why watch youtube inside discord...

This commit is contained in:
Zack Rauen 2020-03-16 15:12:54 -04:00
parent 44669f44c6
commit 23f1493d0a
2 changed files with 19 additions and 9 deletions

View File

@ -57,13 +57,6 @@
window.localStorage = __proxy;
const oCreateElement = document.createElement;
document.createElement = function() {
const tag = arguments[0];
if (tag.toLowerCase().includes("iframe")) return null;
return Reflect.apply(oCreateElement, this, arguments);
};
const oOpen = XMLHttpRequest.prototype.open;
XMLHttpRequest.prototype.open = function() {
const url = arguments[1];
@ -1392,6 +1385,23 @@ var Utils = class {
observer.observe(document.body, {subtree: true, childList: true});
}
static onAdded(node, callback) {
const observer = new MutationObserver((mutations) => {
for (let m = 0; m < mutations.length; m++) {
const mutation = mutations[m];
const nodes = Array.from(mutation.addedNodes);
const directMatch = nodes.indexOf(node) > -1;
const parentMatch = nodes.some(parent => parent.contains(node));
if (directMatch || parentMatch) {
observer.disconnect();
callback();
}
}
});
observer.observe(document.body, {subtree: true, childList: true});
}
static getNestedProp(obj, path) {
return path.split(/\s?\.\s?/).reduce(function(obj, prop) {
return obj && obj[prop];

4
js/main.min.js vendored

File diff suppressed because one or more lines are too long