hideThinker

Hide users in Kluv

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(У мене вже є менеджер скриптів, дайте мені встановити його!)

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.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==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>
     `);
}