Last active
August 29, 2015 14:09
-
-
Save roachhd/cd2be60aa1d22bd34aaa to your computer and use it in GitHub Desktop.
Persistent stylesheet switcher
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" | |
"http://www.w3.org/TR/html4/strict.dtd"> | |
<html> | |
<head> | |
<title>another page - read cookie</title> | |
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> | |
<link id="mystyle" rel="stylesheet" href="style1.css" type="text/css"> | |
<script type="text/javascript"> | |
function readCookie() { | |
if(document.cookie) { | |
which=document.cookie.split('style=')[1]; | |
document.getElementById('mystyle').href=which; | |
} | |
} | |
window.onload=readCookie; | |
</script> | |
</head> | |
<body> | |
<h1 id="test">This is another page</h1> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" | |
"http://www.w3.org/TR/html4/strict.dtd"> | |
<html> | |
<head> | |
<title>style changer button</title> | |
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> | |
<link id="mystyle" rel="stylesheet" type="text/css" href="style1.css"> | |
<script type="text/javascript"> | |
var obj0,obj1,styleid; | |
window.onload=function() { | |
obj0=document.getElementById('mybutton'); | |
obj1=document.getElementById('mystyle'); | |
readCookie(); | |
obj0.onclick=function() { | |
stylech(); | |
} | |
} | |
function stylech() { | |
if(obj0.value=='font-size:10px') { | |
obj0.value='font-size:36px'; | |
styleid='style1.css'; | |
obj1.href=styleid; | |
} | |
else { | |
obj0.value='font-size:10px'; | |
styleid='style2.css'; | |
obj1.href=styleid; | |
} | |
setCookie(); | |
} | |
function setCookie() { | |
exp=new Date(); | |
plusMonth=exp.getTime()+(31*24*60*60*1000); | |
exp.setTime(plusMonth); | |
document.cookie='style='+styleid+';expires='+exp.toGMTString(); | |
} | |
function readCookie() { | |
if(document.cookie) { | |
which=document.cookie.split('style=')[1]; | |
obj1.href=which; | |
if(which=='style1.css'){ | |
obj0.value='font-size:36px'; | |
} | |
else{ | |
obj0.value='font-size:10px'; | |
} | |
} | |
else { | |
stylech(); | |
} | |
} | |
</script> | |
</head> | |
<body> | |
<div><input id="mybutton" type="button" value="font-size:10px"></div> | |
<ul> | |
<li><a href="anotherPage.html">another page</a></li> | |
</ul> | |
<h1 id="test">this is a font size test</h1> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html,:root{font-family:"leitura-news", Georgia, serif;font-size:112.5%;line-height:1.55556;-ms-text-size-adjust:none;-webkit-text-size-adjust:none;text-size-adjust:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-webkit-font-feature-settings:"liga" 1, "onum" 1, "kern" 1;-moz-font-feature-settings:"liga" 1, "onum" 1, "kern" 1;font-feature-settings:"liga" 1, "onum" 1, "kern" 1;-webkit-font-kerning:normal;-moz-font-kerning:normal;font-kerning:normal;background-color:#fff;color:#3d464d}@media (max-width: 860px){html,:root{font-size:101.25%}}@media (max-width: 500px){html,:root{font-size:90%}}html.night-mode,:root.night-mode{background-color:#1d1f21;color:#999a9b}*{margin:0;padding:0;box-sizing:border-box;position:relative}img{max-width:100%}ul,ol{padding-left:1.4em;overflow:hidden}header,main,footer,p,table,figure,blockquote,pre,ul,ol,h1,.alpha,h2,.beta{margin-bottom:1.55556rem}picture{display:block}li ol,li ul{margin-bottom:0}.o--b{display:block}.o--p{margin-bottom:1.55556rem}.o--mz{margin-bottom:0}.o--z{z-index:100}.unl{padding-left:0;list-style:none}.f--l{float:left}.f--r{float:right}.grid__col--1-of-6{width:16.66667%}.grid__col--push-1-of-6{margin-left:16.66667%}.grid__col--pull-1-of-6{margin-left:-16.66667%}.grid__col--5-of-6{width:83.33333%}.grid__col--push-5-of-6{margin-left:83.33333%}.grid__col--pull-5-of-6{margin-left:-83.33333%}.grid{list-style:none;margin-left:-1.55556rem}.grid .grid__col--6-of-6{width:100%}.grid .grid__col--3-of-6{width:50%}.grid .grid__col--2-of-6{width:33.33333%}.grid .grid__col--4-of-6{width:66.66667%}.grid .grid__col--push-6-of-6{margin-left:100%}.grid .grid__col--push-3-of-6{margin-left:50%}.grid .grid__col--push-2-of-6{margin-left:33.33333%}.grid .grid__col--push-4-of-6{margin-left:66.66667%}.grid .grid__col--pull-6-of-6{margin-left:-100%}.grid .grid__col--pull-3-of-6{margin-left:-50%}.grid .grid__col--pull-2-of-6{margin-left:-33.33333%}.grid .grid__col--pull-4-of-6{margin-left:-66.66667%}.grid .grid__col{box-sizing:border-box;display:inline-block;margin-right:-.25em;min-height:1px;padding-left:1.55556rem;vertical-align:top}@media screen and (max-width: 600px){.grid .grid__col{display:block;margin-left:0;margin-right:0;padding-left:0;width:auto}}.grid .grid__col--centered{display:block;margin-left:auto;margin-right:auto}@media screen and (max-width: 600px){.grid{margin-left:0;width:auto}}.grid .grid__col--d-first{float:left}.grid .grid__col--d-last{float:right}.grid.grid--no-gutter{margin-left:0;width:100%}.grid.grid--no-gutter *{padding-left:0}.grid.grid--no-gutter .grid__col--span-all{margin-left:0;width:100%}.grid .grid__col--ab{vertical-align:bottom}.grid .grid__col--am{vertical-align:middle}.wrap{max-width:50rem;margin:0 auto}body{padding:1.55556rem}.island{padding:1.55556rem}.island--v{padding-top:1.55556rem;padding-bottom:1.55556rem}.isle,.highlight pre{padding:0.77778rem}.isle--v,.footer__copyright{padding-top:0.77778rem;padding-bottom:0.77778rem}.spit,.js--toggle-lights{padding:0.38889rem}.spit--v,.site__nav a{padding-top:0.38889rem;padding-bottom:0.38889rem}.nav,.nav ul,.nav ol{list-style:none;padding-left:0}.nav li,.nav a,.nav ul li,.nav ul a,.nav ol li,.nav ol a{display:inline-block}h1,.alpha{font-weight:800;font-size:2.5rem;line-height:1}@media (max-width: 500px){h1,.alpha{font-size:2rem}}h2,.beta{font-family:"franklin-gothic-urw", Geneva, Verdana, san-serif;font-size:1.5rem;font-weight:700}*+h2,*+.beta{padding-top:1.55556rem}h3,.gamma{margin-bottom:0.77778rem;font-family:"franklin-gothic-urw", Geneva, Verdana, san-serif;font-size:1rem;font-weight:700}h4,.delta{margin-bottom:0.77778rem;font-family:"franklin-gothic-urw", Geneva, Verdana, san-serif;font-weight:400}small,.small,figcaption,.footnotes,.footer__copyright{font-size:.8em}.mega{font-size:2.5rem;line-height:1.55556;font-weight:200}.sans{font-family:"franklin-gothic-urw", Geneva, Verdana, san-serif}.meta,.footnotes{color:#727375}a,a:visited,.js--toggle-lights{color:inherit;cursor:pointer}a:hover,.js--toggle-lights:hover{color:#cb5c42}figcaption{font-family:"franklin-gothic-urw", Geneva, Verdana, san-serif;color:#727375}.night-mode figcaption{color:#77797a}hr,.footnotes:before{border:0;border-bottom:2px solid #d0d2d4;width:6rem;padding-top:1.55556rem;margin-top:-2px;margin-right:auto;margin-bottom:3.11111rem;margin-left:auto}.night-mode hr,.night-mode .footnotes:before{border-bottom-color:#393b3f}mark{background-color:transparent;color:#cb5c42}blockquote{padding:0 1.55556rem;color:#727375;border-left:2px solid #cb5c42}.promo{text-align:center}.caps{-webkit-font-feature-settings:"c2sc" 1, "smcp" 1;-moz-font-feature-settings:"c2sc" 1, "smcp" 1;font-feature-settings:"c2sc" 1, "smcp" 1}sup,sub{vertical-align:baseline;top:-0.4em}sub{top:0.4em}figure img,picture img{display:block;width:100%;margin-bottom:0.77778rem}@media (min-width: 600px){.alignleft{float:left;width:50%;margin-left:-25%;margin-right:1.55556rem}}@media (min-width: 600px){.alignright{float:right;width:50%;margin-right:-25%;margin-left:1.55556rem}}@media (min-width: 600px){.imgbleed{width:150%;margin-left:-25%}}html,:root{font-family:"leitura-news", Georgia, serif;font-size:112.5%;line-height:1.55556;-ms-text-size-adjust:none;-webkit-text-size-adjust:none;text-size-adjust:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-webkit-font-feature-settings:"liga" 1, "onum" 1, "kern" 1;-moz-font-feature-settings:"liga" 1, "onum" 1, "kern" 1;font-feature-settings:"liga" 1, "onum" 1, "kern" 1;-webkit-font-kerning:normal;-moz-font-kerning:normal;font-kerning:normal;background-color:#fff;color:#3d464d}@media (max-width: 860px){html,:root{font-size:101.25%}}@media (max-width: 500px){html,:root{font-size:90%}}html.night-mode,:root.night-mode{background-color:#1d1f21;color:#999a9b}code,pre{font:85%/1.647058824 "Source Code Pro", Menlo, Consolas, monospace}.highlight pre{max-width:100%;overflow:scroll;border-radius:.25em;background-color:#fafcfd;box-shadow:inset 0 0 0 1px rgba(0,0,0,0.1)}.highlight pre .hll{background-color:#ffc}.highlight pre .c{color:#aaa;font-style:italic}.highlight pre .err{color:#f00;background-color:#f0a0a0}.highlight pre .k{color:#00a}.highlight pre .cm{color:#aaa;font-style:italic}.highlight pre .cp{color:#4c8317}.highlight pre .c1{color:#aaa;font-style:italic}.highlight pre .cs{color:#00a;font-style:italic}.highlight pre .gd{color:#a00}.highlight pre .ge{font-style:italic}.highlight pre .gr{color:#a00}.highlight pre .gh{color:#000080;font-weight:bold}.highlight pre .gi{color:#0a0}.highlight pre .go{color:#888}.highlight pre .gp{color:#555}.highlight pre .gs{font-weight:bold}.highlight pre .gu{color:#800080;font-weight:bold}.highlight pre .gt{color:#a00}.highlight pre .kc{color:#00a}.highlight pre .kd{color:#00a}.highlight pre .kn{color:#00a}.highlight pre .kp{color:#00a}.highlight pre .kr{color:#00a}.highlight pre .kt{color:#0aa}.highlight pre .m{color:#099}.highlight pre .s{color:#a50}.highlight pre .na{color:#1e90ff}.highlight pre .nb{color:#0aa}.highlight pre .nc{color:#0a0;text-decoration:underline}.highlight pre .no{color:#a00}.highlight pre .nd{color:#888}.highlight pre .ni{color:#800000;font-weight:bold}.highlight pre .nf{color:#0a0}.highlight pre .nn{color:#0aa;text-decoration:underline}.highlight pre .nt{color:#1e90ff;font-weight:bold}.highlight pre .nv{color:#a00}.highlight pre .ow{color:#00a}.highlight pre .w{color:#bbb}.highlight pre .mf{color:#099}.highlight pre .mh{color:#099}.highlight pre .mi{color:#099}.highlight pre .mo{color:#099}.highlight pre .sb{color:#a50}.highlight pre .sc{color:#a50}.highlight pre .sd{color:#a50}.highlight pre .s2{color:#a50}.highlight pre .se{color:#a50}.highlight pre .sh{color:#a50}.highlight pre .si{color:#a50}.highlight pre .sx{color:#a50}.highlight pre .sr{color:#099}.highlight pre .s1{color:#a50}.highlight pre .ss{color:#00a}.highlight pre .bp{color:#0aa}.highlight pre .vc{color:#a00}.highlight pre .vg{color:#a00}.highlight pre .vi{color:#a00}.highlight pre .il{color:#099}.site__header{margin-bottom:3.11111rem}.site__title{font-weight:400;text-decoration:none}.site__title:hover{color:inherit}.site__title span{margin-bottom:0}.site__nav{border-top:1px solid #d0d2d4}.night-mode .site__nav{border-top-color:#393b3f}.site__nav ul{overflow:visible}.site__nav li{margin-top:-1px}.site__nav li+li{margin-left:1rem}.site__nav a{text-decoration:none;color:#727375;border-top:1px solid transparent}.night-mode .site__nav a{color:#77797a}.site__nav a.active{color:#cb5c42;border-top-color:#cb5c42}.site__nav a:hover{color:#cb5c42}.js--toggle-lights{font-family:sans-serif}.posts__list .beta{margin-bottom:0}.posts__list a{text-decoration:none}p:empty{display:none}.hentry{margin-bottom:6.22222rem}@media (max-width: 860px){.hentry{margin-left:0}}.post__header,.page__header{margin-bottom:4.66667rem}@media (max-width: 860px) and (min-width: 600px){.post__content.grid__col,.page__content.grid__col,.post__header.grid__col,.page__header.grid__col{display:block;padding-left:0;margin-left:auto;margin-right:auto}}.home__avatar{shape-outside:url("/uploads/2014/09/sketch-portrait-large.png");shape-margin:20px}.footnote,.footnote:visited{padding:.15em;color:#cb5c42;text-decoration:none}.footnote:hover,.footnote:visited:hover{text-decoration:underline}.footnotes:before{content:'';display:block}.footnotes :last-child{margin-bottom:0}.footnotes :target{color:#3d464d}.site__footer{border-top:1px solid #d0d2d4}.night-mode .site__footer{border-top-color:#393b3f}.site__footer section{position:static}.site__footer section+section:before{content:none;content:normal}@media screen and (min-width: 700px){.site__footer section+section:before{content:'';position:absolute;width:1px;margin-left:-0.77778rem;top:0;bottom:0;background-color:#d0d2d4}.night-mode .site__footer section+section:before{background-color:#393b3f}}.footer__copyright{border-top:1px solid #d0d2d4}.night-mode .footer__copyright{border-top-color:#393b3f} | |
↑ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#test { font-size:10px; text-align:center; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#test { font-size:36px; text-align:center; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment