From 2fe467d7e8cf5df9dc24f6fcc9ccb974f634e4d4 Mon Sep 17 00:00:00 2001
From: Dennis Eichhorn
Date: Tue, 22 Dec 2015 23:15:06 +0100
Subject: [PATCH] Inspection fixes
---
Asset/AssetManager.js | 2 +-
Chart/Chart.js | 26 +++++++++++----------
Chart/LineChart.js | 6 ++---
Config/Options.js | 10 ++++----
DataStorage/LocalStorage.js | 2 +-
Message/Request/Request.js | 6 ++---
UI/FormManager.js | 10 ++++----
Utils/Markdown/Markdown.js | 46 +++++++++++++++++++++----------------
Utils/oLib.js | 6 ++---
9 files changed, 61 insertions(+), 53 deletions(-)
diff --git a/Asset/AssetManager.js b/Asset/AssetManager.js
index 3027740..06bda89 100644
--- a/Asset/AssetManager.js
+++ b/Asset/AssetManager.js
@@ -116,7 +116,7 @@
*
* @param {string} key Key of the asset (hash)
*
- * @return {bool}
+ * @return {boolean}
*
* @method
*
diff --git a/Chart/Chart.js b/Chart/Chart.js
index c108136..3b1764c 100644
--- a/Chart/Chart.js
+++ b/Chart/Chart.js
@@ -70,7 +70,7 @@
}
return x;
- }
+ };
jsOMS.Chart.prototype.calculateVerticalPosition = function (position)
{
@@ -90,17 +90,17 @@
}
return y;
- }
+ };
jsOMS.Chart.prototype.setColor = function (color)
{
this.color = color;
- }
+ };
jsOMS.Chart.prototype.getColor = function ()
{
return this.color;
- }
+ };
jsOMS.Chart.prototype.setAxis = function (id, axis)
{
@@ -194,7 +194,7 @@
this.dataset = data;
this.findAxisDomain();
- }
+ };
jsOMS.Chart.prototype.findAxisDomain = function ()
{
@@ -215,12 +215,12 @@
});
})
}
- }
+ };
jsOMS.Chart.prototype.getData = function ()
{
return this.dataset;
- }
+ };
jsOMS.Chart.prototype.drawLegend = function (svg, dataPointEnter, dataPoint)
{
@@ -253,8 +253,10 @@
});
dataPoint.exit().remove();
+ var tlength = this.chartSelect.select('.dataPoint-name').node().getComputedTextLength();
+
// Adding margin for legend
- if (this.margin.right < (tlength = this.chartSelect.select('.dataPoint-name').node().getComputedTextLength())) {
+ if (this.margin.right < tlength) {
this.margin.right = tlength + 30;
this.shouldRedraw = true;
}
@@ -262,7 +264,7 @@
this.margin.right = 10;
this.shouldRedraw = true;
}
- }
+ };
jsOMS.Chart.prototype.drawMarker = function (svg, x, y, dataPointEnter, dataPoint)
{
@@ -308,7 +310,7 @@
.style("opacity", 0);
});
}
- }
+ };
jsOMS.Chart.prototype.drawText = function (svg)
{
@@ -372,7 +374,7 @@
this.shouldRedraw = true;
}
}
- }
+ };
jsOMS.Chart.prototype.drawAxis = function (svg, xAxis1, yAxis1)
{
@@ -448,7 +450,7 @@
if (this.axis.y2 !== undefined) {
}
- }
+ };
jsOMS.Chart.prototype.drawGrid = function (svg, xGrid, yGrid)
{
diff --git a/Chart/LineChart.js b/Chart/LineChart.js
index ef65bd3..e3b23b8 100644
--- a/Chart/LineChart.js
+++ b/Chart/LineChart.js
@@ -55,7 +55,7 @@
jsOMS.Chart.LineChart.prototype.getChart = function ()
{
return this.chart;
- }
+ };
jsOMS.Chart.LineChart.prototype.draw = function ()
{
@@ -193,7 +193,7 @@
this.chart.shouldRedraw = false;
this.chart.chartSelect.select("*").remove();
this.draw();
- }
+ };
jsOMS.Chart.LineChart.prototype.drawData = function (svg, line, dataPointEnter, dataPoint)
{
@@ -215,7 +215,7 @@
});
return [dataPointEnter, dataPoint];
- }
+ };
jsOMS.Chart.LineChart.prototype.drawZoomPanel = function (svg, zoom)
{
diff --git a/Config/Options.js b/Config/Options.js
index 3e404b8..277b149 100644
--- a/Config/Options.js
+++ b/Config/Options.js
@@ -25,10 +25,10 @@
* Set option.
*
* @param {int|string} key Option key
- * @param {boo|int|float|string|Array} value Option value
- * @param {bool} [overwrite=true] Overwrite value
+ * @param {boolean|int|float|string|Array} value Option value
+ * @param {boolean} [overwrite=true] Overwrite value
*
- * @param {bool}
+ * @return {boolean}
*
* @method
*
@@ -53,7 +53,7 @@
*
* @param {int|string} key Option key
*
- * @return {boo|int|float|string|Array}
+ * @return {boolean|int|float|string|Array}
*
* @method
*
@@ -74,7 +74,7 @@
*
* @param {int|string} key Option key
*
- * @return {boo}
+ * @return {boolean}
*
* @method
*
diff --git a/DataStorage/LocalStorage.js b/DataStorage/LocalStorage.js
index 5a4e7c2..69b70a7 100644
--- a/DataStorage/LocalStorage.js
+++ b/DataStorage/LocalStorage.js
@@ -23,7 +23,7 @@
/**
* Is local storage available?
*
- * @return {boo}
+ * @return {boolean}
*
* @method
*
diff --git a/Message/Request/Request.js b/Message/Request/Request.js
index 336dcd1..3cb2acd 100644
--- a/Message/Request/Request.js
+++ b/Message/Request/Request.js
@@ -67,7 +67,7 @@
*
* EnumResponseType
*
- * @param {string} method Method type
+ * @param {string} type Method type
*
* @method
*
@@ -160,7 +160,7 @@
/**
* Set success callback.
*
- * @param {requestCallback} success Success callback
+ * @param {requestCallback} callback Success callback
*
* @method
*
@@ -207,7 +207,7 @@
*
* EnumRequestType
*
- * @param {string} method Method type
+ * @param {string} type Method type
*
* @method
*
diff --git a/UI/FormManager.js b/UI/FormManager.js
index c1ff85d..18c0c11 100644
--- a/UI/FormManager.js
+++ b/UI/FormManager.js
@@ -50,7 +50,7 @@
* @param {string} selector Form id
* @param {requestCallback} callback Callback to execute before submit
*
- * @return {bool}
+ * @return {boolean}
*
* @method
*
@@ -108,7 +108,7 @@
for (var i = 0; i < forms.length; i++) {
if (this.ignore.indexOf(forms[i].id) === -1) {
- this.forms.push(forms[i])
+ this.forms.push(forms[i]);
this.bindElement(forms[i]);
}
}
@@ -120,7 +120,7 @@
*
* @param {Object} e Form element
*
- * @return {bool}
+ * @return {boolean}
*
* @method
*
@@ -416,10 +416,10 @@
jsOMS.FormManager.prototype.getElements = function ()
{
return this.forms;
- }
+ };
jsOMS.FormManager.prototype.count = function ()
{
return this.forms.length;
- }
+ };
}(window.jsOMS = window.jsOMS || {}));
diff --git a/Utils/Markdown/Markdown.js b/Utils/Markdown/Markdown.js
index ea3b7b0..bc89fd0 100644
--- a/Utils/Markdown/Markdown.js
+++ b/Utils/Markdown/Markdown.js
@@ -1,30 +1,36 @@
-(function (jsOMS, undefined) {
+(function (jsOMS, undefined)
+{
// TODO: create comments
- jsOMS.Markdown = function (source, destination) {
+ jsOMS.Markdown = function (source, destination)
+ {
this.source = document.querySelector(source);
this.dest = document.querySelector(destination);
var self = this;
var timer = 0;
- this.source.addEventListener('input', function () {
+ this.source.addEventListener('input', function ()
+ {
maybeUpdateFromInput(this.value);
}, false);
// todo: maybe export to own olib function?!
- function maybeUpdateFromInput(val) {
+ function maybeUpdateFromInput(val)
+ {
if (timer) {
clearTimeout(timer);
}
- timer = setTimeout(function () {
+ timer = setTimeout(function ()
+ {
self.dest.value = self.parse(self.source.value);
timer = 0;
}, 500);
}
};
- jsOMS.Markdown.prototype.parse = function (plain) {
+ jsOMS.Markdown.prototype.parse = function (plain)
+ {
plain = plain.replace('\r\n', '\n');
plain = plain.replace('\r', '\n');
plain = plain.replace('\t', ' ');
@@ -37,7 +43,8 @@
};
- jsOMS.Markdown.prototype.lines = function (lines) {
+ jsOMS.Markdown.prototype.lines = function (lines)
+ {
var escaped = false;
var line = '';
@@ -48,7 +55,7 @@
line += '
';
} else if (i === 0) {
line = '
' + line;
- } else if(i === liens.length - 1) {
+ } else if (i === liens.length - 1) {
line += '
';
}
@@ -60,20 +67,19 @@
var text = indent > 0 ? line.substr(indent) : line;
- for(var j = 0; j < text.length; j++) {
- if(text[j] === '*' && !escaped) {
+ for (var j = 0; j < text.length; j++) {
+ if (text[j] === '*' && !escaped) {
- } else if(text[j] === '_' && !escaped) {}
- else if(text[j] === '-' && !escaped) {}
- else if(text[j] === '#' && !escaped) {}
- else if(['1', '2', '3' , '4', '5', '6', '7', '8', '9', '0'].indexOf(text[j]) !== -1 && !escaped) {}
- else if(text[j] === '`' && !escaped) {}
- else if(text[j] === '"' && !escaped) {}
- else if(text[j] === '[' && !escaped) {}
- else if(text[j] === '\\' && !escaped) {
+ } else if (text[j] === '_' && !escaped) {
+ } else if (text[j] === '-' && !escaped) {
+ } else if (text[j] === '#' && !escaped) {
+ } else if (['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'].indexOf(text[j]) !== -1 && !escaped) {
+ } else if (text[j] === '`' && !escaped) {
+ } else if (text[j] === '"' && !escaped) {
+ } else if (text[j] === '[' && !escaped) {
+ } else if (text[j] === '\\' && !escaped) {
escaped = true;
- }
- else {
+ } else {
escaped = false;
}
}
diff --git a/Utils/oLib.js b/Utils/oLib.js
index 957e45c..b7e0403 100644
--- a/Utils/oLib.js
+++ b/Utils/oLib.js
@@ -16,7 +16,7 @@
* @param {Object} ele DOM Element
* @param {string} cls Class to find
*
- * @return {bool}
+ * @return {boolean}
*
* @function
*
@@ -173,7 +173,7 @@
*
* @param ele DOM Node
*
- * @return {bool}
+ * @return {boolean}
*
* @function
*
@@ -195,7 +195,7 @@
*
* @param o DOM Element
*
- * @return {bool}
+ * @return {boolean}
*
* @function
*