Feature/#9 core make scripts only run on url #13
|
@ -5,7 +5,7 @@ registerScript(node => {
|
|||
changeBorderColor(node);
|
||||
removeUnknownUsers(node);
|
||||
}
|
||||
});
|
||||
}, "/requests");
|
||||
|
||||
function changeFollowedStarColor(node) {
|
||||
const starIcon = 'star';
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
let __scripts = [];
|
||||
|
||||
function registerScript(func) {
|
||||
__scripts.push(func);
|
||||
function registerScript(func, pattern = '.*') {
|
||||
__scripts.push({ "function": func, "pattern": pattern });
|
||||
}
|
||||
|
||||
function runScripts(node) {
|
||||
__scripts.forEach(script => script(node));
|
||||
__scripts.forEach(script => {
|
||||
if (window.location.pathname.match(script.pattern)) {
|
||||
script.function(node);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
let observer = new MutationObserver(mutations => {
|
||||
|
|
Loading…
Reference in a new issue