1(function ( ) { 2 "use strict"; 3 4 function realtimeSearch ($el) { 5 var options, $output, $pagination, $forms, xhr; 6 7 options = $.extend( 8 { 9 "output": ".realtime-output", 10 "pagination": ".pagination", 11 "forms": "form", 12 "errorText": '<div class="alert alert-danger"><h1>Something went wrong</h1><p>Please reload and try again.</p></div>' 13 }, 14 $el.data() 15 ); 16 17 function go (url, data, type) { 18 if (xhr) { 19 xhr.abort(); 20 } 21 22 xhr = $.ajax({ 23 "url": url, 24 "data": data, 25 "dataType": "html", 26 "type": type 27 }).done(display); 28 }; 29 30 function display (data) { 31 if (data) { 32 $output.html($(data).find(options.output).html()); 33 $output.find(".responsive-image").responsiveImage(); 34 } else { 35 $output.html(options.errorText); 36 } 37 }; 38 39 function paginationClick (e) { 40 var $this = $(this); 41 42 e.preventDefault(); 43 44 go($this.attr("href")); 45 }; 46 47 function formSubmit (e) { 48 var $this = $(this); 49 50 e.preventDefault(); 51 52 go($this.attr("action"), $this.serialize(), $this.attr("method")); 53 }; 54 55 function inputChange ( ) { 56 $(this).closest("form").submit(); 57 }; 58 59 $output = $(options.output); 60 $forms = $(options.forms); 61 62 $output.on("click", options.pagination, paginationClick); 63 $forms.on("submit", formSubmit); 64 $forms.on("change", "input", inputChange); 65 66 return { 67 }; 68 }; 69 70 $.fn.realtimeSearch = jQueryPlugin("realtimeSearch", realtimeSearch); 71 72 $(".realtime-search").realtimeSearch(); 73}());
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.