// ==UserScript== // @name 巴蜀OJ自动发信机+自动删信机 // @name:en Auto mail sender + deleter for BSOJ // @namespace https://greasyfork.org/users/1265383 // @version 2.0 // @description 自动向指定用户发送n条消息,1秒1条。自动删除当前页码上的所有信息,瞬间删完。 // @description:en Automatically send n messages to the specified user, one message every second.Automatically deletes all information on the current page number in an instant. // @author 123asdf123(luogu 576074) // @match https://oj.bashu.com.cn/code/mail.* // @icon https://oj.bashu.com.cn/favicon.ico // @license GPL3.0+SATA // @grant none // @downloadURL none // ==/UserScript== var sendb=document.getElementById("sendnew"),autosendb=document.createElement("span"),delb=document.createElement("span"),automail=document.createElement("div"); function insertAfter(newElement, targetElement) { let parent = targetElement.parentNode; if (parent.lastChild == targetElement) { parent.appendChild(newElement); } else { parent.insertBefore(newElement, targetElement.nextSibling); } } function send(user,title,content){ sendb.click(); document.getElementById("to_input").value=user; document.getElementById("title_input").value=title; document.getElementById("detail_input").value=content; document.getElementById("send_btn").click(); } function sendmessage(){ localStorage["auto-send-remain"]=parseInt(document.getElementById("auto_times_input").value); localStorage["auto-send-user"]=document.getElementById("auto_to_input").value; localStorage["auto-send-title"]=document.getElementById("auto_title_input").value; localStorage["auto-send-content"]=document.getElementById("auto_detail_input").value; location.reload(); } function offmessage(){ automail.className="modal hide"; automail.setAttribute("aria-hidden","true"); automail.setAttribute("style","display: none;"); document.getElementById("AutoMailModal_block").remove(); } function getmessage(){ automail.className="modal hide in"; automail.setAttribute("aria-hidden","false"); automail.setAttribute("style","display: block;"); var blocker=document.createElement("div"); blocker.className="modal-backdrop in"; blocker.setAttribute("id","AutoMailModal_block"); document.body.parentNode.appendChild(blocker); document.getElementById("hide_auto_modal").onclick=offmessage; document.getElementById("hide_auto_modal_x").onclick=offmessage; document.getElementById("auto_send_btn").onclick=sendmessage; } function delmessage(){ let need=document.querySelectorAll(".btn.btn-mini.btn-danger"); need.forEach(function (message) { message.click(); }); } (function() { 'use strict'; sendb.innerText="Send"; sendb.className="btn btn-primary shortcut-hint"; autosendb.innerHTML="Auto-Send"; autosendb.className="btn btn-info"; autosendb.setAttribute("style","margin:5px"); autosendb.onclick=getmessage; delb.innerHTML="Delete all messages on this page"; delb.className="btn btn-danger"; delb.setAttribute("style","margin:5px"); delb.onclick=delmessage; automail.innerHTML="
×

New Auto Message

SendClose
"; automail.className="modal hide"; automail.setAttribute("id","AutoMailModal"); automail.setAttribute("aria-hidden","true"); automail.setAttribute("style","display: none;"); sendb.parentNode.appendChild(autosendb); sendb.parentNode.appendChild(delb); insertAfter(autosendb,sendb); document.getElementById("MailModal").parentNode.appendChild(automail); insertAfter(automail,document.getElementById("MailModal")); if(localStorage.getItem("auto-send-remain")==null){ localStorage["auto-send-remain"]=0; } if(localStorage["auto-send-remain"]!=0){ localStorage["auto-send-remain"]--; send(localStorage["auto-send-user"],localStorage["auto-send-title"],localStorage["auto-send-content"]); location.reload(); } })();