PageSourceSearch

https://www.yalla-events.com/wp-content/plugins/directorist-faqs//assets/js/main.js?ver=1

js yalla-events.com collected 2026-10-05 06:09:40 UTC 5,172 bytes, 116 lines download raw bytes

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        });
36    }
37
38
39    // SOCIAL SECTION
40    // Rearrange the IDS and Add new social field
41    $("#directorist-add-faq").on('click', function() {
42        var currentItems = $('.directorist-faq-box').length;
43        var ID = "id=" + currentItems; // eg. 'id=3'
44        var iconBindingElement = jQuery('#directorist-add-faq');
45        // arrange names ID in order before adding new elements
46        $('.directorist-faq-box').each(function(index, element) {
47            var e = $(element);
48            //console.log(index);
49            e.attr('id', 'directorist-faq-' + index);
50            e.find('.directorist-faq-qstn').attr('name', 'faqs[' + index + '][quez]');
51            e.find('.atbdp_faqs_input').attr('name', 'faqs[' + index + '][ans]');
52            e.find('.directorist-btn-faq-remove').attr('data-id', index);
53        });
54        // now add the new elements. we could do it here without using ajax but it would require more markup here.
55        atbdp_do_ajax(iconBindingElement, 'atbdp_faqs_handler', ID, function(data) {
56            $s_wrap.append(data);
57            if ('normal' !== listing_faqs.ans_field) {
58                tinymce.init({ selector: 'textarea' });
59            }
60        });
61    });
62
63
64    // remove the social field and then reset the ids while maintaining position
65    $(document).on('click', '.directorist-btn-faq-remove', function(e) {
66        let id = $(this).data("id"),
67            elementToRemove = $('div#directorist-faq-' +id);
68        e.preventDefault();
69
70        // Faq Remove Confirm Modal
71        $('.directorist-faq-remove-confirm-js').on('click', " .directorist-modal-ok", function(){
72            elementToRemove.remove();
73            $('.directorist-faq-box').each(function( index , element) {
74                let e = $(element);
75                e.attr('id','directorist-faq-'+index);
76                e.find('.directorist-faq-qstn').attr('name', 'faqs['+index+'][quez]');
77                e.find('.atbdp_faqs_input').attr('name', 'faqs['+index+'][ans]');
78                e.find('.directorist-btn-faq-remove').attr('data-id',index);
79            });
80        });
81
82    });
83
84    // Open Modal for Confirm Delete
85    var directoristModal = document.querySelector('.directorist-modal-js');
86        $('body').on('click', '.directorist-btn-modal-js', function (e) {
87            e.preventDefault();
88            var data_target = $(this).attr("data-directorist_target");
89            document.querySelector(".".concat(data_target)).classList.add('directorist-show');
90        });
91
92        $('body').on('click', '.directorist-modal-close-js', function (e) {
93            e.preventDefault();
94            $(this).closest('.directorist-modal-js').removeClass('directorist-show');
95        });
96
97        $(document).bind('click', function (e) {
98        if (e.target == directoristModal) {
99            directoristModal.classList.remove('directorist-show');
100        }
101    });
102
103    $('.directorist-faq-accordion__content').hide();
104    $('.directorist-faq-accordion__single > .directorist-faq-accordion__title > a').on("click", function(e) {
105        var $this = $(this);
106        $this.parent().next().slideToggle();
107        $this.parent().parents(".directorist-faq-accordion__single").siblings(".directorist-faq-accordion__single").children(".directorist-faq-accordion__content").slideUp();
108        $this.parent().parents(".directorist-faq-accordion__single").toggleClass("directorist-faq-active");
109        $this.parent().parents(".directorist-faq-accordion__single").siblings(".directorist-faq-accordion__single").removeClass("directorist-faq-active");
110        $this.toggleClass("directorist-active");
111        $this.parent().parents(".directorist-faq-accordion__single").siblings(".directorist-faq-accordion__single").children(".directorist-faq-accordion__title").children("a").removeClass("directorist-active");
112        e.preventDefault();
113    });
114
115
116});

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.