Mercurial > open-web-challenges
changeset 19:c029286305e2
Challenge IDs can now be specified in the querystring, and nonexistent ones show a 'does-not-exist' challenge.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Tue, 31 Mar 2009 07:44:25 -0700 |
parents | fa108b6e9fbd |
children | 1c1f74ba541a |
files | index.html open-web-challenges.js |
diffstat | 2 files changed, 24 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/index.html Tue Mar 31 07:24:47 2009 -0700 +++ b/index.html Tue Mar 31 07:44:25 2009 -0700 @@ -69,7 +69,20 @@ } </div> </div> - + <div id="challenge-does-not-exist" class="challenge"> + <div class="content"> + <p>Sorry, this challenge doesn't exist yet. Please check back later!</p> + </div> + <div class="hints"> + <p>No, really, this isn't a challenge.</p> + <p>Well, if you really want more puzzles, check out <a href="http://parchment.googlecode.com/svn/trunk/parchment.html?story=http://parchment.toolness.com/if-archive/games/zcode/Galatea.zblorb.js">Galatea</a>.</p> + </div> + <div class="validator"> + function(query) { + return false; + } + </div> + </div> </body> <script src="jquery.js"></script> <script src="open-web-challenges.js"></script>
--- a/open-web-challenges.js Tue Mar 31 07:24:47 2009 -0700 +++ b/open-web-challenges.js Tue Mar 31 07:44:25 2009 -0700 @@ -17,6 +17,8 @@ load: function load(id) { var challenge = $('#challenge-' + id); + if (!challenge.length) + challenge = $('#challenge-does-not-exist'); var content = challenge.find('.content').clone(); var current = $('#current-challenge'); current.empty(); @@ -58,8 +60,15 @@ $(window).ready( function() { + var queryIndex = window.location.href.indexOf('?'); + var challengeId; + if (queryIndex == -1) + challengeId = 1; + else + challengeId = window.location.href.slice(queryIndex+1); + function showChallenge() { - OWC.load(1); + OWC.load(challengeId); } if ($('#_firebugConsole').length)