From cb10f34f2e252f84cb4e4912a3c66cfe08f1d43b Mon Sep 17 00:00:00 2001 From: Aaron Gyes Date: Sun, 12 Dec 2021 12:32:32 -0800 Subject: [PATCH] web_config js: lots of undeclared local variables --- share/tools/web_config/js/colorutils.js | 16 ++++++++-------- share/tools/web_config/js/controllers.js | 16 ++++++++-------- share/tools/web_config/js/filters.js | 16 ++++++++-------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/share/tools/web_config/js/colorutils.js b/share/tools/web_config/js/colorutils.js index 23674bf93..8497bd556 100644 --- a/share/tools/web_config/js/colorutils.js +++ b/share/tools/web_config/js/colorutils.js @@ -85,21 +85,21 @@ function adjust_lightness(color_str, func) { if (color_str == 'white') color_str = 'c0c0c0'; - rgb = parseInt(color_str, 16) - r = (rgb >> 16) & 0xFF - g = (rgb >> 8) & 0xFF - b = (rgb >> 0) & 0xFF + var rgb = parseInt(color_str, 16) + var r = (rgb >> 16) & 0xFF + var g = (rgb >> 8) & 0xFF + var b = (rgb >> 0) & 0xFF - hsl = rgb_to_hsl(r, g, b) - new_lightness = func(hsl[2]) + var hsl = rgb_to_hsl(r, g, b) + var new_lightness = func(hsl[2]) function to_int_str(val) { - str = Math.round(val).toString(16) + var str = Math.round(val).toString(16) while (str.length < 2) str = '0' + str return str } - new_rgb = hsl_to_rgb(hsl[0], hsl[1], new_lightness) + var new_rgb = hsl_to_rgb(hsl[0], hsl[1], new_lightness) return to_int_str(new_rgb[0]) + to_int_str(new_rgb[1]) + to_int_str(new_rgb[2]) } diff --git a/share/tools/web_config/js/controllers.js b/share/tools/web_config/js/controllers.js index f30f1d4ec..b29de6d47 100644 --- a/share/tools/web_config/js/controllers.js +++ b/share/tools/web_config/js/controllers.js @@ -146,11 +146,11 @@ controllers.controller("colorsController", function($scope, $http) { "fish_pager_color_progress" ]; var remaining = settingNames.length; - postdata = { + var postdata = { "theme" : $scope.selectedColorScheme["name"], "colors": [], } - for (name of settingNames) { + for (var name of settingNames) { var selected; // Skip colors undefined in the current theme // js is dumb - the empty string is false, @@ -235,16 +235,16 @@ controllers.controller("functionsController", function($scope, $http) { $scope.cleanupFishFunction = function (contents) { /* Replace leading tabs and groups of four spaces at the beginning of a line with two spaces. */ - lines = contents ? contents.split('\n') : []; - rx = /^[\t ]+/ + var lines = contents ? contents.split('\n') : []; + var rx = /^[\t ]+/ for (var i=0; i < lines.length; i++) { - line = lines[i] + var line = lines[i] /* Get leading tabs and spaces */ - whitespace_arr = rx.exec(line) + var whitespace_arr = rx.exec(line) if (whitespace_arr) { /* Replace four spaces with two spaces, and tabs with two spaces */ var whitespace = whitespace_arr[0] - new_whitespace = whitespace.replace(/( )|(\t)/g, ' ') + var new_whitespace = whitespace.replace(/( )|(\t)/g, ' ') lines[i] = new_whitespace + line.slice(whitespace.length) } } @@ -380,7 +380,7 @@ controllers.controller("abbreviationsController", function($scope, $http) { $scope.abbreviations = []; $scope.addBlank = function() { // Add blank entry if it is missing - hasBlank = {hasBlank: false} + var hasBlank = {hasBlank: false} angular.forEach($scope.abbreviations, function(value, key) { if (value.phrase === "" && value.word === "") { this.hasBlank = true; diff --git a/share/tools/web_config/js/filters.js b/share/tools/web_config/js/filters.js index a3a4ec70d..073869550 100644 --- a/share/tools/web_config/js/filters.js +++ b/share/tools/web_config/js/filters.js @@ -6,8 +6,8 @@ filters.filter("filterVariable", function() { if (variables == undefined) return result; if (query == null) { return variables }; - for(i=0; i