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
data/.DS_Store
ADDED
Binary file
|
data/.gitignore
ADDED
data/README.md
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{compass_formalize}
|
5
|
+
s.version = "0.0.1"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.3.5")
|
8
|
+
s.authors = ["Wynn Netherland", "Nathan Smith"]
|
9
|
+
s.date = %q{2011-04-19}
|
10
|
+
s.description = %q{Compass and Sass port of Nathan Smith's Formalize HTML form normalizer.}
|
11
|
+
s.email = %w{wynn.netherland@gmail.com nathan@sonspring.com}
|
12
|
+
s.has_rdoc = false
|
13
|
+
s.files = `git ls-files`.split("\n")
|
14
|
+
s.homepage = %q{http://github.com/pengwynn/compass_formalize}
|
15
|
+
s.require_paths = ["lib"]
|
16
|
+
s.rubyforge_project = %q{compass-960-plugin}
|
17
|
+
s.rubygems_version = %q{1.3.6}
|
18
|
+
s.summary = %q{Compass compatible Sass port of Formalize.}
|
19
|
+
s.add_dependency(%q<compass>, [">= 0.10.0"])
|
20
|
+
end
|
@@ -0,0 +1,271 @@
|
|
1
|
+
// `Widths
|
2
|
+
//----------------------------------------------------------------------------------------------------
|
3
|
+
|
4
|
+
.input_tiny
|
5
|
+
width: 50px
|
6
|
+
|
7
|
+
.input_small
|
8
|
+
width: 100px
|
9
|
+
|
10
|
+
.input_medium
|
11
|
+
width: 150px
|
12
|
+
|
13
|
+
.input_large
|
14
|
+
width: 200px
|
15
|
+
|
16
|
+
.input_xlarge
|
17
|
+
width: 250px
|
18
|
+
|
19
|
+
.input_xxlarge
|
20
|
+
width: 300px
|
21
|
+
|
22
|
+
.input_full
|
23
|
+
width: 100%
|
24
|
+
|
25
|
+
// Added via JS to <textarea> and class="input-full".
|
26
|
+
// Applies only to IE7. Other browsers don't need it.
|
27
|
+
.input_full_wrap
|
28
|
+
display: block
|
29
|
+
padding-right: 8px
|
30
|
+
|
31
|
+
// `UI Consistency
|
32
|
+
//----------------------------------------------------------------------------------------------------
|
33
|
+
|
34
|
+
::-moz-focus-inner
|
35
|
+
border: 0
|
36
|
+
padding: 0
|
37
|
+
|
38
|
+
input[type="search"]::-webkit-search-decoration
|
39
|
+
display: none
|
40
|
+
|
41
|
+
input,
|
42
|
+
button,
|
43
|
+
select,
|
44
|
+
textarea
|
45
|
+
-moz-background-clip: padding
|
46
|
+
-webkit-background-clip: padding
|
47
|
+
background-clip: padding-box
|
48
|
+
margin: 0
|
49
|
+
vertical-align: middle
|
50
|
+
|
51
|
+
button,
|
52
|
+
input[type="reset"],
|
53
|
+
input[type="submit"],
|
54
|
+
input[type="button"]
|
55
|
+
-webkit-appearance: none
|
56
|
+
+border-radius(11px)
|
57
|
+
background: #ddd image-url(button.png) repeat-x
|
58
|
+
+linear-gradient(color-stops(#fff, #ddd))
|
59
|
+
border: 1px solid
|
60
|
+
border-color: #ddd #bbb #999
|
61
|
+
cursor: pointer
|
62
|
+
color: #333
|
63
|
+
font: bold 12px/1.2 Arial, sans-serif
|
64
|
+
outline: 0
|
65
|
+
overflow: visible
|
66
|
+
padding: 3px 10px 4px
|
67
|
+
text-shadow: #fff 0 1px 1px
|
68
|
+
width: auto
|
69
|
+
|
70
|
+
// IE7
|
71
|
+
*padding-top: 2px
|
72
|
+
*padding-bottom: 0px
|
73
|
+
|
74
|
+
button
|
75
|
+
// IE7
|
76
|
+
*padding-top: 1px
|
77
|
+
*padding-bottom: 1px
|
78
|
+
|
79
|
+
textarea,
|
80
|
+
select,
|
81
|
+
input[type="date"],
|
82
|
+
input[type="datetime"],
|
83
|
+
input[type="datetime-local"],
|
84
|
+
input[type="email"],
|
85
|
+
input[type="month"],
|
86
|
+
input[type="number"],
|
87
|
+
input[type="password"],
|
88
|
+
input[type="search"],
|
89
|
+
input[type="tel"],
|
90
|
+
input[type="text"],
|
91
|
+
input[type="time"],
|
92
|
+
input[type="url"],
|
93
|
+
input[type="week"]
|
94
|
+
-webkit-appearance: none
|
95
|
+
+border-radius(0)
|
96
|
+
+box-sizing(border-box)
|
97
|
+
background-color: #fff
|
98
|
+
border: 1px solid
|
99
|
+
border-color: #848484 #c1c1c1 #e1e1e1
|
100
|
+
color: #000
|
101
|
+
outline: 0
|
102
|
+
padding: 2px 3px
|
103
|
+
font:
|
104
|
+
size: 13px
|
105
|
+
family: Arial, sans-serif
|
106
|
+
height: 1.8em
|
107
|
+
|
108
|
+
// IE7
|
109
|
+
*padding-top: 2px
|
110
|
+
*padding-bottom: 1px
|
111
|
+
*height: auto
|
112
|
+
|
113
|
+
// Separate rule for Firefox.
|
114
|
+
// Cannot stack with WebKit's.
|
115
|
+
|
116
|
+
input.placeholder-text,
|
117
|
+
textarea.placeholder-text,
|
118
|
+
input:-moz-placeholder,
|
119
|
+
textarea:-moz-placeholder
|
120
|
+
color: #888
|
121
|
+
|
122
|
+
::-webkit-input-placeholder
|
123
|
+
color: #888
|
124
|
+
|
125
|
+
button:focus,
|
126
|
+
button:active,
|
127
|
+
input:focus,
|
128
|
+
input:active,
|
129
|
+
select:focus,
|
130
|
+
select:active,
|
131
|
+
textarea:focus,
|
132
|
+
textarea:active
|
133
|
+
-moz-box-shadow: #06f 0 0 7px
|
134
|
+
-webkit-box-shadow: #06f 0 0 7px
|
135
|
+
box-shadow: #06f 0 0 7px
|
136
|
+
|
137
|
+
// for Opera
|
138
|
+
z-index: 1
|
139
|
+
|
140
|
+
input[type="file"]:focus,
|
141
|
+
input[type="file"]:active,
|
142
|
+
input[type="radio"]:focus,
|
143
|
+
input[type="radio"]:active,
|
144
|
+
input[type="checkbox"]:focus,
|
145
|
+
input[type="checkbox"]:active
|
146
|
+
-moz-box-shadow: none
|
147
|
+
-webkit-box-shadow: none
|
148
|
+
box-shadow: none
|
149
|
+
|
150
|
+
select[disabled],
|
151
|
+
textarea[disabled],
|
152
|
+
input[type="date"][disabled],
|
153
|
+
input[type="datetime"][disabled],
|
154
|
+
input[type="datetime-local"][disabled],
|
155
|
+
input[type="email"][disabled],
|
156
|
+
input[type="month"][disabled],
|
157
|
+
input[type="number"][disabled],
|
158
|
+
input[type="password"][disabled],
|
159
|
+
input[type="search"][disabled],
|
160
|
+
input[type="tel"][disabled],
|
161
|
+
input[type="text"][disabled],
|
162
|
+
input[type="time"][disabled],
|
163
|
+
input[type="url"][disabled],
|
164
|
+
input[type="week"][disabled]
|
165
|
+
background-color: #eee
|
166
|
+
|
167
|
+
button[disabled],
|
168
|
+
input[disabled],
|
169
|
+
select[disabled],
|
170
|
+
select[disabled] option,
|
171
|
+
select[disabled] optgroup,
|
172
|
+
textarea[disabled]
|
173
|
+
-moz-box-shadow: none
|
174
|
+
-webkit-box-shadow: none
|
175
|
+
box-shadow: none
|
176
|
+
-webkit-user-select: none
|
177
|
+
-moz-user-select: none
|
178
|
+
user-select: none
|
179
|
+
color: #888
|
180
|
+
cursor: default
|
181
|
+
|
182
|
+
.is_webkit select
|
183
|
+
// Tweaks for Safari + Chrome.
|
184
|
+
background:
|
185
|
+
image: image-url(select_arrow.gif)
|
186
|
+
repeat: no-repeat
|
187
|
+
position: right center
|
188
|
+
padding-right: 20px
|
189
|
+
|
190
|
+
textarea,
|
191
|
+
select[size],
|
192
|
+
select[multiple]
|
193
|
+
height: auto
|
194
|
+
|
195
|
+
.is_webkit select[size]
|
196
|
+
.is_webkit select[multiple]
|
197
|
+
background-image: none
|
198
|
+
padding: 0
|
199
|
+
|
200
|
+
textarea
|
201
|
+
min-height: 40px
|
202
|
+
overflow: auto
|
203
|
+
resize: vertical
|
204
|
+
width: 100%
|
205
|
+
|
206
|
+
optgroup
|
207
|
+
color: #000
|
208
|
+
font-style: normal
|
209
|
+
font-weight: normal
|
210
|
+
|
211
|
+
// `IE6
|
212
|
+
//----------------------------------------------------------------------------------------------------
|
213
|
+
|
214
|
+
// Everything below this line is for IE6.
|
215
|
+
// Delete it if you don't support it! :)
|
216
|
+
|
217
|
+
// Classes are added dynamically via JS,
|
218
|
+
// because IE6 doesn't support attribute
|
219
|
+
// selectors: .ie6_button, .ie6_input, etc.
|
220
|
+
|
221
|
+
// Note: These style rules are somewhat
|
222
|
+
// duplicated because IE6 bombs out when
|
223
|
+
// it sees attribute selectors. Example:
|
224
|
+
|
225
|
+
// .ie6_button {
|
226
|
+
// This works in IE6.
|
227
|
+
// }
|
228
|
+
|
229
|
+
// .ie6_button,
|
230
|
+
// input[type=submit] {
|
231
|
+
// This doesn't work.
|
232
|
+
// }
|
233
|
+
|
234
|
+
.ie6_button,
|
235
|
+
* html button
|
236
|
+
background: #ddd image-url(button.png) repeat-x
|
237
|
+
border: 1px solid
|
238
|
+
border-color: #ddd #bbb #999
|
239
|
+
cursor: pointer
|
240
|
+
color: #333
|
241
|
+
font: bold 12px/1.2 Arial, sans-serif
|
242
|
+
padding: 2px 10px 0px
|
243
|
+
overflow: visible
|
244
|
+
width: auto
|
245
|
+
|
246
|
+
* html button
|
247
|
+
padding-top: 1px
|
248
|
+
padding-bottom: 1px
|
249
|
+
|
250
|
+
.ie6_input,
|
251
|
+
* html textarea,
|
252
|
+
* html select
|
253
|
+
background: #fff
|
254
|
+
border: 1px solid
|
255
|
+
border-color: #848484 #c1c1c1 #e1e1e1
|
256
|
+
color: #000
|
257
|
+
padding: 2px 3px 1px
|
258
|
+
font-size: 13px
|
259
|
+
font-family: Arial, sans-serif
|
260
|
+
vertical-align: top
|
261
|
+
|
262
|
+
* html select
|
263
|
+
margin-top: 1px
|
264
|
+
|
265
|
+
.placeholder_text,
|
266
|
+
.ie6_input_disabled,
|
267
|
+
.ie6_button_disabled
|
268
|
+
color: #888
|
269
|
+
|
270
|
+
.ie6_input_disabled
|
271
|
+
background: #eee
|
data/templates/.DS_Store
ADDED
Binary file
|
Binary file
|
@@ -0,0 +1,174 @@
|
|
1
|
+
//
|
2
|
+
// Note: This file depends on the Dojo 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 = parseInt(dojo.isIE, 10) === 6;
|
13
|
+
var IE7 = parseInt(dojo.isIE, 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
|
+
dojo.query('html').addClass('is_webkit');
|
33
|
+
},
|
34
|
+
// FORMALIZE.init.full_input_size
|
35
|
+
full_input_size: function() {
|
36
|
+
if (!IE7 || !dojo.query('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
|
+
dojo.query('textarea, input.input_full').forEach(function(el) {
|
43
|
+
var new_el = el.cloneNode(false);
|
44
|
+
var span = document.createElement('span');
|
45
|
+
|
46
|
+
span.className = 'input_full_wrap';
|
47
|
+
span.appendChild(new_el);
|
48
|
+
el.parentNode.replaceChild(span, el);
|
49
|
+
});
|
50
|
+
},
|
51
|
+
// FORMALIZE.init.ie6_skin_inputs
|
52
|
+
ie6_skin_inputs: function() {
|
53
|
+
// Test for Internet Explorer 6.
|
54
|
+
if (!IE6 || !dojo.query('input, select, textarea').length) {
|
55
|
+
// Exit if the browser is not IE6,
|
56
|
+
// or if no form elements exist.
|
57
|
+
return;
|
58
|
+
}
|
59
|
+
|
60
|
+
// For <input type="submit" />, etc.
|
61
|
+
var button_regex = /button|submit|reset/;
|
62
|
+
|
63
|
+
// For <input type="text" />, etc.
|
64
|
+
var type_regex = /date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;
|
65
|
+
|
66
|
+
dojo.query('input').forEach(function(el) {
|
67
|
+
// Is it a button?
|
68
|
+
if (el.getAttribute('type').match(button_regex)) {
|
69
|
+
dojo.addClass(el, 'ie6_button');
|
70
|
+
|
71
|
+
/* Is it disabled? */
|
72
|
+
if (el.disabled) {
|
73
|
+
dojo.addClass(el, 'ie6_button_disabled');
|
74
|
+
}
|
75
|
+
}
|
76
|
+
// Or is it a textual input?
|
77
|
+
else if (el.getAttribute('type').match(type_regex)) {
|
78
|
+
dojo.addClass(el, 'ie6_input');
|
79
|
+
|
80
|
+
/* Is it disabled? */
|
81
|
+
if (el.disabled) {
|
82
|
+
dojo.addClass(el, 'ie6_input_disabled');
|
83
|
+
}
|
84
|
+
}
|
85
|
+
});
|
86
|
+
|
87
|
+
dojo.query('textarea, select').forEach(function(el) {
|
88
|
+
/* Is it disabled? */
|
89
|
+
if (el.disabled) {
|
90
|
+
dojo.addClass(el, 'ie6_input_disabled');
|
91
|
+
}
|
92
|
+
});
|
93
|
+
},
|
94
|
+
// FORMALIZE.init.autofocus
|
95
|
+
autofocus: function() {
|
96
|
+
if (AUTOFOCUS_SUPPORTED || !dojo.query('[autofocus]').length) {
|
97
|
+
return;
|
98
|
+
}
|
99
|
+
|
100
|
+
dojo.query('[autofocus]')[0].focus();
|
101
|
+
},
|
102
|
+
// FORMALIZE.init.placeholder
|
103
|
+
placeholder: function() {
|
104
|
+
if (PLACEHOLDER_SUPPORTED || !dojo.query('[placeholder]').length) {
|
105
|
+
// Exit if placeholder is supported natively,
|
106
|
+
// or if page does not have any placeholder.
|
107
|
+
return;
|
108
|
+
}
|
109
|
+
|
110
|
+
FORMALIZE.misc.add_placeholder();
|
111
|
+
|
112
|
+
dojo.query('[placeholder]').forEach(function(el) {
|
113
|
+
dojo.connect(el, 'onfocus', function() {
|
114
|
+
var text = el.getAttribute('placeholder');
|
115
|
+
|
116
|
+
if (el.value === text) {
|
117
|
+
el.value = '';
|
118
|
+
dojo.removeClass(el, 'placeholder_text');
|
119
|
+
}
|
120
|
+
});
|
121
|
+
|
122
|
+
dojo.connect(el, 'onblur', function() {
|
123
|
+
FORMALIZE.misc.add_placeholder();
|
124
|
+
});
|
125
|
+
});
|
126
|
+
|
127
|
+
// Prevent <form> from accidentally
|
128
|
+
// submitting the placeholder text.
|
129
|
+
dojo.query('form').forEach(function(form) {
|
130
|
+
dojo.connect(form, 'onsubmit', function() {
|
131
|
+
dojo.query('[placeholder]', form).forEach(function(el) {
|
132
|
+
var text = el.getAttribute('placeholder');
|
133
|
+
|
134
|
+
if (el.value === text) {
|
135
|
+
el.value = '';
|
136
|
+
dojo.removeClass(el, 'placeholder_text');
|
137
|
+
}
|
138
|
+
});
|
139
|
+
});
|
140
|
+
|
141
|
+
dojo.connect(form, 'onreset', function() {
|
142
|
+
setTimeout(FORMALIZE.misc.add_placeholder, 50);
|
143
|
+
});
|
144
|
+
});
|
145
|
+
}
|
146
|
+
},
|
147
|
+
// FORMALIZE.misc
|
148
|
+
misc: {
|
149
|
+
// FORMALIZE.misc.add_placeholder
|
150
|
+
add_placeholder: function() {
|
151
|
+
if (PLACEHOLDER_SUPPORTED || !dojo.query('[placeholder]').length) {
|
152
|
+
// Exit if placeholder is supported natively,
|
153
|
+
// or if page does not have any placeholder.
|
154
|
+
return;
|
155
|
+
}
|
156
|
+
|
157
|
+
dojo.query('[placeholder]').forEach(function(el) {
|
158
|
+
var text = el.getAttribute('placeholder');
|
159
|
+
|
160
|
+
if (!el.value || el.value === text) {
|
161
|
+
el.value = text;
|
162
|
+
dojo.addClass(el, 'placeholder_text');
|
163
|
+
}
|
164
|
+
});
|
165
|
+
}
|
166
|
+
}
|
167
|
+
};
|
168
|
+
// Alias window, document.
|
169
|
+
})(this, this.document);
|
170
|
+
|
171
|
+
// Automatically calls all functions in FORMALIZE.init
|
172
|
+
dojo.addOnLoad(function() {
|
173
|
+
FORMALIZE.go();
|
174
|
+
});
|