59e92cb03c75190c8b996235b734a0d678206eeb
2 * This file is part of the TYPO3 CMS project.
4 * It is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU General Public License, either version 2
6 * of the License, or any later version.
8 * For the full copyright and license information, please read the
9 * LICENSE.txt file that was distributed with this source code.
11 * The TYPO3 project - inspiring people to share!
15 * Module: TYPO3/CMS/Backend/Viewport
16 * Handles the main logic of the TYPO3 backend viewport
17 * @exports TYPO3/CMS/Backend/Viewport
20 'TYPO3/CMS/Backend/Viewport',
28 initialize: function() {
29 TYPO3
.Backend
.doLayout();
30 $(document
).on('resize', TYPO3
.Backend
.doLayout
);
33 * This function is triggered whenever a re-layouting of component is needed
35 doLayout: function () {
36 TYPO3
.Backend
.NavigationContainer
.cleanup();
37 TYPO3
.Backend
.NavigationContainer
.calculateScrollbar();
38 $('.t3js-topbar-header').css('padding-right', $('.t3js-scaffold-toolbar').outerWidth());
39 if (typeof Ext
.getCmp('typo3-pagetree') !== 'undefined') {
40 Ext
.getCmp('typo3-pagetree').doLayout();
45 require(['nprogress'], function(NProgress
) {
46 NProgress
.configure({parent
: '.t3js-scaffold-content-module', showSpinner
: false});
51 require(['nprogress'], function(NProgress
) {
56 NavigationContainer
: {
58 refreshTree: function() {
59 if (typeof Ext
.getCmp('typo3-pagetree') !== 'undefined') {
60 Ext
.getCmp('typo3-pagetree').activeTree
.refreshTree();
65 $('.t3js-scaffold').toggleClass('scaffold-content-navigation-expanded')
68 $('.t3js-scaffold-modulemenu').removeAttr('style');
69 $('t3js-scaffold-content').removeAttr('style');
72 $('.t3js-topbar-button-navigationcomponent').css('visibility', 'hidden');
73 $('.t3js-scaffold').removeClass('scaffold-content-navigation-expanded');
74 $('.t3js-scaffold-content-module').removeAttr('style');
76 show: function (component
) {
77 $('.t3js-topbar-button-navigationcomponent').css('visibility', 'visible');
78 if(component
!== undefined) {
79 $('.t3js-scaffold').addClass('scaffold-content-navigation-expanded');
81 $('.t3js-scaffold-content-navigation [data-component]').hide();
82 $('.t3js-scaffold-content-navigation [data-component=' + component
+ ']').show();
84 setUrl: function(urlToLoad
) {
85 $('.t3js-scaffold').addClass('scaffold-content-navigation-expanded');
86 $('.t3js-scaffold-content-navigation-iframe').attr('src', urlToLoad
);
89 return $('.t3js-scaffold-content-navigation-iframe').attr('src');
94 calculateScrollbar: function (){
95 TYPO3
.Backend
.NavigationContainer
.cleanup();
96 var $scaffold
= $('.t3js-scaffold');
97 var $moduleMenuContainer
= $('.t3js-scaffold-modulemenu');
98 var $contentContainer
= $('.t3js-scaffold-content');
99 var $moduleMenu
= $('.t3js-modulemenu');
100 $moduleMenuContainer
.css('overflow', 'auto');
101 var moduleMenuContainerWidth
= $moduleMenuContainer
.outerWidth();
102 var moduleMenuWidth
= $moduleMenu
.outerWidth();
103 $moduleMenuContainer
.removeAttr('style').css('overflow', 'hidden');
104 if ($scaffold
.hasClass('scaffold-modulemenu-expanded') === false) {
105 $moduleMenuContainer
.width(moduleMenuContainerWidth
+ (moduleMenuContainerWidth
- moduleMenuWidth
));
106 $contentContainer
.css('left', moduleMenuContainerWidth
+ (moduleMenuContainerWidth
- moduleMenuWidth
))
108 $moduleMenuContainer
.removeAttr('style');
109 $contentContainer
.removeAttr('style');
111 $moduleMenuContainer
.css('overflow', 'auto');
118 // @deprecated since TYPO3 v8, will be removed in v9.
119 // Use top.TYPO3.Backend.ContentContainer.get() instead of top.TYPO3.Backend.ContentContainer.iframe
120 'iframe': $('.t3js-scaffold-content-module-iframe')[0].contentWindow
,
122 return $('.t3js-scaffold-content-module-iframe')[0].contentWindow
;
124 setUrl: function (urlToLoad
) {
125 TYPO3
.Backend
.Loader
.start();
126 $('.t3js-scaffold-content-module-iframe')
127 .attr('src', urlToLoad
)
128 .one('load', function() {
129 TYPO3
.Backend
.Loader
.finish();
133 return $('.t3js-scaffold-content-module-iframe').attr('src');
135 refresh: function() {
138 getIdFromUrl: function() {
140 return TYPO3
.Utility
.getParameterFromUrl(this.getUrl
, 'id');
148 // start the module menu app
149 TYPO3
.Backend
.initialize();
150 return TYPO3
.Backend
;