From 1ad95f672fb6f1636439b2594f73d9e34cd499c7 Mon Sep 17 00:00:00 2001 From: Jonas Heinrich Date: Fri, 4 Aug 2017 20:29:08 +0200 Subject: [PATCH] fixed global search timeout, pumped nextcloud max-version, further work on db backend --- appinfo/database.xml | 55 ++++++++++++++++++++++++++------------------ appinfo/info.xml | 4 ++-- js/main.js | 36 +++++++++++++++++++++++------ 3 files changed, 63 insertions(+), 32 deletions(-) diff --git a/appinfo/database.xml b/appinfo/database.xml index 78ff613..11332f4 100755 --- a/appinfo/database.xml +++ b/appinfo/database.xml @@ -1,25 +1,34 @@ - - *dbname* - true - false - utf8 - - *dbprefix*radio_stations - - - id - integer - true - 6 - - - user_id - text - 200 - - true - - -
+ *dbname* + true + false + utf8 + + *dbprefix*radio_stations + + + id + integer + true + true + true + true + 8 + + + stationid + text + 200 + + true + + + user_id + text + 200 + + true + + +
diff --git a/appinfo/info.xml b/appinfo/info.xml index bee0a19..9814a6d 100755 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -3,11 +3,11 @@ radio Radio Listening to your favorite radio stations in Nextcloud - 0.3 + 0.4 MIT Jonas Heinrich - + diff --git a/js/main.js b/js/main.js index f943feb..ea8951a 100644 --- a/js/main.js +++ b/js/main.js @@ -1,8 +1,18 @@ $(function(){ - $('body').on('click', 'tr', function() { + searchTimeout = null; + + /*$('body').on('click', 'tr', function() { var stationid = $(this).attr('data-id'); play_station(stationid); + }); */ + + $('body').on('click', 'tr .icon', function() { + alert('test'); + }); + + $('.icon-star').click(function (){ + alert('test'); }); function play_station(stationid){ @@ -39,11 +49,19 @@ $(function(){ } function get_station_ids(){ + var stations = [] var baseUrl = OC.generateUrl('/apps/radio'); + var station = { + "id": 16, + "stationid": "89920", + "active": true + }; $.get(baseUrl + '/stations', function ( data ) { - alert(JSON.stringify(data)); + for (var station in data) { + stations.push(data[station]["stationid"]); + }; + render_stations(stations); }); - return ["89920","44707","91101","85755","45281","78011","91102"] }; function render_stations(station_ids){ @@ -95,8 +113,7 @@ $(function(){ break; case 2: $('li.nav-favorite').addClass('active'); - station_ids = get_station_ids() - render_stations(station_ids) + get_station_ids(); break; } } @@ -114,8 +131,13 @@ $(function(){ }); function mySearch(query){ - $("tbody > tr").remove(); - radio_query(0, query); + if (query != "") { + clearTimeout(searchTimeout); + searchTimeout = setTimeout(function(){ + $("tbody > tr").remove(); + radio_query(0, query); + }, 500); + }; }; OC.Plugins.register('OCA.Search', {