Skip to content

Commit

Permalink
added sticky support
Browse files Browse the repository at this point in the history
  • Loading branch information
nomadjimbob committed May 3, 2024
1 parent ba4c334 commit aa80004
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ If the plugin is installed, the **Template Styles Settings** page will be expand
- Fixed incorrect style file names. Thanks Wolfram.
- Table cell padding now adjustable through the style config page. Thanks Hakker.
- Added ability to style row border color through the style config page. Thanks Elanndelh.
- Added option to make the left sidebar sticky. Requested by Wolfram.

- **_2024-02-09_**
- Added support for DokuWiki Kaos
Expand Down
6 changes: 6 additions & 0 deletions assets/mikio.less
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,12 @@
position: sticky;
}

.mikio-sidebar-sticky {
position: -webkit-sticky;
position: sticky;
top: 1rem;
}

.mikio-pre-wrap {
white-space: pre-wrap;
white-space: -moz-pre-wrap;
Expand Down
6 changes: 4 additions & 2 deletions conf/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,5 +100,7 @@
$conf['includePageUseACL'] = 1;
$conf['includePagePropagate'] = 1;

$conf['fixedTopHeader'] = 0;
$conf['fixedNavbar'] = 0;
$meta['stickyTopHeader'] = 0;
$meta['stickyNavbar'] = 0;
$meta['stickyHeader'] = 0;
$meta['stickyLeftSidebar'] = 0;
1 change: 1 addition & 0 deletions conf/metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,4 @@
$meta['stickyTopHeader'] = ['onoff'];
$meta['stickyNavbar'] = ['onoff'];
$meta['stickyHeader'] = ['onoff'];
$meta['stickyLeftSidebar'] = ['onoff'];
1 change: 1 addition & 0 deletions lang/en/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,4 @@
$lang['stickyTopHeader'] = 'Make the top header part sticky';
$lang['stickyNavbar'] = 'Make the navbar sticky';
$lang['stickyHeader'] = 'Make the header part sticky';
$lang['stickyLeftSidebar'] = 'Make the left sidebar sticky';
21 changes: 18 additions & 3 deletions mikio.php
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,11 @@ public function getConf(string $key, $default = false)
['keys' => ['brandURLUser'], 'type' => 'string'],

['keys' => ['useLESS'], 'type' => 'bool'],

['keys' => ['stickyTopHeader'], 'type' => 'bool'],
['keys' => ['stickyNavbar'], 'type' => 'bool'],
['keys' => ['stickyHeader'], 'type' => 'bool'],
['keys' => ['stickyLeftSidebar'], 'type' => 'bool'],
];

foreach ($data as $row) {
Expand Down Expand Up @@ -968,10 +973,20 @@ public function includeSidebar(string $prefix = '', bool $print = true, bool $pa
}

if (empty($html) === false) {
$html = '<aside class="mikio-sidebar mikio-sidebar-' . (empty($prefix) === true ? 'left' : $prefix) .
'"><a class="mikio-sidebar-toggle' .
$sidebarClasses = [
'mikio-sidebar',
'mikio-sidebar-' . (empty($prefix) === true ? 'left' : $prefix)
];

$collapseClasses = ['mikio-sidebar-collapse'];

if(empty($prefix) === true && $this->getConf('stickyLeftSidebar') === true) {
$collapseClasses[] = 'mikio-sidebar-sticky';
}

$html = '<aside class="' . implode(' ', $sidebarClasses) . '"><a class="mikio-sidebar-toggle' .
($this->getConf('sidebarMobileDefaultCollapse') === true ? ' closed' : '') . '" href="#">' .
tpl_getLang('sidebar-title') . ' <span class="icon"></span></a><div class="mikio-sidebar-collapse">' .
tpl_getLang('sidebar-title') . ' <span class="icon"></span></a><div class="' . implode(' ', $collapseClasses) . '">' .
$html . '</div></aside>';
}

Expand Down

0 comments on commit aa80004

Please sign in to comment.