Showing posts with label blog. Show all posts
Showing posts with label blog. Show all posts

Thursday, April 22, 2010

Blogger Rollovers

In my recent Magic and Not A Spiral posts, I used mouse rollovers to help illustrate the differences between two images. For anyone else who uses Blogger and wants to know how, here is a handy guide.

First, Blogger doesn't (easily) allow Javascript, so this will be pure CSS. Second, I wanted the rollover code in the post to be as small and repeatable as possible. So, I used Tables (gasp!).

There are two pieces of formatting code.

Piece Number One
This goes in Layout | Edit HTML, somewhere in the CSS layout. If you don't know what the CSS layout is, ....you probably shouldn't be playing around in the HTML. So, this guide is not for you. For everyone else, here's what to paste in:
table.rollover {
border-width: 0px;
border-spacing: 0px;
border-style: none;
background-repeat:no-repeat;}
table.rollover td {
border-width: 0px;
padding: 0px;
border-style: none;}
table.rollover td img {
padding:0px;
border:0px none;
}
table.rollover:hover img {visibility:hidden;}
What this does is, when you create a table with the "rollover" class, it will hide any image inside the table, which will leave any background image visible. It also removes table and image borders, as my normal layout has those.

Piece Number Two
Now, whenever you want to include a rollover image, all you have to do is use:
<table class="rollover" style="background-image:url(rolloverimage)">
<tr><td height="73"><img src="regularimage" /></td></tr>
</table>
Set "rolloverimage" to the url of the image you want displayed when the mouse is over, and "regularimage" to what you want shown normally. (I don't remember why I put height=73 in there, but it works for any size image [except maybe those with height less than 73?]).

Voilà, pure CSS rollovers usable on Blogger. And here are some examples in action, using Calvin re-enacted by seefresh's lovely wife.







































Saturday, November 07, 2009

Fine.

OK, fine, here's a post for today. I'm at the programming contest right now, and we're not allowed a real browser. This one keeps crashing. Which is fine. People don't like long posts anyway. :-P

Friday, November 06, 2009

No Post!

No post for today! I'm *OUT* of forward posts! I've barely stayed a day or so ahead, but now I'm in Moscow-Pullman for the weekend. Will I post? Probably not!

So, tomorrow may be the very first day without a post since JUNE 30th of this year! How truly sad.

Guess I didn't make it to Christmas after all...

Saturday, October 31, 2009

Happy Halloween!


Another month with daily posts, AND not so many far-forward posts like before. (Of course, that leads to yesterday's random crap)

And because it's the end of the month, it's time for my cop-out. ^_^ Tomorrow I'll have something real to post (maybe).

....alright, alright here's something for today: Sexy Halloween Costumes: When Does A Costume Go Too Far?

Wednesday, September 30, 2009

Another Month

So, another full month of daily posts. And since it is the end of the month, it's time for another cop-out post. ^_^ I won't even tell you what day it is I'm writing this, as it's pretty ridiculous, but I WILL say that forward-posting this far ahead has significant drawbacks. You can draw your own conclusions there.

But don't be surprised if there is no post tomorrow.

So that this post isn't a TOTAL waste, here's an image of a Phoenix. ^_^


(via)

Tuesday, September 01, 2009

So Sue Me

HAHA! I'm writing this in July!

ALRIGHT, I just had to get one in, in case I'm too busy to post between now and the end of the month. ^_^

That's it.

Monday, August 31, 2009

Damn...

So it's already (virtually) the end of August. If I post one more thing I will be posting in September.

And I'm writing this in July. So... there's that.

This blog is quickly changing from "Things I think are cool and interesting" to "Things I thought were cool and interesting months ago when I wrote about them".

:-/

Time to slow down a little?

Friday, August 14, 2009

Four Weeks

As of today (7/17), I now have a FOUR WEEK post buffer on this blog.

That's just ridiculous.

Monday, August 03, 2009

New Record

With this entry, I now have more posts this year than the past three years COMBINED.

It's not even counting the posts I've already written that are scheduled for the rest of the year (eg, holidays).

That is all.

Friday, July 31, 2009

Daily Dose

So, without planning to, I've managed to post every day this month. ^_^

(Yeah, this one is kind of a cop-out; what are you gonna do about it?)

Tuesday, April 14, 2009

Change Is Constant

Blogger changed the feeds for comments, breaking the PEEK function (which then broke the entire page). Awesome.

So no PEEKing until I have time to fix it.

Sunday, March 01, 2009

Peekaboo

Hell yes I got peekaboo comments working again!

In the old Blogger, the comments were available from any page, including non-item pages. This is no longer the case, so I couldn't simply hide the comment block like I used to.

BUT! There is now a comment RSS feed for each post. Aha! I read in the feed and write out the comments. Formatting is lost (the feed only includes the bare text), but it works for a peek, and that's what I wanted.

I already had phidden and pshown set up in my style sheet, because I use them to hide videos.

.phidden {display:none}
.pshown {display:inline}


And for the same reason, I already had the javascript functions to use these styles.
function hide (which){
which.className='phidden';
}

function show (which){
which.className='pshown';
}

function hideid (id) {
var which = document.getElementById(id);
which.className='phidden';
}

function showid (id) {
var which = document.getElementById(id);
which.className='pshown';
}

function togglehidden (id) {
var which = document.getElementById(id);

if (which.className=='pshown') {
hide(which);
}
else {
show(which);
}
}
I just needed code to load, parse, and write the rss data in the post loop. Oh no! The DATE information isn't in any format that javascript can recognize! So I have to parse that too.
function parseXSDDateString(dateString) {
var Zp = (dateString.charAt(10) == "T") ? 19 : 10;
if (19 == Zp) {
if ("." == dateString.charAt(19)) {
dateString = dateString.substr(0, 18) + dateString.substr(22);
}
}
var xDate = new Date(dateString.substr(0, Zp).replace(/-/g, '/').replace("T", " "));
if (dateString.length > Zp) {
xDate.setMinutes(xDate.getMinutes() + xDate.getTimezoneOffset());
if (dateString.charAt(Zp) != "Z") {
var tZ = dateString.substr(Zp).split(":");
tZ = tZ[0] * 60 + (tZ[1] * 1);
xDate.setMinutes(xDate.getMinutes() + tZ);
}
}
return xDate;
}

function hideComments(curl) {
var cid = curl.substring(curl.lastIndexOf('=') + 1);
document.write("<a href=\"javascript:togglehidden('c" + cid + "')\">peek</a>");
document.write("<span class=\"phidden\" id=\"c" + cid + "\">");
var xmlDoc = null;
if (window.ActiveXObject) { // code for IE
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
} else if (document.implementation.createDocument) { // code for Mozilla, Firefox, Opera, etc.
xmlDoc = document.implementation.createDocument("", "", null);
} else {
alert('Your browser cannot handle this script');
}
if (xmlDoc != null) {
xmlDoc.async = false;
xmlDoc.load("http://myrighteye.korv.us/feeds/" + cid + "/comments/default");
document.write("<dl id='comments-block'>");
var x = xmlDoc.getElementsByTagName("entry");
for (i = x.length - 1; i >= 0; i--) {
var auth = x[i].getElementsByTagName("author");
var permalink = x[i].getElementsByTagName("link")[2].attributes[2].value;
var id = permalink.substring(permalink.lastIndexOf('#'));
var d = parseXSDDateString(x[i].getElementsByTagName("published")[0].childNodes[0].nodeValue);
document.write("<dt class='comment-author blogger-comment-icon' id='" + id + "'>");
document.write("<a name='" + id + "'></a>");
document.write("<a href='" + auth[0].getElementsByTagName("uri")[0].childNodes[0].nodeValue + "' rel='nofollow'>" + auth[0].getElementsByTagName("name")[0].childNodes[0].nodeValue + "</a> said...");
document.write("</dt>");
document.write("<dd class='comment-body'>");
document.write("<p>" + x[i].getElementsByTagName("summary")[0].childNodes[0].nodeValue + "</p>");
document.write("</dd>");
document.write("<dd class='comment-footer'>");
document.write("<span class='comment-timestamp'>");
document.write("<a href='" + permalink + "' title='comment permalink'>");
document.write(d.toLocaleString());
document.write("</a>");
document.write("</span>");
document.write("</dd>");
}
document.write("</dl>");
}
document.write("</span>");
}
(Yes, it would be more proper not to use document.write but I'm lazy).

Then there was the tricky part: adding the peek link to the post includable. I only want it showing up on the main page and archive pages, not item pages.

(Also, before you do this, if you use the Layout option to edit your post format, do that now; it's going to stop working once you fiddle with its internals)

Expanded the widgets and searched for "data:post.addCommentUrl" (which shows up twice; for separate page and embedded commenting). The first instance looked like:
<b:if cond='data:post.allowComments'>
<a class='comment-link' expr:href='data:post.addCommentUrl' expr:onclick='data:post.addCommentOnclick'><b:if cond='data:post.numComments == 1'>1 <data:top.commentLabel/><b:else/><data:post.numComments/> <data:top.commentLabelPlural/></b:if></a>
</b:if>
I changed this to:
<b:if cond='data:post.allowComments'>
<a class='comment-link' expr:href='data:post.addCommentUrl' expr:onclick='data:post.addCommentOnclick'><b:if cond='data:post.numComments == 1'>1 <data:top.commentLabel/><b:else/><data:post.numComments/> <data:top.commentLabelPlural/></b:if></a>
<b:if cond='data:post.numComments &gt; 0'>
<script type='text/javascript'>
hideComments(&quot;<data:post.addCommentUrl/>&quot;);
</script>
</b:if>

</b:if>
Hurray, success! Or I should say SUCCESS, since there's apparently a text-transform:uppercase in effect. So add text-transform:none; to #comments-block and voila.

So, it's working (and without loaded huge external .js files like other peekaboo comment systems I won't mention), but there is a lot of room for improvement. It's not asynchronous, so every rss feed for every post on the page is retrieved and parsed (potentially SLOW); it COULD retrieve the feed when you click peek, as needed (also, all of my javascript links are way old-style and should be updated to use proper onclick events). I could make proper element creators instead of half-assing with document.write. I could clean up the code a LOT.

But, it's working, so I'm probably not going to do any of that. ^_^

Tuesday, February 24, 2009

No Post

So my buffer of forward posts ran out and there was no new post yesterday. I HAD been hoping that my posting streak would at least last the entire month, and with less than a week to go I blinked.

SO close...

This happened because I worked through this past weekend trying to get projects done for school, instead of fun projects like the blog. And all weekend long, I kept thinking "Oh, I really have to remember to write my posts for this week. I'm definitely going to do that..." and then it was Tuesday.

:-(

Thursday, February 19, 2009

Calling "Blog Rights"

Thomas introduced me to the practice of calling 'blog rights' to something. Having never heard of the practice, I called blog rights to 'blog rights'.

That was what, two months ago? More? It's been a while.

So here it is, at long last: the rules to calling blog rights (with addendum).
  1. The first person to call it gets it.
  2. You can't pre-call it (eg, no going "I call blog rights on the concert we're going to next weekend").
It's really a lot like calling shotgun. Here's the proposed addendum:
  • If someone calls blog rights to something, and NEVER POSTS IT, their exclusive rights expire. Let's say, in a week.
Does that work?

Saturday, February 14, 2009

Forward Posting Revisited

How is the forward posting experiment going so far?

Well, drafts and scheduled posts now take up the entire first page of the Edit Posts menu (and part of the second).

Sometimes it's great, like during the week when I have almost NO time to post anything. I don't have to worry.

Sometimes it sucks, like when Mike posts a video that I have sitting in my queue. ^_^

Sometimes so much time has passed between when I write something and when it posts that the post is meaningless or out-of-date on arrival.

Overall, I like it. I can sometimes think of scheduled posts in the back of my mind, simmering away, and something new will occur to me, or I'll have a change of heart. I can edit it before it posts; I have plenty of time. And if I forget, well, then it wasn't that important. ^_^

Tuesday, February 03, 2009

Tuesday's Hidden Videos News

OK, so clearly all the videos are gone/hidden on my blog (at least, all the recent ones).

Instead, you'll see these links:Show/Hide
Wow, you'll just click anything, won't you.

I did this for a couple of reasons, but mostly because the page loads much faster without all the videos. They're still there, and you can still watch them, you just don't have to wait for every old thumbnail to load from a dozen different sites. Also, the page isn't as long this way, so you can scroll down quicker.

And those autoplaying flash files on my old pages can be hidden so they don't autoplay!

Anyway, like I said, lots of reasons. Just a way of making my little part of the world a bit better every day.

Friday, January 30, 2009

I Accidentally The Whole Template

I just wanted to update my picture
oh god how did this get here
I am not good with computer