Improve increment

This commit is contained in:
Dennis Eichhorn 2018-02-10 21:41:27 +01:00
parent 35dd6f8e3f
commit 4eb521f3c4
23 changed files with 41 additions and 41 deletions

View File

@ -37,7 +37,7 @@
this.maxDistance = 70; this.maxDistance = 70;
this.gravitation = 10000000; this.gravitation = 10000000;
for (let i = 0; i < this.width * this.height / 3000; i++) { for (let i = 0; i < this.width * this.height / 3000; ++i) {
this.particles.push(new jsOMS.Animation.Canvas.Particle( this.particles.push(new jsOMS.Animation.Canvas.Particle(
Math.random() * this.width, Math.random() * this.width,
Math.random() * this.height, Math.random() * this.height,
@ -66,7 +66,7 @@
const length = self.particles.length; const length = self.particles.length;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; ++i) {
self.particles[i].draw(self.ctx); self.particles[i].draw(self.ctx);
} }
@ -109,7 +109,7 @@
const length = this.particles.length; const length = this.particles.length;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; ++i) {
particle = this.particles[i]; particle = this.particles[i];
pos = particle.getPosition(); pos = particle.getPosition();
vel = particle.getVelocity(); vel = particle.getVelocity();

View File

@ -39,7 +39,7 @@
this.assets = {}; this.assets = {};
for (let i = 0; i < length; i++) { for (let i = 0; i < length; ++i) {
this.assets[jsOMS.hash(scripts[i].src)] = scripts[i].src; this.assets[jsOMS.hash(scripts[i].src)] = scripts[i].src;
} }
}; };

View File

@ -36,7 +36,7 @@
const length = paths.length; const length = paths.length;
let current = jsOMS; let current = jsOMS;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; ++i) {
if (typeof current[paths[i]] === 'undefined') { if (typeof current[paths[i]] === 'undefined') {
current[paths[i]] = {}; current[paths[i]] = {};
} }
@ -58,7 +58,7 @@
const scripts = document.getElementsByTagName('script'), const scripts = document.getElementsByTagName('script'),
length = !scripts ? 0 : scripts.length; length = !scripts ? 0 : scripts.length;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; ++i) {
/** global: URL */ /** global: URL */
/** @var {string} URL */ /** @var {string} URL */
scripts[i].src.replace(URL + '/', ''); scripts[i].src.replace(URL + '/', '');
@ -95,7 +95,7 @@
{ {
const length = file.length; const length = file.length;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; ++i) {
if (jsOMS.Autoloader.loaded.indexOf(file) === -1) { if (jsOMS.Autoloader.loaded.indexOf(file) === -1) {
this.assetLoader.load(file, 'js'); this.assetLoader.load(file, 'js');

View File

@ -86,7 +86,7 @@
let year = d.split('-')[0], let year = d.split('-')[0],
length = self.chart.dataset.length; length = self.chart.dataset.length;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; ++i) {
if (self.chart.dataset[i].name != year) { if (self.chart.dataset[i].name != year) {
continue; continue;
} }
@ -108,7 +108,7 @@
let year = d.split('-')[0], let year = d.split('-')[0],
length = self.chart.dataset.length; length = self.chart.dataset.length;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; ++i) {
if (self.chart.dataset[i].name != year) { if (self.chart.dataset[i].name != year) {
continue; continue;
} }
@ -129,7 +129,7 @@
let year = d.split('-')[0], let year = d.split('-')[0],
length = self.chart.dataset.length; length = self.chart.dataset.length;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; ++i) {
if (self.chart.dataset[i].name != year) { if (self.chart.dataset[i].name != year) {
continue; continue;
} }

View File

@ -68,7 +68,7 @@
add = 0; add = 0;
// todo: remove value since positive and negative can be checked by looking at the diff of y-y0 // 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 }; dataset[0].points[i] = { name: data[i].name, y0: add, y: data[i].value + add };
add += data[i].value; add += data[i].value;
} }

View File

@ -54,7 +54,7 @@
visible: true visible: true
} }
}; };
this.chart.subtype = 'vwaterfall'; this.chart.subtype = 'vwaterfall';
}; };
@ -70,7 +70,7 @@
add = 0; add = 0;
// todo: remove value since positive and negative can be checked by looking at the diff of y-y0 // 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 }; dataset[0].points[i] = { name: data[i].name, y0: add, y: data[i].value + add };
add += data[i].value; add += data[i].value;
} }

View File

@ -70,7 +70,7 @@
add = 0; add = 0;
// todo: remove value since positive and negative can be checked by looking at the diff of y-y0 // 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 }; dataset[0].points[i] = { name: data[i].name, y0: add, y: data[i].value + add };
add += data[i].value; add += data[i].value;
} }

View File

@ -7,7 +7,7 @@
postfix = jsOMS.shuntingYard(equation); postfix = jsOMS.shuntingYard(equation);
length = postfix.length; 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])) { if (!isNaN(parseFloat(postfix[i])) && isFinite(postfix[i])) {
stack.push(postfix[i]); stack.push(postfix[i]);
} else { } else {
@ -52,7 +52,7 @@
equation = equation.split(/([\+\-\*\/\^\(\)])/).filter(function (n) { return n !== '' }); equation = equation.split(/([\+\-\*\/\^\(\)])/).filter(function (n) { return n !== '' });
let length = equation.length; let length = equation.length;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; ++i) {
let token = equation[i]; let token = equation[i];
if (!isNaN(parseFloat(token)) && isFinite(token)) { if (!isNaN(parseFloat(token)) && isFinite(token)) {

View File

@ -33,7 +33,7 @@
j = 0, j = 0,
this.compiledData = this.dataset; this.compiledData = this.dataset;
for (let i = 0; i < cRows; i++) { for (let i = 0; i < cRows; ++i) {
cCols = this.compiledData[i].length(); cCols = this.compiledData[i].length();
for (j = 0; j < cCols; j++) { for (j = 0; j < cCols; j++) {

View File

@ -44,7 +44,7 @@
const uiElements = typeof id === 'undefined' ? document.querySelectorAll('[data-action]') : (typeof id.length !== 'undefined' ? id : [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++) { for (let i = 0; i < length; ++i) {
if (uiElements[i] !== null && uiElements[i].hasAttribute('data-action')) { if (uiElements[i] !== null && uiElements[i].hasAttribute('data-action')) {
this.bindElement(uiElements[i]); this.bindElement(uiElements[i]);
} }
@ -69,7 +69,7 @@
self = this; self = this;
// For everey action an event is registered // For everey action an event is registered
for (let i = 0; i < listenerLength; i++) { for (let i = 0; i < listenerLength; ++i) {
let c = [e], hasSelector = false; let c = [e], hasSelector = false;
if (listeners[i].hasOwnProperty('selector')) { if (listeners[i].hasOwnProperty('selector')) {

View File

@ -76,7 +76,7 @@
const forms = document.getElementsByTagName('form'), const forms = document.getElementsByTagName('form'),
length = !forms ? 0 : forms.length; length = !forms ? 0 : forms.length;
for (let i = 0; i < length; i++) { 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') { if (typeof forms[i].getAttribute('id') !== 'undefined' && forms[i].getAttribute('id') !== null && typeof this.ignore[forms[i].getAttribute('id')] === 'undefined') {
this.bindForm(forms[i].getAttribute('id')); this.bindForm(forms[i].getAttribute('id'));
} }
@ -106,7 +106,7 @@
const submits = this.forms[id].getSubmit(), 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) submits[i].addEventListener('click', function (event)
{ {
jsOMS.preventAll(event); jsOMS.preventAll(event);

View File

@ -124,7 +124,7 @@
data = tempResponse.getData(), data = tempResponse.getData(),
length = data.length; length = data.length;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; ++i) {
option = document.createElement('option'); option = document.createElement('option');
option.value = tempResponse.value; option.value = tempResponse.value;
option.text = tempResponse.text; option.text = tempResponse.text;
@ -151,7 +151,7 @@
{ {
const length = datalist.options.length; const length = datalist.options.length;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; ++i) {
datalist.remove(0); datalist.remove(0);
} }
}; };

View File

@ -43,7 +43,7 @@
const tabs = document.querySelectorAll('.tabview'), const tabs = document.querySelectorAll('.tabview'),
length = !tabs ? 0 : tabs.length; length = !tabs ? 0 : tabs.length;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; ++i) {
this.bindElement(tabs[i]); this.bindElement(tabs[i]);
} }
} }

View File

@ -43,7 +43,7 @@
const tables = document.getElementsByTagName('table'), const tables = document.getElementsByTagName('table'),
length = !tables ? 0 : tables.length; length = !tables ? 0 : tables.length;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; ++i) {
this.bindElement(tables[i]); this.bindElement(tables[i]);
} }
} }

View File

@ -51,7 +51,7 @@
const elements = document.querySelectorAll('[draggable]'), const elements = document.querySelectorAll('[draggable]'),
length = !elements ? 0 : elements.length; length = !elements ? 0 : elements.length;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; ++i) {
if (typeof elements[i].getAttribute('id') !== 'undefined' && elements[i].getAttribute('id') !== null) { if (typeof elements[i].getAttribute('id') !== 'undefined' && elements[i].getAttribute('id') !== null) {
this.bindElement(elements[i].getAttribute('id')); this.bindElement(elements[i].getAttribute('id'));
} }

View File

@ -58,7 +58,7 @@
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; const length = e.length;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; ++i) {
e[i].addEventListener('click', function(event) { e[i].addEventListener('click', function(event) {
jsOMS.preventAll(event); jsOMS.preventAll(event);
window.location = jsOMS.Uri.UriFactory.build(this.getAttribute('data-href')); window.location = jsOMS.Uri.UriFactory.build(this.getAttribute('data-href'));
@ -93,7 +93,7 @@
}); });
} }
for (let i = 0; i < length; i++) { for (let i = 0; i < length; ++i) {
if (!this.visObs) { if (!this.visObs) {
e[i].src = e[i].dataset.lazyload; e[i].src = e[i].dataset.lazyload;
delete e[i].dataset.lazyload; delete e[i].dataset.lazyload;

View File

@ -89,7 +89,7 @@
keyLength = this.down.length; keyLength = this.down.length;
let match = false; let match = false;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; ++i) {
for (let j = 0; j < keyLength; j++) { for (let j = 0; j < keyLength; j++) {
if (actions[i].keys.indexOf(this.down[j]) === -1) { if (actions[i].keys.indexOf(this.down[j]) === -1) {
match = false; match = false;

View File

@ -108,7 +108,7 @@
const actions = this.elements[element], const actions = this.elements[element],
length = actions.length; length = actions.length;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; ++i) {
if ((!actions[i].exact || event.target.getAttribute('id') === element) if ((!actions[i].exact || event.target.getAttribute('id') === element)
&& actions[i].button === event.button && actions[i].button === event.button
) { ) {

View File

@ -155,7 +155,7 @@
spl = null, spl = null,
length = pars.length; length = pars.length;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; ++i) {
spl = pars[i].split('='); spl = pars[i].split('=');
comps[spl[0]] = spl[1]; comps[spl[0]] = spl[1];
} }

View File

@ -123,7 +123,7 @@
let res = 0 let res = 0
const len = str.length; const len = str.length;
for (let i = 0; i < len; i++) { for (let i = 0; i < len; ++i) {
res = res * 31 + str.charCodeAt(i); res = res * 31 + str.charCodeAt(i);
} }

View File

@ -194,7 +194,7 @@
{ {
const length = ele.childNodes.length; const length = ele.childNodes.length;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; ++i) {
if (jsOMS.hasClass(ele.childNodes[i], cls)) { if (jsOMS.hasClass(ele.childNodes[i], cls)) {
return ele.childNodes[i]; return ele.childNodes[i];
} }
@ -218,7 +218,7 @@
{ {
const length = e.length; const length = e.length;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; ++i) {
e[i].addEventListener(event, callback); e[i].addEventListener(event, callback);
} }
}; };

View File

@ -297,7 +297,7 @@
let res = 0; let res = 0;
const len = str.length; const len = str.length;
for (let i = 0; i < len; i++) { for (let i = 0; i < len; ++i) {
res = res * 31 + str.charCodeAt(i); res = res * 31 + str.charCodeAt(i);
} }
@ -364,7 +364,7 @@
{ {
const length = ele.childNodes.length; const length = ele.childNodes.length;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; ++i) {
if (jsOMS.hasClass(ele.childNodes[i], cls)) { if (jsOMS.hasClass(ele.childNodes[i], cls)) {
return ele.childNodes[i]; return ele.childNodes[i];
} }
@ -388,7 +388,7 @@
{ {
const length = e.length; const length = e.length;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; ++i) {
e[i].addEventListener(event, callback); e[i].addEventListener(event, callback);
} }
}; };

View File

@ -157,7 +157,7 @@
let value = null; let value = null;
for (let i = 0; i < length; i++) { 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'); value = elements[i].toDataURL('image/png');
} else { } else {
@ -195,7 +195,7 @@
length = elements.length; length = elements.length;
try { try {
for (let i = 0; i < length; i++) { for (let i = 0; i < length; ++i) {
if ((elements[i].required && elements[i].value === '') if ((elements[i].required && elements[i].value === '')
|| (typeof elements[i].pattern !== 'undefined' || (typeof elements[i].pattern !== 'undefined'
&& elements[i].pattern !== '' && elements[i].pattern !== ''
@ -282,7 +282,7 @@
const elements = this.getFormElements(), const elements = this.getFormElements(),
length = elements.length; length = elements.length;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; ++i) {
switch (elements[i].tagName) { switch (elements[i].tagName) {
case 'input': case 'input':
jsOMS.UI.Input.bind(elements[i]); jsOMS.UI.Input.bind(elements[i]);
@ -311,7 +311,7 @@
const elements = this.getFormElements(), const elements = this.getFormElements(),
length = elements.length; length = elements.length;
for (let i = 0; i < length; i++) { for (let i = 0; i < length; ++i) {
switch (elements[i].tagName) { switch (elements[i].tagName) {
case 'input': case 'input':
jsOMS.UI.Input.unbind(elements[i]); jsOMS.UI.Input.unbind(elements[i]);