@@ -14,41 +14,41 @@ public class MIRViewerConfigurationStrategy extends MCRViewerDefaultConfiguratio
1414
1515 @ Override
1616 public MCRViewerConfiguration get (HttpServletRequest request ) {
17- MCRViewerConfiguration mcrViewerConfiguration = super .get (request );
17+ MCRViewerConfiguration configuration = super .get (request );
1818 String baseURL = MCRFrontendUtil .getBaseURL (request );
1919
2020 if (!MCRXMLFunctions .isMobileDevice (request .getHeader ("User-Agent" ))) {
21- // Default Stylesheet
22- String theme = MCRConfiguration2 .getString ("MIR.Layout.Theme" ).orElse (null );
23- String file = MCRConfiguration2 .getString ("MIR.DefaultLayout.CSS" ).orElse (null );
24- if (theme != null && file != null ) {
25- String mirBootstrapCSSURL = String .format (Locale .ROOT , "%srsc/sass/mir-layout/scss/%s-%s.css" ,
26- baseURL , theme , file );
27- mcrViewerConfiguration .addCSS (mirBootstrapCSSURL );
28- }
29-
30- // customLayout Stylesheet
31- String customLayout = MCRConfiguration2 .getString ("MIR.CustomLayout.CSS" ).orElse ("" );
32- if (!customLayout .isEmpty ()) {
33- String customLayoutURL = String .format (Locale .ROOT , "%scss/%s" , baseURL , customLayout );
34- mcrViewerConfiguration .addCSS (customLayoutURL );
35- }
3621
37- String customJS = MCRConfiguration2 .getString ("MIR.CustomLayout.JS" ).orElse ("" );
38- if (!customJS .isEmpty ()) {
39- mcrViewerConfiguration .addScript (String .format (Locale .ROOT , "%sjs/%s" , baseURL , customJS ));
40- }
22+ // default Stylesheet
23+ MCRConfiguration2 .getString ("MIR.Layout.Theme" ).ifPresent (theme ->
24+ MCRConfiguration2 .getString ("MIR.DefaultLayout.CSS" ).ifPresent (file -> {
25+ String defaultCssUrl = String .format (Locale .ROOT , "%srsc/sass/mir-layout/scss/%s-%s.css" ,
26+ baseURL , theme , file );
27+ configuration .addCSS (defaultCssUrl );
28+ }));
29+
30+ // custom Stylesheet
31+ MCRConfiguration2 .getString ("MIR.CustomLayout.CSS" ).ifPresent (customCss -> {
32+ String customCssUrl = String .format (Locale .ROOT , "%scss/%s" , baseURL , customCss );
33+ configuration .addCSS (customCssUrl );
34+ });
35+
36+ // custom Script
37+ MCRConfiguration2 .getString ("MIR.CustomLayout.JS" ).ifPresent (customJs -> {
38+ String customJsUrl = String .format (Locale .ROOT , "%sjs/%s" , baseURL , customJs );
39+ configuration .addScript (customJsUrl );
40+ });
4141
4242 if (request .getParameter ("embedded" ) != null ) {
43- mcrViewerConfiguration .setProperty ("permalink.updateHistory" , false );
44- mcrViewerConfiguration .setProperty ("chapter.showOnStart" , false );
43+ configuration .setProperty ("permalink.updateHistory" , false );
44+ configuration .setProperty ("chapter.showOnStart" , false );
4545 } else {
46- // Default JS
47- mcrViewerConfiguration
48- .addScript (MCRFrontendUtil . getBaseURL () + "assets/bootstrap/js/bootstrap.min.js" );
46+ // default Script
47+ String defaultJsUrl = MCRFrontendUtil . getBaseURL () + "assets/bootstrap/js/bootstrap.min.js" ;
48+ configuration .addScript (defaultJsUrl );
4949 }
5050 }
5151
52- return mcrViewerConfiguration ;
52+ return configuration ;
5353 }
5454}
0 commit comments