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(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 c=d(6);var b=d(7);function d(k){var j=f.createElement("b");j.innerHTML="<!--[if IE "+k+"]><br><![endif]-->";return !!j.getElementsByTagName("br").length;}return{go:function(){for(var j in FORMALIZE.init){FORMALIZE.init[j]();}},init:{detect_webkit:function(){if(!g){return;}$$("html")[0].addClassName("is_webkit");},full_input_size:function(){if(!b||!$$("textarea, input.input_full").length){return;}$$("textarea, input.input_full").each(function(j){Element.wrap(j,"span",{"class":"input_full_wrap"});});},ie6_skin_inputs:function(){if(!c||!$$("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/;$$("input").each(function(l){if(l.getAttribute("type").match(j)){l.addClassName("ie6_button");if(l.disabled){l.addClassName("ie6_button_disabled");}}else{if(l.getAttribute("type").match(k)){l.addClassName("ie6_input");if(l.disabled){l.addClassName("ie6_input_disabled");}}}});$$("textarea, select").each(function(l){if(l.disabled){l.addClassName("ie6_input_disabled");}});},autofocus:function(){if(i||!$$("[autofocus]").length){return;}$$("[autofocus]")[0].focus();},placeholder:function(){if(h||!$$("[placeholder]").length){return;}FORMALIZE.misc.add_placeholder();$$("[placeholder]").each(function(j){var l=j.getAttribute("placeholder");var k=j.up("form");j.observe("focus",function(){if(j.value===l){j.value="";j.removeClassName("placeholder_text");}});j.observe("blur",function(){FORMALIZE.misc.add_placeholder();});k.observe("submit",function(){if(j.value===l){j.value="";j.removeClassName("placeholder_text");}});k.observe("reset",function(){setTimeout(FORMALIZE.misc.add_placeholder,50);});});}},misc:{add_placeholder:function(){if(h||!$$("[placeholder]").length){return;}$$("[placeholder]").each(function(j){var k=j.getAttribute("placeholder");if(!j.value||j.value===k){j.value=k;j.addClassName("placeholder_text");}});}}};})(this,this.document);$(document).observe("dom:loaded",function(){FORMALIZE.go();});
|
Binary file
|
Binary file
|
Binary file
|
@@ -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
|
@@ -0,0 +1,168 @@
|
|
1
|
+
//
|
2
|
+
// Note: This file depends on the YUI 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(Y.UA.ie, 10) === 6;
|
13
|
+
var IE7 = parseInt(Y.UA.ie, 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
|
+
Y.one('html').addClass('is_webkit');
|
33
|
+
},
|
34
|
+
// FORMALIZE.init.full_input_size
|
35
|
+
full_input_size: function() {
|
36
|
+
if (!IE7 || !Y.all('textarea, input.input_full')) {
|
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
|
+
Y.all('textarea, input.input_full').each(function(el) {
|
43
|
+
var wrapper = Y.Node.create('<span class="input_full_wrap"></span>');
|
44
|
+
wrapper.append(el.replace(wrapper));
|
45
|
+
});
|
46
|
+
},
|
47
|
+
// FORMALIZE.init.ie6_skin_inputs
|
48
|
+
ie6_skin_inputs: function() {
|
49
|
+
// Test for Internet Explorer 6.
|
50
|
+
if (!IE6 || !Y.all('input, select, textarea')) {
|
51
|
+
// Exit if the browser is not IE6,
|
52
|
+
// or if no form elements exist.
|
53
|
+
return;
|
54
|
+
}
|
55
|
+
|
56
|
+
// For <input type="submit" />, etc.
|
57
|
+
var button_regex = /button|submit|reset/;
|
58
|
+
|
59
|
+
// For <input type="text" />, etc.
|
60
|
+
var type_regex = /date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;
|
61
|
+
|
62
|
+
Y.all('input').each(function(el) {
|
63
|
+
// Is it a button?
|
64
|
+
if (el.getAttribute('type').match(button_regex)) {
|
65
|
+
el.addClass('ie6_button');
|
66
|
+
|
67
|
+
/* Is it disabled? */
|
68
|
+
if (el.disabled) {
|
69
|
+
el.addClass('ie6_button_disabled');
|
70
|
+
}
|
71
|
+
}
|
72
|
+
// Or is it a textual input?
|
73
|
+
else if (el.getAttribute('type').match(type_regex)) {
|
74
|
+
el.addClass('ie6_input');
|
75
|
+
|
76
|
+
/* Is it disabled? */
|
77
|
+
if (el.disabled) {
|
78
|
+
el.addClass('ie6_input_disabled');
|
79
|
+
}
|
80
|
+
}
|
81
|
+
});
|
82
|
+
|
83
|
+
Y.all('textarea, select').each(function(el) {
|
84
|
+
/* Is it disabled? */
|
85
|
+
if (el.disabled) {
|
86
|
+
el.addClass('ie6_input_disabled');
|
87
|
+
}
|
88
|
+
});
|
89
|
+
},
|
90
|
+
// FORMALIZE.init.autofocus
|
91
|
+
autofocus: function() {
|
92
|
+
if (AUTOFOCUS_SUPPORTED || !Y.one('[autofocus]')) {
|
93
|
+
return;
|
94
|
+
}
|
95
|
+
|
96
|
+
Y.one('[autofocus]').focus();
|
97
|
+
},
|
98
|
+
// FORMALIZE.init.placeholder
|
99
|
+
placeholder: function() {
|
100
|
+
if (PLACEHOLDER_SUPPORTED || !Y.one('[placeholder]')) {
|
101
|
+
// Exit if placeholder is supported natively,
|
102
|
+
// or if page does not have any placeholder.
|
103
|
+
return;
|
104
|
+
}
|
105
|
+
|
106
|
+
FORMALIZE.misc.add_placeholder();
|
107
|
+
|
108
|
+
Y.all('[placeholder]').each(function(el) {
|
109
|
+
var text = el.getAttribute('placeholder');
|
110
|
+
var form = el.ancestor('form');
|
111
|
+
|
112
|
+
function add_placeholder() {
|
113
|
+
if (!el.get('value') || el.get('value') === text) {
|
114
|
+
el.set('value', text).addClass('placeholder_text');
|
115
|
+
}
|
116
|
+
}
|
117
|
+
|
118
|
+
el.on('focus', function() {
|
119
|
+
if (el.get('value') === text) {
|
120
|
+
el.set('value', '').removeClass('placeholder_text');
|
121
|
+
}
|
122
|
+
});
|
123
|
+
|
124
|
+
el.on('blur', function() {
|
125
|
+
FORMALIZE.misc.add_placeholder();
|
126
|
+
});
|
127
|
+
|
128
|
+
// Prevent <form> from accidentally
|
129
|
+
// submitting the placeholder text.
|
130
|
+
form.on('submit', function() {
|
131
|
+
if (el.get('value') === text) {
|
132
|
+
el.set('value', '').removeClass('placeholder_text');
|
133
|
+
}
|
134
|
+
});
|
135
|
+
|
136
|
+
form.on('reset', function() {
|
137
|
+
setTimeout(FORMALIZE.misc.add_placeholder, 50);
|
138
|
+
});
|
139
|
+
});
|
140
|
+
}
|
141
|
+
},
|
142
|
+
// FORMALIZE.misc
|
143
|
+
misc: {
|
144
|
+
// FORMALIZE.misc.add_placeholder
|
145
|
+
add_placeholder: function() {
|
146
|
+
if (PLACEHOLDER_SUPPORTED || !Y.one('[placeholder]')) {
|
147
|
+
// Exit if placeholder is supported natively,
|
148
|
+
// or if page does not have any placeholder.
|
149
|
+
return;
|
150
|
+
}
|
151
|
+
|
152
|
+
Y.all('[placeholder]').each(function(el) {
|
153
|
+
var text = el.getAttribute('placeholder');
|
154
|
+
|
155
|
+
if (!el.get('value') || el.get('value') === text) {
|
156
|
+
el.set('value', text).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
|
+
Y.on('domready', 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=parseInt(Y.UA.ie,10)===6;var h=parseInt(Y.UA.ie,10)===7;return{go:function(){for(var j in FORMALIZE.init){FORMALIZE.init[j]();}},init:{detect_webkit:function(){if(!d){return;}Y.one("html").addClass("is_webkit");},full_input_size:function(){if(!h||!Y.all("textarea, input.input_full")){return;}Y.all("textarea, input.input_full").each(function(i){var j=Y.Node.create('<span class="input_full_wrap"></span>');j.append(i.replace(j));});},ie6_skin_inputs:function(){if(!a||!Y.all("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/;Y.all("input").each(function(k){if(k.getAttribute("type").match(i)){k.addClass("ie6_button");if(k.disabled){k.addClass("ie6_button_disabled");}}else{if(k.getAttribute("type").match(j)){k.addClass("ie6_input");if(k.disabled){k.addClass("ie6_input_disabled");}}}});Y.all("textarea, select").each(function(k){if(k.disabled){k.addClass("ie6_input_disabled");}});},autofocus:function(){if(c||!Y.one("[autofocus]")){return;}Y.one("[autofocus]").focus();},placeholder:function(){if(e||!Y.one("[placeholder]")){return;}FORMALIZE.misc.add_placeholder();Y.all("[placeholder]").each(function(j){var l=j.getAttribute("placeholder");var k=j.ancestor("form");function i(){if(!j.get("value")||j.get("value")===l){j.set("value",l).addClass("placeholder_text");}}j.on("focus",function(){if(j.get("value")===l){j.set("value","").removeClass("placeholder_text");}});j.on("blur",function(){FORMALIZE.misc.add_placeholder();});k.on("submit",function(){if(j.get("value")===l){j.set("value","").removeClass("placeholder_text");}});k.on("reset",function(){setTimeout(FORMALIZE.misc.add_placeholder,50);});});}},misc:{add_placeholder:function(){if(e||!Y.one("[placeholder]")){return;}Y.all("[placeholder]").each(function(i){var j=i.getAttribute("placeholder");if(!i.get("value")||i.get("value")===j){i.set("value",j).addClass("placeholder_text");}});}}};})(this,this.document);Y.on("domready",function(){FORMALIZE.go();});
|
metadata
ADDED
@@ -0,0 +1,130 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: compass_formalize
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Wynn Netherland
|
14
|
+
- Nathan Smith
|
15
|
+
autorequire:
|
16
|
+
bindir: bin
|
17
|
+
cert_chain: []
|
18
|
+
|
19
|
+
date: 2011-04-19 00:00:00 -05:00
|
20
|
+
default_executable:
|
21
|
+
dependencies:
|
22
|
+
- !ruby/object:Gem::Dependency
|
23
|
+
name: compass
|
24
|
+
prerelease: false
|
25
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ">="
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
hash: 55
|
31
|
+
segments:
|
32
|
+
- 0
|
33
|
+
- 10
|
34
|
+
- 0
|
35
|
+
version: 0.10.0
|
36
|
+
type: :runtime
|
37
|
+
version_requirements: *id001
|
38
|
+
description: Compass and Sass port of Nathan Smith's Formalize HTML form normalizer.
|
39
|
+
email:
|
40
|
+
- wynn.netherland@gmail.com
|
41
|
+
- nathan@sonspring.com
|
42
|
+
executables: []
|
43
|
+
|
44
|
+
extensions: []
|
45
|
+
|
46
|
+
extra_rdoc_files: []
|
47
|
+
|
48
|
+
files:
|
49
|
+
- .DS_Store
|
50
|
+
- .gitignore
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- compass_formalize.gemspec
|
54
|
+
- lib/compass_formalize.rb
|
55
|
+
- stylesheets/_formalize.sass
|
56
|
+
- templates/.DS_Store
|
57
|
+
- templates/dojo/button.png
|
58
|
+
- templates/dojo/dojo.formalize.js
|
59
|
+
- templates/dojo/dojo.formalize.min.js
|
60
|
+
- templates/dojo/manifest.rb
|
61
|
+
- templates/dojo/select_arrow.gif
|
62
|
+
- templates/extjs/.DS_Store
|
63
|
+
- templates/extjs/button.png
|
64
|
+
- templates/extjs/extjs.formalize.js
|
65
|
+
- templates/extjs/extjs.formalize.min.js
|
66
|
+
- templates/extjs/manifest.rb
|
67
|
+
- templates/extjs/select_arrow.gif
|
68
|
+
- templates/jquery/.DS_Store
|
69
|
+
- templates/jquery/button.png
|
70
|
+
- templates/jquery/jquery.formalize.js
|
71
|
+
- templates/jquery/jquery.formalize.min.js
|
72
|
+
- templates/jquery/manifest.rb
|
73
|
+
- templates/jquery/select_arrow.gif
|
74
|
+
- templates/mootools/.DS_Store
|
75
|
+
- templates/mootools/button.png
|
76
|
+
- templates/mootools/manifest.rb
|
77
|
+
- templates/mootools/mootools.formalize.js
|
78
|
+
- templates/mootools/mootools.formalize.min.js
|
79
|
+
- templates/mootools/select_arrow.gif
|
80
|
+
- templates/project/manifest.rb
|
81
|
+
- templates/prototype/.DS_Store
|
82
|
+
- templates/prototype/button.png
|
83
|
+
- templates/prototype/manifest.rb
|
84
|
+
- templates/prototype/prototype.formalize.js
|
85
|
+
- templates/prototype/prototype.formalize.min.js
|
86
|
+
- templates/prototype/select_arrow.gif
|
87
|
+
- templates/yui/.DS_Store
|
88
|
+
- templates/yui/button.png
|
89
|
+
- templates/yui/manifest.rb
|
90
|
+
- templates/yui/select_arrow.gif
|
91
|
+
- templates/yui/yui.formalize.js
|
92
|
+
- templates/yui/yui.formalize.min.js
|
93
|
+
has_rdoc: false
|
94
|
+
homepage: http://github.com/pengwynn/compass_formalize
|
95
|
+
licenses: []
|
96
|
+
|
97
|
+
post_install_message:
|
98
|
+
rdoc_options: []
|
99
|
+
|
100
|
+
require_paths:
|
101
|
+
- lib
|
102
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
103
|
+
none: false
|
104
|
+
requirements:
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
hash: 3
|
108
|
+
segments:
|
109
|
+
- 0
|
110
|
+
version: "0"
|
111
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
|
+
none: false
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
hash: 17
|
117
|
+
segments:
|
118
|
+
- 1
|
119
|
+
- 3
|
120
|
+
- 5
|
121
|
+
version: 1.3.5
|
122
|
+
requirements: []
|
123
|
+
|
124
|
+
rubyforge_project: compass-960-plugin
|
125
|
+
rubygems_version: 1.6.2
|
126
|
+
signing_key:
|
127
|
+
specification_version: 3
|
128
|
+
summary: Compass compatible Sass port of Formalize.
|
129
|
+
test_files: []
|
130
|
+
|