1var cache = []; 2 3$(window).on('popstate', function() { 4 var url = window.location.search; 5 console.log(cache); 6 if (cache[url] == undefined) { 7 url = 'index.php'+url; 8 } 9 if (cache[url] != undefined) { 10 link = cache[url][0]; 11 loadArea = cache[url][1]; 12 reloadLoadArea = cache[url][2]; 13 runAjax(link,loadArea,reloadLoadArea,false); 14 //delete cache[link]; 15 } 16}); 17 18function runAjax(link,loadArea,reloadLoadArea,addcache) { 19 var loadAreaID = loadArea.prop('id'); 20 var contentID = loadArea.data("ajaxloadalso"); 21 if (typeof addcache === 'undefined') { 22 addcache = true; 23 } 24 if (reloadLoadArea == true) { 25 loadArea.css('opacity',0.5); 26 } 27 if (contentID != undefined ) { 28 for (i = 0; i < contentID.length; ++i) { 29 $("#"+contentID[i]).css('opacity',0.5); 30 } 31 } 32 33 $.ajax({ 34 url: link, 35 context: document.body 36 }).done(function( data) { 37 if (addcache) { 38 cache[link] = [link,loadArea,reloadLoadArea]; 39 window.history.pushState(link, link, link); 40 } 41 42 if (reloadLoadArea == true) { 43 loadArea.html($(data).find("#"+loadAreaID).html()).css('opacity',1); 44 } 45 46 if (contentID != undefined ) { 47 for (i = 0; i < contentID.length; ++i) { 48 $("#"+contentID[i]).html($(data).find("#"+contentID[i]).html()).css('opacity',1); 49 } 50 } 51 categories_trigger(); 52 }); 53 54} 55 56 57 58$("body").on("click",".ajax-load-area .ajax-load-link a,a.ajax-load-link",function(event){ 59 if(($('#calendar_events').length || $('#calendar_page').length)) { 60 event.preventDefault(); 61 var link = $(this).attr("href"); 62 var loadArea = $(this).parents('.ajax-load-area'); 63 var loadAreaID = loadArea.prop('id'); 64 if(loadAreaID != 'searchoptions' && loadAreaID != 'searchoptions-generic' ) 65 runAjax(link,loadArea,true); 66 67 if($(this).parents('.pagination').length) { 68 $('html, body').animate({scrollTop: $("#calendar_events").offset().top - $('header').height() }, 1000); 69 } 70 } 71}); 72 73function handleForm(container) { 74 if($('#calendar_events').length || $('#calendar_page').length) { 75 var loadArea = container.parents('.ajax-load-area'); 76 var loadAreaID = loadArea.prop('id'); 77 console.log(loadAreaID); 78 var link = $("#" + loadAreaID + " form").attr("action")+"?"+$("#" + loadAreaID + " form").serialize(); 79 runAjax(link,loadArea,false); 80 } 81} 82 83$("body").on('click', "#searchoptions form :checkbox, #searchoptions-generic form :checkbox, #searchoptions-categories form :checkbox, #past_events form :checkbox",function(event){ 84 handleForm($(this)); 85}); 86$("body").on('click', "#searchoptions-dates input[type=submit], #jumptoform input[type=submit], #jumptoform button",function(event){ 87 handleForm($(this)); 88 return false; 89}); 90 91//input[text] keywords 92var delay = (function(){ 93 var timer = 0; 94 return function(callback, ms){ 95 clearTimeout (timer); 96 timer = setTimeout(callback, ms); 97 }; 98})(); 99 100$("body").on('keyup',"#searchoptions input[type=text], #searchoptions-generic input[type=text]",function(event){ 101 if($('#calendar_events').length || $('#calendar_page').length) { 102 var inputText = $(this); 103 delay(function(){ 104 handleForm(inputText); 105 }, 500 ); 106 } 107}); 108 109$("body").on("keypress","#searchoptions form, #searchoptions-generic form", function(e) { 110 if (e.keyCode == 13) { 111 e.preventDefault(); 112 return false; 113 } 114}); 115 116$("#calendar_page").on('mouseenter mouseleave'," .cal-event a",function(event){ 117 $(this).removeAttr("title"); 118 event.preventDefault(); 119 var contentID = $(this).data("tooltipcal"); 120 $("#" + contentID).toggleClass("active"); 121}); 122 123function categories_trigger(){ 124 $('.ajax-load-area .categories_trigger a').each(function(){ 125 var baseurl = $(this).parent('.categories_trigger').data("baseurl"); 126 var catname = $(this).text(); 127 caturl = catname.replace(/ /gi,"+"); 128 caturl = caturl.replace(/&/gi,"%26"); 129 130 131 $(this).attr("href",baseurl+"&categories[]="+caturl); 132 $(this).data("catname",catname); 133 var sub = catname.split(">"); 134 if (sub[1] != "") { 135 $(this).html(sub[1]); 136 } 137 }); 138} 139categories_trigger(); 140 141 142function remove_filter() { 143 if(!$('.event-filter').length) { 144 $('.clear-filters').addClass('is-hidden'); 145 } else { 146 $('.clear-filters').removeClass('is-hidden'); 147 } 148 149 $('body').on('click','.event-filter', function(e) { 150 var clicked = $(this); 151 if (clicked.attr('data-category') && clicked.hasClass('category-filter')) { 152 var category = clicked.attr('data-category'); 153 $('input[data-category="' + category + '"]').trigger('click'); 154 155 } 156 if(clicked.hasClass('keywords-filter')) { 157 if($('#searchoptions').length) { 158 $('#searchoptions input[type=text]').val('').trigger('keyup'); 159 } 160 if($('#searchoptions-generic').length) { 161 $('#searchoptions-generic input[type=text]').val('').trigger('keyup'); 162 } 163 } 164 if(clicked.hasClass('past-filter')) { 165 $('input#past').trigger('click'); 166 } 167 168 clicked.remove(); 169 if(!$('.event-filter').length) { 170 $('.clear-filters').addClass('is-hidden'); 171 } else { 172 $('.clear-filters').removeClass('is-hidden'); 173 } 174 }); 175} 176remove_filter(); 177
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.