You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
896 B

11 months ago
  1. function waitForElm(selector) {
  2. return new Promise(resolve => {
  3. if (document.querySelector(selector)) {
  4. return resolve(document.querySelector(selector));
  5. }
  6. const observer = new MutationObserver(mutations => {
  7. if (document.querySelector(selector)) {
  8. resolve(document.querySelector(selector));
  9. observer.disconnect();
  10. }
  11. });
  12. observer.observe(document.body, {
  13. childList: true,
  14. subtree: true
  15. });
  16. });
  17. }
  18. // Force change the Swagger logo in the header
  19. waitForElm('.topbar-wrapper').then((elm) => {
  20. if (window.SWAGGER_DOCS_ENV === 'development') {
  21. elm.innerHTML = `<img href='${window.location.origin}' src='http://localhost:3000/public/anything-llm-light.png' width='200'/>`
  22. } else {
  23. elm.innerHTML = `<img href='${window.location.origin}' src='${window.location.origin}/anything-llm-light.png' width='200'/>`
  24. }
  25. });