From 00d36bc66549fa877b75ba1a1f091ff538c641dd Mon Sep 17 00:00:00 2001 From: wangyidong Date: Wed, 8 Nov 2023 09:45:27 +0800 Subject: [PATCH] * Adjust floatprenextbtn. --- lib/zin/wg/floatprenextbtn/js/v1.js | 24 ++++++++++++------------ lib/zin/wg/floatprenextbtn/v1.php | 4 ++-- lib/zin/wg/globalsearch/v1.php | 11 ++++------- 3 files changed, 18 insertions(+), 21 deletions(-) diff --git a/lib/zin/wg/floatprenextbtn/js/v1.js b/lib/zin/wg/floatprenextbtn/js/v1.js index 8d471a64fa..38166e856d 100644 --- a/lib/zin/wg/floatprenextbtn/js/v1.js +++ b/lib/zin/wg/floatprenextbtn/js/v1.js @@ -1,24 +1,24 @@ -function updateBtnPosition(margin) +function updateBtnPosition(margin, offset) { const preBtn = document.querySelector('#preButton'); const nextBtn = document.querySelector('#nextButton'); - if(preBtn) - { - $(preBtn).css('top', margin); - } - - if(nextBtn) - { - $(nextBtn).css('top', margin); - } + if(preBtn) $(preBtn).css('top', margin).css('left', offset); + if(nextBtn) $(nextBtn).css('top', margin).css('right', offset); } window.addEventListener('resize', function(event) { - updateBtnPosition(event.target.innerHeight / 2); + updateBtnPosition(event.target.innerHeight / 2, getOffset()); }); +window.getOffset = function() +{ + let $mainContainer = $('#mainContainer'); + let offset = parseFloat($mainContainer.css('margin-left')) + parseFloat($mainContainer.css('padding-left')); + return offset; +} + $(() => { - updateBtnPosition(window.innerHeight / 2); + updateBtnPosition(window.innerHeight / 2, getOffset()); }); diff --git a/lib/zin/wg/floatprenextbtn/v1.php b/lib/zin/wg/floatprenextbtn/v1.php index 8144158d17..61828d6648 100644 --- a/lib/zin/wg/floatprenextbtn/v1.php +++ b/lib/zin/wg/floatprenextbtn/v1.php @@ -30,7 +30,7 @@ class floatPreNextBtn extends wg ( setID('preButton'), set::url($preLink), - setClass('float-btn fixed left-0 z-10'), + setClass('float-btn fixed z-10'), set::icon('angle-left'), set('data-app', $app->tab) ) : null, @@ -38,7 +38,7 @@ class floatPreNextBtn extends wg ( setID('nextButton'), set::url($nextLink), - setClass('float-btn fixed right-0 z-10'), + setClass('float-btn fixed z-10'), set::icon('angle-right'), set('data-app', $app->tab) ) : null, diff --git a/lib/zin/wg/globalsearch/v1.php b/lib/zin/wg/globalsearch/v1.php index 1c325d91fc..582b177b14 100644 --- a/lib/zin/wg/globalsearch/v1.php +++ b/lib/zin/wg/globalsearch/v1.php @@ -6,9 +6,9 @@ class globalSearch extends wg { protected static array $defineProps = array( 'commonSearchText?: string', - 'commonSearchUrl: string', - 'searchItems: array', - 'searchFunc: callable' + 'commonSearchUrl?: string', + 'searchItems?: array', + 'searchFunc?: callable' ); public static function getPageJS(): string|false @@ -26,10 +26,7 @@ class globalSearch extends wg unset($lang->searchObjects['all']); $searchItems = array(); - foreach($lang->searchObjects as $key => $module) - { - $searchItems[] = array('key' => $key, 'text' => $module); - } + foreach($lang->searchObjects as $key => $module) $searchItems[] = array('key' => $key, 'text' => $module); $this->setDefaultProps(array( 'commonSearchText' => $lang->searchAB,