Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: Adrek on March 02, 2012, 03:55:24 PM

Title: Changing shortcut Alt+s
Post by: Adrek on March 02, 2012, 03:55:24 PM
How can I change default shortcut Alt+s into Alt+w ?
In Polish language we have letter ś and users on Mac OS can type it, because this shortcut works on both Alt buttons, and it sends message :|
Title: Re: Changing shortcut Alt+s
Post by: JaGoDkA on March 03, 2012, 07:03:55 AM
Hallo,

I see somebody has this same problem. On my forum smf 2.0.2 users also reports this problem. Anybody has any idea how to solve it?
Title: Re: Changing shortcut Alt+s
Post by: MrPhil on March 03, 2012, 07:03:41 PM
Note that if you're using Firefox, it's shift+alt+s.

Unfortunately, the keys used are hard coded into the HTML templates. Look through your Themes/<theme name>/ files for accesskey="s" and change it to something else. You might do it for all languages you support, or just Polish. Also remember to change $txt['shortcuts'] and $txt['shortcuts_firefox'] to show the new letter. It appears that only 'p' and 's' are in use by SMF, but many browsers define the use of other letters (including alt+w) for their own purposes, so make changes with caution, to minimize user confusion.
Title: Re: Changing shortcut Alt+s
Post by: Adrek on March 04, 2012, 01:36:26 AM
Thank you for helping ;)

I found it in few files, and it seems to work, but in editor.js is this code:
// Register default keyboard shortcuts.
smc_Editor.prototype.registerDefaultShortcuts = function()
{
if (is_ff)
{
this.registerShortcut('b', 'ctrl', 'b');
this.registerShortcut('u', 'ctrl', 'u');
this.registerShortcut('i', 'ctrl', 'i');
this.registerShortcut('p', 'alt', 'preview');
this.registerShortcut('s', 'alt', 'submit');
}
}


And should  I change also this.registerShortcut('s', 'alt', 'submit'); to this.registerShortcut('w', 'alt', 'submit'); ?

AFAIK none of browsers uses Alt+w. There is Ctrl+w for close tab/window, but I think that browsers don't use Alt+w :)
Title: Re: Changing shortcut Alt+s
Post by: MrPhil on March 04, 2012, 12:43:04 PM
Yes, you'd have to change that, too. Some browsers running on Windows do use alt+w, so you should be aware of that (you would end up overriding that functionality).