var NexusUtil = {
_isInit: false,
_isActiveX: false,
_isExist: false,
_isExist410: false,
_exist: function() {
try {
var myObj1 = new ActiveXObject("Nexus.VersionCtl");
var myObj2 = new ActiveXObject("Nexus.AuthenticationCtl");
var myObj3 = new ActiveXObject("Nexus.SignerV2Ctl");
if (myObj1){
NexusUtil._isExist = true;
}
if (NexusUtil._isExist && myObj2 && myObj3){
NexusUtil._isExist410 = true;
}
NexusUtil._isActiveX = true;
} catch(e) {
NexusUtil._isExist = false;
NexusUtil._isExist410 = false;
NexusUtil._isExist =
navigator.plugins &&
navigator.plugins.length > 0 &&
navigator.mimeTypes &&
navigator.mimeTypes["application/x-personal-version"] &&
navigator.mimeTypes["application/x-personal-version"].enabledPlugin;
NexusUtil._isExist410 =
NexusUtil._isExist &&
navigator.mimeTypes["application/x-personal-authentication"] &&
navigator.mimeTypes["application/x-personal-authentication"].enabledPlugin &&
navigator.mimeTypes["application/x-personal-signer2"] &&
navigator.mimeTypes["application/x-personal-signer2"].enabledPlugin;
}
},
_init: function() {
if(NexusUtil._isInit) {
return;
}
NexusUtil._exist();
if(NexusUtil._isExist) {
var html = '';
if(NexusUtil._isActiveX) {
html += "";
if(NexusUtil._isExist410) {
html += "";
html += "";
}
} else {
html += "";
if(NexusUtil._isExist410) {
html += "";
html += "";
}
}
document.getElementById('NexusPluginHolder').innerHTML = html;
}
NexusUtil._isInit = true;
},
getVersionInfo: function(){
NexusUtil._init();
if(NexusUtil._isExist){
return document.getElementById('NexusPluginVersion').GetVersion();
}
return undefined;
},
getVersion: function() {
NexusUtil._init();
if(NexusUtil._isExist) {
try {
var ver = this.getVersionInfo();
ver = ver.toLowerCase();
var start = ver.indexOf('personal=');
if(start != -1) {
start += 9;
var end = ver.indexOf('&', start);
if(end == -1) {
end = ver.length;
}
return ver.substring(start, end);
}
} catch(e) {
return 'UNK';
}
} else {
return 'UNK';
}
},
allowedCardreaderExist: function(){
NexusUtil._init();
if(NexusUtil._isExist){
var ver = document.getElementById('NexusPluginVersion').GetVersion();
if( (ver.search(/Handelsbanken card reader/i) >= 0) ||
(ver.search(/Handelsbanken Talk/i) >= 0) ||
(ver.search(/Nordea NCR/i) >= 0) ||
(ver.search(/VASCO DIGIPASS 920/i) >= 0) ){
return true;
}
}
return false;
},
getBestBefore: function(){
NexusUtil._init();
if(NexusUtil._isExist){
var verInfo = NexusUtil.getVersionInfo();
var wIndex = verInfo.indexOf( "best_before=" );
return verInfo.substring( wIndex ).split( "=" )[1].split("&")[0];
}
return undefined;
}
};