survivalkit 1.0.beta.8 → 1.0.beta.9
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.markdown +3 -0
- data/README.markdown +2 -2
- data/lib/survivalkit.rb +3 -2
- data/stylesheets/survivalkit/fonts/_font-awesome.scss +355 -0
- data/stylesheets/survivalkit/fonts/_league-gothic.scss +46 -0
- data/stylesheets/survivalkit/fonts/_ostrich-sans.scss +69 -0
- data/stylesheets/survivalkit/mixins/_ui.scss +22 -12
- data/stylesheets/survivalkit/survival-kit/_survival-kit.sass +157 -0
- data/templates/clean/manifest.rb +94 -0
- data/templates/drupal/script.js +2 -17
- data/templates/project/libs/jquery-1.8.2.min.js +2 -0
- data/templates/project/libs/modernizr-2.6.2.min.js +815 -0
- data/templates/project/manifest.rb +46 -27
- data/templates/project/script.js +2 -17
- data/templates/project/sources/FitText/README.md +52 -0
- data/templates/project/sources/FitText/example.html +60 -0
- data/templates/project/sources/FitText/jquery.fittext.js +43 -0
- data/templates/shared/fonts/font-awesome/fontawesome-webfont.eot +0 -0
- data/templates/shared/fonts/font-awesome/fontawesome-webfont.svg +255 -0
- data/templates/shared/fonts/font-awesome/fontawesome-webfont.ttf +0 -0
- data/templates/shared/fonts/font-awesome/fontawesome-webfont.woff +0 -0
- data/templates/shared/fonts/league-gothic/leaguegothic-condensed-italic-webfont.eot +0 -0
- data/templates/shared/fonts/league-gothic/leaguegothic-condensed-italic-webfont.svg +224 -0
- data/templates/shared/fonts/league-gothic/leaguegothic-condensed-italic-webfont.ttf +0 -0
- data/templates/shared/fonts/league-gothic/leaguegothic-condensed-italic-webfont.woff +0 -0
- data/templates/shared/fonts/league-gothic/leaguegothic-condensed-regular-webfont.eot +0 -0
- data/templates/shared/fonts/league-gothic/leaguegothic-condensed-regular-webfont.svg +224 -0
- data/templates/shared/fonts/league-gothic/leaguegothic-condensed-regular-webfont.ttf +0 -0
- data/templates/shared/fonts/league-gothic/leaguegothic-condensed-regular-webfont.woff +0 -0
- data/templates/shared/fonts/league-gothic/leaguegothic-italic-webfont.eot +0 -0
- data/templates/shared/fonts/league-gothic/leaguegothic-italic-webfont.svg +224 -0
- data/templates/shared/fonts/league-gothic/leaguegothic-italic-webfont.ttf +0 -0
- data/templates/shared/fonts/league-gothic/leaguegothic-italic-webfont.woff +0 -0
- data/templates/shared/fonts/league-gothic/leaguegothic-regular-webfont.eot +0 -0
- data/templates/shared/fonts/league-gothic/leaguegothic-regular-webfont.svg +223 -0
- data/templates/shared/fonts/league-gothic/leaguegothic-regular-webfont.ttf +0 -0
- data/templates/shared/fonts/league-gothic/leaguegothic-regular-webfont.woff +0 -0
- data/templates/shared/fonts/ostrich/ostrich-black-webfont.eot +0 -0
- data/templates/shared/fonts/ostrich/ostrich-black-webfont.svg +141 -0
- data/templates/shared/fonts/ostrich/ostrich-black-webfont.ttf +0 -0
- data/templates/shared/fonts/ostrich/ostrich-black-webfont.woff +0 -0
- data/templates/shared/fonts/ostrich/ostrich-bold-webfont.eot +0 -0
- data/templates/shared/fonts/ostrich/ostrich-bold-webfont.svg +141 -0
- data/templates/shared/fonts/ostrich/ostrich-bold-webfont.ttf +0 -0
- data/templates/shared/fonts/ostrich/ostrich-bold-webfont.woff +0 -0
- data/templates/shared/fonts/ostrich/ostrich-dashed-webfont.eot +0 -0
- data/templates/shared/fonts/ostrich/ostrich-dashed-webfont.svg +141 -0
- data/templates/shared/fonts/ostrich/ostrich-dashed-webfont.ttf +0 -0
- data/templates/shared/fonts/ostrich/ostrich-dashed-webfont.woff +0 -0
- data/templates/shared/fonts/ostrich/ostrich-light-webfont.eot +0 -0
- data/templates/shared/fonts/ostrich/ostrich-light-webfont.svg +140 -0
- data/templates/shared/fonts/ostrich/ostrich-light-webfont.ttf +0 -0
- data/templates/shared/fonts/ostrich/ostrich-light-webfont.woff +0 -0
- data/templates/shared/fonts/ostrich/ostrich-regular-webfont.eot +0 -0
- data/templates/shared/fonts/ostrich/ostrich-regular-webfont.svg +141 -0
- data/templates/shared/fonts/ostrich/ostrich-regular-webfont.ttf +0 -0
- data/templates/shared/fonts/ostrich/ostrich-regular-webfont.woff +0 -0
- data/templates/shared/fonts/ostrich/ostrich-rounded-webfont.eot +0 -0
- data/templates/shared/fonts/ostrich/ostrich-rounded-webfont.svg +141 -0
- data/templates/shared/fonts/ostrich/ostrich-rounded-webfont.ttf +0 -0
- data/templates/shared/fonts/ostrich/ostrich-rounded-webfont.woff +0 -0
- data/templates/shared/partials/01-variables/_colors.scss +1 -1
- data/templates/shared/partials/01-variables/_fonts.scss +10 -0
- data/templates/shared/partials/06-ui-patterns/_drupal-patterns.scss +4 -5
- data/templates/shared/partials/07-styletile/_tile-design.scss +2 -2
- data/templates/shared/style.scss +2 -1
- metadata +73 -187
- data/stylesheets/survivalkit/survival_kit/_survival-kit.scss +0 -145
- data/templates/drupal/libs/320-up/helper.js +0 -146
- data/templates/drupal/libs/320-up/imgSizer.js +0 -61
- data/templates/drupal/libs/dd_belatedpng.js +0 -13
- data/templates/drupal/libs/formalize/README.txt +0 -11
- data/templates/drupal/libs/formalize/dojo.formalize.js +0 -174
- data/templates/drupal/libs/formalize/extjs.formalize.js +0 -168
- data/templates/drupal/libs/formalize/jquery.formalize.js +0 -158
- data/templates/drupal/libs/formalize/mootools.formalize.js +0 -163
- data/templates/drupal/libs/formalize/prototype.formalize.js +0 -171
- data/templates/drupal/libs/formalize/yui.formalize.js +0 -168
- data/templates/drupal/libs/jquery-1.6.js +0 -8865
- data/templates/drupal/libs/jquery-1.6.min.js +0 -16
- data/templates/drupal/libs/modernizr-2.0.min.js +0 -4
- data/templates/drupal/libs/mootools-core-1.3.1-full-compat-yc.js +0 -485
- data/templates/drupal/libs/plugins.js +0 -58
- data/templates/drupal/libs/respond.min.js +0 -7
- data/templates/drupal/libs/selectivizr-min.js +0 -5
- data/templates/drupal/libs/selectivizr.js +0 -5
- data/templates/project/files/apple-touch-icon-114x114-precomposed.png +0 -0
- data/templates/project/files/apple-touch-icon-72x72-precomposed.png +0 -0
- data/templates/project/files/apple-touch-icon.png +0 -0
- data/templates/project/files/crossdomain.xml +0 -25
- data/templates/project/files/favicon.ico +0 -0
- data/templates/project/files/favicon.png +0 -0
- data/templates/project/files/google.yml +0 -22
- data/templates/project/files/htaccess.htaccess +0 -478
- data/templates/project/files/html/404.html +0 -22
- data/templates/project/files/html/formalize_jquery_demo.html +0 -288
- data/templates/project/files/html/formalize_jquery_disabled.html +0 -288
- data/templates/project/files/html/formalize_jquery_errors.html +0 -288
- data/templates/project/files/html/index.html +0 -100
- data/templates/project/files/html/survivalkit/elements-common.html +0 -588
- data/templates/project/files/html/survivalkit/elements-html5.html +0 -2988
- data/templates/project/files/html/survivalkit/elements-typography.html +0 -240
- data/templates/project/files/html/survivalkit/elements-ui-patterns-drupal-css.html +0 -1883
- data/templates/project/files/html/survivalkit/elements-ui-patterns-drupal.html +0 -1882
- data/templates/project/files/html/survivalkit/elements-ui-patterns.html +0 -267
- data/templates/project/files/html/survivalkit/index.html +0 -132
- data/templates/project/files/html/survivalkit/styletile/index.html +0 -1
- data/templates/project/files/html/survivalkit/styletile/styletile.html +0 -215
- data/templates/project/files/humans.txt +0 -43
- data/templates/project/files/robots.txt +0 -5
- data/templates/project/libs/320-up/helper.js +0 -146
- data/templates/project/libs/320-up/imgSizer.js +0 -61
- data/templates/project/libs/jquery-1.6.js +0 -8865
- data/templates/project/libs/jquery-1.6.min.js +0 -16
- data/templates/project/libs/modernizr-2.0.min.js +0 -4
- data/templates/project/libs/plugins.js +0 -58
- data/templates/project/libs/selectivizr.js +0 -5
- data/templates/project/templates/_flashes.html.haml +0 -4
- data/templates/project/templates/_footer.html.haml +0 -2
- data/templates/project/templates/_head.html.haml +0 -26
- data/templates/project/templates/_header.html.haml +0 -1
- data/templates/project/templates/_javascripts.html.haml +0 -27
- data/templates/project/templates/_stylesheets.html.haml +0 -5
- data/templates/project/templates/application.html.haml +0 -28
- data/templates/project/templates/old/_layout.haml +0 -1
- data/templates/project/templates/old/home.html.haml +0 -14
- data/templates/project/templates/old/layouts/default.haml +0 -62
- data/templates/project/templates/old/layouts/survivalkit/default.haml +0 -64
- data/templates/project/templates/old/layouts/survivalkit/styletile.haml +0 -64
- data/templates/project/templates/old/survivalkit/_layout.haml +0 -1
- data/templates/project/templates/old/survivalkit/elements-common.haml +0 -33
- data/templates/project/templates/old/survivalkit/elements-html5.haml +0 -71
- data/templates/project/templates/old/survivalkit/elements-typography.haml +0 -100
- data/templates/project/templates/old/survivalkit/elements-ui-patterns-drupal.haml +0 -38
- data/templates/project/templates/old/survivalkit/elements-ui-patterns.haml +0 -23
- data/templates/project/templates/old/survivalkit/index.haml +0 -2
- data/templates/project/templates/old/survivalkit/partials/common/abbr.haml +0 -8
- data/templates/project/templates/old/survivalkit/partials/common/acronym.haml +0 -8
- data/templates/project/templates/old/survivalkit/partials/common/characters.haml +0 -11
- data/templates/project/templates/old/survivalkit/partials/common/cite.haml +0 -12
- data/templates/project/templates/old/survivalkit/partials/common/code.haml +0 -8
- data/templates/project/templates/old/survivalkit/partials/common/dfn.haml +0 -8
- data/templates/project/templates/old/survivalkit/partials/common/em.haml +0 -10
- data/templates/project/templates/old/survivalkit/partials/common/forms.haml +0 -27
- data/templates/project/templates/old/survivalkit/partials/common/headers.haml +0 -23
- data/templates/project/templates/old/survivalkit/partials/common/inline-images.haml +0 -9
- data/templates/project/templates/old/survivalkit/partials/common/kbd.haml +0 -10
- data/templates/project/templates/old/survivalkit/partials/common/links.haml +0 -10
- data/templates/project/templates/old/survivalkit/partials/common/lists.haml +0 -55
- data/templates/project/templates/old/survivalkit/partials/common/others.haml +0 -35
- data/templates/project/templates/old/survivalkit/partials/common/paragraphs.haml +0 -15
- data/templates/project/templates/old/survivalkit/partials/common/pre.haml +0 -27
- data/templates/project/templates/old/survivalkit/partials/common/q.haml +0 -8
- data/templates/project/templates/old/survivalkit/partials/common/samp.haml +0 -8
- data/templates/project/templates/old/survivalkit/partials/common/strong.haml +0 -8
- data/templates/project/templates/old/survivalkit/partials/common/tables.haml +0 -43
- data/templates/project/templates/old/survivalkit/partials/common/var.haml +0 -8
- data/templates/project/templates/old/survivalkit/partials/header-styletile.haml +0 -9
- data/templates/project/templates/old/survivalkit/partials/header.haml +0 -6
- data/templates/project/templates/old/survivalkit/partials/html5/a.haml +0 -36
- data/templates/project/templates/old/survivalkit/partials/html5/abbr.haml +0 -26
- data/templates/project/templates/old/survivalkit/partials/html5/address.haml +0 -27
- data/templates/project/templates/old/survivalkit/partials/html5/all-headings.haml +0 -31
- data/templates/project/templates/old/survivalkit/partials/html5/article.haml +0 -22
- data/templates/project/templates/old/survivalkit/partials/html5/aside.haml +0 -20
- data/templates/project/templates/old/survivalkit/partials/html5/b.haml +0 -21
- data/templates/project/templates/old/survivalkit/partials/html5/bdi.haml +0 -30
- data/templates/project/templates/old/survivalkit/partials/html5/blockquote.haml +0 -32
- data/templates/project/templates/old/survivalkit/partials/html5/cite.haml +0 -46
- data/templates/project/templates/old/survivalkit/partials/html5/code.haml +0 -70
- data/templates/project/templates/old/survivalkit/partials/html5/details.haml +0 -42
- data/templates/project/templates/old/survivalkit/partials/html5/dfn.haml +0 -52
- data/templates/project/templates/old/survivalkit/partials/html5/dl.haml +0 -69
- data/templates/project/templates/old/survivalkit/partials/html5/em.haml +0 -15
- data/templates/project/templates/old/survivalkit/partials/html5/fieldset.haml +0 -49
- data/templates/project/templates/old/survivalkit/partials/html5/figure.haml +0 -48
- data/templates/project/templates/old/survivalkit/partials/html5/footer.haml +0 -37
- data/templates/project/templates/old/survivalkit/partials/html5/header.haml +0 -44
- data/templates/project/templates/old/survivalkit/partials/html5/hgroup.haml +0 -20
- data/templates/project/templates/old/survivalkit/partials/html5/hr.haml +0 -52
- data/templates/project/templates/old/survivalkit/partials/html5/i.haml +0 -28
- data/templates/project/templates/old/survivalkit/partials/html5/kbd.haml +0 -19
- data/templates/project/templates/old/survivalkit/partials/html5/label.haml +0 -18
- data/templates/project/templates/old/survivalkit/partials/html5/li.haml +0 -91
- data/templates/project/templates/old/survivalkit/partials/html5/mark.haml +0 -30
- data/templates/project/templates/old/survivalkit/partials/html5/menu.haml +0 -39
- data/templates/project/templates/old/survivalkit/partials/html5/nav.haml +0 -68
- data/templates/project/templates/old/survivalkit/partials/html5/ol.haml +0 -23
- data/templates/project/templates/old/survivalkit/partials/html5/p.haml +0 -41
- data/templates/project/templates/old/survivalkit/partials/html5/pre.haml +0 -48
- data/templates/project/templates/old/survivalkit/partials/html5/q.haml +0 -34
- data/templates/project/templates/old/survivalkit/partials/html5/ruby.haml +0 -55
- data/templates/project/templates/old/survivalkit/partials/html5/s.haml +0 -17
- data/templates/project/templates/old/survivalkit/partials/html5/samp.haml +0 -27
- data/templates/project/templates/old/survivalkit/partials/html5/sample-forms.haml +0 -52
- data/templates/project/templates/old/survivalkit/partials/html5/sample-tables.haml +0 -152
- data/templates/project/templates/old/survivalkit/partials/html5/section.haml +0 -21
- data/templates/project/templates/old/survivalkit/partials/html5/small.haml +0 -33
- data/templates/project/templates/old/survivalkit/partials/html5/strong.haml +0 -25
- data/templates/project/templates/old/survivalkit/partials/html5/sub-sup.haml +0 -58
- data/templates/project/templates/old/survivalkit/partials/html5/table.haml +0 -196
- data/templates/project/templates/old/survivalkit/partials/html5/text-summary.haml +0 -305
- data/templates/project/templates/old/survivalkit/partials/html5/thead.haml +0 -67
- data/templates/project/templates/old/survivalkit/partials/html5/time.haml +0 -31
- data/templates/project/templates/old/survivalkit/partials/html5/ul.haml +0 -21
- data/templates/project/templates/old/survivalkit/partials/menu.haml +0 -14
- data/templates/project/templates/old/survivalkit/partials/patterns-drupal/block.haml +0 -7
- data/templates/project/templates/old/survivalkit/partials/patterns-drupal/breadcrumbs.haml +0 -7
- data/templates/project/templates/old/survivalkit/partials/patterns-drupal/comments.haml +0 -69
- data/templates/project/templates/old/survivalkit/partials/patterns-drupal/field-image.haml +0 -7
- data/templates/project/templates/old/survivalkit/partials/patterns-drupal/form-comment.haml +0 -54
- data/templates/project/templates/old/survivalkit/partials/patterns-drupal/form-login.haml +0 -23
- data/templates/project/templates/old/survivalkit/partials/patterns-drupal/form-new-account.haml +0 -24
- data/templates/project/templates/old/survivalkit/partials/patterns-drupal/form-new-password.haml +0 -16
- data/templates/project/templates/old/survivalkit/partials/patterns-drupal/links.haml +0 -6
- data/templates/project/templates/old/survivalkit/partials/patterns-drupal/menu.haml +0 -10
- data/templates/project/templates/old/survivalkit/partials/patterns-drupal/messages.haml +0 -21
- data/templates/project/templates/old/survivalkit/partials/patterns-drupal/node.haml +0 -28
- data/templates/project/templates/old/survivalkit/partials/patterns-drupal/pager.haml +0 -17
- data/templates/project/templates/old/survivalkit/partials/patterns-drupal/rss-link.haml +0 -5
- data/templates/project/templates/old/survivalkit/partials/patterns-drupal/search.haml +0 -14
- data/templates/project/templates/old/survivalkit/partials/patterns-drupal/site-name.haml +0 -6
- data/templates/project/templates/old/survivalkit/partials/patterns-drupal/tabs.haml +0 -14
- data/templates/project/templates/old/survivalkit/partials/patterns-drupal/taxonomy.haml +0 -10
- data/templates/project/templates/old/survivalkit/partials/patterns-general/block.haml +0 -7
- data/templates/project/templates/old/survivalkit/partials/patterns-general/breadcrumbs.haml +0 -7
- data/templates/project/templates/old/survivalkit/partials/patterns-general/comments.haml +0 -69
- data/templates/project/templates/old/survivalkit/partials/patterns-general/field-image.haml +0 -7
- data/templates/project/templates/old/survivalkit/partials/patterns-general/form-comment.haml +0 -54
- data/templates/project/templates/old/survivalkit/partials/patterns-general/form-login.haml +0 -23
- data/templates/project/templates/old/survivalkit/partials/patterns-general/form-new-account.haml +0 -24
- data/templates/project/templates/old/survivalkit/partials/patterns-general/form-new-password.haml +0 -16
- data/templates/project/templates/old/survivalkit/partials/patterns-general/links.haml +0 -6
- data/templates/project/templates/old/survivalkit/partials/patterns-general/menu.haml +0 -10
- data/templates/project/templates/old/survivalkit/partials/patterns-general/messages.haml +0 -21
- data/templates/project/templates/old/survivalkit/partials/patterns-general/node.haml +0 -28
- data/templates/project/templates/old/survivalkit/partials/patterns-general/pager.haml +0 -17
- data/templates/project/templates/old/survivalkit/partials/patterns-general/rss-link.haml +0 -5
- data/templates/project/templates/old/survivalkit/partials/patterns-general/search.haml +0 -14
- data/templates/project/templates/old/survivalkit/partials/patterns-general/site-name.haml +0 -6
- data/templates/project/templates/old/survivalkit/partials/patterns-general/tabs.haml +0 -14
- data/templates/project/templates/old/survivalkit/partials/patterns-general/taxonomy.haml +0 -10
- data/templates/project/templates/old/survivalkit/styletile/_layout.haml +0 -1
- data/templates/project/templates/old/survivalkit/styletile/index.redirect +0 -1
- data/templates/project/templates/old/survivalkit/styletile/styletile.haml +0 -60
- data/templates/project/templates/old/view_helpers.rb +0 -25
- data/templates/shared/survivalkit/drupal7.scss +0 -3224
- data/templates/shared/survivalkit/survivalkit.scss +0 -32
@@ -1,146 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* MBP - Mobile boilerplate helper functions
|
3
|
-
*/
|
4
|
-
(function(document){
|
5
|
-
|
6
|
-
window.MBP = window.MBP || {};
|
7
|
-
|
8
|
-
// Fix for iPhone viewport scale bug
|
9
|
-
// http://www.blog.highub.com/mobile-2/a-fix-for-iphone-viewport-scale-bug/
|
10
|
-
|
11
|
-
MBP.viewportmeta = document.querySelector && document.querySelector('meta[name="viewport"]');
|
12
|
-
MBP.ua = navigator.userAgent;
|
13
|
-
|
14
|
-
MBP.scaleFix = function () {
|
15
|
-
if (MBP.viewportmeta && /iPhone|iPad/.test(MBP.ua) && !/Opera Mini/.test(MBP.ua)) {
|
16
|
-
MBP.viewportmeta.content = "width=device-width, minimum-scale=1.0, maximum-scale=1.0";
|
17
|
-
document.addEventListener("gesturestart", MBP.gestureStart, false);
|
18
|
-
}
|
19
|
-
};
|
20
|
-
MBP.gestureStart = function () {
|
21
|
-
MBP.viewportmeta.content = "width=device-width, minimum-scale=0.25, maximum-scale=1.6";
|
22
|
-
};
|
23
|
-
|
24
|
-
|
25
|
-
// Hide URL Bar for iOS
|
26
|
-
// http://remysharp.com/2010/08/05/doing-it-right-skipping-the-iphone-url-bar/
|
27
|
-
|
28
|
-
MBP.hideUrlBar = function () {
|
29
|
-
/iPhone/.test(MBP.ua) && !pageYOffset && !location.hash && setTimeout(function () {
|
30
|
-
window.scrollTo(0, 1);
|
31
|
-
}, 1000);
|
32
|
-
};
|
33
|
-
|
34
|
-
|
35
|
-
// Fast Buttons - read wiki below before using
|
36
|
-
// https://github.com/shichuan/mobile-html5-boilerplate/wiki/JavaScript-Helper
|
37
|
-
|
38
|
-
MBP.fastButton = function (element, handler) {
|
39
|
-
this.element = element;
|
40
|
-
this.handler = handler;
|
41
|
-
if (element.addEventListener) {
|
42
|
-
element.addEventListener('touchstart', this, false);
|
43
|
-
element.addEventListener('click', this, false);
|
44
|
-
}
|
45
|
-
};
|
46
|
-
|
47
|
-
MBP.fastButton.prototype.handleEvent = function(event) {
|
48
|
-
switch (event.type) {
|
49
|
-
case 'touchstart': this.onTouchStart(event); break;
|
50
|
-
case 'touchmove': this.onTouchMove(event); break;
|
51
|
-
case 'touchend': this.onClick(event); break;
|
52
|
-
case 'click': this.onClick(event); break;
|
53
|
-
}
|
54
|
-
};
|
55
|
-
|
56
|
-
MBP.fastButton.prototype.onTouchStart = function(event) {
|
57
|
-
event.stopPropagation();
|
58
|
-
this.element.addEventListener('touchend', this, false);
|
59
|
-
document.body.addEventListener('touchmove', this, false);
|
60
|
-
this.startX = event.touches[0].clientX;
|
61
|
-
this.startY = event.touches[0].clientY;
|
62
|
-
this.element.style.backgroundColor = "rgba(0,0,0,.7)";
|
63
|
-
};
|
64
|
-
|
65
|
-
MBP.fastButton.prototype.onTouchMove = function(event) {
|
66
|
-
if(Math.abs(event.touches[0].clientX - this.startX) > 10 || Math.abs(event.touches[0].clientY - this.startY) > 10) {
|
67
|
-
this.reset();
|
68
|
-
}
|
69
|
-
};
|
70
|
-
|
71
|
-
MBP.fastButton.prototype.onClick = function(event) {
|
72
|
-
event.stopPropagation();
|
73
|
-
this.reset();
|
74
|
-
this.handler(event);
|
75
|
-
if(event.type == 'touchend') {
|
76
|
-
MBP.preventGhostClick(this.startX, this.startY);
|
77
|
-
}
|
78
|
-
this.element.style.backgroundColor = "";
|
79
|
-
};
|
80
|
-
|
81
|
-
MBP.fastButton.prototype.reset = function() {
|
82
|
-
this.element.removeEventListener('touchend', this, false);
|
83
|
-
document.body.removeEventListener('touchmove', this, false);
|
84
|
-
this.element.style.backgroundColor = "";
|
85
|
-
};
|
86
|
-
|
87
|
-
MBP.preventGhostClick = function (x, y) {
|
88
|
-
MBP.coords.push(x, y);
|
89
|
-
window.setTimeout(function (){
|
90
|
-
MBP.coords.splice(0, 2);
|
91
|
-
}, 2500);
|
92
|
-
};
|
93
|
-
|
94
|
-
MBP.ghostClickHandler = function (event) {
|
95
|
-
for(var i = 0, len = MBP.coords.length; i < len; i += 2) {
|
96
|
-
var x = MBP.coords[i];
|
97
|
-
var y = MBP.coords[i + 1];
|
98
|
-
if(Math.abs(event.clientX - x) < 25 && Math.abs(event.clientY - y) < 25) {
|
99
|
-
event.stopPropagation();
|
100
|
-
event.preventDefault();
|
101
|
-
}
|
102
|
-
}
|
103
|
-
};
|
104
|
-
|
105
|
-
if (document.addEventListener) {
|
106
|
-
document.addEventListener('click', MBP.ghostClickHandler, true);
|
107
|
-
}
|
108
|
-
|
109
|
-
MBP.coords = [];
|
110
|
-
|
111
|
-
|
112
|
-
// iOS Startup Image
|
113
|
-
// https://github.com/shichuan/mobile-html5-boilerplate/issues#issue/2
|
114
|
-
|
115
|
-
MBP.splash = function () {
|
116
|
-
var filename = navigator.platform === 'iPad' ? 'h/' : 'l/';
|
117
|
-
document.write('<link rel="apple-touch-startup-image" href="/img/' + filename + 'splash.png" />' );
|
118
|
-
};
|
119
|
-
|
120
|
-
|
121
|
-
// Autogrow
|
122
|
-
// http://googlecode.blogspot.com/2009/07/gmail-for-mobile-html5-series.html
|
123
|
-
|
124
|
-
MBP.autogrow = function (element, lh) {
|
125
|
-
|
126
|
-
function handler(e){
|
127
|
-
var newHeight = this.scrollHeight,
|
128
|
-
currentHeight = this.clientHeight;
|
129
|
-
if (newHeight > currentHeight) {
|
130
|
-
this.style.height = newHeight + 3 * textLineHeight + "px";
|
131
|
-
}
|
132
|
-
}
|
133
|
-
|
134
|
-
var setLineHeight = (lh) ? lh : 12,
|
135
|
-
textLineHeight = element.currentStyle ? element.currentStyle.lineHeight :
|
136
|
-
getComputedStyle(element, null).lineHeight;
|
137
|
-
|
138
|
-
textLineHeight = (textLineHeight.indexOf("px") == -1) ? setLineHeight :
|
139
|
-
parseInt(textLineHeight, 10);
|
140
|
-
|
141
|
-
element.style.overflow = "hidden";
|
142
|
-
element.addEventListener ? element.addEventListener('keyup', handler, false) :
|
143
|
-
element.attachEvent('onkeyup', handler);
|
144
|
-
};
|
145
|
-
|
146
|
-
})(document);
|
@@ -1,61 +0,0 @@
|
|
1
|
-
var imgSizer = {
|
2
|
-
Config : {
|
3
|
-
imgCache : []
|
4
|
-
,spacer : "/path/to/your/spacer.gif"
|
5
|
-
}
|
6
|
-
|
7
|
-
,collate : function(aScope) {
|
8
|
-
var isOldIE = (document.all && !window.opera && !window.XDomainRequest) ? 1 : 0;
|
9
|
-
if (isOldIE && document.getElementsByTagName) {
|
10
|
-
var c = imgSizer;
|
11
|
-
var imgCache = c.Config.imgCache;
|
12
|
-
|
13
|
-
var images = (aScope && aScope.length) ? aScope : document.getElementsByTagName("img");
|
14
|
-
for (var i = 0; i < images.length; i++) {
|
15
|
-
images[i].origWidth = images[i].offsetWidth;
|
16
|
-
images[i].origHeight = images[i].offsetHeight;
|
17
|
-
|
18
|
-
imgCache.push(images[i]);
|
19
|
-
c.ieAlpha(images[i]);
|
20
|
-
images[i].style.width = "100%";
|
21
|
-
}
|
22
|
-
|
23
|
-
if (imgCache.length) {
|
24
|
-
c.resize(function() {
|
25
|
-
for (var i = 0; i < imgCache.length; i++) {
|
26
|
-
var ratio = (imgCache[i].offsetWidth / imgCache[i].origWidth);
|
27
|
-
imgCache[i].style.height = (imgCache[i].origHeight * ratio) + "px";
|
28
|
-
}
|
29
|
-
});
|
30
|
-
}
|
31
|
-
}
|
32
|
-
}
|
33
|
-
|
34
|
-
,ieAlpha : function(img) {
|
35
|
-
var c = imgSizer;
|
36
|
-
if (img.oldSrc) {
|
37
|
-
img.src = img.oldSrc;
|
38
|
-
}
|
39
|
-
var src = img.src;
|
40
|
-
img.style.width = img.offsetWidth + "px";
|
41
|
-
img.style.height = img.offsetHeight + "px";
|
42
|
-
img.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='scale')"
|
43
|
-
img.oldSrc = src;
|
44
|
-
img.src = c.Config.spacer;
|
45
|
-
}
|
46
|
-
|
47
|
-
// Ghettomodified version of Simon Willison's addLoadEvent() -- http://simonwillison.net/2004/May/26/addLoadEvent/
|
48
|
-
,resize : function(func) {
|
49
|
-
var oldonresize = window.onresize;
|
50
|
-
if (typeof window.onresize != 'function') {
|
51
|
-
window.onresize = func;
|
52
|
-
} else {
|
53
|
-
window.onresize = function() {
|
54
|
-
if (oldonresize) {
|
55
|
-
oldonresize();
|
56
|
-
}
|
57
|
-
func();
|
58
|
-
}
|
59
|
-
}
|
60
|
-
}
|
61
|
-
}
|
@@ -1,13 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* DD_belatedPNG: Adds IE6 support: PNG images for CSS background-image and HTML <IMG/>.
|
3
|
-
* Author: Drew Diller
|
4
|
-
* Email: drew.diller@gmail.com
|
5
|
-
* URL: http://www.dillerdesign.com/experiment/DD_belatedPNG/
|
6
|
-
* Version: 0.0.8a
|
7
|
-
* Licensed under the MIT License: http://dillerdesign.com/experiment/DD_belatedPNG/#license
|
8
|
-
*
|
9
|
-
* Example usage:
|
10
|
-
* DD_belatedPNG.fix('.png_bg'); // argument is a CSS selector
|
11
|
-
* DD_belatedPNG.fixPng( someNode ); // argument is an HTMLDomElement
|
12
|
-
**/
|
13
|
-
var DD_belatedPNG={ns:"DD_belatedPNG",imgSize:{},delay:10,nodesFixed:0,createVmlNameSpace:function(){if(document.namespaces&&!document.namespaces[this.ns]){document.namespaces.add(this.ns,"urn:schemas-microsoft-com:vml")}},createVmlStyleSheet:function(){var b,a;b=document.createElement("style");b.setAttribute("media","screen");document.documentElement.firstChild.insertBefore(b,document.documentElement.firstChild.firstChild);if(b.styleSheet){b=b.styleSheet;b.addRule(this.ns+"\\:*","{behavior:url(#default#VML)}");b.addRule(this.ns+"\\:shape","position:absolute;");b.addRule("img."+this.ns+"_sizeFinder","behavior:none; border:none; position:absolute; z-index:-1; top:-10000px; visibility:hidden;");this.screenStyleSheet=b;a=document.createElement("style");a.setAttribute("media","print");document.documentElement.firstChild.insertBefore(a,document.documentElement.firstChild.firstChild);a=a.styleSheet;a.addRule(this.ns+"\\:*","{display: none !important;}");a.addRule("img."+this.ns+"_sizeFinder","{display: none !important;}")}},readPropertyChange:function(){var b,c,a;b=event.srcElement;if(!b.vmlInitiated){return}if(event.propertyName.search("background")!=-1||event.propertyName.search("border")!=-1){DD_belatedPNG.applyVML(b)}if(event.propertyName=="style.display"){c=(b.currentStyle.display=="none")?"none":"block";for(a in b.vml){if(b.vml.hasOwnProperty(a)){b.vml[a].shape.style.display=c}}}if(event.propertyName.search("filter")!=-1){DD_belatedPNG.vmlOpacity(b)}},vmlOpacity:function(b){if(b.currentStyle.filter.search("lpha")!=-1){var a=b.currentStyle.filter;a=parseInt(a.substring(a.lastIndexOf("=")+1,a.lastIndexOf(")")),10)/100;b.vml.color.shape.style.filter=b.currentStyle.filter;b.vml.image.fill.opacity=a}},handlePseudoHover:function(a){setTimeout(function(){DD_belatedPNG.applyVML(a)},1)},fix:function(a){if(this.screenStyleSheet){var c,b;c=a.split(",");for(b=0;b<c.length;b++){this.screenStyleSheet.addRule(c[b],"behavior:expression(DD_belatedPNG.fixPng(this))")}}},applyVML:function(a){a.runtimeStyle.cssText="";this.vmlFill(a);this.vmlOffsets(a);this.vmlOpacity(a);if(a.isImg){this.copyImageBorders(a)}},attachHandlers:function(i){var d,c,g,e,b,f;d=this;c={resize:"vmlOffsets",move:"vmlOffsets"};if(i.nodeName=="A"){e={mouseleave:"handlePseudoHover",mouseenter:"handlePseudoHover",focus:"handlePseudoHover",blur:"handlePseudoHover"};for(b in e){if(e.hasOwnProperty(b)){c[b]=e[b]}}}for(f in c){if(c.hasOwnProperty(f)){g=function(){d[c[f]](i)};i.attachEvent("on"+f,g)}}i.attachEvent("onpropertychange",this.readPropertyChange)},giveLayout:function(a){a.style.zoom=1;if(a.currentStyle.position=="static"){a.style.position="relative"}},copyImageBorders:function(b){var c,a;c={borderStyle:true,borderWidth:true,borderColor:true};for(a in c){if(c.hasOwnProperty(a)){b.vml.color.shape.style[a]=b.currentStyle[a]}}},vmlFill:function(e){if(!e.currentStyle){return}else{var d,f,g,b,a,c;d=e.currentStyle}for(b in e.vml){if(e.vml.hasOwnProperty(b)){e.vml[b].shape.style.zIndex=d.zIndex}}e.runtimeStyle.backgroundColor="";e.runtimeStyle.backgroundImage="";f=true;if(d.backgroundImage!="none"||e.isImg){if(!e.isImg){e.vmlBg=d.backgroundImage;e.vmlBg=e.vmlBg.substr(5,e.vmlBg.lastIndexOf('")')-5)}else{e.vmlBg=e.src}g=this;if(!g.imgSize[e.vmlBg]){a=document.createElement("img");g.imgSize[e.vmlBg]=a;a.className=g.ns+"_sizeFinder";a.runtimeStyle.cssText="behavior:none; position:absolute; left:-10000px; top:-10000px; border:none; margin:0; padding:0;";c=function(){this.width=this.offsetWidth;this.height=this.offsetHeight;g.vmlOffsets(e)};a.attachEvent("onload",c);a.src=e.vmlBg;a.removeAttribute("width");a.removeAttribute("height");document.body.insertBefore(a,document.body.firstChild)}e.vml.image.fill.src=e.vmlBg;f=false}e.vml.image.fill.on=!f;e.vml.image.fill.color="none";e.vml.color.shape.style.backgroundColor=d.backgroundColor;e.runtimeStyle.backgroundImage="none";e.runtimeStyle.backgroundColor="transparent"},vmlOffsets:function(d){var h,n,a,e,g,m,f,l,j,i,k;h=d.currentStyle;n={W:d.clientWidth+1,H:d.clientHeight+1,w:this.imgSize[d.vmlBg].width,h:this.imgSize[d.vmlBg].height,L:d.offsetLeft,T:d.offsetTop,bLW:d.clientLeft,bTW:d.clientTop};a=(n.L+n.bLW==1)?1:0;e=function(b,p,q,c,s,u){b.coordsize=c+","+s;b.coordorigin=u+","+u;b.path="m0,0l"+c+",0l"+c+","+s+"l0,"+s+" xe";b.style.width=c+"px";b.style.height=s+"px";b.style.left=p+"px";b.style.top=q+"px"};e(d.vml.color.shape,(n.L+(d.isImg?0:n.bLW)),(n.T+(d.isImg?0:n.bTW)),(n.W-1),(n.H-1),0);e(d.vml.image.shape,(n.L+n.bLW),(n.T+n.bTW),(n.W),(n.H),1);g={X:0,Y:0};if(d.isImg){g.X=parseInt(h.paddingLeft,10)+1;g.Y=parseInt(h.paddingTop,10)+1}else{for(j in g){if(g.hasOwnProperty(j)){this.figurePercentage(g,n,j,h["backgroundPosition"+j])}}}d.vml.image.fill.position=(g.X/n.W)+","+(g.Y/n.H);m=h.backgroundRepeat;f={T:1,R:n.W+a,B:n.H,L:1+a};l={X:{b1:"L",b2:"R",d:"W"},Y:{b1:"T",b2:"B",d:"H"}};if(m!="repeat"||d.isImg){i={T:(g.Y),R:(g.X+n.w),B:(g.Y+n.h),L:(g.X)};if(m.search("repeat-")!=-1){k=m.split("repeat-")[1].toUpperCase();i[l[k].b1]=1;i[l[k].b2]=n[l[k].d]}if(i.B>n.H){i.B=n.H}d.vml.image.shape.style.clip="rect("+i.T+"px "+(i.R+a)+"px "+i.B+"px "+(i.L+a)+"px)"}else{d.vml.image.shape.style.clip="rect("+f.T+"px "+f.R+"px "+f.B+"px "+f.L+"px)"}},figurePercentage:function(d,c,f,a){var b,e;e=true;b=(f=="X");switch(a){case"left":case"top":d[f]=0;break;case"center":d[f]=0.5;break;case"right":case"bottom":d[f]=1;break;default:if(a.search("%")!=-1){d[f]=parseInt(a,10)/100}else{e=false}}d[f]=Math.ceil(e?((c[b?"W":"H"]*d[f])-(c[b?"w":"h"]*d[f])):parseInt(a,10));if(d[f]%2===0){d[f]++}return d[f]},fixPng:function(c){c.style.behavior="none";var g,b,f,a,d;if(c.nodeName=="BODY"||c.nodeName=="TD"||c.nodeName=="TR"){return}c.isImg=false;if(c.nodeName=="IMG"){if(c.src.toLowerCase().search(/\.png$/)!=-1){c.isImg=true;c.style.visibility="hidden"}else{return}}else{if(c.currentStyle.backgroundImage.toLowerCase().search(".png")==-1){return}}g=DD_belatedPNG;c.vml={color:{},image:{}};b={shape:{},fill:{}};for(a in c.vml){if(c.vml.hasOwnProperty(a)){for(d in b){if(b.hasOwnProperty(d)){f=g.ns+":"+d;c.vml[a][d]=document.createElement(f)}}c.vml[a].shape.stroked=false;c.vml[a].shape.appendChild(c.vml[a].fill);c.parentNode.insertBefore(c.vml[a].shape,c)}}c.vml.image.shape.fillcolor="none";c.vml.image.fill.type="tile";c.vml.color.fill.on=false;g.attachHandlers(c);g.giveLayout(c);g.giveLayout(c.offsetParent);c.vmlInitiated=true;g.applyVML(c)}};try{document.execCommand("BackgroundImageCache",false,true)}catch(r){}DD_belatedPNG.createVmlNameSpace();DD_belatedPNG.createVmlStyleSheet();
|
@@ -1,174 +0,0 @@
|
|
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
|
-
});
|
@@ -1,168 +0,0 @@
|
|
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
|
-
});
|