!function(){"use strict";if(!window.Joomla)throw new Error("Joomla API was not properly initialised");document.addEventListener("DOMContentLoaded",(function e(){var o=Joomla.getOptions("system.paths"),t=Joomla.getOptions("com_scheduler.test-task.token"),a=(o?o.base+"/index.php":window.location.pathname)+"?option=com_ajax&format=json&plugin=RunSchedulerTest&group=system&id=%d"+(t?"&"+t+"=1":""),n=document.getElementById("scheduler-test-modal"),r='\n

'+Joomla.Text._("COM_SCHEDULER_TEST_RUN_TASK")+"

\n
"+Joomla.Text._("COM_SCHEDULER_TEST_RUN_STATUS_STARTED")+'
\n
\n ',d=function(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'").replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g,"$1
$2")};n.addEventListener("show.bs.modal",(function(e){var o=e.relatedTarget,t=parseInt(o.dataset.id,10),i=o.dataset.title;n.querySelector(".modal-title").innerHTML=Joomla.Text._("COM_SCHEDULER_TEST_RUN_TITLE").replace("%d",t.toString()),n.querySelector(".modal-body > div").innerHTML=r.replace("%s",i),Joomla.request({url:a.replace("%d",t.toString()),onSuccess:function(e,o){[].slice.call(n.querySelectorAll(".modal-body > div > div")).forEach((function(e){e.parentNode.removeChild(e)}));var t=JSON.parse(e);if(t&&t.success&&t.data){if(n.querySelector(".modal-body > div").innerHTML+="
"+Joomla.Text._("COM_SCHEDULER_TEST_RUN_STATUS_COMPLETED")+"
",t.data.duration>0&&(n.querySelector(".modal-body > div").innerHTML+="
"+Joomla.Text._("COM_SCHEDULER_TEST_RUN_DURATION").replace("%s",t.data.duration.toFixed(2))+"
"),t.data.output){var a=Joomla.sanitizeHtml(t.data.output,null,d);n.querySelector(".modal-body > div").innerHTML+="
"+Joomla.Text._("COM_SCHEDULER_TEST_RUN_OUTPUT").replace("%s",a)+"
"}}else n.querySelector(".modal-body > div").innerHTML+="
"+Joomla.Text._("COM_SCHEDULER_TEST_RUN_STATUS_TERMINATED")+"
",n.querySelector(".modal-body > div").innerHTML+="
"+Joomla.Text._("COM_SCHEDULER_TEST_RUN_OUTPUT").replace("%s",Joomla.Text._("JLIB_JS_AJAX_ERROR_OTHER").replace("%s",o.status))+"
"},onError:function(e){n.querySelector(".modal-body > div").innerHTML+="
"+Joomla.Text._("COM_SCHEDULER_TEST_RUN_STATUS_TERMINATED")+"
";var o=Joomla.ajaxErrorsMessages(e);n.querySelector(".modal-body > div").innerHTML+="
"+Joomla.Text._("COM_SCHEDULER_TEST_RUN_OUTPUT").replace("%s",o.error)+"
"}})})),n.addEventListener("hidden.bs.modal",(function(){window.location.href=(o?o.base+"/index.php":window.location.pathname)+"?option=com_scheduler&view=tasks"})),document.removeEventListener("DOMContentLoaded",e)}))}();