PageSourceSearch

https://mpress.mn/themes/bootstrap/js/script.js?v=1682856953

js mpress.mn collected 2026-10-04 13:29:28 UTC 10,049 bytes, 286 lines download raw bytes

1$(function() {
2    var d = new Date();
3    var month = new Array();
4    month[0] = "01";
5    month[1] = "02";
6    month[2] = "03";
7    month[3] = "04";
8    month[4] = "05";
9    month[5] = "06";
10    month[6] = "07";
11    month[7] = "08";
12    month[8] = "09";
13    month[9] = "10";
14    month[10] = "11";
15    month[11] = "12";
16
17    if ($('.today-title')) {
18        $('.today-title').append(' <span class="today-date">' + month[d.getMonth()] + ' сарын ' + d.getDate() + ' <i class="fas fa-chevron-down"></i> </span>');
19    }
20})
21
22function weatherWidget(city = 'Улаанбаатар') {
23    $.get('/weather.json?city=' + city, function(data) {
24        var $weather = $('.weather');
25        var html = '<div class="weather-modal cursor-pointer">';
26        html += '<span class="w-icon"><img src="/theme/frontend/images/weather/' + data['data']['weather'][0]['phenoIdDay'] + '_d.png">';
27        html += '<span class="w-name"><span class="w-city">' + data['city'] + '</span> ' + data['data']['weather'][0]['temperatureDay'] + '°C' + '</span>';
28        html += '</div>';
29
30        var items = '<h5 class="mb-1">' + data['city'] + '</h5>';
31    	items += '<div class="table-responsive weather-table">'
32        items += '<table class="wi-list w-100 m-0 text-center"><tr>';
33
34        for (var i in data['data']['weather']) {
35            var item = data['data']['weather'][i];
36            items += '<td>'
37            items += '<div class="wi-item">'
38            items += '<div class="wi-date">';
39
40            if ((parseInt(i) === 0)) {
41                items += 'Өнөөдөр';
42            } else {
43                items += item['date'];
44            }
45
46            items += '</div>';
47            items += '<div class="wi-text">' + item['phenoDay'] + '</div>';
48            items += '<div class="wi-img"><img class="img-fluid" src="/theme/frontend/images/weather/' + item['phenoIdDay'] + '_d.png"></div>';
49            items += '<table class="w-100 text-center m-0"><tr><td> Өдөр <h5>' + item['temperatureDay'] + '</h5></td><td>Шөнө<h5>' + item['temperatureNight'] + '</h5></td></tr></table>'
50            items += '<div>'
51            items += '</td>'
52
53        }
54        items += '</tr></table>';
55      	items += '</div>';
56        items += '<br><p class="m-0 small">Эх сурвалж: © Цаг уур, орчны шинжилгээний газар</p>';
57
58        $weather.html(html);
59
60        $('.weather-modal').click(function() {
61            event.preventDefault();
62            $('#modal').find('.modal-dialog').addClass('modal-lg');
63            $('#modal').find('.modal-body').html(items);
64            $('#modal').find('.modal-title').text('5 хоногийн цаг агаарын урьдчилсан мэдээ');
65            $('#modal').modal('show');
66        });
67
68        //$weather.find('.w-name').html( data['city'] );
69        //$weather.find('.w-date').html( data['data']['weather'][0]['date'] );
70        //$weather.find('.w-icon').html(  );
71        //$weather.find('.w-temp').html( );
72        //$weather.find('.w-pheno').html( data['data']['weather'][0]['phenoDay'] );
73
74    })
75}
76
77function xrateWidget() {
78    $.get('//monxansh.appspot.com/xansh.json?currency=USD', function(res) {
79        var $rate = $('.x-rate');
80        var html = '<div class="xr-item cursor-pointer">';
81        html += '<span class="xr-flag mr-1"><img src="/theme/frontend/images/flag/' + res[0]['code'].toLowerCase() + '.png" class="d-inline"></span>';
82        html += '<span class="xr-curr">' + res[0]['rate_float'] + '₮</span>';
83        html += '<div class="xr-name">' + res[0]['name'] + '</div>';
84        html += '</div>';
85        $rate.html(html);
86    });
87
88    $('body').on('click', '.xr-item', function() {
89        $.get('//monxansh.appspot.com/xansh.json', function(res) {
90            var html = '<div class="row mb-2"><div class="col-6"><img src="https://www.mongolbank.mn/img/mongolbank_logo.png" height="30"></div><div class="col-6 text-right">' + res[0]['last_date'] + '</div></div>'
91            html += '<table class="table table-bordered table-striped">';
92            html += '<thead><tr>';
93            html += '<th></th>';
94            html += '<th></th>';
95            html += '<th>Валют</th>';
96            html += '<th>Ханш</th><tr></thead>';
97            html += '<tbody>';
98
99            for (i in res) {
100                html += '<tr>'
101                if (parseInt(i) <= 33) {
102                    html += '<td><img src="/theme/frontend/images/flag/' + res[i]['code'].toLowerCase() + '.png"></td>';
103                } else {
104                    html += '<td></td>';
105                }
106                html += '<td>' + res[i]['code'] + '</td>';
107                html += '<td>' + res[i]['name'] + '</td>';
108                html += '<td>' + res[i]['rate_float'] + '₮</td>';
109                html += '</tr>'
110            }
111
112            html += '</tbody></table>';
113
114            $('#modal').find('.modal-dialog').addClass('modal-lg').addClass('modal-dialog-scrollable');
115            $('#modal').find('.modal-body').html(html);
116            $('#modal').find('.modal-title').text('Монгол банкны ханшийн мэдээ');
117            $('#modal').modal('show');
118
119        });
120    });
121}
122
123function resizeFacebookVideos() {
124    var ths = $('.embed-responsive .fb-video');
125    ths.attr('data-height', '275');
126}
127
128$(document).ready(function() {
129    // resizeFacebookVideos();
130});
131
132$(window).resize(resizeFacebookVideos);
133
134function horosWidget() {
135    var html = '<div>' + moment().format('yyyy-MM-DD') + ' </div>';
136    html += '<div><i class="icon-calendar3"></i> ' + moment().format('dddd') + '</div>';
137    $('.head-widget .horoscope').html(html);
138}
139
140$(function() {
141    horosWidget();
142    xrateWidget();
143    weatherWidget();
144});
145
146$.fn.ticker = function() {
147    return this.each(function() {
148        var $this = $(this);
149        var _scroll = {
150            delay: 1000,
151            easing: 'linear',
152            items: 1,
153            duration: 0.05,
154            timeoutDuration: 0,
155            pauseOnHover: 'immediate'
156        };
157        $this.carouFredSel({
158            width: 1000,
159            align: false,
160            items: {
161                width: 'variable',
162                height: 25,
163                visible: 1
164            },
165            scroll: _scroll
166        });
167        $this.parent('.caroufredsel_wrapper').css('width', '100%');
168    });
169};
170
171function formatNumber(number, ind = 0) {
172    number = number.toFixed(ind) + '';
173    x = number.split('.');
174    x1 = x[0];
175    x2 = x.length > 1 ? '.' + x[1] : '';
176    var rgx = /(\d+)(\d{3})/;
177    while (rgx.test(x1)) {
178        x1 = x1.replace(rgx, '$1' + ',' + '$2');
179    }
180    return x1 + x2;
181}
182
183function scrollToFixed() {
184  	if($('.IDKPSH4571930FH1').length > 0 && $(document).width() > 1000){
185      $('.IDKPSH4571930FH1').scrollToFixed({
186          marginTop: 20,
187          limit: $('.IDKPSH3ANIL06CN1').offset().top - $('.IDKPSH4571930FH1').outerHeight(true)
188      });
189    }
190  
191  	if($('#sidebar-right').length > 0 && $(document).width() > 1000){
192      $('#sidebar-right').scrollToFixed({
193          marginTop: 20,
194          limit: $('.footer').offset().top - $('#sidebar-right').outerHeight(true)
195      });
196    }
197	
198  	if($('.IDKPSMLZADYBLH21').length > 0 && $(document).width() > 1000 ){
199      $('.IDKPSMLZADYBLH21').scrollToFixed({
200          marginTop: 20,
201          limit: $('.IDKPTIT6TIHS5D91').offset().top - $('.IDKPSMLZADYBLH21').outerHeight(true)
202      });
203    }
204  	if($('#homeTab').length > 0 && $(document).width() < 700 ){
205      $('#homeTab').scrollToFixed({
206          marginTop: 0,
207      });
208    }
209}
210
211$(function() {
212    $.getJSON('/getDataMse', function(res) {
213        var items = [];
214        $.each(res, function(key, item) {
215            var perc = '',
216                s = '';
217            if (item[2] > 0) {
218                s = '<span class="rate-icon me-1 text-success"><i class="fas fa-angle-up"></i></span>';
219                perc = '<span class="rate-perc me-1 text-success"> +' + formatNumber(item[2]) + '%</span>';
220            } else {
221                s = '<span class="rate-icon me-1 text-danger"><i class="fas fa-angle-down text-danger"></i></span>';
222                perc = '<span class="rate-perc me-1 text-danger">' + formatNumber(item[2]) + '%</span>';
223            }
224            t = '<span class="rate-curr fw-bold me-1">' + item[0] + '</span>';
225            v = '<span class="rate-value fw-bold">' + formatNumber(item[1]) + '</span>';
226
227            items.push("<li class='list-inline-item px-2 mx-1'>" + s + t + perc + v + "</li>");
228        });
229        $("<ul/>", {
230            "class": "list-inline m-0",
231            'id': "xrate-ticker",
232            html: items.join("")
233        }).appendTo(".xrate-ticker");
234        $('#xrate-ticker').ticker();
235    });
236
237    $('#video-posts-carousel').flexslider({
238        animation: "slide",
239        controlNav: false,
240        animationLoop: false,
241        slideshow: false,
242        itemWidth: 170,
243        itemMargin: 10,
244        asNavFor: '#video-posts-slider'
245    });
246
247    $('#video-posts-slider').flexslider({
248        animation: "slide",
249        controlNav: false,
250        animationLoop: false,
251        slideshow: false,
252        sync: "#video-posts-carousel"
253    });
254  
255});
256
257$('document').ready(function(){
258  scrollToFixed();
259  $('#header-wrap .dropdown-toggle').removeAttr('data-bs-toggle');
260  $('.xrate-ticker').click(function(){
261    window.location = 'https://mpress.mn/cat/2';
262  })
263  var gototop = document.getElementById("gotoTop");
264
265  // When the user scrolls down 20px from the top of the document, show the button
266  window.onscroll = function() {scrollFunction()};
267
268  function scrollFunction() {
269    if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
270      gototop.style.display = "block";
271    } else {
272      gototop.style.display = "none";
273    }
274  }
275
276  // When the user clicks on the button, scroll to the top of the document
277  function goToTop() {
278    document.body.scrollTop = 0;
279    document.documentElement.scrollTop = 0;
280  }
281
282  $('#gotoTop').click(function(){
283    goToTop();
284  });
285  
286});

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.