您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
AtCoderの参加登録メニューで未記入のものがあれば赤く表示します
// ==UserScript== // @name AtCoder未記入チェッカー // @namespace https://github.com/ZOI-dayo // @version 0.1 // @description AtCoderの参加登録メニューで未記入のものがあれば赤く表示します // @author ZOI_dayo // @supportURL https://twitter.com/ZOI_dayo // @license MIT // @match https://atcoder.jp/contests/*/register // @icon https://www.google.com/s2/favicons?sz=64&domain=atcoder.jp // ==/UserScript== (() =>{ 'use strict'; const warn = (elem) => { elem.style.backgroundColor = "#FF000044" } const unwarn = (elem) => { elem.style.backgroundColor = "unset" } const onChange = () => { for(let elem of document.querySelectorAll('.form-group')) { console.log(elem) const inputs = elem.querySelectorAll('input'); if(inputs.length == 0) continue; console.log(inputs[0].getAttribute('type')) console.log(elem.querySelector('input[type="radio"][checked]')) const type = inputs[0].getAttribute('type') if(type == 'radio') { // console.log(inputs[0].getAttribute('name')) const checked = Array.from(inputs).find(i => i.checked) if(checked.value == "No") warn(elem) else unwarn(elem) } else if(type == 'text') { const value = inputs[0].value; if(value == "") warn(elem) else unwarn(elem) } else if(type == 'checkbox') { if(!Array.from(inputs).some(i => i.checked)) warn(elem) else unwarn(elem) } } } document.forms[1].addEventListener('change', onChange); onChange(); })();