LeetCode-cn竞赛页面跳转

从竞赛页面跳转至问题页面

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

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 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.

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

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         LeetCode-cn竞赛页面跳转
// @namespace    http://tampermonkey.net/
// @version      1.2
// @description  从竞赛页面跳转至问题页面
// @author       Weng
// @match        https://leetcode-cn.com/contest/*/problems/*/
// @icon         https://www.google.com/s2/favicons?domain=leetcode-cn.com
// @grant        none
// ==/UserScript==

(function() {
    var href = location.href.replace(/contest\/.*problems\//, "problems/")
    var btn = `<a class="btn btn-success" href="${href}"> 跳转问题页面</a>`
    document.querySelector('.btn-default').insertAdjacentHTML('afterend', btn)
})();