2025-03-07 14:46:38 +09:00
|
|
|
/*
|
|
|
|
|
* general edit javascript
|
|
|
|
|
* former name: edit.jq.js
|
|
|
|
|
* This is the jquery version
|
|
|
|
|
* NOTE: jquey parts will be deprecated
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import {
|
|
|
|
|
errorCatch as _errorCatch,
|
|
|
|
|
isFunction as _isFunction,
|
|
|
|
|
executeFunctionByName as _executeFunctionByName,
|
|
|
|
|
isObject as _isObject,
|
|
|
|
|
getObjectCount as _getObjectCount,
|
|
|
|
|
keyInObject as _keyInObject,
|
|
|
|
|
getKeyByValue as _getKeyByValue,
|
|
|
|
|
valueInObject as _valueInObject,
|
|
|
|
|
deepCopyFunction as _deepCopyFunction
|
|
|
|
|
} from './utils/JavaScriptHelpers.mjs';
|
|
|
|
|
import {
|
|
|
|
|
escapeHtml as _escapeHtml,
|
|
|
|
|
unescapeHtml as _unescapeHtml,
|
|
|
|
|
html_options as _html_options,
|
|
|
|
|
html_options_block as _html_options_block,
|
|
|
|
|
html_options_refill as _html_options_refill
|
|
|
|
|
} from './utils/HtmlHelpers.mjs';
|
|
|
|
|
import {
|
|
|
|
|
loadEl as _loadEl,
|
|
|
|
|
pop as _pop,
|
|
|
|
|
expandTA as _expandTA,
|
|
|
|
|
exists as _exists
|
|
|
|
|
} from './utils/DomHelpers.mjs';
|
|
|
|
|
import {
|
|
|
|
|
dec2hex as _dec2hex,
|
|
|
|
|
getRandomIntInclusive as _getRandomIntInclusive,
|
|
|
|
|
roundPrecision as _roundPrecision
|
|
|
|
|
} from './utils/MathHelpers.mjs';
|
|
|
|
|
import {
|
|
|
|
|
formatString as _formatString,
|
|
|
|
|
numberWithCommas as _numberWithCommas,
|
|
|
|
|
convertLBtoBR as _convertLBtoBR
|
|
|
|
|
} from './utils/StringHelpers.mjs';
|
|
|
|
|
import {
|
|
|
|
|
getTimestamp as _getTimestamp
|
|
|
|
|
} from './utils/DateTimeHelpers.mjs';
|
|
|
|
|
import {
|
|
|
|
|
generateId as _generateId,
|
|
|
|
|
randomIdF as _randomIdF,
|
|
|
|
|
} from './utils/UniqIdGenerators.mjs';
|
|
|
|
|
import {
|
|
|
|
|
getWindowSize as _getWindowSize,
|
|
|
|
|
getScrollOffset as _getScrollOffset,
|
|
|
|
|
getScrollOffsetOpener as _getScrollOffsetOpener,
|
|
|
|
|
setCenter as _setCenter,
|
|
|
|
|
goToPos as _goToPos,
|
|
|
|
|
goTo as _goTo
|
|
|
|
|
} from './utils/ResizingAndMove.mjs';
|
|
|
|
|
import {
|
|
|
|
|
formatBytes as _formatBytes,
|
|
|
|
|
formatBytesLong as _formatBytesLong,
|
|
|
|
|
stringByteFormat as _stringByteFormat
|
|
|
|
|
} from './utils/FormatBytes.mjs';
|
|
|
|
|
import {
|
|
|
|
|
parseQueryString as _parseQueryString,
|
|
|
|
|
getQueryStringParam as _getQueryStringParam
|
|
|
|
|
} from './utils/UrlParser.mjs';
|
|
|
|
|
import {
|
|
|
|
|
loginLogout as _loginLogout,
|
2025-03-07 15:26:38 +09:00
|
|
|
} from './utils/LoginLogout.mjs';
|
2025-03-07 14:46:38 +09:00
|
|
|
import {
|
|
|
|
|
ActionIndicatorOverlayBox,
|
|
|
|
|
actionIndicator as _actionIndicator,
|
|
|
|
|
actionIndicatorShow as _actionIndicatorShow,
|
|
|
|
|
actionIndicatorHide as _actionIndicatorHide,
|
|
|
|
|
overlayBoxShow as _overlayBoxShow,
|
|
|
|
|
overlayBoxHide as _overlayBoxHide,
|
|
|
|
|
setOverlayBox as _setOverlayBox,
|
|
|
|
|
hideOverlayBox as _hideOverlayBox,
|
|
|
|
|
ClearCall as _ClearCall
|
|
|
|
|
} from './utils/ActionIndicatorOverlayBox.mjs';
|
|
|
|
|
import { l10nTranslation } from './utils/l10nTranslation.mjs';
|
|
|
|
|
import { HtmlElementCreator } from './utils/HtmlElementCreator.mjs';
|
|
|
|
|
import { ActionBox } from './utils/ActionBox.mjs';
|
2025-03-07 15:26:38 +09:00
|
|
|
import { LoginNavMenu } from './utils/LoginNavMenu.mjs';
|
2025-03-07 14:46:38 +09:00
|
|
|
|
|
|
|
|
let aiob = new ActionIndicatorOverlayBox();
|
|
|
|
|
let hec = new HtmlElementCreator();
|
2025-03-07 15:26:38 +09:00
|
|
|
// if ( undef === "undefined") {
|
2025-03-07 14:46:38 +09:00
|
|
|
// @ts-ignore
|
|
|
|
|
// eslint-disable-next-line no-undef
|
2025-03-07 15:26:38 +09:00
|
|
|
let l10n = new l10nTranslation(typeof i18n === "undefined" ? {} : i18n);
|
2025-03-07 14:46:38 +09:00
|
|
|
let ab = new ActionBox(hec, l10n);
|
2025-03-07 15:26:38 +09:00
|
|
|
let lnm = new LoginNavMenu(hec, l10n);
|
2025-03-07 14:46:38 +09:00
|
|
|
|
|
|
|
|
// MARK: deprecated String/Number override
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* simple sprintf formater for replace
|
|
|
|
|
* usage: "{0} is cool, {1} is not".format("Alpha", "Beta");
|
|
|
|
|
* First, checks if it isn't implemented yet.
|
|
|
|
|
* @param {String} String.prototype.format string with elements to be replaced
|
|
|
|
|
* @return {String} Formated string
|
|
|
|
|
* @deprecated StringHelpers.formatString
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
if (!String.prototype.format) {
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
String.prototype.format = function()
|
|
|
|
|
{
|
|
|
|
|
console.error('[DEPRECATED] use StringHelpers.formatString');
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
return _formatString(this, arguments);
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* round to digits (float)
|
|
|
|
|
* @param {Number} Number.prototype.round Float type number to round
|
|
|
|
|
* @param {Number} prec Precision to round to
|
|
|
|
|
* @return {Float} Rounded number
|
|
|
|
|
* @deprecated use MathHelpers.roundPrecision
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
if (Number.prototype.round) {
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
Number.prototype.round = function (prec) {
|
|
|
|
|
console.error('[DEPRECATED] use MathHelpers.roundPrecision');
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
return _roundPrecision(this, prec);
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* escape HTML string
|
|
|
|
|
* @param {String} String.prototype.escapeHTML HTML data string to be escaped
|
|
|
|
|
* @return {String} escaped string
|
|
|
|
|
* @deprecated use HtmlHelpers.escapeHtml
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
if (!String.prototype.escapeHTML) {
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
String.prototype.escapeHTML = function() {
|
|
|
|
|
console.error('[DEPRECATED] use HtmlHelpers.escapeHtml');
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
return _escapeHtml(this);
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* unescape a HTML encoded string
|
|
|
|
|
* @param {String} String.prototype.unescapeHTML data with escaped entries
|
|
|
|
|
* @return {String} HTML formated string
|
|
|
|
|
* @deprecated use HtmlHelpers.unescapeHtml
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
if (!String.prototype.unescapeHTML) {
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
String.prototype.unescapeHTML = function() {
|
|
|
|
|
console.error('[DEPRECATED] use HtmlHelpers.unescapeHtml');
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
return _unescapeHtml(this);
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// MARK: general collection
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* @param {String} string
|
|
|
|
|
* @returns {String}
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function escapeHtml(string) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
return _escapeHtml(string);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* round to digits (float)
|
|
|
|
|
* @param {Number} number Float type number to round
|
|
|
|
|
* @param {Number} prec Precision to round to
|
|
|
|
|
* @return {Number} Rounded number
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function roundPrecision(number, prec) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
return _roundPrecision(number, prec);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* simple sprintf formater for replace
|
|
|
|
|
* usage: "{0} is cool, {1} is not".format("Alpha", "Beta");
|
|
|
|
|
* First, checks if it isn't implemented yet.
|
|
|
|
|
* @param {String} string String with elements to be replaced
|
|
|
|
|
* @return {String} Formated string
|
|
|
|
|
* @deprecated StringHelpe
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function formatString(string, ...args) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
2025-03-10 17:02:17 +09:00
|
|
|
return _formatString(string, ...args);
|
2025-03-07 14:46:38 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* @param {String} string
|
|
|
|
|
* @returns {String}
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function unescapeHtml(string) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
return _unescapeHtml(string);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets html element or throws an error
|
|
|
|
|
* @param {string} el_id Element ID to get
|
|
|
|
|
* @returns {HTMLElement}
|
|
|
|
|
* @throws Error
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function loadEl(el_id) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
return _loadEl(el_id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* opens a pop_ window with winName and given features (string)
|
|
|
|
|
* @param {String} theURL the url
|
|
|
|
|
* @param {String} winName window name
|
|
|
|
|
* @param {Object} features pop_ features
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function pop(theURL, winName, features) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
_pop(theURL, winName, features);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* automatically resize a text area based on the amount of lines in it
|
|
|
|
|
* @param {string} ta_id element id
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function expandTA(ta_id) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
_expandTA(ta_id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* wrapper to get the real window size for the current browser window
|
|
|
|
|
* @return {Object} object with width/height
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function getWindowSize() // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
return _getWindowSize();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* wrapper to get the correct scroll offset
|
|
|
|
|
* @return {Object} object with x/y px
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function getScrollOffset() // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
return _getScrollOffset();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* wrapper to get the correct scroll offset for opener page (from pop_)
|
|
|
|
|
* @return {Object} object with x/y px
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function getScrollOffsetOpener() // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
return _getScrollOffsetOpener();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* centers div to current window size middle
|
|
|
|
|
* @param {String} id element to center
|
|
|
|
|
* @param {Boolean} left if true centers to the middle from the left
|
|
|
|
|
* @param {Boolean} top if true centers to the middle from the top
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function setCenter(id, left, top) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
_setCenter(id, left, top);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* goes to an element id position
|
|
|
|
|
* @param {String} element element id to move to
|
|
|
|
|
* @param {Number} [offset=0] offset from top, default is 0 (px)
|
|
|
|
|
* @param {Number} [duration=500] animation time, default 500ms
|
|
|
|
|
* @param {String} [base='body,html'] base element for offset scroll
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function goToPos(element, offset = 0, duration = 500, base = 'body,html') // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
_goToPos(element, offset, duration, base);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* go to element, scroll
|
|
|
|
|
* non jquery
|
|
|
|
|
* @param {string} target
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function goTo(target) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
_goTo(target);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* uses the i18n object created in the translation template
|
|
|
|
|
* that is filled from gettext in PHP
|
|
|
|
|
* @param {String} string text to translate
|
|
|
|
|
* @return {String} translated text (based on PHP selected language)
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function __(string) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
return l10n.__(string);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* formats flat number 123456 to 123,456
|
|
|
|
|
* @param {Number} x number to be formated
|
|
|
|
|
* @return {String} formatted with , in thousands
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function numberWithCommas(x) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
return _numberWithCommas(x);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* converts line breaks to br
|
|
|
|
|
* @param {String} string any string
|
|
|
|
|
* @return {String} string with <br>
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function convertLBtoBR(string) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
return _convertLBtoBR(string);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* returns current timestamp (unix timestamp)
|
|
|
|
|
* @return {Number} timestamp (in milliseconds)
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function getTimestamp() // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
return _getTimestamp();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* dec2hex :: Integer -> String
|
|
|
|
|
* i.e. 0-255 -> '00'-'ff'
|
|
|
|
|
* @param {Number} dec decimal string
|
|
|
|
|
* @return {String} hex encdoded number
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function dec2hex(dec) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
return _dec2hex(dec);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* generateId :: Integer -> String
|
|
|
|
|
* only works on mondern browsers
|
|
|
|
|
* @param {Number} len length of unique id string
|
|
|
|
|
* @return {String} random string in length of len
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function generateId(len) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
return _generateId(len);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* creates a pseudo random string of 10 characters
|
|
|
|
|
* works on all browsers
|
|
|
|
|
* after many runs it will create d_licates
|
|
|
|
|
* @return {String} not true random string
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function randomIdF() // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
return _randomIdF();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* generate a number between min/max
|
|
|
|
|
* with min/max inclusive.
|
|
|
|
|
* eg: 1,5 will create a number ranging from 1 o 5
|
|
|
|
|
* @param {Number} min minimum int number inclusive
|
|
|
|
|
* @param {Number} max maximumg int number inclusive
|
|
|
|
|
* @return {Number} Random number
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function getRandomIntInclusive(min, max) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
return _getRandomIntInclusive(min, max);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* check if name is a function
|
|
|
|
|
* @param {string} name Name of function to check if exists
|
|
|
|
|
* @return {Boolean} true/false
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function isFunction(name) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
return _isFunction(name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* call a function by its string name
|
|
|
|
|
* https://stackoverflow.com/a/359910
|
|
|
|
|
* example: executeFunctionByName("My.Namespace.functionName", window, arguments);
|
|
|
|
|
* @param {string} functionName The function name or namespace + function
|
|
|
|
|
* @param {any} context context (window or first namespace)
|
|
|
|
|
* hidden next are all the arguments
|
|
|
|
|
* @return {any} Return values from functon
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function executeFunctionByName(functionName, context) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
return _executeFunctionByName(functionName, context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* checks if a variable is an object
|
|
|
|
|
* @param {any} val possible object
|
|
|
|
|
* @return {Boolean} true/false if it is an object or not
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function isObject(val) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
return _isObject(val);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* get the length of an object (entries)
|
|
|
|
|
* @param {Object} object object to check
|
|
|
|
|
* @return {Number} number of entry
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function getObjectCount(object) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
return _getObjectCount(object);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* checks if a key exists in a given object
|
|
|
|
|
* @param {String} key key name
|
|
|
|
|
* @param {Object} object object to search key in
|
|
|
|
|
* @return {Boolean} true/false if key exists in object
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function keyInObject(key, object) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
return _keyInObject(key, object);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* returns matching key of value
|
|
|
|
|
* @param {Object} object object to search value in
|
|
|
|
|
* @param {any} value any value (String, Number, etc)
|
|
|
|
|
* @return {String} the key found for the first matching value
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function getKeyByValue(object, value) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
return _getKeyByValue(object, value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* returns true if value is found in object with a key
|
|
|
|
|
* @param {Object} object object to search value in
|
|
|
|
|
* @param {any} value any value (String, Number, etc)
|
|
|
|
|
* @return {Boolean} true on value found, false on not found
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function valueInObject(object, value) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
return _valueInObject(object, value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* true deep copy for Javascript objects
|
|
|
|
|
* if Object.assign({}, obj) is not working (shallow)
|
|
|
|
|
* or if JSON.parse(JSON.stringify(obj)) is failing
|
|
|
|
|
* @param {Object} inObject Object to copy
|
|
|
|
|
* @return {Object} Copied Object
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function deepCopyFunction(inObject) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
return _deepCopyFunction(inObject);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* checks if a DOM element actually exists
|
|
|
|
|
* @param {String} id Element id to check for
|
|
|
|
|
* @return {Boolean} true if element exists, false on failure
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function exists(id) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
return _exists(id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* converts a int number into bytes with prefix in two decimals precision
|
|
|
|
|
* currently precision is fixed, if dynamic needs check for max/min precision
|
|
|
|
|
* @param {Number} bytes bytes in int
|
|
|
|
|
* @return {String} string in GB/MB/KB
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function formatBytes(bytes) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
return _formatBytes(bytes);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* like formatBytes, but returns bytes for <1KB and not 0.n KB
|
|
|
|
|
* @param {Number} bytes bytes in int
|
|
|
|
|
* @return {String} string in GB/MB/KB
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function formatBytesLong(bytes) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
return _formatBytesLong(bytes);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Convert a string with B/K/M/etc into a byte number
|
|
|
|
|
* @param {String|Number} bytes Any string with B/K/M/etc
|
|
|
|
|
* @return {String|Number} A byte number, or original string as is
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function stringByteFormat(bytes) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
return _stringByteFormat(bytes);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* prints out error messages based on data available from the browser
|
|
|
|
|
* @param {Object} err error from try/catch block
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function errorCatch(err) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
_errorCatch(err);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// MARK: ActionIndicatorOverlayBoxLegacy
|
|
|
|
|
|
|
|
|
|
/*************************************************************
|
|
|
|
|
* OLD action indicator and overlay boxes calls
|
|
|
|
|
* DO NOT USE
|
|
|
|
|
* actionIndicator -> showActionIndicator
|
|
|
|
|
* actionIndicator -> hideActionIndicator
|
|
|
|
|
* actionIndicatorShow -> showActionIndicator
|
|
|
|
|
* actionIndicatorHide -> hideActionIndicator
|
|
|
|
|
* overlayBoxShow -> showOverlayBoxLayers
|
|
|
|
|
* overlayBoxHide -> hideOverlayBoxLayers
|
|
|
|
|
* setOverlayBox -> showOverlayBoxLayers
|
|
|
|
|
* hideOverlayBox -> hideOverlayBoxLayers
|
|
|
|
|
* ClearCall -> ClearCallActionBox
|
|
|
|
|
* ***********************************************************/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* show or hide the "do" overlay
|
|
|
|
|
* @param {String} loc location name for action indicator
|
|
|
|
|
* default empty. for console.log
|
|
|
|
|
* @param {Boolean} [overlay=true] override the auto hide/show over the overlay div block
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function actionIndicator(loc, overlay = true) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
_actionIndicator(loc, overlay);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* explicit show for action Indicator
|
|
|
|
|
* instead of automatically show or hide, do on command show
|
|
|
|
|
* @param {String} loc location name for action indicator
|
|
|
|
|
* default empty. for console.log
|
|
|
|
|
* @param {Boolean} [overlay=true] override the auto hide/show over the overlay div block
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function actionIndicatorShow(loc, overlay = true) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
_actionIndicatorShow(loc, overlay);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* explicit hide for action Indicator
|
|
|
|
|
* instead of automatically show or hide, do on command hide
|
|
|
|
|
* @param {String} loc location name for action indicator
|
|
|
|
|
* default empty. for console.log
|
|
|
|
|
* @param {Boolean} [overlay=true] override the auto hide/show over the overlay div block
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function actionIndicatorHide(loc, overlay = true) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
_actionIndicatorHide(loc, overlay);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* shows the overlay box or if already visible, bumps the zIndex to 100
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function overlayBoxShow() // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
_overlayBoxShow();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* hides the overlay box or if zIndex is 100 bumps it down to previous level
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function overlayBoxHide() // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
_overlayBoxHide();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* position the overlay block box and shows it
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function setOverlayBox() // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
_setOverlayBox();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* opposite of set, always hides overlay box
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function hideOverlayBox() // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
_hideOverlayBox();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* the abort call, clears the action box and hides it and the overlay box
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function ClearCall() // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
_ClearCall();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// MARK: ActionIndicatorOverlayBox
|
|
|
|
|
|
|
|
|
|
/*************************************************************
|
|
|
|
|
* NEW action indicator and overlay box calls
|
|
|
|
|
* USE THIS
|
|
|
|
|
* ***********************************************************/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* show action indicator
|
|
|
|
|
* - checks if not existing and add
|
|
|
|
|
* - only shows if not visible (else ignore)
|
|
|
|
|
* - overlaybox check is called and shown on a fixzed
|
|
|
|
|
* zIndex of 1000
|
|
|
|
|
* - indicator is page centered
|
|
|
|
|
* @param {String} loc ID string, only used for console log
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function showActionIndicator(loc) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
aiob.showActionIndicator(loc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* hide action indicator, if it is visiable
|
|
|
|
|
* If the global variable GL_OB_S is > GL_OB_BASE then
|
|
|
|
|
* the overlayBox is not hidden but the zIndex
|
|
|
|
|
* is set to this value
|
|
|
|
|
* @param {String} loc ID string, only used for console log
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function hideActionIndicator(loc) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
aiob.hideActionIndicator(loc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* checks if overlayBox exists, if not it is
|
|
|
|
|
* added as hidden item at the body end
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function checkOverlayExists() // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
aiob.checkOverlayExists();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* show overlay box
|
|
|
|
|
* if not visible show and set zIndex to 10 (GL_OB_BASE)
|
|
|
|
|
* if visible, add +1 to the GL_OB_S variable and
|
|
|
|
|
* _ zIndex by this value
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function showOverlayBoxLayers(el_id) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
aiob.showOverlayBoxLayers(el_id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* hide overlay box
|
|
|
|
|
* lower GL_OB_S value by -1
|
|
|
|
|
* if we are 10 (GL_OB_BASE) or below hide the overlayIndex
|
|
|
|
|
* and set zIndex and GL_OB_S to 0
|
|
|
|
|
* else just set zIndex to the new GL_OB_S value
|
|
|
|
|
* @param {String} el_id Target to hide layer
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function hideOverlayBoxLayers(el_id='') // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
aiob.hideOverlayBoxLayers(el_id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* only for single action box
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function clearCallActionBox() // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
aiob.clearCallActionBox();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// MARK: DOM MANAGEMENT FUNCTIONS
|
|
|
|
|
/**
|
|
|
|
|
* reates object for DOM element creation flow
|
|
|
|
|
* @param {String} tag must set tag (div, span, etc)
|
|
|
|
|
* @param {String} [id=''] optional set for id, if input, select will be used for name
|
|
|
|
|
* @param {String} [content=''] text content inside, is skipped if sub elements exist
|
|
|
|
|
* @param {Array} [css=[]] array for css tags
|
|
|
|
|
* @param {Object} [options={}] anything else (value, placeholder, OnClick, style)
|
|
|
|
|
* @return {Object} created element as an object
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function cel(tag, id = '', content = '', css = [], options = {}) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
return hec.cel(tag, id, content, css, options);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* attach a cel created object to another to create a basic DOM tree
|
|
|
|
|
* @param {Object} base object where to attach/search
|
|
|
|
|
* @param {Object} attach the object to be attached
|
|
|
|
|
* @param {String} [id=''] optional id, if given search in base for this id and attach there
|
|
|
|
|
* @return {Object} "none", technically there is no return needed as it is global attach
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function ael(base, attach, id = '') // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
return hec.ael(base, attach, id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* directly attach n elements to one master base element
|
|
|
|
|
* this type does not s_port attach with optional id
|
|
|
|
|
* @param {Object} base object to where we attach the elements
|
|
|
|
|
* @param {...Object} attach attach 1..n: attach directly to the base element those attachments
|
|
|
|
|
* @return {Object} "none", technically there is no return needed, global attach
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function aelx(base, ...attach) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
2025-03-10 17:02:17 +09:00
|
|
|
return hec.aelx(base, ...attach);
|
2025-03-07 14:46:38 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* same as aelx, but instead of using objects as parameters
|
|
|
|
|
* get an array of objects to attach
|
|
|
|
|
* @param {Object} base object to where we attach the elements
|
|
|
|
|
* @param {Array} attach array of objects to attach
|
|
|
|
|
* @return {Object} "none", technically there is no return needed, global attach
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function aelxar(base, attach) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
return hec.aelxar(base, attach);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* resets the sub elements of the base element given
|
|
|
|
|
* @param {Object} base cel created element
|
|
|
|
|
* @return {Object} returns reset base element
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function rel(base) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
return hec.rel(base);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* searches and removes style from css array
|
|
|
|
|
* @param {Object} _element element to work one
|
|
|
|
|
* @param {String} css style sheet to remove (name)
|
|
|
|
|
* @return {Object} returns full element
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function rcssel(_element, css) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
return hec.rcssel(_element, css);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* adds a new style sheet to the element given
|
|
|
|
|
* @param {Object} _element element to work on
|
|
|
|
|
* @param {String} css style sheet to add (name)
|
|
|
|
|
* @return {Object} returns full element
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function acssel(_element, css) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
return hec.acssel(_element, css);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* removes one css and adds another
|
|
|
|
|
* is a wrapper around rcssel/acssel
|
|
|
|
|
* @param {Object} _element element to work on
|
|
|
|
|
* @param {String} rcss style to remove (name)
|
|
|
|
|
* @param {String} acss style to add (name)
|
|
|
|
|
* @return {Object} returns full element
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function scssel(_element, rcss, acss) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
hec.scssel(_element, rcss, acss);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* parses the object tree created with cel/ael and converts it into an HTML string
|
|
|
|
|
* that can be inserted into the page
|
|
|
|
|
* @param {Object} tree object tree with dom element declarations
|
|
|
|
|
* @return {String} HTML string that can be used as innerHTML
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function phfo(tree) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
return hec.phfo(tree);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Create HTML elements from array list
|
|
|
|
|
* as a flat element without master object file
|
|
|
|
|
* Is like tree.sub call
|
|
|
|
|
* @param {Array} list Array of cel created objects
|
|
|
|
|
* @return {String} HTML String
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function phfa(list) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
return hec.phfa(list);
|
|
|
|
|
}
|
|
|
|
|
// *** DOM MANAGEMENT FUNCTIONS
|
|
|
|
|
|
|
|
|
|
// MARK: HTML Helpers
|
|
|
|
|
// BLOCK: html wrappers for quickly creating html data blocks
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* NOTE: OLD FORMAT which misses multiple block set
|
|
|
|
|
* creates an select/options drop down block.
|
|
|
|
|
* the array needs to be key -> value format.
|
|
|
|
|
* key is for the option id and value is for the data output
|
|
|
|
|
* @param {String} name name/id
|
|
|
|
|
* @param {Object} data array for the options
|
|
|
|
|
* @param {String} [selected=''] selected item uid
|
|
|
|
|
* @param {Boolean} [options_only=false] if this is true, it will not print the select part
|
|
|
|
|
* @param {Boolean} [return_string=false] return as string and not as element
|
|
|
|
|
* @param {String} [sort=''] if empty as is, else allowed 'keys',
|
|
|
|
|
* 'values' all others are ignored
|
|
|
|
|
* @return {String} html with build options block
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function html_options(name, data, selected = '', options_only = false, return_string = false, sort = '') // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
return _html_options(name, data, selected, options_only, return_string, sort);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* NOTE: USE THIS CALL, the above one is deprecated
|
|
|
|
|
* creates an select/options drop down block.
|
|
|
|
|
* the array needs to be key -> value format.
|
|
|
|
|
* key is for the option id and value is for the data output
|
|
|
|
|
* @param {String} name name/id
|
|
|
|
|
* @param {Object} data array for the options
|
|
|
|
|
* @param {String} [selected=''] selected item uid
|
|
|
|
|
* @param {Number} [multiple=0] if this is 1 or larger, the drop down
|
|
|
|
|
* will be turned into multiple select
|
|
|
|
|
* the number sets the size value unless it is 1,
|
|
|
|
|
* then it is default
|
|
|
|
|
* @param {Boolean} [options_only=false] if this is true, it will not print the select part
|
|
|
|
|
* @param {Boolean} [return_string=false] return as string and not as element
|
|
|
|
|
* @param {String} [sort=''] if empty as is, else allowed 'keys',
|
|
|
|
|
* 'values' all others are ignored
|
|
|
|
|
* @param {String} [onchange=''] onchange trigger call, default unset
|
|
|
|
|
* @return {String} html with build options block
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function html_options_block( // eslint-disable-line no-unused-vars
|
|
|
|
|
name, data, selected = '', multiple = 0, options_only = false, return_string = false, sort = '', onchange = ''
|
|
|
|
|
) {
|
|
|
|
|
return _html_options_block(
|
|
|
|
|
name, data, selected, multiple, options_only, return_string, sort, onchange
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* refills a select box with options and keeps the selected
|
|
|
|
|
* @param {String} name name/id
|
|
|
|
|
* @param {Object} data array of options
|
|
|
|
|
* @param {String} [sort=''] if empty as is, else allowed 'keys', 'values'
|
|
|
|
|
* all others are ignored
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function html_options_refill(name, data, sort = '') // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
_html_options_refill(name, data, sort);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// MARK: URL
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* parses a query string from window.location.search.substring(1)
|
|
|
|
|
* ALTERNATIVE CODE
|
|
|
|
|
* var url = new URL(window.location.href);
|
|
|
|
|
* param_uid = url.searchParams.get('uid');
|
|
|
|
|
* @param {String} [query=''] the query string to parse
|
|
|
|
|
* if not set will auto fill
|
|
|
|
|
* @param {String} [return_key=''] if set only returns this key entry
|
|
|
|
|
* or empty for none
|
|
|
|
|
* @return {Object|String} parameter entry list
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function parseQueryString(query = '', return_key = '') // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
return _parseQueryString(query, return_key);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* searches query parameters for entry and returns data either as string or array
|
|
|
|
|
* if no search is given the whole parameters are returned as an object
|
|
|
|
|
* if a parameter is set several times it will be returned as an array
|
|
|
|
|
* if search parameter set and nothing found and empty string is returned
|
|
|
|
|
* if no parametes exist and no serach is set and empty object is returned
|
|
|
|
|
* @param {String} [search=''] if set searches for this entry, if empty
|
|
|
|
|
* all parameters are returned
|
|
|
|
|
* @param {String} [query=''] different query string to parse, if not
|
|
|
|
|
* set (default) the current window href is used
|
|
|
|
|
* @param {Boolean} [single=false] if set to true then only the first found
|
|
|
|
|
* will be returned
|
|
|
|
|
* @return {Object|Array|String} if search is empty, object, if search is set
|
|
|
|
|
* and only one entry, then string, else array
|
|
|
|
|
* unless single is true
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function getQueryStringParam(search = '', query = '', single = false) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
return _getQueryStringParam(search, query, single);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// MARK: ACL LOGIN
|
|
|
|
|
// *** MASTER logout call
|
|
|
|
|
/**
|
|
|
|
|
* submits basic data for form logout
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function loginLogout() // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
_loginLogout();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* create login string and logout button elements
|
|
|
|
|
* @param {String} login_string the login string to show on the left
|
|
|
|
|
* @param {String} [header_id='mainHeader'] the target for the main element block
|
|
|
|
|
* if not set mainHeader is assumed
|
|
|
|
|
* this is the target div for the "loginRow"
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function createLoginRow(login_string, header_id = 'mainHeader') // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
2025-03-07 15:26:38 +09:00
|
|
|
lnm.createLoginRow(login_string, header_id);
|
2025-03-07 14:46:38 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* create the top nav menu that switches physical between pages
|
|
|
|
|
* (edit access data based)
|
|
|
|
|
* @param {Object} nav_menu the built nav menu with highlight info
|
|
|
|
|
* @param {String} [header_id='mainHeader'] the target for the main element block
|
|
|
|
|
* if not set mainHeader is assumed
|
|
|
|
|
* this is the target div for the "menuRow"
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function createNavMenu(nav_menu, header_id = 'mainHeader') // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
2025-03-07 15:26:38 +09:00
|
|
|
lnm.createNavMenu(nav_menu, header_id);
|
2025-03-07 14:46:38 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// MARK: ACTION BOX
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Show an action box
|
|
|
|
|
* @param {string} [target_id='actionBox'] where to attach content to, if not exists, create new
|
|
|
|
|
* @param {string} [content=''] content to add to the box
|
|
|
|
|
* @param {array} [action_box_css=[]] additional css elements for the action box
|
|
|
|
|
* @param {number} [override=0] override size adjust
|
|
|
|
|
* @param {number} [content_override=0] override content size adjust
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function showFillActionBox(target_id = 'actionBox', content = '', action_box_css = [], override = 0, content_override = 0) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
ab.showFillActionBox(target_id, content, action_box_css, override, content_override);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Fill action box with content, create it if it does not existgs
|
|
|
|
|
* @param {string} [target_id='actionBox'] where to attach content to, if not exists, create new
|
|
|
|
|
* @param {string} [content=''] content to add to the box
|
|
|
|
|
* @param {array} [action_box_css=[]] additional css elements for the action box
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function fillActionBox(target_id = 'actionBox', content = '', action_box_css = []) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
// show action box, calc height + center
|
|
|
|
|
ab.fillActionBox(target_id, content, action_box_css);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Adjust the size of the action box
|
|
|
|
|
* @param {string} [target_id='actionBox'] which actionBox to work on
|
|
|
|
|
* @param {number} [override=0] override size adjust
|
|
|
|
|
* @param {number} [content_override=0] override content size adjust
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function adjustActionBox(target_id = 'actionBox', override = 0, content_override = 0) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
ab.adjustActionBox(target_id, override, content_override);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* hide any open action boxes and hide overlay
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function hideAllActionBoxes() // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
ab.hideAllActionBoxes();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* hide action box, but do not clear content
|
|
|
|
|
* DEPRECATED
|
|
|
|
|
* @param {string} [target_id='actionBox']
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function hideActionBox(target_id = 'actionBox') // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
ab.hideActionBox(target_id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Just show and adjust the box
|
|
|
|
|
* DEPRECAED
|
|
|
|
|
* @param {string} [target_id='actionBox'] which actionBox to work on
|
|
|
|
|
* @param {number} [override=0] override size adjust
|
|
|
|
|
* @param {number} [content_override=0] override content size adjust
|
|
|
|
|
* @param {Boolean} [hide_all=false] if set to true, hide all other action boxes
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function showActionBox(target_id = 'actionBox', override = 0, content_override = 0, hide_all = true) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
ab.showActionBox(target_id, override, content_override, hide_all);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* close an action box with default clear content
|
|
|
|
|
* for just hide use hideActionBox
|
|
|
|
|
* DEPRECATED
|
|
|
|
|
* @param {String} [target_id='actionBox'] which action box to close, default is set
|
|
|
|
|
* @param {Boolean} [clean=true] if set to false will not remove html content, just hide
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function closeActionBox(target_id = 'actionBox', clean = true) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
// set the target/content ids
|
|
|
|
|
ab.closeActionBox(target_id, clean);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* TODO: better stacked action box: OPEN
|
|
|
|
|
* @param {string} [target_id='actionBox'] which actionBox to work on
|
|
|
|
|
* @param {number} [override=0] override size adjust
|
|
|
|
|
* @param {number} [content_override=0] override content size adjust
|
|
|
|
|
* @param {Boolean} [hide_all=false] if set to true, hide all other action boxes
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function showActionBoxFloat(target_id = 'actionBox', override = 0, content_override = 0, hide_all = false) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
ab.showActionBoxFloat(target_id, override, content_override, hide_all);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* TODO: better stacked action box: CLOSE
|
|
|
|
|
* @param {String} [target_id='actionBox'] which action box to close, default is set
|
|
|
|
|
* @param {Boolean} [clean=true] if set to false will not remove html content, just hide
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function closeActionBoxFloat(target_id = 'actionBox', clean = true) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
ab.closeActionBoxFloat(target_id, clean);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* create a new action box and fill it with basic elements
|
|
|
|
|
* @param {String} [target_id='actionBox']
|
|
|
|
|
* @param {String} [title='']
|
|
|
|
|
* @param {Object} [contents={}]
|
|
|
|
|
* @param {Object} [headers={}]
|
|
|
|
|
* @param {Boolean} [show_close=true]
|
|
|
|
|
* @param {Object} [settings={}] Optional settings, eg style sheets
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function createActionBox( // eslint-disable-line no-unused-vars
|
|
|
|
|
target_id = 'actionBox',
|
|
|
|
|
title = '',
|
|
|
|
|
contents = {},
|
|
|
|
|
headers = {},
|
|
|
|
|
settings = {},
|
|
|
|
|
show_close = true
|
|
|
|
|
) {
|
|
|
|
|
ab.createActionBox(target_id, title, contents, headers, settings, show_close);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* adjusts the action box height based on content and window height of browser
|
|
|
|
|
* TODO: border on outside/and other margin things need to be added in overall adjustment
|
|
|
|
|
* @param {String} [target_id='actionBox'] target id, if not set, fall back to default
|
|
|
|
|
* @param {Number} [override=0] override value to add to the actionBox height
|
|
|
|
|
* @param {Number} [content_override=0] override the value from _content block if it exists
|
|
|
|
|
*/
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
function adjustActionBoxHeight(target_id = 'actionBox', override = 0, content_override = 0) // eslint-disable-line no-unused-vars
|
|
|
|
|
{
|
|
|
|
|
ab.adjustActionBoxHeight(target_id, override, content_override);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* END */
|