accoders link fix(by APJifengc)
accoder 的一些东西比较唐,而这个插件可以优化,
但是洛谷上不了,所以搬运一下。
首先下载 tampermonkey,拖到浏览器里安装(linux Firefox),然后添加新脚本即可。
// ==UserScript==
// @name AcCoders Problem Link Fix
// @version 3.2
// @description Fix the link
// @author APJifengc
// @match http://47.92.197.167:5283/*
// @icon https://cdn.luogu.com.cn/upload/image_hosting/od8b7m13.png
// @grant none
// ==/UserScript==
(function() {
'use strict';
if (localStorage.getItem("problem_ids") == null) {
localStorage.setItem("problem_ids", "{}")
}
let problem_ids = JSON.parse(localStorage.getItem("problem_ids"))
if (window.location.href.match(/^http:\/\/47\.92\.197\.167:5283\/contest\/(\d+)$/) != null) {
$("table.ui.selectable.celled.table tbody tr td a").each((id, element) => {
if (element.href.lastIndexOf("problem\/") != -1) {
$.get(element.href, response => {
let id = response.match(/\/problem\/(-?\d+)\/submit/)[1]
console.log(id + " " + element.href)
problem_ids[id] = element.href
localStorage.setItem("problem_ids", JSON.stringify(problem_ids))
}, "html")
}
})
}
$("a").each((index, element) => {
let match = element.href.match(/^http:\/\/47\.92\.197\.167:5283\/problem\/(-?\d+)\/?$/)
if (match) {
if (problem_ids[match[1]]) {
element.href = problem_ids[match[1]]
}
}
})
})();
// for people without internet connection
$.getScript("http://47.92.197.167:5283/file/download-share/ea65c0b50bbcdc9d69d5d4b1d17008c3046bd8084223b5611d78b78a186751a472bb4e6ee8a9031d185328139d13c0c858c0641f51420356aca2", () => {
$('.ui.accordion').accordion({ selector: { trigger: '.title:not(.unexpandable)' }})
$('#select_language').dropdown();
$('#select_status').dropdown();
})
制作人:APJifengc,感谢学长的馈赠。