2014-01-30 04:50:14 +00:00
|
|
|
(function () {
|
|
|
|
var c = document.cookie.split(";").map(function (s) {
|
|
|
|
return s.trim();
|
|
|
|
});
|
|
|
|
|
2014-02-25 00:25:49 +00:00
|
|
|
var theme = "/css/themes/slate.css";
|
2014-01-30 04:50:14 +00:00
|
|
|
for (var i = 0; i < c.length; i++) {
|
|
|
|
if (c[i].indexOf("cytube-theme=") === 0) {
|
|
|
|
theme = c[i].split("=")[1];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-28 05:38:22 +00:00
|
|
|
if (theme == null || !theme.match(/^\/css\/themes\/\w+.css$/)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-02-25 00:25:49 +00:00
|
|
|
if (theme !== "/css/themes/slate.css") {
|
|
|
|
console.log("THEME COOKIE:", theme);
|
2014-01-30 04:50:14 +00:00
|
|
|
var cur = document.getElementById("usertheme");
|
|
|
|
cur.parentNode.removeChild(cur);
|
|
|
|
var css = document.createElement("link");
|
|
|
|
css.setAttribute("rel", "stylesheet");
|
|
|
|
css.setAttribute("type", "text/css");
|
|
|
|
css.setAttribute("href", theme);
|
2014-02-02 18:41:41 +00:00
|
|
|
css.setAttribute("id", "usertheme");
|
2014-01-30 04:50:14 +00:00
|
|
|
document.head.appendChild(css);
|
|
|
|
}
|
|
|
|
})();
|