<commit_before>class NZBUnityNzbgeek {
  public replace:boolean = false;

  constructor() {
    Util.storage.get(['Providers', 'ReplaceLinks'])
      .then((opts) => {
        this.replace = opts.ReplaceLinks;
        let provider = opts.Providers && opts.Providers.nzbgeek;
        let enabled:boolean = provider ? provider.Enabled : true;

        if (enabled) {
          console.info(`[NZB Unity] Initializing 1-click functionality...`);
          this.initializeLinks();
        } else {
          console.info(`[NZB Unity] 1-click functionality disabled for this site`);
        }
      });
  }

  // getNzbUrl(id:string):string {
  //   return `${this.apiurl}?user=${this.username}&api=${this.apikey}&id=${id}`;
  // }

  initializeLinks() {
    // Create direct download links
    // I'm not a huge fan of matching against the download icon, but it works for this site without hitting multiple links in the same row.
    $('img[src$="download.png"]').closest('a[href*="getnzb"]').each((i, el) => {
      let a:JQuery<HTMLElement> = $(el);
      let row:JQuery<HTMLElement> = a.closest('tr[id^="guid"]');

      // Get the category
      let category:string = '';
      let catSrc:string = 'default';
      let pathSearch:string = window.location.pathname + window.location.search;

      if (row.find('a[href*="geekseek.php?c="]').length) {
        // Standard page
        category = row.find('a[href*="geekseek.php?c="]').text().split(/\s*>\s*/)[0];
        catSrc = 'row';
      } else if (pathSearch.match(/^\/geekseek.php\?c=/)) {
        // Category search
        let match:string[] = $('center > font[size="4"] > b').text().match(/your seek returned [\d,]+ ([^,]+)/i);
        if (match) {
          category = match[1];
          catSrc = 'header'
        }
      }

      let opts:CreateAddLinkOptions = { url: a.attr('href'), category: category };

      if (this.replace) {
        PageUtil.bindAddUrl(opts, a, true);
      } else {
        let link:JQuery<HTMLElement> = PageUtil.createAddUrlButton(opts)
          .on('nzb.success', (e) => {
            link.closest('tr').find('a[href*="details"]').first()
              .prepend('<img src="pics/downloaded.png" class="hastip" title="" style="width:13px;margin-right:.25em;" border="0">');
          })
          .insertAfter(a);
      }
    });
  }
}

$(($) => {
  let nzbIntegration = new NZBUnityNzbgeek();
});
<commit_msg>Minor fix for NZBGeek changes<commit_after>class NZBUnityNzbgeek {
  public replace:boolean = false;

  constructor() {
    Util.storage.get(['Providers', 'ReplaceLinks'])
      .then((opts) => {
        this.replace = opts.ReplaceLinks;
        let provider = opts.Providers && opts.Providers.nzbgeek;
        let enabled:boolean = provider ? provider.Enabled : true;

        if (enabled) {
          console.info(`[NZB Unity] Initializing 1-click functionality...`);
          this.initializeLinks();
        } else {
          console.info(`[NZB Unity] 1-click functionality disabled for this site`);
        }
      });
  }

  // getNzbUrl(id:string):string {
  //   return `${this.apiurl}?user=${this.username}&api=${this.apikey}&id=${id}`;
  // }

  initializeLinks() {
    // Create direct download links
    // I'm not a huge fan of matching against the download icon, but it works for this site without hitting multiple links in the same row.
    $('img[src$="download.png"]').closest('a').each((i, el) => {
      let a:JQuery<HTMLElement> = $(el);
      let row:JQuery<HTMLElement> = a.closest('tr[id^="guid"]');

      // Get the category
      let category:string = '';
      let catSrc:string = 'default';
      let pathSearch:string = window.location.pathname + window.location.search;

      if (row.find('a[href*="geekseek.php?c="]').length) {
        // Standard page
        category = row.find('a[href*="geekseek.php?c="]').text().split(/\s*>\s*/)[0];
        catSrc = 'row';
      } else if (pathSearch.match(/^\/geekseek.php\?c=/)) {
        // Category search
        let match:string[] = $('center > font[size="4"] > b').text().match(/your seek returned [\d,]+ ([^,]+)/i);
        if (match) {
          category = match[1];
          catSrc = 'header'
        }
      }

      let opts:CreateAddLinkOptions = { url: a.attr('href'), category: category };

      if (this.replace) {
        PageUtil.bindAddUrl(opts, a, true);
      } else {
        let link:JQuery<HTMLElement> = PageUtil.createAddUrlButton(opts)
          .on('nzb.success', (e) => {
            link.closest('tr').find('a[href*="details"]').first()
              .prepend('<img src="pics/downloaded.png" class="hastip" title="" style="width:13px;margin-right:.25em;" border="0">');
          })
          .insertAfter(a);
      }
    });
  }
}

$(($) => {
  let nzbIntegration = new NZBUnityNzbgeek();
});

{'fraction_non_alphanumeric': 0.1834097540641934, 'fraction_numerical': 0.004168403501458941, 'mean_word_length': 2.6001500375093776, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '638861', 'n_tokens_mistral': 1568, 'n_tokens_neox': 1530, 'n_words': 298}