OLD | NEW |
| (Empty) |
1 <script> | |
2 | |
3 var botRoot = "http://build.chromium.org/buildbot/waterfall"; | |
4 | |
5 var botUrl = botRoot + "/horizontal_one_box_per_builder"; | |
6 | |
7 function updateStatus(status) { | |
8 var div = document.getElementById("status"); | |
9 div.title = status; | |
10 var open = /open/i; | |
11 if (open.exec(status)) { | |
12 div.innerHTML = "tree: open "; | |
13 div.className = "open"; | |
14 } else { | |
15 div.innerHTML = "tree: closed"; | |
16 div.className = "closed"; | |
17 } | |
18 } | |
19 | |
20 function requestStatus() { | |
21 var bots = document.getElementById("bots"); | |
22 if (bots) { | |
23 // TODO(erikkay): this generates "Unsafe JavaScript attempt to access frame | |
24 // with URL" | |
25 bots.src = botUrl + "?xxx=" + (new Date()).getTime(); | |
26 } | |
27 var xhr = new XMLHttpRequest(); | |
28 try { | |
29 xhr.onreadystatechange = function(state) { | |
30 if (xhr.readyState == 4) { | |
31 var text = xhr.responseText; | |
32 var re = /"Notice"[^>]*>([^<\n]+)</g; | |
33 var results = re.exec(text); | |
34 if (results && results.index >= 0) { | |
35 updateStatus(results[1]); | |
36 } else { | |
37 console.log("Error: couldn't find node"); | |
38 } | |
39 } | |
40 } | |
41 | |
42 xhr.onerror = function(error) { | |
43 console.log("xhr error: " + error); | |
44 } | |
45 | |
46 xhr.open("GET", "http://chromium-status.appspot.com/current"); | |
47 xhr.send({}); | |
48 } catch(e) { | |
49 console.log("exception: " + e); | |
50 } | |
51 setTimeout(requestStatus, 30000); | |
52 } | |
53 | |
54 function statusClick() { | |
55 window.open(botRoot); | |
56 } | |
57 | |
58 requestStatus(); | |
59 </script> | |
60 <link rel="stylesheet" type="text/css" href="extensions_toolstrip.css"> | |
61 <style> | |
62 .open { | |
63 color: green; | |
64 } | |
65 | |
66 .closed { | |
67 color: red; | |
68 } | |
69 | |
70 #bots { | |
71 border: none; | |
72 height: 20px; /* hardcoded height sucks */ | |
73 width: 435px; /* hardcoded width sucks */ | |
74 background-color: transparent; | |
75 display:-webkit-box; | |
76 } | |
77 | |
78 #frame-wrapper { | |
79 /* This is used to get us to vertically center the iframe in the vertical | |
80 space. */ | |
81 display:-webkit-box; | |
82 -webkit-box-align:center; | |
83 /* Also, scooch the frame in a bit, under the button, because the content of | |
84 the frame has some extra built-in left padding. */ | |
85 margin-left:-10px; | |
86 } | |
87 | |
88 </style> | |
89 | |
90 <div class="toolstrip-button" onclick="statusClick();"> | |
91 <span id="status" class="open">tree: open?</span> | |
92 </div> | |
93 | |
94 <div id="frame-wrapper"> | |
95 <iframe scrolling='no' id='bots' src="http://build.chromium.org/buildbot/waterfa
ll/horizontal_one_box_per_builder"></iframe> | |
96 </div> | |
OLD | NEW |