Revision: 3910 Author: hans URL: http://bknr.net/trac/changeset/3910
Handle unknown paths by redirecting to the home page.
U trunk/projects/quickhoney/website/static/javascript.js
Modified: trunk/projects/quickhoney/website/static/javascript.js =================================================================== --- trunk/projects/quickhoney/website/static/javascript.js 2008-09-16 19:02:57 UTC (rev 3909) +++ trunk/projects/quickhoney/website/static/javascript.js 2008-09-17 09:24:51 UTC (rev 3910) @@ -472,7 +472,11 @@ }
log('got ', query_result.length.toString(), ' images'); - display_query_result(); + if (query_result.length) { + display_query_result(); + } else { + document.location.href = '/#home'; + } }
function query_imagedb(directory, subdirectory, force) { @@ -554,6 +558,12 @@ }
function show_page(pagename, subpath) { + + if (!pages[pagename]) { + document.location.href = '/'; + return; + } + var page = pages[pagename];
log('show_page ' + pagename + ' subpath ' + subpath + ' current_directory ' + current_directory);