[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;
|
||||
$b = $block->body;
|
||||
$i = preg_replace('/[^a-zA-Z0-9]/', '_', $h) . "-setup";
|
||||
$html = "
|
||||
<section class='setupblock'>
|
||||
<b class='shm-toggler' data-toggle-sel='#$i'>$h</b>
|
||||
<br><div id='$i'>$b</div>
|
||||
<b>$h</b>
|
||||
<br>$b
|
||||
</section>
|
||||
";
|
||||
return $html;
|
||||
|
|
|
@ -4,43 +4,11 @@ declare(strict_types=1);
|
|||
|
||||
namespace Shimmie2;
|
||||
|
||||
/**
|
||||
* Class CustomSetupTheme
|
||||
*
|
||||
* A customised version of the Setup theme.
|
||||
*
|
||||
*/
|
||||
class CustomSetupTheme extends SetupTheme
|
||||
{
|
||||
protected function sb_to_html(SetupBlock $block): string
|
||||
{
|
||||
$h = $block->header;
|
||||
$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>
|
||||
";
|
||||
|
||||
$html = parent::sb_to_html($block);
|
||||
return "<div class='tframe'>$html</div>";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,9 +8,6 @@ use MicroHTML\HTMLElement;
|
|||
|
||||
use function MicroHTML\{A,DIV,SPAN,joinHTML};
|
||||
|
||||
/**
|
||||
* Class Themelet
|
||||
*/
|
||||
class Themelet extends BaseThemelet
|
||||
{
|
||||
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;
|
||||
|
||||
/**
|
||||
* Class CustomSetupTheme
|
||||
*
|
||||
* A customised version of the Setup theme.
|
||||
*
|
||||
*/
|
||||
class CustomUserConfigTheme extends UserConfigTheme
|
||||
{
|
||||
protected function sb_to_html(SetupBlock $block): string
|
||||
{
|
||||
$h = $block->header;
|
||||
$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>
|
||||
";
|
||||
|
||||
$html = parent::sb_to_html($block);
|
||||
return "<div class='tframe'>$html</div>";
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue