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)) {
$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'),
);
}
}

View File

@ -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"
}
}

View File

@ -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: './'}
)

View File

@ -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);