mirror of
https://github.com/Karaka-Management/jsOMS.git
synced 2026-01-11 17:58:41 +00:00
phpcs fixes
This commit is contained in:
parent
35f3d3ca51
commit
f5a4aaa850
|
|
@ -85,65 +85,65 @@
|
||||||
let year = d.split('-')[0],
|
let year = d.split('-')[0],
|
||||||
length = self.chart.dataset.length;
|
length = self.chart.dataset.length;
|
||||||
|
|
||||||
for (let i = 0; i < length; ++i) {
|
for (let i = 0; i < length; ++i) {
|
||||||
if (self.chart.dataset[i].name != year) {
|
if (self.chart.dataset[i].name != year) {
|
||||||
continue;
|
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
.attr("class", function(d) {
|
||||||
let year = d.split('-')[0],
|
let year = d.split('-')[0],
|
||||||
length = self.chart.dataset.length;
|
length = self.chart.dataset.length;
|
||||||
|
|
||||||
for (let i = 0; i < length; ++i) {
|
for (let i = 0; i < length; ++i) {
|
||||||
if (self.chart.dataset[i].name != year) {
|
if (self.chart.dataset[i].name != year) {
|
||||||
continue;
|
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";
|
|
||||||
}
|
}
|
||||||
})
|
|
||||||
.select("title")
|
|
||||||
.text(function(d) {
|
|
||||||
let year = d.split('-')[0],
|
|
||||||
length = self.chart.dataset.length;
|
|
||||||
|
|
||||||
for (let i = 0; i < length; ++i) {
|
let dataLength = self.chart.dataset[i].points.length;
|
||||||
if (self.chart.dataset[i].name != year) {
|
|
||||||
continue;
|
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 ()
|
jsOMS.Chart.CalendarChart.prototype.redraw = function ()
|
||||||
|
|
|
||||||
|
|
@ -324,25 +324,23 @@
|
||||||
let div = this.chartSelect.append("div").attr("class", "charttooltip").style("opacity", 0);
|
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);
|
div.html(self.axis.x.label.text + ': ' + 100 + "<br/>" + self.axis.y.label.text + ': ' + 100);
|
||||||
|
|
||||||
temp.on("mouseover", function (d)
|
temp.on("mouseover", function (d) {
|
||||||
{
|
let dim = div.node().getBoundingClientRect();
|
||||||
let dim = div.node().getBoundingClientRect();
|
let pos = this.getBoundingClientRect();
|
||||||
let pos = this.getBoundingClientRect();
|
|
||||||
|
|
||||||
div.transition()
|
div.transition()
|
||||||
.duration(200)
|
.duration(200)
|
||||||
.style("opacity", .9);
|
.style("opacity", .9);
|
||||||
|
|
||||||
div.html(self.axis.x.label.text + ': ' + d.x + "<br/>" + self.axis.y.label.text + ': ' + d.y)
|
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("left", (x(d.x) + dim.width / 2) + "px")
|
||||||
.style("top", (y(d.y) + dim.height) + "px");
|
.style("top", (y(d.y) + dim.height) + "px");
|
||||||
})
|
})
|
||||||
.on("mouseout", function (d)
|
.on("mouseout", function (d) {
|
||||||
{
|
div.transition()
|
||||||
div.transition()
|
.duration(500)
|
||||||
.duration(500)
|
.style("opacity", 0);
|
||||||
.style("opacity", 0);
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,13 +11,13 @@ export function timerAction (action, callback, data)
|
||||||
{
|
{
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
if (timerActionDelay[action.id]) {
|
if (timerActionDelay[action.id]) {
|
||||||
clearTimeout(timerActionDelay[action.id]);
|
clearTimeout(timerActionDelay[action.id]);
|
||||||
delete timerActionDelay[action.id]
|
delete timerActionDelay[action.id]
|
||||||
}
|
}
|
||||||
|
|
||||||
timerActionDelay[action.id] = setTimeout(function() {
|
timerActionDelay[action.id] = setTimeout(function() {
|
||||||
delete timerActionDelay[action.id];
|
delete timerActionDelay[action.id];
|
||||||
callback(data);
|
callback(data);
|
||||||
}, action.delay);
|
}, action.delay);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -187,21 +187,39 @@ export class UriFactory
|
||||||
static build (uri, toMatch)
|
static build (uri, toMatch)
|
||||||
{
|
{
|
||||||
const current = HttpUri.parseUrl(window.location.href);
|
const current = HttpUri.parseUrl(window.location.href);
|
||||||
let parsed = uri.replace(new RegExp('\{[\/#\?%@\.\$\!][a-zA-Z0-9\-\#\.]*\}', 'g'), function (match)
|
let parsed = uri.replace(new RegExp('\{[\/#\?%@\.\$\!][a-zA-Z0-9\-\#\.]*\}', 'g'), function (match) {
|
||||||
{
|
match = match.substr(1, match.length - 2);
|
||||||
match = match.substr(1, match.length - 2);
|
|
||||||
|
|
||||||
if (typeof toMatch !== 'undefined' && toMatch.hasOwnProperty(match)) {
|
if (typeof toMatch !== 'undefined' && toMatch.hasOwnProperty(match)) {
|
||||||
return toMatch[match];
|
return toMatch[match];
|
||||||
} else if (typeof UriFactory.uri[match] !== 'undefined') {
|
} else if (typeof UriFactory.uri[match] !== 'undefined') {
|
||||||
return UriFactory.uri[match];
|
return UriFactory.uri[match];
|
||||||
} else if (match.indexOf('!') === 0) {
|
} else if (match.indexOf('!') === 0) {
|
||||||
const e = document.querySelector(match.substr(1));
|
const e = document.querySelector(match.substr(1));
|
||||||
|
|
||||||
if (!e) {
|
if (!e) {
|
||||||
return '';
|
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') {
|
if (e.tagName.toLowerCase() !== 'form') {
|
||||||
return e.value;
|
return e.value;
|
||||||
}
|
}
|
||||||
|
|
@ -214,44 +232,25 @@ export class UriFactory
|
||||||
}
|
}
|
||||||
|
|
||||||
return value;
|
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) {
|
if (parsed.indexOf('?') === -1) {
|
||||||
parsed = parsed.replace('&', '?');
|
parsed = parsed.replace('&', '?');
|
||||||
|
|
|
||||||
|
|
@ -136,6 +136,7 @@
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopImmediatePropagation();
|
event.stopImmediatePropagation();
|
||||||
event.cancelBubble = true;
|
event.cancelBubble = true;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ready invoke
|
* Ready invoke
|
||||||
|
|
|
||||||
|
|
@ -586,7 +586,7 @@ export class FormView
|
||||||
const elements = this.getFormElements(),
|
const elements = this.getFormElements(),
|
||||||
length = elements.length;
|
length = elements.length;
|
||||||
|
|
||||||
for (let i = 0; i < length; ++i) {
|
for (let i = 0; i < length; ++i) {
|
||||||
switch (elements[i].tagName.toLowerCase()) {
|
switch (elements[i].tagName.toLowerCase()) {
|
||||||
case 'input':
|
case 'input':
|
||||||
Input.bindElement(elements[i]);
|
Input.bindElement(elements[i]);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user