mirror of
https://github.com/YunoHost/doc.git
synced 2024-09-03 20:06:26 +02:00
20 lines
619 B
JavaScript
20 lines
619 B
JavaScript
|
import $ from 'jquery';
|
||
|
|
||
|
if (window.sessionStorage.getItem('search-value')) {
|
||
|
$(document.body).removeClass('searchbox-hidden');
|
||
|
$('[data-search-input]').val(sessionStorage.getItem('search-value')).trigger('input');
|
||
|
}
|
||
|
|
||
|
// allow keyboard control for prev/next links
|
||
|
$(document).on('click', '.nav-prev, .nav-next', (event) => {
|
||
|
const target = $(event.currentTarget);
|
||
|
window.location.href = target.attr('href');
|
||
|
});
|
||
|
|
||
|
$(document).on('keydown', (event) => {
|
||
|
const item = event.which === 37 ? $('a.nav-prev') : (event.which === 39 ? $('a.nav-next') : null);
|
||
|
if (item) {
|
||
|
item.click();
|
||
|
}
|
||
|
});
|