failed to make Script
3 posters
Page 1 of 1
failed to make Script
hello i have find that Script somewhere on the internet for forumotion to replace any image link by
%27%20+%20link.href%20+%20%27
i tried
link.href
but failed i tried *.* failed too so is there a way to fix it
im also thinking about making a Script to replace youtube links to show the vedio insted of vedio link like the image replacer
- Code:
[img]the image link[/img]
- Code:
$(function() {
var links = $('.postbody a', document.getElementById('main-content')), reg = /\.(?:png|jpeg|jpg|gif)$/i;
for(var i = 0, link; (link = links[i++]); ) {
if(reg.test(link.href)) {
link.innerHTML = '[img]%27%20+%20link.href%20+%20%27[/img]';
}
}
});
- Code:
[img]%27%20+%20link.href%20+%20%27[/img]
%27%20+%20link.href%20+%20%27
i tried
link.href
but failed i tried *.* failed too so is there a way to fix it
im also thinking about making a Script to replace youtube links to show the vedio insted of vedio link like the image replacer
Michael_vx- Forumember
- Posts : 659
Reputation : 29
Language : Arabic and some English
Location : Egypt
Re: failed to make Script
Are you talking about when you are posting images and videos? If yes, then you can use the WYSIWYG mode in the editor.
Lost Founder's Password |Forum's Utilities |Report a Forum |General Rules |FAQ |Tricks & Tips
You need one post to send a PM.
You need one post to send a PM.
When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
Re: failed to make Script
may be something was missed
after post sent
what i meant by image is when i post dierct image link
like this https://i.servimg.com/u/f21/16/89/96/68/slgray10.png
it should be replaced with the Script to be
after post sent
what i meant by image is when i post dierct image link
like this https://i.servimg.com/u/f21/16/89/96/68/slgray10.png
it should be replaced with the Script to be
- Code:
[img]http://i21.servimg.com/u/f21/16/89/96/68/slgray10.png[/img]
Michael_vx- Forumember
- Posts : 659
Reputation : 29
Language : Arabic and some English
Location : Egypt
Re: failed to make Script
bump
any way to solve the main problem ?
any way to solve the main problem ?
- Code:
$(function() {
var links = $('.postbody a', document.getElementById('main-content')), reg = /\.(?:png|jpeg|jpg|gif)$/i;
for(var i = 0, link; (link = links[i++]); ) {
if(reg.test(link.href)) {
link.innerHTML = '[img]%27%20+%20link.href%20+%20%27[/img]';
}
}
});
Michael_vx- Forumember
- Posts : 659
Reputation : 29
Language : Arabic and some English
Location : Egypt
Re: failed to make Script
Hi @Michael_vx,
The reference to link.href is in string notation, so the string is only going to print "link.href" and not the href value of link. You need to concat link between the two strings like this :
The reference to link.href is in string notation, so the string is only going to print "link.href" and not the href value of link. You need to concat link between the two strings like this :
- Code:
$(function() {
var links = $('.postbody a', document.getElementById('main-content')), reg = /\.(?:png|jpeg|jpg|gif)$/i;
for(var i = 0, link; (link = links[i++]); ) {
if(reg.test(link.href)) {
link.innerHTML = '[img]' + link.href + '[/img]';
}
}
});
Re: failed to make Script
thats a good news thanks for that info i think i have a lot to learn
now the link appear as same link i post but the image wont show
http://miclap.logu2.com/t2-topic
i still not sure what he reson
now the link appear as same link i post but the image wont show
http://miclap.logu2.com/t2-topic
i still not sure what he reson
Michael_vx- Forumember
- Posts : 659
Reputation : 29
Language : Arabic and some English
Location : Egypt
Re: failed to make Script
Oh right, silly me.. I should've noticed you were using bbcode tags. You need to use the HTML image tag instead, as bbcode is only parsed server-side.
- Code:
$(function() {
var links = $('.postbody a', document.getElementById('main-content')), reg = /\.(?:png|jpeg|jpg|gif)$/i;
for(var i = 0, link; (link = links[i++]); ) {
if(reg.test(link.href)) {
link.innerHTML = '<img src="' + link.href + '"/>';
}
}
});
Re: failed to make Script
i think im the silly one
i stuck in a little small thing i scrow up everything
i dont know how to thank you for this big help
you are the life savior
this topic is now solved
only when you close the the topic wish me luck of my next Script that should do the same thing with youtube
thanks again for giving me the hand in solving this
Michael_vx- Forumember
- Posts : 659
Reputation : 29
Language : Arabic and some English
Location : Egypt
Re: failed to make Script
No problem. ^^
Topic archived
Have a good weekend.
If you need any additional references these are some good sources for learning :
https://developer.mozilla.org/en-US/docs/Web/JavaScript
http://www.quackit.com/
http://www.w3schools.com/
Topic archived
Have a good weekend.
If you need any additional references these are some good sources for learning :
https://developer.mozilla.org/en-US/docs/Web/JavaScript
http://www.quackit.com/
http://www.w3schools.com/
Similar topics
» Is it possible to make a progress bar script.
» Suggested Script (Need Someone that can read script)
» register Script (I Need The Script)
» HTTPS Has Failed
» Admin login failed
» Suggested Script (Need Someone that can read script)
» register Script (I Need The Script)
» HTTPS Has Failed
» Admin login failed
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum