Greasy Fork is available in English.

百度贴吧不可能会跳转!

去除贴吧帖子里链接的跳转

您查看的为 2014-06-27 提交的版本。查看 最新版本

// ==UserScript==
// @id             tieba_url_no_jump
// @name           百度贴吧不可能会跳转!
// @version        1.3
// @namespace      jiayiming
// @author         jiayiming
// @description    去除贴吧帖子里链接的跳转
// @include        http://tieba.baidu.com/p/*
// @include        http://tieba.baidu.com/f?ct*
// @homepageURL    https://greasyfork.org/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].innerHTML;
        if (url.indexOf("http") < 0)
            url = "http://" + urls[i].innerHTML;
        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);