Update: code

This commit is contained in:
bitdust 2017-05-13 15:56:20 +08:00
parent 6c30e0af09
commit 94e019a15a
2 changed files with 4 additions and 4 deletions

View File

@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name Douban2Piratebay // @name Douban2Piratebay
// @namespace https://github.com/bitdust/Douban2Piratebay/ // @namespace https://github.com/bitdust/Douban2Piratebay/
// @version 0.4 // @version 0.5
// @description And direct link to piratebay from douban movie page. // @description And direct link to piratebay from douban movie page.
// @author bitdust // @author bitdust
// @match https://movie.douban.com/subject/* // @match https://movie.douban.com/subject/*

View File

@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name Douban2Piratebay // @name Douban2Piratebay
// @namespace https://github.com/bitdust/Douban2Piratebay/ // @namespace https://github.com/bitdust/Douban2Piratebay/
// @version 0.4 // @version 0.5
// @description And direct link to piratebay from douban movie page. // @description And direct link to piratebay from douban movie page.
// @author bitdust // @author bitdust
// @match https://movie.douban.com/subject/* // @match https://movie.douban.com/subject/*
@ -13,10 +13,10 @@
(function() { (function() {
'use strict'; 'use strict';
// Your code here...
function insertAfter(newNode, referenceNode) { function insertAfter(newNode, referenceNode) {
referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling); referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
} }
var links = document.querySelectorAll ( var links = document.querySelectorAll (
"#info > a" "#info > a"
); );
@ -28,6 +28,7 @@
break; break;
} }
} }
if (imdblink !== null) { if (imdblink !== null) {
var imdbindex = imdblink.innerText; var imdbindex = imdblink.innerText;
var fragment = document.createDocumentFragment(); var fragment = document.createDocumentFragment();
@ -35,7 +36,6 @@
var parent = imdblink.parentElement; var parent = imdblink.parentElement;
var span = imdblink.previousElementSibling.cloneNode(false); var span = imdblink.previousElementSibling.cloneNode(false);
span.textContent = "海盗湾链接: "; span.textContent = "海盗湾链接: ";
span.class = 'pl';
var a = imdblink.cloneNode(true); var a = imdblink.cloneNode(true);
a.href = 'https://thepiratebay.org/search/' + imdbindex; a.href = 'https://thepiratebay.org/search/' + imdbindex;
fragment.appendChild(br); fragment.appendChild(br);