PageSourceSearch

https://www.darkside.ru/js/klayers.js

js darkside.ru collected 2026-10-02 10:00:28 UTC 9,166 bytes, 392 lines download raw bytes

1/************************************************\
2| KLayers 2.97                                   |
3| DHTML Library for Internet Explorer 4.* - 6.*, |
4| Netscape 4.* - 7.*, Mozilla, Opera 5.* - 7.*   |
5| Copyright by Kruglov S. A. (kruglov.ru) 2003   |
6\************************************************/
7/*ck*\
8/***  See for description and latest version  ***\
9\***  http://www.kruglov.ru/klayers/          ***/
10
11function initKLayers(){
12  isDOM=document.getElementById?true:false
13  isOpera=isOpera5=window.opera && isDOM
14  isOpera6=isOpera && window.print
15  isOpera7=isOpera && document.readyState
16  isMSIE=isIE=document.all && document.all.item && !isOpera
17  isStrict=document.compatMode=='CSS1Compat'
18  isNN=isNC=navigator.appName=="Netscape"
19  isNN4=isNC4=isNN && !isDOM
20  isMozilla=isNN6=isNN && isDOM
21
22  if(!isDOM && !isNC && !isMSIE && !isOpera){
23    KLayers=false
24    return false
25  }
26
27  pageLeft=0
28  pageTop=0
29
30  KL_imgCount=0
31  KL_imgArray=new Array()
32
33  KL_imageRef="document.images[\""
34  KL_imagePostfix="\"]"
35  KL_styleSwitch=".style"
36  KL_layerPostfix="\"]"
37
38  if(isNN4){
39    KL_layerRef="document.layers[\""
40    KL_styleSwitch=""
41  }
42
43  if(isMSIE){
44    KL_layerRef="document.all[\""
45  }
46
47  if(isDOM){
48    KL_layerRef="document.getElementById(\""
49    KL_layerPostfix="\")"
50  }
51
52  KLayers=true
53  return true
54}
55
56initKLayers()
57
58// document and window functions:
59
60function KL_getBody(w){
61  if(!w) w=window
62  if(isStrict){
63    return w.document.documentElement
64  }else{
65    return w.document.body
66  }
67}
68
69function getWindowLeft(w){
70  if(!w) w=window
71  if(isMSIE || isOpera7) return w.screenLeft
72  if(isNN || isOpera) return w.screenX
73}
74
75function getWindowTop(w){
76  if(!w) w=window
77  if(isMSIE || isOpera7) return w.screenTop
78  if(isNN || isOpera) return w.screenY
79}
80
81function getWindowWidth(w){
82  if(!w) w=window
83  if(isMSIE) return KL_getBody(w).clientWidth
84  if(isNN || isOpera) return w.innerWidth
85}
86
87function getWindowHeight(w){
88  if(!w) w=window
89  if(isMSIE) return KL_getBody(w).clientHeight
90  if(isNN || isOpera) return w.innerHeight
91}
92
93function getDocumentWidth(w){
94  if(!w) w=window
95  if(isMSIE || isOpera7) return KL_getBody(w).scrollWidth
96  if(isNN) return w.document.width
97  if(isOpera) return w.document.body.style.pixelWidth
98}
99
100function getDocumentHeight(w){
101  if(!w) w=window
102  if(isMSIE || isOpera7) return KL_getBody(w).scrollHeight
103  if(isNN) return w.document.height
104  if(isOpera) return w.document.body.style.pixelHeight
105}
106
107function getScrollX(w){
108  if(!w) w=window
109  if(isMSIE || isOpera7) return KL_getBody(w).scrollLeft
110  if(isNN || isOpera) return w.pageXOffset
111}
112
113function getScrollY(w){
114  if(!w) w=window
115  if(isMSIE || isOpera7) return KL_getBody(w).scrollTop
116  if(isNN || isOpera) return w.pageYOffset
117}
118
119function preloadImage(imageFile){
120  KL_imgArray[KL_imgCount]=new Image()
121  KL_imgArray[KL_imgCount++].src=imageFile
122}
123
124var KL_LAYER=0
125var KL_IMAGE=1
126
127function KL_findObject(what,where,type){
128  var i,j,l,s
129  var len=eval(where+".length")
130  for(j=0;j<len;j++){
131    s=where+"["+j+"].document.layers"
132    if(type==KL_LAYER){
133      l=s+"[\""+what+"\"]"
134    }
135    if(type==KL_IMAGE){
136      i=where+"["+j+"].document.images"
137      l=i+"[\""+what+"\"]"
138    }
139    if(eval(l)) return l
140    l=KL_findObject(what,s,type)
141    if(l!="null") return l
142  }
143  return "null"
144}
145
146function KL_getObjectPath(name,parent,type){
147  var l=((parent && isNN4)?(parent+"."):(""))+((type==KL_LAYER)?KL_layerRef:KL_imageRef)+name+((type==KL_LAYER)?KL_layerPostfix:KL_imagePostfix)
148  if(eval(l))return l
149  if(!isNN4){
150    return l
151  }else{
152    return KL_findObject(name,"document.layers",type)
153  }
154}
155
156function layer(name){
157  return new KLayer(name,null)
158}
159
160function layerFrom(name,parent){
161  if(parent.indexOf("document.")<0) parent=layer(parent).path
162  return new KLayer(name,parent)
163}
164
165function image(name){
166  return new KImage(name,null)
167}
168
169function imageFrom(name,parent){
170  if(parent.indexOf("document.")<0) parent=layer(parent).path
171  return new KImage(name,parent)
172}
173
174// class "KLayer":
175
176function KLayer(name,parent){
177  this.path=KL_getObjectPath(name,parent,KL_LAYER)
178  this.object=eval(this.path)
179  if(!this.object)return
180  this.style=this.css=eval(this.path+KL_styleSwitch)
181}
182
183KLP=KLayer.prototype
184
185KLP.isExist=KLP.exists=function(){
186  return (this.object)?true:false
187}
188
189function KL_getPageOffset(o){ 
190  var KL_left=0
191  var KL_top=0
192  do{
193    KL_left+=o.offsetLeft
194    KL_top+=o.offsetTop
195  }while(o=o.offsetParent)
196  return [KL_left, KL_top]
197}
198
199KLP.getLeft=function(){
200  var o=this.object
201  if(isMSIE || isMozilla || isOpera) return o.offsetLeft-pageLeft
202  if(isNN4) return o.x-pageLeft
203}
204
205KLP.getTop=function(){
206  var o=this.object
207  if(isMSIE || isMozilla || isOpera) return o.offsetTop-pageTop
208  if(isNN4) return o.y-pageTop
209}
210
211KLP.getAbsoluteLeft=function(){
212  var o=this.object
213  if(isMSIE || isMozilla || isOpera) return KL_getPageOffset(o)[0]-pageLeft
214  if(isNN4) return o.pageX-pageLeft
215}
216
217KLP.getAbsoluteTop=function(){
218  var o=this.object
219  if(isMSIE || isMozilla || isOpera) return KL_getPageOffset(o)[1]-pageTop
220  if(isNN4) return o.pageY-pageTop
221}
222
223KLP.getWidth=function(){
224  var o=this.object
225  if(isMSIE || isMozilla || isOpera7) return o.offsetWidth
226  if(isOpera) return this.css.pixelWidth
227  if(isNN4) return o.document.width
228}
229
230KLP.getHeight=function(){
231  var o=this.object
232  if(isMSIE || isMozilla || isOpera7) return o.offsetHeight
233  if(isOpera) return this.css.pixelHeight
234  if(isNN4) return o.document.height
235}
236
237KLP.getZIndex=function(){ //deprecated
238  return this.css.zIndex
239}
240
241KLP.setLeft=KLP.moveX=function(x){
242  x+=pageLeft
243  if(isOpera){
244    this.css.pixelLeft=x
245  }else if(isNN4){
246    this.object.x=x
247  }else{
248    this.css.left=x+"px"
249  }
250}
251
252KLP.setTop=KLP.moveY=function(y){
253  y+=pageTop
254  if(isOpera){
255    this.css.pixelTop=y
256  }else if(isNN4){
257    this.object.y=y
258  }else{
259    this.css.top=y+"px"
260  }
261}
262
263KLP.moveTo=KLP.move=function(x,y){
264  this.setLeft(x)
265  this.setTop(y)
266}
267
268KLP.moveBy=function(x,y){
269  this.moveTo(this.getLeft()+x,this.getTop()+y)
270}
271
272KLP.setZIndex=KLP.moveZ=function(z){ //deprecated
273  this.css.zIndex=z
274}
275
276KLP.setVisibility=function(v){
277  this.css.visibility=(v)?(isNN4?"show":"visible"):(isNN4?"hide":"hidden")
278}
279
280KLP.show=function(){
281  this.setVisibility(true)
282}
283
284KLP.hide=function(){
285  this.setVisibility(false)
286}
287
288KLP.isVisible=KLP.getVisibility=function(){
289  return (this.css.visibility.toLowerCase().charAt(0)=='h')?false:true
290}
291
292KLP.setBgColor=function(c){
293  if(isMSIE || isMozilla || isOpera7){
294    this.css.backgroundColor=c
295  }else if(isOpera){
296    this.css.background=c
297  }else if(isNN4){
298    this.css.bgColor=c
299  }
300}
301
302KLP.setBgImage=function(url){
303  if(isMSIE || isMozilla || isOpera6){
304    this.css.backgroundImage="url("+url+")"
305  }else if(isNN4){
306    this.css.background.src=url
307  }
308}
309
310KLP.setClip=KLP.clip=function(top,right,bottom,left){
311  if(isMSIE || isMozilla || isOpera7){
312    this.css.clip="rect("+top+"px "+right+"px "+bottom+"px "+left+"px)"
313  }else if(isNN4){
314    var c=this.css.clip
315    c.top=top
316    c.right=right
317    c.bottom=bottom
318    c.left=left
319  }
320}
321
322KLP.scrollTo=KLP.scroll=function(windowLeft,windowTop,windowWidth,windowHeight,scrollX,scrollY){
323  if(scrollX>this.getWidth()-windowWidth) scrollX=this.getWidth()-windowWidth
324  if(scrollY>this.getHeight()-windowHeight) scrollY=this.getHeight()-windowHeight
325  if(scrollX<0)scrollX=0
326  if(scrollY<0)scrollY=0
327  var top=0
328  var right=windowWidth
329  var bottom=windowHeight
330  var left=0
331  left=left+scrollX
332  right=right+scrollX
333  top=top+scrollY
334  bottom=bottom+scrollY
335  this.moveTo(windowLeft-scrollX,windowTop-scrollY)
336  this.setClip(top,right,bottom,left)
337}
338
339KLP.scrollBy=KLP.scrollByOffset=function(windowLeft,windowTop,windowWidth,windowHeight,scrollX,scrollY){
340  var X=-parseInt(this.css.left)+windowLeft+scrollX
341  var Y=-parseInt(this.css.top)+windowTop+scrollY
342  this.scroll(windowLeft,windowTop,windowWidth,windowHeight,X,Y)
343}
344
345KLP.scrollByPercentage=function(windowLeft,windowTop,windowWidth,windowHeight,scrollX,scrollY){
346  var X=(this.getWidth()-windowWidth)*scrollX/100
347  var Y=(this.getHeight()-windowHeight)*scrollY/100
348  this.scroll(windowLeft,windowTop,windowWidth,windowHeight,X,Y)
349}
350
351KLP.write=function(str){
352  var o=this.object
353  if(isNN4){
354    var d=o.document
355    d.open()
356    d.write(str)
357    d.close()
358  }else{
359    o.innerHTML=str
360  }
361}
362
363KLP.add=function(str){
364  var o=this.object
365  if(isNN4){
366    o.document.write(str)
367  }else{
368    o.innerHTML+=str
369  }
370}
371
372// class "KImage":
373
374KIP=KImage.prototype
375
376function KImage(name){
377  this.path=KL_getObjectPath(name,false,KL_IMAGE)
378  this.object=eval(this.path)
379}
380
381KIP.isExist=KIP.exists=function(){
382  return (this.object)?true:false
383}
384
385KIP.getSrc=KIP.src=function(){
386  return this.object.src
387}
388
389KIP.setSrc=KIP.load=function(url){
390  this.object.src=url
391}
392

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.