diff options
author | V <v@anomalous.eu> | 2023-10-07 07:50:14 +0200 |
---|---|---|
committer | V <v@anomalous.eu> | 2023-10-07 07:50:14 +0200 |
commit | aea7bf718ded8b679877ee4480fe9d612d2ec4a5 (patch) | |
tree | ffc9a884d12ec35c2ce8a94823686c307c4957be | |
parent | 85b56739de7568cf5d2523b7d00c197939cee979 (diff) | |
download | refined-nixpkgs-aea7bf718ded8b679877ee4480fe9d612d2ec4a5.tar.zst |
Improve comments
-rw-r--r-- | content.js | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/content.js b/content.js index 4ef1f33..ab6931e 100644 --- a/content.js +++ b/content.js @@ -1,24 +1,24 @@ function sprongulate() { // Since GitHub is an SPA, we can't limit ourselves to only loading on - // specifically nixpkgs PRs, as synthetic browser navigation doesn't - // trigger content script loading. Thus, we have to load on all pages, - // and ensure we're on a nixpkgs PR before running. + // Nixpkgs PRs, as synthetic browser navigation doesn't trigger content + // script loading. Thus, we have to load on any GitHub URL, rerun on + // navigation, and ensure we're on a Nixpkgs PR before continuing. const [, NixOS, nixpkgs, pull, number] = new URL(window.location.href).pathname.split('/') if (NixOS !== 'NixOS' || nixpkgs !== 'nixpkgs' || pull !== 'pull') return // There are (at the time of writing) two contexts in which the PR // number is visible: // - // 1. in the header (following the PR title) - // 2. sufficiently far down that the header is no longer visible (at + // 1. In the header (following the PR title). + // 2. Sufficiently far down that the header is no longer visible (at // which point the header shrinks and affixes itself to the top of - // the page) + // the page). // - // These are actually two distinct elements, the visibility of which - // are dependent on your scroll position. They also have completely + // These are actually two distinct elements: the visibility of each + // is dependent on your scroll position. They also have completely // different (and nondescript) CSS selectors, so instead of looking // for them directly, we locate the immediately preceding PR title - // elements (which *do* have a common CSS selector), to find them. + // element (which *does* have a common CSS selector), to find them. for (let node of document.querySelectorAll('.js-issue-title')) { node = node.nextElementSibling const a = document.createElement('a') |