// ACHTUNG:
// Diese Funktion ist in dieser Datei, da es die einzige ist, die in allen
// Tabellen aufgerufen wird.
function removeAllHviapLinks() {
var links = document.querySelectorAll('[href^=hviap]');
links.forEach(function(link) {
link.href = link.href.replace(/hviap(.*)\:\/\/showpopuphtml\?url=/, '');
link.target = "new";
link.rel = "noopener noreferrer";
});
};
if (location.href.indexOf('heise.de/select') !== -1) {
removeAllHviapLinks();
};
var BridgeCommunication = new Class({
startSetup: function(options) {
this.options = options;
$(document).ready(function() {
if (this.options) {
this.setMandator(this.options.mandant, this.options.appVersion);
this.setFontSize(this.options.fontSize);
this.setOrientation(this.options.orientation);
}
this.finishedLoad('startSetup');
}.bind(this));
$(window).load(function() {
if (window.AndroidBridge) {
AndroidBridge.finishedLoad();
}
}.bind(this));
},
setMandator: function(mandator, version) {
$('body').addClass(mandator);
hviapCheck(mandator);
},
hasPageControls: function() {
if (window.AndroidBridge) {
AndroidBridge.hasPageControls(true);
}
return true;
},
setOrientation: function(orientation) {
$('body').data('device-orientation', orientation);
this.heightChanged('setOrientation');
setTimeout(function() {
$('.iosSlider').iosSlider('update');
this.heightChanged('setOrientation');
}.bind(this), 500);
},
setFontSize: function(fontSize) {
fontSize = parseFloat(fontSize);
if (fontSize) {
$('body')
.removeClass('fontSize12 fontSize14 fontSize16 fontSize20 fontSize24')
.addClass('fontSize' + fontSize);
}
this.heightChanged('setFontSize');
},
finishedLoad: function(calledFrom) {
if (this.options && this.options.platform === 'iOS') {
this.heightChanged(calledFrom);
}
},
heightChanged: function(calledFrom) {
if (this.options && this.options.platform === 'iOS') {
setTimeout(function() {
window.location = 'hviap-' + this.options.mandant + '://heightChanged?height=' + $(document.body).height() + '&calledFrom=' + calledFrom + '0.5sTimeout';
}, 500);
setTimeout(function() {
window.location = 'hviap-' + this.options.mandant + '://heightChanged?height=' + $(document.body).height() + '&calledFrom=' + calledFrom + '1.3sTimeout';
}, 1300);
} else if (window.AndroidBridge) {
setTimeout(function() {
AndroidBridge.heightChanged($(document.body).height());
}, 1300);
setTimeout(function() {
AndroidBridge.heightChanged($(document.body).height());
}, 2500);
/*setTimeout(function(){
AndroidBridge.heightChanged($(document.body).height());
}, 4000);*/
}
},
shareCode: function(code) {
this.lastCode = code;
if (window.AndroidBridge) {
AndroidBridge.shareCode(code);
} else if (this.options && this.options.platform === 'iOS') {
window.location = 'hviap-' + this.options.mandant + '://shareCode?callBackFunction=Bridge.lastSharedCode';
} else {
alert(code);
}
},
lastSharedCode: function() {
return this.lastCode;
},
goToPage: function(direction) {
if (window.AndroidBridge) {
AndroidBridge.goToPage(direction);
} else if (this.options && this.options.platform === 'iOS') {
window.location = 'hviap-' + this.options.mandant + '://goToPage?direction=' + direction;
}
},
scrollToID: function(divid) {
if (divid) {
scrollToIdElm(divid);
}
}
});