Skip to content

Instantly share code, notes, and snippets.

@indiamos
Last active July 8, 2024 03:17
Show Gist options
  • Save indiamos/59ccb31d699ea64881776a236ac7424f to your computer and use it in GitHub Desktop.
Save indiamos/59ccb31d699ea64881776a236ac7424f to your computer and use it in GitHub Desktop.
Replaces an impossible-to-out-specify element style
(() => {
const resizeObserver = new ResizeObserver(() => {
const viewerBody = document.querySelectorAll("article.viewer__body");
viewerBody.forEach((node) => {
node.setAttribute(
"style",
"color:#FADA5E!important;font-family:ScalaSansOT,Literata;line-height:2;font-size: 24px;"
);
node
.querySelectorAll("p")
.forEach((span) => span.removeAttribute("style"));
node
.querySelectorAll("p>span")
.forEach((span) => span.removeAttribute("style"));
});
document.querySelectorAll("p+br").forEach((br) => br.remove());
});
resizeObserver.observe(document.querySelector(".js-episode-viewer"));
})();
// Minified and wrapped in a bookmarklet:
// javascript:void(new ResizeObserver((()=>{document.querySelectorAll("article.viewer__body").forEach((e=>{e.setAttribute("style","color:#FADA5E!important;font-family:ScalaSansOT,Literata;line-height:2;font-size: 24px;"),e.querySelectorAll("p").forEach((e=>e.removeAttribute("style"))),e.querySelectorAll("p>span").forEach((e=>e.removeAttribute("style")))})),document.querySelectorAll("p+br").forEach((e=>e.remove()))})).observe(document.querySelector(".js-episode-viewer")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment