home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magazyn WWW 2000 June
/
www-06-2000.iso
/
full
/
js
/
biblioteka.js
next >
Wrap
Text File
|
2000-04-05
|
8KB
|
233 lines
/********************************************/
/* BIBLIOTEKA Cross-Browser DHTML */
/* wersja 3.0 1999-10-22 */
/********************************************/
/* onFocus Dynamic Web Design */
/* Ania KrΩglewska, Pawe│ Postupalski */
/* mailto:onfocus@webmedia.pl */
/* http://www.onfocus.com.pl */
/********************************************/
/* Ta biblioteka moze byc wykorzystywana */
/* bez zadnych ograniczen pod warunkiem */
/* nie usuniecia tego naglowka. */
/********************************************/
/*************************/
/* Detekcja przegladarki */
/*************************/
nn4=(document.layers)?true:false;
ie4=(document.all)?true:false;
niemac=(navigator.appVersion.indexOf("Macintosh")==-1);
ie4=ie4 && niemac;
/*****************************************/
/* Poni┐szy fragment pozwala */
/* unikn╣µ k│opot≤w przy zmianie */
/* rozmiar≤w okna w NN */
/*****************************************/
/* -- najlepiej przepisz do dokumentu -- */
/*****************************************/
if(nn4) {
_oknoW = window.innerWidth;
_oknoH = window.innerHeight;
}
function reDo() {
if(window.innerWidth != _oknoW || window.innerHeight != _oknoH) {
window.location.reload();
}
}
if(nn4){window.onresize = reDo;}
/*************************/
/* Pokaz blok 'ident' */
/*************************/
function show(ident,nest) {
if(nn4) {
nest ? document.layers[nest].document.layers[ident].visibility = "show" : document.layers[ident].visibility = "show";
} else if(ie4) {
document.all[ident].style.visibility = "visible";
}
}
/*************************/
/* Ukryj blok 'ident' */
/*************************/
function hide(ident,nest) {
if(nn4) {
nest ? document.layers[nest].document.layers[ident].visibility = "hide" : document.layers[ident].visibility = "hide";
} else if(ie4) {
document.all[ident].style.visibility = "hidden";
}
}
/****************************************/
/* Przesun blok 'ident' do punktu (x,y) */
/****************************************/
function moveTo(ident,x,y,nest) {
if(nn4) {
nest ? document.layers[nest].document.layers[ident].left = x : document.layers[ident].left = x;
nest ? document.layers[nest].document.layers[ident].top = y : document.layers[ident].top = y;
} else if(ie4) {
document.all[ident].style.left = x;
document.all[ident].style.top = y;
}
}
/*****************************************/
/* Przesun blok 'ident' o wektor [dx,dy] */
/*****************************************/
function moveBy(ident,dx,dy,nest) {
if(nn4) {
nest ? document.layers[nest].document.layers[ident].left += dx : document.layers[ident].left += dx;
nest ? document.layers[nest].document.layers[ident].top += dy : document.layers[ident].top += dy;
} else if(ie4) {
document.all[ident].style.left = document.all[ident].offsetLeft + dx;
document.all[ident].style.top = document.all[ident].offsetTop + dy;
}
}
/************************************************/
/* Przytnij blok 'ident' do zadanego prostokata */
/* t: top, r: right, b: bottom, l:left */
/************************************************/
function clipTo(ident, t, r, b, l,nest) {
if(nn4) {
if(nest) {
document.layers[nest].document.layers[ident].clip.top = t;
document.layers[nest].document.layers[ident].clip.right = r;
document.layers[nest].document.layers[ident].clip.bottom = b;
document.layers[nest].document.layers[ident].clip.left = l;
} else {
document.layers[ident].clip.top = t;
document.layers[ident].clip.right = r;
document.layers[ident].clip.bottom = b;
document.layers[ident].clip.left = l;
}
} else if(ie4) {
document.all[ident].style.clip =
"rect(" + t + " " + r + " " + b + " " + l + ")";
}
}
/****************************************************/
/* Zmien przyciecie bloku 'ident' o zadane wartosci */
/* t: top, r: right, b: bottom, l:left */
/****************************************************/
function clipBy(ident, t, r, b, l,nest) {
if(nn4) {
if(nest) {
document.layers[nest].document.layers[ident].clip.top += t;
document.layers[nest].document.layers[ident].clip.right += r;
document.layers[nest].document.layers[ident].clip.bottom += b;
document.layers[nest].document.layers[ident].clip.left += l;
} else {
document.layers[ident].clip.top += t;
document.layers[ident].clip.right += r;
document.layers[ident].clip.bottom += b;
document.layers[ident].clip.left += l;
}
} else if(ie4) {
ie_clip = document.all[ident].style.clip;
ie_clip = ie_clip.substring(5, ie_clip.length-1);
ie_clip_wart = ie_clip.split("px");
t += parseInt(ie_clip_wart [0]);
r += parseInt(ie_clip_wart [1]);
b += parseInt(ie_clip_wart [2]);
l += parseInt(ie_clip_wart [3]);
document.all[ident].style.clip = "rect(" + t + "px " + r + "px " + b + "px " + l + "px)";
}
}
/*************************************************************/
/* Zapisz pozycje bloku 'ident' do zmiennych l: left, t: top */
/*************************************************************/
function pozycja(ident,nest) {
if(nn4) {
l = nest ? document.layers[nest].document.layers[ident].left : document.layers[ident].left;
t = nest ? document.layers[nest].document.layers[ident].top : document.layers[ident].top;
} else if(ie4) {
l = document.all[ident].offsetLeft;
t = document.all[ident].offsetTop;
}
}
/******************************************************/
/* Zapisz wysokosc bloku 'ident' do zmienej h: height */
/******************************************************/
function wysokosc(ident,nest) {
if(nn4) {
h = nest ? document.layers[nest].document.layers[ident].document.height : document.layers[ident].document.height;
} else if(ie4) {
h = document.all[ident].scrollHeight;
}
return h;
}
/*********************************/
/* Zmien zawartosc bloku 'ident' */
/*********************************/
function writeTo(ident, tekst, nest) {
if(nn4) {
if(nest) {
document.layers[nest].document.layers[ident].document.open();
document.layers[nest].document.layers[ident].document.write(tekst);
document.layers[nest].document.layers[ident].document.close();
} else {
document.layers[ident].document.open();
document.layers[ident].document.write(tekst);
document.layers[ident].document.close();
}
} else if(ie4) {
document.all[ident].innerHTML = tekst;
}
}
/****************************************/
/* Zmien wartosc z-indexu bloku 'ident' */
/****************************************/
function zmienZindex(ident, z, nest) {
if(nn4) {
if(nest) {
document.layers[nest].document.layers[ident].zIndex=z;
} else {
document.layers[ident].zIndex=z;
}
} else if(ie4) {
document.all[ident].style.zIndex=z;
}
}
/****************************************/
/* Sprawdz rozmiary okna */
/* oknoW: dostepna szerokosc */
/* oknoH: dostepna wysokosc */
/* UWAGA: funkcja przestarza│a, */
/* nalezy stosowaµ f. rozmiaryOkna() */
/****************************************/
function okno(){
if(nn4){
oknoW=window.innerWidth-16;
oknoH=window.innerHeight
}else if(ie4){
oknoW=document.body.clientWidth;
oknoH=document.body.clientHeight;
}
}
/****************************************/
/* Sprawdz rozmiary okna */
/* oknoW: dostepna szerokosc */
/* oknoH: dostepna wysokosc */
/****************************************/
function rozmiaryOkna(suwaki) {
if(nn4){
oknoW=window.innerWidth - (suwaki?16:0);
oknoH=window.innerHeight
}else if(ie4){
oknoW=document.body.clientWidth;
oknoH=document.body.clientHeight;
}
}