Files: d7acb5062b990c4d876df857fbd8a3b29bf7d2cb / modules_extra / suggest-emoji.js
611 bytesRaw
1 | var plugs = require('../plugs') |
2 | var emoji_url = plugs.first(exports.emoji_url = []) |
3 | var emoji_names = plugs.first(exports.emoji_names = []) |
4 | |
5 | exports.suggest_mentions = function (word, cb) { |
6 | if (word[0] !== ':' || word.length < 2) return cb() |
7 | word = word.substr(1) |
8 | if (word[word.length-1] === ':') word = word.substr(0, word.length-1) |
9 | cb(null, emoji_names().filter(function (name) { |
10 | return name.substr(0, word.length) === word |
11 | }).slice(0, 50).map(function (emoji) { |
12 | return { |
13 | image: emoji_url(emoji), |
14 | title: emoji, |
15 | subtitle: emoji, |
16 | value: ':' + emoji + ':' |
17 | } |
18 | })) |
19 | } |
20 |
Built with git-ssb-web