2020-01-31 11:25:26 +01:00
|
|
|
this.Element && function(ElementPrototype) {
|
|
|
|
ElementPrototype.closest = ElementPrototype.closest ||
|
|
|
|
function(selector) {
|
|
|
|
var el = this;
|
|
|
|
while (el.matches && !el.matches(selector)) el = el.parentNode;
|
|
|
|
return el.matches ? el : null;
|
|
|
|
}
|
|
|
|
}(Element.prototype);
|
|
|
|
|
2020-01-31 15:07:39 +01:00
|
|
|
function openBackendHandler(event) {
|
2019-01-20 12:55:15 +01:00
|
|
|
event.preventDefault();
|
|
|
|
var element = event.target;
|
2020-01-31 11:25:26 +01:00
|
|
|
|
|
|
|
if (element.tagName !== 'A') {
|
2020-01-31 15:07:39 +01:00
|
|
|
element = element.closest('a.typo3-feedit-btn-openBackend');
|
2019-01-20 12:55:15 +01:00
|
|
|
}
|
2020-01-31 11:25:26 +01:00
|
|
|
|
2020-09-25 00:30:48 +02:00
|
|
|
var vHWin = window.open(element.getAttribute('data-backendScript'), element.getAttribute('data-t3BeSitenameMd5'), 'noopener=yes');
|
2020-01-31 11:25:26 +01:00
|
|
|
vHWin.focus();
|
2019-01-20 12:55:15 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-01-31 15:07:39 +01:00
|
|
|
function submitFormHandler(event) {
|
|
|
|
event.preventDefault();
|
|
|
|
var element = event.target;
|
|
|
|
|
|
|
|
if (element.tagName !== 'A') {
|
|
|
|
element = element.closest('a.typo3-feedit-btn-submitForm');
|
|
|
|
}
|
|
|
|
|
|
|
|
var execute = true;
|
|
|
|
var form = document[element.getAttribute('data-feedit-formname')];
|
|
|
|
var confirmText = element.getAttribute('data-feedit-confirm');
|
|
|
|
|
|
|
|
if (confirmText) {
|
|
|
|
execute = confirm(confirmText);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (execute) {
|
|
|
|
form.querySelector('.typo3-feedit-cmd').value = element.getAttribute('data-feedit-cmd');
|
|
|
|
form.submit();
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-01-20 12:55:15 +01:00
|
|
|
function initializeEditModule() {
|
2020-01-31 15:07:39 +01:00
|
|
|
var editModuleBtnsOpenBackend = document.querySelectorAll('.typo3-feedit-btn-openBackend');
|
2020-01-31 11:25:26 +01:00
|
|
|
for (var i = 0, len = editModuleBtnsOpenBackend.length; i < len; i++ ) {
|
2020-01-31 15:07:39 +01:00
|
|
|
editModuleBtnsOpenBackend[i].addEventListener('click', openBackendHandler);
|
2020-01-31 11:25:26 +01:00
|
|
|
}
|
2019-01-20 12:55:15 +01:00
|
|
|
|
2020-01-31 15:07:39 +01:00
|
|
|
var editModuleBtnsSubmitForm = document.querySelectorAll('.typo3-feedit-btn-submitForm');
|
|
|
|
for (var i = 0, len = editModuleBtnsSubmitForm.length; i < len; i++ ) {
|
|
|
|
editModuleBtnsSubmitForm[i].addEventListener('click', submitFormHandler);
|
|
|
|
}
|
|
|
|
}
|
2019-01-20 12:55:15 +01:00
|
|
|
|
|
|
|
window.addEventListener('load', initializeEditModule, false);
|