// // 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://www.eventbrite.com/e/high-fidelity-load-test-saturday-oct-6-1100am-pdt-tickets-50014437529?aff=erelexpmlt"; var button = tablet.addButton({ text: 'SIGNUP', 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); }());