1616@basset (' https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme@3.0.0/Material/css/theme-gray.min.css' , false )
1717<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 >
1818@bassetBlock (' elfinderThemeSwitcherScript.js' )
19- <script type =" text/javascript" >
20- document .addEventListener (' DOMContentLoaded' , function () {
19+ <script type =" module" >
2120 function getElfinderStyleSheet (main = true ) {
2221 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"]' );
2322 // Find the main elfinder stylesheet
@@ -50,7 +49,7 @@ function addElfinderLightStylesheet() {
5049 }
5150
5251 let colorMode = window .parent .colorMode ? .result ?? window .colorMode ? .result ?? false ;
53-
52+
5453 if (colorMode !== ' dark' ) {
5554 addElfinderLightStylesheet ();
5655 }
@@ -69,23 +68,20 @@ function addElfinderLightStylesheet() {
6968 // in case we switched to dark mode, remove the ligth theme css
7069 if (scheme === ' dark' ) {
7170 selectedLinkElement .parentNode .removeChild (selectedLinkElement);
72- return true ;
71+ return true ;
7372 }
7473 addElfinderLightStylesheet ()
7574 });
7675 }
77-
78- });
7976< / script>
8077@endBassetBlock
78+
8179@if ($styleBodyElement ?? false )
82- < script type= " text/javascript" >
83- document .addEventListener (' DOMContentLoaded' , function () {
84- // we dont want to style the body when elfinder is loaded as a component in a backpack view
85- // we pass true when loading elfinder inside an iframe to style the iframe body.
86- // use the topbar and footbar darker color as the background to ease transitions
87- document .getElementsByTagName (' body' )[0 ].style .background = ' #061325' ;
88- document .getElementsByTagName (' body' )[0 ].style .opacity = 1 ;
89- });
80+ < script type= " module" >
81+ // we dont want to style the body when elfinder is loaded as a component in a backpack view
82+ // we pass true when loading elfinder inside an iframe to style the iframe body.
83+ // use the topbar and footbar darker color as the background to ease transitions
84+ document .getElementsByTagName (' body' )[0 ].style .background = ' #061325' ;
85+ document .getElementsByTagName (' body' )[0 ].style .opacity = 1 ;
9086< / script>
9187@endif
0 commit comments