Skip to content

Commit

Permalink
update library
Browse files Browse the repository at this point in the history
  • Loading branch information
louisachu committed Nov 27, 2023
1 parent 82da48a commit b36f859
Showing 1 changed file with 0 additions and 33 deletions.
33 changes: 0 additions & 33 deletions src/components/CustomLibrary.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,6 @@ import React from 'react'

const CustomLibrary = () => (
<script src="https://cdn.redoc.ly/reference-docs/latest/redocly-reference-docs.min.js">
<script> {
window.onload = () => {
console.log("window load")
const imageElement = document.getElementById("operation/v1/images/generations")
const firstElement = imageElement.firstElementChild
const newImg = document.createElement('img');
imageElement.insertBefore(newImg, firstElement);
const sampleBlock = document.querySelector('div[data-cy="samples-block"]');
const config = {childList: true, subtree: true};
const callback = (mutationList, observer) => {
for (const mutation of mutationList) {
if (mutation.type === "childList") {
console.log("node has been added or removed");
}
}
const responseBody = imageElement.querySelector('div[data-cy="console-response-body"]');
if (responseBody && window.getComputedStyle(responseBody).display !== "none") {
const responseList = responseBody.getElementsByClassName("string");
for (let i = 0; i < responseList.length; i++) {
if (responseList[i].innerHTML === '"base64"') {
var pic = responseList[i + 1].innerHTML.replaceAll("\"", "");
newImg.src = 'data:image/jpeg;base64,' + pic;
newImg.style.width = "500px";
newImg.style.height = "500px";
}
}
}
}
const observer = new MutationObserver(callback);
observer.observe(sampleBlock, config);
}
}
</script>
</script>
);

Expand Down

0 comments on commit b36f859

Please sign in to comment.