-
-
Save anonymous/102242 to your computer and use it in GitHub Desktop.
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
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