{* stylesheet-switching, stolen wholesale from Zeldman with thanks *} {php} $this->config_overwrite = false; {/php} {assign var="baseUrl" value=$url->getBaseUrl()} {assign var="rootPath" value=$smarty.const.SMARTY_DIR|replace:"\\":"/"|replace:"/class/template/smarty/":""} {assign var="stylstFilepath" value=$url->getTemplateFile("styles.conf")|replace:"$baseUrl":"$rootPath"} {config_load file="file:$stylstFilepath"} function setActiveStyleSheet(title) {ldelim} var i, a, main; for (i=0; (a = document.getElementsByTagName("link")[i]); i++) {ldelim} if (a.getAttribute("rel") && a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {ldelim} a.disabled = true; if(a.getAttribute("title") == title) a.disabled = false; {rdelim} {rdelim} {rdelim} function getActiveStyleSheet() {ldelim} var i, a; for (i=0; (a = document.getElementsByTagName("link")[i]); i++) {ldelim} if (a.getAttribute("rel") && a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled ) return a.getAttribute("title"); {rdelim} return null; {rdelim} function getPreferredStyleSheet() {ldelim} var i, a; for (i=0; (a = document.getElementsByTagName("link")[i]); i++) {ldelim} if (a.getAttribute("rel") && a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("rel").indexOf("alt") == -1 && a.getAttribute("title") ) return a.getAttribute("title"); {rdelim} return null; {rdelim} function createCookie(name,value,days) {ldelim} if (days) {ldelim} var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); {rdelim} else expires = ""; document.cookie = name+"="+value+expires+"; path=/"; {rdelim} function readCookie(name) {ldelim} var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) {ldelim} var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); {rdelim} return null; {rdelim} window.onload = function(e) {ldelim} var cookie = readCookie("wordplog_style_{$blog->getId()}"); var title = cookie ? cookie : getPreferredStyleSheet(); setActiveStyleSheet(title); {rdelim} window.onunload = function(e) {ldelim} var title = getActiveStyleSheet(); createCookie("wordplog_style_{$blog->getId()}", title, 365); {rdelim} var cookie = readCookie("wordplog_style_{$blog->getId()}"); var title = cookie ? cookie : getPreferredStyleSheet(); setActiveStyleSheet(title); function setselect() {ldelim} document.write('
'); {rdelim}