PageSourceSearch

https://activistrights.org.au/wp-content/plugins/eazydocs-pro/assets/js/ajax.js

js activistrights.org.au collected 2026-10-02 03:36:29 UTC 4,856 bytes, 132 lines download raw bytes

1(function ($) {
2  'use strict'
3
4  $(document).ready(function () {
5    
6    // Contributor [ Delete ] 
7    function ezd_contribute_delete() {
8      $('.ezd_contribute_delete').off('click').on('click', function (e) {
9        e.preventDefault();
10
11        let contributor_id = $(this).attr('data-contributor-delete');
12        let data_doc_id    = $(this).attr('data-doc-id');
13        let data_name      = $(this).attr('data_name');
14
15        $.ajax({
16          url: eazydocs_ajax_search.ajax_url,
17          method: 'POST',
18          data: {
19            action: 'ezd_doc_contributor',
20            contributor_delete: contributor_id,
21            data_doc_id: data_doc_id
22          },
23          beforeSend: function () {
24            $('.ezd_contribute_delete[data-contributor-delete=' + contributor_id + ']').html(
25              '<span class="spinner-border ezd-contributor-loader"><span class="visually-hidden">Loading...</span></span>'
26            );
27          },
28          success: function (response) {
29            $('#user-' + contributor_id).remove();
30            $('.to-add-user-' + contributor_id).not(':last').remove();
31
32            // Remove avatar by ID or fallback to title
33            $('#contributor-avatar-' + contributor_id).remove();
34            $('.contributed_user_list a[title='+data_name+']').remove();
35
36            $('#to_add_contributors').append(response);
37            ezd_contributor_add();
38          },
39          error: function () {
40            console.log('Oops! Something went wrong, try again!');
41          }
42        });
43      });
44    }
45    ezd_contribute_delete();
46
47    // Contributor [ Add ] 
48    function ezd_contributor_add() {
49      $('.ezd_contribute_add').off('click').on('click', function (e) {
50        e.preventDefault();
51
52        let contributor_add = $(this).attr('data-contributor-add');
53        let data_doc_id     = $(this).attr('data-doc-id');
54
55        let container  = $(this).closest('.users_wrap_item');
56        let user_img   = container.find('img').attr('src');
57        let user_name  = $(this).attr('data_name');
58        let user_url   = container.find('a').first().attr('href');
59        let avatar_src = user_img.replace(/([?&])s=\d+/, '$1s=25');
60
61        $.ajax({
62          url: eazydocs_ajax_search.ajax_url,
63          method: 'POST',
64          data: {
65            action: 'ezd_doc_contributor',
66            contributor_add: contributor_add,
67            data_doc_id: data_doc_id
68          },
69          beforeSend: function () {
70            $('.ezd_contribute_add[data-contributor-add=' + contributor_add + ']').html(
71              '<span class="spinner-border ezd-contributor-loader"><span class="visually-hidden">Loading...</span></span>'
72            );
73          },
74          success: function (response) {
75            $('#added_contributors').append(response);
76            $('#to-add-user-' + contributor_add).remove();
77            $('.user-' + contributor_add).not(':last').remove();
78
79            // Remove old avatar if already exists
80            $('#contributor-avatar-' + contributor_add).remove();
81
82            // Add avatar
83            $('.contributed_user_list').append(
84              '<a id="contributor-avatar-' + contributor_add + '" title="' + user_name + '" href="' + user_url + '" data-bs-toggle="tooltip" data-bs-placement="bottom">' +
85              '<img width="24px" src="' + avatar_src + '">' +
86              '</a>'
87            );
88
89            // $('[data-bs-toggle="tooltip"]').tooltip();
90            ezd_contribute_delete(); // Rebind delete buttons
91          },
92          error: function () {
93            console.log('Oops! Something went wrong, try again!');
94          }
95        });
96      });
97    }
98    ezd_contributor_add();
99    
100    // EazyDocs login submission
101    $('.ezd-form-wrap').submit(function (e) {
102        e.preventDefault();
103
104        // Get form data
105        var formData = $(this).serialize();
106        var nonceValue = eazydocs_ajax_search.eazydocs_local_nonce;
107
108        // Perform AJAX request
109        $.ajax({
110            type: 'POST',
111            url: eazydocs_ajax_search.ajax_url,
112            data: formData + '&action=ezd_login_check&nonce=' + nonceValue,
113            dataType: 'json',
114            beforeSend: function () {
115                $('.ezd-login-error').html('<span class="spinner-border ezd-login-loader"><span class="visually-hidden">Loading...</span></span>');
116            },
117            success: function (response) {              
118                $('.ezd-login-error').html(response.success);
119                if ( response.redirect_to ) {
120                  window.location.href = response.redirect_to;
121                }     
122                           
123                if ( response.success == false ) {
124                  $('.ezd-login-error').html(response.message);
125                }
126            }
127        });
128    });
129    // end
130    
131  });
132})(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.