1(function($) { 2 $doc = $(document); 3 4 $doc.ready( function() { 5 6 /** 7 * Retrieve posts 8 */ 9 function get_posts($params) { 10 11 $container = $('#container-async'); 12 $content = $container.find('.content'); 13 $status = $container.find('.status'); 14 $pager = $container.find('.infscr-pager a'); 15 16 $status.text('Caricando i post...'); 17 18 /** 19 * Reset Pager for infinite scroll 20 */ 21 if ( $params.page === 1 && $pager.length ) { 22 $pager.removeAttr('disabled').text('CARICA ALTRI CASE STUDIES'); 23 } 24 25 if ( $pager.length ) { 26 $method = 'infscr'; 27 } 28 else { 29 $method = 'pager'; 30 } 31 32 $.ajax({ 33 url: bobz.ajax_url, 34 data: { 35 action: 'do_filter_posts', 36 nonce: bobz.nonce, 37 params: $params, 38 pager: $method 39 }, 40 type: 'post', 41 dataType: 'json', 42 success: function(data, textStatus, XMLHttpRequest) { 43 44 if (data.status === 200) { 45 if (data.method === 'pager' || $params.page === 1 ) { 46 $content.html(data.content); 47 } 48 /** 49 * Append content for infinite scroll 50 */ 51 else { 52 $content.append(data.content); 53 54 if (data.next !== 0) { 55 $pager.attr('href', '#page-' + data.next); 56 } 57 } 58 } 59 else if (data.status === 201) { 60 if (data.method === 'pager' ) { 61 $content.html(data.message); 62 } 63 else { 64 $pager.attr('disabled', 'disabled').text('You reached the end'); 65 } 66 } 67 else { 68 $status.html(data.message); 69 } 70 }, 71 error: function(MLHttpRequest, textStatus, errorThrown) { 72 73 $status.html(textStatus); 74 75 /*console.log(MLHttpRequest); 76 console.log(textStatus); 77 console.log(errorThrown);*/ 78 }, 79 complete: function(data, textStatus) { 80 81 msg = textStatus; 82 83 if (textStatus === 'success') { 84 msg = data.responseJSON.found; 85 } 86 87 $status.text('Posts found: ' + msg); 88 89 /*console.log(data); 90 console.log(textStatus);*/ 91 } 92 }); 93 } 94 95 /** 96 * Bind get_posts to tag cloud and navigation 97 */ 98 $('#container-async').on('click', 'a[data-filter], option[data-filter], .pagination a', function(event) { 99 if(event.preventDefault) { event.preventDefault(); } 100 101 $this = $(this); 102 103 /** 104 * Set filter active 105 */ 106 if ($this.data('filter')) { 107 $this.closest('ul').find('.active').removeClass('active'); 108 $this.parent('li').addClass('active'); 109 $page = $this.data('page'); 110 $('.filtro').change(function() { 111 $('option:selected', this).addClass('active').siblings().removeClass('active'); 112 }); 113 } 114 else { 115 /** 116 * Pagination 117 */ 118 $page = parseInt($this.attr('href').replace(/\D/g,'')); 119 $this = $('.nav-filter .active a'); 120 $this = $('.filtro option.active'); 121 } 122 123 124 $params = { 125 'page' : $page, 126 'tax' : $this.data('filter'), 127 'term' : $this.data('term'), 128 'qty' : $this.closest('#container-async').data('paged'), 129 }; 130 131 // Run query 132 get_posts($params); 133 }); 134 135 $('a[data-term="all-terms"], option[data-term="all-terms"]').trigger('click'); 136 }); 137 138})(jQuery);
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.