mochiflappe
4/8/2014 - 4:08 PM

実行するとモニターの真ん中にtwitterのwindowを出す関数

実行するとモニターの真ん中にtwitterのwindowを出す関数

function tweetPop() {
  var url = "https://twitter.com/share?";
  url += "text=" + encodeURI("example_text");
  url += "&via=twitter_account";
  url += "&url=" + encodeURI("http://example.com/");
  url += "&hashtags=" + encodeURI("hashtag");

  var popW = 550;
  var popH = 420;
  var x = (screen.width - popW) / 2;
  var y = (screen.height - popH) / 2;
  var size = 'width=' + popW;
  size += ',height=' + popH;
  size += ',top=' + y;
  size += ',left=' + x;

  window.open(url, "tweetPop", size);
}