Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. //CHECK IF GEOLOCATION IS AVAILABLE
  2. if ("geolocation" in navigator) {
  3. $('#locate').show();
  4. } else {
  5. $('#locate').hide();
  6. }
  7.  
  8. //LOCATION UPDATE
  9. $('#locate').on('click', function() {
  10. navigator.geolocation.getCurrentPosition(function(position) {
  11. loadWeather(position.coords.latitude+','+position.coords.longitude);
  12. });
  13. });
  14.  
  15.  
  16. $(document).ready(function() {
  17. loadWeather(); <------ For some fucked-up Reason this doesn't work.
  18. setInterval(loadWeather, 60000); //Update the weather every 5 minutes.
  19. });
  20.  
  21. function loadWeather(location, woeid) {
  22. $.simpleWeather({
  23. location: location,
  24. woeid: woeid,
  25. unit: 'c',
  26. success: function(weather){
  27.  
  28. console.log(weather.title);
  29.  
  30. var iconHolder = $('#icon')[0];
  31. //COLOURS
  32. var orange = "#F2B441";
  33. var lightBlue = "#A0CCFF";
  34. var darkBlue = "#23568F";
  35.  
  36. var icon = document.getElementById("icon");
  37. var adj = document.getElementById("adj");
  38. var bg = document.body;
  39.  
  40. /*======================================================== ETC ==========================================*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement