Skip to content

Instantly share code, notes, and snippets.

/x
Created Apr 27, 2009

Embed
What would you like to do?
var noun_type_service = new CmdUtils.NounType( "service",
["facebook", "twitter", "digg", "reddit"]
);
CmdUtils.CreateCommand({
name: "share",
icon: "http://static.addtoany.com/buttons/share_16_16.png",
description: "Share to any service",
modifiers: {"to": noun_type_service},
_getAddToAnyUrl: function(mods) {
var document = CmdUtils.getDocument();
var location = document.location.href;
var title = document.title || '';
var selection = document.getSelection().substring(0, 1200) || '';
var service = mods.to.text || '';
var params = Utils.paramsToString({
linkurl: location,
linkname: title,
linknote: selection
});
if ( service )
var addtoany = "http://www.addtoany.com/add_to/"
+ service
+ params;
else
var addtoany = "http://www.addtoany.com/share_save"
+ params;
return addtoany;
},
execute: function(directObject, mods) {
Utils.openUrlInBrowser( this._getAddToAnyUrl(mods) );
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.