Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Image destroyer
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description asd
- // @author You
- // @include https://ponyach.ru/*
- // @include https://ponyach.ga/*
- // @grant none
- // ==/UserScript==
- /* jshint -W097 */
- 'use strict';
- var names = ['Cpt. Wolf', 'Murky'];
- $(function() {
- $('.pstnode').each(function() {
- removePostFiles($(this));
- });
- runObserver('.pstnode', removeMutationPostFiles);
- });
- function removeMutationPostFiles(mutation) {
- var $addedNodes = $(mutation.addedNodes);
- $addedNodes.each(function() {
- removePostFiles($(this));
- });
- }
- function removePostFiles($postObj) {
- var posterName = $postObj.find('.postername').text().trim();
- names.some(function(name) {
- if (posterName === name) {
- $postObj.find('.post-files').remove();
- return true;
- }
- return false;
- });
- }
- function runObserver(selector, mutationCallback) {
- var target = document.querySelector(selector);
- var observer = new MutationObserver(function(mutations) {
- mutations.forEach(mutationCallback);
- });
- var config = { attributes: true, childList: true, characterData: true }
- observer.observe(target, config);
- }
Advertisement
Add Comment
Please, Sign In to add comment