2015-08-28 15:00:39 +01:00
|
|
|
function insert_emoticons(ident, classes) {
|
2015-08-24 17:54:23 +01:00
|
|
|
classes = classes || "";
|
|
|
|
$(ident).each(function() {
|
2015-08-25 10:45:40 +01:00
|
|
|
decoder = image_decoder.images;
|
|
|
|
for (var i = 0; i < decoder.length; i++) {
|
|
|
|
key = Object.keys(decoder[i]);
|
|
|
|
image = decoder[i][key];
|
|
|
|
key = "(" + key + ")";
|
2015-08-24 21:42:23 +01:00
|
|
|
$(this).html($(this).html().replace(key,
|
2015-08-25 16:10:44 +01:00
|
|
|
"<img class='" + classes + "' style='height: 30px; width: auto;' src='" + image + "'/>"
|
2015-08-24 17:54:23 +01:00
|
|
|
));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2015-08-28 15:00:39 +01:00
|
|
|
function markdown_decoder(ident) {
|
2015-08-25 12:12:13 +01:00
|
|
|
decoder = image_decoder.images;
|
|
|
|
for (var i = 0; i < decoder.length; i++) {
|
|
|
|
raw_key = Object.keys(decoder[i]);
|
|
|
|
image = decoder[i][raw_key];
|
|
|
|
key = "(" + raw_key + ")";
|
2015-08-25 14:27:00 +01:00
|
|
|
$(ident).val($(ident).val().replace(key,
|
2015-08-25 12:12:13 +01:00
|
|
|
"![" + raw_key + "](" + image + ")"
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-08-25 14:55:24 +01:00
|
|
|
console.log("Hipchat-emoticons-for-all is enabled.");
|
2015-08-24 21:42:23 +01:00
|
|
|
|
2015-08-24 17:54:23 +01:00
|
|
|
var image_decoder = %image_decoder%
|