Atcoder to Luogu

在 AT 题目界面显示两个通往洛谷该题目的题面 / 题解的按钮

当前为 2023-03-27 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Atcoder to Luogu
// @namespace    Perfect-Izayoi-Sakuya
// @version      0.3
// @description  在 AT 题目界面显示两个通往洛谷该题目的题面 / 题解的按钮
// @author       LaoMang
// @license      MIT
// @match        https://atcoder.jp/contests/*/tasks/*
// @icon         https://img.atcoder.jp/assets/logo.png
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    if (window.location.href.split('/').slice(-1) == 'editorial') return
    let t = document.querySelector('span.h2')
    let ele1 = t.childNodes[1].cloneNode(), ele2 = t.childNodes[1].cloneNode()
    ele1.innerHTML = 'Luogu statement'
    ele1.href = '//www.luogu.com.cn/problem/AT_' + window.location.href.split('/').slice(-1)
    ele2.innerHTML = 'Luogu solution'
    ele2.href = '//www.luogu.com.cn/problem/solution/AT_' + window.location.href.split('/').slice(-1)
    t.appendChild(ele1)
    t.innerHTML += '\n'
    t.appendChild(ele2)
})();