PluginProbe ʕ •ᴥ•ʔ
Permalink Manager Lite / trunk
Permalink Manager Lite vtrunk
2.5.4 2.5.3.4 2.2.18 2.2.19.2 2.2.19.3 2.2.19.3.1 2.2.2 2.2.20 2.2.20.1 2.2.20.3 2.2.4 2.2.5 2.2.6 2.2.7.2 2.2.7.3 2.2.7.5 2.2.7.6 2.2.8.4 2.2.8.5 2.2.8.6 2.2.8.7 2.2.8.9 2.2.9.1 2.2.9.2 2.2.9.2.1 2.2.9.3 2.2.9.4 2.2.9.6 2.2.9.7 2.2.9.9 2.3.0 2.3.1.1 2.4.0 2.4.1 2.4.1.2 2.4.1.3 2.4.1.4 2.4.1.5 2.4.1.6 2.4.2 2.4.2.1 2.4.3 2.4.3.1 2.4.3.2 2.4.3.3 2.4.3.4 2.4.4 2.4.4.1 2.4.4.2 2.4.4.3 2.5.0 2.5.1 2.5.1.1 2.5.1.2 2.5.1.3 2.5.1.4 2.5.2 2.5.2.1 2.5.2.2 2.5.2.3 2.5.2.4 2.5.3 2.5.3.1 2.5.3.2 2.5.3.3 trunk 0.2 0.3 0.3.1 0.3.2 0.3.3 0.3.4 0.4 0.4.1 0.4.2 0.4.3 0.4.4 0.4.6 0.4.7 0.4.8 0.4.9 0.5.3 0.5.4 1.0.0 1.0.1 1.0.4 1.1.0 1.1.1 1.1.2 1.11.6.3 2.0.0 2.0.3 2.0.4 2.0.4.3 2.0.5.1 2.0.5.2 2.0.5.3 2.0.5.3.1 2.0.5.4 2.0.5.4a 2.0.5.5 2.0.5.6 2.0.5.6.1 2.0.5.7 2.0.5.9a 2.0.6.2.1 2.0.6.2a 2.0.6.3 2.1.0 2.1.1 2.1.2.4 2.2.0 2.2.1.1 2.2.1.2 2.2.11 2.2.12 2.2.13.1 2.2.14 2.2.15.1 2.2.16 2.2.17
permalink-manager / out / permalink-manager-admin.js
permalink-manager / out Last commit date
permalink-manager-admin.css 1 day ago permalink-manager-admin.js 3 months ago permalink-manager-gutenberg.js 1 year ago permalink-manager-plugins.css 1 year ago permalink-manager-plugins.js 1 year ago
permalink-manager-admin.js
695 lines
1 jQuery(document).ready(function () {
2
3 /**
4 * "(Un)select all" checkboxes
5 */
6 var checkbox_actions = ['select_all', 'unselect_all'];
7 checkbox_actions.forEach(function (element) {
8 jQuery(document).on('click', '#permalink-manager .' + element, function () {
9 jQuery(this).parents('.field-container').find('.checkboxes input[type="checkbox"]').each(function () {
10 var action = (element === 'select_all');
11 jQuery(this).prop('checked', action);
12 });
13
14 return false;
15 });
16 });
17
18 jQuery('#permalink-manager .checkboxes label, #permalink-manager .single_checkbox label').not('input').on('click', function (ev) {
19 var input = jQuery(this).find("input");
20 if (!jQuery(ev.target).is("input")) {
21 input.prop('checked', !(input.prop("checked")));
22 }
23 });
24
25 /**
26 * Confirm action
27 */
28 jQuery('.pm-confirm-action').on('click', function () {
29 return confirm(permalink_manager.confirm);
30 });
31
32 jQuery('#permalink-manager #uri_editor form input[name="s"]').on('keydown keypress keyup', function (e) {
33 if (e.keyCode == 13) {
34 jQuery('#permalink-manager #search-submit').trigger('click');
35
36 e.preventDefault();
37 return false;
38 }
39 });
40
41 /**
42 * Filter by content types in "Tools"
43 */
44 jQuery('#permalink-manager *[data-field="content_type"] select').on('change', function () {
45 var content_type = jQuery(this).val();
46 if (content_type == 'post_types') {
47 jQuery(this).parents('.form-table').find('*[data-field="post_types"],*[data-field="post_statuses"]').removeClass('hidden');
48 jQuery(this).parents('.form-table').find('*[data-field="taxonomies"]').addClass('hidden');
49 } else {
50 jQuery(this).parents('.form-table').find('*[data-field="post_types"],*[data-field="post_statuses"]').addClass('hidden');
51 jQuery(this).parents('.form-table').find('*[data-field="taxonomies"]').removeClass('hidden');
52 }
53 }).trigger("change");
54
55 /**
56 * Toggle "Edit URI" box
57 */
58 jQuery('#wpwrap').on('click', '#permalink-manager-toggle, .permalink-manager-edit-uri-box .close-button', function () {
59 jQuery('.permalink-manager-edit-uri-box').slideToggle();
60
61 return false;
62 });
63
64 /**
65 * Toggle "Edit Redirects" box
66 */
67 jQuery('#permalink-manager').on('click', '#toggle-redirect-panel', function () {
68 jQuery('#redirect-panel-inside').slideToggle();
69
70 return false;
71 });
72
73 jQuery('#permalink-manager').on('click', '.permalink-manager.redirects-panel #permalink-manager-new-redirect', function () {
74 // Find the table
75 var table = jQuery(this).parents('.redirects-panel').find('table');
76
77 // Copy the row from the sample
78 var new_row = jQuery(this).parents('.redirects-panel').find('.sample-row').clone().removeClass('sample-row');
79
80 // Adjust the array key
81 var last_key = jQuery(table).find("tr:last-of-type input[data-index]").data("index") + 1;
82 jQuery("input[data-index]", new_row).attr("data-index", last_key).attr("name", function () {
83 return jQuery(this).attr("name") + "[" + last_key + "]"
84 });
85
86 // Append the new row
87 jQuery(table).append(new_row);
88
89 return false;
90 });
91
92 jQuery('#permalink-manager').on('click', '.remove-redirect', function () {
93 jQuery(this).closest('tr').remove();
94
95 return false;
96 });
97
98 /**
99 * Synchronize "Edit URI" input field with the sample permalink
100 */
101 var custom_uri_input = jQuery('.permalink-manager-edit-uri-box input[name="custom_uri"]');
102 jQuery(custom_uri_input).on('keyup change', function () {
103 jQuery('.sample-permalink-span .editable').text(jQuery(this).val());
104 });
105
106 /**
107 * Synchronize "Coupon URI" input field with the final permalink
108 */
109 jQuery('#permalink-manager-coupon-url input[name="custom_uri"]').on('keyup change', function () {
110 var uri = jQuery(this).val();
111 jQuery('#permalink-manager-coupon-url code span').text(uri);
112
113 if (!uri) {
114 jQuery('#permalink-manager-coupon-url .coupon-full-url').addClass("hidden");
115 } else {
116 jQuery('#permalink-manager-coupon-url .coupon-full-url').removeClass("hidden");
117 }
118 });
119
120 function permalink_manager_duplicate_check(custom_uri_input, nonce) {
121 // Set default values
122 custom_uri_input = typeof custom_uri_input !== 'undefined' ? custom_uri_input : false;
123
124 var all_custom_uris_values = {};
125
126 if (custom_uri_input) {
127 var custom_uri = jQuery(custom_uri_input).val();
128 var element_id = jQuery(custom_uri_input).attr("data-element-id");
129
130 all_custom_uris_values[element_id] = custom_uri;
131 } else {
132 jQuery('.custom_uri').each(function (i, obj) {
133 var field_name = jQuery(obj).attr('data-element-id');
134 all_custom_uris_values[field_name] = jQuery(obj).val();
135 });
136 }
137
138 if (all_custom_uris_values) {
139 jQuery.ajax(permalink_manager.ajax_url, {
140 type: 'POST',
141 async: true,
142 data: {
143 action: 'pm_detect_duplicates',
144 nonce: nonce,
145 custom_uris: all_custom_uris_values
146 },
147 success: function (data) {
148 if (typeof data === 'object' && data !== null) {
149 // Loop through results
150 jQuery.each(data, function (key, is_duplicate) {
151 var alert_container = jQuery('.custom_uri[data-element-id="' + key + '"]').parents('.custom_uri_container').find('.duplicated_uri_alert');
152
153 if (is_duplicate) {
154 jQuery(alert_container).text(is_duplicate);
155 } else {
156 jQuery(alert_container).empty();
157 }
158 });
159 }
160 }
161 });
162 }
163 }
164
165 /**
166 * Check if a single custom URI is not duplicated
167 */
168 var custom_uri_check_timeout = null;
169 jQuery('.custom_uri_container input[name="custom_uri"], .custom_uri_container input.custom_uri').each(function () {
170 var input = this;
171
172 jQuery(this).on('keyup change', function () {
173 clearTimeout(custom_uri_check_timeout);
174
175 // Wait until user finishes typing
176 custom_uri_check_timeout = setTimeout(function () {
177 permalink_manager_duplicate_check(input);
178 }, 1000);
179 });
180 });
181
182 /**
183 * Check if any of displayed custom URIs is not duplicated
184 */
185 if (jQuery('#uri_editor .custom_uri').length > 0) {
186 let uri_editor_nonce = jQuery('#uri_editor #uri_editor_nonce').val();
187 permalink_manager_duplicate_check(false, uri_editor_nonce);
188 }
189
190 /**
191 * Disable "Edit URI" input if URI should be updated automatically
192 */
193 jQuery('#permalink-manager').on('change', 'select[name="auto_update_uri"]', function () {
194 var selected = jQuery(this).find('option:selected');
195 var auto_update_status = jQuery(selected).data('readonly');
196 var container = jQuery(this).parents('#permalink-manager');
197
198 if (auto_update_status == 1 || auto_update_status == 2) {
199 jQuery(container).find('input[name="custom_uri"]').attr("readonly", true);
200 jQuery(container).find('.uri_locked').removeClass("hidden");
201 } else {
202 jQuery(container).find('input[name="custom_uri"]').removeAttr("readonly", true);
203 jQuery(container).find('.uri_locked').addClass("hidden");
204 }
205 });
206 jQuery('select[name="auto_update_uri"]').trigger("change");
207
208 /**
209 * Restore "Default URI"
210 */
211 jQuery('#permalink-manager').on('click', '.restore-default', function () {
212 // Find all input fields within the relevant container
213 var inputs = jQuery(this).parents('.field-container, .permalink-manager-edit-uri-box, #permalink-manager .inside').find('input.custom_uri, .permastruct-field');
214
215 // Iterate over each input element
216 inputs.each(function () {
217 var input = jQuery(this);
218 var default_uri = input.attr('data-default'); // Get the default value for this specific input
219
220 // Set the default value and trigger the 'keyup' event
221 input.val(default_uri).trigger('keyup');
222 });
223
224 return false;
225 });
226
227 /**
228 * Display additional permastructure settings
229 */
230 jQuery('#permalink-manager').on('click', '.permastruct-buttons a.extra-settings', function () {
231 jQuery(this).parents('.permastruct-row').find('.permastruct-settings').slideToggle();
232
233 return false;
234 });
235
236 /**
237 * Copy Permastructure tag to clipboard
238 */
239 jQuery('.structure-tags-list .permastruct-tag-container .permastruct-tag-buttons button').on('click', async function () {
240 const button = jQuery(this);
241 const textToCopy = button.text().trim(); // Get button text
242
243 try {
244 await navigator.clipboard.writeText(textToCopy); // Copy text to clipboard
245 button.text('Copied!').prop('disabled', true); // Provide feedback
246
247 setTimeout(() => {
248 button.text(button.data('original-text')).prop('disabled', false);
249 }, 1000);
250 } catch (err) {
251 console.error('Clipboard copy failed:', err);
252 }
253 });
254
255 /**
256 * Control the settings tabs
257 */
258 jQuery('#permalink-manager').on('click', '.settings-tabs .subsubsub a', function () {
259 var tab_id = jQuery(this).attr('data-tab');
260
261 pm_load_settings_tab(tab_id);
262
263 return false;
264 });
265
266 if (jQuery('#permalink-manager .settings-tabs').length > 0) {
267 var tab_id = window.location.hash.substring(1);
268
269 if (tab_id) {
270 pm_load_settings_tab(tab_id);
271 }
272 }
273
274 function pm_load_settings_tab(tab_id) {
275 var settings_container = jQuery('#permalink-manager .settings-tabs');
276 var new_tab = jQuery(settings_container).find('.subsubsub a[data-tab=' + tab_id + ']');
277
278 if (jQuery(new_tab).length > 0) {
279 jQuery(settings_container).find('.subsubsub a').removeClass('current');
280 jQuery(new_tab).addClass('current');
281
282 jQuery(settings_container).find('form > div').hide().removeClass('active-tab');
283 jQuery(settings_container).find('form > div#pm_' + tab_id).show().addClass('active-tab');
284
285 jQuery(settings_container).find('form input[name="pm_active_tab"]').val(tab_id);
286
287 // Change the hash in the URL
288 if (tab_id) {
289 if (history.pushState) {
290 history.pushState(null, null, "#" + tab_id);
291 } else {
292 window.location.hash = tab_id;
293 }
294 }
295 }
296 }
297
298 /**
299 * Conditional fields in Permalink Manager settings
300 */
301 jQuery('#permalink-manager .settings-tabs #extra_redirects input[type="checkbox"]').on('change', function () {
302 var is_checked = jQuery(this).is(':checked');
303 var rel_field_container = jQuery('#permalink-manager .settings-tabs #setup_redirects');
304
305 if (is_checked == true) {
306 rel_field_container.removeClass('hidden');
307 } else {
308 rel_field_container.addClass('hidden');
309 }
310 }).trigger("change");
311
312 /**
313 * Hide global admin notices
314 */
315 jQuery(document).on('click', '.permalink-manager-notice.is-dismissible .notice-dismiss', function () {
316 var alert_id = jQuery(this).closest('.permalink-manager-notice').data('alert_id');
317
318 jQuery.ajax(permalink_manager.ajax_url, {
319 type: 'POST',
320 data: {
321 action: 'pm_dismissed_notice_handler',
322 alert_id: alert_id,
323 }
324 });
325 });
326
327 /**
328 * Save permalinks from Gutenberg with AJAX
329 */
330 var pm_container = jQuery('#permalink-manager.postbox');
331 var pm_container_disabled = false;
332 var pm_container_reloading = false;
333 jQuery('#permalink-manager .save-row.hidden').removeClass('hidden');
334 jQuery('#permalink-manager').on('click', '#permalink-manager-save-button', pm_gutenberg_save_uri);
335
336 function pm_gutenberg_loading_overlay(show = true) {
337 if (show && !pm_container_disabled) {
338 pm_container_disabled = true;
339
340 jQuery(pm_container).LoadingOverlay('show', {
341 background: 'rgba(0, 0, 0, 0.1)',
342 });
343 } else if (!show && pm_container_disabled) {
344 pm_container_disabled = false;
345
346 jQuery(pm_container).LoadingOverlay('hide', true);
347 }
348 }
349
350 function pm_gutenberg_reload() {
351 var pm_post_id = jQuery('input[name="permalink-manager-edit-uri-element-id"]').val();
352
353 jQuery.ajax({
354 type: 'GET',
355 url: permalink_manager.ajax_url + '?action=pm_get_uri_editor',
356 data: {
357 'post_id': pm_post_id
358 },
359 beforeSend: pm_gutenberg_loading_overlay,
360 success: function (html) {
361 jQuery(pm_container).find('.permalink-manager-gutenberg').replaceWith(html);
362 pm_gutenberg_loading_overlay(false);
363
364 jQuery(pm_container).find('select[name="auto_update_uri"]').trigger("change");
365 pm_help_tooltips();
366 }
367 });
368 }
369
370 function pm_gutenberg_save_uri() {
371 var pm_fields = jQuery(pm_container).find("input, select");
372
373 jQuery.ajax({
374 type: 'POST',
375 url: permalink_manager.ajax_url,
376 async: true,
377 data: jQuery(pm_fields).serialize() + '&action=pm_save_permalink',
378 beforeSend: pm_gutenberg_loading_overlay,
379 success: pm_gutenberg_reload
380 });
381
382 return false;
383 }
384
385 /**
386 * Reload the URI Editor in Gutenberg after the post is published or the title/slug is changed
387 */
388 if (typeof wp !== 'undefined' && typeof wp.data !== 'undefined' && typeof wp.data.select !== 'undefined' && typeof wp.data.subscribe !== 'undefined' && wp.data.select('core/editor') != null && wp.data.select('core/edit-post') != null) {
389 wp.data.subscribe(function () {
390 try {
391 var isSavingPost = wp.data.select('core/editor').isSavingPost();
392 var isAutosavingPost = wp.data.select('core/editor').isAutosavingPost();
393 var isSavingMetaBoxes = wp.data.select('core/edit-post').isSavingMetaBoxes();
394
395 // Disable URI Editor until it is reloaded
396 if (isSavingPost && !isAutosavingPost) {
397 pm_gutenberg_loading_overlay();
398 }
399
400 // Reload URI Editor only after metaboxes are saved
401 if (isSavingMetaBoxes) {
402 pm_container_reloading = true;
403 } else if (pm_container_reloading) {
404 pm_container_reloading = false;
405
406 pm_gutenberg_reload();
407 }
408 } catch (err) {
409 console.log('Permalink Manager', err);
410 }
411 });
412 }
413
414 /**
415 * Help tooltips
416 */
417 function pm_help_tooltips() {
418 if (jQuery('#permalink-manager .help_tooltip').length > 0) {
419 jQuery('#permalink-manager .help_tooltip').each(function () {
420 var helpTooltip = this;
421
422 tippy(helpTooltip, {
423 // placement: 'top-start',
424 arrow: true,
425 content: jQuery(helpTooltip).attr('title'),
426 distance: 20
427 });
428 });
429 }
430 }
431
432 pm_help_tooltips();
433
434
435 /**
436 * Check expiration date
437 */
438 jQuery(document).on('click', '#pm_get_exp_date', function () {
439 jQuery.ajax(permalink_manager.ajax_url, {
440 type: 'POST',
441 data: {
442 action: 'pm_get_exp_date',
443 licence: {
444 licence_key: jQuery('#permalink-manager #settings #licence_key input[type="text"]').val()
445 }
446 },
447 beforeSend: function () {
448 var spinner = '<img src="' + permalink_manager.spinners + '/wpspin_light-2x.gif" width="16" height="16">';
449 jQuery('#permalink-manager .licence-info').html(spinner);
450 },
451 success: function (data) {
452 jQuery('#permalink-manager .licence-info').html(data);
453 }
454 });
455
456 return false;
457 });
458
459 /**
460 * Bulk tools
461 */
462 function pm_show_progress(elem, progress) {
463 if (progress) {
464 jQuery(elem).LoadingOverlay("text", progress + "%");
465 } else {
466 jQuery(elem).LoadingOverlay("show", {
467 background: "rgba(0, 0, 0, 0.1)",
468 text: '0%'
469 });
470 }
471 }
472
473 jQuery('#permalink-manager #tools form.form-ajax').on('submit', function () {
474 var total_iterations = updated_count = total = progress = 0;
475 var iteration = 1;
476 var data = jQuery(this).serialize() + '&action=pm_bulk_tools&iteration=' + iteration;
477
478 // Hide alert & results table
479 jQuery('#permalink-manager .updated-slugs-table, .permalink-manager-notice.updated_slugs, #permalink-manager #updated-list').remove();
480
481 jQuery.ajax({
482 type: 'POST',
483 url: permalink_manager.ajax_url,
484 data: data,
485 beforeSend: function () {
486 // Show progress overlay
487 pm_show_progress("#permalink-manager #tools", progress);
488 },
489 success: function (data) {
490 var table_dom = jQuery('#permalink-manager .updated-slugs-table');
491 var ajax_request = this;
492
493 // The first AJAX request should return the total items & iterations count
494 if (data.hasOwnProperty('total_iterations') && data.hasOwnProperty('total')) {
495 total_iterations = parseInt(data.total_iterations);
496 total = parseInt(data.total);
497
498 // If prior requests were handled with errors, remove those alerts
499 jQuery('.permalink-manager-notice.updated_slugs.error').remove();
500
501 // Add the alert container with the status but do not display it yet
502 if (data.hasOwnProperty('alert')) {
503 jQuery('#plugin-name-heading').after(jQuery(data.alert).hide());
504 }
505 } // Check if the iteration and total count were correctly set in the first AJAX request
506 else if (total_iterations === 0 || total === 0) {
507 console.log('No items have been processed.');
508 jQuery('#permalink-manager #tools').LoadingOverlay("hide", true);
509
510 return true;
511 }
512
513 // Display the table
514 if (data.hasOwnProperty('html')) {
515 var table = jQuery(data.html);
516
517 if (table_dom.length == 0) {
518 jQuery('#permalink-manager #tools').after(data.html);
519 } else {
520 jQuery(table_dom).append(jQuery(table).find('tbody').html());
521 }
522 }
523
524 // Increase updated count
525 if (data.hasOwnProperty('updated_count')) {
526 updated_count = updated_count + parseInt(data.updated_count);
527
528 jQuery('.permalink-manager-notice.updated_slugs .updated_count').text(updated_count);
529 }
530
531 // Repeat the AJAX request for the next chunk of items
532 if (iteration < total_iterations) {
533 // Update the progress
534 progress = Math.floor((iteration / total_iterations) * 100);
535 console.log(iteration + "/" + total_iterations + " = " + progress + "%");
536
537 // Go to the next chunk
538 iteration++;
539
540 // Change the iteration number in the AJAX data
541 ajax_request.data = ajax_request.data.replace(/(&iteration=)([\d]+)/gm, "$1" + iteration);
542 jQuery.ajax(ajax_request);
543 } else {
544 // Display the alert container and hide the loading overlay
545 jQuery('.permalink-manager-notice.updated_slugs').fadeIn();
546 jQuery('#permalink-manager #tools').LoadingOverlay("hide", true);
547
548 if (table_dom.length > 0) {
549 jQuery('html, body').animate({
550 scrollTop: table_dom.offset().top - 100
551 }, 2000);
552 }
553
554 // Reset progress & updated count
555 progress = updated_count = 0;
556 }
557
558 return true;
559 },
560 error: function (xhr, status, error_data) {
561 alert('There was a problem running this tool and the process could not be completed. You can find more details in browser\'s console log.');
562 console.log('Status: ' + status);
563 console.log('Please send the debug data to contact@permalinkmanager.pro:\n\n' + xhr.responseText);
564
565 jQuery('#permalink-manager #tools').LoadingOverlay("hide", true);
566 }
567 });
568
569 return false;
570 });
571
572 /**
573 * Stop-words
574 */
575 var stop_words_input = '#permalink-manager .field-container textarea.stop_words';
576
577 if (jQuery(stop_words_input).length > 0) {
578 var stop_words = new TIB(document.querySelector(stop_words_input), {
579 alert: false,
580 //escape: null,
581 escape: [','],
582 classes: ['tags words-editor', 'tag', 'tags-input', 'tags-output', 'tags-view'],
583 });
584 jQuery('.tags-output').hide();
585
586 // Force lowercase
587 stop_words.filter = function (text) {
588 return text.toLowerCase();
589 };
590
591 // Remove all words
592 jQuery('#permalink-manager .field-container .clear_all_words').on('click', function () {
593 stop_words.reset();
594 });
595
596 // Load stop-words list
597 jQuery('#permalink-manager #load_stop_words_button').on('click', function () {
598 var lang = jQuery(".load_stop_words option:selected").val();
599 if (lang) {
600 var json_url = permalink_manager.url + "/includes/vendor/stopwords-json/dist/" + lang + ".json";
601
602 // Load JSON with words list
603 jQuery.getJSON(json_url, function (data) {
604 var new_words = [];
605
606 jQuery.each(data, function (key, val) {
607 new_words.push(val);
608 });
609
610 stop_words.update(new_words);
611 });
612 }
613
614 return false;
615 });
616 }
617
618 /**
619 * Quick Edit
620 */
621 function pm_quick_edit(item, inlineEdit) {
622 // Get the item ID and type
623 let item_id = 0;
624 let item_uri_id = '';
625 let item_type = '';
626 let item_row = '';
627
628 // Get the ID
629 if (typeof (inlineEdit) == 'object') {
630 item_id = parseInt(inlineEdit.getId(item));
631 item_type = inlineEdit.type;
632 } else {
633 return;
634 }
635
636 // Get the edit row
637 let edit_row = jQuery('#edit-' + item_id);
638
639 // Get the post/term row
640 if (item_type === 'tag') {
641 item_row = jQuery('#tag-' + item_id);
642 item_uri_id = "tax-" + item_id;
643 } else if (item_type === 'post' || item_type === 'page') {
644 item_row = jQuery('#post-' + item_id);
645 item_uri_id = item_id;
646 } else {
647 return;
648 }
649
650 if (item_id !== 0) {
651 // Get the row & "Custom URI" field
652 let custom_uri_field = edit_row.find('.custom_uri');
653
654 // Prepare the Custom URI
655 let custom_uri = item_row.find(".column-permalink-manager-col").text();
656
657 // Fill with the Custom URI
658 custom_uri_field.val(custom_uri);
659
660 // Get auto-update settings
661 let auto_update = item_row.find(".permalink-manager-col-uri").attr('data-disabled');
662
663 if (typeof auto_update !== "undefined" && (auto_update == 1 || auto_update == 2)) {
664 if (auto_update == 1) {
665 custom_uri_field.attr('readonly', 'readonly');
666 } else if (auto_update == 2) {
667 custom_uri_field.attr('disabled', 'disabled');
668 }
669 }
670
671 // Set the element ID
672 edit_row.find('.permalink-manager-edit-uri-element-id').val(item_uri_id);
673 }
674 }
675
676 if (typeof inlineEditPost !== "undefined") {
677 var inline_post_editor = inlineEditPost.edit;
678 inlineEditPost.edit = function (id) {
679 inline_post_editor.apply(this, arguments);
680
681 pm_quick_edit(id, this);
682 }
683 }
684
685 if (typeof inlineEditTax !== "undefined") {
686 var inline_tax_editor = inlineEditTax.edit;
687 inlineEditTax.edit = function (id) {
688 inline_tax_editor.apply(this, arguments);
689
690 pm_quick_edit(id, this);
691 }
692 }
693
694 });
695