1/* eslint-disable */ 2jQuery(document).ready(function($) { 3 /*This function handles all ajax request*/ 4 function atbdp_do_ajax(ElementToShowLoadingIconAfter, ActionName, arg, CallBackHandler) { 5 var data; 6 if (ActionName) data = "action=" + ActionName; 7 if (arg) data = arg + "&action=" + ActionName; 8 if (arg && !ActionName) data = arg; 9 //data = data ; 10 11 var n = data.search(listing_faqs.nonceName); 12 if (n < 0) { 13 data = data + "&" + listing_faqs.nonceName + "=" + listing_faqs.nonce; 14 } 15 16 jQuery.ajax({ 17 type: "post", 18 url: listing_faqs.ajaxurl, 19 data: data, 20 beforeSend: function() { jQuery("<span class='atbdp_ajax_loading'></span>").insertAfter(ElementToShowLoadingIconAfter); }, 21 success: function(data) { 22 jQuery(".atbdp_ajax_loading").remove(); 23 CallBackHandler(data); 24 } 25 }); 26 } 27 // enable sorting if only the container has any social or skill field 28 // enable sorting if only the container has any social or skill field 29 var $s_wrap = $("#directorist-draggable-faq-container"); // cache it 30 31 if ($s_wrap.length) { 32 $s_wrap.sortable({ 33 axis: 'y', 34 opacity: '0.7', 35 start: function (e, ui) { 36 $(ui.item).find('textarea').each(function () { 37 tinymce.execCommand('mceRemoveEditor', false, $(this).attr('id')); 38 }); 39 }, 40 stop: function (e, ui) { 41 $(ui.item).find('textarea').each(function () { 42 tinymce.execCommand('mceAddEditor', true, $(this).attr('id')); 43 }); 44 } 45 }); 46 } 47 48 49 // SOCIAL SECTION 50 // Rearrange the IDS and Add new social field 51 $("#directorist-add-faq").on('click', function() { 52 var currentItems = $('.directorist-faq-box').length; 53 var ID = "id=" + currentItems; // eg. 'id=3' 54 var iconBindingElement = jQuery('#directorist-add-faq'); 55 // arrange names ID in order before adding new elements 56 $('.directorist-faq-box').each(function(index, element) { 57 var e = $(element); 58 e.attr('id', 'directorist-faq-' + index); 59 e.find('.directorist-faq-qstn').attr('name', 'faqs[' + index + '][quez]'); 60 e.find('.atbdp_faqs_input').attr('name', 'faqs[' + index + '][ans]'); 61 e.find('.directorist-btn-faq-remove').attr('data-id', index); 62 }); 63 // now add the new elements. we could do it here without using ajax but it would require more markup here. 64 atbdp_do_ajax(iconBindingElement, 'atbdp_faqs_handler', ID, function(data) { 65 $s_wrap.append(data); 66 if ('normal' !== listing_faqs.ans_field) { 67 tinymce.init({ selector: 'textarea' }); 68 } 69 }); 70 }); 71 72 73 // remove the faqs field and then reset the ids while maintaining position 74 let id; 75 let elementToRemove; 76 $(document).on('click', '.directorist-btn-faq-remove', function(e) { 77 id = $(this).data("id"); 78 elementToRemove = $('div#directorist-faq-' +id); 79 e.preventDefault(); 80 }); 81 // Faq Remove Confirm Modal 82 $('.directorist-faq-remove-confirm-js').on('click', " .directorist-modal-ok", function(){ 83 elementToRemove.remove(); 84 $('.directorist-faq-box').each(function( index , element) { 85 let e = $(element); 86 e.attr('id','directorist-faq-'+index); 87 e.find('.directorist-faq-qstn').attr('name', 'faqs['+index+'][quez]'); 88 e.find('.atbdp_faqs_input').attr('name', 'faqs['+index+'][ans]'); 89 e.find('.directorist-btn-faq-remove').attr('data-id',index); 90 }); 91 }); 92 93 // Open Modal for Confirm Delete 94 var directoristModal = document.querySelector('.directorist-modal-js'); 95 $('body').on('click', '.directorist-btn-modal-js', function (e) { 96 e.preventDefault(); 97 var data_target = $(this).attr("data-directorist_target"); 98 document.querySelector(".".concat(data_target)).classList.add('directorist-show'); 99 }); 100 101 $('body').on('click', '.directorist-modal-close-js', function (e) { 102 e.preventDefault(); 103 $(this).closest('.directorist-modal-js').removeClass('directorist-show'); 104 }); 105 106 $(document).bind('click', function (e) { 107 if (e.target == directoristModal) { 108 directoristModal.classList.remove('directorist-show'); 109 } 110 }); 111 112 $('.directorist-faq-accordion__content').hide(); 113 $('.directorist-faq-accordion__single > .directorist-faq-accordion__title > a').on("click", function(e) { 114 var $this = $(this); 115 $this.parent().next().slideToggle(); 116 $this.parent().parents(".directorist-faq-accordion__single").siblings(".directorist-faq-accordion__single").children(".directorist-faq-accordion__content").slideUp(); 117 $this.parent().parents(".directorist-faq-accordion__single").toggleClass("directorist-faq-active"); 118 $this.parent().parents(".directorist-faq-accordion__single").siblings(".directorist-faq-accordion__single").removeClass("directorist-faq-active"); 119 $this.toggleClass("directorist-active"); 120 $this.parent().parents(".directorist-faq-accordion__single").siblings(".directorist-faq-accordion__single").children(".directorist-faq-accordion__title").children("a").removeClass("directorist-active"); 121 e.preventDefault(); 122 }); 123 124 125});
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.