Skip to content

Commit

Permalink
Merge branch 'develop' of github.ugent.be:Scriptingtalen/dodona into …
Browse files Browse the repository at this point in the history
…develop
  • Loading branch information
bmesuere committed Jun 7, 2016
2 parents cd58505 + 9ef28ef commit 6de8fb2
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 16 deletions.
11 changes: 9 additions & 2 deletions app/assets/javascripts/exercise.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ function init_exercise_show(exerciseId, loggedIn, tests) {

centerImagesAndTables();


// create feedback table
var feedbackTable = new FeedbackTable(tests);
$("#feedback-loading").hide();


// test source code if button is clicked on editor panel
$("#editor-process-btn").click(function () {
// test submitted source code
Expand All @@ -34,8 +36,6 @@ function init_exercise_show(exerciseId, loggedIn, tests) {
$('#exercise-feedback-link').tab('show');
});

MathJax.Hub.Typeset();

// hide/show correct test cases if button is clicked in menu on feedback
// panel
$("#feedback-menu-toggle-correct").click(function () {
Expand All @@ -51,6 +51,13 @@ function init_exercise_show(exerciseId, loggedIn, tests) {
$(this).dropdown('toggle');
return false;
});

MathJax.Hub.Queue(function() {
/* MathJax has not been run yet*/
if ($('span.MathJax').length === 0) {
MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
}
});
}

function initEditor() {
Expand Down
57 changes: 43 additions & 14 deletions vendor/assets/javascripts/strip/strip.pkgd.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -765,23 +765,52 @@ function initStrip() {
d = this.view && this.view.options.onShow;
"function" == $.type(d) && d.call(Strip);

/* MathJax in caption */
/* BEGIN MathJax in caption */

function _resize(element) {
var e = Window.resize(element[c], function() {
--b < 1 && a()
}, e);
return e;
}

var numberMathJax = 0;
if (typeof MathJax !== 'undefined') {
MathJax.Hub.Queue(["Typeset", MathJax.Hub, "div.strp-caption"]);
MathJax.Hub.Queue(function() {
$("div.strp-caption div.MathJax_Display").each(function() {
$(this).contents().unwrap();
});
//force resize after mathjax is done
var a;
(a = Pages.page) && (a.animated || a.animatingWindow ? (a.fitToWindow(), a.show()) : (a.fitToWindow(), Window.resize(a.z, null, 0), Window.adjustPrevNext(null, !0)))

})

$('div.strp-caption').each(function() {
//There is math in this caption -> Typeset it
if ($(this).html().indexOf('$$') > -1) {
numberMathJax += 1;
MathJax.Hub.Queue(["Typeset", MathJax.Hub, $(this)[0]]);
}
});

parent = this;

/* Put Mathjax inline, but only when necessary */
if (numberMathJax > 0) {

MathJax.Hub.Queue(function() {
$("div.strp-caption div.MathJax_Display").each(function() {
$(this).contents().unwrap();
});
e = _resize(this);
//force explicit resize after mathjax is done
var a;
(a = Pages.page) && (a.animated || a.animatingWindow ? (a.fitToWindow(), a.show()) : (a.fitToWindow(), Window.resize(a.z, null, 0), Window.adjustPrevNext(null, !0)))
})

} else {
var e = _resize(this);
}


} else {
var e = _resize(this);
}

var e = Window.resize(this[c], function() {
--b < 1 && a()
}, e);
/* END MathJax in caption */

this._show(function() {
--b < 1 && a()
}, e), Window.adjustPrevNext(function() {
Expand Down

0 comments on commit 6de8fb2

Please sign in to comment.