Greasy Fork

Greasy Fork is available in English.

锁帖页跳转Printable

在锁帖页面添加一个跳转到Printable的链接

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         锁帖页跳转Printable
// @namespace    https://fang.blog.miri.site
// @version      0.2
// @description  在锁帖页面添加一个跳转到Printable的链接
// @author       Mr_Fang
// @match        https://www.mcbbs.net/forum.php?mod=viewthread&tid=*
// @match        https://www.mcbbs.net/thread-*
// @grant        none
// ==/UserScript==
 
(function() {
    if (typeof jQuery == 'undefined') {
        console.error("%c脚本“锁帖页跳转Printable”已停止运行:\n无法加载jQuery。", "font-weight:bold");
        return false;
    }
    var tid = null;
    var filename = window.location.href.split("/").slice(window.location.href.split("/").length - 1,window.location.href.split("/").length).toString(String).split(".")[0];
    function GetQueryValue(queryName) {
        var query = decodeURI(window.location.search.substring(1));
        var vars = query.split("&");
        for (var i = 0; i < vars.length; i++) {
            var pair = vars[i].split("=");
            if (pair[0] == queryName) { return pair[1]; }
        }
        return null;
    }
    console.log(filename);
    tid = GetQueryValue('tid');
    if(tid == null){
        filename = filename.split('-');
        tid = filename[1];
    }
    console.log(tid);
 
    jq("#messagetext").append('<p class="alert_btnleft"><a href="/thread-' + tid + '-1-1.html?action=printable">[ 使用Printable查看 ]</a></p>');
})();