-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #67 from prasanna-lmsace/moodle_44_dev
Improvement: Update for Moodle 4.4 compatibility and improved MathJax support 1658984705
- Loading branch information
Showing
10 changed files
with
98 additions
and
43 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
define(["jquery", "core/ajax"], function ($, Ajax) { | ||
return { | ||
init: function () { | ||
$(document).ready(function () { | ||
// Initialise MathJax typesetting | ||
var nodes = Y.all(".latex-math"); | ||
Y.fire(M.core.event.FILTER_CONTENT_UPDATED, { nodes: nodes }); | ||
|
||
var waitForMathJax = setInterval(function () { | ||
try { | ||
if (MathJax) { | ||
MathJax.Hub.Queue(["Typeset", MathJax.Hub]); | ||
clearInterval(waitForMathJax); | ||
} | ||
} catch (e) { | ||
// MathJax has not yet been loaded. | ||
} | ||
}, 100); | ||
}); | ||
}, | ||
}; | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,56 @@ | ||
define(["jquery", "core/ajax"], function ($, Ajax) { | ||
return { | ||
init: function () { | ||
$(document).ready(function () { | ||
// Initialise MathJax typesetting | ||
var nodes = Y.all(".latex-math"); | ||
Y.fire(M.core.event.FILTER_CONTENT_UPDATED, { nodes: nodes }); | ||
|
||
var waitForMathJax = setInterval(function () { | ||
try { | ||
if (MathJax) { | ||
MathJax.Hub.Queue(["Typeset", MathJax.Hub]); | ||
clearInterval(waitForMathJax); | ||
define(["jquery", "core/ajax", "core_filters/events"], function ($, Ajax, FilterEvents) { | ||
|
||
// Selectors and other strings defined here. | ||
const SELECTORS = { | ||
root: '.monassis', | ||
mathEquation: '.latex-math', | ||
questionContent: '.question-content', | ||
classes: { | ||
filterMathjax: 'filter_mathjaxloader_equation' | ||
} | ||
}; | ||
|
||
// Parent element of the questions. | ||
const root = document.querySelector(SELECTORS.root); | ||
|
||
const mathJaxFilterByEvents = function() { | ||
|
||
/** | ||
* Update the equations by mathjax filter. | ||
*/ | ||
function updateMathJax() { | ||
|
||
if (root.querySelector(SELECTORS.questionContent) === null) { | ||
return false; | ||
} | ||
|
||
// Initialise MathJax typesetting. | ||
root.querySelector(SELECTORS.questionContent).classList.add(SELECTORS.classes.filterMathjax); | ||
// Notifiy the siyavula filtered content are updated. | ||
FilterEvents.notifyFilterContentUpdated(document.querySelectorAll(SELECTORS.root)); | ||
|
||
return true; | ||
|
||
} | ||
|
||
// Update the equations, if the content loaded before JS initiated. | ||
var waitForMathJax = setInterval(function() { | ||
try { | ||
if (window.MathJax && updateMathJax()) { | ||
window.MathJax.Hub.Queue(["Typeset", window.MathJax.Hub]); | ||
clearInterval(waitForMathJax); | ||
} | ||
} catch (e) { | ||
// MathJax has not yet been loaded. | ||
} | ||
} catch (e) { | ||
// MathJax has not yet been loaded. | ||
} | ||
}, 100); | ||
}); | ||
}, | ||
}; | ||
|
||
}; | ||
|
||
return { | ||
|
||
init: function () { | ||
mathJaxFilterByEvents(); | ||
}, | ||
}; | ||
}); |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,4 +21,4 @@ | |
|
||
form#form_test_token{ | ||
padding-top: 60px; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<?php | ||
|
||
defined('MOODLE_INTERNAL') || die(); | ||
$plugin->version = 2023121300; // The current plugin version (Date: YYYYMMDDXX) | ||
$plugin->version = 2023121301; // The current plugin version (Date: YYYYMMDDXX) | ||
$plugin->requires = 2019111809; // Requires this Moodle version | ||
$plugin->component = 'filter_siyavula'; // Full name of the plugin (used for diagnostics) | ||
$plugin->maturity = MATURITY_STABLE; |