summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authormodmew8 <modmew8@gmail.com>2018-02-03 09:09:35 +0100
committerLauris BH <lauris@nix.lv>2018-02-03 10:09:35 +0200
commite08b3a592e80baeab1a6d7d5f87bed343ff14e1e (patch)
treefeb7f19d723c3400398e2d5a19fccb81e13470cb /templates
parentb62ce2e24655e2d9316770d4eb342b823111fe0e (diff)
downloadgitea-e08b3a592e80baeab1a6d7d5f87bed343ff14e1e.tar.gz
gitea-e08b3a592e80baeab1a6d7d5f87bed343ff14e1e.zip
Emoji Autocomplete (#3433)
* Implemented emoji autocomplete. * Changed emoji access url. * Reverted vendor css to default, moved all style changes to _tribute.less * Made no-results overwriteable, added missing autocomplete to edit issue field. Signed-off-by: modmew8 <modmew8@gmail.com>
Diffstat (limited to 'templates')
-rw-r--r--templates/base/footer.tmpl32
1 files changed, 32 insertions, 0 deletions
diff --git a/templates/base/footer.tmpl b/templates/base/footer.tmpl
index 73914e6a7e..70691659ff 100644
--- a/templates/base/footer.tmpl
+++ b/templates/base/footer.tmpl
@@ -89,6 +89,38 @@
issuesTribute.attach(document.getElementById('content'))
</script>
{{end}}
+ <script>
+ var emojiTribute = new Tribute({
+ collection: [{
+ trigger: ':',
+ requireLeadingSpace: true,
+ values: function (text, cb) {
+ var array = emojify.emojiNames;
+ var data = [];
+ for(var j=0; j<array.length; j++) {
+ if(array[j].indexOf(text) !== -1) {
+ data.push(array[j]);
+ if(data.length > 5) {
+ break;
+ }
+ }
+ }
+ cb(data);
+ },
+ lookup: function (item) {
+ return item;
+ },
+ selectTemplate: function (item) {
+ if (typeof item === 'undefinied') return null;
+ return ':' + item.original + ':';
+ },
+ menuItemTemplate: function (item) {
+ return '<img class="emoji" src="{{AppSubUrl}}/vendor/plugins/emojify/images/' + item.original + '.png"/>' + item.original;
+ }
+ }]
+ });
+ emojiTribute.attach(document.getElementById('content'))
+ </script>
{{end}}
<script src="{{AppSubUrl}}/vendor/plugins/autolink/autolink.js"></script>
<script src="{{AppSubUrl}}/vendor/plugins/emojify/emojify.min.js"></script>