Youtube block all, not interested in all, dismiss all

不感兴趣, दिलचस्पी नहीं है, 興味なし, 관심 없음, Kein Interesse,لا يهمني,Pas intéressé, Не интересует, Não tenho interesse, No me interesa

Від 06.10.2025. Дивіться остання версія.

// ==UserScript==
// @name         Youtube block all, not interested in all, dismiss all
// @name:zh-CN   Youtube block all, not interested in all, dismiss all
// @name:zh-TW   Youtube block all, not interested in all, dismiss all
// @name:ja   Youtube block all, not interested in all, dismiss all
// @name:ko   Youtube block all, not interested in all, dismiss all
// @name:de   Youtube block all, not interested in all, dismiss all
// @name:es   Youtube block all, not interested in all, dismiss all
// @name:eo   Youtube block all, not interested in all, dismiss all
// @name:fr   Youtube block all, not interested in all, dismiss all
// @name:it   Youtube block all, not interested in all, dismiss all
// @name:ru   Youtube block all, not interested in all, dismiss all
// @name:vi   Youtube block all, not interested in all, dismiss all
// @name:pt-BR   Youtube block all, not interested in all, dismiss all
// @name:id   Youtube block all, not interested in all, dismiss all
// @name:ar   Youtube block all, not interested in all, dismiss all
// @name:bg   Youtube block all, not interested in all, dismiss all
// @name:cs   Youtube block all, not interested in all, dismiss all
// @name:tr   Youtube block all, not interested in all, dismiss all
// @name:el   Youtube block all, not interested in all, dismiss all
// @name:hu   Youtube block all, not interested in all, dismiss all
// @name:th   Youtube block all, not interested in all, dismiss all
// @icon         https://img.icons8.com/?size=100&id=9a46bTk3awwI&format=png&color=000000
// @version      1.3.1
// @description  不感兴趣, दिलचस्पी नहीं है, 興味なし, 관심 없음, Kein Interesse,لا يهمني,Pas intéressé, Не интересует, Não tenho interesse, No me interesa
// @description:zh-CN   不感兴趣, दिलचस्पी नहीं है, 興味なし, 관심 없음, Kein Interesse,لا يهمني,Pas intéressé, Не интересует, Não tenho interesse, No me interesa
// @description:zh-TW   不感兴趣, दिलचस्पी नहीं है, 興味なし, 관심 없음, Kein Interesse,لا يهمني,Pas intéressé, Не интересует, Não tenho interesse, No me interesa
// @description:ja      不感兴趣, दिलचस्पी नहीं है, 興味なし, 관심 없음, Kein Interesse,لا يهمني,Pas intéressé, Не интересует, Não tenho interesse, No me interesa
// @description:ko      不感兴趣, दिलचस्पी नहीं है, 興味なし, 관심 없음, Kein Interesse,لا يهمني,Pas intéressé, Не интересует, Não tenho interesse, No me interesa
// @description:de      不感兴趣, दिलचस्पी नहीं है, 興味なし, 관심 없음, Kein Interesse,لا يهمني,Pas intéressé, Не интересует, Não tenho interesse, No me interesa
// @description:es      不感兴趣, दिलचस्पी नहीं है, 興味なし, 관심 없음, Kein Interesse,لا يهمني,Pas intéressé, Не интересует, Não tenho interesse, No me interesa
// @description:eo      不感兴趣, दिलचस्पी नहीं है, 興味なし, 관심 없음, Kein Interesse,لا يهمني,Pas intéressé, Не интересует, Não tenho interesse, No me interesa
// @description:fr      不感兴趣, दिलचस्पी नहीं है, 興味なし, 관심 없음, Kein Interesse,لا يهمني,Pas intéressé, Не интересует, Não tenho interesse, No me interesa
// @description:it      不感兴趣, दिलचस्पी नहीं है, 興味なし, 관심 없음, Kein Interesse,لا يهمني,Pas intéressé, Не интересует, Não tenho interesse, No me interesa
// @description:ru      不感兴趣, दिलचस्पी नहीं है, 興味なし, 관심 없음, Kein Interesse,لا يهمني,Pas intéressé, Не интересует, Não tenho interesse, No me interesa
// @description:vi      不感兴趣, दिलचस्पी नहीं है, 興味なし, 관심 없음, Kein Interesse,لا يهمني,Pas intéressé, Не интересует, Não tenho interesse, No me interesa
// @description:pt-BR   不感兴趣, दिलचस्पी नहीं है, 興味なし, 관심 없음, Kein Interesse,لا يهمني,Pas intéressé, Не интересует, Não tenho interesse, No me interesa
// @description:id      不感兴趣, दिलचस्पी नहीं है, 興味なし, 관심 없음, Kein Interesse,لا يهمني,Pas intéressé, Не интересует, Não tenho interesse, No me interesa
// @description:ar      不感兴趣, दिलचस्पी नहीं है, 興味なし, 관심 없음, Kein Interesse,لا يهمني,Pas intéressé, Не интересует, Não tenho interesse, No me interesa
// @description:bg      不感兴趣, दिलचस्पी नहीं है, 興味なし, 관심 없음, Kein Interesse,لا يهمني,Pas intéressé, Не интересует, Não tenho interesse, No me interesa
// @description:cs      不感兴趣, दिलचस्पी नहीं है, 興味なし, 관심 없음, Kein Interesse,لا يهمني,Pas intéressé, Не интересует, Não tenho interesse, No me interesa
// @description:tr      不感兴趣, दिलचस्पी नहीं है, 興味なし, 관심 없음, Kein Interesse,لا يهمني,Pas intéressé, Не интересует, Não tenho interesse, No me interesa
// @description:el      不感兴趣, दिलचस्पी नहीं है, 興味なし, 관심 없음, Kein Interesse,لا يهمني,Pas intéressé, Не интересует, Não tenho interesse, No me interesa
// @description:hu      不感兴趣, दिलचस्पी नहीं है, 興味なし, 관심 없음, Kein Interesse,لا يهمني,Pas intéressé, Не интересует, Não tenho interesse, No me interesa
// @description:th      不感兴趣, दिलचस्पी नहीं है, 興味なし, 관심 없음, Kein Interesse,لا يهمني,Pas intéressé, Не интересует, Não tenho interesse, No me interesa
// @author       evanlai
// @match        https://www.youtube.com/*
// @exclude      https://www.youtube.com/shorts/*
// @require            https://openuserjs.org/src/libs/sizzle/GM_config.js
// @require            https://cdn.jsdelivr.net/npm/[email protected]/dist/sweetalert.min.js
// @require            https://cdn.jsdelivr.net/npm/[email protected]/dist/cdn.min.js
// @grant              GM_getValue
// @grant              GM_setValue
// @grant              GM_addStyle
// @namespace https://greatest.deepsurf.us/users/732057
// ==/UserScript==

if (window.trustedTypes && window.trustedTypes.createPolicy) {
    window.trustedTypes.createPolicy('default', {
    createHTML: string => string,
    createScriptURL: string => string,
    createScript: string => string,
    });
}


GM_addStyle(`
    #J_dismiss_all,#J_open_settings{
        display: inline-flex;
        margin-left: 2em;
        align-items: center;
        vertical-align: middle;
        color: gray;
        font-size: 2em;
        line-height: 2em;
        text-decoration: none;
    }

    #J_open_settings{
        margin-top:1px;
        margin-left: 1em;
    }

    #Y_settings > div{
        margin-bottom:10px;
    }
    .config-current-value{
        font-weight: bold;
        color:blueviolet;
    }
`);

function wait(ms) {
    return new Promise((resolve) => {
        setTimeout(resolve, ms);
    });
}
function inArray(array, element) {
  return array.indexOf(element) !== -1;
}

function toNumber(value){
    let num = Number(value);

    if (isNaN(num) || !isFinite(num)) {
        return 0;
    }

    return num;
}

var runflag = true;
var firstEnterThisPage = true;
async function dismissCurrent() {
    let lastElementForClick = null;
    [...document.querySelectorAll(`.ytListViewModelHost .yt-list-item-view-model path[d="${(typeof GM_getValue !== 'undefined' && GM_getValue('videoOrCreator') === "video") ? "M12 2c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zM3 12c0 2.31.87 4.41 2.29 6L18 5.29C16.41 3.87 14.31 3 12 3c-4.97 0-9 4.03-9 9zm15.71-6L6 18.71C7.59 20.13 9.69 21 12 21c4.97 0 9-4.03 9-9 0-2.31-.87-4.41-2.29-6z" : "M12 3c-4.96 0-9 4.04-9 9s4.04 9 9 9 9-4.04 9-9-4.04-9-9-9m0-1c5.52 0 10 4.48 10 10s-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2zm7 11H5v-2h14v2z"}"]`)].forEach(d => {
        d.closest('yt-list-item-view-model').click();
    });
    // lastElementForClick.click();
    // lastElementForClick.remove();
    return true;
}
async function dismissAll() {
    let list = document.querySelectorAll('yt-lockup-metadata-view-model yt-touch-feedback-shape');

    while (firstEnterThisPage && list.length < 5) {
        await wait(1000);
        list = document.querySelectorAll('yt-lockup-metadata-view-model yt-touch-feedback-shape');
    }
    firstEnterThisPage = false;

    let i = 0;
    for (let item of list) {
        item.click();
        await wait(50);
        await dismissCurrent();
        await wait(100);
        i++;
        if (i >= parseInt(GM_getValue('maximumNumberOfBlocksPerOperation'))) break;
    }
    if (runflag) {
        runflag = false;
        // await dismissAll();
    }
    window.location.reload();
}

window.dismissAll = function() {
    dismissAll();
}
window.openGmcSettings = function() {
    let settings = document.getElementById('J_settings');
    settings.style.display = '';

    swal({
        content: settings,
        buttons: {
            cancel: "close",
        },
    }).then(async (value) => {
        settings.style.display = 'none';
    });
}

function createButton() {
    var elementForInsertNewButton = document.querySelector('#start') || document.querySelector('#logo-icon') || document.querySelector('#country-code');

    var dismissAllLink = document.createElement('a');
    dismissAllLink.id = 'J_dismiss_all';
    dismissAllLink.href = 'javascript:';
    dismissAllLink.onclick = window.dismissAll;
    dismissAllLink.textContent = '⟳';

    var openGmcSettingsLink = document.createElement('a');
    openGmcSettingsLink.id = 'J_open_settings';
    openGmcSettingsLink.href = 'javascript:';
    openGmcSettingsLink.onclick = window.openGmcSettings;
    openGmcSettingsLink.textContent = '⋮';

    elementForInsertNewButton.appendChild(dismissAllLink);
    elementForInsertNewButton.appendChild(openGmcSettingsLink);
}

createButton();

// settings
document.addEventListener('alpine:init', () => {
    var maximumNumberOfBlocksPerOperation = GM_getValue('maximumNumberOfBlocksPerOperation');
    if(typeof maximumNumberOfBlocksPerOperation === 'undefined') maximumNumberOfBlocksPerOperation = '12';
    GM_setValue('maximumNumberOfBlocksPerOperation', maximumNumberOfBlocksPerOperation);
    Alpine.store('maximumNumberOfBlocksPerOperation', {
        value: maximumNumberOfBlocksPerOperation,
        valueHasChanged(){
            toNumber(this.value).toString();
            GM_setValue('maximumNumberOfBlocksPerOperation', toNumber(this.value).toString());
        }
    })


    var autoMode = GM_getValue('autoMode') === 'on' ? 'on' : 'off';
    GM_setValue('autoMode', autoMode);

    Alpine.store('autoMode', {
        value: autoMode,
        async toggle() {

            let oldvalue = this.value;
            this.value = this.value === 'on' ? 'off' : 'on';
            
            GM_setValue('autoMode', this.value);

            if(this.value === 'on') {
                await wait(1000);
                window.location.reload();
            }

        }
    })


    var videoOrCreator = GM_getValue('videoOrCreator') === 'creator' ? 'creator' : 'video';
    GM_setValue('videoOrCreator', videoOrCreator);


    Alpine.store('videoOrCreator', {
        value: videoOrCreator,
        toggle() {
            let oldvalue = this.value;
            this.value = this.value === "creator" ? "video" : "creator";
            GM_setValue('videoOrCreator', this.value);
        }
    })

    if(GM_getValue('autoMode') === 'on') window.dismissAll()
});

var gmcSettings = document.createElement('div');
gmcSettings.id = 'J_settings';
gmcSettings.style.display = 'none';

gmcSettings.innerHTML = `
    <div id="Y_settings">
            <div>
                <span>Maximum number of blocks per operation:</span>
                <input type="text" x-model="$store.maximumNumberOfBlocksPerOperation.value" x-init="$watch('$store.maximumNumberOfBlocksPerOperation.value', value => $store.maximumNumberOfBlocksPerOperation.valueHasChanged())">
            </div>
            <div>
                <button style x-data @click="$store.videoOrCreator.toggle()">Block video or creator: <span class="config-current-value" x-text="$store.videoOrCreator.value.toUpperCase()"></span></button>
            </div>
            <div>
                <button style="display: flex; align-items: center; margin:auto" x-data @click="$store.autoMode.toggle()"><span>Automatically refresh the page and process all: </span><img x-show="$store.autoMode.value === 'on'" style='display:inline-block; width:1.5em; height:1.5em; line-height:1.5em' src='https://img.icons8.com/?size=100&id=12226&format=png&color=000000'><span class="config-current-value" x-text="$store.autoMode.value.toUpperCase()"></span></button>
            </div>
    </div>


`;
document.querySelector('body').appendChild(gmcSettings);