2016-11-17 22:07:22 +00:00
|
|
|
$(window).on('load', function(){
|
|
|
|
|
|
|
|
$('body').on('click', 'tr', function() {
|
|
|
|
var sourceUrl = $(this).attr('src');
|
|
|
|
$("#player").attr("src", sourceUrl);
|
|
|
|
$('#player').trigger('play');
|
|
|
|
});
|
|
|
|
|
|
|
|
function show_result(data){
|
|
|
|
$("tbody > tr").remove();
|
|
|
|
$.each(data, function(i, station) {
|
2016-11-18 21:45:53 +00:00
|
|
|
$('tbody').append('<tr src='+station['url']+'>\
|
2017-01-04 16:15:12 +00:00
|
|
|
<td width=60px align=center><img class=fav width=20px height=20px src='+OC.imagePath('radio','fav.png')+'></td>\
|
2016-11-18 21:45:53 +00:00
|
|
|
<td width=60px align=center><img width=40px height=40px src='+station['favicon']+'></td>\
|
|
|
|
<td>'+station['name']+'</td>\
|
2017-01-04 16:15:12 +00:00
|
|
|
<td width=60px align=center><a href="'+station['homepage']+'" target="_blank"><img class=homepage width=20px height=20px src='+OC.imagePath('radio','homepage.png')+'></a></td>\
|
2016-11-18 21:45:53 +00:00
|
|
|
</tr>');
|
2016-11-17 22:07:22 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function search(query){
|
|
|
|
$.ajax({
|
|
|
|
method: "POST",
|
2016-11-18 21:45:53 +00:00
|
|
|
url: 'https://www.radio-browser.info/webservice/json/stations/search',
|
2016-11-17 22:07:22 +00:00
|
|
|
data: {
|
|
|
|
name: query
|
|
|
|
},
|
|
|
|
dataType: 'json',
|
|
|
|
success: show_result
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2016-11-18 21:45:53 +00:00
|
|
|
$('#radiosearch').submit(function() {
|
|
|
|
var query = $('#radioquery').val();
|
2016-11-17 22:07:22 +00:00
|
|
|
search(query);
|
|
|
|
});
|
|
|
|
});
|