Skip to content

Instantly share code, notes, and snippets.

@hamen
Created April 27, 2020 14:30
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 hamen/73e3495e48fa0a7e9fcf8ed0b20d1600 to your computer and use it in GitHub Desktop.
Save hamen/73e3495e48fa0a7e9fcf8ed0b20d1600 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Telegram - Jump to first unread message
// @namespace https://ivanmorgillo.com/
// @version 0.1
// @description Kinda Slack shortcut
// @author Ivan Morgillo
// @match https://web.telegram.org/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
window.$(document).on("keydown", function(e){
if (e.keyCode == 75 && (e.ctrlKey || e.metaKey)){
var unread = window.$( '.im_dialog_badge.badge:not(".ng-hide")' ).first();
if (unread != undefined) {
var container = unread.parent().parent();
container.mousedown();
console.log("container clicked");
}
}
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment