Skip to content

Instantly share code, notes, and snippets.

@magixsource
Created June 12, 2014 14:13
Show Gist options
  • Save magixsource/acafed21a93a9e3263e7 to your computer and use it in GitHub Desktop.
Save magixsource/acafed21a93a9e3263e7 to your computer and use it in GitHub Desktop.
This is a chrome extension named dongqiudi
var answers = new Array("巴蒂","贝克汉姆","菲戈","雷米特杯","魔兽","兵工厂","教授","欧文","小罗","里皮","保罗","托雷斯","罗马里奥","郑大世","贝尔","厄齐尔","比利亚","齐达内","罗纳尔多","尼日利亚","布斯克茨","巴洛特利","齐达内","电话门","大黄蜂","贝克汉姆","沃尔科特","兰帕德","巴拉圭","10巴特兹","克洛泽","卡卡","C罗","卡恩","舍普琴科","方丹","飞火流星","法兰克福","安切洛蒂","苏克","罗纳尔多","贝隆","贝贝托","利物浦","年轻人","克洛泽","卡西利亚斯","伊布","拉涅利","因扎吉","范尼","斯基拉奇","格罗索","里贝里","巴乔","哈维","伊涅斯塔","莫雷洛","苏格拉底","全攻全守","沙特","西蒙尼","杰拉德","拉姆","国际米兰","布里奇","弟媳","穆里尼奥","布雷默","兰帕德","马拉多纳","戴维斯","伊涅斯塔","英格兰","阿内尔卡","哥伦比亚","格罗索","利比里亚","内马尔","鲁尼","卡洛斯","梅西","翻译","萨基","哈吉","米拉","希勒","弗格森","巴拉克","克雷斯波","贝利","伊布","马特乌斯","济科","乌龙","鸭子","任意球","克洛泽","内斯塔","亨利","加斯科因","内德维德","图拉姆","多梅内克","贝肯鲍尔","伊瓜因","匈牙利","科隆","马修斯","土耳其","坎通纳","奥特加","谢亚龙","卡马乔","塞内加尔","塞萨尔","英格兰","朝鲜","切赫","诺伊尔","皮耶罗","尼日利亚","山东鲁能","李金羽","萨连科","洪明浦","博斯克","托雷斯","穆里尼奥","梅西","克林斯曼","米卢","贝肯鲍尔","佩鲁贾","容祖儿","意大利","雅辛","巴乔吗","特维斯","c罗","坎波斯","伊基塔","佐夫","莱茵克尔","墨索里尼","兰帕德","赫斯特","贝利","团队之星","布兰克","克鲁伊夫","埃托奥","菲戈","布冯","阿曼","挪威","郑智","马赛","帕勒莫","马特乌斯","托蒂","巴尔德拉马","皮耶罗","皮尔洛","扎卡尔多","墨西哥","扎加洛","中山雅史","国际米兰","施拉普纳","萨莫拉诺","马赛回旋","齐达内","托蒂","英格兰","尤文图斯","切尔西","香克利","海瑟尔惨案","普天同庆","博格坎普","布兰科","马塔","特里","亚军","胜利","雅辛奖","丹尼斯劳","勒沃库森","布鲁查加","尤西比奥","因扎吉","马拉多纳","里维利诺","帕尔马","摩洛哥","马萨罗","博洛尼亚","苏亚雷斯","德波尔");
answers = $.unique(answers);
var filterAnsers;
var answersChars;
var length;
var init = false;
var url = "http://c.3g.163.com/uc/api/exam/jsonp/commit";
function nonBlockingInvoke(obj){
$.getJSON(url+"?answer="+obj+"&passport=admin@163.com&questionNo=87&callback=?",function(json){
if(json.pass){
alert(obj);
}else{
blockingInvoke();
}
});
}
function blockingInvoke(){
// step1 find answer length
// step2 filter answers by length
if(!init){
length = $("ul.ques_answer>li.answer_char").length;
filterAnsers = filter(answers,length);
answersChars = getChars();
init = true;
}
var item = filterAnsers.pop();
if(item){
nonBlockingInvoke(item);
}
}
function getChars(){
var array = new Array();
$("ul.ques_confuse>li.confuse_char").each(function(i){
array[i] = $(this).text();
});
return array;
}
function canbeable(chars){
var words = chars.split("");
for (var i = 0; i < words.length; i++) {
if($.inArray(words[i],answersChars)==-1){
return false;
}
};
return true;
}
function filter(array,len){
var result = new Array();
var filterIndex = 0;
for (var i = 0; i < array.length; i++) {
var o = array[i];
if(o.length == len && canbeable(o)){
result[filterIndex] = o;
filterIndex++;
}
};
return result;
}
$(function(){
$("body").bind("dblclick",function(){
blockingInvoke();
});
});
{
"manifest_version": 2,
"name": "董秋弟",
"version": "2.0",
"description": "我的第一个Chrome扩展",
"icons": {
"128": "images/Trophy football camp.png"
},
"content_scripts": [
{
"matches": ["*://2014.163.com/dongqiudi/"],
"js": ["js/jquery.js","js/helper.js"]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment