dltdb.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461
  1. 
  2. var DRTcompare = new Object();
  3. DRTcompare.Config = {
  4. Redmin: 1,
  5. Redmax: 35,
  6. Redlen: 12,
  7. Bluemin: 1,
  8. Bluemax: 12,
  9. Bluelen: 6,
  10. msieEnter: unescape("%0D%0A"),
  11. geckoEnter: unescape("%0A"),
  12. 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(","),
  13. exArea: 0,
  14. batchMax: 30
  15. };
  16. DRTcompare.Window_onLoad = function ()
  17. {
  18. DRTcompare.Result_onLoad();
  19. };
  20. DRTcompare.r_onclick = function (object)
  21. {
  22. var in1 = document.getElementById("in1");
  23. var in2 = document.getElementById("in2");
  24. var data = $(object).val();
  25. if (data == "0")
  26. {
  27. $("#leftul").attr("class","list array bot-line");
  28. $("#rightul").attr("class","list array selected");
  29. } else if (data == "1")
  30. {
  31. $("#leftul").attr("class","list array bot-line selected");
  32. $("#rightul").attr("class","list array");
  33. }
  34. };
  35. DRTcompare.cRedBlue_onLoad = function (type)
  36. {
  37. var mins = DRTcompare.Config[type + "min"];
  38. var maxs = DRTcompare.Config[type + "max"];
  39. var lens = DRTcompare.Config[type + "len"];
  40. var o = "";
  41. for (var i = mins; i <= maxs; i++)
  42. {
  43. //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>";
  44. o += "<span class='bigball grey-28' id='c" + type + " " + i.addzero(2) + "' name='c" + type + "'>" + i.addzero(2) + "</span>";
  45. if (i % lens == 0) o += "<br>";
  46. };
  47. document.getElementById("c" + type + "s").innerHTML = o;
  48. //var obj = document.forms["frm"].elements["c" + type];
  49. var obj = $("span[name=c" + type+"]");
  50. for (var i = 0; i < obj.length; i++)
  51. {
  52. obj[i].onclick = function () { DRTcompare.cRedBlue_onClick(this); };
  53. };
  54. };
  55. DRTcompare.cRedBlue_onClick = function (object)
  56. {
  57. //debugger;
  58. //var type = (object.name == "cRed") ? "Red" : "Blue";
  59. var type = ($(object).attr("name") == "cRed") ? "Red" : "Blue";
  60. if ($(object).attr("class") == "bigball ball-red-28")
  61. { $(object).attr("class","bigball bgrey-28"); }
  62. else { $(object).attr("class","bigball ball-red-28"); }
  63. //object.nextSibling.className = (object.checked == true) ? "t" + type : "";
  64. DRTcompare.hRedBlue_onLoad("c",type,object);
  65. };
  66. DRTcompare.cRedBlue_Reform = function (type)
  67. {
  68. var tRedBlue = document.forms["frm"].elements["tRedBlue"].value.split("+");
  69. tRedBlue = (type == "Red") ? tRedBlue[0] : tRedBlue[1];
  70. //var object = document.forms["frm"].elements["c" + type];
  71. var object = $("span[name=[c" + type + "]");
  72. for (var i = 0; i < object.length; i++)
  73. {
  74. //object[i].checked = (tRedBlue.indexOf(Math.round(object[i].value).addzero(2)) != -1) ? true : false;
  75. //object[i].nextSibling.className = (object[i].checked == true) ? "t" + type : "";
  76. //$(object[i]).attr("class", "");
  77. };
  78. };
  79. DRTcompare.tRedBlue_onLoad = function (type,value)
  80. {
  81. var o = "<input name='t" + type + "' value='" + value + "' size='1' maxlength='2' class='" + (type == "Red" ? "text red" : "text wblue") + "'> ";
  82. document.getElementById("t" + type + "s").innerHTML += o;
  83. var object = document.forms["frm"].elements["t" + type];
  84. object = object[object.length - 1];
  85. object.onpaste = function () { return false; };
  86. object.onclick = function () { this.select(); };
  87. object.onkeyup = function () { DRTcompare.tRedBlue_onKeyup(this); };
  88. object.onblur = function () { DRTcompare.tRedBlue_onBlur(this); };
  89. };
  90. DRTcompare.tRedBlue_onKeyup = function (object)
  91. {
  92. object.value = object.value.replace(/\D/gi,"");
  93. if (object.value.length == 2) DRTcompare.tRedBlue_Check(object);
  94. };
  95. DRTcompare.tRedBlue_onBlur = function (object)
  96. {
  97. if (object.value.length == 1)
  98. {
  99. object.value = Math.round(object.value).addzero(2);
  100. DRTcompare.tRedBlue_Check(object);
  101. };
  102. };
  103. DRTcompare.tRedBlue_Check = function (object)
  104. {
  105. var type = (object.name == "tRed") ? "Red" : "Blue";
  106. var mins = DRTcompare.Config[type + "min"];
  107. var maxs = DRTcompare.Config[type + "max"];
  108. if (Math.round(object.value) > maxs || Math.round(object.value) < mins) object.value = "";
  109. if (object.value != "") DRTcompare.hRedBlue_onLoad("t",type,object);
  110. };
  111. DRTcompare.tRedBlue_Reform = function (type)
  112. {
  113. document.getElementById("t" + type + "s").innerHTML = "";
  114. var tRedBlue = document.forms["frm"].elements["tRedBlue"].value.split("+");
  115. tRedBlue = (type == "Red") ? tRedBlue[0] : tRedBlue[1];
  116. tRedBlue = (tRedBlue + " ").split(" ");
  117. var object = document.forms["frm"].elements["t" + type];
  118. for (var i = 0; i < (tRedBlue.length - 1); i++)
  119. { DRTcompare.tRedBlue_onLoad(type,tRedBlue[i]); };
  120. };
  121. DRTcompare.tRedBlue_focus = function (type)
  122. {
  123. var object = document.forms["frm"].elements["t" + type];
  124. if (DRTcompare.BrowInfo == "msie") object[object.length - 1].focus();
  125. };
  126. DRTcompare.hRedBlue_onLoad = function (source,type)
  127. {
  128. //debugger;
  129. var tRedBlue = document.forms["frm"].elements["tRedBlue"].value.split("+");
  130. switch (type)
  131. {
  132. case "Red": tRedBlue[0] = DRTcompare.hRedBlue_Gather(source,type); break;
  133. case "Blue": tRedBlue[1] = DRTcompare.hRedBlue_Gather(source,type); break;
  134. };
  135. document.forms["frm"].elements["tRedBlue"].value = tRedBlue.join("+");
  136. DRTcompare.hRedBlue_Reform(source,type);
  137. if (tRedBlue[0] != "")
  138. document.forms["frm"].elements["red_n"].value = (tRedBlue[0] + " ").split(" ").length - 1;
  139. if (tRedBlue[1] != "")
  140. document.forms["frm"].elements["blue_n"].value = (tRedBlue[1] + " ").split(" ").length - 1;
  141. };
  142. DRTcompare.hRedBlue_Gather = function (source,type) {
  143. //debugger;
  144. //var object = document.forms["frm"].elements[source + type];
  145. var object = $("span[name=" + source + type + "]");//.find("class=bigball ball-red-28");
  146. var mins = DRTcompare.Config[type + "min"];
  147. var maxs = DRTcompare.Config[type + "max"];
  148. var tmpStr = "";
  149. for (var i = 0; i < object.length; i++)
  150. {
  151. var objValue = $(object[i]).text();
  152. if ((tmpStr.indexOf(Math.round(objValue).addzero(2)) == -1) && (objValue != ""))
  153. {
  154. if (Math.round(objValue) >= mins && Math.round(objValue) <= maxs)
  155. {
  156. switch (source)
  157. {
  158. case "c":
  159. if ($(object[i]).attr("class") == "bigball ball-red-28")
  160. tmpStr += " " + Math.round(objValue).addzero(2);
  161. break;
  162. case "t":
  163. tmpStr += " " + Math.round(objValue).addzero(2);
  164. break;
  165. };
  166. };
  167. };
  168. };
  169. return tmpStr.trim();
  170. };
  171. DRTcompare.hRedBlue_Reform = function (source,type)
  172. {
  173. DRTcompare.tRedBlue_Reform(type);
  174. DRTcompare.cRedBlue_Reform(type);
  175. DRTcompare.tRedBlue_onLoad(type,"");
  176. switch (type)
  177. {
  178. case "Red": setTimeout("DRTcompare.tRedBlue_focus('Red')",0); break;
  179. case "Blue": setTimeout("DRTcompare.tRedBlue_focus('Blue')",0); break;
  180. };
  181. };
  182. DRTcompare.Calculate_onClick = function ()
  183. {
  184. var r1 = ($("ul[name='r1']").attr("class") != "hide") ? 1 : 2;
  185. DRTcompare.hRedBlue_Value = "";
  186. if (r1 == 1) {
  187. var reditems = $("input[name='db']");
  188. for (var i = 0; i < reditems.length; i++) {
  189. if ($(reditems[i]).prop("checked"))
  190. DRTcompare.hRedBlue_Value = DRTcompare.hRedBlue_Value + $(reditems[i]).val().replace("\n", "").trim() + " ";
  191. }
  192. DRTcompare.hRedBlue_Value += "+";
  193. var blueitems = $("input[name='hdb']");
  194. for (var i = 0; i < blueitems.length; i++) {
  195. if ($(blueitems[i]).prop("checked"))
  196. DRTcompare.hRedBlue_Value = DRTcompare.hRedBlue_Value + $(blueitems[i]).val().replace("\n", "").trim() + " ";
  197. }
  198. } else {
  199. DRTcompare.hRedBlue_Value = $("textarea[class='textarea']").val();
  200. }
  201. if ((DRTcompare.hRedBlue_Value == "") || (DRTcompare.hRedBlue_Value == "+")) { alert(DRTcompare.AlertMsg["0001"]); return false; };
  202. if (DRTcompare.hRedBlue_Value.search(/[^0-9\+\r\n\ ]/g,"") >= 0) { alert(DRTcompare.AlertMsg["0002"]); return false; }
  203. DRTcompare.hRedBlue_Value += DRTcompare.Config[DRTcompare.BrowInfo + "Enter"];
  204. DRTcompare.hRedBlue_Value = DRTcompare.hRedBlue_Value.split(DRTcompare.Config[DRTcompare.BrowInfo + "Enter"]);
  205. for (var i = DRTcompare.hRedBlue_Value.length - 1; i >= 0; i--)
  206. {
  207. DRTcompare.hRedBlue_Value[i] = DRTcompare.hRedBlue_Value[i].trim();
  208. if (DRTcompare.hRedBlue_Value[i] != "")
  209. {
  210. DRTcompare.hRedBlue_Value[i] = DRTcompare.hRedBlue_Value[i].replace(/\ {2,}/gi," ");
  211. if (DRTcompare.hRedBlue_Value[i].indexOf("+") == -1) DRTcompare.hRedBlue_Value[i] += "+";
  212. DRTcompare.hRedBlue_Value[i] = DRTcompare.hRedBlue_Value[i].split("+");
  213. DRTcompare.hRedBlue_Value[i][0] += " ";
  214. DRTcompare.hRedBlue_Value[i][1] += " ";
  215. DRTcompare.hRedBlue_Value[i][0] = DRTcompare.hRedBlue_Value[i][0].split(" ");
  216. DRTcompare.hRedBlue_Value[i][1] = DRTcompare.hRedBlue_Value[i][1].split(" ");
  217. if (DRTcompare.hRedBlue_Value[i][0].length <= 5) { alert(DRTcompare.AlertMsg["0003"]); return false; }
  218. } else { DRTcompare.hRedBlue_Value = DRTcompare.hRedBlue_Value.slice(0,DRTcompare.hRedBlue_Value.length - 1); };
  219. };
  220. if (DRTcompare.hRedBlue_Value.length > DRTcompare.Config["batchMax"]) { alert(DRTcompare.AlertMsg["0021"]); return false; };
  221. for (var i = 0; i < DRTcompare.ResultList.length; i++) { DRTcompare.ResultList[i] = ""; };
  222. DRTcompare.Calculate_Start();
  223. };
  224. DRTcompare.Calculate_Start = function () {
  225. var CountA, CountB;
  226. var historyA, historyB;
  227. var Zero, tmpArray;
  228. for (var i = 0; i < h2b.length; i++) {
  229. for (var j = 0; j < DRTcompare.hRedBlue_Value.length; j++) {
  230. historyA = "," + h2b[i][0] + ",";
  231. historyB = "," + h2b[i][1] + ",";
  232. tmpArray = "";
  233. CountA = DRTcompare.Calculate_Count(historyA, DRTcompare.hRedBlue_Value[j][0]);
  234. CountB = DRTcompare.Calculate_Count(historyB, DRTcompare.hRedBlue_Value[j][1]);
  235. if (CountA > 0) historyA = DRTcompare.Calculate_AddHTML(historyA, DRTcompare.hRedBlue_Value[j][0], "red");
  236. if (CountB > 0) historyB = DRTcompare.Calculate_AddHTML(historyB, DRTcompare.hRedBlue_Value[j][1], "blue");
  237. numZero = DRTcompare.Calculate_Zero(CountA, CountB);
  238. historyA = historyA.substring(1, historyA.length - 1).split(",");
  239. historyB = historyB.substring(1, historyB.length - 1).split(",");
  240. tmpArray = historyA + "+" + historyB + "+" + h2b[i][2] + "+" + i + "+" + j;
  241. DRTcompare.ResultList[numZero] += tmpArray + "||";
  242. };
  243. };
  244. var obj;
  245. for (var i = 0; i < DRTcompare.ResultList.length; i++) {
  246. DRTcompare.ResultList[i] = DRTcompare.ResultList[i].split("||");
  247. document.getElementById("resultx_" + i).innerHTML = DRTcompare.ResultList[i].length - 1;
  248. var info = DRTcompare.Result_Start(i);
  249. document.getElementById("show_" + i).innerHTML=info;
  250. };
  251. $('.hidden').hide();
  252. $(".list").click(function () {
  253. $(this).next().siblings(".list").find("a").attr('class', '');
  254. $(this).next().slideDown();
  255. $(this).find("a").attr('class', 'blue');
  256. $(this).next().siblings(".hidden").slideUp();
  257. });
  258. document.getElementById("result1").style.display = "";
  259. };
  260. DRTcompare.Calculate_Count = function (history,Array)
  261. {
  262. var tmpCount = 0;
  263. for (var i = 0; i < Array.length - 1; i++)
  264. {
  265. if (history.indexOf("," + Array[i] + ",") != -1) tmpCount++;
  266. };
  267. return tmpCount;
  268. };
  269. DRTcompare.Calculate_AddHTML = function (history,Array,type) {
  270. var tmpHistory = history;
  271. for (var i = 0; i < Array.length - 1; i++)
  272. {
  273. tmpHistory = tmpHistory.replace("," + Array[i] + ",",",<span class=" + ((type == "blue") ? "wblue" : "wred") + ">" + Array[i] + "</span>,");
  274. };
  275. return tmpHistory;
  276. };
  277. DRTcompare.Calculate_Zero = function (CountA,CountB)
  278. {
  279. var tmpZ;
  280. for (var i = 0; i < DRTcompare.Config["List"].length; i++)
  281. {
  282. if ((DRTcompare.Config["List"][i][0] == CountA) && (DRTcompare.Config["List"][i][2] == CountB))
  283. {
  284. tmpZ = i;
  285. break;
  286. };
  287. };
  288. return tmpZ;
  289. };
  290. DRTcompare.Result_onLoad = function ()
  291. {
  292. DRTcompare.ResultList = new Array();
  293. var o = "";
  294. o += DRTcompare.Result_onLoad2(0, 17, "result11");
  295. document.getElementById("result1").innerHTML = o;
  296. };
  297. DRTcompare.Result_onLoad2 = function (start,end,idname)
  298. {
  299. var o = "";
  300. o += "<div id='" + idname + "' class='gs-follow'>";
  301. for (var i = start; i <= end; i++) {
  302. DRTcompare.ResultList[i] = "";
  303. o += "<div class='list'><span>" + DRTcompare.AlertMsg["0004"] + " ";
  304. o += DRTcompare.Config["List"][i][0] + " " + DRTcompare.AlertMsg["0005"];
  305. o += DRTcompare.Config["List"][i][2] + " " + DRTcompare.AlertMsg["0006"] + " ";
  306. o += "<span id='resultx_" + i + "' class='Tresult2'></span>" + "&nbsp;" + DRTcompare.AlertMsg["0007"];
  307. o += "<a class=''>" + DRTcompare.AlertMsg["0008"] + "</a></span></div>";
  308. o += "<div class='hidden' id='show_"+i+"'></div>";
  309. };
  310. o += "</div>";
  311. return o;
  312. }
  313. DRTcompare.Result_ExArea = function ()
  314. {
  315. var exArea = window.prompt(DRTcompare.AlertMsg["0009"],DRTcompare.Config["exArea"]);
  316. if (Math.round(exArea) == NaN) exArea = 0;
  317. if (Math.round(exArea) >= 10) { alert(DRTcompare.AlertMsg["0011"]); return false; };
  318. DRTcompare.Config["exArea"] = Math.round(exArea);
  319. DRTcompare.Result_Show();
  320. };
  321. DRTcompare.Result_Start = function (numZero) { DRTcompare.CurrNumZero = numZero; var info = DRTcompare.Result_Show(); return info; };
  322. DRTcompare.Result_Show = function () {
  323. var o = "<ul class='hidden1 dlt'>";
  324. var numZero = DRTcompare.CurrNumZero;
  325. if (DRTcompare.ResultList[numZero] != "") {
  326. var r1 = ($("ul[name='r1']").attr("class") != "hide") ? 1 : 2;
  327. for (var i = 0; i < DRTcompare.ResultList[numZero].length - 1; i++) {
  328. DRTcompare.ResultList[numZero][i] = DRTcompare.ResultList[numZero][i].split("+");
  329. o += DRTcompare.ResultexList(DRTcompare.ResultList[numZero][i][3], "-");
  330. o += "<li class='list'>" + DRTcompare.AlertMsg["0017"] + DRTcompare.ResultList[numZero][i][2];
  331. o += DRTcompare.AlertMsg["0018"] + " " + DRTcompare.ResultList[numZero][i][0].split(",").join(" ");
  332. o += " + " + DRTcompare.ResultList[numZero][i][1].split(",").join(" ");
  333. o += "</li>";
  334. o += DRTcompare.ResultexList(DRTcompare.ResultList[numZero][i][3], "+");
  335. DRTcompare.ResultList[numZero][i] = DRTcompare.ResultList[numZero][i].join("+");
  336. };
  337. } else {
  338. o += DRTcompare.AlertMsg["0015"];
  339. };
  340. o += "</ul>";
  341. return o;
  342. };
  343. DRTcompare.ResultexList = function (historyID,type)
  344. {
  345. var startID,endID;
  346. historyID = Math.round(historyID);
  347. switch (type)
  348. {
  349. case "-": startID = historyID - DRTcompare.Config["exArea"]; endID = historyID - 1; break;
  350. case "+": startID = historyID + 1; endID = historyID + DRTcompare.Config["exArea"]; break;
  351. };
  352. if (startID < 0) startID = 0;
  353. if (endID >= h2b.length) endID = h2b.length - 1;
  354. var o = "";
  355. if (DRTcompare.Config["exArea"] > 0)
  356. {
  357. if (type == "-") o += "<div><img width=0 height=3></div>";
  358. for (var i = startID; i <= endID; i++)
  359. {
  360. o += "<div class='list'>" + DRTcompare.AlertMsg["0017"] + "" + h2b[i][2];
  361. o += DRTcompare.AlertMsg["0018"] + " " + h2b[i][0].split(",").join(" ");
  362. o += " + " + h2b[i][1] + "</div>";
  363. };
  364. if (type == "+") o += "<div></div>";
  365. };
  366. return o;
  367. };
  368. DRTcompare.AlertMsg = {
  369. "0001": "您选择或者输入的号码为空!",
  370. "0002": "批量对比数据列表中,出现非法的字符。",
  371. "0003": "选择的前区少于5个,查询过程不成立。",
  372. "0004": "开出过",
  373. "0005": "前",
  374. "0006": "后",
  375. "0007": "次",
  376. "0008": "显示历史开奖",
  377. "0009": "请输入您要扩展查询对比结果上下多少期的数值。例如:要扩展查询3 期就输入数字“3”。如您输入数字“0”,就表示不扩展查询。",
  378. "0010": "扩展对比结果上下n期",
  379. "0011": "您选择的扩展查询范围大于10期",
  380. "0012": "开出过",
  381. "0013": "个前区号与",
  382. "0014": "个后区号",
  383. "0015": "暂时没有对比成功的数据",
  384. "0016": "与",
  385. "0017": "第",
  386. "0018": "期",
  387. "0019": "注",
  388. "0020": "显示≤3个红球的结果",
  389. "0021": "您输入的批量数据超出最大限度!!"
  390. };
  391. Number.prototype.addzero = function (length)
  392. { var tmpStr = ""; var tmpNum = this.toString(); for (var i = 0; i < length - tmpNum.length; i++) { tmpStr += "0"; }; return tmpStr + tmpNum; };
  393. String.prototype.trim = function ()
  394. { return this.replace(/(^\s*)|(\s*$)/g,""); }
  395. window.onload = DRTcompare.Window_onLoad;
  396. document.forms["frm"].elements["r1"][0].onclick = function () { DRTcompare.r_onclick(this); };
  397. document.forms["frm"].elements["r1"][1].onclick = function () { DRTcompare.r_onclick(this); };