2015-08-28 15:00:39 +01:00
|
|
|
function insert_emoticons(ident, classes) {
|
2015-08-24 17:54:23 +01:00
|
|
|
classes = classes || "";
|
2015-08-28 15:52:12 +01:00
|
|
|
decoder = image_decoder.images;
|
2015-09-22 15:54:27 +01:00
|
|
|
console.log("Replacing " + $(ident).length + " instances of " + ident);
|
2015-08-24 17:54:23 +01:00
|
|
|
$(ident).each(function() {
|
2015-08-25 10:45:40 +01:00
|
|
|
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-09-25 11:04:36 +01:00
|
|
|
"<img class='" + classes + "' style='height: 28px; width: auto;' src='" + image + "'/>"
|
2015-08-24 17:54:23 +01:00
|
|
|
));
|
|
|
|
}
|
|
|
|
});
|
2015-08-28 15:52:12 +01:00
|
|
|
console.log("Swapped " + ident);
|
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-28 15:52:12 +01:00
|
|
|
console.log("Hipchat-emoticons-for-all is enabled on " + location.href);
|
2015-08-24 21:42:23 +01:00
|
|
|
|
2015-09-22 15:54:27 +01:00
|
|
|
var image_decoder = %image_decoder%
|