From c3bc6934e0180ddb1719ebc59cea5b92a5499cc5 Mon Sep 17 00:00:00 2001
From: Jonathan Wilkes <jon.w.wilkes@gmail.com>
Date: Thu, 25 Feb 2016 23:46:18 -0500
Subject: [PATCH] fix problems discovered with jslint

---
 pd/nw/dialog_gatom.html  |  4 ++--
 pd/nw/dialog_iemgui.html |  9 +++++----
 pd/nw/dialog_prefs.html  | 21 +++++++++++----------
 pd/nw/dialog_search.html | 10 +++++-----
 4 files changed, 23 insertions(+), 21 deletions(-)

diff --git a/pd/nw/dialog_gatom.html b/pd/nw/dialog_gatom.html
index 26828f55a..cf6e4b5d3 100644
--- a/pd/nw/dialog_gatom.html
+++ b/pd/nw/dialog_gatom.html
@@ -146,7 +146,7 @@
 
   <script>
 "use strict";
-var gui = require("nw.gui"); 
+var gui = require("nw.gui");
 var pdgui = require("./pdgui.js");
 
 // For translations
@@ -197,7 +197,7 @@ function update_attr(elem) {
 
 function send_params(attrs, create_undo_point) {
     //pdgui.post("we're applying gatom changes!");
-    pdgui.pdsend(pd_object_callback, "param", 
+    pdgui.pdsend(pd_object_callback, "param",
         +attrs.width,
         +attrs.draglo,
         +attrs.draghi,
diff --git a/pd/nw/dialog_iemgui.html b/pd/nw/dialog_iemgui.html
index 0e66710a7..ed7e52bde 100644
--- a/pd/nw/dialog_iemgui.html
+++ b/pd/nw/dialog_iemgui.html
@@ -327,7 +327,7 @@
 
   <script>
 "use strict";
-var gui = require("nw.gui"); 
+var gui = require("nw.gui");
 var pdgui = require("./pdgui.js");
 
 // For translations
@@ -346,9 +346,10 @@ function substitute_space(arg) {
 }
 
 function strip_problem_chars(arg) {
-    var problem_chars = [";", ",", "{", "}", "\\"];
-    var ret = arg;
-    for(var i = 0; i < problem_chars.length; i++) {
+    var problem_chars = [";", ",", "{", "}", "\\"],
+        ret = arg,
+        i;
+    for(i = 0; i < problem_chars.length; i++) {
         ret = ret.split(";").join("");
     }
     return ret;
diff --git a/pd/nw/dialog_prefs.html b/pd/nw/dialog_prefs.html
index 618113fdd..78b107c5b 100644
--- a/pd/nw/dialog_prefs.html
+++ b/pd/nw/dialog_prefs.html
@@ -252,7 +252,7 @@
     </div>
   <script>
 "use strict";
-var gui = require("nw.gui"); 
+var gui = require("nw.gui");
 var pdgui = require("./pdgui.js");
 
 // For translations
@@ -451,7 +451,7 @@ function populate_devs(type, attrs) {
         elem.appendChild(opt);
         for (j = 0; j < devs.length; j++) {
             opt = document.createElement("option");
-            opt.value = j; 
+            opt.value = j;
             opt.textContent = devs[j];
             elem.appendChild(opt);
         }
@@ -479,7 +479,7 @@ function populate_midi_devs(type, attrs) {
         elem.appendChild(opt);
         for (j = 0; j < devs.length; j++) {
             opt = document.createElement("option");
-            opt.value = j; 
+            opt.value = j;
             opt.textContent = devs[j];
             elem.appendChild(opt);
         }
@@ -507,8 +507,8 @@ function audio_prefs_callback(attrs) {
     document.getElementById("blocksize").value = get_attr("blocksize", attrs);
     document.getElementById("advance").value = get_attr("advance", attrs);
 
-    var callback = get_attr("cancallback", attrs);
-    //show the checkbox if the API allows 
+    callback = get_attr("cancallback", attrs);
+    //show the checkbox if the API allows
     if (callback !== -1) {
         document.getElementById("callback_container")
             .classList.remove("hidden");
@@ -594,10 +594,11 @@ function tr_text(id) {
 
 // Stop-gap translator
 function translate_form() {
-    var i;
-    var elements = document.querySelectorAll("[data-i18n]");
+    var elements = document.querySelectorAll("[data-i18n]"),
+        data,
+        i;
     for (i = 0; i < elements.length; i++) {
-        var data = elements[i].dataset.i18n;
+        data = elements[i].dataset.i18n;
         if (data.slice(0,7) === "[title]") {
             elements[i].title = l(data.slice(7));
         } else {
@@ -608,8 +609,8 @@ function translate_form() {
 
 function populate_form(attr_array) {
     // First, let's put the translated text for the form labels:
-
-    for(var i = 0; i < attr_array.length; i+=2) {
+    var i;
+    for(i = 0; i < attr_array.length; i+=2) {
         // Unhide the span with the class with the same name as the id
         var prop_group = document.getElementsByClassName(attr_array[i])[0];
         if (prop_group !== undefined) {
diff --git a/pd/nw/dialog_search.html b/pd/nw/dialog_search.html
index c2edd3f41..0c0b0e7f6 100644
--- a/pd/nw/dialog_search.html
+++ b/pd/nw/dialog_search.html
@@ -28,10 +28,11 @@ var doc_id = 0;
 
 // Stop-gap translator
 function translate_form() {
-    var i;
-    var elements = document.querySelectorAll("[data-i18n]");
+    var elements = document.querySelectorAll("[data-i18n]"),
+        data,
+        i;
     for (i = 0; i < elements.length; i++) {
-        var data = elements[i].dataset.i18n;
+        data = elements[i].dataset.i18n;
         if (data.slice(0,7) === "[title]") {
             elements[i].title = l(data.slice(7));
         } else {
@@ -67,7 +68,6 @@ function add_doc_to_index(filename, data) {
         //"body": big_line,
         "path": filename
     });
-    
 }
 
 function read_file(err, filename, stat) {
@@ -107,7 +107,7 @@ function console_unwrap_tag(console_elem, tag_name) {
         while(b[0].firstChild) {
             parent_elem.insertBefore(b[0].firstChild, b[0]);
         }
-        parent_elem.removeChild(b[0]); 
+        parent_elem.removeChild(b[0]);
         parent_elem.normalize();
     }
 }
-- 
GitLab