Tampermonkey Userscripts
Tampermonkey is a browser extensions that let you store, manage, and run pieces of JavaScript code, called userscripts, on webpages that you browse. It helps automate thing, change page behaviour, tweak page look etc.
Here’s a collection of my userscripts. Maybe you could find something useful.
Print Gmail E-mail without stupid gazillion of nested tables.
// ==UserScript==
// @name Print Gmail E-mail
// @namespace themactep.com
// @description Strip Gmail overhead from email before printing.
// @author Paul Philippov <paul@themactep.com>
// @match https://mail.google.com/mail/*
// @icon https://www.google.com/s2/favicons?domain=mail.google.com
// @grant none
// @run-at context-menu
// @version 20201225084000
// ==/UserScript==
(function() {
let a = document.querySelector('.message');
let body = document.querySelector('body');
body.innerHTML = '';
body.append(a);
})();
Leave multiple positive feedback on AliExpress in one click.
// ==UserScript==
// @name AliExpress Leave positive feedback
// @namespace themactep.com
// @description AliExpress positive feedback helper.
// @author Paul Philippov <paul@themactep.com>
// @match https://feedback.aliexpress.com/management/leaveFeedback.htm
// @icon https://www.google.com/s2/favicons?domain=aliexpress.com
// @grant none
// @run-at context-menu
// @version 20180827082951
// ==/UserScript==
(function() {
const feedback = "It's all good. Thank you.";
document.querySelectorAll('.star-5').forEach(function(el) { el.click(); });
document.querySelectorAll('textarea').forEach(function(el) { el.textContent = feedback; });
})();
Hide promoted content on twitter.com.
// ==UserScript==
// @name Twitter cleaner
// @namespace themactep.com
// @description Hides promoted content
// @author Paul Philippov <paul@themactep.com>
// @match https://twitter.com/*
// @icon https://www.google.com/s2/favicons?domain=twitter.com
// @grant none
// @version 20211012100000
// ==/UserScript==
(function() {
function removePromotedTwits() {
[...document.querySelectorAll('span')].filter(el => el.textContent.includes('Promoted')).filter(el => el.children.length == 0).forEach(el => {
let promotedTwit = el.parentNode.parentNode.parentNode.parentNode.parentNode;
let promotedTwitParent = promotedTwit;
while ((typeof(promotedTwitParent.style) == 'undefined' || promotedTwitParent.style.transform == "") && promotedTwitParent.parentNode) {
promotedTwitParent = promotedTwitParent.parentNode;
}
if (promotedTwitParent != document) promotedTwit = promotedTwitParent;
if (promotedTwit.style.display != 'none') promotedTwit.style.display = 'none';
})
}
document.addEventListener('transitionend', removePromotedTwits);
})();