PluginProbe
Search Atlas SEO – OTTO AI SEO Automation for WordPress / 2.6.3
Search Atlas SEO – OTTO AI SEO Automation for WordPress v2.6.3
2.7.1 2.7.2 2.7.0 2.6.26 2.6.25 2.6.24 2.6.23 2.6.22 2.6.21 2.6.20 2.6.19 2.6.18 2.6.17 2.6.16 2.6.15 2.6.14 2.6.13 2.6.12 2.6.11 2.6.10 2.6.9 2.6.8 2.6.7 2.6.6 2.6.5 All 141 releases
metasync / views / js / metasync-redirections.js

metasync-redirections.js in Search Atlas SEO – OTTO AI SEO Automation for WordPress 2.6.3, at views/js/metasync-redirections.js

50 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * MetaSync redirections — filter auto-submit and pagination tab fix.
3 *
4 * Extracted from views/metasync-redirection.php (Phase 5, #887).
5 */
6 document.addEventListener('DOMContentLoaded', function() {
7 // Auto-submit filters when changed
8 var filterSelects = document.querySelectorAll('#status-filter, #pattern-filter, #http-code-filter');
9 var form = document.getElementById('redirection-form');
10 filterSelects.forEach(function(select) {
11 select.addEventListener('change', function() {
12 var formAction = form.getAttribute('action') || window.location.href;
13 var url = new URL(formAction, window.location.origin);
14 url.searchParams.delete('paged_redir');
15 form.setAttribute('action', url.pathname + url.search);
16
17 // Also add hidden field to ensure pagination resets
18 var pagedInput = form.querySelector('input[name="paged_redir"]');
19 if (!pagedInput) {
20 pagedInput = document.createElement('input');
21 pagedInput.type = 'hidden';
22 pagedInput.name = 'paged_redir';
23 form.appendChild(pagedInput);
24 }
25 pagedInput.value = '1';
26
27 form.submit();
28 });
29 });
30
31 // Add tab parameter to all pagination links in redirections tab
32 function addTabToPaginationLinks() {
33 // Find all pagination links within redirections-content
34 var redirectionsContent = document.getElementById('redirections-content');
35 if (redirectionsContent) {
36 var paginationLinks = redirectionsContent.querySelectorAll('.tablenav-pages a');
37 paginationLinks.forEach(function(link) {
38 var url = new URL(link.href);
39 url.searchParams.set('tab', 'redirections');
40 link.href = url.toString();
41 });
42 }
43 }
44
45 // Run immediately and after a short delay
46 addTabToPaginationLinks();
47 setTimeout(addTabToPaginationLinks, 100);
48 setTimeout(addTabToPaginationLinks, 500);
49 });
50