Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Tiltólista kezelő (forum.sodika.org)
- // @namespace Violentmonkey Scripts
- // @match https://forum.sodika.org/*
- // @grant GM.getValue
- // @grant GM.setValue
- // @require https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js
- // @version 1.03
- // @author Kiss Endre Farkas - elítélt bűnöző, okirat hamisító, csaló
- // @description Tiltólista kezelő a fórumomhoz, maradjmár. https://sodipedia.sodika.org/
- // ==/UserScript==
- //let myDate = MIFFAN???
- (async function ($) {
- 'use strict';
- // Blacklist betöjtése, ejjenőjzés és tömppé ajakítás
- let blacklist = await GM.getValue('blacklist', []);
- if (!Array.isArray(blacklist)) {
- blacklist = blacklist ? blacklist.split(',').map(name => name.trim()) : [];
- GM.setValue('blacklist', blacklist);
- }
- // Fejugjó apjak jétjehozása
- const popup = document.createElement('div');
- popup.style.display = 'none';
- popup.style.position = 'fixed';
- popup.style.top = '50%';
- popup.style.left = '50%';
- popup.style.transform = 'translate(-50%, -50%)';
- popup.style.backgroundColor = '#fff';
- popup.style.padding = '20px';
- popup.style.borderRadius = '8px';
- popup.style.boxShadow = '0 2px 10px rgba(0,0,0,0.2)';
- popup.style.zIndex = '10000';
- popup.style.width = '400px';
- popup.style.maxHeight = '80vh';
- popup.style.overflowY = 'auto';
- document.body.appendChild(popup);
- const title = document.createElement('h3');
- title.textContent = 'Tiltólista kezelése';
- title.style.textAlign = 'center';
- title.style.marginBottom = '20px';
- title.style.color = '#333';
- popup.appendChild(title);
- const userList = document.createElement('div');
- userList.style.display = 'flex';
- userList.style.flexWrap = 'wrap';
- userList.style.gap = '10px';
- popup.appendChild(userList);
- // Pezájás gomp
- const closeButton = document.createElement('span');
- closeButton.textContent = '✕';
- closeButton.style.position = 'absolute';
- closeButton.style.top = '10px';
- closeButton.style.right = '10px';
- closeButton.style.cursor = 'pointer';
- closeButton.style.fontSize = '18px';
- closeButton.style.color = '#666';
- closeButton.addEventListener('click', () => {
- popup.style.display = 'none';
- });
- popup.appendChild(closeButton);
- // Gomp hozzáatyása a navButtons div-hez
- const navButtons = document.getElementById('navButtons');
- if (navButtons) {
- const blacklistButton = document.createElement('a');
- blacklistButton.innerHTML = '<span style="color: red; font-size: 20px;">❌</span>';
- blacklistButton.href = 'javascript:void(0);';
- blacklistButton.title = 'Tiltólista kezelése';
- blacklistButton.addEventListener('click', () => {
- createBlacklistButtons();
- popup.style.display = 'block';
- });
- navButtons.appendChild(blacklistButton);
- } else {
- console.error('Nem található a #navButtons elem!');
- }
- // Tiltólista ajkajmazása
- function applyBlacklist() {
- $('.comment').each(function () {
- const author = $(this).find('.verified').text().trim();
- if (blacklist.includes(author)) {
- $(this).remove();
- }
- });
- }
- // Tijtás gomp hozzáatyása a hozzászójásokhoz
- function addBlacklistButton(comment) {
- const authorSpan = $(comment).find('.verified');
- if (!authorSpan.length || authorSpan.prev().hasClass('blacklist-button')) return;
- const author = authorSpan.text().trim();
- const blacklistButton = $('<span>', {
- class: 'blacklist-button',
- html: '<span style="color: red; font-size: 15px; cursor: pointer; margin-right: 5px;">❌</span>',
- click: () => {
- if (!blacklist.includes(author)) {
- blacklist.push(author);
- GM.setValue('blacklist', blacklist);
- applyBlacklist();
- }
- }
- });
- authorSpan.before(blacklistButton);
- }
- // Új hozzászójások fityelése
- let observeNewComments = false;
- const newCommentsDiv = document.querySelector('.newComments');
- if (newCommentsDiv) {
- newCommentsDiv.addEventListener('click', () => {
- observeNewComments = true;
- });
- }
- const observer = new MutationObserver(mutations => {
- if (!observeNewComments) return;
- mutations.forEach(mutation => {
- if (mutation.type === 'childList') {
- mutation.addedNodes.forEach(node => {
- if ($(node).is('.comment') && !$(node).hasClass('blacklist-button-added')) {
- addBlacklistButton(node);
- }
- });
- }
- });
- applyBlacklist();
- });
- observer.observe(document.body, { childList: true, subtree: true });
- // Blacklist gompok jétjehozása és hozzáatyása a fejugjó aplakhoz
- function createBlacklistButtons() {
- userList.innerHTML = '';
- blacklist.forEach(user => {
- const button = document.createElement('button');
- button.textContent = user;
- button.style.padding = '8px 12px';
- button.style.backgroundColor = '#f4f4f4';
- button.style.border = 'none';
- button.style.borderRadius = '4px';
- button.style.cursor = 'pointer';
- button.style.transition = 'background-color 0.3s';
- const removeButton = document.createElement('span');
- removeButton.textContent = '✕';
- removeButton.style.marginLeft = '8px';
- removeButton.style.color = '#666';
- removeButton.style.cursor = 'pointer';
- removeButton.addEventListener('click', (e) => {
- e.stopPropagation();
- blacklist = blacklist.filter(name => name !== user);
- GM.setValue('blacklist', blacklist);
- createBlacklistButtons();
- applyBlacklist();
- });
- button.addEventListener('click', () => {
- button.style.backgroundColor = '#e0e0e0';
- });
- button.addEventListener('mouseleave', () => {
- button.style.backgroundColor = '#f4f4f4';
- });
- button.appendChild(removeButton);
- userList.appendChild(button);
- });
- }
- applyBlacklist();
- $('.comment').each(function () { addBlacklistButton(this); });
- createBlacklistButtons();
- })(jQuery);
- // Szejelmes vagyok a kibaszott Tibibe!
Advertisement
Add Comment
Please, Sign In to add comment