[bknr-cvs] r2437 - in branches/trunk-reorg/projects/quickhoney/website: static templates

hhubner at common-lisp.net hhubner at common-lisp.net
Fri Feb 1 12:01:52 UTC 2008


Author: hhubner
Date: Fri Feb  1 07:01:51 2008
New Revision: 2437

Modified:
   branches/trunk-reorg/projects/quickhoney/website/static/javascript.js
   branches/trunk-reorg/projects/quickhoney/website/static/styles.css
   branches/trunk-reorg/projects/quickhoney/website/templates/index.xml
Log:
Fix navigation - This was very simple, and I really regret that using
achors to store navigation information had not occured to me two years
ago.  One can now deep link into the Quickhoney site, a feature that is
used by the RSS feed.  Also, inner-site navigation updates the anchor now,
making it possible to store links to anything.


Modified: branches/trunk-reorg/projects/quickhoney/website/static/javascript.js
==============================================================================
--- branches/trunk-reorg/projects/quickhoney/website/static/javascript.js	(original)
+++ branches/trunk-reorg/projects/quickhoney/website/static/javascript.js	Fri Feb  1 07:01:51 2008
@@ -531,14 +531,14 @@
 
     if (current_directory) {
 	if (current_subdirectory) {
-	    path_links[0] = '<a href="#" onclick="show_page(' + "'" + current_directory + "'" + ');">' + current_directory + '</a>';
+	    path_links[0] = '<a href="#' + current_directory + '" onclick="show_page(' + "'" + current_directory + "'" + ');">' + current_directory + '</a>';
 	} else {
 	    path_links[0] = current_directory;
 	}
     }
     if (current_subdirectory) {
 	if (current_image) {
-	    path_links[1] = '<a href="#" onclick="subdirectory(' + "'" + current_subdirectory + "'" + ');">' + current_subdirectory + '</a>';
+	    path_links[1] = '<a href="#' + current_directory + "/" + current_subdirectory + '" onclick="subdirectory(' + "'" + current_subdirectory + "'" + ');">' + current_subdirectory + '</a>';
 	} else {
 	    path_links[1] = current_subdirectory;
 	}
@@ -646,6 +646,7 @@
 	} else {
 	    buttons[i].style.visibility = 'hidden';
 	    buttons[i].src = new_image;
+	    buttons[i].parentNode.href = '#' + current_directory + '/' + subdirectory_name;
 	    eval("button_links[i].onclick = function onclick(event) { subdirectory('" + subdirectory_name + "'); }");
 	}
     }
@@ -734,13 +735,16 @@
 
     if (query_result_pages.length > 1) {
 	if (current_page > 0) {
-	    push(result_links, '<a href="#" onclick="goto_page(' + (current_page - 1) + ');"><<</a>');
+	    push(result_links,
+		 '<a href="#' + current_directory + '/' + current_subdirectory + '/' + (current_page - 1) +
+		 '" onclick="goto_page(' + (current_page - 1) + ');"><<</a>');
 	} else {
 	    push(result_links, '<<');
 	}
 	var last_page = position_to_page(query_result.length - 1);
 	if (current_page < last_page) {
-	    push(result_links, '<a href="#" onclick="goto_page(' + (current_page + 1).toString() + ');">>></a>');
+	    push(result_links, '<a href="#' + current_directory + '/' + current_subdirectory + '/' + (current_page + 1).toString() +
+		 '" onclick="goto_page(' + (current_page + 1).toString() + ');">>></a>');
 	} else {
 	    push(result_links, '>>');
 	}
@@ -764,7 +768,8 @@
 	    if (page_number == current_page) {
 		push(result_links, (page_number + 1).toString());
 	    } else {
-		push(result_links, '<a href="#" onclick="goto_page(' + page_number + ');">' + (page_number + 1) + '</a>');
+		push(result_links, '<a href="#' + current_directory + '/' + current_subdirectory + '/' + (current_page + 1).toString() +
+		     '" onclick="goto_page(' + page_number + ');">' + (page_number + 1) + '</a>');
 	    }
 	}
 
@@ -795,7 +800,9 @@
 	for (var image_index = 2; image_index < row.length; image_index++) {
 	    var image = row[image_index];
 	    thumbnail_html
-		+= '<a href="#" onclick="display_image(' + "'" + image.position + "'" + ');">'
+		+= '<a href="#'
+		+ current_directory + '/' + current_subdirectory + '/' + image.name
+		+ '" onclick="display_image(' + "'" + image.position + "'" + ');">'
 		+ '<img class="inherited_image" width="' + cell_width + '" height="' + cell_height + '" '
 		+ ' src="/image/' + image.name + '/cell,' + background_color + ',' + cell_width + ',' + cell_height + ',8" '
 		+ ' onload="reveal_image(this);" />'
@@ -813,15 +820,20 @@
     var result_links = [];
 
     if (query_position > 0) {
-	push(result_links, '<a href="#" onclick="display_image(' + (query_position - 1) + ');"><<</a>');
+	push(result_links, '<a href="#'
+	     + current_directory + '/' + current_subdirectory + '/' + query_result[query_position - 1].name
+	     + '" onclick="display_image(' + (query_position - 1) + ');"><<</a>');
     } else {
 	push(result_links, '<<');
     }
     if (query_position < (query_result.length - 1)) {
-	push(result_links, '<a href="#" onclick="display_image(' + (query_position + 1) + ');">>></a>');
+	push(result_links, '<a href="#'
+	     + current_directory + '/' + current_subdirectory + '/' + query_result[query_position + 1].name
+	     + '" onclick="display_image(' + (query_position + 1) + ');">>></a>');
     } else {
 	push(result_links, '>>');
     }
+    document.getElementById('back_to_results_link').href = '#' + current_directory + '/' + current_subdirectory + '/' + position_to_page(query_position);
 
     document.getElementById("image_navbar").innerHTML = result_links.join(" ");
     document.getElementById("result_image_count").innerHTML = "result " + (query_position + 1) + " of " + query_result.length;
@@ -1012,37 +1024,35 @@
 }
 
 function init() {
-    if (document.location.href.indexOf("#debug") != -1) {
-	want_debugger = true;
+    var path = (document.location.href + "#").split("#")[1];
+
+    if (path) {
+	if (path == "debug") {
+
+	    want_debugger = true;
 	
-	document.getElementById("debugger").style.visibility = 'visible';
-	document.getElementById("debugger").style.left = '730px';
-	document.getElementById("debugger").style.width = '400px';
-	document.getElementById("debugger").style.heigth = '640px';
-    } else {
-	document.getElementById("debugger").style.left = "1px";
-	document.getElementById("debugger").style.right = "1px";
-	document.getElementById("debugger").style.width = "1px";
-	document.getElementById("debugger").style.height = "1px";
-    }
+	    document.getElementById("debugger").style.visibility = 'visible';
+	    document.getElementById("debugger").style.left = '730px';
+	    document.getElementById("debugger").style.width = '400px';
+	    document.getElementById("debugger").style.heigth = '640px';
 
-    debug('init - path is ', document.location.href);
+	} else if (path == "update") {
 
-    if (document.location.href.indexOf("#update") != -1) {
-	if ((navigator.platform == "MacPPC") && (navigator.userAgent.indexOf("MSIE 5.") != -1)) {
-	    alert("CMS functionality not supported on IE5/Mac");
+	    if ((navigator.platform == "MacPPC") && (navigator.userAgent.indexOf("MSIE 5.") != -1)) {
+		alert("CMS functionality not supported on IE5/Mac");
+	    } else {
+		wants_cms = true;
+		document.getElementById("login_form").style.visibility = 'visible';
+	    }
+	    show_cms_window("login_form");
 	} else {
-	    wants_cms = true;
-	    document.getElementById("login_form").style.visibility = 'visible';
+	    var jump_to = path;
+	    jump_to = jump_to.replace(/[&#].*/, "");
+	    document.jump_to = jump_to;
 	}
-	show_cms_window("login_form");
     }
 
-    if (document.location.href.indexOf("jumpto=") != -1) {
-	var jump_to = document.location.href.replace(/.*jumpto=/, "");
-	jump_to = jump_to.replace(/[&#].*/, "");
-	document.jump_to = jump_to;
-    }
+    debug('init - path is ', path);
 
     buttons = document.getElementById("directory").getElementsByTagName('img');
     button_links = document.getElementById("directory").getElementsByTagName('a');

Modified: branches/trunk-reorg/projects/quickhoney/website/static/styles.css
==============================================================================
--- branches/trunk-reorg/projects/quickhoney/website/static/styles.css	(original)
+++ branches/trunk-reorg/projects/quickhoney/website/static/styles.css	Fri Feb  1 07:01:51 2008
@@ -69,10 +69,10 @@
 #debugger {
 	visibility: hidden;
 	position: absolute;
-	left: 0px;
-	top: 36px;
-	width: 0px;
-	height: 0px;
+	left: 1px;
+	top: 1px;
+	width: 1px;
+	height: 1px;
 }
 
 .debugger {

Modified: branches/trunk-reorg/projects/quickhoney/website/templates/index.xml
==============================================================================
--- branches/trunk-reorg/projects/quickhoney/website/templates/index.xml	(original)
+++ branches/trunk-reorg/projects/quickhoney/website/templates/index.xml	Fri Feb  1 07:01:51 2008
@@ -15,22 +15,22 @@
 
 	<body id="quickhoney">
 
-		<a onclick="show_page('quickhoney')" href="#">
+		<a onclick="show_page('quickhoney')" href="#quickhoney">
 			<img alt="quickhoney" class="menu" id="m_quickhoney" src="/image/quickhoney" />
 		</a>
-		<a onclick="show_page('pixel')" href="#">
+		<a onclick="show_page('pixel')" href="#pixel">
 			<img alt="pixel" class="menu" id="m_pixel" src="/image/pixel" />
 		</a>
-		<a onclick="show_page('vector')" href="#">
+		<a onclick="show_page('vector')" href="#vector">
 			<img alt="vector" class="menu" id="m_vector" src="/image/vector" />
 		</a>
-		<a onclick="show_page('photo')" href="#">
+		<a onclick="show_page('photo')" href="#photo">
 			<img alt="photo" class="menu" id="m_photo" src="/image/photo" />
 		</a>
-		<a onclick="show_page('clients')" href="#">
+		<a onclick="show_page('clients')" href="#clients">
 			<img alt="clients" class="menu" id="m_clients" src="/image/clients" />
 		</a>
-		<a onclick="show_page('contact')" href="#">
+		<a onclick="show_page('contact')" href="#contact">
 			<img alt="contact" class="menu" id="m_contact" src="/image/contact" />
 		</a>
 
@@ -81,7 +81,7 @@
 				</span>
 	
 				<span id="results_navbar" class="text">
-					<span id="back_to_results"><a onclick="back_to_results()" href="#">back to results</a></span>
+					<span id="back_to_results"><a id="back_to_results_link" onclick="back_to_results()" href="#">back to results</a></span>
 					<span id="result_image_count"> <!-- may not be empty -->
 					</span>
 				</span>
@@ -95,7 +95,7 @@
 			</div>
 	
 			<div id="clients">
-				<a href="#" onclick="return nice_jobs();">
+				<a href="#clients/nicejobs" onclick="return nice_jobs();">
 					<img id="jobs-banner" src="/random-image/button/jobs" border="0" />
 				</a>
 				<img id="clients-type" src="/image/type-niceclients" />



More information about the Bknr-cvs mailing list