Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions XMOJ.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -2323,6 +2323,25 @@ async function main() {
}
problemSwitcher.innerHTML += `<a href="${problemList[i].url}" title="${problemList[i].title.trim()}" class="btn btn-outline-secondary mb-2 ${activeClass}">${buttonText}</a>`;
}
let refreshBtn = document.createElement("a");
refreshBtn.title = "刷新缓存";
refreshBtn.classList.add("btn", "btn-outline-secondary", "mt-2");
refreshBtn.innerHTML = "↻";
refreshBtn.href = "#";
refreshBtn.addEventListener("click", function(e) {
e.preventDefault();
let cid = SearchParams.get("cid");
let keysToRemove = [];
for (let k = 0; k < localStorage.length; k++) {
let key = localStorage.key(k);
if (key && key.startsWith("UserScript-Contest-" + cid + "-")) {
keysToRemove.push(key);
}
}
keysToRemove.forEach(k => localStorage.removeItem(k));
location.reload();
});
problemSwitcher.appendChild(refreshBtn);
document.body.appendChild(problemSwitcher);
}
if (document.querySelector("body > div > div.mt-3 > h2") != null) {
Expand Down
Loading