From 159e44a19d5cd3cc08d486c3f6bdbbca1f732f1b Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Wed, 25 Apr 2018 22:39:17 -0400 Subject: [PATCH] Block "Pardon the interruption" popup This blocks the annoying "Pardon the interruption" dialog without preventing other parts of the UI from working correctly (basically. see comments). --- content.js | 13 +++++++++++++ medium.css | 4 +--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/content.js b/content.js index 3d324e2..d79668b 100644 --- a/content.js +++ b/content.js @@ -9,6 +9,19 @@ var makeReadable = function() { topNav.classList.remove('u-fixed'); } + // Remove the "Pardon the interruption" popup. + // We do this with JS because the .overlay.overlay--lighter element is used + // for interactions we consent to, like the sign up / log in dialogs, so we + // don't want to obliterate them too. + // FIXME: prevent this from breaking signup/login dialogs when the popup + // is removed (it works after changing pages). + var headings = document.evaluate("//h1[contains(., 'Pardon the interruption.')]", document, null, XPathResult.ANY_TYPE, null ); + var thisHeading = headings.iterateNext(); + if (thisHeading != null) { + var $overlay = thisHeading.parentNode.parentNode.parentNode.parentNode; + $overlay.parentNode.removeChild($overlay); + } + // Inject remaining styles // This check makes sure the extension works on Chrome and Firefox. if (typeof browser === 'undefined') { diff --git a/medium.css b/medium.css index f3aa7e7..2c8f601 100644 --- a/medium.css +++ b/medium.css @@ -6,9 +6,7 @@ .openInAppButton, .js-stickyFooter, .js-upgradeMembershipAction, -.butterBar--privacy, -.overlay, -.overlay--lighter { +.butterBar--privacy { display: none; }