PageSourceSearch

https://hymnary.org/sites/hymnary.org/modules/hymnary/hymnary-register-destination.js?tlw2nf

js hymnary.org collected 2026-10-01 09:23:34 UTC 1,525 bytes, 31 lines download raw bytes

1/* global jQuery, localStorage */
2jQuery(document).ready(function () {
3  // If register path with a destination, set cookie to remember where they should be directed after registration
4  const route = window.location.pathname + window.location.search;
5  const registerDestRegex = /^\/user\/register\?destination=([^&]+)/mi;
6  const matches = route.match(registerDestRegex);
7  if (matches) {
8    localStorage.setItem('hymnary-register-destination', matches[1]);
9  } else if (route.startsWith('/sso-confirm/')) {
10    // After confirming email, redirect them to the stored destination
11    const registerDest = localStorage.getItem('hymnary-register-destination');
12    if (registerDest) {
13      localStorage.removeItem('hymnary-register-destination');
14      jQuery('a:contains("Log in to")').attr('href', function (i, current) {
15        return current + '&destination=' + registerDest;
16      });
17    }
18  }
19
20  // Automatically redeem pro pass after creating account or logging in
21  // TODO: Find a less hacky way to do this
22  const params = new URLSearchParams(window.location.search);
23  const paramsObj = Object.fromEntries(params.entries());
24  if (paramsObj.destination && paramsObj.destination.startsWith('/pro/pass/')) {
25    localStorage.setItem('hymnary-redeem-pro-pass', true);
26  }
27  if (localStorage.getItem('hymnary-redeem-pro-pass') && window.location.pathname.startsWith('/pro/pass/')) {
28    localStorage.removeItem('hymnary-redeem-pro-pass');
29    jQuery('.pro-pass-card-actions-button[type="submit"]').click();
30  }
31});

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.