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, { 40/******/ configurable: false, 41/******/ enumerable: true, 42/******/ get: getter 43/******/ }); 44/******/ } 45/******/ }; 46/******/ 47/******/ // getDefaultExport function for compatibility with non-harmony modules 48/******/ __webpack_require__.n = function(module) { 49/******/ var getter = module && module.__esModule ? 50/******/ function getDefault() { return module['default']; } : 51/******/ function getModuleExports() { return module; }; 52/******/ __webpack_require__.d(getter, 'a', getter); 53/******/ return getter; 54/******/ }; 55/******/ 56/******/ // Object.prototype.hasOwnProperty.call 57/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 58/******/ 59/******/ // __webpack_public_path__ 60/******/ __webpack_require__.p = "/wp-content/themes/plasticseurope-theme/dist/"; 61/******/ 62/******/ // Load entry module and return exports 63/******/ return __webpack_require__(__webpack_require__.s = 124); 64/******/ }) 65/************************************************************************/ 66/******/ ({ 67 68/***/ 124: 69/***/ (function(module, exports, __webpack_require__) { 70 71module.exports = __webpack_require__(125); 72 73 74/***/ }), 75 76/***/ 125: 77/***/ (function(module, exports, __webpack_require__) { 78 79/* WEBPACK VAR INJECTION */(function(jQuery) {/* eslint-disable */ 80jQuery(function($){ 81 82 /* 83 * Load More 84 */ 85 function loadMorePostItems() { 86 87 $.ajax({ 88 url : mla_loadmore_params.ajaxurl, // AJAX handler 89 data : { 90 'action': 'loadmorebutton', // the parameter for admin-ajax.php 91 'query': mla_loadmore_params.posts, // loop parameters passed by wp_localize_script() 92 'page' : mla_loadmore_params.current_page // current page 93 }, 94 95 type : 'POST', 96 beforeSend : function ( xhr ) { 97 $('#mla_loadmore').text('Loading...'); // some type of preloader 98 }, 99 success : function( posts ){ 100 101 console.log("success"); 102 103 if( posts ) { 104 105 $('#mla_loadmore').text( 'Load More' ); 106 $('#filtered-items').append( posts ); // insert new posts 107 mla_loadmore_params.current_page++; 108 109 console.log('curr ' + mla_loadmore_params.current_page); 110 console.log('max ' + mla_loadmore_params.max_page); 111 112 if ( mla_loadmore_params.current_page == mla_loadmore_params.max_page ) 113 { $('#mla_loadmore').hide(); } // if last page, HIDE the button 114 115 } else { 116 $('#mla_loadmore').hide(); // if no data, HIDE the button as well 117 } 118 } 119 }); 120 return false; 121 }; 122 123 /* 124 * Filter 125 */ 126 127 function submitFilterForm() { 128 129 130 var filter = $('#filters'); 131 // formData = $('input[name="categoryFilter"]:checked').val(); 132 133 console.log(filter.serialize()); 134 135 $.ajax({ 136 url : mla_loadmore_params.ajaxurl, 137 data : filter.serialize(), // form data 138 dataType : 'json', // this data type allows us to receive objects from the server 139 type : 'POST', 140 beforeSend : function(xhr){ 141 // $('#mla_filters').find('#posts-filter').text('Filtering...'); 142 // $('#filtered-items').addClass('filtering'); 143 }, 144 success : function( data ){ 145 var maxPage = 'max page - ' + data.max_page; 146 console.log(maxPage); 147 148 149 // when filter applied: 150 // set the current page to 1 151 mla_loadmore_params.current_page = 1; 152 153 // // set the new query parameters 154 mla_loadmore_params.posts = data.posts; 155 156 // // set the new max page parameter 157 mla_loadmore_params.max_page = data.max_page; 158 159 // change the button label back 160 // $('#mla_filters').find('#posts-filter').text('Apply Filters'); 161 162 // remove class 163 // $('#filtered-items').removeClass('filtering'); 164 165 // insert the posts to the container 166 $('#filtered-items').html(data.content); 167 168 // close filter 169 // $('#collapseFilter').collapse('hide'); 170 171 // hide load more button, if there are not enough posts for the second page 172 if ( data.max_page < 2 ) { 173 $('#mla_loadmore').hide(); 174 } else { 175 $('#mla_loadmore').show(); 176 } 177 } 178 }); 179 } 180 181 /* 182 * Filter 183 */ 184 function submitCustomFilterForm() { 185 186 var filter = $('#custom-filters'); 187 // formData = $('input[name="categoryFilter"]:checked').val(); 188 189 console.log(filter.serialize()); 190 191 $.ajax({ 192 url : topics_loadmore_params.ajaxurl, 193 data : filter.serialize(), // form data 194 dataType : 'json', // this data type allows us to receive objects from the server 195 type : 'POST', 196 beforeSend : function(xhr){ 197 // $('#mla_filters').find('#posts-filter').text('Filtering...'); 198 $('input[type="radio"]').attr('disabled', true); 199 }, 200 success : function( data ){ 201 var maxPage = 'max page - ' + data.max_page; 202 console.log(maxPage); 203 204 205 // when filter applied: 206 // set the current page to 1 207 topics_loadmore_params.current_page = 1; 208 209 // // set the new query parameters 210 topics_loadmore_params.posts = data.posts; 211 212 // // set the new max page parameter 213 topics_loadmore_params.max_page = data.max_page; 214 215 // change the button label back 216 // $('#mla_filters').find('#posts-filter').text('Apply Filters'); 217 218 // remove class 219 // $('#filtered-items').removeClass('filtering'); 220 221 // insert the posts to the container 222 $('input[type="radio"]').attr('disabled', false); 223 $('#filtered-items').html(data.content); 224 225 // close filter 226 // $('#collapseFilter').collapse('hide'); 227 228 // hide load more button, if there are not enough posts for the second page 229 if ( data.max_page < 2 ) { 230 $('#loadmore-topics').hide(); 231 } else { 232 $('#loadmore-topics').show(); 233 } 234 } 235 }); 236 } 237 238 /* 239 * Load More Custom Posts 240 */ 241 function loadMoreCustomPostItems() { 242 243 $.ajax({ 244 url : topics_loadmore_params.ajaxurl, // AJAX handler 245 data : { 246 'action': 'loadmoretopics', // the parameter for admin-ajax.php 247 'query': topics_loadmore_params.posts, // loop parameters passed by wp_localize_script() 248 'page' : topics_loadmore_params.current_page, // current page 249 'count' : topics_loadmore_params.found_posts // found posts 250 }, 251 252 type : 'POST', 253 beforeSend : function ( xhr ) { 254 $('#loadmore-topics').text('Loading...'); // some type of preloader 255 }, 256 success : function( posts ){ 257 258 console.log("success"); 259 console.log(topics_loadmore_params.post_count); 260 261 if( posts ) {
262 $('#loadmore-topics').text( 'Load More' ); 263 $('#filtered-items').append( posts ); // insert new posts 264 topics_loadmore_params.current_page++; 265 topics_loadmore_params.count++; 266 267 console.log('curr ' + topics_loadmore_params.current_page); 268 console.log('max ' + topics_loadmore_params.max_page); 269 270 if ( topics_loadmore_params.current_page == topics_loadmore_params.max_page ) 271 { $('#loadmore-topics').hide(); } // if last page, HIDE the button 272 273 } else { 274 $('#loadmore-topics').hide(); // if no data, HIDE the button as well 275 } 276 } 277 }); 278 return false; 279 }; 280 281 /* 282 * Filter 283 */ 284 $('#filters input[name="categoryFilter"]').on('change', function() { 285 console.log('changed'); 286 submitFilterForm(); 287 // do not submit the form 288 return false; 289 }); 290 291 $('#custom-filters input[name="categoryFilter"]').on('change', function() { 292 console.log('changed'); 293 submitCustomFilterForm(); 294 // do not submit the form 295 return false; 296 }); 297 298 /* 299 * Filter Button 300 */ 301 302 $('#posts-filter').on('click', function() { 303 submitFilterForm(); 304 // do not submit the form 305 return false; 306 }); 307 308 /* 309 * Clear Filter 310 */ 311 312 $('#posts-filter-clear').on('click', function() { 313 // Clear all checked fields 314 $('#mla_filters input[name="categoryFilter[]"]').attr('checked', false); 315 316 // Disable button 317 $('#posts-filter').prop("disabled", true); 318 submitFilterForm(); 319 // do not submit the form 320 return false; 321 }); 322 323 324 /* 325 * Disable button till filter checked 326 */ 327 328 $('#posts-filter').prop("disabled", true); 329 330 $('#mla_filters input[name="categoryFilter[]"]').click(function() { 331 if ($(this).is(':checked')) { 332 $('#posts-filter').prop("disabled", false); 333 } else { 334 if ( $('input[name="categoryFilter[]"]').filter(':checked').length < 1 ) { 335 $('#posts-filter').prop("disabled", true); 336 } 337 } 338 }); 339 340 /* 341 * Load Button 342 */ 343 344 $('#mla_loadmore').on('click', function() { 345 // submitFilterForm();
346 loadMorePostItems(); 347 // do not submit the form 348 return false; 349 }); 350 351 $('#loadmore-topics').on('click', function() { 352 // submitFilterForm(); 353 loadMoreCustomPostItems(); 354 // do not submit the form 355 return false; 356 }); 357 358// $('#subscribe-form button').on('click', function() { 359// // submitFilterForm(); 360// $( "#subscribe-form" ).validate({ 361// rules: { 362// email: { 363// required: true, 364// email: true 365// }, 366// } 367// }); 368}); 369 370/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3))) 371 372/***/ }), 373 374/***/ 3: 375/***/ (function(module, exports) { 376 377module.exports = jQuery; 378 379/***/ }) 380 381/******/ }); 382//# sourceMappingURL=ajax-filter.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.