PluginProbe
Poll Maker by AYS – Versus Polls, Anonymous Polls, Image Polls / 6.5.1
Poll Maker by AYS – Versus Polls, Anonymous Polls, Image Polls v6.5.1
6.5.1 6.5.0 6.4.9 6.4.8 6.4.7 6.4.6 6.4.5 6.4.4 6.4.3 6.4.2 6.4.1 6.4.0 6.3.9 6.3.8 6.3.7 6.3.6 6.3.5 6.3.4 6.3.3 5.6.0 5.6.1 5.6.2 5.6.3 5.6.4 5.6.5 All 154 releases
← All changes | admin/js/poll-maker-ays-admin.js +333 -33 5.6.3 → 6.5.1 View file →
@@ -621,8 +621,9 @@
621 621 $(document).find('.nav-tab-wrapper a.nav-tab').on('click', function (e) {
622 622 var elemenetID = $(this).attr('href');
623 623 var activeTab = $(this).attr('data-title');
624 624 var activeTabData = $(this).attr('data-tab');
625 + var $this = $(this);
625 626
626 627 $(document).find('.nav-tab-wrapper a.nav-tab').each(function () {
627 628 if ($(this).hasClass('nav-tab-active')) {
628 629 $(this).removeClass('nav-tab-active');
@@ -627,9 +628,13 @@
627 628 if ($(this).hasClass('nav-tab-active')) {
628 629 $(this).removeClass('nav-tab-active');
629 630 }
630 631 });
631 - $(this).addClass('nav-tab-active');
632 +
633 + setTimeout(function() {
634 + $this.addClass('nav-tab-active');
635 + }, 50);
636 +
632 637 $(document).find('.ays-poll-tab-content').each(function () {
633 638 $(this).css('display', 'none');
634 639 });
635 640 $('#ays_poll_active_tab').val(activeTab);
@@ -637,11 +642,13 @@
637 642 $(document).find('#ays_poll_active_tab_results').val(activeTabData);
638 643 $('.ays-poll-tab-content' + elemenetID).css('display', 'block');
639 644 e.preventDefault();
640 645 });
646 +
641 647 $('.button-primary#ays-button').on('click', function () {
642 648 $('#ays_poll_active_tab').val("General");
643 649 });
650 +
644 651 $('.button-primary#ays-button-top').on('click', function () {
645 652 $('#ays_poll_active_tab').val("General");
646 653 });
647 654
@@ -1531,9 +1538,9 @@
1531 1538 var val = $(this).val();
1532 1539 $('.apm-title-box h5').text(val);
1533 1540 });
1534 1541 var checkAnswerStyle = $(document).find("#ays_poll_enable_answer_style").prop("checked");
1535 - $(document).on('change', '.ays-poll-question-font-size,#ays_poll_question_image_height,#ays_answers_view,#ays_poll_answer_img_height,#ays_poll_answer_image_border_radius,#ays_poll_image_background_size,#ays_poll_answers_padding,#ays_poll_answers_margin,#ays_poll_title_font_size,#ays_poll_title_alignment,#ays_poll_text_type_placeholder,#ays_poll_question_image_object_fit,#ays_poll_answers_box_shadow_enable,#ays_poll_answers_box_shadow_color,#ays_poll_answer_border_radius,#ays_poll_answer_box_shadow_x_offset,#ays_poll_answer_box_shadow_y_offset,#ays_poll_answer_box_shadow_z_offset' , function () {
1542 + $(document).on('change', '.ays-poll-question-font-size,#ays_poll_question_image_height,#ays_answers_view,#ays_poll_answer_img_height,#ays_poll_answer_image_border_radius,#ays_poll_image_background_size,#ays_poll_answers_padding,#ays_poll_answers_margin,#ays_poll_title_font_size,#ays_poll_title_font_weight,#ays_poll_title_alignment,#ays_poll_title_text_transform,#ays_poll_text_type_placeholder,#ays_poll_question_image_object_fit,#ays_poll_answers_box_shadow_enable,#ays_poll_answers_box_shadow_color,#ays_poll_answer_border_radius,#ays_poll_answer_box_shadow_x_offset,#ays_poll_answer_box_shadow_y_offset,#ays_poll_answer_box_shadow_z_offset' , function () {
1536 1543 var checkAnswerStyleOnChange = $(document).find("#ays_poll_enable_answer_style").prop("checked");
1537 1544 refreshLivePreview(checkAnswerStyleOnChange);
1538 1545 });
1539 1546
@@ -1690,28 +1697,28 @@
1690 1697 livePrevToChoosing('choosing');
1691 1698 }
1692 1699 });
1693 1700
1694 - $(document).find('.poll-maker-challenge-cancel').on('click', function() {
1695 - var challengeBox = $(this).closest('.poll-maker-challenge');
1696 - var wp_nonce = $(document).find('#poll_maker_ajax_challenge_cancel_nonce').val();
1701 + // $(document).find('.poll-maker-challenge-cancel').on('click', function() {
1702 + // var challengeBox = $(this).closest('.poll-maker-challenge');
1703 + // var wp_nonce = $(document).find('#poll_maker_ajax_challenge_cancel_nonce').val();
1697 1704
1698 - $.ajax({
1699 - url: poll.ajax,
1700 - type: 'POST',
1701 - data: {
1702 - action: 'delete_challenge_box',
1703 - _ajax_nonce: wp_nonce
1704 - },
1705 - success: function(response) {
1706 - var result = JSON.parse(response);
1705 + // $.ajax({
1706 + // url: poll.ajax,
1707 + // type: 'POST',
1708 + // data: {
1709 + // action: 'delete_challenge_box',
1710 + // _ajax_nonce: wp_nonce
1711 + // },
1712 + // success: function(response) {
1713 + // var result = JSON.parse(response);
1707 1714
1708 - if (result.success) {
1709 - challengeBox.remove();
1710 - }
1711 - }
1712 - });
1713 - })
1715 + // if (result.success) {
1716 + // challengeBox.remove();
1717 + // }
1718 + // }
1719 + // });
1720 + // })
1714 1721
1715 1722 $(document).find('#ays_poll_create_author').select2({
1716 1723 placeholder: 'Select users',
1717 1724 minimumInputLength: 1,
@@ -1926,8 +1933,9 @@
1926 1933 var answerDefaultGap = "10";
1927 1934 var answerDefaultFontSize = "16";
1928 1935 var answerDefaultFontSizeMobile = "16";
1929 1936 var titleDefaultFontSize = "20";
1937 + var titleDefaultFontWeight = "normal";
1930 1938 var answersBorderRadiusDefault = "0";
1931 1939
1932 1940 // Boxes
1933 1941 var imageBoxes = $(document).find('.box-apm .ays-poll-answer-image-live');
@@ -1969,8 +1977,11 @@
1969 1977 var checkTextType = $(document).find('.box-apm.text-poll').length > 0 ? true : false;
1970 1978 // Title font size
1971 1979 var titleFontSizeBox = $(document).find("#ays_poll_title_font_size");
1972 1980 var titleFontSize = titleFontSizeBox.val();
1981 + // Title font weight
1982 + var titleFontWeightBox = $(document).find("#ays_poll_title_font_weight");
1983 + var titleFontWeight = titleFontWeightBox.val();
1973 1984 // Poll text type placeholder
1974 1985 var textPlaceholder = $(document).find("#ays_poll_text_type_placeholder");
1975 1986 var textPlaceholderVal = textPlaceholder.val();
1976 1987 $(document).find('.ays-poll-text-type-fields').attr('placeholder' , textPlaceholderVal);
@@ -1978,8 +1989,10 @@
1978 1989 'display': 'flex',
1979 1990 });
1980 1991 // Title alignment
1981 1992 var titleAlignment = $(document).find("#ays_poll_title_alignment").val();
1993 + // Title text transform
1994 + var titleTextTransform = $(document).find("#ays_poll_title_text_transform").val();
1982 1995
1983 1996 if(parseInt(imageHeight) < 0){
1984 1997 imageHeight = 0;
1985 1998 $(document).find('#ays_poll_answer_img_height').val(imageHeight);
@@ -2021,8 +2034,10 @@
2021 2034 answersMarginVal = answerDefaultGap;
2022 2035 answerFontSize = answerDefaultFontSize;
2023 2036 answerFontSizeMain.val(answerDefaultFontSize);
2024 2037 answerFontSizeMobileMain.val(answerDefaultFontSize);
2038 + titleFontWeight = titleDefaultFontWeight;
2039 + titleFontWeightBox.val(titleDefaultFontWeight);
2025 2040 answersBorderRadius = answersBorderRadiusDefault;
2026 2041 answersBorderRadiusMain.val(answersBorderRadiusDefault);
2027 2042 }
2028 2043 // Image Changes
@@ -2066,9 +2081,11 @@
2066 2081 titleFontSizeBox.val(0);
2067 2082 }
2068 2083 $(document).find('.apm-title-box h5').css({
2069 2084 "font-size" : titleFontSize + "px",
2085 + "font-weight" : titleFontWeight,
2070 2086 "text-align" : titleAlignment,
2087 + "text-transform" : titleTextTransform,
2071 2088 });
2072 2089 if(viewType == 'list'){
2073 2090 $(document).find('.grid_column_count').hide(250);
2074 2091 answersCont.removeClass('ays_poll_grid_view_container');
@@ -2160,9 +2177,9 @@
2160 2177 buttonsCont.hide(200);
2161 2178 }
2162 2179 });
2163 2180
2164 - $(document).find('.ays-poll-question-tab-all-filter-button-top, .ays-poll-question-tab-all-filter-button-bottom').on('click', function(e) {
2181 + $(document).find('.ays-poll-question-tab-all-filter-button-top, .ays-poll-question-tab-all-filter-button-bottom, .description-filter-apply-top, .description-filter-apply-bottom').on('click', function(e) {
2165 2182 e.preventDefault();
2166 2183 var $this = $(this);
2167 2184 var parent = $this.parents('.tablenav');
2168 2185
@@ -2177,8 +2194,9 @@
2177 2194 top_or_bottom = 'bottom';
2178 2195 }
2179 2196
2180 2197 var catFilter = $(document).find('select[name="filterby-'+ top_or_bottom +'"]').val();
2198 + var catDescFilter = $(document).find('select[name="filterbyDescription-'+ top_or_bottom +'"]').val();
2181 2199 var authorFilter = $(document).find('select[name="filterbyauthor-'+ top_or_bottom +'"]').val();
2182 2200 var typeFilter = $(document).find('select[name="filterbytype-'+ top_or_bottom +'"]').val();
2183 2201 var link = location.href;
2184 2202
@@ -2187,8 +2205,14 @@
2187 2205 what: 'filterby',
2188 2206 value: catFilter
2189 2207 });
2190 2208 }
2209 + if (typeof catDescFilter != "undefined") {
2210 + link = catFilterForListTable(link, searchValue, {
2211 + what: 'filterbyDescription',
2212 + value: catDescFilter
2213 + });
2214 + }
2191 2215 if (typeof authorFilter != "undefined") {
2192 2216 link = catFilterForListTable(link, searchValue, {
2193 2217 what: 'filterbyauthor',
2194 2218 value: authorFilter
@@ -2211,10 +2235,11 @@
2211 2235 for(var i = 0; i < linkModified.length; i++){
2212 2236 if ( linkModified[i].split("=")[0] == "ays_result_tab" ) {
2213 2237 linkModified.splice(i, 1, "ays_result_tab=poststuff");
2214 2238 }
2215 - if(linkModified[i].split("=")[0] == options.what){
2239 + if(linkModified[i].split("=")[0] == options.what || linkModified[i].split("=")[0] == 'paged'){
2216 2240 linkModified.splice(i, 1);
2241 + i--;
2217 2242 }
2218 2243 }
2219 2244 linkModified = linkModified.join('&');
2220 2245 if (typeof searchValue != 'undefined' && searchValue != '') {
@@ -2224,10 +2249,11 @@
2224 2249 }else{
2225 2250 var linkModifiedStart = link.split('?')[0];
2226 2251 var linkModified = link.split('?')[1].split('&');
2227 2252 for(var i = 0; i < linkModified.length; i++){
2228 - if(linkModified[i].split("=")[0] == options.what){
2253 + if(linkModified[i].split("=")[0] == options.what || linkModified[i].split("=")[0] == 'paged'){
2229 2254 linkModified.splice(i, 1);
2255 + i--;
2230 2256 }
2231 2257 }
2232 2258 linkModified = linkModified.join('&');
2233 2259 if (typeof searchValue != 'undefined' && searchValue != '') {
@@ -2297,8 +2323,12 @@
2297 2323 var closeButton = mainParent.find("button.notice-dismiss");
2298 2324 var attr_plugin = $this.attr('data-plugin');
2299 2325 var wp_nonce = thisParent.find('#poll-maker-ays-sale-banner').val();
2300 2326
2327 + if(typeof wp_nonce == 'undefined'){
2328 + wp_nonce = $(document).find('#poll-maker-ays-sale-banner').val();
2329 + }
2330 +
2301 2331 var data = {
2302 2332 action: 'ays_poll_dismiss_button',
2303 2333 _ajax_nonce: wp_nonce,
2304 2334 };
@@ -2359,22 +2389,41 @@
2359 2389 var createdNewPoll = aysPollGetCookie('ays_poll_created_new');
2360 2390 if(createdNewPoll && createdNewPoll > 1){
2361 2391 var url = new URL(window.location.href);
2362 2392
2393 + var getCustomPostId = aysPollGetCookie('ays_poll_created_new_'+createdNewPoll+'_post_id');
2394 +
2395 + var link = "#";
2396 + if(getCustomPostId){
2397 + link = getCustomPostId;
2398 + }
2399 +
2363 2400 // Get a specific GET parameter by name
2364 2401 var parameterValue = url.searchParams.get("action");
2365 - var htmlDefaultText = '<p style="margin-top:1rem;">'+ pollLangObj.formMoreDetailed +' <a href="admin.php?page=poll-maker&action=edit&id=' + createdNewPoll + '">'+ pollLangObj.editPollPage +'</a>.</p>';
2402 + var htmlDefaultText = '<p style="margin-top:1rem;">'+ pollLangObj.formMoreDetailed +' <a href="admin.php?page=poll-maker-ays&action=edit&poll=' + createdNewPoll + '">'+ pollLangObj.editPollPage +'</a>.</p>';
2366 2403
2404 + var htmlContent = parameterValue && parameterValue == 'edit' ? '' : htmlDefaultText;
2405 +
2406 + var previewButtonSvgIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">'+
2407 + '<path d="M11.9999 7.21325C11.8231 7.21325 11.6535 7.28349 11.5285 7.40851C11.4035 7.53354 11.3333 7.70311 11.3333 7.87992V12.6666C11.3333 12.8434 11.263 13.013 11.138 13.138C11.013 13.263 10.8434 13.3333 10.6666 13.3333H3.33325C3.15644 13.3333 2.98687 13.263 2.86185 13.138C2.73682 13.013 2.66659 12.8434 2.66659 12.6666V5.33325C2.66659 5.15644 2.73682 4.98687 2.86185 4.86185C2.98687 4.73682 3.15644 4.66658 3.33325 4.66658H8.11992C8.29673 4.66658 8.4663 4.59635 8.59132 4.47132C8.71635 4.3463 8.78658 4.17673 8.78658 3.99992C8.78658 3.82311 8.71635 3.65354 8.59132 3.52851C8.4663 3.40349 8.29673 3.33325 8.11992 3.33325H3.33325C2.80282 3.33325 2.29411 3.54397 1.91904 3.91904C1.54397 4.29411 1.33325 4.80282 1.33325 5.33325V12.6666C1.33325 13.197 1.54397 13.7057 1.91904 14.0808C2.29411 14.4559 2.80282 14.6666 3.33325 14.6666H10.6666C11.197 14.6666 11.7057 14.4559 12.0808 14.0808C12.4559 13.7057 12.6666 13.197 12.6666 12.6666V7.87992C12.6666 7.70311 12.5963 7.53354 12.4713 7.40851C12.3463 7.28349 12.1767 7.21325 11.9999 7.21325ZM14.6133 1.74659C14.5456 1.58369 14.4162 1.45424 14.2533 1.38659C14.1731 1.35242 14.087 1.33431 13.9999 1.33325H9.99992C9.82311 1.33325 9.65354 1.40349 9.52851 1.52851C9.40349 1.65354 9.33325 1.82311 9.33325 1.99992C9.33325 2.17673 9.40349 2.3463 9.52851 2.47132C9.65354 2.59635 9.82311 2.66659 9.99992 2.66659H12.3933L5.52659 9.52658C5.4641 9.58856 5.4145 9.66229 5.38066 9.74353C5.34681 9.82477 5.32939 9.91191 5.32939 9.99992C5.32939 10.0879 5.34681 10.1751 5.38066 10.2563C5.4145 10.3375 5.4641 10.4113 5.52659 10.4733C5.58856 10.5357 5.66229 10.5853 5.74353 10.6192C5.82477 10.653 5.91191 10.6705 5.99992 10.6705C6.08793 10.6705 6.17506 10.653 6.2563 10.6192C6.33754 10.5853 6.41128 10.5357 6.47325 10.4733L13.3333 3.60659V5.99992C13.3333 6.17673 13.4035 6.3463 13.5285 6.47132C13.6535 6.59635 13.8231 6.66658 13.9999 6.66658C14.1767 6.66658 14.3463 6.59635 14.4713 6.47132C14.5963 6.3463 14.6666 6.17673 14.6666 5.99992V1.99992C14.6655 1.9128 14.6474 1.82673 14.6133 1.74659Z" fill="#007DCB"/>'+
2408 + '</svg>';
2409 +
2367 2410 swal({
2368 - title: '<strong>' + pollLangObj.greateJob + '</strong>',
2369 - type: 'success',
2370 - html: '<p>' + pollLangObj.youCanUuseThisShortcode + '</p><input type="text" id="ays-poll-create-new" onClick="this.setSelectionRange(0, this.value.length)" readonly value="[ays_poll id=\'' + createdNewPoll + '\']" />',
2411 + title: '<strong class="ays-poll-maker-swal2-title">' + pollLangObj.greateJob + '</strong>',
2412 + type: 'success',
2413 + html: '<p class="ays-poll-maker-swal2-created-row">' + pollLangObj.youPollIsCreated + '</p><p clas="ays-poll-maker-swal2-content-text-row">' + pollLangObj.youCanUuseThisShortcode + '</p><input type="text" id="ays-poll-create-new" onClick="this.setSelectionRange(0, this.value.length)" readonly value="[ays_poll id=\'' + createdNewPoll + '\']" />' + htmlContent,
2414 + showCancelButton: true,
2371 2415 showCloseButton: true,
2372 2416 focusConfirm: false,
2417 + cancelButtonClass: "ays-poll-preview-popup-cancel-button",
2373 2418 confirmButtonText: '<i class="ays_poll_fas ays_poll_fa_thumbs_up"></i> '+ pollLangObj.done,
2374 2419 confirmButtonAriaLabel: pollLangObj.thumbsUpGreat,
2420 + cancelButtonText: '<a href="'+ link +'" target="_blank">'+ pollLangObj.preivewPoll + ' ' + previewButtonSvgIcon +'</a>',
2421 + cancelButtonAriaLabel: pollLangObj.thumbsUpGreat,
2422 +
2375 2423 });
2376 2424 aysPollDeleteCookie('ays_poll_created_new');
2425 + aysPollDeleteCookie('ays_poll_created_new_'+createdNewPoll+'_post_id');
2377 2426 }
2378 2427
2379 2428 function aysPollDeleteCookie(name) {
2380 2429 document.cookie = name + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
@@ -2847,9 +2896,9 @@
2847 2896 });
2848 2897 $(document).on('click', '.ays_menu_right', function(){
2849 2898 var scroll = parseInt($(this).attr('data-scroll'));
2850 2899 var howTranslate = $(document).find('div.ays-top-tab-wrapper').width() - $(document).find('.ays-top-menu').width();
2851 - howTranslate += 7;
2900 + howTranslate += 250;
2852 2901 if(scroll == -1){
2853 2902 scroll = menuItemWidth;
2854 2903 }
2855 2904 scroll += menuItemWidth;
@@ -2862,10 +2911,10 @@
2862 2911 });
2863 2912 // Poll Responsive tabs end
2864 2913
2865 2914
2915 + // var checkCountdownIsExists = $(document).find('#ays-poll-countdown-main-container');
2866 2916 var checkCountdownIsExists = $(document).find('#ays-poll-maker-countdown-main-container');
2867 - // var checkCountdownIsExists = $(document).find('#ays-poll-countdown-main-container');
2868 2917 if ( checkCountdownIsExists.length > 0 ) {
2869 2918 var second = 1000,
2870 2919 minute = second * 60,
2871 2920 hour = minute * 60,
@@ -2870,11 +2919,10 @@
2870 2919 minute = second * 60,
2871 2920 hour = minute * 60,
2872 2921 day = hour * 24;
2873 2922
2923 + // var pollCountdownEndTime = "DEC 05, 2025 23:59:59";
2874 2924 var pollCountdownEndTime = pollLangObj.pollBannerDate;
2875 - // var pollCountdownEndTime = "DEC 09, 2024 23:59:59";
2876 - // var pollCountdownEndTime = "JAN 15, 2025 23:59:59";
2877 2925 var countDown_new = new Date(pollCountdownEndTime).getTime();
2878 2926 if ( isNaN(countDown_new) || isFinite(countDown_new) == false ) {
2879 2927 var AYS_POLL_MILLISECONDS = 3 * day;
2880 2928 var countdownStartDate = new Date(Date.now() + AYS_POLL_MILLISECONDS);
@@ -2996,12 +3044,25 @@
2996 3044 });
2997 3045
2998 3046 $(document).find('.ays_poll_layer_button').on('click',function(){
2999 3047 $('.ays_poll_layer_container').css({'position':'unset' , 'display':'none'});
3048 + $(document.body).removeClass('ays-poll-modal-open');
3000 3049 $(document).find('.ays-poll-show-result-chart-google').prop("checked", true);
3001 3050
3002 3051 checkType($(this).attr("data-type"));
3052 +
3053 + // var $checklistPanel = $(document).find('.ays-poll-checklist-panel');
3054 + // if ($checklistPanel.length > 0) {
3055 + // $checklistPanel.show();
3056 + // }
3003 3057 })
3058 +
3059 + // Add body class when modal is visible
3060 + $(document).ready(function(){
3061 + if($('.ays_poll_layer_container').is(':visible')) {
3062 + $(document.body).addClass('ays-poll-modal-open');
3063 + }
3064 + });
3004 3065 // CHOOSE POLL TYPE FROM MODAL END
3005 3066
3006 3067 $(document).find('.ays-poll-open-polls-list').on('click', function(e){
3007 3068 $(this).parents(".ays-poll-subtitle-main-box").find(".ays-poll-polls-data").toggle('fast');
@@ -3144,10 +3205,13 @@
3144 3205 $(document).find('#ays_answers_view').val('list').change();
3145 3206 $(document).find("#ays_poll_answers_box_shadow_enable").prop('checked' , false).change();
3146 3207 $(document).find('input#ays_poll_title_font_size').val('20').change();
3147 3208 $(document).find('input#ays_poll_title_font_size_mobile').val('20').change();
3209 + $(document).find('#ays_poll_title_font_weight').val('normal').change();
3210 + $(document).find('#ays_poll_title_font_weight_mobile').val('normal').change();
3148 3211 $(document).find('#ays_poll_title_alignment').val('center').change();
3149 3212 $(document).find('#ays_poll_title_alignment_mobile').val('center').change();
3213 + $(document).find('#ays_poll_title_text_transform').val('none').change();
3150 3214 $(document).find("#ays_poll_enable_title_text_shadow").prop('checked' , false).change();
3151 3215 $(document).find('input#ays-poll-icon-size').val('24').change();
3152 3216 $(document).find('input#ays-poll-width').val('0').change();
3153 3217 $(document).find('input#ays_poll_width_for_mobile').val('0').change();
@@ -3224,9 +3288,11 @@
3224 3288 }
3225 3289
3226 3290 // Select message vars galleries page | Start
3227 3291 $(document).find('.ays-poll-message-vars-icon').on('click', function(e){
3228 - $(this).parents(".ays-poll-message-vars-box").find(".ays-poll-message-vars-data").toggle('fast');
3292 + var messageVarsBox = $(this).parents(".ays-poll-message-vars-box");
3293 + messageVarsBox.toggleClass("ays-poll-message-vars-open");
3294 + messageVarsBox.find(".ays-poll-message-vars-data").toggle('fast');
3229 3295 });
3230 3296
3231 3297 $(document).on( "click" , function(e){
3232 3298 if($(e.target).closest('.ays-poll-message-vars-box').length != 0){
@@ -3232,8 +3298,9 @@
3232 3298 if($(e.target).closest('.ays-poll-message-vars-box').length != 0){
3233 3299 }
3234 3300 else{
3235 3301 $(document).find(".ays-poll-message-vars-box .ays-poll-message-vars-data").hide('fast');
3302 + $(document).find(".ays-poll-message-vars-box").removeClass("ays-poll-message-vars-open");
3236 3303 }
3237 3304 });
3238 3305
3239 3306 $(document).find('.ays-poll-message-vars-each-data').on('click', function(e){
@@ -3396,11 +3463,216 @@
3396 3463 $(this).parents('.ays-modal').aysModal('hide_remove_video');
3397 3464 });
3398 3465 // // Pro features end
3399 3466
3467 + $(document).on("click", ".ays-poll-cards-block .ays-poll-card__footer button.status-missing", function(e){
3468 + var $this = $(this);
3469 + var thisParent = $this.parents(".ays-poll-cards-block");
3470 +
3471 + $this.prop('disabled', true);
3472 + $this.addClass('disabled');
3473 +
3474 + var loader_html = '<i class="fa fa-spinner fa-spin" aria-hidden="true"></i>';
3475 +
3476 + $this.html(loader_html);
3477 +
3478 + var attr_plugin = $this.attr('data-plugin');
3479 + var wp_nonce = thisParent.find('#ays_poll_ajax_install_plugin_nonce').val();
3480 +
3481 + var data = {
3482 + action: 'ays_poll_install_plugin',
3483 + _ajax_nonce: wp_nonce,
3484 + plugin: attr_plugin,
3485 + type: 'plugin'
3486 + };
3487 +
3488 + $.ajax({
3489 + url: poll.ajax,
3490 + method: 'post',
3491 + dataType: 'json',
3492 + data: data,
3493 + success: function (response) {
3494 + if (response.success) {
3495 + swal.fire({
3496 + type: 'success',
3497 + html: "<h4>"+ response['data']['msg'] +"</h4>"
3498 + }).then( function(res) {
3499 + if ( $this.hasClass('status-missing') ) {
3500 + $this.removeClass('status-missing');
3501 + }
3502 + $this.text(poll.activated);
3503 + $this.addClass('status-active');
3504 + });
3505 + }
3506 + else {
3507 + swal.fire({
3508 + type: 'info',
3509 + html: "<h4>"+ response['data'][0]['message'] +"</h4>"
3510 + }).then( function(res) {
3511 + $this.text(poll.errorMsg);
3512 + });
3513 + }
3514 + },
3515 + error: function(){
3516 + swal.fire({
3517 + type: 'info',
3518 + html: "<h2>"+ poll.loadResource +"</h2><br><h6>"+ poll.somethingWentWrong +"</h6>"
3519 + }).then( function(res) {
3520 + $this.text(poll.errorMsg);
3521 + });
3522 + }
3523 + });
3524 + });
3525 +
3526 + $(document).on("click", ".ays-poll-cards-block .ays-poll-card__footer button.status-installed", function(e){
3527 + var $this = $(this);
3528 + var thisParent = $this.parents(".ays-poll-cards-block");
3529 +
3530 + $this.prop('disabled', true);
3531 + $this.addClass('disabled');
3532 +
3533 + var loader_html = '<i class="fa fa-spinner fa-spin" aria-hidden="true"></i>';
3534 +
3535 + $this.html(loader_html);
3536 +
3537 + var attr_plugin = $this.attr('data-plugin');
3538 + var wp_nonce = thisParent.find('#ays_poll_ajax_install_plugin_nonce').val();
3539 +
3540 + var data = {
3541 + action: 'ays_poll_activate_plugin',
3542 + _ajax_nonce: wp_nonce,
3543 + plugin: attr_plugin,
3544 + type: 'plugin'
3545 + };
3546 +
3547 + $.ajax({
3548 + url: poll.ajax,
3549 + method: 'post',
3550 + dataType: 'json',
3551 + data: data,
3552 + success: function (response) {
3553 + if( response.success ){
3554 + swal.fire({
3555 + type: 'success',
3556 + html: "<h4>"+ response['data'] +"</h4>"
3557 + }).then( function(res) {
3558 + if ( $this.hasClass('status-installed') ) {
3559 + $this.removeClass('status-installed');
3560 + }
3561 + $this.text(poll.activated);
3562 + $this.addClass('status-active disabled');
3563 + });
3564 + } else {
3565 + swal.fire({
3566 + type: 'info',
3567 + html: "<h4>"+ response['data'][0]['message'] +"</h4>"
3568 + });
3569 + }
3570 + },
3571 + error: function(){
3572 + swal.fire({
3573 + type: 'info',
3574 + html: "<h2>"+ poll.loadResource +"</h2><br><h6>"+ poll.somethingWentWrong +"</h6>"
3575 + }).then( function(res) {
3576 + $this.text(poll.errorMsg);
3577 + });
3578 + }
3579 + });
3580 + });
3581 +
3582 + // Replace image to YouTube embed video
3583 + $(document).on('click', '.ays-poll-youtube-placeholder', function() {
3584 + var videoId = $(this).data('video-id');
3585 + var iframe = $('<iframe>', {
3586 + src: 'https://www.youtube.com/embed/' + videoId + '?autoplay=1',
3587 + class: '',
3588 + width: 560,
3589 + height: 315,
3590 + frameborder: 0,
3591 + allow: 'accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture',
3592 + allowfullscreen: true,
3593 + });
3594 + $(this).replaceWith(iframe);
3595 + });
3596 +
3400 3597 })(jQuery);
3401 3598
3599 +document.addEventListener("DOMContentLoaded", function() {
3600 + var startDate = new Date("2025-09-21");
3601 + var endDate = new Date("2025-10-21");
3602 + var totalLicenses = 50;
3603 + var progressionPattern = new Array(3, 2, 1, 4, 2, 3, 1, 2, 4, 3, 2, 1, 3, 2, 4, 1, 3, 2, 2, 3, 1, 2);
3604 + function getCurrentProgress() {
3605 + var today = new Date();
3606 + // today.setDate(today.getDate() + 1);
3607 + var daysPassed = Math.floor((today - startDate) / (1000 * 60 * 60 * 24));
3608 + var usedLicenses = 0;
3609 + for (var i = 0; i < Math.min(daysPassed, progressionPattern.length); i++) {
3610 + usedLicenses += progressionPattern[i];
3611 + }
3612 + return Math.min(usedLicenses, totalLicenses);
3613 + }
3614 + function updateProgress() {
3615 + var usedLicenses = getCurrentProgress();
3616 + var remainingLicenses = totalLicenses - usedLicenses;
3617 + var progressPercentage = (usedLicenses / totalLicenses) * 100;
3618 + var remainingElement = document.getElementById("remaining-licenses");
3619 + var progressElement = document.getElementById("progress-fill");
3620 + if (remainingElement) remainingElement.textContent = remainingLicenses;
3621 + if (progressElement) progressElement.style.width = progressPercentage + "%";
3622 + }
3623 + updateProgress();
3624 +});
3402 3625
3626 +// Copy to clipboard function
3627 +function pollCopyToClipboard(text) {
3628 + if (navigator.clipboard && window.isSecureContext) {
3629 + navigator.clipboard.writeText(text).then(function() {
3630 + pollShowCopyNotification(pollLangObj.successCopyCoupon);
3631 + }).catch(function() {
3632 + fallbackCopyTextToClipboard(text);
3633 + });
3634 + } else {
3635 + fallbackCopyTextToClipboard(text);
3636 + }
3637 +}
3638 +
3639 +function fallbackCopyTextToClipboard(text) {
3640 + var textArea = document.createElement("textarea");
3641 + textArea.value = text;
3642 + textArea.style.position = "fixed";
3643 + textArea.style.top = "-9999px";
3644 + textArea.style.left = "-9999px";
3645 + document.body.appendChild(textArea);
3646 + textArea.focus();
3647 + textArea.select();
3648 + try {
3649 + var successful = document.execCommand("copy");
3650 + if (successful) {
3651 + pollShowCopyNotification(pollLangObj.successCopyCoupon);
3652 + } else {
3653 + pollShowCopyNotification(pollLangObj.failedCopyCoupon);
3654 + }
3655 + } catch (err) {
3656 + pollShowCopyNotification(pollLangObj.failedCopyCoupon);
3657 + }
3658 + document.body.removeChild(textArea);
3659 +}
3660 +
3661 +function pollShowCopyNotification(message) {
3662 + var notification = document.createElement("div");
3663 + notification.className = "ays-poll-copy-notification show";
3664 + console.log(notification);
3665 + notification.textContent = message;
3666 + document.body.appendChild(notification);
3667 + setTimeout(function() {
3668 + notification.classList.remove("show");
3669 + setTimeout(function() {
3670 + document.body.removeChild(notification);
3671 + }, 300);
3672 + }, 2000);
3673 +}
3674 +
3403 3675 function selectElementContents(el) {
3404 3676 if (window.getSelection && document.createRange) {
3405 3677 var _this = jQuery(document).find('strong.ays-poll-shortcode-box');
3406 3678 var text = el.textContent;
@@ -3542,5 +3814,33 @@
3542 3814 //redraw graph when window resize is completed
3543 3815 jQuery(window).on('resizeEnd', function() {
3544 3816 chart.draw(data, options);
3545 3817 });
3546 -}
3818 +}
3819 +
3820 +function selectAndCopyElementContents(el) {
3821 + if (window.getSelection && document.createRange) {
3822 + var _this = jQuery(document).find('.ays-poll-copy-element-box');
3823 +
3824 + var text = el.textContent;
3825 + var textField = document.createElement('textarea');
3826 +
3827 + textField.innerText = text;
3828 + document.body.appendChild(textField);
3829 + textField.select();
3830 + document.execCommand('copy');
3831 + textField.remove();
3832 +
3833 + var selection = window.getSelection();
3834 + selection.setBaseAndExtent(el,0,el,1);
3835 +
3836 + _this.attr( "data-original-title", pollLangObj.copied );
3837 + _this.attr( "title", pollLangObj.copied );
3838 +
3839 + _this.tooltip("show");
3840 +
3841 + } else if (document.selection && document.body.createTextRange) {
3842 + var textRange = document.body.createTextRange();
3843 + textRange.moveToElementText(el);
3844 + textRange.select();
3845 + }
3846 +}