Greasy Fork

Greasy Fork is available in English.

影视网页标题清理

清除剧集标题中“集”字后面的字符,以及清理带《》的电影标题

当前为 2023-05-12 提交的版本,查看 最新版本

// ==UserScript==
// @name         影视网页标题清理
// @version      4
// @description  清除剧集标题中“集”字后面的字符,以及清理带《》的电影标题
// @author       ChatGPT
// @match        *://*/*
// @grant        none
// @namespace http://greasyfork.icu/users/452911
// ==/UserScript==

(function() {
    'use strict';

    // 获取当前网页标题
    var pageTitle = document.title;

    // 查找"集"字在标题中的位置
    var index = pageTitle.indexOf("集");

    // 如果找到了"集"字
    if (index > -1) {
        // 删掉"集"字后面的所有字符,重新设置标题
        document.title = pageTitle.substring(0, index + 1);
    }
})();
if (document.title && document.title.includes('《') && !document.title.includes('》')) {
  document.title = document.title.replace('《', '');
};
if (document.title && !document.title.includes('集') && document.title.includes('《') && document.title.includes('》')) {
  document.title = document.title.substring(document.title.indexOf('《') + 1, document.title.indexOf('》'));
}