refactor: remove deprecated event observers and modal HTML
Cleanup of obsolete event observer functions and modal HTML code. This streamlines the codebase by eliminating unused PHP event observer definitions and redundant embedded modal HTML in JS file. Enhances maintainability and reduces potential overhead. No functionality should be directly impacted.
This commit is contained in:
parent
b58487ebb8
commit
762edec903
4 changed files with 1 additions and 53 deletions
0
README.md
Normal file
0
README.md
Normal file
|
@ -1,5 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
defined('MOODLE_INTERNAL') || die();
|
|
||||||
|
|
||||||
$observers = mod_exp360_get_event_observers();
|
|
23
global.js
23
global.js
|
@ -1,27 +1,4 @@
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
|
|
||||||
const modalHTML = `
|
|
||||||
<div id="fullScreenModal" class="modal" tabindex="-1"
|
|
||||||
aria-labelledby="modalLabel" aria-hidden="true">
|
|
||||||
<div style="background-color:#294084;" class="modal-dialog modal-fullscreen">
|
|
||||||
<div style="background-color:#294084;" class="modal-content">
|
|
||||||
<div style="background-color:#294084;" class="modal-body"><iframe style="background-color:#294084;" id="modal-iframe"></iframe></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="regularModal" style="background: rgb(255,255,255,.7);" class="modal" tabindex="-2"
|
|
||||||
aria-labelledby="modalLabel" aria-hidden="true">
|
|
||||||
<div style="background-color:#294084;height:90%;" class="modal-dialog modal-lg">
|
|
||||||
<div style="background-color:#294084;height:100%;" class="modal-content">
|
|
||||||
<div style="background-color:#294084;" class="modal-body"><iframe style="background-color:#294084;width:100%;height:100%;" id="regular-modal-iframe"></iframe></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
|
|
||||||
// Append the modal HTML to the document body
|
|
||||||
document.body.insertAdjacentHTML('beforeend', modalHTML);
|
|
||||||
|
|
||||||
// Function to load a script into the DOM
|
// Function to load a script into the DOM
|
||||||
function loadScript(url, integrity, crossorigin) {
|
function loadScript(url, integrity, crossorigin) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|
24
lib.php
24
lib.php
|
@ -58,27 +58,3 @@ function mod_exp360_cm_info_dynamic(cm_info $cm)
|
||||||
$cm->set_no_view_link();
|
$cm->set_no_view_link();
|
||||||
$cm->set_content($modals . $script);
|
$cm->set_content($modals . $script);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Event observer for mod_exp360.
|
|
||||||
*/
|
|
||||||
function mod_exp360_event_observer($event)
|
|
||||||
{
|
|
||||||
global $PAGE;
|
|
||||||
$PAGE->requires->js('/mod/exp360/global.js');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the list of event observers.
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
function mod_exp360_get_event_observers()
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
[
|
|
||||||
'eventname' => '\core\event\course_viewed',
|
|
||||||
'callback' => 'mod_exp360_event_observer',
|
|
||||||
],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue