mathjax and fade improvements

- remove the unnecessary processing delays mathjax defaults to
- use a separate fade time for question and answer
This commit is contained in:
Damien Elmes 2017-08-10 20:45:42 +10:00
parent 9af28b7159
commit c3415028b0
2 changed files with 12 additions and 5 deletions

View file

@ -6,5 +6,10 @@ window.MathJax = {
}, },
messageStyle: "none", messageStyle: "none",
skipStartupTypeset: true, skipStartupTypeset: true,
showMathMenu: false showMathMenu: false,
AuthorInit: function () {
MathJax.Hub.processSectionDelay = 0;
MathJax.Hub.processUpdateTime = 0;
MathJax.Hub.processUpdateDelay = 0;
}
}; };

View file

@ -1,8 +1,10 @@
var ankiPlatform = "desktop"; var ankiPlatform = "desktop";
var typeans; var typeans;
var fadeTime = 100;
function _updateQA(html, onupdate, onshown) { var qFade = 100;
var aFade = 0;
function _updateQA(html, fadeTime, onupdate, onshown) {
// fade out current text // fade out current text
var qa = $("#qa"); var qa = $("#qa");
qa.fadeTo(fadeTime, 0, function() { qa.fadeTo(fadeTime, 0, function() {
@ -27,7 +29,7 @@ function _updateQA(html, onupdate, onshown) {
} }
function _showQuestion(q, bodyclass) { function _showQuestion(q, bodyclass) {
_updateQA(q, function(obj) { _updateQA(q, qFade, function(obj) {
// return to top of window // return to top of window
window.scrollTo(0, 0); window.scrollTo(0, 0);
@ -42,7 +44,7 @@ function _showQuestion(q, bodyclass) {
} }
function _showAnswer(a, bodyclass) { function _showAnswer(a, bodyclass) {
_updateQA(a, function(obj) { _updateQA(a, aFade, function(obj) {
if (bodyclass) { if (bodyclass) {
// when previewing // when previewing
document.body.className = bodyclass; document.body.className = bodyclass;