1var portfolio = { 2 init: function() { 3 if ($(".portfolio-filters-section").length > 0) { 4 this.tagFiltering.init(); 5 } 6 7 if ($('[data-video-play]').length > 0) { 8 this.videoPlay.init(); 9 } 10 }, 11 12 tagFiltering: { 13 settings: { 14 tagFilterTimeout: null 15 }, 16 init: function() { 17 this.filterAllToggle.init(); 18 this.singleTagToggle.init(); 19 }, 20 21 filterAllToggle: { 22 init: function() { 23 // Bind to what, which should be re-set, what is the re-set 24 this.bindToggle('[data-behavior="clear-industry-filters"]', '#selected_industries_all', '.portfolio-filter-industry'); 25 this.bindToggle('[data-behavior="clear-channel-filters"]', '#selected_channels_all', '.portfolio-filter-channel'); 26 }, 27 28 bindToggle: function(resetToggle, resetInput, filterInputs) { 29 $(resetToggle).on("click", function (e) { 30 e.preventDefault(); 31 $(filterInputs).prop("checked", false); 32 $(resetInput).prop("checked", true); 33 portfolio.getContent(1); 34 }); 35 } 36 }, 37 38 singleTagToggle: { 39 init: function() { 40 this.bindToggle('[data-behavior="industries-filter"]', 'input[name="selected_industries"]', '#selected_industries_all'); 41 this.bindToggle('[data-behavior="channels-filter"]', 'input[name="selected_channels"]', '#selected_channels_all'); 42 }, 43 44 bindToggle: function(filterInputs, inputName, resetToggle) { 45 $(filterInputs).on("click", function () { 46 setTimeout( 47 function () { 48 var checkedSubcategoriesCount = $(inputName + ':checked').length; 49 $(resetToggle).prop("checked", checkedSubcategoriesCount > 0 ? false : true); 50 }, 51 0, 52 this 53 ); 54 clearTimeout(portfolio.tagFiltering.settings.tagFilterTimeout); 55 portfolio.tagFiltering.settings.tagFilterTimeout = setTimeout(function () { 56 portfolio.getContent(); 57 }, 600); 58 }); 59 } 60 } 61 }, 62 63 getContent() { 64 var industriesList = []; 65 var channelsList = [] 66 67 $('input[name="selected_industries"]:checked').each(function () { industriesList.push(this.value); }); 68 $('input[name="selected_channels"]:checked').each(function () { channelsList.push(this.value); }); 69 70 data = {}; 71 data.selected_industries = industriesList; 72 data.selected_channels = channelsList; 73 data.action = "lensthat_load_filtered_list"; 74 75 $.ajax({
76 type: "POST", 77 url: ajaxRequestURL, 78 data: data, 79 beforeSend() { 80 $('.portfolio-listing').append('<div class="loader"></div>'); 81 }, 82 success: function (postsList) { 83 if (!postsList) { 84 $(".portfolio-listing").html( 85 `<p class="alert">Sorry, no posts matched your criteria.</p>` 86 ); 87 } else { 88 $(".portfolio-listing").html(postsList); 89 portfolio.videoPlay.init(); 90 setTimeout(function () { 91 $("html, body").animate({ 92 scrollTop: $('.portfolio-listing').offset().top - 100, 93 }); 94 }, 500); 95 } 96 }, 97 error: function (_error) { 98 console.error("Error occured while fetching data."); 99 }, 100 }); 101 }, 102 103 videoPlay: { 104 init: function() { 105 this.bindPlay(); 106 }, 107 108 bindPlay: function() { 109 $('[data-video-play]').on('click', function(e) { 110 e.preventDefault(); 111 112 // Pause other videos 113 $('[data-video]').each( function(index, elem) { 114 elem.pause(); 115 const elemParent = $(elem).parent(); 116 if (elemParent.hasClass('video-playing')) { 117 elemParent 118 .addClass('video-loaded') 119 .removeClass('video-playing'); 120 } 121 }); 122 123 // Hide play button 124 const container = $(this).parent(); 125 container.addClass('video-playing'); 126 127 // Play the video 128 const video = container.find('video')[0]; 129 video.setAttribute('controls', 'true'); 130 video.play(); 131 132 133 }); 134 } 135 } 136} 137 138$(function () { 139 portfolio.init(); 140});
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.