admin-js.js
332 lines
| 1 | /******/ (function(modules) { // webpackBootstrap |
| 2 | /******/ // The module cache |
| 3 | /******/ var installedModules = {}; |
| 4 | /******/ |
| 5 | /******/ // The require function |
| 6 | /******/ function __webpack_require__(moduleId) { |
| 7 | /******/ |
| 8 | /******/ // Check if module is in cache |
| 9 | /******/ if(installedModules[moduleId]) { |
| 10 | /******/ return installedModules[moduleId].exports; |
| 11 | /******/ } |
| 12 | /******/ // Create a new module (and put it into the cache) |
| 13 | /******/ var module = installedModules[moduleId] = { |
| 14 | /******/ i: moduleId, |
| 15 | /******/ l: false, |
| 16 | /******/ exports: {} |
| 17 | /******/ }; |
| 18 | /******/ |
| 19 | /******/ // Execute the module function |
| 20 | /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); |
| 21 | /******/ |
| 22 | /******/ // Flag the module as loaded |
| 23 | /******/ module.l = true; |
| 24 | /******/ |
| 25 | /******/ // Return the exports of the module |
| 26 | /******/ return module.exports; |
| 27 | /******/ } |
| 28 | /******/ |
| 29 | /******/ |
| 30 | /******/ // expose the modules object (__webpack_modules__) |
| 31 | /******/ __webpack_require__.m = modules; |
| 32 | /******/ |
| 33 | /******/ // expose the module cache |
| 34 | /******/ __webpack_require__.c = installedModules; |
| 35 | /******/ |
| 36 | /******/ // identity function for calling harmony imports with the correct context |
| 37 | /******/ __webpack_require__.i = function(value) { return value; }; |
| 38 | /******/ |
| 39 | /******/ // define getter function for harmony exports |
| 40 | /******/ __webpack_require__.d = function(exports, name, getter) { |
| 41 | /******/ if(!__webpack_require__.o(exports, name)) { |
| 42 | /******/ Object.defineProperty(exports, name, { |
| 43 | /******/ configurable: false, |
| 44 | /******/ enumerable: true, |
| 45 | /******/ get: getter |
| 46 | /******/ }); |
| 47 | /******/ } |
| 48 | /******/ }; |
| 49 | /******/ |
| 50 | /******/ // getDefaultExport function for compatibility with non-harmony modules |
| 51 | /******/ __webpack_require__.n = function(module) { |
| 52 | /******/ var getter = module && module.__esModule ? |
| 53 | /******/ function getDefault() { return module['default']; } : |
| 54 | /******/ function getModuleExports() { return module; }; |
| 55 | /******/ __webpack_require__.d(getter, 'a', getter); |
| 56 | /******/ return getter; |
| 57 | /******/ }; |
| 58 | /******/ |
| 59 | /******/ // Object.prototype.hasOwnProperty.call |
| 60 | /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; |
| 61 | /******/ |
| 62 | /******/ // __webpack_public_path__ |
| 63 | /******/ __webpack_require__.p = ""; |
| 64 | /******/ |
| 65 | /******/ // Load entry module and return exports |
| 66 | /******/ return __webpack_require__(__webpack_require__.s = 2); |
| 67 | /******/ }) |
| 68 | /************************************************************************/ |
| 69 | /******/ ([ |
| 70 | /* 0 */ |
| 71 | /***/ (function(module, exports, __webpack_require__) { |
| 72 | |
| 73 | "use strict"; |
| 74 | |
| 75 | |
| 76 | Object.defineProperty(exports, "__esModule", { |
| 77 | value: true |
| 78 | }); |
| 79 | |
| 80 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); |
| 81 | |
| 82 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
| 83 | |
| 84 | var Notice = function () { |
| 85 | function Notice($element) { |
| 86 | var _this = this; |
| 87 | |
| 88 | _classCallCheck(this, Notice); |
| 89 | |
| 90 | this.$element = $element; |
| 91 | this.key = $element.data('key'); |
| 92 | this.nonce = $element.data('nonce'); |
| 93 | |
| 94 | this.$element.on('click', '.notice-dismiss', function () { |
| 95 | return _this.onDismissClick(); |
| 96 | }); |
| 97 | } |
| 98 | |
| 99 | _createClass(Notice, [{ |
| 100 | key: 'onDismissClick', |
| 101 | value: function onDismissClick() { |
| 102 | |
| 103 | this.$element.remove(); |
| 104 | |
| 105 | jQuery.ajax({ |
| 106 | type: "POST", |
| 107 | data: { action: "wpmtst_dismiss_notice", nonce: this.nonce, key: this.key }, |
| 108 | url: ajaxurl |
| 109 | }); |
| 110 | } |
| 111 | }]); |
| 112 | |
| 113 | return Notice; |
| 114 | }(); |
| 115 | |
| 116 | exports.default = Notice; |
| 117 | |
| 118 | /***/ }), |
| 119 | /* 1 */, |
| 120 | /* 2 */ |
| 121 | /***/ (function(module, exports, __webpack_require__) { |
| 122 | |
| 123 | "use strict"; |
| 124 | |
| 125 | |
| 126 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); |
| 127 | |
| 128 | var _notice = __webpack_require__(0); |
| 129 | |
| 130 | var _notice2 = _interopRequireDefault(_notice); |
| 131 | |
| 132 | var _AddonsPage = __webpack_require__(4); |
| 133 | |
| 134 | var _AddonsPage2 = _interopRequireDefault(_AddonsPage); |
| 135 | |
| 136 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
| 137 | |
| 138 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
| 139 | |
| 140 | /** |
| 141 | * Strong Testimonials admin |
| 142 | * |
| 143 | * @namespace jQuery |
| 144 | */ |
| 145 | |
| 146 | // Function to get the Max value in Array |
| 147 | Array.max = function (array) { |
| 148 | return Math.max.apply(Math, array); |
| 149 | }; |
| 150 | |
| 151 | jQuery(document).ready(function ($) { |
| 152 | |
| 153 | // Convert "A String" to "a_string" |
| 154 | function convertLabel(label) { |
| 155 | return label.replace(/\s+/g, '_').replace(/\W/g, '').toLowerCase(); |
| 156 | } |
| 157 | |
| 158 | // Remove invalid characters |
| 159 | function removeSpaces(word) { |
| 160 | //return word.replace(/\s+/g, "_"); |
| 161 | return word.replace(/[^\w\s(?!\-)]/gi, ''); |
| 162 | } |
| 163 | |
| 164 | $.fn.showInlineBlock = function () { |
| 165 | return this.css('display', 'inline-block'); |
| 166 | }; |
| 167 | |
| 168 | /** |
| 169 | * ---------------------------------------- |
| 170 | * General events |
| 171 | * ---------------------------------------- |
| 172 | */ |
| 173 | |
| 174 | // Add protocol if missing |
| 175 | // Thanks http://stackoverflow.com/a/36429927/51600 |
| 176 | $('input[type=url]').change(function () { |
| 177 | if (this.value.length && !/^https*:\/\//.test(this.value)) { |
| 178 | this.value = 'http://' + this.value; |
| 179 | } |
| 180 | }); |
| 181 | |
| 182 | $('ul.ui-tabs-nav li a').click(function () { |
| 183 | $(this).blur(); |
| 184 | }); |
| 185 | |
| 186 | $('.focus-next-field').change(function (e) { |
| 187 | if ($(e.target).is(':checked')) { |
| 188 | $(e.target).parent().next().find('input').focus().select(); |
| 189 | } |
| 190 | }); |
| 191 | |
| 192 | // toggle screenshots |
| 193 | $('#toggle-screen-options').add('#screenshot-screen-options').click(function (e) { |
| 194 | $(this).blur(); |
| 195 | $('#screenshot-screen-options').slideToggle(); |
| 196 | }); |
| 197 | |
| 198 | // toggle screenshots |
| 199 | $('#toggle-help').click(function (e) { |
| 200 | $(this).toggleClass('closed open').blur(); |
| 201 | $('#help-section').slideToggle(); |
| 202 | }); |
| 203 | |
| 204 | /** |
| 205 | * ---------------------------------------- |
| 206 | * View List Table |
| 207 | * ---------------------------------------- |
| 208 | */ |
| 209 | |
| 210 | /** |
| 211 | * Save sort order |
| 212 | */ |
| 213 | $('table.wpm-testimonial_page_testimonial-views th.manage-column').on('click', function (e) { |
| 214 | var columnName = $(this).attr('id'); |
| 215 | // get the opposite class |
| 216 | var columnOrder = $(this).hasClass('asc') ? 'desc' : $(this).hasClass('desc') ? 'asc' : ''; |
| 217 | var data = { |
| 218 | 'action': 'wpmtst_save_view_list_order', |
| 219 | 'name': columnName, |
| 220 | 'order': columnOrder |
| 221 | }; |
| 222 | $.get(ajaxurl, data, function (response) {}); |
| 223 | }); |
| 224 | |
| 225 | /** |
| 226 | * Sticky views |
| 227 | */ |
| 228 | $('table.wpm-testimonial_page_testimonial-views').on('click', '.stickit', function (e) { |
| 229 | var icon = $(this); |
| 230 | icon.closest('.wp-list-table-wrap').find('.overlay').fadeIn(200); |
| 231 | icon.blur().toggleClass('stuck'); |
| 232 | var id = $(this).closest('tr').find('td.id').html(); |
| 233 | var data = { |
| 234 | 'action': 'wpmtst_save_view_sticky', |
| 235 | 'id': id |
| 236 | }; |
| 237 | $.get(ajaxurl, data, function (response) { |
| 238 | if (response) { |
| 239 | window.location.reload(); |
| 240 | } |
| 241 | }); |
| 242 | }); |
| 243 | }); |
| 244 | |
| 245 | var WPMTST_Admin = function () { |
| 246 | function WPMTST_Admin() { |
| 247 | _classCallCheck(this, WPMTST_Admin); |
| 248 | |
| 249 | this.initNotices(); |
| 250 | this.initAddonsPage(); |
| 251 | } |
| 252 | |
| 253 | _createClass(WPMTST_Admin, [{ |
| 254 | key: 'initNotices', |
| 255 | value: function initNotices() { |
| 256 | var $div = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : jQuery("body"); |
| 257 | |
| 258 | $div.find('.wpmtst-notice').each(function (index) { |
| 259 | new _notice2.default(jQuery(this)); |
| 260 | }); |
| 261 | } |
| 262 | }, { |
| 263 | key: 'initAddonsPage', |
| 264 | value: function initAddonsPage() { |
| 265 | new _AddonsPage2.default(jQuery(this)); |
| 266 | } |
| 267 | }]); |
| 268 | |
| 269 | return WPMTST_Admin; |
| 270 | }(); |
| 271 | |
| 272 | window.WPMTST_Admin = new WPMTST_Admin(); |
| 273 | |
| 274 | /***/ }), |
| 275 | /* 3 */, |
| 276 | /* 4 */ |
| 277 | /***/ (function(module, exports, __webpack_require__) { |
| 278 | |
| 279 | "use strict"; |
| 280 | |
| 281 | |
| 282 | Object.defineProperty(exports, "__esModule", { |
| 283 | value: true |
| 284 | }); |
| 285 | |
| 286 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); |
| 287 | |
| 288 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
| 289 | |
| 290 | var AddonsPage = function () { |
| 291 | function AddonsPage() { |
| 292 | var _this = this; |
| 293 | |
| 294 | _classCallCheck(this, AddonsPage); |
| 295 | |
| 296 | if (!jQuery('body').hasClass('wpm-testimonial_page_strong-testimonials-addons')) { |
| 297 | return; |
| 298 | } |
| 299 | |
| 300 | this.reloadButton = jQuery('#wpmtst-reload-extensions'); |
| 301 | |
| 302 | //events |
| 303 | this.reloadButton.on('click', function (e) { |
| 304 | return _this.onReloadExtensionsClick(e); |
| 305 | }); |
| 306 | } |
| 307 | |
| 308 | _createClass(AddonsPage, [{ |
| 309 | key: 'onReloadExtensionsClick', |
| 310 | value: function onReloadExtensionsClick(e) { |
| 311 | e.preventDefault(); |
| 312 | |
| 313 | this.reloadButton.addClass('updating-message'); |
| 314 | |
| 315 | jQuery.ajax({ |
| 316 | type: "POST", |
| 317 | data: { action: "wpmtst_reload_extensions", nonce: this.reloadButton.data('nonce') }, |
| 318 | url: ajaxurl, |
| 319 | success: function success(response) { |
| 320 | location.reload(); |
| 321 | } |
| 322 | }); |
| 323 | } |
| 324 | }]); |
| 325 | |
| 326 | return AddonsPage; |
| 327 | }(); |
| 328 | |
| 329 | exports.default = AddonsPage; |
| 330 | |
| 331 | /***/ }) |
| 332 | /******/ ]); |