您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
小视野 CPH 拓展
// ==UserScript== // @name CPH for 小视野 // @namespace http://lkyo.top/ // @version 2024-08-16 // @description 小视野 CPH 拓展 // @author xhze // @match http://gdgzoi.com/* // @icon https://www.google.com/s2/favicons?sz=64&domain=gdgzoi.com // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; console.log('run'); const geti=(x,document)=>{ return document.evaluate(x, document, null, XPathResult.ANY_TYPE, null); } function get(x,document) { return geti(x,document).iterateNext(); } let center = get("/html/body/div/div[3]/section/div/div/div/div/center[1]",document); center.innerHTML += ' <a href="javascript:postToCph()" class="btn btn-primary" role="button"> Throw to CPH </a>'; window.postToCph = async() => { if(window.location.toString().indexOf('contest')==-1) { sendProblem(parseProblemFromDom(window.location.toString(), document)); }else { let c=geti("//a[starts-with(@href,'problem.php')]", document); let d=c.iterateNext(); let dp = new DOMParser(); let ls = [] while(d) { ls.push(d); d=c.iterateNext(); } ls.reverse(); for(d of ls) { let html = await(await fetch(d.href)).text(); let g=dp.parseFromString(html, 'text/html'); console.log('ok'); sendProblem(parseProblemFromDom(d.href,g)); } } function sendProblem(problem) { console.log(problem); return fetch('http://localhost:27121', { method: "POST", mode: "no-cors", body: JSON.stringify(problem) }); } function parseProblemFromDom(url, document) { let center = get("/html/body/div/div[3]/section/div/div/div/div/center[1]",document); let inp = get("/html/body/div/div[3]/section/div/div/div/div/div[4]/div[1]/ul/pre",document).innerText.replaceAll(/【.+】/g, "@(*&)").split("@(*&)").map(e => e.trim()).filter(e => e); let ans = get("/html/body/div/div[3]/section/div/div/div/div/div[4]/div[2]/ul/pre",document).innerText.replaceAll(/【.+】/g, "@(*&)").split("@(*&)").map(e => e.trim()).filter(e => e); return { name:'horizon_P' + url.match(/(?<=cid=)(\d+)|(?<=pid=)(\d+)/g).join('_'), url, interactive: false, memoryLimit: center.innerText.match(/(\d+)(?= MB)/g)[0] * 1024 * 1024, timeLimit: center.innerText.match(/(\d+)(?= Sec)/g)[0] * 1000, group: "asd", tests: inp.map((e, i) => ({ input: e, output: ans[i], id: i, })), srcPath: "", local: true } } }; })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址