Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Stary Vikop
- // @author Nogisz
- // @namespace https://wykop.pl/
- // @version 2026-09-24
- // @description Wyłącz nowe "drzewko komentarzy" w pizdu
- // @match https://wykop.pl/*
- // @icon https://www.google.com/s2/favicons?sz=64&domain=wykop.pl
- // @grant none
- // @run-at document-start
- // ==/UserScript==
- (function () {
- 'use strict';
- const STORAGE_KEY = 'wykop-comments-tree-enabled';
- const INPUT_ID = 'tampermonkey-comments-tree';
- function getStore() {
- return [...document.querySelectorAll('*')]
- .map(el => el.__vue__)
- .find(vm => vm?.$store)
- ?.$store;
- }
- function getEnabled() {
- const value = localStorage.getItem(STORAGE_KEY);
- return value === null ? false : value === 'true';
- }
- function setEnabled(enabled) {
- localStorage.setItem(STORAGE_KEY, String(enabled));
- const store = getStore();
- if (!store) {
- return false;
- }
- store.commit('config/setCommentsTreeEnabled', enabled);
- console.log(
- '[Stary Vikop]',
- enabled ? 'Drzewko włączone!' : 'Drzewko wyłączone!'
- );
- return true;
- }
- function applySetting() {
- const enabled = getEnabled();
- if (setEnabled(enabled)) {
- return;
- }
- const interval = setInterval(() => {
- if (setEnabled(enabled)) {
- clearInterval(interval);
- }
- }, 20);
- setTimeout(() => clearInterval(interval), 10000);
- }
- function injectSetting() {
- if (location.pathname !== '/ustawienia/ogolne') {
- return;
- }
- if (document.getElementById(INPUT_ID)) {
- return;
- }
- const section = document.querySelector('section.display');
- if (!section) {
- return;
- }
- const form = section.querySelector('form');
- if (!form) {
- return;
- }
- const template = form.querySelector('.form-group .switch');
- if (!template) {
- return;
- }
- const templateFormGroup = template.closest('.form-group');
- if (!templateFormGroup) {
- return;
- }
- const formGroup = templateFormGroup.cloneNode(true);
- const input = formGroup.querySelector('input[type="checkbox"]');
- const label = formGroup.querySelector('label');
- const text = formGroup.querySelector('label span');
- if (!input || !label || !text) {
- return;
- }
- input.id = INPUT_ID;
- input.checked = getEnabled();
- label.setAttribute('for', INPUT_ID);
- text.textContent = 'Wyświetlaj Mikroblog w formie drzewa';
- input.addEventListener('change', () => {
- setEnabled(input.checked);
- });
- const confirm = form.querySelector('.confirm');
- if (confirm) {
- form.insertBefore(formGroup, confirm);
- } else {
- form.appendChild(formGroup);
- }
- }
- applySetting();
- const observer = new MutationObserver(() => {
- injectSetting();
- });
- observer.observe(document.documentElement, {
- childList: true,
- subtree: true
- });
- if (document.readyState === 'loading') {
- document.addEventListener('DOMContentLoaded', injectSetting);
- } else {
- injectSetting();
- }
- })();
Advertisement
Add Comment
Please, Sign In to add comment