sync/www/js/theme.js

29 lines
731 B
JavaScript
Raw Normal View History

2014-01-29 22:50:14 -06:00
(function () {
var c = document.cookie.split(";").map(function (s) {
return s.trim();
});
var theme = "default";
for (var i = 0; i < c.length; i++) {
if (c[i].indexOf("cytube-theme=") === 0) {
theme = c[i].split("=")[1];
break;
}
}
2014-02-18 21:56:54 -06:00
console.log("cookie theme=", theme);
2014-01-29 22:50:14 -06:00
if (theme !== "default") {
var cur = document.getElementById("usertheme");
cur.parentNode.removeChild(cur);
2014-02-18 21:56:54 -06:00
console.log('removed');
2014-01-29 22:50:14 -06:00
var css = document.createElement("link");
css.setAttribute("rel", "stylesheet");
css.setAttribute("type", "text/css");
css.setAttribute("href", theme);
2014-02-02 12:41:41 -06:00
css.setAttribute("id", "usertheme");
2014-01-29 22:50:14 -06:00
document.head.appendChild(css);
2014-02-18 21:56:54 -06:00
console.log(css);
2014-01-29 22:50:14 -06:00
}
})();