Skip to content

Commit

Permalink
build(deps-dev): Bump swagger-ui-dist from 5.10.5 to 5.11.2 (#122)
Browse files Browse the repository at this point in the history
* build(deps-dev): Bump swagger-ui-dist from 5.10.5 to 5.11.2

Bumps [swagger-ui-dist](https://github.com/swagger-api/swagger-ui) from 5.10.5 to 5.11.2.
- [Release notes](https://github.com/swagger-api/swagger-ui/releases)
- [Changelog](https://github.com/swagger-api/swagger-ui/blob/master/.releaserc)
- [Commits](swagger-api/swagger-ui@v5.10.5...v5.11.2)

---
updated-dependencies:
- dependency-name: swagger-ui-dist
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* fix logo swapper

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: uzlopak <[email protected]>
  • Loading branch information
dependabot[bot] and Uzlopak authored Jan 31, 2024
1 parent 5119f09 commit 0d94fe3
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
33 changes: 27 additions & 6 deletions lib/swagger-initializer.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,26 @@ function swaggerInitializer (opts) {
const logoData = `data:${opts.logo.type};base64,${logoBase64}`

return `window.onload = function () {
function waitForElement(selector) {
return new Promise(resolve => {
if (document.querySelector(selector)) {
return resolve(document.querySelector(selector));
}
const observer = new MutationObserver(mutations => {
if (document.querySelector(selector)) {
observer.disconnect();
resolve(document.querySelector(selector));
}
});
// If you get "parameter 1 is not of type 'Node'" error, see https://stackoverflow.com/a/77855838/492336
observer.observe(document.body, {
childList: true,
subtree: true
});
});
}
function resolveUrl(url) {
const anchor = document.createElement('a')
anchor.href = url
Expand Down Expand Up @@ -35,12 +55,13 @@ function swaggerInitializer (opts) {
const logoData = '${logoData}'
if (logoData && resConfig.layout === 'StandaloneLayout') {
const link = document.querySelector('#swagger-ui > section > div.topbar > div > div > a')
const img = document.createElement('img')
img.height = 40
img.src = logoData
link.innerHTML = ''
link.appendChild(img)
waitForElement('#swagger-ui > section > div.topbar > div > div > a').then((link) => {
const img = document.createElement('img')
img.height = 40
img.src = logoData
link.innerHTML = ''
link.appendChild(img)
})
}
ui.initOAuth(${serialize(opts.initOAuth)})
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"fs-extra": "^11.0.0",
"qs": "^6.11.0",
"standard": "^17.0.0",
"swagger-ui-dist": "5.10.5",
"swagger-ui-dist": "5.11.2",
"tap": "^18.6.1",
"tsd": "^0.30.0"
},
Expand Down

0 comments on commit 0d94fe3

Please sign in to comment.