PluginProbe
WP Ultimate Post Grid / 1.6
WP Ultimate Post Grid v1.6
4.1.1 trunk 1.5 1.6 1.7 1.7.1 1.7.2 1.8 1.9 2.0 2.1 2.2 2.3 2.4.0 2.5.0 2.6.0 2.7.0 2.8.0 2.8.2 3.0.0 3.3.0 3.4.0 3.5.0 3.6.0 3.7.0 All 32 releases
← All changes | js/admin_form.js +7 -144 2.11.6 View file →
@@ -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,18 +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.changedOrderBy();
219 195 WPUltimatePostGrid.changedLimitPosts();
220 196 WPUltimatePostGrid.initRules();
221 197 WPUltimatePostGrid.changedFilterType();
222 - WPUltimatePostGrid.changedShowCount();
223 198 WPUltimatePostGrid.changedMultiselect();
224 - WPUltimatePostGrid.changedLimitTerms();
225 - WPUltimatePostGrid.changedDropdownLabels();
226 199 WPUltimatePostGrid.changedIsotopeFilterStyle();
227 200 WPUltimatePostGrid.changedIsotopeFilterText();
228 201 WPUltimatePostGrid.changedLayoutMode();
229 202 WPUltimatePostGrid.changedPaginationStyle();
@@ -230,11 +203,9 @@
230 203 WPUltimatePostGrid.changedPaginationType();
231 204 WPUltimatePostGrid.changedPaginationText();
232 205
233 206 // Events
234 - jQuery('#wpupg_type').on('change', function() { WPUltimatePostGrid.changedType(); });
235 207 jQuery('#wpupg_post_types').on('change', function() { WPUltimatePostGrid.changedPostType(); });
236 - jQuery('#wpupg_order_by').on('change', function() { WPUltimatePostGrid.changedOrderBy(); });
237 208 jQuery('#wpupg_limit_posts').on('change', function() { WPUltimatePostGrid.changedLimitPosts(); });
238 209 jQuery('#wpupg_add_rule').on('click', function(e) { e.preventDefault(); WPUltimatePostGrid.addRule(); });
239 210 jQuery('.wpupg_rule_delete').on('click', function(e) { e.preventDefault(); WPUltimatePostGrid.removeRule(jQuery(this).parents('tr').attr('data-rule')); });
240 211 jQuery('.wpupg_rule_field').on('change', function(e) { WPUltimatePostGrid.changedRuleField(jQuery(this).parents('tr').attr('data-rule')); });
@@ -240,12 +211,9 @@
240 211 jQuery('.wpupg_rule_field').on('change', function(e) { WPUltimatePostGrid.changedRuleField(jQuery(this).parents('tr').attr('data-rule')); });
241 212 jQuery('.rule_container_wpupg_general_date').find('select').on('change', function(e) { WPUltimatePostGrid.changedDateRule(jQuery(this).parents('tr').attr('data-rule')); });
242 213 jQuery('.wpupg-date').on('change', function(e) { WPUltimatePostGrid.changedDateRule(jQuery(this).parents('tr').attr('data-rule')); });
243 214 jQuery('#wpupg_filter_type').on('change', function() { WPUltimatePostGrid.changedFilterType(); });
244 - jQuery('#wpupg_filter_count').on('change', function() { WPUltimatePostGrid.changedShowCount(); });
245 215 jQuery('#wpupg_filter_multiselect').on('change', function() { WPUltimatePostGrid.changedMultiselect(); });
246 - jQuery('.wpupg_filter_taxonomy').on('change', function() { WPUltimatePostGrid.changedLimitTerms(); WPUltimatePostGrid.changedDropdownLabels(); });
247 - jQuery('#wpupg_filter_limit').on('change', function() { WPUltimatePostGrid.changedLimitTerms(); });
248 216 jQuery('#wpupg_layout_mode').on('change', function() { WPUltimatePostGrid.changedLayoutMode(); });
249 217 jQuery('#wpupg_pagination_type').on('change', function() { WPUltimatePostGrid.changedPaginationType(); });
250 218 jQuery('#wpupg_pagination_load_more_button_text').on('change keyup', function() { WPUltimatePostGrid.changedPaginationText(); });
251 219
@@ -316,38 +284,8 @@
316 284 }
317 285 });
318 286 };
319 287
320 -WPUltimatePostGrid.changedType = function() {
321 - var type = jQuery('#wpupg_type').find(':selected').val();
322 -
323 - if( type == 'terms' ) {
324 - WPUltimatePostGrid.checkPremiumFeatures('type', true);
325 - jQuery('#wpupg_meta_box_data_source_terms').show();
326 -
327 - jQuery('#wpupg_meta_box_data_source').hide();
328 - jQuery('#wpupg_meta_box_limit_posts').hide();
329 - jQuery('#wpupg_meta_box_filter').hide();
330 - jQuery('#wpupg_meta_box_isotope_filter').hide();
331 - jQuery('#wpupg_meta_box_pagination').hide();
332 - jQuery('#wpupg_meta_box_pagination_style').hide();
333 - } else {
334 - WPUltimatePostGrid.checkPremiumFeatures('type', false);
335 - jQuery('#wpupg_meta_box_data_source_terms').hide();
336 -
337 - jQuery('#wpupg_meta_box_data_source').show();
338 - jQuery('#wpupg_meta_box_limit_posts').show();
339 - jQuery('#wpupg_meta_box_filter').show();
340 - jQuery('#wpupg_meta_box_isotope_filter').show();
341 - jQuery('#wpupg_meta_box_pagination').show();
342 - jQuery('#wpupg_meta_box_pagination_style').show();
343 -
344 - WPUltimatePostGrid.changedLimitPosts();
345 - WPUltimatePostGrid.changedFilterType();
346 - WPUltimatePostGrid.changedPaginationType();
347 - }
348 -};
349 -
350 288 WPUltimatePostGrid.changedPostType = function() {
351 289 var post_type = jQuery('#wpupg_post_types').find(':selected').val();
352 290
353 291 jQuery('.wpupg_filter_taxonomy_container').hide();
@@ -364,24 +302,10 @@
364 302 WPUltimatePostGrid.filter_possible = false;
365 303 }
366 304
367 305 WPUltimatePostGrid.changedFilterType();
368 - WPUltimatePostGrid.changedLimitTerms();
369 - WPUltimatePostGrid.changedDropdownLabels();
370 306 };
371 307
372 -WPUltimatePostGrid.changedOrderBy = function() {
373 - var order_by = jQuery('#wpupg_order_by').find(':selected').val();
374 -
375 - if(order_by == 'custom') {
376 - WPUltimatePostGrid.checkPremiumFeatures('order_by', true);
377 - jQuery('.wpupg_order_custom_key_container').show();
378 - } else {
379 - WPUltimatePostGrid.checkPremiumFeatures('order_by', false);
380 - jQuery('.wpupg_order_custom_key_container').hide();
381 - }
382 -};
383 -
384 308 WPUltimatePostGrid.changedLimitPosts = function() {
385 309 if(jQuery('#wpupg_limit_posts').is(':checked')) {
386 310 WPUltimatePostGrid.checkPremiumFeatures('limit_posts', true);
387 311 jQuery('#wpupg_meta_box_limit_posts').show();
@@ -469,9 +393,9 @@
469 393 WPUltimatePostGrid.changedFilterType = function() {
470 394 var filter_type = jQuery('#wpupg_filter_type').find(':selected').val();
471 395
472 396 // Hide & Show Filter Settings
473 - if(filter_type == 'none' || filter_type == 'text') {
397 + if(filter_type == 'none') {
474 398 jQuery('#wpupg_form_filter').find('tr').not('.wpupg_no_filter').hide();
475 399 } else {
476 400 jQuery('#wpupg_form_filter').find('tr').not('.wpupg_no_filter').show();
477 401 }
@@ -476,9 +400,9 @@
476 400 jQuery('#wpupg_form_filter').find('tr').not('.wpupg_no_filter').show();
477 401 }
478 402
479 403 // Premium only filters
480 - if(filter_type == 'dropdown' || filter_type == 'text') {
404 + if(filter_type == 'dropdown') {
481 405 WPUltimatePostGrid.checkPremiumFeatures('filter_type', true);
482 406 } else {
483 407 WPUltimatePostGrid.checkPremiumFeatures('filter_type', false);
484 408 }
@@ -489,23 +413,10 @@
489 413
490 414 if(WPUltimatePostGrid.filter_possible) {
491 415 jQuery('#wpupg_meta_box_' + filter_type + '_filter').show();
492 416 }
493 -
494 - WPUltimatePostGrid.changedLimitTerms();
495 - WPUltimatePostGrid.changedDropdownLabels();
496 417 };
497 418
498 -WPUltimatePostGrid.changedShowCount = function() {
499 - var show_count = jQuery('#wpupg_filter_count').is(':checked');
500 -
501 - if(show_count) {
502 - WPUltimatePostGrid.checkPremiumFeatures('show_count', true);
503 - } else {
504 - WPUltimatePostGrid.checkPremiumFeatures('show_count', false);
505 - }
506 -};
507 -
508 419 WPUltimatePostGrid.changedMultiselect = function() {
509 420 var multiselect = jQuery('#wpupg_filter_multiselect').is(':checked');
510 421
511 422 if(multiselect) {
@@ -516,50 +427,8 @@
516 427 jQuery('.wpupg_multiselect').hide();
517 428 }
518 429 };
519 430
520 -WPUltimatePostGrid.changedLimitTerms = function() {
521 - var limit_terms = jQuery('#wpupg_filter_limit').is(':checked');
522 - var post_type = jQuery('#wpupg_post_types').find(':selected').val();
523 - var taxonomies = jQuery('#wpupg_filter_taxonomy_' + post_type).val();
524 -
525 - if( !jQuery.isArray( taxonomies ) ) {
526 - taxonomies = [taxonomies];
527 - }
528 -
529 - if(limit_terms && taxonomies) {
530 - jQuery('.wpupg_limit_terms').show();
531 - jQuery('.wpupg_filter_terms_taxonomy').hide();
532 -
533 - for(var i = 0; i < taxonomies.length; i++) {
534 - jQuery('#wpupg_filter_terms_taxonomy_' + taxonomies[i]).show();
535 - }
536 - } else {
537 - jQuery('.wpupg_limit_terms').hide();
538 - }
539 -};
540 -
541 -WPUltimatePostGrid.changedDropdownLabels = function() {
542 - var filter_type = jQuery('#wpupg_filter_type').find(':selected').val();
543 - var post_type = jQuery('#wpupg_post_types').find(':selected').val();
544 - var taxonomies = jQuery('#wpupg_filter_taxonomy_' + post_type).val();
545 -
546 - if( !jQuery.isArray( taxonomies ) ) {
547 - taxonomies = [taxonomies];
548 - }
549 -
550 - if(filter_type == 'dropdown' && taxonomies) {
551 - jQuery('.wpupg_dropdown_labels').show();
552 - jQuery('.wpupg_filter_dropdown_labels_taxonomy').hide();
553 -
554 - for(var i = 0; i < taxonomies.length; i++) {
555 - jQuery('#wpupg_filter_dropdown_label_taxonomy_' + taxonomies[i]).show();
556 - }
557 - } else {
558 - jQuery('.wpupg_dropdown_labels').hide();
559 - }
560 -};
561 -
562 431 WPUltimatePostGrid.changedIsotopeFilterStyle = function() {
563 432 var margin_vertical = parseInt(jQuery('#wpupg_isotope_filter_style_margin_vertical').val());
564 433 var margin_horizontal = parseInt(jQuery('#wpupg_isotope_filter_style_margin_horizontal').val());
565 434 var padding_vertical = parseInt(jQuery('#wpupg_isotope_filter_style_padding_vertical').val());
@@ -593,14 +462,9 @@
593 462 };
594 463
595 464 WPUltimatePostGrid.changedIsotopeFilterText = function() {
596 465 var text = jQuery('#wpupg_isotope_filter_style_all_button_text').val();
597 -
598 - if(text.length > 0) {
599 - jQuery('#wpupg_isotope_filter_style_all_button_text_preview').text(text).show();
600 - } else {
601 - jQuery('#wpupg_isotope_filter_style_all_button_text_preview').hide();
602 - }
466 + jQuery('#wpupg_isotope_filter_style_all_button_text_preview').text(text);
603 467 };
604 468
605 469
606 470 WPUltimatePostGrid.changedLayoutMode = function() {
@@ -653,17 +517,16 @@
653 517 jQuery('#wpupg_form_pagination').find('tbody').not('.wpupg_pagination_' + pagination_type).not('.wpupg_pagination_none').hide();
654 518 jQuery('#wpupg_form_pagination').find('tbody.wpupg_pagination_' + pagination_type).show();
655 519
656 520 // Premium only pagination
657 - if(pagination_type == 'none' || pagination_type == 'pages') {
521 + if(pagination_type == 'load_more') {
522 + WPUltimatePostGrid.checkPremiumFeatures('pagination_type', true);
523 + } else {
658 524 WPUltimatePostGrid.checkPremiumFeatures('pagination_type', false);
659 - } else {
660 - WPUltimatePostGrid.checkPremiumFeatures('pagination_type', true);
661 525 }
662 526
663 527 // Hide & Show Pagination Styles
664 - if(pagination_type != 'none' && pagination_type != 'infinite_load' && pagination_type != 'load_filter') {
665 - pagination_type = pagination_type == 'load_more_filter' ? 'load_more' : pagination_type;
528 + if(pagination_type != 'none') {
666 529 jQuery('#wpupg_meta_box_pagination_style').show().find('.wpupg_filter_preview').hide();
667 530 jQuery('#wpupg_filter_preview_pagination_style_' + pagination_type).show();
668 531 } else {
669 532 jQuery('#wpupg_meta_box_pagination_style').hide();