Switch to emojify.js lib

Emojify.js play nice with simple smiles like :-) and ;D
This commit is contained in:
Dmitriy Simushev 2014-09-25 13:07:36 +00:00
parent 7eb73f0706
commit a771330773
4 changed files with 10 additions and 10 deletions

View File

@ -67,7 +67,7 @@ class Plugin extends \Mibew\Plugin\AbstractPlugin implements \Mibew\Plugin\Plugi
if ($this->isAppropriatePage($request)) { if ($this->isAppropriatePage($request)) {
$base_path = $request->getBasePath() . '/' . $this->getFilesPath(); $base_path = $request->getBasePath() . '/' . $this->getFilesPath();
$args['js'][] = $base_path . '/components/es5-shim/es5-shim.js'; $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'; $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)) { if ($this->isAppropriatePage($request)) {
$args['plugins']['MibewEmoji'] = array( $args['plugins']['MibewEmoji'] = array(
'imagesDir' => ($request->getBasePath() . '/' . $this->getFilesPath() 'imagesDir' => ($request->getBasePath() . '/' . $this->getFilesPath()
. '/components/emoji-images/pngs'), . '/components/emojify.js/images/emoji'),
); );
} }
} }

View File

@ -4,7 +4,7 @@
"private": true, "private": true,
"dependencies": {}, "dependencies": {},
"devDependencies": { "devDependencies": {
"emoji-images": "https://github.com/HenrikJoreteg/emoji-images.git#154d7641a7f93699afbd7b4934c490837b8b5973", "emojify.js": "~0.9.4",
"es5-shim": "~4.0.3" "es5-shim": "~4.0.3"
} }
} }

View File

@ -50,9 +50,9 @@ var getSources = function() {
'js/*', 'js/*',
'css/*', 'css/*',
'components/es5-shim/es5-shim.js', 'components/es5-shim/es5-shim.js',
'components/emoji-images/emoji-images.js', 'components/emojify.js/emojify.js',
'components/emoji-images/readme.md', 'components/emojify.js/README.md',
'components/emoji-images/pngs/*' 'components/emojify.js/images/emoji/*'
], ],
{base: './'} {base: './'}
) )

View File

@ -16,7 +16,7 @@
* limitations under the License. * limitations under the License.
*/ */
(function (Mibew) { (function (Mibew, emojify) {
// Initialize separated Marionette.js module for the plugin. // Initialize separated Marionette.js module for the plugin.
var module = Mibew.Application.module( var module = Mibew.Application.module(
'MibewEmojiPlugin', 'MibewEmojiPlugin',
@ -37,7 +37,7 @@
Mibew.Application.Invitation.on(eventsMap); Mibew.Application.Invitation.on(eventsMap);
module.addInitializer(function() { 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 // Update message body right after it is added to the messages
// collection. // collection.
@ -47,9 +47,9 @@
if (kind == model.KIND_USER || kind == model.KIND_AGENT) { if (kind == model.KIND_USER || kind == model.KIND_AGENT) {
model.set( model.set(
'message', 'message',
emoji(model.get('message'), imagesDir) emojify.replace(model.get('message'))
); );
} }
}); });
}); });
})(Mibew); })(Mibew, emojify);