");
metascore.html('Metascore');
return metascore.append($('
').attr('href', imdb_href + '/' + 'criticreviews?ref_=tt_ov_rt').text(score));
} else if (text.indexOf('Popularity') !== -1) {
popularity = $("
");
Popularity = $(item).find('span.subText').html();
return popularity.html('流行度 ' + Popularity + '
');
} else if (text.indexOf('Reviews') !== -1) {
return null;
}
};
// add IMDB top 250 tag
if (ratingValue >= 8) {
getDoc('https://m.imdb.com/chart/top', meta, function (doc, res, meta) {
var list = res.responseText.match(/data-tconst="(tt\d{7})"/g);
//console.log(list);
var number = list.indexOf('data-tconst="tt' + imdb_id + '"') + 1;
if (number < 1 || number > 250) return;
// inject css if needed
if (document.getElementsByClassName('top250').length === 0) {
var style = document.createElement('style');
style.innerHTML = '.top250{background:url(https://s.doubanio.com/f/movie/f8a7b5e23d00edee6b42c6424989ce6683aa2fff/pics/movie/top250_bg.png) no-repeat;width:150px;font:12px Helvetica,Arial,sans-serif;margin:5px 0;color:#744900}.top250 span{display:inline-block;text-align:center;height:18px;line-height:18px}.top250 a,.top250 a:link,.top250 a:hover,.top250 a:active,.top250 a:visited{color:#744900;text-decoration:none;background:none}.top250-no{width:34%}.top250-link{width:66%}';
document.head.appendChild(style);
}
var after = document.getElementById('dale_movie_subject_top_icon');
if (!after)
after = document.querySelector('h1');
after.insertAdjacentHTML('beforebegin', '
');
[].forEach.call(document.getElementsByClassName('top250'), function (e) {
e.style.display = 'inline-block';
});
});
}
update_site_online_sites(title_en, true);
update_site_sub_sites(title_en, true);
update_site_offline_sites(title_en, true, imdb_id);
$('div.article #info').append('
生成信息: ').append(movieinfo);
// put on more ratings
for (i = 0, len = titleReviewBarItem.length; i < len; i++) {
item = titleReviewBarItem[i];
parse(item);
}
if (metascore || popularity || reviews) {
if (metascore) {
rating_more.append(metascore);
}
if (popularity) {
rating_more.append(popularity);
}
if (reviews) {
rating_more.append(reviews);
}
} else {
rating_more.remove();
}
return null;
});
}
// get Chinese title
var title, title_en, title_sec;
title = title_sec = $('#content > h1 > span')[0].textContent.split(' ');
title = title.shift();
title_sec = title_sec.join(' ').trim();
title_en = '';
update_site_online_sites(title);
update_site_offline_sites(title);
update_site_sub_sites(title);
update_site_pt_sites(title, false);
// add link to BIG poster
let posterAnchor = document.querySelector('#mainpic > a');
if (posterAnchor) {
// get the posters page's URL via movie.douban.com's customs
let url = window.location.href;
let urlTrimmed = url.slice(0, 42);
let postersUrl = urlTrimmed + "photos?type=R";
// ajax call on the posters page's URL
let xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
let tempDiv = document.createElement('div');
tempDiv.innerHTML = this.responseText;
let aPosterUrl = tempDiv.querySelector('.article > ul > li:nth-child(1) > div.cover > a').getAttribute('href');
// ajax call on the 1st poster's page
let xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
let tempDiv = document.createElement('div');
tempDiv.innerHTML = this.responseText;
let hdPosterAnchor = tempDiv.querySelector('span.magnifier > a');
let info = document.querySelector('#info');
// info.appendChild(hdPosterAnchor);
$('#mainpic p.gact').after(hdPosterAnchor);
}
};
xhttp.open("GET", aPosterUrl, true);
xhttp.send();
// another ajax ends
}
};
xhttp.open("GET", postersUrl, true);
xhttp.send();
}
//get torrents info from NexusPHP sites
function NexusPHP(site, search_prefix, torrent_table_selector) {
function Get_Search_Page(site, search_prefix, parser_func) {
//console.log("Start Searching in Site " + site + " ."+search_prefix );
GM_xmlhttpRequest({
method: 'GET',
url: search_prefix,
onload: function (res) {
if (/(login|verify|returnto)[.=]/.test(res.finalUrl)) {
//console.log("May Not Login in Site " + site + ". With finalUrl: " + res.finalUrl);
} else {
//console.log("Get Search Pages Success in Site " + site + ".");
var doc = (new DOMParser()).parseFromString(res.responseText, 'text/html');
var body = doc.querySelector("body");
var page = $(body); // 构造 jQuery 对象
try {
parser_func(res, doc, body, page);
//console.log("End of Search in Site " + site + ".");
} catch (error) {
//console.log("An error occurred when parser in Site " + site + ". With Error information: " + error + ". Please opening a issues to report at https://github.com/Rhilip/PT-help/issues/2");
}
}
},
onerror: function (res) {
//console.log("An error occurred when searching in Site " + site + " .With finalUrl: " + res.finalUrl + ". Your computer may not be able to access this site.");
}
});
}
Get_Search_Page(site, search_prefix, function (res, doc, body, page) {
var url_prefix = /pt\.whu\.edu\.cn|whupt\.net|hudbt\.hust\.edu\.cn/.test(res.finalUrl) ? "" : (res.finalUrl.match(/(https?:\/\/[^\/]+?\/).+/) || ['', ''])[1];
//console.log("Using The normal parser for NexusPHP in Site: " + site);
var psite = $('.site-pt-body a').filter(function () {
return $(this).attr('site') == site;
});
if (/没有种子|No Torrents Found|Your search did not match anything.|No torrents here|用准确的关键字重试/.test(res.responseText)) {
//console.log("No any torrent find in Site " + site + ".");
$(psite).css("background-color", "#f4eac2");
$(psite).attr('stat', 'none');
return;
}
var tr_list = page.find(torrent_table_selector || "table.torrents:last > tbody > tr:gt(0)");
//console.log("Get " + tr_list.length + " records in Site " + site + ".");
if (tr_list.length) {
$(psite).css("background-color", "#e3f1ed");
$(psite).attr('stat', 'true');
}
else {
$(psite).css("background-color", "#f4eac2");
$(psite).attr('stat', 'none');
}
});
}
// edu ipv6 sites
NexusPHP("BYR", "https://bt.byr.cn/torrents.php?incldead=1&search_area=4&search=" + imdb_id);
NexusPHP("WHUPT", "https://pt.whu.edu.cn/torrents.php?incldead=1&search=" + imdb_id, "table.torrents:last > tbody > tr");
NexusPHP("HUDBT", "https://hudbt.hust.edu.cn/torrents.php?incldead=1&search_area=4&search=" + imdb_id, "table.torrents:last > tbody > tr");
NexusPHP("NPUPT", "https://npupt.com/torrents.php?incldead=1&sort=10&imdb=tt" + imdb_id, "table#torrents_table:last > tbody > tr:gt(0)");
// chinese sites
NexusPHP("CHDBits", "https://chdbits.co/torrents.php?cat401=1&incldead=1&search_area=4&search=" + imdb_id);
NexusPHP("CMCT", "https://hdcmct.org/torrents.php?incldead=1&search_area=4&search=" + imdb_id);
NexusPHP("GZTown", "https://pt.gztown.net/torrents.php?incldead=1&search_area=4&search=" + imdb_id);
NexusPHP("HD4FANS", "https://pt.hd4fans.org/torrents.php?incldead=1&search_area=4&search=" + imdb_id);
NexusPHP("HDChina", "https://hdchina.org/torrents.php?incldead=1&search_area=4&search_mode=0&search=" + imdb_id, "table.torrent_list:last > tbody > tr:gt(0)");
NexusPHP("HDHome", "https://hdhome.org/torrents.php?incldead=1&search_area=4&search=" + imdb_id);
NexusPHP("HDSky", "https://hdsky.me/torrents.php?incldead=1&search_area=4&search=" + imdb_id);
NexusPHP("HDTime", "https://hdtime.org/torrents.php?search=" + imdb_id);
NexusPHP("KeepFrds", "https://pt.keepfrds.com/torrents.php?search=" + imdb_id);
NexusPHP("MTeam", "https://tp.m-team.cc/movie.php?incldead=1&search_area=4&search=" + imdb_id);
NexusPHP("Ourbits", "https://ourbits.club/torrents.php?incldead=1&search_area=4&search=" + imdb_id);
NexusPHP("TLFBits", "http://pt.eastgame.org/torrents.php?incldead=1&search_area=4&search=" + imdb_id);
NexusPHP("TTG", "https://totheglory.im/browse.php?search_field=" + title, "table#torrent_table:last > tbody > tr:gt(0)");
NexusPHP("U2", "https://u2.dmhy.org/torrents.php?incldead=1&search_area=4&search=" + imdb_id);
//global sites
NexusPHP("ADC", "http://asiandvdclub.org/browse.php?descr=1&btnSubmit=Search%21&search=tt" + imdb_id, "table.torrenttable:last > tbody > tr");
NexusPHP("AHD", "https://awesome-hd.me/torrents.php?searchstr=tt" + imdb_id, "table.torrent_table:last > tbody > tr:gt(0)");
NexusPHP("HDBits", "https://hdbits.org/browse.php?&imdb=" + imdb_id);
NexusPHP("HDT", "https://hd-torrents.org/torrents.php?active=0&options=2&search=" + imdb_id, "table.mainblockcontenttt:last > tbody > tr:gt(0)");
NexusPHP("HDSpace", "https://hd-space.org/index.php?page=torrents&active=0&options=2&search=" + imdb_id, "table.lista:last > tbody > tr:gt(0)");
NexusPHP("IPT", "https://iptorrents.com/t?q=tt" + imdb_id, "table#torrents:last > tbody > tr:gt(0)");
NexusPHP("KG", "https://karagarga.in/browse.php?search_type=imdb&search=" + imdb_id, "table#browse:last > tbody > tr:gt(0)");
NexusPHP("PTP", "https://passthepopcorn.me/torrents.php?searchstr=tt" + imdb_id, "table.torrent_table:last > tbody > tr:gt(0)");
NexusPHP("Tik", "https://www.cinematik.net/browse.php?incldead=1&sort=1&type=asc&srchdtls=1&search=tt " + imdb_id, "table[cellpadding]:last > tbody > tr:gt(0)");
NexusPHP("TorViet", "http://torviet.com/torrents.php?incldead=&search_area=4&search=" + imdb_id);
NexusPHP("UHD", "https://uhdbits.org/torrents.php?searchstr=tt" + imdb_id, "table.torrent_table:last > tbody > tr:gt(0)");
NexusPHP("SC", "https://secret-cinema.pw/torrents.php?cataloguenumber=tt" + imdb_id, "div.torrent_card");
});
}
// movie blacklist on '/explore' and '/tag'
else if (location.href.startsWith('https://movie.douban.com/explore') | location.href.startsWith('https://movie.douban.com/tag/')) {
$(document).ready(function () {
// append add_blacklist button on posters
$('div.list-wp').on('mouseover', 'a.item', function () {
if ($(this).prev().is('.bl_cover')) {
$(this).prev().show();
$(this).prev().css({ "left": ($(this).offset().left + 85), "top": ($(this).offset().top) });
return;
}
var douban_id = $(this).attr('href').split('/')[4];
var title = $(this).find('img').attr('alt');
var posterid = $(this).find('img').attr('src').split('/')[7].replace('.jpg', '');
// console.log('title=' + title);
// console.log('posterid=' + posterid);
$(this).before('
');
$(this).prev().attr('title', '屏蔽' + douban_id).css({ "left": ($(this).offset().left + 85), "top": ($(this).offset().top) });
$(this).prev().click(function () {
GM_setValue('bl', GM_getValue('bl', '') + '$' + douban_id);
GM_setValue(douban_id, title + '$' + posterid);
blacklist();
});
$(this).prev().mouseover(function () {
$(this).show();
});
$(this).prev().mouseout(function () {
$(this).hide();
});
});
$('div.list-wp').on('mouseout', 'a.item', function () {
$(this).prev().hide();
});
// blacklist filter function
var blacklist = function () {
// only do this function when Ajax finished, otherwise may cause in endless loop;
if (/载入中/.test($('a.more').text())) return;
else {
var bl_list = GM_getValue('bl', '').split('$');
if (!bl_list.length) return;
for (var i = 1; i < bl_list.length; i++) {
var reg = '"' + bl_list[i] + '"';
$('a.item').filter(function () { return RegExp(reg).test($(this).html()) }).hide();
}
if ($('a.item').length < 30) {
$('.list-wp a.more').text('载入中');
$('.list-wp a.more').wrap('
');
$('.list-wp p.more').click();
}
}
}
// when something has changed in .list-wp, do blacklist()
$('div.article .list-wp').bind('DOMNodeInserted', function () {
blacklist();
});
// when .deatil-pop shows up, append add_blocklist_button to it
$('div.detail-pop').bind('DOMNodeInserted', function () {
if ($('div.detail-pop .add_blocklist').length) return;
var douban_id = $('div.detail-pop .info h3 a').first().attr('href').split('/')[4];
var add_blocklist_button = $('
屏蔽' + douban_id + '');
add_blocklist_button.click(
function () {
GM_setValue('bl', GM_getValue('bl', '') + '$' + douban_id);
var title = $('div.detail-pop .info h3 a').text();
var posterid = $('a.item').filter(function () { return RegExp('"' + douban_id + '"').test($(this).html()) }).find('img').first().attr('src').split('/')[7].replace('.jpg', '');
GM_setValue(douban_id, title + '$' + posterid);
// console.log('title=' + title);
// console.log('posterid=' + posterid);
blacklist();
});
$('div.detail-pop .collect-area').append(add_blocklist_button);
})
blacklist();
})
}
$(document).ready(function () {
// add blacklist nav-tag and page
var bl_nav = $('
黑名单');
var update_bl = function (i) {
var bl_list = GM_getValue('bl', '').split('$');
if (!bl_list.length || i >= bl_list.length) {
$('.article h2').first().text('电影黑名单 · · · · · ·');
return;
}
$('.article h2').first().text('电影黑名单 · · · · · ·正在列出第' + i + '/' + (bl_list.length - 1) + '项');
var current_id = bl_list[i];
if (RegExp('/' + current_id + '/').test($('.article .indent').html())) { update_bl(++i); return; }
var title, posterid;
function append_movie(title, posterid) {
var block_html = $('
');
var remove_blocklist_button = $('
解除屏蔽' + current_id + '');
remove_blocklist_button.click(function () {
GM_setValue('bl', GM_getValue('bl', '').replace('$' + current_id, ''));
$('.article .indent div').first().empty().append('
');
update_bl(1);
});
var refresh_blocklist_button = $('
刷新信息' + current_id + '');
refresh_blocklist_button.click(function () {
getJSON('http://api.douban.com/v2/movie/' + current_id, function (temp, url) {
if (!temp) {
alert('get info error, aborting!');
return;
}
var current_id = url.split('/')[5];
var title = temp.attrs.language == '汉语普通话' ? temp.title : temp.alt_title.split('/')[0] + ' ' + temp.title.split('/')[0];
title = title + ' (' + temp.attrs.year + ')';
var posterid = temp.image.split('/')[7].replace('.webp', '');
GM_setValue(current_id, title + '$' + posterid);
append_movie(title, posterid);
// console.log('get info from api.douban.com title=' + title + ' and posterid=' + posterid);
$('.article .indent div').first().empty().append('
');
update_bl(1);
});
});
block_html.find('div.pl2').append('
').append(remove_blocklist_button).append(refresh_blocklist_button);
$('.article .indent div').first().append(block_html);
}
var value_temp = GM_getValue(bl_list[i], '');
if (value_temp !== '') {
var title = value_temp.split('$')[0];
var posterid = value_temp.split('$')[1];
append_movie(title, posterid);
update_bl(++i);
}
else {
getJSON('http://api.douban.com/v2/movie/' + bl_list[i], function (temp, url) {
if (!temp) {
alert('get info error, aborting!');
return;
}
var current_id = url.split('/')[5];
var title = temp.attrs.country == '中国大陆' ? temp.title : temp.alt_title.split('/')[0] + ' ' + temp.title.split('/')[0];
title = title + ' (' + temp.attrs.year + ')';
var posterid = temp.image.split('/')[7].replace('.webp', '');
GM_setValue(current_id, title + '$' + posterid);
append_movie(title, posterid);
// speed control. The ratio limit of douban api is 100/hour.
sleep(1600);
update_bl(++i);
});
}
//console.log(GM_listValues());
}
bl_nav.click(function () {
$('div#wrapper').empty();
$('div#wrapper').append('
豆瓣电影黑名单
黑名单说明 · · · · · ·
黑名单功能是为了屏蔽掉一些不想在找电影时看到但又不想标记已看的片子,加入黑名单后影片将不会在选电影和分类选片页面中出现。
在选电影界面的detail-pop元素和海报右上角(将鼠标移动到影片海报上就会弹出)增加了“屏蔽该影片”按钮,点击即可一键加入黑名单。
管理功能说明 · · · · · ·
清空黑名单:把所有影片移出黑名单。
清理缓存(慎用!):重新获取黑名单中影片信息。当发现本页面中的影片信息显示不正确时,可以用这个功能强制刷新。由于douban api有每小时100次的限制,当黑名单列表过长时,此功能会出现问题。
导出黑名单:由于黑名单只能作用于本地,当多台设备想要同步黑名单时,目前只能利用手动导出导入实现。
导入黑名单:导入你想屏蔽的影片列表,注意格式。
');
$('div#wrapper .types a.bl_clear').click(function () {
GM_setValue('bl', '');
$('.article .indent').first().empty();
})
$('div#wrapper .types a.cache_clear').click(function () {
var value_temp = GM_listValues();
for (var x = 0; x < value_temp.length; x++) {
if (RegExp(reservedValues).test(value_temp[x])) continue;
GM_deleteValue(value_temp[x]);
}
$('.article .indent').first().empty().append('
');
update_bl(1);
})
$('div#wrapper .types a.bl_export').click(function () {
$('.article h2').first().text('导出黑名单 · · · · · ·');
$('.article .indent').first().empty().append('