您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds average rating of film to film pages
当前为
// ==UserScript== // @name Letterboxd Average Rating // @namespace https://github.com/rcalderong/userscripts // @description Adds average rating of film to film pages // @copyright 2014, Ramón Calderón (http://rcalderon.es) // @homepageURL https://github.com/rcalderong/userscripts // @supportURL https://github.com/rcalderong/userscripts/issues // @icon https://raw.githubusercontent.com/rcalderong/userscripts/master/img/letterboxd_icon.png // @license GPLv3; http://www.gnu.org/licenses/gpl.html // @version 1.1 // @include /^http:\/\/(www.)?letterboxd.com\/film\/[\w|\-]+\/$/ // @grant none // ==/UserScript== (function () { var newElt, // Element with average rating to be inserted in page newInnerElt, // Element with average rating to be inserted in page rating5, // Average rating of the film in a five-star scale rating10, // Average rating of the film in a one-to-ten scale ratingsElt; // Page element of the ratings section // Get average rating from page metadata ratingsElt = document.querySelector(".ratings-histogram-chart"); rating10 = ratingsElt.querySelector("span meta").getAttribute("content"); rating5 = (rating10 / 2).toFixed(1); // Create element to be inserted in page newElt = document.createElement("a"); newElt.className = "rating-green tooltip"; newElt.setAttribute("href", ratingsElt.querySelector("h3 a").getAttribute("href")); newElt.setAttribute("title", rating5.replace(/\./, ",") + " stars"); newElt.setAttribute("style", "position: absolute; top: 0; left: 72px;"); newInnerElt = document.createElement("span"); newInnerElt.className = "rating rated-" + Math.round(rating10); newElt.appendChild(newInnerElt); // Insert element in page ratingsElt.insertBefore(newElt, ratingsElt.children[1]); }());