It definitely does, because I noticed when using IE that first it goes to the specified anchor, and then drops down to the new-comment box (if it's supposed to go to the last comment, well, that doesn't work quite right either).
That's responsible for filling in the saved data for commenters what have selected to have their data saved. But the last line causes the "author" field to be active, so the cursor goes there—which drags ineluctably the scrollbar and with the scrollbar the window. Comment out that line and I'll bet your problems are solved.
Well, ogged, I'm glad you asked! I'm pretty sure I've addressed this already in some comment thread here or other, but no matter. As I'm sure you know, since you wrote the HTML for this site by hand, the less-than and greater-than signs signal the start and end of tags. That means that if you're going to display them on your page, you can't just write them, bare, and expect them to show up, because the parser will barf (I believe that's the technical term). So, you have to write them some other way. That way is to write "<" for less than ("gt" for greater than).
You don't actually need to escape ampersands in all cases, but if you want to write something like the above, you do. Had I written, in this text area, "<", what would have shown up would be <, since the ampersand would have been interpreted as the start of an escape sequence. Consequently, I had to escape it: & (which, to me as I write, looks like this: &amp;).
I liked being taken to the bottom too (bada-bing?), but I like being able to link to comments even more. If someone knows a way to do both, I'll do it.
I bet if you modified the function doOnload to contain, at the end, these lines it would work:
if (!document.href.contains("#")) {
document.getElementById("author").focus();
document.getElementById("author").select();
}
I suspect that then you would be able to link to a single comment (since named anchors include the # character), but if you just open the comments link at the bottom of each post, it will go to the bottom.
I posted this in the thread above, but no one seems to have noticed:
How about just a button or link at the top of the comments box that executes the same line of Javascript you just commented out of the OnLoad function (i.e. going to the bottom of the page)? That way, those who like it can use it, and those who don't, can... not use it.
Well, I was trying to offer Ogged a Javascript solution, since that seemed to be what he was looking for. Anyway, there are always 18 million different ways to do the same thing on a computer, but Javascript buttons have caché.
So I was thinking about another cool feature you might try adding: in the OnLoad function, after it fills in the Name/e-mail/URL from the cookie, you can have it check to make sure those values were found, and if so, select the comment box instead of the name box, so that way it saves people who have already put in their info a little bit of scrolling and a click. And it only requires a few more lines of code. Here's the full re-written function:
It definitely does, because I noticed when using IE that first it goes to the specified anchor, and then drops down to the new-comment box (if it's supposed to go to the last comment, well, that doesn't work quite right either).
Posted by ben wolfson | Link to this comment | 03- 3-05 10:43 AM
That is the javascript that opens the comments, but it hasn't been adequately escaped, or something, so it comes up all invisible!!! oh noes!!
function OpenComments (c) {
window.open(c,
'comments',
'width=480,height=480,scrollbars=yes,resizable=yes,status=yes');
}
Note that there's nothing here that screams "I want to go to the bottom of the page!"
Posted by ben wolfson | Link to this comment | 03- 3-05 10:56 AM
In IE the "read more" link doesn't actually get you anything.
Posted by Matt Weiner | Link to this comment | 03- 3-05 10:56 AM
That's because I can't friggin' remember how to quote code.
Posted by ogged | Link to this comment | 03- 3-05 10:58 AM
I am so smrt. Here's what does it. It's in the code in each of the comments pages:
document.getElementById("email").value = getCookie("mtcmtmail");
document.getElementById("author").value = getCookie("mtcmtauth");
document.getElementById("url").value = getCookie("mtcmthome"); document.getElementById("author").focus();
document.getElementById("author").select();
}
That's responsible for filling in the saved data for commenters what have selected to have their data saved. But the last line causes the "author" field to be active, so the cursor goes there—which drags ineluctably the scrollbar and with the scrollbar the window. Comment out that line and I'll bet your problems are solved.
That'll be $150.
Posted by ben wolfson | Link to this comment | 03- 3-05 11:03 AM
Thanks Ben! It was the "author / focus" line that was the problem. Now, tell me again, how do I quote code so that it shows up on the page??
Posted by ogged | Link to this comment | 03- 3-05 11:11 AM
I wasn't doing anything special at all. The only things you have to watch out for are > and <, and ampersands. Those have to be escaped.
Posted by ben wolfson | Link to this comment | 03- 3-05 11:23 AM
When you say "escaped," that means what, exactly?
Posted by ogged | Link to this comment | 03- 3-05 11:24 AM
Well, ogged, I'm glad you asked! I'm pretty sure I've addressed this already in some comment thread here or other, but no matter. As I'm sure you know, since you wrote the HTML for this site by hand, the less-than and greater-than signs signal the start and end of tags. That means that if you're going to display them on your page, you can't just write them, bare, and expect them to show up, because the parser will barf (I believe that's the technical term). So, you have to write them some other way. That way is to write "<" for less than ("gt" for greater than).
You don't actually need to escape ampersands in all cases, but if you want to write something like the above, you do. Had I written, in this text area, "<", what would have shown up would be <, since the ampersand would have been interpreted as the start of an escape sequence. Consequently, I had to escape it: & (which, to me as I write, looks like this: &amp;).
Posted by ben wolfson | Link to this comment | 03- 3-05 11:30 AM
Thanks again. Yes, you'd addressed it before, but I couldn't find it.
Ah...here it is (and that's a working link, bud).
Posted by ogged | Link to this comment | 03- 3-05 11:33 AM
This is a neat article that involves escaping.
Posted by ben wolfson | Link to this comment | 03- 3-05 11:37 AM
But... but... I LIKED being taken to the bottom of the comments.
Posted by girl27 | Link to this comment | 03- 3-05 12:38 PM
Just testing out this phat knowledge.
>boo yeah<
Posted by Michael | Link to this comment | 03- 3-05 1:19 PM
What I want is a program that sets a cookie so it takes you not to the bottom, but to the last comment you yourself actually viewed.
Posted by bitchphd | Link to this comment | 03- 3-05 1:40 PM
I liked being taken to the bottom too (bada-bing?), but I like being able to link to comments even more. If someone knows a way to do both, I'll do it.
Posted by ogged | Link to this comment | 03- 3-05 2:12 PM
I bet if you modified the function doOnload to contain, at the end, these lines it would work:
if (!document.href.contains("#")) {
document.getElementById("author").focus();
document.getElementById("author").select();
}
I suspect that then you would be able to link to a single comment (since named anchors include the # character), but if you just open the comments link at the bottom of each post, it will go to the bottom.
The whole function would then be:
function doOnload(){
document.getElementById("email").value = getCookie("mtcmtmail");
document.getElementById("author").value = getCookie("mtcmtauth");
document.getElementById("url").value = getCookie("mtcmthome");
if (!document.href.contains("#")) {
document.getElementById("author").focus();
document.getElementById("author").select();
}
}
Posted by ben wolfson | Link to this comment | 03- 3-05 2:22 PM
whoops! Change that conditional to be "if(document.href.indexOf("#") == -1)".
Posted by ben wolfson | Link to this comment | 03- 3-05 2:23 PM
Man. And I can barely capitalize a sentence.
Posted by Joe Drymala | Link to this comment | 03- 3-05 2:24 PM
I posted this in the thread above, but no one seems to have noticed:
How about just a button or link at the top of the comments box that executes the same line of Javascript you just commented out of the OnLoad function (i.e. going to the bottom of the page)? That way, those who like it can use it, and those who don't, can... not use it.
Posted by Walter Sobchak | Link to this comment | 03- 3-05 2:25 PM
Walter - you could always just hit the 'End' button on your keyboard.
Posted by apostropher | Link to this comment | 03- 3-05 2:27 PM
Baby, you can hit the 'end' button on my keyboard whenever you want to.
Posted by Matt Weiner | Link to this comment | 03- 3-05 2:30 PM
*punches Matt in the kidneys*
Posted by ben wolfson | Link to this comment | 03- 3-05 2:31 PM
W-A-W, wouldn't it be great if that button were real?
Not that I'd need it. But for some people.
Posted by Joe Drymala | Link to this comment | 03- 3-05 2:31 PM
Ben, doesn't seem to have worked; doesn't go to the bottom. Here's what I have:
function doOnload(){
document.getElementById("email").value = getCookie("mtcmtmail");
document.getElementById("author").value = getCookie("mtcmtauth");
document.getElementById("url").value = getCookie("mtcmthome");
if(document.href.indexOf("#") == -1) {
document.getElementById("author").focus();
document.getElementById("author").select();
}
}
Posted by ogged | Link to this comment | 03- 3-05 2:32 PM
Well, I was trying to offer Ogged a Javascript solution, since that seemed to be what he was looking for. Anyway, there are always 18 million different ways to do the same thing on a computer, but Javascript buttons have caché.
Posted by Walter Sobchak | Link to this comment | 03- 3-05 2:33 PM
maybe it's document.location? I don't actually know javascript. I'd try document.location instead of document.href.
Posted by ben wolfson | Link to this comment | 03- 3-05 2:34 PM
That doesn't work either. Doesn't matter, really. Thanks for trying.
Posted by ogged | Link to this comment | 03- 3-05 2:37 PM
Oh, by the way, that line should be "window.location.href" if you still want to try it.
Posted by Walter Sobchak | Link to this comment | 03- 3-05 2:47 PM
Speaking of recent nerdiliciousness, The Poor Man has finally jettisoned Teh Suck.
Posted by Joe Drymala | Link to this comment | 03- 3-05 2:49 PM
Whoa! Sobchak's code worked, I guess.
Posted by Joe Drymala | Link to this comment | 03- 3-05 2:50 PM
Thanks, Walter!
Posted by ogged | Link to this comment | 03- 3-05 2:51 PM
The Poor Man has finally jettisoned Teh Suck.
Thank god! That old site was killing me.
Posted by ogged | Link to this comment | 03- 3-05 2:53 PM
Day nadda, ameego.
Posted by Walter Sobchak | Link to this comment | 03- 3-05 2:56 PM
So I was thinking about another cool feature you might try adding: in the OnLoad function, after it fills in the Name/e-mail/URL from the cookie, you can have it check to make sure those values were found, and if so, select the comment box instead of the name box, so that way it saves people who have already put in their info a little bit of scrolling and a click. And it only requires a few more lines of code. Here's the full re-written function:
function doOnload(){
document.getElementById("email").value = getCookie("mtcmtmail");
document.getElementById("author").value = getCookie("mtcmtauth");
document.getElementById("url").value = getCookie("mtcmthome");
if(window.location.href.indexOf("#") == -1) {
if(document.getElementById("author").value == "") {
document.getElementById("author").focus()
document.getElementById("author").select()
}
else { document.getElementById("comment").focus()
}
}
}
Cool, or just anal retentive?
Posted by Walter Sobchak | Link to this comment | 03- 4-05 8:23 PM
No, that is cool, Walter. I'll try it out.
Posted by ogged | Link to this comment | 03- 4-05 8:27 PM