Skip to content

Commit

Permalink
Fix link bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
chandler767 committed May 1, 2020
1 parent 6a230f1 commit ec729f3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions good-news-dashboard/dashboard.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<html>
<head>
<link rel="stylesheet" href="styles.css?version=1.2">
<link rel="stylesheet" href="styles.css?version=2">
<link rel="stylesheet" href="https://use.typekit.net/smi8zdn.css">
<meta charset="UTF-8">
<title>Good News Machine</title>
Expand Down Expand Up @@ -45,7 +45,7 @@ <h1>TODAY'S BEST NEWS</h1>
</div>
</div>
<script src="https://cdn.pubnub.com/sdk/javascript/pubnub.4.27.4.js"></script>
<script src="dashboard.js?version=1.2"></script>
<script src="dashboard.js?version=2"></script>
<script src="https://cdn.jsdelivr.net/npm/@joeattardi/emoji-button@3.0.0/dist/index.min.js"></script>
</body>
</html>
Expand Down
3 changes: 2 additions & 1 deletion good-news-dashboard/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ function refreshPosts() {
}
let title = truncate(currentPost.post.title, 98);
let votes = currentPost.votes;
let link = currentPost.post.link;
let request = new XMLHttpRequest();
request.onreadystatechange = function() {
let postVoteCount = 0;
Expand All @@ -238,7 +239,7 @@ function refreshPosts() {
if (postVoteCount < votes) { // The object may have been removed from history.
postVoteCount = votes;
}
posts.push([Number(postVoteCount), "<div class=\"top-story\"><h2><a href=\""+currentPost.post.link+"\" target=\"_blank\">"+title+"</a></h2><h3>"+description+"</h3><p>⭐ "+postVoteCount+" Votes</p></div>"]);
posts.push([Number(postVoteCount), "<div class=\"top-story\"><h2><a href=\""+link+"\" target=\"_blank\">"+title+"</a></h2><h3>"+description+"</h3><p>⭐ "+postVoteCount+" Votes</p></div>"]);
addToTop(posts.sort(function(a,b) {
return a[0]-b[0];
}));
Expand Down

0 comments on commit ec729f3

Please sign in to comment.