Skip to content

Instantly share code, notes, and snippets.

@jindrichsirucek
Last active October 30, 2020 01:52
Show Gist options
  • Save jindrichsirucek/4373d9b902f7fc16df62c2c8b5314f17 to your computer and use it in GitHub Desktop.
Save jindrichsirucek/4373d9b902f7fc16df62c2c8b5314f17 to your computer and use it in GitHub Desktop.
schortuct to start and stop debug in GAS for tampermonkey
// ==UserScript==
// @name schortuct to debug in GAS
// @namespace http://tampermonkey.net/
// @version 0.1
// @description ctr+alt+d - run debug in google apps script
// @author You
// @match https://script.google.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
document.onkeyup = debugRunShortcut;
function debugRunShortcut(e)
{
//alert(e.ctrlKey + " " + e.altKey + " " + e.keyCode);
if (e.ctrlKey && e.altKey)
{
if(e.keyCode == "D".charCodeAt(0))//D - run debug
dispEvent("debugButton");
if(e.keyCode == "S".charCodeAt(0))//S - Stop debug
dispEvent("stopButton");
}
}
function dispEvent(elemId)
{
var elem = document.getElementById(elemId);
elem.dispatchEvent(new Event('mousedown', {bubbles: true}));
elem.dispatchEvent(new Event('mouseup', {bubbles: true}));
e.cancelBubble = true;
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment