@@ -67,6 +67,8 @@ var TogetherJSConfig_hubBase = "http://localhost:30035/"; // local
6767// can imagine other learners joining into the original session as well
6868var 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
134142function 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 }
0 commit comments