mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 22:28:51 +00:00
[ticket/11795] Redo form elements auto-focus
Use data-focus attribute for forms to focus elements when document is loaded instead of adding JavaScript PHPBB3-11795
This commit is contained in:
parent
235e3f5595
commit
605cd0cafb
3 changed files with 12 additions and 25 deletions
|
@ -293,20 +293,23 @@ function apply_onkeypress_event() {
|
||||||
jQuery(document).ready(apply_onkeypress_event);
|
jQuery(document).ready(apply_onkeypress_event);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adjust HTML code for IE8 and older versions
|
* Run onload functions
|
||||||
*/
|
*/
|
||||||
(function($) {
|
(function($) {
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
// Focus forms
|
||||||
|
$('form[data-focus]:first').each(function() {
|
||||||
|
$('#' + this.getAttribute('data-focus')).focus();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Adjust HTML code for IE8 and older versions
|
||||||
var test = document.createElement('div'),
|
var test = document.createElement('div'),
|
||||||
oldBrowser = (typeof test.style.borderRadius == 'undefined');
|
oldBrowser = (typeof test.style.borderRadius == 'undefined');
|
||||||
delete test;
|
delete test;
|
||||||
|
|
||||||
if (!oldBrowser) {
|
if (oldBrowser) {
|
||||||
return;
|
// Fix .linkslist.bulletin lists
|
||||||
|
$('ul.linklist.bulletin li:first-child, ul.linklist.bulletin li.rightside:last-child').addClass('no-bulletin');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix .linkslist.bulletin lists
|
|
||||||
$('ul.linklist.bulletin li:first-child, ul.linklist.bulletin li.rightside:last-child').addClass('no-bulletin');
|
|
||||||
});
|
});
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,6 @@
|
||||||
<!-- INCLUDE overall_header.html -->
|
<!-- INCLUDE overall_header.html -->
|
||||||
|
|
||||||
<script type="text/javascript">
|
<form action="{S_LOGIN_ACTION}" method="post" id="login" data-focus="<!-- IF S_ADMIN_AUTH -->{PASSWORD_CREDENTIAL}<!-- ELSE -->{USERNAME_CREDENTIAL}<!-- ENDIF -->">
|
||||||
// <![CDATA[
|
|
||||||
onload_functions.push(function () {
|
|
||||||
document.getElementById("<!-- IF S_ADMIN_AUTH -->{PASSWORD_CREDENTIAL}<!-- ELSE -->{USERNAME_CREDENTIAL}<!-- ENDIF -->").focus();
|
|
||||||
});
|
|
||||||
// ]]>
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<form action="{S_LOGIN_ACTION}" method="post" id="login">
|
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
<div class="inner">
|
<div class="inner">
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,8 @@
|
||||||
<!-- INCLUDE overall_header.html -->
|
<!-- INCLUDE overall_header.html -->
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
// <![CDATA[
|
|
||||||
onload_functions.push(function () {
|
|
||||||
document.getElementById("keywords").focus();
|
|
||||||
});
|
|
||||||
// ]]>
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<h2 class="solo">{L_SEARCH}</h2>
|
<h2 class="solo">{L_SEARCH}</h2>
|
||||||
|
|
||||||
<form method="get" action="{S_SEARCH_ACTION}">
|
<form method="get" action="{S_SEARCH_ACTION}" data-focus="keywords">
|
||||||
|
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
<div class="inner">
|
<div class="inner">
|
||||||
|
|
Loading…
Add table
Reference in a new issue