// ==UserScript== // @name Douban-Info-for-PTP&HDB // @namespace https://github.com/techmovie/Douban-Info-for-PTP // @version 0.5.4 // @description 在ptp和hdb电影详情页展示部分中文信息 // @author birdplane // @match https://passthepopcorn.me/torrents.php?id=* // @match https://hdbits.org/details.php?id=* // @grant GM_addStyle // @grant GM_xmlhttpRequest // @note 2021-01-12 支持hdb剧集 // @note 2021-01-24 修改豆瓣评分样式 // @downloadURL none // ==/UserScript== (()=>{var x=GM_addStyle(` .contentlayout.douban-info { display: flex; justify-content: space-around; } .contentlayout.douban-info .detail{ flex:1; } .detail .title{ font-size: 26px; font-weight: 600; margin-bottom: 20px; } .detail .title a{ text-decoration: none; } .movie-detail{ display: flex; justify-content: space-between; } .movie-detail .synopsis { width: 60%; } .movie-detail .movieinfo { margin-right: 20px; max-width: 30%; } .icon-pt1{ font-size: 14px; display: inline-block; text-align: center; border: 1px solid #41be57; background-color: #41be57; color: white; border-top-left-radius: 4px; border-bottom-left-radius: 4px; width: 24px; height: 24px; line-height: 24px; } .icon-pt2{ display: inline-block; text-align: center; border: 1px solid #41be57; color: #3ba94d; background: #ffffff; border-top-right-radius: 4px; border-bottom-right-radius: 4px; width: 69px; height: 24px; line-height: 24px; font-size: 14px; } .cast-empty{ background-image: url(GM.getResourceUrl("emptyIcon")); width: auto; display: flex; align-content: center; align-items: center; flex-wrap: wrap; overflow: hidden; height: 100%; background-position: center center; background-repeat: no-repeat; background-color: #dbdbdb; box-sizing: border-box; background-size: 50%; text-overflow: ellipsis; } .cast-item{ margin-top: 10px; margin-bottom: 10px; flex-shrink: 0; display: inline-block; margin-left: 10px; margin-right: 4px; width: 138px; background-color: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); padding-bottom: 10px; border-radius: 6px; overflow: hidden; } .cast-item-image{ width: 138px; height: 175px; display:block; overflow: hidden; } .cast-item .actor-name{ color: #000; font-weight: bold; padding: 10px 10px 0; } `);var a="https://omit.mkrobot.org/movie/infos",p="https://movie.douban.com/j/subject_suggest",l={PTP:"passthepopcorn.me",HDB:"hdbits.org"},c=()=>{let t=location.host,e="";try{return Object.keys(l).forEach(i=>{let r=l[i];r&&r===t&&(e=i)}),e}catch(i){i.message!=="end loop"&&console.log(i)}},o=c(),s=o==="HDB"&&!!$(".showlinks")[0],n=null;o==="PTP"&&(n=$("#imdb-title-link").attr("href"));o==="HDB"&&!s&&(n=$(".contentlayout h1 a").attr("href"));s&&(n=$("#details .showlinks li").eq(1).find("a").attr("href"));var g=/tt\d+/.exec(n)[0];GM_xmlhttpRequest({method:"GET",url:`${p}?q=${g}`,onload(t){let e=JSON.parse(t.responseText);if(e.length>0){let i=e[0].id;s?f(i):v(i)}}});var f=t=>{GM_xmlhttpRequest({url:`${a}/${t}`,onload(e){let i=JSON.parse(e.responseText);d(i.data)}})},v=t=>{GM_xmlhttpRequest({url:`${a}/${t}`,onload(e){let i=JSON.parse(e.responseText);console.log(i),o==="PTP"&&m(i.data),o==="HDB"&&d(i.data)}})},d=t=>{let e=`