Commit 6f2819ac authored by tmeyrick's avatar tmeyrick
Browse files

Added leaflet images

parents 3ed66b98 bf5cbab8
Pipeline #4049 passed with stage
in 2 seconds
...@@ -218,44 +218,41 @@ var Validator = (function () { ...@@ -218,44 +218,41 @@ var Validator = (function () {
messages = []; messages = [];
errorHTML = ""; errorHTML = "";
// Validate Address Details // Validate Address Details
checkAddress(document.getElementById("deliveryAddress1").value, messages); checkAddress($("#deliveryAddress1").val(), messages);
checkName(document.getElementById("deliveryName").value, messages); checkName($("#deliveryName").val(), messages);
checkEmail(document.getElementById("deliveryEmail").value, messages); checkEmail($("#deliveryEmail").val(), messages);
// TO BE ADDED // TO BE ADDED
// Validate Credit Card Details // Validate Credit Card Details
// This depends a bit on the type of card, so get that first // This depends a bit on the type of card, so get that first
cardType = document.getElementById("cardType").value; cardType = $("#cardType").val();
// Credit card number validation // Credit card number validation
cardNumber = document.getElementById("cardNumber").value; cardNumber = $("#cardNumber").val();
checkCreditCardNumber(cardType, cardNumber, messages); checkCreditCardNumber(cardType, cardNumber, messages);
// Expiry date validation // Expiry date validation
cardMonth = document.getElementById("cardMonth").value; cardMonth = $("#cardMonth").val();
cardYear = document.getElementById("cardYear").value; cardYear = $("#cardYear").val();
checkCreditCardDate(cardMonth, cardYear, messages); checkCreditCardDate(cardMonth, cardYear, messages);
// CVC validation // CVC validation
cardValidation = document.getElementById("cardValidation").value; cardValidation = $("#cardValidation").val();
checkCreditCardValidation(cardType, cardValidation, messages); checkCreditCardValidation(cardType, cardValidation, messages);
if (messages.length === 0) { if (messages.length === 0) {
// Checkout successful, clear the cart // Checkout successful, clear the cart
window.sessionStorage.clear(); window.sessionStorage.clear();
document.getElementById("errorMsgs").innerHTML = "<p>Your order has been submitted</p>"; $("#errorMsgs").innerHTML = "<p>Your order has been submitted</p>";
} else { } else {
errorHTML = "<ul>"; errorHTML = "<ul>";
for (i = 0; i < messages.length; i++) { for (i = 0; i < messages.length; i++) {
errorHTML += "<li>" + messages[i] + "</li>"; errorHTML += "<li>" + messages[i] + "</li>";
} }
errorHTML += "</ul>"; errorHTML += "</ul>";
document.getElementById("errorMsgs").innerHTML = errorHTML; $("#errorMsgs").innerHTML = errorHTML;
} }
// Stop the form from submitting, which would trigger a page load // Stop the form from submitting, which would trigger a page load
...@@ -277,6 +274,9 @@ var Validator = (function () { ...@@ -277,6 +274,9 @@ var Validator = (function () {
document.getElementById("cardNumber").onkeypress = checkKeyIsDigit; document.getElementById("cardNumber").onkeypress = checkKeyIsDigit;
document.getElementById("cardValidation").onkeypress = checkKeyIsDigit; document.getElementById("cardValidation").onkeypress = checkKeyIsDigit;
document.getElementById("deliveryPostcode").onkeypress = checkKeyIsDigit; document.getElementById("deliveryPostcode").onkeypress = checkKeyIsDigit;
$("#cardNumber").onkeypress = checkKeyIsDigit;
$("#cardValidation").onkeypress = checkKeyIsDigit;
$("#deliveryPostcode").onkeypress = checkKeyIsDigit;
}; };
// Expose public interface // Expose public interface
...@@ -284,10 +284,4 @@ var Validator = (function () { ...@@ -284,10 +284,4 @@ var Validator = (function () {
}()); }());
// The usual onload event handling to call SampleValidator.setup // The usual onload event handling to call SampleValidator.setup
if (window.addEventListener) { $(document).ready(Validator.setup);
window.addEventListener('load', Validator.setup); \ No newline at end of file
} else if (window.attachEvent) {
window.attachEvent('onload', Validator.setup);
} else {
alert("Could not attach 'Validator.setup' to the 'window.onload' event");
}
\ No newline at end of file
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<title>Classic Cinema</title> <title>Classic Cinema</title>
<meta charset="utf-8"> <meta charset="utf-8">
<link rel="stylesheet" href="style.css"> <link rel="stylesheet" href="style.css">
<script src="jquery.min.js"></script>
</head> </head>
......
...@@ -4,14 +4,12 @@ var Cart = (function() { ...@@ -4,14 +4,12 @@ var Cart = (function() {
function addToCart() { function addToCart() {
var cartlist = []; var cartlist = [];
var titleOfMovie = $(this).parent().siblings("h3")[0].innerHTML;
var movie = this.parentNode.parentNode; var priceOfMovie = $(this).siblings(".price")[0].innerHTML;
var titleOfMovie = movie.getElementsByTagName("h3")[0].innerHTML;
var priceOfMovie = movie.getElementsByClassName("price")[0].innerHTML;
var myObject = {title: titleOfMovie, price: priceOfMovie}; var myObject = {title: titleOfMovie, price: priceOfMovie};
if (window.sessionStorage.getItem("cartlist") != null) { if (window.sessionStorage.getItem("cartlist") != null) {
cartlist = JSON.parse(window.sessionStorage.getItem("cartlist")); cartlist = $.parseJSON(window.sessionStorage.getItem("cartlist"));
cartlist.push(myObject); cartlist.push(myObject);
window.sessionStorage.setItem("cartlist", JSON.stringify(cartlist)); window.sessionStorage.setItem("cartlist", JSON.stringify(cartlist));
} else { } else {
...@@ -21,15 +19,16 @@ var Cart = (function() { ...@@ -21,15 +19,16 @@ var Cart = (function() {
} }
pub.setup = function() { pub.setup = function() {
var buttons = document.getElementsByClassName("buy"); var buttons = $(".buy");
// var buttons = document.getElementsByClassName("buy");
for (let button of buttons) { for (let button of buttons) {
button.onclick = addToCart; $(button).click(addToCart);
} }
}; };
/*let /*
When the 'add to cart' button is pushed, create an object with When the 'add to cart' button is pushed, create an object with
two data fields - a title and a price. two data fields - a title and a price.
...@@ -40,11 +39,7 @@ var Cart = (function() { ...@@ -40,11 +39,7 @@ var Cart = (function() {
}()); }());
if (window.addEventListener) {
window.addEventListener('load', Cart.setup);
} else if (window.attachEvent) {
window.attachEvent('onload', Cart.setup);
}
$(document).ready(Cart.setup);
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<title>Classic Cinema</title> <title>Classic Cinema</title>
<meta charset="utf-8"> <meta charset="utf-8">
<link rel="stylesheet" href="style.css"> <link rel="stylesheet" href="style.css">
</head> <script src="jquery.min.js"></script>
</head>
<body>
<body>
<header>
<h1>Classic Cinema</h1> <header>
<h1>Classic Cinema</h1>
<div id="user">
<div id="login"> <div id="user">
<form id="loginForm"> <div id="login">
<label for="loginUser">Username: </label> <form id="loginForm">
<input type="text" name="loginUser" id="loginUser"><br> <label for="loginUser">Username: </label>
<label for="loginPassword">Password: </label> <input type="text" name="loginUser" id="loginUser"><br>
<input type="password" name="loginPassword" id="loginPassword"><br> <label for="loginPassword">Password: </label>
<input type="submit" id="loginSubmit" value="Login"> <input type="password" name="loginPassword" id="loginPassword"><br>
</form> <input type="submit" id="loginSubmit" value="Login">
</div> </form>
</div>
<div id="logout">
<p>Welcome, <span id="logoutUser"></span></p> <div id="logout">
<form id="logoutForm"> <p>Welcome, <span id="logoutUser"></span></p>
<input type="submit" id="logoutSubmit" value="Logout"> <form id="logoutForm">
</form> <input type="submit" id="logoutSubmit" value="Logout">
</div> </form>
</div> </div>
<nav> </div>
<ul> <nav>
<li> <a href="index.html">Home</a> <ul>
<li> Classics <li> <a href="index.html">Home</a>
<li> <a href="scifi.html">Sci&nbsp;Fi</a> <li> Classics
<li> <a href="hitchcock.html">Hitchcock</a> <li> <a href="scifi.html">Sci&nbsp;Fi</a>
<li><a href="contact.html">Contact</a></li> <li> <a href="hitchcock.html">Hitchcock</a>
</ul> <li><a href="contact.html">Contact</a></li>
</nav> <li><a href="cart.html">Cart</a></li>
</header> </ul>
</nav>
</header>
<main>
<h2>Classic Films</h2>
<main>
<section class="film"> <h2>Classic Films</h2>
<img src="images/Gone_With_the_Wind.jpg" alt="Gone With the Wind">
<h3>Gone With the Wind (1939)</h3> <section class="film">
<p>Directed by: Victor Fleming, George Cukor, Sam Wood</p> <img src="images/Gone_With_the_Wind.jpg" alt="Gone With the Wind">
<p>Starring: Clark Gable, Vivien Leigh, Leslie Howard, Olivia de Havilland, Hattie McDaniel</p> <h3>Gone With the Wind (1939)</h3>
<p>An epic historical romance and winner of 8 Academy Awards (from 13 nominations).</p> <p>Directed by: Victor Fleming, George Cukor, Sam Wood</p>
<p> <p>Starring: Clark Gable, Vivien Leigh, Leslie Howard, Olivia de Havilland, Hattie McDaniel</p>
$<span class="price">13.99</span> <p>An epic historical romance and winner of 8 Academy Awards (from 13 nominations).</p>
<input type="button" value="Add to Cart" class="buy"> <p>
</p> $<span class="price">13.99</span>
</section> <input type="button" value="Add to Cart" class="buy">
</p>
<section class="film"> </section>
<img src="images/The_Jazz_Singer.jpg" alt="The Jazz Singer">
<h3>The Jazz Singer (1927)</h3> <section class="film">
<p>Directed by: Alan Crosland</p> <img src="images/The_Jazz_Singer.jpg" alt="The Jazz Singer">
<p>Starring: Al Jolson, May McAvoy, Warner Oland, Cantor Rosenblatt</p> <h3>The Jazz Singer (1927)</h3>
<p>The first feature length 'talkie', The Jazz Singer is a piece of cinematic history</p> <p>Directed by: Alan Crosland</p>
<p> <p>Starring: Al Jolson, May McAvoy, Warner Oland, Cantor Rosenblatt</p>
$<span class="price">13.99</span> <p>The first feature length 'talkie', The Jazz Singer is a piece of cinematic history</p>
<input type="button" value="Add to Cart" class="buy"> <p>
</p> $<span class="price">13.99</span>
</section> <input type="button" value="Add to Cart" class="buy">
</p>
<section class="film"> </section>
<img src="images/Metropolis.jpg" alt="Metropolis">
<h3>Metropolis (1927)</h3> <section class="film">
<p>Directed by: Fritz Lang</p> <img src="images/Metropolis.jpg" alt="Metropolis">
<p>Starring: Alfred Abel, Brigitte Helm, Gustav Fr&ouml;hlich, Rudolf Klein-Rogge</p> <h3>Metropolis (1927)</h3>
<p>A lovingly restored version of Fritz Lang's dystopian masterpiece, one of the great achievements of the silent era.</p> <p>Directed by: Fritz Lang</p>
<p> <p>Starring: Alfred Abel, Brigitte Helm, Gustav Fr&ouml;hlich, Rudolf Klein-Rogge</p>
$<span class="price">19.99</span> <p>A lovingly restored version of Fritz Lang's dystopian masterpiece, one of the great achievements of the silent era.</p>
<input type="button" value="Add to Cart" class="buy"> <p>
</p> $<span class="price">19.99</span>
</section> <input type="button" value="Add to Cart" class="buy">
</p>
</main> </section>
<footer> </main>
<p>
Classic Cinema is not a real store. No products are available, and no money will be accepted. <footer>
<p> <p>
All images from <a href="http://commons.wikimedia.org/wiki/Main_Page">Wikimedia Commons</a> and are believed to be in the public domain. Classic Cinema is not a real store. No products are available, and no money will be accepted.
</p> <p>
</footer> All images from <a href="http://commons.wikimedia.org/wiki/Main_Page">Wikimedia Commons</a> and are believed to be in the public domain.
</p>
<script src="showHide.js"></script> </footer>
<script src="cart.js"></script>
</body> <script src="showHide.js"></script>
<script src="cart.js"></script>
</body>
</html> </html>
\ No newline at end of file
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
<li><a href="scifi.html">Sci&nbsp;Fi</a> <li><a href="scifi.html">Sci&nbsp;Fi</a>
<li><a href="hitchcock.html">Hitchcock</a> <li><a href="hitchcock.html">Hitchcock</a>
<li>Contact</li> <li>Contact</li>
<li><a href="cart.html">Cart</a></li>
</ul> </ul>
......
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<title>Classic Cinema</title> <title>Classic Cinema</title>
<meta charset="utf-8"> <meta charset="utf-8">
<link rel="stylesheet" href="style.css"> <link rel="stylesheet" href="style.css">
</head> <script src="jquery.min.js"></script>
</head>
<body>
<body>
<header>
<h1>Classic Cinema</h1> <header>
<h1>Classic Cinema</h1>
<div id="user">
<div id="login"> <div id="user">
<form id="loginForm"> <div id="login">
<label for="loginUser">Username: </label> <form id="loginForm">
<input type="text" name="loginUser" id="loginUser"><br> <label for="loginUser">Username: </label>
<label for="loginPassword">Password: </label> <input type="text" name="loginUser" id="loginUser"><br>
<input type="password" name="loginPassword" id="loginPassword"><br> <label for="loginPassword">Password: </label>
<input type="submit" id="loginSubmit" value="Login"> <input type="password" name="loginPassword" id="loginPassword"><br>
</form> <input type="submit" id="loginSubmit" value="Login">
</div> </form>
</div>
<div id="logout">
<p>Welcome, <span id="logoutUser"></span></p> <div id="logout">
<form id="logoutForm"> <p>Welcome, <span id="logoutUser"></span></p>
<input type="submit" id="logoutSubmit" value="Logout"> <form id="logoutForm">
</form> <input type="submit" id="logoutSubmit" value="Logout">
</div> </form>
</div> </div>
</div>
<nav>
<ul> <nav>
<li> <a href="index.html">Home</a> <ul>
<li> <a href="classic.html">Classics</a> <li> <a href="index.html">Home</a>
<li> <a href="scifi.html">Sci&nbsp;Fi</a> <li> <a href="classic.html">Classics</a>
<li> Hitchcock <li> <a href="scifi.html">Sci&nbsp;Fi</a>
<li><a href="contact.html">Contact</a></li> <li> Hitchcock
</ul> <li><a href="contact.html">Contact</a></li>
<li><a href="cart.html">Cart</a></li>
</nav> </ul>
</header>
</nav>
</header>
<main>
<h2>Alfred Hitchcock</h2>
<main>
<section class="film"> <h2>Alfred Hitchcock</h2>
<img src="images/The_Birds.jpg" alt="The Birds">
<h3>The Birds (1963)</h3> <section class="film">
<p>Directed by: Alfred Hitchcock</p> <img src="images/The_Birds.jpg" alt="The Birds">
<p>Starring: Rod Taylor, Jessica Tandy, Suzanne Pleshette, Tippi Hedren</p> <h3>The Birds (1963)</h3>
<p>The follow up to his box office sensation, <em>Psycho</em>, the Birds mixes suspense and horror from an everyday source.</p> <p>Directed by: Alfred Hitchcock</p>
<p> <p>Starring: Rod Taylor, Jessica Tandy, Suzanne Pleshette, Tippi Hedren</p>
$<span class="price">14.99</span> <p>The follow up to his box office sensation, <em>Psycho</em>, the Birds mixes suspense and horror from an everyday source.</p>
<input type="button" value="Add to Cart" class="buy"> <p>
</p> $<span class="price">14.99</span>
</section> <input type="button" value="Add to Cart" class="buy">
</p>
<section class="film"> </section>
<img src="images/Dial_M_for_Murder.jpg" alt="Dial M for Murder">
<h3>Dial M for Murder (1954)</h3> <section class="film">
<p>Directed by: Alfred Hitchcock</p> <img src="images/Dial_M_for_Murder.jpg" alt="Dial M for Murder">
<p>Starring: Ray Milland, Grace Kelly, Robert Cimmings, John Williams</p> <h3>Dial M for Murder (1954)</h3>
<p>Shot in 3D, but only released in 2D because of lack of interest in the process, it was shown in 3D in the 1980s, and has recently been released in 3D Blu-ray format.</p> <p>Directed by: Alfred Hitchcock</p>
<p> <p>Starring: Ray Milland, Grace Kelly, Robert Cimmings, John Williams</p>
$<span class="price">12.99</span> <p>Shot in 3D, but only released in 2D because of lack of interest in the process, it was shown in 3D in the 1980s, and has recently been released in 3D Blu-ray format.</p>
<input type="button" value="Add to Cart" class="buy"> <p>
</p> $<span class="price">12.99</span>
</section> <input type="button" value="Add to Cart" class="buy">
</p>
<section class="film"> </section>
<img src="images/The_Man_Who_Knew_Too_Much.jpg" alt="The Man Who Knew Too Much">
<h3>The Man Who Knew Too Much (1956)</h3> <section class="film">
<p>Directed by: Alfred Hitchcock</p> <img src="images/The_Man_Who_Knew_Too_Much.jpg" alt="The Man Who Knew Too Much">
<p>Starring: James Stewart, Doris Day, Brenda De Banzie, Bernard Miles, Alan Mowbray, Hillary Brooke, Christopher Olsen</p> <h3>The Man Who Knew Too Much (1956)</h3>
<p>Hitchcock's remake of his own earlier (1934) version.</p> <p>Directed by: Alfred Hitchcock</p>
<p> <p>Starring: James Stewart, Doris Day, Brenda De Banzie, Bernard Miles, Alan Mowbray, Hillary Brooke, Christopher Olsen</p>
$<span class="price">11.99</span> <p>Hitchcock's remake of his own earlier (1934) version.</p>
<input type="button" value="Add to Cart" class="buy"> <p>
</p> $<span class="price">11.99</span>
</section> <input type="button" value="Add to Cart" class="buy">
</p>
<section class="film"> </section>
<img src="images/North_by_Northwest.jpg" alt="North by Northwest">
<h3>North by Northwest (1959)</h3> <section class="film">
<p>Directed by: Alfred Hitchcock</p> <img src="images/North_by_Northwest.jpg" alt="North by Northwest">
<p>Starring: Cary Grant, Eva Marie Saint, James Mason, Jessie Royce Landis</p> <h3>North by Northwest (1959)</h3>
<p>A classic thriller in which an innocent man is pursued by mysterious agents over government secrets.</p> <p>Directed by: Alfred Hitchcock</p>
<p> <p>Starring: Cary Grant, Eva Marie Saint, James Mason, Jessie Royce Landis</p>
$<span class="price">14.99</span> <p>A classic thriller in which an innocent man is pursued by mysterious agents over government secrets.</p>
<input type="button" value="Add to Cart" class="buy"> <p>
</p> $<span class="price">14.99</span>
</section> <input type="button" value="Add to Cart" class="buy">
</p>
<section class="film"> </section>
<img src="images/Vertigo.jpg" alt="Vertigo">
<h3>Vertigo (1958)</h3> <section class="film">
<p>Directed by: Alfred Hitchcock</p> <img src="images/Vertigo.jpg" alt="Vertigo">
<p>Starring: James Stuart, Kim Novak, Barbara Bel Geddes</p> <h3>Vertigo (1958)</h3>
<p>A classic piece of Hitchcock, often included in lists of the best films of all time.</p> <p>Directed by: Alfred Hitchcock</p>
<p> <p>Starring: James Stuart, Kim Novak, Barbara Bel Geddes</p>
$<span class="price">16.99</span> <p>A classic piece of Hitchcock, often included in lists of the best films of all time.</p>
<input type="button" value="Add to Cart" class="buy"> <p>
</p> $<span class="price">16.99</span>
</section> <input type="button" value="Add to Cart" class="buy">
</p>
</main> </section>
<footer> </main>
<p>
Classic Cinema is not a real store. No products are available, and no money will be accepted. <footer>
<p> <p>
All images from <a href="http://commons.wikimedia.org/wiki/Main_Page">Wikimedia Commons</a> and are believed to be in the public domain. Classic Cinema is not a real store. No products are available, and no money will be accepted.
</p> <p>
</footer> All images from <a href="http://commons.wikimedia.org/wiki/Main_Page">Wikimedia Commons</a> and are believed to be in the public domain.
</p>
<script src="showHide.js"></script> </footer>
<script src="cart.js"></script>
</body> <script src="showHide.js"></script>
<script src="cart.js"></script>
</body>
</html> </html>
\ No newline at end of file
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
<li> <a href="scifi.html">Sci&nbsp;Fi</a> <li> <a href="scifi.html">Sci&nbsp;Fi</a>
<li> <a href="hitchcock.html">Hitchcock</a> <li> <a href="hitchcock.html">Hitchcock</a>
<li><a href="contact.html">Contact</a></li>