HTML:
public static function footerJS($conent)
{
$options = Helper::options();
$pluginRoot = Typecho_Common::url('DarkReader', $options->pluginUrl);
$darkreader = Typecho_Widget::widget('Widget_Options')->plugin('DarkReader');
$cls = "off" . ($conent ? " front" : " admin");
echo <<<CODE
<div id="darkreader-btn-light" class="$cls" title="开灯"></div>
<link rel="stylesheet" href="$pluginRoot/style.css">
<script src="https://cdn.jsdelivr.net/npm/js-polyfills" nomodule ></script>
<script src="https://cdn.jsdelivr.net/npm/darkreader"></script>
<script>
!function() {
var params = [$darkreader->themeOptions, '$darkreader->fixes', $darkreader->isIFrame];
var el = document.getElementById('darkreader-btn-light');
el.onclick = function() {
var className = el.className, title = '';
if (className.indexOf('on ') > -1) {
className = className.replace('on ', 'off ');
title = '开灯';
DarkReader.enable(params[0], params[1], params[2]);
} else {
className = className.replace('off ', 'on ');
title = '关灯';
DarkReader.disable();
}
el.className = className;
el.title = title;
};
DarkReader.enable(params[0], params[1], params[2]);
}();
</script>
CODE;
}
}
是否cokie没记录上,导致重新刷新又返回初始的变化,请问如何解决?谢谢

请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。