1/************************************************************* 2* * 3* STRING FORMATTING * 4* * 5*************************************************************/ 6//------------------------------------------------------------ 7// Pad single digits with 0s 8//------------------------------------------------------------ 9function padZero( time ) { 10 if ( time < 10 ) { 11 return '0' + time; 12 } 13 return time; 14} 15//------------------------------------------------------------ 16// Get digital-clock styled time from seconds 17//------------------------------------------------------------ 18function secsToClock( secs ) { 19 hrs = Math.floor( secs / 3600 ); 20 secs -= hrs * 3600; 21 22 mins = Math.floor( secs / 60 ); 23 secs -= mins * 60; 24 25 time = ''; 26 if ( hrs > 0) { 27 time = hrs + ":"; 28 time += padZero( mins ); 29 } 30 else if ( mins > 0 ) { 31 time += mins; 32 } 33 time += ":" + padZero( secs ); 34 return time; 35} 36 37 38 39/************************************************************* 40* * 41* COOKIES * 42* * 43*************************************************************/ 44//------------------------------------------------------------ 45// Set a cookie. 46//------------------------------------------------------------ 47function setCookie( name, value, exp_days ) { 48 //------------------------- 49 // Build expiration date 50 //------------------------- 51 var date = new Date(); 52 date.setDate( date.getDate() + exp_days ); 53 var duration = ''; 54 if ( exp_days != null ) { 55 duration = '; expires=' + date.toUTCString(); 56 } 57 var value = escape( value ) + duration; 58 document.cookie = name + '=' + value; 59} 60//------------------------------------------------------------ 61// Retrieve a cookie value. 62//------------------------------------------------------------ 63function getCookie( name ) { 64 var i, check, value, ARRcookies = document.cookie.split(';'); 65 for ( i=0; i < ARRcookies.length; i++ ) { 66 check = ARRcookies[i].substr( 0, ARRcookies[i].indexOf('=') ); 67 value = ARRcookies[i].substr( ARRcookies[i].indexOf('=') + 1 ); 68 check = check.replace( /^\s+|\s+$/g,'' ); 69 if ( check == name ) { 70 return unescape( value ); 71 } 72 } 73} 74 75 76 77/************************************************************* 78* * 79* Array & Objects * 80* * 81*************************************************************/ 82//-------------------- 83// Count object keys 84//-------------------- 85function objectSize( obj ) { 86 var size = 0; 87 for ( key in obj ) { 88 size++; 89 } 90 return size; 91}; 92 93 94 95/************************************************************* 96* * 97* Standalone jQuery Functions * 98* * 99*************************************************************/ 100(function($){ 101 $.fn.replaceTagName = function(a){ 102 var t = []; 103 for(var i = this.length - 1; 0 <= i ; i--) { 104 var n = document.createElement(a); 105 n.innerHTML = this[i].innerHTML; 106 $.each(this[i].attributes, function(j, v) { 107 $(n).attr(v.name, v.value); 108 }); 109 $(this[i]).after(n).remove(); 110 t[i] = n; 111 } 112 return $(t); 113 }; 114})(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.