From d59cb00da74360bacdc1c60ac1aca7c79d4e5c46 Mon Sep 17 00:00:00 2001 From: filesite Date: Wed, 18 Sep 2024 16:23:25 +0800 Subject: [PATCH] add menu toggle icon --- themes/beauty/views/site/index.php | 10 ++++++++-- www/css/beauty.css | 7 +++++++ www/img/beauty/arrow-left-circle.svg | 4 ++++ www/img/beauty/arrow-right-circle.svg | 4 ++++ www/js/beauty.js | 21 +++++++++++++++++++++ 5 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 www/img/beauty/arrow-left-circle.svg create mode 100644 www/img/beauty/arrow-right-circle.svg diff --git a/themes/beauty/views/site/index.php b/themes/beauty/views/site/index.php index 85a1ede..85936c1 100644 --- a/themes/beauty/views/site/index.php +++ b/themes/beauty/views/site/index.php @@ -10,6 +10,11 @@ $supportedExts = array_merge($imgExts, $videoExts); $authConfig = FSC::$app['config']['password_auth']; $dir_ext_status = !empty($_COOKIE['dir_ext_status']) ? $_COOKIE['dir_ext_status'] : 'opened'; +$menu_ext_status = !empty($_COOKIE['menu_ext_status']) ? $_COOKIE['menu_ext_status'] : 'opened'; + +$menu_expand_icon_cls = $menu_ext_status == 'opened' ? '' : 'closed'; +$menu_expand_icon_url = $menu_ext_status == 'opened' ? 'arrow-left-circle.svg' : 'arrow-right-circle.svg'; +$main_view_cls = $menu_ext_status == 'opened' ? '' : 'full'; ?> -
+
+ + + diff --git a/www/img/beauty/arrow-right-circle.svg b/www/img/beauty/arrow-right-circle.svg new file mode 100644 index 0000000..cf884b7 --- /dev/null +++ b/www/img/beauty/arrow-right-circle.svg @@ -0,0 +1,4 @@ + + + + diff --git a/www/js/beauty.js b/www/js/beauty.js index 3b718c4..89a3c70 100644 --- a/www/js/beauty.js +++ b/www/js/beauty.js @@ -786,6 +786,27 @@ $('.btn-dir-ext').click(function(evt) { $('.btn-dir-ext').find('img').attr('src', '/img/arrow-up.svg'); $('.btn-dir-ext').find('span').text(opened_title); + Cookies.set(cookieKey, 'opened', { expires: 1 }); + } +}); + +$('.expand-icon').click(function(evt) { + var cookieKey = 'menu_ext_status'; + var status = $('.expand-icon').attr('data-status'); + + if (!status || status == 'opened') { + $('.expand-icon').attr('data-status', 'closed'); + $('.img_main').addClass('full'); + $('.expand-icon img').attr('src', '/img/beauty/arrow-right-circle.svg'); + $('.navbar-fixed-left').addClass('closed'); + + Cookies.set(cookieKey, 'closed', { expires: 1 }); + }else { + $('.expand-icon').attr('data-status', 'opened'); + $('.img_main').removeClass('full'); + $('.expand-icon img').attr('src', '/img/beauty/arrow-left-circle.svg'); + $('.navbar-fixed-left').removeClass('closed'); + Cookies.set(cookieKey, 'opened', { expires: 1 }); } }); \ No newline at end of file