From 78f167f5189f8cdfee93b9e2e52f54f2f7d67b9d Mon Sep 17 00:00:00 2001 From: Ryan Lerch Date: Sep 13 2016 08:50:05 +0000 Subject: added missing emojicomplete file --- diff --git a/pagure/static/emoji/emojicomplete.js b/pagure/static/emoji/emojicomplete.js new file mode 100644 index 0000000..3af10fe --- /dev/null +++ b/pagure/static/emoji/emojicomplete.js @@ -0,0 +1,57 @@ +emoji_complete = function(json_url, folder) { + + emojione.imagePathPNG = folder; + emojione.imageType = 'png'; + emojione.sprites = true; + + var emojiStrategy; + if (!emojiStrategy) { + $.getJSON( + json_url, + function( data ) { + emojiStrategy = data; + } + ); + } + + $("textarea").textcomplete([ { + match: /\B:([\-+\w]*)$/, + search: function (term, callback) { + var results = []; + var results2 = []; + var results3 = []; + console.log(emojiStrategy); + $.each(emojiStrategy,function(shortname,data) { + if(shortname.indexOf(term) > -1) { results.push(shortname); } + else { + if((data.aliases !== null) && (data.aliases.indexOf(term) > -1)) { + results2.push(shortname); + } + else if((data.keywords !== null) && (data.keywords.indexOf(term) > -1)) { + results3.push(shortname); + } + } + }); + + if(term.length >= 3) { + results.sort(function(a,b) { return (a.length > b.length); }); + results2.sort(function(a,b) { return (a.length > b.length); }); + results3.sort(); + } + var newResults = results.concat(results2).concat(results3); + + callback(newResults); + }, + template: function (shortname) { + return ':'+shortname+':'; + }, + replace: function (shortname) { + return ':'+shortname+': '; + }, + index: 1, + maxCount: 10 + } + ],{ + footer: 'Browse All»' + }); +};