Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              
<html lang="en" ng-app="trainList">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1 user-scalable=no">
  <title>Departure Board</title>
  <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
  <link href='https://fonts.googleapis.com/css?family=VT323' rel='stylesheet' type='text/css'>
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js"></script>
  <script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
</head>
<body>

  <div class="container"  ng-controller="TrainList">
  
  <div class="row">
    
    <div class="col-sm-12">
  
      <div role="tabpanel">

      <!-- Nav tabs -->
      <ul class="nav nav-tabs" role="tablist">
        <li role="presentation"><a href="#morning" aria-controls="home" role="tab" data-toggle="tab">MORNING TRAINS</a></li>
        <li role="presentation" class="active"><a href="#evening" aria-controls="profile" role="tab" data-toggle="tab">EVENING TRAINS</a></li>
      </ul>

      <!-- Tab panes -->
      <div class="tab-content">
        
        <div role="tabpanel" class="tab-pane" id="morning">
          <h2>WHEN IS MY TRAIN TO WORK?</h2>
          
          <div class="row">
            <div class="col-xs-4">
              <h3>SERVICE</h3>
            </div>
            <div class="col-xs-4">
              <h3>ESTIMATED DEPARTURE TIME</h3>
            </div>
          </div>
   
      <div class="row" ng-repeat="service in mornServices">
							
			        <div class="col-xs-4"><p>	    {{service.locationDetail.gbttBookedDeparture}} {{service.locationDetail.description}} - <span ng-repeat="destination in service.locationDetail.destination">
          {{destination.description}}
        </span> ({{service.trainIdentity}})
                </p></div>
        <div class="col-xs-4">
        <p> {{service.locationDetail.realtimeDeparture}}</p>
        <p>{{service.locationDetail.cancelReasonLongText}}</p>
        </div>
	      </div>
   
    <h2>DID THE EARLIER TRAINS LEAVE ON TIME?</h2>
          <div class="row">
            <div class="col-xs-4">
              <h3>SERVICE</h3>
            </div>
            <div class="col-xs-4">
              <h3>ACTUAL DEPARTURE TIME</h3>
            </div>
            <div class="col-xs-4">
              <h3>DEPARTED?</h3>
            </div>
          </div>
          
    
      <div class="row" ng-repeat="service in prevMornServices">
			        <div class="col-xs-4"><p>	    {{service.locationDetail.gbttBookedDeparture}} {{service.locationDetail.description}} - <span ng-repeat="destination in service.locationDetail.destination">
          {{destination.description}}
                </span> ({{service.trainIdentity}})</p>
			        </div>
        <div class="col-xs-4"><p> {{service.locationDetail.realtimeDeparture}} </p><p>{{service.locationDetail.cancelReasonLongText}}</p> </div><div class="col-xs-4"><p>{{service.locationDetail.realtimeDepartureActual}}
        </p></div>
        
	      </div>
   
    
  <!--  <h2>WHERE ARE MY TRAINS TO WORK?</h2>
    
          <p class="destination">0801 Kings Langley - London Euston (2K12)</p>
        <p>{{stats.cancelReasonLongText}}</p>
       

    <div class="row">
      <div class="col-sm-1 eightohonetimes"  ng-repeat="stats in eightohone">
        <p>{{stats.crs}}</p>
        <p>ARR {{stats.realtimeArrival}}<br />{{stats.realtimeArrivalActual}}</p><p> DEP {{stats.realtimeDeparture}}<br/>{{stats.realtimeDepartureActual}}</p>
      </div>
    </div>
  

    <p class="destination2">
      0816 Kings Langley - London Euston (2T52)
    </p>
    <p>{{stats.cancelReasonLongText}}</p>
    <div class="row">
      <div class="col-sm-1" ng-repeat="stats in eightsixteen">
        <p>{{stats.crs}}</p>
        <p>ARR {{stats.realtimeArrival}}<br />{{stats.realtimeArrivalActual}}</p><p> DEP {{stats.realtimeDeparture}}<br/>{{stats.realtimeDepartureActual}}</p></div>
    </div>
    
 
    <p class="destination2">
      0841 Kings Langley - London Euston (2T42)
    </p>
    <p>{{stats.cancelReasonLongText}}</p>
    <div class="row">
      <div class="col-sm-1" ng-repeat="stats in eightfortyone">
        <p>{{stats.crs}}</p><p>ARR {{stats.realtimeArrival}}<br />{{stats.realtimeArrivalActual}}</p> <p>DEP {{stats.realtimeDeparture}}
       <br/> {{stats.realtimeDepartureActual}}</p></div>
    </p>
    
     </div>-->
        </div>
        
        <div role="tabpanel" class="tab-pane active" id="evening">
          <h2>WHEN IS MY TRAIN HOME?</h2>
           <div class="row">
            <div class="col-xs-4">
              <h3>SERVICE</h3>
            </div>
            <div class="col-xs-4">
              <h3>ESTIMATED DEPARTURE TIME</h3>
            </div>
            <div class="col-xs-4">
              <h3>PLATFORM / CONFIRMED?</h3>
            </div>
          </div>
      <div class="row" ng-repeat="service in eveServices">
							
			       <div class="col-xs-4"> <p>	    {{service.locationDetail.gbttBookedDeparture}} {{service.locationDetail.description}} - <span ng-repeat="destination in service.locationDetail.destination">
          {{destination.description}}
        </span> ({{service.trainIdentity}})
               </p></div>
        <div class="col-xs-4"><p> {{service.locationDetail.realtimeDeparture}}</p><p>{{service.locationDetail.cancelReasonLongText}}</p></div>
        <div class="col-xs-4"><p> {{service.locationDetail.platform}}  {{service.locationDetail.platformConfirmed}}
        </p>
          </div>
	      </div>
  
    <h2>DID THE EARLIER TRAINS LEAVE ON TIME?</h2>
           <div class="row">
            <div class="col-xs-4">
              <h3>SERVICE</h3>
            </div>
            <div class="col-xs-4">
              <h3>ACTUAL DEPARTURE TIME</h3>
            </div>
            <div class="col-xs-4">
              <h3>DEPARTED?</h3>
            </div>
          </div>

      <div class="row" ng-repeat="service in prevEveServices">
			        <div class="col-xs-4"><p>	    {{service.locationDetail.gbttBookedDeparture}} {{service.locationDetail.description}} - <span ng-repeat="destination in service.locationDetail.destination">
          {{destination.description}}
        </span> ({{service.trainIdentity}})
                </p></div>
        <div class="col-xs-4"> <p>{{service.locationDetail.realtimeDeparture}}</p>
        <p>{{service.locationDetail.cancelReasonLongText}}</p></div>
        <div class="col-xs-4"><p>{{service.locationDetail.realtimeDepartureActual}}
          </p></div>
        
	      </div>
  
        </div>
      </div>

    </div>
      
  </div>
    
</div>

</div>
    
<p class="text-center">
<a href="http://www.tjmortimer.com" title="TJMortimer.com" target="_blank">See more work on TJMortimer.com</a> or 
<a href="https://codepen.io/TJMortimer/pen/myVZyN" title="Source on Codepen" target="_blank">View source on Codepen</a>
</p>    
  
  <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
</body>
</html>
            
          
!
            
              @import "lesshat";

body {
  background-color:#ccc!important;
  p {
    a {
      font-weight:bold;
      color:black;
    }
  }
}
.container {
  background: black;
  color:yellow;
  font-family: 'VT323', 'arial' ;
  font-size:19px;
  -webkit-box-shadow: 8px 6px 10px 0px rgba(50, 50, 50, 0.75);
	-moz-box-shadow:    8px 6px 10px 0px rgba(50, 50, 50, 0.75);
	box-shadow:         8px 6px 10px 0px rgba(50, 50, 50, 0.75);
}
li {
  list-style:none;
}
.nav.nav-tabs {
    padding-top:10px;
    border-bottom:1px solid yellow;
    li {
    background:black;
    border:1px solid yellow;
      a {
        color:white;
      }
    }
}
.nav-tabs>li.active>a, .nav-tabs>li.active>a:hover, .nav-tabs>li.active>a:focus, .nav-tabs>li>a:hover, .nav-tabs>li>a:focus {
  background-color:yellow!important;
  border:1px solid yellow!important;
  border-radius:0!important;
  color:black!important;
}
/*Equalizing margins*/
.destination {
  margin-top:20px;
}
.destination2 {
  margin-top: 10px;
}
/*Let's hide Cheddington cos 13 won't fit and no-one goes there anyway!*/
.eightohonenames:nth-of-type(4), .eightohonetimes:nth-of-type(4) {
  display:none;
}
/*MQs*/
@media (max-width:767px) {
  .nav.nav-tabs li {
    width:50%;
  }
  h3 {
    font-size:20px!important;
  }
}
            
          
!
            
              /*Get today's date*/
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //January is 0!
var yyyy = today.getFullYear();

if(dd<10) {
    dd='0'+dd
} 

if(mm<10) {
    mm='0'+mm
} 

today = yyyy+'/'+mm+'/'+dd;

/*Angular Controller START*/

/*Name app*/
var trainList = angular.module('trainList', []);

/*Name controller and call Angular functions*/
trainList.controller('TrainList', function ($scope, $http) {

  /*Login to API*/
  $http.defaults.headers.common.Authorization = 'Basic cnR0YXBpX3J0dF90aG9tYXMtbW9ydGltZXI6ODQyNzY3MzhjNzJiOWQ0NzRhNmJkZWI2ZGJhYjU4ZjE2MGI2MjAyYg=='
  
  /*Fetch evening EUS departures*/
   $http.get('https://jsonproxy.herokuapp.com/?url=https://api.rtt.io/api/v1/json/search/eus/to/hml/' + today + '/1741').success(function(data) {
    	$scope.eveServices = data.services;
    });
  
  /*Fetch early evening departures*/
  $http.get('https://jsonproxy.herokuapp.com/?url=https://api.rtt.io/api/v1/json/search/eus/to/hml/'+ today + '/1615').success(function(data) {
    	$scope.prevEveServices = data.services;
    });
  
  /*Fetch early morning departures*/
  $http.get('https://jsonproxy.herokuapp.com/?url=https://api.rtt.io/api/v1/json/search/hml/to/eus/' + today + '/0630').success(function(data) {
    	$scope.prevMornServices = data.services;
    });
  
  /*Fetch morning KGL departures*/
  $http.get('https://jsonproxy.herokuapp.com/?url=https://api.rtt.io/api/v1/json/search/hml/to/eus/' + today + '/0800').success(function(data) {
    	$scope.mornServices = data.services;
    });
  
  /*Fetch 0801 KGL-EUS position
  $http.get('http://jsonproxy.herokuapp.com/?url=https://api.rtt.io/api/v1/json/service/P71463/' + today).success(function(data) {
    	$scope.eightohone = data.locations;
    });
  /*Fetch 0816 KGL-EUS position
  $http.get('http://jsonproxy.herokuapp.com/?url=https://api.rtt.io/api/v1/json/service/P72728/' + today).success(function(data) {
    	$scope.eightsixteen = data.locations;
    });
  /*Fetch 0841 KGL-EUS position
  $http.get('http://jsonproxy.herokuapp.com/?url=https://api.rtt.io/api/v1/json/service/P72720/' + today).success(function(data) {
    	$scope.eightfortyone = data.locations;
    });*/
  
});

/*Angular Controller END*/
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console