|
Lines 134-152
function addCollapseHandler() {
Link Here
|
| 134 |
|
134 |
|
| 135 |
// Add a handler for any consent delete links |
135 |
// Add a handler for any consent delete links |
| 136 |
function addConsentDeleteHandler() { |
136 |
function addConsentDeleteHandler() { |
| 137 |
// Don't duplicate click event handlers |
137 |
const deleteButtons = $('.consentDelete').map(function() { |
| 138 |
const ev = $._data($('.consentDelete'), 'events'); |
138 |
return this |
| 139 |
if (ev && ev.click) { |
139 |
}).get(); |
| 140 |
return; |
140 |
deleteButtons.forEach((deleteButton) => { |
| 141 |
} |
141 |
// Don't duplicate click event handlers |
| 142 |
$('.consentDelete').on('click', function (e) { |
142 |
const ev = $._data($(deleteButton).get(0), 'events'); |
| 143 |
e.preventDefault(); |
143 |
if (ev && ev.click) { |
| 144 |
const target = $(this).data('target'); |
144 |
return; |
| 145 |
const proceed = confirm(__('Are you sure you want to delete this consent item?')); |
|
|
| 146 |
if (proceed) { |
| 147 |
$('#' + target).remove(); |
| 148 |
} |
145 |
} |
| 149 |
}); |
146 |
$(deleteButton).on('click', function (e) { |
|
|
147 |
e.preventDefault(); |
| 148 |
const target = $(this).data('target'); |
| 149 |
const proceed = confirm(__('Are you sure you want to delete this consent item?')); |
| 150 |
if (proceed) { |
| 151 |
$('#' + target).remove(); |
| 152 |
} |
| 153 |
}); |
| 154 |
}) |
| 150 |
} |
155 |
} |
| 151 |
|
156 |
|
| 152 |
$( document ).ready( function () { |
157 |
$( document ).ready( function () { |
| 153 |
- |
|
|