diff --git a/share/templates/api/root/chswaggerui.tt b/share/templates/api/root/chswaggerui.tt index 01373a1eb2..e9a9f83d4c 100644 --- a/share/templates/api/root/chswaggerui.tt +++ b/share/templates/api/root/chswaggerui.tt @@ -102,24 +102,45 @@ function HideTopbarPlugin() { window.onload = function() { // Build a system - const ui = SwaggerUIBundle({ - url: "/api?swagger=1", - dom_id: '#swagger-ui', - deepLinking: true, - presets: [ - SwaggerUIBundle.presets.apis, - SwaggerUIStandalonePreset - ], - plugins: [ - SwaggerUIBundle.plugins.DownloadUrl, - HideTopbarPlugin - ], - layout: "StandaloneLayout", - //layout: "BaseLayout", - docExpansion: "none", - defaultModelsExpandDepth: 0, - validatorUrl: null - }) + if (window.matchMedia("print").matches) { + const ui = SwaggerUIBundle({ + url: "/api?swagger=1", + dom_id: '#swagger-ui', + deepLinking: true, + presets: [ + SwaggerUIBundle.presets.apis, + SwaggerUIStandalonePreset + ], + plugins: [ + SwaggerUIBundle.plugins.DownloadUrl, + HideTopbarPlugin + ], + layout: "StandaloneLayout", + //layout: "BaseLayout", + docExpansion: "full", + defaultModelsExpandDepth: 0, + validatorUrl: null + }) + } else { + const ui = SwaggerUIBundle({ + url: "/api?swagger=1", + dom_id: '#swagger-ui', + deepLinking: true, + presets: [ + SwaggerUIBundle.presets.apis, + SwaggerUIStandalonePreset + ], + plugins: [ + SwaggerUIBundle.plugins.DownloadUrl, + HideTopbarPlugin + ], + layout: "StandaloneLayout", + //layout: "BaseLayout", + docExpansion: "none", + defaultModelsExpandDepth: 0, + validatorUrl: null + }) + } window.ui = ui };