From d03bc37283ffff817db9df684722388c12706981 Mon Sep 17 00:00:00 2001 From: "Glitch (a2-benemrick)" Date: Thu, 5 Sep 2019 16:50:31 +0000 Subject: [PATCH 01/61] =?UTF-8?q?=F0=9F=91=B4=F0=9F=8C=BD=20Checkpoint?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shrinkwrap.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 shrinkwrap.yaml diff --git a/shrinkwrap.yaml b/shrinkwrap.yaml new file mode 100644 index 00000000..86c7048d --- /dev/null +++ b/shrinkwrap.yaml @@ -0,0 +1,15 @@ +dependencies: + mime: 2.4.4 +packages: + /mime/2.4.4: + dev: false + engines: + node: '>=4.0.0' + hasBin: true + resolution: + integrity: sha512-LRxmNwziLPT828z+4YkNzloCFC2YM4wrB99k+AV5ZbEyfGNWfG8SO1FUXLmLDBSo89NrJZ4DIWeLjy1CHGhMGA== +registry: 'https://registry.npmjs.org/' +shrinkwrapMinorVersion: 9 +shrinkwrapVersion: 3 +specifiers: + mime: ^2.4.4 From 7308e6d26047cdffd9d8752401784808b96adaad Mon Sep 17 00:00:00 2001 From: "Glitch (a2-benemrick)" Date: Fri, 6 Sep 2019 18:25:57 +0000 Subject: [PATCH 02/61] =?UTF-8?q?=F0=9F=95=8D=F0=9F=8D=8E=20Checkpoint=20.?= =?UTF-8?q?/public/css/style.css:2480412/316=20./public/index.html:2480412?= =?UTF-8?q?/1293?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/css/style.css | 11 ++++++++++- public/index.html | 16 +++++++++++++--- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/public/css/style.css b/public/css/style.css index d5f842ab..9b105a6e 100755 --- a/public/css/style.css +++ b/public/css/style.css @@ -1 +1,10 @@ -/*Style your own assignment! This is fun! */ \ No newline at end of file +/*Style your own assignment! This is fun! */ + +.gradient { + background: #abbaab; + /* fallback for old browsers */ + background: -webkit-linear-gradient(to right, #ffffff, #abbaab); + /* Chrome 10-25, Safari 5.1-6 */ + background: linear-gradient(to right, #ffffff, #abbaab); + /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */ +} \ No newline at end of file diff --git a/public/index.html b/public/index.html index c56d620e..a9993f25 100755 --- a/public/index.html +++ b/public/index.html @@ -1,12 +1,22 @@ - CS4241 Assignment 2 + Shopr + -
- + +
From cfb17510b590238b24e3f3289e928f17732e4d3e Mon Sep 17 00:00:00 2001 From: "Glitch (a2-benemrick)" Date: Fri, 6 Sep 2019 18:49:54 +0000 Subject: [PATCH 03/61] =?UTF-8?q?=F0=9F=93=9F=F0=9F=9B=8D=20Checkpoint=20.?= =?UTF-8?q?/public/index.html:2480412/432=20./public/css/style.css:2480412?= =?UTF-8?q?/13?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/css/style.css | 2 +- public/index.html | 12 ++---------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/public/css/style.css b/public/css/style.css index 9b105a6e..bd0f55d6 100755 --- a/public/css/style.css +++ b/public/css/style.css @@ -1,6 +1,6 @@ /*Style your own assignment! This is fun! */ -.gradient { +body { background: #abbaab; /* fallback for old browsers */ background: -webkit-linear-gradient(to right, #ffffff, #abbaab); diff --git a/public/index.html b/public/index.html index a9993f25..8afc1cd6 100755 --- a/public/index.html +++ b/public/index.html @@ -3,16 +3,8 @@ Shopr - + +
From 797eac3f95ee23089e517935810e32e54731aca3 Mon Sep 17 00:00:00 2001 From: "Glitch (a2-benemrick)" Date: Fri, 6 Sep 2019 19:11:57 +0000 Subject: [PATCH 04/61] =?UTF-8?q?=F0=9F=8C=BC=F0=9F=91=9A=20Checkpoint=20.?= =?UTF-8?q?/public/index.html:2480412/46?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 43 ------------------------------------------- 1 file changed, 43 deletions(-) diff --git a/public/index.html b/public/index.html index 8afc1cd6..e69de29b 100755 --- a/public/index.html +++ b/public/index.html @@ -1,43 +0,0 @@ - - - - Shopr - - - - - - - - - - - - From 557b8b8cbe84c3cf643f54672366f7a1ee74a96b Mon Sep 17 00:00:00 2001 From: "Glitch (a2-benemrick)" Date: Fri, 6 Sep 2019 19:23:58 +0000 Subject: [PATCH 05/61] =?UTF-8?q?=F0=9F=A7=80=F0=9F=8D=99=20Checkpoint=20.?= =?UTF-8?q?/public/index.html:2480412/206=20./.glitch-assets:2480412/850?= =?UTF-8?q?=20./public/css/style.css:2480412/69?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .glitch-assets | 2 ++ public/css/style.css | 7 +++++++ public/index.html | 48 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 .glitch-assets diff --git a/.glitch-assets b/.glitch-assets new file mode 100644 index 00000000..be86213f --- /dev/null +++ b/.glitch-assets @@ -0,0 +1,2 @@ +{"name":"soragrit-wongsa-pMEGruJJ6Ko-unsplash.jpg","date":"2019-09-06T19:15:57.874Z","url":"https://cdn.glitch.com/79e54494-5c78-498c-9a09-a20e3f7b3641%2Fsoragrit-wongsa-pMEGruJJ6Ko-unsplash.jpg","type":"image/jpeg","size":1387750,"imageWidth":5472,"imageHeight":3648,"thumbnail":"https://cdn.glitch.com/79e54494-5c78-498c-9a09-a20e3f7b3641%2Fthumbnails%2Fsoragrit-wongsa-pMEGruJJ6Ko-unsplash.jpg","thumbnailWidth":330,"thumbnailHeight":220,"uuid":"JhnRUudcVqhI74LU"} +{"name":"price-tag.png","date":"2019-09-06T19:15:58.047Z","url":"https://cdn.glitch.com/79e54494-5c78-498c-9a09-a20e3f7b3641%2Fprice-tag.png","type":"image/png","size":26499,"imageWidth":512,"imageHeight":512,"thumbnail":"https://cdn.glitch.com/79e54494-5c78-498c-9a09-a20e3f7b3641%2Fthumbnails%2Fprice-tag.png","thumbnailWidth":330,"thumbnailHeight":330,"uuid":"6AhHVT4GvP91I6KN"} diff --git a/public/css/style.css b/public/css/style.css index bd0f55d6..31d3a81b 100755 --- a/public/css/style.css +++ b/public/css/style.css @@ -7,4 +7,11 @@ body { /* Chrome 10-25, Safari 5.1-6 */ background: linear-gradient(to right, #ffffff, #abbaab); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */ +} + +.logo { + display: flex; + justify-content: flex-start; + + } \ No newline at end of file diff --git a/public/index.html b/public/index.html index e69de29b..ee54605c 100755 --- a/public/index.html +++ b/public/index.html @@ -0,0 +1,48 @@ + + + + Shopr + + + + + +
+ +
+
+ + +
+ + + From 9709cb8de2f585f36b4214d2b4b867fbbb88e832 Mon Sep 17 00:00:00 2001 From: "Glitch (a2-benemrick)" Date: Fri, 6 Sep 2019 19:35:57 +0000 Subject: [PATCH 06/61] =?UTF-8?q?=F0=9F=90=8A=F0=9F=97=BE=20Checkpoint=20.?= =?UTF-8?q?/public/index.html:2480412/1723=20./public/css/style.css:248041?= =?UTF-8?q?2/307?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/css/style.css | 11 --------- public/index.html | 58 ++++++++++++++++++++++++-------------------- 2 files changed, 32 insertions(+), 37 deletions(-) diff --git a/public/css/style.css b/public/css/style.css index 31d3a81b..c2a6d61c 100755 --- a/public/css/style.css +++ b/public/css/style.css @@ -1,17 +1,6 @@ /*Style your own assignment! This is fun! */ -body { - background: #abbaab; - /* fallback for old browsers */ - background: -webkit-linear-gradient(to right, #ffffff, #abbaab); - /* Chrome 10-25, Safari 5.1-6 */ - background: linear-gradient(to right, #ffffff, #abbaab); - /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */ -} - .logo { display: flex; justify-content: flex-start; - - } \ No newline at end of file diff --git a/public/index.html b/public/index.html index ee54605c..04d538cc 100755 --- a/public/index.html +++ b/public/index.html @@ -4,13 +4,12 @@ Shopr - + + - -
- + +
+
@@ -19,30 +18,37 @@ + + + + + + + From 1c0fdab7292679d451fd22b1e7a44d0319896dee Mon Sep 17 00:00:00 2001 From: "Glitch (a2-benemrick)" Date: Fri, 6 Sep 2019 19:47:57 +0000 Subject: [PATCH 07/61] =?UTF-8?q?=F0=9F=99=89=F0=9F=95=B6=20Checkpoint=20.?= =?UTF-8?q?/public/css/style.css:2480412/72=20./public/index.html:2480412/?= =?UTF-8?q?120?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/css/style.css | 5 ++--- public/index.html | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/public/css/style.css b/public/css/style.css index c2a6d61c..a5eed70e 100755 --- a/public/css/style.css +++ b/public/css/style.css @@ -1,6 +1,5 @@ /*Style your own assignment! This is fun! */ -.logo { - display: flex; - justify-content: flex-start; +body { + background: black; } \ No newline at end of file diff --git a/public/index.html b/public/index.html index 04d538cc..74d89399 100755 --- a/public/index.html +++ b/public/index.html @@ -3,7 +3,7 @@ Shopr - + From 4de1e30bf8b0ffb3d86e44b9fe4844e2ce1f240d Mon Sep 17 00:00:00 2001 From: "Glitch (a2-benemrick)" Date: Sun, 8 Sep 2019 19:03:09 +0000 Subject: [PATCH 08/61] =?UTF-8?q?=F0=9F=95=B6=F0=9F=8F=94=20Checkpoint=20.?= =?UTF-8?q?/public/index.html:2480412/128?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/index.html b/public/index.html index 74d89399..8f027cbe 100755 --- a/public/index.html +++ b/public/index.html @@ -3,7 +3,7 @@ Shopr - + From 73e7bdf1754fefafe09b89cdf37418a598dd89a2 Mon Sep 17 00:00:00 2001 From: "Glitch (a2-benemrick)" Date: Sun, 8 Sep 2019 19:25:10 +0000 Subject: [PATCH 09/61] =?UTF-8?q?=F0=9F=94=91=F0=9F=96=87=20Checkpoint=20.?= =?UTF-8?q?/public/index.html:2480412/100=20./public/css/style.css:2480412?= =?UTF-8?q?/77?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/css/style.css | 4 ++-- public/index.html | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/public/css/style.css b/public/css/style.css index a5eed70e..c2ca580e 100755 --- a/public/css/style.css +++ b/public/css/style.css @@ -1,5 +1,5 @@ /*Style your own assignment! This is fun! */ -body { - background: black; +.icon { + color: blue; } \ No newline at end of file diff --git a/public/index.html b/public/index.html index 8f027cbe..bb1c1996 100755 --- a/public/index.html +++ b/public/index.html @@ -6,10 +6,11 @@ +
- +
From c14ad09d242b13fcfcc3cc834b4102fcc5e12304 Mon Sep 17 00:00:00 2001 From: "Glitch (a2-benemrick)" Date: Sun, 8 Sep 2019 19:36:17 +0000 Subject: [PATCH 10/61] =?UTF-8?q?=E2=9C=8B=F0=9F=8E=A2=20Checkpoint=20./pu?= =?UTF-8?q?blic/index.html:2480412/207=20./public/css/style.css:2480412/56?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/css/style.css | 5 +++++ public/index.html | 1 + 2 files changed, 6 insertions(+) diff --git a/public/css/style.css b/public/css/style.css index c2ca580e..bba1ff48 100755 --- a/public/css/style.css +++ b/public/css/style.css @@ -2,4 +2,9 @@ .icon { color: blue; +} + +.title { + font-family: 'Roboto', sans-serif; + } \ No newline at end of file diff --git a/public/index.html b/public/index.html index bb1c1996..02d37c6d 100755 --- a/public/index.html +++ b/public/index.html @@ -12,6 +12,7 @@
+

Shopr

From 81d9810c1cc6d7164ed6c5482535d7004b65d0b1 Mon Sep 17 00:00:00 2001 From: "Glitch (a2-benemrick)" Date: Sun, 8 Sep 2019 20:00:16 +0000 Subject: [PATCH 11/61] =?UTF-8?q?=F0=9F=90=95=F0=9F=93=85=20Checkpoint=20.?= =?UTF-8?q?/public/css/style.css:2480412/66=20./public/index.html:2480412/?= =?UTF-8?q?26?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/css/style.css | 3 ++- public/index.html | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/public/css/style.css b/public/css/style.css index bba1ff48..657df999 100755 --- a/public/css/style.css +++ b/public/css/style.css @@ -1,7 +1,8 @@ /*Style your own assignment! This is fun! */ .icon { - color: blue; + margin-top: 20px; + } .title { diff --git a/public/index.html b/public/index.html index 02d37c6d..52221a4f 100755 --- a/public/index.html +++ b/public/index.html @@ -10,7 +10,7 @@
- +

Shopr

From a78ab7950d9f868b748076f4e4362c2a46f10df4 Mon Sep 17 00:00:00 2001 From: "Glitch (a2-benemrick)" Date: Sun, 8 Sep 2019 21:24:06 +0000 Subject: [PATCH 12/61] =?UTF-8?q?=F0=9F=8F=9F=F0=9F=9A=A7=20Checkpoint=20.?= =?UTF-8?q?/public/index.html:2480412/18?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/index.html b/public/index.html index 52221a4f..9d9d9f13 100755 --- a/public/index.html +++ b/public/index.html @@ -8,7 +8,7 @@ - +
From 1123bfbf91df127f59cd204265bc6200c3968cd7 Mon Sep 17 00:00:00 2001 From: "Glitch (a2-benemrick)" Date: Sun, 8 Sep 2019 21:35:07 +0000 Subject: [PATCH 13/61] =?UTF-8?q?=F0=9F=8D=83=F0=9F=8D=9F=20Checkpoint=20.?= =?UTF-8?q?/public/index.html:2480412/545=20./public/css/style.css:2480412?= =?UTF-8?q?/837=20./public/js/scripts.js:2480412/91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/css/style.css | 30 ++++++++++++++++++++++++++++++ public/index.html | 8 +++++--- public/js/scripts.js | 5 +++++ 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/public/css/style.css b/public/css/style.css index 657df999..594bc34f 100755 --- a/public/css/style.css +++ b/public/css/style.css @@ -8,4 +8,34 @@ .title { font-family: 'Roboto', sans-serif; +} + +body, html { + height: 100%; +} + +/* The hero image */ +.header-image { + /* Use "linear-gradient" to add a darken background effect to the image (photographer.jpg). This will make the text easier to read */ + background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url("photographer.jpg"); + + /* Set a specific height */ + height: 50%; + + /* Position and center the image to scale nicely on all screens */ + background-position: center; + background-repeat: no-repeat; + background-size: cover; + position: relative; +} + +/* Place text in the middle of the image */ +.header-text { + text-align: center; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + color: white; + font-family: 'Roboto', sans-serif; } \ No newline at end of file diff --git a/public/index.html b/public/index.html index 9d9d9f13..7d9c4594 100755 --- a/public/index.html +++ b/public/index.html @@ -9,10 +9,12 @@ -
- +
+
+

Shopr

+

your online wishlist

+
-

Shopr

diff --git a/public/js/scripts.js b/public/js/scripts.js index de052eae..5b1796a8 100755 --- a/public/js/scripts.js +++ b/public/js/scripts.js @@ -1,3 +1,8 @@ // Add some Javascript code here, to run on the front end. +unsplash.search.photos("dogs", 1) + .then(toJson) + .then(json => { + // Your code + }); console.log("Welcome to assignment 2!") \ No newline at end of file From de0c95e556ea87ab62e434a880c560ed51a76205 Mon Sep 17 00:00:00 2001 From: "Glitch (a2-benemrick)" Date: Sun, 8 Sep 2019 21:47:06 +0000 Subject: [PATCH 14/61] =?UTF-8?q?=F0=9F=95=B5=F0=9F=8C=8D=20Checkpoint=20.?= =?UTF-8?q?/public/js/scripts.js:2480412/702=20./public/index.html:2480412?= =?UTF-8?q?/440?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 3 ++- public/index.html | 15 +++++++++++---- public/js/scripts.js | 17 ++++++++++++++--- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 988f135f..869d72d5 100755 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "start": "node server.improved.js" }, "dependencies": { - "mime": "^2.4.4" + "mime": "^2.4.4", + "unsplash-js": "^5.0.0" } } diff --git a/public/index.html b/public/index.html index 7d9c4594..5ac44358 100755 --- a/public/index.html +++ b/public/index.html @@ -5,6 +5,7 @@ + @@ -15,10 +16,7 @@

Shopr

your online wishlist

- - - - + diff --git a/public/js/scripts.js b/public/js/scripts.js index 5b1796a8..9e3d1005 100755 --- a/public/js/scripts.js +++ b/public/js/scripts.js @@ -1,8 +1,19 @@ -// Add some Javascript code here, to run on the front end. +// ES Modules syntax +import Unsplash from 'unsplash-js'; -unsplash.search.photos("dogs", 1) +// require syntax +const Unsplash = require('unsplash-js').default; + +const unsplash = new Unsplash({ + applicationId: "210c371817cd6adae5a2fd6484fb09a9c92f0fec9d3443744a797518224071ef", + secret: "fd62ab61acfdb6f6a1a725f41856dff34770e89a875c51224515c1c2aca625da" +}); + +const randPhoto = function() { + unsplash.search.photos("dogs", 1) .then(toJson) .then(json => { // Your code }); -console.log("Welcome to assignment 2!") \ No newline at end of file +} + From 30cab31e3ca835367f9941d8bb9735ce435370ea Mon Sep 17 00:00:00 2001 From: "Glitch (a2-benemrick)" Date: Sun, 8 Sep 2019 21:58:07 +0000 Subject: [PATCH 15/61] =?UTF-8?q?=F0=9F=98=BA=F0=9F=8F=88=20Checkpoint=20.?= =?UTF-8?q?/public/index.html:2480412/426=20./public/css/style.css:2480412?= =?UTF-8?q?/365?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/css/style.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/css/style.css b/public/css/style.css index 594bc34f..9333e1dd 100755 --- a/public/css/style.css +++ b/public/css/style.css @@ -17,7 +17,7 @@ body, html { /* The hero image */ .header-image { /* Use "linear-gradient" to add a darken background effect to the image (photographer.jpg). This will make the text easier to read */ - background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url("photographer.jpg"); + background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url("https://images.unsplash.com/photo-1438109491414-7198515b166b?q=80&fm=jpg&s=cbdabf7a79c087a0b060670a6d79726c"); /* Set a specific height */ height: 50%; From 2f2b6216c28573d7ba705caacb9914f379d81d37 Mon Sep 17 00:00:00 2001 From: "Glitch (a2-benemrick)" Date: Sun, 8 Sep 2019 22:10:07 +0000 Subject: [PATCH 16/61] =?UTF-8?q?=F0=9F=8D=88=F0=9F=9A=97=20Checkpoint=20.?= =?UTF-8?q?/public/css/style.css:2480412/476=20./public/index.html:2480412?= =?UTF-8?q?/154?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/css/style.css | 9 ++++++++- public/index.html | 11 +++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/public/css/style.css b/public/css/style.css index 9333e1dd..ea9bb8b5 100755 --- a/public/css/style.css +++ b/public/css/style.css @@ -7,7 +7,14 @@ .title { font-family: 'Roboto', sans-serif; + font-weight: bold; + font-size: 400%; +} +.slogan { + font-family: 'Roboto', sans-serif; + font-weight: bold; + font-size: 150%; } body, html { @@ -17,7 +24,7 @@ body, html { /* The hero image */ .header-image { /* Use "linear-gradient" to add a darken background effect to the image (photographer.jpg). This will make the text easier to read */ - background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url("https://images.unsplash.com/photo-1438109491414-7198515b166b?q=80&fm=jpg&s=cbdabf7a79c087a0b060670a6d79726c"); + background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url("https://source.unsplash.com/FK81rxilUXg/1600x900"); /* Set a specific height */ height: 50%; diff --git a/public/index.html b/public/index.html index 5ac44358..56b9fa39 100755 --- a/public/index.html +++ b/public/index.html @@ -12,11 +12,18 @@
-

Shopr

-

your online wishlist

+

shopr

+

your online wishlist

+
+

+ Favorites +

+ +
+ @@ -26,26 +26,27 @@

-
Yeezy
+
appdata[0].name

Category

Price

-
-
Card title
-

This card has supporting text below as a natural lead-in to additional content.

-

Last updated 3 mins ago

+
Yeezy
+

Category

+

Price

+
-
Card title
-

This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.

-

Last updated 3 mins ago

+
Yeezy
+

Category

+

Price

+
From 5018f1aa7a3f515b4d18581b57ebb5158cc86f40 Mon Sep 17 00:00:00 2001 From: "Glitch (a2-benemrick)" Date: Sun, 8 Sep 2019 23:44:12 +0000 Subject: [PATCH 24/61] =?UTF-8?q?=F0=9F=99=85=E2=9D=84=EF=B8=8F=20Checkpoi?= =?UTF-8?q?nt=20./public/index.html:2480412/527?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/public/index.html b/public/index.html index 80da9eef..9b436005 100755 --- a/public/index.html +++ b/public/index.html @@ -23,10 +23,10 @@

Favorites

-
+
-
appdata[0].name
+
Yeezy

Category

Price

@@ -112,6 +112,20 @@

button.onclick = submit } + $(document).ready(function () { + var html = ""; + for (var i = 0; i < rows.length; i++) { + html+=""; + html+=""; + html+=""; + html+=""; + + html+=""; + + } + html+="
"+rows[i].name+""+rows[i].age+""+rows[i].email+"
"; + $("div").html(html); + }); const url = function() { unsplash.search.photos("shopping", 1) From 1f6c2e47d3e92ce204be7a24d8a66ff74c93ad8a Mon Sep 17 00:00:00 2001 From: "Glitch (a2-benemrick)" Date: Sun, 8 Sep 2019 23:55:14 +0000 Subject: [PATCH 25/61] =?UTF-8?q?=F0=9F=8E=A4=F0=9F=8C=94=20Checkpoint=20.?= =?UTF-8?q?/public/index.html:2480412/376=20./public/js/scripts.js:2480412?= =?UTF-8?q?/3661?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 14 -------------- public/js/scripts.js | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 14 deletions(-) diff --git a/public/index.html b/public/index.html index 9b436005..5a8e5873 100755 --- a/public/index.html +++ b/public/index.html @@ -112,20 +112,6 @@

button.onclick = submit } - $(document).ready(function () { - var html = ""; - for (var i = 0; i < rows.length; i++) { - html+=""; - html+=""; - html+=""; - html+=""; - - html+=""; - - } - html+="
"+rows[i].name+""+rows[i].age+""+rows[i].email+"
"; - $("div").html(html); - }); const url = function() { unsplash.search.photos("shopping", 1) diff --git a/public/js/scripts.js b/public/js/scripts.js index 9e3d1005..8c21182c 100755 --- a/public/js/scripts.js +++ b/public/js/scripts.js @@ -17,3 +17,41 @@ const randPhoto = function() { }); } +const loadFavorites = async function() { + const resp = await fetch('/orders', { method: 'GET' }); + const data = await resp.json(); + const orders = data.data; + let htmlDiv = document.getElementById('orders'); + htmlDiv.innerHTML = '\n' + + ' Name\n' + + ' Dream\n' + + ' Pork\n' + + ' Garlic\n' + + ' Price\n' + + ' \n' + + ' \n' + + ' '; + for (let i = 0; i < orders.length; i++) { + const order = orders[i]; + const stringOrder = JSON.stringify(orders[i]); + const garlic = (order.garlic ? 'Yes' : 'No'); + let newRow = '\n'; + newRow += (` ${order.name} \n`); + newRow += (` ${order.dream} \n`); + newRow += (` ${order.amountOfPork} pieces\n`); + newRow += (` ${garlic} \n`); + newRow += (` ${order.price} \n`); + newRow += (` \n`); + newRow += (` \n`); + newRow += ''; + htmlDiv.innerHTML += newRow; + } + + return false; +}; + +window.onload = function(){ + loadFavorites +} From 63f32867c4ae047fccaafe54368cfbb2fd73b267 Mon Sep 17 00:00:00 2001 From: "Glitch (a2-benemrick)" Date: Mon, 9 Sep 2019 00:07:12 +0000 Subject: [PATCH 26/61] =?UTF-8?q?=F0=9F=8D=87=F0=9F=8C=A8=20Checkpoint=20.?= =?UTF-8?q?/public/js/scripts.js:2480412/1230=20./public/index.html:248041?= =?UTF-8?q?2/14?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 2 +- public/js/scripts.js | 54 ++++++++++++++++++++++++++++---------------- 2 files changed, 35 insertions(+), 21 deletions(-) diff --git a/public/index.html b/public/index.html index 5a8e5873..522f6d1d 100755 --- a/public/index.html +++ b/public/index.html @@ -23,7 +23,7 @@

Favorites

-
+
Yeezy
diff --git a/public/js/scripts.js b/public/js/scripts.js index 8c21182c..11edf398 100755 --- a/public/js/scripts.js +++ b/public/js/scripts.js @@ -18,24 +18,38 @@ const randPhoto = function() { } const loadFavorites = async function() { - const resp = await fetch('/orders', { method: 'GET' }); + const resp = await fetch('/', { method: 'GET' }); const data = await resp.json(); - const orders = data.data; - let htmlDiv = document.getElementById('orders'); - htmlDiv.innerHTML = '\n' + - ' Name\n' + - ' Dream\n' + - ' Pork\n' + - ' Garlic\n' + - ' Price\n' + - ' \n' + - ' \n' + - ' '; - for (let i = 0; i < orders.length; i++) { - const order = orders[i]; - const stringOrder = JSON.stringify(orders[i]); - const garlic = (order.garlic ? 'Yes' : 'No'); - let newRow = '\n'; + const favs = data.data; + + /*var html = ""; + for (var i = 0; i < rows.length; i++) { + html+=""; + html+=""; + html+=""; + html+=""; + + html+=""; + + } + html+="
"+rows[i].name+""+rows[i].age+""+rows[i].email+"
"; + $("div").html(html);*/ + +
+
+
Yeezy
+

Category

+

Price

+
+ +
+ + let html = document.getElementById('favorites'); + html.innerHtml = "
" + + for (let i = 0; i < favs.length; i++) { + const item = item[i]; + const strItem = JSON.stringify(item[i]); newRow += (` ${order.name} \n`); newRow += (` ${order.dream} \n`); newRow += (` ${order.amountOfPork} pieces\n`); @@ -52,6 +66,6 @@ const loadFavorites = async function() { return false; }; -window.onload = function(){ - loadFavorites -} +window.onload = function() { + loadFavorites() +}; From 5db10c5d7f14797d44beecd5549c054beeaedba4 Mon Sep 17 00:00:00 2001 From: "Glitch (a2-benemrick)" Date: Mon, 9 Sep 2019 00:18:14 +0000 Subject: [PATCH 27/61] =?UTF-8?q?=F0=9F=8E=AB=F0=9F=8C=87=20Checkpoint=20.?= =?UTF-8?q?/public/js/scripts.js:2480412/2143?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/js/scripts.js | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/public/js/scripts.js b/public/js/scripts.js index 11edf398..82c374cb 100755 --- a/public/js/scripts.js +++ b/public/js/scripts.js @@ -35,32 +35,23 @@ const loadFavorites = async function() { html+=""; $("div").html(html);*/ -
+ /*
Yeezy

Category

Price

-
+
*/ + + let htmlCard = `
' +
` - let html = document.getElementById('favorites'); - html.innerHtml = "
" for (let i = 0; i < favs.length; i++) { - const item = item[i]; - const strItem = JSON.stringify(item[i]); - newRow += (` ${order.name} \n`); - newRow += (` ${order.dream} \n`); - newRow += (` ${order.amountOfPork} pieces\n`); - newRow += (` ${garlic} \n`); - newRow += (` ${order.price} \n`); - newRow += (` \n`); - newRow += (` \n`); - newRow += ''; - htmlDiv.innerHTML += newRow; + htmlCard = `
${favs[i].name}
+ + ` } return false; From 3ebbe1f8159dd738cccf07365f8b2e219960e401 Mon Sep 17 00:00:00 2001 From: "Glitch (a2-benemrick)" Date: Mon, 9 Sep 2019 00:30:15 +0000 Subject: [PATCH 28/61] =?UTF-8?q?=F0=9F=8D=B4=F0=9F=9A=83=20Checkpoint=20.?= =?UTF-8?q?/public/js/scripts.js:2480412/2749=20./server.improved.js:24804?= =?UTF-8?q?12/6=20./public/index.html:2480412/774?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 33 ------------------- public/js/scripts.js | 78 ++++++++++++++++++++++++++------------------ server.improved.js | 6 ++-- 3 files changed, 49 insertions(+), 68 deletions(-) diff --git a/public/index.html b/public/index.html index 522f6d1d..2b5fc3c5 100755 --- a/public/index.html +++ b/public/index.html @@ -87,39 +87,6 @@

diff --git a/public/js/scripts.js b/public/js/scripts.js index 82c374cb..321b8a79 100755 --- a/public/js/scripts.js +++ b/public/js/scripts.js @@ -9,6 +9,34 @@ const unsplash = new Unsplash({ secret: "fd62ab61acfdb6f6a1a725f41856dff34770e89a875c51224515c1c2aca625da" }); +const submit = function( e ) { + // prevent default form action from being carried out + e.preventDefault() + + const input = document.querySelector( '#yourname' ), + json = { yourname: input.value }, + body = JSON.stringify( json ) + + fetch( '/submit', { + method:'POST', + body + }) + .then( function( response ) { + // do something with the reponse + console.log( response ) + }) + + return false +} + +const url = function() { + unsplash.search.photos("shopping", 1) + .then(toJson) + .then(json => { + // Your code + }); +} + const randPhoto = function() { unsplash.search.photos("dogs", 1) .then(toJson) @@ -22,41 +50,27 @@ const loadFavorites = async function() { const data = await resp.json(); const favs = data.data; - /*var html = ""; - for (var i = 0; i < rows.length; i++) { - html+=""; - html+=""; - html+=""; - html+=""; - - html+=""; - - } - html+="
"+rows[i].name+""+rows[i].age+""+rows[i].email+"
"; - $("div").html(html);*/ - - /*
-
-
Yeezy
-

Category

-

Price

-
- -
*/ - - let htmlCard = `
' -
` - + let htmlCard = `
+
`; - for (let i = 0; i < favs.length; i++) { - htmlCard = `
${favs[i].name}
- - ` + for (let i = 0; i < 3; i++) { + htmlCard += `
${favs[i].name}
+

${favs[i].category}

+

${favs[i].usd}

+

${favs[i].eur}

+
+ +
`; } + document.getElementById("favorites").innerHTML = htmlCard; + return false; -}; +} window.onload = function() { - loadFavorites() -}; + const button = document.querySelector( 'button' ) + button.onclick = submit + + loadFavorites(); +} \ No newline at end of file diff --git a/server.improved.js b/server.improved.js index 33a704ee..dada469d 100644 --- a/server.improved.js +++ b/server.improved.js @@ -7,9 +7,9 @@ const http = require( 'http' ), port = 3000 const appdata = [ - { 'name': 'Yeezy 350', 'Categroy': 'Fashion', 'rating': 5, 'usd': 200, 'eur': 182 }, - { 'name': 'Macbook Pro', 'Categroy': 'Tech', 'rating': 3, 'usd': 1299, 'eur': 1178.31 }, - { 'name': 'Wilson Basketball', 'Categroy': 'Sports', 'rating': 2, 'usd': 20, 'eur': 18.14 }, + { 'name': 'Yeezy 350', 'categroy': 'Fashion', 'rating': 5, 'usd': 200, 'eur': 182 }, + { 'name': 'Macbook Pro', 'categroy': 'Tech', 'rating': 3, 'usd': 1299, 'eur': 1178.31 }, + { 'name': 'Wilson Basketball', 'categroy': 'Sports', 'rating': 2, 'usd': 20, 'eur': 18.14 }, ] const server = http.createServer( function( request,response ) { From f8ebc7c14b8510095e0fc180bcd064f8f3c0f270 Mon Sep 17 00:00:00 2001 From: "Glitch (a2-benemrick)" Date: Mon, 9 Sep 2019 00:42:14 +0000 Subject: [PATCH 29/61] =?UTF-8?q?=F0=9F=8C=A8=F0=9F=8C=83=20Checkpoint=20.?= =?UTF-8?q?/public/js/scripts.js:2480412/1208=20./public/index.html:248041?= =?UTF-8?q?2/3469?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 51 ++++++++++++++++++++++---------------------- public/js/scripts.js | 40 ---------------------------------- 2 files changed, 25 insertions(+), 66 deletions(-) diff --git a/public/index.html b/public/index.html index 2b5fc3c5..7cbb021c 100755 --- a/public/index.html +++ b/public/index.html @@ -23,32 +23,7 @@

Favorites

-
-
-
-
Yeezy
-

Category

-

Price

-
- -
-
-
-
Yeezy
-

Category

-

Price

-
- -
-
-
-
Yeezy
-

Category

-

Price

-
- -
-
+

Wishlist @@ -86,7 +61,31 @@

diff --git a/public/js/scripts.js b/public/js/scripts.js index 321b8a79..6bb8b6a4 100755 --- a/public/js/scripts.js +++ b/public/js/scripts.js @@ -1,14 +1,3 @@ -// ES Modules syntax -import Unsplash from 'unsplash-js'; - -// require syntax -const Unsplash = require('unsplash-js').default; - -const unsplash = new Unsplash({ - applicationId: "210c371817cd6adae5a2fd6484fb09a9c92f0fec9d3443744a797518224071ef", - secret: "fd62ab61acfdb6f6a1a725f41856dff34770e89a875c51224515c1c2aca625da" -}); - const submit = function( e ) { // prevent default form action from being carried out e.preventDefault() @@ -45,32 +34,3 @@ const randPhoto = function() { }); } -const loadFavorites = async function() { - const resp = await fetch('/', { method: 'GET' }); - const data = await resp.json(); - const favs = data.data; - - let htmlCard = `
-
`; - - for (let i = 0; i < 3; i++) { - htmlCard += `
${favs[i].name}
-

${favs[i].category}

-

${favs[i].usd}

-

${favs[i].eur}

-
- -
`; - } - - document.getElementById("favorites").innerHTML = htmlCard; - - return false; -} - -window.onload = function() { - const button = document.querySelector( 'button' ) - button.onclick = submit - - loadFavorites(); -} \ No newline at end of file From a4cb1e8216071860a00197cdd35db143ffb388de Mon Sep 17 00:00:00 2001 From: "Glitch (a2-benemrick)" Date: Mon, 9 Sep 2019 02:02:14 +0000 Subject: [PATCH 30/61] =?UTF-8?q?=F0=9F=8D=A9=F0=9F=8C=82=20Checkpoint=20.?= =?UTF-8?q?/public/index.html:2480412/32=20./server.improved.js:2480412/88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 3 +-- server.improved.js | 4 +++- shrinkwrap.yaml | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 3 deletions(-) diff --git a/public/index.html b/public/index.html index 7cbb021c..694dc235 100755 --- a/public/index.html +++ b/public/index.html @@ -62,8 +62,7 @@

From 2a673a0db45d1f91ab038d9f20d580f4cb490a6f Mon Sep 17 00:00:00 2001 From: "Glitch (a2-benemrick)" Date: Mon, 9 Sep 2019 03:13:11 +0000 Subject: [PATCH 36/61] =?UTF-8?q?=E2=9B=B5=EF=B8=8F=F0=9F=8E=92=20Checkpoi?= =?UTF-8?q?nt=20./public/index.html:2480412/18=20./server.improved.js:2480?= =?UTF-8?q?412/904?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 6 +++--- server.improved.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/public/index.html b/public/index.html index fd24718b..a88dff22 100755 --- a/public/index.html +++ b/public/index.html @@ -60,8 +60,8 @@

${favs[i].name}

${favs[i].category}

-

$${favs[i].usd} - USD

-

€${favs[i].eur} - EURO

+

$${favs[i].usd}

+

€${favs[i].eur}

`; @@ -80,7 +80,7 @@
${favs[i].name}
Item Category USD - EUR + EURO Rating diff --git a/server.improved.js b/server.improved.js index e5a29642..412f6c03 100644 --- a/server.improved.js +++ b/server.improved.js @@ -7,9 +7,9 @@ const http = require( 'http' ), port = 3000 const appdata = [ - { 'name': 'Yeezy 350', 'category': 'Fashion', 'rating': 5, 'usd': 200, 'eur': 182 }, - { 'name': 'Macbook Pro', 'category': 'Tech', 'rating': 3, 'usd': 1299, 'eur': 1178.31 }, - { 'name': 'Wilson Basketball', 'category': 'Sports', 'rating': 2, 'usd': 20, 'eur': 18.14 }, + { 'name': 'Yeezy 350 Boost', 'category': 'Fashion', 'rating': 5, 'usd': 200, 'eur': 182, 'link': "https://stockx.com/adidas-yeezy-boost-350-v2-cream-white?currencyCode=USD&size=8.5&gclid=CjwKCAjwzdLrBRBiEiwAEHrAYr6Goiw3RGnCl12vXPPsgVqOjI-F36X_4AfNaeBDvt6D-mjEkhmVBBoCRBEQAvD_BwE"}, + { 'name': 'Macbook Pro', 'category': 'Tech', 'rating': 3, 'usd': 1299, 'eur': 1178.31, 'link': "https://www.apple.com/shop/buy-mac/macbook-pro/13-inch-space-gray-1.4ghz-quad-core-processor-with-turbo-boost-up-to-3.9ghz-128gb?afid=p238%7Csbepnohbm-dc_mtid_1870765e38482_pcrid_246386726307_pgrid_14874568330_&cid=aos-us-kwgo-pla-mac--slid-----product-MUHN2LL/A" }, + { 'name': 'Wilson Basketball', 'category': 'Sports', 'rating': 2, 'usd': 20, 'eur': 18.14, 'link': "https://www.wilson.com/en-us/basketball/balls/evolution/evolution-game-basketball?gclid=CjwKCAjwzdLrBRBiEiwAEHrAYsO1rcrobWjAgngQhHvN_RTM9DJZj_zVaqj5c4KJ7Vw5_S4yYuE4QxoCYssQAvD_BwE&source=googleshopping&ef_id=CjwKCAjwzdLrBRBiEiwAEHrAYsO1rcrobWjAgngQhHvN_RTM9DJZj_zVaqj5c4KJ7Vw5_S4yYuE4QxoCYssQAvD_BwE:G:s&s_kwcid=AL!8492!3!179840140943!!!g!430754648574!&CMPID=Google-wilson-basketball_g_shopping_usa---c-179840140943-" } ] const server = http.createServer( function( request,response ) { From 1d584d648ef743586984a2f3095021b78da021e9 Mon Sep 17 00:00:00 2001 From: "Glitch (a2-benemrick)" Date: Mon, 9 Sep 2019 03:25:11 +0000 Subject: [PATCH 37/61] =?UTF-8?q?=F0=9F=94=91=F0=9F=8F=8F=20Checkpoint=20.?= =?UTF-8?q?/public/index.html:2480412/3761?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/public/index.html b/public/index.html index a88dff22..0d98e031 100755 --- a/public/index.html +++ b/public/index.html @@ -58,7 +58,11 @@

let stars = displayStars(favs[i].rating); htmlCard += `
-
${favs[i].name}
+ +
${favs[i].name}
+
+ Buy +

${favs[i].category}

$${favs[i].usd}

€${favs[i].eur}

From bdd28fdbf93a134fa8ce8046d779baa5f9dab4b9 Mon Sep 17 00:00:00 2001 From: "Glitch (a2-benemrick)" Date: Mon, 9 Sep 2019 03:36:16 +0000 Subject: [PATCH 38/61] =?UTF-8?q?=F0=9F=92=81=E2=9B=B1=20Checkpoint=20./pu?= =?UTF-8?q?blic/index.html:2480412/1046?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/public/index.html b/public/index.html index 0d98e031..8cbe1825 100755 --- a/public/index.html +++ b/public/index.html @@ -58,14 +58,11 @@

let stars = displayStars(favs[i].rating); htmlCard += `
- -
${favs[i].name}
-
- Buy - -

${favs[i].category}

-

$${favs[i].usd}

-

€${favs[i].eur}

+
${favs[i].name}
+

${favs[i].category}

+

Price: $${favs[i].usd} | €${favs[i].eur}

+ Buy +
`; @@ -99,6 +96,8 @@

${favs[i].name}
$${favs[i].usd} €${favs[i].eur} ${stars} + Buy + `; } From 2211d468c234e91214df9c1d23df7491d5818500 Mon Sep 17 00:00:00 2001 From: "Glitch (a2-benemrick)" Date: Mon, 9 Sep 2019 03:48:14 +0000 Subject: [PATCH 39/61] =?UTF-8?q?=F0=9F=8F=AC=F0=9F=91=A6=20Checkpoint=20.?= =?UTF-8?q?/public/index.html:2480412/2592=20./public/css/style.css:248041?= =?UTF-8?q?2/153?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/css/style.css | 4 ++++ public/index.html | 35 +++++++++++++++++++++++++++++++---- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/public/css/style.css b/public/css/style.css index e482f87a..f196b9a9 100755 --- a/public/css/style.css +++ b/public/css/style.css @@ -3,6 +3,10 @@ body, html { height: 100%; } +.link { + color: black; +} + .icon { margin-top: 20px; diff --git a/public/index.html b/public/index.html index 8cbe1825..adf50bb1 100755 --- a/public/index.html +++ b/public/index.html @@ -14,7 +14,36 @@

shopr

your online wishlist

- + +
+
+ + @@ -91,13 +120,11 @@
${favs[i].name}
for (let i = 0; i < favs.length ; i++) { let stars = displayStars(favs[i].rating); htmlTable += ` - ${favs[i].name} + ${favs[i].name} ${favs[i].category} $${favs[i].usd} €${favs[i].eur} ${stars} - Buy - `; } From e88d8e3ee278ff41fb40ba6a8fe1423c4035df6c Mon Sep 17 00:00:00 2001 From: "Glitch (a2-benemrick)" Date: Mon, 9 Sep 2019 04:00:15 +0000 Subject: [PATCH 40/61] =?UTF-8?q?=F0=9F=90=BA=F0=9F=97=BA=20Checkpoint=20.?= =?UTF-8?q?/public/index.html:2480412/3948?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/public/index.html b/public/index.html index adf50bb1..294b0907 100755 --- a/public/index.html +++ b/public/index.html @@ -14,15 +14,15 @@

shopr

your online wishlist

- +
-

-

Favorites

+

Favorites

-

Wishlist

+

Wishlist

From 1ea72ce58ec463d1536f53833f8b4b019f7e6359 Mon Sep 17 00:00:00 2001 From: "Glitch (a2-benemrick)" Date: Mon, 9 Sep 2019 04:48:13 +0000 Subject: [PATCH 44/61] =?UTF-8?q?=F0=9F=8E=B9=F0=9F=8F=AE=20Checkpoint=20.?= =?UTF-8?q?/server.improved.js:2480412/734=20./public/index.html:2480412/2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 2 +- server.improved.js | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/public/index.html b/public/index.html index 332b8f9e..f0d6b079 100755 --- a/public/index.html +++ b/public/index.html @@ -179,7 +179,7 @@
${favs[i].name}
} window.onload = function() { - refresh + refresh() const button = document.getElementById( 'newBtn' ) button.onclick = newItem diff --git a/server.improved.js b/server.improved.js index 412f6c03..da8a0da4 100644 --- a/server.improved.js +++ b/server.improved.js @@ -42,8 +42,18 @@ const handlePost = function( request, response ) { request.on( 'end', function() { console.log( JSON.parse( dataString ) ) - - // ... do something with the data here!!! + const item = JSON.parse( dataString ); + + const newItemObj = { + 'name': item.name, + 'category': item.category, + 'rating': parseInt(item.rating), + 'usd': parseFloat(item.usd), + 'eur': calcEuroPrice(parseFloat(item.usd)), + 'link': item.link, + }; + + appdata.push(newItemObj); response.writeHead( 200, "OK", {'Content-Type': 'text/plain' }) response.end() @@ -79,4 +89,8 @@ const sendData = function( response, items ) { response.end(); }; +function calcEuroPrice(usd) { + return usd * 0.91; +} + server.listen( process.env.PORT || port ) From 5f0e2b722cfbb4ce7e140456ba5aa6ad94348927 Mon Sep 17 00:00:00 2001 From: "Glitch (a2-benemrick)" Date: Mon, 9 Sep 2019 05:00:19 +0000 Subject: [PATCH 45/61] =?UTF-8?q?=F0=9F=92=BA=F0=9F=95=B5=20Checkpoint=20.?= =?UTF-8?q?/public/index.html:2480412/128=20./public/js/scripts.js:2480412?= =?UTF-8?q?/683=20./server.improved.js:2480412/260?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 5 ++--- public/js/scripts.js | 36 ------------------------------------ server.improved.js | 3 +++ 3 files changed, 5 insertions(+), 39 deletions(-) diff --git a/public/index.html b/public/index.html index f0d6b079..450cd33d 100755 --- a/public/index.html +++ b/public/index.html @@ -67,7 +67,7 @@
@@ -153,7 +153,6 @@
${favs[i].name}
const newItem = function( e ) { // prevent default form action from being carried out - // { 'name': 'Yeezy 350 Boost', 'category': 'Fashion', 'rating': 5, 'usd': 200, 'eur': 182, 'link' e.preventDefault() const inName = document.querySelector( '#name' ), inCategory = document.querySelector( '#category' ), @@ -167,7 +166,7 @@
${favs[i].name}
body }) .then( function( response ) { - refresh + refresh() console.log( response ) }) return false diff --git a/public/js/scripts.js b/public/js/scripts.js index 6bb8b6a4..e69de29b 100755 --- a/public/js/scripts.js +++ b/public/js/scripts.js @@ -1,36 +0,0 @@ -const submit = function( e ) { - // prevent default form action from being carried out - e.preventDefault() - - const input = document.querySelector( '#yourname' ), - json = { yourname: input.value }, - body = JSON.stringify( json ) - - fetch( '/submit', { - method:'POST', - body - }) - .then( function( response ) { - // do something with the reponse - console.log( response ) - }) - - return false -} - -const url = function() { - unsplash.search.photos("shopping", 1) - .then(toJson) - .then(json => { - // Your code - }); -} - -const randPhoto = function() { - unsplash.search.photos("dogs", 1) - .then(toJson) - .then(json => { - // Your code - }); -} - diff --git a/server.improved.js b/server.improved.js index da8a0da4..52c41aaf 100644 --- a/server.improved.js +++ b/server.improved.js @@ -54,6 +54,9 @@ const handlePost = function( request, response ) { }; appdata.push(newItemObj); + + // sort the data to ensure favorite are always first 3 elements + appdata.sort((a, b) => (a.rating < b.rating) ? 1 : (a.rating === b.rating) ? ((a.usd > b.usd) ? 1 : -1) : -1 ) response.writeHead( 200, "OK", {'Content-Type': 'text/plain' }) response.end() From 3f3364a890cccbb9b82ae9388c05bc0142a8de5c Mon Sep 17 00:00:00 2001 From: "Glitch (a2-benemrick)" Date: Mon, 9 Sep 2019 11:22:51 +0000 Subject: [PATCH 46/61] =?UTF-8?q?=F0=9F=8F=A5=E2=8F=B1=20Checkpoint=20./se?= =?UTF-8?q?rver.improved.js:2480412/1299?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server.improved.js | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/server.improved.js b/server.improved.js index 52c41aaf..e0717e28 100644 --- a/server.improved.js +++ b/server.improved.js @@ -15,8 +15,12 @@ const appdata = [ const server = http.createServer( function( request,response ) { if( request.method === 'GET' ) { handleGet( request, response ) - }else if( request.method === 'POST' ){ + } else if( request.method === 'POST' ){ handlePost( request, response ) + } else if( request.method === 'DELETE' ){ + handleDelete( request, response ) + } else { + //handlePut( request, response ) } }) @@ -63,6 +67,26 @@ const handlePost = function( request, response ) { }) } +const handleDelete = function( request, response ) { + let dataString = '' + + request.on( 'data', function( data ) { + dataString += data + }) + + request.on( 'end', function() { + console.log( JSON.parse( dataString ) ) + + appdata.splice(newItemObj); + + // sort the data to ensure favorite are always first 3 elements + appdata.sort((a, b) => (a.rating < b.rating) ? 1 : (a.rating === b.rating) ? ((a.usd > b.usd) ? 1 : -1) : -1 ) + + response.writeHead( 200, "OK", {'Content-Type': 'text/plain' }) + response.end() + }) +} + const sendFile = function( response, filename ) { const type = mime.getType( filename ) From 9c0018270a9f726ebe6fd58c1a6e0fcbb4987f51 Mon Sep 17 00:00:00 2001 From: "Glitch (a2-benemrick)" Date: Mon, 9 Sep 2019 11:36:27 +0000 Subject: [PATCH 47/61] =?UTF-8?q?=F0=9F=90=A2=F0=9F=91=B6=20Checkpoint=20.?= =?UTF-8?q?/server.improved.js:2480412/622=20./public/index.html:2480412/4?= =?UTF-8?q?14?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 8 +++++++- server.improved.js | 15 +++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/public/index.html b/public/index.html index 450cd33d..20a8733d 100755 --- a/public/index.html +++ b/public/index.html @@ -128,7 +128,7 @@
${favs[i].name}
Category USD EURO - Rating + Rating @@ -142,6 +142,8 @@
${favs[i].name}
$${favs[i].usd} €${favs[i].eur} ${stars} + + `; } @@ -171,12 +173,16 @@
${favs[i].name}
}) return false } + + const const refresh = function() { loadFavorites(); loadAllResults(); } + + window.onload = function() { refresh() diff --git a/server.improved.js b/server.improved.js index e0717e28..2bf33806 100644 --- a/server.improved.js +++ b/server.improved.js @@ -59,9 +59,8 @@ const handlePost = function( request, response ) { appdata.push(newItemObj); - // sort the data to ensure favorite are always first 3 elements - appdata.sort((a, b) => (a.rating < b.rating) ? 1 : (a.rating === b.rating) ? ((a.usd > b.usd) ? 1 : -1) : -1 ) - + sortData(); + response.writeHead( 200, "OK", {'Content-Type': 'text/plain' }) response.end() }) @@ -77,10 +76,9 @@ const handleDelete = function( request, response ) { request.on( 'end', function() { console.log( JSON.parse( dataString ) ) - appdata.splice(newItemObj); + appdata.splice(dataString.index, 1); - // sort the data to ensure favorite are always first 3 elements - appdata.sort((a, b) => (a.rating < b.rating) ? 1 : (a.rating === b.rating) ? ((a.usd > b.usd) ? 1 : -1) : -1 ) + sortData(); response.writeHead( 200, "OK", {'Content-Type': 'text/plain' }) response.end() @@ -120,4 +118,9 @@ function calcEuroPrice(usd) { return usd * 0.91; } +function sortData() { + // sort the data to ensure favorite are always first 3 elements + appdata.sort((a, b) => (a.rating < b.rating) ? 1 : (a.rating === b.rating) ? ((a.usd > b.usd) ? 1 : -1) : -1 ); +} + server.listen( process.env.PORT || port ) From fbd71f45b8684b40387f606e1ef7ba5f201161d8 Mon Sep 17 00:00:00 2001 From: "Glitch (a2-benemrick)" Date: Mon, 9 Sep 2019 11:48:22 +0000 Subject: [PATCH 48/61] =?UTF-8?q?=F0=9F=8C=8C=F0=9F=91=86=20Checkpoint=20.?= =?UTF-8?q?/public/index.html:2480412/635?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/public/index.html b/public/index.html index 20a8733d..3e12b96f 100755 --- a/public/index.html +++ b/public/index.html @@ -174,7 +174,18 @@
${favs[i].name}
return false } - const + const deleteItem = function ( e, arrPosition ) { + // prevent default form action from being carried out + e.preventDefault() + + const index = { index: arrPosition }; + const body = JSON.stringify(index); + fetch('/delete', { + method: 'POST', + body + }); + refresh(); + } const refresh = function() { loadFavorites(); @@ -182,12 +193,14 @@
${favs[i].name}
} - window.onload = function() { refresh() const button = document.getElementById( 'newBtn' ) button.onclick = newItem + + const button = document.getElementById( 'newBtn' ) + button.onclick = newItem } From 16ef627b9f3d634e446163c76476d4aa1ccbd5bc Mon Sep 17 00:00:00 2001 From: "Glitch (a2-benemrick)" Date: Mon, 9 Sep 2019 11:59:22 +0000 Subject: [PATCH 49/61] =?UTF-8?q?=F0=9F=92=BD=F0=9F=8E=A2=20Checkpoint=20.?= =?UTF-8?q?/public/index.html:2480412/331?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/public/index.html b/public/index.html index 3e12b96f..4a5cdfb9 100755 --- a/public/index.html +++ b/public/index.html @@ -143,7 +143,7 @@
${favs[i].name}
€${favs[i].eur} ${stars} - + `; } @@ -174,14 +174,12 @@
${favs[i].name}
return false } - const deleteItem = function ( e, arrPosition ) { - // prevent default form action from being carried out - e.preventDefault() - - const index = { index: arrPosition }; - const body = JSON.stringify(index); + const deleteItem = function ( arrPosition ) { + const indexJson = { index: arrPosition }; + debugger + const body = JSON.stringify(indexJson); fetch('/delete', { - method: 'POST', + method: 'DELETE', body }); refresh(); @@ -198,9 +196,7 @@
${favs[i].name}
const button = document.getElementById( 'newBtn' ) button.onclick = newItem - - const button = document.getElementById( 'newBtn' ) - button.onclick = newItem + } From 1f559b46a4107350e148a6f072df71b21e8ae344 Mon Sep 17 00:00:00 2001 From: "Glitch (a2-benemrick)" Date: Mon, 9 Sep 2019 12:11:20 +0000 Subject: [PATCH 50/61] =?UTF-8?q?=E2=9B=84=EF=B8=8F=E2=8F=B3=20Checkpoint?= =?UTF-8?q?=20./public/index.html:2480412/3515?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 79 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 78 insertions(+), 1 deletion(-) diff --git a/public/index.html b/public/index.html index 4a5cdfb9..8b0fdc48 100755 --- a/public/index.html +++ b/public/index.html @@ -18,6 +18,7 @@

shopr

+