[bknr-cvs] hans changed trunk/projects/quickhoney/website/static/

BKNR Commits bknr at bknr.net
Tue Sep 9 08:57:35 UTC 2008


Revision: 3859
Author: hans
URL: http://bknr.net/trac/changeset/3859

Remove debugger, improve load appearance.

U   trunk/projects/quickhoney/website/static/index.css
U   trunk/projects/quickhoney/website/static/javascript.js

Modified: trunk/projects/quickhoney/website/static/index.css
===================================================================
--- trunk/projects/quickhoney/website/static/index.css	2008-09-09 08:45:08 UTC (rev 3858)
+++ trunk/projects/quickhoney/website/static/index.css	2008-09-09 08:57:35 UTC (rev 3859)
@@ -7,6 +7,10 @@
 a:active { outline: none }
 a:focus { -moz-outline-style: none }
 
+#logo {
+	margin: 290px 0px 305px 105px;
+}
+
 .page {
         display: none;
         border: 0px;
@@ -156,6 +160,7 @@
 /* path / version */
 
 #path-and-version {
+	visibility: hidden;
 	position: absolute;
         top: 68px;
         left: 36px;
@@ -314,7 +319,7 @@
 
 #cue {
 	position: absolute;
-	visibility: hidden;
+	visibility: visible;
 	left: 0px;
         background-color: white;
         top: 8px;
@@ -399,7 +404,7 @@
 
 /* cms styles */
 
-p.cms {
+.cms {
 	margin-top: 10px;
 }
 

Modified: trunk/projects/quickhoney/website/static/javascript.js
===================================================================
--- trunk/projects/quickhoney/website/static/javascript.js	2008-09-09 08:45:08 UTC (rev 3858)
+++ trunk/projects/quickhoney/website/static/javascript.js	2008-09-09 08:57:35 UTC (rev 3859)
@@ -36,30 +36,6 @@
     return document.getElementById(id);
 }
 
-/* debugger */
-
-var want_debugger = false;
-var debug_string = '';
-
-function debug() {
-    var message = '';
-    for (var i = 0; i < arguments.length; i++) {
-        message += arguments[i];
-    }
-    if (window.console && window.console.log) {
-        window.console.log(message);
-    }
-    if (want_debugger) {
-	debug_string += message + '<br />';
-	$("debugger_text").innerHTML = debug_string;
-    }
-}
-
-function clear_debug_window() {
-    debug_string = '';
-    debug('debug window cleared');
-}
-
 /* login status */
 
 function login_status(json_result) {
@@ -79,7 +55,7 @@
 
 function show_cms_window(name) {
 
-    debug('show_cms_window ' + name);
+    log('show_cms_window ' + name);
 
     $("cms").style.top = "106px";
     $("cms").style.left = "730px";
@@ -392,7 +368,7 @@
 
     // make sure that the right elements are displayed
     if (document.show_picture) {
-	debug('directly jump to ' + document.show_picture);
+	log('directly jump to ' + document.show_picture);
 	for (var i = 0; i < query_result.length; i++) {
 	    if (query_result[i].name == document.show_picture) {
 		display_image(i);
@@ -442,14 +418,14 @@
 	}
     }
 
-    debug('got ', query_result.length.toString(), ' images');
+    log('got ', query_result.length.toString(), ' images');
     display_query_result();
     hide_cue();
 }
 
 function query_imagedb(directory, subdirectory, force) {
 
-    debug('query_imagedb - keywords: ', directory, " ", subdirectory);
+    log('query_imagedb - keywords: ', directory, " ", subdirectory);
 
     var key = directory + ((subdirectory == "browseall") ? "" : ("/" + subdirectory)) + ((subdirectory == "smallworld") ? "?layout=smallworld" : "");
 
@@ -522,9 +498,10 @@
 function show_page(pagename, subpath) {
     var page = pages[pagename];
 
-    debug('show_page ' + pagename + ' subpath ' + subpath + ' current_directory ' + current_directory);
+    log('show_page ' + pagename + ' subpath ' + subpath + ' current_directory ' + current_directory);
 
     $('loading').style.display = 'none';
+    $('path-and-version').style.visibility = 'visible';
 
     /* workaround for IE, which does not display the overlapping menu items expectedly */
     map(function (keyword) {
@@ -598,7 +575,7 @@
 
 function home_loaded(image) {
 
-    debug('home_loaded - image is ' + image + ' width: ' + image.width);
+    log('home_loaded - image is ' + image + ' width: ' + image.width);
 
     reveal_image(image);
 }
@@ -732,7 +709,7 @@
 
 function directory(directory_name, subpath) {
 
-    debug('directory: ', directory_name, ' subpath: ', subpath, ' current_directory: ', current_directory);
+    log('directory: ', directory_name, ' subpath: ', subpath, ' current_directory: ', current_directory);
 
     replaceChildNodes("thumbnails", " ");
 
@@ -769,7 +746,7 @@
 
 function subdirectory(subdirectory, page) {
 
-    debug('subdirectory: ', subdirectory, ' page: ', page);
+    log('subdirectory: ', subdirectory, ' page: ', page);
 
     $('explicit').checked = (subdirectory == 'nudes');
 
@@ -887,6 +864,21 @@
     }
 }
 
+function wait_for_images(callback) {
+    var complete = true;
+    map(function (image) {
+            if (!image.complete) {
+                complete = false;
+            }
+        }, getElementsByTagAndClassName('img', null));
+
+    if (complete) {
+        callback();
+    } else {
+        callLater(.2, partial(wait_for_images, callback));
+    }
+}
+
 function display_thumbnail_page() {
     var current_page_index = position_to_page_number(query_position) - 1;
 
@@ -951,7 +943,7 @@
     query_position = index;
     current_image = query_result[index];
     
-    debug('display_image index ' + index);
+    log('display_image index ' + index);
 
     overlay_remove();
     display_path();
@@ -976,7 +968,7 @@
 
     var percent = Math.round(100 * ratio);
 
-    debug("calculated scaling: ratio " + (Math.round(ratio * 100) / 100) + " percent " + percent + " width " + display_width + " height " + display_height);
+    log("calculated scaling: ratio " + (Math.round(ratio * 100) / 100) + " percent " + percent + " width " + display_width + " height " + display_height);
 
     var may_enlarge = (current_directory == 'pixel' && (current_image.ratio < 1));
 
@@ -1095,7 +1087,7 @@
 /* open the upload window */
 
 function do_upload(target) {
-    debug('do_upload - target is ', target);
+    log('do_upload - target is ', target);
     
     var upload_window = window.open('', target, "width=500,height=300,status=no,toolbar=no,menubar=no,resizable=no,scrollbars=no");
     upload_window.focus();
@@ -1106,7 +1098,7 @@
 /* open the button upload window */
 
 function do_button_upload(target) {
-    debug('do_button_upload - target is ', target);
+    log('do_button_upload - target is ', target);
     
     var upload_window = window.open('', target, "width=500,height=300,status=no,toolbar=no,menubar=no,resizable=no,scrollbars=no");
     upload_window.focus();
@@ -1134,7 +1126,7 @@
 
 function safari_compatibility_hack() {
     // for safari, we change the style sheet so that images are not hidden during load
-    debug('changing stylesheet for safari');
+    log('changing stylesheet for safari');
     for (var i = 0; i < document.styleSheets.length; i++) {
 	var rules = document.styleSheets[i][document.all ? 'rules' : 'cssRules'];
 	for (var j = 0; j < rules.length; j++) {
@@ -1147,22 +1139,14 @@
     }
 }
 
-function enable_debuger()
-{
-    want_debugger = true;
-	
-    $("debugger").style.visibility = 'visible';
-    $("debugger").style.left = '730px';
-    $("debugger").style.width = '400px';
-    $("debugger").style.heigth = '640px';
-}
-
-function init() {
+function init_() {
     if (navigator.userAgent.indexOf("Safari") != -1) {
 	safari = true;
 	safari_compatibility_hack();
     }
 
+    show_cue('initializing');
+
     load_button_images();
     loadJSONDoc("/json-login").addCallbacks(login_status, alert);
     loadJSONDoc("/json-clients").addCallbacks(set_clients, alert);
@@ -1175,10 +1159,14 @@
     poll_path();
 }
 
+function init() {
+    wait_for_images(init_);
+}
+
 function jump_to(path) {
     document.current_path = path;
 
-    debug('jump_to - path is ', path);
+    log('jump_to - path is ', path);
 
     path = decodeURI(path.replace(/[&#].*/, ""));
     var components = path.split("/");




More information about the Bknr-cvs mailing list