| @@ -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 | +__webpack_require__.dn(__WEBPACK_DEFAULT_EXPORT__); | |
| 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,24 +1007,24 @@ | ||
| 1142 | 1007 | } |
| 1143 | 1008 | }); |
| 1144 | 1009 | }); |
| 1145 | 1010 | |
| 1146 | -/***/ }) | |
| 1011 | +/***/ } | |
| 1147 | 1012 | |
| 1148 | 1013 | /******/ }); |
| 1149 | 1014 | /************************************************************************/ |
| 1150 | 1015 | /******/ // The module cache |
| 1151 | -/******/ var __webpack_module_cache__ = {}; | |
| 1016 | +/******/ const __webpack_module_cache__ = {}; | |
| 1152 | 1017 | /******/ |
| 1153 | 1018 | /******/ // The require function |
| 1154 | 1019 | /******/ function __webpack_require__(moduleId) { |
| 1155 | 1020 | /******/ // Check if module is in cache |
| 1156 | -/******/ var cachedModule = __webpack_module_cache__[moduleId]; | |
| 1021 | +/******/ const cachedModule = __webpack_module_cache__[moduleId]; | |
| 1157 | 1022 | /******/ if (cachedModule !== undefined) { |
| 1158 | 1023 | /******/ return cachedModule.exports; |
| 1159 | 1024 | /******/ } |
| 1160 | 1025 | /******/ // Create a new module (and put it into the cache) |
| 1161 | -/******/ var module = __webpack_module_cache__[moduleId] = { | |
| 1026 | +/******/ const module = __webpack_module_cache__[moduleId] = { | |
| 1162 | 1027 | /******/ // no module.id needed |
| 1163 | 1028 | /******/ // no module.loaded needed |
| 1164 | 1029 | /******/ exports: {} |
| 1165 | 1030 | /******/ }; |
| @@ -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 | +/******/ const 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,56 +1043,85 @@ | ||
| 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) { | |
| 1179 | -/******/ var getter = module && module.__esModule ? | |
| 1180 | -/******/ function() { return module['default']; } : | |
| 1181 | -/******/ function() { return module; }; | |
| 1049 | +/******/ __webpack_require__.n = (module) => { | |
| 1050 | +/******/ const getter = module && module.__esModule ? | |
| 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() { | |
| 1189 | -/******/ // define getter functions for harmony exports | |
| 1190 | -/******/ __webpack_require__.d = function(exports, definition) { | |
| 1191 | -/******/ for(var key in definition) { | |
| 1192 | -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { | |
| 1193 | -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); | |
| 1059 | +/******/ (() => { | |
| 1060 | +/******/ // define getter/value functions for harmony exports | |
| 1061 | +/******/ __webpack_require__.d = (exports, definition) => { | |
| 1062 | +/******/ if(Array.isArray(definition)) { | |
| 1063 | +/******/ var i = 0; | |
| 1064 | +/******/ while(i < definition.length) { | |
| 1065 | +/******/ var key = definition[i++]; | |
| 1066 | +/******/ var binding = definition[i++]; | |
| 1067 | +/******/ if(!__webpack_require__.o(exports, key)) { | |
| 1068 | +/******/ if(binding === 0) { | |
| 1069 | +/******/ Object.defineProperty(exports, key, { enumerable: true, value: definition[i++] }); | |
| 1070 | +/******/ } else { | |
| 1071 | +/******/ Object.defineProperty(exports, key, { enumerable: true, get: binding }); | |
| 1072 | +/******/ } | |
| 1073 | +/******/ } else if(binding === 0) { i++; } | |
| 1194 | 1074 | /******/ } |
| 1075 | +/******/ } else { | |
| 1076 | +/******/ for(var key in definition) { | |
| 1077 | +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { | |
| 1078 | +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); | |
| 1079 | +/******/ } | |
| 1080 | +/******/ } | |
| 1195 | 1081 | /******/ } |
| 1196 | 1082 | /******/ }; |
| 1197 | -/******/ }(); | |
| 1083 | +/******/ })(); | |
| 1198 | 1084 | /******/ |
| 1199 | 1085 | /******/ /* webpack/runtime/hasOwnProperty shorthand */ |
| 1200 | -/******/ !function() { | |
| 1201 | -/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } | |
| 1202 | -/******/ }(); | |
| 1086 | +/******/ (() => { | |
| 1087 | +/******/ __webpack_require__.o = (obj, prop) => (Object.hasOwn(obj, prop)) | |
| 1088 | +/******/ })(); | |
| 1203 | 1089 | /******/ |
| 1204 | 1090 | /******/ /* webpack/runtime/make namespace object */ |
| 1205 | -/******/ !function() { | |
| 1091 | +/******/ (() => { | |
| 1206 | 1092 | /******/ // define __esModule on exports |
| 1207 | -/******/ __webpack_require__.r = function(exports) { | |
| 1208 | -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { | |
| 1093 | +/******/ __webpack_require__.r = (exports) => { | |
| 1094 | +/******/ if(Symbol.toStringTag) { | |
| 1209 | 1095 | /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
| 1210 | 1096 | /******/ } |
| 1211 | 1097 | /******/ Object.defineProperty(exports, '__esModule', { value: true }); |
| 1212 | 1098 | /******/ }; |
| 1213 | -/******/ }(); | |
| 1099 | +/******/ })(); | |
| 1214 | 1100 | /******/ |
| 1101 | +/******/ /* webpack/runtime/set anonymous default export name */ | |
| 1102 | +/******/ (() => { | |
| 1103 | +/******/ // set .name for anonymous default exports per ES spec | |
| 1104 | +/******/ // skipped when the property is non-configurable (pre-ES2015 engines), | |
| 1105 | +/******/ // where Object.defineProperty would throw | |
| 1106 | +/******/ __webpack_require__.dn = (x) => { | |
| 1107 | +/******/ var descriptor = Object.getOwnPropertyDescriptor(x, "name"); | |
| 1108 | +/******/ if (!descriptor || (!descriptor.writable && descriptor.configurable)) Object.defineProperty(x, "name", { value: "default", configurable: true }); | |
| 1109 | +/******/ }; | |
| 1110 | +/******/ })(); | |
| 1111 | +/******/ | |
| 1215 | 1112 | /************************************************************************/ |
| 1216 | -var __webpack_exports__ = {}; | |
| 1217 | -// This entry need to be wrapped in an IIFE because it need to be in strict mode. | |
| 1218 | -!function() { | |
| 1113 | +let __webpack_exports__ = {}; | |
| 1114 | +// This entry needs to be wrapped in an IIFE because it needs to be in strict mode. | |
| 1115 | +(() => { | |
| 1219 | 1116 | "use strict"; |
| 1220 | 1117 | /*!**************************************!*\ |
| 1221 | 1118 | !*** ./assets/src/js/utils/index.js ***! |
| 1222 | 1119 | \**************************************/ |
| 1223 | 1120 | __webpack_require__.r(__webpack_exports__); |
| 1121 | +/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 1122 | +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) | |
| 1123 | +/* harmony export */ }); | |
| 1224 | 1124 | /* harmony import */ var _extend__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./extend */ "./assets/src/js/utils/extend.js"); |
| 1225 | 1125 | /* harmony import */ var _fn__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./fn */ "./assets/src/js/utils/fn.js"); |
| 1226 | 1126 | /* harmony import */ var _quick_tip__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./quick-tip */ "./assets/src/js/utils/quick-tip.js"); |
| 1227 | 1127 | /* harmony import */ var _quick_tip__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_quick_tip__WEBPACK_IMPORTED_MODULE_2__); |
| @@ -1249,22 +1149,20 @@ | ||
| 1249 | 1149 | |
| 1250 | 1150 | |
| 1251 | 1151 | |
| 1252 | 1152 | |
| 1153 | + | |
| 1253 | 1154 | const $ = jQuery; |
| 1254 | - | |
| 1255 | 1155 | String.prototype.getQueryVar = function (name) { |
| 1256 | 1156 | name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]'); |
| 1257 | 1157 | const regex = new RegExp('[\\?&]' + name + '=([^&#]*)'), |
| 1258 | - results = regex.exec(this); | |
| 1158 | + results = regex.exec(this); | |
| 1259 | 1159 | return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' ')); |
| 1260 | 1160 | }; |
| 1261 | - | |
| 1262 | 1161 | String.prototype.addQueryVar = function (name, value) { |
| 1263 | 1162 | let url = this, |
| 1264 | - m = url.split('#'); | |
| 1163 | + m = url.split('#'); | |
| 1265 | 1164 | url = m[0]; |
| 1266 | - | |
| 1267 | 1165 | if (name.match(/\[/)) { |
| 1268 | 1166 | url += url.match(/\?/) ? '&' : '?'; |
| 1269 | 1167 | url += name + '=' + value; |
| 1270 | 1168 | } else if (url.indexOf('&' + name + '=') != -1 || url.indexOf('?' + name + '=') != -1) { |
| @@ -1272,12 +1170,10 @@ | ||
| 1272 | 1170 | } else { |
| 1273 | 1171 | url += url.match(/\?/) ? '&' : '?'; |
| 1274 | 1172 | url += name + '=' + value; |
| 1275 | 1173 | } |
| 1276 | - | |
| 1277 | 1174 | return url + (m[1] ? '#' + m[1] : ''); |
| 1278 | 1175 | }; |
| 1279 | - | |
| 1280 | 1176 | String.prototype.removeQueryVar = function (name) { |
| 1281 | 1177 | let url = this; |
| 1282 | 1178 | const m = url.split('#'); |
| 1283 | 1179 | url = m[0]; |
| @@ -1284,9 +1180,11 @@ | ||
| 1284 | 1180 | name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]'); |
| 1285 | 1181 | const regex = new RegExp('[\\?&]' + name + '([\[][^=]*)?=([^&#]*)', 'g'); |
| 1286 | 1182 | url = url.replace(regex, ''); |
| 1287 | 1183 | return url + (m[1] ? '#' + m[1] : ''); |
| 1288 | -}; // if ( $.isEmptyObject( '' ) == false ) { | |
| 1184 | +}; | |
| 1185 | + | |
| 1186 | +// if ( $.isEmptyObject( '' ) == false ) { | |
| 1289 | 1187 | // $.isEmptyObject = function( a ) { |
| 1290 | 1188 | // let prop; |
| 1291 | 1189 | // for ( prop in a ) { |
| 1292 | 1190 | // if ( a.hasOwnProperty( prop ) ) { |
| @@ -1296,12 +1194,10 @@ | ||
| 1296 | 1194 | // return true; |
| 1297 | 1195 | // }; |
| 1298 | 1196 | // } |
| 1299 | 1197 | |
| 1300 | - | |
| 1301 | 1198 | const _default = { |
| 1302 | 1199 | Hook: _hook__WEBPACK_IMPORTED_MODULE_5__["default"], |
| 1303 | - | |
| 1304 | 1200 | setUrl(url, ember, title) { |
| 1305 | 1201 | if (url) { |
| 1306 | 1202 | history.pushState({}, title, url); |
| 1307 | 1203 | LP.Hook.doAction('learn_press_set_location_url', url); |
| @@ -1306,20 +1202,16 @@ | ||
| 1306 | 1202 | history.pushState({}, title, url); |
| 1307 | 1203 | LP.Hook.doAction('learn_press_set_location_url', url); |
| 1308 | 1204 | } |
| 1309 | 1205 | }, |
| 1310 | - | |
| 1311 | 1206 | toggleGroupSection(el, target) { |
| 1312 | 1207 | const $el = $(el), |
| 1313 | - isHide = $el.hasClass('hide-if-js'); | |
| 1314 | - | |
| 1208 | + isHide = $el.hasClass('hide-if-js'); | |
| 1315 | 1209 | if (isHide) { |
| 1316 | 1210 | $el.hide().removeClass('hide-if-js'); |
| 1317 | 1211 | } |
| 1318 | - | |
| 1319 | 1212 | $el.removeClass('hide-if-js').slideToggle(function () { |
| 1320 | 1213 | const $this = $(this); |
| 1321 | - | |
| 1322 | 1214 | if ($this.is(':visible')) { |
| 1323 | 1215 | $(target).addClass('toggle-on').removeClass('toggle-off'); |
| 1324 | 1216 | } else { |
| 1325 | 1217 | $(target).addClass('toggle-off').removeClass('toggle-on'); |
| @@ -1325,13 +1217,11 @@ | ||
| 1325 | 1217 | $(target).addClass('toggle-off').removeClass('toggle-on'); |
| 1326 | 1218 | } |
| 1327 | 1219 | }); |
| 1328 | 1220 | }, |
| 1329 | - | |
| 1330 | 1221 | overflow(el, v) { |
| 1331 | 1222 | const $el = $(el), |
| 1332 | - overflow = $el.css('overflow'); | |
| 1333 | - | |
| 1223 | + overflow = $el.css('overflow'); | |
| 1334 | 1224 | if (v) { |
| 1335 | 1225 | $el.css('overflow', v).data('overflow', overflow); |
| 1336 | 1226 | } else { |
| 1337 | 1227 | $el.css('overflow', $el.data('overflow')); |
| @@ -1336,48 +1226,37 @@ | ||
| 1336 | 1226 | } else { |
| 1337 | 1227 | $el.css('overflow', $el.data('overflow')); |
| 1338 | 1228 | } |
| 1339 | 1229 | }, |
| 1340 | - | |
| 1341 | 1230 | getUrl() { |
| 1342 | 1231 | return window.location.href; |
| 1343 | 1232 | }, |
| 1344 | - | |
| 1345 | 1233 | addQueryVar(name, value, url) { |
| 1346 | 1234 | return (url === undefined ? window.location.href : url).addQueryVar(name, value); |
| 1347 | 1235 | }, |
| 1348 | - | |
| 1349 | 1236 | removeQueryVar(name, url) { |
| 1350 | 1237 | return (url === undefined ? window.location.href : url).removeQueryVar(name); |
| 1351 | 1238 | }, |
| 1352 | - | |
| 1353 | 1239 | reload(url) { |
| 1354 | 1240 | if (!url) { |
| 1355 | 1241 | url = window.location.href; |
| 1356 | 1242 | } |
| 1357 | - | |
| 1358 | 1243 | window.location.href = url; |
| 1359 | 1244 | }, |
| 1360 | - | |
| 1361 | 1245 | parseResponse(response, type) { |
| 1362 | 1246 | const m = response.match(/<-- LP_AJAX_START -->(.*)<-- LP_AJAX_END -->/s); |
| 1363 | - | |
| 1364 | 1247 | if (m) { |
| 1365 | 1248 | response = m[1]; |
| 1366 | 1249 | } |
| 1367 | - | |
| 1368 | 1250 | return (type || 'json') === 'json' ? this.parseJSON(response) : response; |
| 1369 | 1251 | }, |
| 1370 | - | |
| 1371 | 1252 | parseJSON(data) { |
| 1372 | 1253 | if (typeof data !== 'string') { |
| 1373 | 1254 | return data; |
| 1374 | 1255 | } |
| 1375 | - | |
| 1376 | 1256 | const m = String.raw({ |
| 1377 | 1257 | raw: data |
| 1378 | 1258 | }).match(/<-- LP_AJAX_START -->(.*)<-- LP_AJAX_END -->/s); |
| 1379 | - | |
| 1380 | 1259 | try { |
| 1381 | 1260 | if (m) { |
| 1382 | 1261 | data = JSON.parse(m[1].replace(/(?:\r\n|\r|\n)/g, '')); |
| 1383 | 1262 | } else { |
| @@ -1385,22 +1264,19 @@ | ||
| 1385 | 1264 | } |
| 1386 | 1265 | } catch (e) { |
| 1387 | 1266 | data = {}; |
| 1388 | 1267 | } |
| 1389 | - | |
| 1390 | 1268 | return data; |
| 1391 | 1269 | }, |
| 1392 | - | |
| 1393 | 1270 | ajax(args) { |
| 1394 | 1271 | 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 | - | |
| 1272 | + dataType = args.dataType || 'json', | |
| 1273 | + data = args.action ? $.extend(args.data, { | |
| 1274 | + 'lp-ajax': args.action | |
| 1275 | + }) : args.data, | |
| 1276 | + beforeSend = args.beforeSend || function () {}, | |
| 1277 | + url = args.url || window.location.href; | |
| 1278 | + // console.debug( beforeSend ); | |
| 1403 | 1279 | $.ajax({ |
| 1404 | 1280 | data, |
| 1405 | 1281 | url, |
| 1406 | 1282 | type, |
| @@ -1405,97 +1281,78 @@ | ||
| 1405 | 1281 | url, |
| 1406 | 1282 | type, |
| 1407 | 1283 | dataType: 'html', |
| 1408 | 1284 | beforeSend: beforeSend.apply(null, args), |
| 1409 | - | |
| 1410 | 1285 | success(raw) { |
| 1411 | 1286 | const response = LP.parseResponse(raw, dataType); |
| 1412 | 1287 | typeof args.success === 'function' && args.success(response, raw); |
| 1413 | 1288 | }, |
| 1414 | - | |
| 1415 | 1289 | error() { |
| 1416 | 1290 | typeof args.error === 'function' && args.error.apply(null, LP.funcArgs2Array()); |
| 1417 | 1291 | } |
| 1418 | - | |
| 1419 | 1292 | }); |
| 1420 | 1293 | }, |
| 1421 | - | |
| 1422 | 1294 | doAjax(args) { |
| 1423 | 1295 | 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; | |
| 1296 | + dataType = args.dataType || 'json', | |
| 1297 | + action = (args.prefix === undefined || 'learnpress_') + args.action, | |
| 1298 | + data = args.action ? $.extend(args.data, { | |
| 1299 | + action | |
| 1300 | + }) : args.data; | |
| 1429 | 1301 | $.ajax({ |
| 1430 | 1302 | data, |
| 1431 | 1303 | url: args.url || window.location.href, |
| 1432 | 1304 | type, |
| 1433 | 1305 | dataType: 'html', |
| 1434 | - | |
| 1435 | 1306 | success(raw) { |
| 1436 | 1307 | const response = LP.parseResponse(raw, dataType); |
| 1437 | 1308 | typeof args.success === 'function' && args.success(response, raw); |
| 1438 | 1309 | }, |
| 1439 | - | |
| 1440 | 1310 | error() { |
| 1441 | 1311 | typeof args.error === 'function' && args.error.apply(null, LP.funcArgs2Array()); |
| 1442 | 1312 | } |
| 1443 | - | |
| 1444 | 1313 | }); |
| 1445 | 1314 | }, |
| 1446 | - | |
| 1447 | 1315 | funcArgs2Array(args) { |
| 1448 | 1316 | const arr = []; |
| 1449 | - | |
| 1450 | 1317 | for (let i = 0; i < args.length; i++) { |
| 1451 | 1318 | arr.push(args[i]); |
| 1452 | 1319 | } |
| 1453 | - | |
| 1454 | 1320 | return arr; |
| 1455 | 1321 | }, |
| 1456 | - | |
| 1457 | 1322 | addFilter(action, callback) { |
| 1458 | 1323 | const $doc = $(document), |
| 1459 | - event = 'LP.' + action; | |
| 1324 | + event = 'LP.' + action; | |
| 1460 | 1325 | $doc.on(event, callback); |
| 1461 | 1326 | LP.log($doc.data('events')); |
| 1462 | 1327 | return this; |
| 1463 | 1328 | }, |
| 1464 | - | |
| 1465 | 1329 | applyFilters() { |
| 1466 | 1330 | const $doc = $(document), |
| 1467 | - action = arguments[0], | |
| 1468 | - args = this.funcArgs2Array(arguments); | |
| 1469 | - | |
| 1331 | + action = arguments[0], | |
| 1332 | + args = this.funcArgs2Array(arguments); | |
| 1470 | 1333 | if ($doc.hasEvent(action)) { |
| 1471 | 1334 | args[0] = 'LP.' + action; |
| 1472 | 1335 | return $doc.triggerHandler.apply($doc, args); |
| 1473 | 1336 | } |
| 1474 | - | |
| 1475 | 1337 | return args[1]; |
| 1476 | 1338 | }, |
| 1477 | - | |
| 1478 | 1339 | addAction(action, callback) { |
| 1479 | 1340 | return this.addFilter(action, callback); |
| 1480 | 1341 | }, |
| 1481 | - | |
| 1482 | 1342 | doAction() { |
| 1483 | 1343 | const $doc = $(document), |
| 1484 | - action = arguments[0], | |
| 1485 | - args = this.funcArgs2Array(arguments); | |
| 1486 | - | |
| 1344 | + action = arguments[0], | |
| 1345 | + args = this.funcArgs2Array(arguments); | |
| 1487 | 1346 | if ($doc.hasEvent(action)) { |
| 1488 | 1347 | args[0] = 'LP.' + action; |
| 1489 | 1348 | $doc.trigger.apply($doc, args); |
| 1490 | 1349 | } |
| 1491 | 1350 | }, |
| 1492 | - | |
| 1493 | 1351 | toElement(element, args) { |
| 1494 | 1352 | if ($(element).length === 0) { |
| 1495 | 1353 | return; |
| 1496 | 1354 | } |
| 1497 | - | |
| 1498 | 1355 | args = $.extend({ |
| 1499 | 1356 | delay: 300, |
| 1500 | 1357 | duration: 'slow', |
| 1501 | 1358 | offset: 50, |
| @@ -1503,104 +1360,82 @@ | ||
| 1503 | 1360 | callback: null, |
| 1504 | 1361 | invisible: false |
| 1505 | 1362 | }, args || {}); |
| 1506 | 1363 | let $container = $(args.container), |
| 1507 | - rootTop = 0; | |
| 1508 | - | |
| 1364 | + rootTop = 0; | |
| 1509 | 1365 | if ($container.length === 0) { |
| 1510 | 1366 | $container = $('body, html'); |
| 1511 | 1367 | } |
| 1512 | - | |
| 1513 | 1368 | rootTop = $container.offset().top; |
| 1514 | 1369 | const to = $(element).offset().top + $container.scrollTop() - rootTop - args.offset; |
| 1515 | - | |
| 1516 | 1370 | function isElementInView(element, fullyInView) { |
| 1517 | 1371 | const pageTop = $container.scrollTop(); |
| 1518 | 1372 | const pageBottom = pageTop + $container.height(); |
| 1519 | 1373 | const elementTop = $(element).offset().top - $container.offset().top; |
| 1520 | 1374 | const elementBottom = elementTop + $(element).height(); |
| 1521 | - | |
| 1522 | 1375 | if (fullyInView === true) { |
| 1523 | 1376 | return pageTop < elementTop && pageBottom > elementBottom; |
| 1524 | 1377 | } |
| 1525 | - | |
| 1526 | 1378 | return elementTop <= pageBottom && elementBottom >= pageTop; |
| 1527 | 1379 | } |
| 1528 | - | |
| 1529 | 1380 | if (args.invisible && isElementInView(element, true)) { |
| 1530 | 1381 | return; |
| 1531 | 1382 | } |
| 1532 | - | |
| 1533 | 1383 | $container.fadeIn(10).delay(args.delay).animate({ |
| 1534 | 1384 | scrollTop: to |
| 1535 | 1385 | }, args.duration, args.callback); |
| 1536 | 1386 | }, |
| 1537 | - | |
| 1538 | 1387 | uniqueId(prefix, more_entropy) { |
| 1539 | 1388 | if (typeof prefix === 'undefined') { |
| 1540 | 1389 | prefix = ''; |
| 1541 | 1390 | } |
| 1542 | - | |
| 1543 | 1391 | let retId; |
| 1544 | - | |
| 1545 | 1392 | const formatSeed = function (seed, reqWidth) { |
| 1546 | 1393 | seed = parseInt(seed, 10).toString(16); // to hex str |
| 1547 | - | |
| 1548 | 1394 | if (reqWidth < seed.length) { |
| 1549 | 1395 | // so long we split |
| 1550 | 1396 | return seed.slice(seed.length - reqWidth); |
| 1551 | 1397 | } |
| 1552 | - | |
| 1553 | 1398 | if (reqWidth > seed.length) { |
| 1554 | 1399 | // so short we pad |
| 1555 | 1400 | return new Array(1 + (reqWidth - seed.length)).join('0') + seed; |
| 1556 | 1401 | } |
| 1557 | - | |
| 1558 | 1402 | return seed; |
| 1559 | - }; // BEGIN REDUNDANT | |
| 1403 | + }; | |
| 1560 | 1404 | |
| 1561 | - | |
| 1405 | + // BEGIN REDUNDANT | |
| 1562 | 1406 | if (!this.php_js) { |
| 1563 | 1407 | this.php_js = {}; |
| 1564 | - } // END REDUNDANT | |
| 1565 | - | |
| 1566 | - | |
| 1408 | + } | |
| 1409 | + // END REDUNDANT | |
| 1567 | 1410 | if (!this.php_js.uniqidSeed) { |
| 1568 | 1411 | // init seed with big random int |
| 1569 | 1412 | this.php_js.uniqidSeed = Math.floor(Math.random() * 0x75bcd15); |
| 1570 | 1413 | } |
| 1571 | - | |
| 1572 | 1414 | this.php_js.uniqidSeed++; |
| 1573 | 1415 | retId = prefix; // start with prefix, add current milliseconds hex string |
| 1574 | - | |
| 1575 | 1416 | retId += formatSeed(parseInt(new Date().getTime() / 1000, 10), 8); |
| 1576 | 1417 | retId += formatSeed(this.php_js.uniqidSeed, 5); // add seed hex string |
| 1577 | - | |
| 1578 | 1418 | if (more_entropy) { |
| 1579 | 1419 | // for more entropy we add a float lower to 10 |
| 1580 | 1420 | retId += (Math.random() * 10).toFixed(8).toString(); |
| 1581 | 1421 | } |
| 1582 | - | |
| 1583 | 1422 | return retId; |
| 1584 | 1423 | }, |
| 1585 | - | |
| 1586 | 1424 | log() { |
| 1587 | 1425 | //if (typeof LEARN_PRESS_DEBUG != 'undefined' && LEARN_PRESS_DEBUG && console) { |
| 1588 | 1426 | for (let i = 0, n = arguments.length; i < n; i++) { |
| 1589 | 1427 | console.log(arguments[i]); |
| 1590 | - } //} | |
| 1591 | - | |
| 1428 | + } | |
| 1429 | + //} | |
| 1592 | 1430 | }, |
| 1593 | - | |
| 1594 | 1431 | blockContent() { |
| 1595 | 1432 | if ($('#learn-press-block-content').length === 0) { |
| 1596 | 1433 | $(LP.template('learn-press-template-block-content', {})).appendTo($('body')); |
| 1597 | 1434 | } |
| 1598 | - | |
| 1599 | 1435 | LP.hideMainScrollbar().addClass('block-content'); |
| 1600 | 1436 | $(document).trigger('learn_press_block_content'); |
| 1601 | 1437 | }, |
| 1602 | - | |
| 1603 | 1438 | unblockContent() { |
| 1604 | 1439 | setTimeout(function () { |
| 1605 | 1440 | LP.showMainScrollbar().removeClass('block-content'); |
| 1606 | 1441 | $(document).trigger('learn_press_unblock_content'); |
| @@ -1605,51 +1440,44 @@ | ||
| 1605 | 1440 | LP.showMainScrollbar().removeClass('block-content'); |
| 1606 | 1441 | $(document).trigger('learn_press_unblock_content'); |
| 1607 | 1442 | }, 350); |
| 1608 | 1443 | }, |
| 1609 | - | |
| 1610 | 1444 | hideMainScrollbar(el) { |
| 1611 | 1445 | if (!el) { |
| 1612 | 1446 | el = 'html, body'; |
| 1613 | 1447 | } |
| 1614 | - | |
| 1615 | 1448 | const $el = $(el); |
| 1616 | 1449 | $el.each(function () { |
| 1617 | 1450 | const $root = $(this), |
| 1618 | - overflow = $root.css('overflow'); | |
| 1451 | + overflow = $root.css('overflow'); | |
| 1619 | 1452 | $root.css('overflow', 'hidden').attr('overflow', overflow); |
| 1620 | 1453 | }); |
| 1621 | 1454 | return $el; |
| 1622 | 1455 | }, |
| 1623 | - | |
| 1624 | 1456 | showMainScrollbar(el) { |
| 1625 | 1457 | if (!el) { |
| 1626 | 1458 | el = 'html, body'; |
| 1627 | 1459 | } |
| 1628 | - | |
| 1629 | 1460 | const $el = $(el); |
| 1630 | 1461 | $el.each(function () { |
| 1631 | 1462 | const $root = $(this), |
| 1632 | - overflow = $root.attr('overflow'); | |
| 1463 | + overflow = $root.attr('overflow'); | |
| 1633 | 1464 | $root.css('overflow', overflow).removeAttr('overflow'); |
| 1634 | 1465 | }); |
| 1635 | 1466 | return $el; |
| 1636 | 1467 | }, |
| 1637 | - | |
| 1638 | 1468 | template: typeof _ !== 'undefined' ? _.memoize(function (id, data) { |
| 1639 | 1469 | let compiled, |
| 1640 | - options = { | |
| 1641 | - evaluate: /<#([\s\S]+?)#>/g, | |
| 1642 | - interpolate: /\{\{\{([\s\S]+?)\}\}\}/g, | |
| 1643 | - escape: /\{\{([^\}]+?)\}\}(?!\})/g, | |
| 1644 | - variable: 'data' | |
| 1645 | - }; | |
| 1646 | - | |
| 1470 | + options = { | |
| 1471 | + evaluate: /<#([\s\S]+?)#>/g, | |
| 1472 | + interpolate: /\{\{\{([\s\S]+?)\}\}\}/g, | |
| 1473 | + escape: /\{\{([^\}]+?)\}\}(?!\})/g, | |
| 1474 | + variable: 'data' | |
| 1475 | + }; | |
| 1647 | 1476 | const tmpl = function (data) { |
| 1648 | 1477 | compiled = compiled || _.template($('#' + id).html(), null, options); |
| 1649 | 1478 | return compiled(data); |
| 1650 | 1479 | }; |
| 1651 | - | |
| 1652 | 1480 | return data ? tmpl(data) : tmpl; |
| 1653 | 1481 | }, function (a, b) { |
| 1654 | 1482 | return a + '-' + JSON.stringify(b); |
| 1655 | 1483 | }) : function () { |
| @@ -1654,13 +1482,11 @@ | ||
| 1654 | 1482 | return a + '-' + JSON.stringify(b); |
| 1655 | 1483 | }) : function () { |
| 1656 | 1484 | return ''; |
| 1657 | 1485 | }, |
| 1658 | - | |
| 1659 | 1486 | alert(localize, callback) { |
| 1660 | 1487 | let title = '', |
| 1661 | - message = ''; | |
| 1662 | - | |
| 1488 | + message = ''; | |
| 1663 | 1489 | if (typeof localize === 'string') { |
| 1664 | 1490 | message = localize; |
| 1665 | 1491 | } else { |
| 1666 | 1492 | if (typeof localize.title !== 'undefined') { |
| @@ -1665,27 +1491,21 @@ | ||
| 1665 | 1491 | } else { |
| 1666 | 1492 | if (typeof localize.title !== 'undefined') { |
| 1667 | 1493 | title = localize.title; |
| 1668 | 1494 | } |
| 1669 | - | |
| 1670 | 1495 | if (typeof localize.message !== 'undefined') { |
| 1671 | 1496 | message = localize.message; |
| 1672 | 1497 | } |
| 1673 | 1498 | } |
| 1674 | - | |
| 1675 | 1499 | $.alerts.alert(message, title, function (e) { |
| 1676 | 1500 | LP._on_alert_hide(); |
| 1677 | - | |
| 1678 | 1501 | callback && callback(e); |
| 1679 | 1502 | }); |
| 1680 | - | |
| 1681 | 1503 | this._on_alert_show(); |
| 1682 | 1504 | }, |
| 1683 | - | |
| 1684 | 1505 | confirm(localize, callback) { |
| 1685 | 1506 | let title = '', |
| 1686 | - message = ''; | |
| 1687 | - | |
| 1507 | + message = ''; | |
| 1688 | 1508 | if (typeof localize === 'string') { |
| 1689 | 1509 | message = localize; |
| 1690 | 1510 | } else { |
| 1691 | 1511 | if (typeof localize.title !== 'undefined') { |
| @@ -1690,40 +1510,32 @@ | ||
| 1690 | 1510 | } else { |
| 1691 | 1511 | if (typeof localize.title !== 'undefined') { |
| 1692 | 1512 | title = localize.title; |
| 1693 | 1513 | } |
| 1694 | - | |
| 1695 | 1514 | if (typeof localize.message !== 'undefined') { |
| 1696 | 1515 | message = localize.message; |
| 1697 | 1516 | } |
| 1698 | 1517 | } |
| 1699 | - | |
| 1700 | 1518 | $.alerts.confirm(message, title, function (e) { |
| 1701 | 1519 | LP._on_alert_hide(); |
| 1702 | - | |
| 1703 | 1520 | callback && callback(e); |
| 1704 | 1521 | }); |
| 1705 | - | |
| 1706 | 1522 | this._on_alert_show(); |
| 1707 | 1523 | }, |
| 1708 | - | |
| 1709 | 1524 | _on_alert_show() { |
| 1710 | 1525 | const $container = $('#popup_container'), |
| 1711 | - $placeholder = $('<span id="popup_container_placeholder" />').insertAfter($container).data('xxx', $container); | |
| 1526 | + $placeholder = $('<span id="popup_container_placeholder" />').insertAfter($container).data('xxx', $container); | |
| 1712 | 1527 | $container.stop().css('top', '-=50').css('opacity', '0').animate({ |
| 1713 | 1528 | top: '+=50', |
| 1714 | 1529 | opacity: 1 |
| 1715 | 1530 | }, 250); |
| 1716 | 1531 | }, |
| 1717 | - | |
| 1718 | 1532 | _on_alert_hide() { |
| 1719 | 1533 | const $holder = $('#popup_container_placeholder'), |
| 1720 | - $container = $holder.data('xxx'); | |
| 1721 | - | |
| 1534 | + $container = $holder.data('xxx'); | |
| 1722 | 1535 | if ($container) { |
| 1723 | 1536 | $container.replaceWith($holder); |
| 1724 | 1537 | } |
| 1725 | - | |
| 1726 | 1538 | $container.appendTo($(document.body)); |
| 1727 | 1539 | $container.stop().animate({ |
| 1728 | 1540 | top: '+=50', |
| 1729 | 1541 | opacity: 0 |
| @@ -1730,50 +1542,39 @@ | ||
| 1730 | 1542 | }, 250, function () { |
| 1731 | 1543 | $(this).remove(); |
| 1732 | 1544 | }); |
| 1733 | 1545 | }, |
| 1734 | - | |
| 1735 | 1546 | sendMessage(data, object, targetOrigin, transfer) { |
| 1736 | 1547 | if ($.isPlainObject(data)) { |
| 1737 | 1548 | data = JSON.stringify(data); |
| 1738 | 1549 | } |
| 1739 | - | |
| 1740 | 1550 | object = object || window; |
| 1741 | 1551 | targetOrigin = targetOrigin || '*'; |
| 1742 | 1552 | object.postMessage(data, targetOrigin, transfer); |
| 1743 | 1553 | }, |
| 1744 | - | |
| 1745 | 1554 | receiveMessage(event, b) { |
| 1746 | 1555 | let target = event.origin || event.originalEvent.origin, |
| 1747 | - data = event.data || event.originalEvent.data || ''; | |
| 1748 | - | |
| 1556 | + data = event.data || event.originalEvent.data || ''; | |
| 1749 | 1557 | if (typeof data === 'string' || data instanceof String) { |
| 1750 | 1558 | if (data.indexOf('{') === 0) { |
| 1751 | 1559 | data = LP.parseJSON(data); |
| 1752 | 1560 | } |
| 1753 | 1561 | } |
| 1754 | - | |
| 1755 | 1562 | LP.Hook.doAction('learn_press_receive_message', data, target); |
| 1756 | 1563 | }, |
| 1757 | - | |
| 1758 | - camelCaseDashObjectKeys(obj) { | |
| 1759 | - let deep = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; | |
| 1564 | + camelCaseDashObjectKeys(obj, deep = true) { | |
| 1760 | 1565 | const self = LP; |
| 1761 | - | |
| 1762 | 1566 | const isArray = function (a) { |
| 1763 | 1567 | return Array.isArray(a); |
| 1764 | 1568 | }; |
| 1765 | - | |
| 1766 | 1569 | const isObject = function (o) { |
| 1767 | 1570 | return o === Object(o) && !isArray(o) && typeof o !== 'function'; |
| 1768 | 1571 | }; |
| 1769 | - | |
| 1770 | 1572 | const toCamel = s => { |
| 1771 | 1573 | return s.replace(/([-_][a-z])/ig, $1 => { |
| 1772 | 1574 | return $1.toUpperCase().replace('-', '').replace('_', ''); |
| 1773 | 1575 | }); |
| 1774 | 1576 | }; |
| 1775 | - | |
| 1776 | 1577 | if (isObject(obj)) { |
| 1777 | 1578 | const n = {}; |
| 1778 | 1579 | Object.keys(obj).forEach(k => { |
| 1779 | 1580 | n[toCamel(k)] = deep ? self.camelCaseDashObjectKeys(obj[k]) : obj[k]; |
| @@ -1783,12 +1584,10 @@ | ||
| 1783 | 1584 | return obj.map(i => { |
| 1784 | 1585 | return self.camelCaseDashObjectKeys(i); |
| 1785 | 1586 | }); |
| 1786 | 1587 | } |
| 1787 | - | |
| 1788 | 1588 | return obj; |
| 1789 | 1589 | }, |
| 1790 | - | |
| 1791 | 1590 | IframeSubmit: _iframe_submit__WEBPACK_IMPORTED_MODULE_9__["default"] |
| 1792 | 1591 | }; |
| 1793 | 1592 | $(document).ready(function () { |
| 1794 | 1593 | if (typeof $.alerts !== 'undefined') { |
| @@ -1796,13 +1595,11 @@ | ||
| 1796 | 1595 | $.alerts.overlayOpacity = 0.5; |
| 1797 | 1596 | $.alerts.okButton = lpGlobalSettings.localize.button_ok; |
| 1798 | 1597 | $.alerts.cancelButton = lpGlobalSettings.localize.button_cancel; |
| 1799 | 1598 | } |
| 1800 | - | |
| 1801 | 1599 | $('.learn-press-message.fixed').each(function () { |
| 1802 | 1600 | const $el = $(this), |
| 1803 | - options = $el.data(); | |
| 1804 | - | |
| 1601 | + options = $el.data(); | |
| 1805 | 1602 | (function ($el, options) { |
| 1806 | 1603 | if (options.delayIn) { |
| 1807 | 1604 | setTimeout(function () { |
| 1808 | 1605 | $el.show().hide().fadeIn(); |
| @@ -1807,9 +1604,8 @@ | ||
| 1807 | 1604 | setTimeout(function () { |
| 1808 | 1605 | $el.show().hide().fadeIn(); |
| 1809 | 1606 | }, options.delayIn); |
| 1810 | 1607 | } |
| 1811 | - | |
| 1812 | 1608 | if (options.delayOut) { |
| 1813 | 1609 | setTimeout(function () { |
| 1814 | 1610 | $el.fadeOut(); |
| 1815 | 1611 | }, options.delayOut + (options.delayIn || 0)); |
| @@ -1818,24 +1614,23 @@ | ||
| 1818 | 1614 | }); |
| 1819 | 1615 | setTimeout(function () { |
| 1820 | 1616 | $('.learn-press-nav-tabs li.active:not(.default) a').trigger('click'); |
| 1821 | 1617 | }, 300); |
| 1822 | - $('body.course-item-popup').parent().css('overflow', 'hidden'); | |
| 1823 | 1618 | |
| 1619 | + //$( 'body.course-item-popup' ).parent().css( 'overflow', 'hidden' ); | |
| 1620 | + | |
| 1824 | 1621 | (function () { |
| 1825 | 1622 | 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 | - | |
| 1623 | + callback = function () { | |
| 1624 | + $('.auto-check-lines').checkLines(function (r) { | |
| 1625 | + if (r > 1) { | |
| 1626 | + $(this).removeClass('single-lines'); | |
| 1627 | + } else { | |
| 1628 | + $(this).addClass('single-lines'); | |
| 1629 | + } | |
| 1630 | + $(this).attr('rows', r); | |
| 1631 | + }); | |
| 1632 | + }; | |
| 1838 | 1633 | $(window).on('resize.check-lines', function () { |
| 1839 | 1634 | if (timer) { |
| 1840 | 1635 | timer && clearTimeout(timer); |
| 1841 | 1636 | timer = setTimeout(callback, 300); |
| @@ -1843,9 +1638,8 @@ | ||
| 1843 | 1638 | callback(); |
| 1844 | 1639 | } |
| 1845 | 1640 | }); |
| 1846 | 1641 | })(); |
| 1847 | - | |
| 1848 | 1642 | $('.learn-press-tooltip, .lp-passing-conditional').LP_Tooltip({ |
| 1849 | 1643 | offset: [24, 24] |
| 1850 | 1644 | }); |
| 1851 | 1645 | $('.learn-press-icon').LP_Tooltip({ |
| @@ -1852,10 +1646,9 @@ | ||
| 1852 | 1646 | offset: [30, 30] |
| 1853 | 1647 | }); |
| 1854 | 1648 | $('.learn-press-message[data-autoclose]').each(function () { |
| 1855 | 1649 | const $el = $(this), |
| 1856 | - delay = parseInt($el.data('autoclose')); | |
| 1857 | - | |
| 1650 | + delay = parseInt($el.data('autoclose')); | |
| 1858 | 1651 | if (delay) { |
| 1859 | 1652 | setTimeout(function ($el) { |
| 1860 | 1653 | $el.fadeOut(); |
| 1861 | 1654 | }, delay, $el); |
| @@ -1871,9 +1664,9 @@ | ||
| 1871 | 1664 | Cookies: _cookies__WEBPACK_IMPORTED_MODULE_6__["default"], |
| 1872 | 1665 | localStorage: _local_storage__WEBPACK_IMPORTED_MODULE_7__["default"], |
| 1873 | 1666 | ..._default |
| 1874 | 1667 | }); |
| 1875 | -/* harmony default export */ __webpack_exports__["default"] = ({ | |
| 1668 | +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ | |
| 1876 | 1669 | fn: _fn__WEBPACK_IMPORTED_MODULE_1__["default"], |
| 1877 | 1670 | QuickTip: (_quick_tip__WEBPACK_IMPORTED_MODULE_2___default()), |
| 1878 | 1671 | Cookies: _cookies__WEBPACK_IMPORTED_MODULE_6__["default"], |
| 1879 | 1672 | localStorage: _local_storage__WEBPACK_IMPORTED_MODULE_7__["default"], |
| @@ -1878,8 +1671,9 @@ | ||
| 1878 | 1671 | Cookies: _cookies__WEBPACK_IMPORTED_MODULE_6__["default"], |
| 1879 | 1672 | localStorage: _local_storage__WEBPACK_IMPORTED_MODULE_7__["default"], |
| 1880 | 1673 | showPass: (_show_password__WEBPACK_IMPORTED_MODULE_10___default()) |
| 1881 | 1674 | }); |
| 1882 | -}(); | |
| 1675 | +})(); | |
| 1676 | + | |
| 1883 | 1677 | /******/ })() |
| 1884 | 1678 | ; |
| 1885 | 1679 | //# sourceMappingURL=utils.js.map |