PageSourceSearch

https://dzogchen.net/js/app/ManageCommunityInfoCtrl.js

js dzogchen.net collected 2026-10-02 09:59:18 UTC 2,234 bytes, 59 lines download raw bytes

1app.controller('ManageCommunityInfoCtrl', function ($scope, $rootScope, $http, $timeout, $resource, $location) {
2
3    var initMap = function (lat, lng, hasLocation) {
4        $scope.map = {
5            center: { latitude: lat, longitude: lng },
6            zoom: 8,
7            events: {
8                click: function (mapModel, eventName, originalEventArgs) {
9                    var e = originalEventArgs[0];
10                    var markerLat = e.latLng.lat(), markerLng = e.latLng.lng();
11                    $scope.c.Lat = markerLat;
12                    $scope.c.Lng = markerLng;
13                    $scope.marker = {
14
15                        coords: { latitude: markerLat, longitude: markerLng },
16                        id: 1,
17                        options: {
18                            labelContent: 'You need to save now',
19                            labelClass: "marker-labels",
20                        }
21                    };
22                    $scope.$apply();
23                }
24            }
25        };
26        if (hasLocation) {
27            $scope.marker = {
28                coords: { latitude: lat, longitude: lng }
29            };
30        }
31    };
32
33
34    $scope.communitySv = $resource("/api/ManageCommunityInfo/");
35    $http.get("/api/ManageCommunityInfo/").success(function (resp) {
36        if (resp.IsSuccess) {
37            $scope.c = resp.Data;
38            if ($scope.c.Lat && $scope.c.Lng) {
39                initMap($scope.c.Lat, $scope.c.Lng, true);
40                //$scope.$apply();
41            }
42            else {
43                $http.get("https://maps.google.com/maps/api/geocode/json?address=" + $scope.c.CountryCode + "&key=AIzaSyC9nuqTe6S2jZlosNxh9oNGVJc2g2O9-nE").success(function (resp) {
44                    var countryLocation = resp.results[0].geometry.location;
45                    initMap(countryLocation.lat, countryLocation.lng);
46                });
47            }
48        } else {
49            $rootScope.successAlert(resp.Reason);
50            $location.path("/profile/info");
51        }
52
53    });
54
55
56    $scope.save = function () {
57        $scope.communitySv.save($scope.c).$promise.then($rootScope.successAlert('Saved'));
58    };
59});

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.