Обговорення » Creation Requests
Parse [e]...[/e] tags
something like this:
// ==UserScript==
// @name eehex
// @namespace greasyforum
// @description replace [e]XXXX[/e] with &#xXXXX;
// @include https://greasyfork.org/*/forum/discussion/*
// @include file:///E:/RES/testo.htm
// @run-at document-end
// ==/UserScript==
var re=/\[e]([0-9a-fA-F].+?)\[\/e]/g;
function eehex(s){
return s.replace(re,
function(m, p1){ return '&#x'+p1+';'; }
);
}
var eeserver = new MutationObserver(function(muts) {
var m, t, tc;
for( var i=0; i<muts.length ; i++){
if( !(m=muts[i]) && !(t=m.target)) continue;
var nn=m.addedNodes, n, nl=nn.length;
for( var j=0; j<nl ; j++){
if( (n=nn[j]) && (tc=n.innerHTML) ){
if ( re.test(tc) ) n.innerHTML=eehex(tc);
}
}}
});
if(document.body && ~document.body.innerHTML.indexOf('[/e]'))
document.body.innerHTML=eehex(document.body.innerHTML);
eeserver.observe(document, { attributes: true, subtree:true, childList: true } );
? ? ?
? code updated [e]1f600[/e] [e]1F637[/e]
now works as intended [e]1f60e[/e]
✘✖✗ Alas, Chrome can't show unicode smiles ✙✝✞
-
Sorry for my late reply, I was away for some days ;)
Gonna try it asap! Thanks
[e]1f609[/e]
Indeed :( probable some missing fonts in Chrome :(
Parse [e]...[/e] tags
Hi there,
Sometimes, I come across posts (typically in a forum where you can post from web-based interface or from an Android app) where 'smilies' or 'emojis' appear as a sequence of [e]...hex value...[/e] instead of the proper Unicode character.
Could it be possible to write a script that intercepts those sequences and convert them to the corresponding Unicode character before display? (maybe dependant of the browser/OS, I dunno)
Thanks in advance :)