phpcs fixes

This commit is contained in:
Dennis Eichhorn 2020-12-05 21:39:55 +01:00
parent 35f3d3ca51
commit f5a4aaa850
6 changed files with 123 additions and 125 deletions

View File

@ -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 ()

View File

@ -324,25 +324,23 @@
let div = this.chartSelect.append("div").attr("class", "charttooltip").style("opacity", 0);
div.html(self.axis.x.label.text + ': ' + 100 + "<br/>" + 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 + "<br/>" + 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 + "<br/>" + 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);
});
}
};

View File

@ -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);
};

View File

@ -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('&', '?');

View File

@ -136,6 +136,7 @@
event.preventDefault();
event.stopImmediatePropagation();
event.cancelBubble = true;
};
/**
* Ready invoke

View File

@ -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]);