您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Prevent accidentally modifying the mobile or locale on Codeforces
// ==UserScript== // @name CF - keep mobile and locale unchanged // @version 0.0.0 // @description Prevent accidentally modifying the mobile or locale on Codeforces // @match *://codeforces.com // @match *://codeforces.com/* // @grant GM_getValue // @grant GM_setValue // @grant GM_deleteValue // @run-at document-start // @namespace https://gf.qytechs.cn/users/410786 // ==/UserScript== (function(){ let url=new URL(location.href) let changed=false for(let param of ['mobile','locale']){ const expected=GM_getValue('lastParam_'+param) if(expected!==undefined&& url.searchParams.has(param)&& url.searchParams.get(param)!==expected ){ changed=true url.searchParams.set(param,expected) } } if(changed){ location.href=url.toString() return } window.addEventListener('DOMContentLoaded',function(){ document.querySelectorAll('a[href^="?locale="],a[href^="?mobile="]').forEach(function(elem){ elem.addEventListener('click',function(){ for(let param of ['mobile','locale']) GM_deleteValue('lastParam_'+param) }) }) GM_setValue('lastParam_locale',document.documentElement.lang) GM_setValue('lastParam_mobile',document.getElementsByClassName('switchToMobile').length ? "false" : "true") }) })()
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址