mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-29 06:25:18 -04:00
Adds no-js fallback to PHP verison.
This commit is contained in:
parent
1828855f63
commit
4724214b9e
5 changed files with 55 additions and 5 deletions
|
@ -1,4 +1,6 @@
|
||||||
<!-- generated code ends here -->
|
<!-- generated code ends here -->
|
||||||
</div>
|
</div>
|
||||||
|
<script src="/_h5ai/config.js"></script>
|
||||||
|
<script src="/_h5ai/js/scripts.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -31,8 +31,6 @@
|
||||||
<span class="right"></span>
|
<span class="right"></span>
|
||||||
<span class="center"></span>
|
<span class="center"></span>
|
||||||
</div>
|
</div>
|
||||||
<script src="/_h5ai/config.js"></script>
|
|
||||||
<script src="/_h5ai/js/scripts.js"></script>
|
|
||||||
<div id="data-apache-autoindex" class="hideOnJs">
|
<div id="data-apache-autoindex" class="hideOnJs">
|
||||||
<!--
|
<!--
|
||||||
The following code was generated by Apache's autoindex module. It is not valid HTML5, but gets
|
The following code was generated by Apache's autoindex module. It is not valid HTML5, but gets
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
#data-apache-autoindex {
|
#data-apache-autoindex, #data-php-no-js-fallback {
|
||||||
max-width: 960px;
|
max-width: 960px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
|
|
||||||
|
@ -29,6 +29,11 @@
|
||||||
opacity: 0.9;
|
opacity: 0.9;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
span {
|
||||||
|
color: #555;
|
||||||
|
font-weight: normal;
|
||||||
|
opacity: 0.4;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
td {
|
td {
|
||||||
border: 1px solid #ddd;
|
border: 1px solid #ddd;
|
||||||
|
|
|
@ -32,8 +32,6 @@
|
||||||
<span class="right"></span>
|
<span class="right"></span>
|
||||||
<span class="center"></span>
|
<span class="center"></span>
|
||||||
</div>
|
</div>
|
||||||
<script src="/_h5ai/config.js"></script>
|
|
||||||
<script src="/_h5ai/js/scripts.js"></script>
|
|
||||||
<div id="data-generic-json" class="hidden">
|
<div id="data-generic-json" class="hidden">
|
||||||
<?php if (stripos($_SERVER["REQUEST_METHOD"], "HEAD") === false) {
|
<?php if (stripos($_SERVER["REQUEST_METHOD"], "HEAD") === false) {
|
||||||
|
|
||||||
|
@ -64,5 +62,13 @@
|
||||||
echo $h5ai->getGenericJson();
|
echo $h5ai->getGenericJson();
|
||||||
} ?>
|
} ?>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="data-php-no-js-fallback" class="hideOnJs">
|
||||||
|
<?php if (stripos($_SERVER["REQUEST_METHOD"], "HEAD") === false) {
|
||||||
|
|
||||||
|
echo $h5ai->getNoJsFallback();
|
||||||
|
} ?>
|
||||||
|
</div>
|
||||||
|
<script src="/_h5ai/config.js"></script>
|
||||||
|
<script src="/_h5ai/js/scripts.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -292,6 +292,45 @@ class H5ai {
|
||||||
|
|
||||||
return $entries;
|
return $entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function getNoJsFallback() {
|
||||||
|
|
||||||
|
date_default_timezone_set ("UTC");
|
||||||
|
|
||||||
|
function _cmp($entry1, $entry2) {
|
||||||
|
|
||||||
|
if ($entry1->isFolder && !$entry2->isFolder) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (!$entry1->isFolder && $entry2->isFolder) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return strcasecmp($entry1->absHref, $entry2->absHref);
|
||||||
|
}
|
||||||
|
|
||||||
|
$folder = Entry::get($this, $this->absPath, $this->absHref);
|
||||||
|
$entries = $folder->getContent();
|
||||||
|
uasort($entries, "_cmp");
|
||||||
|
|
||||||
|
$html = "<table>";
|
||||||
|
$html .= "<tr><th></th><th><span>Name</span></th><th><span>Last modified</span></th><th><span>Size</span></th></tr>";
|
||||||
|
if ($folder->parent) {
|
||||||
|
$html .= "<tr><td></td><td><a href=\"..\">Parent Directory</a></td><td></td><td></td></tr>";
|
||||||
|
}
|
||||||
|
foreach ($entries as $entry) {
|
||||||
|
$html .= "<tr>";
|
||||||
|
$html .= "<td></td>";
|
||||||
|
$html .= "<td><a href=\"" . $entry->absHref . "\">" . basename($entry->absPath) . ($entry->isFolder ? "/" : "") . "</a></td>";
|
||||||
|
$html .= "<td>" . date("Y-m-d H:i", $entry->date) . "</td>";
|
||||||
|
$html .= "<td>" . ($entry->size !== null ? intval($entry->size / 1000) . " KB" : "" ) . "</td>";
|
||||||
|
$html .= "</tr>";
|
||||||
|
}
|
||||||
|
$html .= "</table>";
|
||||||
|
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
Loading…
Add table
Add a link
Reference in a new issue