Skip to content

Commit e2c74bc

Browse files
authored
Merge pull request #649 from xronosuf/development (sage)
sage / Dutch-to-English
2 parents 88e32f8 + 85fb63f commit e2c74bc

2 files changed

Lines changed: 22 additions & 16 deletions

File tree

public/javascripts/math-answer.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,27 @@ var buttonlessTemplate = '<input class="form-control" type="text"/>';
1616
var template = '<div class="input-group" style="width:100%">' +
1717
'<input class="form-control answer-input-part" aria-label="answer" type="text"/>' +
1818
'<span class="input-group-btn answer-input-part">' +
19-
'<button class="px-0 btn btn-success btn-ximera-correct" data-toggle="tooltip" data-placement="top" title="Juist!" style="display: none; z-index: 1;" aria-label="juist" aria-live="assertive">' +
19+
'<button class="px-0 btn btn-success btn-ximera-correct" data-toggle="tooltip" data-placement="top" title="Correct!" style="display: none; z-index: 1;" aria-label="Correct" aria-live="polite">' +
2020
'<i class="fa fa-fw fa-check"></i>' +
2121
'</button>' +
22-
'<button class="px-0 btn btn-danger btn-ximera-incorrect" data-toggle="tooltip" data-placement="top" title="Fout. Probeer opnieuw!" style="display: none; z-index: 1;" aria-label="fout! probeer opnieuw" aria-live="assertive">' +
22+
'<button class="px-0 btn btn-danger btn-ximera-incorrect" data-toggle="tooltip" data-placement="top" title="Incorrect, try again!" style="display: none; z-index: 1;" aria-label="Incorrect, try again" aria-live="polite">' +
2323
'<i class="fa fa-fw fa-times"></i>' +
2424
'</button>' +
25-
'<button class="px-0 btn btn-primary disabled btn-ximera-checking" aria-label="aan het controleren" data-toggle="tooltip" data-placement="top" title="Controleren..." style="z-index: 1; display: none;">' +
25+
'<button class="px-0 btn btn-primary disabled btn-ximera-checking" aria-label="Checking" data-toggle="tooltip" data-placement="top" title="Check..." style="z-index: 1; display: none;">' +
2626
'<i class="fa fa-fw fa-spinner fa-spin"></i>' +
2727
'</button>' +
28-
'<button class="px-0 btn btn-primary btn-ximera-submit" aria-label="kijk na" data-toggle="tooltip" data-placement="top" title="Klik om je antwoord na te kijken." style="z-index: 1;">' +
28+
'<button class="px-0 btn btn-primary btn-ximera-submit" aria-label="Check" data-toggle="tooltip" data-placement="top" title="Click to check your answer." style="z-index: 1;">' +
2929
'<i class="fa fa-fw fa-question"></i>' +
3030
'</button>' +
3131
'</span>' +
3232
'<span class="input-group-btn show-answer-small">' +
33-
'<button class="px-0 btn btn-primary btn-info btn-ximera-show-answer" style="vertical-align:baseline" aria-label="Toon antwoord" data-toggle="tooltip" data-placement="top" title="Klik om het antwoord te tonen." style="z-index: 1;">' +
33+
'<button class="px-0 btn btn-primary btn-info btn-ximera-show-answer" style="vertical-align:baseline" aria-label="Show Answer" data-toggle="tooltip" data-placement="top" title="Click to Show Answer." style="z-index: 1;">' +
3434
'<i class="fa fa-fw fa-key"></i>' +
3535
'</button>' +
3636
'</span>' +
3737
'<span class="input-group-btn show-answer-large" style="width:100%">' +
38-
'<button class="px-0 btn btn-primary btn-info btn-ximera-show-answer" style="vertical-align:baseline; width:100%" aria-label="Toon antwoord" data-toggle="tooltip" data-placement="top" title="Klik om het antwoord te tonen." style="z-index: 1;">' +
39-
'<i class="fa fa-fw fa-key"></i><span class="show-answer-text">Toon Antwoord</span>' +
38+
'<button class="px-0 btn btn-primary btn-info btn-ximera-show-answer" style="vertical-align:baseline; width:100%" aria-label="Show Answer" data-toggle="tooltip" data-placement="top" title="Click to Show Answer." style="z-index: 1;">' +
39+
'<i class="fa fa-fw fa-key"></i><span class="show-answer-text">Show Answer</span>' +
4040
'</button>' +
4141
'</span>' +
4242
'</div>';
@@ -181,8 +181,8 @@ exports.connectMathAnswer = function(result, answer) {
181181
'<table class="table table-striped">' +
182182
'<thead>' +
183183
' <tr>' +
184-
' <th>Aantal</th>' +
185-
' <th>Antwoord</th>' +
184+
' <th>Number</th>' +
185+
' <th>Answer</th>' +
186186
' </tr>' +
187187
'</thead><tbody>';
188188

@@ -202,15 +202,15 @@ exports.connectMathAnswer = function(result, answer) {
202202
' <div class="modal-dialog">' +
203203
' <div class="modal-content">' +
204204
' <div class="modal-header">' +
205-
' <button type="button" class="close" data-dismiss="modal" aria-label="Sluit"><span aria-hidden="true">&times;</span></button>' +
206-
' <h4 class="modal-title">' + total + ' antwoorden</h4>' +
205+
' <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>' +
206+
' <h4 class="modal-title">' + total + ' Answers</h4>' +
207207
' </div>' +
208208
' <div class="modal-body">' +
209209
' ' + table +
210-
' <p>Bijkomende antwoorden: ' + additionalAnswers + '<p>' +
210+
' <p>Additional Answers: ' + additionalAnswers + '<p>' +
211211
' </div>' +
212212
' <div class="modal-footer">' +
213-
' <button type="button" class="btn btn-default" data-dismiss="modal">Sluit</button>' +
213+
' <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>' +
214214
' </div>' +
215215
' </div><!-- /.modal-content -->' +
216216
' </div><!-- /.modal-dialog -->' +
@@ -221,7 +221,7 @@ exports.connectMathAnswer = function(result, answer) {
221221
modal.find('button').click( function() { modal.modal('hide'); } );
222222

223223
result.find('span.input-group-btn').prepend(
224-
$('<button class="btn btn-info" data-toggle="tooltip" data-placement="top" title="' + total + ' antwoorden">' +
224+
$('<button class="btn btn-info" data-toggle="tooltip" data-placement="top" title="' + total + ' Answers">' +
225225
'<i class="fa fa-bar-chart"/>' +
226226
'</button>')
227227
);

public/javascripts/sagemath.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,14 @@ exports.createKernel = _.once(function() {
163163

164164
var d = document.createElement('div');
165165
window.sagecell.makeSagecell({inputLocation: d, linked: true});
166-
d.children[0].children[1].click();
167-
166+
// console.log(d);
167+
var observer = new MutationObserver(function(mutations, observer) {
168+
if (d.children && d.children[0] && d.children[0].children[1]) {
169+
d.children[0].children[1].click();
170+
observer.disconnect();
171+
}
172+
});
173+
observer.observe(d, { childList: true, subtree: true });
168174
// Make sage cells---but make them linked so there's just one kernel.
169175
window.sagecell.makeSagecell({"inputLocation": ".sage", linked: true});
170176
window.sagecell.makeSagecell({"inputLocation": ".sageOutput", "hide": ["editor","evalButton"], "autoeval": true, linked: true });

0 commit comments

Comments
 (0)