Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

A while back I got tired of scrolling back to the top of a post after reading it and deciding to vote on it, so I wrote a little Javascript/jQuery to move the buttons to the bottom of a reply. I insert it in the page using a Chromium extension called Personalized Web, but you can use any browser plugin/extension that does the same thing, or insert it using the Free Nodelet Settings as jdporter said here. I've added some other features to it, and thought I'd share it in case others can get some use from it.

The code has four parts:

  1. This one line adds a [vote!] button for each post, so I don't have to scroll to the bottom of the page when I'm ready to submit my votes.
  2. This moves the vote buttons for each reply to the bottom of the reply, so they're accessible when you've read to the bottom of the reply.
  3. This does the same with the vote buttons for the main post at the top of the page.
  4. (This one may be controversial, so use it or delete it as you like.) I tend to find Anonymous Monk replies, let's say, less useful than non-Anonymous Monk replies, so I thought I'd like to hide them but make it easy to see them in case I want to for context. This hides the reply itself, shrinks the header a bit, changes its background color to make it stand out, and makes it clickable. Clicking on it toggles the visibility of the reply, so I can click to see it and then click it back out of the way.

If you like it, use it however you like. If you have any questions or suggestions, please share them.

<script src="//code.jquery.com/jquery-1.11.3.min.js"></script> <script type="text/javascript"> jQuery(document).ready(function(){ // 1. add vote button next to each set of voting radio buttons jQuery('div.reputation center').append('<input style="margin-left: +20px" type="submit" name="sexisgreat" value="vote!" />'); // 2. move vote buttons for replies jQuery('td.reply-body').not('td.adjunct-links').each(function(){ var $m = $(this).children().first(); var $t = $m.html(); $m.remove(); $(this).append('<div class="reputation">'+$t+'</div>'); }); // 3. move vote buttons for main post var $m = $('div.reputation').first(); var $t = $m.html(); jQuery('div.doctext').append($t); // different classes depending +on jQuery('div.notetext').append($t); // whether top of thread $m.remove(); // 4. hide and de-emphasize Anonymous Monk replies var $anon = jQuery('span.attribution:contains("Anonymous Monk")'). +parents('tr.reply'); $anon.css({'font-size':'50%','background-color':'#dd7'}); $anon.next().hide(); $anon.click(function(e){ e.preventDefault(); jQuery(this).next().toggle(); }); }); </script>

Aaron B.
Available for small or large Perl jobs and *nix system administration; see my home node.


In reply to jQuery Customizations to Enhance the PerlMonks Experience by aaron_baugher

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-04-20 02:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found