PageSourceSearch

https://www.lebanonboro.com/_Assets/js/angular/app/components/article/article.controller.js

js lebanonboro.com collected 2026-10-02 19:19:28 UTC 3,433 bytes, 84 lines download raw bytes

1app.directive('createNewsArticleWidget', function () {
2    return {
3        restrict: 'E',
4        templateUrl: '/_Assets/js/angular/app/components/article/article.widget.tpl.html',
5        scope: {
6            tag: '@',
7            take: '@',
8            type: '@',
9            click: '&'
10        }, controller: function ($scope, $http, $location) {
11            $scope.items = [];
12            $scope.itemsFeatured = [];
13
14            $scope.hideLoadMoreButton = false;
15            $scope.firstLoad = false;
16            $scope.param = {
17                type: $scope.type,
18                currentPage: 0,
19                skip: 0,
20                take: $scope.take,
21                tag: $scope.tag
22            };
23            $scope.baseUrl = $location.$$absUrl;
24
25            /* Load items */
26            $scope.loadItems = function () {
27                $http.get('/api/data/GetNewsData', { params: { skip: $scope.param.skip, take: $scope.param.take, type: $scope.param.type, tag: $scope.param.tag, featured: false } }).then(function (response) {
28                    angular.forEach(response.data.records, function (article) {
29                        $scope.items.push(article);
30                    });
31
32                    if (!$scope.firstLoad) {
33                        if (response.data.total == 0) {
34                            if ($scope.param.type == "news") {
35                                $('#tabNews').hide();
36                            }
37                            if ($scope.param.type == "notice") {
38                                $('#tabNotices').hide();
39                            }
40                            if ($scope.param.type == "archive") {
41                                $('#tabArchives').hide();
42                            }
43                        }
44                    } else {
45                        addthis.layers.refresh();
46                    }
47
48                    $scope.firstLoad = true;
49
50                    if (response.data.total < $scope.param.take) {
51                        $scope.hideLoadMoreButton = true;
52                    }
53
54                    $scope.param.currentPage++;
55                    $scope.param.skip = $scope.param.currentPage * $scope.param.take;
56                });
57
58                /* Load Notices */
59                if ($scope.param.type == "notice") {
60                    $http.get('/api/data/GetNews_NewArticle', { params: { type: $scope.param.type, tag: $scope.param.tag } }).then(function (response) {
61                        if (response.data.newData) {
62                            $('#tabNotices').append("<div class='new-label'>New!</div>");
63                        }
64                    });
65                }
66            }
67
68            /* Load Featured Items */
69            $scope.loadFeaturedItems = function () {
70                if ($scope.param.type == "news") {
71                    $http.get('/api/data/GetNewsData', { params: { skip: 0, take: 10, type: $scope.param.type, tag: $scope.param.tag, featured: true } }).then(function (response) {
72                        angular.forEach(response.data.records, function (article) {
73                            $scope.itemsFeatured.push(article);
74                        });
75                    });
76                }
77            }
78
79
80            $scope.loadFeaturedItems();
81            $scope.loadItems();
82        }
83    };
84});

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.