Browse Source

beauty theme improved

master
filesite 5 months ago
parent
commit
f20a4ae26e
  1. 2
      lib/DirScanner.php
  2. 6
      themes/beauty/controller/ListController.php
  3. 6
      themes/beauty/controller/SiteController.php
  4. 2
      themes/beauty/views/layout/main.php
  5. 38
      themes/beauty/views/site/index.php
  6. 5
      www/css/beauty.css
  7. 4
      www/img/beauty/folder.svg
  8. 25
      www/img/beauty/image.svg
  9. 2
      www/img/beauty/video.svg
  10. 2
      www/js/beauty.js

2
lib/DirScanner.php

@ -87,7 +87,7 @@ Class DirScanner {
//不允许包含斜杠/,反斜杠\,单引号',双引号",空格字符 //不允许包含斜杠/,反斜杠\,单引号',双引号",空格字符
//忽略.开头的隐藏文件 //忽略.开头的隐藏文件
private function isValid($name) { private function isValid($name) {
return str_replace(['/', '\\', "'", '"', ' '], '', $name) == $name && !preg_match('/^\..+/', $name); return str_replace(['/', '\\', "'", '"'], '', $name) == $name && !preg_match('/^\..+/', $name);
} }
//解析描述文件内容 //解析描述文件内容

6
themes/beauty/controller/ListController.php

@ -65,6 +65,10 @@ Class ListController extends Controller {
$mp3File = $scanner->getDefaultFile('mp3'); $mp3File = $scanner->getDefaultFile('mp3');
} }
//翻页支持
$page = $this->get('page', 1);
$pageSize = $this->get('limit', 24);
$pageTitle = !empty($titles) ? $titles[0]['name'] : "FileSite.io - 无数据库、基于文件和目录的Markdown文档、网址导航、图书、图片、视频网站PHP开源系统"; $pageTitle = !empty($titles) ? $titles[0]['name'] : "FileSite.io - 无数据库、基于文件和目录的Markdown文档、网址导航、图书、图片、视频网站PHP开源系统";
if (!empty($subcate)) { if (!empty($subcate)) {
$pageTitle = "{$subcate['directory']}的照片,来自{$pageTitle}"; $pageTitle = "{$subcate['directory']}的照片,来自{$pageTitle}";
@ -75,7 +79,7 @@ Class ListController extends Controller {
$viewName = '//site/index'; //共享视图 $viewName = '//site/index'; //共享视图
$params = compact( $params = compact(
'cateId', 'dirTree', 'scanResults', 'menus', 'htmlReadme', 'breadcrumbs', 'htmlCateReadme', 'cateId', 'dirTree', 'scanResults', 'menus', 'htmlReadme', 'breadcrumbs', 'htmlCateReadme',
'mp3File' 'mp3File', 'page', 'pageSize'
); );
return $this->render($viewName, $params, $pageTitle); return $this->render($viewName, $params, $pageTitle);
} }

6
themes/beauty/controller/SiteController.php

@ -62,6 +62,10 @@ Class SiteController extends Controller {
$mp3File = $scanner->getDefaultFile('mp3'); $mp3File = $scanner->getDefaultFile('mp3');
} }
//翻页支持
$page = $this->get('page', 1);
$pageSize = $this->get('limit', 24);
$pageTitle = !empty($titles) ? $titles[0]['name'] : "FileSite.io - 无数据库、基于文件和目录的Markdown文档、网址导航、图书、图片、视频网站PHP开源系统"; $pageTitle = !empty($titles) ? $titles[0]['name'] : "FileSite.io - 无数据库、基于文件和目录的Markdown文档、网址导航、图书、图片、视频网站PHP开源系统";
if (!empty($readmeFile['title'])) { if (!empty($readmeFile['title'])) {
$pageTitle = $readmeFile['title']; $pageTitle = $readmeFile['title'];
@ -72,7 +76,7 @@ Class SiteController extends Controller {
$viewName = 'index'; $viewName = 'index';
$params = compact( $params = compact(
'cateId', 'dirTree', 'scanResults', 'menus', 'htmlReadme', 'htmlCateReadme', 'cateId', 'dirTree', 'scanResults', 'menus', 'htmlReadme', 'htmlCateReadme',
'mp3File' 'mp3File', 'page', 'pageSize'
); );
return $this->render($viewName, $params, $pageTitle); return $this->render($viewName, $params, $pageTitle);
} }

2
themes/beauty/views/layout/main.php

@ -68,9 +68,11 @@ eof;
<li class="scroll_top scroll_topJS"> <li class="scroll_top scroll_topJS">
<img class="icon svg" src="/img/beauty/huojian.svg" alt="回到顶部" title="点击回到顶部" /> <img class="icon svg" src="/img/beauty/huojian.svg" alt="回到顶部" title="点击回到顶部" />
</li> </li>
<?php if (!empty($viewData['mp3File'])) { ?>
<li class="music_switch musicJS"> <li class="music_switch musicJS">
<img class="icon svg verMiddle" src="/img/beauty/music.svg" alt="音乐" title="开启关闭音乐" /> <img class="icon svg verMiddle" src="/img/beauty/music.svg" alt="音乐" title="开启关闭音乐" />
</li> </li>
<?php } ?>
<li class="connectmeJS"> <li class="connectmeJS">
<img class="icon3 svg verMiddle" src="/img/beauty/contactUs.svg" alt="联系我们" title="联系我们" /> <img class="icon3 svg verMiddle" src="/img/beauty/contactUs.svg" alt="联系我们" title="联系我们" />
</li> </li>

38
themes/beauty/views/site/index.php

@ -36,9 +36,9 @@ eof;
<?php /* <?php /*
<form class="navbar-form navbar-left"> <form class="navbar-form navbar-left">
<div class="form-group"> <div class="form-group">
<input type="text" class="form-control" placeholder="Search"> <input type="text" class="form-control" placeholder="搜索图片名称">
</div> </div>
<button type="submit" class="btn btn-default">Submit</button> <button type="submit" class="btn btn-default">搜索</button>
</form> </form>
*/ ?> */ ?>
<div class="nb_right nav navbar-nav navbar-right hidden-xs"> <div class="nb_right nav navbar-nav navbar-right hidden-xs">
@ -80,6 +80,7 @@ eof;
<?php <?php
$imgExts = !empty(FSC::$app['config']['supportedImageExts']) ? FSC::$app['config']['supportedImageExts'] : array('jpg', 'jpeg', 'png', 'webp', 'gif'); $imgExts = !empty(FSC::$app['config']['supportedImageExts']) ? FSC::$app['config']['supportedImageExts'] : array('jpg', 'jpeg', 'png', 'webp', 'gif');
$category = !empty($viewData['scanResults'][$selectedId]) ? $viewData['scanResults'][$selectedId] : []; $category = !empty($viewData['scanResults'][$selectedId]) ? $viewData['scanResults'][$selectedId] : [];
$total = 0; //翻页支持
//当前目录的描述介绍 //当前目录的描述介绍
if (!empty($category['description'])) { if (!empty($category['description'])) {
@ -96,6 +97,7 @@ eof;
} }
if (!empty($category['directories'])) { //两级目录支持 if (!empty($category['directories'])) { //两级目录支持
$total = count($category['directories']); //翻页支持
$index = 0; $index = 0;
foreach ($category['directories'] as $dir) { foreach ($category['directories'] as $dir) {
echo <<<eof echo <<<eof
@ -144,37 +146,63 @@ eof;
$title = !empty($dir['title']) ? $dir['title'] : $dir['directory']; $title = !empty($dir['title']) ? $dir['title'] : $dir['directory'];
echo <<<eof echo <<<eof
<div class="im_img_title"> <div class="im_img_title">
<span>{$title}</span> <span>
<img src="/img/beauty/folder.svg" alt="folder" width="24">
{$title}
</span>
</div> </div>
</a> </a>
</div> </div>
eof; eof;
$index++; $index++;
} }
//分割目录和文件
echo '</div>';
if (!empty($category['files'])) {
echo '<hr>';
}
echo '<div class="im_mainl row">';
} }
if (!empty($category['files'])) { //一级目录支持 if (!empty($category['files'])) { //一级目录支持
$total = count($category['files']); //翻页支持
$index = 0; $index = 0;
foreach ($category['files'] as $file) { foreach ($category['files'] as $file) {
if (!in_array($file['extension'], $imgExts)) { if (!in_array($file['extension'], $imgExts)) {
continue; continue;
} }
if ($index >= $viewData['pageSize']) {break;} //翻页支持
$title = !empty($file['title']) ? $file['title'] : $file['filename']; $title = !empty($file['title']) ? $file['title'] : $file['filename'];
if ($index > 0) { if ($index > 0) {
echo <<<eof echo <<<eof
<div class="im_item bor_radius col-xs-6 col-sm-4 col-md-3 col-lg-2"> <div class="im_item bor_radius col-xs-6 col-sm-4 col-md-3 col-lg-2">
<a href="javascript:;" class="bor_radius" data-fancybox="gallery" data-src="{$file['path']}" data-caption="图片{$title}"> <a href="javascript:;" class="bor_radius" data-fancybox="gallery" data-src="{$file['path']}" data-caption="{$title}" title="{$title}">
<img src="/img/beauty/lazy.svg" data-original="{$file['path']}" class="bor_radius im_img lazy" alt="{$file['filename']}"> <img src="/img/beauty/lazy.svg" data-original="{$file['path']}" class="bor_radius im_img lazy" alt="{$file['filename']}">
<div class="im_img_title">
<span>
<img src="/img/beauty/image.svg" alt="image" width="20">
{$title}
</span>
</div>
</a> </a>
</div> </div>
eof; eof;
} else { } else {
echo <<<eof echo <<<eof
<div class="im_item bor_radius col-xs-6 col-sm-4 col-md-3 col-lg-2"> <div class="im_item bor_radius col-xs-6 col-sm-4 col-md-3 col-lg-2">
<a href="javascript:;" class="bor_radius" data-fancybox="gallery" data-src="{$file['path']}" data-caption="图片{$title}"> <a href="javascript:;" class="bor_radius" data-fancybox="gallery" data-src="{$file['path']}" data-caption="{$title}" title="{$title}">
<img src="{$file['path']}" class="bor_radius im_img" alt="{$file['filename']}"> <img src="{$file['path']}" class="bor_radius im_img" alt="{$file['filename']}">
<div class="im_img_title">
<span>
<img src="/img/beauty/image.svg" alt="image" width="20">
{$title}
</span>
</div>
</a> </a>
</div> </div>
eof; eof;

5
www/css/beauty.css

@ -59,11 +59,12 @@ a:link{text-decoration:none}
.im_img:hover{transform:scale(1.03)} .im_img:hover{transform:scale(1.03)}
.im_item{padding:5px;height:16vw;overflow:hidden} .im_item{padding:5px;height:16vw;overflow:hidden}
.im_item>a{overflow: hidden;display:block;position:relative;width: 100%;height: 100%} .im_item>a{overflow: hidden;display:block;position:relative;width: 100%;height: 100%}
.im_img_title{background:rgba(7, 7, 7, .3);position:absolute;left:0;right:0;bottom:0;top:0;color:#FFF;border-radius:10px} .im_img_title{background:rgba(7, 7, 7, .1);position:absolute;left:0;right:0;bottom:0;top:0;color:#FFF;border-radius:10px}
.im_item:hover .im_img{transform:scale(1.03)} .im_item:hover .im_img{transform:scale(1.03)}
.im_img_title span{position:absolute;bottom:10px;left:10px;margin-right:10px;font-weight:bold;padding:5px;border:solid 2px #FFF;border-radius:10px} .im_img_title span{position:absolute;bottom:10px;left:10px;margin-right:10px;font-weight:bold;padding:5px;border:solid 2px #FFF;border-radius:10px}
.im_img_title img{vertical-align:bottom}
.web_info{padding:10px 0 42px 0;margin-top:15px;border-top:solid 1px #f5f5f5} .web_info{padding:10px 0 42px 0;margin-top:75px;border-top:solid 1px #f5f5f5}
.web_info p{color:#808080;font-size:13px;margin:5px 0} .web_info p{color:#808080;font-size:13px;margin:5px 0}
.web_info a{text-decoration: underline;color:#808080} .web_info a{text-decoration: underline;color:#808080}
.web_info a:hover{color:#000} .web_info a:hover{color:#000}

4
www/img/beauty/folder.svg

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="100" height="100" viewBox="0 0 48 48">
<path fill="#FFA000" d="M40,12H22l-4-4H8c-2.2,0-4,1.8-4,4v8h40v-4C44,13.8,42.2,12,40,12z"></path><path fill="#FFCA28" d="M40,12H8c-2.2,0-4,1.8-4,4v20c0,2.2,1.8,4,4,4h32c2.2,0,4-1.8,4-4V16C44,13.8,42.2,12,40,12z"></path>
</svg>

After

Width:  |  Height:  |  Size: 372 B

25
www/img/beauty/image.svg

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg height="800px" width="800px" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 368 368" xml:space="preserve">
<g transform="translate(22 26)">
<path style="fill:#9CE0FF;" d="M306,14c17.6,0,32,14.4,32,32v224c0,17.6-14.4,32-32,32H18c-17.6,0-32-14.4-32-32V46
c0-17.6,14.4-32,32-32H306L306,14z"/>
<path style="fill:#80D440;" d="M334,178.8l-47.6-47.6c-3.2-3.2-8-3.2-11.2,0l-96.8,95.2l-60-56.4L-0.8,296.8h336L334,178.8z"/>
<path style="fill:#62C418;" d="M177.2,222.8l-52.4-50.4c-3.2-3.2-8-3.2-11.2,0L-10,294h120L177.2,222.8z"/>
<g>
<path style="fill:#5F961D;" d="M132,278c-2,0-4-0.8-5.6-2.4c-3.2-3.2-3.2-8,0-11.2l8-8c3.2-3.2,8-3.2,11.2,0c3.2,3.2,3.2,8,0,11.2
l-8,8C136,277.2,134,278,132,278z"/>
<path style="fill:#5F961D;" d="M-1.2,293.2c-2,0-4-0.8-5.6-2.4c-3.2-3.2-3.2-8.4,0-11.2L108.8,166c3.2-3.2,7.2-4.8,11.2-4.8
s8.4,1.6,11.2,4.8l46.4,46.4c3.2,3.2,3.2,8,0,11.2s-8,3.2-11.2,0L120,177.2L4.4,290.8C2.8,292.4,0.8,293.2-1.2,293.2z"/>
</g>
<path style="fill:#5F971D;" d="M156.8,252.8c-2,0-4-0.8-5.6-2.4c-3.2-3.2-3.2-8,0-11.2l118.4-117.6c6.4-6.4,16-6.4,22.4,0
l47.6,47.6c3.2,3.2,3.2,8,0,11.2s-8,3.2-11.2,0l-47.6-47.6L162.4,250.4C160.8,252,158.8,252.8,156.8,252.8z"/>
<path style="fill:#62A2DD;" d="M306,310H18c-22,0-40-18-40-40V46C-22,24-4,6,18,6h288c22,0,40,18,40,40v224
C346,292,328,310,306,310z M18,22C4.8,22-6,32.8-6,46v224c0,13.2,10.8,24,24,24h288c13.2,0,24-10.8,24-24V46c0-13.2-10.8-24-24-24
H18z"/>
<circle style="fill:#FFE53C;" cx="66" cy="94" r="24"/>
<path style="fill:#F3D933;" d="M66,118c13.2,0,24-10.8,24-24S79.2,70,66,70C66,94,66,99.6,66,118z"/>
<path style="fill:#C39215;" d="M66,126c-17.6,0-32-14.4-32-32s14.4-32,32-32s32,14.4,32,32S83.6,126,66,126z M66,78
c-8.8,0-16,7.2-16,16s7.2,16,16,16s16-7.2,16-16S74.8,78,66,78z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

2
www/img/beauty/video.svg

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="800px" height="800px" viewBox="0 0 1024 1024" class="icon" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M21.333329 405.333462l981.333129 0 0 597.333209-981.333129 0 0-597.333209Z" fill="#9FDBAD" /><path d="M959.9998 426.666791a21.333329 21.333329 0 0 1 21.333329 21.333329v511.999893a21.333329 21.333329 0 0 1-21.333329 21.333329H63.999987a21.333329 21.333329 0 0 1-21.333329-21.333329V448.00012a21.333329 21.333329 0 0 1 21.333329-21.333329h895.999813m0-42.666658H63.999987a63.999987 63.999987 0 0 0-63.999987 63.999987v511.999893a63.999987 63.999987 0 0 0 63.999987 63.999987h895.999813a63.999987 63.999987 0 0 0 63.999987-63.999987V448.00012a63.999987 63.999987 0 0 0-63.999987-63.999987z" fill="#5C2D51" /><path d="M66.986653 407.040129a15.999997 15.999997 0 0 1-15.359997-11.946665L21.333329 281.600155a15.999997 15.999997 0 0 1 11.519997-19.626663L951.679802 21.333542h4.053332a15.999997 15.999997 0 0 1 15.359997 11.946664l29.653327 113.49331a15.999997 15.999997 0 0 1-11.519997 19.626663L71.039985 406.613462z" fill="#FFFFFF" /><path d="M951.893135 43.946871l27.093328 103.253312L70.826652 384.000133l-26.879994-102.613312L951.893135 43.946871M955.733134 0.000213a37.333326 37.333326 0 0 0-9.386664 1.28L27.946661 241.493496a37.333326 37.333326 0 0 0-26.666661 45.439991l29.653327 113.49331A37.333326 37.333326 0 0 0 76.373317 426.666791L994.986459 186.880174a37.333326 37.333326 0 0 0 26.666661-45.653323L991.999793 27.946874A37.333326 37.333326 0 0 0 955.733134 0.000213z" fill="#5C2D51" /><path d="M177.493296 224.426833l78.933317-20.693329 9.173332 151.893302-78.933317 20.693329-9.173332-151.893302z" fill="#F05071" /><path d="M236.799951 230.826832l6.399998 108.586644-36.906659 9.599998-6.399998-108.586644 36.906659-9.599998m39.466658-54.399989L155.306634 208.213503l11.519998 195.413293 120.959975-31.573327-11.519998-195.413292z" fill="#5C2D51" /><path d="M369.919923 174.080177l78.933317-20.693329 8.959998 152.106635-78.933317 20.479996-8.959998-151.893302z" fill="#F05071" /><path d="M429.013244 180.693509l6.399999 108.586644-36.693326 9.386665-6.399999-108.586644 36.906659-9.599998M469.333236 126.29352L347.519928 157.866847l11.519997 195.413293 120.959975-31.573327-10.666664-195.413293z" fill="#5C2D51" /><path d="M562.133216 123.733521l78.933317-20.693329 9.173332 152.106635-79.146651 20.693329-8.959998-152.106635z" fill="#F05071" /><path d="M621.439871 130.346853l6.399998 108.586644-36.906659 9.599998-6.399998-108.586644 36.906659-9.599998M661.333196 75.946864L539.946554 106.666858l11.519998 195.413292 120.959975-31.573326L661.333196 75.946864z" fill="#5C2D51" /><path d="M754.559843 73.386865l78.719983-20.479996 9.173332 151.893302-78.933317 20.693329-8.959998-152.106635z" fill="#F05071" /><path d="M813.653164 80.000197l6.399998 108.586644-36.906658 9.599998-6.399999-108.586644 36.906659-9.599998M853.333156 25.600208l-121.173309 31.573327 11.519998 195.413292 120.959975-31.573326L853.333156 25.600208z" fill="#5C2D51" /><path d="M429.013244 842.026705a42.666658 42.666658 0 0 1-42.666658-42.666658v-189.866627a42.666658 42.666658 0 0 1 42.666658-42.666658 42.666658 42.666658 0 0 1 21.333329 5.759999l165.973299 94.933313a42.666658 42.666658 0 0 1 0 74.666651l-165.973299 94.079981a42.666658 42.666658 0 0 1-21.333329 5.759999z" fill="#FDCA89" /><path d="M429.013244 587.306758a21.333329 21.333329 0 0 1 10.666664 2.986666l165.973299 94.933313a21.333329 21.333329 0 0 1 0 37.759992l-165.973299 94.933314a21.333329 21.333329 0 0 1-10.666664 2.986666 21.333329 21.333329 0 0 1-21.333329-21.333329v-189.866627a21.333329 21.333329 0 0 1 21.333329-21.333329m0-42.666658a63.999987 63.999987 0 0 0-63.999987 63.999987v189.866627a63.999987 63.999987 0 0 0 96.426647 55.893322l165.973299-94.933314a63.999987 63.999987 0 0 0 0-111.786643l-165.973299-94.933314a63.999987 63.999987 0 0 0-31.78666-8.533331z" fill="#5C2D51" /></svg>

After

Width:  |  Height:  |  Size: 3.8 KiB

2
www/js/beauty.js

@ -9,7 +9,7 @@ if ($('#image_site').get(0)) {
// 图片浏览 // 图片浏览
$('[data-fancybox]').fancybox({ $('[data-fancybox]').fancybox({
toolbar: true, toolbar: true,
loop: false, loop: true,
smallBtn: false, smallBtn: false,
buttons: ["zoom", "slideShow", "fullScreen", "download", "thumbs", "close"], buttons: ["zoom", "slideShow", "fullScreen", "download", "thumbs", "close"],
iframe: { iframe: {

Loading…
Cancel
Save