From 91f6182a88937360773534caf1e63ca69d468d47 Mon Sep 17 00:00:00 2001 From: rosh Date: Sat, 1 Aug 2020 14:26:22 +0530 Subject: [PATCH 01/16] first commit --- Style.css | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ movies.js | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++ searchmovies.html | 20 +++++++++++++++++++ searchstyle.css | 32 +++++++++++++++++++++++++++++ 4 files changed, 167 insertions(+) create mode 100644 Style.css create mode 100644 movies.js create mode 100644 searchmovies.html create mode 100644 searchstyle.css diff --git a/Style.css b/Style.css new file mode 100644 index 0000000..9919b19 --- /dev/null +++ b/Style.css @@ -0,0 +1,60 @@ + +.login-page{ + width: 360px; + padding: 10% 0 0; + margin: auto; +} + +.form{ + position:relative; + z-index: 1; + background: #ff6666; + max-width: 360px; + margin: 0 auto 100px; + padding: 45px; + text-align: center; +} + +.form input{ + font-family: "Roboto", sans-serif; + outline: 1; + background: #f2f2f2; + width: 100%; + border:0; + margin: 0 0 15px; + padding: 15px; + box-sizing: border-box; + font-size: 14px; +} + +.form button{ + font-family: "Roboto", sans-serif; + text-transform: uppercase; + outline: 0; + background: #ffcc66; + width: 100%; + border: 0; + padding: 15px; + color: #FFFFFF; + font-size: 14; + cursor: pointer; +} + +.form button:hover,.form button:active{ + background:#43A047; +} + +.form .message{ + margin: 15px 0 0; + color: aliceblue; + font-family: "Roboto", sans-serif; + font-size: 14px; +} + +.form .message a{ + color: #f2f2f2; +} + +.form .register-form{ + display: none; +} \ No newline at end of file diff --git a/movies.js b/movies.js new file mode 100644 index 0000000..1dafb68 --- /dev/null +++ b/movies.js @@ -0,0 +1,55 @@ +$(document).ready(function(){ +$('.message a').click(function(){ + $('form').animate({height: "toggle", opacity: "toggle"},"slow"); +}) +}); + +async function submitForm(e, form){ + e.preventDefault(); + + try { + const response = await fetch('https://mkr.thefeathers.in/register', { + method: 'post', + body: JSON.stringify({ + "username": form.formName.value, + "email": form.formEmail.value, + "password": form.formPassword.value, + }) + }); + const data = await response.json(); + //Success code goes here + //window.location = "searchmovies.html"; + alert(JSON.stringify(data)); + $('form').animate({ height: "toggle", opacity: "toggle" }, "slow"); + } + catch (err) { + //Failure + alert('Error'); + } +} + + +async function submitForm1(e, form){ + e.preventDefault(); + + try { + const response = await fetch('https://mkr.thefeathers.in/login', { + method: 'POST', + body: JSON.stringify({ + "username" : document.getElementById('formName1').value, + "password" : document.getElementById('formPassword1').value + }) + }); + const data1 = await response.json(); + //Success code goes here + alert(JSON.stringify(data1)); + window.location = "searchmovies.html"; + } + catch (err) { + //Failure + alert('Error'); + } +} + + + \ No newline at end of file diff --git a/searchmovies.html b/searchmovies.html new file mode 100644 index 0000000..41db625 --- /dev/null +++ b/searchmovies.html @@ -0,0 +1,20 @@ + + + + Search Movies + + + + + + +
+
+
+ + +
+
+
+
+ \ No newline at end of file diff --git a/searchstyle.css b/searchstyle.css new file mode 100644 index 0000000..323f2ee --- /dev/null +++ b/searchstyle.css @@ -0,0 +1,32 @@ +.body{ + margin: 0; + padding: 0; +} + +.header{ + text-align: center; +} + +.search-movies{ + height: 50px; + padding: 10px; + border-radius: 25px; + width: 800px; + outline-width: 0; + display: inline-block; +} + +.form-box button:hover,.form-box button:active{ + background:#43A047; +} + +.search-btn{ + height: 50px; + width: 150px; + background: #ffeb3b; + border: none; + color: #000; + border-radius: 25px; + outline: 0; + cursor: pointer; +} From 668eeec7d5b7410a04ace743e450d4c84dab5588 Mon Sep 17 00:00:00 2001 From: rosh Date: Sat, 1 Aug 2020 14:39:41 +0530 Subject: [PATCH 02/16] adding Login.html --- Login.html | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Login.html diff --git a/Login.html b/Login.html new file mode 100644 index 0000000..6684fd4 --- /dev/null +++ b/Login.html @@ -0,0 +1,29 @@ + + + + Login and Registration Form + + + + + + + + + \ No newline at end of file From 9f5de526f3317f0275808e1bc6b9a2edf8a79640 Mon Sep 17 00:00:00 2001 From: rosh Date: Tue, 4 Aug 2020 12:45:27 +0530 Subject: [PATCH 03/16] adding search query --- Login.html | 4 ++-- movies.js | 43 ++++++++++++++++++++++++++++++++++++------- searchmovies.html | 2 +- 3 files changed, 39 insertions(+), 10 deletions(-) diff --git a/Login.html b/Login.html index 6684fd4..df13e93 100644 --- a/Login.html +++ b/Login.html @@ -10,14 +10,14 @@ +
\ No newline at end of file From e5a12f8d9996f59d1637df878098821570ead852 Mon Sep 17 00:00:00 2001 From: rosh Date: Thu, 6 Aug 2020 16:17:39 +0530 Subject: [PATCH 05/16] adding movies page --- movies.js | 66 +++++++++++++++++++++++++++++++++++++++++++++------------ moviesPage.html | 15 +++++++++++++ 2 files changed, 68 insertions(+), 13 deletions(-) create mode 100644 moviesPage.html diff --git a/movies.js b/movies.js index f253f74..38c6150 100644 --- a/movies.js +++ b/movies.js @@ -1,12 +1,8 @@ -var searchkey; + $(document).ready(function(){ $('.message a').click(function(){ $('form').animate({height: "toggle", opacity: "toggle"},"slow"); }); - -$('.search-btn').click(function() { - searchkey= $('.search-movies').val(); - }); }); async function submitForm(e){ @@ -61,6 +57,7 @@ async function submitForm1(e){ async function search(e){ e.preventDefault(); + var searchkey= $('.search-movies').val(); var Token=window.localStorage.getItem('Token'); try { const response = await fetch('https://mkr.thefeathers.in/search/'+searchkey, { @@ -71,16 +68,29 @@ async function search(e){ //Success code goes here //window.location = "searchmovies.html"; alert(JSON.stringify(data2)); - var str = '
    ' - var result = data2.results; - result.forEach(myfunction); + var results =data2.results; + if(!results) return; + + var listItems = results.map(myfunction); + window.localStorage.setItem('movieID', (results.movieID)); + var movieID=window.localStorage.getItem('movieID'); - function myfunction(slide){ - str += '
  • '+ slide + '
  • '; + function myfunction(results){ + var x = document.createElement("li"); + var a = document.createElement("a"); + var t = document.createTextNode(results.title); + x.appendChild(a); + a.appendChild(t); + a.setAttribute("href","https://mkr.thefeathers.in/movie/"+movieID); + x.setAttribute("class","list"); + return x; + } - - str += '
'; - document.getElementById("slideContainer").innerHTML = str; + document.getElementById("slideContainer").append(...listItems); + + $('.list').click(function(event){ + moviePage(event); + }); } catch (err) { //Failure @@ -88,5 +98,35 @@ async function search(e){ } } +async function moviePage(e){ + e.preventDefault(); + var Token=window.localStorage.getItem('Token'); + var movieID=window.localStorage.getItem('movieID'); + window.location = "searchmovies.html"; + try { + const response = await fetch('https://mkr.thefeathers.in/movie/'+movieID, { + method: 'GET', + headers: new Headers({'content-type': 'application/json', 'Authentication': Token }), + }); + const data3 = await response.json(); + //Success code goes here + alert(JSON.stringify(data3)); + var results1 =data2.results; + + window.location = "moviesPage.html"; + document.getElementById("Container").append(results1.movieID); + document.getElementById("Container").append(results1.title); + document.getElementById("Container").append(results1.overview); + document.getElementById("Container").append(results1.poster); + document.getElementById("Container").append(results1.release); + document.getElementById("Container").append(results1.watchStatus); + document.getElementById("Container").append(results1.rating); + + } + catch (err) { + //Failure + alert('Error'); + } +} \ No newline at end of file diff --git a/moviesPage.html b/moviesPage.html new file mode 100644 index 0000000..e0786a0 --- /dev/null +++ b/moviesPage.html @@ -0,0 +1,15 @@ + + + + Search Movies + + + + + + +
+
+ +
+ \ No newline at end of file From 91602dbb37ab6740a12e484c2216d209f3a9d1c0 Mon Sep 17 00:00:00 2001 From: rosh Date: Thu, 6 Aug 2020 17:47:30 +0530 Subject: [PATCH 06/16] adding movies page --- movies.js | 41 +++-------------------------------------- moviesPage.html | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 39 deletions(-) diff --git a/movies.js b/movies.js index 38c6150..f9fc965 100644 --- a/movies.js +++ b/movies.js @@ -72,25 +72,19 @@ async function search(e){ if(!results) return; var listItems = results.map(myfunction); - window.localStorage.setItem('movieID', (results.movieID)); - var movieID=window.localStorage.getItem('movieID'); - function myfunction(results){ + function myfunction(result){ var x = document.createElement("li"); var a = document.createElement("a"); - var t = document.createTextNode(results.title); + var t = document.createTextNode(result.title); x.appendChild(a); a.appendChild(t); - a.setAttribute("href","https://mkr.thefeathers.in/movie/"+movieID); + a.setAttribute("href","/moviesPage?movieId=" + result.movieId); x.setAttribute("class","list"); return x; } document.getElementById("slideContainer").append(...listItems); - - $('.list').click(function(event){ - moviePage(event); - }); } catch (err) { //Failure @@ -98,35 +92,6 @@ async function search(e){ } } -async function moviePage(e){ - e.preventDefault(); - var Token=window.localStorage.getItem('Token'); - var movieID=window.localStorage.getItem('movieID'); - window.location = "searchmovies.html"; - try { - const response = await fetch('https://mkr.thefeathers.in/movie/'+movieID, { - method: 'GET', - headers: new Headers({'content-type': 'application/json', 'Authentication': Token }), - }); - const data3 = await response.json(); - //Success code goes here - alert(JSON.stringify(data3)); - var results1 =data2.results; - window.location = "moviesPage.html"; - document.getElementById("Container").append(results1.movieID); - document.getElementById("Container").append(results1.title); - document.getElementById("Container").append(results1.overview); - document.getElementById("Container").append(results1.poster); - document.getElementById("Container").append(results1.release); - document.getElementById("Container").append(results1.watchStatus); - document.getElementById("Container").append(results1.rating); - - } - catch (err) { - //Failure - alert('Error'); - } -} \ No newline at end of file diff --git a/moviesPage.html b/moviesPage.html index e0786a0..87c51ee 100644 --- a/moviesPage.html +++ b/moviesPage.html @@ -10,6 +10,38 @@
-
+ \ No newline at end of file From 33f248ab8bd3490de1a748b362e8f22da5c2246b Mon Sep 17 00:00:00 2001 From: rosh Date: Fri, 7 Aug 2020 14:03:34 +0530 Subject: [PATCH 07/16] movie page changes --- moviesPage.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/moviesPage.html b/moviesPage.html index 87c51ee..52707e0 100644 --- a/moviesPage.html +++ b/moviesPage.html @@ -12,6 +12,8 @@