3434@endBassetBlock
3535<span data-elfinder-light-theme-url =" {{ Basset:: getUrl (' https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme@3.0.0/Material/css/theme-gray.min.css' ) } }" style =" display :none " ></span >
3636@bassetBlock (' elfinderThemeSwitcherScript.js' )
37- <script type =" text/javascript" >
38- document .addEventListener (' DOMContentLoaded' , function () {
37+ <script type =" module" >
3938 function getElfinderStyleSheet (main = true ) {
4039 const regex = new RegExp (main ? ` RobiNN1\/ elFinder-Material-Theme@3.0.0\/ Material\/ css\/ theme\. min\. css` : ` RobiNN1\/ elFinder-Material-Theme@3.0.0\/ Material\/ css\/ theme-gray\. min\. css` ); const linkElements = document .querySelectorAll (' link[rel="stylesheet"]' );
4140 // Find the main elfinder stylesheet
@@ -68,7 +67,7 @@ function addElfinderLightStylesheet() {
6867 }
6968
7069 let colorMode = window .parent .colorMode ? .result ?? window .colorMode ? .result ?? false ;
71-
70+
7271 if (colorMode !== ' dark' ) {
7372 addElfinderLightStylesheet ();
7473 }
@@ -87,23 +86,20 @@ function addElfinderLightStylesheet() {
8786 // in case we switched to dark mode, remove the ligth theme css
8887 if (scheme === ' dark' ) {
8988 selectedLinkElement .parentNode .removeChild (selectedLinkElement);
90- return true ;
89+ return true ;
9190 }
9291 addElfinderLightStylesheet ()
9392 });
9493 }
95-
96- });
9794< / script>
9895@endBassetBlock
96+
9997@if ($styleBodyElement ?? false )
100- < script type= " text/javascript" >
101- document .addEventListener (' DOMContentLoaded' , function () {
102- // we dont want to style the body when elfinder is loaded as a component in a backpack view
103- // we pass true when loading elfinder inside an iframe to style the iframe body.
104- // use the topbar and footbar darker color as the background to ease transitions
105- document .getElementsByTagName (' body' )[0 ].style .background = ' #061325' ;
106- document .getElementsByTagName (' body' )[0 ].style .opacity = 1 ;
107- });
98+ < script type= " module" >
99+ // we dont want to style the body when elfinder is loaded as a component in a backpack view
100+ // we pass true when loading elfinder inside an iframe to style the iframe body.
101+ // use the topbar and footbar darker color as the background to ease transitions
102+ document .getElementsByTagName (' body' )[0 ].style .background = ' #061325' ;
103+ document .getElementsByTagName (' body' )[0 ].style .opacity = 1 ;
108104< / script>
109105@endif
0 commit comments