From c152294184fdc19b367174ccbc03a6d96ec3437e Mon Sep 17 00:00:00 2001 From: Emupedia Date: Tue, 14 Jan 2020 10:03:24 +0200 Subject: [PATCH] More work --- beta/emuos/css/chat.css | 85 +++-------------------------------------- beta/emuos/js/chat.js | 31 +++++++-------- 2 files changed, 21 insertions(+), 95 deletions(-) diff --git a/beta/emuos/css/chat.css b/beta/emuos/css/chat.css index 036cdf29..09365b4a 100644 --- a/beta/emuos/css/chat.css +++ b/beta/emuos/css/chat.css @@ -79,7 +79,7 @@ #client_room_users .emoji { width: 14px; - vertical-align: bottom; + vertical-align: middle; } #client_room { @@ -115,9 +115,8 @@ /*noinspection DuplicatedCode*/ #client_output .emoji { - position: fixed; - width: 14px; - vertical-align: bottom; + height: 14px; + vertical-align: middle; -webkit-transition: all 0.5s; -moz-transition: all 0.5s; @@ -125,31 +124,12 @@ -o-transition: all 0.5s; transition: all 0.5s; + transform: scale(1); z-index: 1; } -#client_container #client_output div > .emoji { - -webkit-animation-iteration-count: 1; - -moz-animation-iteration-count: 1; - -ms-animation-iteration-count: 1; - -o-animation-iteration-count: 1; - animation-iteration-count: 1; - - -webkit-animation-duration: 1.5s; - -moz-animation-duration: 1.5s; - -ms-animation-duration: 1.5s; - -o-animation-duration: 1.5s; - animation-duration: 1.5s; - - -webkit-animation-name: ZoomOut; - -moz-animation-name: ZoomOut; - -ms-animation-name: ZoomOut; - -o-animation-name: ZoomOut; - animation-name: ZoomOut; -} - #client_output div > .emoji:hover { - width: 84px; + transform: scale(6); } #client_input { @@ -171,59 +151,4 @@ padding: 0; overflow: hidden; vertical-align: top; -} - -/*noinspection DuplicatedCode*/ -@-webkit-keyframes ZoomOut { - 0% { - width: 84px; - } - - 100% { - width: 14px; - } -} - -/*noinspection DuplicatedCode*/ -@-moz-keyframes ZoomOut { - 0% { - width: 84px; - } - - 100% { - width: 14px; - } -} - -/*noinspection DuplicatedCode*/ -@-ms-keyframes ZoomOut { - 0% { - width: 84px; - } - - 100% { - width: 14px; - } -} - -/*noinspection DuplicatedCode*/ -@-o-keyframes ZoomOut { - 0% { - width: 84px; - } - - 100% { - width: 14px; - } -} - -/*noinspection DuplicatedCode*/ -@keyframes ZoomOut { - 0% { - width: 84px; - } - - 100% { - width: 14px; - } } \ No newline at end of file diff --git a/beta/emuos/js/chat.js b/beta/emuos/js/chat.js index 9f2fced3..9366171a 100644 --- a/beta/emuos/js/chat.js +++ b/beta/emuos/js/chat.js @@ -31,25 +31,24 @@ return hash >>> 0; }; - net.str_replace = function(search, replace, subject, countObj) { + // noinspection DuplicatedCode + net.str_replace = function(search, replace, subject) { var i = 0; var j = 0; + var k = 0; var temp = ''; var repl = ''; var sl = 0; var fl = 0; var f = [].concat(search); + var ff = []; + var ffl = 0; var r = [].concat(replace); var s = subject; var ra = Object.prototype.toString.call(r) === '[object Array]'; var sa = Object.prototype.toString.call(s) === '[object Array]'; s = [].concat(s); - var $global = (typeof window !== 'undefined' ? window : global); - $global.$locutus = $global.$locutus || {}; - var $locutus = $global.$locutus; - $locutus.php = $locutus.php || {}; - if (typeof (search) === 'object' && typeof (replace) === 'string') { temp = replace; replace = []; @@ -63,10 +62,6 @@ ra = Object.prototype.toString.call(r) === '[object Array]'; } - if (typeof countObj !== 'undefined') { - countObj.value = 0; - } - for (i = 0, sl = s.length; i < sl; i++) { if (s[i] === '') { continue; @@ -74,12 +69,16 @@ for (j = 0, fl = f.length; j < fl; j++) { temp = s[i] + ''; - repl = ra ? (r[j] !== undefined ? r[j] : '') : r[0]; - s[i] = (temp).split(f[j]).join(repl); + repl = ra ? (typeof r[j] !== 'undefined' ? r[j] : '') : r[0]; + ff = temp.split(' '); - if (typeof countObj !== 'undefined') { - countObj.value += ((temp.split(f[j])).length - 1); + for (k = 0, ffl = ff.length; k < ffl; k++) { + if (ff[k] === f[j]) { + ff[k] = repl; + } } + + s[i] = ff.join(' '); } } @@ -87,7 +86,9 @@ }; net.normalize = function(str) { - return twemoji.parse(net.str_replace(search, replace, $('
').text(str.replace(/[\u0300-\u036F\u1AB0-\u1AFF\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F\u0483-\u0486\u05C7\u0610-\u061A\u0656-\u065F\u0670\u06D6-\u06ED\u0711\u0730-\u073F\u0743-\u074A\u0F18-\u0F19\u0F35\u0F37\u0F72-\u0F73\u0F7A-\u0F81\u0F84\u0e00-\u0eff\uFC5E-\uFC62]{2,}/gi, '')).html()), { + var subject = $('
').text(str.replace(/[\u0300-\u036F\u1AB0-\u1AFF\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F\u0483-\u0486\u05C7\u0610-\u061A\u0656-\u065F\u0670\u06D6-\u06ED\u0711\u0730-\u073F\u0743-\u074A\u0F18-\u0F19\u0F35\u0F37\u0F72-\u0F73\u0F7A-\u0F81\u0F84\u0e00-\u0eff\uFC5E-\uFC62]{2,}/gi, '')).html(); + + return twemoji.parse(net.str_replace(search, replace, subject), { folder: 'svg', ext: '.svg' });