From a7713307739cea9b3c975acb7ec5b44077b734c0 Mon Sep 17 00:00:00 2001 From: Dmitriy Simushev Date: Thu, 25 Sep 2014 13:07:36 +0000 Subject: [PATCH] Switch to emojify.js lib Emojify.js play nice with simple smiles like :-) and ;D --- Plugin.php | 4 ++-- bower.json | 2 +- gulpfile.js | 6 +++--- js/plugin.js | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Plugin.php b/Plugin.php index f0f5c60..2efa7ad 100644 --- a/Plugin.php +++ b/Plugin.php @@ -67,7 +67,7 @@ class Plugin extends \Mibew\Plugin\AbstractPlugin implements \Mibew\Plugin\Plugi if ($this->isAppropriatePage($request)) { $base_path = $request->getBasePath() . '/' . $this->getFilesPath(); $args['js'][] = $base_path . '/components/es5-shim/es5-shim.js'; - $args['js'][] = $base_path . '/components/emoji-images/emoji-images.js'; + $args['js'][] = $base_path . '/components/emojify.js/emojify.js'; $args['js'][] = $base_path . '/js/plugin.js'; } } @@ -99,7 +99,7 @@ class Plugin extends \Mibew\Plugin\AbstractPlugin implements \Mibew\Plugin\Plugi if ($this->isAppropriatePage($request)) { $args['plugins']['MibewEmoji'] = array( 'imagesDir' => ($request->getBasePath() . '/' . $this->getFilesPath() - . '/components/emoji-images/pngs'), + . '/components/emojify.js/images/emoji'), ); } } diff --git a/bower.json b/bower.json index c3bd960..fa6d11e 100644 --- a/bower.json +++ b/bower.json @@ -4,7 +4,7 @@ "private": true, "dependencies": {}, "devDependencies": { - "emoji-images": "https://github.com/HenrikJoreteg/emoji-images.git#154d7641a7f93699afbd7b4934c490837b8b5973", + "emojify.js": "~0.9.4", "es5-shim": "~4.0.3" } } diff --git a/gulpfile.js b/gulpfile.js index 16c22f4..73e9128 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -50,9 +50,9 @@ var getSources = function() { 'js/*', 'css/*', 'components/es5-shim/es5-shim.js', - 'components/emoji-images/emoji-images.js', - 'components/emoji-images/readme.md', - 'components/emoji-images/pngs/*' + 'components/emojify.js/emojify.js', + 'components/emojify.js/README.md', + 'components/emojify.js/images/emoji/*' ], {base: './'} ) diff --git a/js/plugin.js b/js/plugin.js index c7507db..d7e4aee 100644 --- a/js/plugin.js +++ b/js/plugin.js @@ -16,7 +16,7 @@ * limitations under the License. */ -(function (Mibew) { +(function (Mibew, emojify) { // Initialize separated Marionette.js module for the plugin. var module = Mibew.Application.module( 'MibewEmojiPlugin', @@ -37,7 +37,7 @@ Mibew.Application.Invitation.on(eventsMap); module.addInitializer(function() { - var imagesDir = Mibew.PluginOptions.MibewEmoji.imagesDir; + emojify.setConfig({'img_dir': Mibew.PluginOptions.MibewEmoji.imagesDir}); // Update message body right after it is added to the messages // collection. @@ -47,9 +47,9 @@ if (kind == model.KIND_USER || kind == model.KIND_AGENT) { model.set( 'message', - emoji(model.get('message'), imagesDir) + emojify.replace(model.get('message')) ); } }); }); -})(Mibew); +})(Mibew, emojify);