|
352 | 352 | ).on("change", function () { |
353 | 353 | urm_validate_login_page_settings($(this)); |
354 | 354 | }); |
| 355 | + |
| 356 | + highlight_deep_linked_setting(); |
355 | 357 | }); |
356 | 358 |
|
| 359 | + /** |
| 360 | + * Deep-link support: when arriving with ?highlight=<field_id> (e.g. from the |
| 361 | + * login block editor), open the relevant tab/section and flash the setting. |
| 362 | + */ |
| 363 | + function highlight_deep_linked_setting() { |
| 364 | + var params = new URLSearchParams(window.location.search); |
| 365 | + var field_id = params.get("highlight"); |
| 366 | + |
| 367 | + if (!field_id) { |
| 368 | + return; |
| 369 | + } |
| 370 | + |
| 371 | + // admin.js builds the .form-settings-tab section nav on ready; wait for it. |
| 372 | + setTimeout(function () { |
| 373 | + switch_to_tab_and_section( |
| 374 | + params.get("tab") || "ur-tab-login-form-settings", |
| 375 | + params.get("tab-item") |
| 376 | + ); |
| 377 | + |
| 378 | + setTimeout(function () { |
| 379 | + var $container = $("#" + field_id).closest( |
| 380 | + ".user-registration-login-form-global-settings" |
| 381 | + ); |
| 382 | + |
| 383 | + if (!$container.length) { |
| 384 | + return; |
| 385 | + } |
| 386 | + |
| 387 | + $("html, body").animate( |
| 388 | + { scrollTop: $container.offset().top - 120 }, |
| 389 | + 500 |
| 390 | + ); |
| 391 | + |
| 392 | + $container.css({ |
| 393 | + outline: "2px solid #475bb2", |
| 394 | + "outline-offset": "4px", |
| 395 | + "border-radius": "6px", |
| 396 | + transition: "outline-color .3s ease" |
| 397 | + }); |
| 398 | + setTimeout(function () { |
| 399 | + $container.css({ outline: "", "outline-offset": "" }); |
| 400 | + }, 3000); |
| 401 | + }, 300); |
| 402 | + }, 500); |
| 403 | + } |
| 404 | + |
357 | 405 | function urm_validate_login_page_settings($this) { |
358 | 406 | var field_container = $this.closest( |
359 | 407 | ".user-registration-login-form-global-settings--field" |
|
425 | 473 | // If in Form Settings tab and section_id is provided, switch to that section |
426 | 474 | if (tab_id === "ur-tab-login-form-settings" && section_id) { |
427 | 475 | var $section_nav_item = $( |
428 | | - "a[href='#" + |
| 476 | + ".form-settings-tab[id='" + |
| 477 | + section_id + |
| 478 | + "'], a[href='#" + |
429 | 479 | section_id + |
430 | 480 | "'], li#" + |
431 | 481 | section_id + |
|
0 commit comments