dracodraconis: (Default)
dracodraconis ([personal profile] dracodraconis) wrote in [site community profile] dw_nifty2009-04-30 08:06 am

DW/LJ submitlet bookmark function

When LiveJournal introduced it's javascript-based submitlet function, it made my life easier, being a person who mostly posts current articles in news, science, and technology with a summary and the ocassional snarky comment if warranted. For those who may not know of what I speak, the submitlet script allows you to, when on a page the link for which you want to submit as a new post to LJ, automatically copy the page information and link as a new LJ post in a new window. When I came to DreamWidth I missed having this function so set about remedying the solution.

What I came up with still uses javascript from the LiveJournal site, but creates a new DreamWidth post. Create a new bookmark and use some appropriate descriptor (I use "Submit to Dreamwidth"). In the Location box, cut-and-paste the following:

javascript:void((function(){var%20u='http://www.dreamwidth.org/',w=window.open(
'','','toolbar=0,resizable=1,scrollbars=1,status=1,width=1000,height=500');if(window.LJ_bookmarklet){return%20LJ_bookmarklet(w,u)};var%20e=document.createElement('script');e.setAttribute('type','text/javascript');e.onload=function(){LJ_bookmarklet(w,u)};e.setAttribute('src','http://www.livejournal.com/js/bookmarklet.js');document.getElementsByTagName('head').item(0).appendChild(e)})())

As you can see, the script still calls LJ's bookmarklet.js function, but gets the job done. Ideally, I would like to have everything run either entirely locally or on a DW server, but this gets the job done in the meantime.
dreamweaver: A white mug of coffee sitting on a wooden table beside a computer (Best Part of the day: Computer and coffe)

[personal profile] dreamweaver 2009-05-04 12:30 am (UTC)(link)
Errrr maybe this is really dumb, and this is cool, but I'm missing something. When I copy the code, where do I paste it?