Source code of filesite.io. https://filesite.io
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

79 lines
2.1 KiB

<div class="menu">
<?php
$selectedId = $viewData['cateId'];
if (!empty($viewData['menus'])) {
foreach($viewData['menus'] as $index => $item) {
$selected = $item['id'] == $selectedId ? 'selected' : '';
echo <<<eof
<a href="/?id={$item['id']}" class="{$selected}">{$item['directory']}</a>
eof;
}
}
?>
</div>
<div class="hr"></div>
<div class="content markdown-body">
<?php
$imgExts = ['jpg', 'jpeg', 'png', 'gif'];
$category = $viewData['scanResults'][$selectedId];
if (!empty($category['directories'])) { //两级目录支持
foreach($category['directories'] as $dir) {
echo <<<eof
<a href="{$dir['path']}" class="img-item">
eof;
if (!empty($dir['snapshot'])) {
echo <<<eof
<img src="{$dir['snapshot']}" alt="{$dir['directory']}">
eof;
}else if (!empty($dir['files'])) {
$first_img = array_shift($dir['files']);
if (!in_array($first_img['extension'], $imgExts)) {
foreach($dir['files'] as $file) {
if (in_array($file['extension'], $imgExts)) {
$first_img = $file;
break;
}
}
}
if (in_array($first_img['extension'], $imgExts)) {
echo <<<eof
<img src="{$first_img['path']}" alt="{$first_img['filename']}">
eof;
}
}
echo <<<eof
<strong>{$dir['directory']}</strong>
</a>
eof;
}
}else if (!empty($category['files'])) { //一级目录支持
foreach($category['files'] as $file) {
if (!in_array($file['extension'], $imgExts)) {continue;}
echo <<<eof
<a href="{$file['path']}" class="img-item img-preview" target="_blank">
<img src="{$file['path']}" alt="{$file['filename']}">
</a>
eof;
}
}
?>
</div>
<div class="modal-mask" id="modal_about">
<div class="modal-about">
<div class="modal-head">
<h3>关于GoogleImage</h3>
<span class="btn-close" role="button"><svg width="24" height="24" viewBox="0 0 24 24" focusable="false" class=" NMm5M"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"></path></svg></span>
</div>
<div class="hr"></div>
<div class="modal-body markdown-body">
<?php echo $viewData['html']; ?>
</div>
</div>
</div>