Skip to content

Instantly share code, notes, and snippets.

@dancek
Created September 24, 2019 14:24
Show Gist options
  • Save dancek/f65de9b4577775a9e567473384f45604 to your computer and use it in GitHub Desktop.
Save dancek/f65de9b4577775a9e567473384f45604 to your computer and use it in GitHub Desktop.
Slightly more usable Telegram Web
// ==UserScript==
// @name Telegram Web: compact layout
// @match https://web.telegram.org/
// @grant GM_addStyle
// @author Hannu Hartikainen
// ==/UserScript==
// Make layout wider and more compact
GM_addStyle(`
.im_page_wrap, .tg_head_split, .im_send_panel_wrap, .im_send_form {
max-width: initial;
}
.im_history_message_wrap {
margin-top: 4px;
}
.im_history_message_wrap.im_grouped, .im_history_message_wrap.im_grouped_short {
margin-top: 0;
}
.im_history_message_wrap .im_content_message_wrap {
margin: 2px 8px;
}
.im_message_wrap {
max-width: 60em;
}
`)
// Make font size larger on larger displays (scale: 12..15px)
GM_addStyle(`
@media (min-width: 1200px) {
body {
font-size: 1.0vw;
}
}
@media (min-width: 1500px) {
body {
font-size: 15px;
}
}
`)
// Hide link image/video previews except when selected
GM_addStyle(`
.im_message_webpage_photo > .im_message_photo_thumb,
.im_message_webpage_video > .im_message_video_thumb{
display: none;
}
.im_message_selected .im_message_webpage_photo > .im_message_photo_thumb,
.im_message_selected .im_message_webpage_video > .im_message_video_thumb{
display: block;
}
`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment