diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/AjaxDataHandler.js b/typo3/sysext/backend/Resources/Public/JavaScript/AjaxDataHandler.js index 0ed59a2e94942674c0df46aca1310a2b9bd718d6..71479ae143561f82a57c48a05daaef8cdc3102c1 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/AjaxDataHandler.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/AjaxDataHandler.js @@ -14,7 +14,7 @@ /** * AjaxDataHandler - Javascript functions to work with AJAX and interacting with tce_db.php */ -define(['jquery', 'TYPO3/CMS/Backend/Notification', 'TYPO3/CMS/Backend/Modal'], function ($) { +define(['jquery', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Backend/Notification'], function ($, Modal) { 'use strict'; var AjaxDataHandler = {}; @@ -66,7 +66,7 @@ define(['jquery', 'TYPO3/CMS/Backend/Notification', 'TYPO3/CMS/Backend/Modal'], $(document).on('click', '.t3js-record-delete', function(evt) { evt.preventDefault(); var $anchorElement = $(this); - var $modal = top.TYPO3.Modal.confirm($anchorElement.data('title'), $anchorElement.data('message'), top.TYPO3.Severity.warning, [ + var $modal = Modal.confirm($anchorElement.data('title'), $anchorElement.data('message'), top.TYPO3.Severity.warning, [ { text: $(this).data('button-close-text') || TYPO3.lang['button.cancel'] || 'Cancel', active: true, @@ -80,9 +80,9 @@ define(['jquery', 'TYPO3/CMS/Backend/Notification', 'TYPO3/CMS/Backend/Modal'], ]); $modal.on('button.clicked', function(e) { if (e.target.name === 'cancel') { - top.TYPO3.Modal.dismiss(); + Modal.dismiss(); } else if (e.target.name === 'delete') { - top.TYPO3.Modal.dismiss(); + Modal.dismiss(); AjaxDataHandler.deleteRecord($anchorElement); } }); diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/DragUploader.js b/typo3/sysext/backend/Resources/Public/JavaScript/DragUploader.js index 32c9789374479aea414a45b78752c29d0f884db1..24de4bca0d9b9d7bc029266b06bc2289d78918cd 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/DragUploader.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/DragUploader.js @@ -15,7 +15,7 @@ * JavaScript RequireJS module called "TYPO3/CMS/Backend/DragUploader" * */ -define(['jquery', 'moment', 'nprogress', 'TYPO3/CMS/Lang/Lang', 'TYPO3/CMS/Backend/Modal'], function($, moment, NProgress) { +define(['jquery', 'moment', 'nprogress', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Lang/Lang'], function($, moment, NProgress, Modal) { /** * Array of files which are asked for being overridden @@ -284,7 +284,7 @@ define(['jquery', 'moment', 'nprogress', 'TYPO3/CMS/Lang/Lang', 'TYPO3/CMS/Backe $modalContent.find('table').append($record); } - var $modal = top.TYPO3.Modal.confirm(TYPO3.lang['file_upload.existingfiles.title'], $modalContent, top.TYPO3.Severity.warning, [ + var $modal = Modal.confirm(TYPO3.lang['file_upload.existingfiles.title'], $modalContent, top.TYPO3.Severity.warning, [ { text: $(this).data('button-close-text') || TYPO3.lang['file_upload.button.cancel'] || 'Cancel', active: true, @@ -333,7 +333,7 @@ define(['jquery', 'moment', 'nprogress', 'TYPO3/CMS/Lang/Lang', 'TYPO3/CMS/Backe }).on('button.clicked', function(e) { if (e.target.name === 'cancel') { askForOverride = []; - top.TYPO3.Modal.dismiss(); + Modal.dismiss(); } else if (e.target.name === 'continue') { $.each(askForOverride, function(key, fileInfo) { if (fileInfo.action === actions.USE_EXISTING) { @@ -346,7 +346,7 @@ define(['jquery', 'moment', 'nprogress', 'TYPO3/CMS/Lang/Lang', 'TYPO3/CMS/Backe } }); askForOverride = []; - top.TYPO3.Modal.dismiss(); + Modal.dismiss(); } }).on('hidden.bs.modal', function() { askForOverride = []; @@ -580,10 +580,12 @@ define(['jquery', 'moment', 'nprogress', 'TYPO3/CMS/Lang/Lang', 'TYPO3/CMS/Backe if (typeof option === 'string') { data[option](); } - }) + }); }; - $('.t3js-drag-uploader').dragUploader(); + $(function() { + $('.t3js-drag-uploader').dragUploader(); + }); }; diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine.js b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine.js index cb55043d34e7dde9c65e0ab9bfd11e877bcf255f..47cc40ce9a48c2b7c47b07da06b4f5d09c2ca6bd 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine.js @@ -28,7 +28,8 @@ var setFormValueOpenBrowser ,setFormValue_getFObj; -define(['jquery'], function ($) { +define(['jquery', 'TYPO3/CMS/Backend/Modal'], function ($, Modal) { + // main options var FormEngine = { @@ -596,7 +597,7 @@ define(['jquery'], function ($) { var title = TYPO3.lang['label.confirm.delete_record.title'] || 'Delete this record?'; var content = TYPO3.lang['label.confirm.delete_record.content'] || 'Are you sure you want to delete this record?'; var $anchorElement = $(this); - var $modal = top.TYPO3.Modal.confirm(title, content, top.TYPO3.Severity.warning, [ + var $modal = Modal.confirm(title, content, top.TYPO3.Severity.warning, [ { text: TYPO3.lang['buttons.confirm.delete_record.no'] || 'Cancel', active: true, @@ -610,10 +611,10 @@ define(['jquery'], function ($) { ]); $modal.on('button.clicked', function(e) { if (e.target.name === 'no') { - top.TYPO3.Modal.dismiss(); + Modal.dismiss(); } else if (e.target.name === 'yes') { deleteRecord($anchorElement.data('table'), $anchorElement.data('uid'), $anchorElement.data('return-url')); - top.TYPO3.Modal.dismiss(); + Modal.dismiss(); } }); }); @@ -623,7 +624,7 @@ define(['jquery'], function ($) { var title = TYPO3.lang['label.confirm.delete_record.title'] || 'Delete this record?'; var content = TYPO3.lang['label.confirm.delete_record.content'] || 'Are you sure you want to delete this record?'; var $anchorElement = $(this); - var $modal = top.TYPO3.Modal.confirm(title, content, top.TYPO3.Severity.warning, [ + var $modal = Modal.confirm(title, content, top.TYPO3.Severity.warning, [ { text: TYPO3.lang['buttons.confirm.delete_record.no'] || 'Cancel', active: true, @@ -637,11 +638,11 @@ define(['jquery'], function ($) { ]); $modal.on('button.clicked', function(e) { if (e.target.name === 'no') { - top.TYPO3.Modal.dismiss(); + Modal.dismiss(); } else if (e.target.name === 'yes') { var objectId = $anchorElement.data('objectid'); inline.deleteRecord(objectId); - top.TYPO3.Modal.dismiss(); + Modal.dismiss(); } }); }); @@ -836,7 +837,7 @@ define(['jquery'], function ($) { if ($('.has-change').length > 0) { var title = TYPO3.lang['label.confirm.close_without_save.title'] || 'Do you want to quit without saving?'; var content = TYPO3.lang['label.confirm.close_without_save.content'] || 'You have currently unsaved changes. Are you sure that you want to discard all changes?'; - $modal = top.TYPO3.Modal.confirm(title, content, top.TYPO3.Severity.warning, [ + $modal = Modal.confirm(title, content, top.TYPO3.Severity.warning, [ { text: TYPO3.lang['buttons.confirm.close_without_save.no'] || 'No, I will continue editing', active: true, @@ -850,9 +851,9 @@ define(['jquery'], function ($) { ]); $modal.on('button.clicked', function(e) { if (e.target.name === 'no') { - top.TYPO3.Modal.dismiss(); + Modal.dismiss(); } else if (e.target.name === 'yes') { - top.TYPO3.Modal.dismiss(); + Modal.dismiss(); FormEngine.closeDocument(); } }); @@ -868,7 +869,7 @@ define(['jquery'], function ($) { if ($('.has-error').length > 0) { var title = TYPO3.lang['label.alert.save_with_error.title'] || 'You have errors in your form!'; var content = TYPO3.lang['label.alert.save_with_error.content'] || 'Please check the form, there is at least one error in your form.'; - $modal = top.TYPO3.Modal.confirm(title, content, top.TYPO3.Severity.error, [ + $modal = Modal.confirm(title, content, top.TYPO3.Severity.error, [ { text: TYPO3.lang['buttons.alert.save_with_error.ok'] || 'OK', btnClass: 'btn-danger', @@ -877,7 +878,7 @@ define(['jquery'], function ($) { ]); $modal.on('button.clicked', function(e) { if (e.target.name === 'ok') { - top.TYPO3.Modal.dismiss(); + Modal.dismiss(); } }); return false; diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/ImageManipulation.js b/typo3/sysext/backend/Resources/Public/JavaScript/ImageManipulation.js index 5e2cbb36e51821ca4126358a609aa09c89056e70..e985f4c7aede6a41a6b213bf789552c3b1d803a1 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/ImageManipulation.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/ImageManipulation.js @@ -14,7 +14,7 @@ /** * contains all logic for the image crop GUI */ -define(['jquery', 'TYPO3/CMS/Backend/Modal'], function ($) { +define(['jquery', 'TYPO3/CMS/Backend/Modal'], function ($, Modal) { var ImageManipulation = { margin: 20, @@ -53,7 +53,7 @@ define(['jquery', 'TYPO3/CMS/Backend/Modal'], function ($) { * Open modal with image to crop */ ImageManipulation.show = function() { - ImageManipulation.currentModal = top.TYPO3.Modal.loadUrl( + ImageManipulation.currentModal = Modal.loadUrl( ImageManipulation.$trigger.data('image-name'), TYPO3.Severity.notice, [], @@ -107,7 +107,7 @@ define(['jquery', 'TYPO3/CMS/Backend/Modal'], function ($) { $modal.css({marginLeft: 'auto', marginRight: 'auto'}); // Center modal vertical - top.TYPO3.Modal.center(); + Modal.center(); // Wait a few microseconds to let the modal resize setTimeout(ImageManipulation.initializeCropper, 100); diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Modal.js b/typo3/sysext/backend/Resources/Public/JavaScript/Modal.js index 111879543a2a94a0c6f621d0ba92bc4cd42704a1..c72c9d5916450a8277b04c4a16f1f5e5d49d0c31 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Modal.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/Modal.js @@ -16,6 +16,17 @@ * This module depends on TYPO3/CMS/Backend/Notification due to top.TYPO3.Severity. */ define(['jquery', 'TYPO3/CMS/Backend/Notification', 'bootstrap'], function($) { + "use strict"; + + // fetch from parent + if (parent && parent.window.TYPO3 && parent.window.TYPO3.Modal) { + return parent.window.TYPO3.Modal; + } + + // fetch object from outer frame + if (top && top.TYPO3.Modal) { + return top.TYPO3.Modal; + } /** * The main object of the modal API @@ -102,7 +113,7 @@ define(['jquery', 'TYPO3/CMS/Backend/Notification', 'bootstrap'], function($) { } ]; additionalCssClasses = additionalCssClasses || []; - $modal = Modal.show(title, content, severity, buttons, additionalCssClasses); + var $modal = Modal.show(title, content, severity, buttons, additionalCssClasses); $modal.on('button.clicked', function(e) { if (e.target.name === 'cancel') { $(this).trigger('confirm.button.cancel'); @@ -148,13 +159,15 @@ define(['jquery', 'TYPO3/CMS/Backend/Notification', 'bootstrap'], function($) { * @param {array} additionalCssClasses additional css classes to add to the modal */ Modal.show = function(title, content, severity, buttons, additionalCssClasses) { + var i; + severity = (typeof severity !== 'undefined' ? severity : top.TYPO3.Severity.info); buttons = buttons || []; additionalCssClasses = additionalCssClasses || []; var currentModal = Modal.template.clone(); if (additionalCssClasses.length) { - for (var i=0; i < additionalCssClasses.length; i++) { + for (i = 0; i < additionalCssClasses.length; i++) { currentModal.addClass(additionalCssClasses[i]); } } @@ -176,7 +189,7 @@ define(['jquery', 'TYPO3/CMS/Backend/Notification', 'bootstrap'], function($) { currentModal.addClass('t3-modal-' + Modal.getSeverityClass(severity)); if (buttons.length > 0) { - for (var i=0; i<buttons.length; i++) { + for (i = 0; i<buttons.length; i++) { var button = buttons[i]; var $button = $('<button />', {class: 'btn'}); $button.html(button.text); @@ -283,22 +296,14 @@ define(['jquery', 'TYPO3/CMS/Backend/Notification', 'bootstrap'], function($) { active: true, btnClass: 'btn-default', trigger: function() { - if (typeof top.TYPO3 !== 'undefined' && typeof top.TYPO3.Modal !== 'undefined') { - top.TYPO3.Modal.currentModal.trigger('modal-dismiss'); - } else { - Modal.trigger('modal-dismiss'); - } + Modal.trigger('modal-dismiss'); } }, { text: $element.data('button-ok-text') || 'OK', btnClass: 'btn-' + Modal.getSeverityClass(severity), trigger: function() { - if (typeof top.TYPO3 !== 'undefined' && typeof top.TYPO3.Modal !== 'undefined') { - top.TYPO3.Modal.currentModal.trigger('modal-dismiss'); - } else { - Modal.trigger('modal-dismiss'); - } + Modal.trigger('modal-dismiss'); self.location.href = $element.data('href') || $element.attr('href'); } } @@ -306,17 +311,9 @@ define(['jquery', 'TYPO3/CMS/Backend/Notification', 'bootstrap'], function($) { if (url !== null) { var separator = (url.indexOf('?') > -1) ? '&' : '?'; var params = $.param({data: $element.data()}); - if (typeof top.TYPO3 !== 'undefined' && typeof top.TYPO3.Modal !== 'undefined') { - top.TYPO3.Modal.loadUrl(title, severity, buttons, url + separator + params); - } else { - Modal.loadUrl(title, severity, buttons, url + separator + params); - } + Modal.loadUrl(title, severity, buttons, url + separator + params); } else { - if (typeof top.TYPO3 !== 'undefined' && typeof top.TYPO3.Modal !== 'undefined') { - top.TYPO3.Modal.show(title, content, severity, buttons); - } else { - Modal.show(title, content, severity, buttons); - } + Modal.show(title, content, severity, buttons); } }); }; @@ -326,12 +323,10 @@ define(['jquery', 'TYPO3/CMS/Backend/Notification', 'bootstrap'], function($) { */ $(document).on('modal-dismiss', Modal.dismiss); - /** - * Return the Modal object - */ - return function() { - Modal.initializeMarkupTrigger(); - TYPO3.Modal = Modal; - return Modal; - }(); + Modal.initializeMarkupTrigger(); + + // expose as global object + TYPO3.Modal = Modal; + + return Modal; }); diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/OnlineMedia.js b/typo3/sysext/backend/Resources/Public/JavaScript/OnlineMedia.js index dc02d0178773a6453041048c83105ece93c6b6ec..85d2ad6b0050e2ee21839e7d2f345ed0640bd8c6 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/OnlineMedia.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/OnlineMedia.js @@ -14,7 +14,7 @@ /** * Javascript for show the online media dialog */ -define(['jquery', 'nprogress', 'TYPO3/CMS/Lang/Lang', 'TYPO3/CMS/Backend/Modal'], function($, NProgress) { +define(['jquery', 'nprogress', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Lang/Lang'], function($, NProgress, Modal) { "use strict"; var OnlineMediaPlugin = function(element) { @@ -49,13 +49,13 @@ define(['jquery', 'nprogress', 'TYPO3/CMS/Lang/Lang', 'TYPO3/CMS/Backend/Modal'] 'file' ); } else { - var $confirm = top.TYPO3.Modal.confirm( + var $confirm = Modal.confirm( 'ERROR', data.error, top.TYPO3.Severity.error, [{ text: TYPO3.lang['button.ok'] || 'OK', - btnClass: 'btn-' + top.TYPO3.Modal.getSeverityClass(top.TYPO3.Severity.error), + btnClass: 'btn-' + Modal.getSeverityClass(top.TYPO3.Severity.error), name: 'ok' }] ).on('confirm.button.ok', function() { @@ -71,7 +71,7 @@ define(['jquery', 'nprogress', 'TYPO3/CMS/Lang/Lang', 'TYPO3/CMS/Backend/Modal'] me.$btn.on('click', function(evt) { evt.preventDefault(); - var $modal = top.TYPO3.Modal.show( + var $modal = Modal.show( me.$btn.attr('title'), '<div class="form-control-wrap">' + '<input type="text" class="form-control online-media-url" placeholder="' + me.placeholder + '" />' + diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Toolbar/ShortcutMenu.js b/typo3/sysext/backend/Resources/Public/JavaScript/Toolbar/ShortcutMenu.js index 87adf09d8dcf35360290adfe55e04d0485aa79ca..0ce6b7b4cb85db78d5915ca3d0ed35c5c8971f0c 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Toolbar/ShortcutMenu.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/Toolbar/ShortcutMenu.js @@ -15,7 +15,7 @@ * shortcut menu logic to add new shortcut, remove a shortcut * and edit a shortcut */ -define(['jquery'], function($) { +define(['jquery', 'TYPO3/CMS/Backend/Modal'], function($, Modal) { var ShortcutMenu = { $spinnerElement: $('<span>', { @@ -76,7 +76,7 @@ define(['jquery'], function($) { */ ShortcutMenu.deleteShortcut = function($shortcutRecord) { // @todo: translations - top.TYPO3.Modal.confirm('Delete bookmark', 'Do you really want to remove this bookmark?') + Modal.confirm('Delete bookmark', 'Do you really want to remove this bookmark?') .on('confirm.button.ok', function() { $.ajax({ url: TYPO3.settings.ajaxUrls['shortcut_remove'], @@ -105,7 +105,7 @@ define(['jquery'], function($) { ShortcutMenu.createShortcut = function(moduleName, url, confirmationText, motherModule, shortcutButton) { if (typeof confirmationText !== 'undefined') { // @todo: translations - top.TYPO3.Modal.confirm('Create bookmark', confirmationText) + Modal.confirm('Create bookmark', confirmationText) .on('confirm.button.ok', function() { var $toolbarItemIcon = $(ShortcutMenu.options.toolbarIconSelector, ShortcutMenu.options.containerSelector); var $spinner = ShortcutMenu.$spinnerElement.clone(); diff --git a/typo3/sysext/extensionmanager/Resources/Public/JavaScript/Main.js b/typo3/sysext/extensionmanager/Resources/Public/JavaScript/Main.js index 7422fd12bcc004a7b20521c4970c1171bcb0fea6..cbc84f5da0794bb23208881e3a259477df834b1d 100644 --- a/typo3/sysext/extensionmanager/Resources/Public/JavaScript/Main.js +++ b/typo3/sysext/extensionmanager/Resources/Public/JavaScript/Main.js @@ -17,7 +17,7 @@ * ExtensionManager.Update => Various AJAX functions to display updates * ExtensionManager.uploadForm => helper to show the upload form */ -define(['jquery', 'nprogress', 'datatables', 'TYPO3/CMS/Backend/jquery.clearable'], function($, NProgress) { +define(['jquery', 'nprogress', 'TYPO3/CMS/Backend/Modal', 'datatables', 'TYPO3/CMS/Backend/jquery.clearable'], function($, NProgress, Modal) { var ExtensionManager = { identifier: { extensionlist: '#typo3-extension-list', @@ -73,7 +73,7 @@ define(['jquery', 'nprogress', 'datatables', 'TYPO3/CMS/Backend/jquery.clearable $me.attr('href', '#'); $me.addClass('transformed'); $me.click(function() { - top.TYPO3.Modal.confirm( + Modal.confirm( TYPO3.lang['extensionList.removalConfirmation.title'], TYPO3.lang['extensionList.removalConfirmation.question'], top.TYPO3.Severity.error, @@ -82,14 +82,14 @@ define(['jquery', 'nprogress', 'datatables', 'TYPO3/CMS/Backend/jquery.clearable text: TYPO3.lang['button.cancel'], active: true, trigger: function() { - top.TYPO3.Modal.dismiss(); + Modal.dismiss(); } }, { text: TYPO3.lang['button.remove'], btnClass: 'btn-danger', trigger: function() { ExtensionManager.removeExtensionFromDisk($me); - top.TYPO3.Modal.dismiss(); + Modal.dismiss(); } } ] @@ -189,7 +189,7 @@ define(['jquery', 'nprogress', 'datatables', 'TYPO3/CMS/Backend/jquery.clearable NProgress.done(); $extManager.unmask(); - top.TYPO3.Modal.confirm( + Modal.confirm( TYPO3.lang['extensionList.updateConfirmation.questionVersionComments'], message, top.TYPO3.Severity.warning, @@ -198,7 +198,7 @@ define(['jquery', 'nprogress', 'datatables', 'TYPO3/CMS/Backend/jquery.clearable text: TYPO3.lang['button.cancel'], active: true, trigger: function() { - top.TYPO3.Modal.dismiss(); + Modal.dismiss(); } }, { text: TYPO3.lang['button.updateExtension'], @@ -208,7 +208,7 @@ define(['jquery', 'nprogress', 'datatables', 'TYPO3/CMS/Backend/jquery.clearable url: data.url, data: { tx_extensionmanager_tools_extensionmanagerextensionmanager: { - version: $('input:radio[name=version]:checked', top.TYPO3.Modal.currentModal).val() + version: $('input:radio[name=version]:checked', Modal.currentModal).val() } }, dataType: 'json', @@ -220,7 +220,7 @@ define(['jquery', 'nprogress', 'datatables', 'TYPO3/CMS/Backend/jquery.clearable location.reload(); } }); - top.TYPO3.Modal.dismiss(); + Modal.dismiss(); } } ] @@ -382,19 +382,19 @@ define(['jquery', 'nprogress', 'datatables', 'TYPO3/CMS/Backend/jquery.clearable NProgress.done(); $extManager.unmask(); if (data.hasDependencies) { - top.TYPO3.Modal.confirm(data.title, data.message, top.TYPO3.Severity.info, [ + Modal.confirm(data.title, data.message, top.TYPO3.Severity.info, [ { text: TYPO3.lang['button.cancel'], active: true, trigger: function() { - top.TYPO3.Modal.dismiss(); + Modal.dismiss(); } }, { text: TYPO3.lang['button.resolveDependencies'], btnClass: 'btn-info', trigger: function() { Repository.getResolveDependenciesAndInstallResult(data.url + '&tx_extensionmanager_tools_extensionmanagerextensionmanager[downloadPath]=' + Repository.downloadPath); - top.TYPO3.Modal.dismiss(); + Modal.dismiss(); } } ]); @@ -419,24 +419,24 @@ define(['jquery', 'nprogress', 'datatables', 'TYPO3/CMS/Backend/jquery.clearable }, success: function (data) { if (data.errorCount > 0) { - top.TYPO3.Modal.confirm(data.errorTitle, data.errorMessage, top.TYPO3.Severity.error, [ + Modal.confirm(data.errorTitle, data.errorMessage, top.TYPO3.Severity.error, [ { text: TYPO3.lang['button.cancel'], active: true, trigger: function() { - top.TYPO3.Modal.dismiss(); + Modal.dismiss(); } }, { text: TYPO3.lang['button.resolveDependenciesIgnore'], btnClass: 'btn-danger disabled t3js-dependencies', trigger: function() { Repository.getResolveDependenciesAndInstallResult(data.skipDependencyUri); - top.TYPO3.Modal.dismiss(); + Modal.dismiss(); } } ]); - top.TYPO3.Modal.currentModal.on('shown.bs.modal', function() { - var $actionButton = top.TYPO3.Modal.currentModal.find('.t3js-dependencies'); + Modal.currentModal.on('shown.bs.modal', function() { + var $actionButton = Modal.currentModal.find('.t3js-dependencies'); top.TYPO3.jQuery('input[name=unlockDependencyIgnoreButton]').on('change', function() { $actionButton.toggleClass('disabled', !$(this).prop('checked')); }); diff --git a/typo3/sysext/impexp/Resources/Public/JavaScript/ImportExport.js b/typo3/sysext/impexp/Resources/Public/JavaScript/ImportExport.js index 67d452fb4d44230f5dc5d22d97b8139449e0c7cb..c1cdd951e7f41b34f645164f16f2a41ad99bd635 100644 --- a/typo3/sysext/impexp/Resources/Public/JavaScript/ImportExport.js +++ b/typo3/sysext/impexp/Resources/Public/JavaScript/ImportExport.js @@ -14,19 +14,21 @@ /** * JavaScript to handle confirm windows in the Import/Export module */ -define(['jquery'], function ($) { +define(['jquery', 'TYPO3/CMS/Backend/Modal'], function ($, Modal) { + "use strict"; + $(function() { $(document).on('click', '.t3js-confirm-trigger', function() { - $button = $(this); - top.TYPO3.Modal.confirm($button.data('title'), $button.data('message')) + var $button = $(this); + Modal.confirm($button.data('title'), $button.data('message')) .on('confirm.button.ok', function() { $('#t3js-submit-field') .attr('name', $button.attr('name')) .closest('form').submit(); - top.TYPO3.Modal.currentModal.trigger('modal-dismiss'); + Modal.currentModal.trigger('modal-dismiss'); }) .on('confirm.button.cancel', function() { - top.TYPO3.Modal.currentModal.trigger('modal-dismiss'); + Modal.currentModal.trigger('modal-dismiss'); }); }); }); diff --git a/typo3/sysext/recycler/Resources/Public/JavaScript/Recycler.js b/typo3/sysext/recycler/Resources/Public/JavaScript/Recycler.js index 6bf9433a95308749a1a10380c39145e554c26bba..f72cefe5d134b79878dd5072500822e8b474aad4 100644 --- a/typo3/sysext/recycler/Resources/Public/JavaScript/Recycler.js +++ b/typo3/sysext/recycler/Resources/Public/JavaScript/Recycler.js @@ -14,7 +14,7 @@ /** * RequireJS module for Recycler */ -define(['jquery', 'nprogress', 'TYPO3/CMS/Backend/jquery.clearable'], function($, NProgress) { +define(['jquery', 'nprogress', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Backend/jquery.clearable'], function($, NProgress, Modal) { var Recycler = { identifiers: { searchForm: '#recycler-form', @@ -333,23 +333,24 @@ define(['jquery', 'nprogress', 'TYPO3/CMS/Backend/jquery.clearable'], function($ var $tr = $(this).parents('tr'), isMassDelete = $tr.parent().prop('tagName') !== 'TBODY'; // deleteRecord() was invoked by the mass delete button + var records, message; if (isMassDelete) { - var records = Recycler.markedRecordsForMassAction, - message = TYPO3.lang['modal.massdelete.text']; + records = Recycler.markedRecordsForMassAction; + message = TYPO3.lang['modal.massdelete.text']; } else { var uid = $tr.data('uid'), table = $tr.data('table'), - records = table + ':' + uid, - recordTitle = $tr.data('recordtitle'), - message = table === 'pages' ? TYPO3.lang['modal.deletepage.text'] : TYPO3.lang['modal.deletecontent.text']; - message = Recycler.createMessage(message, [recordTitle, '[' + records + ']']); + recordTitle = $tr.data('recordtitle'); + records = table + ':' + uid; + message = table === 'pages' ? TYPO3.lang['modal.deletepage.text'] : TYPO3.lang['modal.deletecontent.text']; + message = Recycler.createMessage(message, [recordTitle, '[' + records + ']']); } - top.TYPO3.Modal.confirm(TYPO3.lang['modal.delete.header'], message, top.TYPO3.Severity.error, [ + Modal.confirm(TYPO3.lang['modal.delete.header'], message, top.TYPO3.Severity.error, [ { text: TYPO3.lang['button.cancel'], trigger: function() { - top.TYPO3.Modal.dismiss(); + Modal.dismiss(); } }, { text: TYPO3.lang['button.delete'], @@ -365,21 +366,23 @@ define(['jquery', 'nprogress', 'TYPO3/CMS/Backend/jquery.clearable'], function($ var $tr = $(this).parents('tr'), isMassUndo = $tr.parent().prop('tagName') !== 'TBODY'; // undoRecord() was invoked by the mass delete button + var records, messageText, recoverPages; if (isMassUndo) { - var records = Recycler.markedRecordsForMassAction, - messageText = TYPO3.lang['modal.massundo.text'], - recoverPages = true; + records = Recycler.markedRecordsForMassAction; + messageText = TYPO3.lang['modal.massundo.text']; + recoverPages = true; } else { var uid = $tr.data('uid'), table = $tr.data('table'), - records = table + ':' + uid, - recordTitle = $tr.data('recordtitle'), - $message = null, - recoverPages = table === 'pages', - messageText = recoverPages ? TYPO3.lang['modal.undopage.text'] : TYPO3.lang['modal.undocontent.text']; - messageText = Recycler.createMessage(messageText, [recordTitle, '[' + records + ']']); + recordTitle = $tr.data('recordtitle'); + + records = table + ':' + uid; + recoverPages = table === 'pages'; + messageText = recoverPages ? TYPO3.lang['modal.undopage.text'] : TYPO3.lang['modal.undocontent.text']; + messageText = Recycler.createMessage(messageText, [recordTitle, '[' + records + ']']); } + var $message; if (recoverPages) { $message = $('<div />').append( $('<p />').text(messageText), @@ -391,11 +394,11 @@ define(['jquery', 'nprogress', 'TYPO3/CMS/Backend/jquery.clearable'], function($ $message = messageText; } - top.TYPO3.Modal.confirm(TYPO3.lang['modal.undo.header'], $message, top.TYPO3.Severity.ok, [ + Modal.confirm(TYPO3.lang['modal.undo.header'], $message, top.TYPO3.Severity.ok, [ { text: TYPO3.lang['button.cancel'], trigger: function() { - top.TYPO3.Modal.dismiss(); + Modal.dismiss(); } }, { text: TYPO3.lang['button.undo'], @@ -457,7 +460,7 @@ define(['jquery', 'nprogress', 'TYPO3/CMS/Backend/jquery.clearable'], function($ Recycler.allToggled = false; }, complete: function() { - top.TYPO3.Modal.dismiss(); + Modal.dismiss(); NProgress.done(); } }); @@ -548,15 +551,9 @@ define(['jquery', 'nprogress', 'TYPO3/CMS/Backend/jquery.clearable'], function($ $(this).addClass('disabled').find('.t3-icon').unwrap().wrap($('<span />')); }; - /** - * return the main Recycler object - * initialize once on document ready - */ - return function() { - $(document).ready(function() { - Recycler.initialize(); - }); + $(document).ready(function() { + Recycler.initialize(); + }); - return Recycler; - }(); + return Recycler; }); diff --git a/typo3/sysext/sys_action/Resources/Public/JavaScript/ActionTask.js b/typo3/sysext/sys_action/Resources/Public/JavaScript/ActionTask.js index c8b898e3cf31838ca117850d14a2789c04f65916..f3eab538215ebce60d55412c9ec7d9982bc39896 100644 --- a/typo3/sysext/sys_action/Resources/Public/JavaScript/ActionTask.js +++ b/typo3/sysext/sys_action/Resources/Public/JavaScript/ActionTask.js @@ -14,18 +14,18 @@ /** * JavaScript to handle confirm windows in the task center module */ -define(['jquery'], function ($) { +define(['jquery', 'TYPO3/CMS/Backend/Modal'], function ($, Modal) { $(function() { $(document).on('click', '.t3js-confirm-trigger', function(e) { e.preventDefault(); var $link = $(this); - top.TYPO3.Modal.confirm($link.data('title'), $link.data('message')) + Modal.confirm($link.data('title'), $link.data('message')) .on('confirm.button.ok', function() { self.location.href = $link.attr('href'); - top.TYPO3.Modal.currentModal.trigger('modal-dismiss'); + Modal.currentModal.trigger('modal-dismiss'); }) .on('confirm.button.cancel', function() { - top.TYPO3.Modal.currentModal.trigger('modal-dismiss'); + Modal.currentModal.trigger('modal-dismiss'); }); return false; });