Sha256: 5c0343286ee4b384973dc0bc4615de33358ff66e82fb1899e5cb1e58815ef395

Contents?: true

Size: 1.09 KB

Versions: 19

Compression:

Stored size: 1.09 KB

Contents

var EmoteHelper = {
  legalEmotes: ['angry', 'arr', 'blink', 'blush', 'brucelee', 'btw', 'chuckle', 'clap', 'cool', 'drool', 'drunk', 'dry', 'eek', 'flex', 'happy', 'holmes', 'huh', 'laugh', 'lol', 'mad', 'mellow', 'noclue', 'oh', 'ohmy', 'ph34r', 'pimp', 'punch', 'realmad', 'rock', 'rofl', 'rolleyes', 'sad', 'scratch', 'shifty', 'shock', 'shrug', 'sleep', 'sleeping', 'smile', 'suicide', 'sweat', 'thumbs', 'tongue', 'unsure', 'w00t', 'wacko', 'whistling', 'wink', 'worship', 'yucky'],

  emoteToImage: function(emote) {
    var result = emote;
    emote = emote.replace(/^:/, '').toLowerCase();
    if (EmoteHelper.legalEmotes.find(function(v) { return v == emote })) {
      result = '<img src="/images/emoticons/#{emote}.gif" alt="#{description}" />'.interpolate({ emote: emote, description: emote });
    }
    return result;
  },

  insertEmotes: function(text) {
    var result = '';
    $A(text.split(/(:[^ ]*)/)).each(function(segment) {
      if (segment && segment.match(/^:/)) {
        segment = EmoteHelper.emoteToImage(segment);
      }
      result += segment;
    });
    return result;
  }
};

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
jschat-0.3.6 lib/jschat/http/public/javascripts/app/helpers/emote_helper.js
jschat-0.3.5 lib/jschat/http/public/javascripts/app/helpers/emote_helper.js
jschat-0.3.3 lib/jschat/http/public/javascripts/app/helpers/emote_helper.js
jschat-0.3.2 lib/jschat/http/public/javascripts/app/helpers/emote_helper.js
jschat-0.3.1 lib/jschat/http/public/javascripts/app/helpers/emote_helper.js
jschat-0.3.0 lib/jschat/http/public/javascripts/app/helpers/emote_helper.js
jschat-0.2.9 lib/jschat/http/public/javascripts/app/helpers/emote_helper.js
jschat-0.2.8 lib/jschat/http/public/javascripts/app/helpers/emote_helper.js
jschat-0.2.7 lib/jschat/http/public/javascripts/app/helpers/emote_helper.js
jschat-0.2.6 lib/jschat/http/public/javascripts/app/helpers/emote_helper.js
jschat-0.2.5 lib/jschat/http/public/javascripts/app/helpers/emote_helper.js
jschat-0.2.4 lib/jschat/http/public/javascripts/app/helpers/emote_helper.js
jschat-0.2.3 lib/jschat/http/public/javascripts/app/helpers/emote_helper.js
jschat-0.2.2 lib/jschat/http/public/javascripts/app/helpers/emote_helper.js
jschat-0.2.1 lib/jschat/http/public/javascripts/app/helpers/emote_helper.js
jschat-0.2.0 lib/jschat/http/public/javascripts/app/helpers/emote_helper.js
jschat-0.1.5 lib/jschat/http/public/javascripts/app/helpers/emote_helper.js
jschat-0.1.2 lib/jschat/http/public/javascripts/app/helpers/emote_helper.js
jschat-0.1.1 lib/jschat/http/public/javascripts/app/helpers/emote_helper.js