// ==UserScript== // @name Twemoji Everywhere // @namespace pointydev // @author pointydev // @match http*://*/* // @inject-into content // @grant GM_addStyle // @version 0.1.0 // @homepageURL https://gist.github.com/pointydev/f2d96ec634f393286593dc92bee19efc // @updateURL https://gist.github.com/pointydev/f2d96ec634f393286593dc92bee19efc/raw/twemoji_everywhere.user.js // @icon https://twemoji.maxcdn.com/v/latest/72x72/1f603.png // @require https://twemoji.maxcdn.com/v/latest/twemoji.min.js // @description Replaces the browser emoji implementation with Twemoji // ==/UserScript== const parser = function(node) { twemoji.parse(node.target, { folder: 'svg', ext: '.svg', className: "pointydev-twemoji" }); }; const update = function(mutation, observer) { mutation.forEach(parser); }; const observer = new MutationObserver(update); try { GM_addStyle("img.pointydev-twemoji {height: 1em; width: 1em; margin: 0 .05em 0 .1em; vertical-align: -0.1em;}"); observer.observe(document.body, {subtree: true, childList: true, characterData: true}); parser({target: document.body}); console.info("%c[Twemoji Everywhere]", "color: #1DA1F2; font-style: bold", "Initialised!"); } catch(e) { observer.disconnect() console.warn("%c[Twemoji Everywhere]", "color: #1DA1F2; font-style: bold", "Failed to initialise!\n", e); };