Skip to content

Instantly share code, notes, and snippets.

@romannurik
Created June 7, 2010 07:46
Show Gist options
  • Save romannurik/428350 to your computer and use it in GitHub Desktop.
Save romannurik/428350 to your computer and use it in GitHub Desktop.
// ==ClosureCompiler==
// @output_file_name google-buzz-bookmarklet.js
// @compilation_level SIMPLE_OPTIMIZATIONS
// ==/ClosureCompiler==
// Buzz API - Buttons: http://code.google.com/apis/buzz/buttons_and_gadgets.html#post_to_google_buzz
// Closure Compiler Service: http://closure-compiler.appspot.com/home
(function(){
var url = window.location.href;
var title = document.title;
var text = window.getSelection ? window.getSelection().toString() : (document.selection ? document.selection.createRange().text : '');
window.open(
'http://www.google.com/buzz/post' +
'?message=' + window.encodeURIComponent(title + (text ? '\n\n\"' + text + '\"': '')) +
'&url=' + window.encodeURIComponent(url),
'_blank',
'resizable=0,scrollbars=0,width=690,height=415'
);
})()
1. Create a new bookmark
2. Name it "Post to Google Buzz"
3. Set the address to:
javascript:(function(){var b=window.location.href,c=document.title,a=window.getSelection?window.getSelection().toString():document.selection?document.selection.createRange().text:"";window.open("http://www.google.com/buzz/post?message="+window.encodeURIComponent(c+(a?'\n\n"'+a+'"':""))+"&url="+window.encodeURIComponent(b),"_blank","resizable=0,scrollbars=0,width=690,height=415")})();
@sporkmonger
Copy link

Nice!

Edit: Tried to put a hyperlink here for drag-and-drop, but of course it got sanitized. Silly me.

@sporkmonger
Copy link

Right... it'd be bad if that hyperlink actually worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment