// ==UserScript== // @name DoubanMoviePlus // @namespace ziz.zway.xyz // @version 0.2.0 // @description 为豆瓣电影加入IMDB评分、调整布局 // @author Zzway // @match http*://movie.douban.com/subject/* // @exclude http*://movie.douban.com/subject/*/questions* // @grant GM_xmlhttpRequest // @downloadURL none // ==/UserScript== $(document).ready(function(){ //显示IMDB评分 var imdbtt=$("#info a[href^='http://www.imdb.com/title']").text(); var ratinghref=$("#info a[href^='http://www.imdb.com/title']").attr("href")+"/ratings"; if(imdbtt !== ""){ console.log("imdb:"+imdbtt); GM_xmlhttpRequest({ method: "GET", url: "https://p.media-imdb.com/static-content/documents/v1/title/"+imdbtt+"/ratings%3Fjsonp=imdb.rating.run:imdb.api.title.ratings/data.json", onload: function(response) { var imdb={},myImdb imdb.rating = { response: {}, elems: {} } imdb.rating.run=function (response){myImdb=response} eval(response.responseText) console.log("myImdb:"+myImdb.resource.rating) $("#interest_sectl .rating_wrap").after("
"); $("#interest_sectl .rating_imdb").append("IMDB评分
"); $("#interest_sectl .rating_imdb").append("
"); $(" .rating_imdb .rating_content_wrap").append(""+myImdb.resource.rating+""); $(" .rating_imdb .rating_content_wrap").append(""+myImdb.resource.ratingCount+"人评价"); $("#imdbRating").css({"color":"#deaa26"}); $(".rating_imdb span").first().css({"font-size":"12px"}); } }); $("#interest_sectl .rating_logo").hide();//隐藏“豆瓣评分”四个字 } $("#comments-section i:first").text("短评"); var comments=$("#comments-section").clone(true); $("#comments-section").remove(); if($(".mr10:contains(看过)").text() !== ""){//看过的片子,简介移到侧栏,短评移到自评下 if($(".related-info .a_show_full").text() !== ""){ $(".related-info #link-report").text($(".related-info .hidden").text());//展开简介 } var tempContent=$(".related-info").clone(true); $(".related-info").remove(); $("#subject-others-interests").after(tempContent); $(".indent.clearfix").after(comments); }else{ //没看过的片子,短评移到图片下 $("#related-pic").after(comments); } //豆瓣App讨论移到底 // var appd=$("#app-discuss").clone(true); // $("#app-discuss").remove(); // $(".discussion_link").after(appd); //推荐电影移到侧栏,默认隐藏海报 $(".recommendations-bd dt").hide(); $(".recommendations-bd").css({"margin-right":"70px"}); $(".recommendations-bd dd").css({"background-color":"#E5F1FA","border-radius":"3px"}); $(".recommendations-bd dl").mouseover(function(){ $(this).children().fadeIn(); $(this).children("dd").css({"background-color":"#FFFFFF"}); }); $("#recommendations h2").click(function(){ $(".recommendations-bd dt").slideToggle(); }); $(".recommendations-bd").mouseleave(function(){ $(this).children().children("dd").css({"background-color":"#E5F1FA"}); $(".recommendations-bd dt").slideUp(); }); var rcmd=$("#recommendations").clone(true); $("#recommendations").remove(); $("#subject-others-interests").before(rcmd); //影评过滤 var reviews=$("div.review"); var filter=["文/","题记","烂片","不谢","戳中","微信公号","我的微信"]; //$("body").append(''); if(reviews.length>1 && filter.length>0){ for (var i=0; i 0){ //console.log(filter[j]); var pos=text.indexOf(filter[j]); text=text.slice(pos-6,pos+8); $(this).html(text); break; } } }); } } //可以考虑更多过滤条件,比如:句号超过80个,"我们"超过3个 });