Greasy Fork is available in English.
去除贴吧帖子里链接的跳转
当前为
// ==UserScript==
// @id tieba_url_no_jump
// @name 百度贴吧不可能会跳转!
// @version 1.4
// @namespace jiayiming
// @author jiayiming
// @description 去除贴吧帖子里链接的跳转
// @include http://tieba.baidu.com/p/*
// @include http://tieba.baidu.com/f?ct*
// @homepageURL http://greasyfork.icu/scripts/783/
// @run-at document-end
// ==/UserScript==
function run() {
var urls = document.querySelectorAll('a[href^="http://jump.bdimg.com/safecheck"]');
for (var i = 0; i < urls.length; i++) {
var url = urls[i].childNodes[0].nodeValue;
if (url.indexOf("http") < 0)
url = "http://" + url;
//console.log(url);
urls[i].setAttribute("href", url);
}
}
function addMutationObserver(selector, callback) {
var watch = document.querySelector(selector);
if (!watch) return;
var observer = new MutationObserver(function(mutations){
var nodeAdded = mutations.some(function(x){ return x.addedNodes.length > 0; });
if (nodeAdded) {
// observer.disconnect();
callback();
}
});
observer.observe(watch, {childList: true, subtree: true});
}
run();
addMutationObserver('#j_p_postlist', run);