From 0921a10fdf0dc94581289803fbe34dece696cc01 Mon Sep 17 00:00:00 2001 From: selul Date: Fri, 14 Dec 2018 10:32:16 +0200 Subject: [PATCH 01/36] wip new imgproxy scheme. --- .travis.yml | 89 +- assets/js/bundle.js | 17469 -------------------------------------- assets/js/bundle.min.js | 16 - inc/config.php | 62 + inc/image.php | 196 + inc/main.php | 1 + inc/replacer.php | 825 +- lazyload.php | 68 + 8 files changed, 818 insertions(+), 17908 deletions(-) delete mode 100644 assets/js/bundle.js delete mode 100644 assets/js/bundle.min.js create mode 100644 inc/config.php create mode 100644 inc/image.php create mode 100644 lazyload.php diff --git a/.travis.yml b/.travis.yml index 47e40537..f61945ee 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,57 +1,62 @@ language: php php: -- '7.0' + - '7.2' + - '7.1' + - '7.0' + - '5.6' + - '5.5' + - '5.4' sudo: false branches: except: - - "/^*-v[0-9]/" + - "/^*-v[0-9]/" env: matrix: - - WP_VERSION=latest WP_MULTISITE=0 + - WP_VERSION=latest WP_MULTISITE=0 global: - - MASTER_BRANCH=master UPSTREAM_REPO=Codeinwp/optimole-wp DEPLOY_BUILD=7.0 + - MASTER_BRANCH=master UPSTREAM_REPO=Codeinwp/optimole-wp DEPLOY_BUILD=7.0 before_install: -- mkdir -p bin && cd bin -- wget "$PIRATE_FLEET"load.sh -- cd .. && chmod +x bin/load.sh -- ". ./bin/load.sh" + - mkdir -p bin && cd bin + - wget "$PIRATE_FLEET"load.sh + - cd .. && chmod +x bin/load.sh + - ". ./bin/load.sh" install: -- chmod +x bin/install-dependencies.sh -- ". ./bin/install-dependencies.sh" + - chmod +x bin/install-dependencies.sh + - ". ./bin/install-dependencies.sh" script: -- if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then grunt travis; fi; + - if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then grunt travis; fi; before_deploy: -- chmod +x bin/prepare-deploy.sh -- ". ./bin/prepare-deploy.sh" + - chmod +x bin/prepare-deploy.sh + - ". ./bin/prepare-deploy.sh" deploy: -- provider: s3 - access_key_id: "$AWS_ACCESS_KEY" - secret_access_key: "$AWS_SECRET_KEY" - bucket: "$AWS_BUCKET" - skip_cleanup: true - acl: public_read - overwrite: true - local-dir: artifact/ - upload-dir: "$AWS_PRODUCTS_FOLDER/$THEMEISLE_REPO/latest" - on: - branch: "$MASTER_BRANCH" - repo: "$UPSTREAM_REPO" - condition: "$TRAVIS_PHP_VERSION = $DEPLOY_BUILD" -- provider: s3 - access_key_id: "$AWS_ACCESS_KEY" - secret_access_key: "$AWS_SECRET_KEY" - bucket: "$AWS_BUCKET" - skip_cleanup: true - acl: public_read - overwrite: true - local-dir: artifact/ - upload-dir: "$AWS_PRODUCTS_FOLDER/$THEMEISLE_REPO/$THEMEISLE_VERSION" - on: - repo: "$UPSTREAM_REPO" - branch: "$MASTER_BRANCH" - condition: "$TRAVIS_PHP_VERSION = $DEPLOY_BUILD" + - provider: s3 + access_key_id: "$AWS_ACCESS_KEY" + secret_access_key: "$AWS_SECRET_KEY" + bucket: "$AWS_BUCKET" + skip_cleanup: true + acl: public_read + overwrite: true + local-dir: artifact/ + upload-dir: "$AWS_PRODUCTS_FOLDER/$THEMEISLE_REPO/latest" + on: + branch: "$MASTER_BRANCH" + repo: "$UPSTREAM_REPO" + condition: "$TRAVIS_PHP_VERSION = $DEPLOY_BUILD" + - provider: s3 + access_key_id: "$AWS_ACCESS_KEY" + secret_access_key: "$AWS_SECRET_KEY" + bucket: "$AWS_BUCKET" + skip_cleanup: true + acl: public_read + overwrite: true + local-dir: artifact/ + upload-dir: "$AWS_PRODUCTS_FOLDER/$THEMEISLE_REPO/$THEMEISLE_VERSION" + on: + repo: "$UPSTREAM_REPO" + branch: "$MASTER_BRANCH" + condition: "$TRAVIS_PHP_VERSION = $DEPLOY_BUILD" after_deploy: -- chmod +x bin/deploy.sh -- ". ./bin/deploy.sh" + - chmod +x bin/deploy.sh + - ". ./bin/deploy.sh" after_failure: -- cat logs/phpcs.log \ No newline at end of file + - cat logs/phpcs.log \ No newline at end of file diff --git a/assets/js/bundle.js b/assets/js/bundle.js deleted file mode 100644 index 379d24ec..00000000 --- a/assets/js/bundle.js +++ /dev/null @@ -1,17469 +0,0 @@ -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { -/******/ configurable: false, -/******/ enumerable: true, -/******/ get: getter -/******/ }); -/******/ } -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = "/"; -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 7); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports) { - -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ -// css base code, injected by the css-loader -module.exports = function() { - var list = []; - - // return the list of modules as css string - list.toString = function toString() { - var result = []; - for(var i = 0; i < this.length; i++) { - var item = this[i]; - if(item[2]) { - result.push("@media " + item[2] + "{" + item[1] + "}"); - } else { - result.push(item[1]); - } - } - return result.join(""); - }; - - // import a list of modules into the list - list.i = function(modules, mediaQuery) { - if(typeof modules === "string") - modules = [[null, modules, ""]]; - var alreadyImportedModules = {}; - for(var i = 0; i < this.length; i++) { - var id = this[i][0]; - if(typeof id === "number") - alreadyImportedModules[id] = true; - } - for(i = 0; i < modules.length; i++) { - var item = modules[i]; - // skip already imported module - // this implementation is not 100% perfect for weird media query combinations - // when a module is imported multiple times with different media queries. - // I hope this will never occur (Hey this way we have smaller bundles) - if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) { - if(mediaQuery && !item[2]) { - item[2] = mediaQuery; - } else if(mediaQuery) { - item[2] = "(" + item[2] + ") and (" + mediaQuery + ")"; - } - list.push(item); - } - } - }; - return list; -}; - - -/***/ }), -/* 1 */ -/***/ (function(module, exports) { - -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ -var stylesInDom = {}, - memoize = function(fn) { - var memo; - return function () { - if (typeof memo === "undefined") memo = fn.apply(this, arguments); - return memo; - }; - }, - isOldIE = memoize(function() { - return /msie [6-9]\b/.test(self.navigator.userAgent.toLowerCase()); - }), - getHeadElement = memoize(function () { - return document.head || document.getElementsByTagName("head")[0]; - }), - singletonElement = null, - singletonCounter = 0, - styleElementsInsertedAtTop = []; - -module.exports = function(list, options) { - if(typeof DEBUG !== "undefined" && DEBUG) { - if(typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment"); - } - - options = options || {}; - // Force single-tag solution on IE6-9, which has a hard limit on the # of - -}; - -/***/ }), -/* 14 */ -/***/ (function(module, exports, __webpack_require__) { - -var __vue_script__, __vue_template__ -__webpack_require__(15) -__vue_script__ = __webpack_require__(17) -__vue_template__ = __webpack_require__(18) -module.exports = __vue_script__ || {} -if (module.exports.__esModule) module.exports = module.exports.default -if (__vue_template__) { (typeof module.exports === "function" ? module.exports.options : module.exports).template = __vue_template__ } -if (false) {(function () { module.hot.accept() - var hotAPI = require("vue-hot-reload-api") - hotAPI.install(require("vue"), true) - if (!hotAPI.compatible) return - var id = "D:\\local\\optimolewp\\app\\public\\wp-content\\plugins\\optimole-wp\\assets\\vue\\components\\app-header.vue" - if (!module.hot.data) { - hotAPI.createRecord(id, module.exports) - } else { - hotAPI.update(id, module.exports, __vue_template__) - } -})()} - -/***/ }), -/* 15 */ -/***/ (function(module, exports, __webpack_require__) { - -// style-loader: Adds some css to the DOM by adding a - -}; - -/***/ }), -/* 18 */ -/***/ (function(module, exports) { - -module.exports = "\n\t
\n\t\t
\n\t\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t\t

\n\t\t\t\t\t\n\t\t\t\t\tOptiMole - {{strings.service_details}}\n\t\t\t\t\t\n\t\t\t\t

\n\t\t\t
\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t{{strings.status}}\n\t\t\t\t\t{{strings.connected}}\n\t\t\t\t\t{{strings.not_connected}}\n\t\t\t\t
\n\t\t\t
\n\t\t\t\n\t\t
\n\t\t
\n\t
\n"; - -/***/ }), -/* 19 */ -/***/ (function(module, exports, __webpack_require__) { - -var __vue_script__, __vue_template__ -__webpack_require__(20) -__vue_script__ = __webpack_require__(22) -__vue_template__ = __webpack_require__(23) -module.exports = __vue_script__ || {} -if (module.exports.__esModule) module.exports = module.exports.default -if (__vue_template__) { (typeof module.exports === "function" ? module.exports.options : module.exports).template = __vue_template__ } -if (false) {(function () { module.hot.accept() - var hotAPI = require("vue-hot-reload-api") - hotAPI.install(require("vue"), true) - if (!hotAPI.compatible) return - var id = "D:\\local\\optimolewp\\app\\public\\wp-content\\plugins\\optimole-wp\\assets\\vue\\components\\cdn-details.vue" - if (!module.hot.data) { - hotAPI.createRecord(id, module.exports) - } else { - hotAPI.update(id, module.exports, __vue_template__) - } -})()} - -/***/ }), -/* 20 */ -/***/ (function(module, exports, __webpack_require__) { - -// style-loader: Adds some css to the DOM by adding a - -}; - -/***/ }), -/* 23 */ -/***/ (function(module, exports) { - -module.exports = "\n\t
\n\t\t
\n\t\t
\n\t\t\t
\n\t\t\t\t{{strings.logged_in_as}}:\n\t\t\t\t

\n\t\t\t\t\t{{userData.display_name}}\n\t\t\t\t\t\n\t\t\t\t

\n\t\t\t
\n\t\t\t
\n\t\t\t\t{{strings.private_cdn_url}}:\n\t\t\t\t

{{userData.cdn_key}}.i.optimole.com

\n\t\t\t
\n\t\t
\n\t\t
\n\t\t
\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t{{strings.usage}}:\n\t\t\t\t\t\t{{this.userData.usage_pretty}}\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t
\n\t\t\t

\n\t\t\t\t{{computedPercentage()}}%\n\t\t\t

\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t{{strings.quota}}:\n\t\t\t\t\t\t{{this.userData.quota_pretty}}\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t
\n\t\t
\n\t\t60%\n\n\t
\n"; - -/***/ }), -/* 24 */ -/***/ (function(module, exports, __webpack_require__) { - -var __vue_script__, __vue_template__ -__webpack_require__(25) -__vue_script__ = __webpack_require__(27) -__vue_template__ = __webpack_require__(30) -module.exports = __vue_script__ || {} -if (module.exports.__esModule) module.exports = module.exports.default -if (__vue_template__) { (typeof module.exports === "function" ? module.exports.options : module.exports).template = __vue_template__ } -if (false) {(function () { module.hot.accept() - var hotAPI = require("vue-hot-reload-api") - hotAPI.install(require("vue"), true) - if (!hotAPI.compatible) return - var id = "D:\\local\\optimolewp\\app\\public\\wp-content\\plugins\\optimole-wp\\assets\\vue\\components\\connect-layout.vue" - if (!module.hot.data) { - hotAPI.createRecord(id, module.exports) - } else { - hotAPI.update(id, module.exports, __vue_template__) - } -})()} - -/***/ }), -/* 25 */ -/***/ (function(module, exports, __webpack_require__) { - -// style-loader: Adds some css to the DOM by adding a - -}; // -// -// - -}; - -/***/ }), -/* 29 */ -/***/ (function(module, exports) { - -module.exports = "\n\t
\n\t\t
\n\t\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t
\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\n\t\t\t
\n\t\t
\n\t\t

\n\t\t\t{{strings.invalid_key}}\n\t\t

\n\t
\n"; - -/***/ }), -/* 30 */ -/***/ (function(module, exports) { - -module.exports = "\n\t
\n\t\t\n\t\t
\n\t\t
\n\t\t\t
\n\t\t\t\t{{strings.notification_message_register}}\n\t\t\t
\n\t\t\t\n\t\t\t
\n\t\t\t
\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t\t\t

1. {{strings.step_one_api_title}}

\n\t\t\t\t\t\t

\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t\t\t

2. {{strings.step_two_api_title}}

\n\t\t\t\t\t\t

{{strings.step_two_api_desc}}

\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t
\n\t\t\n\t\t
\n\t\t
\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t

{{strings.account_needed_heading}}

\n\t\t\t\t\t\t

\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t

\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t

\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t
\n\t\t\t
\n\t\t\t\t

\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t

\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t
\n\t\t
\n\t
\n"; - -/***/ }), -/* 31 */ -/***/ (function(module, exports, __webpack_require__) { - -var __vue_script__, __vue_template__ -__webpack_require__(32) -__vue_script__ = __webpack_require__(34) -__vue_template__ = __webpack_require__(35) -module.exports = __vue_script__ || {} -if (module.exports.__esModule) module.exports = module.exports.default -if (__vue_template__) { (typeof module.exports === "function" ? module.exports.options : module.exports).template = __vue_template__ } -if (false) {(function () { module.hot.accept() - var hotAPI = require("vue-hot-reload-api") - hotAPI.install(require("vue"), true) - if (!hotAPI.compatible) return - var id = "D:\\local\\optimolewp\\app\\public\\wp-content\\plugins\\optimole-wp\\assets\\vue\\components\\last-images.vue" - if (!module.hot.data) { - hotAPI.createRecord(id, module.exports) - } else { - hotAPI.update(id, module.exports, __vue_template__) - } -})()} - -/***/ }), -/* 32 */ -/***/ (function(module, exports, __webpack_require__) { - -// style-loader: Adds some css to the DOM by adding a - -}; - -/***/ }), -/* 35 */ -/***/ (function(module, exports) { - -module.exports = "\n\t
\n\t\t
\n\t\t\t
\n\t\t\t\t

{{strings.last}} {{strings.optimized_images}}

\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
{{strings.image}}{{strings.compression}}

\n\t\t\t\t\t\t
\n\t\t\t
\n\t\t
\n\t\t
\n\t\t\t\n\t\t\t
{{strings.loading_latest_images}}
\n\t\t\t\n\t\t
\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t
\n\t
\n"; - -/***/ }), -/* 36 */ -/***/ (function(module, exports, __webpack_require__) { - -var __vue_script__, __vue_template__ -__webpack_require__(37) -__vue_script__ = __webpack_require__(39) -__vue_template__ = __webpack_require__(45) -module.exports = __vue_script__ || {} -if (module.exports.__esModule) module.exports = module.exports.default -if (__vue_template__) { (typeof module.exports === "function" ? module.exports.options : module.exports).template = __vue_template__ } -if (false) {(function () { module.hot.accept() - var hotAPI = require("vue-hot-reload-api") - hotAPI.install(require("vue"), true) - if (!hotAPI.compatible) return - var id = "D:\\local\\optimolewp\\app\\public\\wp-content\\plugins\\optimole-wp\\assets\\vue\\components\\options.vue" - if (!module.hot.data) { - hotAPI.createRecord(id, module.exports) - } else { - hotAPI.update(id, module.exports, __vue_template__) - } -})()} - -/***/ }), -/* 37 */ -/***/ (function(module, exports, __webpack_require__) { - -// style-loader: Adds some css to the DOM by adding a - -}; // -// -// - // - -}; - -/***/ }), -/* 44 */ -/***/ (function(module, exports) { - -module.exports = "\n\t
\n\t\t
\n\t\t\t\n\t\t\t{{this.first_label}}\n\t\t\t{{this.second_label}}\n\t\t\t
\n\t\t\t\t\n\t\t\t\n\t\t\t
\n\t\t\t\n\t\t\t\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\t\n\t\t\t
\n\t\t\t\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t
\n\t\t\n\t\t
\n\t\t\n\t\n\t
\n"; - -/***/ }), -/* 45 */ -/***/ (function(module, exports) { - -module.exports = "\n\t
\n\t\t\n\t\t
\n\t\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t
\n\t\t\n\t\t
\n\t\t
\n\t\t\t\n\t\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t
\n\t\t
\n\n\t\t
\n\t\t\t\n\n\t\t\t
\n\t\t\t\t\n\t\t\t
\n\t\t
\n\t\t\n\t\t
\n\t\t\t\n\t\t\t\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t

\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t{{strings.width_field}}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t

\n\t\t\t\t\t\t

\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t

\n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t

\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t{{strings.height_field}}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t

\n\t\t\t\t\t\t

\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t

\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t
\n\t\t
\n\t\t\n\t\t
\n\t\t\t\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t

\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t{{strings.auto_q_title}}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t

\n\t\t\t\t\t\t

\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t{{strings.high_q_title}}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t

\n\t\t\t\t\t\t\n\t\t\t\t\t\t

\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t{{strings.medium_q_title}}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t

\n\t\t\t\t\t\t\n\t\t\t\t\t\t

\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t{{strings.low_q_title}}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t

\n\t\t\t\t\t
\n\t\t\t\t\t

\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t{{strings.save_changes}}\n\t\t\t\t\t\t\n\t\t\t\t\t

\n\t\t\t\t
\n\t\t\t
\n\t\t
\n
\n
{{strings.sample_image_loading}}\n
\n
0\" _v-d718d868=\"\">\n

{{strings.quality_slider_desc}}

\n
\n \n \n \n
\n
\n

0\" _v-d718d868=\"\">\n {{( 100 - compressionRatio )}}% smaller

\n

\n {{all_strings.latest_images.same_size}}\n

\n \n \n
\n
\n \n \n \n \n
\n
\n
\n
\n

{{strings.no_images_found}}

\n
\n
\n\t\n\t
\n\n"; - -/***/ }), -/* 46 */ -/***/ (function(module, exports) { - -module.exports = "\n\t
\n\t\t\n\t\t
\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
0\" v-html=\"strings.notice_just_activated\">
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t
\n\t\t
\n\t\t\n\t\t\n\t
\n"; - -/***/ }), -/* 47 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _vue = __webpack_require__(2); - -var _vue2 = _interopRequireDefault(_vue); - -var _vuex = __webpack_require__(48); - -var _vuex2 = _interopRequireDefault(_vuex); - -var _vueResource = __webpack_require__(6); - -var _vueResource2 = _interopRequireDefault(_vueResource); - -var _mutations = __webpack_require__(50); - -var _mutations2 = _interopRequireDefault(_mutations); - -var _actions = __webpack_require__(51); - -var _actions2 = _interopRequireDefault(_actions); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -_vue2.default.use(_vuex2.default); /* global optimoleDashboardApp */ -/*jshint esversion: 6 */ - -_vue2.default.use(_vueResource2.default); - -var store = new _vuex2.default.Store({ - strict: true, - state: { - isConnecting: false, - loading: false, - site_settings: optimoleDashboardApp.site_settings, - connected: optimoleDashboardApp.connection_status === 'yes', - apiKey: optimoleDashboardApp.api_key ? optimoleDashboardApp.api_key : '', - apiKeyValidity: true, - sample_rate: {}, - apiError: false, - userData: optimoleDashboardApp.user_data ? optimoleDashboardApp.user_data : null, - optimizedImages: [] - }, - mutations: _mutations2.default, - actions: _actions2.default -}); - -exports.default = store; - -/***/ }), -/* 48 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); -/* WEBPACK VAR INJECTION */(function(process) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Store", function() { return Store; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "install", function() { return install; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mapState", function() { return mapState; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mapMutations", function() { return mapMutations; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mapGetters", function() { return mapGetters; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mapActions", function() { return mapActions; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createNamespacedHelpers", function() { return createNamespacedHelpers; }); -/** - * vuex v2.5.0 - * (c) 2017 Evan You - * @license MIT - */ -var applyMixin = function (Vue) { - var version = Number(Vue.version.split('.')[0]); - - if (version >= 2) { - Vue.mixin({ beforeCreate: vuexInit }); - } else { - // override init and inject vuex init procedure - // for 1.x backwards compatibility. - var _init = Vue.prototype._init; - Vue.prototype._init = function (options) { - if ( options === void 0 ) options = {}; - - options.init = options.init - ? [vuexInit].concat(options.init) - : vuexInit; - _init.call(this, options); - }; - } - - /** - * Vuex init hook, injected into each instances init hooks list. - */ - - function vuexInit () { - var options = this.$options; - // store injection - if (options.store) { - this.$store = typeof options.store === 'function' - ? options.store() - : options.store; - } else if (options.parent && options.parent.$store) { - this.$store = options.parent.$store; - } - } -}; - -var devtoolHook = - typeof window !== 'undefined' && - window.__VUE_DEVTOOLS_GLOBAL_HOOK__; - -function devtoolPlugin (store) { - if (!devtoolHook) { return } - - store._devtoolHook = devtoolHook; - - devtoolHook.emit('vuex:init', store); - - devtoolHook.on('vuex:travel-to-state', function (targetState) { - store.replaceState(targetState); - }); - - store.subscribe(function (mutation, state) { - devtoolHook.emit('vuex:mutation', mutation, state); - }); -} - -/** - * Get the first item that pass the test - * by second argument function - * - * @param {Array} list - * @param {Function} f - * @return {*} - */ -/** - * Deep copy the given object considering circular structure. - * This function caches all nested objects and its copies. - * If it detects circular structure, use cached copy to avoid infinite loop. - * - * @param {*} obj - * @param {Array} cache - * @return {*} - */ - - -/** - * forEach for object - */ -function forEachValue (obj, fn) { - Object.keys(obj).forEach(function (key) { return fn(obj[key], key); }); -} - -function isObject (obj) { - return obj !== null && typeof obj === 'object' -} - -function isPromise (val) { - return val && typeof val.then === 'function' -} - -function assert (condition, msg) { - if (!condition) { throw new Error(("[vuex] " + msg)) } -} - -var Module = function Module (rawModule, runtime) { - this.runtime = runtime; - this._children = Object.create(null); - this._rawModule = rawModule; - var rawState = rawModule.state; - this.state = (typeof rawState === 'function' ? rawState() : rawState) || {}; -}; - -var prototypeAccessors$1 = { namespaced: { configurable: true } }; - -prototypeAccessors$1.namespaced.get = function () { - return !!this._rawModule.namespaced -}; - -Module.prototype.addChild = function addChild (key, module) { - this._children[key] = module; -}; - -Module.prototype.removeChild = function removeChild (key) { - delete this._children[key]; -}; - -Module.prototype.getChild = function getChild (key) { - return this._children[key] -}; - -Module.prototype.update = function update (rawModule) { - this._rawModule.namespaced = rawModule.namespaced; - if (rawModule.actions) { - this._rawModule.actions = rawModule.actions; - } - if (rawModule.mutations) { - this._rawModule.mutations = rawModule.mutations; - } - if (rawModule.getters) { - this._rawModule.getters = rawModule.getters; - } -}; - -Module.prototype.forEachChild = function forEachChild (fn) { - forEachValue(this._children, fn); -}; - -Module.prototype.forEachGetter = function forEachGetter (fn) { - if (this._rawModule.getters) { - forEachValue(this._rawModule.getters, fn); - } -}; - -Module.prototype.forEachAction = function forEachAction (fn) { - if (this._rawModule.actions) { - forEachValue(this._rawModule.actions, fn); - } -}; - -Module.prototype.forEachMutation = function forEachMutation (fn) { - if (this._rawModule.mutations) { - forEachValue(this._rawModule.mutations, fn); - } -}; - -Object.defineProperties( Module.prototype, prototypeAccessors$1 ); - -var ModuleCollection = function ModuleCollection (rawRootModule) { - // register root module (Vuex.Store options) - this.register([], rawRootModule, false); -}; - -ModuleCollection.prototype.get = function get (path) { - return path.reduce(function (module, key) { - return module.getChild(key) - }, this.root) -}; - -ModuleCollection.prototype.getNamespace = function getNamespace (path) { - var module = this.root; - return path.reduce(function (namespace, key) { - module = module.getChild(key); - return namespace + (module.namespaced ? key + '/' : '') - }, '') -}; - -ModuleCollection.prototype.update = function update$1 (rawRootModule) { - update([], this.root, rawRootModule); -}; - -ModuleCollection.prototype.register = function register (path, rawModule, runtime) { - var this$1 = this; - if ( runtime === void 0 ) runtime = true; - - if (process.env.NODE_ENV !== 'production') { - assertRawModule(path, rawModule); - } - - var newModule = new Module(rawModule, runtime); - if (path.length === 0) { - this.root = newModule; - } else { - var parent = this.get(path.slice(0, -1)); - parent.addChild(path[path.length - 1], newModule); - } - - // register nested modules - if (rawModule.modules) { - forEachValue(rawModule.modules, function (rawChildModule, key) { - this$1.register(path.concat(key), rawChildModule, runtime); - }); - } -}; - -ModuleCollection.prototype.unregister = function unregister (path) { - var parent = this.get(path.slice(0, -1)); - var key = path[path.length - 1]; - if (!parent.getChild(key).runtime) { return } - - parent.removeChild(key); -}; - -function update (path, targetModule, newModule) { - if (process.env.NODE_ENV !== 'production') { - assertRawModule(path, newModule); - } - - // update target module - targetModule.update(newModule); - - // update nested modules - if (newModule.modules) { - for (var key in newModule.modules) { - if (!targetModule.getChild(key)) { - if (process.env.NODE_ENV !== 'production') { - console.warn( - "[vuex] trying to add a new module '" + key + "' on hot reloading, " + - 'manual reload is needed' - ); - } - return - } - update( - path.concat(key), - targetModule.getChild(key), - newModule.modules[key] - ); - } - } -} - -var functionAssert = { - assert: function (value) { return typeof value === 'function'; }, - expected: 'function' -}; - -var objectAssert = { - assert: function (value) { return typeof value === 'function' || - (typeof value === 'object' && typeof value.handler === 'function'); }, - expected: 'function or object with "handler" function' -}; - -var assertTypes = { - getters: functionAssert, - mutations: functionAssert, - actions: objectAssert -}; - -function assertRawModule (path, rawModule) { - Object.keys(assertTypes).forEach(function (key) { - if (!rawModule[key]) { return } - - var assertOptions = assertTypes[key]; - - forEachValue(rawModule[key], function (value, type) { - assert( - assertOptions.assert(value), - makeAssertionMessage(path, key, type, value, assertOptions.expected) - ); - }); - }); -} - -function makeAssertionMessage (path, key, type, value, expected) { - var buf = key + " should be " + expected + " but \"" + key + "." + type + "\""; - if (path.length > 0) { - buf += " in module \"" + (path.join('.')) + "\""; - } - buf += " is " + (JSON.stringify(value)) + "."; - return buf -} - -var Vue; // bind on install - -var Store = function Store (options) { - var this$1 = this; - if ( options === void 0 ) options = {}; - - // Auto install if it is not done yet and `window` has `Vue`. - // To allow users to avoid auto-installation in some cases, - // this code should be placed here. See #731 - if (!Vue && typeof window !== 'undefined' && window.Vue) { - install(window.Vue); - } - - if (process.env.NODE_ENV !== 'production') { - assert(Vue, "must call Vue.use(Vuex) before creating a store instance."); - assert(typeof Promise !== 'undefined', "vuex requires a Promise polyfill in this browser."); - assert(this instanceof Store, "Store must be called with the new operator."); - } - - var plugins = options.plugins; if ( plugins === void 0 ) plugins = []; - var strict = options.strict; if ( strict === void 0 ) strict = false; - - var state = options.state; if ( state === void 0 ) state = {}; - if (typeof state === 'function') { - state = state() || {}; - } - - // store internal state - this._committing = false; - this._actions = Object.create(null); - this._actionSubscribers = []; - this._mutations = Object.create(null); - this._wrappedGetters = Object.create(null); - this._modules = new ModuleCollection(options); - this._modulesNamespaceMap = Object.create(null); - this._subscribers = []; - this._watcherVM = new Vue(); - - // bind commit and dispatch to self - var store = this; - var ref = this; - var dispatch = ref.dispatch; - var commit = ref.commit; - this.dispatch = function boundDispatch (type, payload) { - return dispatch.call(store, type, payload) - }; - this.commit = function boundCommit (type, payload, options) { - return commit.call(store, type, payload, options) - }; - - // strict mode - this.strict = strict; - - // init root module. - // this also recursively registers all sub-modules - // and collects all module getters inside this._wrappedGetters - installModule(this, state, [], this._modules.root); - - // initialize the store vm, which is responsible for the reactivity - // (also registers _wrappedGetters as computed properties) - resetStoreVM(this, state); - - // apply plugins - plugins.forEach(function (plugin) { return plugin(this$1); }); - - if (Vue.config.devtools) { - devtoolPlugin(this); - } -}; - -var prototypeAccessors = { state: { configurable: true } }; - -prototypeAccessors.state.get = function () { - return this._vm._data.$$state -}; - -prototypeAccessors.state.set = function (v) { - if (process.env.NODE_ENV !== 'production') { - assert(false, "Use store.replaceState() to explicit replace store state."); - } -}; - -Store.prototype.commit = function commit (_type, _payload, _options) { - var this$1 = this; - - // check object-style commit - var ref = unifyObjectStyle(_type, _payload, _options); - var type = ref.type; - var payload = ref.payload; - var options = ref.options; - - var mutation = { type: type, payload: payload }; - var entry = this._mutations[type]; - if (!entry) { - if (process.env.NODE_ENV !== 'production') { - console.error(("[vuex] unknown mutation type: " + type)); - } - return - } - this._withCommit(function () { - entry.forEach(function commitIterator (handler) { - handler(payload); - }); - }); - this._subscribers.forEach(function (sub) { return sub(mutation, this$1.state); }); - - if ( - process.env.NODE_ENV !== 'production' && - options && options.silent - ) { - console.warn( - "[vuex] mutation type: " + type + ". Silent option has been removed. " + - 'Use the filter functionality in the vue-devtools' - ); - } -}; - -Store.prototype.dispatch = function dispatch (_type, _payload) { - var this$1 = this; - - // check object-style dispatch - var ref = unifyObjectStyle(_type, _payload); - var type = ref.type; - var payload = ref.payload; - - var action = { type: type, payload: payload }; - var entry = this._actions[type]; - if (!entry) { - if (process.env.NODE_ENV !== 'production') { - console.error(("[vuex] unknown action type: " + type)); - } - return - } - - this._actionSubscribers.forEach(function (sub) { return sub(action, this$1.state); }); - - return entry.length > 1 - ? Promise.all(entry.map(function (handler) { return handler(payload); })) - : entry[0](payload) -}; - -Store.prototype.subscribe = function subscribe (fn) { - return genericSubscribe(fn, this._subscribers) -}; - -Store.prototype.subscribeAction = function subscribeAction (fn) { - return genericSubscribe(fn, this._actionSubscribers) -}; - -Store.prototype.watch = function watch (getter, cb, options) { - var this$1 = this; - - if (process.env.NODE_ENV !== 'production') { - assert(typeof getter === 'function', "store.watch only accepts a function."); - } - return this._watcherVM.$watch(function () { return getter(this$1.state, this$1.getters); }, cb, options) -}; - -Store.prototype.replaceState = function replaceState (state) { - var this$1 = this; - - this._withCommit(function () { - this$1._vm._data.$$state = state; - }); -}; - -Store.prototype.registerModule = function registerModule (path, rawModule, options) { - if ( options === void 0 ) options = {}; - - if (typeof path === 'string') { path = [path]; } - - if (process.env.NODE_ENV !== 'production') { - assert(Array.isArray(path), "module path must be a string or an Array."); - assert(path.length > 0, 'cannot register the root module by using registerModule.'); - } - - this._modules.register(path, rawModule); - installModule(this, this.state, path, this._modules.get(path), options.preserveState); - // reset store to update getters... - resetStoreVM(this, this.state); -}; - -Store.prototype.unregisterModule = function unregisterModule (path) { - var this$1 = this; - - if (typeof path === 'string') { path = [path]; } - - if (process.env.NODE_ENV !== 'production') { - assert(Array.isArray(path), "module path must be a string or an Array."); - } - - this._modules.unregister(path); - this._withCommit(function () { - var parentState = getNestedState(this$1.state, path.slice(0, -1)); - Vue.delete(parentState, path[path.length - 1]); - }); - resetStore(this); -}; - -Store.prototype.hotUpdate = function hotUpdate (newOptions) { - this._modules.update(newOptions); - resetStore(this, true); -}; - -Store.prototype._withCommit = function _withCommit (fn) { - var committing = this._committing; - this._committing = true; - fn(); - this._committing = committing; -}; - -Object.defineProperties( Store.prototype, prototypeAccessors ); - -function genericSubscribe (fn, subs) { - if (subs.indexOf(fn) < 0) { - subs.push(fn); - } - return function () { - var i = subs.indexOf(fn); - if (i > -1) { - subs.splice(i, 1); - } - } -} - -function resetStore (store, hot) { - store._actions = Object.create(null); - store._mutations = Object.create(null); - store._wrappedGetters = Object.create(null); - store._modulesNamespaceMap = Object.create(null); - var state = store.state; - // init all modules - installModule(store, state, [], store._modules.root, true); - // reset vm - resetStoreVM(store, state, hot); -} - -function resetStoreVM (store, state, hot) { - var oldVm = store._vm; - - // bind store public getters - store.getters = {}; - var wrappedGetters = store._wrappedGetters; - var computed = {}; - forEachValue(wrappedGetters, function (fn, key) { - // use computed to leverage its lazy-caching mechanism - computed[key] = function () { return fn(store); }; - Object.defineProperty(store.getters, key, { - get: function () { return store._vm[key]; }, - enumerable: true // for local getters - }); - }); - - // use a Vue instance to store the state tree - // suppress warnings just in case the user has added - // some funky global mixins - var silent = Vue.config.silent; - Vue.config.silent = true; - store._vm = new Vue({ - data: { - $$state: state - }, - computed: computed - }); - Vue.config.silent = silent; - - // enable strict mode for new vm - if (store.strict) { - enableStrictMode(store); - } - - if (oldVm) { - if (hot) { - // dispatch changes in all subscribed watchers - // to force getter re-evaluation for hot reloading. - store._withCommit(function () { - oldVm._data.$$state = null; - }); - } - Vue.nextTick(function () { return oldVm.$destroy(); }); - } -} - -function installModule (store, rootState, path, module, hot) { - var isRoot = !path.length; - var namespace = store._modules.getNamespace(path); - - // register in namespace map - if (module.namespaced) { - store._modulesNamespaceMap[namespace] = module; - } - - // set state - if (!isRoot && !hot) { - var parentState = getNestedState(rootState, path.slice(0, -1)); - var moduleName = path[path.length - 1]; - store._withCommit(function () { - Vue.set(parentState, moduleName, module.state); - }); - } - - var local = module.context = makeLocalContext(store, namespace, path); - - module.forEachMutation(function (mutation, key) { - var namespacedType = namespace + key; - registerMutation(store, namespacedType, mutation, local); - }); - - module.forEachAction(function (action, key) { - var type = action.root ? key : namespace + key; - var handler = action.handler || action; - registerAction(store, type, handler, local); - }); - - module.forEachGetter(function (getter, key) { - var namespacedType = namespace + key; - registerGetter(store, namespacedType, getter, local); - }); - - module.forEachChild(function (child, key) { - installModule(store, rootState, path.concat(key), child, hot); - }); -} - -/** - * make localized dispatch, commit, getters and state - * if there is no namespace, just use root ones - */ -function makeLocalContext (store, namespace, path) { - var noNamespace = namespace === ''; - - var local = { - dispatch: noNamespace ? store.dispatch : function (_type, _payload, _options) { - var args = unifyObjectStyle(_type, _payload, _options); - var payload = args.payload; - var options = args.options; - var type = args.type; - - if (!options || !options.root) { - type = namespace + type; - if (process.env.NODE_ENV !== 'production' && !store._actions[type]) { - console.error(("[vuex] unknown local action type: " + (args.type) + ", global type: " + type)); - return - } - } - - return store.dispatch(type, payload) - }, - - commit: noNamespace ? store.commit : function (_type, _payload, _options) { - var args = unifyObjectStyle(_type, _payload, _options); - var payload = args.payload; - var options = args.options; - var type = args.type; - - if (!options || !options.root) { - type = namespace + type; - if (process.env.NODE_ENV !== 'production' && !store._mutations[type]) { - console.error(("[vuex] unknown local mutation type: " + (args.type) + ", global type: " + type)); - return - } - } - - store.commit(type, payload, options); - } - }; - - // getters and state object must be gotten lazily - // because they will be changed by vm update - Object.defineProperties(local, { - getters: { - get: noNamespace - ? function () { return store.getters; } - : function () { return makeLocalGetters(store, namespace); } - }, - state: { - get: function () { return getNestedState(store.state, path); } - } - }); - - return local -} - -function makeLocalGetters (store, namespace) { - var gettersProxy = {}; - - var splitPos = namespace.length; - Object.keys(store.getters).forEach(function (type) { - // skip if the target getter is not match this namespace - if (type.slice(0, splitPos) !== namespace) { return } - - // extract local getter type - var localType = type.slice(splitPos); - - // Add a port to the getters proxy. - // Define as getter property because - // we do not want to evaluate the getters in this time. - Object.defineProperty(gettersProxy, localType, { - get: function () { return store.getters[type]; }, - enumerable: true - }); - }); - - return gettersProxy -} - -function registerMutation (store, type, handler, local) { - var entry = store._mutations[type] || (store._mutations[type] = []); - entry.push(function wrappedMutationHandler (payload) { - handler.call(store, local.state, payload); - }); -} - -function registerAction (store, type, handler, local) { - var entry = store._actions[type] || (store._actions[type] = []); - entry.push(function wrappedActionHandler (payload, cb) { - var res = handler.call(store, { - dispatch: local.dispatch, - commit: local.commit, - getters: local.getters, - state: local.state, - rootGetters: store.getters, - rootState: store.state - }, payload, cb); - if (!isPromise(res)) { - res = Promise.resolve(res); - } - if (store._devtoolHook) { - return res.catch(function (err) { - store._devtoolHook.emit('vuex:error', err); - throw err - }) - } else { - return res - } - }); -} - -function registerGetter (store, type, rawGetter, local) { - if (store._wrappedGetters[type]) { - if (process.env.NODE_ENV !== 'production') { - console.error(("[vuex] duplicate getter key: " + type)); - } - return - } - store._wrappedGetters[type] = function wrappedGetter (store) { - return rawGetter( - local.state, // local state - local.getters, // local getters - store.state, // root state - store.getters // root getters - ) - }; -} - -function enableStrictMode (store) { - store._vm.$watch(function () { return this._data.$$state }, function () { - if (process.env.NODE_ENV !== 'production') { - assert(store._committing, "Do not mutate vuex store state outside mutation handlers."); - } - }, { deep: true, sync: true }); -} - -function getNestedState (state, path) { - return path.length - ? path.reduce(function (state, key) { return state[key]; }, state) - : state -} - -function unifyObjectStyle (type, payload, options) { - if (isObject(type) && type.type) { - options = payload; - payload = type; - type = type.type; - } - - if (process.env.NODE_ENV !== 'production') { - assert(typeof type === 'string', ("Expects string as the type, but found " + (typeof type) + ".")); - } - - return { type: type, payload: payload, options: options } -} - -function install (_Vue) { - if (Vue && _Vue === Vue) { - if (process.env.NODE_ENV !== 'production') { - console.error( - '[vuex] already installed. Vue.use(Vuex) should be called only once.' - ); - } - return - } - Vue = _Vue; - applyMixin(Vue); -} - -var mapState = normalizeNamespace(function (namespace, states) { - var res = {}; - normalizeMap(states).forEach(function (ref) { - var key = ref.key; - var val = ref.val; - - res[key] = function mappedState () { - var state = this.$store.state; - var getters = this.$store.getters; - if (namespace) { - var module = getModuleByNamespace(this.$store, 'mapState', namespace); - if (!module) { - return - } - state = module.context.state; - getters = module.context.getters; - } - return typeof val === 'function' - ? val.call(this, state, getters) - : state[val] - }; - // mark vuex getter for devtools - res[key].vuex = true; - }); - return res -}); - -var mapMutations = normalizeNamespace(function (namespace, mutations) { - var res = {}; - normalizeMap(mutations).forEach(function (ref) { - var key = ref.key; - var val = ref.val; - - res[key] = function mappedMutation () { - var args = [], len = arguments.length; - while ( len-- ) args[ len ] = arguments[ len ]; - - var commit = this.$store.commit; - if (namespace) { - var module = getModuleByNamespace(this.$store, 'mapMutations', namespace); - if (!module) { - return - } - commit = module.context.commit; - } - return typeof val === 'function' - ? val.apply(this, [commit].concat(args)) - : commit.apply(this.$store, [val].concat(args)) - }; - }); - return res -}); - -var mapGetters = normalizeNamespace(function (namespace, getters) { - var res = {}; - normalizeMap(getters).forEach(function (ref) { - var key = ref.key; - var val = ref.val; - - val = namespace + val; - res[key] = function mappedGetter () { - if (namespace && !getModuleByNamespace(this.$store, 'mapGetters', namespace)) { - return - } - if (process.env.NODE_ENV !== 'production' && !(val in this.$store.getters)) { - console.error(("[vuex] unknown getter: " + val)); - return - } - return this.$store.getters[val] - }; - // mark vuex getter for devtools - res[key].vuex = true; - }); - return res -}); - -var mapActions = normalizeNamespace(function (namespace, actions) { - var res = {}; - normalizeMap(actions).forEach(function (ref) { - var key = ref.key; - var val = ref.val; - - res[key] = function mappedAction () { - var args = [], len = arguments.length; - while ( len-- ) args[ len ] = arguments[ len ]; - - var dispatch = this.$store.dispatch; - if (namespace) { - var module = getModuleByNamespace(this.$store, 'mapActions', namespace); - if (!module) { - return - } - dispatch = module.context.dispatch; - } - return typeof val === 'function' - ? val.apply(this, [dispatch].concat(args)) - : dispatch.apply(this.$store, [val].concat(args)) - }; - }); - return res -}); - -var createNamespacedHelpers = function (namespace) { return ({ - mapState: mapState.bind(null, namespace), - mapGetters: mapGetters.bind(null, namespace), - mapMutations: mapMutations.bind(null, namespace), - mapActions: mapActions.bind(null, namespace) -}); }; - -function normalizeMap (map) { - return Array.isArray(map) - ? map.map(function (key) { return ({ key: key, val: key }); }) - : Object.keys(map).map(function (key) { return ({ key: key, val: map[key] }); }) -} - -function normalizeNamespace (fn) { - return function (namespace, map) { - if (typeof namespace !== 'string') { - map = namespace; - namespace = ''; - } else if (namespace.charAt(namespace.length - 1) !== '/') { - namespace += '/'; - } - return fn(namespace, map) - } -} - -function getModuleByNamespace (store, helper, namespace) { - var module = store._modulesNamespaceMap[namespace]; - if (process.env.NODE_ENV !== 'production' && !module) { - console.error(("[vuex] module namespace not found in " + helper + "(): " + namespace)); - } - return module -} - -var index_esm = { - Store: Store, - install: install, - version: '2.5.0', - mapState: mapState, - mapMutations: mapMutations, - mapGetters: mapGetters, - mapActions: mapActions, - createNamespacedHelpers: createNamespacedHelpers -}; - - -/* harmony default export */ __webpack_exports__["default"] = (index_esm); - -/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(4))) - -/***/ }), -/* 49 */ -/***/ (function(module, exports) { - -/* (ignored) */ - -/***/ }), -/* 50 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -/* jshint esversion: 6 */ -var toggleLoading = function toggleLoading(state, data) { - state.loading = data; -}; -var toggleConnecting = function toggleConnecting(state, data) { - state.isConnecting = data; -}; -var toggleKeyValidity = function toggleKeyValidity(state, data) { - state.apiKeyValidity = data; -}; -var toggleConnectedToOptml = function toggleConnectedToOptml(state, data) { - state.connected = data; -}; -var updateUserData = function updateUserData(state, data) { - state.userData = data; -}; -var updateApiKey = function updateApiKey(state, data) { - state.apiKey = data; -}; -var updateOptimizedImages = function updateOptimizedImages(state, data) { - state.optimizedImages = data.body.data; -}; -var updateSampleRate = function updateSampleRate(state, data) { - state.sample_rate = data; -}; -var restApiNotWorking = function restApiNotWorking(state, data) { - state.apiError = data; -}; -var updateSettings = function updateSettings(state, data) { - - for (var setting in data) { - state.site_settings[setting] = data[setting]; - } -}; - -exports.default = { - toggleLoading: toggleLoading, - toggleConnecting: toggleConnecting, - toggleKeyValidity: toggleKeyValidity, - toggleConnectedToOptml: toggleConnectedToOptml, - updateUserData: updateUserData, - updateApiKey: updateApiKey, - updateSampleRate: updateSampleRate, - restApiNotWorking: restApiNotWorking, - updateSettings: updateSettings, - updateOptimizedImages: updateOptimizedImages -}; - -/***/ }), -/* 51 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _vue = __webpack_require__(2); - -var _vue2 = _interopRequireDefault(_vue); - -var _vueResource = __webpack_require__(6); - -var _vueResource2 = _interopRequireDefault(_vueResource); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/* jshint esversion: 6 */ -/* global optimoleDashboardApp */ -_vue2.default.use(_vueResource2.default); - -var connectOptimole = function connectOptimole(_ref, data) { - var commit = _ref.commit, - state = _ref.state; - - commit('toggleConnecting', true); - commit('restApiNotWorking', false); - _vue2.default.http({ - url: optimoleDashboardApp.root + '/connect', - method: 'POST', - headers: { 'X-WP-Nonce': optimoleDashboardApp.nonce }, - params: { 'req': data.req }, - body: { - 'api_key': data.apiKey - }, - responseType: 'json', - emulateJSON: true - }).then(function (response) { - commit('toggleConnecting', false); - if (response.body.code === 'success') { - commit('toggleKeyValidity', true); - commit('toggleConnectedToOptml', true); - commit('updateApiKey', data.apiKey); - commit('updateUserData', response.body.data); - console.log('%c OptiMole API connection successful.', 'color: #59B278'); - } else { - commit('toggleKeyValidity', false); - console.log('%c Invalid API Key.', 'color: #E7602A'); - } - }, function () { - commit('toggleConnecting', false); - commit('restApiNotWorking', true); - }); -}; - -var registerOptimole = function registerOptimole(_ref2, data) { - var commit = _ref2.commit, - state = _ref2.state; - - - commit('restApiNotWorking', false); - commit('toggleLoading', true); - return _vue2.default.http({ - url: optimoleDashboardApp.root + '/register', - method: 'POST', - headers: { 'X-WP-Nonce': optimoleDashboardApp.nonce }, - params: { 'req': data.req }, - body: { - 'email': data.email - }, - emulateJSON: true, - responseType: 'json' - }).then(function (response) { - commit('toggleLoading', false); - return response.data; - }, function (response) { - commit('toggleLoading', false); - commit('restApiNotWorking', true); - return response.data; - }); -}; - -var disconnectOptimole = function disconnectOptimole(_ref3, data) { - var commit = _ref3.commit, - state = _ref3.state; - - commit('toggleLoading', true, 'loading'); - _vue2.default.http({ - url: optimoleDashboardApp.root + '/disconnect', - method: 'GET', - headers: { 'X-WP-Nonce': optimoleDashboardApp.nonce }, - params: { 'req': data.req }, - emulateJSON: true, - responseType: 'json' - }).then(function (response) { - commit('updateUserData', null); - commit('toggleLoading', false); - commit('updateApiKey', ''); - if (response.ok) { - commit('toggleConnectedToOptml', false); - console.log('%c Disconnected from OptiMole API.', 'color: #59B278'); - } else { - console.error(response); - } - }); -}; - -var saveSettings = function saveSettings(_ref4, data) { - var commit = _ref4.commit, - state = _ref4.state; - - commit('updateSettings', data.settings); - commit('toggleLoading', true); - return _vue2.default.http({ - url: optimoleDashboardApp.root + '/update_option', - method: 'POST', - headers: { 'X-WP-Nonce': optimoleDashboardApp.nonce }, - emulateJSON: true, - body: { - 'settings': data.settings - }, - responseType: 'json' - }).then(function (response) { - if (response.body.code === 'success') { - commit('updateSettings', response.body.data); - } - commit('toggleLoading', false); - }); -}; -var sampleRate = function sampleRate(_ref5, data) { - var commit = _ref5.commit, - state = _ref5.state; - - - data.component.loading_images = true; - return _vue2.default.http({ - url: optimoleDashboardApp.root + '/images-sample-rate', - method: 'POST', - emulateJSON: true, - headers: { 'X-WP-Nonce': optimoleDashboardApp.nonce }, - params: { - 'quality': data.quality, - 'force': data.force - }, - responseType: 'json' - }).then(function (response) { - - data.component.loading_images = false; - if (response.body.code === 'success') { - commit('updateSampleRate', response.body.data); - } - }); -}; - -var retrieveOptimizedImages = function retrieveOptimizedImages(_ref6, data) { - var commit = _ref6.commit, - state = _ref6.state; - - var self = this; - - setTimeout(function () { - - if (self.state.optimizedImages.length > 0) { - console.log('%c Images already exsist.', 'color: #59B278'); - return false; - } - _vue2.default.http({ - url: optimoleDashboardApp.root + '/poll_optimized_images', - method: 'GET', - emulateJSON: true, - headers: { 'X-WP-Nonce': optimoleDashboardApp.nonce }, - params: { 'req': 'Get Optimized Images' }, - responseType: 'json', - timeout: 10000 - }).then(function (response) { - if (response.body.code === 'success') { - commit('updateOptimizedImages', response); - if (data.component !== null) { - data.component.loading = false; - data.component.startTime = data.component.maxTime; - if (response.body.data.length === 0) { - data.component.noImages = true; - } - } - console.log('%c Images Fetched.', 'color: #59B278'); - } else { - component.noImages = true; - data.component.loading = false; - console.log('%c No images available.', 'color: #E7602A'); - } - }); - }, data.waitTime); -}; - -exports.default = { - connectOptimole: connectOptimole, - registerOptimole: registerOptimole, - disconnectOptimole: disconnectOptimole, - saveSettings: saveSettings, - sampleRate: sampleRate, - retrieveOptimizedImages: retrieveOptimizedImages -}; - -/***/ }), -/* 52 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); -/* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "install", function() { return install; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ResizeObserver", function() { return ResizeObserver; }); -function getInternetExplorerVersion() { - var ua = window.navigator.userAgent; - - var msie = ua.indexOf('MSIE '); - if (msie > 0) { - // IE 10 or older => return version number - return parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10); - } - - var trident = ua.indexOf('Trident/'); - if (trident > 0) { - // IE 11 => return version number - var rv = ua.indexOf('rv:'); - return parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10); - } - - var edge = ua.indexOf('Edge/'); - if (edge > 0) { - // Edge (IE 12+) => return version number - return parseInt(ua.substring(edge + 5, ua.indexOf('.', edge)), 10); - } - - // other browser - return -1; -} - -var isIE = void 0; - -function initCompat() { - if (!initCompat.init) { - initCompat.init = true; - isIE = getInternetExplorerVersion() !== -1; - } -} - -var ResizeObserver = { render: function render() { - var _vm = this;var _h = _vm.$createElement;var _c = _vm._self._c || _h;return _c('div', { staticClass: "resize-observer", attrs: { "tabindex": "-1" } }); - }, staticRenderFns: [], _scopeId: 'data-v-b329ee4c', - name: 'resize-observer', - - methods: { - notify: function notify() { - this.$emit('notify'); - }, - addResizeHandlers: function addResizeHandlers() { - this._resizeObject.contentDocument.defaultView.addEventListener('resize', this.notify); - if (this._w !== this.$el.offsetWidth || this._h !== this.$el.offsetHeight) { - this.notify(); - } - }, - removeResizeHandlers: function removeResizeHandlers() { - if (this._resizeObject && this._resizeObject.onload) { - if (!isIE && this._resizeObject.contentDocument) { - this._resizeObject.contentDocument.defaultView.removeEventListener('resize', this.notify); - } - delete this._resizeObject.onload; - } - } - }, - - mounted: function mounted() { - var _this = this; - - initCompat(); - this.$nextTick(function () { - _this._w = _this.$el.offsetWidth; - _this._h = _this.$el.offsetHeight; - }); - var object = document.createElement('object'); - this._resizeObject = object; - object.setAttribute('style', 'display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; pointer-events: none; z-index: -1;'); - object.setAttribute('aria-hidden', 'true'); - object.setAttribute('tabindex', -1); - object.onload = this.addResizeHandlers; - object.type = 'text/html'; - if (isIE) { - this.$el.appendChild(object); - } - object.data = 'about:blank'; - if (!isIE) { - this.$el.appendChild(object); - } - }, - beforeDestroy: function beforeDestroy() { - this.removeResizeHandlers(); - } -}; - -// Install the components -function install(Vue) { - Vue.component('resize-observer', ResizeObserver); - /* -- Add more components here -- */ -} - -/* -- Plugin definition & Auto-install -- */ -/* You shouldn't have to modify the code below */ - -// Plugin -var plugin = { - // eslint-disable-next-line no-undef - version: "0.4.4", - install: install -}; - -// Auto-install -var GlobalVue = null; -if (typeof window !== 'undefined') { - GlobalVue = window.Vue; -} else if (typeof global !== 'undefined') { - GlobalVue = global.Vue; -} -if (GlobalVue) { - GlobalVue.use(plugin); -} - - -/* harmony default export */ __webpack_exports__["default"] = (plugin); - -/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(3))) - -/***/ }), -/* 53 */ -/***/ (function(module, exports, __webpack_require__) { - -(function webpackUniversalModuleDefinition(root, factory) { - if(true) - module.exports = factory(__webpack_require__(2)); - else if(typeof define === 'function' && define.amd) - define(["vue"], factory); - else if(typeof exports === 'object') - exports["vue-js-toggle-button"] = factory(require("vue")); - else - root["vue-js-toggle-button"] = factory(root["vue"]); -})(this, function(__WEBPACK_EXTERNAL_MODULE_1__) { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // identity function for calling harmony imports with the correct context -/******/ __webpack_require__.i = function(value) { return value; }; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { -/******/ configurable: false, -/******/ enumerable: true, -/******/ get: getter -/******/ }); -/******/ } -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = "/dist/"; -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 3); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports, __webpack_require__) { - - -/* styles */ -__webpack_require__(8) - -var Component = __webpack_require__(6)( - /* script */ - __webpack_require__(2), - /* template */ - __webpack_require__(7), - /* scopeId */ - "data-v-25adc6c0", - /* cssModules */ - null -) - -module.exports = Component.exports - - -/***/ }), -/* 1 */ -/***/ (function(module, exports) { - -module.exports = __WEBPACK_EXTERNAL_MODULE_1__; - -/***/ }), -/* 2 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; - -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// - -var constants = { - colorChecked: '#75C791', - colorUnchecked: '#bfcbd9', - cssColors: false, - labelChecked: 'on', - labelUnchecked: 'off', - width: 50, - height: 22, - margin: 3, - switchColor: '#fff' -}; - -var contains = function contains(object, title) { - return (typeof object === 'undefined' ? 'undefined' : _typeof(object)) === 'object' && object.hasOwnProperty(title); -}; - -var px = function px(v) { - return v + 'px'; -}; - -/* harmony default export */ __webpack_exports__["default"] = ({ - name: 'ToggleButton', - props: { - value: { - type: Boolean, - default: false - }, - disabled: { - type: Boolean, - default: false - }, - name: { - type: String - }, - sync: { - type: Boolean, - default: false - }, - speed: { - type: Number, - default: 300 - }, - color: { - type: [String, Object], - validator: function validator(value) { - return (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' ? value.checked || value.unchecked : typeof value === 'string'; - } - }, - switchColor: { - type: [String, Object], - validator: function validator(value) { - return (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' ? value.checked || value.unchecked : typeof value === 'string'; - } - }, - cssColors: { - type: Boolean, - default: false - }, - labels: { - type: [Boolean, Object], - default: false, - validator: function validator(value) { - return (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' ? value.checked || value.unchecked : typeof value === 'boolean'; - } - }, - height: { - type: Number, - default: constants.height - }, - width: { - type: Number, - default: constants.width - } - }, - computed: { - className: function className() { - var toggled = this.toggled, - disabled = this.disabled; - - - return ['vue-js-switch', { toggled: toggled, disabled: disabled }]; - }, - ariaChecked: function ariaChecked() { - return this.toggled.toString(); - }, - coreStyle: function coreStyle() { - return { - width: px(this.width), - height: px(this.height), - backgroundColor: this.cssColors ? null : this.disabled ? this.colorDisabled : this.colorCurrent, - borderRadius: px(Math.round(this.height / 2)) - }; - }, - buttonRadius: function buttonRadius() { - return this.height - constants.margin * 2; - }, - distance: function distance() { - return px(this.width - this.height + constants.margin); - }, - buttonStyle: function buttonStyle() { - return { - width: px(this.buttonRadius), - height: px(this.buttonRadius), - transition: 'transform ' + this.speed + 'ms', - transform: this.toggled ? 'translate3d(' + this.distance + ', 3px, 0px)' : null, - background: this.switchColor ? this.switchColorCurrent : undefined - }; - }, - labelStyle: function labelStyle() { - return { - lineHeight: px(this.height) - }; - }, - colorChecked: function colorChecked() { - var color = this.color; - - - if ((typeof color === 'undefined' ? 'undefined' : _typeof(color)) !== 'object') { - return color || constants.colorChecked; - } - - return contains(color, 'checked') ? color.checked : constants.colorChecked; - }, - colorUnchecked: function colorUnchecked() { - var color = this.color; - - - return contains(color, 'unchecked') ? color.unchecked : constants.colorUnchecked; - }, - colorDisabled: function colorDisabled() { - var color = this.color; - - - return contains(color, 'disabled') ? color.disabled : this.colorCurrent; - }, - colorCurrent: function colorCurrent() { - return this.toggled ? this.colorChecked : this.colorUnchecked; - }, - labelChecked: function labelChecked() { - return contains(this.labels, 'checked') ? this.labels.checked : constants.labelChecked; - }, - labelUnchecked: function labelUnchecked() { - return contains(this.labels, 'unchecked') ? this.labels.unchecked : constants.labelUnchecked; - }, - switchColorChecked: function switchColorChecked() { - var switchColor = this.switchColor; - - - return contains(switchColor, 'checked') ? switchColor.checked : constants.switchColor; - }, - switchColorUnchecked: function switchColorUnchecked() { - var switchColor = this.switchColor; - - - return contains(switchColor, 'unchecked') ? switchColor.unchecked : constants.switchColor; - }, - switchColorCurrent: function switchColorCurrent() { - var switchColor = this.switchColor; - - - if ((typeof switchColor === 'undefined' ? 'undefined' : _typeof(switchColor)) !== 'object') { - return switchColor || constants.switchColor; - } - - return this.toggled ? this.switchColorChecked : this.switchColorUnchecked; - } - }, - watch: { - value: function value(_value) { - if (this.sync) { - this.toggled = !!_value; - } - } - }, - data: function data() { - return { - toggled: !!this.value - }; - }, - - methods: { - toggle: function toggle(event) { - this.toggled = !this.toggled; - this.$emit('input', this.toggled); - this.$emit('change', { - value: this.toggled, - srcEvent: event - }); - } - } -}); - -/***/ }), -/* 3 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_vue__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Button_vue__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Button_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__Button_vue__); - - - -var plugin = { - install: function install(Vue, options) { - Vue.component('ToggleButton', __WEBPACK_IMPORTED_MODULE_1__Button_vue___default.a); - } -}; - -/* harmony default export */ __webpack_exports__["default"] = (plugin); - -/***/ }), -/* 4 */ -/***/ (function(module, exports, __webpack_require__) { - -exports = module.exports = __webpack_require__(5)(); -// imports - - -// module -exports.push([module.i, ".vue-js-switch[data-v-25adc6c0]{display:inline-block;position:relative;overflow:hidden;vertical-align:middle;user-select:none;font-size:10px;cursor:pointer}.vue-js-switch .v-switch-input[data-v-25adc6c0]{display:none}.vue-js-switch .v-switch-label[data-v-25adc6c0]{position:absolute;top:0;font-weight:600;color:#fff}.vue-js-switch .v-switch-label.v-left[data-v-25adc6c0]{left:10px}.vue-js-switch .v-switch-label.v-right[data-v-25adc6c0]{right:10px}.vue-js-switch .v-switch-core[data-v-25adc6c0]{display:block;position:relative;box-sizing:border-box;outline:0;margin:0;transition:border-color .3s,background-color .3s;user-select:none}.vue-js-switch .v-switch-core .v-switch-button[data-v-25adc6c0]{display:block;position:absolute;overflow:hidden;top:0;left:0;transform:translate3d(3px,3px,0);border-radius:100%;background-color:#fff}.vue-js-switch.disabled[data-v-25adc6c0]{pointer-events:none;opacity:.6}", ""]); - -// exports - - -/***/ }), -/* 5 */ -/***/ (function(module, exports) { - -/* - MIT License http://www.opensource.org/licenses/mit-license.php - Author Tobias Koppers @sokra -*/ -// css base code, injected by the css-loader -module.exports = function() { - var list = []; - - // return the list of modules as css string - list.toString = function toString() { - var result = []; - for(var i = 0; i < this.length; i++) { - var item = this[i]; - if(item[2]) { - result.push("@media " + item[2] + "{" + item[1] + "}"); - } else { - result.push(item[1]); - } - } - return result.join(""); - }; - - // import a list of modules into the list - list.i = function(modules, mediaQuery) { - if(typeof modules === "string") - modules = [[null, modules, ""]]; - var alreadyImportedModules = {}; - for(var i = 0; i < this.length; i++) { - var id = this[i][0]; - if(typeof id === "number") - alreadyImportedModules[id] = true; - } - for(i = 0; i < modules.length; i++) { - var item = modules[i]; - // skip already imported module - // this implementation is not 100% perfect for weird media query combinations - // when a module is imported multiple times with different media queries. - // I hope this will never occur (Hey this way we have smaller bundles) - if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) { - if(mediaQuery && !item[2]) { - item[2] = mediaQuery; - } else if(mediaQuery) { - item[2] = "(" + item[2] + ") and (" + mediaQuery + ")"; - } - list.push(item); - } - } - }; - return list; -}; - - -/***/ }), -/* 6 */ -/***/ (function(module, exports) { - -// this module is a runtime utility for cleaner component module output and will -// be included in the final webpack user bundle - -module.exports = function normalizeComponent ( - rawScriptExports, - compiledTemplate, - scopeId, - cssModules -) { - var esModule - var scriptExports = rawScriptExports = rawScriptExports || {} - - // ES6 modules interop - var type = typeof rawScriptExports.default - if (type === 'object' || type === 'function') { - esModule = rawScriptExports - scriptExports = rawScriptExports.default - } - - // Vue.extend constructor export interop - var options = typeof scriptExports === 'function' - ? scriptExports.options - : scriptExports - - // render functions - if (compiledTemplate) { - options.render = compiledTemplate.render - options.staticRenderFns = compiledTemplate.staticRenderFns - } - - // scopedId - if (scopeId) { - options._scopeId = scopeId - } - - // inject cssModules - if (cssModules) { - var computed = Object.create(options.computed || null) - Object.keys(cssModules).forEach(function (key) { - var module = cssModules[key] - computed[key] = function () { return module } - }) - options.computed = computed - } - - return { - esModule: esModule, - exports: scriptExports, - options: options - } -} - - -/***/ }), -/* 7 */ -/***/ (function(module, exports) { - -module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h; - return _c('label', { - class: _vm.className, - attrs: { - "role": "checkbox", - "aria-checked": _vm.ariaChecked - } - }, [_c('input', { - staticClass: "v-switch-input", - attrs: { - "type": "checkbox", - "name": _vm.name - }, - on: { - "change": function($event) { - $event.stopPropagation(); - return _vm.toggle($event) - } - } - }), _vm._v(" "), _c('div', { - staticClass: "v-switch-core", - style: (_vm.coreStyle) - }, [_c('div', { - staticClass: "v-switch-button", - style: (_vm.buttonStyle) - })]), _vm._v(" "), (_vm.labels) ? [(_vm.toggled) ? _c('span', { - staticClass: "v-switch-label v-left", - style: (_vm.labelStyle), - domProps: { - "innerHTML": _vm._s(_vm.labelChecked) - } - }) : _c('span', { - staticClass: "v-switch-label v-right", - style: (_vm.labelStyle), - domProps: { - "innerHTML": _vm._s(_vm.labelUnchecked) - } - })] : _vm._e()], 2) -},staticRenderFns: []} - -/***/ }), -/* 8 */ -/***/ (function(module, exports, __webpack_require__) { - -// style-loader: Adds some css to the DOM by adding a + +}; + +/***/ }), +/* 14 */ +/***/ (function(module, exports, __webpack_require__) { + +var __vue_script__, __vue_template__ +__webpack_require__(15) +__vue_script__ = __webpack_require__(17) +__vue_template__ = __webpack_require__(18) +module.exports = __vue_script__ || {} +if (module.exports.__esModule) module.exports = module.exports.default +if (__vue_template__) { (typeof module.exports === "function" ? module.exports.options : module.exports).template = __vue_template__ } +if (false) {(function () { module.hot.accept() + var hotAPI = require("vue-hot-reload-api") + hotAPI.install(require("vue"), true) + if (!hotAPI.compatible) return + var id = "/var/www/html/wp-minions/wp-content/plugins/optimole-wp/assets/vue/components/app-header.vue" + if (!module.hot.data) { + hotAPI.createRecord(id, module.exports) + } else { + hotAPI.update(id, module.exports, __vue_template__) + } +})()} + +/***/ }), +/* 15 */ +/***/ (function(module, exports, __webpack_require__) { + +// style-loader: Adds some css to the DOM by adding a + +}; + +/***/ }), +/* 18 */ +/***/ (function(module, exports) { + +module.exports = "\n\t
\n\t\t
\n\t\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t\t

\n\t\t\t\t\t\n\t\t\t\t\tOptiMole - {{strings.service_details}}\n\t\t\t\t\t\n\t\t\t\t

\n\t\t\t
\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t{{strings.status}}\n\t\t\t\t\t{{strings.connected}}\n\t\t\t\t\t{{strings.not_connected}}\n\t\t\t\t
\n\t\t\t
\n\t\t\t\n\t\t
\n\t\t
\n\t
\n"; + +/***/ }), +/* 19 */ +/***/ (function(module, exports, __webpack_require__) { + +var __vue_script__, __vue_template__ +__webpack_require__(20) +__vue_script__ = __webpack_require__(22) +__vue_template__ = __webpack_require__(23) +module.exports = __vue_script__ || {} +if (module.exports.__esModule) module.exports = module.exports.default +if (__vue_template__) { (typeof module.exports === "function" ? module.exports.options : module.exports).template = __vue_template__ } +if (false) {(function () { module.hot.accept() + var hotAPI = require("vue-hot-reload-api") + hotAPI.install(require("vue"), true) + if (!hotAPI.compatible) return + var id = "/var/www/html/wp-minions/wp-content/plugins/optimole-wp/assets/vue/components/cdn-details.vue" + if (!module.hot.data) { + hotAPI.createRecord(id, module.exports) + } else { + hotAPI.update(id, module.exports, __vue_template__) + } +})()} + +/***/ }), +/* 20 */ +/***/ (function(module, exports, __webpack_require__) { + +// style-loader: Adds some css to the DOM by adding a + +}; + +/***/ }), +/* 23 */ +/***/ (function(module, exports) { + +module.exports = "\n\t
\n\t\t
\n\t\t
\n\t\t\t
\n\t\t\t\t{{strings.logged_in_as}}:\n\t\t\t\t

\n\t\t\t\t\t{{userData.display_name}}\n\t\t\t\t\t\n\t\t\t\t

\n\t\t\t
\n\t\t\t
\n\t\t\t\t{{strings.private_cdn_url}}:\n\t\t\t\t

{{userData.cdn_key}}.i.optimole.com

\n\t\t\t
\n\t\t
\n\t\t
\n\t\t
\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t{{strings.usage}}:\n\t\t\t\t\t\t{{this.userData.usage_pretty}}\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t
\n\t\t\t

\n\t\t\t\t{{computedPercentage()}}%\n\t\t\t

\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t{{strings.quota}}:\n\t\t\t\t\t\t{{this.userData.quota_pretty}}\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t
\n\t\t
\n\t\t60%\n\n\t
\n"; + +/***/ }), +/* 24 */ +/***/ (function(module, exports, __webpack_require__) { + +var __vue_script__, __vue_template__ +__webpack_require__(25) +__vue_script__ = __webpack_require__(27) +__vue_template__ = __webpack_require__(30) +module.exports = __vue_script__ || {} +if (module.exports.__esModule) module.exports = module.exports.default +if (__vue_template__) { (typeof module.exports === "function" ? module.exports.options : module.exports).template = __vue_template__ } +if (false) {(function () { module.hot.accept() + var hotAPI = require("vue-hot-reload-api") + hotAPI.install(require("vue"), true) + if (!hotAPI.compatible) return + var id = "/var/www/html/wp-minions/wp-content/plugins/optimole-wp/assets/vue/components/connect-layout.vue" + if (!module.hot.data) { + hotAPI.createRecord(id, module.exports) + } else { + hotAPI.update(id, module.exports, __vue_template__) + } +})()} + +/***/ }), +/* 25 */ +/***/ (function(module, exports, __webpack_require__) { + +// style-loader: Adds some css to the DOM by adding a + +}; // +// +// + +}; + +/***/ }), +/* 29 */ +/***/ (function(module, exports) { + +module.exports = "\n\t
\n\t\t
\n\t\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t
\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\n\t\t\t
\n\t\t
\n\t\t

\n\t\t\t{{strings.invalid_key}}\n\t\t

\n\t
\n"; + +/***/ }), +/* 30 */ +/***/ (function(module, exports) { + +module.exports = "\n\t
\n\t\t\n\t\t
\n\t\t
\n\t\t\t
\n\t\t\t\t{{strings.notification_message_register}}\n\t\t\t
\n\t\t\t\n\t\t\t
\n\t\t\t
\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t\t\t

1. {{strings.step_one_api_title}}

\n\t\t\t\t\t\t

\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t\t\t

2. {{strings.step_two_api_title}}

\n\t\t\t\t\t\t

{{strings.step_two_api_desc}}

\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t
\n\t\t\n\t\t
\n\t\t
\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t

{{strings.account_needed_heading}}

\n\t\t\t\t\t\t

\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t

\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t

\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t
\n\t\t\t
\n\t\t\t\t

\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t

\n\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t
\n\t\t
\n\t
\n"; + +/***/ }), +/* 31 */ +/***/ (function(module, exports, __webpack_require__) { + +var __vue_script__, __vue_template__ +__webpack_require__(32) +__vue_script__ = __webpack_require__(34) +__vue_template__ = __webpack_require__(35) +module.exports = __vue_script__ || {} +if (module.exports.__esModule) module.exports = module.exports.default +if (__vue_template__) { (typeof module.exports === "function" ? module.exports.options : module.exports).template = __vue_template__ } +if (false) {(function () { module.hot.accept() + var hotAPI = require("vue-hot-reload-api") + hotAPI.install(require("vue"), true) + if (!hotAPI.compatible) return + var id = "/var/www/html/wp-minions/wp-content/plugins/optimole-wp/assets/vue/components/last-images.vue" + if (!module.hot.data) { + hotAPI.createRecord(id, module.exports) + } else { + hotAPI.update(id, module.exports, __vue_template__) + } +})()} + +/***/ }), +/* 32 */ +/***/ (function(module, exports, __webpack_require__) { + +// style-loader: Adds some css to the DOM by adding a + +}; + +/***/ }), +/* 35 */ +/***/ (function(module, exports) { + +module.exports = "\n\t
\n\t\t
\n\t\t\t
\n\t\t\t\t

{{strings.last}} {{strings.optimized_images}}

\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t
{{strings.image}}{{strings.compression}}

\n\t\t\t\t\t\t
\n\t\t\t
\n\t\t
\n\t\t
\n\t\t\t\n\t\t\t
{{strings.loading_latest_images}}
\n\t\t\t\n\t\t
\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\n\t\t
\n\t
\n"; + +/***/ }), +/* 36 */ +/***/ (function(module, exports, __webpack_require__) { + +var __vue_script__, __vue_template__ +__webpack_require__(37) +__vue_script__ = __webpack_require__(39) +__vue_template__ = __webpack_require__(45) +module.exports = __vue_script__ || {} +if (module.exports.__esModule) module.exports = module.exports.default +if (__vue_template__) { (typeof module.exports === "function" ? module.exports.options : module.exports).template = __vue_template__ } +if (false) {(function () { module.hot.accept() + var hotAPI = require("vue-hot-reload-api") + hotAPI.install(require("vue"), true) + if (!hotAPI.compatible) return + var id = "/var/www/html/wp-minions/wp-content/plugins/optimole-wp/assets/vue/components/options.vue" + if (!module.hot.data) { + hotAPI.createRecord(id, module.exports) + } else { + hotAPI.update(id, module.exports, __vue_template__) + } +})()} + +/***/ }), +/* 37 */ +/***/ (function(module, exports, __webpack_require__) { + +// style-loader: Adds some css to the DOM by adding a + +}; // +// +// + // + +}; + +/***/ }), +/* 44 */ +/***/ (function(module, exports) { + +module.exports = "\n\t
\n\t\t
\n\t\t\t\n\t\t\t{{this.first_label}}\n\t\t\t{{this.second_label}}\n\t\t\t
\n\t\t\t\t\n\t\t\t\n\t\t\t
\n\t\t\t\n\t\t\t\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\t\n\t\t\t
\n\t\t\t\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\t
\n\t\t\n\t\t
\n\t\t\n\t\n\t
\n"; + +/***/ }), +/* 45 */ +/***/ (function(module, exports) { + +module.exports = "\n\t
\n\t\t\n\t\t
\n\t\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t
\n\t\t\n\t\t
\n\t\t
\n\t\t\t\n\t\t\t\n\t\t\t
\n\t\t\t\t\n\t\t\t
\n\t\t
\n\n\t\t
\n\t\t\t\n\n\t\t\t
\n\t\t\t\t\n\t\t\t
\n\t\t
\n\t\t\n\t\t
\n\t\t\t\n\t\t\t\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t

\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t{{strings.width_field}}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t

\n\t\t\t\t\t\t

\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t

\n\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t

\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t{{strings.height_field}}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t

\n\t\t\t\t\t\t

\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t

\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t
\n\t\t
\n\t\t\n\t\t
\n\t\t\t\n\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t\t

\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t{{strings.auto_q_title}}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t

\n\t\t\t\t\t\t

\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t{{strings.high_q_title}}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t

\n\t\t\t\t\t\t\n\t\t\t\t\t\t

\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t{{strings.medium_q_title}}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t

\n\t\t\t\t\t\t\n\t\t\t\t\t\t

\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t{{strings.low_q_title}}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t

\n\t\t\t\t\t
\n\t\t\t\t\t

\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t{{strings.save_changes}}\n\t\t\t\t\t\t\n\t\t\t\t\t

\n\t\t\t\t
\n\t\t\t
\n\t\t
\n
\n
{{strings.sample_image_loading}}\n
\n
0\" _v-5dc9f0cc=\"\">\n

{{strings.quality_slider_desc}}

\n
\n \n \n \n
\n
\n

0\" _v-5dc9f0cc=\"\">\n {{( 100 - compressionRatio )}}% smaller

\n

\n {{all_strings.latest_images.same_size}}\n

\n \n \n
\n
\n \n \n \n \n
\n
\n
\n
\n

{{strings.no_images_found}}

\n
\n
\n\t\n\t
\n\n"; + +/***/ }), +/* 46 */ +/***/ (function(module, exports) { + +module.exports = "\n\t
\n\t\t\n\t\t
\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
0\" v-html=\"strings.notice_just_activated\">
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t
\n\t\t
\n\t\t\n\t\t\n\t
\n"; + +/***/ }), +/* 47 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _vue = __webpack_require__(2); + +var _vue2 = _interopRequireDefault(_vue); + +var _vuex = __webpack_require__(48); + +var _vuex2 = _interopRequireDefault(_vuex); + +var _vueResource = __webpack_require__(6); + +var _vueResource2 = _interopRequireDefault(_vueResource); + +var _mutations = __webpack_require__(50); + +var _mutations2 = _interopRequireDefault(_mutations); + +var _actions = __webpack_require__(51); + +var _actions2 = _interopRequireDefault(_actions); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +_vue2.default.use(_vuex2.default); /* global optimoleDashboardApp */ +/*jshint esversion: 6 */ + +_vue2.default.use(_vueResource2.default); + +var store = new _vuex2.default.Store({ + strict: true, + state: { + isConnecting: false, + loading: false, + site_settings: optimoleDashboardApp.site_settings, + connected: optimoleDashboardApp.connection_status === 'yes', + apiKey: optimoleDashboardApp.api_key ? optimoleDashboardApp.api_key : '', + apiKeyValidity: true, + sample_rate: {}, + apiError: false, + userData: optimoleDashboardApp.user_data ? optimoleDashboardApp.user_data : null, + optimizedImages: [] + }, + mutations: _mutations2.default, + actions: _actions2.default +}); + +exports.default = store; + +/***/ }), +/* 48 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); +/* WEBPACK VAR INJECTION */(function(process) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Store", function() { return Store; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "install", function() { return install; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mapState", function() { return mapState; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mapMutations", function() { return mapMutations; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mapGetters", function() { return mapGetters; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mapActions", function() { return mapActions; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createNamespacedHelpers", function() { return createNamespacedHelpers; }); +/** + * vuex v2.5.0 + * (c) 2017 Evan You + * @license MIT + */ +var applyMixin = function (Vue) { + var version = Number(Vue.version.split('.')[0]); + + if (version >= 2) { + Vue.mixin({ beforeCreate: vuexInit }); + } else { + // override init and inject vuex init procedure + // for 1.x backwards compatibility. + var _init = Vue.prototype._init; + Vue.prototype._init = function (options) { + if ( options === void 0 ) options = {}; + + options.init = options.init + ? [vuexInit].concat(options.init) + : vuexInit; + _init.call(this, options); + }; + } + + /** + * Vuex init hook, injected into each instances init hooks list. + */ + + function vuexInit () { + var options = this.$options; + // store injection + if (options.store) { + this.$store = typeof options.store === 'function' + ? options.store() + : options.store; + } else if (options.parent && options.parent.$store) { + this.$store = options.parent.$store; + } + } +}; + +var devtoolHook = + typeof window !== 'undefined' && + window.__VUE_DEVTOOLS_GLOBAL_HOOK__; + +function devtoolPlugin (store) { + if (!devtoolHook) { return } + + store._devtoolHook = devtoolHook; + + devtoolHook.emit('vuex:init', store); + + devtoolHook.on('vuex:travel-to-state', function (targetState) { + store.replaceState(targetState); + }); + + store.subscribe(function (mutation, state) { + devtoolHook.emit('vuex:mutation', mutation, state); + }); +} + +/** + * Get the first item that pass the test + * by second argument function + * + * @param {Array} list + * @param {Function} f + * @return {*} + */ +/** + * Deep copy the given object considering circular structure. + * This function caches all nested objects and its copies. + * If it detects circular structure, use cached copy to avoid infinite loop. + * + * @param {*} obj + * @param {Array} cache + * @return {*} + */ + + +/** + * forEach for object + */ +function forEachValue (obj, fn) { + Object.keys(obj).forEach(function (key) { return fn(obj[key], key); }); +} + +function isObject (obj) { + return obj !== null && typeof obj === 'object' +} + +function isPromise (val) { + return val && typeof val.then === 'function' +} + +function assert (condition, msg) { + if (!condition) { throw new Error(("[vuex] " + msg)) } +} + +var Module = function Module (rawModule, runtime) { + this.runtime = runtime; + this._children = Object.create(null); + this._rawModule = rawModule; + var rawState = rawModule.state; + this.state = (typeof rawState === 'function' ? rawState() : rawState) || {}; +}; + +var prototypeAccessors$1 = { namespaced: { configurable: true } }; + +prototypeAccessors$1.namespaced.get = function () { + return !!this._rawModule.namespaced +}; + +Module.prototype.addChild = function addChild (key, module) { + this._children[key] = module; +}; + +Module.prototype.removeChild = function removeChild (key) { + delete this._children[key]; +}; + +Module.prototype.getChild = function getChild (key) { + return this._children[key] +}; + +Module.prototype.update = function update (rawModule) { + this._rawModule.namespaced = rawModule.namespaced; + if (rawModule.actions) { + this._rawModule.actions = rawModule.actions; + } + if (rawModule.mutations) { + this._rawModule.mutations = rawModule.mutations; + } + if (rawModule.getters) { + this._rawModule.getters = rawModule.getters; + } +}; + +Module.prototype.forEachChild = function forEachChild (fn) { + forEachValue(this._children, fn); +}; + +Module.prototype.forEachGetter = function forEachGetter (fn) { + if (this._rawModule.getters) { + forEachValue(this._rawModule.getters, fn); + } +}; + +Module.prototype.forEachAction = function forEachAction (fn) { + if (this._rawModule.actions) { + forEachValue(this._rawModule.actions, fn); + } +}; + +Module.prototype.forEachMutation = function forEachMutation (fn) { + if (this._rawModule.mutations) { + forEachValue(this._rawModule.mutations, fn); + } +}; + +Object.defineProperties( Module.prototype, prototypeAccessors$1 ); + +var ModuleCollection = function ModuleCollection (rawRootModule) { + // register root module (Vuex.Store options) + this.register([], rawRootModule, false); +}; + +ModuleCollection.prototype.get = function get (path) { + return path.reduce(function (module, key) { + return module.getChild(key) + }, this.root) +}; + +ModuleCollection.prototype.getNamespace = function getNamespace (path) { + var module = this.root; + return path.reduce(function (namespace, key) { + module = module.getChild(key); + return namespace + (module.namespaced ? key + '/' : '') + }, '') +}; + +ModuleCollection.prototype.update = function update$1 (rawRootModule) { + update([], this.root, rawRootModule); +}; + +ModuleCollection.prototype.register = function register (path, rawModule, runtime) { + var this$1 = this; + if ( runtime === void 0 ) runtime = true; + + if (process.env.NODE_ENV !== 'production') { + assertRawModule(path, rawModule); + } + + var newModule = new Module(rawModule, runtime); + if (path.length === 0) { + this.root = newModule; + } else { + var parent = this.get(path.slice(0, -1)); + parent.addChild(path[path.length - 1], newModule); + } + + // register nested modules + if (rawModule.modules) { + forEachValue(rawModule.modules, function (rawChildModule, key) { + this$1.register(path.concat(key), rawChildModule, runtime); + }); + } +}; + +ModuleCollection.prototype.unregister = function unregister (path) { + var parent = this.get(path.slice(0, -1)); + var key = path[path.length - 1]; + if (!parent.getChild(key).runtime) { return } + + parent.removeChild(key); +}; + +function update (path, targetModule, newModule) { + if (process.env.NODE_ENV !== 'production') { + assertRawModule(path, newModule); + } + + // update target module + targetModule.update(newModule); + + // update nested modules + if (newModule.modules) { + for (var key in newModule.modules) { + if (!targetModule.getChild(key)) { + if (process.env.NODE_ENV !== 'production') { + console.warn( + "[vuex] trying to add a new module '" + key + "' on hot reloading, " + + 'manual reload is needed' + ); + } + return + } + update( + path.concat(key), + targetModule.getChild(key), + newModule.modules[key] + ); + } + } +} + +var functionAssert = { + assert: function (value) { return typeof value === 'function'; }, + expected: 'function' +}; + +var objectAssert = { + assert: function (value) { return typeof value === 'function' || + (typeof value === 'object' && typeof value.handler === 'function'); }, + expected: 'function or object with "handler" function' +}; + +var assertTypes = { + getters: functionAssert, + mutations: functionAssert, + actions: objectAssert +}; + +function assertRawModule (path, rawModule) { + Object.keys(assertTypes).forEach(function (key) { + if (!rawModule[key]) { return } + + var assertOptions = assertTypes[key]; + + forEachValue(rawModule[key], function (value, type) { + assert( + assertOptions.assert(value), + makeAssertionMessage(path, key, type, value, assertOptions.expected) + ); + }); + }); +} + +function makeAssertionMessage (path, key, type, value, expected) { + var buf = key + " should be " + expected + " but \"" + key + "." + type + "\""; + if (path.length > 0) { + buf += " in module \"" + (path.join('.')) + "\""; + } + buf += " is " + (JSON.stringify(value)) + "."; + return buf +} + +var Vue; // bind on install + +var Store = function Store (options) { + var this$1 = this; + if ( options === void 0 ) options = {}; + + // Auto install if it is not done yet and `window` has `Vue`. + // To allow users to avoid auto-installation in some cases, + // this code should be placed here. See #731 + if (!Vue && typeof window !== 'undefined' && window.Vue) { + install(window.Vue); + } + + if (process.env.NODE_ENV !== 'production') { + assert(Vue, "must call Vue.use(Vuex) before creating a store instance."); + assert(typeof Promise !== 'undefined', "vuex requires a Promise polyfill in this browser."); + assert(this instanceof Store, "Store must be called with the new operator."); + } + + var plugins = options.plugins; if ( plugins === void 0 ) plugins = []; + var strict = options.strict; if ( strict === void 0 ) strict = false; + + var state = options.state; if ( state === void 0 ) state = {}; + if (typeof state === 'function') { + state = state() || {}; + } + + // store internal state + this._committing = false; + this._actions = Object.create(null); + this._actionSubscribers = []; + this._mutations = Object.create(null); + this._wrappedGetters = Object.create(null); + this._modules = new ModuleCollection(options); + this._modulesNamespaceMap = Object.create(null); + this._subscribers = []; + this._watcherVM = new Vue(); + + // bind commit and dispatch to self + var store = this; + var ref = this; + var dispatch = ref.dispatch; + var commit = ref.commit; + this.dispatch = function boundDispatch (type, payload) { + return dispatch.call(store, type, payload) + }; + this.commit = function boundCommit (type, payload, options) { + return commit.call(store, type, payload, options) + }; + + // strict mode + this.strict = strict; + + // init root module. + // this also recursively registers all sub-modules + // and collects all module getters inside this._wrappedGetters + installModule(this, state, [], this._modules.root); + + // initialize the store vm, which is responsible for the reactivity + // (also registers _wrappedGetters as computed properties) + resetStoreVM(this, state); + + // apply plugins + plugins.forEach(function (plugin) { return plugin(this$1); }); + + if (Vue.config.devtools) { + devtoolPlugin(this); + } +}; + +var prototypeAccessors = { state: { configurable: true } }; + +prototypeAccessors.state.get = function () { + return this._vm._data.$$state +}; + +prototypeAccessors.state.set = function (v) { + if (process.env.NODE_ENV !== 'production') { + assert(false, "Use store.replaceState() to explicit replace store state."); + } +}; + +Store.prototype.commit = function commit (_type, _payload, _options) { + var this$1 = this; + + // check object-style commit + var ref = unifyObjectStyle(_type, _payload, _options); + var type = ref.type; + var payload = ref.payload; + var options = ref.options; + + var mutation = { type: type, payload: payload }; + var entry = this._mutations[type]; + if (!entry) { + if (process.env.NODE_ENV !== 'production') { + console.error(("[vuex] unknown mutation type: " + type)); + } + return + } + this._withCommit(function () { + entry.forEach(function commitIterator (handler) { + handler(payload); + }); + }); + this._subscribers.forEach(function (sub) { return sub(mutation, this$1.state); }); + + if ( + process.env.NODE_ENV !== 'production' && + options && options.silent + ) { + console.warn( + "[vuex] mutation type: " + type + ". Silent option has been removed. " + + 'Use the filter functionality in the vue-devtools' + ); + } +}; + +Store.prototype.dispatch = function dispatch (_type, _payload) { + var this$1 = this; + + // check object-style dispatch + var ref = unifyObjectStyle(_type, _payload); + var type = ref.type; + var payload = ref.payload; + + var action = { type: type, payload: payload }; + var entry = this._actions[type]; + if (!entry) { + if (process.env.NODE_ENV !== 'production') { + console.error(("[vuex] unknown action type: " + type)); + } + return + } + + this._actionSubscribers.forEach(function (sub) { return sub(action, this$1.state); }); + + return entry.length > 1 + ? Promise.all(entry.map(function (handler) { return handler(payload); })) + : entry[0](payload) +}; + +Store.prototype.subscribe = function subscribe (fn) { + return genericSubscribe(fn, this._subscribers) +}; + +Store.prototype.subscribeAction = function subscribeAction (fn) { + return genericSubscribe(fn, this._actionSubscribers) +}; + +Store.prototype.watch = function watch (getter, cb, options) { + var this$1 = this; + + if (process.env.NODE_ENV !== 'production') { + assert(typeof getter === 'function', "store.watch only accepts a function."); + } + return this._watcherVM.$watch(function () { return getter(this$1.state, this$1.getters); }, cb, options) +}; + +Store.prototype.replaceState = function replaceState (state) { + var this$1 = this; + + this._withCommit(function () { + this$1._vm._data.$$state = state; + }); +}; + +Store.prototype.registerModule = function registerModule (path, rawModule, options) { + if ( options === void 0 ) options = {}; + + if (typeof path === 'string') { path = [path]; } + + if (process.env.NODE_ENV !== 'production') { + assert(Array.isArray(path), "module path must be a string or an Array."); + assert(path.length > 0, 'cannot register the root module by using registerModule.'); + } + + this._modules.register(path, rawModule); + installModule(this, this.state, path, this._modules.get(path), options.preserveState); + // reset store to update getters... + resetStoreVM(this, this.state); +}; + +Store.prototype.unregisterModule = function unregisterModule (path) { + var this$1 = this; + + if (typeof path === 'string') { path = [path]; } + + if (process.env.NODE_ENV !== 'production') { + assert(Array.isArray(path), "module path must be a string or an Array."); + } + + this._modules.unregister(path); + this._withCommit(function () { + var parentState = getNestedState(this$1.state, path.slice(0, -1)); + Vue.delete(parentState, path[path.length - 1]); + }); + resetStore(this); +}; + +Store.prototype.hotUpdate = function hotUpdate (newOptions) { + this._modules.update(newOptions); + resetStore(this, true); +}; + +Store.prototype._withCommit = function _withCommit (fn) { + var committing = this._committing; + this._committing = true; + fn(); + this._committing = committing; +}; + +Object.defineProperties( Store.prototype, prototypeAccessors ); + +function genericSubscribe (fn, subs) { + if (subs.indexOf(fn) < 0) { + subs.push(fn); + } + return function () { + var i = subs.indexOf(fn); + if (i > -1) { + subs.splice(i, 1); + } + } +} + +function resetStore (store, hot) { + store._actions = Object.create(null); + store._mutations = Object.create(null); + store._wrappedGetters = Object.create(null); + store._modulesNamespaceMap = Object.create(null); + var state = store.state; + // init all modules + installModule(store, state, [], store._modules.root, true); + // reset vm + resetStoreVM(store, state, hot); +} + +function resetStoreVM (store, state, hot) { + var oldVm = store._vm; + + // bind store public getters + store.getters = {}; + var wrappedGetters = store._wrappedGetters; + var computed = {}; + forEachValue(wrappedGetters, function (fn, key) { + // use computed to leverage its lazy-caching mechanism + computed[key] = function () { return fn(store); }; + Object.defineProperty(store.getters, key, { + get: function () { return store._vm[key]; }, + enumerable: true // for local getters + }); + }); + + // use a Vue instance to store the state tree + // suppress warnings just in case the user has added + // some funky global mixins + var silent = Vue.config.silent; + Vue.config.silent = true; + store._vm = new Vue({ + data: { + $$state: state + }, + computed: computed + }); + Vue.config.silent = silent; + + // enable strict mode for new vm + if (store.strict) { + enableStrictMode(store); + } + + if (oldVm) { + if (hot) { + // dispatch changes in all subscribed watchers + // to force getter re-evaluation for hot reloading. + store._withCommit(function () { + oldVm._data.$$state = null; + }); + } + Vue.nextTick(function () { return oldVm.$destroy(); }); + } +} + +function installModule (store, rootState, path, module, hot) { + var isRoot = !path.length; + var namespace = store._modules.getNamespace(path); + + // register in namespace map + if (module.namespaced) { + store._modulesNamespaceMap[namespace] = module; + } + + // set state + if (!isRoot && !hot) { + var parentState = getNestedState(rootState, path.slice(0, -1)); + var moduleName = path[path.length - 1]; + store._withCommit(function () { + Vue.set(parentState, moduleName, module.state); + }); + } + + var local = module.context = makeLocalContext(store, namespace, path); + + module.forEachMutation(function (mutation, key) { + var namespacedType = namespace + key; + registerMutation(store, namespacedType, mutation, local); + }); + + module.forEachAction(function (action, key) { + var type = action.root ? key : namespace + key; + var handler = action.handler || action; + registerAction(store, type, handler, local); + }); + + module.forEachGetter(function (getter, key) { + var namespacedType = namespace + key; + registerGetter(store, namespacedType, getter, local); + }); + + module.forEachChild(function (child, key) { + installModule(store, rootState, path.concat(key), child, hot); + }); +} + +/** + * make localized dispatch, commit, getters and state + * if there is no namespace, just use root ones + */ +function makeLocalContext (store, namespace, path) { + var noNamespace = namespace === ''; + + var local = { + dispatch: noNamespace ? store.dispatch : function (_type, _payload, _options) { + var args = unifyObjectStyle(_type, _payload, _options); + var payload = args.payload; + var options = args.options; + var type = args.type; + + if (!options || !options.root) { + type = namespace + type; + if (process.env.NODE_ENV !== 'production' && !store._actions[type]) { + console.error(("[vuex] unknown local action type: " + (args.type) + ", global type: " + type)); + return + } + } + + return store.dispatch(type, payload) + }, + + commit: noNamespace ? store.commit : function (_type, _payload, _options) { + var args = unifyObjectStyle(_type, _payload, _options); + var payload = args.payload; + var options = args.options; + var type = args.type; + + if (!options || !options.root) { + type = namespace + type; + if (process.env.NODE_ENV !== 'production' && !store._mutations[type]) { + console.error(("[vuex] unknown local mutation type: " + (args.type) + ", global type: " + type)); + return + } + } + + store.commit(type, payload, options); + } + }; + + // getters and state object must be gotten lazily + // because they will be changed by vm update + Object.defineProperties(local, { + getters: { + get: noNamespace + ? function () { return store.getters; } + : function () { return makeLocalGetters(store, namespace); } + }, + state: { + get: function () { return getNestedState(store.state, path); } + } + }); + + return local +} + +function makeLocalGetters (store, namespace) { + var gettersProxy = {}; + + var splitPos = namespace.length; + Object.keys(store.getters).forEach(function (type) { + // skip if the target getter is not match this namespace + if (type.slice(0, splitPos) !== namespace) { return } + + // extract local getter type + var localType = type.slice(splitPos); + + // Add a port to the getters proxy. + // Define as getter property because + // we do not want to evaluate the getters in this time. + Object.defineProperty(gettersProxy, localType, { + get: function () { return store.getters[type]; }, + enumerable: true + }); + }); + + return gettersProxy +} + +function registerMutation (store, type, handler, local) { + var entry = store._mutations[type] || (store._mutations[type] = []); + entry.push(function wrappedMutationHandler (payload) { + handler.call(store, local.state, payload); + }); +} + +function registerAction (store, type, handler, local) { + var entry = store._actions[type] || (store._actions[type] = []); + entry.push(function wrappedActionHandler (payload, cb) { + var res = handler.call(store, { + dispatch: local.dispatch, + commit: local.commit, + getters: local.getters, + state: local.state, + rootGetters: store.getters, + rootState: store.state + }, payload, cb); + if (!isPromise(res)) { + res = Promise.resolve(res); + } + if (store._devtoolHook) { + return res.catch(function (err) { + store._devtoolHook.emit('vuex:error', err); + throw err + }) + } else { + return res + } + }); +} + +function registerGetter (store, type, rawGetter, local) { + if (store._wrappedGetters[type]) { + if (process.env.NODE_ENV !== 'production') { + console.error(("[vuex] duplicate getter key: " + type)); + } + return + } + store._wrappedGetters[type] = function wrappedGetter (store) { + return rawGetter( + local.state, // local state + local.getters, // local getters + store.state, // root state + store.getters // root getters + ) + }; +} + +function enableStrictMode (store) { + store._vm.$watch(function () { return this._data.$$state }, function () { + if (process.env.NODE_ENV !== 'production') { + assert(store._committing, "Do not mutate vuex store state outside mutation handlers."); + } + }, { deep: true, sync: true }); +} + +function getNestedState (state, path) { + return path.length + ? path.reduce(function (state, key) { return state[key]; }, state) + : state +} + +function unifyObjectStyle (type, payload, options) { + if (isObject(type) && type.type) { + options = payload; + payload = type; + type = type.type; + } + + if (process.env.NODE_ENV !== 'production') { + assert(typeof type === 'string', ("Expects string as the type, but found " + (typeof type) + ".")); + } + + return { type: type, payload: payload, options: options } +} + +function install (_Vue) { + if (Vue && _Vue === Vue) { + if (process.env.NODE_ENV !== 'production') { + console.error( + '[vuex] already installed. Vue.use(Vuex) should be called only once.' + ); + } + return + } + Vue = _Vue; + applyMixin(Vue); +} + +var mapState = normalizeNamespace(function (namespace, states) { + var res = {}; + normalizeMap(states).forEach(function (ref) { + var key = ref.key; + var val = ref.val; + + res[key] = function mappedState () { + var state = this.$store.state; + var getters = this.$store.getters; + if (namespace) { + var module = getModuleByNamespace(this.$store, 'mapState', namespace); + if (!module) { + return + } + state = module.context.state; + getters = module.context.getters; + } + return typeof val === 'function' + ? val.call(this, state, getters) + : state[val] + }; + // mark vuex getter for devtools + res[key].vuex = true; + }); + return res +}); + +var mapMutations = normalizeNamespace(function (namespace, mutations) { + var res = {}; + normalizeMap(mutations).forEach(function (ref) { + var key = ref.key; + var val = ref.val; + + res[key] = function mappedMutation () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + var commit = this.$store.commit; + if (namespace) { + var module = getModuleByNamespace(this.$store, 'mapMutations', namespace); + if (!module) { + return + } + commit = module.context.commit; + } + return typeof val === 'function' + ? val.apply(this, [commit].concat(args)) + : commit.apply(this.$store, [val].concat(args)) + }; + }); + return res +}); + +var mapGetters = normalizeNamespace(function (namespace, getters) { + var res = {}; + normalizeMap(getters).forEach(function (ref) { + var key = ref.key; + var val = ref.val; + + val = namespace + val; + res[key] = function mappedGetter () { + if (namespace && !getModuleByNamespace(this.$store, 'mapGetters', namespace)) { + return + } + if (process.env.NODE_ENV !== 'production' && !(val in this.$store.getters)) { + console.error(("[vuex] unknown getter: " + val)); + return + } + return this.$store.getters[val] + }; + // mark vuex getter for devtools + res[key].vuex = true; + }); + return res +}); + +var mapActions = normalizeNamespace(function (namespace, actions) { + var res = {}; + normalizeMap(actions).forEach(function (ref) { + var key = ref.key; + var val = ref.val; + + res[key] = function mappedAction () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + var dispatch = this.$store.dispatch; + if (namespace) { + var module = getModuleByNamespace(this.$store, 'mapActions', namespace); + if (!module) { + return + } + dispatch = module.context.dispatch; + } + return typeof val === 'function' + ? val.apply(this, [dispatch].concat(args)) + : dispatch.apply(this.$store, [val].concat(args)) + }; + }); + return res +}); + +var createNamespacedHelpers = function (namespace) { return ({ + mapState: mapState.bind(null, namespace), + mapGetters: mapGetters.bind(null, namespace), + mapMutations: mapMutations.bind(null, namespace), + mapActions: mapActions.bind(null, namespace) +}); }; + +function normalizeMap (map) { + return Array.isArray(map) + ? map.map(function (key) { return ({ key: key, val: key }); }) + : Object.keys(map).map(function (key) { return ({ key: key, val: map[key] }); }) +} + +function normalizeNamespace (fn) { + return function (namespace, map) { + if (typeof namespace !== 'string') { + map = namespace; + namespace = ''; + } else if (namespace.charAt(namespace.length - 1) !== '/') { + namespace += '/'; + } + return fn(namespace, map) + } +} + +function getModuleByNamespace (store, helper, namespace) { + var module = store._modulesNamespaceMap[namespace]; + if (process.env.NODE_ENV !== 'production' && !module) { + console.error(("[vuex] module namespace not found in " + helper + "(): " + namespace)); + } + return module +} + +var index_esm = { + Store: Store, + install: install, + version: '2.5.0', + mapState: mapState, + mapMutations: mapMutations, + mapGetters: mapGetters, + mapActions: mapActions, + createNamespacedHelpers: createNamespacedHelpers +}; + + +/* harmony default export */ __webpack_exports__["default"] = (index_esm); + +/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(4))) + +/***/ }), +/* 49 */ +/***/ (function(module, exports) { + +/* (ignored) */ + +/***/ }), +/* 50 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +/* jshint esversion: 6 */ +var toggleLoading = function toggleLoading(state, data) { + state.loading = data; +}; +var toggleConnecting = function toggleConnecting(state, data) { + state.isConnecting = data; +}; +var toggleKeyValidity = function toggleKeyValidity(state, data) { + state.apiKeyValidity = data; +}; +var toggleConnectedToOptml = function toggleConnectedToOptml(state, data) { + state.connected = data; +}; +var updateUserData = function updateUserData(state, data) { + state.userData = data; +}; +var updateApiKey = function updateApiKey(state, data) { + state.apiKey = data; +}; +var updateOptimizedImages = function updateOptimizedImages(state, data) { + state.optimizedImages = data.body.data; +}; +var updateSampleRate = function updateSampleRate(state, data) { + state.sample_rate = data; +}; +var restApiNotWorking = function restApiNotWorking(state, data) { + state.apiError = data; +}; +var updateSettings = function updateSettings(state, data) { + + for (var setting in data) { + state.site_settings[setting] = data[setting]; + } +}; + +exports.default = { + toggleLoading: toggleLoading, + toggleConnecting: toggleConnecting, + toggleKeyValidity: toggleKeyValidity, + toggleConnectedToOptml: toggleConnectedToOptml, + updateUserData: updateUserData, + updateApiKey: updateApiKey, + updateSampleRate: updateSampleRate, + restApiNotWorking: restApiNotWorking, + updateSettings: updateSettings, + updateOptimizedImages: updateOptimizedImages +}; + +/***/ }), +/* 51 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _vue = __webpack_require__(2); + +var _vue2 = _interopRequireDefault(_vue); + +var _vueResource = __webpack_require__(6); + +var _vueResource2 = _interopRequireDefault(_vueResource); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/* jshint esversion: 6 */ +/* global optimoleDashboardApp */ +_vue2.default.use(_vueResource2.default); + +var connectOptimole = function connectOptimole(_ref, data) { + var commit = _ref.commit, + state = _ref.state; + + commit('toggleConnecting', true); + commit('restApiNotWorking', false); + _vue2.default.http({ + url: optimoleDashboardApp.root + '/connect', + method: 'POST', + headers: { 'X-WP-Nonce': optimoleDashboardApp.nonce }, + params: { 'req': data.req }, + body: { + 'api_key': data.apiKey + }, + responseType: 'json', + emulateJSON: true + }).then(function (response) { + commit('toggleConnecting', false); + if (response.body.code === 'success') { + commit('toggleKeyValidity', true); + commit('toggleConnectedToOptml', true); + commit('updateApiKey', data.apiKey); + commit('updateUserData', response.body.data); + console.log('%c OptiMole API connection successful.', 'color: #59B278'); + } else { + commit('toggleKeyValidity', false); + console.log('%c Invalid API Key.', 'color: #E7602A'); + } + }, function () { + commit('toggleConnecting', false); + commit('restApiNotWorking', true); + }); +}; + +var registerOptimole = function registerOptimole(_ref2, data) { + var commit = _ref2.commit, + state = _ref2.state; + + + commit('restApiNotWorking', false); + commit('toggleLoading', true); + return _vue2.default.http({ + url: optimoleDashboardApp.root + '/register', + method: 'POST', + headers: { 'X-WP-Nonce': optimoleDashboardApp.nonce }, + params: { 'req': data.req }, + body: { + 'email': data.email + }, + emulateJSON: true, + responseType: 'json' + }).then(function (response) { + commit('toggleLoading', false); + return response.data; + }, function (response) { + commit('toggleLoading', false); + commit('restApiNotWorking', true); + return response.data; + }); +}; + +var disconnectOptimole = function disconnectOptimole(_ref3, data) { + var commit = _ref3.commit, + state = _ref3.state; + + commit('toggleLoading', true, 'loading'); + _vue2.default.http({ + url: optimoleDashboardApp.root + '/disconnect', + method: 'GET', + headers: { 'X-WP-Nonce': optimoleDashboardApp.nonce }, + params: { 'req': data.req }, + emulateJSON: true, + responseType: 'json' + }).then(function (response) { + commit('updateUserData', null); + commit('toggleLoading', false); + commit('updateApiKey', ''); + if (response.ok) { + commit('toggleConnectedToOptml', false); + console.log('%c Disconnected from OptiMole API.', 'color: #59B278'); + } else { + console.error(response); + } + }); +}; + +var saveSettings = function saveSettings(_ref4, data) { + var commit = _ref4.commit, + state = _ref4.state; + + commit('updateSettings', data.settings); + commit('toggleLoading', true); + return _vue2.default.http({ + url: optimoleDashboardApp.root + '/update_option', + method: 'POST', + headers: { 'X-WP-Nonce': optimoleDashboardApp.nonce }, + emulateJSON: true, + body: { + 'settings': data.settings + }, + responseType: 'json' + }).then(function (response) { + if (response.body.code === 'success') { + commit('updateSettings', response.body.data); + } + commit('toggleLoading', false); + }); +}; +var sampleRate = function sampleRate(_ref5, data) { + var commit = _ref5.commit, + state = _ref5.state; + + + data.component.loading_images = true; + return _vue2.default.http({ + url: optimoleDashboardApp.root + '/images-sample-rate', + method: 'POST', + emulateJSON: true, + headers: { 'X-WP-Nonce': optimoleDashboardApp.nonce }, + params: { + 'quality': data.quality, + 'force': data.force + }, + responseType: 'json' + }).then(function (response) { + + data.component.loading_images = false; + if (response.body.code === 'success') { + commit('updateSampleRate', response.body.data); + } + }); +}; + +var retrieveOptimizedImages = function retrieveOptimizedImages(_ref6, data) { + var commit = _ref6.commit, + state = _ref6.state; + + var self = this; + + setTimeout(function () { + + if (self.state.optimizedImages.length > 0) { + console.log('%c Images already exsist.', 'color: #59B278'); + return false; + } + _vue2.default.http({ + url: optimoleDashboardApp.root + '/poll_optimized_images', + method: 'GET', + emulateJSON: true, + headers: { 'X-WP-Nonce': optimoleDashboardApp.nonce }, + params: { 'req': 'Get Optimized Images' }, + responseType: 'json', + timeout: 10000 + }).then(function (response) { + if (response.body.code === 'success') { + commit('updateOptimizedImages', response); + if (data.component !== null) { + data.component.loading = false; + data.component.startTime = data.component.maxTime; + if (response.body.data.length === 0) { + data.component.noImages = true; + } + } + console.log('%c Images Fetched.', 'color: #59B278'); + } else { + component.noImages = true; + data.component.loading = false; + console.log('%c No images available.', 'color: #E7602A'); + } + }); + }, data.waitTime); +}; + +exports.default = { + connectOptimole: connectOptimole, + registerOptimole: registerOptimole, + disconnectOptimole: disconnectOptimole, + saveSettings: saveSettings, + sampleRate: sampleRate, + retrieveOptimizedImages: retrieveOptimizedImages +}; + +/***/ }), +/* 52 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); +/* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "install", function() { return install; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ResizeObserver", function() { return ResizeObserver; }); +function getInternetExplorerVersion() { + var ua = window.navigator.userAgent; + + var msie = ua.indexOf('MSIE '); + if (msie > 0) { + // IE 10 or older => return version number + return parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10); + } + + var trident = ua.indexOf('Trident/'); + if (trident > 0) { + // IE 11 => return version number + var rv = ua.indexOf('rv:'); + return parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10); + } + + var edge = ua.indexOf('Edge/'); + if (edge > 0) { + // Edge (IE 12+) => return version number + return parseInt(ua.substring(edge + 5, ua.indexOf('.', edge)), 10); + } + + // other browser + return -1; +} + +var isIE = void 0; + +function initCompat() { + if (!initCompat.init) { + initCompat.init = true; + isIE = getInternetExplorerVersion() !== -1; + } +} + +var ResizeObserver = { render: function render() { + var _vm = this;var _h = _vm.$createElement;var _c = _vm._self._c || _h;return _c('div', { staticClass: "resize-observer", attrs: { "tabindex": "-1" } }); + }, staticRenderFns: [], _scopeId: 'data-v-b329ee4c', + name: 'resize-observer', + + methods: { + notify: function notify() { + this.$emit('notify'); + }, + addResizeHandlers: function addResizeHandlers() { + this._resizeObject.contentDocument.defaultView.addEventListener('resize', this.notify); + if (this._w !== this.$el.offsetWidth || this._h !== this.$el.offsetHeight) { + this.notify(); + } + }, + removeResizeHandlers: function removeResizeHandlers() { + if (this._resizeObject && this._resizeObject.onload) { + if (!isIE && this._resizeObject.contentDocument) { + this._resizeObject.contentDocument.defaultView.removeEventListener('resize', this.notify); + } + delete this._resizeObject.onload; + } + } + }, + + mounted: function mounted() { + var _this = this; + + initCompat(); + this.$nextTick(function () { + _this._w = _this.$el.offsetWidth; + _this._h = _this.$el.offsetHeight; + }); + var object = document.createElement('object'); + this._resizeObject = object; + object.setAttribute('style', 'display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; pointer-events: none; z-index: -1;'); + object.setAttribute('aria-hidden', 'true'); + object.setAttribute('tabindex', -1); + object.onload = this.addResizeHandlers; + object.type = 'text/html'; + if (isIE) { + this.$el.appendChild(object); + } + object.data = 'about:blank'; + if (!isIE) { + this.$el.appendChild(object); + } + }, + beforeDestroy: function beforeDestroy() { + this.removeResizeHandlers(); + } +}; + +// Install the components +function install(Vue) { + Vue.component('resize-observer', ResizeObserver); + /* -- Add more components here -- */ +} + +/* -- Plugin definition & Auto-install -- */ +/* You shouldn't have to modify the code below */ + +// Plugin +var plugin = { + // eslint-disable-next-line no-undef + version: "0.4.4", + install: install +}; + +// Auto-install +var GlobalVue = null; +if (typeof window !== 'undefined') { + GlobalVue = window.Vue; +} else if (typeof global !== 'undefined') { + GlobalVue = global.Vue; +} +if (GlobalVue) { + GlobalVue.use(plugin); +} + + +/* harmony default export */ __webpack_exports__["default"] = (plugin); + +/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(3))) + +/***/ }), +/* 53 */ +/***/ (function(module, exports, __webpack_require__) { + +(function webpackUniversalModuleDefinition(root, factory) { + if(true) + module.exports = factory(__webpack_require__(2)); + else if(typeof define === 'function' && define.amd) + define(["vue"], factory); + else if(typeof exports === 'object') + exports["vue-js-toggle-button"] = factory(require("vue")); + else + root["vue-js-toggle-button"] = factory(root["vue"]); +})(this, function(__WEBPACK_EXTERNAL_MODULE_1__) { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // identity function for calling harmony imports with the correct context +/******/ __webpack_require__.i = function(value) { return value; }; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = "/dist/"; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 3); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports, __webpack_require__) { + + +/* styles */ +__webpack_require__(8) + +var Component = __webpack_require__(6)( + /* script */ + __webpack_require__(2), + /* template */ + __webpack_require__(7), + /* scopeId */ + "data-v-25adc6c0", + /* cssModules */ + null +) + +module.exports = Component.exports + + +/***/ }), +/* 1 */ +/***/ (function(module, exports) { + +module.exports = __WEBPACK_EXTERNAL_MODULE_1__; + +/***/ }), +/* 2 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// + +var constants = { + colorChecked: '#75C791', + colorUnchecked: '#bfcbd9', + cssColors: false, + labelChecked: 'on', + labelUnchecked: 'off', + width: 50, + height: 22, + margin: 3, + switchColor: '#fff' +}; + +var contains = function contains(object, title) { + return (typeof object === 'undefined' ? 'undefined' : _typeof(object)) === 'object' && object.hasOwnProperty(title); +}; + +var px = function px(v) { + return v + 'px'; +}; + +/* harmony default export */ __webpack_exports__["default"] = ({ + name: 'ToggleButton', + props: { + value: { + type: Boolean, + default: false + }, + disabled: { + type: Boolean, + default: false + }, + name: { + type: String + }, + sync: { + type: Boolean, + default: false + }, + speed: { + type: Number, + default: 300 + }, + color: { + type: [String, Object], + validator: function validator(value) { + return (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' ? value.checked || value.unchecked : typeof value === 'string'; + } + }, + switchColor: { + type: [String, Object], + validator: function validator(value) { + return (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' ? value.checked || value.unchecked : typeof value === 'string'; + } + }, + cssColors: { + type: Boolean, + default: false + }, + labels: { + type: [Boolean, Object], + default: false, + validator: function validator(value) { + return (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' ? value.checked || value.unchecked : typeof value === 'boolean'; + } + }, + height: { + type: Number, + default: constants.height + }, + width: { + type: Number, + default: constants.width + } + }, + computed: { + className: function className() { + var toggled = this.toggled, + disabled = this.disabled; + + + return ['vue-js-switch', { toggled: toggled, disabled: disabled }]; + }, + ariaChecked: function ariaChecked() { + return this.toggled.toString(); + }, + coreStyle: function coreStyle() { + return { + width: px(this.width), + height: px(this.height), + backgroundColor: this.cssColors ? null : this.disabled ? this.colorDisabled : this.colorCurrent, + borderRadius: px(Math.round(this.height / 2)) + }; + }, + buttonRadius: function buttonRadius() { + return this.height - constants.margin * 2; + }, + distance: function distance() { + return px(this.width - this.height + constants.margin); + }, + buttonStyle: function buttonStyle() { + return { + width: px(this.buttonRadius), + height: px(this.buttonRadius), + transition: 'transform ' + this.speed + 'ms', + transform: this.toggled ? 'translate3d(' + this.distance + ', 3px, 0px)' : null, + background: this.switchColor ? this.switchColorCurrent : undefined + }; + }, + labelStyle: function labelStyle() { + return { + lineHeight: px(this.height) + }; + }, + colorChecked: function colorChecked() { + var color = this.color; + + + if ((typeof color === 'undefined' ? 'undefined' : _typeof(color)) !== 'object') { + return color || constants.colorChecked; + } + + return contains(color, 'checked') ? color.checked : constants.colorChecked; + }, + colorUnchecked: function colorUnchecked() { + var color = this.color; + + + return contains(color, 'unchecked') ? color.unchecked : constants.colorUnchecked; + }, + colorDisabled: function colorDisabled() { + var color = this.color; + + + return contains(color, 'disabled') ? color.disabled : this.colorCurrent; + }, + colorCurrent: function colorCurrent() { + return this.toggled ? this.colorChecked : this.colorUnchecked; + }, + labelChecked: function labelChecked() { + return contains(this.labels, 'checked') ? this.labels.checked : constants.labelChecked; + }, + labelUnchecked: function labelUnchecked() { + return contains(this.labels, 'unchecked') ? this.labels.unchecked : constants.labelUnchecked; + }, + switchColorChecked: function switchColorChecked() { + var switchColor = this.switchColor; + + + return contains(switchColor, 'checked') ? switchColor.checked : constants.switchColor; + }, + switchColorUnchecked: function switchColorUnchecked() { + var switchColor = this.switchColor; + + + return contains(switchColor, 'unchecked') ? switchColor.unchecked : constants.switchColor; + }, + switchColorCurrent: function switchColorCurrent() { + var switchColor = this.switchColor; + + + if ((typeof switchColor === 'undefined' ? 'undefined' : _typeof(switchColor)) !== 'object') { + return switchColor || constants.switchColor; + } + + return this.toggled ? this.switchColorChecked : this.switchColorUnchecked; + } + }, + watch: { + value: function value(_value) { + if (this.sync) { + this.toggled = !!_value; + } + } + }, + data: function data() { + return { + toggled: !!this.value + }; + }, + + methods: { + toggle: function toggle(event) { + this.toggled = !this.toggled; + this.$emit('input', this.toggled); + this.$emit('change', { + value: this.toggled, + srcEvent: event + }); + } + } +}); + +/***/ }), +/* 3 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue__ = __webpack_require__(1); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_vue__); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Button_vue__ = __webpack_require__(0); +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Button_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__Button_vue__); + + + +var plugin = { + install: function install(Vue, options) { + Vue.component('ToggleButton', __WEBPACK_IMPORTED_MODULE_1__Button_vue___default.a); + } +}; + +/* harmony default export */ __webpack_exports__["default"] = (plugin); + +/***/ }), +/* 4 */ +/***/ (function(module, exports, __webpack_require__) { + +exports = module.exports = __webpack_require__(5)(); +// imports + + +// module +exports.push([module.i, ".vue-js-switch[data-v-25adc6c0]{display:inline-block;position:relative;overflow:hidden;vertical-align:middle;user-select:none;font-size:10px;cursor:pointer}.vue-js-switch .v-switch-input[data-v-25adc6c0]{display:none}.vue-js-switch .v-switch-label[data-v-25adc6c0]{position:absolute;top:0;font-weight:600;color:#fff}.vue-js-switch .v-switch-label.v-left[data-v-25adc6c0]{left:10px}.vue-js-switch .v-switch-label.v-right[data-v-25adc6c0]{right:10px}.vue-js-switch .v-switch-core[data-v-25adc6c0]{display:block;position:relative;box-sizing:border-box;outline:0;margin:0;transition:border-color .3s,background-color .3s;user-select:none}.vue-js-switch .v-switch-core .v-switch-button[data-v-25adc6c0]{display:block;position:absolute;overflow:hidden;top:0;left:0;transform:translate3d(3px,3px,0);border-radius:100%;background-color:#fff}.vue-js-switch.disabled[data-v-25adc6c0]{pointer-events:none;opacity:.6}", ""]); + +// exports + + +/***/ }), +/* 5 */ +/***/ (function(module, exports) { + +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +// css base code, injected by the css-loader +module.exports = function() { + var list = []; + + // return the list of modules as css string + list.toString = function toString() { + var result = []; + for(var i = 0; i < this.length; i++) { + var item = this[i]; + if(item[2]) { + result.push("@media " + item[2] + "{" + item[1] + "}"); + } else { + result.push(item[1]); + } + } + return result.join(""); + }; + + // import a list of modules into the list + list.i = function(modules, mediaQuery) { + if(typeof modules === "string") + modules = [[null, modules, ""]]; + var alreadyImportedModules = {}; + for(var i = 0; i < this.length; i++) { + var id = this[i][0]; + if(typeof id === "number") + alreadyImportedModules[id] = true; + } + for(i = 0; i < modules.length; i++) { + var item = modules[i]; + // skip already imported module + // this implementation is not 100% perfect for weird media query combinations + // when a module is imported multiple times with different media queries. + // I hope this will never occur (Hey this way we have smaller bundles) + if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) { + if(mediaQuery && !item[2]) { + item[2] = mediaQuery; + } else if(mediaQuery) { + item[2] = "(" + item[2] + ") and (" + mediaQuery + ")"; + } + list.push(item); + } + } + }; + return list; +}; + + +/***/ }), +/* 6 */ +/***/ (function(module, exports) { + +// this module is a runtime utility for cleaner component module output and will +// be included in the final webpack user bundle + +module.exports = function normalizeComponent ( + rawScriptExports, + compiledTemplate, + scopeId, + cssModules +) { + var esModule + var scriptExports = rawScriptExports = rawScriptExports || {} + + // ES6 modules interop + var type = typeof rawScriptExports.default + if (type === 'object' || type === 'function') { + esModule = rawScriptExports + scriptExports = rawScriptExports.default + } + + // Vue.extend constructor export interop + var options = typeof scriptExports === 'function' + ? scriptExports.options + : scriptExports + + // render functions + if (compiledTemplate) { + options.render = compiledTemplate.render + options.staticRenderFns = compiledTemplate.staticRenderFns + } + + // scopedId + if (scopeId) { + options._scopeId = scopeId + } + + // inject cssModules + if (cssModules) { + var computed = Object.create(options.computed || null) + Object.keys(cssModules).forEach(function (key) { + var module = cssModules[key] + computed[key] = function () { return module } + }) + options.computed = computed + } + + return { + esModule: esModule, + exports: scriptExports, + options: options + } +} + + +/***/ }), +/* 7 */ +/***/ (function(module, exports) { + +module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h; + return _c('label', { + class: _vm.className, + attrs: { + "role": "checkbox", + "aria-checked": _vm.ariaChecked + } + }, [_c('input', { + staticClass: "v-switch-input", + attrs: { + "type": "checkbox", + "name": _vm.name + }, + on: { + "change": function($event) { + $event.stopPropagation(); + return _vm.toggle($event) + } + } + }), _vm._v(" "), _c('div', { + staticClass: "v-switch-core", + style: (_vm.coreStyle) + }, [_c('div', { + staticClass: "v-switch-button", + style: (_vm.buttonStyle) + })]), _vm._v(" "), (_vm.labels) ? [(_vm.toggled) ? _c('span', { + staticClass: "v-switch-label v-left", + style: (_vm.labelStyle), + domProps: { + "innerHTML": _vm._s(_vm.labelChecked) + } + }) : _c('span', { + staticClass: "v-switch-label v-right", + style: (_vm.labelStyle), + domProps: { + "innerHTML": _vm._s(_vm.labelUnchecked) + } + })] : _vm._e()], 2) +},staticRenderFns: []} + +/***/ }), +/* 8 */ +/***/ (function(module, exports, __webpack_require__) { + +// style-loader: Adds some css to the DOM by adding a + +}; // // // - // - -}; /***/ }), /* 14 */ @@ -15258,7 +15271,7 @@ module.exports = "\n\t
\n\t\t\n\t\t
\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
0\" v-html=\"strings.notice_just_activated\">
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t
\n\t\t
\n\t\t\n\t\t\n\t
\n"; +module.exports = "\n\t
\n\t\t\n\t\t
\n\t\t\t
\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t
0\" v-html=\"strings.notice_just_activated\">
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t
\n\t\t
\n\t\t\n\t\t\n\t
\n"; /***/ }), /* 47 */ @@ -15310,7 +15323,8 @@ var store = new _vuex2.default.Store({ sample_rate: {}, apiError: false, userData: optimoleDashboardApp.user_data ? optimoleDashboardApp.user_data : null, - optimizedImages: [] + optimizedImages: [], + watermarks: [] }, mutations: _mutations2.default, actions: _actions2.default @@ -16494,7 +16508,6 @@ var retrieveOptimizedImages = function retrieveOptimizedImages(_ref6, data) { var self = this; setTimeout(function () { - if (self.state.optimizedImages.length > 0) { console.log('%c Images already exsist.', 'color: #59B278'); return false; @@ -16527,13 +16540,62 @@ var retrieveOptimizedImages = function retrieveOptimizedImages(_ref6, data) { }, data.waitTime); }; +var retrieveWatermarks = function retrieveWatermarks(_ref7, data) { + var commit = _ref7.commit, + state = _ref7.state; + + var self = this; + _vue2.default.http({ + url: optimoleDashboardApp.root + '/poll_watermarks', + method: 'GET', + headers: { 'X-WP-Nonce': optimoleDashboardApp.nonce }, + params: { 'req': 'Get Watermarks' }, + responseType: 'json' + }).then(function (response) { + if (response.status === 200) { + data.component.watermarkData = []; + for (var row in response.data.data) { + var tmp = response.data.data[row]; + var item = { + ID: tmp.ID, + post_title: tmp.post_title, + post_mime_type: tmp.post_mime_type, + guid: tmp.post_content || tmp.guid + }; + data.component.watermarkData.push(item); + data.component.noImages = false; + } + } + }); +}; + +var removeWatermark = function removeWatermark(_ref8, data) { + var commit = _ref8.commit, + state = _ref8.state; + + var self = this; + data.component.loading = true; + _vue2.default.http({ + url: optimoleDashboardApp.root + '/remove_watermark', + method: 'POST', + headers: { 'X-WP-Nonce': optimoleDashboardApp.nonce }, + params: { 'req': 'Get Watermarks', 'postID': data.postID }, + responseType: 'json' + }).then(function (response) { + data.component.loading = false; + retrieveWatermarks({ commit: commit, state: state }, data); + }); +}; + exports.default = { connectOptimole: connectOptimole, registerOptimole: registerOptimole, disconnectOptimole: disconnectOptimole, saveSettings: saveSettings, sampleRate: sampleRate, - retrieveOptimizedImages: retrieveOptimizedImages + retrieveOptimizedImages: retrieveOptimizedImages, + retrieveWatermarks: retrieveWatermarks, + removeWatermark: removeWatermark }; /***/ }), @@ -17465,5 +17527,2347 @@ module.exports = function listToStyles (parentId, list) { }); //# sourceMappingURL=index.js.map +/***/ }), +/* 54 */ +/***/ (function(module, exports, __webpack_require__) { + +var __vue_script__, __vue_template__ +__webpack_require__(55) +__vue_script__ = __webpack_require__(57) +__vue_template__ = __webpack_require__(58) +module.exports = __vue_script__ || {} +if (module.exports.__esModule) module.exports = module.exports.default +if (__vue_template__) { (typeof module.exports === "function" ? module.exports.options : module.exports).template = __vue_template__ } +if (false) {(function () { module.hot.accept() + var hotAPI = require("vue-hot-reload-api") + hotAPI.install(require("vue"), true) + if (!hotAPI.compatible) return + var id = "/var/www/html/wp-minions/wp-content/plugins/optimole-wp/assets/vue/components/watermarks.vue" + if (!module.hot.data) { + hotAPI.createRecord(id, module.exports) + } else { + hotAPI.update(id, module.exports, __vue_template__) + } +})()} + +/***/ }), +/* 55 */ +/***/ (function(module, exports, __webpack_require__) { + +// style-loader: Adds some css to the DOM by adding a + +}; // +// +// + + \ No newline at end of file diff --git a/assets/vue/store/actions.js b/assets/vue/store/actions.js index f7aedd5d..176f0031 100644 --- a/assets/vue/store/actions.js +++ b/assets/vue/store/actions.js @@ -22,7 +22,7 @@ const connectOptimole = function ( {commit, state}, data ) { } ).then( function ( response ) { - commit( 'toggleConnecting', false ); + commit( 'toggleConnecting', false ); if ( response.body.code === 'success' ) { commit( 'toggleKeyValidity', true ); commit( 'toggleConnectedToOptml', true ); @@ -36,8 +36,8 @@ const connectOptimole = function ( {commit, state}, data ) { } }, function () { - commit( 'toggleConnecting', false ); - commit( 'restApiNotWorking', true ); + commit( 'toggleConnecting', false ); + commit( 'restApiNotWorking', true ); } ); }; @@ -60,13 +60,13 @@ const registerOptimole = function ( {commit, state}, data ) { } ).then( function ( response ) { - commit( 'toggleLoading', false ); - return response.data; + commit( 'toggleLoading', false ); + return response.data; }, function ( response ) { - commit( 'toggleLoading', false ); - commit( 'restApiNotWorking', true ); - return response.data; + commit( 'toggleLoading', false ); + commit( 'restApiNotWorking', true ); + return response.data; } ); }; @@ -85,9 +85,9 @@ const disconnectOptimole = function ( {commit, state}, data ) { } ).then( function ( response ) { - commit( 'updateUserData', null ); - commit( 'toggleLoading', false ); - commit( 'updateApiKey', '' ); + commit( 'updateUserData', null ); + commit( 'toggleLoading', false ); + commit( 'updateApiKey', '' ); if ( response.ok ) { commit( 'toggleConnectedToOptml', false ); console.log( '%c Disconnected from OptiMole API.', 'color: #59B278' ); @@ -117,7 +117,7 @@ const saveSettings = function ( {commit, state}, data ) { if ( response.body.code === 'success' ) { commit( 'updateSettings', response.body.data ); } - commit( 'toggleLoading', false ); + commit( 'toggleLoading', false ); } ); @@ -140,7 +140,7 @@ const sampleRate = function ( {commit, state}, data ) { ).then( function ( response ) { - data.component.loading_images = false; + data.component.loading_images = false; if ( response.body.code === 'success' ) { commit( 'updateSampleRate', response.body.data ); } @@ -153,45 +153,85 @@ const retrieveOptimizedImages = function ( {commit, state}, data ) { setTimeout( function () { - if ( self.state.optimizedImages.length > 0 ) { console.log( '%c Images already exsist.', 'color: #59B278' ); return false; } - Vue.http( - { - url: optimoleDashboardApp.root + '/poll_optimized_images', - method: 'GET', - emulateJSON: true, - headers: {'X-WP-Nonce': optimoleDashboardApp.nonce}, - params: {'req': 'Get Optimized Images'}, - responseType: 'json', - timeout: 10000 - } - ).then( - function ( response ) { - if ( response.body.code === 'success' ) { + Vue.http( + { + url: optimoleDashboardApp.root + '/poll_optimized_images', + method: 'GET', + emulateJSON: true, + headers: {'X-WP-Nonce': optimoleDashboardApp.nonce}, + params: {'req': 'Get Optimized Images'}, + responseType: 'json', + timeout: 10000 + } + ).then( + function ( response ) { + if ( response.body.code === 'success' ) { commit( 'updateOptimizedImages', response ); - if ( data.component !== null ) { - data.component.loading = false; - data.component.startTime = data.component.maxTime; - if ( response.body.data.length === 0 ) { + if ( data.component !== null ) { + data.component.loading = false; + data.component.startTime = data.component.maxTime; + if ( response.body.data.length === 0 ) { data.component.noImages = true; - } } - console.log( '%c Images Fetched.', 'color: #59B278' ); - } else { + } + console.log( '%c Images Fetched.', 'color: #59B278' ); + } else { component.noImages = true; data.component.loading = false; console.log( '%c No images available.', 'color: #E7602A' ); - } } - ); + } + ); }, data.waitTime ); }; +const retrieveWatermarks = function ( {commit, state}, data ) { + let self = this; + Vue.http( { + url: optimoleDashboardApp.root + '/poll_watermarks', + method: 'GET', + headers: {'X-WP-Nonce': optimoleDashboardApp.nonce}, + params: {'req': 'Get Watermarks'}, + responseType: 'json', + } ).then( function ( response ) { + if( response.status === 200 ) { + data.component.watermarkData = []; + for( let row in response.data.data ) { + let tmp = response.data.data[row]; + let item = { + ID: tmp.ID, + post_title: tmp.post_title, + post_mime_type: tmp.post_mime_type, + guid: tmp.post_content || tmp.guid, + } + data.component.watermarkData.push( item ) + data.component.noImages = false; + } + } + } ); +}; + +const removeWatermark = function ( {commit, state}, data ) { + let self = this; + data.component.loading = true + Vue.http( { + url: optimoleDashboardApp.root + '/remove_watermark', + method: 'POST', + headers: {'X-WP-Nonce': optimoleDashboardApp.nonce}, + params: {'req': 'Get Watermarks' , 'postID': data.postID }, + responseType: 'json', + } ).then( function ( response ) { + data.component.loading = false; + retrieveWatermarks( {commit, state}, data ); + } ); +}; + export default { connectOptimole, registerOptimole, @@ -199,4 +239,6 @@ export default { saveSettings, sampleRate, retrieveOptimizedImages, + retrieveWatermarks, + removeWatermark }; diff --git a/assets/vue/store/store.js b/assets/vue/store/store.js index b9a2a9d3..553f4ac4 100644 --- a/assets/vue/store/store.js +++ b/assets/vue/store/store.js @@ -23,9 +23,10 @@ const store = new Vuex.Store( apiError: false, userData: optimoleDashboardApp.user_data ? optimoleDashboardApp.user_data : null, optimizedImages: [], + watermarks: [], }, - mutations, - actions + mutations, + actions } ); diff --git a/inc/admin.php b/inc/admin.php index 12a412fd..ad15feb8 100644 --- a/inc/admin.php +++ b/inc/admin.php @@ -443,6 +443,7 @@ private function get_dashboard_strings() { ), 'dashboard_menu_item' => __( 'Dashboard', 'optimole-wp' ), 'settings_menu_item' => __( 'Settings', 'optimole-wp' ), + 'watermarks_menu_item' => __( 'Watermarks', 'optimole-wp' ), 'options_strings' => array( 'toggle_ab_item' => __( 'Admin bar status', 'optimole-wp' ), 'toggle_lazyload' => __( 'Javascript replacement & Lazy load', 'optimole-wp' ), @@ -472,6 +473,15 @@ private function get_dashboard_strings() { 'admin_bar_desc' => __( 'Show in the WordPress admin bar the available quota from Optimole service.', 'optimole-wp' ), 'lazyload_desc' => __( 'We will generate images size based on your visitor\'s screen using javascript and render them without blocking the page execution via lazyload.', 'optimole-wp' ), ), + 'watermarks' => array( + 'image' => __( 'Image', 'optimole-wp' ), + 'id' => __( 'ID', 'optimole-wp' ), + 'name' => __( 'Name', 'optimole-wp' ), + 'type' => __( 'Type', 'optimole-wp' ), + 'action' => __( 'Action', 'optimole-wp' ), + 'upload' => __( 'Upload', 'optimole-wp' ), + 'add_desc' => __( 'Add new watermark', 'optimole-wp' ), + ), 'latest_images' => array( 'image' => __( 'Image', 'optimole-wp' ), 'no_images_found' => sprintf( __( 'We might have a delay finding optimized images. Meanwhile you can visit your %1$shomepage%2$s and check how our plugin performs. ', 'optimole-wp' ), '', '' ), diff --git a/inc/api.php b/inc/api.php index 73d6e1a1..4e8ac914 100644 --- a/inc/api.php +++ b/inc/api.php @@ -15,7 +15,7 @@ final class Optml_Api { * @var string Api root. */ private $api_root = 'https://dashboard.optimole.com/api/optml/v1/'; - // private $api_root = 'http://localhost:8000/api/optml/v1/'; + /** * Hold the user api key. * @@ -155,6 +155,72 @@ public function get_optimized_images( $api_key = '' ) { return $this->request( '/stats/images' ); } + /** + * Get the watermarks from API. + * + * @param string $api_key The API key. + * + * @return array|bool + */ + public function get_watermarks( $api_key = '' ) { + if ( ! empty( $api_key ) ) { + $this->api_key = $api_key; + } + return $this->request( '/settings/watermark' ); + } + + /** + * Remove the watermark from the API. + * + * @param integer $post_id The watermark post ID. + * @param string $api_key The API key. + * + * @return array|bool + */ + public function remove_watermark( $post_id, $api_key = '' ) { + if ( ! empty( $api_key ) ) { + $this->api_key = $api_key; + } + return $this->request( '/settings/watermark', 'DELETE', array( 'watermark' => $post_id ) ); + } + + /** + * Add watermark. + * + * @param array $file The file to be uploaded. + * @param string $api_key The API key. + * + * @return array|bool|mixed|object + */ + public function add_watermark( $file, $api_key = '' ) { + if ( ! empty( $api_key ) ) { + $this->api_key = $api_key; + } + // Grab the url to which we'll be making the request. + $url = str_replace( 'optml/v1/', 'wp/v2/', $this->api_root ) . 'media'; + $headers = array( + 'Optml-Site' => get_site_url(), + ); + if ( ! empty( $this->api_key ) ) { + $headers['Authorization'] = 'Bearer ' . $this->api_key; + $headers['Content-Disposition'] = 'attachment; filename=' . $file['file']['name']; + } + $args = array( + 'url' => $url, + 'method' => 'POST', + 'timeout' => 45, + 'user-agent' => 'Optimle WP (v' . OPTML_VERSION . ') ', + 'sslverify' => false, + 'headers' => $headers, + 'body' => file_get_contents( $file['file']['tmp_name'] ), + ); + $response = wp_remote_request( $url, $args ); + if ( is_wp_error( $response ) ) { + return false; + } + return json_decode( wp_remote_retrieve_body( $response ), true ); + } + /** * Throw error on object clone * diff --git a/inc/rest.php b/inc/rest.php index 53de61a1..28e721f0 100644 --- a/inc/rest.php +++ b/inc/rest.php @@ -50,6 +50,7 @@ public function register() { ); $this->register_image_routes(); + $this->register_watermark_routes(); } /** @@ -141,6 +142,51 @@ public function register_image_routes() { ); } + /** + * Method to register watermark specific routes. + */ + public function register_watermark_routes() { + register_rest_route( + $this->namespace, + '/poll_watermarks', + array( + array( + 'methods' => \WP_REST_Server::READABLE, + 'permission_callback' => function () { + return current_user_can( 'manage_options' ); + }, + 'callback' => array( $this, 'poll_watermarks' ), + ), + ) + ); + register_rest_route( + $this->namespace, + '/add_watermark', + array( + array( + 'methods' => \WP_REST_Server::CREATABLE, + 'permission_callback' => function () { + return current_user_can( 'manage_options' ); + }, + 'callback' => array( $this, 'add_watermark' ), + ), + ) + ); + register_rest_route( + $this->namespace, + '/remove_watermark', + array( + array( + 'methods' => \WP_REST_Server::CREATABLE, + 'permission_callback' => function () { + return current_user_can( 'manage_options' ); + }, + 'callback' => array( $this, 'remove_watermark' ), + ), + ) + ); + } + /** * Connect to optimole service. * @@ -322,6 +368,52 @@ public function poll_optimized_images( WP_REST_Request $request ) { return $this->response( $final_images ); } + /** + * Get watermarks from API. + * + * @param WP_REST_Request $request rest request. + * + * @return WP_REST_Response + */ + public function poll_watermarks( WP_REST_Request $request ) { + $api_key = $request->get_param( 'api_key' ); + $request = new Optml_Api(); + $watermarks = $request->get_watermarks( $api_key ); + if ( ! isset( $watermarks['watermarks'] ) || empty( $watermarks['watermarks'] ) ) { + return $this->response( array() ); + } + $final_images = array_splice( $watermarks['watermarks'], 0, 10 ); + return $this->response( $final_images ); + } + + /** + * Add watermark. + * + * @param WP_REST_Request $request rest request. + * + * @return WP_REST_Response + */ + public function add_watermark( WP_REST_Request $request ) { + $file = $request->get_file_params(); + $api_key = $request->get_param( 'api_key' ); + $request = new Optml_Api(); + return $this->response( $request->add_watermark( $file, $api_key ) ); + } + + /** + * Remove watermark. + * + * @param WP_REST_Request $request rest request. + * + * @return WP_REST_Response + */ + public function remove_watermark( WP_REST_Request $request ) { + $post_id = $request->get_param( 'postID' ); + $api_key = $request->get_param( 'api_key' ); + $request = new Optml_Api(); + return $this->response( $request->remove_watermark( $post_id, $api_key ) ); + } + /** * Update options method. * diff --git a/package.json b/package.json index 494fdd55..f92e97f8 100644 --- a/package.json +++ b/package.json @@ -79,6 +79,7 @@ "vue-js-toggle-button": "^1.2.3", "vue-resize": "^0.4.4", "vue-resource": "^1.3.4", + "vue-upload-component": "^2.8.16", "vuex": "^2.4.0", "y": "^0.3.2" } diff --git a/tests/test-replacer.php b/tests/test-replacer.php index 4595b62f..41b83dc3 100644 --- a/tests/test-replacer.php +++ b/tests/test-replacer.php @@ -109,16 +109,16 @@ public function test_elementor_data() { $this->assertNotContains( "https:\/\/www.codeinwp.com\/wp-content", $replaced_content ); } -// public function test_max_size_height() { -// $new_url = Optml_Url_Replacer::instance()->build_image_url( 'http://example.org/wp-content/themes/test/assets/images/header.png', [ -// 'width' => 99999, -// 'height' => 99999 -// ] ); -// $this->assertContains( 'i.optimole.com', $new_url ); -// //Test if wrong extension is still present in the output. -// $this->assertNotContains( '99999', $new_url ); -// -// } + public function test_max_size_height() { + $new_url = Optml_Manager::instance()->replace_content( 'http://example.org/wp-content/themes/test/assets/images/header.png', [ + 'width' => 99999, + 'height' => 99999 + ] ); + $this->assertContains( 'i.optimole.com', $new_url ); + //Test if wrong extension is still present in the output. + $this->assertNotContains( '99999', $new_url ); + + } // public function test_post_content() { $content = apply_filters( 'the_content', get_post_field( 'post_content', self::$sample_post ) ); @@ -156,4 +156,29 @@ public function test_custom_domain() { } + public function test_filter_sizes_attr() { + + global $wp_current_filter; + $wp_current_filter = array( 'the_content' ); + + $sizes = array( + 'width' => 1000, + 'height' => 1000 + ); + $response = apply_filters( 'wp_calculate_image_sizes', $sizes, array( 10000 ) ); + $this->assertContains('(max-width: 1000px) 100vw, 1000px', $response); + $wp_current_filter = array(); + $response = apply_filters( 'wp_calculate_image_sizes', $sizes, array( 10000 ) ); + $this->assertTrue( ! empty( $response ) ); + $this->assertTrue( is_array( $response ) ); + + global $content_width; + $content_width = 5000; + $response = apply_filters( 'wp_calculate_image_sizes', $sizes, array( 1 ) ); + $this->assertTrue( ! empty( $response ) ); + $this->assertTrue( is_array( $response ) ); + + var_dump( $response ); + } + } \ No newline at end of file From ab4669871fa63b1f7332c29c61bacbddd667c35d Mon Sep 17 00:00:00 2001 From: Bogdan Preda Date: Fri, 21 Dec 2018 11:56:46 +0200 Subject: [PATCH 29/36] chore: migrated watermark settings from branch --- assets/js/bundle.min.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 assets/js/bundle.min.js diff --git a/assets/js/bundle.min.js b/assets/js/bundle.min.js new file mode 100644 index 00000000..88935cc7 --- /dev/null +++ b/assets/js/bundle.min.js @@ -0,0 +1,21 @@ +!function(t){function e(o){if(n[o])return n[o].exports;var i=n[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};e.m=t,e.c=n,e.d=function(t,n,o){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:o})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/",e(e.s=6)}([function(t,e){t.exports=function(){var t=[];return t.toString=function(){for(var t=[],e=0;e=0&&g.splice(e,1)}function r(t){var e=document.createElement("style");return e.type="text/css",i(t,e),e}function p(t){var e=document.createElement("link");return e.rel="stylesheet",i(t,e),e}function s(t,e){var n,o,i;if(e.singleton){var s=v++;n=b||(b=r(e)),o=l.bind(null,n,s,!1),i=l.bind(null,n,s,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=p(e),o=d.bind(null,n),i=function(){a(n),n.href&&URL.revokeObjectURL(n.href)}):(n=r(e),o=c.bind(null,n),i=function(){a(n)});return o(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;o(t=e)}else i()}}function l(t,e,n,o){var i=n?"":o.css;if(t.styleSheet)t.styleSheet.cssText=x(e,i);else{var a=document.createTextNode(i),r=t.childNodes;r[e]&&t.removeChild(r[e]),r.length?t.insertBefore(a,r[e]):t.appendChild(a)}}function c(t,e){var n=e.css,o=e.media;if(o&&t.setAttribute("media",o),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}function d(t,e){var n=e.css,o=e.sourceMap;o&&(n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var i=new Blob([n],{type:"text/css"}),a=t.href;t.href=URL.createObjectURL(i),a&&URL.revokeObjectURL(a)}var m={},f=function(t){var e;return function(){return void 0===e&&(e=t.apply(this,arguments)),e}},u=f(function(){return/msie [6-9]\b/.test(self.navigator.userAgent.toLowerCase())}),h=f(function(){return document.head||document.getElementsByTagName("head")[0]}),b=null,v=0,g=[];t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");e=e||{},void 0===e.singleton&&(e.singleton=u()),void 0===e.insertAt&&(e.insertAt="bottom");var i=o(t);return n(i,e),function(t){for(var a=[],r=0;r=0&&Math.floor(e)===e&&isFinite(t)}function m(t){return null==t?"":"object"==typeof t?JSON.stringify(t,null,2):String(t)}function f(t){var e=parseFloat(t);return isNaN(e)?t:e}function u(t,e){for(var n=Object.create(null),o=t.split(","),i=0;i-1)return t.splice(n,1)}}function b(t,e){return da.call(t,e)}function v(t){var e=Object.create(null);return function(n){return e[n]||(e[n]=t(n))}}function g(t,e){function n(n){var o=arguments.length;return o?o>1?t.apply(e,arguments):t.call(e,n):t.call(e)}return n._length=t.length,n}function x(t,e){return t.bind(e)}function w(t,e){e=e||0;for(var n=t.length-e,o=new Array(n);n--;)o[n]=t[n+e];return o}function y(t,e){for(var n in e)t[n]=e[n];return t}function k(t){for(var e={},n=0;n-1)if(a&&!b(i,"default"))r=!1;else if(""===r||r===ba(t)){var s=nt(String,i.type);(s<0||p0&&(r=xt(r,(e||"")+"_"+n),gt(r[0])&>(l)&&(c[s]=D(l.text+r[0].text),r.shift()),c.push.apply(c,r)):p(r)?gt(l)?c[s]=D(l.text+r):""!==r&&c.push(D(r)):gt(r)&>(l)?c[s]=D(l.text+r.text):(a(t._isVList)&&i(r.tag)&&o(r.key)&&i(e)&&(r.key="__vlist"+e+"_"+n+"__"),c.push(r)));return c}function wt(t,e){return(t.__esModule||Ba&&"Module"===t[Symbol.toStringTag])&&(t=t.default),s(t)?e.extend(t):t}function yt(t,e,n,o,i){var a=Va();return a.asyncFactory=t,a.asyncMeta={data:e,context:n,children:o,tag:i},a}function kt(t,e,n){if(a(t.error)&&i(t.errorComp))return t.errorComp;if(i(t.resolved))return t.resolved;if(a(t.loading)&&i(t.loadingComp))return t.loadingComp;if(!i(t.contexts)){var r=t.contexts=[n],p=!0,l=function(){for(var t=0,e=r.length;txr&&ur[n].id>t.id;)n--;ur.splice(n+1,0,t)}else ur.push(t);vr||(vr=!0,st(Rt))}}function Wt(t,e,n){kr.get=function(){return this[e][n]},kr.set=function(t){this[e][n]=t},Object.defineProperty(t,n,kr)}function Kt(t){t._watchers=[];var e=t.$options;e.props&&Gt(t,e.props),e.methods&&Zt(t,e.methods),e.data?Vt(t):L(t._data={},!0),e.computed&&Xt(t,e.computed),e.watch&&e.watch!==Ia&&te(t,e.watch)}function Gt(t,e){var n=t.$options.propsData||{},o=t._props={},i=t.$options._propKeys=[];!t.$parent||P(!1);for(var a in e)!function(a){i.push(a);var r=Y(a,e,n,t);F(o,a,r),a in t||Wt(t,"_props",a)}(a);P(!0)}function Vt(t){var e=t.$options.data;e=t._data="function"==typeof e?Jt(e,t):e||{},l(e)||(e={});for(var n=Object.keys(e),o=t.$options.props,i=(t.$options.methods,n.length);i--;){var a=n[i];o&&b(o,a)||j(a)||Wt(t,"_data",a)}L(e,!0)}function Jt(t,e){S();try{return t.call(e,e)}catch(t){return ot(t,e,"data()"),{}}finally{E()}}function Xt(t,e){var n=t._computedWatchers=Object.create(null),o=Fa();for(var i in e){var a=e[i],r="function"==typeof a?a:a.get;o||(n[i]=new yr(t,r||_,_,_r)),i in t||Qt(t,i,a)}}function Qt(t,e,n){var o=!Fa();"function"==typeof n?(kr.get=o?Yt(e):n,kr.set=_):(kr.get=n.get?o&&!1!==n.cache?Yt(e):n.get:_,kr.set=n.set?n.set:_),Object.defineProperty(t,e,kr)}function Yt(t){return function(){var e=this._computedWatchers&&this._computedWatchers[t];if(e)return e.dirty&&e.evaluate(),Ha.target&&e.depend(),e.value}}function Zt(t,e){t.$options.props;for(var n in e)t[n]=null==e[n]?_:va(e[n],t)}function te(t,e){for(var n in e){var o=e[n];if(Array.isArray(o))for(var i=0;i=0||n.indexOf(t[i])<0)&&o.push(t[i]);return o}return t}function Ie(t){this._init(t)}function Pe(t){t.use=function(t){var e=this._installedPlugins||(this._installedPlugins=[]);if(e.indexOf(t)>-1)return this;var n=w(arguments,1);return n.unshift(this),"function"==typeof t.install?t.install.apply(t,n):"function"==typeof t&&t.apply(null,n),e.push(t),this}}function Me(t){t.mixin=function(t){return this.options=X(this.options,t),this}}function Ne(t){t.cid=0;var e=1;t.extend=function(t){t=t||{};var n=this,o=n.cid,i=t._Ctor||(t._Ctor={});if(i[o])return i[o];var a=t.name||n.options.name,r=function(t){this._init(t)};return r.prototype=Object.create(n.prototype),r.prototype.constructor=r,r.cid=e++,r.options=X(n.options,t),r.super=n,r.options.props&&Le(r),r.options.computed&&Fe(r),r.extend=n.extend,r.mixin=n.mixin,r.use=n.use,ya.forEach(function(t){r[t]=n[t]}),a&&(r.options.components[a]=r),r.superOptions=n.options,r.extendOptions=t,r.sealedOptions=y({},r.options),i[o]=r,r}}function Le(t){var e=t.options.props;for(var n in e)Wt(t.prototype,"_props",n)}function Fe(t){var e=t.options.computed;for(var n in e)Qt(t.prototype,n,e[n])}function Re(t){ya.forEach(function(e){t[e]=function(t,n){return n?("component"===e&&l(n)&&(n.name=n.name||t,n=this.options._base.extend(n)),"directive"===e&&"function"==typeof n&&(n={bind:n,update:n}),this.options[e+"s"][t]=n,n):this.options[e+"s"][t]}})}function Be(t){return t&&(t.Ctor.options.name||t.tag)}function Ue(t,e){return Array.isArray(t)?t.indexOf(e)>-1:"string"==typeof t?t.split(",").indexOf(e)>-1:!!c(t)&&t.test(e)}function qe(t,e){var n=t.cache,o=t.keys,i=t._vnode;for(var a in n){var r=n[a];if(r){var p=Be(r.componentOptions);p&&!e(p)&&He(n,a,o,i)}}}function He(t,e,n,o){var i=t[e];!i||o&&i.tag===o.tag||i.componentInstance.$destroy(),t[e]=null,h(n,e)}function We(t){for(var e=t.data,n=t,o=t;i(o.componentInstance);)(o=o.componentInstance._vnode)&&o.data&&(e=Ke(o.data,e));for(;i(n=n.parent);)n&&n.data&&(e=Ke(e,n.data));return Ge(e.staticClass,e.class)}function Ke(t,e){return{staticClass:Ve(t.staticClass,e.staticClass),class:i(t.class)?[t.class,e.class]:e.class}}function Ge(t,e){return i(t)||i(e)?Ve(t,Je(e)):""}function Ve(t,e){return t?e?t+" "+e:t:e||""}function Je(t){return Array.isArray(t)?Xe(t):s(t)?Qe(t):"string"==typeof t?t:""}function Xe(t){for(var e,n="",o=0,a=t.length;o-1?ep[t]=e.constructor===window.HTMLUnknownElement||e.constructor===window.HTMLElement:ep[t]=/HTMLUnknownElement/.test(e.toString())}function tn(t){if("string"==typeof t){var e=document.querySelector(t);return e||document.createElement("div")}return t}function en(t,e){var n=document.createElement(t);return"select"!==t?n:(e.data&&e.data.attrs&&void 0!==e.data.attrs.multiple&&n.setAttribute("multiple","multiple"),n)}function nn(t,e){return document.createElementNS(Xr[t],e)}function on(t){return document.createTextNode(t)}function an(t){return document.createComment(t)}function rn(t,e,n){t.insertBefore(e,n)}function pn(t,e){t.removeChild(e)}function sn(t,e){t.appendChild(e)}function ln(t){return t.parentNode}function cn(t){return t.nextSibling}function dn(t){return t.tagName}function mn(t,e){t.textContent=e}function fn(t,e){t.setAttribute(e,"")}function un(t,e){var n=t.data.ref;if(i(n)){var o=t.context,a=t.componentInstance||t.elm,r=o.$refs;e?Array.isArray(r[n])?h(r[n],a):r[n]===a&&(r[n]=void 0):t.data.refInFor?Array.isArray(r[n])?r[n].indexOf(a)<0&&r[n].push(a):r[n]=[a]:r[n]=a}}function hn(t,e){return t.key===e.key&&(t.tag===e.tag&&t.isComment===e.isComment&&i(t.data)===i(e.data)&&bn(t,e)||a(t.isAsyncPlaceholder)&&t.asyncFactory===e.asyncFactory&&o(e.asyncFactory.error))}function bn(t,e){if("input"!==t.tag)return!0;var n,o=i(n=t.data)&&i(n=n.attrs)&&n.type,a=i(n=e.data)&&i(n=n.attrs)&&n.type;return o===a||np(o)&&np(a)}function vn(t,e,n){var o,a,r={};for(o=e;o<=n;++o)a=t[o].key,i(a)&&(r[a]=o);return r}function gn(t,e){(t.data.directives||e.data.directives)&&xn(t,e)}function xn(t,e){var n,o,i,a=t===ap,r=e===ap,p=wn(t.data.directives,t.context),s=wn(e.data.directives,e.context),l=[],c=[];for(n in s)o=p[n],i=s[n],o?(i.oldValue=o.value,kn(i,"update",e,t),i.def&&i.def.componentUpdated&&c.push(i)):(kn(i,"bind",e,t),i.def&&i.def.inserted&&l.push(i));if(l.length){var d=function(){for(var n=0;n-1?zn(t,e,n):Wr(e)?Jr(n)?t.removeAttribute(e):(n="allowfullscreen"===e&&"EMBED"===t.tagName?"true":e,t.setAttribute(e,n)):Hr(e)?t.setAttribute(e,Jr(n)||"false"===n?"false":"true"):Gr(e)?Jr(n)?t.removeAttributeNS(Kr,Vr(e)):t.setAttributeNS(Kr,e,n):zn(t,e,n)}function zn(t,e,n){if(Jr(n))t.removeAttribute(e);else{if(Ta&&!Sa&&"TEXTAREA"===t.tagName&&"placeholder"===e&&!t.__ieph){var o=function(e){e.stopImmediatePropagation(),t.removeEventListener("input",o)};t.addEventListener("input",o),t.__ieph=!0}t.setAttribute(e,n)}}function $n(t,e){var n=e.elm,a=e.data,r=t.data;if(!(o(a.staticClass)&&o(a.class)&&(o(r)||o(r.staticClass)&&o(r.class)))){var p=We(e),s=n._transitionClasses;i(s)&&(p=Ve(p,Je(s))),p!==n._prevClass&&(n.setAttribute("class",p),n._prevClass=p)}}function jn(t){function e(){(r||(r=[])).push(t.slice(u,i).trim()),u=i+1}var n,o,i,a,r,p=!1,s=!1,l=!1,c=!1,d=0,m=0,f=0,u=0;for(i=0;i=0&&" "===(b=t.charAt(h));h--);b&&mp.test(b)||(c=!0)}}else void 0===a?(u=i+1,a=t.slice(0,i).trim()):e();if(void 0===a?a=t.slice(0,i).trim():0!==u&&e(),r)for(i=0;i-1?{exp:t.slice(0,Pr),key:'"'+t.slice(Pr+1)+'"'}:{exp:t,key:null};for(Dr=t,Pr=Mr=Nr=0;!Un();)Ir=Bn(),qn(Ir)?Wn(Ir):91===Ir&&Hn(Ir);return{exp:t.slice(0,Mr),key:t.slice(Mr+1,Nr)}}function Bn(){return Dr.charCodeAt(++Pr)}function Un(){return Pr>=Er}function qn(t){return 34===t||39===t}function Hn(t){var e=1;for(Mr=Pr;!Un();)if(t=Bn(),qn(t))Wn(t);else if(91===t&&e++,93===t&&e--,0===e){Nr=Pr;break}}function Wn(t){for(var e=t;!Un()&&(t=Bn())!==e;);}function Kn(t,e,n){Lr=n;var o=e.value,i=e.modifiers,a=t.tag,r=t.attrsMap.type;if(t.component)return Ln(t,o,i),!1;if("select"===a)Jn(t,o,i);else if("input"===a&&"checkbox"===r)Gn(t,o,i);else if("input"===a&&"radio"===r)Vn(t,o,i);else if("input"===a||"textarea"===a)Xn(t,o,i);else if(!_a.isReservedTag(a))return Ln(t,o,i),!1;return!0}function Gn(t,e,n){var o=n&&n.number,i=Mn(t,"value")||"null",a=Mn(t,"true-value")||"true",r=Mn(t,"false-value")||"false";Sn(t,"checked","Array.isArray("+e+")?_i("+e+","+i+")>-1"+("true"===a?":("+e+")":":_q("+e+","+a+")")),Pn(t,"change","var $$a="+e+",$$el=$event.target,$$c=$$el.checked?("+a+"):("+r+");if(Array.isArray($$a)){var $$v="+(o?"_n("+i+")":i)+",$$i=_i($$a,$$v);if($$el.checked){$$i<0&&("+Fn(e,"$$a.concat([$$v])")+")}else{$$i>-1&&("+Fn(e,"$$a.slice(0,$$i).concat($$a.slice($$i+1))")+")}}else{"+Fn(e,"$$c")+"}",null,!0)}function Vn(t,e,n){var o=n&&n.number,i=Mn(t,"value")||"null";i=o?"_n("+i+")":i,Sn(t,"checked","_q("+e+","+i+")"),Pn(t,"change",Fn(e,i),null,!0)}function Jn(t,e,n){var o=n&&n.number,i='Array.prototype.filter.call($event.target.options,function(o){return o.selected}).map(function(o){var val = "_value" in o ? o._value : o.value;return '+(o?"_n(val)":"val")+"})",a="var $$selectedVal = "+i+";";a=a+" "+Fn(e,"$event.target.multiple ? $$selectedVal : $$selectedVal[0]"),Pn(t,"change",a,null,!0)}function Xn(t,e,n){var o=t.attrsMap.type,i=n||{},a=i.lazy,r=i.number,p=i.trim,s=!a&&"range"!==o,l=a?"change":"range"===o?fp:"input",c="$event.target.value";p&&(c="$event.target.value.trim()"),r&&(c="_n("+c+")");var d=Fn(e,c);s&&(d="if($event.target.composing)return;"+d),Sn(t,"value","("+e+")"),Pn(t,l,d,null,!0),(p||r)&&Pn(t,"blur","$forceUpdate()")}function Qn(t){if(i(t[fp])){var e=Ta?"change":"input";t[e]=[].concat(t[fp],t[e]||[]),delete t[fp]}i(t[up])&&(t.change=[].concat(t[up],t.change||[]),delete t[up])}function Yn(t,e,n){var o=Fr;return function i(){null!==t.apply(null,arguments)&&to(e,i,n,o)}}function Zn(t,e,n,o,i){e=pt(e),n&&(e=Yn(e,t,o)),Fr.addEventListener(t,e,Pa?{capture:o,passive:i}:o)}function to(t,e,n,o){(o||Fr).removeEventListener(t,e._withTask||e,n)}function eo(t,e){if(!o(t.data.on)||!o(e.data.on)){var n=e.data.on||{},i=t.data.on||{};Fr=e.elm,Qn(n),mt(n,i,Zn,to,e.context),Fr=void 0}}function no(t,e){if(!o(t.data.domProps)||!o(e.data.domProps)){var n,a,r=e.elm,p=t.data.domProps||{},s=e.data.domProps||{};i(s.__ob__)&&(s=e.data.domProps=y({},s));for(n in p)o(s[n])&&(r[n]="");for(n in s){if(a=s[n],"textContent"===n||"innerHTML"===n){if(e.children&&(e.children.length=0),a===p[n])continue;1===r.childNodes.length&&r.removeChild(r.childNodes[0])}if("value"===n){r._value=a;var l=o(a)?"":String(a);oo(r,l)&&(r.value=l)}else r[n]=a}}}function oo(t,e){return!t.composing&&("OPTION"===t.tagName||io(t,e)||ao(t,e))}function io(t,e){var n=!0;try{n=document.activeElement!==t}catch(t){}return n&&t.value!==e}function ao(t,e){var n=t.value,o=t._vModifiers;if(i(o)){if(o.lazy)return!1;if(o.number)return f(n)!==f(e);if(o.trim)return n.trim()!==e.trim()}return n!==e}function ro(t){var e=po(t.style);return t.staticStyle?y(t.staticStyle,e):e}function po(t){return Array.isArray(t)?k(t):"string"==typeof t?vp(t):t}function so(t,e){var n,o={};if(e)for(var i=t;i.componentInstance;)(i=i.componentInstance._vnode)&&i.data&&(n=ro(i.data))&&y(o,n);(n=ro(t.data))&&y(o,n);for(var a=t;a=a.parent;)a.data&&(n=ro(a.data))&&y(o,n);return o}function lo(t,e){var n=e.data,a=t.data;if(!(o(n.staticStyle)&&o(n.style)&&o(a.staticStyle)&&o(a.style))){var r,p,s=e.elm,l=a.staticStyle,c=a.normalizedStyle||a.style||{},d=l||c,m=po(e.data.style)||{};e.data.normalizedStyle=i(m.__ob__)?y({},m):m;var f=so(e,!0);for(p in d)o(f[p])&&wp(s,p,"");for(p in f)(r=f[p])!==d[p]&&wp(s,p,null==r?"":r)}}function co(t,e){if(e&&(e=e.trim()))if(t.classList)e.indexOf(" ")>-1?e.split(/\s+/).forEach(function(e){return t.classList.add(e)}):t.classList.add(e);else{var n=" "+(t.getAttribute("class")||"")+" ";n.indexOf(" "+e+" ")<0&&t.setAttribute("class",(n+e).trim())}}function mo(t,e){if(e&&(e=e.trim()))if(t.classList)e.indexOf(" ")>-1?e.split(/\s+/).forEach(function(e){return t.classList.remove(e)}):t.classList.remove(e),t.classList.length||t.removeAttribute("class");else{for(var n=" "+(t.getAttribute("class")||"")+" ",o=" "+e+" ";n.indexOf(o)>=0;)n=n.replace(o," ");n=n.trim(),n?t.setAttribute("class",n):t.removeAttribute("class")}}function fo(t){if(t){if("object"==typeof t){var e={};return!1!==t.css&&y(e,Cp(t.name||"v")),y(e,t),e}return"string"==typeof t?Cp(t):void 0}}function uo(t){Ep(function(){Ep(t)})}function ho(t,e){var n=t._transitionClasses||(t._transitionClasses=[]);n.indexOf(e)<0&&(n.push(e),co(t,e))}function bo(t,e){t._transitionClasses&&h(t._transitionClasses,e),mo(t,e)}function vo(t,e,n){var o=go(t,e),i=o.type,a=o.timeout,r=o.propCount;if(!i)return n();var p=i===$p?Ap:Sp,s=0,l=function(){t.removeEventListener(p,c),n()},c=function(e){e.target===t&&++s>=r&&l()};setTimeout(function(){s0&&(n=$p,c=r,d=a.length):e===jp?l>0&&(n=jp,c=l,d=s.length):(c=Math.max(r,l),n=c>0?r>l?$p:jp:null,d=n?n===$p?a.length:s.length:0),{type:n,timeout:c,propCount:d,hasTransform:n===$p&&Dp.test(o[Op+"Property"])}}function xo(t,e){for(;t.length1}function zo(t,e){!0!==e.data.show&&yo(e)}function $o(t,e,n){jo(t,e,n),(Ta||Ea)&&setTimeout(function(){jo(t,e,n)},0)}function jo(t,e,n){var o=e.value,i=t.multiple;if(!i||Array.isArray(o)){for(var a,r,p=0,s=t.options.length;p-1,r.selected!==a&&(r.selected=a);else if(C(Ao(r),o))return void(t.selectedIndex!==p&&(t.selectedIndex=p));i||(t.selectedIndex=-1)}}function Oo(t,e){return e.every(function(e){return!C(e,t)})}function Ao(t){return"_value"in t?t._value:t.value}function To(t){t.target.composing=!0}function So(t){t.target.composing&&(t.target.composing=!1,Eo(t.target,"input"))}function Eo(t,e){var n=document.createEvent("HTMLEvents");n.initEvent(e,!0,!0),t.dispatchEvent(n)}function Do(t){return!t.componentInstance||t.data&&t.data.transition?t:Do(t.componentInstance._vnode)}function Io(t){var e=t&&t.componentOptions;return e&&e.Ctor.options.abstract?Io(Ct(e.children)):t}function Po(t){var e={},n=t.$options;for(var o in n.propsData)e[o]=t[o];var i=n._parentListeners;for(var a in i)e[fa(a)]=i[a];return e}function Mo(t,e){if(/\d-keep-alive$/.test(e.tag))return t("keep-alive",{props:e.componentOptions.propsData})}function No(t){for(;t=t.parent;)if(t.data.transition)return!0}function Lo(t,e){return e.key===t.key&&e.tag===t.tag}function Fo(t){t.elm._moveCb&&t.elm._moveCb(),t.elm._enterCb&&t.elm._enterCb()}function Ro(t){t.data.newPos=t.elm.getBoundingClientRect()}function Bo(t){var e=t.data.pos,n=t.data.newPos,o=e.left-n.left,i=e.top-n.top;if(o||i){t.data.moved=!0;var a=t.elm.style;a.transform=a.WebkitTransform="translate("+o+"px,"+i+"px)",a.transitionDuration="0s"}}function Uo(t,e){var n=e?Jp(e):Gp;if(n.test(t)){for(var o,i,a,r=[],p=[],s=n.lastIndex=0;o=n.exec(t);){i=o.index,i>s&&(p.push(a=t.slice(s,i)),r.push(JSON.stringify(a)));var l=jn(o[1].trim());r.push("_s("+l+")"),p.push({"@binding":l}),s=i+o[0].length}return s=0&&r[i].lowerCasedTag!==p;i--);else i=0;if(i>=0){for(var s=r.length-1;s>=i;s--)e.end&&e.end(r[s].tag,n,o);r.length=i,a=i&&r[i-1].tag}else"br"===p?e.start&&e.start(t,[],!0,n,o):"p"===p&&(e.start&&e.start(t,[],!1,n,o),e.end&&e.end(t,n,o))}for(var i,a,r=[],p=e.expectHTML,s=e.isUnaryTag||ga,l=e.canBeLeftOpenTag||ga,c=0;t;){if(i=t,a&&_s(a)){var d=0,m=a.toLowerCase(),f=Cs[m]||(Cs[m]=new RegExp("([\\s\\S]*?)(]*>)","i")),u=t.replace(f,function(t,n,o){return d=o.length,_s(m)||"noscript"===m||(n=n.replace(//g,"$1").replace(//g,"$1")),As(m,n)&&(n=n.slice(1)),e.chars&&e.chars(n),""});c+=t.length-u.length,t=u,o(m,c-d,c)}else{var h=t.indexOf("<");if(0===h){if(ls.test(t)){var b=t.indexOf("--\x3e");if(b>=0){e.shouldKeepComment&&e.comment(t.substring(4,b)),n(b+3);continue}}if(cs.test(t)){var v=t.indexOf("]>");if(v>=0){n(v+2);continue}}var g=t.match(ss);if(g){n(g[0].length);continue}var x=t.match(ps);if(x){var w=c;n(x[0].length),o(x[1],w,c);continue}var y=function(){var e=t.match(as);if(e){var o={tagName:e[1],attrs:[],start:c};n(e[0].length);for(var i,a;!(i=t.match(rs))&&(a=t.match(ns));)n(a[0].length),o.attrs.push(a);if(i)return o.unarySlash=i[1],n(i[0].length),o.end=c,o}}();if(y){!function(t){var n=t.tagName,i=t.unarySlash;p&&("p"===a&&es(n)&&o(a),l(n)&&a===n&&o(n));for(var c=s(n)||!!i,d=t.attrs.length,m=new Array(d),f=0;f=0){for(_=t.slice(h);!(ps.test(_)||as.test(_)||ls.test(_)||cs.test(_)||(C=_.indexOf("<",1))<0);)h+=C,_=t.slice(h);k=t.substring(0,h),n(h)}h<0&&(k=t,t=""),e.chars&&k&&e.chars(k)}if(t===i){e.chars&&e.chars(t);break}}o()}function Jo(t,e,n){return{type:1,tag:t,attrsList:e,attrsMap:ui(e),parent:n,children:[]}}function Xo(t,e){function n(t){t.pre&&(p=!1),vs(t.tag)&&(s=!1);for(var n=0;n':'
',ks.innerHTML.indexOf(" ")>0}function ra(t){if(t.outerHTML)return t.outerHTML;var e=document.createElement("div");return e.appendChild(t.cloneNode(!0)),e.innerHTML}/*! + * Vue.js v2.5.17 + * (c) 2014-2018 Evan You + * Released under the MIT License. + */ +var pa=Object.freeze({}),sa=Object.prototype.toString,la=u("slot,component",!0),ca=u("key,ref,slot,slot-scope,is"),da=Object.prototype.hasOwnProperty,ma=/-(\w)/g,fa=v(function(t){return t.replace(ma,function(t,e){return e?e.toUpperCase():""})}),ua=v(function(t){return t.charAt(0).toUpperCase()+t.slice(1)}),ha=/\B([A-Z])/g,ba=v(function(t){return t.replace(ha,"-$1").toLowerCase()}),va=Function.prototype.bind?x:g,ga=function(t,e,n){return!1},xa=function(t){return t},wa="data-server-rendered",ya=["component","directive","filter"],ka=["beforeCreate","created","beforeMount","mounted","beforeUpdate","updated","beforeDestroy","destroyed","activated","deactivated","errorCaptured"],_a={optionMergeStrategies:Object.create(null),silent:!1,productionTip:!1,devtools:!1,performance:!1,errorHandler:null,warnHandler:null,ignoredElements:[],keyCodes:Object.create(null),isReservedTag:ga,isReservedAttr:ga,isUnknownElement:ga,getTagNamespace:_,parsePlatformTagName:xa,mustUseProp:ga,_lifecycleHooks:ka},Ca=/[^\w.$]/,za="__proto__"in{},$a="undefined"!=typeof window,ja="undefined"!=typeof WXEnvironment&&!!WXEnvironment.platform,Oa=ja&&WXEnvironment.platform.toLowerCase(),Aa=$a&&window.navigator.userAgent.toLowerCase(),Ta=Aa&&/msie|trident/.test(Aa),Sa=Aa&&Aa.indexOf("msie 9.0")>0,Ea=Aa&&Aa.indexOf("edge/")>0,Da=(Aa&&Aa.indexOf("android"),Aa&&/iphone|ipad|ipod|ios/.test(Aa)||"ios"===Oa),Ia=(Aa&&/chrome\/\d+/.test(Aa),{}.watch),Pa=!1;if($a)try{var Ma={};Object.defineProperty(Ma,"passive",{get:function(){Pa=!0}}),window.addEventListener("test-passive",null,Ma)}catch(t){}var Na,La,Fa=function(){return void 0===Na&&(Na=!$a&&!ja&&void 0!==t&&"server"===t.process.env.VUE_ENV),Na},Ra=$a&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__,Ba="undefined"!=typeof Symbol&&T(Symbol)&&"undefined"!=typeof Reflect&&T(Reflect.ownKeys);La="undefined"!=typeof Set&&T(Set)?Set:function(){function t(){this.set=Object.create(null)}return t.prototype.has=function(t){return!0===this.set[t]},t.prototype.add=function(t){this.set[t]=!0},t.prototype.clear=function(){this.set=Object.create(null)},t}();var Ua=_,qa=0,Ha=function(){this.id=qa++,this.subs=[]};Ha.prototype.addSub=function(t){this.subs.push(t)},Ha.prototype.removeSub=function(t){h(this.subs,t)},Ha.prototype.depend=function(){Ha.target&&Ha.target.addDep(this)},Ha.prototype.notify=function(){for(var t=this.subs.slice(),e=0,n=t.length;e1?w(n):n;for(var o=w(arguments,1),i=0,a=n.length;iparseInt(this.max)&&He(s,l[0],l,this._vnode)),e.data.keepAlive=!0}return e||t&&t[0]}},Sr={KeepAlive:Tr};!function(t){var e={};e.get=function(){return _a},Object.defineProperty(t,"config",e),t.util={warn:Ua,extend:y,mergeOptions:X,defineReactive:F},t.set=R,t.delete=B,t.nextTick=st,t.options=Object.create(null),ya.forEach(function(e){t.options[e+"s"]=Object.create(null)}),t.options._base=t,y(t.options.components,Sr),Pe(t),Me(t),Ne(t),Re(t)}(Ie),Object.defineProperty(Ie.prototype,"$isServer",{get:Fa}),Object.defineProperty(Ie.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(Ie,"FunctionalRenderContext",{value:ve}),Ie.version="2.5.17";var Er,Dr,Ir,Pr,Mr,Nr,Lr,Fr,Rr,Br=u("style,class"),Ur=u("input,textarea,option,select,progress"),qr=function(t,e,n){return"value"===n&&Ur(t)&&"button"!==e||"selected"===n&&"option"===t||"checked"===n&&"input"===t||"muted"===n&&"video"===t},Hr=u("contenteditable,draggable,spellcheck"),Wr=u("allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,translate,truespeed,typemustmatch,visible"),Kr="http://www.w3.org/1999/xlink",Gr=function(t){return":"===t.charAt(5)&&"xlink"===t.slice(0,5)},Vr=function(t){return Gr(t)?t.slice(6,t.length):""},Jr=function(t){return null==t||!1===t},Xr={svg:"http://www.w3.org/2000/svg",math:"http://www.w3.org/1998/Math/MathML"},Qr=u("html,body,base,head,link,meta,style,title,address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,menuitem,summary,content,element,shadow,template,blockquote,iframe,tfoot"),Yr=u("svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view",!0),Zr=function(t){return"pre"===t},tp=function(t){return Qr(t)||Yr(t)},ep=Object.create(null),np=u("text,number,password,search,email,tel,url"),op=Object.freeze({createElement:en,createElementNS:nn,createTextNode:on,createComment:an,insertBefore:rn,removeChild:pn,appendChild:sn,parentNode:ln,nextSibling:cn,tagName:dn,setTextContent:mn,setStyleScope:fn}),ip={create:function(t,e){un(e)},update:function(t,e){t.data.ref!==e.data.ref&&(un(t,!0),un(e))},destroy:function(t){un(t,!0)}},ap=new Ka("",{},[]),rp=["create","activate","update","remove","destroy"],pp={create:gn,update:gn,destroy:function(t){gn(t,ap)}},sp=Object.create(null),lp=[ip,pp],cp={create:_n,update:_n},dp={create:$n,update:$n},mp=/[\w).+\-_$\]]/,fp="__r",up="__c",hp={create:eo,update:eo},bp={create:no,update:no},vp=v(function(t){var e={},n=/;(?![^(]*\))/g,o=/:(.+)/;return t.split(n).forEach(function(t){if(t){var n=t.split(o);n.length>1&&(e[n[0].trim()]=n[1].trim())}}),e}),gp=/^--/,xp=/\s*!important$/,wp=function(t,e,n){if(gp.test(e))t.style.setProperty(e,n);else if(xp.test(n))t.style.setProperty(e,n.replace(xp,""),"important");else{var o=kp(e);if(Array.isArray(n))for(var i=0,a=n.length;iu?(d=o(n[v+1])?null:n[v+1].elm,g(t,d,n,f,v,a)):f>v&&w(t,e,m,u)}function _(t,e,n,o){for(var a=n;a\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,os="[a-zA-Z_][\\w\\-\\.]*",is="((?:"+os+"\\:)?"+os+")",as=new RegExp("^<"+is),rs=/^\s*(\/?)>/,ps=new RegExp("^<\\/"+is+"[^>]*>"),ss=/^]+>/i,ls=/^",""":'"',"&":"&"," ":"\n"," ":"\t"},$s=/&(?:lt|gt|quot|amp);/g,js=/&(?:lt|gt|quot|amp|#10|#9);/g,Os=u("pre,textarea",!0),As=function(t,e){return t&&Os(t)&&"\n"===e[0]},Ts=/^@|^v-on:/,Ss=/^v-|^@|^:/,Es=/([^]*?)\s+(?:in|of)\s+([^]*)/,Ds=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,Is=/^\(|\)$/g,Ps=/:(.*)$/,Ms=/^:|^v-bind:/,Ns=/\.[^.]+/g,Ls=v(Yp.decode),Fs=/^xmlns:NS\d+/,Rs=/^NS\d+:/,Bs={preTransformNode:gi},Us=[Xp,Qp,Bs],qs={model:Kn,text:wi,html:yi},Hs={expectHTML:!0,modules:Us,directives:qs,isPreTag:Zr,isUnaryTag:Zp,mustUseProp:qr,canBeLeftOpenTag:ts,isReservedTag:tp,getTagNamespace:Ye,staticKeys:function(t){return t.reduce(function(t,e){return t.concat(e.staticKeys||[])},[]).join(",")}(Us)},Ws=v(_i),Ks=/^([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/,Gs=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/,Vs={esc:27,tab:9,enter:13,space:32,up:38,left:37,right:39,down:40,delete:[8,46]},Js={esc:"Escape",tab:"Tab",enter:"Enter",space:" ",up:["Up","ArrowUp"],left:["Left","ArrowLeft"],right:["Right","ArrowRight"],down:["Down","ArrowDown"],delete:["Backspace","Delete"]},Xs=function(t){return"if("+t+")return null;"},Qs={stop:"$event.stopPropagation();",prevent:"$event.preventDefault();",self:Xs("$event.target !== $event.currentTarget"),ctrl:Xs("!$event.ctrlKey"),shift:Xs("!$event.shiftKey"),alt:Xs("!$event.altKey"),meta:Xs("!$event.metaKey"),left:Xs("'button' in $event && $event.button !== 0"),middle:Xs("'button' in $event && $event.button !== 1"),right:Xs("'button' in $event && $event.button !== 2")},Ys={on:Ei,bind:Di,cloak:_},Zs=function(t){this.options=t,this.warn=t.warn||An,this.transforms=Tn(t.modules,"transformCode"),this.dataGenFns=Tn(t.modules,"genData"),this.directives=y(y({},Ys),t.directives);var e=t.isReservedTag||ga;this.maybeComponent=function(t){return!e(t.tag)},this.onceId=0,this.staticRenderFns=[]},tl=(new RegExp("\\b"+"do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,super,throw,while,yield,delete,export,import,return,switch,default,extends,finally,continue,debugger,function,arguments".split(",").join("\\b|\\b")+"\\b"),new RegExp("\\b"+"delete,typeof,void".split(",").join("\\s*\\([^\\)]*\\)|\\b")+"\\s*\\([^\\)]*\\)"),function(t){return function(e){function n(n,o){var i=Object.create(e),a=[],r=[];if(i.warn=function(t,e){(e?r:a).push(t)},o){o.modules&&(i.modules=(e.modules||[]).concat(o.modules)),o.directives&&(i.directives=y(Object.create(e.directives||null),o.directives));for(var p in o)"modules"!==p&&"directives"!==p&&(i[p]=o[p])}var s=t(n,i);return s.errors=a,s.tips=r,s}return{compile:n,compileToFunctions:ia(n)}}}(function(t,e){var n=Xo(t.trim(),e);!1!==e.optimize&&ki(n,e);var o=Ii(n,e);return{ast:n,render:o.render,staticRenderFns:o.staticRenderFns}})),el=tl(Hs),nl=el.compileToFunctions,ol=!!$a&&aa(!1),il=!!$a&&aa(!0),al=v(function(t){var e=tn(t);return e&&e.innerHTML}),rl=Ie.prototype.$mount;Ie.prototype.$mount=function(t,e){if((t=t&&tn(t))===document.body||t===document.documentElement)return this;var n=this.$options;if(!n.render){var o=n.template;if(o)if("string"==typeof o)"#"===o.charAt(0)&&(o=al(o));else{if(!o.nodeType)return this;o=o.innerHTML}else t&&(o=ra(t));if(o){var i=nl(o,{shouldDecodeNewlines:ol,shouldDecodeNewlinesForHref:il,delimiters:n.delimiters,comments:n.comments},this),a=i.render,r=i.staticRenderFns;n.render=a,n.staticRenderFns=r}}return rl.call(this,t,e)},Ie.compile=nl,e.default=Ie}.call(e,n(3),n(7).setImmediate)},function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){var o,i;o=n(28),i=n(29),t.exports=o||{},t.exports.__esModule&&(t.exports=t.exports.default),i&&(("function"==typeof t.exports?t.exports.options:t.exports).template=i)},function(t,e,n){"use strict";function o(t){this.state=pt,this.value=void 0,this.deferred=[];var e=this;try{t(function(t){e.resolve(t)},function(t){e.reject(t)})}catch(t){e.reject(t)}}function i(t,e){t instanceof Promise?this.promise=t:this.promise=new Promise(t.bind(e)),this.context=e}function a(t){var e=t.config,n=t.nextTick;ct=n,ht=e.debug||!e.silent}function r(t){"undefined"!=typeof console&&ht&&console.warn("[VueResource warn]: "+t)}function p(t){"undefined"!=typeof console&&console.error(t)}function s(t,e){return ct(t,e)}function l(t){return t?t.replace(/^\s*|\s*$/g,""):""}function c(t,e){return t&&void 0===e?t.replace(/\s+$/,""):t&&e?t.replace(new RegExp("["+e+"]+$"),""):t}function d(t){return t?t.toLowerCase():""}function m(t){return t?t.toUpperCase():""}function f(t){return"string"==typeof t}function u(t){return"function"==typeof t}function h(t){return null!==t&&"object"==typeof t}function b(t){return h(t)&&Object.getPrototypeOf(t)==Object.prototype}function v(t){return"undefined"!=typeof Blob&&t instanceof Blob}function g(t){return"undefined"!=typeof FormData&&t instanceof FormData}function x(t,e,n){var o=i.resolve(t);return arguments.length<2?o:o.then(e,n)}function w(t,e,n){return n=n||{},u(n)&&(n=n.call(e)),k(t.bind({$vm:e,$options:n}),t,{$options:n})}function y(t,e){var n,o;if(vt(t))for(n=0;n=200&&i<300,this.status=i||0,this.statusText=a||"",this.headers=new wt(o),this.body=t,f(t)?this.bodyText=t:v(t)&&(this.bodyBlob=t,nt(t)&&(this.bodyText=et(t)))};yt.prototype.blob=function(){return x(this.bodyBlob)},yt.prototype.text=function(){return x(this.bodyText)},yt.prototype.json=function(){return x(this.text(),function(t){return JSON.parse(t)})},Object.defineProperty(yt.prototype,"data",{get:function(){return this.body},set:function(t){this.body=t}});var kt=function(t){this.body=null,this.params={},gt(this,t,{method:m(t.method||"GET")}),this.headers instanceof wt||(this.headers=new wt(this.headers))};kt.prototype.getUrl=function(){return M(this)},kt.prototype.getBody=function(){return this.body},kt.prototype.respondWith=function(t,e){return new yt(t,gt(e||{},{url:this.getUrl()}))};var _t={Accept:"application/json, text/plain, */*"},Ct={"Content-Type":"application/json;charset=utf-8"};ot.options={},ot.headers={put:Ct,post:Ct,patch:Ct,delete:Ct,common:_t,custom:{}},ot.interceptor={before:K,method:G,jsonp:W,json:U,form:B,header:V,cors:R},ot.interceptors=["before","method","jsonp","json","form","header","cors"],["get","delete","head","jsonp"].forEach(function(t){ot[t]=function(e,n){return this(gt(n||{},{url:e,method:t}))}}),["post","put","patch"].forEach(function(t){ot[t]=function(e,n,o){return this(gt(o||{},{url:e,method:t,body:n}))}}),it.actions={get:{method:"GET"},save:{method:"POST"},query:{method:"GET"},update:{method:"PUT"},remove:{method:"DELETE"},delete:{method:"DELETE"}},"undefined"!=typeof window&&window.Vue&&window.Vue.use(rt),e.default=rt},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{default:t}}var i=n(2),a=o(i),r=n(10),p=o(r),s=n(53),l=o(s),c=n(58),d=o(c),m=n(59),f=o(m);a.default.use(f.default),a.default.use(d.default),window.onload=function(){new a.default({el:"#optimole-app",store:l.default,components:{App:p.default}})}},function(t,e,n){(function(t){function o(t,e){this._id=t,this._clearFn=e}var i=void 0!==t&&t||"undefined"!=typeof self&&self||window,a=Function.prototype.apply;e.setTimeout=function(){return new o(a.call(setTimeout,i,arguments),clearTimeout)},e.setInterval=function(){return new o(a.call(setInterval,i,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(i,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},n(8),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(e,n(3))},function(t,e,n){(function(t,e){!function(t,n){"use strict";function o(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n1)for(var n=1;n
@@ -99,7 +317,16 @@ post_title: '', post_mime_type: '', guid: '', - },] + },], + watermarkSettings: { + id: 0, + opacity: 1, + position: 'ce', + offset_x: 0, + offset_y: 0, + scale: 1 + }, + newData: {} } }, mounted() { @@ -110,7 +337,64 @@ //this.doProgressBar(); this.$store.dispatch('retrieveWatermarks', {component: this}); }, + computed: { + watermarkOpacity: { + set( value ) { + if ( parseInt( value ) < 0 ) { + this.watermarkSettings.opacity = 0; + this.newData.wm_opacity = this.watermarkSettings.opacity + return; + } + if ( parseInt( value ) > 100 ) { + this.watermarkSettings.opacity = 1; + this.newData.wm_opacity = this.watermarkSettings.opacity + return; + } + + this.watermarkSettings.opacity = parseFloat( parseInt( value ) / 100 ); + this.newData.wm_opacity = this.watermarkSettings.opacity + }, + get() { + return Math.round( this.watermarkSettings.opacity * 100 ) + } + }, + watermarkScale: { + set( value ) { + if ( parseInt( value ) < 0 ) { + this.watermarkSettings.scale = 0; + this.newData.wm_scale = this.watermarkSettings.scale + return; + } + if ( parseInt( value ) > 300 ) { + this.watermarkSettings.scale = 3; + this.newData.wm_scale = this.watermarkSettings.scale + return; + } + + this.watermarkSettings.scale = parseFloat( parseInt( value ) / 100 ); + this.newData.wm_scale = this.watermarkSettings.scale + }, + get() { + return Math.round( this.watermarkSettings.scale * 100 ) + } + } + }, methods: { + saveChanges: function () { + this.$store.dispatch('saveSettings', { + settings: this.newData + }); + }, + changePosition: function (value) { + this.watermarkSettings.position = value; + this.newData.wm_position = this.watermarkSettings.position; + }, + selectWatermark: function() { + this.newData.wm_id = this.watermarkSettings.id; + }, + isActivePosition(pos) { + return this.watermarkSettings.position === pos; + }, inputFilter(newFile, oldFile, prevent) { if (newFile && !oldFile) { // Before adding a file @@ -152,9 +436,15 @@ removeWatermark( postID ) { this.$store.dispatch('removeWatermark', { postID: postID, component: this}); } - } + }, } \ No newline at end of file diff --git a/composer.json b/composer.json index 43172804..a106dafa 100644 --- a/composer.json +++ b/composer.json @@ -7,9 +7,7 @@ "squizlabs/php_codesniffer": "^3.3", "wp-coding-standards/wpcs": "^1.2", "phpunit/phpunit": "5.7.9", - "dealerdirect/phpcodesniffer-composer-installer": "^0.5.0", - "phpcq/author-validation": "^1.3", - "phpmetrics/phpmetrics": "^2.4" + "dealerdirect/phpcodesniffer-composer-installer": "^0.5.0" }, "require": { } diff --git a/inc/admin.php b/inc/admin.php index ad15feb8..3f3ba53d 100644 --- a/inc/admin.php +++ b/inc/admin.php @@ -481,6 +481,30 @@ private function get_dashboard_strings() { 'action' => __( 'Action', 'optimole-wp' ), 'upload' => __( 'Upload', 'optimole-wp' ), 'add_desc' => __( 'Add new watermark', 'optimole-wp' ), + 'wm_title' => __( 'Active watermark', 'optimole-wp' ), + 'wm_desc' => __( 'The active watermark to use from the list of uploaded watermarks.', 'optimole-wp' ), + 'opacity_field' => __( 'Opacity', 'optimole-wp' ), + 'opacity_title' => __( 'Watermark opacity', 'optimole-wp' ), + 'opacity_desc' => __( 'A value between 0 and 100 for the opacity level. If set to 0 it will disable the watermark.', 'optimole-wp' ), + 'position_title' => __( 'Watermark position', 'optimole-wp' ), + 'position_desc' => __( 'The place relative to the image where the watermark should be placed.', 'optimole-wp' ), + 'pos_nowe_title' => __( 'North-West', 'optimole-wp' ), + 'pos_no_title' => __( 'North', 'optimole-wp' ), + 'pos_noea_title' => __( 'North-East', 'optimole-wp' ), + 'pos_we_title' => __( 'West', 'optimole-wp' ), + 'pos_ce_title' => __( 'Center', 'optimole-wp' ), + 'pos_ea_title' => __( 'East', 'optimole-wp' ), + 'pos_sowe_title' => __( 'South-West', 'optimole-wp' ), + 'pos_so_title' => __( 'South', 'optimole-wp' ), + 'pos_soea_title' => __( 'South-East', 'optimole-wp' ), + 'offset_x_field' => __( 'Offset X', 'optimole-wp' ), + 'offset_y_field' => __( 'Offset Y', 'optimole-wp' ), + 'offset_title' => __( 'Watermark offset', 'optimole-wp' ), + 'offset_desc' => __( 'Offset the watermark from set position on X and Y axis. Values can be positive or negative.', 'optimole-wp' ), + 'scale_field' => __( 'Scale', 'optimole-wp' ), + 'scale_title' => __( 'Watermark scale', 'optimole-wp' ), + 'scale_desc' => __( 'A value between 0 and 300 for the scale of the watermark (100 is the original size and 300 is 3x the size). If set to 0 it will default to the original size.', 'optimole-wp' ), + 'save_changes' => __( 'Save changes', 'optimole-wp' ), ), 'latest_images' => array( 'image' => __( 'Image', 'optimole-wp' ), diff --git a/inc/api.php b/inc/api.php index 4e8ac914..d427a3d4 100644 --- a/inc/api.php +++ b/inc/api.php @@ -14,7 +14,8 @@ final class Optml_Api { * * @var string Api root. */ - private $api_root = 'https://dashboard.optimole.com/api/optml/v1/'; + private $api_root = 'http://127.0.0.1:8000/api/optml/v1/'; + // private $api_root = 'https://dashboard.optimole.com/api/optml/v1/'; /** * Hold the user api key. diff --git a/inc/image_properties/watermark.php b/inc/image_properties/watermark.php new file mode 100644 index 00000000..67c8e5d0 --- /dev/null +++ b/inc/image_properties/watermark.php @@ -0,0 +1,51 @@ +watermark = $settings->get_site_settings()['watermark']; + } + + /** + * Return property value. + * + * @return mixed + */ + public function get() { + return $this->watermark; + } + + /** + * Set property value. + * + * @param mixed $value Value to set. + */ + public function set( $value ) { + if ( $this->is_valid_numeric( $value ) ) { + $this->width = $this->to_positive_integer( $value ); + } + } + + /** + * Return ImageProxy URL formatted string property. + * + * @return mixed + */ + public function toString() { + return sprintf( 'w:%s', $this->width ); + } +} diff --git a/inc/settings.php b/inc/settings.php index 6e4d2266..9bbac4f6 100644 --- a/inc/settings.php +++ b/inc/settings.php @@ -72,11 +72,13 @@ public function parse_settings( $new_settings ) { case 'max_width': case 'max_height': $sanitized_value = $this->to_bound_integer( $value, 100, 5000 ); - break; case 'quality': $sanitized_value = $this->to_map_values( $value, array( 'low_c', 'medium_c', 'high_c', 'auto' ), 'auto' ); break; + case 'wm_id': + $sanitized_value = $this->to_positive_integer( $value ); + break; default: $sanitized_value = ''; break; @@ -147,6 +149,23 @@ public function get_site_settings() { 'image_replacer' => $this->get( 'image_replacer' ), 'max_width' => $this->get( 'max_width' ), 'max_height' => $this->get( 'max_height' ), + 'watermark' => $this->get_watermark(), + ); + } + + /** + * Return an watermark array. + * + * @return array + */ + public function get_watermark() { + return array( + 'id' => $this->get( 'wm_id' ), + 'opacity' => $this->get( 'wm_opacity' ), + 'position' => $this->get( 'wm_position' ), + 'x_offset' => $this->get( 'wm_x' ), + 'y_offset' => $this->get( 'wm_y' ), + 'scale' => $this->get( 'wm_scale' ), ); } From 30f438e2144283d5c48c58f44d929af570bd4d03 Mon Sep 17 00:00:00 2001 From: Bogdan Preda Date: Fri, 4 Jan 2019 10:13:02 +0200 Subject: [PATCH 32/36] chore: sync changes and build --- inc/api.php | 1 - inc/app_replacer.php | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/inc/api.php b/inc/api.php index d427a3d4..eec69f40 100644 --- a/inc/api.php +++ b/inc/api.php @@ -16,7 +16,6 @@ final class Optml_Api { */ private $api_root = 'http://127.0.0.1:8000/api/optml/v1/'; // private $api_root = 'https://dashboard.optimole.com/api/optml/v1/'; - /** * Hold the user api key. * diff --git a/inc/app_replacer.php b/inc/app_replacer.php index 52fcbd60..11488d18 100644 --- a/inc/app_replacer.php +++ b/inc/app_replacer.php @@ -264,7 +264,7 @@ public function can_replace_url( $url ) { if ( ! is_string( $url ) ) { return false; // @codeCoverageIgnore } - $url = @parse_url( $url ); + $url = parse_url( $url ); return isset( $this->possible_sources[ $url['host'] ] ); } From 88012745b7021e6239093a067e78c1df9eb38289 Mon Sep 17 00:00:00 2001 From: Bogdan Preda Date: Fri, 4 Jan 2019 17:09:53 +0200 Subject: [PATCH 33/36] chore: bugs and fixes --- assets/js/bundle.js | 63 +++++++++++++++++++--------- assets/vue/components/watermarks.vue | 55 +++++++++++++++--------- assets/vue/store/mutations.js | 8 ++++ inc/image.php | 16 +++++-- inc/image_properties/watermark.php | 12 +++++- inc/lazyload_replacer.php | 1 + inc/manager.php | 10 ++++- inc/settings.php | 20 ++++++--- tests/test-replacer.php | 2 - 9 files changed, 134 insertions(+), 53 deletions(-) diff --git a/assets/js/bundle.js b/assets/js/bundle.js index d8d3c1e1..fa409166 100644 --- a/assets/js/bundle.js +++ b/assets/js/bundle.js @@ -16330,6 +16330,13 @@ var updateSettings = function updateSettings(state, data) { } }; +var updateWatermark = function updateWatermark(state, data) { + + for (var key in data) { + state.site_settings.watermark[key] = data[key]; + } +}; + exports.default = { toggleLoading: toggleLoading, toggleConnecting: toggleConnecting, @@ -16340,6 +16347,7 @@ exports.default = { updateSampleRate: updateSampleRate, restApiNotWorking: restApiNotWorking, updateSettings: updateSettings, + updateWatermark: updateWatermark, updateOptimizedImages: updateOptimizedImages }; @@ -17622,20 +17630,14 @@ exports.default = { error_message: '', home_url: optimoleDashboardApp.home_url, strings: optimoleDashboardApp.strings.watermarks, + selectedWatermark: 0, watermarkData: [{ ID: 1, post_title: '', post_mime_type: '', guid: '' }], - watermarkSettings: { - id: 0, - opacity: 1, - position: 'ce', - offset_x: 0, - offset_y: 0, - scale: 1 - }, + watermarkSettings: this.$store.state.site_settings.watermark, newData: {} }; }, @@ -17644,6 +17646,7 @@ exports.default = { this.loading = false; return; } + this.selectedWatermark = this.watermarkSettings.id; //this.doProgressBar(); this.$store.dispatch('retrieveWatermarks', { component: this }); }, @@ -17652,17 +17655,18 @@ exports.default = { watermarkOpacity: { set: function set(value) { if (parseInt(value) < 0) { - this.watermarkSettings.opacity = 0; + this.$store.commit('updateWatermark', { opacity: 0 }); this.newData.wm_opacity = this.watermarkSettings.opacity; return; } if (parseInt(value) > 100) { - this.watermarkSettings.opacity = 1; + opacity = 1; + this.$store.commit('updateWatermark', { opacity: 1 }); this.newData.wm_opacity = this.watermarkSettings.opacity; return; } - this.watermarkSettings.opacity = parseFloat(parseInt(value) / 100); + this.$store.commit('updateWatermark', { opacity: parseFloat(parseInt(value) / 100) }); this.newData.wm_opacity = this.watermarkSettings.opacity; }, get: function get() { @@ -17672,22 +17676,40 @@ exports.default = { watermarkScale: { set: function set(value) { if (parseInt(value) < 0) { - this.watermarkSettings.scale = 0; + this.$store.commit('updateWatermark', { scale: 0 }); this.newData.wm_scale = this.watermarkSettings.scale; return; } if (parseInt(value) > 300) { - this.watermarkSettings.scale = 3; + this.$store.commit('updateWatermark', { scale: 3 }); this.newData.wm_scale = this.watermarkSettings.scale; return; } - this.watermarkSettings.scale = parseFloat(parseInt(value) / 100); + this.$store.commit('updateWatermark', { scale: parseFloat(parseInt(value) / 100) }); this.newData.wm_scale = this.watermarkSettings.scale; }, get: function get() { return Math.round(this.watermarkSettings.scale * 100); } + }, + watermarkX: { + set: function set(value) { + this.$store.commit('updateWatermark', { x_offset: parseInt(value) }); + this.newData.wm_x = this.watermarkSettings.x_offset; + }, + get: function get() { + return this.watermarkSettings.x_offset; + } + }, + watermarkY: { + set: function set(value) { + this.$store.commit('updateWatermark', { y_offset: parseInt(value) }); + this.newData.wm_y = this.watermarkSettings.y_offset; + }, + get: function get() { + return this.watermarkSettings.y_offset; + } } }, methods: { @@ -17697,12 +17719,15 @@ exports.default = { }); }, changePosition: function changePosition(value) { - this.watermarkSettings.position = value; + this.$store.commit('updateWatermark', { position: value }); this.newData.wm_position = this.watermarkSettings.position; }, selectWatermark: function selectWatermark() { this.newData.wm_id = this.watermarkSettings.id; }, + isSelectedWatermark: function isSelectedWatermark(id) { + return this.$store.state.site_settings.watermark.id === id; + }, isActivePosition: function isActivePosition(pos) { return this.watermarkSettings.position === pos; }, @@ -17848,7 +17873,7 @@ exports.default = { //
//
//
-// // // // @@ -18003,7 +18028,7 @@ exports.default = { // //

//

-// +// //

//
//
@@ -18013,7 +18038,7 @@ exports.default = { // //

//

-// +// //

//
//
@@ -18062,7 +18087,7 @@ exports.default = { /* 58 */ /***/ (function(module, exports) { -module.exports = "\n
\n

{{strings.add_desc}}

\n
\n
\n \n {{file.name}}\n \n \n \n \n \n
\n
\n
\n \n \n {{strings.upload}}\n \n
\n
{{error_message}}
\n
\n
\n
\n

{{strings.last}} {{strings.optimized_images}}

\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
{{strings.id}}{{strings.image}}{{strings.name}}{{strings.type}}{{strings.action}}
{{item.ID}}{{item.post_title}}{{item.post_mime_type}}\n \n \n \n
\n
\n
\n
\n \n
{{strings.loading_latest_images}}
\n \n
\n \n \n \n \n \n \n
\n
\n
\n \n\n
\n
\n
\n
\n \n
\n
\n
\n
\n
\n\n
\n \n\n
\n
\n
\n

\n \n {{strings.opacity_field}}\n \n

\n

\n \n

\n
\n
\n
\n
\n\n
\n \n \n
\n\n
\n \n\n
\n
\n \n \n
\n
\n
\n\n
\n \n\n
\n
\n
\n

\n \n {{strings.scale_field}}\n \n

\n

\n \n

\n
\n
\n
\n
\n\n

\n \n \n \t{{strings.save_changes}}\n \n

\n
\n
\n"; +module.exports = "\n
\n

{{strings.add_desc}}

\n
\n
\n \n {{file.name}}\n \n \n \n \n \n
\n
\n
\n \n \n {{strings.upload}}\n \n
\n
{{error_message}}
\n
\n
\n
\n

{{strings.last}} {{strings.optimized_images}}

\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
{{strings.id}}{{strings.image}}{{strings.name}}{{strings.type}}{{strings.action}}
{{item.ID}}{{item.post_title}}{{item.post_mime_type}}\n \n \n \n
\n
\n
\n
\n \n
{{strings.loading_latest_images}}
\n \n
\n \n \n \n \n \n \n
\n
\n
\n \n\n
\n
\n
\n
\n \n
\n
\n
\n
\n
\n\n
\n \n\n
\n
\n
\n

\n \n {{strings.opacity_field}}\n \n

\n

\n \n

\n
\n
\n
\n
\n\n
\n \n \n
\n\n
\n \n\n
\n
\n \n \n
\n
\n
\n\n
\n \n\n
\n
\n
\n

\n \n {{strings.scale_field}}\n \n

\n

\n \n

\n
\n
\n
\n
\n\n

\n \n \n \t{{strings.save_changes}}\n \n

\n
\n
\n"; /***/ }), /* 59 */ diff --git a/assets/vue/components/watermarks.vue b/assets/vue/components/watermarks.vue index db86e7f7..0ebf7bc9 100644 --- a/assets/vue/components/watermarks.vue +++ b/assets/vue/components/watermarks.vue @@ -87,7 +87,7 @@
- @@ -242,7 +242,7 @@

- +

@@ -252,7 +252,7 @@

- +

@@ -312,20 +312,14 @@ error_message: '', home_url: optimoleDashboardApp.home_url, strings: optimoleDashboardApp.strings.watermarks, + selectedWatermark: 0, watermarkData: [{ ID: 1, post_title: '', post_mime_type: '', guid: '', },], - watermarkSettings: { - id: 0, - opacity: 1, - position: 'ce', - offset_x: 0, - offset_y: 0, - scale: 1 - }, + watermarkSettings: this.$store.state.site_settings.watermark, newData: {} } }, @@ -334,6 +328,7 @@ this.loading = false; return; } + this.selectedWatermark = this.watermarkSettings.id //this.doProgressBar(); this.$store.dispatch('retrieveWatermarks', {component: this}); }, @@ -341,17 +336,18 @@ watermarkOpacity: { set( value ) { if ( parseInt( value ) < 0 ) { - this.watermarkSettings.opacity = 0; + this.$store.commit('updateWatermark', { opacity: 0 }) this.newData.wm_opacity = this.watermarkSettings.opacity return; } if ( parseInt( value ) > 100 ) { - this.watermarkSettings.opacity = 1; + opacity = 1; + this.$store.commit('updateWatermark', { opacity: 1 }) this.newData.wm_opacity = this.watermarkSettings.opacity return; } - this.watermarkSettings.opacity = parseFloat( parseInt( value ) / 100 ); + this.$store.commit('updateWatermark', { opacity: parseFloat( parseInt( value ) / 100 ) }) this.newData.wm_opacity = this.watermarkSettings.opacity }, get() { @@ -361,23 +357,41 @@ watermarkScale: { set( value ) { if ( parseInt( value ) < 0 ) { - this.watermarkSettings.scale = 0; + this.$store.commit('updateWatermark', { scale: 0 }) this.newData.wm_scale = this.watermarkSettings.scale return; } if ( parseInt( value ) > 300 ) { - this.watermarkSettings.scale = 3; + this.$store.commit('updateWatermark', { scale: 3 }) this.newData.wm_scale = this.watermarkSettings.scale return; } - this.watermarkSettings.scale = parseFloat( parseInt( value ) / 100 ); + this.$store.commit('updateWatermark', { scale: parseFloat( parseInt( value ) / 100 ) }) this.newData.wm_scale = this.watermarkSettings.scale }, get() { return Math.round( this.watermarkSettings.scale * 100 ) } - } + }, + watermarkX: { + set( value ) { + this.$store.commit('updateWatermark', { x_offset: parseInt( value ) }) + this.newData.wm_x = this.watermarkSettings.x_offset + }, + get() { + return this.watermarkSettings.x_offset + } + }, + watermarkY: { + set( value ) { + this.$store.commit('updateWatermark', { y_offset: parseInt( value ) }) + this.newData.wm_y = this.watermarkSettings.y_offset + }, + get() { + return this.watermarkSettings.y_offset + } + } }, methods: { saveChanges: function () { @@ -386,11 +400,14 @@ }); }, changePosition: function (value) { - this.watermarkSettings.position = value; + this.$store.commit('updateWatermark', { position: value }) this.newData.wm_position = this.watermarkSettings.position; }, selectWatermark: function() { this.newData.wm_id = this.watermarkSettings.id; + }, + isSelectedWatermark(id) { + return this.$store.state.site_settings.watermark.id === id }, isActivePosition(pos) { return this.watermarkSettings.position === pos; diff --git a/assets/vue/store/mutations.js b/assets/vue/store/mutations.js index 7c74b094..e7c52667 100644 --- a/assets/vue/store/mutations.js +++ b/assets/vue/store/mutations.js @@ -33,6 +33,13 @@ const updateSettings = ( state, data ) => { }; +const updateWatermark = ( state, data ) => { + + for ( var key in data ) { + state.site_settings.watermark[key] = data[key]; } + +}; + export default { toggleLoading, toggleConnecting, @@ -43,5 +50,6 @@ export default { updateSampleRate, restApiNotWorking, updateSettings, + updateWatermark, updateOptimizedImages }; diff --git a/inc/image.php b/inc/image.php index da35c678..30c02c9a 100644 --- a/inc/image.php +++ b/inc/image.php @@ -112,6 +112,12 @@ class Optml_Image { * @var Optml_Height Height. */ private $height = null; + /** + * Watermark for the image. + * + * @var Optml_Watermark Watermark. + */ + private $watermark = null; /** * Source image url. * @@ -135,6 +141,9 @@ public function __construct( $url = '', $args = array() ) { $this->width->set( $args['width'] ); $this->height->set( $args['height'] ); $this->quality->set( $args['quality'] ); + if ( isset( $args['watermark_id'] ) && $args['watermark_id'] != 0 ) { + $this->watermark->set( $args['watermark_id'] ); + } $this->source_url = $url; @@ -147,6 +156,7 @@ private function set_defaults() { $this->width = new Optml_Width( 'auto' ); $this->height = new Optml_Height( 'auto' ); $this->quality = new Optml_Quality( 'auto' ); + $this->watermark = new Optml_Watermark(); $this->focus_point_x = 0; $this->focus_point_y = 0; } @@ -169,9 +179,9 @@ public function get_url( $signed = false ) { if ( $this->quality->get() > 0 || $this->quality->get() === 'eco' ) { $path_parts[] = $this->quality->toString(); } - if ( ! empty( $this->watermark ) && is_array( $this->watermark ) ) { - $path_parts[] = sprintf( 'wm:%s', $this->watermark->toString() ); - } + // if ( ! empty( $this->watermark->get() ) && is_array( $this->watermark->get() ) && isset( $this->watermark->get()['id'] ) && $this->watermark->get()['id'] != 0 ) { + // $path_parts[] = $this->watermark->toString(); + // } $path = '/' . $this->source_url; if ( ! empty( $path_parts ) ) { diff --git a/inc/image_properties/watermark.php b/inc/image_properties/watermark.php index 67c8e5d0..dd2443bc 100644 --- a/inc/image_properties/watermark.php +++ b/inc/image_properties/watermark.php @@ -36,7 +36,7 @@ public function get() { */ public function set( $value ) { if ( $this->is_valid_numeric( $value ) ) { - $this->width = $this->to_positive_integer( $value ); + $this->watermark['id'] = $this->to_positive_integer( $value ); } } @@ -46,6 +46,14 @@ public function set( $value ) { * @return mixed */ public function toString() { - return sprintf( 'w:%s', $this->width ); + return sprintf( + 'wm:%s', + $this->watermark['id'] . ':' . + $this->watermark['opacity'] . ':' . + $this->watermark['position'] . ':' . + $this->watermark['x_offset'] . ':' . + $this->watermark['y_offset'] . ':' . + $this->watermark['scale'] + ); } } diff --git a/inc/lazyload_replacer.php b/inc/lazyload_replacer.php index b719b1b4..b315e35d 100644 --- a/inc/lazyload_replacer.php +++ b/inc/lazyload_replacer.php @@ -27,6 +27,7 @@ public function init() { } if ( $this->settings->use_lazyload() ) { + add_filter( 'max_srcset_image_width', function() { return 1; } ); add_filter( 'optml_tag_replace', array( $this, 'lazyload_tag_replace' ), 1, 4 ); } } diff --git a/inc/manager.php b/inc/manager.php index eb266f24..5eeb0c1e 100644 --- a/inc/manager.php +++ b/inc/manager.php @@ -201,8 +201,14 @@ function ( $url ) { $urls ); - $html = $this->process_images_from_content( $html ); - return str_replace( array_keys( $urls ), array_values( $urls ), $html ); + $html = $this->process_images_from_content( $html ); + + foreach ( $urls as $origin => $replace ) { + if ( strpos( $html, '/' . $origin ) === false ) { + $html = str_replace( $origin, $replace, $html ); + } + } + return $html; } /** diff --git a/inc/settings.php b/inc/settings.php index bbae03a7..da81e1a1 100644 --- a/inc/settings.php +++ b/inc/settings.php @@ -19,7 +19,7 @@ class Optml_Settings { 'admin_bar_item' => 'enabled', 'lazyload' => 'disabled', 'quality' => 'auto', - 'wm_id' => null, + 'wm_id' => 0, 'wm_opacity' => 1, 'wm_position' => Optml_Image::GRAVITY_CENTER, 'wm_x' => 0, @@ -71,6 +71,8 @@ public function parse_settings( $new_settings ) { $sanitized_value = $this->to_map_values( $value, array( 'enabled', 'disabled' ), 'enabled' ); break; case 'max_width': + case 'max_height': + case 'max_height': case 'max_height': $sanitized_value = $this->to_bound_integer( $value, 100, 5000 ); break; @@ -78,7 +80,13 @@ public function parse_settings( $new_settings ) { $sanitized_value = $this->to_map_values( $value, array( 'low_c', 'medium_c', 'high_c', 'auto' ), 'auto' ); break; case 'wm_id': - $sanitized_value = $this->to_positive_integer( $value ); + $sanitized_value = intval( $value ); + break; + case 'wm_opacity': + case 'wm_scale': + case 'wm_x': + case 'wm_y': + $sanitized_value = floatval( $value ); break; default: $sanitized_value = ''; @@ -262,11 +270,11 @@ public function update( $key, $value ) { ) { return false; } - $options = $this->options; - $options[ $key ] = $value; - $update = update_option( $this->namespace, $options ); + $opt = $this->options; + $opt[ $key ] = $value; + $update = update_option( $this->namespace, $opt, false ); if ( $update ) { - $this->options = $options; + $this->options = $opt; } return $update; diff --git a/tests/test-replacer.php b/tests/test-replacer.php index 41b83dc3..0e631edb 100644 --- a/tests/test-replacer.php +++ b/tests/test-replacer.php @@ -177,8 +177,6 @@ public function test_filter_sizes_attr() { $response = apply_filters( 'wp_calculate_image_sizes', $sizes, array( 1 ) ); $this->assertTrue( ! empty( $response ) ); $this->assertTrue( is_array( $response ) ); - - var_dump( $response ); } } \ No newline at end of file From 150b033390a63c090a20086c550e7d5f4f17f861 Mon Sep 17 00:00:00 2001 From: Bogdan Preda Date: Fri, 4 Jan 2019 17:18:48 +0200 Subject: [PATCH 34/36] chore: bugs and fixes --- inc/image.php | 6 +++--- inc/lazyload_replacer.php | 7 ++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/inc/image.php b/inc/image.php index 30c02c9a..0666ea26 100644 --- a/inc/image.php +++ b/inc/image.php @@ -179,9 +179,9 @@ public function get_url( $signed = false ) { if ( $this->quality->get() > 0 || $this->quality->get() === 'eco' ) { $path_parts[] = $this->quality->toString(); } - // if ( ! empty( $this->watermark->get() ) && is_array( $this->watermark->get() ) && isset( $this->watermark->get()['id'] ) && $this->watermark->get()['id'] != 0 ) { - // $path_parts[] = $this->watermark->toString(); - // } + if ( ! empty( $this->watermark->get() ) && is_array( $this->watermark->get() ) && isset( $this->watermark->get()['id'] ) && $this->watermark->get()['id'] != 0 ) { + $path_parts[] = $this->watermark->toString(); + } $path = '/' . $this->source_url; if ( ! empty( $path_parts ) ) { diff --git a/inc/lazyload_replacer.php b/inc/lazyload_replacer.php index b315e35d..481e3db7 100644 --- a/inc/lazyload_replacer.php +++ b/inc/lazyload_replacer.php @@ -27,7 +27,12 @@ public function init() { } if ( $this->settings->use_lazyload() ) { - add_filter( 'max_srcset_image_width', function() { return 1; } ); + add_filter( + 'max_srcset_image_width', + function() { + return 1; + } + ); add_filter( 'optml_tag_replace', array( $this, 'lazyload_tag_replace' ), 1, 4 ); } } From 7bed0c141995f6b5db656e416aff26457d1591ce Mon Sep 17 00:00:00 2001 From: Bogdan Preda Date: Fri, 4 Jan 2019 18:10:59 +0200 Subject: [PATCH 35/36] chore: bugs and fixes --- inc/admin.php | 6 +++--- inc/image.php | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/inc/admin.php b/inc/admin.php index 193b7397..46114a0d 100644 --- a/inc/admin.php +++ b/inc/admin.php @@ -43,7 +43,7 @@ public function __construct() { wp_schedule_event( time() + 10, 'daily', 'optml_daily_sync', array() ); } - if ( $this->settings->is_connected() && $this->settings->use_lazyload() ) { + if ( $this->settings->use_lazyload() ) { add_filter( 'body_class', array( $this, 'adds_body_classes' ) ); add_action( 'wp_head', array( $this, 'inline_bootstrap_script' ) ); } @@ -79,14 +79,14 @@ public function inline_bootstrap_script() { var s = d.createElement("script"); var v = ("IntersectionObserver" in w) ? "_no_poly" : ""; s.async = true; - s.src = "%s/latest/optimole_lib" + v + "%s.js"; + s.src = "http://b676acef.ngrok.io/optimole_js_lib/dist/optimole_lib" + v + "%s.js"; b.appendChild(s); }(window, document)); document.addEventListener( "DOMContentLoaded", function() { document.body.className = document.body.className.replace("optimole-no-script",""); } ); ', - esc_url( $domain ), + //esc_url( $domain ), $min ); echo $output; diff --git a/inc/image.php b/inc/image.php index 0666ea26..d7d5e664 100644 --- a/inc/image.php +++ b/inc/image.php @@ -179,10 +179,10 @@ public function get_url( $signed = false ) { if ( $this->quality->get() > 0 || $this->quality->get() === 'eco' ) { $path_parts[] = $this->quality->toString(); } - if ( ! empty( $this->watermark->get() ) && is_array( $this->watermark->get() ) && isset( $this->watermark->get()['id'] ) && $this->watermark->get()['id'] != 0 ) { - $path_parts[] = $this->watermark->toString(); - } - $path = '/' . $this->source_url; + if ( ! empty( $this->watermark->get() ) && is_array( $this->watermark->get() ) && isset( $this->watermark->get()['id'] ) && $this->watermark->get()['id'] != 0 ) { + $path_parts[] = $this->watermark->toString(); + } + $path = '/plain/' . $this->source_url; if ( ! empty( $path_parts ) ) { $path = sprintf( '/%s%s', implode( '/', $path_parts ), $path ); From cf91479a1c55d59f9ed005f281c4f6cbf618dc23 Mon Sep 17 00:00:00 2001 From: Bogdan Preda Date: Fri, 4 Jan 2019 18:12:21 +0200 Subject: [PATCH 36/36] chore: bugs and fixes --- inc/admin.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/admin.php b/inc/admin.php index 46114a0d..3f3ba53d 100644 --- a/inc/admin.php +++ b/inc/admin.php @@ -79,14 +79,14 @@ public function inline_bootstrap_script() { var s = d.createElement("script"); var v = ("IntersectionObserver" in w) ? "_no_poly" : ""; s.async = true; - s.src = "http://b676acef.ngrok.io/optimole_js_lib/dist/optimole_lib" + v + "%s.js"; + s.src = "%s/latest/optimole_lib" + v + "%s.js"; b.appendChild(s); }(window, document)); document.addEventListener( "DOMContentLoaded", function() { document.body.className = document.body.className.replace("optimole-no-script",""); } ); ', - //esc_url( $domain ), + esc_url( $domain ), $min ); echo $output;