diff --git a/css/glowingbear.css b/css/glowingbear.css index bda2406..f90c001 100644 --- a/css/glowingbear.css +++ b/css/glowingbear.css @@ -539,12 +539,19 @@ li.buffer.indent.private a { user-select: none; } -/* Scales emoji to font size */ -img.emoji { - height: 1em; - width: 1em; - margin: 0 .05em 0 .1em; - vertical-align: -0.1em; +.emojione { + font-size: inherit; + height: 1em; + width: 1.1em; + min-height: 16px; + min-width: 16px; + display: inline-block; + margin: -.2ex .15em .2ex; + line-height: normal; + vertical-align: middle; +} +img.emojione { + width: auto; } @media (min-width: 1400px) { diff --git a/directives/input.html b/directives/input.html index e373298..afcf580 100644 --- a/directives/input.html +++ b/directives/input.html @@ -1,6 +1,6 @@
- diff --git a/index.html b/index.html index 03aa1f2..b9ce305 100644 --- a/index.html +++ b/index.html @@ -36,6 +36,7 @@ + diff --git a/js/filters.js b/js/filters.js index 9317af4..0e1246d 100644 --- a/js/filters.js +++ b/js/filters.js @@ -141,11 +141,11 @@ weechat.filter('getBufferQuickKeys', function () { }; }); -// Emojifis the string using https://github.com/twitter/twemoji +// Emojifis the string using https://github.com/Ranks/emojione weechat.filter('emojify', function() { return function(text, enable_JS_Emoji) { if (enable_JS_Emoji === true) { - return twemoji.parse(text); + return emojione.unicodeToImage(text); } else { return(text); } diff --git a/js/glowingbear.js b/js/glowingbear.js index ba1353e..ecd5a19 100644 --- a/js/glowingbear.js +++ b/js/glowingbear.js @@ -36,7 +36,7 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', 'fontsize': '14px', 'fontfamily': (utils.isMobileUi() ? 'sans-serif' : 'Inconsolata, Consolas, Monaco, Ubuntu Mono, monospace'), 'readlineBindings': false, - 'enableJSEmoji': false, + 'enableJSEmoji': (utils.isMobileUi() ? false : true), 'enableMathjax': false, }); $scope.settings = settings; @@ -385,22 +385,6 @@ weechat.controller('WeechatCtrl', ['$rootScope', '$scope', '$store', '$timeout', } }); - // To reduce loading times for users who don't want twemoji, - // load it only if the setting is enabled. - // This also fires when the page is loaded. - settings.addCallback('enableJSEmoji', function(enabled) { - if (enabled && !$rootScope.twemoji_init) { - // Load twemoji only once - $rootScope.twemoji_init = true; - (function() { - var script = document.createElement("script"); - script.type = "text/javascript"; - script.src = "//twemoji.maxcdn.com/twemoji.min.js"; - document.getElementsByTagName("head")[0].appendChild(script); - })(); - } - }); - // To prevent unnecessary loading times for users who don't // want MathJax, load it only if the setting is enabled. // This also fires when the page is loaded if enabled. diff --git a/js/inputbar.js b/js/inputbar.js index ab4394a..6f6daf0 100644 --- a/js/inputbar.js +++ b/js/inputbar.js @@ -23,6 +23,11 @@ weechat.directive('inputBar', function() { IrcUtils, settings) { + // E.g. Turn :smile: into the unicode equivalent + $scope.inputChanged = function() { + $scope.command = emojione.shortnameToUnicode($scope.command); + }; + /* * Returns the input element */