mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
prep work for emoji versioning
This commit is contained in:
parent
5551676fef
commit
57b1f002d1
@ -1,7 +1,9 @@
|
|||||||
var emoji = <%= Dir.glob(File.expand_path("../../../public/images/*.png", __FILE__)).map{|f| File.basename(f).split(".")[0]}.inspect %>;
|
|
||||||
|
|
||||||
// TODO @robin to move this whole thing to es6
|
// TODO @robin to move this whole thing to es6
|
||||||
Discourse.Emoji = {};
|
Discourse.Emoji = {};
|
||||||
|
// bump up this number to expire all emojis
|
||||||
|
Discourse.Emoji.ImageVersion = "0"
|
||||||
|
|
||||||
|
var emoji = <%= Dir.glob(File.expand_path("../../../public/images/*.png", __FILE__)).map{|f| File.basename(f).split(".")[0]}.inspect %>;
|
||||||
|
|
||||||
var _extendedEmoji = {};
|
var _extendedEmoji = {};
|
||||||
Discourse.Dialect.registerEmoji = function(code, url) {
|
Discourse.Dialect.registerEmoji = function(code, url) {
|
||||||
@ -46,6 +48,7 @@ var search = function(term, options) {
|
|||||||
|
|
||||||
Discourse.Emoji.search = search;
|
Discourse.Emoji.search = search;
|
||||||
|
|
||||||
|
|
||||||
var emojiHash = {};
|
var emojiHash = {};
|
||||||
emoji.forEach(function(code){
|
emoji.forEach(function(code){
|
||||||
emojiHash[code] = true;
|
emojiHash[code] = true;
|
||||||
@ -57,7 +60,7 @@ var urlFor = function(code) {
|
|||||||
url = _extendedEmoji[code];
|
url = _extendedEmoji[code];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!url && emojiHash.hasOwnProperty(code)) {
|
if(!url && emojiHash.hasOwnProperty(code)) {
|
||||||
url = Discourse.getURL('/plugins/emoji/images/' + code + '.png');
|
url = Discourse.getURL('/plugins/emoji/images/' + code + '.png');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,6 +68,10 @@ var urlFor = function(code) {
|
|||||||
url = Discourse.CDN + url;
|
url = Discourse.CDN + url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(url){
|
||||||
|
url = url + "?v=" + Discourse.Emoji.ImageVersion;
|
||||||
|
}
|
||||||
|
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user