PageSourceSearch

https://awardsradar.com/_static/??-eJydjs0KwjAQhF/IuBHU4kF8lk1YatL…zdFKmBcNI1siEE7KMkt3Kav+Lx0D91pfb3fVtLVdxM=

js awardsradar.com collected 2026-10-02 06:27:07 UTC 122,565 bytes, 2,122 lines download raw bytes

1(function ($) {
2    // String.prototype.stripSlashes = function () {
3    //     return this.replace(/\\(.)/mg, "$1");
4    // }
5    function stripSlashes(str) {
6        return str.replace(/\\(.)/mg, "$1");
7    }
8    $.fn.serializeFormJSON = function () {
9        var o = {},
10            a = this.serializeArray();
11        $.each(a, function () {
12            if (o[this.name]) {
13                if (!o[this.name].push) {
14                    o[this.name] = [o[this.name]];
15                }
16                o[this.name].push(this.value || '');
17            } else {
18                o[this.name] = this.value || '';
19            }
20        });
21        return o;
22    };
23
24    $.fn.goToPoll = function(enabelAnimation, scroll) {
25        var pollAnimationTop = (scroll && scroll != 0) ? parseInt(scroll) : 100;
26        
27        if( enabelAnimation ){
28            $('html, body').animate({
29                scrollTop: $(this).offset().top - scroll + 'px'
30            }, 'slow');
31        }
32        return this; // for chaining...
33    }
34
35    $.fn.aysModal = function(action){
36        var $this = $(this);
37        switch(action){
38            case 'hide':
39                $(this).find('.ays-poll-avatars-modal-content').css('animation-name', 'zoomOut');
40                setTimeout(function(){
41                    $(document.body).removeClass('modal-open');
42                    $(document).find('.ays-modal-backdrop').remove();
43                    $this.hide();
44                }, 250);
45                break;
46            case 'show':
47            default:
48                $this.show();
49                $(this).find('.ays-poll-avatars-modal-content').css('animation-name', 'zoomIn');
50                $(document).find('.modal-backdrop').remove();
51                $(document.body).append('<div class="ays-modal-backdrop"></div>');
52                $(document.body).addClass('modal-open');
53                break;
54        }
55    }
56
57    $(document).find(".ays-poll-main .apm-info-form").each(function(e){
58        var infoForm = $(this);
59        var mainContainer = infoForm.parents('.ays-poll-main');
60        var id = mainContainer.attr('id').match(/\d+$/)[0];
61        var pollBox = mainContainer.find('div[data-id="' + id + '"]');
62        var uniqueId = pollBox.attr('id');
63        var pollOptions = JSON.parse(window.atob(window.aysPollOptions[uniqueId]));
64    
65        if (pollOptions.autofill_user_data && pollOptions.autofill_user_data == "on") {
66            var userData = {};
67            userData.action = 'ays_poll_get_user_information';
68            userData._ajax_nonce = poll_maker_ajax_public.nonce;
69            $.ajax({
70                url: poll_maker_ajax_public.ajax_url,
71                method: 'post',
72                dataType: 'json',
73                data: userData,
74                success: function (response) {
75                    if(response !== null){
76                        infoForm.find("input[name='apm_name']").val(response.data.display_name);
77                        infoForm.find("input[name='apm_email']").val(response.data.user_email);
78                    }
79                }
80            });
81        }
82    })
83
84    function socialBtnAdd(formId, buttons) {
85        var socialDiv = $("<div class='apm-social-btn'></div>");
86        if(buttons.heading != ""){
87            socialDiv.append("<div class='ays-survey-social-shares-heading'>"+
88                                    buttons.heading
89                                +"</div>");
90        }
91        if(buttons.faceBook){
92            socialDiv.append("<a class='fb-share-button ays-share-btn ays-share-btn-branded ays-share-btn-facebook'"+
93                                        "title='Share on Facebook'>"+
94                                        "<span class='ays-share-btn-text'>Facebook</span>"+
95                                    "</a>");
96        }
97        if(buttons.twitter){
98            socialDiv.append("<a class='twt-share-button ays-share-btn ays-share-btn-branded ays-share-btn-twitter'"+
99                                    "title='Share on Twitter'>"+
100                                    "<span class='ays-share-btn-text'>Twitter</span>"+
101                                "</a>");
102        }
103        if(buttons.linkedIn){
104            socialDiv.append("<a class='linkedin-share-button ays-share-btn ays-share-btn-branded ays-share-btn-l
104inkedin'"+
105                                    "title='Share on LinkedIn'>"+
106                                    "<span class='ays-share-btn-text'>LinkedIn</span>"+
107                                "</a>");
108        }
109        if(buttons.vkontakte){
110            socialDiv.append("<a class='vkontakte-share-button ays-share-btn ays-share-btn-branded ays-share-btn-vkontakte'"+
111                                    "title='Share on VKontakte'>"+
112                                    "<span class='ays-survey-share-btn-icon'></span>"+
113                                    "<span class='ays-share-btn-text'>VKontakte</span>"+
114                                "</a>");
115        }
116        $("#"+formId).append(socialDiv);
117        $(document).on('click', '.fb-share-button', function (e) {
118            window.open('https://www.facebook.com/sharer/sharer.php?u=' + window.location.href,
119                'facebook-share-dialog',
120                'width=650,height=450'
121            );
122            return false;
123        })
124        $(document).on('click', '.twt-share-button', function (e) {
125            window.open('https://twitter.com/intent/tweet?url=' + window.location.href,
126                'twitter-share-dialog',
127                'width=650,height=450'
128            );
129            return false;
130        })
131        $(document).on('click', '.linkedin-share-button', function (e) {
132            window.open('https://www.linkedin.com/shareArticle?mini=true&url=' + window.location.href,
133                'linkedin-share-dialog',
134                'width=650,height=450'
135            );
136            return false;
137        })
138        $(document).on('click', '.vkontakte-share-button', function (e) {
139            window.open('https://vk.com/share.php?url=' + window.location.href,
140                'vkontakte-share-dialog',
141                'width=650,height=450'
142            );
143            return false;
144        })
145        setTimeout(function() {
146            $("#"+formId+" .apm-social-btn").css('opacity', '1');
147        }, 1000);
148    }
149
150    function socialLinksAdd(formId, buttons) {
151        var socialLinksDiv = $("<div class='apm-social-btn'></div>");
152        if(buttons.heading != ""){
153            socialLinksDiv.append("<div class='ays-survey-social-shares-heading'>"+
154                                    buttons.heading
155                                +"</div>");
156        }
157        if(buttons.faceBookLink != ''){
158            socialLinksDiv.append("<a class='ays-share-btn ays-share-btn-branded ays-share-btn-facebook'"+
159                                        "title='Facebook Link'  target='_blank' href=" + buttons.faceBookLink + ">"+
160                                        "<div class='ays-poll-link-icon'><?xml version='1.0'?><svg fill='#fff' xmlns='http://www.w3.org/2000/svg'  viewBox='0 0 24 24' width='48px' height='48px'><path d='M19,3H5C3.895,3,3,3.895,3,5v14c0,1.105,0.895,2,2,2h7.621v-6.961h-2.343v-2.725h2.343V9.309 c0-2.324,1.421-3.591,3.495-3.591c0.699-0.002,1.397,0.034,2.092,0.105v2.43h-1.428c-1.13,0-1.35,0.534-1.35,1.322v1.735h2.7 l-0.351,2.725h-2.365V21H19c1.105,0,2-0.895,2-2V5C21,3.895,20.105,3,19,3z'/></svg></div>"+
161                                    "</a>");
162        }
163        if(buttons.twitterLink != ''){
164            socialLinksDiv.append("<a class='ays-share-btn ays-share-btn-branded ays-share-btn-x'"+
165                                    "title='Twitter Link'  target='_blank' href=" + buttons.twitterLink + ">"+
166                                    "<div class='ays-poll-link-icon'><svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='48px' height='48px' fill='currentColor'><path d='M18.244 2H21.552L14.325 10.26L22.8 22H16.17L10.96 14.82L4.7 22H1.39L9.14 13.14L1 2H7.8L12.52 8.46L18.244 2ZM17.1 20H18.95L6.8 4H4.82L17.1 20Z'/></svg></div>"+
167                                "</a>");
168        }
169        if(buttons.linkedInLink != ''){
170            socialLinksDiv.append("<a class='ays-share-btn ays-share-btn-branded ays-share-btn-l
170inkedin'"+
171                                    "title='LinkedIn Link' target='_blank' href=" + buttons.linkedInLink + ">"+
172                                    "<div class='ays-poll-link-icon'><?xml version='1.0'?><svg fill='#fff' xmlns='http://www.w3.org/2000/svg'  viewBox='0 0 24 24' width='48px' height='48px'>    <path d='M21,3H3v18h18V3z M9,17H6.477v-7H9V17z M7.694,8.717c-0.771,0-1.286-0.514-1.286-1.2s0.514-1.2,1.371-1.2 c0.771,0,1.286,0.514,1.286,1.2S8.551,8.717,7.694,8.717z M18,17h-2.442v-3.826c0-1.058-0.651-1.302-0.895-1.302 s-1.058,0.163-1.058,1.302c0,0.163,0,3.826,0,3.826h-2.523v-7h2.523v0.977C13.93,10.407,14.581,10,15.802,10 C17.023,10,18,10.977,18,13.174V17z'/></svg></div>"+
173                                "</a>");
174        }
175        if(buttons.vkontakteLink != ''){
176            socialLinksDiv.append("<a class='ays-share-btn ays-share-btn-branded ays-share-btn-vkontakte'"+
177                                    "title='VKontakte Link'  target='_blank' href=" + buttons.vkontakteLink + ">"+
178                                    "<div class='ays-poll-link-icon'><svg fill='#fff' xmlns='http://www.w3.org/2000/svg'  viewBox='0 0 48 48' width='48px' height='48px'><path d='M45.763,35.202c-1.797-3.234-6.426-7.12-8.337-8.811c-0.523-0.463-0.579-1.264-0.103-1.776 c3.647-3.919,6.564-8.422,7.568-11.143C45.334,12.27,44.417,11,43.125,11l-3.753,0c-1.237,0-1.961,0.444-2.306,1.151 c-3.031,6.211-5.631,8.899-7.451,10.47c-1.019,0.88-2.608,0.151-2.608-1.188c0-2.58,0-5.915,0-8.28 c0-1.147-0.938-2.075-2.095-2.075L18.056,11c-0.863,0-1.356,0.977-0.838,1.662l1.132,1.625c0.426,0.563,0.656,1.248,0.656,1.951 L19,23.556c0,1.273-1.543,1.895-2.459,1.003c-3.099-3.018-5.788-9.181-6.756-12.128C9.505,11.578,8.706,11.002,7.8,11l-3.697-0.009 c-1.387,0-2.401,1.315-2.024,2.639c3.378,11.857,10.309,23.137,22.661,24.36c1.217,0.12,2.267-0.86,2.267-2.073l0-3.846 c0-1.103,0.865-2.051,1.977-2.079c0.039-0.001,0.078-0.001,0.117-0.001c3.267,0,6.926,4.755,8.206,6.979 c0.368,0.64,1.056,1.03,1.8,1.03l4.973,0C45.531,38,46.462,36.461,45.763,35.202z'/></svg></div>"+
179                                "</a>");
180        }
181        if(buttons.youtubeLink != ''){
182            socialLinksDiv.append("<a class='ays-share-btn ays-share-btn-branded ays-poll-share-btn-youtube'"+
183                                    "title='Youtube Link'  target='_blank' href=" + buttons.youtubeLink + ">"+
184                                    "<div class='ays-poll-link-icon'><svg xmlns='http://www.w3.org/2000/svg' fill='#FF0000' viewBox='0 0 28 28' width='48px' height='48px'>    <path d='M 15 4 C 10.814 4 5.3808594 5.0488281 5.3808594 5.0488281 L 5.3671875 5.0644531 C 3.4606632 5.3693645 2 7.0076245 2 9 L 2 15 L 2 15.001953 L 2 21 L 2 21.001953 A 4 4 0 0 0 5.3769531 24.945312 L 5.3808594 24.951172 C 5.3808594 24.951172 10.814 26.001953 15 26.001953 C 19.186 26.001953 24.619141 24.951172 24.619141 24.951172 L 24.621094 24.949219 A 4 4 0 0 0 28 21.001953 L 28 21 L 28 15.001953 L 28 15 L 28 9 A 4 4 0 0 0 24.623047 5.0546875 L 24.619141 5.0488281 C 24.619141 5.0488281 19.186 4 15 4 z M 12 10.398438 L 20 15 L 12 19.601562 L 12 10.398438 z'/></svg></div>"+
185                                "</a>");
186        }
187        if(buttons.tiktokLink != ''){
188            socialLinksDiv.append("<a class='ays-share-btn ays-share-btn-branded ays-poll-share-btn-tiktok'"+
189                                    "title='Tiktok Link'  target='_blank' href=" + buttons.tiktokLink + ">"+
190                                    "<div class='ays-poll-link-icon'><svg fill='none' viewBox='0 0 32 32' height='24px' width='24px' xmlns='http://www.w3.org/2000/svg'><path d='M8.45095 19.7926C8.60723 18.4987 9.1379 17.7743 10.1379 17.0317C11.5688 16.0259 13.3561 16.5948 13.3561 16.5948V13.2197C13.7907 13.2085 14.2254 13.2343 14.6551 13.2966V17.6401C14.6551 17.6401 12.8683 17.0712 11.4375 18.0775C10.438 18.8196 9.90623 19.5446 9.7505 20.8385C9.74562 21.5411 9.87747 22.4595 10.4847 23.2536C10.3345 23.1766 10.1815 23.0889 10.0256 22.9905C8.68807 22.0923 8.44444 20.7449 8.45095 19.7926ZM22.0352 6.97898C21.0509 5.90039 20.6786 4.81139 20.5441 4.04639H21.7823C21.7823 4.04639 21.5354 6.05224 23.3347 8.02482L23.3597 8.05134C22.8747 7.7463 22.43 7.38624 22.0352 6.97898ZM28 10.0369V14.293C28 14.293 26.42 14.2312 25.2507 13.9337C23.6179 13.5176 22.5685 12.8795 22.5685 12.8795C22.5685 12.8795 21.8436 12.4245 21.785 12.3928V21.1817C21.785 21.6711 21.651 22.8932 21.2424 23.9125C20.709 25.246 19.8859 26.1212 19.7345 26.3001C19.7345 26.3001 18.7334 27.4832 16.9672 28.28C15.3752 28.9987 13.9774 28.9805 13.5596 28.9987C13.5596 28.9987 11.1434 29.0944 8.96915 27.6814C8.49898 27.3699 8.06011 27.0172 7.6582 26.6277L7.66906 26.6355C9.84383 28.0485 12.2595 27.9528 12.2595 27.9528C12.6779 27.9346 14.0756 27.9528 15.6671 27.2341C17.4317 26.4374 18.4344 25.2543 18.4344 25.2543C18.5842 25.0754 19.4111 24.2001 19.9423 22.8662C2
1900.3498 21.8474 20.4849 20.6247 20.4849 20.1354V11.3475C20.5435 11.3797 21.2679 11.8347 21.2679 11.8347C21.2679 11.8347 22.3179 12.4734 23.9506 12.8889C25.1204 13.1864 26.7 13.2483 26.7 13.2483V9.91314C27.2404 10.0343 27.7011 10.0671 28 10.0369Z' fill='#EE1D52'/><path d='M26.7009 9.91314V13.2472C26.7009 13.2472 25.1213 13.1853 23.9515 12.8879C22.3188 12.4718 21.2688 11.8337 21.2688 11.8337C21.2688 11.8337 20.5444 11.3787 20.4858 11.3464V20.1364C20.4858 20.6258 20.3518 21.8484 19.9432 22.8672C19.4098 24.2012 18.5867 25.0764 18.4353 25.2553C18.4353 25.2553 17.4337 26.4384 15.668 27.2352C14.0765 27.9539 12.6788 27.9357 12.2604 27.9539C12.2604 27.9539 9.84473 28.0496 7.66995 26.6366L7.6591 26.6288C7.42949 26.4064 7.21336 26.1717 7.01177 25.9257C6.31777 25.0795 5.89237 24.0789 5.78547 23.7934C5.78529 23.7922 5.78529 23.791 5.78547 23.7898C5.61347 23.2937 5.25209 22.1022 5.30147 20.9482C5.38883 18.9122 6.10507 17.6625 6.29444 17.3494C6.79597 16.4957 7.44828 15.7318 8.22233 15.0919C8.90538 14.5396 9.6796 14.1002 10.5132 13.7917C11.4144 13.4295 12.3794 13.2353 13.3565 13.2197V16.5948C13.3565 16.5948 11.5691 16.028 10.1388 17.0317C9.13879 17.7743 8.60812 18.4987 8.45185 19.7926C8.44534 20.7449 8.68897 22.0923 10.0254 22.991C10.1813 23.0898 10.3343 23.1775 10.4845 23.2541C10.7179 23.5576 11.0021 23.8221 11.3255 24.0368C12.631 24.8632 13.7249 24.9209 15.1238 24.3842C16.0565 24.0254 16.7586 23.2167 17.0842 22.3206C17.2888 21.7611 17.2861 21.1978 17.2861 20.6154V4.04639H20.5417C20.6763 4.81139 21.0485 5.90039 22.0328 6.97898C22.4276 7.38624 22.8724 7.7463 23.3573 8.05134C23.5006 8.19955 24.2331 8.93231 25.1734 9.38216C25.6596 9.61469 26.1722 9.79285 26.7009 9.91314Z' fill='#000000'/><path d='M4.48926 22.7568V22.7594L4.57004 22.9784C4.56076 22.9529 4.53074 22.8754 4.48926 22.7568Z' fill='#69C9D0'/><path d='M10.5128 13.7916C9.67919 14.1002 8.90498 14.5396 8.22192 15.0918C7.44763 15.7332 6.79548 16.4987 6.29458 17.354C6.10521 17.6661 5.38897 18.9168 5.30161 20.9528C5.25223 22.1068 5.61361 23.2983 5.78561 23.7944C5.78543 23.7956 5.78543 23.7968 5.78561 23.798C5.89413 24.081 6.31791 25.0815 7.01191 25.9303C7.2135 26.1763 7.42963 26.4111 7.65924 26.6334C6.92357 26.1457 6.26746 25.5562 5.71236 24.8839C5.02433 24.0451 4.60001 23.0549 4.48932 22.7626C4.48919 22.7605 4.48919 22.7584 4.48932 22.7564V22.7527C4.31677 22.2571 3.95431 21.0651 4.00477 19.9096C4.09213 17.8736 4.80838 16.6239 4.99775 16.3108C5.4985 15.4553 6.15067 14.6898 6.92509 14.0486C7.608 13.4961 8.38225 13.0567 9.21598 12.7484C9.73602 12.5416 10.2778 12.3891 10.8319 12.2934C11.6669 12.1537 12.5198 12.1415 13.3588 12.2575V13.2196C12.3808 13.2349 11.4148 13.4291 10.5128 13.7916Z' fill='#69C9D0'/><path d='M20.5438 4.04635H17.2881V20.6159C17.2881 21.1983 17.2881 21.76 17.0863 22.3211C16.7575 23.2167 16.058 24.0253 15.1258 24.3842C13.7265 24.923 12.6326 24.8632 11.3276 24.0368C11.0036 23.823 10.7187 23.5594 10.4844 23.2567C11.5962 23.8251 12.5913 23.8152 13.8241 23.341C14.7558 22.9821 15.4563 22.1734 15.784 21.2774C15.9891 20.7178 15.9864 20.1546 15.9864 19.5726V3H20.4819C20.4819 3 20.4315 3.41188 20.5438 4.04635ZM26.7002 8.99104V9.9131C26.1725 9.79263 25.6609 9.61447 25.1755 9.38213C24.2352 8.93228 23.5026 8.19952 23.3594 8.0513C23.5256 8.1559 23.6981 8.25106 23.8759 8.33629C25.0192 8.88339 26.1451 9.04669 26.7002 8.99104Z' fill='#69C9D0'/></svg></div>"+
191                                "</a>");
192        }
193        if(buttons.instagramLink != ''){
194            socialLinksDiv.append("<a class='ays-share-btn ays-share-btn-branded ays-poll-share-btn-instagram'"+
195                                    "title='Instagram Link'  target='_blank' href=" + buttons.instagramLink + ">"+
196                                    "<div class='ays-poll-link-icon'><svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='24px' height='24px' viewBox='0 0 264.583 264.583'><defs><radialGradient xlink:href='#a' id='f' cx='158.429' cy='578.088' r='52.352' fx='158.429' fy='578.088' gradientTransform='matrix(0 -4.03418 4.28018 0 -2332.227 942.236)' gradientUnits='userSpaceOnUse'/><radialGradient xlink:href='#b' id='g' cx='172.615' cy='600.692' r='65' fx='172.615' fy='600.692' gradientTransform='matrix(.67441 -1.16203 
1961.51283 .87801 -814.366 -47.835)' gradientUnits='userSpaceOnUse'/><radialGradient xlink:href='#c' id='h' cx='144.012' cy='51.337' r='67.081' fx='144.012' fy='51.337' gradientTransform='matrix(-2.3989 .67549 -.23008 -.81732 464.996 -26.404)' gradientUnits='userSpaceOnUse'/><radialGradient xlink:href='#d' id='e' cx='199.788' cy='628.438' r='52.352' fx='199.788' fy='628.438' gradientTransform='matrix(-3.10797 .87652 -.6315 -2.23914 1345.65 1374.198)' gradientUnits='userSpaceOnUse'/><linearGradient id='d'><stop offset='0' stop-color='#ff005f'/><stop offset='1' stop-color='#fc01d8'/></linearGradient><linearGradient id='c'><stop offset='0' stop-color='#780cff'/><stop offset='1' stop-color='#820bff' stop-opacity='0'/></linearGradient><linearGradient id='b'><stop offset='0' stop-color='#fc0'/><stop offset='1' stop-color='#fc0' stop-opacity='0'/></linearGradient><linearGradient id='a'><stop offset='0' stop-color='#fc0'/><stop offset='.124' stop-color='#fc0'/><stop offset='.567' stop-color='#fe4a05'/><stop offset='.694' stop-color='#ff0f3f'/><stop offset='1' stop-color='#fe0657' stop-opacity='0'/></linearGradient></defs><path fill='url(#e)' d='M204.15 18.143c-55.23 0-71.383.057-74.523.317-11.334.943-18.387 2.728-26.07 6.554-5.922 2.942-10.592 6.351-15.201 11.13-8.394 8.716-13.481 19.439-15.323 32.184-.895 6.188-1.156 7.45-1.209 39.056-.02 10.536 0 24.4 0 42.999 0 55.2.062 71.341.326 74.476.916 11.032 2.645 17.973 6.308 25.565 7 14.533 20.37 25.443 36.12 29.514 5.453 1.404 11.476 2.178 19.208 2.544 3.277.142 36.669.244 70.081.244s66.826-.04 70.02-.203c8.954-.422 14.153-1.12 19.901-2.606 15.852-4.09 28.977-14.838 36.12-29.575 3.591-7.409 5.412-14.614 6.236-25.07.18-2.28.255-38.626.255-74.924 0-36.304-.082-72.583-.26-74.863-.835-10.625-2.656-17.77-6.364-25.32-3.042-6.182-6.42-10.799-11.324-15.519-8.752-8.361-19.455-13.45-32.21-15.29-6.18-.894-7.41-1.158-39.033-1.213z' transform='translate(-71.816 -18.143)'/><path fill='url(#f)' d='M204.15 18.143c-55.23 0-71.383.057-74.523.317-11.334.943-18.387 2.728-26.07 6.554-5.922 2.942-10.592 6.351-15.201 11.13-8.394 8.716-13.481 19.439-15.323 32.184-.895 6.188-1.156 7.45-1.209 39.056-.02 10.536 0 24.4 0 42.999 0 55.2.062 71.341.326 74.476.916 11.032 2.645 17.973 6.308 25.565 7 14.533 20.37 25.443 36.12 29.514 5.453 1.404 11.476 2.178 19.208 2.544 3.277.142 36.669.244 70.081.244s66.826-.04 70.02-.203c8.954-.422 14.153-1.12 19.901-2.606 15.852-4.09 28.977-14.838 36.12-29.575 3.591-7.409 5.412-14.614 6.236-25.07.18-2.28.255-38.626.255-74.924 0-36.304-.082-72.583-.26-74.863-.835-10.625-2.656-17.77-6.364-25.32-3.042-6.182-6.42-10.799-11.324-15.519-8.752-8.361-19.455-13.45-32.21-15.29-6.18-.894-7.41-1.158-39.033-1.213z' transform='translate(-71.816 -18.143)'/><path fill='url(#g)' d='M204.15 18.143c-55.23 0-71.383.057-74.523.317-11.334.943-18.387 2.728-26.07 6.554-5.922 2.942-10.592 6.351-15.201 11.13-8.394 8.716-13.481 19.439-15.323 32.184-.895 6.188-1.156 7.45-1.209 39.056-.02 10.536 0 24.4 0 42.999 0 55.2.062 71.341.326 74.476.916 11.032 2.645 17.973 6.308 25.565 7 14.533 20.37 25.443 36.12 29.514 5.453 1.404 11.476 2.178 19.208 2.544 3.277.142 36.669.244 70.081.244s66.826-.04 70.02-.203c8.954-.422 14.153-1.12 19.901-2.606 15.852-4.09 28.977-14.838 36.12-29.575 3.591-7.409 5.412-14.614 6.236-25.07.18-2.28.255-38.626.255-74.924 0-36.304-.082-72.583-.26-74.863-.835-10.625-2.656-17.77-6.364-25.32-3.042-6.182-6.42-10.799-11.324-15.519-8.752-8.361-19.455-13.45-32.21-15.29-6.18-.894-7.41-1.158-39.033-1.213z' transform='translate(-71.816 -18.143)'/><path fill='url(#h)' d='M204.15 18.143c-55.23 0-71.383.057-74.523.317-11.334.943-18.387 2.728-26.07 6.554-5.922 2.942-10.592 6.351-15.201 11.13-8.394 8.716-13.481 19.439-15.323 32.184-.895 6.188-1.156 7.45-1.209 39.056-.02 10.536 0 24.4 0 42.999 0 55.2.062 71.341.326 74.476.916 11.032 2.645 17.973 6.308 25.565 7 14.533 20.37 25.443 36.12 29.514 5.453 1.404 11.476 2.178 19.208 2.544 3.277.142 36.669.244 70.081.244s66.826-.04 70.02-.203c8.954-.422 14.153-1.12 19.901-2.606 15.852-4.09 28.977-14.838 36.12-29.575 3.591-7.409 5.412-14.614 6.236-25.07.18-2.28.255-38.626.255-74.924 0-36.304-.082-72.583-.26-74.863-.835-10.625-2.656-17.77-6.364-25.32-3.042-6.182-6.42-10.799-11.324-15.519-8.752-8.361-19.455-13.45-32.21-15.29-6.18-.894-7.41-1.158-39.033-1.213z' transform='translate(-71.816 -18.143)'/><path fill='#fff' d='M132.345 33.973c-26.716 0-30.07.117-40.563.594-10.472.48-17.62 2.136-23.876 4.567-6.47 2.51-11.958 5.87-17.426 11.335-5.472 5.464-8.834 10.948-11.354 17.412-2.44 6.252-4.1 13.397-4.57 23.858-.47 10.486-.593 13.838-.593 40.535s.119 30.037.594 40.522c.482 10.465 2.14 17.609 4.57 23.859 2.515 6.465 5.876 11.95 11.346 17.414 5.466 5.468 10.955 8.834 17.42 11.345 6.26 2.431 13.41 4.088 23.881 4.567 10.493.477 13.844.594 40.559.594 26.719 0 30.061-.117 40.555-.594 
19610.472-.48 17.63-2.136 23.888-4.567 6.468-2.51 11.948-5.877 17.414-11.345 5.472-5.464 8.834-10.949 11.354-17.412 2.419-6.252 4.079-13.398 4.57-23.858.472-10.486.595-13.828.595-40.525s-.123-30.047-.594-40.533c-.492-10.465-2.152-17.608-4.57-23.858-2.521-6.466-5.883-10.799-11.355-17.414-5.472-5.468-10.944-8.827-17.42-11.335-6.271-2.431-13.424-4.088-23.897-4.567-10.493-.477-13.834-.594-40.558-.594zm-8.825 17.715c2.62-.004 5.542 0 8.825 0 26.266 0 29.38.094 39.752.565 9.591.438 14.797 2.04 18.264 3.385 4.591 1.782 7.864 3.912 11.305 7.352 3.443 3.44 5.575 6.717 7.362 11.305 1.346 3.46 2.951 8.663 3.388 18.247.47 10.363.573 13.475.573 39.71 0 26.233-.102 29.346-.573 39.709-.44 9.584-2.042 14.786-3.388 18.247-1.783 4.587-3.919 7.854-7.362 11.292-3.443 3.441-6.712 5.57-11.305 7.352-3.463 1.352-8.673 2.95-18.264 3.388-10.37.47-13.486.573-39.752.573-26.268 0-29.38-.102-39.751-.573-9.592-.443-14.797-2.044-18.267-3.39-4.59-1.781-7.87-3.911-11.313-7.352-3.443-3.44-5.574-6.709-7.362-11.298-1.346-3.461-2.95-8.663-3.387-18.247-.472-10.363-.566-13.476-.566-39.726s.094-29.347.566-39.71c.438-9.584 2.04-14.786 3.387-18.25 1.783-4.588 3.919-7.865 7.362-11.305 3.443-3.441 6.722-5.57 11.313-7.357 3.468-1.351 8.675-2.949 18.267-3.389 9.075-.41 12.592-.532 30.926-.553zm61.337 16.322c-6.518 0-11.805 5.277-11.805 11.792 0 6.512 5.287 11.796 11.805 11.796s11.804-5.284 11.804-11.796c0-6.513-5.287-11.796-11.805-11.796zm-52.512 13.782c-27.9 0-50.519 22.603-50.519 50.482s22.62 50.471 50.52 50.471 50.51-22.592 50.51-50.471-22.613-50.482-50.513-50.482zm0 17.715c18.11 0 32.792 14.67 32.792 32.767 0 18.096-14.683 32.767-32.792 32.767s-32.791-14.671-32.791-32.767c0-18.098 14.68-32.767 32.791-32.767'/></svg></div>"+
197                                "</a>");
198        }
199        $("#"+formId).append(socialLinksDiv);
200
201        setTimeout(function() {
202            $("#"+formId+" .apm-social-btn").css('opacity', '1');
203        }, 1000);
204    }
205
206    function loadEffect(formId, onOff , fontSize,message) {
207        var loadFontSize = fontSize.length > 0 ? fontSize+"px" : '100%';
208        var form = $("#"+formId),
209            effect = form.attr('data-loading');
210        switch (effect) {
211            case 'blur':
212                form.css({
213                    WebkitFilter: onOff ? 'blur(5px)' : 'unset',
214                    filter: onOff ? 'blur(5px)' : 'unset',
215                })
216                break;
217            case 'load_gif':
218                if (onOff) {
219                    var loadSvg = '';
220                    switch (form.attr('data-load-gif')) {
221                        case 'plg_1':
222                            loadSvg = '<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width='+loadFontSize+' height='+loadFontSize+' viewBox="0 0 24 30" style="enable-background:new 0 0 50 50;" xml:space="preserve">'+
223                            '<rect x="0" y="0" width="4" height="10" fill="#333">'+
224                              '<animateTransform attributeType="xml"'+
225                                'attributeName="transform" type="translate"'+
226                                'values="0 0; 0 20; 0 0"'+
227                                'begin="0" dur="0.8s" repeatCount="indefinite" />'+
228                            '</rect>'+
229                            '<rect x="10" y="0" width="4" height="10" fill="#333">'+
230                              '<animateTransform attributeType="xml"'+
231                                'attributeName="transform" type="translate"'+
232                                'values="0 0; 0 20; 0 0"'+
233                                'begin="0.2s" dur="0.8s" repeatCount="indefinite" />'+
234                            '</rect>'+
235                            '<rect x="20" y="0" width="4" height="10" fill="#333">'+
236                              '<animateTransform attributeType="xml"'+
237                                'attributeName="transform" type="translate"'+
238                                'values="0 0; 0 20; 0 0"'+
239                                'begin="0.4s" dur="0.8s" repeatCount="indefinite" />'+
240                            '</rect>'+
241                        '</svg>';
242                            break;
243                        case 'plg_2':
244                            loadSvg = '<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"  width='+loadFontSize+' height='+loadFontSize+' viewBox="0 0 24 30" style="enable-background:new 0 0 50 50;" xml:space="preserve">'+
245                            '<rect x="0" y="10" width="4" height="10" fill="#333" opacity="0.2">'+
246                                '<animate attributeName="opacity" attributeType="XML" values="0.2; 1;
246 .2" begin="0s" dur="0.7s" repeatCount="indefinite" />'+
247                                '<animate attributeName="height" attributeType="XML" values="10; 20; 10" begin="0s" dur="0.7s" repeatCount="indefinite" />'+
248                                '<animate attributeName="y" attributeType="XML" values="10; 5; 10" begin="0s" dur="0.7s" repeatCount="indefinite" />'+
249                            '</rect>'+
250                            '<rect x="8" y="10" width="4" height="10" fill="#333"  opacity="0.2">'+
251                                '<animate attributeName="opacity" attributeType="XML" values="0.2; 1; .2"    begin="0.15s" dur="0.7s" repeatCount="indefinite" />'+
252                                '<animate attributeName="height" attributeType="XML" values="10; 20; 10" begin="0.15s" dur="0.7s" repeatCount="indefinite" />'+
253                                '<animate attributeName="y" attributeType="XML" values="10; 5; 10" begin="0.15s"   dur="0.7s" repeatCount="indefinite" />'+
254                            '</rect>'+
255                            '<rect x="16" y="10" width="4" height="10" fill="#333"  opacity="0.2">'+
256                                '<animate attributeName="opacity" attributeType="XML" values="0.2; 1; .2" begin="0.3s" dur="0.7s" repeatCount="indefinite" />'+
257                                '<animate attributeName="height" attributeType="XML" values="10; 20; 10" begin="0.3s" dur="0.7s" repeatCount="indefinite" />'+
258                                '<animate attributeName="y" attributeType="XML" values="10; 5; 10" begin="0.3s" dur="0.7s" repeatCount="indefinite" />'+
259                            '</rect>'+
260                        '</svg>';
261                            break;
262                        case 'plg_3':
263                            loadSvg = '<svg width='+loadFontSize+' height='+loadFontSize+' viewBox="0 0 105 105" xmlns="http://www.w3.org/2000/svg" fill="#000">'+
264                            '<circle cx="12.5" cy="12.5" r="12.5">'+
265                                '<animate attributeName="fill-opacity"'+
266                                 'begin="0s" dur="0.9s"'+
267                                 'values="1;.2;1" calcMode="linear"'+
268                                 'repeatCount="indefinite" />'+
269                            '</circle>'+
270                            '<circle cx="12.5" cy="52.5" r="12.5" fill-opacity=".5">'+
271                                '<animate attributeName="fill-opacity"'+
272                                 'begin="100ms" dur="0.9s"'+
273                                 'values="1;.2;1" calcMode="linear"'+
274                                 'repeatCount="indefinite" />'+
275                            '</circle>'+
276                            '<circle cx="52.5" cy="12.5" r="12.5">'+
277                                '<animate attributeName="fill-opacity"'+
278                                 'begin="300ms" dur="0.9s"'+
279                                 'values="1;.2;1" calcMode="linear"'+
280                                 'repeatCount="indefinite" />'+
281                            '</circle>'+
282                            '<circle cx="52.5" cy="52.5" r="12.5">'+
283                                '<animate attributeName="fill-opacity"'+
284                                 'begin="600ms" dur="0.9s"'+
285                                 'values="1;.2;1" calcMode="linear"'+
286                                 'repeatCount="indefinite" />'+
287                            '</circle>'+
288                            '<circle cx="92.5" cy="12.5" r="12.5">'+
289                                '<animate attributeName="fill-opacity"'+
290                                 'begin="800ms" dur="0.9s"'+
291                                 'values="1;.2;1" calcMode="linear"'+
292                                 'repeatCount="indefinite" />'+
293                            '</circle>'+
294                            '<circle cx="92.5" cy="52.5" r="12.5">'+
295                                '<animate attributeName="fill-opacity"'+
296                                 'begin="400ms" dur="0.9s"'+
297                                 'values="1;.2;1" calcMode="linear"'+
298                                 'repeatCount="indefinite" />'+
299                            '</circle>'+
300                            '<circle cx="12.5" cy="92.5" r="12.5">'+
301                                '<animate attributeName="fill-opacity"'+
302                                 'begin="700ms" dur="0.9s"'+
303                                 'values="1;.2;1" calcMode="linear"'+
304                                 'repeatCount="indefinite" />'+
305                            '</circle>'+
306                            '<circle cx="52.5" cy="92.5" r="12.5">'+
307                                '<animate attributeName="fill-opacity"'+
308                                 'begin="500ms" dur="0.9s"'+
309                                 'values="1;.2;1" calcMode="linear"'+
310                                 'repeatCount="indefinite" />'+
311                            '</circle>'+
312                            '<circle cx="92.5" cy="92.5" r="12.5">'+
313                                '<animate attributeName="fill-opacity"'+
314                                 'begin="200ms" dur="0.9s"'+
315                                 'values="1;.2;1" calcMode="linear"'+
316                                 'repeatCount="indefinite" />'+
317                            '</circle>'+
318                        '</svg>';
319                            break;
320                        case 'plg_4':
321                            loadSvg = '<svg width='+loadFontSize+' height='+loadFontSize+' viewBox="0 0 57 57" xmlns="http://www.w3.org/2000/svg"  stroke="#000">'+
322                            '<g fill="none" fill-rule="evenodd">'+
323                                '<g transform="translate(1 1)" stroke-width="2">'+
324                                    '<circle cx="5" cy="50" r="5">'+
325                                        '<animate attributeName="cy"'+
326                                             'begin="0s" dur="2.2s"'+
327                                             'values="50;5;50;50"'+
328                                             'calcMode="linear"'+
329                                             'repeatCount="indefinite" />'+
330                                        '<animate attributeName="cx"'+
331                                             'begin="0s" dur="2.2s"'+
332                                             'values="5;27;49;5"'+
333                                             'calcMode="linear"'+
334                                             'repeatCount="indefinite" />'+
335                                    '</circle>'+
336                                    '<circle cx="27" cy="5" r="5">'+
337                                        '<animate attributeName="cy"'+
338                                             'begin="0s" dur="2.2s"'+
339                                             'from="5" to="5"'+
340                                             'values="5;50;50;5"'+
341                                             'calcMode="linear"'+
342                                             'repeatCount="indefinite" />'+
343                                        '<animate attributeName="cx"'+
344                                             'begin="0s" dur="2.2s"'+
345                                             'from="27" to="27"'+
346                                             'values="27;49;5;27"'+
347                                             'calcMode="linear"'+
348                                             'repeatCount="indefinite" />'+
349                                    '</circle>'+
350                                    '<circle cx="49" cy="50" r="5">'+
351                                        '<animate attributeName="cy"'+
352                                             'begin="0s" dur="2.2s"'+
353                                             'values="50;50;5;50"'+
354                                             'calcMode="linear"'+
355                                             'repeatCount="indefinite" />'+
356                                        '<animate attributeName="cx"'+
357                                             'from="49" to="49"'+
358                                             'begin="0s" dur="2.2s"'+
359                                             'values="49;5;27;49"'+
360                                             'calcMode="linear"'+
361                                             'repeatCount="indef
361inite" />'+
362                                    '</circle>'+
363                                '</g>'+
364                            '</g>'+
365                        '</svg>';
366                            break;
367                        case 'plg_5':
368                            loadSvg = '<svg width='+loadFontSize+' height='+loadFontSize+' viewBox="0 0 135 140" xmlns="http://www.w3.org/2000/svg"  stroke="#000">'+
369                            '<rect y="10" width="15" height="120" rx="6">'+
370                                '<animate attributeName="height" begin="0.5s" dur="1s" values="120;110;100;90;80;70;60;50;40;140;120" calcMode="linear" repeatCount="indefinite" />'+
371                                '<animate attributeName="y" begin="0.5s" dur="1s" values="10;15;20;25;30;35;40;45;50;0;10" calcMode="linear" repeatCount="indefinite" />'+
372                            '</rect>'+
373                            '<rect x="30" y="10" width="15" height="120" rx="6">'+
374                                '<animate attributeName="height" begin="0.25s" dur="1s" values="120;110;100;90;80;70;60;50;40;140;120" calcMode="linear" repeatCount="indefinite"/>'+
375                                '<animate attributeName="y" begin="0.25s" dur="1s" values="10;15;20;25;30;35;40;45;50;0;10" calcMode="linear" repeatCount="indefinite"/>'+
376                            '</rect>'+
377                           ' <rect x="60" width="15" height="140" rx="6">'+
378                                '<animate attributeName="height" begin="0s" dur="1s" values="120;110;100;90;80;70;60;50;40;140;120" calcMode="linear" repeatCount="indefinite"/>'+
379                                '<animate attributeName="y" begin="0s" dur="1s" values="10;15;20;25;30;35;40;45;50;0;10" calcMode="linear" repeatCount="indefinite"/>'+
380                            '</rect>'+
381                            '<rect x="90" y="10" width="15" height="120" rx="6">'+
382                                '<animate attributeName="height" begin="0.25s" dur="1s" values="120;110;100;90;80;70;60;50;40;140;120" calcMode="linear" repeatCount="indefinite"/>'+
383                                '<animate attributeName="y" begin="0.25s" dur="1s" values="10;15;20;25;30;35;40;45;50;0;10" calcMode="linear" repeatCount="indefinite"/>'+
384                            '</rect>'+
385                            '<rect x="120" y="10" width="15" height="120" rx="6">'+
386                                '<animate attributeName="height" begin="0.5s" dur="1s" values="120;110;100;90;80;70;60;50;40;140;120" calcMode="linear" repeatCount="indefinite"/>'+
387                                '<animate attributeName="y" begin="0.5s" dur="1s" values="10;15;20;25;30;35;40;45;50;0;10" calcMode="linear" repeatCount="indefinite"/>'+
388                            '</rect>'+
389                        '</svg>';
390                            break;
391                        default:
392                            loadSvg = '<svg version="1.1" id="loader-1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"'+
393                            'width='+loadFontSize+' height='+loadFontSize+' viewBox="0 0 50 50" style="enable-background:new 0 0 50  50;" xml:space="preserve">'+
394                                '<path fill="#000" d="M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318, 0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0, 14.615, 6.543,14.615,14.615H43.935z">'+
395                                    '<animateTransform attributeType="xml"'+
396                                        'attributeName="transform"'+
397                                        'type="rotate"'+
398                                        'from="0 25 25"'+
399                                        'to="360 25 25"'+
400                                        'dur="0.6s"'+
401                                        'repeatCount="indefinite"/>'+
402                                '</path>'+
403                            '</svg>';
404                    }
405                    var layer = $('<div class="apm-opacity-layer-light" style="margin-top: 0">'+
406                        '<div class="apm-loading-gif">'+
407                            '<div class="apm-loader loader--style3">'+
408                                loadSvg+
409                            '</div>'+
410                        '</div>'+
411                    '</div>');
412                    form.css({
413                        position: 'relative'
414                    });
415                    form.append(layer);
416                    layer.css('opacity', 1);
417                } else {
418                    $('.apm-opacity-layer-light').css('opacity', 0).empty();
419                    setTimeout(function() {
420                        $('.apm-opacity-layer-light').remove();
421                    }, 500);
422                }
423                break;
424            case 'message':
425                if (onOff) {
426                    var layer = $('<div class="apm-opacity-layer-light apm-load-message-container"><span>'+message+'</span></div>');
427                    form.css({
428                        position: 'relative'
429                    });
430                    form.append(layer);
431                    layer.css('opacity', 1);
432                    setTimeout(function() {
433                        $('.apm-load-message-container').remove();
434                    }, 500);
435                }
436                else{
437                     $('.apm-opacity-layer-light').css('opacity', 0).empty();
438                    setTimeout(function() {
439                        $('.apm-opacity-layer-dark').remove();
440                    }, 500);
441                }
442                break;    
443            default:
444                if (onOff) {
445                    var layer = $('<div class="apm-opacity-layer-dark"></div>');
446                    form.css({
447                        position: 'relative'
448                    });
449                    form.append(layer);
450                    layer.css('opacity', 1);
451                } else {
452                    $('.apm-opacity-layer-dark').css('opacity', 0);
453                    setTimeout(function() {
454                        $('.apm-opacity-layer-dark').remove();
455                    }, 500);
456                }
457                break;
458        }
459    }
460
461    function sortDate(rateCount, votesSum, answers, formId) {
462        var form = $("#"+formId),
463            sortable = form.attr('data-res-sort'),
464            widths = [];
465        for (var i = 0; i < rateCount; i++) {
466            var answer = answers[i];
467            widths[i] = {};
468            var width = (answer.votes * 100 / votesSum).toFixed(0);
469            widths[i].width = width;
470            widths[i].index = i;
471        }
472        if (sortable === "ASC") {
473            for (var i = 0; i < rateCount; i++) {
474                for (var j = (i + 1); j < rateCount; j++) {
475                    if (Number(widths[i].width) > Number(widths[j].width)) {
476                        var temp = widths[i].width;
477                        widths[i].width = widths[j].width;
478                        widths[j].width = temp;
479                        temp = widths[i].index;
480                        widths[i].index = widths[j].index;
481                        widths[j].index = temp;
482                    }
483                }
484            }
485        } else if (sortable === "DESC") {
486            for (var i = 0; i < rateCount; i++) {
487                for (var j = (i + 1); j < rateCount; j++) {
488                    if (Number(widths[i].width) < Number(widths[j].width)) {
489                        var temp = widths[i].width;
490                        widths[i].width = widths[j].width;
491                        widths[j].width = temp;
492                        temp = widths[i].index;
493                        widths[i].index = widths[j].index;
494                        widths[j].index = temp;
495                    }
496                }
497            }
498        }
499        return widths;
500    }
501
502    var apmIcons = {
503        star: "<i class='ays_poll_far ays_poll_fa-star'></i>",
504        star1: "<i class='ays_poll_fas ays_poll_fa-star'></i>",
505        emoji: [
506            "<i class='ays_poll_far ays_poll_fa-dizzy'></i>",
507            "<i class='ays_poll_far ays_poll_fa-smile'></i>",
508            "<i class='ays_poll_far ays_poll_fa-meh'></i>",
509            "<i class='ays_poll_far ays_poll_fa-frown'></i>",
510            "<i class='ays_poll_far ays_poll_fa-tired'></i>",
511        ],
512        emoji1: [
513            "<i class='ays_poll_fas ays_poll_fa-dizzy'></i>",
514            "<i class='ays_poll_fas ays_poll_fa-smile'></i>",
515            "<i class='ays_poll_fas ays_poll_fa-meh'></i>",
516            "<i class='ays_poll_fas ays_poll_fa-frown'></i>",
517            "<i class='ays_poll_fas ays_poll_fa-tired'></i>",
518        ],
519        hand: [
520            "<i class='ays_poll_far ays_poll_fa-thumbs-up'></i>",
521            "<i class='ays_poll_far ays_poll_fa-thumbs-down'></i>"
522        ],
523        hand1: [
524            "<i class='ays_poll_fas ays_poll_fa-thumbs-up'></i>",
525            "<i class='ays_poll_fas ays_poll_fa-thumbs-down'></i>"
526        ],
527    };
528
529    function showInfoForm($form) {
530        $form.find('.ays_question, .apm-answers').fadeOut(0);
531        $infoForm = $form.find('.apm-info-form');
532        $infoForm.fadeIn();
533        $form.find('.ays_finish_poll').val($infoForm.attr('data-text'));
534        $form.find('.ays_finish_poll').attr('style', 'display:initial !important');
535        $form.find('.ays-see-res-button-show').attr('style', 'display:none');
536        $form.attr('data-info-form', '');
537    }
538
539    var emailValivatePattern = /^[a-zA-Z0-9\._-]+@[a-zA-Z0-9\._-]+\.\w{2,}$/;
540
541    function voting(btnId , type) {
542        if (typeof btnId == "undefined"){
543            btnId = 0;
544        }
545        var btn;
546        if( btnId === 0 ){
547            btn = $(this);
548        }else{
549            btn = btnId;
550        }
551        var seeRes = btn.attr('data-seeRes'),
552            isLimitation = btn.attr('data-limitation') == 'true';
553            formId = btn.attr('data-form'),
554            form = $("#"+formId),
555            pollId = form.attr('data-id'),
556            isRestart = form.attr('data-restart'),
557            voteURLRedirection = form.attr('data-redirect-check'),
558            voteRedirection = form.attr('data-redirection'),
559            infoForm = form.attr('data-info-form'),
560            resultColorsRgba = form.attr('data-res-rgba'),
561            hideBgImage = form.attr('data-hide-bg-image'),
562            hideBgImageDefColor = form.data('hide-bg-image-def-color'),
563            backgroundGradientCheck = form.data('gradient-check'),
564            backgroundGradientC1 = form.data('gradient-c1'),
565            backgroundGradientC2 = form.data('gradient-c2'),
566            backgroundGradientDir = form.data('gradient-dir'),
567            loadEffectFontSize = form.attr('data-load-gif-font-size');
568            enableTopAnimation = form.attr('data-enable-top-animation');
569            topAnimationScroll = form.attr('data-top-animation-scroll');
570            loadEffectMessage  = typeof form.data('loadMessage') != "undefined" ? form.data('loadMessage') : "";
571
572        var pollOptions = JSON.parse(window.atob(window.aysPollOptions[formId]));
573        var pollEnableLn = typeof pollOptions.poll_show_social_ln != "undefined" && pollOptions.poll_show_social_ln.length > 0 && pollOptions.poll_show_social_ln == "on" ? true : false;
574        var pollEnableFb = typeof pollOptions.poll_show_social_fb != "undefined" && pollOptions.poll_show_social_fb.length > 0 && pollOptions.poll_show_social_fb == "on" ? true : false;
575        var pollEnableTr = typeof pollOptions.poll_show_social_tr != "undefined" && pollOptions.poll_show_social_tr.length > 0 && pollOptions.poll_show_social_tr == "on" ? true : false;
576        var pollEnableVk = typeof pollOptions.poll_show_social_vk != "undefined" && pollOptions.poll_show_social_vk.length > 0 && pollOptions.poll_show_social_vk == "on" ? true : false;
577        var pollSocialButtons = {
578            linkedIn  : pollEnableLn,
579            faceBook  : pollEnableFb,
580            twitter   : pollEnableTr,
581            vkontakte : pollEnableVk,
582        };
583
584        if( typeof pollOptions.social_links != "undefined" ) {
585            var pollLinkedInLink = pollOptions.social_links.linkedin_link != "" ? pollOptions.social_links.linkedin_link : "";
586            var pollFacebookInLink = pollOptions.social_links.facebook_link != "" ? pollOptions.social_links.facebook_link : "";
587            var pollTwitterLink = pollOptions.social_links.twitter_link != "" ? pollOptions.social_links.twitter_link : "";
588            var pollVkontakteLink = pollOptions.social_links.vkontakte_link != "" ? pollOptions.social_links.vkontakte_link : "";
589            var pollYoutubeLink = pollOptions.social_links.youtube_link != "" ? pollOptions.social_links.youtube_link : "";
590            var pollTiktokLink = pollOptions.social_links.tiktok_link != "" ? pollOptions.social_links.tiktok_link : "";
591            var pollInstagramLink = pollOptions.social_links.instagram_link != "" ? pollOptions.social_links.instagram_link : "";
592        }
593        var pollSocialLinks = {
594            linkedInLink  : pollLinkedInLink,
595            faceBookLink  : pollFacebookInLink,
596            twitterLink   : pollTwitterLink,
597            vkontakteLink : pollVkontakteLink,
598            youtubeLink   : pollYoutubeLink,
599            tiktokLink   : pollTiktokLink,
600            instagramLink   : pollInstagramLink,
601        }
602
603        var data = form.parent().serializeFormJSON();
604        
605        if(form.hasClass('choosing-poll') && !seeRes){
606            var allowMultivoteCheck = $('#'+formId).find('input#ays_poll_multivote_min_count').data("allow");
607            if(allowMultivoteCheck){
608                var numberCheckedAnswers  = $('#'+formId).find('input:checkbox:checked').length;
609                var numberAllAnswers  = $('#'+formId).find('input:checkbox').length;
610                var minimumVotesCount = $('#'+formId).find('input#ays_poll_multivote_min_count').val();
611                var otherAnswer = $('#'+formId).find('input.ays-poll-new-answer-apply-text');
612                var otherAnswerVal = otherAnswer.val();
613                if(otherAnswer.length > 0 && otherAnswerVal != ""){
614                    numberCheckedAnswers++;
615                }
616                if( numberAllAnswers < minimumVotesCount){
617                    minimumVotesCount = numberAllAnswers;
618                    form.find('.ays-poll-multivote-message').html("Minimum votes count shoulde be "+minimumVotesCount);
619                }
620                if(minimumVotesCount > numberCheckedAnswers){
621                    form.find('.ays-poll-multivote-message').show();
622                    return false;
623                }
624            }
625        }
626
627        if (infoForm) {
628            if (type == "text" && data.answer == ""){
629                return;
630            }
631
632            if ('answer' in data && !seeRes || (('ays_poll_new_answer' in data) && data.ays_poll_new_answer != '')) {
633                return showInfoForm(form);
634            } else if(!seeRes) {
635                return false;
636            }
637        }
638
639        var valid = true;
640        form.find('.apm-info-form input[name]').each(function () {
641            $(this).removeClass('ays_poll_shake');
642            if ($(this).attr('data-required') == 'true' && $(this).val() == "" && !seeRes) {
643                $(this).addClass('apm-invalid');
644                $(this).addClass('ays_red_border');
645                $(this).addClass('ays_poll_shake');
646                valid = false;
647            }
648        });
649        
650        var email_val = $('[check_id="'+formId+'"]');
651        if (email_val.attr('type') !== 'hidden' && email_val.attr('check_id') == formId) {
652            if(email_val.val() != ''){
653                if (!(emailValivatePattern.test(email_val.val())) && !seeRes) {
654                    email_val.addClass('ays_red_border');
655                    email_val.addClass('ays_poll_shake');
656                    valid = false;
657                }else{
658                    email_val.addClass('ays_green_border');
659                }
660            }
661        }
662
663        var phoneInput = $(document).find("#"+formId).find('input[name="apm_phone"]');
664        var phoneInputVal = phoneInput.val();
665        if(phoneInputVal != '' && typeof phoneInputVal !== 'undefined'){
666            phoneInput.removeClass('ays_red_border');
667            phoneInput.removeClass('ays_green_border');
668            if (!validatePhoneNumber(phoneInput.get(0))) {
669                if (phoneInput.attr('type') !== 'hidden') {
670                    phoneInput.addClass('ays_red_border');
671                    phoneInput.addClass('ays_poll_shake');
672                    valid = false;
673                }
674            }else{
675                phoneInput.addClass('ays_green_border');
676            }
677        }
678        
679        if (!valid && !seeRes) {
680            return false;
681        }
682
683        if ((!('answer' in data) && !seeRes) && (!('ays_poll_new_answer' in data) || (('ays_poll_new_answer' in data) && data.ays_poll_new_answer == ''))) return;
684        var userAnswerValue;
685        if (data.answer) {
686            var userAnswerId = data.answer;
687
688            if ($.isArray(userAnswerId)) {
689                var userEachAnswerValue = [];
690
691                for (var i = 0; i < userAnswerId.length; i++) {
692                    var userEachAnswer = form.find('input[name="answer"][value="'+userAnswerId[i]+'"]');
693                    var userEachAnswerBox = userEachAnswer.parent();
694                    userEachAnswerValue.push(userEachAnswerBox.find('span.ays-poll-each-answer-grid').text());
695                }
696
697                userAnswerValue = userEachAnswerValue;
698
699                if (data.ays_poll_new_answer) {
700                    userAnswerValue.push(data.ays_poll_new_answer);
701                }
702            } else {
703                var userAnsweInput = form.find('input[name="answer"][value="'+userAnswerId+'"]');
704                var userAnswerBox = userAnsweInput.parent();
705                userAnswerValue = userAnswerBox.find('span.ays-poll-each-answer-grid').text();
706            }
707        } else if(data.ays_poll_new_answer) {
708            userAnswerValue = data.ays_poll_new_answer;
709        }
710        if (seeRes && ('answer' in data)) delete data['answer'];
711        loadEffect(formId, true , loadEffectFontSize,loadEffectMessage);
712        btn.off();
713        data.action = 'ays_finish_poll';
714        data.poll_id = pollId;
715
716        var endDate = GetFullDateTime();
717        data.end_date = endDate;
718
719        // Mute answer sound button
720        var $this = $(document).find('.ays_finish_poll').data("form");
721        var currentContainer = $(document).find("#"+$this);
722        var soundEls = currentContainer.find('.ays_music_sound');
723        if(soundEls.hasClass("ays_music_sound")){
724            soundEls.removeClass("ays_sound_active");
725            soundEls.addClass("ays_poll_display_none");
726        }
727        if($(document).scrollTop() >= form.offset().top){
728            form.goToPoll(enableTopAnimation,topAnimationScroll);
729        }
730
731        $.ajax({
732            url: poll_maker_ajax_public.ajax_url,
733            dataType: 'json',
734            method:'post',
735            data: data,
736            success: function(res) {
737                form.find(".ays-poll-vote-reason").hide();
738                var answers_sounds = $("#"+formId).parent().find('.ays_poll_ans_sound').get(0);
739                if(answers_sounds){
740                    setTimeout(function() {
741                        resetPlaying(answers_sounds);
742                    }, 1000);
743                }
744                if(hideBgImage == 'true'){
745                    if(!backgroundGradientCheck){
746                        $(document).find("#"+formId).css("background-image", "none");
747                        $(document).find("#"+formId).css("background-color", hideBgImageDefColor);
748                    }
749                    else{
750                        $(document).find("#"+formId).css("background-image", "linear-gradient("+backgroundGradientDir+", "+backgroundGradientC1+", "+backgroundGradientC2+")");
751                    }
752                }
753                $("#"+formId+" .ays_poll_cb_and_a").hide();
754                $("#"+formId+" .ays_poll_show_timer").hide();
755                var delay = $('.ays-poll-main').find('div.box-apm[data-delay]').attr('data-delay');
756                delayCountDown(delay);
757                loadEffect(formId, false , loadEffectFontSize,loadEffectMessage);
758                form.parent().next().prop('disabled', false);
759                $('.answer-' + formId).parent().remove(); //for removing apm-answer
760                form.find('.ays_poll_passed_count').remove();
761                form.find('.apm-info-form').remove();
762                var redirectMessage = voteRedirection ? form.find('.redirectionAfterVote').clone(true) : '';
763                $("#"+formId+" .apm-button-box").remove();
764                var hideRes = form.attr('data-res');
765                var resultContainer = $("#"+formId).parent().find('.box-apm');
766
767                var hideResOption = false;
768                var pollSocialLinksHeading = "";
769                var pollSocialButtonsHeading = "";
770                if(typeof res.styles != "undefined"){
771
772                    if(typeof res.styles['hide_results'] != "undefined"){
773                        hideResOption = res.styles['hide_results'].length > 0 && res.styles['hide_results'] != 1 ? true : false;
774                    }
775
776                    if(typeof res.styles['poll_social_links_heading'] != "undefined"){
777                        pollSocialLinksHeading = typeof res.styles['poll_social_links_heading'] != "undefined" && res.styles['poll_social_links_heading'].length > 0 && res.styles['poll_social_links_heading'] != "" ? res.styles['poll_social_links_heading'] : "";
778                    }
779
780                    if(typeof res.styles['poll_social_buttons_heading'] != "undefined"){
781                        pollSocialButtonsHeading = typeof res.styles['poll_social_buttons_heading'] != "undefined" && res.styles['poll_social_buttons_heading'].length > 0 && res.styles['poll_social_buttons_heading'] != "" ? res.styles['poll_social_buttons_heading'] : "";
782                    }
783
784                    var result_message = typeof res.styles['result_message'] != "undefined" && res.styles['result_message'] != "" ? res.styles['result_message'] : "";
785
786                    if (!isLimitation) {
787                        form.find('.apm-title-box.ays_res_mess').html(result_message);
788                    }
789
790                    var hide_results_text = typeof res.styles['hide_results_text'] != "undefined" && res.styles['hide_results_text'] != "" ? res.styles['hide_results_text'] : "";
791                    form.find('.ays-poll-hide-result-box').html(hide_results_text);
792
793                }
794                pollSocialLinks.heading = pollSocialLinksHeading;
795                pollSocialButtons.heading = pollSocialButtonsHeading;
796                    
797                if( !res.voted_status && !seeRes && hideResOption){
798                    var content = '';
799                    var limitation_message = (res.styles['limitation_message'] && res.styles['limitation_message'] != '') ? res.styles['limitation_message'] : poll_maker_ajax_public.alreadyVoted;
800                    limitation_message = limitation_message.replace(/\\/g, '');
801
802                    content += '<div class="ays-poll-vote-message">';
803                        content += '<p>'+ limitation_message +'</p>';
804                    content += '</div>';
805
806                    resultContainer.append(content);
807                }
808
809                if (hideRes != 0) {
810                    $("#"+formId+" .ays_question").remove();
811                    $("#"+formId+" .hideResults").css("display", "block");
812                }
813                else if ( type == "text" ) {
814                    $("#"+formId+" .ays_question").remove();
815                    $("#"+formId+" .hideResults").css("display", "block");
816                    $("#"+formId+" .ays_res_mess").fadeIn();
817                }
818                else if ( !res.voted_status ) {
819                    $("#"+formId+" .hideResults").css("display", "block");
820                }
821                else {
822                    form.append('<div class="results-apm" id="pollResultId' +data.poll_id+ '">' + '</div>');
823                    var votesSum = 0;
824                    var votesMax = 0;
825                    var answer;
826                    for ( answer in res.answers) {
827                        votesSum = Math.abs(res.answers[answer].votes) + votesSum;
828                        if (+res.answers[answer].votes >
828 votesMax) {
829                            votesMax = +res.answers[answer].votes;
830                        }
831                    }
832                    var answer2 = res.answers;
833
834                    // Answer Numbering
835                    
836                    var widths = sortDate(res.answers.length, votesSum, answer2, formId );
837                    //show votes count 
838                    var showvotescounts = true;
839                    if (res.styles.show_votes_count == 0) {
840                        showvotescounts = false;
841                    }
842
843                    //show result percent 
844                    var showrespercent = true;
845                    if (res.styles.show_res_percent == 0) {
846                        showrespercent = false;
847                    }
848
849                    var barChartType = typeof res.styles['show_chart_type'] != "undefined" && res.styles['show_chart_type'].length > 0 && res.styles['show_chart_type'] != "" ? res.styles['show_chart_type'] : "default_bar_chart";
850
851                    if(barChartType == "google_bar_chart") {
852                        var chartHeight = typeof res.styles['show_chart_type_google_height'] != "undefined" && res.styles['show_chart_type_google_height'] != "" ? res.styles['show_chart_type_google_height'] : 400;
853                        var aysBarChartData = new Array(['', '']);
854                        $("#"+formId+" .ays_res_mess").fadeIn();
855                        for (var tox in widths) {
856                            var chartRealVotes = +answer2[widths[tox].index].votes;
857                            var answerTextVal   = answer2[widths[tox].index].answer;
858                            //var finalAnswerText = ays_poll_restriction_string( 'words', answerTextVal, 2 );
859                            answerTextVal   = answerTextVal.replace(/\\/g, '');
860                            aysBarChartData.push([
861                              answerTextVal,
862                              parseInt(chartRealVotes)
863                            ]);
864                        }
865
866                        google.charts.load('current', {packages: ['corechart', 'bar']});
867                        google.charts.setOnLoadCallback(drawBasic);
868
869                        function drawBasic() {
870                            var data = google.visualization.arrayToDataTable(aysBarChartData);
871
872                            var groupData = google.visualization.data.group(
873                                        data,
874                                        [{column: 0, modifier: function () {return 'total'}, type:'string'}],
875                                        [{column: 1, aggregation: google.visualization.data.sum, type: 'number'}]
876                            );
877  
878                            var formatPercent = new google.visualization.NumberFormat({
879                                pattern: '#%'
880                            });
881                    
882                            var formatShort = new google.visualization.NumberFormat({
883                                pattern: 'short'
884                            });
885                            
886                            var view = new google.visualization.DataView(data);
887                            view.setColumns([0, 1, {
888                                calc: function (dt, row) {
889                                    if( groupData.getValue(0, 1) == 0 ){
890                                        return amount;
891                                    }
892                                    var amount =  formatShort.formatValue(dt.getValue(row, 1));
893                                    var percent = formatPercent.formatValue(dt.getValue(row, 1) / groupData.getValue(0, 1));
894                                    return amount + ' (' + percent + ')';
895                                },
896                                type: 'string',
897                                role: 'annotation'
898                            }]);
899                            var options = {
900                                maxWidth: '100%',
901                                height: chartHeight,
902                                legend: { position: 'none' },
903                                axes: {
904                                    x: {
905                                      0: { side: 'bottom'}
906                                    }
907                                },
908                                bars: 'horizontal',
909                                bar: { groupWidth: "90%" },
910                            };
911
912                            var chart = new google.visualization.BarChart(document.getElementById('pollResultId' + pollId));
913                            google.visualization.events.addListener(chart, 'ready', function () {
914                                $.each($('text[text-anchor="end"]'), function (index, label) {
915                                    var labelText = $(label).text();
916                                    if ($.isArray(userAnswerValue)) {
917                                        for (var i = 0; i < userAnswerValue.length; i++) {
918                                            if (labelText == userAnswerValue[i]) {
919                                                $(this).css('font-weight', '600');
920                                            }
921                                        }
922                                    } else {
923                                      if (labelText == userAnswerValue) {
924                                        $(this).css('font-weight', '600');
925                                      }
926                                    }
927                                });
928                            });
929                            chart.draw(view,options);
930                        }
931                    } else if (barChartType == "default_bar_chart") {
932                        if(typeof data.answer == "string") {
933                            var dataAnswerArr = data.answer.split(",")
934                        }
935                        else {
936                            dataAnswerArr = data.answer;
937                        }
938
939                        for (var i = 0; i < res.answers.length; i++) {
940                            var rightAnswerCheck = (jQuery.inArray(res.answers[widths[i].index].id, dataAnswerArr) !== -1) ? 'ays_check' : '';
941                            var starAnswerCheck = (data.answer == res.answers[widths[i].index].id) ? apmIcons.star1 : apmIcons.star;
942                            var emojiAnswerCheck = (data.answer == res.answers[widths[i].index].id) ? apmIcons.emoji1 : apmIcons.emoji;
943                            var handAnswerCheck = (data.answer == res.answers[widths[i].index].id) ? apmIcons.hand1 : apmIcons.hand;
944                            var answer = res.answers;
945                            var percentColor = form.attr('data-percent-color');
946                            
947                            var answerDiv = $('<div class="answer-title flex-apm"></div>'),
948                            answerBar = $('<div class="answer-percent" data-percent="'+widths[i].width+'"></div>');
949                    if( answerDiv.find('.ayspoll-answers-votes-count-before-voting-width').css('display') == 'none'){
950                    answerDiv.find('.ayspoll-answers-votes-count-before-voting-width > span').css('width', '0%');
951                    answerDiv.find('.ayspoll-answers-votes-count-before-voting').css('display', 'flex');
952                    answerDiv.find('.ayspoll-answers-votes-count-before-voting-width').css('display', 'flex');
953                }
954                    // answerDiv.find('.ayspoll-answers-votes-count-before-voting').text(res_count);
955                    answerDiv.css({
956                        'pointer-events': 'none'
957                    });
958                    setTimeout(function(){
959                        answerDiv.find('.ayspoll-answers-votes-count-before-voting-width > span').css('width', notLeloadingRes[answerID].width + '%');
960                    }, 300);
961                            var userMoreImage;
962                            if(res.check_user_pic && res.answers[i].avatar){
963                                var userpicsMore = res.answers[widths[i].index].avatar;
964                                var userPicsCount = res.check_user_pic_count;
965                                var addedMoreImage = "<div class='ays-users-profile-pics'><img src="+res.check_user_pic_url+" width='24' height='24' class='ays-user-image-more' data-answer-id="+res.answers[widths[i].index].id+"></div>";                                
966                                if(userpicsMore.length != 0){
967                                    userpicsMore = userpicsMore.splice(0 , userPicsCount);
968                                    userpicsMore.push(addedMoreImage);
969                                }
970                                userMoreImage = $('<div class="ays-user-count">'+userpicsMore.join(' ')+'</div>');
971                            }
972
973                            if (resultColorsRgba) {
974                                answerBar.attr('style', 'background-color:'+hexToRgba(percentColor, widths[i].width/100)+'  !important; border: 1px solid ' + percentColor +' !important;');
975                            }
976                            else{
977                                answerBar.attr('style', 'background-color:'+percentColor);
978                            }
979
980                            answerBar.css({
981                                width: '1%'
982                            });
983
984                            var answerText = '';
985                            var pollShowAnswerImage = false;
986                            switch (type) {
987                                case 'choose':
988                                    pollShowAnswerImage = (res.styles.poll_enable_answer_image_after_voting == "on") ? true : false;
989                                    if(pollShowAnswerImage){
990                                        var answerImage = typeof answer[widths[i].index].answer_img != "undefined" || typeof (answer[widths[i].index].answer_img) != "" ? answer[widths[i].index].answer_img : "";
991                                        var answerImageBox = $("<div class='ays-poll-answers-image-box-empty-image'></div>");
992                                        var answerImageIsEmptyClass = "ays-poll-answers-box-no-image";
993                                        if(answerImage != ""){
994                                            answerImageIsEmptyClass = "ays-poll-answers-box";
995                                            answerImageBox = $("<div class='ays-poll-answers-image-box'><img src="+answerImage+" class='ays-poll-answers-current-image'></div>");
996                                        }
997                                        var answerTextAndPercent = $("<div class='ays-poll-answer-text-and-percent-box'></div>");
998                                        var answerMainDiv = $('<div class='+answerImageIsEmptyClass+'></div>');
999                                    }
1000
1001                                    answerText = $('<span class="answer-text '+rightAnswerCheck+'"></span>');
1002                                    var htmlstr = stripSlashes(answer[widths[i].index].answer);
1003
1004                                    answerText.html(htmlstr);
1005                                    break;
1006                                case 'rate':
1007                                    switch (res.view_type) {
1008                                        case 'emoji':
1009                                            answerText = emojiAnswerCheck[res.answers.length / 2 + 1.5 - widths[i].index];
1010                                            break;
1011
1012                                        case 'star':
1013                                            for (var j = 0; j <= widths[i].index; j++) {
1014                                                answerText += starAnswerCheck;
1015                                            }
1016                                            break;
1017                                    }
1018                                    answerText = $('<span class="answer-text">'+answerText+'</span>');
1019                                    break;
1020                                case 'vote':
1021                                    switch (res.view_type) {
1022                                        case 'hand':
1023                                            answerText = handAnswerCheck[widths[i].index];
1024                                            break;
1025
1026                                        case 'emoji':
1027                                            answerText = emojiAnswerCheck[2 * widths[i].index + 1];
1028                                            break;
1029                                    }
1030                                    answerText = $('<span class="answer-text">'+answerText+'</span>');
1031                                    break;
1032                            }
1033                            
1034                            var answerVotes = $('<span class="answer-votes"></span>');
1035                            if(showvotescounts){
1036                            answerVotes.text(answer[widths[i].index].votes);
1037                            }
1038                            if(res.check_admin_approval){
1039                                if(type == 'choose'){
1040                                    answerDiv.append("<span class='ays_grid_answer_span' >"+poll_maker_ajax_public.thank_message+"</span>").appendTo("#"+formId+" .results-apm");
1041                                    break;
1042                                }
1043                            }
1044
1045                            if(!pollShowAnswerImage){
1046                                answerDiv.append(answerText).append(answerVotes).appendTo("#"+formId+" .results-apm");
1047                                $("#"+formId+" .results-apm").append(userMoreImage).append(answerBar);
1048                            }
1049                            else{
1050                                answerMainDiv.appendTo("#"+formId+" .results-apm");
1051                                answerImageBox.appendTo(answerMainDiv);
1052                                answerTextAndPercent.appendTo(answerMainDiv);
1053                                answerDiv.append(answerText).append(answerVotes).appendTo(answerTextAndPercent);
1054
1055                                if(typeof userMoreImage != "undefined"){
1056                                    answerTextAndPercent.append(userMoreImage);
1057                                }
1058                                
1059                                answerBar.appendTo(answerTextAndPercent); 
1060                            }
1061
1062                            $("#"+formId+" .ays_res_mess").fadeIn();
1063                            $('.redirectionAfterVote').show();
1064
1065                        }
1066
1067                        setTimeout(function() {
1068                            form.find('.answer-percent').each(function () {
1069                                var percent = $(this).attr('data-percent');
1070
1071                                $(this).css({
1072                                    width: (percent || 1) + '%'
1073                                });
1074
1075                                if (showrespercent) {
1076                                    var aaa = $(this);
1077                                    setTimeout(function() {
1078                                        aaa.text(percent > 5 ? percent + '%' : '');
1079                                    }, 200);
1080                                }
1081                            });
1082                        }, 100);
1083                    }
1084                }
1085
1086                // Remove disable from next button for category polls start
1087                form.parents('.ays_poll_category-container').find('.ays-poll-next-btn').prop('disabled', false);
1088                var vvv = form.parents('.ays_poll_category-container').attr("data-var");
1089                window['showNext' + vvv] = true;
1090                if (typeof(window['catIndex' + vvv]) != 'undefined') {
1091                    if (typeof(window['pollsGlobalPool'+vvv]) != 'undefined') {
1092                        if (window['catIndex' + vvv] == window['pollsGlobalPool' + vvv].length - 1) {
1093                            form.parents('.ays_poll_category-container').find('.ays-poll-next-btn').prop('disabled', true);
1094                        }
1095                    }
1096
1097                    if (window['catIndex' + vvv] == 0 && form.parents('.ays_poll_category-container').find('.results-apm').length > 0) {
1098                        form.parents('.ays_poll_category-container').find('.ays-poll-previous-btn').prop('disabled', true);
1099                    }
1100                }
1101                // Remove disable from next button for category polls end
1102
1103                if (form.attr('data-show-social') == 1) {
1104                    socialBtnAdd(formId, pollSocialButtons);
1105                }
1106                if (form.attr('data-enable-social-links') == 1) {
1107                    socialLinksAdd(formId, pollSocialLinks);
1108                }
1109                if (voteURLRedirection == 1) {
1110                    var url = form.attr('data-url-href');
1111                    var answerRedirectDelay = +form.attr('data-delay');
1112                    form.append(redirectMessage);
1113                    if (url !== '') {
1114                        setTimeout(function() {
1115                            location.href = url;
1116                        } , answerRedirectDelay * 1000);
1117                    }else{
1118                        $('.redirectionAfterVote').hide();
1119                    }                    
1120                }else{
1121                    voteURLRedirection = false;
1122                }
1123                if (voteRedirection == 1 && voteURLRedirection == false) {
1124                    var url = form.attr('data-href');
1125                    var delay = +form.attr('data-delay');
1126                    form.append(redirectMessage);
1127                    setTimeout(function() {
1128                        location.href = url;
1129                    }, delay * 1000);
1130                }
1131                if (isRestart == 'true') {
1132                    showRestart(formId);
1133                }
1134
1135                if(res.check_user_pic){
1136                    var checkModal = $(document).find(".ays-poll-avatars-modal-main");
1137                    if(checkModal.length < 1){
1138                    var avatarsModal = "<div class='ays-poll-avatars-modal-main'>" +
1139                                            "<div class='ays-poll-avatars-modal-content'>" +
1140                                                "<div class='ays-poll-avatars-preloader'>" +
1141                                                    "<img class='ays-poll-avatar-pic-loader' src="+res.check_user_pic_loader+">" +
1142                                                "</div>" +
1143                                                "<div class='ays-poll-avatars-modal-header'>" +
1144                                                    "<span class='ays-close' id='ays-poll-close-avatars-modal'>&times;</span>" +
1145                                                    "<span style='font-weight: bold;'></span>" +
1146                                                "</div>" +
1147                                                "<div class='ays-poll-modal-body' id='ays-poll-avatars-body'></div>" +
1148                                            "</div>" +
1149                                        "</div>";
1150                    $(document.body).append(avatarsModal);
1151                    }
1152                }
1153            },
1154            error: function () {
1155                loadEffect(formId, false , loadEffectFontSize,loadEffectMessage);
1156                $(".user-form-"+formId).fadeOut();
1157                form.parent().next().prop('disabled', false);
1158                $('.answer-' + formId).parent().parent().find('.apm-button-box').remove();
1159                $('.answer-' + formId).remove();
1160                btn.remove();
1161                $("#"+formId+" .ays_question").text("Something went wrong. Please reload page.");
1162            }
1163        });
1164
1165    }
1166
1167    function showRestart(formId) {
1168        var restartBtn = $('<div class="apm-button-box"><input type="button" class="btn ays-poll-btn btn-restart" onclick="location.reload()" value="'  + poll_maker_ajax_public.restart + '"></div>');
1169        $("#"+formId).append(restartBtn);
1170    }
1171
1172    if ($(document).find('#ays_res_without_see').length > 0) {
1173        
1174        let btn = $(document).find('#ays_res_without_see'),
1175            type = $(document).find('#ays_res_without_see').attr('data-polltype');
1176            
1177        voting( btn, type );
1178    }  
1179
1180    $(document).on('click', '.ays-poll-btn.choosing-btn', function () {
1181        voting( $(this), 'choose' );
1182    });
1183    $(document).on('click', '.ays-poll-btn.rating-btn', function () {
1184        voting( $(this), 'rate' );
1185    });
1186    $(document).on('click', '.ays-poll-btn.voting-btn', function () {
1187        voting( $(this), 'vote' );
1188    });
1189    $(document).on('click', '.ays-poll-btn.text-btn', function () {
1190        voting( $(this), 'text' );
1191    });
1192
1193    $(document).on('change', '.apm-answers-without-submit input', function () {
1194        if ($(this).parent().hasClass('apm-rating')) {
1195            voting($(this).parents('.box-apm').find('.apm-button-box input.ays_finish_poll'), 'rate');
1196        } else if ($(this).parent().hasClass('apm-voting')) {
1197            voting($(this).parents('.box-apm').find('.apm-button-box input.ays_finish_poll'), 'vote');
1198        } else if ($(this).parent().hasClass('apm-choosing')) {
1199            voting($(this).parents('.box-apm').find('.apm-button-box input.ays_finish_poll'), 'choose');
1200        }
1201    })
1202
1203    function delayCountDown(sec) {
1204        delaySec = parseInt(sec);
1205        var intervalSec = setInterval(function() {
1206            if (delaySec > 0) {
1207                delaySec--;
1208                $('.ays-poll-main').find('p.redirectionAfterVote span').text(delaySec);
1209            } else {
1210                clearInterval(intervalSec);
1211            }
1212        }, 1000);
1213    }
1214
1215    function resetPlaying(audelems) {
1216        audelems.pause();
1217        audelems.currentTime = 0;
1218    }
1219
1220    function validatePhoneNumber(input) {
1221        var phoneno = /^[+ 0-9-]+$/;
1222        if (typeof input !== 'undefined') {
1223            if (input.value.match(phoneno)) {
1224                return true;
1225            } else {
1226                return false;
1227            }
1228
1229        }
1230    }
1231
1232    /**
1233     * @return {string}
1234     */
1235    function GetFullDateTime(){
1236        var now = new Date();
1237        return [[now.getFullYear(), AddZero(now.getMonth() + 1), AddZero(now.getDate())].join("-"), [AddZero(now.getHours()), AddZero(now.getMinutes()), AddZero(now.getSeconds())].join(":")].join(" ");
1238    }
1239
1240    /**
1241     * @return {string}
1242     */
1243    function AddZero(num) {
1244        return (num >= 0 && num < 10) ? "0" + num : num + "";
1245    }
1246
1247    function hexToRgba(hex, alfa) {
1248        var c;
1249        if (alfa == null) {
1250            alfa = 1;
1251        }
1252        if (/^#([A-Fa-f0-9]{3}){1,2}$/.test(hex)) {
1253            c= hex.substring(1).split('');
1254            if(c.length== 3){
1255                c= [c[0], c[0], c[1], c[1], c[2], c[2]];
1256            }
1257            c= '0x'+c.join('');
1258            return 'rgba('+[(c>>16)&255, (c>>8)&255, c&255].join(',')+','+alfa+')';
1259        }
1260    }
1261
1262        function ays_poll_restriction_string( type, x, length ){
1263        var tval = '';
1264        if( x.length > 0 && x != null){
1265            tval = x.trim();
1266        }
1267        switch ( type ) {
1268            case 'characters':
1269                break;
1270            case 'words':
1271                if(tval.length > 0 && tval != null && tval.length != ''){
1272                    var wordsLength = tval.match(/\S+/g).length;
1273                    if (wordsLength > length) {
1274                        var trimmed = tval.split(/\s+/, length).join(" ");
1275                        x = trimmed + '...';
1276                    }
1277                }
1278                break;
1279            default:
1280                break;
1281        }
1282        return x;
1283    }
1284
1285    // Avatars modal start
1286
1287    // Open users avatars modal
1288    $(document).on('click', '.ays-user-image-more', function(e){
1289        $(document).find('div.ays-poll-avatars-preloader').css('display', 'flex');
1290        $(document).find('.ays-poll-avatars-modal-main').aysModal('show');
1291        var $this = $(this);
1292        var answer_id = $(this).data('answerId');
1293        var action = 'ays_poll_get_current_answer_users_pics';
1294        data = {};
1295        data.action = action;
1296        data.answer_id = answer_id;
1297        $.ajax({
1298            url: poll_maker_ajax_public.ajax_url,
1299            dataType: 'json',
1300            method:'post',
1301            data: data,
1302            success: function(response){
1303                    for(var avatars of response){
1304                        $('div#ays-poll-avatars-body').append(avatars);
1305
1306                    }
1307                    var answerTitle = $this.parents(".ays-user-count").prev().find(".answer-text").html();
1308                    $(document).find('div.ays-poll-avatars-preloader').css('display', 'none');
1309                    $(document).find('div.ays-poll-avatars-modal-header span:nth-child(2)').append(answerTitle);
1310            }
1311        });
1312    });
1313
1314    // Close users avatars modal
1315    $(document).on('click', '.ays-close', function () {
1316        $(document).find('.ays-poll-avatars-modal-main').aysModal('hide');
1317        setTimeout(function(){
1318            $(document).find('div#ays-poll-avatars-body').html('');
1319            $(document).find('div.ays-poll-avatars-modal-header span:nth-child(2)').html('');
1320        }, 250);
1321    });
1322
1323    // Cldoe users avatars modal with ESC button
1324    $(document).on("keydown", function(e){
1325        if(e.keyCode === 27){
1326            $(document).find('.ays-close').trigger('click');
1327            return false;
1328        }
1329    });
1330
1331    if(typeof idChecker !== 'undefined'){
1332        var checkResShow = $(document).find("#"+idChecker);
1333        if(checkResShow.data("loadMethod")){
1334            var checkModal = $(document).find(".ays-poll-avatars-modal-main");
1335            if(checkModal.length < 1){
1336                var avatarsModal = "<div class='ays-poll-avatars-modal-main'>" +
1337                                        "<div class='ays-poll-avatars-modal-content'>" +
1338                                            "<div class='ays-poll-avatars-preloader'>" +
1339                                            "<img class='ays-poll-avatar-pic-loader' src="+resLoader+">" +
1340                                            "</div>" +
1341                                            "<div class='ays-poll-avatars-modal-header'>" +
1342                                                "<span class='ays-close' id='ays-poll-close-avatars-modal'>&times;</span>" +
1343                                                "<span style='font-weight: bold;'></span>" +
1344                                            "</div>" +
1345                                            "<div class='ays-poll-modal-body' id='ays-poll-avatars-body'></div>" +
1346                                        "</div>" +
1347                                    "</div>";
1348                $(document.body).append(avatarsModal);
1349            }
1350        }
1351    }
1352    // Avatars modal end
1353
1354})(jQuery);;
1355(function($) {
1356    window.FontAwesomeConfig = {
1357        autoReplaceSvg: false
1358    }
1359
1360    $(document).ready(function() {
1361        var active = false;
1362        var emailValivatePattern = /^[a-zA-Z0-9\._-]+@[a-zA-Z0-9\._-]+\.\w{2,}$/;
1363        $(document).on('mouseleave', '.rating-poll .apm-answers', function() {
1364            if ($(this).find('label:not(.emoji)').length > 0) {
1365                var allRateLabels = $(this).find('label');
1366                if (active) {
1367                    var index = -1;
1368                    allRateLabels.each(function() {
1369                        if ($(this).hasClass('active-answer')) {
1370                            index = allRateLabels.index(this);
1371                        }
1372                    })
1373                    for (var i = 0; i < allRateLabels.length; i++) {
1374                        if (i > index) {
1375                            allRateLabels.eq(i).find('i').removeClass('fas').addClass('far');
1376                        } else {
1377                            allRateLabels.eq(i).find('i').removeClass('far').addClass('fas');
1378                        }
1379                    }
1380                } else {
1381                    allRateLabels.each(function() {
1382                        $(this).find('i').removeClass('fas').addClass('far');
1383                    })
1384                }
1385            }
1386        })
1387
1388        $(document).on('click', '.rating-poll label:not(.emoji)', function(){
1389            $(this).parent().parent().find('label').each(function() {
1390                $(this).removeClass('active-answer');
1391            })
1392            $(this).addClass('active-answer');
1393            active = true;
1394        });
1395
1396        $(document).on('mouseover', '.rating-poll label:not(.emoji)', function(){
1397            var allRateLabels = $(this).parent().parent().find('label');
1398            var index = allRateLabels.index(this);
1399            allRateLabels.each(function() {
1400                $(this).find('i').removeClass('fas').addClass('far');
1401            });
1402            for (var i = 0; i <= index; i++) {
1403                allRateLabels.eq(i).find('i').removeClass('far').addClass('fas');
1404            }
1405        });
1406
1407        $(document).on('mouseleave', '.rating-poll .apm-answers', function() {
1408            if ($(this).find('label.emoji').length > 0) {
1409                var $this = $(this);
1410                if (active) {
1411                    var index = -1;
1412                    $this.find('label.emoji').each(function() {
1413                        if ($(this).hasClass('active-answer')) {
1414                            index = $this.find('label.emoji').index(this);
1415                        }
1416                    });
1417                    for (var i = 0; i < $this.find('label.emoji').length; i++) {
1418                        if (i != index) {
1419                            $this.find('label.emoji').eq(i).find('i').removeClass('fas').addClass('far');
1420                        } else {
1421                            $this.find('label.emoji').eq(i).find('i').removeClass('far').addClass('fas');
1422                        }
1423                    }
1424                } else {
1425                    $this.find('label.emoji').each(function() {
1426                        $(this).find('i').removeClass('fas').addClass('far');
1427                    });
1428                }
1429            }
1430        });
1431
1432        $(document).on('mouseover', '.rating-poll label.emoji', function() {
1433            var $this = $(this);
1434            var thisLabels = $this.parent().parent().find('label.emoji');
1435            var index = thisLabels.index(this);
1436
1437            thisLabels.each(function() {
1438                $(this).find('i').removeClass('fas').addClass('far');
1439            });
1440            thisLabels.eq(index).find('i').removeClass('far').addClass('fas');
1441        });
1442
1443        $(document).on('click', '.rating-poll label.emoji', function() {
1444            var thisLabels = $(this).parent().parent().find('label.emoji');
1445            thisLabels.each(function() {
1446                $(this).removeClass('active-answer');
1447            })
1448            $(this).addClass('active-answer');
1449            active = true;
1450        });
1451
1452        $(document).on('mouseleave', '.voting-poll .apm-answers', function() {
1453            var index = -1;
1454            var labels = $(this).find('label');
1455            if (active) {
1456                labels.each(function() {
1457                    if ($(this).hasClass('active-answer')) {
1458                        index = labels.index(this);
1459                    }
1460                });
1461                for (var i = 0; i < labels.length; i++) {
1462                    if (i != index) {
1463                        labels.eq(i).find('i').removeClass('fas').addClass('far');
1464                    } else {
1465                        labels.eq(i).find('i').removeClass('far').addClass('fas');
1466                    }
1467                }
1468            } else {
1469                labels.each(function() {
1470                    $(this).find('i').removeClass('fas').addClass('far');
1471                });
1472            }
1473        });
1474
1475        $(document).on('mouseover', '.voting-poll label', function() {
1476            var $this = $(this);
1477            var index = $this.parent().parent().find('label').index(this);
1478            $this.parent().parent().find('label').each(function() {
1479                $(this).find('i').removeClass('fas').addClass('far');
1480            });
1481            $this.parent().parent().find('label').eq(index).find('i').removeClass('far').addClass('fas');
1482        });
1483
1484        $(document).on('click', '.voting-poll label', function() {
1485            var $this = $(this);
1486            $this.parent().parent().find('label').each(function() {
1487                $(this).removeClass('active-answer');
1488            });
1489            $(this).addClass('active-answer');
1490            active = true;
1491        });
1492
1493        $('.redirect-after-vote-url').on('click', function(e) {
1494            var x = $(this).attr('data-answers-url');
1495            var multivoteActivated = $(document).find('#ays_poll_multivote_min_count').length;
1496            var finalUrl = "";
1497
1498            if (multivoteActivated > 0) {
1499                var checkedBoxes =  $(this).parents(".apm-answers").find("input:checkbox:checked");
1500
1501                for(var i = 0; i <= checkedBoxes.length; i ++) {
1502                    var answersUrl = checkedBoxes.eq(i).next().attr('data-answers-url');
1503
1504                    if(typeof answersUrl !== 'undefined' && answersUrl !== false) {
1505                        finalUrl = answersUrl;
1506                        break;
1507                    }
1508                    else {
1509                        finalUrl = $(this).attr('data-answers-url');
1510                    }
1511                }
1512                var url = $(this).parents(".box-apm").attr('data-url-href', finalUrl);
1513            }
1514            else if(multivoteActivated == 0) {
1515                var url = $(this).parents(".box-apm").attr('data-url-href', x);
1516            }
1517        });
1518
1519        $('.poll_answers_sound').on('click', function(e) {
1520            var answers_sound = $(this).parents('.ays-poll-main').find('.ays_poll_ans_sound').get(0);            
1521            if(answers_sound){
1522                resetPlaying(answers_sound);
1523                setTimeout(function(){
1524                    answers_sound.play();
1525                }, 10);
1526            }
1527        });
1528
1529        $(document).on('click','.ays-poll-view-more-button', function(e) {
1530            var $this = $(this);
1531            var parent = $this.parents('.ays-poll-main ');
1532            var pollAnswers = parent.find('.apm-answers .apm-choosing');
1533
1534            pollAnswers.each(function(e) {
1535                if ($(this).hasClass('ays_poll_display_none')) {
1536                    $(this).removeClass('ays_poll_display_none');
1537                }
1538            });
1539
1540            $this.parents('.ays-poll-view-more-button-box').addClass('ays_poll_display_none');
1541        });
1542
1543        $(document).on('mouseover', '.ays-poll-logo-image-url-link', function () {
1544            if($(this).attr("href") == "javascript:void(0)") {
1545                $(this).css('cursor', 'auto');
1546            }
1547        })
1548            
1549        //Users limitations 
1550        if ($('.apm-redirection').length > 0) {
1551            $('.apm-redirection').each(function(e) {
1552                var url = $(this).find('p').attr('data-href');
1553                var delay = +$(this).find('p').attr('data-delay');
1554                var formId = $(this).find('p').attr('data-id');
1555                setTimeout(function() {
1556                    var interval = setInterval(function() {
1557                        if (delay > 0) {
1558                            delay--;
1559                            $(this).find('p b').text(secsToText(delay));
1560                        } else {
1561                            clearInterval(interval);
1562                            location.href = url;
1563                        }
1564                    }, 1000);
1565                }, 1500);
1566            })
1567        }
1568
1569        function secsToText(sec) {
1570            /*** get the hours ***/
1571            var hours = ((sec / 3600) % 24).toFixed(0);
1572            if (hours > 0) hours = hours < 10 ? '0'+hours : hours;
1573            else hours = '00';
1574            /*** get the minutes ***/
1575            var minutes = ((sec / 60) % 60).toFixed(0);
1576            if (minutes > 0) minutes = minutes < 10 ? '0'+minutes : minutes;
1577            else minutes = '00';
1578            /*** get the seconds ***/
1579            var seconds = (sec % 60).toFixed(0);
1580            if (seconds > 0) seconds = seconds < 10 ? '0'+seconds : seconds;
1581            else seconds = '00';
1582
1583            return hours+':'+minutes+':'+seconds;
1584        }
1585
1586        $(document).on('input', '.ays_animated_xms', function(){
1587            $(document).find('.apm-info-form input[name]').each(function () {
1588                $(this).removeClass('ays_poll_shake');
1589            });
1590            $(this).removeClass('ays_red_border');
1591            $(this).removeClass('ays_green_border');
1592            if ($(this).attr('type') !== 'hidden' && $(this).attr('name') != 'apm_email') {
1593                if($(this).val() == '' && $(this).data('required')){
1594                    $(this).addClass('ays_red_border');
1595                }else{
1596                    $(this).addClass('ays_green_border');
1597                }                
1598            }else if($(this).attr('type') !== 'hidden'){
1599                if($(this).val() != ''){
1600                    if (!(emailValivatePattern.test($(this).val()))) {
1601                        $(this).addClass('ays_red_border');
1602                    }else{
1603                        $(this).addClass('ays_green_border');
1604                    }
1605                }
1606            }
1607        });
1608
1609        $(document).on('input', '.amp-info-form-input-box input[name="apm_phone"]', function(){
1610            if ($(this).attr('type') !== 'hidden') {
1611                $(this).removeClass('ays_red_border');
1612                $(this).removeClass('ays_green_border');
1613                if($(this).val() != ''){
1614                    if (!(/^[+ 0-9-]+$/.test($(this).val()))) {
1615                        $(this).addClass('ays_red_border');
1616                    }else{
1617                        $(this).addClass('ays_green_border');
1618                    }
1619                }
1620            }
1621        });
1622
1623        function resetPlaying(audelems) {
1624                audelems.pause();
1625                audelems.currentTime = 0;
1626        }
1627        //AV Countdown date
1628        var poll_id =  $(document).find('.box-apm').data('id');
1629
1630        $(document).find('.show_timer_countdown').each(function(e){
1631            // Countdown date
1632            var countDownEndDate = $(this).data('timer_countdown');
1633            var this_poll_id = $(this).parents(".ays-poll-main").attr("id");
1634            var refreshButton = "<input type='button' id='ays_refresh_btn_"+this_poll_id+"' class='btn ays-poll-btn btn-restart' style='text-align:center;' value='Refresh'>";
1635            if (countDownEndDate != '' && countDownEndDate != undefined) {
1636                ays_countdown_datetime(countDownEndDate, this_poll_id);
1637            }
1638        });
1639
1640        function ays_countdown_datetime(sec, poll_id) {
1641            var distance = sec*1000;
1642            var x_int;
1643
1644            // Update the count down every 1 second
1645            x_int = setInterval(function() {
1646                // Time calculations for days, hours, minutes and seconds
1647                var days = Math.floor(distance / (1000 * 60 * 60 * 24));
1648                var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
1649                var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
1650                var seconds = Math.floor((distance % (1000 * 60)) / 1000);
1651
1652                // Output the result in an element with id="demo"
1653                var text = "";
1654
1655                if(days > 0){
1656                    text += days + " ";
1657                    if(days == 1){
1658                        text += poll_maker_ajax_public.day + " ";
1659                    }else{
1660                        text += poll_maker_ajax_public.days + " ";
1661                    }
1662                }
1663
1664                if(hours > 0){
1665                    text += hours + " ";
1666                    if(hours == 1){
1667                        text += poll_maker_ajax_public.hour + " ";
1668                    }else{
1669                        text += poll_maker_ajax_public.hours + " ";
1670                    }
1671                }
1672
1673                if(minutes > 0){
1674                    text += minutes + " ";
1675                    if(minutes == 1){
1676                        text += poll_maker_ajax_public.minute + " ";
1677                    }else{
1678                        text += poll_maker_ajax_public.minutes + " ";
1679                    }
1680                }
1681
1682                text += seconds + " " + poll_maker_ajax_public.seconds;
1683
1684                jQuery(document).find( "#"+ poll_id +" .show_timer_countdown" ).html(text);
1685
1686                // If the count down is over, write some text
1687                if (distance > 0) {
1688                    distance -= 1000;
1689                }
1690                if (distance <= 0) {
1691                    clearInterval(x_int);
1692                    jQuery(document).find( "#"+ poll_id +" .show_timer_countdown" ).html('');
1693                }
1694                if(distance == 0){
1695                    location.reload();
1696                }
1697            }, 1000);
1698        }
1699
1700        $(document).on('click', '#ays_refresh_btn_'+poll_id, function(){
1701            location.reload();
1702        });
1703
1704        // Answer Sound Muter
1705        $(document).on('click', '.ays_music_sound', function() {
1706            var $this = $(this);
1707            var pollCoutainer = $this.parents('.ays-poll-main');
1708            var audioEl = pollCoutainer.find('.ays_poll_ans_sound').get(0);
1709            if($this.hasClass('ays_sound_active')){
1710                audioEl.volume = 0;
1711                $this.find('.ays_poll_far').addClass('ays_poll_fa-volume_off').removeClass('ays_poll_fa-volume_up');
1712                $this.removeClass('ays_sound_active');
1713            } else {
1714                audioEl.volume = 1;
1715                $this.find('.ays_poll_far').addClass('ays_poll_fa-volume_up').removeClass('ays_poll_fa-volume_off');
1716                $this.addClass('ays_sound_active');
1717            }
1718        });
1719
1720        // Allow Multivote
1721        $(document).on('change', '.apm-choosing' , function(){
1722            var numberOfChecked = $(this).parent().find("input:checkbox:checked").length;
1723            var multivote_answer_count = $(this).parent().find("#multivot_answer_count").val();
1724            var pollMultivoteMinCount = $(this).parent().find("#ays_poll_multivote_min_count").val();
1725            var numberNotChecked = $(this).parent().find('input:checkbox:not(":checked")');
1726            var numberAllAnswers = $(this).parents("form").find('input:checkbox').length;
1727            var voteButton = $(this).parents("form").find("input[name='ays_finish_poll']");
1728            var otherAnswer = $(this).parent().find('input.ays-poll-new-answer-apply-text');
1729            otherAnswer.attr("data-votes" , numberOfChecked);
1730            if(otherAnswer.length > 0){
1731                var otherAnswerVotes = otherAnswer.data("votes");
1732                var otherAnswerVal = otherAnswer.val();
1733                if(otherAnswerVal != ""){
1734                    otherAnswer.attr("data-votes" , numberOfChecked+1);
1735                    otherAnswerVotes = numberOfChecked+1;
1736                }
1737                if (numberOfChecked >= multivote_answer_count && otherAnswerVal == ""){
1738                    otherAnswer.attr("data-votes" , numberOfChecked);
1739                    numberNotChecked.prop( "disabled", true );
1740                    otherAnswer.prop( "disabled", true );
1741                    otherAnswer.css( "opacity", "0.5" );
1742                } else if (otherAnswerVotes >= multivote_answer_count) {
1743                    numberNotChecked.prop( "disabled", true );
1744                } else{
1745                    numberNotChecked.prop( "disabled", false );
1746                    otherAnswer.prop( "disabled", false );
1747                    otherAnswer.css( "opacity", "1" );
1748                }
1749
1750                if (numberAllAnswers < pollMultivoteMinCount) {
1751                    pollMultivoteMinCount = numberAllAnswers;
1752                }
1753                
1754                if (otherAnswerVal == "") {
1755                    if(pollMultivoteMinCount > numberOfChecked){
1756                        voteButton.css("opacity" , "0.5");
1757                    } else {
1758                        voteButton.css("opacity" , "1");
1759                    }
1760                } else {
1761                    if (pollMultivoteMinCount > otherAnswerVotes) {
1762                        voteButton.css("opacity" , "0.5");
1763                    } else {
1764                        voteButton.css("opacity" , "1");
1765                    }
1766                }
1767            }
1768            else{
1769                if(numberOfChecked >= multivote_answer_count){
1770                    numberNotChecked.prop( "disabled", true );
1771                } else {
1772                    numberNotChecked.prop( "disabled", false );
1773                }
1774
1775                if (numberAllAnswers < pollMultivoteMinCount){
1776                    pollMultivoteMinCount = numberAllAnswers;
1777                }
1778                
1779                if (pollMultivoteMinCount > numberOfChecked){
1780                    voteButton.css("opacity" , "0.5");
1781                } else {
1782                    voteButton.css("opacity" , "1");
1783                }
1784            }
1785        });
1786
1787        $(document).find(".ays-poll-new-answer-apply-text").on("input" , function(){
1788            var _this = $(this);
1789            var voteButton = _this.parents("form").find("input[name='ays_finish_poll']");
1790            var allowMultivoteCheck = _this.parents("form").find('input#ays_poll_multivote_min_count').data("allow");
1791            var pollMultivoteMinCount = _this.parents(".apm-answers").find("#ays_poll_multivote_min_count").val();
1792            var CheckedBoxes = _this.parents(".apm-answers").find("input:checkbox:checked");
1793            var numberOfChecked = CheckedBoxes.length;
1794            if(_this.val() != ""){
1795                numberOfChecked++;
1796            }
1797            var noteBox = _this.parents(".apm-add-answer").next();
1798            if(noteBox.hasClass('ays-poll-add-answer-note-enable')){
1799                noteBox.slideDown(200);
1800                noteBox.removeClass("ays-poll-add-answer-note-enable");
1801            }
1802            else if(_this.val() == ''){
1803                noteBox.addClass("ays-poll-add-answer-note-enable");
1804                noteBox.slideUp(200);
1805            }
1806            if(allowMultivoteCheck){
1807                if(pollMultivoteMinCount > numberOfChecked){
1808                    voteButton.css("opacity" , "0.5");
1809                }
1810                else{
1811                    voteButton.css("opacity" , "1");
1812                }
1813            }
1814        });
1815
1816        var questionTypeText = $(document).find('textarea.ays-poll-text-types-inputs-only-textarea');
1817        autosize(questionTypeText);
1818
1819        $(document).find('textarea.ays_poll_question_limit_length, input.ays_poll_question_limit_length').on('keyup keypress', function(e) {
1820            var $this = $(this);
1821            var limitType = $this.data("limitType");
1822            var limitMaxLength = $this.data("maxLength");
1823            var limitTextMessage = $this.parents(".ays-poll-maker-text-answer-main").find('.ays_poll_question_text_message_span');
1824
1825            var remainder = '';
1826            if(limitMaxLength != '' && limitMaxLength != 0){
1827                switch ( limitType ) {
1828                    case 'characters':
1829                        var tval = $this.val();
1830                        var tlength = tval.length;
1831                        var set = limitMaxLength;
1832                        var remain = parseInt(set - tlength);
1833                        if (remain <= 0 && e.which !== 0 && e.charCode !== 0) {
1834                            $this.val((tval).substring(0, tlength - 1));
1835                        }
1836                        if (e.type=="keyup") {
1837                            var tval = $this.val().trim();
1838                            if(tval.length > 0 && tval != null){
1839                                var wordsLength = this.value.split('').length;
1840                                if (wordsLength > limitMaxLength) {
1841                                    var trimmed = tval.split('', limitMaxLength).join("");
1842                                    $this.val(trimmed);
1843                                }
1844                            }
1845                        }
1846                        remainder = remain;
1847                        break;
1848                    case 'words':
1849                        if (e.type=="keyup") {
1850                            var tval = $this.val().trim();
1851                            if(tval.length > 0 && tval != null){
1852                                var wordsLength = this.value.match(/\S+/g).length;
1853                                if (wordsLength > limitMaxLength) {
1854                                    var trimmed = tval.split(/\s+/, limitMaxLength).join(" ");
1855                                    $this.val(trimmed + " ");
1856                                }
1857                                remainder = limitMaxLength - wordsLength;
1858                            }
1859                        }
1860                        break;
1861                    default:
1862                        break;
1863                }
1864                if (e.type=="keyup") {
1865                    if ( limitTextMessage ) {
1866                        if(limitMaxLength != '' && limitMaxLength != 0){
1867                            if (remainder <= 0) {
1868                                remainder = 0;
1869                            }
1870                            if (tval.length == 0 || tval == null) {
1871                                remainder = limitMaxLength;
1872                            }
1873                        }
1874                        limitTextMessage.html( remainder );
1875                    }
1876                }
1877            }
1878        });
1879
1880        $(document).on('click', '.ays-poll-password-toggle', function(e){
1881            var $this  = $(this);
1882            
1883            var parent = $this.parents('.ays-poll-password-input-box-visibility');
1884            var passwordInput = parent.find('.ays-poll-password-input');
1885
1886            var visibilityOn  = parent.find('.ays-poll-password-toggle-visibility');
1887            var visibilityOff = parent.find('.ays-poll-password-toggle-visibility-off');
1888
1889            if( $this.hasClass('ays-poll-password-toggle-visibility-off') ) {
1890                passwordInput.attr('type', 'text');
1891                    
1892                if ( visibilityOn.hasClass('ays_poll_display_none') ) {
1893                    visibilityOn.removeClass('ays_poll_display_none');
1894                }
1895
1896                if ( ! visibilityOff.hasClass('ays_poll_display_none') ) {
1897                    visibilityOff.addClass('ays_poll_display_none');
1898                }
1899
1900            } else if( $this.hasClass('ays-poll-password-toggle-visibility') ) {
1901                passwordInput.attr('type', 'password');
1902
1903                if ( ! visibilityOn.hasClass('ays_poll_display_none') ) {
1904                    visibilityOn.addClass('ays_poll_display_none');
1905                }
1906
1907                if ( visibilityOff.hasClass('ays_poll_display_none') ) {
1908                    visibilityOff.removeClass('ays_poll_display_none');
1909                }                
1910            }
1911        });
1912        
1913
1914    })
1915})(jQuery);;
1916(function($) {
1917	'use strict'
1918
1919    $(document).ready(function() {
1920        var widthForNext = 1;
1921        var widthForPrev = 0;
1922        var containers = $(document).find('.ays_poll_category-container');
1923
1924        containers.each(function() {
1925            var $j = $(this).attr('data-var');
1926            var catContainer = $('#' + window['catContainer' + $j]);
1927            catContainer.append(window['pollsGlobalPool' + $j][window['catIndex' + $j]]);
1928
1929            var previousNextBtnContainer = $("<div class='previous_next_buttons'></div>");
1930            var btn = $("<button id='catBtn" + $j + "' class='ays-poll_previous_next_buttons ays-poll-next-btn ays_p_n_buttons" + $j + "' type='button' data-name='next'> " + window['aysPollBtnText' + $j] + " </button>");
1931            var previousBtn = $("<button id='previousBtn" + $j + "' class='ays-poll_previous_next_buttons ays-poll-previous-btn ays_p_n_buttons" + $j + "' type='button' data-name='previous'> " + window['aysPollPreviousBtnText' + $j] + "</button>");
1932            btn.css(dataCss);
1933            previousBtn.css(dataCss);
1934
1935            if (catContainer.find('.apm-need-sign-in').length > 0 || !window['showNext' + $j]) {
1936                btn.prop('disabled', true);
1937            } else {
1938            	btn.prop('disabled', !window['showNext' + $j]);
1939            }
1940
1941            if (window['catIndex' + $j] != 0 ) {
1942                previousBtn.prop('disabled', false);
1943            } else {
1944                previousBtn.prop('disabled', true);
1945            }
1946
1947            if (window['pollsGlobalPool'+$j].length == 1) {
1948                btn.prop('disabled', true);
1949            }
1950
1951            var nextPrevButtonsWidths = JSON.parse(window['aysPollWidths'+$j]);
1952            $(document).on('click', ".ays_p_n_buttons" + $j, function() {
1953                if (window['showNext' + $j]) {
1954                    if($(this).attr('data-name') == 'next') {
1955                        if(nextPrevButtonsWidths[widthForNext] == "0px") {
1956                            nextPrevButtonsWidths[widthForNext] = "100%";
1957                        }
1958
1959                        $(this).parent().css("width", nextPrevButtonsWidths[widthForNext]);
1960                        previousBtn.prop('disabled', false);
1961
1962                        var previousPollHtml = emptyCatCont($(this));
1963                        window['pollsGlobalPool' + $j][window['catIndex' + $j]] = previousPollHtml;
1964                        window['catIndex'+ $j]++;
1965                        if(typeof(window['pollsGlobalPool' + $j][window['catIndex' + $j]]) != 'undefined'){
1966                            catContainer.empty().append(window['pollsGlobalPool' + $j][window['catIndex' + $j]]);
1967                        }
1968
1969                        catContainer.append(previousNextBtnContainer);
1970                        var checkIfVoted = catContainer.find('.results-apm').length > 0 ? true : false;
1971                        if (window['catIndex' + $j] != window['pollsGlobalPool' + $j].length - 1) {
1972                            if (catContainer.find('.apm-need-sign-in').length > 0 || !window['showNext'+$j]) {
1973                                btn.prop('disabled', true);
1974                            } else {
1975                                var checkVal = false;
1976                                if (window['showNextVal'+$j] == false) {
1977                                    checkVal = true;
1978                                }
1979                                btn.prop('disabled', checkVal);
1980                            }
1981
1982                            if(checkIfVoted) {
1983                                btn.prop('disabled', false);
1984                            }
1985                        } else {
1986                            btn.prop('disabled', true);
1987                        }
1988
1989                        widthForPrev++;
1990                        widthForNext++;
1991                    } else if($(this).attr('data-name') == 'previous') {
1992                        widthForNext--;
1993                        widthForPrev--;
1994
1995                        if (widthForPrev == 0) {
1996                            widthForPrev == "100%";
1997                        }
1998
1999                        if (nextPrevButtonsWidths[widthForPrev] == "0px") {
2000                            nextPrevButtonsWidths[widthForPrev] = "100%";
2001                        }
2002
2003                        $(this).parent().css("width", nextPrevButtonsWidths[widthForPrev]);
2004                        var nextPollHtml = emptyCatCont($(this));
2005
2006                        window['pollsGlobalPool' + $j][window['catIndex' + $j]] = nextPollHtml;
2007                        window['catIndex' + $j]--;
2008
2009                        btn.prop('disabled', false);
2010                        previousBtn.prop('disabled', false);
2011                        catContainer.empty().append(window['pollsGlobalPool' + $j][window['catIndex' + $j]]);
2012                        catContainer.append(previousNextBtnContainer);
2013                        if (window['catIndex' + $j] == 0) {
2014                            previousBtn.prop('disabled', true);
2015                        }
2016                    }
2017                } else {
2018                    window['catIndex' + $j] = 0;
2019                }
2020            });
2021
2022            $(document).on('click', ".ays-poll_previous_next_buttons" ,function() {
2023                $(document).find(".ays-poll_previous_next_buttons").css(dataCss);
2024            });
2025
2026            $(document).on('mouseleave', ".ays_p_n_buttons" + $j, function() {
2027                $(this).css(dataCss);
2028            });
2029
2030            $(document).on('mouseenter', ".ays_p_n_buttons" + $j, function() {
2031                $(this).css(hoverCss);
2032            });
2033
2034            previousNextBtnContainer.append(previousBtn);
2035            previousNextBtnContainer.append(btn);
2036            catContainer.append(previousNextBtnContainer);
2037
2038            if (!window['showNext' + $j]) {
2039                btn.prop('disabled', true);
2040            }
2041        });
2042
2043        function emptyCatCont(current) {
2044            var content1 = current.parents('.ays_poll_category-container').clone();
2045            var prevPollHtml = '';
2046
2047            if (content1.find('.ays-poll_previous_next_buttons').length > 0) {
2048                content1.find('.previous_next_buttons').remove();
2049                prevPollHtml = content1.html();
2050                return prevPollHtml;
2051            }
2052
2053            return false;
2054        }
2055    });
2056
2057})(jQuery);;
2058/*!
2059	autosize 4.0.2
2060	license: MIT
2061	http://www.jacklmoore.com/autosize
2062*/
2063!function(e,t){if("function"==typeof define&&define.amd)define(["module","exports"],t);else if("undefined"!=typeof exports)t(module,exports);else{var n={exports:{}};t(n,n.exports),e.autosize=n.exports}}(this,function(e,t){"use strict";var n,o,p="function"==typeof Map?new Map:(n=[],o=[],{has:function(e){return-1<n.indexOf(e)},get:function(e){return o[n.indexOf(e)]},set:function(e,t){-1===n.indexOf(e)&&(n.push(e),o.push(t))},delete:function(e){var t=n.indexOf(e);-1<t&&(n.splice(t,1),o.splice(t,1))}}),c=function(e){return new Event(e,{bubbles:!0})};try{new Event("test")}catch(e){c=function(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!1),t}}function r(r){if(r&&r.nodeName&&"TEXTAREA"===r.nodeName&&!p.has(r)){var e,n=null,o=null,i=null,d=function(){r.clientWidth!==o&&a()},l=function(t){window.removeEventListener("resize",d,!1),r.removeEventListener("input",a,!1),r.removeEventListener("keyup",a,
2063!1),r.removeEventListener("autosize:destroy",l,!1),r.removeEventListener("autosize:update",a,!1),Object.keys(t).forEach(function(e){r.style[e]=t[e]}),p.delete(r)}.bind(r,{height:r.style.height,resize:r.style.resize,overflowY:r.style.overflowY,overflowX:r.style.overflowX,wordWrap:r.style.wordWrap});r.addEventListener("autosize:destroy",l,!1),"onpropertychange"in r&&"oninput"in r&&r.addEventListener("keyup",a,!1),window.addEventListener("resize",d,!1),r.addEventListener("input",a,!1),r.addEventListener("autosize:update",a,!1),r.style.overflowX="hidden",r.style.wordWrap="break-word",p.set(r,{destroy:l,update:a}),"vertical"===(e=window.getComputedStyle(r,null)).resize?r.style.resize="none":"both"===e.resize&&(r.style.resize="horizontal"),n="content-box"===e.boxSizing?-(parseFloat(e.paddingTop)+parseFloat(e.paddingBottom)):parseFloat(e.borderTopWidth)+parseFloat(e.borderBottomWidth),isNaN(n)&&(n=0),a()}function s(e){var t=r.style.width;r.style.width="0px",r.offsetWidth,r.style.width=t,r.style.overflowY=e}function u(){if(0!==r.scrollHeight){var e=function(e){for(var t=[];e&&e.parentNode&&e.parentNode instanceof Element;)e.parentNode.scrollTop&&t.push({node:e.parentNode,scrollTop:e.parentNode.scrollTop}),e=e.parentNode;return t}(r),t=document.documentElement&&document.documentElement.scrollTop;r.style.height="",r.style.height=r.scrollHeight+n+"px",o=r.clientWidth,e.forEach(function(e){e.node.scrollTop=e.scrollTop}),t&&(document.documentElement.scrollTop=t)}}function a(){u();var e=Math.round(parseFloat(r.style.height)),t=window.getComputedStyle(r,null),n="content-box"===t.boxSizing?Math.round(parseFloat(t.height)):r.offsetHeight;if(n<e?"hidden"===t.overflowY&&(s("scroll"),u(),n="content-box"===t.boxSizing?Math.round(parseFloat(window.getComputedStyle(r,null).height)):r.offsetHeight):"hidden"!==t.overflowY&&(s("hidden"),u(),n="content-box"===t.boxSizing?Math.round(parseFloat(window.getComputedStyle(r,null).height)):r.offsetHeight),i!==n){i=n;var o=c("autosize:resized");try{r.dispatchEvent(o)}catch(e){}}}}function i(e){var t=p.get(e);t&&t.destroy()}function d(e){var t=p.get(e);t&&t.update()}var l=null;"undefined"==typeof window||"function"!=typeof window.getComputedStyle?((l=function(e){return e}).destroy=function(e){return e},l.update=function(e){return e}):((l=function(e,t){return e&&Array.prototype.forEach.call(e.length?e:[e],function(e){return r(e)}),e}).destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],i),e},l.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],d),e}),t.default=l,e.exports=t.default});;
2064(function ($) {
2065
2066    'use strict';
2067
2068    g1.backToTop = function () {
2069        var $scrollToTop = $('.g1-back-to-top');
2070
2071        // init
2072        toggleVisibility($scrollToTop);
2073
2074        $scrollToTop.on('click', function (e) {
2075            e.preventDefault();
2076
2077            var multipier = 200;
2078            var durationRange = {
2079                min: 200,
2080                max: 1000
2081            };
2082
2083            var winHeight = $(window).height();
2084            var docHeight = $(document).height();
2085            var proportion = Math.floor(docHeight / winHeight);
2086
2087            var duration = proportion * multipier;
2088
2089            if (duration < durationRange.min) {
2090                duration = durationRange.min;
2091            }
2092
2093            if (duration > durationRange.max) {
2094                duration = durationRange.max;
2095            }
2096
2097            $('html, body').animate({
2098                scrollTop: 0
2099            }, duration);
2100        });
2101
2102        $(window).scroll(function() {
2103            window.requestAnimationFrame(function () {
2104                toggleVisibility($scrollToTop);
2105            });
2106        });
2107    };
2108
2109    function toggleVisibility ($scrollToTop) {
2110        if ($(window).scrollTop() > 240) {
2111            $scrollToTop.addClass('g1-back-to-top-on').removeClass('g1-back-to-top-off');
2112        } else {
2113            $scrollToTop.addClass('g1-back-to-top-off').removeClass('g1-back-to-top-on');
2114        }
2115    }
2116
2117    $(document).ready(function () {
2118        g1.backToTop();
2119    });
2120})(jQuery);
2121
2122;

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.