Handy PDW TamperMonkey script...
Resource
For those of you in the know, here is a handy TamperMonkey script I made that makes viewing PDW sooo much better. It removes all posts older than 5h, removes duplicate posts too, and adding your own keywords is easily done at the top of the script. The keywords are not case sensitive. Enjoy.
// ==UserScript== // @name Block Posts by Keywords and Age // @namespace http://tampermonkey.net/ // @version 0.5 // @description Block posts based on keywords and age // @author You // @match ://patriots.win/ // @grant none // ==/UserScript==
(function() { 'use strict';
// =================== KEYWORDS ===================
const keywords = [
'Jesus',
'Hannity',
'Pence',
'God wins'
].map(keyword => keyword.toLowerCase());
// ================================================
// Create a set to keep track of processed posts
const processedPosts = new Set();
// Toggle button
let toggleButton = document.createElement('button');
toggleButton.innerHTML = 'Toggle Post Blocking';
toggleButton.onclick = () => {
toggleButton.active = !toggleButton.active;
localStorage.setItem('toggleState', toggleButton.active);
toggleButton.style.color = toggleButton.active ? 'green' : 'red';
processPosts(); // Trigger post processing when toggled
};
toggleButton.active = localStorage.getItem('toggleState') === 'true';
toggleButton.style.color = toggleButton.active ? 'green' : 'red';
toggleButton.style.position = 'fixed';
toggleButton.style.top = '1in';
toggleButton.style.right = '1in';
toggleButton.style.zIndex = '9999';
toggleButton.draggable = true;
toggleButton.ondragend = () => {
localStorage.setItem('toggleButtonPosition', JSON.stringify({
right: toggleButton.style.right,
top: toggleButton.style.top
}));
};
const savedPosition = localStorage.getItem('toggleButtonPosition');
if (savedPosition) {
const position = JSON.parse(savedPosition);
toggleButton.style.right = position.right;
toggleButton.style.top = position.top;
}
document.body.appendChild(toggleButton);
// Function to process posts
const processPosts = () => {
if (!toggleButton.active) return;
document.querySelectorAll('.post').forEach(post => {
const postId = post.getAttribute('data-id');
if (processedPosts.has(postId)) return;
processedPosts.add(postId);
// Check age
const ageElement = post.querySelector('.timeago');
if (ageElement) {
const ageText = ageElement.textContent || '';
const ageMatch = ageText.match(/(\d+) (hours?|days?) ago/);
if (ageMatch) {
const numericValue = parseInt(ageMatch[1], 10);
if (ageMatch[2].toLowerCase() === 'hour' && numericValue > 5) {
post.style.display = 'none';
return;
} else if (ageMatch[2].toLowerCase() === 'day' && numericValue > 1) {
post.style.display = 'none';
return;
}
}
}
// Check keywords
const titleElement = post.querySelector('.top .title');
if (titleElement) {
const titleText = titleElement.textContent.toLowerCase();
if (keywords.some(keyword => titleText.includes(keyword))) {
post.style.display = 'none';
}
}
});
};
// Initial run and set interval
processPosts();
setInterval(processPosts, 6000); // 6 seconds
})();
Giving this a try. It deletes a lot of content on PDW but I like what you did with the toggle. I can always turn it off if I'm looking for something. Thanks for this!