Daily Archives: Saturday, 22nd March 2008
Spring Has (Not) Sprung
As the forecast was for snow, sleet, earthquakes, volcanoes and rains of small fish[1], I decided to get an early start and do my shopping before it got nasty. There was a bit of a lazy wind[2] blowing, which wasn’t nice, but there was a distinct lack of stuff falling from the sky. Anyway, shopping done, I was back home well before 11am, which is pretty good for me on a Saturday[3]. About ten minutes later, the hail started, so I got that about right…
And it’s been on and off nasty stuff all afternoon. Snow, featuring lots of big flakes, but no inclination to stick on the ground, and something more like nasty sleet. And now it’s cleared up again. I was hoping for a proper snowfall, so I’d have something to motivate me to go out with the camera, but that seems to have been cancelled. Mutter.
[1] Or something like that. I might be remembering it wrong.
It certainly sounded dramatic, anyway.
[2] The kind that can’t be bothered going around you, so goes straight through instead
[3] It’s not unusual for me to be still trying to persuade myself that getting dressed and going out is a good idea
Weight Report – 22 March 2008
Hmmm. Up a wee bit today, but that would seem to be well within normal daily fluctuation range, so I’ll let it go for now.
WordPress Bookmarklet on Safari 3.1
Wow. Err, Cool. I’m impressed with myself.
OK, let’s backtrack a bit…
When I’m using Firefox, if I see something on a webpage that I want to blog about, I generally use the ScribeFire extension. This pops up a box in the lower half of the window, with a link to the page in question already filled in. I have it configured to save what I post as a draft, so I can tidy it up in WordPress before publishing it.
But that’s not going to work on Safari. But never mind, WordPress 2.3.3 provides a little Bookmarklet – basically a link containing some JavaScript that you can drag to your Bookmark bar. Highlight some text on a page, click the link and you’ll be taken to your WordPress Write page. The page title will be filled in as the post title and the link and any highlighted text will be already in the text box, ready for you to finish the post and publish it.
The only trouble is that the code doesn’t do what I really want – on Safari, it opens the Write page in the current tab – the one with the document I want to write about, which rather defeats the object of the exercise, as I would generally want to refer back to the original page while I’m working on the post.
So I did some googling and reading, and found a suggestion that looked like it might work. What I needed to do was use a different JavaScript command. Instead of
location.href=http://whatever
I should use
window.open('http://whatever...')
Well, I gave it a try, and after a few false starts and typos, I had a new bookmarklet which actually works.
This is the code, should you want to make your own:
javascript:if(navigator.userAgent.indexOf('Safari')%20%3E=%200) {Q=getSelection();}else{Q=document.selection? document.selection.createRange().text:document.getSelection();} window.open('http://www.example.com/wordpress/wp-admin/post-new.php? text='+encodeURIComponent(Q)+'&popupurl='+encodeURIComponent(location.href)¬+'&popuptitle='+encodeURIComponent(document.title));
The whole thing needs to be on one line. You’d need to put your own site address in there in place of “example.com”, of course, and if your blog isn’t in /wordpress, edit that bit, too. Then all you have to do is make that the target of a new bookmark – you might find it easier to drag the WordPress Bookmarklet from the bottom of the Write page to your bookmark bar, then edit it to match.
This has only been tested on Safari 3.1 on Mac OS X 10.5.2. No guarantees are offered, and if it doesn’t work for you, I probably won’t have a clue why. But for me, it opens a new tab, ready for me to post into, and I’m quite happy with that.



