Replace text to emoticon using javascript
4 posters
Page 1 of 1
Replace text to emoticon using javascript
There's some code for replace a text to a image (emoticon)?
Last edited by Chavo on March 20th 2014, 6:01 am; edited 1 time in total
Re: Replace text to emoticon using javascript
Hi
Please clarify which texts.
If you want it easier, why don't you just use an html tag of an image or bbcode for it?
Regards,
Pizza Boi
Please clarify which texts.
If you want it easier, why don't you just use an html tag of an image or bbcode for it?
- Code:
For HTML
<img src="IMG Link here" title="Title of image" />
- Code:
For BBC
[img]IMG Link[/img]
Regards,
Pizza Boi
Pizza Boi- Hyperactive
- Posts : 2016
Reputation : 160
Language : French
Location : Pizza Hut!
Re: Replace text to emoticon using javascript
It's for replace a text for a emoticon i've forgote to mention that
Re: Replace text to emoticon using javascript
Hi
If you're using the new editor (Which is pretty obvious) When you click on the "Switch Editor Mode", there's that option when you input a "" emoticon for example, it will automatically change into that smiley. The "Switch Editor Mode" is located on the lower part and in the most right side if it's in the quick reply and for the "Post Reply".
Regards,
Pizza Boi
If you're using the new editor (Which is pretty obvious) When you click on the "Switch Editor Mode", there's that option when you input a "" emoticon for example, it will automatically change into that smiley. The "Switch Editor Mode" is located on the lower part and in the most right side if it's in the quick reply and for the "Post Reply".
Regards,
Pizza Boi
Pizza Boi- Hyperactive
- Posts : 2016
Reputation : 160
Language : French
Location : Pizza Hut!
Re: Replace text to emoticon using javascript
I know...
I wanna imput new emoticons via javascript without add by the commom way.
I have a javascript but it change by the title of the image (alt) and any image with the same title is changeg into the emoticons. I wanna do it by text.
I wanna imput new emoticons via javascript without add by the commom way.
I have a javascript but it change by the title of the image (alt) and any image with the same title is changeg into the emoticons. I wanna do it by text.
Re: Replace text to emoticon using javascript
Hi
Can you put there that code so we can try to edit it.
Can you put there that code so we can try to edit it.
Re: Replace text to emoticon using javascript
- Code:
var Smileys;
Smileys = {
'Lara com Z' : 'http://i738.photobucket.com/albums/xx29/forummultix/emoticons/Lara7_zps32c7c5d6.gif',
'Gretchen' : 'http://i738.photobucket.com/albums/xx29/forummultix/emoticons/gretchensaindo_zpsbb7eafc6.gif',
'Falta de sacanagem' : 'http://i738.photobucket.com/albums/xx29/forummultix/emoticons/putafaltadesacanagem_zps162a2df9.gif',
};
$(function() {
$.each(Smileys, function(key, value) {
$('img[alt="' + key + '"]').attr('src', value);
});
});
Re: Replace text to emoticon using javascript
Hi
I'm not really good at javascript... but wouldn't declaring in the alt an image link or something like \('[img.][/img]'\) do justice?
Sorry for not being of much help with this one.
Regards,
Pizza Boi
I'm not really good at javascript... but wouldn't declaring in the alt an image link or something like \('[img.][/img]'\) do justice?
Sorry for not being of much help with this one.
Regards,
Pizza Boi
Pizza Boi- Hyperactive
- Posts : 2016
Reputation : 160
Language : French
Location : Pizza Hut!
Re: Replace text to emoticon using javascript
Hello Chavo,
The most I can come up with is this :
* Placement should be in the topics
We replace the text in a post with an image element.
The most I can come up with is this :
* Placement should be in the topics
- Code:
$(function() {
var c = document.getElementsByClassName('entry-content');
for (i=0; i<c.length; i++) {
c[i].innerHTML = c[i].innerHTML.replace(/:cool:/g,'<img src="http://2img.net/i/fa/i/smiles/icon_cool.gif"/>');
c[i].innerHTML = c[i].innerHTML.replace(/:sad:/g,'<img src="http://2img.net/i/fa/i/smiles/icon_sad.gif"/>');
}
});
We replace the text in a post with an image element.
Re: Replace text to emoticon using javascript
Thank you!!! It works!! I've tested many codes i found on web but it won't work, but SO MANY THANKS!!
Similar topics
» Replace text to emoticon (on Forumotion)
» Replace post time text from English to other
» How to Change the Text Colour in JavaScript
» Problem with javascript which change text in index_body template
» Making Javascript word count box have a different text input colour
» Replace post time text from English to other
» How to Change the Text Colour in JavaScript
» Problem with javascript which change text in index_body template
» Making Javascript word count box have a different text input colour
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum