Implement class keyword instead of prototype

This commit is contained in:
Dennis Eichhorn 2018-04-25 22:38:23 +02:00
parent a5474c68cb
commit 5b305db3d2
42 changed files with 4099 additions and 4017 deletions

View File

@ -12,12 +12,14 @@
jsOMS.Autoloader.defineNamespace('jsOMS.Account');
jsOMS.Account.AccountManager = class {
/**
* @constructor
*
* @since 1.0.0
*/
jsOMS.Account.AccountManager = function ()
constructor ()
{
this.accounts = [];
};
@ -31,7 +33,7 @@
*
* @since 1.0.0
*/
jsOMS.Account.AccountManager.prototype.add = function (account)
add (account)
{
this.accounts[account.getId()] = account;
};
@ -45,7 +47,7 @@
*
* @since 1.0.0
*/
jsOMS.Account.AccountManager.prototype.remove = function (id)
remove (id)
{
if (typeof this.accounts[id] !== 'undefined') {
delete this.accounts[id];
@ -67,7 +69,7 @@
*
* @since 1.0.0
*/
jsOMS.Account.AccountManager.prototype.get = function (id)
get (id)
{
if (this.accounts[id]) {
return this.accounts[id];
@ -75,4 +77,5 @@
return undefined;
};
}
}(window.jsOMS = window.jsOMS || {}));

View File

@ -13,12 +13,13 @@
/** @namespace jsOMS.Animation.Canvas */
jsOMS.Autoloader.defineNamespace('jsOMS.Animation.Canvas');
jsOMS.Animation.Canvas.Particle = class {
/**
* @constructor
*
* @since 1.0.0
*/
jsOMS.Animation.Canvas.Particle = function (posX, posY, velX, velY, radius)
constructor (posX, posY, velX, velY, radius)
{
this.posX = posX;
this.posY = posY;
@ -39,7 +40,7 @@
*
* @since 1.0.0
*/
jsOMS.Animation.Canvas.Particle.prototype.getRadius = function ()
getRadius ()
{
return this.radius;
};
@ -56,7 +57,7 @@
*
* @since 1.0.0
*/
jsOMS.Animation.Canvas.Particle.prototype.setPosition = function (posX, posY)
setPosition (posX, posY)
{
this.posX = posX;
this.posY = posY;
@ -71,7 +72,7 @@
*
* @since 1.0.0
*/
jsOMS.Animation.Canvas.Particle.prototype.getPosition = function ()
getPosition ()
{
return {x: this.posX, y: this.posY};
};
@ -88,7 +89,7 @@
*
* @since 1.0.0
*/
jsOMS.Animation.Canvas.Particle.prototype.setVelocity = function (velX, velY)
setVelocity (velX, velY)
{
this.velX = velX;
this.velY = velY;
@ -103,7 +104,7 @@
*
* @since 1.0.0
*/
jsOMS.Animation.Canvas.Particle.prototype.getVelocity = function ()
getVelocity ()
{
return {x: this.velX, y: this.velY};
};
@ -119,11 +120,12 @@
*
* @since 1.0.0
*/
jsOMS.Animation.Canvas.Particle.prototype.draw = function (ctx)
draw (ctx)
{
ctx.fillStyle = 'rgba(' + this.color.r + ', ' + this.color.g + ', ' + this.color.b + ', ' + this.color.a + ')';
ctx.beginPath();
ctx.arc(this.posX, this.posY, this.radius, 0, Math.PI * 2, false);
ctx.fill();
};
}
}(window.jsOMS = window.jsOMS || {}));

View File

@ -13,6 +13,7 @@
/** @namespace jsOMS.Animation.Canvas */
jsOMS.Autoloader.defineNamespace('jsOMS.Animation.Canvas');
jsOMS.Animation.Canvas.ParticleAnimation = class {
/**
*
* @param {object} canvas Canvas
@ -21,7 +22,7 @@
*
* @since 1.0.0
*/
jsOMS.Animation.Canvas.ParticleAnimation = function (canvas)
constructor (canvas)
{
this.canvas = canvas;
this.ctx = canvas.getContext('2d');
@ -59,7 +60,7 @@
*
* @since 1.0.0
*/
jsOMS.Animation.Canvas.ParticleAnimation.prototype.draw = function (self)
draw (self)
{
self = typeof self !== 'undefined' ? self : this;
self.invalidate();
@ -86,7 +87,7 @@
*
* @since 1.0.0
*/
jsOMS.Animation.Canvas.ParticleAnimation.prototype.invalidate = function ()
invalidate ()
{
this.ctx.clearRect(0, 0, this.width, this.height);
};
@ -100,7 +101,7 @@
*
* @since 1.0.0
*/
jsOMS.Animation.Canvas.ParticleAnimation.prototype.updateParticles = function ()
updateParticles ()
{
let particle,
pos,
@ -152,7 +153,7 @@
*
* @since 1.0.0
*/
jsOMS.Animation.Canvas.ParticleAnimation.prototype.updateDistance = function (p1, p2)
updateDistance (p1, p2)
{
const pos1 = p1.getPosition(),
pos2 = p2.getPosition(),
@ -185,4 +186,5 @@
p2.setVelocity(vel2.x, vel2.y);
}
};
}
}(window.jsOMS = window.jsOMS || {}));

View File

@ -12,12 +12,13 @@
jsOMS.Asset = {};
jsOMS.Asset.AssetManager = class {
/**
* @constructor
*
* @since 1.0.0
*/
jsOMS.Asset.AssetManager = function ()
constructor ()
{
this.assets = {};
this.registerLoadedAssets();
@ -32,7 +33,7 @@
*
* @since 1.0.0
*/
jsOMS.Asset.AssetManager.prototype.registerLoadedAssets = function ()
registerLoadedAssets ()
{
const scripts = document.getElementsByTagName('script'),
length = !scripts ? 0 : scripts.length;
@ -57,7 +58,7 @@
*
* @since 1.0.0
*/
jsOMS.Asset.AssetManager.prototype.load = function (path, filetype, callback)
load (path, filetype, callback)
{
let hash;
@ -104,7 +105,7 @@
}
if (callback) {
fileref.onreadystatechange = function ()
fileref.onreadystatechange ()
{
if (this.readyState === 'complete') {
callback();
@ -131,7 +132,7 @@
*
* @since 1.0.0
*/
jsOMS.Asset.AssetManager.prototype.get = function (key)
get (key)
{
key = jsOMS.hash(key);
@ -153,7 +154,7 @@
*
* @since 1.0.0
*/
jsOMS.Asset.AssetManager.prototype.remove = function (key)
remove (key)
{
key = jsOMS.hash(key);
@ -165,4 +166,5 @@
return false;
};
};
}(window.jsOMS = window.jsOMS || {}));

View File

@ -12,12 +12,13 @@
jsOMS.Autoloader.defineNamespace('jsOMS.Auth');
jsOMS.Auth.Auth = class {
/**
* @constructor
*
* @since 1.0.0
*/
jsOMS.Auth.Auth = function (uri)
constructor (uri)
{
this.account = null;
this.uri = uri;
@ -32,7 +33,7 @@
*
* @since 1.0.0
*/
jsOMS.Auth.Auth.prototype.setAccount = function (account)
setAccount (account)
{
this.account = account;
};
@ -46,7 +47,7 @@
*
* @since 1.0.0
*/
jsOMS.Auth.Auth.prototype.getAccount = function ()
getAccount ()
{
return this.account;
};
@ -58,7 +59,7 @@
*
* @since 1.0.0
*/
jsOMS.Auth.Auth.prototype.login = function ()
login ()
{
const authRequest = new jsOMS.Message.Request.Request();
authRequest.setUri(this.uri);
@ -80,7 +81,7 @@
*
* @since 1.0.0
*/
jsOMS.Auth.Auth.prototype.logout = function ()
logout ()
{
location.reload();
};
@ -92,8 +93,9 @@
*
* @since 1.0.0
*/
jsOMS.Auth.Auth.prototype.loginResult = function (xhr)
loginResult (xhr)
{
location.reload();
};
};
}(window.jsOMS = window.jsOMS || {}));

View File

@ -16,12 +16,13 @@
/** @namespace jsOMS.Config */
jsOMS.Autoloader.defineNamespace('jsOMS.Config');
jsOMS.Config.Options = class {
/**
* @constructor
*
* @since 1.0.0
*/
jsOMS.Config.Options = function ()
constructor ()
{
this.options = {};
};
@ -39,7 +40,7 @@
*
* @since 1.0.0
*/
jsOMS.Config.Options.prototype.set = function (key, value, overwrite = false)
set (key, value, overwrite = false)
{
if (overwrite || typeof this.options[key] === 'undefined') {
this.options[key] = value;
@ -61,7 +62,7 @@
*
* @since 1.0.0
*/
jsOMS.Config.Options.prototype.get = function (key)
get (key)
{
if (typeof this.options[key] !== 'undefined') {
return this.options[key];
@ -81,7 +82,7 @@
*
* @since 1.0.0
*/
jsOMS.Config.Options.prototype.remove = function (key)
remove (key)
{
if (typeof this.options[key] !== 'undefined') {
delete this.options[key];
@ -91,4 +92,5 @@
return false;
};
}
}(window.jsOMS = window.jsOMS || {}));

View File

@ -4,7 +4,11 @@
jsOMS.Autoloader.defineNamespace('jsOMS.DataStorage');
// TODO: create comments
jsOMS.DataStorage.CacheManager = function ()
jsOMS.DataStorage.CacheManager = class {
constructor ()
{
}
};
}(window.jsOMS = window.jsOMS || {}));

View File

@ -17,9 +17,10 @@
*
* @since 1.0.0
*/
jsOMS.DataStorage.CookieJar = function ()
jsOMS.DataStorage.CookieJar = class {
constructor ()
{
};
}
/**
* Saving data to cookie
@ -36,7 +37,7 @@
*
* @since 1.0.0
*/
jsOMS.DataStorage.CookieJar.prototype.setCookie = function (cName, value, exdays, domain, path)
setCookie (cName, value, exdays, domain, path)
{
const exdate = new Date();
exdate.setDate(exdate.getDate() + exdays);
@ -61,7 +62,7 @@
*
* @since 1.0.0
*/
jsOMS.DataStorage.CookieJar.prototype.getCookie = function (cName)
getCookie (cName)
{
let cValue = document.cookie,
cStart = cValue.indexOf(" " + cName + "=");
@ -84,4 +85,5 @@
}
return cValue;
};
};
}(window.jsOMS = window.jsOMS || {}));

View File

@ -12,12 +12,13 @@
jsOMS.Autoloader.defineNamespace('jsOMS.DataStorage');
jsOMS.DataStorage.LocalStorage = class {
/**
* @constructor
*
* @since 1.0.0
*/
jsOMS.DataStorage.LocalStorage = function ()
constructor ()
{
};
@ -30,7 +31,7 @@
*
* @since 1.0.0
*/
jsOMS.DataStorage.LocalStorage.prototype.available = function ()
available ()
{
try {
return 'localStorage' in window && window.localStorage !== null;
@ -38,4 +39,5 @@
return false;
}
};
}
}(window.jsOMS = window.jsOMS || {}));

View File

@ -3,7 +3,9 @@
jsOMS.Autoloader.defineNamespace('jsOMS.DataStorage');
jsOMS.DataStorage.StorageManager = function ()
jsOMS.DataStorage.StorageManager = class {
constructor ()
{
};
}
}(window.jsOMS = window.jsOMS || {}));

View File

@ -3,7 +3,9 @@
jsOMS.Autoloader.defineNamespace('jsOMS.Dispatcher');
jsOMS.Dispatcher.Dispatcher = function ()
jsOMS.Dispatcher.Dispatcher = class {
constructor ()
{
};
}
}(window.jsOMS = window.jsOMS || {}));

View File

@ -14,12 +14,13 @@
jsOMS.Autoloader.defineNamespace('jsOMS.Event');
jsOMS.Event.EventManager = class {
/**
* @constructor
*
* @since 1.0.0
*/
jsOMS.Event.EventManager = function ()
constructor ()
{
this.logger = jsOMS.Log.Logger.getInstance();
this.groups = {};
@ -38,7 +39,7 @@
*
* @since 1.0.0
*/
jsOMS.Event.EventManager.prototype.addGroup = function (group, id)
addGroup (group, id)
{
if (typeof this.groups[group] === 'undefined') {
this.groups[group] = {};
@ -58,7 +59,7 @@
*
* @since 1.0.0
*/
jsOMS.Event.EventManager.prototype.reset = function (group)
reset (group)
{
for (let id in this.groups[group]) {
if (this.groups[group].hasOwnProperty(id)) {
@ -78,7 +79,7 @@
*
* @since 1.0.0
*/
jsOMS.Event.EventManager.prototype.hasOutstanding = function (group)
hasOutstanding (group)
{
if (typeof this.groups[group] === 'undefined') {
return false;
@ -108,7 +109,7 @@
*
* @since 1.0.0
*/
jsOMS.Event.EventManager.prototype.trigger = function (group, id, data)
trigger (group, id, data)
{
id = typeof id !== 'undefined' ? id : 0;
@ -145,7 +146,7 @@
*
* @since 1.0.0
*/
jsOMS.Event.EventManager.prototype.detach = function (group)
detach (group)
{
delete this.callbacks[group];
delete this.groups[group];
@ -165,7 +166,7 @@
*
* @since 1.0.0
*/
jsOMS.Event.EventManager.prototype.attach = function (group, callback, remove = false, reset = false)
attach (group, callback, remove = false, reset = false)
{
if (this.callbacks.hasOwnProperty(group)) {
return false;
@ -185,8 +186,9 @@
*
* @since 1.0.0
*/
jsOMS.Event.EventManager.prototype.count = function ()
count ()
{
return this.callbacks.length;
};
}
}(window.jsOMS = window.jsOMS || {}));

View File

@ -12,6 +12,7 @@
/** @namespace jsOMS.Log */
jsOMS.Autoloader.defineNamespace('jsOMS.Log');
jsOMS.Log.Logger = class {
/**
* @constructor
*
@ -21,15 +22,13 @@
*
* @since 1.0.0
*/
jsOMS.Log.Logger = function (verbose, ui, remote)
constructor (verbose, ui, remote)
{
this.verbose = typeof verbose !== 'undefined' ? verbose : true;
this.ui = typeof ui !== 'undefined' ? ui : true;
this.remote = typeof remote !== 'undefined' ? remote : false;
};
jsOMS.Log.Logger.instance = null;
/**
* Get logging instance
*
@ -43,7 +42,7 @@
*
* @since 1.0.0
*/
jsOMS.Log.Logger.getInstance = function(verbose, ui, remote)
static getInstance (verbose, ui, remote)
{
if(!jsOMS.Log.Logger.instance) {
jsOMS.Log.Logger.instance = new jsOMS.Log.Logger(verbose, ui, remote);
@ -52,8 +51,6 @@
return jsOMS.Log.Logger.instance;
};
jsOMS.Log.Logger.MSG_FULL = '{datetime}; {level}; {version}; {os}; {browser}; {path}; {message}';
/**
* Interpolate message
*
@ -67,7 +64,7 @@
*
* @since 1.0.0
*/
jsOMS.Log.Logger.prototype.interpolate = function (message, context, level)
interpolate (message, context, level)
{
let newMessage = jsOMS.Log.Logger.MSG_FULL;
@ -93,7 +90,7 @@
*
* @since 1.0.0
*/
jsOMS.Log.Logger.prototype.createContext = function (message, context, level)
createContext (message, context, level)
{
context.datetime = (new Date()).toISOString();
context.version = '1.0.0';
@ -119,7 +116,7 @@
*
* @since 1.0.0
*/
jsOMS.Log.Logger.prototype.write = function (message, context, level)
write (message, context, level)
{
context = this.createContext(message, context, level);
@ -180,7 +177,7 @@
*
* @since 1.0.0
*/
jsOMS.Log.Logger.prototype.emergency = function (message, context = {})
emergency (message, context = {})
{
this.write(message, context, jsOMS.Log.LogLevel.EMERGENCY);
};
@ -197,7 +194,7 @@
*
* @since 1.0.0
*/
jsOMS.Log.Logger.prototype.alert = function (message, context = {})
alert (message, context = {})
{
this.write(message, context, jsOMS.Log.LogLevel.ALERT);
};
@ -214,7 +211,7 @@
*
* @since 1.0.0
*/
jsOMS.Log.Logger.prototype.critical = function (message, context = {})
critical (message, context = {})
{
this.write(message, context, jsOMS.Log.LogLevel.CRITICAL);
};
@ -231,7 +228,7 @@
*
* @since 1.0.0
*/
jsOMS.Log.Logger.prototype.error = function (message, context = {})
error (message, context = {})
{
this.write(message, context, jsOMS.Log.LogLevel.ERROR);
};
@ -248,7 +245,7 @@
*
* @since 1.0.0
*/
jsOMS.Log.Logger.prototype.warning = function (message, context = {})
warning (message, context = {})
{
this.write(message, context, jsOMS.Log.LogLevel.WARNING);
};
@ -265,7 +262,7 @@
*
* @since 1.0.0
*/
jsOMS.Log.Logger.prototype.notice = function (message, context = {})
notice (message, context = {})
{
this.write(message, context, jsOMS.Log.LogLevel.NOTICE);
};
@ -282,7 +279,7 @@
*
* @since 1.0.0
*/
jsOMS.Log.Logger.prototype.info = function (message, context = {})
info (message, context = {})
{
this.write(message, context, jsOMS.Log.LogLevel.INFO);
};
@ -299,7 +296,7 @@
*
* @since 1.0.0
*/
jsOMS.Log.Logger.prototype.debug = function (message, context = {})
debug (message, context = {})
{
this.write(message, context, jsOMS.Log.LogLevel.DEBUG);
};
@ -317,7 +314,7 @@
*
* @since 1.0.0
*/
jsOMS.Log.Logger.prototype.log = function (level, message, context = {})
log (level, message, context = {})
{
this.write(message, context, level);
};
@ -335,8 +332,12 @@
*
* @since 1.0.0
*/
jsOMS.Log.Logger.prototype.console = function (level, message, context = {})
console (level, message, context = {})
{
this.write(message, context, jsOMS.Log.LogLevel.INFO);
};
}
jsOMS.Log.Logger.instance = null;
jsOMS.Log.Logger.MSG_FULL = '{datetime}; {level}; {version}; {os}; {browser}; {path}; {message}';
}(window.jsOMS = window.jsOMS || {}));

View File

@ -13,22 +13,23 @@
/** @namespace jsOMS.Message.Notification.App */
jsOMS.Autoloader.defineNamespace('jsOMS.Message.Notification.App');
jsOMS.Message.Notification.App.AppNotification = function()
jsOMS.Message.Notification.App.AppNotification = class {
constructor ()
{
this.status = 0;
};
jsOMS.Message.Notification.App.AppNotification.prototype.setStatus = function(status)
setStatus (status)
{
this.status = status;
};
jsOMS.Message.Notification.App.AppNotification.prototype.requestPermission = function()
requestPermission ()
{
const self = this;
};
jsOMS.Message.Notification.App.AppNotification.prototype.send = function(msg)
send (msg)
{
const tpl = document.getElementById('app-message');
@ -48,4 +49,5 @@
document.getElementsByClassName('log-msg')[0].remove();
}, 3000);
};
}
}(window.jsOMS = window.jsOMS || {}));

View File

@ -13,17 +13,18 @@
/** @namespace jsOMS.Message.Notification.Browser */
jsOMS.Autoloader.defineNamespace('jsOMS.Message.Notification.Browser');
jsOMS.Message.Notification.Browser.BrowserNotification = function()
jsOMS.Message.Notification.Browser.BrowserNotification = class {
constructor()
{
this.status = 0;
};
jsOMS.Message.Notification.Browser.BrowserNotification.prototype.setStatus = function(status)
setStatus (status)
{
this.status = status;
};
jsOMS.Message.Notification.Browser.BrowserNotification.prototype.requestPermission = function()
requestPermission ()
{
const self = this;
@ -39,9 +40,10 @@
}
};
jsOMS.Message.Notification.Browser.BrowserNotification.prototype.send = function(msg)
send (msg)
{
/** global: Notification */
let n = new Notification(/* ... */);
};
}
}(window.jsOMS = window.jsOMS || {}));

View File

@ -13,13 +13,14 @@
/** @namespace jsOMS.Message.Notification */
jsOMS.Autoloader.defineNamespace('jsOMS.Message.Notification');
jsOMS.Message.Notification.NotificationManager = function()
jsOMS.Message.Notification.NotificationManager = class {
constructor()
{
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)
send (message, type)
{
if (jsOMS.Message.Notification.NotificationType.APP_NOTIFICATION === type) {
this.appNotifier.send(message);
@ -28,13 +29,14 @@
}
};
jsOMS.Message.Notification.NotificationManager.prototype.getAppNotifier = function()
getAppNotifier ()
{
return this.appNotifier;
};
jsOMS.Message.Notification.NotificationManager.prototype.getBrowserNotifier = function()
getBrowserNotifier ()
{
return this.browserNotifier;
};
}
}(window.jsOMS = window.jsOMS || {}));

View File

@ -12,10 +12,12 @@
/** @namespace jsOMS.Message.Notification.App */
jsOMS.Autoloader.defineNamespace('jsOMS.Message.Notification');
jsOMS.Message.Notification.NotificationMessage = function (status, title, message)
jsOMS.Message.Notification.NotificationMessage = class {
constructor(status, title, message)
{
this.status = status;
this.title = title;
this.message = message;
};
}
}(window.jsOMS = window.jsOMS || {}));

View File

@ -13,12 +13,13 @@
/** @namespace jsOMS.Message.Request */
jsOMS.Autoloader.defineNamespace('jsOMS.Message.Request');
jsOMS.Message.Request.Request = class {
/**
* @constructor
*
* @since 1.0.0
*/
jsOMS.Message.Request.Request = function (uri, method, type)
constructor (uri, method, type)
{
this.uri = typeof uri !== 'undefined' ? uri : null;
this.method = typeof method !== 'undefined' ? method : jsOMS.Message.Request.RequestMethod.GET;
@ -46,7 +47,7 @@
*
* @since 1.0.0
*/
jsOMS.Message.Request.Request.getBrowser = function ()
static getBrowser()
{
/** global: InstallTrigger */
/** global: navigator */
@ -54,7 +55,7 @@
return jsOMS.Message.Request.BrowserType.OPERA;
} else if (typeof InstallTrigger !== 'undefined') {
return jsOMS.Message.Request.BrowserType.FIREFOX;
} else if (Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0) {
} else if (Object.toString.call(window.HTMLElement).indexOf('Constructor') > 0) {
return jsOMS.Message.Request.BrowserType.SAFARI;
} else if (/*@cc_on!@*/false || !!document.documentMode) {
return jsOMS.Message.Request.BrowserType.IE;
@ -78,7 +79,7 @@
*
* @since 1.0.0
*/
jsOMS.Message.Request.Request.getOS = function ()
static getOS()
{
for (let os in jsOMS.Message.Request.OSType) {
if (jsOMS.Message.Request.OSType.hasOwnProperty(os)) {
@ -103,7 +104,7 @@
*
* @since 1.0.0
*/
jsOMS.Message.Request.Request.prototype.setMethod = function (method)
setMethod(method)
{
this.method = method;
};
@ -119,7 +120,7 @@
*
* @since 1.0.0
*/
jsOMS.Message.Request.Request.prototype.getMethod = function ()
getMethod()
{
return this.method;
};
@ -135,7 +136,7 @@
*
* @since 1.0.0
*/
jsOMS.Message.Request.Request.prototype.setResponseType = function (type)
setResponseType(type)
{
this.xhr.responseType = type;
};
@ -151,7 +152,7 @@
*
* @since 1.0.0
*/
jsOMS.Message.Request.Request.prototype.getResponseType = function ()
getResponseType()
{
return this.responseType;
};
@ -166,7 +167,7 @@
*
* @since 1.0.0
*/
jsOMS.Message.Request.Request.prototype.setRequestHeader = function (type, header)
setRequestHeader(type, header)
{
this.requestHeader[type] = header;
};
@ -180,7 +181,7 @@
*
* @since 1.0.0
*/
jsOMS.Message.Request.Request.prototype.getRequestHeader = function ()
getRequestHeader()
{
return this.requestHeader;
};
@ -194,7 +195,7 @@
*
* @since 1.0.0
*/
jsOMS.Message.Request.Request.prototype.setUri = function (uri)
setUri(uri)
{
this.uri = uri;
};
@ -208,7 +209,7 @@
*
* @since 1.0.0
*/
jsOMS.Message.Request.Request.prototype.getUri = function ()
getUri()
{
return this.uri;
};
@ -223,7 +224,7 @@
*
* @since 1.0.0
*/
jsOMS.Message.Request.Request.prototype.setSuccess = function (callback)
setSuccess(callback)
{
this.result[200] = callback;
};
@ -238,7 +239,7 @@
*
* @since 1.0.0
*/
jsOMS.Message.Request.Request.prototype.setResultCallback = function (status, callback)
setResultCallback(status, callback)
{
this.result[status] = callback;
};
@ -252,7 +253,7 @@
*
* @since 1.0.0
*/
jsOMS.Message.Request.Request.prototype.setData = function (data)
setData(data)
{
this.data = data;
};
@ -266,7 +267,7 @@
*
* @since 1.0.0
*/
jsOMS.Message.Request.Request.prototype.getData = function ()
getData()
{
return this.data;
};
@ -282,7 +283,7 @@
*
* @since 1.0.0
*/
jsOMS.Message.Request.Request.prototype.setType = function (type)
setType(type)
{
this.type = type;
};
@ -298,7 +299,7 @@
*
* @since 1.0.0
*/
jsOMS.Message.Request.Request.prototype.getType = function ()
getType()
{
return this.type;
};
@ -312,7 +313,7 @@
*
* @since 1.0.0
*/
jsOMS.Message.Request.Request.prototype.queryfy = function (obj)
queryfy(obj)
{
const str = [];
for (let p in obj) {
@ -333,7 +334,7 @@
*
* @since 1.0.0
*/
jsOMS.Message.Request.Request.prototype.send = function ()
send()
{
const self = this;
@ -378,4 +379,5 @@
this.xhr.send(this.data);
}
};
}
}(window.jsOMS = window.jsOMS || {}));

View File

@ -15,23 +15,25 @@
/** @namespace jsOMS.Message.Response */
jsOMS.Autoloader.defineNamespace('jsOMS.Message.Response');
jsOMS.Message.Response.Response = function (data)
jsOMS.Message.Response.Response = class {
constructor (data)
{
this.responses = data;
};
jsOMS.Message.Response.Response.prototype.get = function (id)
get (id)
{
return this.responses[id];
};
jsOMS.Message.Response.Response.prototype.getByIndex = function (index)
getByIndex (index)
{
return this.responses[index];
};
jsOMS.Message.Response.Response.prototype.count = function ()
count ()
{
return this.responses.length;
};
}
}(window.jsOMS = window.jsOMS || {}));

View File

@ -15,12 +15,13 @@
/** @namespace jsOMS.Message.Response */
jsOMS.Autoloader.defineNamespace('jsOMS.Message.Response');
jsOMS.Message.Response.ResponseManager = class {
/**
* @constructor
*
* @since 1.0.0
*/
jsOMS.Message.Response.ResponseManager = function ()
constructor()
{
this.messages = {};
};
@ -38,7 +39,7 @@
*
* @since 1.0.0
*/
jsOMS.Message.Response.ResponseManager.prototype.add = function (key, message, request)
add(key, message, request)
{
request = typeof request !== 'undefined' ? request : 'any';
if (typeof this.messages[key] === 'undefined') {
@ -61,7 +62,7 @@
*
* @since 1.0.0
*/
jsOMS.Message.Response.ResponseManager.prototype.run = function (key, data, request)
run(key, data, request)
{
if (typeof request !== 'undefined' && typeof this.messages[key] !== 'undefined' && typeof this.messages[key][request] !== 'undefined') {
this.messages[key][request](data);
@ -71,4 +72,5 @@
jsOMS.Log.Logger.instance.warning('Undefined type: ' + key);
}
};
}
}(window.jsOMS = window.jsOMS || {}));

View File

@ -12,12 +12,13 @@
jsOMS.Autoloader.defineNamespace('jsOMS.Module');
jsOMS.Module.ModuleFactory = class {
/**
* @constructor
*
* @since 1.0.0
*/
jsOMS.Module.ModuleFactory = function ()
constructor ()
{
};
@ -33,8 +34,9 @@
*
* @since 1.0.0
*/
jsOMS.Module.ModuleFactory.getInstance = function (module, app)
static getInstance (module, app)
{
return new jsOMS.Modules[module](app);
};
}
}(window.jsOMS = window.jsOMS || {}));

View File

@ -13,12 +13,13 @@
/** @namespace jsOMS.Module */
jsOMS.Autoloader.defineNamespace('jsOMS.Module');
jsOMS.Module.ModuleManager = class {
/**
* @constructor
*
* @since 1.0.0
*/
jsOMS.Module.ModuleManager = function (app)
constructor(app)
{
this.modules = {};
this.app = app;
@ -35,7 +36,7 @@
*
* @since 1.0.0
*/
jsOMS.Module.ModuleManager.prototype.get = function (module)
get (module)
{
if (typeof this.modules[module] === 'undefined') {
this.modules[module] = jsOMS.Module.ModuleFactory.getInstance(module, this.app);
@ -43,4 +44,5 @@
return this.modules[module];
};
}
}(window.jsOMS = window.jsOMS || {}));

View File

@ -3,17 +3,19 @@
jsOMS.Autoloader.defineNamespace('jsOMS.Route');
jsOMS.Route.Route = class {
// TODO: create comments
jsOMS.Route.Route = function ()
constructor ()
{
this.routes = null;
};
// TODO: create comments
jsOMS.Route.prototype.add = function (path, callback, exact)
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

@ -96,6 +96,7 @@
for (let j = 0; j < length; ++j) {
self.bindListener(data.addedNodes[j].id, listeners[i], true);
// todo only make removable if action itself is defined as auto removable
}
});
@ -127,13 +128,14 @@
for (let j = 1; j < actionLength; ++j) {
if (typeof id === 'undefined' || typeof listener.key === 'undefined') {
throw 'Invalid element id/key.'
jsOMS.Log.Logger.instance.error('Invalid element id/key: ' + id + '/' + listener.key);
return;
}
this.app.eventManager.attach(id + '-' + listener.key + '-' + listener.action[j - 1].key, function (data)
{
self.runAction(id, listener, listener.action[j], data);
}, removable, true); // todo: make actions removable e.g. in case of child elements getting removed = tag list
}, removable, true);
}
// todo: the true here is a memory leak since it should be removed at some point?!
// todo: handle onload action right after registering everything. this will be used for onload api calls in order to get content such as lists or models. Maybe in the main application after registering a invoke('onload') should be called if the application wants to execute the onload elements

View File

@ -13,12 +13,13 @@
/** @namespace jsOMS.UI */
jsOMS.Autoloader.defineNamespace('jsOMS.UI.Component');
jsOMS.UI.Component.Form = class {
/**
* @constructor
*
* @since 1.0.0
*/
jsOMS.UI.Component.Form = function (app)
constructor (app)
{
this.app = app;
this.forms = {};
@ -32,7 +33,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.Component.Form.prototype.get = function (id)
get (id)
{
return this.forms[id];
};
@ -44,7 +45,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.Component.Form.prototype.isIgnored = function (id)
isIgnored (id)
{
return this.ignore.indexOf(id) !== -1;
};
@ -56,7 +57,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.Component.Form.prototype.unbind = function (id)
unbind (id)
{
};
@ -68,7 +69,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.Component.Form.prototype.bind = function (id)
bind (id)
{
if (typeof id !== 'undefined' && typeof this.ignore[id] === 'undefined') {
this.bindForm(id);
@ -91,7 +92,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.Component.Form.prototype.bindForm = function (id)
bindForm (id)
{
if (typeof id === 'undefined' || !id) {
jsOMS.Log.Logger.instance.info('A form doesn\'t have an ID.');
@ -122,7 +123,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.Component.Form.prototype.unbindForm = function (id)
unbindForm (id)
{
// todo: do i need the findex? can't i just use id?
let findex = 0;
@ -146,7 +147,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.Component.Form.prototype.submit = function (form)
submit (form)
{
/* Handle injects */
const self = this,
@ -187,7 +188,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.Component.Form.prototype.submitForm = function (form)
submitForm (form)
{
if (!form.isValid()) {
jsOMS.Log.Logger.instance.debug('Form "' + form.getId() + '" has invalid values.');
@ -228,8 +229,6 @@
if ((successInject = form.getSuccess()) !== null) {
successInject(response);
} else {
self.app.responseManager.run(response.get(0).type, response.get(0), request);
}
} catch (e) {
console.log(e);
@ -263,8 +262,9 @@
*
* @since 1.0.0
*/
jsOMS.UI.Component.Form.prototype.count = function ()
count ()
{
return this.forms.length;
};
}
}(window.jsOMS = window.jsOMS || {}));

View File

@ -13,6 +13,7 @@
/** @namespace jsOMS.UI.Input*/
jsOMS.Autoloader.defineNamespace('jsOMS.UI.Input');
jsOMS.UI.Input = class {
/**
* Unbind input element
*
@ -20,7 +21,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.Input.unbind = function (input)
static unbind = function (input)
{
this.app.inputManager.getKeyboardManager().unbind(input);
/** global: changeBind */
@ -34,7 +35,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.Input.bindElement = function (input)
static bindElement = function (input)
{
if (typeof input === 'undefined') {
throw 'Input element required'
@ -98,7 +99,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.Input.addRemoteDatalistOptions = function (input, datalist)
static addRemoteDatalistOptions = function (input, datalist)
{
this.clearDatalistOptions(datalist);
@ -147,7 +148,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.Input.clearDatalistOptions = function (datalist)
static clearDatalistOptions = function (datalist)
{
const length = datalist.options.length;
@ -155,4 +156,5 @@
datalist.remove(0);
}
};
}
}(window.jsOMS = window.jsOMS || {}));

View File

@ -12,12 +12,13 @@
jsOMS.Autoloader.defineNamespace('jsOMS.UI.Component');
jsOMS.UI.Component.Tab = class {
/**
* @constructor
*
* @since 1.0.0
*/
jsOMS.UI.Component.Tab = function (responseManager)
constructor (responseManager)
{
this.responseManager = responseManager;
};
@ -31,7 +32,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.Component.Tab.prototype.bind = function (id)
bind (id)
{
if (typeof id !== 'undefined') {
const e = document.getElementById(id);
@ -58,7 +59,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.Component.Tab.prototype.bindElement = function (e)
bindElement (e)
{
const nodes = e.querySelectorAll('.tab-links a');
@ -78,4 +79,5 @@
jsOMS.preventAll(evt);
});
};
}
}(window.jsOMS = window.jsOMS || {}));

View File

@ -12,12 +12,13 @@
jsOMS.Autoloader.defineNamespace('jsOMS.UI.Component');
jsOMS.UI.Component.Table = class {
/**
* @constructor
*
* @since 1.0.0
*/
jsOMS.UI.Component.Table = function (responseManager)
constructor(responseManager)
{
this.responseManager = responseManager;
};
@ -31,7 +32,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.Component.Table.prototype.bind = function (id)
bind (id)
{
if (typeof id !== 'undefined') {
const e = document.getElementById(id);
@ -58,7 +59,8 @@
*
* @since 1.0.0
*/
jsOMS.UI.Component.Table.prototype.bindElement = function (e)
bindElement (e)
{
};
}
}(window.jsOMS = window.jsOMS || {}));

View File

@ -13,12 +13,13 @@
/** @namespace jsOMS.UI.DragNDrop*/
jsOMS.Autoloader.defineNamespace('jsOMS.UI.DragNDrop');
jsOMS.UI.DragNDrop = class {
/**
* @constructor
*
* @since 1.0.0
*/
jsOMS.UI.DragNDrop = function (app)
constructor (app)
{
this.app = app;
this.draggable = {};
@ -32,7 +33,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.DragNDrop.prototype.unbind = function (element)
unbind (element)
{
};
@ -43,7 +44,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.DragNDrop.prototype.bind = function (id)
bind (id)
{
if (typeof id !== 'undefined') {
this.bindElement(id);
@ -66,7 +67,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.DragNDrop.prototype.bindElement = function (id)
bindElement (id)
{
const element = document.getElementById(id),
self = this;
@ -123,5 +124,5 @@
self.dragging = null;
}, false);
}
}
}(window.jsOMS = window.jsOMS || {}));

View File

@ -13,14 +13,14 @@
/** @namespace jsOMS.UI */
jsOMS.Autoloader.defineNamespace('jsOMS.UI');
jsOMS.UI.GeneralUI = class {
/**
* @constructor
*
* @since 1.0.0
*/
jsOMS.UI.GeneralUI = function ()
constructor ()
{
this.visObs = null;
};
@ -33,7 +33,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.GeneralUI.prototype.bind = function (id)
bind (id)
{
let e = null;
if (typeof id !== 'undefined') {
@ -53,7 +53,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.GeneralUI.prototype.bindHref = function (e)
bindHref (e)
{
e = e !== null ? e.querySelectorAll('[data-href]') : document.querySelectorAll('[data-href]');
const length = e.length;
@ -75,7 +75,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.GeneralUI.prototype.bindLazyLoad = function (e)
bindLazyLoad (e)
{
e = e !== null ? e.querySelectorAll('[data-lazyload]') : document.querySelectorAll('[data-lazyload]');
const length = e.length;
@ -102,4 +102,5 @@
}
}
};
}
}(window.jsOMS = window.jsOMS || {}));

View File

@ -13,12 +13,13 @@
/** @namespace jsOMS.UI.Input */
jsOMS.Autoloader.defineNamespace('jsOMS.UI.Input');
jsOMS.UI.Input.InputManager = class {
/**
* @constructor
*
* @since 1.0.0
*/
jsOMS.UI.Input.InputManager = function (app)
constructor(app)
{
this.keyboardManager = new jsOMS.UI.Input.Keyboard.KeyboardManager();
this.mouseManager = new jsOMS.UI.Input.Mouse.MouseManager();
@ -32,7 +33,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.Input.InputManager.prototype.getKeyboardManager = function ()
getKeyboardManager ()
{
return this.keyboardManager;
};
@ -44,7 +45,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.Input.InputManager.prototype.getMouseManager = function ()
getMouseManager ()
{
return this.mouseManager;
};
@ -56,8 +57,9 @@
*
* @since 1.0.0
*/
jsOMS.UI.Input.InputManager.prototype.getVoiceManager = function ()
getVoiceManager ()
{
return this.voiceManager;
};
}
}(window.jsOMS = window.jsOMS || {}));

View File

@ -13,12 +13,13 @@
/** @namespace jsOMS.UI.Input.Keyboard */
jsOMS.Autoloader.defineNamespace('jsOMS.UI.Input.Keyboard');
jsOMS.UI.Input.Keyboard.KeyboardManager = class {
/**
* @constructor
*
* @since 1.0.0
*/
jsOMS.UI.Input.Keyboard.KeyboardManager = function ()
constructor ()
{
this.elements = {};
this.down = [];
@ -33,7 +34,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.Input.Keyboard.KeyboardManager.prototype.add = function (element, keys, callback)
add (element, keys, callback)
{
if (typeof this.elements[element] === 'undefined') {
this.elements[element] = [];
@ -51,7 +52,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.Input.Keyboard.KeyboardManager.prototype.bind = function (element)
bind (element)
{
const self = this;
@ -78,7 +79,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.Input.Keyboard.KeyboardManager.prototype.run = function (element, event)
run (element, event)
{
if (typeof this.elements[element] === 'undefined') {
throw 'Unexpected elmenet!';
@ -108,4 +109,5 @@
}
}
};
}
}(window.jsOMS = window.jsOMS || {}));

View File

@ -13,12 +13,13 @@
/** @namespace jsOMS.UI.Input.Mouse */
jsOMS.Autoloader.defineNamespace('jsOMS.UI.Input.Mouse');
jsOMS.UI.Input.Mouse.MouseManager = class {
/**
* @constructor
*
* @since 1.0.0
*/
jsOMS.UI.Input.Mouse.MouseManager = function ()
constructor ()
{
this.elements = {};
this.click = {time: 0};
@ -35,7 +36,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.Input.Mouse.MouseManager.prototype.add = function (element, type, button, callback, exact)
add (element, type, button, callback, exact)
{
if (typeof this.elements[element] === 'undefined') {
this.elements[element] = [];
@ -53,7 +54,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.Input.Mouse.MouseManager.prototype.bind = function (element, type)
bind (element, type)
{
const self = this,
e = document.getElementById(element);
@ -99,7 +100,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.Input.Mouse.MouseManager.prototype.run = function (element, event)
run (element, event)
{
if (typeof this.elements[element] === 'undefined') {
throw 'Unexpected elmenet!';
@ -117,4 +118,5 @@
}
}
};
}
}(window.jsOMS = window.jsOMS || {}));

View File

@ -13,6 +13,7 @@
/** @namespace jsOMS.UI.Input.Touch */
jsOMS.Autoloader.defineNamespace('jsOMS.UI.Input.Touch');
jsOMS.UI.Input.Touch.TouchManager = class {
/**
* @constructor
*
@ -20,7 +21,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.Input.Touch.TouchManager = function (app)
constructor (app)
{
this.app = app;
this.activeSwipe = {};
@ -34,7 +35,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.Input.Touch.TouchManager.prototype.resetSwipe = function ()
resetSwipe ()
{
this.activeSwipe = {'startX': null, 'startY': null, 'time': null};
};
@ -46,7 +47,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.Input.Touch.TouchManager.prototype.add = function (surface)
add (surface)
{
const e = document.getElementById(surface),
self = this;
@ -122,4 +123,5 @@
}
});
};
}
}(window.jsOMS = window.jsOMS || {}));

View File

@ -26,12 +26,13 @@
/** global: SpeechRecognitionEvent */
var SpeechRecognitionEvent = typeof SpeechRecognitionEvent !== 'undefined' ? SpeechRecognitionEvent : typeof webkitSpeechRecognitionEvent !== 'undefined' ? webkitSpeechRecognitionEvent : null;
jsOMS.UI.Input.Voice.ReadManager = class {
/**
* @constructor
*
* @since 1.0.0
*/
jsOMS.UI.Input.Voice.ReadManager = function (lang = 'en-US')
constructor (lang = 'en-US')
{
this.pitch = 1;
this.rate = 1;
@ -54,7 +55,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.Input.Voice.ReadManager.prototype.read = function(text)
read (text)
{
/** global: SpeechSynthesisUtterance */
let utter = new SpeechSynthesisUtterance(text);
@ -75,7 +76,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.Input.Voice.ReadManager.prototype.setLanguage = function(lang)
setLanguage (lang)
{
this.lang = lang;
};
@ -89,7 +90,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.Input.Voice.ReadManager.prototype.setPitch = function(pitch)
setPitch (pitch)
{
this.pitch = pitch;
};
@ -103,7 +104,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.Input.Voice.ReadManager.prototype.setRate = function(rate)
setRate (rate)
{
this.rate = rate;
};
@ -115,8 +116,9 @@
*
* @since 1.0.0
*/
jsOMS.UI.Input.Voice.ReadManager.prototype.getVoices = function()
getVoices ()
{
return this.voices;
};
}
}(window.jsOMS = window.jsOMS || {}));

View File

@ -26,12 +26,13 @@
/** global: SpeechRecognitionEvent */
var SpeechRecognitionEvent = typeof SpeechRecognitionEvent !== 'undefined' ? SpeechRecognitionEvent : typeof webkitSpeechRecognitionEvent !== 'undefined' ? webkitSpeechRecognitionEvent : null;
jsOMS.UI.Input.Voice.VoiceManager = class {
/**
* @constructor
*
* @since 1.0.0
*/
jsOMS.UI.Input.Voice.VoiceManager = function (app, commands = {}, lang = 'en-US')
constructor(app, commands = {}, lang = 'en-US')
{
this.app = app;
this.commands = commands;
@ -52,7 +53,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.Input.Voice.VoiceManager.prototype.setup = function()
setup()
{
if (SpeechRecognition === null) {
return;
@ -102,7 +103,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.Input.Voice.VoiceManager.prototype.getCommandsString = function()
getCommandsString()
{
return '#JSGF V1.0; grammar phrase; public <phrase> = ' + Object.keys(this.commands).join(' | ') + ' ;';
};
@ -116,7 +117,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.Input.Voice.VoiceManager.prototype.setLanguage = function(lang)
setLanguage(lang)
{
// todo: eventually restart
this.recognition.lang = lang;
@ -132,7 +133,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.Input.Voice.VoiceManager.prototype.add = function(command, callback)
add(command, callback)
{
this.commands[command] = callback;
};
@ -144,7 +145,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.Input.Voice.VoiceManager.prototype.start = function()
start()
{
if (SpeechRecognition === null) {
return;
@ -160,7 +161,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.Input.Voice.VoiceManager.prototype.stop = function()
stop()
{
if (SpeechRecognition === null) {
return;
@ -168,4 +169,5 @@
this.recognition.stop();
};
}
}(window.jsOMS = window.jsOMS || {}));

View File

@ -13,6 +13,7 @@
/** @namespace jsOMS.UI */
jsOMS.Autoloader.defineNamespace('jsOMS.UI');
jsOMS.UI.UIManager = class {
/**
* @constructor
*
@ -20,7 +21,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.UIManager = function (app)
constructor(app)
{
this.app = app;
this.formManager = new jsOMS.UI.Component.Form(this.app);
@ -50,7 +51,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.UIManager.prototype.bind = function (id)
bind(id)
{
if (typeof id === 'undefined') {
this.formManager.bind();
@ -89,7 +90,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.UIManager.prototype.getFormManager = function ()
getFormManager()
{
return this.formManager;
};
@ -103,7 +104,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.UIManager.prototype.getActionManager = function ()
getActionManager()
{
return this.actionManager;
};
@ -117,7 +118,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.UIManager.prototype.getDragNDrop = function ()
getDragNDrop()
{
return this.dragNDrop;
};
@ -131,7 +132,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.UIManager.prototype.getTabManager = function ()
getTabManager()
{
return this.tabManager;
};
@ -145,7 +146,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.UIManager.prototype.getTableManager = function ()
getTableManager()
{
return this.tabManager;
};
@ -159,7 +160,7 @@
*
* @since 1.0.0
*/
jsOMS.UI.UIManager.prototype.getDOMObserver = function ()
getDOMObserver()
{
return this.domObserver;
};
@ -173,8 +174,9 @@
*
* @since 1.0.0
*/
jsOMS.UI.UIManager.prototype.getGeneralUI = function ()
getGeneralUI()
{
return this.generalUI;
};
}
}(window.jsOMS = window.jsOMS || {}));

View File

@ -15,12 +15,13 @@
/** @namespace jsOMS.Uri.UriFactory */
jsOMS.Autoloader.defineNamespace('jsOMS.Uri.Http');
jsOMS.Uri.Http = class {
/**
* @constructor
*
* @since 1.0.0
*/
jsOMS.Uri.Http = function (uri)
constructor(uri)
{
this.uri = '';
this.scheme = '';
@ -51,7 +52,7 @@
*
* @since 1.0.0
*/
jsOMS.Uri.Http.parseUrl = function (str, mode = 'php')
static parseUrl (str, mode = 'php')
{
const key = ['source', 'scheme', 'authority', 'userInfo', 'user', 'pass', 'host', 'port',
'relative', 'path', 'directory', 'file', 'query', 'fragment'
@ -93,7 +94,7 @@
*
* @since 1.0.0
*/
jsOMS.Uri.Http.getUriQueryParameter = function (query, name)
static getUriQueryParameter (query, name)
{
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
@ -114,7 +115,7 @@
*
* @since 1.0.0
*/
jsOMS.Uri.Http.getAllUriQueryParameters = function (query)
static getAllUriQueryParameters (query)
{
const params = {};
let keyValPairs = [],
@ -156,7 +157,7 @@
*
* @since 1.0.0
*/
jsOMS.Uri.Http.prototype.set = function (uri)
set (uri)
{
this.uri = uri;
@ -194,7 +195,7 @@
*
* @since 1.0.0
*/
jsOMS.Uri.Http.prototype.setRootPath = function(rootPath)
setRootPath(rootPath)
{
this.root = rootPath;
this.set(this.uri);
@ -209,7 +210,7 @@
*
* @since 1.0.0
*/
jsOMS.Uri.Http.prototype.getBase = function()
getBase()
{
return this.base;
};
@ -223,7 +224,7 @@
*
* @since 1.0.0
*/
jsOMS.Uri.Http.prototype.getScheme = function()
getScheme()
{
return this.scheme;
};
@ -237,7 +238,7 @@
*
* @since 1.0.0
*/
jsOMS.Uri.Http.prototype.getHost = function()
getHost()
{
return this.host;
};
@ -251,7 +252,7 @@
*
* @since 1.0.0
*/
jsOMS.Uri.Http.prototype.getPort = function()
getPort()
{
return this.port;
};
@ -265,7 +266,7 @@
*
* @since 1.0.0
*/
jsOMS.Uri.Http.prototype.getUser = function()
getUser()
{
return this.user;
};
@ -279,7 +280,7 @@
*
* @since 1.0.0
*/
jsOMS.Uri.Http.prototype.getPass = function()
getPass()
{
return this.pass;
};
@ -293,7 +294,7 @@
*
* @since 1.0.0
*/
jsOMS.Uri.Http.prototype.getQuery = function()
getQuery()
{
return this.queryString;
};
@ -307,7 +308,7 @@
*
* @since 1.0.0
*/
jsOMS.Uri.Http.prototype.getUri = function()
getUri()
{
return this.uri;
};
@ -321,7 +322,7 @@
*
* @since 1.0.0
*/
jsOMS.Uri.Http.prototype.getFragment = function()
getFragment()
{
return this.fragment;
};
@ -335,7 +336,7 @@
*
* @since 1.0.0
*/
jsOMS.Uri.Http.prototype.getPath = function()
getPath()
{
return this.path;
};
@ -349,8 +350,9 @@
*
* @since 1.0.0
*/
jsOMS.Uri.Http.prototype.getPathOffset = function()
getPathOffset()
{
return jsOMS.substr_count(this.root, '/') - 1;
};
}
}(window.jsOMS = window.jsOMS || {}));

View File

@ -13,14 +13,7 @@
/** @namespace jsOMS.Uri.UriFactory */
jsOMS.Autoloader.defineNamespace('jsOMS.Uri.UriFactory');
/**
* Uri values
*
* @var {Object}
* @since 1.0.0
*/
jsOMS.Uri.UriFactory.uri = {};
jsOMS.Uri.UriFactory = class {
/**
* Set uri query
*
@ -34,7 +27,7 @@
*
* @since 1.0.0
*/
jsOMS.Uri.UriFactory.setQuery = function (key, value, overwrite)
static setQuery (key, value, overwrite)
{
overwrite = typeof overwrite !== 'undefined' ? overwrite : true;
@ -58,7 +51,7 @@
*
* @since 1.0.0
*/
jsOMS.Uri.UriFactory.getQuery = function (key)
static getQuery (key)
{
if (!jsOMS.Uri.UriFactory.uri.hasOwnProperty(key)) {
return '';
@ -76,7 +69,7 @@
*
* @since 1.0.0
*/
jsOMS.Uri.UriFactory.clearAll = function()
static clearAll ()
{
jsOMS.Uri.UriFactory.uri = {};
@ -94,7 +87,7 @@
*
* @since 1.0.0
*/
jsOMS.Uri.UriFactory.clear = function(key)
static clear (key)
{
if (jsOMS.Uri.UriFactory.uri.hasOwnProperty(key)) {
delete jsOMS.Uri.UriFactory.uri[key];
@ -116,7 +109,7 @@
*
* @since 1.0.0
*/
jsOMS.Uri.UriFactory.clearLike = function(pattern)
static clearLike (pattern)
{
let success = false;
const regexp = new RegExp(pattern);
@ -144,7 +137,7 @@
*
* @since 1.0.0
*/
jsOMS.Uri.UriFactory.unique = function (url)
static unique (url)
{
const parts = url.split('?');
@ -191,7 +184,7 @@
*
* @since 1.0.0
*/
jsOMS.Uri.UriFactory.build = function (uri, toMatch)
static build (uri, toMatch)
{
const current = jsOMS.Uri.Http.parseUrl(window.location.href);
let parsed = uri.replace(new RegExp('\{[\/#\?%@\.\$][a-zA-Z0-9\-]*\}', 'g'), function (match)
@ -240,7 +233,7 @@
*
* @since 1.0.0
*/
jsOMS.Uri.UriFactory.setupUriBuilder = function (uri)
static setupUriBuilder (uri)
{
jsOMS.Uri.UriFactory.setQuery('/scheme', uri.getScheme());
jsOMS.Uri.UriFactory.setQuery('/host', uri.getHost());
@ -260,4 +253,13 @@
}
}
};
}
/**
* Uri values
*
* @var {Object}
* @since 1.0.0
*/
jsOMS.Uri.UriFactory.uri = {};
}(window.jsOMS = window.jsOMS || {}));

View File

@ -16,6 +16,7 @@
/** @namespace jsOMS.Views */
jsOMS.Autoloader.defineNamespace('jsOMS.Views');
jsOMS.Views.FormView = class {
/**
* @constructor
*
@ -23,7 +24,7 @@
*
* @since 1.0.0
*/
jsOMS.Views.FormView = function (id)
constructor (id)
{
this.id = id;
@ -41,7 +42,7 @@
*
* @since 1.0.0
*/
jsOMS.Views.FormView.prototype.initializeMembers = function ()
initializeMembers ()
{
this.submitInjects = [];
this.method = 'POST';
@ -55,7 +56,7 @@
*
* @since 1.0.0
*/
jsOMS.Views.FormView.prototype.getMethod = function ()
getMethod ()
{
return this.method;
};
@ -67,17 +68,17 @@
*
* @since 1.0.0
*/
jsOMS.Views.FormView.prototype.getAction = function ()
getAction ()
{
return this.action;
};
jsOMS.Views.FormView.prototype.getLastSubmit = function ()
getLastSubmit ()
{
return this.lastSubmit;
};
jsOMS.Views.FormView.prototype.updateLastSubmit = function ()
updateLastSubmit ()
{
this.lastSubmit = Math.floor(Date.now());
};
@ -89,7 +90,7 @@
*
* @since 1.0.0
*/
jsOMS.Views.FormView.prototype.getSubmit = function ()
getSubmit ()
{
return document.querySelectorAll('#' + this.id + ' input[type=submit], button[form=' + this.id + '][type=submit]');
};
@ -101,7 +102,7 @@
*
* @since 1.0.0
*/
jsOMS.Views.FormView.prototype.getSuccess = function ()
getSuccess ()
{
return this.success;
};
@ -113,7 +114,7 @@
*
* @since 1.0.0
*/
jsOMS.Views.FormView.prototype.setSuccess = function (callback)
setSuccess (callback)
{
this.success = callback;
};
@ -125,7 +126,7 @@
*
* @since 1.0.0
*/
jsOMS.Views.FormView.prototype.injectSubmit = function (callback)
injectSubmit (callback)
{
this.submitInjects.push(callback);
};
@ -137,7 +138,7 @@
*
* @since 1.0.0
*/
jsOMS.Views.FormView.prototype.getFormElements = function ()
getFormElements ()
{
const form = document.getElementById(this.id);
@ -169,7 +170,7 @@
*
* @since 1.0.0
*/
jsOMS.Views.FormView.prototype.getUniqueFormElements = function (arr)
getUniqueFormElements (arr)
{
let seen = {};
@ -185,7 +186,7 @@
*
* @since 1.0.0
*/
jsOMS.Views.FormView.prototype.getData = function ()
getData ()
{
const data = {},
elements = this.getFormElements(),
@ -213,7 +214,7 @@
*
* @since 1.0.0
*/
jsOMS.Views.FormView.prototype.getId = function ()
getId ()
{
return this.id;
};
@ -225,7 +226,7 @@
*
* @since 1.0.0
*/
jsOMS.Views.FormView.prototype.isValid = function ()
isValid ()
{
const elements = this.getFormElements(),
length = elements.length;
@ -254,7 +255,7 @@
*
* @since 1.0.0
*/
jsOMS.Views.FormView.prototype.getElement = function ()
getElement ()
{
return document.getElementById(this.getId());
};
@ -266,7 +267,7 @@
*
* @since 1.0.0
*/
jsOMS.Views.FormView.getElementId = function (e)
static getElementId (e)
{
let id = e.getAttribute('name');
@ -292,7 +293,7 @@
*
* @since 1.0.0
*/
jsOMS.Views.FormView.prototype.getSubmitInjects = function ()
getSubmitInjects ()
{
return this.submitInjects;
};
@ -302,7 +303,7 @@
*
* @since 1.0.0
*/
jsOMS.Views.FormView.prototype.bind = function ()
bind ()
{
this.clean();
@ -342,7 +343,7 @@
*
* @since 1.0.0
*/
jsOMS.Views.FormView.prototype.unbind = function ()
unbind ()
{
const elements = this.getFormElements(),
length = elements.length;
@ -371,9 +372,10 @@
*
* @since 1.0.0
*/
jsOMS.Views.FormView.prototype.clean = function ()
clean ()
{
this.unbind();
this.initializeMembers();
};
}
}(window.jsOMS = window.jsOMS || {}));

View File

@ -1,38 +1,40 @@
(function (jsOMS) {
"use strict";
jsOMS.TableView = function () {
jsOMS.TableView = class {
constructor () {
this.table = null;
};
/**
* None, Pagination, Infinite
*/
jsOMS.TableView.prototype.setExtensible = function () {
setExtensible () {
};
jsOMS.TableView.prototype.add = function (element) {
add (element) {
};
jsOMS.TableView.prototype.addCollection = function (collection) {
addCollection (collection) {
};
jsOMS.TableView.prototype.remove = function (id) {
remove (id) {
};
jsOMS.TableView.prototype.get = function (id) {
get (id) {
};
jsOMS.TableView.prototype.filter = function (id) {
filter (id) {
};
jsOMS.TableView.prototype.request = function (filter) {
request (filter) {
};
}
}(window.jsOMS = window.jsOMS || {}));

View File

@ -1,18 +1,19 @@
(function (jsOMS) {
"use strict";
jsOMS.ViewAbstract = function ()
jsOMS.ViewAbstract = class {
constructor ()
{
this.element = null;
this.data = [];
};
jsOMS.ViewAbstract.prototype.bind = function (node)
bind (node)
{
this.element = node;
};
jsOMS.ViewAbstract.prototype.addData = function(id, data, overwrite)
addData(id, data, overwrite)
{
overwrite = typeof overwrite !== 'undefined' ? overwrite : false;
@ -25,8 +26,9 @@
return false;
};
jsOMS.ViewAbstract.prototype.getData = function(id)
getData(id)
{
return typeof this.data[id] !== 'undefined' ? this.data[id] : undefined;
};
}
}(window.jsOMS = window.jsOMS || {}));