added function to menu entries
This commit is contained in:
parent
7bb389d210
commit
0907a573b0
48
js/main.js
48
js/main.js
@ -6,7 +6,7 @@ $(window).on('load', function(){
|
|||||||
$('#player').trigger('play');
|
$('#player').trigger('play');
|
||||||
});
|
});
|
||||||
|
|
||||||
function show_result(data){
|
function render_result(data){
|
||||||
$("tbody > tr").remove();
|
$("tbody > tr").remove();
|
||||||
$.each(data, function(i, station) {
|
$.each(data, function(i, station) {
|
||||||
$('tbody').append('<tr data-src='+station['url']+' data-id='+station['id']+'>\
|
$('tbody').append('<tr data-src='+station['url']+' data-id='+station['id']+'>\
|
||||||
@ -26,20 +26,58 @@ $(window).on('load', function(){
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function search(query){
|
function radio_query(type, query){
|
||||||
|
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";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
var url = "https://www.radio-browser.info/webservice/json/stations/lastchange/20";
|
||||||
|
break;
|
||||||
|
};
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
url: 'https://www.radio-browser.info/webservice/json/stations/search',
|
url: url,
|
||||||
data: {
|
data: {
|
||||||
name: query
|
name: query
|
||||||
},
|
},
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
success: show_result
|
success: render_result
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function switch_menu(type) {
|
||||||
|
$('#app-navigation').find('li').removeClass("active");;
|
||||||
|
switch (type) {
|
||||||
|
case 0:
|
||||||
|
$('li.nav-files').addClass('active');
|
||||||
|
radio_query(1);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
$('li.nav-recent').addClass('active');
|
||||||
|
radio_query(2);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
$('li.nav-favorite').addClass('active');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$('#radiosearch').submit(function() {
|
$('#radiosearch').submit(function() {
|
||||||
var query = $('#radioquery').val();
|
var query = $('#radioquery').val();
|
||||||
search(query);
|
radio_query(0, query);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('a.nav-icon-files').click(function() {
|
||||||
|
switch_menu(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('a.nav-icon-recent').click(function() {
|
||||||
|
switch_menu(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
switch_menu(0);
|
||||||
});
|
});
|
||||||
|
@ -33,13 +33,6 @@
|
|||||||
<form id="radiosearch" action="javascript:void(0);">
|
<form id="radiosearch" action="javascript:void(0);">
|
||||||
<input id="radioquery" placeholder="Search for name" autofocus required></input>
|
<input id="radioquery" placeholder="Search for name" autofocus required></input>
|
||||||
</form>
|
</form>
|
||||||
<div id="files-setting-showhidden">
|
|
||||||
<input class="checkbox" id="showhiddenfilesToggle" checked="checked" type="checkbox">
|
|
||||||
<label for="showhiddenfilesToggle">Show hidden files</label>
|
|
||||||
</div>
|
|
||||||
<label for="webdavurl">WebDAV</label>
|
|
||||||
<input id="webdavurl" type="text" readonly="readonly" value="http://127.0.0.1/remote.php/webdav/" />
|
|
||||||
<em>Use this address to <a href="https://docs.nextcloud.com/server/11/go.php?to=user-webdav" target="_blank" rel="noreferrer">access your Files via WebDAV</a></em>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -56,23 +49,9 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="fileList">
|
<tbody id="fileList">
|
||||||
<tr>
|
</tbody>
|
||||||
<td class="filename">
|
<tfoot>
|
||||||
<a href="#" class="action action-favorite " data-original-title="" title="">
|
</tfoot>
|
||||||
<span class="icon icon-star"></span>
|
|
||||||
<span class="hidden-visually">Favorite</span>
|
|
||||||
</a>
|
|
||||||
<label for="select-files-3">
|
|
||||||
<div class="thumbnail" style="background-image:url('http://www.swr.de/static/favicons/SWR1/favicons/SWR1_96.png'); background-size: 32px;"></div>
|
|
||||||
</label>
|
|
||||||
<a class="name" href="#">
|
|
||||||
<span class="nametext"><span class="innernametext">Radio 3</span></span>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
<tfoot>
|
|
||||||
</tfoot>
|
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user