mirror of
https://github.com/discourse/discourse.git
synced 2025-03-28 07:47:53 +08:00
FIX: In Firefox :w autocomplete was broken
Always use hasOwnProperty as opposed to [] on hash objects, {} has a "watch" function in Firefox
This commit is contained in:
parent
ef5d56a258
commit
8b9c7da571
@ -46,23 +46,29 @@ var search = function(term, options) {
|
||||
|
||||
Discourse.Emoji.search = search;
|
||||
|
||||
var urlFor = function(code) {
|
||||
var url = _extendedEmoji[code];
|
||||
if (!url && emoji.indexOf(code) !== -1) {
|
||||
url = Discourse.getURL('/plugins/emoji/images/' + code + '.png');
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
Discourse.Emoji.urlFor = urlFor;
|
||||
|
||||
var emojiHash = {};
|
||||
emoji.forEach(function(code){
|
||||
emojiHash[code] = true;
|
||||
});
|
||||
|
||||
var urlFor = function(code) {
|
||||
var url;
|
||||
if(_extendedEmoji.hasOwnProperty(code)) {
|
||||
url = _extendedEmoji[code];
|
||||
}
|
||||
|
||||
if (!url && emojiHash.hasOwnProperty(code)) {
|
||||
url = Discourse.getURL('/plugins/emoji/images/' + code + '.png');
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
Discourse.Emoji.urlFor = urlFor;
|
||||
|
||||
|
||||
Discourse.Emoji.exists = function(code){
|
||||
return !!(_extendedEmoji[code] || emojiHash[code]);
|
||||
return !!(_extendedEmoji.hasOwnProperty(code) || emojiHash.hasOwnProperty(code));
|
||||
}
|
||||
|
||||
function imageFor(code) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user