1 2 3const burgerprofielTemplate = document.getElementById("burgerprofiel-settings-template"); 4if (burgerprofielTemplate !== null) { 5 const jsonText = burgerprofielTemplate.innerHTML.trim(); 6 try { 7 var Burgerprofiel = JSON.parse(jsonText); 8 } catch (error) { 9 console.error("Error parsing JSON:", error); 10 } 11} 12 13if (typeof (Burgerprofiel) !== "undefined" && typeof (vl) !== "undefined") { 14 15 var wasAuthorized = false; 16 var loggedOutLocal = false; 17 vl.widget.client.bootstrap(Burgerprofiel.apiURl) 18 .then(function (widget) { 19 var placeholder = document.getElementById('global-header-placeholder'); 20 widget.setMountElement(placeholder); 21 widget.mount().catch(console.error.bind(console)) 22 return widget; 23 }) 24 .then(function (widget) { 25 vl.widget.client.capture((widget) => { window.widget = widget }); 26 widget.getExtension('citizen_profile').then((citizen_profile) => { 27 28 if (Burgerprofiel.integratedLogin != undefined && Burgerprofiel.integratedLogin) { 29 var websiteHasAuthenticatedSession = Burgerprofiel.isAuthenticated; 30 var session = citizen_profile.getSession(); 31 session.configure({ 32 active: websiteHasAuthenticatedSession, 33 endpoints: { 34 loginUrl: '/login', 35 logoutUrl: '/sso/logout?returnurl=/', 36 loginRedirectUrl: window.location.href 37 } 38 }); 39 40 } 41 42 var state = citizen_profile.getSession().getState(); 43 var btnLogout = document.getElementById('profiellogout'); 44 if (btnLogout !== null) { 45 46 btnLogout.addEventListener('click', function (e) { 47 var state2 = citizen_profile.getSession().getState(); 48 if (state2 == 'authenticated') { 49 e.preventDefault(); 50 citizen_profile.getSession().logout(); 51 loggedOutLocal = true; 52 } 53 }); 54 } 55 citizen_profile.addEventListener('session.update', (event) => { 56 var state2 = citizen_profile.getSession().getState(); // of event.getSource().getState(); 57 var myProfileLink = document.querySelector(Burgerprofiel.profileLinkSelector); 58 if (state2 == 'authenticated') { 59 wasAuthorized = true; 60 if (myProfileLink != null) { 61 myProfileLink.classList.remove('hidden'); 62 } 63 64 } else if (state2 == 'unauthenticated') { 65 if (loggedOutLocal) { 66 loggedOutLocal = false;
67 window.location = '/sso/logout?returnurl=/'; 68 } 69 if (myProfileLink != null) { 70 myProfileLink.classList.add('hidden'); 71 } 72 73 74 if (Burgerprofiel.isLoggedInWithACM && Burgerprofiel.isAuthenticated) { 75 76 if (wasAuthorized) { 77 wasAuthorized = false; 78 window.location = '/sso/logout?returnurl=/'; 79 80 } else { 81 citizen_profile.getSession().login(); 82 if (myProfileLink != null) { 83 myProfileLink.classList.remove('hidden'); 84 } 85 } 86 } 87 } 88 }); 89 }); 90 }) 91 .catch(console.error.bind(console)); 92} else { 93 console.log('Burgerprofiel not loaded.'); 94}
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.