diff --git a/README.md b/README.md index f1a45d4..d8cbe90 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,19 @@ -![](src/assets/sites.png) +![](https://i.imgur.com/MVR68qM.jpg) ## What the Extension Does - Adds a "Search on Nyaa" Button to Anime and Manga pages - Sites: **[MyAnimeList](https://i.imgur.com/1hymaOS.png), [AniList](https://i.imgur.com/DtNugQF.png), [Kitsu](https://i.imgur.com/TVKqRcK.png), [Anime-Planet](https://i.imgur.com/zohAYbs.png), [AnimeNewsNetwork](https://i.imgur.com/xOYS17r.png), [AniDB](https://i.imgur.com/pRDcUVh.png)** -- Search Parameters can be changed and saved in the [Extension Popup window](https://i.imgur.com/oiu0DZW.png) +- Search Parameters can be changed and saved in the [Extension Popup window](https://i.imgur.com/bzaChNf.png) - For Manga pages, the Category setting will search for the "Literature" equivalent - All tabs with a supported website currently open will automatically refresh on Save -- The Search will include both the Japanese(Romaji) & English titles, if they exist and are different - - as well as the base titles of each if the titles include: ("Season"|"Part"|": "|" - ") - - for example, clicking the button on [Shingeki no Kyojin Season 3 Part 2](https://myanimelist.net/anime/38524/Shingeki_no_Kyojin_Season_3_Part_2) will return the search query: - - "Shingeki no Kyojin Season 3 Part 2"|"Attack on Titan Season 3 Part 2"|"Shingeki no Kyojin"|"Attack on Titan" + +- By default the search will include both the Japanese(Romaji) & English titles — if they exist, and they are different + - the search will also add the base titles, if they include: ("Season"|"Part"|": "|" - ") + - for example, clicking the button on [Shingeki no Kyojin Season 3 Part 2](https://myanimelist.net/anime/38524/Shingeki_no_Kyojin_Season_3_Part_2) will return the search query: + - _"Shingeki no Kyojin Season 3 Part 2"|"Attack on Titan Season 3 Part 2"|"Shingeki no Kyojin"|"Attack on Titan"_ + - _**additional "Query" types are available**: the Default combines both "Exact" and "Base"._ + - Fuzzy: Searches for the site's default title only, without quotes ~ allows fuzzy matching + - Exact: Japanese and English full titles ~ searches for exact title names as written + - Base: Japanese and English base titles ~ searches with Seasons and Parts removed # Firefox - [Extension Page](https://addons.mozilla.org/en-US/firefox/addon/nyaa-linker/) diff --git a/package.json b/package.json index d63c132..b428846 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,11 @@ { "name": "nyaa-linker", - "version": "1.0.1", + "version": "1.1.0", "description": "Adds a button to Anime and Manga database websites that opens a relevant Nyaa search", "scripts": { - "zip": "cd src && zip -r nyaa-linker.zip . -x manifest-*.json && cd ..", - "firefox": "mv src/manifest-firefox.json src/manifest.json && npm run zip && mv src/manifest.json src/manifest-firefox.json", - "chrome": "mv src/manifest-chrome.json src/manifest.json && npm run zip && mv src/manifest.json src/manifest-chrome.json" + "zip": "npm run firefox && npm run chrome", + "firefox": "mv src/manifest-firefox.json src/manifest.json && cd src && zip -r nyaa-linker-%npm_package_version%-%npm_lifecycle_event%.zip . -x manifest-*.json && cd .. && mv src/manifest.json src/manifest-firefox.json", + "chrome": "mv src/manifest-chrome.json src/manifest.json && cd src && zip -r nyaa-linker-%npm_package_version%-%npm_lifecycle_event%.zip . -x manifest-*.json && cd .. && mv src/manifest.json src/manifest-chrome.json" }, "devDependencies": { "eslint": "^8.26.0", @@ -26,5 +26,5 @@ "printWidth": 150 }, "author": "Metacor (https://github.com/Metacor/nyaa-linker)", - "license": "GPLv3" + "license": "GPL-3.0-only" } diff --git a/src/assets/sites.png b/src/assets/sites.png deleted file mode 100644 index f50b829..0000000 Binary files a/src/assets/sites.png and /dev/null differ diff --git a/src/background.js b/src/background.js index 3d3da02..481e29d 100644 --- a/src/background.js +++ b/src/background.js @@ -15,6 +15,7 @@ const defaultSettings = () => { settings: { filter_setting: '0', category_setting: '1_2', + query_setting: 'default', sort_setting: 'seeders', order_setting: 'desc', }, diff --git a/src/main.js b/src/main.js index fee5f3e..3ea120c 100644 --- a/src/main.js +++ b/src/main.js @@ -19,6 +19,7 @@ const searchNyaa = () => { chrome.storage.sync.get('settings', (load) => { const filter = load.settings.filter_setting; let category = load.settings.category_setting; + const queryType = load.settings.query_setting; const sort = load.settings.sort_setting; const order = load.settings.order_setting; @@ -166,52 +167,80 @@ const searchNyaa = () => { awaitLoadOf('.nyaaBtn').then(() => { let query = `"${titleJap}"|"${titleEng}"`; + let baseJap = titleJap; + let baseEng = titleEng; - if (!titleEng || titleJap.toLowerCase() === titleEng.toLowerCase()) { - query = titleJap; - } else { + const getBase = () => { const hasSeason = /(?Raw - + + + + - + + diff --git a/src/popup/popup.js b/src/popup/popup.js index b22838b..40fcd43 100644 --- a/src/popup/popup.js +++ b/src/popup/popup.js @@ -3,6 +3,7 @@ window.onload = () => { if (load.settings) { document.getElementById('filter_select').value = load.settings.filter_setting; document.getElementById('category_select').value = load.settings.category_setting; + document.getElementById('query_select').value = load.settings.query_setting; document.getElementById('sort_select').value = load.settings.sort_setting; document.getElementById('order_select').value = load.settings.order_setting; } @@ -13,6 +14,7 @@ const saveSettings = () => { const settings = {}; settings['filter_setting'] = document.getElementById('filter_select').value; settings['category_setting'] = document.getElementById('category_select').value; + settings['query_setting'] = document.getElementById('query_select').value; settings['sort_setting'] = document.getElementById('sort_select').value; settings['order_setting'] = document.getElementById('order_select').value; return settings;