Greasy Fork

Greasy Fork is available in English.

百度贴吧我的贴吧跳转到我的帖子

替换百度贴吧的“我的贴吧”链接,使其跳转到“我的贴子”页面

当前为 2019-10-26 提交的版本,查看 最新版本

// ==UserScript==
// @name         百度贴吧我的贴吧跳转到我的帖子
// @namespace    https://osu.ppy.sh/u/376831
// @version      1.0
// @description  替换百度贴吧的“我的贴吧”链接,使其跳转到“我的贴子”页面
// @author       wcx19911123
// @match       *tieba.baidu.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    var myTieba = 0;
    var eventId = null;
    function doIt(){
        myTieba = 0;
        eventId = setInterval(function(){
            $("li.u_itieba a").each(function(){
                if($(this).html().indexOf("我的贴吧")>-1){
                    //console.log($(this).attr("href"));
                    $(this).attr("href","http://tieba.baidu.com/i/i/my_tie");
                    $(this).attr("target","_blank");
                    myTieba++;
                }
            });
            if(myTieba > 0){
                clearInterval(eventId);
            }
        },500);
    }
    doIt();
})();