Merge pull request #2 from chickenPopcorn/master

add support for more sites
This commit is contained in:
bitdust 2017-06-06 13:03:36 +08:00 committed by GitHub
commit 819f24eff3
1 changed files with 18 additions and 10 deletions

View File

@ -22,25 +22,33 @@
); );
var imdblink = null; var imdblink = null;
var imdbRe = new RegExp("tt[0-9]{4,}"); var imdbRe = new RegExp("tt[0-9]{4,}");
for (var i=0;i<links.length;i++) { for (var i=0; i<links.length; i++) {
if(imdbRe.test(links[i].textContent)) { if(imdbRe.test(links[i].textContent)) {
imdblink = links[i]; imdblink = links[i];
break; break;
} }
} }
if (imdblink !== null) { function addLink(name, href){
var imdbindex = imdblink.innerText; let imdbindex = imdblink.innerText;
var fragment = document.createDocumentFragment(); let fragment = document.createDocumentFragment();
var br = document.createElement("br"); let br = document.createElement("br");
var parent = imdblink.parentElement; let parent = imdblink.parentElement;
var span = imdblink.previousElementSibling.cloneNode(false); let span = imdblink.previousElementSibling.cloneNode(false);
span.textContent = "海盗湾链接: "; span.textContent = name + "链接: ";
var a = imdblink.cloneNode(true); let a = imdblink.cloneNode(true);
a.href = 'https://thepiratebay.org/search/' + imdbindex; a.textContent = "下载";
a.href = href + imdbindex;
fragment.appendChild(br); fragment.appendChild(br);
fragment.appendChild(span); fragment.appendChild(span);
fragment.appendChild(a); fragment.appendChild(a);
insertAfter(fragment, imdblink); insertAfter(fragment, imdblink);
} }
if (imdblink !== null) {
addLink("电影天堂", 'http://www.btrr.net/tag/');
addLink("HD湾", 'http://www.hdwan.net/?s=');
addLink("RARGB", 'https://rarbgmirror.com/torrents.php?imdb=');
addLink("海盗湾", 'https://thepiratebay.org/search/');
}
})(); })();