Skip to content

Commit

Permalink
fix: sub-domains
Browse files Browse the repository at this point in the history
  • Loading branch information
Metacor committed Nov 25, 2022
1 parent 986cceb commit 1544f5f
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nyaa-linker",
"version": "1.0.0",
"version": "1.0.1",
"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 ..",
Expand Down
4 changes: 2 additions & 2 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ const searchNyaa = () => {

btnSpace = document.querySelector('.mainEntry');
createBtn();
btn.classList.add('button', 'screenshots');
const buttons = document.getElementsByClassName('button screenshots');
btn.classList.add('button');
const buttons = document.querySelectorAll('.mainEntry > .button');
for (const button in buttons) {
typeof buttons[button] === 'object' && (buttons[button].style.width = '180px');
}
Expand Down
14 changes: 7 additions & 7 deletions src/manifest-chrome.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"name": "Nyaa Linker",
"version": "1.0.0",
"version": "1.0.1",
"description": "Adds a button to Anime and Manga database websites that opens a relevant Nyaa search",
"manifest_version": 3,

"background": { "service_worker": "background.js" },
"content_scripts": [
{
"matches": [
"https://myanimelist.net/*",
"https://anilist.co/*",
"https://kitsu.io/*",
"https://www.anime-planet.com/*",
"https://www.animenewsnetwork.com/encyclopedia/*",
"https://anidb.net/*"
"*://*.myanimelist.net/*",
"*://*.anilist.co/*",
"*://*.kitsu.io/*",
"*://*.anime-planet.com/*",
"*://*.animenewsnetwork.com/encyclopedia/*",
"*://*.anidb.net/*"
],
"js": ["main.js"]
}
Expand Down
14 changes: 7 additions & 7 deletions src/manifest-firefox.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"name": "Nyaa Linker",
"version": "1.0.0",
"version": "1.0.1",
"description": "Adds a button to Anime and Manga database websites that opens a relevant Nyaa search",
"manifest_version": 2,

"background": { "scripts": ["background.js"] },
"content_scripts": [
{
"matches": [
"https://myanimelist.net/*",
"https://anilist.co/*",
"https://kitsu.io/*",
"https://www.anime-planet.com/*",
"https://www.animenewsnetwork.com/encyclopedia/*",
"https://anidb.net/*"
"*://*.myanimelist.net/*",
"*://*.anilist.co/*",
"*://*.kitsu.io/*",
"*://*.anime-planet.com/*",
"*://*.animenewsnetwork.com/encyclopedia/*",
"*://*.anidb.net/*"
],
"js": ["main.js"]
}
Expand Down
2 changes: 2 additions & 0 deletions src/popup/popup.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ select {
width: 70%;
background: var(--clrAccent);
color: var(--clrDark);
margin-top: 0.1rem;
text-indent: 0.1rem;
}

#save {
Expand Down
2 changes: 1 addition & 1 deletion src/popup/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ document.getElementById('save').onclick = () => {
chrome.tabs.query({}, (tabs) => {
const manifestSites = chrome.runtime.getManifest().content_scripts[0].matches;
for (const tab in tabs) {
manifestSites.some((e) => tabs[tab].url.match(e)) && chrome.tabs.reload(tabs[tab].id);
manifestSites.some((e) => tabs[tab].url.match(e.split('*://*.').pop())) && chrome.tabs.reload(tabs[tab].id);
}
window.close();
});
Expand Down

0 comments on commit 1544f5f

Please sign in to comment.