JavaScript in Posts

Clearly, this is the first time I’ve tried to do this. No, that’s not quote true. I’ve been working on a post that does it, I just haven’t published it yet. I’ve discovered that JavaScript is really neat for doing lots of cool stuff. However, WordPress has a couple of issues with it. It’s okay to use JavaScript in template files, or include external JavaScripts, and even to use JavaScript in Pages, but if you try to use it in Posts, it fails. It converts “ into ", and ‘ into '. Or more strictly, into the #8220;-ish version. Which isn’t much good, as then any JavaScript which uses quotes, to define a string, for instance, will not work. You could define a function elsewhere, and then just call it, that should work. But not do anything that requires quotes. There seem to be a couple of WordPress workarounds, but not in WordPress-MU. Or Blogsome, that means. I may have a look at the source, to see if I can figure out a way to make it work nicer. Oh, and that reminds me. I need a decent text editor for Windows. Notepad just ain’t cutting it anymore. Especially if I try to open a Unix file.

What the... ?

Tried to shut down the other night, got this interesting dialog: At least I knew what button to click on!

PostSecret Again

These three caught my fancy. Not that I fancy any student’s parents. Or could keep a student back. Or find teens sexy. Or play cello. But funny nonetheless.

Floor Finished!

Simon breated me for not posting any house pictures lately, so here you go. We finished replacing all of the floorboards yesterday. Looks pretty good too. There were a couple of issues where the edging was - particularly the part where the lounge meets the dining room (but we’ll be using it as a study).

Preventing Trackback Spam

Now I’ve (virtually) solved my Comment Spam issue, I’ll look into trackback Spam. Note to self: look at Trackback Validator Plugin over on Trackback Spam Resources. That whole site looks pretty good, too.

Comment Moderation

I need to see why Blogsome isn’t notifying readers when their comments are moderated. Apparently (according to the Codex) this is just a line or two of code. It would be nice to make a system wide change, but I’ll start with just a notification in my blog template.

Catchpa Working?

I think my simple catchpa is working quite well. I’ve only had one comment through that was Spam, and that was actually a trackback, not a comment. Ditto for comments in moderation. However, I haven’t had too many ‘real’ comments in the last few days, either. I hope there aren’t people who are trying to comment but cannot. I don’t think so, since I seem to be able to comment fine, from IE and Firefox. Love to hear from anyone using this method.

When Classic Applications Don't Run

ManOpen is a great idea. Why be limited to viewing man pages in the Terminal _you are working in, when you can offload it to another window, another application even. Even before this came along, I investigated other solutions, like using groff to generate a PDF, and viewing that (too slow), and starting a new Terminal window and viewing the man page in that. Generally, this would involve a Cmd-N, then man _whatever_. Then I found ManOpen. I blogged about how I had some issues with ManOpen under Tiger, but an update fixed this. What the update didn’t fix, in fact, what it screwed up were some Classic Applications. See, in OS X, Apple decided to use extensions rather than meta-data as the main way of telling if a file is an application or porn. Or any other type of file, for that matter. Which is all well and good if the application has a name that actually ends in .app. But what about older OS9 applications, like Photoshop 5.5. I know, I know, upgrade to CS. Well, we run that too, but PS5.5 runs under Classic, and we kind of need to run under Classic to get decent print quality. Or decent PDF quality and small sizes. So, _Adobeâ„¢ Photoshopâ„¢ 5.5, which ends with a .5 used to work. Before ManOpen decided to ‘0wn’ all of the files that end in .5, or .n (where n is any single digit, excluding 0). Which meant that trying to run this program caused ManOpen to, well, open. I didn’t twig this until I had tried as hard as I could to get PS5.5 to actually run itself. File Buddy was showing it as a Classic Application, but the Finder just wouldn’t. The bizarre thing is that I only have ManOpen installed under one user’s ~/Applications, so in theory it shouldn’t affect other users. But for some reason, it changed the owner of all files ending in .5, and Script Editor decided it should try to open it. So, if Google sent you here, the solution is: add .app to the file name. It’s as simple as that…

WYSIWYG comments.

Editing comments in IE is annoying - until just now I had a width:100%; clause in my StyleSheet, and this somehow caused IE to resize the box every time a character is typed. Now, you lose access to the scrollbar, but it doesn’t do the jumping thing. It actually got me thinking about how to implement WYSIWYG commenting. Instead of typing into a TextArea form, you type into a div. This div doesn’t allow for HTML to be actually typed in, but does have the quicktags. Any HTML code is actually converted to how it would display. Pressing any of the quicktags formats the text automatically. The raw text (actually, the raw HTML) is also stored in a hidden textarea, and this is what is sent to the server. This kills a few birds with one stone:

  • Only allows HTML that is ‘approved’ to be typed in.
  • Fixes any problems with Safari and inability to find cursor position in textarea (which has been fixed in recent builds of the WebKit, btw).
  • Removes the need for a Comment Preview box.

Potential problems that may appear (this may be extended):

  • Clicking a buttons removes the selection from the div - no idea where to insert the formatting tags,
  • Doesn’t seem to be a way to make just any part of the page editable.

globalvar

Looking through the Blogsome/WPµ source, I came across a Smarty function {globalvar}. “Righto,” I thought, “I’ll google that, and see what comes up.” My template file was the first thing that did. Okay, what this function does is take a Smarty variable, and make it global in the PHP scope. Used in my template, and most Blogsome ones, it sets the variable $comment to be a global one. I haven’t come up with another good use for it, but it’s nice to know.