Javascript for command-line posting
Apr. 10th, 2009 12:52 pm![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
I just arrived at Dreamwidth yesterday and have, so far, been rather impressed. One of the features I missed, however, was the bookmarklet javascript for auto-posting. I've gerry-rigged the LJ javascript function to perform the same function for dreamwidth:
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',u+'js/bookmarklet.js');document.getElementsByTagName('head').item(0).appendChild(e)})())
Create a bookmark in your browser and in the URL field cut-and-paste the above script. One of the biggest changes that is needed is to replace the http://www.livejournal.com/js/bookmarklet.js javascript code residing either locally or on a DW server rather than on the LJ server. I'll continue to play with this to see what I come up with.
If anyone makes any improvements to this script, please let me know and I'll update this post with appropriate cudos.
Edit: Found a bug with the method; it only works if you have run the script to post to LJ at least once in this session. Not a big problem at the moment because I'm posting to both so I just post to LJ first, then to DW, but this is certainly not a long-term solution.
Edit 2: Now testing some locally-running javascript to attempt to perform the same function but so far no-go.
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',u+'js/bookmarklet.js');document.getElementsByTagName('head').item(0).appendChild(e)})())
Create a bookmark in your browser and in the URL field cut-and-paste the above script. One of the biggest changes that is needed is to replace the http://www.livejournal.com/js/bookmarklet.js javascript code residing either locally or on a DW server rather than on the LJ server. I'll continue to play with this to see what I come up with.
If anyone makes any improvements to this script, please let me know and I'll update this post with appropriate cudos.
Edit: Found a bug with the method; it only works if you have run the script to post to LJ at least once in this session. Not a big problem at the moment because I'm posting to both so I just post to LJ first, then to DW, but this is certainly not a long-term solution.
Edit 2: Now testing some locally-running javascript to attempt to perform the same function but so far no-go.
(no subject)
Date: 2009-04-11 03:05 am (UTC)(no subject)
Date: 2009-04-11 03:49 am (UTC)I'll test it out for a few days to see if there are any hidden glitches in the method and if it seems to work consistently then I'll cross-post it. In the meantime, if you could let me know how well this script works for you and of any problems you might have run into, it would be greatly appreciated.