Greasy Fork is available in English.
从疑似影视网页的标题中提取片名与集数重新显示
// ==UserScript==// @name 影视网页标题清理// @version 13// @description 从疑似影视网页的标题中提取片名与集数重新显示// @author Lemon399// @match *://*/*// @run-at document-start// @grant none// @namespace https://gfork.dahi.icu/users/452911// ==/UserScript==(function() {function matcher(title) {let r###lt = "",ji = NaN,temp = title;/* 匹配 [数字]集 */const ji1 = title.match(/(\d+)集/);/* 如果存在 */if (ji1) {/* 取 [数字] 为集数 */ji = ji1[1];/* 删除 [数字]集 以及后面所有内容 */temp = title.split(ji + "集")[0];/* 如果末尾是 第,删除 第 */if (temp.match(/第$/)) {temp = temp.replace(/第$/, "");}}/* 如果上面没有得到集数,匹配 》[空格][数字] 为集数 */const ji2 = title.match(/》\s*(\d+)/);if (!ji && ji2) ji = ji2[1];/* 删除 《 以及前面内容 和 》以及后面内容,清理多余空格 */temp = temp.replace(/^.*《/, "").replace(/》.*$/, "").trim();r###lt = temp + (ji ? " " + ji.padStart(2, "0") : "");return r###lt ? r###lt : title;}function updateTitle() {document.title = matcher(document.title);}// 立即执行一次updateTitle();// 延迟0.5秒后再次执行setTimeout(updateTitle, 500);})();