Skip to content
This repository has been archived by the owner on Jul 20, 2020. It is now read-only.

Commit

Permalink
If there is only one station matched from the query, auto-play it.
Browse files Browse the repository at this point in the history
  • Loading branch information
AzureKitsune committed Apr 8, 2013
1 parent c2e9d6a commit e00bc1b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions frontend/public/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,15 @@ $("input[type='search']").on('search', function () {
Hanasu.prototype.addStationToUI(this);
});
} else {
$(Hanasu.prototype.Stations).filter(function(index) {
var searched = $(Hanasu.prototype.Stations).filter(function(index) {
return this.Name.indexOf(query) !== -1; // http://stackoverflow.com/questions/1789945/method-like-string-contains-in-javascript
}).each(function() {
});
searched.each(function() {
Hanasu.prototype.addStationToUI(this);
});

if (searched.length == 1) {
Hanasu.prototype.playStation(searched[0]);
}
}
});

0 comments on commit e00bc1b

Please sign in to comment.