"Press This" feature for Drupal

After a bit of digging, I came across this great PressThis like feature for Drupal. Quick to setup and implement for Drupal 6 and Drupal 7! Start posting straight to your Drupal site in three basic steps:

  1. Install the Prepopulate Module
  2. tweak some javascript code with two custom variables
    • your drupal site url/domain
    • your node/content type identifier (shown in the url when adding that content type)
  3. add javascript code as the url field for a bookmark in your preferred browser

Detailed information and instructions can be found at: Mimicking the WordPress "Press This" Bookmarklet in Drupal 7 | Drupal Dork.  Kudos to my colleague, Brian Osborne for tweaking the code for Drupal 6! Below is the javascript code you can copy and tweak. Be sure to delete/strip out all linebreaks in the code before bookmarking.

Drupal 6 Press This like Bookmarklet Script

javascript:
%20var%20siteURL='www.yourdomain.com',
%20nodeType='node-type-when-adding-content',
%20d=document,
%20w=window,
%20e=w.getSelection,
%20k=d.getSelection,
%20x=d.selection,
%20s=(e?e():(k)?k():(x?x.createRange().text:0)),
%20l=d.location,
%20e=encodeURIComponent,
%20url='http://'+siteURL+'/node/add/'
+nodeType+'?edit[title]='+e(d.title);
%20if(s)
%20{
%20s='<blockquote>'+s+'</blockquote>';
%20s+='<p>from
%20<a%20href="'+l+'">'+d.title+'</a></p>';
%20url+='&edit[body_field][body]='+e(s);}
%20a=function(){
if(!w.open(url,'quickpost','toolbar=0,resizable=1,
scrollbars=1,status=1,width=1024,height=570'))
%20l.href=url;};
%20if%20(/Firefox/.test(navigator.userAgent))
%20setTimeout(a,%200);
%20else%20a();
void(0);

Drupal 7 Press This like Bookmarklet Script

javascript:
%20var%20siteURL='www.yourdomain.com',
%20nodeType='node-type-when-adding-content',
%20d=document,
%20w=window,
%20e=w.getSelection,
%20k=d.getSelection,
%20x=d.selection,
%20s=(e?e():(k)?k():(x?x.createRange().text:0)),
%20l=d.location,
%20e=encodeURIComponent,
%20url='http://'+siteURL+'/node/add/'
+nodeType+'?edit[title]='+e(d.title);
%20if(s)
%20{
%20s='<blockquote>'+s+'</blockquote>';
%20s+='\n\nfrom
%20<a%20href="'+l+'">'+d.title+'</a>';
%20url+='&edit[body][und][0][value]='+e(s);}
%20a=function(){
if(!w.open(url,'quickpost','toolbar=0,resizable=1,
scrollbars=1,status=1,width=1024,height=570'))
%20l.href=url;};
%20if%20(/Firefox/.test(navigator.userAgent))
%20setTimeout(a,%200);
%20else%20a();
void(0)