diff --git a/index.html b/index.html index c371c22..eb22574 100644 --- a/index.html +++ b/index.html @@ -3,17 +3,41 @@ Quotes for Life - + - + +
-

Quotes
For
Life

-
+

Quotes
For
Life

+
+ +
+
- +
diff --git a/quote.js b/quote.js index 7b75d41..085d989 100644 --- a/quote.js +++ b/quote.js @@ -1,28 +1,35 @@ function randomQuote() { $.ajax({ - url: "https://api.forismatic.com/api/1.0/", - jsonp: "jsonp", - dataType: "jsonp", - data: { - method: "getQuote", - lang: "en", - format: "jsonp" - }, - success: function(quote) { - $('#Quote').html('“'+quote.quoteText+'”') - $('#author').html("-"+quote.quoteAuthor) - } - }); + url: "https://api.forismatic.com/api/1.0/", + jsonp: "jsonp", + dataType: "jsonp", + data: { + method: "getQuote", + lang: "en", + format: "jsonp" + }, + success: function(quote) { + $('#twitter-share-button').html(''); + $('#Quote').html('“'+quote.quoteText+'”') + $('#author').html("-"+quote.quoteAuthor) + var tweetContent = quote.quoteText+'\r\n - '+quote.quoteAuthor; + twttr.widgets.createShareButton( + '/', + document.getElementById('twitter-share-button'), + {text: tweetContent} + ); + } + }); } //Click on the button to generate another random quote $(document).ready(function(){ - randomQuote(); + randomQuote(); $('#random').on('click', function() { - - randomQuote(); - - }); + + randomQuote(); + + }); }); \ No newline at end of file