Skip to content

Instantly share code, notes, and snippets.

@astrotars
Created July 30, 2018 22:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save astrotars/a66ab9675f66af437925cd23ed813030 to your computer and use it in GitHub Desktop.
Save astrotars/a66ab9675f66af437925cd23ed813030 to your computer and use it in GitHub Desktop.
tweet(title, url) {
const getWindowOptions = function() {
const width = 500;
const height = 350;
const left = window.innerWidth / 2 - width / 2;
const top = window.innerHeight / 2 - height / 2;
return [
'resizable,scrollbars,status',
'height=' + height,
'width=' + width,
'left=' + left,
'top=' + top,
].join();
};
const shareUrl = `https://twitter.com/intent/tweet?url=${url}&text=${title}&hashtags=Winds`;
const win = window.open(shareUrl, 'Share on Twitter', getWindowOptions());
win.opener = null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment