text: "use strict";
  
  // desired git repository websites' hostnames
  const REPO_HOSTNAMES = [
    "github",
    "gitlab",
    "bitbucket",
    "gitbucket",
    "sourceforge",
  ];
  
  // Listen for messages from the popup.
  extensionApi.runtime.onMessage.addListener((msg, sender, response) => {
    if (msg.from === "popup" && msg.subject === "repolinks") {
      // get all <a> tags in the document
      const anchorTags = document.getElementsByTagName("a");
  
      // store all matching url hostnames in foundRepoURLs
      const foundRepoURLs = [];
      for (const tag of anchorTags) {
        const tagURL = new URL(tag.href);
        const tagURLHostname = tagURL.hostname;
        const tagHostnameNoDomain = tagURLHostname.slice(
          0,
          tagURLHostname.length - 4
        );
        for (const hostname of REPO_HOSTNAMES) {
          if (tagHostnameNoDomain === hostname) {
            const foundRepoURL = {
              href: tagURL.href,
              hostname: tagHostnameNoDomain,
            };
            foundRepoURLs.push(foundRepoURL);
          }
        }
      }
  
      // send data to popup
      response(foundRepoURLs);
    }
  });
  
  extensionApi.runtime.sendMessage({
    from: "content",
    subject: "showBrowserAction",
  });
  