Skip to content

Instantly share code, notes, and snippets.

@radiosterne
Created September 23, 2018 19:45
Show Gist options
  • Select an option

  • Save radiosterne/2aac5a50f88e0f28b36612eba46ed5c9 to your computer and use it in GitHub Desktop.

Select an option

Save radiosterne/2aac5a50f88e0f28b36612eba46ed5c9 to your computer and use it in GitHub Desktop.
HideYourKids
// ==UserScript==
// @name HideYourKids
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Hides baaad firemen.
// @author You
// @match https://vk.com/im*
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Добавление идентификатора в этот массив банит этого пользователя из ВСЕХ (!!!) диалогов ВК.
const bannedUsers = [139189750, 176725294, 502315675, 468300089]
.map(x => x.toString());
const targetNode = document.getElementsByClassName('im-page-wrapper')[0];
const mutationConfig = { attributes: true, childList: true, subtree: true };
const mutationCallback = () => Array.prototype.slice
.call(document.getElementsByClassName("im-mess-stack"))
.filter(elem => bannedUsers.indexOf(elem.attributes.getNamedItem("data-peer").value.toString()) !== -1)
.map(elem => elem.remove());
const observer = new MutationObserver(mutationCallback);
observer.observe(targetNode, mutationConfig);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment