diff options
author | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2012-12-17 12:01:45 +0100 |
---|---|---|
committer | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2012-12-17 12:01:45 +0100 |
commit | b80bd744ad873f6fc43018bc4bfb90677de167bd (patch) | |
tree | 072c4b0e33d442528555b82c415f5e7a1712b2b0 /app/assets/javascripts/vendor/jquery.survival-kit.coffee | |
parent | 3e706c2025ecc5523e81ad649639ef2ff75e7bac (diff) |
Start of GS5.
Diffstat (limited to 'app/assets/javascripts/vendor/jquery.survival-kit.coffee')
-rw-r--r-- | app/assets/javascripts/vendor/jquery.survival-kit.coffee | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/app/assets/javascripts/vendor/jquery.survival-kit.coffee b/app/assets/javascripts/vendor/jquery.survival-kit.coffee new file mode 100644 index 0000000..654e167 --- /dev/null +++ b/app/assets/javascripts/vendor/jquery.survival-kit.coffee @@ -0,0 +1,36 @@ +Array.prototype.empty = -> + if this.length <= 0 + return true + else + return false + +$.ns('sk').add { + # Search Box Helper + searchBox: -> + input = $('input.text', this) + default_mes = input.val() + input.focus(-> + if input.val() == default_mes + input.val '' + ).blur(-> + if input.val() == '' + input.val default_mes + ) + + # Simple Form Style Helper. + simpleForms: -> + max = 0 + labels = $("div:not(.boolean) > label", this) + hints = $("div:not(.boolean) > .hint", this) + labels.each -> + if $(this).width() > max + max = $(this).width() + $('> .hint.padded', this).css 'padding-left' : max + + # Get the horizontal-spacing (set on the css.) + horizontal_spacing = parseInt(labels.first().css('margin-right')) + + hints.css 'padding-left' : (max + horizontal_spacing) + $('.actions', this).css 'padding-left' : (max + horizontal_spacing) + labels.width(max) +} |