示例#1
0
 function(data) {
   // Success!
   // console.log("Successfully fetched Asteroid data!" + data);
   var object = data;
   var nearEarthObjects = object.near_earth_objects;
   if(nearEarthObjects.length==0) {
     // console.log(" neo is undefined ");
     noAsteroidCard.show();
   } else {
     try {
       for(var i = 0; i < nearEarthObjects[todayDate].length; i++) {
         var obj = nearEarthObjects[todayDate][i];
         var lunarDistance = obj.close_approach_data[0].miss_distance.lunar;
         var kilometers = obj.close_approach_data[0].miss_distance.kilometers;
         var relativeVelocity = obj.close_approach_data[0].relative_velocity.kilometers_per_hour;
         var absoluteMag = obj.absolute_magnitude_h;
         asteroids.push({
           title: obj.name,
           subtitle: "Lunar Distance " + lunarDistance,
           relvel: formatNumber(parseInt(relativeVelocity.replace(',', ''))),
           lunarDistance: lunarDistance,
           absoluteMag: absoluteMag,
           kilometers: formatNumber(parseInt(kilometers.replace(',', ''))),
         });
       }
       asteroid_list.section(0).title ='AsteroidToday - ' + nearEarthObjects[todayDate].length;
       asteroid_list.show();
     } catch(err) {
       console.log('Caught error' + err);
       splashWindow.hide();
     }
   }
   splashWindow.hide();
 },
示例#2
0
文件: app.js 项目: ikinnear/pebblejs
main.on('click', 'select', function(e) {
  var wind = new UI.Window({
    backgroundColor: 'black'
  });
  var radial = new UI.Radial({
    position: new Vector2(2, 14),
    size: new Vector2(140, 140),
    angleStart: 0,
    angleEnd: 300,
    radius: 20,
    backgroundColor: 'cyan',
    borderColor: 'celeste',
    borderWidth: 1,
  });
  var textfield = new UI.Text({
    position: new Vector2(0, 57),
    size: new Vector2(144, 60),
    font: 'gothic-24-bold',
    text: 'Dynamic\nWindow',
    textAlign: 'center'
  });
  wind.add(radial);
  wind.add(textfield);
  wind.show();
});
示例#3
0
main.on('click', 'select', function(e) {
  var wind = new UI.Window({
    fullscreen: true,
  });
  var textfield1 = new UI.Text({
    position: new Vector2(0,40),
    size: new Vector2(144,20),
    font: 'gothic-28',
    text: 'christopher',
    textAlign: 'center'
  });
  var textfield2 = new UI.Text({
    position: new Vector2(0, 65),
    size: new Vector2(144, 30),
    font: 'bitham-42-bold',
    text: 'ROOS',
    textAlign: 'center'
  });
  
  var image = new UI.Image({
    position: new Vector2(0, 0),
    size: new Vector2(144, 168),
    image: 'images/pebble-bgnd1.png'
  });
  wind.add(image);
  wind.add(textfield1);
  wind.add(textfield2);
  wind.show();
});
示例#4
0
文件: app.js 项目: appleinventor/pcf1
main.on(clk, dn, function(e){
  vibe.vibrate('long');
  var vd = new UI.Window();
  var texts = new UI.Text({
    position : new Vector2(0, 50),
    size: new Vector2(144, 30),
    font: 'fonts/UbuntuMono-Regular.ttf',
    text: 'BUZZ lol',
    textAlign: cen
  });
  console.log('BUZZZZZZZZZZZZZZZZZZZ');
  vd.add(texts);
  vd.show();
  /*vd.on(clk, sel, function(e){
    var menu = new UI.Menu({
      sections: [{
      title: 'First section',
      items: [{
        title: 'First Item',
        subtitle: 'Some subtitle',
        icon: 'images/item_icon.png'
      },
        {
        title: 'Second item'
        }]
      }]
    });
  });*/
});
示例#5
0
LoadSplash.prototype.error = function() {
	splashWindow.add(load_error);
	splashWindow.add(load_error_desc);
	var randNum = randMinMaxInt(0, choosieSays.length - 1);
	load_error_comment.text('Choosie Says: \n"' + choosieSays[randNum] + '"');
	splashWindow.add(load_error_comment);
};
示例#6
0
function UpdateMain(message){
  main_window.each(function(element) {
    main_window.remove(element);
  });
  main_window.each(function(element) {
    main_window.remove(element);
  });

  main_window.backgroundColor('black');

  var txtStatus = new UI.Text({
    position: new Vector2(5, 62),
    size: new Vector2(144, 10),
    font: 'Gothic 28 Bold',
    text: message,
    textAlign: 'left',
    color: 'white'
  });
  
  main_window.add(txtHeaderLabel);
  main_window.add(txtOpenLabel);
  main_window.add(txtStatus);
  main_window.add(txtUpdateLabel);  
  main_window.add(txtCloseLabel);
  main_window.add(txtFooterLabel);
   
  
  main_window.show();
}
示例#7
0
main.on('select', function(sel) {
	//console.log(sel.item.title);
	if (pkmn[sel.itemIndex]) {
		var res = Feature.resolution();
		var pk = pkmn[sel.itemIndex];
		var map = getMap(pk.latitude, pk.longitude, pk.pokemonId, res.x, res.y);
		console.log(map);
		var wind = new UI.Window({
			backgroundColor: 'white',
			status: {
				backgroundColor: 'white',
				separator: Feature.round('none', 'dotted')
			}
		});
		var image = new UI.Image({
			position: new Vector2(0, 0),
			size: new Vector2(res.x, res.y),
			image: map
		});
		wind.add(image);
		wind.show();
        wind.on('click','back',function(e){
           wind.hide();
           wind = undefined;
        });
	}
});
示例#8
0
 scoresMenu.on('select', function(event) {
   console.log('user picked ' + event.itemIndex + ' and dmSection was ' + dmSection);
   
 
   var detailsWindows = new UI.Window();
   //teamDetails(detailsWindows, "San Jose Spiders", "W: 5 | L: 0 | PD: 25", "SJ");
   teamDetails(detailsWindows, nameHash[event.itemIndex], statsHash[event.itemIndex], icnHash[event.itemIndex]);
   detailsWindows.show();
 });
示例#9
0
 scheduleMenu.on('select', function(e) {
   // scheduled game details
   var picked = (e.itemIndex + 1);
   var gameDate = resultsObj[picked][0] + " " + resultsObj[picked][1] + resultsObj[picked][2] + " " + resultsObj[picked][3];
   var hometeam = resultsObj[picked][5];
   var awayteam = resultsObj[picked][6];
   
   var gameDetailsWindow = new UI.Window();
   //teamDetails(detailsWindows, "San Jose Spiders", "W: 5 | L: 0 | PD: 25", "SJ");
   gameDetails(gameDetailsWindow, gameDate, hometeam, awayteam);
   gameDetailsWindow.show();
 });
示例#10
0
main.on('click', 'select', function(e) {
  var wind = new UI.Window();
  var textfield = new UI.Text({
    position: new Vector2(0, 50),
    size: new Vector2(144, 30),
    font: 'gothic-24-bold',
    text: 'Text Anywhere!',
    textAlign: 'center'
  });
  wind.add(textfield);
  wind.show();
});
示例#11
0
var checkForBoc = function(date) {
  // capture boolean indication if the image graphic has been added to the window
  var isBocShowing = window.index(bocImg) > -1;
  
  if (date.getHours() === END_HOUR && !isBocShowing) {
    window.add(bocRect);
    window.add(bocImg);
    Vibe.vibrate('short');
  } else if (date.getHours() > END_HOUR && isBocShowing) {
    window.remove(bocRect);      
    window.remove(bocImg);
  }
};
示例#12
0
card.on('click', 'down', function(e) {
  card.hide();
  var textfield = new UI.Text({
    position: new Vector2(0, 0),
    size: new Vector2(144, 30),
    font: 'gothic-24-bold',
    text: 'Wolf Weather',
    textAlign: 'center',
    color: 'white'
  });
  wind.add(textfield);
  
  wind.show();
});
示例#13
0
main.on('click', 'select', function(e) {
  var wind = new UI.Window({
    fullscreen: true,
  });
  var textfield = new UI.Text({
    position: new Vector2(0, 65),
    size: new Vector2(144, 30),
    font: 'gothic-24-bold',
    text: 'Michelle Smells!',
    textAlign: 'center'
  });
  wind.add(textfield);
  wind.show();
});
示例#14
0
  wind.on('click', 'down', function(e) {
  var windEnd = new UI.Window({
    fullscreen: true,
    });

  var image = new UI.Image({
  position: new Vector2(0, 0),
  size: new Vector2(144, 168),
  image: 'images/om-symbol.png'
  });
  turnOff();
  windEnd.add(image);
  windEnd.show();  
});
示例#15
0
function initErrorScreen(){
  screen_error = new UI.Window();
  var text_error = new UI.Text({
    position: new Vector2(0, 0),
    size: new Vector2(144, 168),
    text: getMessage(messages.error_screen),
    font: 'GOTHIC_28_BOLD',
    color: 'black',
    textOverflow: 'wrap',
    textAlign: 'center',
    backgroundColor: 'white'
  });
  screen_error.add(text_error);
}
示例#16
0
Detail.add = function(title_text, text, title_size) {
  if (platform.version() === 'chalk') {
    var card = new UI.Card({
      title: title_text,
      body: text,
      scrollable: true
    });
    return card;
  } else if (platform.version() === 'aplite' || platform.version() === 'basalt') {
    var page = new UI.Window({ fullscreen: false, scrollable: true });
    // Create a background Rect
    var bgRect = new UI.Rect({
      position: new Vector2(0, 0),
      size: new Vector2(144, 230),
      backgroundColor: 'white'
    });
    page.add(bgRect);
    var image = new UI.Image({
      position: new Vector2(10, 10),
      size: new Vector2(15, 15),
      image: 'images/menu_icon.png'
    });
    page.add(image);
    var title = new UI.Text({
     position: new Vector2(35, 5),
     size: new Vector2(109, 12),
     font: 'gothic-18-bold',
     text: title_text,
     textOverflow:'wrap',
     color: 'black'
    });
    if (title_size === "title_size_big") {
      title.font('gothic-24-bold');
      title.position(new Vector2(35, 2));
    }
    page.add(title);
    var textfield = new UI.Text({
     position: new Vector2(3, 30),
     size: new Vector2(136, 200),
     font: 'gothic-18-bold',
     text: text,
     textOverflow:'wrap',
     color: 'black',
     textAlign: 'left'
    });
    page.add(textfield);
    return page;
  }
}
示例#17
0
文件: app.js 项目: henryhwilson/Swipr
  function(data) {
    // Success!
    console.log("Success");
    console.log(data); // ["$134","1"];
    dba = data.split(',')[0];
    swipes = data.split(',')[1];
    
    var dbaText = "Invalid login";

    if (data.charAt(0) == "$") {
      dbaText = "DBA: " + dba + "\nSwipes: " + swipes;
    }
    var main = new UI.Window();
    

var dba_swipe_text = new UI.Text({
  position: new Vector2(0,0),
  size: new Vector2(144,74),
  borderColor: 'white',
  backgroudColor: 'black',
  text: dbaText,
  textOverflow: 'ellipsis',
  textAlign: 'center',
  font: 'gothic-28',
  color: 'white'
}); 

var swipe_period_text = new UI.Text({
  position: new Vector2(0,74),
  size: new Vector2(144,78),
  borderColor: 'white',
  backgroudColor: 'black',
  text: swipe,
  textOverflow: 'fill',
  textAlign: 'center',
  font: 'gothic-28',
  color: 'white'
});

main.add(dba_swipe_text);
main.add(swipe_period_text);
    
main.on('click', 'select', function(e) {
  menu.show();
});
    main.show();
    loading.hide();
  },
示例#18
0
 show: function(error_message) {
   var errorWindow = new UI.Window();
   // Text element to inform user
   var errorText = new UI.Text({
     position: new Vector2(0, 0),
     size: new Vector2(144, 168),
     text:error_message,
     font:'GOTHIC_14_BOLD',
     color:'black',
     textOverflow:'wrap',
     textAlign:'center',
     backgroundColor:'white'
   });
   errorWindow.add(errorText);
   errorWindow.show();
 }
示例#19
0
文件: app.js 项目: adaniliuk/tiketti
function showMenu() {
  var mainMenu = new UI.Menu({
     sections: [{
       items: [{
         title: 'Search Events'
       }, {
         title: 'Favorites'
       }]
     }],
     backgroundColor: styles.bgColor,
     textColor: styles.textColor,
     highlightBackgroundColor: styles.highlightBgColor,
     highlightTextColor: styles.highlightTextColor
  });
  
  mainMenu.on('select', function(e) {
    console.log('mainMenu selected item: ' + e.itemIndex);
    
    switch (e.itemIndex) {
      case 0:
        showClassifications();
        break;
      case 1:
        showFavorites();
        break;
    }
  });
  
  mainMenu.show();
  splashScreen.hide();
}
示例#20
0
 wind.on('click', 'select', function(e) {
   if (selectClick === 0) {
     selectClick = 1;
   } else if (selectClick === 2) {
     // Reset menu and set * on the selected method
     wind.hide();
     routesMenu.show();
     selectClick = 0;
   } else if (selectClick === 1) {
     selectClick = 2;
     // transitModeMenu = transitModeMenuReset;
     var items='';
   for ( items in evt.menu.items(evt.section) )
       if(evt.menu.item(evt.section, evt.item).title.slice(0,1) === "*") {
         console.log(evt.menu.item(evt.section, evt.item).title);
         evt.menu.item(evt.section, evt.item).title=
           evt.menu.item(evt.section, evt.item).title.slice(
             0,evt.menu.item(evt.section, evt.item).title.length);
       }
     
     modeSelected = evt.menu.item(evt.section, evt.item).title;
 //    modeSelectedId = evt.item;
     console.log(modeSelected);
     evt.menu.item(evt.section, evt.item, {title: "* "+modeSelected, 
                                           subtitle: h+" : "+m, 
                                           icon: evt.menu.item(evt.section, evt.item).icon});
     // transitModeMenu.item(e.section, e.item).title("*"+transitModeMenu.item(e.section, e.item).title);
     // selectClick = 2;
   }            
 });
示例#21
0
文件: app.js 项目: re4jh/fhem4pebble
  function(data, status, request) {
    splashWindow.hide();
    menu.show();
    //console.log('Alias: ' + data.Results[2].devices[15].ATTR.alias);
    var aDevices = data.Results[2].devices;
    var myMenuPos = 0;
    for(var i = 0; i < aDevices.length; i++) {
      if(aDevices[i].ATTR.subType === 'switch')
        {
          var myAlias = aDevices[i].ATTR.alias;
          var myShorterAlias = myAlias.replace('Schalter: ', '');
          var myNextState = 'on';
          if (aDevices[i].STATE==='on') myNextState = 'off';
          menu.item(0, myMenuPos, {
            title: myShorterAlias,
            subtitle: 'State:' +  aDevices[i].STATE,
            state_next: myNextState,
            state_current: aDevices[i].STATE,
            switch_name:  aDevices[i].NAME,
            switch_url: scheme + '://' + user + ':' + passwd  + '@' + host  + ':' + port  + '/fhem?XHR=1&cmd.' + aDevices[i].NAME + '=set%20' + aDevices[i].NAME + '%20' + myNextState
          });
          console.log('Switch found:' + aDevices[i].ATTR.alias);
          myMenuPos++;
        }
    }    
    
},
示例#22
0
 function(data) {
   var placeList = new UI.Menu({
     
     // Show top 5 places
     sections: [{
       items: [{
         title: data.response.venues[0].name,
         subtitle: data.response.venues[0].location.distance+' meters away.'
       }, {
         title: data.response.venues[1].name,
         subtitle: data.response.venues[1].location.distance+' meters away.'
       },{
         title: data.response.venues[2].name,
         subtitle: data.response.venues[2].location.distance+' meters away.'
       },{
         title: data.response.venues[3].name,
         subtitle: data.response.venues[3].location.distance+' meters away.'
       },{
         title: data.response.venues[4].name,
         subtitle: data.response.venues[4].location.distance+' meters away.'
       },{
         title: data.response.venues[5].name,
         subtitle: data.response.venues[5].location.distance+' meters away.'
       }]
     }]
     
   });
   
   // Change view
   loading.show();   
   placeList.show();
 },
示例#23
0
wind.on('click', 'select', function(e) {
  console.log("click select");
    
  wind.hide();
  card.show();

});
示例#24
0
    wind.on('click', 'back', function () {
        wind.hide();

        if (options.onCancel) {
            options.onCancel();
        }
    });
示例#25
0
function  TestConfig() {
  options = Settings.option();
  if (!options.code) {
    main.hide();
    conf = new UI.Card({
      title: "Freebox Télec",
      body: "Merci de compléter la config"
    });
    conf.show();
  } else {
    main.show();
    if (conf) {
      conf.hide();
    }
  }
}
示例#26
0
    function(data) {

      // If we're successful!
      console.log("Successfully fetched Solar info!");
      console.log("Last Updated: " + data.overview.lastUpdateTime);

      // Extract data from web, rounds the values, then makes it the correct units---
      var currentpower = data.overview.currentPower.power; //W
      var todayenergy = data.overview.lastDayData.energy; //Wh
      var monthenergy = data.overview.lastMonthData.energy; //Wh
      var yearenergy = data.overview.lastYearData.energy; //Wh
      var lifetimeenergy = data.overview.lifeTimeData.energy; //Wh
      var lifetimerevenue = data.overview.lifeTimeData.revenue; //$

      // Last Updated----------------------------------------------------------------
      var lastupdated = data.overview.lastUpdateTime;

      // Creates menu items based on the above data from the web---------------------
      var menuItems = [
        {
          title: "Current Power",
          subtitle: numberFormat(currentpower, 'W')
        },
        {
          title: "Today\'s Energy",
          subtitle: numberFormat(todayenergy, 'Wh')
        },
        {
          title: "Month\'s Energy",
          subtitle: numberFormat(monthenergy, 'Wh')
        },
        {
          title: "YTD Energy",
          subtitle: numberFormat(yearenergy, 'Wh')
        },
        {
          title: "Lifetime Energy",
          subtitle: numberFormat(lifetimeenergy, 'Wh')
        },
        {
          title: "Lifetime Revenue",
          subtitle: "$ " + lifetimerevenue.toFixed(2)
        },
        {
          title: "Last Updated",
          subtitle: (lastupdated)
        }
      ];

      // Creates info to show user
      var resultsMenu = new UI.Menu({
        sections: [{
          items: menuItems
        }]
      });

      resultsMenu.show(); //shows the menu items
      Intro.hide();
    },
示例#27
0
var clockThread = function(){
    var now = new Date();
    var min = now.getMinutes() ;
    if( currentMin !== min ){
      if( null !== currentCupolan ){
        wind.remove(currentCupolan);
      }
      if( null !== timeText ){
        wind.remove(timeText);
      }
      currentCupolan = cupolan[min % 10];
  
      wind.add(currentCupolan);
      wind.add(timeText);
      currentMin = min;
    }
};
示例#28
0
		Topic: function(topic){
			var win = new UI.Window({
					scrollable: true,
					backgroundColor: 'dukeBlue'
				});
			win.add(
				new UI.Text({
					position: new Vector2(0,0),
					size: new Vector2(144,168),
					text: topic.subject,
					color: 'white',
					textOverflow: 'wrap',
					textAlign: 'center'
				})
			);
			return win;
		},
示例#29
0
 buildCard: function(text) {
   var splashWindow = new UI.Window();
   
   var uiText = new UI.Text({
     position: new Vector2(0, 46),
     size: new Vector2(144, 15),
     text: text,
     font: "GOTHIC_28_BOLD",
     color: "springBud",
     textOverflow: "wrap",
     textAlign: "center",
     backgroundColor: "black"
   });
   
   splashWindow.add(uiText);
   return splashWindow;
 },
var showFarewellScreen = function() {
    Vibe.vibrate('long');

    var window = new UI.Window({
        fullscreen: true
    });

    var image = new UI.Image({
        position: new Vector2(10, 10),
        image: 'images/rest.png'
    });

    window.add(image);

    var text = new UI.Text({
        position: new Vector2(65, 10),
        size: new Vector2(144, 30),
        font: 'gothic-24-bold',
        text: 'See you next time!',
        textAlign: 'center'
    });

    window.add(text);

    window.show();

    window.on('click', 'up', this.application.exit);
    window.on('click', 'select', this.application.exit);
    window.on('click', 'down', this.application.exit);
};