47 lines
1.4 KiB
JavaScript
47 lines
1.4 KiB
JavaScript
//
|
|
// trivia.js
|
|
//
|
|
// Created by Rebecca Stankus on 06/11/18
|
|
// Copyright 2018 High Fidelity, Inc.
|
|
//
|
|
// Distributed under the Apache License, Version 2.0.
|
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
|
|
|
(function() {
|
|
var TABLET_BUTTON_IMAGE = Script.resolvePath('icons/signup-i.png?124');
|
|
var TABLET_BUTTON_PRESSED = Script.resolvePath('icons/signup-a.png?124');
|
|
|
|
var tablet = Tablet.getTablet('com.highfidelity.interface.tablet.system');
|
|
var appPage = "https://mixer.com/bighungry2x";
|
|
var button = tablet.addButton({
|
|
text: 'bighungry2x',
|
|
icon: TABLET_BUTTON_IMAGE,
|
|
activeIcon: TABLET_BUTTON_PRESSED
|
|
});
|
|
var open = false;
|
|
|
|
|
|
function onClicked() {
|
|
if (open) {
|
|
tablet.gotoHomeScreen();
|
|
} else {
|
|
tablet.gotoWebScreen(appPage);
|
|
}
|
|
}
|
|
|
|
function onScreenChanged(type, url) {
|
|
open = (url === appPage);
|
|
button.editProperties({isActive: open});
|
|
}
|
|
|
|
function appEnding() {
|
|
button.clicked.disconnect(onClicked);
|
|
tablet.removeButton(button);
|
|
tablet.screenChanged.disconnect(onScreenChanged);
|
|
}
|
|
|
|
button.clicked.connect(onClicked);
|
|
tablet.screenChanged.connect(onScreenChanged);
|
|
|
|
Script.scriptEnding.connect(appEnding);
|
|
}());
|