continue optimizing todos

This commit is contained in:
Dennis Eichhorn 2020-01-05 21:39:19 +01:00
parent 3423761881
commit 61f2ea2693
19 changed files with 51 additions and 46 deletions

View File

@ -89,10 +89,6 @@ export class AssetManager
/** global: Image */
this.assets[hash] = new Image();
this.assets[hash].src = path;
} else if (filetype === 'audio') {
// TODO: implement audio asset
} else if (filetype === 'video') {
// TODO: implement video asset
}
if (callback) {

View File

@ -81,7 +81,6 @@
+ "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) {
let year = d.split('-')[0],
length = self.chart.dataset.length;

View File

@ -324,7 +324,6 @@
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);
/* todo: allow also hover on charts without marker... not possible since hover only on marker and not on point? */
temp.on("mouseover", function (d)
{
let dim = div.node().getBoundingClientRect();
@ -396,7 +395,6 @@
// 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') {
spacer = -this.margin.top;
}

View File

@ -208,7 +208,6 @@
{
y.domain([yMin, yMax]);
// todo: n is undefined !!!!
rect.transition()
.duration(500)
.delay(function (d, i)

View File

@ -40,7 +40,6 @@
dataPointEnter = temp[0];
dataPoint = temp[1];
// todo: create own legend drawing
this.chart.drawLegend(svg, dataPointEnter, dataPoint);
this.chart.drawText(svg);

View File

@ -68,7 +68,6 @@
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) {
dataset[0].points[i] = { name: data[i].name, y0: add, y: data[i].value + add };
add += data[i].value;

View File

@ -69,7 +69,6 @@
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) {
dataset[0].points[i] = { name: data[i].name, y0: add, y: data[i].value + add };
add += data[i].value;

View File

@ -69,7 +69,6 @@
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) {
dataset[0].points[i] = { name: data[i].name, y0: add, y: data[i].value + add };
add += data[i].value;

View File

@ -241,6 +241,20 @@ export class EventManager
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
*

View File

@ -115,7 +115,11 @@ export class Logger
}
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) {

View File

@ -55,6 +55,7 @@ export class AppNotification
output.querySelector('.log-msg-content').innerHTML = msg.message;
tpl.parentNode.appendChild(output);
window.navigator.vibrate(meg.vibrate ? 200 : 0);
setTimeout(function ()
{

View File

@ -41,17 +41,9 @@ export class BrowserNotification
*/
requestPermission ()
{
const self = this;
/** global: Notification */
if (Notification.permission !== 'granted' && Notification.permission !== 'denied') {
Notification.requestPermission(function(permission) {
if (permission === 'granted') {
let msg = new jsOMS.Message.Notification.NotificationMessage();
self.send(msg);
}
});
Notification.requestPermission().then(function(permission) { });
}
};
@ -66,8 +58,11 @@ export class BrowserNotification
*/
send (msg)
{
// todo: implement
/** 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);
}
};
};

View File

@ -14,13 +14,15 @@ export class NotificationMessage
* @param {string} status Message status
* @param {string} title Message title
* @param {string} message Message content
* @param {bool} [vibrate] Vibrate
*
* @since 1.0.0
*/
constructor(status, title, message)
constructor(status, title, message, vibrate = false)
{
this.status = status;
this.title = title;
this.message = message;
this.vibrate = vibrate
};
};

View File

@ -4,18 +4,15 @@
jsOMS.Autoloader.defineNamespace('jsOMS.Route');
jsOMS.Route.Route = class {
// TODO: create comments
constructor ()
{
this.routes = null;
};
// TODO: create comments
add (path, callback, exact)
{
exact = typeof exact !== 'undefined' ? exact : true;
// todo: create array key path like i did for php
};
}
}(window.jsOMS = window.jsOMS || {}));

View File

@ -232,12 +232,9 @@ export class Form
*/
unbindForm (id)
{
// todo: do i need the findex? can't i just use id?
let findex = 0;
if ((findex = this.forms[id]) !== 'undefined') {
this.forms[id].unbind();
this.forms.splice(findex, 1);
this.forms.splice(id, 1);
return true;
}
@ -266,12 +263,13 @@ export class Form
injects = form.getSubmitInjects();
let counter = 0;
// todo: test if attach necessary (maybe already attached in event manager)
// Register normal form behavior
if (!this.app.eventManager.isAttached(form.getId())) {
this.app.eventManager.attach(form.getId(), function ()
{
self.submitForm(form, action);
}, true);
}
// Run all injects first
for (let property in injects) {

View File

@ -2558,7 +2558,7 @@
clean(doc);
// some stuff, like accidental reference links must now be escaped
// TODO
// todo
// doc.innerHTML = doc.innerHTML.replace(/\[[\S\t ]]/);
var nodes = doc.childNodes,

View File

@ -133,7 +133,7 @@
*/
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'

View File

@ -276,7 +276,7 @@
*/
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') {
func();
} else {

View File

@ -115,7 +115,6 @@ export class FormView
*/
getSubmit ()
{
// todo: question, exclude save/remove button? maybe not because they also submit data right?
return document.querySelectorAll(
'#' + this.id + ' input[type=submit], '
+ 'button[form=' + this.id + '][type=submit], '
@ -133,7 +132,6 @@ export class FormView
* @since 1.0.0
*/
getImagePreviews() {
// todo: question, exclude save/remove button? maybe not because they also submit data right?
return document.querySelectorAll(
'#' + this.id + ' input[type=file].preview'
);
@ -397,7 +395,15 @@ export class FormView
}
// 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(),
dataLength = data.length;