Skip to content

Commit

Permalink
Improved tweetThis() function
Browse files Browse the repository at this point in the history
  • Loading branch information
KBPsystem777 committed Oct 11, 2017
1 parent 46efac7 commit 189fbcc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,14 @@ function newQuote() {
console.log(randomNumber)
console.log(quotes[randomNumber]);
document.getElementById('quoteDisplay').innerHTML = quotes[randomNumber];


}
function tweetThis() {
window.open('https://twitter.com/intent/tweet?text="' + quotes + '"', '_blank');
var tweetMessage = quoteDisplay.textContent;
if (tweetMessage === "Click to Generate Game Of Thrones Inspired Quotes...") {
alert('Generate quotes first before sharing!');
} else {
window.open('https://twitter.com/intent/tweet?text="' + tweetMessage + '"&via=kbpsystem', '_blank');
}
}

0 comments on commit 189fbcc

Please sign in to comment.