Skip to content

Instantly share code, notes, and snippets.

@git2samus
Created March 27, 2021 13:15
Show Gist options
  • Save git2samus/d15ba39e898e1d452f801d528d7433d3 to your computer and use it in GitHub Desktop.
Save git2samus/d15ba39e898e1d452f801d528d7433d3 to your computer and use it in GitHub Desktop.
Disable Reddit collections
// ==UserScript==
// @name Disable Reddit collections
// @namespace https://github.com/git2samus/
// @version 0.1
// @description Revert Reddit collections layout on the new design
// @author git2samus
// @match https://www.reddit.com/r/*/comments/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Delayed run because of Reddit scripts
setTimeout(function() {
console.log('Disable Reddit collections');
// Verify we're on a collection post
if (document.querySelector('._10IcBRrmressbhblq2bqiU')) {
// Look for relevant containers
const [content, sidebar] = document.querySelectorAll('._1vyLCp-v-tE5QvZovwrASa > div');
// Look for collection nodes
const [header, collection, comments] = content.children[1].children;
// Remove extra nodes
header.remove();
collection.remove();
// Adjust CSS of remaining nodes
content.className = '_1OVBBWLtHoSPfGCRaPzpTf _3nSp9cdBpqL13CqjdMr2L_ _2udhMC-jldHp_EpAuBeSR1 PaJBYLqPf_Gie2aZntVQ7';
sidebar.className = '_1BFbVxT49QnrAN3fqGZ1z8 _1tvThPWQpORoc2taKebHxs';
}
}, 1000);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment