mirror of
https://gitlab.silvrtree.co.uk/martind2000/old-silvrgit.git
synced 2025-01-11 09:55:09 +00:00
3 lines
3.5 KiB
JavaScript
3 lines
3.5 KiB
JavaScript
|
!function(){var e,t=0,o=0,n=3.49524333,a={gbp:0,usd:0},s={gbp:0,usd:0},r=function(e,t){return new Date(e.getTime()+24*t*60*60*1e3)},c=function(e,t){var o,n,a;return n=e.getTime(),a=t.getTime(),o=(a-n)/864e5},l=function(){var e=new Date,t=new Date,o=new Date,n=new Date,a=new Date;t.setFullYear(2013,9,24),o=r(t,1001),n.setFullYear(2015,4,10),a.setFullYear(2013,7,25),$("#one").text("101B ends: "+Math.ceil(c(e,o))+" days / "+Math.ceil(c(e,o)/7)+" weeks"),$("#two").text("Ends: "+Math.ceil(c(e,n))+" days / "+Math.ceil(c(e,n)/7)+" weeks"),$("#three").hide()},p=function(){navigator.geolocation.getCurrentPosition(i)},i=function(e){var t=e.coords.latitude,o=e.coords.longitude;$.ajax({type:"GET",url:"https://api.forecast.io/forecast/0657dc0d81c037cbc89ca88e383b6bbf/"+t.toString()+","+o.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 t=5/9*(e.currently.temperature-32);$("#weather").html(e.currently.summary+" "+parseInt(t)+"°c <em>"+e.daily.summary+"</em>")},error:function(e,t){console.log("ajax error"),console.log(e),console.log(t)}})},u=function(e,r){var c,l,p=$("#btc");0!==t?(p.removeClass(),e>t?p.addClass("up"):t>e&&p.addClass("down")):(a.gbp=e,a.usd=r,s.gbp=e,s.usd=r),t=e,o=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)),p.html("$"+parseFloat(r.toFixed(2))+" / £"+parseFloat(e.toFixed(2))+" (£"+parseFloat(l.toFixed(2))+")"),p.prop("title",c)},d=function(e){var t=$("#fx");t.html("£1 = $"+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 t=e.bpi.GBP.rate_float,o=e.bpi.USD.rate_float;u(t,o)},error:function(e,t){console.log("ajax error"),console.log(e),console.log(t)}})},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 t=1/e.rates.GBP,o=t*e.rates.SEK,n={usd:1,gbp:e.rates.GBP,sek:e.rates.SEK,gpbe:t,sekex:o};d(n)},error:function(e,t){console.log("ajax error"),console.log(e),console.log(t)}})},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),b("dbeglq",e)},error:function(e,t){console.log("ajax error"),console.log(e),console.log(t)}})},b=function(e,t){var o,n,a=$("#"+e);o="On Time"==t.eta?t.eta:t.sta,n="On Time"==t.eta?"delayed":"ontime",a.html(o),a.prop("class",n)};l(),p(),h(),g(),f(),_fastTimer=setInterval(function(){h(),f()},6e4),e=setInterval(function(){g(),p()},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};
|
||
|
//# sourceMappingURL=app.min.js.map
|