Greasy Fork

Greasy Fork is available in English.

献给安康

即时跳转所有百度贴吧跳转链接至主域名(大力飞砖版)

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         献给安康
// @namespace    https://github.com/yourname
// @version      2.1
// @description  即时跳转所有百度贴吧跳转链接至主域名(大力飞砖版)
// @author       YXY
// @match        *://jump.bdimg.com/*
// @match        *://jump2.bdimg.com/*
// @match        *://jump3.bdimg.com/*
// @run-at       document-start
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';
    const domainMapper = {
        getFullPath: () => window.location.href.split('.bdimg.com')[1]  || '/',
        buildTargetUrl: function() {
            return 'https://tieba.baidu.com'  + this.getFullPath()
        },
        // 执行即时跳转
        execute: function() {
            if (window.self  === window.top)  {
                window.stop();
                location.replace(this.buildTargetUrl());
            }
        }
    }
    domainMapper.execute();
})();