1/*--------------------------------------------------------------------------* 2 * 3 * SmoothScroll JavaScript Library beta1 4 * 5 * MIT-style license. 6 * 7 * 2007 Kazuma Nishihata 8 * http://www.webcreativepark.net 9 * 10 *--------------------------------------------------------------------------*/ 11 12new function(){ 13 14 /* 15 *ã¤ãã³ã追å ç¨ 16 -------------------------------------------------*/ 17 function addEvent(elm,listener,fn){ 18 try{ // IE 19 elm.addEventListener(listener,fn,false); 20 }catch(e){ 21 elm.attachEvent( 22 "on"+listener 23 ,function(){ 24 fn.apply(elm,arguments) 25 } 26 ); 27 } 28 } 29 30 /* 31 *ã¹ã ã¼ãºã¹ã¯ãã¼ã« 32 -------------------------------------------------*/ 33 function SmoothScroll(a){ 34 if(document.getElementById(a.rel.replace(/.*\#/,""))){ 35 var e = document.getElementById(a.rel.replace(/.*\#/,"")); 36 }else{ 37 return; 38 } 39 40 //ç§»åä½ç½® 41 var end=e.offsetTop 42 //ç¾å¨ä½ç½® 43 var start=window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0; 44 45 var flag=(end<start)?"up":"down"; 46 47 function scrollMe(start,end,flag) { 48 49 setTimeout( 50 function(){ 51 if(flag=="up" && start >= end){ 52 start=start-(start-end)/20-1; 53 window.scrollTo(0,start) 54 arguments.callee(start,end,flag); 55 56 }else if(flag=="down" && start <= end){ 57 start=start+(end-start)/20+1; 58 59 window.scrollTo(0,start) 60 arguments.callee(start,end,flag); 61 62 }else{ 63 scrollTo(0,end); 64 } 65 } 66 ,200 67 ); 68 69 } 70 scrollMe(start,end,flag) 71 } 72 73 /* 74 *ã¹ã ã¼ãºå¤æã¹ã¯ãªãã 75 -------------------------------------------------*/ 76 addEvent(window,"load",function(){ 77 var anchors = document.getElementsByTagName("a"); 78 for(var i = 0 ; i<anchors.length ; i++){ 79 if(anchors[i].href.replace(/\#[a-zA-Z0-9]+/,"") == location.href.replace(/\#[a-zA-Z0-9]+/,"")){ 80 anchors[i].rel = anchors[i].href; 81 anchors[i].href = "javascript:void(0)"; 82 anchors[i].onclick=function(){SmoothScroll(this)} 83 } 84 } 85 }); 86 87}
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.