| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"/> |
| 5 | <title>dojox.mobile auto run</title> |
| 6 | <script src="index.js"></script> |
| 7 | <script> |
| 8 | var tests, win, c, data, map = {}, theme = ""; |
| 9 | function sort(keys){ |
| 10 | var data = []; |
| 11 | for(var i = 0; i < keys.length; i++){ |
| 12 | var key = keys[i]; |
| 13 | var items = []; |
| 14 | items.label = key.label; |
| 15 | for(var j = 0; j < tests.length; j++){ |
| 16 | var item = tests[j]; |
| 17 | var url = item.url; |
| 18 | var label = item.label || item.url; |
| 19 | var tags = item.tags ? item.tags.split(/,/) : []; |
| 20 | for(var k = 0; k < tags.length; k++){ |
| 21 | if(tags[k] === key.tag){ |
| 22 | items.push(item); |
| 23 | } |
| 24 | } |
| 25 | } |
| 26 | data.push(items); |
| 27 | map[key.label] = items; |
| 28 | } |
| 29 | return data; |
| 30 | } |
| 31 | function init(){ |
| 32 | c = document.getElementById("container"); |
| 33 | var data = sort(categories); |
| 34 | for(var i = 0; i < data.length; i++){ |
| 35 | var cat = data[i]; |
| 36 | var inp = document.createElement("input"); |
| 37 | inp.type = "checkbox"; |
| 38 | inp.name = cat.label; |
| 39 | c.appendChild(inp); |
| 40 | c.appendChild(document.createTextNode(cat.label)); |
| 41 | c.appendChild(document.createElement("br")); |
| 42 | } |
| 43 | } |
| 44 | function checkAll(v){ |
| 45 | for(var i = 0; i < c.childNodes.length; i++){ |
| 46 | var inp = c.childNodes[i]; |
| 47 | if(inp.tagName !== "INPUT"){ continue; } |
| 48 | inp.checked = v; |
| 49 | } |
| 50 | } |
| 51 | function run(idx){ |
| 52 | win.location.href = tests[idx++] + (theme ? "?theme=" + theme : ""); |
| 53 | setTimeout(function(){ |
| 54 | if(idx < tests.length){ |
| 55 | run(idx); |
| 56 | }else{ |
| 57 | win.close(); |
| 58 | } |
| 59 | }, document.forms[0].interval.value - 0); |
| 60 | } |
| 61 | function start1(){ |
| 62 | tests = []; |
| 63 | for(var i = 0; i < c.childNodes.length; i++){ |
| 64 | var inp = c.childNodes[i]; |
| 65 | if(inp.tagName !== "INPUT" || !inp.checked){ continue; } |
| 66 | var label = inp.name; |
| 67 | console.log(label); |
| 68 | var items = map[label]; |
| 69 | for(var j = 0; j < items.length; j++){ |
| 70 | tests.push(items[j].url); |
| 71 | } |
| 72 | } |
| 73 | win = window.open("about:blank", "_blank"); |
| 74 | run(0); |
| 75 | } |
| 76 | function onThemeChange(){ |
| 77 | theme = document.getElementById("sel1").value; |
| 78 | } |
| 79 | </script> |
| 80 | </head> |
| 81 | <body onload="init()"> |
| 82 | <form> |
| 83 | <select id="sel1" onchange="onThemeChange()"> |
| 84 | <option value=""></option> |
| 85 | <option value="iPhone">iPhone</option> |
| 86 | <option value="Android">Android</option> |
| 87 | <option value="BlackBerry">BlackBerry</option> |
| 88 | <option value="Custom">Custom</option> |
| 89 | </select> |
| 90 | <input id="btn" type="button" onclick="start1()" value=" START "><br> |
| 91 | <hr> |
| 92 | Interval: <input name="interval" value="5000"> [ms]<br> |
| 93 | <div id="container"></div> |
| 94 | <hr> |
| 95 | <input id="btn" type="button" onclick="checkAll(true)" value=" Check All "> |
| 96 | <input id="btn" type="button" onclick="checkAll(false)" value=" Uncheck All "><br> |
| 97 | </form> |
| 98 | </body> |
| 99 | </html> |