Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

finishing touches #77

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@ <h2 class="selected-line"></h2>

<section class="choose-your-line">
<div>
<button class="overground" name="tube-lines" value="london-overground">London Overground</button>
<button class="circle" name="tube-lines" value="circle">Circle Line</button>
<button class="hammersmith" name="tube-lines" value="hammersmith-city">Hammersmith & City Line</button>
<button class="metropolitan" name="tube-lines" value="metropolitan">Metropolitan Line</button>
<button class="bakerloo" name="tube-lines" value="bakerloo">Bakerloo Line</button>
<button class="central" name="tube-lines" value="central">Central Line</button>
<button class="district" name="tube-lines" value="district">District Line</button>
<button class="jubilee" name="tube-lines" value="jubilee">Jubilee Line</button>
<button class="overground" name="tube-lines" value="london-overground">Overground</button>
<button class="circle" name="tube-lines" value="circle">Circle</button>
<button class="hammersmith" name="tube-lines" value="hammersmith-city">Hammersmith & City</button>
<button class="metropolitan" name="tube-lines" value="metropolitan">Metropolitan</button>
<button class="bakerloo" name="tube-lines" value="bakerloo">Bakerloo</button>
<button class="central" name="tube-lines" value="central">Central</button>
<button class="district" name="tube-lines" value="district">District</button>
<button class="jubilee" name="tube-lines" value="jubilee">Jubilee</button>
<button class="northern" name="tube-lines" value="northern">Northern</button>
<button class="piccadilly" name="tube-lines" value="piccadilly">Piccadilly Line</button>
<button class="victoria" name="tube-lines" value="victoria">Victoria Line</button>
<button class="waterloo-city" name="tube-lines" value="waterloo-city">Waterloo & City Line</button>
<button class="piccadilly" name="tube-lines" value="piccadilly">Piccadilly</button>
<button class="victoria" name="tube-lines" value="victoria">Victoria</button>
<button class="waterloo-city" name="tube-lines" value="waterloo-city">Waterloo & City</button>
<button class="tfl-rail" name="tube-lines" value="tfl-rail">TFL Rail</button>
<button class="dlr" name="tube-lines" value="dlr">DLR</button>
<button class="tram" name="tube-lines" value="tram">Tram</button>
Expand All @@ -46,4 +46,4 @@ <h2 class="selected-line"></h2>
<script src="./js/logic.js"></script>
<script src="./js/dom.js"></script>

</html>
</html>
30 changes: 15 additions & 15 deletions js/dom.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
( function() {
var render = function( resultsObj ) {
var lineTitleSelector = document.getElementsByClassName('selected-line')[0];
var imageSelector = document.getElementsByClassName('giphy')[0];
var captionSelector = document.getElementsByClassName('status-severity')[0];
var render = function( resultsObj ) {
var lineTitleSelector = document.getElementsByClassName('selected-line')[0];
var imageSelector = document.getElementsByClassName('giphy')[0];
var captionSelector = document.getElementsByClassName('status-severity')[0];

imageSelector.src = resultsObj.url;
imageSelector.setAttribute('alt', resultsObj.status);
imageSelector.setAttribute('title', resultsObj.status);
captionSelector.textContent = resultsObj.status;
lineTitleSelector.style.padding = '1%';
lineTitleSelector.style.backgroundColor = linesColours[resultsObj.line][0];
lineTitleSelector.style.color = linesColours[resultsObj.line][1];
lineTitleSelector.textContent = resultsObj.lineName;
imageSelector.src = resultsObj.url;
imageSelector.setAttribute('alt', resultsObj.status);
imageSelector.setAttribute('title', resultsObj.status);
captionSelector.textContent = resultsObj.status;
lineTitleSelector.style.padding = '1%';
lineTitleSelector.style.backgroundColor = linesColours[resultsObj.line][0];
lineTitleSelector.style.color = linesColours[resultsObj.line][1];
lineTitleSelector.textContent = resultsObj.lineName;

};
};

( function() {
var tubeLines = document.getElementsByName('tube-lines'),
chooseLine = document.getElementsByClassName('choose-your-line')[0];

chooseLine.addEventListener( 'click', function( e ) {
logicObj.init( e.target.value, e.target.textContent, render);
logicObj.init( e.target.value, e.target.textContent);
});
}() );
8 changes: 4 additions & 4 deletions js/logic.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var logicObj = {
logicObj.resultsObj.url = gifSrc;
},

waterfall: function(tasksArray, urlsArray, render) {
waterfall: function(tasksArray, urlsArray) {
if (tasksArray.length > 0) {

var task = tasksArray[0];
Expand All @@ -52,7 +52,7 @@ var logicObj = {

logicObj.apiCall(url, function(data) {
task(data);
logicObj.waterfall(remainingTasks, remainingUrls, render);
logicObj.waterfall(remainingTasks, remainingUrls);
})

}
Expand All @@ -61,10 +61,10 @@ var logicObj = {
}
},

init: function(line, lineName, render) {
init: function(line, lineName) {
logicObj.resultsObj.line = line;
logicObj.resultsObj.lineName = lineName;
logicObj.waterfall([logicObj.tflCb, logicObj.giphyCb], [logicObj.makeTflUrl, logicObj.makeGiphyUrl], render);
logicObj.waterfall([logicObj.tflCb, logicObj.giphyCb], [logicObj.makeTflUrl, logicObj.makeGiphyUrl]);
}

}
Expand Down
Binary file added resources/London-Tube.ttf
Binary file not shown.
Binary file removed resources/fire-tunnel.jpg
Binary file not shown.
Binary file removed resources/fire.jpg
Binary file not shown.
Binary file removed resources/underground-symbol.png
Binary file not shown.
13 changes: 9 additions & 4 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ body {
line-height: 1;
}

@font-face {
font-family: "London Tube";
src: url(./resources/London-Tube.ttf);
}

body {
font-family: "London Tube", sans-serif;
background-color: black;
Expand Down Expand Up @@ -67,14 +72,14 @@ button {
display: inline-block;
font-size: 1rem;
width: 30%;
height: 50px;
height: 60px;
text-align: center;
white-space: nowrap;
opacity: 0.8;
padding: 1%;
margin: 0;
position: relative;
margin: 0.1rem 0;
border: none;
overflow: hidden;
text-overflow: hidden;
}

.choose-your-line {
Expand Down