Skip to content
This repository has been archived by the owner on Nov 11, 2024. It is now read-only.

Commit

Permalink
Fixed magnet links not showing on certain pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Niamor committed Apr 4, 2016
1 parent 49e7db3 commit 97ad7e8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
'use strict';

const parseTorrent = require('parse-torrent');
const url = document.URL;

if (!location.search || location.search === -1 ||
location.search.indexOf('page=search') !== -1) {
if (url.indexOf('page=search') !== -1 ||
url.indexOf('user=') !== -1 ||
url.indexOf('page=') === -1) {
$(() => {
$('[title="Download"]').each((i, el) => {
const elem = $(el);
Expand All @@ -19,7 +21,7 @@ if (!location.search || location.search === -1 ||
});
});
});
} else if (location.search.indexOf('page=view') !== -1) {
} else if (url.indexOf('page=view') !== -1) {
const button = $('.viewdownloadbutton');
parseTorrent.remote(location.protocol + button.find('a').attr('href'), (err, parsedTorrent) => {
const magnetButton = $('<div/>', {
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "Nyaa Magnet Links",
"version": "0.1.1",
"version": "0.1.2",

"description": "Add magnet links on NyaaTorrents",
"homepage_url": "https://github.com/Niamor/nyaa-magnet-links",
Expand Down

0 comments on commit 97ad7e8

Please sign in to comment.