CheckBoxer for Google Chrome
CheckBoxer is an extension I wrote for Google Chrome. Based on the CheckBoxMate plugin for Firefox by nrlz, it does ... well.. exactly the same thing: you draw a rectangle around the check boxes you want to toggle on or off. Magic.
Here it is in action:
As you can see, it has selected all of the check boxes within the selected area. No need to hold any other buttons as it only works when you've dragged over the starting checkbox.
Click here to check it out.
CheckBoxMate for Greasemonkey
Ever had to check off a bunch of checkboxes one by one? It's a grueling and tedious process, especially when you have to do more than .. say .. five. Never fear! That's why nrlz came up with CheckBoxMate.
What Is CheckBoxMate? This script allows you to check multiple checkboxes just by drawing a box around them.
It doesn't get any more elegant than that and it's one of those tools you don't use every day but when you need it, it's a godsend. The trouble is, it doesn't seem to work at all (without tweaking) with Firefox 3.6+. That's where Greasemonkey comes in.
In a desperate attempt at making my precious CheckBoxMate work with my updated Firefox script, I decided to look under the hood to see if I could figure out the solution to the issue. After an hour of poking and prodding, I was able to troubleshoot and fix the problem using the Add-on's javascript in Greasemonkey (pretty handy way to diagnose Add-on problems in general, actually).
Summary: CheckBoxMate stopped working, so I jammed it into Greasemonkey, fixed it and released it on userscripts.org.
I'm currently using CheckBoxMate for Greasemonkey with Firefox 3.6.3 on Mac OS X 10.6.3 with absolutely zero problems.
P.S. I've done all of this essentially without nrlz's permission at all, so if he tells me to take this down, I will.
*** UPDATE***
I've tested this on my Windows 7 box at work (Firefox 3.6.3) and it works perfectly. Please let me know if you have any issues.
ShareThis Sucks for Greasemonkey
After becoming repeatedly annoyed at how the ShareThis button would pop up and just stay there at any hint of a mouseover/hover, I wrote this short Greasemonkey script to banish ShareThis from my sight:
And here's a link directly to the file:
Enjoy!
-Scott
Reddit Tabbed Links
Put simply, I was just tired of shift+clicking the links on Reddit, so I made a Greasemonkey script that does it for all the main links and comment links:
Here's the direct link to the script:
Enjoy.
Use jQuery to Tally Forms
Recently, I had the task of creating a simple form to be submitted to a specific department member here on campus. I felt this was a great opportunity to utilize jQuery and to see just how simple I could make adding new fields, since I wanted the form to be somewhat dynamic (adding/removing of inputs and such).
After trying a few methods here and there, I was able to utilize a few jQuery functions and a nice plugin (jquery-formatcurrency) to make everything work as desired.
Here is what I came up with:
$(document).ready(function(){ var total = 0; $('.currency').blur(function() { total = 0; $('.add').each(function(i,obj){ total += $(obj).val()*1; }); $('.subtract').each(function(i,obj){ total -= $(obj).val()*1; }); $('#total').val(total); $('.currency').formatCurrency({symbol:''}); }); });
What's neat about this method is that it handles everything on the blur (loss of focus) of any element with the 'currency' class applied. That means it won't do anything to the field while a person is typing in it -- annoying for some people -- it waits until the user moves on to the next field or away from the field altogether.
The really cool part of what happens first is the mathematical operation. Notice the similarity between the following methods:
$('.add').each(function(i,obj){ total += $(obj).val()*1; }); $('.subtract').each(function(i,obj){ total -= $(obj).val()*1; });
The first method looks at all elements with the 'add' class applied. The .each jQuery function cycles through each matched element and feeds two variables to the attached function: an incremented index and the object reference itself. This makes a tally extremely simple as jQuery will automagically cycle through all the elements you want to either add or subtract based on what class you have applied. The same applies to both classes and, of course, can be extended if you want to do more complex mathematics or formatting to your fields.
After these methods run, the total variable now holds the correct sum for all fields properly classed either 'add' or 'subtract.' This can now be applied to the input field with an id of 'total':
$('#total').val(total);
This will set the 'total' input field's value to the sum of the fields.
Lastly, it will format all fields to currency using the formatCurrency function:
$('.currency').formatCurrency({symbol:''});
Notice I specify here that I do not want any currency symbol (e.g. '$') as I specify that outside the field itself to display to the user.
Again, all of this happens every time a field gets updated and loses focus. So yes, it's magic.

