whatsapp-desktop-dark
whatsapp-desktop-dark copied to clipboard
[not an issue] [enhancement] Userscript implementation?
Very cool. I'm just wondering, is it possible to add a userscript to the whatsapp desktop app? I usually use this userscript to hide my contacts and the currently open chat with a hotkey, but I haven't really used the desktop app cos I haven't been able to get the userscript. The userscript is like this. Again, I'm not even sure if it can be implemented into the app, but it would be pretty epic if it's possible.
// ==UserScript==
// @name Whatsapp Web Privacy Mode lite
// @namespace graphen
// @version 1.8
// @description Add button and hotkey to hide contact names on web.whatsapp.com
// @author Graphen
// @match https://web.whatsapp.com/
// @icon https://i.imgur.com/LeZuNg7.png
// @grant none
// ==/UserScript==
/* jshint esversion: 6 */
(function() {
'use strict';
var hidden = false;
window.addEventListener('load', () => {
document.addEventListener("keydown", function(e) {
var keyCode = e.keyCode;
if(keyCode==115) {
toggleShowHide();
}
}, false);
});
function toggleShowHide() {
var sidepanel = document.getElementById('pane-side');
var contactname = document.getElementsByClassName('_1lpto')[0];
if (hidden) {
console.log("WA Privacy: Toggled show.");
try { // show
sidepanel.setAttribute('style', 'display:block');
contactname.setAttribute('style', 'visibility:visible !important;');
} catch(err) {
console.log("toggleShow: " + err);
}
} else {
console.log("WA Privacy: Toggled hide.");
try { // hide
sidepanel.setAttribute('style', 'display:none');
contactname.setAttribute('style', 'visibility:hidden !important;');
} catch(err) {
console.log("toggleHide: " + err);
}
}
hidden = !hidden;
}
})();
Hi @ndrew222, I've been fiddling with a few modification scripts for WA desktop myself. But injecting scripts is way too complicated and time consuming so far. I do like to see this come to life but it might take some time till i can come up with something stable. I'll keep this in consideration. Thanks for the suggestion.
UPDATE: I think we're on the right path now because i was able to inject a Dark/Light mode switch button to the UI. This might become possible. 🤞🏼