2017-05-13 14:00:36 +08:00
|
|
|
// ==UserScript==
|
|
|
|
// @name Douban2Piratebay
|
2017-05-13 14:30:44 +08:00
|
|
|
// @namespace https://github.com/bitdust/Douban2Piratebay/
|
2020-09-17 12:40:08 +08:00
|
|
|
// @version 0.7
|
2017-05-13 14:00:36 +08:00
|
|
|
// @description And direct link to piratebay from douban movie page.
|
|
|
|
// @author bitdust
|
|
|
|
// @match https://movie.douban.com/subject/*
|
2017-05-13 15:08:33 +08:00
|
|
|
// @updateURL https://raw.githubusercontent.com/bitdust/Douban2Piratebay/master/Douban2Piratebay.meta.js
|
|
|
|
// @downloadURL https://raw.githubusercontent.com/bitdust/Douban2Piratebay/master/Douban2Piratebay.user.js
|
2017-05-13 14:00:36 +08:00
|
|
|
// @grant none
|
|
|
|
// ==/UserScript==
|
|
|
|
|
|
|
|
(function() {
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
function insertAfter(newNode, referenceNode) {
|
2021-09-04 13:51:54 +08:00
|
|
|
$(newNode).appendTo(referenceNode);
|
2017-05-13 14:00:36 +08:00
|
|
|
}
|
2017-06-06 13:27:58 +08:00
|
|
|
|
|
|
|
function addLink(fragment, text, href){
|
2021-09-04 13:51:54 +08:00
|
|
|
let a = document.createElement("a")
|
2017-06-06 13:27:58 +08:00
|
|
|
a.textContent = text;
|
|
|
|
a.href = href;
|
|
|
|
fragment.appendChild(a);
|
|
|
|
}
|
2017-05-13 15:56:20 +08:00
|
|
|
|
2017-05-13 14:00:36 +08:00
|
|
|
var links = document.querySelectorAll (
|
2021-09-04 13:51:54 +08:00
|
|
|
"#info"
|
2017-05-13 14:00:36 +08:00
|
|
|
);
|
2021-09-04 13:51:54 +08:00
|
|
|
var imdbLink = null;
|
|
|
|
var imdbindex = null;
|
|
|
|
var imdbRe=new RegExp(".*?(tt[0-9]{4,})");
|
2017-06-04 23:42:54 +08:00
|
|
|
for (var i=0; i<links.length; i++) {
|
2017-05-13 14:00:36 +08:00
|
|
|
if(imdbRe.test(links[i].textContent)) {
|
2021-09-04 13:51:54 +08:00
|
|
|
imdbLink = links[i];
|
|
|
|
imdbindex = imdbRe.exec(links[i].textContent)[1];
|
2017-05-13 14:00:36 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2017-05-13 15:56:20 +08:00
|
|
|
|
2021-09-04 13:51:54 +08:00
|
|
|
if (imdbindex !== null) {
|
2017-06-06 13:27:58 +08:00
|
|
|
var fragment = document.createDocumentFragment();
|
|
|
|
var br = document.createElement("br");
|
2021-09-04 13:51:54 +08:00
|
|
|
var span = document.createElement("span")
|
|
|
|
span.class="pl"
|
|
|
|
span.textContent = "资源: ";
|
2017-06-06 13:27:58 +08:00
|
|
|
fragment.appendChild(span);
|
|
|
|
addLink(fragment, "TPB ", 'https://thepiratebay.org/search/' + imdbindex);
|
2020-09-17 12:40:08 +08:00
|
|
|
addLink(fragment, "RARGB ", 'https://rarbgmirror.com/torrents.php?search=' + imdbindex);
|
2021-09-04 13:51:54 +08:00
|
|
|
fragment.appendChild(br);
|
|
|
|
insertAfter(fragment, imdbLink);
|
2017-06-04 23:42:54 +08:00
|
|
|
}
|
2017-05-13 14:00:36 +08:00
|
|
|
})();
|