Auto-focus on forms
With this mod, when you open a page with a form, the cursor will jump into the form automatically, so you can start typing without having to select the form first.
Fast Reply
To let your users' cursor automatically jump to the fast reply field when the open it, go to Look & Feel in your ACP, open the skin group "Topic View", edit the template bit "quick_reply_box_closed" and add at the end of the link's href attribute:
document.getElementById('fast-reply_textarea').focus();
Your final code should look similar to this:
<a href="javascript:ShowHide('qr_open','qr_closed'); document.getElementById('fast-reply_textarea').focus();" title="{$this->ipsclass->lang['qr_open']}" accesskey="f"><{T_QREPLY}></a>
Other forms
- Open the 'Board Header & Footer Wrapper' of your skin
-
After "<% JAVASCRIPT %>", add:
<script type="text/javascript">
//hbtronix.de/IPB - auto-focus on form fields
var nk_autofocus = false;
var nk_is_rte = false;
function setAutoFocus(e, force, rte) { if(nk_autofocus === false || force) { nk_autofocus = e; nk_is_rte = !!rte; } }
function checkAutoFocus() {
if(nk_autofocus !== false) {
if(nk_is_rte) {
IPS_editor[nk_autofocus].editor_check_focus();
} else {
var e = document.getElementById(nk_autofocus);
if(e) e.focus();
}
}
}
</script> -
And after "<body", add:
onload="checkAutoFocus()"
-
The final code should look more or less like this:
<% JAVASCRIPT %>
<script type="text/javascript">
(...)
</script>
</head>
<body onload="checkAutoFocus()"> - Open the skin group 'Post / PM Editor' of your skin and edit the template bit 'ips_editor'
-
At the top, add:
<script type="text/javascript">if($rte_mode == 1) setAutoFocus('{$editor_id}', false, true); else setAutoFocus('{$editor_id}_textarea'); </script>
- Open the skin group 'Messenger' of your skin and edit the template bit 'topictitle_fields'
-
At the top, add:
<script type="text/javascript">setAutoFocus('entered_name');</script>
- Open the skin group 'Post Screen' of your skin and edit the template bit 'topictitle_fields'
-
At the top, add:
<script type="text/javascript">setAutoFocus('TopicTitle');</script>
-
Find:
<input type="text" size="50" maxlength="{$this->ipsclass->vars['topic_title_max_len']}" name="TopicTitle" value="{$data['TITLE']}" tabindex="1" />
-
And change to:
<input type="text" size="50" maxlength="{$this->ipsclass->vars['topic_title_max_len']}" name="TopicTitle" id="TopicTitle" value="{$data['TITLE']}" tabindex="1" />
Now every time you visit the new topic, reply or write PM page, your cursor should be focused on the first form field and you can start typing immediately.
Credit
If you liked my modifications, please link back to this site (http://hbtronix.de/IPB/)!