mirror of
https://github.com/Karaka-Management/jsOMS.git
synced 2026-01-11 01:48:40 +00:00
Fix codestyle with phpcs
This commit is contained in:
parent
ea94fafcdd
commit
6f9367aa64
|
|
@ -155,10 +155,10 @@
|
|||
jsOMS.Animation.Canvas.ParticleAnimation.prototype.updateDistance = function (p1, p2)
|
||||
{
|
||||
const pos1 = p1.getPosition(),
|
||||
pos2 = p2.getPosition(),
|
||||
dx = pos1.x - pos2.x,
|
||||
dy = pos1.y - pos2.y,
|
||||
dist = Math.sqrt(dx * dx + dy * dy);
|
||||
pos2 = p2.getPosition(),
|
||||
dx = pos1.x - pos2.x,
|
||||
dy = pos1.y - pos2.y,
|
||||
dist = Math.sqrt(dx * dx + dy * dy);
|
||||
|
||||
let vel1 = p1.getVelocity(),
|
||||
vel2 = p2.getVelocity();
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
jsOMS.Asset.AssetManager.prototype.registerLoadedAssets = function ()
|
||||
{
|
||||
const scripts = document.getElementsByTagName('script'),
|
||||
length = !scripts ? 0 : scripts.length;
|
||||
length = !scripts ? 0 : scripts.length;
|
||||
|
||||
this.assets = {};
|
||||
|
||||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
jsOMS.Auth.Auth = function (uri)
|
||||
{
|
||||
this.account = null;
|
||||
this.uri = uri;
|
||||
this.uri = uri;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@
|
|||
let paths = namespace.split('.');
|
||||
paths.splice(0, 1);
|
||||
|
||||
const length = paths.length;
|
||||
let current = jsOMS;
|
||||
const length = paths.length;
|
||||
let current = jsOMS;
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
if (typeof current[paths[i]] === 'undefined') {
|
||||
|
|
@ -56,7 +56,7 @@
|
|||
jsOMS.Autoloader.initPreloaded = function ()
|
||||
{
|
||||
const scripts = document.getElementsByTagName('script'),
|
||||
length = !scripts ? 0 : scripts.length;
|
||||
length = !scripts ? 0 : scripts.length;
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
/** global: URL */
|
||||
|
|
@ -103,7 +103,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
if(typeof callback !== 'undefined' && callback !== null) {
|
||||
if (typeof callback !== 'undefined' && callback !== null) {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
jsOMS.Chart.AreaChart = function (id)
|
||||
{
|
||||
this.chart = new jsOMS.Chart.LineChart(id);
|
||||
this.chart = new jsOMS.Chart.LineChart(id);
|
||||
this.chart.getChart().subtype = 'area';
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@
|
|||
// 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 = {
|
||||
this.chart.color = d3.scale.category10();
|
||||
this.chart.axis = {
|
||||
x: {
|
||||
visible: true,
|
||||
label: {
|
||||
|
|
@ -92,12 +92,12 @@
|
|||
|
||||
this.chart.calculateDimension();
|
||||
|
||||
x = this.chart.createXScale('linear');
|
||||
y = this.chart.createYScale('ordinal');
|
||||
x = this.chart.createXScale('linear');
|
||||
y = this.chart.createYScale('ordinal');
|
||||
xAxis1 = this.chart.createXAxis(x);
|
||||
yAxis1 = this.chart.createYAxis(y);
|
||||
xGrid = this.chart.createXGrid(x);
|
||||
yGrid = this.chart.createYGrid(y);
|
||||
xGrid = this.chart.createXGrid(x);
|
||||
yGrid = this.chart.createYGrid(y);
|
||||
|
||||
x.domain([0, this.chart.axis.y.max + 1]);
|
||||
y.domain(d3.range(this.chart.dataset[0].points.length)).rangeRoundBands([0, this.chart.dimension.height - this.chart.margin.top - this.chart.margin.bottom], .1);
|
||||
|
|
@ -111,9 +111,9 @@
|
|||
|
||||
this.chart.drawGrid(svg, xGrid, yGrid);
|
||||
|
||||
let dataPoint = null,
|
||||
let dataPoint = null,
|
||||
dataPointEnter = null,
|
||||
temp = this.drawData(svg, x, y, dataPointEnter, dataPoint);
|
||||
temp = this.drawData(svg, x, y, dataPointEnter, dataPoint);
|
||||
|
||||
dataPointEnter = temp[0];
|
||||
dataPoint = temp[1];
|
||||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
// Setting default chart values
|
||||
this.chart.margin = {top: 5, right: 0, bottom: 0, left: 0};
|
||||
/** global: d3 */
|
||||
this.chart.color = d3.scale.quantize()
|
||||
this.chart.color = d3.scale.quantize()
|
||||
.domain([-.05, .05])
|
||||
.range(d3.range(11).map(function(d) { return "q" + d + "-11"; }));
|
||||
|
||||
|
|
@ -28,14 +28,15 @@
|
|||
|
||||
jsOMS.Chart.CalendarChart.prototype.draw = function ()
|
||||
{
|
||||
let percent = d3.format(".1%"),
|
||||
format = d3.time.format("%Y-%m-%d"),
|
||||
let percent = d3.format(".1%"),
|
||||
format = d3.time.format("%Y-%m-%d"),
|
||||
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)
|
||||
|
|
@ -43,8 +44,8 @@
|
|||
.attr("class", "RdYlGn")
|
||||
.append("g")
|
||||
.attr("transform", "translate("
|
||||
+ ((this.chart.dimension.width - this.chart.cellSize * 53) / 2)
|
||||
+ "," + (this.chart.dimension.height - this.chart.cellSize * 7 - 1) + ")");
|
||||
+ ((this.chart.dimension.width - this.chart.cellSize * 53) / 2)
|
||||
+ "," + (this.chart.dimension.height - this.chart.cellSize * 7 - 1) + ")");
|
||||
|
||||
svg.append("text")
|
||||
.attr("transform", "translate(-6," + this.chart.cellSize * 3.5 + ")rotate(-90)")
|
||||
|
|
@ -82,18 +83,18 @@
|
|||
|
||||
// todo: fix the following data filter etc. this is way to much work and slow
|
||||
rect.filter(function(d) {
|
||||
let year = d.split('-')[0],
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -105,17 +106,17 @@
|
|||
})
|
||||
.attr("class", function(d) {
|
||||
let year = d.split('-')[0],
|
||||
length = self.chart.dataset.length;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
@ -126,17 +127,17 @@
|
|||
.select("title")
|
||||
.text(function(d) {
|
||||
let year = d.split('-')[0],
|
||||
length = self.chart.dataset.length;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@
|
|||
// 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 = {
|
||||
this.chart.color = d3.scale.category10();
|
||||
this.chart.axis = {
|
||||
x: {
|
||||
visible: true,
|
||||
label: {
|
||||
|
|
@ -49,7 +49,7 @@
|
|||
}
|
||||
};
|
||||
|
||||
this.chart.grid = {
|
||||
this.chart.grid = {
|
||||
x: {
|
||||
visible: true
|
||||
},
|
||||
|
|
@ -72,18 +72,18 @@
|
|||
|
||||
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();
|
||||
|
||||
x = this.chart.createXScale('linear');
|
||||
y = this.chart.createYScale('linear');
|
||||
x = this.chart.createXScale('linear');
|
||||
y = this.chart.createYScale('linear');
|
||||
xAxis1 = this.chart.createXAxis(x);
|
||||
yAxis1 = this.chart.createYAxis(y);
|
||||
xGrid = this.chart.createXGrid(x);
|
||||
yGrid = this.chart.createYGrid(y);
|
||||
xGrid = this.chart.createXGrid(x);
|
||||
yGrid = this.chart.createYGrid(y);
|
||||
|
||||
x.domain([this.chart.axis.x.min - 1, this.chart.axis.x.max + 1]);
|
||||
y.domain([this.chart.axis.y0.min - 1, this.chart.axis.y.max + 1]);
|
||||
|
|
@ -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("y", function(d) {return y(d.open);})
|
||||
.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("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" ;});
|
||||
}
|
||||
|
||||
|
|
@ -131,7 +131,7 @@
|
|||
.enter().append("svg:line")
|
||||
.attr("class", "stem")
|
||||
.attr("x1", function(d) { return x(d.x);})
|
||||
.attr("x2", function(d) { return x(d.x);})
|
||||
.attr("x2", function(d) { return x(d.x);})
|
||||
.attr("y1", function(d) { return y(d.y);})
|
||||
.attr("y2", function(d) { return y(d.y0); })
|
||||
.attr("stroke", function(d){ return d.open > d.close ? "red" : "green"; });
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
jsOMS.Chart.ChartAbstract = function (id)
|
||||
{
|
||||
/** global: d3 */
|
||||
this.chartId = id;
|
||||
this.chartId = id;
|
||||
this.chartSelect = d3.select('#' + this.chartId);
|
||||
|
||||
this.title = {
|
||||
|
|
@ -17,23 +17,27 @@
|
|||
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.color = d3.scale.category10();
|
||||
this.dataset = [];
|
||||
this.dataSettings = {
|
||||
style: {
|
||||
strokewidth: 3,
|
||||
|
|
@ -57,10 +61,10 @@
|
|||
};
|
||||
|
||||
this.dimension = {width: 0, height: 0};
|
||||
this.margin = {top: 0, right: 0, bottom: 0, left: 0};
|
||||
this.margin = {top: 0, right: 0, bottom: 0, left: 0};
|
||||
|
||||
this.axis = {};
|
||||
this.grid = {};
|
||||
this.axis = {};
|
||||
this.grid = {};
|
||||
this.subtype = '';
|
||||
|
||||
this.clean();
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
@ -363,9 +367,9 @@
|
|||
|
||||
if (!this.defined.text.subtitle) {
|
||||
this.position.subtitle.top = temp.node().getBoundingClientRect().height / 2;
|
||||
this.margin.top += temp.node().getBoundingClientRect().height / 2 + topmargin;
|
||||
this.margin.top += temp.node().getBoundingClientRect().height / 2 + topmargin;
|
||||
this.defined.text.subtitle = true;
|
||||
this.shouldRedraw = true;
|
||||
this.shouldRedraw = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -381,9 +385,9 @@
|
|||
|
||||
if (!this.defined.text.title) {
|
||||
this.position.title.top = 0;
|
||||
this.margin.top += (temp.node().getBoundingClientRect().height) / 2 + this.position.subtitle.top / 2;
|
||||
this.margin.top += (temp.node().getBoundingClientRect().height) / 2 + this.position.subtitle.top / 2;
|
||||
this.defined.text.title = true;
|
||||
this.shouldRedraw = true;
|
||||
this.shouldRedraw = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
@ -455,7 +459,7 @@
|
|||
if (!this.defined.axis.x) {
|
||||
this.margin.bottom += 50;
|
||||
this.defined.axis.x = true;
|
||||
this.shouldRedraw = true;
|
||||
this.shouldRedraw = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -477,9 +481,9 @@
|
|||
}
|
||||
|
||||
if (!this.defined.axis.y) {
|
||||
this.margin.left += svg.select('.y.axis .tick').node().getBoundingClientRect().width + 25;
|
||||
this.margin.left += svg.select('.y.axis .tick').node().getBoundingClientRect().width + 25;
|
||||
this.defined.axis.y = true;
|
||||
this.shouldRedraw = true;
|
||||
this.shouldRedraw = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -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
|
||||
|
|
@ -602,9 +606,9 @@
|
|||
|
||||
jsOMS.Chart.ChartAbstract.prototype.clean = function ()
|
||||
{
|
||||
this.margin = {top: 0, right: 0, bottom: 0, left: 0};
|
||||
this.margin = {top: 0, right: 0, bottom: 0, left: 0};
|
||||
this.dimension = {width: 0, height: 0};
|
||||
this.position = {
|
||||
this.position = {
|
||||
title: {
|
||||
top: 0,
|
||||
left: 0
|
||||
|
|
@ -624,7 +628,7 @@
|
|||
};
|
||||
|
||||
this.shouldRedraw = false;
|
||||
this.defined = {
|
||||
this.defined = {
|
||||
axis: {
|
||||
x: false,
|
||||
y: false
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@
|
|||
"use strict";
|
||||
|
||||
jsOMS.Chart.Legend = function () {
|
||||
this.position = {x: 0, y: 0};
|
||||
this.relative = true;
|
||||
this.position = {x: 0, y: 0};
|
||||
this.relative = true;
|
||||
this.horizontal = false;
|
||||
this.visible = true;
|
||||
this.labels = []; // {title, color, marker}
|
||||
this.visible = true;
|
||||
this.labels = []; // {title, color, marker}
|
||||
};
|
||||
|
||||
jsOMS.Chart.Legend.prototype.addLabel = function(label) {
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@
|
|||
// 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 = {
|
||||
this.chart.color = d3.scale.category10();
|
||||
this.chart.axis = {
|
||||
x: {
|
||||
visible: true,
|
||||
label: {
|
||||
|
|
@ -92,12 +92,12 @@
|
|||
|
||||
this.chart.calculateDimension();
|
||||
|
||||
x = this.chart.createXScale('ordinal');
|
||||
y = this.chart.createYScale('linear');
|
||||
x = this.chart.createXScale('ordinal');
|
||||
y = this.chart.createYScale('linear');
|
||||
xAxis1 = this.chart.createXAxis(x);
|
||||
yAxis1 = this.chart.createYAxis(y);
|
||||
xGrid = this.chart.createXGrid(x);
|
||||
yGrid = this.chart.createYGrid(y);
|
||||
xGrid = this.chart.createXGrid(x);
|
||||
yGrid = this.chart.createYGrid(y);
|
||||
|
||||
x.domain(d3.range(this.chart.dataset[0].points.length)).rangeRoundBands([0, this.chart.dimension.width - this.chart.margin.right - this.chart.margin.left], .1);
|
||||
y.domain([0, this.chart.axis.y.max + 1]);
|
||||
|
|
@ -111,11 +111,12 @@
|
|||
|
||||
this.chart.drawGrid(svg, xGrid, yGrid);
|
||||
|
||||
let dataPoint = null,
|
||||
let dataPoint = null,
|
||||
dataPointEnter = null,
|
||||
temp = this.drawData(svg, x, y, dataPointEnter, dataPoint);
|
||||
dataPointEnter = temp[0];
|
||||
dataPoint = temp[1];
|
||||
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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@
|
|||
|
||||
jsOMS.Chart.DiffAreaChart = function (id)
|
||||
{
|
||||
this.chart = new jsOMS.Chart.LineChart(id);
|
||||
this.chart = new jsOMS.Chart.LineChart(id);
|
||||
this.chart.getChart().dataSettings.marker.visible = false;
|
||||
this.chart.getChart().subtype = 'diffarea';
|
||||
this.chart.getChart().subtype = 'diffarea';
|
||||
};
|
||||
|
||||
jsOMS.Chart.DiffAreaChart.prototype.getChart = function ()
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
// Setting default chart values
|
||||
this.chart.getChart().dataSettings.style.strokewidth = 0.3;
|
||||
this.chart.getChart().subtype = 'donut';
|
||||
this.chart.getChart().subtype = 'donut';
|
||||
};
|
||||
|
||||
jsOMS.Chart.DonutChart.prototype.getChart = function ()
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
jsOMS.Chart.GroupedBarChart = function (id)
|
||||
{
|
||||
this.chart = new jsOMS.Chart.BarChart(id);
|
||||
this.chart = new jsOMS.Chart.BarChart(id);
|
||||
this.chart.getChart().subtype = 'grouped';
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
jsOMS.Chart.GroupedColumnChart = function (id)
|
||||
{
|
||||
this.chart = new jsOMS.Chart.ColumnChart(id);
|
||||
this.chart = new jsOMS.Chart.ColumnChart(id);
|
||||
this.chart.getChart().subtype = 'grouped';
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@
|
|||
// 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 = {
|
||||
this.chart.color = d3.scale.category10();
|
||||
this.chart.axis = {
|
||||
x: {
|
||||
visible: true,
|
||||
label: {
|
||||
|
|
@ -78,12 +78,12 @@
|
|||
|
||||
this.chart.calculateDimension();
|
||||
|
||||
x = this.chart.createXScale('linear');
|
||||
y = this.chart.createYScale('linear');
|
||||
x = this.chart.createXScale('linear');
|
||||
y = this.chart.createYScale('linear');
|
||||
xAxis1 = this.chart.createXAxis(x);
|
||||
yAxis1 = this.chart.createYAxis(y);
|
||||
xGrid = this.chart.createXGrid(x);
|
||||
yGrid = this.chart.createYGrid(y);
|
||||
xGrid = this.chart.createXGrid(x);
|
||||
yGrid = this.chart.createYGrid(y);
|
||||
|
||||
x.domain([this.chart.axis.x.min, this.chart.axis.x.max + 1]);
|
||||
y.domain([this.chart.axis.y.min - 1, this.chart.axis.y.max + 1]);
|
||||
|
|
@ -192,9 +192,9 @@
|
|||
//svg.selectAll('.x.axis').transition().duration(500).call(xAxis1);
|
||||
//svg.selectAll('.y.axis').transition().duration(500).call(yAxis1);
|
||||
|
||||
let dataPoint = null,
|
||||
let dataPoint = null,
|
||||
dataPointEnter = null,
|
||||
temp = this.drawData(svg, line, dataPointEnter, dataPoint);
|
||||
temp = this.drawData(svg, line, dataPointEnter, dataPoint);
|
||||
|
||||
dataPointEnter = temp[0];
|
||||
dataPoint = temp[1];
|
||||
|
|
@ -221,8 +221,7 @@
|
|||
jsOMS.Chart.LineChart.prototype.drawData = function (svg, line, dataPointEnter, dataPoint)
|
||||
{
|
||||
const self = this;
|
||||
|
||||
dataPoint = svg.selectAll(".dataPoint").data(this.chart.dataset, function (c)
|
||||
dataPoint = svg.selectAll(".dataPoint").data(this.chart.dataset, function (c)
|
||||
{
|
||||
return c.id;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
jsOMS.Chart.OhlcChart = function (id)
|
||||
{
|
||||
this.chart = new jsOMS.Chart.CandlestickChart(id);
|
||||
this.chart = new jsOMS.Chart.CandlestickChart(id);
|
||||
this.chart.getChart().subtype = 'ohlc';
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -8,11 +8,12 @@
|
|||
|
||||
// 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.color = d3.scale.category10();
|
||||
this.chart.dataSettings.style.strokewidth = 1;
|
||||
this.chart.dataSettings.style.padding = 3;
|
||||
this.chart.subtype = 'pie';
|
||||
this.chart.dataSettings.style.padding = 3;
|
||||
this.chart.subtype = 'pie';
|
||||
};
|
||||
|
||||
jsOMS.Chart.PieChart.prototype.getChart = function ()
|
||||
|
|
@ -33,11 +34,11 @@
|
|||
+ (this.chart.margin.left) + ","
|
||||
+ (this.chart.margin.top) + ")");
|
||||
|
||||
let dataPoint = null,
|
||||
let dataPoint = null,
|
||||
dataPointEnter = null,
|
||||
temp = this.drawData(svg, dataPointEnter, dataPoint);
|
||||
dataPointEnter = temp[0];
|
||||
dataPoint = temp[1];
|
||||
temp = this.drawData(svg, dataPointEnter, dataPoint);
|
||||
dataPointEnter = temp[0];
|
||||
dataPoint = temp[1];
|
||||
|
||||
// todo: create own legend drawing
|
||||
this.chart.drawLegend(svg, dataPointEnter, dataPoint);
|
||||
|
|
@ -62,20 +63,20 @@
|
|||
|
||||
jsOMS.Chart.PieChart.prototype.drawData = function (svg, dataPointEnter, dataPoint)
|
||||
{
|
||||
const self = this;
|
||||
let pie = d3.layout.pie()
|
||||
const self = this;
|
||||
let pie = d3.layout.pie()
|
||||
.sort(null)
|
||||
.value(function (d)
|
||||
{
|
||||
return d.value;
|
||||
}),
|
||||
radius = (
|
||||
radius = (
|
||||
Math.min(this.chart.dimension.width, this.chart.dimension.height) / 2
|
||||
- Math.max(this.chart.margin.right + this.chart.margin.left,
|
||||
this.chart.margin.top + this.chart.margin.bottom)
|
||||
),
|
||||
innerRadius = radius - radius*self.chart.dataSettings.style.strokewidth,
|
||||
arc = d3.svg.arc()
|
||||
arc = d3.svg.arc()
|
||||
.outerRadius(function() { return radius; })
|
||||
.innerRadius(function() { return innerRadius; });
|
||||
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@
|
|||
// 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 = {
|
||||
this.chart.color = d3.scale.category10();
|
||||
this.chart.axis = {
|
||||
x: {
|
||||
visible: true,
|
||||
label: {
|
||||
|
|
@ -64,13 +64,13 @@
|
|||
jsOMS.Chart.PyramidChart.prototype.setData = function (data)
|
||||
{
|
||||
let dataset = [{id: 1, name: 'Dataset', points: []}],
|
||||
length = data.length,
|
||||
add = 0;
|
||||
length = data.length,
|
||||
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;
|
||||
add += data[i].value;
|
||||
}
|
||||
|
||||
dataset[0].points[length - 1] = { name: data[length - 1].name, y0: 0, y: add };
|
||||
|
|
@ -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,
|
||||
|
|
@ -145,11 +147,11 @@
|
|||
|
||||
this.chart.drawGrid(svg, xGrid, yGrid);
|
||||
|
||||
let dataPoint = null,
|
||||
let dataPoint = null,
|
||||
dataPointEnter = null,
|
||||
temp = this.drawData(svg, x, y, dataPointEnter, dataPoint);
|
||||
dataPointEnter = temp[0];
|
||||
dataPoint = temp[1];
|
||||
temp = this.drawData(svg, x, y, dataPointEnter, dataPoint);
|
||||
dataPointEnter = temp[0];
|
||||
dataPoint = temp[1];
|
||||
|
||||
this.chart.drawText(svg);
|
||||
this.chart.drawAxis(svg, xAxis1, yAxis1);
|
||||
|
|
|
|||
|
|
@ -8,9 +8,10 @@
|
|||
|
||||
// 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 = {
|
||||
this.chart.color = d3.scale.category10();
|
||||
this.chart.axis = {
|
||||
x: {
|
||||
visible: true,
|
||||
label: {
|
||||
|
|
@ -72,12 +73,12 @@
|
|||
|
||||
this.chart.calculateDimension('linear');
|
||||
|
||||
x = this.chart.createXScale('linear');
|
||||
y = this.chart.createYScale('linear');
|
||||
x = this.chart.createXScale('linear');
|
||||
y = this.chart.createYScale('linear');
|
||||
xAxis1 = this.chart.createXAxis(x);
|
||||
yAxis1 = this.chart.createYAxis(y);
|
||||
xGrid = this.chart.createXGrid(x);
|
||||
yGrid = this.chart.createYGrid(y);
|
||||
xGrid = this.chart.createXGrid(x);
|
||||
yGrid = this.chart.createYGrid(y);
|
||||
|
||||
x.domain([this.chart.axis.x.min, this.chart.axis.x.max + 1]);
|
||||
y.domain([this.chart.axis.y.min - 1, this.chart.axis.y.max + 1]);
|
||||
|
|
@ -91,11 +92,11 @@
|
|||
|
||||
this.chart.drawGrid(svg, xGrid, yGrid);
|
||||
|
||||
let dataPoint = null,
|
||||
let dataPoint = null,
|
||||
dataPointEnter = null,
|
||||
temp = this.drawData(svg, x, y, dataPointEnter, dataPoint);
|
||||
dataPointEnter = temp[0];
|
||||
dataPoint = temp[1];
|
||||
temp = this.drawData(svg, x, y, dataPointEnter, dataPoint);
|
||||
dataPointEnter = temp[0];
|
||||
dataPoint = temp[1];
|
||||
|
||||
this.chart.drawLegend(svg, dataPointEnter, dataPoint);
|
||||
this.chart.drawText(svg);
|
||||
|
|
@ -116,8 +117,7 @@
|
|||
jsOMS.Chart.ScatterplotChart.prototype.drawData = function (svg, x, y, dataPointEnter, dataPoint)
|
||||
{
|
||||
const self = this;
|
||||
|
||||
dataPoint = svg.selectAll(".dataPoint").data(this.chart.dataset, function (c)
|
||||
dataPoint = svg.selectAll(".dataPoint").data(this.chart.dataset, function (c)
|
||||
{
|
||||
return c.id;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@
|
|||
|
||||
jsOMS.Chart.StackedAreaChart = function (id)
|
||||
{
|
||||
this.chart = new jsOMS.Chart.LineChart(id);
|
||||
this.chart = new jsOMS.Chart.LineChart(id);
|
||||
this.chart.getChart().dataSettings.marker.visible = false;
|
||||
this.chart.getChart().subtype = 'stacked';
|
||||
this.chart.getChart().subtype = 'stacked';
|
||||
};
|
||||
|
||||
jsOMS.Chart.StackedAreaChart.prototype.getChart = function ()
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
jsOMS.Chart.StackedBarChart = function (id)
|
||||
{
|
||||
this.chart = new jsOMS.Chart.BarChart(id);
|
||||
this.chart = new jsOMS.Chart.BarChart(id);
|
||||
this.chart.getChart().subtype = 'stacked';
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
jsOMS.Chart.StackedColumnChart = function (id)
|
||||
{
|
||||
this.chart = new jsOMS.Chart.ColumnChart(id);
|
||||
this.chart = new jsOMS.Chart.ColumnChart(id);
|
||||
this.chart.getChart().subtype = 'stacked';
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -8,9 +8,10 @@
|
|||
|
||||
// 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 = {
|
||||
this.chart.color = d3.scale.category10();
|
||||
this.chart.axis = {
|
||||
x: {
|
||||
visible: true,
|
||||
label: {
|
||||
|
|
@ -53,6 +54,7 @@
|
|||
visible: true
|
||||
}
|
||||
};
|
||||
|
||||
this.chart.subtype = 'vwaterfall';
|
||||
};
|
||||
|
||||
|
|
@ -64,13 +66,13 @@
|
|||
jsOMS.Chart.VWaterfallChart.prototype.setData = function (data)
|
||||
{
|
||||
let dataset = [{id: 1, name: 'Dataset', points: []}],
|
||||
length = data.length,
|
||||
add = 0;
|
||||
length = data.length,
|
||||
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;
|
||||
add += data[i].value;
|
||||
}
|
||||
|
||||
dataset[0].points[length - 1] = { name: data[length - 1].name, y0: 0, y: add };
|
||||
|
|
@ -84,14 +86,14 @@
|
|||
|
||||
this.chart.calculateDimension();
|
||||
|
||||
x = this.chart.createXScale('linear');
|
||||
y = this.chart.createYScale('ordinal');
|
||||
x = this.chart.createXScale('linear');
|
||||
y = this.chart.createYScale('ordinal');
|
||||
xAxis1 = this.chart.createXAxis(x);
|
||||
yAxis1 = this.chart.createYAxis(y);
|
||||
xGrid = this.chart.createXGrid(x);
|
||||
yGrid = this.chart.createYGrid(y);
|
||||
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")
|
||||
|
|
@ -103,11 +105,11 @@
|
|||
|
||||
this.chart.drawGrid(svg, xGrid, yGrid);
|
||||
|
||||
let dataPoint = null,
|
||||
let dataPoint = null,
|
||||
dataPointEnter = null,
|
||||
temp = this.drawData(svg, x, y, dataPointEnter, dataPoint);
|
||||
dataPointEnter = temp[0];
|
||||
dataPoint = temp[1];
|
||||
temp = this.drawData(svg, x, y, dataPointEnter, dataPoint);
|
||||
dataPointEnter = temp[0];
|
||||
dataPoint = temp[1];
|
||||
|
||||
this.chart.drawText(svg);
|
||||
this.chart.drawAxis(svg, xAxis1, yAxis1);
|
||||
|
|
@ -127,8 +129,7 @@
|
|||
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)
|
||||
dataPoint = svg.selectAll(".dataPoint").data(this.chart.dataset[0].points, function (c)
|
||||
{
|
||||
return c.name;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -8,9 +8,10 @@
|
|||
|
||||
// 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 = {
|
||||
this.chart.color = d3.scale.category10();
|
||||
this.chart.axis = {
|
||||
x: {
|
||||
visible: true,
|
||||
label: {
|
||||
|
|
@ -53,6 +54,7 @@
|
|||
visible: true
|
||||
}
|
||||
};
|
||||
|
||||
this.chart.subtype = 'waterfall';
|
||||
};
|
||||
|
||||
|
|
@ -64,13 +66,13 @@
|
|||
jsOMS.Chart.WaterfallChart.prototype.setData = function (data)
|
||||
{
|
||||
let dataset = [{id: 1, name: 'Dataset', points: []}],
|
||||
length = data.length,
|
||||
add = 0;
|
||||
length = data.length,
|
||||
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;
|
||||
add += data[i].value;
|
||||
}
|
||||
|
||||
dataset[0].points[length - 1] = { name: data[length - 1].name, y0: 0, y: add };
|
||||
|
|
@ -84,15 +86,15 @@
|
|||
|
||||
this.chart.calculateDimension();
|
||||
|
||||
x = this.chart.createXScale('ordinal');
|
||||
y = this.chart.createYScale('linear');
|
||||
x = this.chart.createXScale('ordinal');
|
||||
y = this.chart.createYScale('linear');
|
||||
xAxis1 = this.chart.createXAxis(x);
|
||||
yAxis1 = this.chart.createYAxis(y);
|
||||
xGrid = this.chart.createXGrid(x);
|
||||
yGrid = this.chart.createYGrid(y);
|
||||
xGrid = this.chart.createXGrid(x);
|
||||
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)
|
||||
|
|
@ -103,11 +105,11 @@
|
|||
|
||||
this.chart.drawGrid(svg, xGrid, yGrid);
|
||||
|
||||
let dataPoint = null,
|
||||
let dataPoint = null,
|
||||
dataPointEnter = null,
|
||||
temp = this.drawData(svg, x, y, dataPointEnter, dataPoint);
|
||||
dataPointEnter = temp[0];
|
||||
dataPoint = temp[1];
|
||||
temp = this.drawData(svg, x, y, dataPointEnter, dataPoint);
|
||||
dataPointEnter = temp[0];
|
||||
dataPoint = temp[1];
|
||||
|
||||
this.chart.drawText(svg);
|
||||
this.chart.drawAxis(svg, xAxis1, yAxis1);
|
||||
|
|
@ -127,8 +129,7 @@
|
|||
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)
|
||||
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;
|
||||
};
|
||||
|
||||
|
|
@ -67,7 +73,7 @@
|
|||
if (cStart === -1) {
|
||||
cValue = null;
|
||||
} else {
|
||||
cStart = cValue.indexOf("=", cStart) + 1;
|
||||
cStart = cValue.indexOf("=", cStart) + 1;
|
||||
let cEnd = cValue.indexOf(";", cStart);
|
||||
|
||||
if (cEnd === -1) {
|
||||
|
|
|
|||
|
|
@ -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,12 +166,12 @@
|
|||
*/
|
||||
jsOMS.Event.EventManager.prototype.attach = function (group, callback, remove, reset)
|
||||
{
|
||||
if(this.callbacks.hasOwnProperty(group)) {
|
||||
if (this.callbacks.hasOwnProperty(group)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
remove = typeof remove === 'undefined' ? false : remove;
|
||||
reset = typeof reset === 'undefined' ? false : reset;
|
||||
reset = typeof reset === 'undefined' ? false : reset;
|
||||
|
||||
this.callbacks[group] = {remove: remove, reset: reset, func: callback};
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
jsOMS.shuntingYard = function(equation)
|
||||
{
|
||||
const stack = [];
|
||||
const stack = [];
|
||||
const operators = {
|
||||
'^': {precedence: 4, order: 1},
|
||||
'/': {precedence: 3, order: -1},
|
||||
|
|
@ -46,36 +46,34 @@
|
|||
'+': {precedence: 2, order: -1},
|
||||
'-': {precedence: 2, order: -1},
|
||||
};
|
||||
let output = [];
|
||||
let output = [];
|
||||
|
||||
equation = equation.replace(/\s+/g, '');
|
||||
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());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,13 +15,13 @@
|
|||
|
||||
jsOMS.Message.Notification.NotificationManager = function()
|
||||
{
|
||||
this.appNotifier = new jsOMS.Message.Notification.App.AppNotification();
|
||||
this.appNotifier = new jsOMS.Message.Notification.App.AppNotification();
|
||||
this.browserNotifier = new jsOMS.Message.Notification.Browser.BrowserNotification();
|
||||
};
|
||||
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
"use strict";
|
||||
|
||||
jsOMS.Account = function () {
|
||||
this.login = '';
|
||||
this.login = '';
|
||||
this.password = '';
|
||||
this.id = 0;
|
||||
this.auth = null;
|
||||
this.id = 0;
|
||||
this.auth = null;
|
||||
};
|
||||
}(window.jsOMS = window.jsOMS || {}));
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
jsOMS.Module.ModuleManager = function (app)
|
||||
{
|
||||
this.modules = {};
|
||||
this.app = app;
|
||||
this.app = app;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@
|
|||
|
||||
jsOMS.Spreadsheet.Cell = function(id, raw)
|
||||
{
|
||||
this.id = id;
|
||||
this.raw = raw;
|
||||
this.formatting = raw.formatting;
|
||||
this.id = id;
|
||||
this.raw = raw;
|
||||
this.formatting = raw.formatting;
|
||||
};
|
||||
}(window.jsOMS = window.jsOMS || {}));
|
||||
|
|
@ -14,34 +14,34 @@
|
|||
|
||||
jsOMS.Spreadsheet.Spreadsheet = function(id, dataset, options)
|
||||
{
|
||||
this.spreadsheet = document.getElementById(id);
|
||||
this.title = '';
|
||||
this.sheets = [];
|
||||
this.columns = true;
|
||||
this.rows = true;
|
||||
this.dataset = [];
|
||||
this.compiledData = [];
|
||||
this.scroll = {h: false, v: false};
|
||||
this.spreadsheet = document.getElementById(id);
|
||||
this.title = '';
|
||||
this.sheets = [];
|
||||
this.columns = true;
|
||||
this.rows = true;
|
||||
this.dataset = [];
|
||||
this.compiledData = [];
|
||||
this.scroll = {h: false, v: false};
|
||||
};
|
||||
|
||||
jsOMS.SpreadSheet.prototype.draw = function()
|
||||
{
|
||||
let col = 0,
|
||||
row = 0,
|
||||
cRows = this.dataset.length(),
|
||||
cCols = 0;
|
||||
j = 0,
|
||||
this.compiledData = this.dataset;
|
||||
let col = 0,
|
||||
row = 0,
|
||||
cRows = this.dataset.length(),
|
||||
cCols = 0;
|
||||
j = 0,
|
||||
this.compiledData = this.dataset;
|
||||
|
||||
for(let i = 0; i < cRows; i++) {
|
||||
cCols = this.compiledData[i].length();
|
||||
for (let i = 0; i < cRows; i++) {
|
||||
cCols = this.compiledData[i].length();
|
||||
|
||||
for(j = 0; j < cCols; j++) {
|
||||
this.compiledData[i][j] = Functions.evaluate(this.compiledData[i][j], compiledData);
|
||||
for (j = 0; j < cCols; j++) {
|
||||
this.compiledData[i][j] = Functions.evaluate(this.compiledData[i][j], compiledData);
|
||||
|
||||
this.drawCell(this.compiledData[i][j]);
|
||||
}
|
||||
}
|
||||
this.drawCell(this.compiledData[i][j]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
jsOMS.SpreadSheet.prototype.drawCell = function()
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@
|
|||
jsOMS.UI.ActionManager.prototype.bind = function (id)
|
||||
{
|
||||
const uiElements = typeof id === 'undefined' ? document.querySelectorAll('[data-action]') : (typeof id.length !== 'undefined' ? id : [id]),
|
||||
length = uiElements.length;
|
||||
length = uiElements.length;
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
if (uiElements[i] !== null && uiElements[i].hasAttribute('data-action')) {
|
||||
|
|
@ -64,22 +64,22 @@
|
|||
*/
|
||||
jsOMS.UI.ActionManager.prototype.bindElement = function (e)
|
||||
{
|
||||
const listeners = JSON.parse(e.getAttribute('data-action')),
|
||||
const listeners = JSON.parse(e.getAttribute('data-action')),
|
||||
listenerLength = listeners.length,
|
||||
self = this;
|
||||
self = this;
|
||||
|
||||
// For everey action an event is registered
|
||||
for (let i = 0; i < listenerLength; i++) {
|
||||
let c = [e], hasSelector = false;
|
||||
|
||||
if(listeners[i].hasOwnProperty('selector')) {
|
||||
c = document.querySelectorAll(listeners[i].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,23 +88,22 @@
|
|||
// 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]);
|
||||
}
|
||||
|
||||
observeConfig.childList = true;
|
||||
observeConfig.subtree = true;
|
||||
observeConfig.subtree = true;
|
||||
});
|
||||
}
|
||||
|
||||
this.app.eventManager.attach(e.id + 'attributes', function(data) {});
|
||||
|
||||
this.app.uiManager.getDOMObserver().observe(e, observeConfig);
|
||||
}
|
||||
};
|
||||
|
|
@ -123,7 +122,7 @@
|
|||
*/
|
||||
jsOMS.UI.ActionManager.prototype.bindListener = function(e, listener)
|
||||
{
|
||||
const self = this,
|
||||
const self = this,
|
||||
actionLength = listener.action.length;
|
||||
|
||||
for (let j = 1; j < actionLength; j++) {
|
||||
|
|
@ -138,7 +137,7 @@
|
|||
// Register event for first action
|
||||
e.addEventListener(listener.listener, function (event)
|
||||
{
|
||||
if(listener.preventDefault) {
|
||||
if (listener.preventDefault) {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -73,8 +73,8 @@
|
|||
if (typeof id !== 'undefined' && typeof this.ignore[id] === 'undefined') {
|
||||
this.bindForm(id);
|
||||
} else {
|
||||
const forms = document.getElementsByTagName('form'),
|
||||
length = !forms ? 0 : forms.length;
|
||||
const forms = document.getElementsByTagName('form'),
|
||||
length = !forms ? 0 : forms.length;
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
if (typeof forms[i].getAttribute('id') !== 'undefined' && forms[i].getAttribute('id') !== null && typeof this.ignore[forms[i].getAttribute('id')] === 'undefined') {
|
||||
|
|
@ -98,15 +98,15 @@
|
|||
return;
|
||||
}
|
||||
|
||||
const self = this;
|
||||
const self = this;
|
||||
this.forms[id] = new jsOMS.Views.FormView(id);
|
||||
|
||||
this.unbind(id);
|
||||
|
||||
const submits = this.forms[id].getSubmit(),
|
||||
length = submits.length;
|
||||
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);
|
||||
|
|
@ -149,7 +149,7 @@
|
|||
jsOMS.UI.Component.Form.prototype.submit = function (form)
|
||||
{
|
||||
/* Handle injects */
|
||||
const self = this,
|
||||
const self = this,
|
||||
injects = form.getSubmitInjects();
|
||||
let counter = 0;
|
||||
|
||||
|
|
@ -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());
|
||||
}
|
||||
};
|
||||
|
|
@ -198,7 +198,7 @@
|
|||
|
||||
/* Handle default submit */
|
||||
const request = new jsOMS.Message.Request.Request(),
|
||||
self = this;
|
||||
self = this;
|
||||
|
||||
request.setData(form.getData());
|
||||
request.setType(jsOMS.Message.Response.ResponseType.JSON);
|
||||
|
|
@ -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();
|
||||
}
|
||||
});
|
||||
|
|
@ -111,7 +111,7 @@
|
|||
request.setSuccess(function (xhr)
|
||||
{
|
||||
try {
|
||||
const o = JSON.parse(xhr.response),
|
||||
const o = JSON.parse(xhr.response),
|
||||
response = new jsOMS.Message.Response(o),
|
||||
responseLength = response.count();
|
||||
let tempResponse = null,
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
if (typeof id !== 'undefined') {
|
||||
const e = document.getElementById(id);
|
||||
|
||||
if(e) {
|
||||
if (e) {
|
||||
this.bindElement();
|
||||
}
|
||||
} else {
|
||||
|
|
@ -66,7 +66,7 @@
|
|||
{
|
||||
/* Change Tab */
|
||||
const attr = this.getAttribute('href').substring(1),
|
||||
cont = this.parentNode.parentNode.parentNode.children[1];
|
||||
cont = this.parentNode.parentNode.parentNode.children[1];
|
||||
|
||||
jsOMS.removeClass(jsOMS.getByClass(this.parentNode.parentNode, 'active'), 'active');
|
||||
jsOMS.addClass(this.parentNode, 'active');
|
||||
|
|
|
|||
|
|
@ -36,12 +36,12 @@
|
|||
if (typeof id !== 'undefined') {
|
||||
const e = document.getElementById(id);
|
||||
|
||||
if(e) {
|
||||
if (e) {
|
||||
this.bindElement(e);
|
||||
}
|
||||
} else {
|
||||
const tables = document.getElementsByTagName('table'),
|
||||
length = !tables ? 0 : tables.length;
|
||||
length = !tables ? 0 : tables.length;
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
this.bindElement(tables[i]);
|
||||
|
|
|
|||
|
|
@ -20,9 +20,9 @@
|
|||
*/
|
||||
jsOMS.UI.DragNDrop = function (app)
|
||||
{
|
||||
this.app = app;
|
||||
this.draggable = {};
|
||||
this.dragging = null;
|
||||
this.app = app;
|
||||
this.draggable = {};
|
||||
this.dragging = null;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -49,7 +49,7 @@
|
|||
this.bindElement(id);
|
||||
} else {
|
||||
const elements = document.querySelectorAll('[draggable]'),
|
||||
length = !elements ? 0 : elements.length;
|
||||
length = !elements ? 0 : elements.length;
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
if (typeof elements[i].getAttribute('id') !== 'undefined' && elements[i].getAttribute('id') !== null) {
|
||||
|
|
@ -69,15 +69,15 @@
|
|||
jsOMS.UI.DragNDrop.prototype.bindElement = function (id)
|
||||
{
|
||||
const element = document.getElementById(id),
|
||||
self = this;
|
||||
self = this;
|
||||
|
||||
if(!element) {
|
||||
if (!element) {
|
||||
return;
|
||||
}
|
||||
|
||||
element.addEventListener('dragstart', function(e) {
|
||||
if(self.dragging === null) {
|
||||
self.dragging = this;
|
||||
if (self.dragging === null) {
|
||||
self.dragging = this;
|
||||
e.dataTransfer.effectAllowed = 'move';
|
||||
e.dataTransfer.setData('text/html', this.innerHTML);
|
||||
}
|
||||
|
|
@ -110,12 +110,12 @@
|
|||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
||||
if(self.dragging === this) {
|
||||
if (self.dragging === this) {
|
||||
return;
|
||||
}
|
||||
|
||||
self.dragging.innerHTML = this.innerHTML;
|
||||
this.innerHTML = e.dataTransfer.getData('text/html');
|
||||
this.innerHTML = e.dataTransfer.getData('text/html');
|
||||
|
||||
// todo: add to now destination
|
||||
// todo: remove from old destination
|
||||
|
|
|
|||
|
|
@ -55,10 +55,10 @@
|
|||
*/
|
||||
jsOMS.UI.GeneralUI.prototype.bindHref = function (e)
|
||||
{
|
||||
e = e !== null ? e.querySelectorAll('[data-href]') : document.querySelectorAll('[data-href]');
|
||||
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'));
|
||||
|
|
@ -77,11 +77,11 @@
|
|||
*/
|
||||
jsOMS.UI.GeneralUI.prototype.bindLazyLoad = function (e)
|
||||
{
|
||||
e = e !== null ? e.querySelectorAll('[data-lazyload]') : document.querySelectorAll('[data-lazyload]');
|
||||
e = e !== null ? e.querySelectorAll('[data-lazyload]') : document.querySelectorAll('[data-lazyload]');
|
||||
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 {
|
||||
|
|
|
|||
|
|
@ -84,10 +84,9 @@
|
|||
throw 'Unexpected elmenet!';
|
||||
}
|
||||
|
||||
const actions = this.elements[element],
|
||||
const actions = this.elements[element],
|
||||
length = actions.length,
|
||||
keyLength = this.down.length;
|
||||
|
||||
let match = false;
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@
|
|||
jsOMS.UI.Input.Mouse.MouseManager.prototype.bind = function (element, type)
|
||||
{
|
||||
const self = this,
|
||||
e = document.getElementById(element);
|
||||
e = document.getElementById(element);
|
||||
|
||||
if (!e) {
|
||||
return;
|
||||
|
|
@ -106,10 +106,12 @@
|
|||
}
|
||||
|
||||
const actions = this.elements[element],
|
||||
length = actions.length;
|
||||
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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,10 +48,10 @@
|
|||
*/
|
||||
jsOMS.UI.Input.Touch.TouchManager.prototype.add = function (surface)
|
||||
{
|
||||
const e = document.getElementById(surface),
|
||||
const e = document.getElementById(surface),
|
||||
self = this;
|
||||
|
||||
if(!e) {
|
||||
if (!e) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -73,7 +73,7 @@
|
|||
|
||||
e.addEventListener('touchend', function (event)
|
||||
{
|
||||
const touch = this.changedTouches[0],
|
||||
const touch = this.changedTouches[0],
|
||||
distX = touch.pageX - self.activeSwipe.startX,
|
||||
distY = touch.pageY - self.activeSwipe.startY,
|
||||
elapsedTime = new Date().getTime() - self.activeSwipe.time;
|
||||
|
|
|
|||
|
|
@ -33,15 +33,15 @@
|
|||
*/
|
||||
jsOMS.UI.Input.Voice.ReadManager = function (lang)
|
||||
{
|
||||
this.pitch = 1;
|
||||
this.rate = 1;
|
||||
this.lang = typeof lang === 'undefined' ? 'en-US' : lang;
|
||||
this.pitch = 1;
|
||||
this.rate = 1;
|
||||
this.lang = typeof lang === 'undefined' ? 'en-US' : lang;
|
||||
this.voices = [];
|
||||
this.voice = null;
|
||||
this.voice = null;
|
||||
|
||||
if(SpeechRecognition !== null) {
|
||||
if (SpeechRecognition !== null) {
|
||||
this.voices = window.speechSynthesis.getVoices();
|
||||
this.voice = this.voices[0];
|
||||
this.voice = this.voices[0];
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -57,11 +57,12 @@
|
|||
jsOMS.UI.Input.Voice.ReadManager.prototype.read = function(text)
|
||||
{
|
||||
/** global: SpeechSynthesisUtterance */
|
||||
let utter = new SpeechSynthesisUtterance(text);
|
||||
utter.lang = this.lang;
|
||||
let utter = new SpeechSynthesisUtterance(text);
|
||||
utter.lang = this.lang;
|
||||
utter.voice = this.voice;
|
||||
utter.pitch = this.pitch;
|
||||
utter.rate = this.rate;
|
||||
utter.rate = this.rate;
|
||||
|
||||
window.speechSynthesis.speak(utter);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -33,14 +33,14 @@
|
|||
*/
|
||||
jsOMS.UI.Input.Voice.VoiceManager = function (app, commands, lang)
|
||||
{
|
||||
this.app = app;
|
||||
this.commands = typeof commands === 'undefined' ? {} : commands;
|
||||
this.lang = typeof lang === 'undefined' ? 'en-US' : lang;
|
||||
this.recognition = null;
|
||||
this.app = app;
|
||||
this.commands = typeof commands === 'undefined' ? {} : commands;
|
||||
this.lang = typeof lang === 'undefined' ? 'en-US' : lang;
|
||||
this.recognition = null;
|
||||
this.speechRecognitionList = null;
|
||||
|
||||
if(SpeechRecognition !== null) {
|
||||
this.recognition = new SpeechRecognition();
|
||||
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;
|
||||
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;
|
||||
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.onstart = function() {};
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
12
Uri/Http.js
12
Uri/Http.js
|
|
@ -55,10 +55,10 @@
|
|||
{
|
||||
mode = typeof mode === 'undefined' ? 'php' : mode;
|
||||
|
||||
const key = ['source', 'scheme', 'authority', 'userInfo', 'user', 'pass', 'host', 'port',
|
||||
const key = ['source', 'scheme', 'authority', 'userInfo', 'user', 'pass', 'host', 'port',
|
||||
'relative', 'path', 'directory', 'file', 'query', 'fragment'
|
||||
],
|
||||
parser = {
|
||||
parser = {
|
||||
php: /^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?()(?:(()(?:(?:[^?#\/]*\/)*)()(?:[^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
|
||||
strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
|
||||
loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/\/?)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/ // Added one optional slash to post-scheme to catch file:/// (should restrict this)
|
||||
|
|
@ -68,7 +68,7 @@
|
|||
throw new Error('Unexpected parsing mode.', 'UriFactory', 52);
|
||||
}
|
||||
|
||||
const m = parser[mode].exec(str),
|
||||
const m = parser[mode].exec(str),
|
||||
uri = {};
|
||||
let i = 14;
|
||||
|
||||
|
|
@ -99,7 +99,7 @@
|
|||
{
|
||||
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
|
||||
|
||||
const regex = new RegExp("[\\?&]*" + name + "=([^&#]*)"),
|
||||
const regex = new RegExp("[\\?&]*" + name + "=([^&#]*)"),
|
||||
results = regex.exec(query);
|
||||
|
||||
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
|
||||
|
|
@ -118,7 +118,7 @@
|
|||
*/
|
||||
jsOMS.Uri.Http.getAllUriQueryParameters = function (query)
|
||||
{
|
||||
const params = {};
|
||||
const params = {};
|
||||
let keyValPairs = [],
|
||||
pairNum = null;
|
||||
|
||||
|
|
@ -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;
|
||||
|
|
@ -118,11 +118,11 @@
|
|||
*/
|
||||
jsOMS.Uri.UriFactory.clearLike = function(pattern)
|
||||
{
|
||||
let success = false;
|
||||
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;
|
||||
}
|
||||
|
|
@ -149,10 +149,10 @@
|
|||
const parts = url.split('?');
|
||||
|
||||
if (parts.length >= 2) {
|
||||
let full = parts[1],
|
||||
pars = full.split('&'),
|
||||
comps = {},
|
||||
spl = null,
|
||||
let full = parts[1],
|
||||
pars = full.split('&'),
|
||||
comps = {},
|
||||
spl = null,
|
||||
length = pars.length;
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
|
|
@ -194,7 +194,7 @@
|
|||
jsOMS.Uri.UriFactory.build = function (uri, toMatch)
|
||||
{
|
||||
const current = jsOMS.Uri.Http.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);
|
||||
|
||||
|
|
@ -205,7 +205,7 @@
|
|||
} else if (match.indexOf('#') === 0) {
|
||||
const e = document.getElementById(match.substr(1));
|
||||
|
||||
if(e) {
|
||||
if (e) {
|
||||
return e.value;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,10 +28,10 @@
|
|||
jsOMS.getArray = function(path, data, delim)
|
||||
{
|
||||
const pathParts = path.split(delim);
|
||||
let current = data;
|
||||
let current = data;
|
||||
|
||||
for(let key in pathParts) {
|
||||
if(!pathParts.hasOwnProperty(key)) {
|
||||
for (let key in pathParts) {
|
||||
if (!pathParts.hasOwnProperty(key)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -82,15 +82,15 @@
|
|||
* @since 1.0.0
|
||||
*/
|
||||
jsOMS.substr_count = function(str, substr) {
|
||||
str += '';
|
||||
str += '';
|
||||
substr += '';
|
||||
|
||||
if (substr.length <= 0) {
|
||||
return (str.length + 1);
|
||||
}
|
||||
|
||||
let n = 0,
|
||||
pos = 0,
|
||||
let n = 0,
|
||||
pos = 0,
|
||||
step = substr.length;
|
||||
|
||||
while (true) {
|
||||
|
|
@ -120,7 +120,7 @@
|
|||
*/
|
||||
jsOMS.hash = function (str)
|
||||
{
|
||||
let res = 0
|
||||
let res = 0
|
||||
const len = str.length;
|
||||
|
||||
for (let i = 0; i < len; i++) {
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@
|
|||
jsOMS.removeClass = function (ele, cls)
|
||||
{
|
||||
if (jsOMS.hasClass(ele, cls)) {
|
||||
const reg = new RegExp('(\\s|^)' + cls + '(\\s|$)');
|
||||
const reg = new RegExp('(\\s|^)' + cls + '(\\s|$)');
|
||||
ele.className = ele.className.replace(reg, '');
|
||||
}
|
||||
};
|
||||
|
|
@ -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"
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -28,14 +28,14 @@
|
|||
jsOMS.getArray = function(path, data, delim)
|
||||
{
|
||||
const pathParts = path.split(delim);
|
||||
let current = data;
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -115,15 +115,15 @@
|
|||
* @since 1.0.0
|
||||
*/
|
||||
jsOMS.substr_count = function(str, substr) {
|
||||
str += '';
|
||||
str += '';
|
||||
substr += '';
|
||||
|
||||
if (substr.length <= 0) {
|
||||
return (str.length + 1);
|
||||
}
|
||||
|
||||
let n = 0,
|
||||
pos = 0,
|
||||
let n = 0,
|
||||
pos = 0,
|
||||
step = substr.length;
|
||||
|
||||
while (true) {
|
||||
|
|
@ -193,7 +193,7 @@
|
|||
jsOMS.removeClass = function (ele, cls)
|
||||
{
|
||||
if (jsOMS.hasClass(ele, cls)) {
|
||||
const reg = new RegExp('(\\s|^)' + cls + '(\\s|$)');
|
||||
const reg = new RegExp('(\\s|^)' + cls + '(\\s|$)');
|
||||
ele.className = ele.className.replace(reg, '');
|
||||
}
|
||||
};
|
||||
|
|
@ -294,7 +294,7 @@
|
|||
*/
|
||||
jsOMS.hash = function (str)
|
||||
{
|
||||
let res = 0;
|
||||
let res = 0;
|
||||
const len = str.length;
|
||||
|
||||
for (let i = 0; i < len; i++) {
|
||||
|
|
@ -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,11 +129,11 @@
|
|||
{
|
||||
const form = document.getElementById(this.id);
|
||||
|
||||
if(!form) {
|
||||
if (!form) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const selects = form.getElementsByTagName('select'),
|
||||
const selects = form.getElementsByTagName('select'),
|
||||
textareas = form.getElementsByTagName('textarea'),
|
||||
inputs = form.getElementsByTagName('input'),
|
||||
canvas = form.getElementsByTagName('canvas'),
|
||||
|
|
@ -151,14 +151,14 @@
|
|||
*/
|
||||
jsOMS.Views.FormView.prototype.getData = function ()
|
||||
{
|
||||
const data = {},
|
||||
const data = {},
|
||||
elements = this.getFormElements(),
|
||||
length = elements.length;
|
||||
|
||||
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;
|
||||
|
|
@ -192,11 +192,15 @@
|
|||
jsOMS.Views.FormView.prototype.isValid = function ()
|
||||
{
|
||||
const elements = this.getFormElements(),
|
||||
length = elements.length;
|
||||
length = elements.length;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -276,7 +280,7 @@
|
|||
this.action = e.action;
|
||||
|
||||
const elements = this.getFormElements(),
|
||||
length = elements.length;
|
||||
length = elements.length;
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
switch (elements[i].tagName) {
|
||||
|
|
@ -305,7 +309,7 @@
|
|||
jsOMS.Views.FormView.prototype.unbind = function ()
|
||||
{
|
||||
const elements = this.getFormElements(),
|
||||
length = elements.length;
|
||||
length = elements.length;
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
switch (elements[i].tagName) {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
jsOMS.ViewAbstract = function ()
|
||||
{
|
||||
this.element = null;
|
||||
this.data = [];
|
||||
this.data = [];
|
||||
};
|
||||
|
||||
jsOMS.ViewAbstract.prototype.bind = function (node)
|
||||
|
|
@ -14,9 +14,9 @@
|
|||
|
||||
jsOMS.ViewAbstract.prototype.addData = function(id, data, overwrite)
|
||||
{
|
||||
overwrite = typeof overwrite !== 'undefined' ? overwrite : false;
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ describe('UriFactoryTest', function ()
|
|||
{
|
||||
it('Testing global queries', function ()
|
||||
{
|
||||
let uri = 'www.test-uri.com?id={@ID}&test={.mTest}&two={/path}&hash={#hash}&none=#none&found={/not}&v={/valid2}',
|
||||
let uri = 'www.test-uri.com?id={@ID}&test={.mTest}&two={/path}&hash={#hash}&none=#none&found={/not}&v={/valid2}',
|
||||
vars = {
|
||||
'@ID' : 1,
|
||||
'.mTest': 'someString',
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user