Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// ==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
You can’t perform that action at this time.