@bbn/bbn 1.0.117 → 1.0.119

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 (245) hide show
  1. package/dist/$.js +1 -1
  2. package/dist/_.js +11 -7
  3. package/dist/bundle-webpack.js +77 -0
  4. package/dist/bundle-webpack.js.map +1 -0
  5. package/dist/bundle.js +13374 -9875
  6. package/dist/bundle.js.map +1 -0
  7. package/dist/db.js +82 -81
  8. package/dist/env.js +1 -1
  9. package/dist/fn/ajax/_addLoader.js +6 -6
  10. package/dist/fn/ajax/_deleteLoader.js +16 -14
  11. package/dist/fn/ajax/abort.js +3 -3
  12. package/dist/fn/ajax/abortURL.js +4 -4
  13. package/dist/fn/ajax/ajax.js +36 -31
  14. package/dist/fn/ajax/callback.js +14 -10
  15. package/dist/fn/ajax/download.js +15 -13
  16. package/dist/fn/ajax/downloadContent.js +10 -9
  17. package/dist/fn/ajax/getLoader.js +3 -3
  18. package/dist/fn/ajax/getRequestId.js +5 -5
  19. package/dist/fn/ajax/link.js +20 -16
  20. package/dist/fn/ajax/post.js +10 -6
  21. package/dist/fn/ajax/postOut.js +7 -5
  22. package/dist/fn/ajax/setNavigationVars.js +11 -9
  23. package/dist/fn/ajax/treatAjaxArguments.js +8 -8
  24. package/dist/fn/ajax/upload.js +11 -8
  25. package/dist/fn/browser/copy.js +10 -8
  26. package/dist/fn/browser/eraseCookie.js +1 -1
  27. package/dist/fn/browser/error.js +4 -4
  28. package/dist/fn/browser/getBrowserName.js +2 -2
  29. package/dist/fn/browser/getBrowserVersion.js +2 -2
  30. package/dist/fn/browser/getCookie.js +6 -6
  31. package/dist/fn/browser/getDeviceType.js +2 -2
  32. package/dist/fn/browser/getEventData.js +33 -33
  33. package/dist/fn/browser/happy.js +6 -2
  34. package/dist/fn/browser/history.js +1 -1
  35. package/dist/fn/browser/info.js +6 -2
  36. package/dist/fn/browser/isActiveInterface.js +3 -2
  37. package/dist/fn/browser/isDesktopDevice.js +2 -2
  38. package/dist/fn/browser/isFocused.js +2 -1
  39. package/dist/fn/browser/isMobile.js +3 -3
  40. package/dist/fn/browser/isMobileDevice.js +2 -2
  41. package/dist/fn/browser/isTabletDevice.js +2 -2
  42. package/dist/fn/browser/log.js +13 -9
  43. package/dist/fn/browser/replaceSelection.js +6 -6
  44. package/dist/fn/browser/selectElementText.js +5 -4
  45. package/dist/fn/browser/setCookie.js +4 -4
  46. package/dist/fn/browser/toggleFullScreen.js +2 -2
  47. package/dist/fn/browser/warning.js +4 -4
  48. package/dist/fn/convert/arrayBuffer2String.js +1 -1
  49. package/dist/fn/convert/canvasToImage.js +2 -2
  50. package/dist/fn/convert/colorToHex.js +2 -2
  51. package/dist/fn/convert/fromXml.js +14 -8
  52. package/dist/fn/convert/hex2rgb.js +1 -1
  53. package/dist/fn/convert/imageToCanvas.js +2 -2
  54. package/dist/fn/convert/imgToBase64.js +4 -3
  55. package/dist/fn/convert/rgb2hex.js +1 -1
  56. package/dist/fn/convert/string2ArrayBuffer.js +1 -1
  57. package/dist/fn/convert/toCSV.js +13 -10
  58. package/dist/fn/datetime/calendar.js +11 -10
  59. package/dist/fn/datetime/chrono.js +9 -9
  60. package/dist/fn/datetime/date.js +5 -5
  61. package/dist/fn/datetime/dateSQL.d.ts +1 -1
  62. package/dist/fn/datetime/dateSQL.js +4 -4
  63. package/dist/fn/datetime/daysInMonth.js +3 -3
  64. package/dist/fn/datetime/fdate.js +7 -6
  65. package/dist/fn/datetime/fdatetime.js +6 -5
  66. package/dist/fn/datetime/formatDate.js +1 -1
  67. package/dist/fn/datetime/ftime.js +5 -5
  68. package/dist/fn/datetime/getDay.js +5 -5
  69. package/dist/fn/datetime/timestamp.js +3 -2
  70. package/dist/fn/default/defaultAjaxAbortFunction.js +3 -2
  71. package/dist/fn/default/defaultAjaxErrorFunction.js +4 -2
  72. package/dist/fn/default/defaultAlertFunction.js +2 -1
  73. package/dist/fn/default/defaultConfirmFunction.js +4 -3
  74. package/dist/fn/default/defaultEndLoadingFunction.js +3 -1
  75. package/dist/fn/default/defaultErrorFunction.js +2 -2
  76. package/dist/fn/default/defaultHistoryFunction.js +1 -1
  77. package/dist/fn/default/defaultLinkFunction.js +1 -1
  78. package/dist/fn/default/defaultPostLinkFunction.js +2 -1
  79. package/dist/fn/default/defaultPreLinkFunction.js +4 -2
  80. package/dist/fn/default/defaultResizeFunction.js +1 -1
  81. package/dist/fn/default/defaultStartLoadingFunction.js +3 -1
  82. package/dist/fn/form/addInputs.js +13 -11
  83. package/dist/fn/form/fieldValue.js +2 -2
  84. package/dist/fn/form/formdata.js +29 -29
  85. package/dist/fn/form/objectToFormData.js +13 -10
  86. package/dist/fn/form/submit.js +5 -5
  87. package/dist/fn/html/adjustHeight.js +4 -4
  88. package/dist/fn/html/adjustSize.js +7 -7
  89. package/dist/fn/html/adjustWidth.js +4 -4
  90. package/dist/fn/html/getAllTags.js +3 -3
  91. package/dist/fn/html/getAncestors.js +3 -2
  92. package/dist/fn/html/getAttributes.js +4 -4
  93. package/dist/fn/html/getHTMLOfSelection.js +6 -6
  94. package/dist/fn/html/getHtml.js +4 -3
  95. package/dist/fn/html/getPath.js +24 -17
  96. package/dist/fn/html/getText.js +1 -1
  97. package/dist/fn/html/html2text.js +2 -2
  98. package/dist/fn/html/isInside.js +9 -9
  99. package/dist/fn/html/makeReactive.js +35 -31
  100. package/dist/fn/html/selector.js +1 -1
  101. package/dist/fn/init.js +28 -28
  102. package/dist/fn/loop/each.js +6 -6
  103. package/dist/fn/loop/fori.js +7 -5
  104. package/dist/fn/loop/forir.js +7 -5
  105. package/dist/fn/loop/iterate.js +7 -4
  106. package/dist/fn/loop/riterate.js +3 -2
  107. package/dist/fn/misc/analyzeFunction.js +30 -30
  108. package/dist/fn/misc/getTimeoff.js +1 -1
  109. package/dist/fn/misc/money.js +6 -6
  110. package/dist/fn/misc/percent.js +1 -1
  111. package/dist/fn/misc/randomInt.js +1 -1
  112. package/dist/fn/misc/roundDecimal.js +1 -1
  113. package/dist/fn/misc/translate.js +4 -4
  114. package/dist/fn/object/_compareValues.js +7 -6
  115. package/dist/fn/object/arrayFromProp.js +5 -5
  116. package/dist/fn/object/autoExtend.js +2 -2
  117. package/dist/fn/object/checkProps.js +3 -2
  118. package/dist/fn/object/checkPropsDetails.js +13 -12
  119. package/dist/fn/object/checkPropsOrDie.js +4 -3
  120. package/dist/fn/object/circularReplacer.js +6 -6
  121. package/dist/fn/object/clone.js +6 -6
  122. package/dist/fn/object/compare.js +6 -6
  123. package/dist/fn/object/compareConditions.js +11 -11
  124. package/dist/fn/object/count.js +4 -2
  125. package/dist/fn/object/createObject.js +17 -4
  126. package/dist/fn/object/deepPath.js +10 -9
  127. package/dist/fn/object/deleteProp.js +2 -2
  128. package/dist/fn/object/diffObj.js +19 -17
  129. package/dist/fn/object/extend.js +17 -13
  130. package/dist/fn/object/extendOut.js +10 -5
  131. package/dist/fn/object/filter.d.ts +1 -1
  132. package/dist/fn/object/filter.js +12 -10
  133. package/dist/fn/object/filterToConditions.js +10 -9
  134. package/dist/fn/object/findAll.js +8 -7
  135. package/dist/fn/object/getField.js +6 -3
  136. package/dist/fn/object/getFieldValues.js +6 -6
  137. package/dist/fn/object/getProp.js +2 -2
  138. package/dist/fn/object/getProperty.js +2 -2
  139. package/dist/fn/object/getRow.js +4 -2
  140. package/dist/fn/object/map.js +4 -3
  141. package/dist/fn/object/move.js +2 -2
  142. package/dist/fn/object/multiorder.js +8 -7
  143. package/dist/fn/object/numProperties.js +1 -1
  144. package/dist/fn/object/order.js +3 -2
  145. package/dist/fn/object/pickValue.js +1 -1
  146. package/dist/fn/object/removeEmpty.js +6 -6
  147. package/dist/fn/object/removePrivateProp.js +4 -3
  148. package/dist/fn/object/search.d.ts +1 -1
  149. package/dist/fn/object/search.js +15 -12
  150. package/dist/fn/object/setProp.js +3 -1
  151. package/dist/fn/object/setProperty.js +10 -10
  152. package/dist/fn/object/shortenObj.js +8 -7
  153. package/dist/fn/object/shuffle.js +4 -3
  154. package/dist/fn/object/sum.js +6 -6
  155. package/dist/fn/object/unique.js +1 -1
  156. package/dist/fn/string/baseName.js +6 -6
  157. package/dist/fn/string/br2nl.js +2 -2
  158. package/dist/fn/string/camelToCss.js +1 -1
  159. package/dist/fn/string/camelize.js +1 -1
  160. package/dist/fn/string/correctCase.js +2 -2
  161. package/dist/fn/string/crc32.js +8 -8
  162. package/dist/fn/string/dirName.js +4 -4
  163. package/dist/fn/string/escapeDquotes.js +2 -2
  164. package/dist/fn/string/escapeRegExp.js +1 -1
  165. package/dist/fn/string/escapeSquotes.js +2 -2
  166. package/dist/fn/string/escapeTicks.js +2 -2
  167. package/dist/fn/string/escapeUrl.js +11 -11
  168. package/dist/fn/string/fileExt.js +3 -3
  169. package/dist/fn/string/format.js +6 -6
  170. package/dist/fn/string/formatBytes.js +3 -2
  171. package/dist/fn/string/formatSize.js +3 -3
  172. package/dist/fn/string/hash.js +9 -9
  173. package/dist/fn/string/md5.js +1 -1
  174. package/dist/fn/string/nl2br.js +2 -2
  175. package/dist/fn/string/printf.js +1 -1
  176. package/dist/fn/string/quotes2html.js +2 -2
  177. package/dist/fn/string/randomString.js +7 -7
  178. package/dist/fn/string/removeAccents.js +3 -3
  179. package/dist/fn/string/removeExtraSpaces.js +1 -1
  180. package/dist/fn/string/removeHtmlComments.js +2 -2
  181. package/dist/fn/string/removeTrailingChars.js +2 -2
  182. package/dist/fn/string/repeat.js +1 -1
  183. package/dist/fn/string/replaceAll.js +4 -3
  184. package/dist/fn/string/sanitize.js +9 -8
  185. package/dist/fn/string/shorten.js +3 -3
  186. package/dist/fn/string/simpleHash.js +5 -5
  187. package/dist/fn/string/simpleHash1.js +4 -4
  188. package/dist/fn/string/simpleHash2.js +4 -4
  189. package/dist/fn/string/substr.js +4 -4
  190. package/dist/fn/string/trim.js +3 -2
  191. package/dist/fn/string/uniqString.js +17 -10
  192. package/dist/fn/style/addColors.js +17 -17
  193. package/dist/fn/style/addStyle.js +4 -4
  194. package/dist/fn/style/animateCss.js +4 -4
  195. package/dist/fn/style/center.js +2 -2
  196. package/dist/fn/style/cssExists.js +8 -8
  197. package/dist/fn/style/getCssVar.js +1 -1
  198. package/dist/fn/style/getScrollBarSize.js +6 -6
  199. package/dist/fn/style/lightenDarkenHex.js +3 -3
  200. package/dist/fn/style/outerHeight.js +4 -4
  201. package/dist/fn/style/outerWidth.js +4 -4
  202. package/dist/fn/style/resize.js +17 -17
  203. package/dist/fn/style/setCssVar.js +1 -1
  204. package/dist/fn/type/checkType.js +16 -12
  205. package/dist/fn/type/isArray.js +7 -2
  206. package/dist/fn/type/isBlob.js +7 -2
  207. package/dist/fn/type/isBoolean.js +7 -2
  208. package/dist/fn/type/isCanvas.js +7 -2
  209. package/dist/fn/type/isColor.js +8 -3
  210. package/dist/fn/type/isComment.js +7 -2
  211. package/dist/fn/type/isCp.js +9 -4
  212. package/dist/fn/type/isDate.js +7 -2
  213. package/dist/fn/type/isDimension.js +8 -3
  214. package/dist/fn/type/isDom.js +7 -2
  215. package/dist/fn/type/isEmail.js +9 -4
  216. package/dist/fn/type/isEmpty.js +3 -3
  217. package/dist/fn/type/isEvent.js +7 -2
  218. package/dist/fn/type/isFunction.js +7 -2
  219. package/dist/fn/type/isHostname.js +9 -4
  220. package/dist/fn/type/isIP.js +8 -3
  221. package/dist/fn/type/isInt.js +7 -2
  222. package/dist/fn/type/isIterable.js +7 -2
  223. package/dist/fn/type/isNull.js +7 -2
  224. package/dist/fn/type/isNumber.js +7 -2
  225. package/dist/fn/type/isObject.js +7 -2
  226. package/dist/fn/type/isPercent.js +7 -2
  227. package/dist/fn/type/isPrimitive.js +7 -2
  228. package/dist/fn/type/isPromise.js +7 -2
  229. package/dist/fn/type/isPropSize.js +4 -4
  230. package/dist/fn/type/isSQLDate.js +7 -2
  231. package/dist/fn/type/isSame.js +9 -9
  232. package/dist/fn/type/isString.js +7 -2
  233. package/dist/fn/type/isSymbol.js +7 -2
  234. package/dist/fn/type/isURL.js +7 -2
  235. package/dist/fn/type/isValidDimension.js +5 -5
  236. package/dist/fn/type/isValidName.js +8 -3
  237. package/dist/fn/type/isValue.js +8 -3
  238. package/dist/fn/type/isVue.js +11 -4
  239. package/dist/fn.d.ts +1 -1
  240. package/dist/fn.js +456 -456
  241. package/dist/index.d.ts +5 -5
  242. package/dist/index.js +1241 -920
  243. package/dist/lng.js +1 -1
  244. package/dist/vars.js +1 -1
  245. package/package.json +8 -5
@@ -1,4 +1,4 @@
1
- import { search } from "../object/search.js";
1
+ import { search } from '../object/search.js';
2
2
  /**
3
3
  * Finds the loader object corresponding to the given unique ID and returns it if found.
4
4
  *
@@ -34,8 +34,8 @@ import { search } from "../object/search.js";
34
34
  *
35
35
  * @returns {null|Object} The corresponding loader Object if it exists, false otherwise
36
36
  */
37
- const getLoader = function (requestId) {
38
- let idx = search(bbn.env.loaders, { key: requestId });
37
+ var getLoader = function (requestId) {
38
+ var idx = search(bbn.env.loaders, { key: requestId });
39
39
  if (idx > -1) {
40
40
  return bbn.env.loaders[idx];
41
41
  }
@@ -1,5 +1,5 @@
1
- import { iterate } from "../loop/iterate.js";
2
- import { md5 } from "../string/md5.js";
1
+ import { iterate } from '../loop/iterate.js';
2
+ import { md5 } from '../string/md5.js';
3
3
  /**
4
4
  * Returns a unique ID for a "loader" based on the URL, the data keys and the datatype.
5
5
  *
@@ -48,10 +48,10 @@ import { md5 } from "../string/md5.js";
48
48
  *
49
49
  * @returns {String} The unique ID
50
50
  */
51
- const getRequestId = function (url, data, datatype) {
52
- let d = {};
51
+ var getRequestId = function (url, data, datatype) {
52
+ var d = {};
53
53
  if (data) {
54
- iterate(data, (a, n) => {
54
+ iterate(data, function (a, n) {
55
55
  if (n.indexOf('_bbn') === -1) {
56
56
  d[n] = a;
57
57
  }
@@ -1,11 +1,11 @@
1
- import { treatAjaxArguments } from "./treatAjaxArguments.js";
2
- import { getLoader } from "./getLoader.js";
3
- import { ajax } from "./ajax.js";
4
- import { log } from "../browser/log.js";
5
- import { extend } from "../object/extend.js";
6
- import { isObject } from "../type/isObject.js";
7
- import { callback } from "./callback.js";
8
- import { setNavigationVars } from "./setNavigationVars.js";
1
+ import { treatAjaxArguments } from './treatAjaxArguments.js';
2
+ import { getLoader } from './getLoader.js';
3
+ import { ajax } from './ajax.js';
4
+ import { log } from '../browser/log.js';
5
+ import { extend } from '../object/extend.js';
6
+ import { isObject } from '../type/isObject.js';
7
+ import { callback } from './callback.js';
8
+ import { setNavigationVars } from './setNavigationVars.js';
9
9
  /**
10
10
  * Follows a link and if needed by sending the corresponding Ajax request and executing bbn.fn.defaultPreLinkFunction.
11
11
  *
@@ -30,9 +30,13 @@ import { setNavigationVars } from "./setNavigationVars.js";
30
30
  *
31
31
  * @returns
32
32
  */
33
- const link = function (...args) {
34
- let cfg = treatAjaxArguments(args);
35
- let ok = 1;
33
+ var link = function () {
34
+ var args = [];
35
+ for (var _i = 0; _i < arguments.length; _i++) {
36
+ args[_i] = arguments[_i];
37
+ }
38
+ var cfg = treatAjaxArguments(args);
39
+ var ok = 1;
36
40
  /* If we can't find a correct link we load the current URL */
37
41
  if (!cfg) {
38
42
  return link(window.location.href);
@@ -60,7 +64,7 @@ const link = function (...args) {
60
64
  /* Mail link */
61
65
  bbn.env.ignoreUnload = true;
62
66
  window.location.href = cfg.url;
63
- setTimeout(() => {
67
+ setTimeout(function () {
64
68
  bbn.env.ignoreUnload = false;
65
69
  }, 0);
66
70
  return false;
@@ -84,7 +88,7 @@ const link = function (...args) {
84
88
  ok = cfg.successFn(cfg.url);
85
89
  }
86
90
  else if (bbn.fn.defaultPreLinkFunction) {
87
- let tmp = bbn.fn.defaultPreLinkFunction(cfg.url, cfg.force, cfg.ele);
91
+ var tmp = bbn.fn.defaultPreLinkFunction(cfg.url, cfg.force, cfg.ele);
88
92
  if (tmp.data !== undefined) {
89
93
  extend(cfg.obj, tmp.data);
90
94
  ok = 1;
@@ -95,15 +99,15 @@ const link = function (...args) {
95
99
  cfg.url = ok;
96
100
  }
97
101
  /** todo Do we keep obj in the unique string or do we make that only one concurrent connection to the same address can occur at the same time? */
98
- let errSt = bbn._('The Ajax call to') + ' ' + cfg.url + ' ';
102
+ var errSt_1 = bbn._('The Ajax call to') + ' ' + cfg.url + ' ';
99
103
  return ajax(cfg.url, cfg.datatype, cfg.obj, function (res) {
100
104
  if (!res) {
101
- log(errSt + bbn._('returned no answer'));
105
+ log(errSt_1 + bbn._('returned no answer'));
102
106
  }
103
107
  if (isObject(res)) {
104
108
  // If there's nothing in the result, just an empty object, the callback stops here and the URL is not changed
105
109
  if (Object.keys(res).length === 0) {
106
- log(errSt + bbn._('returned an empty object'));
110
+ log(errSt_1 + bbn._('returned an empty object'));
107
111
  }
108
112
  if (res.new_url) {
109
113
  res.old_path = cfg.url;
@@ -1,6 +1,6 @@
1
- import { treatAjaxArguments } from "./treatAjaxArguments.js";
2
- import { ajax } from "./ajax.js";
3
- import { callback } from "./callback.js";
1
+ import { treatAjaxArguments } from './treatAjaxArguments.js';
2
+ import { ajax } from './ajax.js';
3
+ import { callback } from './callback.js';
4
4
  /**
5
5
  * Creates a POST XHR through bbn.fn.ajax then launches bbn.fn.callback with the result.
6
6
  *
@@ -34,10 +34,14 @@ import { callback } from "./callback.js";
34
34
  *
35
35
  * @returns {undefined|Promise}
36
36
  */
37
- const post = function (...args) {
38
- let cfg = treatAjaxArguments(args);
37
+ var post = function () {
38
+ var args = [];
39
+ for (var _i = 0; _i < arguments.length; _i++) {
40
+ args[_i] = arguments[_i];
41
+ }
42
+ var cfg = treatAjaxArguments(args);
39
43
  if (cfg.url) {
40
- return ajax(cfg.url, cfg.datatype, cfg.obj, (res) => {
44
+ return ajax(cfg.url, cfg.datatype, cfg.obj, function (res) {
41
45
  callback(cfg.url, res, cfg.successFn, null, cfg.ele);
42
46
  }, cfg.errorFn, cfg.abortFn);
43
47
  }
@@ -1,6 +1,6 @@
1
- import { createObject } from "../object/createObject.js";
2
- import { addInputs } from "../form/addInputs.js";
3
- import { setProperty } from "../object/setProperty.js";
1
+ import { createObject } from '../object/createObject.js';
2
+ import { addInputs } from '../form/addInputs.js';
3
+ import { setProperty } from '../object/setProperty.js';
4
4
  /**
5
5
  * Posts a request in a new window.
6
6
  *
@@ -20,8 +20,10 @@ import { setProperty } from "../object/setProperty.js";
20
20
  *
21
21
  * @returns {void}
22
22
  */
23
- const postOut = function (url, data, success = null, target = "") {
24
- let form = document.body.querySelector("form#bbn-form_out");
23
+ var postOut = function (url, data, success, target) {
24
+ if (success === void 0) { success = null; }
25
+ if (target === void 0) { target = ""; }
26
+ var form = document.body.querySelector("form#bbn-form_out");
25
27
  if (!form) {
26
28
  form = document.createElement("form");
27
29
  form.classList.add("bbn-no");
@@ -1,7 +1,7 @@
1
- import { substr } from "../string/substr.js";
2
- import { filter } from "../object/filter.js";
3
- import { extend } from "../object/extend.js";
4
- import { html2text } from "../html/html2text.js";
1
+ import { substr } from '../string/substr.js';
2
+ import { filter } from '../object/filter.js';
3
+ import { extend } from '../object/extend.js';
4
+ import { html2text } from '../html/html2text.js';
5
5
  /**
6
6
  * Changes the URL and the associated variables and updates the history.
7
7
  *
@@ -25,7 +25,9 @@ import { html2text } from "../html/html2text.js";
25
25
  *
26
26
  * @returns {void}
27
27
  */
28
- const setNavigationVars = function (url, title, data = null, repl = false) {
28
+ var setNavigationVars = function (url, title, data, repl) {
29
+ if (data === void 0) { data = null; }
30
+ if (repl === void 0) { repl = false; }
29
31
  // Current path becomes old path
30
32
  bbn.env.old_path = bbn.env.path;
31
33
  // URL includes the domain
@@ -33,16 +35,16 @@ const setNavigationVars = function (url, title, data = null, repl = false) {
33
35
  // Path does not
34
36
  bbn.env.path = substr(bbn.env.url, bbn.env.root.length);
35
37
  // Params will include each part of the URL
36
- bbn.env.params = filter(bbn.env.path.split('/'), (v) => {
38
+ bbn.env.params = filter(bbn.env.path.split('/'), function (v) {
37
39
  return v !== '';
38
40
  });
39
41
  // Managing history
40
- let h = window.history;
42
+ var h = window.history;
41
43
  if (h) {
42
44
  // Current state
43
- let state = h.state;
45
+ var state = h.state;
44
46
  // Future state
45
- let obj = {
47
+ var obj = {
46
48
  url: bbn.env.path,
47
49
  old_path: bbn.env.old_path || null,
48
50
  data: data || {},
@@ -1,7 +1,7 @@
1
- import { isObject } from "../type/isObject.js";
2
- import { isFunction } from "../type/isFunction.js";
3
- import { substr } from "../string/substr.js";
4
- import { numProperties } from "../object/numProperties.js";
1
+ import { isObject } from '../type/isObject.js';
2
+ import { isFunction } from '../type/isFunction.js';
3
+ import { substr } from '../string/substr.js';
4
+ import { numProperties } from '../object/numProperties.js';
5
5
  /**
6
6
  * Transforms unordered arguments into a configuratiuon object for Ajax shortcut functions.
7
7
  *
@@ -53,10 +53,10 @@ import { numProperties } from "../object/numProperties.js";
53
53
  *
54
54
  * @returns {Object} The configuration object
55
55
  */
56
- const treatAjaxArguments = function (args) {
57
- let cfg = {};
58
- let t;
59
- let i;
56
+ var treatAjaxArguments = function (args) {
57
+ var cfg = {};
58
+ var t;
59
+ var i;
60
60
  if (isObject(args[0]) && args.length === 1) {
61
61
  return args[0];
62
62
  }
@@ -1,5 +1,5 @@
1
- import { objectToFormData } from "../form/objectToFormData.js";
2
- import { log } from "../browser/log.js";
1
+ import { objectToFormData } from '../form/objectToFormData.js';
2
+ import { log } from '../browser/log.js';
3
3
  /**
4
4
  * Uploads a file synchronously through an XHR indicating progress.
5
5
  *
@@ -16,15 +16,18 @@ import { log } from "../browser/log.js";
16
16
  *
17
17
  * @returns {Promise}
18
18
  */
19
- const upload = function (url, file, success = null, failure = null, progress = null) {
20
- let fn = () => {
19
+ var upload = function (url, file, success, failure, progress) {
20
+ if (success === void 0) { success = null; }
21
+ if (failure === void 0) { failure = null; }
22
+ if (progress === void 0) { progress = null; }
23
+ var fn = function () {
21
24
  return axios.post(url || bbn.env.path, objectToFormData(file), {
22
25
  headers: {
23
26
  'Content-Type': 'multipart/form-data',
24
27
  },
25
- onUploadProgress(progressEvent) {
28
+ onUploadProgress: function (progressEvent) {
26
29
  if (progress) {
27
- let percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total);
30
+ var percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total);
28
31
  progress(percentCompleted, progressEvent.loaded, progressEvent.total);
29
32
  }
30
33
  },
@@ -35,13 +38,13 @@ const upload = function (url, file, success = null, failure = null, progress = n
35
38
  }
36
39
  else {
37
40
  return fn()
38
- .then((res) => {
41
+ .then(function (res) {
39
42
  if (success) {
40
43
  log('SUCCESS', res);
41
44
  success(res);
42
45
  }
43
46
  })
44
- .catch((err) => {
47
+ .catch(function (err) {
45
48
  if (failure) {
46
49
  log('ERROR', err);
47
50
  failure(err);
@@ -1,5 +1,5 @@
1
- import { isObject } from "../type/isObject.js";
2
- import { isFunction } from "../type/isFunction.js";
1
+ import { isObject } from '../type/isObject.js';
2
+ import { isFunction } from '../type/isFunction.js';
3
3
  /**
4
4
  * Copies to the clipboard the value of the given string.
5
5
  * @method copy
@@ -13,18 +13,20 @@ import { isFunction } from "../type/isFunction.js";
13
13
  * @param {String} st The string to copy.
14
14
  * @returns
15
15
  */
16
- const copy = function (st) {
17
- return new Promise((resolve) => {
16
+ var copy = function (st) {
17
+ return new Promise(function (resolve) {
18
+ var _a;
18
19
  if (st) {
19
20
  if (navigator && navigator.clipboard) {
20
21
  if (st instanceof Blob) {
21
- navigator.clipboard.write([new ClipboardItem({ [st.type.toString()]: st })]).then(() => {
22
+ navigator.clipboard.write([new ClipboardItem((_a = {}, _a[st.type.toString()] = st, _a))]).then(function () {
22
23
  resolve(true);
23
24
  });
24
25
  }
25
26
  else if (isObject(st) && isFunction(st.toBlob)) {
26
- st.toBlob((blob) => {
27
- navigator.clipboard.write([new ClipboardItem({ [blob.type.toString()]: blob })]).then(() => {
27
+ st.toBlob(function (blob) {
28
+ var _a;
29
+ navigator.clipboard.write([new ClipboardItem((_a = {}, _a[blob.type.toString()] = blob, _a))]).then(function () {
28
30
  resolve(true);
29
31
  });
30
32
  });
@@ -35,7 +37,7 @@ const copy = function (st) {
35
37
  }
36
38
  return;
37
39
  }
38
- let input = document.createElement('textarea');
40
+ var input = document.createElement('textarea');
39
41
  input.style.opacity = '0';
40
42
  input.value = st;
41
43
  document.body.appendChild(input);
@@ -11,7 +11,7 @@
11
11
  * @memberof bbn.fn
12
12
  * @returns {*}
13
13
  */
14
- const eraseCookie = function (name) {
14
+ var eraseCookie = function (name) {
15
15
  document.cookie = name + '=; Max-Age=-99999999;';
16
16
  };
17
17
  export { eraseCookie };
@@ -1,4 +1,4 @@
1
- import { log } from "./log.js";
1
+ import { log } from './log.js';
2
2
  /**
3
3
  * Throws an error.
4
4
  * @method error
@@ -11,10 +11,10 @@ import { log } from "./log.js";
11
11
  * @param {String} errorMsg
12
12
  * @returns
13
13
  */
14
- const error = function (errorMsg) {
14
+ var error = function (errorMsg) {
15
15
  if (arguments.length > 1) {
16
- const args = [];
17
- for (let i = 1; i < arguments.length; i++) {
16
+ var args = [];
17
+ for (var i = 1; i < arguments.length; i++) {
18
18
  args.push(arguments[i]);
19
19
  }
20
20
  args.unshift({
@@ -5,8 +5,8 @@
5
5
  * @memberof bbn.fn
6
6
  * @returns {String}
7
7
  */
8
- const getBrowserName = function () {
9
- const userAgent = navigator.userAgent.toLowerCase();
8
+ var getBrowserName = function () {
9
+ var userAgent = navigator.userAgent.toLowerCase();
10
10
  switch (true) {
11
11
  case userAgent.includes('edge'):
12
12
  case userAgent.includes('edg/'):
@@ -5,8 +5,8 @@
5
5
  * @memberof bbn.fn
6
6
  * @returns {String}
7
7
  */
8
- const getBrowserVersion = function () {
9
- const userAgent = navigator.userAgent.toLowerCase();
8
+ var getBrowserVersion = function () {
9
+ var userAgent = navigator.userAgent.toLowerCase();
10
10
  switch (true) {
11
11
  case userAgent.includes('edge/'):
12
12
  return userAgent.split('edge/')[1].split(' ')[0];
@@ -12,16 +12,16 @@
12
12
  * @param {String} name
13
13
  * @returns
14
14
  */
15
- const getCookie = function (name) {
16
- let nameEqual = name + '=';
17
- let ca = document.cookie.split(';');
18
- for (let i = 0; i < ca.length; i++) {
19
- let c = ca[i];
15
+ var getCookie = function (name) {
16
+ var nameEqual = name + '=';
17
+ var ca = document.cookie.split(';');
18
+ for (var i = 0; i < ca.length; i++) {
19
+ var c = ca[i];
20
20
  while (c.charAt(0) == ' ') {
21
21
  c = c.substring(1, c.length);
22
22
  }
23
23
  if (c.indexOf(nameEqual) == 0) {
24
- let st = c.substring(nameEqual.length, c.length);
24
+ var st = c.substring(nameEqual.length, c.length);
25
25
  if (st) {
26
26
  return JSON.parse(unescape(st)).value;
27
27
  }
@@ -10,8 +10,8 @@
10
10
  * @memberof bbn.fn
11
11
  * @returns {String}
12
12
  */
13
- const getDeviceType = function () {
14
- const userAgent = navigator.userAgent.toLowerCase();
13
+ var getDeviceType = function () {
14
+ var userAgent = navigator.userAgent.toLowerCase();
15
15
  if (/iPhone|Android/i.test(navigator.userAgent)) {
16
16
  return 'mobile';
17
17
  }
@@ -1,5 +1,5 @@
1
- import { getHTMLOfSelection } from "../html/getHTMLOfSelection.js";
2
- import { each } from "../loop/each.js";
1
+ import { getHTMLOfSelection } from '../html/getHTMLOfSelection.js';
2
+ import { each } from '../loop/each.js';
3
3
  /**
4
4
  * Returns a promise having the event's data as argument.
5
5
  * @method getEventData
@@ -14,16 +14,16 @@ import { each } from "../loop/each.js";
14
14
  * @memberof bbn.fn
15
15
  * @returns {Promise}
16
16
  */
17
- const getEventData = function (e) {
18
- let dt = e.dataTransfer || e.clipboardData;
19
- let t = dt.getData('Text');
20
- let res = { raw: t, files: [], str: [] };
21
- let p = new Promise((ok, err) => {
22
- let done = !(dt instanceof DataTransfer);
17
+ var getEventData = function (e) {
18
+ var dt = e.dataTransfer || e.clipboardData;
19
+ var t = dt.getData('Text');
20
+ var res = { raw: t, files: [], str: [] };
21
+ var p = new Promise(function (ok, err) {
22
+ var done = !(dt instanceof DataTransfer);
23
23
  if (!t && e.type === 'copy') {
24
- let sel = window.getSelection();
24
+ var sel = window.getSelection();
25
25
  res.raw = sel.toString();
26
- let html = getHTMLOfSelection();
26
+ var html = getHTMLOfSelection();
27
27
  res.str.push({
28
28
  type: 'text/plain',
29
29
  data: res.raw,
@@ -46,57 +46,57 @@ const getEventData = function (e) {
46
46
  ok(res);
47
47
  }
48
48
  if (!done) {
49
- let strings = [];
50
- let num = dt.items.length;
51
- each(dt.items, (item, idx) => {
52
- let kind = item.kind;
53
- let type = item.type;
49
+ var strings_1 = [];
50
+ var num_1 = dt.items.length;
51
+ each(dt.items, function (item, idx) {
52
+ var kind = item.kind;
53
+ var type = item.type;
54
54
  if (kind === 'file') {
55
- let cp = dt.files[idx];
55
+ var cp = dt.files[idx];
56
56
  if (!type && cp.name) {
57
- let bits = cp.name.split('.');
57
+ var bits = cp.name.split('.');
58
58
  type = bits[bits.length - 1];
59
59
  }
60
- let name = cp ? cp.name : bbn._('untitled');
61
- let size = cp ? cp.size : null;
62
- let lastModified = cp ? cp.lastModified : null;
63
- let blob = item.getAsFile();
60
+ var name_1 = cp ? cp.name : bbn._('untitled');
61
+ var size = cp ? cp.size : null;
62
+ var lastModified = cp ? cp.lastModified : null;
63
+ var blob = item.getAsFile();
64
64
  if (blob) {
65
65
  done = true;
66
- num--;
66
+ num_1--;
67
67
  res.files.push({
68
68
  type: type,
69
69
  data: blob,
70
- name: name,
70
+ name: name_1,
71
71
  size: size,
72
72
  mdate: lastModified,
73
73
  });
74
- strings.push(name);
75
- if (!num) {
74
+ strings_1.push(name_1);
75
+ if (!num_1) {
76
76
  if (!res.raw) {
77
- res.raw = strings.join(', ');
77
+ res.raw = strings_1.join(', ');
78
78
  }
79
79
  ok(res);
80
80
  }
81
81
  }
82
82
  else {
83
- bbn.fn.defaultErrorFunction(bbn._('Impossible to read the file') + ' ' + name);
83
+ bbn.fn.defaultErrorFunction(bbn._('Impossible to read the file') + ' ' + name_1);
84
84
  }
85
85
  }
86
86
  else {
87
87
  done = true;
88
- item.getAsString((data) => {
89
- num--;
88
+ item.getAsString(function (data) {
89
+ num_1--;
90
90
  res.str.push({
91
91
  type: type,
92
92
  data: data,
93
93
  });
94
94
  if (type === 'text/plain') {
95
- strings.push(name);
95
+ strings_1.push(name);
96
96
  }
97
- if (!num) {
97
+ if (!num_1) {
98
98
  if (!res.raw) {
99
- res.raw = strings.join(', ');
99
+ res.raw = strings_1.join(', ');
100
100
  }
101
101
  ok(res);
102
102
  }
@@ -105,7 +105,7 @@ const getEventData = function (e) {
105
105
  });
106
106
  }
107
107
  if (!done) {
108
- setTimeout(() => {
108
+ setTimeout(function () {
109
109
  ok(res);
110
110
  });
111
111
  }
@@ -1,4 +1,4 @@
1
- import { log } from "./log.js";
1
+ import { log } from './log.js';
2
2
  /**
3
3
  * Logs the given argument in the browser's console highlighting it with a green background.
4
4
  * @method happy
@@ -11,7 +11,11 @@ import { log } from "./log.js";
11
11
  * @param {...any} args
12
12
  * @returns
13
13
  */
14
- const happy = function (...args) {
14
+ var happy = function () {
15
+ var args = [];
16
+ for (var _i = 0; _i < arguments.length; _i++) {
17
+ args[_i] = arguments[_i];
18
+ }
15
19
  args.unshift({
16
20
  _bbn_console_level: 3,
17
21
  _bbn_console_style: 'color: white; background: green; font-size: 18px;',
@@ -1,4 +1,4 @@
1
- const history = function () {
1
+ var history = function () {
2
2
  return window.history || false;
3
3
  };
4
4
  export { history };
@@ -1,4 +1,4 @@
1
- import { log } from "./log.js";
1
+ import { log } from './log.js';
2
2
  /**
3
3
  * Logs the given argument in the browser's console highlighting it with a blue background.
4
4
  * @method info
@@ -7,7 +7,11 @@ import { log } from "./log.js";
7
7
  * @param {...any} args
8
8
  * @returns {*}
9
9
  */
10
- const info = function (...args) {
10
+ var info = function () {
11
+ var args = [];
12
+ for (var _i = 0; _i < arguments.length; _i++) {
13
+ args[_i] = arguments[_i];
14
+ }
11
15
  args.unshift({
12
16
  //_bbn_console_mode: "info",
13
17
  _bbn_console_level: 4,
@@ -10,11 +10,12 @@
10
10
  * @memberof bbn.fn
11
11
  * @returns {Boolean}
12
12
  */
13
- const isActiveInterface = function (secs = 600) {
13
+ var isActiveInterface = function (secs) {
14
+ if (secs === void 0) { secs = 600; }
14
15
  if (!bbn.env.last_focus) {
15
16
  return false;
16
17
  }
17
- let t = new Date().getTime();
18
+ var t = new Date().getTime();
18
19
  return t - bbn.env.last_focus < secs * 1000;
19
20
  };
20
21
  export { isActiveInterface };
@@ -1,4 +1,4 @@
1
- import { getDeviceType } from "../browser/getDeviceType.js";
1
+ import { getDeviceType } from '../browser/getDeviceType.js';
2
2
  /**
3
3
  * Returns true if the current device type is a desktop.
4
4
  * @method isDesktopDevice
@@ -11,7 +11,7 @@ import { getDeviceType } from "../browser/getDeviceType.js";
11
11
  * @memberof bbn.fn
12
12
  * @returns {Boolean}
13
13
  */
14
- const isDesktopDevice = function () {
14
+ var isDesktopDevice = function () {
15
15
  return getDeviceType() === 'desktop';
16
16
  };
17
17
  export { isDesktopDevice };
@@ -17,7 +17,8 @@
17
17
  *
18
18
  * @returns {Boolean} True if focused
19
19
  */
20
- const isFocused = function (ele, contain = false) {
20
+ var isFocused = function (ele, contain) {
21
+ if (contain === void 0) { contain = false; }
21
22
  return ele === document.activeElement || (contain && ele.contains && ele.contains(document.activeElement));
22
23
  };
23
24
  export { isFocused };
@@ -1,5 +1,5 @@
1
- import { isMobileDevice } from "./isMobileDevice.js";
2
- import { isTabletDevice } from "./isTabletDevice.js";
1
+ import { isMobileDevice } from './isMobileDevice.js';
2
+ import { isTabletDevice } from './isTabletDevice.js';
3
3
  /**
4
4
  * Returns true if the current browser is on a mobile device (smartphone or tablet).
5
5
  * @method isMobile
@@ -12,7 +12,7 @@ import { isTabletDevice } from "./isTabletDevice.js";
12
12
  * @memberof bbn.fn
13
13
  * @returns {Boolean}
14
14
  */
15
- const isMobile = function () {
15
+ var isMobile = function () {
16
16
  return isMobileDevice() || isTabletDevice();
17
17
  };
18
18
  export { isMobile };