✨ Add Old Reddit Image Expander
This commit is contained in:
parent
89ef621228
commit
5db7867f46
1 changed files with 33 additions and 0 deletions
33
old-reddit-expando.user.js
Normal file
33
old-reddit-expando.user.js
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
// ==UserScript==
|
||||
// @name Old Reddit Image Expander
|
||||
// @namespace danielrayjones
|
||||
// @description Allow removal of visited links on Amazon Giveaway Listing
|
||||
// @include https://old.reddit.com*
|
||||
// @version 1.0.0
|
||||
// ==/UserScript==
|
||||
|
||||
(function() {
|
||||
const listing = document.getElementById('siteTable');
|
||||
|
||||
if (!listing) {
|
||||
return;
|
||||
}
|
||||
|
||||
let para = document.createElement('p');
|
||||
//para.innerHtml = '<button id="expander">Expand images</button><button id="depand">Collapse images</button>';
|
||||
let exButton = document.createElement('button');
|
||||
exButton.id = 'expander';
|
||||
exButton.innerText = 'Expand images';
|
||||
exButton = para.appendChild(exButton);
|
||||
|
||||
let deButton = document.createElement('button');
|
||||
deButton.id = 'depand';
|
||||
deButton.innerText = 'Collapse images';
|
||||
deButton = para.appendChild(deButton);
|
||||
|
||||
para = listing.insertBefore(para, listing.firstChild);
|
||||
|
||||
exButton.addEventListener('click', () => document.querySelectorAll('.expando-button.collapsed').forEach(e => e.click()));
|
||||
deButton.addEventListener('click', () => document.querySelectorAll('.expando-button.expanded').forEach(e => e.click()));
|
||||
})();
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue