1/**--------------------------------- 2 * basic.js 3 * 4 * ... 5 * author : takaaki koyama 6 * 7 * @use jQuery 1.2.6 later 8 ---------------------------------*/ 9;(function($){ 10 $(document).ready(function(){ 11 //rollover 12 // switching image xxx_off.xxx -> xxx_on.xxx 13 // if image name is bnr_xxxx or btn_xxx which don't has neme _off , _on 14 // fade effect on mouse over. 15 $("a img[src*='_on']").addClass("current"); 16 17 $("a img,:image").mouseover(function(){ 18 if ($(this).attr("src").match(/_off./)){ 19 $(this).attr("src",$(this).attr("src").replace("_off.", "_on.")); 20 return; 21 } 22 }); 23 24 $("a img[class!='current'],:image").mouseout(function(){ 25 if ($(this).attr("src").match(/_on./)){ 26 $(this).attr("src",$(this).attr("src").replace("_on.", "_off.")); 27 return; 28 } 29 }); 30 31 //preload images 32 var images = []; 33 $("a img,:image").each(function(index){ 34 if($(this).attr("src").match(/_off./)){ 35 images[index]= new Image(); 36 images[index].src = $(this).attr("src").replace("_on.", "_off."); 37 } 38 }); 39 40 //CSS3 selector 41// //last-child 42// $("li:last-child, dl > *:last-child, table > *:last-child, tr > *:last-child").addClass("last-child"); 43// 44// //nth-child 45// $("ol,ul").each(function(){ 46// $(this).children("li").each(function(index){ 47// $(this).addClass("n"+(index+1)+"th-child"); 48// }); 49// }); 50// $("dl").each(function(){ 51// $(this).children("dt").each(function(index){ 52// $(this).addClass("n"+(index+1)+"th-child"); 53// }); 54// $(this).children("dd").each(function(index){ 55// $(this).addClass("n"+(index+1)+"th-child"); 56// }); 57// }); 58// //:even, :odd 59// $("li:even,dt:even,dd:even,tr:even,tr > *:even").addClass("even"); 60// $("li:odd,dt:odd,dd:odd,td:odd,td > *:odd").addClass("odd"); 61 62 $("input,textarea") 63 .focus(function(){$(this).addClass("focus")}) 64 .blur(function(){$(this).removeClass("focus")}) 65 .hover(function(){$(this).addClass("hover")},function(){$(this).removeClass("hover")}); 66 67 68 // popup 69 // class="popup400x600" -> window.open(this.href,"popup","width=400,height=600,...) 70 $("a[class^='popup']").click(function(){ 71 if($.browser.safari ){ 72 window.open(this.href,"_blank"); 73 return false; 74 } 75 var className = $(this).attr("class").match(/^popup([0-9]{1,})x([0-9]{1,})/) ; 76 var width = RegExp.$1; 77 var height = RegExp.$2; 78 var state = ""; 79 var notHasSize = "yes" 80 if(width!=null && height !=null){ 81 state += "width="+width+",height="+height+","; 82 notHasSize = "no" 83 } 84 state += "location="+notHasSize+",toolbar="+notHasSize+",directories="+notHasSize+","; 85 state += "status=yes,menubar=no,scrollbars=yes,resizable=yes,alwaysRaised=yes"; 86 window.name = document.domain + "root"; 87 window.open(this.href,"popup"+(new Date()).getTime().toString(),state); 88 return false; 89 }); 90 // open in popup parent window. 91 // add class="openParentWin" on a-tag in a popup window. 92 $("a.openParentWin").click(function(){ 93 window.open(this.href,document.domain + "root"); 94 return false; 95 }); 96 97 // target _blank auto add 98 /* 99 var domains = [document.domain]; 100 var domain_selector = "" 101 var left_str= ":not([href^=http://"; 102 var left_str_https= ":not([href^=https://"; 103 var right_str = "])"; 104 domain_selector = left_str+domains.join(right_str+left_str)+right_str; 105 domain_selector+= left_str_https+domains.join(right_str+left_str_https)+right_str; 106 $("a[href^=http]:not([class^=popup])"+domain_selector+", area[href^=http]:not([class^=popup])"+domain_selector) 107 .addClass("external"); 108 */ 109 110 //if has class .external -> open _blank window 111 function windowOpen(){ 112 var w = window.open(this.href,"_blank"); 113 w.window.focus(); 114 return false; 115 } 116 117 //Smooth Scroll 118 function smoothScroll() { 119 var target = $(this.hash); 120 if(target.size()) { 121 var top = target.offset().top; 122 $($.browser.safari ? 'body' : 'html,body').animate({scrollTop:top}, 800, 'swing'); 123 } 124 return false; 125 } 126 127 $("a.external").bind("click",windowOpen);
128 $('a[href^=#]').bind("click",smoothScroll); 129 130 searchInput(); 131 }); 132 133 //serach from 134 var searchInput = function(){ 135 var $q = $("input[name='q']"); 136 var val_def = $q.val() 137 $q.focus(function(){ 138 if ($q.val() == val_def) $q.val(''); 139 }).blur(function(){ 140 if ($q.val() == '') $q.val(val_def); 141 }) 142 /* 143 $("form :image").click(function(){ 144 if($q .val() == val_def){ 145 return false; 146 }; 147 document.gs.submit(); 148 return false 149 }); 150 151 */ 152 } 153})(jQuery); 154 155
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.