Skip to content

Commit

Permalink
Convert array declaration in JS.
Browse files Browse the repository at this point in the history
Remove useless code.
Remove useless declarations.

Signed-off-by: Hugues Peccatte <hugues.peccatte@gmail.com>
  • Loading branch information
Tithugues committed Dec 11, 2015
1 parent ff4517c commit c721815
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 29 deletions.
4 changes: 2 additions & 2 deletions js/db_structure.js
Expand Up @@ -37,15 +37,15 @@ AJAX.registerTeardown('db_structure.js', function () {
* when truncating, creating, dropping or inserting into a table
*/
function PMA_adjustTotals() {
var byteUnits = new Array(
var byteUnits = [
PMA_messages.strB,
PMA_messages.strKiB,
PMA_messages.strMiB,
PMA_messages.strGiB,
PMA_messages.strTiB,
PMA_messages.strPiB,
PMA_messages.strEiB
);
];
/**
* @var $allTr jQuery object that references all the rows in the list of tables
*/
Expand Down
19 changes: 9 additions & 10 deletions js/error_report.js
Expand Up @@ -166,18 +166,17 @@ var ErrorReport = {
* @return String
*/
_extractExceptionName: function (exception) {
if (exception.message === null || typeof(exception.message) == "undefined"){
if (exception.message === null || typeof(exception.message) == "undefined") {
return "";
} else {
var reg = /([a-zA-Z]+):/;
var regex_result = null;
regex_result = reg.exec(exception.message);
if (regex_result && regex_result.length == 2) {
return regex_result[1];
} else {
return "";
}
}

var reg = /([a-zA-Z]+):/;
var regex_result = reg.exec(exception.message);
if (regex_result && regex_result.length == 2) {
return regex_result[1];
}

return "";
},
/**
* Shows the modal dialog previewing the report
Expand Down
5 changes: 2 additions & 3 deletions js/keyhandler.js
Expand Up @@ -51,8 +51,6 @@ function onKeyDownArrowsHandler(e)

var x = pos[2], y = pos[1];

var nO = null;

switch (e.keyCode) {
case 38:
// up
Expand All @@ -77,7 +75,8 @@ function onKeyDownArrowsHandler(e)
var is_firefox = navigator.userAgent.toLowerCase().indexOf("firefox/") > -1;

var id = "field_" + y + "_" + x;
nO = document.getElementById(id);

var nO = document.getElementById(id);
if (! nO) {
id = "field_" + y + "_" + x + "_0";
nO = document.getElementById(id);
Expand Down
18 changes: 9 additions & 9 deletions js/pmd/move.js
Expand Up @@ -1686,14 +1686,14 @@ function getColorByTarget(target)
var j = (i - d) / 6;
j = j % 4;
j++;
var color_case = new Array(
new Array(1, 0, 0),
new Array(0, 1, 0),
new Array(0, 0, 1),
new Array(1, 1, 0),
new Array(1, 0, 1),
new Array(0, 1, 1)
);
var color_case = [
[1, 0, 0],
[0, 1, 0],
[0, 0, 1],
[1, 1, 0],
[1, 0, 1],
[0, 1, 1]
];
var a = color_case[d][0];
var b = color_case[d][1];
var c = color_case[d][2];
Expand All @@ -1704,7 +1704,7 @@ function getColorByTarget(target)
b = Math.round(c * 200 * e);
color = "rgba(" + r + "," + g + "," + b + ",1)";

TargetColors.push(new Array(target, color));
TargetColors.push([target, color]);
}

return color;
Expand Down
4 changes: 0 additions & 4 deletions js/tbl_chart.js
Expand Up @@ -304,10 +304,6 @@ AJAX.registerOnload('tbl_chart.js', function () {
temp_chart_title = $(this).val();
})
.keyup(function () {
var title = $(this).val();
if (title.length === 0) {
title = ' ';
}
currentSettings.title = $('input[name="chartTitle"]').val();
drawChart();
})
Expand Down
1 change: 0 additions & 1 deletion js/tbl_zoom_plot_jqplot.js
Expand Up @@ -635,7 +635,6 @@ AJAX.registerOnload('tbl_zoom_plot_jqplot.js', function () {
}
field_id++;
}
selectedRow = {};
selectedRow = data.row_info;
});

Expand Down

0 comments on commit c721815

Please sign in to comment.