js/main.js
// Function to update the the weather
Function to update the the weather
Function to update the the weather
function update(response) {
    var temp = response.main.temp;
    var high = Math.round((response.main.temp_max * 1.8) + 32);
    var low = Math.round((response.main.temp_min * 1.8) + 32);
    currTemp = Math.round((temp * 1.8) + 32);
    $('#weather-vid').attr('src', function() {
      switch (response.weather[0].main) {
        case 'Snow':
          return 'http://jonmaldia.com/tencadenceweather/img/snowy.mp4';
          break;
        case 'Mist':
          return 'http://jonmaldia.com/tencadenceweather/img/misty.mp4';
          break;
        case 'Drizzle':
          return 'http://jonmaldia.com/tencadenceweather/img/misty.mp4';
          break;
        case 'Clouds':
          return 'http://jonmaldia.com/tencadenceweather/img/cloudy.mp4';
          break;
        case 'Rain':
          return 'http://jonmaldia.com/tencadenceweather/img/rainy.mp4';
          break;
        default:
          return 'http://jonmaldia.com/tencadenceweather/img/sunny.mp4';
      }
    });   
    $("#bg-vid")[0].load();
    $('#location').html('<h2>' + response.name + '</h2>');
    $('#conditions').html('<h4>' + response.weather[0].main + '</h4>');
    $('#weather').html('<h1 id="temperature">' + currTemp + '&deg;</h1>');
    $('#details').html('<p>H: ' + high + '&deg; | L: ' + low + '&deg;</p>');
  }
function update ( response ) { var temp = response . main . temp ; var high = Math . round ( ( response . main . temp_max * 1.8 ) + 32 ) ; var low = Math . round ( ( response . main . temp_min * 1.8 ) + 32 ) ; currTemp = Math . round ( ( temp * 1.8 ) + 32 ) ; $ ( '#weather-vid' ) . attr ( 'src' , function ( ) { switch ( response . weather [ 0 ] . main ) { case 'Snow' : return 'http://jonmaldia.com/tencadenceweather/img/snowy.mp4' ; break ; case 'Mist' : return 'http://jonmaldia.com/tencadenceweather/img/misty.mp4' ; break ; case 'Drizzle' : return 'http://jonmaldia.com/tencadenceweather/img/misty.mp4' ; break ; case 'Clouds' : return 'http://jonmaldia.com/tencadenceweather/img/cloudy.mp4' ; break ; case 'Rain' : return 'http://jonmaldia.com/tencadenceweather/img/rainy.mp4' ; break ; default : return 'http://jonmaldia.com/tencadenceweather/img/sunny.mp4' ; } } ) ; $ ( "#bg-vid" ) [ 0 ] . load ( ) ; $ ( '#location' ) . html ( '<h2>' + response . name + '</h2>' ) ; $ ( '#conditions' ) . html ( '<h4>' + response . weather [ 0 ] . main + '</h4>' ) ; $ ( '#weather' ) . html ( '<h1 id="temperature">' + currTemp + '&deg;</h1>' ) ; $ ( '#details' ) . html ( '<p>H: ' + high + '&deg; | L: ' + low + '&deg;</p>' ) ; }
Function to update the the weather
Function to update the the weather
// Update the background video based on the current conditions  // Loads the video  // Updates the page temperature