What should I add to this code assignments change the caption of the photo.
2 posters
Page 1 of 1
What should I add to this code assignments change the caption of the photo.
What should I add to this code assignments change the caption of the photo.
- Code:
$(function() {
var replace1 = 'Трябва да си регистриран за да виждаш линковете..';
var replace2 = 'Вие нямате права за сваляне !';
var replace3 = '$1Свален $2 пъти.';
var post = $('.postbody div');
var atbox = $('.attachbox');
var reg1 = /\[You must be.*?to see this [A-Z]+.\]/ig;
var reg2 = /You don't have permission to download attachments./ig;
var reg3 = /(\(\d+ [A-Z]+\)) Downloaded (\d+) times/ig;
for (i=0;i<post.length;i++)if(reg1.test(post[i].innerHTML))post[i].innerHTML=post[i].innerHTML.replace(reg1,replace1);
for (i=0;i<atbox.length;i++)if(reg2.test(atbox[i].innerHTML) || reg3.test(atbox[i].innerHTML))atbox[i].innerHTML=atbox[i].innerHTML.replace(reg2,replace2).replace(reg3,replace3);
});
Re: What should I add to this code assignments change the caption of the photo.
Hello smurfavr,
I simplified the code for you, replace your script by :
In the script you'll see :
Replace Attachments text by the texts you want to display.
Explanation :
To replace texts simply write replaceText();, between the parenthesis you'll fill out the following information in order :
Element : The element the texts are inside
Reg : The regular expression to search for the texts
Rep : The replacement for the searched texts
When done your result should be :
I simplified the code for you, replace your script by :
- Code:
$(function() {
replaceText('.postbody div', /\[You must be.*?to see this [A-Z]+.\]/ig, 'Трябва да си регистриран за да виждаш линковете..');
replaceText('.attachbox', /You don't have permission to download attachments./ig, 'Вие нямате права за сваляне !');
replaceText('.attachbox', /(\(\d+ [A-Z]+\)) Downloaded (\d+) times/ig, '$1 Свален $2 пъти.');
replaceText('.attachbox', /Attachments/g, 'Attachments text');
function replaceText(element, reg, rep){var el=$('.post '+element);for(i=0;i<el.length;i++)if(reg.test(el[i].innerHTML))el[i].innerHTML=el[i].innerHTML.replace(reg,rep)}
});
In the script you'll see :
- Code:
replaceText('.attachbox', /Attachments/g, 'Attachments text');
Replace Attachments text by the texts you want to display.
Explanation :
To replace texts simply write replaceText();, between the parenthesis you'll fill out the following information in order :
Element : The element the texts are inside
Reg : The regular expression to search for the texts
Rep : The replacement for the searched texts
When done your result should be :
- Code:
replaceText('.attachbox', /Attachments/g, 'Attachments text');
Re: What should I add to this code assignments change the caption of the photo.
Thank you Ange Tuteur.Everything works.
Re: What should I add to this code assignments change the caption of the photo.
You're welcome
Topic archived
Have a good day ! ^^
Topic archived
Have a good day ! ^^
Similar topics
» i need to change the position of this code
» i need to change direction of this code
» How to change this code?
» Change box code
» Change Code: to something else
» i need to change direction of this code
» How to change this code?
» Change box code
» Change Code: to something else
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum