Skip to content

Commit ee20512

Browse files
committed
added some stents
1 parent d71b246 commit ee20512

3 files changed

Lines changed: 35 additions & 11 deletions

File tree

v3/js/opt-frontend-common.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,9 +350,13 @@ function updateAppDisplay(newAppMode) {
350350
appMode = 'display'; // canonicalize
351351

352352
$("#pyInputPane").hide();
353-
$("#pyOutputPane,#surveyHeader").show();
353+
$("#pyOutputPane").show();
354354
$("#embedLinkDiv").show();
355355

356+
if (!(TogetherJS && TogetherJS.running)) {
357+
$("#surveyHeader").show();
358+
}
359+
356360
doneExecutingCode();
357361

358362
// do this AFTER making #pyOutputPane visible, or else

v3/js/opt-frontend.js

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ var TogetherJSConfig_hubBase = "http://localhost:30035/"; // local
6767
// can imagine other learners joining into the original session as well
6868
var isTutor = false;
6969

70+
var manuallySharingUrl = false; // TODO: refactor
71+
7072
// TODO: consider deferred initialization later: "TogetherJS starts up
7173
// automatically as soon as it can, especially when continuing a
7274
// session. Sometimes this is problematic, like an application that
@@ -130,6 +132,12 @@ var TogetherJSConfig_getUserName = function () {
130132
}
131133
}
132134

135+
// temporary stent:
136+
function startSharedSession() {
137+
manuallySharingUrl = true; // icky global!
138+
TogetherJS();
139+
}
140+
133141
// get this app ready for TogetherJS
134142
function initTogetherJS() {
135143
if (isTutor) {
@@ -400,10 +408,9 @@ function initTogetherJS() {
400408

401409
if (dat.helpAvailable) {
402410
$("#togetherJSHeader").fadeIn(750, redrawConnectors);
403-
$("#surveyHeader").remove(); // kill this to save space
404411
}
405412
else {
406-
if (TogetherJS.running) {
413+
if (TogetherJS.running && !manuallySharingUrl) {
407414
alert("No more live tutors are available now.\nPlease check back later.");
408415
TogetherJS(); // toggle off
409416
}
@@ -427,6 +434,8 @@ function initTogetherJS() {
427434
console.log("TogetherJS ready");
428435
$("#togetherBtn").html("Stop live help session");
429436

437+
$("#surveyHeader").hide();
438+
430439
$("#helpQueueUrls").fadeIn(500);
431440

432441
$("#togetherJSHeader").fadeIn(750, redrawConnectors); // always show when ready
@@ -437,10 +446,15 @@ function initTogetherJS() {
437446
requestSync();
438447
}
439448
else {
440-
// if you're a learner, request help when TogetherJS is activated
441-
$.get(TogetherJSConfig_hubBase + 'request-help',
442-
{url: TogetherJS.shareUrl(), id: TogetherJS.shareId()},
443-
null /* don't use a callback; rely on SSE */);
449+
if (manuallySharingUrl) {
450+
console.log('URL TO SHARE', TogetherJS.shareUrl() + '&role=tutor&share=manual');
451+
}
452+
else {
453+
// if you're a learner, request help when TogetherJS is activated
454+
$.get(TogetherJSConfig_hubBase + 'request-help',
455+
{url: TogetherJS.shareUrl(), id: TogetherJS.shareId()},
456+
null /* don't use a callback; rely on SSE */);
457+
}
444458

445459
// also log the learner's initial state when they first requested help
446460
TogetherJS.send({type: "initialAppState", myAppState: getAppState()});
@@ -453,6 +467,10 @@ function initTogetherJS() {
453467
TogetherJS.on("close", function () {
454468
console.log("TogetherJS close");
455469

470+
if (appMode == "display") {
471+
$("#surveyHeader").show();
472+
}
473+
456474
$("#helpQueueUrls").fadeOut(500);
457475

458476
if (isTutor) {
@@ -578,6 +596,8 @@ $(document).ready(function() {
578596
var role = $.bbq.getState('role');
579597
isTutor = (role == 'tutor'); // GLOBAL
580598

599+
manuallySharingUrl = ($.bbq.getState('share') == 'manual'); // GLOBAL
600+
581601
if (enableTogetherJS || isTutor) {
582602
initTogetherJS();
583603
}

v3/visualize.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
<body>
7575

7676
<!-- hide by default -->
77-
<div id="togetherJSHeader" style="margin-top: 12pt; margin-bottom: 10pt; display: none;">
77+
<div id="togetherJSHeader" style="margin-top: 12pt; margin-bottom: 12pt; display: none;">
7878
<button id="togetherBtn" type="button"
7979
style="color: #b80000; font-size: 12pt; padding: 6px;
8080
margin-right: 5pt;">Chat with a tutor (experimental)</button>
@@ -105,7 +105,7 @@
105105
// Version 2 of my display-mode survey, greatly simplified and deployed on 2014-05-24
106106
-->
107107

108-
<div id="surveyHeader" style="margin-left: 70px; margin-bottom: 20pt; display: none;">
108+
<div id="surveyHeader" style="margin-left: 70px; margin-bottom: 10pt; display: none;">
109109
<div id="vizSurveyLabel" style="font-size: 8pt; color: #666; margin-bottom: 8pt;">
110110
<!-- 2014-05-25 tagline -->
111111
Help future learners by writing about what you are learning.
@@ -116,9 +116,9 @@
116116
something new from the visualization:
117117
-->
118118
</div>
119-
<div style="font-size: 11pt; margin-bottom: 5pt; padding: 1pt;">
119+
<div style="font-size: 10pt; margin-bottom: 5pt; padding: 1pt;">
120120
I just learned that
121-
<input style="font-size: 11pt; padding: 1pt;" type="text" id="iJustLearnedInput" size="75"/>
121+
<input style="font-size: 10pt; padding: 1pt;" type="text" id="iJustLearnedInput" size="75"/>
122122

123123
<button id="iJustLearnedSubmission" type="button" style="font-size: 12pt;">Submit</button>
124124

0 commit comments

Comments
 (0)