diff --git a/Chart/CalendarChart.js b/Chart/CalendarChart.js index fbd627f..d00ddcc 100644 --- a/Chart/CalendarChart.js +++ b/Chart/CalendarChart.js @@ -85,65 +85,65 @@ let year = d.split('-')[0], length = self.chart.dataset.length; - for (let i = 0; i < length; ++i) { - if (self.chart.dataset[i].name != year) { - continue; - } - - let dataLength = self.chart.dataset[i].points.length; - - for (let j = 0; j < dataLength; ++j) { - if (self.chart.dataset[i].points[j].x === d) { - return true; - } - } - - return false; + for (let i = 0; i < length; ++i) { + if (self.chart.dataset[i].name != year) { + continue; } - return false; + let dataLength = self.chart.dataset[i].points.length; + + for (let j = 0; j < dataLength; ++j) { + if (self.chart.dataset[i].points[j].x === d) { + return true; + } + } + + return false; + } + + return false; }) - .attr("class", function(d) { - let year = d.split('-')[0], - length = self.chart.dataset.length; + .attr("class", function(d) { + let year = d.split('-')[0], + length = self.chart.dataset.length; - for (let i = 0; i < length; ++i) { - if (self.chart.dataset[i].name != year) { - continue; - } - - let dataLength = self.chart.dataset[i].points.length; - - for (let j = 0; j < dataLength; ++j) { - if (self.chart.dataset[i].points[j].x === d) { - return "day " + self.chart.color(self.chart.dataset[i].points[j].y); - } - } - - throw "Should not happen"; + for (let i = 0; i < length; ++i) { + if (self.chart.dataset[i].name != year) { + continue; } - }) - .select("title") - .text(function(d) { - let year = d.split('-')[0], - length = self.chart.dataset.length; - for (let i = 0; i < length; ++i) { - if (self.chart.dataset[i].name != year) { - continue; + let dataLength = self.chart.dataset[i].points.length; + + for (let j = 0; j < dataLength; ++j) { + if (self.chart.dataset[i].points[j].x === d) { + return "day " + self.chart.color(self.chart.dataset[i].points[j].y); } - - let dataLength = self.chart.dataset[i].points.length; - - for (let j = 0; j < dataLength; ++j) { - if (self.chart.dataset[i].points[j].x === d) { - return d + ": " + self.chart.dataset[i].points[j].y; - } - } - - throw "Should not happen"; } - }); + + throw "Should not happen"; + } + }) + .select("title") + .text(function(d) { + let year = d.split('-')[0], + length = self.chart.dataset.length; + + for (let i = 0; i < length; ++i) { + if (self.chart.dataset[i].name != year) { + continue; + } + + let dataLength = self.chart.dataset[i].points.length; + + for (let j = 0; j < dataLength; ++j) { + if (self.chart.dataset[i].points[j].x === d) { + return d + ": " + self.chart.dataset[i].points[j].y; + } + } + + throw "Should not happen"; + } + }); }; jsOMS.Chart.CalendarChart.prototype.redraw = function () diff --git a/Chart/ChartAbstract.js b/Chart/ChartAbstract.js index 8fff76f..3ddd43b 100644 --- a/Chart/ChartAbstract.js +++ b/Chart/ChartAbstract.js @@ -324,25 +324,23 @@ let div = this.chartSelect.append("div").attr("class", "charttooltip").style("opacity", 0); div.html(self.axis.x.label.text + ': ' + 100 + "
" + self.axis.y.label.text + ': ' + 100); - temp.on("mouseover", function (d) - { - let dim = div.node().getBoundingClientRect(); - let pos = this.getBoundingClientRect(); + temp.on("mouseover", function (d) { + let dim = div.node().getBoundingClientRect(); + let pos = this.getBoundingClientRect(); - div.transition() - .duration(200) - .style("opacity", .9); + div.transition() + .duration(200) + .style("opacity", .9); - div.html(self.axis.x.label.text + ': ' + d.x + "
" + self.axis.y.label.text + ': ' + d.y) - .style("left", (x(d.x) + dim.width / 2) + "px") - .style("top", (y(d.y) + dim.height) + "px"); - }) - .on("mouseout", function (d) - { - div.transition() - .duration(500) - .style("opacity", 0); - }); + div.html(self.axis.x.label.text + ': ' + d.x + "
" + self.axis.y.label.text + ': ' + d.y) + .style("left", (x(d.x) + dim.width / 2) + "px") + .style("top", (y(d.y) + dim.height) + "px"); + }) + .on("mouseout", function (d) { + div.transition() + .duration(500) + .style("opacity", 0); + }); } }; diff --git a/Model/Action/Utils/Timer.js b/Model/Action/Utils/Timer.js index d09f5bc..d870247 100644 --- a/Model/Action/Utils/Timer.js +++ b/Model/Action/Utils/Timer.js @@ -11,13 +11,13 @@ export function timerAction (action, callback, data) { "use strict"; - if (timerActionDelay[action.id]) { - clearTimeout(timerActionDelay[action.id]); - delete timerActionDelay[action.id] - } + if (timerActionDelay[action.id]) { + clearTimeout(timerActionDelay[action.id]); + delete timerActionDelay[action.id] + } - timerActionDelay[action.id] = setTimeout(function() { - delete timerActionDelay[action.id]; - callback(data); + timerActionDelay[action.id] = setTimeout(function() { + delete timerActionDelay[action.id]; + callback(data); }, action.delay); }; diff --git a/Uri/UriFactory.js b/Uri/UriFactory.js index 695f92c..c6f67f4 100644 --- a/Uri/UriFactory.js +++ b/Uri/UriFactory.js @@ -187,21 +187,39 @@ export class UriFactory static build (uri, toMatch) { const current = HttpUri.parseUrl(window.location.href); - let parsed = uri.replace(new RegExp('\{[\/#\?%@\.\$\!][a-zA-Z0-9\-\#\.]*\}', 'g'), function (match) - { - match = match.substr(1, match.length - 2); + let parsed = uri.replace(new RegExp('\{[\/#\?%@\.\$\!][a-zA-Z0-9\-\#\.]*\}', 'g'), function (match) { + match = match.substr(1, match.length - 2); - if (typeof toMatch !== 'undefined' && toMatch.hasOwnProperty(match)) { - return toMatch[match]; - } else if (typeof UriFactory.uri[match] !== 'undefined') { - return UriFactory.uri[match]; - } else if (match.indexOf('!') === 0) { - const e = document.querySelector(match.substr(1)); + if (typeof toMatch !== 'undefined' && toMatch.hasOwnProperty(match)) { + return toMatch[match]; + } else if (typeof UriFactory.uri[match] !== 'undefined') { + return UriFactory.uri[match]; + } else if (match.indexOf('!') === 0) { + const e = document.querySelector(match.substr(1)); - if (!e) { - return ''; - } + if (!e) { + return ''; + } + if (e.tagName.toLowerCase() !== 'form') { + return e.value; + } + + let value = ''; + const form = (new FormView(e.id)).getData(); + + for (let pair of form.entries()) { + value += '&' + pair[0] + '=' + pair[1]; + } + + return value; + } else if (match.indexOf('?') === 0) { + return HttpUri.getUriQueryParameter(current.query, match.substr(1)); + } else if (match === '#') { + return current.fragment; + } else if (match.indexOf('#') === 0) { + const e = document.getElementById(match.substr(1)); + if (e) { if (e.tagName.toLowerCase() !== 'form') { return e.value; } @@ -214,44 +232,25 @@ export class UriFactory } return value; - } else if (match.indexOf('?') === 0) { - return HttpUri.getUriQueryParameter(current.query, match.substr(1)); - } else if (match === '#') { - return current.fragment; - } else if (match.indexOf('#') === 0) { - const e = document.getElementById(match.substr(1)); - if (e) { - if (e.tagName.toLowerCase() !== 'form') { - return e.value; - } - - let value = ''; - const form = (new FormView(e.id)).getData(); - - for (let pair of form.entries()) { - value += '&' + pair[0] + '=' + pair[1]; - } - - return value; - } - - return ''; - } else if (match.indexOf('?') === 0) { - return current.query(); - } else if (match.indexOf('/') === 0) { - return current.path; - } else if (match.indexOf(':user') === 0) { - return current.user; - } else if (match.indexOf(':pass') === 0) { - return current.pass; - } else if (match.indexOf('/') === 0) { - return 'ERROR PATH'; - } else if (match === '%') { - return window.location.href; - } else { - return match; } - }); + + return ''; + } else if (match.indexOf('?') === 0) { + return current.query(); + } else if (match.indexOf('/') === 0) { + return current.path; + } else if (match.indexOf(':user') === 0) { + return current.user; + } else if (match.indexOf(':pass') === 0) { + return current.pass; + } else if (match.indexOf('/') === 0) { + return 'ERROR PATH'; + } else if (match === '%') { + return window.location.href; + } else { + return match; + } + }); if (parsed.indexOf('?') === -1) { parsed = parsed.replace('&', '?'); diff --git a/Utils/UiUtils.js b/Utils/UiUtils.js index 15b798d..a8c1290 100644 --- a/Utils/UiUtils.js +++ b/Utils/UiUtils.js @@ -136,6 +136,7 @@ event.preventDefault(); event.stopImmediatePropagation(); event.cancelBubble = true; + }; /** * Ready invoke diff --git a/Views/FormView.js b/Views/FormView.js index 40dd453..90a4eae 100644 --- a/Views/FormView.js +++ b/Views/FormView.js @@ -586,7 +586,7 @@ export class FormView const elements = this.getFormElements(), length = elements.length; - for (let i = 0; i < length; ++i) { + for (let i = 0; i < length; ++i) { switch (elements[i].tagName.toLowerCase()) { case 'input': Input.bindElement(elements[i]);