puvox-library 1.0.71 → 1.0.72

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/library_standard.js +468 -473
  2. package/package.json +1 -1
@@ -15,39 +15,41 @@
15
15
  *
16
16
  */
17
17
 
18
- function PUVOX_LIBRARY() { return {
18
+ class PuvoxLibrary {
19
+ self = this;
20
+
19
21
  // ########## ARRAY ########## //
20
22
  arrayValue(obj_arr, key, default_){
21
23
  return (obj_arr && key in obj_arr ? obj_arr[key] : default_);
22
- },
24
+ }
23
25
  arrayValueLower(obj_arr, key, default_){
24
26
  const val = this.arrayValue(obj_arr, key, default_);
25
27
  return (val===null ? null : val.toLowerCase());
26
- },
28
+ }
27
29
  arrayValueUpper(obj_arr, key, default_){
28
30
  const val = this.arrayValue(obj_arr, key, default_);
29
31
  return (val===null ? null : val.toUpperCase());
30
- },
32
+ }
31
33
  stringToArray(str, splitChar){
32
34
  var splitChar= splitChar || '|';
33
35
  let parts = str.split(splitChar);
34
36
  return parts;
35
- },
37
+ }
36
38
  arrayColumn(array, columnName) {
37
39
  return array.map(function(value,index) {
38
40
  return value[columnName];
39
41
  })
40
- },
42
+ }
41
43
  arrayUnique(array, removeEmpties){
42
44
  //let uniqueItems = [...new Set(items)]
43
45
  let res = array.filter(function(item, pos) {
44
46
  return array.indexOf(item) == pos;
45
47
  });
46
48
  return (removeEmpties ? this.arrayRemoveEmpty(res) : res);
47
- },
49
+ }
48
50
  arrayMerge(ar1,ar2){
49
51
  return ar1.concat(ar2);
50
- },
52
+ }
51
53
  objectsArrayTill(arrayBlocks, key, value)
52
54
  {
53
55
  let newArr = this.isObject(arrayBlocks) ? {} : [];
@@ -60,10 +62,10 @@ function PUVOX_LIBRARY() { return {
60
62
  newArr[key_1] = obj_1;
61
63
  }
62
64
  return newArr;
63
- },
64
- arrayRemoveEmpty(array){ return array.filter(item => item); },
65
- arrayLastMember(arr){ return arr[arr.length-1]; },
66
- arrayLastItem(arr){ return this.arrayLastMember(arr); },
65
+ }
66
+ arrayRemoveEmpty(array){ return array.filter(item => item); }
67
+ arrayLastMember(arr){ return arr[arr.length-1]; }
68
+ arrayLastItem(arr){ return this.arrayLastMember(arr); }
67
69
  removeKeys(obj, keysArr){
68
70
  let newObj ={};
69
71
  for (let [key,val] of Object.entries(obj)){
@@ -71,7 +73,7 @@ function PUVOX_LIBRARY() { return {
71
73
  newObj[key]=val;
72
74
  }
73
75
  return newObj;
74
- },
76
+ }
75
77
  removeKeysExcept (obj, keysArr){
76
78
  let newObj ={};
77
79
  for (let [key,val] of Object.entries(obj)){
@@ -79,13 +81,13 @@ function PUVOX_LIBRARY() { return {
79
81
  newObj[key]=val;
80
82
  }
81
83
  return newObj;
82
- },
84
+ }
83
85
  arrayDiff(source, comparedTo){
84
86
  return source.filter(x => !comparedTo.includes(x));
85
- },
87
+ }
86
88
  arrayIntersect(source, comparedTo){
87
89
  return source.filter(x => comparedTo.includes(x));
88
- },
90
+ }
89
91
  arrayDiffFull(o1,o2) {
90
92
  const self = this;
91
93
  const typeObject = function(o){
@@ -140,40 +142,40 @@ function PUVOX_LIBRARY() { return {
140
142
  diff(o1,o2),
141
143
  diff(o2,o1),
142
144
  ];
143
- },
145
+ }
144
146
  sortKeys (x, out = {}) {
145
147
  for (const k of Object.keys (x).sort ()) {
146
148
  out[k] = x[k]
147
149
  }
148
150
  return out
149
- },
151
+ }
150
152
  sortByValuesIntoArray(obj, ascending = true){
151
153
  return Object.entries(obj).sort((a, b) => ascending ? a[1] - b[1] : b[1] - a[1]);
152
- },
154
+ }
153
155
  stringArrayToNumeric(arr){
154
156
  let newArr = [];
155
157
  for(let i=0; i<arr.length; i++){
156
158
  newArr.push( parseFloat(arr[i]) );
157
159
  }
158
160
  return newArr;
159
- },
161
+ }
160
162
  stringToArrayToNumeric(arr){
161
163
  return this.stringArrayToNumeric(this.stringToArray(arr));
162
- },
164
+ }
163
165
 
164
166
  objectCopy(obj){
165
167
  return JSON.parse(JSON.stringify(obj));
166
- },
168
+ }
167
169
  // https://stackoverflow.com/a/44782052/2377343
168
170
  cloneObjectDestructuve(orig){
169
171
  return Object.assign(Object.create(Object.getPrototypeOf(orig)), orig);
170
- },
172
+ }
171
173
  // https://stackoverflow.com/a/41474987/2377343
172
174
  cloneObjectWithPrototype(orig){
173
175
  const clone = Object.assign( Object.create(orig), orig );
174
176
  Object.setPrototypeOf( clone, Blah.prototype );
175
177
  return clone;
176
- },
178
+ }
177
179
  getKeyByValue (object, value) {
178
180
  const keys = Object.keys (object);
179
181
  for (let i = 0; i < keys.length; i++) {
@@ -183,7 +185,7 @@ function PUVOX_LIBRARY() { return {
183
185
  }
184
186
  }
185
187
  return undefined;
186
- },
188
+ }
187
189
  hasChildWithKeyValue (obj, targetKey, targetValue) {
188
190
  const keys = Object.keys (obj);
189
191
  for (let i = 0; i < keys.length; i++) {
@@ -195,8 +197,7 @@ function PUVOX_LIBRARY() { return {
195
197
  }
196
198
  }
197
199
  return false;
198
- },
199
-
200
+ }
200
201
 
201
202
 
202
203
 
@@ -218,7 +219,7 @@ function PUVOX_LIBRARY() { return {
218
219
  }
219
220
  });
220
221
  }
221
- },
222
+ }
222
223
 
223
224
  // setTimeout( window[arguments.callee.name.toString() ], 500);
224
225
 
@@ -229,14 +230,14 @@ function PUVOX_LIBRARY() { return {
229
230
  jQuery( this ).attr( 'src', jQuery( this ).attr( 'data-src' ) );
230
231
  }
231
232
  );
232
- },
233
+ }
233
234
 
234
235
  move_to_top_in_parent(el_tag)
235
236
  {
236
237
  $(el_tag).each(function() {
237
238
  $(this).parent().prepend(this);
238
239
  });
239
- },
240
+ }
240
241
 
241
242
  //window.onload REPLACEMENT Both methods are used to achieve the same goal of attaching an event to an element.
242
243
  // ttachEvent can only be used on older trident rendering engines ( IE5+ IE5-8*) and addEventListener is a W3 standard that is implemented in the majority of other browsers (FF, Webkit, Opera, IE9+).
@@ -262,7 +263,7 @@ function PUVOX_LIBRARY() { return {
262
263
  }
263
264
  //append in head
264
265
  (document.head || document.getElementsByTagName('head')[0]).appendChild(x);
265
- },
266
+ }
266
267
  Append_To_Head(elemntType, content) {
267
268
  var Is_Link = content.split(/\r\n|\r|\n/).length <= 1 && content.indexOf("/") > -1 && (content.substring(0, 4) == 'http' || content.substring(0, 2) == '//' || content.substring(0, 2) == './' || content.substring(0, 1) == '/');
268
269
  if (Is_Link) {
@@ -298,7 +299,7 @@ function PUVOX_LIBRARY() { return {
298
299
  }
299
300
  document.head.appendChild(x);
300
301
  }
301
- },
302
+ }
302
303
  // loadScript
303
304
  appendScript(url, callback, defer=false){
304
305
  var script = document.createElement('script');
@@ -307,24 +308,24 @@ function PUVOX_LIBRARY() { return {
307
308
  if (defer)
308
309
  script.defer = true;
309
310
  document.head.appendChild(script);
310
- },
311
+ }
311
312
  appendScript2(url){
312
313
  var script = document.createElement('script');
313
314
  document.head.appendChild(script);
314
315
  script.onload = function () { };
315
316
  script.src = url;
316
- },
317
+ }
317
318
 
318
319
  blackground2(){
319
320
  var innerDiv = document.createElement("div"); innerDiv.id = "my_black_backgr";
320
321
  innerDiv.setAttribute("style", "background:black; height:4000px; left:0px; opacity:0.9; position:fixed; top:0px; width:100%; z-index:9990;");
321
322
  var BODYYY = document.body; BODYYY.insertBefore(innerDiv, BODYYY.childNodes[0]);
322
- },
323
+ }
323
324
 
324
325
  getFileExtension(filename){
325
326
  var ext = filename.split('.').pop();
326
327
  return (ext===filename) ? '' : ext;
327
- },
328
+ }
328
329
 
329
330
  // stackoverflow -best foreach
330
331
  forEach(collection, callback, scope) {
@@ -339,30 +340,29 @@ function PUVOX_LIBRARY() { return {
339
340
  callback.call(scope, collection[i], i, collection);
340
341
  }
341
342
  }
342
- },
343
+ }
343
344
 
344
345
  // ################
345
- sanitize(str){ return str.trim().replace( /[^a-zA-Z0-9_\-]/g, "_"); },
346
- sanitize_key(str, use_dash){ return str.trim().toLowerCase().replace( /[^a-z0-9_\-]/g, (use_dash===true ? '_' : (use_dash ? use_dash :'')) ); }, //same as wp
347
- sanitize_key_dashed(str){ return this.sanitize_key(str, true).replace(/__/g,'_'); },
348
- sanitize_variable_name(str)
349
- {
350
- return this.strip_non_word(str).replace(/-/g,"_");
351
- },
352
- sanitize_text(str, use_dash=false) { return str.trim().replace(/[^a-zA-Z0-9]+/g, (use_dash ? "_":"") ); },
346
+ sanitize(str){ return str.trim().replace( /[^a-zA-Z0-9_\-]/g, "_"); }
347
+
348
+ sanitize_key(str, use_dash){ return str.trim().toLowerCase().replace( /[^a-z0-9_\-]/g, (use_dash===true ? '_' : (use_dash ? use_dash :'')) ); } //same as wp
349
+
350
+ sanitize_key_dashed(str){ return this.sanitize_key(str, true).replace(/__/g,'_'); }
351
+
352
+ sanitize_variable_name(str) { return this.strip_non_word(str).replace(/-/g,"_"); }
353
+
354
+ sanitize_text(str, use_dash=false) { return str.trim().replace(/[^a-zA-Z0-9]+/g, (use_dash ? "_":"") ); }
353
355
 
354
356
  //nonword
355
- strip_non_word(str)
356
- {
357
- return str.replace(/[\W_]+/g,"-");
358
- },
359
- removeAllWhitespaces(content){ return content.replace(/\s/g,''); },
357
+ strip_non_word(str) { return str.replace(/[\W_]+/g,"-"); }
358
+
359
+ removeAllWhitespaces(content){ return content.replace(/\s/g,''); }
360
360
 
361
361
  replaceAllOccurences (input, search, replacement) {
362
362
  const splited = input.split (search);
363
363
  const joined = splited.join (replacement);
364
364
  return joined;
365
- },
365
+ }
366
366
 
367
367
  // ####################### TYPE ##############################
368
368
 
@@ -374,26 +374,26 @@ function PUVOX_LIBRARY() { return {
374
374
  else if (this.isArray(x)) return "array";
375
375
  else if (this.isObject(x)) return "object";
376
376
  return typeof x;
377
- },
378
- isInteger(x) { return Number.isInteger(x); },
379
- isNumeric(x) { return Number.isFinite(x); },
380
- isDecimal(x) { return this.isNumeric(x) && (!isNaN(parseFloat(x))); }, // avoid occasions like "1abc"
381
- isBoolean(x) { return this.isBooleanReal(x) || (this.isString(x) && (x.toLowerCase() =="true" || x.toLowerCase() =="false")); },
382
- isBooleanReal(x) { return x === true || x === false || toString.call(x) === '[object Boolean]'; },
383
- isString(x) { return Object.prototype.toString.call(x) === "[object String]"; }, // return (typeof content === 'string' || content instanceof String);
377
+ }
378
+ isInteger(x) { return Number.isInteger(x); }
379
+ isNumeric(x) { return Number.isFinite(x); }
380
+ isDecimal(x) { return this.isNumeric(x) && (!isNaN(parseFloat(x))); } // avoid occasions like "1abc"
381
+ isBoolean(x) { return this.isBooleanReal(x) || (this.isString(x) && (x.toLowerCase() =="true" || x.toLowerCase() =="false")); }
382
+ isBooleanReal(x) { return x === true || x === false || toString.call(x) === '[object Boolean]'; }
383
+ isString(x) { return Object.prototype.toString.call(x) === "[object String]"; } // return (typeof content === 'string' || content instanceof String);
384
384
  // https://stackoverflow.com/questions/8834126/
385
- isObject(x) { return ( !Array.isArray(x) && Object.prototype.toString.call(x) !== '[object Array]' ) && ( (typeof x === 'object' && x !== null ) || ( (!!x) && (x.constructor === Object) ) || (typeof x === 'function' || typeof x === 'object' && !!x) ) ; },
385
+ isObject(x) { return ( !Array.isArray(x) && Object.prototype.toString.call(x) !== '[object Array]' ) && ( (typeof x === 'object' && x !== null ) || ( (!!x) && (x.constructor === Object) ) || (typeof x === 'function' || typeof x === 'object' && !!x) ) ; }
386
386
  // https://stackoverflow.com/questions/8511281/check-if-a-value-is-an-object-in-javascript
387
387
  isJsonObject(data){
388
388
  // doesnt work for string return data!="" && (data=={} || JSON.stringify(data)!='{}');
389
389
  return false;
390
- },
391
- isArray(x) { return ( (!!x) && (x.constructor === Array) ) || (Array.isArray(x)); },
390
+ }
391
+ isArray(x) { return ( (!!x) && (x.constructor === Array) ) || (Array.isArray(x)); }
392
392
 
393
- isSimpleVariableType(obj){ return this.isSimpleVariableTypeName(typeof obj); },
394
- isSimpleVariableTypeName(typeName_){ return this.inArray( typeName_, [ "boolean", "integer", "float", "double", "decimal", "string"]); },
395
- isNumericVariableType(obj){ return this.isNumericVariableTypeName(typeof obj); },
396
- isNumericVariableTypeName(typeName_){ return this.inArray(typeName_, [ "integer", "float", "double", "decimal"]); },
393
+ isSimpleVariableType(obj){ return this.isSimpleVariableTypeName(typeof obj); }
394
+ isSimpleVariableTypeName(typeName_){ return this.inArray( typeName_, [ "boolean", "integer", "float", "double", "decimal", "string"]); }
395
+ isNumericVariableType(obj){ return this.isNumericVariableTypeName(typeof obj); }
396
+ isNumericVariableTypeName(typeName_){ return this.inArray(typeName_, [ "integer", "float", "double", "decimal"]); }
397
397
 
398
398
  stringToBoolean(string){
399
399
  switch(string.toLowerCase().trim()){
@@ -401,10 +401,10 @@ function PUVOX_LIBRARY() { return {
401
401
  case "false": case "no": case "0": case null: return false;
402
402
  default: return Boolean(string);
403
403
  }
404
- },
404
+ }
405
405
  isException(e){
406
406
  return e && e.stack && e.message;
407
- },
407
+ }
408
408
  IsJsonString (str) {
409
409
  try {
410
410
  JSON.parse(str);
@@ -412,10 +412,10 @@ function PUVOX_LIBRARY() { return {
412
412
  return false;
413
413
  }
414
414
  return true;
415
- },
415
+ }
416
416
  is_object(variable){
417
417
  return typeof variable === 'object' && variable !== null;
418
- },
418
+ }
419
419
  formItemsToJson(FormElement){
420
420
  let formDataEntries = new FormData(FormElement).entries();
421
421
  const handleChild = function (obj,keysArr,value){
@@ -441,7 +441,7 @@ function PUVOX_LIBRARY() { return {
441
441
  for (const [key, value] of formDataEntries )
442
442
  result= handleChild(result, key.split(/\[/), value);
443
443
  return result;
444
- },
444
+ }
445
445
 
446
446
  renameKey (obj, keyFrom, keyTo) {
447
447
  for (const key of Object.keys(obj)) {
@@ -449,14 +449,14 @@ function PUVOX_LIBRARY() { return {
449
449
  delete obj[keyFrom];
450
450
  }
451
451
  return obj;
452
- },
452
+ }
453
453
  renameSubKey (obj, keyFrom, keyTo, strict = false) {
454
454
  for (const key of Object.keys(obj)) {
455
455
  obj[key][keyTo] = strict ? obj[key][keyFrom] : (obj[key][keyFrom] || null);
456
456
  delete obj[key][keyFrom];
457
457
  }
458
458
  return obj;
459
- },
459
+ }
460
460
 
461
461
  hasEmptyChild(obj){
462
462
  let hasEmpty = false;
@@ -468,47 +468,47 @@ function PUVOX_LIBRARY() { return {
468
468
  }
469
469
  }
470
470
  return hasEmpty;
471
- },
471
+ }
472
472
 
473
473
  filterObject(obj, callback) {
474
474
  return Object.fromEntries(Object.entries(obj).
475
475
  filter(([key, val]) => callback(val, key)));
476
- },
476
+ }
477
477
  // #####################################$$$$$################
478
478
 
479
479
 
480
- isBetween(a,b,c) { return a< b && b< c; },
481
- isBetweenEq(a,b,c) { return a<=b && b<=c; },
480
+ isBetween(a,b,c) { return a< b && b< c; }
481
+ isBetweenEq(a,b,c) { return a<=b && b<=c; }
482
482
  startsWithWhiteSpace(content){
483
483
  return (/^\s/).test(content);
484
- },
484
+ }
485
485
  trimOnlyFromEnd(content){
486
486
  return content.replace(/\s*$/,"");
487
- },
487
+ }
488
488
  startsWith(content, what){
489
489
  return content.startsWith(what);
490
- },
490
+ }
491
491
  startsWithArray(content,array){
492
492
  array.forEach(function(val){
493
493
  if (content.startsWith(val)) return true;
494
494
  })
495
495
  return false;
496
- },
496
+ }
497
497
  endsWith(content, what){
498
498
  return content.endsWith(what);
499
- },
499
+ }
500
500
  endsWithArray(content,array){
501
501
  array.forEach(function(val){
502
502
  if (content.endsWith(val)) return true;
503
503
  })
504
504
  return false;
505
- },
505
+ }
506
506
  startLetters(str, amountOfLetters){
507
507
  return str.substr(0, amountOfLetters);
508
- },
508
+ }
509
509
  endLetters(str, amountOfLetters){
510
510
  return str.substr(str.length - amountOfLetters);
511
- },
511
+ }
512
512
 
513
513
  ConvertNumbToRoman(num){
514
514
  num= num.replace('40','XXXX'); num= num.replace('39','XXXIX'); num= num.replace('38','XXXVIII'); num= num.replace('37','XXXVII');
@@ -521,7 +521,7 @@ function PUVOX_LIBRARY() { return {
521
521
  num= num.replace('12','XII'); num= num.replace('11','XI'); num= num.replace('10','X'); num= num.replace('9','IX');
522
522
  num= num.replace('8','VIII'); num= num.replace('7','VII'); num= num.replace('6','VI'); num= num.replace('5','V');
523
523
  num= num.replace('4','IV'); num= num.replace('3','III'); num= num.replace('2','II'); num= num.replace('1','I'); return num;
524
- },
524
+ }
525
525
 
526
526
  // encrypt decrypt: http://jsfiddle.net/kein1945/M9K2c/ | https://stackoverflow.com/questions/18279141/ | https://stackoverflow.com/questions/51531021/x
527
527
 
@@ -530,24 +530,24 @@ function PUVOX_LIBRARY() { return {
530
530
  when_element_is_loaded(Id_or_class,functionname){
531
531
  Id_or_class=Id_or_class.trim(); var eName = Id_or_class.substr(1); if('#'==Id_or_class.charAt(0)){var x=document.getElementById(eName);} else{var x=document.getElementsByClassName(eName)[0];}
532
532
  if(x) { functionname(); } else { setTimeout(when_element_is_loaded, 100, Id_or_class, functionname); }
533
- },
533
+ }
534
534
 
535
535
  // set document title
536
- SetTitlee(title) { document.getElementsByTagName('title')[0].innerHTML = title; },
536
+ SetTitlee(title) { document.getElementsByTagName('title')[0].innerHTML = title; }
537
537
 
538
538
  setUrl(urlPath, title) {
539
539
  var title= title || false;
540
540
  window.history.pushState( ( title ? {"pageTitle":title} : ""),"", urlPath); //{"html":...,"pageTitle":....}
541
- },
541
+ }
542
542
 
543
543
  requestUri(url){
544
544
  var url = url || location.href;
545
545
  return url.replace(origin,'');
546
- },
546
+ }
547
547
  // check if key exists in array
548
548
  ArrayKeyExistss(keyname,array) {
549
549
  return typeof array[keyname] !== 'undefined';
550
- },
550
+ }
551
551
 
552
552
  hashtageChangeOnClick(e) {
553
553
  function MyCallbackTemp (e)
@@ -568,17 +568,17 @@ function PUVOX_LIBRARY() { return {
568
568
 
569
569
  if (document.addEventListener) document.addEventListener('click', MyCallbackTemp, false);
570
570
  else document.attachEvent('onclick', MyCallbackTemp);
571
- },
571
+ }
572
572
 
573
573
  capitalizeFirstLetter(string) {
574
574
  return string.charAt(0).toUpperCase() + string.slice(1);
575
- },
575
+ }
576
576
 
577
577
  addQueryArg(name,value, url)
578
578
  {
579
579
  var url = url || location.href;
580
580
  return url + (url.indexOf("?")<0 ? "?":"&") +escape(name)+"="+escape(value);
581
- },
581
+ }
582
582
  buildQueryString(params){
583
583
  if (!params) return '';
584
584
  return Object.entries(params)
@@ -586,7 +586,7 @@ function PUVOX_LIBRARY() { return {
586
586
  return `${key}=${encodeURIComponent(value)}`;
587
587
  })
588
588
  .join('&');
589
- },
589
+ }
590
590
 
591
591
  // find home url (in wordpress)
592
592
  wpHomeUrl (){
@@ -594,9 +594,8 @@ function PUVOX_LIBRARY() { return {
594
594
  if (typeof matches !== 'undefined' && matches != null && matches.length > 1 ){
595
595
  homeURL = matches[2];
596
596
  }
597
- },
597
+ }
598
598
 
599
-
600
599
  LoadYoutubeApi(callback)
601
600
  {
602
601
  // This code loads the IFrame Player API code asynchronously.
@@ -607,10 +606,10 @@ function PUVOX_LIBRARY() { return {
607
606
  window.onYouTubeIframeAPIReady= function(){
608
607
  callback();
609
608
  };
610
- },
609
+ }
611
610
 
612
- argvsString(){ return process.argv[2]; },
613
- argvsArray(){ return process.argv.slice(2); },
611
+ argvsString(){ return process.argv[2]; }
612
+ argvsArray(){ return process.argv.slice(2); }
614
613
  argvs(){
615
614
  let argvs= this.argvsArray();
616
615
  let KeyValues= {};
@@ -639,14 +638,14 @@ function PUVOX_LIBRARY() { return {
639
638
  }
640
639
  }
641
640
  return KeyValues;
642
- },
641
+ }
643
642
  argv(which, def = undefined){
644
643
  let KeyValues= this.argvs();
645
644
  return (which in KeyValues ? KeyValues[which] : def);
646
- },
645
+ }
647
646
  argvIsSet(which){
648
647
  return this.inArray(which, this.argvsArray()) || this.argv(which)!=undefined;
649
- },
648
+ }
650
649
 
651
650
 
652
651
  parseQuery(queryString) {
@@ -664,7 +663,7 @@ function PUVOX_LIBRARY() { return {
664
663
  query[decodeURIComponent(pair[0])] = p2;
665
664
  }
666
665
  return query;
667
- },
666
+ }
668
667
 
669
668
  //https://stackoverflow.com/questions/123999/how-can-i-tell-if-a-dom-element-is-visible-in-the-current-viewport
670
669
  // $(window).on('DOMContentLoaded load resize scroll', handler);
@@ -676,7 +675,7 @@ function PUVOX_LIBRARY() { return {
676
675
  const newObj = {};
677
676
  Object.keys(obj).map (k=>newObj[obj[k]]=k);
678
677
  return newObj;
679
- },
678
+ }
680
679
 
681
680
  isElementInViewport (el) {
682
681
  // Special bonus for those using jQuery
@@ -692,7 +691,7 @@ function PUVOX_LIBRARY() { return {
692
691
  rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && /* or $(window).height() */
693
692
  rect.right <= (window.innerWidth || document.documentElement.clientWidth) /* or $(window).width() */
694
693
  );
695
- },
694
+ }
696
695
 
697
696
  MakeIframeFullHeight(iframeElement, cycling, overwrite_margin){
698
697
  cycling= cycling || false;
@@ -714,9 +713,9 @@ function PUVOX_LIBRARY() { return {
714
713
  })();
715
714
  //var funcname= arguments.callee.name;
716
715
  //window.setTimeout( function(){ console.log(funcname); console.log(cycling); window[funcname](iframeElement, cycling); }, 500 );
717
- },
716
+ }
718
717
 
719
- getYtIdFromURL(URLL){let r=URLL.match(/^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/)|(?:(?:watch)?\?v(?:i)?=|\&v(?:i)?=))([^#\&\?]*).*/); return r[1];},
718
+ getYtIdFromURL(URLL){let r=URLL.match(/^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/)|(?:(?:watch)?\?v(?:i)?=|\&v(?:i)?=))([^#\&\?]*).*/); return r[1];}
720
719
 
721
720
  //state url change
722
721
  //function processAjaxData(response, urlPath){
@@ -742,7 +741,7 @@ function PUVOX_LIBRARY() { return {
742
741
  };
743
742
  tx[i].addEventListener("input", OnInput, false);
744
743
  }
745
- },
744
+ }
746
745
 
747
746
  getAllMethods(obj, inherited_too)
748
747
  {
@@ -753,7 +752,7 @@ function PUVOX_LIBRARY() { return {
753
752
  }
754
753
  }
755
754
  return methods;
756
- },
755
+ }
757
756
 
758
757
  hasMethod(obj, funcName, inherited_too)
759
758
  {
@@ -765,19 +764,19 @@ function PUVOX_LIBRARY() { return {
765
764
  }
766
765
  }
767
766
  return false;
768
- },
767
+ }
769
768
 
770
769
 
771
770
  ConvertToHourMinSec(time){ //Output like "1:01" or "4:03:59" or "123:03:59"
772
771
  var hrs = ~~(time / 3600); var mins = ~~((time % 3600) / 60); var secs = time % 60;
773
772
  var hms=""; hms +=""+hrs+":"+(mins< 10 ? "0":""); hms +=""+mins+":"+(secs<10 ? "0":""); hms +=""+secs; return hms;
774
- },
773
+ }
775
774
 
776
775
  // =========== get device sizes ==========//
777
776
  // http://ryanve.com/lab/dimensions/
778
777
  getWindowSize(){
779
778
  return {x:document.documentElement.clientWidth, y:document.documentElement.clientHeight} ;
780
- },
779
+ }
781
780
 
782
781
  removeItem(arr, value) {
783
782
  var i = 0;
@@ -789,20 +788,20 @@ function PUVOX_LIBRARY() { return {
789
788
  }
790
789
  }
791
790
  return arr;
792
- },
791
+ }
793
792
  removeItemOnce(arr, value) {
794
793
  var index = arr.indexOf(value);
795
794
  if (index > -1) {
796
795
  arr.splice(index, 1);
797
796
  }
798
797
  return arr;
799
- },
798
+ }
800
799
  toggleItemInArray(array, value, condition)
801
800
  {
802
801
  if (condition) array.push(value);
803
802
  else this.removeItemOnce(array,value);
804
803
  return array;
805
- },
804
+ }
806
805
 
807
806
  // avoid ccxt's bug for undefined : https://jsfiddle.net/Lpxsthw4/
808
807
  mergeDeep(target, source) {
@@ -821,7 +820,7 @@ function PUVOX_LIBRARY() { return {
821
820
  });
822
821
  }
823
822
  return output;
824
- },
823
+ }
825
824
 
826
825
  getScrollbarWidth() {
827
826
  var outer = document.createElement("div");
@@ -837,7 +836,7 @@ function PUVOX_LIBRARY() { return {
837
836
  var widthWithScroll = inner.offsetWidth;
838
837
  outer.parentNode.removeChild(outer);
839
838
  return widthNoScroll - widthWithScroll;
840
- },
839
+ }
841
840
 
842
841
  // animation-css https://codepen.io/AKGD/pen/yvwQYZ
843
842
  animationClick(element, animation, removeOrNot){
@@ -854,7 +853,7 @@ function PUVOX_LIBRARY() { return {
854
853
  }
855
854
  }
856
855
  );
857
- },
856
+ }
858
857
 
859
858
  animationClickTarget(element, target, animation, removeOrNot){
860
859
  var $=jQuery;
@@ -870,69 +869,70 @@ function PUVOX_LIBRARY() { return {
870
869
  }
871
870
  }
872
871
  );
873
- },
872
+ }
874
873
 
875
874
 
876
- datetime : {
875
+ datetime = new (class{
876
+ MAIN_CLASS = self;
877
877
  // 0940 type time-ints
878
- isBetweenHMS(target, start, end, equality) { }, // datetime, int/datetime, int/datetime, bool
878
+ isBetweenHMS(target, start, end, equality) { } // datetime, int/datetime, int/datetime, bool
879
879
  equalDays(d1,d2) {
880
880
  return d1.getYear()==d2.getyear() && d1.getMonth()==d2.getMonth() && d1.getDate()==d2.getDate();
881
- }, // DateTime, DateTime
882
- IsTodayStart(dt) { }, // DateTime
883
- GetWeekOfMonth(dt) { }, // DateTime
884
- GetWeekOfYear(dt) { }, // DateTime
885
- GetQuarter(dt) { }, // DateTime
886
- NumberToHMSstring(hhmmss) { }, // int
881
+ } // DateTime, DateTime
882
+ IsTodayStart(dt) { } // DateTime
883
+ GetWeekOfMonth(dt) { } // DateTime
884
+ GetWeekOfYear(dt) { } // DateTime
885
+ GetQuarter(dt) { } // DateTime
886
+ NumberToHMSstring(hhmmss) { } // int
887
887
  // ZZ incorrect, need LOCAL/UTC: DatetimeToHMSstring(dt) { }, // DateTime
888
888
  // HMSToTimeSpan(hhmmss) { }, // int
889
- addNumberToHMS(hhmmss, added_or_subtracted) { }, // int, int
889
+ addNumberToHMS(hhmmss, added_or_subtracted) { } // int, int
890
890
  DatetimeToStringUtc(dt, withMS = true, withTZ = true) {
891
891
  var str = (new Date( dt || new Date() )).toISOString();
892
892
  let finalStr = (withTZ ? str : str.replace("T", " ").replace("Z", ""));
893
893
  return withMS ? finalStr : finalStr.split('.')[0]; //2022-07-09 15:25:00.276
894
- },
894
+ }
895
895
  DatetimeToStringLocal(dt, withMS = true, withT = false) {
896
896
  const str = (dt || new Date()).toLocaleString('sv', {year:'numeric', month:'numeric', day:'numeric', hour:'numeric', minute:'numeric', second:'numeric', fractionalSecondDigits: 3}).replace(',', '.');
897
897
  let finalStr = (withT ? str.replace(' ', 'T') : str);
898
898
  return withMS ? finalStr : finalStr.split('.')[0]; //2022-07-09 19:25:00.276
899
- },
899
+ }
900
900
  // in some langs, the date object has distinctions, so the two below needs separated methods. However, the "date" object returned from them, are same, just the representation can be local or UTC depending user.
901
- StringToDatetimeUtc(str, format, culture) { return new Date(str); },
902
- StringToDatetimeLocal(str, format, culture) { return new Date(str); },
903
- StringToTimestamUtc(str, format, culture) { return new Date(str).getTime(); },
901
+ StringToDatetimeUtc(str, format, culture) { return new Date(str); }
902
+ StringToDatetimeLocal(str, format, culture) { return new Date(str); }
903
+ StringToTimestamUtc(str, format, culture) { return new Date(str).getTime(); }
904
904
  DatetimeUtc() {
905
905
  var now = new Date();
906
906
  var utc = new Date(now.getTime()); // + now.getTimezoneOffset() * 60000 is not needed !!!!!!
907
907
  return utc;
908
- }, UtcDatetime() { return this.DatetimeUtc(); },
908
+ } UtcDatetime() { return this.DatetimeUtc(); }
909
909
  // UTC
910
910
  TimestampUtc() {
911
911
  return Math.floor(new Date().getTime());
912
- }, UtcTimestamp() { return this.TimestampUtc(); },
912
+ } UtcTimestamp() { return this.TimestampUtc(); }
913
913
  //i.e. input: "2021-03-08 11:59:00" | output : 1650000000000 (milliseconds)
914
914
  // [DONT CHANGE THIS FUNC, I'VE REVISED]
915
915
  DatetimeToTimestampUtc(dt) {
916
916
  let offset = this.getOffsetFromUtc();
917
917
  return ((((new Date( dt )).getTime()) / 1000) + 14400 - offset * 60* 60) * 1000;
918
- }, UtcTimestampFrom(dt) { return this.DatetimeToTimestampUtc(dt); },
918
+ } UtcTimestampFrom(dt) { return this.DatetimeToTimestampUtc(dt); }
919
919
  TimestampUtcToDatetimeUtc(ts) {
920
920
  var d = new Date(ts);
921
921
  d.setHours(d.getHours());
922
922
  return d;
923
- }, UtcTimestampToUtcDatetime(ts) { return this.TimestampUtcToDatetimeUtc(ts); },
923
+ } UtcTimestampToUtcDatetime(ts) { return this.TimestampUtcToDatetimeUtc(ts); }
924
924
  // shorthands
925
- MaxDate(d1, d2, d3=null) {},
926
- MinDate(d1, d2, d3=null) {},
927
- localDatetimeToUtcString(dt){ },
928
- areSameDays(d1, d2){ },
925
+ MaxDate(d1, d2, d3=null) {}
926
+ MinDate(d1, d2, d3=null) {}
927
+ localDatetimeToUtcString(dt){ }
928
+ areSameDays(d1, d2){ }
929
929
 
930
930
 
931
931
  // ##### added to JS #####
932
- GetDayOfYear(dt) { return (dt || new Date()).getUTCDate(); },
932
+ GetDayOfYear(dt) { return (dt || new Date()).getUTCDate(); }
933
933
  StringToUtcString(str) {
934
934
  return str.indexOf ('Z') > -1 || str.indexOf ('GMT') > -1 ? str : str + ' GMT+0000';
935
- },
935
+ }
936
936
  //i.e. input: 1650000000000 (milliseconds) | output : "2021-03-08 11:59:00"
937
937
  UtcTimestampToLocalDatetime(ts) {
938
938
  var d = new Date(ts);
@@ -943,29 +943,29 @@ function PUVOX_LIBRARY() { return {
943
943
  // var utc = d.getTime() + (d.getTimezoneOffset() * 60000); //This converts to UTC 00:00
944
944
  // var nd = new Date(utc + (3600000*offset));
945
945
  // return nd; return nd.toLocaleString();
946
- },
946
+ }
947
947
  //i.e. input: 1650000000000 (milliseconds) | output : "2021-07-14T21:08:00.000Z"
948
948
  // [DONT CHANGE THIS FUNC, I'VE REVISED]
949
949
  UtcTimestampToUtcDatetimeString_OLD_CORRECT(epochtime, withTZ){
950
950
  let d = new Date(epochtime);
951
951
  let str =d.toISOString();
952
952
  return (withTZ ? str : str.replace("T", " ").replace("Z", ""));
953
- },
953
+ }
954
954
  UtcTimestampToUtcDatetimeString(epochtime, withTZ){
955
955
  let d = this.UtcTimestampToUtcDatetime(epochtime);
956
956
  return this.DatetimeToStringUtc(d, true, withTZ);
957
- },
957
+ }
958
958
  getOffsetFromUtc(){
959
959
  var dt = new Date();
960
960
  return -dt.getTimezoneOffset()/60;
961
- },
961
+ }
962
962
  // https://stackoverflow.com/questions/8579861/how-to-convert-milliseconds-into-a-readable-date
963
963
  stringToDate(str){ // i.. "2021-04-05 15:59:55 GMT+4"
964
964
  return new Date( Date.parse(str) );
965
- },
965
+ }
966
966
  msGoneAfter(date){
967
967
  return (new Date()-date);
968
- },
968
+ }
969
969
  getYMDHISFfromDate(dt, utc=true){
970
970
  // todo ? is +1 needed for month ??
971
971
  if (utc) {
@@ -973,7 +973,7 @@ function PUVOX_LIBRARY() { return {
973
973
  } else {
974
974
  return [1900 + dt.getYear(), dt.getMonth()+1, dt.getDate(), dt.getHours(), dt.getMinutes(), dt.getSeconds(), dt.getMilliseconds()];
975
975
  }
976
- },
976
+ }
977
977
  getYMDHISFfromDateWithZeros(dt, utc=true){
978
978
  let y, M, d, h, m, s, f;
979
979
  if (utc) {
@@ -994,36 +994,36 @@ function PUVOX_LIBRARY() { return {
994
994
  f = dt.getMilliseconds();
995
995
  }
996
996
  return {y:y.toString(), M:(M<10?'0':'')+M.toString(), d:(d<10?'0':'')+d.toString(), h:(h<10?'0':'')+h.toString(), m:(m<10?'0':'')+m.toString(), s:(s<10?'0':'')+s.toString(), f:(f<10?'00':(f<100?'0':''))+f.toString()};
997
- },
997
+ }
998
998
  prefixWithZero(num, digits){
999
999
  return (digits===1 ? num : (digits===2 ? (num < 10 ? "0"+num : num ) : (digits===3 ? (num < 10 ? "00"+num : (num < 100 ? "0"+num : num ) ) : num ) ) ).toString();
1000
- },
1000
+ }
1001
1001
  currentDatetimeIs(targetDate){ //"2021-03-30 13:33:45 GMT+0300"
1002
1002
  var curr_dt = new Date( Date.now() );
1003
1003
  var target_dt= new Date( Date.parse(targetDate) );
1004
1004
  return curr_dt.getYear() ==target_dt.getYear() && curr_dt.getMonth() ==target_dt.getMonth() && curr_dt.getDate() ==target_dt.getDate() && curr_dt.getHours() ==target_dt.getHours() && curr_dt.getMinutes() ==target_dt.getMinutes() && curr_dt.getSeconds() ==target_dt.getSeconds();
1005
- },
1005
+ }
1006
1006
  dateCompare(date1, date2){
1007
- var date1 = puvox_library.isString(date1) ? Date.parse(date1) : date1;
1007
+ var date1 = this.MAIN_CLASS.isString(date1) ? Date.parse(date1) : date1;
1008
1008
  date1 = new Date( date1 );
1009
1009
  var date2 = date2 || new Date(Date.now());
1010
1010
  return (+date1 > +date2 ? 1 : +date1 < +date2 ? -1 : 0);
1011
- },
1011
+ }
1012
1012
  dateTill(date1, date2){
1013
- var date1 = puvox_library.isString(date1) ? Date.parse(date1) : date1;
1013
+ var date1 = this.MAIN_CLASS.isString(date1) ? Date.parse(date1) : date1;
1014
1014
  date1 = new Date( date1 );
1015
1015
  var date2 = date2 || new Date(Date.now());
1016
1016
  var diff = new Date(date1.getTime()-date2.getTime());
1017
1017
  return diff;
1018
- },
1018
+ }
1019
1019
  secondsTill(date1, date2){
1020
- var date1 = puvox_library.isString(date1) ? Date.parse(date1) : date1;
1020
+ var date1 = this.MAIN_CLASS.isString(date1) ? Date.parse(date1) : date1;
1021
1021
  date1 = new Date( date1 );
1022
1022
  var date2 = date2 || new Date(Date.now());
1023
1023
  var diffS = date1.getTime()-date2.getTime();
1024
1024
  var seconds = Math.round(diffS/1000);
1025
1025
  return seconds;
1026
- },
1026
+ }
1027
1027
 
1028
1028
  /**
1029
1029
  * Adds time to a date. Modelled after MySQL DATE_ADD function.
@@ -1051,16 +1051,16 @@ function PUVOX_LIBRARY() { return {
1051
1051
  default : ret = undefined; break;
1052
1052
  }
1053
1053
  return ret;
1054
- },
1054
+ }
1055
1055
  // this approach is correct, the other one: https://pastebin_com/GwsScXx1 has strange bug in node, might relate to: https://stackoverflow.com/a/19691491/2377343
1056
1056
  addSeconds(date, seconds){
1057
1057
  return new Date( Date.parse(date) + seconds*1000 );
1058
- },
1058
+ }
1059
1059
  addDays(date, days){
1060
1060
  var result = new Date(date);
1061
1061
  result.setDate(result.getDate() + days);
1062
1062
  return result;
1063
- },
1063
+ }
1064
1064
  daysBetween(a, b, utc = true){
1065
1065
  // https://stackoverflow.com/a/15289883/2377343
1066
1066
  const _MS_PER_DAY = 1000 * 60 * 60 * 24;
@@ -1075,7 +1075,7 @@ function PUVOX_LIBRARY() { return {
1075
1075
  }
1076
1076
  return Math.floor((d2 - d1) / _MS_PER_DAY);
1077
1077
  }
1078
- },
1078
+ })();
1079
1079
  // ####### END OF DATETIME FUNCTIONS ####### //
1080
1080
 
1081
1081
 
@@ -1098,14 +1098,14 @@ function PUVOX_LIBRARY() { return {
1098
1098
  el.parentNode.removeChild(el);
1099
1099
  }
1100
1100
  }
1101
- },
1101
+ }
1102
1102
 
1103
1103
 
1104
1104
 
1105
1105
  contains(string, pattern){
1106
1106
  var re = new RegExp(pattern);
1107
1107
  return (re.test(string));
1108
- },
1108
+ }
1109
1109
 
1110
1110
  hide_show_transprent(el, hide){
1111
1111
  if(hide){
@@ -1116,11 +1116,11 @@ function PUVOX_LIBRARY() { return {
1116
1116
  el.css("opacity", 1);
1117
1117
  el.css("z-index", 0);
1118
1118
  }
1119
- },
1119
+ }
1120
1120
 
1121
1121
  get_extension_from_url( url ) {
1122
1122
  return url.split(/\#|\?/)[0].split('.').pop().trim();
1123
- },
1123
+ }
1124
1124
 
1125
1125
 
1126
1126
  // https://stackoverflow.com/a/7924240/2377343 (has better performance than (ch.match(/\n/g) || []).length or ch.split('\n').length - 1 )
@@ -1134,7 +1134,7 @@ function PUVOX_LIBRARY() { return {
1134
1134
  if (pos >= 0) { ++n; pos += step; } else break;
1135
1135
  }
1136
1136
  return n;
1137
- },
1137
+ }
1138
1138
 
1139
1139
  // startReadStream(__dirname + '/aa.csv', ()=>{});
1140
1140
  async readLineByLine (filePath, callback, linesSize = 10000, delimiterN = true) {
@@ -1172,7 +1172,7 @@ function PUVOX_LIBRARY() { return {
1172
1172
  rejector();
1173
1173
  });
1174
1174
  return prom;
1175
- },
1175
+ }
1176
1176
  async linesAmountInFile(filePath, delimiterN = true) {
1177
1177
  const self = this;
1178
1178
  // calblack format: callback(linesArray, isLastChunk)
@@ -1196,7 +1196,7 @@ function PUVOX_LIBRARY() { return {
1196
1196
  rejector();
1197
1197
  });
1198
1198
  return prom;
1199
- },
1199
+ }
1200
1200
 
1201
1201
 
1202
1202
 
@@ -1204,16 +1204,16 @@ function PUVOX_LIBRARY() { return {
1204
1204
 
1205
1205
  oneSpace(cc){
1206
1206
  return cc.replace(/\s\s+/g, ' ');
1207
- },
1207
+ }
1208
1208
  removeFirstAndLastChar(cc){
1209
1209
  return this.oneSpace( cc.substring(1, cc.length-1 ) );
1210
- },
1210
+ }
1211
1211
  getWithin_X(cc, x){
1212
1212
  return this.oneSpace( cc.replace(new RegExp('(.*?)'+x+'(.*)'+x+'(.*)', 'g'), '$2') );
1213
- },
1213
+ }
1214
1214
  getWithin_XY(cc, x, y){
1215
1215
  return this.oneSpace( cc.replace(new RegExp('(.*?)'+x+'(.*)'+y+'(.*)', 'g'), '$2') );
1216
- },
1216
+ }
1217
1217
  // https://stackoverflow.com/q/6462578/2377343
1218
1218
  removeIfOutsideQuotes(content, replaceWhat, replaceWith){
1219
1219
  var regex = new RegExp('"[^"]+"|('+replaceWhat+')','g');
@@ -1222,31 +1222,31 @@ function PUVOX_LIBRARY() { return {
1222
1222
  else return replaceWith;
1223
1223
  });
1224
1224
  return replaced;
1225
- },
1225
+ }
1226
1226
  // https://stackoverflow.com/questions/19414193/regex-extract-string-not-between-two-brackets
1227
1227
  // https://stackoverflow.com/questions/62616023/regex-split-if-not-inside-the-two-characters
1228
1228
  splitBy_X_NotInside_Y(str, x, y) //x: split by; y: not inside
1229
1229
  {
1230
1230
  return str.split( RegExp(x+'+(?=(?:(?:[^'+y+']*"){2})*[^'+y+']*$)', 'g' ) );
1231
- },
1231
+ }
1232
1232
  splitBy_X_NotInside_YZ(str, by, y, z) //x: split by; y&z: not inside
1233
1233
  {
1234
1234
  return str.split( RegExp(by+'+(?=(?:(?:[^'+y+']*"){2})*[^'+z+']*$)', 'g' ) );
1235
- },
1235
+ }
1236
1236
  splitOnlyFirstOccurence(str, what){
1237
1237
  return str.split(new RegExp(what+'(.+)'));
1238
- },
1238
+ }
1239
1239
  //equal
1240
1240
  splitByEqualNotInsideDoubleQuotes(str)
1241
1241
  {
1242
1242
  return str.split(/\=+(?=(?:(?:[^"]*"){2})*[^"]*$)/g);
1243
- },
1243
+ }
1244
1244
  //double equals
1245
1245
  splitByEqualNotInsideDoubleQuotesAndDoubleEquals(str)
1246
1246
  {
1247
1247
  let newStr = str.replace(/==/g, "__DOUBLE_EQUAL__RAND294393494__");
1248
1248
  return newStr.split(/\=+(?=(?:(?:[^"]*"){2})*[^"]*$)/g).map(x=> x.replace(/__DOUBLE_EQUAL__RAND294393494__/g,"==") );
1249
- },
1249
+ }
1250
1250
 
1251
1251
  splitByNotInside2(str, splitChar,notInsideCharStart,notInsideCharEnd)
1252
1252
  {
@@ -1269,7 +1269,7 @@ function PUVOX_LIBRARY() { return {
1269
1269
  }
1270
1270
 
1271
1271
  if (currentPart) parts.push(currentPart);
1272
- },
1272
+ }
1273
1273
 
1274
1274
  // i.e. if you want to get from first to last correct brackets
1275
1275
  // start ( "a1)" "b1)" 'c1)' ) aaaaa ) bbbbb ) cccccc)
@@ -1321,21 +1321,22 @@ function PUVOX_LIBRARY() { return {
1321
1321
  }
1322
1322
  }
1323
1323
  return result;
1324
- },
1324
+ }
1325
1325
 
1326
1326
  // https://stackoverflow.com/questions/9621825/escape-a-variable-within-a-regular-expression
1327
1327
  preg_quote(str, delimiter) {
1328
1328
  return (str + '').replace(new RegExp('[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\' + (delimiter || '') + '-]', 'g'), '\\$&');
1329
- },
1329
+ }
1330
1330
  escapeRegExp(string) {
1331
1331
  return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
1332
- },
1332
+ }
1333
1333
 
1334
1334
  splitStringIntoChars(str){
1335
1335
  return str.split(/(?=[\s\S])/u);
1336
- },
1336
+ }
1337
1337
 
1338
- empty(MyVar){ return this.is_empty_or_undefined(MyVar);},
1338
+ empty(MyVar){ return this.is_empty_or_undefined(MyVar);}
1339
+
1339
1340
  is_empty_or_undefined (MyVar)
1340
1341
  {
1341
1342
  return (
@@ -1357,7 +1358,7 @@ function PUVOX_LIBRARY() { return {
1357
1358
  ||
1358
1359
  (/^\s*$/.test(MyVar))
1359
1360
  );
1360
- },
1361
+ }
1361
1362
  isEmptyValue(input){
1362
1363
  //input is considered empty value: falsy value (like null, undefined, '', except false and 0),
1363
1364
  // string with white space characters only, empty array, empty object
@@ -1365,17 +1366,17 @@ function PUVOX_LIBRARY() { return {
1365
1366
  ((input instanceof String || typeof input === 'string') && !input.trim()) ||
1366
1367
  (Array.isArray(input) && !input.length) ||
1367
1368
  (input instanceof Object && !Object.keys(input).length);
1368
- },
1369
+ }
1369
1370
  removeEmptyValue (obj) {
1370
1371
  if (!(obj instanceof Object))
1371
1372
  return {};
1372
1373
  Object.keys(obj).forEach(key => this.isEmptyValue(obj[key]) && delete obj[key]);
1373
1374
  return obj;
1374
- },
1375
+ }
1375
1376
  isIterable(obj) {
1376
1377
  if (obj == null) { return false; }
1377
1378
  return typeof obj[Symbol.iterator] === 'function';
1378
- },
1379
+ }
1379
1380
  insertRedErrorLine(array_){
1380
1381
  var array = array_;
1381
1382
  array["position"] = array["position"] || "before";
@@ -1391,7 +1392,7 @@ function PUVOX_LIBRARY() { return {
1391
1392
  $(this).hide();
1392
1393
  }
1393
1394
  );
1394
- } ,
1395
+ }
1395
1396
 
1396
1397
  // more from locutus: https://github.com/locutusjs/locutus/blob/master/src/php
1397
1398
  stripTags (input, allowed) {
@@ -1401,9 +1402,9 @@ function PUVOX_LIBRARY() { return {
1401
1402
  return input.replace(commentsAndPhpTags, '').replace(tags, function ($0, $1) {
1402
1403
  return allowed.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : '';
1403
1404
  });
1404
- },
1405
+ }
1405
1406
 
1406
- br2nl(content) { return content.replace('/\<br(\s*)?\/?\>/i', "\n"); },
1407
+ br2nl(content) { return content.replace('/\<br(\s*)?\/?\>/i', "\n"); }
1407
1408
 
1408
1409
  jquery_popup(element, isModal, params){
1409
1410
  var isModal = isModal || true;
@@ -1429,7 +1430,7 @@ function PUVOX_LIBRARY() { return {
1429
1430
  $("#custom_overlay").remove();
1430
1431
  }
1431
1432
  });
1432
- },
1433
+ }
1433
1434
  jquery_popup_once(cookiename, key, text, duration, onComplete){
1434
1435
  var text = text;
1435
1436
  var cookieVal = this.Cookies.getOption(cookiename, "popup_shown_"+key, "true");
@@ -1445,7 +1446,7 @@ function PUVOX_LIBRARY() { return {
1445
1446
  else{
1446
1447
  onComplete();
1447
1448
  }
1448
- },
1449
+ }
1449
1450
 
1450
1451
  jquery_popup_one_time_checkbox(cookiename, key, text, callable_func, defaultCheckboxTxt){
1451
1452
  var defaultCheckboxTxt = defaultCheckboxTxt || '<div class="dialog_dont_show_again" style=" bottom:0; right:0; font-size:0.7em; background:#e7e7e7; width:100%; margin: 2px; padding: 2px; display: inline-block;"><input type="checkbox" onclick="PuvoxLibrary.dialog_dont_show_again(event, \''+key+'\', \''+cookiename+'\')" /><span class="dont_show_again_inner">Don\'t show this window again</span></div>';
@@ -1461,23 +1462,22 @@ function PUVOX_LIBRARY() { return {
1461
1462
  {
1462
1463
  callable_func();
1463
1464
  }
1464
- },
1465
+ }
1465
1466
  dialog_dont_show_again(event, key, cookiename)
1466
1467
  {
1467
1468
  this.Cookies.setOption(cookiename, "popup_checkbox_"+key, (event.target.checked ? "false" : "true") );
1468
- },
1469
+ }
1469
1470
 
1470
1471
  dialogClose(){
1471
1472
  window.parent.$('.ui-dialog-content:visible').dialog('close');
1472
- },
1473
-
1474
-
1473
+ }
1475
1474
 
1476
1475
 
1476
+
1477
1477
  mergeObjects(obj1, obj2){
1478
1478
  for (var attrname in obj2) { obj1[attrname] = obj2[attrname]; }
1479
1479
  return obj1;
1480
- },
1480
+ }
1481
1481
 
1482
1482
  // returns a new object with the values at each key mapped using mapFn(value)
1483
1483
  objectMap(obj, fn) {
@@ -1486,7 +1486,7 @@ function PUVOX_LIBRARY() { return {
1486
1486
  ([k, v], i) => [k, fn(v, k, i)]
1487
1487
  )
1488
1488
  )
1489
- },
1489
+ }
1490
1490
 
1491
1491
  fancyTimeFormat(time)
1492
1492
  {
@@ -1505,7 +1505,7 @@ function PUVOX_LIBRARY() { return {
1505
1505
  ret += "" + mins + ":" + (secs < 10 ? "0" : "");
1506
1506
  ret += "" + secs;
1507
1507
  return ret;
1508
- },
1508
+ }
1509
1509
 
1510
1510
  getYtIdFromURL(URL_or_ID){
1511
1511
  var id;
@@ -1518,7 +1518,7 @@ function PUVOX_LIBRARY() { return {
1518
1518
  id = r[1];
1519
1519
  }
1520
1520
  return id;
1521
- },
1521
+ }
1522
1522
 
1523
1523
  //
1524
1524
  jsonToArray(json_data){
@@ -1526,16 +1526,16 @@ function PUVOX_LIBRARY() { return {
1526
1526
  //for(var i in json_data) result.push([i, json_data[i]]);
1527
1527
  result = Object.keys(json_data).map((key) => [key, json_data[key]]);
1528
1528
  return result;
1529
- },
1529
+ }
1530
1530
 
1531
1531
  fixEntitiedJson(json_data){
1532
1532
  return json_data.replace(/&#34;/g,'"');
1533
- },
1533
+ }
1534
1534
 
1535
1535
 
1536
1536
  setSelectByOptionName(selectEl, optName){
1537
1537
  selectEl.find('option').filter(function () { var txt=$(this).html(); return (txt==optName); }).prop('selected', true);
1538
- },
1538
+ }
1539
1539
  ScrollTo(el, func, offset_distance) //setHashInAddress
1540
1540
  {
1541
1541
  var offset_distance= offset_distance || 0;
@@ -1543,29 +1543,29 @@ function PUVOX_LIBRARY() { return {
1543
1543
  $('html, body').animate({
1544
1544
  scrollTop: $(el).offset().top - offset_distance
1545
1545
  }, 1000, func);
1546
- },
1546
+ }
1547
1547
  sleep(ms) {
1548
1548
  return new Promise(resolve => this.setTimeout_safe(resolve, ms));
1549
- },
1549
+ }
1550
1550
  // immitating ccxt setTimeout
1551
1551
  setTimeout_safe (done, ms) {
1552
1552
  const self = this; const targetTime = Date.now() + ms; if (ms >= 2147483647) { throw new Error ('setTimeout() function was called with unrealistic value of ' + ms.toString ()); } let clearInnerTimeout = () => {}; let active = true; const id = setTimeout (() => { active = true; const rest = targetTime - Date.now (); if (rest > 0) { clearInnerTimeout = self.setTimeout_safe (done, rest, setTimeout, targetTime); } else { done (); } }, ms); return function clear () { if (active) { active = false; clearTimeout (id); } clearInnerTimeout (); };
1553
- },
1553
+ }
1554
1554
 
1555
1555
  scrollToBottom2(el) //setHashInAddress
1556
1556
  {
1557
1557
  if (el && el[0])
1558
1558
  el.scrollTop(el[0].scrollHeight - el.height());
1559
- },
1559
+ }
1560
1560
  scrollToBottom(el_or_id) {
1561
1561
  var el = this.isObject(el_or_id) ? el_or_id : document.querySelector(el_or_id);
1562
1562
  el.scrollTop = el.scrollHeight - el.clientHeight;
1563
- },
1563
+ }
1564
1564
 
1565
1565
  scrollToBottom3(el_or_id) {
1566
1566
  var el = this.isObject(el_or_id) ? el_or_id : document.querySelector(el_or_id);
1567
1567
  el.scrollTop(el.scrollHeight - el.height());
1568
- },
1568
+ }
1569
1569
 
1570
1570
 
1571
1571
  // scroll to
@@ -1574,18 +1574,18 @@ function PUVOX_LIBRARY() { return {
1574
1574
  $('html, body').animate({
1575
1575
  scrollTop: $(selector).offset().top-100
1576
1576
  }, 1000);
1577
- },
1577
+ }
1578
1578
 
1579
1579
 
1580
1580
  addLine(selector, text, first_or_last){
1581
1581
  let elem = this.isObject(selector) ? selector : document.querySelector(selector);
1582
1582
  elem.insertAdjacentHTML("beforeend", "\r\n - "+text);
1583
- },
1583
+ }
1584
1584
  removeLine(selector, first_or_last, ifMoreThanXlines) {
1585
1585
  let elem = this.isObject(selector) ? selector : document.querySelector(selector);
1586
1586
  //c( "a"+this.removeLineFromText(elem.innerHTML, first_or_last, ifMoreThanXlines));
1587
1587
  elem.innerHTML = this.removeElementFromElement(elem.innerHTML, first_or_last, ifMoreThanXlines);
1588
- },
1588
+ }
1589
1589
 
1590
1590
  removeElementIfMoreThan(el, amount, first_or_last){
1591
1591
  let childs = el.children;
@@ -1593,13 +1593,13 @@ function PUVOX_LIBRARY() { return {
1593
1593
  {
1594
1594
  el.children[0].remove();
1595
1595
  }
1596
- },
1596
+ }
1597
1597
 
1598
1598
  removeElementIfMoreThanNEW(el, amount, first_or_last){
1599
1599
  let newEl = el.cloneNode(true);
1600
1600
  this.removeElementIfMoreThan(newEl, amount, first_or_last);
1601
1601
  return newEl;
1602
- },
1602
+ }
1603
1603
 
1604
1604
  // if(setHashInAddress) { window.location.hash = id_or_Name; }
1605
1605
  removeLine_old(selector, first_or_last, ifMoreThanXlines) {
@@ -1616,12 +1616,12 @@ function PUVOX_LIBRARY() { return {
1616
1616
  else val.pop();
1617
1617
  }
1618
1618
  elem.value=val.join('\n') + '\r\n';
1619
- },
1619
+ }
1620
1620
 
1621
1621
  removeLineFromTextarea(selector, first_or_last, ifMoreThanXlines) {
1622
1622
  let elem = document.querySelector(selector);
1623
1623
  elem.value = this.removeLineFromText(elem.value, first_or_last, ifMoreThanXlines);
1624
- },
1624
+ }
1625
1625
  removeLineFromText(text, first_or_last, ifMoreThanXlines)
1626
1626
  {
1627
1627
  var ifMoreThanXlines= ifMoreThanXlines || 0;
@@ -1637,22 +1637,22 @@ function PUVOX_LIBRARY() { return {
1637
1637
  else val.pop();
1638
1638
  return val.join('\n') + '\r\n';
1639
1639
  }
1640
- },
1640
+ }
1641
1641
 
1642
1642
 
1643
1643
  arrayColumn(array, col)
1644
1644
  {
1645
1645
  return array.map(function(value,index) { return value[col]; });
1646
- },
1646
+ }
1647
1647
  arrayPart(array_, amount_, from)
1648
1648
  {
1649
1649
  var from = from || 'start'; //start|end
1650
1650
  let count = array_.length;
1651
1651
  return count<=amount_ ? array_ : ( from=='start' ? array_.slice(0, amount_) : array_.slice(-amount_) );
1652
- },
1652
+ }
1653
1653
  arrayInsertAt(array, index, value){
1654
1654
  return array.splice(index, 0, value);
1655
- },
1655
+ }
1656
1656
  executeAfterTry(el, func, num)
1657
1657
  {
1658
1658
  var num=num || 0;
@@ -1663,14 +1663,14 @@ function PUVOX_LIBRARY() { return {
1663
1663
  if( $(el).length ) func();
1664
1664
  else setTimeout( function(){ this_.executeAfterTry(el, func, num+1); }, 100 );
1665
1665
  }
1666
- },
1666
+ }
1667
1667
 
1668
1668
  waitExecute(el, func)
1669
1669
  {
1670
1670
  var this_ = this;
1671
1671
  if( jQuery(el).length ) func();
1672
1672
  else setTimeout( function(){ this_.waitExecute(el, func); }, 700 );
1673
- },
1673
+ }
1674
1674
 
1675
1675
  // https://stackoverflow.com/a/41407246/2377343
1676
1676
  consoleLogColor (text, backgroundColor=null, foregroundColor=null) {
@@ -1690,10 +1690,10 @@ function PUVOX_LIBRARY() { return {
1690
1690
  foreColorString = prefix + objectTree['foreground'][foregroundColor] + suffix;
1691
1691
  }
1692
1692
  console.log (backColorString + foreColorString + "%s" + prefix + objectTree.types.reset + suffix, text);
1693
- },
1693
+ }
1694
1694
 
1695
- toggleWindowsMessages_WindowConfirm() { return window.confirm },
1696
- toggleWindowsMessages_WindowAlert() { return window.alert },
1695
+ toggleWindowsMessages_WindowConfirm() { return window.confirm }
1696
+ toggleWindowsMessages_WindowAlert() { return window.alert }
1697
1697
  toggleWindowsMessages(enable){
1698
1698
  if (enable)
1699
1699
  {
@@ -1705,7 +1705,7 @@ function PUVOX_LIBRARY() { return {
1705
1705
  window.confirm = function() { return true; };
1706
1706
  window.alert = function() {};
1707
1707
  }
1708
- },
1708
+ }
1709
1709
  suspressMessagesExecution(func){
1710
1710
  var alert_ = window.alert;
1711
1711
  var confirm_= window.confirm;
@@ -1714,7 +1714,7 @@ function PUVOX_LIBRARY() { return {
1714
1714
  func();
1715
1715
  window.confirm = alert_;
1716
1716
  window.alert = confirm_;
1717
- },
1717
+ }
1718
1718
 
1719
1719
 
1720
1720
  MakeIframeFullHeight (iframeElement, cycling, overwrite_margin){
@@ -1737,14 +1737,14 @@ function PUVOX_LIBRARY() { return {
1737
1737
  })();
1738
1738
  //var funcname= arguments.callee.name;
1739
1739
  //window.setTimeout( function(){ console.log(funcname); console.log(cycling); window[funcname](iframeElement, cycling); }, 500 );
1740
- },
1740
+ }
1741
1741
 
1742
1742
  in_array(needle, haystack) {
1743
1743
  for(var i in haystack) {
1744
1744
  if(haystack[i] == needle) return true;
1745
1745
  }
1746
1746
  return false;
1747
- },
1747
+ }
1748
1748
 
1749
1749
  CreateFrameIn(targetEl, frameContent, MakeItfullWH){
1750
1750
  var MakeItfullWH = MakeItfullWH || false;
@@ -1759,7 +1759,7 @@ function PUVOX_LIBRARY() { return {
1759
1759
  this.MakeIframeFullHeight(iframe);
1760
1760
  }
1761
1761
  return iframe;
1762
- },
1762
+ }
1763
1763
 
1764
1764
  makeAllATargetBlank(el){
1765
1765
  if(!el) return;
@@ -1769,7 +1769,7 @@ function PUVOX_LIBRARY() { return {
1769
1769
  els[i].setAttribute("target", "_blank");
1770
1770
  }
1771
1771
  }
1772
- },
1772
+ }
1773
1773
 
1774
1774
  createDropdownFrom(arr, elementId, jqueriUi, appendToElement){
1775
1775
  var jqueriUi = jqueriUi || false;
@@ -1785,7 +1785,7 @@ function PUVOX_LIBRARY() { return {
1785
1785
  $(elementId).selectmenu();
1786
1786
  }
1787
1787
  return html;
1788
- },
1788
+ }
1789
1789
 
1790
1790
  //=====
1791
1791
 
@@ -1797,33 +1797,33 @@ function PUVOX_LIBRARY() { return {
1797
1797
  function toSolidBytes(match, p1) {
1798
1798
  return String.fromCharCode('0x' + p1);
1799
1799
  }));
1800
- },
1800
+ }
1801
1801
 
1802
1802
  b64DecodeUnicode(str) {
1803
1803
  // Going backwards: from bytestream, to percent-encoding, to original string.
1804
1804
  return decodeURIComponent(atob(str).split('').map(function(c) {
1805
1805
  return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
1806
1806
  }).join(''));
1807
- },
1807
+ }
1808
1808
 
1809
1809
  round(num,decimals){
1810
1810
  let v=Math.pow(10,decimals); return Math.round((num + Number.EPSILON) * v) / v; //toFixed
1811
- },
1811
+ }
1812
1812
 
1813
1813
 
1814
-
1815
1814
 
1816
1815
  // ============================= get basename of url ============================
1817
- basename(path) { return path.split('/').reverse()[0]; },
1816
+ basename(path) { return path.split('/').reverse()[0]; }
1818
1817
 
1819
1818
 
1820
1819
  // ======== simple POPUP ======== https://github.com/ttodua/useful-javascript/ ==============
1821
1820
  show_my_popup(TEXTorID, AdditionalStyles ){
1822
1821
  TEXTorID=TEXTorID.trim(); var FirstChar= TEXTorID.charAt(0); var eName = TEXTorID.substr(1); if ('#'==FirstChar || '.'==FirstChar){ if('#'==FirstChar){var x=document.getElementById(eName);} else{var x=document.getElementsByClassName(eName)[0];}} else { var x=document.createElement('div');x.innerHTML=TEXTorID;} var randm_id=Math.floor((Math.random()*100000000));
1823
1822
  var DivAA = document.createElement('div'); DivAA.id = "blkBackgr_"+randm_id; DivAA.className = "MyJsBackg"; DivAA.setAttribute("style", 'background:black; height:5000px; left:0px; opacity:0.9; position:fixed; top:0px; width:100%; z-index:99995;'); document.body.appendChild(DivAA); AdditionalStyles= AdditionalStyles || '';
1824
- var DivBB = document.createElement('div'); DivBB.id = 'popupp_'+randm_id; DivBB.className = "MyJsPopup"; DivBB.setAttribute("style",'background-color:white; border:6px solid white; border-radius:10px; display:block; min-height:1%; min-width:350px; width:auto; overflow:auto; max-height:80%; max-width:800px; padding:15px; position:fixed; text-align:left; top:10%; z-index:99995; left:0px; right:0px; margin-left:auto; margin-right:auto; width:80%;'+ AdditionalStyles); DivBB.innerHTML = '<div style="background-color:#C0BCBF; border-radius:55px; padding:5px; font-family:arial; float:right; font-weight:700; margin:-15px -10px 0px 0px; z-index: 88; " class="CloseButtn" ><a href="javascript:my_popup_closee('+randm_id+');" style="display:block;margin:-5px 0 0 0;font-size:1.6em;">x</a></div>'; document.body.appendChild(DivBB);z=x.cloneNode(true);DivBB.appendChild(z); if(z.style.display=="none"){z.style.display="block";} },
1825
- my_popup_closee(RandomIDD) { var x=document.getElementById("blkBackgr_"+RandomIDD); x.parentNode.removeChild(x); var x=document.getElementById('popupp_'+RandomIDD); x.parentNode.removeChild(x);
1826
- },
1823
+ var DivBB = document.createElement('div'); DivBB.id = 'popupp_'+randm_id; DivBB.className = "MyJsPopup"; DivBB.setAttribute("style",'background-color:white; border:6px solid white; border-radius:10px; display:block; min-height:1%; min-width:350px; width:auto; overflow:auto; max-height:80%; max-width:800px; padding:15px; position:fixed; text-align:left; top:10%; z-index:99995; left:0px; right:0px; margin-left:auto; margin-right:auto; width:80%;'+ AdditionalStyles); DivBB.innerHTML = '<div style="background-color:#C0BCBF; border-radius:55px; padding:5px; font-family:arial; float:right; font-weight:700; margin:-15px -10px 0px 0px; z-index: 88; " class="CloseButtn" ><a href="javascript:my_popup_closee('+randm_id+');" style="display:block;margin:-5px 0 0 0;font-size:1.6em;">x</a></div>'; document.body.appendChild(DivBB);z=x.cloneNode(true);DivBB.appendChild(z); if(z.style.display=="none"){z.style.display="block";}
1824
+ }
1825
+ my_popup_closee(RandomIDD) { var x=document.getElementById("blkBackgr_"+RandomIDD); x.parentNode.removeChild(x); var x=document.getElementById('popupp_'+RandomIDD); x.parentNode.removeChild(x);
1826
+ }
1827
1827
  // ========================================================== //
1828
1828
 
1829
1829
 
@@ -1833,7 +1833,7 @@ function PUVOX_LIBRARY() { return {
1833
1833
  loaderImage(circleColor){
1834
1834
  var circlecolor=circleColor || '#ffffff';
1835
1835
  return '<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0" width="90px" height="90px" viewBox="0 0 128 128" xml:space="preserve"><g><circle cx="16" cy="64" r="16" fill="'+circlecolor+'" fill-opacity="1"/><circle cx="16" cy="64" r="16" fill="'+circlecolor+'" fill-opacity="0.67" transform="rotate(45,64,64)"/><circle cx="16" cy="64" r="16" fill="#ffffff" fill-opacity="0.42" transform="rotate(90,64,64)"/><circle cx="16" cy="64" r="16" fill="'+circlecolor+'" fill-opacity="0.2" transform="rotate(135,64,64)"/><circle cx="16" cy="64" r="16" fill="'+circlecolor+'" fill-opacity="0.12" transform="rotate(180,64,64)"/><circle cx="16" cy="64" r="16" fill="'+circlecolor+'" fill-opacity="0.12" transform="rotate(225,64,64)"/><circle cx="16" cy="64" r="16" fill="'+circlecolor+'" fill-opacity="0.12" transform="rotate(270,64,64)"/><circle cx="16" cy="64" r="16" fill="'+circlecolor+'" fill-opacity="0.12" transform="rotate(315,64,64)"/><animateTransform attributeName="transform" type="rotate" values="0 64 64;315 64 64;270 64 64;225 64 64;180 64 64;135 64 64;90 64 64;45 64 64" calcMode="discrete" dur="720ms" repeatCount="indefinite"></animateTransform></g></svg>';
1836
- },
1836
+ }
1837
1837
  Loader(ShowOrHide, style, content_To_show)
1838
1838
  {
1839
1839
  var elementID = 'waiter_box_p';
@@ -1854,7 +1854,7 @@ function PUVOX_LIBRARY() { return {
1854
1854
  else{
1855
1855
  var x =document.getElementById(elementID); if (x) x.parentNode.removeChild(x);
1856
1856
  }
1857
- },
1857
+ }
1858
1858
  // ========================================================== //
1859
1859
 
1860
1860
 
@@ -1869,7 +1869,7 @@ function PUVOX_LIBRARY() { return {
1869
1869
  xmlhttp.open(method,url, true);
1870
1870
  if (method == "post"){xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.send(parameters);}
1871
1871
  else if (method == "get"){xmlhttp.send(null);}
1872
- },
1872
+ }
1873
1873
  // ========================================================== //
1874
1874
 
1875
1875
 
@@ -1879,7 +1879,7 @@ function PUVOX_LIBRARY() { return {
1879
1879
  for (index = 0; index < elmnts.length; ++index) {
1880
1880
  elmnts[index].style.display= "none"; //elmnts[index].className = elmnts[index].className + " my_css_hide_class";
1881
1881
  }
1882
- },
1882
+ }
1883
1883
  //window.onload = function(){ if(typeof MyTargetHideClass ==='String') hide_popuping_divs(MyTargetHideClass); };
1884
1884
 
1885
1885
  get(url, parameters) {
@@ -1914,10 +1914,10 @@ function PUVOX_LIBRARY() { return {
1914
1914
  // Make the request
1915
1915
  req.send(params_);
1916
1916
  });
1917
- },
1917
+ }
1918
1918
  getJSON(url, parameters) {
1919
1919
  return this.get(url, parameters).then(JSON.parse);
1920
- },
1920
+ }
1921
1921
 
1922
1922
  post(url, params, callback_1, callback_2){
1923
1923
  return fetch(url, {
@@ -1928,16 +1928,16 @@ function PUVOX_LIBRARY() { return {
1928
1928
  callback_1(text);
1929
1929
  });
1930
1930
  }); // .then(function(data) { callback_error(data); });
1931
- },
1931
+ }
1932
1932
 
1933
1933
 
1934
1934
  stringifyPretty(obj){
1935
1935
  return JSON.stringify(obj, null, 2);
1936
- },
1936
+ }
1937
1937
 
1938
1938
  responseStringify(obj_or_text){
1939
1939
  return ! this.is_object(obj_or_text) ? obj_or_text : ( 'responseText' in obj_or_text ? obj_or_text.responseText : JSON.stringify(obj_or_text) );
1940
- },
1940
+ }
1941
1941
  // ============================= getElementById from parent_node ========== http://stackoverflow.com/a/5683184/2377343 ==========
1942
1942
  //Element.prototype.getElementById_FROM_PARENT = function(req) {
1943
1943
  getElementById_FROM_PARENT(req) {
@@ -1950,16 +1950,16 @@ function PUVOX_LIBRARY() { return {
1950
1950
  else {id=elem.getElementById_FROM_PARENT(req); if(id) return id;} // otherwise, search recursively within the child
1951
1951
  }
1952
1952
  return null; // if no match found
1953
- },
1953
+ }
1954
1954
  // ========================================================== //
1955
1955
 
1956
1956
 
1957
1957
  inArray(needle, haystack) {
1958
1958
  return haystack.indexOf(needle) > -1;
1959
- },
1959
+ }
1960
1960
  inKeys(key, obj){
1961
1961
  return key in obj;
1962
- },
1962
+ }
1963
1963
 
1964
1964
  partialObject(object_, array_) {
1965
1965
  let newObj ={};
@@ -1969,7 +1969,7 @@ function PUVOX_LIBRARY() { return {
1969
1969
  }
1970
1970
  }
1971
1971
  return newObj;
1972
- },
1972
+ }
1973
1973
 
1974
1974
 
1975
1975
  array_column_with_keys(object_, keyName_) {
@@ -1979,7 +1979,7 @@ function PUVOX_LIBRARY() { return {
1979
1979
  new_[key_] = value_[keyName_];
1980
1980
  }
1981
1981
  return new_;
1982
- },
1982
+ }
1983
1983
 
1984
1984
 
1985
1985
  // ============================= URL parameters ============================= //
@@ -2010,7 +2010,7 @@ function PUVOX_LIBRARY() { return {
2010
2010
  }
2011
2011
  }
2012
2012
  return query_string;
2013
- },
2013
+ }
2014
2014
 
2015
2015
  // executed below
2016
2016
  URLParser(url){
@@ -2136,7 +2136,7 @@ function PUVOX_LIBRARY() { return {
2136
2136
  });
2137
2137
  }
2138
2138
  return obj;
2139
- },
2139
+ }
2140
2140
  /*
2141
2141
  http://www.example.com:8082/index.php#tab2?foo=789
2142
2142
 
@@ -2170,7 +2170,7 @@ function PUVOX_LIBRARY() { return {
2170
2170
  // });
2171
2171
  // request.on('end', function(){ callback(qs.parse(stringData)); } );
2172
2172
  }
2173
- },
2173
+ }
2174
2174
 
2175
2175
 
2176
2176
 
@@ -2197,7 +2197,7 @@ function PUVOX_LIBRARY() { return {
2197
2197
 
2198
2198
  el.attr("href", CurrentUrlReplaced);
2199
2199
  });
2200
- },
2200
+ }
2201
2201
 
2202
2202
 
2203
2203
  //replace parameter in query string
@@ -2209,22 +2209,22 @@ function PUVOX_LIBRARY() { return {
2209
2209
  var part= param_name+'='+variations[eachProp]; if (url.indexOf(part) >= 0){url = url.replace(part, param_name+'='+param_new_val); }
2210
2210
  }
2211
2211
  return url;
2212
- },
2212
+ }
2213
2213
 
2214
2214
 
2215
2215
 
2216
2216
  //if referrer is from same domain
2217
- refferer_is_same_domain(){ return document.referrer.indexOf(location.host) > -1;} ,
2217
+ refferer_is_same_domain(){ return document.referrer.indexOf(location.host) > -1;}
2218
2218
  //prevent default, better function
2219
- DoPrevent(e) { e.preventDefault(); e.stopPropagation(); },
2219
+ DoPrevent(e) { e.preventDefault(); e.stopPropagation(); }
2220
2220
  preventDefaultForAll(instantly){
2221
2221
  var func = function(){ document.querySelectorAll('.preventDefault').forEach( function(item){ item.addEventListener('click', function(e){ e.preventDefault(); }); } ); };
2222
2222
  if (instantly || false) func();
2223
2223
  else this.trigger_on_load(func);
2224
- },
2224
+ }
2225
2225
 
2226
2226
  //add hovered class on element
2227
- addHovered(elem){ if( elem.hasClass("hoveredd")) { elem.removeClass("hoveredd");} else { elem.addClass("hoveredd"); } },
2227
+ addHovered(elem){ if( elem.hasClass("hoveredd")) { elem.removeClass("hoveredd");} else { elem.addClass("hoveredd"); } }
2228
2228
  // ========================================================== //
2229
2229
 
2230
2230
 
@@ -2240,7 +2240,7 @@ function PUVOX_LIBRARY() { return {
2240
2240
  var x = jQuery(target_hidding_selector);
2241
2241
  if( jQuery(selector+':checked').val() == desiredvalue) {if(SHOW_or_hide) x.show(); else x.hide();}
2242
2242
  else {if(SHOW_or_hide) x.hide(); else x.show();}
2243
- },
2243
+ }
2244
2244
 
2245
2245
  // string.containss(smth)
2246
2246
  // if (window.String && String.prototype && !String.prototype.containss) String.prototype.containss = function(arg) { return (this.indexOf(arg) > -1); }
@@ -2248,7 +2248,7 @@ function PUVOX_LIBRARY() { return {
2248
2248
  // get random from array
2249
2249
  GetRandomFromArray(my_array){
2250
2250
  return my_array[this.random_number_minmax(0, my_array.length-1)];
2251
- },
2251
+ }
2252
2252
  // make array random
2253
2253
  array_shuffle(array) {
2254
2254
  var currentIndex = array.length, temporaryValue, randomIndex;
@@ -2263,7 +2263,7 @@ function PUVOX_LIBRARY() { return {
2263
2263
  array[randomIndex] = temporaryValue;
2264
2264
  }
2265
2265
  return array;
2266
- },
2266
+ }
2267
2267
 
2268
2268
 
2269
2269
  // ============================= youtube modal popup ============================= //
@@ -2300,14 +2300,14 @@ function PUVOX_LIBRARY() { return {
2300
2300
  });
2301
2301
  }
2302
2302
  if(options.oncall != ''){ window[options.oncall](); }
2303
- },
2303
+ }
2304
2304
 
2305
2305
  FadeOut_modalpp(){
2306
2306
  $(".yt-modal").fadeOut(350, function() {
2307
2307
  $(this).remove();
2308
2308
  $(".modal-bg").remove();
2309
2309
  });
2310
- },
2310
+ }
2311
2311
  // ============================= Youtube popup ============================= //
2312
2312
 
2313
2313
 
@@ -2319,7 +2319,7 @@ function PUVOX_LIBRARY() { return {
2319
2319
  }
2320
2320
  }
2321
2321
  };
2322
- },
2322
+ }
2323
2323
  forEachDefine2(){
2324
2324
  if (!Object.prototype.forEach2) {
2325
2325
  Object.defineProperty(Object.prototype, 'forEach2', {
@@ -2336,7 +2336,7 @@ function PUVOX_LIBRARY() { return {
2336
2336
  }
2337
2337
  });
2338
2338
  }
2339
- },
2339
+ }
2340
2340
  filterDefine(){
2341
2341
  Object.filter2 = function( obj, predicate) {
2342
2342
  let result = {}, key;
@@ -2349,7 +2349,7 @@ function PUVOX_LIBRARY() { return {
2349
2349
 
2350
2350
  return result;
2351
2351
  };
2352
- },
2352
+ }
2353
2353
  filterDefine2(){
2354
2354
  if (!Object.prototype.filter2) {
2355
2355
  Object.defineProperty(Object.prototype, 'filter2', {
@@ -2372,10 +2372,10 @@ function PUVOX_LIBRARY() { return {
2372
2372
  }
2373
2373
  });
2374
2374
  }
2375
- },
2375
+ }
2376
2376
 
2377
2377
 
2378
- var_dump(array){ var o=""; for (x in array) { o += x + ": " + array[x]+"; "; } window.console && console.log(o); },
2378
+ var_dump(array){ var o=""; for (x in array) { o += x + ": " + array[x]+"; "; } window.console && console.log(o); }
2379
2379
 
2380
2380
  // ============================= POST REQUEST SEND (LIVE FORM CREATION) ============================= //
2381
2381
  //USAGE: postForm( {deletecityy:'hihi', surname: 'blabla'}, 'Are you sure?' , 'http://yoursite.com' , '_blank');
@@ -2395,7 +2395,7 @@ function PUVOX_LIBRARY() { return {
2395
2395
  }
2396
2396
  }
2397
2397
  document.body.appendChild(form); form.submit();
2398
- },
2398
+ }
2399
2399
  // ==========================================================
2400
2400
 
2401
2401
 
@@ -2407,7 +2407,7 @@ function PUVOX_LIBRARY() { return {
2407
2407
  var NewClass = document.createElement('div');NewClass.innerHTML='.myHintClass{position:absolute; background:#eeeeee; z-index: 9999;}'; document.body.appendChild(NewClass);
2408
2408
  //
2409
2409
  this.SetPoistion=function(e){ e.target.style.top= parseInt(e.pageY+top)+'px'; e.target.style.left= parseInt(e.pageX + left) + 'px'; };
2410
- },
2410
+ }
2411
2411
  // ==========================================================
2412
2412
 
2413
2413
 
@@ -2438,7 +2438,7 @@ function PUVOX_LIBRARY() { return {
2438
2438
 
2439
2439
  }
2440
2440
  else{ window.console && console.log("img not defined.. error28475 in script"); }
2441
- },
2441
+ }
2442
2442
 
2443
2443
 
2444
2444
  Balanced_Image_proportions (classname, widthh, heightt, parentClassname){ var LOAD_Result; var myImages; var FinalWidth=widthh; var FinalHeight=heightt;
@@ -2485,7 +2485,7 @@ function PUVOX_LIBRARY() { return {
2485
2485
 
2486
2486
 
2487
2487
  }
2488
- },
2488
+ }
2489
2489
  // ========================================================= //
2490
2490
  // ================= ### IMAGE PROPORTIONS ================= //
2491
2491
  // ========================================================= //
@@ -2493,11 +2493,11 @@ function PUVOX_LIBRARY() { return {
2493
2493
  show_after_pageload(el){
2494
2494
  var el = el || '.show_after_pageload';
2495
2495
  this.Append_To_Head("style", 'body '+el+' {opacity:1;}');
2496
- },
2496
+ }
2497
2497
  hide_after_pageload(el){
2498
2498
  var el = el || '.hide_after_pageload';
2499
2499
  this.Append_To_Head("style", 'body '+el+' {display:none;}');
2500
- },
2500
+ }
2501
2501
 
2502
2502
  // ==================== Position ==================== //
2503
2503
  Highlight_Current_Menu_link(Added_class_name, Ancestor_to_search_in, link_to_find){
@@ -2516,9 +2516,9 @@ function PUVOX_LIBRARY() { return {
2516
2516
  }
2517
2517
  if (condition) { A_elements[i].className += " "+Added_class_name; }
2518
2518
  }
2519
- },
2519
+ }
2520
2520
  //remove # from location
2521
- RemoveHashString(str){ var hash=str.split("#")[1]; return str.replace("#"+hash,''); },
2521
+ RemoveHashString(str){ var hash=str.split("#")[1]; return str.replace("#"+hash,''); }
2522
2522
  // ===================================================================//
2523
2523
 
2524
2524
  arrayRemoveValue(array, value) {
@@ -2528,14 +2528,14 @@ function PUVOX_LIBRARY() { return {
2528
2528
  newArray.splice(index, 1);
2529
2529
  }
2530
2530
  return newArray;
2531
- },
2531
+ }
2532
2532
 
2533
2533
  getCharsFromStart(str, amount){
2534
2534
  return str.substring(0, amount);
2535
- },
2535
+ }
2536
2536
  getCharsFromEnd(str, amount){
2537
2537
  return str.substring(str.length-amount, str.length);
2538
- },
2538
+ }
2539
2539
 
2540
2540
  // ============================= Position ============================= //
2541
2541
  GetTopLeft(myyElement) {
@@ -2543,20 +2543,20 @@ function PUVOX_LIBRARY() { return {
2543
2543
  var scrolled = {x : 0, y : 0}; this.GetScrolled (myyElement.parentNode, scrolled);
2544
2544
  var posX = offset.x - scrolled.x; var posY = offset.y - scrolled.y;
2545
2545
  return {lefttt: posX , toppp: posY };
2546
- },
2546
+ }
2547
2547
  GetOffset(object, offset) {
2548
2548
  if (!object) return;
2549
2549
  offset.x += object.offsetLeft; offset.y += object.offsetTop;
2550
2550
  this.GetOffset (object.offsetParent, offset);
2551
- },
2551
+ }
2552
2552
  GetScrolled(object, scrolled) {
2553
2553
  if (!object) return;
2554
2554
  scrolled.x += object.scrollLeft; scrolled.y += object.scrollTop;
2555
2555
  if (object.tagName.toLowerCase () != "html") { this.GetScrolled (object.parentNode, scrolled); }
2556
- },
2557
- // ============================= ##Position ============================= //
2556
+ }
2557
+ // ======================== ##Position ======================== //
2558
2558
 
2559
- // ============================= ## jQUery Fixed navigation ============================= //
2559
+ // ================ ## jQUery Fixed navigation ================ //
2560
2560
  MakeFixed(selector, ExtraHeightToBody){
2561
2561
  var sticky = $(selector);
2562
2562
  var StickyHeight=parseInt(sticky.height());
@@ -2568,7 +2568,7 @@ function PUVOX_LIBRARY() { return {
2568
2568
  if ($(window).scrollTop() > navPosition.top) { if(!sticky.hasClass('fixed_stickyy')){sticky.addClass('fixed_stickyy');} }
2569
2569
  else { if( sticky.hasClass('fixed_stickyy')){sticky.removeClass('fixed_stickyy');} }
2570
2570
  });
2571
- },
2571
+ }
2572
2572
  // ========================================================== //
2573
2573
 
2574
2574
  triggerWhenElementInView(el, func){
@@ -2602,7 +2602,7 @@ function PUVOX_LIBRARY() { return {
2602
2602
  return (!(viewport.right < bounds.left || viewport.left > bounds.right || viewport.bottom < bounds.top || viewport.top > bounds.bottom));
2603
2603
 
2604
2604
  };
2605
- },
2605
+ }
2606
2606
 
2607
2607
  compare(a, operator, b) {
2608
2608
  if(operator === '==') return a == b;
@@ -2614,7 +2614,7 @@ function PUVOX_LIBRARY() { return {
2614
2614
  else if (operator === '<') return a < b;
2615
2615
  else if (operator === '<=') return a <= b;
2616
2616
  else throw "Unknown operator";
2617
- },
2617
+ }
2618
2618
  calculate(a, operator, b) {
2619
2619
  if(operator === '+') return a + b;
2620
2620
  else if (operator === '-') return a - b;
@@ -2622,15 +2622,15 @@ function PUVOX_LIBRARY() { return {
2622
2622
  else if (operator === '/') return a / b;
2623
2623
  else if (operator === '%') return a % b;
2624
2624
  else throw "Unknown operator";
2625
- },
2625
+ }
2626
2626
 
2627
2627
  // random NUMBER or STRINGS
2628
- RandomNum(maxNum) { return Math.floor((Math.random() * maxNum) + 1); },
2628
+ RandomNum(maxNum) { return Math.floor((Math.random() * maxNum) + 1); }
2629
2629
 
2630
- random_number(Length) { var length= length || 5; return Math.floor((Math.random() * Math.pow(10, length)) + 1);},
2631
- randomNumber(Length) {return this.random_number(length);},
2632
- random_number_minmax(min, max) { var min= min || 1; var max= max || 9999999999; return Math.floor(Math.random() * (max - min + 1)) + min;},
2633
- randomString(Length) { var length= length || 5; return Math.random().toString(36).substr(2, length);},
2630
+ random_number(Length) { var length= length || 5; return Math.floor((Math.random() * Math.pow(10, length)) + 1);}
2631
+ randomNumber(Length) {return this.random_number(length);}
2632
+ random_number_minmax(min, max) { var min= min || 1; var max= max || 9999999999; return Math.floor(Math.random() * (max - min + 1)) + min;}
2633
+ randomString(Length) { var length= length || 5; return Math.random().toString(36).substr(2, length);}
2634
2634
  //getRandomInt(max) { return Math.floor(Math.random() * Math.floor(max)); },
2635
2635
 
2636
2636
  shuffle_Word(word){
@@ -2643,9 +2643,9 @@ function PUVOX_LIBRARY() { return {
2643
2643
  word.splice(charIndex,1);
2644
2644
  }
2645
2645
  return shuffledWord;
2646
- },
2646
+ }
2647
2647
 
2648
- youtubeImage(id, quality) { return 'http://img.youtube.com/vi/'+id+'/'+ (quality || "mqdefault") +'.jpg'; } ,
2648
+ youtubeImage(id, quality) { return 'http://img.youtube.com/vi/'+id+'/'+ (quality || "mqdefault") +'.jpg'; }
2649
2649
 
2650
2650
  // ============================= detect mobile device ============================= //
2651
2651
  IsMobileDevice(simpleORfull){
@@ -2658,7 +2658,7 @@ function PUVOX_LIBRARY() { return {
2658
2658
  this.IsMobileDevice= (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(navigtr)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(navigtr.substr(0,4)));
2659
2659
  }
2660
2660
  return IsMobileDevice;
2661
- },
2661
+ }
2662
2662
 
2663
2663
  backToTopBind(el){
2664
2664
  if ($(el).length) {
@@ -2669,7 +2669,7 @@ function PUVOX_LIBRARY() { return {
2669
2669
  }, 700);
2670
2670
  });
2671
2671
  }
2672
- },
2672
+ }
2673
2673
 
2674
2674
  enable_jquery_errors()
2675
2675
  {
@@ -2677,7 +2677,7 @@ function PUVOX_LIBRARY() { return {
2677
2677
  var elements = jQuery(selector, context); if( !elements.length ) { window.console && console.log("'" + selector + "' element(s) not found"); }
2678
2678
  return elements;
2679
2679
  }
2680
- },
2680
+ }
2681
2681
 
2682
2682
 
2683
2683
  // region ### TELEGRAM FUNCTIONS ###
@@ -2722,10 +2722,10 @@ function PUVOX_LIBRARY() { return {
2722
2722
  } catch (ex) {
2723
2723
  return {'ok': false, 'description': ex.message + ':::' + responseText };
2724
2724
  }
2725
- },
2725
+ }
2726
2726
 
2727
- telegram_interval_ms: 50, // telegram seems to accept around 30 times per second, so we'd better wait around that milliseconds
2728
- telegram_last_sent_time: 0,
2727
+ telegram_interval_ms= 50; // telegram seems to accept around 30 times per second, so we'd better wait around that milliseconds
2728
+ telegram_last_sent_time= 0;
2729
2729
 
2730
2730
  async telegramMessageCached(text, chat_id, bot_key, extra_opts={}, customCacheId=null){
2731
2731
  if (!extra_opts) extra_opts = {};
@@ -2745,17 +2745,17 @@ function PUVOX_LIBRARY() { return {
2745
2745
  //if(is_callable([$this,'notifications_db_entry']))
2746
2746
  // $this->notifications_db_entry($key, $array['chat_id'], $this->stringify($res), time(), $ok );
2747
2747
  //return $res;
2748
- },
2748
+ }
2749
2749
 
2750
2750
  openUrlInBrowser(url)
2751
2751
  {
2752
2752
  var cmd = (process.platform == 'darwin'? `open ${url}`: process.platform == 'win32'? `start ${url}`: `xdg-open ${url}`);
2753
2753
  // require('child_process').exec(cmd);
2754
- },
2754
+ }
2755
2755
 
2756
2756
  stringify(obj_or_str){
2757
2757
  return this.isSimpleVariableType(obj_or_str) ? obj_or_str.toString() : JSON.stringify(obj_or_str);
2758
- },
2758
+ }
2759
2759
 
2760
2760
  stringify_plain(data){
2761
2761
  var text='';
@@ -2776,21 +2776,21 @@ function PUVOX_LIBRARY() { return {
2776
2776
  text = data;
2777
2777
  }
2778
2778
  return text;
2779
- },
2779
+ }
2780
2780
  CopyObject(obj) {
2781
2781
  return JSON.parse(JSON.stringify(obj));
2782
- },
2782
+ }
2783
2783
 
2784
2784
  uniqId(obj_or_str){
2785
2785
  return this.md5( this.stringify(obj_or_str) );
2786
- },
2786
+ }
2787
2787
 
2788
2788
  stringifyWithUndefined(obj){
2789
2789
  return JSON.stringify(obj, function(key, value){ return value === undefined ? null : value; });
2790
- },
2790
+ }
2791
2791
  // https://gist.github.com/PixnBits/8811212
2792
2792
  //md5(str){ let name='crypto'; return require(name).createHash('md5').update(str).digest("hex"); }
2793
- md5(str){var md5cycle=function(x,k){var a=x[0],b=x[1],c=x[2],d=x[3];a=ff(a,b,c,d,k[0],7,-680876936);d=ff(d,a,b,c,k[1],12,-389564586);c=ff(c,d,a,b,k[2],17,606105819);b=ff(b,c,d,a,k[3],22,-1044525330);a=ff(a,b,c,d,k[4],7,-176418897);d=ff(d,a,b,c,k[5],12,1200080426);c=ff(c,d,a,b,k[6],17,-1473231341);b=ff(b,c,d,a,k[7],22,-45705983);a=ff(a,b,c,d,k[8],7,1770035416);d=ff(d,a,b,c,k[9],12,-1958414417);c=ff(c,d,a,b,k[10],17,-42063);b=ff(b,c,d,a,k[11],22,-1990404162);a=ff(a,b,c,d,k[12],7,1804603682);d=ff(d,a,b,c,k[13],12,-40341101);c=ff(c,d,a,b,k[14],17,-1502002290);b=ff(b,c,d,a,k[15],22,1236535329);a=gg(a,b,c,d,k[1],5,-165796510);d=gg(d,a,b,c,k[6],9,-1069501632);c=gg(c,d,a,b,k[11],14,643717713);b=gg(b,c,d,a,k[0],20,-373897302);a=gg(a,b,c,d,k[5],5,-701558691);d=gg(d,a,b,c,k[10],9,38016083);c=gg(c,d,a,b,k[15],14,-660478335);b=gg(b,c,d,a,k[4],20,-405537848);a=gg(a,b,c,d,k[9],5,568446438);d=gg(d,a,b,c,k[14],9,-1019803690);c=gg(c,d,a,b,k[3],14,-187363961);b=gg(b,c,d,a,k[8],20,1163531501);a=gg(a,b,c,d,k[13],5,-1444681467);d=gg(d,a,b,c,k[2],9,-51403784);c=gg(c,d,a,b,k[7],14,1735328473);b=gg(b,c,d,a,k[12],20,-1926607734);a=hh(a,b,c,d,k[5],4,-378558);d=hh(d,a,b,c,k[8],11,-2022574463);c=hh(c,d,a,b,k[11],16,1839030562);b=hh(b,c,d,a,k[14],23,-35309556);a=hh(a,b,c,d,k[1],4,-1530992060);d=hh(d,a,b,c,k[4],11,1272893353);c=hh(c,d,a,b,k[7],16,-155497632);b=hh(b,c,d,a,k[10],23,-1094730640);a=hh(a,b,c,d,k[13],4,681279174);d=hh(d,a,b,c,k[0],11,-358537222);c=hh(c,d,a,b,k[3],16,-722521979);b=hh(b,c,d,a,k[6],23,76029189);a=hh(a,b,c,d,k[9],4,-640364487);d=hh(d,a,b,c,k[12],11,-421815835);c=hh(c,d,a,b,k[15],16,530742520);b=hh(b,c,d,a,k[2],23,-995338651);a=ii(a,b,c,d,k[0],6,-198630844);d=ii(d,a,b,c,k[7],10,1126891415);c=ii(c,d,a,b,k[14],15,-1416354905);b=ii(b,c,d,a,k[5],21,-57434055);a=ii(a,b,c,d,k[12],6,1700485571);d=ii(d,a,b,c,k[3],10,-1894986606);c=ii(c,d,a,b,k[10],15,-1051523);b=ii(b,c,d,a,k[1],21,-2054922799);a=ii(a,b,c,d,k[8],6,1873313359);d=ii(d,a,b,c,k[15],10,-30611744);c=ii(c,d,a,b,k[6],15,-1560198380);b=ii(b,c,d,a,k[13],21,1309151649);a=ii(a,b,c,d,k[4],6,-145523070);d=ii(d,a,b,c,k[11],10,-1120210379);c=ii(c,d,a,b,k[2],15,718787259);b=ii(b,c,d,a,k[9],21,-343485551);x[0]=add32(a,x[0]);x[1]=add32(b,x[1]);x[2]=add32(c,x[2]);x[3]=add32(d,x[3])};var cmn=function(q,a,b,x,s,t){a=add32(add32(a,q),add32(x,t));return add32(a<<s|a>>>32-s,b)};var ff=function(a,b,c,d,x,s,t){return cmn(b&c|~b&d,a,b,x,s,t)};var gg=function(a,b,c,d,x,s,t){return cmn(b&d|c&~d,a,b,x,s,t)};var hh=function(a,b,c,d,x,s,t){return cmn(b^c^d,a,b,x,s,t)};var ii=function(a,b,c,d,x,s,t){return cmn(c^(b|~d),a,b,x,s,t)};var md51=function(s){var txt="",n=s.length,state=[1732584193,-271733879,-1732584194,271733878],i;for(i=64;i<=s.length;i+=64){md5cycle(state,md5blk(s.substring(i-64,i)))}s=s.substring(i-64);var tail=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(i=0;i<s.length;i++)tail[i>>2]|=s.charCodeAt(i)<<(i%4<<3);tail[i>>2]|=128<<(i%4<<3);if(i>55){md5cycle(state,tail);for(i=0;i<16;i++)tail[i]=0}tail[14]=n*8;md5cycle(state,tail);return state};var md5blk=function(s){var md5blks=[],i;for(i=0;i<64;i+=4){md5blks[i>>2]=s.charCodeAt(i)+(s.charCodeAt(i+1)<<8)+(s.charCodeAt(i+2)<<16)+(s.charCodeAt(i+3)<<24)}return md5blks};var hex_chr="0123456789abcdef".split("");var rhex=function(n){var s="",j=0;for(;j<4;j++)s+=hex_chr[n>>j*8+4&15]+hex_chr[n>>j*8&15];return s};var hex=function(x){for(var i=0;i<x.length;i++)x[i]=rhex(x[i]);return x.join("")};var md5_=function(s){return hex(md51(s))};var add32=function(a,b){return a+b&4294967295};if(md5_("hello")!="5d41402abc4b2a76b9719d911017c592"){var add32=function(x,y){var lsw=(x&65535)+(y&65535),msw=(x>>16)+(y>>16)+(lsw>>16);return msw<<16|lsw&65535}}return md5_(str)},
2793
+ md5(str){var md5cycle=function(x,k){var a=x[0],b=x[1],c=x[2],d=x[3];a=ff(a,b,c,d,k[0],7,-680876936);d=ff(d,a,b,c,k[1],12,-389564586);c=ff(c,d,a,b,k[2],17,606105819);b=ff(b,c,d,a,k[3],22,-1044525330);a=ff(a,b,c,d,k[4],7,-176418897);d=ff(d,a,b,c,k[5],12,1200080426);c=ff(c,d,a,b,k[6],17,-1473231341);b=ff(b,c,d,a,k[7],22,-45705983);a=ff(a,b,c,d,k[8],7,1770035416);d=ff(d,a,b,c,k[9],12,-1958414417);c=ff(c,d,a,b,k[10],17,-42063);b=ff(b,c,d,a,k[11],22,-1990404162);a=ff(a,b,c,d,k[12],7,1804603682);d=ff(d,a,b,c,k[13],12,-40341101);c=ff(c,d,a,b,k[14],17,-1502002290);b=ff(b,c,d,a,k[15],22,1236535329);a=gg(a,b,c,d,k[1],5,-165796510);d=gg(d,a,b,c,k[6],9,-1069501632);c=gg(c,d,a,b,k[11],14,643717713);b=gg(b,c,d,a,k[0],20,-373897302);a=gg(a,b,c,d,k[5],5,-701558691);d=gg(d,a,b,c,k[10],9,38016083);c=gg(c,d,a,b,k[15],14,-660478335);b=gg(b,c,d,a,k[4],20,-405537848);a=gg(a,b,c,d,k[9],5,568446438);d=gg(d,a,b,c,k[14],9,-1019803690);c=gg(c,d,a,b,k[3],14,-187363961);b=gg(b,c,d,a,k[8],20,1163531501);a=gg(a,b,c,d,k[13],5,-1444681467);d=gg(d,a,b,c,k[2],9,-51403784);c=gg(c,d,a,b,k[7],14,1735328473);b=gg(b,c,d,a,k[12],20,-1926607734);a=hh(a,b,c,d,k[5],4,-378558);d=hh(d,a,b,c,k[8],11,-2022574463);c=hh(c,d,a,b,k[11],16,1839030562);b=hh(b,c,d,a,k[14],23,-35309556);a=hh(a,b,c,d,k[1],4,-1530992060);d=hh(d,a,b,c,k[4],11,1272893353);c=hh(c,d,a,b,k[7],16,-155497632);b=hh(b,c,d,a,k[10],23,-1094730640);a=hh(a,b,c,d,k[13],4,681279174);d=hh(d,a,b,c,k[0],11,-358537222);c=hh(c,d,a,b,k[3],16,-722521979);b=hh(b,c,d,a,k[6],23,76029189);a=hh(a,b,c,d,k[9],4,-640364487);d=hh(d,a,b,c,k[12],11,-421815835);c=hh(c,d,a,b,k[15],16,530742520);b=hh(b,c,d,a,k[2],23,-995338651);a=ii(a,b,c,d,k[0],6,-198630844);d=ii(d,a,b,c,k[7],10,1126891415);c=ii(c,d,a,b,k[14],15,-1416354905);b=ii(b,c,d,a,k[5],21,-57434055);a=ii(a,b,c,d,k[12],6,1700485571);d=ii(d,a,b,c,k[3],10,-1894986606);c=ii(c,d,a,b,k[10],15,-1051523);b=ii(b,c,d,a,k[1],21,-2054922799);a=ii(a,b,c,d,k[8],6,1873313359);d=ii(d,a,b,c,k[15],10,-30611744);c=ii(c,d,a,b,k[6],15,-1560198380);b=ii(b,c,d,a,k[13],21,1309151649);a=ii(a,b,c,d,k[4],6,-145523070);d=ii(d,a,b,c,k[11],10,-1120210379);c=ii(c,d,a,b,k[2],15,718787259);b=ii(b,c,d,a,k[9],21,-343485551);x[0]=add32(a,x[0]);x[1]=add32(b,x[1]);x[2]=add32(c,x[2]);x[3]=add32(d,x[3])};var cmn=function(q,a,b,x,s,t){a=add32(add32(a,q),add32(x,t));return add32(a<<s|a>>>32-s,b)};var ff=function(a,b,c,d,x,s,t){return cmn(b&c|~b&d,a,b,x,s,t)};var gg=function(a,b,c,d,x,s,t){return cmn(b&d|c&~d,a,b,x,s,t)};var hh=function(a,b,c,d,x,s,t){return cmn(b^c^d,a,b,x,s,t)};var ii=function(a,b,c,d,x,s,t){return cmn(c^(b|~d),a,b,x,s,t)};var md51=function(s){var txt="",n=s.length,state=[1732584193,-271733879,-1732584194,271733878],i;for(i=64;i<=s.length;i+=64){md5cycle(state,md5blk(s.substring(i-64,i)))}s=s.substring(i-64);var tail=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(i=0;i<s.length;i++)tail[i>>2]|=s.charCodeAt(i)<<(i%4<<3);tail[i>>2]|=128<<(i%4<<3);if(i>55){md5cycle(state,tail);for(i=0;i<16;i++)tail[i]=0}tail[14]=n*8;md5cycle(state,tail);return state};var md5blk=function(s){var md5blks=[],i;for(i=0;i<64;i+=4){md5blks[i>>2]=s.charCodeAt(i)+(s.charCodeAt(i+1)<<8)+(s.charCodeAt(i+2)<<16)+(s.charCodeAt(i+3)<<24)}return md5blks};var hex_chr="0123456789abcdef".split("");var rhex=function(n){var s="",j=0;for(;j<4;j++)s+=hex_chr[n>>j*8+4&15]+hex_chr[n>>j*8&15];return s};var hex=function(x){for(var i=0;i<x.length;i++)x[i]=rhex(x[i]);return x.join("")};var md5_=function(s){return hex(md51(s))};var add32=function(a,b){return a+b&4294967295};if(md5_("hello")!="5d41402abc4b2a76b9719d911017c592"){var add32=function(x,y){var lsw=(x&65535)+(y&65535),msw=(x>>16)+(y>>16)+(lsw>>16);return msw<<16|lsw&65535}}return md5_(str);}
2794
2794
 
2795
2795
 
2796
2796
 
@@ -2808,14 +2808,12 @@ function PUVOX_LIBRARY() { return {
2808
2808
  }
2809
2809
  return o1;
2810
2810
  }
2811
- },
2812
-
2813
-
2811
+ }
2814
2812
 
2815
2813
 
2816
2814
  async fetch(url, postOptions = null, opts = {}){
2817
2815
  return await this.getRemoteData(url, postOptions, opts);
2818
- },
2816
+ }
2819
2817
  async getRemoteData(url, postOptions = null, opts = {}){
2820
2818
  // https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch
2821
2819
  const options = {};
@@ -2834,7 +2832,7 @@ function PUVOX_LIBRARY() { return {
2834
2832
  // }).on ('error', (ex) => { reject (ex); });
2835
2833
  // } catch (ex) { reject (ex); }
2836
2834
  // });
2837
- },
2835
+ }
2838
2836
  // if(setHashInAddress) { window.location.hash = id_or_Name; }
2839
2837
 
2840
2838
 
@@ -2852,29 +2850,30 @@ function PUVOX_LIBRARY() { return {
2852
2850
  str = str.slice(0, -1);
2853
2851
  }
2854
2852
  return str;
2855
- },
2853
+ }
2856
2854
  trailingSlash(str){
2857
2855
  return this.unTrailingSlash(str) + '/';
2858
- },
2856
+ }
2859
2857
 
2860
2858
  // ######## CACHE ITEMS (client-side JS) ########
2861
- privateAppName__ : null, //override with anything you want
2862
- setAppName (name){ this.privateAppName__ = name; },
2859
+ privateAppName__ = null; //override with anything you want
2860
+ setAppName (name){ this.privateAppName__ = name; }
2863
2861
  getAppName(){
2864
2862
  if (!this.privateAppName__){
2865
2863
  throw new Error ('Before you start using caching functions, please at first define your appplication\'s name(identifier) at first with .setAppName("whatever_my_app_name"), so it will get its own cache-storage');
2866
2864
  }
2867
2865
  return this.privateAppName__;
2868
- },
2866
+ }
2869
2867
 
2870
2868
 
2871
2869
  // ######## Cookies: https://github.com/ttodua/useful-javascript/blob/master/cookies-library.js ######## //
2872
- Cookies : {
2873
- get(a,b) { return this.cookies_instance().get(a,b); },
2874
- set(a,b,c) { return this.cookies_instance().set(a,b); },
2875
- remove(a, b) {return this.cookies_instance().remove(a,b); },
2876
- append(name, value, attributes) {return this.cookies_instance().set((this.get(name) || '') + value, attributes); },
2877
- isset(cookiename) {return this.get(cookiename)!="";}, // document.cookie.indexOf('; '+cookiename+'=');
2870
+ Cookies = new (class{
2871
+ MAIN_CLASS = self;
2872
+ get(a,b) { return this.cookies_instance().get(a,b); }
2873
+ set(a,b,c) { return this.cookies_instance().set(a,b); }
2874
+ remove(a, b) {return this.cookies_instance().remove(a,b); }
2875
+ append(name, value, attributes) {return this.cookies_instance().set((this.get(name) || '') + value, attributes); }
2876
+ isset(cookiename) {return this.get(cookiename)!="";} // document.cookie.indexOf('; '+cookiename+'=');
2878
2877
  // WORKING WITH ARRAY/OBJECTS
2879
2878
  getOption(cookieName, key, defaultValue)
2880
2879
  {
@@ -2886,7 +2885,7 @@ function PUVOX_LIBRARY() { return {
2886
2885
  return parsed[key];
2887
2886
  }
2888
2887
  return defaultValue;
2889
- },
2888
+ }
2890
2889
  setOption(cookieName, key, value, attributes)
2891
2890
  {
2892
2891
  var cookie = this.get(cookieName);
@@ -2896,7 +2895,7 @@ function PUVOX_LIBRARY() { return {
2896
2895
  var attributes = attributes || { expires: 99999 };
2897
2896
  this.set(cookieName, JSON.stringify(parsed), attributes);
2898
2897
  return parsed;
2899
- },
2898
+ }
2900
2899
  removeOption(cookieName, key, attributes)
2901
2900
  {
2902
2901
  var cookie = this.get(cookieName);
@@ -2906,17 +2905,17 @@ function PUVOX_LIBRARY() { return {
2906
2905
  var attributes = attributes || { expires: 99999 };
2907
2906
  this.set(cookieName, JSON.stringify(parsed), attributes);
2908
2907
  return parsed;
2909
- },
2908
+ }
2910
2909
  //sub-array
2911
2910
  getOptionObject(cookieName, key){
2912
2911
  return JSON.parse( this.getOption(cookieName, key, "{}") );
2913
- },
2912
+ }
2914
2913
  setOptionObject(cookieName, key, subKey, subValue){
2915
2914
  var existing = JSON.parse( this.getOption(cookieName, key, "{}") );
2916
2915
  if (subValue==null) delete existing[subKey];
2917
2916
  else existing[subKey]=subValue;
2918
2917
  this.setOption(cookieName, key, JSON.stringify(existing));
2919
- },
2918
+ }
2920
2919
  setOptionArray(cookieName, key, subValue, Add_or_remove)
2921
2920
  {
2922
2921
  var existing = JSON.parse( this.getOption(cookieName, key, "[]") );
@@ -2926,26 +2925,27 @@ function PUVOX_LIBRARY() { return {
2926
2925
  }
2927
2926
  else if(!Add_or_remove && existing.includes(subValue) )
2928
2927
  {
2929
- existing = puvox_library.removeItem(existing, subValue);
2928
+ existing = this.MAIN_CLASS.removeItem(existing, subValue);
2930
2929
  }
2931
2930
  this.setOption(cookieName, key, JSON.stringify(existing));
2932
- },
2931
+ }
2933
2932
  //
2934
- cookies_instance(){ if (!this.cookies_inited) this.cookies_inited=this.cookies(); return this.cookies_inited; } ,
2935
- cookies_inited: null,
2933
+ cookies_instance(){ if (!this.cookies_inited) this.cookies_inited = this.cookies(); return this.cookies_inited; }
2934
+ cookies_inited= null;
2936
2935
  // https://cdn.jsdelivr.net/npm/js-cookie@rc/dist/js.cookie.min.js
2937
- cookies : function(){"use strict";function e(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)e[r]=n[r]}return e}var t={read:function(e){return e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};return function n(r,o){function i(t,n,i){if("undefined"!=typeof document){"number"==typeof(i=e({},o,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),t=encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),n=r.write(n,t);var c="";for(var u in i)i[u]&&(c+="; "+u,!0!==i[u]&&(c+="="+i[u].split(";")[0]));return document.cookie=t+"="+n+c}}return Object.create({set:i,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],o={},i=0;i<n.length;i++){var c=n[i].split("="),u=c.slice(1).join("=");'"'===u[0]&&(u=u.slice(1,-1));try{var f=t.read(c[0]);if(o[f]=r.read(u,f),e===f)break}catch(e){}}return e?o[e]:o}},remove:function(t,n){i(t,"",e({},n,{expires:-1}))},withAttributes:function(t){return n(this.converter,e({},this.attributes,t))},withConverter:function(t){return n(e({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(o)},converter:{value:Object.freeze(r)}})}(t,{path:"/"})}
2938
- },
2936
+ cookies = function(){"use strict";function e(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)e[r]=n[r]}return e}var t={read:function(e){return e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};return function n(r,o){function i(t,n,i){if("undefined"!=typeof document){"number"==typeof(i=e({},o,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),t=encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),n=r.write(n,t);var c="";for(var u in i)i[u]&&(c+="; "+u,!0!==i[u]&&(c+="="+i[u].split(";")[0]));return document.cookie=t+"="+n+c}}return Object.create({set:i,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var n=document.cookie?document.cookie.split("; "):[],o={},i=0;i<n.length;i++){var c=n[i].split("="),u=c.slice(1).join("=");'"'===u[0]&&(u=u.slice(1,-1));try{var f=t.read(c[0]);if(o[f]=r.read(u,f),e===f)break}catch(e){}}return e?o[e]:o}},remove:function(t,n){i(t,"",e({},n,{expires:-1}))},withAttributes:function(t){return n(this.converter,e({},this.attributes,t))},withConverter:function(t){return n(e({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(o)},converter:{value:Object.freeze(r)}})}(t,{path:"/"})}
2937
+ })();
2939
2938
 
2940
2939
 
2941
- cache: {
2940
+ cache = new (class{
2941
+ MAIN_CLASS = self;
2942
2942
  helper_read(groupName, storageType, expireSeconds = 0){
2943
- const appName = puvox_library.getAppName();
2943
+ const appName = this.MAIN_CLASS.getAppName();
2944
2944
  if (storageType === 'file'){
2945
- const dir = puvox_library.file.tempDir() + appName + '/';
2945
+ const dir = this.MAIN_CLASS.file.tempDir() + appName + '/';
2946
2946
  const filepath = dir + groupName + '.json';
2947
2947
  // todo: add expiration
2948
- return puvox_library.file.read(filepath);
2948
+ return this.MAIN_CLASS.file.read(filepath);
2949
2949
  } else if (storageType === 'localStorage') {
2950
2950
  const storage = window.localStorage;
2951
2951
  let val = storage.getItem(appName + '_' + groupName);
@@ -2962,16 +2962,16 @@ function PUVOX_LIBRARY() { return {
2962
2962
  if (typeof alert !== 'undefined') alert(`storageType ${storageType} not supported`);
2963
2963
  throw new Error(`storageType ${storageType} not supported`);
2964
2964
  }
2965
- },
2965
+ }
2966
2966
  helper_write(groupName, content, storageType){
2967
- content = puvox_library.isString (content) ? content : (puvox_library.isArray(content) || puvox_library.isObject(content) ? JSON.stringify(content) : content);
2968
- const appName = puvox_library.getAppName();
2967
+ content = this.MAIN_CLASS.isString (content) ? content : (this.MAIN_CLASS.isArray(content) || this.MAIN_CLASS.isObject(content) ? JSON.stringify(content) : content);
2968
+ const appName = this.MAIN_CLASS.getAppName();
2969
2969
  if (storageType === 'file'){
2970
- const dir = puvox_library.file.tempDir() + appName + '/';
2971
- puvox_library.file.createDirectory(dir);
2970
+ const dir = this.MAIN_CLASS.file.tempDir() + appName + '/';
2971
+ this.MAIN_CLASS.file.createDirectory(dir);
2972
2972
  const filepath = dir + groupName + '.json';
2973
2973
  // todo: add expiration
2974
- puvox_library.file.write(filepath, content);
2974
+ this.MAIN_CLASS.file.write(filepath, content);
2975
2975
  return true;
2976
2976
  } else if (storageType === 'localStorage') {
2977
2977
  try{
@@ -2985,13 +2985,13 @@ function PUVOX_LIBRARY() { return {
2985
2985
  if (typeof alert !== 'undefined') alert(`storageType ${storageType} not supported`);
2986
2986
  throw new Error(`storageType ${storageType} not supported`);
2987
2987
  }
2988
- },
2988
+ }
2989
2989
  helper_delete(groupName, storageType){
2990
- const appName = puvox_library.getAppName();
2990
+ const appName = this.MAIN_CLASS.getAppName();
2991
2991
  if (storageType === 'file'){
2992
- const filepath = puvox_library.file.tempDir() + appName + '/' + groupName + '.json';
2992
+ const filepath = this.MAIN_CLASS.file.tempDir() + appName + '/' + groupName + '.json';
2993
2993
  // todo: better delete
2994
- puvox_library.file.delete(filepath);
2994
+ this.MAIN_CLASS.file.delete(filepath);
2995
2995
  return true;
2996
2996
  } else if (storageType === 'localStorage') {
2997
2997
  try{
@@ -3005,30 +3005,30 @@ function PUVOX_LIBRARY() { return {
3005
3005
  alert(`storageType ${storageType} not supported`);
3006
3006
  throw new Error(`storageType ${storageType} not supported`);
3007
3007
  }
3008
- },
3008
+ }
3009
3009
 
3010
3010
  get(groupName, defaultVal = null, storageType = 'localStorage', expireSeconds = 0){
3011
3011
  const content = this.helper_read(groupName, storageType, expireSeconds);
3012
3012
  return (content !== null && content !== '') ? content : defaultVal;
3013
- },
3013
+ }
3014
3014
  set(groupName, content, storageType = 'localStorage'){
3015
3015
  this.helper_write(groupName, content, storageType);
3016
- },
3016
+ }
3017
3017
  delete(groupName, storageType = 'localStorage'){
3018
3018
  this.helper_delete(groupName, storageType);
3019
- },
3019
+ }
3020
3020
  getChild(groupName, optName, defaultVal = null, storageType = 'localStorage', expireSeconds = 0){
3021
3021
  // todo: individual sub-item expiration
3022
3022
  const content = this.get(groupName, '{}', storageType, expireSeconds);
3023
3023
  const json = JSON.parse(content);
3024
3024
  return (optName in json) ? json[optName] : defaultVal;
3025
- },
3025
+ }
3026
3026
  setChild(groupName, optName, val, storageType = 'localStorage'){
3027
3027
  const content = this.get(groupName, '{}', storageType);
3028
3028
  const json = JSON.parse(content);
3029
3029
  json[optName] = val;
3030
3030
  this.set(groupName, JSON.stringify(json), storageType);
3031
- },
3031
+ }
3032
3032
  deleteChild(groupName, optName, storageType = 'localStorage'){
3033
3033
  const content = this.get(groupName, '{}', storageType, expireSeconds);
3034
3034
  // if it's empty, no need to do anything
@@ -3036,40 +3036,41 @@ function PUVOX_LIBRARY() { return {
3036
3036
  const json = JSON.parse(content);
3037
3037
  delete json[optName];
3038
3038
  this.set(groupName, JSON.stringify(json), storageType);
3039
- },
3039
+ }
3040
3040
 
3041
3041
 
3042
- file: {
3042
+ file = new (class {
3043
+ MAIN_CLASS = self;
3043
3044
  // ########## CACHE DIRS (server-side JS) ##########
3044
- customCacheDir:null,
3045
+ customCacheDir = null;
3045
3046
  get_dir(){
3046
3047
  if (!this.customCacheDir){
3047
- this.customCacheDir = puvox_library.file.tempDir();
3048
+ this.customCacheDir = this.MAIN_CLASS.file.tempDir();
3048
3049
  }
3049
- let finaldir = puvox_library.trailingSlash(this.customCacheDir + puvox_library.getAppName() + '_cache_');
3050
+ let finaldir = this.MAIN_CLASS.trailingSlash(this.customCacheDir + this.MAIN_CLASS.getAppName() + '_cache_');
3050
3051
  return finaldir;
3051
- },
3052
+ }
3052
3053
  set_dir(dir, auto_clear_seconds=null){
3053
3054
  if(dir) this.customCacheDir = dir;
3054
- const res = puvox_library.file.createDirectory(this.customCacheDir);
3055
+ const res = this.MAIN_CLASS.file.createDirectory(this.customCacheDir);
3055
3056
  if( !is_null(auto_clear_seconds))
3056
3057
  {
3057
3058
  throw new Error("Not implemented yet! 345346");
3058
3059
  //$this->clearCacheDir($auto_clear_seconds);
3059
3060
  }
3060
3061
  return res;
3061
- },
3062
+ }
3062
3063
  filePath(uniqFileName){
3063
- const parent = puvox_library;
3064
+ const parent = this.MAIN_CLASS;
3064
3065
  uniqFileName = parent.isString(uniqFileName) || parent.isNumeric(uniqFileName) ? uniqFileName : JSON.stringify(uniqFileName);
3065
3066
  uniqFileName = parent.sanitize_key_dashed(parent.getCharsFromStart(uniqFileName, 15)) + "_"+ parent.md5(uniqFileName);
3066
3067
  filePath= this.get_dir() + uniqFileName + "_tmp"; //"/".
3067
3068
  return filePath;
3068
- },
3069
+ }
3069
3070
  //
3070
3071
  get(uniqFileName, defaultContent ='', expire_seconds=8640000, decode = true)
3071
3072
  {
3072
- const parent = puvox_library;
3073
+ const parent = this.MAIN_CLASS;
3073
3074
  let filePath = this.filePath(uniqFileName);
3074
3075
  if ( parent.file.exists(filePath) ){
3075
3076
  if ( parent.file.mtime(filePath) + expire_seconds *1000 < (new Date()).getTime() ){
@@ -3099,17 +3100,14 @@ function PUVOX_LIBRARY() { return {
3099
3100
  else {
3100
3101
  return defaultContent;
3101
3102
  }
3102
- },
3103
+ }
3103
3104
  set(uniqFileName, content)
3104
3105
  {
3105
- const parent = puvox_library;
3106
+ const parent = this.MAIN_CLASS;
3106
3107
  let filePath= this.filePath(uniqFileName);
3107
3108
  let contentFinal = parent.isString(content) ? content : ((parent.isArray(content) || parent.isObject(content)) ? JSON.stringify(content) : content);
3108
3109
  return parent.file.write(filePath, contentFinal);
3109
- },
3110
-
3111
-
3112
-
3110
+ }
3113
3111
 
3114
3112
 
3115
3113
  //
@@ -3117,14 +3115,14 @@ function PUVOX_LIBRARY() { return {
3117
3115
  // try{
3118
3116
  // var callback = callback || function(){};
3119
3117
  // var self = this;
3120
- // puvox_library.modules('fs').readFile(filePath, 'utf8', function(err,data) {
3118
+ // this.MAIN_CLASS.modules('fs').readFile(filePath, 'utf8', function(err,data) {
3121
3119
  // let json = {};
3122
3120
  // if (typeof data !="undefined" && data!=''){
3123
3121
  // json=JSON.parse(data);
3124
3122
  // }
3125
3123
  // let jsonNew = self.jsonConcat(json, jsonContent);
3126
3124
  // let content = JSON.stringify(jsonNew);
3127
- // puvox_library.modules('fs').writeFile(filePath, content, 'utf8', function(callback_) {
3125
+ // this.MAIN_CLASS.modules('fs').writeFile(filePath, content, 'utf8', function(callback_) {
3128
3126
  // });
3129
3127
  // });
3130
3128
  // }
@@ -3132,41 +3130,39 @@ function PUVOX_LIBRARY() { return {
3132
3130
  // console.log("writeFileAppendJson", e);
3133
3131
  // }
3134
3132
  // },
3135
- containerDefaultPrefix: "_cached_ids_",
3136
- tempIds:{},
3133
+ containerDefaultPrefix = "_cached_ids_";
3134
+ tempIds = {};
3137
3135
  idForContent(slugOrContent){
3138
- return puvox_library.md5(puvox_library.isSimpleVariableType(slugOrContent) ? slugOrContent : JSON.stringify(slugOrContent));
3139
- },
3136
+ return this.MAIN_CLASS.md5(this.MAIN_CLASS.isSimpleVariableType(slugOrContent) ? slugOrContent : JSON.stringify(slugOrContent));
3137
+ }
3140
3138
  existsId(containerSlug, id){
3141
3139
  return (id in this.getIds(containerSlug));
3142
- },
3140
+ }
3143
3141
  getIds(containerSlug) {
3144
3142
  if (! (containerSlug in this.tempIds)) {
3145
- const content = puvox_library.file.read(this.get_dir() + this.containerDefaultPrefix + containerSlug, '{}');
3143
+ const content = this.MAIN_CLASS.file.read(this.get_dir() + this.containerDefaultPrefix + containerSlug, '{}');
3146
3144
  this.tempIds[containerSlug] = JSON.parse(content);
3147
3145
  }
3148
3146
  return this.tempIds[containerSlug];
3149
- },
3147
+ }
3150
3148
  setIds(containerSlug, idsDict) {
3151
3149
  this.tempIds[containerSlug] = idsDict;
3152
- return puvox_library.file.write(this.get_dir() + this.containerDefaultPrefix + containerSlug, JSON.stringify(this.tempIds[containerSlug]));
3153
- },
3150
+ return this.MAIN_CLASS.file.write(this.get_dir() + this.containerDefaultPrefix + containerSlug, JSON.stringify(this.tempIds[containerSlug]));
3151
+ }
3154
3152
  addId(containerSlug, id){
3155
3153
  const ids = this.getIds(containerSlug);
3156
3154
  ids[id] = 1;
3157
3155
  this.setIds(containerSlug, ids);
3158
- },
3156
+ }
3159
3157
  addIdIfNotExists(containerSlug, id){
3160
3158
  if (! this.existsId(containerSlug, id)){
3161
3159
  this.addId(containerSlug, id);
3162
3160
  return true;
3163
3161
  }
3164
3162
  return false;
3165
- },
3166
- },
3167
-
3168
-
3169
- },
3163
+ }
3164
+ })();
3165
+ })();
3170
3166
 
3171
3167
  // ################################################
3172
3168
  // for node packs:_fs_instance :null,
@@ -3179,7 +3175,8 @@ function PUVOX_LIBRARY() { return {
3179
3175
  // return this._required_instances[name];
3180
3176
  // }
3181
3177
  // },
3182
- file: {
3178
+ file = new (class {
3179
+ MAIN_CLASS = self;
3183
3180
  // support for several native modules
3184
3181
  set_module(module) {
3185
3182
  // 'fs'
@@ -3194,63 +3191,63 @@ function PUVOX_LIBRARY() { return {
3194
3191
  else if ('hostname' in module && 'homedir' in module && 'tmpdir' in module && 'platform' in module) {
3195
3192
  this.module_os = module;
3196
3193
  }
3197
- },
3194
+ }
3198
3195
  fs() {
3199
3196
  if(!this.module_fs) {
3200
3197
  throw new Error ('at first, set puvox_library.set_module(require("fs"))');
3201
3198
  }
3202
3199
  return this.module_fs;
3203
- },
3200
+ }
3204
3201
  os() {
3205
3202
  if(!this.module_os) {
3206
3203
  throw new Error ('at first, set puvox_library.set_module(require("os"))');
3207
3204
  }
3208
3205
  return this.module_os;
3209
- },
3206
+ }
3210
3207
  path() {
3211
3208
  if(!this.module_path) {
3212
3209
  throw new Error ('at first, set puvox_library.set_module(require("path"))');
3213
3210
  }
3214
3211
  return this.module_path;
3215
- },
3212
+ }
3216
3213
  // ends with slash
3217
- tempDir(){ return puvox_library.trailingSlash(this.os().tmpdir()); },
3214
+ tempDir(){ return this.MAIN_CLASS.trailingSlash(this.os().tmpdir()); }
3218
3215
 
3219
3216
  exists(filePath){
3220
3217
  return this.fs().existsSync(filePath);
3221
- },
3218
+ }
3222
3219
  mtime(filePath){
3223
3220
  if (this.exists(filePath)) {
3224
3221
  return (this.fs().statSync(filePath)).mtimeMs;
3225
3222
  } else {
3226
3223
  return null;
3227
3224
  }
3228
- },
3225
+ }
3229
3226
  delete(filePath){
3230
3227
  return (this.unlink(filePath));
3231
- },
3228
+ }
3232
3229
  unlink(filePath){
3233
3230
  return (this.fs().unlinkSync(filePath));
3234
- },
3231
+ }
3235
3232
  createDirectory(dirPath){
3236
3233
  if (!this.exists(dirPath)){
3237
3234
  return this.fs().mkdirSync(dirPath, { recursive: true });
3238
3235
  }
3239
3236
  return true;
3240
- },
3237
+ }
3241
3238
  read(filePath, defaultContent = ''){
3242
3239
  if (!this.exists(filePath)){
3243
3240
  return defaultContent;
3244
3241
  }
3245
3242
  return this.fs().readFileSync(filePath);
3246
- },
3243
+ }
3247
3244
  write(filePath, content){
3248
3245
  const dir = this.path().dirname(filePath);
3249
3246
  this.createDirectory(dir);
3250
3247
  this.fs().writeFileSync(filePath, content, 'utf8', function(err){
3251
3248
  if (err) throw err;
3252
3249
  });
3253
- },
3250
+ }
3254
3251
  getFilesListFromDir (dir) {
3255
3252
  const filesList = [];
3256
3253
  this.fs().readdirSync(dir, (err, files) => {
@@ -3259,14 +3256,14 @@ function PUVOX_LIBRARY() { return {
3259
3256
  });
3260
3257
  });
3261
3258
  return filesList;
3262
- },
3263
- },
3259
+ }
3260
+ })();
3264
3261
 
3265
3262
  catchUnhandledExceptions (callback) {
3266
3263
  process.on('uncaughtException', (e) => { callback(e, "exc-uncaught"); });
3267
3264
  process.on('unhandledRejection', (e) => { callback(e, "uexc-nhandled"); });
3268
3265
  process.on('warning', e=>{ callback(e, "exc-warning"); });
3269
- },
3266
+ }
3270
3267
 
3271
3268
 
3272
3269
 
@@ -3283,32 +3280,32 @@ function PUVOX_LIBRARY() { return {
3283
3280
 
3284
3281
  // region: ####### from CCXT ##########
3285
3282
  // generic
3286
- keys: Object.keys,
3287
- values(x) { return ((!this.isArray (x)) ? Object.values (x) : x);},
3288
- extend(...args) { return Object.assign ({}, ...args) ;}, // NB: side-effect free
3289
- clone(x){ return (this.isArray (x) ? Array.from (x) : this.extend (x)) ;},
3290
- index(x) { return new Set (this.values (x));},
3291
- ordered(x) { return x;}, // a stub to keep assoc keys in order (in JS it does nothing, it's mostly for Python)
3292
- unique(x) { return Array.from (this.index (x));},
3293
- arrayConcat (a, b) { return a.concat (b);},
3283
+ keys= Object.keys;
3284
+ values(x) { return ((!this.isArray (x)) ? Object.values (x) : x);}
3285
+ extend(...args) { return Object.assign ({}, ...args) ;} // NB: side-effect free
3286
+ clone(x){ return (this.isArray (x) ? Array.from (x) : this.extend (x)) ;}
3287
+ index(x) { return new Set (this.values (x));}
3288
+ ordered(x) { return x;} // a stub to keep assoc keys in order (in JS it does nothing, it's mostly for Python)
3289
+ unique(x) { return Array.from (this.index (x));}
3290
+ arrayConcat (a, b) { return a.concat (b);}
3294
3291
  inArray (needle, haystack) {
3295
3292
  return haystack.includes (needle);
3296
- },
3293
+ }
3297
3294
  toArray (object) {
3298
3295
  return Object.values (object);
3299
- },
3296
+ }
3300
3297
  isEmpty (object) {
3301
3298
  if (!object) {
3302
3299
  return true;
3303
3300
  }
3304
3301
  return (Array.isArray (object) ? object : Object.keys (object)).length < 1;
3305
- },
3302
+ }
3306
3303
  keysort (x, out = {}) {
3307
3304
  for (const k of this.keys (x).sort ()) {
3308
3305
  out[k] = x[k];
3309
3306
  }
3310
3307
  return out;
3311
- },
3308
+ }
3312
3309
  indexBy (x, k, out = {}) {
3313
3310
  // description: https://github.com/ccxt/ccxt/blob/master/js/base/functions/generic.js
3314
3311
  for (const v of this.values (x)) {
@@ -3318,7 +3315,7 @@ function PUVOX_LIBRARY() { return {
3318
3315
  }
3319
3316
 
3320
3317
  return out;
3321
- },
3318
+ }
3322
3319
  groupBy (x, k, out = {}) {
3323
3320
  // description: https://github.com/ccxt/ccxt/blob/master/js/base/functions/generic.js
3324
3321
  for (const v of this.values (x)) {
@@ -3329,7 +3326,7 @@ function PUVOX_LIBRARY() { return {
3329
3326
  }
3330
3327
  }
3331
3328
  return out;
3332
- },
3329
+ }
3333
3330
  filterBy (x, k, value = undefined, out = []) {
3334
3331
  // description: https://github.com/ccxt/ccxt/blob/master/js/base/functions/generic.js
3335
3332
  for (const v of this.values (x)) {
@@ -3338,7 +3335,7 @@ function PUVOX_LIBRARY() { return {
3338
3335
  }
3339
3336
  }
3340
3337
  return out;
3341
- },
3338
+ }
3342
3339
  sortBy (array, key, descending = false, direction = descending ? -1 : 1) {
3343
3340
  return array.sort ((a, b) => {
3344
3341
  if (a[key] < b[key]) {
@@ -3349,7 +3346,7 @@ function PUVOX_LIBRARY() { return {
3349
3346
  return 0;
3350
3347
  }
3351
3348
  });
3352
- },
3349
+ }
3353
3350
  sortBy2 (array, key1, key2, descending = false, direction = descending ? -1 : 1) {
3354
3351
  return array.sort ((a, b) => {
3355
3352
  if (a[key1] < b[key1]) {
@@ -3366,7 +3363,7 @@ function PUVOX_LIBRARY() { return {
3366
3363
  }
3367
3364
  }
3368
3365
  });
3369
- },
3366
+ }
3370
3367
  flatten (x, out = []) {
3371
3368
  for (const v of x) {
3372
3369
  if (this.isArray (v)) {
@@ -3376,8 +3373,8 @@ function PUVOX_LIBRARY() { return {
3376
3373
  }
3377
3374
  }
3378
3375
  return out;
3379
- },
3380
- pluck(x, k) { return this.values (x).filter ((v) => k in v).map ((v) => v[k]);},
3376
+ }
3377
+ pluck(x, k) { return this.values (x).filter ((v) => k in v).map ((v) => v[k]);}
3381
3378
  omit (x, ...args) {
3382
3379
  if (!Array.isArray (x)) {
3383
3380
  const out = this.clone (x);
@@ -3393,11 +3390,11 @@ function PUVOX_LIBRARY() { return {
3393
3390
  return out;
3394
3391
  }
3395
3392
  return x;
3396
- },
3393
+ }
3397
3394
  sum (...xs) {
3398
3395
  const ns = xs.filter (isNumber); // leave only numbers
3399
3396
  return (ns.length > 0) ? ns.reduce ((a, b) => a + b, 0) : undefined;
3400
- },
3397
+ }
3401
3398
  deepExtend(...xs) {
3402
3399
  let out = undefined;
3403
3400
  for (const x of xs) {
@@ -3413,22 +3410,21 @@ function PUVOX_LIBRARY() { return {
3413
3410
  }
3414
3411
  }
3415
3412
  return out;
3416
- },
3413
+ }
3417
3414
  // type
3418
- isNumber: Number.isFinite,
3419
- isInteger: Number.isInteger,
3420
- isArray: Array.isArray,
3421
- hasProps (o){ return ((o !== undefined) && (o !== null));},
3422
- isString (s){ return (typeof s === 'string');},
3423
- isObject (o){ return ((o !== null) && (typeof o === 'object'));},
3424
- isRegExp (o){ return (o instanceof RegExp);},
3425
- isDictionary(o ){return (this.isObject (o) && (Object.getPrototypeOf (o) === Object.prototype) && !this.isArray (o) && !this.isRegExp (o));},
3426
- isStringCoercible(x){ return ((this.hasProps (x) && x.toString) || this.isNumber (x));},
3427
- prop (o, k) { return (this.isObject (o) && o[k] !== '' && o[k] !== null ? o[k] : undefined);},
3428
- getValueFromKeysInArray(object, array) { return object[array.find (k => this.prop (object,k) !== undefined)];},
3415
+ isNumber= Number.isFinite;
3416
+ isInteger= Number.isInteger;
3417
+ isArray= Array.isArray;
3418
+ hasProps (o){ return ((o !== undefined) && (o !== null));}
3419
+ isString (s){ return (typeof s === 'string');}
3420
+ isObject (o){ return ((o !== null) && (typeof o === 'object'));}
3421
+ isRegExp (o){ return (o instanceof RegExp);}
3422
+ isDictionary(o ){return (this.isObject (o) && (Object.getPrototypeOf (o) === Object.prototype) && !this.isArray (o) && !this.isRegExp (o));}
3423
+ isStringCoercible(x){ return ((this.hasProps (x) && x.toString) || this.isNumber (x));}
3424
+ prop (o, k) { return (this.isObject (o) && o[k] !== '' && o[k] !== null ? o[k] : undefined);}
3425
+ getValueFromKeysInArray(object, array) { return object[array.find (k => this.prop (object,k) !== undefined)];}
3429
3426
  asFloat (x) { return ((this.isNumber (x) || (this.isString (x) && x.length !== 0)) ? parseFloat (x) : NaN);}
3430
- ,
3431
- asInteger(x) { return ((this.isNumber (x) || (this.isString (x) && x.length !== 0)) ? Math.trunc (Number(x)) : NaN);},
3427
+ asInteger(x) { return ((this.isNumber (x) || (this.isString (x) && x.length !== 0)) ? Math.trunc (Number(x)) : NaN);}
3432
3428
  // safeFloat:(o, k, $default, n = asFloat (prop (o, k))) => (this.isNumber (n) ? n : $default),
3433
3429
  // safeInteger: (o, k, $default, n = asInteger (prop (o, k))) => (this.isNumber (n) ? n : $default),
3434
3430
  // safeTimestamp: (o, k, $default, n = asFloat (prop (o, k))) => (isNumber (n) ? parseInt (n * 1000) : $default),
@@ -3451,62 +3447,61 @@ function PUVOX_LIBRARY() { return {
3451
3447
  else if (unit === 's') { scale = 1; }
3452
3448
  else { throw new NotSupported ('timeframe unit ' + unit + ' is not supported'); }
3453
3449
  return amount * scale;
3454
- },
3450
+ }
3455
3451
  roundTimeframe(timeframe, timestamp, direction = ROUND_DOWN) {
3456
3452
  const ms = this.parseTimeframe (timeframe) * 1000
3457
3453
  // Get offset based on timeframe in milliseconds
3458
3454
  const offset = timestamp % ms
3459
3455
  return timestamp - offset + ((direction === ROUND_UP) ? ms : 0);
3460
- },
3461
- json(data, params = undefined) { return JSON.stringify (data); },
3456
+ }
3457
+ json(data, params = undefined) { return JSON.stringify (data); }
3462
3458
  isJsonEncodedObject (object) {
3463
3459
  return (
3464
3460
  (typeof object === 'string') &&
3465
3461
  (object.length >= 2) &&
3466
3462
  ((object[0] === '{') || (object[0] === '['))
3467
3463
  );
3468
- },
3464
+ }
3469
3465
  //htmlentities
3470
3466
  encode_html_entities (content) {
3471
3467
  return content.replace(/[\u00A0-\u9999<>\&]/g, function(i) {
3472
3468
  return '&#'+i.charCodeAt(0)+';';
3473
3469
  });
3474
- },
3470
+ }
3475
3471
  // number
3476
3472
  precisionFromString (string) {
3477
3473
  const split = string.replace (/0+$/g, '').split ('.')
3478
3474
  return (split.length > 1) ? (split[1].length) : 0
3479
- },
3475
+ }
3480
3476
  numberToString (x) { // avoids scientific notation for too large and too small numbers
3481
3477
  if (x === undefined) return undefined; if (typeof x !== 'number') return x.toString (); const s = x.toString (); if (Math.abs (x) < 1.0) { const n_e = s.split ('e-'); const n = n_e[0].replace ('.', ''); const e = parseInt (n_e[1]); const neg = (s[0] === '-'); if (e) { x = (neg ? '-' : '') + '0.' + (new Array (e)).join ('0') + n.substring (neg); return x; } } else { const parts = s.split ('e'); if (parts[1]) { let e = parseInt (parts[1]); const m = parts[0].split ('.'); let part = ''; if (m[1]) { e -= m[1].length; part = m[1]; } return m[0] + part + (new Array (e + 1)).join ('0'); } } return s;
3482
- },
3478
+ }
3483
3479
  // platform
3484
- isBrowser: typeof window !== 'undefined',
3485
- isElectron: typeof process !== 'undefined' && typeof process.versions !== 'undefined' && typeof process.versions.electron !== 'undefined',
3486
- isWebWorker: typeof WorkerGlobalScope !== 'undefined' && (self instanceof WorkerGlobalScope),
3487
- isWindows: typeof process !== 'undefined' && process.platform === "win32",
3480
+ isBrowser=typeof window !== 'undefined';
3481
+ isElectron= typeof process !== 'undefined' && typeof process.versions !== 'undefined' && typeof process.versions.electron !== 'undefined';
3482
+ isWebWorker= typeof WorkerGlobalScope !== 'undefined' && (self instanceof WorkerGlobalScope);
3483
+ isWindows= typeof process !== 'undefined' && process.platform === "win32";
3488
3484
  // isNode when it's not browser, neither webworker
3489
- isNode: typeof window === 'undefined' && !(typeof WorkerGlobalScope !== 'undefined' && (self instanceof WorkerGlobalScope)),
3490
- defaultFetch: fetch,
3485
+ isNode= typeof window === 'undefined' && !(typeof WorkerGlobalScope !== 'undefined' && (self instanceof WorkerGlobalScope));
3486
+ defaultFetch=fetch;
3491
3487
  //string
3492
- uuid (a) { return a ? (a ^ Math.random () * 16 >> a / 4).toString (16) : ([1e7]+-1e3+-4e3+-8e3+-1e11).replace (/[018]/g, uuid);},
3493
- capitalize (s) {return s.length ? (s.charAt (0).toUpperCase () + s.slice (1)) : s;},
3494
- strip (s) { return s.replace(/^\s+|\s+$/g, '');},
3488
+ uuid (a) { return a ? (a ^ Math.random () * 16 >> a / 4).toString (16) : ([1e7]+-1e3+-4e3+-8e3+-1e11).replace (/[018]/g, uuid);}
3489
+ capitalize (s) {return s.length ? (s.charAt (0).toUpperCase () + s.slice (1)) : s;}
3490
+ strip (s) { return s.replace(/^\s+|\s+$/g, '');}
3495
3491
  // time
3496
- now : Date.now,
3497
- milliseconds: Date.now, // milliseconds(){ return (new Date().getTime()); },
3498
- seconds() { return Math.floor (Date.now () / 1000);},
3492
+ now = Date.now;
3493
+ milliseconds=Date.now; // milliseconds(){ return (new Date().getTime()); },
3494
+ seconds() { return Math.floor (Date.now () / 1000);}
3499
3495
  // endregion: ####### from CCXT ##########
3500
-
3501
- }; }
3496
+ }
3502
3497
 
3503
3498
 
3504
3499
  // export to outside world
3505
3500
  if (typeof module != 'undefined' && module.hasOwnProperty('exports')) {
3506
- module.exports = PUVOX_LIBRARY;
3501
+ module.exports = PuvoxLibrary;
3507
3502
  }
3508
3503
  if (typeof window != 'undefined') {
3509
- window['PuvoxLibrary'] = PUVOX_LIBRARY;
3504
+ window['PuvoxLibrary'] = PuvoxLibrary;
3510
3505
  }
3511
3506
 
3512
3507
  // export default puvox_library;