Scroll to top when searching is complete.

This commit is contained in:
Jim Driessen
2017-09-28 20:40:07 +02:00
committed by Daan Sprenkels
parent 04cdce9ad4
commit f50e76626c

View File

@ -48,11 +48,11 @@ $(function () {
$('#cancel-request').click(function () {
hideRequestTable();
});
$('.pagenum').change(function(){
getSongs();
});
$('#search-all, #search-uploader').change(function(){
$('.pagenum').val(1);
getSongs();
@ -63,24 +63,24 @@ $(function () {
$('.pagenum').val(1);
getSongs();
});
$('button.prev').click(function(){
var pageNumSelect = $('.pagenum');
pageNumSelect.val(Math.max(parseInt(pageNumSelect.val()) - 1, 1));
getSongs();
});
$('button.next').click(function(){
var pageNumSelect = $('.pagenum');
pageNumSelect.val(Math.min(parseInt(pageNumSelect.val()) + 1, pageNumSelect.children('option:last-child').val()));
getSongs();
});
$('button.first').click(function(){
$('.pagenum').val(1);
getSongs();
});
$('button.last').click(function(){
var pageNumSelect = $('.pagenum');
pageNumSelect.val(pageNumSelect.children('option:last-child').val());
@ -279,6 +279,10 @@ function getSongs()
}
pageNumSelect.val(result.current_page);
$('.pagesize').val(result.per_page);
refreshingSongs = false;
if(requestViewOpen) {
window.scrollTo(0, 0);
}
});
}