Created
March 4, 2009 14:36
-
-
Save eversonl/73855 to your computer and use it in GitHub Desktop.
post-to-facebook
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
//post-to-facebook | |
CmdUtils.CreateCommand({ | |
name: "post-to-facebook", | |
icon: "http://www.facebook.com/favicon.ico", | |
homepage: "http://www.leeeverson.co.uk/20090223/my-ubiquity-commands/", | |
author: { name: "Lee Everson", email: "lee@0-21.co.uk"}, | |
license: "GPL", | |
description: "quickly share any web page with your friends, even when you're not on Facebook.", | |
help: "The Share Bookmarklet will recognise when you share videos and music, making them easy to play within Facebook.", | |
preview: function(pblock) { | |
pblock.innerHTML = "Executes the <b>Facebook</b> bookmarklet<br>quickly share any web page with your friends, even when you're not on Facebook."; | |
}, | |
execute: function() { | |
var bookmarkletCode = "javascript:var%20d=document,f='http://www.facebook.com/share',l=d.location,e=encodeURIComponent,p='.php?src=bm&v=4&i=1236177022&u='+e(l.href)+'&t='+e(d.title);1;try{if%20(!/^(.*\.)?facebook\.[^.]*$/.test(l.host))throw(0);share_internal_bookmarklet(p)}catch(z)%20{a=function()%20{if%20(!window.open(f+'r'+p,'sharer','toolbar=0,status=0,resizable=1,width=626,height=436'))l.href=f+p};if%20(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else{a()}}void(0)"; | |
var urlBar = context.chromeWindow.document.getElementById("urlbar"); | |
var oldURL = urlBar.value; | |
urlBar.value = bookmarkletCode; | |
context.chromeWindow.handleURLBarCommand(); | |
urlBar.value = oldURL; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment