Unverified Commit ea1d2d16 authored by Jonathan Horak's avatar Jonathan Horak Committed by GitHub
Browse files

Focus and select search input (#6348)

* Focus and select search input

* Set feature to desktop only per https://github.com/2factorauth/twofactorauth/pull/6348#issuecomment-996243469 and https://github.com/2factorauth/twofactorauth/pull/6348#issuecomment-997432757



* Move codeblock inside `resizeObserver`

* Empty commit to trigger checks
Co-authored-by: default avatarMichael Loßin <github@michael-lossin.de>
parent 5c54e11d
$(document).ready(function () {
// Show popup notice
$('.exception').popup({ position: 'right center', hoverable: true, title: 'Exceptions & Restrictions' });
......@@ -19,7 +18,7 @@ $(document).ready(function () {
$('.cat').click(function () {
let query = window.location.hash;
// Collapse all other tables.
// Collapse all other tables
$('.collapse').collapse('hide');
$('.cat').removeClass('active');
......@@ -33,8 +32,7 @@ $('.cat').click(function () {
}
});
// Show desktop & mobile tables
// Show desktop and mobile tables
function showCategory(category) {
$(`#${category}-table`).collapse("show");
$(`#${category}-mobile-table`).collapse("show");
......@@ -43,11 +41,16 @@ function showCategory(category) {
let resizeObserver = new ResizeObserver(() => {
// Fix the footer to bottom of viewport if body is less than viewport
if($('body').height() < $(window).height()){
if ($('body').height() < $(window).height()) {
$('.footer').css({position: 'absolute'});
}else{
} else {
$('.footer').css({position: 'static'});
}
// Focus and select search input on desktop
if ($(window).innerWidth() >= 992) {
$('#innerSearchBox').focus().select();
}
});
resizeObserver.observe($('body')[0]);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment