Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/wll8/redoc-try
Browse files Browse the repository at this point in the history
  • Loading branch information
wll8 committed Jul 15, 2023
2 parents 225b3f2 + c460ed9 commit 641beab
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dist/try.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
}
function initCss() {
// reset swagger-ui css
$('head').append("\n <style>\n /* Set the position of swaggerBox with body as the relative element */\n body {\n position: relative;\n }\n @media print, screen and (max-width: 85rem) {\n .eIeJha,\n .dtUibw {\n padding: 4px;\n }\n }\n\n .swaggerBox.hide {\n visibility: hidden;\n cursor: none;\n width: 0;\n height: 0;\n }\n .swaggerBox.show {\n visibility: visible;\n cursor: initial;\n }\n\n /* Reset the style of swagger-ui */\n .swaggerBox .swagger-ui .wrapper {\n padding: 0;\n }\n .swaggerBox .swagger-ui .download-contents {\n top: -10px;\n right: 0;\n width: initial;\n }\n\n /* Disable api bar to avoid problems */\n .swaggerBox:not(.onlySwagger) .swagger-ui .opblock .opblock-summary {\n cursor: not-allowed;\n pointer-events: none;\n }\n\n /* Disable the api bar, but exclude the authorization button */\n .swaggerBox .swagger-ui .authorization__btn {\n cursor: initial;\n pointer-events: initial;\n }\n\n .swaggerBox {\n border-radius: 4px;\n background-color: #fff;\n width: 100%;\n height: 100vh;\n position: absolute;\n top: 0;\n left: 0;\n z-index: 1;\n }\n .swaggerBox:not(.onlySwagger) {\n overflow: hidden;\n }\n /* Hide some disturbing elements */\n .swaggerBox.pure:not(.onlySwagger) .swagger-ui .opblock-summary {\n visibility: hidden;\n padding: 0;\n }\n .swaggerBox.pure:not(.onlySwagger) .opblock-section thead,\n .swaggerBox.pure:not(.onlySwagger) .swagger-ui .opblock-summary * {\n display: none;\n }\n\n .swaggerBox:not(.onlySwagger) .swagger-ui .opblock .opblock-section-header,\n .swaggerBox:not(.onlySwagger) .btn.cancel,\n .swaggerBox:not(.onlySwagger) .try-out,\n .swaggerBox:not(.onlySwagger) .responses-inner>div>h4,\n .swaggerBox:not(.onlySwagger) :not(.live-responses-table).responses-table,\n .swaggerBox:not(.onlySwagger) .opblock-body > .opblock-description-wrapper {\n display: none;\n }\n\n .swaggerBox .tryBtn {\n margin-right: 10px;\n background-color: #fff;\n }\n </style>\n ");
$('head').append("\n <style>\n /* Set the position of swaggerBox with body as the relative element */\n body {\n position: relative;\n }\n @media print, screen and (max-width: 85rem) {\n .eIeJha,\n .dtUibw {\n padding: 4px;\n }\n }\n\n .swaggerBox.hide {\n visibility: hidden;\n cursor: none;\n width: 0;\n height: 0;\n }\n .swaggerBox.show {\n visibility: visible;\n cursor: initial;\n }\n\n /* Reset the style of swagger-ui */\n .swaggerBox .swagger-ui .wrapper {\n padding: 0;\n }\n .swaggerBox .swagger-ui .download-contents {\n top: -10px;\n right: 0;\n width: initial;\n }\n\n /* Disable api bar to avoid problems */\n .swaggerBox:not(.onlySwagger) .swagger-ui .opblock .opblock-summary {\n cursor: not-allowed;\n pointer-events: none;\n }\n\n /* Disable the api bar, but exclude the authorization button */\n .swaggerBox .swagger-ui .authorization__btn {\n cursor: initial;\n pointer-events: initial;\n }\n\n .swaggerBox {\n border-radius: 4px;\n background-color: #fff;\n width: 100%;\n height: 100vh;\n position: absolute;\n top: 0;\n left: 0;\n z-index: 1;\n }\n .swaggerBox:not(.onlySwagger) {\n overflow: hidden;\n }\n /* Hide some disturbing elements */\n .swaggerBox.pure:not(.onlySwagger) .swagger-ui .opblock-summary {\n visibility: hidden;\n padding: 0;\n }\n .swaggerBox.pure:not(.onlySwagger) .opblock-section thead,\n .swaggerBox.pure:not(.onlySwagger) .swagger-ui .opblock-summary * {\n display: none;\n }\n\n .swaggerBox:not(.onlySwagger) .swagger-ui .opblock .opblock-section-header,\n .swaggerBox:not(.onlySwagger) .btn.cancel,\n .swaggerBox:not(.onlySwagger) .try-out,\n .swaggerBox:not(.onlySwagger) .responses-inner>div>h4,\n .swaggerBox:not(.onlySwagger) :not(.live-responses-table).responses-table,\n .swaggerBox:not(.onlySwagger) .opblock-body > .opblock-description-wrapper {\n display: none;\n }\n .swaggerBox:not(.onlySwagger) .block div>span:last-child .operation-tag-content>span:last-child {\n display: block;\n margin-bottom: 100vh;\n }\n .swaggerBox .tryBtn {\n margin-right: 10px;\n background-color: #fff;\n }\n </style>\n ");
}
function initSwagger(swaggerOptions) {
// dom
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
!window.initTryOptions.openApi && (delete window.initTryOptions.openApi);
</script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/bundles/redoc.standalone.min.js"> </script>
<script src="https://cdn.jsdelivr.net/gh/wll8/[email protected].2/dist/try.js"></script>
<script src="https://cdn.jsdelivr.net/gh/wll8/[email protected].3/dist/try.js"></script>
<script>
// initTry(`https://petstore.swagger.io/v2/swagger.json`)
initTry({
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Add `Try it out` function like [swagger](https://petstore.swagger.io/) on [redoc
<body>
<div id="redoc-container"></div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/bundles/redoc.standalone.min.js"> </script>
<script src="https://cdn.jsdelivr.net/gh/wll8/[email protected].2/dist/try.js"></script>
<script src="https://cdn.jsdelivr.net/gh/wll8/[email protected].3/dist/try.js"></script>
<script>
// initTry(`https://petstore.swagger.io/v2/swagger.json`)
initTry({
Expand Down
5 changes: 4 additions & 1 deletion try.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,10 @@ function initCss() {
.swaggerBox:not(.onlySwagger) .opblock-body > .opblock-description-wrapper {
display: none;
}
.swaggerBox:not(.onlySwagger) .block div>span:last-child .operation-tag-content>span:last-child {
display: block;
margin-bottom: 100vh;
}
.swaggerBox .tryBtn {
margin-right: 10px;
background-color: #fff;
Expand Down

0 comments on commit 641beab

Please sign in to comment.