Merge pull request #566 from glowing-bear/emojione

Twemoji => Emojione
This commit is contained in:
Lorenz Hübschle-Schneider 2015-03-22 13:14:48 +01:00
commit 399b3af9f4
6 changed files with 23 additions and 26 deletions

View file

@ -539,12 +539,19 @@ li.buffer.indent.private a {
user-select: none;
}
/* Scales emoji to font size */
img.emoji {
.emojione {
font-size: inherit;
height: 1em;
width: 1em;
margin: 0 .05em 0 .1em;
vertical-align: -0.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) {

View file

@ -1,6 +1,6 @@
<form class="form form-horizontal" id="inputform" ng-submit="sendMessage()">
<div class="input-group">
<textarea id="{{inputId}}" class="form-control favorite-font" ng-trim="false" rows="1" autocomplete="on" ng-model="command" ng-focus="hideSidebar()">
<textarea id="{{inputId}}" class="form-control favorite-font" ng-trim="false" rows="1" ng-change="inputChanged()" autocomplete="on" ng-model="command" ng-focus="hideSidebar()">
</textarea>
<span class="input-group-btn">
<button class="btn btn-default btn-primary unselectable">Send</button>

View file

@ -36,6 +36,7 @@
<script type="text/javascript" src="js/websockets.js"></script>
<script type="text/javascript" src="js/models.js"></script>
<script type="text/javascript" src="js/plugins.js"></script>
<script src="//cdn.jsdelivr.net/emojione/1.3.0/lib/js/emojione.min.js"></script>
<script type="text/javascript" src="3rdparty/favico-0.3.5.min.js"></script>
</head>
<body ng-controller="WeechatCtrl" ng-keydown="handleKeyPress($event)" ng-keyup="handleKeyRelease($event)" ng-keypress="handleKeyPress($event)" ng-class="{'no-overflow': connected}" lang="en-US">

View file

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

View file

@ -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.

View file

@ -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
*/