From dd20acd78471b378b6e8657980afaec048d043fb Mon Sep 17 00:00:00 2001 From: Rob Garrison Date: Sun, 24 Mar 2019 18:08:01 -0500 Subject: [PATCH] Fix USO install button Narcolepticinsomniac worked out the code --- content/install-hook-userstyles.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/content/install-hook-userstyles.js b/content/install-hook-userstyles.js index 76cf4ade..d21e4d2f 100644 --- a/content/install-hook-userstyles.js +++ b/content/install-hook-userstyles.js @@ -456,3 +456,15 @@ if (location.search.includes('category=')) { }).observe(document, {childList: true, subtree: true}); }); } + +if (/^https?:\/\/userstyles\.org\/styles\/\d{3,}/.test(location.href)) { + new MutationObserver((_, observer) => { + const cssButton = document.getElementsByClassName('css_button'); + if (cssButton.length) { + // Click on the "Show CSS Code" button to workaround the JS error + cssButton[0].click(); + cssButton[0].click(); + observer.disconnect(); + } + }).observe(document, {childList: true, subtree: true}); +}