backup
2 years ago
notices
2 years ago
analytics-consent-modal.js
2 years ago
analytics-consent-modal.js.map
2 years ago
analytics-consent-modal.min.js
2 years ago
analytics-consent-modal.min.js.map
2 years ago
wpstg-admin-beta.js
3 years ago
wpstg-admin-beta.js.map
3 years ago
wpstg-admin-beta.min.js
5 years ago
wpstg-admin-beta.min.js.map
3 years ago
wpstg-admin-corrupt-settings.js
3 years ago
wpstg-admin-corrupt-settings.js.map
3 years ago
wpstg-admin-corrupt-settings.min.js
3 years ago
wpstg-admin-corrupt-settings.min.js.map
3 years ago
wpstg-admin-plugins.js
2 years ago
wpstg-admin-plugins.js.map
2 years ago
wpstg-admin-plugins.min.js
2 years ago
wpstg-admin-plugins.min.js.map
2 years ago
wpstg-admin-rating.js
3 years ago
wpstg-admin-rating.js.map
3 years ago
wpstg-admin-rating.min.js
3 years ago
wpstg-admin-rating.min.js.map
3 years ago
wpstg-admin.js
2 years ago
wpstg-admin.js.map
2 years ago
wpstg-admin.min.js
2 years ago
wpstg-admin.min.js.map
2 years ago
wpstg-blank-loader.js
3 years ago
wpstg-blank-loader.js.map
3 years ago
wpstg-blank-loader.min.js
3 years ago
wpstg-blank-loader.min.js.map
3 years ago
wpstg-sweetalert2.js
3 years ago
wpstg-sweetalert2.js.map
3 years ago
wpstg-sweetalert2.min.js
3 years ago
wpstg-sweetalert2.min.js.map
3 years ago
wpstg.js
2 years ago
wpstg.js.map
2 years ago
wpstg.min.js
2 years ago
wpstg.min.js.map
2 years ago
wpstg.js
947 lines
| 1 | /** |
| 2 | * version: 3.6.0 |
| 3 | */ |
| 4 | (function () { |
| 5 | 'use strict'; |
| 6 | |
| 7 | function _regeneratorRuntime() { |
| 8 | _regeneratorRuntime = function () { |
| 9 | return exports; |
| 10 | }; |
| 11 | var exports = {}, |
| 12 | Op = Object.prototype, |
| 13 | hasOwn = Op.hasOwnProperty, |
| 14 | defineProperty = Object.defineProperty || function (obj, key, desc) { |
| 15 | obj[key] = desc.value; |
| 16 | }, |
| 17 | $Symbol = "function" == typeof Symbol ? Symbol : {}, |
| 18 | iteratorSymbol = $Symbol.iterator || "@@iterator", |
| 19 | asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", |
| 20 | toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; |
| 21 | function define(obj, key, value) { |
| 22 | return Object.defineProperty(obj, key, { |
| 23 | value: value, |
| 24 | enumerable: !0, |
| 25 | configurable: !0, |
| 26 | writable: !0 |
| 27 | }), obj[key]; |
| 28 | } |
| 29 | try { |
| 30 | define({}, ""); |
| 31 | } catch (err) { |
| 32 | define = function (obj, key, value) { |
| 33 | return obj[key] = value; |
| 34 | }; |
| 35 | } |
| 36 | function wrap(innerFn, outerFn, self, tryLocsList) { |
| 37 | var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, |
| 38 | generator = Object.create(protoGenerator.prototype), |
| 39 | context = new Context(tryLocsList || []); |
| 40 | return defineProperty(generator, "_invoke", { |
| 41 | value: makeInvokeMethod(innerFn, self, context) |
| 42 | }), generator; |
| 43 | } |
| 44 | function tryCatch(fn, obj, arg) { |
| 45 | try { |
| 46 | return { |
| 47 | type: "normal", |
| 48 | arg: fn.call(obj, arg) |
| 49 | }; |
| 50 | } catch (err) { |
| 51 | return { |
| 52 | type: "throw", |
| 53 | arg: err |
| 54 | }; |
| 55 | } |
| 56 | } |
| 57 | exports.wrap = wrap; |
| 58 | var ContinueSentinel = {}; |
| 59 | function Generator() {} |
| 60 | function GeneratorFunction() {} |
| 61 | function GeneratorFunctionPrototype() {} |
| 62 | var IteratorPrototype = {}; |
| 63 | define(IteratorPrototype, iteratorSymbol, function () { |
| 64 | return this; |
| 65 | }); |
| 66 | var getProto = Object.getPrototypeOf, |
| 67 | NativeIteratorPrototype = getProto && getProto(getProto(values([]))); |
| 68 | NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); |
| 69 | var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); |
| 70 | function defineIteratorMethods(prototype) { |
| 71 | ["next", "throw", "return"].forEach(function (method) { |
| 72 | define(prototype, method, function (arg) { |
| 73 | return this._invoke(method, arg); |
| 74 | }); |
| 75 | }); |
| 76 | } |
| 77 | function AsyncIterator(generator, PromiseImpl) { |
| 78 | function invoke(method, arg, resolve, reject) { |
| 79 | var record = tryCatch(generator[method], generator, arg); |
| 80 | if ("throw" !== record.type) { |
| 81 | var result = record.arg, |
| 82 | value = result.value; |
| 83 | return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { |
| 84 | invoke("next", value, resolve, reject); |
| 85 | }, function (err) { |
| 86 | invoke("throw", err, resolve, reject); |
| 87 | }) : PromiseImpl.resolve(value).then(function (unwrapped) { |
| 88 | result.value = unwrapped, resolve(result); |
| 89 | }, function (error) { |
| 90 | return invoke("throw", error, resolve, reject); |
| 91 | }); |
| 92 | } |
| 93 | reject(record.arg); |
| 94 | } |
| 95 | var previousPromise; |
| 96 | defineProperty(this, "_invoke", { |
| 97 | value: function (method, arg) { |
| 98 | function callInvokeWithMethodAndArg() { |
| 99 | return new PromiseImpl(function (resolve, reject) { |
| 100 | invoke(method, arg, resolve, reject); |
| 101 | }); |
| 102 | } |
| 103 | return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); |
| 104 | } |
| 105 | }); |
| 106 | } |
| 107 | function makeInvokeMethod(innerFn, self, context) { |
| 108 | var state = "suspendedStart"; |
| 109 | return function (method, arg) { |
| 110 | if ("executing" === state) throw new Error("Generator is already running"); |
| 111 | if ("completed" === state) { |
| 112 | if ("throw" === method) throw arg; |
| 113 | return doneResult(); |
| 114 | } |
| 115 | for (context.method = method, context.arg = arg;;) { |
| 116 | var delegate = context.delegate; |
| 117 | if (delegate) { |
| 118 | var delegateResult = maybeInvokeDelegate(delegate, context); |
| 119 | if (delegateResult) { |
| 120 | if (delegateResult === ContinueSentinel) continue; |
| 121 | return delegateResult; |
| 122 | } |
| 123 | } |
| 124 | if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { |
| 125 | if ("suspendedStart" === state) throw state = "completed", context.arg; |
| 126 | context.dispatchException(context.arg); |
| 127 | } else "return" === context.method && context.abrupt("return", context.arg); |
| 128 | state = "executing"; |
| 129 | var record = tryCatch(innerFn, self, context); |
| 130 | if ("normal" === record.type) { |
| 131 | if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; |
| 132 | return { |
| 133 | value: record.arg, |
| 134 | done: context.done |
| 135 | }; |
| 136 | } |
| 137 | "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); |
| 138 | } |
| 139 | }; |
| 140 | } |
| 141 | function maybeInvokeDelegate(delegate, context) { |
| 142 | var methodName = context.method, |
| 143 | method = delegate.iterator[methodName]; |
| 144 | if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; |
| 145 | var record = tryCatch(method, delegate.iterator, context.arg); |
| 146 | if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; |
| 147 | var info = record.arg; |
| 148 | return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); |
| 149 | } |
| 150 | function pushTryEntry(locs) { |
| 151 | var entry = { |
| 152 | tryLoc: locs[0] |
| 153 | }; |
| 154 | 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); |
| 155 | } |
| 156 | function resetTryEntry(entry) { |
| 157 | var record = entry.completion || {}; |
| 158 | record.type = "normal", delete record.arg, entry.completion = record; |
| 159 | } |
| 160 | function Context(tryLocsList) { |
| 161 | this.tryEntries = [{ |
| 162 | tryLoc: "root" |
| 163 | }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); |
| 164 | } |
| 165 | function values(iterable) { |
| 166 | if (iterable) { |
| 167 | var iteratorMethod = iterable[iteratorSymbol]; |
| 168 | if (iteratorMethod) return iteratorMethod.call(iterable); |
| 169 | if ("function" == typeof iterable.next) return iterable; |
| 170 | if (!isNaN(iterable.length)) { |
| 171 | var i = -1, |
| 172 | next = function next() { |
| 173 | for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; |
| 174 | return next.value = undefined, next.done = !0, next; |
| 175 | }; |
| 176 | return next.next = next; |
| 177 | } |
| 178 | } |
| 179 | return { |
| 180 | next: doneResult |
| 181 | }; |
| 182 | } |
| 183 | function doneResult() { |
| 184 | return { |
| 185 | value: undefined, |
| 186 | done: !0 |
| 187 | }; |
| 188 | } |
| 189 | return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { |
| 190 | value: GeneratorFunctionPrototype, |
| 191 | configurable: !0 |
| 192 | }), defineProperty(GeneratorFunctionPrototype, "constructor", { |
| 193 | value: GeneratorFunction, |
| 194 | configurable: !0 |
| 195 | }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { |
| 196 | var ctor = "function" == typeof genFun && genFun.constructor; |
| 197 | return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); |
| 198 | }, exports.mark = function (genFun) { |
| 199 | return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; |
| 200 | }, exports.awrap = function (arg) { |
| 201 | return { |
| 202 | __await: arg |
| 203 | }; |
| 204 | }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { |
| 205 | return this; |
| 206 | }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { |
| 207 | void 0 === PromiseImpl && (PromiseImpl = Promise); |
| 208 | var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); |
| 209 | return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { |
| 210 | return result.done ? result.value : iter.next(); |
| 211 | }); |
| 212 | }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { |
| 213 | return this; |
| 214 | }), define(Gp, "toString", function () { |
| 215 | return "[object Generator]"; |
| 216 | }), exports.keys = function (val) { |
| 217 | var object = Object(val), |
| 218 | keys = []; |
| 219 | for (var key in object) keys.push(key); |
| 220 | return keys.reverse(), function next() { |
| 221 | for (; keys.length;) { |
| 222 | var key = keys.pop(); |
| 223 | if (key in object) return next.value = key, next.done = !1, next; |
| 224 | } |
| 225 | return next.done = !0, next; |
| 226 | }; |
| 227 | }, exports.values = values, Context.prototype = { |
| 228 | constructor: Context, |
| 229 | reset: function (skipTempReset) { |
| 230 | if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); |
| 231 | }, |
| 232 | stop: function () { |
| 233 | this.done = !0; |
| 234 | var rootRecord = this.tryEntries[0].completion; |
| 235 | if ("throw" === rootRecord.type) throw rootRecord.arg; |
| 236 | return this.rval; |
| 237 | }, |
| 238 | dispatchException: function (exception) { |
| 239 | if (this.done) throw exception; |
| 240 | var context = this; |
| 241 | function handle(loc, caught) { |
| 242 | return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; |
| 243 | } |
| 244 | for (var i = this.tryEntries.length - 1; i >= 0; --i) { |
| 245 | var entry = this.tryEntries[i], |
| 246 | record = entry.completion; |
| 247 | if ("root" === entry.tryLoc) return handle("end"); |
| 248 | if (entry.tryLoc <= this.prev) { |
| 249 | var hasCatch = hasOwn.call(entry, "catchLoc"), |
| 250 | hasFinally = hasOwn.call(entry, "finallyLoc"); |
| 251 | if (hasCatch && hasFinally) { |
| 252 | if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); |
| 253 | if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); |
| 254 | } else if (hasCatch) { |
| 255 | if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); |
| 256 | } else { |
| 257 | if (!hasFinally) throw new Error("try statement without catch or finally"); |
| 258 | if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); |
| 259 | } |
| 260 | } |
| 261 | } |
| 262 | }, |
| 263 | abrupt: function (type, arg) { |
| 264 | for (var i = this.tryEntries.length - 1; i >= 0; --i) { |
| 265 | var entry = this.tryEntries[i]; |
| 266 | if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { |
| 267 | var finallyEntry = entry; |
| 268 | break; |
| 269 | } |
| 270 | } |
| 271 | finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); |
| 272 | var record = finallyEntry ? finallyEntry.completion : {}; |
| 273 | return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); |
| 274 | }, |
| 275 | complete: function (record, afterLoc) { |
| 276 | if ("throw" === record.type) throw record.arg; |
| 277 | return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; |
| 278 | }, |
| 279 | finish: function (finallyLoc) { |
| 280 | for (var i = this.tryEntries.length - 1; i >= 0; --i) { |
| 281 | var entry = this.tryEntries[i]; |
| 282 | if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; |
| 283 | } |
| 284 | }, |
| 285 | catch: function (tryLoc) { |
| 286 | for (var i = this.tryEntries.length - 1; i >= 0; --i) { |
| 287 | var entry = this.tryEntries[i]; |
| 288 | if (entry.tryLoc === tryLoc) { |
| 289 | var record = entry.completion; |
| 290 | if ("throw" === record.type) { |
| 291 | var thrown = record.arg; |
| 292 | resetTryEntry(entry); |
| 293 | } |
| 294 | return thrown; |
| 295 | } |
| 296 | } |
| 297 | throw new Error("illegal catch attempt"); |
| 298 | }, |
| 299 | delegateYield: function (iterable, resultName, nextLoc) { |
| 300 | return this.delegate = { |
| 301 | iterator: values(iterable), |
| 302 | resultName: resultName, |
| 303 | nextLoc: nextLoc |
| 304 | }, "next" === this.method && (this.arg = undefined), ContinueSentinel; |
| 305 | } |
| 306 | }, exports; |
| 307 | } |
| 308 | function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { |
| 309 | try { |
| 310 | var info = gen[key](arg); |
| 311 | var value = info.value; |
| 312 | } catch (error) { |
| 313 | reject(error); |
| 314 | return; |
| 315 | } |
| 316 | if (info.done) { |
| 317 | resolve(value); |
| 318 | } else { |
| 319 | Promise.resolve(value).then(_next, _throw); |
| 320 | } |
| 321 | } |
| 322 | function _asyncToGenerator(fn) { |
| 323 | return function () { |
| 324 | var self = this, |
| 325 | args = arguments; |
| 326 | return new Promise(function (resolve, reject) { |
| 327 | var gen = fn.apply(self, args); |
| 328 | function _next(value) { |
| 329 | asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); |
| 330 | } |
| 331 | function _throw(err) { |
| 332 | asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); |
| 333 | } |
| 334 | _next(undefined); |
| 335 | }); |
| 336 | }; |
| 337 | } |
| 338 | |
| 339 | /** |
| 340 | * This is a namespaced port of https://github.com/tristen/hoverintent, |
| 341 | * with slight modification to accept selector with dynamically added element in dom, |
| 342 | * instead of just already present element. |
| 343 | * |
| 344 | * @param {HTMLElement} parent |
| 345 | * @param {string} selector |
| 346 | * @param {CallableFunction} onOver |
| 347 | * @param {CallableFunction} onOut |
| 348 | * |
| 349 | * @return {object} |
| 350 | */ |
| 351 | function wpstgHoverIntent (parent, selector, onOver, onOut) { |
| 352 | var x; |
| 353 | var y; |
| 354 | var pX; |
| 355 | var pY; |
| 356 | var mouseOver = false; |
| 357 | var focused = false; |
| 358 | var h = {}; |
| 359 | var state = 0; |
| 360 | var timer = 0; |
| 361 | var options = { |
| 362 | sensitivity: 7, |
| 363 | interval: 100, |
| 364 | timeout: 0, |
| 365 | handleFocus: false |
| 366 | }; |
| 367 | function delay(el, e) { |
| 368 | if (timer) { |
| 369 | timer = clearTimeout(timer); |
| 370 | } |
| 371 | state = 0; |
| 372 | return focused ? undefined : onOut(el, e); |
| 373 | } |
| 374 | function tracker(e) { |
| 375 | x = e.clientX; |
| 376 | y = e.clientY; |
| 377 | } |
| 378 | function compare(el, e) { |
| 379 | if (timer) timer = clearTimeout(timer); |
| 380 | if (Math.abs(pX - x) + Math.abs(pY - y) < options.sensitivity) { |
| 381 | state = 1; |
| 382 | return focused ? undefined : onOver(el, e); |
| 383 | } else { |
| 384 | pX = x; |
| 385 | pY = y; |
| 386 | timer = setTimeout(function () { |
| 387 | compare(el, e); |
| 388 | }, options.interval); |
| 389 | } |
| 390 | } |
| 391 | |
| 392 | // Public methods |
| 393 | h.options = function (opt) { |
| 394 | var focusOptionChanged = opt.handleFocus !== options.handleFocus; |
| 395 | options = Object.assign({}, options, opt); |
| 396 | if (focusOptionChanged) { |
| 397 | options.handleFocus ? addFocus() : removeFocus(); |
| 398 | } |
| 399 | return h; |
| 400 | }; |
| 401 | function dispatchOver(el, e) { |
| 402 | mouseOver = true; |
| 403 | if (timer) { |
| 404 | timer = clearTimeout(timer); |
| 405 | } |
| 406 | el.removeEventListener('mousemove', tracker, false); |
| 407 | if (state !== 1) { |
| 408 | pX = e.clientX; |
| 409 | pY = e.clientY; |
| 410 | el.addEventListener('mousemove', tracker, false); |
| 411 | timer = setTimeout(function () { |
| 412 | compare(el, e); |
| 413 | }, options.interval); |
| 414 | } |
| 415 | return this; |
| 416 | } |
| 417 | |
| 418 | /** |
| 419 | * Newly added method, |
| 420 | * A wrapper around dispatchOver to support dynamically added elements to dom |
| 421 | */ |
| 422 | function onMouseOver(event) { |
| 423 | if (event.target.matches(selector + ', ' + selector + ' *')) { |
| 424 | dispatchOver(event.target.closest(selector), event); |
| 425 | } |
| 426 | } |
| 427 | function dispatchOut(el, e) { |
| 428 | mouseOver = false; |
| 429 | if (timer) { |
| 430 | timer = clearTimeout(timer); |
| 431 | } |
| 432 | el.removeEventListener('mousemove', tracker, false); |
| 433 | if (state === 1) { |
| 434 | timer = setTimeout(function () { |
| 435 | delay(el, e); |
| 436 | }, options.timeout); |
| 437 | } |
| 438 | return this; |
| 439 | } |
| 440 | |
| 441 | /** |
| 442 | * Newly added method, |
| 443 | * A wrapper around dispatchOut to support dynamically added elements to dom |
| 444 | */ |
| 445 | function onMouseOut(event) { |
| 446 | if (event.target.matches(selector + ', ' + selector + ' *')) { |
| 447 | dispatchOut(event.target.closest(selector), event); |
| 448 | } |
| 449 | } |
| 450 | function dispatchFocus(el, e) { |
| 451 | if (!mouseOver) { |
| 452 | focused = true; |
| 453 | onOver(el, e); |
| 454 | } |
| 455 | } |
| 456 | |
| 457 | /** |
| 458 | * Newly added method, |
| 459 | * A wrapper around dispatchFocus to support dynamically added elements to dom |
| 460 | */ |
| 461 | function onFocus(event) { |
| 462 | if (event.target.matches(selector + ', ' + selector + ' *')) { |
| 463 | dispatchFocus(event.target.closest(selector), event); |
| 464 | } |
| 465 | } |
| 466 | function dispatchBlur(el, e) { |
| 467 | if (!mouseOver && focused) { |
| 468 | focused = false; |
| 469 | onOut(el, e); |
| 470 | } |
| 471 | } |
| 472 | |
| 473 | /** |
| 474 | * Newly added method, |
| 475 | * A wrapper around dispatchBlur to support dynamically added elements to dom |
| 476 | */ |
| 477 | function onBlur(event) { |
| 478 | if (event.target.matches(selector + ', ' + selector + ' *')) { |
| 479 | dispatchBlur(event.target.closest(selector), event); |
| 480 | } |
| 481 | } |
| 482 | |
| 483 | /** |
| 484 | * Modified to support dynamically added element |
| 485 | */ |
| 486 | function addFocus() { |
| 487 | parent.addEventListener('focus', onFocus, false); |
| 488 | parent.addEventListener('blur', onBlur, false); |
| 489 | } |
| 490 | |
| 491 | /** |
| 492 | * Modified to support dynamically added element |
| 493 | */ |
| 494 | function removeFocus() { |
| 495 | parent.removeEventListener('focus', onFocus, false); |
| 496 | parent.removeEventListener('blur', onBlur, false); |
| 497 | } |
| 498 | |
| 499 | /** |
| 500 | * Modified to support dynamically added element |
| 501 | */ |
| 502 | h.remove = function () { |
| 503 | if (!parent) { |
| 504 | return; |
| 505 | } |
| 506 | parent.removeEventListener('mouseover', onMouseOver, false); |
| 507 | parent.removeEventListener('mouseout', onMouseOut, false); |
| 508 | removeFocus(); |
| 509 | }; |
| 510 | |
| 511 | /** |
| 512 | * Modified to support dynamically added element |
| 513 | */ |
| 514 | if (parent) { |
| 515 | parent.addEventListener('mouseover', onMouseOver, false); |
| 516 | parent.addEventListener('mouseout', onMouseOut, false); |
| 517 | } |
| 518 | return h; |
| 519 | } |
| 520 | |
| 521 | /** |
| 522 | * Detect memory exhaustion and show warning. |
| 523 | */ |
| 524 | var WpstgDetectMemoryExhaust = /*#__PURE__*/function () { |
| 525 | function WpstgDetectMemoryExhaust(wpstgObject) { |
| 526 | if (wpstgObject === void 0) { |
| 527 | wpstgObject = wpstg; |
| 528 | } |
| 529 | this.wpstgObject = wpstgObject; |
| 530 | } |
| 531 | var _proto = WpstgDetectMemoryExhaust.prototype; |
| 532 | _proto.sendRequest = /*#__PURE__*/function () { |
| 533 | var _sendRequest = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(requestType) { |
| 534 | var response, data; |
| 535 | return _regeneratorRuntime().wrap(function _callee$(_context) { |
| 536 | while (1) switch (_context.prev = _context.next) { |
| 537 | case 0: |
| 538 | _context.prev = 0; |
| 539 | _context.next = 3; |
| 540 | return fetch(this.wpstgObject.ajaxUrl, { |
| 541 | method: 'POST', |
| 542 | credentials: 'same-origin', |
| 543 | body: new URLSearchParams({ |
| 544 | action: 'wpstg--detect-memory-exhaust', |
| 545 | requestType: requestType, |
| 546 | accessToken: this.wpstgObject.accessToken, |
| 547 | nonce: this.wpstgObject.nonce |
| 548 | }), |
| 549 | headers: { |
| 550 | 'Content-Type': 'application/x-www-form-urlencoded' |
| 551 | } |
| 552 | }); |
| 553 | case 3: |
| 554 | response = _context.sent; |
| 555 | _context.next = 6; |
| 556 | return response.json(); |
| 557 | case 6: |
| 558 | data = _context.sent; |
| 559 | if (!('undefined' !== typeof data.status && data.status && data.error)) { |
| 560 | _context.next = 9; |
| 561 | break; |
| 562 | } |
| 563 | return _context.abrupt("return", data); |
| 564 | case 9: |
| 565 | console.warn(data.message); |
| 566 | _context.next = 15; |
| 567 | break; |
| 568 | case 12: |
| 569 | _context.prev = 12; |
| 570 | _context.t0 = _context["catch"](0); |
| 571 | console.warn(this.wpstgObject.i18n['somethingWentWrong'], _context.t0); |
| 572 | case 15: |
| 573 | return _context.abrupt("return", false); |
| 574 | case 16: |
| 575 | case "end": |
| 576 | return _context.stop(); |
| 577 | } |
| 578 | }, _callee, this, [[0, 12]]); |
| 579 | })); |
| 580 | function sendRequest(_x) { |
| 581 | return _sendRequest.apply(this, arguments); |
| 582 | } |
| 583 | return sendRequest; |
| 584 | }(); |
| 585 | return WpstgDetectMemoryExhaust; |
| 586 | }(); |
| 587 | |
| 588 | var wpstg$1 = (function ($) { |
| 589 | var WPStagingCommon = { |
| 590 | continueErrorHandle: true, |
| 591 | retry: { |
| 592 | currentDelay: 0, |
| 593 | count: 0, |
| 594 | max: wpstg.maxFailedRetries, |
| 595 | retryOnErrors: [401, 403, 404, 429, 502, 503, 504], |
| 596 | performingRequest: false, |
| 597 | incrementRetry: function incrementRetry(incrementRatio) { |
| 598 | if (incrementRatio === void 0) { |
| 599 | incrementRatio = 1.25; |
| 600 | } |
| 601 | WPStagingCommon.retry.performingRequest = true; |
| 602 | if (WPStagingCommon.retry.currentDelay === 0) { |
| 603 | // start with a delay of 1sec |
| 604 | WPStagingCommon.retry.currentDelay = 1000; |
| 605 | WPStagingCommon.retry.count = 1; |
| 606 | } |
| 607 | WPStagingCommon.retry.currentDelay += 500 * WPStagingCommon.retry.count * incrementRatio; |
| 608 | WPStagingCommon.retry.count++; |
| 609 | }, |
| 610 | canRetry: function canRetry() { |
| 611 | return WPStagingCommon.retry.count < WPStagingCommon.retry.max; |
| 612 | }, |
| 613 | reset: function reset() { |
| 614 | WPStagingCommon.retry.currentDelay = 0; |
| 615 | WPStagingCommon.retry.count = 0; |
| 616 | WPStagingCommon.retry.performingRequest = false; |
| 617 | } |
| 618 | }, |
| 619 | memoryExhaustArticleLink: 'https://wp-staging.com/docs/php-fatal-error-allowed-memory-size-of-134217728-bytes-exhausted/', |
| 620 | cache: { |
| 621 | elements: [], |
| 622 | get: function get(selector) { |
| 623 | // It is already cached! |
| 624 | if ($.inArray(selector, this.elements) !== -1) { |
| 625 | return this.elements[selector]; |
| 626 | } |
| 627 | |
| 628 | // Create cache and return |
| 629 | this.elements[selector] = $(selector); |
| 630 | return this.elements[selector]; |
| 631 | }, |
| 632 | refresh: function refresh(selector) { |
| 633 | selector.elements[selector] = $(selector); |
| 634 | } |
| 635 | }, |
| 636 | setJobId: function setJobId(jobId) { |
| 637 | localStorage.setItem('jobIdBeingProcessed', jobId); |
| 638 | }, |
| 639 | getJobId: function getJobId() { |
| 640 | return localStorage.getItem('jobIdBeingProcessed'); |
| 641 | }, |
| 642 | checkMemoryExhaustion: function checkMemoryExhaustion(requestType) { |
| 643 | return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() { |
| 644 | var detectMemoryExhaust, response; |
| 645 | return _regeneratorRuntime().wrap(function _callee$(_context) { |
| 646 | while (1) switch (_context.prev = _context.next) { |
| 647 | case 0: |
| 648 | detectMemoryExhaust = new WpstgDetectMemoryExhaust(); |
| 649 | _context.next = 3; |
| 650 | return detectMemoryExhaust.sendRequest(requestType); |
| 651 | case 3: |
| 652 | response = _context.sent; |
| 653 | if (response) { |
| 654 | _context.next = 6; |
| 655 | break; |
| 656 | } |
| 657 | return _context.abrupt("return", false); |
| 658 | case 6: |
| 659 | return _context.abrupt("return", response); |
| 660 | case 10: |
| 661 | case "end": |
| 662 | return _context.stop(); |
| 663 | } |
| 664 | }, _callee); |
| 665 | }))(); |
| 666 | }, |
| 667 | listenTooltip: function listenTooltip() { |
| 668 | wpstgHoverIntent(document, '.wpstg--tooltip', function (target, event) { |
| 669 | target.querySelector('.wpstg--tooltiptext').style.visibility = 'visible'; |
| 670 | }, function (target, event) { |
| 671 | if (!event.target.closest('.wpstg--tooltiptext a')) { |
| 672 | target.querySelector('.wpstg--tooltiptext').style.visibility = 'hidden'; |
| 673 | } |
| 674 | }); |
| 675 | }, |
| 676 | // Get the custom themed Swal Modal for WP Staging |
| 677 | // Easy to maintain now in one place now |
| 678 | getSwalModal: function getSwalModal(isContentCentered, customClasses) { |
| 679 | if (isContentCentered === void 0) { |
| 680 | isContentCentered = false; |
| 681 | } |
| 682 | if (customClasses === void 0) { |
| 683 | customClasses = {}; |
| 684 | } |
| 685 | // common style for all swal modal used in WP Staging |
| 686 | var defaultCustomClasses = { |
| 687 | confirmButton: 'wpstg--btn--confirm wpstg-blue-primary wpstg-button wpstg-link-btn wpstg-100-width', |
| 688 | cancelButton: 'wpstg--btn--cancel wpstg-blue-primary wpstg-link-btn wpstg-100-width', |
| 689 | actions: 'wpstg--modal--actions', |
| 690 | popup: isContentCentered ? 'wpstg-swal-popup wpstg-centered-modal' : 'wpstg-swal-popup' |
| 691 | }; |
| 692 | |
| 693 | // If an attribute exists in both default and additional attributes, |
| 694 | // The class(es) of the additional attribute will overwrite the default one. |
| 695 | var options = { |
| 696 | customClass: Object.assign(defaultCustomClasses, customClasses), |
| 697 | buttonsStyling: false, |
| 698 | reverseButtons: true, |
| 699 | showClass: { |
| 700 | popup: 'wpstg--swal2-show wpstg-swal-show' |
| 701 | } |
| 702 | }; |
| 703 | return wpstgSwal.mixin(options); |
| 704 | }, |
| 705 | showSuccessModal: function showSuccessModal(htmlContent) { |
| 706 | this.getSwalModal().fire({ |
| 707 | showConfirmButton: false, |
| 708 | showCancelButton: true, |
| 709 | cancelButtonText: 'OK', |
| 710 | icon: 'success', |
| 711 | title: 'Success!', |
| 712 | html: '<div class="wpstg--grey" style="text-align: left; margin-top: 8px;">' + htmlContent + '</div>' |
| 713 | }); |
| 714 | }, |
| 715 | showWarningModal: function showWarningModal(htmlContent) { |
| 716 | this.getSwalModal().fire({ |
| 717 | showConfirmButton: false, |
| 718 | showCancelButton: true, |
| 719 | cancelButtonText: 'OK', |
| 720 | icon: 'warning', |
| 721 | title: '', |
| 722 | html: '<div class="wpstg--grey" style="text-align: left; margin-top: 8px;">' + htmlContent + '</div>' |
| 723 | }); |
| 724 | }, |
| 725 | showErrorModal: function showErrorModal(htmlContent) { |
| 726 | this.getSwalModal().fire({ |
| 727 | showConfirmButton: false, |
| 728 | showCancelButton: true, |
| 729 | cancelButtonText: 'OK', |
| 730 | icon: 'error', |
| 731 | title: 'Error!', |
| 732 | html: '<div class="wpstg--grey" style="text-align: left; margin-top: 8px;">' + htmlContent + '</div>' |
| 733 | }); |
| 734 | }, |
| 735 | getSwalContainer: function getSwalContainer() { |
| 736 | return wpstgSwal.getContainer(); |
| 737 | }, |
| 738 | closeSwalModal: function closeSwalModal() { |
| 739 | wpstgSwal.close(); |
| 740 | }, |
| 741 | /** |
| 742 | * Treats a default response object generated by WordPress's |
| 743 | * wp_send_json_success() or wp_send_json_error() functions in |
| 744 | * PHP, parses it in JavaScript, and either throws if it's an error, |
| 745 | * or returns the data if the response is successful. |
| 746 | * |
| 747 | * @param {object} response |
| 748 | * @return {*} |
| 749 | */ |
| 750 | getDataFromWordPressResponse: function getDataFromWordPressResponse(response) { |
| 751 | if (typeof response !== 'object') { |
| 752 | throw new Error('Unexpected response (ERR 1341)'); |
| 753 | } |
| 754 | if (!response.hasOwnProperty('success')) { |
| 755 | throw new Error('Unexpected response (ERR 1342)'); |
| 756 | } |
| 757 | if (!response.hasOwnProperty('data')) { |
| 758 | throw new Error('Unexpected response (ERR 1343)'); |
| 759 | } |
| 760 | if (response.success === false) { |
| 761 | if (response.data instanceof Array && response.data.length > 0) { |
| 762 | throw new Error(response.data.shift()); |
| 763 | } else { |
| 764 | throw new Error('Response was not successful'); |
| 765 | } |
| 766 | } else { |
| 767 | // Successful response. Return the data. |
| 768 | return response.data; |
| 769 | } |
| 770 | }, |
| 771 | isLoading: function isLoading(_isLoading) { |
| 772 | if (!_isLoading || _isLoading === false) { |
| 773 | WPStagingCommon.cache.get('.wpstg-loader').hide(); |
| 774 | } else { |
| 775 | WPStagingCommon.cache.get('.wpstg-loader').show(); |
| 776 | } |
| 777 | }, |
| 778 | /** |
| 779 | * Convert the given url to make it slug compatible |
| 780 | * @param {string} url |
| 781 | * @return {string} |
| 782 | */ |
| 783 | slugify: function slugify(url) { |
| 784 | return url.toString().toLowerCase().normalize('NFD').replace(/[\u0300-\u036f]/g, '').replace(/\s+/g, '-').replace(/&/g, '-and-').replace(/[^a-z0-9\-]/g, '').replace(/-+/g, '-').replace(/^-*/, '').replace(/-*$/, ''); |
| 785 | }, |
| 786 | sanitizeEventAttribute: function sanitizeEventAttribute(string) { |
| 787 | if (string === null) { |
| 788 | return string; |
| 789 | } |
| 790 | return string.toString().replace(/("|')\s+on([a-z]+)\s?=\s?([a-z0-9\)\(\"\';]+)/i, ''); |
| 791 | }, |
| 792 | htmlEntityQuotesDecode: function htmlEntityQuotesDecode(string) { |
| 793 | if (string === null) { |
| 794 | return string; |
| 795 | } |
| 796 | return string.toString().replace(/\\"/g, '"').replace(/\\'/g, '''); |
| 797 | }, |
| 798 | showAjaxFatalError: function showAjaxFatalError(response, prependMessage, appendMessage) { |
| 799 | prependMessage = prependMessage ? prependMessage + '<br/><br/>' : 'Something went wrong! <br/><br/>'; |
| 800 | appendMessage = appendMessage ? appendMessage + '<br/><br/>' : '<br/><br/>Please try the <a href=\'https://wp-staging.com/docs/wp-staging-settings-for-small-servers/\' target=\'_blank\'>WP Staging Small Server Settings</a> or submit an error report and contact us.'; |
| 801 | if (response === false) { |
| 802 | WPStagingCommon.showError(prependMessage + ' Error: No response.' + appendMessage); |
| 803 | window.removeEventListener('beforeunload', WPStaging.warnIfClosingDuringProcess); |
| 804 | return; |
| 805 | } |
| 806 | if (typeof response.error !== 'undefined' && response.error) { |
| 807 | WPStagingCommon.showError(prependMessage + ' Error: ' + response.message + appendMessage); |
| 808 | window.removeEventListener('beforeunload', WPStaging.warnIfClosingDuringProcess); |
| 809 | return; |
| 810 | } |
| 811 | }, |
| 812 | handleFetchErrors: function handleFetchErrors(response) { |
| 813 | if (!response.ok) { |
| 814 | WPStagingCommon.showError('Error: ' + response.status + ' - ' + response.statusText + '. Please try again or contact support.'); |
| 815 | } |
| 816 | return response; |
| 817 | }, |
| 818 | showError: function showError(message) { |
| 819 | // If retry request no need to show Error; |
| 820 | if (WPStagingCommon.retry.performingRequest) { |
| 821 | return; |
| 822 | } |
| 823 | WPStagingCommon.cache.get('#wpstg-try-again').css('display', 'inline-block'); |
| 824 | WPStagingCommon.cache.get('#wpstg-cancel-cloning').text('Reset'); |
| 825 | WPStagingCommon.cache.get('#wpstg-resume-cloning').show(); |
| 826 | WPStagingCommon.cache.get('#wpstg-error-wrapper').show(); |
| 827 | WPStagingCommon.cache.get('#wpstg-error-details').show().html(message); |
| 828 | WPStagingCommon.cache.get('#wpstg-removing-clone').removeClass('loading'); |
| 829 | WPStagingCommon.cache.get('.wpstg-loader').hide(); |
| 830 | $('.wpstg--modal--process--generic-problem').show().html(message); |
| 831 | }, |
| 832 | resetErrors: function resetErrors() { |
| 833 | WPStagingCommon.cache.get('#wpstg-error-details').hide().html(''); |
| 834 | }, |
| 835 | /** |
| 836 | * Ajax Requests |
| 837 | * @param {Object} data |
| 838 | * @param {Function} callback |
| 839 | * @param {string} dataType |
| 840 | * @param {bool} showErrors |
| 841 | * @param {int} tryCount |
| 842 | * @param {float} incrementRatio |
| 843 | * @param {function} errorCallback |
| 844 | */ |
| 845 | ajax: function ajax(data, callback, dataType, showErrors, tryCount, incrementRatio, errorCallback) { |
| 846 | if (incrementRatio === void 0) { |
| 847 | incrementRatio = null; |
| 848 | } |
| 849 | if (errorCallback === void 0) { |
| 850 | errorCallback = null; |
| 851 | } |
| 852 | if ('undefined' === typeof dataType) { |
| 853 | dataType = 'json'; |
| 854 | } |
| 855 | if (false !== showErrors) { |
| 856 | showErrors = true; |
| 857 | } |
| 858 | tryCount = 'undefined' === typeof tryCount ? 0 : tryCount; |
| 859 | var retryLimit = wpstg.maxFailedRetries; |
| 860 | var retryTimeout = 10000 * tryCount; |
| 861 | incrementRatio = parseInt(incrementRatio); |
| 862 | if (!isNaN(incrementRatio)) { |
| 863 | retryTimeout *= incrementRatio; |
| 864 | } |
| 865 | $.ajax({ |
| 866 | url: ajaxurl + '?action=wpstg_processing&_=' + Date.now() / 1000, |
| 867 | type: 'POST', |
| 868 | dataType: dataType, |
| 869 | cache: false, |
| 870 | data: data, |
| 871 | error: function error(xhr, textStatus, errorThrown) { |
| 872 | console.log(xhr.status + ' ' + xhr.statusText + '---' + textStatus); |
| 873 | if (typeof errorCallback === 'function') { |
| 874 | // Custom error handler |
| 875 | errorCallback(xhr, textStatus, errorThrown); |
| 876 | if (!WPStagingCommon.continueErrorHandle) { |
| 877 | // Reset state |
| 878 | WPStagingCommon.continueErrorHandle = true; |
| 879 | return; |
| 880 | } |
| 881 | } |
| 882 | |
| 883 | // Default error handler |
| 884 | tryCount++; |
| 885 | if (tryCount <= retryLimit) { |
| 886 | setTimeout(function () { |
| 887 | WPStagingCommon.ajax(data, callback, dataType, showErrors, tryCount, incrementRatio); |
| 888 | return; |
| 889 | }, retryTimeout); |
| 890 | } else { |
| 891 | var errorCode = 'undefined' === typeof xhr.status ? 'Unknown' : xhr.status; |
| 892 | WPStagingCommon.showError('Fatal Error: ' + errorCode + ' Please try the <a href=\'https://wp-staging.com/docs/wp-staging-settings-for-small-servers/\' target=\'_blank\'>WP Staging Small Server Settings</a> or submit an error report and contact us.'); |
| 893 | } |
| 894 | }, |
| 895 | success: function success(data) { |
| 896 | if ('function' === typeof callback) { |
| 897 | callback(data); |
| 898 | } |
| 899 | }, |
| 900 | statusCode: { |
| 901 | 404: function _() { |
| 902 | if (tryCount >= retryLimit) { |
| 903 | WPStagingCommon.showError('Error 404 - Can\'t find ajax request URL! Please try the <a href=\'https://wp-staging.com/docs/wp-staging-settings-for-small-servers/\' target=\'_blank\'>WP Staging Small Server Settings</a> or submit an error report and contact us.'); |
| 904 | } |
| 905 | }, |
| 906 | 500: function _() { |
| 907 | if (tryCount >= retryLimit) { |
| 908 | WPStagingCommon.showError('Fatal Error 500 - Internal server error while processing the request! Please try the <a href=\'https://wp-staging.com/docs/wp-staging-settings-for-small-servers/\' target=\'_blank\'>WP Staging Small Server Settings</a> or submit an error report and contact us.'); |
| 909 | } |
| 910 | }, |
| 911 | 504: function _() { |
| 912 | if (tryCount > retryLimit) { |
| 913 | WPStagingCommon.showError('Error 504 - It looks like your server is rate limiting ajax requests. Please try to resume after a minute. If this still not works try the <a href=\'https://wp-staging.com/docs/wp-staging-settings-for-small-servers/\' target=\'_blank\'>WP Staging Small Server Settings</a> or submit an error report and contact us.\n\ '); |
| 914 | } |
| 915 | }, |
| 916 | 502: function _() { |
| 917 | if (tryCount >= retryLimit) { |
| 918 | WPStagingCommon.showError('Error 502 - It looks like your server is rate limiting ajax requests. Please try to resume after a minute. If this still not works try the <a href=\'https://wp-staging.com/docs/wp-staging-settings-for-small-servers/\' target=\'_blank\'>WP Staging Small Server Settings</a> or submit an error report and contact us.\n\ '); |
| 919 | } |
| 920 | }, |
| 921 | 503: function _() { |
| 922 | if (tryCount >= retryLimit) { |
| 923 | WPStagingCommon.showError('Error 503 - It looks like your server is rate limiting ajax requests. Please try to resume after a minute. If this still not works try the <a href=\'https://wp-staging.com/docs/wp-staging-settings-for-small-servers/\' target=\'_blank\'>WP Staging Small Server Settings</a> or submit an error report and contact us.\n\ '); |
| 924 | } |
| 925 | }, |
| 926 | 429: function _() { |
| 927 | if (tryCount >= retryLimit) { |
| 928 | WPStagingCommon.showError('Error 429 - It looks like your server is rate limiting ajax requests. Please try to resume after a minute. If this still not works try the <a href=\'https://wp-staging.com/docs/wp-staging-settings-for-small-servers/\' target=\'_blank\'>WP Staging Small Server Settings</a> or submit an error report and contact us.\n\ '); |
| 929 | } |
| 930 | }, |
| 931 | 403: function _() { |
| 932 | if (tryCount >= retryLimit) { |
| 933 | WPStagingCommon.showError('Refresh page or login again! The process should be finished successfully. \n\ '); |
| 934 | } |
| 935 | } |
| 936 | } |
| 937 | }); |
| 938 | } |
| 939 | }; |
| 940 | return WPStagingCommon; |
| 941 | })(jQuery); |
| 942 | |
| 943 | return wpstg$1; |
| 944 | |
| 945 | })(); |
| 946 | //# sourceMappingURL=wpstg.js.map |
| 947 |