@lmjs/core 1.0.6 → 2.0.0
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/build/bundle.js +264 -0
- package/build/plugins-registry.js +216 -0
- package/dist/lumenjs-core-with-plugins.js +59258 -0
- package/dist/lumenjs-core.js +50 -0
- package/dist/lumenjs-plugins.css +2822 -0
- package/package.json +59 -28
- package/src/_re.js +2307 -0
- package/src/dom-shim.js +473 -0
- package/src/index-bootstrap.js +47 -0
- package/src/lstnrs.js +1391 -0
- package/src/walk.js +749 -0
- package/src/workers/css.js +1 -0
- package/src/workers/cssRaw.js +1173 -0
- package/src/workers/esp.js +1 -0
- package/src/workers/espRaw.js +78 -0
- package/src/workers/up.js +1 -0
- package/src/workers/upRaw.js +491 -0
- package/src/workers/work.js +1 -0
- package/src/workers/workRaw.js +1097 -0
- package/src/ws.js +1162 -0
- package/vendor/astring.js +3 -0
- package/vendor/bootstrap2-less-stubs/mixins.less +16 -0
- package/vendor/bootstrap2-less-stubs/variables.less +13 -0
- package/vendor/md5.js +1 -0
- package/vendor/reconnecting-websocket.js +4118 -0
- package/vendor/webworker-helper.js +1 -0
- package/LICENSE +0 -201
- package/README.md +0 -3
- package/index.js +0 -14
package/src/lstnrs.js
ADDED
|
@@ -0,0 +1,1391 @@
|
|
|
1
|
+
/**************************************/
|
|
2
|
+
/****** START GLOBAL EVENTS LISTENERS */
|
|
3
|
+
/**************************************/
|
|
4
|
+
|
|
5
|
+
var _navT = 0;
|
|
6
|
+
var _nav = false;
|
|
7
|
+
var _pbc;
|
|
8
|
+
var _vuid = {};
|
|
9
|
+
$("body").on("click touch tap", function (e) {
|
|
10
|
+
if (!_pbc) _pbc = new AudioContext();
|
|
11
|
+
if (_pbc.state == "suspended") {
|
|
12
|
+
_pbc.resume().then(() => { });
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
$("body").on("click touch", ".navTgl", function (e) {
|
|
16
|
+
_nav = false;
|
|
17
|
+
clearTimeout(_navT);
|
|
18
|
+
if ($("nav").hasClass("nav-opened")) {
|
|
19
|
+
$("nav").removeClass("nav-opened");
|
|
20
|
+
$("body").removeClass("nav-opened");
|
|
21
|
+
} else {
|
|
22
|
+
$("nav").addClass("nav-opened");
|
|
23
|
+
$("body").addClass("nav-opened");
|
|
24
|
+
_navT = setTimeout(function () {
|
|
25
|
+
_nav = true;
|
|
26
|
+
}, 20);
|
|
27
|
+
}
|
|
28
|
+
e.stopPropagation();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
$(document).keydown(function (e) {
|
|
32
|
+
var keyCode = e.keyCode || e.which;
|
|
33
|
+
if (keyCode == 27) {
|
|
34
|
+
e.preventDefault();
|
|
35
|
+
e.stopPropagation();
|
|
36
|
+
if ($("[loader]").length) {
|
|
37
|
+
if (_loader.options.Dismissible) _loader.hide();
|
|
38
|
+
} else if (_nav) {
|
|
39
|
+
$("nav").removeClass("nav-opened");
|
|
40
|
+
$("body").removeClass("nav-opened");
|
|
41
|
+
_nav = false;
|
|
42
|
+
} else {
|
|
43
|
+
if ($("popup").length && $("droplet").length) {
|
|
44
|
+
$("droplet")
|
|
45
|
+
.removeClass("is-visible")
|
|
46
|
+
.each(function () {
|
|
47
|
+
var p = $(this);
|
|
48
|
+
setTimeout(function () {
|
|
49
|
+
p.remove();
|
|
50
|
+
}, 150);
|
|
51
|
+
});
|
|
52
|
+
} else if ($("popup").length) {
|
|
53
|
+
$("[close-modal]:last").click();
|
|
54
|
+
} else {
|
|
55
|
+
$("body").css({ overflow: "visible" });
|
|
56
|
+
$("droplet")
|
|
57
|
+
.removeClass("is-visible")
|
|
58
|
+
.each(function () {
|
|
59
|
+
var p = $(this);
|
|
60
|
+
setTimeout(function () {
|
|
61
|
+
p.remove();
|
|
62
|
+
}, 150);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
_csswrk.on('css-ready', function (e) {
|
|
70
|
+
let data = e.originalEvent.data;
|
|
71
|
+
_vuid[data.key].resolve(data.csses);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
_upwrk.on('message', function (e) {
|
|
75
|
+
let data = e.originalEvent.data;
|
|
76
|
+
});
|
|
77
|
+
_upwrk.on('files-added', function (e) {
|
|
78
|
+
let data = e.originalEvent.data;
|
|
79
|
+
processEv(e, $('[upid="' + data.upid + '"]'), "files-added", data.files, data.newfiles);
|
|
80
|
+
});
|
|
81
|
+
_upwrk.on('queue-changed', function (e) {
|
|
82
|
+
let data = e.originalEvent.data;
|
|
83
|
+
processEv(e, $('[upid="' + data.upid + '"]'), "queue-changed", data.files);
|
|
84
|
+
});
|
|
85
|
+
_upwrk.on('file-removed', function (e) {
|
|
86
|
+
let data = e.originalEvent.data;
|
|
87
|
+
processEv(e, $('[upid="' + data.upid + '"]'), "file-removed", data.files, data.removedfile);
|
|
88
|
+
});
|
|
89
|
+
_upwrk.on('upload-start', function (e) {
|
|
90
|
+
let data = e.originalEvent.data;
|
|
91
|
+
processEv(e, $('[upid="' + data.upid + '"]'), "upload-start", data.files);
|
|
92
|
+
});
|
|
93
|
+
_upwrk.on('file-uploaded', function (e) {
|
|
94
|
+
let data = e.originalEvent.data;
|
|
95
|
+
processEv(e, $('[upid="' + data.upid + '"]'), "file-uploaded", data.files, data.file);
|
|
96
|
+
});
|
|
97
|
+
_upwrk.on('upload-progress', function (e) {
|
|
98
|
+
let data = e.originalEvent.data;
|
|
99
|
+
processEv(e, $('[upid="' + data.upid + '"]'), "upload-progress", data.files);
|
|
100
|
+
});
|
|
101
|
+
_upwrk.on('upload-complete', function (e) {
|
|
102
|
+
let data = e.originalEvent.data;
|
|
103
|
+
processEv(e, $('[upid="' + data.upid + '"]'), "upload-complete", data.files);
|
|
104
|
+
});
|
|
105
|
+
_upwrk.on('upload-stop', function (e) {
|
|
106
|
+
let data = e.originalEvent.data;
|
|
107
|
+
processEv(e, $('[upid="' + data.upid + '"]'), "upload-stop", data.files);
|
|
108
|
+
});
|
|
109
|
+
_upwrk.on('queue-empty', function (e) {
|
|
110
|
+
let data = e.originalEvent.data;
|
|
111
|
+
processEv(e, $('[upid="' + data.upid + '"]'), "queue-empty");
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
$.fn.extend({
|
|
116
|
+
startUpload: function () {
|
|
117
|
+
if (this.hasAttr('up')) {
|
|
118
|
+
_upwrk.trigger('start-upload', {
|
|
119
|
+
"upid": this.attr('upid')
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
return this;
|
|
123
|
+
},
|
|
124
|
+
stopUpload: function () {
|
|
125
|
+
if (this.hasAttr('up')) {
|
|
126
|
+
_upwrk.trigger('stop-upload', {
|
|
127
|
+
"upid": this.attr('upid')
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
return this;
|
|
131
|
+
},
|
|
132
|
+
removeFile: function (id) {
|
|
133
|
+
if (this.hasAttr('up')) {
|
|
134
|
+
_upwrk.trigger('remove-file', {
|
|
135
|
+
"upid": this.attr('upid'),
|
|
136
|
+
"id": id
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
return this;
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
$("body").on("FilesAdded", "[up]", function (e, files) {
|
|
145
|
+
let t = $(this);
|
|
146
|
+
var size = t.attr('data-mxs') ? t.attr('data-mxs') : '10mb';
|
|
147
|
+
//TODO: Filter + Reset File Input
|
|
148
|
+
_upwrk.trigger('handle-files', {
|
|
149
|
+
"upid": t.attr('upid'),
|
|
150
|
+
"files": files
|
|
151
|
+
});
|
|
152
|
+
processEv(e, t, "browse-files", files);
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
$("body").on("dragover", "[up] [drpzn]", function (e) {
|
|
156
|
+
e.stopPropagation();
|
|
157
|
+
e.preventDefault();
|
|
158
|
+
let t = $(this).closest('[up]');
|
|
159
|
+
$(this).addClass('dragover');
|
|
160
|
+
e.originalEvent.dataTransfer.dropEffect = 'copy';
|
|
161
|
+
return false;
|
|
162
|
+
});
|
|
163
|
+
$("body").on("dragleave", "[up] [drpzn]", function (e) {
|
|
164
|
+
e.stopPropagation();
|
|
165
|
+
e.preventDefault();
|
|
166
|
+
$(this).removeClass('dragover');
|
|
167
|
+
});
|
|
168
|
+
$("body").on("drop", "[up] [drpzn]", function (e) {
|
|
169
|
+
e.stopPropagation();
|
|
170
|
+
e.preventDefault();
|
|
171
|
+
var files = e.originalEvent.dataTransfer?.files || e.target?.files;
|
|
172
|
+
let t = $(this).closest('[up]');
|
|
173
|
+
$(this).removeClass('dragover');
|
|
174
|
+
t.trigger('FilesAdded', [files]);
|
|
175
|
+
return false;
|
|
176
|
+
});
|
|
177
|
+
$("body").on("click", "[up] [browse]", function (e) {
|
|
178
|
+
e.stopPropagation();
|
|
179
|
+
e.preventDefault();
|
|
180
|
+
let t = $(this).closest('[up]');
|
|
181
|
+
t.find("[files]").click();
|
|
182
|
+
});
|
|
183
|
+
$("body").on("change", "[up] [files]", function (e) {
|
|
184
|
+
e.stopPropagation();
|
|
185
|
+
e.preventDefault();
|
|
186
|
+
var files = e.originalEvent.dataTransfer?.files || e.target?.files;
|
|
187
|
+
let t = $(this).closest('[up]');
|
|
188
|
+
t.trigger('FilesAdded', [files]);
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
$("body").on("click touch", "[ctc]", function (ev) {
|
|
192
|
+
var el = $(this);
|
|
193
|
+
var ctc = el.attr("ctc");
|
|
194
|
+
var selector = el;
|
|
195
|
+
if (ctc.indexOf("el.") !== -1) {
|
|
196
|
+
selector = eval(ctc);
|
|
197
|
+
} else if (ctc != "") selector = $(ctc);
|
|
198
|
+
|
|
199
|
+
if (!navigator.clipboard) {
|
|
200
|
+
var temp = $("<textarea class='pf' style='left: -40%;' />");
|
|
201
|
+
$("body").append(temp);
|
|
202
|
+
temp.val(selector.text()).select();
|
|
203
|
+
document.execCommand("copy");
|
|
204
|
+
temp.remove();
|
|
205
|
+
} else {
|
|
206
|
+
navigator.clipboard.writeText(selector.text()).then(
|
|
207
|
+
function () {
|
|
208
|
+
// console.log("Async: Copying to clipboard was successful!");
|
|
209
|
+
},
|
|
210
|
+
function (err) {
|
|
211
|
+
// console.error("Async: Could not copy text: ", err);
|
|
212
|
+
var temp = $("<textarea class='pf' style='left: -40%;' />");
|
|
213
|
+
$("body").append(temp);
|
|
214
|
+
temp.val(selector.text()).select();
|
|
215
|
+
document.execCommand("copy");
|
|
216
|
+
temp.remove();
|
|
217
|
+
}
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
if (el.hasAttr("stop")) ev.stopPropagation();
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
$("body").on("click touch", "[scroll-left]", function (ev) {
|
|
225
|
+
var _el = $(this);
|
|
226
|
+
var _wrap = _el.closest("[wrapper]");
|
|
227
|
+
if (_wrap.length) {
|
|
228
|
+
var _p = _wrap.find("div").first();
|
|
229
|
+
_p.stop().animate(
|
|
230
|
+
{ scrollLeft: _p.scrollLeft() - 100 },
|
|
231
|
+
{
|
|
232
|
+
duration: 200,
|
|
233
|
+
easing: "easeOutCirc",
|
|
234
|
+
complete: function () { },
|
|
235
|
+
}
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
$("body").on("click touch", "[scroll-right]", function (ev) {
|
|
241
|
+
var _el = $(this);
|
|
242
|
+
var _wrap = _el.closest("[wrapper]");
|
|
243
|
+
if (_wrap.length) {
|
|
244
|
+
var _p = _wrap.find("div").first();
|
|
245
|
+
_p.stop().animate(
|
|
246
|
+
{ scrollLeft: _p.scrollLeft() + 100 },
|
|
247
|
+
{
|
|
248
|
+
duration: 200,
|
|
249
|
+
easing: "easeOutCirc",
|
|
250
|
+
complete: function () { },
|
|
251
|
+
}
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
$("body").on("click touch", "[scroll-top]", function (ev) {
|
|
257
|
+
var _el = $(this);
|
|
258
|
+
var _wrap = _el.closest("[wrapper]");
|
|
259
|
+
if (_wrap.length) {
|
|
260
|
+
var _p = _wrap.find("div").first();
|
|
261
|
+
_p.stop().animate(
|
|
262
|
+
{ scrollTop: _p.scrollTop() - 100 },
|
|
263
|
+
{
|
|
264
|
+
duration: 200,
|
|
265
|
+
easing: "easeOutCirc",
|
|
266
|
+
complete: function () { },
|
|
267
|
+
}
|
|
268
|
+
);
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
$("body").on("click touch", "[scroll-bottom]", function (ev) {
|
|
273
|
+
var _el = $(this);
|
|
274
|
+
var _wrap = _el.closest("[wrapper]");
|
|
275
|
+
if (_wrap.length) {
|
|
276
|
+
var _p = _wrap.find("div").first();
|
|
277
|
+
_p.stop().animate(
|
|
278
|
+
{ scrollTop: _p.scrollTop() + 100 },
|
|
279
|
+
{
|
|
280
|
+
duration: 200,
|
|
281
|
+
easing: "easeOutCirc",
|
|
282
|
+
complete: function () { },
|
|
283
|
+
}
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
function bs(t) {
|
|
289
|
+
$("body").css({ overflow: t ? "visible" : "hidden" });
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
$("body").on("open-modal", "[modal]", function (ev) {
|
|
293
|
+
var el = $(this);
|
|
294
|
+
var n = popups.modals.length;
|
|
295
|
+
var _view = el.attr("modal");
|
|
296
|
+
bs();
|
|
297
|
+
|
|
298
|
+
var va = el.attr("modal-align") ?? "center middle";
|
|
299
|
+
var padding = el.attr("modal-spacing") ?? "p10";
|
|
300
|
+
var ov = el.attr("modal-ov") ?? "bgb20";
|
|
301
|
+
va = va.split(" ");
|
|
302
|
+
if (va.length == 2) {
|
|
303
|
+
va = {
|
|
304
|
+
h: ["left", "center", "right"].indexOf(va[0]) >= 0 ? va[0] : "center",
|
|
305
|
+
v:
|
|
306
|
+
["top", "center", "middle", "bottom"].indexOf(va[1]) >= 0
|
|
307
|
+
? va[1]
|
|
308
|
+
: "middle",
|
|
309
|
+
};
|
|
310
|
+
} else {
|
|
311
|
+
va = {
|
|
312
|
+
h: "center",
|
|
313
|
+
v: "middle",
|
|
314
|
+
};
|
|
315
|
+
setError(null, "Modal align should be modal-align='vertical horizontal'.");
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
if (!el.hasAttr("data-modal")) {
|
|
319
|
+
var selector = "modals_" + n;
|
|
320
|
+
|
|
321
|
+
var popup =
|
|
322
|
+
'<popup class="ov pf [c] z10000">' +
|
|
323
|
+
'<pop-o class="ov pf [ov]"></pop-o>' +
|
|
324
|
+
'<tbl_nm fixed class="hv100">' +
|
|
325
|
+
'<cl class="[va] [ta] [p]">' +
|
|
326
|
+
"<pop-c>" +
|
|
327
|
+
'<pop-x close-modal data-dismiss="modal" aria-label="Close"><span aria-hidden="true" class="cc c">×</span></pop-x>' +
|
|
328
|
+
"<pop-h><pop-t>[t]</pop-t><pop-d>[d]</pop-d></pop-h>" +
|
|
329
|
+
"<pop-b>[b]</pop-b>" +
|
|
330
|
+
"<pop-f>[f]</pop-f>" +
|
|
331
|
+
"</pop-c>" +
|
|
332
|
+
"</cl>" +
|
|
333
|
+
"</tbl_nm>" +
|
|
334
|
+
"</popup>";
|
|
335
|
+
|
|
336
|
+
var verticalAlign =
|
|
337
|
+
va["v"] == "center" || va["v"] == "middle"
|
|
338
|
+
? "vm"
|
|
339
|
+
: va["v"] == "top"
|
|
340
|
+
? "vt"
|
|
341
|
+
: "vb";
|
|
342
|
+
var textAlign = va["h"] == "center" ? "c" : va["h"] == "left" ? "l" : "r";
|
|
343
|
+
|
|
344
|
+
popup = popup
|
|
345
|
+
.split("[va]")
|
|
346
|
+
.join(verticalAlign)
|
|
347
|
+
.split("[p]")
|
|
348
|
+
.join(padding)
|
|
349
|
+
.split("[ta]")
|
|
350
|
+
.join(textAlign)
|
|
351
|
+
.split("[ov]")
|
|
352
|
+
.join(ov);
|
|
353
|
+
let attrsData = {
|
|
354
|
+
t: el.attr("modal-title") ?? "New Modal",
|
|
355
|
+
d: el.attr("modal-description") ?? "",
|
|
356
|
+
c: el.attr("modal-class") ?? "",
|
|
357
|
+
};
|
|
358
|
+
if (_view != "") {
|
|
359
|
+
popup = popup.split("[t]").join(attrsData.t);
|
|
360
|
+
popup = popup.split("[d]").join(attrsData.d);
|
|
361
|
+
popup = popup
|
|
362
|
+
.split("[b]")
|
|
363
|
+
.join('<div for-modal="' + selector + "\" view='" + _view + "'></div>");
|
|
364
|
+
popup = popup.split("[f]").join("");
|
|
365
|
+
} else {
|
|
366
|
+
var c = getComData(el);
|
|
367
|
+
if (!c) {
|
|
368
|
+
if (el.find("modal").length > 0) {
|
|
369
|
+
var modalData = el.find("modal:first");
|
|
370
|
+
var c = getComData(modalData, true);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
if (c) {
|
|
374
|
+
if (c.Title) popup = popup.split("[t]").join(c.Title ?? attrsData.t);
|
|
375
|
+
popup = popup.split("[d]").join(c.Description ?? attrsData.d);
|
|
376
|
+
popup = popup.split("[b]").join(c.Body ?? "");
|
|
377
|
+
popup = popup.split("[f]").join(c.Footer ?? "");
|
|
378
|
+
} else {
|
|
379
|
+
popup = popup.split("[t]").join(attrsData.t);
|
|
380
|
+
popup = popup.split("[d]").join(attrsData.d);
|
|
381
|
+
popup = popup.split("[b]").join("");
|
|
382
|
+
popup = popup.split("[f]").join("");
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
popup = popup.split("[c]").join(attrsData.c);
|
|
386
|
+
var newModal = $(popup);
|
|
387
|
+
newModal.attr("id", selector).appendTo("body");
|
|
388
|
+
// el.attach('Open');
|
|
389
|
+
let modal = $("#" + selector);
|
|
390
|
+
|
|
391
|
+
el.trigger("modal-open", [modal]);
|
|
392
|
+
|
|
393
|
+
modal.data("props", el.data("props"));
|
|
394
|
+
|
|
395
|
+
modal
|
|
396
|
+
.addClass("modal-open")
|
|
397
|
+
.delay(10)
|
|
398
|
+
.queue(function (next) {
|
|
399
|
+
$(this).addClass("in");
|
|
400
|
+
next();
|
|
401
|
+
});
|
|
402
|
+
$(this).attr("data-modal", selector);
|
|
403
|
+
popups["modals"].push(newModal.get(0));
|
|
404
|
+
|
|
405
|
+
// el.trigger('Open', [$("#" + selector), el, c]);
|
|
406
|
+
|
|
407
|
+
// if (el.attr('modal-open')) {
|
|
408
|
+
// var mo = el.attr('modal-open');
|
|
409
|
+
// if (typeof window[mo] === "function") {
|
|
410
|
+
// window[mo]($("#" + selector), el, c);
|
|
411
|
+
// }
|
|
412
|
+
// }
|
|
413
|
+
|
|
414
|
+
globalWatch();
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
if (el.hasAttr("stop")) ev.stopPropagation();
|
|
418
|
+
});
|
|
419
|
+
|
|
420
|
+
$("body").on("click touch", "[modal]", function (ev) {
|
|
421
|
+
let modalTriggered = false;
|
|
422
|
+
var obj = {};
|
|
423
|
+
$.each($(this)[0].attributes, function () {
|
|
424
|
+
if (this.value.toLowerCase() == "openmodal") {
|
|
425
|
+
modalTriggered = true;
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
obj[this.name] = this.value;
|
|
429
|
+
});
|
|
430
|
+
if (!modalTriggered) {
|
|
431
|
+
$(this).trigger("open-modal");
|
|
432
|
+
}
|
|
433
|
+
});
|
|
434
|
+
|
|
435
|
+
$("body").on("modal-close", "[\\@modal-close]", function (ev, modal, cb) {
|
|
436
|
+
let el = $(this),
|
|
437
|
+
_v = el.attr("@modal-close");
|
|
438
|
+
let props = modal.data("props");
|
|
439
|
+
let _fn = _v.split("(")[0];
|
|
440
|
+
try {
|
|
441
|
+
if (typeof window[_v] === "function") cb(window[_fn](ev, el, modal, props));
|
|
442
|
+
else {
|
|
443
|
+
let _eva = eval(_v);
|
|
444
|
+
cb(_eva);
|
|
445
|
+
}
|
|
446
|
+
} catch (e) {
|
|
447
|
+
cb();
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
// let el = $(this),
|
|
451
|
+
// _v = el.attr("@modal-close"),
|
|
452
|
+
// _bv = el.attr("@modal-beforeclose");
|
|
453
|
+
|
|
454
|
+
// let props = modal.data("props");
|
|
455
|
+
// let _fn = _v.split("(")[0];
|
|
456
|
+
|
|
457
|
+
// try {
|
|
458
|
+
// let ex = true;
|
|
459
|
+
// if (_bv) {
|
|
460
|
+
// let r = true;
|
|
461
|
+
// let _bfn = _bv.split("(")[0];
|
|
462
|
+
// if (typeof window[_bv] === "function") r = cb(window[_bfn](ev, el, modal, props));
|
|
463
|
+
// else {
|
|
464
|
+
// let _eva = eval(_bv);
|
|
465
|
+
// r = cb(_eva);
|
|
466
|
+
// }
|
|
467
|
+
// ex = r;
|
|
468
|
+
// }
|
|
469
|
+
// if (ex) {
|
|
470
|
+
// if (typeof window[_v] === "function") cb(window[_fn](ev, el, modal, props));
|
|
471
|
+
// else {
|
|
472
|
+
// let _eva = eval(_v);
|
|
473
|
+
// cb(_eva);
|
|
474
|
+
// }
|
|
475
|
+
// }
|
|
476
|
+
// } catch (e) {
|
|
477
|
+
// cb();
|
|
478
|
+
// }
|
|
479
|
+
});
|
|
480
|
+
|
|
481
|
+
$("body").on("modal-open", "[\\@modal-open]", function (ev, modal) {
|
|
482
|
+
let el = $(this),
|
|
483
|
+
_v = el.attr("@modal-open");
|
|
484
|
+
let _fn = _v.split("(")[0];
|
|
485
|
+
try {
|
|
486
|
+
if (typeof window[_v] === "function") {
|
|
487
|
+
var _data = window[_fn](ev, el, modal);
|
|
488
|
+
modal.data("props", _data);
|
|
489
|
+
} else {
|
|
490
|
+
let _eva = eval(_v);
|
|
491
|
+
modal.data("props", _eva);
|
|
492
|
+
}
|
|
493
|
+
} catch (e) { }
|
|
494
|
+
});
|
|
495
|
+
|
|
496
|
+
function evalEvAttr(_v, ev, el, n, arg1, arg2, arg3) {
|
|
497
|
+
let _fn = _v.split("(")[0];
|
|
498
|
+
try {
|
|
499
|
+
if (typeof window[_v] === "function") {
|
|
500
|
+
ev["cType"] = n;
|
|
501
|
+
var _data = arg3 ? window[_fn](ev, el, arg1, arg2, arg3) : (arg2 ? window[_fn](ev, el, arg1, arg2) : (arg1 ? window[_fn](ev, el, arg1) : window[_fn](ev, el)));
|
|
502
|
+
return _data;
|
|
503
|
+
} else {
|
|
504
|
+
let _eva = eval(_v);
|
|
505
|
+
return _eva;
|
|
506
|
+
}
|
|
507
|
+
} catch (e) {
|
|
508
|
+
return false;
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
function processEv(ev, el, n, arg1, arg2, arg3) {
|
|
513
|
+
if (el.attr("stop")) ev.stopPropagation();
|
|
514
|
+
if (n == "focusin") n = "focus";
|
|
515
|
+
else if (n == "focusout") n = "blur";
|
|
516
|
+
if (!el.hasAttr("@" + n)) return;
|
|
517
|
+
if (el.hasAttr("@before-" + n)) {
|
|
518
|
+
if (!evalEvAttr(el.attr("@before-" + n), ev, el, n, arg1, arg2, arg3)) return;
|
|
519
|
+
}
|
|
520
|
+
let _v = el.attr("@" + n);
|
|
521
|
+
if (_v.toLowerCase() == "openmodal") {
|
|
522
|
+
el.trigger("open-modal");
|
|
523
|
+
return;
|
|
524
|
+
}
|
|
525
|
+
evalEvAttr(_v, ev, el, n, arg1, arg2, arg3);
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
$("body").on("click touch", "[ci]", function (ev) {
|
|
529
|
+
var el = $(this);
|
|
530
|
+
var f = el.closest("form");
|
|
531
|
+
var inputs = $("");
|
|
532
|
+
|
|
533
|
+
if (el.attr("ci") != "") {
|
|
534
|
+
let ci = el.attr("ci").split(",");
|
|
535
|
+
for (let index = 0; index < ci.length; index++) {
|
|
536
|
+
const selector = ci[index];
|
|
537
|
+
inputs = inputs.add(f.find(selector));
|
|
538
|
+
}
|
|
539
|
+
} else {
|
|
540
|
+
inputs = f.find(
|
|
541
|
+
$("input[\\:required],select[\\:required],textarea[\\:required]")
|
|
542
|
+
);
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
f.removeClass("validation-error");
|
|
546
|
+
for (var i = 0; i < inputs.length; i++) {
|
|
547
|
+
if (!checkFormInputs(f, inputs[i])) {
|
|
548
|
+
f.addClass("validation-error");
|
|
549
|
+
break;
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
});
|
|
553
|
+
|
|
554
|
+
$("body").on("doubletap", "[\\@dblclick]", function (ev) {
|
|
555
|
+
processEv(ev, $(this), "dblclick");
|
|
556
|
+
});
|
|
557
|
+
|
|
558
|
+
$("body").on("doubletap", "[\\@dbltap]", function (ev) {
|
|
559
|
+
processEv(ev, $(this), "dbltap");
|
|
560
|
+
});
|
|
561
|
+
|
|
562
|
+
$("body").on("singletap", "[\\@singleclick]", function (ev) {
|
|
563
|
+
processEv(ev, $(this), "singleclick");
|
|
564
|
+
});
|
|
565
|
+
|
|
566
|
+
$("body").on("singletap", "[\\@singletap]", function (ev) {
|
|
567
|
+
processEv(ev, $(this), "singletap");
|
|
568
|
+
});
|
|
569
|
+
|
|
570
|
+
$("body").on("taphold", "[\\@taphold]", function (ev) {
|
|
571
|
+
processEv(ev, $(this), "taphold");
|
|
572
|
+
});
|
|
573
|
+
|
|
574
|
+
$("body").on("taphold", "[\\@clickhold]", function (ev) {
|
|
575
|
+
processEv(ev, $(this), "clickhold");
|
|
576
|
+
});
|
|
577
|
+
|
|
578
|
+
$("body").on("click touch", "[\\@click]", function (ev) {
|
|
579
|
+
processEv(ev, $(this), "click");
|
|
580
|
+
});
|
|
581
|
+
|
|
582
|
+
$("body").on("tap", "[\\@tap]", function (ev) {
|
|
583
|
+
processEv(ev, $(this), "click touch");
|
|
584
|
+
});
|
|
585
|
+
|
|
586
|
+
$("body").on("tap2", "[\\@click2]", function (ev) {
|
|
587
|
+
processEv(ev, $(this), "click2");
|
|
588
|
+
});
|
|
589
|
+
|
|
590
|
+
$("body").on("tap2", "[\\@tap2]", function (ev) {
|
|
591
|
+
processEv(ev, $(this), "tap2");
|
|
592
|
+
});
|
|
593
|
+
|
|
594
|
+
$("body").on("tap2hold", "[\\@click2hold]", function (ev) {
|
|
595
|
+
processEv(ev, $(this), "click2hold");
|
|
596
|
+
});
|
|
597
|
+
|
|
598
|
+
$("body").on("tap2hold", "[\\@tap2hold]", function (ev) {
|
|
599
|
+
processEv(ev, $(this), "tap2hold");
|
|
600
|
+
});
|
|
601
|
+
|
|
602
|
+
$("body").on("orientationchange", "[\\@orientationchange]", function (ev) {
|
|
603
|
+
processEv(ev, $(this), "orientationchange");
|
|
604
|
+
});
|
|
605
|
+
|
|
606
|
+
$("body").on(
|
|
607
|
+
"swipe swipeleft swipedown swipeend swipeup swiperight",
|
|
608
|
+
"[\\@swipe],[\\@swipe-down],[\\@swipe-up],[\\@swipe-left],[\\@swipe-right],[\\@swipe-end]",
|
|
609
|
+
function (ev) {
|
|
610
|
+
let _v =
|
|
611
|
+
ev.type.length == 5 ? "swipe" : ev.type.split("swipe").join("swipe-");
|
|
612
|
+
processEv(ev, $(this), _v);
|
|
613
|
+
}
|
|
614
|
+
);
|
|
615
|
+
|
|
616
|
+
$("body").on("mouseover", "[\\@mouse-over]", function (ev) {
|
|
617
|
+
processEv(ev, $(this), "mouse-over");
|
|
618
|
+
});
|
|
619
|
+
|
|
620
|
+
$("body").on("mousedown touchstart", "[\\@mouse-down]", function (ev) {
|
|
621
|
+
processEv(ev, $(this), "mouse-down");
|
|
622
|
+
});
|
|
623
|
+
|
|
624
|
+
$("body").on("tapstart", "[\\@tap-start]", function (ev) {
|
|
625
|
+
processEv(ev, $(this), "tap-start");
|
|
626
|
+
});
|
|
627
|
+
|
|
628
|
+
$("body").on("tapend", "[\\@tap-end]", function (ev) {
|
|
629
|
+
processEv(ev, $(this), "tap-end");
|
|
630
|
+
});
|
|
631
|
+
|
|
632
|
+
$("body").on("tapmove", "[\\@tap-move]", function (ev) {
|
|
633
|
+
processEv(ev, $(this), "tap-move");
|
|
634
|
+
});
|
|
635
|
+
|
|
636
|
+
$("body").on("mouseup touchend", "[\\@mouse-up]", function (ev) {
|
|
637
|
+
processEv(ev, $(this), "mouse-up");
|
|
638
|
+
});
|
|
639
|
+
|
|
640
|
+
$("body").on("mouseout", "[\\@mouse-out]", function (ev) {
|
|
641
|
+
processEv(ev, $(this), "mouse-out");
|
|
642
|
+
});
|
|
643
|
+
|
|
644
|
+
$("body").on("mouseenter touchmove", "[\\:hover]", function (ev) {
|
|
645
|
+
let _s = $(this).attr(":hover");
|
|
646
|
+
$(this).attr(
|
|
647
|
+
"style",
|
|
648
|
+
($(this).hasAttr("style") ? $(this).attr("style").rtrim(";") + ";" : "") +
|
|
649
|
+
_s
|
|
650
|
+
);
|
|
651
|
+
});
|
|
652
|
+
|
|
653
|
+
$("body").on("mouseleave touchend", "[\\:hover]", function (ev) {
|
|
654
|
+
let _s = $(this).attr(":hover");
|
|
655
|
+
$(this).attr("style", $(this).attr("style").split(_s).join(""));
|
|
656
|
+
});
|
|
657
|
+
|
|
658
|
+
$("body").on("mouseenter", "[\\@mouse-enter]", function (ev) {
|
|
659
|
+
processEv(ev, $(this), "mouse-enter");
|
|
660
|
+
});
|
|
661
|
+
|
|
662
|
+
$("body").on("mouseleave", "[\\@mouse-leave]", function (ev) {
|
|
663
|
+
processEv(ev, $(this), "mouse-leave");
|
|
664
|
+
});
|
|
665
|
+
|
|
666
|
+
$("body").on("mousemove", "[\\@mouse-move]", function (ev) {
|
|
667
|
+
processEv(ev, $(this), "mouse-move");
|
|
668
|
+
});
|
|
669
|
+
|
|
670
|
+
$("body").on("touchmove", "[\\@mouse-move]", function (ev) {
|
|
671
|
+
processEv(ev, $(this), "mouse-move");
|
|
672
|
+
});
|
|
673
|
+
|
|
674
|
+
$("body").on("sort", "[\\@sort]", function (ev, ui) {
|
|
675
|
+
processEv(ev, $(this), "sort", ui);
|
|
676
|
+
});
|
|
677
|
+
|
|
678
|
+
$("body").on("sortupdate", "[\\@sort-update]", function (ev, ui) {
|
|
679
|
+
processEv(ev, $(this), "sort-update", ui);
|
|
680
|
+
});
|
|
681
|
+
|
|
682
|
+
$("body").on("sortchange", "[\\@sort-change]", function (ev, ui) {
|
|
683
|
+
processEv(ev, $(this), "sort-change", ui);
|
|
684
|
+
});
|
|
685
|
+
|
|
686
|
+
$("body").on("sortstart", "[\\@sort-start]", function (ev, ui) {
|
|
687
|
+
processEv(ev, $(this), "sort-start", ui);
|
|
688
|
+
});
|
|
689
|
+
|
|
690
|
+
$("body").on("sortstop", "[\\@sort-stop]", function (ev, ui) {
|
|
691
|
+
processEv(ev, $(this), "sort-stop", ui);
|
|
692
|
+
});
|
|
693
|
+
|
|
694
|
+
$("body").on("sortbeforestop", "[\\@sort-before-stop]", function (ev, ui) {
|
|
695
|
+
processEv(ev, $(this), "sort-before-stop", ui);
|
|
696
|
+
});
|
|
697
|
+
|
|
698
|
+
$("body").on("drag", "[\\@drag]", function (ev, ui) {
|
|
699
|
+
processEv(ev, $(this), "drag", ui);
|
|
700
|
+
});
|
|
701
|
+
|
|
702
|
+
$("body").on("dragstart", "[\\@drag-start]", function (ev, ui) {
|
|
703
|
+
processEv(ev, $(this), "drag-start", ui);
|
|
704
|
+
});
|
|
705
|
+
|
|
706
|
+
$("body").on("dragstop", "[\\@drag-stop]", function (ev, ui) {
|
|
707
|
+
processEv(ev, $(this), "drag-stop", ui);
|
|
708
|
+
});
|
|
709
|
+
|
|
710
|
+
$("body").on("drop", "[\\@drop]", function (ev, ui) {
|
|
711
|
+
processEv(ev, $(this), "drop", ui);
|
|
712
|
+
});
|
|
713
|
+
|
|
714
|
+
$("body").on("clear", "[sl]", function (ev, ui) {
|
|
715
|
+
let t = $(this);
|
|
716
|
+
t.empty().change();
|
|
717
|
+
try {
|
|
718
|
+
let opts = t.data("select2")?.options?.options;
|
|
719
|
+
opts.data = null;
|
|
720
|
+
t.select2(opts);
|
|
721
|
+
} catch (e) {
|
|
722
|
+
cl(e);
|
|
723
|
+
}
|
|
724
|
+
});
|
|
725
|
+
|
|
726
|
+
$("body").on(
|
|
727
|
+
"change blur focus keyup keydown input",
|
|
728
|
+
"[\\@input],[\\@change],[\\@blur],[\\@focus],[\\@keyup],[\\@keydown]",
|
|
729
|
+
function (ev) {
|
|
730
|
+
processEv(ev, $(this), ev.type);
|
|
731
|
+
}
|
|
732
|
+
);
|
|
733
|
+
|
|
734
|
+
$("body").on("click touch", "[close-modal]", function (ev) {
|
|
735
|
+
var el = $(this);
|
|
736
|
+
var modal = el.closest("popup");
|
|
737
|
+
var id = modal.attr("id");
|
|
738
|
+
var element_to_remove = $("#" + id).get(0);
|
|
739
|
+
var index = $.inArray(element_to_remove, popups.modals);
|
|
740
|
+
var modalOwner = $("[modal][data-modal=" + id + "]");
|
|
741
|
+
if (el.attr("stop")) ev.stopPropagation();
|
|
742
|
+
ev.preventDefault();
|
|
743
|
+
if (modalOwner.hasAttr("@modal-beforeclose")) {
|
|
744
|
+
cl("kuku");
|
|
745
|
+
try {
|
|
746
|
+
let _bv = modalOwner.attr("@modal-beforeclose");
|
|
747
|
+
let _fn = _bv.split("(")[0];
|
|
748
|
+
if (typeof window[_bv] === "function") {
|
|
749
|
+
cl("sasha");
|
|
750
|
+
if (window[_fn](ev, el, modalOwner) == false) return;
|
|
751
|
+
else {
|
|
752
|
+
cl("llll");
|
|
753
|
+
let _eva = eval(_bv);
|
|
754
|
+
if (_eva == false) return;
|
|
755
|
+
cl("khaaawwwww");
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
} catch (e) {
|
|
759
|
+
cl("haha");
|
|
760
|
+
cl(e);
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
if (modalOwner.hasAttr("@modal-close")) {
|
|
764
|
+
modalOwner.trigger("modal-close", [
|
|
765
|
+
modal,
|
|
766
|
+
function (res) {
|
|
767
|
+
if (res === false) return;
|
|
768
|
+
$(
|
|
769
|
+
".select2-container:not(.select2),.colorpicker.colorpicker-visible"
|
|
770
|
+
).remove();
|
|
771
|
+
if (index > -1) {
|
|
772
|
+
$("[modal][data-modal=" + id + "]").removeAttr("data-modal");
|
|
773
|
+
modal
|
|
774
|
+
.removeClass("in")
|
|
775
|
+
.delay(150)
|
|
776
|
+
.queue(function (next) {
|
|
777
|
+
$(this).remove();
|
|
778
|
+
if (popups.modals.length == 0) bs(true);
|
|
779
|
+
next();
|
|
780
|
+
});
|
|
781
|
+
popups.modals.splice(index, 1);
|
|
782
|
+
}
|
|
783
|
+
},
|
|
784
|
+
]);
|
|
785
|
+
} else {
|
|
786
|
+
$(
|
|
787
|
+
".select2-container:not(.select2),.colorpicker.colorpicker-visible"
|
|
788
|
+
).remove();
|
|
789
|
+
if (index > -1) {
|
|
790
|
+
$("[modal][data-modal=" + id + "]").removeAttr("data-modal");
|
|
791
|
+
modal
|
|
792
|
+
.removeClass("in")
|
|
793
|
+
.delay(150)
|
|
794
|
+
.queue(function (next) {
|
|
795
|
+
$(this).remove();
|
|
796
|
+
if (popups.modals.length == 0) bs(true);
|
|
797
|
+
next();
|
|
798
|
+
});
|
|
799
|
+
popups.modals.splice(index, 1);
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
});
|
|
803
|
+
|
|
804
|
+
$("body").on("change keyup", "[password]", function (e) {
|
|
805
|
+
let el = $(this);
|
|
806
|
+
let lbl = el.closest("label");
|
|
807
|
+
let f = el.closest("form");
|
|
808
|
+
var v = $.trim($(this).val());
|
|
809
|
+
let allCls = "has-spaces weak strong very-strong medium";
|
|
810
|
+
let cls = passwordStrength(v);
|
|
811
|
+
|
|
812
|
+
el.removeClass(allCls).addClass(cls);
|
|
813
|
+
if (f.length) f.removeClass(allCls).addClass(cls);
|
|
814
|
+
if (lbl.length) lbl.removeClass(allCls).addClass(cls);
|
|
815
|
+
|
|
816
|
+
if (!$(this).next().hasClass("passStrength"))
|
|
817
|
+
$(this).after("<span class='passStrength'></span>");
|
|
818
|
+
$(this).parent().find(".passStrength").removeClass(allCls).addClass(cls);
|
|
819
|
+
});
|
|
820
|
+
|
|
821
|
+
$("body").on("change keyup", "[username]", function (e) {
|
|
822
|
+
var keyCode = e.keyCode || e.which;
|
|
823
|
+
if (
|
|
824
|
+
keyCode != 9 &&
|
|
825
|
+
keyCode != 16 &&
|
|
826
|
+
keyCode != 27 &&
|
|
827
|
+
keyCode != 93 &&
|
|
828
|
+
keyCode != 91 &&
|
|
829
|
+
keyCode != 17 &&
|
|
830
|
+
keyCode != 18
|
|
831
|
+
) {
|
|
832
|
+
var el = $(this);
|
|
833
|
+
let f = el.closest("form");
|
|
834
|
+
checkFormInputs(f, el, true);
|
|
835
|
+
}
|
|
836
|
+
});
|
|
837
|
+
|
|
838
|
+
// ############################ FORM VALIDATION ############################
|
|
839
|
+
// >>>>>>>>>>>>>>>>>>>> Input on focus(typing in it) <<<<<<<<<<<<<<<<<<<<<<<
|
|
840
|
+
$("body").on(
|
|
841
|
+
"focus",
|
|
842
|
+
"input:not(.select2-search__field,.mobinit),textarea,select",
|
|
843
|
+
function (ev) {
|
|
844
|
+
var el = $(this);
|
|
845
|
+
var f = el.closest("form");
|
|
846
|
+
let lbl = el.closest("label");
|
|
847
|
+
if (f.length) f.addClass("focused");
|
|
848
|
+
if (lbl.length) lbl.addClass("focused");
|
|
849
|
+
el.parent().addClass("focused");
|
|
850
|
+
el.addClass("focused");
|
|
851
|
+
}
|
|
852
|
+
);
|
|
853
|
+
// >>>>>>>>>>>>>>>>>>>> Input on focus(typing in it) <<<<<<<<<<<<<<<<<<<<<<<
|
|
854
|
+
|
|
855
|
+
// >>>>>>>>>>>>>>>>> Input on blur(stopped typing in it and press out of it) <<<<<<<<<<<<<<<<<<<
|
|
856
|
+
$("body").on(
|
|
857
|
+
"blur",
|
|
858
|
+
"input:not(.select2-search__field,.mobinit),textarea,select",
|
|
859
|
+
function (ev) {
|
|
860
|
+
var el = $(this);
|
|
861
|
+
var f = el.closest("form");
|
|
862
|
+
if (f.length) f.removeClass("focused");
|
|
863
|
+
el.parent().removeClass("focused");
|
|
864
|
+
el.removeClass("focused");
|
|
865
|
+
}
|
|
866
|
+
);
|
|
867
|
+
// >>>>>>>>>>>>>>>>> Input on blur(stopped typing in it and press out of it) <<<<<<<<<<<<<<<<<<<
|
|
868
|
+
|
|
869
|
+
// >>>>>>>>>>>>>>>>> Input change(change the input value) blur(remove focus) focus(type it) keyup(remove finger) keydown(put finger) <<<<<<<<<<<<<<<<<<<
|
|
870
|
+
$("body").on(
|
|
871
|
+
"change keyup",
|
|
872
|
+
"input:not(.select2-search__field,.mobinit),textarea,select",
|
|
873
|
+
function (ev) {
|
|
874
|
+
var el = $(this);
|
|
875
|
+
let f = el.closest("form");
|
|
876
|
+
checkFormInputs(f, el, true);
|
|
877
|
+
}
|
|
878
|
+
);
|
|
879
|
+
// >>>>>>>>>>>>>>>>> Input change(change the input value) blur(remove focus) focus(type it) keyup(remove finger) keydown(put finger) <<<<<<<<<<<<<<<<<<<
|
|
880
|
+
// ############################ FORM VALIDATION ############################
|
|
881
|
+
|
|
882
|
+
var _lookups = 0;
|
|
883
|
+
var _debs = {};
|
|
884
|
+
var _proms = {};
|
|
885
|
+
|
|
886
|
+
$("body").on("change keyup", "[\\:lookup]", function (e) {
|
|
887
|
+
var keyCode = e.keyCode || e.which;
|
|
888
|
+
if (
|
|
889
|
+
keyCode != 9 &&
|
|
890
|
+
keyCode != 16 &&
|
|
891
|
+
keyCode != 27 &&
|
|
892
|
+
keyCode != 93 &&
|
|
893
|
+
keyCode != 91 &&
|
|
894
|
+
keyCode != 17 &&
|
|
895
|
+
keyCode != 18
|
|
896
|
+
) {
|
|
897
|
+
var el = $(this);
|
|
898
|
+
if (!el.attr("data-i")) {
|
|
899
|
+
el.attr("data-i", _lookups);
|
|
900
|
+
_lookups++;
|
|
901
|
+
}
|
|
902
|
+
var key = "lu_" + el.attr("data-i");
|
|
903
|
+
|
|
904
|
+
clearTimeout(_debs[key]);
|
|
905
|
+
// $(this).removeClass('error success not-4-chars not-on-pattern');
|
|
906
|
+
// $(this).addClass('pending');
|
|
907
|
+
// var n = $(this).attr('data-n');
|
|
908
|
+
var v = $(this).val();
|
|
909
|
+
var callback = el.attr(":lookup-callback");
|
|
910
|
+
// var fi = $(this).closest('.fields');
|
|
911
|
+
if (!_proms.hasOwnProperty(key)) {
|
|
912
|
+
_proms[key] = defer();
|
|
913
|
+
_proms[key]
|
|
914
|
+
.then(function (val) {
|
|
915
|
+
el.addClass("finished").removeClass("pending");
|
|
916
|
+
})
|
|
917
|
+
.catch((reason) => {
|
|
918
|
+
el.addClass("pending").removeClass("finished");
|
|
919
|
+
});
|
|
920
|
+
} else {
|
|
921
|
+
// _proms[key].reject();
|
|
922
|
+
// _proms[key] = defer();
|
|
923
|
+
// _proms[key].then(function(val) {
|
|
924
|
+
// el.addClass('finished').removeClass('pending');
|
|
925
|
+
// }).catch((reason) => {
|
|
926
|
+
// el.addClass('pending').removeClass('finished');
|
|
927
|
+
// });
|
|
928
|
+
}
|
|
929
|
+
el.addClass("pending").removeClass("finished");
|
|
930
|
+
|
|
931
|
+
_debs[key] = setTimeout(function () {
|
|
932
|
+
_proms[key].reject();
|
|
933
|
+
_proms[key] = defer();
|
|
934
|
+
_proms[key]
|
|
935
|
+
.then(function (val) {
|
|
936
|
+
el.addClass("finished").removeClass("pending");
|
|
937
|
+
})
|
|
938
|
+
.catch((reason) => {
|
|
939
|
+
el.addClass("pending").removeClass("finished");
|
|
940
|
+
});
|
|
941
|
+
window[callback](v, _proms[key]);
|
|
942
|
+
}, 200);
|
|
943
|
+
|
|
944
|
+
// if (v.length < 4) {
|
|
945
|
+
// $(this).addClass('error not-4-chars');
|
|
946
|
+
// fi.addClass('error');
|
|
947
|
+
// $('[tip][for-username]').attr('tip', $(this).attr('data-4-chars')).click();
|
|
948
|
+
// return false;
|
|
949
|
+
// }
|
|
950
|
+
|
|
951
|
+
// prom.resolve();
|
|
952
|
+
// prom.reject();
|
|
953
|
+
|
|
954
|
+
// var k = v.match(/[A-Za-z]+(?!\.)(?!.*\.$)(?!.*?\.\.)[a-zA-Z0-9.]+[A-Za-z0-9]/);
|
|
955
|
+
// if (!k) {
|
|
956
|
+
// $(this).addClass('error not-on-pattern');
|
|
957
|
+
// fi.addClass('error');
|
|
958
|
+
// $('[tip][for-username]').attr('tip', $(this).attr('data-chars-not-allowed')).click();
|
|
959
|
+
// } else {
|
|
960
|
+
// if (k.input != k[0]) {
|
|
961
|
+
// $(this).addClass('error not-on-pattern');
|
|
962
|
+
// fi.addClass('error');
|
|
963
|
+
// $('[tip][for-username]').attr('tip', $(this).attr('data-chars-not-allowed')).click();
|
|
964
|
+
// return false;
|
|
965
|
+
// }
|
|
966
|
+
// }
|
|
967
|
+
}
|
|
968
|
+
});
|
|
969
|
+
|
|
970
|
+
// $('body').on('click touch', '[ci]', function (ev) {
|
|
971
|
+
// var el = $(this)
|
|
972
|
+
// var form = el.closest("form")
|
|
973
|
+
// var inputs = $("input[req]")
|
|
974
|
+
// for (var i = 0; i < inputs.length; i++) {
|
|
975
|
+
// if ($(inputs[i]).attr('type') === 'checkbox' || $(inputs[i]).attr('type') === 'radio') {
|
|
976
|
+
// if ($('input[req]:checked').length == 0 && $(inputs[i]).hasAttr('data-into')) {
|
|
977
|
+
// form.addClass("validation-error")
|
|
978
|
+
// if ($(inputs[i]).hasAttr('data-empty')) {
|
|
979
|
+
// $($(inputs[i]).attr('data-into')).text($(inputs[i]).attr('data-empty'))
|
|
980
|
+
// } else {
|
|
981
|
+
// alert("checkbox or radio don't have data-empty attribute")
|
|
982
|
+
// }
|
|
983
|
+
// }
|
|
984
|
+
// } else {
|
|
985
|
+
// if ($(inputs[i]).val().length === 0 && $(inputs[i]).hasAttr('data-into')) {
|
|
986
|
+
// form.addClass("validation-error")
|
|
987
|
+
// if ($(inputs[i]).hasAttr('data-empty')) {
|
|
988
|
+
// $($(inputs[i]).attr('data-into')).text($(inputs[i]).attr('data-empty'))
|
|
989
|
+
// } else {
|
|
990
|
+
// console.log("place holder ", $(inputs[i]).attr('placeholder'))
|
|
991
|
+
// alert($(inputs[i]).attr('placeholder'))
|
|
992
|
+
// }
|
|
993
|
+
// }
|
|
994
|
+
// }
|
|
995
|
+
// }
|
|
996
|
+
|
|
997
|
+
// });
|
|
998
|
+
|
|
999
|
+
// $('body').on('click touch', '[ci]', function (ev) {
|
|
1000
|
+
|
|
1001
|
+
// var el = $(this);
|
|
1002
|
+
// var f = el.closest('form');
|
|
1003
|
+
|
|
1004
|
+
// var inps = []; $(el.attr('ci')).each(function () { inps.push($(this).attr('name')); });
|
|
1005
|
+
|
|
1006
|
+
// for (var i = 0; i < inps.length; i++) {
|
|
1007
|
+
// var inp = f.find("input[name='" + inps[i] + "']");
|
|
1008
|
+
// var sel = f.find('select[name="' + inps[i] + '"]');
|
|
1009
|
+
// var txt = f.find('textarea[name="' + inps[i] + '"]');
|
|
1010
|
+
// var e = inp; if (!e.length) e = sel; if (!e.length) e = txt;
|
|
1011
|
+
// var or = e.attr('or');
|
|
1012
|
+
|
|
1013
|
+
// // alert(or);
|
|
1014
|
+
|
|
1015
|
+
// if (or != "") {
|
|
1016
|
+
// var inp2 = f.find("input[name='" + or + "']");
|
|
1017
|
+
// var sel2 = f.find('select[name="' + or + '"]');
|
|
1018
|
+
// var txt2 = f.find('textarea[name="' + or + '"]');
|
|
1019
|
+
// var or = inp2; if (!or.length) or = sel2; if (!or.length) or = txt2;
|
|
1020
|
+
// }
|
|
1021
|
+
|
|
1022
|
+
// // alert(or.val());
|
|
1023
|
+
|
|
1024
|
+
// if (e.is(':checkbox') || e.is(':radio')) {
|
|
1025
|
+
// if (!e.is(":checked")) {
|
|
1026
|
+
// if (or.length) {
|
|
1027
|
+
// if (!or.is(":checked")) {
|
|
1028
|
+
// alert(e.attr('placeholder') + ' or ' + or.attr('placeholder'));
|
|
1029
|
+
// e.addClass('error');
|
|
1030
|
+
// e.focus();
|
|
1031
|
+
// ev.preventDefault();
|
|
1032
|
+
// ev.stopPropagation();
|
|
1033
|
+
// return false;
|
|
1034
|
+
// }
|
|
1035
|
+
// } else {
|
|
1036
|
+
// alert(e.attr('placeholder'));
|
|
1037
|
+
// e.addClass('error');
|
|
1038
|
+
// e.focus();
|
|
1039
|
+
// ev.preventDefault();
|
|
1040
|
+
// ev.stopPropagation();
|
|
1041
|
+
// return false;
|
|
1042
|
+
// }
|
|
1043
|
+
// }
|
|
1044
|
+
// } else {
|
|
1045
|
+
// if ($.trim(e.val()).length == 0) {
|
|
1046
|
+
// if (or.length) {
|
|
1047
|
+
// if ($.trim(or.val()).length == 0) {
|
|
1048
|
+
// alert(e.attr('placeholder') + ' or ' + or.attr('placeholder'));
|
|
1049
|
+
// e.addClass('error');
|
|
1050
|
+
// e.focus();
|
|
1051
|
+
// ev.preventDefault();
|
|
1052
|
+
// ev.stopPropagation();
|
|
1053
|
+
// return false;
|
|
1054
|
+
// }
|
|
1055
|
+
// } else {
|
|
1056
|
+
// if (e.attr('data-into')) {
|
|
1057
|
+
// $(e.attr('data-into')).html(e.attr('data-empty') ?? e.attr('placeholder'))
|
|
1058
|
+
// } else {
|
|
1059
|
+
// alert(e.attr('placeholder'));
|
|
1060
|
+
// }
|
|
1061
|
+
// e.addClass('error');
|
|
1062
|
+
// e.focus();
|
|
1063
|
+
// ev.preventDefault();
|
|
1064
|
+
// ev.stopPropagation();
|
|
1065
|
+
// return false;
|
|
1066
|
+
// }
|
|
1067
|
+
// }
|
|
1068
|
+
|
|
1069
|
+
// if (e.attr('data-into')) {
|
|
1070
|
+
// $(e.attr('data-into')).html("")
|
|
1071
|
+
// }
|
|
1072
|
+
|
|
1073
|
+
// if (e.is('[password]')) {
|
|
1074
|
+
// if (!passwordValid(e.val())) {
|
|
1075
|
+
// alert(e.attr('data-wpm'));
|
|
1076
|
+
// e.addClass('error');
|
|
1077
|
+
// e.focus();
|
|
1078
|
+
// ev.preventDefault();
|
|
1079
|
+
// ev.stopPropagation();
|
|
1080
|
+
// return false;
|
|
1081
|
+
// }
|
|
1082
|
+
// }
|
|
1083
|
+
// if (e.is('[rpassword]')) {
|
|
1084
|
+
// if ($.trim(e.val()) != $.trim(e.closest('form').find('[password]').val())) {
|
|
1085
|
+
// e.addClass('error');
|
|
1086
|
+
// alert(e.attr('data-pnm'));
|
|
1087
|
+
// e.focus();
|
|
1088
|
+
// ev.preventDefault();
|
|
1089
|
+
// ev.stopPropagation();
|
|
1090
|
+
// return false;
|
|
1091
|
+
// }
|
|
1092
|
+
// e.removeClass('error');
|
|
1093
|
+
// $('.passStrength').remove();
|
|
1094
|
+
// }
|
|
1095
|
+
|
|
1096
|
+
// }
|
|
1097
|
+
|
|
1098
|
+
// }
|
|
1099
|
+
// });
|
|
1100
|
+
|
|
1101
|
+
$("body").on("click touch", "a,area", function (e) {
|
|
1102
|
+
var el = $(this);
|
|
1103
|
+
var link = el.attr("href");
|
|
1104
|
+
|
|
1105
|
+
if (
|
|
1106
|
+
link == "" ||
|
|
1107
|
+
$(this).closest(".cke").length == 1 ||
|
|
1108
|
+
$(this).closest(".chosen-container").length == 1 ||
|
|
1109
|
+
$(this).attr("target") == "_blank" ||
|
|
1110
|
+
$(this).attr("target") == "_new" ||
|
|
1111
|
+
$(this).hasClass("norm") ||
|
|
1112
|
+
$(this).closest(".gm-style").length == 1
|
|
1113
|
+
) {
|
|
1114
|
+
} else {
|
|
1115
|
+
var local = false;
|
|
1116
|
+
|
|
1117
|
+
// alert(link);
|
|
1118
|
+
|
|
1119
|
+
var l = getLocation(link);
|
|
1120
|
+
var l2 = getLocation(appSettings.Base);
|
|
1121
|
+
// console.log("ll ",[l])
|
|
1122
|
+
var url = "home";
|
|
1123
|
+
local = l.hostname == l2.hostname;
|
|
1124
|
+
|
|
1125
|
+
var url = l.pathname.split(l2.pathname);
|
|
1126
|
+
|
|
1127
|
+
// alert(url);
|
|
1128
|
+
|
|
1129
|
+
if (l.pathname == "/" || l.pathname == "/home") {
|
|
1130
|
+
url = "home";
|
|
1131
|
+
} else {
|
|
1132
|
+
url = url.join("/");
|
|
1133
|
+
}
|
|
1134
|
+
// alert(url);
|
|
1135
|
+
|
|
1136
|
+
if (local && !cntrlon) {
|
|
1137
|
+
e.preventDefault();
|
|
1138
|
+
if (el.hasAttr("stop")) e.stopPropagation();
|
|
1139
|
+
|
|
1140
|
+
pushURL(url + (l.search != "" ? l.search : "") ?? "home");
|
|
1141
|
+
} else {
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
});
|
|
1145
|
+
|
|
1146
|
+
$("body").on("click touch", "[h],[s]", function (e) {
|
|
1147
|
+
var el = $(this);
|
|
1148
|
+
|
|
1149
|
+
if (el.hasAttr("confirm")) if (!confirm(el.attr("confirm"))) return false;
|
|
1150
|
+
if (el.hasAttr("econfirm")) eval(el.attr("econfirm"));
|
|
1151
|
+
var attrs = el.attr();
|
|
1152
|
+
|
|
1153
|
+
var hI = Object.keys(attrs).indexOf("h");
|
|
1154
|
+
var sI = Object.keys(attrs).indexOf("s");
|
|
1155
|
+
if (sI < hI) {
|
|
1156
|
+
$(el.attr("s")).show();
|
|
1157
|
+
$(el.attr("h")).hide();
|
|
1158
|
+
} else {
|
|
1159
|
+
$(el.attr("h")).hide();
|
|
1160
|
+
$(el.attr("s")).show();
|
|
1161
|
+
}
|
|
1162
|
+
if (el.hasAttr("stop")) e.stopPropagation();
|
|
1163
|
+
});
|
|
1164
|
+
|
|
1165
|
+
$("body").on("click touch", "[e]", function (e) {
|
|
1166
|
+
var el = $(this);
|
|
1167
|
+
if (el.hasAttr("confirm")) if (!confirm(el.attr("confirm"))) return false;
|
|
1168
|
+
if (el.hasAttr("econfirm")) eval(el.attr("econfirm"));
|
|
1169
|
+
if ($($(this).attr("e")).is("input")) $($(this).attr("e")).val("");
|
|
1170
|
+
else $($(this).attr("e")).empty();
|
|
1171
|
+
});
|
|
1172
|
+
|
|
1173
|
+
$("body").on("click touch", "[f]", function (e) {
|
|
1174
|
+
var el = $(this);
|
|
1175
|
+
$(el.attr("f")).trigger("focus");
|
|
1176
|
+
if (el.hasAttr("stop")) e.stopPropagation();
|
|
1177
|
+
});
|
|
1178
|
+
$("body").on("click touch", "[tgl]", function (e) {
|
|
1179
|
+
var el = $(this);
|
|
1180
|
+
if (el.hasAttr("confirm")) if (!confirm(el.attr("confirm"))) return false;
|
|
1181
|
+
if (el.hasAttr("econfirm")) eval(el.attr("econfirm"));
|
|
1182
|
+
el.toggleClass(el.attr("tgl"));
|
|
1183
|
+
el.toggleClass("toggled");
|
|
1184
|
+
if (el.hasAttr("stop")) e.stopPropagation();
|
|
1185
|
+
});
|
|
1186
|
+
|
|
1187
|
+
$("body").on("click touch", "[t]", function (e) {
|
|
1188
|
+
var el = $(this);
|
|
1189
|
+
var tcn = el.attr("tcn") ? el.attr("tcn") : "active";
|
|
1190
|
+
if (el.hasAttr("confirm")) if (!confirm(el.attr("confirm"))) return false;
|
|
1191
|
+
if (el.hasAttr("econfirm")) eval(el.attr("econfirm"));
|
|
1192
|
+
$(el.attr("t")).toggleClass(tcn);
|
|
1193
|
+
el.toggleClass("toggled");
|
|
1194
|
+
if (el.hasAttr("stop")) e.stopPropagation();
|
|
1195
|
+
});
|
|
1196
|
+
|
|
1197
|
+
$("body").on("click touch", "[actv]", function (e) {
|
|
1198
|
+
let el = $(this);
|
|
1199
|
+
if (el.attr("actv") != "") $(el.attr("actv")).removeClass("active");
|
|
1200
|
+
el.addClass("active");
|
|
1201
|
+
if (el.attr("stop")) e.stopPropagation();
|
|
1202
|
+
});
|
|
1203
|
+
|
|
1204
|
+
$("body").on("click touch", "[actvt]", function (e) {
|
|
1205
|
+
let el = $(this);
|
|
1206
|
+
if (el.attr("actvt") != "") $(el.attr("actvt")).removeClass("active");
|
|
1207
|
+
if (el.hasClass("active")) el.removeClass("active");
|
|
1208
|
+
else el.addClass("active");
|
|
1209
|
+
if (el.attr("stop")) e.stopPropagation();
|
|
1210
|
+
});
|
|
1211
|
+
|
|
1212
|
+
$("body").on("click touch", "[close-notify]", function (e) {
|
|
1213
|
+
var tis = $(this).parent();
|
|
1214
|
+
tis.fadeOut(function () {
|
|
1215
|
+
tis.remove();
|
|
1216
|
+
});
|
|
1217
|
+
if ($(this).attr("stop")) e.stopPropagation();
|
|
1218
|
+
});
|
|
1219
|
+
|
|
1220
|
+
let _keyInt;
|
|
1221
|
+
$("body").on(
|
|
1222
|
+
"change blur focus keyup keydown input", '[icons_search]', function (ev) {
|
|
1223
|
+
var key = $.trim($(this).val());
|
|
1224
|
+
var outlet = $($(this).attr('icons_outlet'));
|
|
1225
|
+
var count_outlet = $($(this).attr('icons_count_outlet'));
|
|
1226
|
+
clearTimeout(_keyInt);
|
|
1227
|
+
if (key == "" || key.length <= 2) {
|
|
1228
|
+
count_outlet.hide();
|
|
1229
|
+
outlet.html('');
|
|
1230
|
+
} else {
|
|
1231
|
+
_keyInt = setTimeout(function () {
|
|
1232
|
+
|
|
1233
|
+
fetch('https://api.iconify.design/search?query=' + key + '&limit=250', {
|
|
1234
|
+
method: 'GET'
|
|
1235
|
+
})
|
|
1236
|
+
.then(function (response) { return response.json(); })
|
|
1237
|
+
.then(function (r) {
|
|
1238
|
+
count_outlet.show();
|
|
1239
|
+
let icons = r.icons;
|
|
1240
|
+
outlet.html('');
|
|
1241
|
+
count_outlet.html((r.total > 250 ? r.total + '+' : r.total) + ' ' + 'icons found..');
|
|
1242
|
+
for (let i = 0; i < icons.length; i++) {
|
|
1243
|
+
outlet.append(`
|
|
1244
|
+
<li class="w20 md_w25 m_w33 m_m_w50 c icoLi" data-class="`+ icons[i] + `"><div><span class="iconify fs24 mb5 lh40 g_nm" style="height: 40px;" data-icon="` + icons[i] + `" ></span><span class="name-class">` + icons[i] + `</span></div></li>
|
|
1245
|
+
`);
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
});
|
|
1249
|
+
}, 400);
|
|
1250
|
+
}
|
|
1251
|
+
});
|
|
1252
|
+
|
|
1253
|
+
$("body").on("click touch", "[alert]", function (e) {
|
|
1254
|
+
notify(
|
|
1255
|
+
$(this).attr("alert-t"),
|
|
1256
|
+
$(this).attr("alert"),
|
|
1257
|
+
$(this).attr("alert-icon") ? $(this).attr("alert-icon") : "alert-circle",
|
|
1258
|
+
$(this).attr("alert-type") ? $(this).attr("alert-type") : "alert"
|
|
1259
|
+
);
|
|
1260
|
+
});
|
|
1261
|
+
|
|
1262
|
+
$("body").on("click touch", "[rcl],[acl]", function (e) {
|
|
1263
|
+
var el = $(this);
|
|
1264
|
+
if (el.hasAttr("confirm")) if (!confirm(el.attr("confirm"))) return false;
|
|
1265
|
+
if (el.hasAttr("econfirm")) eval(el.attr("econfirm"));
|
|
1266
|
+
|
|
1267
|
+
if (el.hasAttr("acl") && el.hasAttr("rcl")) {
|
|
1268
|
+
var attrs = el.attr();
|
|
1269
|
+
|
|
1270
|
+
var rclcn = el.attr("rclcn") ? el.attr("rclcn") : "active";
|
|
1271
|
+
var aclcn = el.attr("aclcn") ? el.attr("aclcn") : "active";
|
|
1272
|
+
var rCl = Object.keys(attrs).indexOf("rcl");
|
|
1273
|
+
var aCl = Object.keys(attrs).indexOf("acl");
|
|
1274
|
+
if (aCl < rCl) {
|
|
1275
|
+
$(el.attr("acl")).addClass(aclcn);
|
|
1276
|
+
el.addClass("added").removeClass("removed");
|
|
1277
|
+
if (el.hasAttr("stop")) e.stopPropagation();
|
|
1278
|
+
|
|
1279
|
+
$(el.attr("rcl")).removeClass(rclcn);
|
|
1280
|
+
el.addClass("removed").removeClass("added");
|
|
1281
|
+
if (el.hasAttr("stop")) e.stopPropagation();
|
|
1282
|
+
} else {
|
|
1283
|
+
$(el.attr("rcl")).removeClass(rclcn);
|
|
1284
|
+
el.addClass("removed").removeClass("added");
|
|
1285
|
+
if (el.hasAttr("stop")) e.stopPropagation();
|
|
1286
|
+
|
|
1287
|
+
$(el.attr("acl")).addClass(aclcn);
|
|
1288
|
+
el.addClass("added").removeClass("removed");
|
|
1289
|
+
if (el.hasAttr("stop")) e.stopPropagation();
|
|
1290
|
+
}
|
|
1291
|
+
} else {
|
|
1292
|
+
if (el.hasAttr("rcl")) {
|
|
1293
|
+
var rclcn = el.attr("rclcn") ? el.attr("rclcn") : "active";
|
|
1294
|
+
$(el.attr("rcl")).removeClass(rclcn);
|
|
1295
|
+
el.addClass("removed").removeClass("added");
|
|
1296
|
+
if (el.hasAttr("stop")) e.stopPropagation();
|
|
1297
|
+
} else {
|
|
1298
|
+
var aclcn = el.attr("aclcn") ? el.attr("aclcn") : "active";
|
|
1299
|
+
$(el.attr("acl")).addClass(aclcn);
|
|
1300
|
+
el.addClass("added").removeClass("removed");
|
|
1301
|
+
if (el.hasAttr("stop")) e.stopPropagation();
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
});
|
|
1305
|
+
|
|
1306
|
+
$("body").on("click touch", "[st]", function (e) {
|
|
1307
|
+
st($(this).attr("st"));
|
|
1308
|
+
});
|
|
1309
|
+
|
|
1310
|
+
class Loader {
|
|
1311
|
+
options = {
|
|
1312
|
+
Dismissible: true,
|
|
1313
|
+
Class: "loader",
|
|
1314
|
+
Message: "Please Wait...",
|
|
1315
|
+
};
|
|
1316
|
+
|
|
1317
|
+
constructor(options) {
|
|
1318
|
+
for (var k in options) {
|
|
1319
|
+
this.options[k] = options[k];
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
|
|
1323
|
+
dismiss() {
|
|
1324
|
+
if (this.options.Dismissible) {
|
|
1325
|
+
this.hide();
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
init() {
|
|
1330
|
+
let l = `
|
|
1331
|
+
<div loader class="${this.options.Class}">
|
|
1332
|
+
<div class="ov pf" @click="_loader.dismiss()"></div>
|
|
1333
|
+
<div class="wrapper cc sh20">
|
|
1334
|
+
<div class="animation"></div>
|
|
1335
|
+
<div class="text">${this.options.Message}</div>
|
|
1336
|
+
</div>
|
|
1337
|
+
</div>
|
|
1338
|
+
`;
|
|
1339
|
+
$("body").append(l);
|
|
1340
|
+
|
|
1341
|
+
if (this.options.hasOwnProperty("Progress")) {
|
|
1342
|
+
var min = this.options.Progress;
|
|
1343
|
+
var max = 100;
|
|
1344
|
+
if (this.options.hasOwnProperty("MaxProgress"))
|
|
1345
|
+
max = this.options.MaxProgress;
|
|
1346
|
+
$("." + this.options.Class + "[loader] .wrapper").append(
|
|
1347
|
+
$('<div class="prog">' + min + "/" + max + "</div>")
|
|
1348
|
+
);
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
|
|
1352
|
+
show() {
|
|
1353
|
+
if ($("." + this.options.Class + "[loader]").length) return;
|
|
1354
|
+
this.init();
|
|
1355
|
+
$("body").css("overflow", "hidden");
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1358
|
+
hide() {
|
|
1359
|
+
$("." + this.options.Class + "[loader]").unbind("click");
|
|
1360
|
+
$("." + this.options.Class + "[loader]").remove();
|
|
1361
|
+
$("body").css("overflow", "auto");
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
update(options) {
|
|
1365
|
+
for (var k in options) {
|
|
1366
|
+
this.options[k] = options[k];
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
if (options.hasOwnProperty("Message")) {
|
|
1370
|
+
$("." + this.options.Class + "[loader] .wrapper .text").html(
|
|
1371
|
+
options.Message
|
|
1372
|
+
);
|
|
1373
|
+
}
|
|
1374
|
+
if (options.hasOwnProperty("Progress")) {
|
|
1375
|
+
var max = 100;
|
|
1376
|
+
if (options.hasOwnProperty("MaxProgress")) max = this.options.MaxProgress;
|
|
1377
|
+
if (!$("." + this.options.Class + "[loader] .wrapper .prog").length)
|
|
1378
|
+
$("." + this.options.Class + "[loader] .wrapper").append(
|
|
1379
|
+
$('<div class="prog">' + options.Progress + "/" + max + "</div>")
|
|
1380
|
+
);
|
|
1381
|
+
else
|
|
1382
|
+
$("." + this.options.Class + "[loader] .wrapper .prog").html(
|
|
1383
|
+
options.Progress + "/" + max
|
|
1384
|
+
);
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
var _loader = new Loader();
|
|
1389
|
+
/**************************************/
|
|
1390
|
+
/****** END GLOBAL EVENTS LISTENERS ***/
|
|
1391
|
+
/**************************************/
|