1function sp_viewport() { 2 var e = window, a = 'inner'; 3 if ( ! ('innerWidth' in window )) { 4 a = 'client'; 5 e = document.documentElement || document.body; 6 } 7 return { width : e[ a + 'Width' ] , height : e[ a + 'Height' ] }; 8} 9 10(function($) { 11 12 /* Header */ 13 if ( ! $( '.sp-header' ).length ) { 14 $( 'body' ).prepend( '<div class="sp-header sp-header-loaded"></div>' ); 15 } 16 17 /* Countdown */ 18 $( "[data-countdown]" ).each( 19 function() { 20 var $this = $( this ); 21 // Get countdown time 22 var countDownDate = new Date( $( this ).data( 'countdown' ) ).getTime(); 23 // Iterate every second 24 var x = setInterval( 25 function() { 26 27 // Get todays date and time 28 var now = new Date(); 29 30 // Convert curent date and time to UTC 31 var tzDifference = now.getTimezoneOffset(); 32 var nowutc = new Date( now.getTime() + tzDifference * 60 * 1000 ); 33 34 // Find the distance between now and the count down date 35 var distance = countDownDate - nowutc; 36 if ( distance < 0 ) { 37 distance = 0; 38 } 39 40 // Time calculations for days, hours, minutes and seconds 41 var days = Math.floor( distance / (1000 * 60 * 60 * 24) ); 42 var hours = Math.floor( (distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60) ); 43 var minutes = Math.floor( (distance % (1000 * 60 * 60)) / (1000 * 60) ); 44 var seconds = Math.floor( (distance % (1000 * 60)) / 1000 ); 45 46 // Output the result 47 $this.html( 48 "<span>" + (days < 10 ? '0' + days : days) + " <small>" + localized_strings.days + "</small></span> " 49 + "<span>" + ('0' + hours).slice( -2 ) + " <small>" + localized_strings.hrs + "</small></span> " 50 + "<span>" + ('0' + minutes).slice( -2 ) + " <small>" + localized_strings.mins + "</small></span> " 51 + "<span>" + ('0' + seconds).slice( -2 ) + " <small>" + localized_strings.secs + "</small></span>" 52 ); 53 }, 54 1000 55 ); 56 } 57 ); 58 59 /* Scrollable Tables */ 60 $( ".sp-scrollable-table" ).wrap( "<div class=\"sp-scrollable-table-wrapper\"></div>" ); 61 62 /* Selector Redirect */ 63 $( ".sp-selector-redirect" ).change( 64 function() { 65 window.location = $( this ).val(); 66 } 67 ); 68 69 /* Template Tabs */ 70 $( ".sp-tab-menu-item a" ).click( 71 function() { 72 $template = $( this ).data( "sp-tab" ); 73 $( this ).closest( ".sp-tab-menu-item" ).addClass( "sp-tab-menu-item-active" ).siblings( ".sp-tab-menu-item" ).removeClass( "sp-tab-menu-item-active" ); 74 $( this ).closest( ".sp-tab-group" ).find( ".sp-tab-content-" + $template ).show().siblings( ".sp-tab-content" ).hide(); 75 return false; 76 } 77 ); 78 79 /* API method to get paging information */ 80 $.fn.dataTableExt.oApi.fnPagingInfo = function ( oSettings ) 81 { 82 return { 83 "iStart": oSettings._iDisplayStart, 84 "iEnd": oSettings.fnDisplayEnd(), 85 "iLength": oSettings._iDisplayLength, 86 "iTotal": oSettings.fnRecordsTotal(), 87 "iFilteredTotal": oSettings.fnRecordsDisplay(), 88 "iPage": oSettings._iDisplayLength === -1 ? 89 0 : Math.ceil( oSettings._iDisplayStart / oSettings._iDisplayLength ), 90 "iTotalPages": oSettings._iDisplayLength === -1 ? 91 0 : Math.ceil( oSettings.fnRecordsDisplay() / oSettings._iDisplayLength ) 92 }; 93 } 94 95 /* Data Tables */ 96 $( ".sp-data-table" ).each( 97 function() { 98 sortable = $( this ).hasClass( "sp-sortable-table" ); 99 paginated = $( this ).hasClass( "sp-paginated-table" ); 100 display_length = parseInt( $( this ).attr( "data-sp-rows" ) ); 101 if ( display_length == undefined || isNaN( display_length ) ) { 102 display_length = 10; 103 } 104 if ( $( this ).find( "tbody tr" ).length <= display_length ) { 105 paginated = false; 106 } 107 if ( sortable || paginated ) { 108 $( this ).dataTable( 109 { 110 "order": [], 111 "autoWidth": false, 112 "searching": false, 113 "info": false, 114 "paging": paginated, 115 "lengthChange": false, 116 "pagingType": "simple_numbers", 117 "pageLength": display_length, 118 "ordering": sortable, 119 "language": { 120 "aria": { 121 "sortAscending": "", 122 "sortDescending": "" 123 }, 124 "paginate": { 125 "previous": localized_strings.previous, 126 "next": localized_strings.next, 127 } 128 }, 129 "columnDefs": [ 130 { "type": "num-fmt", "targets": [ ".data-number", ".data-rank" ] }, 131 ] 132 } 133 ); 134 } 135 } 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.