// ==UserScript== // @name kbin Keyboard Shortcuts // @namespace http://tampermonkey.net/ // @version 0.1 // @description Adds keyboard shortcuts for formatting and navigation // @author Artillect // @match https://kbin.social/* // @match https://fedia.io/* // @match https://kilioa.org/* // @grant none // @license MIT // @downloadURL https://update.greasyfork.icu/scripts/468603/kbin%20Keyboard%20Shortcuts.user.js // @updateURL https://update.greasyfork.icu/scripts/468603/kbin%20Keyboard%20Shortcuts.meta.js // ==/UserScript== (function() { 'use strict'; const Formats = {'bold': '**', 'italic': '*', 'underline': '__', 'strikethrough': '~~', 'code': '`', 'spoiler': '||', 'quote': '>'}; // On page load, add keyboard shortcuts to the button hover text window.onload = function() { // Get all buttons in the markdown toolbar by tag name document.getElementsByTagName('md-bold')[0].title = "Ctrl + B"; document.getElementsByTagName('md-italic')[0].title = "Ctrl + I"; document.getElementsByTagName('md-header')[0].title = "Insert header"; document.getElementsByTagName('md-quote')[0].title = "Ctrl + Shift + ,"; document.getElementsByTagName('md-code')[0].title = "Insert code"; document.getElementsByTagName('md-link')[0].title = "Insert link"; document.getElementsByTagName('md-image')[0].title = "Insert image"; document.getElementsByTagName('md-ordered-list')[0].title = "Insert ordered list"; document.getElementsByTagName('md-unordered-list')[0].title = "Insert unordered list"; // Add button for strikethrough document.getSelection('markdown-toolbar')[0].innerHTML += '