2016-02-29 15:05:57 +00:00
( function ( ) { var c = 0 , m = 0 , g = 0 , n = 0 , h = 0 ; MicroEvent . mixin ( this ) ; var e = this , k = function ( a , b ) { var d ; d = a . getTime ( ) ; return ( b . getTime ( ) - d ) / 864E5 } ; this . bind ( "displayWeather" , function ( a ) { console . log ( "Update weather event:" ) ; $ ( "#weather" ) . html ( a . currently . summary + " " + a . currently . temperature + "°c <em>" + a . daily . summary + "</em>" ) } ) ; var p = function ( a ) { $ . ajax ( { type : "GET" , url : "https://api.forecast.io/forecast/0657dc0d81c037cbc89ca88e383b6bbf/" + a . coords . latitude . toString ( ) + "," + a . coords . longitude . toString ( ) + "?units=uk2" ,
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 ( a ) { e . trigger ( "displayWeather" , a ) } , error : function ( a , d ) { console . log ( "ajax error" ) ; console . log ( a ) ; console . log ( d ) } } ) } , t = function ( ) { $ . ajax ( { type : "GET" , url : "/btc" , 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 ( a ) { var b = a . bpi . GBP . rate _float ; a = a . bpi . USD . rate _float ; var d , q , f = $ ( "#btc" ) ; 0 !== c ? ( f . removeClass ( ) , b > c ? f . addClass ( "up" ) : b < c && f . addClass ( "down" ) ) : ( m = b , g = a , n = b , h = a ) ; c = b ; b < m && ( m = b ) ; a < g && ( g = a ) ; n < b && ( n = b ) ; h < a && ( h = a ) ; q = 3.49524333 * b ; d = "High: $" + parseFloat ( h . toFixed ( 2 ) ) + " / Low $" + parseFloat ( g . toFixed ( 2 ) ) ; f . html ( "$" + parseFloat ( a . toFixed ( 2 ) ) + " / £" + parseFloat ( b . toFixed ( 2 ) ) + " (£" + parseFloat ( q . toFixed ( 2 ) ) + ")" ) ; f . prop ( "title" , d ) } , error : function ( a ,
b ) { console . log ( "ajax error" ) ; console . log ( a ) ; console . log ( b ) } } ) } ; this . bind ( "getBTC" , function ( ) { console . log ( "BTC Event" ) ; t ( ) } ) ; var r = function ( ) { $ . ajax ( { type : "GET" , url : "/fx" , 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 ( a ) { var b = 1 / a . rates . GBP ; a = b * a . rates . SEK ; $ ( "#fx" ) . html ( "£1 = $" + parseFloat ( b . toFixed ( 2 ) ) + " = " + parseFloat ( a . toFixed ( 2 ) ) +
" SEK" ) } , error : function ( a , b ) { console . log ( "ajax error" ) ; console . log ( a ) ; console . log ( b ) } } ) } , l = function ( a , b ) { var d = b + a ; $ . ajax ( { type : "GET" , url : "/getnexttraintimes?from=" + b + "&to=" + a , 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 ( a ) { var b = $ ( "#" + d ) , c ; c = "On Time" == a . eta ? a . eta : a . sta ; a = "On Time" == a . eta ? "delayed" : "ontime" ; b . html ( c ) ; b . prop ( "class" , a ) } ,
error : function ( a , b ) { console . log ( "ajax error" ) ; console . log ( a ) ; console . log ( b ) } } ) } , u = function ( a , b ) { $ . ajax ( { type : "GET" , url : "/gettrains?from=" + a + "&to=" + b , 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 ( a ) { var b = $ ( "#trainResults" ) ; a = ( new EJS ( { url : "/template/trains.ejs" } ) ) . render ( a ) ; b . empty ( ) ; b . append ( a ) ; b . toggle ( ) } , error : function ( a , b ) { console . log ( "ajax error" ) ;
console . log ( a ) ; console . log ( b ) } } ) } , v = function ( a , b ) { $ . ajax ( { type : "GET" , url : "/generate" , 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 ( a ) { var b = $ ( "#passwordOut" ) ; a = ( new EJS ( { url : "/template/password.ejs" } ) ) . render ( a ) ; b . empty ( ) ; b . append ( a ) ; b . show ( ) } , error : function ( a , b ) { console . log ( "ajax error" ) ; console . log ( a ) ; console . log ( b ) } } ) } ; ( function ( ) { var a =
new Date , b = new Date , c = new Date , e = new Date ; b . setFullYear ( 2013 , 9 , 24 ) ; b = new Date ( b . getTime ( ) + 864864E5 ) ; c . setFullYear ( 2016 , 4 , 4 ) ; e . setFullYear ( 2013 , 7 , 25 ) ; $ ( "#one" ) . text ( "101B ends: " + Math . ceil ( k ( a , b ) ) + " days / " + Math . ceil ( k ( a , b ) / 7 ) + " weeks" ) ; $ ( "#two" ) . text ( "Ends: " + Math . ceil ( k ( a , c ) ) + " days / " + Math . ceil ( k ( a , c ) / 7 ) + " weeks" ) ; $ ( "#three" ) . hide ( ) } ) ( ) ; navigator . geolocation . getCurrentPosition ( p ) ; e . trigger ( "getBTC" ) ; r ( ) ; l ( "dbe" , "glq" ) ; l ( "glq" , "dbe" ) ; _fastTimer = setInterval ( function ( ) { e . trigger ( "getBTC" ) ; l ( "dbe" ,
"glq" ) ; l ( "glq" , "dbe" ) } , 6E4 ) ; setInterval ( function ( ) { r ( ) ; navigator . geolocation . getCurrentPosition ( p ) } , 9E5 ) ; $ ( "#dbeglq" ) . on ( "click" , function ( ) { e . trigger ( "getTrains" , "dbe" , "glq" ) } ) ; $ ( "#glqdbe" ) . on ( "click" , function ( ) { e . trigger ( "getTrains" , "glq" , "dbe" ) } ) ; $ ( "#newPassword" ) . on ( "click" , function ( ) { v ( ) } ) ; this . bind ( "getTrains" , function ( a , b ) { u ( a , b ) } ) ; document . title = "Slack" } ) ( ) ;
var popitout = function ( c ) { c = window . open ( c , "name" , "height=600,width=570" ) ; window . focus && c . focus ( ) ; return ! 1 } , popitoutSmall = function ( c ) { c = window . open ( c , "name" , "height=400,width=520" ) ; window . focus && c . focus ( ) ; return ! 1 } ;