Created
January 22, 2017 09:46
-
-
Save stephenjfox/8ef48cc2662ba046784cfe35099b440a to your computer and use it in GitHub Desktop.
Create and send a tweet for a Random Quote Machine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Read the text from our elements and compose a tweet POST request string*/ | |
const formTweetUrl = () => { | |
// Element initializations elided | |
const text = mainQuoteElement.innerHTML; | |
const author = authorElement.innerHTML; | |
const tweetUrl = `https://twitter.com/share?text="${text}" - ${author}&url=http://codepen.io/stevemasta34/full/GrWmjJ/`; | |
return tweetUrl; | |
}; | |
const sendTweet = () => { | |
console.log("Tweeting"); | |
window.open(formTweetUrl()); // the money maker ;) | |
console.log("Tweeted"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment