dob
Scriptwright
|
Well, something like this I guess:
var codes = [":mellow:", ":huh:", ":happy:", ":ohmy:", ":wink:", ":tongue:", ":biggrin:", ":laugh:", ":cool:", ":rolleyes:", ":omg:", ":smile:", ":wub:", ":mad:", ":sad:", ":unsure:", ":wacko:", ":blink:", ":ph34r:", ":stubborn:", ":blush:", ":alien:", ":boxing:", ":console:", ":cry:", ":devil:", ":dribble:", ":ermm:", ":fallen:", ":flowers:", ":group:", ":hammer:", ":hehe:", ":hug:", ":innocent:", ":kiss:", ":nuke:", ":pinch:", ":pooh:", ":shifty:", ":showoff:", ":sick:", ":sleeping:", ":throb:", ":thumbsup:", ":urgent:", ":w00t:", ":whistling:", ":worthy:", ":xmas:", ":yawn:", ":crazy:", ":clap:", ":sweating:", ":music:", ":smart:", ":dance:", ":punk:", ":grr:", ":spam:", ":tease:", ":whoa:", ":yahoo:", ":thumbsdown:", ":wave:", ":zipped:", ":rofl:", ":shrug:", ":loool:", ":help:", ":XD:", ":birthday:", ":eek:", ":verymad:", ":eyebrows:", ":grinnn:", ":sly:", ":oro:", ":dry:", ":cooly:", ":victory:", ":aniwink:"];
var images = ["mellow.gif", "huh.gif", "happy.gif", "ohmy.gif", "wink.gif", "tongue.gif", "biggrin.gif", "laugh.gif", "cool.gif", "rolleyes.gif", "omg.gif", "smile.gif", "wub.gif", "mad.gif", "sad.gif", "unsure.gif", "wacko.gif", "blink.gif", "ph34r.gif", "stubborn.gif", "blush.gif", "alien.gif", "boxing.gif", "console.gif", "cry.gif", "devil.gif", "dribble.gif", "ermm.gif", "fallen.gif", "flowers.gif", "group.gif", "hammer.gif", "hehe.gif", "hug.gif", "innocent.gif", "kiss.gif", "nuke.gif", "pinch.gif", "pooh.gif", "shifty.gif", "showoff.gif", "sick.gif", "sleeping.gif", "throb.gif", "thumbsup.gif", "urgent.gif", "w00t.gif", "whistling.gif", "worthy.gif", "xmas.gif", "yawn.gif", "crazy.gif", "clap.gif", "sweating.gif", "music.gif", "smart.gif", "dance.gif", "punk.gif", "grr.gif", "spam.gif", "tease.gif", "whoa.gif", "yahoo.gif", "thumbsdown.gif", "wave.gif", "zipped.gif", "rofl.gif", "shrug.gif", "loool.gif", "help.gif", "XD.gif", "birthday.gif", "eek.gif", "verymad.gif", "eyebrows.gif", "grinnn.gif", "sly.gif", "oro.gif", "dry.gif", "cooly.gif", "victory.gif", "aniwink.gif"];
var src = "http://www.createblog.com/forums/style_emoticons/default/";
function add(text) {
var ta = document.getElementsByTagName("textarea")[0];
if (!ta) return;
var start = ta.selectionStart;
var end = ta.selectionEnd;
var _text = ta.substring(start, end);
if (_text == 0) {
ta.value = (_text + src + text);
start = start + (src.length + text.length);
}
}
var form = document.getElementsByTagName("form")[0];
form.addEventListener("submit", function(e) {
e.preventDefault();
e.stopPropagation();
var ta = this.getElementsByTagName("textarea")[0];
for (var i=0; i<codes.length; i++) {
ta.value = ta.value.replace(codes[i], images[i]);
}
this.submit();
}, false);
Ah, I see. My script is useless. Doesn't work and it's not even needed anymore. Well, whatever 
|