From da240d9da104921534a18a9dc62ff1c15f0ed650 Mon Sep 17 00:00:00 2001
From: Kris Borchers <kris.borchers@gmail.com>
Date: Mon, 3 Dec 2012 21:25:55 -0600
Subject: Progressbar: Custom label demo cleanup

---
 demos/progressbar/label.html | 43 ++++++++++++++++++++++---------------------
 1 file changed, 22 insertions(+), 21 deletions(-)

(limited to 'demos')

diff --git a/demos/progressbar/label.html b/demos/progressbar/label.html
index c4334b65c..25394b205 100644
--- a/demos/progressbar/label.html
+++ b/demos/progressbar/label.html
@@ -2,7 +2,7 @@
 <html lang="en">
 <head>
 	<meta charset="utf-8">
-	<title>jQuery UI Progressbar - Default functionality</title>
+	<title>jQuery UI Progressbar - Custom Label</title>
 	<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
 	<script src="../../jquery-1.8.3.js"></script>
 	<script src="../../ui/jquery.ui.core.js"></script>
@@ -10,35 +10,36 @@
 	<script src="../../ui/jquery.ui.progressbar.js"></script>
 	<link rel="stylesheet" href="../demos.css">
 	<style>
-		.progress-label {
-			float: left;
-			margin-left: 50%;
-			margin-top: 5px;
-			font-weight: bold;
-		}
+	.progress-label {
+		float: left;
+		margin-left: 50%;
+		margin-top: 5px;
+		font-weight: bold;
+		text-shadow: 1px 1px 0 #fff;
+	}
 	</style>
 	<script>
 	$(function() {
-		$( "#progressbar" ).progressbar({
+		var progressbar = $( "#progressbar" ),
+			progressLabel = $( ".progress-label" );
+
+		progressbar.progressbar({
 			value: false,
-			change: function( event, ui ) {
-				$( ".progress-label" ).text( $( "#progressbar" ).progressbar( "value" ) + "%" );
+			change: function() {
+				progressLabel.text( progressbar.progressbar( "value" ) + "%" );
+			},
+			complete: function() {
+				progressLabel.text( "Complete!" );
 			}
 		});
 
 		function progress() {
-			var val = $( "#progressbar" ).progressbar( "value" );
+			var val = progressbar.progressbar( "value" ) || 0;
 
-			if ( !val ) {
-				val = 0;
-			}
-			if ( val < 100 ) {
-				$( "#progressbar" ).progressbar( "value", val + 1 );
-				setTimeout( function() {
-					progress();
-				}, 100);
-			} else {
-				$( ".progress-label" ).text( "Complete!" );
+			progressbar.progressbar( "value", val + 1 );
+
+			if ( val < 99 ) {
+				setTimeout( progress, 100 );
 			}
 		}
 
-- 
cgit v1.2.3