Use js modules

This commit is contained in:
Dennis Eichhorn 2019-04-02 22:46:48 +02:00
parent b40c6670d4
commit 89acb321f9
76 changed files with 5341 additions and 5668 deletions

View File

@ -6,13 +6,7 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
jsOMS.Autoloader.defineNamespace('jsOMS.Account');
jsOMS.Account.Account = class {
export class Account {
/**
* @constructor
*
@ -34,5 +28,4 @@
{
return this.id;
};
};
}(window.jsOMS = window.jsOMS || {}));
};

View File

@ -6,13 +6,7 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
jsOMS.Autoloader.defineNamespace('jsOMS.Account');
jsOMS.Account.AccountManager = class {
export class AccountManager {
/**
* @constructor
*
@ -74,5 +68,4 @@
return null;
};
}
}(window.jsOMS = window.jsOMS || {}));
};

View File

@ -6,14 +6,7 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
jsOMS.Autoloader.defineNamespace('jsOMS.Account');
jsOMS.Account.AccountType = Object.freeze({
export const AccountType = Object.freeze({
USER: 0,
GROUP: 1
});
}(window.jsOMS = window.jsOMS || {}));
});

View File

@ -6,13 +6,7 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
jsOMS.Asset = {};
jsOMS.Asset.AssetManager = class {
export class AssetManager {
/**
* @constructor
*
@ -158,5 +152,5 @@
return false;
};
};
}(window.jsOMS = window.jsOMS || {}));
};

View File

@ -6,13 +6,7 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
jsOMS.Autoloader.defineNamespace('jsOMS.Auth');
jsOMS.Auth.Auth = class {
export class Auth {
/**
* @constructor
*
@ -96,5 +90,4 @@
{
location.reload();
};
};
}(window.jsOMS = window.jsOMS || {}));
};

View File

@ -1,3 +1,5 @@
import { AssetManager } from './Asset/AssetManager.js';
/**
* Autoloader.
*
@ -11,16 +13,13 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
export const Autoloader = {};
jsOMS.Autoloader = {};
jsOMS.Autoloader.loaded = [];
jsOMS.Autoloader.namespaced = [];
jsOMS.Autoloader.assetLoader = new jsOMS.Asset.AssetManager();
Autoloader.loaded = [];
Autoloader.namespaced = [];
Autoloader.assetLoader = new AssetManager();
/**
/**
* Define namespace
*
* @param {string} namespace Namespace
@ -29,9 +28,9 @@
*
* @since 1.0.0
*/
jsOMS.Autoloader.defineNamespace = function (namespace)
{
if (jsOMS.Autoloader.namespaced.indexOf(namespace) === -1) {
Autoloader.defineNamespace = function (namespace)
{
if (Autoloader.namespaced.indexOf(namespace) === -1) {
let paths = namespace.split('.');
paths.splice(0, 1);
@ -46,19 +45,19 @@
current = current[paths[i]];
}
jsOMS.Autoloader.namespaced.push(namespace);
Autoloader.namespaced.push(namespace);
}
};
};
/**
/**
* Collect all loaded javascript files
*
* @return {void}
*
* @since 1.0.0
*/
jsOMS.Autoloader.initPreloaded = function ()
{
Autoloader.initPreloaded = function ()
{
const scripts = document.getElementsByTagName('script'),
length = !scripts ? 0 : scripts.length;
@ -67,13 +66,13 @@
/** @var {string} URL */
scripts[i].src.replace(URL + '/', '');
if (jsOMS.Autoloader.loaded.indexOf(scripts[i].src) === -1) {
jsOMS.Autoloader.loaded.push(scripts[i].src);
if (Autoloader.loaded.indexOf(scripts[i].src) === -1) {
Autoloader.loaded.push(scripts[i].src);
}
}
};
};
/**
/**
* Add loaded script
*
* @param {string} file Script URI
@ -82,14 +81,14 @@
*
* @since 1.0.0
*/
jsOMS.Autoloader.addPreloaded = function (file)
{
if (jsOMS.Autoloader.loaded.indexOf(file) === -1) {
jsOMS.Autoloader.loaded.push(file);
Autoloader.addPreloaded = function (file)
{
if (Autoloader.loaded.indexOf(file) === -1) {
Autoloader.loaded.push(file);
}
};
};
/**
/**
* Include script
*
* @param {string} file Script URI
@ -99,20 +98,19 @@
*
* @since 1.0.0
*/
jsOMS.Autoloader.include = function (file, callback)
{
Autoloader.include = function (file, callback)
{
const length = file.length;
for (let i = 0; i < length; ++i) {
if (jsOMS.Autoloader.loaded.indexOf(file) === -1) {
if (Autoloader.loaded.indexOf(file) === -1) {
this.assetLoader.load(file, 'js');
jsOMS.Autoloader.loaded.push(file);
Autoloader.loaded.push(file);
}
}
if (typeof callback !== 'undefined' && callback !== null) {
callback();
}
};
}(window.jsOMS = window.jsOMS || {}));
};

View File

@ -1,14 +1,6 @@
(function (jsOMS) {
"use strict";
jsOMS.Autoloader.defineNamespace('jsOMS.DataStorage');
// TODO: create comments
jsOMS.DataStorage.CacheManager = class {
export class CacheManager {
constructor ()
{
}
};
}(window.jsOMS = window.jsOMS || {}));
};

View File

@ -6,13 +6,7 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
jsOMS.Autoloader.defineNamespace('jsOMS.DataStorage');
jsOMS.DataStorage.LocalStorage = class {
export class LocalStorage {
/**
* @constructor
*
@ -37,5 +31,4 @@
return false;
}
};
};
}(window.jsOMS = window.jsOMS || {}));
};

View File

@ -1,11 +1,5 @@
(function (jsOMS) {
"use strict";
jsOMS.Autoloader.defineNamespace('jsOMS.DataStorage');
jsOMS.DataStorage.StorageManager = class {
export class StorageManager {
constructor ()
{
};
}
}(window.jsOMS = window.jsOMS || {}));
};

View File

@ -1,11 +1,5 @@
(function (jsOMS) {
"use strict";
jsOMS.Autoloader.defineNamespace('jsOMS.Dispatcher');
jsOMS.Dispatcher.Dispatcher = class {
export class Dispatcher {
constructor ()
{
};
}
}(window.jsOMS = window.jsOMS || {}));
};

View File

@ -1,3 +1,5 @@
import { Logger } from '../Log/Logger.js';
/**
* Request manager class.
*
@ -8,13 +10,7 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
jsOMS.Autoloader.defineNamespace('jsOMS.Event');
jsOMS.Event.EventManager = class {
export class EventManager {
/**
* @constructor
*
@ -22,7 +18,7 @@
*/
constructor ()
{
this.logger = jsOMS.Log.Logger.getInstance();
this.logger = Logger.getInstance();
this.groups = {};
this.callbacks = {};
};
@ -255,5 +251,4 @@
{
return Object.keys(this.callbacks).length;
};
}
}(window.jsOMS = window.jsOMS || {}));
};

View File

@ -6,14 +6,7 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
/** @namespace jsOMS.Log */
jsOMS.Autoloader.defineNamespace('jsOMS.Log');
jsOMS.Log.LogLevel = Object.freeze({
export const LogLevel = Object.freeze({
EMERGENCY: 'emergency',
ALERT: 'alert',
CRITICAL: 'critical',
@ -22,5 +15,4 @@
NOTICE: 'notice',
INFO: 'info',
DEBUG: 'debug'
});
}(window.jsOMS = window.jsOMS || {}));
});

View File

@ -1,3 +1,6 @@
import { LogLevel } from './LogLevel.js';
import { Request } from '../Message/Request/Request.js';
/**
* Logger class.
*
@ -6,13 +9,7 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
/** @namespace jsOMS.Log */
jsOMS.Autoloader.defineNamespace('jsOMS.Log');
jsOMS.Log.Logger = class {
export class Logger {
/**
* @constructor
*
@ -42,11 +39,11 @@
*/
static getInstance (verbose = true, ui = true, remote = false)
{
if(!jsOMS.Log.Logger.instance) {
jsOMS.Log.Logger.instance = new jsOMS.Log.Logger(verbose, ui, remote);
if(!Logger.instance) {
Logger.instance = new Logger(verbose, ui, remote);
}
return jsOMS.Log.Logger.instance;
return Logger.instance;
};
/**
@ -62,7 +59,7 @@
*/
interpolate (message, context, level)
{
message = typeof message === 'undefined' ? jsOMS.Log.Logger.MSG_FULL : message;
message = typeof message === 'undefined' ? Logger.MSG_FULL : message;
for (let replace in context) {
if (context.hasOwnProperty(replace) && typeof message === 'string') {
@ -88,8 +85,8 @@
{
context.datetime = (new Date()).toISOString();
context.version = '1.0.0';
context.os = jsOMS.Message.Request.Request.getOS();
context.browser = jsOMS.Message.Request.Request.getBrowser();
context.os = Request.getOS();
context.browser = Request.getBrowser();
context.path = window.location.href;
context.level = level;
context.message = message;
@ -177,11 +174,11 @@
*/
writeRemote (message, context, level)
{
let request = new jsOMS.Message.Request.Request();
let request = new Request();
request.setData(context);
request.setType(jsOMS.Message.Response.Response.ResponseType.JSON);
request.setUri('/{/lang}/api/log');
request.setMethod(jsOMS.Message.Request.Request.RequestMethod.POST);
request.setMethod(Request.RequestMethod.POST);
request.setRequestHeader('Content-Type', 'application/json');
request.setSuccess(function (xhr)
{
@ -201,7 +198,7 @@
*/
emergency (message, context = {})
{
this.write(message, context, jsOMS.Log.LogLevel.EMERGENCY);
this.write(message, context, LogLevel.EMERGENCY);
};
/**
@ -216,7 +213,7 @@
*/
alert (message, context = {})
{
this.write(message, context, jsOMS.Log.LogLevel.ALERT);
this.write(message, context, LogLevel.ALERT);
};
/**
@ -231,7 +228,7 @@
*/
critical (message, context = {})
{
this.write(message, context, jsOMS.Log.LogLevel.CRITICAL);
this.write(message, context, LogLevel.CRITICAL);
};
/**
@ -246,7 +243,7 @@
*/
error (message, context = {})
{
this.write(message, context, jsOMS.Log.LogLevel.ERROR);
this.write(message, context, LogLevel.ERROR);
};
/**
@ -261,7 +258,7 @@
*/
warning (message, context = {})
{
this.write(message, context, jsOMS.Log.LogLevel.WARNING);
this.write(message, context, LogLevel.WARNING);
};
/**
@ -276,7 +273,7 @@
*/
notice (message, context = {})
{
this.write(message, context, jsOMS.Log.LogLevel.NOTICE);
this.write(message, context, LogLevel.NOTICE);
};
/**
@ -291,7 +288,7 @@
*/
info (message, context = {})
{
this.write(message, context, jsOMS.Log.LogLevel.INFO);
this.write(message, context, LogLevel.INFO);
};
/**
@ -306,7 +303,7 @@
*/
debug (message, context = {})
{
this.write(message, context, jsOMS.Log.LogLevel.DEBUG);
this.write(message, context, LogLevel.DEBUG);
};
/**
@ -337,10 +334,9 @@
*/
console (message, context = {})
{
this.writeVerbose(message, context, jsOMS.Log.LogLevel.INFO);
this.writeVerbose(message, context, LogLevel.INFO);
};
}
}
jsOMS.Log.Logger.instance = null;
jsOMS.Log.Logger.MSG_FULL = '{datetime}; {level}; {version}; {os}; {browser}; {path}; {message}';
}(window.jsOMS = window.jsOMS || {}));
Logger.instance = null;
Logger.MSG_FULL = '{datetime}; {level}; {version}; {os}; {browser}; {path}; {message}';

View File

@ -6,14 +6,7 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
/** @namespace jsOMS.Message.Notification.App */
jsOMS.Autoloader.defineNamespace('jsOMS.Message.Notification.App');
jsOMS.Message.Notification.App.AppNotification = class {
export class AppNotification {
/**
* @constructor
*
@ -67,5 +60,4 @@
document.getElementsByClassName('log-msg')[0].remove();
}, 3000);
};
}
}(window.jsOMS = window.jsOMS || {}));
};

View File

@ -6,14 +6,7 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
/** @namespace jsOMS.Message.Notification.Browser */
jsOMS.Autoloader.defineNamespace('jsOMS.Message.Notification.Browser');
jsOMS.Message.Notification.Browser.BrowserNotification = class {
export class BrowserNotification {
/**
* @constructor
*
@ -76,5 +69,4 @@
/** global: Notification */
let n = new Notification(/* ... */);
};
}
}(window.jsOMS = window.jsOMS || {}));
};

View File

@ -6,16 +6,9 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS) {
"use strict";
/** @namespace jsOMS.Message.Notification */
jsOMS.Autoloader.defineNamespace('jsOMS.Message.Notification');
jsOMS.Message.Notification.NotificationLevel = Object.freeze({
export const NotificationLevel = Object.freeze({
OK: 'ok',
INFO: 'info',
WARNING: 'warning',
ERROR: 'error'
});
}(window.jsOMS = window.jsOMS || {}));
});

View File

@ -1,3 +1,7 @@
import { AppNotification } from '../../../jsOMS/Message/Notification/App/AppNotification.js';
import { BrowserNotification } from '../../../jsOMS/Message/Notification/Browser/BrowserNotification.js';
import { NotificationType } from '../../../jsOMS/Message/Notification/NotificationType.js';
/**
* Notification manager.
*
@ -6,14 +10,7 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
/** @namespace jsOMS.Message.Notification */
jsOMS.Autoloader.defineNamespace('jsOMS.Message.Notification');
jsOMS.Message.Notification.NotificationManager = class {
export class NotificationManager {
/**
* @constructor
*
@ -21,8 +18,8 @@
*/
constructor()
{
this.appNotifier = new jsOMS.Message.Notification.App.AppNotification();
this.browserNotifier = new jsOMS.Message.Notification.Browser.BrowserNotification();
this.appNotifier = new AppNotification();
this.browserNotifier = new BrowserNotification();
};
/**
@ -37,7 +34,7 @@
*/
send (message, type)
{
if (jsOMS.Message.Notification.NotificationType.APP_NOTIFICATION === type) {
if (NotificationType.APP_NOTIFICATION === type) {
this.appNotifier.send(message);
} else {
this.browserNotifier.send(message);
@ -67,5 +64,4 @@
{
return this.browserNotifier;
};
}
}(window.jsOMS = window.jsOMS || {}));
};

View File

@ -6,13 +6,7 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS) {
"use strict";
/** @namespace jsOMS.Message.Notification.App */
jsOMS.Autoloader.defineNamespace('jsOMS.Message.Notification');
jsOMS.Message.Notification.NotificationMessage = class {
export class NotificationMessage {
/**
* @constructor
*
@ -28,5 +22,4 @@
this.title = title;
this.message = message;
};
}
}(window.jsOMS = window.jsOMS || {}));
};

View File

@ -6,15 +6,7 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
/** @namespace jsOMS.Message.Notification */
jsOMS.Autoloader.defineNamespace('jsOMS.Message.Notification');
jsOMS.Message.Notification.NotificationType = Object.freeze({
export const NotificationType = Object.freeze({
APP_NOTIFICATION: 1,
BROWSER_NOTIFICATION: 2
});
}(window.jsOMS = window.jsOMS || {}));
});

View File

@ -6,14 +6,7 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
/** @namespace jsOMS.Message.Request */
jsOMS.Autoloader.defineNamespace('jsOMS.Message.Request');
jsOMS.Message.Request.BrowserType = Object.freeze({
export const BrowserType = Object.freeze({
OPERA: 'opera',
FIREFOX: 'firefox',
SAFARI: 'safari',
@ -22,5 +15,4 @@
CHROME: 'chrome',
BLINK: 'blink',
UNKNOWN: 'unknown'
});
}(window.jsOMS = window.jsOMS || {}));
});

View File

@ -6,14 +6,7 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
/** @namespace jsOMS.Message.Request */
jsOMS.Autoloader.defineNamespace('jsOMS.Message.Request');
jsOMS.Message.Request.OSType = Object.freeze({
export const OSType = Object.freeze({
WINDOWS_10: 'windows nt 10.0', /* Windows 10 */
WINDOWS_81: 'windows nt 6.3', /* Windows 8.1 */
WINDOWS_8: 'windows nt 6.2', /* Windows 8 */
@ -39,5 +32,4 @@
BLACKBERRY: 'blackberry', /* Blackberry */
MOBILE: 'webos', /* Mobile */
UNKNOWN: 'UNKNOWN' /* Unknown */
});
}(window.jsOMS = window.jsOMS || {}));
});

View File

@ -1,3 +1,10 @@
import { RequestMethod } from './RequestMethod.js'
import { RequestType } from './RequestType.js'
import { BrowserType } from './BrowserType.js'
import { OSType } from './OSType.js'
import { UriFactory } from '../../Uri/UriFactory.js'
import { Logger } from '../../Log/Logger.js'
/**
* Request class.
*
@ -6,14 +13,7 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
/** @namespace jsOMS.Message.Request */
jsOMS.Autoloader.defineNamespace('jsOMS.Message.Request');
jsOMS.Message.Request.Request = class {
export class Request {
/**
* @constructor
*
@ -26,17 +26,17 @@
constructor (uri = null, method, type)
{
this.uri = uri;
this.method = typeof method !== 'undefined' ? method : jsOMS.Message.Request.RequestMethod.GET;
this.method = typeof method !== 'undefined' ? method : RequestMethod.GET;
this.requestHeader = [];
this.result = {};
this.type = typeof type !== 'undefined' ? type : jsOMS.Message.Request.RequestType.JSON;
this.type = typeof type !== 'undefined' ? type : RequestType.JSON;
this.data = {};
this.requestHeader['Content-Type'] = this.setContentTypeBasedOnType(this.type);
this.result[0] = function()
{
jsOMS.Log.Logger.instance.info('Unhandled response');
Logger.instance.info('Unhandled response');
};
/** global: XMLHttpRequest */
@ -53,11 +53,11 @@
setContentTypeBasedOnType(type)
{
switch(type) {
case jsOMS.Message.Request.RequestType.JSON:
case RequestType.JSON:
return 'application/json';
case jsOMS.Message.Request.RequestType.URL_ENCODE:
case RequestType.URL_ENCODE:
return 'application/x-www-form-urlencoded';
case jsOMS.Message.Request.RequestType.FILE:
case RequestType.FILE:
return '';
default:
return 'text/plain';
@ -76,25 +76,25 @@
/** global: InstallTrigger */
/** global: navigator */
if ((!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0) {
return jsOMS.Message.Request.BrowserType.OPERA;
return BrowserType.OPERA;
} else if (typeof InstallTrigger !== 'undefined') {
return jsOMS.Message.Request.BrowserType.FIREFOX;
return BrowserType.FIREFOX;
} else if (Object.toString.call(window.HTMLElement).indexOf('Constructor') > 0) {
return jsOMS.Message.Request.BrowserType.SAFARI;
return BrowserType.SAFARI;
} else if (/*@cc_on!@*/false || !!document.documentMode) {
return jsOMS.Message.Request.BrowserType.IE;
return BrowserType.IE;
} else if (!!window.StyleMedia) {
return jsOMS.Message.Request.BrowserType.EDGE;
return BrowserType.EDGE;
} else if (!!window.chrome && !!window.chrome.webstore) {
return jsOMS.Message.Request.BrowserType.CHROME;
return BrowserType.CHROME;
} else if (((typeof isChrome !== 'undefined' && isChrome)
|| (typeof isOpera !== 'undefined' && isOpera))
&& !!window.CSS
) {
return jsOMS.Message.Request.BrowserType.BLINK;
return BrowserType.BLINK;
}
return jsOMS.Message.Request.BrowserType.UNKNOWN;
return BrowserType.UNKNOWN;
};
/**
@ -106,16 +106,16 @@
*/
static getOS()
{
for (let os in jsOMS.Message.Request.OSType) {
if (jsOMS.Message.Request.OSType.hasOwnProperty(os)) {
for (let os in OSType) {
if (OSType.hasOwnProperty(os)) {
/** global: navigator */
if (navigator.appVersion.toLowerCase().indexOf(jsOMS.Message.Request.OSType[os]) !== -1) {
return jsOMS.Message.Request.OSType[os];
if (navigator.appVersion.toLowerCase().indexOf(OSType[os]) !== -1) {
return OSType[os];
}
}
}
return jsOMS.Message.Request.OSType.UNKNOWN;
return OSType.UNKNOWN;
};
/**
@ -348,7 +348,7 @@
const self = this;
if (this.xhr.readyState !== 1) {
this.xhr.open(this.method, jsOMS.Uri.UriFactory.build(this.uri));
this.xhr.open(this.method, UriFactory.build(this.uri));
for (let p in this.requestHeader) {
if (this.requestHeader.hasOwnProperty(p) && this.requestHeader[p] !== '') {
@ -373,15 +373,14 @@
}
};
if (this.type === jsOMS.Message.Request.RequestType.JSON) {
if (this.type === RequestType.JSON) {
this.xhr.send(JSON.stringify(this.data));
} else if (this.type === jsOMS.Message.Request.RequestType.RAW
|| this.type === jsOMS.Message.Request.RequestType.FILE
} else if (this.type === RequestType.RAW
|| this.type === RequestType.FILE
) {
this.xhr.send(this.data);
} else if (this.type === jsOMS.Message.Request.RequestType.URL_ENCODE) {
} else if (this.type === RequestType.URL_ENCODE) {
this.xhr.send(this.queryfy(this.data));
}
};
}
}(window.jsOMS = window.jsOMS || {}));
};

View File

@ -6,18 +6,10 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
/** @namespace jsOMS.Message.Request */
jsOMS.Autoloader.defineNamespace('jsOMS.Message.Request');
jsOMS.Message.Request.RequestMethod = Object.freeze({
export const RequestMethod = Object.freeze({
POST: 'POST',
GET: 'GET',
PUT: 'PUT',
DELETE: 'DELETE',
HEAD: 'HEAD'
});
}(window.jsOMS = window.jsOMS || {}));
});

View File

@ -6,17 +6,9 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
/** @namespace jsOMS.Message.Request */
jsOMS.Autoloader.defineNamespace('jsOMS.Message.Request');
jsOMS.Message.Request.RequestType = Object.freeze({
export const RequestType = Object.freeze({
JSON: 'json',
RAW: 'raw',
FILE: 'file',
URL_ENCODE: 'url'
});
}(window.jsOMS = window.jsOMS || {}));
});

View File

@ -8,14 +8,7 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
/** @namespace jsOMS.Message.Response */
jsOMS.Autoloader.defineNamespace('jsOMS.Message.Response');
jsOMS.Message.Response.Response = class {
export class Response {
/**
* @constructor
*
@ -53,5 +46,4 @@
{
return this.responses.length;
};
}
}(window.jsOMS = window.jsOMS || {}));
};

View File

@ -8,14 +8,7 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
/** @namespace jsOMS.Message.Response */
jsOMS.Autoloader.defineNamespace('jsOMS.Message.Response');
jsOMS.Message.Response.ResponseManager = class {
export class ResponseManager {
/**
* @constructor
*
@ -72,5 +65,4 @@
jsOMS.Log.Logger.instance.warning('Undefined type: ' + key);
}
};
}
}(window.jsOMS = window.jsOMS || {}));
};

View File

@ -6,19 +6,11 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
/** @namespace jsOMS.Message.Response */
jsOMS.Autoloader.defineNamespace('jsOMS.Message.Response');
jsOMS.Message.Response.ResponseType = Object.freeze({
export const ResponseType = Object.freeze({
TEXT: 'text',
JSON: 'json',
DOCUMENT: 'document',
BLOB: 'blob',
ARRAYBUFFER: 'arraybuffer',
DEFAULT: ''
});
}(window.jsOMS = window.jsOMS || {}));
});

View File

@ -6,7 +6,7 @@
*
* @since 1.0.0
*/
const datalistAppend = function (action, callback)
export function datalistAppend (action, callback)
{
"use strict";

View File

@ -6,7 +6,7 @@
*
* @since 1.0.0
*/
const datalistClear = function (action, callback)
export function datalistClear (action, callback)
{
"use strict";

View File

@ -1,4 +1,4 @@
const focusAction = function (action, callback)
export function focusAction (action, callback)
{
"use strict";

View File

@ -7,7 +7,7 @@
*
* @since 1.0.0
*/
const domGetValue = function (action, callback, id)
export function domGetValue (action, callback, id)
{
"use strict";

View File

@ -1,4 +1,4 @@
const hideAction = function (action, callback)
export function hideAction (action, callback)
{
"use strict";

View File

@ -7,7 +7,7 @@
*
* @since 1.0.0
*/
const popupButtonAction = function (action, callback, id)
export function popupButtonAction (action, callback, id)
{
"use strict";

View File

@ -7,7 +7,7 @@
*
* @since 1.0.0
*/
const removeButtonAction = function (action, callback, id)
export function removeButtonAction (action, callback, id)
{
"use strict";

View File

@ -7,7 +7,7 @@
*
* @since 1.0.0
*/
const domRemoveValue = function (action, callback, id)
export function domRemoveValue (action, callback, id)
{
"use strict";

View File

@ -7,7 +7,7 @@
*
* @since 1.0.0
*/
const domSetValue = function (action, callback, id)
export function domSetValue (action, callback, id)
{
"use strict";

View File

@ -1,4 +1,4 @@
const showAction = function (action, callback)
export function showAction (action, callback)
{
"use strict";

View File

@ -6,7 +6,7 @@
*
* @since 1.0.0
*/
const tableAppend = function (action, callback)
export function tableAppend (action, callback)
{
"use strict";

View File

@ -6,7 +6,7 @@
*
* @since 1.0.0
*/
const tableClear = function (action, callback)
export function tableClear (action, callback)
{
"use strict";

View File

@ -7,7 +7,7 @@
*
* @since 1.0.0
*/
const preventEvent = function (action, callback, id)
export function preventEvent (action, callback, id)
{
"use strict";

View File

@ -6,7 +6,7 @@
*
* @since 1.0.0
*/
const logAction = function (action, callback)
export function logAction (action, callback)
{
"use strict";

View File

@ -6,7 +6,7 @@
*
* @since 1.0.0
*/
const requestAction = function (action, callback)
export function requestAction (action, callback)
{
"use strict";

View File

@ -6,7 +6,7 @@
*
* @since 1.0.0
*/
const dataCollectionAction = function (action, callback)
export function dataCollectionAction (action, callback)
{
"use strict";

View File

@ -7,7 +7,7 @@
* @since 1.0.0
*/
const timerActionDelay = {};
const timerAction = function (action, callback, data)
export function timerAction (action, callback, data)
{
"use strict";

View File

@ -6,7 +6,7 @@
*
* @since 1.0.0
*/
const validateKeypress = function (action, callback)
export function validateKeypress (action, callback)
{
"use strict";

View File

@ -5,7 +5,7 @@
*
* @since 1.0.0
*/
const domAction = function (data)
export function domAction (data)
{
/** global: jsOMS */
setTimeout(function ()

View File

@ -1,7 +1,4 @@
(function (jsOMS) {
"use strict";
jsOMS.EnumDomActionType = Object.freeze({
export const EnumDomActionType = Object.freeze({
CREATE_BEFORE: 0,
CREATE_AFTER: 1,
DELETE: 2,
@ -11,5 +8,4 @@
HIDE: 6,
ACTIVATE: 7,
DEACTIVATE: 8
});
} (window.jsOMS = window.jsOMS || {}));
});

View File

@ -5,7 +5,7 @@
*
* @since 1.0.0
*/
const formValidationMessage = function (data) {
export function formValidationMessage (data) {
const form = document.getElementById(data.form);
if(!form) {

View File

@ -5,7 +5,7 @@
*
* @since 1.0.0
*/
const notifyMessage = function (data)
export function notifyMessage (data)
{
setTimeout(function ()
{

View File

@ -1,11 +1,8 @@
(function (jsOMS) {
"use strict";
jsOMS.EnumNotifyType = Object.freeze({
export const EnumNotifyType = Object.freeze({
BINARY: 0,
INFO: 1,
WARNING: 2,
ERROR: 3,
FATAL: 4
});
}(window.jsOMS = window.jsOMS || {}));
});

View File

@ -1,3 +1,5 @@
import { UriFactory } from '../../Uri/UriFactory.js';
/**
* Set message.
*
@ -5,11 +7,11 @@
*
* @since 1.0.0
*/
const redirectMessage = function (data)
export function redirectMessage (data)
{
setTimeout(function ()
{
/** global: jsOMS */
window.location = jsOMS.Uri.UriFactory.build(data.uri);
window.location = UriFactory.build(data.uri);
}, parseInt(data.delay));
};

View File

@ -5,7 +5,7 @@
*
* @since 1.0.0
*/
const reloadMessage = function (data) {
export function reloadMessage (data) {
setTimeout(function () {
document.location.reload(true);
}, parseInt(data.delay));

View File

@ -6,13 +6,7 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
jsOMS.Autoloader.defineNamespace('jsOMS.Module');
jsOMS.Module.ModuleFactory = class {
export class ModuleFactory {
/**
* @constructor
*
@ -36,5 +30,4 @@
{
return new jsOMS.Modules[module](app);
};
}
}(window.jsOMS = window.jsOMS || {}));
};

View File

@ -1,3 +1,4 @@
import { ModuleFactory } from './ModuleFactory.js';
/**
* Module manager.
*
@ -6,14 +7,7 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
/** @namespace jsOMS.Module */
jsOMS.Autoloader.defineNamespace('jsOMS.Module');
jsOMS.Module.ModuleManager = class {
export class ModuleManager {
/**
* @constructor
*
@ -39,10 +33,9 @@
get (module)
{
if (typeof this.modules[module] === 'undefined') {
this.modules[module] = jsOMS.Module.ModuleFactory.getInstance(module, this.app);
this.modules[module] = ModuleFactory.getInstance(module, this.app);
}
return this.modules[module];
};
}
}(window.jsOMS = window.jsOMS || {}));
};

View File

@ -6,14 +6,7 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
/** @namespace jsOMS.UI */
jsOMS.Autoloader.defineNamespace('jsOMS.UI.ActionManager');
jsOMS.UI.ActionManager = class {
export class ActionManager {
/**
* @constructor
*
@ -193,5 +186,4 @@
{
this.actions[name] = callback;
};
}
}(window.jsOMS = window.jsOMS || {}));
};

View File

@ -1,3 +1,4 @@
import { Request } from '../../Message/Request/Request.js';
/**
* Advanced input class.
*
@ -9,14 +10,7 @@
* @todo: this class is probably the most stupid thing I've done in a long time. Seriously fix this!
* @todo: Passing self to every MEMBER function is just dumb.
*/
(function (jsOMS)
{
"use strict";
/** @namespace jsOMS.UI */
jsOMS.Autoloader.defineNamespace('jsOMS.UI.Component');
jsOMS.UI.Component.AdvancedInput = class {
export class AdvancedInput {
/**
* @constructor
*
@ -192,7 +186,7 @@
{
// if remote data
if (typeof self.src !== 'undefined' && self.src !== '') {
const request = new jsOMS.Message.Request.Request(self.src);
const request = new Request(self.src);
request.setSuccess(function (data) { self.remoteCallback(self, data); });
request.send();
}
@ -313,17 +307,16 @@
*/
inputTimeDelay(action, callback, self, data)
{
if (jsOMS.UI.Component.AdvancedInput.timerDelay[action.id]) {
clearTimeout(jsOMS.UI.Component.AdvancedInput.timerDelay[action.id]);
delete jsOMS.UI.Component.AdvancedInput.timerDelay[action.id]
if (AdvancedInput.timerDelay[action.id]) {
clearTimeout(AdvancedInput.timerDelay[action.id]);
delete AdvancedInput.timerDelay[action.id]
}
jsOMS.UI.Component.AdvancedInput.timerDelay[action.id] = setTimeout(function() {
delete jsOMS.UI.Component.AdvancedInput.timerDelay[action.id];
AdvancedInput.timerDelay[action.id] = setTimeout(function() {
delete AdvancedInput.timerDelay[action.id];
callback(self, data);
}, action.delay);
};
}
};
jsOMS.UI.Component.AdvancedInput.timerDelay = {};
}(window.jsOMS = window.jsOMS || {}));
AdvancedInput.timerDelay = {};

View File

@ -1,3 +1,10 @@
import { Logger } from '../../Log/Logger.js';
import { FormView } from '../../Views/FormView.js';
import { Request } from '../../Message/Request/Request.js';
import { RequestMethod } from '../../Message/Request/RequestMethod.js';
import { Response } from '../../Message/Response/Response.js';
import { ResponseType } from '../../Message/Response/ResponseType.js';
/**
* Form manager class.
*
@ -6,14 +13,7 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
/** @namespace jsOMS.UI */
jsOMS.Autoloader.defineNamespace('jsOMS.UI.Component');
jsOMS.UI.Component.Form = class {
export class Form {
/**
* @constructor
*
@ -112,12 +112,12 @@
bindForm (id)
{
if (typeof id === 'undefined' || !id) {
jsOMS.Log.Logger.instance.info('A form doesn\'t have an ID.');
Logger.instance.info('A form doesn\'t have an ID.');
return;
}
const self = this;
this.forms[id] = new jsOMS.Views.FormView(id);
this.forms[id] = new FormView(id);
this.unbind(id);
@ -193,7 +193,7 @@
return;
}
} else {
jsOMS.Log.Logger.instance.warning('Invalid property.');
Logger.instance.warning('Invalid property.');
}
}
@ -217,14 +217,14 @@
{
if (!form.isValid()) {
this.app.notifyManager.send(
new jsOMS.Message.Notification.NotificationMessage(jsOMS.Message.Notification.NotificationLevel.INFO, jsOMS.lang.Info, jsOMS.lang.invalid_form), jsOMS.Message.Notification.NotificationType.APP_NOTIFICATION
new NotificationMessage(NotificationLevel.INFO, jsOMS.lang.Info, jsOMS.lang.invalid_form), NotificationType.APP_NOTIFICATION
);
jsOMS.Log.Logger.instance.debug('Form "' + form.getId() + '" has invalid values.');
Logger.instance.debug('Form "' + form.getId() + '" has invalid values.');
return;
}
if (form.getMethod() !== jsOMS.Message.Request.RequestMethod.GET
if (form.getMethod() !== RequestMethod.GET
&& Math.abs(Date.now() - form.getLastSubmit()) < 500
) {
return;
@ -233,11 +233,11 @@
form.updateLastSubmit();
/* Handle default submit */
const request = new jsOMS.Message.Request.Request(),
const request = new Request(),
self = this;
request.setData(form.getData());
request.setType(jsOMS.Message.Response.ResponseType.JSON);
request.setType(ResponseType.JSON);
request.setUri(form.getAction());
request.setMethod(form.getMethod());
request.setRequestHeader('Content-Type', 'application/json');
@ -247,7 +247,7 @@
try {
const o = JSON.parse(xhr.response),
response = new jsOMS.Message.Response.Response(o);
response = new Response(o);
let successInject = null;
if ((successInject = form.getSuccess()) !== null) {
@ -259,13 +259,13 @@
self.app.responseManager.run(response.get(0).type, response.get(0), request);
} else if (typeof o.status !== 'undefined') {
self.app.notifyManager.send(
new jsOMS.Message.Notification.NotificationMessage(o.status, o.title, o.message), jsOMS.Message.Notification.NotificationType.APP_NOTIFICATION
new NotificationMessage(o.status, o.title, o.message), NotificationType.APP_NOTIFICATION
);
}
} catch (e) {
console.log(e);
jsOMS.Log.Logger.instance.error('Invalid form response. \n'
Logger.instance.error('Invalid form response. \n'
+ 'URL: ' + form.getAction() + '\n'
+ 'Request: ' + JSON.stringify(form.getData()) + '\n'
+ 'Response: ' + xhr.response
@ -276,11 +276,11 @@
request.setResultCallback(0, function (xhr)
{
self.app.notifyManager.send(
new jsOMS.Message.Notification.NotificationMessage(
jsOMS.Message.Notification.NotificationLevel.ERROR,
new NotificationMessage(
NotificationLevel.ERROR,
'Failure',
'Some failure happend'
), jsOMS.Message.Notification.NotificationType.APP_NOTIFICATION
), NotificationType.APP_NOTIFICATION
);
});
@ -302,5 +302,4 @@
{
return this.forms.length;
};
}
}(window.jsOMS = window.jsOMS || {}));
};

View File

@ -6,14 +6,7 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
/** @namespace jsOMS.UI.Input*/
jsOMS.Autoloader.defineNamespace('jsOMS.UI.Input');
jsOMS.UI.Input = class {
export class Input {
/**
* @constructor
*
@ -120,17 +113,17 @@
{
this.clearDatalistOptions(datalist);
const request = new jsOMS.Message.Request();
const request = new Request();
request.setData(input.value);
request.setType(jsOMS.Message.Response.ResponseType.JSON);
request.setType(ResponseType.JSON);
request.setUri(datalist.getAttribute('data-list-src'));
request.setMethod(jsOMS.Message.Request.RequestMethod.POST);
request.setMethod(RequestMethod.POST);
request.setRequestHeader('Content-Type', 'application/json');
request.setSuccess(function (xhr)
{
try {
const o = JSON.parse(xhr.response),
response = new jsOMS.Message.Response(o),
response = new Response(o),
responseLength = response.count();
let tempResponse = null,
success = null;
@ -151,7 +144,7 @@
}
}
} catch (exception) {
jsOMS.Log.Logger.instance.error('Invalid JSON object: ' + xhr, 'FormManager');
Logger.instance.error('Invalid JSON object: ' + xhr, 'FormManager');
}
});
@ -175,5 +168,4 @@
datalist.remove(0);
}
};
}
}(window.jsOMS = window.jsOMS || {}));
};

View File

@ -1,3 +1,6 @@
import { UriFactory } from '../../Uri/UriFactory.js';
import { Http } from '../../Uri/Http.js';
/**
* Tab manager class.
*
@ -6,13 +9,7 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
jsOMS.Autoloader.defineNamespace('jsOMS.UI.Component');
jsOMS.UI.Component.Tab = class {
export class Tab {
/**
* @constructor
*
@ -67,7 +64,7 @@
for (let i = 0; i < length; ++i) {
nodes[i].addEventListener('click', function (evt)
{
let fragmentString = window.location.href.includes('#') ? jsOMS.Uri.Http.parseUrl(window.location.href).fragment : '';
let fragmentString = window.location.href.includes('#') ? Http.parseUrl(window.location.href).fragment : '';
/* Change Tab */
/* Remove selected tab */
@ -94,7 +91,7 @@
/* Add selected tab */
window.history.pushState(null, '',
jsOMS.Uri.UriFactory.build(
UriFactory.build(
'{%}#' + (fragmentString === '' ? '' : fragmentString + ',') + this.getElementsByTagName('label')[0].getAttribute('for')
)
);
@ -117,7 +114,7 @@
*/
activateTabUri(e)
{
const fragmentString = window.location.href.includes('#') ? jsOMS.Uri.Http.parseUrl(window.location.href).fragment : '';
const fragmentString = window.location.href.includes('#') ? Http.parseUrl(window.location.href).fragment : '';
const fragments = fragmentString.split(','),
fragLength = fragments.length;
@ -134,5 +131,4 @@
e.querySelector('label').click();
}
};
}
}(window.jsOMS = window.jsOMS || {}));
};

View File

@ -1,3 +1,6 @@
import { TableView } from '../../Views/TableView.js';
import { Request } from '../../Message/Request/Request.js';
import { ResponseType } from '../../Message/Response/ResponseType.js';
/**
* Table manager class.
*
@ -6,13 +9,7 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
jsOMS.Autoloader.defineNamespace('jsOMS.UI.Component');
jsOMS.UI.Component.Table = class {
export class Table {
/**
* @constructor
*
@ -83,7 +80,7 @@
return;
}
this.tables[id] = new jsOMS.Views.TableView(id);
this.tables[id] = new TableView(id);
this.unbind(id);
@ -247,7 +244,7 @@
table.setAttribute('data-sorting', (sortType > 0 ? '+' : '-') + (columnName !== null ? columnName : cellId));
if (table.getAttribute('data-src') !== null) {
jsOMS.UI.Component.Table.getRemoteData(table);
Table.getRemoteData(table);
return;
}
@ -342,7 +339,7 @@
document.getElementById('table-filter').parentNode.removeChild(document.getElementById('table-filter'));
if (table.getAttribute('data-src') !== null) {
jsOMS.UI.Component.Table.getRemoteData(table);
Table.getRemoteData(table);
return;
}
@ -480,15 +477,15 @@
filter: table.getAttribute('data-filter')
};
const request = new jsOMS.Message.Request.Request();
const request = new Request();
request.setData(data);
request.setType(jsOMS.Message.Response.ResponseType.JSON);
request.setType(ResponseType.JSON);
request.setUri(table.getAttribute('data-src'));
request.setMethod('GET');
request.setRequestHeader('Content-Type', 'application/json');
request.setSuccess(function (xhr) {
jsOMS.UI.Component.Table.emptyTable(table.getElementsByTagName('tbody')[0]);
jsOMS.UI.Component.Table.addToTable(table.getElementsByTagName('tbody')[0], JSON.parse(xhr.response));
Table.emptyTable(table.getElementsByTagName('tbody')[0]);
Table.addToTable(table.getElementsByTagName('tbody')[0], JSON.parse(xhr.response));
});
request.send();
@ -625,5 +622,4 @@
}
});
};
}
}(window.jsOMS = window.jsOMS || {}));
};

View File

@ -6,14 +6,7 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
/** @namespace jsOMS.UI.DragNDrop*/
jsOMS.Autoloader.defineNamespace('jsOMS.UI.DragNDrop');
jsOMS.UI.DragNDrop = class {
export class DragNDrop {
/**
* @constructor
*
@ -130,5 +123,4 @@
self.dragging = null;
}, false);
}
}
}(window.jsOMS = window.jsOMS || {}));
};

View File

@ -1,3 +1,7 @@
import { AdvancedInput } from './Component/AdvancedInput.js';
import { UriFactory } from '../Uri/UriFactory.js';
/**
* UI manager for handling basic ui elements.
*
@ -6,14 +10,7 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
/** @namespace jsOMS.UI */
jsOMS.Autoloader.defineNamespace('jsOMS.UI');
jsOMS.UI.GeneralUI = class {
export class GeneralUI {
/**
* @constructor
*
@ -62,7 +59,7 @@
for (let i = 0; i < length; ++i) {
e[i].addEventListener('click', function(event) {
jsOMS.preventAll(event);
window.location = jsOMS.Uri.UriFactory.build(this.getAttribute('data-href'));
window.location = UriFactory.build(this.getAttribute('data-href'));
});
}
};
@ -119,8 +116,7 @@
const length = e.length;
for (let i = 0; i < length; ++i) {
new jsOMS.UI.Component.AdvancedInput(e[i]);
new AdvancedInput(e[i]);
}
};
}
}(window.jsOMS = window.jsOMS || {}));
};

View File

@ -1,3 +1,7 @@
import { KeyboardManager } from '../../../jsOMS/UI/Input/Keyboard/KeyboardManager.js';
import { MouseManager } from '../../../jsOMS/UI/Input/Mouse/MouseManager.js';
import { VoiceManager } from '../../../jsOMS/UI/Input/Voice/VoiceManager.js';
/**
* UI manager class.
*
@ -6,14 +10,7 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
/** @namespace jsOMS.UI.Input */
jsOMS.Autoloader.defineNamespace('jsOMS.UI.Input');
jsOMS.UI.Input.InputManager = class {
export class InputManager {
/**
* @constructor
*
@ -21,9 +18,9 @@
*/
constructor(app)
{
this.keyboardManager = new jsOMS.UI.Input.Keyboard.KeyboardManager();
this.mouseManager = new jsOMS.UI.Input.Mouse.MouseManager();
this.voiceManager = new jsOMS.UI.Input.Voice.VoiceManager(app);
this.keyboardManager = new KeyboardManager();
this.mouseManager = new MouseManager();
this.voiceManager = new VoiceManager(app);
};
/**
@ -61,5 +58,4 @@
{
return this.voiceManager;
};
}
}(window.jsOMS = window.jsOMS || {}));
};

View File

@ -6,14 +6,7 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
/** @namespace jsOMS.UI.Input.Keyboard */
jsOMS.Autoloader.defineNamespace('jsOMS.UI.Input.Keyboard');
jsOMS.UI.Input.Keyboard.KeyboardManager = class {
export class KeyboardManager {
/**
* @constructor
*
@ -117,5 +110,4 @@
}
}
};
}
}(window.jsOMS = window.jsOMS || {}));
};

View File

@ -6,16 +6,8 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
/** @namespace jsOMS.UI.Input.Mouse */
jsOMS.Autoloader.defineNamespace('jsOMS.UI.Input.Mouse');
jsOMS.UI.Input.Mouse.ClickType = Object.freeze({
export const ClickType = Object.freeze({
LEFT: 0,
MIDDLE: 1,
RIGHT: 2
});
}(window.jsOMS = window.jsOMS || {}));
});

View File

@ -6,16 +6,8 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
/** @namespace jsOMS.UI.Input.Mouse */
jsOMS.Autoloader.defineNamespace('jsOMS.UI.Input.Mouse');
jsOMS.UI.Input.Mouse.EventType = Object.freeze({
export const EventType = Object.freeze({
CONTEXT: 0,
LONGPRESS: 1,
CLICK: 2
});
}(window.jsOMS = window.jsOMS || {}));
});

View File

@ -1,3 +1,5 @@
import { EventType } from '../../../../jsOMS/UI/Input/Mouse/EventType.js';
/**
* Mouse manager class.
*
@ -6,14 +8,7 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
/** @namespace jsOMS.UI.Input.Mouse */
jsOMS.Autoloader.defineNamespace('jsOMS.UI.Input.Mouse');
jsOMS.UI.Input.Mouse.MouseManager = class {
export class MouseManager {
/**
* @constructor
*
@ -67,12 +62,12 @@
return;
}
if (type === jsOMS.UI.Input.Mouse.EventType.CONTEXT) {
if (type === EventType.CONTEXT) {
e.addEventListener('contextmenu', function (event)
{
self.run(element, event);
}, false);
} else if (type === jsOMS.UI.Input.Mouse.EventType.LONGPRESS) {
} else if (type === EventType.LONGPRESS) {
e.addEventListener('mousedown', function (event)
{
self.click.time = new Date().getTime();
@ -88,7 +83,7 @@
self.click.time = 0;
}, false);
} else if (type === jsOMS.UI.Input.Mouse.EventType.CLICK) {
} else if (type === EventType.CLICK) {
e.addEventListener('click', function (event)
{
self.run(element, event);
@ -124,5 +119,4 @@
}
}
};
}
}(window.jsOMS = window.jsOMS || {}));
};

View File

@ -6,14 +6,7 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
/** @namespace jsOMS.UI.Input.Touch */
jsOMS.Autoloader.defineNamespace('jsOMS.UI.Input.Touch');
jsOMS.UI.Input.Touch.TouchManager = class {
export class TouchManager {
/**
* @constructor
*
@ -127,5 +120,4 @@
}
});
};
}
}(window.jsOMS = window.jsOMS || {}));
};

View File

@ -6,27 +6,7 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
/** @namespace jsOMS.UI */
jsOMS.Autoloader.defineNamespace('jsOMS.UI.Input.Voice');
// todo: remove once obsolete
/** global: webkitSpeechRecognition */
/** global: SpeechRecognition */
var SpeechRecognition = typeof SpeechRecognition !== 'undefined' ? SpeechRecognition : typeof webkitSpeechRecognition !== 'undefined' ? webkitSpeechRecognition : null;
/** global: webkitSpeechGrammarList */
/** global: SpeechGrammarList */
var SpeechGrammarList = typeof SpeechGrammarList !== 'undefined' ? SpeechGrammarList : typeof webkitSpeechGrammarList !== 'undefined' ? webkitSpeechGrammarList : null;
/** global: webkitSpeechRecognitionEvent */
/** global: SpeechRecognitionEvent */
var SpeechRecognitionEvent = typeof SpeechRecognitionEvent !== 'undefined' ? SpeechRecognitionEvent : typeof webkitSpeechRecognitionEvent !== 'undefined' ? webkitSpeechRecognitionEvent : null;
jsOMS.UI.Input.Voice.ReadManager = class {
export class ReadManager {
/**
* @constructor
*
@ -122,5 +102,17 @@
{
return this.voices;
};
}
}(window.jsOMS = window.jsOMS || {}));
};
// todo: remove once obsolete
/** global: webkitSpeechRecognition */
/** global: SpeechRecognition */
var SpeechRecognition = typeof SpeechRecognition !== 'undefined' ? SpeechRecognition : typeof webkitSpeechRecognition !== 'undefined' ? webkitSpeechRecognition : null;
/** global: webkitSpeechGrammarList */
/** global: SpeechGrammarList */
var SpeechGrammarList = typeof SpeechGrammarList !== 'undefined' ? SpeechGrammarList : typeof webkitSpeechGrammarList !== 'undefined' ? webkitSpeechGrammarList : null;
/** global: webkitSpeechRecognitionEvent */
/** global: SpeechRecognitionEvent */
var SpeechRecognitionEvent = typeof SpeechRecognitionEvent !== 'undefined' ? SpeechRecognitionEvent : typeof webkitSpeechRecognitionEvent !== 'undefined' ? webkitSpeechRecognitionEvent : null;

View File

@ -6,27 +6,7 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
/** @namespace jsOMS.UI */
jsOMS.Autoloader.defineNamespace('jsOMS.UI.Input.Voice');
// todo: remove once obsolete
/** global: webkitSpeechRecognition */
/** global: SpeechRecognition */
var SpeechRecognition = typeof SpeechRecognition !== 'undefined' ? SpeechRecognition : typeof webkitSpeechRecognition !== 'undefined' ? webkitSpeechRecognition : null;
/** global: webkitSpeechGrammarList */
/** global: SpeechGrammarList */
var SpeechGrammarList = typeof SpeechGrammarList !== 'undefined' ? SpeechGrammarList : typeof webkitSpeechGrammarList !== 'undefined' ? webkitSpeechGrammarList : null;
/** global: webkitSpeechRecognitionEvent */
/** global: SpeechRecognitionEvent */
var SpeechRecognitionEvent = typeof SpeechRecognitionEvent !== 'undefined' ? SpeechRecognitionEvent : typeof webkitSpeechRecognitionEvent !== 'undefined' ? webkitSpeechRecognitionEvent : null;
jsOMS.UI.Input.Voice.VoiceManager = class {
export class VoiceManager {
/**
* @constructor
*
@ -173,5 +153,17 @@
this.recognition.stop();
};
}
}(window.jsOMS = window.jsOMS || {}));
};
// todo: remove once obsolete
/** global: webkitSpeechRecognition */
/** global: SpeechRecognition */
var SpeechRecognition = typeof SpeechRecognition !== 'undefined' ? SpeechRecognition : typeof webkitSpeechRecognition !== 'undefined' ? webkitSpeechRecognition : null;
/** global: webkitSpeechGrammarList */
/** global: SpeechGrammarList */
var SpeechGrammarList = typeof SpeechGrammarList !== 'undefined' ? SpeechGrammarList : typeof webkitSpeechGrammarList !== 'undefined' ? webkitSpeechGrammarList : null;
/** global: webkitSpeechRecognitionEvent */
/** global: SpeechRecognitionEvent */
var SpeechRecognitionEvent = typeof SpeechRecognitionEvent !== 'undefined' ? SpeechRecognitionEvent : typeof webkitSpeechRecognitionEvent !== 'undefined' ? webkitSpeechRecognitionEvent : null;

View File

@ -1,3 +1,10 @@
import { Form } from '../UI/Component/Form.js';
import { Tab } from '../UI/Component/Tab.js';
import { Table } from '../UI/Component/Table.js';
import { ActionManager } from '../UI/ActionManager.js';
import { DragNDrop } from '../UI/DragNDrop.js';
import { GeneralUI } from '../UI/GeneralUI.js';
/**
* UI manager for handling basic ui elements.
*
@ -6,14 +13,7 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
/** @namespace jsOMS.UI */
jsOMS.Autoloader.defineNamespace('jsOMS.UI');
jsOMS.UI.UIManager = class {
export class UIManager {
/**
* @constructor
*
@ -24,12 +24,12 @@
constructor(app)
{
this.app = app;
this.formManager = new jsOMS.UI.Component.Form(this.app);
this.tabManager = new jsOMS.UI.Component.Tab(this.app);
this.tableManager = new jsOMS.UI.Component.Table(this.app);
this.actionManager = new jsOMS.UI.ActionManager(this.app);
this.dragNDrop = new jsOMS.UI.DragNDrop(this.app);
this.generalUI = new jsOMS.UI.GeneralUI();
this.formManager = new Form(this.app);
this.tabManager = new Tab(this.app);
this.tableManager = new Table(this.app);
this.actionManager = new ActionManager(this.app);
this.dragNDrop = new DragNDrop(this.app);
this.generalUI = new GeneralUI();
const self = this;
/** global: MutationObserver */
@ -164,5 +164,4 @@
{
return this.generalUI;
};
}
}(window.jsOMS = window.jsOMS || {}));
};

View File

@ -14,7 +14,7 @@
window.addEventListener('error', function (e)
{
/** global: jsOMS */
jsOMS.Log.Logger.instance.error(e.error);
//jsOMS.Log.Logger.instance.error(e.error);
return false;
});

View File

@ -8,14 +8,7 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
/** @namespace jsOMS.Uri.UriFactory */
jsOMS.Autoloader.defineNamespace('jsOMS.Uri.Http');
jsOMS.Uri.Http = class {
export class Http {
/**
* @constructor
*
@ -153,7 +146,7 @@
{
this.uri = uri;
const parsed = jsOMS.Uri.Http.parseUrl(this.uri, 'php');
const parsed = Http.parseUrl(this.uri, 'php');
this.scheme = parsed['scheme'];
this.host = parsed['host'];
@ -169,7 +162,7 @@
this.queryString = typeof parsed['query'] !== 'undefined' ? parsed['query'] : [];
if (this.queryString !== null) {
this.query = jsOMS.Uri.Http.getAllUriQueryParameters(this.queryString);
this.query = Http.getAllUriQueryParameters(this.queryString);
}
this.fragment = typeof parsed['fragment'] !== 'undefined' ? parsed['fragment'] : '';
@ -322,5 +315,4 @@
{
return jsOMS.substr_count(this.root, '/') - 1;
};
}
}(window.jsOMS = window.jsOMS || {}));
};

View File

@ -1,3 +1,5 @@
import { Http } from './Http.js';
/**
* Uri factory.
*
@ -6,14 +8,7 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
/** @namespace jsOMS.Uri.UriFactory */
jsOMS.Autoloader.defineNamespace('jsOMS.Uri.UriFactory');
jsOMS.Uri.UriFactory = class {
export class UriFactory {
/**
* Set uri query
*
@ -29,8 +24,8 @@
{
overwrite = typeof overwrite !== 'undefined' ? overwrite : true;
if (overwrite || !jsOMS.Uri.UriFactory.uri.hasOwnProperty(key)) {
jsOMS.Uri.UriFactory.uri[key] = value;
if (overwrite || !UriFactory.uri.hasOwnProperty(key)) {
UriFactory.uri[key] = value;
return true;
}
@ -49,7 +44,7 @@
*/
static getQuery (key)
{
return jsOMS.Uri.UriFactory.uri.hasOwnProperty(key) ? jsOMS.Uri.UriFactory.uri[key] : null;
return UriFactory.uri.hasOwnProperty(key) ? UriFactory.uri[key] : null;
};
/**
@ -61,7 +56,7 @@
*/
static clearAll ()
{
jsOMS.Uri.UriFactory.uri = {};
UriFactory.uri = {};
return true;
};
@ -77,8 +72,8 @@
*/
static clear (key)
{
if (jsOMS.Uri.UriFactory.uri.hasOwnProperty(key)) {
delete jsOMS.Uri.UriFactory.uri[key];
if (UriFactory.uri.hasOwnProperty(key)) {
delete UriFactory.uri[key];
return true;
}
@ -100,9 +95,9 @@
let success = false;
const regexp = new RegExp(pattern);
for (let key in jsOMS.Uri.UriFactory.uri) {
if (jsOMS.Uri.UriFactory.uri.hasOwnProperty(key) && regexp.test(key)) {
delete jsOMS.Uri.UriFactory.uri[key];
for (let key in UriFactory.uri) {
if (UriFactory.uri.hasOwnProperty(key) && regexp.test(key)) {
delete UriFactory.uri[key];
success = true;
}
}
@ -181,15 +176,15 @@
*/
static build (uri, toMatch)
{
const current = jsOMS.Uri.Http.parseUrl(window.location.href);
const current = Http.parseUrl(window.location.href);
let parsed = uri.replace(new RegExp('\{[\/#\?%@\.\$][a-zA-Z0-9\-]*\}', 'g'), function (match)
{
match = match.substr(1, match.length - 2);
if (typeof toMatch !== 'undefined' && toMatch.hasOwnProperty(match)) {
return toMatch[match];
} else if (typeof jsOMS.Uri.UriFactory.uri[match] !== 'undefined') {
return jsOMS.Uri.UriFactory.uri[match];
} else if (typeof UriFactory.uri[match] !== 'undefined') {
return UriFactory.uri[match];
} else if (match.indexOf('#') === 0) {
const e = document.getElementById(match.substr(1));
@ -199,7 +194,7 @@
return '';
} else if (match.indexOf('?') === 0) {
return jsOMS.Uri.Http.getUriQueryParameter(current.query, match.substr(1));
return Http.getUriQueryParameter(current.query, match.substr(1));
} else if (match.indexOf('/') === 0) {
// todo: second match should return second path
return 'ERROR PATH';
@ -214,7 +209,7 @@
parsed = parsed.replace('&', '?');
}
return jsOMS.Uri.UriFactory.unique(parsed);
return UriFactory.unique(parsed);
};
/**
@ -226,31 +221,31 @@
*/
static setupUriBuilder (uri)
{
jsOMS.Uri.UriFactory.setQuery('/scheme', uri.getScheme());
jsOMS.Uri.UriFactory.setQuery('/host', uri.getHost());
jsOMS.Uri.UriFactory.setQuery('/base', jsOMS.rtrim(uri.getBase(), '/'));
jsOMS.Uri.UriFactory.setQuery('?', uri.getQuery());
jsOMS.Uri.UriFactory.setQuery('%', uri.getUri());
jsOMS.Uri.UriFactory.setQuery('#', uri.getFragment());
jsOMS.Uri.UriFactory.setQuery('/', uri.getPath());
jsOMS.Uri.UriFactory.setQuery(':user', uri.getUser());
jsOMS.Uri.UriFactory.setQuery(':pass', uri.getPass());
UriFactory.setQuery('/scheme', uri.getScheme());
UriFactory.setQuery('/host', uri.getHost());
UriFactory.setQuery('/base', jsOMS.rtrim(uri.getBase(), '/'));
UriFactory.setQuery('?', uri.getQuery());
UriFactory.setQuery('%', uri.getUri());
UriFactory.setQuery('#', uri.getFragment());
UriFactory.setQuery('/', uri.getPath());
UriFactory.setQuery(':user', uri.getUser());
UriFactory.setQuery(':pass', uri.getPass());
const query = uri.getQuery();
for (let key in query) {
if (query.hasOwnProperty(key)) {
jsOMS.Uri.UriFactory.setQuery('?' + key, query[key]);
UriFactory.setQuery('?' + key, query[key]);
}
}
};
}
};
/**
/**
* Uri values
*
* @var {Object}
* @since 1.0.0
*/
jsOMS.Uri.UriFactory.uri = {};
}(window.jsOMS = window.jsOMS || {}));
UriFactory.uri = {};

View File

@ -10,13 +10,7 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS)
{
"use strict";
/** @namespace jsOMS.Views */
jsOMS.Autoloader.defineNamespace('jsOMS.Views');
jsOMS.Views.FormView = class {
export class FormView {
/**
* @constructor
*
@ -467,5 +461,4 @@
this.unbind();
this.initializeMembers();
};
}
}(window.jsOMS = window.jsOMS || {}));
};

View File

@ -6,12 +6,7 @@
* @version 1.0.0
* @since 1.0.0
*/
(function (jsOMS) {
"use strict";
jsOMS.Autoloader.defineNamespace('jsOMS.Views');
jsOMS.Views.TableView = class {
export class TableView {
/**
* @constructor
*
@ -158,5 +153,4 @@
'#' + this.id + ' tbody .update'
);
};
}
}(window.jsOMS = window.jsOMS || {}));
};