1/** 2 * Force host-only cookies for local hosts and ensure form_key cookie is set. 3 */ 4(function () { 5 function applyCookieConfigDomain() { 6 if (typeof window.COOKIE_CONFIG === 'object') { 7 window.COOKIE_CONFIG.domain = null; 8 } 9 } 10 11 function setFormKeyCookieFromDom() { 12 var input = document.querySelector('input[name="form_key"]'); 13 if (!input || !input.value) { 14 return; 15 } 16 // Host-only, session lifetime, Lax same-site. 17 document.cookie = 'form_key=' + encodeURIComponent(input.value) + '; path=/; samesite=lax'; 18 } 19 20 // Run immediately in case COOKIE_CONFIG is already present. 21 applyCookieConfigDomain(); 22 23 // Ensure we run after DOM is ready so the hidden form_key input exists. 24 if (document.readyState === 'complete' || document.readyState === 'interactive') { 25 setFormKeyCookieFromDom(); 26 } else { 27 document.addEventListener('DOMContentLoaded', function () { 28 applyCookieConfigDomain(); 29 setFormKeyCookieFromDom(); 30 }, {once: true}); 31 } 32})();
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.