init
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
/**
|
||||
* @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
Joomla = window.Joomla || {};
|
||||
|
||||
(function (Joomla, document) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* USED IN: libraries/joomla/html/toolbar/button/help.php
|
||||
*
|
||||
* Pops up a new window in the middle of the screen
|
||||
*
|
||||
* @param {string} mypage The URL for the redirect
|
||||
* @param {string} myname The name of the page
|
||||
* @param {int} w The width of the new window
|
||||
* @param {int} h The height of the new window
|
||||
* @param {string} scroll The vertical/horizontal scroll bars
|
||||
*
|
||||
* @since 4.0.0
|
||||
*
|
||||
* @deprecated 4.3 will be removed in 7.0
|
||||
* Will be removed without replacement. Use browser native call instead
|
||||
*/
|
||||
Joomla.popupWindow = function (mypage, myname, w, h, scroll) {
|
||||
const winl = (screen.width - w) / 2;
|
||||
const wint = (screen.height - h) / 2;
|
||||
const winprops = `height=${h},width=${w},top=${wint},left=${winl},scrollbars=${scroll},resizable`;
|
||||
|
||||
window.open(mypage, myname, winprops).window.focus();
|
||||
};
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
/**
|
||||
* Fix the alignment of the Options and Help toolbar buttons
|
||||
*/
|
||||
const toolbarOptions = document.getElementById('toolbar-options');
|
||||
const toolbarHelp = document.getElementById('toolbar-help');
|
||||
const toolbarInlineHelp = document.getElementById('toolbar-inlinehelp');
|
||||
|
||||
// Handle Help buttons
|
||||
document.querySelectorAll('.js-toolbar-help-btn').forEach((button) => {
|
||||
button.addEventListener('click', (event) => {
|
||||
const btn = event.currentTarget;
|
||||
const winprops = `height=${parseInt(btn.dataset.height, 10)},width=${parseInt(btn.dataset.width, 10)},top=${(window.innerHeight - parseInt(btn.dataset.height, 10)) / 2},`
|
||||
+ `left=${(window.innerWidth - parseInt(btn.dataset.width, 10)) / 2},scrollbars=${btn.dataset.width === 'true'},resizable`;
|
||||
|
||||
window.open(btn.dataset.url, btn.dataset.tile, winprops).window.focus();
|
||||
});
|
||||
});
|
||||
|
||||
if (toolbarInlineHelp) {
|
||||
toolbarInlineHelp.classList.add('ms-auto');
|
||||
return;
|
||||
}
|
||||
|
||||
if (toolbarHelp && !toolbarOptions) {
|
||||
toolbarHelp.classList.add('ms-auto');
|
||||
}
|
||||
|
||||
if (toolbarOptions && !toolbarHelp) {
|
||||
toolbarOptions.classList.add('ms-auto');
|
||||
}
|
||||
});
|
||||
}(Joomla, document));
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/Joomla=window.Joomla||{},(function(r,e){"use strict";r.popupWindow=function(o,n,s,i,a){const t=(screen.width-s)/2,l=(screen.height-i)/2,d=`height=${i},width=${s},top=${l},left=${t},scrollbars=${a},resizable`;window.open(o,n,d).window.focus()},e.addEventListener("DOMContentLoaded",()=>{const o=e.getElementById("toolbar-options"),n=e.getElementById("toolbar-help"),s=e.getElementById("toolbar-inlinehelp");if(e.querySelectorAll(".js-toolbar-help-btn").forEach(i=>{i.addEventListener("click",a=>{const t=a.currentTarget,l=`height=${parseInt(t.dataset.height,10)},width=${parseInt(t.dataset.width,10)},top=${(window.innerHeight-parseInt(t.dataset.height,10))/2},left=${(window.innerWidth-parseInt(t.dataset.width,10))/2},scrollbars=${t.dataset.width==="true"},resizable`;window.open(t.dataset.url,t.dataset.tile,l).window.focus()})}),s){s.classList.add("ms-auto");return}n&&!o&&n.classList.add("ms-auto"),o&&!n&&o.classList.add("ms-auto")})})(Joomla,document);
|
||||
Binary file not shown.
Reference in New Issue
Block a user