Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Adding the ability to debug locally

git-svn-id: http://html5slides.googlecode.com/svn/trunk@16 5963eb91-a1a4-c111-6e9c-cdd99a89fa83
  • Loading branch information...
commit af22898ae8ba3682c7c78c830efaa5685af53946 1 parent 5f74aad
authored May 20, 2011

Showing 1 changed file with 29 additions and 3 deletions. Show diff stats Hide diff stats

  1. 32  slides.js
32  slides.js
@@ -3,7 +3,7 @@
3 3
 
4 4
   Authors: Luke Mahé (code)
5 5
            Marcin Wichary (code and design)
6  
-           
  6
+
7 7
            Dominic Mazzoni (browser compatibility)
8 8
            Charles Chen (ChromeVox support)
9 9
 
@@ -601,7 +601,33 @@ function handleDomLoaded() {
601 601
 function initialize() {
602 602
   getCurSlideFromHash();
603 603
 
604  
-  document.addEventListener('DOMContentLoaded', handleDomLoaded, false);
  604
+  if (window['_DEBUG']) {
  605
+    PERMANENT_URL_PREFIX = '../';
  606
+  }
  607
+
  608
+  if (window['_DCL']) {
  609
+    handleDomLoaded();
  610
+  } else {
  611
+    document.addEventListener('DOMContentLoaded', handleDomLoaded, false);
  612
+  }
605 613
 }
606 614
 
607  
-initialize();
  615
+// If ?debug exists then load the script relative instead of absolute
  616
+if (!window['_DEBUG'] && document.location.href.indexOf('?debug') !== -1) {
  617
+  document.addEventListener('DOMContentLoaded', function() {
  618
+    // Avoid missing the DomContentLoaded event
  619
+    window['_DCL'] = true
  620
+  }, false);
  621
+
  622
+  window['_DEBUG'] = true;
  623
+  var script = document.createElement('script');
  624
+  script.type = 'text/javascript';
  625
+  script.src = '../slides.js';
  626
+  var s = document.getElementsByTagName('script')[0];
  627
+  s.parentNode.insertBefore(script, s);
  628
+
  629
+  // Remove this script
  630
+  s.parentNode.removeChild(s);
  631
+} else {
  632
+  initialize();
  633
+}

0 notes on commit af22898

Please sign in to comment.
Something went wrong with that request. Please try again.