HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
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.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
If the stylesheet you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
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.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
Search for and use JavaScript packages from npm here. By selecting a package, an import
statement will be added to the top of the JavaScript editor for this package.
Using packages here is powered by Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<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*/
Also see: Tab Triggers