From 81a13161f0653d3b05ef2d01eb59e38611269393 Mon Sep 17 00:00:00 2001 From: filesite Date: Thu, 18 Jul 2024 19:44:34 +0800 Subject: [PATCH] add toggle button for dirs --- themes/beauty/views/site/index.php | 21 +++++++++++++++++---- www/css/beauty.css | 4 ++++ www/js/beauty.js | 23 +++++++++++++++++++++-- 3 files changed, 42 insertions(+), 6 deletions(-) diff --git a/themes/beauty/views/site/index.php b/themes/beauty/views/site/index.php index 7ffddd1..8359504 100644 --- a/themes/beauty/views/site/index.php +++ b/themes/beauty/views/site/index.php @@ -114,8 +114,7 @@ eof; } ?> -
- {$viewData['htmlCateReadme']}
eof; } + ?> +
+ - + eof; if (!empty($dir['snapshot'])) { @@ -212,9 +218,16 @@ eof; //分割目录和文件 echo '
'; + if (!empty($category['files']) && count($category['files']) > 3) { - echo '
'; + echo << +
+ + +eof; } + echo '
'; } diff --git a/www/css/beauty.css b/www/css/beauty.css index 7e829f1..5c90668 100644 --- a/www/css/beauty.css +++ b/www/css/beauty.css @@ -124,6 +124,10 @@ a:link{text-decoration:none} .lampshow .text_dark{color:#808080} .lampshow .text_dark a{color:#f4f7fd} +.gap-hr{position:relative} +.gap-hr .btn-dir-ext{position:absolute;left:50%;top:50%;margin-top:-11px;margin-left:-26px} +.gap-hr .btn-dir-ext img{width:13px} + #qrimg{width:160px;height:160px;margin:0 auto 20px auto;background-color:#FFF;padding:5px;border:1px solid #EEE;border-radius:5px;overflow:hidden} .videoplayer{max-width:800px;margin:0 auto;text-align:center} diff --git a/www/js/beauty.js b/www/js/beauty.js index c7b2516..aed016d 100644 --- a/www/js/beauty.js +++ b/www/js/beauty.js @@ -235,7 +235,9 @@ $('.dir_item').each(function(index, el) { }, 100); } }else { - console.warn('目录 %s 里没有任何图片', id); + //console.warn('目录 %s 里没有任何图片', id); + var imgHtml = ''; + $(el).find('.im_img_title').before(imgHtml); } }).fail(function(jqXHR, textStatus, errorThrown) { console.error('获取封面图失败,错误信息:' + errorThrown); @@ -492,4 +494,21 @@ if ($('#my-player').length > 0 && typeof(videojs) != 'undefined') { clickedBtn.prop('disabled', false); }, 3000); }); -} \ No newline at end of file +} + + +//目录收拢、展开 +$('.btn-dir-ext').click(function(evt) { + var status = $('.btn-dir-ext').attr('data-status'); + if (status == 'open') { + $('.btn-dir-ext').attr('data-status', 'closed'); + $('.btn-dir-ext').parents('.gap-hr').prev('.im_mainl').addClass('hide'); + $('.btn-dir-ext').find('img').attr('src', '/img/arrow-down.svg'); + $('.btn-dir-ext').find('span').text('展开'); + }else { + $('.btn-dir-ext').attr('data-status', 'open'); + $('.btn-dir-ext').parents('.gap-hr').prev('.im_mainl').removeClass('hide'); + $('.btn-dir-ext').find('img').attr('src', '/img/arrow-up.svg'); + $('.btn-dir-ext').find('span').text('收拢'); + } +}); \ No newline at end of file