old-silvrgit/app/app.min.js

3 lines
3.9 KiB
JavaScript
Raw Normal View History

2015-08-04 16:09:42 +00:00
!function(){var e,o=0,t=0,n=3.49524333,a={gbp:0,usd:0},s={gbp:0,usd:0},r=function(e,o){return new Date(e.getTime()+24*o*60*60*1e3)},c=function(e,o){var t,n,a;return n=e.getTime(),a=o.getTime(),t=(a-n)/864e5},l=function(){var e=new Date,o=new Date,t=new Date,n=new Date,a=new Date;o.setFullYear(2013,9,24),t=r(o,1001),n.setFullYear(2015,4,10),a.setFullYear(2013,7,25),$("#one").text("101B ends: "+Math.ceil(c(e,t))+" days / "+Math.ceil(c(e,t)/7)+" weeks"),$("#two").text("Ends: "+Math.ceil(c(e,n))+" days / "+Math.ceil(c(e,n)/7)+" weeks"),$("#three").hide()},i=function(){navigator.geolocation.getCurrentPosition(p)},p=function(e){var o=e.coords.latitude,t=e.coords.longitude;$.ajax({type:"GET",url:"https://api.forecast.io/forecast/0657dc0d81c037cbc89ca88e383b6bbf/"+o.toString()+","+t.toString(),data:"",dataType:"jsonp",timeout:1e4,context:$("body"),contentType:"application/json",headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"PUT, GET, POST, DELETE, OPTIONS","Access-Control-Allow-Headers":"Content-Type"},success:function(e){var o=5/9*(e.currently.temperature-32);$("#weather").html(e.currently.summary+" "+parseInt(o)+"&deg;c&nbsp;<em>"+e.daily.summary+"</em>")},error:function(e,o){console.log("ajax error"),console.log(e),console.log(o)}})},u=function(e,r){var c,l,i=$("#btc");0!==o?(i.removeClass(),e>o?i.addClass("up"):o>e&&i.addClass("down")):(a.gbp=e,a.usd=r,s.gbp=e,s.usd=r),o=e,t=r,e<a.gbp&&(a.gbp=e),r<a.usd&&(a.usd=r),s.gbp<e&&(s.gbp=e),s.usd<r&&(s.usd=r),l=n*e,c="High: $"+parseFloat(s.usd.toFixed(2))+" / Low $"+parseFloat(a.usd.toFixed(2)),i.html("&#36;"+parseFloat(r.toFixed(2))+" / &pound;"+parseFloat(e.toFixed(2))+" (&pound;"+parseFloat(l.toFixed(2))+")"),i.prop("title",c)},d=function(e){var o=$("#fx");o.html("&pound;1 = &#36;"+parseFloat(e.gpbe.toFixed(2))+" = "+parseFloat(e.sekex.toFixed(2))+" SEK")},h=function(){var e="/btc";$.ajax({type:"GET",url:e,data:"",dataType:"json",timeout:1e4,headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"PUT, GET, POST, DELETE, OPTIONS","Access-Control-Allow-Headers":"Content-Type"},success:function(e){var o=e.bpi.GBP.rate_float,t=e.bpi.USD.rate_float;u(o,t)},error:function(e,o){console.log("ajax error"),console.log(e),console.log(o)}})},g=function(){var e="/fx";$.ajax({type:"GET",url:e,data:"",dataType:"json",timeout:1e4,headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"PUT, GET, POST, DELETE, OPTIONS","Access-Control-Allow-Headers":"Content-Type"},success:function(e){var o=1/e.rates.GBP,t=o*e.rates.SEK,n={usd:1,gbp:e.rates.GBP,sek:e.rates.SEK,gpbe:o,sekex:t};d(n)},error:function(e,o){console.log("ajax error"),console.log(e),console.log(o)}})},f=function(){var e="/dbeglq";$.ajax({type:"GET",url:e,data:"",dataType:"json",timeout:1e4,headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"PUT, GET, POST, DELETE, OPTIONS","Access-Control-Allow-Headers":"Content-Type"},success:function(e){console.log(e),v("dbeglq",e)},error:function(e,o){console.log("ajax error"),console.log(e),console.log(o)}})},b=function(){var e="/glqdbe";$.ajax({type:"GET",url:e,data:"",dataType:"json",timeout:1e4,headers:{"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"PUT, GET, POST, DELETE, OPTIONS","Access-Control-Allow-Headers":"Content-Type"},success:function(e){console.log(e),v("glqdbe",e)},error:function(e,o){console.log("ajax error"),console.log(e),console.log(o)}})},v=function(e,o){var t,n,a=$("#"+e);t="On Time"==o.eta?o.eta:o.sta,n="On Time"==o.eta?"delayed":"ontime",a.html(t),a.prop("class",n)};l(),i(),h(),g(),f(),b(),_fastTimer=setInterval(function(){h(),f(),b()},6e4),e=setInterval(function(){g(),i()},9e5)}();var popitout=function(e){return newwindow=window.open(e,"name","height=600,width=570"),window.focus&&newwindow.focus(),!1},popitoutSmall=function(e){return newwindow=window.open(e,"name","height=400,width=520"),window.focus&&newwindow.focus(),!1};
2015-08-04 14:07:01 +00:00
//# sourceMappingURL=app.min.js.map