| @@ -9,18 +9,8 @@ | ||
| 9 | 9 | jQuery('.wpupg-select2').select2wpupg({ |
| 10 | 10 | width: '100%' |
| 11 | 11 | }); |
| 12 | 12 | |
| 13 | - // Multiselect with order | |
| 14 | - jQuery('select.wpupg_filter_taxonomy').on('select2wpupg:select', function (evt) { | |
| 15 | - var element = evt.params.data.element; | |
| 16 | - var $element = jQuery(element); | |
| 17 | - | |
| 18 | - $element.detach(); | |
| 19 | - jQuery(this).append($element); | |
| 20 | - jQuery(this).trigger('change'); | |
| 21 | - }); | |
| 22 | - | |
| 23 | 13 | // Datepicker |
| 24 | 14 | jQuery('#wpupg_rules').find('.wpupg-date').datepicker(); |
| 25 | 15 | |
| 26 | 16 | // Sliders |
| @@ -40,16 +30,8 @@ | ||
| 40 | 30 | var posts_per_page = jQuery('#wpupg_pagination_pages_posts_per_page'); |
| 41 | 31 | slider_args.start = posts_per_page.val(); |
| 42 | 32 | jQuery('#wpupg_pagination_pages_posts_per_page_slider').noUiSlider(slider_args).Link('lower').to(posts_per_page); |
| 43 | 33 | |
| 44 | - var infinite_posts = jQuery('#wpupg_pagination_infinite_load_initial_posts'); | |
| 45 | - slider_args.start = infinite_posts.val(); | |
| 46 | - jQuery('#wpupg_pagination_infinite_load_initial_posts_slider').noUiSlider(slider_args).Link('lower').to(infinite_posts); | |
| 47 | - | |
| 48 | - var posts_on_scroll = jQuery('#wpupg_pagination_infinite_load_posts_on_scroll'); | |
| 49 | - slider_args.start = posts_on_scroll.val(); | |
| 50 | - jQuery('#wpupg_pagination_infinite_load_posts_on_scroll_slider').noUiSlider(slider_args).Link('lower').to(posts_on_scroll); | |
| 51 | - | |
| 52 | 34 | var initial_posts = jQuery('#wpupg_pagination_load_more_initial_posts'); |
| 53 | 35 | slider_args.start = initial_posts.val(); |
| 54 | 36 | jQuery('#wpupg_pagination_load_more_initial_posts_slider').noUiSlider(slider_args).Link('lower').to(initial_posts); |
| 55 | 37 | |
| @@ -56,12 +38,8 @@ | ||
| 56 | 38 | var posts_on_click = jQuery('#wpupg_pagination_load_more_posts_on_click'); |
| 57 | 39 | slider_args.start = posts_on_click.val(); |
| 58 | 40 | jQuery('#wpupg_pagination_load_more_posts_on_click_slider').noUiSlider(slider_args).Link('lower').to(posts_on_click); |
| 59 | 41 | |
| 60 | - var initial_posts_filter = jQuery('#wpupg_pagination_load_filter_initial_posts'); | |
| 61 | - slider_args.start = initial_posts_filter.val(); | |
| 62 | - jQuery('#wpupg_pagination_load_filter_initial_posts_slider').noUiSlider(slider_args).Link('lower').to(initial_posts_filter); | |
| 63 | - | |
| 64 | 42 | slider_args = { |
| 65 | 43 | start: 0, |
| 66 | 44 | step: 1, |
| 67 | 45 | range: { |
| @@ -212,20 +190,13 @@ | ||
| 212 | 190 | change: function () { WPUltimatePostGrid.changedPaginationStyle(); } |
| 213 | 191 | }); |
| 214 | 192 | |
| 215 | 193 | // Initial State |
| 216 | - WPUltimatePostGrid.changedType(); | |
| 217 | 194 | WPUltimatePostGrid.changedPostType(); |
| 218 | - WPUltimatePostGrid.changedTaxonomy(); | |
| 219 | - WPUltimatePostGrid.changedOrderBy(); | |
| 220 | 195 | WPUltimatePostGrid.changedLimitPosts(); |
| 221 | - WPUltimatePostGrid.changedLimitTerms(); | |
| 222 | 196 | WPUltimatePostGrid.initRules(); |
| 223 | 197 | WPUltimatePostGrid.changedFilterType(); |
| 224 | - WPUltimatePostGrid.changedShowCount(); | |
| 225 | 198 | WPUltimatePostGrid.changedMultiselect(); |
| 226 | - WPUltimatePostGrid.changedLimitFilterTerms(); | |
| 227 | - WPUltimatePostGrid.changedDropdownLabels(); | |
| 228 | 199 | WPUltimatePostGrid.changedIsotopeFilterStyle(); |
| 229 | 200 | WPUltimatePostGrid.changedIsotopeFilterText(); |
| 230 | 201 | WPUltimatePostGrid.changedLayoutMode(); |
| 231 | 202 | WPUltimatePostGrid.changedPaginationStyle(); |
| @@ -232,14 +203,10 @@ | ||
| 232 | 203 | WPUltimatePostGrid.changedPaginationType(); |
| 233 | 204 | WPUltimatePostGrid.changedPaginationText(); |
| 234 | 205 | |
| 235 | 206 | // Events |
| 236 | - jQuery('#wpupg_type').on('change', function() { WPUltimatePostGrid.changedType(); }); | |
| 237 | 207 | jQuery('#wpupg_post_types').on('change', function() { WPUltimatePostGrid.changedPostType(); }); |
| 238 | - jQuery('#wpupg_taxonomies').on('change', function() { WPUltimatePostGrid.changedTaxonomy(); }); | |
| 239 | - jQuery('#wpupg_order_by').on('change', function() { WPUltimatePostGrid.changedOrderBy(); }); | |
| 240 | 208 | jQuery('#wpupg_limit_posts').on('change', function() { WPUltimatePostGrid.changedLimitPosts(); }); |
| 241 | - jQuery('#wpupg_limit_terms').on('change', function() { WPUltimatePostGrid.changedLimitTerms(); }); | |
| 242 | 209 | jQuery('#wpupg_add_rule').on('click', function(e) { e.preventDefault(); WPUltimatePostGrid.addRule(); }); |
| 243 | 210 | jQuery('.wpupg_rule_delete').on('click', function(e) { e.preventDefault(); WPUltimatePostGrid.removeRule(jQuery(this).parents('tr').attr('data-rule')); }); |
| 244 | 211 | jQuery('.wpupg_rule_field').on('change', function(e) { WPUltimatePostGrid.changedRuleField(jQuery(this).parents('tr').attr('data-rule')); }); |
| 245 | 212 | jQuery('.rule_container_wpupg_general_date').find('select').on('change', function(e) { WPUltimatePostGrid.changedDateRule(jQuery(this).parents('tr').attr('data-rule')); }); |
| @@ -244,12 +211,9 @@ | ||
| 244 | 211 | jQuery('.wpupg_rule_field').on('change', function(e) { WPUltimatePostGrid.changedRuleField(jQuery(this).parents('tr').attr('data-rule')); }); |
| 245 | 212 | jQuery('.rule_container_wpupg_general_date').find('select').on('change', function(e) { WPUltimatePostGrid.changedDateRule(jQuery(this).parents('tr').attr('data-rule')); }); |
| 246 | 213 | jQuery('.wpupg-date').on('change', function(e) { WPUltimatePostGrid.changedDateRule(jQuery(this).parents('tr').attr('data-rule')); }); |
| 247 | 214 | jQuery('#wpupg_filter_type').on('change', function() { WPUltimatePostGrid.changedFilterType(); }); |
| 248 | - jQuery('#wpupg_filter_count').on('change', function() { WPUltimatePostGrid.changedShowCount(); }); | |
| 249 | 215 | jQuery('#wpupg_filter_multiselect').on('change', function() { WPUltimatePostGrid.changedMultiselect(); }); |
| 250 | - jQuery('.wpupg_filter_taxonomy').on('change', function() { WPUltimatePostGrid.changedLimitFilterTerms(); WPUltimatePostGrid.changedDropdownLabels(); }); | |
| 251 | - jQuery('#wpupg_filter_limit').on('change', function() { WPUltimatePostGrid.changedLimitFilterTerms(); }); | |
| 252 | 216 | jQuery('#wpupg_layout_mode').on('change', function() { WPUltimatePostGrid.changedLayoutMode(); }); |
| 253 | 217 | jQuery('#wpupg_pagination_type').on('change', function() { WPUltimatePostGrid.changedPaginationType(); }); |
| 254 | 218 | jQuery('#wpupg_pagination_load_more_button_text').on('change keyup', function() { WPUltimatePostGrid.changedPaginationText(); }); |
| 255 | 219 | |
| @@ -320,49 +284,8 @@ | ||
| 320 | 284 | } |
| 321 | 285 | }); |
| 322 | 286 | }; |
| 323 | 287 | |
| 324 | -WPUltimatePostGrid.changedType = function() { | |
| 325 | - var type = jQuery('#wpupg_type').find(':selected').val(); | |
| 326 | - | |
| 327 | - if( type == 'terms' ) { | |
| 328 | - WPUltimatePostGrid.checkPremiumFeatures('type', true); | |
| 329 | - jQuery('#wpupg_meta_box_data_source_terms').show(); | |
| 330 | - | |
| 331 | - jQuery('#wpupg_meta_box_data_source').hide(); | |
| 332 | - jQuery('#wpupg_meta_box_limit_terms').show(); | |
| 333 | - jQuery('#wpupg_meta_box_limit_posts').hide(); | |
| 334 | - jQuery('#wpupg_meta_box_filter').hide(); | |
| 335 | - jQuery('#wpupg_meta_box_isotope_filter').hide(); | |
| 336 | - jQuery('#wpupg_meta_box_pagination').hide(); | |
| 337 | - jQuery('#wpupg_meta_box_pagination_style').hide(); | |
| 338 | - | |
| 339 | - WPUltimatePostGrid.changedLimitTerms(); | |
| 340 | - } else { | |
| 341 | - WPUltimatePostGrid.checkPremiumFeatures('type', false); | |
| 342 | - jQuery('#wpupg_meta_box_data_source_terms').hide(); | |
| 343 | - | |
| 344 | - jQuery('#wpupg_meta_box_data_source').show(); | |
| 345 | - jQuery('#wpupg_meta_box_limit_terms').hide(); | |
| 346 | - jQuery('#wpupg_meta_box_limit_posts').show(); | |
| 347 | - jQuery('#wpupg_meta_box_filter').show(); | |
| 348 | - jQuery('#wpupg_meta_box_isotope_filter').show(); | |
| 349 | - jQuery('#wpupg_meta_box_pagination').show(); | |
| 350 | - jQuery('#wpupg_meta_box_pagination_style').show(); | |
| 351 | - | |
| 352 | - WPUltimatePostGrid.changedLimitPosts(); | |
| 353 | - WPUltimatePostGrid.changedFilterType(); | |
| 354 | - WPUltimatePostGrid.changedPaginationType(); | |
| 355 | - } | |
| 356 | -}; | |
| 357 | - | |
| 358 | -WPUltimatePostGrid.changedTaxonomy = function() { | |
| 359 | - var taxonomy = jQuery('#wpupg_taxonomies').find(':selected').val(); | |
| 360 | - | |
| 361 | - jQuery('#wpupg_form_limit_terms').find('tr').hide(); | |
| 362 | - jQuery('#wpupg_form_limit_terms').find('tr#wpupg_form_limit_terms_' + taxonomy).show(); | |
| 363 | -}; | |
| 364 | - | |
| 365 | 288 | WPUltimatePostGrid.changedPostType = function() { |
| 366 | 289 | var post_type = jQuery('#wpupg_post_types').find(':selected').val(); |
| 367 | 290 | |
| 368 | 291 | jQuery('.wpupg_filter_taxonomy_container').hide(); |
| @@ -379,32 +302,10 @@ | ||
| 379 | 302 | WPUltimatePostGrid.filter_possible = false; |
| 380 | 303 | } |
| 381 | 304 | |
| 382 | 305 | WPUltimatePostGrid.changedFilterType(); |
| 383 | - WPUltimatePostGrid.changedLimitFilterTerms(); | |
| 384 | - WPUltimatePostGrid.changedDropdownLabels(); | |
| 385 | 306 | }; |
| 386 | 307 | |
| 387 | -WPUltimatePostGrid.changedOrderBy = function() { | |
| 388 | - var order_by = jQuery('#wpupg_order_by').find(':selected').val(); | |
| 389 | - | |
| 390 | - if(order_by == 'custom') { | |
| 391 | - WPUltimatePostGrid.checkPremiumFeatures('order_by', true); | |
| 392 | - jQuery('.wpupg_order_custom_key_container').show(); | |
| 393 | - } else { | |
| 394 | - WPUltimatePostGrid.checkPremiumFeatures('order_by', false); | |
| 395 | - jQuery('.wpupg_order_custom_key_container').hide(); | |
| 396 | - } | |
| 397 | -}; | |
| 398 | - | |
| 399 | -WPUltimatePostGrid.changedLimitTerms = function() { | |
| 400 | - if(jQuery('#wpupg_limit_terms').is(':checked')) { | |
| 401 | - jQuery('#wpupg_meta_box_limit_terms').show(); | |
| 402 | - } else { | |
| 403 | - jQuery('#wpupg_meta_box_limit_terms').hide(); | |
| 404 | - } | |
| 405 | -}; | |
| 406 | - | |
| 407 | 308 | WPUltimatePostGrid.changedLimitPosts = function() { |
| 408 | 309 | if(jQuery('#wpupg_limit_posts').is(':checked')) { |
| 409 | 310 | WPUltimatePostGrid.checkPremiumFeatures('limit_posts', true); |
| 410 | 311 | jQuery('#wpupg_meta_box_limit_posts').show(); |
| @@ -490,17 +391,11 @@ | ||
| 490 | 391 | }; |
| 491 | 392 | |
| 492 | 393 | WPUltimatePostGrid.changedFilterType = function() { |
| 493 | 394 | var filter_type = jQuery('#wpupg_filter_type').find(':selected').val(); |
| 494 | - var filter_type_search = false; | |
| 495 | 395 | |
| 496 | - if(filter_type.substring(0,5) == 'text_') { | |
| 497 | - filter_type = filter_type.substring(5); | |
| 498 | - filter_type_search = true; | |
| 499 | - } | |
| 500 | - | |
| 501 | 396 | // Hide & Show Filter Settings |
| 502 | - if(filter_type == 'none' || filter_type == 'text') { | |
| 397 | + if(filter_type == 'none') { | |
| 503 | 398 | jQuery('#wpupg_form_filter').find('tr').not('.wpupg_no_filter').hide(); |
| 504 | 399 | } else { |
| 505 | 400 | jQuery('#wpupg_form_filter').find('tr').not('.wpupg_no_filter').show(); |
| 506 | 401 | } |
| @@ -505,9 +400,9 @@ | ||
| 505 | 400 | jQuery('#wpupg_form_filter').find('tr').not('.wpupg_no_filter').show(); |
| 506 | 401 | } |
| 507 | 402 | |
| 508 | 403 | // Premium only filters |
| 509 | - if(filter_type == 'dropdown' || filter_type == 'text') { | |
| 404 | + if(filter_type == 'dropdown') { | |
| 510 | 405 | WPUltimatePostGrid.checkPremiumFeatures('filter_type', true); |
| 511 | 406 | } else { |
| 512 | 407 | WPUltimatePostGrid.checkPremiumFeatures('filter_type', false); |
| 513 | 408 | } |
| @@ -513,33 +408,15 @@ | ||
| 513 | 408 | } |
| 514 | 409 | |
| 515 | 410 | // Hide & Show Filter Styles |
| 516 | 411 | jQuery('#wpupg_meta_box_isotope_filter').hide(); |
| 517 | - jQuery('#wpupg_meta_box_text_filter').hide(); | |
| 518 | 412 | jQuery('#wpupg_meta_box_dropdown_filter').hide(); |
| 519 | 413 | |
| 520 | 414 | if(WPUltimatePostGrid.filter_possible) { |
| 521 | 415 | jQuery('#wpupg_meta_box_' + filter_type + '_filter').show(); |
| 522 | - | |
| 523 | - if(filter_type_search) { | |
| 524 | - jQuery('#wpupg_meta_box_text_filter').show(); | |
| 525 | - } | |
| 526 | 416 | } |
| 527 | - | |
| 528 | - WPUltimatePostGrid.changedLimitFilterTerms(); | |
| 529 | - WPUltimatePostGrid.changedDropdownLabels(); | |
| 530 | 417 | }; |
| 531 | 418 | |
| 532 | -WPUltimatePostGrid.changedShowCount = function() { | |
| 533 | - var show_count = jQuery('#wpupg_filter_count').is(':checked'); | |
| 534 | - | |
| 535 | - if(show_count) { | |
| 536 | - WPUltimatePostGrid.checkPremiumFeatures('show_count', true); | |
| 537 | - } else { | |
| 538 | - WPUltimatePostGrid.checkPremiumFeatures('show_count', false); | |
| 539 | - } | |
| 540 | -}; | |
| 541 | - | |
| 542 | 419 | WPUltimatePostGrid.changedMultiselect = function() { |
| 543 | 420 | var multiselect = jQuery('#wpupg_filter_multiselect').is(':checked'); |
| 544 | 421 | |
| 545 | 422 | if(multiselect) { |
| @@ -550,54 +427,8 @@ | ||
| 550 | 427 | jQuery('.wpupg_multiselect').hide(); |
| 551 | 428 | } |
| 552 | 429 | }; |
| 553 | 430 | |
| 554 | -WPUltimatePostGrid.changedLimitFilterTerms = function() { | |
| 555 | - var limit_terms = jQuery('#wpupg_filter_limit').is(':checked'); | |
| 556 | - var post_type = jQuery('#wpupg_post_types').find(':selected').val(); | |
| 557 | - var taxonomies = jQuery('#wpupg_filter_taxonomy_' + post_type).val(); | |
| 558 | - | |
| 559 | - if( !jQuery.isArray( taxonomies ) ) { | |
| 560 | - taxonomies = [taxonomies]; | |
| 561 | - } | |
| 562 | - | |
| 563 | - if(limit_terms && taxonomies) { | |
| 564 | - jQuery('.wpupg_limit_terms').show(); | |
| 565 | - jQuery('.wpupg_filter_terms_taxonomy').hide(); | |
| 566 | - | |
| 567 | - for(var i = 0; i < taxonomies.length; i++) { | |
| 568 | - jQuery('#wpupg_filter_terms_taxonomy_' + taxonomies[i]).show(); | |
| 569 | - } | |
| 570 | - } else { | |
| 571 | - jQuery('.wpupg_limit_terms').hide(); | |
| 572 | - } | |
| 573 | -}; | |
| 574 | - | |
| 575 | -WPUltimatePostGrid.changedDropdownLabels = function() { | |
| 576 | - var filter_type = jQuery('#wpupg_filter_type').find(':selected').val(); | |
| 577 | - var post_type = jQuery('#wpupg_post_types').find(':selected').val(); | |
| 578 | - var taxonomies = jQuery('#wpupg_filter_taxonomy_' + post_type).val(); | |
| 579 | - | |
| 580 | - if(filter_type.substring(0,5) == 'text_') { | |
| 581 | - filter_type = filter_type.substring(5); | |
| 582 | - } | |
| 583 | - | |
| 584 | - if( !jQuery.isArray( taxonomies ) ) { | |
| 585 | - taxonomies = [taxonomies]; | |
| 586 | - } | |
| 587 | - | |
| 588 | - if(filter_type == 'dropdown' && taxonomies) { | |
| 589 | - jQuery('.wpupg_dropdown_labels').show(); | |
| 590 | - jQuery('.wpupg_filter_dropdown_labels_taxonomy').hide(); | |
| 591 | - | |
| 592 | - for(var i = 0; i < taxonomies.length; i++) { | |
| 593 | - jQuery('#wpupg_filter_dropdown_label_taxonomy_' + taxonomies[i]).show(); | |
| 594 | - } | |
| 595 | - } else { | |
| 596 | - jQuery('.wpupg_dropdown_labels').hide(); | |
| 597 | - } | |
| 598 | -}; | |
| 599 | - | |
| 600 | 431 | WPUltimatePostGrid.changedIsotopeFilterStyle = function() { |
| 601 | 432 | var margin_vertical = parseInt(jQuery('#wpupg_isotope_filter_style_margin_vertical').val()); |
| 602 | 433 | var margin_horizontal = parseInt(jQuery('#wpupg_isotope_filter_style_margin_horizontal').val()); |
| 603 | 434 | var padding_vertical = parseInt(jQuery('#wpupg_isotope_filter_style_padding_vertical').val()); |
| @@ -631,14 +462,9 @@ | ||
| 631 | 462 | }; |
| 632 | 463 | |
| 633 | 464 | WPUltimatePostGrid.changedIsotopeFilterText = function() { |
| 634 | 465 | var text = jQuery('#wpupg_isotope_filter_style_all_button_text').val(); |
| 635 | - | |
| 636 | - if(text.length > 0) { | |
| 637 | - jQuery('#wpupg_isotope_filter_style_all_button_text_preview').text(text).show(); | |
| 638 | - } else { | |
| 639 | - jQuery('#wpupg_isotope_filter_style_all_button_text_preview').hide(); | |
| 640 | - } | |
| 466 | + jQuery('#wpupg_isotope_filter_style_all_button_text_preview').text(text); | |
| 641 | 467 | }; |
| 642 | 468 | |
| 643 | 469 | |
| 644 | 470 | WPUltimatePostGrid.changedLayoutMode = function() { |
| @@ -691,17 +517,16 @@ | ||
| 691 | 517 | jQuery('#wpupg_form_pagination').find('tbody').not('.wpupg_pagination_' + pagination_type).not('.wpupg_pagination_none').hide(); |
| 692 | 518 | jQuery('#wpupg_form_pagination').find('tbody.wpupg_pagination_' + pagination_type).show(); |
| 693 | 519 | |
| 694 | 520 | // Premium only pagination |
| 695 | - if(pagination_type == 'none' || pagination_type == 'pages') { | |
| 521 | + if(pagination_type == 'load_more') { | |
| 522 | + WPUltimatePostGrid.checkPremiumFeatures('pagination_type', true); | |
| 523 | + } else { | |
| 696 | 524 | WPUltimatePostGrid.checkPremiumFeatures('pagination_type', false); |
| 697 | - } else { | |
| 698 | - WPUltimatePostGrid.checkPremiumFeatures('pagination_type', true); | |
| 699 | 525 | } |
| 700 | 526 | |
| 701 | 527 | // Hide & Show Pagination Styles |
| 702 | - if(pagination_type != 'none' && pagination_type != 'infinite_load' && pagination_type != 'load_filter') { | |
| 703 | - pagination_type = pagination_type == 'load_more_filter' ? 'load_more' : pagination_type; | |
| 528 | + if(pagination_type != 'none') { | |
| 704 | 529 | jQuery('#wpupg_meta_box_pagination_style').show().find('.wpupg_filter_preview').hide(); |
| 705 | 530 | jQuery('#wpupg_filter_preview_pagination_style_' + pagination_type).show(); |
| 706 | 531 | } else { |
| 707 | 532 | jQuery('#wpupg_meta_box_pagination_style').hide(); |