mirror of
https://github.com/Karaka-Management/jsOMS.git
synced 2026-02-15 16:58:42 +00:00
continue optimizing todos
This commit is contained in:
parent
3423761881
commit
61f2ea2693
|
|
@ -89,10 +89,6 @@ export class AssetManager
|
||||||
/** global: Image */
|
/** global: Image */
|
||||||
this.assets[hash] = new Image();
|
this.assets[hash] = new Image();
|
||||||
this.assets[hash].src = path;
|
this.assets[hash].src = path;
|
||||||
} else if (filetype === 'audio') {
|
|
||||||
// TODO: implement audio asset
|
|
||||||
} else if (filetype === 'video') {
|
|
||||||
// TODO: implement video asset
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (callback) {
|
if (callback) {
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,6 @@
|
||||||
+ "H" + (w0 + 1) * self.chart.cellSize + "Z";
|
+ "H" + (w0 + 1) * self.chart.cellSize + "Z";
|
||||||
});
|
});
|
||||||
|
|
||||||
// todo: fix the following data filter etc. this is way to much work and slow
|
|
||||||
rect.filter(function(d) {
|
rect.filter(function(d) {
|
||||||
let year = d.split('-')[0],
|
let year = d.split('-')[0],
|
||||||
length = self.chart.dataset.length;
|
length = self.chart.dataset.length;
|
||||||
|
|
|
||||||
|
|
@ -324,7 +324,6 @@
|
||||||
let div = this.chartSelect.append("div").attr("class", "charttooltip").style("opacity", 0);
|
let div = this.chartSelect.append("div").attr("class", "charttooltip").style("opacity", 0);
|
||||||
div.html(self.axis.x.label.text + ': ' + 100 + "<br/>" + self.axis.y.label.text + ': ' + 100);
|
div.html(self.axis.x.label.text + ': ' + 100 + "<br/>" + self.axis.y.label.text + ': ' + 100);
|
||||||
|
|
||||||
/* todo: allow also hover on charts without marker... not possible since hover only on marker and not on point? */
|
|
||||||
temp.on("mouseover", function (d)
|
temp.on("mouseover", function (d)
|
||||||
{
|
{
|
||||||
let dim = div.node().getBoundingClientRect();
|
let dim = div.node().getBoundingClientRect();
|
||||||
|
|
@ -396,7 +395,6 @@
|
||||||
|
|
||||||
// if no x axis available an element less will be drawn and the footer
|
// if no x axis available an element less will be drawn and the footer
|
||||||
// will be out of bounds.
|
// 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;
|
spacer = -this.margin.top;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -208,7 +208,6 @@
|
||||||
{
|
{
|
||||||
y.domain([yMin, yMax]);
|
y.domain([yMin, yMax]);
|
||||||
|
|
||||||
// todo: n is undefined !!!!
|
|
||||||
rect.transition()
|
rect.transition()
|
||||||
.duration(500)
|
.duration(500)
|
||||||
.delay(function (d, i)
|
.delay(function (d, i)
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,6 @@
|
||||||
dataPointEnter = temp[0];
|
dataPointEnter = temp[0];
|
||||||
dataPoint = temp[1];
|
dataPoint = temp[1];
|
||||||
|
|
||||||
// todo: create own legend drawing
|
|
||||||
this.chart.drawLegend(svg, dataPointEnter, dataPoint);
|
this.chart.drawLegend(svg, dataPointEnter, dataPoint);
|
||||||
this.chart.drawText(svg);
|
this.chart.drawText(svg);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,6 @@
|
||||||
length = data.length,
|
length = data.length,
|
||||||
add = 0;
|
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 };
|
dataset[0].points[i] = { name: data[i].name, y0: add, y: data[i].value + add };
|
||||||
add += data[i].value;
|
add += data[i].value;
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,6 @@
|
||||||
length = data.length,
|
length = data.length,
|
||||||
add = 0;
|
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 };
|
dataset[0].points[i] = { name: data[i].name, y0: add, y: data[i].value + add };
|
||||||
add += data[i].value;
|
add += data[i].value;
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,6 @@
|
||||||
length = data.length,
|
length = data.length,
|
||||||
add = 0;
|
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 };
|
dataset[0].points[i] = { name: data[i].name, y0: add, y: data[i].value + add };
|
||||||
add += data[i].value;
|
add += data[i].value;
|
||||||
|
|
|
||||||
|
|
@ -241,6 +241,20 @@ export class EventManager
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is a certain group allready attached
|
||||||
|
*
|
||||||
|
* @param {string|int} group Group id
|
||||||
|
*
|
||||||
|
* @return {boolean}
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
isAttached (group)
|
||||||
|
{
|
||||||
|
return this.callbacks.hasOwnProperty(group);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Count events
|
* Count events
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,11 @@ export class Logger
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.ui) {
|
if (this.ui) {
|
||||||
// todo: fill log box, set class and initiate animation
|
/**
|
||||||
|
* @todo Orange-Management/jsOMS#67
|
||||||
|
* Implement UI logging
|
||||||
|
* Create a dom element with inline css for UI logging.
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.remote) {
|
if (this.remote) {
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ export class AppNotification
|
||||||
output.querySelector('.log-msg-content').innerHTML = msg.message;
|
output.querySelector('.log-msg-content').innerHTML = msg.message;
|
||||||
|
|
||||||
tpl.parentNode.appendChild(output);
|
tpl.parentNode.appendChild(output);
|
||||||
|
window.navigator.vibrate(meg.vibrate ? 200 : 0);
|
||||||
|
|
||||||
setTimeout(function ()
|
setTimeout(function ()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -41,17 +41,9 @@ export class BrowserNotification
|
||||||
*/
|
*/
|
||||||
requestPermission ()
|
requestPermission ()
|
||||||
{
|
{
|
||||||
const self = this;
|
|
||||||
|
|
||||||
/** global: Notification */
|
/** global: Notification */
|
||||||
if (Notification.permission !== 'granted' && Notification.permission !== 'denied') {
|
if (Notification.permission !== 'granted' && Notification.permission !== 'denied') {
|
||||||
Notification.requestPermission(function(permission) {
|
Notification.requestPermission().then(function(permission) { });
|
||||||
if (permission === 'granted') {
|
|
||||||
let msg = new jsOMS.Message.Notification.NotificationMessage();
|
|
||||||
|
|
||||||
self.send(msg);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -66,8 +58,11 @@ export class BrowserNotification
|
||||||
*/
|
*/
|
||||||
send (msg)
|
send (msg)
|
||||||
{
|
{
|
||||||
// todo: implement
|
|
||||||
/** global: Notification */
|
/** global: Notification */
|
||||||
let n = new Notification(/* ... */);
|
if (Notification.permission === "granted") {
|
||||||
|
let notification = new Notification(msg.title, { body: msg.message, vibrate: [msg.vibrate ? 200 : 0] });
|
||||||
|
|
||||||
|
setTimeout(notification.close.bind(notification), 4000);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
@ -11,16 +11,18 @@ export class NotificationMessage
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
*
|
*
|
||||||
* @param {string} status Message status
|
* @param {string} status Message status
|
||||||
* @param {string} title Message title
|
* @param {string} title Message title
|
||||||
* @param {string} message Message content
|
* @param {string} message Message content
|
||||||
|
* @param {bool} [vibrate] Vibrate
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
constructor(status, title, message)
|
constructor(status, title, message, vibrate = false)
|
||||||
{
|
{
|
||||||
this.status = status;
|
this.status = status;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.message = message;
|
this.message = message;
|
||||||
|
this.vibrate = vibrate
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
@ -4,18 +4,15 @@
|
||||||
jsOMS.Autoloader.defineNamespace('jsOMS.Route');
|
jsOMS.Autoloader.defineNamespace('jsOMS.Route');
|
||||||
|
|
||||||
jsOMS.Route.Route = class {
|
jsOMS.Route.Route = class {
|
||||||
// TODO: create comments
|
|
||||||
constructor ()
|
constructor ()
|
||||||
{
|
{
|
||||||
this.routes = null;
|
this.routes = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: create comments
|
|
||||||
add (path, callback, exact)
|
add (path, callback, exact)
|
||||||
{
|
{
|
||||||
exact = typeof exact !== 'undefined' ? exact : true;
|
exact = typeof exact !== 'undefined' ? exact : true;
|
||||||
|
|
||||||
// todo: create array key path like i did for php
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}(window.jsOMS = window.jsOMS || {}));
|
}(window.jsOMS = window.jsOMS || {}));
|
||||||
|
|
|
||||||
|
|
@ -232,12 +232,9 @@ export class Form
|
||||||
*/
|
*/
|
||||||
unbindForm (id)
|
unbindForm (id)
|
||||||
{
|
{
|
||||||
// todo: do i need the findex? can't i just use id?
|
|
||||||
let findex = 0;
|
|
||||||
|
|
||||||
if ((findex = this.forms[id]) !== 'undefined') {
|
if ((findex = this.forms[id]) !== 'undefined') {
|
||||||
this.forms[id].unbind();
|
this.forms[id].unbind();
|
||||||
this.forms.splice(findex, 1);
|
this.forms.splice(id, 1);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -266,12 +263,13 @@ export class Form
|
||||||
injects = form.getSubmitInjects();
|
injects = form.getSubmitInjects();
|
||||||
let counter = 0;
|
let counter = 0;
|
||||||
|
|
||||||
// todo: test if attach necessary (maybe already attached in event manager)
|
|
||||||
// Register normal form behavior
|
// Register normal form behavior
|
||||||
this.app.eventManager.attach(form.getId(), function ()
|
if (!this.app.eventManager.isAttached(form.getId())) {
|
||||||
{
|
this.app.eventManager.attach(form.getId(), function ()
|
||||||
self.submitForm(form, action);
|
{
|
||||||
}, true);
|
self.submitForm(form, action);
|
||||||
|
}, true);
|
||||||
|
}
|
||||||
|
|
||||||
// Run all injects first
|
// Run all injects first
|
||||||
for (let property in injects) {
|
for (let property in injects) {
|
||||||
|
|
|
||||||
|
|
@ -2558,7 +2558,7 @@
|
||||||
clean(doc);
|
clean(doc);
|
||||||
|
|
||||||
// some stuff, like accidental reference links must now be escaped
|
// some stuff, like accidental reference links must now be escaped
|
||||||
// TODO
|
// todo
|
||||||
// doc.innerHTML = doc.innerHTML.replace(/\[[\S\t ]]/);
|
// doc.innerHTML = doc.innerHTML.replace(/\[[\S\t ]]/);
|
||||||
|
|
||||||
var nodes = doc.childNodes,
|
var nodes = doc.childNodes,
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@
|
||||||
*/
|
*/
|
||||||
jsOMS.ready = function (func)
|
jsOMS.ready = function (func)
|
||||||
{
|
{
|
||||||
// TODO: IE problems? + Maybe interactive + loaded can cause problems since elements might not be loaded yet?!!?!!?!
|
// todo: IE problems? + Maybe interactive + loaded can cause problems since elements might not be loaded yet?!!?!!?!
|
||||||
if (document.readyState === 'complete'
|
if (document.readyState === 'complete'
|
||||||
|| document.readyState === 'loaded'
|
|| document.readyState === 'loaded'
|
||||||
|| document.readyState === 'interactive'
|
|| document.readyState === 'interactive'
|
||||||
|
|
|
||||||
|
|
@ -276,7 +276,7 @@
|
||||||
*/
|
*/
|
||||||
jsOMS.ready = function (func)
|
jsOMS.ready = function (func)
|
||||||
{
|
{
|
||||||
// TODO: IE problems? + Maybe interactive + loaded can cause problems since elements might not be loaded yet?!!?!!?!
|
// todo: IE problems? + Maybe interactive + loaded can cause problems since elements might not be loaded yet?!!?!!?!
|
||||||
if (document.readyState === 'complete' || document.readyState === 'loaded' || document.readyState === 'interactive') {
|
if (document.readyState === 'complete' || document.readyState === 'loaded' || document.readyState === 'interactive') {
|
||||||
func();
|
func();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,6 @@ export class FormView
|
||||||
*/
|
*/
|
||||||
getSubmit ()
|
getSubmit ()
|
||||||
{
|
{
|
||||||
// todo: question, exclude save/remove button? maybe not because they also submit data right?
|
|
||||||
return document.querySelectorAll(
|
return document.querySelectorAll(
|
||||||
'#' + this.id + ' input[type=submit], '
|
'#' + this.id + ' input[type=submit], '
|
||||||
+ 'button[form=' + this.id + '][type=submit], '
|
+ 'button[form=' + this.id + '][type=submit], '
|
||||||
|
|
@ -133,7 +132,6 @@ export class FormView
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
getImagePreviews() {
|
getImagePreviews() {
|
||||||
// todo: question, exclude save/remove button? maybe not because they also submit data right?
|
|
||||||
return document.querySelectorAll(
|
return document.querySelectorAll(
|
||||||
'#' + this.id + ' input[type=file].preview'
|
'#' + this.id + ' input[type=file].preview'
|
||||||
);
|
);
|
||||||
|
|
@ -397,7 +395,15 @@ export class FormView
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create FormData
|
// Create FormData
|
||||||
/* todo: implement once we know how to handle this in the backend/php
|
/**
|
||||||
|
* @todo Orange-Management/Modules#202
|
||||||
|
* Consider to use FormData
|
||||||
|
* Form data is currently submitted in two steps if it contains media files.
|
||||||
|
* 1. Upload media data
|
||||||
|
* 2. Submit form data
|
||||||
|
* Consider to use `FormData` in order to submit media files and form data at the same time.
|
||||||
|
*/
|
||||||
|
/*
|
||||||
const formData = new FormData(),
|
const formData = new FormData(),
|
||||||
dataLength = data.length;
|
dataLength = data.length;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user