vendor: 3,612 bytes, lines 1-88
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/******/ // define getter function for harmony exports 37/******/ __webpack_require__.d = function(exports, name, getter) { 38/******/ if(!__webpack_require__.o(exports, name)) { 39/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 40/******/ } 41/******/ }; 42/******/ 43/******/ // define __esModule on exports 44/******/ __webpack_require__.r = function(exports) { 45/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 46/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 47/******/ } 48/******/ Object.defineProperty(exports, '__esModule', { value: true }); 49/******/ }; 50/******/ 51/******/ // create a fake namespace object 52/******/ // mode & 1: value is a module id, require it 53/******/ // mode & 2: merge all properties of value into the ns 54/******/ // mode & 4: return value when already ns object 55/******/ // mode & 8|1: behave like require 56/******/ __webpack_require__.t = function(value, mode) { 57/******/ if(mode & 1) value = __webpack_require__(value); 58/******/ if(mode & 8) return value; 59/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 60/******/ var ns = Object.create(null); 61/******/ __webpack_require__.r(ns); 62/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 63/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 64/******/ return ns; 65/******/ }; 66/******/ 67/******/ // getDefaultExport function for compatibility with non-harmony modules 68/******/ __webpack_require__.n = function(module) { 69/******/ var getter = module && module.__esModule ? 70/******/ function getDefault() { return module['default']; } : 71/******/ function getModuleExports() { return module; }; 72/******/ __webpack_require__.d(getter, 'a', getter); 73/******/ return getter; 74/******/ }; 75/******/ 76/******/ // Object.prototype.hasOwnProperty.call 77/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 78/******/ 79/******/ // __webpack_public_path__ 80/******/ __webpack_require__.p = ""; 81/******/ 82/******/ 83/******/ // Load entry module and return exports 84/******/ return __webpack_require__(__webpack_require__.s = "./src/Frontend.js"); 85/******/ }) 86/************************************************************************/ 87/******/ ({ 88
89/***/ "./src/Frontend.js": 90/*!*************************!*\ 91 !*** ./src/Frontend.js ***! 92 \*************************/ 93/*! no static exports found */ 94/***/ (function(module, exports) { 95 96; 97 98(function ($) { 99 'use strict'; 100 101 $.fn.pros_variation_swatches_form = function () { 102 return this.each(function () { 103 var $form = $(this), 104 clicked = null, 105 selected = []; 106 107 var mark_as_unavailable = function mark_as_unavailable() { 108 $form.find('.pro-swatches-item.pro-swatches-not-available').removeClass('pro-swatches-not-available'); 109 $('.pro-swatches-wrapper').each(function () { 110 var that = $(this), 111 select = that.find('select'); 112 var founded = []; 113 select.find('option').each(function () { 114 var option = $(this).val(); 115 116 if (option != "") { 117 founded.push(option); 118 } 119 }); 120 that.find('.pro-swatches-item').each(function () { 121 var item = $(this), 122 data = item.data('value'); 123 124 if (!founded.includes(data)) { 125 item.addClass("pro-swatches-not-available"); 126 } 127 }); 128 }); 129 }; 130 131 $form.on('click', '.pro-swatches-item', function (e) { 132 e.preventDefault(); 133 var $el = $(this), 134 $select = $el.closest('.value').find('select'), 135 attribute_name = $select.data('attribute_name') || $select.attr('name'), 136 value = $el.data('value'); 137 $select.trigger('focusin'); 138 139 if ($el.hasClass("pro-swatches-not-available")) { 140 return; 141 } // Check if this variation combination is available 142 143 144 if (!$select.find('option[value="' + value + '"]').length) { 145 $el.siblings('.pro-swatches-item').removeClass('selected'); 146 $select.val('').change(); 147 return; 148 } 149 150 clicked = attribute_name; 151 152 if (selected.indexOf(attribute_name) === -1) { 153 selected.push(attribute_name); 154 } 155 156 if ($el.hasClass('selected')) { 157 $select.val(''); 158 $el.removeClass('selected'); 159 delete selected[selected.indexOf(attribute_name)]; 160 } else { 161 $el.addClass('selected').siblings('.selected').removeClass('selected'); 162 $select.val(value); 163 } 164 165 $select.change(); 166 mark_as_unavailable(); 167 }).on('click', '.reset_variations', function () { 168 var form = $(this).closest('.variations_form'); 169 form.find('.pro-swatches-item.selected').removeClass('selected'); 170 form.find('.pro-swatches-item.pro-swatches-not-available').removeClass('pro-swatches-not-available'); 171 selected = []; 172 }); 173 }); 174 }; 175 176 $.fn.pros_tooltip = function () { 177 return this.each(function () { 178 var $item = $(this), 179 body = $('body'), 180 title = $item.attr('title'), 181 tooltip_item = $("<div>", { 182 "class": "pro-swatches-tooltip" 183 }); 184 185 function getOffset(el) { 186 var _x = 0; 187 var _y = 0; 188 189 while (el && !isNaN(el.offsetLeft) && !isNaN(el.offsetTop)) { 190 _x += el.offsetLeft - el.scrollLeft; 191 _y += el.offsetTop - el.scrollTop; 192 el = el.offsetParent; 193 } 194 195 return { 196 top: _y, 197 left: _x 198 }; 199 } 200 201 if (title) { 202 $item.mouseenter(function () { 203 tooltip_item.text(title); 204 var offset = getOffset($item[0]); 205 body.append(tooltip_item); 206 tooltip_item.css({ 207 top: "".concat(offset.top - 10, "px"), 208 left: "".concat(offset.left + 7, "px") 209 }); 210 }).mouseleave(function () { 211 body.find('.pro-swatches-tooltip').remove(); 212 }); 213 } 214 }); 215 }; 216 217 $(function () { 218 $('.variations_form').pros_variation_swatches_form(); 219 $('.pro-swatches-item').pros_tooltip(); 220 }); 221})(jQuery); 222 223/***/ })
223 224 225/******/ }); 226//# sourceMappingURL=pro-swatches-frontend.build.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.