1var rlbBoApp = angular.module('rlbApp', ['geolocation','rt.debounce']); 2 3function removeAccents(value) { 4 return value.toLowerCase() 5 .replace(/á/g, 'a') 6 .replace(/â/g, 'a') 7 .replace(/é/g, 'e') 8 .replace(/è/g, 'e') 9 .replace(/ê/g, 'e') 10 .replace(/Ã/g, 'i') 11 .replace(/ï/g, 'i') 12 .replace(/ì/g, 'i') 13 .replace(/ó/g, 'o') 14 .replace(/ô/g, 'o') 15 .replace(/ú/g, 'u') 16 .replace(/ü/g, 'u') 17 .replace(/ç/g, 'c') 18 .replace(/Ã/g, 's') 19 .replace(/-/g, ' '); 20} 21 22rlbBoApp.controller('SearchNewsController', function($scope,$http,$sce,geolocation,debounce) { 23 24 $scope.ignoreAccents = function(item) { 25 if (!$scope.searchInput) return true; 26 var text = removeAccents(item.label); 27 var search = removeAccents($scope.searchInput); 28 return text.indexOf(search) > -1; 29 }; 30 31 $scope.arroundMe = function() { 32 if (navigator.geolocation) { 33 geolocation.getLocation().then( 34 function(data){ 35 $scope.latitude = data.coords.latitude; 36 $scope.longitude = data.coords.longitude; 37 $scope.locationInput=i18n['fo.search.around.me']; 38 $scope.location = i18n['fo.search.around.me']; 39 $scope.showCityList = false; 40 41 /*$http({ 42 method: 'POST', 43 url: 'https://maps.googleapis.com/maps/api/geocode/json?sensor=true&key='+KEYGMAP, 44 params: { 45 latlng:data.coords.latitude+','+data.coords.longitude 46 } 47 }) 48 .then(function (response) { 49 console.log(response.data); 50 });*/ 51 52 },function (error) { 53 console.log(error); 54 }); 55 }else{ 56 console.log('geolocation disabled !'); 57 } 58 }; 59 60 $scope.fillCity = function(val){ 61 $scope.locationInput=val; 62 } 63 64 $scope.leaveCity = function(val){ 65 console.log('leaveCity'); 66 if($scope.locationInput!="" && $scope.showCityList && $scope.cities && $scope.cities.predictions) $scope.fillLatLong($scope.cities.predictions[0]); 67 else if ($scope.showCityList) $scope.showCityList = false; 68 } 69 70 $scope.fillLatLong = function(city){ 71 console.log('fillLatLong '+city.place_id); 72 $scope.showCityList = false; 73 $http.get("/fo/location?placeId="+city.place_id+"&service="+$scope.cities.service).then(function(response){ 74 $scope.latitude = response.data.result.geometry.location.lat; 75 $scope.longitude = response.data.result.geometry.location.lng; 76 $scope.locationInput = response.data.result.name; 77 $scope.location = response.data.result.name; 78 }); 79 /*$http.get("/fo/location?placeId="+city.locationId).then(function(response){ 80 var infos = response.data.response.view[0].result[0].location; 81 if(infos){ 82 $scope.latitude = infos.displayPosition.latitude; 83 $scope.longitude = infos.displayPosition.longitude; 84 $scope.locationInput = infos.address.city; 85 $scope.location = infos.address.city; 86 } 87 });*/ 88 } 89 90 $scope.searchInputLocation = debounce(500,function(){ 91 console.log('searchInputLocation'); 92 $scope.location = ''; 93 $scope.latitude = null; 94 $scope.longitude = null; 95 if($scope.locationInput && $scope.locationInput!='' && $scope.locationInput.length>=3){ 96 $http.get("/fo/locationsearch?search="+$scope.locationInput).then(function(response){ 97 $scope.cities = response.data; 98 }); 99 } 100 }) 101 102 /* 103 $scope.searchInputLocation = debounce(500,function(){ 104 if($scope.locationInput && $scope.locationInput!='' && $scope.locationInput.length>=3){ 105 $http.get("/fo/locationsearch?search="+$scope.locationInput).then(function(response){ 106 $scope.cities = response.data; 107 }); 108 }else{ 109 $scope.location=''; 110 $scope.latitude = null; 111 $scope.longitude = null; 112 } 113 });*/ 114 115 116 $( "#searchDropdown").show(); 117 118});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.