survivalkit 1.0.beta.11 → 1.0.beta.12
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.markdown +4 -0
- data/lib/survivalkit.rb +2 -2
- data/stylesheets/survivalkit/fonts/_all.scss +2 -0
- data/stylesheets/survivalkit/fonts/_ss-social.scss +136 -0
- data/stylesheets/survivalkit/fonts/_ss-standard.scss +426 -0
- data/stylesheets/survivalkit/reset/_reset.scss +4 -0
- data/templates/clean/manifest.rb +0 -2
- data/templates/drupal/manifest.rb +0 -2
- data/templates/project/manifest.rb +44 -46
- data/templates/project/sources/FitVids/README.md +49 -0
- data/templates/project/sources/FitVids/jquery.fitvids.js +80 -0
- data/templates/project/sources/FitVids/tests.html +66 -0
- data/templates/project/sources/Geared-Scrolling/README.md +31 -0
- data/templates/project/sources/Geared-Scrolling/css/specific.css +88 -0
- data/templates/project/sources/Geared-Scrolling/images/col1.png +0 -0
- data/templates/project/sources/Geared-Scrolling/images/col2.png +0 -0
- data/templates/project/sources/Geared-Scrolling/images/col3.png +0 -0
- data/templates/project/sources/Geared-Scrolling/images/header.png +0 -0
- data/templates/project/sources/Geared-Scrolling/index.html +32 -0
- data/templates/project/sources/Geared-Scrolling/js/init.js +11 -0
- data/templates/project/sources/Geared-Scrolling/js/jquery.heyday.gearedscrolling.js +283 -0
- data/templates/project/sources/Lettering.js/README.md +58 -0
- data/templates/project/sources/Lettering.js/examples/index.html +135 -0
- data/templates/project/sources/Lettering.js/examples/style.css +171 -0
- data/templates/project/sources/Lettering.js/jquery.lettering.js +66 -0
- data/templates/project/sources/Respond/README.md +100 -0
- data/templates/project/sources/Respond/cross-domain/example.html +24 -0
- data/templates/project/sources/Respond/cross-domain/respond-proxy.html +96 -0
- data/templates/project/sources/Respond/cross-domain/respond.proxy.gif +0 -0
- data/templates/project/sources/Respond/cross-domain/respond.proxy.js +127 -0
- data/templates/project/sources/Respond/respond.min.js +6 -0
- data/templates/project/sources/Respond/respond.src.js +326 -0
- data/templates/project/sources/Respond/test/test.css +80 -0
- data/templates/project/sources/Respond/test/test.html +20 -0
- data/templates/project/sources/Respond/test/test2.css +8 -0
- data/templates/project/sources/Respond/test/unit/index.html +29 -0
- data/templates/project/sources/Respond/test/unit/qunit/qunit.css +226 -0
- data/templates/project/sources/Respond/test/unit/qunit/qunit.js +1598 -0
- data/templates/project/sources/Respond/test/unit/test.css +73 -0
- data/templates/project/sources/Respond/test/unit/test2.css +5 -0
- data/templates/project/sources/Respond/test/unit/test3.css +5 -0
- data/templates/project/sources/Respond/test/unit/tests.js +144 -0
- data/templates/project/sources/box-sizing-polyfill/README.md +24 -0
- data/templates/project/sources/box-sizing-polyfill/boxsizing.htc +501 -0
- data/templates/project/sources/formalize/README.txt +26 -0
- data/templates/project/sources/formalize/assets/css/_formalize.sass +326 -0
- data/templates/project/sources/formalize/assets/css/demo.css +654 -0
- data/templates/project/sources/formalize/assets/css/formalize.css +368 -0
- data/templates/project/sources/formalize/assets/css/reset.css +211 -0
- data/templates/project/sources/formalize/assets/css/text.css +81 -0
- data/templates/project/sources/formalize/assets/images/button.png +0 -0
- data/templates/project/sources/formalize/assets/images/select_arrow.gif +0 -0
- data/templates/project/sources/formalize/assets/js/dojo.formalize.js +202 -0
- data/templates/project/sources/formalize/assets/js/dojo.formalize.min.js +1 -0
- data/templates/project/sources/formalize/assets/js/extjs.formalize.js +192 -0
- data/templates/project/sources/formalize/assets/js/extjs.formalize.min.js +1 -0
- data/templates/project/sources/formalize/assets/js/jquery.formalize.js +181 -0
- data/templates/project/sources/formalize/assets/js/jquery.formalize.min.js +1 -0
- data/templates/project/sources/formalize/assets/js/mootools.formalize.js +193 -0
- data/templates/project/sources/formalize/assets/js/mootools.formalize.min.js +1 -0
- data/templates/project/sources/formalize/assets/js/prototype.formalize.js +192 -0
- data/templates/project/sources/formalize/assets/js/prototype.formalize.min.js +1 -0
- data/templates/project/sources/formalize/assets/js/yui.formalize.js +183 -0
- data/templates/project/sources/formalize/assets/js/yui.formalize.min.js +1 -0
- data/templates/project/sources/formalize/demo.html +130 -0
- data/templates/project/sources/formalize/dojo_demo.html +215 -0
- data/templates/project/sources/formalize/dojo_disabled.html +215 -0
- data/templates/project/sources/formalize/dojo_errors.html +215 -0
- data/templates/project/sources/formalize/extjs_demo.html +215 -0
- data/templates/project/sources/formalize/extjs_disabled.html +215 -0
- data/templates/project/sources/formalize/extjs_errors.html +215 -0
- data/templates/project/sources/formalize/jquery_demo.html +215 -0
- data/templates/project/sources/formalize/jquery_disabled.html +215 -0
- data/templates/project/sources/formalize/jquery_errors.html +215 -0
- data/templates/project/sources/formalize/mootools_demo.html +215 -0
- data/templates/project/sources/formalize/mootools_disabled.html +215 -0
- data/templates/project/sources/formalize/mootools_errors.html +215 -0
- data/templates/project/sources/formalize/prototype_demo.html +215 -0
- data/templates/project/sources/formalize/prototype_disabled.html +215 -0
- data/templates/project/sources/formalize/prototype_errors.html +215 -0
- data/templates/project/sources/formalize/unstyled.html +210 -0
- data/templates/project/sources/formalize/yui_demo.html +223 -0
- data/templates/project/sources/formalize/yui_disabled.html +223 -0
- data/templates/project/sources/formalize/yui_errors.html +223 -0
- data/templates/project/sources/iOS-Orientationchange-Fix/README.md +16 -0
- data/templates/project/sources/iOS-Orientationchange-Fix/demo.html +43 -0
- data/templates/project/sources/iOS-Orientationchange-Fix/ios-orientationchange-fix.js +56 -0
- data/templates/project/sources/jQuery-widowFix/index.html +159 -0
- data/templates/project/sources/jQuery-widowFix/js/jquery-1.4.3.min.js +166 -0
- data/templates/project/sources/jQuery-widowFix/js/jquery.widowFix-1.3.2.js +135 -0
- data/templates/project/sources/jQuery-widowFix/js/jquery.widowFix-1.3.2.min.js +10 -0
- data/templates/project/sources/jQuery-widowFix/sample.html +84 -0
- data/templates/project/sources/jquery-html5-placeholder-shim/jquery.html5-placeholder-shim.js +96 -0
- data/templates/project/sources/jquery-html5-placeholder-shim/readme.md +22 -0
- data/templates/project/sources/jquery-html5-placeholder-shim/test.html +103 -0
- data/templates/project/sources/ss-social/ss-social.js +78 -0
- data/templates/project/sources/ss-standard/ss-standard.js +78 -0
- data/templates/shared/partials/01-variables/_colors.scss +2 -6
- data/templates/shared/partials/01-variables/_fonts.scss +49 -2
- data/templates/shared/partials/01-variables/_settings.scss +48 -13
- data/templates/shared/partials/04-base/_all.scss +0 -2
- data/templates/shared/partials/04-base/_common.scss +0 -4
- data/templates/shared/partials/05-layout/_grids-susy.scss +4 -4
- data/templates/shared/style.scss +9 -9
- metadata +93 -5
- data/templates/shared/partials/04-base/_edits.scss +0 -8
- data/templates/shared/partials/04-base/_font-face.scss +0 -14
@@ -0,0 +1 @@
|
|
1
|
+
var FORMALIZE=function(e,t,n){function r(e){var n=t.createElement("b");return n.innerHTML="<!--[if IE "+e+"]><br><![endif]-->",!!n.getElementsByTagName("br").length}var i="placeholder"in t.createElement("input"),s="autofocus"in t.createElement("input"),o=r(6),u=r(7);return{go:function(){var e,t=this.init;for(e in t)t.hasOwnProperty(e)&&t[e]()},init:{disable_link_button:function(){Ext.getBody().on("click",function(e){var t=e.target,n=t.tagName.toLowerCase()==="a"&&t.className.match("button_disabled");n&&e.preventDefault()})},full_input_size:function(){if(!u||!Ext.query("textarea, input.input_full"))return;Ext.each(Ext.query("textarea, input.input_full"),function(e){Ext.get(e).wrap('<span class="input_full_wrap"></span>')})},ie6_skin_inputs:function(){if(!o||!Ext.query("input, select, textarea"))return;var e=/button|submit|reset/,t=/date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;Ext.each(Ext.query("input"),function(n){n.getAttribute("type").match(e)?(Ext.get(n).addClass("ie6_button"),n.disabled&&Ext.get(n).addClass("ie6_button_disabled")):n.getAttribute("type").match(t)&&(Ext.get(n).addClass("ie6_input"),n.disabled&&Ext.get(n).addClass("ie6_input_disabled"))}),Ext.each(Ext.query("textarea, select"),function(e){e.disabled&&Ext.get(e).addClass("ie6_input_disabled")})},autofocus:function(){if(s||!Ext.query("[autofocus]"))return;var e=Ext.query("[autofocus]")[0];e.disabled||e.focus()},placeholder:function(){if(i||!Ext.query("[placeholder]"))return;FORMALIZE.misc.add_placeholder(),Ext.each(Ext.query("[placeholder]"),function(e){if(e.type==="password")return;var t=e.getAttribute("placeholder"),n=Ext.get(e).parent("form");Ext.get(e).on("focus",function(){e.value===t&&(e.value="",Ext.get(e).removeClass("placeholder_text"))}),Ext.get(e).on("blur",function(){FORMALIZE.misc.add_placeholder()}),n.on("submit",function(){e.value===t&&(e.value="",Ext.get(e).removeClass("placeholder_text"))}),n.on("reset",function(){setTimeout(FORMALIZE.misc.add_placeholder,50)})})}},misc:{add_placeholder:function(){if(i||!Ext.query("[placeholder]"))return;Ext.each(Ext.query("[placeholder]"),function(e){if(e.type==="password")return;var t=e.getAttribute("placeholder");if(!e.value||e.value===t)e.value=t,Ext.get(e).addClass("placeholder_text")})}}}}(this,this.document);Ext.onReady(function(){FORMALIZE.go()})
|
@@ -0,0 +1,181 @@
|
|
1
|
+
/*
|
2
|
+
Formalize - version 1.2
|
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
|
+
// Internet Explorer detection.
|
11
|
+
function IE(version) {
|
12
|
+
var b = document.createElement('b');
|
13
|
+
b.innerHTML = '<!--[if IE ' + version + ']><br><![endif]-->';
|
14
|
+
return !!b.getElementsByTagName('br').length;
|
15
|
+
}
|
16
|
+
|
17
|
+
// Private constants.
|
18
|
+
var PLACEHOLDER_SUPPORTED = 'placeholder' in document.createElement('input');
|
19
|
+
var AUTOFOCUS_SUPPORTED = 'autofocus' in document.createElement('input');
|
20
|
+
var IE6 = IE(6);
|
21
|
+
var IE7 = IE(7);
|
22
|
+
|
23
|
+
// Expose innards of FORMALIZE.
|
24
|
+
return {
|
25
|
+
// FORMALIZE.go
|
26
|
+
go: function() {
|
27
|
+
var i, j = this.init;
|
28
|
+
|
29
|
+
for (i in j) {
|
30
|
+
j.hasOwnProperty(i) && j[i]();
|
31
|
+
}
|
32
|
+
},
|
33
|
+
// FORMALIZE.init
|
34
|
+
init: {
|
35
|
+
// FORMALIZE.init.disable_link_button
|
36
|
+
disable_link_button: function() {
|
37
|
+
$(document.documentElement).on('click', 'a.button_disabled', function() {
|
38
|
+
return false;
|
39
|
+
});
|
40
|
+
},
|
41
|
+
// FORMALIZE.init.full_input_size
|
42
|
+
full_input_size: function() {
|
43
|
+
if (!IE7 || !$('textarea, input.input_full').length) {
|
44
|
+
return;
|
45
|
+
}
|
46
|
+
|
47
|
+
// This fixes width: 100% on <textarea> and class="input_full".
|
48
|
+
// It ensures that form elements don't go wider than container.
|
49
|
+
$('textarea, input.input_full').wrap('<span class="input_full_wrap"></span>');
|
50
|
+
},
|
51
|
+
// FORMALIZE.init.ie6_skin_inputs
|
52
|
+
ie6_skin_inputs: function() {
|
53
|
+
// Test for Internet Explorer 6.
|
54
|
+
if (!IE6 || !$('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
|
+
$('input').each(function() {
|
67
|
+
var el = $(this);
|
68
|
+
|
69
|
+
// Is it a button?
|
70
|
+
if (this.getAttribute('type').match(button_regex)) {
|
71
|
+
el.addClass('ie6_button');
|
72
|
+
|
73
|
+
/* Is it disabled? */
|
74
|
+
if (this.disabled) {
|
75
|
+
el.addClass('ie6_button_disabled');
|
76
|
+
}
|
77
|
+
}
|
78
|
+
// Or is it a textual input?
|
79
|
+
else if (this.getAttribute('type').match(type_regex)) {
|
80
|
+
el.addClass('ie6_input');
|
81
|
+
|
82
|
+
/* Is it disabled? */
|
83
|
+
if (this.disabled) {
|
84
|
+
el.addClass('ie6_input_disabled');
|
85
|
+
}
|
86
|
+
}
|
87
|
+
});
|
88
|
+
|
89
|
+
$('textarea, select').each(function() {
|
90
|
+
/* Is it disabled? */
|
91
|
+
if (this.disabled) {
|
92
|
+
$(this).addClass('ie6_input_disabled');
|
93
|
+
}
|
94
|
+
});
|
95
|
+
},
|
96
|
+
// FORMALIZE.init.autofocus
|
97
|
+
autofocus: function() {
|
98
|
+
if (AUTOFOCUS_SUPPORTED || !$(':input[autofocus]').length) {
|
99
|
+
return;
|
100
|
+
}
|
101
|
+
|
102
|
+
var el = $('[autofocus]')[0];
|
103
|
+
|
104
|
+
if (!el.disabled) {
|
105
|
+
el.focus();
|
106
|
+
}
|
107
|
+
},
|
108
|
+
// FORMALIZE.init.placeholder
|
109
|
+
placeholder: function() {
|
110
|
+
if (PLACEHOLDER_SUPPORTED || !$(':input[placeholder]').length) {
|
111
|
+
// Exit if placeholder is supported natively,
|
112
|
+
// or if page does not have any placeholder.
|
113
|
+
return;
|
114
|
+
}
|
115
|
+
|
116
|
+
FORMALIZE.misc.add_placeholder();
|
117
|
+
|
118
|
+
$(':input[placeholder]').each(function() {
|
119
|
+
// Placeholder obscured in older browsers,
|
120
|
+
// so there's no point adding to password.
|
121
|
+
if (this.type === 'password') {
|
122
|
+
return;
|
123
|
+
}
|
124
|
+
|
125
|
+
var el = $(this);
|
126
|
+
var text = el.attr('placeholder');
|
127
|
+
|
128
|
+
el.focus(function() {
|
129
|
+
if (el.val() === text) {
|
130
|
+
el.val('').removeClass('placeholder_text');
|
131
|
+
}
|
132
|
+
}).blur(function() {
|
133
|
+
FORMALIZE.misc.add_placeholder();
|
134
|
+
});
|
135
|
+
|
136
|
+
// Prevent <form> from accidentally
|
137
|
+
// submitting the placeholder text.
|
138
|
+
el.closest('form').submit(function() {
|
139
|
+
if (el.val() === text) {
|
140
|
+
el.val('').removeClass('placeholder_text');
|
141
|
+
}
|
142
|
+
}).on('reset', function() {
|
143
|
+
setTimeout(FORMALIZE.misc.add_placeholder, 50);
|
144
|
+
});
|
145
|
+
});
|
146
|
+
}
|
147
|
+
},
|
148
|
+
// FORMALIZE.misc
|
149
|
+
misc: {
|
150
|
+
// FORMALIZE.misc.add_placeholder
|
151
|
+
add_placeholder: function() {
|
152
|
+
if (PLACEHOLDER_SUPPORTED || !$(':input[placeholder]').length) {
|
153
|
+
// Exit if placeholder is supported natively,
|
154
|
+
// or if page does not have any placeholder.
|
155
|
+
return;
|
156
|
+
}
|
157
|
+
|
158
|
+
$(':input[placeholder]').each(function() {
|
159
|
+
// Placeholder obscured in older browsers,
|
160
|
+
// so there's no point adding to password.
|
161
|
+
if (this.type === 'password') {
|
162
|
+
return;
|
163
|
+
}
|
164
|
+
|
165
|
+
var el = $(this);
|
166
|
+
var text = el.attr('placeholder');
|
167
|
+
|
168
|
+
if (!el.val() || el.val() === text) {
|
169
|
+
el.val(text).addClass('placeholder_text');
|
170
|
+
}
|
171
|
+
});
|
172
|
+
}
|
173
|
+
}
|
174
|
+
};
|
175
|
+
// Alias jQuery, window, document.
|
176
|
+
})(jQuery, this, this.document);
|
177
|
+
|
178
|
+
// Automatically calls all functions in FORMALIZE.init
|
179
|
+
jQuery(document).ready(function() {
|
180
|
+
FORMALIZE.go();
|
181
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
var FORMALIZE=function(e,t,n,r){function i(e){var t=n.createElement("b");return t.innerHTML="<!--[if IE "+e+"]><br><![endif]-->",!!t.getElementsByTagName("br").length}var s="placeholder"in n.createElement("input"),o="autofocus"in n.createElement("input"),u=i(6),a=i(7);return{go:function(){var e,t=this.init;for(e in t)t.hasOwnProperty(e)&&t[e]()},init:{disable_link_button:function(){e(n.documentElement).on("click","a.button_disabled",function(){return!1})},full_input_size:function(){if(!a||!e("textarea, input.input_full").length)return;e("textarea, input.input_full").wrap('<span class="input_full_wrap"></span>')},ie6_skin_inputs:function(){if(!u||!e("input, select, textarea").length)return;var t=/button|submit|reset/,n=/date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;e("input").each(function(){var r=e(this);this.getAttribute("type").match(t)?(r.addClass("ie6_button"),this.disabled&&r.addClass("ie6_button_disabled")):this.getAttribute("type").match(n)&&(r.addClass("ie6_input"),this.disabled&&r.addClass("ie6_input_disabled"))}),e("textarea, select").each(function(){this.disabled&&e(this).addClass("ie6_input_disabled")})},autofocus:function(){if(o||!e(":input[autofocus]").length)return;var t=e("[autofocus]")[0];t.disabled||t.focus()},placeholder:function(){if(s||!e(":input[placeholder]").length)return;FORMALIZE.misc.add_placeholder(),e(":input[placeholder]").each(function(){if(this.type==="password")return;var t=e(this),n=t.attr("placeholder");t.focus(function(){t.val()===n&&t.val("").removeClass("placeholder_text")}).blur(function(){FORMALIZE.misc.add_placeholder()}),t.closest("form").submit(function(){t.val()===n&&t.val("").removeClass("placeholder_text")}).on("reset",function(){setTimeout(FORMALIZE.misc.add_placeholder,50)})})}},misc:{add_placeholder:function(){if(s||!e(":input[placeholder]").length)return;e(":input[placeholder]").each(function(){if(this.type==="password")return;var t=e(this),n=t.attr("placeholder");(!t.val()||t.val()===n)&&t.val(n).addClass("placeholder_text")})}}}}(jQuery,this,this.document);jQuery(document).ready(function(){FORMALIZE.go()})
|
@@ -0,0 +1,193 @@
|
|
1
|
+
/*
|
2
|
+
Formalize - version 1.2
|
3
|
+
|
4
|
+
Note: This file depends on the MooTools library.
|
5
|
+
*/
|
6
|
+
|
7
|
+
// Module pattern:
|
8
|
+
// http://yuiblog.com/blog/2007/06/12/module-pattern
|
9
|
+
var FORMALIZE = (function(window, document, undefined) {
|
10
|
+
// Internet Explorer detection.
|
11
|
+
function IE(version) {
|
12
|
+
var b = document.createElement('b');
|
13
|
+
b.innerHTML = '<!--[if IE ' + version + ']><br><![endif]-->';
|
14
|
+
return !!b.getElementsByTagName('br').length;
|
15
|
+
}
|
16
|
+
|
17
|
+
// Private constants.
|
18
|
+
var PLACEHOLDER_SUPPORTED = 'placeholder' in document.createElement('input');
|
19
|
+
var AUTOFOCUS_SUPPORTED = 'autofocus' in document.createElement('input');
|
20
|
+
var IE6 = IE(6);
|
21
|
+
var IE7 = IE(7);
|
22
|
+
|
23
|
+
// Expose innards of FORMALIZE.
|
24
|
+
return {
|
25
|
+
// FORMALIZE.go
|
26
|
+
go: function() {
|
27
|
+
var i, j = this.init;
|
28
|
+
|
29
|
+
for (i in j) {
|
30
|
+
j.hasOwnProperty(i) && j[i]();
|
31
|
+
}
|
32
|
+
},
|
33
|
+
// FORMALIZE.init
|
34
|
+
init: {
|
35
|
+
// FORMALIZE.init.disable_link_button
|
36
|
+
disable_link_button: function() {
|
37
|
+
$(document.documentElement).addEvent('click', function(ev) {
|
38
|
+
var el = ev.target;
|
39
|
+
var is_disabled = el.tagName.toLowerCase() === 'a' && el.className.match('button_disabled');
|
40
|
+
|
41
|
+
if (is_disabled) {
|
42
|
+
ev.preventDefault();
|
43
|
+
}
|
44
|
+
});
|
45
|
+
},
|
46
|
+
// FORMALIZE.init.full_input_size
|
47
|
+
full_input_size: function() {
|
48
|
+
if (!IE7 || !$$('textarea, input.input_full').length) {
|
49
|
+
return;
|
50
|
+
}
|
51
|
+
|
52
|
+
// This fixes width: 100% on <textarea> and class="input_full".
|
53
|
+
// It ensures that form elements don't go wider than container.
|
54
|
+
$$('textarea, input.input_full').each(function(el) {
|
55
|
+
new Element('span.input_full_wrap').wraps(el);
|
56
|
+
});
|
57
|
+
|
58
|
+
},
|
59
|
+
// FORMALIZE.init.ie6_skin_inputs
|
60
|
+
ie6_skin_inputs: function() {
|
61
|
+
// Test for Internet Explorer 6.
|
62
|
+
if (!IE6 || !$$('input, select, textarea').length) {
|
63
|
+
// Exit if the browser is not IE6,
|
64
|
+
// or if no form elements exist.
|
65
|
+
return;
|
66
|
+
}
|
67
|
+
|
68
|
+
// For <input type="submit" />, etc.
|
69
|
+
var button_regex = /button|submit|reset/;
|
70
|
+
|
71
|
+
// For <input type="text" />, etc.
|
72
|
+
var type_regex = /date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;
|
73
|
+
|
74
|
+
$$('input').each(function(el) {
|
75
|
+
// Is it a button?
|
76
|
+
if (el.getAttribute('type').match(button_regex)) {
|
77
|
+
el.addClass('ie6_button');
|
78
|
+
|
79
|
+
/* Is it disabled? */
|
80
|
+
if (el.disabled) {
|
81
|
+
el.addClass('ie6_button_disabled');
|
82
|
+
}
|
83
|
+
}
|
84
|
+
// Or is it a textual input?
|
85
|
+
else if (el.getAttribute('type').match(type_regex)) {
|
86
|
+
el.addClass('ie6_input');
|
87
|
+
|
88
|
+
/* Is it disabled? */
|
89
|
+
if (el.disabled) {
|
90
|
+
el.addClass('ie6_input_disabled');
|
91
|
+
}
|
92
|
+
}
|
93
|
+
});
|
94
|
+
|
95
|
+
$$('textarea, select').each(function(el) {
|
96
|
+
/* Is it disabled? */
|
97
|
+
if (el.disabled) {
|
98
|
+
el.addClass('ie6_input_disabled');
|
99
|
+
}
|
100
|
+
});
|
101
|
+
},
|
102
|
+
// FORMALIZE.init.autofocus
|
103
|
+
autofocus: function() {
|
104
|
+
if (AUTOFOCUS_SUPPORTED || !$$('[autofocus]').length) {
|
105
|
+
return;
|
106
|
+
}
|
107
|
+
|
108
|
+
var el = $$('[autofocus]')[0];
|
109
|
+
|
110
|
+
if (!el.disabled) {
|
111
|
+
el.focus();
|
112
|
+
}
|
113
|
+
},
|
114
|
+
// FORMALIZE.init.placeholder
|
115
|
+
placeholder: function() {
|
116
|
+
if (PLACEHOLDER_SUPPORTED || !$$('[placeholder]').length) {
|
117
|
+
// Exit if placeholder is supported natively,
|
118
|
+
// or if page does not have any placeholder.
|
119
|
+
return;
|
120
|
+
}
|
121
|
+
|
122
|
+
FORMALIZE.misc.add_placeholder();
|
123
|
+
|
124
|
+
$$('[placeholder]').each(function(el) {
|
125
|
+
// Placeholder obscured in older browsers,
|
126
|
+
// so there's no point adding to password.
|
127
|
+
if (el.type === 'password') {
|
128
|
+
return;
|
129
|
+
}
|
130
|
+
|
131
|
+
var text = el.get('placeholder');
|
132
|
+
|
133
|
+
el.addEvents({
|
134
|
+
focus: function() {
|
135
|
+
if (el.value === text) {
|
136
|
+
el.set('value', '').removeClass('placeholder_text');
|
137
|
+
}
|
138
|
+
},
|
139
|
+
blur: function() {
|
140
|
+
FORMALIZE.misc.add_placeholder();
|
141
|
+
}
|
142
|
+
});
|
143
|
+
|
144
|
+
// Prevent <form> from accidentally
|
145
|
+
// submitting the placeholder text.
|
146
|
+
var form = el.getParent('form');
|
147
|
+
|
148
|
+
form && form.addEvents({
|
149
|
+
'submit': function() {
|
150
|
+
if (el.value === text) {
|
151
|
+
el.set('value', '').removeClass('placeholder_text');
|
152
|
+
}
|
153
|
+
},
|
154
|
+
'reset': function() {
|
155
|
+
setTimeout(FORMALIZE.misc.add_placeholder, 50);
|
156
|
+
}
|
157
|
+
});
|
158
|
+
});
|
159
|
+
}
|
160
|
+
},
|
161
|
+
// FORMALIZE.misc
|
162
|
+
misc: {
|
163
|
+
// FORMALIZE.misc.add_placeholder
|
164
|
+
add_placeholder: function() {
|
165
|
+
if (PLACEHOLDER_SUPPORTED || !$$('[placeholder]').length) {
|
166
|
+
// Exit if placeholder is supported natively,
|
167
|
+
// or if page does not have any placeholder.
|
168
|
+
return;
|
169
|
+
}
|
170
|
+
|
171
|
+
$$('[placeholder]').each(function(el) {
|
172
|
+
// Placeholder obscured in older browsers,
|
173
|
+
// so there's no point adding to password.
|
174
|
+
if (el.type === 'password') {
|
175
|
+
return;
|
176
|
+
}
|
177
|
+
|
178
|
+
var text = el.get('placeholder');
|
179
|
+
|
180
|
+
if (!el.value || el.value === text) {
|
181
|
+
el.set('value', text).addClass('placeholder_text');
|
182
|
+
}
|
183
|
+
});
|
184
|
+
}
|
185
|
+
}
|
186
|
+
};
|
187
|
+
// Alias window, document.
|
188
|
+
})(this, this.document);
|
189
|
+
|
190
|
+
// Automatically calls all functions in FORMALIZE.init
|
191
|
+
$(document).addEvent('domready', function() {
|
192
|
+
FORMALIZE.go();
|
193
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
var FORMALIZE=function(e,t,n){function r(e){var n=t.createElement("b");return n.innerHTML="<!--[if IE "+e+"]><br><![endif]-->",!!n.getElementsByTagName("br").length}var i="placeholder"in t.createElement("input"),s="autofocus"in t.createElement("input"),o=r(6),u=r(7);return{go:function(){var e,t=this.init;for(e in t)t.hasOwnProperty(e)&&t[e]()},init:{disable_link_button:function(){$(t.documentElement).addEvent("click",function(e){var t=e.target,n=t.tagName.toLowerCase()==="a"&&t.className.match("button_disabled");n&&e.preventDefault()})},full_input_size:function(){if(!u||!$$("textarea, input.input_full").length)return;$$("textarea, input.input_full").each(function(e){(new Element("span.input_full_wrap")).wraps(e)})},ie6_skin_inputs:function(){if(!o||!$$("input, select, textarea").length)return;var e=/button|submit|reset/,t=/date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;$$("input").each(function(n){n.getAttribute("type").match(e)?(n.addClass("ie6_button"),n.disabled&&n.addClass("ie6_button_disabled")):n.getAttribute("type").match(t)&&(n.addClass("ie6_input"),n.disabled&&n.addClass("ie6_input_disabled"))}),$$("textarea, select").each(function(e){e.disabled&&e.addClass("ie6_input_disabled")})},autofocus:function(){if(s||!$$("[autofocus]").length)return;var e=$$("[autofocus]")[0];e.disabled||e.focus()},placeholder:function(){if(i||!$$("[placeholder]").length)return;FORMALIZE.misc.add_placeholder(),$$("[placeholder]").each(function(e){if(e.type==="password")return;var t=e.get("placeholder");e.addEvents({focus:function(){e.value===t&&e.set("value","").removeClass("placeholder_text")},blur:function(){FORMALIZE.misc.add_placeholder()}});var n=e.getParent("form");n&&n.addEvents({submit:function(){e.value===t&&e.set("value","").removeClass("placeholder_text")},reset:function(){setTimeout(FORMALIZE.misc.add_placeholder,50)}})})}},misc:{add_placeholder:function(){if(i||!$$("[placeholder]").length)return;$$("[placeholder]").each(function(e){if(e.type==="password")return;var t=e.get("placeholder");(!e.value||e.value===t)&&e.set("value",t).addClass("placeholder_text")})}}}}(this,this.document);$(document).addEvent("domready",function(){FORMALIZE.go()})
|
@@ -0,0 +1,192 @@
|
|
1
|
+
/*
|
2
|
+
Formalize - version 1.2
|
3
|
+
|
4
|
+
Note: This file depends on the Prototype library.
|
5
|
+
*/
|
6
|
+
|
7
|
+
// Module pattern:
|
8
|
+
// http://yuiblog.com/blog/2007/06/12/module-pattern
|
9
|
+
var FORMALIZE = (function(window, document, undefined) {
|
10
|
+
// Internet Explorer detection.
|
11
|
+
function IE(version) {
|
12
|
+
var b = document.createElement('b');
|
13
|
+
b.innerHTML = '<!--[if IE ' + version + ']><br><![endif]-->';
|
14
|
+
return !!b.getElementsByTagName('br').length;
|
15
|
+
}
|
16
|
+
|
17
|
+
// Private constants.
|
18
|
+
var PLACEHOLDER_SUPPORTED = 'placeholder' in document.createElement('input');
|
19
|
+
var AUTOFOCUS_SUPPORTED = 'autofocus' in document.createElement('input');
|
20
|
+
var IE6 = IE(6);
|
21
|
+
var IE7 = IE(7);
|
22
|
+
|
23
|
+
// Expose innards of FORMALIZE.
|
24
|
+
return {
|
25
|
+
// FORMALIZE.go
|
26
|
+
go: function() {
|
27
|
+
var i, j = this.init;
|
28
|
+
|
29
|
+
for (i in j) {
|
30
|
+
j.hasOwnProperty(i) && j[i]();
|
31
|
+
}
|
32
|
+
},
|
33
|
+
// FORMALIZE.init
|
34
|
+
init: {
|
35
|
+
// FORMALIZE.init.disable_link_button
|
36
|
+
disable_link_button: function() {
|
37
|
+
$(document.documentElement).observe('click', function(ev) {
|
38
|
+
var el = ev.target;
|
39
|
+
var is_disabled = el.tagName.toLowerCase() === 'a' && el.className.match('button_disabled');
|
40
|
+
|
41
|
+
if (is_disabled) {
|
42
|
+
ev.preventDefault();
|
43
|
+
}
|
44
|
+
});
|
45
|
+
},
|
46
|
+
// FORMALIZE.init.full_input_size
|
47
|
+
full_input_size: function() {
|
48
|
+
if (!IE7 || !$$('textarea, input.input_full').length) {
|
49
|
+
return;
|
50
|
+
}
|
51
|
+
|
52
|
+
// This fixes width: 100% on <textarea> and class="input_full".
|
53
|
+
// It ensures that form elements don't go wider than container.
|
54
|
+
$$('textarea, input.input_full').each(function(el) {
|
55
|
+
Element.wrap(el, 'span', {'class': 'input_full_wrap'});
|
56
|
+
});
|
57
|
+
},
|
58
|
+
// FORMALIZE.init.ie6_skin_inputs
|
59
|
+
ie6_skin_inputs: function() {
|
60
|
+
// Test for Internet Explorer 6.
|
61
|
+
if (!IE6 || !$$('input, select, textarea').length) {
|
62
|
+
// Exit if the browser is not IE6,
|
63
|
+
// or if no form elements exist.
|
64
|
+
return;
|
65
|
+
}
|
66
|
+
|
67
|
+
// For <input type="submit" />, etc.
|
68
|
+
var button_regex = /button|submit|reset/;
|
69
|
+
|
70
|
+
// For <input type="text" />, etc.
|
71
|
+
var type_regex = /date|datetime|datetime-local|email|month|number|password|range|search|tel|text|time|url|week/;
|
72
|
+
|
73
|
+
$$('input').each(function(el) {
|
74
|
+
// Is it a button?
|
75
|
+
if (el.getAttribute('type').match(button_regex)) {
|
76
|
+
el.addClassName('ie6_button');
|
77
|
+
|
78
|
+
/* Is it disabled? */
|
79
|
+
if (el.disabled) {
|
80
|
+
el.addClassName('ie6_button_disabled');
|
81
|
+
}
|
82
|
+
}
|
83
|
+
// Or is it a textual input?
|
84
|
+
else if (el.getAttribute('type').match(type_regex)) {
|
85
|
+
el.addClassName('ie6_input');
|
86
|
+
|
87
|
+
/* Is it disabled? */
|
88
|
+
if (el.disabled) {
|
89
|
+
el.addClassName('ie6_input_disabled');
|
90
|
+
}
|
91
|
+
}
|
92
|
+
});
|
93
|
+
|
94
|
+
$$('textarea, select').each(function(el) {
|
95
|
+
/* Is it disabled? */
|
96
|
+
if (el.disabled) {
|
97
|
+
el.addClassName('ie6_input_disabled');
|
98
|
+
}
|
99
|
+
});
|
100
|
+
},
|
101
|
+
// FORMALIZE.init.autofocus
|
102
|
+
autofocus: function() {
|
103
|
+
if (AUTOFOCUS_SUPPORTED || !$$('[autofocus]').length) {
|
104
|
+
return;
|
105
|
+
}
|
106
|
+
|
107
|
+
var el = $$('[autofocus]')[0];
|
108
|
+
|
109
|
+
if (!el.disabled) {
|
110
|
+
el.focus();
|
111
|
+
}
|
112
|
+
},
|
113
|
+
// FORMALIZE.init.placeholder
|
114
|
+
placeholder: function() {
|
115
|
+
if (PLACEHOLDER_SUPPORTED || !$$('[placeholder]').length) {
|
116
|
+
// Exit if placeholder is supported natively,
|
117
|
+
// or if page does not have any placeholder.
|
118
|
+
return;
|
119
|
+
}
|
120
|
+
|
121
|
+
FORMALIZE.misc.add_placeholder();
|
122
|
+
|
123
|
+
$$('[placeholder]').each(function(el) {
|
124
|
+
// Placeholder obscured in older browsers,
|
125
|
+
// so there's no point adding to password.
|
126
|
+
if (el.type === 'password') {
|
127
|
+
return;
|
128
|
+
}
|
129
|
+
|
130
|
+
var text = el.getAttribute('placeholder');
|
131
|
+
var form = el.up('form');
|
132
|
+
|
133
|
+
el.observe('focus', function() {
|
134
|
+
if (el.value === text) {
|
135
|
+
el.value = '';
|
136
|
+
el.removeClassName('placeholder_text');
|
137
|
+
}
|
138
|
+
});
|
139
|
+
|
140
|
+
el.observe('blur', function() {
|
141
|
+
FORMALIZE.misc.add_placeholder();
|
142
|
+
});
|
143
|
+
|
144
|
+
// Prevent <form> from accidentally
|
145
|
+
// submitting the placeholder text.
|
146
|
+
form.observe('submit', function() {
|
147
|
+
if (el.value === text) {
|
148
|
+
el.value = '';
|
149
|
+
el.removeClassName('placeholder_text');
|
150
|
+
}
|
151
|
+
});
|
152
|
+
|
153
|
+
form.observe('reset', function() {
|
154
|
+
setTimeout(FORMALIZE.misc.add_placeholder, 50);
|
155
|
+
});
|
156
|
+
});
|
157
|
+
}
|
158
|
+
},
|
159
|
+
// FORMALIZE.misc
|
160
|
+
misc: {
|
161
|
+
// FORMALIZE.misc.add_placeholder
|
162
|
+
add_placeholder: function() {
|
163
|
+
if (PLACEHOLDER_SUPPORTED || !$$('[placeholder]').length) {
|
164
|
+
// Exit if placeholder is supported natively,
|
165
|
+
// or if page does not have any placeholder.
|
166
|
+
return;
|
167
|
+
}
|
168
|
+
|
169
|
+
$$('[placeholder]').each(function(el) {
|
170
|
+
// Placeholder obscured in older browsers,
|
171
|
+
// so there's no point adding to password.
|
172
|
+
if (el.type === 'password') {
|
173
|
+
return;
|
174
|
+
}
|
175
|
+
|
176
|
+
var text = el.getAttribute('placeholder');
|
177
|
+
|
178
|
+
if (!el.value || el.value === text) {
|
179
|
+
el.value = text;
|
180
|
+
el.addClassName('placeholder_text');
|
181
|
+
}
|
182
|
+
});
|
183
|
+
}
|
184
|
+
}
|
185
|
+
};
|
186
|
+
// Alias window, document.
|
187
|
+
})(this, this.document);
|
188
|
+
|
189
|
+
// Automatically calls all functions in FORMALIZE.init
|
190
|
+
$(document).observe('dom:loaded', function() {
|
191
|
+
FORMALIZE.go();
|
192
|
+
});
|