In the brief pause between projects (Flight of the Scions and Author Intrusion), I decided to work on a few side projects and to do items that have been haunting me for a while. I figured a month of that would get rid of a lot of them and also give me the high for finishing things.

This week, I was working on the Javascript theme engine. This is a relatively simple idea, create a client-side theme for websites. I'm using jQuery for this version, mainly because it was a lot easier to work with then Prototype.

I think the advantages are pretty clear. The web pages are fairly simple, because I don't even include the

tags needed to hang the CSS rules on. I can put navigation on the bottom so the Google search results look better; jQuery lets me relocate things wherever I want.

And, probably the main reason for me, I can use the same theme across multiple web applications. This is important to me because I want my WordPress blog to look and feel identical to the DokuWiki site at the root. Same with the MfGames site for the Simple Machines Forum and that wiki.

Unthemed Example

The basic page is above. This is used for all the themes. If you look at the source, you'll see that it has no formatting rules or div tags. It has a line for jQuery, a local theme setting, and then the loader. I also have a customization for navigation.

The loading is relatively simple, the library doesn't have a lot of complexity right now. Well, the theme is getting there, but mainly it is the setup that is short and sweet. I'm going to eventually allow customizations and theme changing but that is a later feature. I want to get the pattern of the code down, but that requires using it more.

Summer Day Theme Example

This is the first, non-trivial theme. For those who know the Moonfire Games website, it is a port of that theme which a few alterations. Since I have more flexibility of movings things around, I added a fixed navigation and also an application-specific bar.

The major drawback of this approach is people who use NoScript or turn off Javascript. Since most people have Javascript, I don't think it will be too bad, but I'm going to still put in a little block to tell them. Also, I'm thinking about hosting it on a dedicated site (say theme.mfgames.com) to make it easier for NoScript folks.

I think it is turning out pretty well, but as usually, I'd look opinions and feedback.

2011-07-30