Skip to content

Commit

Permalink
v1.16.2 - small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
clutterskull committed Nov 30, 2021
1 parent b9972e5 commit e7c9d87
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nzbunity",
"version": "1.16.1",
"version": "1.16.2",
"license": "MPL-2.0",
"description": "Send and control NZB files directly with SABnzbd or NZBGet download clients.",
"author": "clutterskull@gmail.com",
Expand Down
20 changes: 10 additions & 10 deletions src/content/sites/nzbfinder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ class NZBUnityNzbfinder {
}

getLinkContainer(link: HTMLElement): HTMLElement {
return link.closest(this.isList(link) ? 'tr' : 'article');
return link.closest(this.isList(link) ? 'tr' : 'article') ?? link.closest('#buttongroup');
}

getFirstChild(container: HTMLElement): HTMLElement {
return container.querySelector(':scope > :first-child') as HTMLElement;
}

getCategory(link: HTMLElement): string {
const cat = this.getLinkContainer(link).querySelector('#catname')?.textContent.trim();
const cat = this.getLinkContainer(link)?.querySelector('#catname')?.textContent.trim();

if (/^\w+$/.test(cat)) {
// If the category is a single word, it's probably a sub-category
Expand All @@ -70,17 +70,17 @@ class NZBUnityNzbfinder {
const a = el as HTMLElement;
const guidMatch = a.getAttribute('href').match(/\/getnzb\?id=([\w-]+)/i) as string[];
const id = guidMatch && guidMatch[1];
const url = this.getNzbUrl(id);

// Get the category
let category = this.getCategory(a) ?? '';
const opts:CreateAddLinkOptions = { url, category };
const opts: CreateAddLinkOptions = {
url: this.getNzbUrl(id),
category: this.getCategory(a),
};

if (window.location.pathname.startsWith('/details')) {
// Item detail
const catLink = document.querySelectorAll('table a[href*="/browse/"]:not([href*="/browse/group?"])');
if (catLink.length) {
opts.category = (catLink[0] as HTMLElement).innerText.trim();
const catLink = document.querySelector('table a[href*="/browse/"]:not([href*="/browse/group?"])');
if (catLink) {
opts.category = (catLink as HTMLElement).innerText.trim();
}

if (this.replace) {
Expand Down Expand Up @@ -114,13 +114,13 @@ class NZBUnityNzbfinder {
// List
const link = PageUtil.createAddUrlLink(opts)
.addClass(this.getFirstChild(a).classList.value)
.removeClass('h-5 w-5')
.css({ display: 'inline', height: '', width: '' })
.insertBefore(a);

link.find('> img')
.css({ display: 'inline' });

a.parentElement.style.minWidth = `75px`;
} else {
// Covers
PageUtil.createAddUrlLink(opts)
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "NZB Unity",
"version": "1.16.1",
"version": "1.16.2",
"author": "clutterskull@gmail.com",
"description": "Send and control NZB files directly with SABnzbd or NZBGet download clients.",
"background": {
Expand Down

0 comments on commit e7c9d87

Please sign in to comment.