why watch youtube inside discord...
This commit is contained in:
parent
44669f44c6
commit
23f1493d0a
24
js/main.js
24
js/main.js
|
@ -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];
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue