1jQuery(document).ready(function ($) { 2 3 function toggleExcerpt() { 4 $('.shows-show').hover(function () { 5 $('.show-excerpt', this).stop().slideDown('fast'); 6 }, function () { 7 $('.show-excerpt', this).stop().slideUp('slow'); 8 }); 9 } 10 toggleExcerpt(); 11 12 //If the user goes back to a previously filtered page, set the filters again 13 function filterShows(filterName, filterValue) { 14 $.ajax({ 15 url: shows.ajax_url, 16 type: 'post', 17 dataType: 'json', 18 data: { 19 action: 'filterShows', 20 filterName: filterName, 21 filterValue: filterValue 22 }, 23 success: function (response) { 24 $('#posts-container').replaceWith(response); 25 toggleExcerpt(); 26 $(window).scroll(function () { 27 if ($('#authorMeta').val() !== 'default') { 28 filterName = 'authorMeta'; 29 filterValue = $('#authorMeta').val(); 30 } else if ($('#genre').val() !== 'default') { 31 filterName = 'genre'; 32 filterValue = $('#genre').val(); 33 } 34 if ($(document).height() - $(window).height() === $(window).scrollTop()) { 35 infiniteScroll('filterShows', $('.shows-show').length, filterName, filterValue); 36 } 37 }); 38 } 39 }); 40 } 41 if ($('#authorMeta').length > 0 && $('#authorMeta').val() !== 'default') { 42 $('.total-shows').remove(); 43 $('#posts-container').hide(); 44 filterShows('authorMeta', $('#authorMeta').val()); 45 } 46 if ($('#genre').length > 0 && $('#genre').val() !== 'default') { 47 $('.total-shows').remove(); 48 $('#posts-container').hide(); 49 filterShows('genre', $('#genre').val()); 50 } 51 52 // Filter the shows by author or by genre 53 $('#genre, #authorMeta').on('change', function (event) { 54 var filterValue = $(this).val(); 55 // reset previously set filters; 56 $('.shows-filters select:not(#' + event.target.id + ')').val('default'); 57 $.ajax({ 58 url: shows.ajax_url, 59 type: 'post', 60 dataType: 'json', 61 data: { 62 action: 'filterShows', 63 filterName: event.target.id, 64 filterValue: filterValue 65 }, 66 success: function (response) { 67 $('#posts-container').fadeOut('slow', function () { 68 $('.total-shows').remove(); 69 $(this).replaceWith(response); 70 toggleExcerpt(); 71 $(window).scroll(function () { 72 if ($(document).height() - $(window).height() === $(window).scrollTop() && $('#' + event.target.id).val() !== 'default') { 73 infiniteScroll('filterShows', $('.shows-show').length, event.target.id, $('#' + event.target.id).val()); 74 } 75 }); 76 }); 77 } 78 }); 79 }); 80 81 // Change order of the alphabetical sort, by show name 82 $('#alphabetic').on('change', function () { 83 var shows = $('.shows-show'); 84 var showsArray = $.makeArray(shows); 85 showsArray.reverse(); 86 var showsHtml = ''; 87 for (var i = 0; i < showsArray.length; i++) { 88 showsHtml += showsArray[i].outerHTML; 89 } 90 $('#posts-container').html(showsHtml); 91 toggleExcerpt(); 92 }); 93 94 // Toggle display of the search input 95 $('#showsSearch').on('click', function () { 96 $('.shows-filters div').hide(); 97 $('#searchForm').show(); 98 }); 99 $('#closeSearch').on('click', function () { 100 $('#searchForm').hide(); 101 $('.shows-filters div:not(#searchForm)').show(); 102 }); 103 104 // Infinite scrolling 105 function infiniteScroll(action, offset, filterName, filterValue) { 106 if ($('.loading').length < 1 && offset < parseInt($('.total-shows p span').html())) { 107 $('#posts-container').append('<div class="loading"><p>Se încarcÄ mai multe</p><div><div></div><div></div><div></div><div></div><div></div></div></div>'); 108 109 var i = 0; 110 var squares = $('.loading div div'); 111 setInterval(function () { 112 $(squares[i]).css('background-color', '#000'); 113 i++; 114 if (i > squares.length) { 115 for (j = 0, k = 0.9; j < squares.length; j++, k -= 0.2) { 116 $(squares[j]).css('background-color', 'rgba(0, 0, 0, ' + k + ')'); 117 } 118 i = 0; 119 } 120 }, 150); 121 122 $.ajax({ 123 url: shows.ajax_url, 124 type: 'post', 125 dataType: 'json', 126 data: { 127 action: action, 128 queryOffset: offset, 129 filterName: filterName, 130 filterValue: filterValue 131 }, 132 success: function (response) { 133 $('.loading').remove(); 134 $('#posts-container').append(response); 135 toggleExcerpt(); 136 } 137 }); 138 } 139 } 140 141 $(window).scroll(function () { 142 if ((3 / 4 * ($(document).height() - $(window).height())) < $(window).scrollTop() && $('#genre').val() === 'default' && $('#authorMeta').val() === 'default') { 143 infiniteScroll('loadMoreShows', $('.shows-show').length); 144 } 145 }); 146 147});
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.