This topic is locked
[SOLVED]

HotKeys

12/26/2024 3:48:56 PM
PHPRunner General questions
A
asawyer13 authorDevClub member

I saw some older posts about adding HotKeys to a PHPRunner app, but the one I really liked doesn't see to exist any longer.

If anyone has added HotKeys to their PHPR app and willing to share how they did it, I would be appreciated.

Thanks in advance,

Alan Sawyer
USA

C
Chris Whitehead 12/26/2024

I would think the best method would be adding javascript into the javascript onload event, Ypu'll need to echo out the codes for each keypress so you can add in the correct one.

Something like this which I found on stakoverflow
https://stackoverflow.com/questions/2511388/how-can-i-add-a-keyboard-shortcut-to-an-existing-javascript-function

document.onkeyup=function(e){
var e = e || window.event;
console.log( {keypress:e.which} );
if(e.which ==37) {
$("#prev").click()
}else if(e.which == 39){
$("#next").click()
}
}

A
asawyer13 authorDevClub member 12/26/2024

The problem is that I'm gonig to want it on every page in my project.
That's why I was thinking maybe a system wide function or something that I could setup once and have it be able to be executed on all pages.

I'm not a JS expert, but can code be put somewhere so it's available on all pages?
Alan

G
Grdimitris 12/27/2024

In Events, at the bottom of list there is custom_functions.js.
There you can write global code for all pages. Be aware for browsers HotKeys.

A
asawyer13 authorDevClub member 12/27/2024

Thanks everyone. I will try it out.
Alan