Autofill Acronyms in Comments

I created (or rather modified) some code to allow for quicktags, so commenters can have bold, italic and code text, amongst other features. I also added in abbr and acronym tags, just for fun. Today, I made this even more kick-ass. If you select some text, and click on abbr or acronym, and there is a valid acronym in the list in the script, it autofills the definition in the dialog for you. I got rather excited after doing this. But, I’m a nerd. • Note: The seperate Quicktags toolbar is not supported. Please use the full toolbox script, or hack it any way you like. The remainder of this post remains for posterity only. • Anyway, you can get the button version here, and the CSS link version here. Remember to Right-click and download, rather than just clicking on them.

Comment Preview Fix

One thing is missing from my Comment Preview script: when you click on the link button you get a window to enter the link URI, I need to implement the equivalent for the acronym/abbr. Actually, I can probably autofill most of the acronyms. That would be cool. And maybe get the code added back into the one that is used for the WordPress Dash.

Automation of XHTML Cleanup

I use SubEthaEdit all of the time, and the feature I like just about most is the Copy As XHTML ⇧⌘C. This will create some nice marked up text that accurately represents what SubEthaEdit looks like - it takes your current syntax styling layout and creates is as XHTML. There are a couple of issues, at least with Blogsome. Firstly, for some reason Blogsome needs all style tags inside the block to use ‘, not “. I think it might be to do with the fact it is a <pre> block. I did notice it was screwing with some double-quotes on another script I was posting. My other hassle is that the syntax highlighting isn’t quite right for AppleScript: it doesn’t take into account terms used from applications, so sometimes the wrong colour appear. I will write an Automator action that grabs the XHTML from SubEthaEdit, replaces “ with ‘, and pastes it into the current active text box, I think. I also started using Convert Script To Markup Code - don’t recall where I found this, but it does a much better job of marking up the text from Script Editor, and everything looks much nicer.

Gravatars not loading

I’ve noticed some commenters Gravatars are not loading, including mine. Some of them are, but I don’t know why. I haven’t been able to log into to see what’s going on. Oh, and Jake, I think there’s a problem with document.commentform on your site, and I cannot submit a comment.

GPGMail causes to Crash

Not that I get a lot of PGP encrypted email, but I had GPGMail installed, and I upgraded to Tiger (I missed the chance to do an Archive & Install, apparently - they hid that a bit too well). Mail complained on startup that GPGMail wouldn’t run, but apparently it still was trying to render the emails through it, as every email I tried to view caused to crash. A cursory inspection of the Crash Report told me this was the cause. Disabling it fixed it alright.

DVDs not mounting properly

I have a couple of DVDs a friend gave me, and I have noticed some interesting things occurring with them. Firstly, I thought the DVD he gave me was bad, as it would not mount in my iMac G4. It’s an HFS or HFS+ disc, so will not mount in a PC either. I then asked him for another copy, which he gave to me. It won’t mount either. Thinking something weird was going on, I tried it in an iMac G5, with a DVD-ROM/CD-RW drive. Mounted first time. I then tried it in another iMac G5, this time with a DVD-RW (specifically, a Pioneer DVR-K04F) drive, and it wouldn’t mount. So, it seems like this DVD will mount in DVD-ROM drives, but not DVD-RW drives. And I cannot make another copy, as the only drives it will mount in are not Recordable drives! Every other disc I have tried in my iMac has worked. I am stumped.

iPod update

I haven’t updated the iPod in a while, and I noticed after doing it tonight that it gives it a nice new icon, and when restarting the iPod it gives a progress bar, just like booting up a Mac.

Simple Catchpa

Note: This has been updated to reflect most of the feedback I received from the comments and emails. One of the ways to combat comment spam is to use a Catchpa: or a Completely Automated Turing Test to Tell Humans and Computers Apart. I have implemented one with a simple bit of JavaScript. You need to have two sections of code in your comments.html:

 1    function checkCatchpa()
 2    {
 3        var catchpaResponse = document.getElementById("catchpa").value;
 4            if( catchpaResponse == theAnswer )
 5            {
 6                return true;
 7            }
 8        return false;
 9    }
11    function SubmitComment()
12    {
13        if (checkCatchpa() == true)
14        {
15            document.commentform.submit();
16        }
17    }

This one needs to be inside a <script> block: I have it where I also use a couple of functions to show a comment preview. You will also need to surround the script block with {literal} tags to prevent it from screwing up your template. The next one creates the puzzle. It should go after the URI box in your comment form:

 1    <p>
 2        <input type="text" name="catchpa" id="catchpa" value="" size="28" tabindex="4" />
 3        <label for="catchpa">{_e text="<acronym title='Completely Automated Turing Test to Tell Humans and Computers Apart'>Catchpa</acronym>: "}</label> 
 4        <script type="text/javascript">
 5            var firstNumber = Math.ceil(Math.random()*10); 
 6            var secondNumber = Math.ceil(Math.random()*10); 
 7            document.write("What is "+firstNumber+" plus "+secondNumber+"?");
 8            var theAnswer = firstNumber + secondNumber;
 9        </script>
10    </p>

You will also then need to tell the form itself to call the checkCatchpa() function, rather than just submitting:

1         <form action="{$siteurl}/wp-comments-post.php" method="post" id="commentform" name="commentform" onSubmit="return checkCatchpa()">

Depending on your setup, you may also need to use the SubmitComment() call on your link or button that actually submits the form.

1    <a class='button' href='javascript:SubmitComment();'> Post Reply </a>

I’ve tested this and it works: I’ll leave it on my site for a couple of days so you can test it out: if you have any problems, leave a response here (if you can!), or AIM/email me.

Boing Boing: Interesting words from around the world

Boing Boing: Interesting words from around the world My favourite: bakku-shan: a girl who appears pretty from behind but not the front. Japanese.

WordPress PHP files

Since someone on the forums mentioned that you can change some hardcore options with /wp-admin/options.php, I got a little interested, and discovered there are other filest that you can run, and do interesting stuff with. All of these PHP files are located in /wp-admin/install-xxx.php, where xxx can be: b2, blogger, greymatter, livejournal, mt, rss, textpattern. These will allow you to import the contents of your blog directly into blogsome, I assume. I haven’t done this, so cannot tell if they will work - I imported mine via ecto, an offline reader. Actually, it looks like the b2, blogger, greymatter ones might work - the others require you to edit the files that you open. And I cannot seem to identify these files in the editing screen, so I’m stuck. /wp-admin/plugin-editor.php This would be cool, except you cannot actually change any files. Oh well, at least you can examine a plugin and see how it works… Also interesting are the Smarty Template files. I may learn something here about what extra things I can do from Smarty in Blogsome. custom_fields.enclosure.php & custom_fields.photoblog.php I already use enclosure, but I didn’t know about photoblog. Have to investigate that one. function.blogroll.php, function.cork.php, function.eightball.php, function.googleit.php, function.photoblog.php, function.pirate.php & function.relatedstories.php {blogroll} allows you to use to track your blogroll. I’m pretty happy with RSS at home, so I’ll leave it there. {cork} - don’t know what this does yet. {eightball} looks like it wants to be a magic eightball simulator, but only ever seems to give me the one result: Maybe in your reality. {googleit}, {photoblog} & {pirate} will require further study. {relatedstories} looks interesting, but I cannot get any result as yet: this I may work on. I think it’s pretty much like {todayayearago}. outputfilter.protect_email.php {'string'|protect_email} does not work: it causes the pages not to load.