formalize-rails 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in formalize-rails.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,24 @@
1
+ # Formalize Rails
2
+
3
+ This gem vendors Formalize to the asset pipeline. Therefore, this gem requires Rails 3.1 and
4
+ greater.
5
+
6
+ Add this gem to your gemfile:
7
+
8
+ gem 'formalize-rails'
9
+
10
+ And add `app/assets/stylesheets/application.css`:
11
+
12
+ //= require formalize
13
+
14
+ And add one of these lines to `app/assets/javascripts/application.js`, depending on which javascript
15
+ framework you are using:
16
+
17
+ //= dojo.formalize
18
+ //= extjs.formalize
19
+ //= jquery.formalize
20
+ //= mootools.formalize
21
+ //= prototype.formalize
22
+ //= yui.formalize
23
+
24
+ See [formalize.me](http://formalize.me) for more information.
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "formalize/rails/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "formalize-rails"
7
+ s.version = Formalize::Rails::VERSION
8
+ s.authors = ["Iain Hecker"]
9
+ s.email = ["iain@iain.nl"]
10
+ s.homepage = "https://github.com/iain/formalize-rails"
11
+ s.summary = %q{Use Formalize with the asset pipeline}
12
+ s.description = %q{This gem provides the assets for the formalize form styling, for easy usage with the Rails 3.1 asset pipeline.}
13
+
14
+ s.rubyforge_project = "formalize-rails"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_dependency "railties", "~> 3.1.0.rc1"
22
+ end
@@ -0,0 +1,6 @@
1
+ module Formalize
2
+ module Rails
3
+ class Engine < ::Rails::Engine
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module Formalize
2
+ module Rails
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ require 'formalize/rails/engine'
2
+
3
+ module Formalize
4
+ module Rails
5
+
6
+ end
7
+ end
@@ -0,0 +1 @@
1
+ require 'formalize/rails'
Binary file
@@ -0,0 +1,166 @@
1
+ /*
2
+ Formalize - version 1.1
3
+
4
+ Note: This file depends on the Dojo library.
5
+ */
6
+
7
+ // Module pattern:
8
+ // http://yuiblog.com/blog/2007/06/12/module-pattern
9
+ var FORMALIZE = (function(window, document, undefined) {
10
+ // Private constants.
11
+ var PLACEHOLDER_SUPPORTED = 'placeholder' in document.createElement('input');
12
+ var AUTOFOCUS_SUPPORTED = 'autofocus' in document.createElement('input');
13
+ var IE6 = parseInt(dojo.isIE, 10) === 6;
14
+ var IE7 = parseInt(dojo.isIE, 10) === 7;
15
+
16
+ // Expose innards of FORMALIZE.
17
+ return {
18
+ // FORMALIZE.go
19
+ go: function() {
20
+ for (var i in FORMALIZE.init) {
21
+ FORMALIZE.init[i]();
22
+ }
23
+ },
24
+ // FORMALIZE.init
25
+ init: {
26
+ // FORMALIZE.init.full_input_size
27
+ full_input_size: function() {
28
+ if (!IE7 || !dojo.query('textarea, input.input_full').length) {
29
+ return;
30
+ }
31
+
32
+ // This fixes width: 100% on <textarea> and class="input_full".
33
+ // It ensures that form elements don't go wider than container.
34
+ dojo.query('textarea, input.input_full').forEach(function(el) {
35
+ var new_el = el.cloneNode(false);
36
+ var span = document.createElement('span');
37
+
38
+ span.className = 'input_full_wrap';
39
+ span.appendChild(new_el);
40
+ el.parentNode.replaceChild(span, el);
41
+ });
42
+ },
43
+ // FORMALIZE.init.ie6_skin_inputs
44
+ ie6_skin_inputs: function() {
45
+ // Test for Internet Explorer 6.
46
+ if (!IE6 || !dojo.query('input, select, textarea').length) {
47
+ // Exit if the browser is not IE6,
48
+ // or if no form elements exist.
49
+ return;
50
+ }
51
+
52
+ // For <input type="submit" />, etc.
53
+ var button_regex = /button|submit|reset/;
54
+
55
+ // For <input type="text" />, etc.
56
+ var type_regex = /date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;
57
+
58
+ dojo.query('input').forEach(function(el) {
59
+ // Is it a button?
60
+ if (el.getAttribute('type').match(button_regex)) {
61
+ dojo.addClass(el, 'ie6_button');
62
+
63
+ /* Is it disabled? */
64
+ if (el.disabled) {
65
+ dojo.addClass(el, 'ie6_button_disabled');
66
+ }
67
+ }
68
+ // Or is it a textual input?
69
+ else if (el.getAttribute('type').match(type_regex)) {
70
+ dojo.addClass(el, 'ie6_input');
71
+
72
+ /* Is it disabled? */
73
+ if (el.disabled) {
74
+ dojo.addClass(el, 'ie6_input_disabled');
75
+ }
76
+ }
77
+ });
78
+
79
+ dojo.query('textarea, select').forEach(function(el) {
80
+ /* Is it disabled? */
81
+ if (el.disabled) {
82
+ dojo.addClass(el, 'ie6_input_disabled');
83
+ }
84
+ });
85
+ },
86
+ // FORMALIZE.init.autofocus
87
+ autofocus: function() {
88
+ if (AUTOFOCUS_SUPPORTED || !dojo.query('[autofocus]').length) {
89
+ return;
90
+ }
91
+
92
+ dojo.query('[autofocus]')[0].focus();
93
+ },
94
+ // FORMALIZE.init.placeholder
95
+ placeholder: function() {
96
+ if (PLACEHOLDER_SUPPORTED || !dojo.query('[placeholder]').length) {
97
+ // Exit if placeholder is supported natively,
98
+ // or if page does not have any placeholder.
99
+ return;
100
+ }
101
+
102
+ FORMALIZE.misc.add_placeholder();
103
+
104
+ dojo.query('[placeholder]').forEach(function(el) {
105
+ dojo.connect(el, 'onfocus', function() {
106
+ var text = el.getAttribute('placeholder');
107
+
108
+ if (el.value === text) {
109
+ el.value = '';
110
+ dojo.removeClass(el, 'placeholder_text');
111
+ }
112
+ });
113
+
114
+ dojo.connect(el, 'onblur', function() {
115
+ FORMALIZE.misc.add_placeholder();
116
+ });
117
+ });
118
+
119
+ // Prevent <form> from accidentally
120
+ // submitting the placeholder text.
121
+ dojo.query('form').forEach(function(form) {
122
+ dojo.connect(form, 'onsubmit', function() {
123
+ dojo.query('[placeholder]', form).forEach(function(el) {
124
+ var text = el.getAttribute('placeholder');
125
+
126
+ if (el.value === text) {
127
+ el.value = '';
128
+ dojo.removeClass(el, 'placeholder_text');
129
+ }
130
+ });
131
+ });
132
+
133
+ dojo.connect(form, 'onreset', function() {
134
+ setTimeout(FORMALIZE.misc.add_placeholder, 50);
135
+ });
136
+ });
137
+ }
138
+ },
139
+ // FORMALIZE.misc
140
+ misc: {
141
+ // FORMALIZE.misc.add_placeholder
142
+ add_placeholder: function() {
143
+ if (PLACEHOLDER_SUPPORTED || !dojo.query('[placeholder]').length) {
144
+ // Exit if placeholder is supported natively,
145
+ // or if page does not have any placeholder.
146
+ return;
147
+ }
148
+
149
+ dojo.query('[placeholder]').forEach(function(el) {
150
+ var text = el.getAttribute('placeholder');
151
+
152
+ if (!el.value || el.value === text) {
153
+ el.value = text;
154
+ dojo.addClass(el, 'placeholder_text');
155
+ }
156
+ });
157
+ }
158
+ }
159
+ };
160
+ // Alias window, document.
161
+ })(this, this.document);
162
+
163
+ // Automatically calls all functions in FORMALIZE.init
164
+ dojo.addOnLoad(function() {
165
+ FORMALIZE.go();
166
+ });
@@ -0,0 +1 @@
1
+ var FORMALIZE=function(a,b,c){var d="placeholder"in b.createElement("input"),e="autofocus"in b.createElement("input"),f=parseInt(dojo.isIE,10)===6,g=parseInt(dojo.isIE,10)===7;return{go:function(){for(var a in FORMALIZE.init)FORMALIZE.init[a]()},init:{full_input_size:function(){!!g&&!!dojo.query("textarea, input.input_full").length&&dojo.query("textarea, input.input_full").forEach(function(a){var c=a.cloneNode(!1),d=b.createElement("span");d.className="input_full_wrap",d.appendChild(c),a.parentNode.replaceChild(d,a)})},ie6_skin_inputs:function(){if(!!f&&!!dojo.query("input, select, textarea").length){var a=/button|submit|reset/,b=/date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;dojo.query("input").forEach(function(c){c.getAttribute("type").match(a)?(dojo.addClass(c,"ie6_button"),c.disabled&&dojo.addClass(c,"ie6_button_disabled")):c.getAttribute("type").match(b)&&(dojo.addClass(c,"ie6_input"),c.disabled&&dojo.addClass(c,"ie6_input_disabled"))}),dojo.query("textarea, select").forEach(function(a){a.disabled&&dojo.addClass(a,"ie6_input_disabled")})}},autofocus:function(){!e&&!!dojo.query("[autofocus]").length&&dojo.query("[autofocus]")[0].focus()},placeholder:function(){!d&&!!dojo.query("[placeholder]").length&&(FORMALIZE.misc.add_placeholder(),dojo.query("[placeholder]").forEach(function(a){dojo.connect(a,"onfocus",function(){var b=a.getAttribute("placeholder");a.value===b&&(a.value="",dojo.removeClass(a,"placeholder_text"))}),dojo.connect(a,"onblur",function(){FORMALIZE.misc.add_placeholder()})}),dojo.query("form").forEach(function(a){dojo.connect(a,"onsubmit",function(){dojo.query("[placeholder]",a).forEach(function(a){var b=a.getAttribute("placeholder");a.value===b&&(a.value="",dojo.removeClass(a,"placeholder_text"))})}),dojo.connect(a,"onreset",function(){setTimeout(FORMALIZE.misc.add_placeholder,50)})}))}},misc:{add_placeholder:function(){!d&&!!dojo.query("[placeholder]").length&&dojo.query("[placeholder]").forEach(function(a){var b=a.getAttribute("placeholder");if(!a.value||a.value===b)a.value=b,dojo.addClass(a,"placeholder_text")})}}}}(this,this.document);dojo.addOnLoad(function(){FORMALIZE.go()})
@@ -0,0 +1,163 @@
1
+ /*
2
+ Formalize - version 1.1
3
+
4
+ Note: This file depends on the ExtJS 3.x library.
5
+ */
6
+
7
+ // Module pattern:
8
+ // http://yuiblog.com/blog/2007/06/12/module-pattern
9
+ var FORMALIZE = (function(window, document, undefined) {
10
+ // Private constants.
11
+ var PLACEHOLDER_SUPPORTED = 'placeholder' in document.createElement('input');
12
+ var AUTOFOCUS_SUPPORTED = 'autofocus' in document.createElement('input');
13
+ var IE6 = Ext.isIE6;
14
+ var IE7 = Ext.isIE7;
15
+
16
+ // Expose innards of FORMALIZE.
17
+ return {
18
+ // FORMALIZE.go
19
+ go: function() {
20
+ for (var i in FORMALIZE.init) {
21
+ FORMALIZE.init[i]();
22
+ }
23
+ },
24
+ // FORMALIZE.init
25
+ init: {
26
+ // FORMALIZE.init.full_input_size
27
+ full_input_size: function() {
28
+ if (!IE7 || !Ext.query('textarea, input.input_full')) {
29
+ return;
30
+ }
31
+
32
+ // This fixes width: 100% on <textarea> and class="input_full".
33
+ // It ensures that form elements don't go wider than container.
34
+ Ext.each(Ext.query('textarea, input.input_full'), function(el) {
35
+ Ext.get(el).wrap('<span class="input_full_wrap"></span>');
36
+ });
37
+ },
38
+ // FORMALIZE.init.ie6_skin_inputs
39
+ ie6_skin_inputs: function() {
40
+ // Test for Internet Explorer 6.
41
+ if (!IE6 || !Ext.query('input, select, textarea')) {
42
+ // Exit if the browser is not IE6,
43
+ // or if no form elements exist.
44
+ return;
45
+ }
46
+
47
+ // For <input type="submit" />, etc.
48
+ var button_regex = /button|submit|reset/;
49
+
50
+ // For <input type="text" />, etc.
51
+ var type_regex = /date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;
52
+
53
+ Ext.each(Ext.query('input'), function(el) {
54
+ // Is it a button?
55
+ if (el.getAttribute('type').match(button_regex)) {
56
+ Ext.get(el).addClass('ie6_button');
57
+
58
+ /* Is it disabled? */
59
+ if (el.disabled) {
60
+ Ext.get(el).addClass('ie6_button_disabled');
61
+ }
62
+ }
63
+ // Or is it a textual input?
64
+ else if (el.getAttribute('type').match(type_regex)) {
65
+ Ext.get(el).addClass('ie6_input');
66
+
67
+ /* Is it disabled? */
68
+ if (el.disabled) {
69
+ Ext.get(el).addClass('ie6_input_disabled');
70
+ }
71
+ }
72
+ });
73
+
74
+ Ext.each(Ext.query('textarea, select'), function(el) {
75
+ /* Is it disabled? */
76
+ if (el.disabled) {
77
+ Ext.get(el).addClass('ie6_input_disabled');
78
+ }
79
+ });
80
+ },
81
+ // FORMALIZE.init.autofocus
82
+ autofocus: function() {
83
+ if (AUTOFOCUS_SUPPORTED || !Ext.query('[autofocus]')) {
84
+ return;
85
+ }
86
+
87
+ Ext.query('[autofocus]')[0].focus();
88
+ },
89
+ // FORMALIZE.init.placeholder
90
+ placeholder: function() {
91
+ if (PLACEHOLDER_SUPPORTED || !Ext.query('[placeholder]')) {
92
+ // Exit if placeholder is supported natively,
93
+ // or if page does not have any placeholder.
94
+ return;
95
+ }
96
+
97
+ FORMALIZE.misc.add_placeholder();
98
+
99
+ Ext.each(Ext.query('[placeholder]'), function(el) {
100
+ var text = el.getAttribute('placeholder');
101
+ var form = Ext.get(el).parent('form');
102
+
103
+ function add_placeholder() {
104
+ if (!el.value || el.value === text) {
105
+ el.value = text;
106
+ Ext.get(el).addClass('placeholder_text');
107
+ }
108
+ }
109
+
110
+ Ext.get(el).on('focus', function() {
111
+ if (el.value === text) {
112
+ el.value = '';
113
+ Ext.get(el).removeClass('placeholder_text');
114
+ }
115
+ });
116
+
117
+ Ext.get(el).on('blur', function() {
118
+ FORMALIZE.misc.add_placeholder();
119
+ });
120
+
121
+ // Prevent <form> from accidentally
122
+ // submitting the placeholder text.
123
+ form.on('submit', function() {
124
+ if (el.value === text) {
125
+ el.value = '';
126
+ Ext.get(el).removeClass('placeholder_text');
127
+ }
128
+ });
129
+
130
+ form.on('reset', function() {
131
+ setTimeout(FORMALIZE.misc.add_placeholder, 50);
132
+ });
133
+ });
134
+ }
135
+ },
136
+ // FORMALIZE.misc
137
+ misc: {
138
+ // FORMALIZE.misc.add_placeholder
139
+ add_placeholder: function() {
140
+ if (PLACEHOLDER_SUPPORTED || !Ext.query('[placeholder]')) {
141
+ // Exit if placeholder is supported natively,
142
+ // or if page does not have any placeholder.
143
+ return;
144
+ }
145
+
146
+ Ext.each(Ext.query('[placeholder]'), function(el) {
147
+ var text = el.getAttribute('placeholder');
148
+
149
+ if (!el.value || el.value === text) {
150
+ el.value = text;
151
+ Ext.get(el).addClass('placeholder_text');
152
+ }
153
+ });
154
+ }
155
+ }
156
+ };
157
+ // Alias window, document.
158
+ })(this, this.document);
159
+
160
+ // Automatically calls all functions in FORMALIZE.init
161
+ Ext.onReady(function() {
162
+ FORMALIZE.go();
163
+ });
@@ -0,0 +1 @@
1
+ var FORMALIZE=function(a,b,c){var d="placeholder"in b.createElement("input"),e="autofocus"in b.createElement("input"),f=Ext.isIE6,g=Ext.isIE7;return{go:function(){for(var a in FORMALIZE.init)FORMALIZE.init[a]()},init:{full_input_size:function(){!!g&&!!Ext.query("textarea, input.input_full")&&Ext.each(Ext.query("textarea, input.input_full"),function(a){Ext.get(a).wrap('<span class="input_full_wrap"></span>')})},ie6_skin_inputs:function(){if(!!f&&!!Ext.query("input, select, textarea")){var a=/button|submit|reset/,b=/date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;Ext.each(Ext.query("input"),function(c){c.getAttribute("type").match(a)?(Ext.get(c).addClass("ie6_button"),c.disabled&&Ext.get(c).addClass("ie6_button_disabled")):c.getAttribute("type").match(b)&&(Ext.get(c).addClass("ie6_input"),c.disabled&&Ext.get(c).addClass("ie6_input_disabled"))}),Ext.each(Ext.query("textarea, select"),function(a){a.disabled&&Ext.get(a).addClass("ie6_input_disabled")})}},autofocus:function(){!e&&!!Ext.query("[autofocus]")&&Ext.query("[autofocus]")[0].focus()},placeholder:function(){!d&&!!Ext.query("[placeholder]")&&(FORMALIZE.misc.add_placeholder(),Ext.each(Ext.query("[placeholder]"),function(a){function d(){if(!a.value||a.value===b)a.value=b,Ext.get(a).addClass("placeholder_text")}var b=a.getAttribute("placeholder"),c=Ext.get(a).parent("form");Ext.get(a).on("focus",function(){a.value===b&&(a.value="",Ext.get(a).removeClass("placeholder_text"))}),Ext.get(a).on("blur",function(){FORMALIZE.misc.add_placeholder()}),c.on("submit",function(){a.value===b&&(a.value="",Ext.get(a).removeClass("placeholder_text"))}),c.on("reset",function(){setTimeout(FORMALIZE.misc.add_placeholder,50)})}))}},misc:{add_placeholder:function(){!d&&!!Ext.query("[placeholder]")&&Ext.each(Ext.query("[placeholder]"),function(a){var b=a.getAttribute("placeholder");if(!a.value||a.value===b)a.value=b,Ext.get(a).addClass("placeholder_text")})}}}}(this,this.document);Ext.onReady(function(){FORMALIZE.go()})
@@ -0,0 +1,150 @@
1
+ /*
2
+ Formalize - version 1.1
3
+
4
+ Note: This file depends on the jQuery library.
5
+ */
6
+
7
+ // Module pattern:
8
+ // http://yuiblog.com/blog/2007/06/12/module-pattern
9
+ var FORMALIZE = (function($, window, document, undefined) {
10
+ // Private constants.
11
+ var PLACEHOLDER_SUPPORTED = 'placeholder' in document.createElement('input');
12
+ var AUTOFOCUS_SUPPORTED = 'autofocus' in document.createElement('input');
13
+ var IE6 = !!($.browser.msie && parseInt($.browser.version, 10) === 6);
14
+ var IE7 = !!($.browser.msie && parseInt($.browser.version, 10) === 7);
15
+
16
+ // Expose innards of FORMALIZE.
17
+ return {
18
+ // FORMALIZE.go
19
+ go: function() {
20
+ for (var i in FORMALIZE.init) {
21
+ FORMALIZE.init[i]();
22
+ }
23
+ },
24
+ // FORMALIZE.init
25
+ init: {
26
+ // FORMALIZE.init.full_input_size
27
+ full_input_size: function() {
28
+ if (!IE7 || !$('textarea, input.input_full').length) {
29
+ return;
30
+ }
31
+
32
+ // This fixes width: 100% on <textarea> and class="input_full".
33
+ // It ensures that form elements don't go wider than container.
34
+ $('textarea, input.input_full').wrap('<span class="input_full_wrap"></span>');
35
+ },
36
+ // FORMALIZE.init.ie6_skin_inputs
37
+ ie6_skin_inputs: function() {
38
+ // Test for Internet Explorer 6.
39
+ if (!IE6 || !$('input, select, textarea').length) {
40
+ // Exit if the browser is not IE6,
41
+ // or if no form elements exist.
42
+ return;
43
+ }
44
+
45
+ // For <input type="submit" />, etc.
46
+ var button_regex = /button|submit|reset/;
47
+
48
+ // For <input type="text" />, etc.
49
+ var type_regex = /date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;
50
+
51
+ $('input').each(function() {
52
+ var el = $(this);
53
+
54
+ // Is it a button?
55
+ if (this.getAttribute('type').match(button_regex)) {
56
+ el.addClass('ie6_button');
57
+
58
+ /* Is it disabled? */
59
+ if (this.disabled) {
60
+ el.addClass('ie6_button_disabled');
61
+ }
62
+ }
63
+ // Or is it a textual input?
64
+ else if (this.getAttribute('type').match(type_regex)) {
65
+ el.addClass('ie6_input');
66
+
67
+ /* Is it disabled? */
68
+ if (this.disabled) {
69
+ el.addClass('ie6_input_disabled');
70
+ }
71
+ }
72
+ });
73
+
74
+ $('textarea, select').each(function() {
75
+ /* Is it disabled? */
76
+ if (this.disabled) {
77
+ $(this).addClass('ie6_input_disabled');
78
+ }
79
+ });
80
+ },
81
+ // FORMALIZE.init.autofocus
82
+ autofocus: function() {
83
+ if (AUTOFOCUS_SUPPORTED || !$(':input[autofocus]').length) {
84
+ return;
85
+ }
86
+
87
+ $(':input[autofocus]:visible:first').focus();
88
+ },
89
+ // FORMALIZE.init.placeholder
90
+ placeholder: function() {
91
+ if (PLACEHOLDER_SUPPORTED || !$(':input[placeholder]').length) {
92
+ // Exit if placeholder is supported natively,
93
+ // or if page does not have any placeholder.
94
+ return;
95
+ }
96
+
97
+ FORMALIZE.misc.add_placeholder();
98
+
99
+ $(':input[placeholder]').each(function() {
100
+ var el = $(this);
101
+ var text = el.attr('placeholder');
102
+
103
+ el.focus(function() {
104
+ if (el.val() === text) {
105
+ el.val('').removeClass('placeholder_text');
106
+ }
107
+ }).blur(function() {
108
+ FORMALIZE.misc.add_placeholder();
109
+ });
110
+
111
+ // Prevent <form> from accidentally
112
+ // submitting the placeholder text.
113
+ el.closest('form').submit(function() {
114
+ if (el.val() === text) {
115
+ el.val('').removeClass('placeholder_text');
116
+ }
117
+ }).bind('reset', function() {
118
+ setTimeout(FORMALIZE.misc.add_placeholder, 50);
119
+ });
120
+ });
121
+ }
122
+ },
123
+ // FORMALIZE.misc
124
+ misc: {
125
+ // FORMALIZE.misc.add_placeholder
126
+ add_placeholder: function() {
127
+ if (PLACEHOLDER_SUPPORTED || !$(':input[placeholder]').length) {
128
+ // Exit if placeholder is supported natively,
129
+ // or if page does not have any placeholder.
130
+ return;
131
+ }
132
+
133
+ $(':input[placeholder]').each(function() {
134
+ var el = $(this);
135
+ var text = el.attr('placeholder');
136
+
137
+ if (!el.val() || el.val() === text) {
138
+ el.val(text).addClass('placeholder_text');
139
+ }
140
+ });
141
+ }
142
+ }
143
+ };
144
+ // Alias jQuery, window, document.
145
+ })(jQuery, this, this.document);
146
+
147
+ // Automatically calls all functions in FORMALIZE.init
148
+ jQuery(document).ready(function() {
149
+ FORMALIZE.go();
150
+ });
@@ -0,0 +1 @@
1
+ var FORMALIZE=function(a,b,c,d){var e="placeholder"in c.createElement("input"),f="autofocus"in c.createElement("input"),g=!!a.browser.msie&&parseInt(a.browser.version,10)===6,h=!!a.browser.msie&&parseInt(a.browser.version,10)===7;return{go:function(){for(var a in FORMALIZE.init)FORMALIZE.init[a]()},init:{full_input_size:function(){!!h&&!!a("textarea, input.input_full").length&&a("textarea, input.input_full").wrap('<span class="input_full_wrap"></span>')},ie6_skin_inputs:function(){if(!!g&&!!a("input, select, textarea").length){var b=/button|submit|reset/,c=/date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;a("input").each(function(){var d=a(this);this.getAttribute("type").match(b)?(d.addClass("ie6_button"),this.disabled&&d.addClass("ie6_button_disabled")):this.getAttribute("type").match(c)&&(d.addClass("ie6_input"),this.disabled&&d.addClass("ie6_input_disabled"))}),a("textarea, select").each(function(){this.disabled&&a(this).addClass("ie6_input_disabled")})}},autofocus:function(){!f&&!!a(":input[autofocus]").length&&a(":input[autofocus]:visible:first").focus()},placeholder:function(){!e&&!!a(":input[placeholder]").length&&(FORMALIZE.misc.add_placeholder(),a(":input[placeholder]").each(function(){var b=a(this),c=b.attr("placeholder");b.focus(function(){b.val()===c&&b.val("").removeClass("placeholder_text")}).blur(function(){FORMALIZE.misc.add_placeholder()}),b.closest("form").submit(function(){b.val()===c&&b.val("").removeClass("placeholder_text")}).bind("reset",function(){setTimeout(FORMALIZE.misc.add_placeholder,50)})}))}},misc:{add_placeholder:function(){!e&&!!a(":input[placeholder]").length&&a(":input[placeholder]").each(function(){var b=a(this),c=b.attr("placeholder");(!b.val()||b.val()===c)&&b.val(c).addClass("placeholder_text")})}}}}(jQuery,this,this.document);jQuery(document).ready(function(){FORMALIZE.go()})