mirror of https://github.com/calzoneman/sync.git
Merge pull request #593 from Xaekai/themesanity
Default theme reference refactor
This commit is contained in:
commit
44cc6336b9
|
@ -2,7 +2,7 @@
|
||||||
"author": "Calvin Montgomery",
|
"author": "Calvin Montgomery",
|
||||||
"name": "CyTube",
|
"name": "CyTube",
|
||||||
"description": "Online media synchronizer and chat",
|
"description": "Online media synchronizer and chat",
|
||||||
"version": "3.18.3",
|
"version": "3.18.4",
|
||||||
"repository": {
|
"repository": {
|
||||||
"url": "http://github.com/calzoneman/sync"
|
"url": "http://github.com/calzoneman/sync"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
- var DEFAULT_THEME = "/css/themes/slate.css";
|
||||||
|
|
||||||
mixin head()
|
mixin head()
|
||||||
meta(charset="utf-8")
|
meta(charset="utf-8")
|
||||||
meta(name="viewport", content="width=device-width, initial-scale=1.0")
|
meta(name="viewport", content="width=device-width, initial-scale=1.0")
|
||||||
|
@ -7,7 +9,10 @@ mixin head()
|
||||||
title= siteTitle
|
title= siteTitle
|
||||||
link(href="/css/sticky-footer-navbar.css", rel="stylesheet")
|
link(href="/css/sticky-footer-navbar.css", rel="stylesheet")
|
||||||
link(href="/css/cytube.css", rel="stylesheet")
|
link(href="/css/cytube.css", rel="stylesheet")
|
||||||
link(id="usertheme", href="/css/themes/slate.css", rel="stylesheet")
|
link(id="usertheme", href=DEFAULT_THEME, rel="stylesheet")
|
||||||
|
|
||||||
|
script(type="text/javascript").
|
||||||
|
var DEFAULT_THEME = '#{DEFAULT_THEME}';
|
||||||
script(src="/js/theme.js")
|
script(src="/js/theme.js")
|
||||||
//[if lt IE 9]
|
//[if lt IE 9]
|
||||||
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
|
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
|
||||||
|
|
|
@ -97,7 +97,7 @@ function getOrDefault(k, def) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var USEROPTS = {
|
var USEROPTS = {
|
||||||
theme : getOrDefault("theme", "/css/themes/slate.css"),
|
theme : getOrDefault("theme", DEFAULT_THEME), // Set in head template
|
||||||
layout : getOrDefault("layout", "fluid"),
|
layout : getOrDefault("layout", "fluid"),
|
||||||
synch : getOrDefault("synch", true),
|
synch : getOrDefault("synch", true),
|
||||||
hidevid : getOrDefault("hidevid", false),
|
hidevid : getOrDefault("hidevid", false),
|
||||||
|
@ -204,9 +204,9 @@ function eraseCookie(name) {
|
||||||
(function () {
|
(function () {
|
||||||
var localVersion = parseFloat(getOpt("version"));
|
var localVersion = parseFloat(getOpt("version"));
|
||||||
if (isNaN(localVersion)) {
|
if (isNaN(localVersion)) {
|
||||||
USEROPTS.theme = "/css/themes/slate.css";
|
USEROPTS.theme = DEFAULT_THEME;
|
||||||
USEROPTS.layout = "fluid";
|
USEROPTS.layout = "fluid";
|
||||||
setOpt("theme", "/css/themes/slate.css");
|
setOpt("theme", DEFAULT_THEME);
|
||||||
setOpt("layout", "fluid");
|
setOpt("layout", "fluid");
|
||||||
setOpt("version", CL_VERSION);
|
setOpt("version", CL_VERSION);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
return s.trim();
|
return s.trim();
|
||||||
});
|
});
|
||||||
|
|
||||||
var theme = "/css/themes/slate.css";
|
// Set in the head template.
|
||||||
|
var theme = DEFAULT_THEME;
|
||||||
for (var i = 0; i < c.length; i++) {
|
for (var i = 0; i < c.length; i++) {
|
||||||
if (c[i].indexOf("cytube-theme=") === 0) {
|
if (c[i].indexOf("cytube-theme=") === 0) {
|
||||||
theme = c[i].split("=")[1];
|
theme = c[i].split("=")[1];
|
||||||
|
@ -15,8 +16,8 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (theme !== "/css/themes/slate.css") {
|
if (theme !== DEFAULT_THEME) {
|
||||||
console.log("THEME COOKIE:", theme);
|
console.info("THEME COOKIE:", theme);
|
||||||
var cur = document.getElementById("usertheme");
|
var cur = document.getElementById("usertheme");
|
||||||
cur.parentNode.removeChild(cur);
|
cur.parentNode.removeChild(cur);
|
||||||
var css = document.createElement("link");
|
var css = document.createElement("link");
|
||||||
|
|
|
@ -696,7 +696,7 @@ function applyOpts() {
|
||||||
var old = $("#usertheme").attr("id", "usertheme_old");
|
var old = $("#usertheme").attr("id", "usertheme_old");
|
||||||
var theme = USEROPTS.theme;
|
var theme = USEROPTS.theme;
|
||||||
if (theme === "default") {
|
if (theme === "default") {
|
||||||
theme = "/css/themes/slate.css";
|
theme = DEFAULT_THEME;
|
||||||
}
|
}
|
||||||
$("<link/>").attr("rel", "stylesheet")
|
$("<link/>").attr("rel", "stylesheet")
|
||||||
.attr("type", "text/css")
|
.attr("type", "text/css")
|
||||||
|
|
Loading…
Reference in New Issue