]> git.wh0rd.org Git - chrome-ext/web-power-switch.git/commitdiff
popup: use standard String.trim() now
authorMike Frysinger <vapier@gentoo.org>
Wed, 1 Apr 2020 02:32:41 +0000 (22:32 -0400)
committerMike Frysinger <vapier@gentoo.org>
Wed, 1 Apr 2020 02:32:41 +0000 (22:32 -0400)
popup.js

index bcb0dd4b5e81a8485b2fef439d038cb3d969dd33..be7fe61b445df9253d9b38c3677ff8b7a531a60e 100644 (file)
--- a/popup.js
+++ b/popup.js
@@ -95,8 +95,6 @@ function toggle_confirm() {
        }, 5000);
 }
 
-function trim(str) {
-       return str.replace(/^\s+|\s+$/, '');
 }
 
 function initpopup(xhr, state) {
@@ -120,7 +118,7 @@ function initpopup(xhr, state) {
                if (th.bgColor != '#DDDDFF')
                        continue;
 
-               var controller_name = trim(th.innerText);
+               var controller_name = th.innerText.trim();
                if (controller_name.slice(0, 12) != 'Controller: ')
                        continue;
 
@@ -137,10 +135,10 @@ function initpopup(xhr, state) {
                if (tr.bgColor != '#F4F4F4')
                        continue;
 
-               var outlet_num     = trim(tr.children[0].innerText);
-               var outlet_name    = trim(tr.children[1].innerText);
-               var current_status = trim(tr.children[2].innerText);
-               var new_status     = trim(tr.children[3].innerText);
+               var outlet_num     = tr.children[0].innerText.trim();
+               var outlet_name    = tr.children[1].innerText.trim();
+               var current_status = tr.children[2].innerText.trim();
+               var new_status     = tr.children[3].innerText.trim();
                var confirmable    = tr.children[3].children[0].hasAttribute('onclick');
 
                row = tbl.insertRow(-1);