Closed Thread Icon

Topic awaiting preservation: Shoutbox smilies (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=24469" title="Pages that link to Topic awaiting preservation: Shoutbox smilies (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Shoutbox smilies <span class="small">(Page 1 of 1)</span>\

 
Ensellitis
Bipolar (III) Inmate

From: New York, USA
Insane since: Feb 2002

posted posted 12-22-2004 03:57

Anyone happen to know the script for clicking on a smilie and it automatically adds it into a form for a shoutbox?

____________________________________________________

Skaarjj
Maniac (V) Mad Scientist

From: :morF
Insane since: May 2000

posted posted 12-22-2004 04:30

Well, to the left of this here reply box, if you click on the 'insert slimies' link, you'll find precisely what you're looking for. All you have to do is hunt it out of the source and see how it works, then write your own. I personally wouldn't suggest copying and pasting, you don't learn anything that way except for a couple of keyboard shortcuts.


Justice 4 Pat Richard

JKMabry
Maniac (V) Inmate

From: raht cheah
Insane since: Aug 2000

posted posted 12-22-2004 05:39

the slimies inserted in the posting interface are only javascript that will insert the text that will then be parsed by the server side script that runs a regex on the text looking for colonEEKcolon and the like then replacing it with the corresponding image tag.

phpBB is an open source bulletin board that you could pick apart to learn how to do that from, javascript and php bits.

Sorry I can't help further than that, I'm a scripting retahd.

Ensellitis
Bipolar (III) Inmate

From: New York, USA
Insane since: Feb 2002

posted posted 12-22-2004 06:29

Ok, after looking at how the Asylum did it, and PHPbb and about 20 other places, I came up with this...

code:
<script language="Javascript" type="text/javascript">
<!-- hide
function insertsmilie(smilieface) {
if (document.shoutit.message.createTextRange && document.shoutit.message.caretPos) {
var caretPos = document.shoutit.message.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? smilieface + ' ' : smilieface;
document.shoutit.message.focus();
} else {
document.shoutit.message.value+=smilieface;
document.shoutit.message.focus();
}
}
// -->
</script>



And the smile:

code:
<span title='Smile'>
<img src='smilies/smile.gif' onClick="Javascript:insertsmilie(':)')" border="0" alt='Smile' />
</span>



I know it's probably poorly written, but it does work. =)

____________________________________________________



(Edited by Ensellitis on 12-22-2004 06:29)

« BackwardsOnwards »

Show Forum Drop Down Menu