Skip to content

Commit

Permalink
sweet ui hax courtesy of Ben
Browse files Browse the repository at this point in the history
  • Loading branch information
nkpart committed Jun 11, 2011
1 parent 87bda3e commit 24f1c6e
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 20 deletions.
38 changes: 28 additions & 10 deletions site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</head>
<body>
<h1 id='title'></h1>
<ul id='holes'></ul>
<div id='holes'></div>
<div id='score'></div>
<form action='#' id='guess' method='get'>
<input id='guess_text' />
Expand All @@ -26,12 +26,14 @@ <h1 id='title'></h1>
<style type='text/css'>
/*<![CDATA[*/
body {
font-family: 'Helvetica Neue', Arial, sans-serif;
margin: 0 auto;
width: 400px;
}

* {
font-family: 'Lucida Grande', sans-serif;
h1#title {
font-size: 6em;
margin: 0.2em 0;
}

#party-time {
Expand All @@ -56,11 +58,21 @@ <h1 id='title'></h1>
margin: 1em 0;
}

ul#holes li {
#holes {
font-family: monospace;
overflow: hidden;
}

#holes ul {
float: left;
}

#holes ul li {
font-family: monospace;
}

input#guess_text {
font-family: 'Helvetica Neue', Arial, sans-serif;
font-size: 160%;
font-weight: bold;
width: 100%;
Expand All @@ -75,7 +87,8 @@ <h1 id='title'></h1>
//<![CDATA[
var puzzles = [
["acidic", ["acidic","acid","cad","aid"]],
["cafe", ["cafe", "face", "ace"]]
["cafe", ["cafe", "face", "ace"]],
["canyon", ["canyon","annoy","canny","canon","anon","cony","cyan","nay","yon","any","can","cay","con","coy"]],
];

var GameState = {
Expand All @@ -85,9 +98,9 @@ <h1 id='title'></h1>
this.children.sort(function (a, b) {
var checkSize = a.length == b.length;
if (checkSize) {
return a > b;
return a > b ? 1 : -1;
} else {
return a.length < b.length;
return a.length < b.length ? 1 : -1;
}
});
this.found = [];
Expand Down Expand Up @@ -136,9 +149,14 @@ <h1 id='title'></h1>
}).join('');
$('#title').html(show);
$('#holes').html('');
$.each(GameState.children, function() {
$('#holes').append('<li id=word-' + this + '>' + hidden(this) + '</li>');
});
var words = GameState.children.slice(0);
while (words.length > 0) {
var chunk = words.splice(0, 5);
var middle = $.map(chunk, function(val, i) {
return ('<li id=word-' + val + '>' + hidden(val) + '</li>');
}).join('\n');
$('#holes').append('<ul>' + middle + '</ul>');
}
$('#guess_text').focus();
},
incrementFails: function() {
Expand Down
1 change: 1 addition & 0 deletions tasks
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
columns for the things that aren't done yet
server end
store solved puzzle numbers in local storage
38 changes: 28 additions & 10 deletions ui.haml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
%body
%h1#title

%ul#holes
#holes

#score

Expand All @@ -26,12 +26,14 @@

:css
body {
font-family: 'Helvetica Neue', Arial, sans-serif;
margin: 0 auto;
width: 400px;
}

* {
font-family: 'Lucida Grande', sans-serif;
h1#title {
font-size: 6em;
margin: 0.2em 0;
}

#party-time {
Expand All @@ -56,11 +58,21 @@
margin: 1em 0;
}

ul#holes li {
#holes {
font-family: monospace;
overflow: hidden;
}

#holes ul {
float: left;
}

#holes ul li {
font-family: monospace;
}

input#guess_text {
font-family: 'Helvetica Neue', Arial, sans-serif;
font-size: 160%;
font-weight: bold;
width: 100%;
Expand All @@ -74,7 +86,8 @@

var puzzles = [
["acidic", ["acidic","acid","cad","aid"]],
["cafe", ["cafe", "face", "ace"]]
["cafe", ["cafe", "face", "ace"]],
["canyon", ["canyon","annoy","canny","canon","anon","cony","cyan","nay","yon","any","can","cay","con","coy"]],
];

var GameState = {
Expand All @@ -84,9 +97,9 @@
this.children.sort(function (a, b) {
var checkSize = a.length == b.length;
if (checkSize) {
return a > b;
return a > b ? 1 : -1;
} else {
return a.length < b.length;
return a.length < b.length ? 1 : -1;
}
});
this.found = [];
Expand Down Expand Up @@ -135,9 +148,14 @@
}).join('');
$('#title').html(show);
$('#holes').html('');
$.each(GameState.children, function() {
$('#holes').append('<li id=word-' + this + '>' + hidden(this) + '</li>');
});
var words = GameState.children.slice(0);
while (words.length > 0) {
var chunk = words.splice(0, 5);
var middle = $.map(chunk, function(val, i) {
return ('<li id=word-' + val + '>' + hidden(val) + '</li>');
}).join('\n');
$('#holes').append('<ul>' + middle + '</ul>');
}
$('#guess_text').focus();
},
incrementFails: function() {
Expand Down

0 comments on commit 24f1c6e

Please sign in to comment.