1(function($){ 2 3 "use strict"; 4 5 $(document).ready(function($){ 6 7 // Add limit to textarea counter 8 $("textarea.survey_textarea").keyup(function(){ 9 var lenght = $(this).val().length; 10 $(this).next().text((1000 - lenght) + " / 1000"); 11 }); 12 13 $("body").on("click",".survey-rating",function(e){ 14 $(this).closest('li').prevAll('li').find('.survey-rating').addClass('selected'); 15 $(this).closest('li').nextAll('li').find('.survey-rating').removeClass('selected'); 16 $(this).addClass('selected'); 17 }); 18 19 $("body").on("click",".ps-select-answer option", function(e){ 20 21 var $select = $(this).closest('select'); 22 23 if($select.attr("multiple")) 24 { 25 if($(this).val().length > 0) 26 { 27 $select.find("option").filter(function(){ return !$(this).val(); }).prop('selected',false); 28 } 29 else if(!$(this).val()) 30 { 31 $select.find("option").prop('selected',false); 32 $(this).prop('selected',true); 33 } 34 } 35 }); 36 37 $("body").on("click",".survey_submit_btn", function(e){ 38 39 e.preventDefault(); 40 41 var $survey = $(this).closest(".survey-container"); 42 var errors = ps_validate_survey($survey); 43 var metadata = $survey.data('metadata'); 44 45 if(errors.length > 0) 46 { 47 swal({ 48 title: "Ops!", 49 text: "⢠"+errors.join('\n ⢠'), 50 }); 51 return false; 52 } 53 54 var submit_mode = metadata['ps_question_submit_complete']; 55 56 var postDataArray = $survey.find(".survey_question_box:visible *").serializeArray(); 57 58 $survey.find(".survey_question_container:not(.hidden_ps_questions_com) .survey_question_box").each(function(){ 59 if(!$(this).data("validationRequired")) 60 { 61 if($(this).find("*").serializeArray().length == 0) 62 { 63 postDataArray.push({ 64 name: 'ps_questions['+$(this).data('questionId')+']', 65 value: 0 66 }); 67 } 68 } 69 }); 70 71 var postData = ps_form_array_to_object(postDataArray); 72 postData['ID'] = $survey.data('id'); 73 74 ps_ajax_post("save_question_data",postData, function(response){ 75 76 var partial_message = 'ps_success_message_one'; 77 var complete_message = 'ps_success_message_complete'; 78 var set_complete_messages = 'ps_success_message_complete_on'; 79 var set_one_messages = 'ps_success_message_one_on'; 80 81 if(typeof metadata[complete_message] != 'undefined' && response.total_questions_answered == response.total_questions) 82 { 83 if(typeof metadata[complete_message] == 'string' && metadata[complete_message].length > 0 && metadata[set_complete_messages] == 'message_complete_on') 84 { 85 swal({ 86 text: metadata[complete_message], 87 }).then(confirm); 88 } 89 else 90 { 91 confirm(); 92 } 93 94 function confirm() 95 { 96 if(typeof metadata['ps_success_page_link'] != 'undefined' && metadata.ps_success_page_link.length > 0) 97 { 98 window.location.href=metadata.ps_success_page_link; 99 } 100 else 101 { 102 typeof metadata['ps_question_submit_type'] == 'undefined' || metadata['ps_question_submit_type'] != 'ajax' ? window.location.reload() : ps_survey_reload($survey); 103 } 104 } 105 } 106 107 if(typeof metadata[partial_message] != 'undefined' && response.total_questions_answered < response.total_questions) 108 { 109 if(typeof metadata[partial_message] == 'string' && metadata[partial_message].length > 0 && metadata[set_one_messages] == 'message_one_on') 110 { 111 swal({ 112 113 text: metadata[partial_message], 114 115 }).then(confirm); 116 } 117 else 118 { 119 confirm(); 120 } 121 122 function confirm() 123 { 124 typeof metadata['ps_question_submit_type'] == 'undefined' || metadata['ps_question_submit_type'] != 'ajax' ? window.location.reload() : ps_survey_reload($survey); 125 } 126 } 127 }); 128 }); 129 130 $("body").on('mouseenter','.ps-datepicker', function(){ 131 if(typeof $.fn.datepicker == 'function' && typeof $(this).data('datepicker') == 'undefined') 132 { 133 $(this).datepicker({ 134 beforeShow: function() { 135 $(this).datepicker("widget").addClass("ps_ui_customize_survey"); 136 }, 137 changeMonth: true, 138 changeYear: true, 139 yearRange: '-100:+100', 140 }); 141 } 142 }); 143 144 $("body").on('click', '.ps_sfe_toglger', function(e) { 145 $(this).toggleClass('ps_sfe_toglger_opener'); 146 $(this).next().toggle(); 147 }) 148 }); 149 150})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.