--- /dev/null
+.dropdown-menu {
+ position:absolute;
+ top:100%;
+ left:0;
+ z-index:1000;
+ display:none;
+ float:left;
+ min-width:160px;
+ margin:2px 0 0;
+ text-align:left;
+ list-style:none;
+ background-color:#1C2C3C;
+ -webkit-background-clip:padding-box;
+ background-clip:padding-box;
+ border:3px solid #000;
+ border-radius:4px;
+ -webkit-box-shadow:0 6px 12px rgba(0,0,0,.175);
+ box-shadow:0 6px 12px rgba(0,0,0,.175)
+}
+
+.dropdown-menu>li>a{
+ display:block;
+ padding:3px 20px;
+ clear:both;
+ color:#fff;
+ cursor: pointer;
+ white-space:nowrap
+}
+
+.dropdown-menu>.active>a,.dropdown-menu>.active>a:focus,.dropdown-menu>.active>a:hover{
+ color:#fff;
+ text-decoration:none;
+ background: rgba(0,0,0,0.25);
+ color: #FFB122;
+ outline:0
+}
\ No newline at end of file
<div ng-if="packList && packList.length" id="filters">\r
<div id="text-filters">\r
- <input type="text" ng-model="$parent.packTitleFilterKeyword" placeholder="Pack Title"/>\r
- <input type="text" ng-model="$parent.artistFilterKeyword" placeholder="Song Artist"/>\r
- <input type="text" ng-model="$parent.songTitleFilterKeyword" placeholder="Song Title"/>\r
- <input type="text" ng-model="$parent.stepArtistFilterKeyword" placeholder="Step Artist"/>\r
+ <input type="text" ng-model="$parent.packTitleFilterKeyword" placeholder="Pack Title" typeahead="pack.title for pack in packList | filter:$viewValue | limitTo:8"/>\r
+ <input type="text" ng-model="$parent.artistFilterKeyword" placeholder="Song Artist" typeahead="artist for artist in allSongArtists | filter:$viewValue | limitTo:8" />\r
+ <input type="text" ng-model="$parent.songTitleFilterKeyword" placeholder="Song Title" typeahead="song for song in allSongTitles | filter:$viewValue | limitTo:8" />\r
+ <input type="text" ng-model="$parent.stepArtistFilterKeyword" placeholder="Step Artist" typeahead="contributor for contributor in allContributors | filter:$viewValue | limitTo:8" />\r
<input type="text" ng-model="$parent.ratingFilterKeyword" placeholder="Block Rating"/>\r
</div>\r
<div id="select-filters">\r
$scope.modeFilterKeyword = 'Any';
$scope.packList = [];
$scope.filteredPackList = [];
+ $scope.allContributors = [];
+ $scope.allSongTitles = [];
+ $scope.allSongArtists = [];
var watchMen = ['packTitleFilterKeyword', 'artistFilterKeyword', 'songTitleFilterKeyword', 'difficultyFilterKeyword', 'ratingFilterKeyword', 'stepArtistFilterKeyword', 'fgChangesFilterKeyword', 'bgChangesFilterKeyword', 'bpmChangesFilterKeyword', 'modeFilterKeyword'];
$scope.$watchGroup(watchMen, function(newValues, oldValues) {
- $scope.applyFilters();
+ applyFilters();
});
-
- //XXX: Why is this here?
-// $scope.getSimfileListingIndex = function(packName, index)
-// {
-// return packName + "" + index;
-// };
- $scope.packTitleFilter = function(pack)
+ var packTitleFilter = function(pack)
{
- var re = new RegExp($scope.packTitleFilterKeyword, 'i');
+ var re = new RegExp(escapeRegExp($scope.packTitleFilterKeyword), 'i');
return !$scope.packTitleFilterKeyword || re.test(pack.title);
};
- $scope.simfileFilter = function(pack)
+ var simfileFilter = function(pack)
{
// Step 0: All chart keywords are null
if(!$scope.songTitleFilterKeyword &&
for(var i=0; i<simfiles.length; i++)
{
var simfile = pack.simfiles[i];
- var songTitleRe = new RegExp($scope.songTitleFilterKeyword, 'i');
- var artistRe = new RegExp($scope.artistFilterKeyword, 'i');
-
+ var songTitleRe = new RegExp(escapeRegExp($scope.songTitleFilterKeyword), 'i');
+ var artistRe = new RegExp(escapeRegExp($scope.artistFilterKeyword), 'i');
match = (!$scope.songTitleFilterKeyword || songTitleRe.test(simfile.title)) &&
(!$scope.artistFilterKeyword || artistRe.test(simfile.artist)) &&
return true;
}
- var stepArtistRe = new RegExp($scope.stepArtistFilterKeyword, 'i');
+ var stepArtistRe = new RegExp(escapeRegExp($scope.stepArtistFilterKeyword), 'i');
var steps = [simfile.steps.single, simfile.steps.double];
var modeKeywordMap = ['single', 'double'];
var match = false;
return false;
};
- $scope.applyFilters = function()
+ var applyFilters = function()
{
- $scope.filteredPackList = filterFilter(filterFilter($scope.packList, $scope.packTitleFilter), $scope.simfileFilter);
+ $scope.filteredPackList = filterFilter(filterFilter($scope.packList, packTitleFilter), simfileFilter);
};
SimfileService.getPacks().then(function(packs)
$scope.currentPage = 1;
$scope.packList = packs;
$scope.filteredPackList = packs;
+
+ for(var i =0; i<packs.length; i++)
+ {
+ var pack = packs[i];
+ for(var j=0; j<pack.contributors.length; j++)
+ {
+ if($scope.allContributors.indexOf(pack.contributors[j]) === -1)
+ $scope.allContributors.push(pack.contributors[j]);
+ }
+
+ for(var j=0; j<pack.simfiles.length; j++)
+ {
+ if($scope.allSongTitles.indexOf(pack.simfiles[j].title) === -1)
+ $scope.allSongTitles.push(pack.simfiles[j].title);
+
+ if($scope.allSongArtists.indexOf(pack.simfiles[j].artist) === -1)
+ $scope.allSongArtists.push(pack.simfiles[j].artist);
+ }
+ }
}
});
+
+ var escapeRegExp = function(str)
+ {
+ str = str ? str : "";
+ return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
+ };
}]);
\ No newline at end of file