PageSourceSearch

https://www.economic.bg/web/js/additional.js?v=2

js economic.bg collected 2026-10-02 02:32:32 UTC 5,852 bytes, 158 lines download raw bytes

1$(document).ready(function () {
2    var cityInfo = [];
3    var currentIndex = 0;
4    var tmrRotate = null;
5    var timeout = 10000;
6
7    $.ajax({
8        "url": xhr_url + '?method=getWeatherReport',
9        "dataType": "json",
10        "type": "GET",
11        "cache": false,
12        "success": function (response) {
13            $('.js-weather-widget').addClass('is-ready');
14            var index = 0;
15            for (var i in response.data) {
16                if (response.data.hasOwnProperty(i)) {
17
18                    var city = response.data[i];
19                    var name = city.name;
20                    var forecast = city.list;
21                    cityInfo[index] = {
22                        name: name,
23                        forecast: forecast,
24                    };
25                    index++;
26                }
27            }
28            loop();
29            tmrRotate = setTimeout(loop, timeout);
30
31        },
32        "error": function () {
33            //Error
34        }
35    });
36
37    function loop() {
38        var cityData = cityInfo[currentIndex];
39        var months = ['Януари', 'Февруари', 'Март', 'Април', 'Май', 'Юни', 'Юли', 'Август', 'Септември', 'Октомври', 'Ноември', 'Декември'];
40        var days = ['Днес:', 'Утре:', 'Вдругиден:'];
41        $('.weather__city').html(cityData.name);
42        $('.weather__forecast').html(cityData.forecast[0].weather[0].description);
43
44        $('.forecast').each(function (i, e) {
45            var el = $(this);
46            el.children(".weather__temp").html(cityData.forecast[i].temp.day.toFixed(0) + '° C');
47            var svg = el.children('svg').children('use');
48            var curr_link = svg.attr('xlink:href').split("#");
49            if (cityData.forecast[i].weather[0].icon) {
50                var icon = cityData.forecast[i].weather[0].icon.slice(0, -1);
51            }
52            svg.attr('xlink:href', curr_link[0] + '#icon-weather-' + icon + 'd');
53            var d = new Date(cityData.forecast[i].dt * 1000);
54            el.find(".weather__date").attr("datetime", d.getFullYear() + '-' + d.getMonth() + 1 + '-' + d.getDate());
55            el.find(".weather__date").html(days[i] + ' ' + d.getDate() + ' ' + months[d.getMonth()]);
56        });
57
58
59        currentIndex++;
60        if (currentIndex >= cityInfo.length) {
61            currentIndex = 0;
62        }
63        clearTimeout(tmrRotate);
64        tmrRotate = setTimeout(loop, timeout);
65    }
66
67    //fb cookie bar
68    if ($('.js-cookie-bar').length) {
69        //check for cookie
70        if (!readCookie('fbcommentsaccept')) {
71            $('.js-comments-request').show();
72        } else {
73            $('.js-comments-request').hide();
74            $('.fb-comments').show();
75        }
76        //cookie accept
77        $('.js-comment-accept').on('click', function () {
78            var date = new Date();
79            date.setTime(date.getTime() + (100 * 24 * 60 * 60 * 1000));
80            var expires = "expires=" + date.toGMTString();
81            document.cookie = 'fbcommentsaccept' + "=true; " + expires + "; path=/";
82            $('.js-comments-request').hide();
83        });
84    }
85
86
87    //cookie
88    function readCookie(name) {
89        var nameEQ = name + "=";
90        var ca = document.cookie.split(';');
91        for (var i = 0; i < ca.length; i++) {
92            var c = ca[i];
93            while (c.charAt(0) == ' ') c = c.substring(1, c.length);
94            if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
95        }
96        return false;
97    }
98
99    //Emergency news
100    $.ajax({
101        "url": xhr_url + '/?method=getEmergencyArticle',
102        "dataType": "json",
103        "type": "GET",
104        "cache": false,
105        "success": function (response) {
106            if (response && response.data) {
107                var id = response.data.id;
108                var title = response.data.title;
109                var url = response.data.url;
110                var updated_at = response.data.updated_at;
111
112                $('.extra-news__text').html('<a href="" title="" class="extra-news__link"></a>');
113                $('.extra-news__link').text(title);
114                $('.extra-news__link').attr("href", url);
115                $('.extra-news__link').attr("title", title);
116                $('.extra-news').show();
117
118                // if ($('.js-cookie-bar').length) {
119                //check for cookie
120                if (readCookie('emergencycookie') == id + '~' + updated_at) {
121                    $('.extra-news').hide();
122                } else {
123                    $('.extra-news').show();
124                }
125                //cookie accept
126                $('.extra-news__close').on('click', function () {
127                    var date = new Date();
128                    date.setTime(date.getTime() + (24 * 60 * 60 * 1000));
129                    var expires = "expires=" + date.toGMTString();
130                    document.cookie = 'emergencycookie' + "=" + id + '~' + updated_at + "; " + expires + "; path=/";
131                    $('.extra-news__close').hide();
132                });
133                // }
134            }
135        },
136        "error": function () {
137            //Error
138        }
139    });
140
141    $.ajax({
142        "url": xhr_url + '/?method=getCurrencies',
143        "dataType": "json",
144        "type": "GET",
145        "cache": false,
146        "success": function (response) {
147            
148            //console.log(response);
149            $(".js-currency-label").each(function (index) {
150                $(this).html(response.data.rows[index]);
151            });
152            $(".js-currency-rate").each(function (index) {
153                $(this).html((response.data.currency[index].rate).toFixed(4));
154                $(this).addClass("currency__rate--" + response.data.currency[index].arrow);
155            });
156        }
157    });
158});

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.