Skip to content

Commit f95184a

Browse files
committed
move around survey code
1 parent 39e7e89 commit f95184a

2 files changed

Lines changed: 51 additions & 49 deletions

File tree

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

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,57 @@ function genericOptFrontendReady() {
665665
$("#embedLinkDiv").hide();
666666
$("#executeBtn").attr('disabled', false);
667667
$("#executeBtn").click(executeCodeFromScratch);
668+
669+
670+
// for survey-related stuff
671+
// Version 1 - started experiment on 2014-04-09, put on hold on 2014-05-02
672+
/*
673+
$('.surveyBtn').click(function(e) {
674+
// wow, massive copy-and-paste action from above!
675+
var myArgs = getAppState();
676+
677+
var buttonPrompt = $(this).html();
678+
var res = prompt('"' + buttonPrompt + '"' + '\nPlease elaborate if you can and hit OK to submit:');
679+
// don't do ajax call when Cancel button is pressed
680+
// (note that if OK button is pressed with no response, then an
681+
// empty string will still be sent to the server
682+
if (res !== null) {
683+
myArgs.surveyQuestion = buttonPrompt;
684+
myArgs.surveyResponse = res;
685+
$.get('survey.py', myArgs, function(dat) {});
686+
}
687+
});
688+
*/
689+
690+
// Version 2 - started running on 2014-05-24
691+
$('#iJustLearnedSubmission').click(function(e) {
692+
var resp = $("#iJustLearnedInput").val();
693+
694+
if (!$.trim(resp)) {
695+
return;
696+
}
697+
698+
// wow, massive copy-and-paste action from above!
699+
var myArgs = getAppState();
700+
701+
// myArgs.surveyQuestion = "I just learned that ..."; // retired on 2014-06-04
702+
myArgs.surveyQuestion = "What did you just learn?";
703+
myArgs.surveyResponse = resp;
704+
myArgs.surveyVersion = 'v2';
705+
706+
// 2014-05-25: implemented more detailed tracing for surveys
707+
if (myVisualizer) {
708+
myArgs.updateHistoryJSON = JSON.stringify(myVisualizer.updateHistory);
709+
}
710+
711+
$.get('survey.py', myArgs, function(dat) {});
712+
713+
$("#iJustLearnedInput").val('');
714+
$("#iJustLearnedThanks").show();
715+
$.doTimeout('iJustLearnedThanksFadeOut', 1200, function() {
716+
$("#iJustLearnedThanks").fadeOut(1000);
717+
});
718+
});
668719
}
669720

670721

‎v3/js/opt-frontend.js‎

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -480,54 +480,5 @@ $(document).ready(function() {
480480
$('#embedCodeOutput').val(iframeStr);
481481
});
482482

483-
484-
// for survey-related stuff
485-
// Version 1 - started experiment on 2014-04-09, put on hold on 2014-05-02
486-
$('.surveyBtn').click(function(e) {
487-
// wow, massive copy-and-paste action from above!
488-
var myArgs = getAppState();
489-
490-
var buttonPrompt = $(this).html();
491-
var res = prompt('"' + buttonPrompt + '"' + '\nPlease elaborate if you can and hit OK to submit:');
492-
// don't do ajax call when Cancel button is pressed
493-
// (note that if OK button is pressed with no response, then an
494-
// empty string will still be sent to the server
495-
if (res !== null) {
496-
myArgs.surveyQuestion = buttonPrompt;
497-
myArgs.surveyResponse = res;
498-
$.get('survey.py', myArgs, function(dat) {});
499-
}
500-
});
501-
502-
// Version 2 - started running on 2014-05-24
503-
$('#iJustLearnedSubmission').click(function(e) {
504-
var resp = $("#iJustLearnedInput").val();
505-
506-
if (!$.trim(resp)) {
507-
return;
508-
}
509-
510-
// wow, massive copy-and-paste action from above!
511-
var myArgs = getAppState();
512-
513-
// myArgs.surveyQuestion = "I just learned that ..."; // retired on 2014-06-04
514-
myArgs.surveyQuestion = "What did you just learn?";
515-
myArgs.surveyResponse = resp;
516-
myArgs.surveyVersion = 'v2';
517-
518-
// 2014-05-25: implemented more detailed tracing for surveys
519-
if (myVisualizer) {
520-
myArgs.updateHistoryJSON = JSON.stringify(myVisualizer.updateHistory);
521-
}
522-
523-
$.get('survey.py', myArgs, function(dat) {});
524-
525-
$("#iJustLearnedInput").val('');
526-
$("#iJustLearnedThanks").show();
527-
$.doTimeout('iJustLearnedThanksFadeOut', 1200, function() {
528-
$("#iJustLearnedThanks").fadeOut(1000);
529-
});
530-
});
531-
532483
genericOptFrontendReady(); // initialize at the end
533484
});

0 commit comments

Comments
 (0)