跳到正文

剪贴板

剪贴板 dcwt2uo1

原文
剪贴板信息

剪贴板信息

收录
更新

luogu.com 自动跳转

因为在专栏、剪贴板、帖子里显示“从‘洛谷’跳转到‘洛谷’”很烦,所以我(洛谷743373)做了这个脚本。

JavaScript
// ==UserScript==
// @name         洛谷.com自动跳转
// @namespace    http://tampermonkey.net/
// @version      1919.810
// @description  因为在专栏里显示“从‘洛谷’跳转到‘洛谷’”很烦,所以我(洛谷743373)做了这个脚本,部分代码转载。
// @author       sz_jinzikai
// @match        *://*.luogu.com.cn/article/*
// @match        *://*.luogu.com.cn/discuss/*
// @match        *://*.luogu.com.cn/paste/*
// @icon         https://cdn.luogu.com.cn/upload/usericon/743373.png
// ==/UserScript==

(function() {
    'use strict';
    let a = document.URL;
    let t = document.documentElement.outerHTML;
    let b = "";
    for (let i = 0; i < a.length; i++) {
        if (i < a.length - 3 && a[i] == '.' && a[i + 1] == 'c' && a[i + 2] == 'n') i += 2;
        else b += a[i];
    }
    if (t.indexOf(b) >= 0) {
        window.location.replace(b);
    }
})();