catalogcss rename
author:
contributor:
published:
updated:
source uri:
Topic /common/topic
Also known as:
Subjects:
Subject of:
Summary
var domain = acre.environ.params.group;
// If host is specified, get its freebase.site and apply...
// If host is specified, get its freebase.site and apply...
Content
var domain = acre.environ.params.group;
// If host is specified, get its freebase.site and apply its theme
var siteq = acre.mqlread({
"type" : "/user/jdouglas/freebase/site",
"name" : null,
"id" : domain,
"theme" : {
"id" : null,
"masthead_image":{
"id":null,
"optional":true
}
}
});
var theme_id = siteq.theme.id;
var DEFAULT_THEME_ID = "/guid/9202a8c04000641f8000000006ea9f10";
var TRANS_RAW = "http://www.freebase.com/api/trans/raw";
var themes = acre.mqlread([{
"id" : null,
"type" : "/user/jdouglas/config/theme",
"id|=" : [theme_id, DEFAULT_THEME_ID],
"background_image":{
"id":null,
"optional":true
},
"masthead_image":{
"id":null,
"optional":true
},
"background_color" : null,
"font" : null,
"link_color" : null,
"module_background_color" : null,
"module_border_color" : null,
"module_text_color" : null,
"module_link_color" : null,
"module_visited_link_color" : null,
"text_color" : null,
"visited_link_color" : null
}]);
// Figure out which is the default theme and which is the site theme
var d = (themes[0].id == DEFAULT_THEME_ID) ? themes[0] : themes[1];
var t = (themes[0].id == theme_id) ? themes[0] : themes[1];
// Overwrite missing theme values with those from the default theme
for (i in t) {
if (t[i] == null)
t[i] = d[i];
}
acre.start_response(200, {
'content-type': 'text/css; charset="UTF-8"'
});
// convenience function
function insertRule(rule) { acre.write(rule + '\n'); }
var bgimage = '';
if (t.background_image)
bgimage = " url(" + TRANS_RAW + t.background_image.id + ") repeat-x top";
insertRule("body {background: " + t.background_color + bgimage + ";}");
insertRule("body {font-family: " + t.font + "}");
insertRule("body {color: " + t.text_color + "}");
insertRule("a {color: " + t.link_color + "}");
insertRule("a:visited {color: " + t.visited_link_color + "}");
insertRule("hr {background: " + t.module_border_color + "}");
insertRule(".shaded {border-color: " + t.module_border_color + "}");
insertRule(".shaded td {border-color: " + t.module_border_color + "}");
insertRule(".shaded {background: " + t.module_background_color + "}");
insertRule(".shaded {color: " + t.module_text_color + "}");
insertRule(".shaded h4 {color: " + t.module_border_color + "}");
insertRule(".shaded a {color: " + t.module_link_color + "}");
insertRule(".shaded a:visited {color: " + t.module_visited_link_color + "}");
// If host is specified, get its freebase.site and apply its theme
var siteq = acre.mqlread({
"type" : "/user/jdouglas/freebase/site",
"name" : null,
"id" : domain,
"theme" : {
"id" : null,
"masthead_image":{
"id":null,
"optional":true
}
}
});
var theme_id = siteq.theme.id;
var DEFAULT_THEME_ID = "/guid/9202a8c04000641f8000000006ea9f10";
var TRANS_RAW = "http://www.freebase.com/api/trans/raw";
var themes = acre.mqlread([{
"id" : null,
"type" : "/user/jdouglas/config/theme",
"id|=" : [theme_id, DEFAULT_THEME_ID],
"background_image":{
"id":null,
"optional":true
},
"masthead_image":{
"id":null,
"optional":true
},
"background_color" : null,
"font" : null,
"link_color" : null,
"module_background_color" : null,
"module_border_color" : null,
"module_text_color" : null,
"module_link_color" : null,
"module_visited_link_color" : null,
"text_color" : null,
"visited_link_color" : null
}]);
// Figure out which is the default theme and which is the site theme
var d = (themes[0].id == DEFAULT_THEME_ID) ? themes[0] : themes[1];
var t = (themes[0].id == theme_id) ? themes[0] : themes[1];
// Overwrite missing theme values with those from the default theme
for (i in t) {
if (t[i] == null)
t[i] = d[i];
}
acre.start_response(200, {
'content-type': 'text/css; charset="UTF-8"'
});
// convenience function
function insertRule(rule) { acre.write(rule + '\n'); }
var bgimage = '';
if (t.background_image)
bgimage = " url(" + TRANS_RAW + t.background_image.id + ") repeat-x top";
insertRule("body {background: " + t.background_color + bgimage + ";}");
insertRule("body {font-family: " + t.font + "}");
insertRule("body {color: " + t.text_color + "}");
insertRule("a {color: " + t.link_color + "}");
insertRule("a:visited {color: " + t.visited_link_color + "}");
insertRule("hr {background: " + t.module_border_color + "}");
insertRule(".shaded {border-color: " + t.module_border_color + "}");
insertRule(".shaded td {border-color: " + t.module_border_color + "}");
insertRule(".shaded {background: " + t.module_background_color + "}");
insertRule(".shaded {color: " + t.module_text_color + "}");
insertRule(".shaded h4 {color: " + t.module_border_color + "}");
insertRule(".shaded a {color: " + t.module_link_color + "}");
insertRule(".shaded a:visited {color: " + t.module_visited_link_color + "}");
Created by:
jdouglas
Mar 11, 2008
Last edited by:
Constant Gardener Process
Aug 18, 2009
Recent Discussions about catalogcss
There is no discussion about this document.
Start the Discussion »