Hopefully fix battery status detection
This commit is contained in:
parent
362d3ce0ca
commit
3238d1aa35
@ -173,28 +173,6 @@ function initCordova() {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
window.addEventListener("batterylow", function (status) {
|
|
||||||
auto_disable_animations = true;
|
|
||||||
if (getStorage("animation") == "auto") {
|
|
||||||
toggleAnimations(false);
|
|
||||||
}
|
|
||||||
batterylevel = status.level;
|
|
||||||
}, false);
|
|
||||||
|
|
||||||
window.addEventListener("batterystatus", function (status) {
|
|
||||||
if (status.isPlugged && getStorage("animation") == "auto") {
|
|
||||||
// Plugged in, enable animations
|
|
||||||
auto_disable_animations = false;
|
|
||||||
toggleAnimations(true);
|
|
||||||
}
|
|
||||||
if (typeof batterylevel !== 'undefined' && status.level > batterylevel && getStorage("animation") == "auto") {
|
|
||||||
// The battery level has gone up from when it was low, so we're probably not low anymore
|
|
||||||
auto_disable_animations = false;
|
|
||||||
toggleAnimations(true);
|
|
||||||
}
|
|
||||||
}, false);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
setupHTML5BarcodeScanner();
|
setupHTML5BarcodeScanner();
|
||||||
}
|
}
|
||||||
@ -204,6 +182,19 @@ function initCordova() {
|
|||||||
window.open($(this).attr("href"), "_system");
|
window.open($(this).attr("href"), "_system");
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
window.addEventListener("batterystatus", function (status) {
|
||||||
|
if (getStorage("animation") == "auto") {
|
||||||
|
if (status.isPlugged || status.level > 20) {
|
||||||
|
// Plugged in or above 20%, enable animations
|
||||||
|
auto_disable_animations = false;
|
||||||
|
toggleAnimations(true);
|
||||||
|
} else {
|
||||||
|
auto_disable_animations = false;
|
||||||
|
toggleAnimations(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
function initNW() {
|
function initNW() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user