wallet-core/articles/ui/figs/taler-presence.js

36 lines
1.1 KiB
JavaScript
Raw Normal View History

2016-03-21 16:41:40 +01:00
function handleInstall() {
var show = document.getElementsByClassName("taler-installed-show");
var hide = document.getElementsByClassName("taler-installed-hide");
for (var i = 0; i < show.length; i++) {
show[i].style.display = "";
}
for (var i = 0; i < hide.length; i++) {
hide[i].style.display = "none";
}
};
function handleUninstall() {
var show = document.getElementsByClassName("taler-installed-show");
var hide = document.getElementsByClassName("taler-installed-hide");
for (var i = 0; i < show.length; i++) {
show[i].style.display = "none";
}
for (var i = 0; i < hide.length; i++) {
hide[i].style.display = "";
}
};
function probeTaler() {
var eve = new Event("taler-probe");
document.dispatchEvent(eve);
};
function initTaler() {
handleUninstall(); probeTaler();
};
document.addEventListener("taler-wallet-present", handleInstall, false);
document.addEventListener("taler-unload", handleUninstall, false);
document.addEventListener("taler-load", handleInstall, false);
window.addEventListener("load", initTaler, false);