From 3857351138595924308dbfd84bb06a46b3b8a978 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sun, 14 Apr 2013 23:27:09 -0400 Subject: [PATCH] extract user-set name for device, and link to the system --- popup.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) 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 -- 2.39.2