Created
February 13, 2017 04:10
-
-
Save mog86uk/c12cc17e8c1e8edeb33f7ca244dea90a to your computer and use it in GitHub Desktop.
A mod for the Discord web app - to give extra shortcut keys for hiding sidebars, plus more layout stuff...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Discord Layout Mod | |
// @namespace mog86uk-discord-layout-mod | |
// @version 1.0 | |
// @description A mod for the Discord web app - to give extra shortcut keys for hiding sidebars, plus more layout stuff... | |
// @author mog86uk | |
// @match https://discordapp.com/channels/* | |
// @require http://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js | |
// @grant none | |
// ==/UserScript== | |
jQuery.noConflict(); | |
jQuery(document).ready(function($) { | |
/*jshint multistr: true */ | |
var TheStyleSheet="\ | |
.channel-members-wrap {min-width: 220px !important;} /* default = min-width: 240px; */\n\ | |
.channel-members {padding: 0 0 20px !important;} /* default = padding: 20px 0; */\n\ | |
.channel-members h2 {margin: 9px 0 0 !important;} /* default = margin: 9px 0; margin-top: 30px; */\n\ | |
.member-status {padding: 5px 16px 5px 10px !important;} /* default = padding: 5px 16px 5px 30px; */\n\ | |
.title-wrap {min-height: 10px !important;} /* default = min-height: 57px; */\n\ | |
.message-group {padding: 10px 0 !important;} /* default = padding: 20px 0; */\n\ | |
.channel-textarea {margin: 10px 0 30px !important;} /* default = margin: 20px 0 30px; */"; | |
addGlobalStyle(TheStyleSheet); | |
$(document).on('keydown', function(evt) { | |
if (evt.ctrlKey) { | |
switch(evt.which) { | |
case 71: // Ctrl + G | |
evt.preventDefault(); | |
$('.title-wrap').toggle(); | |
break; | |
case 72: // Ctrl + H | |
evt.preventDefault(); | |
$('.guilds-wrapper').toggle(); | |
break; | |
case 74: // Ctrl + J | |
evt.preventDefault(); | |
$('.channels-wrap').toggle(); | |
} | |
} | |
}); | |
function addGlobalStyle(css) { | |
var head, style; | |
head = document.getElementsByTagName('head')[0]; | |
if (!head) { return; } | |
style = document.createElement('style'); | |
style.type = 'text/css'; | |
style.innerHTML = css; | |
head.appendChild(style); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ctrl + G = show/hide title bar
Ctrl + H = show/hide server list
Ctrl + J = show/hide channel list
(Ctrl + U = show/hide channel member list)