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:
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.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: jQuery Customizations to Enhance the PerlMonks Experience
by GrandFather (Saint) on Jun 28, 2015 at 02:17 UTC | |
by aaron_baugher (Curate) on Jun 29, 2015 at 00:12 UTC |