123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461 |
-
- var DRTcompare = new Object();
- DRTcompare.Config = {
- Redmin: 1,
- Redmax: 35,
- Redlen: 12,
- Bluemin: 1,
- Bluemax: 12,
- Bluelen: 6,
- msieEnter: unescape("%0D%0A"),
- geckoEnter: unescape("%0A"),
- List: "5+2,5+1,5+0,4+2,4+1,4+0,3+2,3+1,3+0,2+2,2+1,2+0,1+2,1+1,1+0,0+2,0+1,0+0".split(","),
- exArea: 0,
- batchMax: 30
- };
- DRTcompare.Window_onLoad = function ()
- {
- DRTcompare.Result_onLoad();
- };
- DRTcompare.r_onclick = function (object)
- {
- var in1 = document.getElementById("in1");
- var in2 = document.getElementById("in2");
- var data = $(object).val();
- if (data == "0")
- {
- $("#leftul").attr("class","list array bot-line");
- $("#rightul").attr("class","list array selected");
- } else if (data == "1")
- {
- $("#leftul").attr("class","list array bot-line selected");
- $("#rightul").attr("class","list array");
- }
- };
- DRTcompare.cRedBlue_onLoad = function (type)
- {
- var mins = DRTcompare.Config[type + "min"];
- var maxs = DRTcompare.Config[type + "max"];
- var lens = DRTcompare.Config[type + "len"];
- var o = "";
- for (var i = mins; i <= maxs; i++)
- {
- //o += "<input type='checkbox' name='c" + type + "' value='" + i + "' id='c" + type + " " + i.addzero(2) + "'>"+"<span class='bigball grey-28' for='c" + type + " " + i.addzero(2) + "'>" + i.addzero(2) + "</span>";
- o += "<span class='bigball grey-28' id='c" + type + " " + i.addzero(2) + "' name='c" + type + "'>" + i.addzero(2) + "</span>";
- if (i % lens == 0) o += "<br>";
- };
- document.getElementById("c" + type + "s").innerHTML = o;
- //var obj = document.forms["frm"].elements["c" + type];
- var obj = $("span[name=c" + type+"]");
- for (var i = 0; i < obj.length; i++)
- {
- obj[i].onclick = function () { DRTcompare.cRedBlue_onClick(this); };
- };
- };
- DRTcompare.cRedBlue_onClick = function (object)
- {
- //debugger;
- //var type = (object.name == "cRed") ? "Red" : "Blue";
- var type = ($(object).attr("name") == "cRed") ? "Red" : "Blue";
-
- if ($(object).attr("class") == "bigball ball-red-28")
- { $(object).attr("class","bigball bgrey-28"); }
- else { $(object).attr("class","bigball ball-red-28"); }
- //object.nextSibling.className = (object.checked == true) ? "t" + type : "";
- DRTcompare.hRedBlue_onLoad("c",type,object);
- };
- DRTcompare.cRedBlue_Reform = function (type)
- {
- var tRedBlue = document.forms["frm"].elements["tRedBlue"].value.split("+");
- tRedBlue = (type == "Red") ? tRedBlue[0] : tRedBlue[1];
- //var object = document.forms["frm"].elements["c" + type];
- var object = $("span[name=[c" + type + "]");
- for (var i = 0; i < object.length; i++)
- {
- //object[i].checked = (tRedBlue.indexOf(Math.round(object[i].value).addzero(2)) != -1) ? true : false;
- //object[i].nextSibling.className = (object[i].checked == true) ? "t" + type : "";
- //$(object[i]).attr("class", "");
- };
- };
- DRTcompare.tRedBlue_onLoad = function (type,value)
- {
- var o = "<input name='t" + type + "' value='" + value + "' size='1' maxlength='2' class='" + (type == "Red" ? "text red" : "text wblue") + "'> ";
- document.getElementById("t" + type + "s").innerHTML += o;
- var object = document.forms["frm"].elements["t" + type];
- object = object[object.length - 1];
- object.onpaste = function () { return false; };
- object.onclick = function () { this.select(); };
- object.onkeyup = function () { DRTcompare.tRedBlue_onKeyup(this); };
- object.onblur = function () { DRTcompare.tRedBlue_onBlur(this); };
- };
- DRTcompare.tRedBlue_onKeyup = function (object)
- {
- object.value = object.value.replace(/\D/gi,"");
- if (object.value.length == 2) DRTcompare.tRedBlue_Check(object);
- };
- DRTcompare.tRedBlue_onBlur = function (object)
- {
- if (object.value.length == 1)
- {
- object.value = Math.round(object.value).addzero(2);
- DRTcompare.tRedBlue_Check(object);
- };
- };
- DRTcompare.tRedBlue_Check = function (object)
- {
- var type = (object.name == "tRed") ? "Red" : "Blue";
- var mins = DRTcompare.Config[type + "min"];
- var maxs = DRTcompare.Config[type + "max"];
- if (Math.round(object.value) > maxs || Math.round(object.value) < mins) object.value = "";
- if (object.value != "") DRTcompare.hRedBlue_onLoad("t",type,object);
- };
- DRTcompare.tRedBlue_Reform = function (type)
- {
- document.getElementById("t" + type + "s").innerHTML = "";
- var tRedBlue = document.forms["frm"].elements["tRedBlue"].value.split("+");
- tRedBlue = (type == "Red") ? tRedBlue[0] : tRedBlue[1];
- tRedBlue = (tRedBlue + " ").split(" ");
- var object = document.forms["frm"].elements["t" + type];
- for (var i = 0; i < (tRedBlue.length - 1); i++)
- { DRTcompare.tRedBlue_onLoad(type,tRedBlue[i]); };
- };
- DRTcompare.tRedBlue_focus = function (type)
- {
- var object = document.forms["frm"].elements["t" + type];
- if (DRTcompare.BrowInfo == "msie") object[object.length - 1].focus();
- };
- DRTcompare.hRedBlue_onLoad = function (source,type)
- {
- //debugger;
- var tRedBlue = document.forms["frm"].elements["tRedBlue"].value.split("+");
- switch (type)
- {
- case "Red": tRedBlue[0] = DRTcompare.hRedBlue_Gather(source,type); break;
- case "Blue": tRedBlue[1] = DRTcompare.hRedBlue_Gather(source,type); break;
- };
- document.forms["frm"].elements["tRedBlue"].value = tRedBlue.join("+");
- DRTcompare.hRedBlue_Reform(source,type);
- if (tRedBlue[0] != "")
- document.forms["frm"].elements["red_n"].value = (tRedBlue[0] + " ").split(" ").length - 1;
- if (tRedBlue[1] != "")
- document.forms["frm"].elements["blue_n"].value = (tRedBlue[1] + " ").split(" ").length - 1;
- };
- DRTcompare.hRedBlue_Gather = function (source,type) {
- //debugger;
- //var object = document.forms["frm"].elements[source + type];
- var object = $("span[name=" + source + type + "]");//.find("class=bigball ball-red-28");
- var mins = DRTcompare.Config[type + "min"];
- var maxs = DRTcompare.Config[type + "max"];
- var tmpStr = "";
- for (var i = 0; i < object.length; i++)
- {
- var objValue = $(object[i]).text();
- if ((tmpStr.indexOf(Math.round(objValue).addzero(2)) == -1) && (objValue != ""))
- {
- if (Math.round(objValue) >= mins && Math.round(objValue) <= maxs)
- {
- switch (source)
- {
- case "c":
- if ($(object[i]).attr("class") == "bigball ball-red-28")
- tmpStr += " " + Math.round(objValue).addzero(2);
- break;
- case "t":
- tmpStr += " " + Math.round(objValue).addzero(2);
- break;
- };
- };
- };
- };
- return tmpStr.trim();
- };
- DRTcompare.hRedBlue_Reform = function (source,type)
- {
- DRTcompare.tRedBlue_Reform(type);
- DRTcompare.cRedBlue_Reform(type);
- DRTcompare.tRedBlue_onLoad(type,"");
- switch (type)
- {
- case "Red": setTimeout("DRTcompare.tRedBlue_focus('Red')",0); break;
- case "Blue": setTimeout("DRTcompare.tRedBlue_focus('Blue')",0); break;
- };
- };
- DRTcompare.Calculate_onClick = function ()
- {
- var r1 = ($("ul[name='r1']").attr("class") != "hide") ? 1 : 2;
- DRTcompare.hRedBlue_Value = "";
- if (r1 == 1) {
- var reditems = $("input[name='db']");
- for (var i = 0; i < reditems.length; i++) {
- if ($(reditems[i]).prop("checked"))
- DRTcompare.hRedBlue_Value = DRTcompare.hRedBlue_Value + $(reditems[i]).val().replace("\n", "").trim() + " ";
- }
- DRTcompare.hRedBlue_Value += "+";
- var blueitems = $("input[name='hdb']");
- for (var i = 0; i < blueitems.length; i++) {
- if ($(blueitems[i]).prop("checked"))
- DRTcompare.hRedBlue_Value = DRTcompare.hRedBlue_Value + $(blueitems[i]).val().replace("\n", "").trim() + " ";
- }
- } else {
- DRTcompare.hRedBlue_Value = $("textarea[class='textarea']").val();
- }
- if ((DRTcompare.hRedBlue_Value == "") || (DRTcompare.hRedBlue_Value == "+")) { alert(DRTcompare.AlertMsg["0001"]); return false; };
- if (DRTcompare.hRedBlue_Value.search(/[^0-9\+\r\n\ ]/g,"") >= 0) { alert(DRTcompare.AlertMsg["0002"]); return false; }
- DRTcompare.hRedBlue_Value += DRTcompare.Config[DRTcompare.BrowInfo + "Enter"];
- DRTcompare.hRedBlue_Value = DRTcompare.hRedBlue_Value.split(DRTcompare.Config[DRTcompare.BrowInfo + "Enter"]);
- for (var i = DRTcompare.hRedBlue_Value.length - 1; i >= 0; i--)
- {
- DRTcompare.hRedBlue_Value[i] = DRTcompare.hRedBlue_Value[i].trim();
- if (DRTcompare.hRedBlue_Value[i] != "")
- {
- DRTcompare.hRedBlue_Value[i] = DRTcompare.hRedBlue_Value[i].replace(/\ {2,}/gi," ");
- if (DRTcompare.hRedBlue_Value[i].indexOf("+") == -1) DRTcompare.hRedBlue_Value[i] += "+";
- DRTcompare.hRedBlue_Value[i] = DRTcompare.hRedBlue_Value[i].split("+");
- DRTcompare.hRedBlue_Value[i][0] += " ";
- DRTcompare.hRedBlue_Value[i][1] += " ";
- DRTcompare.hRedBlue_Value[i][0] = DRTcompare.hRedBlue_Value[i][0].split(" ");
- DRTcompare.hRedBlue_Value[i][1] = DRTcompare.hRedBlue_Value[i][1].split(" ");
- if (DRTcompare.hRedBlue_Value[i][0].length <= 5) { alert(DRTcompare.AlertMsg["0003"]); return false; }
- } else { DRTcompare.hRedBlue_Value = DRTcompare.hRedBlue_Value.slice(0,DRTcompare.hRedBlue_Value.length - 1); };
- };
- if (DRTcompare.hRedBlue_Value.length > DRTcompare.Config["batchMax"]) { alert(DRTcompare.AlertMsg["0021"]); return false; };
- for (var i = 0; i < DRTcompare.ResultList.length; i++) { DRTcompare.ResultList[i] = ""; };
- DRTcompare.Calculate_Start();
- };
- DRTcompare.Calculate_Start = function () {
- var CountA, CountB;
- var historyA, historyB;
- var Zero, tmpArray;
- for (var i = 0; i < h2b.length; i++) {
- for (var j = 0; j < DRTcompare.hRedBlue_Value.length; j++) {
- historyA = "," + h2b[i][0] + ",";
- historyB = "," + h2b[i][1] + ",";
- tmpArray = "";
- CountA = DRTcompare.Calculate_Count(historyA, DRTcompare.hRedBlue_Value[j][0]);
- CountB = DRTcompare.Calculate_Count(historyB, DRTcompare.hRedBlue_Value[j][1]);
- if (CountA > 0) historyA = DRTcompare.Calculate_AddHTML(historyA, DRTcompare.hRedBlue_Value[j][0], "red");
- if (CountB > 0) historyB = DRTcompare.Calculate_AddHTML(historyB, DRTcompare.hRedBlue_Value[j][1], "blue");
- numZero = DRTcompare.Calculate_Zero(CountA, CountB);
- historyA = historyA.substring(1, historyA.length - 1).split(",");
- historyB = historyB.substring(1, historyB.length - 1).split(",");
- tmpArray = historyA + "+" + historyB + "+" + h2b[i][2] + "+" + i + "+" + j;
- DRTcompare.ResultList[numZero] += tmpArray + "||";
- };
- };
- var obj;
- for (var i = 0; i < DRTcompare.ResultList.length; i++) {
- DRTcompare.ResultList[i] = DRTcompare.ResultList[i].split("||");
- document.getElementById("resultx_" + i).innerHTML = DRTcompare.ResultList[i].length - 1;
- var info = DRTcompare.Result_Start(i);
- document.getElementById("show_" + i).innerHTML=info;
- };
- $('.hidden').hide();
- $(".list").click(function () {
- $(this).next().siblings(".list").find("a").attr('class', '');
- $(this).next().slideDown();
- $(this).find("a").attr('class', 'blue');
- $(this).next().siblings(".hidden").slideUp();
- });
- document.getElementById("result1").style.display = "";
- };
- DRTcompare.Calculate_Count = function (history,Array)
- {
- var tmpCount = 0;
- for (var i = 0; i < Array.length - 1; i++)
- {
- if (history.indexOf("," + Array[i] + ",") != -1) tmpCount++;
- };
- return tmpCount;
- };
- DRTcompare.Calculate_AddHTML = function (history,Array,type) {
-
- var tmpHistory = history;
- for (var i = 0; i < Array.length - 1; i++)
- {
- tmpHistory = tmpHistory.replace("," + Array[i] + ",",",<span class=" + ((type == "blue") ? "wblue" : "wred") + ">" + Array[i] + "</span>,");
- };
- return tmpHistory;
- };
- DRTcompare.Calculate_Zero = function (CountA,CountB)
- {
- var tmpZ;
- for (var i = 0; i < DRTcompare.Config["List"].length; i++)
- {
- if ((DRTcompare.Config["List"][i][0] == CountA) && (DRTcompare.Config["List"][i][2] == CountB))
- {
- tmpZ = i;
- break;
- };
- };
- return tmpZ;
- };
- DRTcompare.Result_onLoad = function ()
- {
- DRTcompare.ResultList = new Array();
- var o = "";
- o += DRTcompare.Result_onLoad2(0, 17, "result11");
- document.getElementById("result1").innerHTML = o;
- };
- DRTcompare.Result_onLoad2 = function (start,end,idname)
- {
- var o = "";
- o += "<div id='" + idname + "' class='gs-follow'>";
- for (var i = start; i <= end; i++) {
- DRTcompare.ResultList[i] = "";
- o += "<div class='list'><span>" + DRTcompare.AlertMsg["0004"] + " ";
- o += DRTcompare.Config["List"][i][0] + " " + DRTcompare.AlertMsg["0005"];
- o += DRTcompare.Config["List"][i][2] + " " + DRTcompare.AlertMsg["0006"] + " ";
- o += "<span id='resultx_" + i + "' class='Tresult2'></span>" + " " + DRTcompare.AlertMsg["0007"];
- o += "<a class=''>" + DRTcompare.AlertMsg["0008"] + "</a></span></div>";
- o += "<div class='hidden' id='show_"+i+"'></div>";
- };
- o += "</div>";
- return o;
- }
- DRTcompare.Result_ExArea = function ()
- {
- var exArea = window.prompt(DRTcompare.AlertMsg["0009"],DRTcompare.Config["exArea"]);
- if (Math.round(exArea) == NaN) exArea = 0;
- if (Math.round(exArea) >= 10) { alert(DRTcompare.AlertMsg["0011"]); return false; };
- DRTcompare.Config["exArea"] = Math.round(exArea);
- DRTcompare.Result_Show();
- };
- DRTcompare.Result_Start = function (numZero) { DRTcompare.CurrNumZero = numZero; var info = DRTcompare.Result_Show(); return info; };
- DRTcompare.Result_Show = function () {
- var o = "<ul class='hidden1 dlt'>";
- var numZero = DRTcompare.CurrNumZero;
- if (DRTcompare.ResultList[numZero] != "") {
- var r1 = ($("ul[name='r1']").attr("class") != "hide") ? 1 : 2;
- for (var i = 0; i < DRTcompare.ResultList[numZero].length - 1; i++) {
- DRTcompare.ResultList[numZero][i] = DRTcompare.ResultList[numZero][i].split("+");
- o += DRTcompare.ResultexList(DRTcompare.ResultList[numZero][i][3], "-");
- o += "<li class='list'>" + DRTcompare.AlertMsg["0017"] + DRTcompare.ResultList[numZero][i][2];
- o += DRTcompare.AlertMsg["0018"] + " " + DRTcompare.ResultList[numZero][i][0].split(",").join(" ");
- o += " + " + DRTcompare.ResultList[numZero][i][1].split(",").join(" ");
- o += "</li>";
- o += DRTcompare.ResultexList(DRTcompare.ResultList[numZero][i][3], "+");
- DRTcompare.ResultList[numZero][i] = DRTcompare.ResultList[numZero][i].join("+");
- };
- } else {
- o += DRTcompare.AlertMsg["0015"];
- };
- o += "</ul>";
- return o;
- };
- DRTcompare.ResultexList = function (historyID,type)
- {
- var startID,endID;
- historyID = Math.round(historyID);
- switch (type)
- {
- case "-": startID = historyID - DRTcompare.Config["exArea"]; endID = historyID - 1; break;
- case "+": startID = historyID + 1; endID = historyID + DRTcompare.Config["exArea"]; break;
- };
- if (startID < 0) startID = 0;
- if (endID >= h2b.length) endID = h2b.length - 1;
- var o = "";
- if (DRTcompare.Config["exArea"] > 0)
- {
- if (type == "-") o += "<div><img width=0 height=3></div>";
- for (var i = startID; i <= endID; i++)
- {
- o += "<div class='list'>" + DRTcompare.AlertMsg["0017"] + "" + h2b[i][2];
- o += DRTcompare.AlertMsg["0018"] + " " + h2b[i][0].split(",").join(" ");
- o += " + " + h2b[i][1] + "</div>";
- };
- if (type == "+") o += "<div></div>";
- };
- return o;
- };
- DRTcompare.AlertMsg = {
- "0001": "您选择或者输入的号码为空!",
- "0002": "批量对比数据列表中,出现非法的字符。",
- "0003": "选择的前区少于5个,查询过程不成立。",
- "0004": "开出过",
- "0005": "前",
- "0006": "后",
- "0007": "次",
- "0008": "显示历史开奖",
- "0009": "请输入您要扩展查询对比结果上下多少期的数值。例如:要扩展查询3 期就输入数字“3”。如您输入数字“0”,就表示不扩展查询。",
- "0010": "扩展对比结果上下n期",
- "0011": "您选择的扩展查询范围大于10期",
- "0012": "开出过",
- "0013": "个前区号与",
- "0014": "个后区号",
- "0015": "暂时没有对比成功的数据",
- "0016": "与",
- "0017": "第",
- "0018": "期",
- "0019": "注",
- "0020": "显示≤3个红球的结果",
- "0021": "您输入的批量数据超出最大限度!!"
- };
- Number.prototype.addzero = function (length)
- { var tmpStr = ""; var tmpNum = this.toString(); for (var i = 0; i < length - tmpNum.length; i++) { tmpStr += "0"; }; return tmpStr + tmpNum; };
- String.prototype.trim = function ()
- { return this.replace(/(^\s*)|(\s*$)/g,""); }
- window.onload = DRTcompare.Window_onLoad;
- document.forms["frm"].elements["r1"][0].onclick = function () { DRTcompare.r_onclick(this); };
- document.forms["frm"].elements["r1"][1].onclick = function () { DRTcompare.r_onclick(this); };
|