Created
April 15, 2022 17:12
-
-
Save cynecx/cdd4c49da796156b393266c39d44b660 to your computer and use it in GitHub Desktop.
Force Native Emoji Font (eg. Apple) on GitHub As Tampermonkey Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function () { | |
| "use strict"; | |
| const originalCustomElements = window.customElements; | |
| const originalPropertyDescriptor = Object.getOwnPropertyDescriptor(window, "customElements"); | |
| const newCustomElements = { | |
| get(name) { | |
| return originalCustomElements.get(name) | |
| }, | |
| define(name, constructor, options) { | |
| if (name === "g-emoji") { | |
| Object.defineProperty(window, 'customElements', originalPropertyDescriptor); | |
| const newConstructor = class extends constructor { | |
| connectedCallback() { | |
| if (this.hasAttribute('tone')) { | |
| this.attributeChangedCallback('tone'); | |
| } | |
| } | |
| }; | |
| return originalCustomElements.define(name, newConstructor, options); | |
| } | |
| return originalCustomElements.define(name, constructor, options); | |
| }, | |
| upgrade(root) { | |
| return originalCustomElements.upgrade(root); | |
| }, | |
| whenDefined(name) { | |
| return originalCustomElements.whenDefined(name); | |
| } | |
| }; | |
| Object.defineProperty(window, 'customElements', { | |
| enumerable: true, | |
| configurable: true, | |
| get: function () { return newCustomElements; } | |
| }); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment