hideThinker

Hide users in Kluv

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript== 
// @name hideThinker
// @namespace deepThinker 
// @description Hide users in Kluv 
// @include https://thecage.co.il/*
// @require http://code.jquery.com/jquery-3.3.1.js
// @version 0.0.5
// ==/UserScript==

let hiddenUsers = window.hiddenUsers;
$(document).ready(() => {
    hiddenUsers = getHiddenUsersList() || [];
    // Only if within profile page 
    window.location.href.includes('profile') && initHideUserButton();
    hiddenUsers.forEach(user => {
        // Blog in front page 
        $(`.frontpage_box_small_item:contains(${user})`).hide();
        // Comment
        $(`article:contains(${user})`).hide();
        // User in usersList 
        $(`td span.user:contains(${user})`).hide();
    });
});

toggleUser = () => {
    const selectedUser = $('.profile-username > span').text();
    if (hiddenUsers.includes(selectedUser)) {
        hiddenUsers = hiddenUsers.filter(user => user !== selectedUser);
    } else {
        hiddenUsers.push(selectedUser);
    }
    localStorage.setItem('hiddenUsers', JSON.stringify(hiddenUsers));
    initHideUserButton();
}

getHiddenUsersList = () => {
    const users = localStorage.getItem('hiddenUsers');
    if (users) {
        return JSON.parse(users);
    } else {
        localStorage.setItem('hiddenUsers', JSON.stringify([]));
    }
}

initHideUserButton = () => {
    // Remove the btn if any before drawing 
    $('.hideUserBtn').remove();
    const username = $('.profile-username > span').text();
    const btnText = hiddenUsers.includes(username) ? 'הצג יוזר' : 'הסתר יוזר';
    $('.profileActionButtons').append(`
        <div class="col-md-3 col-sm-6 profileActionButtonsColumn hideUserBtn">
            <button class="btn btn-info btn-block" role="button" onClick="toggleUser()">
            <i class="icon-block" aria-hidden="true"></i>
            <span>&nbsp;</span>  
            ${btnText}
            </button>
        </div>
     `);
}