Skip to content

Commit

Permalink
[UPDATE] Update JavaScriptModules and JS files to ES6 syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
tinzog committed Jan 20, 2025
1 parent eebd6f9 commit 850844f
Show file tree
Hide file tree
Showing 7 changed files with 392 additions and 420 deletions.
2 changes: 1 addition & 1 deletion Classes/Middleware/InjectLoadingOverlayMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
'',
false,
);
$pageRenderer->loadJavaScriptModule('TYPO3/CMS/In2publishCore/LoadingOverlay');
$pageRenderer->loadJavaScriptModule('@in2code/in2publish_core/loading-overlay.js');
$pageRenderer->addInlineLanguageLabelFile('EXT:in2publish_core/Resources/Private/Language/locallang_js.xlf');

$response = $handler->handle($request);
Expand Down
11 changes: 10 additions & 1 deletion Configuration/JavaScriptModules.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,14 @@
],
'imports' => [
'@in2code/in2publish_core/' => 'EXT:in2publish_core/Resources/Public/JavaScript/',
'@in2code/in2publish_core/backend-module.js' => 'EXT:in2publish_core/Resources/Public/JavaScript/BackendModule.js',
'@in2code/in2publish_core/backend-enhancements.js' => 'EXT:in2publish_core/Resources/Public/JavaScript/BackendEnhancements.js',
'@in2code/in2publish_core/confirmation-modal.js' => 'EXT:in2publish_core/Resources/Public/JavaScript/ConfirmationModal.js',
'@in2code/in2publish_core/context-menu-actions.js' => 'EXT:in2publish_core/Resources/Public/JavaScript/context-menu-actions.js',
'@in2code/in2publish_core/context-menu-publish-entry.js' => 'EXT:in2publish_core/Resources/Public/JavaScript/ContextMenuPublishEntry.js',
'@in2code/in2publish_core/loading-overlay.js' => 'EXT:in2publish_core/Resources/Public/JavaScript/LoadingOverlay.js',
'@typo3/core/event/debounce-event.js' => 'EXT:core/Resources/Public/JavaScript/event/debounce-event.js',
'@typo3/backend/modal.js' => 'EXT:backend/Resources/Public/JavaScript/modal.js',
'@typo3/backend/input/clearable.js' => 'EXT:backend/Resources/Public/JavaScript/input/clearable.js'
],
];
];
42 changes: 13 additions & 29 deletions Resources/Public/JavaScript/BackendEnhancements.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,22 @@
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
'use strict';

/**
* Module: TYPO3/CMS/In2publishCore/BackendEnhancements
*
* @exports TYPO3/CMS/In2publishCore/BackendEnhancements
*/
define(['nprogress'], function (nprogress) {
'use strict';

class BackendEnhancements {
import nprogress from 'nprogress';

constructor() {
this.registerNprogressHandler()
}
class BackendEnhancements {
constructor() {
this.registerNprogressHandler();
}

registerNprogressHandler() {
document.querySelectorAll('.t3-js-jumpMenuBox').forEach(
element => element.addEventListener(
'change', event => nprogress.start()
)
registerNprogressHandler() {
document.querySelectorAll('.t3-js-jumpMenuBox').forEach(
element => element.addEventListener(
'change', () => nprogress.start()
)
}
);
}
}

return new BackendEnhancements();
});
export default new BackendEnhancements();
Loading

0 comments on commit 850844f

Please sign in to comment.