Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Metacor committed Nov 24, 2022
0 parents commit 586b0a3
Show file tree
Hide file tree
Showing 20 changed files with 1,902 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
### Local Setup

- **Fork the Project**
- **Clone the Repository:** `git clone https://github.com/<YOUR-USERNAME>/nyaa-linker.git`
- **Install Dependencies:** `yarn`
- **Create a Feature Branch:** `git checkout -b feature/feature-name` _or_ `git checkout -b fix/problem-name`

### Test Changes

**Firefox**: `about:debugging#/runtime/this-firefox`

- _rename `manifest-firefox.json` to `manifest.json`_
- _click on the `Load Temporary Add-on...` button_
- _select the `manifest.json` file_

**Chrome**: `chrome://extensions/`

- _rename `manifest-chrome.json` to `manifest.json`_
- _click on the `Load unpacked` button_
- _select the `src` folder_

### Submit Changes

- **Stage changes:** `git add .`
- **Commit changes:** `git commit -m "add: Feature Name"`
_or_ `git commit -m "fix: Problem Name"`
- _for simple documentation changes, use Github's default `"Update file.name"`_
- **Push changes:** `git push origin feature/feature-name` _or_ `git push origin head`
- **Submit a Pull Request on Github:** _if your Feature resolves an Issue, add `fix #XXX` in the description_
29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Bug Report
description: Report a Bug that you've found.
labels: [bug]
body:
- type: textarea
attributes:
label: Issue
description: What happened, and how can the Bug be reproduced? Provide Screenshots if possible.
placeholder: 'Please only add one Bug per Bug Report.'
validations:
required: true
- type: textarea
attributes:
label: Expected Behavior
description: What would you normally expect to happen?
validations:
required: true
- type: input
attributes:
label: Which Browser, and Browser Version are you using?
placeholder: 'Chrome, Version 105.0.5195.127'
validations:
required: true
- type: input
attributes:
label: Which Extension Version are you using?
placeholder: 'v1.2.3'
validations:
required: true
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Feature Request
description: Suggest new Features to be added.
labels: [feature request]
body:
- type: textarea
attributes:
label: Proposal
description: Explain the Feature that you would like to be added.
placeholder: 'Please only add one Feature per Feature Request.'
validations:
required: true
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Node
node_modules
package-lock.json

# Log Files
*.log*

# Compressed Files
*.zip
*.rar
*.xpi

# Mac
.DS_Store

# Visual Studio Code
.vscode

# Sublime Text
*.sublime-workspace
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
## What the Extension Does:

- Adds a "Search on Nyaa" Button to [Anime and Manga pages](src/assets/sites.png)
- 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/Ash7DPT.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"

## Firefox - [Extension Page](https://addons.mozilla.org/en-US/firefox/addon/nyaa-linker/)

## Chrome - ~~Extension Page~~

> I don't have a Chrome Developer Account, Chrome Users will need to manually install the Extension for now
- Download Chrome.zip from the [Latest Release](https://github.com/Metacor/nyaa-linker/releases)
- [Enable "Developer mode" in Chrome](https://i.imgur.com/h7kvj1h.png)
- [Drag and Drop](https://i.imgur.com/u9LzP57.png) "nyaa-linker.zip" onto the "chrome://extensions" page

### If the Extension only activates after you click the Popup:

- Enable Permissions
- **Firefox**: about:addons
- Click on the "Nyaa Linker" Extension
- Click on the "Permissions" tab
- [Enable Permissions for the websites you use](https://i.imgur.com/DWbinsN.png)
- **Chrome**: chrome://extensions
- Click on "Details" under the "Nyaa Linker" Extension
- [Enable Permissions for the websites you use](https://i.imgur.com/Qe3TD7i.png)
- Optionally: Right-click the Extension icon and enable for each site: [Firefox](https://i.imgur.com/XHziPTB.png) | [Chrome](https://i.imgur.com/RjMCZSK.png)

### If you wish to submit a Pull Request, please read the [Contributing Guide](https://github.com/Metacor/nyaa-linker/blob/main/.github/CONTRIBUTING.md)
30 changes: 30 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "nyaa-linker",
"version": "1.0.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"
},
"devDependencies": {
"eslint": "^8.26.0",
"prettier": "^2.7.1"
},
"eslintConfig": {
"extends": [
"eslint:recommended",
"prettier"
]
},
"prettier": {
"trailingComma": "es5",
"tabWidth": 4,
"semi": true,
"singleQuote": true,
"bracketSpacing": true,
"printWidth": 150
},
"author": "Metacor <Metacor.Code@gmail.com> (https://github.com/Metacor/nyaa-linker)",
"license": "GPLv3"
}
Binary file added src/assets/icon-128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/icon-16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/icon-48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/sites.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions src/background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
const cringeSites = ['kitsu.io/*', 'anilist.co/*'];
const skip = ['/episodes', '/chapters', '/characters', '/watch', '/reactions', '/franchise', '/staff', '/reviews', '/stats', '/social'];
for (const site in cringeSites) {
if (changeInfo.status === 'complete' && tab.url.match(cringeSites[site]) && !skip.some((e) => tab.url.includes(e))) {
chrome.tabs.sendMessage(tabId, { type: 'tabUpdated', url: tab.url });
}
}
});

chrome.runtime.onInstalled.addListener((e) => e.reason === 'install' && defaultSettings());

const defaultSettings = () => {
chrome.storage.sync.set({
settings: {
filter_setting: '0',
category_setting: '1_2',
sort_setting: 'seeders',
order_setting: 'desc',
},
});
};
Loading

0 comments on commit 586b0a3

Please sign in to comment.