jQuery: Not as hard as it sounds

For the new blogs page I wanted to put together an accordion-like fea­ture for view­ing the posts to make it feel some­what like a feed reader. I looked at dif­fer­ent javascript libraries for this and chose to go with jQuery, not that oth­ers wouldn’t work, but because I had some lim­ited expe­ri­ence with it.

I started toy­ing around with the slideTog­gle() func­tion, but after a cou­ple hours I had to look around the inter­net for some help. I couldn’t have done it with­out Steve Krueger’s tuto­r­ial. Although I didn’t fol­low it exactly, it helped be over a few hurtles.

Here is the code I ended up with.

jQuery(document).ready(function($){
	$('.story').hide();
	$('.title').click(function(){
	if($(this).is('.active')) {
		$(this).toggleClass('active');
  		$(this).next('.story').slideToggle('fast');
  		return false;
  	} else {
  		$('.story:visible').slideUp('fast');
		$('.title.active').removeClass('active');
		$(this).toggleClass('active');
  		$(this).next('.story').slideToggle();
  		return false;
		}
	});
});

Also, as I was delv­ing deeper into this project, I spent a lot of time around the Word­Press Codex. I found this great func­tion called wp_enqueue_script for load­ing javascript libraries. This is for use in Word­Press plu­g­ins and themes so there is no con­flicts or super­flu­ous code. Pretty neat.

Update — June 29
I edited the page so when open­ing an item it will scroll to the top of your win­dow. So much bet­ter. Some help from Learn­ing jQuery and Marc Gra­ban­ski. I am using the jQuery.ScrollTo plugin.

Here is the updated code:

jQuery(document).ready(function($){
	var scrollTop = jQuery(window).scrollTop();
	$('#content > div.story').hide();
	$('#content > h2.title').click(function() {
		$('#content > h2.title').removeClass('active');
		$(this).addClass('active');
		var $nextDiv = $(this).next();
		var $visibleSiblings = $nextDiv.siblings('div.story:visible');
		if ($visibleSiblings.length ) {
			$visibleSiblings.slideUp('fast', function() {
				$nextDiv.slideToggle('fast');
				jQuery('#content > h2').each(function(i, h2){
				h2top = jQuery(h2).offset().top;
				if (scrollTop  h2').each(function(i, h2){
				h2top = jQuery(h2).offset().top;
				if (scrollTop < h2top) {
					jQuery.scrollTo('.active', 300 );
					return false;
				}
			});
		}
	});
});

Word of the Day: Merde

As in, “Don’t be ner­vous! You’ll do great! Merde!”

I was just informed by a friend who works for a bal­let, that it is cus­tom­ary to say “Merde!” to bal­let dancers before they go on in lieu of “Good Luck!” or “Break a leg!”

(imag­ine your­self back­stage…)
“Hey, merde.“
”…thanks”

An ongoing investigation: Browsing the www

I’ve had a very ter­ri­ble cou­ple of years com­ing up on the Inter­net. When it began, it was easy. I had my gate­way lap­top, I used IE until 2004 when I heard about Fire­fox. It was a sim­ple choice. Fire­fox had tabs, it was faster, it had the lus­ter of being open source. (In fact, it inspired my fanati­cism for all things open source). But in 2005 I got a tiny power­book and Safari was so cute and new. I was dis­ap­pointed with Fire­fox on my power­book. The wid­gets were ugly and pix­e­lated, noth­ing like aqua at all. At this point I was ded­i­cated to Safari, only using Fire­fox for sites that rejected Safari for what­ever reason.

But I wasn’t sat­is­fied. I started flirt­ing with other web browsers: Shi­ira, Opera, Omni­Web, Camino, Opti­mized Fire­fox builds… It was a con­fus­ing time. I exper­i­mented heav­ily. Even­tu­ally I began to fall in love with Camino. It had the ten­der­ness of real mac app, but also the cer­tain flare of being open source and dan­ger­ous like Firefox.

When I upgraded to Leop­ard, it was back to square one. I went with Safari for a while because Camino was strug­gling with 10.5. Then Fire­fox 3 came around with its hype and fancy Smart Loca­tion Bar. I fell back into my old ways. I was using a PC at work, Fire­fox felt right, cut­ting edge, cus­tomiz­able, fun.

Since then I’ve not set­tled. I can’t decide. I’m switch­ing weekly. Nobody has exactly every­thing I want. Here is where I stand now:

Safari 3

  • I love to use cmd-1, cmd-2, etc for links on the book­marks bar
  • You can­not set Google Reader as your default feed reader
  • In gen­eral, works fine, but
  • is bor­ing

Safari 4 beta

  • “Smart Address Field”, sim­i­lar to Firefox’s Smart Loca­tion Bar
  • Top tabs, makes sense.
  • Devel­oper Tools are very cool
  • Top Sites? Yuck!
  • Chokes here and there
    • Espe­cially in Word­press
    • And with the Tum­blr book­marklet: when I use a key­board short­cut to open, in my case cmd-1 because it is first on my book­marks bar, it opens into a new tab instead of a new win­dow. Very frustrating.

Camino

  • Uses cmd-1, etc for book­marks bar
  • Uses Key­chain to save passwords
  • Feels very at home in OS X
  • But but­tons suck in Leopard
  • Some sites still reject Camino

Camino 2 beta

  • But­tons fixed for Leopard
  • Del key no longer works for going back a page
  • Finally has drag­gable tabs
  • No smart loca­tion bar, which I’ve become very com­fort­able using

Fire­fox 3

  • No key­board shorcuts for the book­marks bar :-(
  • Doesn’t use Key­chain to save pass­words, which is very annoying
  • One mil­lion awe­some extensions

So I have no idea what to do. I was using Fire­fox for the last month, but last week I went back to Safari. It is hard to choose. What are you feel­ings? Do you have such trou­ble deciding?

The $1000 Seastead Design Contest

Or open source design for inde­pen­dent microna­tions.

The idea is this: The Seast­eading Insti­tute, a non-profit orga­ni­za­tion con­ceived about a year ago by Patri Fried­man and Wayne Gram­lich, is propos­ing a frame­work that would make it pos­si­ble to per­ma­nently set­tle on the ocean. Their vision, inspired by the cul­ture of web 2.0, is to crowd-source the devel­op­ment of government.

seastead1seast­eading

What they have done is designed a bare plat­form, called a seast­ead, that is about the size of a city block. They are encour­ag­ing every­one to share their idea for a per­ma­nent civ­i­liza­tion on the ocean through The $1000 Seast­ead Design Con­test (sub­mis­sions due May 1st, 2009). Con­tes­tants are to expound upon the plat­form in any way they see fit – “It may be a hos­pi­tal, a casino, a res­i­den­tial com­mu­nity, a cricket sta­dium, or some­thing entirely dif­fer­ent.” The idea is to share and to col­lec­tively reach this goal. Designs for the seast­eads will be released under a Cre­ative Com­mons license.

seastead2Wendy Sitler-Roddier

[They are] hop­ing to cre­ate a plat­form in the sense that Linux is a plat­form: a base upon which peo­ple can build their own inno­v­a­tive forms of gov­er­nance. The ulti­mate goal is to cre­ate stan­dards and blue­prints that can be eas­ily adapted, allow­ing small com­mu­ni­ties to rapidly incu­bate and test new mod­els of self-rule with the same ease that a pro­gram­mer in his garage can whip up a Face­book app.
WIRED and BLDGBLOG

As com­pared to other projects of this nature, The Seast­eading Insti­tute is try­ing to build a mod­u­lar frame­work which allows for many dif­fer­ent ideals. Because they don’t focus on one spe­cific model that could fail, the project is much more sus­tain­able. Although I do not par­tic­u­larly sub­scribe to Lib­er­tar­i­an­ism, I have inter­est in projects like this for their for­ward think­ing ideas. The Seast­eading Insti­tute is not respond­ing as much to cli­mate change, but to soci­etal change. Maybe there is some­thing we can learn from their model.

Waterpod Project – A Floating World

waterpod_newstuff_v0003
Water­pod Project (ren­der­ings by James Halver­son of Lux Visual Effects)

A recur­ring theme for the future seems to be alter­na­tive hous­ing. The Water­pod Project intends to be a model for the future of archi­tec­ture and liv­ing. It is con­cerned with the same basic prob­lems as other projects, cli­mate change and increas­ing world pop­u­la­tion, but takes a dif­fer­ent approach. Where Polar Cities and Lily­pad are pri­mar­ily con­cerned with phys­i­cal sur­vival, Water­pod is inter­ested in cre­ativ­ity and expression.

The Water­pod is inspir­ing because it has moved past the hypo­thet­i­cal, it is cur­rently being con­structed in New York. Being a model for future build­ing, sus­tain­abil­ity is the key. The Water­pod is being built on a retired indus­trial barge using sal­vaged mate­ri­als. It fea­tures three domes to be used for artis­tic space, sleep­ing quar­ters, and agriculture.

It is cur­rently sched­uled to launch in New York in May, 2009, from the New­town Creek between Brook­lyn and Queens, nav­i­gate down the East River, explore the waters of New York Har­bor, and stop­ping at each of the five bor­oughs it will dock at sev­eral Man­hat­tan piers on the Hud­son River, then beyond.
Water­pod Structure

rowhouse_v0002_lo
Water­pod artist res­i­dency building

To begin with there will be five res­i­dents who will live and work and be com­pletely sus­tained on the barge. They plan to travel around to teach, give tours, and have exhi­bi­tions. They hope to be a model and inspi­ra­tion for the future, to pre­pare and to encour­age innovation.

This forces me to focus on cer­tain things that I have been putting off for too long, and forces me to live like we will prob­a­bly all need to live sooner or later.
Mary Mat­tingly

Software that I paid money for

In response to all this hub­bub about YACHT being a pirate, I’ve been think­ing about what soft­ware I’ve pur­chased. So here, more or less, com­pre­hen­sive as hell, my list:

  • Every “major” prod­uct that Panic has made includ­ing Trans­mit, Coda, and Uni­son. I used Uni­son a lot ini­tially, but I can’t say I’ve opened it in a while.
  • BBE­dit, which I bought a long time ago and has since retired from my appli­ca­tions folder. I loved it.
  • Text­Mate, which came as a replace­ment for BBE­dit. Suck­ily, I found Text­Mate just before Coda came out. I still use it from time to time though.
  • Adobe CS2/Macromedia Stuff 8. (Before the merger, I haven’t delved into CS4 yet, but I’ve heard many bad things.)
  • QuarkX­Press 7, still my favorite page lay­out application.
  • Ecto, which I haven’t used in a long time, but it was the blog­ging tool for me.
  • I upgraded OmniOut­liner from 2 to 3, and I’ve almost pur­chased Omni­Web sev­eral times.
  • Remem­ber The Milk pro, for the Black­berry syncing. 
  • And of course Flickr.

(A lot of the other soft­ware I use is freeware… Also, I’ve been think­ing about pur­chas­ing FontExplorer.)

Use This: Vanilla

I fre­quent a hand­ful of forums, and most of my favorites use Vanilla. Vanilla is great because the first view you see is a list of all recent dis­cus­sions instead of cat­e­gories, which is nice because it is only one click to read a thread rather than two or more. Also, the objec­tive of Vanilla is to be a min­i­mal­ist forum, not many default fea­tures, very fast, very exten­si­ble. Because Vanilla is very basic by default, it is fun to cus­tomize. I use it for Nice.

cargo-talk

These screen­shots are of some really nicely designed forums that I like. They are used as sup­port and bug report­ing for dif­fer­ent ser­vices. Sim­i­larly, I use a Vanilla pow­ered forum to man­age free­lance work and other projects.

indxr-forum

Any­how, use Vanilla, it is cool. Use it.

More positive

I just found out Sunday
I was lis­ten­ing to an inter­view with Sally Car­son (Fix­pert) on Bike Talk on KPFK today and she was say­ing cool stuff about the way you should act as a cyclist. About not being all aggro and flip­ping the bird, but just truck­ing along in all weather hav­ing a good time. When you send out pos­i­tive vibes to drivers, you inspire them to bike because it looks so fun (and then you won’t inspire dri­vers to hate cyclists more). 

I needed to hear that. I some­times get really frus­trated with cars and suvs cut­ting me off or almost hit­ting me and I yell and flip the bird. It can really get to me, about how cars have more rights, and can just run you off the road, and that the police or who­ever would take their side. And how cars con­tribute to smog and exhaust just chok­ing me and short­en­ing my life. Bitches. 

But like Laura tells me, it is not worth get­ting so mad and worked up over. Also, like Sally said, you can inspire them to ride bikes, which is like bet­ter for the whole world. And they were talk­ing about on the show that any­one on any kind of bike (road, moun­tain, beach cruiser, fixed gear, what­ever) is GREAT because it is SO MUCH BETTER than them dri­ving around in SUVs. There is no rea­son to be an elit­ist about it. The main goals of the cycling com­mu­nity should always to have more peo­ple riding. 

I have always been inspired by peo­ple like that, being so cool and nice to every­one. I feel like there are elit­ist and accept­ing cool peo­ple in any com­mu­nity. I would like to be more like that, not all aggro and elit­ist all the time, but be really cool, pos­i­tive, and accept­ing. We all have a right to love life and not to be shamed for trying.

I am prepared for amazing things to happen


Cyclist Takes Bed Along in Home­made Trailer (Oct, 1940)

I am siked! Stoked! Wack! I don’t know. But I’m pretty pumped. We are at this cross­roads in our life, our econ­omy, etc etc and all that yucky stuff, where we can really do any­thing we want. WHAT HAVE WE GOT TO LOSE? Very lit­tle really.

This pic­ture is maybe the third thing to really get me pumped this year so far. First was read­ing Swim­ming to Antarc­tica by Lynne Cox. I mean, she has to be the coolest most inspir­ing per­son. Like really UP THERE with Gandhi or Dr. King or Obama, you know? She has been swim­ming her whole life. She swam the Bering Strait! No wet­suit, no spe­cial warm­ing noth­ing, she just swam it in her bathing suit. Not only that, she swam from the USA to the Soviet Union DURING THE COLD WAR. How pow­er­ful and inspir­ing is that? Not only was she swim­ming in like 40° water, but she was swim­ming for diplo­macy. And swim­ming the Bering Strait wasn’t her only or biggest accom­plish­ment, she has set all kinds of world records and swam in all kinds of places where no one ever has. In short, read her book! Buy it or get it at the library or bor­row mine. It is very important.

So that was the first thing. The sec­ond thing isn’t as spe­cific. It is a more gen­eral con­cept, or a move­ment really. L has been get­ting pretty deep into the idea of per­ma­cul­ture (to over gen­er­al­ize and state the obvi­ous). She has been an incred­i­ble wealth of knowl­edge and keeps shar­ing these mind-blowing things that peo­ple are doing. Like “…there is this farm run by two ladies near santa cruz and they deliver the CSA on bike.” Whoa! Right? And that is only the tip of the ice­berg. There is a quote that maybe typ­i­fies the sec­ond thing.

…cook­ing, sewing, wash­ing, clean­ing, read­ing, gar­den­ing, fix­ing, writ­ing, draw­ing, craft­ing. woman’s work? per­haps. but i think its bet­ter than lin­ing the pock­ets of some­one else, work­ing for basi­cally noth­ing (for what end or pur­pose), prob­a­bly harm­ing the earth more (we have 30 less envi­ron­ment impact by me not work­ing). this work i do at home ben­e­fits us, not some unknown corp exec and doesnt pol­lute the earth.

We have made the choice to live off of one salary (and my hus­band works only four days a week) and that means that we will always be poor. one car, less “stuff”, noth­ing new for years, but much more hap­pier. that means we get to see and be part of her mile­stones, hear each new word uttered and each new task mas­tered.
per­ma­cul­ture of family

It is about mak­ing a choice, decid­ing what you want to live for or to work towards. This may be a painfully obvi­ous and juve­nile con­cept, but I feel like I’m real­iz­ing its mean­ing fully for the first time.

The third thing is, as I have stated, this image from the Octo­ber 1940 issue of Pop­u­lar Sci­ence. Chet Jr. trav­eled 1,200 miles in 14 days fund­ing his trip by sell­ing post cards? WHAT? Are you kid­ding? That is very awe­some. AND he made that awe­some trailer to sleep in? Can I do that please? But seri­ously, what is stop­ping us from liv­ing out our dreams and doing very cool things like Chet Jr.?

So for 2009, a year of “change”, I am resolved to really think through what I want to accom­plish in my life and start doing it.

Odetta died yesterday

In Novem­ber 2008, Odetta’s health began to decline and she began receiv­ing treat­ment at Lenox Hill Hos­pi­tal in New York. She was slated to per­form at Barack Obama’s inau­gu­ra­tion on Jan­u­ary 20, 2009.
via