MacdougalMedia by Scott Macdougal Weaver

13Apr/100

CheckBoxer for Google Chrome

CheckBoxer extension for Google ChromeCheckBoxer 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:

CheckBoxer 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.

7Apr/102

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.

[Install CheckBoxMate for Greasemonkey]

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.

13Mar/100

ShareThis Sucks for Greasemonkey

ShareThis Sucks

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:

ShareThis Sucks

And here's a link directly to the file:

share_this_sucks.js

Enjoy!

-Scott

10Mar/100

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:

Reddit Tabbed Links

Here's the direct link to the script:

reddit_tabbed_links.js

Enjoy.

http://userscripts.org/scripts/show/71070Reddit Tabbed Links
11Dec/090

Use jQuery to Tally Forms

Travel Expenses

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.

10Aug/092

Death To Internet Explorer 6! [Internet Explorer]

Kill Internet Explorer 6

Kill Internet Explorer 6

Well it's about time.

It's been nearly ten years of toiling over my CSS and Javascript, trying to give my websites a consistent look and feel across the board. Internet Explorer version 6 has been the bane of my existence and the thorn in my hide. My developer friends and I have discussed boycotting it at the risk of losing the eyes of the uninformed millions unknowingly viewing the internet the way it was never meant to be seen. Sure, we might lose their eyes altogether but we'd prefer that over a negative experience.

More recent versions of Internet Explorer aren't as bad and they're getting better at adhering to web standards but there are still some annoying browser-specific quirks we have to deal with every day. All I ask is that people really follow through with this movement.

To read more, click here.