// ==UserScript== // @version 1.0 // @name Douban Rating // @author Zhou Meng // @description Show Douban Rating in Douban List // @include http://*.douban.com/doulist/* // ==/UserScript== if ('undefined' == typeof __PAGE_SCOPE_RUN__) { //把当前脚本注入到页面 //http://wiki.greasespot.net/Content_Scope_Runner (function page_scope_runner() { var my_src = "(" + page_scope_runner.caller.toString() + ")();"; var script = document.createElement('script'); script.setAttribute("type", "text/javascript"); script.textContent = "var __PAGE_SCOPE_RUN__ = true;\n" + my_src; setTimeout(function() { document.body.appendChild(script); document.body.removeChild(script); }, 0); })(); return; } else { Do(function() { $("div.article table").each(function(i, table) { var url = $(table).find("a").attr("href"); $.get(url, function(data) { var rating = $(data).find("strong.rating_num").text(); if (rating) { $(table).find("p.pl").append("
" + "评分 : " + rating); } }); }); }); }