diff --git a/content/content.css b/content/content.css index e94bd9a..67d664a 100644 --- a/content/content.css +++ b/content/content.css @@ -18,6 +18,7 @@ filter: alpha(opacity=5) !important; zoom: 1 !important; position: relative !important; + box-shadow: none; } .dim:not(:hover) > * > * > * { @@ -56,37 +57,3 @@ padding-right: 2rem !important; width: 100% !important; } - -body.darkMode { - -webkit-filter: invert(100%); - filter: invert(100%); -} - -body.darkMode img, -body.darkMode video, -body.darkMode :not(object):not(body) > embed, -body.darkMode object, -body.darkMode svg image, -body.darkMode [style*='background:url'], -body.darkMode [style*='background-image:url'], -body.darkMode [style*='background: url'], -body.darkMode [style*='background-image: url'], -body.darkMode [background], -body.darkMode twitterwidget, -body.darkMode .sr-reader, -body.darkMode .sr-backdrop { - -webkit-filter: invert(100%); - filter: invert(100%); -} - -body.darkMode [style*="background:url"] *, -body.darkMode [style*="background-image:url"] *, -body.darkMode [style*="background: url"] *, -body.darkMode [style*="background-image: url"] *, -body.darkMode input, -body.darkMode [background] *, -body.darkMode img[src^="https://s0.wp.com/latex.php"], -body.darkMode twitterwidget .NaturalImage-image { - -webkit-filter: invert(100%); - filter: invert(100%); -} diff --git a/content/content.js b/content/content.js index 186efea..a812d0a 100644 --- a/content/content.js +++ b/content/content.js @@ -150,10 +150,12 @@ async function doIt(response) { hideOther('premium-upsell-link', false) hideOther('gp-promo-embedded-card-three__card') hideOther('artdeco-card overflow-hidden ph1 mb2', false) + hideOtherByIndex('artdeco-tab ember-view', 1, false) } else if (res('main-toggle', false) || res('hide-premium', false)) { showOther('premium-upsell-link') showOther('gp-promo-embedded-card-three__card') showOther('artdeco-card overflow-hidden ph1 mb2', false) + showOtherByIndex('artdeco-tab ember-view', 1, false) } // Hide news @@ -171,6 +173,19 @@ async function doIt(response) { showOther('notification-badge__count') } + if (res('hide-job-guidance', true)) { + hideOther('artdeco-card mb2 pt5 pb4', false) + } else if (res('main-toggle', false) || res('hide-job-guidance', false)) { + showOther('artdeco-card mb2 pt5 pb4') + } + + // Hide AI button + if (res('hide-ai-button', true)) { + hideOther('ember-view link-without-hover-state artdeco-button', false) + } else if (res('main-toggle', false) || res('hide-ai-button', false)) { + showOther('ember-view link-without-hover-state artdeco-button') + } + oldResponse = response } @@ -216,6 +231,7 @@ async function toggleFeed(shown) { async function hideOther(className, showIcon = true, forcedMode = null) { const elements = await waitForClassName(className) + for (let el of elements) { el.classList.remove('hide', 'dim', 'showIcon') el.classList.add(forcedMode || mode) @@ -231,6 +247,22 @@ async function showOther(className) { for (let el of elements) el.classList.remove('hide', 'dim', 'showIcon') } +// Toggle arbitrary element based on index +async function hideOtherByIndex(className, index, showIcon = true) { + const elements = await waitForClassName(className) + const element = elements[index] + + element.classList.remove('hide', 'dim', 'showIcon') + element.classList.add(mode, showIcon && 'showIcon') +} + +async function showOtherByIndex(className, index) { + const elements = await waitForClassName(className) + const element = elements[index] + + element.classList.remove('hide', 'dim', 'showIcon') +} + // Block by keywords let keywordInterval @@ -398,12 +430,25 @@ async function waitForSelector(selector) { return document.querySelector(selector) } +const checkElementAndPlaceholder = (className) => { + const found = document.getElementsByClassName(className) + + if (found.length > 0) { + return Array.from(found).some((element) => + element.innerHTML.includes('skeleton') + ) + } + + return true +} + async function waitForClassName(className) { - while (!document.getElementsByClassName(className).length) { + while (checkElementAndPlaceholder(className)) { await new Promise((resolve) => { requestAnimationFrame(resolve) }) } + return document.getElementsByClassName(className) } diff --git a/popup/popup.html b/popup/popup.html index 1f4d1f9..ca9f197 100644 --- a/popup/popup.html +++ b/popup/popup.html @@ -203,14 +203,14 @@
- I'm working hard on writing the new features in this category. If you'd - like to help, please make a feature request on - github or share the - extension with your colleagues. -
+