var data = [{"$type":"Tfl.Api.Presentation.Entities.Prediction, Tfl.Api.Presentation.Entities","id":"479721371","operationType":1,"vehicleId":"011","naptanId":"940GZZLUTFP","stationName":"Tufnell Park Underground Station","lineId":"northern","lineName":"Northern","platformName":"Southbound - Platform 2","direction":"inbound","bearing":"","destinationNaptanId":"940GZZLUMDN","destinationName":"Morden Underground Station","timestamp":"2025-08-17T08:15:17.0598928Z","timeToStation":435,"currentLocation":"Finchley Central Platform 3","towards":"Morden via Bank","expectedArrival":"2025-08-17T08:22:32Z","timeToLive":"2025-08-17T08:22:32Z","modeName":"tube","timing":{"$type":"Tfl.Api.Presentation.Entities.PredictionTiming, Tfl.Api.Presentation.Entities","countdownServerAdjustment":"00:00:00","source":"0001-01-01T00:00:00","insert":"0001-01-01T00:00:00","read":"2025-08-17T08:15:49.966Z","sent":"2025-08-17T08:15:17Z","received":"0001-01-01T00:00:00"}},{"$type":"Tfl.Api.Presentation.Entities.Prediction, Tfl.Api.Presentation.Entities","id":"-1034932590","operationType":1,"vehicleId":"026","naptanId":"940GZZLUTFP","stationName":"Tufnell Park Underground Station","lineId":"northern","lineName":"Northern","platformName":"Southbound - Platform 2","direction":"inbound","bearing":"","destinationNaptanId":"940GZZBPSUST","destinationName":"Battersea Power Station Underground Station","timestamp":"2025-08-17T08:15:17.0598928Z","timeToStation":45,"currentLocation":"At Tufnell Park Platform 2","towards":"Battersea via CX","expectedArrival":"2025-08-17T08:16:02Z","timeToLive":"2025-08-17T08:16:02Z","modeName":"tube","timing":{"$type":"Tfl.Api.Presentation.Entities.PredictionTiming, Tfl.Api.Presentation.Entities","countdownServerAdjustment":"00:00:00","source":"0001-01-01T00:00:00","insert":"0001-01-01T00:00:00","read":"2025-08-17T08:15:49.966Z","sent":"2025-08-17T08:15:17Z","received":"0001-01-01T00:00:00"}},{"$type":"Tfl.Api.Presentation.Entities.Prediction, Tfl.Api.Presentation.Entities","id":"-230790284","operationType":1,"vehicleId":"030","naptanId":"940GZZLUTFP","stationName":"Tufnell Park Underground Station","lineId":"northern","lineName":"Northern","platformName":"Northbound - Platform 1","direction":"outbound","bearing":"","destinationNaptanId":"940GZZLUHBT","destinationName":"High Barnet Underground Station","timestamp":"2025-08-17T08:15:17.0598928Z","timeToStation":226,"currentLocation":"At Camden Town","towards":"High Barnet via CX","expectedArrival":"2025-08-17T08:19:03Z","timeToLive":"2025-08-17T08:19:03Z","modeName":"tube","timing":{"$type":"Tfl.Api.Presentation.Entities.PredictionTiming, Tfl.Api.Presentation.Entities","countdownServerAdjustment":"00:00:00","source":"0001-01-01T00:00:00","insert":"0001-01-01T00:00:00","read":"2025-08-17T08:15:49.966Z","sent":"2025-08-17T08:15:17Z","received":"0001-01-01T00:00:00"}},{"$type":"Tfl.Api.Presentation.Entities.Prediction, Tfl.Api.Presentation.Entities","id":"479852443","operationType":1,"vehicleId":"031","naptanId":"940GZZLUTFP","stationName":"Tufnell Park Underground Station","lineId":"northern","lineName":"Northern","platformName":"Northbound - Platform 1","direction":"outbound","bearing":"","destinationNaptanId":"940GZZLUMHL","destinationName":"Mill Hill East Underground Station","timestamp":"2025-08-17T08:15:17.0598928Z","timeToStation":376,"currentLocation":"Between Euston and Camden Town","towards":"Mill Hill East via Bank","expectedArrival":"2025-08-17T08:21:33Z","timeToLive":"2025-08-17T08:21:33Z","modeName":"tube","timing":{"$type":"Tfl.Api.Presentation.Entities.PredictionTiming, Tfl.Api.Presentation.Entities","countdownServerAdjustment":"00:00:00","source":"0001-01-01T00:00:00","insert":"0001-01-01T00:00:00","read":"2025-08-17T08:15:49.966Z","sent":"2025-08-17T08:15:17Z","received":"0001-01-01T00:00:00"}},{"$type":"Tfl.Api.Presentation.Entities.Prediction, Tfl.Api.Presentation.Entities","id":"479983515","operationType":1,"vehicleId":"051","naptanId":"940GZZLUTFP","stationName":"Tufnell Park Underground Station","lineId":"northern","lineName":"Northern","platformName":"Southbound - Platform 2","direction":"inbound","bearing":"","destinationNaptanId":"940GZZBPSUST","destinationName":"Battersea Power Station Underground Station","timestamp":"2025-08-17T08:15:17.0598928Z","timeToStation":375,"currentLocation":"Approaching East Finchley","towards":"Battersea via CX","expectedArrival":"2025-08-17T08:21:32Z","timeToLive":"2025-08-17T08:21:32Z","modeName":"tube","timing":{"$type":"Tfl.Api.Presentation.Entities.PredictionTiming, Tfl.Api.Presentation.Entities","countdownServerAdjustment":"00:00:00","source":"0001-01-01T00:00:00","insert":"0001-01-01T00:00:00","read":"2025-08-17T08:15:49.966Z","sent":"2025-08-17T08:15:17Z","received":"0001-01-01T00:00:00"}},{"$type":"Tfl.Api.Presentation.Entities.Prediction, Tfl.Api.Presentation.Entities","id":"-1175225282","operationType":1,"vehicleId":"052","naptanId":"940GZZLUTFP","stationName":"Tufnell Park Underground Station","lineId":"northern","lineName":"Northern","platformName":"Northbound - Platform 1","direction":"outbound","bearing":"","destinationNaptanId":"940GZZLUMHL","destinationName":"Mill Hill East Underground Station","timestamp":"2025-08-17T08:15:17.0598928Z","timeToStation":1575,"currentLocation":"Left Nine Elms","towards":"Mill Hill East via CX","expectedArrival":"2025-08-17T08:41:32Z","timeToLive":"2025-08-17T08:41:32Z","modeName":"tube","timing":{"$type":"Tfl.Api.Presentation.Entities.PredictionTiming, Tfl.Api.Presentation.Entities","countdownServerAdjustment":"00:00:00","source":"0001-01-01T00:00:00","insert":"0001-01-01T00:00:00","read":"2025-08-17T08:15:49.966Z","sent":"2025-08-17T08:15:17Z","received":"0001-01-01T00:00:00"}},{"$type":"Tfl.Api.Presentation.Entities.Prediction, Tfl.Api.Presentation.Entities","id":"-632649563","operationType":1,"vehicleId":"053","naptanId":"940GZZLUTFP","stationName":"Tufnell Park Underground Station","lineId":"northern","lineName":"Northern","platformName":"Northbound - Platform 1","direction":"outbound","bearing":"","destinationNaptanId":"940GZZLUHBT","destinationName":"High Barnet Underground Station","timestamp":"2025-08-17T08:15:17.0598928Z","timeToStation":795,"currentLocation":"Between Old Street and Angel","towards":"High Barnet via Bank","expectedArrival":"2025-08-17T08:28:32Z","timeToLive":"2025-08-17T08:28:32Z","modeName":"tube","timing":{"$type":"Tfl.Api.Presentation.Entities.PredictionTiming, Tfl.Api.Presentation.Entities","countdownServerAdjustment":"00:00:00","source":"0001-01-01T00:00:00","insert":"0001-01-01T00:00:00","read":"2025-08-17T08:15:49.966Z","sent":"2025-08-17T08:15:17Z","received":"0001-01-01T00:00:00"}},{"$type":"Tfl.Api.Presentation.Entities.Prediction, Tfl.Api.Presentation.Entities","id":"-1034473838","operationType":1,"vehicleId":"076","naptanId":"940GZZLUTFP","stationName":"Tufnell Park Underground Station","lineId":"northern","lineName":"Northern","platformName":"Southbound - Platform 2","direction":"inbound","bearing":"","destinationNaptanId":"940GZZBPSUST","destinationName":"Battersea Power Station Underground Station","timestamp":"2025-08-17T08:15:17.0598928Z","timeToStation":555,"currentLocation":"At West Finchley Platform 2","towards":"Battersea via CX","expectedArrival":"2025-08-17T08:24:32Z","timeToLive":"2025-08-17T08:24:32Z","modeName":"tube","timing":{"$type":"Tfl.Api.Presentation.Entities.PredictionTiming, Tfl.Api.Presentation.Entities","countdownServerAdjustment":"00:00:00","source":"0001-01-01T00:00:00","insert":"0001-01-01T00:00:00","read":"2025-08-17T08:15:49.966Z","sent":"2025-08-17T08:15:17Z","received":"0001-01-01T00:00:00"}},{"$type":"Tfl.Api.Presentation.Entities.Prediction, Tfl.Api.Presentation.Entities","id":"-1034867051","operationType":1,"vehicleId":"116","naptanId":"940GZZLUTFP","stationName":"Tufnell Park Underground Station","lineId":"northern","lineName":"Northern","platformName":"Southbound - Platform 2","direction":"inbound","bearing":"","destinationNaptanId":"940GZZBPSUST","destinationName":"Battersea Power Station Underground Station","timestamp":"2025-08-17T08:15:17.0598928Z","timeToStation":1035,"currentLocation":"14A/B Crossover","towards":"Battersea via CX","expectedArrival":"2025-08-17T08:32:32Z","timeToLive":"2025-08-17T08:32:32Z","modeName":"tube","timing":{"$type":"Tfl.Api.Presentation.Entities.PredictionTiming, Tfl.Api.Presentation.Entities","countdownServerAdjustment":"00:00:00","source":"0001-01-01T00:00:00","insert":"0001-01-01T00:00:00","read":"2025-08-17T08:15:49.966Z","sent":"2025-08-17T08:15:17Z","received":"0001-01-01T00:00:00"}},{"$type":"Tfl.Api.Presentation.Entities.Prediction, Tfl.Api.Presentation.Entities","id":"-1577541010","operationType":1,"vehicleId":"125","naptanId":"940GZZLUTFP","stationName":"Tufnell Park Underground Station","lineId":"northern","lineName":"Northern","platformName":"Southbound - Platform 2","direction":"inbound","bearing":"","destinationNaptanId":"940GZZLUMDN","destinationName":"Morden Underground Station","timestamp":"2025-08-17T08:15:17.0598928Z","timeToStation":795,"currentLocation":"At Totteridge & Whetstone","towards":"Morden via Bank","expectedArrival":"2025-08-17T08:28:32Z","timeToLive":"2025-08-17T08:28:32Z","modeName":"tube","timing":{"$type":"Tfl.Api.Presentation.Entities.PredictionTiming, Tfl.Api.Presentation.Entities","countdownServerAdjustment":"00:00:00","source":"0001-01-01T00:00:00","insert":"0001-01-01T00:00:00","read":"2025-08-17T08:15:49.966Z","sent":"2025-08-17T08:15:17Z","received":"0001-01-01T00:00:00"}},{"$type":"Tfl.Api.Presentation.Entities.Prediction, Tfl.Api.Presentation.Entities","id":"-1034735979","operationType":1,"vehicleId":"136","naptanId":"940GZZLUTFP","stationName":"Tufnell Park Underground Station","lineId":"northern","lineName":"Northern","platformName":"Southbound - Platform 2","direction":"inbound","bearing":"","destinationNaptanId":"940GZZLUMDN","destinationName":"Morden Underground Station","timestamp":"2025-08-17T08:15:17.0598928Z","timeToStation":285,"currentLocation":"At Highgate Platform 2","towards":"Morden via Bank","expectedArrival":"2025-08-17T08:20:02Z","timeToLive":"2025-08-17T08:20:02Z","modeName":"tube","timing":{"$type":"Tfl.Api.Presentation.Entities.PredictionTiming, Tfl.Api.Presentation.Entities","countdownServerAdjustment":"00:00:00","source":"0001-01-01T00:00:00","insert":"0001-01-01T00:00:00","read":"2025-08-17T08:15:49.966Z","sent":"2025-08-17T08:15:17Z","received":"0001-01-01T00:00:00"}},{"$type":"Tfl.Api.Presentation.Entities.Prediction, Tfl.Api.Presentation.Entities","id":"1823128376","operationType":1,"vehicleId":"137","naptanId":"940GZZLUTFP","stationName":"Tufnell Park Underground Station","lineId":"northern","lineName":"Northern","platformName":"Northbound - Platform 1","direction":"outbound","bearing":"","destinationNaptanId":"940GZZLUHBT","destinationName":"High Barnet Underground Station","timestamp":"2025-08-17T08:15:17.0598928Z","timeToStation":32,"currentLocation":"At Platform","towards":"High Barnet via Bank","expectedArrival":"2025-08-17T08:15:49Z","timeToLive":"2025-08-17T08:15:49Z","modeName":"tube","timing":{"$type":"Tfl.Api.Presentation.Entities.PredictionTiming, Tfl.Api.Presentation.Entities","countdownServerAdjustment":"00:00:00","source":"0001-01-01T00:00:00","insert":"0001-01-01T00:00:00","read":"2025-08-17T08:15:49.966Z","sent":"2025-08-17T08:15:17Z","received":"0001-01-01T00:00:00"}},{"$type":"Tfl.Api.Presentation.Entities.Prediction, Tfl.Api.Presentation.Entities","id":"-632584028","operationType":1,"vehicleId":"143","naptanId":"940GZZLUTFP","stationName":"Tufnell Park Underground Station","lineId":"northern","lineName":"Northern","platformName":"Northbound - Platform 1","direction":"outbound","bearing":"","destinationNaptanId":"940GZZLUHBT","destinationName":"High Barnet Underground Station","timestamp":"2025-08-17T08:15:17.0598928Z","timeToStation":616,"currentLocation":"At Goodge Street Platform 1","towards":"High Barnet via CX","expectedArrival":"2025-08-17T08:25:33Z","timeToLive":"2025-08-17T08:25:33Z","modeName":"tube","timing":{"$type":"Tfl.Api.Presentation.Entities.PredictionTiming, Tfl.Api.Presentation.Entities","countdownServerAdjustment":"00:00:00","source":"0001-01-01T00:00:00","insert":"0001-01-01T00:00:00","read":"2025-08-17T08:15:49.966Z","sent":"2025-08-17T08:15:17Z","received":"0001-01-01T00:00:00"}},{"$type":"Tfl.Api.Presentation.Entities.Prediction, Tfl.Api.Presentation.Entities","id":"-1577409938","operationType":1,"vehicleId":"145","naptanId":"940GZZLUTFP","stationName":"Tufnell Park Underground Station","lineId":"northern","lineName":"Northern","platformName":"Northbound - Platform 1","direction":"outbound","bearing":"","destinationNaptanId":"940GZZLUHBT","destinationName":"High Barnet Underground Station","timestamp":"2025-08-17T08:15:17.0598928Z","timeToStation":1755,"currentLocation":"At Battersea Power Station Platform 1","towards":"High Barnet via CX","expectedArrival":"2025-08-17T08:44:32Z","timeToLive":"2025-08-17T08:44:32Z","modeName":"tube","timing":{"$type":"Tfl.Api.Presentation.Entities.PredictionTiming, Tfl.Api.Presentation.Entities","countdownServerAdjustment":"00:00:00","source":"0001-01-01T00:00:00","insert":"0001-01-01T00:00:00","read":"2025-08-17T08:15:49.966Z","sent":"2025-08-17T08:15:17Z","received":"0001-01-01T00:00:00"}},{"$type":"Tfl.Api.Presentation.Entities.Prediction, Tfl.Api.Presentation.Entities","id":"-1034801515","operationType":1,"vehicleId":"146","naptanId":"940GZZLUTFP","stationName":"Tufnell Park Underground Station","lineId":"northern","lineName":"Northern","platformName":"Northbound - Platform 1","direction":"outbound","bearing":"","destinationNaptanId":"940GZZLUHBT","destinationName":"High Barnet Underground Station","timestamp":"2025-08-17T08:15:17.0598928Z","timeToStation":1035,"currentLocation":"Between Waterloo and Embankment","towards":"High Barnet via CX","expectedArrival":"2025-08-17T08:32:32Z","timeToLive":"2025-08-17T08:32:32Z","modeName":"tube","timing":{"$type":"Tfl.Api.Presentation.Entities.PredictionTiming, Tfl.Api.Presentation.Entities","countdownServerAdjustment":"00:00:00","source":"0001-01-01T00:00:00","insert":"0001-01-01T00:00:00","read":"2025-08-17T08:15:49.966Z","sent":"2025-08-17T08:15:17Z","received":"0001-01-01T00:00:00"}}] var times = []; for (var i = 0; i < data.length; i++) { var platformName = data[i].platformName.replace(" - Platform ", ' platform '); var platformName = platformName.toLowerCase(); if (data[i].towards.includes('Check Front of Train')) { var towards = ' (check front of train for destination)'; } else { var towards = ' (towards ' + data[i].towards + ')'; } var towards = towards.replace(" (Circle)", ''); var towards = towards.replace("Elephant and Castle", 'Elephant & Castle'); var towards = towards.replace("Harrow and Wealdstone", 'Harrow & Wealdstone'); var towards = towards.replace("T123 + 5", 'Terminals 2-3 & 5'); var towards = towards.replace("via CX", 'via Charing Cross'); var expectedArrival = data[i].expectedArrival.split("T"); var expectedArrival_bits = expectedArrival[1].split(":"); var expectedArrival = expectedArrival_bits[0] + ':' + expectedArrival_bits[1] + towards; var time = data[i].lineName + ' ' + platformName + ' –' + expectedArrival; var time = time.replace("Bakerloo", 'Bakerloo line'); var time = time.replace("Central", 'Central line'); var time = time.replace("Hendon Central line", 'Hendon Central'); var time = time.replace("Finchley Central line", 'Finchley Central'); var time = time.replace("Walthamstow Central line", 'Walthamstow Central'); var time = time.replace("Wembley Central line", 'Wembley Central'); var time = time.replace("Circle", 'Circle line'); var time = time.replace("towards Circle line", 'check front of train for destination'); var time = time.replace("towards Circle Line", 'check front of train for destination'); var time = time.replace("District", 'District line'); var time = time.replace("Docklands Light Railway", 'Docklands Light Railway'); var time = time.replace("DLR", 'Docklands Light Railway'); var time = time.replace("Hammersmith & City", 'Hammersmith & City line'); var time = time.replace("Jubilee", 'Jubilee line'); var time = time.replace("Metropolitan", 'Metropolitan line'); var time = time.replace("Northern", 'Northern line'); var time = time.replace("Piccadilly", 'Piccadilly line'); var time = time.replace("Elizabeth", 'Elizabeth line'); var time = time.replace("Victoria", 'Victoria line'); var time = time.replace("(via Victoria line)", 'via Victoria'); var time = time.replace("Waterloo & City", 'Waterloo & City line'); var time = time.replace("via Bank", 'via Bank loop'); var time = time.replace("via Charing Cross", 'via Charing Cross loop'); var time = time.replace("northbound platform", 'Northbound platform'); var time = time.replace("southbound platform", 'Southbound platform'); var time = time.replace("eastbound platform", 'Eastbound platform'); var time = time.replace("westbound platform", 'Westbound platform'); var time = time.replace("inner rail", 'Inner rail'); var time = time.replace("outer rail", 'Outer rail'); var time = time.replace("23:", '00:'); var time = time.replace("22:", '23:'); var time = time.replace("21:", '22:'); var time = time.replace("20:", '21:'); var time = time.replace("19:", '20:'); var time = time.replace("18:", '19:'); var time = time.replace("17:", '18:'); var time = time.replace("16:", '17:'); var time = time.replace("15:", '16:'); var time = time.replace("14:", '15:'); var time = time.replace("13:", '14:'); var time = time.replace("12:", '13:'); var time = time.replace("11:", '12:'); var time = time.replace("10:", '11:'); var time = time.replace("09:", '10:'); var time = time.replace("08:", '09:'); var time = time.replace("07:", '08:'); var time = time.replace("06:", '07:'); var time = time.replace("05:", '06:'); var time = time.replace("04:", '05:'); var time = time.replace("03:", '04:'); var time = time.replace("02:", '03:'); var time = time.replace("01:", '02:'); var time = time.replace("00:", '01:'); times.push(time); } times.sort(); var real_times = []; var done_platforms = []; for (var i = 0; i < times.length; i++) { var pieces = times[i].split(" –"); if (done_platforms.indexOf(pieces[0]) != -1) { var piece = ' ' + pieces[1]; } else { var piece = '

' + pieces[0] + ' ' + pieces[1]; } real_times.push(piece); done_platforms.push(pieces[0]); } var real_times_array = real_times.toString(); var real_times_array = real_times_array.replace(/\,

/g, '

'); var real_times_array = real_times_array.replace(/\,/g, ' · '); var real_times_array = real_times_array.replace(/\(towards \)/g, '(check front of train for destination)'); if (real_times_array.length < 25) { var real_times_array = real_times_array + '

Timetable information is not available

'; } var real_times_array = real_times_array + '

'; var real_times_array = real_times_array + '

Powered by TfL Open Data. Contains OS data © Crown copyright and database rights 2016 / Geomni UK Map data © and database rights 2019

'; document.getElementById("departures").innerHTML = real_times_array;