Saturday, October 19, 2013

Google Bookmarks shortcut in pentadactyl


Till now I used Shareholic extension to add bookmarks in Google for the websites.

This worked great but I had to install a addon just for this functionality. I like minimalistic design so I don't have a menuar, bookmarks bar, location bar etc, it's just the webpage. That's the very reason I use pentadactyl on my Firefox. So, the very thought of adding a addon bugs me.

Just today, I figured that I can map javascript functions with shortcuts. So, here is a little thing that you can add in your `.pentadactylrc` and add bookmarks just by pressing a shortcut.
map -modes=n z -javascript (function(){var a=window,b=content.document,c=encodeURIComponent,d=a.open("https://www.google.com/bookmarks/mark?op=edit&output=popup&bkmk="+c(b.location)+"&title="+c(b.title),"bkmk_popup","left="+((a.screenX||a.screenLeft)+10)+",top="+((a.screenY||a.screenTop)+10)+",height=510px,width=550px,resizable=1,alwaysRaised=1");a.setTimeout(function(){d.focus()},300)})();
Notice the "content" in variable "b", that's because if I just use "document.location", I'll get the value as  "chrome://browser/content/browser.xul".
Now, you can press "z" and add current location to Google Bookmarks.



1 comment: