Adding costum shortcut action into tampermonkey script

Viewed 104

I am quite new with tampermonkey so if you give really simple answers i would be really greatful:)

I am planning to write a simple script when i press on short cut button such as alt+a i would like to paste predefined text such as apple.

document.onkeyup=function(e){
  var e = e || window.event; // for IE to cover IEs window event-object
  if(e.altKey && e.which == 65) {
    print('apple');
    return false;
  }
}

I have this JS code but I am not sure how to transform that to userscript.

Any help would be most welcome.

0 Answers
Related