Skip to content

Instantly share code, notes, and snippets.

@subtleGradient
Last active September 19, 2020 14:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save subtleGradient/663a61bf1e9f04b00dd7943950128dcb to your computer and use it in GitHub Desktop.
Save subtleGradient/663a61bf1e9f04b00dd7943950128dcb to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name JW Image focus
// @namespace https://gist.github.com/subtleGradient/663a61bf1e9f04b00dd7943950128dcb
// @version 1.0.1
// @description Block 3rd party related images when doing Google image searches using site:jw.org
// @author Thomas Aylott
// @match https://www.google.com/search?*
// @grant none
// ==/UserScript==
;(function(){
const ID = `JW_IMAGE_FOCUS_CSS`;
console.log(ID);
let el = document.getElementById(ID);
if (el) el.parentNode.removeChild(el);
document.body.insertAdjacentHTML('beforeend', `
<style id="${ID}">
[data-p*="site:jw.org"]>[data-ved]
[data-ved][jsmodel] {
overflow: hidden;
}
[data-p*="site:jw.org"]>[data-ved]
a[data-ved][target="_blank"][href]:not([href^="https://www.jw.org"]):not([href^="https://wol.jw.org"]) {
background: black;
color: transparent;
position: relative;
padding-top: 999px;
margin-top: -999px;
pointer-events: none;
}
[data-p*="site:jw.org"]>[data-ved]
a[data-ved][target="_blank"][href]:not([href^="https://www.jw.org"]):not([href^="https://wol.jw.org"]) * {
color: transparent;
}
</style>
`);
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment