diff --git a/index.js b/index.js index 019244c..db76305 100644 --- a/index.js +++ b/index.js @@ -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); @@ -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 = $('
', { diff --git a/manifest.json b/manifest.json index 21f9452..84f8f40 100644 --- a/manifest.json +++ b/manifest.json @@ -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",