mirror of
https://github.com/Karaka-Management/jsOMS.git
synced 2026-01-11 17:58:41 +00:00
Fix codestyle with phpcs
This commit is contained in:
parent
ea94fafcdd
commit
6f9367aa64
|
|
@ -72,7 +72,7 @@
|
|||
if (typeof fileref !== 'undefined') {
|
||||
const head = document.getElementsByTagName('head');
|
||||
|
||||
if(head) {
|
||||
if (head) {
|
||||
head[0].appendChild(fileref);
|
||||
}
|
||||
}
|
||||
|
|
@ -87,7 +87,7 @@
|
|||
if (typeof fileref !== 'undefined') {
|
||||
const head = document.getElementsByTagName('head');
|
||||
|
||||
if(head) {
|
||||
if (head) {
|
||||
head[0].appendChild(fileref);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
if(typeof callback !== 'undefined' && callback !== null) {
|
||||
if (typeof callback !== 'undefined' && callback !== null) {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@
|
|||
.attr("width", 0)
|
||||
.attr("height", y.rangeBand());
|
||||
|
||||
if(this.chart.subtype === 'stacked') {
|
||||
if (this.chart.subtype === 'stacked') {
|
||||
rect.transition()
|
||||
.delay(function (d, i)
|
||||
{
|
||||
|
|
@ -190,7 +190,7 @@
|
|||
{
|
||||
return y(d.x) + y.rangeBand() / self.chart.dataset.length * j;
|
||||
})
|
||||
.attr("height", y.rangeBand() /self.chart.dataset.length)
|
||||
.attr("height", y.rangeBand() / self.chart.dataset.length)
|
||||
.transition()
|
||||
.attr("x", 0)
|
||||
.attr("width", function (d)
|
||||
|
|
|
|||
|
|
@ -33,9 +33,10 @@
|
|||
svg, self = this;
|
||||
|
||||
this.chart.calculateDimension();
|
||||
this.chart.cellSize = Math.min(this.chart.dimension.width / (12*5), this.chart.dimension.height / (8));
|
||||
this.chart.cellSize = Math.min(this.chart.dimension.width / (12 * 5), this.chart.dimension.height / (8));
|
||||
|
||||
document.getElementById(this.chart.chartId).style.height = (this.chart.dimension.height * this.chart.dataset.length) + 'px';
|
||||
document.getElementById(this.chart.chartId)
|
||||
.style.height = (this.chart.dimension.height * this.chart.dataset.length) + 'px';
|
||||
|
||||
svg = this.chart.chartSelect.selectAll('svg').data(this.chart.dataset).enter().append("svg")
|
||||
.attr("width", this.chart.dimension.width)
|
||||
|
|
@ -85,15 +86,15 @@
|
|||
let year = d.split('-')[0],
|
||||
length = self.chart.dataset.length;
|
||||
|
||||
for(let i = 0; i < length; i++) {
|
||||
if(self.chart.dataset[i].name != year) {
|
||||
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) {
|
||||
for (let j = 0; j < dataLength; j++) {
|
||||
if (self.chart.dataset[i].points[j].x === d) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -107,15 +108,15 @@
|
|||
let year = d.split('-')[0],
|
||||
length = self.chart.dataset.length;
|
||||
|
||||
for(let i = 0; i < length; i++) {
|
||||
if(self.chart.dataset[i].name != year) {
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
@ -128,15 +129,15 @@
|
|||
let year = d.split('-')[0],
|
||||
length = self.chart.dataset.length;
|
||||
|
||||
for(let i = 0; i < length; i++) {
|
||||
if(self.chart.dataset[i].name != year) {
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,9 +72,9 @@
|
|||
|
||||
jsOMS.Chart.CandlestickChart.prototype.draw = function ()
|
||||
{
|
||||
let bar, svg, x, xAxis1, xAxis2, y, yAxis1, yAxis2, xGrid, yGrid, zoom, self = this;
|
||||
|
||||
let mm = 50;
|
||||
let bar, svg, x, xAxis1, xAxis2, y, yAxis1, yAxis2, xGrid, yGrid, zoom,
|
||||
self = this,
|
||||
mm = 50;
|
||||
|
||||
this.chart.calculateDimension();
|
||||
|
||||
|
|
@ -97,13 +97,13 @@
|
|||
|
||||
this.chart.drawGrid(svg, xGrid, yGrid);
|
||||
|
||||
if(this.chart.subtype === 'candlestick') {
|
||||
if (this.chart.subtype === 'candlestick') {
|
||||
svg.selectAll("rect")
|
||||
.data(this.chart.dataset[0].points)
|
||||
.enter().append("svg:rect")
|
||||
.attr("x", function(d) { return x(d.x)-0.5*mm/2; })
|
||||
.attr("y", function(d) {return y(Math.max(d.open, d.close));})
|
||||
.attr("height", function(d) { return Math.max(1, y(Math.min(d.open, d.close))-y(Math.max(d.open, d.close)));})
|
||||
.attr("x", function(d) { return x(d.x) - 0.5 * mm / 2; })
|
||||
.attr("y", function(d) { return y(Math.max(d.open, d.close)); })
|
||||
.attr("height", function(d) { return Math.max(1, y(Math.min(d.open, d.close)) - y(Math.max(d.open, d.close)));})
|
||||
.attr("width", function(d) { return 0.5 * mm; })
|
||||
.attr("fill",function(d) { return d.open > d.close ? "red" : "green" ;});
|
||||
} else {
|
||||
|
|
@ -112,17 +112,17 @@
|
|||
.enter();
|
||||
|
||||
datapoint.append("svg:rect")
|
||||
.attr("x", function(d) { return x(d.x)-0.25*mm/2; })
|
||||
.attr("x", function(d) { return x(d.x) - 0.25 * mm / 2; })
|
||||
.attr("y", function(d) {return y(d.open);})
|
||||
.attr("height", function(d) { return 1;})
|
||||
.attr("width", function(d) { return 0.25 * mm/2; })
|
||||
.attr("width", function(d) { return 0.25 * mm / 2; })
|
||||
.attr("fill",function(d) { return d.open > d.close ? "red" : "green" ;});
|
||||
|
||||
datapoint.append("svg:rect")
|
||||
.attr("x", function(d) { return x(d.x); })
|
||||
.attr("y", function(d) {return y(d.close);})
|
||||
.attr("height", function(d) { return 1;})
|
||||
.attr("width", function(d) { return 0.25 * mm/2; })
|
||||
.attr("width", function(d) { return 0.25 * mm / 2; })
|
||||
.attr("fill",function(d) { return d.open > d.close ? "red" : "green" ;});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,21 +17,25 @@
|
|||
anchor: "middle",
|
||||
position: "center"
|
||||
};
|
||||
|
||||
this.subtitle = {
|
||||
visible: true,
|
||||
text: "",
|
||||
anchor: "middle",
|
||||
position: "center"
|
||||
};
|
||||
|
||||
this.footer = {
|
||||
visible: true,
|
||||
text: "",
|
||||
anchor: "end",
|
||||
position: "right"
|
||||
};
|
||||
|
||||
this.legend = {
|
||||
visible: true
|
||||
};
|
||||
|
||||
this.color = d3.scale.category10();
|
||||
this.dataset = [];
|
||||
this.dataSettings = {
|
||||
|
|
@ -221,7 +225,7 @@
|
|||
jsOMS.Chart.ChartAbstract.prototype.findAxisDomain = function ()
|
||||
{
|
||||
for (let id in this.axis) {
|
||||
if(!this.axis.hasOwnProperty(id)) {
|
||||
if (!this.axis.hasOwnProperty(id)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -393,7 +397,7 @@
|
|||
// if no x axis available an element less will be drawn and the footer
|
||||
// will be out of bounds.
|
||||
// todo: fix this hacky solution!!!
|
||||
if(typeof this.axis.x === 'undefined') {
|
||||
if (typeof this.axis.x === 'undefined') {
|
||||
spacer = -this.margin.top;
|
||||
}
|
||||
|
||||
|
|
@ -510,7 +514,7 @@
|
|||
|
||||
jsOMS.Chart.ChartAbstract.prototype.createXScale = function (type)
|
||||
{
|
||||
if(type === 'ordinal') {
|
||||
if (type === 'ordinal') {
|
||||
return d3.scale.ordinal().rangeRoundBands([
|
||||
0,
|
||||
this.dimension.width
|
||||
|
|
@ -529,7 +533,7 @@
|
|||
|
||||
jsOMS.Chart.ChartAbstract.prototype.createYScale = function (type)
|
||||
{
|
||||
if(type === 'ordinal') {
|
||||
if (type === 'ordinal') {
|
||||
return d3.scale.ordinal().rangeRoundBands([
|
||||
0,
|
||||
this.dimension.height
|
||||
|
|
|
|||
|
|
@ -116,6 +116,7 @@
|
|||
temp = this.drawData(svg, x, y, dataPointEnter, dataPoint);
|
||||
dataPointEnter = temp[0];
|
||||
dataPoint = temp[1];
|
||||
|
||||
this.chart.drawMarker(svg, x, y, dataPointEnter, dataPoint);
|
||||
this.chart.drawLegend(svg, dataPointEnter, dataPoint);
|
||||
this.chart.drawText(svg);
|
||||
|
|
@ -163,7 +164,7 @@
|
|||
.attr("width", x.rangeBand())
|
||||
.attr("height", 0);
|
||||
|
||||
if(this.chart.subtype === 'stacked') {
|
||||
if (this.chart.subtype === 'stacked') {
|
||||
rect.transition()
|
||||
.delay(function (d, i)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -221,7 +221,6 @@
|
|||
jsOMS.Chart.LineChart.prototype.drawData = function (svg, line, dataPointEnter, dataPoint)
|
||||
{
|
||||
const self = this;
|
||||
|
||||
dataPoint = svg.selectAll(".dataPoint").data(this.chart.dataset, function (c)
|
||||
{
|
||||
return c.id;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
// Setting default chart values
|
||||
this.chart.margin = {top: 5, right: 0, bottom: 0, left: 0};
|
||||
|
||||
/** global: d3 */
|
||||
this.chart.color = d3.scale.category10();
|
||||
this.chart.dataSettings.style.strokewidth = 1;
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@
|
|||
add = 0;
|
||||
|
||||
// todo: remove value since positive and negative can be checked by looking at the diff of y-y0
|
||||
for(let i = 0; i < length - 1; i++) {
|
||||
for (let i = 0; i < length - 1; i++) {
|
||||
dataset[0].points[i] = { name: data[i].name, y0: add, y: data[i].value + add };
|
||||
add += data[i].value;
|
||||
}
|
||||
|
|
@ -80,7 +80,9 @@
|
|||
|
||||
jsOMS.Chart.PyramidChart.prototype.draw = function ()
|
||||
{
|
||||
let bar, svg, x, xAxis1, xAxis2, y, yAxis1, yAxis2, xGrid, yGrid, zoom, self = this, box = this.chart.chartSelect.node().getBoundingClientRect();
|
||||
let bar, svg, x, xAxis1, xAxis2, y, yAxis1, yAxis2, xGrid, yGrid, zoom,
|
||||
self = this,
|
||||
box = this.chart.chartSelect.node().getBoundingClientRect();
|
||||
|
||||
this.chart.dimension = {
|
||||
width: box.width,
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
// Setting default chart values
|
||||
this.chart.margin = {top: 5, right: 0, bottom: 0, left: 0};
|
||||
|
||||
/** global: d3 */
|
||||
this.chart.color = d3.scale.category10();
|
||||
this.chart.axis = {
|
||||
|
|
@ -116,7 +117,6 @@
|
|||
jsOMS.Chart.ScatterplotChart.prototype.drawData = function (svg, x, y, dataPointEnter, dataPoint)
|
||||
{
|
||||
const self = this;
|
||||
|
||||
dataPoint = svg.selectAll(".dataPoint").data(this.chart.dataset, function (c)
|
||||
{
|
||||
return c.id;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
// Setting default chart values
|
||||
this.chart.margin = {top: 5, right: 0, bottom: 0, left: 0};
|
||||
|
||||
/** global: d3 */
|
||||
this.chart.color = d3.scale.category10();
|
||||
this.chart.axis = {
|
||||
|
|
@ -53,6 +54,7 @@
|
|||
visible: true
|
||||
}
|
||||
};
|
||||
|
||||
this.chart.subtype = 'vwaterfall';
|
||||
};
|
||||
|
||||
|
|
@ -68,7 +70,7 @@
|
|||
add = 0;
|
||||
|
||||
// todo: remove value since positive and negative can be checked by looking at the diff of y-y0
|
||||
for(let i = 0; i < length - 1; i++) {
|
||||
for (let i = 0; i < length - 1; i++) {
|
||||
dataset[0].points[i] = { name: data[i].name, y0: add, y: data[i].value + add };
|
||||
add += data[i].value;
|
||||
}
|
||||
|
|
@ -91,7 +93,7 @@
|
|||
xGrid = this.chart.createXGrid(x);
|
||||
yGrid = this.chart.createYGrid(y);
|
||||
|
||||
x.domain([0, d3.max(this.chart.dataset[0].points, function(d) { return d.y*1.05; })]);
|
||||
x.domain([0, d3.max(this.chart.dataset[0].points, function(d) { return d.y * 1.05; })]);
|
||||
y.domain(this.chart.dataset[0].points.map(function(d) { return d.name; }));
|
||||
|
||||
svg = this.chart.chartSelect.append("svg")
|
||||
|
|
@ -127,7 +129,6 @@
|
|||
jsOMS.Chart.VWaterfallChart.prototype.drawData = function (svg, x, y, dataPointEnter, dataPoint)
|
||||
{
|
||||
const self = this;
|
||||
|
||||
dataPoint = svg.selectAll(".dataPoint").data(this.chart.dataset[0].points, function (c)
|
||||
{
|
||||
return c.name;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
// Setting default chart values
|
||||
this.chart.margin = {top: 5, right: 0, bottom: 0, left: 0};
|
||||
|
||||
/** global: d3 */
|
||||
this.chart.color = d3.scale.category10();
|
||||
this.chart.axis = {
|
||||
|
|
@ -53,6 +54,7 @@
|
|||
visible: true
|
||||
}
|
||||
};
|
||||
|
||||
this.chart.subtype = 'waterfall';
|
||||
};
|
||||
|
||||
|
|
@ -68,7 +70,7 @@
|
|||
add = 0;
|
||||
|
||||
// todo: remove value since positive and negative can be checked by looking at the diff of y-y0
|
||||
for(let i = 0; i < length - 1; i++) {
|
||||
for (let i = 0; i < length - 1; i++) {
|
||||
dataset[0].points[i] = { name: data[i].name, y0: add, y: data[i].value + add };
|
||||
add += data[i].value;
|
||||
}
|
||||
|
|
@ -92,7 +94,7 @@
|
|||
yGrid = this.chart.createYGrid(y);
|
||||
|
||||
x.domain(this.chart.dataset[0].points.map(function(d) { return d.name; }));
|
||||
y.domain([0, d3.max(this.chart.dataset[0].points, function(d) { return d.y*1.05; })]);
|
||||
y.domain([0, d3.max(this.chart.dataset[0].points, function(d) { return d.y * 1.05; })]);
|
||||
|
||||
svg = this.chart.chartSelect.append("svg")
|
||||
.attr("width", this.chart.dimension.width)
|
||||
|
|
@ -127,7 +129,6 @@
|
|||
jsOMS.Chart.WaterfallChart.prototype.drawData = function (svg, x, y, dataPointEnter, dataPoint)
|
||||
{
|
||||
const self = this;
|
||||
|
||||
dataPoint = svg.selectAll(".dataPoint").data(this.chart.dataset[0].points, function (c)
|
||||
{
|
||||
return c.name;
|
||||
|
|
|
|||
|
|
@ -40,7 +40,13 @@
|
|||
{
|
||||
const exdate = new Date();
|
||||
exdate.setDate(exdate.getDate() + exdays);
|
||||
const cValue = encodeURI(value) + ((exdays === null) ? "" : "; expires=" + exdate.toUTCString()) + ";domain=" + domain + ";path=" + path;
|
||||
|
||||
const cValue = encodeURI(value)
|
||||
+ ((exdays === null) ? "" : "; expires="
|
||||
+ exdate.toUTCString()) + ";domain="
|
||||
+ domain + ";path="
|
||||
+ path;
|
||||
|
||||
document.cookie = cName + "=" + cValue;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@
|
|||
{
|
||||
id = typeof id !== 'undefined' ? id : 0;
|
||||
|
||||
if(!this.callbacks.hasOwnProperty(group)) {
|
||||
if (!this.callbacks.hasOwnProperty(group)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -125,7 +125,7 @@
|
|||
|
||||
if (this.callbacks[group].remove) {
|
||||
this.detach(group);
|
||||
} else if(this.callbacks[group].reset) {
|
||||
} else if (this.callbacks[group].reset) {
|
||||
this.reset(group);
|
||||
}
|
||||
}
|
||||
|
|
@ -166,7 +166,7 @@
|
|||
*/
|
||||
jsOMS.Event.EventManager.prototype.attach = function (group, callback, remove, reset)
|
||||
{
|
||||
if(this.callbacks.hasOwnProperty(group)) {
|
||||
if (this.callbacks.hasOwnProperty(group)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,18 +3,18 @@
|
|||
|
||||
jsOMS.mathEvaluate = function(equation)
|
||||
{
|
||||
const stack = [];
|
||||
const postfix = jsOMS.shuntingYard(equation);
|
||||
const length = postfix.length;
|
||||
const stack = [],
|
||||
postfix = jsOMS.shuntingYard(equation);
|
||||
length = postfix.length;
|
||||
|
||||
for(let i = 0; i < length; i++) {
|
||||
for (let i = 0; i < length; i++) {
|
||||
if (!isNaN(parseFloat(postfix[i])) && isFinite(postfix[i])) {
|
||||
stack.push(postfix[i]);
|
||||
} else {
|
||||
let a = jsOMS.parseValue(stack.pop());
|
||||
let b = jsOMS.parseValue(stack.pop());
|
||||
|
||||
if(postfix[i] === '+') {
|
||||
if (postfix[i] === '+') {
|
||||
stack.push(a + b);
|
||||
} else if (postfix[i] === '-') {
|
||||
stack.push(b - a);
|
||||
|
|
@ -52,30 +52,28 @@
|
|||
equation = equation.split(/([\+\-\*\/\^\(\)])/).filter(function (n) { return n !== '' });
|
||||
|
||||
let length = equation.length;
|
||||
for(let i = 0; i < length; i++) {
|
||||
for (let i = 0; i < length; i++) {
|
||||
let token = equation[i];
|
||||
|
||||
if (!isNaN(parseFloat(token)) && isFinite(token)) {
|
||||
output.push(token);
|
||||
} else if('^*/+-'.indexOf(token) !== -1) {
|
||||
} else if ('^*/+-'.indexOf(token) !== -1) {
|
||||
let o1 = token;
|
||||
let o2 = stack[stack.length - 1];
|
||||
|
||||
while ('^*/+-'.indexOf(o2) !== -1 &&
|
||||
(
|
||||
(operators[o1].order === -1 && operators[o1].precedence <= operators[o2].precedence)
|
||||
|| (operators[o1].order === 1 && operators[o1].precedence < operators[o2].precedence)
|
||||
)
|
||||
while ('^*/+-'.indexOf(o2) !== -1
|
||||
&& ((operators[o1].order === -1 && operators[o1].precedence <= operators[o2].precedence)
|
||||
|| (operators[o1].order === 1 && operators[o1].precedence < operators[o2].precedence))
|
||||
) {
|
||||
output.push(stack.pop());
|
||||
o2 = stack[stack.length - 1];
|
||||
}
|
||||
|
||||
stack.push(o1);
|
||||
} else if(token === '(') {
|
||||
} else if (token === '(') {
|
||||
stack.push(token);
|
||||
} else if (token === ')') {
|
||||
while(stack[stack.length - 1] !== '(') {
|
||||
while (stack[stack.length - 1] !== '(') {
|
||||
output.push(stack.pop());
|
||||
}
|
||||
|
||||
|
|
@ -83,7 +81,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
while(stack.length > 0) {
|
||||
while (stack.length > 0) {
|
||||
output.push(stack.pop());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
jsOMS.Message.Notification.NotificationManager.prototype.send = function(message, type)
|
||||
{
|
||||
if(jsOMS.Message.Notification.NotificationType.APP_NOTIFICATION === type) {
|
||||
if (jsOMS.Message.Notification.NotificationType.APP_NOTIFICATION === type) {
|
||||
this.appNotifier.send(message);
|
||||
} else {
|
||||
this.browserNotifier.send(message);
|
||||
|
|
|
|||
|
|
@ -33,10 +33,10 @@
|
|||
j = 0,
|
||||
this.compiledData = this.dataset;
|
||||
|
||||
for(let i = 0; i < cRows; i++) {
|
||||
for (let i = 0; i < cRows; i++) {
|
||||
cCols = this.compiledData[i].length();
|
||||
|
||||
for(j = 0; j < cCols; j++) {
|
||||
for (j = 0; j < cCols; j++) {
|
||||
this.compiledData[i][j] = Functions.evaluate(this.compiledData[i][j], compiledData);
|
||||
|
||||
this.drawCell(this.compiledData[i][j]);
|
||||
|
|
|
|||
|
|
@ -72,14 +72,14 @@
|
|||
for (let i = 0; i < listenerLength; i++) {
|
||||
let c = [e], hasSelector = false;
|
||||
|
||||
if(listeners[i].hasOwnProperty('selector')) {
|
||||
if (listeners[i].hasOwnProperty('selector')) {
|
||||
c = document.querySelectorAll(listeners[i].selector);
|
||||
hasSelector = true;
|
||||
}
|
||||
|
||||
let childLength = c.length;
|
||||
|
||||
for(let j = 0; j < childLength; j++) {
|
||||
for (let j = 0; j < childLength; j++) {
|
||||
this.bindListener(c[j], listeners[i]);
|
||||
}
|
||||
|
||||
|
|
@ -88,13 +88,13 @@
|
|||
// todo: careful this could cause bugs if there is another component relying on a listener for this dom element. Maybe create actionManager domlistener?
|
||||
// Maybe just use this listener for ALL action listeners and check if delete, then remove otherwise do current stuff.
|
||||
// Problem is, the listener doesn't work for the node itself only for children and listening to ALL document nodes might be a bad idea?!?!?!
|
||||
const observeConfig = {childList: false, attributes: true, subtree: false};
|
||||
const observeConfig = { childList: false, attributes: true, subtree: false };
|
||||
|
||||
if(hasSelector) {
|
||||
if (hasSelector) {
|
||||
this.app.eventManager.attach(e.id + 'childList', function(data) {
|
||||
const length = data.addedNodes.length;
|
||||
|
||||
for(let j = 0; j < length; j++) {
|
||||
for (let j = 0; j < length; j++) {
|
||||
self.bindListener(data.addedNodes[j], listeners[i]);
|
||||
}
|
||||
|
||||
|
|
@ -104,7 +104,6 @@
|
|||
}
|
||||
|
||||
this.app.eventManager.attach(e.id + 'attributes', function(data) {});
|
||||
|
||||
this.app.uiManager.getDOMObserver().observe(e, observeConfig);
|
||||
}
|
||||
};
|
||||
|
|
@ -138,7 +137,7 @@
|
|||
// Register event for first action
|
||||
e.addEventListener(listener.listener, function (event)
|
||||
{
|
||||
if(listener.preventDefault) {
|
||||
if (listener.preventDefault) {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@
|
|||
const submits = this.forms[id].getSubmit(),
|
||||
length = submits.length;
|
||||
|
||||
for(let i = 0; i < length; i++) {
|
||||
for (let i = 0; i < length; i++) {
|
||||
submits[i].addEventListener('click', function (event)
|
||||
{
|
||||
jsOMS.preventAll(event);
|
||||
|
|
@ -167,7 +167,7 @@
|
|||
this.app.eventManager.addGroup(form.getId(), counter);
|
||||
const result = injects[property](form, counter, form.getId());
|
||||
|
||||
if(result === false) {
|
||||
if (result === false) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -175,7 +175,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
if(counter === 0) {
|
||||
if (counter === 0) {
|
||||
this.app.eventManager.trigger(form.getId());
|
||||
}
|
||||
};
|
||||
|
|
@ -225,10 +225,10 @@
|
|||
}
|
||||
}
|
||||
} catch (e) {
|
||||
jsOMS.Log.Logger.instance.error('Invalid form response. \n' +
|
||||
'URL: ' + form.getAction() + '\n' +
|
||||
'Request: ' + JSON.stringify(form.getData()) + '\n' +
|
||||
'Response: ' + xhr.response
|
||||
jsOMS.Log.Logger.instance.error('Invalid form response. \n'
|
||||
+ 'URL: ' + form.getAction() + '\n'
|
||||
+ 'Request: ' + JSON.stringify(form.getData()) + '\n'
|
||||
+ 'Response: ' + xhr.response
|
||||
);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
*/
|
||||
jsOMS.UI.Input.bindElement = function (input)
|
||||
{
|
||||
if(typeof input === 'undefined') {
|
||||
if (typeof input === 'undefined') {
|
||||
throw 'Input element required'
|
||||
}
|
||||
|
||||
|
|
@ -61,7 +61,7 @@
|
|||
if (typeof (ref = this.getAttribute('data-ref')) !== 'undefined') {
|
||||
let e = document.getElementById(ref);
|
||||
|
||||
if(!e) {
|
||||
if (!e) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -81,7 +81,7 @@
|
|||
{
|
||||
const db = document.getElementById(dataButton);
|
||||
|
||||
if(db) {
|
||||
if (db) {
|
||||
db.click();
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
if (typeof id !== 'undefined') {
|
||||
const e = document.getElementById(id);
|
||||
|
||||
if(e) {
|
||||
if (e) {
|
||||
this.bindElement();
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
if (typeof id !== 'undefined') {
|
||||
const e = document.getElementById(id);
|
||||
|
||||
if(e) {
|
||||
if (e) {
|
||||
this.bindElement(e);
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -71,12 +71,12 @@
|
|||
const element = document.getElementById(id),
|
||||
self = this;
|
||||
|
||||
if(!element) {
|
||||
if (!element) {
|
||||
return;
|
||||
}
|
||||
|
||||
element.addEventListener('dragstart', function(e) {
|
||||
if(self.dragging === null) {
|
||||
if (self.dragging === null) {
|
||||
self.dragging = this;
|
||||
e.dataTransfer.effectAllowed = 'move';
|
||||
e.dataTransfer.setData('text/html', this.innerHTML);
|
||||
|
|
@ -110,7 +110,7 @@
|
|||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
||||
if(self.dragging === this) {
|
||||
if (self.dragging === this) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@
|
|||
e = e !== null ? e.querySelectorAll('[data-href]') : document.querySelectorAll('[data-href]');
|
||||
const length = e.length;
|
||||
|
||||
for(let i = 0; i < length; i++) {
|
||||
for (let i = 0; i < length; i++) {
|
||||
e[i].addEventListener('click', function(event) {
|
||||
jsOMS.preventAll(event);
|
||||
window.location = jsOMS.Uri.UriFactory.build(this.getAttribute('data-href'));
|
||||
|
|
@ -81,7 +81,7 @@
|
|||
const length = e.length;
|
||||
|
||||
/** global: IntersectionObserver */
|
||||
if(!this.visObs && window.IntersectionObserver) {
|
||||
if (!this.visObs && window.IntersectionObserver) {
|
||||
this.visObs = new IntersectionObserver(function(eles, obs) {
|
||||
eles.forEach(ele => {
|
||||
if (ele.intersectionRatio > 0) {
|
||||
|
|
@ -93,8 +93,8 @@
|
|||
});
|
||||
}
|
||||
|
||||
for(let i = 0; i < length; i++) {
|
||||
if(!this.visObs) {
|
||||
for (let i = 0; i < length; i++) {
|
||||
if (!this.visObs) {
|
||||
e[i].src = e[i].dataset.lazyload;
|
||||
delete e[i].dataset.lazyload;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -87,7 +87,6 @@
|
|||
const actions = this.elements[element],
|
||||
length = actions.length,
|
||||
keyLength = this.down.length;
|
||||
|
||||
let match = false;
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
|
|
|
|||
|
|
@ -109,7 +109,9 @@
|
|||
length = actions.length;
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
if ((!actions[i].exact || event.target.getAttribute('id') === element) && actions[i].button === event.button) {
|
||||
if ((!actions[i].exact || event.target.getAttribute('id') === element)
|
||||
&& actions[i].button === event.button
|
||||
) {
|
||||
jsOMS.preventAll(event);
|
||||
actions[i].callback();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@
|
|||
const e = document.getElementById(surface),
|
||||
self = this;
|
||||
|
||||
if(!e) {
|
||||
if (!e) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
this.voices = [];
|
||||
this.voice = null;
|
||||
|
||||
if(SpeechRecognition !== null) {
|
||||
if (SpeechRecognition !== null) {
|
||||
this.voices = window.speechSynthesis.getVoices();
|
||||
this.voice = this.voices[0];
|
||||
}
|
||||
|
|
@ -62,6 +62,7 @@
|
|||
utter.voice = this.voice;
|
||||
utter.pitch = this.pitch;
|
||||
utter.rate = this.rate;
|
||||
|
||||
window.speechSynthesis.speak(utter);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
this.recognition = null;
|
||||
this.speechRecognitionList = null;
|
||||
|
||||
if(SpeechRecognition !== null) {
|
||||
if (SpeechRecognition !== null) {
|
||||
this.recognition = new SpeechRecognition();
|
||||
this.speechRecognitionList = new SpeechGrammarList();
|
||||
}
|
||||
|
|
@ -54,41 +54,43 @@
|
|||
*/
|
||||
jsOMS.UI.Input.Voice.VoiceManager.prototype.setup = function()
|
||||
{
|
||||
if(SpeechRecognition === null) {
|
||||
if (SpeechRecognition === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
const self = this;
|
||||
|
||||
this.recognition.lang = this.lang;
|
||||
this.recognition.interimResults = false;
|
||||
this.recognition.maxAlternatives = 1;
|
||||
this.recognition.continuous = true;
|
||||
this.recognition.lang = this.lang;
|
||||
|
||||
if(typeof this.commands !== 'undefined') {
|
||||
if (typeof this.commands !== 'undefined') {
|
||||
this.speechRecognitionList.addFromString(this.getCommandsString(), 1);
|
||||
this.recognition.grammars = this.speechRecognitionList;
|
||||
}
|
||||
|
||||
this.recognition.onstart = function() {};
|
||||
|
||||
this.recognition.onresult = function(event) {
|
||||
this.recognition.onresult = function(event)
|
||||
{
|
||||
let result = jsOMS.trim(event.results[event.resultIndex][0].transcript);
|
||||
|
||||
if(self.commands.hasOwnProperty(result)) {
|
||||
if (self.commands.hasOwnProperty(result)) {
|
||||
self.commands[result]();
|
||||
}
|
||||
};
|
||||
|
||||
this.recognition.onspeechend = function() {
|
||||
this.recognition.onspeechend = function()
|
||||
{
|
||||
};
|
||||
|
||||
this.recognition.onnomatch = function(event) {
|
||||
this.recognition.onnomatch = function(event)
|
||||
{
|
||||
jsOMS.Log.Logger.instance.warning('Couldn\'t recognize speech');
|
||||
};
|
||||
|
||||
this.recognition.onerror = function(event) {
|
||||
this.recognition.onerror = function(event)
|
||||
{
|
||||
jsOMS.Log.Logger.instance.warning('Error during speech recognition: ' + event.error);
|
||||
};
|
||||
};
|
||||
|
|
@ -144,7 +146,7 @@
|
|||
*/
|
||||
jsOMS.UI.Input.Voice.VoiceManager.prototype.start = function()
|
||||
{
|
||||
if(SpeechRecognition === null) {
|
||||
if (SpeechRecognition === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -160,7 +162,7 @@
|
|||
*/
|
||||
jsOMS.UI.Input.Voice.VoiceManager.prototype.stop = function()
|
||||
{
|
||||
if(SpeechRecognition === null) {
|
||||
if (SpeechRecognition === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@
|
|||
keyValPairs = query.split('&');
|
||||
|
||||
for (pairNum in keyValPairs) {
|
||||
if(!keyValPairs.hasOwnProperty(pairNum)) {
|
||||
if (!keyValPairs.hasOwnProperty(pairNum)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
*/
|
||||
jsOMS.Uri.UriFactory.clear = function(key)
|
||||
{
|
||||
if(jsOMS.Uri.UriFactory.uri.hasOwnProperty(key)) {
|
||||
if (jsOMS.Uri.UriFactory.uri.hasOwnProperty(key)) {
|
||||
delete jsOMS.Uri.UriFactory.uri[key];
|
||||
|
||||
return true;
|
||||
|
|
@ -121,8 +121,8 @@
|
|||
let success = false;
|
||||
const regexp = new RegExp(pattern);
|
||||
|
||||
for(let key in jsOMS.Uri.UriFactory.uri) {
|
||||
if(jsOMS.Uri.UriFactory.uri.hasOwnProperty(key) && regexp.test(key)) {
|
||||
for (let key in jsOMS.Uri.UriFactory.uri) {
|
||||
if (jsOMS.Uri.UriFactory.uri.hasOwnProperty(key) && regexp.test(key)) {
|
||||
delete jsOMS.Uri.UriFactory.uri[key];
|
||||
success = true;
|
||||
}
|
||||
|
|
@ -205,7 +205,7 @@
|
|||
} else if (match.indexOf('#') === 0) {
|
||||
const e = document.getElementById(match.substr(1));
|
||||
|
||||
if(e) {
|
||||
if (e) {
|
||||
return e.value;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@
|
|||
const pathParts = path.split(delim);
|
||||
let current = data;
|
||||
|
||||
for(let key in pathParts) {
|
||||
if(!pathParts.hasOwnProperty(key)) {
|
||||
for (let key in pathParts) {
|
||||
if (!pathParts.hasOwnProperty(key)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -151,8 +151,7 @@
|
|||
{
|
||||
/** global: Node */
|
||||
return (
|
||||
typeof Node === "object" ? ele instanceof Node :
|
||||
ele && typeof ele === "object" && typeof ele.nodeType === "number" && typeof ele.nodeName === "string"
|
||||
typeof Node === "object" ? ele instanceof Node : ele && typeof ele === "object" && typeof ele.nodeType === "number" && typeof ele.nodeName === "string"
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -30,12 +30,12 @@
|
|||
const pathParts = path.split(delim);
|
||||
let current = data;
|
||||
|
||||
for(let key in pathParts) {
|
||||
if(!pathParts.hasOwnProperty(key)) {
|
||||
for (let key in pathParts) {
|
||||
if (!pathParts.hasOwnProperty(key)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(typeof current === 'undefined' || !current.hasOwnProperty(pathParts[key])) {
|
||||
if (typeof current === 'undefined' || !current.hasOwnProperty(pathParts[key])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
@ -321,8 +321,7 @@
|
|||
{
|
||||
/** global: Node */
|
||||
return (
|
||||
typeof Node === "object" ? ele instanceof Node :
|
||||
ele && typeof ele === "object" && typeof ele.nodeType === "number" && typeof ele.nodeName === "string"
|
||||
typeof Node === "object" ? ele instanceof Node : ele && typeof ele === "object" && typeof ele.nodeType === "number" && typeof ele.nodeName === "string"
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@
|
|||
{
|
||||
const form = document.getElementById(this.id);
|
||||
|
||||
if(!form) {
|
||||
if (!form) {
|
||||
return [];
|
||||
}
|
||||
|
||||
|
|
@ -158,7 +158,7 @@
|
|||
let value = null;
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
if(elements[i].tagName.toLowerCase() === 'canvas') {
|
||||
if (elements[i].tagName.toLowerCase() === 'canvas') {
|
||||
value = elements[i].toDataURL('image/png');
|
||||
} else {
|
||||
value = elements[i].value;
|
||||
|
|
@ -196,7 +196,11 @@
|
|||
|
||||
try {
|
||||
for (let i = 0; i < length; i++) {
|
||||
if ((elements[i].required && elements[i].value === '') || (typeof elements[i].pattern !== 'undefined' && elements[i].pattern !== '' && !(new RegExp(elements[i].pattern)).test(elements[i].value))) {
|
||||
if ((elements[i].required && elements[i].value === '')
|
||||
|| (typeof elements[i].pattern !== 'undefined'
|
||||
&& elements[i].pattern !== ''
|
||||
&& !(new RegExp(elements[i].pattern)).test(elements[i].value))
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -268,7 +272,7 @@
|
|||
|
||||
const e = document.getElementById(this.id);
|
||||
|
||||
if(!e) {
|
||||
if (!e) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
{
|
||||
overwrite = typeof overwrite !== 'undefined' ? overwrite : false;
|
||||
|
||||
if(typeof this.data[id] === 'undefined' || overwrite) {
|
||||
if (typeof this.data[id] === 'undefined' || overwrite) {
|
||||
this.data[id] = data;
|
||||
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user