Joe Maller.com

Two little MonoBook styling hacks for MediaWiki

Recently, I’ve spent some time working with MediaWiki for Lila’s school’s web site. A small part of what I’ve been doing has been implementing an exisiting design onto the wiki backend. In an effort not to overcomplicate anything (think longevity) I built the entire design adaptation on the default MediaWiki MonoBook theme. Everyone who’s visited Wikipedia has seen what this looks like. Monobook is a very well constructed theme with clearly defined parts that degrade nicely without its stylesheets. So far, with the exception of these two small changes, I’ve able to do everything I needed to with the default page structure.

First change: Fixing bad portlet IDs

Editing Mediawiki:Sidebar allows for nearly complete customization of the sidebar links. Custom sections automatically get custom IDs which can then be styled. There is one thing that seems like a bug however: If a section heading has a space in it, the portlet ID will have an illegal name. Classes can have spaces in their selectors, but IDs can’t. Here’s what I did:

<div class='portlet' id='p-<?php echo htmlspecialchars($bar) ?>'>

and the new one:

<div class='portlet' id='p-<?php echo str_replace(' ', '_',htmlspecialchars($bar)) ?>'>

Simple enough, PHP’s str_replace is used to swap underscores for spaces. I’m still feeling my way around the MediaWiki codebase, so this might not be the best solution to the problem, but it does what it needs to with a very lightweight function.

Second change: Classes from page title

I needed to change the background of the globalWrapper element depending on the page, the way I accomplished this was to use the page-title. This has one initial drawback, namely that colons are not allowed in CSS class names. However the workaround above can be recast here with added benefit. Switching colons for spaces results in multiple class names, so namespaces can be styled too.

Here’s the old code:

<div id="globalWrapper">

And the new code:

<div id="globalWrapper" class="<?php echo str_replace(':', ' ', $this->data['titleprefixeddbkey'])?>">

This method would seem preferrable to adding a CSS import rule which would look for a custom-named file. Even though CSS load errors don’t break pages with visible 404 errors, they would slow down page loads and litter the server logs. Checking that the CSS file exists is somewhat costly, and I suspect MediaWiki’s cacheing isn’t something that can be quickly skimmed over and implemented.

There appears to be a pageCSS extension somewhere, the hooks are even specified in MonoBook’s header, but I couldn’t find a working download and CVS repository doesn’t seem to be working anymore.


Buy a Wii…

Buy a Wii and cute, giggling (French|Japanese|American) girls will flail around your generic apartment.

Nintendo’s Wii promotional site is brilliant. Cute giggling girls aside, these videos are really fun to watch. And effective as marketing too, because we’re immediately curious about what unseen thing these people are looking and smiling at.

Nintendo isn’t just marketing to non-gamers, they really did build this “with everyone in mind. My favorite videos were the kids in this family and this older couple, who go from stoic to ecstatic in about 5 milliseconds. Looks like fun, though I’d much rather being playing catch outside.

What can Sony and Microsoft possibly have to counter this? (Some aliens in a generic dark and smokey sci-fi world with big explosions and inexplicably ubiquitous crates everywhere?)

Another good thing about the Wii controllers is that they will force players to get up off the sofa or at very least hold their arms up. That means there will be fatigue and that mean it will be very difficult for kids to get as sucked in as the typical twitching thumbs console game. Which got me thinking:

In the near future, there will be a YouTube video showing how to play Wii without leaving the sofa. Players will demonstrate ways of using the controller with as little physical movement as possible.

Mark. My. Words.

Update Through a random stroke of luck I was able to play a pre-release Wii yesterday. Well, mostly Lila played but I got to work the menus. The Wii really is that good, this thing is going to own Christmas.


More on my next espresso machine

(continued from this previous post)

After more research, I’m switching my preference from the the Gaggia Classic to the Rancilio Silvia.

Finding Sweet Maria’s Rancilio Silvia page did a lot to sway me. They’ve got some very good close up pictures showing the parts, and as of July 2005, they have stopped selling the Gaggia Classic.

“We don’t stock the Classic model anymore, because I feel that the Rancilio Silvia is a better machine in the same price class. I am leaving the description for posterity sake.”

Even more exciting is the discovery that there is a Rancilio Sylvia modding community.

A modding community for an espresso machine.

That takes a minute to sink in. But there are people hot-rodding these machines all over the place: Precision digital thermostats. More digital thermostats, Add-on spare parts. Faster warmup tutorials. Collected tips and mods. Extreme mods from Taiwan.

And then there’s Randy Glass’ opus, Espresso! My Espresso!

The decision is mostly settled in my mind, but I’m going to give it a few more days before buying. I’d wait longer, but I’d like to be familiar with the machine before relatives arrive for Thanksgiving later this month.

Update: I bought the Sylvia, it should be here sometime Thursday.

Two-months later: Two months of great coffee



JavaScript

Projects

iPhoto

Twitter

Categories

Archives:

Geekery etc.

digits.com counter