Support user defined themes
code is almost there now as select a CSS file based on theme but need config to rotate amongst all options. Current it's all hard coded in actions.js and config.js
Leave a comment
This code from google selector-shell might be useful
/**
*/
SelectorShell.prototype.addCssText_ = function(cssText) {
var cssNode = document.createElement('style');
cssNode.type = 'text/css';
cssNode.id = 'cssh-sheet-' + document.styleSheets.length;
var headEl = document.getElementsByTagName('head')[0];
headEl.appendChild(cssNode);
// IE
if (cssNode.styleSheet) {
cssNode.styleSheet.cssText = cssText;
// W3C
} else {
var cssText = document.createTextNode(cssText);
cssNode.appendChild(cssText);
}
return cssNode;
};
/**
- Adds CSS text to the DOM
- @param {string} cssText The css text to add.
- @return {Element} cssNode the added css DOM node.
- @private
*/
SelectorShell.prototype.addCssText_ = function(cssText) {
var cssNode = document.createElement('style');
cssNode.type = 'text/css';
cssNode.id = 'cssh-sheet-' + document.styleSheets.length;
var headEl = document.getElementsByTagName('head')[0];
headEl.appendChild(cssNode);
// IE
if (cssNode.styleSheet) {
cssNode.styleSheet.cssText = cssText;
// W3C
} else {
var cssText = document.createTextNode(cssText);
cssNode.appendChild(cssText);
}
return cssNode;
};