new layout

This commit is contained in:
Koen Lageveen 2016-03-02 21:11:16 +01:00
parent 781745f4d9
commit f41b7f8ff9
1 changed files with 284 additions and 278 deletions

View File

@ -1,6 +1,6 @@
<!doctype html> <!doctype html>
<html> <html>
<head> <head>
<title>Programming Fonts - Test Drive</title> <title>Programming Fonts - Test Drive</title>
<meta charset="utf-8"/> <meta charset="utf-8"/>
@ -86,132 +86,121 @@
background: #F5F0E6; background: #F5F0E6;
} }
body { body {
color:#444; color: #fff;
background: #222;
font-family: "Lato", sans-serif; font-family: "Lato", sans-serif;
font-size: 16px; font-size: 16px;
line-height: 2; line-height: 2;
} }
h1 { h1 {
font-family: 'Input Mono', serif;
font-weight: bold; font-weight: bold;
font-size: 64px; font-size: 2em;
line-height: 64px; margin: 0;
margin: 0 0 16px 0; padding: 0;
text-align: center;
padding-top: 64px;
} }
h1 + p { h1 + p {
font-weight: bold; line-height: 1;
text-align: center; padding: 1em 0;
margin: 0 0 48px 0;
font-size: 20px;
} }
article { article {
max-width: 90%; position: fixed;
width: 800px; background: transparent;
margin: 0 auto; bottom: 0;
margin-bottom: 64px; right: 0;
background: white; margin-bottom: 2em;
border: 0; margin-right: 2em;
box-shadow: 0 0 2px rgba(0, 0, 0, 0.2); text-align: right;
max-width: 50%;
} }
article p { footer {
text-align: center; font-size: .8em;
padding: 0 32px 16px 32px;
}
article p:last-child {
padding-bottom: 36px;
} }
#font-info p { #font-info p {
display: none; display: none;
padding-bottom: 36px; line-height: 1;
} padding: 1em 0;
article form {
margin-bottom: 32px;
}
select {
margin-right: 32px;
}
footer {
max-width: 90%;
width: 800px;
text-align: center;
margin: 64px auto;
}
footer form {
margin-top: 8px;
} }
a, a,
a:link, a:link,
a:visited, a:visited,
a:hover { a:hover {
color: #44cc9a; color: inherit;
text-decoration: none; opacity: .7;
transition: opacity .2s;
} }
a:hover { a:hover,
opacity: .8; a:active {
transition: opacity .5s; opacity: 1;
}
select {
width: 12em;
margin-left: .5ex;
} }
pre, pre,
textarea, textarea,
.CodeMirror { .CodeMirror {
font-family: "Input Mono"; font-family: "Input Mono";
height: auto;
} }
.CodeMirror { .CodeMirror {
border: none; border: none;
font-size:16px; font-size:16px;
background: transparent; background: transparent;
box-shadow: none !important; box-shadow: none !important;
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
} }
.CodeMirror-gutters { .CodeMirror-gutters {
background: transparent; background: transparent;
} }
@media screen and (max-width:800px) { @media (max-width: 400px) {
.select { body { line-height: 1.5; }
display: block; article { margin-bottom: 1.5em; max-width: none; }
text-align: right; label { display: block; }
margin: 0; h1 { font-size: 1em; }
} h1 + p,
} footer { display: none; }
@media screen and (max-width:640px) {
h1 {
font-size: 48px;
line-height: 48px;
padding-top: 48px;
margin-bottom: 48px;
}
} }
</style> </style>
</head> </head>
<body> <body>
<div class="background"></div> <form>
<textarea id="code" name="code">
<h1>Programming Fonts</h1>
<p class="description">What font looks best? Test drive over 50 free programming fonts and find out!</p>
<article>
<form>
<textarea id="code" name="code">
# Type some code: # Type some code:
function findSequence(goal) { function updateGutters(cm) {
function find(start, history) { var gutters = cm.display.gutters, specs = cm.options.gutters;
if (start == goal) removeChildren(gutters);
return history; for (var i = 0; i < specs.length; ++i) {
else if (start > goal) var gutterClass = specs[i];
return null; var gElt = gutters.appendChild(elt("div", null, "CodeMirror-gutter " + gutterClass));
else if (gutterClass == "CodeMirror-linenumbers") {
return find(start + 9, "(" + history + " + 9)") || cm.display.lineGutter = gElt;
find(start * 3, "(" + history + " * 3)"); gElt.style.width = (cm.display.lineNumWidth || 1) + "px";
} }
return find(1, "I"); }
gutters.style.display = i ? "" : "none";
updateGutterSpace(cm);
} }
return "o0Og9ilL1!";
</textarea> </textarea>
</form> </form>
<p><span class="select">Select a theme <article>
<h1>Programming Fonts</h1>
<p class="description">What font looks best?<br>
Test drive over 50 free programming fonts and find out!</p>
<p>
<span class="select"><label for="select">Select a theme</label>
<select onchange="selectTheme()" id="select"> <select onchange="selectTheme()" id="select">
<option>3024-day</option> <option>3024-day</option>
<option>3024-night</option> <option>3024-night</option>
@ -243,25 +232,29 @@ function findSequence(goal) {
<option>vibrant-ink</option> <option>vibrant-ink</option>
<option>xq-dark</option> <option>xq-dark</option>
<option>xq-light</option> <option>xq-light</option>
</select></span> </select>
<span class="select">Select a font <select onchange="selectFont()" id="select-font"> </span>
</p>
<p>
<span class="select" id="fontselect"><label for="select-font">Select a font</label>
<select onchange="selectFont()" id="select-font">
<!-- filled from json --> <!-- filled from json -->
</select></span> </select>
</span>
</p> </p>
<dix id="font-info"></dix> <dix id="font-info"></dix>
<footer>
<a href="http://programmingfonts.org/list" rel="external">The full list</a> -
<a href="http://programmingfonts.org">The blog</a> -
<a href="http://atom.io/packages/fonts" rel="external">Atom package</a> -
<a href="https://github.com/braver/programmingfonts">Fork this on Github</a> -
By <a href="http://koenlageveen.nl">Koen Lageveen</a>
</footer>
</article> </article>
<footer>
<p><a href="http://programmingfonts.org/list" rel="external">Download your favourite fonts</a>, or use <a href="http://atom.io/packages/fonts" rel="external">this package</a> in <a href="http://atom.io">Atom</a></p>
<p>
Contribute on <a href="https://github.com/braver/programmingfonts">Github</a>
</p>
<p>
<a href="http://programmingfonts.org">Back to the blog</a> - &copy; 2016 <a href="http://koenlageveen.nl">Koen Lageveen</a>
<p>
</footer>
<!-- Some jquery to make life easier --> <!-- Some jquery to make life easier -->
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script> <script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
@ -277,11 +270,17 @@ function findSequence(goal) {
theme: "monokai" theme: "monokai"
}); });
function applyColors() {
$("body").css('color', $(".CodeMirror").css('color'));
$("article").css("text-shadow", "0 0 4px " + $(".CodeMirror").css('background-color'));
}
// CodeMirror theme selector // CodeMirror theme selector
var input = document.getElementById("select"); var input = document.getElementById("select");
function selectTheme() { function selectTheme() {
var theme = input.options[input.selectedIndex].innerHTML; var theme = input.options[input.selectedIndex].innerHTML;
editor.setOption("theme", theme); editor.setOption("theme", theme);
applyColors();
} }
var choice = document.location.search && var choice = document.location.search &&
@ -311,6 +310,13 @@ function findSequence(goal) {
} }
$(document).ready(function(){ $(document).ready(function(){
//randomly select a theme
var options = $("#select > option");
options[Math.floor(Math.random() * options.length)].selected = "selected";
selectTheme();
applyColors();
var font_aliases = []; var font_aliases = [];
$.getJSON("fonts.json", function(data) { $.getJSON("fonts.json", function(data) {
@ -351,5 +357,5 @@ function findSequence(goal) {
_gaq.push(['_trackPageview']); _gaq.push(['_trackPageview']);
</script> </script>
</body> </body>
</html> </html>