1 line
1.6 KiB
JavaScript
1 line
1.6 KiB
JavaScript
((e,t)=>{if(!t||"function"!=typeof t.Text._)throw new Error("core.js was not properly initialised");e.addEventListener("DOMContentLoaded",(()=>{e.getElementById("toolbar-load").addEventListener("click",(()=>{const r=e.getElementById("toolbar-load");if(!r.disabled){const o=e.querySelectorAll('input[id*="cb"]:checked');if(1===o.length){const e=`${r.childNodes[1].getAttribute("data-url")}&version_id=${o[0].value}`;window.parent&&e&&(window.parent.location=e)}else t.renderMessages({error:[t.Text._("COM_CONTENTHISTORY_BUTTON_SELECT_ONE_VERSION")]})}return!1})),e.getElementById("toolbar-preview").addEventListener("click",(()=>{const r=e.getElementById("toolbar-preview");if(!r.disabled){const o=["width=800, height=600, resizable=yes, scrollbars=yes"],n=e.querySelectorAll('input[id*="cb"]:checked');if(1===n.length){const e=`${r.childNodes[1].getAttribute("data-url")}&version_id=${n[0].value}`;window.parent&&e&&window.open(e,"",o.toString())}else t.renderMessages({error:[t.Text._("COM_CONTENTHISTORY_BUTTON_SELECT_ONE_VERSION")]})}return!1})),e.getElementById("toolbar-compare").addEventListener("click",(()=>{const r=e.getElementById("toolbar-compare");if(!r.disabled){const o=["width=1000, height=600, resizable=yes, scrollbars=yes"],n=e.querySelectorAll('input[id*="cb"]:checked');if(0===n.length)t.renderMessages({error:[t.Text._("JLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST")]});else if(2===n.length){const e=`${r.childNodes[1].getAttribute("data-url")}&id1=${n[0].value}&id2=${n[1].value}`;window.parent&&e&&window.open(e,"",o.toString())}else t.renderMessages({error:[t.Text._("COM_CONTENTHISTORY_BUTTON_SELECT_TWO_VERSIONS")]})}return!1}))}))})(document,Joomla); |