PageSourceSearch

https://www.kla.tv/js/app/directive/smartstats-star-video.directive.js?v=2026092409

js kla.tv collected 2026-10-01 10:31:10 UTC 4,876 bytes, 102 lines download raw bytes

1(function ()
2{
3
4    'use strict';
5
6    angular
7        .module('ktvApp')
8        .directive('smartstatsStarVideo', smartstatsStarVideo);
9
10    smartstatsStarVideo.$inject = ['$http'];
11    function smartstatsStarVideo ($http)
12    {
13        var directive = {
14            restrict: 'A',
15            /*scope: true,
16            link: linkFunc,
17            //controller: ExampleController,
18            // note: This would be 'ExampleController' (the exported controller name, as string)
19            // if referring to a defined controller in its separate file.
20            controllerAs: 'vm',
21            bindToController: true // because the scope is isolated*/
22            scope: {
23                videoid: '@videoid',
24                format: '@format',
25            },
26            link: function ($scope, element, $attr)
27            {
28                var popular_cnt = 60000;
29                var view_cnt = 15000;
30
31                $attr.$observe('videoid', function (videoid)
32                {
33                    element.html('');
34                    if (videoid)
35                    {
36                        var config = {
37                            method: "GET",
38                            url: 'https://smartstats.kla.tv/v1/stats/' + videoid + "/combined",
39                            timeout: 1000
40                        };
41                        window.CollectingRequestCache.get('loadStars', videoid)
42                        //$http(config)
43                        .then(function (data)
44                            {
45                                var viewsTxt = "" + data["data"]["views"];
46                                var views = parseInt(data["data"]["views"]);
47                                var dots = Math.floor((viewsTxt.length - 1) / 3);
48                                var viewAdvc = ""
49                                for (var i = 1; i <= dots; i++)
50                                {
51                                    viewAdvc = '.' + viewsTxt.substr(-3 * i, 3) + viewAdvc;
52                                }
53                                viewAdvc = viewsTxt.substr(0, viewsTxt.length - 3 * dots) + viewAdvc;
54
55                                if (views > view_cnt)
56                                {
57                                    var htmlString = '<span style="display: block;color: black; font-size: 12px;">'
58                                    var basepath = $attr.basepath;
59                                    var lang_view = $attr.langView;
60                                    var lang_popular = $attr.langPopular;
61                                    var style_text = "";
62                                    if (views > popular_cnt)
63                                    {
64                                        if ($attr.format == "big")
65                                        {
66                                            htmlString += '<img src="' + basepath + 'images/icons/smartstats_v01_stars_big.png" /><span style="color: #ffaf00;">' + lang_popular+'</span><br>';
67                                        } else if ($attr.format == "small" || $attr.format == "smallwhite")
68                                        {
69                                            htmlString += `<span style="color: #ffaf00;">
70                                                        <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
71	                                                    viewBox="0 0 53.867 53.867" style="width: 16px; margin-top: -2px;" xml:space="preserve">
72                                                            <polygon style="fill:#ffaf00;" points="26.934,1.318 35.256,18.182 53.867,20.887 40.4,34.013 43.579,52.549 26.934,43.798 
73	                                                        10.288,52.549 13.467,34.013 0,20.887 18.611,18.182 "/>
74                                                                
75                                                                </svg></span>`;
76                                        }
77                                        style_text = ($attr.format == "big")?"top: 2px; position: relative;": "margin-left: 4px;";
78                                    }
79                                    var colorStyle = ($attr.format == "smallwhite") ? "style='color: white;'" : "";
80                                    htmlString += '<span style="' + style_text + '"><b ' + colorStyle   + '>' + viewAdvc + ' ' + lang_view + '</b></span></span>';
81                                    element.html(htmlString);
82                                }
83                                else {
84                                    element.html('');
85                                }
86                            }).catch(function () { });
87                    }
88                });
89            }
90        };
91
92
93
94
95
96        return directive;
97
98
99    }
100
101
102})()

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.