Atcoder to Luogu

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

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

Bạn sẽ cần cài đặt một tiện ích mở rộng như Tampermonkey hoặc Violentmonkey để cài đặt kịch bản này.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(Tôi đã có Trình quản lý tập lệnh người dùng, hãy cài đặt nó!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Atcoder to Luogu
// @namespace    Perfect-Izayoi-Sakuya
// @version      0.4
// @description  在 AT 题目界面显示两个通往洛谷该题目的题面 / 题解的按钮
// @author       LaoMang
// @license      MIT
// @match        https://atcoder.jp/contests/*/tasks/*
// @icon         https://atcoder.jp/favicon.ico
// @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)
})();