Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Voting buttons at bottom rather than top?

by jvector (Friar)
on Jan 29, 2009 at 21:32 UTC ( [id://740036] : monkdiscuss . print w/replies, xml ) Need Help??

Seeing some other recent (-ish) threads ( Voting on nodes in lengthy threads, Offer reply in thread to "toplevel"?,Voting Option) prompts me to throw in another comment on the logistics of voting on nodes : where there is a long-ish reply, when I get to the bottom of that reply and think "I'd like to vote for that", it's a bit of a bother to have to scroll up to the top of the reply to hit the (.)++ button and then scroll on down again. I've often thought the buttons could usefully appear at the bottom of each post rather than at the top.

Update: corrected bad link shortcuts. My apologies and thanks for pointing it out.

This signature is taking the scenic route

Replies are listed 'Best First'.
Re: Voting buttons at bottom rather than top?
by Fletch (Bishop) on Jan 29, 2009 at 22:09 UTC

    Should be trivial to whip up your own custom CSS, or at worst some jQuery that iterates over $('td.reply-body') and removes and then appends each one to the enclosing element.

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

      I gave an example of exactly that in Re: The big Vote button


      Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

        Thank you for that little lead; nice and neat and simple. I see that grinder had the same idea about the location of the ++0--buttons earlier in that thread too. Maybe I'll have a little tinker with this..

        New signature generator needed
Re: Voting buttons at bottom rather than top?
by shmem (Chancellor) on Jan 29, 2009 at 22:21 UTC
Re: Voting buttons at bottom rather than top?
by jvector (Friar) on Jan 29, 2009 at 23:07 UTC
    Fletch: .. for me, no CSS is trivial ;-) Maybe this year I get over whatever is in the way and get there!

    shmem: thank you for the reference. Quite a lot there to take in but I will go into it.

    (Interesting aside... for many years I have actually been quite happy using a mouse + a keyboard together and wondered why some people are so vociferous about using only a keyboard ... at a desktop computer. Now I am often talking to PM on a laptop in the living room c/o wireless, and switching from keys to touchpad is, though closer, somehow a lot more intrusive.)

    My thanks to both. As ever, PerlMonks acts not as a source of Answers to Questions but as a stimulus to more inquiry and learning.

    I'm now just waiting for the moon to slow us down to a 26-hour day.

    This signature would be ready by Christmas if days had 26 hours

      Haha, the same thing happened to me. I just got a laptop earlier this month (I have been using a desktop for ~2 years) and I hate having to use the touchpad. Let me know what you decide to do, I may want to follow suit. :)

      And you didn't even know bears could type.

Re: Voting buttons at bottom rather than top?
by Hue-Bond (Priest) on Jan 31, 2009 at 03:20 UTC

    This is my incomplete implementation, to be used from the free nodelet. It moves the radio button to the cell at the right, above the options [reply], [/msg], [d/l] and such.

    <script language="Javascript"> // reparent voting radio buttons var replies_table = document.getElementById ('replies_table'); if (replies_table) { var divs = replies_table.getElementsByTagName ('div'); for (var i = divs.length - 1; i >= 0; i--) { var node = divs`[i`]; var class = node.getAttribute('class'); if ('vote' != class) { continue; } var dest = node.parentNode.nextSibling; // remove <center> tag node.innerHTML = node.firstChild.innerHTML; // discard spacing between <label>s var children = node.childNodes; for (var j = children.length - 1; j >= 0; j--) { var c = children`[j`]; //alert (c.tagName + ' ' + c.innerHTML); if ('LABEL' != c.tagName) { node.removeChild (c); continue; } } // insert <br>s between <label>s for (var j = children.length - 1; j >= 1; j--) { node.insertBefore (document.createElement ('br'), children +`[j`]); } // add a couple of nbsp's to make the cell wider in // order to make room for the "+=0" vote option dest.firstChild.innerHTML += '&nbsp;&nbsp;&nbsp;'; // add the vote buttons div to the cell at the right dest.insertBefore (node, dest.firstChild); // appendChild (no +de); //alert ('index (' + i + ') class (' + class + ') dest.innerHT +ML (' + dest.innerHTML + ')'); } } </script>

    Things to be improved:

    • Only moves radio buttons in replies, not in the node displayed at the top.
    • The text +=0 appears on its own line, instead of being at the right of its radio button (not an issue for some users). I don't know how to fix that. (Update: if the cell includes the option [select], it gets wide enough and this problem doesn't happen). (Update, more than one year later: it just struck me that adding a couple of &nbsp;s to the [reply] link would be enough to widen the cell and make room for the +=0, thereby fixing the bug.

    David Serrano

      Thank you .. works for me ;-)

      404: signature : not found
Re: Voting buttons at bottom rather than top? (butterfly ballot)
by tye (Sage) on Jan 29, 2009 at 23:42 UTC

    I have looked at several mock-ups placing voting radio buttons at the bottom of each node, but they all were too easy to see as the voting radio buttons being above the author information (an interpretation that would lead to one voting on the wrong node).

    So, as is so often the case, the devil is in the details. If you want buttons at the bottom, then move them for yourself in a way that won't confuse you. If you hope for the site to add an option for putting the buttons there, then produce the mock-up that shows a good way to do it, since I have yet to see one.

    - tye        

      tye, if you could supply the bad ones, I could give a try while avoiding those, resulting in a shorter try-fail loop.

        I tend not to hoard failures. I certainly don't keep track of them for years (I'm sure it has been years since the last time this idea was entertained). There may well be some of them stored in nodes somewhere, so you could try searching for them.

        - tye        

      Just an idea. This only works for replies, not for the node viewed, but what if we placed them on the sidebar above the reply and msg links?