Commit 2e634017 authored by PoroCYon's avatar PoroCYon

fix theme toggle thing

parent 1c54e3b7
......@@ -3,7 +3,7 @@ function cookie_get(name) {
var value = "; " + document.cookie,
parts = value.split("; " + name + "=");
if (parts.length == 2) {
if (parts.length > 1) {
return parts.pop().split(";").shift();
}
}
......@@ -17,12 +17,12 @@ function toggle_theme() {
var links = document.getElementsByTagName("link");
for (var i = 0; i < links.length; i++) {
if (links[i].href.indexOf("stc/style-dark.css") !== -1) {
if (links[i].href.indexOf("/stc/style-dark.css") !== -1) {
links[i].href = links[i].href.replace("dark", "light");
cookie_create("pcy_theme=solarized_light");
break;
}
if (links[i].href.indexOf("stc/style-light.css") !== -1) {
if (links[i].href.indexOf("/stc/style-light.css") !== -1) {
links[i].href = links[i].href.replace("light", "dark");
cookie_create("pcy_theme=solarized_dark");
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment