fixed global search timeout, pumped nextcloud max-version, further work on db backend

This commit is contained in:
Jonas Heinrich 2017-08-04 20:29:08 +02:00
parent 664cb06e61
commit 1ad95f672f
3 changed files with 63 additions and 32 deletions

View File

@ -1,4 +1,3 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<database> <database>
<name>*dbname*</name> <name>*dbname*</name>
<create>true</create> <create>true</create>
@ -11,7 +10,17 @@
<name>id</name> <name>id</name>
<type>integer</type> <type>integer</type>
<notnull>true</notnull> <notnull>true</notnull>
<length>6</length> <autoincrement>true</autoincrement>
<unsigned>true</unsigned>
<primary>true</primary>
<length>8</length>
</field>
<field>
<name>stationid</name>
<type>text</type>
<length>200</length>
<default></default>
<notnull>true</notnull>
</field> </field>
<field> <field>
<name>user_id</name> <name>user_id</name>

View File

@ -3,11 +3,11 @@
<id>radio</id> <id>radio</id>
<name>Radio</name> <name>Radio</name>
<description>Listening to your favorite radio stations in Nextcloud</description> <description>Listening to your favorite radio stations in Nextcloud</description>
<version>0.3</version> <version>0.4</version>
<licence>MIT</licence> <licence>MIT</licence>
<author>Jonas Heinrich</author> <author>Jonas Heinrich</author>
<dependencies> <dependencies>
<owncloud min-version="9.1" max-version="9.2"/> <owncloud min-version="9.1" max-version="9.2"/>
<nextcloud min-version="10" max-version="11"/> <nextcloud min-version="10" max-version="12"/>
</dependencies> </dependencies>
</info> </info>

View File

@ -1,8 +1,18 @@
$(function(){ $(function(){
$('body').on('click', 'tr', function() { searchTimeout = null;
/*$('body').on('click', 'tr', function() {
var stationid = $(this).attr('data-id'); var stationid = $(this).attr('data-id');
play_station(stationid); play_station(stationid);
}); */
$('body').on('click', 'tr .icon', function() {
alert('test');
});
$('.icon-star').click(function (){
alert('test');
}); });
function play_station(stationid){ function play_station(stationid){
@ -39,11 +49,19 @@ $(function(){
} }
function get_station_ids(){ function get_station_ids(){
var stations = []
var baseUrl = OC.generateUrl('/apps/radio'); var baseUrl = OC.generateUrl('/apps/radio');
var station = {
"id": 16,
"stationid": "89920",
"active": true
};
$.get(baseUrl + '/stations', function ( data ) { $.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){ function render_stations(station_ids){
@ -95,8 +113,7 @@ $(function(){
break; break;
case 2: case 2:
$('li.nav-favorite').addClass('active'); $('li.nav-favorite').addClass('active');
station_ids = get_station_ids() get_station_ids();
render_stations(station_ids)
break; break;
} }
} }
@ -114,8 +131,13 @@ $(function(){
}); });
function mySearch(query){ function mySearch(query){
if (query != "") {
clearTimeout(searchTimeout);
searchTimeout = setTimeout(function(){
$("tbody > tr").remove(); $("tbody > tr").remove();
radio_query(0, query); radio_query(0, query);
}, 500);
};
}; };
OC.Plugins.register('OCA.Search', { OC.Plugins.register('OCA.Search', {