Fully deprecate prototype edit.js, add deprecation warnings to edit.jq.js and add new utils

Note that all the utils.js are build in an external repository and just copied here
This commit is contained in:
Clemens Schwaighofer
2025-03-10 11:00:02 +09:00
parent bbcc642fde
commit e71df90144
6 changed files with 259 additions and 127 deletions

View File

@@ -40,7 +40,7 @@ final class CoreLibsConvertByteTest extends TestCase
4 => '1.00 KB', 4 => '1.00 KB',
5 => '1.02KiB', 5 => '1.02KiB',
], ],
'invalud string number' => [ 'invalid string number' => [
0 => '1024 MB', 0 => '1024 MB',
1 => '1024 MB', 1 => '1024 MB',
2 => '1024 MB', 2 => '1024 MB',

View File

@@ -1,5 +1,9 @@
/* general edit javascript */ /*
/* jquery version */ general edit javascript
jquery version
*/
/** @deprecated Do not use this anymore, use utils.js or utils.min.js */
/* global i18n */ /* global i18n */
@@ -21,6 +25,7 @@ var GL_OB_BASE = 100;
* @param {string} el_id Element ID to get * @param {string} el_id Element ID to get
* @returns {HTMLElement} * @returns {HTMLElement}
* @throws Error * @throws Error
* @deprecated use utils.js
*/ */
function loadEl(el_id) function loadEl(el_id)
{ {
@@ -36,6 +41,7 @@ function loadEl(el_id)
* @param {String} theURL the url * @param {String} theURL the url
* @param {String} winName window name * @param {String} winName window name
* @param {Object} features popup features * @param {Object} features popup features
* @deprecated use utils.js
*/ */
function pop(theURL, winName, features) // eslint-disable-line no-unused-vars function pop(theURL, winName, features) // eslint-disable-line no-unused-vars
{ {
@@ -46,6 +52,7 @@ function pop(theURL, winName, features) // eslint-disable-line no-unused-vars
/** /**
* automatically resize a text area based on the amount of lines in it * automatically resize a text area based on the amount of lines in it
* @param {string} ta_id element id * @param {string} ta_id element id
* @deprecated use utils.js
*/ */
function expandTA(ta_id) // eslint-disable-line no-unused-vars function expandTA(ta_id) // eslint-disable-line no-unused-vars
{ {
@@ -71,6 +78,7 @@ function expandTA(ta_id) // eslint-disable-line no-unused-vars
/** /**
* wrapper to get the real window size for the current browser window * wrapper to get the real window size for the current browser window
* @return {Object} object with width/height * @return {Object} object with width/height
* @deprecated use utils.js
*/ */
function getWindowSize() function getWindowSize()
{ {
@@ -86,6 +94,7 @@ function getWindowSize()
/** /**
* wrapper to get the correct scroll offset * wrapper to get the correct scroll offset
* @return {Object} object with x/y px * @return {Object} object with x/y px
* @deprecated use utils.js
*/ */
function getScrollOffset() function getScrollOffset()
{ {
@@ -101,6 +110,7 @@ function getScrollOffset()
/** /**
* wrapper to get the correct scroll offset for opener page (from popup) * wrapper to get the correct scroll offset for opener page (from popup)
* @return {Object} object with x/y px * @return {Object} object with x/y px
* @deprecated use utils.js
*/ */
function getScrollOffsetOpener() // eslint-disable-line no-unused-vars function getScrollOffsetOpener() // eslint-disable-line no-unused-vars
{ {
@@ -118,6 +128,7 @@ function getScrollOffsetOpener() // eslint-disable-line no-unused-vars
* @param {String} id element to center * @param {String} id element to center
* @param {Boolean} left if true centers to the middle from the left * @param {Boolean} left if true centers to the middle from the left
* @param {Boolean} top if true centers to the middle from the top * @param {Boolean} top if true centers to the middle from the top
* @deprecated use utils.js
*/ */
function setCenter(id, left, top) function setCenter(id, left, top)
{ {
@@ -155,6 +166,7 @@ function setCenter(id, left, top)
* @param {Number} [offset=0] offset from top, default is 0 (px) * @param {Number} [offset=0] offset from top, default is 0 (px)
* @param {Number} [duration=500] animation time, default 500ms * @param {Number} [duration=500] animation time, default 500ms
* @param {String} [base='body,html'] base element for offset scroll * @param {String} [base='body,html'] base element for offset scroll
* @deprecated use utils.js
*/ */
function goToPos(element, offset = 0, duration = 500, base = 'body,html') // eslint-disable-line no-unused-vars function goToPos(element, offset = 0, duration = 500, base = 'body,html') // eslint-disable-line no-unused-vars
{ {
@@ -173,6 +185,7 @@ function goToPos(element, offset = 0, duration = 500, base = 'body,html') // esl
* go to element, scroll * go to element, scroll
* non jquery * non jquery
* @param {string} target * @param {string} target
* @deprecated use utils.js
*/ */
function goTo(target) // eslint-disable-line no-unused-vars function goTo(target) // eslint-disable-line no-unused-vars
{ {
@@ -186,6 +199,7 @@ function goTo(target) // eslint-disable-line no-unused-vars
* that is filled from gettext in PHP * that is filled from gettext in PHP
* @param {String} string text to translate * @param {String} string text to translate
* @return {String} translated text (based on PHP selected language) * @return {String} translated text (based on PHP selected language)
* @deprecated use utils.js
*/ */
function __(string) function __(string)
{ {
@@ -202,6 +216,7 @@ function __(string)
* First, checks if it isn't implemented yet. * First, checks if it isn't implemented yet.
* @param {String} String.prototype.format string with elements to be replaced * @param {String} String.prototype.format string with elements to be replaced
* @return {String} Formated string * @return {String} Formated string
* @deprecated use utils.js
*/ */
if (!String.prototype.format) { if (!String.prototype.format) {
String.prototype.format = function() String.prototype.format = function()
@@ -218,6 +233,7 @@ if (!String.prototype.format) {
* @param {String} string String with {..} entries * @param {String} string String with {..} entries
* @param {...any} args List of replacement * @param {...any} args List of replacement
* @returns {String} Escaped string * @returns {String} Escaped string
* @deprecated use utils.js
*/ */
function formatString(string, ...args) function formatString(string, ...args)
{ {
@@ -235,6 +251,7 @@ function formatString(string, ...args)
* @param {Number} Number.prototype.round Float type number to round * @param {Number} Number.prototype.round Float type number to round
* @param {Number} prec Precision to round to * @param {Number} prec Precision to round to
* @return {Float} Rounded number * @return {Float} Rounded number
* @deprecated use utils.js
*/ */
if (Number.prototype.round) { if (Number.prototype.round) {
Number.prototype.round = function (prec) { Number.prototype.round = function (prec) {
@@ -248,6 +265,7 @@ if (Number.prototype.round) {
* @param {Number} number Float type number to round * @param {Number} number Float type number to round
* @param {Number} precision Precision to round to * @param {Number} precision Precision to round to
* @return {Number} Rounded number * @return {Number} Rounded number
* @deprecated use utils.js
*/ */
function roundPrecision(number, precision) function roundPrecision(number, precision)
{ {
@@ -261,6 +279,7 @@ function roundPrecision(number, precision)
* formats flat number 123456 to 123,456 * formats flat number 123456 to 123,456
* @param {Number} x number to be formated * @param {Number} x number to be formated
* @return {String} formatted with , in thousands * @return {String} formatted with , in thousands
* @deprecated use utils.js
*/ */
function numberWithCommas(x) // eslint-disable-line no-unused-vars function numberWithCommas(x) // eslint-disable-line no-unused-vars
{ {
@@ -273,6 +292,7 @@ function numberWithCommas(x) // eslint-disable-line no-unused-vars
* converts line breaks to br * converts line breaks to br
* @param {String} string any string * @param {String} string any string
* @return {String} string with <br> * @return {String} string with <br>
* @deprecated use utils.js
*/ */
function convertLBtoBR(string) // eslint-disable-line no-unused-vars function convertLBtoBR(string) // eslint-disable-line no-unused-vars
{ {
@@ -283,6 +303,7 @@ function convertLBtoBR(string) // eslint-disable-line no-unused-vars
* escape HTML string * escape HTML string
* @param {String} String.prototype.escapeHTML HTML data string to be escaped * @param {String} String.prototype.escapeHTML HTML data string to be escaped
* @return {String} escaped string * @return {String} escaped string
* @deprecated use utils.js
*/ */
if (!String.prototype.escapeHTML) { if (!String.prototype.escapeHTML) {
String.prototype.escapeHTML = function() { String.prototype.escapeHTML = function() {
@@ -295,6 +316,7 @@ if (!String.prototype.escapeHTML) {
* unescape a HTML encoded string * unescape a HTML encoded string
* @param {String} String.prototype.unescapeHTML data with escaped entries * @param {String} String.prototype.unescapeHTML data with escaped entries
* @return {String} HTML formated string * @return {String} HTML formated string
* @deprecated use utils.js
*/ */
if (!String.prototype.unescapeHTML) { if (!String.prototype.unescapeHTML) {
String.prototype.unescapeHTML = function() { String.prototype.unescapeHTML = function() {
@@ -307,6 +329,7 @@ if (!String.prototype.unescapeHTML) {
* Escapes HTML in string * Escapes HTML in string
* @param {String} string Text to escape HTML in * @param {String} string Text to escape HTML in
* @returns {String} * @returns {String}
* @deprecated use utils.js
*/ */
function escapeHtml(string) function escapeHtml(string)
{ {
@@ -328,6 +351,7 @@ function escapeHtml(string)
* Unescape a HTML encoded string * Unescape a HTML encoded string
* @param {String} string Text to unescape HTML in * @param {String} string Text to unescape HTML in
* @returns {String} * @returns {String}
* @deprecated use utils.js
*/ */
function unescapeHtml(string) function unescapeHtml(string)
{ {
@@ -348,6 +372,7 @@ function unescapeHtml(string)
/** /**
* returns current timestamp (unix timestamp) * returns current timestamp (unix timestamp)
* @return {Number} timestamp (in milliseconds) * @return {Number} timestamp (in milliseconds)
* @deprecated use utils.js
*/ */
function getTimestamp() // eslint-disable-line no-unused-vars function getTimestamp() // eslint-disable-line no-unused-vars
{ {
@@ -360,6 +385,7 @@ function getTimestamp() // eslint-disable-line no-unused-vars
* i.e. 0-255 -> '00'-'ff' * i.e. 0-255 -> '00'-'ff'
* @param {Number} dec decimal string * @param {Number} dec decimal string
* @return {String} hex encdoded number * @return {String} hex encdoded number
* @deprecated use utils.js
*/ */
function dec2hex(dec) function dec2hex(dec)
{ {
@@ -371,6 +397,7 @@ function dec2hex(dec)
* only works on mondern browsers * only works on mondern browsers
* @param {Number} len length of unique id string * @param {Number} len length of unique id string
* @return {String} random string in length of len * @return {String} random string in length of len
* @deprecated use utils.js
*/ */
function generateId(len) // eslint-disable-line no-unused-vars function generateId(len) // eslint-disable-line no-unused-vars
{ {
@@ -384,6 +411,7 @@ function generateId(len) // eslint-disable-line no-unused-vars
* works on all browsers * works on all browsers
* after many runs it will create duplicates * after many runs it will create duplicates
* @return {String} not true random string * @return {String} not true random string
* @deprecated use utils.js
*/ */
function randomIdF() // eslint-disable-line no-unused-vars function randomIdF() // eslint-disable-line no-unused-vars
{ {
@@ -397,6 +425,7 @@ function randomIdF() // eslint-disable-line no-unused-vars
* @param {Number} min minimum int number inclusive * @param {Number} min minimum int number inclusive
* @param {Number} max maximumg int number inclusive * @param {Number} max maximumg int number inclusive
* @return {Number} Random number * @return {Number} Random number
* @deprecated use utils.js
*/ */
function getRandomIntInclusive(min, max) // eslint-disable-line no-unused-vars function getRandomIntInclusive(min, max) // eslint-disable-line no-unused-vars
{ {
@@ -410,6 +439,7 @@ function getRandomIntInclusive(min, max) // eslint-disable-line no-unused-vars
* check if name is a function * check if name is a function
* @param {string} name Name of function to check if exists * @param {string} name Name of function to check if exists
* @return {Boolean} true/false * @return {Boolean} true/false
* @deprecated use utils.js
*/ */
function isFunction(name) // eslint-disable-line no-unused-vars function isFunction(name) // eslint-disable-line no-unused-vars
{ {
@@ -429,6 +459,7 @@ function isFunction(name) // eslint-disable-line no-unused-vars
* @param {mixed} context context (window or first namespace) * @param {mixed} context context (window or first namespace)
* hidden next are all the arguments * hidden next are all the arguments
* @return {mixed} Return values from functon * @return {mixed} Return values from functon
* @deprecated use utils.js
*/ */
function executeFunctionByName(functionName, context /*, args */) // eslint-disable-line no-unused-vars function executeFunctionByName(functionName, context /*, args */) // eslint-disable-line no-unused-vars
{ {
@@ -445,6 +476,7 @@ function executeFunctionByName(functionName, context /*, args */) // eslint-disa
* checks if a variable is an object * checks if a variable is an object
* @param {Mixed} val possible object * @param {Mixed} val possible object
* @return {Boolean} true/false if it is an object or not * @return {Boolean} true/false if it is an object or not
* @deprecated use utils.js
*/ */
function isObject(val) function isObject(val)
{ {
@@ -458,6 +490,7 @@ function isObject(val)
* get the length of an object (entries) * get the length of an object (entries)
* @param {Object} object object to check * @param {Object} object object to check
* @return {Number} number of entry * @return {Number} number of entry
* @deprecated use utils.js
*/ */
function getObjectCount(object) function getObjectCount(object)
{ {
@@ -469,6 +502,7 @@ function getObjectCount(object)
* @param {String} key key name * @param {String} key key name
* @param {Object} object object to search key in * @param {Object} object object to search key in
* @return {Boolean} true/false if key exists in object * @return {Boolean} true/false if key exists in object
* @deprecated use utils.js
*/ */
function keyInObject(key, object) function keyInObject(key, object)
{ {
@@ -480,6 +514,7 @@ function keyInObject(key, object)
* @param {Object} object object to search value in * @param {Object} object object to search value in
* @param {Mixed} value any value (String, Number, etc) * @param {Mixed} value any value (String, Number, etc)
* @return {String} the key found for the first matching value * @return {String} the key found for the first matching value
* @deprecated use utils.js
*/ */
function getKeyByValue(object, value) // eslint-disable-line no-unused-vars function getKeyByValue(object, value) // eslint-disable-line no-unused-vars
{ {
@@ -494,6 +529,7 @@ function getKeyByValue(object, value) // eslint-disable-line no-unused-vars
* @param {Object} object object to search value in * @param {Object} object object to search value in
* @param {Mixed} value any value (String, Number, etc) * @param {Mixed} value any value (String, Number, etc)
* @return {Boolean} true on value found, false on not found * @return {Boolean} true on value found, false on not found
* @deprecated use utils.js
*/ */
function valueInObject(object, value) // eslint-disable-line no-unused-vars function valueInObject(object, value) // eslint-disable-line no-unused-vars
{ {
@@ -509,6 +545,7 @@ function valueInObject(object, value) // eslint-disable-line no-unused-vars
* or if JSON.parse(JSON.stringify(obj)) is failing * or if JSON.parse(JSON.stringify(obj)) is failing
* @param {Object} inObject Object to copy * @param {Object} inObject Object to copy
* @return {Object} Copied Object * @return {Object} Copied Object
* @deprecated use utils.js
*/ */
function deepCopyFunction(inObject) function deepCopyFunction(inObject)
{ {
@@ -532,6 +569,7 @@ function deepCopyFunction(inObject)
* checks if a DOM element actually exists * checks if a DOM element actually exists
* @param {String} id Element id to check for * @param {String} id Element id to check for
* @return {Boolean} true if element exists, false on failure * @return {Boolean} true if element exists, false on failure
* @deprecated use utils.js
*/ */
function exists(id) function exists(id)
{ {
@@ -543,6 +581,7 @@ function exists(id)
* currently precision is fixed, if dynamic needs check for max/min precision * currently precision is fixed, if dynamic needs check for max/min precision
* @param {Number} bytes bytes in int * @param {Number} bytes bytes in int
* @return {String} string in GB/MB/KB * @return {String} string in GB/MB/KB
* @deprecated use utils.js
*/ */
function formatBytes(bytes) // eslint-disable-line no-unused-vars function formatBytes(bytes) // eslint-disable-line no-unused-vars
{ {
@@ -559,6 +598,7 @@ function formatBytes(bytes) // eslint-disable-line no-unused-vars
* like formatBytes, but returns bytes for <1KB and not 0.n KB * like formatBytes, but returns bytes for <1KB and not 0.n KB
* @param {Number} bytes bytes in int * @param {Number} bytes bytes in int
* @return {String} string in GB/MB/KB * @return {String} string in GB/MB/KB
* @deprecated use utils.js
*/ */
function formatBytesLong(bytes) // eslint-disable-line no-unused-vars function formatBytesLong(bytes) // eslint-disable-line no-unused-vars
{ {
@@ -571,6 +611,7 @@ function formatBytesLong(bytes) // eslint-disable-line no-unused-vars
* Convert a string with B/K/M/etc into a byte number * Convert a string with B/K/M/etc into a byte number
* @param {String|Number} bytes Any string with B/K/M/etc * @param {String|Number} bytes Any string with B/K/M/etc
* @return {String|Number} A byte number, or original string as is * @return {String|Number} A byte number, or original string as is
* @deprecated use utils.js
*/ */
function stringByteFormat(bytes) // eslint-disable-line no-unused-vars function stringByteFormat(bytes) // eslint-disable-line no-unused-vars
{ {
@@ -601,6 +642,7 @@ function stringByteFormat(bytes) // eslint-disable-line no-unused-vars
/** /**
* prints out error messages based on data available from the browser * prints out error messages based on data available from the browser
* @param {Object} err error from try/catch block * @param {Object} err error from try/catch block
* @deprecated use utils.js
*/ */
function errorCatch(err) function errorCatch(err)
{ {
@@ -644,6 +686,7 @@ function errorCatch(err)
* @param {String} loc location name for action indicator * @param {String} loc location name for action indicator
* default empty. for console.log * default empty. for console.log
* @param {Boolean} [overlay=true] override the auto hide/show over the overlay div block * @param {Boolean} [overlay=true] override the auto hide/show over the overlay div block
* @deprecated use utils.js
*/ */
function actionIndicator(loc, overlay = true) // eslint-disable-line no-unused-vars function actionIndicator(loc, overlay = true) // eslint-disable-line no-unused-vars
{ {
@@ -660,6 +703,7 @@ function actionIndicator(loc, overlay = true) // eslint-disable-line no-unused-v
* @param {String} loc location name for action indicator * @param {String} loc location name for action indicator
* default empty. for console.log * default empty. for console.log
* @param {Boolean} [overlay=true] override the auto hide/show over the overlay div block * @param {Boolean} [overlay=true] override the auto hide/show over the overlay div block
* @deprecated use utils.js
*/ */
function actionIndicatorShow(loc, overlay = true) function actionIndicatorShow(loc, overlay = true)
{ {
@@ -682,6 +726,7 @@ function actionIndicatorShow(loc, overlay = true)
* @param {String} loc location name for action indicator * @param {String} loc location name for action indicator
* default empty. for console.log * default empty. for console.log
* @param {Boolean} [overlay=true] override the auto hide/show over the overlay div block * @param {Boolean} [overlay=true] override the auto hide/show over the overlay div block
* @deprecated use utils.js
*/ */
function actionIndicatorHide(loc, overlay = true) function actionIndicatorHide(loc, overlay = true)
{ {
@@ -694,6 +739,7 @@ function actionIndicatorHide(loc, overlay = true)
/** /**
* shows the overlay box or if already visible, bumps the zIndex to 100 * shows the overlay box or if already visible, bumps the zIndex to 100
* @deprecated use utils.js
*/ */
function overlayBoxShow() function overlayBoxShow()
{ {
@@ -708,6 +754,7 @@ function overlayBoxShow()
/** /**
* hides the overlay box or if zIndex is 100 bumps it down to previous level * hides the overlay box or if zIndex is 100 bumps it down to previous level
* @deprecated use utils.js
*/ */
function overlayBoxHide() function overlayBoxHide()
{ {
@@ -721,6 +768,7 @@ function overlayBoxHide()
/** /**
* position the overlay block box and shows it * position the overlay block box and shows it
* @deprecated use utils.js
*/ */
function setOverlayBox() // eslint-disable-line no-unused-vars function setOverlayBox() // eslint-disable-line no-unused-vars
{ {
@@ -731,6 +779,7 @@ function setOverlayBox() // eslint-disable-line no-unused-vars
/** /**
* opposite of set, always hides overlay box * opposite of set, always hides overlay box
* @deprecated use utils.js
*/ */
function hideOverlayBox() // eslint-disable-line no-unused-vars function hideOverlayBox() // eslint-disable-line no-unused-vars
{ {
@@ -741,6 +790,7 @@ function hideOverlayBox() // eslint-disable-line no-unused-vars
/** /**
* the abort call, clears the action box and hides it and the overlay box * the abort call, clears the action box and hides it and the overlay box
* @deprecated use utils.js
*/ */
function ClearCall() // eslint-disable-line no-unused-vars function ClearCall() // eslint-disable-line no-unused-vars
{ {
@@ -762,6 +812,7 @@ function ClearCall() // eslint-disable-line no-unused-vars
* zIndex of 1000 * zIndex of 1000
* - indicator is page centered * - indicator is page centered
* @param {String} loc ID string, only used for console log * @param {String} loc ID string, only used for console log
* @deprecated use utils.js
*/ */
function showActionIndicator(loc) // eslint-disable-line no-unused-vars function showActionIndicator(loc) // eslint-disable-line no-unused-vars
{ {
@@ -800,6 +851,7 @@ function showActionIndicator(loc) // eslint-disable-line no-unused-vars
* the overlayBox is not hidden but the zIndex * the overlayBox is not hidden but the zIndex
* is set to this value * is set to this value
* @param {String} loc ID string, only used for console log * @param {String} loc ID string, only used for console log
* @deprecated use utils.js
*/ */
function hideActionIndicator(loc) // eslint-disable-line no-unused-vars function hideActionIndicator(loc) // eslint-disable-line no-unused-vars
{ {
@@ -823,6 +875,7 @@ function hideActionIndicator(loc) // eslint-disable-line no-unused-vars
/** /**
* checks if overlayBox exists, if not it is * checks if overlayBox exists, if not it is
* added as hidden item at the body end * added as hidden item at the body end
* @deprecated use utils.js
*/ */
function checkOverlayExists() function checkOverlayExists()
{ {
@@ -840,6 +893,7 @@ function checkOverlayExists()
* if not visible show and set zIndex to 10 (GL_OB_BASE) * if not visible show and set zIndex to 10 (GL_OB_BASE)
* if visible, add +1 to the GL_OB_S variable and * if visible, add +1 to the GL_OB_S variable and
* up zIndex by this value * up zIndex by this value
* @deprecated use utils.js
*/ */
function showOverlayBoxLayers(el_id) // eslint-disable-line no-unused-vars function showOverlayBoxLayers(el_id) // eslint-disable-line no-unused-vars
{ {
@@ -872,6 +926,7 @@ function showOverlayBoxLayers(el_id) // eslint-disable-line no-unused-vars
* and set zIndex and GL_OB_S to 0 * and set zIndex and GL_OB_S to 0
* else just set zIndex to the new GL_OB_S value * else just set zIndex to the new GL_OB_S value
* @param {String} el_id Target to hide layer * @param {String} el_id Target to hide layer
* @deprecated use utils.js
*/ */
function hideOverlayBoxLayers(el_id='') function hideOverlayBoxLayers(el_id='')
{ {
@@ -897,6 +952,7 @@ function hideOverlayBoxLayers(el_id='')
/** /**
* only for single action box * only for single action box
* @deprecated use utils.js
*/ */
function clearCallActionBox() // eslint-disable-line no-unused-vars function clearCallActionBox() // eslint-disable-line no-unused-vars
{ {
@@ -914,6 +970,7 @@ function clearCallActionBox() // eslint-disable-line no-unused-vars
* @param {Array} [css=[]] array for css tags * @param {Array} [css=[]] array for css tags
* @param {Object} [options={}] anything else (value, placeholder, OnClick, style) * @param {Object} [options={}] anything else (value, placeholder, OnClick, style)
* @return {Object} created element as an object * @return {Object} created element as an object
* @deprecated use utils.js
*/ */
function cel(tag, id = '', content = '', css = [], options = {}) function cel(tag, id = '', content = '', css = [], options = {})
{ {
@@ -934,6 +991,7 @@ function cel(tag, id = '', content = '', css = [], options = {})
* @param {Object} attach the object to be attached * @param {Object} attach the object to be attached
* @param {String} [id=''] optional id, if given search in base for this id and attach there * @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 * @return {Object} "none", technically there is no return needed as it is global attach
* @deprecated use utils.js
*/ */
function ael(base, attach, id = '') function ael(base, attach, id = '')
{ {
@@ -964,6 +1022,7 @@ function ael(base, attach, id = '')
* @param {Object} base object to where we attach the elements * @param {Object} base object to where we attach the elements
* @param {...Object} attach attach 1..n: attach directly to the base element those attachments * @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 * @return {Object} "none", technically there is no return needed, global attach
* @deprecated use utils.js
*/ */
function aelx(base, ...attach) function aelx(base, ...attach)
{ {
@@ -980,6 +1039,7 @@ function aelx(base, ...attach)
* @param {Object} base object to where we attach the elements * @param {Object} base object to where we attach the elements
* @param {Array} attach array of objects to attach * @param {Array} attach array of objects to attach
* @return {Object} "none", technically there is no return needed, global attach * @return {Object} "none", technically there is no return needed, global attach
* @deprecated use utils.js
*/ */
function aelxar(base, attach) // eslint-disable-line no-unused-vars function aelxar(base, attach) // eslint-disable-line no-unused-vars
{ {
@@ -994,6 +1054,7 @@ function aelxar(base, attach) // eslint-disable-line no-unused-vars
* resets the sub elements of the base element given * resets the sub elements of the base element given
* @param {Object} base cel created element * @param {Object} base cel created element
* @return {Object} returns reset base element * @return {Object} returns reset base element
* @deprecated use utils.js
*/ */
function rel(base) // eslint-disable-line no-unused-vars function rel(base) // eslint-disable-line no-unused-vars
{ {
@@ -1006,6 +1067,7 @@ function rel(base) // eslint-disable-line no-unused-vars
* @param {Object} _element element to work one * @param {Object} _element element to work one
* @param {String} css style sheet to remove (name) * @param {String} css style sheet to remove (name)
* @return {Object} returns full element * @return {Object} returns full element
* @deprecated use utils.js
*/ */
function rcssel(_element, css) function rcssel(_element, css)
{ {
@@ -1021,6 +1083,7 @@ function rcssel(_element, css)
* @param {Object} _element element to work on * @param {Object} _element element to work on
* @param {String} css style sheet to add (name) * @param {String} css style sheet to add (name)
* @return {Object} returns full element * @return {Object} returns full element
* @deprecated use utils.js
*/ */
function acssel(_element, css) function acssel(_element, css)
{ {
@@ -1038,6 +1101,7 @@ function acssel(_element, css)
* @param {String} rcss style to remove (name) * @param {String} rcss style to remove (name)
* @param {String} acss style to add (name) * @param {String} acss style to add (name)
* @return {Object} returns full element * @return {Object} returns full element
* @deprecated use utils.js
*/ */
function scssel(_element, rcss, acss) // eslint-disable-line no-unused-vars function scssel(_element, rcss, acss) // eslint-disable-line no-unused-vars
{ {
@@ -1050,6 +1114,7 @@ function scssel(_element, rcss, acss) // eslint-disable-line no-unused-vars
* that can be inserted into the page * that can be inserted into the page
* @param {Object} tree object tree with dom element declarations * @param {Object} tree object tree with dom element declarations
* @return {String} HTML string that can be used as innerHTML * @return {String} HTML string that can be used as innerHTML
* @deprecated use utils.js
*/ */
function phfo(tree) function phfo(tree)
{ {
@@ -1156,6 +1221,7 @@ function phfo(tree)
* Is like tree.sub call * Is like tree.sub call
* @param {Array} list Array of cel created objects * @param {Array} list Array of cel created objects
* @return {String} HTML String * @return {String} HTML String
* @deprecated use utils.js
*/ */
function phfa(list) // eslint-disable-line no-unused-vars function phfa(list) // eslint-disable-line no-unused-vars
{ {
@@ -1182,6 +1248,7 @@ function phfa(list) // eslint-disable-line no-unused-vars
* @param {String} [sort=''] if empty as is, else allowed 'keys', * @param {String} [sort=''] if empty as is, else allowed 'keys',
* 'values' all others are ignored * 'values' all others are ignored
* @return {String} html with build options block * @return {String} html with build options block
* @deprecated use utils.js
*/ */
function html_options(name, data, selected = '', options_only = false, return_string = false, sort = '') // eslint-disable-line no-unused-vars function html_options(name, data, selected = '', options_only = false, return_string = false, sort = '') // eslint-disable-line no-unused-vars
{ {
@@ -1209,6 +1276,7 @@ function html_options(name, data, selected = '', options_only = false, return_st
* 'values' all others are ignored * 'values' all others are ignored
* @param {String} [onchange=''] onchange trigger call, default unset * @param {String} [onchange=''] onchange trigger call, default unset
* @return {String} html with build options block * @return {String} html with build options block
* @deprecated use utils.js
*/ */
function html_options_block( function html_options_block(
name, data, selected = '', multiple = 0, options_only = false, return_string = false, sort = '', onchange = '' name, data, selected = '', multiple = 0, options_only = false, return_string = false, sort = '', onchange = ''
@@ -1291,6 +1359,7 @@ function html_options_block(
* @param {String} name name/id * @param {String} name name/id
* @param {Object} data array of options * @param {Object} data array of options
* @param {String} [sort=''] if empty as is, else allowed 'keys', 'values' * @param {String} [sort=''] if empty as is, else allowed 'keys', 'values'
* @deprecated use utils.js
* all others are ignored * all others are ignored
*/ */
function html_options_refill(name, data, sort = '') // eslint-disable-line no-unused-vars function html_options_refill(name, data, sort = '') // eslint-disable-line no-unused-vars
@@ -1339,6 +1408,7 @@ function html_options_refill(name, data, sort = '') // eslint-disable-line no-un
* @param {String} [return_key=''] if set only returns this key entry * @param {String} [return_key=''] if set only returns this key entry
* or empty for none * or empty for none
* @return {Object|String} parameter entry list * @return {Object|String} parameter entry list
* @deprecated use utils.js
*/ */
function parseQueryString(query = '', return_key = '') // eslint-disable-line no-unused-vars function parseQueryString(query = '', return_key = '') // eslint-disable-line no-unused-vars
{ {
@@ -1393,6 +1463,7 @@ function parseQueryString(query = '', return_key = '') // eslint-disable-line no
* @return {Object|Array|String} if search is empty, object, if search is set * @return {Object|Array|String} if search is empty, object, if search is set
* and only one entry, then string, else array * and only one entry, then string, else array
* unless single is true * unless single is true
* @deprecated use utils.js
*/ */
function getQueryStringParam(search = '', query = '', single = false) // eslint-disable-line no-unused-vars function getQueryStringParam(search = '', query = '', single = false) // eslint-disable-line no-unused-vars
{ {
@@ -1430,6 +1501,7 @@ function getQueryStringParam(search = '', query = '', single = false) // eslint-
// *** MASTER logout call // *** MASTER logout call
/** /**
* submits basic data for form logout * submits basic data for form logout
* @deprecated use utils.js
*/ */
function loginLogout() // eslint-disable-line no-unused-vars function loginLogout() // eslint-disable-line no-unused-vars
{ {
@@ -1450,6 +1522,7 @@ function loginLogout() // eslint-disable-line no-unused-vars
* @param {String} [header_id='mainHeader'] the target for the main element block * @param {String} [header_id='mainHeader'] the target for the main element block
* if not set mainHeader is assumed * if not set mainHeader is assumed
* this is the target div for the "loginRow" * this is the target div for the "loginRow"
* @deprecated use utils.js
*/ */
function createLoginRow(login_string, header_id = 'mainHeader') // eslint-disable-line no-unused-vars function createLoginRow(login_string, header_id = 'mainHeader') // eslint-disable-line no-unused-vars
{ {
@@ -1485,6 +1558,7 @@ function createLoginRow(login_string, header_id = 'mainHeader') // eslint-disabl
* @param {String} [header_id='mainHeader'] the target for the main element block * @param {String} [header_id='mainHeader'] the target for the main element block
* if not set mainHeader is assumed * if not set mainHeader is assumed
* this is the target div for the "menuRow" * this is the target div for the "menuRow"
* @deprecated use utils.js
*/ */
function createNavMenu(nav_menu, header_id = 'mainHeader') // eslint-disable-line no-unused-vars function createNavMenu(nav_menu, header_id = 'mainHeader') // eslint-disable-line no-unused-vars
{ {

View File

@@ -1,5 +1,11 @@
/* general edit javascript */ /*
/* prototype version */ general edit javascript
prototype version
*/
/** @deprecated Do not use this anymore, use utils.js */
throw new Error("Prototype Support is deprected, please switch to jquery and utils.js/utils.min.js");
/* jshint esversion: 6 */ /* jshint esversion: 6 */
@@ -25,7 +31,7 @@ function pop(theURL, winName, features) {
/** /**
* automatically resize a text area based on the amount of lines in it * automatically resize a text area based on the amount of lines in it
* @param {[string} ta_id element id * @param {string} ta_id element id
*/ */
function expandTA(ta_id) { function expandTA(ta_id) {
var ta; var ta;

View File

@@ -1,4 +1,4 @@
// www/admin/layout/js-dev/utils/JavaScriptHelpers.mjs // src/utils/JavaScriptHelpers.mjs
function errorCatch(err) { function errorCatch(err) {
if (err.stack) { if (err.stack) {
if (err.lineNumber) { if (err.lineNumber) {
@@ -41,15 +41,24 @@ function isObject(val) {
return typeof val === "function" || typeof val === "object"; return typeof val === "function" || typeof val === "object";
} }
function getObjectCount(object) { function getObjectCount(object) {
if (!isObject(object)) {
return -1;
}
return Object.keys(object).length; return Object.keys(object).length;
} }
function keyInObject(key, object) { function keyInObject(key, object) {
return objectKeyExists(object, key);
}
function objectKeyExists(object, key) {
return Object.prototype.hasOwnProperty.call(object, key) ? true : false; return Object.prototype.hasOwnProperty.call(object, key) ? true : false;
} }
function getKeyByValue(object, value) { function getKeyByValue(object, value) {
return Object.keys(object).find((key) => object[key] === value) ?? ""; return Object.keys(object).find((key) => object[key] === value) ?? "";
} }
function valueInObject(object, value) { function valueInObject(object, value) {
return objectValueExists(object, value);
}
function objectValueExists(object, value) {
return Object.keys(object).find((key) => object[key] === value) ? true : false; return Object.keys(object).find((key) => object[key] === value) ? true : false;
} }
function deepCopyFunction(inObject) { function deepCopyFunction(inObject) {
@@ -65,7 +74,7 @@ function deepCopyFunction(inObject) {
return outObject; return outObject;
} }
// www/admin/layout/js-dev/utils/DomHelpers.mjs // src/utils/DomHelpers.mjs
function loadEl(el_id) { function loadEl(el_id) {
let el = document.getElementById(el_id); let el = document.getElementById(el_id);
if (el === null) { if (el === null) {
@@ -103,7 +112,7 @@ function exists(id) {
return $("#" + id).length > 0 ? true : false; return $("#" + id).length > 0 ? true : false;
} }
// www/admin/layout/js-dev/utils/HtmlElementCreator.mjs // src/utils/HtmlElementCreator.mjs
var HtmlElementCreator = class { var HtmlElementCreator = class {
/** /**
* reates object for DOM element creation flow * reates object for DOM element creation flow
@@ -324,7 +333,7 @@ var HtmlElementCreator = class {
} }
}; };
// www/admin/layout/js-dev/utils/HtmlHelpers.mjs // src/utils/HtmlHelpers.mjs
var dom = new HtmlElementCreator(); var dom = new HtmlElementCreator();
function escapeHtml(string) { function escapeHtml(string) {
return string.replace(/[&<>"'/]/g, function(s) { return string.replace(/[&<>"'/]/g, function(s) {
@@ -453,9 +462,9 @@ function html_options_refill(name, data, sort = "") {
} }
} }
// www/admin/layout/js-dev/utils/MathHelpers.mjs // src/utils/MathHelpers.mjs
function dec2hex(dec) { function dec2hex(dec) {
return ("0" + dec.toString(16)).substring(-2); return ("0x" + dec.toString(16)).substring(-2);
} }
function getRandomIntInclusive(min, max) { function getRandomIntInclusive(min, max) {
min = Math.ceil(min); min = Math.ceil(min);
@@ -463,13 +472,13 @@ function getRandomIntInclusive(min, max) {
return Math.floor(Math.random() * (max - min + 1) + min); return Math.floor(Math.random() * (max - min + 1) + min);
} }
function roundPrecision(number, precision) { function roundPrecision(number, precision) {
if (!isNaN(number) || !isNaN(precision)) { if (isNaN(number) || isNaN(precision)) {
return number; return number;
} }
return Math.round(number * Math.pow(10, precision)) / Math.pow(10, precision); return Math.round(number * Math.pow(10, precision)) / Math.pow(10, precision);
} }
// www/admin/layout/js-dev/utils/StringHelpers.mjs // src/utils/StringHelpers.mjs
function formatString(string, ...args) { function formatString(string, ...args) {
return string.replace(/{(\d+)}/g, function(match, number) { return string.replace(/{(\d+)}/g, function(match, number) {
return typeof args[number] != "undefined" ? args[number] : match; return typeof args[number] != "undefined" ? args[number] : match;
@@ -484,13 +493,13 @@ function convertLBtoBR(string) {
return string.replace(/(?:\r\n|\r|\n)/g, "<br>"); return string.replace(/(?:\r\n|\r|\n)/g, "<br>");
} }
// www/admin/layout/js-dev/utils/DateTimeHelpers.mjs // src/utils/DateTimeHelpers.mjs
function getTimestamp() { function getTimestamp() {
var date = /* @__PURE__ */ new Date(); var date = /* @__PURE__ */ new Date();
return date.getTime(); return date.getTime();
} }
// www/admin/layout/js-dev/utils/UniqIdGenerators.mjs // src/utils/UniqIdGenerators.mjs
function generateId(len) { function generateId(len) {
var arr = new Uint8Array((len || 40) / 2); var arr = new Uint8Array((len || 40) / 2);
(window.crypto || // @ts-ignore (window.crypto || // @ts-ignore
@@ -501,7 +510,7 @@ function randomIdF() {
return Math.random().toString(36).substring(2); return Math.random().toString(36).substring(2);
} }
// www/admin/layout/js-dev/utils/ResizingAndMove.mjs // src/utils/ResizingAndMove.mjs
function getWindowSize() { function getWindowSize() {
var width, height; var width, height;
width = window.innerWidth || (window.document.documentElement.clientWidth || window.document.body.clientWidth); width = window.innerWidth || (window.document.documentElement.clientWidth || window.document.body.clientWidth);
@@ -570,9 +579,12 @@ function goTo(target) {
}); });
} }
// www/admin/layout/js-dev/utils/FormatBytes.mjs // src/utils/FormatBytes.mjs
function formatBytes(bytes) { function formatBytes(bytes) {
var i = -1; var i = -1;
if (typeof bytes === "bigint") {
bytes = Number(bytes);
}
do { do {
bytes = bytes / 1024; bytes = bytes / 1024;
i++; i++;
@@ -580,14 +592,22 @@ function formatBytes(bytes) {
return Math.round(bytes * Math.pow(10, 2)) / Math.pow(10, 2) + ["kB", "MB", "GB", "TB", "PB", "EB"][i]; return Math.round(bytes * Math.pow(10, 2)) / Math.pow(10, 2) + ["kB", "MB", "GB", "TB", "PB", "EB"][i];
} }
function formatBytesLong(bytes) { function formatBytesLong(bytes) {
if (typeof bytes === "bigint") {
bytes = Number(bytes);
}
if (isNaN(bytes)) { if (isNaN(bytes)) {
return bytes.toString(); return bytes.toString();
} }
let negative = false;
if (bytes < 0) {
negative = true;
bytes *= -1;
}
var i = Math.floor(Math.log(bytes) / Math.log(1024)); var i = Math.floor(Math.log(bytes) / Math.log(1024));
var sizes = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]; var sizes = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
return ((bytes / Math.pow(1024, i)).toFixed(2) + " " + sizes[i]).toString(); return (negative ? "-" : "") + ((bytes / Math.pow(1024, i)).toFixed(2) + " " + sizes[i]).toString();
} }
function stringByteFormat(bytes) { function stringByteFormat(bytes, raw = false) {
if (!(typeof bytes === "string" || bytes instanceof String)) { if (!(typeof bytes === "string" || bytes instanceof String)) {
return bytes.toString(); return bytes.toString();
} }
@@ -601,10 +621,13 @@ function stringByteFormat(bytes) {
bytes = m1 * Math.pow(1024, valid_units.indexOf(m2)); bytes = m1 * Math.pow(1024, valid_units.indexOf(m2));
} }
} }
return bytes; if (raw) {
return bytes;
}
return Math.round(bytes);
} }
// www/admin/layout/js-dev/utils/UrlParser.mjs // src/utils/UrlParser.mjs
function parseQueryString(query = "", return_key = "") { function parseQueryString(query = "", return_key = "") {
if (!query) { if (!query) {
query = window.location.search.substring(1); query = window.location.search.substring(1);
@@ -662,30 +685,7 @@ function getQueryStringParam(search = "", query = "", single = false) {
return param; return param;
} }
// www/admin/layout/js-dev/utils/l10nTranslation.mjs // src/utils/LoginLogout.mjs
var l10nTranslation = class {
#i18n = {};
constructor(i18n2) {
this.#i18n = i18n2;
}
/**
* 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)
*/
__(string) {
if (typeof this.#i18n !== "undefined" && isObject(this.#i18n) && this.#i18n[string]) {
return this.#i18n[string];
} else {
return string;
}
}
};
// www/admin/layout/js-dev/utils/LoginMenu.mjs
var hec = new HtmlElementCreator();
var l10n = new l10nTranslation(i18n ?? {});
function loginLogout() { function loginLogout() {
const form = document.createElement("form"); const form = document.createElement("form");
form.method = "post"; form.method = "post";
@@ -697,58 +697,8 @@ function loginLogout() {
document.body.appendChild(form); document.body.appendChild(form);
form.submit(); form.submit();
} }
function createLoginRow(login_string, header_id = "mainHeader") {
if (exists(header_id)) {
if (!exists("loginRow")) {
$("#" + header_id).html(hec.phfo(hec.cel("div", "loginRow", "", ["loginRow", "flx-spbt"])));
}
$("#loginRow").html(hec.phfo(hec.cel("div", "loginRow-name", login_string)));
$("#loginRow").append(hec.phfo(hec.cel("div", "loginRow-info", "")));
$("#loginRow").append(hec.phfo(
hec.aelx(
// outer div
hec.cel("div", "loginRow-logout"),
// inner element
hec.cel("input", "logout", "", [], {
value: l10n.__("Logout"),
type: "button",
onClick: "loginLogout()"
})
)
));
}
}
function createNavMenu(nav_menu, header_id = "mainHeader") {
if (isObject(nav_menu) && getObjectCount(nav_menu) > 1) {
if (!exists("menuRow")) {
$("#" + header_id).html(hec.phfo(hec.cel("div", "menuRow", "", ["menuRow", "flx-s"])));
}
var content = [];
$.each(nav_menu, function(key, item) {
if (key != 0) {
content.push(hec.phfo(hec.cel("div", "", "&middot;", ["pd-2"])));
}
if (item.enabled) {
if (window.location.href.indexOf(item.url) != -1) {
item.selected = 1;
}
content.push(hec.phfo(
hec.aelx(
hec.cel("div"),
hec.cel("a", "", item.name, ["pd-2"].concat(item.selected ? "highlight" : ""), {
href: item.url
})
)
));
}
});
$("#menuRow").html(content.join(""));
} else {
$("#menuRow").hide();
}
}
// www/admin/layout/js-dev/utils/ActionIndicatorOverlayBox.mjs // src/utils/ActionIndicatorOverlayBox.mjs
function actionIndicator(loc, overlay = true) { function actionIndicator(loc, overlay = true) {
if ($("#indicator").is(":visible")) { if ($("#indicator").is(":visible")) {
this.actionIndicatorHide(loc, overlay); this.actionIndicatorHide(loc, overlay);
@@ -919,7 +869,28 @@ var ActionIndicatorOverlayBox = class {
} }
}; };
// www/admin/layout/js-dev/utils/ActionBox.mjs // src/utils/l10nTranslation.mjs
var l10nTranslation = class {
#i18n = {};
constructor(i18n2) {
this.#i18n = i18n2;
}
/**
* 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)
*/
__(string) {
if (typeof this.#i18n !== "undefined" && isObject(this.#i18n) && this.#i18n[string]) {
return this.#i18n[string];
} else {
return string;
}
}
};
// src/utils/ActionBox.mjs
var ActionBox = class { var ActionBox = class {
// open overlay boxes counter for z-index // open overlay boxes counter for z-index
zIndex = { zIndex = {
@@ -941,9 +912,9 @@ var ActionBox = class {
* @param {Object} hec HtmlElementCreator * @param {Object} hec HtmlElementCreator
* @param {Object} l10n l10nTranslation * @param {Object} l10n l10nTranslation
*/ */
constructor(hec3, l10n3) { constructor(hec2, l10n2) {
this.hec = hec3; this.hec = hec2;
this.l10n = l10n3; this.l10n = l10n2;
} }
/** /**
* Show an action box * Show an action box
@@ -1269,11 +1240,92 @@ var ActionBox = class {
} }
}; };
// www/admin/layout/js-dev/utilsAll.mjs // src/utils/LoginNavMenu.mjs
var LoginNavMenu = class {
hec;
l10n;
/**
* action box creator
* @param {Object} hec HtmlElementCreator
* @param {Object} l10n l10nTranslation
*/
constructor(hec2, l10n2) {
this.hec = hec2;
this.l10n = l10n2;
}
/**
* 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"
*/
createLoginRow(login_string, header_id = "mainHeader") {
if (exists(header_id)) {
if (!exists("loginRow")) {
$("#" + header_id).html(this.hec.phfo(this.hec.cel("div", "loginRow", "", ["loginRow", "flx-spbt"])));
}
$("#loginRow").html(this.hec.phfo(this.hec.cel("div", "loginRow-name", login_string)));
$("#loginRow").append(this.hec.phfo(this.hec.cel("div", "loginRow-info", "")));
$("#loginRow").append(this.hec.phfo(
this.hec.aelx(
// outer div
this.hec.cel("div", "loginRow-logout"),
// inner element
this.hec.cel("input", "logout", "", [], {
value: this.l10n.__("Logout"),
type: "button",
onClick: "loginLogout()"
})
)
));
}
}
/**
* 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"
*/
createNavMenu(nav_menu, header_id = "mainHeader") {
if (isObject(nav_menu) && getObjectCount(nav_menu) > 1) {
if (!exists("menuRow")) {
$("#" + header_id).html(this.hec.phfo(this.hec.cel("div", "menuRow", "", ["menuRow", "flx-s"])));
}
var content = [];
$.each(nav_menu, function(key, item) {
if (key != 0) {
content.push(this.hec.phfo(this.hec.cel("div", "", "&middot;", ["pd-2"])));
}
if (item.enabled) {
if (window.location.href.indexOf(item.url) != -1) {
item.selected = 1;
}
content.push(this.hec.phfo(
this.hec.aelx(
this.hec.cel("div"),
this.hec.cel("a", "", item.name, ["pd-2"].concat(item.selected ? "highlight" : ""), {
href: item.url
})
)
));
}
});
$("#menuRow").html(content.join(""));
} else {
$("#menuRow").hide();
}
}
};
// src/utils.mjs
var aiob = new ActionIndicatorOverlayBox(); var aiob = new ActionIndicatorOverlayBox();
var hec2 = new HtmlElementCreator(); var hec = new HtmlElementCreator();
var l10n2 = new l10nTranslation(i18n ?? {}); var l10n = new l10nTranslation(typeof i18n === "undefined" ? {} : i18n);
var ab = new ActionBox(hec2, l10n2); var ab = new ActionBox(hec, l10n);
var lnm = new LoginNavMenu(hec, l10n);
if (!String.prototype.format) { if (!String.prototype.format) {
String.prototype.format = function() { String.prototype.format = function() {
console.error("[DEPRECATED] use StringHelpers.formatString"); console.error("[DEPRECATED] use StringHelpers.formatString");
@@ -1338,7 +1390,7 @@ function goTo2(target) {
goTo(target); goTo(target);
} }
function __(string) { function __(string) {
return l10n2.__(string); return l10n.__(string);
} }
function numberWithCommas2(x) { function numberWithCommas2(x) {
return numberWithCommas(x); return numberWithCommas(x);
@@ -1443,34 +1495,34 @@ function clearCallActionBox() {
aiob.clearCallActionBox(); aiob.clearCallActionBox();
} }
function cel(tag, id = "", content = "", css = [], options = {}) { function cel(tag, id = "", content = "", css = [], options = {}) {
return hec2.cel(tag, id, content, css, options); return hec.cel(tag, id, content, css, options);
} }
function ael(base, attach, id = "") { function ael(base, attach, id = "") {
return hec2.ael(base, attach, id); return hec.ael(base, attach, id);
} }
function aelx(base, ...attach) { function aelx(base, ...attach) {
return hec2.aelx(base, attach); return hec.aelx(base, attach);
} }
function aelxar(base, attach) { function aelxar(base, attach) {
return hec2.aelxar(base, attach); return hec.aelxar(base, attach);
} }
function rel(base) { function rel(base) {
return hec2.rel(base); return hec.rel(base);
} }
function rcssel(_element, css) { function rcssel(_element, css) {
return hec2.rcssel(_element, css); return hec.rcssel(_element, css);
} }
function acssel(_element, css) { function acssel(_element, css) {
return hec2.acssel(_element, css); return hec.acssel(_element, css);
} }
function scssel(_element, rcss, acss) { function scssel(_element, rcss, acss) {
hec2.scssel(_element, rcss, acss); hec.scssel(_element, rcss, acss);
} }
function phfo(tree) { function phfo(tree) {
return hec2.phfo(tree); return hec.phfo(tree);
} }
function phfa(list) { function phfa(list) {
return hec2.phfa(list); return hec.phfa(list);
} }
function html_options2(name, data, selected = "", options_only = false, return_string = false, sort = "") { function html_options2(name, data, selected = "", options_only = false, return_string = false, sort = "") {
return html_options(name, data, selected, options_only, return_string, sort); return html_options(name, data, selected, options_only, return_string, sort);
@@ -1499,11 +1551,11 @@ function getQueryStringParam2(search = "", query = "", single = false) {
function loginLogout2() { function loginLogout2() {
loginLogout(); loginLogout();
} }
function createLoginRow2(login_string, header_id = "mainHeader") { function createLoginRow(login_string, header_id = "mainHeader") {
createLoginRow(login_string, header_id); lnm.createLoginRow(login_string, header_id);
} }
function createNavMenu2(nav_menu, header_id = "mainHeader") { function createNavMenu(nav_menu, header_id = "mainHeader") {
createNavMenu(nav_menu, header_id); lnm.createNavMenu(nav_menu, header_id);
} }
function showFillActionBox(target_id = "actionBox", content = "", action_box_css = [], override = 0, content_override = 0) { function showFillActionBox(target_id = "actionBox", content = "", action_box_css = [], override = 0, content_override = 0) {
ab.showFillActionBox(target_id, content, action_box_css, override, content_override); ab.showFillActionBox(target_id, content, action_box_css, override, content_override);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long