Sindbad~EG File Manager
/**
* Module javascript to place the placeholders.
* Modified version of IOMAD Email template emailvars.
*
* @module mod_pulse/module
* @category Classes - autoloading
* @copyright 2021, bdecent gmbh bdecent.de
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define("mod_pulse/module",[],(function(){return{init:function(){for(var module=this,templatevars=document.getElementsByClassName("fitem_id_templatevars_editor"),l=0;l<templatevars.length;l++)templatevars[l].addEventListener("click",(function(){var EditorInput=document.getElementById("id_pulse_content_editoreditable");module.insertCaretActive(EditorInput)}));var notificationheader=document.getElementById("admin-notificationheader");null!==notificationheader&¬ificationheader.addEventListener("click",(function(){var EditorInput=document.getElementById("id_s_mod_pulse_notificationheadereditable");module.insertCaretActive(EditorInput)}));var notificationfooter=document.getElementById("admin-notificationfooter");null!==notificationfooter&¬ificationfooter.addEventListener("click",(function(){var EditorInput=document.getElementById("id_s_mod_pulse_notificationfootereditable");module.insertCaretActive(EditorInput)}));for(var clickforword=document.getElementsByClassName("clickforword"),i=0;i<clickforword.length;i++)clickforword[i].addEventListener("click",(function(e){e.preventDefault(),module.insertAtCaret("{"+this.getAttribute("data-text")+"}")}));if(null!==document.getElementById("page-mod-pulse-mod")&&null!==document.getElementById("page-mod-pulse-mod").querySelector("#fgroup_id_completionrequireapproval [data-fieldtype='autocomplete']")){this.getAllTextNodes(document.getElementById("page-mod-pulse-mod").querySelector("#fgroup_id_completionrequireapproval [data-fieldtype='autocomplete']")).forEach((node=>{const span=document.createElement("span");span.classList="badge badge-info pulse-completion-roles",node.after(span),span.appendChild(node)}))}},insertCaretActive:function(EditorInput){for(var caret=document.getElementsByClassName("insertatcaretactive"),j=0;j<caret.length;j++)caret[j].classList.remove("insertatcaretactive");EditorInput.classList.add("insertatcaretactive")},getAllTextNodes:function(element){return Array.from(element.childNodes).filter((node=>3===node.nodeType&&node.textContent.trim().length>1))},insertAtCaret:function(myValue){for(var sel,range,caretelements=document.getElementsByClassName("insertatcaretactive"),n=0;n<caretelements.length;n++){var thiselem=caretelements[n];if(void 0===thiselem.value&&window.getSelection){if((sel=window.getSelection()).getRangeAt&&sel.rangeCount){(range=sel.getRangeAt(0)).deleteContents(),range.insertNode(document.createTextNode(myValue));for(let position=0;position!=myValue.length+1;position++)sel.modify("move","right","character")}}else void 0===thiselem.value&&document.selection&&document.selection.createRange&&((range=document.selection.createRange()).text=myValue);if(void 0!==thiselem.value)if(document.selection)thiselem.focus(),(sel=document.selection.createRange()).text=myValue,thiselem.focus();else if(thiselem.selectionStart||"0"==thiselem.selectionStart){var startPos=thiselem.selectionStart,endPos=thiselem.selectionEnd;thiselem.value=thiselem.value.substring(0,startPos)+myValue+thiselem.value.substring(endPos,thiselem.value.length),thiselem.focus(),thiselem.selectionStart=startPos+myValue.length,thiselem.selectionEnd=startPos+myValue.length,thiselem.focus()}else thiselem.value+=myValue,thiselem.focus()}}}}));
//# sourceMappingURL=module.min.js.map
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists