Saturday, March 19, 2011

What the hell?

Anyone looking at my blog in the wee hours of the night might have noticed a bunch of gibberish-y posts disappearing and reappearing.

That was me, I admit it.  Admin stuff.  Oh, what was I doing?  Only this:

(this probably won't work if you're viewing this in a feed reader)

Click me
A sentence magically appeared!!!

If that worked, then you're looking at the product of hours of work.  A sentence was supposed to appear under "click me" btw. If you click on "click me" again, then the sentence should disappear.  Why hours of work, you ask?

Because, dear reader, I don't know javascript.  The last few hours involved me cutting and pasting bits from different scripts that basically worked but had little problems.  Most required a different script for each block of text.  For example:

Click this one now
Some scripts required multiple embeddings of the same script in order for multiple blocks of text to be shown or hidden in one post.  With the script I have now, all I have to do is keep a unique id in the text's wrapper (a new unique id for each block of text)

It wasn't easy.  I honestly can't believe it worked.  I literally tried one last thing, saying to myself "If this doesn't work I'm going to bed".  And I meant it this time.

Another good thing about this script versus others:  Other scripts will expand the text once the link is clicked, but if said link is at the bottom of a post, the browser will for some reason jump to the top of the page, losing your place. This one doesn't. Or shouldn't.  Hopefully it works for all of you like it does for me.

Well, bed time for me.  Time to get up I mean, but I think I'll go to bed instead.


No comments:

Post a Comment