stylig bug fixed
This commit is contained in:
@@ -62,13 +62,14 @@ var themes = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function applyTheme() {
|
function applyTheme() {
|
||||||
if (location.search.length > 0) {
|
|
||||||
var ui = { theme: "default" };
|
var ui = { theme: "default" };
|
||||||
|
if (location.search.length > 0) {
|
||||||
location.search.slice(1).split("&").reduce(function(acc, e){
|
location.search.slice(1).split("&").reduce(function(acc, e){
|
||||||
var p = e.split("=");
|
var p = e.split("=");
|
||||||
acc[p[0]] = p[1];
|
acc[p[0]] = p[1];
|
||||||
return acc
|
return acc
|
||||||
}, ui);
|
}, ui);
|
||||||
|
}
|
||||||
|
|
||||||
var vars = {
|
var vars = {
|
||||||
'@background': themes[ui.theme].background.normal,
|
'@background': themes[ui.theme].background.normal,
|
||||||
@@ -80,17 +81,19 @@ function applyTheme() {
|
|||||||
'@link_hover': themes[ui.theme].link.hover
|
'@link_hover': themes[ui.theme].link.hover
|
||||||
};
|
};
|
||||||
|
|
||||||
if(ui["header-font"] || ui["text-font"]) {
|
|
||||||
var fontURL = "http://fonts.googleapis.com/" +
|
var fontURL = "http://fonts.googleapis.com/" +
|
||||||
"css?family=PT+Serif:700|Noticia+Text:700%s" +
|
"css?family=PT+Serif:700|Noticia+Text:700%s" +
|
||||||
"&subset=latin,cyrillic";
|
"&subset=latin,cyrillic",
|
||||||
|
injection = "";
|
||||||
|
|
||||||
var injection = ["header-font", "text-font"].reduce(function(acc, font){
|
if(ui["header-font"] || ui["text-font"]) {
|
||||||
|
injection = ["header-font", "text-font"].reduce(function(acc, font){
|
||||||
if(ui[font]) {
|
if(ui[font]) {
|
||||||
vars['@' + font.replace(/-/, "_")] = ui[font].replace(/\+/g," ");
|
vars['@' + font.replace(/-/, "_")] = ui[font].replace(/\+/g," ");
|
||||||
return acc + "|" + ui[font];
|
return acc + "|" + ui[font];
|
||||||
} else return acc;
|
} else return acc;
|
||||||
}, "");
|
}, "");
|
||||||
|
}
|
||||||
|
|
||||||
fontURL = fontURL.replace(/%s/, injection);
|
fontURL = fontURL.replace(/%s/, injection);
|
||||||
var fileref = document.createElement("link")
|
var fileref = document.createElement("link")
|
||||||
@@ -98,7 +101,6 @@ function applyTheme() {
|
|||||||
fileref.setAttribute("type", "text/css")
|
fileref.setAttribute("type", "text/css")
|
||||||
fileref.setAttribute("href", fontURL)
|
fileref.setAttribute("href", fontURL)
|
||||||
document.getElementsByTagName("head")[0].appendChild(fileref)
|
document.getElementsByTagName("head")[0].appendChild(fileref)
|
||||||
}
|
|
||||||
less.modifyVars(vars);
|
less.modifyVars(vars);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user