PageSourceSearch

http://kanos.com.ua/wp-content/themes/kanos/js/script.js?v=4

js kanos.com.ua collected 2026-10-02 20:18:52 UTC 15,836 bytes, 563 lines download raw bytes

1var maxWidth = 960;
2var minWidth = 944;
3//var ie = detectIE();
4
5$(document).ready(function() {
6    initJcarousel();
7    initScrollbar('.newscast');
8    initScrollbar('.aktualno');
9    hideCommentsAfter3Item();
10    showAllComments();
11    commentFormValidate();
12    feedbackFormValidate();
13
14    /*oldBrowserShowPopup();
15    scrollToTop();
16    scrollToTopClick();
17    initMenu();
18    initPopupCallers();
19    initSliderJcarousel();
20    initSlider2Jcarousel();
21    initSlider3Jcarousel();  
22
23    feedbackFormValidate();
24    tellUsNewsFormValidate();
25    archiveCalendar();           
26    newsFeedScrollbar();             
27    mobSearch();
28    mobMenu();
29    mobCopyBlockNews();
30    
31    $(window).scroll(function() {
32        scrollToTop();
33    });                      
34    $(window).resize(function () {
35        mobCopyBlockNews();
36    });    */
37});
38
39function initJcarousel()
40{
41    var jcarousel = $('.jcarousel');
42
43    jcarousel.on('jcarousel:reload jcarousel:create', function () {
44        var carousel = $(this),
45            width = $('#'+carousel.attr('id')).innerWidth();
46        carousel.jcarousel('items').css('width', Math.ceil(width) + 'px');
47    }
47).jcarousel({
48        wrap: 'circular',
49        animation: {
50            duration: 0,
51            easing: 'linear'
52        }
53    }).jcarouselAutoscroll({
54        target: '-=1',
55        interval: '10000',
56        autostart: true
57    });
58
59    jcarousel.on('jcarousel:animate', function (event, carousel) {
60        $(carousel._element.context).find('li').hide().fadeIn(500);
61    });
62
63    $('.jcarousel-control-prev').on('jcarouselcontrol:active', function() {
64        $(this).removeClass('inactive');
65    }).on('jcarouselcontrol:inactive', function() {
66        $(this).addClass('inactive');
67    }).jcarouselControl({
68        target: '-=1'
69    });
70
71    $('.jcarousel-control-next').on('jcarouselcontrol:active', function() {
72        $(this).removeClass('inactive');
73    }).on('jcarouselcontrol:inactive', function() {
74        $(this).addClass('inactive');
75    }).jcarouselControl({
76        target: '+=1'
77    });
78
79    $('.jcarousel-pagination').on('jcarouselpagination:active', 'a', function() {
80        $(this).addClass('active');
81    }).on('jcarouselpagination:inactive', 'a', function() {
82        $(this).removeClass('active');
83    }
83).jcarouselPagination();
84}
85
86function initScrollbar(elem)
87{
88    $(elem).mCustomScrollbar({
89        scrollInertia:0
90    });
91}
92
93function isTouchDevice() 
94{
95    return (('ontouchstart' in window) || (navigator.MaxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0));
96}
97
98function hideCommentsAfter3Item()
99{
100    $('.commentlist .comment:gt(2)').hide();
101}
102
103function showAllComments()
104{
105    $('#show-all-comments').on('click', function(){
106        $('.commentlist .comment').show();
107    });
108}
109
110function commentFormValidate()
111{
112    var form = $('#commentform');
113    $('#comment-submit').on('click', function() {
114        var valid = 0;
115
116        valid += validRequiredField(form.find('#author'));
117        valid += validRequiredField(form.find('#email'));
118        valid += validEmailField(form.find('#email'));
119        valid += validRequiredField(form.find('#captcha_code'));
120        valid += validRequiredField(form.find('#comment'));
121
122        if (valid == 5) {
123            $(this).attr('type', 'submit');
124            $(this).submit();
125        }
126    });
127    form.find('#author').on('blur keyup', function() {
128        validRequiredField($(this));
129    });
130    form.find('#email').on('blur keyup', function() {
131        validRequiredField($(this));
132        validEmailField($(this));
133    });
134    form.find('#captcha_code').on('blur keyup', function() {
135        validRequiredField($(this));
136    });
137    form.find('#comment').on('blur keyup', function() {
138        validRequiredField($(this));
139    });
140}
141
142function feedbackFormValidate()
143{
144    var formID = 'feedback-form',
145        submitBtnID = 'feedback-submit',
146        successBlockID = 'feedback-success',
147        errorBlockID = 'feedback-error',
148        form = $('#'+formID);
149
150    $('#'+submitBtnID).on('click', function() {
151        var valid = 0;
152
153        valid += validRequiredField(form.find('#feedback-name'));
154        valid += validRequiredField(form.find('#feedback-email'));
155        valid += validEmailField(form.find('#feedback-email'));
156        valid += validRequiredField(form.find('#feedback-text'));
157
158        if (valid == 4) {
159            var data = form.serializeObject();
160            data['action'] = 'feedbackSend';
161            data['nonce'] = myajax.nonce;
162
163            if (data.email != '') {
164                showBgOverlay();
165                $.post(myajax.url, data, function(response) {
166                    if(response == 'success') {
167                        form.hide();
168                        grecaptcha.reset();
169                        $('#'+successBlockID).show();
170                        setTimeout(function(){
171                            $('#'+successBlockID).hide();
172                            form.show();
173                        }, 5000);
174                    } else {
175                        form.hide();
176                        $('#'+errorBlockID).show();
177                        setTimeout(function(){
178                            $('#'+errorBlockID).hide();
179                            form.show();
180                        }, 5000);
181                    }
182                    hideBgOverlay();
183                });
184                form.trigger('reset');
185            }
186        }
187    });
188    form.find('#feedback-name').on('blur keyup', function() {
189        validRequiredField($(this));
190    });
191    form.find('#feedback-email').on('blur keyup', function() {
192        validRequiredField($(this));
193        validEmailField($(this));
194    });
195    form.find('#feedback-text').on('blur keyup', function() {
196        validRequiredField($(this));
197    });
198}
199
200function validRequiredField(objectField)
201{
202    if (objectField.val() == undefined) {
203        return true;
204    }
205    var valid = $.trim(objectField.val()) != '' ? true : false;
206
207    if (!valid) {
208        objectField.addClass('error');
209    } else {
210        objectField.removeClass('error');
211    }
212
213    return valid;
214}
215
216function validEmailField(objectField)
217{
218    if (objectField.val() == undefined) {
219        return true;
220    }
221    var pattern = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
222        valid = pattern.test(objectField.val());
223
224    if (!valid) {
225        objectField.addClass('error');
226    } else {
227        objectField.removeClass('error');
228    }
229
230    return valid;
231}
232
233function showBgOverlay() {
234    $('input[type=submit], input[type=button], button[type=submit]').attr('disabled', 'disabled');
235}
236
237function hideBgOverlay() {
238    $('input[type=submit], input[type=button], button[type=submit]').removeAttr('disabled');
239}
240
241$.fn.serializeObject = function () {
242    var o = {};
243    var a = this.serializeArray();
244    $.each(a, function () {
245        if (o[this.name] !== undefined) {
246            if (!o[this.name].push) {
247                o[this.name] = [o[this.name]];
248            }
249            o[this.name].push(this.value || '');
250        } else {
251            o[this.name] = this.value || '';
252        }
253    });
254
255    return o;
256};
257
258/*function oldBrowserShowPopup()
259{
260    if (ie && ie <= 9) {
261        $('#old-browser-popup').bPopup({
262            modalClose: false,
263            opacity: 0.9
264        }).show();
265    }
266}*/
267
268/*function scrollToTop()
269{
270    if ($('body').innerWidth() > minWidth) {
271        if ($(document).scrollTop() > $(window).height()) {
272            $('.scroll-to-top').fadeIn();
273        } else {
274            $('.scroll-to-top').fadeOut();
275        }
276    } else {
277        $('.scroll-to-top').hide();
278    }
279}*/
280
281/*function scrollToTopClick()
282{
283    $('.scroll-to-top').on('click', function(){
284        $('html, body').animate({scrollTop : 0},800);
285        return false;
286    });
287}*/
288
289/*function detectIE()
290{
291    var ua = window.navigator.userAgent;
292
293    var msie = ua.indexOf('MSIE ');
294    if (msie > 0) {
295        // IE 10 or older => return version number
296        return parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10);
297    }
298    var trident = ua.indexOf('Trident/');
299    if (trident > 0) {
300        // IE 11 => return version number
301        var rv = ua.indexOf('rv:');
302        return parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10);
303    }
304    var edge = ua.indexOf('Edge/');
305    if (edge > 0) {
306        // Edge (IE 12+) => return version number
307        return parseInt(ua.substring(edge + 5, ua.indexOf('.', edge)), 10);
308    }
309
310    return false;
311}*/
312
313/*function initMenu()
314{
315    $('.js-item-city').on('click', function(){
316        $('.select-city-wrap').toggleClass('open');
317    });
318    $('.nav-top > ul > li').hover(function(){
319        if($(this).find('ul').is(':visible')){
320            $('.nav-top-line').addClass('show');
321        }
322    }, function(){
323        $('.nav-top-line').removeClass('show');
324    });
325}*/
326
327/*function initPopupCallers()
328{
329    $('a.popup-caller').on('click', function (event) {
330        event.preventDefault();
331        if (!isTouchDevice()) {
332            $($(this).attr('href')).bPopup();
333        } else {
334            $($(this).attr('href')).bPopup({
335                follow: [false, false]
336            });
337        }
338    });
339}*/
340
341
342
343/*function initSlider2Jcarousel()
344{
345    var jcarousel = $('.jcarousel-slider');
346
347    jcarousel.on('jcarousel:reload jcarousel:create', function () {
348        var carousel = $(this),
349         width = $('.jcarousel-slider').innerWidth();
350
351         carousel.jcarousel('items').css('width', Math.ceil(width) + 'px');
352    }
352).jcarousel({
353        wrap: 'circular',
354        animation: {
355            duration: 400,
356            easing: 'linear'
357        }
358    }).jcarouselAutoscroll({
359        target: '+=1',
360        interval: '10000',
361        autostart: true
362    });
363    
364    $('.jcarousel-control-prev').on('jcarouselcontrol:active', function() {
365        $(this).removeClass('inactive');
366    }).on('jcarouselcontrol:inactive', function() {
367        $(this).addClass('inactive');
368    }).jcarouselControl({
369        target: '-=1'
370    });
371
372    $('.jcarousel-control-next').on('jcarouselcontrol:active', function() {
373        $(this).removeClass('inactive');
374    }).on('jcarouselcontrol:inactive', function() {
375        $(this).addClass('inactive');
376    }).jcarouselControl({
377        target: '+=1'
378    });
379
380    $('.jcarousel-pagination').on('jcarouselpagination:active', 'a', function() {
381        $(this).addClass('active');
382    }).on('jcarouselpagination:inactive', 'a', function() {
383        $(this).removeClass('active');
384    }).jcarouselPagination();
385}*/
386
387/*function initSlider3Jcarousel()
388{
389    var jcarousel = $('#jcarousel-bottom-slider');
390
391    jcarousel.on('jcarousel:reload jcarousel:create', function () {
392        var carousel = $(this),
393            width = $('#jcarousel-bottom-slider').innerWidth();
394        carousel.jcarousel('items').css('width', Math.ceil(width) + 'px');
395    }
395).jcarousel({
396        wrap: 'circular',
397        animation: {
398            duration: 0,
399            easing: 'linear'
400        }
401    }).jcarouselAutoscroll({
402        target: '-=1',
403        interval: '10000',
404        autostart: true
405    });
406
407    jcarousel.on('jcarousel:animate', function (event, carousel) {
408        $(carousel._element.context).find('li').hide().fadeIn(1000);
409    });
410}*/
411
412
413
414/*
415
416*/
417
418/*function tellUsNewsFormValidate()
419{
420    var formID = 'tell-us-news-form',
421        submitBtnID = 'tell-us-news-submit',
422        successBlockID = 'tell-us-news-success',
423        errorBlockID = 'tell-us-news-error',
424        form = $('#'+formID);
425
426    $('#'+submitBtnID).on('click', function() {
427        var valid = 0;
428
429        valid += validRequiredField(form.find('#tell-us-news-name'));
430        valid += validRequiredField(form.find('#tell-us-news-phone'));
431        valid += validRequiredField(form.find('#tell-us-news-email'));
432        valid += validEmailField(form.find('#tell-us-news-email'));
433        valid += validRequiredField(form.find('#tell-us-news-text'));
434
435        if (valid == 5) {
436            var data = form.serializeObject();
437            data['action'] = 'tellUsNews';
438            data['nonce'] = myajax.nonce;
439
440            if (data.email != '') {
441                $.post(myajax.url, data, function(response) {
442                    if(response == 'success') {
443                        form.hide();
444                        grecaptcha.reset();
445                        $('#'+successBlockID).show();
446                        setTimeout(function(){
447                            $('#'+successBlockID).hide();
448                            form.show();
449                        }, 5000);
450                    } else {
451                        form.hide();
452                        $('#'+errorBlockID).show();
453                        setTimeout(function(){
454                            $('#'+errorBlockID).hide();
455                            form.show();
456                        }, 5000);
457                    }
458                });
459                form.trigger('reset');
460            }
461        }
462    });
463    form.find('#tell-us-news-name').on('blur keyup', function() {
464        validRequiredField($(this));
465    });
466    form.find('#tell-us-news-phone').on('blur keyup', function() {
467        validRequiredField($(this));
468    });
469    form.find('#tell-us-news-email').on('blur keyup', function() {
470        validRequiredField($(this));
471        validEmailField($(this));
472    });
473    form.find('#tell-us-news-text').on('blur keyup', function() {
474        validRequiredField($(this));
475    });
476}*/
477
478
479
480/*function archiveCalendar()
481{
482    $('#archive-month, #archive-year').on('change', function(){
483        $('.archive-current-month').text($('#archive-month option:selected').text());
484        $('.archive-current-year').text($('#archive-year option:selected').text());
485        _archiveCalendarChange($('#archive-month option:selected').val(), $('#archive-year option:selected').val())
486    });
487}*/
488
489/*function _archiveCalendarChange(month, year)
490{
491    $('.archive-all-month a').attr('href', '/'+year+'/'+(month < 10 ? '0'+month : month)+'/');
492
493    var html = '';
494    $.each(archiveCalendarJson[year][month], function(i, item) {
495        html += item;
496    });
497    $('.archive-day-wrap').html(html);
498}*/
499
500/*function mobSearch()
501{
502    $('.mob-search-btn').on('click', function(){
503        $(this).hide();
504        $('.search-wrap').show();
505        $('#input-search').focus();        
506    });
507    $('#input-search').on('blur', function(){
508        $(this).val('');
509        $('.search-wrap').removeAttr('style');
510        $('.mob-search-btn').removeAttr('style');
511    });
512}*/
513
514/*function mobMenu()
515{
516    $("#nav-top").mmenu({
517        navbar: {
518            title: "Меню"
519        }
520    }, { clone: true});
521    $(window).on("scroll resize orientationchange", function (event) {        
522        if ($('body').innerWidth() > minWidth) {
523            $("#mm-nav-top").data('mmenu').close();
524        }
525    });
526}*/
527
528/*function mobCopyBlockNews()
529{
530    if($('#mob-news-feed').length) {
531        if ($('body').innerWidth() <= minWidth) {
532            var blockNews = $('#block-news').children();
533            if (blockNews != '') {
534                $('#mob-news-feed').append(blockNews);
535            }
536        } else {
537            var blockNews = $('#mob-news-feed').children();
538            if (blockNews != '') {
539                $('#block-news').append(blockNews);
540            }
541        }
542    }
543    
544}*/
545
546/*$.fn.serializeObject = function ()
547{
548    var o = {};
549    var a = this.serializeArray();
550    $.each(a, function () {
551        if (o[this.name] !== undefined) {
552            if (!o[this.name].push) {
553                o[this.name] = [o[this.name]];
554            }
555            o[this.name].push(this.value || '');
556        } else {
557            o[this.name] = this.value || '';
558        }
559    });
560    
561    return o;
562};*/
563

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.