compass_formalize 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.DS_Store +0 -0
- data/.gitignore +2 -0
- data/README.md +6 -0
- data/Rakefile +4 -0
- data/compass_formalize.gemspec +20 -0
- data/lib/compass_formalize.rb +2 -0
- data/stylesheets/_formalize.sass +271 -0
- data/templates/.DS_Store +0 -0
- data/templates/dojo/button.png +0 -0
- data/templates/dojo/dojo.formalize.js +174 -0
- data/templates/dojo/dojo.formalize.min.js +1 -0
- data/templates/dojo/manifest.rb +37 -0
- data/templates/dojo/select_arrow.gif +0 -0
- data/templates/extjs/.DS_Store +0 -0
- data/templates/extjs/button.png +0 -0
- data/templates/extjs/extjs.formalize.js +168 -0
- data/templates/extjs/extjs.formalize.min.js +1 -0
- data/templates/extjs/manifest.rb +37 -0
- data/templates/extjs/select_arrow.gif +0 -0
- data/templates/jquery/.DS_Store +0 -0
- data/templates/jquery/button.png +0 -0
- data/templates/jquery/jquery.formalize.js +158 -0
- data/templates/jquery/jquery.formalize.min.js +1 -0
- data/templates/jquery/manifest.rb +37 -0
- data/templates/jquery/select_arrow.gif +0 -0
- data/templates/mootools/.DS_Store +0 -0
- data/templates/mootools/button.png +0 -0
- data/templates/mootools/manifest.rb +37 -0
- data/templates/mootools/mootools.formalize.js +163 -0
- data/templates/mootools/mootools.formalize.min.js +1 -0
- data/templates/mootools/select_arrow.gif +0 -0
- data/templates/project/manifest.rb +18 -0
- data/templates/prototype/.DS_Store +0 -0
- data/templates/prototype/button.png +0 -0
- data/templates/prototype/manifest.rb +37 -0
- data/templates/prototype/prototype.formalize.js +171 -0
- data/templates/prototype/prototype.formalize.min.js +1 -0
- data/templates/prototype/select_arrow.gif +0 -0
- data/templates/yui/.DS_Store +0 -0
- data/templates/yui/button.png +0 -0
- data/templates/yui/manifest.rb +37 -0
- data/templates/yui/select_arrow.gif +0 -0
- data/templates/yui/yui.formalize.js +168 -0
- data/templates/yui/yui.formalize.min.js +1 -0
- metadata +130 -0
@@ -0,0 +1 @@
|
|
1
|
+
var FORMALIZE=(function(f,b,g){var e="placeholder" in b.createElement("input");var c="autofocus" in b.createElement("input");var d="webkitAppearance" in b.createElement("select").style;var a=parseInt(dojo.isIE,10)===6;var h=parseInt(dojo.isIE,10)===7;return{go:function(){for(var j in FORMALIZE.init){FORMALIZE.init[j]();}},init:{detect_webkit:function(){if(!d){return;}dojo.query("html").addClass("is_webkit");},full_input_size:function(){if(!h||!dojo.query("textarea, input.input_full").length){return;}dojo.query("textarea, input.input_full").forEach(function(j){var k=j.cloneNode(false);var i=b.createElement("span");i.className="input_full_wrap";i.appendChild(k);j.parentNode.replaceChild(i,j);});},ie6_skin_inputs:function(){if(!a||!dojo.query("input, select, textarea").length){return;}var i=/button|submit|reset/;var j=/date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;dojo.query("input").forEach(function(k){if(k.getAttribute("type").match(i)){dojo.addClass(k,"ie6_button");if(k.disabled){dojo.addClass(k,"ie6_button_disabled");}}else{if(k.getAttribute("type").match(j)){dojo.addClass(k,"ie6_input");if(k.disabled){dojo.addClass(k,"ie6_input_disabled");}}}});dojo.query("textarea, select").forEach(function(k){if(k.disabled){dojo.addClass(k,"ie6_input_disabled");}});},autofocus:function(){if(c||!dojo.query("[autofocus]").length){return;}dojo.query("[autofocus]")[0].focus();},placeholder:function(){if(e||!dojo.query("[placeholder]").length){return;}FORMALIZE.misc.add_placeholder();dojo.query("[placeholder]").forEach(function(i){dojo.connect(i,"onfocus",function(){var j=i.getAttribute("placeholder");if(i.value===j){i.value="";dojo.removeClass(i,"placeholder_text");}});dojo.connect(i,"onblur",function(){FORMALIZE.misc.add_placeholder();});});dojo.query("form").forEach(function(i){dojo.connect(i,"onsubmit",function(){dojo.query("[placeholder]",i).forEach(function(j){var k=j.getAttribute("placeholder");if(j.value===k){j.value="";dojo.removeClass(j,"placeholder_text");}});});dojo.connect(i,"onreset",function(){setTimeout(FORMALIZE.misc.add_placeholder,50);});});}},misc:{add_placeholder:function(){if(e||!dojo.query("[placeholder]").length){return;}dojo.query("[placeholder]").forEach(function(i){var j=i.getAttribute("placeholder");if(!i.value||i.value===j){i.value=j;dojo.addClass(i,"placeholder_text");}});}}};})(this,this.document);dojo.addOnLoad(function(){FORMALIZE.go();});
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# Make sure you list all the project template files here in the manifest.
|
2
|
+
discover :all
|
3
|
+
|
4
|
+
description "Teach your forms some manners."
|
5
|
+
|
6
|
+
help %Q{
|
7
|
+
Please see the Formalize website for documentation:
|
8
|
+
|
9
|
+
http://formalize.me/
|
10
|
+
}
|
11
|
+
|
12
|
+
welcome_message %Q{
|
13
|
+
|
14
|
+
Formalize assets have been copied to the proper asset folders
|
15
|
+
based on your Compass configuration.
|
16
|
+
|
17
|
+
Usage:
|
18
|
+
|
19
|
+
If you're using SCSS syntax, in your stylesheet:
|
20
|
+
|
21
|
+
@import "formalize";
|
22
|
+
|
23
|
+
or if you're using indented syntax
|
24
|
+
|
25
|
+
@import "formalize"
|
26
|
+
|
27
|
+
In your HTML markup, include the JavaScript implementation of
|
28
|
+
your choice:
|
29
|
+
|
30
|
+
// a jQuery example
|
31
|
+
<script src="/javascripts/jquery.formalize.js"></script>
|
32
|
+
|
33
|
+
Please see the Formalize website for documentation:
|
34
|
+
|
35
|
+
http://formalize.me/
|
36
|
+
}
|
37
|
+
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,168 @@
|
|
1
|
+
//
|
2
|
+
// Note: This file depends on the ExtJS 3.x library.
|
3
|
+
//
|
4
|
+
var FORMALIZE = (function(window, document, undefined) {
|
5
|
+
// Private constants.
|
6
|
+
var PLACEHOLDER_SUPPORTED = 'placeholder' in document.createElement('input');
|
7
|
+
var AUTOFOCUS_SUPPORTED = 'autofocus' in document.createElement('input');
|
8
|
+
var WEBKIT = 'webkitAppearance' in document.createElement('select').style;
|
9
|
+
var IE6 = Ext.isIE6;
|
10
|
+
var IE7 = Ext.isIE7;
|
11
|
+
|
12
|
+
// Expose innards of FORMALIZE.
|
13
|
+
return {
|
14
|
+
// FORMALIZE.go
|
15
|
+
go: function() {
|
16
|
+
for (var i in FORMALIZE.init) {
|
17
|
+
FORMALIZE.init[i]();
|
18
|
+
}
|
19
|
+
},
|
20
|
+
// FORMALIZE.init
|
21
|
+
init: {
|
22
|
+
// FORMALIZE.init.detect_webkit
|
23
|
+
detect_webkit: function() {
|
24
|
+
if (!WEBKIT) {
|
25
|
+
return;
|
26
|
+
}
|
27
|
+
|
28
|
+
// Tweaks for Safari + Chrome.
|
29
|
+
Ext.get(Ext.query('html')).addClass('is_webkit');
|
30
|
+
},
|
31
|
+
// FORMALIZE.init.full_input_size
|
32
|
+
full_input_size: function() {
|
33
|
+
if (!IE7 || !Ext.query('textarea, input.input_full')) {
|
34
|
+
return;
|
35
|
+
}
|
36
|
+
|
37
|
+
// This fixes width: 100% on <textarea> and class="input_full".
|
38
|
+
// It ensures that form elements don't go wider than container.
|
39
|
+
Ext.each(Ext.query('textarea, input.input_full'), function(el) {
|
40
|
+
Ext.get(el).wrap('<span class="input_full_wrap"></span>');
|
41
|
+
});
|
42
|
+
},
|
43
|
+
// FORMALIZE.init.ie6_skin_inputs
|
44
|
+
ie6_skin_inputs: function() {
|
45
|
+
// Test for Internet Explorer 6.
|
46
|
+
if (!IE6 || !Ext.query('input, select, textarea')) {
|
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
|
+
Ext.each(Ext.query('input'), function(el) {
|
59
|
+
// Is it a button?
|
60
|
+
if (el.getAttribute('type').match(button_regex)) {
|
61
|
+
Ext.get(el).addClass('ie6_button');
|
62
|
+
|
63
|
+
/* Is it disabled? */
|
64
|
+
if (el.disabled) {
|
65
|
+
Ext.get(el).addClass('ie6_button_disabled');
|
66
|
+
}
|
67
|
+
}
|
68
|
+
// Or is it a textual input?
|
69
|
+
else if (el.getAttribute('type').match(type_regex)) {
|
70
|
+
Ext.get(el).addClass('ie6_input');
|
71
|
+
|
72
|
+
/* Is it disabled? */
|
73
|
+
if (el.disabled) {
|
74
|
+
Ext.get(el).addClass('ie6_input_disabled');
|
75
|
+
}
|
76
|
+
}
|
77
|
+
});
|
78
|
+
|
79
|
+
Ext.each(Ext.query('textarea, select'), function(el) {
|
80
|
+
/* Is it disabled? */
|
81
|
+
if (el.disabled) {
|
82
|
+
Ext.get(el).addClass('ie6_input_disabled');
|
83
|
+
}
|
84
|
+
});
|
85
|
+
},
|
86
|
+
// FORMALIZE.init.autofocus
|
87
|
+
autofocus: function() {
|
88
|
+
if (AUTOFOCUS_SUPPORTED || !Ext.query('[autofocus]')) {
|
89
|
+
return;
|
90
|
+
}
|
91
|
+
|
92
|
+
Ext.query('[autofocus]')[0].focus();
|
93
|
+
},
|
94
|
+
// FORMALIZE.init.placeholder
|
95
|
+
placeholder: function() {
|
96
|
+
if (PLACEHOLDER_SUPPORTED || !Ext.query('[placeholder]')) {
|
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
|
+
Ext.each(Ext.query('[placeholder]'), function(el) {
|
105
|
+
var text = el.getAttribute('placeholder');
|
106
|
+
var form = Ext.get(el).parent('form');
|
107
|
+
|
108
|
+
function add_placeholder() {
|
109
|
+
if (!el.value || el.value === text) {
|
110
|
+
el.value = text;
|
111
|
+
Ext.get(el).addClass('placeholder_text');
|
112
|
+
}
|
113
|
+
}
|
114
|
+
|
115
|
+
Ext.get(el).on('focus', function() {
|
116
|
+
if (el.value === text) {
|
117
|
+
el.value = '';
|
118
|
+
Ext.get(el).removeClass('placeholder_text');
|
119
|
+
}
|
120
|
+
});
|
121
|
+
|
122
|
+
Ext.get(el).on('blur', function() {
|
123
|
+
FORMALIZE.misc.add_placeholder();
|
124
|
+
});
|
125
|
+
|
126
|
+
// Prevent <form> from accidentally
|
127
|
+
// submitting the placeholder text.
|
128
|
+
form.on('submit', function() {
|
129
|
+
if (el.value === text) {
|
130
|
+
el.value = '';
|
131
|
+
Ext.get(el).removeClass('placeholder_text');
|
132
|
+
}
|
133
|
+
});
|
134
|
+
|
135
|
+
form.on('reset', function() {
|
136
|
+
setTimeout(FORMALIZE.misc.add_placeholder, 50);
|
137
|
+
});
|
138
|
+
});
|
139
|
+
}
|
140
|
+
},
|
141
|
+
// FORMALIZE.misc
|
142
|
+
misc: {
|
143
|
+
// FORMALIZE.misc.add_placeholder
|
144
|
+
add_placeholder: function() {
|
145
|
+
if (PLACEHOLDER_SUPPORTED || !Ext.query('[placeholder]')) {
|
146
|
+
// Exit if placeholder is supported natively,
|
147
|
+
// or if page does not have any placeholder.
|
148
|
+
return;
|
149
|
+
}
|
150
|
+
|
151
|
+
Ext.each(Ext.query('[placeholder]'), function(el) {
|
152
|
+
var text = el.getAttribute('placeholder');
|
153
|
+
|
154
|
+
if (!el.value || el.value === text) {
|
155
|
+
el.value = text;
|
156
|
+
Ext.get(el).addClass('placeholder_text');
|
157
|
+
}
|
158
|
+
});
|
159
|
+
}
|
160
|
+
}
|
161
|
+
};
|
162
|
+
// Alias window, document.
|
163
|
+
})(this, this.document);
|
164
|
+
|
165
|
+
// Automatically calls all functions in FORMALIZE.init
|
166
|
+
Ext.onReady(function() {
|
167
|
+
FORMALIZE.go();
|
168
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
var FORMALIZE=(function(f,b,g){var e="placeholder" in b.createElement("input");var c="autofocus" in b.createElement("input");var d="webkitAppearance" in b.createElement("select").style;var a=Ext.isIE6;var h=Ext.isIE7;return{go:function(){for(var j in FORMALIZE.init){FORMALIZE.init[j]();}},init:{detect_webkit:function(){if(!d){return;}Ext.get(Ext.query("html")).addClass("is_webkit");},full_input_size:function(){if(!h||!Ext.query("textarea, input.input_full")){return;}Ext.each(Ext.query("textarea, input.input_full"),function(i){Ext.get(i).wrap('<span class="input_full_wrap"></span>');});},ie6_skin_inputs:function(){if(!a||!Ext.query("input, select, textarea")){return;}var i=/button|submit|reset/;var j=/date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;Ext.each(Ext.query("input"),function(k){if(k.getAttribute("type").match(i)){Ext.get(k).addClass("ie6_button");if(k.disabled){Ext.get(k).addClass("ie6_button_disabled");}}else{if(k.getAttribute("type").match(j)){Ext.get(k).addClass("ie6_input");if(k.disabled){Ext.get(k).addClass("ie6_input_disabled");}}}});Ext.each(Ext.query("textarea, select"),function(k){if(k.disabled){Ext.get(k).addClass("ie6_input_disabled");}});},autofocus:function(){if(c||!Ext.query("[autofocus]")){return;}Ext.query("[autofocus]")[0].focus();},placeholder:function(){if(e||!Ext.query("[placeholder]")){return;}FORMALIZE.misc.add_placeholder();Ext.each(Ext.query("[placeholder]"),function(j){var l=j.getAttribute("placeholder");var k=Ext.get(j).parent("form");function i(){if(!j.value||j.value===l){j.value=l;Ext.get(j).addClass("placeholder_text");}}Ext.get(j).on("focus",function(){if(j.value===l){j.value="";Ext.get(j).removeClass("placeholder_text");}});Ext.get(j).on("blur",function(){FORMALIZE.misc.add_placeholder();});k.on("submit",function(){if(j.value===l){j.value="";Ext.get(j).removeClass("placeholder_text");}});k.on("reset",function(){setTimeout(FORMALIZE.misc.add_placeholder,50);});});}},misc:{add_placeholder:function(){if(e||!Ext.query("[placeholder]")){return;}Ext.each(Ext.query("[placeholder]"),function(i){var j=i.getAttribute("placeholder");if(!i.value||i.value===j){i.value=j;Ext.get(i).addClass("placeholder_text");}});}}};})(this,this.document);Ext.onReady(function(){FORMALIZE.go();});
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# Make sure you list all the project template files here in the manifest.
|
2
|
+
discover :all
|
3
|
+
|
4
|
+
description "Teach your forms some manners."
|
5
|
+
|
6
|
+
help %Q{
|
7
|
+
Please see the Formalize website for documentation:
|
8
|
+
|
9
|
+
http://formalize.me/
|
10
|
+
}
|
11
|
+
|
12
|
+
welcome_message %Q{
|
13
|
+
|
14
|
+
Formalize assets have been copied to the proper asset folders
|
15
|
+
based on your Compass configuration.
|
16
|
+
|
17
|
+
Usage:
|
18
|
+
|
19
|
+
If you're using SCSS syntax, in your stylesheet:
|
20
|
+
|
21
|
+
@import "formalize";
|
22
|
+
|
23
|
+
or if you're using indented syntax
|
24
|
+
|
25
|
+
@import "formalize"
|
26
|
+
|
27
|
+
In your HTML markup, include the JavaScript implementation of
|
28
|
+
your choice:
|
29
|
+
|
30
|
+
// a jQuery example
|
31
|
+
<script src="/javascripts/jquery.formalize.js"></script>
|
32
|
+
|
33
|
+
Please see the Formalize website for documentation:
|
34
|
+
|
35
|
+
http://formalize.me/
|
36
|
+
}
|
37
|
+
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,158 @@
|
|
1
|
+
//
|
2
|
+
// Note: This file depends on the jQuery library.
|
3
|
+
//
|
4
|
+
|
5
|
+
// Module pattern:
|
6
|
+
// http://yuiblog.com/blog/2007/06/12/module-pattern/
|
7
|
+
var FORMALIZE = (function($, window, document, undefined) {
|
8
|
+
// Private constants.
|
9
|
+
var PLACEHOLDER_SUPPORTED = 'placeholder' in document.createElement('input');
|
10
|
+
var AUTOFOCUS_SUPPORTED = 'autofocus' in document.createElement('input');
|
11
|
+
var WEBKIT = 'webkitAppearance' in document.createElement('select').style;
|
12
|
+
var IE6 = !!($.browser.msie && parseInt($.browser.version, 10) === 6);
|
13
|
+
var IE7 = !!($.browser.msie && parseInt($.browser.version, 10) === 7);
|
14
|
+
|
15
|
+
// Expose innards of FORMALIZE.
|
16
|
+
return {
|
17
|
+
// FORMALIZE.go
|
18
|
+
go: function() {
|
19
|
+
for (var i in FORMALIZE.init) {
|
20
|
+
FORMALIZE.init[i]();
|
21
|
+
}
|
22
|
+
},
|
23
|
+
// FORMALIZE.init
|
24
|
+
init: {
|
25
|
+
// FORMALIZE.init.detect_webkit
|
26
|
+
detect_webkit: function() {
|
27
|
+
if (!WEBKIT) {
|
28
|
+
return;
|
29
|
+
}
|
30
|
+
|
31
|
+
// Tweaks for Safari + Chrome.
|
32
|
+
$('html').addClass('is_webkit');
|
33
|
+
},
|
34
|
+
// FORMALIZE.init.full_input_size
|
35
|
+
full_input_size: function() {
|
36
|
+
if (!IE7 || !$('textarea, input.input_full').length) {
|
37
|
+
return;
|
38
|
+
}
|
39
|
+
|
40
|
+
// This fixes width: 100% on <textarea> and class="input_full".
|
41
|
+
// It ensures that form elements don't go wider than container.
|
42
|
+
$('textarea, input.input_full').wrap('<span class="input_full_wrap"></span>');
|
43
|
+
},
|
44
|
+
// FORMALIZE.init.ie6_skin_inputs
|
45
|
+
ie6_skin_inputs: function() {
|
46
|
+
// Test for Internet Explorer 6.
|
47
|
+
if (!IE6 || !$('input, select, textarea').length) {
|
48
|
+
// Exit if the browser is not IE6,
|
49
|
+
// or if no form elements exist.
|
50
|
+
return;
|
51
|
+
}
|
52
|
+
|
53
|
+
// For <input type="submit" />, etc.
|
54
|
+
var button_regex = /button|submit|reset/;
|
55
|
+
|
56
|
+
// For <input type="text" />, etc.
|
57
|
+
var type_regex = /date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;
|
58
|
+
|
59
|
+
$('input').each(function() {
|
60
|
+
var el = $(this);
|
61
|
+
|
62
|
+
// Is it a button?
|
63
|
+
if (this.getAttribute('type').match(button_regex)) {
|
64
|
+
el.addClass('ie6_button');
|
65
|
+
|
66
|
+
/* Is it disabled? */
|
67
|
+
if (this.disabled) {
|
68
|
+
el.addClass('ie6_button_disabled');
|
69
|
+
}
|
70
|
+
}
|
71
|
+
// Or is it a textual input?
|
72
|
+
else if (this.getAttribute('type').match(type_regex)) {
|
73
|
+
el.addClass('ie6_input');
|
74
|
+
|
75
|
+
/* Is it disabled? */
|
76
|
+
if (this.disabled) {
|
77
|
+
el.addClass('ie6_input_disabled');
|
78
|
+
}
|
79
|
+
}
|
80
|
+
});
|
81
|
+
|
82
|
+
$('textarea, select').each(function() {
|
83
|
+
/* Is it disabled? */
|
84
|
+
if (this.disabled) {
|
85
|
+
$(this).addClass('ie6_input_disabled');
|
86
|
+
}
|
87
|
+
});
|
88
|
+
},
|
89
|
+
// FORMALIZE.init.autofocus
|
90
|
+
autofocus: function() {
|
91
|
+
if (AUTOFOCUS_SUPPORTED || !$(':input[autofocus]').length) {
|
92
|
+
return;
|
93
|
+
}
|
94
|
+
|
95
|
+
$(':input[autofocus]:visible:first').focus();
|
96
|
+
},
|
97
|
+
// FORMALIZE.init.placeholder
|
98
|
+
placeholder: function() {
|
99
|
+
if (PLACEHOLDER_SUPPORTED || !$(':input[placeholder]').length) {
|
100
|
+
// Exit if placeholder is supported natively,
|
101
|
+
// or if page does not have any placeholder.
|
102
|
+
return;
|
103
|
+
}
|
104
|
+
|
105
|
+
FORMALIZE.misc.add_placeholder();
|
106
|
+
|
107
|
+
$(':input[placeholder]').each(function() {
|
108
|
+
var el = $(this);
|
109
|
+
var text = el.attr('placeholder');
|
110
|
+
|
111
|
+
el.focus(function() {
|
112
|
+
if (el.val() === text) {
|
113
|
+
el.val('').removeClass('placeholder_text');
|
114
|
+
}
|
115
|
+
}).blur(function() {
|
116
|
+
FORMALIZE.misc.add_placeholder();
|
117
|
+
});
|
118
|
+
|
119
|
+
// Prevent <form> from accidentally
|
120
|
+
// submitting the placeholder text.
|
121
|
+
el.closest('form').submit(function() {
|
122
|
+
if (el.val() === text) {
|
123
|
+
el.val('').removeClass('placeholder_text');
|
124
|
+
}
|
125
|
+
}).bind('reset', function() {
|
126
|
+
setTimeout(FORMALIZE.misc.add_placeholder, 50);
|
127
|
+
});
|
128
|
+
});
|
129
|
+
}
|
130
|
+
},
|
131
|
+
// FORMALIZE.misc
|
132
|
+
misc: {
|
133
|
+
// FORMALIZE.misc.add_placeholder
|
134
|
+
add_placeholder: function() {
|
135
|
+
if (PLACEHOLDER_SUPPORTED || !$(':input[placeholder]').length) {
|
136
|
+
// Exit if placeholder is supported natively,
|
137
|
+
// or if page does not have any placeholder.
|
138
|
+
return;
|
139
|
+
}
|
140
|
+
|
141
|
+
$(':input[placeholder]').each(function() {
|
142
|
+
var el = $(this);
|
143
|
+
var text = el.attr('placeholder');
|
144
|
+
|
145
|
+
if (!el.val() || el.val() === text) {
|
146
|
+
el.val(text).addClass('placeholder_text');
|
147
|
+
}
|
148
|
+
});
|
149
|
+
}
|
150
|
+
}
|
151
|
+
};
|
152
|
+
// Alias jQuery, window, document.
|
153
|
+
})(jQuery, this, this.document);
|
154
|
+
|
155
|
+
// Automatically calls all functions in FORMALIZE.init
|
156
|
+
jQuery(document).ready(function() {
|
157
|
+
FORMALIZE.go();
|
158
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
var FORMALIZE=(function(b,e,f,a){var h="placeholder" in f.createElement("input");var i="autofocus" in f.createElement("input");var g="webkitAppearance" in f.createElement("select").style;var d=!!(b.browser.msie&&parseInt(b.browser.version,10)===6);var c=!!(b.browser.msie&&parseInt(b.browser.version,10)===7);return{go:function(){for(var j in FORMALIZE.init){FORMALIZE.init[j]();}},init:{detect_webkit:function(){if(!g){return;}b("html").addClass("is_webkit");},full_input_size:function(){if(!c||!b("textarea, input.input_full").length){return;}b("textarea, input.input_full").wrap('<span class="input_full_wrap"></span>');},ie6_skin_inputs:function(){if(!d||!b("input, select, textarea").length){return;}var j=/button|submit|reset/;var k=/date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;b("input").each(function(){var l=b(this);if(this.getAttribute("type").match(j)){l.addClass("ie6_button");if(this.disabled){l.addClass("ie6_button_disabled");}}else{if(this.getAttribute("type").match(k)){l.addClass("ie6_input");if(this.disabled){l.addClass("ie6_input_disabled");}}}});b("textarea, select").each(function(){if(this.disabled){b(this).addClass("ie6_input_disabled");}});},autofocus:function(){if(i||!b(":input[autofocus]").length){return;}b(":input[autofocus]:visible:first").focus();},placeholder:function(){if(h||!b(":input[placeholder]").length){return;}FORMALIZE.misc.add_placeholder();b(":input[placeholder]").each(function(){var j=b(this);var k=j.attr("placeholder");j.focus(function(){if(j.val()===k){j.val("").removeClass("placeholder_text");}}).blur(function(){FORMALIZE.misc.add_placeholder();});j.closest("form").submit(function(){if(j.val()===k){j.val("").removeClass("placeholder_text");}}).bind("reset",function(){setTimeout(FORMALIZE.misc.add_placeholder,50);});});}},misc:{add_placeholder:function(){if(h||!b(":input[placeholder]").length){return;}b(":input[placeholder]").each(function(){var j=b(this);var k=j.attr("placeholder");if(!j.val()||j.val()===k){j.val(k).addClass("placeholder_text");}});}}};})(jQuery,this,this.document);jQuery(document).ready(function(){FORMALIZE.go();});
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# Make sure you list all the project template files here in the manifest.
|
2
|
+
discover :all
|
3
|
+
|
4
|
+
description "Teach your forms some manners."
|
5
|
+
|
6
|
+
help %Q{
|
7
|
+
Please see the Formalize website for documentation:
|
8
|
+
|
9
|
+
http://formalize.me/
|
10
|
+
}
|
11
|
+
|
12
|
+
welcome_message %Q{
|
13
|
+
|
14
|
+
Formalize assets have been copied to the proper asset folders
|
15
|
+
based on your Compass configuration.
|
16
|
+
|
17
|
+
Usage:
|
18
|
+
|
19
|
+
If you're using SCSS syntax, in your stylesheet:
|
20
|
+
|
21
|
+
@import "formalize";
|
22
|
+
|
23
|
+
or if you're using indented syntax
|
24
|
+
|
25
|
+
@import "formalize"
|
26
|
+
|
27
|
+
In your HTML markup, include the JavaScript implementation of
|
28
|
+
your choice:
|
29
|
+
|
30
|
+
// a jQuery example
|
31
|
+
<script src="/javascripts/jquery.formalize.js"></script>
|
32
|
+
|
33
|
+
Please see the Formalize website for documentation:
|
34
|
+
|
35
|
+
http://formalize.me/
|
36
|
+
}
|
37
|
+
|