VulpesOS/gaia/apps/ftu/js/time.js
OverSu b38dea0597 Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
2026-09-30 23:13:03 +02:00

35 lines
901 B
JavaScript
Executable file

/* exported TimeManager */
'use strict';
var TimeManager = {
elementIDs: [
'tz-region',
'tz-city',
'date-configuration',
'time-configuration'
],
init: function tm_init() {
if (window.navigator.mozTime) {
this.time = window.navigator.mozTime;
} else {
console.log('There is no mozTime available in window');
}
this.elementIDs.forEach(function(elementID) {
document.getElementById(elementID + '-button').addEventListener('click',
function(evt) {
evt.preventDefault();
var input = document.getElementById(elementID);
// Inspired by app/clock/js/form_button.js
// It seems like setting focus instantly does not trigger the input/
// select dialog.
setTimeout(input.focus.bind(input), 10);
});
});
},
set: function tm_set(date) {
this.time.set(date);
}
};