Revision: 3957 Author: hans URL: http://bknr.net/trac/changeset/3957
Prepare "send image by imail". Avoid errors when the user blocks Google Analytics. Remove /MochiKit handler
U trunk/projects/quickhoney/src/webserver.lisp U trunk/projects/quickhoney/website/static/index.css U trunk/projects/quickhoney/website/static/javascript.js U trunk/projects/quickhoney/website/templates/index.xml
Modified: trunk/projects/quickhoney/src/webserver.lisp =================================================================== --- trunk/projects/quickhoney/src/webserver.lisp 2008-09-24 13:45:25 UTC (rev 3956) +++ trunk/projects/quickhoney/src/webserver.lisp 2008-09-24 13:59:17 UTC (rev 3957) @@ -43,8 +43,6 @@ ("/static" directory-handler :destination ,(merge-pathnames #p"static/" *website-directory*) :filename-separator #,) - ("/MochiKit" directory-handler - :destination ,(merge-pathnames #p"static/MochiKit/" *website-directory*)) ("/favicon.ico" file-handler :destination ,(merge-pathnames #p"static/favicon.ico" *website-directory*) :content-type "application/x-icon")
Modified: trunk/projects/quickhoney/website/static/index.css =================================================================== --- trunk/projects/quickhoney/website/static/index.css 2008-09-24 13:45:25 UTC (rev 3956) +++ trunk/projects/quickhoney/website/static/index.css 2008-09-24 13:59:17 UTC (rev 3957) @@ -502,7 +502,7 @@ padding: 10px 15px 10px 10px; }
-#overlay #hey #hey_from, #overlay #hey textarea { +#overlay #hey #hey_from, #overlay #hey #hey_to, #overlay #hey textarea { width: 100%; }
Modified: trunk/projects/quickhoney/website/static/javascript.js =================================================================== --- trunk/projects/quickhoney/website/static/javascript.js 2008-09-24 13:45:25 UTC (rev 3956) +++ trunk/projects/quickhoney/website/static/javascript.js 2008-09-24 13:59:17 UTC (rev 3957) @@ -1116,7 +1116,7 @@ var d = doXHR("/digg-image/" + current_image.id, { method: 'POST', headers: {"Content-Type":"application/x-www-form-urlencoded"}, - sendContent: queryString({ from: $('hey_from').value, text: $('hey_text').value }) }) + sendContent: queryString({ from: $('hey_from').value, to: $('hey_to').value, text: $('hey_text').value }) }) .addCallback(overlay_remove); make_overlay('send-comment', 'Sending your comment', 300); return false; @@ -1228,12 +1228,14 @@ function poll_path() { var url_path = (document.location.href + "#").split("#")[1]; if (url_path && (url_path != document.current_path)) { - try { - pageTracker._trackPageview(document.location.href.replace("#", "/").replace(/^[^/]+://[^/]+/, "")); + if (pageTracker) { + try { + pageTracker._trackPageview(document.location.href.replace("#", "/").replace(/^[^/]+://[^/]+/, "")); + } + catch (e) { + log("tracking failed: " + e); + } } - catch (e) { - log("tracking failed: " + e); - } jump_to(url_path); }
@@ -1286,6 +1288,27 @@ overlay.style.visibility = 'inherit'; }
+function make_post_mail_form() { + var subject = 'Send image ' + current_image.name + ' by email'; + make_overlay('hey', 'Comment', 320, + FORM({ method: 'POST', action: '#' }, + 'your email', + BR(), + INPUT({ type: 'text', id: 'hey_from', value: '' }), + BR(), + 'receipient email', + BR(), + INPUT({ type: 'text', id: 'hey_to', value: '' }), + BR(), + BR(), + 'comment', + BR(), + TEXTAREA({ name: 'text', id: 'hey_text', rows: 4, columns: 40 }, ''), + BR(), + INPUT({ type: 'submit', id: 'hey_send', value: 'Send' }))); + $('hey_send').onclick = hey_send; +} + function make_comment_form() { var subject = 'Comment on ' + current_image.name; make_overlay('hey', 'Comment', 320, @@ -1293,6 +1316,7 @@ 'email', BR(), INPUT({ type: 'text', id: 'hey_from', value: '' }), + INPUT({ type: 'hidden', id: 'hey_to', value: '' }), BR(), BR(), 'comment',
Modified: trunk/projects/quickhoney/website/templates/index.xml =================================================================== --- trunk/projects/quickhoney/website/templates/index.xml 2008-09-24 13:45:25 UTC (rev 3956) +++ trunk/projects/quickhoney/website/templates/index.xml 2008-09-24 13:59:17 UTC (rev 3957) @@ -326,14 +326,16 @@
<div id="cue"><img alt="" src="/static/spinner.gif" width="16" height="16"/></div>
-<script type="text/javascript"> -var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); -document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); -</script> -<script type="text/javascript"> -var pageTracker = _gat._getTracker("UA-3432041-5"); -pageTracker._trackPageview(); -</script> + <script type="text/javascript"> + var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); + document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); + </script> + <script type="text/javascript"> + if (typeof(_gat) == 'object') { + var pageTracker = _gat._getTracker("UA-3432041-5"); + pageTracker._trackPageview(); + } + </script> <script language="javascript" type="text/javascript"> init(); </script>