Hello fellas,
Today we are going to see how can you create keyboard shortcuts for your forum. For example, what if you want to check inbox fast, and you are lazy to click "Messages" link? Not a problem, we got a neat trick for you!
Go to CP > Modules > HTML & Javascript > Javascript Codes management and create a new script. Name it as you wish and paste this code in it:
$(document).keydown(function(e){ // Shift + S - Go to search page if(e.shiftKey && e.keyCode == 83){ location.href = 'https://testaca.forumotion.me/search'; } // Shift + 1 - Go to inbox page if(e.shiftKey && e.keyCode == 49){ location.href = 'https://testaca.forumotion.me/privmsg?folder=inbox'; } // Shift + F - Go to FAQ page if(e.shiftKey && e.keyCode == 70){ location.href = 'https://testaca.forumotion.me/faq'; } });
In the code above you can see we have 3 if statements where we check which keys have been pressed. If the statement is true, we do what's inside. At the moment, we have redirection to some pages.
Shift+S - leads to search page
Shift+1 - leads to inbox page
Shift+F - leades to FAQ
Have in mind that you MUST change links given here because this is setup for my test forum, but not for yours ;)
If you wish to add more if statements, just copy the original one and change the keyCode number.
In case you want to know keyCode numbers for keyboard, visit:
https://www.toptal.com/developers/keycode and press any key.
Cheers. ;)