fix continious scrolling

This commit is contained in:
Jonas Heinrich 2018-08-06 17:07:52 +02:00
parent 1707ed2c8d
commit 24c43d96eb

View File

@ -2,6 +2,7 @@ $(function(){
$(document).ready(function () {
// Player icon pause/stop
var vid = document.getElementById("player");
vid.onwaiting = function () {
$('#playbutton').attr("class", "buffering");
@ -9,6 +10,34 @@ $(function(){
vid.onplaying = function () {
$('#playbutton').attr("class", "pause");
};
vid.onpause = function () {
$('#playbutton').attr("class", "play");
};
// Scroll event handler
$(window).scroll(function(){
var station_list = $("#app-content-files");
if ( ( $(window).scrollTop() + $(window).height() ) == $(document).height() ) {
if(!station_list.data("didfire")) {
console.log("fire");
station_list.data("didfire", true);
if ($('li.nav-files').hasClass('active')){
radio_query(1, "");
} else if ($('li.nav-recent').hasClass('active')) {
radio_query(2, "");
} else if ($('li.nav-favorites').hasClass('active')) {
console.log("todo");
} else {
var query = $('#searchbox').val();
radio_query(0, query);
};
var ref = station_list;
setTimeout(function(){
ref.data("didfire", false);
}, 500);
};
};
});
});
@ -62,38 +91,12 @@ $(function(){
action_favorite(stationid);
});
/* Scroll event handler for continious scrolling */
$('#app-content').data("didfire", false).scroll(function() {
if ($(this).height() == ($(this).get(0).scrollHeight - $(this).scrollTop())) {
if(!$(this).data("didfire")) {
$(this).data("didfire", true);
if ($('li.nav-files').hasClass('active')){
radio_query(1, "");
} else if ($('li.nav-recent').hasClass('active')) {
radio_query(2, "");
} else if ($('li.nav-favorites').hasClass('active')) {
console.log("todo");
} else {
var query = $('#searchbox').val();
radio_query(0, query);
};
var ref = $(this);
setTimeout(function(){
ref.data("didfire", false);
}, 500);
};
};
});
/* Playbutton click */
$('#playbutton').click(function() {
var music = document.getElementById('player');
if (music.paused && $("#player").attr("src") != "") {
music.play();
} else {
$('#playbutton').removeClass("pause");
$('#playbutton').addClass("play");
music.pause();
}
});
@ -345,9 +348,17 @@ $(function(){
search.setFilter('radio', mySearch);
}
});*/
OC.Plugins.attach('OCA.Search.Core', function(search) {
search.setFilter('radio', mySearch);
});
SearchProxy = {
attach: function(search) {
search.setFilter('radio', function(query) {
alert("test");
});
}
};
OC.Plugins.register('OCA.Search.Core', SearchProxy);
$('#volumeslider').slider({
orientation: "horizontal",