@@ -433,6 +433,30 @@ function populateTogetherJsShareUrl() {
433433 ' ) ;
434434 $ ( "#togetherjsURL" ) . val ( urlToShare ) . attr ( 'size' , urlToShare . length + 20 ) ;
435435 $ ( "#syncBtn" ) . click ( requestSync ) ;
436+
437+ // append post shared session survey
438+ $ ( "#togetherjsStatus" ) . append ( postSessionSurvey ) ;
439+ $ ( '.star-rating :radio' ) . change ( function ( ) {
440+ if ( TogetherJS . running ) {
441+ TogetherJS . send ( { type : "surveyHowUsefulStars" ,
442+ stars : Number ( this . value ) } ) ;
443+ }
444+ } ) ;
445+
446+ $ ( '#submitSessionSurveyBtn' ) . click ( function ( ) {
447+ var resp = $ ( '#sharedSessionWhatLearned' ) . val ( ) ;
448+ if ( TogetherJS . running && resp ) {
449+ TogetherJS . send ( { type : "surveyFreetextQuestion" ,
450+ question : "What did you just learn?" ,
451+ answer : $ ( '#sharedSessionWhatLearned' ) . val ( ) } ) ;
452+
453+ $ ( "#sharedSessionWhatLearned" ) . val ( '' ) ;
454+ $ ( "#sharedSessionWhatLearnedThanks" ) . show ( ) ;
455+ $ . doTimeout ( 'sharedSessionWhatLearnedThanksFadeOut' , 1000 , function ( ) {
456+ $ ( "#sharedSessionWhatLearnedThanks" ) . fadeOut ( 2000 ) ;
457+ } ) ;
458+ }
459+ } ) ;
436460}
437461
438462// END - shared session stuff
@@ -1049,3 +1073,22 @@ function getSurveyObject() {
10491073
10501074 return ret ;
10511075}
1076+
1077+
1078+ // survey for shared sessions, deployed on 2014-06-06
1079+ var postSessionSurvey = '\n\
1080+ <div id="postSessionSurveyDiv" style="border: 1px solid #BE554E; padding: 5px; margin-top: 5px; line-height: 175%;">\n\
1081+ <span style="font-size: 8pt; color: #666;">Support our research by giving anonymous feedback before ending your session.</span><br/>\n\
1082+ How useful was this particular session? (click star to rate)\n\
1083+ <span class="star-rating togetherjsIgnore">\n\
1084+ <input type="radio" class="togetherjsIgnore" name="rating" value="1"/><i></i>\n\
1085+ <input type="radio" class="togetherjsIgnore" name="rating" value="2"/><i></i>\n\
1086+ <input type="radio" class="togetherjsIgnore" name="rating" value="3"/><i></i>\n\
1087+ <input type="radio" class="togetherjsIgnore" name="rating" value="4"/><i></i>\n\
1088+ <input type="radio" class="togetherjsIgnore" name="rating" value="5"/><i></i>\n\
1089+ </span>\n\
1090+ <br/>\
1091+ What did you just learn? <input type="text" id="sharedSessionWhatLearned" class="surveyQ togetherjsIgnore" size=60 maxlength=140/>\n\
1092+ <button id="submitSessionSurveyBtn" type="button" style="font-size: 8pt;">Submit</button>\n\
1093+ <span id="sharedSessionWhatLearnedThanks" style="color: #e93f34; font-weight: bold; font-size: 10pt; display: none;">Thanks!</span>\n\
1094+ </div>'
0 commit comments