Friday, December 30, 2005

Added blogging feature Added blogging feature

One problem with blogger software is that you inevitably end up wading through long posts as you scroll through blogs. In my sonyrootkit.blogspot.com blog, I was dumping a lot of links into the blog, with short comments attached to most of them, with little analysis. So, I went looking for a better way of doing things.

Blogger in its help section provides two different ways of opening and closing blog entries. Both require modifying your blog template. The first requires that you add special code to each blog entry. The result was that your blog entries are in two parts, one part always visible, and the second appearing only when clicked. This worked somewhat, and can be made easier by adding a blog entry template. But it was still a pain, and didn't really look that good. In particular, I disliked that it applied to both short and long blog entries.

The second approach opened and closed each blog entry in its entirety. At first glance, that seemed worse than the first approach, because you would need to open up even the shortest. But then, as I worked with the blog template, I realized that the answer to my problem was to open up my short blog entries, but not my long ones.

In the end, I couldn't quite do that exactly, or rather, didn't devote enough time to get it just right. But what I was able to accomplish was when you moved your cursor over a blog entry, it would open up (and stay open) if it were a small entry, but would stay shut if larger (but would display the blog entry size in the status area). I did this by using the ONMOUSEOVER HTML command. The ONMOUSEOVER would invoke a javascript function whenever the mouse was over specified text that checked the blog entry size and opened it if below a certain limit. Initially, I put the ONMOUSEOVER on the anchor (A) element with the open/close code. But later, I put it on a DIV (division) element that covered the entire blog entry.

The result worked fairly well. As you scrolled down through the blog, shorter blog entries would automatically open for you as your cursor went over the closed blog entries, but longer blog entries would stay closed until manually opened.

If I were running that blog another month or so, and had some more free time, I think that my next attempt would be to try to link the blog entries together so that when you opened one, either explicitly, or through passing the cursor over a shorter one, the other blog entries would close. It shouldn't be that hard. Every time either an entry is opened, whether explicitly, or automatically via ONMOUSEOVER, it is chained to the other blog entries, if not already in the chain. Then, the chain is run, forcing closed all the other blog entries, while this one is opened. Or maybe a slightly different effect if I force closed all other blog entries on each ONMOUSEOVER. The difference is that with the first approach, once one blog entry is open, there will be precisely one blog entry open henceforth. With the second, there is at most one blog entry open (though there may be none).

This is both the upside and downside of being a programmer at heart.

Labels:

12:40 AM Display: Full / Chopped / Footer

Display: Full / Chopped / None

Display: Full / Footer / None

Display: Chopped / Footer / None

1 Comments:

Blogger Fl Florida House Cleaning said...

Fascinating blog. I loved the site you did a good
job on it, I will be back! I surf the net for blog
like this one.
I will give you access to jump to my ms mississippi house cleaning blog.

12:05 PM  

Post a Comment

Links to this post:

Create a Link

<< Home >>