Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Welcome to Pebble.js!
- *
- * This is where you write your app.
- */
- var UI = require('ui');
- var Vector2 = require('vector2');
- var ajax = require('ajax');
- populateTimes("park");
- var main = new UI.Menu({
- sections: [{
- items: [{
- title: 'Universal Studios',
- subtitle: '7AM-8:30PM'
- }, {
- title: 'Islands of Adventure',
- subtitle: '7AM-9PM'
- }]
- }]
- });
- main.show();
- main.on('select', function(e) {
- if (e.itemIndex === 0)
- {
- USOMenu.items(0, [{title: 'Universal Studios', subtitle: "bitch"}]);
- USOMenu.show();
- }
- else if (e.itemIndex === 1)
- {
- IOAMenu.show();
- }
- console.log('Selected item #' + e.itemIndex + ' of section #' + e.sectionIndex);
- console.log('The item is titled "' + e.item.title + '"');
- });
- var IOAMenu = new UI.Menu({
- sections: [{
- items: [{
- title: 'IOA Ride 1',
- subtitle: '3 minutes'
- }, {
- title: 'IOA Ride 2',
- subtitle: '6 minutes'
- }, {
- title: 'IOA Ride 3',
- subtitle: '1 minute'
- }]
- }]
- });
- var USOMenu = new UI.Menu({
- sections: [{
- items: [{
- title: 'USO Ride 1',
- subtitle: '3 minutes'
- }, {
- title: 'USO Ride 2',
- subtitle: '6 minutes'
- }, {
- title: 'USO Ride 3',
- subtitle: '1 minute'
- }]
- }]
- });
- function ajaxCall() {
- ajax({ url: 'https://site.com/universal/rides.php', type: 'json' },
- function(data) {
- return data;
- }
- );
- }
- function populateTimes(parkOrRides) {
- var parkJSON = ajaxCall();
- if (parkOrRides == "park")
- {
- // Make menu items for park hours
- //USOMenu.items(0, [{title: 'Universal Studios', subtitle: parkJSON.USO}]);
- //main.items(1, [{title: 'Islands Of Adventure', subtitle: '2:00AM-6:00PM'}]);
- }
- else if (parkOrRides == "USO")
- {
- // Make menu items for USO wait times
- }
- else if (parkOrRides == "IOA")
- {
- // Make menu items for IOA wait times
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement