@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.
- package/dist/$.js +1 -1
- package/dist/_.js +11 -7
- package/dist/bundle-webpack.js +77 -0
- package/dist/bundle-webpack.js.map +1 -0
- package/dist/bundle.js +13374 -9875
- package/dist/bundle.js.map +1 -0
- package/dist/db.js +82 -81
- package/dist/env.js +1 -1
- package/dist/fn/ajax/_addLoader.js +6 -6
- package/dist/fn/ajax/_deleteLoader.js +16 -14
- package/dist/fn/ajax/abort.js +3 -3
- package/dist/fn/ajax/abortURL.js +4 -4
- package/dist/fn/ajax/ajax.js +36 -31
- package/dist/fn/ajax/callback.js +14 -10
- package/dist/fn/ajax/download.js +15 -13
- package/dist/fn/ajax/downloadContent.js +10 -9
- package/dist/fn/ajax/getLoader.js +3 -3
- package/dist/fn/ajax/getRequestId.js +5 -5
- package/dist/fn/ajax/link.js +20 -16
- package/dist/fn/ajax/post.js +10 -6
- package/dist/fn/ajax/postOut.js +7 -5
- package/dist/fn/ajax/setNavigationVars.js +11 -9
- package/dist/fn/ajax/treatAjaxArguments.js +8 -8
- package/dist/fn/ajax/upload.js +11 -8
- package/dist/fn/browser/copy.js +10 -8
- package/dist/fn/browser/eraseCookie.js +1 -1
- package/dist/fn/browser/error.js +4 -4
- package/dist/fn/browser/getBrowserName.js +2 -2
- package/dist/fn/browser/getBrowserVersion.js +2 -2
- package/dist/fn/browser/getCookie.js +6 -6
- package/dist/fn/browser/getDeviceType.js +2 -2
- package/dist/fn/browser/getEventData.js +33 -33
- package/dist/fn/browser/happy.js +6 -2
- package/dist/fn/browser/history.js +1 -1
- package/dist/fn/browser/info.js +6 -2
- package/dist/fn/browser/isActiveInterface.js +3 -2
- package/dist/fn/browser/isDesktopDevice.js +2 -2
- package/dist/fn/browser/isFocused.js +2 -1
- package/dist/fn/browser/isMobile.js +3 -3
- package/dist/fn/browser/isMobileDevice.js +2 -2
- package/dist/fn/browser/isTabletDevice.js +2 -2
- package/dist/fn/browser/log.js +13 -9
- package/dist/fn/browser/replaceSelection.js +6 -6
- package/dist/fn/browser/selectElementText.js +5 -4
- package/dist/fn/browser/setCookie.js +4 -4
- package/dist/fn/browser/toggleFullScreen.js +2 -2
- package/dist/fn/browser/warning.js +4 -4
- package/dist/fn/convert/arrayBuffer2String.js +1 -1
- package/dist/fn/convert/canvasToImage.js +2 -2
- package/dist/fn/convert/colorToHex.js +2 -2
- package/dist/fn/convert/fromXml.js +14 -8
- package/dist/fn/convert/hex2rgb.js +1 -1
- package/dist/fn/convert/imageToCanvas.js +2 -2
- package/dist/fn/convert/imgToBase64.js +4 -3
- package/dist/fn/convert/rgb2hex.js +1 -1
- package/dist/fn/convert/string2ArrayBuffer.js +1 -1
- package/dist/fn/convert/toCSV.js +13 -10
- package/dist/fn/datetime/calendar.js +11 -10
- package/dist/fn/datetime/chrono.js +9 -9
- package/dist/fn/datetime/date.js +5 -5
- package/dist/fn/datetime/dateSQL.d.ts +1 -1
- package/dist/fn/datetime/dateSQL.js +4 -4
- package/dist/fn/datetime/daysInMonth.js +3 -3
- package/dist/fn/datetime/fdate.js +7 -6
- package/dist/fn/datetime/fdatetime.js +6 -5
- package/dist/fn/datetime/formatDate.js +1 -1
- package/dist/fn/datetime/ftime.js +5 -5
- package/dist/fn/datetime/getDay.js +5 -5
- package/dist/fn/datetime/timestamp.js +3 -2
- package/dist/fn/default/defaultAjaxAbortFunction.js +3 -2
- package/dist/fn/default/defaultAjaxErrorFunction.js +4 -2
- package/dist/fn/default/defaultAlertFunction.js +2 -1
- package/dist/fn/default/defaultConfirmFunction.js +4 -3
- package/dist/fn/default/defaultEndLoadingFunction.js +3 -1
- package/dist/fn/default/defaultErrorFunction.js +2 -2
- package/dist/fn/default/defaultHistoryFunction.js +1 -1
- package/dist/fn/default/defaultLinkFunction.js +1 -1
- package/dist/fn/default/defaultPostLinkFunction.js +2 -1
- package/dist/fn/default/defaultPreLinkFunction.js +4 -2
- package/dist/fn/default/defaultResizeFunction.js +1 -1
- package/dist/fn/default/defaultStartLoadingFunction.js +3 -1
- package/dist/fn/form/addInputs.js +13 -11
- package/dist/fn/form/fieldValue.js +2 -2
- package/dist/fn/form/formdata.js +29 -29
- package/dist/fn/form/objectToFormData.js +13 -10
- package/dist/fn/form/submit.js +5 -5
- package/dist/fn/html/adjustHeight.js +4 -4
- package/dist/fn/html/adjustSize.js +7 -7
- package/dist/fn/html/adjustWidth.js +4 -4
- package/dist/fn/html/getAllTags.js +3 -3
- package/dist/fn/html/getAncestors.js +3 -2
- package/dist/fn/html/getAttributes.js +4 -4
- package/dist/fn/html/getHTMLOfSelection.js +6 -6
- package/dist/fn/html/getHtml.js +4 -3
- package/dist/fn/html/getPath.js +24 -17
- package/dist/fn/html/getText.js +1 -1
- package/dist/fn/html/html2text.js +2 -2
- package/dist/fn/html/isInside.js +9 -9
- package/dist/fn/html/makeReactive.js +35 -31
- package/dist/fn/html/selector.js +1 -1
- package/dist/fn/init.js +28 -28
- package/dist/fn/loop/each.js +6 -6
- package/dist/fn/loop/fori.js +7 -5
- package/dist/fn/loop/forir.js +7 -5
- package/dist/fn/loop/iterate.js +7 -4
- package/dist/fn/loop/riterate.js +3 -2
- package/dist/fn/misc/analyzeFunction.js +30 -30
- package/dist/fn/misc/getTimeoff.js +1 -1
- package/dist/fn/misc/money.js +6 -6
- package/dist/fn/misc/percent.js +1 -1
- package/dist/fn/misc/randomInt.js +1 -1
- package/dist/fn/misc/roundDecimal.js +1 -1
- package/dist/fn/misc/translate.js +4 -4
- package/dist/fn/object/_compareValues.js +7 -6
- package/dist/fn/object/arrayFromProp.js +5 -5
- package/dist/fn/object/autoExtend.js +2 -2
- package/dist/fn/object/checkProps.js +3 -2
- package/dist/fn/object/checkPropsDetails.js +13 -12
- package/dist/fn/object/checkPropsOrDie.js +4 -3
- package/dist/fn/object/circularReplacer.js +6 -6
- package/dist/fn/object/clone.js +6 -6
- package/dist/fn/object/compare.js +6 -6
- package/dist/fn/object/compareConditions.js +11 -11
- package/dist/fn/object/count.js +4 -2
- package/dist/fn/object/createObject.js +17 -4
- package/dist/fn/object/deepPath.js +10 -9
- package/dist/fn/object/deleteProp.js +2 -2
- package/dist/fn/object/diffObj.js +19 -17
- package/dist/fn/object/extend.js +17 -13
- package/dist/fn/object/extendOut.js +10 -5
- package/dist/fn/object/filter.d.ts +1 -1
- package/dist/fn/object/filter.js +12 -10
- package/dist/fn/object/filterToConditions.js +10 -9
- package/dist/fn/object/findAll.js +8 -7
- package/dist/fn/object/getField.js +6 -3
- package/dist/fn/object/getFieldValues.js +6 -6
- package/dist/fn/object/getProp.js +2 -2
- package/dist/fn/object/getProperty.js +2 -2
- package/dist/fn/object/getRow.js +4 -2
- package/dist/fn/object/map.js +4 -3
- package/dist/fn/object/move.js +2 -2
- package/dist/fn/object/multiorder.js +8 -7
- package/dist/fn/object/numProperties.js +1 -1
- package/dist/fn/object/order.js +3 -2
- package/dist/fn/object/pickValue.js +1 -1
- package/dist/fn/object/removeEmpty.js +6 -6
- package/dist/fn/object/removePrivateProp.js +4 -3
- package/dist/fn/object/search.d.ts +1 -1
- package/dist/fn/object/search.js +15 -12
- package/dist/fn/object/setProp.js +3 -1
- package/dist/fn/object/setProperty.js +10 -10
- package/dist/fn/object/shortenObj.js +8 -7
- package/dist/fn/object/shuffle.js +4 -3
- package/dist/fn/object/sum.js +6 -6
- package/dist/fn/object/unique.js +1 -1
- package/dist/fn/string/baseName.js +6 -6
- package/dist/fn/string/br2nl.js +2 -2
- package/dist/fn/string/camelToCss.js +1 -1
- package/dist/fn/string/camelize.js +1 -1
- package/dist/fn/string/correctCase.js +2 -2
- package/dist/fn/string/crc32.js +8 -8
- package/dist/fn/string/dirName.js +4 -4
- package/dist/fn/string/escapeDquotes.js +2 -2
- package/dist/fn/string/escapeRegExp.js +1 -1
- package/dist/fn/string/escapeSquotes.js +2 -2
- package/dist/fn/string/escapeTicks.js +2 -2
- package/dist/fn/string/escapeUrl.js +11 -11
- package/dist/fn/string/fileExt.js +3 -3
- package/dist/fn/string/format.js +6 -6
- package/dist/fn/string/formatBytes.js +3 -2
- package/dist/fn/string/formatSize.js +3 -3
- package/dist/fn/string/hash.js +9 -9
- package/dist/fn/string/md5.js +1 -1
- package/dist/fn/string/nl2br.js +2 -2
- package/dist/fn/string/printf.js +1 -1
- package/dist/fn/string/quotes2html.js +2 -2
- package/dist/fn/string/randomString.js +7 -7
- package/dist/fn/string/removeAccents.js +3 -3
- package/dist/fn/string/removeExtraSpaces.js +1 -1
- package/dist/fn/string/removeHtmlComments.js +2 -2
- package/dist/fn/string/removeTrailingChars.js +2 -2
- package/dist/fn/string/repeat.js +1 -1
- package/dist/fn/string/replaceAll.js +4 -3
- package/dist/fn/string/sanitize.js +9 -8
- package/dist/fn/string/shorten.js +3 -3
- package/dist/fn/string/simpleHash.js +5 -5
- package/dist/fn/string/simpleHash1.js +4 -4
- package/dist/fn/string/simpleHash2.js +4 -4
- package/dist/fn/string/substr.js +4 -4
- package/dist/fn/string/trim.js +3 -2
- package/dist/fn/string/uniqString.js +17 -10
- package/dist/fn/style/addColors.js +17 -17
- package/dist/fn/style/addStyle.js +4 -4
- package/dist/fn/style/animateCss.js +4 -4
- package/dist/fn/style/center.js +2 -2
- package/dist/fn/style/cssExists.js +8 -8
- package/dist/fn/style/getCssVar.js +1 -1
- package/dist/fn/style/getScrollBarSize.js +6 -6
- package/dist/fn/style/lightenDarkenHex.js +3 -3
- package/dist/fn/style/outerHeight.js +4 -4
- package/dist/fn/style/outerWidth.js +4 -4
- package/dist/fn/style/resize.js +17 -17
- package/dist/fn/style/setCssVar.js +1 -1
- package/dist/fn/type/checkType.js +16 -12
- package/dist/fn/type/isArray.js +7 -2
- package/dist/fn/type/isBlob.js +7 -2
- package/dist/fn/type/isBoolean.js +7 -2
- package/dist/fn/type/isCanvas.js +7 -2
- package/dist/fn/type/isColor.js +8 -3
- package/dist/fn/type/isComment.js +7 -2
- package/dist/fn/type/isCp.js +9 -4
- package/dist/fn/type/isDate.js +7 -2
- package/dist/fn/type/isDimension.js +8 -3
- package/dist/fn/type/isDom.js +7 -2
- package/dist/fn/type/isEmail.js +9 -4
- package/dist/fn/type/isEmpty.js +3 -3
- package/dist/fn/type/isEvent.js +7 -2
- package/dist/fn/type/isFunction.js +7 -2
- package/dist/fn/type/isHostname.js +9 -4
- package/dist/fn/type/isIP.js +8 -3
- package/dist/fn/type/isInt.js +7 -2
- package/dist/fn/type/isIterable.js +7 -2
- package/dist/fn/type/isNull.js +7 -2
- package/dist/fn/type/isNumber.js +7 -2
- package/dist/fn/type/isObject.js +7 -2
- package/dist/fn/type/isPercent.js +7 -2
- package/dist/fn/type/isPrimitive.js +7 -2
- package/dist/fn/type/isPromise.js +7 -2
- package/dist/fn/type/isPropSize.js +4 -4
- package/dist/fn/type/isSQLDate.js +7 -2
- package/dist/fn/type/isSame.js +9 -9
- package/dist/fn/type/isString.js +7 -2
- package/dist/fn/type/isSymbol.js +7 -2
- package/dist/fn/type/isURL.js +7 -2
- package/dist/fn/type/isValidDimension.js +5 -5
- package/dist/fn/type/isValidName.js +8 -3
- package/dist/fn/type/isValue.js +8 -3
- package/dist/fn/type/isVue.js +11 -4
- package/dist/fn.d.ts +1 -1
- package/dist/fn.js +456 -456
- package/dist/index.d.ts +5 -5
- package/dist/index.js +1241 -920
- package/dist/lng.js +1 -1
- package/dist/vars.js +1 -1
- package/package.json +8 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { search } from
|
|
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
|
-
|
|
38
|
-
|
|
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
|
|
2
|
-
import { md5 } from
|
|
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
|
-
|
|
52
|
-
|
|
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
|
}
|
package/dist/fn/ajax/link.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { treatAjaxArguments } from
|
|
2
|
-
import { getLoader } from
|
|
3
|
-
import { ajax } from
|
|
4
|
-
import { log } from
|
|
5
|
-
import { extend } from
|
|
6
|
-
import { isObject } from
|
|
7
|
-
import { callback } from
|
|
8
|
-
import { setNavigationVars } from
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
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(
|
|
110
|
+
log(errSt_1 + bbn._('returned an empty object'));
|
|
107
111
|
}
|
|
108
112
|
if (res.new_url) {
|
|
109
113
|
res.old_path = cfg.url;
|
package/dist/fn/ajax/post.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { treatAjaxArguments } from
|
|
2
|
-
import { ajax } from
|
|
3
|
-
import { callback } from
|
|
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
|
-
|
|
38
|
-
|
|
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
|
}
|
package/dist/fn/ajax/postOut.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createObject } from
|
|
2
|
-
import { addInputs } from
|
|
3
|
-
import { setProperty } from
|
|
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
|
-
|
|
24
|
-
|
|
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
|
|
2
|
-
import { filter } from
|
|
3
|
-
import { extend } from
|
|
4
|
-
import { html2text } from
|
|
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
|
-
|
|
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
|
-
|
|
42
|
+
var h = window.history;
|
|
41
43
|
if (h) {
|
|
42
44
|
// Current state
|
|
43
|
-
|
|
45
|
+
var state = h.state;
|
|
44
46
|
// Future state
|
|
45
|
-
|
|
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
|
|
2
|
-
import { isFunction } from
|
|
3
|
-
import { substr } from
|
|
4
|
-
import { numProperties } from
|
|
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
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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
|
}
|
package/dist/fn/ajax/upload.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { objectToFormData } from
|
|
2
|
-
import { log } from
|
|
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
|
-
|
|
20
|
-
|
|
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
|
-
|
|
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);
|
package/dist/fn/browser/copy.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isObject } from
|
|
2
|
-
import { isFunction } from
|
|
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
|
-
|
|
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()]
|
|
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
|
-
|
|
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
|
-
|
|
40
|
+
var input = document.createElement('textarea');
|
|
39
41
|
input.style.opacity = '0';
|
|
40
42
|
input.value = st;
|
|
41
43
|
document.body.appendChild(input);
|
package/dist/fn/browser/error.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { log } from
|
|
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
|
-
|
|
14
|
+
var error = function (errorMsg) {
|
|
15
15
|
if (arguments.length > 1) {
|
|
16
|
-
|
|
17
|
-
for (
|
|
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
|
-
|
|
9
|
-
|
|
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
|
-
|
|
9
|
-
|
|
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
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
for (
|
|
19
|
-
|
|
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
|
-
|
|
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
|
-
|
|
14
|
-
|
|
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
|
|
2
|
-
import { each } from
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
|
|
24
|
+
var sel = window.getSelection();
|
|
25
25
|
res.raw = sel.toString();
|
|
26
|
-
|
|
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
|
-
|
|
50
|
-
|
|
51
|
-
each(dt.items, (item, idx)
|
|
52
|
-
|
|
53
|
-
|
|
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
|
-
|
|
55
|
+
var cp = dt.files[idx];
|
|
56
56
|
if (!type && cp.name) {
|
|
57
|
-
|
|
57
|
+
var bits = cp.name.split('.');
|
|
58
58
|
type = bits[bits.length - 1];
|
|
59
59
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
-
|
|
66
|
+
num_1--;
|
|
67
67
|
res.files.push({
|
|
68
68
|
type: type,
|
|
69
69
|
data: blob,
|
|
70
|
-
name:
|
|
70
|
+
name: name_1,
|
|
71
71
|
size: size,
|
|
72
72
|
mdate: lastModified,
|
|
73
73
|
});
|
|
74
|
-
|
|
75
|
-
if (!
|
|
74
|
+
strings_1.push(name_1);
|
|
75
|
+
if (!num_1) {
|
|
76
76
|
if (!res.raw) {
|
|
77
|
-
res.raw =
|
|
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') + ' ' +
|
|
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
|
-
|
|
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
|
-
|
|
95
|
+
strings_1.push(name);
|
|
96
96
|
}
|
|
97
|
-
if (!
|
|
97
|
+
if (!num_1) {
|
|
98
98
|
if (!res.raw) {
|
|
99
|
-
res.raw =
|
|
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
|
}
|
package/dist/fn/browser/happy.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { log } from
|
|
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
|
-
|
|
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;',
|
package/dist/fn/browser/info.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { log } from
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
2
|
-
import { isTabletDevice } from
|
|
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
|
-
|
|
15
|
+
var isMobile = function () {
|
|
16
16
|
return isMobileDevice() || isTabletDevice();
|
|
17
17
|
};
|
|
18
18
|
export { isMobile };
|