Instantly share code, notes, and snippets.

Embed
What would you like to do?
Nuclino SidebarToggle Ctrl+Shift+H Shortcut (Tampermonkey Userscript)
// ==UserScript==
// @name Nuclino SidebarToggle Ctrl+Shift+H
// @namespace http://tampermonkey.net/
// @version 0.4.8
// @downloadURL https://gist.github.com/muellermarkus/7709efc76b3bf65aa24d4966889575fe/raw/
// @updateURL https://gist.github.com/muellermarkus/7709efc76b3bf65aa24d4966889575fe/raw/
// @description Adds a Sidebar Toggle functionality to the Nuclino webapp (press "Ctrl+Shift+H" to toggle)
// @author Markus Mueller
// @require https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.18.2/babel.js
// @require https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/6.16.0/polyfill.js
// @match https://app.nuclino.com/*
// ==/UserScript==
// How to install via GitHub Gist. Install Tampermonkey, visit this page and and click on "Raw" => Tampermonkey dialog opens and allows you to install the script.
// If auto-updating is enabled in your settings, this script will auto-update itself.
/* jshint ignore:start */
var inline_src = (<><![CDATA[
/* jshint ignore:end */
/* jshint esnext: false */
/* jshint esversion: 6 */
window.addEventListener('keypress', function(e){
// Close Button || Open Button
const sidebarToggle =
document.querySelector("div._7XdAsEUKwzbU6hjB8MneA._84bTrJSSD4IvncuvD8MDV") ||
document.querySelector("div._18LcGwZnpoCHePxvvwVMD6");
if (e.shiftKey && e.ctrlKey && e.key == "H") {
sidebarToggle.click();
}
}, false);
/* jshint ignore:start */
]]></>).toString();
var c = Babel.transform(inline_src, { presets: [ "es2015", "es2016" ] });
eval(c.code);
/* jshint ignore:end */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment