rejetto forum

Software => HFS ~ HTTP File Server => Topic started by: ivanfong on January 02, 2005, 07:48:40 AM

Title: About the file type..
Post by: ivanfong on January 02, 2005, 07:48:40 AM
i wrote a javascript... for the preview of pic and movie

Code: [Select]
<SCRIPT Language=Javascript>
var ie=document.all
var ns=document.layers
var ns6=document.getElementById&&!document.all

function enlarge(which,e,ty,filename){
crossobj=document.getElementById? document.getElementById("showimage") : document.all.showimage
crossobj.style.left=ns6? pageXOffset+e.clientX : document.body.scrollLeft+event.clientX
crossobj.style.top=ns6? pageYOffset+e.clientY : document.body.scrollTop+event.clientY
if (ty=="~img37"){
crossobj.innerHTML='<div align=right id=drag><table bgcolor=white><tr><td><b><a href="" onClick="return closepreview(event)" style=font-family:tahoma;font-size:8pt><font color=red>Review - '+filename+'<b onClick=closepreview(event) style=font-family:tahoma;font-size:8pt><font color=red>[X]</font></b></td></tr></table></div><img src="'+which+'" height=480 width=640>'
crossobj.style.visibility="visible"
}else if (ty=="~img45"||ty=="~img35"){
crossobj.innerHTML='<div align=right id=drag><table bgcolor=white><tr><td><b><a href="" onClick="return closepreview(event)" style=font-family:tahoma;font-size:8pt><font color=red>Review - '+filename+'[X]</font></b></td></tr></table></div><object data="'+which+'" height=260 width=320 type="video/quicktime"></object>'
crossobj.style.visibility="visible"
}else{
crossobj.innerHTML='<div align=center id=drag><table bgcolor=white><tr><td align=center><b><a href="" onClick="return closepreview(event)" style=font-family:tahoma;font-size:12pt><font color=red>這不是圖片或影片!不可預覽![X]</font></b></td></tr></table></div>'
crossobj.style.visibility="visible"
}
return false
}


function closepreview(e){
crossobj=document.getElementById? document.getElementById("showimage") : document.all.showimage
crossobj.style.left=ns6? pageXOffset+e.clientX : document.body.scrollLeft+event.clientX
crossobj.style.top=ns6? pageYOffset+e.clientY : document.body.scrollTop+event.clientY
crossobj.innerHTML=''
crossobj.style.visibility="hidden"
return false
}

</script>
but i discover that the ~img_file code will change everytime when u start the HFS..how come?

and it cant auto load the HTML Template.
Title: About the file type..
Post by: rejetto on January 04, 2005, 04:34:37 PM
I'm not sure of what you are asking.
The index of file icons is not fixed, so you should not rely on it.
If you want to know the filetype, you'd better check the filename instead.
Title: Re: About the file type..
Post by: PikachuEXE on January 08, 2005, 02:59:41 AM
Quote from: "ivanfong"
i wrote a javascript... for the preview of pic and movie

Code: [Select]
<SCRIPT Language=Javascript>
var ie=document.all
var ns=document.layers
var ns6=document.getElementById&&!document.all

function enlarge(which,e,ty,filename){
crossobj=document.getElementById? document.getElementById("showimage") : document.all.showimage
crossobj.style.left=ns6? pageXOffset+e.clientX : document.body.scrollLeft+event.clientX
crossobj.style.top=ns6? pageYOffset+e.clientY : document.body.scrollTop+event.clientY
if (ty=="~img37"){
crossobj.innerHTML='<div align=right id=drag><table bgcolor=white><tr><td><b><a href="" onClick="return closepreview(event)" style=font-family:tahoma;font-size:8pt><font color=red>Review - '+filename+'<b onClick=closepreview(event) style=font-family:tahoma;font-size:8pt><font color=red>[X]</font></b></td></tr></table></div><img src="'+which+'" height=480 width=640>'
crossobj.style.visibility="visible"
}else if (ty=="~img45"||ty=="~img35"){
crossobj.innerHTML='<div align=right id=drag><table bgcolor=white><tr><td><b><a href="" onClick="return closepreview(event)" style=font-family:tahoma;font-size:8pt><font color=red>Review - '+filename+'[X]</font></b></td></tr></table></div><object data="'+which+'" height=260 width=320 type="video/quicktime"></object>'
crossobj.style.visibility="visible"
}else{
crossobj.innerHTML='<div align=center id=drag><table bgcolor=white><tr><td align=center><b><a href="" onClick="return closepreview(event)" style=font-family:tahoma;font-size:12pt><font color=red>這不是圖片或影片!不可預覽![X]</font></b></td></tr></table></div>'
crossobj.style.visibility="visible"
}
return false
}


function closepreview(e){
crossobj=document.getElementById? document.getElementById("showimage") : document.all.showimage
crossobj.style.left=ns6? pageXOffset+e.clientX : document.body.scrollLeft+event.clientX
crossobj.style.top=ns6? pageYOffset+e.clientY : document.body.scrollTop+event.clientY
crossobj.innerHTML=''
crossobj.style.visibility="hidden"
return false
}

</script>
but i discover that the ~img_file code will change everytime when u start the HFS..how come?

and it cant auto load the HTML Template.
preview...??
it may cause a lot of source(for CPU)
that's a good idea but not suitable for slow computer...


PS:i see that ther are some chinese word...
i know the meaning coz i am a chinese...
but ... this is a english forum
change all language into english, ok?? :D