fix loading all favorites and remember sorting order
This commit is contained in:
parent
e0eadcd950
commit
ceb3107643
@ -1,5 +1,9 @@
|
|||||||
## 0.6.2 –
|
## 0.6.3 –
|
||||||
### Fixed
|
### Fixed
|
||||||
|
- Fix loading all favorites
|
||||||
|
[#58](https://git.project-insanity.org/onny/nextcloud-app-radio/issues/58) @onny
|
||||||
|
- Remember favorite stations sort order
|
||||||
|
[#64](https://git.project-insanity.org/onny/nextcloud-app-radio/issues/64) @onny
|
||||||
- Split up javascript file
|
- Split up javascript file
|
||||||
[#67](https://git.project-insanity.org/onny/nextcloud-app-radio/issues/67) @onny
|
[#67](https://git.project-insanity.org/onny/nextcloud-app-radio/issues/67) @onny
|
||||||
|
|
||||||
|
31
js/main.js
31
js/main.js
@ -196,20 +196,33 @@ var MODULE = (function (radio) {
|
|||||||
|
|
||||||
radio.query_stations = function(station_ids){
|
radio.query_stations = function(station_ids){
|
||||||
var station_array = [];
|
var station_array = [];
|
||||||
|
var station_array_new = [];
|
||||||
|
|
||||||
station_ids.forEach(function (station_id, idx) {
|
station_ids.forEach(function (station_id, idx) {
|
||||||
|
var url = "https://www.radio-browser.info/webservice/json/stations/byid/"+station_ids[idx];
|
||||||
|
$.getJSON( url , function( data ) {
|
||||||
|
|
||||||
$.ajax({
|
if (data.length === 0) {
|
||||||
method: "GET",
|
station_array = station_array.concat([{'id': station_id, 'name': 'Broken radio station entry :(', 'favicon': '', 'url': ''}])
|
||||||
url: "https://www.radio-browser.info/webservice/json/stations/byid/"+station_ids[idx],
|
} else {
|
||||||
dataType: 'json',
|
station_array = station_array.concat(data);
|
||||||
}).success( function(data){
|
|
||||||
station_array = station_array.concat(data);
|
|
||||||
if (station_ids.length == (idx+1)){
|
|
||||||
radio.render_results(station_array);
|
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
|
||||||
|
if (station_ids.length == station_array.length){
|
||||||
|
|
||||||
|
// sorting results array
|
||||||
|
station_ids.forEach( function (station_id) {
|
||||||
|
station_array.forEach( function (station) {
|
||||||
|
if (station_id === station['id']) {
|
||||||
|
station_array_new = station_array_new.concat(station);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
radio.render_results(station_array_new);
|
||||||
|
};
|
||||||
|
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user