Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
//META{"name":"maganedevgithub"}*//
const maganedevgithub = function() {};
maganedevgithub.prototype.vars = {
className: 'magane-script',
src: 'https://bobbywibowo.github.io/Magane/dist/magane.min.js?_=1613150310',
unloadIds: [
'maganeContainer',
'localStorageIframe'
],
unloadStyles: [
'/** Magane: global.css **/',
'/** Magane: main.scss **/'
]
};
maganedevgithub.prototype.start = function() {
// Try to unload first.
maganedevgithub.prototype.stop();
const element = document.createElement('script');
element.className = maganedevgithub.prototype.vars.className;
element.setAttribute('src', maganedevgithub.prototype.vars.src);
document.head.appendChild(element);
};
maganedevgithub.prototype.stop = function() {
// Destroy script tags
document.querySelectorAll('head script.' + maganedevgithub.prototype.vars.className).forEach(e => {
e.parentNode.removeChild(e);
});
// Destroy APIs
if (typeof window.magane !== 'undefined') {
delete window.magane;
}
// Destroy elements
for (const id of maganedevgithub.prototype.vars.unloadIds) {
const element = document.getElementById(id);
if (element) {
element.parentNode.removeChild(element);
}
}
// Destroy styles
document.querySelectorAll('head style[type="text/css"]').forEach(e => {
const match = maganedevgithub.prototype.vars.unloadStyles.some(s => e.innerText.startsWith(s));
if (match) {
e.parentNode.removeChild(e);
}
});
};
maganedevgithub.prototype.getName = function() { return 'Magane-DEV-GITHUB'; };
maganedevgithub.prototype.getDescription = function() { return 'Bringing LINE stickers to Discord in a chaotic way.'; };
maganedevgithub.prototype.getVersion = function() { return '3.1.1-DEV-GITHUB'; };
maganedevgithub.prototype.getAuthor = function() { return 'Kana'; };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment