From 13a7292377cf16d14a475b9cdbac18d29d20d6ce Mon Sep 17 00:00:00 2001 From: Nick Gordon Date: Tue, 26 Nov 2013 21:49:53 -0800 Subject: [PATCH] emoji works, huzzah. addresses #681, #1840, and some discussion in #1908 --- bower.json | 4 +++- public/js/directives/directives.js | 12 +++++++++--- public/manifest.json | 4 +++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/bower.json b/bower.json index 5a3ad43ed9..a54c855e4f 100644 --- a/bower.json +++ b/bower.json @@ -35,7 +35,9 @@ "github-buttons": "git://github.com/mdo/github-buttons.git", "marked": "~0.2.9", "JavaScriptButtons": "git://github.com/paypal/JavaScriptButtons.git#master", - "Angular-At-Directive": "git://github.com/snicker/Angular-At-Directive#master" + "Angular-At-Directive": "git://github.com/snicker/Angular-At-Directive#master", + "js-emoji": "git://github.com/iamcal/js-emoji#master", + "gemoji": "git://github.com/github/gemoji" }, "resolutions": { "jquery": "~2.0.3", diff --git a/public/js/directives/directives.js b/public/js/directives/directives.js index d808790b7a..b5a35a69c1 100644 --- a/public/js/directives/directives.js +++ b/public/js/directives/directives.js @@ -81,12 +81,18 @@ habitrpg.directive('habitrpgSortable', ['User', function(User) { // return hljs.highlightAuto(code).value; // } }); + + emoji.img_path = 'bower_components/gemoji/images/emoji/unicode/'; var toHtml = function (markdown) { if (markdown == undefined) return ''; - - return marked(markdown); + + markdown = marked(markdown); + markdown = emoji.replace_colons(markdown); + markdown = emoji.replace_unified(markdown); + + return markdown; }; // [nickgordon20131123] this hacky override wraps images with a link to the image in a new window, and also adds some classes in case we want to style @@ -133,7 +139,7 @@ habitrpg.directive('habitrpgSortable', ['User', function(User) { + '>'; } } - + //hljs.tabReplace = ' '; return { diff --git a/public/manifest.json b/public/manifest.json index de6a0bef8b..6354c04520 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -16,6 +16,7 @@ "bower_components/Angular-At-Directive/src/at.js", "bower_components/Angular-At-Directive/src/caret.js", "bower_components/angular-bindonce/bindonce.js", + "bower_components/js-emoji/emoji.js", "bower_components/bootstrap/docs/assets/js/bootstrap.js", "bower_components/angular-bootstrap/ui-bootstrap.js", @@ -59,7 +60,8 @@ "css": [ "bower_components/bootstrap/docs/assets/css/bootstrap.css", "app.css", - "bower_components/habitrpg-shared/dist/spritesheets.css" + "bower_components/habitrpg-shared/dist/spritesheets.css", + "bower_components/js-emoji/emoji.css" ] }, "static": {