修复以适配豆瓣改版
This commit is contained in:
parent
cca05088bb
commit
0067f0aae9
|
@ -14,38 +14,40 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function insertAfter(newNode, referenceNode) {
|
function insertAfter(newNode, referenceNode) {
|
||||||
referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
|
$(newNode).appendTo(referenceNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
function addLink(fragment, text, href){
|
function addLink(fragment, text, href){
|
||||||
let a = imdblink.cloneNode(true);
|
let a = document.createElement("a")
|
||||||
a.textContent = text;
|
a.textContent = text;
|
||||||
a.href = href;
|
a.href = href;
|
||||||
fragment.appendChild(a);
|
fragment.appendChild(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
var links = document.querySelectorAll (
|
var links = document.querySelectorAll (
|
||||||
"#info > a"
|
"#info"
|
||||||
);
|
);
|
||||||
var imdblink = null;
|
var imdbLink = null;
|
||||||
var imdbRe = new RegExp("tt[0-9]{4,}");
|
var imdbindex = null;
|
||||||
|
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];
|
||||||
|
imdbindex = imdbRe.exec(links[i].textContent)[1];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (imdblink !== null) {
|
if (imdbindex !== null) {
|
||||||
var imdbindex = imdblink.innerText;
|
|
||||||
var fragment = document.createDocumentFragment();
|
var fragment = document.createDocumentFragment();
|
||||||
var br = document.createElement("br");
|
var br = document.createElement("br");
|
||||||
var span = imdblink.previousElementSibling.cloneNode(false);
|
var span = document.createElement("span")
|
||||||
span.textContent = "资源:";
|
span.class="pl"
|
||||||
fragment.appendChild(br);
|
span.textContent = "资源: ";
|
||||||
fragment.appendChild(span);
|
fragment.appendChild(span);
|
||||||
addLink(fragment, "TPB ", 'https://thepiratebay.org/search/' + imdbindex);
|
addLink(fragment, "TPB ", 'https://thepiratebay.org/search/' + imdbindex);
|
||||||
addLink(fragment, "RARGB ", 'https://rarbgmirror.com/torrents.php?search=' + imdbindex);
|
addLink(fragment, "RARGB ", 'https://rarbgmirror.com/torrents.php?search=' + imdbindex);
|
||||||
insertAfter(fragment, imdblink);
|
fragment.appendChild(br);
|
||||||
|
insertAfter(fragment, imdbLink);
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
Loading…
Reference in New Issue