mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-06 08:51:14 -03:00
web_config js: lots of undeclared local variables
This commit is contained in:
@@ -85,21 +85,21 @@ function adjust_lightness(color_str, func) {
|
|||||||
if (color_str == 'white') color_str = 'c0c0c0';
|
if (color_str == 'white') color_str = 'c0c0c0';
|
||||||
|
|
||||||
|
|
||||||
rgb = parseInt(color_str, 16)
|
var rgb = parseInt(color_str, 16)
|
||||||
r = (rgb >> 16) & 0xFF
|
var r = (rgb >> 16) & 0xFF
|
||||||
g = (rgb >> 8) & 0xFF
|
var g = (rgb >> 8) & 0xFF
|
||||||
b = (rgb >> 0) & 0xFF
|
var b = (rgb >> 0) & 0xFF
|
||||||
|
|
||||||
hsl = rgb_to_hsl(r, g, b)
|
var hsl = rgb_to_hsl(r, g, b)
|
||||||
new_lightness = func(hsl[2])
|
var new_lightness = func(hsl[2])
|
||||||
function to_int_str(val) {
|
function to_int_str(val) {
|
||||||
str = Math.round(val).toString(16)
|
var str = Math.round(val).toString(16)
|
||||||
while (str.length < 2)
|
while (str.length < 2)
|
||||||
str = '0' + str
|
str = '0' + str
|
||||||
return 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])
|
return to_int_str(new_rgb[0]) + to_int_str(new_rgb[1]) + to_int_str(new_rgb[2])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -146,11 +146,11 @@ controllers.controller("colorsController", function($scope, $http) {
|
|||||||
"fish_pager_color_progress"
|
"fish_pager_color_progress"
|
||||||
];
|
];
|
||||||
var remaining = settingNames.length;
|
var remaining = settingNames.length;
|
||||||
postdata = {
|
var postdata = {
|
||||||
"theme" : $scope.selectedColorScheme["name"],
|
"theme" : $scope.selectedColorScheme["name"],
|
||||||
"colors": [],
|
"colors": [],
|
||||||
}
|
}
|
||||||
for (name of settingNames) {
|
for (var name of settingNames) {
|
||||||
var selected;
|
var selected;
|
||||||
// Skip colors undefined in the current theme
|
// Skip colors undefined in the current theme
|
||||||
// js is dumb - the empty string is false,
|
// js is dumb - the empty string is false,
|
||||||
@@ -235,16 +235,16 @@ controllers.controller("functionsController", function($scope, $http) {
|
|||||||
|
|
||||||
$scope.cleanupFishFunction = function (contents) {
|
$scope.cleanupFishFunction = function (contents) {
|
||||||
/* Replace leading tabs and groups of four spaces at the beginning of a line with two spaces. */
|
/* Replace leading tabs and groups of four spaces at the beginning of a line with two spaces. */
|
||||||
lines = contents ? contents.split('\n') : [];
|
var lines = contents ? contents.split('\n') : [];
|
||||||
rx = /^[\t ]+/
|
var rx = /^[\t ]+/
|
||||||
for (var i=0; i < lines.length; i++) {
|
for (var i=0; i < lines.length; i++) {
|
||||||
line = lines[i]
|
var line = lines[i]
|
||||||
/* Get leading tabs and spaces */
|
/* Get leading tabs and spaces */
|
||||||
whitespace_arr = rx.exec(line)
|
var whitespace_arr = rx.exec(line)
|
||||||
if (whitespace_arr) {
|
if (whitespace_arr) {
|
||||||
/* Replace four spaces with two spaces, and tabs with two spaces */
|
/* Replace four spaces with two spaces, and tabs with two spaces */
|
||||||
var whitespace = whitespace_arr[0]
|
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)
|
lines[i] = new_whitespace + line.slice(whitespace.length)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -380,7 +380,7 @@ controllers.controller("abbreviationsController", function($scope, $http) {
|
|||||||
$scope.abbreviations = [];
|
$scope.abbreviations = [];
|
||||||
$scope.addBlank = function() {
|
$scope.addBlank = function() {
|
||||||
// Add blank entry if it is missing
|
// Add blank entry if it is missing
|
||||||
hasBlank = {hasBlank: false}
|
var hasBlank = {hasBlank: false}
|
||||||
angular.forEach($scope.abbreviations, function(value, key) {
|
angular.forEach($scope.abbreviations, function(value, key) {
|
||||||
if (value.phrase === "" && value.word === "") {
|
if (value.phrase === "" && value.word === "") {
|
||||||
this.hasBlank = true;
|
this.hasBlank = true;
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ filters.filter("filterVariable", function() {
|
|||||||
if (variables == undefined) return result;
|
if (variables == undefined) return result;
|
||||||
if (query == null) { return variables };
|
if (query == null) { return variables };
|
||||||
|
|
||||||
for(i=0; i<variables.length; ++i) {
|
for(var i=0; i<variables.length; ++i) {
|
||||||
variable = variables[i];
|
var variable = variables[i];
|
||||||
if (variable.name.indexOf(query) != -1 || variable.value.indexOf(query) != -1) {
|
if (variable.name.indexOf(query) != -1 || variable.value.indexOf(query) != -1) {
|
||||||
result.push(variable);
|
result.push(variable);
|
||||||
}
|
}
|
||||||
@@ -23,14 +23,14 @@ filters.filter("filterBinding", function() {
|
|||||||
if (bindings == undefined) return result;
|
if (bindings == undefined) return result;
|
||||||
if (query == null) { return bindings};
|
if (query == null) { return bindings};
|
||||||
|
|
||||||
for(i=0; i<bindings.length; ++i) {
|
for(var i=0; i<bindings.length; ++i) {
|
||||||
binding = bindings[i];
|
var binding = bindings[i];
|
||||||
if (binding.command.indexOf(query) != -1) {
|
if (binding.command.indexOf(query) != -1) {
|
||||||
result.push(binding);
|
result.push(binding);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
varieties = binding.bindings;
|
var varieties = binding.bindings;
|
||||||
for (j=0; j<varieties.length; ++j) {
|
for (var j=0; j<varieties.length; ++j) {
|
||||||
if (varieties[j].readable_binding.toLowerCase().indexOf(query.toLowerCase()) != -1) {
|
if (varieties[j].readable_binding.toLowerCase().indexOf(query.toLowerCase()) != -1) {
|
||||||
result.push(binding);
|
result.push(binding);
|
||||||
break;
|
break;
|
||||||
@@ -48,8 +48,8 @@ filters.filter("filterAbbreviations", function() {
|
|||||||
if (abbreviations == undefined) return result;
|
if (abbreviations == undefined) return result;
|
||||||
if (query == null) { return abbreviations};
|
if (query == null) { return abbreviations};
|
||||||
|
|
||||||
for(i=0; i<abbreviations.length; ++i) {
|
for(var i=0; i<abbreviations.length; ++i) {
|
||||||
abbr = abbreviations[i];
|
var abbr = abbreviations[i];
|
||||||
if (abbr.word.toLowerCase().indexOf(query) != -1 || abbr.phrase.toLowerCase().indexOf(query.toLowerCase()) != -1) {
|
if (abbr.word.toLowerCase().indexOf(query) != -1 || abbr.phrase.toLowerCase().indexOf(query.toLowerCase()) != -1) {
|
||||||
result.push(abbr);
|
result.push(abbr);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user