Skip to content

Instantly share code, notes, and snippets.

@realgenekim
Created October 20, 2023 04:21
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 realgenekim/b83a378dbe4a7ca91fb67adfd14908f7 to your computer and use it in GitHub Desktop.
Save realgenekim/b83a378dbe4a7ca91fb67adfd14908f7 to your computer and use it in GitHub Desktop.
tampermonkey script for Piwaa: messaging for linkedin: put in keyboard accelerator to archive message
// ==UserScript==
// @name Piwaa: Linkedin Messages: keyboard accelerators
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Script to accept all the follow requests
// @author You
// @match https://app.piwaa.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=linkedin.com
// @grant none
// ==/UserScript==
//To Activate the Script reload the Connection Request Page
(function() {
'use strict';
function getArchiveButton(parent) {
return parent.querySelectorAll("button[title='Archive']");
}
function highlight() {
const els = document.querySelectorAll("div.MuiCardContent-root");
//console.log("els: length: " + els.length);
els.forEach(item => {
item.style.border = '3px solid pink';
});
//els[0].click();
const selected = document.querySelectorAll("div.MuiCardContent-root[pressed='1']");
selected[0].style.border = '3px solid green';
const archive = getArchiveButton(selected[0]);
if (archive.length > 0) {
archive[0].style.border = '3px solid green';
}
}
function archive() {
const selected = document.querySelectorAll("div.MuiCardContent-root[pressed='1']");
const archive = getArchiveButton(selected[0]);
archive[0].style.border = '3px solid pink';
console.log("ARCHIVE!")
archive[0].click();
}
window.onload = highlight;
setInterval(highlight, 1500);
document.addEventListener('keydown', function(event) {
console.log("keydown:" + event.key);
// Check if the 'A' key is pressed and the 'Alt' key is held down
// if (event.key === 'a' && event.altKey) {
if (event.key === 'å' && event.altKey) {
archive(); // Call your desired function
}
});
// Your code here...
})();
@realgenekim
Copy link
Author

Piwaa is a fantastic tool to make LinkedIn Messaging easier to navigate and reply to. Chrome extension: https://chrome.google.com/webstore/detail/piwaa/bkcibcjcbhgjoddeldfmgkbaipjkidpf

This is a way to get keyboard accelerator for "Opt-A" to archive messages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment