Browse Source

Fixed recent emoji problems

master
Igor Zhukov 11 years ago
parent
commit
76871b65d3
  1. 33
      app/vendor/jquery.emojiarea/jquery.emojiarea.js

33
app/vendor/jquery.emojiarea/jquery.emojiarea.js vendored

@ -172,8 +172,13 @@
This function was added by Igor Zhukov to save recent used emojis. This function was added by Igor Zhukov to save recent used emojis.
*/ */
util.emojiInserted = function (emojiKey, menu) { util.emojiInserted = function (emojiKey, menu) {
var curEmojisStr = localStorage.getItem('emojis_recent'), try {
curEmojis = curEmojisStr && curEmojisStr.split(',') || [], var curEmojisStr = localStorage.getItem('emojis_recent');
} catch (e) {
return false;
}
var curEmojis = curEmojisStr && curEmojisStr.split(',') || [],
pos = curEmojis.indexOf(emojiKey); pos = curEmojis.indexOf(emojiKey);
if (!pos) { if (!pos) {
@ -608,14 +613,16 @@
} }
} }
} else { } else {
var curEmojis = (localStorage.getItem('emojis_recent') || '').split(','), try {
key, i; var curEmojis = (localStorage.getItem('emojis_recent') || '').split(','),
for (i = 0; i < curEmojis.length; i++) { key, i;
key = curEmojis[i] for (i = 0; i < curEmojis.length; i++) {
if (options[key]) { key = curEmojis[i]
html.push('<a href="javascript:void(0)" title="' + util.htmlEntities(key) + '">' + EmojiArea.createIcon(options[key]) + '<span class="label">' + util.htmlEntities(key) + '</span></a>'); if (options[key]) {
html.push('<a href="javascript:void(0)" title="' + util.htmlEntities(key) + '">' + EmojiArea.createIcon(options[key]) + '<span class="label">' + util.htmlEntities(key) + '</span></a>');
}
} }
} } catch (e) {}
} }
this.$items.html(html.join('')); this.$items.html(html.join(''));
@ -632,8 +639,12 @@
*/ */
EmojiMenu.prototype.updateRecentTab = function(curEmojis) { EmojiMenu.prototype.updateRecentTab = function(curEmojis) {
if (curEmojis === undefined) { if (curEmojis === undefined) {
var curEmojisStr = localStorage.getItem('emojis_recent'); try {
curEmojis = curEmojisStr && curEmojisStr.split(',') || []; var curEmojisStr = localStorage.getItem('emojis_recent');
curEmojis = curEmojisStr && curEmojisStr.split(',') || [];
} catch (e) {
curEmojis = [];
}
} }
if (this.hasRecent != (curEmojis.length > 1)) { if (this.hasRecent != (curEmojis.length > 1)) {

Loading…
Cancel
Save