fix: load all favs at once

This commit is contained in:
Jonas Heinrich 2017-08-10 00:24:46 +02:00
parent 9624b4dc4c
commit 6a447f0148
3 changed files with 12 additions and 23 deletions

View File

@ -7,29 +7,12 @@
- Continious scrolling
[#13](https://git.project-insanity.org/onny/nextcloud-app-radio/commit/c8e86558d0a1ceeea21f801f6e2391ab70046a4e) @onny
- Loading animation
[#25](https://git.project-insanity.org/onny/nextcloud-app-radio/commit/c8e86558d0a1ceeea21f801f6e2391ab70046a4e) @onny
### Changed
- Minimum server is Nextcloud 10/ownCloud 9.1
[#84](https://github.com/nextcloud/mail/pull/84) @ChristophWurst
- Use session storage instead of local storage for client-side cache
[#1612](https://github.com/owncloud/mail/pull/1612) @ChristophWurst
- When deleting the current message, the next one is selected immediatelly
[#1585](https://github.com/owncloud/mail/pull/1585) @ChristophWurst
[#25](https://git.project-insanity.org/onny/nextcloud-app-radio/commit/9624b4dc4c5770df93b548736c1be43b96d6dea5) @onny
### Fixed
- Fix missing background color for first td in table row
[#32](https://git.project-insanity.org/onny/nextcloud-app-radio/commit/9e5b7961009ca7842f8a025de59cb3acaae2bea1) @onny
### Removed
- Removed old API
### Deprecated
- Deprecated new API
### Security
- Fixed XXE in xml upload
## 0.5.0 2017-08-06
### Added
- First release

View File

@ -157,7 +157,7 @@ $(function(){
});
};
function render_result(data){
function render_results(data){
var baseUrl = OC.generateUrl('/apps/radio');
$.get(baseUrl + '/stations', function ( fav_stations ) {
@ -165,6 +165,7 @@ $(function(){
$.each(data, function(i, station) {
var isstarred = ""
for (var fav_station in fav_stations) {
if (fav_stations[fav_station]["stationid"] == station['id']) {
isstarred = "starred";
@ -200,18 +201,22 @@ $(function(){
for (var station in data) {
stations.push(data[station]["stationid"]);
};
render_stations(stations);
query_stations(stations);
});
};
function render_stations(station_ids){
function query_stations(station_ids){
var station_array = [];
for (stationid in station_ids){
$.ajax({
method: "GET",
url: "https://www.radio-browser.info/webservice/json/stations/byid/"+station_ids[stationid],
dataType: 'json',
}).success( function(data){
render_result(data);
station_array = station_array.concat(data);
if (station_array.length == station_ids.length){
render_results(station_array);
};
});
};
};
@ -239,7 +244,7 @@ $(function(){
},
dataType: 'json',
}).success( function(data){
render_result(data);
render_results(data);
});
};

View File

@ -32,6 +32,7 @@
</div>
<div id="app-content">
<div id="app-content-files" class="viewcontainer">
<!-- <div class="mask transparent icon-loading"></div> -->
<table id="filestable" data-preview-x="32" data-preview-y="32">
<thead>
<tr>