-
-
Save ticky/60af5a3074f5b3dfe2a8e0abfc121142 to your computer and use it in GitHub Desktop.
This file contains 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
!((webpackJsonp) => { | |
// <https://gist.github.com/ticky/91d4e075a690e3d9db90d9bd095c71e8> | |
return (injectedModule) => { | |
if (!webpackJsonp) { | |
throw new Error("Can't find Webpack!"); | |
} | |
const modName = btoa(+new Date); | |
const fakeModule = (mod, exp, require) => { | |
// Run injected module | |
injectedModule(mod, exp, require); | |
// Delete ourselves | |
delete require.m[modName]; | |
delete require.c[modName]; | |
}; | |
webpackJsonp([], { [modName]: fakeModule }, [modName]); | |
}; | |
})(window.webpackJsonp)((module, exports, require) => { | |
let searchModuleIndex = 0; | |
let searchModule; | |
window.require = require; | |
Object.keys(require.c).find((moduleId) => { | |
let searchModule = require(searchModuleIndex); | |
}); | |
do { | |
searchModule = require(searchModuleIndex); | |
// Find Mastodon's "emoji" module | |
if (searchModule.default && searchModule.buildCustomEmojis) { | |
break; | |
} | |
searchModuleIndex++; | |
} while (searchModule); | |
if (!searchModule) { | |
console.log('Mastodon emoji module not found'); | |
return; | |
} | |
// Pass emoji straight through because | |
// screw all that image nonsense, yo | |
searchModule.default = (t) => t; | |
console.log('Mastodon emoji module replaced! 💜'); | |
}); |
This file contains 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
(e=>o=>{if(!e)throw new Error("Can't find Webpack!");const d=btoa(+new Date);e([],{[d]:(e,n,t)=>{o(e,n,t),delete t.m[d],delete t.c[d]}},[d])})(window.webpackJsonp)((e,o,d)=>{let n,t=0;window.require=d,Object.keys(d.c).find(e=>{d(t)});do{if((n=d(t)).default&&n.buildCustomEmojis)break;t++}while(n);n?(n.default=(e=>e),console.log("Mastodon emoji module replaced! 💜")):console.log("Mastodon emoji module not found")}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment