-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathjquery in moodle.html
25 lines (21 loc) · 1.11 KB
/
jquery in moodle.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<!-- jQuery in Moodle v.3.1 - Copyright (C) 2021, TRMSC - https://trmsc1.wordpress.com/ -->
<!-- GNU General Public Licence 3.0 - http://www.gnu.de/documents/gpl-3.0.en.html -->
<!-- Thanks to Norman Seeliger (Twitter: @nseelinger1) for great help! -->
<script>
window.addEventListener( 'load', function( event ) {
let jquery_load_check_interval = setInterval( function() {
if ( window.jQuery ) {
console.log( 'jQuery in Moodle: jQuery v.' + $.fn.jquery + ' loaded' );
console.log( 'jQuery in Moodle: v.3.1' );
functionname(); /* NAME OF YOUR FUNCTION INSTEAD OF 'FUNCTIONSNAME' (SAME AS BELOW!) */
clearInterval( jquery_load_check_interval );
} else {
console.log( 'jQuery in Moodle: new try to load jquery...' );
}
}, 150);
function functionname() { /* NAME OF YOUR FUNCTION INSTEAD OF 'FUNCTIONSNAME' (SAME AS ABOVE!) */
console.log( 'jQuery in Moodle: function started' );
/* HERE YOU CAN CODE JQUERY */
}
}, false );
</script>