26 lines
1 KiB
JavaScript
26 lines
1 KiB
JavaScript
var moment = Script.require('https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/moment.min.js');
|
|
Script.include.call({ moment: moment }, 'https://momentjs.com/downloads/moment-timezone-with-data-2012-2022.min.js');
|
|
|
|
var URL = 'http://hifi-content.s3.amazonaws.com/caitlyn/scratch/wowslider-win-setup/test/wowslider.html';
|
|
var CONFIG = {
|
|
icon: Script.resolvePath('app.svg'),
|
|
text: 'EVENTS',
|
|
};
|
|
|
|
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"),
|
|
button = tablet.addButton(CONFIG);
|
|
|
|
button.clicked.connect(function() { tablet.gotoWebScreen(URL); });
|
|
Script.scriptEnding.connect(function() { tablet.removeButton(button); });
|
|
|
|
Script.setInterval(function updateTime() {
|
|
var FMT = 'hh:mm A',
|
|
pacific = moment().tz('America/Los_Angeles').format(FMT),
|
|
local = moment().format(FMT);
|
|
|
|
var time = (pacific === local) ? local : ['('+pacific+')', local].join('\n');
|
|
if (time !== updateTime.time) {
|
|
updateTime.time = time;
|
|
button.editProperties({ text: time });
|
|
}
|
|
}, 1000);
|