diff options
author | Chad Kieffer <chad@2tbsp.com> | 2008-12-23 06:24:21 +0000 |
---|---|---|
committer | Chad Kieffer <chad@2tbsp.com> | 2008-12-23 06:24:21 +0000 |
commit | 73d7cb4576ce3e27be738e428b7da759a58c5b09 (patch) | |
tree | bad426236d1db5e8ba48ed46022e14be894d851f /themes/default/js/ui.init.js | |
parent | 8f1cd010c07944542886623f0faf1bf877861f42 (diff) |
Make the loading class a bit more reusable.
Diffstat (limited to 'themes/default/js/ui.init.js')
-rw-r--r-- | themes/default/js/ui.init.js | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/themes/default/js/ui.init.js b/themes/default/js/ui.init.js index 325e5299..394c18b0 100644 --- a/themes/default/js/ui.init.js +++ b/themes/default/js/ui.init.js @@ -140,11 +140,11 @@ function openDialog(element) { $("#gDialog").dialog('destroy').remove(); } }); - $("#gDialog").addClass("gLoadingLarge"); + loading("#gDialog") $(".ui-dialog-content").height(400); $("#gDialog").html(sHref); $.get(sHref, function(data) { - $("#gDialog").removeClass("gLoadingLarge"); + loading("#gDialog"); $("#gDialog").html(data).hide().fadeIn(); // Get dialog and it's contents' height var contentHt = $(".ui-dialog-titlebar").height() @@ -156,8 +156,24 @@ function openDialog(element) { $(".ui-dialog").animate({height: contentHt}); } }); - - - return false; } + +/** + * Toggle the processing indicator, both large and small + * + * @param element ID to which to apply the loading class, including # + * @param size Either Large or Small + */ +function loading(element) { + var size; + switch (element) { + case "#gDialog": + size = "Large"; + break; + default: + size = "Small"; + break; + } + $(element).toggleClass("gLoading" + size); +} |