Fix: less insert operation.
This commit is contained in:
parent
819f24eff3
commit
7c96e524ba
|
@ -1,7 +1,7 @@
|
|||
// ==UserScript==
|
||||
// @name Douban2Piratebay
|
||||
// @namespace https://github.com/bitdust/Douban2Piratebay/
|
||||
// @version 0.5
|
||||
// @version 0.6
|
||||
// @description And direct link to piratebay from douban movie page.
|
||||
// @author bitdust
|
||||
// @match https://movie.douban.com/subject/*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// ==UserScript==
|
||||
// @name Douban2Piratebay
|
||||
// @namespace https://github.com/bitdust/Douban2Piratebay/
|
||||
// @version 0.5
|
||||
// @version 0.6
|
||||
// @description And direct link to piratebay from douban movie page.
|
||||
// @author bitdust
|
||||
// @match https://movie.douban.com/subject/*
|
||||
|
@ -17,6 +17,13 @@
|
|||
referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
|
||||
}
|
||||
|
||||
function addLink(fragment, text, href){
|
||||
let a = imdblink.cloneNode(true);
|
||||
a.textContent = text;
|
||||
a.href = href;
|
||||
fragment.appendChild(a);
|
||||
}
|
||||
|
||||
var links = document.querySelectorAll (
|
||||
"#info > a"
|
||||
);
|
||||
|
@ -29,26 +36,18 @@
|
|||
}
|
||||
}
|
||||
|
||||
function addLink(name, href){
|
||||
let imdbindex = imdblink.innerText;
|
||||
let fragment = document.createDocumentFragment();
|
||||
let br = document.createElement("br");
|
||||
let parent = imdblink.parentElement;
|
||||
let span = imdblink.previousElementSibling.cloneNode(false);
|
||||
span.textContent = name + "链接: ";
|
||||
let a = imdblink.cloneNode(true);
|
||||
a.textContent = "下载";
|
||||
a.href = href + imdbindex;
|
||||
if (imdblink !== null) {
|
||||
var imdbindex = imdblink.innerText;
|
||||
var fragment = document.createDocumentFragment();
|
||||
var br = document.createElement("br");
|
||||
var span = imdblink.previousElementSibling.cloneNode(false);
|
||||
span.textContent = "资源:";
|
||||
fragment.appendChild(br);
|
||||
fragment.appendChild(span);
|
||||
fragment.appendChild(a);
|
||||
addLink(fragment, "TPB ", 'https://thepiratebay.org/search/' + imdbindex);
|
||||
addLink(fragment, "RARGB ", 'https://rarbgmirror.com/torrents.php?imdb=' + imdbindex);
|
||||
addLink(fragment, "HD湾 ", 'http://www.hdwan.net/?s=' + imdbindex);
|
||||
addLink(fragment, "电影天堂 ", 'http://www.btrr.net/?s=' + imdbindex);
|
||||
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/');
|
||||
}
|
||||
})();
|
||||
|
|
Loading…
Reference in New Issue