您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
Adds a button to the movie genre page to open the chart, and redirects "genre" links to the corresponding "film_genre" page.
// ==UserScript== // @name Rateyourmusic Movie Genre Chart Button // @description Adds a button to the movie genre page to open the chart, and redirects "genre" links to the corresponding "film_genre" page. // @version 1.3.2 // @namespace http://greasyfork.icu/users/908137 // @match *://rateyourmusic.com/charts/*/film/* // @match *://rateyourmusic.com/film_genre/* // @run-at document-start // @license GPLv3 // ==/UserScript== const GENRES_NEEDING_SUFFIX = ['comedy', 'experimental', 'satire']; const formatGenreName = (path, toFilmGenre = false) => { let genre = path.split('/')[2].toLowerCase(); return toFilmGenre ? genre.replace('-1', '').replace('-', '+') : genre.replace('+', '-').concat(GENRES_NEEDING_SUFFIX.includes(genre) ? '-1' : ''); }; (() => { const { pathname } = window.location; document.addEventListener('DOMContentLoaded', () => { if (pathname.startsWith('/charts/')) { document.querySelectorAll('a.genre') .forEach(link => link.href = `/film_genre/${formatGenreName(link.pathname, true)}`); } else if (pathname.startsWith('/film_genre/')) { const button = Object.assign(document.createElement('a'), { textContent: 'View genre chart', href: `/charts/top/film/all-time/g:${formatGenreName(pathname)}`, style: 'display: inline-block; float: right;' }); document.getElementById('page_breadcrumb')?.appendChild(button); } }); })();