diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2009-10-19 06:27:18 -0700 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-10-19 06:27:18 -0700 |
commit | 1b530e4680b09391d7f99e91f1b0b1eb6b2069fc (patch) | |
tree | 9beee9ad047c5efa41dae7f64a0195b304770b61 /lib/gallery.common.js | |
parent | 9a6a404a3239c964528b501d3c187ead84b1f7a0 (diff) | |
parent | b2d0b3ebbb1764593e387a2e07e0d4e67f4f5474 (diff) |
Merge branch 'master' into talmdal_dev
Conflicts:
modules/user/views/admin_users.html.php
Diffstat (limited to 'lib/gallery.common.js')
-rw-r--r-- | lib/gallery.common.js | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/lib/gallery.common.js b/lib/gallery.common.js index 4ac6de70..7c52fef0 100644 --- a/lib/gallery.common.js +++ b/lib/gallery.common.js @@ -1,4 +1,6 @@ (function ($) { + + // Fade in action status message background color $.fn.gallery_show_message = function(message) { return this.each(function(i){ $(this).effect("highlight", {"color": "white"}, 3000); @@ -17,7 +19,6 @@ return $(this).height(tallest_height); }; - // Vertically align a block element's content $.fn.gallery_valign = function(container) { return this.each(function(i){ @@ -123,6 +124,7 @@ $(thumb).attr({src: data.src, width: data.width, height: data.height}); }; + // Initialize context menus $.fn.gallery_context_menu = function() { if ($(".g-context-menu li").length) { var hover_target = ".g-context-menu"; @@ -144,6 +146,7 @@ } }; + // Size a container to fit within the browser window $.gallery_auto_fit_window = function(imageWidth, imageHeight) { var size = $.gallery_get_viewport_size(); var width = size.width() - 6, @@ -169,4 +172,40 @@ }; }; + // Initialize a short form. Short forms may contain only one text input. + $.fn.gallery_short_form = function() { + return this.each(function(i){ + var label = $(this).find("label:first"); + var input = $(this).find("input[type=text]:first"); + var button = $(this).find("input[type=submit]"); + + $(".g-short-form").addClass("ui-helper-clearfix"); + $(".g-short-form input[type=text]").addClass("ui-corner-left"); + $(".g-short-form input[type=submit]").addClass("ui-state-default ui-corner-right"); + + // Set the input value equal to label text + if (input.val() == "") { + input.val(label.html()); + button.enable(false); + } + + // Attach event listeners to the input + input.bind("focus", function(e) { + // Empty input value if it equals it's label + if ($(this).val() == label.html()) { + $(this).val(""); + } + button.enable(true); + }); + + input.bind("blur", function(e){ + // Reset the input value if it's empty + if ($(this).val() == "") { + $(this).val(label.html()); + button.enable(false); + } + }); + }); + }; + })(jQuery); |