function isIE() { return (/MSIE (\d+\.\d+);/.test(navigator.userAgent)); } function isFullscreen() { try { return ((top.innerWidth == screen.width) && (top.innerHeight == screen.height)); } catch (e) { return false; } } function isActivexEnabled() { var supported = null; try { supported = !!new ActiveXObject("htmlfile"); } catch (e) { supported = false; } return supported; } function isMetro() { if (!isIE()) return false; return !isActivexEnabled() && isFullscreen(); } /* only required if BKU selection template uses the old local BKU selection form*/ /* window.onload=function() { document.getElementById("localBKU").style.display="block"; return; }*/ function bkuLocalClicked() { setMandateSelection(); } function bkuOnlineClicked() { if (isMetro()) document.getElementById("metroDetected").style.display="block"; var localBkuEl = document.getElementById("localBKU"); if (localBkuEl) localBkuEl.style.display="block"; /* if (checkMandateSSO()) return; */ setMandateSelection(); /* setSSOSelection(); */ var iFrameURL = "$contextPath$submitEndpoint" + "?"; iFrameURL += "&pendingid=" + "$pendingReqID"; iFrameURL += "&bkuURI=" + "$bkuOnline"; iFrameURL += "&useMandate=" + document.getElementById("useMandate").value; generateIFrame(iFrameURL); } function bkuHandyClicked() { var localBkuEl = document.getElementById("localBKU"); if (localBkuEl) localBkuEl.style.display="block"; /* if (checkMandateSSO()) return; */ setMandateSelection(); /* setSSOSelection(); */ var iFrameURL = "$contextPath$submitEndpoint" + "?"; iFrameURL += "&pendingid=" + "$pendingReqID"; iFrameURL += "&bkuURI=" + "$bkuHandy"; iFrameURL += "&useMandate=" + document.getElementById("useMandate").value; generateIFrame(iFrameURL); } function storkClicked() { var localBkuEl = document.getElementById("localBKU"); if (localBkuEl) localBkuEl.style.display="none"; /* if (checkMandateSSO()) return; */ setMandateSelection(); /* setSSOSelection(); */ var ccc = "AT"; var countrySelection = document.getElementById("cccSelection"); if (countrySelection != null) { ccc = document.getElementById("cccSelection").value; } var iFrameURL = "$contextPath$submitEndpoint" + "?"; iFrameURL += "&pendingid=" + "$pendingReqID"; #if($bkuOnline) iFrameURL += "&bkuURI=" + "$bkuOnline"; #end iFrameURL += "&useMandate=" + document.getElementById("useMandate").value; iFrameURL += "&CCC=" + ccc; generateIFrame(iFrameURL); } function generateIFrame(iFrameURL) { var el = document.getElementById("bkulogin"); var width = el.clientWidth; var heigth = el.clientHeight - 20; var parent = el.parentNode; iFrameURL += "&heigth=" + heigth; iFrameURL += "&width=" + width; var iframe = document.createElement("iframe"); iframe.setAttribute("src", iFrameURL); iframe.setAttribute("width", el.clientWidth - 1); iframe.setAttribute("height", el.clientHeight - 1); iframe.setAttribute("frameborder", "0"); iframe.setAttribute("scrolling", "no"); iframe.setAttribute("title", "Login"); parent.replaceChild(iframe, el); } function setMandateSelection() { document.getElementById("useMandate").value = "false"; var checkbox = document.getElementById("mandateCheckBox"); if (checkbox != null) { if (document.getElementById("mandateCheckBox").checked) { document.getElementById("useMandate").value = "true"; } } } function onChangeChecks() { if (self.innerWidth < 650) { document.getElementById("moaidform").setAttribute("target","_parent"); } else { document.getElementById("moaidform").removeAttribute("target"); } } function checkIfBrowserSupportsJava(){ console.log("Browser is Chrome: "+checkIfBrowserIsChrome()); console.log("Browser is Safari: "+checkIfBrowserIsSafari()); console.log("Browser is Edge: "+checkIfBrowserIsEdge()); console.log("Browser is Firefox(>51): " +checkIfBrowserIsFirefox()) var cnt = 0; if(checkIfBrowserIsChrome())cnt++; if(checkIfBrowserIsEdge())cnt++; if(checkIfBrowserIsSafari())cnt++; if(checkIfBrowserIsFirefox())cnt++; if(cnt==0 || cnt>1)//cnt>1 means perhaps wrong detection return true; var image = document.getElementById("bkuimage"); var srcatt = image.getAttribute("src"); var last = srcatt.substring(srcatt.lastIndexOf('/')+1); srcatt = srcatt.replace(last,'karte_deactivated.png'); image.setAttribute("src",srcatt); var button = document.getElementsByName("bkuButtonOnline")[0]; button.setAttribute("class","browserInfoButton"); button.setAttribute("title","Java wird nicht unterstützt, klicken für mehr Informationen."); button.setAttribute("onClick","alert('Java wird von Ihrem Browser nicht unterstützt, ist jedoch für den Betrieb der Online Bürgerkartenumgebung notwendig.\\nWollen Sie dennoch die Online Bürgerkartenumgebung verwenden, wird zur Zeit Java noch von MS Internet Explorer unterstützt. \\nAlternativ koennen Sie auch eine lokale Bürgerkartenumgebung verwenden, verfügbar unter www.buergerkarte.at.');"); return false; } function checkIfBrowserIsFirefox() { var firefoxMarkerPos = navigator.userAgent.toLowerCase().indexOf('firefox'); if (firefoxMarkerPos > -1) { if (navigator.userAgent.toLowerCase().length >= (firefoxMarkerPos + 'firefox/'.length)) { var ffversion = navigator.userAgent.toLowerCase().substring(firefoxMarkerPos + 8); if (ffversion > 51) { return true; } } else { console.log("Browser looks like Firefox but has suspect userAgent string: " + navigator.userAgent.toLowerCase()); } } return false; } function checkIfBrowserIsChrome(){ var chrome_defined = !!window.chrome;//chrome object defined var webstore_defined = false; if(window.chrome){ webstore_defined = !!window.chrome.webstore; } return chrome_defined && webstore_defined; } function checkIfBrowserIsEdge(){//edge also defines the chrome object, but not the webapp var chrome_defined = !!window.chrome;//chrome object defined var webstore_defined = true; if(window.chrome){ webstore_defined = !!window.chrome.webstore; } return chrome_defined && !webstore_defined; } function checkIfBrowserIsSafari(){ var cond1 = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0; return cond1; } function setBKUAvailable(available) { //login = document.getElementById("localBKU"); //active = (login.className.indexOf("lokalebkuaktiv") != -1); try { if (available) { console.log("Local BKU available") //login.className = login.className.replace("lokalebkuinaktiv", "lokalebkuaktiv"); var localBKUForm = document.getElementById("moaidform"); var button = localBKUForm.getElementsByTagName("input")[5]; button.removeAttribute("class");; button.setAttribute("title","Bürgerkarte mit lokaler Bürgerkartenumgebung."); var image = document.getElementById("bkuimage"); var srcatt = image.getAttribute("src"); var last = srcatt.substring(srcatt.lastIndexOf('/')+1); srcatt = srcatt.replace(last,'karte.png'); image.setAttribute("src",srcatt); } else if (!available) { //login.className = login.className.replace("lokalebkuaktiv", "lokalebkuinaktiv"); var localBKUForm = document.getElementById("moaidform"); var button = localBKUForm.getElementsByTagName("input")[5]; button.setAttribute("class","browserInfoButton"); button.setAttribute("title","Es wurde keine Bürgerkartenumgebung gefunden. Sollte es sich hierbei um einen Fehler handeln können Sie den Prozess durch einen Klick auf den Button dennoch fortsetzen."); var image = document.getElementById("bkuimage"); var srcatt = image.getAttribute("src"); var last = srcatt.substring(srcatt.lastIndexOf('/')+1); srcatt = srcatt.replace(last,'karte_deactivated.png'); image.setAttribute("src",srcatt); console.log("Local BKU NOT available") } } catch(e) {console.log("Local BKU detection is not possible! Msg: "+e);} } function setUseMandateFlag(e) { /*document.getElementById("mandateCheckBox").setAttribute("aria-checked", document.getElementById("mandateCheckBox").checked);*/ e.target.setAttribute("aria-checked", e.target.checked); if (e.target.checked) { var image = document.getElementById("eIDASImage"); var srcatt = image.getAttribute("src"); var last = srcatt.substring(srcatt.lastIndexOf('/')+1); srcatt = srcatt.replace(last,'eIDAS_small_deactivated.png'); image.setAttribute("src",srcatt); document.getElementById("buttonEULogin").disabled=true; } else { var image = document.getElementById("eIDASImage"); var srcatt = image.getAttribute("src"); var last = srcatt.substring(srcatt.lastIndexOf('/')+1); srcatt = srcatt.replace(last,'eIDAS_small.png'); image.setAttribute("src",srcatt); document.getElementById("buttonEULogin").disabled=false } } document.addEventListener('resize', onChangeChecks); document.addEventListener('DOMContentLoaded', function () { document.querySelector('#mandateCheckBox').addEventListener('click', setUseMandateFlag); document.querySelector('#moaidform>input[type=submit]').addEventListener('click', setMandateSelection); document.querySelector('#bkuhandy>input[type=button]').addEventListener('click', bkuHandyClicked); document.querySelector('#moaideIDASform>input[type=submit]').addEventListener('click', setMandateSelection); onChangeChecks(); }); /* function setSSOSelection() { document.getElementById("useSSO").value = "false"; var checkbox = document.getElementById("SSOCheckBox"); if (checkbox != null) { if (document.getElementById("SSOCheckBox").checked) { document.getElementById("useSSO").value = "true"; } } } */ /* function checkMandateSSO() { var sso = document.getElementById("SSOCheckBox"); var mandate = document.getElementById("mandateCheckBox"); if (sso.checked && mandate.checked) { alert("Anmeldung in Vertretung in kombination mit Single Sign-On wird aktuell noch nicht unterstützt!") mandate.checked = false; sso.checked = false; return true; } else { return false; } } */