Skip to content

Instantly share code, notes, and snippets.

@SharpCoder
Created August 10, 2019 20:34
Show Gist options
  • Select an option

  • Save SharpCoder/de99c19168652b5d1a1fa0d733e94d6c to your computer and use it in GitHub Desktop.

Select an option

Save SharpCoder/de99c19168652b5d1a1fa0d733e94d6c to your computer and use it in GitHub Desktop.
let shown = false;
window.onscroll = (evt) => {
const commentEl = document.getElementById("comments");
const bounding = commentEl.getBoundingClientRect();
const height = (window.innerHeight || document.documentElement.clientHeight);
if (height >= bounding.top) {
if (!shown) alert("There be dragons here!");
shown = true;
}
};
{
"name": "YouTube Dragons",
"version": "1.0",
"description": "There be dragons here!",
"content_scripts": [
{
"matches": ["https://*.youtube.com/*"],
"js": ["contentScript.js"]
}
],
"manifest_version": 2,
"permissions": [
"activeTab"
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment