Skip to content

Instantly share code, notes, and snippets.

@iamaamir
Created September 6, 2022 14:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamaamir/bfadd74af113e5f124bde6a25a3d8590 to your computer and use it in GitHub Desktop.
Save iamaamir/bfadd74af113e5f124bde6a25a3d8590 to your computer and use it in GitHub Desktop.
Blur whatsapp chats one sidebar and header
// ==UserScript==
// @name Whatsapp Blur chat
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Blur the chats sidebar on whatsapp
// @author Aamir khan
// @match https://web.whatsapp.com/
// @icon https://www.google.com/s2/favicons?domain=whatsapp.com
// @grant none
// ==/UserScript==
(function() {
'use strict';
function waitForElm(selector) {
return new Promise(resolve => {
if (document.querySelector(selector)) {
return resolve(document.querySelector(selector));
}
const observer = new MutationObserver(mutations => {
if (document.querySelector(selector)) {
resolve(document.querySelector(selector));
observer.disconnect();
}
});
observer.observe(document.body, {
childList: true,
subtree: true
});
});
}
const blur = (x) => el => {el.style.filter = `blur(${x})`};
const applyBlur = (s, x="1rem") => {waitForElm(s).then(blur(x));}
applyBlur('#pane-side');
applyBlur('#main header');
// Your code here...
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment