LP Messenger Hotkeys

Various messenger.com hotkeys for pure keyboard navigation.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name        LP Messenger Hotkeys
// @namespace   Violentmonkey Scripts
// @match       https://www.messenger.com/*
// @license     MIT
// @grant       none
// @version     0.1
// @author      Sadist
// @description Various messenger.com hotkeys for pure keyboard navigation.
// ==/UserScript==


document.addEventListener("keydown", (event) => {
  if ( (event.key === "x") && (event.ctrlKey) ) {
    tbox = document.querySelector('[aria-label="Message"]');
    console.log('here');
    tbox.focus();
  }
})

document.addEventListener("keydown", (event) => {
  if ( !event.altKey ) {
    return;
  }
  keyList = ['1','2','3','4','5','6','7','8','9','0','l','g','i','e','t'];
  if ( !keyList.includes(event.key) ) {
    return;
  }
  if (event.key === 'l') {
    document.querySelector('[aria-label^="Send a"]').click();
    return;
  }
  if (event.key === 'g') {
    document.querySelector('[aria-label="Choose a GIF"]').click();
    document.querySelector('[aria-label="GIF Search"]').click();
    return;
  }
  if (event.key === 'i') {
    document.querySelector('[aria-label^="Attach a file"]').click();
    return;
  }
  if (event.key === 'e') {
    event.preventDefault();
    document.querySelector('[aria-label="Choose an emoji"]').click();
    document.querySelector('[aria-label="Search emoji"]').click();
    return;
  }
  if (event.key === 't') {
    event.preventDefault();
    document.querySelector('[aria-label="Choose a sticker"]').click();
    return;
  }
  groupIndex = parseInt(event.key);
  focusGroup = document.querySelectorAll('[href^="/t"],[href^="/e2ee/t"]')[groupIndex];
  focusGroup.click();
})