Files
Xes 73154ae174
Behat tests 1.11.x 🐞 / PHP 7.4 Test on ubuntu-latest (push) Canceled after 0s
PHP-CS-Fixer / composer_install (7.4) (push) Canceled after 0s
Chamilo 1.11.40 (ZIP oficial v1.11.40)
Fuente: https://github.com/chamilo/chamilo-lms/releases/download/v1.11.40/chamilo-1.11.40.zip
sha256: 1cf4bf2cc7bae1ef1a1eff643235db1d552f78ddf4b6dd1e2d2dac9868679439
Snapshot independiente (rama huerfana); diffable vs 1.11.38. vendor incluido.
2026-08-06 17:59:45 +02:00

71 lines
1.7 KiB
Smarty

<script>
/* For licensing terms, see /license.txt */
/*
* JS library to deal with event handlers.
* This script needs to be included from a script where the global include file has already been loaded.
* @package chamilo.inc.lib.javascript
* @author Yannick Warnier
* @author Julio Montoya - Adding twig support
*/
/*
* Assigns any event handler to any element
* @param object Element on which the event is added
* @param string Name of event
* @param string Function to trigger on event
* @param boolean Capture the event and prevent
*/
function addEvent(elm, evType, fn, useCapture) {
if (elm.addEventListener){
elm.addEventListener(evType, fn, useCapture);
return true;
} else if(elm.attachEvent) {
var r = elm.attachEvent('on' + evType, fn);
return r;
} else {
elm['on' + evType] = fn;
}
}
/*
* Adds the event listener
*/
function addListeners(e) {
var my_links = $('.clickable_email_link');
for(var i=0;i < my_links.length;i++) {
addEvent(my_links[i],'click',loadEmailEditor,false);
}
}
/*
* Loads a specific page on event triggering
*/
function loadEmailEditor(e) {
var el;
if(window.event && window.event.srcElement) {
el = window.event.srcElement;
}
if (e && e.target) {
el = e.target;
}
if(!el) {
return;
}
//el is now my link object, so I can get el.href here to load the new window
var link = el.href.replace('mailto:','');
document.location = "{{ _p.web_main }}inc/{{ email_editor }}?dest=" + link;
//cancel default link action
if (window.event && window.event.returnValue){
window.event.returnValue = false;
}
if(e && e.preventDefault){
e.preventDefault();
}
}
$(document).ready(function() {
addEvent(window,'load',addListeners,false);
});
</script>