mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-12-23 01:20:11 +00:00
Fix broken theme button after changing bootstrap version
Also fix the theme cookie if it's for the wrong version.
This commit is contained in:
parent
086fd0ef2f
commit
a5a721b07c
@ -35,16 +35,22 @@
|
|||||||
{{ else }}
|
{{ else }}
|
||||||
const bsVersion = 4;
|
const bsVersion = 4;
|
||||||
{{ end }}
|
{{ end }}
|
||||||
const cssFile = "{{ .cssFile }}";
|
var cssFile = "{{ .cssFile }}";
|
||||||
var css = document.createElement('link');
|
var css = document.createElement('link');
|
||||||
css.setAttribute('rel', 'stylesheet');
|
css.setAttribute('rel', 'stylesheet');
|
||||||
css.setAttribute('type', 'text/css');
|
css.setAttribute('type', 'text/css');
|
||||||
var cssCookie = getCookie("css");
|
var cssCookie = getCookie("css");
|
||||||
if (cssCookie.includes('bs' + bsVersion)) {
|
if (cssCookie.includes('bs' + bsVersion)) {
|
||||||
css.setAttribute('href', cssCookie);
|
cssFile = cssCookie;
|
||||||
|
} else if (cssCookie.includes('bs')) {
|
||||||
|
if (cssCookie.includes('jf')) {
|
||||||
|
cssFile = 'bs' + bsVersion + '-jf.css';
|
||||||
} else {
|
} else {
|
||||||
|
cssFile = 'bs' + bsVersion + '.css';
|
||||||
|
}
|
||||||
|
document.cookie = 'css=' + cssFile;
|
||||||
|
}
|
||||||
css.setAttribute('href', cssFile);
|
css.setAttribute('href', cssFile);
|
||||||
};
|
|
||||||
document.head.appendChild(css);
|
document.head.appendChild(css);
|
||||||
</script>
|
</script>
|
||||||
{{ if not .bs5 }}
|
{{ if not .bs5 }}
|
||||||
|
Loading…
Reference in New Issue
Block a user