mirror of
https://github.com/Karaka-Management/jsOMS.git
synced 2026-02-16 01:08:41 +00:00
fixes #24
This commit is contained in:
parent
8f7b866be9
commit
3e7875c638
|
|
@ -38,7 +38,7 @@
|
||||||
jsOMS.Asset.AssetManager.prototype.registerLoadedAssets = function ()
|
jsOMS.Asset.AssetManager.prototype.registerLoadedAssets = function ()
|
||||||
{
|
{
|
||||||
const scripts = document.getElementsByTagName('script'),
|
const scripts = document.getElementsByTagName('script'),
|
||||||
length = scripts.length;
|
length = !scripts ? 0 : scripts.length;
|
||||||
|
|
||||||
for (let i = 0; i < length; i++) {
|
for (let i = 0; i < length; i++) {
|
||||||
this.assets[jsOMS.hash(scripts[i].src)] = scripts[i].src;
|
this.assets[jsOMS.hash(scripts[i].src)] = scripts[i].src;
|
||||||
|
|
@ -72,7 +72,11 @@
|
||||||
fileref.setAttribute('src', path);
|
fileref.setAttribute('src', path);
|
||||||
|
|
||||||
if (typeof fileref !== 'undefined') {
|
if (typeof fileref !== 'undefined') {
|
||||||
document.getElementsByTagName('head')[0].appendChild(fileref);
|
const head = document.getElementsByTagName('head');
|
||||||
|
|
||||||
|
if(head) {
|
||||||
|
head[0].appendChild(fileref);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.assets[hash] = path;
|
this.assets[hash] = path;
|
||||||
|
|
@ -83,7 +87,11 @@
|
||||||
fileref.setAttribute('href', path);
|
fileref.setAttribute('href', path);
|
||||||
|
|
||||||
if (typeof fileref !== 'undefined') {
|
if (typeof fileref !== 'undefined') {
|
||||||
document.getElementsByTagName('head')[0].appendChild(fileref);
|
const head = document.getElementsByTagName('head');
|
||||||
|
|
||||||
|
if(head) {
|
||||||
|
head[0].appendChild(fileref);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.assets[hash] = path;
|
this.assets[hash] = path;
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@
|
||||||
jsOMS.Autoloader.initPreloaded = function ()
|
jsOMS.Autoloader.initPreloaded = function ()
|
||||||
{
|
{
|
||||||
const scripts = document.getElementsByTagName('script'),
|
const scripts = document.getElementsByTagName('script'),
|
||||||
length = scripts.length;
|
length = !scripts ? 0 : scripts.length;
|
||||||
|
|
||||||
for (let i = 0; i < length; i++) {
|
for (let i = 0; i < length; i++) {
|
||||||
/** global: URL */
|
/** global: URL */
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@
|
||||||
this.bindElement(id);
|
this.bindElement(id);
|
||||||
} else {
|
} else {
|
||||||
const elements = document.querySelectorAll('[draggable]'),
|
const elements = document.querySelectorAll('[draggable]'),
|
||||||
length = elements.length;
|
length = !elements ? 0 : elements.length;
|
||||||
|
|
||||||
for (var i = 0; i < length; i++) {
|
for (var i = 0; i < length; i++) {
|
||||||
if (typeof elements[i].getAttribute('id') !== 'undefined' && elements[i].getAttribute('id') !== null) {
|
if (typeof elements[i].getAttribute('id') !== 'undefined' && elements[i].getAttribute('id') !== null) {
|
||||||
|
|
@ -75,6 +75,10 @@
|
||||||
const element = document.getElementById(id);
|
const element = document.getElementById(id);
|
||||||
console.log(id);
|
console.log(id);
|
||||||
|
|
||||||
|
if(!element) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
element.addEventListener('dragstart', function(event) {
|
element.addEventListener('dragstart', function(event) {
|
||||||
// todo:
|
// todo:
|
||||||
console.log('drag start');
|
console.log('drag start');
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@
|
||||||
{
|
{
|
||||||
/* Handle remote datalist/autocomplete input element */
|
/* Handle remote datalist/autocomplete input element */
|
||||||
let listId, list;
|
let listId, list;
|
||||||
if (typeof (listId = this.getAttribute('list')) !== 'undefined' && (list = document.getElementById(listId)).getAttribute('data-list-src') !== 'undefined') {
|
if (typeof (listId = this.getAttribute('list')) !== 'undefined' && (list = document.getElementById(listId)) && list.getAttribute('data-list-src') !== 'undefined') {
|
||||||
self.addRemoteDatalistOptions(this, list);
|
self.addRemoteDatalistOptions(this, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -72,6 +72,10 @@
|
||||||
if (typeof (ref = this.getAttribute('data-ref')) !== 'undefined') {
|
if (typeof (ref = this.getAttribute('data-ref')) !== 'undefined') {
|
||||||
let e = document.getElementById(ref);
|
let e = document.getElementById(ref);
|
||||||
|
|
||||||
|
if(!e) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (e.tagName) {
|
switch (e.tagName) {
|
||||||
case 'ul':
|
case 'ul':
|
||||||
break;
|
break;
|
||||||
|
|
@ -85,7 +89,11 @@
|
||||||
if (typeof (dataButton = input.getAttribute('data-button')) !== 'undefined') {
|
if (typeof (dataButton = input.getAttribute('data-button')) !== 'undefined') {
|
||||||
this.app.inputManager.getKeyboardManager().bind(input, 13, function ()
|
this.app.inputManager.getKeyboardManager().bind(input, 13, function ()
|
||||||
{
|
{
|
||||||
document.getElementById(dataButton).click();
|
const db = document.getElementById(dataButton);
|
||||||
|
|
||||||
|
if(db) {
|
||||||
|
db.click();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@
|
||||||
this.bindForm(id);
|
this.bindForm(id);
|
||||||
} else {
|
} else {
|
||||||
const forms = document.getElementsByTagName('form'),
|
const forms = document.getElementsByTagName('form'),
|
||||||
length = forms.length;
|
length = !forms ? 0 : forms.length;
|
||||||
|
|
||||||
for (var i = 0; i < length; i++) {
|
for (var i = 0; i < length; i++) {
|
||||||
if (typeof forms[i].getAttribute('id') !== 'undefined' && forms[i].getAttribute('id') !== null && typeof this.ignore[forms[i].getAttribute('id')] === 'undefined') {
|
if (typeof forms[i].getAttribute('id') !== 'undefined' && forms[i].getAttribute('id') !== null && typeof this.ignore[forms[i].getAttribute('id')] === 'undefined') {
|
||||||
|
|
|
||||||
10
UI/Input.js
10
UI/Input.js
|
|
@ -63,6 +63,10 @@
|
||||||
if (typeof (ref = this.getAttribute('data-ref')) !== 'undefined') {
|
if (typeof (ref = this.getAttribute('data-ref')) !== 'undefined') {
|
||||||
let e = document.getElementById(ref);
|
let e = document.getElementById(ref);
|
||||||
|
|
||||||
|
if(!e) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (e.tagName) {
|
switch (e.tagName) {
|
||||||
case 'ul':
|
case 'ul':
|
||||||
break;
|
break;
|
||||||
|
|
@ -76,7 +80,11 @@
|
||||||
if (typeof (dataButton = input.getAttribute('data-button')) !== 'undefined') {
|
if (typeof (dataButton = input.getAttribute('data-button')) !== 'undefined') {
|
||||||
this.app.inputManager.getKeyboardManager().bind(input, 13, function ()
|
this.app.inputManager.getKeyboardManager().bind(input, 13, function ()
|
||||||
{
|
{
|
||||||
document.getElementById(dataButton).click();
|
const db = document.getElementById(dataButton);
|
||||||
|
|
||||||
|
if(db) {
|
||||||
|
db.click();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@
|
||||||
const self = this,
|
const self = this,
|
||||||
e = document.getElementById(element);
|
e = document.getElementById(element);
|
||||||
|
|
||||||
if (e === null) {
|
if (!e) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,10 @@
|
||||||
const e = document.getElementById(surface),
|
const e = document.getElementById(surface),
|
||||||
self = this;
|
self = this;
|
||||||
|
|
||||||
|
if(!e) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
e.addEventListener('touchstart', function (event)
|
e.addEventListener('touchstart', function (event)
|
||||||
{
|
{
|
||||||
const touch = this.changedTouches[0];
|
const touch = this.changedTouches[0];
|
||||||
|
|
|
||||||
|
|
@ -37,11 +37,16 @@
|
||||||
jsOMS.UI.TabManager.prototype.bind = function (id)
|
jsOMS.UI.TabManager.prototype.bind = function (id)
|
||||||
{
|
{
|
||||||
if (typeof id !== 'undefined') {
|
if (typeof id !== 'undefined') {
|
||||||
this.bindElement(document.getElementById(id));
|
const e = document.getElementById(id);
|
||||||
} else {
|
|
||||||
var tabs = document.querySelectorAll('.tabview');
|
|
||||||
|
|
||||||
for (var i = 0; i < tabs.length; i++) {
|
if(e) {
|
||||||
|
this.bindElement();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var tabs = document.querySelectorAll('.tabview'),
|
||||||
|
length = !tabs ? 0 : tabs.length;
|
||||||
|
|
||||||
|
for (var i = 0; i < length; i++) {
|
||||||
this.bindElement(tabs[i]);
|
this.bindElement(tabs[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,11 +37,16 @@
|
||||||
jsOMS.UI.TableManager.prototype.bind = function (id)
|
jsOMS.UI.TableManager.prototype.bind = function (id)
|
||||||
{
|
{
|
||||||
if (typeof id !== 'undefined') {
|
if (typeof id !== 'undefined') {
|
||||||
this.bindElement(document.getElementById(id));
|
const e = document.getElementById(id);
|
||||||
} else {
|
|
||||||
const tables = document.querySelectorAll('.tables');
|
|
||||||
|
|
||||||
for (var i = 0; i < tables.length; i++) {
|
if(e) {
|
||||||
|
this.bindElement(e);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const tables = document.querySelectorAll('.tables'),
|
||||||
|
length = !tables ? 0 : tables.length;
|
||||||
|
|
||||||
|
for (var i = 0; i < length; i++) {
|
||||||
this.bindElement(tables[i]);
|
this.bindElement(tables[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,10 @@
|
||||||
} else {
|
} else {
|
||||||
const tag = document.getElementById(id);
|
const tag = document.getElementById(id);
|
||||||
|
|
||||||
|
if(!tag) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (tag.tagName) {
|
switch (tag.tagName) {
|
||||||
case 'form':
|
case 'form':
|
||||||
this.formManager.bind(id);
|
this.formManager.bind(id);
|
||||||
|
|
|
||||||
|
|
@ -190,7 +190,13 @@
|
||||||
} else if (typeof jsOMS.Uri.UriFactory.uri[match] !== 'undefined') {
|
} else if (typeof jsOMS.Uri.UriFactory.uri[match] !== 'undefined') {
|
||||||
return jsOMS.Uri.UriFactory.uri[match];
|
return jsOMS.Uri.UriFactory.uri[match];
|
||||||
} else if (match.indexOf('#') === 0) {
|
} else if (match.indexOf('#') === 0) {
|
||||||
return document.getElementById(match.substr(1)).value;
|
const e = document.getElementById(match.substr(1));
|
||||||
|
|
||||||
|
if(e) {
|
||||||
|
return e.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
} else if (match.indexOf('?') === 0) {
|
} else if (match.indexOf('?') === 0) {
|
||||||
return jsOMS.Uri.Http.getUriQueryParameter(current.query, match.substr(1));
|
return jsOMS.Uri.Http.getUriQueryParameter(current.query, match.substr(1));
|
||||||
} else if (match.indexOf('/') === 0) {
|
} else if (match.indexOf('/') === 0) {
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,13 @@
|
||||||
*/
|
*/
|
||||||
jsOMS.Views.FormView.prototype.getSubmit = function ()
|
jsOMS.Views.FormView.prototype.getSubmit = function ()
|
||||||
{
|
{
|
||||||
return document.getElementById(this.id).querySelectorAll('input[type=submit]');
|
const e = document.getElementById(this.id);
|
||||||
|
|
||||||
|
if(!e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return e.querySelectorAll('input[type=submit]');
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -133,8 +139,13 @@
|
||||||
*/
|
*/
|
||||||
jsOMS.Views.FormView.prototype.getFormElements = function ()
|
jsOMS.Views.FormView.prototype.getFormElements = function ()
|
||||||
{
|
{
|
||||||
const form = document.getElementById(this.id),
|
const form = document.getElementById(this.id)
|
||||||
selects = form.getElementsByTagName('select'),
|
|
||||||
|
if(!form) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
const selects = form.getElementsByTagName('select'),
|
||||||
textareas = form.getElementsByTagName('textarea'),
|
textareas = form.getElementsByTagName('textarea'),
|
||||||
inputs = form.getElementsByTagName('input'),
|
inputs = form.getElementsByTagName('input'),
|
||||||
external = document.querySelectorAll('[form=' + this.id + ']');
|
external = document.querySelectorAll('[form=' + this.id + ']');
|
||||||
|
|
@ -235,13 +246,13 @@
|
||||||
{
|
{
|
||||||
let id = e.getAttribute('name');
|
let id = e.getAttribute('name');
|
||||||
|
|
||||||
if (id === null) {
|
if (!id) {
|
||||||
id = e.getAttribute('id');
|
id = e.getAttribute('id');
|
||||||
} else {
|
} else {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id === null) {
|
if (!id) {
|
||||||
id = e.getAttribute('type');
|
id = e.getAttribute('type');
|
||||||
} else {
|
} else {
|
||||||
return id;
|
return id;
|
||||||
|
|
@ -273,8 +284,14 @@
|
||||||
{
|
{
|
||||||
this.clean();
|
this.clean();
|
||||||
|
|
||||||
this.method = document.getElementById(this.id).attributes['method'].value;
|
const e = document.getElementById(this.id);
|
||||||
this.action = document.getElementById(this.id).action;
|
|
||||||
|
if(!e) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.method = e.attributes['method'].value;
|
||||||
|
this.action = e.action;
|
||||||
|
|
||||||
const elements = this.getFormElements(),
|
const elements = this.getFormElements(),
|
||||||
length = elements.length;
|
length = elements.length;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user