From 10683070288b879057b70bea56fca96373cb506c Mon Sep 17 00:00:00 2001 From: bnewbold Date: Wed, 8 Aug 2007 02:15:11 -0400 Subject: fixed up styleswitching, may still have to tweak file change (aka 304 http status codes) for alt css files --- static/style/fixed-nuts-sans.css | 36 ++++++++ static/style/fixed-nuts-serif.css | 35 ++++++++ static/style/fixed-sane-sans.css | 48 +++++++++++ static/style/fixed-sane-serif.css | 19 +++++ static/style/flexy-nuts-sans.css | 38 +++++++++ static/style/flexy-nuts-serif.css | 36 ++++++++ static/style/flexy-sane-sans.css | 35 ++++++++ static/style/flexy-sane-serif.css | 34 ++++++++ static/style/font-sans.css | 1 - static/style/font-serif.css | 1 - static/style/fractal.gif | Bin 0 -> 22418 bytes static/style/site-nuts.css | 16 ---- static/style/site-sane.css | 14 ---- static/style/styleswitcher.js | 172 ++++++++++---------------------------- static/style/width-flexy.css | 20 ----- static/style/width-full.css | 19 ----- 16 files changed, 327 insertions(+), 197 deletions(-) create mode 100644 static/style/fixed-nuts-sans.css create mode 100644 static/style/fixed-nuts-serif.css create mode 100644 static/style/fixed-sane-sans.css create mode 100644 static/style/fixed-sane-serif.css create mode 100644 static/style/flexy-nuts-sans.css create mode 100644 static/style/flexy-nuts-serif.css create mode 100644 static/style/flexy-sane-sans.css create mode 100644 static/style/flexy-sane-serif.css delete mode 100644 static/style/font-sans.css delete mode 100644 static/style/font-serif.css create mode 100644 static/style/fractal.gif delete mode 100644 static/style/site-nuts.css delete mode 100644 static/style/site-sane.css delete mode 100644 static/style/width-flexy.css delete mode 100644 static/style/width-full.css (limited to 'static') diff --git a/static/style/fixed-nuts-sans.css b/static/style/fixed-nuts-sans.css new file mode 100644 index 0000000..3ee7c8d --- /dev/null +++ b/static/style/fixed-nuts-sans.css @@ -0,0 +1,36 @@ +.content { + margin-left: 4%; + width: 680px; + margin-top: 0px; + margin-right: 0px; + margin-bottom: 0px; + padding-left: 5px; + padding-right: 5px; + padding-bottom: 5px; } +.content_footer { + margin-left: 4%; + width: 680px; + margin-bottom: 5px; + margin-right: 0px; + margin-top: 0px; + border-top: 2px solid #000000; + padding-top: 6px; + padding-left: 5px; + padding-right: 5px; } +body { + background-image: url("/static/style/fractal.gif"); + background-color: green; } + +a { color: magenta; } +a:visited { color: orange; } +a:hover { color: yellow; } + +.content { background-color: purple; } + +#top_bar { background-color: #FF00FF; } + +#top_bar_content { + background-color: #FF00FF; + border-right: 200px solid #FF00FF; +} +body { font-family: sans; } diff --git a/static/style/fixed-nuts-serif.css b/static/style/fixed-nuts-serif.css new file mode 100644 index 0000000..11142d7 --- /dev/null +++ b/static/style/fixed-nuts-serif.css @@ -0,0 +1,35 @@ +.content { + margin-left: 4%; + width: 680px; + margin-top: 0px; + margin-right: 0px; + margin-bottom: 0px; + padding-left: 5px; + padding-right: 5px; + padding-bottom: 5px; } +.content_footer { + margin-left: 4%; + width: 680px; + margin-bottom: 5px; + margin-right: 0px; + margin-top: 0px; + border-top: 2px solid #000000; + padding-top: 6px; + padding-left: 5px; + padding-right: 5px; } +body { + background-image: url("/static/style/fractal.gif"); + background-color: green; } + +a { color: magenta; } +a:visited { color: orange; } +a:hover { color: yellow; } + +.content { background-color: purple; } + +#top_bar { background-color: #FF00FF; } + +#top_bar_content { + background-color: #FF00FF; + border-right: 200px solid #FF00FF; +} diff --git a/static/style/fixed-sane-sans.css b/static/style/fixed-sane-sans.css new file mode 100644 index 0000000..52d7a65 --- /dev/null +++ b/static/style/fixed-sane-sans.css @@ -0,0 +1,48 @@ +.content { + margin-left: 4%; + width: 680px; + margin-top: 0px; + margin-right: 0px; + margin-bottom: 0px; + padding-left: 5px; + padding-right: 5px; + padding-bottom: 5px; } +.content_footer { + margin-left: 4%; + width: 680px; + margin-bottom: 5px; + margin-right: 0px; + margin-top: 0px; + border-top: 2px solid #000000; + padding-top: 6px; + padding-left: 5px; + padding-right: 5px; } +body { + background-image: none; + background-color: #E3E3E3; } + +a { color: blue; } +a:visited { color: blue; } +a:hover { color: blue; } + +.content { background-color: #FFFFFF; } + +#top_bar { background-color: #993333; } +#top_bar_content { + background-color: #993333; + border-right: 200px solid #993333; } +body { + background-image: none; + background-color: #E3E3E3; } + +a { color: blue; } +a:visited { color: blue; } +a:hover { color: blue; } + +.content { background-color: #FFFFFF; } + +#top_bar { background-color: #993333; } +#top_bar_content { + background-color: #993333; + border-right: 200px solid #993333; } +body { font-family: sans; } diff --git a/static/style/fixed-sane-serif.css b/static/style/fixed-sane-serif.css new file mode 100644 index 0000000..757afff --- /dev/null +++ b/static/style/fixed-sane-serif.css @@ -0,0 +1,19 @@ +.content { + margin-left: 4%; + width: 680px; + margin-top: 0px; + margin-right: 0px; + margin-bottom: 0px; + padding-left: 5px; + padding-right: 5px; + padding-bottom: 5px; } +.content_footer { + margin-left: 4%; + width: 680px; + margin-bottom: 5px; + margin-right: 0px; + margin-top: 0px; + border-top: 2px solid #000000; + padding-top: 6px; + padding-left: 5px; + padding-right: 5px; } diff --git a/static/style/flexy-nuts-sans.css b/static/style/flexy-nuts-sans.css new file mode 100644 index 0000000..fbf189a --- /dev/null +++ b/static/style/flexy-nuts-sans.css @@ -0,0 +1,38 @@ +.content { + margin-left: 0px; + width: 75%; + margin-top: 0px; + margin-bottom: 0px; + margin-right: 250px; + padding-left: 15px; + padding-right: 5px; + padding-bottom: 5px; } +.content_footer { + margin-left: 0px; + width: 75%; + margin-bottom: 5px; + margin-right: 250px; + margin-top: 0px; + border-top: 2px solid #000000; + padding-top: 6px; + padding-left: 15px; + padding-right: 5px; } + +body { + background-image: url("/static/style/fractal.gif"); + background-color: green; } + +a { color: magenta; } +a:visited { color: orange; } +a:hover { color: yellow; } + +.content { background-color: purple; } + +#top_bar { background-color: #FF00FF; } + +#top_bar_content { + background-color: #FF00FF; + border-right: 200px solid #FF00FF; +} +body { font-family: sans; } +body { font-family: sans; } diff --git a/static/style/flexy-nuts-serif.css b/static/style/flexy-nuts-serif.css new file mode 100644 index 0000000..2dbe9b0 --- /dev/null +++ b/static/style/flexy-nuts-serif.css @@ -0,0 +1,36 @@ +.content { + margin-left: 0px; + width: 75%; + margin-top: 0px; + margin-bottom: 0px; + margin-right: 250px; + padding-left: 15px; + padding-right: 5px; + padding-bottom: 5px; } +.content_footer { + margin-left: 0px; + width: 75%; + margin-bottom: 5px; + margin-right: 250px; + margin-top: 0px; + border-top: 2px solid #000000; + padding-top: 6px; + padding-left: 15px; + padding-right: 5px; } + +body { + background-image: url("/static/style/fractal.gif"); + background-color: green; } + +a { color: magenta; } +a:visited { color: orange; } +a:hover { color: yellow; } + +.content { background-color: purple; } + +#top_bar { background-color: #FF00FF; } + +#top_bar_content { + background-color: #FF00FF; + border-right: 200px solid #FF00FF; +} diff --git a/static/style/flexy-sane-sans.css b/static/style/flexy-sane-sans.css new file mode 100644 index 0000000..10d188e --- /dev/null +++ b/static/style/flexy-sane-sans.css @@ -0,0 +1,35 @@ +.content { + margin-left: 0px; + width: 75%; + margin-top: 0px; + margin-bottom: 0px; + margin-right: 250px; + padding-left: 15px; + padding-right: 5px; + padding-bottom: 5px; } +.content_footer { + margin-left: 0px; + width: 75%; + margin-bottom: 5px; + margin-right: 250px; + margin-top: 0px; + border-top: 2px solid #000000; + padding-top: 6px; + padding-left: 15px; + padding-right: 5px; } + +body { + background-image: none; + background-color: #E3E3E3; } + +a { color: blue; } +a:visited { color: blue; } +a:hover { color: blue; } + +.content { background-color: #FFFFFF; } + +#top_bar { background-color: #993333; } +#top_bar_content { + background-color: #993333; + border-right: 200px solid #993333; } +body { font-family: sans; } diff --git a/static/style/flexy-sane-serif.css b/static/style/flexy-sane-serif.css new file mode 100644 index 0000000..eec5837 --- /dev/null +++ b/static/style/flexy-sane-serif.css @@ -0,0 +1,34 @@ +.content { + margin-left: 0px; + width: 75%; + margin-top: 0px; + margin-bottom: 0px; + margin-right: 250px; + padding-left: 15px; + padding-right: 5px; + padding-bottom: 5px; } +.content_footer { + margin-left: 0px; + width: 75%; + margin-bottom: 5px; + margin-right: 250px; + margin-top: 0px; + border-top: 2px solid #000000; + padding-top: 6px; + padding-left: 15px; + padding-right: 5px; } + +body { + background-image: none; + background-color: #E3E3E3; } + +a { color: blue; } +a:visited { color: blue; } +a:hover { color: blue; } + +.content { background-color: #FFFFFF; } + +#top_bar { background-color: #993333; } +#top_bar_content { + background-color: #993333; + border-right: 200px solid #993333; } diff --git a/static/style/font-sans.css b/static/style/font-sans.css deleted file mode 100644 index 171e507..0000000 --- a/static/style/font-sans.css +++ /dev/null @@ -1 +0,0 @@ -body { font-family: sans; } diff --git a/static/style/font-serif.css b/static/style/font-serif.css deleted file mode 100644 index dd3e369..0000000 --- a/static/style/font-serif.css +++ /dev/null @@ -1 +0,0 @@ -body { font-family: serif; } diff --git a/static/style/fractal.gif b/static/style/fractal.gif new file mode 100644 index 0000000..b008702 Binary files /dev/null and b/static/style/fractal.gif differ diff --git a/static/style/site-nuts.css b/static/style/site-nuts.css deleted file mode 100644 index 330a234..0000000 --- a/static/style/site-nuts.css +++ /dev/null @@ -1,16 +0,0 @@ -body { - background-image: url("/static/style/fractal.gif"); - background-color: green; } - -a { color: magenta; } -a:visited { color: orange; } -a:hover { color: yellow; } - -.content { background-color: purple; } - -#top_bar { background-color: #FF00FF; } - -#top_bar_content { - background-color: #FF00FF; - border-right: 200px solid #FF00FF; -} diff --git a/static/style/site-sane.css b/static/style/site-sane.css deleted file mode 100644 index 053b06d..0000000 --- a/static/style/site-sane.css +++ /dev/null @@ -1,14 +0,0 @@ -body { - background-image: none; - background-color: #E3E3E3; } - -a { color: blue; } -a:visited { color: blue; } -a:hover { color: blue; } - -.content { background-color: #FFFFFF; } - -#top_bar { background-color: #993333; } -#top_bar_content { - background-color: #993333; - border-right: 200px solid #993333; } diff --git a/static/style/styleswitcher.js b/static/style/styleswitcher.js index 981a6ca..ddc2846 100644 --- a/static/style/styleswitcher.js +++ b/static/style/styleswitcher.js @@ -1,85 +1,36 @@ -function setActiveSiteStyleSheet(title) { - var i, a, main; - for(i=0; (a = document.getElementsByTagName("link")[i]); i++) { - if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) { - if(a.getAttribute("title").indexOf("site") != 1) a.disabled = true; - if(a.getAttribute("title") == title) a.disabled = false; - } - } -} -function setActiveWidthStyleSheet(title) { - var i, a, main; - for(i=0; (a = document.getElementsByTagName("link")[i]); i++) { - if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) { - if(a.getAttribute("title").indexOf("width") != 1) a.disabled = true; - if(a.getAttribute("title") == title) a.disabled = false; - } - } -} -function setActiveFontStyleSheet(title) { - var i, a, main; - for(i=0; (a = document.getElementsByTagName("link")[i]); i++) { - if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) { - if(a.getAttribute("title").indexOf("font") != 1) a.disabled = true; - if(a.getAttribute("title") == title) a.disabled = false; - } - } -} +var fontStyle = 'serif'; +var siteStyle = 'sane'; +var widthStyle = 'fixed'; -function getActiveSiteStyleSheet() { - var i, a; - for(i=0; (a = document.getElementsByTagName("link")[i]); i++) { - if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled && a.getAttribute("title").indexOf("site") != -1) return a.getAttribute("title"); - } - return null; -} -function getActiveFontStyleSheet() { +function setStyleSheet() { var i, a; + var styleName = '' + widthStyle + '-' + siteStyle + '-' + fontStyle for(i=0; (a = document.getElementsByTagName("link")[i]); i++) { - if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled && a.getAttribute("title").indexOf("font") != -1) return a.getAttribute("title"); - } - return null; -} -function getActiveWidthStyleSheet() { - var i, a; - for(i=0; (a = document.getElementsByTagName("link")[i]); i++) { - if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled && a.getAttribute("title").indexOf("width") != -1) return a.getAttribute("title"); + if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) + { + if(a.getAttribute("title").indexOf(styleName) != -1) a.disabled = false; + else a.disabled = true; + } } - return null; + createCookie("style", styleName, 100); } -function getPreferredSiteStyleSheet() { - var i, a; - for(i=0; (a = document.getElementsByTagName("link")[i]); i++) { - if(a.getAttribute("rel").indexOf("style") != -1 - && a.getAttribute("rel").indexOf("alt") == -1 - && a.getAttribute("title") - && a.getAttribute("title").indexOf("site") != -1 - ) return a.getAttribute("title"); - } - return null; -} -function getPreferredFontStyleSheet() { - var i, a; - for(i=0; (a = document.getElementsByTagName("link")[i]); i++) { - if(a.getAttribute("rel").indexOf("style") != -1 - && a.getAttribute("rel").indexOf("alt") == -1 - && a.getAttribute("title") - && a.getAttribute("title").indexOf("font") != -1 - ) return a.getAttribute("title"); - } - return null; -} -function getPreferredWidthStyleSheet() { - var i, a; - for(i=0; (a = document.getElementsByTagName("link")[i]); i++) { - if(a.getAttribute("rel").indexOf("style") != -1 - && a.getAttribute("rel").indexOf("alt") == -1 - && a.getAttribute("title") - && a.getAttribute("title").indexOf("width") != -1 - ) return a.getAttribute("title"); - } - return null; +function parseStyleCookie(cookie) { + names = cookie.split('-') + widthStyle = names[0] + if(widthStyle == 'flexy') { + document.getElementById('style_width').innerHTML = 'flexy' + } + siteStyle = names[1] + if(siteStyle == 'nuts') { + document.getElementById('style_site').innerHTML = 'nuts' + } + fontStyle = names[2] + if(fontStyle == 'sans') { + document.getElementById('style_font_first').innerHTML = 'A' + document.getElementById('style_font_second').innerHTML = 'a' + } + setStyleSheet() } function createCookie(name,value,days) { @@ -104,81 +55,50 @@ function readCookie(name) { } window.onload = function(e) { - var cookie = readCookie("sitestyle"); - var title = cookie ? cookie : getPreferredSiteStyleSheet(); - setActiveSiteStyleSheet(title); - if(title.indexOf('nuts') != -1) { - document.getElementById('style_site').innerHTML = 'nuts' - } - var cookie = readCookie("fontstyle"); - var title = cookie ? cookie : getPreferredFontStyleSheet(); - setActiveFontStyleSheet(title); - if(title.indexOf('sans') != -1) { - document.getElementById('style_font_first').innerHTML = 'A' - document.getElementById('style_font_second').innerHTML = 'a' - } - var cookie = readCookie("widthstyle"); - var title = cookie ? cookie : getPreferredWidthStyleSheet(); - setActiveWidthStyleSheet(title); - if(title.indexOf('flexy') != -1) { - document.getElementById('style_width').innerHTML = 'flexy' - } -} - -window.onunload = function(e) { - if (stuffset == true) { - var title = getActiveSiteStyleSheet(); - createCookie("sitestyle", title, 365); - title = getActiveFontStyleSheet(); - createCookie("fontstyle", title, 365); - title = getActiveWidthStyleSheet(); - createCookie("widthstyle", title, 365); - } + var cookie = readCookie("style"); + if(cookie) parseStyleCookie(cookie); } -var stuffset = false -var cookie = readCookie("sitestyle"); -var title = cookie ? cookie : getPreferredSiteStyleSheet(); -setActiveSiteStyleSheet(title); -var cookie = readCookie("fontstyle"); -var title = cookie ? cookie : getPreferredFontStyleSheet(); -setActiveFontStyleSheet(title); -var cookie = readCookie("widthstyle"); -var title = cookie ? cookie : getPreferredFontStyleSheet(); -setActiveFontStyleSheet(title); +/* var cookie = readCookie("style"); */ +/* parseStyleCookie(cookie) */ function swapstyle(thing) { stuffset = true; switch(thing){ case 'font': - if(document.getElementById('style_font_first').innerHTML == 'a'){ + if(document.getElementById('style_font_first').innerHTML.indexOf('a') != -1){ document.getElementById('style_font_first').innerHTML = 'A' document.getElementById('style_font_second').innerHTML = 'a' - setActiveFontStyleSheet('font-sans') + fontStyle = 'sans' + setStyleSheet() } else { document.getElementById('style_font_first').innerHTML = 'a' document.getElementById('style_font_second').innerHTML = 'A' - setActiveFontStyleSheet('font-serif') + fontStyle = 'serif' + setStyleSheet() } break; case 'site': - if(document.getElementById('style_site').innerHTML == 'sane'){ + if(document.getElementById('style_site').innerHTML.indexOf('sane') != -1){ document.getElementById('style_site').innerHTML = 'nuts' - setActiveSiteStyleSheet('site-nuts') + siteStyle = 'nuts' + setStyleSheet() } else { document.getElementById('style_site').innerHTML = 'sane' - setActiveSiteStyleSheet('site-sane') + siteStyle = 'sane' + setStyleSheet() } break; case 'width': - if(document.getElementById('style_width').innerHTML == 'fixed'){ + if(document.getElementById('style_width').innerHTML.indexOf('fixed') != -1){ document.getElementById('style_width').innerHTML = 'flexy' - setActiveWidthStyleSheet('width-flexy') + widthStyle = 'flexy' + setStyleSheet() } else { document.getElementById('style_width').innerHTML = 'fixed' - setActiveWidthStyleSheet('width-fixed') + widthStyle = 'fixed' + setStyleSheet() } break; - } } diff --git a/static/style/width-flexy.css b/static/style/width-flexy.css deleted file mode 100644 index 84d1a59..0000000 --- a/static/style/width-flexy.css +++ /dev/null @@ -1,20 +0,0 @@ -.content { - margin-left: none; - width: 75%; - margin-top: 0px; - margin-bottom: 0px; - margin-right: 250px; - padding-left: 15px; - padding-right: 5px; - padding-bottom: 5px; } -.content_footer { - margin-left: none; - width: 75%; - margin-bottom: 5px; - margin-right: 250px; - margin-top: 0px; - border-top: 2px solid #000000; - padding-top: 6px; - padding-left: 15px; - padding-right: 5px; } - diff --git a/static/style/width-full.css b/static/style/width-full.css deleted file mode 100644 index d6f11cb..0000000 --- a/static/style/width-full.css +++ /dev/null @@ -1,19 +0,0 @@ -.content { - margin-left: 4%; - width: 680px; - margin-top: 0px; - margin-right: none; - margin-bottom: 0px; - padding-left: 5px; - padding-right: 5px; - padding-bottom: 5px; } -.content_footer { - margin-left: 4%; - width: 680px; - margin-bottom: 5px; - margin-right: none; - margin-top: 0px; - border-top: 2px solid #000000; - padding-top: 6px; - padding-left: 5px; - padding-right: 5px; } -- cgit v1.2.3