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.
![What should I add to this code assignments change the caption of the photo. 7459021l](https://2img.net/h/prikachi.com/images/21/7459021l.jpg)
![What should I add to this code assignments change the caption of the photo. 7459021l](https://2img.net/h/prikachi.com/images/21/7459021l.jpg)
- 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 ![:rose:](/users/3412/19/22/63/smiles/2084913611.gif)
Topic archived
Have a good day ! ^^
![:rose:](/users/3412/19/22/63/smiles/2084913611.gif)
Topic archived
Have a good day ! ^^
![-](https://2img.net/i/empty.gif)
» How to change the caption edit of the photo
» Change code for YouTube
» i need to change the position of this code
» Change Code: to something else
» How to change this code?
» Change code for YouTube
» i need to change the position of this code
» Change Code: to something else
» How to change this code?
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum