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 += ""+"" + i.addzero(2) + ""; o += "" + i.addzero(2) + ""; if (i % lens == 0) o += "
"; }; 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 = " "; 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] + ",","," + Array[i] + ","); }; 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 += "
"; for (var i = start; i <= end; i++) { DRTcompare.ResultList[i] = ""; o += "
" + DRTcompare.AlertMsg["0004"] + " "; o += DRTcompare.Config["List"][i][0] + " " + DRTcompare.AlertMsg["0005"]; o += DRTcompare.Config["List"][i][2] + " " + DRTcompare.AlertMsg["0006"] + " "; o += "" + " " + DRTcompare.AlertMsg["0007"]; o += "" + DRTcompare.AlertMsg["0008"] + "
"; o += ""; }; o += "
"; 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 = ""; 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 += "
"; for (var i = startID; i <= endID; i++) { o += "
" + DRTcompare.AlertMsg["0017"] + "" + h2b[i][2]; o += DRTcompare.AlertMsg["0018"] + " " + h2b[i][0].split(",").join(" "); o += " + " + h2b[i][1] + "
"; }; if (type == "+") o += "
"; }; 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); };