Archive for December, 2007

It couldn’t be easier to have an attractive loading message that actually prevents those click-happy users from firing off 20 AJAX requests because they didn’t know anything happened when they clicked that “Order Now” link.

Include the jQuery library, the core Ext functions and the dialog functions.

<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/ext-core.js"></script>
<script type="text/javascript" src="js/ext-dialogs.js"></script>

Use the jQuery ajaxStart() and ajaxStop() methods to show a modal dialog that the user can’t mess with.

$(document).ready(function() {
	dialog = new Ext.BasicDialog("loading", {
	        modal:true,
        	width:200,
        	height:100,
        	shadow:true,
        	collapsible:false,
        	draggable:false,
        	resizable:false,
        	closable:false
	});

	$("#loading")
		.ajaxStart(function(){ dialog.show(); })
		.ajaxStop(function(){ dialog.hide(); });
}

Lastly, a simple DIV with an animated gif and some text.

<div id="loading" style="display:none;">
    <div class="x-dlg-hd">Processing...</div>
	<div class="x-dlg-bd">
		<div class="x-dlg-tab" title="">
			<div class="inner-tab" style="font-size:1.25em; font-weight:800;"><img style="margin-right:15px;" src="images/loadingcolors.gif" border="0" />Please wait...</div>
		</div>
	</div>
</div>

Now when the user fires an event that requires an AJAX call, the dialog will immediately appear to prevent any further interaction with the site, and then disappear once the request is done.
Loading dialog

Why I Play Guitar Hero

Every time I post my opinion about the latest version of Guitar Hero, people keep leaving comments to the effect, “Why don’t you just play the real guitar?”

Let me explain why I don’t go out and play a real guitar.

  • I’m at work by 7 in the morning, and get home at 6:30 in the evening
  • My 15 month old daughter then gets all of my attention until bedtime around 7:45
  • I then want to spend time with my wife until our bedtime
  • On the weekends, we actually have things to do like taking care of our daughter, fixing up the house, shopping, travel, friends, etc.
  • On my days off, I like to relax at home with my family

Given all that, going out to Best Buy, buying a game for $50 with a guitar controller and being able to play a game that simulates playing guitar, and being able to play anytime I want (perhaps at 1:00 AM) is far preferable to shelling out money for a real guitar, a monthly fee to someone else to teach me how to play it correctly, and the time it would suck out of my day.

Capish? Now leave me the hell alone.

Powered by ScribeFire.