This repository has been archived on 2024-09-05. You can view files and clone it, but cannot push or open issues or pull requests.
shimmie2/themes/lite/setup.theme.php

47 lines
1 KiB
PHP
Raw Normal View History

2021-12-14 18:32:47 +00:00
<?php
declare(strict_types=1);
2014-04-29 05:51:13 +00:00
namespace Shimmie2;
2010-02-28 11:01:18 +00:00
/**
2014-04-29 05:51:13 +00:00
* Class CustomSetupTheme
*
* A customised version of the Setup theme.
*
2010-02-28 11:01:18 +00:00
*/
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', () => {
2010-02-28 11:01:18 +00:00
$(\"#$i-toggle\").click(function() {
$(\"#$i\").slideToggle(\"slow\", function() {
if($(\"#$i\").is(\":hidden\")) {
Cookies.set(\"$i-hidden\", 'true', {path: '/'});
2010-02-28 11:01:18 +00:00
}
else {
Cookies.set(\"$i-hidden\", 'false', {path: '/'});
2010-02-28 11:01:18 +00:00
}
});
});
if(Cookies.get(\"$i-hidden\") == 'true') {
2010-02-28 11:01:18 +00:00
$(\"#$i\").hide();
}
});
</script>
2010-02-28 11:01:18 +00:00
<div class='setupblock'>
<b id='$i-toggle'>$h</b>
<br><div id='$i'>$b</div>
</div>
";
2023-12-15 21:14:43 +00:00
return "<div class='tframe'>$html</div>";
}
2010-02-28 11:01:18 +00:00
}