PageSourceSearch

https://psaroublackvilla.com/bundles/frontend/theme_manager_3/app/properties/discover.js?v=1790236178

js psaroublackvilla.com collected 2026-09-28 12:58:25 UTC 21,364 bytes, 530 lines download raw bytes

1var myApp = angular.module('frontendApp', []);
2
3myApp.config(function($interpolateProvider){
4    $interpolateProvider.startSymbol('[[').endSymbol(']]');
5});
6myApp.filter('htmlToPlaintext', function() {
7        return function(text) {
8            return angular.element(text).text();
9        }
10    }
11);
12
13myApp.filter("translate", function() { // register new filter
14    var result = '';
15    return function(input, locale, field) { // filter arguments
16        result = '';
17        angular.forEach(input, function(value, key) {
18            if (value.lang.langCode.toLowerCase() == locale.toLowerCase()) {
19                result = value[field];
20            }else if (result=='') {
21                result = value[field];
22            }
23        });
24        return result;
25    };
26});
27
28myApp.directive('stringToNumber', function() {
29    return {
30        require: 'ngModel',
31        link: function(scope, element, attrs, ngModel) {
32            ngModel.$parsers.push(function(value) {
33                return '' + value;
34            });
35            ngModel.$formatters.push(function(value) {
36                return parseFloat(value);
37            });
38        }
39    };
40});
41
42myApp.directive("keepScroll", function(){
43
44    return {
45        controller : function($scope){
46            var element = null;
47
48            this.setElement = function(el){
49                element = el;
50            }
51            this.addItem = function(item){
52                element.scrollTop = (element.scrollTop+item.clientHeight+1);
53            };
54        },
55
56        link : function(scope,el,attr, ctrl) {
57            ctrl.setElement(el[0]);
58        }
59
60    };
61
62})
63
64myApp.directive("scrollItem", function(){
65
66    return{
67        require : "^keepScroll",
68        link : function(scope, el, att, scrCtrl){
69            scrCtrl.addItem(el[0]);
70        }
71    }
72})
73
74myApp.filter('range', function() {
75    return function(input, total) {
76        total = parseInt(total);
77
78        for (var i=0; i<total; i++) {
79            input.push(i);
80        }
81        return input;
82    };
83});
84
85myApp.service('endpoints', function($http){
86    return {
87        getPropertyPois: function(data,id){
88            var promise = $http.post('/api/admin/frontend/pages/manager/properties/search/pois/'+id,data).then(function (response) {
89                return response.data;
90            });
91            return promise;
92        },
93        getPropertyMarker: function(data,id){
94            var promise = $http.post('/api/admin/frontend/pages/manager/property/search/marker/'+id,data).then(function (response) {
95                return response.data;
96            });
97            return promise;
98        },
99        getPoiModal: function(locale,poi_location_id,pages_location_map_id){
100            var promise = $http.get('/'+locale+'/page/modal/poi/location/' + poi_location_id + '/' + pages_location_map_id).then(function (response) {
101                return response.data;
102            });
103            return promise;
104        }
105    };
106});
107
108myApp.filter('chunk', function() {
109    var cache = {}; // holds old arrays for difference repeat scopes
110    var filter = function(newArr, size, scope) {
111        var i,
112            oldLength = 0,
113            newLength = 0,
114            arr = [],
115            id = scope.$id,
116            currentArr = cache[id];
117        if (!newArr) return;
118
119        if (currentArr) {
120            for (i = 0; i < currentArr.length; i++) {
121                oldLength += currentArr[i].length;
122            }
123        }
124        if (newArr.length == oldLength) {
125            return currentArr; // so we keep the old object and prevent rebuild (it blurs inputs)
126        } else {
127            for (i = 0; i < newArr.length; i += size) {
128                arr.push(newArr.slice(i, i + size));
129            }
130            cache[id] = arr;
131            return arr;
132        }
133    };
134    return filter;
135
136});
137
138
139myApp.controller(
140    'applicationCtrl',
141    function($scope,endpoints,$timeout,$window, $document ,$compile){
142
143
144        $scope.page_id=null;
145        $scope.fireSelect2 = function(element){
146            $timeout(function () {
147                $(element).select2();
148            })  ;
149        };
150
151        $scope.range = function(min, max, step,limit) {
152            min = parseInt(min);
153            max = parseInt(max);
154            step = parseInt(step) || 1;
155            limit = parseInt(limit) || 1000;
156            var input = [];
157            for (var i = min; i <= max; i += step) {
158                if(i > limit){ continue; }
159                input.push(i);
160            }
161            return input;
162        };
163
164        $scope.fireNotification = function(message,type,ttl){
165            var notification = new NotificationFx({
166                message : message,
167                layout : 'bar',
168                effect : 'slidetop',
169                type : type,
170                ttl: ttl
171            });
172            notification.show();
173        };
174        $scope.general_limit = 24;
175        $scope.filters = {
176            // property_id: null,
177            filter:  'nearest',
178            limit: $scope.general_limit,
179            loading: 0,
180            locale: null
181        };
182
183        $scope.regular_limit=$scope.general_limit;
184        $scope.first_limit=$scope.general_limit;
185        $scope.these_properties = 0;
186        $scope.total_properties = 0;
187        $scope.properties = [];
188        $scope.firstProperty = null;
189        $scope.hasHitButton = 0;
190        $scope.markers_offset = 0;
191        $scope.final_markers = [];
192        $scope.property_lat = null;
193        $scope.property_lng = null;
194
195        $scope.icon =  {
196            path: MAP_PIN,
197            fillColor: '#6331AE',
198            fillOpacity: 1,
199            strokeColor: '',
200            strokeWeight: 0
201        };
202
203        $scope.map_icon_label = '<span class="map-icon map-icon-city-hall"></span>';
204
205
206        $scope.searchOffers = null;
207        $scope.fetchPropertyPois = function(id){
208            
209            let mapHeight = $( window ).height() - 60;
210            
211            if($scope.filters.loading == 1){ return; }
212            $scope.filters.loading = 1;
213            $scope.data = {};
214            $scope.property_data = null;
215
216            $scope.total_properties = 0;
217            $scope.properties = [];
218            $scope.filters.offset = 0;
219            $scope.these_properties = 0;
220            $scope.markers_offset = 0;
221            $scope.centerPosition = null;
222            $scope.property_pois = false;
223
224            $scope.init();
225            var params = angular.copy($scope.filters);
226            endpoints.getPropertyMarker(params, id).then(function (data) {
227                console.log(data);
228                $scope.property_data = data.property_marker[0];
229                if (data.property_marker.length > 0) {
230                    for (let i = 0; i < data.property_marker.length; i++) {
231                        let pm = data.property_marker[i];
232                        $scope.properties.push(pm);
233                        $scope.property_lat = pm.property_lat;
234                        $scope.property_lng = pm.property_lng;
235                        $scope.addPropertyMarker(pm.property_location_id, pm.property_lat, pm.property_lng, pm.property_title, pm.property_address, pm.property_city, pm.property_zip, pm.property_image, pm.property_country);
236                    }
237                    $scope.displayPropertyMarker();
238                    $scope.property_pois = true;
239                }
240            }).then(function (){
241                endpoints.getPropertyPois(params, id).then(function (data) {
242                    console.log(data);
243                    if (data.pois.length > 0) {
244                        for (let i = 0; i < data.pois.length; i++) {
245                            let poi = data.pois[i];
246                            $scope.properties.push(poi);
247                            $scope.addMarker(poi.id, $scope.property_data.property_location_id, poi.latitude, poi.longitude, poi.title, poi.description, poi.poiGallery);
248                        }
249                        $scope.displayMarkers();
250                        // $scope.cluster = new markerClusterer.MarkerClusterer({map:$scope.map, markers:$scope.final_markers});
251                        new MarkerClusterer($scope.map, $scope.final_markers, {
252                            imagePath: 'https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m'
253                        });
254                    }
255                }).then(f => {
256                    $('#discover-map').css('height', mapHeight);
257                });
258            });
259            
260
261            $scope.filters.loading = 0;
262        };
263
264        $scope.updateMap = function(id){
265            if($scope.filters.loading == 1){ return; }
266            $scope.filters.loading = 1;
267            $scope.data = {};
268            $scope.property_data = null;
269            $scope.final_markers = null;
270            $scope.final_markers = [];
271            $scope.total_properties = 0;
272            $scope.properties = [];
273            $scope.filters.offset = 0;
274            $scope.these_properties = 0;
275            $scope.markers_offset = 0;
276            $scope.centerPosition = null;
277            $scope.property_pois = false;
278            $scope.markers = null;
279            $scope.markers = [];
280            $scope.infoWindowContent = null;
281            $scope.infoWindowContent = [];
282            $scope.property_markers = null;
283            $scope.property_markers = [];
284            $scope.infoWindowPropertyContent = null;
285            $scope.infoWindowPropertyContent = [];
286            $scope.init();
287            var params = angular.copy($scope.filters);
288            var property_mark = [];
289            endpoints.getPropertyMarker(params, id).then(function (data) {
290                console.log(data);
291                $scope.property_data = data.property_marker[0];
292                if (data.property_marker.length > 0) {
293                    for (var i = 0; i < data.property_marker.length; i++) {
294                        var pm = data.property_marker[i];
295                        $scope.properties.push(pm);
296                        $scope.property_lat = pm.property_lat;
297                        $scope.property_lng = pm.property_lng;
298                        $scope.addPropertyMarker(pm.property_location_id, pm.property_lat, pm.property_lng, pm.property_title, pm.property_address, pm.property_city, pm.property_zip, pm.property_image, pm.property_country);
299                        property_mark.push(data.property_marker[i]);
300                    }
301                    $scope.displayPropertyMarker();
302                    $scope.property_pois = true;
303                }
304            }).then(f => {
305                endpoints.getPropertyPois(params, id).then(function (data) {
306                    console.log(data);
307                    var ar = [];
308                    if (data.pois.length > 0) {
309                        for (var i = 0; i < data.pois.length; i++) {
310                            var poi = data.pois[i];
311                            $scope.properties.push(poi);
312                            $scope.addMarker(poi.id, $scope.property_data.property_location_id, poi.latitude, poi.longitude, poi.title, poi.description, poi.poiGallery);
313                            ar.push(data.pois[i]);
314                        }
315                        $scope.displayMarkers();
316                    }
317                    // var markerCluster = new markerClusterer.MarkerClusterer({map:$scope.map, markers:$scope.final_markers});
318                    var markerCluster = new MarkerClusterer($scope.map, $scope.final_markers, {
319                        imagePath: 'https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m'
320                    });
321                });
322            });
323            $('.modal').modal('hide');
324            $scope.filters.loading = 0;
325        };
326
327        $scope.init = function() {
328            $scope.bounds = new google.maps.LatLngBounds();
329            var mapOptions = {
330                disableDefaultUI: false,
331                markers: [],
332                fullscreenControl:false,
333                streetViewControlOptions: true,
334                streetViewControlOptions: {
335                    position: google.maps.ControlPosition.RIGHT_TOP
336                },
337                zoomControlOptions:true,
338                zoomControlOptions: {
339                    position: google.maps.ControlPosition.RIGHT_TOP
340                },
341                styles: [
342                    {
343                        featureType: 'poi',
344                        stylers: [{visibility: 'off'}]
345                    },
346                    {
347                        featureType: 'transit',
348                        elementType: 'labels.icon',
349                        stylers: [{visibility: 'off'}]
350                    }
351                ],
352                zoom: 12
353
354            };
355            var mapElement = document.getElementById('discover-map');
356            $scope.map = new google.maps.Map(mapElement, mapOptions);
357            // setTimeout(function () {
358            //     markerCluster.addMarkers($scope.markers);
359            //     console.log(markerCluster);
360            // },3000);
361
362        };
363
364        $scope.displayPropertyMarker = function () {
365            var infoWindowPropertyContent = new google.maps.InfoWindow(), marker, i;
366            for( i = $scope.markers_offset; i < $scope.property_markers.length; i++ ) {
367
368
369                var position = new google.maps.LatLng($scope.property_markers[i][1], $scope.property_markers[i][2]);
370                if(i==0){
371                    $scope.centerPosition = position;
372                }
373                marker = new google.maps.Marker({
374                    position: position,
375                    map: $scope.map,
376                    title: $scope.property_markers[i][5],
377                    id:$scope.property_markers[i][2],
378                    icon: 'https://loggia-cdn.s3.eu-central-1.amazonaws.com/solid_home_purple-1.png'
379                });
380
381                // $scope.final_markers.push(marker);
382
383                google.maps.event.addListener(marker, 'click', (function(marker, i) {
384                    return function() {
385                        infoWindowPropertyContent.setContent($scope.infoWindowPropertyContent[i]);
386                        infoWindowPropertyContent.open($scope.map, marker);
387                    }
388                })(marker, i));
389            }
390
391            $scope.markers_offset = $scope.markers_offset + $scope.filters.limit;
392            $scope.map.setCenter( $scope.centerPosition );
393            $scope.markers_offset = 0;
394        };
395
396        $scope.displayMarkers = function () {
397            var infoWindow = new google.maps.InfoWindow(), marker, i;
398            for( i = $scope.markers_offset; i < $scope.markers.length; i++ ) {
399
400                var position = new google.maps.LatLng($scope.markers[i][1], $scope.markers[i][2]);
401                if(i==0){
402                    $scope.centerPosition = position;
403                }
404                marker = new google.maps.Marker({
405                    position: position,
406                    map: $scope.map,
407                    title: $scope.markers[i][3],
408                    id:$scope.markers[i][0],
409                    map_icon_label: '<span class="map-icon map-icon-point-of-interest"></span>'
410                });
411
412                $scope.final_markers.push(marker);
413
414                google.maps.event.addListener(marker, 'click', (function(marker, i) {
415                    return function() {
416                        infoWindow.setContent($scope.infoWindowContent[i]);
417                        infoWindow.open($scope.map, marker);
418                    }
419                })(marker, i));
420            }
421
422            $scope.markers_offset = $scope.markers_offset + $scope.filters.limit;
423            // $scope.map.setCenter( $scope.centerPosition );
424            $scope.markers_offset = 0;
425        };
426
427        $scope.icon = null;
428        $scope.markers = [];
429        $scope.infoWindowContent = [];
430        // $scope.locale = null;
431        $scope.addMarker = function (location_id,property_location_id,lat,lng,title,de
431scription,poiGallery) {
432
433            if (lat == null || lng == null) {
434                return;
435            }
436            let marker = [location_id, lat, lng, title, description];
437
438            let content = '<div id="' + location_id + '"> ';
439            content = content + '<div class="panel panel-transparent m-b-0"> ';
440            content = content + '<div class="panel-heading" style="padding: 20px 0 7px 0;"> ';
441            content = content + '<h5 class="panel-title m-b-5 m-t-0">' + title + '</h5>';
442            content = content + '</div> ';
443            content = content + '<div class="panel-body padding-0" style="padding: 0;"> ';
444            if (description != undefined && description != null) {
445                content = content + '<span class="text-master block full-width">' + description + '</span> ';
446            }
447            if (poiGallery > 0) {
448                content = content + '<p class="p-t-10"><a href="javascript:void(0)" ng-click="getPoiMap(&apos;' + $scope.filters.locale + '&apos;,' + location_id + ',' + property_location_id + ');">Show more...</a></p>';
449            }
450            else {
451                content = content + '<p class="p-t-10"><a href="https://www.google.com/maps/dir/' + lat + ',' + lng + '/' + $scope.property_lat + ',' + $scope.property_lng + '/" target="_blank"><i class="fal fa-map"></i> Directions</a></p>';
452            }
453            content = content + '</div> ';
454            content = content + '</div>';
455            content = content + '</div>';
456
457            $scope.markers.push(marker);
458            let compiled = $compile(content)($scope);
459            $scope.infoWindowContent.push(compiled[0]);
460        };
461
462        $scope.property_markers = [];
463        $scope.infoWindowPropertyContent = [];
464        $scope.addPropertyMarker = function (property_location_id,lat,lng,title,address,city,zip,image,country) {
465
466            if(lat != null && lng!= null) {
467                var marker = [property_location_id,lat,lng,title,address,city,zip,image,country];
468
469                var content = '<div class="padding-0" id="' + property_location_id + '"> ';
470                    content = content + '<div> ';
471
472                    content = content + '</div> ';
473
474                    content = content + '<div class="panel panel-transparent m-b-0"> ';
475                        content = content + '<div class="panel-heading padding-0"> ';
476                            content = content + '<div>';
477                                content = content + '<img class="image" ng-src="' + image 
477+ '" alt="' + title + '"> ';
478                            content = content + '</div> ';
479                            content = content + '<h5 class="panel-title m-t-5" style="margin-top: 5px;">' + title + '</h5>';
480                        content = content + '</div> ';
481                        content = content + '<div class="panel-body padding-0" style="padding-bottom: 20px;"> ';
482                            content = content + '<address class="m-b-20" style="margin-bottom: 20px;">';
483                                content = content + '<a target="_blank" class="view-map" href="https://www.google.com/maps/search/?api=1&query='+lat+','+lng+'">';
484                                content = content + ''+address+' '+city+', '+zip+'<br>';
485                                    content = content + country;
486                                content = content + '</a>';
487                            content = content + '</address>';
488                        content = content + '</div> ';
489                    content = content + '</div> ';
490                content = content + '</div>';
491
492                $scope.property_markers.push(marker);
493                var compiled = $compile(content)($scope);
494                $scope.infoWindowPropertyContent.push(compiled[0]);
495
496            }
497        };
498
499        $scope.loadingPoiLocationContent = 0;
500        $scope.fetchingPoiLocationContent = 0;
501        $scope.getPoiMap = function(locale,poi_location_id,pages_location_map_id) {
502            if($scope.fetchingPoiLocationContent==1){
503                return false;
504            }
505            $('#poiLocation_modal').modal('show');
506            $scope.loadingPoiLocationContent = 1;
507            $('#poiLocation_modal_preloader').show();
508            $('#poiLocation_modal .modal-dialog.modal-md').remove();
509            endpoints.getPoiModal(locale,poi_location_id,pages_location_map_id).then(function (data) {
510                $scope.loadingPoiLocationContent = 0;
511                $('#poiLocation_modal_preloader').hide();
512                $('#poiLocation_modal').append(data);
513                setTimeout(function(){window.dispatchEvent(new Event('resize'));},1000);
514                $timeout(function () {
515                    new Swiper('.swiper-container-pagepoi', {
516                        navigation: {
517                            nextEl: ".swiper-button-next-pagepoi",
518                            prevEl: ".swiper-button-prev-pagepoi",
519                        },
520                        loop: false,
521                        parallax: true,
522                        speed: 1000,
523                        lazy: true
524                    });
525                }, 300);
526                $scope.fetchingPoiLocationContent = 0;
527            });
528        };
529    }
530);

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.