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 +5 -130 2.01.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,17 +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 198 WPUltimatePostGrid.changedMultiselect();
223 - WPUltimatePostGrid.changedLimitTerms();
224 - WPUltimatePostGrid.changedDropdownLabels();
225 199 WPUltimatePostGrid.changedIsotopeFilterStyle();
226 200 WPUltimatePostGrid.changedIsotopeFilterText();
227 201 WPUltimatePostGrid.changedLayoutMode();
228 202 WPUltimatePostGrid.changedPaginationStyle();
@@ -229,11 +203,9 @@
229 203 WPUltimatePostGrid.changedPaginationType();
230 204 WPUltimatePostGrid.changedPaginationText();
231 205
232 206 // Events
233 - jQuery('#wpupg_type').on('change', function() { WPUltimatePostGrid.changedType(); });
234 207 jQuery('#wpupg_post_types').on('change', function() { WPUltimatePostGrid.changedPostType(); });
235 - jQuery('#wpupg_order_by').on('change', function() { WPUltimatePostGrid.changedOrderBy(); });
236 208 jQuery('#wpupg_limit_posts').on('change', function() { WPUltimatePostGrid.changedLimitPosts(); });
237 209 jQuery('#wpupg_add_rule').on('click', function(e) { e.preventDefault(); WPUltimatePostGrid.addRule(); });
238 210 jQuery('.wpupg_rule_delete').on('click', function(e) { e.preventDefault(); WPUltimatePostGrid.removeRule(jQuery(this).parents('tr').attr('data-rule')); });
239 211 jQuery('.wpupg_rule_field').on('change', function(e) { WPUltimatePostGrid.changedRuleField(jQuery(this).parents('tr').attr('data-rule')); });
@@ -240,10 +212,8 @@
240 212 jQuery('.rule_container_wpupg_general_date').find('select').on('change', function(e) { WPUltimatePostGrid.changedDateRule(jQuery(this).parents('tr').attr('data-rule')); });
241 213 jQuery('.wpupg-date').on('change', function(e) { WPUltimatePostGrid.changedDateRule(jQuery(this).parents('tr').attr('data-rule')); });
242 214 jQuery('#wpupg_filter_type').on('change', function() { WPUltimatePostGrid.changedFilterType(); });
243 215 jQuery('#wpupg_filter_multiselect').on('change', function() { WPUltimatePostGrid.changedMultiselect(); });
244 - jQuery('.wpupg_filter_taxonomy').on('change', function() { WPUltimatePostGrid.changedLimitTerms(); WPUltimatePostGrid.changedDropdownLabels(); });
245 - jQuery('#wpupg_filter_limit').on('change', function() { WPUltimatePostGrid.changedLimitTerms(); });
246 216 jQuery('#wpupg_layout_mode').on('change', function() { WPUltimatePostGrid.changedLayoutMode(); });
247 217 jQuery('#wpupg_pagination_type').on('change', function() { WPUltimatePostGrid.changedPaginationType(); });
248 218 jQuery('#wpupg_pagination_load_more_button_text').on('change keyup', function() { WPUltimatePostGrid.changedPaginationText(); });
249 219
@@ -314,38 +284,8 @@
314 284 }
315 285 });
316 286 };
317 287
318 -WPUltimatePostGrid.changedType = function() {
319 - var type = jQuery('#wpupg_type').find(':selected').val();
320 -
321 - if( type == 'terms' ) {
322 - WPUltimatePostGrid.checkPremiumFeatures('type', true);
323 - jQuery('#wpupg_meta_box_data_source_terms').show();
324 -
325 - jQuery('#wpupg_meta_box_data_source').hide();
326 - jQuery('#wpupg_meta_box_limit_posts').hide();
327 - jQuery('#wpupg_meta_box_filter').hide();
328 - jQuery('#wpupg_meta_box_isotope_filter').hide();
329 - jQuery('#wpupg_meta_box_pagination').hide();
330 - jQuery('#wpupg_meta_box_pagination_style').hide();
331 - } else {
332 - WPUltimatePostGrid.checkPremiumFeatures('type', false);
333 - jQuery('#wpupg_meta_box_data_source_terms').hide();
334 -
335 - jQuery('#wpupg_meta_box_data_source').show();
336 - jQuery('#wpupg_meta_box_limit_posts').show();
337 - jQuery('#wpupg_meta_box_filter').show();
338 - jQuery('#wpupg_meta_box_isotope_filter').show();
339 - jQuery('#wpupg_meta_box_pagination').show();
340 - jQuery('#wpupg_meta_box_pagination_style').show();
341 -
342 - WPUltimatePostGrid.changedLimitPosts();
343 - WPUltimatePostGrid.changedFilterType();
344 - WPUltimatePostGrid.changedPaginationType();
345 - }
346 -};
347 -
348 288 WPUltimatePostGrid.changedPostType = function() {
349 289 var post_type = jQuery('#wpupg_post_types').find(':selected').val();
350 290
351 291 jQuery('.wpupg_filter_taxonomy_container').hide();
@@ -362,24 +302,10 @@
362 302 WPUltimatePostGrid.filter_possible = false;
363 303 }
364 304
365 305 WPUltimatePostGrid.changedFilterType();
366 - WPUltimatePostGrid.changedLimitTerms();
367 - WPUltimatePostGrid.changedDropdownLabels();
368 306 };
369 307
370 -WPUltimatePostGrid.changedOrderBy = function() {
371 - var order_by = jQuery('#wpupg_order_by').find(':selected').val();
372 -
373 - if(order_by == 'custom') {
374 - WPUltimatePostGrid.checkPremiumFeatures('order_by', true);
375 - jQuery('.wpupg_order_custom_key_container').show();
376 - } else {
377 - WPUltimatePostGrid.checkPremiumFeatures('order_by', false);
378 - jQuery('.wpupg_order_custom_key_container').hide();
379 - }
380 -};
381 -
382 308 WPUltimatePostGrid.changedLimitPosts = function() {
383 309 if(jQuery('#wpupg_limit_posts').is(':checked')) {
384 310 WPUltimatePostGrid.checkPremiumFeatures('limit_posts', true);
385 311 jQuery('#wpupg_meta_box_limit_posts').show();
@@ -487,11 +413,8 @@
487 413
488 414 if(WPUltimatePostGrid.filter_possible) {
489 415 jQuery('#wpupg_meta_box_' + filter_type + '_filter').show();
490 416 }
491 -
492 - WPUltimatePostGrid.changedLimitTerms();
493 - WPUltimatePostGrid.changedDropdownLabels();
494 417 };
495 418
496 419 WPUltimatePostGrid.changedMultiselect = function() {
497 420 var multiselect = jQuery('#wpupg_filter_multiselect').is(':checked');
@@ -504,50 +427,8 @@
504 427 jQuery('.wpupg_multiselect').hide();
505 428 }
506 429 };
507 430
508 -WPUltimatePostGrid.changedLimitTerms = function() {
509 - var limit_terms = jQuery('#wpupg_filter_limit').is(':checked');
510 - var post_type = jQuery('#wpupg_post_types').find(':selected').val();
511 - var taxonomies = jQuery('#wpupg_filter_taxonomy_' + post_type).val();
512 -
513 - if( !jQuery.isArray( taxonomies ) ) {
514 - taxonomies = [taxonomies];
515 - }
516 -
517 - if(limit_terms && taxonomies) {
518 - jQuery('.wpupg_limit_terms').show();
519 - jQuery('.wpupg_filter_terms_taxonomy').hide();
520 -
521 - for(var i = 0; i < taxonomies.length; i++) {
522 - jQuery('#wpupg_filter_terms_taxonomy_' + taxonomies[i]).show();
523 - }
524 - } else {
525 - jQuery('.wpupg_limit_terms').hide();
526 - }
527 -};
528 -
529 -WPUltimatePostGrid.changedDropdownLabels = function() {
530 - var filter_type = jQuery('#wpupg_filter_type').find(':selected').val();
531 - var post_type = jQuery('#wpupg_post_types').find(':selected').val();
532 - var taxonomies = jQuery('#wpupg_filter_taxonomy_' + post_type).val();
533 -
534 - if( !jQuery.isArray( taxonomies ) ) {
535 - taxonomies = [taxonomies];
536 - }
537 -
538 - if(filter_type == 'dropdown' && taxonomies) {
539 - jQuery('.wpupg_dropdown_labels').show();
540 - jQuery('.wpupg_filter_dropdown_labels_taxonomy').hide();
541 -
542 - for(var i = 0; i < taxonomies.length; i++) {
543 - jQuery('#wpupg_filter_dropdown_label_taxonomy_' + taxonomies[i]).show();
544 - }
545 - } else {
546 - jQuery('.wpupg_dropdown_labels').hide();
547 - }
548 -};
549 -
550 431 WPUltimatePostGrid.changedIsotopeFilterStyle = function() {
551 432 var margin_vertical = parseInt(jQuery('#wpupg_isotope_filter_style_margin_vertical').val());
552 433 var margin_horizontal = parseInt(jQuery('#wpupg_isotope_filter_style_margin_horizontal').val());
553 434 var padding_vertical = parseInt(jQuery('#wpupg_isotope_filter_style_padding_vertical').val());
@@ -581,14 +462,9 @@
581 462 };
582 463
583 464 WPUltimatePostGrid.changedIsotopeFilterText = function() {
584 465 var text = jQuery('#wpupg_isotope_filter_style_all_button_text').val();
585 -
586 - if(text.length > 0) {
587 - jQuery('#wpupg_isotope_filter_style_all_button_text_preview').text(text).show();
588 - } else {
589 - jQuery('#wpupg_isotope_filter_style_all_button_text_preview').hide();
590 - }
466 + jQuery('#wpupg_isotope_filter_style_all_button_text_preview').text(text);
591 467 };
592 468
593 469
594 470 WPUltimatePostGrid.changedLayoutMode = function() {
@@ -641,17 +517,16 @@
641 517 jQuery('#wpupg_form_pagination').find('tbody').not('.wpupg_pagination_' + pagination_type).not('.wpupg_pagination_none').hide();
642 518 jQuery('#wpupg_form_pagination').find('tbody.wpupg_pagination_' + pagination_type).show();
643 519
644 520 // Premium only pagination
645 - if(pagination_type == 'none' || pagination_type == 'pages') {
521 + if(pagination_type == 'load_more') {
522 + WPUltimatePostGrid.checkPremiumFeatures('pagination_type', true);
523 + } else {
646 524 WPUltimatePostGrid.checkPremiumFeatures('pagination_type', false);
647 - } else {
648 - WPUltimatePostGrid.checkPremiumFeatures('pagination_type', true);
649 525 }
650 526
651 527 // Hide & Show Pagination Styles
652 - if(pagination_type != 'none' && pagination_type != 'infinite_load' && pagination_type != 'load_filter') {
653 - pagination_type = pagination_type == 'load_more_filter' ? 'load_more' : pagination_type;
528 + if(pagination_type != 'none') {
654 529 jQuery('#wpupg_meta_box_pagination_style').show().find('.wpupg_filter_preview').hide();
655 530 jQuery('#wpupg_filter_preview_pagination_style_' + pagination_type).show();
656 531 } else {
657 532 jQuery('#wpupg_meta_box_pagination_style').hide();