Skip to content

Instantly share code, notes, and snippets.

@shmileee
Last active August 13, 2021 13:35
Show Gist options
  • Save shmileee/ea84f45c29b962699289f3b62a0d4efc to your computer and use it in GitHub Desktop.
Save shmileee/ea84f45c29b962699289f3b62a0d4efc to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Insert Ś
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author shmileee
// @match *://docs.google.com/spreadsheets/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// ==/UserScript==
(function() {
document.addEventListener('keydown', function(e){
if(e.altKey && e.shiftKey){
switch(e.code){
case 'KeyS':
insertLetter();
break;
}
}
}, true);
})();
function insertLetter() {
var range = window.getSelection().getRangeAt(0);
range.deleteContents();
var newNode = document.createTextNode("Ś");
range.insertNode(newNode);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment