Time is one of the most valuable and finite resources that we have. No matter how much wealth or power a person may possess, they cannot purchase more time… for now.
Therefore, productivity is the key to maximizing the limited time we have, and being productive means using our time efficiently to achieve our goals and accomplish tasks in the most effective way possible. By increasing productivity, we can make more time for the things that matter to us, whether spending time with loved ones, pursuing our passions, or simply relaxing and enjoying life.
Today's productivity tip
What is it?
Tampermonkey! It allows its users to customize and enhance the functionality of their favorite web pages. For example, you could add a new button to a web page that lets you quickly share a link on social media, or automatically fill in a form with your personal information.
Give me an example
Here you go then! We will create a script to conceal the archived chats in WhatsApp.
Why? you may ask. Well, simply moving the distracting group chats to the archive section of WhatsApp wasn’t sufficient. I realized that I was still receiving notifications indicating that there were unread messages waiting for me to read causing a constant nagging feeling that I couldn’t resist but to check and distract myself 😩, so we’re going to make those pesky archived chats disappear for good!
We are going to use Tampermonkey to hide that row by injecting some javascript code!
Installation
Go to the chrome store and search for Tampermonkey. They have a large repository of **other user’s scripts** that you can implement instead of writing your own from scratch in those cases where the problem you have has already been solved.
Tampermonkey
Coding
Upon accessing the extension, you’ll be presented with various options, including the ability to “Create a new script.” After selecting this option, a new page will appear, featuring a pre-written header with comments that we can adjust later, as well as a self-invoked method that will contain all of our code.
// ==UserScript==
// @name Hide Whatsapp archived row
// @namespace http://tampermonkey.net/
// @version 1.2
// @description Hides the top row where the archived messages icon are shown
// @author TangerineCoder
// @match *://web.whatsapp.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
var findElementsInterval = setInterval(hideArchivedChats ,100);
function hideArchivedChats() {
// Find left side pane
var paneSide = document.getElementById("pane-side");
// Check if exists
if(paneSide == null){
console.log("No pane found, searching again...");
return;
}
// Stop searching for the divs
clearInterval(findElementsInterval)
document.getElementById("pane-side").addEventListener("DOMSubtreeModified", hideRow)
}
function hideRow() {
// Prevent hidding if it already is hidden
if (document.getElementsByClassName("_2O4d9")[0].style.display == 'none') return ;
// Hide archived row
document.getElementsByClassName("_2O4d9")[0].style.display = 'none'
}
})();
Result
Don’t forget to save the script (⌘ + S ), reload the WhatsApp page, and voilà! No more distracting messages searching for our attention! 🎉
The End
Join me on this productivity journey as we uncover hidden repository gems, learn cool tricks, and explore a variety of new technologies 🤓.
Top comments (0)