[BUGFIX] Add missing DOM ready checks in filelist 90/55390/12
authorFrank Naegler <frank.naegler@typo3.org>
Wed, 17 Jan 2018 22:43:50 +0000 (23:43 +0100)
committerAlexander Opitz <opitz.alexander@googlemail.com>
Mon, 5 Feb 2018 13:48:29 +0000 (14:48 +0100)
Some modules in the filelist are missing DOM ready checks.
This patch adds the missing checks to prevent loading issues.

Resolves: #78976
Releases: master, 8.7
Change-Id: Iee328808a89cf92f4fde1afd59167ae9fa7280be
Reviewed-on: https://review.typo3.org/55390
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Mathias Brodala <mbrodala@pagemachine.de>
Reviewed-by: Alexander Opitz <opitz.alexander@googlemail.com>
Tested-by: Alexander Opitz <opitz.alexander@googlemail.com>
typo3/sysext/filelist/Resources/Public/JavaScript/FileDelete.js
typo3/sysext/filelist/Resources/Public/JavaScript/FileList.js
typo3/sysext/filelist/Resources/Public/JavaScript/FileListLocalisation.js
typo3/sysext/filelist/Resources/Public/JavaScript/FileSearch.js

index d5cb054..31b80c3 100644 (file)
  */
 define(['jquery', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Backend/Severity'], function($, Modal, Severity) {
 
-  $(document).on('click', '.t3js-filelist-delete', function(e) {
-    e.preventDefault();
-    var $anchorElement = $(this);
-    var redirectUrl = $anchorElement.data('redirectUrl');
-    if (redirectUrl) {
-      redirectUrl = top.rawurlencode(redirectUrl);
-    } else {
-      redirectUrl = top.rawurlencode(top.list_frame.document.location.pathname + top.list_frame.document.location.search);
-    }
-    var identifier = $anchorElement.data('identifier');
-    var deleteType = $anchorElement.data('deleteType');
-    var deleteUrl = $anchorElement.data('deleteUrl') + '&data[delete][0][data]=' + encodeURIComponent(identifier);
-    if ($anchorElement.data('check')) {
-      var $modal = Modal.confirm($anchorElement.data('title'), $anchorElement.data('content'), Severity.warning, [
-        {
-          text: TYPO3.lang['buttons.confirm.delete_file.no'] || 'Cancel',
-          active: true,
-          btnClass: 'btn-default',
-          name: 'no'
-        },
-        {
-          text: TYPO3.lang['buttons.confirm.' + deleteType + '.yes'] || 'Yes, delete this file or folder',
-          btnClass: 'btn-warning',
-          name: 'yes'
-        }
-      ]);
-      $modal.on('button.clicked', function(e) {
-        if (e.target.name === 'no') {
-          Modal.dismiss();
-        } else if (e.target.name === 'yes') {
-          Modal.dismiss();
-          top.list_frame.location.href = deleteUrl + '&data[delete][0][redirect]=' + redirectUrl;
-        }
-      });
-    } else {
-      top.list_frame.location.href = deleteUrl + '&data[delete][0][redirect]=' + redirectUrl;
-    }
+  $(function() {
+    $(document).on('click', '.t3js-filelist-delete', function(e) {
+      e.preventDefault();
+      var $anchorElement = $(this);
+      var redirectUrl = $anchorElement.data('redirectUrl');
+      if (redirectUrl) {
+        redirectUrl = top.rawurlencode(redirectUrl);
+      } else {
+        redirectUrl = top.rawurlencode(top.list_frame.document.location.pathname + top.list_frame.document.location.search);
+      }
+      var identifier = $anchorElement.data('identifier');
+      var deleteType = $anchorElement.data('deleteType');
+      var deleteUrl = $anchorElement.data('deleteUrl') + '&data[delete][0][data]=' + encodeURIComponent(identifier);
+      if ($anchorElement.data('check')) {
+        var $modal = Modal.confirm($anchorElement.data('title'), $anchorElement.data('content'), Severity.warning, [
+          {
+            text: TYPO3.lang['buttons.confirm.delete_file.no'] || 'Cancel',
+            active: true,
+            btnClass: 'btn-default',
+            name: 'no'
+          },
+          {
+            text: TYPO3.lang['buttons.confirm.' + deleteType + '.yes'] || 'Yes, delete this file or folder',
+            btnClass: 'btn-warning',
+            name: 'yes'
+          }
+        ]);
+        $modal.on('button.clicked', function(e) {
+          if (e.target.name === 'no') {
+            Modal.dismiss();
+          } else if (e.target.name === 'yes') {
+            Modal.dismiss();
+            top.list_frame.location.href = deleteUrl + '&data[delete][0][redirect]=' + redirectUrl;
+          }
+        });
+      } else {
+        top.list_frame.location.href = deleteUrl + '&data[delete][0][redirect]=' + redirectUrl;
+      }
+    });
   });
 
 });
index ecf6d39..6203ec6 100644 (file)
  */
 define(['jquery'], function($) {
 
-  $('a.filelist-file-title').click(function(event) {
-    event.preventDefault();
+  $(function() {
+    $('a.filelist-file-title').click(function(event) {
+      event.preventDefault();
 
-    var url = $(this).attr('data-url');
-    window.location.href = url;
-  });
+      var url = $(this).attr('data-url');
+      window.location.href = url;
+    });
 
-  $('a.btn.filelist-file-edit').click(function(event) {
-    event.preventDefault();
+    $('a.btn.filelist-file-edit').click(function(event) {
+      event.preventDefault();
 
-    var url = $(this).attr('data-url');
-    top.list_frame.location.href = url;
-  });
+      var url = $(this).attr('data-url');
+      top.list_frame.location.href = url;
+    });
 
-  $('a.btn.filelist-file-view').click(function(event) {
-    event.preventDefault();
+    $('a.btn.filelist-file-view').click(function(event) {
+      event.preventDefault();
 
-    var url = $(this).attr('data-url');
-    top.openUrlInWindow(url, 'WebFile')
-  });
+      var url = $(this).attr('data-url');
+      top.openUrlInWindow(url, 'WebFile')
+    });
 
-  $('a.btn.filelist-file-replace').click(function(event) {
-    event.preventDefault();
+    $('a.btn.filelist-file-replace').click(function(event) {
+      event.preventDefault();
 
-    var url = $(this).attr('data-url');
-    top.list_frame.location.href = url;
-  });
+      var url = $(this).attr('data-url');
+      top.list_frame.location.href = url;
+    });
 
-  $('a.btn.filelist-file-rename').click(function(event) {
-    event.preventDefault();
+    $('a.btn.filelist-file-rename').click(function(event) {
+      event.preventDefault();
 
-    var url = $(this).attr('data-url');
-    top.list_frame.location.href = url;
-  });
+      var url = $(this).attr('data-url');
+      top.list_frame.location.href = url;
+    });
 
-  $('a.btn.filelist-file-info').click(function(event) {
-    event.preventDefault();
+    $('a.btn.filelist-file-info').click(function(event) {
+      event.preventDefault();
 
-    var identifier = $(this).attr('data-identifier');
-    openFileInfoPopup(identifier);
-  });
+      var identifier = $(this).attr('data-identifier');
+      openFileInfoPopup(identifier);
+    });
+
+    $('a.filelist-file-references').click(function(event) {
+      event.preventDefault();
 
-  $('a.filelist-file-references').click(function(event) {
-    event.preventDefault();
+      var identifier = $(this).attr('data-identifier');
+      openFileInfoPopup(identifier);
+    });
 
-    var identifier = $(this).attr('data-identifier');
-    openFileInfoPopup(identifier);
   });
 
   /**
index f94205b..6d1d711 100644 (file)
  */
 define(['jquery'], function($) {
 
-  $('a.filelist-translationToggler').click(function(event) {
-    var id = $(this).attr('data-fileid');
-    $('div[data-fileid="' + id + '"]').toggle();
+  $(function() {
+    $('a.filelist-translationToggler').click(function(event) {
+      var id = $(this).attr('data-fileid');
+      $('div[data-fileid="' + id + '"]').toggle();
+    });
   });
 
   return null;
index b2a08d1..b01625e 100644 (file)
  */
 define(['jquery', 'TYPO3/CMS/Backend/jquery.clearable'], function($) {
 
-  var $searchFields = $('input[name="tx_filelist_file_filelistlist[searchWord]"]');
-  var searchResultShown = ('' !== $searchFields.first().val());
+  $(function() {
+    var $searchFields = $('input[name="tx_filelist_file_filelistlist[searchWord]"]');
+    var searchResultShown = ('' !== $searchFields.first().val());
 
-  // make search field clearable
-  $searchFields.clearable({
-    onClear: function() {
-      if (searchResultShown) {
-        $(this).closest('form').submit();
+    // make search field clearable
+    $searchFields.clearable({
+      onClear: function() {
+        if (searchResultShown) {
+          $(this).closest('form').submit();
+        }
       }
-    }
+    });
   });
 
 });