X-Git-Url: https://git.wh0rd.org/?p=chrome-ext%2Fweb-power-switch.git;a=blobdiff_plain;f=popup.js;h=189bbb74d071ab6d74bdb4f2d7b37bd58df6867e;hp=7ba21e2505df7cb947b21b1a30bb5e7b91871813;hb=3857351138595924308dbfd84bb06a46b3b8a978;hpb=e981c8374cda5aef50354d7f4f3c7233ee0ffe7b diff --git a/popup.js b/popup.js index 7ba21e2..189bbb7 100644 --- a/popup.js +++ b/popup.js @@ -88,6 +88,31 @@ function initpopup(xhr, state) { // There is no clean API for extracting the current state. // Example result: + /* + + + Controller: !!!Web Power Switch 6 + + + */ + + var th, ths = state.currentTarget.responseXML.querySelectorAll('th'); + for (var i = 0; th = ths[i]; ++i) { + if (th.bgColor != '#DDDDFF') + continue; + + var controller_name = trim(th.innerText); + if (controller_name.slice(0, 12) != 'Controller: ') + continue; + + row = tbl.insertRow(-1); + cell = row.insertCell(-1); + cell.colSpan = 2; + cell.align = 'center'; + cell.innerText = controller_name.slice(12); + cell.innerHTML = '' + cell.innerHTML + '' + } + /* 1 Outlet 1