Fusioncube

The online journey of a technophile, by Steve Brownlee

Archive for December, 2007

A better loading message with Ext and jQuery

Wednesday
Dec 19,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

  • Filed under: gaming
Friday
Dec 7,2007

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.

About Steve

I am a technologist, and have been ever since 1980 when I got my very first TRS-80 and programmed it to do my math homework. I love to share the gift of technology with others and show them the wonderful things it can do for them, and how they should not fear it, but embrace it.

Latest Tweets

  • Ok... stayed up way too late trying out website designs for my wife's new nonprofit. The kids will be getting me u... — http://t.co/QrKh5iBI
  • Am I the only one who likes Google’s new privacy policy? http://t.co/qwcym5wH
  • All that time wasted learning the .NET framework - Fusioncube - http://t.co/krANoWmg
  • @marcesher libraries like Less only do what you tell them. You can make a mixin to do that, but it doesn't assume anything (which is good)
  • Circus about to start. Girls are so excited they can't stand it!!!! (with Sabrina and Tessa at @BrdgstoneArena) [pic] — http://t.co/PXwi5emj

Subscribe

Entries (RSS)
Comments (RSS)