Last active
April 6, 2018 12:59
-
-
Save yangshun/95821bcfd4b4777e90b5 to your computer and use it in GitHub Desktop.
For sharing your Coursera quiz answers with your friends
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Steps to share Coursera Quiz answers | |
// ===== | |
// 1. Open the web developer console. In Chrome, press ctrl/cmd + shift + J, in Firefox, press ctrl/cmd + shift + K | |
// 2. Copy the following code below and paste it in the console. Press enter. | |
// 3. Your answers will be printed out and you can share it with other people (: | |
// | |
(function () { | |
var answer = '\n'; | |
$('.course-quiz-question-body').each(function (index) { | |
var $this = $(this); | |
answer += 'Q' + (index + 1) + '. ' + $this.children('.course-quiz-question-text').text() + '\n'; | |
var $inputs = $this.find('.course-quiz-input'); | |
var $choices = $inputs.filter(function () { | |
return $(this).prop('checked'); | |
}); | |
var choicesText = []; | |
if ($choices.length > 0) { | |
var $choicesText = $.each($choices, function () { | |
choicesText.push(' - ' + $.trim($(this).siblings('label').text())); | |
}); | |
choicesText.sort(); | |
} else { | |
choicesText.push(' No choices selected'); | |
} | |
answer += choicesText.join('\n') + '\n\n'; | |
}); | |
console.log(answer); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how do i get my robotics course answers.