Created
May 23, 2012 15:36
-
-
Save summivox/2775950 to your computer and use it in GitHub Desktop.
清华评教:默认选优秀
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name thu-pingjiao | |
// @namespace http://github.com/smilekzs | |
// @include http*://zhjw.cic.tsinghua.edu.cn/pj.xspj_cpryb.do* | |
// @version 0.2 | |
// ==/UserScript== | |
injectScript=function(src){ | |
var scriptEl; | |
scriptEl = document.createElement('script'); | |
scriptEl.innerHTML = "(" + (src.toString()) + ")();"; | |
return document.head.appendChild(scriptEl); | |
}; | |
injectScript(function(){ | |
var d=document;//centerFrame.cpzbframe.document; | |
var x=d.getElementsByTagName('input'); | |
var exp=/优秀/; | |
for(i in x) if(x[i].type==='radio') if(exp.exec(x[i].nextSibling.data)) x[i].checked=true; | |
var el=document.createElement('input'); | |
el.type='button'; | |
el.value='提了个交'; | |
el.onclick=function(){window.sjqd();}; | |
var frm=document.getElementsByName('frm')[0]; | |
frm.insertBefore(el, frm.firstElementChild); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@zzz6519003 对于所有,如果后面跟着“优秀”文字,就选中。
这是一年前写的啦,现在想这么写不是很科学哇,
[].slice.call(d.querySelectorAll('input[type=radio]').forEach
更简单