[setup] drop hideable setup sections
this is mostly-broken; and when it works, it is confusing; and the code is bad
This commit is contained in:
parent
cc69ecb74a
commit
9ed58a69a0
4 changed files with 4 additions and 72 deletions
|
@ -94,11 +94,10 @@ class SetupTheme extends Themelet
|
||||||
{
|
{
|
||||||
$h = $block->header;
|
$h = $block->header;
|
||||||
$b = $block->body;
|
$b = $block->body;
|
||||||
$i = preg_replace('/[^a-zA-Z0-9]/', '_', $h) . "-setup";
|
|
||||||
$html = "
|
$html = "
|
||||||
<section class='setupblock'>
|
<section class='setupblock'>
|
||||||
<b class='shm-toggler' data-toggle-sel='#$i'>$h</b>
|
<b>$h</b>
|
||||||
<br><div id='$i'>$b</div>
|
<br>$b
|
||||||
</section>
|
</section>
|
||||||
";
|
";
|
||||||
return $html;
|
return $html;
|
||||||
|
|
|
@ -4,43 +4,11 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shimmie2;
|
namespace Shimmie2;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class CustomSetupTheme
|
|
||||||
*
|
|
||||||
* A customised version of the Setup theme.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
class CustomSetupTheme extends SetupTheme
|
class CustomSetupTheme extends SetupTheme
|
||||||
{
|
{
|
||||||
protected function sb_to_html(SetupBlock $block): string
|
protected function sb_to_html(SetupBlock $block): string
|
||||||
{
|
{
|
||||||
$h = $block->header;
|
$html = parent::sb_to_html($block);
|
||||||
$b = $block->body;
|
|
||||||
$i = preg_replace('/[^a-zA-Z0-9]/', '_', $h) . "-setup";
|
|
||||||
$html = "
|
|
||||||
<script type='text/javascript'>
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
|
||||||
$(\"#$i-toggle\").click(function() {
|
|
||||||
$(\"#$i\").slideToggle(\"slow\", function() {
|
|
||||||
if($(\"#$i\").is(\":hidden\")) {
|
|
||||||
shm_cookie_set(\"$i-hidden\", 'true');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
shm_cookie_set(\"$i-hidden\", 'false');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
if(shm_cookie_get(\"$i-hidden\") == 'true') {
|
|
||||||
$(\"#$i\").hide();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<div class='setupblock'>
|
|
||||||
<b id='$i-toggle'>$h</b>
|
|
||||||
<br><div id='$i'>$b</div>
|
|
||||||
</div>
|
|
||||||
";
|
|
||||||
|
|
||||||
return "<div class='tframe'>$html</div>";
|
return "<div class='tframe'>$html</div>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,6 @@ use MicroHTML\HTMLElement;
|
||||||
|
|
||||||
use function MicroHTML\{A,DIV,SPAN,joinHTML};
|
use function MicroHTML\{A,DIV,SPAN,joinHTML};
|
||||||
|
|
||||||
/**
|
|
||||||
* Class Themelet
|
|
||||||
*/
|
|
||||||
class Themelet extends BaseThemelet
|
class Themelet extends BaseThemelet
|
||||||
{
|
{
|
||||||
public function display_paginator(Page $page, string $base, ?string $query, int $page_number, int $total_pages, bool $show_random = false)
|
public function display_paginator(Page $page, string $base, ?string $query, int $page_number, int $total_pages, bool $show_random = false)
|
||||||
|
|
|
@ -4,43 +4,11 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Shimmie2;
|
namespace Shimmie2;
|
||||||
|
|
||||||
/**
|
|
||||||
* Class CustomSetupTheme
|
|
||||||
*
|
|
||||||
* A customised version of the Setup theme.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
class CustomUserConfigTheme extends UserConfigTheme
|
class CustomUserConfigTheme extends UserConfigTheme
|
||||||
{
|
{
|
||||||
protected function sb_to_html(SetupBlock $block): string
|
protected function sb_to_html(SetupBlock $block): string
|
||||||
{
|
{
|
||||||
$h = $block->header;
|
$html = parent::sb_to_html($block);
|
||||||
$b = $block->body;
|
|
||||||
$i = preg_replace('/[^a-zA-Z0-9]/', '_', $h) . "-setup";
|
|
||||||
$html = "
|
|
||||||
<script type='text/javascript'>
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
|
||||||
$(\"#$i-toggle\").click(function() {
|
|
||||||
$(\"#$i\").slideToggle(\"slow\", function() {
|
|
||||||
if($(\"#$i\").is(\":hidden\")) {
|
|
||||||
shm_cookie_set(\"$i-hidden\", 'true');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
shm_cookie_set(\"$i-hidden\", 'false');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
if(shm_cookie_get(\"$i-hidden\") == 'true') {
|
|
||||||
$(\"#$i\").hide();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<div class='setupblock'>
|
|
||||||
<b id='$i-toggle'>$h</b>
|
|
||||||
<br><div id='$i'>$b</div>
|
|
||||||
</div>
|
|
||||||
";
|
|
||||||
|
|
||||||
return "<div class='tframe'>$html</div>";
|
return "<div class='tframe'>$html</div>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue