Yandex Music Explicit Mark Replacement

Replaces the exclamation explicit mark with a classic one on Yandex Music

目前为 2025-01-18 提交的版本。查看 最新版本

// ==UserScript==
// @name         Yandex Music Explicit Mark Replacement
// @namespace    http://tampermonkey.net/
// @version      0.5
// @description  Replaces the exclamation explicit mark with a classic one on Yandex Music
// @author       wileyfoxyx
// @match        https://music.yandex.ru/*
// @match        https://music.yandex.com/*
// @match        https://music.yandex.by/*
// @match        https://music.yandex.kz/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    function handleExplicitMarks() {
        const explicitElements = document.querySelectorAll('.d-explicit-mark');

        explicitElements.forEach(element => {
            const title = element.title;

            if (title.includes("УЧАСТНИК ГРУППЫ ПРИЗНАН ИНОАГЕНТОМ") && title.includes("Возрастное ограничение 18+")) {
                element.remove();
            }
            else if (title.includes("ИСПОЛНИТЕЛЬ ПРИЗНАН ИНОАГЕНТОМ") && title.includes("Возрастное ограничение 18+")) {
                element.remove();
            }
            else if (title.includes("THE ARTIST IS RECOGNIZED AS A FOREIGN AGENT") && title.includes("Age restriction 18+")) {
                element.remove();
            }
            else if (title.includes("A BAND MEMBER IS RECOGNIZED AS A FOREIGN AGENT") && title.includes("Age restriction 18+")) {
                element.remove();
            }
            else if (title === "Возрастное ограничение 18+" || title === "Age restriction 18+") {
                const newSpan = document.createElement('span');
                newSpan.className = 'd-explicit-mark d-explicit-mark--e';
                newSpan.title = 'Сервис Яндекс Музыка может содержать информацию, не предназначенную для несовершеннолетних';
                element.replaceWith(newSpan);
            }
        });
    }

    function removeAgentDiv() {
        const agentDivs = document.querySelectorAll('.page-artist__agent');

        agentDivs.forEach(agentDiv => {
            const textContent = agentDiv.textContent.trim();

            if (textContent === "ИСПОЛНИТЕЛЬ ПРИЗНАН ИНОАГЕНТОМ" || textContent === "УЧАСТНИК ГРУППЫ ПРИЗНАН ИНОАГЕНТОМ" || textContent === "THE ARTIST IS RECOGNIZED AS A FOREIGN AGENT" || textContent === "A BAND MEMBER IS RECOGNIZED AS A FOREIGN AGENT") {
                agentDiv.remove();
            }
        });
    }

    handleExplicitMarks();
    removeAgentDiv();

    const observer = new MutationObserver(() => {
        handleExplicitMarks();
        removeAgentDiv();
    });

    observer.observe(document.body, { childList: true, subtree: true });

})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址