Advertisement
Guest User

The Motte show context

a guest
Sep 29th, 2022
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 0.61 KB | Source Code | 0 0
  1. // ==UserScript==
  2. // @name        The Motte show context
  3. // @description Show hidden comments when needed for context
  4. // @match       *://www.themotte.org/post/*
  5. // ==/UserScript==
  6.  
  7. window.onload = () => {
  8.     let context = document.getElementsByClassName('context')[0];
  9.     if (!context) return;
  10.     context = context.parentElement.parentElement;
  11.     while (context.classList.contains('comment')) {
  12.         context.classList.remove('collapsed');
  13.         context = context.parentElement.parentElement.parentElement;
  14.     }
  15.     location.hash = '';
  16.     setTimeout(() => { location.hash = '#context'; }, 0);
  17. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement