1export function getHiddenValue(name, defaultValue = null, deleteAfter = true) { 2 const hiddenField = document.querySelector(`input[name="${name}"]`); 3 if (hiddenField === null) { 4 return defaultValue; 5 } 6 7 const value = hiddenField.value; 8 if (deleteAfter) { 9 hiddenField.remove(); 10 } 11 12 return value; 13} 14 15// UrlParam 16export function setOrUpdateUrlParam(key, value) { 17 const url = new URL(window.location); 18 url.searchParams.set(key, value); // Add or update the parameter 19 history.replaceState(null, '', url); 20} 21 22export function getUrlParam(key) { 23 const url = new URL(window.location); 24 return url.searchParams.get(key); 25} 26 27export function hasUrlParam(key) { 28 const url = new URL(window.location); 29 return url.searchParams.has(key); 30} 31 32export function removeUrlParam(key) { 33 const url = new URL(window.location); 34 url.searchParams.delete(key); 35 history.replaceState(null, '', url); 36}
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.