Skip to content

Commit

Permalink
Adding the ability to debug locally
Browse files Browse the repository at this point in the history
  • Loading branch information
lukem@google.com committed May 20, 2011
1 parent 6e29dc5 commit 7c1b62d
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions slides.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Authors: Luke Mahé (code)
Marcin Wichary (code and design)
Dominic Mazzoni (browser compatibility)
Charles Chen (ChromeVox support)
Expand Down Expand Up @@ -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 7c1b62d

Please sign in to comment.