Permalink
Browse files

Adding the ability to debug locally

git-svn-id: http://html5slides.googlecode.com/svn/trunk@16 5963eb91-a1a4-c111-6e9c-cdd99a89fa83
  • Loading branch information...
1 parent 5f74aad commit af22898ae8ba3682c7c78c830efaa5685af53946 lukem@google.com committed May 20, 2011
Showing with 29 additions and 3 deletions.
  1. +29 −3 slides.js
View
@@ -3,7 +3,7 @@
Authors: Luke Mahé (code)
Marcin Wichary (code and design)
-
+
Dominic Mazzoni (browser compatibility)
Charles Chen (ChromeVox support)
@@ -601,7 +601,33 @@ function handleDomLoaded() {
function initialize() {
getCurSlideFromHash();
- document.addEventListener('DOMContentLoaded', handleDomLoaded, false);
+ if (window['_DEBUG']) {
+ PERMANENT_URL_PREFIX = '../';
+ }
+
+ if (window['_DCL']) {
+ handleDomLoaded();
+ } else {
+ document.addEventListener('DOMContentLoaded', handleDomLoaded, false);
+ }
}
-initialize();
+// If ?debug exists then load the script relative instead of absolute
+if (!window['_DEBUG'] && document.location.href.indexOf('?debug') !== -1) {
+ document.addEventListener('DOMContentLoaded', function() {
+ // Avoid missing the DomContentLoaded event
+ window['_DCL'] = true
+ }, false);
+
+ window['_DEBUG'] = true;
+ var script = document.createElement('script');
+ script.type = 'text/javascript';
+ script.src = '../slides.js';
+ var s = document.getElementsByTagName('script')[0];
+ s.parentNode.insertBefore(script, s);
+
+ // Remove this script
+ s.parentNode.removeChild(s);
+} else {
+ initialize();
+}

0 comments on commit af22898

Please sign in to comment.