анимированные.
// ==UserScript==
// @name Подпесь
// @namespace linux.org.ru
// @include http://www.linux.org.ru/forum/*
// ==/UserScript==
//smiles
function Smiles() {
var site = "http://www.kolobok.us/smiles/standart/";
var smiles = {
"*acute*":"acute.gif",
"*aggressive*":"aggressive.gif",
"*agree*":"agree.gif",
"*air_kiss*":"air_kiss.gif",
"*bad*":"bad.gif",
"*beee*":"beee.gif",
"*black_eye*":"black_eye.gif",
"*blum2*":"blum2.gif",
"*blum3*":"blum3.gif",
"*blush2*":"blush2.gif",
"*blush*":"blush.gif",
"*boast*":"boast.gif",
"*boredom*":"boredom.gif",
"*censored*":"censored.gif",
"*clapping*":"clapping.gif",
"*cray2*":"cray2.gif",
"*cray*":"cray.gif",
"*dance2*":"dance2.gif",
"*dance3*":"dance3.gif",
"*dance4*":"dance4.gif",
"*dance*":"dance.gif",
"*declare*":"declare.gif",
"*derisive*":"derisive.gif",
"*dirol*":"dirol.gif",
"*dntknw*":"dntknw.gif",
"*don-t_mention*":"don-t_mention.gif",
"*download*":"download.gif",
"*drinks*":"drinks.gif",
"*fool*":"fool.gif",
"*friends*":"friends.gif",
"*good2*":"good2.gif",
"*good3*":"good3.gif",
"*good*":"good.gif",
"*grin*":"grin.gif",
"*heat*":"heat.gif",
"*help*":"help.gif",
"*i-m_so_happy*":"i-m_so_happy.gif",
"*ireful1*":"ireful1.gif",
"*ireful2*":"ireful2.gif",
"*ireful3*":"ireful3.gif",
"*kiss*":"kiss.gif",
"*laugh*":"laugh1.gif",
"*laugh2*":"laugh2.gif",
"*laugh3*":"laugh3.gif",
"*lazy2*":"lazy2.gif",
"*lazy3*":"lazy3.gif",
"*lazy*":"lazy.gif",
"*mda*":"mda.gif",
"*meeting*":"meeting.gif",
"*mosking*":"mosking.gif",
"*nea*":"nea.gif",
"*negative*":"negative.gif",
"*no2*":"no2.gif",
"*not_i*":"not_i.gif",
"*offtopic*":"offtopic.gif",
"*ok*":"ok.gif",
"*pardon*":"pardon.gif",
"*party*":"party.gif",
"*pleasantry*":"pleasantry.gif",
"*polling*":"polling.gif",
"*popcorm1*":"popcorm1.gif",
"*popcorm2*":"popcorm2.gif",
"*punish2*":"punish2.gif",
"*punish*":"punish.gif",
"*read*":"read.gif",
"*resent*":"resent.gif",
"*rofl*":"rofl.gif",
"*sad*":"sad.gif",
"*scare2*":"scare2.gif",
"*scare*":"scare.gif",
"*sclerosis*":"sclerosis.gif",
"*scratch_one-s_head*":"scratch_one-s_head.gif",
"*search*":"search.gif",
"*secret*":"secret.gif",
"*padonak*":"SHABLON_padonak_04.gif",
"*SHABLON_padonak_05*":"SHABLON_padonak_05.gif",
"*SHABLON_padonak_06*":"SHABLON_padonak_06.gif",
"*shout*":"shout.gif",
"*smile*":"smile3.gif",
"*smoke*":"smoke.gif",
"*snooks*":"snooks.gif",
"*sorry2*":"sorry2.gif",
"*sorry*":"sorry.gif",
"*stink*":"stink.gif",
"*stop*":"stop.gif",
"*superstition*":"superstition.gif",
"*swoon2*":"swoon2.gif",
"*swoon*":"swoon.gif",
"*take_example*":"take_example.gif",
"*taunt*":"taunt.gif",
"*thank_you2*":"thank_you2.gif",
"*thank_you*":"thank_you.gif",
"*this*":"this.gif",
"*threaten*":"threaten.gif",
"*to_clue*":"to_clue.gif",
"*tongue*":"tongue.gif",
"*to_take_umbrage*":"to_take_umbrage.gif",
"*umnik2*":"umnik2.gif",
"*umnik*":"umnik.gif",
"*unsure*":"unsure.gif",
"*victory*":"victory.gif",
"*whistle2*":"whistle2.gif",
"*whistle3*":"whistle3.gif",
"*whistle*":"whistle.gif",
"*wink3*":"wink3.gif",
"*yahoo*":"yahoo.gif",
"*yes2*":"yes2.gif",
"*yes3*":"yes3.gif",
"*yes4*":"yes4.gif",
"*yes*":"yes.gif",
"*yu*":"yu.gif"
}
var thiz = this;
this.subtitute = function(i, node) {
if(node.nodeName == "#text") {
var str = node.nodeValue;
var parsed = [];
for(var i = 0; i >= 0 && i < str.length; ) {
i = str.indexOf("*", i);
if(i < 0) {
break;
}
var end = str.indexOf("*", i + 1) + 1;
if(end < 1) {
break;
}
var smile = str.substring(i, end);
var gif = smiles[smile.toLowerCase()];
//console.debug(smile);
if(smile && gif) {
parsed.push({
s: i,
e: end,
gif: gif
});
}
i = end + 1;
}
//замена
var parent = node.parentNode;
for(var i = parsed.length - 1; i >= 0 ; --i) {
var p = parsed[i];
var text = node.splitText(p.s);
text.deleteData(0, p.e - p.s);//удаление смайла
var img = document.createElement("img");
img.src = site + p.gif;
parent.insertBefore(img, text);
}
}
for(var i = 0 ; i < node.childNodes.length; ++i) {
thiz.subtitute(i, node.childNodes[i]);
}
}
this.createMenu = function(handler) {
var menu = document.createElement("div");
for(var s in smiles) {
var se = document.createElement("img");
se.src = site + smiles[s];
se.addEventListener("click", (function(s){
return function(){handler(s)};
})(s), false);
menu.appendChild(se);
}
return menu;
}
}
try{
var smiles = new Smiles();
var jQuery = unsafeWindow.jQuery;
jQuery(".msg_body p").each(smiles.subtitute);
var msg = document.getElementById("msg");
var menu = smiles.createMenu(function(smile) {
var val = msg.value;
var s = msg.selectionStart;
var e = msg.selectionEnd;
msg.value = val.substring(0, s) + smile + val.substring(s, val.length);
});
msg.parentNode.insertBefore(menu, msg);
} catch(e) {
// console.debug(e);
}
Вот как выглядит форма отправки:
http://img153.imageshack.us/img153/3406/55203891.png
Вот результат: