summaryrefslogtreecommitdiff
path: root/lib/gallery.common.js
diff options
context:
space:
mode:
authorChad Kieffer <chad@2tbsp.com>2009-05-26 03:59:35 +0000
committerChad Kieffer <chad@2tbsp.com>2009-05-26 03:59:35 +0000
commit88e1f02c1a250dae7b8dabeeaf9f6209f4c84942 (patch)
tree810150dedf2aa0bbc273942959202f8c3621bf07 /lib/gallery.common.js
parent916405bc4b572ded4b60a2a2eaececb8402dba0a (diff)
Split out re-used JavaScript for common functions (messages, valign), panel toggle, and forms to external files.
Diffstat (limited to 'lib/gallery.common.js')
-rw-r--r--lib/gallery.common.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/gallery.common.js b/lib/gallery.common.js
new file mode 100644
index 00000000..bb2e75a2
--- /dev/null
+++ b/lib/gallery.common.js
@@ -0,0 +1,30 @@
+/**
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+(function () {
+ $.fn.showMessage = function(message) {
+ return this.each(function(i){
+ $(this).effect("highlight", {"color": "white"}, 3000);
+ $(this).animate({opacity: 1.0}, 6000);
+ $(this).fadeOut("slow");
+ });
+ };
+})(jQuery);
+
+// Vertically align a block element's content
+(function () {
+ $.fn.vAlign = function(container) {
+ return this.each(function(i){
+ if (container == null) {
+ container = 'div';
+ }
+ $(this).html("<" + container + ">" + $(this).html() + "</" + container + ">");
+ var el = $(this).children(container + ":first");
+ var elh = $(el).height();
+ var ph = $(this).height();
+ var nh = (ph - elh) / 2;
+ $(el).css('margin-top', nh);
+ });
+ };
+})(jQuery);