您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
ja
当前为
// ==UserScript== // @name AddLinkToNewAtcoder // @namespace AddLinkToNewAtcoder // @version 1.3 // @author Luzhiled // @description ja // @include http://*atcoder.jp/* // @include https://*atcoder.jp/* // @grant none // ==/UserScript== (function() { 'use strict'; function ConvertToNewAtcodersURL() { let pathName = location.pathname; let query = location.search; if (pathName.match(/settings/) || pathName.match(/users/)) { return 'https://beta.atcoder.jp' + pathName; } if (location.href.match(/contest.atcoder.jp/)) { let contestName = location.href.replace(/^https?:\/\//, '').split('.')[0]; pathName = pathName.replace(/assignments/g, "tasks"); pathName = pathName.replace(/\/all/g, ""); query = query.replace(/user_screen_name/g, "f.User"); pathName = pathName.replace(/editorial/g, ""); pathName = pathName.replace(/statistics/g, ""); return 'https://beta.atcoder.jp/contests/' + contestName + pathName + query; } else { console.log(pathName); console.log(query); pathName = pathName.replace(/contest/g, "contests"); pathName = pathName.replace(/user/g, "users"); query = query.replace(/categories/g, "category"); query = query.replace(/p=/g, "page="); return 'https://beta.atcoder.jp' + pathName + query; } } function AddLinkToNewAtcoder() { if (location.href.match(/contest.atcoder.jp/)) { $('div.nav-collapse').prepend(` <ul class="nav"> <li class="divider-vertical"></li> <li><a href="${ConvertToNewAtcodersURL()}"><span class="lang lang-selected"><span class="lang-en lang-child hidden-lang">go to beta.atcoder.jp</span><span class="lang-ja lang-child">Beta版へ</span></span></a></li> </ul> `); } else { $('ul.nav.navbar-nav').not('.navbar-right').append(`<li><a href="${ConvertToNewAtcodersURL()}">Beta版へ</a></li>`); } } // function AddLinkToAtcoder() {} if (location.href.match(/beta.atcoder.jp/)) { // AddLinkToAtcoder(); } else { AddLinkToNewAtcoder(); } })();