/* RAWR - Preview Box (c) 2007-2008, RAWR Designs, Some Rights Reserved - Christopher "That Stevens Guy" Stevens Richard "Giant Eagle" Tuininga (CC) http://creativecommons.org/licenses/by-nc-sa/3.0/ Any queries? - Email: contact[at]rawr-designs.com Forum: http://www.rejetto.com/forum/index.php?board=34.0 Homepage: http://rawr-designs.com/ If you have a widescreen FLV folder, place in the comment. */ var disable = false; var boxOpen = null; var ext; /* Initialise preview box. */ function initPreviewBox(target,file) { ext = file.substring(file.lastIndexOf("."),file.length); ext = ext.toLowerCase(); if (disable == false) { disable = true; setTimeout("disable=false;", 350); if(target != boxOpen) { if(boxOpen!=null) boxFade(boxOpen,"out"); if(ext.match(".jpg|.jpeg|.png|.bmp|.tif|.tiff")) spawnIMGBox(target,file); else if(ext.match(".flv|.mp3")) spawnRAWRBox(target,file); else if(ext==".swf") spawnSWFBox(target,file); else if(ext==".wmv") spawnRAWRwmvBox(target,file); else if(ext==".wkv") spawnRAWRwkvBox(target,file); else if(ext.match(".avi|.DivX")) spawnRAWRdivxBox(target,file); else if(ext.match(".mpg|.mpeg|.mp4|.mpg|.mov")) spawnRAWRMPGBox(target,file); else if(ext=="search") spawnSEARCHBox(target,file); } else { boxFade(boxOpen,"out"); } } } /* Spawn 'Loading' box. */ function spawnBox(target,width,height) { gEBI(target).innerHTML = "
X"+lv_loading+"
"; Box = gEBI(target+"Box"); Box.style.left = Box.offsetLeft-500+(480-Box.offsetWidth)+"px"; Box.style.top = Box.offsetTop-(Box.offsetHeight+46)/2+"px"; boxFade(target,"in"); document.onmousedown = startDrag; } /* Spawn Search box. */ function spawnSEARCHBox(target,file) { spawnBox(target,300,62); setTimeout("setSEARCHBox(\""+target+"\",\""+file+"\");",300); } function setSEARCHBox(target,file) { gEBI(target+"Box").firstChild.style.cursor="default"; document.onmousedown = null; setName(lv_advSearch); gEBI(target+"Content").innerHTML = "

"+lv_files+" "+lv_folders+" "+lv_both+" "+lv_recursive+"
"+lv_root+" "+lv_current+"
"; gEBI(target+"Content").style.background="transparent"; } /* Spawn Image box. */ function spawnIMGBox(target,file) { img = new Image(); img.src = "previews_and_thumbnails/prev-"+file.substring(file.lastIndexOf("/")+1,file.length)+".jpg"; if(img.complete) { spawnBox(target,img.width,img.height); setIMGBox(target,file,"setImmediatly"); } else { setTimeout("setIMGBox(\""+target+"\",\""+file+"\",\"none\");",10); } } function setIMGBox(target,file,status) { if(img.width!=0) { if(status == "none") { spawnBox(target,img.width,img.height); status = "boxLoaded"; } if(status == "boxLoaded") { setTimeout("setIMGBox(\""+target+"\",\""+file+"\",\"setImage\");",325); } else if(status == "setImage") { if(img.complete) { gEBI(target+"Content").innerHTML = ""; boxFade(target,"img"); setName(file); img = null; } else { setTimeout("setIMGBox(\""+target+"\",\""+file+"\",\"setImage\");",200); } } else if(status == "setImmediatly") { gEBI(target+"Content").innerHTML = ""; setName(file); img = null; } } else { setTimeout("setIMGBox(\""+target+"\",\""+file+"\",\"none\");",50); } } /* Spawn RAWR box. */ var volume = 50; var height, width, aspect; var playmethod = "single"; var context = "on"; function spawnRAWRBox(target,file) { height = ext==".flv"?270:50; width = ext==".flv"&&aspect=="wide"?480:320; spawnBox(target,width,height); setTimeout("setRAWRBox(\""+target+"\",\""+file+"\");",300); } function setRAWRBox(target,file) { setName(file); file = file.replace('+','%2B').replace('&','%26'); volume = getCookie('Volume') ? getCookie('Volume') : volume; playmethod = getCookie('Method') ? getCookie('Method')+"&mode=full" : "single&mode=full"; if(autoplay == true) playmethod = "single"; if(mod_folder_tasks=="off"&&mod_statistics=="off"&&mod_shoutbox=="off") context = "off"; gEBI(target+"Content").innerHTML = ""; autoplay = false; } function spawnRAWRdivxBox(target,file) { height = ext==".avi"?320:320; width = ext==".avi"&&aspect=="wide"?480:320; spawnBox(target,width,height); setTimeout("setRAWRdivxBox(\""+target+"\",\""+file+"\");",300); } function setRAWRdivxBox(target,file) { setName(file); file = file.replace('+','%2B').replace('&','%26'); volume = getCookie('Volume') ? getCookie('Volume') : volume; playmethod = getCookie('Method') ? getCookie('Method')+"&mode=full" : "single&mode=full"; if(autoplay == true) playmethod = "single"; if(mod_folder_tasks=="off"&&mod_statistics=="off"&&mod_shoutbox=="off") context = "off"; gEBI(target+"Content").innerHTML = ""; autoplay = false; } function spawnRAWRwmvBox(target,file) { height = ext==".wmv"?320:320; width = ext==".wmv"&&aspect=="wide"?480:320; spawnBox(target,width,height); setTimeout("setRAWRwmvBox(\""+target+"\",\""+file+"\");",300); } function setRAWRwmvBox(target,file) { setName(file); file = file.replace('+','%2B').replace('&','%26'); volume = getCookie('Volume') ? getCookie('Volume') : volume; playmethod = getCookie('Method') ? getCookie('Method')+"&mode=full" : "single&mode=full"; if(autoplay == true) playmethod = "single"; if(mod_folder_tasks=="off"&&mod_statistics=="off"&&mod_shoutbox=="off") context = "off"; gEBI(target+"Content").innerHTML = ""; autoplay = false; } function spawnRAWRwkvBox(target,file) { height = ext==".wkv"?320:320; width = ext==".wkv"&&aspect=="wide"?480:320; spawnBox(target,width,height); setTimeout("setRAWRmkvBox(\""+target+"\",\""+file+"\");",300); } function setRAWRwkvBox(target,file) { setName(file); file = file.replace('+','%2B').replace('&','%26'); volume = getCookie('Volume') ? getCookie('Volume') : volume; playmethod = getCookie('Method') ? getCookie('Method')+"&mode=full" : "single&mode=full"; if(autoplay == true) playmethod = "single"; if(mod_folder_tasks=="off"&&mod_statistics=="off"&&mod_shoutbox=="off") context = "off"; gEBI(target+"Content").innerHTML = ""; autoplay = false; } function spawnRAWRMPGBox(target,file) { height = ext==".avi"?320:320; width = ext==".avi"&&aspect=="wide"?480:320; spawnBox(target,width,height); setTimeout("setRAWRMPGBox(\""+target+"\",\""+file+"\");",300); } function setRAWRMPGBox(target,file) { setName(file); file = file.replace('+','%2B').replace('&','%26'); volume = getCookie('Volume') ? getCookie('Volume') : volume; playmethod = getCookie('Method') ? getCookie('Method')+"&mode=full" : "single&mode=full"; if(autoplay == true) playmethod = "single"; if(mod_folder_tasks=="off"&&mod_statistics=="off"&&mod_shoutbox=="off") context = "off"; gEBI(target+"Content").innerHTML = ""; autoplay = false; } /* Spawn SWF box. */ function spawnSWFBox(target,file) { spawnBox(target,413,300); setTimeout("setSWFBox(\""+target+"\",\""+file+"\");",300); } function setSWFBox(target,file) { setName(file); gEBI(target+"Content").innerHTML = ""; } //--Spawn a DivX box.----------------------------// function spawnDivxBox(target,content,name) { spawnBox(target,aspect,240); setTimeout("setDivxBox(\""+target+"\",\""+content+"\",\""+name+"\");",300); } function setDivxBox(target, content, name) { setName(name=="undefined"?content:name); content = "" gEBI(target+"Content").innerHTML = content } //--Spawn a MPG box.----------------------------// function spawnMPGBox(target,content,name) { spawnBox(target,aspect,240); setTimeout("setMPGBox(\""+target+"\",\""+content+"\",\""+name+"\");",300); } function setMPGBox(target, content, name) { setName(name=="undefined"?content:name); content = "" gEBI(target+"Content").innerHTML = content } /* Crop file name if necessary. */ function setName(file) { name = decodeURI(file.substring(file.lastIndexOf("/")+1,file.lastIndexOf("."))); gEBI(boxOpen+"Name","inn",name+ext); while (gEBI(boxOpen+"Box").offsetWidth-50 < gEBI(boxOpen+"Name").offsetWidth ||gEBI(boxOpen+"Name").offsetHeight >31) { name = name.substring(0,name.length-4)+".. "; gEBI(boxOpen+"Name","inn",name+ext); } } /* Fade function. */ var method; function boxFade(target,method,alpha){ method=="img"?id=gEBI(target+"ImageBox"):id=gEBI(target+"Box"); if(!alpha) { if(method=="in"||method=="img") { if(method=="in") boxOpen=target; for(q=24;q>0;q--) setTimeout("boxFade(\""+target+"\",\""+method+"\",\""+q*4+"\");",q*12); setTimeout("gEBI(\""+id.id+"\").style.opacity=0.99;",300); setTimeout("gEBI(\""+id.id+"\").style.filter='alpha(opacity=100)';",300); } else if(method=="out") { if(gEBI(target+"Content").innerHTML.substr(1,3)!="img") gEBI(target+"Content").innerHTML=""; id.name="fadingOut"; if(boxOpen==target) boxOpen=null; for(p=24;p>0;p--) setTimeout("boxFade(\""+target+"\",\"out\","+(100+p*-4)+");",p*12); setTimeout("gEBI(\""+target+"\").innerHTML='';",300); } } else { if((method=="in"||method=="img")&&id.name!="fadingOut"||method=="out") { id.style.filter="alpha(opacity="+alpha+")"; id.style.opacity=alpha/100; } } } /* Drag. */ var sObj = null; var drgOK = false; var dX=dY=sX=sY = 0; function startDrag(e) { if(e==null)e=window.event; var t=e.target!=null?e.target:e.srcElement; try { if(t.parentNode.className=="Box"||t.parentNode.parentNode.className=="Box"||t.parentNode.parentNode.parentNode.className=="Box") { sObj = t.parentNode.parentNode.parentNode.className=="Box"?t.parentNode.parentNode.parentNode:t.parentNode.parentNode.className=="Box"?t.parentNode.parentNode:t.parentNode; drgOK = true; dX = e.clientX-parseInt(sObj.style.left); dY = e.clientY-parseInt(sObj.style.top); sX = document.documentElement.scrollLeft; sY = document.documentElement.scrollTop; gEBI(boxOpen).style.cursor = 'move'; document.onmousemove = drag; document.onmouseup = endDrag; return false; } } catch(e) {} } function drag(e) { if(e==null)e=window.event; if(e.button <= 1 && drgOK) { sObj.style.left = e.clientX-dX+(document.documentElement.scrollLeft-sX)+'px'; sObj.style.top = e.clientY-dY+(document.documentElement.scrollTop-sY)+'px'; return false; } } function endDrag(e) { gEBI(boxOpen).style.cursor = "default"; document.onmousemove = document.onmouseup = null; drgOK = false; } /* Change media file. */ function changeMedia(method) { if(method=="shuffle") { nr =Math.round(Math.random()*playList.length-1); while(boxOpen==playList[nr].boxid) nr =Math.round(Math.random()*playList.length-1); initPreviewBox(playList[nr].boxid,playList[nr].name); return false; } for(i=0;i=0?i-1:playList.length-1; initPreviewBox(playList[nr].boxid,playList[nr].name); return false; } } } /* RAWR-Player flash interface. */ function playerVolume(volume) { setCookie('Volume',volume,exp); } function playbackMethod(playmethod) { setCookie('Method',playmethod,exp); }