From 24d0e7d7051eb5035cea44e73824e97e20b3aa68 Mon Sep 17 00:00:00 2001 From: Jules Forrest Date: Wed, 15 Mar 2017 19:37:35 -0700 Subject: [PATCH 1/7] type --- index.html | 1 + styles/normalize.css | 2 +- styles/style.css | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 3ba0ab0..48585cb 100755 --- a/index.html +++ b/index.html @@ -5,6 +5,7 @@ Feedr @ GA + diff --git a/styles/normalize.css b/styles/normalize.css index 5e5e3c8..8251d0e 100755 --- a/styles/normalize.css +++ b/styles/normalize.css @@ -7,7 +7,7 @@ */ html { - font-family: sans-serif; /* 1 */ + font-family: 'Work Sans', sans-serif; /* 1 */ -ms-text-size-adjust: 100%; /* 2 */ -webkit-text-size-adjust: 100%; /* 2 */ } diff --git a/styles/style.css b/styles/style.css index fcfbf38..271fd3f 100755 --- a/styles/style.css +++ b/styles/style.css @@ -1,4 +1,3 @@ -/* General styles */ .container { max-width: 1000px; margin: 0 auto; From 0a5b700e03fec1d2c971500fbd18f091915c72aa Mon Sep 17 00:00:00 2001 From: Jules Forrest Date: Wed, 15 Mar 2017 19:40:27 -0700 Subject: [PATCH 2/7] GA label --- js/app.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/js/app.js b/js/app.js index a6502cd..c20ed30 100755 --- a/js/app.js +++ b/js/app.js @@ -1,3 +1,5 @@ /* + GA SF JSD6 + Jules Forrest Please add all Javascript code to this file. */ From c8e2a1f9009469df7fb14eae84e51cb4194175da Mon Sep 17 00:00:00 2001 From: Jules Forrest Date: Wed, 15 Mar 2017 21:20:36 -0700 Subject: [PATCH 3/7] got popup working --- index.html | 8 ++++---- js/app.js | 11 +++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index 48585cb..4d0f396 100755 --- a/index.html +++ b/index.html @@ -56,7 +56,7 @@

Article title here

-

Test article title

+

Test article title 1

Lifestyle
@@ -69,7 +69,7 @@
Lifestyle
-

Test article title

+

Test article title 2

Lifestyle
@@ -82,7 +82,7 @@
Lifestyle
-

Test article title

+

Test article title 3

Lifestyle
@@ -95,7 +95,7 @@
Lifestyle
-

Test article title

+

Test article title 4

Lifestyle
diff --git a/js/app.js b/js/app.js index c20ed30..1180145 100755 --- a/js/app.js +++ b/js/app.js @@ -3,3 +3,14 @@ Jules Forrest Please add all Javascript code to this file. */ + +$('.article').click(function(){ + $('#popUp').removeClass('hidden loader'); + var headline = $(this).find('h3').text(); + $('#popUp').find('h1').text(headline); + +}) + +$('.closePopUp').click(function(){ + $('#popUp').addClass('hidden'); +}); From c8487a1626567b570102e7e4d11718341b2809db Mon Sep 17 00:00:00 2001 From: Jules Forrest Date: Fri, 31 Mar 2017 22:18:00 -0700 Subject: [PATCH 4/7] basic stuff working for digg --- js/app.js | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/js/app.js b/js/app.js index 1180145..8d9ffc8 100755 --- a/js/app.js +++ b/js/app.js @@ -4,13 +4,45 @@ Please add all Javascript code to this file. */ -$('.article').click(function(){ +$('#search').click(function(){ + $(this).toggleClass('active'); +}); + +$('#main').on('click', '.article', function(){ $('#popUp').removeClass('hidden loader'); var headline = $(this).find('h3').text(); $('#popUp').find('h1').text(headline); - -}) + debugger + var description = $(this).data("popUpData").description; + $('#popUp').find('p').text(description); + var url = $(this).data("popUpData").url; + $('#popUp').find('a').attr("href", url); +}); $('.closePopUp').click(function(){ $('#popUp').addClass('hidden'); }); + +var createArticleListing = function(title, image, category, impressions) { + return `
+ +
+
+

${title}

+
${category}
+
+
+ ${impressions} +
+
`; +} + + +$.get("https://accesscontrolalloworiginall.herokuapp.com/http://digg.com/api/news/popular.json", function(results){ + console.log(results); + results.data.feed.forEach(function(result){ + var newArticle = createArticleListing(result.content.title); + newArticle = $(newArticle).data( "popUpData", { description: result.content.description, url: result.content.url } ); + $("#main").append(newArticle); + }) +}) From 132d3cc96cd0858633fe24c2d808bc2e1e9c93ba Mon Sep 17 00:00:00 2001 From: Jules Forrest Date: Sat, 1 Apr 2017 08:44:55 -0700 Subject: [PATCH 5/7] apis working --- index.html | 52 ------------------------------------------------ js/app.js | 28 +++++++++++++++++++++----- styles/style.css | 5 +++++ 3 files changed, 28 insertions(+), 57 deletions(-) diff --git a/index.html b/index.html index 4d0f396..4ea7a52 100755 --- a/index.html +++ b/index.html @@ -51,58 +51,6 @@

Article title here

- - - -
diff --git a/js/app.js b/js/app.js index 8d9ffc8..f71f3b0 100755 --- a/js/app.js +++ b/js/app.js @@ -12,11 +12,10 @@ $('#main').on('click', '.article', function(){ $('#popUp').removeClass('hidden loader'); var headline = $(this).find('h3').text(); $('#popUp').find('h1').text(headline); - debugger var description = $(this).data("popUpData").description; $('#popUp').find('p').text(description); var url = $(this).data("popUpData").url; - $('#popUp').find('a').attr("href", url); + $('#popUp').find('.popUpAction').attr("href", url); }); $('.closePopUp').click(function(){ @@ -29,7 +28,7 @@ var createArticleListing = function(title, image, category, impressions) {

${title}

-
${category}
+
${category}
${impressions} @@ -37,12 +36,31 @@ var createArticleListing = function(title, image, category, impressions) {
`; } +$.get("https://accesscontrolalloworiginall.herokuapp.com/http://content.guardianapis.com/search?show-fields=thumbnail%2CtrailText%2Cwordcount&api-key=e8a00826-f3d6-4965-a89b-16ad2066bfa4", function(results){ + console.log(results); + results.response.results.forEach(function(result){ + var newArticle = createArticleListing(result.webTitle, result.fields.thumbnail, result.sectionName, result.fields.wordcount); + newArticle = $(newArticle).data( "popUpData", { description: result.fields.trailText, url: result.webUrl, timestamp: result.webPublicationDate } ); + $("#main").append(newArticle); + }) +}) + +$.get("http://api.nytimes.com/svc/topstories/v2/home.json?api-key=2999869bd86b4da48852d255f65250ff", function(results){ + console.log(results); + results.results.forEach(function(result){ + var newArticle = createArticleListing(result.title, result.multimedia[0].url, result.section, result.abstract.length); + newArticle = $(newArticle).data( "popUpData", { description: result.abstract, url: result.url, timestamp: result.published_date} ); + $("#main").append(newArticle); + }) +}) + + $.get("https://accesscontrolalloworiginall.herokuapp.com/http://digg.com/api/news/popular.json", function(results){ console.log(results); results.data.feed.forEach(function(result){ - var newArticle = createArticleListing(result.content.title); - newArticle = $(newArticle).data( "popUpData", { description: result.content.description, url: result.content.url } ); + var newArticle = createArticleListing(result.content.title, result.content.media.images[0].url, result.content.tags[0].name, result.digg_score); + newArticle = $(newArticle).data( "popUpData", { description: result.content.description, url: result.content.url, timestamp: result.content.date_published } ); $("#main").append(newArticle); }) }) diff --git a/styles/style.css b/styles/style.css index 271fd3f..11f0282 100755 --- a/styles/style.css +++ b/styles/style.css @@ -234,3 +234,8 @@ nav ul ul li { text-align: right; color: #097FB2; } + +.category { + text-transform: uppercase; + letter-spacing: 1px; +} From 8925280e41bb081591c91b838a00e0a13faec4f5 Mon Sep 17 00:00:00 2001 From: Jules Forrest Date: Sat, 1 Apr 2017 13:07:55 -0700 Subject: [PATCH 6/7] filtering --- index.html | 6 +-- js/app.js | 119 +++++++++++++++++++++++++++++++---------------- styles/style.css | 2 +- 3 files changed, 82 insertions(+), 45 deletions(-) diff --git a/index.html b/index.html index 4ea7a52..2e0edef 100755 --- a/index.html +++ b/index.html @@ -26,9 +26,9 @@ diff --git a/js/app.js b/js/app.js index f71f3b0..f68774c 100755 --- a/js/app.js +++ b/js/app.js @@ -4,6 +4,58 @@ Please add all Javascript code to this file. */ +var createArticleListing = function(title, image, category, impressions, timestamp, publication) { + return `
+ +
+
+

${title}

+
${category}
+
+
+ ${impressions} +
+
`; +} + +$(function() { + console.log("hi"); + $('#popUp').removeClass('hidden'); + + $.get("https://accesscontrolalloworiginall.herokuapp.com/http://content.guardianapis.com/search?show-fields=thumbnail%2CtrailText%2Cwordcount&api-key=e8a00826-f3d6-4965-a89b-16ad2066bfa4", function(results){ + console.log(results); + results.response.results.forEach(function(result){ + var newArticle = createArticleListing(result.webTitle, result.fields.thumbnail, result.sectionName, result.fields.wordcount, result.webPublicationDate, "guardian"); + newArticle = $(newArticle).data( "articleData", { description: result.fields.trailText, url: result.webUrl } ); + $("#main").append(newArticle); + + }) + }) + + $.get("http://api.nytimes.com/svc/topstories/v2/home.json?api-key=2999869bd86b4da48852d255f65250ff", function(results){ + console.log(results); + results.results.forEach(function(result){ + var newArticle = createArticleListing(result.title, result.multimedia[0].url, result.section, result.abstract.length, result.published_date, "nyt"); + newArticle = $(newArticle).data( "articleData", { description: result.abstract, url: result.url } ); + $("#main").append(newArticle); + // console.log(newArticle.data("articleData").timestamp); + }) + }) + + $.get("https://accesscontrolalloworiginall.herokuapp.com/http://digg.com/api/news/popular.json", function(results){ + console.log(results); + results.data.feed.forEach(function(result){ + var newArticle = createArticleListing(result.content.title, result.content.media.images[0].url, result.content.tags[0].name, result.digg_score, result.date_published, "digg"); + newArticle = $(newArticle).data( "articleData", { description: result.content.description, url: result.content.url } ); + $("#main").append(newArticle); + // console.log(newArticle.data("articleData").timestamp); + }) + }) + + $('#popUp').addClass('hidden'); + +}); + $('#search').click(function(){ $(this).toggleClass('active'); }); @@ -12,9 +64,9 @@ $('#main').on('click', '.article', function(){ $('#popUp').removeClass('hidden loader'); var headline = $(this).find('h3').text(); $('#popUp').find('h1').text(headline); - var description = $(this).data("popUpData").description; + var description = $(this).data("articleData").description; $('#popUp').find('p').text(description); - var url = $(this).data("popUpData").url; + var url = $(this).data("articleData").url; $('#popUp').find('.popUpAction').attr("href", url); }); @@ -22,45 +74,30 @@ $('.closePopUp').click(function(){ $('#popUp').addClass('hidden'); }); -var createArticleListing = function(title, image, category, impressions) { - return `
- -
-
-

${title}

-
${category}
-
-
- ${impressions} -
-
`; -} - -$.get("https://accesscontrolalloworiginall.herokuapp.com/http://content.guardianapis.com/search?show-fields=thumbnail%2CtrailText%2Cwordcount&api-key=e8a00826-f3d6-4965-a89b-16ad2066bfa4", function(results){ - console.log(results); - results.response.results.forEach(function(result){ - var newArticle = createArticleListing(result.webTitle, result.fields.thumbnail, result.sectionName, result.fields.wordcount); - newArticle = $(newArticle).data( "popUpData", { description: result.fields.trailText, url: result.webUrl, timestamp: result.webPublicationDate } ); - $("#main").append(newArticle); - }) -}) - -$.get("http://api.nytimes.com/svc/topstories/v2/home.json?api-key=2999869bd86b4da48852d255f65250ff", function(results){ - console.log(results); - results.results.forEach(function(result){ - var newArticle = createArticleListing(result.title, result.multimedia[0].url, result.section, result.abstract.length); - newArticle = $(newArticle).data( "popUpData", { description: result.abstract, url: result.url, timestamp: result.published_date} ); - $("#main").append(newArticle); - }) -}) +$('#main').on('click', '.article', function(){ + $('#popUp').removeClass('hidden loader'); + var headline = $(this).find('h3').text(); + $('#popUp').find('h1').text(headline); + var description = $(this).data("articleData").description; + $('#popUp').find('p').text(description); + var url = $(this).data("articleData").url; + $('#popUp').find('.popUpAction').attr("href", url); +}); +$('#nyt').on('click', function(){ + $("#main").find(`[data-pub="nyt"]`).removeClass('hidden'); + $("#main").find(`[data-pub="guardian"]`).addClass('hidden'); + $("#main").find(`[data-pub="digg"]`).addClass('hidden'); +}); +$('#guardian').on('click', function(){ + $("#main").find(`[data-pub="guardian"]`).removeClass('hidden'); + $("#main").find(`[data-pub="nyt"]`).addClass('hidden'); + $("#main").find(`[data-pub="digg"]`).addClass('hidden'); +}); -$.get("https://accesscontrolalloworiginall.herokuapp.com/http://digg.com/api/news/popular.json", function(results){ - console.log(results); - results.data.feed.forEach(function(result){ - var newArticle = createArticleListing(result.content.title, result.content.media.images[0].url, result.content.tags[0].name, result.digg_score); - newArticle = $(newArticle).data( "popUpData", { description: result.content.description, url: result.content.url, timestamp: result.content.date_published } ); - $("#main").append(newArticle); - }) -}) +$('#digg').on('click', function(){ + $("#main").find(`[data-pub="digg"]`).removeClass('hidden'); + $("#main").find(`[data-pub="nyt"]`).addClass('hidden'); + $("#main").find(`[data-pub="guardian"]`).addClass('hidden'); +}); diff --git a/styles/style.css b/styles/style.css index 11f0282..42732c3 100755 --- a/styles/style.css +++ b/styles/style.css @@ -173,7 +173,7 @@ nav ul li:hover > ul { /* First Tier Dropdown */ nav ul ul li { - width:170px; + width: 200px; float:none; display:list-item; position: relative; From c53ef4def31427081be47fdb362f9a3a951a727f Mon Sep 17 00:00:00 2001 From: Jules Forrest Date: Sun, 2 Apr 2017 08:51:04 -0700 Subject: [PATCH 7/7] finished project --- index.html | 6 +-- js/app.js | 130 ++++++++++++++++++++++++++++++++++------------------- 2 files changed, 86 insertions(+), 50 deletions(-) diff --git a/index.html b/index.html index 2e0edef..a1657ad 100755 --- a/index.html +++ b/index.html @@ -21,11 +21,11 @@
-

Feedr

+