implement continious scrolling
This commit is contained in:
parent
04b1bbf49c
commit
c8e86558d0
@ -2,6 +2,8 @@
|
||||
### Added
|
||||
- Display station metadata
|
||||
[#1523](https://github.com/owncloud/mail/pull/1523) @tahaalibra
|
||||
- Changelog file
|
||||
[#1523](https://github.com/owncloud/mail/pull/1523) @tahaalibra
|
||||
|
||||
### Changed
|
||||
- Minimum server is Nextcloud 10/ownCloud 9.1
|
||||
|
@ -3,7 +3,7 @@
|
||||
<id>radio</id>
|
||||
<name>Radio</name>
|
||||
<description>Listening to your favorite radio stations in Nextcloud</description>
|
||||
<version>0.5.0</version>
|
||||
<version>0.6.0</version>
|
||||
<licence>agpl</licence>
|
||||
<author>Jonas Heinrich</author>
|
||||
<bugs>https://git.project-insanity.org/onny/nextcloud-app-radio/issues</bugs>
|
||||
|
28
js/main.js
28
js/main.js
@ -12,11 +12,25 @@ $(function(){
|
||||
action_play(stationid);
|
||||
});
|
||||
|
||||
/* Save station to favorites */
|
||||
$('body').on('click', '.favpls', function() {
|
||||
var stationid = $(this).parent().parent().attr('data-id');
|
||||
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);
|
||||
radio_query(1, "");
|
||||
var ref = $(this);
|
||||
setTimeout(function(){
|
||||
ref.data("didfire", false);
|
||||
}, 500);
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
/* ==============
|
||||
// ACTIONS //
|
||||
@ -135,21 +149,23 @@ $(function(){
|
||||
method: "GET",
|
||||
url: "https://www.radio-browser.info/webservice/json/stations/byid/"+station_ids[stationid],
|
||||
dataType: 'json',
|
||||
success: render_result
|
||||
}).success( function(data){
|
||||
render_result(data);
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
function radio_query(type, query){
|
||||
var offset = $('tbody > tr').length;
|
||||
switch (type) {
|
||||
case 0:
|
||||
var url = "https://www.radio-browser.info/webservice/json/stations/search";
|
||||
break;
|
||||
case 1:
|
||||
var url = "https://www.radio-browser.info/webservice/json/stations/topclick/20";
|
||||
var url = "https://www.radio-browser.info/webservice/json/stations/topclick";
|
||||
break;
|
||||
case 2:
|
||||
var url = "https://www.radio-browser.info/webservice/json/stations/lastchange/20";
|
||||
var url = "https://www.radio-browser.info/webservice/json/stations/lastchange";
|
||||
break;
|
||||
};
|
||||
$.ajax({
|
||||
@ -157,10 +173,12 @@ $(function(){
|
||||
url: url,
|
||||
data: {
|
||||
name: query,
|
||||
limit: 20
|
||||
limit: 20,
|
||||
offset: offset
|
||||
},
|
||||
dataType: 'json',
|
||||
success: render_result
|
||||
}).success( function(data){
|
||||
render_result(data);
|
||||
});
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user