We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e749b04 commit 8e1cac3Copy full SHA for 8e1cac3
3 files changed
src/app/app.js
@@ -198,7 +198,7 @@ angular.module('spotmop', [
198
* Search
199
**/
200
$scope.searchSubmit = function( query ){
201
-
+
202
// track this navigation event
203
Analytics.trackEvent('Search', 'Performed search', query);
204
src/app/common/directives.js
@@ -470,6 +470,29 @@ angular.module('spotmop.directives', [])
470
})
471
472
473
+// replace accented characters with their un-accented counterparts
474
+// Credit: https://gist.github.com/monkeymonk/ccf698e7b71ba22f098a
475
+.filter('stripAccents', function(){
476
+ return function (source) {
477
+ var accent = [
478
+ /[\300-\306]/g, /[\340-\346]/g, // A, a
479
+ /[\310-\313]/g, /[\350-\353]/g, // E, e
480
+ /[\314-\317]/g, /[\354-\357]/g, // I, i
481
+ /[\322-\330]/g, /[\362-\370]/g, // O, o
482
+ /[\331-\334]/g, /[\371-\374]/g, // U, u
483
+ /[\321]/g, /[\361]/g, // N, n
484
+ /[\307]/g, /[\347]/g, // C, c
485
+ ],
486
+ noaccent = ['A','a','E','e','I','i','O','o','U','u','N','n','C','c'];
487
488
+ for (var i = 0; i < accent.length; i++){
489
+ source = source.replace(accent[i], noaccent[i]);
490
+ }
491
492
+ return source;
493
+ };
494
+})
495
496
// get the appropriate sized image
497
.filter('thumbnailImage', function(){
498
return function( images ){
src/app/search/controller.js
@@ -21,14 +21,14 @@ angular.module('spotmop.search', [])
21
/**
22
* Main controller
23
24
-.controller('SearchController', function SearchController( $scope, $rootScope, $state, $stateParams, $timeout, SpotifyService ){
+.controller('SearchController', function SearchController( $scope, $rootScope, $state, $stateParams, $timeout, $filter, SpotifyService ){
25
26
$scope.tracklist = {tracks: [], type: 'track'};
27
$scope.albums = [];
28
$scope.artists = [];
29
$scope.playlists = [];
30
$scope.type = $stateParams.type;
31
- $scope.query = $stateParams.query;
+ $scope.query = $filter('stripAccents')( $stateParams.query );
32
$scope.loading = false;
33
var searchDelayer;
34
0 commit comments