cssStylesheetManager.js # Javascript library that manage alternate CSS stylesheet.
28/01/2009
- /**
- * Javascript library that manage alternate CSS stylesheet.
- * FileName: cssstylesheetmanager.js
- * Date: 15/11/2006
- * Author: Gabriel DROMARD
- * Require: Prototype.js
- */
- /**
- * Set current CSS Stylesheet.
- */
- Event.observe(window, 'load', setCurrentCSSStylesheet, false);
- /**
- * Set active CSS Stylesheet.
- * @param title The CSS stylesheet to activate
- */
- function setActiveCSSStylesheet(title) {
- var i, a, main;
- for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
- if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
- a.disabled = true;
- if(a.getAttribute("title") == title) a.disabled = false;
- }
- }
- setCookie('PingusActiveStyleSheet', title);
- }
- /**
- * Active an already set CSS Stylesheet.
- * (This function use cookies)
- */
- function setCurrentCSSStylesheet() {
- var current = getCookie('PingusActiveStyleSheet');
- if(current != undefined && current != null)
- setActiveCSSStylesheet(current);
- }