Move the addEmoticons jQuery plugin to utils.js
This commit is contained in:
parent
3d7f5eda8e
commit
5a5d3757ea
35
converse.js
35
converse.js
|
@ -90,41 +90,6 @@
|
|||
return [components.shift(), components.join(delimiter)];
|
||||
};
|
||||
|
||||
$.fn.addEmoticons = function () {
|
||||
if (converse.visible_toolbar_buttons.emoticons) {
|
||||
if (this.length > 0) {
|
||||
this.each(function (i, obj) {
|
||||
var text = $(obj).html();
|
||||
text = text.replace(/>:\)/g, '<span class="emoticon icon-evil"></span>');
|
||||
text = text.replace(/:\)/g, '<span class="emoticon icon-smiley"></span>');
|
||||
text = text.replace(/:\-\)/g, '<span class="emoticon icon-smiley"></span>');
|
||||
text = text.replace(/;\)/g, '<span class="emoticon icon-wink"></span>');
|
||||
text = text.replace(/;\-\)/g, '<span class="emoticon icon-wink"></span>');
|
||||
text = text.replace(/:D/g, '<span class="emoticon icon-grin"></span>');
|
||||
text = text.replace(/:\-D/g, '<span class="emoticon icon-grin"></span>');
|
||||
text = text.replace(/:P/g, '<span class="emoticon icon-tongue"></span>');
|
||||
text = text.replace(/:\-P/g, '<span class="emoticon icon-tongue"></span>');
|
||||
text = text.replace(/:p/g, '<span class="emoticon icon-tongue"></span>');
|
||||
text = text.replace(/:\-p/g, '<span class="emoticon icon-tongue"></span>');
|
||||
text = text.replace(/8\)/g, '<span class="emoticon icon-cool"></span>');
|
||||
text = text.replace(/:S/g, '<span class="emoticon icon-confused"></span>');
|
||||
text = text.replace(/:\\/g, '<span class="emoticon icon-wondering"></span>');
|
||||
text = text.replace(/:\/ /g, '<span class="emoticon icon-wondering"></span>');
|
||||
text = text.replace(/>:\(/g, '<span class="emoticon icon-angry"></span>');
|
||||
text = text.replace(/:\(/g, '<span class="emoticon icon-sad"></span>');
|
||||
text = text.replace(/:\-\(/g, '<span class="emoticon icon-sad"></span>');
|
||||
text = text.replace(/:O/g, '<span class="emoticon icon-shocked"></span>');
|
||||
text = text.replace(/:\-O/g, '<span class="emoticon icon-shocked"></span>');
|
||||
text = text.replace(/\=\-O/g, '<span class="emoticon icon-shocked"></span>');
|
||||
text = text.replace(/\(\^.\^\)b/g, '<span class="emoticon icon-thumbs-up"></span>');
|
||||
text = text.replace(/<3/g, '<span class="emoticon icon-heart"></span>');
|
||||
$(obj).html(text);
|
||||
});
|
||||
}
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
var converse = {
|
||||
plugins: {},
|
||||
templates: templates,
|
||||
|
|
35
src/utils.js
35
src/utils.js
|
@ -50,6 +50,41 @@
|
|||
return this;
|
||||
};
|
||||
|
||||
$.fn.addEmoticons = function () {
|
||||
if (converse.visible_toolbar_buttons.emoticons) {
|
||||
if (this.length > 0) {
|
||||
this.each(function (i, obj) {
|
||||
var text = $(obj).html();
|
||||
text = text.replace(/>:\)/g, '<span class="emoticon icon-evil"></span>');
|
||||
text = text.replace(/:\)/g, '<span class="emoticon icon-smiley"></span>');
|
||||
text = text.replace(/:\-\)/g, '<span class="emoticon icon-smiley"></span>');
|
||||
text = text.replace(/;\)/g, '<span class="emoticon icon-wink"></span>');
|
||||
text = text.replace(/;\-\)/g, '<span class="emoticon icon-wink"></span>');
|
||||
text = text.replace(/:D/g, '<span class="emoticon icon-grin"></span>');
|
||||
text = text.replace(/:\-D/g, '<span class="emoticon icon-grin"></span>');
|
||||
text = text.replace(/:P/g, '<span class="emoticon icon-tongue"></span>');
|
||||
text = text.replace(/:\-P/g, '<span class="emoticon icon-tongue"></span>');
|
||||
text = text.replace(/:p/g, '<span class="emoticon icon-tongue"></span>');
|
||||
text = text.replace(/:\-p/g, '<span class="emoticon icon-tongue"></span>');
|
||||
text = text.replace(/8\)/g, '<span class="emoticon icon-cool"></span>');
|
||||
text = text.replace(/:S/g, '<span class="emoticon icon-confused"></span>');
|
||||
text = text.replace(/:\\/g, '<span class="emoticon icon-wondering"></span>');
|
||||
text = text.replace(/:\/ /g, '<span class="emoticon icon-wondering"></span>');
|
||||
text = text.replace(/>:\(/g, '<span class="emoticon icon-angry"></span>');
|
||||
text = text.replace(/:\(/g, '<span class="emoticon icon-sad"></span>');
|
||||
text = text.replace(/:\-\(/g, '<span class="emoticon icon-sad"></span>');
|
||||
text = text.replace(/:O/g, '<span class="emoticon icon-shocked"></span>');
|
||||
text = text.replace(/:\-O/g, '<span class="emoticon icon-shocked"></span>');
|
||||
text = text.replace(/\=\-O/g, '<span class="emoticon icon-shocked"></span>');
|
||||
text = text.replace(/\(\^.\^\)b/g, '<span class="emoticon icon-thumbs-up"></span>');
|
||||
text = text.replace(/<3/g, '<span class="emoticon icon-heart"></span>');
|
||||
$(obj).html(text);
|
||||
});
|
||||
}
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
var utils = {
|
||||
// Translation machinery
|
||||
// ---------------------
|
||||
|
|
Loading…
Reference in New Issue
Block a user