Skip to content

Instantly share code, notes, and snippets.

@yoshimov
Created October 12, 2011 01:26
Show Gist options
  • Select an option

  • Save yoshimov/1279962 to your computer and use it in GitHub Desktop.

Select an option

Save yoshimov/1279962 to your computer and use it in GitHub Desktop.
share url on google plus
CmdUtils.CreateCommand({
names: ["share url on plus", "share url on google plus", "plus url"],
description: "Share URL on Google+.",
help: "Just execute this command on the page which you want to share.",
author: {
name: "NOMURA Yoshihide",
email: "nomura@pobox.com",
homepage: "http://yoshimov.com/",
},
license: "GPL",
homepage: "http://yoshimov.com/",
icon: "http://yoshimov.com/favicon.ico",
arguments: [],
execute: function execute(args) {
var url = "https://plusone.google.com/_/+1/confirm?hl=jp&url="
+ encodeURIComponent(CmdUtils.getDocument().location.href);
var win = CmdUtils.getWindow().open(url, "_blank", "width=500,height=400");
Utils.setTimeout(function() {
win.focus();
});
},
preview: function preview(pblock, args) {
pblock.innerHTML = "Share on Google+ this page.";
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment