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
})();
I had never heard of Tamper Monkey, so I had a look https://www.tampermonkey.net/
Tampermonkey is one of the most popular browser extension with over 10 million users. It's available for Chrome, Microsoft Edge, Safari, Opera Next, and Firefox.
It allows its users to customize and enhance the functionality of your favorite web pages. Userscripts are small JavaScript programs that can be used to add new features or modify existing ones on web pages. With Tampermonkey, you can easily create, manage, and run these userscripts on any website you visit.
For example, with Tampermonkey, you could add a new button to a web page that lets you quickly share a link on social media, or to automatically fill in a form with your personal information. This is especially useful in the age of digitization, where web pages are often used as user interfaces for accessing a wide range of services and applications.
Additionally, Tampermonkey makes it easy to find and install userscripts created by other users. This means that you can quickly and easily access a vast library of customizations and enhancements for your favorite web pages, without having to spend hours writing your own code.
Whether you're a web developer looking to add new features to your site, or just a regular user looking to improve your online experience, Tampermonkey is a great tool to have in your toolkit.
Thanks Looks like we've found a new toy!