PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.9
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.9
4.4.9 4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 All 140 releases
← All changes | assets/js/dist/utils.js +252 -484 4.1.7.1 → 4.4.9 View file →
@@ -1,49 +1,45 @@
1 -/******/ (function() { // webpackBootstrap
1 +/******/ (() => { // webpackBootstrap
2 2 /******/ var __webpack_modules__ = ({
3 3
4 -/***/ "./assets/src/js/utils/cookies.js":
4 +/***/ "./assets/src/js/utils/cookies.js"
5 5 /*!****************************************!*\
6 6 !*** ./assets/src/js/utils/cookies.js ***!
7 7 \****************************************/
8 -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
8 +(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
9 9
10 10 "use strict";
11 11 __webpack_require__.r(__webpack_exports__);
12 +/* harmony export */ __webpack_require__.d(__webpack_exports__, {
13 +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
14 +/* harmony export */ });
12 15 const Cookies = {
13 16 get: (name, def, global) => {
14 17 let ret;
15 -
16 18 if (global) {
17 19 ret = wpCookies.get(name);
18 20 } else {
19 21 let ck = wpCookies.get('LP');
20 -
21 22 if (ck) {
22 23 ck = JSON.parse(ck);
23 24 ret = name ? ck[name] : ck;
24 25 }
25 26 }
26 -
27 27 if (!ret && ret !== def) {
28 28 ret = def;
29 29 }
30 -
31 30 return ret;
32 31 },
33 -
34 32 set(name, value, expires, path, domain, secure) {
35 33 if (arguments.length > 2) {
36 34 wpCookies.set(name, value, expires, path, domain, secure);
37 35 } else if (arguments.length == 2) {
38 36 let ck = wpCookies.get('LP');
39 -
40 37 if (ck) {
41 38 ck = JSON.parse(ck);
42 39 } else {
43 40 ck = {};
44 41 }
45 -
46 42 ck[name] = value;
47 43 wpCookies.set('LP', JSON.stringify(ck), '', '/');
48 44 } else {
49 45 wpCookies.set('LP', JSON.stringify(name), '', '/');
@@ -48,15 +44,13 @@
48 44 } else {
49 45 wpCookies.set('LP', JSON.stringify(name), '', '/');
50 46 }
51 47 },
52 -
53 48 remove(name) {
54 49 const allCookies = Cookies.get();
55 50 const reg = new RegExp(name, 'g');
56 51 const newCookies = {};
57 52 const useRegExp = name.match(/\*/);
58 -
59 53 for (const i in allCookies) {
60 54 if (useRegExp) {
61 55 if (!i.match(reg)) {
62 56 newCookies[i] = allCookies[i];
@@ -64,25 +58,26 @@
64 58 } else if (name != i) {
65 59 newCookies[i] = allCookies[i];
66 60 }
67 61 }
68 -
69 62 Cookies.set(newCookies);
70 63 }
71 -
72 64 };
73 -/* harmony default export */ __webpack_exports__["default"] = (Cookies);
65 +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Cookies);
74 66
75 -/***/ }),
67 +/***/ },
76 68
77 -/***/ "./assets/src/js/utils/event-callback.js":
69 +/***/ "./assets/src/js/utils/event-callback.js"
78 70 /*!***********************************************!*\
79 71 !*** ./assets/src/js/utils/event-callback.js ***!
80 72 \***********************************************/
81 -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
73 +(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
82 74
83 75 "use strict";
84 76 __webpack_require__.r(__webpack_exports__);
77 +/* harmony export */ __webpack_require__.d(__webpack_exports__, {
78 +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
79 +/* harmony export */ });
85 80 /**
86 81 * Manage event callbacks.
87 82 Allow add/remove a callback function into custom event of an object.
88 83 *
@@ -91,58 +86,45 @@
91 86 */
92 87 const Event_Callback = function Event_Callback(self) {
93 88 const callbacks = {};
94 89 const $ = window.jQuery;
95 -
96 90 this.on = function (event, callback) {
97 91 let namespaces = event.split('.'),
98 - namespace = '';
99 -
92 + namespace = '';
100 93 if (namespaces.length > 1) {
101 94 event = namespaces[0];
102 95 namespace = namespaces[1];
103 96 }
104 -
105 97 if (!callbacks[event]) {
106 98 callbacks[event] = [[], {}];
107 99 }
108 -
109 100 if (namespace) {
110 101 if (!callbacks[event][1][namespace]) {
111 102 callbacks[event][1][namespace] = [];
112 103 }
113 -
114 104 callbacks[event][1][namespace].push(callback);
115 105 } else {
116 106 callbacks[event][0].push(callback);
117 107 }
118 -
119 108 return self;
120 109 };
121 -
122 110 this.off = function (event, callback) {
123 111 let namespaces = event.split('.'),
124 - namespace = '';
125 -
112 + namespace = '';
126 113 if (namespaces.length > 1) {
127 114 event = namespaces[0];
128 115 namespace = namespaces[1];
129 116 }
130 -
131 117 if (!callbacks[event]) {
132 118 return self;
133 119 }
134 -
135 120 let at = -1;
136 -
137 121 if (!namespace) {
138 122 if (typeof callback === 'function') {
139 123 at = callbacks[event][0].indexOf(callback);
140 -
141 124 if (at < 0) {
142 125 return self;
143 126 }
144 -
145 127 callbacks[event][0].splice(at, 1);
146 128 } else {
147 129 callbacks[event][0] = [];
148 130 }
@@ -149,36 +131,29 @@
149 131 } else {
150 132 if (!callbacks[event][1][namespace]) {
151 133 return self;
152 134 }
153 -
154 135 if (typeof callback === 'function') {
155 136 at = callbacks[event][1][namespace].indexOf(callback);
156 -
157 137 if (at < 0) {
158 138 return self;
159 139 }
160 -
161 140 callbacks[event][1][namespace].splice(at, 1);
162 141 } else {
163 142 callbacks[event][1][namespace] = [];
164 143 }
165 144 }
166 -
167 145 return self;
168 146 };
169 -
170 147 this.callEvent = function (event, callbackArgs) {
171 148 if (!callbacks[event]) {
172 149 return;
173 150 }
174 -
175 151 if (callbacks[event][0]) {
176 152 for (var i = 0; i < callbacks[event][0].length; i++) {
177 153 typeof callbacks[event][0][i] === 'function' && callbacks[event][i][0].apply(self, callbackArgs);
178 154 }
179 155 }
180 -
181 156 if (callbacks[event][1]) {
182 157 for (var i in callbacks[event][1]) {
183 158 for (let j = 0; j < callbacks[event][1][i].length; j++) {
184 159 typeof callbacks[event][1][i][j] === 'function' && callbacks[event][1][i][j].apply(self, callbackArgs);
@@ -186,27 +161,26 @@
186 161 }
187 162 }
188 163 };
189 164 };
165 +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Event_Callback);
190 166
191 -/* harmony default export */ __webpack_exports__["default"] = (Event_Callback);
167 +/***/ },
192 168
193 -/***/ }),
194 -
195 -/***/ "./assets/src/js/utils/extend.js":
169 +/***/ "./assets/src/js/utils/extend.js"
196 170 /*!***************************************!*\
197 171 !*** ./assets/src/js/utils/extend.js ***!
198 172 \***************************************/
199 -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
173 +(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
200 174
201 175 "use strict";
202 176 __webpack_require__.r(__webpack_exports__);
203 177 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
204 -/* harmony export */ "default": function() { return /* export default binding */ __WEBPACK_DEFAULT_EXPORT__; }
178 +/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)
205 179 /* harmony export */ });
180 +Object.defineProperty(__WEBPACK_DEFAULT_EXPORT__, "name", { value: "default", configurable: true });
206 181 /* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__() {
207 182 window.LP = window.LP || {};
208 -
209 183 if (typeof arguments[0] === 'string') {
210 184 LP[arguments[0]] = LP[arguments[0]] || {};
211 185 LP[arguments[0]] = jQuery.extend(LP[arguments[0]], arguments[1]);
212 186 } else {
@@ -213,18 +187,21 @@
213 187 LP = jQuery.extend(LP, arguments[0]);
214 188 }
215 189 }
216 190
217 -/***/ }),
191 +/***/ },
218 192
219 -/***/ "./assets/src/js/utils/fn.js":
193 +/***/ "./assets/src/js/utils/fn.js"
220 194 /*!***********************************!*\
221 195 !*** ./assets/src/js/utils/fn.js ***!
222 196 \***********************************/
223 -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
197 +(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
224 198
225 199 "use strict";
226 200 __webpack_require__.r(__webpack_exports__);
201 +/* harmony export */ __webpack_require__.d(__webpack_exports__, {
202 +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
203 +/* harmony export */ });
227 204 /**
228 205 * Auto prepend `LP` prefix for jQuery fn plugin name.
229 206 *
230 207 * Create : $.fn.LP( 'PLUGIN_NAME', func) <=> $.fn.LP_PLUGIN_NAME
@@ -231,92 +208,80 @@
231 208 * Usage: $(selector).LP('PLUGIN_NAME') <=> $(selector).LP_PLUGIN_NAME()
232 209 *
233 210 * @version 3.2.6
234 211 */
212 +
235 213 const $ = window.jQuery;
236 214 let exp;
237 -
238 215 (function () {
239 216 if ($ === undefined) {
240 217 return;
241 218 }
242 -
243 219 $.fn.LP = exp = function (widget, fn) {
244 220 if (typeof fn === 'function') {
245 221 $.fn['LP_' + widget] = fn;
246 222 } else if (widget) {
247 223 const args = [];
248 -
249 224 if (arguments.length > 1) {
250 225 for (let i = 1; i < arguments.length; i++) {
251 226 args.push(arguments[i]);
252 227 }
253 228 }
254 -
255 229 return typeof $(this)['LP_' + widget] === 'function' ? $(this)['LP_' + widget].apply(this, args) : this;
256 230 }
257 -
258 231 return this;
259 232 };
260 233 })();
234 +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (exp);
261 235
262 -/* harmony default export */ __webpack_exports__["default"] = (exp);
236 +/***/ },
263 237
264 -/***/ }),
265 -
266 -/***/ "./assets/src/js/utils/hook.js":
238 +/***/ "./assets/src/js/utils/hook.js"
267 239 /*!*************************************!*\
268 240 !*** ./assets/src/js/utils/hook.js ***!
269 241 \*************************************/
270 -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
242 +(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
271 243
272 244 "use strict";
273 245 __webpack_require__.r(__webpack_exports__);
246 +/* harmony export */ __webpack_require__.d(__webpack_exports__, {
247 +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
248 +/* harmony export */ });
274 249 const Hook = {
275 250 hooks: {
276 251 action: {},
277 252 filter: {}
278 253 },
279 -
280 254 addAction(action, callable, priority, tag) {
281 255 this.addHook('action', action, callable, priority, tag);
282 256 return this;
283 257 },
284 -
285 258 addFilter(action, callable, priority, tag) {
286 259 this.addHook('filter', action, callable, priority, tag);
287 260 return this;
288 261 },
289 -
290 262 doAction(action) {
291 263 return this.doHook('action', action, arguments);
292 264 },
293 -
294 265 applyFilters(action) {
295 266 return this.doHook('filter', action, arguments);
296 267 },
297 -
298 268 removeAction(action, tag) {
299 269 this.removeHook('action', action, tag);
300 270 return this;
301 271 },
302 -
303 272 removeFilter(action, priority, tag) {
304 273 this.removeHook('filter', action, priority, tag);
305 274 return this;
306 275 },
307 -
308 276 addHook(hookType, action, callable, priority, tag) {
309 277 if (undefined === this.hooks[hookType][action]) {
310 278 this.hooks[hookType][action] = [];
311 279 }
312 -
313 280 const hooks = this.hooks[hookType][action];
314 -
315 281 if (undefined === tag) {
316 282 tag = action + '_' + hooks.length;
317 283 }
318 -
319 284 this.hooks[hookType][action].push({
320 285 tag,
321 286 callable,
322 287 priority
@@ -322,26 +287,21 @@
322 287 priority
323 288 });
324 289 return this;
325 290 },
326 -
327 291 doHook(hookType, action, args) {
328 292 args = Array.prototype.slice.call(args, 1);
329 -
330 293 if (undefined !== this.hooks[hookType][action]) {
331 294 let hooks = this.hooks[hookType][action],
332 - hook;
295 + hook;
333 296 hooks.sort(function (a, b) {
334 297 return a.priority - b.priority;
335 298 });
336 -
337 299 for (let i = 0; i < hooks.length; i++) {
338 300 hook = hooks[i].callable;
339 -
340 301 if (typeof hook !== 'function') {
341 302 hook = window[hook];
342 303 }
343 -
344 304 if ('action' === hookType) {
345 305 args[i] = hook.apply(null, args);
346 306 } else {
347 307 args[0] = hook.apply(null, args);
@@ -347,20 +307,16 @@
347 307 args[0] = hook.apply(null, args);
348 308 }
349 309 }
350 310 }
351 -
352 311 if ('filter' === hookType) {
353 312 return args[0];
354 313 }
355 -
356 314 return args;
357 315 },
358 -
359 316 removeHook(hookType, action, priority, tag) {
360 317 if (undefined !== this.hooks[hookType][action]) {
361 318 const hooks = this.hooks[hookType][action];
362 -
363 319 for (let i = hooks.length - 1; i >= 0; i--) {
364 320 if ((undefined === tag || tag === hooks[i].tag) && (undefined === priority || priority === hooks[i].priority)) {
365 321 hooks.splice(i, 1);
366 322 }
@@ -365,32 +321,31 @@
365 321 hooks.splice(i, 1);
366 322 }
367 323 }
368 324 }
369 -
370 325 return this;
371 326 }
372 -
373 327 };
374 -/* harmony default export */ __webpack_exports__["default"] = (Hook);
328 +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Hook);
375 329
376 -/***/ }),
330 +/***/ },
377 331
378 -/***/ "./assets/src/js/utils/iframe-submit.js":
332 +/***/ "./assets/src/js/utils/iframe-submit.js"
379 333 /*!**********************************************!*\
380 334 !*** ./assets/src/js/utils/iframe-submit.js ***!
381 335 \**********************************************/
382 -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
336 +(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
383 337
384 338 "use strict";
385 339 __webpack_require__.r(__webpack_exports__);
340 +/* harmony export */ __webpack_require__.d(__webpack_exports__, {
341 +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
342 +/* harmony export */ });
386 343 let iframeCounter = 1;
387 344 const $ = window.jQuery || jQuery;
388 -
389 345 const IframeSubmit = function (form) {
390 346 const iframeId = 'ajax-iframe-' + iframeCounter;
391 347 let $iframe = $('form[name="' + iframeId + '"]');
392 -
393 348 if (!$iframe.length) {
394 349 $iframe = $('<iframe />').appendTo(document.body).attr({
395 350 name: iframeId,
396 351 src: '#'
@@ -395,9 +350,8 @@
395 350 name: iframeId,
396 351 src: '#'
397 352 });
398 353 }
399 -
400 354 $(form).on('submit', function () {
401 355 const $form = $(form).clone().appendTo(document.body);
402 356 $form.attr('target', iframeId);
403 357 $form.find('#submit').remove();
@@ -404,52 +358,48 @@
404 358 return false;
405 359 });
406 360 iframeCounter++;
407 361 };
362 +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (IframeSubmit);
408 363
409 -/* harmony default export */ __webpack_exports__["default"] = (IframeSubmit);
364 +/***/ },
410 365
411 -/***/ }),
412 -
413 -/***/ "./assets/src/js/utils/jquery.plugins.js":
366 +/***/ "./assets/src/js/utils/jquery.plugins.js"
414 367 /*!***********************************************!*\
415 368 !*** ./assets/src/js/utils/jquery.plugins.js ***!
416 369 \***********************************************/
417 -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
370 +(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
418 371
419 372 "use strict";
420 373 __webpack_require__.r(__webpack_exports__);
374 +/* harmony export */ __webpack_require__.d(__webpack_exports__, {
375 +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
376 +/* harmony export */ });
421 377 const $ = window.jQuery || jQuery;
422 -
423 378 const serializeJSON = function serializeJSON(path) {
424 379 const isInput = $(this).is('input') || $(this).is('select') || $(this).is('textarea');
425 380 let unIndexed = isInput ? $(this).serializeArray() : $(this).find('input, select, textarea').serializeArray(),
426 - indexed = {},
427 - validate = /(\[([a-zA-Z0-9_-]+)?\]?)/g,
428 - arrayKeys = {},
429 - end = false;
381 + indexed = {},
382 + validate = /(\[([a-zA-Z0-9_-]+)?\]?)/g,
383 + arrayKeys = {},
384 + end = false;
430 385 $.each(unIndexed, function () {
431 386 const that = this,
432 - match = this.name.match(/^([0-9a-zA-Z_-]+)/);
433 -
387 + match = this.name.match(/^([0-9a-zA-Z_-]+)/);
434 388 if (!match) {
435 389 return;
436 390 }
437 -
438 391 let keys = this.name.match(validate),
439 - objPath = "indexed['" + match[0] + "']";
440 -
392 + objPath = "indexed['" + match[0] + "']";
441 393 if (keys) {
442 394 if (typeof indexed[match[0]] != 'object') {
443 395 indexed[match[0]] = {};
444 396 }
445 -
446 397 $.each(keys, function (i, prop) {
447 398 prop = prop.replace(/\]|\[/g, '');
448 399 let rawPath = objPath.replace(/'|\[|\]/g, ''),
449 - objExp = '',
450 - preObjPath = objPath;
451 -
400 + objExp = '',
401 + preObjPath = objPath;
452 402 if (prop == '') {
453 403 if (arrayKeys[rawPath] == undefined) {
454 404 arrayKeys[rawPath] = 0;
455 405 } else {
@@ -454,18 +404,15 @@
454 404 arrayKeys[rawPath] = 0;
455 405 } else {
456 406 arrayKeys[rawPath]++;
457 407 }
458 -
459 408 objPath += "['" + arrayKeys[rawPath] + "']";
460 409 } else {
461 410 if (!isNaN(prop)) {
462 411 arrayKeys[rawPath] = prop;
463 412 }
464 -
465 413 objPath += "['" + prop + "']";
466 414 }
467 -
468 415 try {
469 416 if (i == keys.length - 1) {
470 417 objExp = objPath + '=that.value;';
471 418 end = true;
@@ -472,9 +419,8 @@
472 419 } else {
473 420 objExp = objPath + '={}';
474 421 end = false;
475 422 }
476 -
477 423 const evalString = '' + 'if( typeof ' + objPath + " == 'undefined'){" + objExp + ';' + '}else{' + 'if(end){' + 'if(typeof ' + preObjPath + "!='object'){" + preObjPath + '={};}' + objExp + '}' + '}';
478 424 eval(evalString);
479 425 } catch (e) {
480 426 console.log('Error:' + e + '\n' + objExp);
@@ -483,18 +429,15 @@
483 429 } else {
484 430 indexed[match[0]] = this.value;
485 431 }
486 432 });
487 -
488 433 if (path) {
489 434 path = "['" + path.replace('.', "']['") + "']";
490 435 const c = 'try{indexed = indexed' + path + '}catch(ex){console.log(c, ex);}';
491 436 eval(c);
492 437 }
493 -
494 438 return indexed;
495 439 };
496 -
497 440 const LP_Tooltip = options => {
498 441 options = $.extend({}, {
499 442 offset: [0, 0]
500 443 }, options || {});
@@ -499,32 +442,26 @@
499 442 offset: [0, 0]
500 443 }, options || {});
501 444 return $.each(undefined, function () {
502 445 const $el = $(this),
503 - content = $el.data('content');
504 -
446 + content = $el.data('content');
505 447 if (!content || $el.data('LP_Tooltip') !== undefined) {
506 448 return;
507 449 }
508 -
509 450 let $tooltip = null;
510 451 $el.on('mouseenter', function (e) {
511 452 $tooltip = $('<div class="learn-press-tooltip-bubble"/>').html(content).appendTo($('body')).hide();
512 453 const position = $el.offset();
513 -
514 454 if (Array.isArray(options.offset)) {
515 455 const top = options.offset[1],
516 - left = options.offset[0];
517 -
456 + left = options.offset[0];
518 457 if ($.isNumeric(left)) {
519 458 position.left += left;
520 459 } else {}
521 -
522 460 if ($.isNumeric(top)) {
523 461 position.top += top;
524 462 } else {}
525 463 }
526 -
527 464 $tooltip.css({
528 465 top: position.top,
529 466 left: position.left
530 467 });
@@ -535,30 +472,24 @@
535 472 });
536 473 $el.data('tooltip', true);
537 474 });
538 475 };
539 -
540 476 const hasEvent = function hasEvent(name) {
541 477 const events = $(this).data('events');
542 -
543 478 if (typeof events.LP == 'undefined') {
544 479 return false;
545 480 }
546 -
547 481 for (i = 0; i < events.LP.length; i++) {
548 482 if (events.LP[i].namespace == name) {
549 483 return true;
550 484 }
551 485 }
552 -
553 486 return false;
554 487 };
555 -
556 488 const dataToJSON = function dataToJSON() {
557 489 const json = {};
558 490 $.each(this[0].attributes, function () {
559 491 const m = this.name.match(/^data-(.*)/);
560 -
561 492 if (m) {
562 493 json[m[1]] = this.value;
563 494 }
564 495 });
@@ -563,9 +494,8 @@
563 494 }
564 495 });
565 496 return json;
566 497 };
567 -
568 498 const rows = function rows() {
569 499 const h = $(this).height();
570 500 const lh = $(this).css('line-height').replace('px', '');
571 501 $(this).attr({
@@ -573,51 +503,44 @@
573 503 'line-height': lh
574 504 });
575 505 return Math.floor(h / parseInt(lh));
576 506 };
577 -
578 507 const checkLines = function checkLines(p) {
579 508 return this.each(function () {
580 509 const $e = $(this),
581 - rows = $e.rows();
510 + rows = $e.rows();
582 511 p.call(this, rows);
583 512 });
584 513 };
585 -
586 514 const findNext = function findNext(selector) {
587 515 const $selector = $(selector),
588 - $root = this.first(),
589 - index = $selector.index($root),
590 - $next = $selector.eq(index + 1);
516 + $root = this.first(),
517 + index = $selector.index($root),
518 + $next = $selector.eq(index + 1);
591 519 return $next.length ? $next : false;
592 520 };
593 -
594 521 const findPrev = function findPrev(selector) {
595 522 const $selector = $(selector),
596 - $root = this.first(),
597 - index = $selector.index($root),
598 - $prev = $selector.eq(index - 1);
523 + $root = this.first(),
524 + index = $selector.index($root),
525 + $prev = $selector.eq(index - 1);
599 526 return $prev.length ? $prev : false;
600 527 };
601 -
602 528 const progress = function progress(v) {
603 529 return this.each(function () {
604 530 const t = parseInt(v / 100 * 360),
605 - timer = null,
606 - $this = $(this);
607 -
531 + timer = null,
532 + $this = $(this);
608 533 if (t < 180) {
609 534 $this.find('.progress-circle').removeClass('gt-50');
610 535 } else {
611 536 $this.find('.progress-circle').addClass('gt-50');
612 537 }
613 -
614 538 $this.find('.fill').css({
615 539 transform: 'rotate(' + t + 'deg)'
616 540 });
617 541 });
618 542 };
619 -
620 543 $.fn.serializeJSON = serializeJSON;
621 544 $.fn.LP_Tooltip = LP_Tooltip;
622 545 $.fn.hasEvent = hasEvent;
623 546 $.fn.dataToJSON = dataToJSON;
@@ -625,9 +548,9 @@
625 548 $.fn.checkLines = checkLines;
626 549 $.fn.findNext = findNext;
627 550 $.fn.findPrev = findPrev;
628 551 $.fn.progress = progress;
629 -/* harmony default export */ __webpack_exports__["default"] = ({
552 +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
630 553 serializeJSON,
631 554 LP_Tooltip,
632 555 hasEvent,
633 556 dataToJSON,
@@ -637,24 +560,25 @@
637 560 findPrev,
638 561 progress
639 562 });
640 563
641 -/***/ }),
564 +/***/ },
642 565
643 -/***/ "./assets/src/js/utils/local-storage.js":
566 +/***/ "./assets/src/js/utils/local-storage.js"
644 567 /*!**********************************************!*\
645 568 !*** ./assets/src/js/utils/local-storage.js ***!
646 569 \**********************************************/
647 -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
570 +(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
648 571
649 572 "use strict";
650 573 __webpack_require__.r(__webpack_exports__);
574 +/* harmony export */ __webpack_require__.d(__webpack_exports__, {
575 +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
576 +/* harmony export */ });
651 577 const _localStorage = {
652 578 __key: 'LP',
653 -
654 579 set(name, value) {
655 580 const data = _localStorage.get();
656 -
657 581 const {
658 582 set
659 583 } = lodash;
660 584 set(data, name, value);
@@ -659,9 +583,8 @@
659 583 } = lodash;
660 584 set(data, name, value);
661 585 localStorage.setItem(_localStorage.__key, JSON.stringify(data));
662 586 },
663 -
664 587 get(name, def) {
665 588 const data = JSON.parse(localStorage.getItem(_localStorage.__key) || '{}');
666 589 const {
667 590 get
@@ -668,45 +591,41 @@
668 591 } = lodash;
669 592 const value = get(data, name);
670 593 return !name ? data : value !== undefined ? value : def;
671 594 },
672 -
673 595 exists(name) {
674 - const data = _localStorage.get(); // return data.hasOwnProperty( name );
596 + const data = _localStorage.get();
675 597
676 -
598 + // return data.hasOwnProperty( name );
677 599 return name in data;
678 600 },
679 -
680 601 remove(name) {
681 602 const data = _localStorage.get();
682 -
683 603 const newData = lodash.omit(data, name);
684 -
685 604 _localStorage.__set(newData);
686 605 },
687 -
688 606 __get() {
689 607 return localStorage.getItem(_localStorage.__key);
690 608 },
691 -
692 609 __set(data) {
693 610 localStorage.setItem(_localStorage.__key, JSON.stringify(data || '{}'));
694 611 }
695 -
696 612 };
697 -/* harmony default export */ __webpack_exports__["default"] = (_localStorage);
613 +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_localStorage);
698 614
699 -/***/ }),
615 +/***/ },
700 616
701 -/***/ "./assets/src/js/utils/message-box.js":
617 +/***/ "./assets/src/js/utils/message-box.js"
702 618 /*!********************************************!*\
703 619 !*** ./assets/src/js/utils/message-box.js ***!
704 620 \********************************************/
705 -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
621 +(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
706 622
707 623 "use strict";
708 624 __webpack_require__.r(__webpack_exports__);
625 +/* harmony export */ __webpack_require__.d(__webpack_exports__, {
626 +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
627 +/* harmony export */ });
709 628 const $ = window.jQuery;
710 629 const MessageBox = {
711 630 $block: null,
712 631 $window: null,
@@ -712,9 +631,8 @@
712 631 $window: null,
713 632 events: {},
714 633 instances: [],
715 634 instance: null,
716 -
717 635 quickConfirm(elem, args) {
718 636 const $e = $(elem);
719 637 $('[learn-press-quick-confirm]').each(function () {
720 638 let $ins;
@@ -721,49 +639,47 @@
721 639 ($ins = $(this).data('quick-confirm')) && (console.log($ins), $ins.destroy());
722 640 });
723 641 !$e.attr('learn-press-quick-confirm') && $e.attr('learn-press-quick-confirm', 'true').data('quick-confirm', new function (elem, args) {
724 642 var $elem = $(elem),
725 - $div = $('<span class="learn-press-quick-confirm"></span>').insertAfter($elem),
726 - //($(document.body)),
727 - offset = $(elem).position() || {
728 - left: 0,
729 - top: 0
730 - },
731 - timerOut = null,
732 - timerHide = null,
733 - n = 3,
734 - hide = function () {
735 - $div.fadeOut('fast', function () {
736 - $(this).remove();
737 - $div.parent().css('position', '');
738 - });
739 - $elem.removeAttr('learn-press-quick-confirm').data('quick-confirm', undefined);
740 - stop();
741 - },
742 - stop = function () {
743 - timerHide && clearInterval(timerHide);
744 - timerOut && clearInterval(timerOut);
745 - },
746 - start = function () {
747 - timerOut = setInterval(function () {
748 - if (--n == 0) {
749 - hide.call($div[0]);
750 - typeof args.onCancel === 'function' && args.onCancel(args.data);
751 - stop();
752 - }
753 -
754 - $div.find('span').html(' (' + n + ')');
755 - }, 1000);
756 - timerHide = setInterval(function () {
757 - if (!$elem.is(':visible') || $elem.css('visibility') == 'hidden') {
758 - stop();
759 - $div.remove();
643 + $div = $('<span class="learn-press-quick-confirm"></span>').insertAfter($elem),
644 + //($(document.body)),
645 + offset = $(elem).position() || {
646 + left: 0,
647 + top: 0
648 + },
649 + timerOut = null,
650 + timerHide = null,
651 + n = 3,
652 + hide = function () {
653 + $div.fadeOut('fast', function () {
654 + $(this).remove();
760 655 $div.parent().css('position', '');
761 - typeof args.onCancel === 'function' && args.onCancel(args.data);
762 - }
763 - }, 350);
764 - };
765 -
656 + });
657 + $elem.removeAttr('learn-press-quick-confirm').data('quick-confirm', undefined);
658 + stop();
659 + },
660 + stop = function () {
661 + timerHide && clearInterval(timerHide);
662 + timerOut && clearInterval(timerOut);
663 + },
664 + start = function () {
665 + timerOut = setInterval(function () {
666 + if (--n == 0) {
667 + hide.call($div[0]);
668 + typeof args.onCancel === 'function' && args.onCancel(args.data);
669 + stop();
670 + }
671 + $div.find('span').html(' (' + n + ')');
672 + }, 1000);
673 + timerHide = setInterval(function () {
674 + if (!$elem.is(':visible') || $elem.css('visibility') == 'hidden') {
675 + stop();
676 + $div.remove();
677 + $div.parent().css('position', '');
678 + typeof args.onCancel === 'function' && args.onCancel(args.data);
679 + }
680 + }, 350);
681 + };
766 682 args = $.extend({
767 683 message: '',
768 684 data: null,
769 685 onOk: null,
@@ -780,16 +696,15 @@
780 696 }).hover(function () {
781 697 stop();
782 698 }, function () {
783 699 start();
784 - }); //$div.parent().css('position', 'relative');
785 -
700 + });
701 + //$div.parent().css('position', 'relative');
786 702 $div.css({
787 703 left: offset.left + $elem.outerWidth() - $div.outerWidth() + args.offset.left,
788 704 top: offset.top + $elem.outerHeight() + args.offset.top + 5
789 705 }).hide().fadeIn('fast');
790 706 start();
791 -
792 707 this.destroy = function () {
793 708 $div.remove();
794 709 $elem.removeAttr('learn-press-quick-confirm').data('quick-confirm', undefined);
795 710 stop();
@@ -795,9 +710,8 @@
795 710 stop();
796 711 };
797 712 }(elem, args));
798 713 },
799 -
800 714 show(message, args) {
801 715 //this.hide();
802 716 $.proxy(function () {
803 717 args = $.extend({
@@ -812,27 +726,22 @@
812 726 }, args || {});
813 727 this.instances.push(args);
814 728 this.instance = args;
815 729 const $doc = $(document),
816 - $body = $(document.body);
817 -
730 + $body = $(document.body);
818 731 if (!this.$block) {
819 732 this.$block = $('<div id="learn-press-message-box-block"></div>').appendTo($body);
820 733 }
821 -
822 734 if (!this.$window) {
823 735 this.$window = $('<div id="learn-press-message-box-window"><div id="message-box-wrap"></div> </div>').insertAfter(this.$block);
824 736 this.$window.click(function () {});
825 - } //this.events = args.events || {};
826 -
827 -
737 + }
738 + //this.events = args.events || {};
828 739 this._createWindow(message, args.title, args.buttons);
829 -
830 740 this.$block.show();
831 741 this.$window.show().attr('instance', args.id);
832 742 $(window).bind('resize.message-box', $.proxy(this.update, this)).bind('scroll.message-box', $.proxy(this.update, this));
833 743 this.update(true);
834 -
835 744 if (args.autohide) {
836 745 setTimeout(function () {
837 746 LP.MessageBox.hide();
838 747 typeof args.onHide === 'function' && args.onHide.call(LP.MessageBox, args);
@@ -839,14 +748,12 @@
839 748 }, args.autohide);
840 749 }
841 750 }, this)();
842 751 },
843 -
844 752 blockUI(message) {
845 753 message = (message !== false ? message ? message : 'Wait a moment' : '') + '<div class="message-box-animation"></div>';
846 754 this.show(message);
847 755 },
848 -
849 756 hide(delay, instance) {
850 757 if (instance) {
851 758 this._removeInstance(instance.id);
852 759 } else if (this.instance) {
@@ -851,66 +758,56 @@
851 758 this._removeInstance(instance.id);
852 759 } else if (this.instance) {
853 760 this._removeInstance(this.instance.id);
854 761 }
855 -
856 762 if (this.instances.length === 0) {
857 763 if (this.$block) {
858 764 this.$block.hide();
859 765 }
860 -
861 766 if (this.$window) {
862 767 this.$window.hide();
863 768 }
864 -
865 769 $(window).unbind('resize.message-box', this.update).unbind('scroll.message-box', this.update);
866 770 } else if (this.instance) {
867 771 this._createWindow(this.instance.message, this.instance.title, this.instance.buttons);
868 772 }
869 773 },
870 -
871 774 update(force) {
872 775 let that = this,
873 - $wrap = this.$window.find('#message-box-wrap'),
874 - timer = $wrap.data('timer'),
875 - _update = function () {
876 - LP.Hook.doAction('learn_press_message_box_before_resize', that);
877 - let $content = $wrap.find('.message-box-content').css('height', '').css('overflow', 'hidden'),
776 + $wrap = this.$window.find('#message-box-wrap'),
777 + timer = $wrap.data('timer'),
778 + _update = function () {
779 + LP.Hook.doAction('learn_press_message_box_before_resize', that);
780 + let $content = $wrap.find('.message-box-content').css('height', '').css('overflow', 'hidden'),
878 781 width = $wrap.outerWidth(),
879 782 height = $wrap.outerHeight(),
880 783 contentHeight = $content.height(),
881 784 windowHeight = $(window).height(),
882 785 top = $wrap.offset().top;
883 -
884 - if (contentHeight > windowHeight - 50) {
885 - $content.css({
886 - height: windowHeight - 25
786 + if (contentHeight > windowHeight - 50) {
787 + $content.css({
788 + height: windowHeight - 25
789 + });
790 + height = $wrap.outerHeight();
791 + } else {
792 + $content.css('height', '').css('overflow', '');
793 + }
794 + $wrap.css({
795 + marginTop: ($(window).height() - height) / 2
887 796 });
888 - height = $wrap.outerHeight();
889 - } else {
890 - $content.css('height', '').css('overflow', '');
891 - }
892 -
893 - $wrap.css({
894 - marginTop: ($(window).height() - height) / 2
895 - });
896 - LP.Hook.doAction('learn_press_message_box_resize', height, that);
897 - };
898 -
797 + LP.Hook.doAction('learn_press_message_box_resize', height, that);
798 + };
899 799 if (force) {
900 800 _update();
901 801 }
902 -
903 802 timer && clearTimeout(timer);
904 803 timer = setTimeout(_update, 250);
905 804 },
906 -
907 805 _removeInstance(id) {
908 806 for (let i = 0; i < this.instances.length; i++) {
909 807 if (this.instances[i].id === id) {
910 808 this.instances.splice(i, 1);
911 809 const len = this.instances.length;
912 -
913 810 if (len) {
914 811 this.instance = this.instances[len - 1];
915 812 this.$window.attr('instance', this.instance.id);
916 813 } else {
@@ -916,14 +813,12 @@
916 813 } else {
917 814 this.instance = false;
918 815 this.$window.removeAttr('instance');
919 816 }
920 -
921 817 break;
922 818 }
923 819 }
924 820 },
925 -
926 821 _getInstance(id) {
927 822 for (let i = 0; i < this.instances.length; i++) {
928 823 if (this.instances[i].id === id) {
929 824 return this.instances[i];
@@ -929,49 +824,40 @@
929 824 return this.instances[i];
930 825 }
931 826 }
932 827 },
933 -
934 828 _createWindow(message, title, buttons) {
935 829 const $wrap = this.$window.find('#message-box-wrap').html('');
936 -
937 830 if (title) {
938 831 $wrap.append('<h3 class="message-box-title">' + title + '</h3>');
939 832 }
940 -
941 833 $wrap.append($('<div class="message-box-content"></div>').html(message));
942 -
943 834 if (buttons) {
944 835 const $buttons = $('<div class="message-box-buttons"></div>');
945 -
946 836 switch (buttons) {
947 837 case 'yesNo':
948 838 $buttons.append(this._createButton(LP_Settings.localize.button_yes, 'yes'));
949 839 $buttons.append(this._createButton(LP_Settings.localize.button_no, 'no'));
950 840 break;
951 -
952 841 case 'okCancel':
953 842 $buttons.append(this._createButton(LP_Settings.localize.button_ok, 'ok'));
954 843 $buttons.append(this._createButton(LP_Settings.localize.button_cancel, 'cancel'));
955 844 break;
956 -
957 845 default:
958 846 $buttons.append(this._createButton(LP_Settings.localize.button_ok, 'ok'));
959 847 }
960 -
961 848 $wrap.append($buttons);
962 849 }
963 850 },
964 -
965 851 _createButton(title, type) {
966 852 const $button = $('<button type="button" class="button message-box-button message-box-button-' + type + '">' + title + '</button>'),
967 - callback = 'on' + (type.substr(0, 1).toUpperCase() + type.substr(1));
853 + callback = 'on' + (type.substr(0, 1).toUpperCase() + type.substr(1));
968 854 $button.data('callback', callback).click(function () {
969 855 const instance = $(this).data('instance'),
970 - callback = instance.events[$(this).data('callback')];
971 -
856 + callback = instance.events[$(this).data('callback')];
972 857 if ($.type(callback) === 'function') {
973 - if (callback.apply(LP.MessageBox, [instance]) === false) {// return;
858 + if (callback.apply(LP.MessageBox, [instance]) === false) {
859 + // return;
974 860 } else {
975 861 LP.MessageBox.hide(null, instance);
976 862 }
977 863 } else {
@@ -979,24 +865,23 @@
979 865 }
980 866 }).data('instance', this.instance);
981 867 return $button;
982 868 }
983 -
984 869 };
985 -/* harmony default export */ __webpack_exports__["default"] = (MessageBox);
870 +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (MessageBox);
986 871
987 -/***/ }),
872 +/***/ },
988 873
989 -/***/ "./assets/src/js/utils/quick-tip.js":
874 +/***/ "./assets/src/js/utils/quick-tip.js"
990 875 /*!******************************************!*\
991 876 !*** ./assets/src/js/utils/quick-tip.js ***!
992 877 \******************************************/
993 -/***/ (function() {
878 +() {
994 879
995 880 (function ($) {
996 881 function QuickTip(el, options) {
997 882 const $el = $(el),
998 - uniId = $el.attr('data-id') || LP.uniqueId();
883 + uniId = $el.attr('data-id') || LP.uniqueId();
999 884 options = $.extend({
1000 885 event: 'hover',
1001 886 autoClose: true,
1002 887 single: true,
@@ -1005,30 +890,25 @@
1005 890 tipClass: ''
1006 891 }, options, $el.data());
1007 892 $el.attr('data-id', uniId);
1008 893 let content = $el.attr('data-content-tip') || $el.html(),
1009 - $tip = $('<div class="learn-press-tip-floating">' + content + '</div>'),
1010 - t = null,
1011 - closeInterval = 0,
1012 - useData = false,
1013 - arrowOffset = options.arrowOffset === 'el' ? $el.outerWidth() / 2 : 8,
1014 - $content = $('#__' + uniId);
1015 -
894 + $tip = $('<div class="learn-press-tip-floating">' + content + '</div>'),
895 + t = null,
896 + closeInterval = 0,
897 + useData = false,
898 + arrowOffset = options.arrowOffset === 'el' ? $el.outerWidth() / 2 : 8,
899 + $content = $('#__' + uniId);
1016 900 if ($content.length === 0) {
1017 901 $(document.body).append($('<div />').attr('id', '__' + uniId).html(content).css('display', 'none'));
1018 902 }
1019 -
1020 903 content = $content.html();
1021 904 $tip.addClass(options.tipClass);
1022 905 $el.data('content-tip', content);
1023 -
1024 906 if ($el.attr('data-content-tip')) {
1025 907 //$el.removeAttr('data-content-tip');
1026 908 useData = true;
1027 909 }
1028 -
1029 910 closeInterval = options.closeInterval;
1030 -
1031 911 if (options.autoClose === false) {
1032 912 $tip.append('<a class="close"></a>');
1033 913 $tip.on('click', '.close', function () {
1034 914 close();
@@ -1033,19 +913,16 @@
1033 913 $tip.on('click', '.close', function () {
1034 914 close();
1035 915 });
1036 916 }
1037 -
1038 917 function show() {
1039 918 if (t) {
1040 919 clearTimeout(t);
1041 920 return;
1042 921 }
1043 -
1044 922 if (options.single) {
1045 923 $('.learn-press-tip').not($el).LP('QuickTip', 'close');
1046 924 }
1047 -
1048 925 $tip.appendTo(document.body);
1049 926 const pos = $el.offset();
1050 927 $tip.css({
1051 928 top: pos.top - $tip.outerHeight() - 8,
@@ -1051,9 +928,8 @@
1051 928 top: pos.top - $tip.outerHeight() - 8,
1052 929 left: pos.left - $tip.outerWidth() / 2 + arrowOffset
1053 930 });
1054 931 }
1055 -
1056 932 function hide() {
1057 933 t && clearTimeout(t);
1058 934 t = setTimeout(function () {
1059 935 $tip.detach();
@@ -1059,23 +935,19 @@
1059 935 $tip.detach();
1060 936 t = null;
1061 937 }, closeInterval);
1062 938 }
1063 -
1064 939 function close() {
1065 940 closeInterval = 0;
1066 941 hide();
1067 942 closeInterval = options.closeInterval;
1068 943 }
1069 -
1070 944 function open() {
1071 945 show();
1072 946 }
1073 -
1074 947 if (!useData) {
1075 948 $el.html('');
1076 949 }
1077 -
1078 950 if (options.event === 'click') {
1079 951 $el.on('click', function (e) {
1080 952 e.stopPropagation();
1081 953 show();
@@ -1080,21 +952,18 @@
1080 952 e.stopPropagation();
1081 953 show();
1082 954 });
1083 955 }
1084 -
1085 956 $(document).on('learn-press/close-all-quick-tip', function () {
1086 957 close();
1087 958 });
1088 959 $el.hover(function (e) {
1089 960 e.stopPropagation();
1090 -
1091 961 if (options.event !== 'click') {
1092 962 show();
1093 963 }
1094 964 }, function (e) {
1095 965 e.stopPropagation();
1096 -
1097 966 if (options.autoClose) {
1098 967 hide();
1099 968 }
1100 969 }).addClass('ready');
@@ -1102,18 +971,15 @@
1102 971 close,
1103 972 open
1104 973 };
1105 974 }
1106 -
1107 975 $.fn.LP('QuickTip', function (options) {
1108 976 return $.each(this, function () {
1109 977 let $tip = $(this).data('quick-tip');
1110 -
1111 978 if (!$tip) {
1112 979 $tip = new QuickTip(this, options);
1113 980 $(this).data('quick-tip', $tip);
1114 981 }
1115 -
1116 982 if (typeof options === 'string') {
1117 983 $tip[options] && $tip[options].apply($tip);
1118 984 }
1119 985 });
@@ -1119,15 +985,15 @@
1119 985 });
1120 986 });
1121 987 })(jQuery);
1122 988
1123 -/***/ }),
989 +/***/ },
1124 990
1125 -/***/ "./assets/src/js/utils/show-password.js":
991 +/***/ "./assets/src/js/utils/show-password.js"
1126 992 /*!**********************************************!*\
1127 993 !*** ./assets/src/js/utils/show-password.js ***!
1128 994 \**********************************************/
1129 -/***/ (function() {
995 +() {
1130 996
1131 997 const $ = jQuery;
1132 998 $(function () {
1133 999 $('.form-field input[type="password"]').wrap('<span class="lp-password-input"></span>');
@@ -1133,9 +999,8 @@
1133 999 $('.form-field input[type="password"]').wrap('<span class="lp-password-input"></span>');
1134 1000 $('.lp-password-input').append('<span class="lp-show-password-input"></span>');
1135 1001 $('.lp-show-password-input').on('click', function () {
1136 1002 $(this).toggleClass('display-password');
1137 -
1138 1003 if ($(this).hasClass('display-password')) {
1139 1004 $(this).siblings(['input[type="password"]']).prop('type', 'text');
1140 1005 } else {
1141 1006 $(this).siblings('input[type="text"]').prop('type', 'password');
@@ -1142,9 +1007,9 @@
1142 1007 }
1143 1008 });
1144 1009 });
1145 1010
1146 -/***/ })
1011 +/***/ }
1147 1012
1148 1013 /******/ });
1149 1014 /************************************************************************/
1150 1015 /******/ // The module cache
@@ -1164,8 +1029,14 @@
1164 1029 /******/ exports: {}
1165 1030 /******/ };
1166 1031 /******/
1167 1032 /******/ // Execute the module function
1033 +/******/ if (!(moduleId in __webpack_modules__)) {
1034 +/******/ delete __webpack_module_cache__[moduleId];
1035 +/******/ var e = new Error("Cannot find module '" + moduleId + "'");
1036 +/******/ e.code = 'MODULE_NOT_FOUND';
1037 +/******/ throw e;
1038 +/******/ }
1168 1039 /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
1169 1040 /******/
1170 1041 /******/ // Return the exports of the module
1171 1042 /******/ return module.exports;
@@ -1172,23 +1043,23 @@
1172 1043 /******/ }
1173 1044 /******/
1174 1045 /************************************************************************/
1175 1046 /******/ /* webpack/runtime/compat get default export */
1176 -/******/ !function() {
1047 +/******/ (() => {
1177 1048 /******/ // getDefaultExport function for compatibility with non-harmony modules
1178 -/******/ __webpack_require__.n = function(module) {
1049 +/******/ __webpack_require__.n = (module) => {
1179 1050 /******/ var getter = module && module.__esModule ?
1180 -/******/ function() { return module['default']; } :
1181 -/******/ function() { return module; };
1051 +/******/ () => (module['default']) :
1052 +/******/ () => (module);
1182 1053 /******/ __webpack_require__.d(getter, { a: getter });
1183 1054 /******/ return getter;
1184 1055 /******/ };
1185 -/******/ }();
1056 +/******/ })();
1186 1057 /******/
1187 1058 /******/ /* webpack/runtime/define property getters */
1188 -/******/ !function() {
1059 +/******/ (() => {
1189 1060 /******/ // define getter functions for harmony exports
1190 -/******/ __webpack_require__.d = function(exports, definition) {
1061 +/******/ __webpack_require__.d = (exports, definition) => {
1191 1062 /******/ for(var key in definition) {
1192 1063 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
1193 1064 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
1194 1065 /******/ }
@@ -1193,35 +1064,38 @@
1193 1064 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
1194 1065 /******/ }
1195 1066 /******/ }
1196 1067 /******/ };
1197 -/******/ }();
1068 +/******/ })();
1198 1069 /******/
1199 1070 /******/ /* webpack/runtime/hasOwnProperty shorthand */
1200 -/******/ !function() {
1201 -/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
1202 -/******/ }();
1071 +/******/ (() => {
1072 +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
1073 +/******/ })();
1203 1074 /******/
1204 1075 /******/ /* webpack/runtime/make namespace object */
1205 -/******/ !function() {
1076 +/******/ (() => {
1206 1077 /******/ // define __esModule on exports
1207 -/******/ __webpack_require__.r = function(exports) {
1078 +/******/ __webpack_require__.r = (exports) => {
1208 1079 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
1209 1080 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1210 1081 /******/ }
1211 1082 /******/ Object.defineProperty(exports, '__esModule', { value: true });
1212 1083 /******/ };
1213 -/******/ }();
1084 +/******/ })();
1214 1085 /******/
1215 1086 /************************************************************************/
1216 1087 var __webpack_exports__ = {};
1217 -// This entry need to be wrapped in an IIFE because it need to be in strict mode.
1218 -!function() {
1088 +// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
1089 +(() => {
1219 1090 "use strict";
1220 1091 /*!**************************************!*\
1221 1092 !*** ./assets/src/js/utils/index.js ***!
1222 1093 \**************************************/
1223 1094 __webpack_require__.r(__webpack_exports__);
1095 +/* harmony export */ __webpack_require__.d(__webpack_exports__, {
1096 +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
1097 +/* harmony export */ });
1224 1098 /* harmony import */ var _extend__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./extend */ "./assets/src/js/utils/extend.js");
1225 1099 /* harmony import */ var _fn__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./fn */ "./assets/src/js/utils/fn.js");
1226 1100 /* harmony import */ var _quick_tip__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./quick-tip */ "./assets/src/js/utils/quick-tip.js");
1227 1101 /* harmony import */ var _quick_tip__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_quick_tip__WEBPACK_IMPORTED_MODULE_2__);
@@ -1249,22 +1123,20 @@
1249 1123
1250 1124
1251 1125
1252 1126
1127 +
1253 1128 const $ = jQuery;
1254 -
1255 1129 String.prototype.getQueryVar = function (name) {
1256 1130 name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
1257 1131 const regex = new RegExp('[\\?&]' + name + '=([^&#]*)'),
1258 - results = regex.exec(this);
1132 + results = regex.exec(this);
1259 1133 return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
1260 1134 };
1261 -
1262 1135 String.prototype.addQueryVar = function (name, value) {
1263 1136 let url = this,
1264 - m = url.split('#');
1137 + m = url.split('#');
1265 1138 url = m[0];
1266 -
1267 1139 if (name.match(/\[/)) {
1268 1140 url += url.match(/\?/) ? '&' : '?';
1269 1141 url += name + '=' + value;
1270 1142 } else if (url.indexOf('&' + name + '=') != -1 || url.indexOf('?' + name + '=') != -1) {
@@ -1272,12 +1144,10 @@
1272 1144 } else {
1273 1145 url += url.match(/\?/) ? '&' : '?';
1274 1146 url += name + '=' + value;
1275 1147 }
1276 -
1277 1148 return url + (m[1] ? '#' + m[1] : '');
1278 1149 };
1279 -
1280 1150 String.prototype.removeQueryVar = function (name) {
1281 1151 let url = this;
1282 1152 const m = url.split('#');
1283 1153 url = m[0];
@@ -1284,9 +1154,11 @@
1284 1154 name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
1285 1155 const regex = new RegExp('[\\?&]' + name + '([\[][^=]*)?=([^&#]*)', 'g');
1286 1156 url = url.replace(regex, '');
1287 1157 return url + (m[1] ? '#' + m[1] : '');
1288 -}; // if ( $.isEmptyObject( '' ) == false ) {
1158 +};
1159 +
1160 +// if ( $.isEmptyObject( '' ) == false ) {
1289 1161 // $.isEmptyObject = function( a ) {
1290 1162 // let prop;
1291 1163 // for ( prop in a ) {
1292 1164 // if ( a.hasOwnProperty( prop ) ) {
@@ -1296,12 +1168,10 @@
1296 1168 // return true;
1297 1169 // };
1298 1170 // }
1299 1171
1300 -
1301 1172 const _default = {
1302 1173 Hook: _hook__WEBPACK_IMPORTED_MODULE_5__["default"],
1303 -
1304 1174 setUrl(url, ember, title) {
1305 1175 if (url) {
1306 1176 history.pushState({}, title, url);
1307 1177 LP.Hook.doAction('learn_press_set_location_url', url);
@@ -1306,20 +1176,16 @@
1306 1176 history.pushState({}, title, url);
1307 1177 LP.Hook.doAction('learn_press_set_location_url', url);
1308 1178 }
1309 1179 },
1310 -
1311 1180 toggleGroupSection(el, target) {
1312 1181 const $el = $(el),
1313 - isHide = $el.hasClass('hide-if-js');
1314 -
1182 + isHide = $el.hasClass('hide-if-js');
1315 1183 if (isHide) {
1316 1184 $el.hide().removeClass('hide-if-js');
1317 1185 }
1318 -
1319 1186 $el.removeClass('hide-if-js').slideToggle(function () {
1320 1187 const $this = $(this);
1321 -
1322 1188 if ($this.is(':visible')) {
1323 1189 $(target).addClass('toggle-on').removeClass('toggle-off');
1324 1190 } else {
1325 1191 $(target).addClass('toggle-off').removeClass('toggle-on');
@@ -1325,13 +1191,11 @@
1325 1191 $(target).addClass('toggle-off').removeClass('toggle-on');
1326 1192 }
1327 1193 });
1328 1194 },
1329 -
1330 1195 overflow(el, v) {
1331 1196 const $el = $(el),
1332 - overflow = $el.css('overflow');
1333 -
1197 + overflow = $el.css('overflow');
1334 1198 if (v) {
1335 1199 $el.css('overflow', v).data('overflow', overflow);
1336 1200 } else {
1337 1201 $el.css('overflow', $el.data('overflow'));
@@ -1336,48 +1200,37 @@
1336 1200 } else {
1337 1201 $el.css('overflow', $el.data('overflow'));
1338 1202 }
1339 1203 },
1340 -
1341 1204 getUrl() {
1342 1205 return window.location.href;
1343 1206 },
1344 -
1345 1207 addQueryVar(name, value, url) {
1346 1208 return (url === undefined ? window.location.href : url).addQueryVar(name, value);
1347 1209 },
1348 -
1349 1210 removeQueryVar(name, url) {
1350 1211 return (url === undefined ? window.location.href : url).removeQueryVar(name);
1351 1212 },
1352 -
1353 1213 reload(url) {
1354 1214 if (!url) {
1355 1215 url = window.location.href;
1356 1216 }
1357 -
1358 1217 window.location.href = url;
1359 1218 },
1360 -
1361 1219 parseResponse(response, type) {
1362 1220 const m = response.match(/<-- LP_AJAX_START -->(.*)<-- LP_AJAX_END -->/s);
1363 -
1364 1221 if (m) {
1365 1222 response = m[1];
1366 1223 }
1367 -
1368 1224 return (type || 'json') === 'json' ? this.parseJSON(response) : response;
1369 1225 },
1370 -
1371 1226 parseJSON(data) {
1372 1227 if (typeof data !== 'string') {
1373 1228 return data;
1374 1229 }
1375 -
1376 1230 const m = String.raw({
1377 1231 raw: data
1378 1232 }).match(/<-- LP_AJAX_START -->(.*)<-- LP_AJAX_END -->/s);
1379 -
1380 1233 try {
1381 1234 if (m) {
1382 1235 data = JSON.parse(m[1].replace(/(?:\r\n|\r|\n)/g, ''));
1383 1236 } else {
@@ -1385,22 +1238,19 @@
1385 1238 }
1386 1239 } catch (e) {
1387 1240 data = {};
1388 1241 }
1389 -
1390 1242 return data;
1391 1243 },
1392 -
1393 1244 ajax(args) {
1394 1245 const type = args.type || 'post',
1395 - dataType = args.dataType || 'json',
1396 - data = args.action ? $.extend(args.data, {
1397 - 'lp-ajax': args.action
1398 - }) : args.data,
1399 - beforeSend = args.beforeSend || function () {},
1400 - url = args.url || window.location.href; // console.debug( beforeSend );
1401 -
1402 -
1246 + dataType = args.dataType || 'json',
1247 + data = args.action ? $.extend(args.data, {
1248 + 'lp-ajax': args.action
1249 + }) : args.data,
1250 + beforeSend = args.beforeSend || function () {},
1251 + url = args.url || window.location.href;
1252 + // console.debug( beforeSend );
1403 1253 $.ajax({
1404 1254 data,
1405 1255 url,
1406 1256 type,
@@ -1405,97 +1255,78 @@
1405 1255 url,
1406 1256 type,
1407 1257 dataType: 'html',
1408 1258 beforeSend: beforeSend.apply(null, args),
1409 -
1410 1259 success(raw) {
1411 1260 const response = LP.parseResponse(raw, dataType);
1412 1261 typeof args.success === 'function' && args.success(response, raw);
1413 1262 },
1414 -
1415 1263 error() {
1416 1264 typeof args.error === 'function' && args.error.apply(null, LP.funcArgs2Array());
1417 1265 }
1418 -
1419 1266 });
1420 1267 },
1421 -
1422 1268 doAjax(args) {
1423 1269 const type = args.type || 'post',
1424 - dataType = args.dataType || 'json',
1425 - action = (args.prefix === undefined || 'learnpress_') + args.action,
1426 - data = args.action ? $.extend(args.data, {
1427 - action
1428 - }) : args.data;
1270 + dataType = args.dataType || 'json',
1271 + action = (args.prefix === undefined || 'learnpress_') + args.action,
1272 + data = args.action ? $.extend(args.data, {
1273 + action
1274 + }) : args.data;
1429 1275 $.ajax({
1430 1276 data,
1431 1277 url: args.url || window.location.href,
1432 1278 type,
1433 1279 dataType: 'html',
1434 -
1435 1280 success(raw) {
1436 1281 const response = LP.parseResponse(raw, dataType);
1437 1282 typeof args.success === 'function' && args.success(response, raw);
1438 1283 },
1439 -
1440 1284 error() {
1441 1285 typeof args.error === 'function' && args.error.apply(null, LP.funcArgs2Array());
1442 1286 }
1443 -
1444 1287 });
1445 1288 },
1446 -
1447 1289 funcArgs2Array(args) {
1448 1290 const arr = [];
1449 -
1450 1291 for (let i = 0; i < args.length; i++) {
1451 1292 arr.push(args[i]);
1452 1293 }
1453 -
1454 1294 return arr;
1455 1295 },
1456 -
1457 1296 addFilter(action, callback) {
1458 1297 const $doc = $(document),
1459 - event = 'LP.' + action;
1298 + event = 'LP.' + action;
1460 1299 $doc.on(event, callback);
1461 1300 LP.log($doc.data('events'));
1462 1301 return this;
1463 1302 },
1464 -
1465 1303 applyFilters() {
1466 1304 const $doc = $(document),
1467 - action = arguments[0],
1468 - args = this.funcArgs2Array(arguments);
1469 -
1305 + action = arguments[0],
1306 + args = this.funcArgs2Array(arguments);
1470 1307 if ($doc.hasEvent(action)) {
1471 1308 args[0] = 'LP.' + action;
1472 1309 return $doc.triggerHandler.apply($doc, args);
1473 1310 }
1474 -
1475 1311 return args[1];
1476 1312 },
1477 -
1478 1313 addAction(action, callback) {
1479 1314 return this.addFilter(action, callback);
1480 1315 },
1481 -
1482 1316 doAction() {
1483 1317 const $doc = $(document),
1484 - action = arguments[0],
1485 - args = this.funcArgs2Array(arguments);
1486 -
1318 + action = arguments[0],
1319 + args = this.funcArgs2Array(arguments);
1487 1320 if ($doc.hasEvent(action)) {
1488 1321 args[0] = 'LP.' + action;
1489 1322 $doc.trigger.apply($doc, args);
1490 1323 }
1491 1324 },
1492 -
1493 1325 toElement(element, args) {
1494 1326 if ($(element).length === 0) {
1495 1327 return;
1496 1328 }
1497 -
1498 1329 args = $.extend({
1499 1330 delay: 300,
1500 1331 duration: 'slow',
1501 1332 offset: 50,
@@ -1503,104 +1334,82 @@
1503 1334 callback: null,
1504 1335 invisible: false
1505 1336 }, args || {});
1506 1337 let $container = $(args.container),
1507 - rootTop = 0;
1508 -
1338 + rootTop = 0;
1509 1339 if ($container.length === 0) {
1510 1340 $container = $('body, html');
1511 1341 }
1512 -
1513 1342 rootTop = $container.offset().top;
1514 1343 const to = $(element).offset().top + $container.scrollTop() - rootTop - args.offset;
1515 -
1516 1344 function isElementInView(element, fullyInView) {
1517 1345 const pageTop = $container.scrollTop();
1518 1346 const pageBottom = pageTop + $container.height();
1519 1347 const elementTop = $(element).offset().top - $container.offset().top;
1520 1348 const elementBottom = elementTop + $(element).height();
1521 -
1522 1349 if (fullyInView === true) {
1523 1350 return pageTop < elementTop && pageBottom > elementBottom;
1524 1351 }
1525 -
1526 1352 return elementTop <= pageBottom && elementBottom >= pageTop;
1527 1353 }
1528 -
1529 1354 if (args.invisible && isElementInView(element, true)) {
1530 1355 return;
1531 1356 }
1532 -
1533 1357 $container.fadeIn(10).delay(args.delay).animate({
1534 1358 scrollTop: to
1535 1359 }, args.duration, args.callback);
1536 1360 },
1537 -
1538 1361 uniqueId(prefix, more_entropy) {
1539 1362 if (typeof prefix === 'undefined') {
1540 1363 prefix = '';
1541 1364 }
1542 -
1543 1365 let retId;
1544 -
1545 1366 const formatSeed = function (seed, reqWidth) {
1546 1367 seed = parseInt(seed, 10).toString(16); // to hex str
1547 -
1548 1368 if (reqWidth < seed.length) {
1549 1369 // so long we split
1550 1370 return seed.slice(seed.length - reqWidth);
1551 1371 }
1552 -
1553 1372 if (reqWidth > seed.length) {
1554 1373 // so short we pad
1555 1374 return new Array(1 + (reqWidth - seed.length)).join('0') + seed;
1556 1375 }
1557 -
1558 1376 return seed;
1559 - }; // BEGIN REDUNDANT
1377 + };
1560 1378
1561 -
1379 + // BEGIN REDUNDANT
1562 1380 if (!this.php_js) {
1563 1381 this.php_js = {};
1564 - } // END REDUNDANT
1565 -
1566 -
1382 + }
1383 + // END REDUNDANT
1567 1384 if (!this.php_js.uniqidSeed) {
1568 1385 // init seed with big random int
1569 1386 this.php_js.uniqidSeed = Math.floor(Math.random() * 0x75bcd15);
1570 1387 }
1571 -
1572 1388 this.php_js.uniqidSeed++;
1573 1389 retId = prefix; // start with prefix, add current milliseconds hex string
1574 -
1575 1390 retId += formatSeed(parseInt(new Date().getTime() / 1000, 10), 8);
1576 1391 retId += formatSeed(this.php_js.uniqidSeed, 5); // add seed hex string
1577 -
1578 1392 if (more_entropy) {
1579 1393 // for more entropy we add a float lower to 10
1580 1394 retId += (Math.random() * 10).toFixed(8).toString();
1581 1395 }
1582 -
1583 1396 return retId;
1584 1397 },
1585 -
1586 1398 log() {
1587 1399 //if (typeof LEARN_PRESS_DEBUG != 'undefined' && LEARN_PRESS_DEBUG && console) {
1588 1400 for (let i = 0, n = arguments.length; i < n; i++) {
1589 1401 console.log(arguments[i]);
1590 - } //}
1591 -
1402 + }
1403 + //}
1592 1404 },
1593 -
1594 1405 blockContent() {
1595 1406 if ($('#learn-press-block-content').length === 0) {
1596 1407 $(LP.template('learn-press-template-block-content', {})).appendTo($('body'));
1597 1408 }
1598 -
1599 1409 LP.hideMainScrollbar().addClass('block-content');
1600 1410 $(document).trigger('learn_press_block_content');
1601 1411 },
1602 -
1603 1412 unblockContent() {
1604 1413 setTimeout(function () {
1605 1414 LP.showMainScrollbar().removeClass('block-content');
1606 1415 $(document).trigger('learn_press_unblock_content');
@@ -1605,51 +1414,44 @@
1605 1414 LP.showMainScrollbar().removeClass('block-content');
1606 1415 $(document).trigger('learn_press_unblock_content');
1607 1416 }, 350);
1608 1417 },
1609 -
1610 1418 hideMainScrollbar(el) {
1611 1419 if (!el) {
1612 1420 el = 'html, body';
1613 1421 }
1614 -
1615 1422 const $el = $(el);
1616 1423 $el.each(function () {
1617 1424 const $root = $(this),
1618 - overflow = $root.css('overflow');
1425 + overflow = $root.css('overflow');
1619 1426 $root.css('overflow', 'hidden').attr('overflow', overflow);
1620 1427 });
1621 1428 return $el;
1622 1429 },
1623 -
1624 1430 showMainScrollbar(el) {
1625 1431 if (!el) {
1626 1432 el = 'html, body';
1627 1433 }
1628 -
1629 1434 const $el = $(el);
1630 1435 $el.each(function () {
1631 1436 const $root = $(this),
1632 - overflow = $root.attr('overflow');
1437 + overflow = $root.attr('overflow');
1633 1438 $root.css('overflow', overflow).removeAttr('overflow');
1634 1439 });
1635 1440 return $el;
1636 1441 },
1637 -
1638 1442 template: typeof _ !== 'undefined' ? _.memoize(function (id, data) {
1639 1443 let compiled,
1640 - options = {
1641 - evaluate: /<#([\s\S]+?)#>/g,
1642 - interpolate: /\{\{\{([\s\S]+?)\}\}\}/g,
1643 - escape: /\{\{([^\}]+?)\}\}(?!\})/g,
1644 - variable: 'data'
1645 - };
1646 -
1444 + options = {
1445 + evaluate: /<#([\s\S]+?)#>/g,
1446 + interpolate: /\{\{\{([\s\S]+?)\}\}\}/g,
1447 + escape: /\{\{([^\}]+?)\}\}(?!\})/g,
1448 + variable: 'data'
1449 + };
1647 1450 const tmpl = function (data) {
1648 1451 compiled = compiled || _.template($('#' + id).html(), null, options);
1649 1452 return compiled(data);
1650 1453 };
1651 -
1652 1454 return data ? tmpl(data) : tmpl;
1653 1455 }, function (a, b) {
1654 1456 return a + '-' + JSON.stringify(b);
1655 1457 }) : function () {
@@ -1654,13 +1456,11 @@
1654 1456 return a + '-' + JSON.stringify(b);
1655 1457 }) : function () {
1656 1458 return '';
1657 1459 },
1658 -
1659 1460 alert(localize, callback) {
1660 1461 let title = '',
1661 - message = '';
1662 -
1462 + message = '';
1663 1463 if (typeof localize === 'string') {
1664 1464 message = localize;
1665 1465 } else {
1666 1466 if (typeof localize.title !== 'undefined') {
@@ -1665,27 +1465,21 @@
1665 1465 } else {
1666 1466 if (typeof localize.title !== 'undefined') {
1667 1467 title = localize.title;
1668 1468 }
1669 -
1670 1469 if (typeof localize.message !== 'undefined') {
1671 1470 message = localize.message;
1672 1471 }
1673 1472 }
1674 -
1675 1473 $.alerts.alert(message, title, function (e) {
1676 1474 LP._on_alert_hide();
1677 -
1678 1475 callback && callback(e);
1679 1476 });
1680 -
1681 1477 this._on_alert_show();
1682 1478 },
1683 -
1684 1479 confirm(localize, callback) {
1685 1480 let title = '',
1686 - message = '';
1687 -
1481 + message = '';
1688 1482 if (typeof localize === 'string') {
1689 1483 message = localize;
1690 1484 } else {
1691 1485 if (typeof localize.title !== 'undefined') {
@@ -1690,40 +1484,32 @@
1690 1484 } else {
1691 1485 if (typeof localize.title !== 'undefined') {
1692 1486 title = localize.title;
1693 1487 }
1694 -
1695 1488 if (typeof localize.message !== 'undefined') {
1696 1489 message = localize.message;
1697 1490 }
1698 1491 }
1699 -
1700 1492 $.alerts.confirm(message, title, function (e) {
1701 1493 LP._on_alert_hide();
1702 -
1703 1494 callback && callback(e);
1704 1495 });
1705 -
1706 1496 this._on_alert_show();
1707 1497 },
1708 -
1709 1498 _on_alert_show() {
1710 1499 const $container = $('#popup_container'),
1711 - $placeholder = $('<span id="popup_container_placeholder" />').insertAfter($container).data('xxx', $container);
1500 + $placeholder = $('<span id="popup_container_placeholder" />').insertAfter($container).data('xxx', $container);
1712 1501 $container.stop().css('top', '-=50').css('opacity', '0').animate({
1713 1502 top: '+=50',
1714 1503 opacity: 1
1715 1504 }, 250);
1716 1505 },
1717 -
1718 1506 _on_alert_hide() {
1719 1507 const $holder = $('#popup_container_placeholder'),
1720 - $container = $holder.data('xxx');
1721 -
1508 + $container = $holder.data('xxx');
1722 1509 if ($container) {
1723 1510 $container.replaceWith($holder);
1724 1511 }
1725 -
1726 1512 $container.appendTo($(document.body));
1727 1513 $container.stop().animate({
1728 1514 top: '+=50',
1729 1515 opacity: 0
@@ -1730,50 +1516,39 @@
1730 1516 }, 250, function () {
1731 1517 $(this).remove();
1732 1518 });
1733 1519 },
1734 -
1735 1520 sendMessage(data, object, targetOrigin, transfer) {
1736 1521 if ($.isPlainObject(data)) {
1737 1522 data = JSON.stringify(data);
1738 1523 }
1739 -
1740 1524 object = object || window;
1741 1525 targetOrigin = targetOrigin || '*';
1742 1526 object.postMessage(data, targetOrigin, transfer);
1743 1527 },
1744 -
1745 1528 receiveMessage(event, b) {
1746 1529 let target = event.origin || event.originalEvent.origin,
1747 - data = event.data || event.originalEvent.data || '';
1748 -
1530 + data = event.data || event.originalEvent.data || '';
1749 1531 if (typeof data === 'string' || data instanceof String) {
1750 1532 if (data.indexOf('{') === 0) {
1751 1533 data = LP.parseJSON(data);
1752 1534 }
1753 1535 }
1754 -
1755 1536 LP.Hook.doAction('learn_press_receive_message', data, target);
1756 1537 },
1757 -
1758 - camelCaseDashObjectKeys(obj) {
1759 - let deep = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
1538 + camelCaseDashObjectKeys(obj, deep = true) {
1760 1539 const self = LP;
1761 -
1762 1540 const isArray = function (a) {
1763 1541 return Array.isArray(a);
1764 1542 };
1765 -
1766 1543 const isObject = function (o) {
1767 1544 return o === Object(o) && !isArray(o) && typeof o !== 'function';
1768 1545 };
1769 -
1770 1546 const toCamel = s => {
1771 1547 return s.replace(/([-_][a-z])/ig, $1 => {
1772 1548 return $1.toUpperCase().replace('-', '').replace('_', '');
1773 1549 });
1774 1550 };
1775 -
1776 1551 if (isObject(obj)) {
1777 1552 const n = {};
1778 1553 Object.keys(obj).forEach(k => {
1779 1554 n[toCamel(k)] = deep ? self.camelCaseDashObjectKeys(obj[k]) : obj[k];
@@ -1783,12 +1558,10 @@
1783 1558 return obj.map(i => {
1784 1559 return self.camelCaseDashObjectKeys(i);
1785 1560 });
1786 1561 }
1787 -
1788 1562 return obj;
1789 1563 },
1790 -
1791 1564 IframeSubmit: _iframe_submit__WEBPACK_IMPORTED_MODULE_9__["default"]
1792 1565 };
1793 1566 $(document).ready(function () {
1794 1567 if (typeof $.alerts !== 'undefined') {
@@ -1796,13 +1569,11 @@
1796 1569 $.alerts.overlayOpacity = 0.5;
1797 1570 $.alerts.okButton = lpGlobalSettings.localize.button_ok;
1798 1571 $.alerts.cancelButton = lpGlobalSettings.localize.button_cancel;
1799 1572 }
1800 -
1801 1573 $('.learn-press-message.fixed').each(function () {
1802 1574 const $el = $(this),
1803 - options = $el.data();
1804 -
1575 + options = $el.data();
1805 1576 (function ($el, options) {
1806 1577 if (options.delayIn) {
1807 1578 setTimeout(function () {
1808 1579 $el.show().hide().fadeIn();
@@ -1807,9 +1578,8 @@
1807 1578 setTimeout(function () {
1808 1579 $el.show().hide().fadeIn();
1809 1580 }, options.delayIn);
1810 1581 }
1811 -
1812 1582 if (options.delayOut) {
1813 1583 setTimeout(function () {
1814 1584 $el.fadeOut();
1815 1585 }, options.delayOut + (options.delayIn || 0));
@@ -1818,24 +1588,23 @@
1818 1588 });
1819 1589 setTimeout(function () {
1820 1590 $('.learn-press-nav-tabs li.active:not(.default) a').trigger('click');
1821 1591 }, 300);
1822 - $('body.course-item-popup').parent().css('overflow', 'hidden');
1823 1592
1593 + //$( 'body.course-item-popup' ).parent().css( 'overflow', 'hidden' );
1594 +
1824 1595 (function () {
1825 1596 let timer = null,
1826 - callback = function () {
1827 - $('.auto-check-lines').checkLines(function (r) {
1828 - if (r > 1) {
1829 - $(this).removeClass('single-lines');
1830 - } else {
1831 - $(this).addClass('single-lines');
1832 - }
1833 -
1834 - $(this).attr('rows', r);
1835 - });
1836 - };
1837 -
1597 + callback = function () {
1598 + $('.auto-check-lines').checkLines(function (r) {
1599 + if (r > 1) {
1600 + $(this).removeClass('single-lines');
1601 + } else {
1602 + $(this).addClass('single-lines');
1603 + }
1604 + $(this).attr('rows', r);
1605 + });
1606 + };
1838 1607 $(window).on('resize.check-lines', function () {
1839 1608 if (timer) {
1840 1609 timer && clearTimeout(timer);
1841 1610 timer = setTimeout(callback, 300);
@@ -1843,9 +1612,8 @@
1843 1612 callback();
1844 1613 }
1845 1614 });
1846 1615 })();
1847 -
1848 1616 $('.learn-press-tooltip, .lp-passing-conditional').LP_Tooltip({
1849 1617 offset: [24, 24]
1850 1618 });
1851 1619 $('.learn-press-icon').LP_Tooltip({
@@ -1852,10 +1620,9 @@
1852 1620 offset: [30, 30]
1853 1621 });
1854 1622 $('.learn-press-message[data-autoclose]').each(function () {
1855 1623 const $el = $(this),
1856 - delay = parseInt($el.data('autoclose'));
1857 -
1624 + delay = parseInt($el.data('autoclose'));
1858 1625 if (delay) {
1859 1626 setTimeout(function ($el) {
1860 1627 $el.fadeOut();
1861 1628 }, delay, $el);
@@ -1871,9 +1638,9 @@
1871 1638 Cookies: _cookies__WEBPACK_IMPORTED_MODULE_6__["default"],
1872 1639 localStorage: _local_storage__WEBPACK_IMPORTED_MODULE_7__["default"],
1873 1640 ..._default
1874 1641 });
1875 -/* harmony default export */ __webpack_exports__["default"] = ({
1642 +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
1876 1643 fn: _fn__WEBPACK_IMPORTED_MODULE_1__["default"],
1877 1644 QuickTip: (_quick_tip__WEBPACK_IMPORTED_MODULE_2___default()),
1878 1645 Cookies: _cookies__WEBPACK_IMPORTED_MODULE_6__["default"],
1879 1646 localStorage: _local_storage__WEBPACK_IMPORTED_MODULE_7__["default"],
@@ -1878,8 +1645,9 @@
1878 1645 Cookies: _cookies__WEBPACK_IMPORTED_MODULE_6__["default"],
1879 1646 localStorage: _local_storage__WEBPACK_IMPORTED_MODULE_7__["default"],
1880 1647 showPass: (_show_password__WEBPACK_IMPORTED_MODULE_10___default())
1881 1648 });
1882 -}();
1649 +})();
1650 +
1883 1651 /******/ })()
1884 1652 ;
1885 1653 //# sourceMappingURL=utils.js.map