Skip to content

Instantly share code, notes, and snippets.

@BlurryFlurry
Last active December 31, 2018 12:49
Embed
What would you like to do?
shortcut keys for youtube comment reply template
// ==UserScript==
// @name Youtube Comment Reply
// @namespace Violentmonkey Scripts
// @match https://www.youtube.com/comments
// @grant none
// ==/UserScript==
//
(function () {
var simulateClick = function (elem) {
// Create our event (with options)
var evt = new MouseEvent('click', {
bubbles: true,
cancelable: true,
view: window
});
// If cancelled, don't dispatch our event
var canceled = !elem.dispatchEvent(evt);
};
replyFunc = function(e){
switch (e.key){
case "F1":
cmtMessage = "Thanks bro"
break;
case "F2":
cmtMessage = "Issarahata karannam bro"
break;
case "F3":
cmtMessage = "Thanks, issarahata karannam bro"
break;
case "F4":
cmtMessage = "Price eka description eke dala thiyenawa bro"
break;
case "F6":
cmtMessage = "Sure will do bro"
break;
case "F8":
cmtMessage = "Thanks, sure will do bro"
}
document.getElementById("ytcb-text").textContent=cmtMessage;
replyBtn = document.getElementById("ytcb-reply");
replyBtn.disabled=false;
simulateClick(replyBtn);
}
document.getElementById("ytcb-text").addEventListener("keydown",replyFunc)
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment