git ssb

16+

Dominic / patchbay



Commit 638952804a57a1897527c5068701efd5fee36915

Add missing suggest-emoji.js

cel committed on 11/24/2016, 12:02:37 PM
Parent: f33727e2f7b90f3e6eeb9525bd45edd414d371e0

Files changed

modules_extra/suggest-emoji.jsadded
modules_extra/suggest-emoji.jsView
@@ -1,0 +1,19 @@
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 +}

Built with git-ssb-web