Skip to content

Commit 3e1386d

Browse files
committed
minor fixes for URL sharing in live editor
1 parent 012296e commit 3e1386d

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

‎v3/js/opt-frontend-common.js‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,9 +1273,13 @@ function updateAppDisplay(newAppMode) {
12731273
var myArgs = getAppState();
12741274
var urlStr = $.param.fragment('live.html', myArgs, 2 /* clobber all */);
12751275
$("#pyOutputPane #liveModeSpan").show();
1276-
$('#pyOutputPane #editLiveModeBtn')
1277-
.attr('href', urlStr)
1278-
.attr('target', '_blank');
1276+
$('#pyOutputPane #editLiveModeBtn').click(function() {
1277+
var myArgs = getAppState();
1278+
var urlStr = $.param.fragment('live.html', myArgs, 2 /* clobber all */);
1279+
window.open(urlStr); // open in new tab
1280+
1281+
return false; // to prevent default "a href" click action
1282+
});
12791283
} else {
12801284
$("#pyOutputPane #liveModeSpan").hide();
12811285
}

‎v3/js/opt-frontend.js‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,6 @@ $(document).ready(function() {
712712
$("#liveModeBtn").click(function() {
713713
var myArgs = getAppState();
714714
var urlStr = $.param.fragment('live.html', myArgs, 2 /* clobber all */);
715-
//window.location = urlStr; // open in same tab
716-
window.open(urlStr); // open in new tab (TODO: what about pop-up blockers?)
715+
window.open(urlStr); // open in new tab
717716
});
718717
});

‎v3/js/pytutor.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ ExecutionVisualizer.prototype.render = function() {
414414
<div id="langDisplayDiv"></div>\
415415
<div id="pyCodeOutputDiv"/>\
416416
<div id="editCodeLinkDiv"><a id="editBtn">Edit code</a>\
417-
<span id="liveModeSpan" style="display: none;">| <a id="editLiveModeBtn">Live programming</a></a>\
417+
<span id="liveModeSpan" style="display: none;">| <a id="editLiveModeBtn" href="#">Live programming</a></a>\
418418
</div>\
419419
<div id="legendDiv"/>\
420420
<div id="executionSliderDocs"><font color="#e93f34">NEW!</font> Click on a line of code to set a <b>breakpoint</b> where you want to jump. Then use the <b>Left</b> and <b>Right</b> arrow keys and the Back and Forward buttons to jump there.</div>\

0 commit comments

Comments
 (0)