1//** Tab Content script v2.0- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com) 2 3function dinamods(tabinterfaceid){this.tabinterfaceid=tabinterfaceid;this.tabs=document.getElementById(tabinterfaceid).getElementsByTagName("a");this.enabletabpersistence=true;this.hottabspositions=[];this.currentTabIndex=0; this.subcontentids=[];this.revcontentids=[];this.selectedClassTarget="link";} 4dinamods.getCookie=function(Name){ 5 var re=new RegExp(Name+"=[^;]+", "i"); 6 if (document.cookie.match(re)) 7 return document.cookie.match(re)[0].split("=")[1]; 8 return ""; 9} 10dinamods.setCookie=function(name, value){ 11 document.cookie = name+"="+value+";path=/"; 12} 13dinamods.prototype={ 14 cycleit:function(dir, autorun){ 15 if (dir=="next"){ 16 var currentTabIndex=(this.currentTabIndex<this.hottabspositions.length-1)? this.currentTabIndex+1 : 0; 17 } 18 else if (dir=="prev"){ 19 var currentTabIndex=(this.currentTabIndex>0)? this.currentTabIndex-1 : this.hottabspositions.length-1; 20 } 21 if (typeof autorun=="undefined") 22 this.cancelautorun(); 23 this.expandtab(this.tabs[this.hottabspositions[currentTabIndex]]); 24 }, 25 setpersist:function(bool){ 26 this.enabletabpersistence=bool; 27 }, 28 setselectedClassTarget:function(objstr){ 29 this.selectedClassTarget=objstr || "link"; 30 }, 31 getselectedClassTarget:function(tabref){ 32 return (this.selectedClassTarget==("linkparent".toLowerCase()))? tabref.parentNode : tabref; 33 }, 34 expandtab:function(tabref){ 35 var subcontentid=tabref.getAttribute("rel"); 36 var associatedrevids=(tabref.getAttribute("rev"))? ","+tabref.getAttribute("rev").replace(/\s+/, "")+"," : ""; 37 this.expandsubcontent(subcontentid); 38 this.expandrevcontent(associatedrevids); 39 for (var i=0; i<this.tabs.length; i++){ 40 this.getselectedClassTarget(this.tabs[i]).className=(this.tabs[i].getAttribute("rel")==subcontentid)? "dm_selected" : ""; 41 } 42 if (this.enabletabpersistence) 43 dinamods.setCookie(this.tabinterfaceid, tabref.tabposition); 44 this.setcurrenttabindex(tabref.tabposition); 45 // Google Analytics integration 46 if (typeof this.autoruntimer!="undefined" && this.autoruntimer==false && typeof(pageTracker) != 'undefined' && typeof(pageTracker._trackPageview) != 'undefined' ) { 47 pageTracker._trackPageview( tabref.getAttribute("href")); 48 } 49 }, 50 expandsubcontent:function(subcontentid){ 51 for (var i=0; i<this.subcontentids.length; i++){ 52 var subcontent=document.getElementById(this.subcontentids[i]); 53 subcontent.style.display=(subcontent.id==subcontentid)? "block" : "none"; 54 } 55 }, 56 expandrevcontent:function(associatedrevids){ 57 var allrevids=this.revcontentids; 58 for (var i=0; i<allrevids.length; i++){ 59 document.getElementById(allrevids[i]).style.display=(associatedrevids.indexOf(","+allrevids[i]+",")!=-1)? "block" : "none"; 60 } 61 }, 62 setcurrenttabindex:function(tabposition){ 63 for (var i=0; i<this.hottabspositions.length; i++){ 64 if (tabposition==this.hottabspositions[i]){ 65 this.currentTabIndex=i; 66 break; 67 } 68 } 69 }, 70 autorun:function(){ 71 this.cycleit('next', true); 72 }, 73 cancelautorun:function(){ 74 if (typeof this.autoruntimer!="undefined") 75 clearInterval(this.autoruntimer); 76 }, 77 init:function(automodeperiod,change){ 78 var persistedtab=dinamods.getCookie(this.tabinterfaceid); 79 var persisterror=true; 80 this.automodeperiod=automodeperiod || 0; 81 for (var i=0; i<this.tabs.length; i++){ 82 this.tabs[i].tabposition=i; 83 if (this.tabs[i].getAttribute("rel")){ 84 var tabinstance=this; 85 this.hottabspositions[this.hottabspositions.length]=i; 86 this.subcontentids[this.subcontentids.length]=this.tabs[i].getAttribute("rel"); 87 this.tabs[i].onclick=function(){ 88 tabinstance.expandtab(this); 89 tabinstance.cancelautorun(); 90 return false; 91 } 92 if (change==1){ 93 this.tabs[i].onmouseover=this.tabs[i].onclick 94 } 95 if (this.tabs[i].getAttribute("rev")){ 96 this.revcontentids=this.revcontentids.concat(this.tabs[i].getAttribute("rev").split(/\s*,\s*/)); 97 } 98 if (this.enabletabpersistence && parseInt(persistedtab)==i || !this.enabletabpersistence && this.getselectedClassTarget(this.tabs[i]).className=="dm_selected"){ 99 this.expandtab(this.tabs[i]); 100 persisterror=false; 101 } 102 } 103 } 104 if (persisterror) 105 this.expandtab(this.tabs[this.hottabspositions[0]]); 106 if (parseInt(this.automodeperiod)>500 && this.hottabspositions.length>1){ 107 this.autoruntimer=setInterval(function(){tabinstance.autorun()}, this.automodeperiod); 108 } 109 } 110}
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.