PageSourceSearch

https://www.friendsofgreatwall.org/js/dropdown.js

js friendsofgreatwall.org collected 2026-10-02 05:43:01 UTC 5,547 bytes, 151 lines download raw bytes

1var cssdropdown={
2disappeardelay: 250, 
3disablemenuclick: false, 
4enableswipe: 1, 
5enableiframeshim: 1, 
6dropmenuobj: null, ie: document.all, firefox: document.getElementById&&!document.all, swipetimer: undefined, bottomclip:0,
7
8getposOffset:function(what, offsettype){
9var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
10var parentEl=what.offsetParent;
11while (parentEl!=null){
12totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
13parentEl=parentEl.offsetParent;
14}
15return totaloffset;
16},
17
18swipeeffect:function(){
19if (this.bottomclip<parseInt(this.dropmenuobj.offsetHeight)){
20this.bottomclip+=10+(this.bottomclip/10) 
21this.dropmenuobj.style.clip="rect(0 auto "+this.bottomclip+"px 0)"
22}
23else
24return
25this.swipetimer=setTimeout("cssdropdown.swipeeffect()", 10)
26},
27
28showhide:function(obj, e){
29if (this.ie || this.firefox)
30this.dropmenuobj.style.left=this.dropmenuobj.style.top="-500px"
31if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover"){
32if (this.enableswipe==1){
33if (typeof this.swipetimer!="undefined")
34clearTimeout(this.swipetimer)
35obj.clip="rect(0 auto 0 0)" 
36this.bottomclip=0
37this.swipeeffect()
38}
39obj.visibility="visible"
40}
41else if (e.type=="click")
42obj.visibility="hidden"
43},
44
45iecompattest:function(){
46return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
47},
48
49clearbrowseredge:function(obj, whichedge){
50var edgeoffset=0
51if (whichedge=="rightedge"){
52var windowedge=this.ie && !window.opera? this.iecompattest().scrollLeft+this.iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
53this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetWidth
54if (windowedge-this.dropmenuobj.x < this.dropmenuobj.contentmeasure)  
55edgeoffset=this.dropmenuobj.contentmeasure-obj.offsetWidth
56}
57else{
58var topedge=this.ie && !window.opera? this.iecompattest().scrollTop : window.pageYOffset
59var windowedge=this.ie && !window.opera? this.iecompattest().scrollTop+this.iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
60this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetHeight
61if (windowedge-this.dropmenuobj.y < this.dropmenuobj.contentmeasure){ 
62edgeoffset=this.dropmenuobj.contentmeasure+obj.offsetHeight
63if ((this.dropmenuobj.y-topedge)<this.dropmenuobj.contentmeasure) 
64edgeoffset=this.dropmenuobj.y+obj.offsetHeight-topedge
65}
66}
67return edgeoffset
68},
69
70dropit:function(obj, e, dropmenuID){
71if (this.dropmenuobj!=null) 
72	this.dropmenuobj.style.visibility="hidden" 
73this.clearhidemenu()
74if (this.ie||this.firefox){
75obj.onmouseout=function(){cssdropdown.delayhidemenu()}
76obj.onclick=function(){return !cssdropdown.disablemenuclick} 
77this.dropmenuobj=document.getElementById(dropmenuID)
78if(!this.dropmenuobj) return;
79this.dropmenuobj.onmouseover=function(){cssdropdown.clearhidemenu()}
80this.dropmenuobj.onmouseout=function(e){cssdropdown.dynamichide(e)}
81this.dropmenuobj.onclick=function(){cssdropdown.delayhidemenu()}
82this.showhide(this.dropmenuobj.style, e)
83this.dropmenuobj.x=this.getposOffset(obj, "left")
84this.dropmenuobj.y=this.getposOffset(obj, "top")
85this.dropmenuobj.style.left=this.dropmenuobj.x-this.clearbrowseredge(obj, "rightedge")+"px"
86this.dropmenuobj.style.top=this.dropmenuobj.y-this.clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+1+"px"
87this.positionshim() 
88}
89},
90
91positionshim:function(){ 
92if (this.enableiframeshim && typeof this.shimobject!="undefined"){
93if (this.dropmenuobj.style.visibility=="visible"){
94this.shimobject.style.width=this.dropmenuobj.offsetWidth+"px"
95this.shimobject.style.height=this.dropmenuobj.offsetHeight+"px"
96this.shimobject.style.left=this.dropmenuobj.style.left
97this.shimobject.style.top=this.dropmenuobj.style.top
98}
99this.shimobject.style.display=(this.dropmenuobj.style.visibility=="visible")? "block" : "none"
100}
101},
102
103hideshim:function(){
104if (this.enableiframeshim && typeof this.shimobject!="undefined")
105this.shimobject.style.display='none'
106},
107
108contains_firefox:function(a, b) {
109while (b.parentNode)
110if ((b = b.parentNode) == a)
111return true;
112return false;
113},
114
115dynamichide:function(e){
116var evtobj=window.event? window.event : e
117if (this.ie&&!this.dropmenuobj.contains(evtobj.toElement))
118this.delayhidemenu()
119else if (this.firefox&&e.currentTarget!= evtobj.relatedTarget&& !this.contains_firefox(evtobj.currentTarget, evtobj.relatedTarget))
120this.delayhidemenu()
121},
122
123delayhidemenu:function(){
124this.delayhide=setTimeout("cssdropdown.dropmenuobj.style.visibility='hidden'; cssdropdown.hideshim()",this.disappeardelay) 
125},
126
127clearhidemenu:function(){
128if (this.delayhide!="undefined")
129clearTimeout(this.delayhide)
130},
131
132startchrome:function(){
133for (var ids=0; ids<arguments.length; ids++){
134var menuitems=document.getElementById(arguments[ids]).getElementsByTagName("a")
135for (var i=0; i<menuitems.length; i++){
136if (menuitems[i].getAttribute("rel")){
137var relvalue=menuitems[i].getAttribute("rel")
138menuitems[i].onmouseover=function(e){
139var event=typeof e!="undefined"? e : window.event
140cssdropdown.dropit(this,event,this.getAttribute("rel"))
141}
142}
143}
144}
145if (window.createPopup && !window.XmlHttpRequest){ 
146document.write('<IFRAME id="iframeshim"  src="" style="display: none; left: 0; top: 0; z-index: 90; position: absolute; filter: progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)" frameBorder="0" scrolling="no"></IFRAME>')
147this.shimobject=document.getElementById("iframeshim") 
148}
149}
150
151}

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.