Docblock and general minor cleanup

This commit is contained in:
Dennis Eichhorn 2018-12-29 11:55:32 +01:00
parent 97a693fe4b
commit b83b957740
43 changed files with 641 additions and 517 deletions

View File

@ -28,8 +28,6 @@
* *
* @return {int} * @return {int}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
getId () getId ()

View File

@ -28,7 +28,7 @@
* *
* @param {Object} account Account * @param {Object} account Account
* *
* @method * @return {void}
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -42,7 +42,7 @@
* *
* @param {int} id Account id * @param {int} id Account id
* *
* @method * @return {void}
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -64,8 +64,6 @@
* *
* @return {null|Object} * @return {null|Object}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
get (id) get (id)

View File

@ -29,8 +29,6 @@
* *
* @return {void} * @return {void}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
registerLoadedAssets () registerLoadedAssets ()
@ -54,8 +52,6 @@
* *
* @return {string|boolean} * @return {string|boolean}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
load (path, filetype, callback) load (path, filetype, callback)
@ -126,9 +122,7 @@
* *
* @param {string} key Key of the asset * @param {string} key Key of the asset
* *
* @return * @return {null|string}
*
* @method
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -150,8 +144,6 @@
* *
* @return {boolean} * @return {boolean}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
remove (key) remove (key)

View File

@ -16,6 +16,8 @@
/** /**
* @constructor * @constructor
* *
* @param {string} uri Login uri
*
* @since 1.0.0 * @since 1.0.0
*/ */
constructor (uri) constructor (uri)
@ -29,8 +31,6 @@
* *
* @param {Object} account Account * @param {Object} account Account
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
setAccount (account) setAccount (account)
@ -43,8 +43,6 @@
* *
* @return {Object} * @return {Object}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
getAccount () getAccount ()
@ -55,7 +53,7 @@
/** /**
* Login account. * Login account.
* *
* @method * @return {void}
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -78,7 +76,7 @@
/** /**
* Logout account. * Logout account.
* *
* @method * @return {void}
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -90,7 +88,7 @@
/** /**
* Handle login result. * Handle login result.
* *
* @method * @return {void}
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -3,7 +3,7 @@
* *
* The autoloader is responsible for defining namespaces and dynamically loading javascript * The autoloader is responsible for defining namespaces and dynamically loading javascript
* files that are not yet included. The intention is to provide a similar functionality as * files that are not yet included. The intention is to provide a similar functionality as
* include, import etc. Contrary to it's name the autoloader is not able to truely autoload * include, import etc. Contrary to it's name the autoloader is not able to truly autoload
* referenced classes. * referenced classes.
* *
* @copyright Dennis Eichhorn * @copyright Dennis Eichhorn
@ -25,6 +25,8 @@
* *
* @param {string} namespace Namespace * @param {string} namespace Namespace
* *
* @return {void}
*
* @since 1.0.0 * @since 1.0.0
*/ */
jsOMS.Autoloader.defineNamespace = function (namespace) jsOMS.Autoloader.defineNamespace = function (namespace)
@ -51,6 +53,8 @@
/** /**
* Collect all loaded javascript files * Collect all loaded javascript files
* *
* @return {void}
*
* @since 1.0.0 * @since 1.0.0
*/ */
jsOMS.Autoloader.initPreloaded = function () jsOMS.Autoloader.initPreloaded = function ()
@ -74,6 +78,8 @@
* *
* @param {string} file Script URI * @param {string} file Script URI
* *
* @return {void}
*
* @since 1.0.0 * @since 1.0.0
*/ */
jsOMS.Autoloader.addPreloaded = function (file) jsOMS.Autoloader.addPreloaded = function (file)
@ -89,6 +95,8 @@
* @param {string} file Script URI * @param {string} file Script URI
* @param {function} callback Callback after script loading * @param {function} callback Callback after script loading
* *
* @return {void}
*
* @since 1.0.0 * @since 1.0.0
*/ */
jsOMS.Autoloader.include = function (file, callback) jsOMS.Autoloader.include = function (file, callback)

View File

@ -36,8 +36,6 @@
* *
* @return {boolean} * @return {boolean}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
set (key, value, overwrite = false) set (key, value, overwrite = false)
@ -58,8 +56,6 @@
* *
* @return {boolean|int|float|string|Array} * @return {boolean|int|float|string|Array}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
get (key) get (key)
@ -78,8 +74,6 @@
* *
* @return {boolean} * @return {boolean}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
remove (key) remove (key)

View File

@ -27,8 +27,6 @@
* *
* @return {boolean} * @return {boolean}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
static available() static available()

View File

@ -35,7 +35,7 @@
* @param {string|int} group Group id * @param {string|int} group Group id
* @param {string|int} id Event id * @param {string|int} id Event id
* *
* @method * @return {void}
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -55,8 +55,6 @@
* *
* @return {void} * @return {void}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
reset (group) reset (group)
@ -75,8 +73,6 @@
* *
* @return {boolean} * @return {boolean}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
hasOutstanding (group) hasOutstanding (group)
@ -105,8 +101,6 @@
* *
* @return {boolean} * @return {boolean}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
trigger (group, id = '', data = null) trigger (group, id = '', data = null)
@ -141,8 +135,6 @@
* *
* @return {boolean} * @return {boolean}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
triggerSingleEvent (group, id = '', data = null) triggerSingleEvent (group, id = '', data = null)
@ -182,8 +174,6 @@
* *
* @return {void} * @return {void}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
detach (group) detach (group)
@ -198,8 +188,6 @@
* *
* @return {void} * @return {void}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
detachCallback(group) detachCallback(group)
@ -220,8 +208,6 @@
* *
* @return {void} * @return {void}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
detachGroup(group) detachGroup(group)
@ -245,8 +231,6 @@
* *
* @return {boolean} * @return {boolean}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
attach (group, callback, remove = false, reset = false) attach (group, callback, remove = false, reset = false)
@ -265,8 +249,6 @@
* *
* @return {int} * @return {int}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
count () count ()

View File

@ -38,8 +38,6 @@
* *
* @return {Object} * @return {Object}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
static getInstance (verbose = true, ui = true, remote = false) static getInstance (verbose = true, ui = true, remote = false)
@ -60,8 +58,6 @@
* *
* @return {string} * @return {string}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
interpolate (message, context, level) interpolate (message, context, level)
@ -86,8 +82,6 @@
* *
* @return {Object} * @return {Object}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
createContext (message, context, level) createContext (message, context, level)
@ -112,8 +106,6 @@
* *
* @return {void} * @return {void}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
write (message, context, level) write (message, context, level)
@ -142,8 +134,6 @@
* *
* @return {void} * @return {void}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
writeVerbose (message, context, level) writeVerbose (message, context, level)
@ -183,8 +173,6 @@
* *
* @return {void} * @return {void}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
writeRemote (message, context, level) writeRemote (message, context, level)
@ -209,8 +197,6 @@
* *
* @return {void} * @return {void}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
emergency (message, context = {}) emergency (message, context = {})
@ -226,8 +212,6 @@
* *
* @return {void} * @return {void}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
alert (message, context = {}) alert (message, context = {})
@ -243,8 +227,6 @@
* *
* @return {void} * @return {void}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
critical (message, context = {}) critical (message, context = {})
@ -260,8 +242,6 @@
* *
* @return {void} * @return {void}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
error (message, context = {}) error (message, context = {})
@ -277,8 +257,6 @@
* *
* @return {void} * @return {void}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
warning (message, context = {}) warning (message, context = {})
@ -294,8 +272,6 @@
* *
* @return {void} * @return {void}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
notice (message, context = {}) notice (message, context = {})
@ -311,8 +287,6 @@
* *
* @return {void} * @return {void}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
info (message, context = {}) info (message, context = {})
@ -328,8 +302,6 @@
* *
* @return {void} * @return {void}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
debug (message, context = {}) debug (message, context = {})
@ -346,8 +318,6 @@
* *
* @return {void} * @return {void}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
log (level, message, context = {}) log (level, message, context = {})
@ -363,8 +333,6 @@
* *
* @return {void} * @return {void}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
console (message, context = {}) console (message, context = {})

View File

@ -9,6 +9,15 @@
(function (jsOMS) { (function (jsOMS) {
"use strict"; "use strict";
/**
* Evaluate math formula
*
* @param {string} equation Equation
*
* @return {null|float|int}
*
* @since 1.0.0
*/
jsOMS.mathEvaluate = function(equation) jsOMS.mathEvaluate = function(equation)
{ {
const stack = [], const stack = [],
@ -41,11 +50,29 @@
return !isNaN(parseFloat(result)) && isFinite(result) ? result : null; return !isNaN(parseFloat(result)) && isFinite(result) ? result : null;
}; };
/**
* Parse value
*
* @param {string} value Value to parse
*
* @return {float|int}
*
* @since 1.0.0
*/
jsOMS.parseValue = function(value) jsOMS.parseValue = function(value)
{ {
return typeof value === 'string' ? (value.indexOf('.') === -1 ? parseInt(value) : parseFloat(value)) : value; return typeof value === 'string' ? (value.indexOf('.') === -1 ? parseInt(value) : parseFloat(value)) : value;
} }
/**
* Perform shunting yard
*
* @param {string} value Value to parse
*
* @return {Array}
*
* @since 1.0.0
*/
jsOMS.shuntingYard = function(equation) jsOMS.shuntingYard = function(equation)
{ {
const stack = []; const stack = [];

View File

@ -14,16 +14,39 @@
jsOMS.Autoloader.defineNamespace('jsOMS.Message.Notification.App'); jsOMS.Autoloader.defineNamespace('jsOMS.Message.Notification.App');
jsOMS.Message.Notification.App.AppNotification = class { jsOMS.Message.Notification.App.AppNotification = class {
/**
* @constructor
*
* @since 1.0.0
*/
constructor () constructor ()
{ {
this.status = 0; this.status = 0;
}; };
/**
* Set notification status.
*
* @param {int} status Notification status
*
* @return {void}
*
* @since 1.0.0
*/
setStatus (status) setStatus (status)
{ {
this.status = status; this.status = status;
}; };
/**
* Create notification
*
* @param {Object} msg Notification
*
* @return {void}
*
* @since 1.0.0
*/
send (msg) send (msg)
{ {
const tpl = document.getElementById('app-message'); const tpl = document.getElementById('app-message');

View File

@ -14,16 +14,37 @@
jsOMS.Autoloader.defineNamespace('jsOMS.Message.Notification.Browser'); jsOMS.Autoloader.defineNamespace('jsOMS.Message.Notification.Browser');
jsOMS.Message.Notification.Browser.BrowserNotification = class { jsOMS.Message.Notification.Browser.BrowserNotification = class {
/**
* @constructor
*
* @since 1.0.0
*/
constructor() constructor()
{ {
this.status = 0; this.status = 0;
}; };
/**
* Set notification status.
*
* @param {int} status Notification status
*
* @return {void}
*
* @since 1.0.0
*/
setStatus (status) setStatus (status)
{ {
this.status = status; this.status = status;
}; };
/**
* Ask for browser permission to create notifications
*
* @return {void}
*
* @since 1.0.0
*/
requestPermission () requestPermission ()
{ {
const self = this; const self = this;
@ -40,8 +61,18 @@
} }
}; };
/**
* Create notification
*
* @param {Object} msg Notification
*
* @return {void}
*
* @since 1.0.0
*/
send (msg) send (msg)
{ {
// todo: implement
/** global: Notification */ /** global: Notification */
let n = new Notification(/* ... */); let n = new Notification(/* ... */);
}; };

View File

@ -1,5 +1,5 @@
/** /**
* Browser notification. * Notification manager.
* *
* @copyright Dennis Eichhorn * @copyright Dennis Eichhorn
* @license OMS License 1.0 * @license OMS License 1.0
@ -14,12 +14,27 @@
jsOMS.Autoloader.defineNamespace('jsOMS.Message.Notification'); jsOMS.Autoloader.defineNamespace('jsOMS.Message.Notification');
jsOMS.Message.Notification.NotificationManager = class { jsOMS.Message.Notification.NotificationManager = class {
/**
* @constructor
*
* @since 1.0.0
*/
constructor() constructor()
{ {
this.appNotifier = new jsOMS.Message.Notification.App.AppNotification(); this.appNotifier = new jsOMS.Message.Notification.App.AppNotification();
this.browserNotifier = new jsOMS.Message.Notification.Browser.BrowserNotification(); this.browserNotifier = new jsOMS.Message.Notification.Browser.BrowserNotification();
}; };
/**
* Create notification.
*
* @param {Object} message Message object
* @param {int} type Notification type
*
* @return {void}
*
* @since 1.0.0
*/
send (message, type) send (message, type)
{ {
if (jsOMS.Message.Notification.NotificationType.APP_NOTIFICATION === type) { if (jsOMS.Message.Notification.NotificationType.APP_NOTIFICATION === type) {
@ -29,11 +44,25 @@
} }
}; };
/**
* Get the app notification manager.
*
* @return {Object}
*
* @since 1.0.0
*/
getAppNotifier () getAppNotifier ()
{ {
return this.appNotifier; return this.appNotifier;
}; };
/**
* Get the browser notification manager.
*
* @return {Object}
*
* @since 1.0.0
*/
getBrowserNotifier () getBrowserNotifier ()
{ {
return this.browserNotifier; return this.browserNotifier;

View File

@ -13,6 +13,15 @@
jsOMS.Autoloader.defineNamespace('jsOMS.Message.Notification'); jsOMS.Autoloader.defineNamespace('jsOMS.Message.Notification');
jsOMS.Message.Notification.NotificationMessage = class { jsOMS.Message.Notification.NotificationMessage = class {
/**
* @constructor
*
* @param {string} status Message status
* @param {string} title Message title
* @param {string} message Message content
*
* @since 1.0.0
*/
constructor(status, title, message) constructor(status, title, message)
{ {
this.status = status; this.status = status;

View File

@ -17,6 +17,10 @@
/** /**
* @constructor * @constructor
* *
* @param {string} uri Request uri
* @param {string} method Request method/verb
* @param {string} type Request content type
*
* @since 1.0.0 * @since 1.0.0
*/ */
constructor (uri = null, method, type) constructor (uri = null, method, type)
@ -44,8 +48,6 @@
* *
* @return {string} * @return {string}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
setContentTypeBasedOnType(type) setContentTypeBasedOnType(type)
@ -67,8 +69,6 @@
* *
* @return {string} * @return {string}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
static getBrowser() static getBrowser()
@ -99,8 +99,6 @@
* *
* @return {string} * @return {string}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
static getOS() static getOS()
@ -124,7 +122,7 @@
* *
* @param {string} method Method type * @param {string} method Method type
* *
* @method * @return {void}
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -140,8 +138,6 @@
* *
* @return {string} * @return {string}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
getMethod() getMethod()
@ -156,7 +152,7 @@
* *
* @param {string} type Method type * @param {string} type Method type
* *
* @method * @return {void}
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -172,8 +168,6 @@
* *
* @return {string} * @return {string}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
getResponseType() getResponseType()
@ -187,7 +181,7 @@
* @param {string} type Request type * @param {string} type Request type
* @param {string} header Request header * @param {string} header Request header
* *
* @method * @return {void}
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -201,8 +195,6 @@
* *
* @return {Array} * @return {Array}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
getRequestHeader() getRequestHeader()
@ -215,7 +207,7 @@
* *
* @param {string} uri Request uri * @param {string} uri Request uri
* *
* @method * @return {void}
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -229,8 +221,6 @@
* *
* @return {string} * @return {string}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
getUri() getUri()
@ -241,10 +231,9 @@
/** /**
* Set success callback. * Set success callback.
* *
* @callback requestCallback
* @param {requestCallback} callback - Success callback * @param {requestCallback} callback - Success callback
* *
* @method * @return {void}
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -259,7 +248,7 @@
* @param {int} status Http response status * @param {int} status Http response status
* @param {function} callback Callback * @param {function} callback Callback
* *
* @method * @return {void}
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -273,7 +262,7 @@
* *
* @param {Array} data Request data * @param {Array} data Request data
* *
* @method * @return {void}
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -287,8 +276,6 @@
* *
* @return {Array} * @return {Array}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
getData() getData()
@ -303,7 +290,7 @@
* *
* @param {string} type Method type * @param {string} type Method type
* *
* @method * @return {void}
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -320,8 +307,6 @@
* *
* @return {string} * @return {string}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
getType() getType()
@ -334,8 +319,6 @@
* *
* @return {string} * @return {string}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
queryfy(obj) queryfy(obj)
@ -355,8 +338,6 @@
* *
* @return {Array} * @return {Array}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
send() send()

View File

@ -16,16 +16,39 @@
jsOMS.Autoloader.defineNamespace('jsOMS.Message.Response'); jsOMS.Autoloader.defineNamespace('jsOMS.Message.Response');
jsOMS.Message.Response.Response = class { jsOMS.Message.Response.Response = class {
/**
* @constructor
*
* @param {mixed} data Response data
*
* @since 1.0.0
*/
constructor (data) constructor (data)
{ {
this.responses = data; this.responses = data;
}; };
/**
* Get response by id.
*
* @param {string} id Response id
*
* @return {mixed}
*
* @since 1.0.0
*/
get (id) get (id)
{ {
return this.responses[id]; return this.responses[id];
}; };
/**
* Count the amount of responses.
*
* @return {int}
*
* @since 1.0.0
*/
count () count ()
{ {
return this.responses.length; return this.responses.length;

View File

@ -35,7 +35,7 @@
* @param {requestCallback} message Callback for message * @param {requestCallback} message Callback for message
* @param {string} [request] Request id in order to only handle a specific request * @param {string} [request] Request id in order to only handle a specific request
* *
* @method * @return {void}
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -58,7 +58,7 @@
* @param {Array|Object} data Date to use in callback * @param {Array|Object} data Date to use in callback
* @param {jsOMS.Message.Request.Request} [request] Request id for request specific execution * @param {jsOMS.Message.Request.Request} [request] Request id for request specific execution
* *
* @method * @return {void}
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -30,8 +30,6 @@
* *
* @return {Object} * @return {Object}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
static getInstance (module, app) static getInstance (module, app)

View File

@ -17,6 +17,8 @@
/** /**
* @constructor * @constructor
* *
* @param {Object} app Application
*
* @since 1.0.0 * @since 1.0.0
*/ */
constructor(app) constructor(app)
@ -32,8 +34,6 @@
* *
* @return {Object} * @return {Object}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
get (module) get (module)

View File

View File

View File

@ -1,5 +1,5 @@
/** /**
* Form manager class. * Action manager class.
* *
* @copyright Dennis Eichhorn * @copyright Dennis Eichhorn
* @license OMS License 1.0 * @license OMS License 1.0
@ -11,18 +11,17 @@
"use strict"; "use strict";
/** @namespace jsOMS.UI */ /** @namespace jsOMS.UI */
jsOMS.Autoloader.defineNamespace('jsOMS.UI'); jsOMS.Autoloader.defineNamespace('jsOMS.UI.ActionManager');
jsOMS.UI.ActionManager = class {
/** /**
* Constructor * @constructor
* *
* @param {Object} app Application * @param {Object} app Application
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
jsOMS.UI.ActionManager = function (app) constructor(app)
{ {
this.app = app; this.app = app;
this.actions = {}; this.actions = {};
@ -35,11 +34,9 @@
* *
* @return {void} * @return {void}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
jsOMS.UI.ActionManager.prototype.bind = function (id) bind(id)
{ {
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;
@ -58,11 +55,9 @@
* *
* @return {void} * @return {void}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
jsOMS.UI.ActionManager.prototype.bindElement = function (e) bindElement (e)
{ {
if (!jsOMS.isValidJson(e.getAttribute('data-action'))) { if (!jsOMS.isValidJson(e.getAttribute('data-action'))) {
jsOMS.Log.Logger.instance.error('Invalid json string: \'' + e.getAttribute('data-action') + '\''); jsOMS.Log.Logger.instance.error('Invalid json string: \'' + e.getAttribute('data-action') + '\'');
@ -123,11 +118,9 @@
* *
* @return {void} * @return {void}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
jsOMS.UI.ActionManager.prototype.bindListener = function(id, listener, removable = false) bindListener (id, listener, removable = false)
{ {
const self = this, const self = this,
actionLength = listener.action.length; actionLength = listener.action.length;
@ -167,11 +160,9 @@
* *
* @return {void} * @return {void}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
jsOMS.UI.ActionManager.prototype.runAction = function (id, listener, action, data) runAction (id, listener, action, data)
{ {
const self = this; const self = this;
@ -196,12 +187,11 @@
* *
* @return {void} * @return {void}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
jsOMS.UI.ActionManager.prototype.add = function (name, callback) add (name, callback)
{ {
this.actions[name] = callback; this.actions[name] = callback;
}; };
}
}(window.jsOMS = window.jsOMS || {})); }(window.jsOMS = window.jsOMS || {}));

View File

@ -17,6 +17,8 @@
/** /**
* @constructor * @constructor
* *
* @param {Object} app Application
*
* @since 1.0.0 * @since 1.0.0
*/ */
constructor (app) constructor (app)
@ -31,6 +33,8 @@
* *
* @param {string} id Form Id * @param {string} id Form Id
* *
* @return {void}
*
* @since 1.0.0 * @since 1.0.0
*/ */
get (id) get (id)
@ -43,6 +47,8 @@
* *
* @param {string} id Form Id * @param {string} id Form Id
* *
* @return {boolean}
*
* @since 1.0.0 * @since 1.0.0
*/ */
isIgnored (id) isIgnored (id)
@ -55,6 +61,8 @@
* *
* @param {string} id Form Id * @param {string} id Form Id
* *
* @return {void}
*
* @since 1.0.0 * @since 1.0.0
*/ */
unbind (id) unbind (id)
@ -67,6 +75,8 @@
* *
* @param {string} id Form Id (optional) * @param {string} id Form Id (optional)
* *
* @return {void}
*
* @since 1.0.0 * @since 1.0.0
*/ */
bind (id) bind (id)
@ -91,6 +101,8 @@
* *
* @param {string} id Form Id * @param {string} id Form Id
* *
* @return {void}
*
* @since 1.0.0 * @since 1.0.0
*/ */
bindForm (id) bindForm (id)
@ -122,6 +134,8 @@
* *
* @param {string} id Form Id * @param {string} id Form Id
* *
* @return {boolean}
*
* @since 1.0.0 * @since 1.0.0
*/ */
unbindForm (id) unbindForm (id)
@ -146,6 +160,8 @@
* *
* @param {Object} form Form object * @param {Object} form Form object
* *
* @return {void}
*
* @since 1.0.0 * @since 1.0.0
*/ */
submit (form) submit (form)
@ -189,6 +205,8 @@
* *
* @param {Object} form Form object * @param {Object} form Form object
* *
* @return {void}
*
* @since 1.0.0 * @since 1.0.0
*/ */
submitForm (form) submitForm (form)
@ -267,7 +285,7 @@
/** /**
* Count the bound forms * Count the bound forms
* *
* @return {number} * @return {int}
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -19,6 +19,8 @@
* *
* @param {Object} input Input element * @param {Object} input Input element
* *
* @return {void}
*
* @since 1.0.0 * @since 1.0.0
*/ */
static unbind = function (input) static unbind = function (input)
@ -29,9 +31,11 @@
}; };
/** /**
* Bind input elment * Bind input element
* *
* @param {Object} input Input elment * @param {Object} input Input element
*
* @return {void}
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -94,8 +98,10 @@
* *
* This only applies for datalists that have remote options * This only applies for datalists that have remote options
* *
* @param {Object} input Input elment * @param {Object} input Input element
* @param {Object} datalist Datalist elment * @param {Object} datalist Datalist element
*
* @return {void}
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -144,7 +150,9 @@
/** /**
* Remove all datalist options from datalist * Remove all datalist options from datalist
* *
* @param {Object} datalist Datalist elment * @param {Object} datalist Datalist element
*
* @return {void}
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -18,9 +18,8 @@
* *
* @since 1.0.0 * @since 1.0.0
*/ */
constructor (responseManager) constructor ()
{ {
this.responseManager = responseManager;
}; };
/** /**
@ -28,7 +27,7 @@
* *
* @param {string} [id] Element id * @param {string} [id] Element id
* *
* @method * @return {void}
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -38,7 +37,7 @@
const e = document.getElementById(id); const e = document.getElementById(id);
if (e) { if (e) {
this.bindElement(); this.bindElement(e);
} }
} else { } else {
const tabs = document.querySelectorAll('.tabview'), const tabs = document.querySelectorAll('.tabview'),
@ -53,9 +52,9 @@
/** /**
* Bind & rebind UI element. * Bind & rebind UI element.
* *
* @param {Object} [e] Element id * @param {Object} e Element id
* *
* @method * @return {void}
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -16,6 +16,8 @@
/** /**
* @constructor * @constructor
* *
* @param {Object} app Application
*
* @since 1.0.0 * @since 1.0.0
*/ */
constructor(app) constructor(app)
@ -30,7 +32,7 @@
* *
* @param {string} [id] Element id * @param {string} [id] Element id
* *
* @method * @return {void}
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -56,6 +58,8 @@
* *
* @param {string} id Table Id * @param {string} id Table Id
* *
* @return {void}
*
* @since 1.0.0 * @since 1.0.0
*/ */
unbind (id) unbind (id)
@ -68,7 +72,7 @@
* *
* @param {Object} [id] Element id * @param {Object} [id] Element id
* *
* @method * @return {void}
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -113,6 +117,16 @@
} }
}; };
/**
* Removes the closest row on click.
*
* @param {Element} remove Remove button
* @param {Object} id Element id
*
* @return {void}
*
* @since 1.0.0
*/
bindRemovable(remove, id) bindRemovable(remove, id)
{ {
remove.addEventListener('click', function (event) remove.addEventListener('click', function (event)
@ -123,6 +137,16 @@
}); });
}; };
/**
* Swaps the row on click.
*
* @param {Element} sorting Swap button
* @param {Object} id Element id
*
* @return {void}
*
* @since 1.0.0
*/
bindReorder(sorting, id) bindReorder(sorting, id)
{ {
sorting.addEventListener('click', function (event) sorting.addEventListener('click', function (event)
@ -143,6 +167,16 @@
}); });
}; };
/**
* Sorts the table.
*
* @param {Element} sorting Sort button
* @param {Object} id Table id
*
* @return {void}
*
* @since 1.0.0
*/
bindSorting(sorting, id) bindSorting(sorting, id)
{ {
sorting.addEventListener('click', function (event) sorting.addEventListener('click', function (event)
@ -193,6 +227,16 @@
}); });
}; };
/**
* Filters the table.
*
* @param {Element} filtering Filter button
* @param {Object} id Table id
*
* @return {void}
*
* @since 1.0.0
*/
bindFiltering(filtering, id) bindFiltering(filtering, id)
{ {
filtering.addEventListener('click', function (event) filtering.addEventListener('click', function (event)

View File

@ -31,6 +31,8 @@
* *
* @param {Object} element DOM element * @param {Object} element DOM element
* *
* @return {void}
*
* @since 1.0.0 * @since 1.0.0
*/ */
unbind (element) unbind (element)
@ -42,6 +44,8 @@
* *
* @param {Object} id DOM element * @param {Object} id DOM element
* *
* @return {void}
*
* @since 1.0.0 * @since 1.0.0
*/ */
bind (id) bind (id)
@ -63,7 +67,9 @@
/** /**
* Bind DOM elment * Bind DOM elment
* *
* @param {string} id DOM elment * @param {string} id DOM element
*
* @return {void}
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -29,7 +29,7 @@
* *
* @param {string} [id] Button id (optional) * @param {string} [id] Button id (optional)
* *
* @method * @return {void}
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -49,7 +49,7 @@
* *
* @param {Object} [e] Element id * @param {Object} [e] Element id
* *
* @method * @return {void}
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -71,7 +71,7 @@
* *
* @param {Object} [e] Element id * @param {Object} [e] Element id
* *
* @method * @return {void}
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -32,6 +32,8 @@
* @param {Array} keys Keyboard keys * @param {Array} keys Keyboard keys
* @param {callback} callback Callback * @param {callback} callback Callback
* *
* @return {void}
*
* @since 1.0.0 * @since 1.0.0
*/ */
add (element, keys, callback) add (element, keys, callback)
@ -50,6 +52,8 @@
* *
* @param {string} element Container id * @param {string} element Container id
* *
* @return {void}
*
* @since 1.0.0 * @since 1.0.0
*/ */
bind (element) bind (element)
@ -77,6 +81,10 @@
* @param {string} element Container id * @param {string} element Container id
* @param {Object} event Key event * @param {Object} event Key event
* *
* @return {void}
*
* @throws {Error}
*
* @since 1.0.0 * @since 1.0.0
*/ */
run (element, event) run (element, event)

View File

@ -34,6 +34,8 @@
* @param {callback} callback Callback * @param {callback} callback Callback
* @param {bool} exact ??? todo: can't remember why this was important oO!!! * @param {bool} exact ??? todo: can't remember why this was important oO!!!
* *
* @return {void}
*
* @since 1.0.0 * @since 1.0.0
*/ */
add (element, type, button, callback, exact) add (element, type, button, callback, exact)
@ -52,6 +54,8 @@
* @param {string} element Element id * @param {string} element Element id
* @param {int} type Action type * @param {int} type Action type
* *
* @return {void}
*
* @since 1.0.0 * @since 1.0.0
*/ */
bind (element, type) bind (element, type)
@ -98,6 +102,8 @@
* @param {string} element Element id * @param {string} element Element id
* @param {Object} event Click event * @param {Object} event Click event
* *
* @return {void}
*
* @since 1.0.0 * @since 1.0.0
*/ */
run (element, event) run (element, event)

View File

@ -33,6 +33,8 @@
* *
* This is called in between swipes in order to reset previous swipe data. * This is called in between swipes in order to reset previous swipe data.
* *
* @return {void}
*
* @since 1.0.0 * @since 1.0.0
*/ */
resetSwipe () resetSwipe ()
@ -43,7 +45,9 @@
/** /**
* Adding swipe functionality. * Adding swipe functionality.
* *
* Forwarding swipe to arrow keyes. * Forwarding swipe to arrow keys.
*
* @return {void}
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -30,6 +30,8 @@
/** /**
* @constructor * @constructor
* *
* @param {string} lang Localization
*
* @since 1.0.0 * @since 1.0.0
*/ */
constructor (lang = 'en-US') constructor (lang = 'en-US')

View File

@ -30,6 +30,10 @@
/** /**
* @constructor * @constructor
* *
* @param {Object} app Application
* @param {Object} commands Available commands
* @param {string} lang Localization
*
* @since 1.0.0 * @since 1.0.0
*/ */
constructor(app, commands = {}, lang = 'en-US') constructor(app, commands = {}, lang = 'en-US')
@ -49,7 +53,7 @@
/** /**
* Setup or re-initialize voice manager. * Setup or re-initialize voice manager.
* *
* @method * @return {void}
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -25,7 +25,7 @@
{ {
this.app = app; this.app = app;
this.formManager = new jsOMS.UI.Component.Form(this.app); this.formManager = new jsOMS.UI.Component.Form(this.app);
this.tabManager = new jsOMS.UI.Component.Tab(this.app.responseManager); this.tabManager = new jsOMS.UI.Component.Tab();
this.tableManager = new jsOMS.UI.Component.Table(this.app); this.tableManager = new jsOMS.UI.Component.Table(this.app);
this.actionManager = new jsOMS.UI.ActionManager(this.app); this.actionManager = new jsOMS.UI.ActionManager(this.app);
this.dragNDrop = new jsOMS.UI.DragNDrop(this.app); this.dragNDrop = new jsOMS.UI.DragNDrop(this.app);
@ -47,7 +47,7 @@
* *
* @param {string} [id] Element id * @param {string} [id] Element id
* *
* @method * @return {void}
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -86,8 +86,6 @@
* *
* @return {Object} * @return {Object}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
getFormManager() getFormManager()
@ -100,8 +98,6 @@
* *
* @return {Object} * @return {Object}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
getActionManager() getActionManager()
@ -114,8 +110,6 @@
* *
* @return {Object} * @return {Object}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
getDragNDrop() getDragNDrop()
@ -128,8 +122,6 @@
* *
* @return {Object} * @return {Object}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
getTabManager() getTabManager()
@ -142,8 +134,6 @@
* *
* @return {Object} * @return {Object}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
getTableManager() getTableManager()
@ -156,8 +146,6 @@
* *
* @return {Object} * @return {Object}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
getDOMObserver() getDOMObserver()
@ -170,8 +158,6 @@
* *
* @return {Object} * @return {Object}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
getGeneralUI() getGeneralUI()

View File

@ -1,7 +1,7 @@
/** /**
* Http Uri. * Http Uri.
* *
* This class is for creating, modifying and analysing http uris. * This class is for creating, modifying and analyzing http uris.
* *
* @copyright Dennis Eichhorn * @copyright Dennis Eichhorn
* @license OMS License 1.0 * @license OMS License 1.0
@ -48,8 +48,6 @@
* *
* @throws {Error} * @throws {Error}
* *
* @function
*
* @since 1.0.0 * @since 1.0.0
*/ */
static parseUrl (str, mode = 'php') static parseUrl (str, mode = 'php')
@ -90,8 +88,6 @@
* *
* @return {null|string} * @return {null|string}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
static getUriQueryParameter (query, name) static getUriQueryParameter (query, name)
@ -111,8 +107,6 @@
* *
* @return {Object} * @return {Object}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
static getAllUriQueryParameters (query) static getAllUriQueryParameters (query)
@ -153,8 +147,6 @@
* *
* @return {void} * @return {void}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
set (uri) set (uri)
@ -191,8 +183,6 @@
* *
* @return {void} * @return {void}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
setRootPath(rootPath) setRootPath(rootPath)
@ -206,8 +196,6 @@
* *
* @return {string} * @return {string}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
getBase() getBase()
@ -220,8 +208,6 @@
* *
* @return {string} * @return {string}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
getScheme() getScheme()
@ -234,8 +220,6 @@
* *
* @return {string} * @return {string}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
getHost() getHost()
@ -248,8 +232,6 @@
* *
* @return {string} * @return {string}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
getPort() getPort()
@ -262,8 +244,6 @@
* *
* @return {string} * @return {string}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
getUser() getUser()
@ -276,8 +256,6 @@
* *
* @return {string} * @return {string}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
getPass() getPass()
@ -290,8 +268,6 @@
* *
* @return {string} * @return {string}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
getQuery() getQuery()
@ -304,8 +280,6 @@
* *
* @return {string} * @return {string}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
getUri() getUri()
@ -318,8 +292,6 @@
* *
* @return {string} * @return {string}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
getFragment() getFragment()
@ -332,8 +304,6 @@
* *
* @return {string} * @return {string}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
getPath() getPath()
@ -346,8 +316,6 @@
* *
* @return {int} * @return {int}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
getPathOffset() getPathOffset()

View File

@ -23,8 +23,6 @@
* *
* @return {boolean} * @return {boolean}
* *
* @function
*
* @since 1.0.0 * @since 1.0.0
*/ */
static setQuery (key, value, overwrite) static setQuery (key, value, overwrite)
@ -47,8 +45,6 @@
* *
* @return {null|string} * @return {null|string}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
static getQuery (key) static getQuery (key)
@ -61,8 +57,6 @@
* *
* @return {boolean} * @return {boolean}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
static clearAll () static clearAll ()
@ -79,8 +73,6 @@
* *
* @return {boolean} * @return {boolean}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
static clear (key) static clear (key)
@ -101,8 +93,6 @@
* *
* @return {boolean} * @return {boolean}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
static clearLike (pattern) static clearLike (pattern)
@ -129,8 +119,6 @@
* *
* @return {string} * @return {string}
* *
* @function
*
* @since 1.0.0 * @since 1.0.0
*/ */
static unique (url) static unique (url)
@ -177,7 +165,7 @@
* @param {string} uri Raw uri * @param {string} uri Raw uri
* @param {Object} [toMatch] Key/value pair to replace in raw * @param {Object} [toMatch] Key/value pair to replace in raw
* *
* @function * @return {string}
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -216,9 +204,7 @@
parsed = parsed.replace('&', '?'); parsed = parsed.replace('&', '?');
} }
parsed = jsOMS.Uri.UriFactory.unique(parsed); return jsOMS.Uri.UriFactory.unique(parsed);
return parsed;
}; };
/** /**
@ -226,8 +212,6 @@
* *
* @return {void} * @return {void}
* *
* @method
*
* @since 1.0.0 * @since 1.0.0
*/ */
static setupUriBuilder (uri) static setupUriBuilder (uri)

View File

@ -19,9 +19,7 @@
* @param {Object} data Object * @param {Object} data Object
* @param {string} delim Path delimiter * @param {string} delim Path delimiter
* *
* @return * @return {mixed}
*
* @function
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -17,7 +17,7 @@
* *
* Used to fire event after delay * Used to fire event after delay
* *
* @function * @return {callback}
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -37,9 +37,7 @@
* @param target Target array * @param target Target array
* @param source Source array * @param source Source array
* *
* @return Array * @return {Array}
*
* @function
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -75,6 +73,15 @@
return obj; return obj;
}; };
/**
* Check if a value/variable is set
*
* @param variable Variable to check for existence.
*
* @return {boolean}
*
* @since 1.0.0
*/
jsOMS.isset = function (variable) jsOMS.isset = function (variable)
{ {
return typeof variable !== 'undefined' && variable !== null; return typeof variable !== 'undefined' && variable !== null;

View File

@ -20,8 +20,6 @@
* *
* @return {string} * @return {string}
* *
* @function
*
* @since 1.0.0 * @since 1.0.0
*/ */
jsOMS.trim = function(str, char = ' ') jsOMS.trim = function(str, char = ' ')
@ -37,8 +35,6 @@
* *
* @return {string} * @return {string}
* *
* @function
*
* @since 1.0.0 * @since 1.0.0
*/ */
jsOMS.rtrim = function(str, char = ' ') jsOMS.rtrim = function(str, char = ' ')
@ -54,8 +50,6 @@
* *
* @return {string} * @return {string}
* *
* @function
*
* @since 1.0.0 * @since 1.0.0
*/ */
jsOMS.ltrim = function(str, char = ' ') jsOMS.ltrim = function(str, char = ' ')
@ -68,7 +62,7 @@
* *
* @param {string} jsonString String to validate * @param {string} jsonString String to validate
* *
* @function * @return {boolean}
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -90,8 +84,6 @@
* *
* @return {int} * @return {int}
* *
* @function
*
* @since 1.0.0 * @since 1.0.0
*/ */
jsOMS.substr_count = function(str, substr) { jsOMS.substr_count = function(str, substr) {
@ -128,8 +120,6 @@
* *
* @return {int} * @return {int}
* *
* @function
*
* @since 1.0.0 * @since 1.0.0
*/ */
jsOMS.hash = function (str) jsOMS.hash = function (str)
@ -144,6 +134,16 @@
return res; return res;
}; };
/**
* Get the remaining string after finding a certain char
*
* @param {string} haystack String to to search in
* @param {array} chars Chars to search for
*
* @return {string}
*
* @since 1.0.0
*/
jsOMS.strpbrk = function (haystack, chars) jsOMS.strpbrk = function (haystack, chars)
{ {
const length = chars.length; const length = chars.length;
@ -159,6 +159,16 @@
return haystack.slice(min); return haystack.slice(min);
}; };
/**
* Encodes special html characters
*
* @param {string} text String to encode
* @param {boolean} quotes Should quotes be allowed
*
* @return {string}
*
* @since 1.0.0
*/
jsOMS.htmlspecialchars = function (text, quotes) { jsOMS.htmlspecialchars = function (text, quotes) {
let map = { let map = {
'&': '&', '&': '&',

View File

@ -22,8 +22,6 @@
* *
* @return {boolean} * @return {boolean}
* *
* @function
*
* @since 1.0.0 * @since 1.0.0
*/ */
jsOMS.hasClass = function (ele, cls) jsOMS.hasClass = function (ele, cls)
@ -42,7 +40,7 @@
* @param ele DOM Element * @param ele DOM Element
* @param cls Class to add * @param cls Class to add
* *
* @function * @return {void}
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -61,7 +59,7 @@
* @param ele DOM Element * @param ele DOM Element
* @param cls Class to remove * @param cls Class to remove
* *
* @function * @return {void}
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -76,11 +74,11 @@
/** /**
* Action prevent * Action prevent
* *
* Preventing event from firering and passing through * Preventing event from firing and passing through
* *
* @param event Event Event to stop * @param event Event Event to stop
* *
* @function * @return {void}
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -100,9 +98,9 @@
* *
* Invoking a function after page load * Invoking a function after page load
* *
* @param func Callback function * @param {callback} func Callback function
* *
* @function * @return {void}
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -129,7 +127,7 @@
* *
* @param ele DOM Element * @param ele DOM Element
* *
* @function * @return {void}
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -149,8 +147,6 @@
* *
* @return {boolean} * @return {boolean}
* *
* @function
*
* @since 1.0.0 * @since 1.0.0
*/ */
jsOMS.isNode = function (ele) jsOMS.isNode = function (ele)
@ -170,8 +166,6 @@
* *
* @return {boolean} * @return {boolean}
* *
* @function
*
* @since 1.0.0 * @since 1.0.0
*/ */
jsOMS.isElement = function (o) jsOMS.isElement = function (o)
@ -190,9 +184,7 @@
* @param ele DOM Element * @param ele DOM Element
* @param cls Class to find * @param cls Class to find
* *
* @return Element * @return {Element}
*
* @function
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -216,7 +208,7 @@
* @param {string} event Event name * @param {string} event Event name
* @param {function} callback Event callback * @param {function} callback Event callback
* *
* @function * @return {void}
* *
* @since 1.0.0 * @since 1.0.0
*/ */

View File

@ -40,6 +40,8 @@
* *
* Pulled out since this is used in a cleanup process * Pulled out since this is used in a cleanup process
* *
* @return {void}
*
* @since 1.0.0 * @since 1.0.0
*/ */
initializeMembers () initializeMembers ()
@ -73,11 +75,25 @@
return this.action; return this.action;
}; };
/**
* Get time of last submit
*
* @return {int}
*
* @since 1.0.0
*/
getLastSubmit () getLastSubmit ()
{ {
return this.lastSubmit; return this.lastSubmit;
}; };
/**
* Update last submit time
*
* @return {void}
*
* @since 1.0.0
*/
updateLastSubmit () updateLastSubmit ()
{ {
this.lastSubmit = Math.floor(Date.now()); this.lastSubmit = Math.floor(Date.now());
@ -116,6 +132,8 @@
* *
* @param {callback} callback Callback * @param {callback} callback Callback
* *
* @return {void}
*
* @since 1.0.0 * @since 1.0.0
*/ */
setSuccess (callback) setSuccess (callback)
@ -128,6 +146,8 @@
* *
* @param {callback} callback Callback * @param {callback} callback Callback
* *
* @return {void}
*
* @since 1.0.0 * @since 1.0.0
*/ */
injectSubmit (callback) injectSubmit (callback)
@ -321,6 +341,8 @@
/** /**
* Bind form * Bind form
* *
* @return {void}
*
* @since 1.0.0 * @since 1.0.0
*/ */
bind () bind ()
@ -361,6 +383,8 @@
/** /**
* Unbind form * Unbind form
* *
* @return {void}
*
* @since 1.0.0 * @since 1.0.0
*/ */
unbind () unbind ()
@ -390,6 +414,8 @@
/** /**
* Clean form * Clean form
* *
* @return {void}
*
* @since 1.0.0 * @since 1.0.0
*/ */
clean () clean ()

View File

@ -1,24 +1,44 @@
/**
* Table view.
*
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS) { (function (jsOMS) {
"use strict"; "use strict";
jsOMS.Autoloader.defineNamespace('jsOMS.Views'); jsOMS.Autoloader.defineNamespace('jsOMS.Views');
jsOMS.Views.TableView = class { jsOMS.Views.TableView = class {
/**
* @constructor
*
* @since 1.0.0
*/
constructor (id) { constructor (id) {
this.id = id; this.id = id;
this.bind(); this.bind();
}; };
/**
* Bind the table
*
* @return {void}
*
* @since 1.0.0
*/
bind () bind ()
{ {
const e = document.getElementById(this.id); const e = document.getElementById(this.id);
}; };
/** /**
* Get sorting elements * Get table header elements which provide sorting
* *
* @return {Object} * @return {array}
* *
* @since 1.0.0 * @since 1.0.0
*/ */
@ -30,6 +50,27 @@
); );
}; };
/**
* Get table header elements which provide filter functionality
*
* @return {array}
*
* @since 1.0.0
*/
getFilter()
{
return document.querySelectorAll(
'#' + this.id + ' thead .filter'
);
};
/**
* Get row elements which allow to swap the current row with another row
*
* @return {array}
*
* @since 1.0.0
*/
getSortableRows() getSortableRows()
{ {
return document.querySelectorAll( return document.querySelectorAll(
@ -38,18 +79,18 @@
); );
}; };
/**
* Get row elements which allow to remove a row element
*
* @return {array}
*
* @since 1.0.0
*/
getRemovable() getRemovable()
{ {
return document.querySelectorAll( return document.querySelectorAll(
'#' + this.id + ' tbody .remove' '#' + this.id + ' tbody .remove'
); );
}; };
getFilter()
{
return document.querySelectorAll(
'#' + this.id + ' thead .filter'
);
};
} }
}(window.jsOMS = window.jsOMS || {})); }(window.jsOMS = window.jsOMS || {}));

View File

@ -1,34 +0,0 @@
(function (jsOMS) {
"use strict";
jsOMS.ViewAbstract = class {
constructor ()
{
this.element = null;
this.data = [];
};
bind (node)
{
this.element = node;
};
addData(id, data, overwrite)
{
overwrite = typeof overwrite !== 'undefined' ? overwrite : false;
if (typeof this.data[id] === 'undefined' || overwrite) {
this.data[id] = data;
return true;
}
return false;
};
getData(id)
{
return typeof this.data[id] !== 'undefined' ? this.data[id] : undefined;
};
}
}(window.jsOMS = window.jsOMS || {}));