File: /storage/v6964/2foodfactor/public_html/wp-content/plugins/quiz-maker/admin/js/quiz-maker-admin.js
function selectElementContents(el){if(window.getSelection&&document.createRange){var _this=jQuery(document).find("strong.ays-quiz-shortcode-box"),text=el.textContent,textField=document.createElement("textarea");textField.innerText=text,document.body.appendChild(textField),textField.select(),document.execCommand("copy"),textField.remove(),window.getSelection().setBaseAndExtent(el,0,el,1),_this.attr("data-original-title",quizLangObj.copied),_this.attr("title",quizLangObj.copied),_this.tooltip("show")}else if(document.selection&&document.body.createTextRange){var textRange=document.body.createTextRange();textRange.moveToElementText(el),textRange.select()}}function selectAndCopyElementContents(el){if(window.getSelection&&document.createRange){var _this=jQuery(document).find(".ays-quiz-copy-element-box"),text=el.textContent,textField=document.createElement("textarea");textField.innerText=text,document.body.appendChild(textField),textField.select(),document.execCommand("copy"),textField.remove(),window.getSelection().setBaseAndExtent(el,0,el,1),_this.attr("data-original-title",quizLangObj.copied),_this.attr("title",quizLangObj.copied),_this.tooltip("show")}else if(document.selection&&document.body.createTextRange){var textRange=document.body.createTextRange();textRange.moveToElementText(el),textRange.select()}}function copyToClipboard(text){navigator.clipboard&&window.isSecureContext?navigator.clipboard.writeText(text).then((function(){showCopyNotification(quizLangObj.successCopyCoupon)})).catch((function(){fallbackCopyTextToClipboard(text)})):fallbackCopyTextToClipboard(text)}function fallbackCopyTextToClipboard(text){var textArea=document.createElement("textarea");textArea.value=text,textArea.style.position="fixed",textArea.style.top="-9999px",textArea.style.left="-9999px",document.body.appendChild(textArea),textArea.focus(),textArea.select();try{showCopyNotification(document.execCommand("copy")?quizLangObj.successCopyCoupon:quizLangObj.failedCopyCoupon)}catch(err){showCopyNotification(quizLangObj.failedCopyCoupon)}document.body.removeChild(textArea)}function showCopyNotification(message){var notification=document.createElement("div");notification.className="ays-quiz-copy-notification show",notification.textContent=message,document.body.appendChild(notification),setTimeout((function(){notification.classList.remove("show"),setTimeout((function(){document.body.removeChild(notification)}),300)}),2e3)}!function($){"use strict";function aysQuizCreateCookie(name,value,days){var expires;if(days){var date=new Date;date.setTime(date.getTime()+24*days*60*60*1e3),expires="; expires="+date.toGMTString()}else expires="";document.cookie=name+"="+value+expires+"; path=/"}function aysQuizGetCookie(c_name){if(document.cookie.length>0){var c_start=document.cookie.indexOf(c_name+"=");if(-1!=c_start){c_start=c_start+c_name.length+1;var c_end=document.cookie.indexOf(";",c_start);return-1==c_end&&(c_end=document.cookie.length),unescape(document.cookie.substring(c_start,c_end))}}return""}function aysQuizDeleteCookie(name){document.cookie=name+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"}function checkTrue(flag){return!0===flag}function ays_youtube_parser(url){var match=url.match(/^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#&?]*).*/);return!(!match||11!=match[7].length)&&match[7]}function openQuizMediaUploader(e,element){e.preventDefault();let aysUploader=wp.media({title:"Upload",button:{text:"Upload"},frame:"post",state:"insert",library:{type:"image"},multiple:!1}).on("insert",(function(){var state=aysUploader.state(),selection=selection||state.get("selection");if(selection){var attachment=selection.first(),display=state.display(attachment).toJSON(),imgurl=(attachment=attachment.toJSON()).sizes[display.size].url;if(element.hasClass("add-quiz-bg-image"))(parent=element.parents(".ays-quiz-bg-image-main-container")).find(".ays-quiz-bg-image-container").fadeIn(),parent.find("img#ays-quiz-bg-img").attr("src",imgurl),parent.find("#ays_quiz_bg_image").val(imgurl),$(document).find(".ays-quiz-live-container").css({"background-image":'url("'+imgurl+'")'}),element.hide();else if(element.hasClass("ays-edit-quiz-bg-img")){var parent;(parent=element.parents(".ays-quiz-bg-image-main-container")).find(".ays-quiz-bg-image-container").fadeIn(),parent.find("img#ays-quiz-bg-img").attr("src",imgurl),parent.find("#ays_quiz_bg_image").val(imgurl),$(document).find(".ays-quiz-live-container").css({"background-image":'url("'+imgurl+'")'})}else element.text("Edit Image"),element.parents(".ays-field").find(".ays-quiz-image-container").fadeIn(),element.parents(".ays-field").find("img#ays-quiz-img").attr("src",imgurl),$("input#ays-quiz-image").val(imgurl)}})).open();return!1}function show_hide_rows(page){let rows=$("table.ays-questions-table tbody tr");rows.each((function(index){$(this).css("display","none")}));let counter=5*page-4;for(let i=counter;i<counter+5;i++)rows.eq(i-1).css("display","table-row")}function activate_question(element){element.find(".ays_fa.ays_fa_times").parent().removeClass("show_remove_answer").addClass("active_remove_answer"),element.find(".ays_add_answer").parents().eq(1).removeClass("show_add_answer");for(var answers_tr=element.find(".ays_answers_table tr"),i=0;i<answers_tr.length;i++){var answer_text=$(answers_tr.eq(i)).find(".ays_answer").text()&&"Answer"!==$(answers_tr.eq(i)).find(".ays_answer").text()?"value='"+$(answers_tr.eq(i)).find(".ays_answer").text()+"'":"placeholder='Answer text'";$(answers_tr.eq(i)).find(".ays_answer_td").empty(),$(answers_tr.eq(i)).find(".ays_answer_td").append('<input type="text" '+answer_text+' class="ays_answer">')}$(document).find("#ays-quick-modal-content .ays_modal_element").removeClass("active_question_border"),element.find(".ays_question_input").select(),element.addClass("active_question_border")}function submitOnce(subButton){var subLoader=subButton.parents("div").find(".ays_quiz_loader_box");subLoader.hasClass("display_none")&&subLoader.removeClass("display_none"),subLoader.css("padding-left","8px"),subLoader.css("display","inline-flex"),setTimeout((function(){$(document).find(".ays-quiz-loader-banner, .ays-quiz-category-next-button-class, .ays-quiz-next-button-class").attr("disabled",!0)}),50),setTimeout((function(){$(document).find(".ays-quiz-loader-banner, .ays-quiz-category-next-button-class, .ays-quiz-next-button-class").attr("disabled",!1),subButton.parents("div").find(".ays_quiz_loader_box").css("display","none")}),5e3)}function aysEscapeHtml(text){var map={"&":"&","<":"<",">":">",'"':""","'":"'"};if(void 0!==text)return text.replace(/[&<>\"']/g,(function(m){return map[m]}))}function catFilterForListTable(link,options){if(""!=options.value){options.value="&"+options.what+"="+options.value;for(var linkModifiedStart=link.split("?")[0],linkModified=link.split("?")[1].split("&"),i=0;i<linkModified.length;i++)"ays_result_tab"==linkModified[i].split("=")[0]&&linkModified.splice(i,1,"ays_result_tab=poststuff"),linkModified[i].split("=")[0]==options.what&&linkModified.splice(i,1);return linkModifiedStart+"?"+(linkModified=linkModified.join("&"))+options.value}for(linkModifiedStart=link.split("?")[0],linkModified=link.split("?")[1].split("&"),i=0;i<linkModified.length;i++)linkModified[i].split("=")[0]==options.what&&linkModified.splice(i,1);return linkModifiedStart+"?"+(linkModified=linkModified.join("&"))}function openCloseAccordion(_this,dataCollapsed){var parent=_this.closest(".ays-quiz-accordion-options-main-container"),container=parent.find(".ays-quiz-accordion-options-box");"true"===dataCollapsed?setTimeout((function(){container.slideDown(),parent.find(".ays-quiz-accordion-arrow-box .ays-quiz-accordion-arrow").removeClass("ays-quiz-accordion-arrow-right").addClass("ays-quiz-accordion-arrow-down"),parent.attr("data-collapsed","false"),parent.find(".ays-quiz-accordion-options-main-container").attr("data-collapsed","false")}),150):setTimeout((function(){container.slideUp(),parent.find(".ays-quiz-accordion-arrow-box .ays-quiz-accordion-arrow").removeClass("ays-quiz-accordion-arrow-down").addClass("ays-quiz-accordion-arrow-right"),parent.attr("data-collapsed","true"),parent.find(".ays-quiz-accordion-options-main-container").attr("data-collapsed","true")}),150)}$(document).ready((function(){$(document).on("click",".notice-dismiss",(function(e){let linkModified=location.href.split("?")[1].split("&");for(let i=0;i<linkModified.length;i++)"status"==linkModified[i].split("=")[0]&&linkModified.splice(i,1);linkModified=linkModified.join("&"),window.history.replaceState({},document.title,"?"+linkModified)})),jQuery(".quiz_toast__close").click((function(e){e.preventDefault(),$(this).parent(".quiz_toast").fadeOut("slow",(function(){$(this).remove()}))}));var emailValidatePattern=/^[a-zA-Z0-9\._-]+@[a-zA-Z0-9\._-]+\.\w{2,}$/;String.prototype.hexToRgbA=function(a){null==a&&(a=1);let result1=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(this),result2=/^#?([a-f\d]{1})([a-f\d]{1})([a-f\d]{1})$/i.exec(this);if(result1){let ays_rgb={r:parseInt(result1[1],16),g:parseInt(result1[2],16),b:parseInt(result1[3],16)};return"rgba("+ays_rgb.r+","+ays_rgb.g+","+ays_rgb.b+","+a+")"}if(result2){let ays_rgb={r:parseInt(result2[1]+""+result2[1],16),g:parseInt(result2[2]+""+result2[2],16),b:parseInt(result2[3]+""+result2[3],16)};return"rgba("+ays_rgb.r+","+ays_rgb.g+","+ays_rgb.b+","+a+")"}return null},$.fn.goToNormal=function(){return $("html, body").animate({scrollTop:this.offset().top-200+"px"},"normal"),this},$.fn.aysModal=function(action){let $this=$(this);var current_popup_id_attr=$this.attr("id"),current_popup_id="",current_popup_class="";switch(current_popup_id_attr&&""!=current_popup_id_attr&&(current_popup_class="."+(current_popup_id="overlay-"+current_popup_id_attr)),action){case"hide":$(this).find(".ays-modal-content").css("animation-name","zoomOut"),$this.find(".ays-modal-body iframe").length>0&&$this.find(".ays-modal-body iframe").remove(),setTimeout((function(){$(document.body).removeClass("modal-open"),$(document).find(".ays-modal-backdrop"+current_popup_class).remove(),$this.hide()}),250);break;case"hide_remove_video":$(this).find(".ays-modal-content").css("animation-name","zoomOut"),$this.find(".ays-modal-body iframe").remove(),setTimeout((function(){$(document.body).removeClass("modal-open"),$(document).find(".ays-modal-backdrop"+current_popup_class).remove(),$this.hide()}),250);break;case"show_flex":$this.css("display","flex"),$(this).find(".ays-modal-content").css("animation-name","zoomIn"),$(document).find(".modal-backdrop").remove(),$(document.body).append('<div class="ays-modal-backdrop '+current_popup_id+'"></div>'),$(document.body).addClass("modal-open");break;default:$this.show(),$(this).find(".ays-modal-content").css("animation-name","zoomIn"),$(document).find(".modal-backdrop").remove(),$(document.body).append('<div class="ays-modal-backdrop '+current_popup_id+'"></div>'),$(document.body).addClass("modal-open")}},$(document).on("input","input",(function(e){if(13==e.keyCode&&(0!==$(document).find("#ays-question-form").length||0!==$(document).find("#ays-quiz-category-form").length||0!==$(document).find("#ays-quiz-settings-form").length))return!1})),$(document).on("keydown",(function(e){return"TEXTAREA"==e.target.nodeName||(13!==e.keyCode||0===$(document).find("#ays-question-form").length&&0===$(document).find("#ays-quiz-category-form").length&&0===$(document).find("#ays-quiz-settings-form").length)&&(27===e.keyCode?($(document).find(".ays-modal").aysModal("hide"),$(document).find(".ays-modal-backdrop").remove(),!1):void 0)}));setInterval((function(){$("div.ays-quiz-maker-wrapper h1 i.ays_fa").toggleClass("ays_pulse"),$(document).find(".ays_heart_beat i.ays_fa").toggleClass("ays_pulse")}),1e3);$(document).find(".ays-top-menu").width()<=$(document).find("div.ays-top-tab-wrapper").width()&&($(document).find(".ays_menu_left").css("display","flex"),$(document).find(".ays_menu_right").css("display","flex")),$(window).resize((function(){$(document).find(".ays-top-menu").width()<=$(document).find("div.ays-top-tab-wrapper").width()?($(document).find(".ays_menu_left").css("display","flex"),$(document).find(".ays_menu_right").css("display","flex")):($(document).find(".ays_menu_left").css("display","none"),$(document).find(".ays_menu_right").css("display","none"),$(document).find("div.ays-top-tab-wrapper").css("transform","translate(0px)"))}));let menuItemWidths0=[],menuItemWidths=[];$(document).find(".ays-top-tab-wrapper .nav-tab").each((function(){let $this=$(this);menuItemWidths0.push($this.outerWidth())}));for(let i=0;i<menuItemWidths0.length;i+=2)menuItemWidths.push(menuItemWidths0[i]+menuItemWidths0[i+1]);let menuItemWidth=0;for(let i=0;i<menuItemWidths.length;i++)menuItemWidth+=menuItemWidths[i];menuItemWidth/=menuItemWidths.length,$(document).on("click",".ays_menu_left",(function(){let scroll=parseInt($(this).attr("data-scroll"));scroll-=menuItemWidth,scroll<0&&(scroll=0),$(document).find("div.ays-top-tab-wrapper").css("transform","translate(-"+scroll+"px)"),$(this).attr("data-scroll",scroll),$(document).find(".ays_menu_right").attr("data-scroll",scroll)})),$(document).on("click",".ays_menu_right",(function(){let scroll=parseInt($(this).attr("data-scroll")),howTranslate=$(document).find("div.ays-top-tab-wrapper").width()-$(document).find(".ays-top-menu").width();howTranslate+=7,-1==scroll&&(scroll=menuItemWidth),scroll+=menuItemWidth,scroll>howTranslate&&(scroll=howTranslate),$(document).find("div.ays-top-tab-wrapper").css("transform","translate(-"+scroll+"px)"),$(this).attr("data-scroll",scroll),$(document).find(".ays_menu_left").attr("data-scroll",scroll)}));let defaultColors_classicLight={quizColor:"#5d6cf9",bgColor:"#ffffff",textColor:"#000000",buttonsTextColor:"#ffffff"},defaultColors_classicDark={quizColor:"#0d62bc",bgColor:"#000000",textColor:"#e25600",buttonsTextColor:"#e25600"},defaultColors_elegantLight={quizColor:"#ffffff",bgColor:"#ffffff",textColor:"#2c2c2c",buttonsTextColor:"#2c2c2c"},defaultColors_elegantDark={quizColor:"#2c2c2c",bgColor:"#2c2c2c",textColor:"#ffffff",buttonsTextColor:"#ffffff"},defaultColors_rectLight={quizColor:"#fff195",bgColor:"#ffffff",textColor:"#515151",buttonsTextColor:"#515151"},defaultColors_rectDark={quizColor:"#1e73be",bgColor:"#2c2c2c",textColor:"#ffffff",buttonsTextColor:"#ffffff"};$(".form_option").on("click",(function(event){"disable"==event.target.value&&"none"!=$(".information_form_options").eq(0).css("display")?$(".information_form_options").eq(0).css("display","none"):"disable"!=event.target.value&&"none"==$(".information_form_options").eq(0).css("display")&&$(".information_form_options").eq(0).css("display","block")})),"disable"!==$("#ays_information_form").val()&&$(".information_form_options").show(250),$("#ays_information_form").on("change",(function(){"disable"===$(this).val()?$(".information_form_options").hide(250):$(".information_form_options").show(250)})),1==$(document).find("#ays_form_name").prop("checked")?$(document).find("#ays_form_name_required").removeAttr("disabled"):($(document).find("#ays_form_name_required").attr("disabled","disabled"),$(document).find("#ays_form_name_required").removeAttr("checked")),$(document).find("#ays_form_name").on("change",(function(e){1==$(this).prop("checked")?$(document).find("#ays_form_name_required").removeAttr("disabled"):($(document).find("#ays_form_name_required").attr("disabled","disabled"),$(document).find("#ays_form_name_required").removeAttr("checked"))})),1==$(document).find("#ays_form_email").prop("checked")?$(document).find("#ays_form_email_required").removeAttr("disabled"):($(document).find("#ays_form_email_required").attr("disabled","disabled"),$(document).find("#ays_form_email_required").removeAttr("checked")),$(document).find("#ays_form_email").on("change",(function(e){1==$(this).prop("checked")?$(document).find("#ays_form_email_required").removeAttr("disabled"):($(document).find("#ays_form_email_required").attr("disabled","disabled"),$(document).find("#ays_form_email_required").removeAttr("checked"))})),1==$(document).find("#ays_form_phone").prop("checked")?$(document).find("#ays_form_phone_required").removeAttr("disabled"):($(document).find("#ays_form_phone_required").attr("disabled","disabled"),$(document).find("#ays_form_phone_required").removeAttr("checked")),$(document).find("#ays_form_phone").on("change",(function(e){1==$(this).prop("checked")?$(document).find("#ays_form_phone_required").removeAttr("disabled"):($(document).find("#ays_form_phone_required").attr("disabled","disabled"),$(document).find("#ays_form_phone_required").removeAttr("checked"))})),$("#ays_users_roles").select2(),$("#ays_user_roles , #ays_user_roles_to_change_quiz").select2(),$('[data-toggle="tooltip"]').tooltip(),$(document).find("#ays_quiz_question_tags").select2();$(document).find("#add_quest_category_filter").select2({placeholder:quizLangObj.selectCategory,multiple:!0,dropdownParent:$(document).find("#quest_cat_container")}),$(document).find("#add_quest_tag_filter").select2({placeholder:quizLangObj.selectTags,multiple:!0,dropdownParent:$(document).find("#quest_tag_container")});if($(document).find("#ays-quiz-title").on("input",(function(e){var dirtyString,container,text,quizTitleVal=$(this).val(),quizListBox=$(document).find(".ays-quiz-quizzes-data"),quizTitle=(dirtyString=quizTitleVal,container=document.createElement("div"),text=document.createTextNode(dirtyString),container.appendChild(text),container.innerHTML);$(document).find(".ays_quiz_title_in_top").html(quizTitle),$(document).find("#wpcontent").outerWidth()-400<=$(document).find(".ays-quiz-subtitle-main-box.ays-quiz-edit-page-subtitle-container .ays-subtitle").outerWidth()?quizListBox.hasClass("ays-quiz-quizzes-data-change-position")||quizListBox.addClass("ays-quiz-quizzes-data-change-position"):quizListBox.hasClass("ays-quiz-quizzes-data-change-position")&&quizListBox.removeClass("ays-quiz-quizzes-data-change-position")})),$(document).find(".ays-quiz-live-title").html(aysEscapeHtml($(document).find("#ays-quiz-title").val())),$(document).find('a[href="#tab2"]').on("click",(function(){aysQuizDescriptionLivePreview()})),"tab2"==$(document).find(".nav-tab.nav-tab-active").attr("data-tab"))var aysQuizDescriptionInterval=setInterval((function(){"complete"===document.readyState&&(aysQuizDescriptionLivePreview(),clearInterval(aysQuizDescriptionInterval))}),500);function aysQuizDescriptionLivePreview(){var emptySubtitle;$(document).find("#wp-ays-quiz-description-wrap").hasClass("tmce-active")?($(document).find("#wp-ays-quiz-description-wrap").addClass("html-active").removeClass("tmce-active"),emptySubtitle=$(document).find("#ays-quiz-description").val(),emptySubtitle=window.tinyMCE.get("ays-quiz-description").getContent(),$(document).find("#wp-ays-quiz-description-wrap").addClass("tmce-active").removeClass("html-active")):emptySubtitle=$(document).find("#ays-quiz-description").val(),$(document).find(".ays-quiz-live-subtitle").html(emptySubtitle)}if($(document).find(".ays-quiz-live-button").css({background:$(document).find("#ays-quiz-color").val(),color:$(document).find("#ays-quiz-buttons-text-color").val()}),$(document).find(".ays-quiz-live-title , .ays-quiz-live-subtitle").css({color:$(document).find("#ays-quiz-text-color").val()}),$(document).find(".ays-progress-value.first, .ays-progress-value.second").css({color:$(document).find("#ays-quiz-text-color").val()}),$(document).find(".ays-progress-value.third").css({color:$(document).find("#ays-quiz-text-color").val()}),$(document).find(".ays-progress-value.fourth").css({color:$(document).find("#ays-quiz-bg-color").val()}),$(document).find(".ays-progress.first, .ays-progress.second").css({background:$(document).find("#ays-quiz-text-color").val()}),$(document).find(".ays-progress-bg.third, .ays-progress-bg.fourth").css({background:$(document).find("#ays-quiz-text-color").val()}),$(document).find(".ays-progress-bar.first, .ays-progress-bar.second").css({background:$(document).find("#ays-quiz-color").val()}),$(document).find(".ays-progress-bar.third, .ays-progress-bar.fourth").css({background:$(document).find("#ays-quiz-color").val()}),"percentage"===$(document).find("#ays_quiz_width_by_percentage_px").val())var width_percentage_px_val="%";else width_percentage_px_val="px";var live_width="0"!==$(document).find("#ays-quiz-width").val()?$(document).find("#ays-quiz-width").val()+width_percentage_px_val:"100%";$(document).find(".ays-quiz-live-container").css({"min-height":$(document).find("#ays-quiz-height").val()+"px",width:live_width,"background-color":$(document).find("#ays-quiz-bg-color").val()}),$(document).find("#ays-quiz-img").attr("src")?$(document).find(".ays-quiz-live-image").attr("src",$(document).find("#ays-quiz-img").attr("src")):$(document).find(".ays-quiz-live-image").css({display:"none"}),$(document).find("#ays-quiz-title").on("change",(function(){$(document).find(".ays-quiz-live-title").text($(document).find("#ays-quiz-title").val())})),$(document).find("#ays-quiz-height").on("change",(function(e){$(document).find(".ays-quiz-live-container").css({"min-height":e.target.value+"px"})})),$(document).find("#ays-quiz-width, #ays_quiz_width_by_percentage_px").on("change",(function(e){var width_percentage_px=$(document).find("#ays_quiz_width_by_percentage_px").val(),quiz_width_val=$(document).find("#ays-quiz-width").val();if("percentage"===width_percentage_px){var width_percentage_px_val="%";quiz_width_val>100&&(quiz_width_val=100)}else width_percentage_px_val="px";quiz_width_val<=0&&(quiz_width_val=100,width_percentage_px_val="%"),$(document).find(".ays-quiz-live-container").css({width:quiz_width_val+width_percentage_px_val})}));var quiz_title_font_size="0"!==$(document).find("#ays_quiz_title_font_size").val()?$(document).find("#ays_quiz_title_font_size").val():"21";let defaultTextColor,defaultBgColor,defaultQuizColor,defaultButtonsTextColor;switch(quiz_title_font_size>0&&$(document).find(".ays-quiz-live-container .ays-quiz-live-title").css({"font-size":quiz_title_font_size+"px"}),$(document).find("#ays_quiz_title_font_size").on("change",(function(e){var quiz_title_font_size=$(this).val();$(document).find(".ays-quiz-live-container .ays-quiz-live-title").css({"font-size":quiz_title_font_size+"px"})})),setTimeout((function(){if($(document).find("#ays_custom_css").length>0){let CodeEditor=null;wp.codeEditor&&(CodeEditor=wp.codeEditor.initialize($(document).find("#ays_custom_css"),cm_settings)),null!==CodeEditor&&CodeEditor.codemirror.on("change",(function(e,ev){$(CodeEditor.codemirror.display.input.div).find(".CodeMirror-linenumber").remove(),$(document).find("#ays_custom_css").val(CodeEditor.codemirror.display.input.div.innerText)}))}}),500),$(document).find('a[href="#tab2"]').on("click",(function(e){setTimeout((function(){if($(document).find("#ays_custom_css").length>0){var ays_custom_css=$(document).find("#ays_custom_css").html();if(wp.codeEditor){$(document).find("#ays_custom_css").next(".CodeMirror").remove();var CodeEditor=wp.codeEditor.initialize($(document).find("#ays_custom_css"),cm_settings);CodeEditor.codemirror.on("change",(function(e,ev){$(CodeEditor.codemirror.display.input.div).find(".CodeMirror-linenumber").remove(),$(document).find("#ays_custom_css").val(CodeEditor.codemirror.display.input.div.innerText)})),ays_custom_css=CodeEditor.codemirror.getValue(),$(document).find("#ays_custom_css").html(ays_custom_css)}}}),500),$(document).find("#ays-quiz-img").attr("src")?($(document).find(".ays-quiz-live-image").attr("src",$(document).find("#ays-quiz-img").attr("src")),$(document).find(".ays-quiz-live-image").css({display:"block",margin:"0 auto"})):$(document).find(".ays-quiz-live-image").css({display:"none"})})),""!=$(document).find("input#ays_quiz_bg_image").val()&&$(document).find(".ays-quiz-live-container").css({"background-image":'url("'+$(document).find("input#ays_quiz_bg_image").val()+'")'}),$(document).find('input[name="ays_quiz_theme"]:checked').val()){case"elegant_dark":defaultQuizColor=defaultColors_elegantDark.quizColor,defaultBgColor=defaultColors_elegantDark.bgColor,defaultTextColor=defaultColors_elegantDark.textColor,defaultButtonsTextColor=defaultColors_elegantDark.buttonsTextColor;break;case"elegant_light":defaultQuizColor=defaultColors_elegantLight.quizColor,defaultBgColor=defaultColors_elegantLight.bgColor,defaultTextColor=defaultColors_elegantLight.textColor,defaultButtonsTextColor=defaultColors_elegantLight.buttonsTextColor;break;case"rect_light":defaultQuizColor=defaultColors_rectLight.quizColor,defaultBgColor=defaultColors_rectLight.bgColor,defaultTextColor=defaultColors_rectLight.textColor,defaultButtonsTextColor=defaultColors_rectLight.buttonsTextColor;break;case"rect_dark":defaultQuizColor=defaultColors_rectDark.quizColor,defaultBgColor=defaultColors_rectDark.bgColor,defaultTextColor=defaultColors_rectDark.textColor,defaultButtonsTextColor=defaultColors_rectDark.buttonsTextColor;break;case"classic_dark":defaultQuizColor=defaultColors_classicDark.quizColor,defaultBgColor=defaultColors_classicDark.bgColor,defaultTextColor=defaultColors_classicDark.textColor,defaultButtonsTextColor=defaultColors_classicDark.buttonsTextColor;break;default:defaultQuizColor=defaultColors_classicLight.quizColor,defaultBgColor=defaultColors_classicLight.bgColor,defaultTextColor=defaultColors_classicLight.textColor,defaultButtonsTextColor=defaultColors_classicLight.buttonsTextColor}let ays_quiz_bg_color_picker={defaultColor:defaultBgColor,change:function(e){setTimeout((function(){$(document).find(".ays-quiz-live-container").css({"background-color":e.target.value}),$(document).find(".ays-progress-value.fourth").css({color:e.target.value})}),1)}},ays_quiz_text_color_picker={defaultColor:defaultTextColor,change:function(e){setTimeout((function(){$(document).find(".ays-quiz-live-title").css({color:e.target.value}),$(document).find(".ays-quiz-live-subtitle").css({color:e.target.value}),$(document).find(".ays-progress-value.first, .ays-progress-value.second").css({color:e.target.value}),$(document).find(".ays-progress-value.third").css({color:e.target.value}),$(document).find(".ays-progress.first, .ays-progress.second").css({background:e.target.value}),$(document).find(".ays-progress-bg.third, .ays-progress-bg.fourth").css({background:e.target.value})}),1)}},ays_quiz_color_picker={defaultColor:defaultQuizColor,change:function(e){setTimeout((function(){$(document).find(".ays-quiz-live-button").css({background:e.target.value}),$(document).find(".ays-progress-bar.first, .ays-progress-bar.second").css({"background-color":e.target.value}),$(document).find(".ays-progress-bar.third, .ays-progress-bar.fourth").css({"background-color":e.target.value})}),1)}},ays_quiz_buttons_text_color={defaultColor:defaultButtonsTextColor,change:function(e){setTimeout((function(){$(document).find(".ays-quiz-live-container .ays-quiz-live-button").css({color:e.target.value}),$(document).find("#ays_buttons_styles_tab .ays-quiz-live-button").css({color:e.target.value})}),1)}},ays_quiz_box_shadow_color_picker={change:function(e){setTimeout((function(){var box_shadow=$(document).find("input#ays_quiz_box_shadow_x_offset").val()+"px "+($(document).find("input#ays_quiz_box_shadow_y_offset").val()+"px ")+($(document).find("input#ays_quiz_box_shadow_z_offset").val()+"px ");$(document).find(".ays-quiz-live-container").css({"box-shadow":box_shadow+" 1px "+e.target.value.hexToRgbA(.5)})}),1)}},ays_quiz_title_text_shadow_color={change:function(e){setTimeout((function(){if($(document).find("#ays_quiz_enable_title_text_shadow").prop("checked")){var text_shadow=$(document).find("input#ays_quiz_title_text_shadow_x_offset").val()+"px "+($(document).find("input#ays_quiz_title_text_shadow_y_offset").val()+"px ")+($(document).find("input#ays_quiz_title_text_shadow_z_offset").val()+"px ");$(document).find(".ays-quiz-live-container .ays-quiz-live-title").css({"text-shadow":text_shadow+" "+e.target.value})}}),1)}},ays_quiz_border_color_picker={change:function(e){setTimeout((function(){$(document).find(".ays-quiz-live-container").css({"border-color":e.target.value})}),1)}},ays_quiz_box_gradient_color1_picker={change:function(e){setTimeout((function(){toggleBackgrounGradient()}),1)}},ays_quiz_box_gradient_color2_picker={change:function(e){setTimeout((function(){toggleBackgrounGradient()}),1)}};function toggleBackgrounGradient(){if(""==$(document).find("input#ays_quiz_bg_image").val()){let quiz_gradient_direction=$(document).find("#ays_quiz_gradient_direction").val();switch(quiz_gradient_direction){case"horizontal":quiz_gradient_direction="to right";break;case"diagonal_left_to_right":quiz_gradient_direction="to bottom right";break;case"diagonal_right_to_left":quiz_gradient_direction="to bottom left";break;default:quiz_gradient_direction="to bottom"}$(document).find("input#ays-enable-background-gradient").prop("checked")?$(document).find(".ays-quiz-live-container").css({"background-image":"linear-gradient("+quiz_gradient_direction+", "+$(document).find("input#ays-background-gradient-color-1").val()+", "+$(document).find("input#ays-background-gradient-color-2").val()+")"}):$(document).find(".ays-quiz-live-container").css({"background-image":"none"})}}if($(document).find("#ays_quiz_gradient_direction").on("change",(function(){toggleBackgrounGradient()})),$(document).find("#ays-quiz-box-shadow-color").wpColorPicker(ays_quiz_box_shadow_color_picker),$(document).find("#ays_quiz_title_text_shadow_color").wpColorPicker(ays_quiz_title_text_shadow_color),$(document).find("#ays_quiz_border_color").wpColorPicker(ays_quiz_border_color_picker),$(document).find("#ays-quiz-bg-color").wpColorPicker(ays_quiz_bg_color_picker),$(document).find("#ays-quiz-buttons-text-color").wpColorPicker(ays_quiz_buttons_text_color),$(document).find("#ays-quiz-text-color").wpColorPicker(ays_quiz_text_color_picker),$(document).find("#ays-quiz-color").wpColorPicker(ays_quiz_color_picker),$(document).find("#ays-background-gradient-color-1").wpColorPicker(ays_quiz_box_gradient_color1_picker),$(document).find("#ays-background-gradient-color-2").wpColorPicker(ays_quiz_box_gradient_color2_picker),$(document).find("#ays_quiz_flash_card_color").wpColorPicker({defaultColor:"#ffffff",change:function(e){}}),$(document).find("#ays_quiz_timer_warning_text_color").wpColorPicker({defaultColor:"#ff0000",change:function(e){}}),$(document).find("#ays_leadboard_color").wpColorPicker({defaultColor:"#99BB5A",change:function(e){}}),$(document).find("#ays_gleadboard_color").wpColorPicker({defaultColor:"#99BB5A",change:function(e){}}),$(document).find("#ays_gleadboard_quiz_cat_color").wpColorPicker({defaultColor:"#99BB5A",change:function(e){}}),$(document).find("#ays_answers_border_color").wpColorPicker({change:function(e){}}),$(document).find("#ays_answers_box_shadow_color").wpColorPicker({change:function(e){}}),$(document).find("input#ays-enable-background-gradient").on("change",(function(){toggleBackgrounGradient()})),toggleBackgrounGradient(),$(document).find("#ays_enable_box_shadow").prop("checked")){var box_shadow=$(document).find("input#ays_quiz_box_shadow_x_offset").val()+"px "+($(document).find("input#ays_quiz_box_shadow_y_offset").val()+"px ")+($(document).find("input#ays_quiz_box_shadow_z_offset").val()+"px ");$(document).find(".ays-quiz-live-container").css({"box-shadow":box_shadow+"1px "+$(document).find("#ays-quiz-box-shadow-color").val().hexToRgbA(.4)})}else $(document).find(".ays-quiz-live-container").css({"box-shadow":"none"});if($(document).find("#ays_enable_box_shadow, #ays_quiz_box_shadow_x_offset, #ays_quiz_box_shadow_y_offset, #ays_quiz_box_shadow_z_offset").on("change",(function(){if($(document).find("#ays_enable_box_shadow").prop("checked")){var box_shadow=$(document).find("input#ays_quiz_box_shadow_x_offset").val()+"px "+($(document).find("input#ays_quiz_box_shadow_y_offset").val()+"px ")+($(document).find("input#ays_quiz_box_shadow_z_offset").val()+"px ");$(document).find(".ays-quiz-live-container").css({"box-shadow":box_shadow+"1px "+$(document).find("#ays-quiz-box-shadow-color").val().hexToRgbA(.4)})}else $(document).find(".ays-quiz-live-container").css({"box-shadow":"none"})})),$(document).find("#ays_quiz_enable_title_text_shadow").prop("checked")){var text_shadow=$(document).find("input#ays_quiz_title_text_shadow_x_offset").val()+"px "+($(document).find("input#ays_quiz_title_text_shadow_y_offset").val()+"px ")+($(document).find("input#ays_quiz_title_text_shadow_z_offset").val()+"px ");$(document).find(".ays-quiz-live-container .ays-quiz-live-title").css({"text-shadow":text_shadow+" "+$(document).find("#ays_quiz_title_text_shadow_color").val()})}else $(document).find(".ays-quiz-live-container .ays-quiz-live-title").css({"text-shadow":"none"});if($(document).find("#ays_quiz_enable_title_text_shadow, #ays_quiz_title_text_shadow_x_offset, #ays_quiz_title_text_shadow_y_offset, #ays_quiz_title_text_shadow_z_offset").on("change",(function(){if($(document).find("#ays_quiz_enable_title_text_shadow").prop("checked")){var text_shadow=$(document).find("input#ays_quiz_title_text_shadow_x_offset").val()+"px "+($(document).find("input#ays_quiz_title_text_shadow_y_offset").val()+"px ")+($(document).find("input#ays_quiz_title_text_shadow_z_offset").val()+"px ");$(document).find(".ays-quiz-live-container .ays-quiz-live-title").css({"text-shadow":text_shadow+" "+$(document).find("#ays_quiz_title_text_shadow_color").val()})}else $(document).find(".ays-quiz-live-container .ays-quiz-live-title").css({"text-shadow":"none"})})),$(document).find("#ays_enable_border").prop("checked")?$(document).find(".ays-quiz-live-container").css({border:$(document).find("#ays_quiz_border_width").val()+"px "+$(document).find("#ays_quiz_border_style").val()+" "+$(document).find("#ays_quiz_border_color").val()}):$(document).find(".ays-quiz-live-container").css({border:"none"}),$(document).find("#ays_enable_border").on("change",(function(){$(this).prop("checked")?$(document).find(".ays-quiz-live-container").css({border:$(document).find("#ays_quiz_border_width").val()+"px "+$(document).find("#ays_quiz_border_style").val()+" "+$(document).find("#ays_quiz_border_color").val()}):$(document).find(".ays-quiz-live-container").css({border:"none"})})),$(document).find("#ays_quiz_border_width").on("change",(function(){$(document).find(".ays-quiz-live-container").css({"border-width":$(document).find("#ays_quiz_border_width").val()+"px"})})),$(document).find("#ays_quiz_border_style").on("change",(function(){$(document).find(".ays-quiz-live-container").css({"border-style":$(document).find("#ays_quiz_border_style").val()})})),$(document).find(".ays-quiz-live-container").css({"border-radius":$(document).find("#ays_quiz_border_radius").val()+"px"}),$(document).find("#ays_quiz_border_radius").on("change",(function(){$(document).find(".ays-quiz-live-container").css({"border-radius":$(this).val()+"px"})})),$(document).find("#ays_enable_live_bar_option").on("change",(function(){$(this).prop("checked")?$(document).find("#ays_enable_percent_view_option_div").show(250):$(document).find("#ays_enable_percent_view_option_div").hide(250)})),$(document).find("#ays_enable_quiz_rate").on("change",(function(){$(this).prop("checked")?$(this).parents(".form-group.row").find(".ays_hidden").show(250):$(this).parents(".form-group.row").find(".ays_hidden").hide(250)})),""!=$(document).find("#ays_quiz_title_transformation").val()){var transformation_value=$(document).find("#ays_quiz_title_transformation").val();$(document).find(".ays-quiz-live-container .ays-quiz-live-title").css({"text-transform":transformation_value})}function ays_formatState(ays_state){if(!ays_state.id)return aysEscapeHtml(ays_state.text);var baseUrl=$(ays_state.element).data("nkar");if(""!=baseUrl)ays_state=$("<span><img src="+baseUrl+' class="ays_answer_select_image" /> '+aysEscapeHtml(ays_state.text)+"</span>");else ays_state=$("<span>"+aysEscapeHtml(ays_state.text)+"</span>");return ays_state}$(document).find("#ays_quiz_title_transformation").on("change",(function(){var transformationValue=$(this).val();$(document).find(".ays-quiz-live-container .ays-quiz-live-title").css({"text-transform":transformationValue})})),$(document).find("#ays-category").select2({placeholder:"Select category"}),$(document).find("#ays_quiz_schedule_timezone").select2(),$(document).find("#ays-type").select2({placeholder:"Select question type",templateResult:ays_formatState,templateSelection:ays_formatState}).on("change",(function(e){var questionType=$(this).val(),defaultCount=$(document).find('input[name="ays_answer_default_count"]');"true_or_false"==questionType&&defaultCount.length>0&&defaultCount.val(2)})),$(document).find("#ays_question_default_category").select2({placeholder:"Select question category"}),$(document).find("#ays-quiz-theme").select2({placeholder:"Select quiz theme"}),$("#ays_smtp_secures").select2(),$("#ays_add_postcat_for_quiz").select2(),$(document).find("table.ays-answers-table tbody").sortable({handle:".ays-quiz-question-answer-ordering-row",cursor:"move",opacity:.8,axis:"y",placeholder:"clone",tolerance:"pointer",helper:"clone",revert:!0,forcePlaceholderSize:!0,forceHelperSize:!0,update:function(event,ui){let className=ui.item.attr("class").split(" ")[0];$(document).find("tr."+className).each((function(index){let newValue=index+1,classEven=(index+1)%2==0?"even":"";$(this).hasClass("even")&&$(this).removeClass("even"),$(this).addClass(classEven),$(this).find(".ays-correct-answer").val(newValue),void 0!==$(this).find(".ays-correct-answer").attr("checked")&&$(this).find(".ays-correct-answer").prop("checked",!0)}))}}),$(document).find(".ays-show-user-page-table").sortable({cursor:"move",opacity:.8,tolerance:"pointer",helper:"clone",placeholder:"ays_user_page_sortable_placeholder",revert:!0,forcePlaceholderSize:!0,forceHelperSize:!0}),$(document).find("#ays_quick_start").on("click",(function(){var activate_first_question=$(document).find("#ays_question_id_1");$("#ays-quick-modal").aysModal(),activate_first_question.hasClass("active_question")||(activate_first_question.addClass("active_question"),activate_question(activate_first_question))})),$(document).on("click",".ays_modal_question",(function(e){$(this).hasClass("active_question")||(!function(){if(0!==$(".active_question").length){var question=$(".active_question").eq(0);$(question).find('input[name^="ays_answer_radio"]:checked').length||$(question).find('input[name^="ays_answer_radio"]').eq(0).attr("checked",!0),$(question).find(".ays_add_answer").parents().eq(1).addClass("show_add_answer"),$(question).find(".fa.fa-times").parent().removeClass("active_remove_answer").addClass("show_remove_answer");var question_text=$(question).find(".ays_question_input").val();$(question).find(".ays_question_input").remove(),$(question).prepend('<p class="ays_question">'+question_text+"</p>");for(var answers_tr=$(question).find(".ays_answers_table tr"),i=0;i<answers_tr.length;i++){var answer_text=$(answers_tr.eq(i)).find(".ays_answer").val()?$(answers_tr.eq(i)).find(".ays_answer").val():"";$(answers_tr.eq(i)).find(".ays_answer_td").empty();let answer_html='<p class="ays_answer">'+answer_text+"</p>"+(""==answer_text?"<p>Answer</p>":"");$(answers_tr.eq(i)).find(".ays_answer_td").append(answer_html)}$(".active_question").removeClass("active_question")}}(),activate_question($(this)))})),$(document).find(".ays-close").on("click",(function(){$(this).parents(".ays-modal").aysModal("hide")})),$(document).find(".ays-close-pro-popup").on("click",(function(){$(this).parents(".ays-modal").aysModal("hide_remove_video")})),$(document).find("#ays-quick-modal-content .ays-close").on("click",(function(){$(this).parents(".ays-modal").aysModal("hide")})),$(document).on("click",".active_remove_answer",(function(){if($(this).parents(".ays_answers_table").find(".ays_answer_td").length>2){if(window.confirm("Are you sure you want to delete answer ?")){var item=$(this).parents().eq(0);$(this).parents().eq(0).addClass("animated fadeOutLeft"),item.remove()}}else swal({type:"warning",text:"Sorry minimum count of answers should be 2"})})),$(document).on("click",".ays_trash_icon",(function(){if(window.confirm(quizLangObj.deleteQuestion)){if(1==$(document).find(".ays_modal_question").length)return swal.fire({type:"warning",text:"Sorry minimum count of questions should be 1"}),!1;var item=$(this).parents(".ays_modal_element.ays_modal_question");item.addClass("animated fadeOutLeft"),setTimeout((function(){item.remove()}),400)}})),$(document).on("click",".ays_modal_element.ays_modal_question",(function(){$(this).hasClass("active_question_border")||($(document).find("#ays-quick-modal-content .ays_modal_element.ays_modal_question").removeClass("active_question_border"),$(this).addClass("active_question_border"))})),$(document).on("click",".ays_question_clone_icon",(function(e){var question_max_inp_id=$(document).find("#ays_quick_question_max_id"),question_max_id=parseInt(question_max_inp_id.val());isNaN(question_max_id)&&(question_max_id=1);var ays_answer_radio_id=question_max_id+1;question_max_inp_id.val(ays_answer_radio_id);var cloningElement=$(this).parents(".ays_modal_element.ays_modal_question"),questionType=cloningElement.find(".ays_quick_question_type").val(),questionCat=cloningElement.find(".ays_quick_question_cat").val(),parentId=cloningElement.attr("id");$(document).find("#"+parentId+" .ays_answer_unique_id:checked").addClass("checkedElement");var cloneElem=cloningElement.clone(!0,!0);cloneElem.attr("id","ays_question_id_"+ays_answer_radio_id),cloneElem.find(".ays_question_input").select();var selectedQuestionType=cloneElem.find(".ays_quick_question_type option"),selectedQuestionCat=cloneElem.find(".ays_quick_question_cat option");selectedQuestionType.each((function(e){var _this=$(this),selectedAttr=_this.attr("selected");void 0!==selectedAttr&&!1!==selectedAttr&&_this.removeAttr("selected")})),selectedQuestionCat.each((function(e){var _this=$(this),selectedAttr=_this.attr("selected");void 0!==selectedAttr&&!1!==selectedAttr&&_this.removeAttr("selected")})),cloneElem.find(".ays_quick_question_type option[value="+questionType+"]").attr("selected","selected"),cloneElem.find(".ays_quick_question_cat option[value="+questionCat+"]").attr("selected","selected"),cloneElem.find(".ays_answer_unique_id").attr("name","ays_answer_radio["+ays_answer_radio_id+"]"),cloneElem.find(".checkedElement:first-of-type").attr("checked","checked"),cloneElem.insertAfter("#"+parentId),setTimeout((function(){$(document).find("#ays-quick-modal-content .ays_modal_element.ays_modal_question").removeClass("active_question_border"),$(document).find("#ays_question_id_"+ays_answer_radio_id).addClass("active_question_border")}),100)})),$(document).on("change",".ays_quick_question_type",(function(e){var $this=$(this),parent=$this.parents(".ays_modal_question"),questionType=(parent.attr("id"),$this.val()),answersTable=parent.find(".ays_answers_table"),answerUniqueID=answersTable.find(".ays_answer_unique_id"),textTypeTable=parent.find("table.ays_quick_quiz_text_type_table"),question_max_inp_id=$(document).find("#ays_quick_question_max_id"),question_max_id=parseInt(question_max_inp_id.val());isNaN(question_max_id)&&(question_max_id=1);var ays_answer_radio_id=question_max_id+1;switch(questionType){case"radio":case"select":default:answerUniqueID.attr("type","radio");break;case"checkbox":answerUniqueID.attr("type","checkbox");break;case"text":var textHTML='<tr><td><input style="display:none;" class="ays-correct-answer ays_answer_unique_id" type="checkbox" name="ays_answer_radio['+ays_answer_radio_id+']" value="1" checked/><textarea type="text" name="ays-correct-answer-value[]" class="ays-correct-answer-value" placeholder="'+quizLangObj.answerText+'"></textarea></td></tr>',shortTextTypeElement=(textTypeElementTd=textTypeTable.find("tbody")).find("input.ays-correct-answer-value.ays-text-question-type-value");shortTextTypeElement.length>0&&shortTextTypeElement.remove(),textTypeElementTd.html(textHTML),textTypeTable.hasClass("display_none")&&textTypeTable.removeClass("display_none"),answersTable.hasClass("display_none")||answersTable.addClass("display_none");break;case"short_text":var shortTextHTML='<tr><td><input style="display:none;" class="ays-correct-answer ays_answer_unique_id" type="checkbox" name="ays_answer_radio['+ays_answer_radio_id+']" value="1" checked/><input type="text" name="ays-correct-answer-value[]" class="ays-correct-answer-value ays-text-question-type-value" placeholder="'+quizLangObj.answerText+'" value=""/></td></tr>';(textTypeElement=(textTypeElementTd=textTypeTable.find("tbody")).find("textarea.ays-correct-answer-value.ays-text-question-type-value")).length>0&&textTypeElement.remove(),textTypeElementTd.html(shortTextHTML),textTypeTable.hasClass("display_none")&&textTypeTable.removeClass("display_none"),answersTable.hasClass("display_none")||answersTable.addClass("display_none");break;case"number":var numberHTML='<tr><td><input style="display:none;" class="ays-correct-answer ays_answer_unique_id" type="checkbox" name="ays_answer_radio['+ays_answer_radio_id+']" value="1" checked/><input type="number" name="ays-correct-answer-value[]" class="ays-correct-answer-value ays-text-question-type-value" placeholder="'+quizLangObj.answerText+'" value=""/></td></tr>';(textTypeElement=(textTypeElementTd=textTypeTable.find("tbody")).find("textarea.ays-correct-answer-value.ays-text-question-type-value")).length>0&&textTypeElement.remove(),textTypeElementTd.html(numberHTML),textTypeTable.hasClass("display_none")&&textTypeTable.removeClass("display_none"),answersTable.hasClass("display_none")||answersTable.addClass("display_none");break;case"true_or_false":var trueOrFalseHTML='<tr> <td> <input class="ays_answer_unique_id" type="radio" name="ays_answer_radio['+ays_answer_radio_id+']" checked> </td> <td class="ays_answer_td"> <p class="ays_answer">'+quizLangObj.true+'</p> <p>Answer</p> </td> <td class="show_remove_answer"> <i class="ays_fa ays_fa_times" aria-hidden="true"></i> </td></tr><tr> <td> <input class="ays_answer_unique_id" type="radio" name="ays_answer_radio['+ays_answer_radio_id+']"> </td> <td class="ays_answer_td"> <p class="ays_answer">'+quizLangObj.false+'</p> <p>Answer</p> </td> <td class="show_remove_answer"> <i class="ays_fa ays_fa_times" aria-hidden="true"></i> </td></tr><tr class="ays_quiz_add_answer_box show_add_answer"> <td colspan="3"> <a href="javascript:void(0)" class="ays_add_answer"> <i class="ays_fa ays_fa_plus_square" aria-hidden="true"></i> </a> </td></tr>';answersTable.find("tbody").html(trueOrFalseHTML),activate_question(parent);break;case"date":var textTypeElementTd,textTypeElement,dateHTML='<tr><td><input style="display:none;" class="ays-correct-answer ays_answer_unique_id" type="checkbox" name="ays_answer_radio['+ays_answer_radio_id+']" value="1" checked/><input type="date" name="ays-correct-answer-value[]" class="ays-correct-answer-value ays-text-question-type-value" placeholder="'+quizLangObj.currentTime+'" value=""/></td></tr>';(textTypeElement=(textTypeElementTd=textTypeTable.find("tbody")).find("textarea.ays-correct-answer-value.ays-text-question-type-value")).length>0&&textTypeElement.remove(),textTypeElementTd.html(dateHTML),textTypeTable.hasClass("display_none")&&textTypeTable.removeClass("display_none"),answersTable.hasClass("display_none")||answersTable.addClass("display_none")}"text"!=questionType&&"short_text"!=questionType&&"number"!=questionType&&"date"!=questionType&&(answersTable.hasClass("display_none")&&answersTable.removeClass("display_none"),textTypeTable.hasClass("display_none")||textTypeTable.addClass("display_none"))})),$(document).on("click",".ays_add_question",(function(){var question_max_inp_id=$(document).find("#ays_quick_question_max_id"),question_max_id=parseInt(question_max_inp_id.val());isNaN(question_max_id)&&(question_max_id=1);var ays_answer_radio_id=question_max_id+1;question_max_inp_id.val(ays_answer_radio_id);var ays_quiz_catObj=aysQuizCatObj.category,appendAble='<div class="ays_modal_element ays_modal_question active_question active_question_border" id="ays_question_id_'+ays_answer_radio_id+'"> <div class="form-group row"> <div class="col-sm-9"> <input type="text" value="'+quizLangObj.questionTitle+'" class="ays_question_input"> </div> <div class="col-sm-3" style="text-align: right;"> <select class="ays_quick_question_type" name="ays_quick_question_type[]" style="width: 120px;"> <option value="radio">'+quizLangObj.radio+'</option> <option value="checkbox">'+quizLangObj.checkbox+'</option> <option value="select">'+quizLangObj.dropdawn+'</option> <option value="text">'+quizLangObj.textType+'</option> <option value="short_text">'+quizLangObj.shortTextType+'</option> <option value="number">'+quizLangObj.number+'</option> <option value="true_or_false">'+quizLangObj.trueOrFalse+'</option> <option value="date">'+quizLangObj.date+'</option> </select> </div> </div> <div class="form-group row"> <div class="col-sm-12" style="text-align: right;"> <select class="ays_quick_question_cat" name="ays_quick_question_cat[]" style="width: 120px;">';for(var k in ays_quiz_catObj)appendAble+='<option value="'+ays_quiz_catObj[k].id+'">'+ays_quiz_catObj[k].title+"</option>";appendAble+='</select> </div> </div> <div class="ays-modal-flexbox flex-end"> <table class="ays_answers_table"> <tr> <td> <input class="ays_answer_unique_id" type="radio" name="ays_answer_radio['+ays_answer_radio_id+']" checked> </td> <td class="ays_answer_td"> <p class="ays_answer"></p> <p>Answer</p> </td> <td class="show_remove_answer"> <i class="ays_fa ays_fa_times" aria-hidden="true"></i> </td> </tr> <tr> <td> <input class="ays_answer_unique_id" type="radio" name="ays_answer_radio['+ays_answer_radio_id+']"> </td> <td class="ays_answer_td"> <p class="ays_answer"></p> <p>Answer</p> </td> <td class="show_remove_answer"> <i class="ays_fa ays_fa_times" aria-hidden="true"></i> </td> </tr> <tr> <td> <input class="ays_answer_unique_id" type="radio" name="ays_answer_radio['+ays_answer_radio_id+']"> </td> <td class="ays_answer_td"> <p class="ays_answer"></p> <p>Answer</p> </td> <td class="show_remove_answer"> <i class="ays_fa ays_fa_times" aria-hidden="true"></i> </td> </tr> <tr class="ays_quiz_add_answer_box show_add_answer"> <td colspan="3"> <a href="javascript:void(0)" class="ays_add_answer"> <i class="ays_fa ays_fa_plus_square" aria-hidden="true"></i> </a> </td> </tr> </table> <table class="ays_quick_quiz_text_type_table display_none"> <tr> <td> <input style="display:none;" class="ays-correct-answer ays_answer_unique_id" type="checkbox" name="ays_answer_radio['+ays_answer_radio_id+']" value="1" checked/> <textarea type="text" name="ays-correct-answer-value[]" class="ays-correct-answer-value ays-text-question-type-value" placeholder="'+quizLangObj.answerText+'"></textarea> </td> </tr> </table> <div class="ays-quick-quiz-icons-box"> <a href="javascript:void(0)" class="ays_question_clone_icon"> <i class="ays_fa ays_fa_clone" aria-hidden="true"></i> </a> <a href="javascript:void(0)" class="ays_trash_icon"> <i class="ays_fa ays_fa_trash_o" aria-hidden="true"></i> </a> </div> </div></div>',$(document).find(".ays-quick-questions-container").append(appendAble),activate_question($(document).find("#ays_question_id_"+ays_answer_radio_id))})),$(document).on("click",".ays_add_answer",(function(){var questType,question_id=$(document).find(".ays_modal_question").index($(this).parents(".ays_modal_question"));switch($(this).parents(".ays_modal_question").find(".ays_quick_question_type").val()){case"radio":case"select":default:questType="radio";break;case"checkbox":questType="checkbox"}$(this).parents().eq(1).before('<tr><td><input class="ays_answer_unique_id" type="'+questType+'" name="ays_answer_radio['+ ++question_id+']"></td><td class="ays_answer_td"><input type="text" placeholder="'+quizLangObj.emptyAnswer+'" class="ays_answer"></td><td class="active_remove_answer"><i class="ays_fa ays_fa_times" aria-hidden="true"></i></td></tr>');var tableTr=$(this).parents(".ays_answers_table").find("tr"),postPreviousChild=tableTr.length-2;tableTr.eq(postPreviousChild).find(".ays_answer").select()})),$(document).find("table.ays-questions-table tbody").sortable({handle:"td.ays-sort",cursor:"move",opacity:.8,axis:"y",placeholder:"clone",tolerance:"pointer",helper:"clone",revert:!0,forcePlaceholderSize:!0,forceHelperSize:!0,items:"tr:not(.ays-question-empty-row)",update:function(event,ui){let className=ui.item.attr("class").split(" ")[0],sorting_ids=[];$("#ays-questions-table").find("tr."+className+":not(.ays-question-empty-row)").each((function(index){let classEven=(index+1)%2==0?"even":"";$(this).hasClass("even")&&$(this).removeClass("even"),void 0!==$(this).data("id")&&sorting_ids.push($(this).data("id")),$(this).addClass(classEven)})),$(document).find("input#ays_already_added_questions").val(sorting_ids)}}),$(document).on("click",".ays-add-answer",(function(){var cloned,answer_row=$(".ays-answer-row"),row_count=answer_row.length,row_id=row_count+1,parent=$(document).find("table#ays-answers-table");(cloned=answer_row.eq(row_count-1).clone()).find("input.ays-correct-answer").attr("id","ays-correct-answer-"+row_id),cloned.find("input.ays-correct-answer").val(row_id),cloned.find("input.ays-correct-answer").prop("checked",!1),cloned.find("input.ays-correct-answer-value").val(""),cloned.find(".ays-answer-image-container").parent().html(" <label class='ays-label' for='ays-answer'><a href=\"javascript:void(0)\" class=\"add-answer-image\" style=display:block;>"+quizLangObj.add+'</a></label>\n<div class="ays-answer-image-container ays-answer-image-container-div" style=display:none; >\n<span class="ays-edit-answer-img" title="'+quizLangObj.editImage+'"></span>\n<span class="ays-remove-answer-img" title="'+quizLangObj.deleteImage+'"></span>\n<img src="" class="ays-answer-img" />\n<input type="hidden" name="ays_answer_image[]" class="ays-answer-image-path" value=""/>\n </div>'),cloned.find("label").attr("for","ays-correct-answer-"+row_id),cloned.appendTo("table#ays-answers-table tbody"),$(document).find("table#ays-answers-table tr.ays-answer-row").each((function(index){$(this).hasClass("even")&&$(this).removeClass("even");var className=index%2==0?"even":"";$(this).addClass(className)})),parent.find("input[name='ays-correct-answer-value[]']").last().focus()})),$(document).on("click",".ays-delete-answer",(function(){let index=1;$("tr.ays-answer-row").length>2?($(this).parents("tr").find('input[type="radio"]').eq(0).prop("checked")&&$(this).parents("tbody").find('input[type="radio"]').eq(0).prop("checked",!0),$(this).parent("td").parent("tr.ays-answer-row").remove(),$(document).find("tr.ays-answer-row").each((function(){$(this).hasClass("even")&&$(this).removeClass("even");let className=index%2==0?"even":"";$(this).addClass(className),$(this).find("span.ays-radio").find("input").attr("id","ays-correct-answer-"+index),$(this).find("span.ays-radio").find("input").val(index),$(this).find("span.ays-radio").find("label").attr("for","ays-correct-answer-"+index),index++}))):swal({type:"warning",text:"Sorry minimum count of answers should be 2"})})),$(document).on("change","#ays-type",(function(){if("checkbox"===$(this).val())$(document).find("input.ays-correct-answer").attr("type","checkbox");else $(document).find("input.ays-correct-answer").attr("type","radio")})),$(document).on("change",".ays-correct-answer",(function(){!0===$(this).prop("checked")&&$(this).attr("checked","checked")})),$(document).find("#ays-type").on("change",(function(e){var answer_row=$(".ays-answer-row"),row_count=answer_row.length,row_id=row_count+1,textTypes=["text","short_text"],isTextType=!1,numberTypes=["number"],isNumberType=!1,checkboxTypes=["checkbox"],isCheckboxType=!1;row_count%2==0?answer_row.eq(0).clone():answer_row.eq(1).clone(),$(document).find(".ays-answers-toolbar-bottom").hide(),$(document).find(".ays-text-answers-desc").hide();for(var i=0;i<textTypes.length;i++)if($(this).val()==textTypes[i]){isTextType=!0;break}for(i=0;i<numberTypes.length;i++)if($(this).val()==numberTypes[i]){isNumberType=!0;break}for(i=0;i<checkboxTypes.length;i++)if($(this).val()==checkboxTypes[i]){isCheckboxType=!0;break}var showForTextType=$(document).find(".show_for_text_type");isTextType?showForTextType.hasClass("display_none")&&showForTextType.removeClass("display_none"):showForTextType.hasClass("display_none")||showForTextType.addClass("display_none");var showForNumberType=$(document).find(".show_for_number_type");isNumberType?showForNumberType.hasClass("display_none")&&showForNumberType.removeClass("display_none"):showForNumberType.hasClass("display_none")||showForNumberType.addClass("display_none");var showForCheckboxType=$(document).find(".show_for_checkbox_type");if(isCheckboxType?showForCheckboxType.hasClass("display_none")&&showForCheckboxType.removeClass("display_none"):showForCheckboxType.hasClass("display_none")||showForCheckboxType.addClass("display_none"),"radio"!=$(this).val()&&"checkbox"!=$(this).val()&&$(document).find('.ays-answers-toolbar-bottom input[name="ays-use-html"]').removeAttr("checked"),"date"==$(this).val()){Date.prototype.yyyymmdd=function(){var mm=this.getMonth()+1,dd=this.getDate();return[this.getFullYear(),(mm>9?"":"0")+mm,(dd>9?"":"0")+dd].join("-")};var d=(new Date).yyyymmdd();let answerRow=$('<tr class="ays-answer-row ui-state-default"><td><input style="display:none;" class="ays-correct-answer" type="checkbox" name="ays-correct-answer[]" value="1" checked/><input type="date" name="ays-correct-answer-value[]" class="ays-date-input ays-correct-answer-value" value="" placeholder="e. g. '+d+'"/></td><td title="This property available only in pro version" class="only_pro"><div class="pro_features"></div><input class="w-100" type="number" value="1" tabindex="-1"/></td></tr>');$(document).find("table#ays-answers-table tbody").addClass("text_answer"),$(document).find('label[for="ays-answers-table"]').html("Answer"),$("table#ays-answers-table tbody").html(""),$("table#ays-answers-table thead tr th.removable").remove(),$("table#ays-answers-table thead tr th.reremoveable").remove(),$("table#ays-answers-table thead tr th:first-child").addClass("th-650"),$(document).find("table#ays-answers-table tbody").append(answerRow)}else if("number"==$(this).val()){let answerRow=$('<tr class="ays-answer-row ui-state-default"><td><input style="display:none;" class="ays-correct-answer" type="checkbox" name="ays-correct-answer[]" value="1" checked/><input type="number" step="any" name="ays-correct-answer-value[]" class="ays-correct-answer-value" value=""/></td><td title="This property available only in pro version" class="only_pro"><div class="pro_features"></div><input class="w-100" type="number" value="1" tabindex="-1"/></td><td><input type="text" name="ays-answer-placeholder[]" class="ays-correct-answer-value" value=""/></td></tr>');$(document).find("table#ays-answers-table tbody").addClass("text_answer"),$(document).find('label[for="ays-answers-table"]').html("Answer"),$("table#ays-answers-table tbody").html("");let answerHeadRowLast=$('<th class="th-350 reremoveable">Placeholder</th>');$("table#ays-answers-table thead tr th.removable").remove(),$("table#ays-answers-table thead tr th.reremoveable").remove(),$(document).find("table#ays-answers-table thead tr").append(answerHeadRowLast),$("table#ays-answers-table thead tr th:first-child").addClass("th-650"),$(document).find("table#ays-answers-table tbody").append(answerRow)}else if("short_text"==$(this).val()){$(document).find(".ays-text-answers-desc").show();let answerRow=$('<tr class="ays-answer-row ui-state-default"><td><input style="display:none;" class="ays-correct-answer" type="checkbox" name="ays-correct-answer[]" value="1" checked/><input type="text" name="ays-correct-answer-value[]" class="ays-correct-answer-value" value=""/></td><td title="This property available only in pro version" class="only_pro"><div class="pro_features"></div></div><input class="w-100" type="number" value="1" tabindex="-1"/></td><td><input type="text" name="ays-answer-placeholder[]" class="ays-correct-answer-value" value=""/></td></tr>');$(document).find("table#ays-answers-table tbody").addClass("text_answer"),$(document).find('label[for="ays-answers-table"]').html("Answer"),$("table#ays-answers-table tbody").html("");let answerHeadRowLast=$('<th class="th-350 reremoveable">Placeholder</th>');$("table#ays-answers-table thead tr th.removable").remove(),$("table#ays-answers-table thead tr th.reremoveable").remove(),$(document).find("table#ays-answers-table thead tr").append(answerHeadRowLast),$("table#ays-answers-table thead tr th:first-child").addClass("th-650"),$(document).find("table#ays-answers-table tbody").append(answerRow)}else if("text"==$(this).val()){$(document).find(".ays-text-answers-desc").show();let answerRow=$('<tr class="ays-answer-row ui-state-default"><td><input style="display:none;" class="ays-correct-answer" type="checkbox" name="ays-correct-answer[]" value="1" checked/><textarea type="text" name="ays-correct-answer-value[]" class="ays-correct-answer-value"></textarea></td><td title="This property available only in pro version" class="only_pro"><div class="pro_features"></div></div><input class="w-100" type="number" value="1" tabindex="-1"/></td><td><input type="text" name="ays-answer-placeholder[]" class="ays-correct-answer-value" value=""/></td></tr>');$(document).find("table#ays-answers-table tbody").addClass("text_answer"),$(document).find('label[for="ays-answers-table"]').html("Answer"),$("table#ays-answers-table tbody").html("");let answerHeadRowLast=$('<th class="th-350 reremoveable">Placeholder</th>');$("table#ays-answers-table thead tr th.removable").remove(),$("table#ays-answers-table thead tr th.reremoveable").remove(),$(document).find("table#ays-answers-table thead tr").append(answerHeadRowLast),$("table#ays-answers-table thead tr th:first-child").addClass("th-650"),$(document).find("table#ays-answers-table tbody").append(answerRow)}else{$(document).find(".ays-answers-toolbar-bottom").css({display:"flex"}),"select"==$(this).val()?$(document).find(".ays-answers-toolbar-bottom").find(".use_html").hide():$(document).find(".ays-answers-toolbar-bottom").find(".use_html").show(),$(document).find(".ays-answers-toolbar-bottom").hasClass("ays-answers-toolbar-bottom-center")||$(document).find(".ays-answers-toolbar-bottom").addClass("ays-answers-toolbar-bottom-center");var true_or_false_flag=!1;if("true_or_false"==$(this).val()&&(true_or_false_flag=!0),$(document).find("table#ays-answers-table tbody").hasClass("text_answer")||true_or_false_flag){$(document).find("table#ays-answers-table tbody").removeClass("text_answer");var pro_features_new_design_html="";pro_features_new_design_html+='<a href="https://ays-pro.com/wordpress/quiz-maker?utm_source=dashboard&utm_medium=quiz-free&utm_campaign=answer-table-'+quizLangObj.AYS_QUIZ_UTM_VERSION+'" tabindex="-1" target="_blank" class="ays-quiz-new-upgrade-button-link ays-quiz-new-upgrade-button-without-text-link">',pro_features_new_design_html+='<div class="ays-quiz-new-upgrade-button-box">',pro_features_new_design_html+="<div>",pro_features_new_design_html+='<img src="'+quizLangObj.AYS_QUIZ_ADMIN_URL+'/images/icons/locked_24x24.svg">',pro_features_new_design_html+='<img src="'+quizLangObj.AYS_QUIZ_ADMIN_URL+'/images/icons/unlocked_24x24.svg" class="ays-quiz-new-upgrade-button-hover">',pro_features_new_design_html+="</div>",pro_features_new_design_html+="</div>";var keyworHtml='<th class="only_pro th-150 removable" style="width:120px;padding:0;">Keyword<br>'+(pro_features_new_design_html+="</a>")+"</th>",addAnswer=$('<div class="ays-answers-footer-toolbar" style="padding:5px;padding-top:10px;"><a href="javascript:void(0)" class="ays-add-answer ays-add-question-answer"><i class="ays_fa ays_fa_plus_square" aria-hidden="true"></i>'+quizLangObj.addAnswer+"</a></div>"),answerHeadRow=$('<th class="th-150 removable">Ordering</th><th class="th-150 removable">Correct</th>'),answerHeadKeywordRow=$(keyworHtml),answerHeadRowLast=$('<th class="th-150 removable" style="padding:0;">Image</th><th class="th-150 removable">Delete</th>');$("table#ays-answers-table thead tr th.removable").remove(),$("table#ays-answers-table thead tr th.reremoveable").remove(),$(document).find('.ays-answers-toolbar-bottom-center label[for="ays-answers-table"]').html(""),$(document).find('.ays-answers-toolbar-bottom-center label[for="ays-answers-table"]').append(addAnswer),$(document).find("table#ays-answers-table thead tr").prepend(answerHeadRow),answerHeadKeywordRow.insertAfter("table#ays-answers-table thead .ays-weight-row"),$(document).find("table#ays-answers-table thead tr").append(answerHeadRowLast),$(document).find("table#ays-answers-table tbody").html("");var default_answer_count=$(document).find("table#ays-answers-table").attr("ays_default_count");default_answer_count=parseInt(default_answer_count);var true_or_false_arr=new Array(quizLangObj.true,quizLangObj.false);true_or_false_flag&&(default_answer_count=2);var loop_index=0;for(row_id=1;row_id<=default_answer_count;row_id++){var true_or_false_val="";true_or_false_flag&&(void 0!==true_or_false_arr[loop_index]&&(true_or_false_val=true_or_false_arr[loop_index]),loop_index++);var answerRow='<tr class="ays-answer-row ui-state-default"><td class="ays-quiz-question-answer-ordering-row"><i class="ays_fa ays_fa_arrows" aria-hidden="true"></i></td><td class="ays-quiz-question-answer-correct-row"><span><input type="radio" id="ays-correct-answer-'+row_id+'" class="ays-correct-answer" name="ays-correct-answer[]" value="'+row_id+'"/><label for="ays-correct-answer-'+row_id+'"></label></span></td><td class="ays-quiz-question-answer-answer-row"><input type="text" name="ays-correct-answer-value[]" class="ays-correct-answer-value" value="'+true_or_false_val+'"/></td><td title="This property available only in pro version" class="only_pro ays-quiz-question-answer-weight-point-row"><div class="pro_features"></div><input class="w-100" type="number" value="1" tabindex="-1"/></td><td title="This property available only in pro version" class="only_pro ays-quiz-question-answer-keyword-row"><div class="pro_features"></div><select class="ays_quiz_keywords" tabindex="-1"><option value="A">A</option></select></td><td class="ays-quiz-question-answer-image-row"><label class="ays-label" for="ays-answer"><a href="javascript:void(0)" class="add-answer-image" style="display:block;">'+quizLangObj.add+'</a></label><div class="ays-answer-image-container ays-answer-image-container-div" style="display:none;"><span class="ays-edit-answer-img" title="'+quizLangObj.editImage+'"></span><span class="ays-remove-answer-img" title="'+quizLangObj.deleteImage+'"></span><img src="" class="ays-answer-img"/><input type="hidden" name="ays_answer_image[]" class="ays-answer-image-path" value=""/></div></td><td class="ays-quiz-question-answer-delete-row"><a href="javascript:void(0)" class="ays-delete-answer"> <i class="ays_fa ays_fa_minus_square" aria-hidden="true"></i></a></td></tr>';$(document).find("table#ays-answers-table tbody").append(answerRow)}}}})),$(document).find("#ays_enable_quiz_theme").on("change",(function(){$(this).prop("checked")?$(document).find("#ays_quiz_theme_div").css({display:"block"}):$(document).find("#ays_quiz_theme_div").css({display:"none"})})),$(document).on("click",".ays-delete-question",(function(){let index=1,id_container=$(document).find("input#ays_already_added_questions"),existing_ids=id_container.val().split(","),q=$(this);q.parents("tr").css({"animation-name":"slideOutLeft","animation-duration":".3s"});let indexOfAddTable=$.inArray($(this).data("id"),window.aysQuestSelected);if(-1!==indexOfAddTable&&(window.aysQuestSelected.splice(indexOfAddTable,1),qatable.draw()),-1!==$.inArray($(this).data("id").toString(),existing_ids)){let position=$.inArray($(this).data("id").toString(),existing_ids);existing_ids.splice(position,1),id_container.val(existing_ids.join(","))}$(document).find('input[type="checkbox"]#ays_select_'+$(this).data("id")).prop("checked",!1),setTimeout((function(){q.parent("td").parent("tr.ays-question-row").remove();let questions_count=$(document).find("table.ays-questions-table tbody").find("tr.ays-question-row").length;if($(document).find(".questions_count_number").text(questions_count),0==$(document).find("tr.ays-question-row").length){var colspan=$(document).find("table.ays-questions-table thead th").length;$(document).find("#ays-questions-table").find(".dataTables_empty").parents("tr").remove();let quizEmptytd='<tr class="ays-question-row ays-question-empty-row ui-state-default"> <td colspan="'+colspan+'" class="empty_quiz_td"> <div class="ays-quiz-create-question-link-box"> <i class="ays_fa ays_fa_info" aria-hidden="true" style="margin-right:10px"></i> <span style="font-size: 13px; font-style: italic;"> There are no questions yet. </span> </div> <div class="ays_add_question_from_table"> <a href="javascript:void(0)" class="ays-add-question-primary"> <i class="ays_fa ays_fa_plus_square" aria-hidden="true"></i> '+quizLangObj.insertQuestion+' </a> <a href="admin.php?page=quiz-maker-questions&action=add" class="ays-add-question" target="_blank"> '+quizLangObj.createQuestion+' <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-external-link-icon lucide-external-link"><path d="M15 3h6v6"/><path d="M10 14 21 3"/><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/></svg> </a> </div> </td></tr>';$(document).find("#ays-questions-table tbody").append(quizEmptytd)}$(document).find("tr.ays-question-row").each((function(){$(this).hasClass("even")&&$(this).removeClass("even");let className=index%2==0?"even":"";index++,$(this).addClass(className)})),0==$(document).find("table.ays-questions-table tbody").find(".ays-sort").length&&$(document).find("table#ays-questions-table").find(".empty_quiz_td .ays-quiz-create-question-link-box").css("display","block")}),300)})),$(document).find('input[type="checkbox"].ays-select-all').on("change",(function(){let state=$(this).prop("checked"),table=$("table.ays-add-questions-table"),id_container=$(document).find("input#ays_already_added_questions"),existing_ids=id_container.val().split(",");!1===state&&table.find('input[type="checkbox"].ays-select-single').each((function(){if(-1!==$.inArray($(this).val().toString(),existing_ids)){let position=$.inArray($(this).val().toString(),existing_ids);existing_ids.splice(position,1),id_container.val(existing_ids.join(","))}})),table.find('input[type="checkbox"].ays-select-all').prop("checked",state),table.find('input[type="checkbox"].ays-select-single').each((function(){$(this).prop("checked",state)}))})),$(document).find('input[type="checkbox"].ays-select-single').on("change",(function(){if(!$(this).prop("checked")){let id_container=$(document).find("input#ays_already_added_questions"),existing_ids=id_container.val().split(","),question=$(this).val();if(-1!==$.inArray(question.toString(),existing_ids)){let position=$.inArray(question.toString(),existing_ids);existing_ids.splice(position,1),id_container.val(existing_ids.join(","))}$(document).find('input[type="checkbox"].ays-select-all').prop("checked",!1)}})),$(document).find("#open_ays_pro").on("click",(function(){window.open("https://ays-pro.com/wordpress/quiz-maker")}));let flags=[];$(document).find('input[type="checkbox"].ays-select-single').each((function(){$(this).prop("checked")?flags.push(!0):flags.push(!1)})),flags.every(checkTrue)&&$(document).find('input[type="checkbox"].ays-select-all').prop("checked",!0),$(document).on("click","a.add-question-image",(function(e){!function(e,element){e.preventDefault();let aysUploader=wp.media({title:"Upload",button:{text:"Upload"},frame:"post",state:"insert",library:{type:"image"},multiple:!1}).on("insert",(function(){var state=aysUploader.state(),selection=selection||state.get("selection");if(selection){var attachment=selection.first(),display=state.display(attachment).toJSON(),imgurl=(attachment=attachment.toJSON()).sizes[display.size].url;jQuery("#filenameFromURL").val(imgurl),element.text("Edit Image"),element.parent().parent().find(".ays-question-image-container").fadeIn(),element.parent().parent().find("img#ays-question-img").attr("src",imgurl),element.parent().parent().find("input#ays-question-image").val(imgurl)}})).open()}(e,$(this))})),$(document).on("click","a.add-quiz-bg-music",(function(e){!function(e,element){e.preventDefault();let aysUploader=wp.media({title:"Upload music",button:{text:"Upload"},library:{type:"audio"},multiple:!1}).on("select",(function(){let attachment=aysUploader.state().get("selection").first().toJSON();element.next().attr("src",attachment.url),element.parent().find("input.ays_quiz_bg_music").val(attachment.url)})).open()}(e,$(this))})),$(document).on("click",".ays-remove-question-img",(function(){$(this).parent().find("img#ays-question-img").attr("src",""),$(this).parent().find("input#ays-question-image").val(""),$(this).parent().fadeOut(),$(document).find("a.add-question-image").text("Add Image")})),$(document).on("click","label.ays-label a.add-answer-image, .ays-answer-image-container .ays-edit-answer-img",(function(e){!function(e,element){e.preventDefault();var aysUploader=wp.media({title:"Upload",button:{text:"Upload"},frame:"post",state:"insert",library:{type:"image"},multiple:!1}).on("insert",(function(){var state=aysUploader.state(),selection=selection||state.get("selection");if(selection){var attachment=selection.first(),display=state.display(attachment).toJSON(),imgurl=(attachment=attachment.toJSON()).sizes[display.size].url;element.parents().eq(1).find(".add-answer-image").css({display:"none"}),element.parent().parent().find(".ays-answer-image-container").fadeIn(),element.parent().parent().find("img.ays-answer-img").attr("src",imgurl),element.parents("tr").find("input.ays-answer-image-path").val(imgurl),element.hasClass("add-interval-image")&&(element.parent().parent().find("img").attr("src",imgurl),element.parents("tr").find("input.ays-answer-image").val(imgurl))}})).open()}(e,$(this))})),$(document).on("click",".ays-remove-answer-img",(function(){$(this).parent().fadeOut();var ays_remove_answer_img=$(this);setTimeout((function(){ays_remove_answer_img.parents().eq(1).find(".add-answer-image").fadeIn(),ays_remove_answer_img.parent().find("img.ays-answer-img").attr("src",""),ays_remove_answer_img.parent().find("input.ays-answer-image-path").eq(0).val("")}),300)})),$(document).on("click","a.add-quiz-image",(function(e){openQuizMediaUploader(e,$(this))})),$(document).on("click","a.add-quiz-bg-image",(function(e){openQuizMediaUploader(e,$(this))})),$(document).on("click",".ays-edit-quiz-bg-img",(function(e){openQuizMediaUploader(e,$(this))})),$(document).on("click",".ays-remove-quiz-img",(function(){$(this).parent().find("img#ays-quiz-img").attr("src",""),$("input#ays-quiz-image").val(""),$(this).parent().fadeOut(),$(document).find("a.add-quiz-image").text("Add Image")})),$(document).on("click",".ays-remove-quiz-bg-img",(function(){$(this).parent().find("img#ays-quiz-bg-img").attr("src",""),$(this).parent().parent().find("input#ays_quiz_bg_image").val(""),$(this).parent().fadeOut(),$(this).parent().parent().find("a.add-quiz-bg-image").show(),$(document).find(".ays-quiz-live-container").css({"background-image":"none"}),toggleBackgrounGradient()})),$(document).on("click","a.add_quiz_loader_custom_gif, span.ays-edit-img",(function(e){!function(e,element){e.preventDefault();var aysUploader=wp.media({title:"Upload",button:{text:"Upload"},frame:"post",state:"insert",library:{type:"image"},multiple:!1}).on("insert",(function(){var state=aysUploader.state(),selection=selection||state.get("selection");if(selection){var attachment=selection.first(),display=state.display(attachment).toJSON(),imgurl=(attachment=attachment.toJSON()).sizes[display.size].url,wrap=element.parents(".ays-image-wrap");wrap.find(".ays-image-container img").attr("src",imgurl),wrap.find("input.ays-image-path").val(imgurl),wrap.find(".ays-image-container").fadeIn(),wrap.find("a.ays-add-image").hide()}})).open()}(e,$(this))})),$(document).on("click",".ays-remove-quiz-loader-custom-gif",(function(e){var parent=$(this).parents(".ays-image-wrap");parent.find("img.img_quiz_loader_custom_gif").attr("src",""),parent.find("input.ays-image-path").val(""),parent.find(".ays-image-container").fadeOut(),parent.find("a.ays-add-image").text(quizLangObj.addGif),parent.find("a.ays-add-image").show()})),window.aysQuestSelected=[],window.aysQuestNewSelected=[];let selectedRows=$(document).find("#ays-question-table-add tbody tr.selected");for(let i=0;i<selectedRows.length;i++)window.aysQuestSelected.push(selectedRows.eq(i).data("id"));var qatable=$("#ays-question-table-add").DataTable({paging:5,responsive:!0,bDestroy:!0,lengthMenu:[[5,10,25,50,100,-1],[5,10,25,50,100,quizLangDataTableObj.all]],language:{sEmptyTable:quizLangDataTableObj.sEmptyTable,sInfo:quizLangDataTableObj.sInfo,sInfoEmpty:quizLangDataTableObj.sInfoEmpty,sInfoFiltered:quizLangDataTableObj.sInfoFiltered,sInfoPostFix:"",sInfoThousands:",",sLoadingRecords:quizLangDataTableObj.sLoadingRecords,sProcessing:quizLangDataTableObj.sProcessing,sSearch:quizLangDataTableObj.sSearch,sUrl:"",sZeroRecords:quizLangDataTableObj.sZeroRecords,oPaginate:{sFirst:quizLangDataTableObj.sFirst,sLast:quizLangDataTableObj.sLast,sNext:quizLangDataTableObj.sNext,sPrevious:quizLangDataTableObj.sPrevious},oAria:{sSortAscending:quizLangDataTableObj.sSortAscending,sSortDescending:quizLangDataTableObj.sSortDescending}},infoCallback:function(){let qaTableSelectAll=$(document).find("#ays-question-table-add tbody tr.ays_quest_row"),qaTableSelected=0;qaTableSelectAll.each((function(){$(this).hasClass("selected")||qaTableSelected++})),qaTableSelected>0?$(document).find(".select_all").hasClass("deselect")&&($(document).find(".select_all").removeClass("deselect"),$(document).find(".select_all").text("Select All")):($(document).find(".select_all").addClass("deselect"),$(document).find(".select_all").text("Deselect All"))},drawCallback:function(settings){$(document).find("#ays-question-table-add").parent().css({overflow:"hidden","overflow-x":"auto"}),$(document).find("#ays-question-table-add tbody tr.ays_quest_row").each((function(){-1==$.inArray(parseInt($(this).data("id")),window.aysQuestSelected)&&($(this).removeClass("selected"),$(this).find(".ays-select-single").removeClass("ays_fa_check_square_o").addClass("ays_fa_square_o"))}))}});$(document).find("#ays-question-table-add_info,#ays-question-table-add_length").append('<button class="button select_all" type="button" style="margin-left:10px;">Select All</button>'),$(document).on("click",".select_all",(function(e){var $this=$(document).find(".select_all"),qaTableSelectAll=$(document).find("#ays-question-table-add tbody tr.ays_quest_row");$this.hasClass("deselect")?(qaTableSelectAll.each((function(){var id=$(this).data("id"),index=$.inArray(id,window.aysQuestSelected),indexNew=$.inArray(id,window.aysQuestNewSelected);$(this).hasClass("selected")&&($(this).removeClass("selected"),-1!==indexNew&&window.aysQuestNewSelected.splice(indexNew,1)),-1!==index&&window.aysQuestSelected.splice(index,1),$(this).find(".ays-select-single").removeClass("ays_fa_check_square_o").addClass("ays_fa_square_o")})),$this.removeClass("deselect"),$this.text("Select All")):(qaTableSelectAll.each((function(){var id=$(this).data("id"),index=$.inArray(id,window.aysQuestSelected),indexNew=$.inArray(id,window.aysQuestNewSelected);$(this).hasClass("selected")||($(this).addClass("selected"),-1===indexNew&&window.aysQuestNewSelected.push(id)),-1===index&&window.aysQuestSelected.push(id),$(this).find(".ays-select-single").removeClass("ays_fa_square_o").addClass("ays_fa_check_square_o")})),$this.addClass("deselect"),$this.text("Deselect All"))}));var lastChecked=null;function aysQuizSelectDeselectAddQuesiton(_this){var id=_this.data("id"),index=$.inArray(id,window.aysQuestSelected),index2=$.inArray(id,window.aysQuestNewSelected);-1===index?window.aysQuestSelected.push(id):window.aysQuestSelected.splice(index,1),-1===index2&&-1===index?window.aysQuestNewSelected.push(id):-1!==index&&-1===index2||window.aysQuestNewSelected.splice(index2,1),_this.hasClass("selected")?_this.find(".ays-select-single").removeClass("ays_fa_check_square_o").addClass("ays_fa_square_o"):_this.find(".ays-select-single").removeClass("ays_fa_square_o").addClass("ays_fa_check_square_o"),_this.toggleClass("selected")}$(document).on("click","#ays-question-table-add tbody tr.ays_quest_row",(function(e){var _this=$(this);$(this).find(":checkbox"),_this.data("id");if(e.shiftKey&&-1!=lastChecked){var eachRow=_this.parents("#ays-question-table-add").find(".ays_quest_row"),start=eachRow.index(this),end=eachRow.index(lastChecked),selectedQuestions=eachRow.slice(Math.min(start,end),Math.max(start,end)+1);_this.hasClass("selected")?selectedQuestions.each((function(e){var $this=$(this);$this.hasClass("selected")&&aysQuizSelectDeselectAddQuesiton($this)})):selectedQuestions.each((function(e){var $this=$(this);$this.hasClass("selected")||aysQuizSelectDeselectAddQuesiton($this)}))}else aysQuizSelectDeselectAddQuesiton(_this);lastChecked=_this})),$(document).on("click",".ays-add-question.ays-add-question-top-button, #ays-questions-table .ays-add-question-primary",(function(){$(document).find("#ays-questions-modal").aysModal()}));let pagination=$(".ays-question-pagination");if(pagination.length>0){let trCount=$(document).find("#ays-questions-table tbody tr").length,pagesCount=1;!function(pagination,pagesCount,pageShow){!function(baseElement,pages,pageShow){let pageNum=0,pageOffset=0;function _initNav(){let appendAble="";for(let i=0;i<pagesCount;i++){appendAble+='<li class="'+(0===i?"active":"")+' button ays-question-page" data-page="'+(i+1)+'">'+(i+1)+"</li>"}$("ul.ays-question-nav-pages").html(appendAble);let toPage,pagePos=$("div.ays-question-pagination").width()/2-parseInt($("ul.ays-question-nav-pages>li:first-child").css("width"))/2;$("ul.ays-question-nav-pages").css({"margin-left":pagePos});let pagesCountExists=$("ul.ays-question-nav-pages li").length;baseElement.on("click",".ays-question-nav-pages li, .ays-question-nav-btn",(function(e){toPage=$(e.target).is(".ays-question-nav-btn")?$(this).hasClass("ays-question-prev")?pageNum-1:pageNum+1:$(this).index();let page=Number(toPage)+1;page>pagesCountExists&&(page=pagesCountExists),page<=0&&(page=1),show_hide_rows(page),_navPage(toPage)}))}function _navPage(toPage){let sel=$(".ays-question-nav-pages li",baseElement),w=sel.first().outerWidth(),diff=toPage-pageNum;if(!(toPage>=0&&toPage<=pages-1))return!1;sel.removeClass("active").eq(toPage).addClass("active"),pageNum=toPage,toPage<=pages-(pageShow+(diff>0?0:1))&&toPage>=0?pageOffset+=-w*diff:pageOffset=toPage>0?-w*(pages-pageShow):0,sel.parent().css("left",pageOffset+"px")}_initNav()}(pagination,pagesCount,pageShow)}(pagination,Math.ceil(trCount/5),pagesCount);let page=1;$("ul.ays-question-nav-pages").removeAttr("style");let pages=$("ul.ays-question-nav-pages li");pages.each((function(){$(this).removeClass("active")})),pages.eq(0).addClass("active"),show_hide_rows(page)}var tabDocsData={tab1:{link:"https://quiz-plugin.com/docs/how-to-create-a-quiz/",text:quizLangObj.generalTabDoc},tab2:{link:"https://quiz-plugin.com/docs/styles-settings/",text:quizLangObj.stylesTabDoc},tab3:{link:"https://quiz-plugin.com/docs/quiz-settings-tab/",text:quizLangObj.settingsTabDoc},tab4:{link:"https://quiz-plugin.com/docs/quiz-results-settings/",text:quizLangObj.resultsSettingsTabDoc},tab5:{link:"https://quiz-plugin.com/docs/quiz-limitation-settings/",text:quizLangObj.limitationUsersTabDoc},tab6:{link:"https://quiz-plugin.com/docs/quiz-user-data-settings/",text:quizLangObj.userDataTabDoc},tab7:{link:"https://quiz-plugin.com/docs/email-certificate-settings/",text:quizLangObj.emailTabDoc},tab8:{link:"https://quiz-plugin.com/docs-category/integrations/",text:quizLangObj.integrationTabDoc}};function quiz_themes_live_preview(quiz_color,quiz_background_color,text_color,buttons_text_color){$(document).find("#ays-quiz-color").wpColorPicker("color",quiz_color),$(document).find("#ays-quiz-bg-color").wpColorPicker("color",quiz_background_color),$(document).find("#ays-quiz-text-color").wpColorPicker("color",text_color),$(document).find("#ays-quiz-buttons-text-color").wpColorPicker("color",buttons_text_color);let ays_quiz_bg_color_picker={defaultColor:quiz_background_color,change:function(e){setTimeout((function(){$(document).find(".ays-quiz-live-container").css({"background-color":e.target.value}),$(document).find(".ays-progress-value.fourth").css({color:e.target.value})}),1)}},ays_quiz_text_color_picker={defaultColor:text_color,change:function(e){setTimeout((function(){$(document).find(".ays-quiz-live-title").css({color:e.target.value}),$(document).find(".ays-quiz-live-subtitle").css({color:e.target.value}),$(document).find(".ays-progress-value.first, .ays-progress-value.second").css({color:e.target.value}),$(document).find(".ays-progress-value.third").css({color:e.target.value}),$(document).find(".ays-progress.first, .ays-progress.second").css({background:e.target.value}),$(document).find(".ays-progress-bg.third, .ays-progress-bg.fourth").css({background:e.target.value})}),1)}},ays_quiz_color_picker={defaultColor:quiz_color,change:function(e){setTimeout((function(){$(document).find(".ays-quiz-live-button").css({background:e.target.value}),$(document).find(".ays-progress-bar.first, .ays-progress-bar.second").css({"background-color":e.target.value}),$(document).find(".ays-progress-bar.third, .ays-progress-bar.fourth").css({"background-color":e.target.value})}),1)}},ays_quiz_buttons_text_color={defaultColor:defaultButtonsTextColor,change:function(e){setTimeout((function(){$(document).find(".ays-quiz-live-container .ays-quiz-live-button").css({color:e.target.value}),$(document).find("#ays_buttons_styles_tab .ays-quiz-live-button").css({color:e.target.value})}),1)}};$(document).find("#ays-quiz-bg-color").wpColorPicker(ays_quiz_bg_color_picker),$(document).find("#ays-quiz-text-color").wpColorPicker(ays_quiz_text_color_picker),$(document).find("#ays-quiz-color").wpColorPicker(ays_quiz_color_picker),$(document).find("#ays-quiz-buttons-text-color").wpColorPicker(ays_quiz_buttons_text_color),$(document).find(".ays-quiz-live-button").css({"background-color":quiz_color,color:buttons_text_color}),$(document).find(".ays-quiz-live-container").css({"background-color":quiz_background_color})}$(document).find(".nav-tab-wrapper a.nav-tab").on("click",(function(e){if(!$(this).hasClass("no-js")){let elemenetID=$(this).attr("href"),active_tab=$(this).attr("data-tab");$(document).find(".nav-tab-wrapper a.nav-tab").each((function(){$(this).hasClass("nav-tab-active")&&$(this).removeClass("nav-tab-active")})),$(this).addClass("nav-tab-active"),$(document).find(".ays-quiz-tab-content").each((function(){$(this).hasClass("ays-quiz-tab-content-active")&&$(this).removeClass("ays-quiz-tab-content-active")})),$(document).find("[name='ays_quiz_tab']").val(active_tab),$(document).find("[name='ays_question_tab']").val(active_tab),$(".ays-quiz-tab-content"+elemenetID).addClass("ays-quiz-tab-content-active");var docLinkContainer=$(document).find("#ays-quiz-tab-doc-link .ays-quiz-doc-link");docLinkContainer.length>0&&(tabDocsData[active_tab]?(docLinkContainer.attr("href",tabDocsData[active_tab].link),docLinkContainer.find("span").text(tabDocsData[active_tab].text),docLinkContainer.show()):docLinkContainer.hide()),e.preventDefault()}})),$(".open-lightbox").on("click",(function(e){e.preventDefault();var image=$(this).attr("href");$("html").addClass("no-scroll"),$(".ays-quiz-row ").append('<div class="lightbox-opened"><img src="'+image+'"></div>')})),$("body").on("click",".lightbox-opened",(function(){$("html").removeClass("no-scroll"),$(".lightbox-opened").remove()})),$(document).on("click",".ays-delete-question",(function(){let id=$(this).parents(".ays-question-row").data("id"),index=$.inArray(id,window.aysQuestSelected);-1!==index&&window.aysQuestSelected.splice(index,1)})),$(document).find("#ays_enable_restriction_pass").on("click",(function(){$(this).prop("checked")?($(document).find("#ays_enable_logged_users").prop("checked")||($(document).find("#ays_logged_in_users_div").show(250),$(document).find("#ays_enable_logged_users").prop("checked",!0)),$(document).find("#ays_enable_logged_users").prop("disabled",!0),$("#ays_users_roles_td").show(250)):($("#ays_users_roles_td").hide(250),$(document).find("#ays_enable_logged_users").prop("disabled",!1))})),$(document).find("#ays_enable_restriction_pass").prop("checked")?($(document).find("#ays_enable_logged_users").prop("checked")||($(document).find("#ays_logged_in_users_div").show(250),$(document).find("#ays_enable_logged_users").prop("checked",!0)),$(document).find("#ays_enable_logged_users").prop("disabled",!0),$("#ays_users_roles_td").show(250)):($("#ays_users_roles_td").hide(250),$(document).find("#ays_enable_logged_users").prop("disabled",!1)),$(document).find("#ays_enable_logged_users").on("click",(function(){$(document).find("#ays_enable_restriction_pass").prop("checked")?($(this).prop("checked",!0),$(this).prop("disabled",!0)):$(this).prop("checked")?$(document).find("#ays_logged_in_users_div").show(250):$(document).find("#ays_logged_in_users_div").hide(250)})),$(document).find("#ays_enable_restriction_pass").prop("checked")?($(this).prop("checked",!0),$(this).prop("disabled",!0)):$(document).find("#ays_enable_logged_users").prop("checked")?$(document).find("#ays_logged_in_users_div").show(250):$(document).find("#ays_logged_in_users_div").hide(250),$(document).find("#ays_limit_users").on("click",(function(){$(this).prop("checked")?$(document).find("#limit-user-options").show(250):$(document).find("#limit-user-options").hide(250)})),$(document).find("#ays_limit_users").prop("checked")?$(document).find("#limit-user-options").show(250):$(document).find("#limit-user-options").hide(250),$(document).find('input[name="ays_quiz_theme"]').on("change",(function(){let defaultTextColor,defaultBgColor,defaultQuizColor,defaultButtonsTextColor;switch($(this).val()){case"elegant_dark":quiz_themes_live_preview("#2C2C2C","#2C2C2C","#ffffff","#ffffff"),$(document).find(".ays-quiz-live-button").css({border:"1px solid"}),$(document).find("#answers_view_select").css("display",""),defaultQuizColor=defaultColors_elegantDark.quizColor,defaultBgColor=defaultColors_elegantDark.bgColor,defaultTextColor=defaultColors_elegantDark.textColor,defaultButtonsTextColor=defaultColors_elegantDark.buttonsTextColor;break;case"elegant_light":quiz_themes_live_preview("#ffffff","#ffffff","#2C2C2C","#2C2C2C"),$(document).find(".ays-quiz-live-button").css({border:"1px solid"}),$(document).find("#answers_view_select").css("display",""),defaultQuizColor=defaultColors_elegantLight.quizColor,defaultBgColor=defaultColors_elegantLight.bgColor,defaultTextColor=defaultColors_elegantLight.textColor,defaultButtonsTextColor=defaultColors_elegantLight.buttonsTextColor;break;case"rect_light":quiz_themes_live_preview("#fff195","#fff","#515151","#515151"),$(document).find(".ays-quiz-live-button").css({border:"1px solid"}),$(document).find("#answers_view_select").css("display",""),defaultQuizColor=defaultColors_rectLight.quizColor,defaultBgColor=defaultColors_rectLight.bgColor,defaultTextColor=defaultColors_rectLight.textColor,defaultButtonsTextColor=defaultColors_rectLight.buttonsTextColor;break;case"rect_dark":quiz_themes_live_preview("#1e73be","#2c2c2c","#ffffff","#ffffff"),$(document).find(".ays-quiz-live-button").css({border:"1px solid"}),$(document).find("#answers_view_select").css("display",""),defaultQuizColor=defaultColors_rectDark.quizColor,defaultBgColor=defaultColors_rectDark.bgColor,defaultTextColor=defaultColors_rectDark.textColor,defaultButtonsTextColor=defaultColors_rectDark.buttonsTextColor;break;case"classic_dark":quiz_themes_live_preview("#0d62bc","#000","#e25600","#e25600"),$(document).find(".ays-quiz-live-button").css({border:"none"}),$(document).find("#answers_view_select").css("display","none"),defaultQuizColor=defaultColors_classicDark.quizColor,defaultBgColor=defaultColors_classicDark.bgColor,defaultTextColor=defaultColors_classicDark.textColor,defaultButtonsTextColor=defaultColors_classicDark.buttonsTextColor;break;default:quiz_themes_live_preview("#5d6cf9","#ffffff","#000000","#ffffff"),$(document).find(".ays-quiz-live-button").css({border:"none"}),$(document).find("#answers_view_select").css("display","none"),defaultQuizColor=defaultColors_classicLight.quizColor,defaultBgColor=defaultColors_classicLight.bgColor,defaultTextColor=defaultColors_classicLight.textColor,defaultButtonsTextColor=defaultColors_classicLight.buttonsTextColor}let ays_quiz_bg_color_picker={defaultColor:defaultBgColor,change:function(e){setTimeout((function(){$(document).find(".ays-quiz-live-container").css({"background-color":e.target.value}),$(document).find(".ays-progress-value.fourth").css({color:e.target.value})}),1)}},ays_quiz_text_color_picker={defaultColor:defaultTextColor,change:function(e){setTimeout((function(){$(document).find(".ays-quiz-live-title").css({color:e.target.value}),$(document).find(".ays-quiz-live-subtitle").css({color:e.target.value}),$(document).find(".ays-progress-value.first, .ays-progress-value.second").css({color:e.target.value}),$(document).find(".ays-progress-value.third").css({color:e.target.value}),$(document).find(".ays-progress.first, .ays-progress.second").css({background:e.target.value}),$(document).find(".ays-progress-bg.third, .ays-progress-bg.fourth").css({background:e.target.value})}),1)}},ays_quiz_color_picker={defaultColor:defaultQuizColor,change:function(e){setTimeout((function(){$(document).find(".ays-quiz-live-button").css({background:e.target.value}),$(document).find(".ays-progress-bar.first, .ays-progress-bar.second").css({"background-color":e.target.value}),$(document).find(".ays-progress-bar.third, .ays-progress-bar.fourth").css({"background-color":e.target.value})}),1)}},ays_quiz_buttons_text_color={defaultColor:defaultButtonsTextColor,change:function(e){setTimeout((function(){$(document).find(".ays-quiz-live-container .ays-quiz-live-button").css({color:e.target.value}),$(document).find("#ays_buttons_styles_tab .ays-quiz-live-button").css({color:e.target.value})}),1)}};$(document).find("#ays-quiz-bg-color").wpColorPicker(ays_quiz_bg_color_picker),$(document).find("#ays-quiz-text-color").wpColorPicker(ays_quiz_text_color_picker),$(document).find("#ays-quiz-color").wpColorPicker(ays_quiz_color_picker),$(document).find("#ays-quiz-buttons-text-color").wpColorPicker(ays_quiz_buttons_text_color)})),$(document).find(".ays_theme_image_div").on("click",(function(){var radio_id=$(this).parent().attr("for");$(this).hasClass("ays_active_theme_image")||($(document).find(".ays_active_theme_image").removeClass("ays_active_theme_image"),$(document).find('input[name="ays_quiz_theme"]').prop("checked",!1),$(this).addClass("ays_active_theme_image"),$(document).find("#"+radio_id).prop("checked",!0))})),$(document).find('a[href="#tab3"]').on("click",(function(){0===$(document).find(".ays_active_theme_image").length&&$(document).find("#answers_view_select").css("display","none"),$(this).find("span.badge").length>0&&($(document).find("#ays_enable_timer").prop("checked")?$(document).find("#ays_quiz_timer_in_title")[0].scrollIntoView({block:"center",behavior:"smooth"}):($(document).find("#ays_enable_timer").trigger("click"),setTimeout((function(){$(document).find("#ays_quiz_timer_in_title")[0].scrollIntoView({block:"center",behavior:"smooth"})}),500)),$(this).find("span.badge").remove())})),$(document).find("#ays_progress_bar_style").on("change",(function(){var progressBar=$(this),progbar=progressBar.siblings().children();progbar.removeClass("display_block"),progbar.each((function(){$(this).hasClass(progressBar.val())&&$(this).addClass("display_block")}))})),$(document).find("#ays_progress_live_bar_style").on("change",(function(){var liveProgress=$(this),progLive=liveProgress.siblings().children();progLive.removeClass("display_block"),progLive.each((function(){$(this).hasClass(liveProgress.val())&&$(this).addClass("display_block")})),progLive.hasClass("ays-progress default display_block")&&$(".ays-live-default").each((function(){var liveLine=$(document).find(".ays-live-default-line"),liveNumber=$(this);liveNumber.prop("Counter",0).animate({Counter:liveNumber.attr("aria-valuenow")},{duration:1e3,easing:"linear",step:function(now){var numberPer=Math.round(100*now)/100;liveNumber.css({width:numberPer+"%"}),liveLine.css({width:numberPer+"%"}),liveNumber.text(numberPer+"%")}})}))})),$(document).find(".ays-quiz-live-container .ays_buttons_div").css("justify-content",$(document).find("#ays_buttons_position").val()),$(document).find("#ays_buttons_position").on("change",(function(){var pos=$(this).val();$(document).find(".ays-quiz-live-container .ays_buttons_div").css("justify-content",pos)})),$(document).find("#ays_quiz_bg_image_position").on("change",(function(){$(document).find(".ays-quiz-live-container").css({"background-position":$(this).val()})})),$(document).find("#ays_quest_animation").on("change",(function(){var quizContainer=$(document).find(".ays-quiz-live-container-1"),quizContainer2=$(document).find(".ays-quiz-live-container-2");switch(quizContainer.css({display:"flex"}),quizContainer2.css({display:"none"}),$(this).val()){case"none":quizContainer.css({display:"none"}),setTimeout((function(){quizContainer.css({display:"flex"})}),50);break;case"fade":quizContainer.css({opacity:0,transition:".5s ease-in-out"}),setTimeout((function(){quizContainer.css({opacity:1,transition:"none"})}),500);break;case"shake":var scale,left,opacity;quizContainer.animate({opacity:0},{step:function(now,mx){scale=1-.2*(1-now),left=50*now+"%",opacity=1-now,quizContainer.css({transform:"scale("+scale+")",position:"absolute",top:0,opacity:1}),quizContainer2.css({left:left,opacity:opacity,display:"flex"})},duration:800,complete:function(){quizContainer.hide(),quizContainer.css({transform:"scale(1)",opacity:1,position:"relative"}),quizContainer2.css({display:"flex",transform:"scale(1)",opacity:1}),setTimeout((function(){quizContainer.css({display:"flex"}),quizContainer2.css({display:"none"})}),100)},easing:"easeInOutBack"})}})),$(document).on("click",".ays_toggle_radio",(function(e){var state=!1;"true"==$(this).attr("data-flag")&&(state=!0);var parent=$(this).parents(".ays_toggle_parent");if($(this).hasClass("ays_toggle_slide"))switch(state){case!0:parent.find(".ays_toggle_target").slideDown(250);break;case!1:parent.find(".ays_toggle_target").slideUp(250)}else switch(state){case!0:parent.find(".ays_toggle_target").show(250);break;case!1:parent.find(".ays_toggle_target").hide(250)}})),$(document).on("change",".ays_toggle",(function(e){let state=$(this).prop("checked");if($(this).hasClass("ays_toggle_slide"))switch(state){case!0:$(this).parent().find(".ays_toggle_target").slideDown(250);break;case!1:$(this).parent().find(".ays_toggle_target").slideUp(250)}else switch(state){case!0:$(this).parent().find(".ays_toggle_target").show(250);break;case!1:$(this).parent().find(".ays_toggle_target").hide(250)}})),$(document).on("click",".ays_toggle_loader_radio",(function(e){var dataFlag=$(this).attr("data-flag"),dataType=$(this).attr("data-type"),state=!1;"true"==dataFlag&&(state=!0);var parent=$(this).parents(".ays_toggle_loader_parent");if($(this).hasClass("ays_toggle_loader_slide"))switch(state){case!0:parent.find(".ays_toggle_loader_target").slideDown(250);break;case!1:parent.find(".ays_toggle_loader_target").slideUp(250)}else switch(state){case!0:switch(dataType){case"text":parent.find('.ays_toggle_loader_target[data-type="'+dataType+'"]').show(250),parent.find('.ays_toggle_loader_target[data-type="gif"]').hide(250);break;case"gif":parent.find('.ays_toggle_loader_target[data-type="'+dataType+'"]').show(250),parent.find('.ays_toggle_loader_target.ays_gif_loader_width_container[data-type="'+dataType+'"]').css({display:"flex","justify-content":"center","align-items":"center"}),parent.find('.ays_toggle_loader_target[data-type="text"]').hide(250);break;default:parent.find(".ays_toggle_loader_target").show(250)}break;case!1:switch(dataType){case"text":case"gif":parent.find('.ays_toggle_loader_target[data-type="'+dataType+'"]').hide(250);break;default:parent.find(".ays_toggle_loader_target").hide(250)}}})),$(document).on("click",".ays_toggle_questions_hint_radio",(function(e){var _this=$(this),parent=_this.parents(".ays_toggle_parent"),dataFlag=_this.attr("data-flag"),dataType=_this.attr("data-type"),state=!1;switch("true"==dataFlag&&(state=!0),state){case!0:switch(dataType){case"text":parent.find('.ays_toggle_target[data-type="'+dataType+'"]').show(250),parent.find('.ays_toggle_target[data-type="button"]').hide(250);break;case"button":parent.find('.ays_toggle_target[data-type="'+dataType+'"]').show(250),parent.find('.ays_toggle_target[data-type="text"]').hide(250);break;default:parent.find(".ays_toggle_target").show(250)}break;case!1:switch(dataType){case"text":case"button":parent.find('.ays_toggle_target[data-type="'+dataType+'"]').hide(250);break;default:parent.find(".ays_toggle_target").hide(250)}}})),$(document).on("change",".ays_toggle_checkbox",(function(e){let state=$(this).prop("checked"),parent=$(this).parents(".ays_toggle_parent").eq(0);if($(this).hasClass("ays_toggle_slide"))switch(state){case!0:parent.find(".ays_toggle_target").eq(0).slideDown(250),parent.find(".ays_toggle_target_inverse").eq(0).slideDown(150);break;case!1:parent.find(".ays_toggle_target").eq(0).slideUp(250),parent.find(".ays_toggle_target_inverse").eq(0).slideUp(250)}else switch(state){case!0:parent.find(".ays_toggle_target").eq(0).show(250),parent.find(".ays_toggle_target_inverse").eq(0).hide(150);break;case!1:parent.find(".ays_toggle_target").eq(0).hide(250),parent.find(".ays_toggle_target_inverse").eq(0).show(250)}})),$("#ays_limit_users").on("change",(function(){let lu_options=$("#limit-user-options");switch($(this).prop("checked")){case!0:lu_options.fadeIn();break;case!1:lu_options.fadeOut()}})),$(document).find(".toggle_ddmenu").on("click",(function(){let ddmenu=$(this).next();switch(ddmenu.attr("data-expanded")){case"true":$(this).find(".ays_fa").css({transform:"rotate(0deg)"}),ddmenu.attr("data-expanded","false");break;case"false":$(this).find(".ays_fa").css({transform:"rotate(90deg)"}),ddmenu.attr("data-expanded","true")}})),$('[data-toggle="popover"]').popover(),$(".tablenav.top").find(".clear").before($("#category-filter-div")),$(".tablenav.top").find(".clear").before($("#category-filter-div-quizlist"));let accordion=$(document).find("table.ays-questions-table tbody");function refreshLivePreview(){var buttonsFontSize=$(document).find("#ays_buttons_font_size").val(),buttonsLeftRightPadding=$(document).find("#ays_buttons_left_right_padding").val(),buttonsTopBottomPadding=$(document).find("#ays_buttons_top_bottom_padding").val(),buttonsBorderRadius=$(document).find("#ays_buttons_border_radius").val(),buttonsWidth=$(document).find("#ays_buttons_width").val();$(document).find('.ays_buttons_div input[name="next"]').css("font-size",buttonsFontSize+"px"),$(document).find('.ays_buttons_div input[name="next"]').css("padding",buttonsTopBottomPadding+"px "+buttonsLeftRightPadding+"px"),$(document).find('.ays_buttons_div input[name="next"]').css("border-radius",buttonsBorderRadius+"px"),$(document).find('.ays_buttons_div input[name="next"]').css("min-width",buttonsWidth+"px")}$(document).on("click",".ays_select_all",(function(e){if(accordion.find(".empty_quiz_td").length>0&&0==accordion.find(".ays-sort").length)return!1;accordion.find(".ays_del_tr").prop("checked",!0),$(document).find(".ays_bulk_del_questions").prop("disabled",!1),$(this).addClass("ays_clear_select_all"),$(this).removeClass("ays_select_all")})),$(document).on("click",".ays_clear_select_all",(function(e){accordion.find(".ays_del_tr").prop("checked",!1),$(document).find(".ays_bulk_del_questions").prop("disabled",!0),$(this).addClass("ays_select_all"),$(this).removeClass("ays_clear_select_all")})),$(document).on("click","table.ays-questions-table tbody .ays_del_tr",(function(e){$(document).find(".ays_bulk_del_questions").prop("disabled",!1)&&$(document).find(".ays_bulk_del_questions").removeProp("disabled"),0==accordion.find(".ays_del_tr:checked").length&&$(document).find(".ays_bulk_del_questions").attr("disabled","disabled")})),$(document).on("click",".ays_bulk_del_questions",(function(e){let accordion_el=accordion.find("tr .ays_del_tr"),id_container=(accordion_el.length,$(document).find("input#ays_already_added_questions")),existing_ids=id_container.val().split(","),questions_count=$(document).find(".questions_count_number");accordion_el.each((function(){if($(this).prop("checked")){$(this).parents("tr").css({"animation-name":"slideOutLeft","animation-duration":".3s"});let a=$(this),index=1,questionId=parseInt(a.parents("tr").data("id")),indexOfAddTable=$.inArray(questionId,window.aysQuestSelected);if(-1!==indexOfAddTable&&(window.aysQuestSelected.splice(indexOfAddTable,1),qatable.draw()),-1!==$.inArray(questionId.toString(),existing_ids)){let position=$.inArray(questionId.toString(),existing_ids);existing_ids.splice(position,1),id_container.val(existing_ids.join(","))}setTimeout((function(){if(a.parents("tr").remove(),questions_count.text(accordion.find("tr.ays-question-row").length),0==accordion.find("tr.ays-question-row").length){var colspan=$(document).find("table.ays-questions-table thead th").length;accordion.find(".dataTables_empty").parents("tr").remove();let quizEmptytd='<tr class="ays-question-row ays-question-empty-row ui-state-default"> <td colspan="'+colspan+'" class="empty_quiz_td"> <div class="ays-quiz-create-question-link-box"> <i class="ays_fa ays_fa_info" aria-hidden="true" style="margin-right:10px"></i> <span style="font-size: 13px; font-style: italic;"> There are no questions yet. </span> </div> <div class="ays_add_question_from_table"> <a href="javascript:void(0)" class="ays-add-question-primary"> <i class="ays_fa ays_fa_plus_square" aria-hidden="true"></i> '+quizLangObj.insertQuestion+' </a> <a href="admin.php?page=quiz-maker-questions&action=add" class="ays-add-question" target="_blank"> '+quizLangObj.createQuestion+' <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-external-link-icon lucide-external-link"><path d="M15 3h6v6"/><path d="M10 14 21 3"/><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/></svg> </a> </div> </td></tr>';accordion.append(quizEmptytd)}accordion.find("tr.ays-question-row").each((function(){$(this).hasClass("even")&&$(this).removeClass("even");let className=index%2==0?"even":"";index++,$(this).addClass(className)})),0==$(document).find("table.ays-questions-table tbody").find(".ays-sort").length&&$(document).find("table#ays-questions-table").find(".empty_quiz_td .ays-quiz-create-question-link-box").css("display","block")}),300)}})),$(document).find(".ays_bulk_del_questions").attr("disabled","disabled"),$(this).next("button").addClass("ays_select_all"),$(this).next("button").hasClass("ays_clear_select_all")&&$(this).next("button").removeClass("ays_clear_select_all")})),$(document).find("#ays-quiz-category-form").on("submit",(function(e){""==$(document).find("#ays-quiz-title").val()&&$(document).find("#ays-quiz-title").val("Quiz").trigger("input");var $this=$(this)[0];""!=$(document).find("#ays-quiz-title").val()||e.preventDefault(),$this.submit()})),$(document).find("#ays-question-form").on("submit",(function(e){$("#wp-ays-question-wrap").hasClass("tmce-active")?tinyMCE.get("ays-question").getContent():$("#ays-question").val();let questionType=$(document).find('select[name="ays_question_type"]').val(),answersTable=($(document).find("#ays-question-image").val(),$(document).find("#ays-answers-table")),status=!0;switch(questionType){case"radio":case"checkbox":case"select":answersTable.find("tbody tr").length<2&&(swal.fire({type:"warning",text:"Sorry minimum count of answers should be 2"}),status=!1);let answersValues=$(document).find("input.ays-correct-answer-value");if("text"!=questionType||questionType){let countEmptyVals=0;answersValues.each((function(){""==$(this).val()&&countEmptyVals++})),answersValues.length-countEmptyVals==1&&(swal.fire({type:"warning",text:"Sorry, you must fill out the minimum 2 answer fields."}),status=!1)}}status?$(this)[0].submit():e.preventDefault()})),$(document).find(".ays-quiz-loader-banner").on("click",(function(){submitOnce($(this))})),$(document).find(".cat-filter-apply-top, .cat-filter-apply-bottom, .user-filter-apply-top, .user-filter-apply-bottom, .category-filter-apply-top, .category-filter-apply-bottom, .question-type-filter-apply-top, .question-type-filter-apply-bottom, .quiz-review-filter-apply-top, .quiz-review-filter-apply-bottom").on("click",(function(e){e.preventDefault();var $this=$(this),html_name="",top_or_bottom="top";$this.parents(".tablenav").hasClass("bottom")&&(top_or_bottom="bottom"),$this.hasClass("cat-filter-apply-"+top_or_bottom)?html_name="filterby":$this.hasClass("user-filter-apply-"+top_or_bottom)?html_name="filterbyuser":$this.hasClass("category-filter-apply-"+top_or_bottom)?html_name="filterbycategory":$this.hasClass("question-type-filter-apply-"+top_or_bottom)?html_name="type":$this.hasClass("quiz-review-filter-apply-"+top_or_bottom)&&(html_name="filterbyreview"),""!=html_name&&function(which,html_name){var filter=$(document).find('select[name="'+html_name+"-"+which+'"]').val(),link=location.href;if(""!=filter){filter="&"+html_name+"="+filter;for(var linkModifiedStart=link.split("?")[0],linkModified=link.split("?")[1].split("&"),i=0;i<linkModified.length;i++)"ays_result_tab"==linkModified[i].split("=")[0]&&linkModified.splice(i,1,"ays_result_tab=poststuff"),linkModified[i].split("=")[0]==html_name&&linkModified.splice(i,1);linkModified=linkModified.join("&"),document.location.href=linkModifiedStart+"?"+linkModified+filter}else{for(linkModifiedStart=link.split("?")[0],linkModified=link.split("?")[1].split("&"),i=0;i<linkModified.length;i++)linkModified[i].split("=")[0]==html_name&&linkModified.splice(i,1);linkModified=linkModified.join("&"),document.location.href=linkModifiedStart+"?"+linkModified}}(top_or_bottom,html_name)})),$(document).find(".ays-quiz-question-tab-all-filter-button-top, .ays-quiz-question-tab-all-filter-button-bottom").on("click",(function(e){e.preventDefault();var top_or_bottom="top";$(this).parents(".tablenav").hasClass("bottom")&&(top_or_bottom="bottom");var catFilter=$(document).find('select[name="filterby-'+top_or_bottom+'"]').val(),userFilter=$(document).find('select[name="filterbyuser-'+top_or_bottom+'"]').val(),tagFilter=$(document).find('select[name="filterbytags-'+top_or_bottom+'"]').val(),typeFilter=$(document).find('select[name="type-'+top_or_bottom+'"]').val(),reviewFilter=$(document).find('select[name="filterbyreview-'+top_or_bottom+'"]').val(),reviewCommentFilter=$(document).find('select[name="filterbycomment-'+top_or_bottom+'"]').val(),filterbycategoryFilter=$(document).find('select[name="filterbycategory-'+top_or_bottom+'"]').val(),filterbyDescriptionFilter=$(document).find('select[name="filterbyDescription-'+top_or_bottom+'"]').val(),filterbyImageFilter=$(document).find('select[name="filterbyImage-'+top_or_bottom+'"]').val(),link=location.href;void 0!==catFilter&&(link=catFilterForListTable(link,{what:"filterby",value:catFilter})),void 0!==userFilter&&(link=catFilterForListTable(link,{what:"filterbyuser",value:userFilter})),void 0!==tagFilter&&(link=catFilterForListTable(link,{what:"filterbytags",value:tagFilter})),void 0!==typeFilter&&(link=catFilterForListTable(link,{what:"type",value:typeFilter})),void 0!==reviewFilter&&(link=catFilterForListTable(link,{what:"filterbyreview",value:reviewFilter})),void 0!==reviewCommentFilter&&(link=catFilterForListTable(link,{what:"filterbycomment",value:reviewCommentFilter})),void 0!==filterbycategoryFilter&&(link=catFilterForListTable(link,{what:"filterbycategory",value:filterbycategoryFilter})),void 0!==filterbyDescriptionFilter&&(link=catFilterForListTable(link,{what:"filterbyDescription",value:filterbyDescriptionFilter})),void 0!==filterbyImageFilter&&(link=catFilterForListTable(link,{what:"filterbyImage",value:filterbyImageFilter})),document.location.href=link})),$(document).on("click",".ays-results-order-filter",(function(e){e.preventDefault();let orderby=$(document).find('select[name="orderby"]').val(),link=location.href;""!=orderby?(orderby="&orderby="+orderby,document.location.href=link+orderby):document.location.href=link})),$(document).find("#ays-deactive, #ays-active, #ays_quiz_change_creation_date").datetimepicker({controlType:"select",oneLine:!0,dateFormat:"yy-mm-dd",timeFormat:"HH:mm:ss",afterInject:function(){$(document).find(".ui-datepicker-buttonpane button.ui-state-default").addClass("button"),$(document).find(".ui-datepicker-buttonpane button.ui-state-default.ui-priority-primary").addClass("button-primary").css("float","right")}}),$(document).find(".ays_next_tab").on("click",(function(e){e.preventDefault();var parent=$(this).parents(".ays-quiz-tab-content");if(null!=typeof parent.next()&&parent.next().hasClass("ays-quiz-tab-content")){var parentId=parent.next().attr("id"),element=$(document).find(".nav-tab-wrapper a[data-tab="+parentId+"]");element.get(0).scrollIntoView({behavior:"smooth",block:"end",inline:"nearest"}),element.trigger("click")}})),$(document).find(".ays_prev_tab").on("click",(function(e){e.preventDefault();var parent=$(this).parents(".ays-quiz-tab-content");if(null!=typeof parent.prev()&&parent.prev().hasClass("ays-quiz-tab-content")){var parentId=parent.prev().attr("id"),element=$(document).find(".nav-tab-wrapper a[data-tab="+parentId+"]");element.get(0).scrollIntoView({behavior:"smooth",block:"end",inline:"nearest"}),element.trigger("click")}})),$(document).find("#ays_buttons_font_size, #ays_buttons_top_bottom_padding, #ays_buttons_left_right_padding, #ays_buttons_border_radius, #ays_buttons_width").on("change",(function(e){refreshLivePreview()})),refreshLivePreview(),$(document).find("#ays_buttons_size").on("change",(function(e){var buttonsFontSize,buttonsLeftRightPadding,buttonsTopBottomPadding,buttonsBorderRadius;switch($(document).find("#ays_buttons_size").val()){case"small":buttonsFontSize=14,buttonsLeftRightPadding=14,buttonsTopBottomPadding=7,buttonsBorderRadius=8;break;case"large":buttonsFontSize=20,buttonsLeftRightPadding=30,buttonsTopBottomPadding=13,buttonsBorderRadius=8;break;default:buttonsFontSize=17,buttonsLeftRightPadding=20,buttonsTopBottomPadding=10,buttonsBorderRadius=8}$(document).find("#ays_buttons_font_size, #ays_buttons_mobile_font_size").val(buttonsFontSize),$(document).find("#ays_buttons_left_right_padding").val(buttonsLeftRightPadding),$(document).find("#ays_buttons_top_bottom_padding").val(buttonsTopBottomPadding),$(document).find("#ays_buttons_border_radius").val(buttonsBorderRadius),$(document).find('.ays_buttons_div input[name="next"]').css("font-size",buttonsFontSize+"px"),$(document).find('.ays_buttons_div input[name="next"]').css("padding",buttonsTopBottomPadding+"px "+buttonsLeftRightPadding+"px"),$(document).find('.ays_buttons_div input[name="next"]').css("border-radius",buttonsBorderRadius+"px")}));var ays_results=$(document).find(".ays_result_read");for(var i in ays_results)void 0!==ays_results.eq(i).val()&&0==ays_results.eq(i).val()&&ays_results.eq(i).parents("tr").addClass("ays_read_result");var ays_quiz_results=$(document).find(".ays-show-results");for(var i in ays_quiz_results)ays_quiz_results.eq(i).parents("tr").addClass("ays_quiz_read_result");$(document).find(".ays-question-ordering").on("click",(function(){var table_tbody=$(document).find("#ays-questions-table tbody");table_tbody.find("tr.ays-question-empty-row").before(table_tbody.find("tr:not(.ays-question-empty-row)").get().reverse());var sorting_ids=[];table_tbody.find("tr:not(.ays-question-empty-row)").each((function(index){void 0!==$(this).data("id")&&sorting_ids.push($(this).data("id"))})),$(document).find("input#ays_already_added_questions").val(sorting_ids),"true"==$(this).attr("data-ordered")?($(this).find("i.ays_fa_exchange").removeClass("ordered"),$(this).attr("data-ordered","false")):($(this).find("i.ays_fa_exchange").addClass("ordered"),$(this).attr("data-ordered","true"))})),$(document).on("keydown","input[name='ays-correct-answer-value[]']",(function(e){var $this=$(this),$thisValue=$this.val(),parent=$this.parents("table#ays-answers-table"),lastAnswer=parent.find("input[name='ays-correct-answer-value[]']").last();if("number"!=$(document).find("select[name='ays_question_type']").val()){if(lastAnswer.is(":focus")){if(13===e.keyCode)e.preventDefault(),$(document).find("label.ays-add-answer-first-label .ays-add-answer").trigger("click"),(addedLastAnswer=parent.find("input[name='ays-correct-answer-value[]']").last()).focus()}else if(13===e.keyCode){e.preventDefault();var nextElement=(parentTr=$this.parents("tr.ays-answer-row")).next().find("input.ays-correct-answer-value");if(nextElement.length>0){var nextElementVal=nextElement.val();nextElement.val(""),nextElement.val(nextElementVal),nextElement.focus()}}if(38==e.keyCode&&!e.ctrlKey&&!e.shiftKey){var parentTr;if(!((parentTr=$this.parents("tr.ays-answer-row")).prev().length>0))return!1;parentTr.prev().find("input[name='ays-correct-answer-value[]']").trigger("focus")}if(40===e.keyCode&&!e.ctrlKey&&!e.shiftKey)if((parentTr=$this.parents("tr.ays-answer-row")).next().length>0)parentTr.next().find("input[name='ays-correct-answer-value[]']").trigger("focus");else $(document).find("label.ays-add-answer-first-label .ays-add-answer").trigger("click"),(addedLastAnswer=parent.find("input[name='ays-correct-answer-value[]']").last()).focus();if(8===e.keyCode&&""==$thisValue){e.preventDefault();var deleteButton=$this.parents("tr.ays-answer-row").find(".ays-delete-answer"),prevParentTr=$this.parents("tr.ays-answer-row").prev();deleteButton.trigger("click");var addedLastAnswer,lastAnswerVal=(addedLastAnswer=prevParentTr.find("input[name='ays-correct-answer-value[]']")).val();addedLastAnswer.val(""),addedLastAnswer.val(lastAnswerVal),addedLastAnswer.focus()}}})),$(document).on("keydown","#ays_quick_popup .ays_answer",(function(e){var $this=$(this),$thisValue=$this.val(),parent=$this.parents("table.ays_answers_table");if(parent.find(".ays_answer").last().is(":focus"))13===e.keyCode&&(e.preventDefault(),parent.find(".ays_add_answer").trigger("click"),(addedLastAnswer=parent.find(".ays_answer").last()).focus());else if(13===e.keyCode){e.preventDefault();var nextElement=(parentTr=$this.parents("tr")).next().find(".ays_answer");if(nextElement.length>0){var nextElementVal=nextElement.val();nextElement.val(""),nextElement.val(nextElementVal),nextElement.focus()}}if(38==e.keyCode&&!e.ctrlKey&&!e.shiftKey){var parentTr;if(!((parentTr=$this.parents("tr")).prev().length>0))return!1;parentTr.prev().find(".ays_answer").trigger("focus")}40!==e.keyCode||e.ctrlKey||e.shiftKey||((parentTr=$this.parents("tr")).next().hasClass("ays_quiz_add_answer_box")?(parent.find(".ays_add_answer").trigger("click"),(addedLastAnswer=parent.find(".ays_answer").last()).focus()):parentTr.next().find(".ays_answer").trigger("focus"));if(8===e.keyCode&&""==$thisValue){e.preventDefault();var deleteButton=$this.parents("tr").find(".active_remove_answer"),prevParentTr=$this.parents("tr").prev();deleteButton.trigger("click");var addedLastAnswer,lastAnswerVal=(addedLastAnswer=prevParentTr.find(".ays_answer")).val();addedLastAnswer.val(""),addedLastAnswer.val(lastAnswerVal),addedLastAnswer.focus()}})),$(document).keydown((function(e){var saveButton=$(document).find('input[name="ays_apply"] , form#ays-quiz-general-settings-form input[name="ays_submit"]');if(saveButton.length>0)return!(83==e.which&&e.ctrlKey||19==e.which)||(saveButton.trigger("click"),e.preventDefault(),!1)})),$(document).find("strong.ays-quiz-shortcode-box").on("mouseleave",(function(){$(this).attr("data-original-title",quizLangObj.clickForCopy)}));var wp_editor_height=$(document).find(".quiz_wp_editor_height");if(wp_editor_height.length>0){var wp_editor_height_val=wp_editor_height.val();if(""!=wp_editor_height_val&&0!=wp_editor_height_val)var ays_quiz=setInterval((function(){"complete"===document.readyState&&($(document).find(".wp-editor-wrap .wp-editor-container iframe , .wp-editor-container textarea.wp-editor-area").css({height:wp_editor_height_val+"px"}),clearInterval(ays_quiz))}),500)}if($(document).find(".ays-modal").on("click",(function(e){var modalBox=$(e.target).attr("class");void 0!==modalBox&&"ays-modal"==modalBox&&$(this).aysModal("hide")})),$(document).on("click",".ays_confirm_del",(function(e){e.preventDefault();var message=$(this).data("message");!0===window.confirm("Are you sure you want to delete "+message+"?")&&window.location.replace($(this).attr("href"))})),$(document).on("click","#ays-question-next-button, #ays-question-prev-button, .ays-quiz-next-button-class, .ays-quiz-category-next-button-class",(function(e){e.preventDefault();var $this=$(this),message=$(this).data("message");!0===window.confirm(message)&&(submitOnce($this),window.location.replace($(this).attr("href")))})),$(document).find("#ays-quiz-maker-countdown-main-container").length>0){var second=1e3,minute=60*second,hour=60*minute,day=24*hour,quizCountdownEndTime=quizLangObj.quizBannerDate,countDown_new=new Date(quizCountdownEndTime).getTime();if(isNaN(countDown_new)||0==isFinite(countDown_new)){var AYS_QUIZ_MILLISECONDS=3*day;quizCountdownEndTime=new Date(Date.now()+AYS_QUIZ_MILLISECONDS).aysQuizCustomFormat("#YYYY#-#MM#-#DD# #hhhh#:#mm#:#ss#"),countDown_new=new Date(quizCountdownEndTime).getTime()}aysQuizBannerCountdown();var y=setInterval((function(){var now=(new Date).getTime(),distance_new=countDown_new-now;if(aysQuizBannerCountdown(),distance_new<0){document.getElementById("ays-quiz-countdown-headline");var countdown=document.getElementById("ays-quiz-countdown"),content=document.getElementById("ays-quiz-countdown-content");countdown.style.display="none",content.style.display="block",clearInterval(y)}}),1e3)}function aysQuizBannerCountdown(){var now=(new Date).getTime(),distance_new=countDown_new-now,countDownDays=document.getElementById("ays-quiz-countdown-days"),countDownHours=document.getElementById("ays-quiz-countdown-hours"),countDownMinutes=document.getElementById("ays-quiz-countdown-minutes"),countDownSeconds=document.getElementById("ays-quiz-countdown-seconds");if((null!==countDownDays||null!==countDownHours||null!==countDownMinutes||null!==countDownSeconds)&&distance_new>0){var countDownDays_innerText=Math.floor(distance_new/day),countDownHours_innerText=Math.floor(distance_new%day/hour),countDownMinutes_innerText=Math.floor(distance_new%hour/minute),countDownSeconds_innerText=Math.floor(distance_new%minute/second);if(isNaN(countDownDays_innerText)||isNaN(countDownHours_innerText)||isNaN(countDownMinutes_innerText)||isNaN(countDownSeconds_innerText)){document.getElementById("ays-quiz-countdown-headline");var countdown=document.getElementById("ays-quiz-countdown"),content=document.getElementById("ays-quiz-countdown-content");countdown.style.display="none",content.style.display="block"}else countDownDays.innerHTML=countDownDays_innerText,countDownHours.innerHTML=countDownHours_innerText,countDownMinutes.innerHTML=countDownMinutes_innerText,countDownSeconds.innerHTML=countDownSeconds_innerText}}$(document).on("input",".ays-quiz-subscribe-email-address",(function(e){var thisParent=$(this).parents(".ays-quiz-subscribe-email-page");emailValidatePattern.test($(this).val())||""==$(this).val()?($(this).removeClass("ays-quiz-subscribe-email-error"),thisParent.find(".ays-quiz-subscribe-email-error-message").css("visibility","hidden")):$(this).addClass("ays-quiz-subscribe-email-error")})),$(document).find(".contextual-help-tabs").on("click","a",(function(e){var panel,link=$(this);if(e.preventDefault(),link.is(".active a"))return!1;$(document).find(".contextual-help-tabs .active").removeClass("active"),link.parent("li").addClass("active"),panel=$(document).find(link.attr("href")),$(document).find(".help-tab-content").not(panel).removeClass("active").hide(),panel.addClass("active").show()})),$(document).find(".ays-quiz-open-quizzes-list").on("click",(function(e){var quizListBox=$(document).find(".ays-quiz-quizzes-data");$(document).find("#wpcontent").outerWidth()-400<=$(document).find(".ays-quiz-subtitle-main-box.ays-quiz-edit-page-subtitle-container .ays-subtitle").outerWidth()?quizListBox.hasClass("ays-quiz-quizzes-data-change-position")||quizListBox.addClass("ays-quiz-quizzes-data-change-position"):quizListBox.hasClass("ays-quiz-quizzes-data-change-position")&&quizListBox.removeClass("ays-quiz-quizzes-data-change-position"),$(this).parents(".ays-quiz-subtitle-main-box").find(".ays-quiz-quizzes-data").toggle("fast")})),$(document).on("click",(function(e){0!=$(e.target).closest(".ays-quiz-subtitle-main-box").length||$(document).find(".ays-quiz-subtitle-main-box .ays-quiz-quizzes-data").hide("fast")})),$(document).find(".ays-quiz-go-to-quizzes").on("click",(function(e){e.preventDefault(),window.confirm(quizLangObj.areYouSureButton)&&(window.location=$(this).attr("href"))})),$(document).on("change","#ays_show_questions_toggle",(function(){$(this).prop("checked")?($(document).find(".quest-toggle-all").css("color","#2277CC"),$(document).find(".ays_result_element.tr_success").show()):($(document).find(".ays_result_element.tr_success").hide(),$(document).find(".quest-toggle-all").css("color","#212529"))})),$(document).find(".ays-quiz-message-vars-icon").on("click",(function(e){$(this).parents(".ays-quiz-message-vars-box").find(".ays-quiz-message-vars-data").toggle("fast")})),$(document).on("click",(function(e){0!=$(e.target).closest(".ays-quiz-message-vars-box").length||$(document).find(".ays-quiz-message-vars-box .ays-quiz-message-vars-data").hide("fast")})),$(document).find(".ays-quiz-message-vars-each-data").on("click",(function(e){var _this=$(this),parent=_this.parents(".ays-quiz-result-message-vars-parent"),textareaID=parent.find("textarea.ays-textarea").attr("id"),messageVar=_this.find(".ays-quiz-message-vars-each-var").val();parent.find("#wp-"+textareaID+"-wrap").hasClass("tmce-active")?window.tinyMCE.get(textareaID).setContent(window.tinyMCE.get(textareaID).getContent()+messageVar+" "):$(document).find("#"+textareaID).append(" "+messageVar+" ")})),$(document).on("click",".pro_features_popup",(function(e){e.preventDefault();var _this=$(this),popupModal=$(document).find("#pro-features-popup-modal"),popupModal_title_text=_this.find(".pro-features-popup-title").text(),popupModal_content=_this.find(".pro-features-popup-content").html(),popupModal_video_link=_this.find(".pro-features-popup-content").attr("data-link"),popupModal_button=_this.find(".pro-features-popup-button"),popupModal_button_text=popupModal_button.text(),popupModal_button_link=popupModal_button.attr("data-link"),leftSection=popupModal.find(".ays-modal-body .pro-features-popup-modal-left-section"),rightSection=popupModal.find(".ays-modal-body .pro-features-popup-modal-right-section");if(rightSection.find(".pro-features-popup-modal-right-box-title").text(popupModal_title_text),rightSection.find(".pro-features-popup-modal-right-box-content").html(popupModal_content),rightSection.find(".pro-features-popup-modal-right-box-content").html(popupModal_content),rightSection.find(".pro-features-popup-modal-right-box-link").text(popupModal_button_text),rightSection.find(".pro-features-popup-modal-right-box-link").attr("href",popupModal_button_link),void 0!==popupModal_video_link&&""!=popupModal_video_link){var iframeHTML='<iframe width="560" height="315" src="https://www.youtube.com/embed/'+ays_youtube_parser(popupModal_video_link)+'" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen loading="lazy"></iframe>';leftSection.html(iframeHTML)}popupModal.aysModal("show_flex")})),$(document).on("click",".ays-quiz-new-upgrade-button-box.ays-quiz-new-upgrade-button-box-no-link, .ays-quiz-center-big-upgrade-button-box.ays-quiz-new-upgrade-button-box-no-link, .ays-quiz-new-watch-video-button-box, .ays-quiz-small-new-watch-video-button-box, .ays-quiz-center-big-watch-video-button-box",(function(e){if(e.preventDefault(),$(this).hasClass("ays-quiz-center-big-watch-video-button-box"))var _this=$(this).parent().parent().find(".pro_features.pro_features_popup");else if($(this).hasClass("ays-quiz-small-new-watch-video-button-box"))_this=$(this).parents(".pro_features_parent").find(".pro_features.pro_features_popup");else _this=$(this).parent().find(".pro_features.pro_features_popup");var popupModal=$(document).find("#pro-features-popup-modal"),popupModal_title_text=_this.find(".pro-features-popup-title").text(),popupModal_content=_this.find(".pro-features-popup-content").html(),popupModal_video_link=_this.find(".pro-features-popup-content").attr("data-link"),popupModal_button=_this.find(".pro-features-popup-button"),popupModal_button_text=popupModal_button.text(),popupModal_button_link=popupModal_button.attr("data-link"),leftSection=popupModal.find(".ays-modal-body .pro-features-popup-modal-left-section"),rightSection=popupModal.find(".ays-modal-body .pro-features-popup-modal-right-section");if(rightSection.find(".pro-features-popup-modal-right-box-title").text(popupModal_title_text),rightSection.find(".pro-features-popup-modal-right-box-content").html(popupModal_content),rightSection.find(".pro-features-popup-modal-right-box-content").html(popupModal_content),rightSection.find(".pro-features-popup-modal-right-box-link").text(popupModal_button_text),rightSection.find(".pro-features-popup-modal-right-box-link").attr("href",popupModal_button_link),void 0!==popupModal_video_link&&""!=popupModal_video_link){var iframeHTML='<iframe width="560" height="315" src="https://www.youtube.com/embed/'+ays_youtube_parser(popupModal_video_link)+'" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen loading="lazy"></iframe>';leftSection.html(iframeHTML)}popupModal.aysModal("show_flex")}));var aysQuizListTables=$(document).find("#wpcontent #wpbody div.wrap.ays-quiz-list-table");if(aysQuizListTables.length>0){var listTableClass="",searchBox="";aysQuizListTables.hasClass("ays_questions_list_table")?(listTableClass="ays_questions_list_table",searchBox="quiz-maker-search-input"):aysQuizListTables.hasClass("ays_quizzes_list_table")?(listTableClass="ays_quizzes_list_table",searchBox="quiz-maker-search-input"):aysQuizListTables.hasClass("ays_quiz_categories_list_table")?(listTableClass="ays_quiz_categories_list_table",searchBox="quiz-maker-search-input"):aysQuizListTables.hasClass("ays_quiz_question_categories_list_table")?(listTableClass="ays_quiz_question_categories_list_table",searchBox="quiz-maker-search-input"):aysQuizListTables.hasClass("ays_results_list_table")?(listTableClass="ays_results_list_table",searchBox="quiz-maker-search-input"):aysQuizListTables.hasClass("ays_reviews_table")&&(listTableClass="ays_reviews_table",searchBox="quiz-maker-search-input"),""!=listTableClass&&""!=searchBox&&function(listTableClass,searchBox){if($(document).find("."+listTableClass).length&&$(document).find("#"+searchBox).length){var search_string=$(document).find("#"+searchBox).val();""!=search_string&&$(document).find("."+listTableClass+" .pagination-links a").each((function(){void 0!==this.href&&""!=this.href&&this.href.indexOf("&s=")<0&&(this.href=this.href+"&s="+search_string)}))}}(listTableClass,searchBox)}$(document).find("input#quiz-maker-search-input + input#search-submit").on("click",(function(e){var input_value=$(this).parents("form").find("input#quiz-maker-search-input").val(),flag=!1,url=window.location.href;(-1!=url.indexOf("?s=")||-1!=url.indexOf("&s="))&&(flag=!0),flag&&void 0!==input_value&&""!=input_value&&(e.preventDefault(),location.href=location.href.replace(/&s=([^&]$|[^&]*)/i,"&s="+input_value))}));var mainPopup=document.getElementById("ays-quiz-fox-lms-all-pages-popup-close");mainPopup&&mainPopup.addEventListener("click",(function(){document.getElementById("ays-quiz-fox-lms-all-pages-popup").style.display="none";var if_cookie_exists=aysQuizGetCookie("ays_fox_lms_pages_popup_dismiss_for_three_click");void 0===if_cookie_exists||""==if_cookie_exists?aysQuizCreateCookie("ays_fox_lms_pages_popup_dismiss_for_three_click",1,7):aysQuizCreateCookie("ays_fox_lms_pages_popup_dismiss_for_three_click",if_cookie_exists&&"number"==typeof parseInt(if_cookie_exists)&&!isNaN(parseInt(if_cookie_exists))?parseInt(if_cookie_exists)+1:1,7)})),$(document).on("click","#ays-quiz-add-question-filter",(function(e){var filterBox=$(document).find(".ays-quiz-add-question-filter-option-box");filterBox.hasClass("display_none")?(filterBox.show(250),filterBox.removeClass("display_none")):(filterBox.hide(250),filterBox.addClass("display_none"))})),$(document).on("change",".ays_quiz_loader input[type=radio]",(function(e){var parent=$(this).parents(".ays_quiz_loader"),quizLoaders=parent.parent("div").find(".ays_quiz_loader");quizLoaders.hasClass("ays_quiz_loader_active")&&quizLoaders.removeClass("ays_quiz_loader_active"),parent.addClass("ays_quiz_loader_active")})),$(document).on("change",".checkbox_ays input[type=checkbox]",(function(e){var _this=$(this),parent=_this.parents(".checkbox_ays");1==_this.prop("checked")?parent.addClass("checkbox_ays_active"):parent.hasClass("checkbox_ays_active")&&parent.removeClass("checkbox_ays_active")})),$(document).find(".ays_quiz_loader input[type=radio]:checked").parents(".ays_quiz_loader").addClass("ays_quiz_loader_active"),$(document).find(".checkbox_ays input[type=checkbox]:checked").parents(".checkbox_ays").addClass("checkbox_ays_active"),$(document).find('input[type="submit"]#doaction, input[type="submit"]#doaction2').on("click",(function(e){!function(e){var $el=$(e.target),action=$el.parent().find('select[name="action"]').val();if("bulk-delete"===action||"bulk-delete-review"===action){if(e.preventDefault(),confirm(quizLangObj.deleteElementFromListTable))$el.closest("form").submit()}}(e)}));var mainResultPopupButton=$(document).find(".ays-quiz-popup-box-header-close-button, .ays-quiz-popup-box-header-desc-a, .ays-quiz-popup-box-action-button");mainResultPopupButton.length>0&&mainResultPopupButton.on("click",(function(){$(document).find(".ays-quiz-popup-box-main-conatiner").css({display:"none"});var if_cookie_exists=aysQuizGetCookie("ays_quiz_result_popup_box");void 0===if_cookie_exists||""==if_cookie_exists?aysQuizCreateCookie("ays_quiz_result_popup_box",1,365):aysQuizCreateCookie("ays_quiz_result_popup_box",if_cookie_exists&&"number"==typeof parseInt(if_cookie_exists)&&!isNaN(parseInt(if_cookie_exists))?parseInt(if_cookie_exists)+1:1,365)}));var createdNewQuiz=aysQuizGetCookie("ays_quiz_created_new");if(createdNewQuiz&&createdNewQuiz>1){var url=new URL(window.location.href),getCustomPostId=aysQuizGetCookie("ays_quiz_created_new_"+createdNewQuiz+"_post_id"),link="#";getCustomPostId&&(link=getCustomPostId);var parameterValue=url.searchParams.get("action"),htmlDefaultText='<p style="margin-top:1rem;">'+quizLangObj.formMoreDetailed+' <a href="admin.php?page=quiz-maker&action=edit&id='+createdNewQuiz+'">'+quizLangObj.editQuizPage+"</a>.</p>",htmlContent=parameterValue&&"edit"==parameterValue?"":htmlDefaultText;swal({title:'<strong class="ays-quiz-maker-swal2-title">'+quizLangObj.greateJob+"</strong>",type:"success",html:'<p class="ays-quiz-maker-swal2-created-row">'+quizLangObj.youQuizIsCreated+'</p><p clas="ays-quiz-maker-swal2-content-text-row">'+quizLangObj.youCanUuseThisShortcode+'</p><input type="text" id="ays-quiz-create-new" onClick="this.setSelectionRange(0, this.value.length)" readonly value="[ays_quiz id=\''+createdNewQuiz+"']\" />"+htmlContent,showCancelButton:!0,showCloseButton:!0,focusConfirm:!1,cancelButtonClass:"ays-quiz-preview-popup-cancel-button",confirmButtonText:'<i class="ays_fa ays_fa_thumbs_up"></i> '+quizLangObj.greate,confirmButtonAriaLabel:quizLangObj.thumbsUpGreat,cancelButtonText:'<a href="'+link+'" target="_blank">'+quizLangObj.preivewQuiz+' <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><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"/></svg></a>',cancelButtonAriaLabel:quizLangObj.thumbsUpGreat}),aysQuizDeleteCookie("ays_quiz_created_new"),aysQuizDeleteCookie("ays_quiz_created_new_"+createdNewQuiz+"_post_id")}$(document).find(".ays-quiz-accordion-container").on("click",(function(e){var _this=$(this),parent=_this.closest(".ays-quiz-accordion-options-main-container");openCloseAccordion(_this,parent.attr("data-collapsed"))}));$(document).on("click","#ays_apply_top.button, #ays_apply.button, #ays_submit_top.button, #ays_submit.button, #ays-button-save-new-top.button, #ays-button-save-new.button, #ays-button-apply-top.button, #ays-button-apply.button, #ays-button-save-new-top.button, #ays-button-save-new.button, #ays-button-save.button, #ays-button-save-top.button, #ays-button.button",(function(){var $this=$(this);$this.hasClass("ays-save-button-clicked")||$this.addClass("ays-save-button-clicked")})),setTimeout((function(){var aysUnsavedChanges=!1;$(document).on("change input","#ays-quiz-category-form .ays-quiz-tab-content input, #ays-quiz-category-form .ays-quiz-tab-content select, #ays-quiz-category-form .ays-quiz-tab-content textarea, #ays-question-form select, #ays-question-form textarea, #ays-question-form input, #ays-quiz-category-form.ays-quiz-questions-real-category-form select, #ays-quiz-category-form.ays-quiz-questions-real-category-form textarea, #ays-quiz-category-form.ays-quiz-questions-real-category-form input, #ays-quiz-category-form.ays-quiz-real-category-form select, #ays-quiz-category-form.ays-quiz-real-category-form textarea, #ays-quiz-category-form.ays-quiz-real-category-form input, #ays-quiz-general-settings-form select, #ays-quiz-general-settings-form textarea, #ays-quiz-general-settings-form input",(function(){aysUnsavedChanges=!0})),$(window).on("beforeunload",(function(event){var savingButtonsClicked=$(document).find("#ays_apply_top.button, #ays_apply.button, #ays_submit_top.button, #ays_submit.button, #ays-button-save-new-top.button, #ays-button-save-new.button, #ays-button-apply-top.button, #ays-button-apply.button, #ays-button-save-new-top.button, #ays-button-save-new.button, #ays-button-save.button, #ays-button-save-top.button, #ays-button.button").filter(".ays-save-button-clicked").length>0;aysUnsavedChanges&&!savingButtonsClicked&&(event.preventDefault(),event.returnValue=!0)}))}),1e3),$(document).on("click",".ays-quiz-collapse-all",(function(e){$(this).parents(".ays-quiz-tab-content").find(".ays-quiz-accordion-options-main-container").find(".ays-quiz-accordion-arrow-box").each((function(){openCloseAccordion($(this),"false")}))})),$(document).on("click",".ays-quiz-expand-all",(function(e){$(this).parents(".ays-quiz-tab-content").find(".ays-quiz-accordion-options-main-container").find(".ays-quiz-accordion-arrow-box").each((function(){openCloseAccordion($(this),"true")}))})),$(document).on("click",".ays-quiz-youtube-placeholder",(function(){var videoId=$(this).data("video-id"),iframe=$("<iframe>",{src:"https://www.youtube.com/embed/"+videoId+"?autoplay=1",class:"",width:560,height:315,frameborder:0,allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowfullscreen:!0});$(this).replaceWith(iframe)})),$(document).on("mouseover",".ays-dashicons",(function(){var allRateStars=$(document).find(".ays-dashicons"),index=allRateStars.index(this);allRateStars.removeClass("ays-dashicons-star-filled").addClass("ays-dashicons-star-empty");for(var i=0;i<=index;i++)allRateStars.eq(i).removeClass("ays-dashicons-star-empty").addClass("ays-dashicons-star-filled")})),$(document).on("mouseleave",".ays-rated-link",(function(){$(document).find(".ays-dashicons").removeClass("ays-dashicons-star-filled").addClass("ays-dashicons-star-empty")}))})),Date.prototype.aysQuizCustomFormat=function(formatString){var YYYY,YY,MMMM,MMM,MM,M,DDDD,DDD,DD,D,hhhh,hhh,hh,h,mm,m,ss,s,ampm,AMPM,dMod,th;return YY=((YYYY=this.getFullYear())+"").slice(-2),MM=(M=this.getMonth()+1)<10?"0"+M:M,MMM=(MMMM=["January","February","March","April","May","June","July","August","September","October","November","December"][M-1]).substring(0,3),DD=(D=this.getDate())<10?"0"+D:D,DDD=(DDDD=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][this.getDay()]).substring(0,3),th=D>=10&&D<=20?"th":1==(dMod=D%10)?"st":2==dMod?"nd":3==dMod?"rd":"th",formatString=formatString.replace("#YYYY#",YYYY).replace("#YY#",YY).replace("#MMMM#",MMMM).replace("#MMM#",MMM).replace("#MM#",MM).replace("#M#",M).replace("#DDDD#",DDDD).replace("#DDD#",DDD).replace("#DD#",DD).replace("#D#",D).replace("#th#",th),0==(h=hhh=this.getHours())&&(h=24),h>12&&(h-=12),hh=h<10?"0"+h:h,hhhh=hhh<10?"0"+hhh:hhh,AMPM=(ampm=hhh<12?"am":"pm").toUpperCase(),mm=(m=this.getMinutes())<10?"0"+m:m,ss=(s=this.getSeconds())<10?"0"+s:s,formatString.replace("#hhhh#",hhhh).replace("#hhh#",hhh).replace("#hh#",hh).replace("#h#",h).replace("#mm#",mm).replace("#m#",m).replace("#ss#",ss).replace("#s#",s).replace("#ampm#",ampm).replace("#AMPM#",AMPM)}}(jQuery),document.addEventListener("DOMContentLoaded",(function(){var usedLicenses,remainingLicenses,progressPercentage,remainingElement,progressElement,startDate=new Date("2025-09-08"),totalLicenses=(new Date("2025-09-30"),50),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);usedLicenses=function(){for(var today=new Date,daysPassed=Math.floor((today-startDate)/864e5),usedLicenses=0,i=0;i<Math.min(daysPassed,progressionPattern.length);i++)usedLicenses+=progressionPattern[i];return Math.min(usedLicenses,totalLicenses)}(),remainingLicenses=totalLicenses-usedLicenses,progressPercentage=usedLicenses/totalLicenses*100,remainingElement=document.getElementById("remaining-licenses"),progressElement=document.getElementById("progress-fill"),remainingElement&&(remainingElement.textContent=remainingLicenses),progressElement&&(progressElement.style.width=progressPercentage+"%")}));