Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Voting buttons at bottom rather than top?

by Hue-Bond (Priest)
on Jan 31, 2009 at 03:20 UTC ( #740375=note: print w/ replies, xml ) Need Help??


in reply to Voting buttons at bottom rather than top?

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


Comment on Re: Voting buttons at bottom rather than top?
Select or Download Code
Re^2: Voting buttons at bottom rather than top?
by jvector (Friar) on Jan 31, 2009 at 13:45 UTC
    Thank you .. works for me ;-)

    404: signature : not found

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://740375]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2014-07-29 00:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (211 votes), past polls