From 6d765facf7dc304deb4f0c7d031efc9aa98e2f23 Mon Sep 17 00:00:00 2001 From: Remy Sharp Date: Wed, 18 Apr 2012 10:49:37 +0100 Subject: [PATCH] Remove alerts only during load - put them back in to allow user to interact and get alerts. Fixes #148 --- index.php | 3 +-- js/render/live.js | 9 ++++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/index.php b/index.php index 833b842672..0f2fece712 100644 --- a/index.php +++ b/index.php @@ -132,8 +132,7 @@ Output - +Include alerts, prompts & confirm boxes">Run JS with alerts diff --git a/js/render/live.js b/js/render/live.js index ca06cfd84a..7ac1b99d65 100644 --- a/js/render/live.js +++ b/js/render/live.js @@ -1,7 +1,9 @@ var $live = $('#live'), $body = $('body'), showlive = $('#showlive')[0], - throttledPreview = throttle(renderLivePreview, 200); + throttledPreview = throttle(renderLivePreview, 200), + killAlerts = '', + restoreAlerts = ''; var iframedelay = (function () { var iframedelay = { active : false }, @@ -69,9 +71,9 @@ function renderLivePreview(withalerts) { // nullify the blocking functions // IE requires that this is done in the script, rather than off the window object outside of the doc.write if (withalerts !== true) { - doc.write(''); + doc.write(killAlerts); } else { - doc.write(''); + doc.write(restoreAlerts); } if (jsbinConsole) { @@ -101,6 +103,7 @@ function renderLivePreview(withalerts) { }; doc.write(source); + doc.write(restoreAlerts); } doc.close(); delete jsbin.panels.panels.live.doc;