Commit 117eef29 authored by Andreas Fernandez's avatar Andreas Fernandez Committed by Richard Haeser
Browse files

[TASK] Remove jQuery from most of EXT:filelist

With this change, most of the jQuery-based code is migrated to either
native APIs or substitutes provided by TYPO3.
The ContextMenu is not touched here as the base implementation heavily
relies on jQuery.

Resolves: #93164
Releases: master
Change-Id: Ie316837a00f1c497ef6028a46e1b00004ae4e09a
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/67246

Tested-by: Benjamin Franzke's avatarBenjamin Franzke <bfr@qbus.de>
Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Richard Haeser's avatarRichard Haeser <richard@richardhaeser.com>
Reviewed-by: Benjamin Franzke's avatarBenjamin Franzke <bfr@qbus.de>
Reviewed-by: Richard Haeser's avatarRichard Haeser <richard@richardhaeser.com>
parent 91d7b30d
......@@ -11,7 +11,7 @@
* The TYPO3 project - inspiring people to share!
*/
import $ from 'jquery';
import DocumentService = require('TYPO3/CMS/Core/DocumentService');
import Modal = require('TYPO3/CMS/Backend/Modal');
import RegularEvent = require('TYPO3/CMS/Core/Event/RegularEvent');
......@@ -26,7 +26,7 @@ class CreateFolder {
private changed: boolean = false;
constructor() {
$((): void => {
DocumentService.ready().then((): void => {
const mainElement: HTMLElement = document.querySelector('.filelist-create-folder-main');
if (!(mainElement instanceof HTMLElement)) {
throw new Error('Main element not found');
......
......@@ -12,7 +12,8 @@
*/
import {SeverityEnum} from 'TYPO3/CMS/Backend/Enum/Severity';
import $ from 'jquery';
import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent';
import DocumentService = require('TYPO3/CMS/Core/DocumentService');
import Modal = require('TYPO3/CMS/Backend/Modal');
/**
......@@ -21,21 +22,20 @@ import Modal = require('TYPO3/CMS/Backend/Modal');
*/
class FileDelete {
constructor() {
$((): void => {
$(document).on('click', '.t3js-filelist-delete', (e: JQueryEventObject): void => {
DocumentService.ready().then((): void => {
new RegularEvent('click', (e: Event, eventTarget: HTMLElement): void => {
e.preventDefault();
const $anchorElement = $(e.currentTarget);
let redirectUrl = $anchorElement.data('redirectUrl');
let redirectUrl = eventTarget.dataset.redirectUrl;
redirectUrl = (redirectUrl)
? encodeURIComponent(redirectUrl)
: encodeURIComponent(top.list_frame.document.location.pathname + top.list_frame.document.location.search);
const identifier = $anchorElement.data('identifier');
const deleteType = $anchorElement.data('deleteType');
const deleteUrl = $anchorElement.data('deleteUrl') + '&data[delete][0][data]=' + encodeURIComponent(identifier);
const identifier = eventTarget.dataset.identifier;
const deleteType = eventTarget.dataset.deleteType;
const deleteUrl = eventTarget.dataset.deleteUrl + '&data[delete][0][data]=' + encodeURIComponent(identifier);
const target = deleteUrl + '&data[delete][0][redirect]=' + redirectUrl;
if ($anchorElement.data('check')) {
const $modal = Modal.confirm($anchorElement.data('title'), $anchorElement.data('content'), SeverityEnum.warning, [
if (eventTarget.dataset.check) {
const $modal = Modal.confirm(eventTarget.dataset.title, eventTarget.dataset.content, SeverityEnum.warning, [
{
text: TYPO3.lang['buttons.confirm.delete_file.no'] || 'Cancel',
active: true,
......@@ -49,7 +49,7 @@ class FileDelete {
},
]);
$modal.on('button.clicked', (evt: JQueryEventObject): void => {
const $element = <HTMLInputElement>evt.target;
const $element = evt.target as HTMLInputElement;
const name = $element.name;
if (name === 'no') {
Modal.dismiss();
......@@ -61,7 +61,7 @@ class FileDelete {
} else {
top.list_frame.location.href = target;
}
});
}).delegateTo(document, '.t3js-filelist-delete');
});
}
}
......
......@@ -11,7 +11,7 @@
* The TYPO3 project - inspiring people to share!
*/
import $ from 'jquery';
import DocumentService = require('TYPO3/CMS/Core/DocumentService');
import InfoWindow = require('TYPO3/CMS/Backend/InfoWindow');
import {BroadcastMessage} from 'TYPO3/CMS/Backend/BroadcastMessage';
import {ModalResponseEvent} from 'TYPO3/CMS/Backend/ModalInterface';
......@@ -61,53 +61,58 @@ class Filelist {
}
private static submitClipboardFormWithCommand(cmd: string): void {
const $form = $('form[name="dblistForm"]');
$form.find('input[name="cmd"]').val(cmd);
$form.trigger('submit');
const form = document.querySelector('form[name="dblistForm"]') as HTMLFormElement
(form.querySelector('input[name="cmd"]') as HTMLInputElement).value = cmd;
form.submit();
}
constructor() {
Filelist.processTriggers();
$((): void => {
DocumentService.ready().then((): void => {
Filelist.registerTreeUpdateEvents();
// file index events
$('[data-filelist-show-item-identifier][data-filelist-show-item-type]').on('click', (evt: JQueryEventObject): void => {
const $element = $(evt.currentTarget);
evt.preventDefault();
new RegularEvent('click', (event: Event, target: HTMLElement): void => {
event.preventDefault();
Filelist.openInfoPopup(
$element.data('filelistShowItemType'),
$element.data('filelistShowItemIdentifier')
target.dataset.filelistShowItemType,
target.dataset.filelistShowItemIdentifier
);
});
}).delegateTo(document, '[data-filelist-show-item-identifier][data-filelist-show-item-type]');
// file search events
$('a.btn.filelist-file-info').on('click', (event: JQueryEventObject): void => {
new RegularEvent('click', (event: Event, target: HTMLElement): void => {
event.preventDefault();
Filelist.openInfoPopup('_FILE', $(event.currentTarget).attr('data-identifier'));
});
$('a.filelist-file-references').on('click', (event: JQueryEventObject): void => {
Filelist.openInfoPopup('_FILE', target.dataset.identifier);
}).delegateTo(document, 'a.btn.filelist-file-info');
new RegularEvent('click', (event: Event, target: HTMLElement): void => {
event.preventDefault();
Filelist.openInfoPopup('_FILE', $(event.currentTarget).attr('data-identifier'));
});
$('a.btn.filelist-file-copy').on('click', (event: JQueryEventObject): void => {
Filelist.openInfoPopup('_FILE', target.dataset.identifier);
}).delegateTo(document, 'a.filelist-file-references');
new RegularEvent('click', (event: Event, target: HTMLElement): void => {
event.preventDefault();
const $element = $(event.currentTarget);
const url = $element.attr('href');
const url = target.getAttribute('href');
let redirectUrl = (url)
? encodeURIComponent(url)
: encodeURIComponent(top.list_frame.document.location.pathname + top.list_frame.document.location.search);
top.list_frame.location.href = url + '&redirect=' + redirectUrl;
});
}).delegateTo(document, 'a.btn.filelist-file-copy');
// clipboard events
$('[data-event-name="filelist:clipboard:cmd"]').on('filelist:clipboard:cmd', (evt: JQueryEventObject) => {
const originalEvent = evt.originalEvent as ModalResponseEvent;
if (originalEvent.detail.result) {
Filelist.submitClipboardFormWithCommand(originalEvent.detail.payload);
}
});
$('[data-filelist-clipboard-cmd]:not([data-filelist-clipboard-cmd=""])').on('click', (evt: JQueryEventObject): void => {
const cmd = $(evt.currentTarget).data('filelistClipboardCmd');
const clipboardCmd = document.querySelector('[data-event-name="filelist:clipboard:cmd"]');
if (clipboardCmd !== null) {
new RegularEvent('filelist:clipboard:cmd', (event: ModalResponseEvent, target: HTMLElement): void => {
if (event.detail.result) {
Filelist.submitClipboardFormWithCommand(event.detail.payload);
}
}).bindTo(clipboardCmd);
}
new RegularEvent('click', (event: ModalResponseEvent, target: HTMLElement): void => {
const cmd = target.dataset.filelistClipboardCmd;
Filelist.submitClipboardFormWithCommand(cmd);
});
}).delegateTo(document, '[data-filelist-clipboard-cmd]:not([data-filelist-clipboard-cmd=""])');
});
}
}
......
......@@ -11,7 +11,8 @@
* The TYPO3 project - inspiring people to share!
*/
import $ from 'jquery';
import DocumentService = require('TYPO3/CMS/Core/DocumentService');
import RegularEvent = require('TYPO3/CMS/Core/Event/RegularEvent');
/**
* Module: TYPO3/CMS/Filelist/FileListLocalisation
......@@ -19,11 +20,11 @@ import $ from 'jquery';
*/
class FileListLocalisation {
constructor() {
$((): void => {
$('a.filelist-translationToggler').on('click', (event: JQueryEventObject): void => {
const id = $(event.currentTarget).attr('data-fileid');
$('div[data-fileid="' + id + '"]').toggle();
});
DocumentService.ready().then((): void => {
new RegularEvent('click', (event: Event, target: HTMLElement): void => {
const id = target.dataset.fileid;
document.querySelector('div[data-fileid="' + id + '"]').classList.toggle('hidden');
}).delegateTo(document, 'a.filelist-translationToggler');
});
}
}
......
......@@ -12,10 +12,13 @@
*/
import RegularEvent = require('TYPO3/CMS/Core/Event/RegularEvent');
import DocumentService = require('TYPO3/CMS/Core/DocumentService');
class FileReplace {
constructor() {
this.registerEvents();
DocumentService.ready().then((): void => {
this.registerEvents();
});
}
private registerEvents(): void {
......
......@@ -11,8 +11,8 @@
* The TYPO3 project - inspiring people to share!
*/
import $ from 'jquery';
import 'TYPO3/CMS/Backend/Input/Clearable';
import DocumentService = require('TYPO3/CMS/Core/DocumentService');
/**
* Module: TYPO3/CMS/Filelist/RenameFile
......@@ -21,10 +21,10 @@ import 'TYPO3/CMS/Backend/Input/Clearable';
*/
class FileSearch {
constructor() {
$((): void => {
DocumentService.ready().then((): void => {
let searchField: HTMLInputElement;
if ((searchField = document.querySelector('input[name="tx_filelist_file_filelistlist[searchWord]"]')) !== null) {
const searchResultShown = ('' !== searchField.value);
const searchResultShown = '' !== searchField.value;
// make search field clearable
searchField.clearable({
......
......@@ -12,8 +12,10 @@
*/
import {SeverityEnum} from 'TYPO3/CMS/Backend/Enum/Severity';
import $ from 'jquery';
import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse';
import AjaxRequest = require('TYPO3/CMS/Core/Ajax/AjaxRequest');
import Modal = require('TYPO3/CMS/Backend/Modal');
import DocumentService = require('TYPO3/CMS/Core/DocumentService');
/**
* Module: TYPO3/CMS/Filelist/RenameFile
......@@ -23,71 +25,73 @@ import Modal = require('TYPO3/CMS/Backend/Modal');
class RenameFile {
constructor() {
this.initialize();
DocumentService.ready().then((): void => {
this.initialize();
});
}
public initialize(): void {
$('.t3js-submit-file-rename').on('click', this.checkForDuplicate);
const submitButton = document.querySelector('.t3js-submit-file-rename');
if (submitButton !== null) {
submitButton.addEventListener('click', this.checkForDuplicate)
}
}
private checkForDuplicate(e: any): void {
private checkForDuplicate(e: Event): void {
e.preventDefault();
const form: any = $('#' + $(e.currentTarget).attr('form'));
const fileNameField: any = form.find('input[name="data[rename][0][target]"]');
const conflictModeField: any = form.find('input[name="data[rename][0][conflictMode]"]');
const ajaxUrl: string = TYPO3.settings.ajaxUrls.file_exists;
const form: HTMLFormElement = (e.currentTarget as HTMLInputElement).form;
const fileNameField = form.querySelector('input[name="data[rename][0][target]"]') as HTMLInputElement;
const destinationField = form.querySelector('input[name="data[rename][0][destination]"]') as HTMLInputElement;
const conflictModeField = form.querySelector('input[name="data[rename][0][conflictMode]"]') as HTMLInputElement;
new AjaxRequest(TYPO3.settings.ajaxUrls.file_exists).withQueryArguments({
fileName: fileNameField.value,
fileTarget: destinationField.value,
}).get({cache: 'no-cache'}).then(async (response: AjaxResponse): Promise<void> => {
const result = await response.resolve();
$.ajax({
cache: false,
data: {
fileName: fileNameField.val(),
fileTarget: form.find('input[name="data[rename][0][destination]"]').val(),
},
success: (response: any): void => {
const fileExists: boolean = typeof response.uid !== 'undefined';
const originalFileName: string = fileNameField.data('original');
const newFileName: string = fileNameField.val();
const fileExists: boolean = typeof result.uid !== 'undefined';
const originalFileName: string = fileNameField.dataset.original;
const newFileName: string = fileNameField.value;
if (fileExists && originalFileName !== newFileName) {
const description: string = TYPO3.lang['file_rename.exists.description']
.replace('{0}', originalFileName).replace(/\{1\}/g, newFileName);
if (fileExists && originalFileName !== newFileName) {
const description: string = TYPO3.lang['file_rename.exists.description']
.replace('{0}', originalFileName).replace(/\{1\}/g, newFileName);
const modal: JQuery = Modal.confirm(
TYPO3.lang['file_rename.exists.title'],
description,
SeverityEnum.warning,
[
{
active: true,
btnClass: 'btn-default',
name: 'cancel',
text: TYPO3.lang['file_rename.actions.cancel'],
},
{
btnClass: 'btn-primary',
name: 'rename',
text: TYPO3.lang['file_rename.actions.rename'],
},
{
btnClass: 'btn-default',
name: 'replace',
text: TYPO3.lang['file_rename.actions.override'],
},
]);
const modal = Modal.confirm(
TYPO3.lang['file_rename.exists.title'],
description,
SeverityEnum.warning,
[
{
active: true,
btnClass: 'btn-default',
name: 'cancel',
text: TYPO3.lang['file_rename.actions.cancel'],
},
{
btnClass: 'btn-primary',
name: 'rename',
text: TYPO3.lang['file_rename.actions.rename'],
},
{
btnClass: 'btn-default',
name: 'replace',
text: TYPO3.lang['file_rename.actions.override'],
},
]);
modal.on('button.clicked', (event: any): void => {
if (event.target.name !== 'cancel') {
conflictModeField.val(event.target.name);
form.trigger('submit');
}
Modal.dismiss();
});
} else {
form.trigger('submit');
}
},
url: ajaxUrl,
modal.on('button.clicked', (event: any): void => {
if (event.target.name !== 'cancel') {
conflictModeField.value = event.target.name;
form.submit();
}
Modal.dismiss();
});
} else {
form.submit();
}
});
}
}
......
......@@ -778,8 +778,8 @@ class FileList
}
// Hide flag button bar when not translated yet
$theData[$field] = ' <div class="localisationData btn-group" data-fileid="' . $fileObject->getUid() . '"' .
(empty($translations) ? ' style="display: none;"' : '') . '>' . $languageCode . '</div>';
$theData[$field] = ' <div class="localisationData btn-group' . (empty($translations) ? ' hidden' : '') . '" data-fileid="' . $fileObject->getUid() . '">'
. $languageCode . '</div>';
$theData[$field] .= '<a class="btn btn-default filelist-translationToggler" data-fileid="' . $fileObject->getUid() . '">' .
'<span title="' . htmlspecialchars($this->getLanguageService()->getLL('translateMetadata')) . '">'
. $this->iconFactory->getIcon('mimetypes-x-content-page-language-overlay', Icon::SIZE_SMALL)->render() . '</span>'
......
......@@ -10,4 +10,4 @@
*
* The TYPO3 project - inspiring people to share!
*/
var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};define(["require","exports","jquery","TYPO3/CMS/Backend/Modal","TYPO3/CMS/Core/Event/RegularEvent"],(function(e,t,n,i,o){"use strict";n=__importDefault(n);return new class{constructor(){this.changed=!1,n.default(()=>{const e=document.querySelector(".filelist-create-folder-main");if(!(e instanceof HTMLElement))throw new Error("Main element not found");this.selfUrl=e.dataset.selfUrl,this.confirmTitle=e.dataset.confirmTitle,this.confirmText=e.dataset.confirmText,this.registerEvents()})}reload(e){const t=this.selfUrl.replace(/AMOUNT/,e.toString());if(this.changed){const e=i.confirm(this.confirmTitle,this.confirmText);e.on("confirm.button.cancel",()=>{e.trigger("modal-dismiss")}),e.on("confirm.button.ok",()=>{e.trigger("modal-dismiss"),window.location.href=t})}else window.location.href=t}registerEvents(){new o("change",()=>{this.changed=!0}).delegateTo(document,['input[type="text"][name^="data[newfolder]"]','input[type="text"][name^="data[newfile]"]','input[type="text"][name^="data[newMedia]"]'].join(",")),new o("change",e=>{const t=parseInt(e.target.value,10);this.reload(t)}).bindTo(document.getElementById("number-of-new-folders"))}}}));
\ No newline at end of file
define(["require","exports","TYPO3/CMS/Core/DocumentService","TYPO3/CMS/Backend/Modal","TYPO3/CMS/Core/Event/RegularEvent"],(function(e,t,n,i,o){"use strict";return new class{constructor(){this.changed=!1,n.ready().then(()=>{const e=document.querySelector(".filelist-create-folder-main");if(!(e instanceof HTMLElement))throw new Error("Main element not found");this.selfUrl=e.dataset.selfUrl,this.confirmTitle=e.dataset.confirmTitle,this.confirmText=e.dataset.confirmText,this.registerEvents()})}reload(e){const t=this.selfUrl.replace(/AMOUNT/,e.toString());if(this.changed){const e=i.confirm(this.confirmTitle,this.confirmText);e.on("confirm.button.cancel",()=>{e.trigger("modal-dismiss")}),e.on("confirm.button.ok",()=>{e.trigger("modal-dismiss"),window.location.href=t})}else window.location.href=t}registerEvents(){new o("change",()=>{this.changed=!0}).delegateTo(document,['input[type="text"][name^="data[newfolder]"]','input[type="text"][name^="data[newfile]"]','input[type="text"][name^="data[newMedia]"]'].join(",")),new o("change",e=>{const t=parseInt(e.target.value,10);this.reload(t)}).bindTo(document.getElementById("number-of-new-folders"))}}}));
\ No newline at end of file
......@@ -10,4 +10,4 @@
*
* The TYPO3 project - inspiring people to share!
*/
var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};define(["require","exports","TYPO3/CMS/Backend/Enum/Severity","jquery","TYPO3/CMS/Backend/Modal"],(function(e,t,n,a,o){"use strict";a=__importDefault(a);return new class{constructor(){a.default(()=>{a.default(document).on("click",".t3js-filelist-delete",e=>{e.preventDefault();const t=a.default(e.currentTarget);let i=t.data("redirectUrl");i=i?encodeURIComponent(i):encodeURIComponent(top.list_frame.document.location.pathname+top.list_frame.document.location.search);const l=t.data("identifier"),r=t.data("deleteType"),d=t.data("deleteUrl")+"&data[delete][0][data]="+encodeURIComponent(l)+"&data[delete][0][redirect]="+i;if(t.data("check")){o.confirm(t.data("title"),t.data("content"),n.SeverityEnum.warning,[{text:TYPO3.lang["buttons.confirm.delete_file.no"]||"Cancel",active:!0,btnClass:"btn-default",name:"no"},{text:TYPO3.lang["buttons.confirm."+r+".yes"]||"Yes, delete this file or folder",btnClass:"btn-warning",name:"yes"}]).on("button.clicked",e=>{const t=e.target.name;"no"===t?o.dismiss():"yes"===t&&(o.dismiss(),top.list_frame.location.href=d)})}else top.list_frame.location.href=d})})}}}));
\ No newline at end of file
var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};define(["require","exports","TYPO3/CMS/Backend/Enum/Severity","TYPO3/CMS/Core/Event/RegularEvent","TYPO3/CMS/Core/DocumentService","TYPO3/CMS/Backend/Modal"],(function(e,t,n,a,o,i){"use strict";a=__importDefault(a);return new class{constructor(){o.ready().then(()=>{new a.default("click",(e,t)=>{e.preventDefault();let a=t.dataset.redirectUrl;a=a?encodeURIComponent(a):encodeURIComponent(top.list_frame.document.location.pathname+top.list_frame.document.location.search);const o=t.dataset.identifier,l=t.dataset.deleteType,r=t.dataset.deleteUrl+"&data[delete][0][data]="+encodeURIComponent(o)+"&data[delete][0][redirect]="+a;if(t.dataset.check){i.confirm(t.dataset.title,t.dataset.content,n.SeverityEnum.warning,[{text:TYPO3.lang["buttons.confirm.delete_file.no"]||"Cancel",active:!0,btnClass:"btn-default",name:"no"},{text:TYPO3.lang["buttons.confirm."+l+".yes"]||"Yes, delete this file or folder",btnClass:"btn-warning",name:"yes"}]).on("button.clicked",e=>{const t=e.target.name;"no"===t?i.dismiss():"yes"===t&&(i.dismiss(),top.list_frame.location.href=r)})}else top.list_frame.location.href=r}).delegateTo(document,".t3js-filelist-delete")})}}}));
\ No newline at end of file
......@@ -10,4 +10,4 @@
*
* The TYPO3 project - inspiring people to share!
*/
var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};define(["require","exports","jquery","TYPO3/CMS/Backend/InfoWindow","TYPO3/CMS/Backend/BroadcastMessage","TYPO3/CMS/Backend/BroadcastService","TYPO3/CMS/Core/Event/RegularEvent"],(function(e,t,a,i,r,o,n){"use strict";a=__importDefault(a);class l{static openInfoPopup(e,t){i.showItem(e,t)}static processTriggers(){const e=document.querySelector(".filelist-main");null!==e&&(l.emitTreeUpdateRequest(e.dataset.filelistCurrentFolderHash),top.fsMod&&top.fsMod.recentIds instanceof Object&&(top.fsMod.recentIds.file=encodeURIComponent(e.dataset.filelistCurrentIdentifier)))}static registerTreeUpdateEvents(){new n("click",(function(){l.emitTreeUpdateRequest(this.dataset.treeUpdateRequest)})).delegateTo(document.body,"[data-tree-update-request]")}static emitTreeUpdateRequest(e){const t=new r.BroadcastMessage("filelist","treeUpdateRequested",{type:"folder",identifier:e});o.post(t)}static submitClipboardFormWithCommand(e){const t=a.default('form[name="dblistForm"]');t.find('input[name="cmd"]').val(e),t.trigger("submit")}constructor(){l.processTriggers(),a.default(()=>{l.registerTreeUpdateEvents(),a.default("[data-filelist-show-item-identifier][data-filelist-show-item-type]").on("click",e=>{const t=a.default(e.currentTarget);e.preventDefault(),l.openInfoPopup(t.data("filelistShowItemType"),t.data("filelistShowItemIdentifier"))}),a.default("a.btn.filelist-file-info").on("click",e=>{e.preventDefault(),l.openInfoPopup("_FILE",a.default(e.currentTarget).attr("data-identifier"))}),a.default("a.filelist-file-references").on("click",e=>{e.preventDefault(),l.openInfoPopup("_FILE",a.default(e.currentTarget).attr("data-identifier"))}),a.default("a.btn.filelist-file-copy").on("click",e=>{e.preventDefault();const t=a.default(e.currentTarget).attr("href");let i=t?encodeURIComponent(t):encodeURIComponent(top.list_frame.document.location.pathname+top.list_frame.document.location.search);top.list_frame.location.href=t+"&redirect="+i}),a.default('[data-event-name="filelist:clipboard:cmd"]').on("filelist:clipboard:cmd",e=>{const t=e.originalEvent;t.detail.result&&l.submitClipboardFormWithCommand(t.detail.payload)}),a.default('[data-filelist-clipboard-cmd]:not([data-filelist-clipboard-cmd=""])').on("click",e=>{const t=a.default(e.currentTarget).data("filelistClipboardCmd");l.submitClipboardFormWithCommand(t)})})}}return new l}));
\ No newline at end of file
define(["require","exports","TYPO3/CMS/Core/DocumentService","TYPO3/CMS/Backend/InfoWindow","TYPO3/CMS/Backend/BroadcastMessage","TYPO3/CMS/Backend/BroadcastService","TYPO3/CMS/Core/Event/RegularEvent"],(function(e,t,i,o,a,n,d){"use strict";class r{static openInfoPopup(e,t){o.showItem(e,t)}static processTriggers(){const e=document.querySelector(".filelist-main");null!==e&&(r.emitTreeUpdateRequest(e.dataset.filelistCurrentFolderHash),top.fsMod&&top.fsMod.recentIds instanceof Object&&(top.fsMod.recentIds.file=encodeURIComponent(e.dataset.filelistCurrentIdentifier)))}static registerTreeUpdateEvents(){new d("click",(function(){r.emitTreeUpdateRequest(this.dataset.treeUpdateRequest)})).delegateTo(document.body,"[data-tree-update-request]")}static emitTreeUpdateRequest(e){const t=new a.BroadcastMessage("filelist","treeUpdateRequested",{type:"folder",identifier:e});n.post(t)}static submitClipboardFormWithCommand(e){const t=document.querySelector('form[name="dblistForm"]');t.querySelector('input[name="cmd"]').value=e,t.submit()}constructor(){r.processTriggers(),i.ready().then(()=>{r.registerTreeUpdateEvents(),new d("click",(e,t)=>{e.preventDefault(),r.openInfoPopup(t.dataset.filelistShowItemType,t.dataset.filelistShowItemIdentifier)}).delegateTo(document,"[data-filelist-show-item-identifier][data-filelist-show-item-type]"),new d("click",(e,t)=>{e.preventDefault(),r.openInfoPopup("_FILE",t.dataset.identifier)}).delegateTo(document,"a.btn.filelist-file-info"),new d("click",(e,t)=>{e.preventDefault(),r.openInfoPopup("_FILE",t.dataset.identifier)}).delegateTo(document,"a.filelist-file-references"),new d("click",(e,t)=>{e.preventDefault();const i=t.getAttribute("href");let o=i?encodeURIComponent(i):encodeURIComponent(top.list_frame.document.location.pathname+top.list_frame.document.location.search);top.list_frame.location.href=i+"&redirect="+o}).delegateTo(document,"a.btn.filelist-file-copy");const e=document.querySelector('[data-event-name="filelist:clipboard:cmd"]');null!==e&&new d("filelist:clipboard:cmd",(e,t)=>{e.detail.result&&r.submitClipboardFormWithCommand(e.detail.payload)}).bindTo(e),new d("click",(e,t)=>{const i=t.dataset.filelistClipboardCmd;r.submitClipboardFormWithCommand(i)}).delegateTo(document,'[data-filelist-clipboard-cmd]:not([data-filelist-clipboard-cmd=""])')})}}return new r}));
\ No newline at end of file
......@@ -10,4 +10,4 @@
*
* The TYPO3 project - inspiring people to share!
*/
var __importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};define(["require","exports","jquery"],(function(t,e,r){"use strict";r=__importDefault(r);return new class{constructor(){r.default(()=>{r.default("a.filelist-translationToggler").on("click",t=>{const e=r.default(t.currentTarget).attr("data-fileid");r.default('div[data-fileid="'+e+'"]').toggle()})})}}}));
\ No newline at end of file
define(["require","exports","TYPO3/CMS/Core/DocumentService","TYPO3/CMS/Core/Event/RegularEvent"],(function(e,t,n,r){"use strict";return new class{constructor(){n.ready().then(()=>{new r("click",(e,t)=>{const n=t.dataset.fileid;document.querySelector('div[data-fileid="'+n+'"]').classList.toggle("hidden")}).delegateTo(document,"a.filelist-translationToggler")})}}}));
\ No newline at end of file
......@@ -10,4 +10,4 @@
*
* The TYPO3 project - inspiring people to share!
*/
define(["require","exports","TYPO3/CMS/Core/Event/RegularEvent"],(function(e,t,i){"use strict";return new class{constructor(){this.registerEvents()}registerEvents(){new i("click",(function(){const e=this.dataset.filelistClickTarget;document.querySelector(e).click()})).delegateTo(document.body,'[data-filelist-click-target]:not([data-filelist-click-target=""]'),new i("change",(function(){const e=this.dataset.filelistChangeTarget;document.querySelector(e).value=this.value})).delegateTo(document.body,'[data-filelist-change-target]:not([data-filelist-change-target=""])')}}}));
\ No newline at end of file
define(["require","exports","TYPO3/CMS/Core/Event/RegularEvent","TYPO3/CMS/Core/DocumentService"],(function(e,t,i,n){"use strict";return new class{constructor(){n.ready().then(()=>{this.registerEvents()})}registerEvents(){new i("click",(function(){const e=this.dataset.filelistClickTarget;document.querySelector(e).click()})).delegateTo(document.body,'[data-filelist-click-target]:not([data-filelist-click-target=""]'),new i("change",(function(){const e=this.dataset.filelistChangeTarget;document.querySelector(e).value=this.value})).delegateTo(document.body,'[data-filelist-change-target]:not([data-filelist-change-target=""])')}}}));
\ No newline at end of file
......@@ -10,4 +10,4 @@
*
* The TYPO3 project - inspiring people to share!
*/
var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};define(["require","exports","jquery","TYPO3/CMS/Backend/Input/Clearable"],(function(e,t,l){"use strict";l=__importDefault(l);return new class{constructor(){l.default(()=>{let e;if(null!==(e=document.querySelector('input[name="tx_filelist_file_filelistlist[searchWord]"]'))){const t=""!==e.value;e.clearable({onClear:e=>{t&&e.closest("form").submit()}})}})}}}));
\ No newline at end of file
define(["require","exports","TYPO3/CMS/Core/DocumentService","TYPO3/CMS/Backend/Input/Clearable"],(function(e,t,r){"use strict";return new class{constructor(){r.ready().then(()=>{let e;if(null!==(e=document.querySelector('input[name="tx_filelist_file_filelistlist[searchWord]"]'))){const t=""!==e.value;e.clearable({onClear:e=>{t&&e.closest("form").submit()}})}})}}}));
\ No newline at end of file
......@@ -10,4 +10,4 @@
*
* The TYPO3 project - inspiring people to share!
*/
var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};define(["require","exports","TYPO3/CMS/Backend/Enum/Severity","jquery","TYPO3/CMS/Backend/Modal"],(function(e,t,a,n,i){"use strict";n=__importDefault(n);return new class{constructor(){this.initialize()}initialize(){n.default(".t3js-submit-file-rename").on("click",this.checkForDuplicate)}checkForDuplicate(e){e.preventDefault();const t=n.default("#"+n.default(e.currentTarget).attr("form")),r=t.find('input[name="data[rename][0][target]"]'),l=t.find('input[name="data[rename][0][conflictMode]"]'),s=TYPO3.settings.ajaxUrls.file_exists;n.default.ajax({cache:!1,data:{fileName:r.val(),fileTarget:t.find('input[name="data[rename][0][destination]"]').val()},success:e=>{const n=void 0!==e.uid,s=r.data("original"),c=r.val();if(n&&s!==c){const e=TYPO3.lang["file_rename.exists.description"].replace("{0}",s).replace(/\{1\}/g,c);i.confirm(TYPO3.lang["file_rename.exists.title"],e,a.SeverityEnum.warning,[{active:!0,btnClass:"btn-default",name:"cancel",text:TYPO3.lang["file_rename.actions.cancel"]},{btnClass:"btn-primary",name:"rename",text:TYPO3.lang["file_rename.actions.rename"]},{btnClass:"btn-default",name:"replace",text:TYPO3.lang["file_rename.actions.override"]}]).on("button.clicked",e=>{"cancel"!==e.target.name&&(l.val(e.target.name),t.trigger("submit")),i.dismiss()})}else t.trigger("submit")},url:s})}}}));
\ No newline at end of file
define(["require","exports","TYPO3/CMS/Backend/Enum/Severity","TYPO3/CMS/Core/Ajax/AjaxRequest","TYPO3/CMS/Backend/Modal","TYPO3/CMS/Core/DocumentService"],(function(e,t,a,n,i,r){"use strict";return new class{constructor(){r.ready().then(()=>{this.initialize()})}initialize(){const e=document.querySelector(".t3js-submit-file-rename");null!==e&&e.addEventListener("click",this.checkForDuplicate)}checkForDuplicate(e){e.preventDefault();const t=e.currentTarget.form,r=t.querySelector('input[name="data[rename][0][target]"]'),c=t.querySelector('input[name="data[rename][0][destination]"]'),l=t.querySelector('input[name="data[rename][0][conflictMode]"]');new n(TYPO3.settings.ajaxUrls.file_exists).withQueryArguments({fileName:r.value,fileTarget:c.value}).get({cache:"no-cache"}).then(async e=>{const n=void 0!==(await e.resolve()).uid,c=r.dataset.original,s=r.value;if(n&&c!==s){const e=TYPO3.lang["file_rename.exists.description"].replace("{0}",c).replace(/\{1\}/g,s);i.confirm(TYPO3.lang["file_rename.exists.title"],e,a.SeverityEnum.warning,[{active:!0,btnClass:"btn-default",name:"cancel",text:TYPO3.lang["file_rename.actions.cancel"]},{btnClass:"btn-primary",name:"rename",text:TYPO3.lang["file_rename.actions.rename"]},{btnClass:"btn-default",name:"replace",text:TYPO3.lang["file_rename.actions.override"]}]).on("button.clicked",e=>{"cancel"!==e.target.name&&(l.value=e.target.name,t.submit()),i.dismiss()})}else t.submit()})}}}));
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment