{lamp/}
{collapse-item label="略过知乎、csdn、简书、掘金、gitee、微博安全中心中间页站外链接直达跳转,CSDN免登录复制" open}
动态监测整个页面链接变化,略过知乎、csdn、简书、掘金、gitee、微博安全中心中间页站外链接直接跳转。解除csdn未登录复制限制,移除知乎、csdn的强制登陆弹窗,getbootstrap4中文网及上述网站去除冗余的广告
{/collapse-item}
{collapse-item label="代码"}
//初始化页面
async function main (){for(const even in host){if(path ==host[even].url){eval(host[even].fun);
console.log(host[even].name);
break;
}
}
}
//在时间线拉到下面动态获取新的问答的时候,Dom 会变化,所以动态监测页面dom变化并检查替换。
async function mo () /观察到变动时执行回调函数
async function callback (mutationsList, observer) / Use traditional 'for loops' for IE 11
for(const mutation of mutationsList) {if (mutation.type === 'childList') {console.log('A child node has been added or removed.');
}
else if (mutation.type === 'attributes') {console.log('The ' + mutation.attributeName + ' attribute was modified.');
}
}
await main();
}
const config = {'attributes': false,
'childList': true,
'subtree': true
};
// 以上述配置开始观察目标节点
const promise = new Promise((resolve, reject) => {const observe = new MutationObserver(callback);
resolve(observe);
})
promise.then(observe => observe.observe(document.body,config));
}
main().then(async () => await mo());
})();{/collapse-item}
{dotted startColor="#ff6c6c" endColor="#1989fa"/}
©版权声明
THE END


暂无评论内容