--- layout: post title: Blog This – bookmarklet for Drupal 6 author: Steven date: 2010-03-12 07:26:05 categories: - Musings tags: - drupal featured_image: https://www.stevenjaycohen.com/wp-content/uploads/2016/07/wsi-imageoptim-drupal.png --- Often, while reading a web page, I will find something worth mentioning here on my site. The code below builds a Bookmarklet that makes a new blog entry with a prepopulated title and whatever text I have highlighted in the browser quoted in its body. This code also depends upon the Drupal Prepopulate module to get the job done. This version launches in a blank tab or page: [codesyntax lang="javascript"] javascript:u=document.location.href;t=document.title;s= ' '+window.getSelection()+' '; pre='From%20'+escape(t)%20+%20escape(': %20');void(window.open(' http://www.stevenjaycohen.com/node/add/blog? edit[title]='+escape('Link: '+t)+' &edit[body_field][body]='+pre+escape(s) +escape('Link'))); This version launches in a sized popup window: javascript:u=document.location.href;t=document.title; s=' '+window.getSelection()+' '; pre='From%20'+escape(t)%20+%20escape (': %20');void(window.open ('http://www.stevenjaycohen.com/node/add/blog? edit[title]='+escape('Link: '+t)+'&edit[body_field] [body]='+pre+escape(s)+escape(' Link'), '_blank','width=710,height=500,status=yes, resizable=yes,scrollbars=yes')); [/codesyntax]