From 042f9ffb554f5c87c3d0b736637dd3ad072580a1 Mon Sep 17 00:00:00 2001
From: Jonathan Wilkes <jon.w.wilkes@gmail.com>
Date: Thu, 25 Feb 2016 22:51:00 -0500
Subject: [PATCH] fix some jslint warnings and remove unnecessary use of `this`

---
 pd/nw/dialog_canvas.html | 30 ++++++++++++++++--------------
 pd/nw/dialog_font.html   |  2 +-
 pd/nw/dialog_gatom.html  |  2 +-
 pd/nw/dialog_iemgui.html |  2 +-
 pd/nw/dialog_prefs.html  |  2 +-
 pd/nw/dialog_search.html |  6 ++++++
 pd/nw/index.js           |  2 +-
 pd/nw/pd_canvas.js       |  2 +-
 8 files changed, 28 insertions(+), 20 deletions(-)

diff --git a/pd/nw/dialog_canvas.html b/pd/nw/dialog_canvas.html
index be780483a..e5c2a3afb 100644
--- a/pd/nw/dialog_canvas.html
+++ b/pd/nw/dialog_canvas.html
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <meta charset="UTF-8">
     <link id="page_style" rel="stylesheet" type="text/css" href="css/default.css">
     <title>Pd Preferences</title>
   </head>
@@ -277,14 +278,14 @@
 
   <script>
 "use strict";
-var gui = require("nw.gui"); 
+var gui = require("nw.gui");
 var pdgui = require("./pdgui.js");
 
 // For translations
 var l = pdgui.get_local_string;
 
 // gui preset
-pdgui.skin.apply(this);
+pdgui.skin.apply(window);
 
 var pd_object_callback;
 
@@ -422,9 +423,9 @@ function array_choose(array_index) {
 }
 
 var arrays_select = document.getElementById("arrays_select");
-arrays_select.addEventListener("change", function() {
-    pdgui.post("changed the thing is " + this.value);
-    array_choose(this.value);
+arrays_select.addEventListener("change", function(evt) {
+    pdgui.post("changing to array index " + evt.target.value);
+    array_choose(evt.target.value);
 });
 
 var gop_label = document.getElementById("gop_label");
@@ -487,9 +488,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;
@@ -598,10 +600,10 @@ function populate_array_form(objects) {
         opt.textContent = "Array #" + (i+1);
         arrays_select.appendChild(opt);
     }
-    // We're permanently hiding the checkbutton for creating a new array 
+    // We're permanently hiding the checkbutton for creating a new array
     // inside an existing graph. It's just a weird interface with very
-    // few benefits. However, patches that already have multiple arrays 
-    // inside a graph will continue to work.  (And if users really want 
+    // few benefits. However, patches that already have multiple arrays
+    // inside a graph will continue to work.  (And if users really want
     // this feature back it's easy to turn it back on.
     if (!new_array_dialog || 1) {  // to re-enable, remove the "|| 1"
         document.getElementsByClassName("array_in_existing_graph")[0]
@@ -616,7 +618,7 @@ function populate_array_form(objects) {
 }
 
 // Set up arrays in an object
-    
+
 function init_arrays(attr_objects) {
     if (attr_objects.length) {
         // populate form with first array
@@ -648,7 +650,7 @@ function register_window_id(gfxstub, attr_objects) {
     // If this is a new array dialog we might not have any canvas
     // properties to set. If so, just show the array form elements
     if (attr_objects[0].hasOwnProperty("array_gfxstub")) {
-        pd_garray_attrs = attr_objects; 
+        pd_garray_attrs = attr_objects;
         new_array_dialog = true; // this is a new array dialog
         canvas_fieldsets = document.getElementsByClassName("canvas");
         for (i = 0; i < canvas_fieldsets.length; i++) {
@@ -709,7 +711,7 @@ function populate_form(attr_object) {
                 // Set the gop-related parts of the form to be
                 // enabled/disabled based on state
                 set_gop(!!flag);
-            }            
+            }
             var elem = document.getElementsByName(prop);
             if (elem.length > 0) {
                 if(prop.slice(-5) === "color") {
diff --git a/pd/nw/dialog_font.html b/pd/nw/dialog_font.html
index 0a6b04765..b334af239 100644
--- a/pd/nw/dialog_font.html
+++ b/pd/nw/dialog_font.html
@@ -94,7 +94,7 @@ var pdgui = require("./pdgui.js");
 // For translations
 var l = pdgui.get_local_string;
 
-pdgui.skin.apply(this);
+pdgui.skin.apply(window);
 
 var pd_object_callback;
 var current_size;
diff --git a/pd/nw/dialog_gatom.html b/pd/nw/dialog_gatom.html
index 725c51b0e..26828f55a 100644
--- a/pd/nw/dialog_gatom.html
+++ b/pd/nw/dialog_gatom.html
@@ -152,7 +152,7 @@ var pdgui = require("./pdgui.js");
 // For translations
 var l = pdgui.get_local_string;
 
-pdgui.skin.apply(this);
+pdgui.skin.apply(window);
 
 var pd_object_callback,
     old_attrs = {}, // original state. Used if we cancel the dialog
diff --git a/pd/nw/dialog_iemgui.html b/pd/nw/dialog_iemgui.html
index f71d177fd..0e66710a7 100644
--- a/pd/nw/dialog_iemgui.html
+++ b/pd/nw/dialog_iemgui.html
@@ -334,7 +334,7 @@ var pdgui = require("./pdgui.js");
 var l = pdgui.get_local_string;
 
 // gui preset
-pdgui.skin.apply(this);
+pdgui.skin.apply(window);
 
 var pd_object_callback,
     old_attrs = {}, // original state. Used if we cancel the dialog
diff --git a/pd/nw/dialog_prefs.html b/pd/nw/dialog_prefs.html
index df5bf774a..618113fdd 100644
--- a/pd/nw/dialog_prefs.html
+++ b/pd/nw/dialog_prefs.html
@@ -259,7 +259,7 @@ var pdgui = require("./pdgui.js");
 var l = pdgui.get_local_string;
 
 // Gui presets
-pdgui.skin.apply(this);
+pdgui.skin.apply(window);
 
 var pd_object_callback;
 
diff --git a/pd/nw/dialog_search.html b/pd/nw/dialog_search.html
index 281ab9383..c2edd3f41 100644
--- a/pd/nw/dialog_search.html
+++ b/pd/nw/dialog_search.html
@@ -15,6 +15,9 @@ var dive = require("./dive.js"); // small module to recursively search dirs
 var l = pdgui.get_local_string;
 
 var index = elasticlunr();
+
+pdgui.skin.apply(window);
+
 index.addField("title");
 index.addField("keywords");
 index.addField("description");
@@ -333,6 +336,9 @@ function doc_search() {
     </script>
   </head>
   <body>
+    <div style="font-family: Courier 10 Pitch; font-size: 2.5em;">
+      <span style="color: #c44654;">P</span><span style="color: #ac399c;">u</span><span style="color: #54439c;">r</span><span style="color: #ce4d3d;">e</span><span style="color: #3c9e54;">d</span><span style="color: #7349a4;">a</span><span style="color: purple;">t</span><span style="color: #7349a4;">a</span>
+    </div>
     <svg xmlns="http://www.w3.org/2000/svg"
          version="1.1"
          viewBox="0 0 450 65"
diff --git a/pd/nw/index.js b/pd/nw/index.js
index 1701a223c..02655fa40 100644
--- a/pd/nw/index.js
+++ b/pd/nw/index.js
@@ -9,7 +9,7 @@ var pd_menus = require("./pd_menus.js");
 var pwd = process.env.PWD !== undefined ? process.env.PWD : process.env.HOME;
 
 // gui preset
-pdgui.skin.apply(this);
+pdgui.skin.apply(window);
 
 // For translations
 var l = pdgui.get_local_string;
diff --git a/pd/nw/pd_canvas.js b/pd/nw/pd_canvas.js
index d997f7f40..e51bd219c 100644
--- a/pd/nw/pd_canvas.js
+++ b/pd/nw/pd_canvas.js
@@ -5,7 +5,7 @@ var pdgui = require("./pdgui.js");
 var pd_menus = require("./pd_menus.js");
 
 // Apply gui preset to this canvas
-pdgui.skin.apply(this);
+pdgui.skin.apply(window);
 
 //var name = pdgui.last_loaded();
    
-- 
GitLab