PageSourceSearch

https://www.dailybhutan.com/js/angularjs/dailybhutan.js?t=2

js dailybhutan.com collected 2026-09-24 21:21:32 UTC 10,922 bytes, 291 lines download raw bytes

1
2API_GetList = {
3    Home: "Category/getArticleList_More",
4    Category: "Category/getArticleList_More",
5    Search: "Home/getSearch_More",
6    Author: "Category/getArticleList_More",
7    Currency: "Home/getCurrency"
8};
9
10App.controller("categoryController", ["$scope", "$rootScope", "AppFactory", function ($scope, $rootScope, AppFactory) {
11    $scope.article_List = [];
12    $scope.isLast = false;
13    $scope.pageNumber = 0;
14    var parameter = {};
15
16    $scope.Preview = function (CurPage, PageType) {
17        $scope.pageNumber = $scope.pageNumber + 1;
18        parameter = {
19            "CurPage": CurPage,
20            "PageType": PageType,
21            "pageNumber": $scope.pageNumber
22        };
23
24        AppFactory.Execute(API_GetList.Category, parameter).then(function (respone) {
25            if (respone.data.errorCode == 0) {
26                $scope.article_List = $scope.article_List.concat(respone.data.data.article_List);
27                $scope.article_Total = respone.data.data.article_Total;
28
29                if ($scope.article_Total == $scope.article_List.length) {
30                    $scope.isLast = true;
31                }
32            }
33        }, function (ex) {
34        });
35    };
36
37    $rootScope.$on("LoadMore", function (event, data) {
38        if (!$scope.isLast) {
39            $("#lastItem").remove();
40            setTimeout(function () {
41                $scope.Preview(data.page, data.type);
42                $(".categoryList").append("<div id='lastItem'></div>");
43            }, 1000);
44        }
45    });
46
47}]).directive("scroll", function ($window, $rootScope) {
48    return function (scope, element, attrs) {
49        angular.element($window).bind("scroll", function () {
50            currPos = this.pageYOffset + $(window).height() - $("#lastItem").outerHeight();
51            if (currPos >= $("#lastItem").offset().top - 50) {
52                var data = {
53                    "page": attrs.page,
54                    "type": attrs.type
55                };
56                $rootScope.$emit("LoadMore", data);
57            }
58        });
59    };
60});
61
62App.controller("searchController", ["$scope", "$rootScope", "AppFactory", function ($scope, $rootScope, AppFactory) {
63    $scope.article_List = [];
64    $scope.isLast = false;
65    $scope.pageNumber = 0;
66    var parameter = {};
67
68    $scope.Preview = function (Temp) {
69        $scope.pageNumber = $scope.pageNumber + 1;
70        parameter = {
71            "Temp": Temp,
72            "pageNumber": $scope.pageNumber
73        };
74
75        AppFactory.Execute(API_GetList.Search, parameter).then(function (respone) {
76            if (respone.data.errorCode == 0) {
77                $scope.article_List = $scope.article_List.concat(respone.data.data.article_List);
78                $scope.article_Total = respone.data.data.article_Total;
79
80                if ($scope.article_Total == $scope.article_List.length) {
81                    $scope.isLast = true;
82                }
83            }
84        }, function (ex) {
85        });
86    };
87
88    $rootScope.$on("LoadMore_Search", function (event, data) {
89        if (!$scope.isLast) {
90            $("#lastItem").remove();
91            setTimeout(function () {
92                $scope.Preview(data.temp);
93                $(".categoryList").append("<div id='lastItem'></div>");
94            }, 1000);
95        }
96    });
97
98}]).directive("scrollsearch", function ($window, $rootScope) {
99    return function (scope, element, attrs) {
100        angular.element($window).bind("scroll", function () {
101            currPos = this.pageYOffset + $(window).height() - $("#lastItem").outerHeight();
102            if (currPos >= $("#lastItem").offset().top - 50) {
103                var data = {
104                    "temp": attrs.temp
105                }
106                $rootScope.$emit("LoadMore_Search", data);
107            }
108        });
109    };
110});
111
112App.controller("searchFormController", ["$scope", function ($scope) {
113    $scope.temp = "";
114    $scope.search = function (temp, event) {
115        if (event.keyCode == 13 || event == "") {
116            const encodedTemp = encodeURIComponent(temp.replace(".", "@2e").replace(":", "@3a").toLowerCase());
117            window.location = "/search/" + encodedTemp;
118        }
119    }
120}]);
121
122App.controller("weatherController", ["$scope", function ($scope) {
123    var iIndex = 0;
124    $scope.display = true;
125    $scope.config = [
126        { "Id": "awcc1502955609070", "Key": "361353", "Name": "Thimphu" },
127        { "Id": "awcc1502960606372", "Key": "360445", "name": "Paro" },
128        { "Id": "awcc1502960707450", "Key": "360459", "name": "Punakha" },
129        { "Id": "awcc1502960724434", "Key": "361405", "name": "Gangtey" },
130        { "Id": "awcc1502960741693", "Key": "3-843066_1_AL", "name": "Bumthang" },
131    ];
132    
133    if($(window).width() < 767) {
134        $scope.display = false;
135    } else {
136        $scope.display = true;
137    }
138
139    $scope.changeLocation = function () {
140        $scope.weather = '<a href="#" class="aw-widget-legal"></a><div id="' + $scope.config[iIndex].Id + '" class="aw-widget-current" data-locationkey="' + $scope.config[iIndex].Key + '" data-unit="c" data-language="en-us" data-useip="false" data-uid="' + $scope.config[iIndex].Id + '"></div><script type="text/javascript" src="https://oap.accuweather.com/launch.js"></script>';
141        iIndex++;
142        if (iIndex == $scope.config.length-1) {
143            iIndex = 0;
144        }
145
146        var myVar = setInterval(function () {
147            if ($(".aw-widget-content").length >= 1) {
148                $("body").on("click", "#link_current", function () {
149                    return false;
150                });
151                $(".aw-widget-content").attr("style", "border:none !important;");
152                $(".aw-current-weather-inner").attr("style", "padding-top:20px !important;");
153                $(".aw-temp-time-desc time").attr("style", "white-space:nowrap !important;");
154                $(".aw-temp-time-desc .aw-weather-description").attr("style", "white-space:nowrap !important;");
155                clearInterval(myVar);
156            }
157        }, 300);
158    }
159
160    $scope.changeLocation();
161    setInterval(function () {
162        $scope.changeLocation();
163        $scope.$apply();
164    }, 15000);
165
166}]);
167
168App.controller("currencyController", ["$scope", "AppFactory", function ($scope, AppFactory) {
169    $scope.changeBank = function (catID) {
170        $scope.currencyListByID = [];
171        $scope.currencyDate = "";
172        $.each($scope.currencyList, function (i, e) {
173            if (e.Category == catID) {
174                $scope.currencyListByID.push(e);
175                $scope.currencyDate = "Last Update: " + e.Date;
176            }
177        });
178        $scope.active = catID;
179        return false;
180    }
181
182    $scope.Preview = function () {
183        parameter = {
184            "type": ""
185        };
186        AppFactory.Execute(API_GetList.Currency, parameter).then(function (respone) {
187            if (respone.data.errorCode == 0) {
188                $scope.categoryList = respone.data.data.categoryList;
189                $scope.currencyList = respone.data.data.currencyList;
190                
191                $scope.changeBank($scope.categoryList[0].ID);
192            }
193        }, function (ex) {
194        });
195    };
196    $scope.Preview();
197
198}]);
199
200App.controller("topBannerController", ["$scope", function ($scope) {
201    var adverArray = [
202        { "src": "drukair.com.sg_a.jpg", "url":"https://www.drukair.com.sg/" },
203        { "src":"drukair.com.sg_b.jpg", "url": "https://www.drukair.com.sg/" }
204    ];
205
206    var advers = adverArray[Math.floor((Math.random() * adverArray.length))];
207    var topAdvers = '<a href="' + advers.url + '" target="_blank"><img alt="Drukair Singapore" src="/images/articles/' + advers.src + '" style="width:100%; padding:15px 0;" /></a>';
208
209    $(".topBanner").html(topAdvers);
210}]);
211
212App.controller("authorController", ["$scope", "$rootScope", "AppFactory", function ($scope, $rootScope, AppFactory) {
213    $scope.article_List = [];
214    $scope.isLast = false;
215    $scope.pageNumber = 0;
216    var parameter = {};
217
218    $scope.Preview = function (CurPage, PageType) {
219        $scope.pageNumber = $scope.pageNumber + 1;
220        parameter = {
221            "CurPage": CurPage,
222            "PageType": PageType,
223            "pageNumber": $scope.pageNumber
224        };
225
226        AppFactory.Execute(API_GetList.Author, parameter).then(function (respone) {
227            if (respone.data.errorCode == 0) {
228                $scope.article_List = $scope.article_List.concat(respone.data.data.article_List);
229                $scope.article_Total = respone.data.data.article_Total;
230
231                if ($scope.article_Total == $scope.article_List.length) {
232                    $scope.isLast = true;
233                }
234            }
235        }, function (ex) {
236        });
237    };
238
239    $rootScope.$on("LoadMore", function (event, data) {
240        if (!$scope.isLast) {
241            $("#lastItem").remove();
242            $scope.Preview(data.page, data.type);
243            $(".categoryList").append("<div id='lastItem'></div>");
244        }
245    });
246
247}]).directive("scrollauthor", function ($window, $rootScope) {
248    return function (scope, element, attrs) {
249        angular.element($window).bind("scroll", function () {
250            currPos = this.pageYOffset + $(window).height() - $("#lastItem").outerHeight();
251            if (currPos >= $("#lastItem").offset().top - 50) {
252                var data = {
253                    "page": attrs.page,
254                    "type": attrs.type
255                }
256                $rootScope.$emit("LoadMore", data);
257            }
258        });
259    };
260});
261
262App.directive("controlLoader", ["$compile", "$templateRequest", function ($compile, $templateRequest) {
263    return {
264        restrict: "E",
265        replace: true,
266        link: function ($scope, element, attrs) {
267            var path = "/App_Plugins/lib/templates/";
268            var temp = path + "spec_loader.html";
269
270            $templateRequest(temp).then(function (html) {
271                var template = angular.element(html);
272                element.append(template);
273                $compile(template)($scope);
274            });
275        }
276    };
277}]);
278
279App.filter("currencyFilter", function () {
280    return function (items) {
281        var exclude = ["Swiss Franc", "Swiss France", "Hong Kong Dollar", "Hongkong Dollar", "Canadian Dollar", "Danish Kroner", "Swedish Kroner", "Norwegian Kroner"];
282        exclude += ["CAD", "CHF", "DKK", "GBP", "HKD", "NOK", "SEK"];
283        var filtered = [];
284        angular.forEach(items, function (e) {
285            if (!exclude.includes(e.Currency)) {
286                filtered.push(e);
287            }
288        });
289        return filtered;
290    };
291});

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.