PageSourceSearch

https://rusaniv.com/wp-content/themes/rusaniv/assets/scripts/index.js?ver=1791510608

js rusaniv.com collected 2026-10-09 01:50:19 UTC 47,272 bytes, 569 lines download raw bytes

1/**Menu hover Effect */
2let menuButton = document.querySelector('.menu-button'),
3    menu = document.querySelector('menu.top-menu'),
4    header = document.querySelector('header.header');
5menuButton.querySelectorAll('rect').forEach(rect => {
6    rect.dataset.startHeight = rect.getAttribute('width');
7})
8menuButton.addEventListener('mouseover', (evt) => {
9    menuButton.querySelectorAll('rect').forEach(rect => {
10        rect.setAttribute('width', '36');
11    })
12});
13menuButton.addEventListener('mouseout', function(evt) {
14    menuButton.querySelectorAll('rect').forEach(rect => {
15        rect.setAttribute('width', rect.dataset.startHeight);
16    })
17});
18menuButton.addEventListener('click', function(evt) {
19    menu.classList.add('opened');
20    header.classList.add('opened');
21    menuButton.classList.add('opened');
22    if (window.screen.width < 576) menuButton.addEventListener('click', closeMenuOnMobile);
23
24});
25menu.querySelector('.close-button').addEventListener('click', function(evt) {
26    menu.classList.remove('opened');
27    header.classList.remove('opened');
28    menuButton.classList.remove('opened');
29});
30/**Menu hover Effect  END*/
31document.querySelector('div').__proto__.__proto__.putTempClass = function(className, timeout = 1000) {
32    this.classList.add(className);
33    setTimeout(() => {
34        this.classList.remove(className);
35    }, timeout);
36};
37
38function closeMenuOnMobile(evt) {
39    menu.classList.remove('opened');
40    menuButton.classList.remove('opened');
41    header.classList.remove('opened');
42    menuButton.removeEventListener('click', closeMenuOnMobile, false);
43}
44/**MASK */
45// VMasker(document.querySelector(".inputtelmask")).maskPattern("+99 (999) 999-99-99");
46/**MASK END*/
47// console.log(document.querySelector('.common-form'));
48document.querySelector('.common-form .form-close-block').onclick = () => {
49    $.magnificPopup.close();
50};
51$('.call-form-js').magnificPopup({
52    items: {
53        type: 'inline',
54        src: '#common-form',
55    },
56    callbacks: {
57        beforeClose: () => document.querySelector('#common-form').putTempClass('f', 2000),
58    },
59    showCloseBtn: false,
60    // other options
61});
62
63$('.datetimepicker').datetimepicker({
64    //            theme:'dark',
65    // value: 'trololo',
66    // value: new Date(),
67    minDate: new Date(),
68    maxTime: '20:00',
69    yearStart: 2019,
70    yearEnd: 2019,
71    dayOfWeekStart: 1,
72
73});
74
75/**checkbox click on label config */
76
77let checkboxes = document.querySelectorAll('.checkbox-group');
78checkboxes.forEach(box => {
79        box.addEventListener('click', function(evt) {
80            // console.log(box);
81
82            document.querySelectorAll('.checkbox-wrap').forEach(radio => radio.style.borderColor = `var(--dark-gray)`);
83            box.querySelector('input').checked = true;
84            box.querySelector('input').checked ?
85                box.querySelector('.checkbox-wrap').style.borderColor = `var(--red)` :
86                null;
87
88            if (box.classList.contains('with-date-js')) {
89                let dateInput = box.querySelector('.datetimewrapper') || null;
90                dateInput.style.opacity = `1`;
91            } else {
92
93                document.querySelector('.datetimewrapper').style.opacity = `0`;
94            }
95        });
96    })
97    /**checkbox click on label config END */
98
99/*Form handler */
100/* beautify preserve:start */
101
102/*
103    jQuery Masked Input Plugin
104    Copyright (c) 2007 - 2015 Josh Bush (digitalbush.com)
105    Licensed under the MIT license (http://digitalbush.com/projects/masked-input-plugin/#license)
106    Version: 1.4.1
107*/
108!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b,c=navigator.userAgent,d=/iphone/i.test(c),e=/chrome/i.test(c),f=/android/i.test(c);a.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},a.fn.extend({caret:function(a,b){var c;if(0!==this.length&&!this.is(":hidden"))return"number"==typeof a?(b="number"==typeof b?b:a,this.each(function(){this.setSelectionRange?this.setSelectionRange(a,b):this.createTextRange&&(c=this.createTextRange(),c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select())})):(this[0].setSelectionRange?(a=this[0].selectionStart,b=this[0].selectionEnd):document.selection&&document.selection.createRange&&(c=document.selection.createRange(),a=0-c.duplicate().moveStart("character",-1e5),b=a+c.text.length),{begin:a,end:b})},unmask:function(){return this.trigger("unmask")},mask:function(c,g){var h,i,j,k,l,m,n,o;if(!c&&this.length>0){h=a(this[0]);var p=h.data(a.mask.dataName);return p?p():void 0}return g=a.extend({autoclear:a.mask.autoclear,placeholder:a.mask.placeholder,completed:null},g),i=a.mask.definitions,j=[],k=n=c.length,l=null,a.each(c.split(""),function(a,b){"?"==b?(n--,k=a):i[b]?(j.push(new RegExp(i[b])),null===l&&(l=j.length-1),k>a&&(m=j.length-1)):j.push(null)}),this.trigger("unmask").each(function(){function h(){if(g.completed){for(var a=l;m>=a;a++)if(j[a]&&C[a]===p(a))return;g.completed.call(B)}}function p(a){return g.placeholder.charAt(a<g.placeholder.length?a:0)}function q(a){for(;++a<n&&!j[a];);return a}function r(a){for(;--a>=0&&!j[a];);return a}function s(a,b){var c,d;if(!(0>a)){for(c=a,d=q(b);n>c;c++)if(j[c]){if(!(n>d&&j[c].test(C[d])))break;C[c]=C[d],C[d]=p(d),d=q(d)}z(),B.caret(Math.max(l,a))}}function t(a){var b,c,d,e;for(b=a,c=p(a);n>b;b++)if(j[b]){if(d=q(b),e=C[b],C[b]=c,!(n>d&&j[d].test(e)))break;c=e}}function u(){var a=B.val(),b=B.caret();if(o&&o.length&&o.length>a.length){for(A(!0);b.begin>0&&!j[b.begin-1];)b.begin--;if(0===b.begin)for(;b.begin<l&&!j[b.begin];)b.begin++;B.caret(b.begin,b.begin)}else{for(A(!0);b.begin<n&&!j[b.begin];)b.begin++;B.caret(b.begin,b.begin)}h()}function v(){A(),B.val()!=E&&B.change()}function w(a){if(!B.prop("readonly")){var b,c,e,f=a.which||a.keyCode;o=B.val(),8===f||46===f||d&&127===f?(b=B.caret(),c=b.begin,e=b.end,e-c===0&&(c=46!==f?r(c):e=q(c-1),e=46===f?q(e):e),y(c,e),s(c,e-1),a.preventDefault()):13===f?v.call(this,a):27===f&&(B.val(E),B.caret(0,A()),a.preventDefault())}}function x(b){if(!B.prop("readonly")){var c,d,e,g=b.which||b.keyCode,i=B.caret();if(!(b.ctrlKey||b.altKey||b.metaKey||32>g)&&g&&13!==g){if(i.end-i.begin!==0&&(y(i.begin,i.end),s(i.begin,i.end-1)),c=q(i.begin-1),n>c&&(d=String.fromCharCode(g),j[c].test(d))){if(t(c),C[c]=d,z(),e=q(c),f){var k=function(){a.proxy(a.fn.caret,B,e)()};setTimeout(k,0)}else B.caret(e);i.begin<=m&&h()}b.preventDefault()}}}function y(a,b){var c;for(c=a;b>c&&n>c;c++)j[c]&&(C[c]=p(c))}function z(){B.val(C.join(""))}function A(a){var b,c,d,e=B.val(),f=-1;for(b=0,d=0;n>b;b++)if(j[b]){for(C[b]=p(b);d++<e.length;)if(c=e.charAt(d-1),j[b].test(c)){C[b]=c,f=b;break}if(d>e.length){y(b+1,n);break}}else C[b]===e.charAt(d)&&d++,k>b&&(f=b);return a?z():k>f+1?g.autoclear||C.join("")===D?(B.val()&&B.val(""),y(0,n)):z():(z(),B.val(B.val().substring(0,f+1))),k?b:l}var B=a(this),C=a.map(c.split(""),function(a,b){return"?"!=a?i[a]?p(b):a:void 0}),D=C.join(""),E=B.val();B.data(a.mask.dataName,function(){return a.map(C,function(a,b){return j[b]&&a!=p(b)?a:null}).join("")}),B.one("unmask",function(){B.off(".mask").removeData(a.mask.dataName)}).on("focus.mask",function(){if(!B.prop("readonly")){clearTimeout(b);var a;E=B.val(),a=A(),b=setTimeout(function(){B.get(0)===document.activeElement&&(z(),a==c.replace("?","").length?B.caret(0,a):B.caret(a))},10)}}).on("blur.mask",v).on("keydown.mask",w).on("keypress.mask",x).on("input.mask paste.mask",function(){B.prop("readonly")||setTimeout(function(){var a=A(!0);B.caret(a),h()},0)}),e&&f&&B.off("input.mask").on("input.mask",u),A()})}})});
109
110/*
111 * International Telephone Input v12.1.3
112 * https://github.com/jackocnr/intl-tel-input.git
113 * Licensed under the MIT license
114 */
115!function(a){"function"==typeof define&&define.amd?define(["jquery"],function(b){a(b,window,document)}):"object"==typeof module&&module.exports?module.exports=a(require("jquery"),window,document):a(jQuery,window,document)}(function(a,b,c,d){"use strict";function e(b,c){this.a=a(b),this.b=a.extend({},h,c),this.ns="."+f+g++,this.d=Boolean(b.setSelectionRange),this.e=Boolean(a(b).attr("placeholder"))}var f="intlTelInput",g=1,h={allowDropdown:!0,autoHideDialCode:!0,autoPlaceholder:"polite",customPlaceholder:null,dropdownContainer:"",excludeCountries:[],formatOnDisplay:!0,geoIpLookup:null,hiddenInput:"",initialCountry:"",nationalMode:!0,onlyCountries:[],placeholderNumberType:"MOBILE",preferredCountries:["us","gb"],separateDialCode:!1,utilsScript:""},i={b:38,c:40,d:13,e:27,f:43,A:65,Z:90,j:32,k:9},j=["800","822","833","844","855","866","877","880","881","882","883","884","885","886","887","888","889"];a(b).on("load",function(){a.fn[f].windowLoaded=!0}),e.prototype={_a:function(){return this.b.nationalMode&&(this.b.autoHideDialCode=!1),this.b.separateDialCode&&(this.b.autoHideDialCode=this.b.nationalMode=!1),this.g=/Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),this.g&&(a("body").addClass("iti-mobile"),this.b.dropdownContainer||(this.b.dropdownContainer="body")),this.h=new a.Deferred,this.i=new a.Deferred,this.s={},this._b(),this._f(),this._h(),this._i(),this._i2(),[this.h,this.i]},_b:function(){this._d(),this._d2(),this._e()},_c:function(a,b,c){b in this.q||(this.q[b]=[]);var d=c||0;this.q[b][d]=a},_d:function(){if(this.b.onlyCountries.length){var a=this.b.onlyCountries.map(function(a){return a.toLowerCase()});this.p=k.filter(function(b){return a.indexOf(b.iso2)>-1})}else if(this.b.excludeCountries.length){var b=this.b.excludeCountries.map(function(a){return a.toLowerCase()});this.p=k.filter(function(a){return b.indexOf(a.iso2)===-1})}else this.p=k},_d2:function(){this.q={};for(var a=0;a<this.p.length;a++){var b=this.p[a];if(this._c(b.iso2,b.dialCode,b.priority),b.areaCodes)for(var c=0;c<b.areaCodes.length;c++)this._c(b.iso2,b.dialCode+b.areaCodes[c])}},_e:function(){this.preferredCountries=[];for(var a=0;a<this.b.preferredCountries.length;a++){var b=this.b.preferredCountries[a].toLowerCase(),c=this._y(b,!1,!0);c&&this.preferredCountries.push(c)}},_f:function(){this.a.attr("autocomplete","off");var b="intl-tel-input";this.b.allowDropdown&&(b+=" allow-dropdown"),this.b.separateDialCode&&(b+=" separate-dial-code"),this.a.wrap(a("<div>",{"class":b})),this.k=a("<div>",{"class":"flag-container"}).insertBefore(this.a);var c=a("<div>",{"class":"selected-flag"});c.appendTo(this.k),this.l=a("<div>",{"class":"iti-flag"}).appendTo(c),this.b.separateDialCode&&(this.t=a("<div>",{"class":"selected-dial-code"}).appendTo(c)),this.b.allowDropdown?(c.attr("tabindex","0"),a("<div>",{"class":"iti-arrow"}).appendTo(c),this.m=a("<ul>",{"class":"country-list hide"}),this.preferredCountries.length&&(this._g(this.preferredCountries,"preferred"),a("<li>",{"class":"divider"}).appendTo(this.m)),this._g(this.p,""),this.o=this.m.children(".country"),this.b.dropdownContainer?this.dropdown=a("<div>",{"class":"intl-tel-input iti-container"}).append(this.m):this.m.appendTo(this.k)):this.o=a(),this.b.hiddenInput&&(this.hiddenInput=a("<input>",{type:"hidden",name:this.b.hiddenInput}).insertBefore(this.a))},_g:function(a,b){for(var c="",d=0;d<a.length;d++){var e=a[d];c+="<li class='country "+b+"' data-dial-code='"+e.dialCode+"' data-country-code='"+e.iso2+"'>",c+="<div class='flag-box'><div class='iti-flag "+e.iso2+"'></div></div>",c+="<span class='country-name'>"+e.name+"</span>",c+="<span class='dial-code'>+"+e.dialCode+"</span>",c+="</li>"}this.m.append(c)},_h:function(){var a=this.a.val();
115this._af(a)&&(!this._isRegionlessNanp(a)||this.b.nationalMode&&!this.b.initialCountry)?this._v(a):"auto"!==this.b.initialCountry&&(this.b.initialCountry?this._z(this.b.initialCountry.toLowerCase()):(this.j=this.preferredCountries.length?this.preferredCountries[0].iso2:this.p[0].iso2,a||this._z(this.j)),a||this.b.nationalMode||this.b.autoHideDialCode||this.b.separateDialCode||this.a.val("+"+this.s.dialCode)),a&&this._u(a)},_i:function(){this._j(),this.b.autoHideDialCode&&this._l(),this.b.allowDropdown&&this._i1(),this.hiddenInput&&this._initHiddenInputListener()},_initHiddenInputListener:function(){var a=this,b=this.a.closest("form");b.length&&b.submit(function(){a.hiddenInput.val(a.getNumber())})},_i1:function(){var a=this,b=this.a.closest("label");b.length&&b.on("click"+this.ns,function(b){a.m.hasClass("hide")?a.a.focus():b.preventDefault()}),this.l.parent().on("click"+this.ns,function(b){!a.m.hasClass("hide")||a.a.prop("disabled")||a.a.prop("readonly")||a._n()}),this.k.on("keydown"+a.ns,function(b){!a.m.hasClass("hide")||b.which!=i.b&&b.which!=i.c&&b.which!=i.j&&b.which!=i.d||(b.preventDefault(),b.stopPropagation(),a._n()),b.which==i.k&&a._ac()})},_i2:function(){var c=this;this.b.utilsScript?a.fn[f].windowLoaded?a.fn[f].loadUtils(this.b.utilsScript,this.i):a(b).on("load",function(){a.fn[f].loadUtils(c.b.utilsScript,c.i)}):this.i.resolve(),"auto"===this.b.initialCountry?this._i3():this.h.resolve()},_i3:function(){a.fn[f].autoCountry?this.handleAutoCountry():a.fn[f].startedLoadingAutoCountry||(a.fn[f].startedLoadingAutoCountry=!0,"function"==typeof this.b.geoIpLookup&&this.b.geoIpLookup(function(b){a.fn[f].autoCountry=b.toLowerCase(),setTimeout(function(){a(".intl-tel-input input").intlTelInput("handleAutoCountry")})}))},_j:function(){var a=this;this.a.on("keyup"+this.ns,function(){a._v(a.a.val())&&a._triggerCountryChange()}),this.a.on("cut"+this.ns+" paste"+this.ns,function(){setTimeout(function(){a._v(a.a.val())&&a._triggerCountryChange()})})},_j2:function(a){var b=this.a.attr("maxlength");return b&&a.length>b?a.substr(0,b):a},_l:function(){var b=this;this.a.on("mousedown"+this.ns,function(a){b.a.is(":focus")||b.a.val()||(a.preventDefault(),b.a.focus())}),this.a.on("focus"+this.ns,function(a){b.a.val()||b.a.prop("readonly")||!b.s.dialCode||(b.a.val("+"+b.s.dialCode),b.a.one("keypress.plus"+b.ns,function(a){a.which==i.f&&b.a.val("")}),setTimeout(function(){var a=b.a[0];if(b.d){var c=b.a.val().length;a.setSelectionRange(c,c)}}))});var c=this.a.prop("form");c&&a(c).on("submit"+this.ns,function(){b._removeEmptyDialCode()}),this.a.on("blur"+this.ns,function(){b._removeEmptyDialCode()})},_removeEmptyDialCode:function(){var a=this.a.val();if("+"==a.charAt(0)){var b=this._m(a);b&&this.s.dialCode!=b||this.a.val("")}this.a.off("keypress.plus"+this.ns)},_m:function(a){return a.replace(/\D/g,"")},_n:function(){this._o();var a=this.m.children(".active");a.length&&(this._x(a),this._ad(a)),this._p(),this.l.children(".iti-arrow").addClass("up"),this.a.trigger("open:countrydropdown")},_o:function(){var c=this;if(this.b.dropdownContainer&&this.dropdown.appendTo(this.b.dropdownContainer),this.n=this.m.removeClass("hide").outerHeight(),!this.g){var d=this.a.offset(),e=d.top,f=a(b).scrollTop(),g=e+this.a.outerHeight()+this.n<f+a(b).height(),h=e-this.n>f;if(this.m.toggleClass("dropup",!g&&h),this.b.dropdownContainer){var i=!g&&h?0:this.a.innerHeight();this.dropdown.css({top:e+i,left:d.left}),a(b).on("scroll"+this.ns,function(){c._ac()})}}},_p:function(){var b=this;this.m.on("mouseover"+this.ns,".country",function(c){b._x(a(this))}),this.m.on("click"+this.ns,".country",function(c){b._ab(a(this))});var d=!0;a("html").on("click"+this.ns,function(a){d||b._ac(),d=!1});var e="",f=null;a(c).on("keydown"+this.ns,function(a){a.preventDefault(),a.which==i.b||a.which==i.c?b._q(a.which):a.which==i.d?b._r():a.which==i.e?b._ac():(a.which>=i.A&&a.which<=i.Z||a.which==i.j)&&(f&&clearTimeout(f),e+=String.fromCharCode(a.which),b._s(e),f=setTimeout(function(){e=""},1e3))})},_q:function(a){var b=this.m.children(".highlight").first(),c=a==i.b?b.prev():b.next();c.length&&(c.hasClass("divider")&&(c=a==i.b?c.prev():c.next()),this._x(c),this._ad(c))},_r:function(){var a=this.m.children(".highlight").first();
115a.length&&this._ab(a)},_s:function(a){for(var b=0;b<this.p.length;b++)if(this._t(this.p[b].name,a)){var c=this.m.children("[data-country-code="+this.p[b].iso2+"]").not(".preferred");this._x(c),this._ad(c,!0);break}},_t:function(a,b){return a.substr(0,b.length).toUpperCase()==b},_u:function(a){if(this.b.formatOnDisplay&&b.intlTelInputUtils&&this.s){var c=this.b.separateDialCode||!this.b.nationalMode&&"+"==a.charAt(0)?intlTelInputUtils.numberFormat.INTERNATIONAL:intlTelInputUtils.numberFormat.NATIONAL;a=intlTelInputUtils.formatNumber(a,this.s.iso2,c)}a=this._ah(a),this.a.val(a)},_v:function(b){b&&this.b.nationalMode&&"1"==this.s.dialCode&&"+"!=b.charAt(0)&&("1"!=b.charAt(0)&&(b="1"+b),b="+"+b);var c=this._af(b),d=null,e=this._m(b);if(c){var f=this.q[this._m(c)],g=a.inArray(this.s.iso2,f)>-1,h="+1"==c&&e.length>=4;if((!("1"==this.s.dialCode)||!this._isRegionlessNanp(e))&&(!g||h))for(var i=0;i<f.length;i++)if(f[i]){d=f[i];break}}else"+"==b.charAt(0)&&e.length?d="":b&&"+"!=b||(d=this.j);return null!==d&&this._z(d)},_isRegionlessNanp:function(b){var c=this._m(b);if("1"==c.charAt(0)){var d=c.substr(1,3);return a.inArray(d,j)>-1}return!1},_x:function(a){this.o.removeClass("highlight"),a.addClass("highlight")},_y:function(a,b,c){for(var d=b?k:this.p,e=0;e<d.length;e++)if(d[e].iso2==a)return d[e];if(c)return null;throw new Error("No country data for '"+a+"'")},_z:function(a){var b=this.s.iso2?this.s:{};this.s=a?this._y(a,!1,!1):{},this.s.iso2&&(this.j=this.s.iso2),this.l.attr("class","iti-flag "+a);var c=a?this.s.name+": +"+this.s.dialCode:"Unknown";if(this.l.parent().attr("title",c),this.b.separateDialCode){var d=this.s.dialCode?"+"+this.s.dialCode:"",e=this.a.parent();b.dialCode&&e.removeClass("iti-sdc-"+(b.dialCode.length+1)),d&&e.addClass("iti-sdc-"+d.length),this.t.text(d)}return this._aa(),this.o.removeClass("active"),a&&this.o.find(".iti-flag."+a).first().closest(".country").addClass("active"),b.iso2!==a},_aa:function(){var a="aggressive"===this.b.autoPlaceholder||!this.e&&(this.b.autoPlaceholder===!0||"polite"===this.b.autoPlaceholder);if(b.intlTelInputUtils&&a){var c=intlTelInputUtils.numberType[this.b.placeholderNumberType],d=this.s.iso2?intlTelInputUtils.getExampleNumber(this.s.iso2,this.b.nationalMode,c):"";d=this._ah(d),"function"==typeof this.b.customPlaceholder&&(d=this.b.customPlaceholder(d,this.s)),this.a.attr("placeholder",d)}},_ab:function(a){var b=this._z(a.attr("data-country-code"));if(this._ac(),this._ae(a.attr("data-dial-code"),!0),this.a.focus(),this.d){var c=this.a.val().length;this.a[0].setSelectionRange(c,c)}b&&this._triggerCountryChange()},_ac:function(){this.m.addClass("hide"),this.l.children(".iti-arrow").removeClass("up"),a(c).off(this.ns),a("html").off(this.ns),this.m.off(this.ns),this.b.dropdownContainer&&(this.g||a(b).off("scroll"+this.ns),this.dropdown.detach()),this.a.trigger("close:countrydropdown")},_ad:function(a,b){var c=this.m,d=c.height(),e=c.offset().top,f=e+d,g=a.outerHeight(),h=a.offset().top,i=h+g,j=h-e+c.scrollTop(),k=d/2-g/2;if(h<e)b&&(j-=k),c.scrollTop(j);else if(i>f){b&&(j+=k);var l=d-g;c.scrollTop(j-l)}},_ae:function(a,b){var c,d=this.a.val();if(a="+"+a,"+"==d.charAt(0)){var e=this._af(d);c=e?d.replace(e,a):a}else{if(this.b.nationalMode||this.b.separateDialCode)return;if(d)c=a+d;else{if(!b&&this.b.autoHideDialCode)return;c=a}}this.a.val(c)},_af:function(b){var c="";if("+"==b.charAt(0))for(var d="",e=0;e<b.length;e++){var f=b.charAt(e);if(a.isNumeric(f)&&(d+=f,this.q[d]&&(c=b.substr(0,e+1)),4==d.length))break}return c},_ag:function(){var b,c=a.trim(this.a.val()),d=this.s.dialCode,e=this._m(c),f="1"==e.charAt(0)?e:"1"+e;return b=this.b.separateDialCode?"+"+d:"+"!=c.charAt(0)&&"1"!=c.charAt(0)&&d&&"1"==d.charAt(0)&&4==d.length&&d!=f.substr(0,4)?d.substr(1):"",b+c},_ah:function(a){if(this.b.separateDialCode){var b=this._af(a);if(b){null!==this.s.areaCodes&&(b="+"+this.s.dialCode);var c=" "===a[b.length]||"-"===a[b.length]?b.length+1:b.length;a=a.substr(c)}}return this._j2(a)},_triggerCountryChange:function(){this.a.trigger("countrychange",this.s)},handleAutoCountry:function(){"auto"===this.b.initialCountry&&(this.j=a.fn[f].autoCountry,this.a.val()||this.setCountry(this.j),this.h.resolve())},handleUtils:function(){b.intlTelInputUtils&&(this.a.val()&&this._u(this.a.val()),this._aa()),this.i.resolve()},destroy:function(){if(this.allowDropdown&&(this._ac(),this.l.parent().off(this.ns),this.a.closest("label").off(this.ns)),this.b.autoHideDialCode){var b=this.a.prop("form");b&&a(b).off(this.ns)}this.a.off(this.ns),this.a.parent().before(this.a).remove()},getExtension:function(){return b.intlTelInputUtils?intlTelInputUtils.getExtension(this._ag(),this.s.iso2):""},getNumber:function(a){return b.intlTelInputUtils?intlTelInputUtils.formatNumber(this._ag(),this.s.iso2,a):""},getNumberType:function(){return b.intlTelInputUtils?intlTelInputUtils.getNumberType(this._ag(),this.s.iso2):-99},getSelectedCountryData:function(){return this.s},getValidationError:function(){return b.intlTelInputUtils?intlTelInputUtils.getValidationError(this._ag(),this.s.iso2):-99},isValidNumber:function(){var c=a.trim(this._ag()),d=this.b.nationalMode?this.s.iso2:"";return b.intlTelInputUtils?intlTelInputUtils.isValidNumber(c,d):null},setCountry:function(a){a=a.toLowerCase(),this.l.hasClass(a)||(this._z(a),this._ae(this.s.dialCode,!1),this._triggerCountryChange())},setNumber:function(a){var b=this._v(a);this._u(a),b&&this._triggerCountryChange()},setPlaceholderNumberType:function(a){this.b.placeholderNumberType=a,this._aa()}},a.fn[f]=function(b){var c=arguments;if(b===d||"object"==typeof b){var g=[];return this.each(function(){if(!a.data(this,"plugin_"+f)){var c=new e(this,b),d=c._a();
115g.push(d[0]),g.push(d[1]),a.data(this,"plugin_"+f,c)}}),a.when.apply(null,g)}if("string"==typeof b&&"_"!==b[0]){var h;return this.each(function(){var d=a.data(this,"plugin_"+f);d instanceof e&&"function"==typeof d[b]&&(h=d[b].apply(d,Array.prototype.slice.call(c,1))),"destroy"===b&&a.data(this,"plugin_"+f,null)}),h!==d?h:this}},a.fn[f].getCountryData=function(){return k},a.fn[f].loadUtils=function(b,c){a.fn[f].loadedUtilsScript?c&&c.resolve():(a.fn[f].loadedUtilsScript=!0,a.ajax({type:"GET",url:b,complete:function(){a(".intl-tel-input input").intlTelInput("handleUtils")},dataType:"script",cache:!0}))},a.fn[f].defaults=h,a.fn[f].version="12.1.3";for(var k=[["Afghanistan (‫افغانستان‬‎)","af","93"],["Albania (Shqipëri)","al","355"],["Algeria (‫الجزائر‬‎)","dz","213"],["American Samoa","as","1684"],["Andorra","ad","376"],["Angola","ao","244"],["Anguilla","ai","1264"],["Antigua and Barbuda","ag","1268"],["Argentina","ar","54"],["Armenia (Հայաստան)","am","374"],["Aruba","aw","297"],["Australia","au","61",0],["Austria (Österreich)","at","43"],["Azerbaijan (Azərbaycan)","az","994"],["Bahamas","bs","1242"],["Bahrain (‫البحرين‬‎)","bh","973"],["Bangladesh (বাংলাদেশ)","bd","880"],["Barbados","bb","1246"],["Belarus (Беларусь)","by","375"],["Belgium (België)","be","32"],["Belize","bz","501"],["Benin (Bénin)","bj","229"],["Bermuda","bm","1441"],["Bhutan (འབྲུག)","bt","975"],["Bolivia","bo","591"],["Bosnia and Herzegovina (Босна и Херцеговина)","ba","387"],["Botswana","bw","267"],["Brazil (Brasil)","br","55"],["British Indian Ocean Territory","io","246"],["British Virgin Islands","vg","1284"],["Brunei","bn","673"],["Bulgaria (България)","bg","359"],["Burkina Faso","bf","226"],["Burundi (Uburundi)","bi","257"],["Cambodia (កម្ពុជា)","kh","855"],["Cameroon (Cameroun)","cm","237"],["Canada","ca","1",1,["204","226","236","249","250","289","306","343","365","387","403","416","418","431","437","438","450","506","514","519","548","579","581","587","604","613","639","647","672","705","709","742","778","780","782","807","819","825","867","873","902","905"]],["Cape Verde (Kabu Verdi)","cv","238"],["Caribbean Netherlands","bq","599",1],["Cayman Islands","ky","1345"],["Central African Republic (République centrafricaine)","cf","236"],["Chad (Tchad)","td","235"],["Chile","cl","56"],["China (中国)","cn","86"],["Christmas Island","cx","61",2],["Cocos (Keeling) Islands","cc","61",1],["Colombia","co","57"],["Comoros (‫جزر القمر‬‎)","km","269"],["Congo (DRC) (Jamhuri ya Kidemokrasia ya Kongo)","cd","243"],["Congo (Republic) (Congo-Brazzaville)","cg","242"],["Cook Islands","ck","682"],["Costa Rica","cr","506"],["Côte d’Ivoire","ci","225"],["Croatia (Hrvatska)","hr","385"],["Cuba","cu","53"],["Curaçao","cw","599",0],["Cyprus (Κύπρος)","cy","357"],["Czech Republic (Česká republika)","cz","420"],["Denmark (Danmark)","dk","45"],["Djibouti","dj","253"],["Dominica","dm","1767"],["Dominican Republic (República Dominicana)","do","1",2,["809","829","849"]],["Ecuador","ec","593"],["Egypt (‫مصر‬‎)","eg","20"],["El Salvador","sv","503"],["Equatorial Guinea (Guinea Ecuatorial)","gq","240"],["Eritrea","er","291"],["Estonia (Eesti)","ee","372"],["Ethiopia","et","251"],["Falkland Islands (Islas Malvinas)","fk","500"],["Faroe Islands (Føroyar)","fo","298"],["Fiji","fj","679"],["Finland (Suomi)","fi","358",0],["France","fr","33"],["French Guiana (Guyane française)","gf","594"],["French Polynesia (Polynésie française)","pf","689"],["Gabon","ga","241"],["Gambia","gm","220"],["Georgia (საქართველო)","ge","995"],["Germany (Deutschland)","de","49"],["Ghana (Gaana)","gh","233"],["Gibraltar","gi","350"],["Greece (Ελλάδα)","gr","30"],["Greenland (Kalaallit Nunaat)","gl","299"],["Grenada","gd","1473"],["Guadeloupe","gp","590",0],["Guam","gu","1671"],["Guatemala","gt","502"],["Guernsey","gg","44",1],["Guinea (Guinée)","gn","224"],["Guinea-Bissau (Guiné Bissau)","gw","245"],["Guyana","gy","592"],["Haiti","ht","509"],["Honduras","hn","504"],["Hong Kong (香港)","hk","852"],["Hungary (Magyarország)","hu","36"],["Iceland (Ísland)","is","354"],["India (भारत)","in","91"],["Indonesia","id","62"],["Iran (‫ایران‬‎)","ir","98"],["Iraq (‫العراق‬‎)","iq","964"],["Ireland","ie","353"],["Isle of Man","im","44",2],["Israel (‫ישראל‬‎)","il","972"],["Italy (Italia)","it","39",0],["Jamaica","jm","1876"],["Japan (日本)","jp","81"],["Jersey","je","44",3],["Jordan (‫الأردن‬‎)","jo","962"],["Kazakhstan (Казахстан)","kz","7",1],["Kenya","ke","254"],["Kiribati","ki","686"],["Kosovo","xk","383"],["Kuwait (‫الكويت‬‎)","kw","965"],["Kyrgyzstan (Кырг
115ызстан)","kg","996"],["Laos (ລາວ)","la","856"],["Latvia (Latvija)","lv","371"],["Lebanon (‫لبنان‬‎)","lb","961"],["Lesotho","ls","266"],["Liberia","lr","231"],["Libya (‫ليبيا‬‎)","ly","218"],["Liechtenstein","li","423"],["Lithuania (Lietuva)","lt","370"],["Luxembourg","lu","352"],["Macau (澳門)","mo","853"],["Macedonia (FYROM) (Македонија)","mk","389"],["Madagascar (Madagasikara)","mg","261"],["Malawi","mw","265"],["Malaysia","my","60"],["Maldives","mv","960"],["Mali","ml","223"],["Malta","mt","356"],["Marshall Islands","mh","692"],["Martinique","mq","596"],["Mauritania (‫موريتانيا‬‎)","mr","222"],["Mauritius (Moris)","mu","230"],["Mayotte","yt","262",1],["Mexico (México)","mx","52"],["Micronesia","fm","691"],["Moldova (Republica Moldova)","md","373"],["Monaco","mc","377"],["Mongolia (Монгол)","mn","976"],["Montenegro (Crna Gora)","me","382"],["Montserrat","ms","1664"],["Morocco (‫المغرب‬‎)","ma","212",0],["Mozambique (Moçambique)","mz","258"],["Myanmar (Burma) (မြန်မာ)","mm","95"],["Namibia (Namibië)","na","264"],["Nauru","nr","674"],["Nepal (नेपाल)","np","977"],["Netherlands (Nederland)","nl","31"],["New Caledonia (Nouvelle-Calédonie)","nc","687"],["New Zealand","nz","64"],["Nicaragua","ni","505"],["Niger (Nijar)","ne","227"],["Nigeria","ng","234"],["Niue","nu","683"],["Norfolk Island","nf","672"],["North Korea (조선 민주주의 인민 공화국)","kp","850"],["Northern Mariana Islands","mp","1670"],["Norway (Norge)","no","47",0],["Oman (‫عُمان‬‎)","om","968"],["Pakistan (‫پاکستان‬‎)","pk","92"],["Palau","pw","680"],["Palestine (‫فلسطين‬‎)","ps","970"],["Panama (Panamá)","pa","507"],["Papua New Guinea","pg","675"],["Paraguay","py","595"],["Peru (Perú)","pe","51"],["Philippines","ph","63"],["Poland (Polska)","pl","48"],["Portugal","pt","351"],["Puerto Rico","pr","1",3,["787","939"]],["Qatar (‫قطر‬‎)","qa","974"],["Réunion (La Réunion)","re","262",0],["Romania (România)","ro","40"],["Russia (Россия)","ru","7",0],["Rwanda","rw","250"],["Saint Barthélemy","bl","590",1],["Saint Helena","sh","290"],["Saint Kitts and Nevis","kn","1869"],["Saint Lucia","lc","1758"],["Saint Martin (Saint-Martin (partie française))","mf","590",2],["Saint Pierre and Miquelon (Saint-Pierre-et-Miquelon)","pm","508"],["Saint Vincent and the Grenadines","vc","1784"],["Samoa","ws","685"],["San Marino","sm","378"],["São Tomé and Príncipe (São Tomé e Príncipe)","st","239"],["Saudi Arabia (‫المملكة العربية السعودية‬‎)","sa","966"],["Senegal (Sénégal)","sn","221"],["Serbia (Србија)","rs","381"],["Seychelles","sc","248"],["Sierra Leone","sl","232"],["Singapore","sg","65"],["Sint Maarten","sx","1721"],["Slovakia (Slovensko)","sk","421"],["Slovenia (Slovenija)","si","386"],["Solomon Islands","sb","677"],["Somalia (Soomaaliya)","so","252"],["South Africa","za","27"],["South Korea (대한민국)","kr","82"],["South Sudan (‫جنوب السودان‬‎)","ss","211"],["Spain (España)","es","34"],["Sri Lanka (ශ්‍රී ලංකාව)","lk","94"],["Sudan (‫السودان‬‎)","sd","249"],["Suriname","sr","597"],["Svalbard and Jan Mayen","sj","47",1],["Swaziland","sz","268"],["Sweden (Sverige)","se","46"],["Switzerland (Schweiz)","ch","41"],["Syria (‫سوريا‬‎)","sy","963"],["Taiwan (台灣)","tw","886"],["Tajikistan","tj","992"],["Tanzania","tz","255"],["Thailand (ไทย)","th","66"],["Timor-Leste","tl","670"],["Togo","tg","228"],["Tokelau","tk","690"],["Tonga","to","676"],["Trinidad and Tobago","tt","1868"],["Tunisia (‫تونس‬‎)","tn","216"],["Turkey (Türkiye)","tr","90"],["Turkmenistan","tm","993"],["Turks and Caicos Islands","tc","1649"],["Tuvalu","tv","688"],["U.S. Virgin Islands","vi","1340"],["Uganda","ug","256"],["Ukraine (Україна)","ua","38"],["United Arab Emirates (‫الإمارات العربية المتحدة‬‎)","ae","971"],["United Kingdom","gb","44",0],["United States","us","1",0],["Uruguay","uy","598"],["Uzbekistan (Oʻzbekiston)","uz","998"],["Vanuatu","vu","678"],["Vatican City (Città del Vaticano)","va","39",1],["Venezuela","ve","58"],["Vietnam (Việt Nam)","vn","84"],["Wallis and Futuna (Wallis-et-Futuna)","wf","681"],["Western Sahara (‫الصحراء الغربية‬‎)","eh","212",1],["Yemen (‫اليمن‬‎)","ye","967"],["Zambia","zm","260"],["Zimbabwe","zw","263"],["Åland Islands","ax","358",1]],l=0;l<k.length;l++){var m=k[l];k[l]={name:m[0],iso2:m[1],dialCode:m[2],priority:m[3]||0,areaCodes:m[4]||null}}});
116;
117/* beautify preserve:end */
118
119let submitList = document.querySelectorAll('.submit-js');
120const SEND_URL = '/wp-admin/admin-ajax.php';
121const ACTION_APPLICATION = 'application';
122
123
124
125/** Маска телефонного номера */
126$.mask.definitions['#'] = '[0-9]';
127$.mask.definitions['9'] = '';
128$('input[name=telephone]').mask("+(38) ### ###-##-##", {
129    placeholder: "_"
130});
131submitList.forEach(el => {
132    el.addEventListener('click', function(evt) {
133        evt.preventDefault();
134        evt.stopPropagation();
135        // console.log(submitList);
136        let status = checkRequiredFields(el.closest('form'));
137        if (typeof status === 'object') {
138            send(status, SEND_URL, el.closest('form'));
139        }
140
141        //console.log(el.closest('form'));
142    });
143});
144
145function checkRequiredFields(form) {
146    const inputs = form.querySelectorAll('input');
147    let sendObject = {};
148    sendObject.form_name = form.dataset.name || '';
149    sendObject.metka = window.location.href || '';
150    inputs.forEach(input => {
151        let inputGroup = input.closest('.input-group');
152        if (input.dataset.required === 'true' && input.value.length === 0) {
153            inputGroup.classList.add('unfilled')
154        } else {
155            inputGroup.classList.remove('unfilled');
156        }
157        sendObject[input.name] = input.value;
158        getDateFromInput(input, sendObject);
159    });
160
161    if (form.querySelector('.unfilled') === null) {
162        return sendObject;
163    } else {
164        return false;
165    }
166    // //console.log(form.querySelector('.unfilled'));
167
168};
169
170function getDateFromInput(input, sendObject) {
171    if (input.closest('.with-date-js') === null || !input.closest('.with-date-js').querySelector('input[type=radio]').checked) return;
172    if (input.closest('.with-date-js')) sendObject[input.name] = 'off';
173    sendObject.call_date = input.closest('.with-date-js').querySelector('input.datetimepicker ').value;
174
175}
176
177function send(object, url, form) {
178    let data = new FormData();
179    // form.querySelector('button[type="submit"]').setAttribute('disabled', '');
180    for (const key in object) {
181        data.append(key, object[key]);
182    }
183
184    data.append('action', ACTION_APPLICATION);
185    console.log(data);
186    $(form).find('button[type=submit]').attr('disabled','disabled');
187    fetch(url, {
188        method: 'POST',
189        body: data,
190        action: ACTION_APPLICATION,
191    }).catch(res => {
192        sendMessageStatus(form, 'Помилка відправки');
193        //console.log(data);
194    }).then(res => {
195        return res.text();
196    }).then(res => {
197        // console.log(res);
198        if (res.match(/done/)) {
199            sendMessageStatus(form, 'Ваше повідомлення відправлено');
200            resetForm(form);
201            sendFormDataLayerPush();
202            setTimeout(() => {
203                form.querySelector('button[type=submit]').removeAttribute('disabled');
204                $.magnificPopup.close();
205                location.replace('/message/')
206            }, 2000);
207        } else {
208            sendMessageStatus(form, 'Помилка відправки');
209            setTimeout(() => {
210                form.querySelector('button[type=submit]').removeAttribute('disabled');
211            }, 2000);
212        }
213    })
214};
215
216function resetForm(form) {
217    form.querySelectorAll('input[type=text]').forEach(input => {
218        input.value = ``;
219    });
220    form.querySelectorAll('input[type=radio]').forEach(input => {
221        input.checked = false;
222    });
223
224}
225
226function sendMessageStatus(form, status) {
227    let element = document.createElement('span');
228    element.style.cssText = `animation: fadeInLeft 1s 1 ease-in-out ; 
229            color:#fff; position:absolute; 
230            padding:10px 20px; 
231            background:var(--blue);
232            left:50%;
233            top:10%;
234            text-align:center;
235            font-size:24px; 
236            transform:translateX(-50%) `;
237    element.innerHTML = status;
238    element.classList.add('send-message');
239    form.append(element);
240    setTimeout(() => {
241        form.querySelector('.send-message').style.animation = 'fadeOutRight 1s 1 ease-in';
242        form.querySelector('.send-message').addEventListener('animationend', function(evt) {
243            form.querySelector('.send-message').remove();
244            // form.querySelector('.send-message').style.opacity = `0`;
245        });
246    }, 3000);
247
248
249}
250/*Form handler END */
251/**ДЛя аналитики */
252
253/**Добавление при успешной отправке формы */
254function sendFormDataLayerPush() {
255    if (/\/flat\//.test(window.location.href)) {
256        dataLayer.push({ 'event': 'request_plan' });
257    } else {
258        dataLayer.push({ 'event': 'request' });
259    }
260}
261
262document.querySelectorAll('.call-form-js').forEach(el => {
263    el.addEventListener('click', function(evt) {
264        dataLayer.push({ 'event': 'call' });
265    });
266})
267document.querySelectorAll('a[href*="tel:"').forEach(el => {
268    el.addEventListener('click', function(evt) {
269        dataLayer.push({ 'event': 'phone' });
270    });
271})
272$(window).scroll(function(){
273    var position = $(window).scrollTop();
274    var begin=35;
275    var bloc=$('.header');
276    if(position>begin){
277        bloc.addClass('dopstyle_header');
278    }else{
279        bloc.removeClass('dopstyle_header');
280    }
281});
282$('.menu-button').click(function(){
283    $('.lang-block').addClass('active');
284});
285$('.close-button').click(function(){
286    $('.lang-block').removeClass('active');
287});
288
289
290
291$.fn.scrollbox = function(config) {
292    //default config
293    var defConfig = {
294        linear: false,          // Scroll method
295        startDelay: 2,          // Start delay (in seconds)
296        delay: 3,               // Delay after each scroll event (in seconds)
297        step: 5,                // Distance of each single step (in pixels)
298        speed: 32,              // Delay after each single step (in milliseconds)
299        switchItems: 1,         // Items to switch after each scroll event
300        direction: 'vertical',
301        distance: 'auto',
302        autoPlay: true,
303        onMouseOverPause: true,
304        paused: false,
305        queue: null,
306        listElement: 'ul',
307        listItemElement:'li',
308        infiniteLoop: true,     // Infinite loop or not
309        switchAmount: 0,        // Give a number if you don't want to have infinite loop
310        afterForward: null,     // Callback function after each forward action
311        afterBackward: null,    // Callback function after each backward action
312        triggerStackable: false // Allow triggers when action is not finish yet
313    };
314    config = $.extend(defConfig, config);
315    config.scrollOffset = config.direction === 'vertical' ? 'scrollTop' : 'scrollLeft';
316    if (config.queue) {
317        config.queue = $('#' + config.queue);
318    }
319
320    return this.each(function() {
321        var container = $(this),
322            containerUL,
323            scrollingId = null,
324            nextScrollId = null,
325            paused = false,
326            releaseStack,
327            backward,
328            forward,
329            resetClock,
330            scrollForward,
331            scrollBackward,
332            forwardHover,
333            pauseHover,
334            switchCount = 0,
335            stackedTriggerIndex = 0;
336
337        if (config.onMouseOverPause) {
338            container.bind('mouseover', function() { paused = true; });
339            container.bind('mouseout', function() { paused = false; });
340        }
341        containerUL = container.children(config.listElement + ':first-child');
342
343        // init default switchAmount
344        if (config.infiniteLoop === false && config.switchAmount === 0) {
345            config.switchAmount = containerUL.children().length;
346        }
347
348        scrollForward = function() {
349            if (paused) {
350                return;
351            }
352            var curLi,
353                i,
354                newScrollOffset,
355                scrollDistance,
356                theStep;
357
358            curLi = containerUL.children(config.listItemElement + ':first-child');
359
360            scrollDistance = config.distance !== 'auto' ? config.distance :
361                config.direction === 'vertical' ? curLi.outerHeight(true) : curLi.outerWidth(true);
362
363            // offset
364            if (!config.linear) {
365                theStep = Math.max(3, parseInt((scrollDistance - container[0][config.scrollOffset]) * 0.3, 10));
366                newScrollOffset = Math.min(container[0][config.scrollOffset] + theStep, scrollDistance);
367            } else {
368                newScrollOffset = Math.min(container[0][config.scrollOffset] + config.step, scrollDistance);
369            }
370            container[0][config.scrollOffset] = newScrollOffset;
371
372            if (newScrollOffset >= scrollDistance) {
373                for (i = 0; i < config.switchItems; i++) {
374                    if (config.queue && config.queue.find(config.listItemElement).length > 0) {
375                        containerUL.append(config.queue.find(config.listItemElement)[0]);
376                        containerUL.children(config.listItemElement + ':first-child').remove();
377                    } else {
378                        containerUL.append(containerUL.children(config.listItemElement + ':first-child'));
379                    }
380                    ++switchCount;
381                }
382                container[0][config.scrollOffset] = 0;
383                clearInterval(scrollingId);
384                scrollingId = null;
385
386                if ($.isFunction(config.afterForward)) {
387                    config.afterForward.call(container, {
388                        switchCount: switchCount,
389                        currentFirstChild: containerUL.children(config.listItemElement + ':first-child')
390                    });
391                }
392                if (config.triggerStackable && stackedTriggerIndex !== 0) {
393                    releaseStack();
394                    return;
395                }
396                if (config.infiniteLoop === false && switchCount >= config.switchAmount) {
397                    return;
398                }
399                if (config.autoPlay) {
400                    nextScrollId = setTimeout(forward, config.delay * 1000);
401                }
402            }
403        };
404
405        // Backward
406        // 1. If forwarding, then reverse
407        // 2. If stoping, then backward once
408        scrollBackward = function() {
409            if (paused) {
410                return;
411            }
412            var curLi,
413                i,
414                newScrollOffset,
415                scrollDistance,
416                theStep;
417
418            // init
419            if (container[0][config.scrollOffset] === 0) {
420                for (i = 0; i < config.switchItems; i++) {
421                    containerUL.children(config.listItemElement + ':last-child').insertBefore(containerUL.children(config.listItemElement+':first-child'));
422                }
423
424                curLi = containerUL.children(config.listItemElement + ':first-child');
425                scrollDistance = config.distance !== 'auto' ?
426                    config.distance :
427                    config.direction === 'vertical' ? curLi.height() : curLi.width();
428                container[0][config.scrollOffset] = scrollDistance;
429            }
430
431            // new offset
432            if (!config.linear) {
433                theStep = Math.max(3, parseInt(container[0][config.scrollOffset] * 0.3, 10));
434                newScrollOffset = Math.max(container[0][config.scrollOffset] - theStep, 0);
435            } else {
436                newScrollOffset = Math.max(container[0][config.scrollOffset] - config.step, 0);
437            }
438            container[0][config.scrollOffset] = newScrollOffset;
439
440            if (newScrollOffset === 0) {
441                --switchCount;
442                clearInterval(scrollingId);
443                scrollingId = null;
444
445                if ($.isFunction(config.afterBackward)) {
446                    config.afterBackward.call(container, {
447                        switchCount: switchCount,
448                        currentFirstChild: containerUL.children(config.listItemElement + ':first-child')
449                    });
450                }
451                if (config.triggerStackable && stackedTriggerIndex !== 0) {
452                    releaseStack();
453                    return;
454                }
455                if (config.autoPlay) {
456                    nextScrollId = setTimeout(forward, config.delay * 1000);
457                }
458            }
459        };
460
461        releaseStack = function () {
462            if (stackedTriggerIndex === 0) {
463                return;
464            }
465            if (stackedTriggerIndex > 0) {
466                stackedTriggerIndex--;
467                nextScrollId = setTimeout(forward, 0);
468            } else {
469                stackedTriggerIndex++;
470                nextScrollId = setTimeout(backward, 0);
471            }
472        };
473
474        forward = function() {
475            clearInterval(scrollingId);
476            scrollingId = setInterval(scrollForward, config.speed);
477        };
478
479        backward = function() {
480            clearInterval(scrollingId);
481            scrollingId = setInterval(scrollBackward, config.speed);
482        };
483
484        // Implements mouseover function.
485        forwardHover = function() {
486            config.autoPlay = true;
487            paused = false;
488            clearInterval(scrollingId);
489            scrollingId = setInterval(scrollForward, config.speed);
490        };
491        pauseHover = function() {
492            paused = true;
493        };
494
495        resetClock = function(delay) {
496            config.delay = delay || config.delay;
497            clearTimeout(nextScrollId);
498            if (config.autoPlay) {
499                nextScrollId = setTimeout(forward, config.delay * 1000);
500            }
501        };
502
503        if (config.autoPlay) {
504            nextScrollId = setTimeout(forward, config.startDelay * 1000);
505        }
506
507        // bind events for container
508        container.bind('resetClock', function(delay) { resetClock(delay); });
509        container.bind('forward', function() {
510            if (config.triggerStackable) {
511                if (scrollingId !== null) {
512                    stackedTriggerIndex++;
513                } else {
514                    forward();
515                }
516            } else {
517                clearTimeout(nextScrollId);
518                forward();
519            }
520        });
521        container.bind('backward', function() {
522            if (config.triggerStackable) {
523                if (scrollingId !== null) {
524                    stackedTriggerIndex--;
525                } else {
526                    backward();
527                }
528            } else {
529                clearTimeout(nextScrollId);
530                backward();
531            }
532        });
533        container.bind('pauseHover', function() { pauseHover(); });
534        container.bind('forwardHover', function() { forwardHover(); });
535        container.bind('speedUp', function(event, speed) {
536            if (speed === 'undefined') {
537                speed = Math.max(1, parseInt(config.speed / 2, 10));
538            }
539            config.speed = speed;
540        });
541
542        container.bind('speedDown', function(event, speed) {
543            if (speed === 'undefined') {
544                speed = config.speed * 2;
545            }
546            config.speed = speed;
547        });
548
549        container.bind('updateConfig', function (event, options) {
550            config = $.extend(config, options);
551        });
552
553    });
554};
555
556
557$('#scroll-menu').scrollbox({
558    direction: 'h',
559    scrolling_items: 1,
560    autoPlay: false,
561    easing: "linear",
562    circular: "yes",
563});
564$('#backward').click(function () {
565    $('#scroll-menu').trigger('backward');
566});
567$('#forward').click(function () {
568    $('#scroll-menu').trigger('forward');
569});

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.