diff --git a/js/main.js b/js/main.js
index 2c9ab84..1397d12 100644
--- a/js/main.js
+++ b/js/main.js
@@ -6,7 +6,7 @@ $(window).on('load', function(){
$('#player').trigger('play');
});
- function show_result(data){
+ function render_result(data){
$("tbody > tr").remove();
$.each(data, function(i, station) {
$('tbody').append('
\
@@ -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({
method: "POST",
- url: 'https://www.radio-browser.info/webservice/json/stations/search',
+ url: url,
data: {
name: query
},
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() {
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);
});
diff --git a/templates/main.php b/templates/main.php
index 43e8421..66ec327 100755
--- a/templates/main.php
+++ b/templates/main.php
@@ -33,13 +33,6 @@
-
-
-
-
-
-
- Use this address to access your Files via WebDAV
@@ -56,23 +49,9 @@
-
-
-
-
- Favorite
-
-
-
- Radio 3
-
- |
-
-
-
-
+
+
+