<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<?php
error_reporting(0);
$subroot=$_SERVER['DOCUMENT_ROOT'];
$root=""; // ie.: "folder1/folder2/" from "document_root/"
// set in dl.php as here
// set in .htaccess ie.: RewriteRule ^(.*)$ /folder1/folder2/index.php?p=$1 [NC,L]
// place files in s/
include($subroot."/".$root."php/setup.php");
include($subroot."/".$root."php/file.php");
include($subroot."/".$root."php/colortime.php");
$bad=array("%","!","?","&","#"," ","+");
$good=array("%25","%21","%3F","%26","%23","%20","%2B");
$path=preg_replace("/\.+\//","",stripslashes(htmlspecialchars($_GET['p'])));
$path=str_replace("&","&",$path);
//if(filesize($loc.$path)>0) {
// echo $path;
// exit;
//}
//$view=false;
//echo urlencode($path);
//exit;
while(!is_dir($loc.$path) && !is_file($loc.$path) && $path<>"") {
//if(filesize($loc.$path)<=0) {
if(substr($path,strlen($substr)-1)=="/") {
$path=substr($path,0,strlen($path)-1);
} else {
$path=substr($path,0,strrpos($path,"/"));
}
//}
}
if(substr($path,strlen($path)-1)!="/" && is_dir($loc.$path) && $path<>"") $path.="/";
$fpath=$loc.$path;
$vpath="";
$dpath="";
$fname="";
if(is_file($fpath)) { // Preparing file preview
if(strpos($path,"/")) {
$path=substr($path,0,strrpos($path,"/")+1);
} else {
$path="";
}
$vpath=$fpath;
$fname=substr($vpath,strrpos($vpath,"/")+1);
$fpath=substr($fpath,0,strrpos($fpath,"/")+1);
$dpath=$dl.$path.$fname;
$view=true;
if(strpos($path.$fname,"secrets")==false) {
appendf($analytics,time()."\v".$path.$fname."\n");
}
}
$farr=array();
$darr=array();
if($handle=opendir($fpath)) { // List current directory
while(false!==($entry=readdir($handle))) {
if($entry!="." && $entry!="..") {
$ts_raw=filemtime($fpath.$entry);
$color="#000";
$fs_get=filesize($fpath.$entry);
$timestamp=date($dformat,$ts_raw);
$ts_get=time()-$ts_raw;
list($ts_get,$color)=colortime($ts_get);
if(is_dir($fpath.$entry)) {
//array_push($darr,$entry);
array_push($darr,array($ts_raw,$entry,$ts_get,$color,$timestamp,$fs_get));
} else {
//array_push($farr,$entry);
array_push($farr,array($ts_raw,$entry,$ts_get,$color,$timestamp,$fs_get));
}
// 0 raw = mtime
// 1 entry = filename
// 2 ts_get = mtime diff?date stamp?
// 3 color = hex
// 4 timestamp = 2 weeks ago~
// 5 fs_get filesize
}
}
}
closedir($handle);
foreach($darr as $key => $row) {
$ts[$key]=$row[0];
$nam[$key]=$row[1];
}
array_multisort($ts,SORT_DESC,$nam,SORT_ASC,$darr);
foreach($farr as $key => $row) {
$ts[$key]=$row[0];
$nam[$key]=$row[1];
}
array_multisort($ts,SORT_DESC,$nam,SORT_ASC,$farr);
//sort($darr);
//sort($farr);
$items=count($darr)+count($farr);
$items.=($items>1)?" items":" item";
session_set_cookie_params(["SameSite" => "Strict"]); //none, lax, strict
session_set_cookie_params(["Secure" => "true"]); //false, true
session_set_cookie_params(["HttpOnly" => "true"]); //false, true
session_start(); // Visit counter
$visits=intval(readf($visitpath));
if(!$_SESSION['visited']) {
$_SESSION['visited']=true;
$visits++;
if($visits>1) writef($visitpath,$visits);
}
?>
<!--
Author: Twily 2015-2022
http://twily.info/
Syntax Highlighting
https://highlightjs.org/
https://github.com/wcoder/highlightjs-line-numbers.js/
Flattr Icons
https://github.com/NitruxSA/flattr-icons
Twilight Vector
http://racer437.deviantart.com/art/Twilight-Sparkle-Vector-321236369
Other Sources:
http://stackoverflow.com/questions/1173194/select-all-div-text-with-single-mouse-click
http://stackoverflow.com/questions/1060008/is-there-a-way-to-detect-if-a-browser-window-is-not-currently-active
http://stackoverflow.com/questions/260857/changing-website-favicon-dynamically
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="description" content="<?php echo $description; ?>">
<meta name="keywords" content="<?php echo $keywords; if($view && is_file($fpath.$fname)) { echo ",".$fname; } ?>">
<title><?php echo $title." ~/".$path.$fname; ?></title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<meta name='viewport' content='width=device-width,initial-scale=1'>
<link id="favicon" rel="shortcut icon" href="/favicon.ico?v=2" />
<link rel="stylesheet" type="text/css" href="/<?php echo $root; ?>css/style.css?v=3.03" />
<?php if($view) { ?>
<style type="text/css">
.listv .td:nth-child(3) { display: none !important; }
.listv .td:nth-child(4) { display: none !important; }
</style>
<?php } ?>
<?php if($view) echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"/".$root."css/highlight.css?v=5\" />\n"; ?>
<script type="text/javascript">
var smallscreen=false;
var path="<?php echo $path; ?>";
var file="<?php echo $fname; ?>";
var ip="<?php echo $_SERVER['HTTP_X_FORWARDED_FOR']; ?>";
</script>
<script type="text/javascript" src="/<?php echo $root; ?>js/main.js?v=1.99"></script>
</head>
<body onload="init();">
<div id="toptitle"><h3>< <?php echo $title; ?> ></h3>
<br />
Filter: <input type="text" value="" placeholder="" id="filterField" onchange="filterItems(this.value);" onkeyup="filterItems(this.value);" /> <span id="filterStat"></span>
</div>
<div id="twily"></div>
<div id="container" onmousedown="bodytouch();" ontouchstart="bodytouch();"<?php if($_SESSION['embed']) { echo " class=\"embed\""; } ?>>
<div class="tbl" id="maintbl">
<div class="tr">
<div class="td" style="width: <?php echo ($view)?"50%":"100%" ?>;">
<a class="btn bb<?php if($path=="") echo " selected"; ?>" href="/<?php echo $root; ?>" target="_self">~</a><?php
$lpath=explode("/",$path);
for($i=0;$i<count($lpath)-1;$i++) {
$lpath_url="/".$root;
$selected="";
for($j=0;$j<=$i;$j++) $lpath_url.=$lpath[$j]."/";
if($i==count($lpath)-2) $selected=" selected";
echo "<a class=\"btn bb".$selected."\" href=\"".$lpath_url."\" target=\"_self\">".$lpath[$i]."</a>";
}
?>
<div class="action" id="dirbtn2"<?php if($view) echo " style=\"display: none;\""; ?>>
<span class="items"><?php echo $items; ?></span>
<?php if($path<>"") { ?>
• <a class="btn bb" href="<?php echo "/".$root.$dl.$path; ?>" target="_blank">Download ./*</a>
<?php } ?>
</div>
<hr />
<div class="action" id="dirbtn">
<span class="items"><?php echo $items; ?></span>
<?php if($path<>"") { ?>
• <a class="btn bb" href="<?php echo "/".$root.$dl.$path; ?>" target="_blank">Download ./*</a>
<?php } ?>
</div>
<div style="clear: both;"></div>
<br />
<div id="browse">
<?php
//$upath=$root.$path;
//$up=substr($upath,0,strrpos($upath,"/"));
//$up=substr($upath,0,strrpos($up,"/"));
$upath=explode("/",$root.$path);
$up="";
for($i=0;$i<count($upath)-2;$i++) {
$up.="/".$upath[$i];
}
if($up<>"") $up.="/";
else $up="/";
$listhtml="";
$listhtml.="<div class=\"tbl\">";
$listhtml.="<div class=\"tr\">";
$listhtml.="<div class=\"td\">";
$listhtml.=" <a class=\"dir\" href=\"".$up."\" target=\"_self\"><div class=\"tbl listv\"><div class=\"tr\"><div class=\"td\"><div class=\"icon\"><img src=\"/".$root."img/folder-up.png\" onload=\"this.style.visibility='visible';\" /></div></div><div class=\"td\">..</div><div class=\"td\"></div><div class=\"td\"></div></div></div></a>\n";
//$listhtml.="<div class=\"td\"></div>"; // ts ?
//$listhtml.="</div><div class=\"td\">$ts</div>"; // ts ?
//$listhtml.="</div>";
$listhtml.="</div></div>";
for($i=0;$i<count($darr);$i++) { // Create directories
$hidden="";
$cutn="";
$dimg="folder.png";
if(substr($darr[$i][1],0,1)==".") $hidden=" hid";
if(strlen($darr[$i][1])>$fnamelen) $cutn="...";
if($path.$darr[$i][1]=="stuff") $dimg="desktop.png";
if($darr[$i][1]!="secrets") {
//$ts_get=filemtime($fpath.$darr[$i][1]);
////$fs_get=filesize($fpath.$darr[$i][1]);
//$timestamp=date($dformat,$ts_get);
//$ts_get=time()-$ts_get;
//list($ts_get,$color)=colortime($ts_get);
$ts_get=$darr[$i][2];
$color=$darr[$i][3];
//$fs_get=$farr[$i][5];
$fs_get=" ";
//if($fs_get>(1024*1024*1024)) {//gb
// $fs_get=round($fs_get/1024/1024/1024,1)." GB";
//} else if($fs_get>(1024*1024)) {//mb
// $fs_get=round($fs_get/1024/1024,1)." MB";
//} else if($fs_get>(1024)) {// kb
// $fs_get=round($fs_get/1024)." KB";
//} else {
// $fs_get=$fs_get." B";
//}
$altcolor="";
$kw=strtolower($darr[$i][1]);
switch($kw) {
case (preg_match('/(prefa)|(materi)|(animat)|(vfx)/', $kw) ? true : false):
$altcolor=" style=\"color: #8695fb;\""; // blue/grey
break;
case (preg_match('/(model)|(fbx)|(mesh)|(blende)/', $kw) ? true : false):
$altcolor=" style=\"color: #ff7a93;\""; // red
break;
case (preg_match('/(audio)|(sound)|(copilot)/', $kw) ? true : false):
$altcolor=" style=\"color: #88e5ad;\""; // green
break;
case (preg_match('/(terra)|(textur)|(icon)|(image)|(ui)/', $kw) ? true : false):
$altcolor=" style=\"color: #2fa954;\""; // deep green
break;
//case (preg_match('/*textures*/', $kw) ? true : false):
//case (preg_match('/*icons*/', $kw) ? true : false):
//case (preg_match('/*audio*/', $kw) ? true : false):
//case (preg_match('/*video*/', $kw) ? true : false):
default:
//$altcolor=" style=\"color: #000;\"";
}
$listhtml.="<div class=\"tr\">";
$listhtml.="<div class=\"td\">";
$listhtml.=" <a class=\"dir".$hidden."\" href=\"/".$root.str_replace($bad,$good,$path.$darr[$i][1])."/\" target=\"_self\"><div class=\"tbl listv\"><div class=\"tr\"><div class=\"td\"><div class=\"icon\"><img src=\"/".$root."img/".$dimg."\" onload=\"this.style.visibility='visible';\" /></div></div><div class=\"td\"$altcolor>".substr($darr[$i][1],0,$fnamelen).$cutn."</div><div class=\"td\">$fs_get</div><div class=\"td\" style=\"color: $color;\">$ts_get</div></div></div></a>\n";
//$listhtml.="</div><div class=\"td\">$ts</div>"; // ts ?
//$listhtml.="</div>";
$listhtml.="</div></div>";
}
}
for($i=0;$i<count($farr);$i++) { // Create files
$info=pathinfo($fpath.$farr[$i][1]);
$img="unknown.png";
$skip=false;
$tmb=false;
$mtyp="";
switch(strtolower($info['extension'])) { // Detect filetype by extension
case "png": case "jpg": case "jpeg": case "bmp": case "gif": case "xbm": case "ico": case "webp": case "svg":
$img="image.png";
$thash=md5($path.$farr[$i][1]);
//$img=md5($path.$farr[$i][1]);
if(file_exists($root."thumbs/".$thash.".jpg")) {
$img="thumbs/".$thash.".jpg";
$tmb=true;
}
$mtyp=" mimg";
break;
case "wav": case "wma": case "mp3": case "ogg": case "flac": case "midi":
$img="audio.png"; break;
case "avi": case "mp4": case "mkv": case "webm":
$img="video.png";
$thash=md5($path.$farr[$i][1]);
if(file_exists($root."/thumbs/".$thash.".jpg")) {
$img="thumbs/".$thash.".jpg";
$tmb=true;
}
$mtyp=" mvid";
break;
case "zip": case "7z": case "tar": case "gz": case "rar":
$img="archive.png"; break;
case "xml": case "xhtml": case "html": case "php":
$img="xml.png"; break;
case "txt": case "log": case "conf":
$img="text.png"; break;
case "otf": case "pcf": case "ttf":
$img="font.png"; break;
case "c": case "cpp":
$img="c.png"; break;
case "pl":
$img="perl.png"; break;
case "py":
$img="python.png"; break;
case "sh":
$img="script.png"; break;
case "css":
$img="css.png"; break;
case "js":
$img="js.png"; break;
case "url":
$img="url.png"; break;
case "$":
$img="info.png"; break;
case "meta":
$skip=true; break;
case "prefab":
$img="flattr_extended/application-x-perl.png";
break;
case "mat":
$img="flattr_extended/application-x-designer.png";
break;
case "fbx":
$img="flattr_extended/text-x-cmake.png";
break;
case "cs":
$img="flattr_extended/text-csharp.png";
break;
case "blend": case "blend1":
$img="flattr_extended/blender.png";
break;
default:
$img="unknown.png";
}
if(!$skip) {
if($img=="unknown.png") { // Dig deeper; regex first line
//$line=(new SplFileObject($fpath.$farr[$i][1]))->fgets();
$fh=fopen($fpath.$farr[$i][1],'r');
$line=fread($fh,64);
fclose($fh);
switch($line) {
case (preg_match('/#!.*sh.*/',$line)?true:false): // script match
$img="script.png"; break;
case (preg_match('/[^\x00-\x7F]/',$line)?true:false): // binary match
$img="application.png"; break;
case (preg_match('/[ -~]/',$line)?true:false): // ascii match
$img="text.png"; break;
default:
$img="unknown.png";
}
}
$selected="";
$hidden="";
$cutn="";
$new="";
if(time()-filemtime($fpath.$farr[$i][1])<$oldafter) { $new=" new"; }
if($view) if($fname==$farr[$i][1]) $selected=" selected";
if(substr($farr[$i][1],0,1)==".") $hidden=" hid";
if(strlen($farr[$i][1])>$fnamelen) $cutn="...";
$target="_self";
$href="".str_replace($bad,$good,$path.$farr[$i][1])."#view"; // Standard local file link
/* Make *.url files open the links directly */
/*if($info['extension']=="url") { // .url file - link contained url instead
$target="_blank";
$href=str_replace("\n","",readf($fpath.$farr[$i][1])); // just in case the .url file contains newline
}*/
$listhtml.="<div class=\"tr\">";
$listhtml.="<div class=\"td\">";
if($selected<>"") {
$listhtml.="<div id=\"view_old\"></div>";
}
$limg="img/";
if($tmb) {
$limg="";
}
//$ts_get=filemtime($fpath.$farr[$i][1]);
//$fs_get=filesize($fpath.$farr[$i][1]);
//$timestamp=date($dformat,$ts_get);
//$ts_get=time()-$ts_get;
//list($ts_get,$color)=colortime($ts_get);
$fs_get=$farr[$i][5];
$ts_get=$farr[$i][2];
$color=$farr[$i][3];
if($fs_get>(1024*1024*1024)) {//gb
$fs_get=round($fs_get/1024/1024/1024,1)." GB";
} else if($fs_get>(1024*1024)) {//mb
$fs_get=round($fs_get/1024/1024,1)." MB";
} else if($fs_get>(1024)) {// kb
$fs_get=round($fs_get/1024)." KB";
} else {
$fs_get=$fs_get." B";
}
$listhtml.=" <a class=\"file".$selected.$hidden.$new.$mtyp."\" href=\"/".$root.$href."\" target=\"".$target."\"><div class=\"tbl listv\"><div class=\"tr\"><div class=\"td\"><div class=\"icon\"><img src=\"/".$root.$limg.$img."\" onload=\"this.style.visibility='visible';\" /></div></div><div class=\"td\">".substr($farr[$i][1],0,$fnamelen).$cutn."</div><div class=\"td\">$fs_get</div><div class=\"td\" style=\"color: $color;\">$ts_get</div></div></div></a>\n";
//$listhtml.="</div><div class=\"td\">$ts</div>"; // ts ?
//$listhtml.="</div>";
$listhtml.="</div></div>";
} // skip
}
$listhtml.="</div>";
echo $listhtml;
?>
</div>
</div>
<div class="td" style="width: <?php echo ($view)?"50%":"0" ?>; position: relative;">
<div id="followView" style="position: absolute; width: 100%;">
<!--<div id="view"></div>-->
<?php
$audiotrig=0;
if($view) { // File preview
if(file_exists($vpath)) {
$mtime=filemtime($vpath);
$timestamp=date($dformat,$mtime);
$mtime=time()-$mtime;
list($mtime,$color)=colortime($mtime);
$data=explode("\n",readf($analytics));
$fviews=0;
for($i=0;$i<count($data);$i++) {
$dna=explode("",$data[$i]);
if($dna[1]==$path.$fname) $fviews++;
}
/*$fh=fopen($analytics,'r');
if(flock($fh,LOCK_EX)) {
while(!feof($fh)) {
$line=explode("\v",stream_get_line($fh,4096));
//$line=explode("\v",fgetc($fh,4096));
if($line[1]==$path.$fname) $fviews++;
}
flock($fh,LOCK_UN);
}
fclose($fh);*/
$lpath=explode("/",$path);
for($i=count($lpath)-2;$i<count($lpath)-1;$i++) {
$lpath_url="#";
if(count($lpath)<2) $lpath[$i]="~";
//if($lpath[$i]<>"") echo "<a class=\"btn bt\" href=\"".$lpath_url."\" target=\"_self\">".$lpath[$i]."</a>";
}
echo "<a class=\"btn bt selected\" href=\"/".$root.$path.$fname."#view\" target=\"_self\">".$fname."</a>\n"
."<br /><hr />"
."<div class=\"action\">\n"
."<span class=\"statsf2\">"
."<span class=\"fviews\">".number_format($fviews,0,","," ")."</span>• "
."<span class=\"lastm\" style=\"color: ".$color.";\" title=\"Last modified ".$timestamp."\">".$mtime."</span>• "
."</span>\n"
."<a class=\"btn bt\" href=\"/".$root.$dpath."\" target=\"_blank\">Download</a>"
."<a class=\"btn bt\" href=\"/".$root."s/".$path.$fname."\" target=\"_blank\">Raw</a>"
."<a class=\"btn bt\" href=\"/".$root.$path."\" target=\"_self\">Close</a>\n"
."</div>\n"
."<div style=\"clear: both;\"></div>\n"
."<div class=\"statsf\">\n"
."<span class=\"lastm\" style=\"color: ".$color.";\" title=\"Last modified ".$timestamp."\">".$mtime."</span>• "
."<span class=\"fviews\">".number_format($fviews,0,","," ")."</span>\n"
."</div>\n";
$info=pathinfo($vpath);
$bprev="";
$prev="";
switch(strtolower($info['extension'])) { // Detect best way to preview by file extension
case "png": case "jpg": case "jpeg": case "bmp": case "gif": case "ico": case "webp": case "svg":
$prev="<br /><br /><img id=\"text\" class=\"media\" onmouseover=\"zindex(this.id);\" src=\"/".str_replace($bad,$good,$root."s/".$path.$fname)."\" /><br /><br />\n";
break;
case "wav": case "mp3": case "ogg": // wma
$prev="<br /><br /><audio id=\"text\" class=\"media\" onmouseover=\"zindex(this.id);\" autoplay controls loop style=\"height: 50px; width: 100%;\"><source src=\"/".str_replace($bad,$good,$root."s/".$path.$fname)."\"></audio></br /><div id=\"audiocont\"><input type=\"checkbox\" id=\"playnext\" onchange=\"checkAudioCont();\" onclick=\"checkAudioCont();\" /><label for=\"playnext\">Play next in folder</label></div><br />\n";
$audiotrig=1;
break;
case "fbx": // gltf / obj / babylon files need different loader
$prev="<iframe src='/three-fbx-loader/examples/index.php?p=s/".$path.$fname."' id='ifrm' frameborder='0'></iframe>";
break;
case "mp4": case "webm": // avi mkv wmv
$prev="<br /><br /><video id=\"text\" class=\"media\" onmouseover=\"zindex(this.id);\" autoplay controls loop><source src=\"/".str_replace($bad,$good,$root."s/".$path.$fname)."\"></video><br /><br />\n";
break;
case "url":
$fc=readf($vpath);
$fctarget="_blank";
$fclnk="";
$fchref=$fc;
if(substr($fc,0,1)=="/") { // inside link
$fctarget="_self";
$fclnk="~";
$fchref="/".$root.substr($fc,1);
}
$prev="<br /><br /><br /><a class=\"btn\" href=\"".$fchref."\" target=\"".$fctarget."\">".$fclnk.$fc."</a><br /><br /><br /><br />\n";
break;
case "$":
echo "<br /><br /><div id=\"text\" onmouseover=\"zindex(this.id);\"><div id=\"code\">\n";
if(is_file($vpath)) include($vpath);
echo "</div></div><br /><br />\n";
break;
default:
$bad=array("&","<",">");
$good=array("&","<",">");
$prev=true;
if(filesize($vpath)>(1024*1024*75)) {
$prev=false;
} else {
$fc=readf($vpath);
$tmp=explode("\n",$fc);
if(preg_match('/[^\x00-\x7F]/',$tmp[0])) { // Detect binary file
$prev=false;
}
if($info['extension']=='apk' ||
$info['extension']=='dex' ||
$info['extension']=='res' ||
$info['extension']=='jar' ||
$info['extension']=='idsig') {
$prev=false;
}
}
if($prev) {
$fc=str_replace($bad,$good,$fc);
$bprev="<br /><a class=\"btn bt\" href=\"javascript:selectText();\" target=\"_self\">{}</a>";
$prev="<div id=\"view_old\"></div><pre id=\"text\" onmouseover=\"zindex(this.id);\" onclick=\"zindex(this.id);\"><code id=\"code\">".$fc."</code></pre><br />\n";
//$prev.="<br /><pre id=\"text\" onmouseover=\"zindex(this.id);\" onclick=\"zindex(this.id);\"><code id=\"code\" onmousedown=\"selectText(event,1);\" onmouseup=\"selectText(event,2);\">".$fc."</code></pre><br />\n";
} else {
$prev="<br /><br /><no preview><br /><br /><br />\n";
}
?>
<script type="text/javascript" src="/<?php echo $root; ?>js/highlight.min.js?v=1"></script>
<script type="text/javascript" src="/<?php echo $root; ?>js/highlightjs-line-numbers.min.js?v=1"></script>
<script type="text/javascript">
//hljs.configure({useBR: true,tabReplace: ' ',classPrefix: ''});
//hljs.initHighlightingOnLoad();
//hljs.initLineNumbersOnLoad();
if(typeof hljs!=='undefined') {
hljs.configure({forceLineNumberOnSingleLine: true,tabReplace: ' ',classPrefix: ''});
}
</script>
<?php
}
echo $bprev."<center style=\"width: 100%; position: absolute;\">\n".$prev."\n<hr />\n<a class=\"btn bb\" id=\"top\" href=\"#\" target=\"_self\">Top</a>\n</center>\n";
}
}
?>
</div>
</div>
</div>
</div> <!-- followView -->
<br />
<script type="text/javascript">function contact(x) { window.location.href='mailto:'+x.replace(' at ','@').replace(' dot ','.'); }</script>
<!--<div id="copyleft"><span class="cleft"><a class="btn bb" href="https://en.wikipedia.org/wiki/Copyleft" target="_blank">©</a></span><a class="btn bt" href="/<?php echo $root; ?>" target="_self"><?php echo $copyl; ?></div>
<div id="contact"><a class="btn bt" href="javascript:contact('<?php echo $email; ?>');" target="_self"><?php echo $email; ?></a></div>-->
<?php
if($view) {
echo "<br /><br /><br /><iframe src=\"/".$root."comment/?f=".hash('sha256',$path.$fname)."\" id=\"comment\" onload=\"loadCmt('comment');\"></iframe>";
}
?>
<div id="visits"><?php echo number_format($visits,0,","," "); ?> visits</div>
</div>
<div id="bg"></div>
<script type="text/javascript">
var root="<?php echo $root; ?>";
var audiotrig=<?php echo $audiotrig; ?>;
var lt,l=true;
function createChat() {
return;
var i=document.createElement("iframe");
i.id="chat";
i.src="/"+root+"chat/";
i.scrolling="no";
i.onmouseover=function() { zindex(i.id); };
i.onload=function() {
i.style.visibility="visible";
<?php if(!$_SESSION['activated']) { ?>
if(l) {
clearTimeout(lt);
lt=setTimeout(function() { i.src=i.src; l=false; },1000);
}
<?php $_SESSION['activated']=true; } ?>
};
<?php if($_SESSION['embed']) { ?>
i.style.height="100%";
<?php } ?>
document.body.appendChild(i);
}
if(window.addEventListener) window.addEventListener("load",createChat,false);
else if(window.attachEvent) window.attachEvent("onload",createChat);
else window.onload=createChat;
function restore_chat() {
$('chat').contentWindow.document.getElementById('nick').value="/exit";
$('chat').contentWindow.post();
document.getElementsByTagName('body')[0].removeChild($('chat'));
createChat();
}
</script>
<a id="chat_restore" class="btn" href="javascript:restore_chat();" target="_self">...</a>
<a id="top_arrow" class="btn arrow bt" href="#view" target="_self">^</a>
<a id="bot_arrow" class="btn arrow bb" href="#comment" target="_self">v</a>
<div id="control" onmouseenter="showBar();" onmouseleave="hideBar();" style="/*display: none;*/ z-index: 4000;">
<label>Auto-scroll</label>
<input type="button" value="Up" id="btnScrollU" onclick="toggleScroll('Up');" />
<input type="button" value="Down" id="btnScrollD" onclick="toggleScroll('Down');" />
<input type="button" value="-" onclick="changeSpeed(-1);" />
<input type="button" value="+" onclick="changeSpeed(1);" />
<span id="scrollSpeed" style="display: none;"></span>
<!--<div style="float: right;">
<input type="range" min="0" max="200" value="0" onchange="changeBorder(this.value);" />
</div>-->
</div>
<script type="text/javascript">
setTimeout(async function() {
if(typeof hljs!=='undefined') {
var blocks=document.getElementsByTagName('code');
if(blocks.length>0) {
hljs.highlightBlock(blocks[0]);
hljs.lineNumbersBlock(blocks[0]);
}
}
});
<?php if(!isset($_SESSION['firstload'])) {
$_SESSION['firstload']=1;
?>
setTimeout(function() { hideBar(); },1000);
<?php } else { ?>
hideBar();
<?php } ?>
var tbl=$('browse').getElementsByClassName('tbl')[0];
var trs=$('browse').getElementsByClassName('tr');
var firsts=1; // idx skip+
var lasts=0; // idx skip-
var btotal=0;
var bcount=0;
function filterItems(tags="") {
btotal=0;
bcount=0;
localStorage.setItem("filterTags",tags);
localStorage.setItem("lastPath",path);
for(var i=firsts;i<(trs.length-lasts);i++) {
if(trs[i].parentElement==tbl) {
var listv=trs[i].getElementsByClassName('listv')[0];
var name=listv.getElementsByClassName('td')[1].innerHTML;
var comps=(name).toLowerCase();
var tagsplit=[];
if(tags.indexOf(" ")!=-1) {
tagsplit=tags.toLowerCase().split(" ");
} else {
tagsplit.push(tags.toLowerCase());
}
var bmatch=false;
if(tagsplit.length>1 || tagsplit[0]!="") {
for(var j=0;j<tagsplit.length;j++) {
if(comps.indexOf(tagsplit[j])!=-1) {
// found
bmatch=true;
break;
}
}
} else {
bmatch=true; // clear
}
if(bmatch) {
trs[i].style.display="";
bcount++;
} else {
trs[i].style.display="none";
}
btotal++;
} // correct parent
//
}
$('filterStat').innerHTML=bcount+"/"+btotal;
}
var oldtags="";
if(localStorage.getItem("filterTags")) {
var lastpath=localStorage.getItem("lastPath");
if(lastpath==path) {
oldtags=localStorage.getItem("filterTags");
$('filterField').value=oldtags;
} else {
localStorage.removeItem("filterTags");
localStorage.removeItem("lastPath");
}
}
filterItems(oldtags); // init
</script>
<script type="text/javascript">
var tabTime=0;
var tabRefS=60*60*4; // seconds in background inactive before a force refresh trigger on re-entry
document.addEventListener("visibilitychange", function() {
if (document.hidden){
//console.log("Browser tab is hidden")
tabTime=new Date().getTime();
} else {
//console.log("Browser tab is visible")
var nTime=new Date().getTime();
if(nTime-tabTime>(tabRefS*1000) && tabTime!=0) {
location.reload();
} else {
tabTime=0;
}
}
});
window.addEventListener('scroll',function(e) {
//console.log('tesy');
//var max=document.body.scrollHeight;
var max=$('container').scrollHeight;
var ntl=0;
//var cur=window.scrollY;
//var cur=document.body.scrollTop;
var cur=window.scrollY;
var nts="";
if(cur+window.innerHeight>=max) nts="max";
else if(cur==0) nts="min";
var percent=Math.round(cur*100/max);
scrollbgto(percent);
// var parentmsg=['scrollbgto',percent,cur,nts,ntl];
// parent.postMessage(JSON.stringify(parentmsg),'*');
//
//if(typeof checkScroll==='function') {
// checkScroll();
//}
});
</script>
</body>
</html>
Top