Using jQuery to further hack Movable Type styles
I admit that this approach to modifying the default template set from Movable Type is kinda ghetto. However, it could be worse, and it does at least get the job done:
Alright, so what I did was I stripped the widget header from the search box and moved the search box widget up to just after the description header field with jQuery, then set the text alignment to be right aligned. I did this because this is how a lot of WordPress themes do the search field. Yay, jQuery!
The second half of the code creates a block of tabs and puts them below the header/before #content. These tabs are just the jQuery UI tabs, not the style of tabs that WordPress uses, which is why I wouldn't use this method of displaying tabs while converting a style over from WordPress, but I think it shows the promise of this general approach nonetheless.
To see what this looks like in this raw form, check out this demo blog I created.
<script type="text/javascript">
$(window).load(function() {
$(".widget-search").find(".widget-header").each(function(i) { $(this).remove(); });
$(".widget-search").css("textAlign", "right").insertAfter($("#header-description"));
$("<div id=\"tabsEx1\"><ul style=\"height: 30px;\"><li><a href=\"#fragment-1\"><span>One</span></a></li><li><a href=\"#fragment-2\"><span>Two</span></a></li><li><a href=\"#fragment-3\"><span>Three</span></a></li> </ul><div id=\"fragment-1\"> <p>First tab is active by default</p> </div> <div id=\"fragment-2\"> <p><b>Second tab is active</b></p><br> <p>Alternative ways to specify the active tab will overrule this argument, listed in the order of their precedence:</p><br> <ol> <li>If a fragment identifier (hash) in the URL of the page refers to the id of a tab panel of a tab interface the corresponding tab will become the initial tab.</li><li>Same if you use the cookie option to save the latest selected tab in.</li> <li>Last not least you can set the selected tab by attaching the selected tab class class (default: \"ui-tabs-selected\") to one of the <code>li</code> elements representing a single tab.</li> </ol> </div> <div id=\"fragment-3\"> Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. </div> </div>").insertBefore($("#content"));
$("#tabsEx1 > ul").tabs();
});
</script>
Alright, so what I did was I stripped the widget header from the search box and moved the search box widget up to just after the description header field with jQuery, then set the text alignment to be right aligned. I did this because this is how a lot of WordPress themes do the search field. Yay, jQuery!
The second half of the code creates a block of tabs and puts them below the header/before #content. These tabs are just the jQuery UI tabs, not the style of tabs that WordPress uses, which is why I wouldn't use this method of displaying tabs while converting a style over from WordPress, but I think it shows the promise of this general approach nonetheless.
To see what this looks like in this raw form, check out this demo blog I created.
**UPDATE**: I got a little time tonight to go a step beyond what I did earlier today, and so I took the toolbar from this WordPress theme and brought it into that page. It's about 99% there, I think.
For those that don't have any experience with jQuery, each jQuery method call in there returns a jQuery object that the next method operates on. Line one, for example, would be read as a plain English algorithm like this:
$( ) is the standard jQuery wrapper that goes around a CSS statement.
- Get items of object class widget-search
- On the result, find objects of class widget-header
- For each widget-header, remove the header from the parent DOM node
$( ) is the standard jQuery wrapper that goes around a CSS statement.

