Created
September 6, 2022 14:40
-
-
Save iamaamir/bfadd74af113e5f124bde6a25a3d8590 to your computer and use it in GitHub Desktop.
Blur whatsapp chats one sidebar and header
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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