skyframe 0.0.1.beta
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/skyframe.rb +8 -0
- data/lib/skyframe/version.rb +3 -0
- data/stylesheets/_main.scss +1 -0
- data/templates/project/files/404.html +157 -0
- data/templates/project/files/CHANGELOG.md +19 -0
- data/templates/project/files/about.html +96 -0
- data/templates/project/files/apple-touch-icon-114x114-precomposed.png +0 -0
- data/templates/project/files/apple-touch-icon-144x144-precomposed.png +0 -0
- data/templates/project/files/apple-touch-icon-57x57-precomposed.png +0 -0
- data/templates/project/files/apple-touch-icon-72x72-precomposed.png +0 -0
- data/templates/project/files/apple-touch-icon-precomposed.png +0 -0
- data/templates/project/files/apple-touch-icon.png +0 -0
- data/templates/project/files/bg_direction_nav.png +0 -0
- data/templates/project/files/blog-details.html +255 -0
- data/templates/project/files/blog.html +157 -0
- data/templates/project/files/config.rb +28 -0
- data/templates/project/files/contact.html +158 -0
- data/templates/project/files/crossdomain.xml +15 -0
- data/templates/project/files/dummy-full.png +0 -0
- data/templates/project/files/dummy-square.png +0 -0
- data/templates/project/files/favicon.ico +0 -0
- data/templates/project/files/flash/video-js.swf +0 -0
- data/templates/project/files/forgot-password.html +101 -0
- data/templates/project/files/htaccess.txt +536 -0
- data/templates/project/files/humans.txt +18 -0
- data/templates/project/files/icon-gmap.png +0 -0
- data/templates/project/files/icon-search.png +0 -0
- data/templates/project/files/inc/breadcrumb.html +5 -0
- data/templates/project/files/inc/footer.html +37 -0
- data/templates/project/files/inc/header.html +20 -0
- data/templates/project/files/inc/js-bottom.html +21 -0
- data/templates/project/files/inc/js-top.html +10 -0
- data/templates/project/files/inc/main-nav.html +7 -0
- data/templates/project/files/logo.png +0 -0
- data/templates/project/files/logo@2x.png +0 -0
- data/templates/project/files/media/audio/dummy-audio.mp3 +0 -0
- data/templates/project/files/media/video/dummy-video.mp4 +0 -0
- data/templates/project/files/products.html +100 -0
- data/templates/project/files/readme.md +55 -0
- data/templates/project/files/robots.txt +3 -0
- data/templates/project/files/services.html +75 -0
- data/templates/project/files/sign-in.html +104 -0
- data/templates/project/files/sitemap.html +102 -0
- data/templates/project/files/video-js.png +0 -0
- data/templates/project/javascripts/libs/jquery-1.8.0.min.js +2 -0
- data/templates/project/javascripts/libs/jquery.validationEngine.js +1819 -0
- data/templates/project/javascripts/libs/languages/jquery.validationEngine-cz.js +156 -0
- data/templates/project/javascripts/libs/languages/jquery.validationEngine-da.js +135 -0
- data/templates/project/javascripts/libs/languages/jquery.validationEngine-de.js +139 -0
- data/templates/project/javascripts/libs/languages/jquery.validationEngine-en.js +192 -0
- data/templates/project/javascripts/libs/languages/jquery.validationEngine-es.js +137 -0
- data/templates/project/javascripts/libs/languages/jquery.validationEngine-et.js +139 -0
- data/templates/project/javascripts/libs/languages/jquery.validationEngine-fa.js +181 -0
- data/templates/project/javascripts/libs/languages/jquery.validationEngine-fi.js +111 -0
- data/templates/project/javascripts/libs/languages/jquery.validationEngine-fr.js +129 -0
- data/templates/project/javascripts/libs/languages/jquery.validationEngine-hr.js +177 -0
- data/templates/project/javascripts/libs/languages/jquery.validationEngine-hu.js +179 -0
- data/templates/project/javascripts/libs/languages/jquery.validationEngine-it.js +111 -0
- data/templates/project/javascripts/libs/languages/jquery.validationEngine-ja.js +149 -0
- data/templates/project/javascripts/libs/languages/jquery.validationEngine-nl.js +136 -0
- data/templates/project/javascripts/libs/languages/jquery.validationEngine-pl.js +140 -0
- data/templates/project/javascripts/libs/languages/jquery.validationEngine-pt.js +135 -0
- data/templates/project/javascripts/libs/languages/jquery.validationEngine-pt_BR.js +127 -0
- data/templates/project/javascripts/libs/languages/jquery.validationEngine-ro.js +177 -0
- data/templates/project/javascripts/libs/languages/jquery.validationEngine-ru.js +136 -0
- data/templates/project/javascripts/libs/languages/jquery.validationEngine-se.js +153 -0
- data/templates/project/javascripts/libs/languages/jquery.validationEngine-tr.js +156 -0
- data/templates/project/javascripts/libs/languages/jquery.validationEngine-vi.js +179 -0
- data/templates/project/javascripts/libs/languages/jquery.validationEngine-zh_CN.js +177 -0
- data/templates/project/javascripts/libs/languages/jquery.validationEngine-zh_TW.js +177 -0
- data/templates/project/javascripts/libs/modernizr-2.5.3.min.js +4 -0
- data/templates/project/javascripts/libs/respond.min.js +6 -0
- data/templates/project/javascripts/libs/selectivizr.js +560 -0
- data/templates/project/javascripts/plugins.js +83 -0
- data/templates/project/javascripts/script.js +282 -0
- data/templates/project/manifest.rb +136 -0
- data/templates/project/partials/_debug.scss +114 -0
- data/templates/project/partials/_functions.scss +10 -0
- data/templates/project/partials/_helpers.scss +86 -0
- data/templates/project/partials/_layout.scss +188 -0
- data/templates/project/partials/_media.scss +191 -0
- data/templates/project/partials/_misc.scss +103 -0
- data/templates/project/partials/_mixins.scss +140 -0
- data/templates/project/partials/_mods.scss +59 -0
- data/templates/project/partials/_normalize.scss +36 -0
- data/templates/project/partials/_print.scss +80 -0
- data/templates/project/partials/_type.scss +331 -0
- data/templates/project/partials/_vars.scss +114 -0
- data/templates/project/partials/mods/_mod-block.scss +96 -0
- data/templates/project/partials/mods/_mod-breadcrumb.scss +103 -0
- data/templates/project/partials/mods/_mod-carousel.scss +108 -0
- data/templates/project/partials/mods/_mod-footer.scss +199 -0
- data/templates/project/partials/mods/_mod-form.scss +319 -0
- data/templates/project/partials/mods/_mod-header.scss +291 -0
- data/templates/project/partials/mods/_mod-intro.scss +98 -0
- data/templates/project/partials/mods/_mod-layouts.scss +135 -0
- data/templates/project/partials/mods/_mod-main-nav.scss +143 -0
- data/templates/project/partials/mods/_mod-map.scss +107 -0
- data/templates/project/partials/mods/_mod-msg.scss +119 -0
- data/templates/project/partials/mods/_mod-paging.scss +101 -0
- data/templates/project/partials/mods/_mod-sitemap.scss +132 -0
- data/templates/project/partials/mods/_mod-split-form.scss +98 -0
- data/templates/project/partials/mods/_mod-strip.scss +118 -0
- data/templates/project/partials/mods/_mod-table.scss +118 -0
- data/templates/project/partials/mods/_mod-widget.scss +103 -0
- data/templates/project/partials/plugins/_flexslider.scss +82 -0
- data/templates/project/partials/plugins/_validation-engine.scss +137 -0
- data/templates/project/partials/plugins/_video-js.scss +616 -0
- data/templates/project/partials/sass-template.scss +103 -0
- data/templates/project/screen.scss +2 -0
- metadata +220 -0
@@ -0,0 +1,177 @@
|
|
1
|
+
(function($){
|
2
|
+
$.fn.validationEngineLanguage = function(){
|
3
|
+
};
|
4
|
+
$.validationEngineLanguage = {
|
5
|
+
newLang: function(){
|
6
|
+
$.validationEngineLanguage.allRules = {
|
7
|
+
"required": { // Add your regex rules here, you can take telephone as an example
|
8
|
+
"regex": "none",
|
9
|
+
"alertText": "* 此处不可空白",
|
10
|
+
"alertTextCheckboxMultiple": "* 请选择一个项目",
|
11
|
+
"alertTextCheckboxe": "* 您必须钩选此栏",
|
12
|
+
"alertTextDateRange": "* 日期范围不可空白"
|
13
|
+
},
|
14
|
+
"requiredInFunction": {
|
15
|
+
"func": function(field, rules, i, options){
|
16
|
+
return (field.val() == "test") ? true : false;
|
17
|
+
},
|
18
|
+
"alertText": "* Field must equal test"
|
19
|
+
},
|
20
|
+
"dateRange": {
|
21
|
+
"regex": "none",
|
22
|
+
"alertText": "* 无效的 ",
|
23
|
+
"alertText2": " 日期范围"
|
24
|
+
},
|
25
|
+
"dateTimeRange": {
|
26
|
+
"regex": "none",
|
27
|
+
"alertText": "* 无效的 ",
|
28
|
+
"alertText2": " 时间范围"
|
29
|
+
},
|
30
|
+
"minSize": {
|
31
|
+
"regex": "none",
|
32
|
+
"alertText": "* 最少 ",
|
33
|
+
"alertText2": " 个字符"
|
34
|
+
},
|
35
|
+
"maxSize": {
|
36
|
+
"regex": "none",
|
37
|
+
"alertText": "* 最多 ",
|
38
|
+
"alertText2": " 个字符"
|
39
|
+
},
|
40
|
+
"groupRequired": {
|
41
|
+
"regex": "none",
|
42
|
+
"alertText": "* 你必需选填其中一个栏位"
|
43
|
+
},
|
44
|
+
"min": {
|
45
|
+
"regex": "none",
|
46
|
+
"alertText": "* 最小值為 "
|
47
|
+
},
|
48
|
+
"max": {
|
49
|
+
"regex": "none",
|
50
|
+
"alertText": "* 最大值为 "
|
51
|
+
},
|
52
|
+
"past": {
|
53
|
+
"regex": "none",
|
54
|
+
"alertText": "* 日期必需早于 "
|
55
|
+
},
|
56
|
+
"future": {
|
57
|
+
"regex": "none",
|
58
|
+
"alertText": "* 日期必需晚于 "
|
59
|
+
},
|
60
|
+
"maxCheckbox": {
|
61
|
+
"regex": "none",
|
62
|
+
"alertText": "* 最多选取 ",
|
63
|
+
"alertText2": " 个项目"
|
64
|
+
},
|
65
|
+
"minCheckbox": {
|
66
|
+
"regex": "none",
|
67
|
+
"alertText": "* 请选择 ",
|
68
|
+
"alertText2": " 个项目"
|
69
|
+
},
|
70
|
+
"equals": {
|
71
|
+
"regex": "none",
|
72
|
+
"alertText": "* 请输入与上面相同的密码"
|
73
|
+
},
|
74
|
+
"creditCard": {
|
75
|
+
"regex": "none",
|
76
|
+
"alertText": "* 无效的信用卡号码"
|
77
|
+
},
|
78
|
+
"phone": {
|
79
|
+
// credit: jquery.h5validate.js / orefalo
|
80
|
+
"regex": /^([\+][0-9]{1,3}[ \.\-])?([\(]{1}[0-9]{2,6}[\)])?([0-9 \.\-\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/,
|
81
|
+
"alertText": "* 无效的电话号码"
|
82
|
+
},
|
83
|
+
"email": {
|
84
|
+
// Shamelessly lifted from Scott Gonzalez via the Bassistance Validation plugin http://projects.scottsplayground.com/email_address_validation/
|
85
|
+
"regex": /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i,
|
86
|
+
"alertText": "* 邮件地址无效"
|
87
|
+
},
|
88
|
+
"integer": {
|
89
|
+
"regex": /^[\-\+]?\d+$/,
|
90
|
+
"alertText": "* 不是有效的整数"
|
91
|
+
},
|
92
|
+
"number": {
|
93
|
+
// Number, including positive, negative, and floating decimal. credit: orefalo
|
94
|
+
"regex": /^[\-\+]?((([0-9]{1,3})([,][0-9]{3})*)|([0-9]+))?([\.]([0-9]+))?$/,
|
95
|
+
"alertText": "* 无效的数字"
|
96
|
+
},
|
97
|
+
"date": {
|
98
|
+
"regex": /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/,
|
99
|
+
"alertText": "* 无效的日期,格式必需为 YYYY-MM-DD"
|
100
|
+
},
|
101
|
+
"ipv4": {
|
102
|
+
"regex": /^((([01]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))[.]){3}(([0-1]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))$/,
|
103
|
+
"alertText": "* 无效的 IP 地址"
|
104
|
+
},
|
105
|
+
"url": {
|
106
|
+
"regex": /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,
|
107
|
+
"alertText": "* Invalid URL"
|
108
|
+
},
|
109
|
+
"onlyNumberSp": {
|
110
|
+
"regex": /^[0-9\ ]+$/,
|
111
|
+
"alertText": "* 只能填数字"
|
112
|
+
},
|
113
|
+
"onlyLetterSp": {
|
114
|
+
"regex": /^[a-zA-Z\ \']+$/,
|
115
|
+
"alertText": "* 只接受英文字母大小写"
|
116
|
+
},
|
117
|
+
"onlyLetterNumber": {
|
118
|
+
"regex": /^[0-9a-zA-Z]+$/,
|
119
|
+
"alertText": "* 不接受特殊字符"
|
120
|
+
},
|
121
|
+
// --- CUSTOM RULES -- Those are specific to the demos, they can be removed or changed to your likings
|
122
|
+
"ajaxUserCall": {
|
123
|
+
"url": "ajaxValidateFieldUser",
|
124
|
+
// you may want to pass extra data on the ajax call
|
125
|
+
"extraData": "name=eric",
|
126
|
+
"alertText": "* 此名称已被其他人使用",
|
127
|
+
"alertTextLoad": "* 正在确认名称是否有其他人使用,请稍等。"
|
128
|
+
},
|
129
|
+
"ajaxUserCallPhp": {
|
130
|
+
"url": "phpajax/ajaxValidateFieldUser.php",
|
131
|
+
// you may want to pass extra data on the ajax call
|
132
|
+
"extraData": "name=eric",
|
133
|
+
// if you provide an "alertTextOk", it will show as a green prompt when the field validates
|
134
|
+
"alertTextOk": "* 此帐号名称可以使用",
|
135
|
+
"alertText": "* 此名称已被其他人使用",
|
136
|
+
"alertTextLoad": "* 正在确认帐号名称是否有其他人使用,请稍等。"
|
137
|
+
},
|
138
|
+
"ajaxNameCall": {
|
139
|
+
// remote json service location
|
140
|
+
"url": "ajaxValidateFieldName",
|
141
|
+
// error
|
142
|
+
"alertText": "* 此名称可以使用",
|
143
|
+
// if you provide an "alertTextOk", it will show as a green prompt when the field validates
|
144
|
+
"alertTextOk": "* 此名称已被其他人使用",
|
145
|
+
// speaks by itself
|
146
|
+
"alertTextLoad": "* 正在确认名称是否有其他人使用,请稍等。"
|
147
|
+
},
|
148
|
+
"ajaxNameCallPhp": {
|
149
|
+
// remote json service location
|
150
|
+
"url": "phpajax/ajaxValidateFieldName.php",
|
151
|
+
// error
|
152
|
+
"alertText": "* 此名称已被其他人使用",
|
153
|
+
// speaks by itself
|
154
|
+
"alertTextLoad": "* 正在确认名称是否有其他人使用,请稍等。"
|
155
|
+
},
|
156
|
+
"validate2fields": {
|
157
|
+
"alertText": "* 请输入 HELLO"
|
158
|
+
},
|
159
|
+
//tls warning:homegrown not fielded
|
160
|
+
"dateFormat":{
|
161
|
+
"regex": /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$|^(?:(?:(?:0?[13578]|1[02])(\/|-)31)|(?:(?:0?[1,3-9]|1[0-2])(\/|-)(?:29|30)))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^(?:(?:0?[1-9]|1[0-2])(\/|-)(?:0?[1-9]|1\d|2[0-8]))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^(0?2(\/|-)29)(\/|-)(?:(?:0[48]00|[13579][26]00|[2468][048]00)|(?:\d\d)?(?:0[48]|[2468][048]|[13579][26]))$/,
|
162
|
+
"alertText": "* 无效的日期格式"
|
163
|
+
},
|
164
|
+
//tls warning:homegrown not fielded
|
165
|
+
"dateTimeFormat": {
|
166
|
+
"regex": /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])\s+(1[012]|0?[1-9]){1}:(0?[1-5]|[0-6][0-9]){1}:(0?[0-6]|[0-6][0-9]){1}\s+(am|pm|AM|PM){1}$|^(?:(?:(?:0?[13578]|1[02])(\/|-)31)|(?:(?:0?[1,3-9]|1[0-2])(\/|-)(?:29|30)))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^((1[012]|0?[1-9]){1}\/(0?[1-9]|[12][0-9]|3[01]){1}\/\d{2,4}\s+(1[012]|0?[1-9]){1}:(0?[1-5]|[0-6][0-9]){1}:(0?[0-6]|[0-6][0-9]){1}\s+(am|pm|AM|PM){1})$/,
|
167
|
+
"alertText": "* 无效的日期或时间格式",
|
168
|
+
"alertText2": "可接受的格式: ",
|
169
|
+
"alertText3": "mm/dd/yyyy hh:mm:ss AM|PM 或 ",
|
170
|
+
"alertText4": "yyyy-mm-dd hh:mm:ss AM|PM"
|
171
|
+
}
|
172
|
+
};
|
173
|
+
|
174
|
+
}
|
175
|
+
};
|
176
|
+
$.validationEngineLanguage.newLang();
|
177
|
+
})(jQuery);
|
@@ -0,0 +1,177 @@
|
|
1
|
+
(function($){
|
2
|
+
$.fn.validationEngineLanguage = function(){
|
3
|
+
};
|
4
|
+
$.validationEngineLanguage = {
|
5
|
+
newLang: function(){
|
6
|
+
$.validationEngineLanguage.allRules = {
|
7
|
+
"required": { // Add your regex rules here, you can take telephone as an example
|
8
|
+
"regex": "none",
|
9
|
+
"alertText": "* 此欄位不可空白",
|
10
|
+
"alertTextCheckboxMultiple": "* 請選擇一個項目",
|
11
|
+
"alertTextCheckboxe": "* 您必需勾選此欄位",
|
12
|
+
"alertTextDateRange": "* 日期範圍欄位都不可空白"
|
13
|
+
},
|
14
|
+
"requiredInFunction": {
|
15
|
+
"func": function(field, rules, i, options){
|
16
|
+
return (field.val() == "test") ? true : false;
|
17
|
+
},
|
18
|
+
"alertText": "* Field must equal test"
|
19
|
+
},
|
20
|
+
"dateRange": {
|
21
|
+
"regex": "none",
|
22
|
+
"alertText": "* 無效的 ",
|
23
|
+
"alertText2": " 日期範圍"
|
24
|
+
},
|
25
|
+
"dateTimeRange": {
|
26
|
+
"regex": "none",
|
27
|
+
"alertText": "* 無效的 ",
|
28
|
+
"alertText2": " 時間範圍"
|
29
|
+
},
|
30
|
+
"minSize": {
|
31
|
+
"regex": "none",
|
32
|
+
"alertText": "* 最少 ",
|
33
|
+
"alertText2": " 個字元"
|
34
|
+
},
|
35
|
+
"maxSize": {
|
36
|
+
"regex": "none",
|
37
|
+
"alertText": "* 最多 ",
|
38
|
+
"alertText2": " 個字元"
|
39
|
+
},
|
40
|
+
"groupRequired": {
|
41
|
+
"regex": "none",
|
42
|
+
"alertText": "* 你必需選填其中一個欄位"
|
43
|
+
},
|
44
|
+
"min": {
|
45
|
+
"regex": "none",
|
46
|
+
"alertText": "* 最小值為 "
|
47
|
+
},
|
48
|
+
"max": {
|
49
|
+
"regex": "none",
|
50
|
+
"alertText": "* 最大值為 "
|
51
|
+
},
|
52
|
+
"past": {
|
53
|
+
"regex": "none",
|
54
|
+
"alertText": "* 日期必需早於 "
|
55
|
+
},
|
56
|
+
"future": {
|
57
|
+
"regex": "none",
|
58
|
+
"alertText": "* 日期必需晚於 "
|
59
|
+
},
|
60
|
+
"maxCheckbox": {
|
61
|
+
"regex": "none",
|
62
|
+
"alertText": "* 最多選取 ",
|
63
|
+
"alertText2": " 個項目"
|
64
|
+
},
|
65
|
+
"minCheckbox": {
|
66
|
+
"regex": "none",
|
67
|
+
"alertText": "* 請選取 ",
|
68
|
+
"alertText2": " 個項目"
|
69
|
+
},
|
70
|
+
"equals": {
|
71
|
+
"regex": "none",
|
72
|
+
"alertText": "* 欄位內容不相符"
|
73
|
+
},
|
74
|
+
"creditCard": {
|
75
|
+
"regex": "none",
|
76
|
+
"alertText": "* 无效的信用卡号码"
|
77
|
+
},
|
78
|
+
"phone": {
|
79
|
+
// credit: jquery.h5validate.js / orefalo
|
80
|
+
"regex": /^([\+][0-9]{1,3}[ \.\-])?([\(]{1}[0-9]{2,6}[\)])?([0-9 \.\-\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/,
|
81
|
+
"alertText": "* 無效的電話號碼"
|
82
|
+
},
|
83
|
+
"email": {
|
84
|
+
// Shamelessly lifted from Scott Gonzalez via the Bassistance Validation plugin http://projects.scottsplayground.com/email_address_validation/
|
85
|
+
"regex": /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i,
|
86
|
+
"alertText": "* Invalid email address"
|
87
|
+
},
|
88
|
+
"integer": {
|
89
|
+
"regex": /^[\-\+]?\d+$/,
|
90
|
+
"alertText": "* 不是有效的整數"
|
91
|
+
},
|
92
|
+
"number": {
|
93
|
+
// Number, including positive, negative, and floating decimal. credit: orefalo
|
94
|
+
"regex": /^[\-\+]?((([0-9]{1,3})([,][0-9]{3})*)|([0-9]+))?([\.]([0-9]+))?$/,
|
95
|
+
"alertText": "* 無效的數字"
|
96
|
+
},
|
97
|
+
"date": {
|
98
|
+
"regex": /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/,
|
99
|
+
"alertText": "* 無效的日期,格式必需為 YYYY-MM-DD"
|
100
|
+
},
|
101
|
+
"ipv4": {
|
102
|
+
"regex": /^((([01]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))[.]){3}(([0-1]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))$/,
|
103
|
+
"alertText": "* 無效的 IP 位址"
|
104
|
+
},
|
105
|
+
"url": {
|
106
|
+
"regex": /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,
|
107
|
+
"alertText": "* Invalid URL"
|
108
|
+
},
|
109
|
+
"onlyNumberSp": {
|
110
|
+
"regex": /^[0-9\ ]+$/,
|
111
|
+
"alertText": "* 只能填數字"
|
112
|
+
},
|
113
|
+
"onlyLetterSp": {
|
114
|
+
"regex": /^[a-zA-Z\ \']+$/,
|
115
|
+
"alertText": "* 只接受英文字母大小寫"
|
116
|
+
},
|
117
|
+
"onlyLetterNumber": {
|
118
|
+
"regex": /^[0-9a-zA-Z]+$/,
|
119
|
+
"alertText": "* 不接受特殊字元"
|
120
|
+
},
|
121
|
+
// --- CUSTOM RULES -- Those are specific to the demos, they can be removed or changed to your likings
|
122
|
+
"ajaxUserCall": {
|
123
|
+
"url": "ajaxValidateFieldUser",
|
124
|
+
// you may want to pass extra data on the ajax call
|
125
|
+
"extraData": "name=eric",
|
126
|
+
"alertText": "* 此名稱已經被其他人使用",
|
127
|
+
"alertTextLoad": "* 正在確認名稱是否有其他人使用,請稍等。"
|
128
|
+
},
|
129
|
+
"ajaxUserCallPhp": {
|
130
|
+
"url": "phpajax/ajaxValidateFieldUser.php",
|
131
|
+
// you may want to pass extra data on the ajax call
|
132
|
+
"extraData": "name=eric",
|
133
|
+
// if you provide an "alertTextOk", it will show as a green prompt when the field validates
|
134
|
+
"alertTextOk": "* 此帳號名稱可以使用",
|
135
|
+
"alertText": "* 此帳號名稱已經被其他人使用",
|
136
|
+
"alertTextLoad": "* 正在確認帳號名稱是否有其他人使用,請稍等。"
|
137
|
+
},
|
138
|
+
"ajaxNameCall": {
|
139
|
+
// remote json service location
|
140
|
+
"url": "ajaxValidateFieldName",
|
141
|
+
// error
|
142
|
+
"alertText": "* 此名稱可以使用",
|
143
|
+
// if you provide an "alertTextOk", it will show as a green prompt when the field validates
|
144
|
+
"alertTextOk": "* 此名稱已經被其他人使用",
|
145
|
+
// speaks by itself
|
146
|
+
"alertTextLoad": "* 正在確認名稱是否有其他人使用,請稍等。"
|
147
|
+
},
|
148
|
+
"ajaxNameCallPhp": {
|
149
|
+
// remote json service location
|
150
|
+
"url": "phpajax/ajaxValidateFieldName.php",
|
151
|
+
// error
|
152
|
+
"alertText": "* 此名稱已經被其他人使用",
|
153
|
+
// speaks by itself
|
154
|
+
"alertTextLoad": "* 正在確認名稱是否有其他人使用,請稍等。"
|
155
|
+
},
|
156
|
+
"validate2fields": {
|
157
|
+
"alertText": "* 請輸入 HELLO"
|
158
|
+
},
|
159
|
+
//tls warning:homegrown not fielded
|
160
|
+
"dateFormat":{
|
161
|
+
"regex": /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$|^(?:(?:(?:0?[13578]|1[02])(\/|-)31)|(?:(?:0?[1,3-9]|1[0-2])(\/|-)(?:29|30)))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^(?:(?:0?[1-9]|1[0-2])(\/|-)(?:0?[1-9]|1\d|2[0-8]))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^(0?2(\/|-)29)(\/|-)(?:(?:0[48]00|[13579][26]00|[2468][048]00)|(?:\d\d)?(?:0[48]|[2468][048]|[13579][26]))$/,
|
162
|
+
"alertText": "* 無效的日期格式"
|
163
|
+
},
|
164
|
+
//tls warning:homegrown not fielded
|
165
|
+
"dateTimeFormat": {
|
166
|
+
"regex": /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])\s+(1[012]|0?[1-9]){1}:(0?[1-5]|[0-6][0-9]){1}:(0?[0-6]|[0-6][0-9]){1}\s+(am|pm|AM|PM){1}$|^(?:(?:(?:0?[13578]|1[02])(\/|-)31)|(?:(?:0?[1,3-9]|1[0-2])(\/|-)(?:29|30)))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^((1[012]|0?[1-9]){1}\/(0?[1-9]|[12][0-9]|3[01]){1}\/\d{2,4}\s+(1[012]|0?[1-9]){1}:(0?[1-5]|[0-6][0-9]){1}:(0?[0-6]|[0-6][0-9]){1}\s+(am|pm|AM|PM){1})$/,
|
167
|
+
"alertText": "* 無效的日期或時間格式",
|
168
|
+
"alertText2": "可接受的格式: ",
|
169
|
+
"alertText3": "mm/dd/yyyy hh:mm:ss AM|PM 或 ",
|
170
|
+
"alertText4": "yyyy-mm-dd hh:mm:ss AM|PM"
|
171
|
+
}
|
172
|
+
};
|
173
|
+
|
174
|
+
}
|
175
|
+
};
|
176
|
+
$.validationEngineLanguage.newLang();
|
177
|
+
})(jQuery);
|
@@ -0,0 +1,4 @@
|
|
1
|
+
/* Modernizr 2.5.3 (Custom Build) | MIT & BSD
|
2
|
+
* Build: http://www.modernizr.com/download/#-fontface-backgroundsize-borderimage-borderradius-boxshadow-flexbox-hsla-multiplebgs-opacity-rgba-textshadow-cssanimations-csscolumns-generatedcontent-cssgradients-cssreflections-csstransforms-csstransforms3d-csstransitions-applicationcache-canvas-canvastext-draganddrop-hashchange-history-audio-video-indexeddb-input-inputtypes-localstorage-postmessage-sessionstorage-websockets-websqldatabase-webworkers-geolocation-inlinesvg-smil-svg-svgclippaths-touch-webgl-shiv-mq-cssclasses-addtest-prefixed-teststyles-testprop-testallprops-hasevent-prefixes-domprefixes-load
|
3
|
+
*/
|
4
|
+
;window.Modernizr=function(a,b,c){function D(a){j.cssText=a}function E(a,b){return D(n.join(a+";")+(b||""))}function F(a,b){return typeof a===b}function G(a,b){return!!~(""+a).indexOf(b)}function H(a,b){for(var d in a)if(j[a[d]]!==c)return b=="pfx"?a[d]:!0;return!1}function I(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:F(f,"function")?f.bind(d||b):f}return!1}function J(a,b,c){var d=a.charAt(0).toUpperCase()+a.substr(1),e=(a+" "+p.join(d+" ")+d).split(" ");return F(b,"string")||F(b,"undefined")?H(e,b):(e=(a+" "+q.join(d+" ")+d).split(" "),I(e,b,c))}function L(){e.input=function(c){for(var d=0,e=c.length;d<e;d++)u[c[d]]=c[d]in k;return u.list&&(u.list=!!b.createElement("datalist")&&!!a.HTMLDataListElement),u}("autocomplete autofocus list placeholder max min multiple pattern required step".split(" ")),e.inputtypes=function(a){for(var d=0,e,f,h,i=a.length;d<i;d++)k.setAttribute("type",f=a[d]),e=k.type!=="text",e&&(k.value=l,k.style.cssText="position:absolute;visibility:hidden;",/^range$/.test(f)&&k.style.WebkitAppearance!==c?(g.appendChild(k),h=b.defaultView,e=h.getComputedStyle&&h.getComputedStyle(k,null).WebkitAppearance!=="textfield"&&k.offsetHeight!==0,g.removeChild(k)):/^(search|tel)$/.test(f)||(/^(url|email)$/.test(f)?e=k.checkValidity&&k.checkValidity()===!1:/^color$/.test(f)?(g.appendChild(k),g.offsetWidth,e=k.value!=l,g.removeChild(k)):e=k.value!=l)),t[a[d]]=!!e;return t}("search tel url email datetime date month week time datetime-local number range color".split(" "))}var d="2.5.3",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k=b.createElement("input"),l=":)",m={}.toString,n=" -webkit- -moz- -o- -ms- ".split(" "),o="Webkit Moz O ms",p=o.split(" "),q=o.toLowerCase().split(" "),r={svg:"http://www.w3.org/2000/svg"},s={},t={},u={},v=[],w=v.slice,x,y=function(a,c,d,e){var f,i,j,k=b.createElement("div"),l=b.body,m=l?l:b.createElement("body");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:h+(d+1),k.appendChild(j);return f=["­","<style>",a,"</style>"].join(""),k.id=h,m.innerHTML+=f,m.appendChild(k),l||(m.style.background="",g.appendChild(m)),i=c(k,a),l?k.parentNode.removeChild(k):m.parentNode.removeChild(m),!!i},z=function(b){var c=a.matchMedia||a.msMatchMedia;if(c)return c(b).matches;var d;return y("@media "+b+" { #"+h+" { position: absolute; } }",function(b){d=(a.getComputedStyle?getComputedStyle(b,null):b.currentStyle)["position"]=="absolute"}),d},A=function(){function d(d,e){e=e||b.createElement(a[d]||"div"),d="on"+d;var f=d in e;return f||(e.setAttribute||(e=b.createElement("div")),e.setAttribute&&e.removeAttribute&&(e.setAttribute(d,""),f=F(e[d],"function"),F(e[d],"undefined")||(e[d]=c),e.removeAttribute(d))),e=null,f}var a={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return d}(),B={}.hasOwnProperty,C;!F(B,"undefined")&&!F(B.call,"undefined")?C=function(a,b){return B.call(a,b)}:C=function(a,b){return b in a&&F(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=w.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(w.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(w.call(arguments)))};return e});var K=function(c,d){var f=c.join(""),g=d.length;y(f,function(c,d){var f=b.styleSheets[b.styleSheets.length-1],h=f?f.cssRules&&f.cssRules[0]?f.cssRules[0].cssText:f.cssText||"":"",i=c.childNodes,j={};while(g--)j[i[g].id]=i[g];e.touch="ontouchstart"in a||a.DocumentTouch&&b instanceof DocumentTouch||(j.touch&&j.touch.offsetTop)===9,e.csstransforms3d=(j.csstransforms3d&&j.csstransforms3d.offsetLeft)===9&&j.csstransforms3d.offsetHeight===3,e.generatedcontent=(j.generatedcontent&&j.generatedcontent.offsetHeight)>=1,e.fontface=/src/i.test(h)&&h.indexOf(d.split(" ")[0])===0},g,d)}(['@font-face {font-family:"font";src:url("https://")}',["@media (",n.join("touch-enabled),("),h,")","{#touch{top:9px;position:absolute}}"].join(""),["@media (",n.join("transform-3d),("),h,")","{#csstransforms3d{left:9px;position:absolute;height:3px;}}"].join(""),['#generatedcontent:after{content:"',l,'";visibility:hidden}'].join("")],["fontface","touch","csstransforms3d","generatedcontent"]);s.flexbox=function(){return J("flexOrder")},s.canvas=function(){var a=b.createElement("canvas");return!!a.getContext&&!!a.getContext("2d")},s.canvastext=function(){return!!e.canvas&&!!F(b.createElement("canvas").getContext("2d").fillText,"function")},s.webgl=function(){try{var d=b.createElement("canvas"),e;e=!(!a.WebGLRenderingContext||!d.getContext("experimental-webgl")&&!d.getContext("webgl")),d=c}catch(f){e=!1}return e},s.touch=function(){return e.touch},s.geolocation=function(){return!!navigator.geolocation},s.postmessage=function(){return!!a.postMessage},s.websqldatabase=function(){return!!a.openDatabase},s.indexedDB=function(){return!!J("indexedDB",a)},s.hashchange=function(){return A("hashchange",a)&&(b.documentMode===c||b.documentMode>7)},s.history=function(){return!!a.history&&!!history.pushState},s.draganddrop=function(){var a=b.createElement("div");return"draggable"in a||"ondragstart"in a&&"ondrop"in a},s.websockets=function(){for(var b=-1,c=p.length;++b<c;)if(a[p[b]+"WebSocket"])return!0;return"WebSocket"in a},s.rgba=function(){return D("background-color:rgba(150,255,150,.5)"),G(j.backgroundColor,"rgba")},s.hsla=function(){return D("background-color:hsla(120,40%,100%,.5)"),G(j.backgroundColor,"rgba")||G(j.backgroundColor,"hsla")},s.multiplebgs=function(){return D("background:url(https://),url(https://),red url(https://)"),/(url\s*\(.*?){3}/.test(j.background)},s.backgroundsize=function(){return J("backgroundSize")},s.borderimage=function(){return J("borderImage")},s.borderradius=function(){return J("borderRadius")},s.boxshadow=function(){return J("boxShadow")},s.textshadow=function(){return b.createElement("div").style.textShadow===""},s.opacity=function(){return E("opacity:.55"),/^0.55$/.test(j.opacity)},s.cssanimations=function(){return J("animationName")},s.csscolumns=function(){return J("columnCount")},s.cssgradients=function(){var a="background-image:",b="gradient(linear,left top,right bottom,from(#9f9),to(white));",c="linear-gradient(left top,#9f9, white);";return D((a+"-webkit- ".split(" ").join(b+a)+n.join(c+a)).slice(0,-a.length)),G(j.backgroundImage,"gradient")},s.cssreflections=function(){return J("boxReflect")},s.csstransforms=function(){return!!J("transform")},s.csstransforms3d=function(){var a=!!J("perspective");return a&&"webkitPerspective"in g.style&&(a=e.csstransforms3d),a},s.csstransitions=function(){return J("transition")},s.fontface=function(){return e.fontface},s.generatedcontent=function(){return e.generatedcontent},s.video=function(){var a=b.createElement("video"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,""),c.h264=a.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,""),c.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,"")}catch(d){}return c},s.audio=function(){var a=b.createElement("audio"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),c.mp3=a.canPlayType("audio/mpeg;").replace(/^no$/,""),c.wav=a.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),c.m4a=(a.canPlayType("audio/x-m4a;")||a.canPlayType("audio/aac;")).replace(/^no$/,"")}catch(d){}return c},s.localstorage=function(){try{return localStorage.setItem(h,h),localStorage.removeItem(h),!0}catch(a){return!1}},s.sessionstorage=function(){try{return sessionStorage.setItem(h,h),sessionStorage.removeItem(h),!0}catch(a){return!1}},s.webworkers=function(){return!!a.Worker},s.applicationcache=function(){return!!a.applicationCache},s.svg=function(){return!!b.createElementNS&&!!b.createElementNS(r.svg,"svg").createSVGRect},s.inlinesvg=function(){var a=b.createElement("div");return a.innerHTML="<svg/>",(a.firstChild&&a.firstChild.namespaceURI)==r.svg},s.smil=function(){return!!b.createElementNS&&/SVGAnimate/.test(m.call(b.createElementNS(r.svg,"animate")))},s.svgclippaths=function(){return!!b.createElementNS&&/SVGClipPath/.test(m.call(b.createElementNS(r.svg,"clipPath")))};for(var M in s)C(s,M)&&(x=M.toLowerCase(),e[x]=s[M](),v.push((e[x]?"":"no-")+x));return e.input||L(),e.addTest=function(a,b){if(typeof a=="object")for(var d in a)C(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,g.className+=" "+(b?"":"no-")+a,e[a]=b}return e},D(""),i=k=null,function(a,b){function g(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function h(){var a=k.elements;return typeof a=="string"?a.split(" "):a}function i(a){var b={},c=a.createElement,e=a.createDocumentFragment,f=e();a.createElement=function(a){var e=(b[a]||(b[a]=c(a))).cloneNode();return k.shivMethods&&e.canHaveChildren&&!d.test(a)?f.appendChild(e):e},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+h().join().replace(/\w+/g,function(a){return b[a]=c(a),f.createElement(a),'c("'+a+'")'})+");return n}")(k,f)}function j(a){var b;return a.documentShived?a:(k.shivCSS&&!e&&(b=!!g(a,"article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block}audio{display:none}canvas,video{display:inline-block;*display:inline;*zoom:1}[hidden]{display:none}audio[controls]{display:inline-block;*display:inline;*zoom:1}mark{background:#FF0;color:#000}")),f||(b=!i(a)),b&&(a.documentShived=b),a)}var c=a.html5||{},d=/^<|^(?:button|form|map|select|textarea)$/i,e,f;(function(){var a=b.createElement("a");a.innerHTML="<xyz></xyz>",e="hidden"in a,f=a.childNodes.length==1||function(){try{b.createElement("a")}catch(a){return!0}var c=b.createDocumentFragment();return typeof c.cloneNode=="undefined"||typeof c.createDocumentFragment=="undefined"||typeof c.createElement=="undefined"}()})();var k={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:j};a.html5=k,j(b)}(this,b),e._version=d,e._prefixes=n,e._domPrefixes=q,e._cssomPrefixes=p,e.mq=z,e.hasEvent=A,e.testProp=function(a){return H([a])},e.testAllProps=J,e.testStyles=y,e.prefixed=function(a,b,c){return b?J(a,b,c):J(a,"pfx")},g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+v.join(" "):""),e}(this,this.document),function(a,b,c){function d(a){return o.call(a)=="[object Function]"}function e(a){return typeof a=="string"}function f(){}function g(a){return!a||a=="loaded"||a=="complete"||a=="uninitialized"}function h(){var a=p.shift();q=1,a?a.t?m(function(){(a.t=="c"?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){a!="img"&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l={},o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};y[c]===1&&(r=1,y[c]=[],l=b.createElement(a)),a=="object"?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),a!="img"&&(r||y[c]===2?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i(b=="c"?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),p.length==1&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&o.call(a.opera)=="[object Opera]",l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return o.call(a)=="[object Array]"},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f<d;f++)g=a[f].split("="),(e=z[g.shift()])&&(c=e(c,g));for(f=0;f<b;f++)c=x[f](c);return c}function g(a,e,f,g,i){var j=b(a),l=j.autoCallback;j.url.split(".").pop().split("?").shift(),j.bypass||(e&&(e=d(e)?e:e[a]||e[g]||e[a.split("/").pop().split("?")[0]]||h),j.instead?j.instead(a,e,f,g,i):(y[j.url]?j.noexec=!0:y[j.url]=1,f.load(j.url,j.forceCSS||!j.forceJS&&"css"==j.url.split(".").pop().split("?").shift()?"c":c,j.noexec,j.attrs,j.timeout),(d(e)||d(l))&&f.load(function(){k(),e&&e(j.origUrl,i,g),l&&l(j.origUrl,i,g),y[j.url]=2})))}function i(a,b){function c(a,c){if(a){if(e(a))c||(j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}),g(a,j,b,0,h);else if(Object(a)===a)for(n in m=function(){var b=0,c;for(c in a)a.hasOwnProperty(c)&&b++;return b}(),a)a.hasOwnProperty(n)&&(!c&&!--m&&(d(j)?j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}:j[n]=function(a){return function(){var b=[].slice.call(arguments);a&&a.apply(this,b),l()}}(k[n])),g(a[n],j,b,n,h))}else!c&&l()}var h=!!a.test,i=a.load||a.both,j=a.callback||f,k=j,l=a.complete||f,m,n;c(h?a.yep:a.nope,!!i),i&&c(i)}var j,l,m=this.yepnope.loader;if(e(a))g(a,0,m,0);else if(w(a))for(j=0;j<a.length;j++)l=a[j],e(l)?g(l,0,m,0):w(l)?B(l):Object(l)===l&&i(l,m);else Object(a)===a&&i(a,m)},B.addPrefix=function(a,b){z[a]=b},B.addFilter=function(a){x.push(a)},B.errorTimeout=1e4,b.readyState==null&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",A=function(){b.removeEventListener("DOMContentLoaded",A,0),b.readyState="complete"},0)),a.yepnope=k(),a.yepnope.executeStack=h,a.yepnope.injectJs=function(a,c,d,e,i,j){var k=b.createElement("script"),l,o,e=e||B.errorTimeout;k.src=a;for(o in d)k.setAttribute(o,d[o]);c=j?h:c||f,k.onreadystatechange=k.onload=function(){!l&&g(k.readyState)&&(l=1,c(),k.onload=k.onreadystatechange=null)},m(function(){l||(l=1,c(1))},e),i?k.onload():n.parentNode.insertBefore(k,n)},a.yepnope.injectCss=function(a,c,d,e,g,i){var e=b.createElement("link"),j,c=i?h:c||f;e.href=a,e.rel="stylesheet",e.type="text/css";for(j in d)e.setAttribute(j,d[j]);g||(n.parentNode.insertBefore(e,n),m(c,0))}}(this,document),Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0))};
|
@@ -0,0 +1,6 @@
|
|
1
|
+
/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */
|
2
|
+
/*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */
|
3
|
+
window.matchMedia=window.matchMedia||(function(e,f){var c,a=e.documentElement,b=a.firstElementChild||a.firstChild,d=e.createElement("body"),g=e.createElement("div");g.id="mq-test-1";g.style.cssText="position:absolute;top:-100em";d.style.background="none";d.appendChild(g);return function(h){g.innerHTML='­<style media="'+h+'"> #mq-test-1 { width: 42px; }</style>';a.insertBefore(d,b);c=g.offsetWidth==42;a.removeChild(d);return{matches:c,media:h}}})(document);
|
4
|
+
|
5
|
+
/*! Respond.js v1.1.0: min/max-width media query polyfill. (c) Scott Jehl. MIT/GPLv2 Lic. j.mp/respondjs */
|
6
|
+
(function(e){e.respond={};respond.update=function(){};respond.mediaQueriesSupported=e.matchMedia&&e.matchMedia("only all").matches;if(respond.mediaQueriesSupported){return}var w=e.document,s=w.documentElement,i=[],k=[],q=[],o={},h=30,f=w.getElementsByTagName("head")[0]||s,g=w.getElementsByTagName("base")[0],b=f.getElementsByTagName("link"),d=[],a=function(){var D=b,y=D.length,B=0,A,z,C,x;for(;B<y;B++){A=D[B],z=A.href,C=A.media,x=A.rel&&A.rel.toLowerCase()==="stylesheet";if(!!z&&x&&!o[z]){if(A.styleSheet&&A.styleSheet.rawCssText){m(A.styleSheet.rawCssText,z,C);o[z]=true}else{if((!/^([a-zA-Z:]*\/\/)/.test(z)&&!g)||z.replace(RegExp.$1,"").split("/")[0]===e.location.host){d.push({href:z,media:C})}}}}u()},u=function(){if(d.length){var x=d.shift();n(x.href,function(y){m(y,x.href,x.media);o[x.href]=true;u()})}},m=function(I,x,z){var G=I.match(/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi),J=G&&G.length||0,x=x.substring(0,x.lastIndexOf("/")),y=function(K){return K.replace(/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,"$1"+x+"$2$3")},A=!J&&z,D=0,C,E,F,B,H;if(x.length){x+="/"}if(A){J=1}for(;D<J;D++){C=0;if(A){E=z;k.push(y(I))}else{E=G[D].match(/@media *([^\{]+)\{([\S\s]+?)$/)&&RegExp.$1;k.push(RegExp.$2&&y(RegExp.$2))}B=E.split(",");H=B.length;for(;C<H;C++){F=B[C];i.push({media:F.split("(")[0].match(/(only\s+)?([a-zA-Z]+)\s?/)&&RegExp.$2||"all",rules:k.length-1,hasquery:F.indexOf("(")>-1,minw:F.match(/\(min\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:F.match(/\(max\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}}j()},l,r,v=function(){var z,A=w.createElement("div"),x=w.body,y=false;A.style.cssText="position:absolute;font-size:1em;width:1em";if(!x){x=y=w.createElement("body");x.style.background="none"}x.appendChild(A);s.insertBefore(x,s.firstChild);z=A.offsetWidth;if(y){s.removeChild(x)}else{x.removeChild(A)}z=p=parseFloat(z);return z},p,j=function(I){var x="clientWidth",B=s[x],H=w.compatMode==="CSS1Compat"&&B||w.body[x]||B,D={},G=b[b.length-1],z=(new Date()).getTime();if(I&&l&&z-l<h){clearTimeout(r);r=setTimeout(j,h);return}else{l=z}for(var E in i){var K=i[E],C=K.minw,J=K.maxw,A=C===null,L=J===null,y="em";if(!!C){C=parseFloat(C)*(C.indexOf(y)>-1?(p||v()):1)}if(!!J){J=parseFloat(J)*(J.indexOf(y)>-1?(p||v()):1)}if(!K.hasquery||(!A||!L)&&(A||H>=C)&&(L||H<=J)){if(!D[K.media]){D[K.media]=[]}D[K.media].push(k[K.rules])}}for(var E in q){if(q[E]&&q[E].parentNode===f){f.removeChild(q[E])}}for(var E in D){var M=w.createElement("style"),F=D[E].join("\n");M.type="text/css";M.media=E;f.insertBefore(M,G.nextSibling);if(M.styleSheet){M.styleSheet.cssText=F}else{M.appendChild(w.createTextNode(F))}q.push(M)}},n=function(x,z){var y=c();if(!y){return}y.open("GET",x,true);y.onreadystatechange=function(){if(y.readyState!=4||y.status!=200&&y.status!=304){return}z(y.responseText)};if(y.readyState==4){return}y.send(null)},c=(function(){var x=false;try{x=new XMLHttpRequest()}catch(y){x=new ActiveXObject("Microsoft.XMLHTTP")}return function(){return x}})();a();respond.update=a;function t(){j(true)}if(e.addEventListener){e.addEventListener("resize",t,false)}else{if(e.attachEvent){e.attachEvent("onresize",t)}}})(this);
|
@@ -0,0 +1,560 @@
|
|
1
|
+
/*
|
2
|
+
selectivizr v1.0.3b - (c) Keith Clark, freely distributable under the terms
|
3
|
+
of the MIT license.
|
4
|
+
|
5
|
+
selectivizr.com
|
6
|
+
*/
|
7
|
+
/*
|
8
|
+
|
9
|
+
Notes about this source
|
10
|
+
-----------------------
|
11
|
+
|
12
|
+
* The #DEBUG_START and #DEBUG_END comments are used to mark blocks of code
|
13
|
+
that will be removed prior to building a final release version (using a
|
14
|
+
pre-compression script)
|
15
|
+
|
16
|
+
|
17
|
+
References:
|
18
|
+
-----------
|
19
|
+
|
20
|
+
* CSS Syntax : http://www.w3.org/TR/2003/WD-css3-syntax-20030813/#style
|
21
|
+
* Selectors : http://www.w3.org/TR/css3-selectors/#selectors
|
22
|
+
* IE Compatability : http://msdn.microsoft.com/en-us/library/cc351024(VS.85).aspx
|
23
|
+
* W3C Selector Tests : http://www.w3.org/Style/CSS/Test/CSS3/Selectors/current/html/tests/
|
24
|
+
|
25
|
+
*/
|
26
|
+
|
27
|
+
(function(win) {
|
28
|
+
|
29
|
+
// If browser isn't IE, then stop execution! This handles the script
|
30
|
+
// being loaded by non IE browsers because the developer didn't use
|
31
|
+
// conditional comments.
|
32
|
+
if (/*@cc_on!@*/true) return;
|
33
|
+
|
34
|
+
// =========================== Init Objects ============================
|
35
|
+
|
36
|
+
var doc = document;
|
37
|
+
var root = doc.documentElement;
|
38
|
+
var xhr = getXHRObject();
|
39
|
+
var ieVersion = /MSIE (\d+)/.exec(navigator.userAgent)[1];
|
40
|
+
|
41
|
+
// If were not in standards mode, IE is too old / new or we can't create
|
42
|
+
// an XMLHttpRequest object then we should get out now.
|
43
|
+
if (doc.compatMode != 'CSS1Compat' || ieVersion<6 || ieVersion>8 || !xhr) {
|
44
|
+
return;
|
45
|
+
}
|
46
|
+
|
47
|
+
|
48
|
+
// ========================= Common Objects ============================
|
49
|
+
|
50
|
+
// Compatiable selector engines in order of CSS3 support. Note: '*' is
|
51
|
+
// a placholder for the object key name. (basically, crude compression)
|
52
|
+
var selectorEngines = {
|
53
|
+
"NW" : "*.Dom.select",
|
54
|
+
"MooTools" : "$$",
|
55
|
+
"DOMAssistant" : "*.$",
|
56
|
+
"Prototype" : "$$",
|
57
|
+
"YAHOO" : "*.util.Selector.query",
|
58
|
+
"Sizzle" : "*",
|
59
|
+
"jQuery" : "*",
|
60
|
+
"dojo" : "*.query"
|
61
|
+
};
|
62
|
+
|
63
|
+
var selectorMethod;
|
64
|
+
var enabledWatchers = []; // array of :enabled/:disabled elements to poll
|
65
|
+
var domPatches = [];
|
66
|
+
var ie6PatchID = 0; // used to solve ie6's multiple class bug
|
67
|
+
var patchIE6MultipleClasses = true; // if true adds class bloat to ie6
|
68
|
+
var namespace = "slvzr";
|
69
|
+
|
70
|
+
// Stylesheet parsing regexp's
|
71
|
+
var RE_COMMENT = /(\/\*[^*]*\*+([^\/][^*]*\*+)*\/)\s*?/g;
|
72
|
+
var RE_IMPORT = /@import\s*(?:(?:(?:url\(\s*(['"]?)(.*)\1)\s*\))|(?:(['"])(.*)\3))\s*([^;]*);/g;
|
73
|
+
var RE_ASSET_URL = /(behavior\s*?:\s*)?\burl\(\s*(["']?)(?!data:)([^"')]+)\2\s*\)/g;
|
74
|
+
var RE_PSEUDO_STRUCTURAL = /^:(empty|(first|last|only|nth(-last)?)-(child|of-type))$/;
|
75
|
+
var RE_PSEUDO_ELEMENTS = /:(:first-(?:line|letter))/g;
|
76
|
+
var RE_SELECTOR_GROUP = /((?:^|(?:\s*})+)(?:\s*@media[^{]+{)?)\s*([^\{]*?[\[:][^{]+)/g;
|
77
|
+
var RE_SELECTOR_PARSE = /([ +~>])|(:[a-z-]+(?:\(.*?\)+)?)|(\[.*?\])/g;
|
78
|
+
var RE_LIBRARY_INCOMPATIBLE_PSEUDOS = /(:not\()?:(hover|enabled|disabled|focus|checked|target|active|visited|first-line|first-letter)\)?/g;
|
79
|
+
var RE_PATCH_CLASS_NAME_REPLACE = /[^\w-]/g;
|
80
|
+
|
81
|
+
// HTML UI element regexp's
|
82
|
+
var RE_INPUT_ELEMENTS = /^(INPUT|SELECT|TEXTAREA|BUTTON)$/;
|
83
|
+
var RE_INPUT_CHECKABLE_TYPES = /^(checkbox|radio)$/;
|
84
|
+
|
85
|
+
// Broken attribute selector implementations (IE7/8 native [^=""], [$=""] and [*=""])
|
86
|
+
var BROKEN_ATTR_IMPLEMENTATIONS = ieVersion>6 ? /[\$\^*]=(['"])\1/ : null;
|
87
|
+
|
88
|
+
// Whitespace normalization regexp's
|
89
|
+
var RE_TIDY_TRAILING_WHITESPACE = /([(\[+~])\s+/g;
|
90
|
+
var RE_TIDY_LEADING_WHITESPACE = /\s+([)\]+~])/g;
|
91
|
+
var RE_TIDY_CONSECUTIVE_WHITESPACE = /\s+/g;
|
92
|
+
var RE_TIDY_TRIM_WHITESPACE = /^\s*((?:[\S\s]*\S)?)\s*$/;
|
93
|
+
|
94
|
+
// String constants
|
95
|
+
var EMPTY_STRING = "";
|
96
|
+
var SPACE_STRING = " ";
|
97
|
+
var PLACEHOLDER_STRING = "$1";
|
98
|
+
|
99
|
+
// =========================== Patching ================================
|
100
|
+
|
101
|
+
// --[ patchStyleSheet() ]----------------------------------------------
|
102
|
+
// Scans the passed cssText for selectors that require emulation and
|
103
|
+
// creates one or more patches for each matched selector.
|
104
|
+
function patchStyleSheet( cssText ) {
|
105
|
+
return cssText.replace(RE_PSEUDO_ELEMENTS, PLACEHOLDER_STRING).
|
106
|
+
replace(RE_SELECTOR_GROUP, function(m, prefix, selectorText) {
|
107
|
+
var selectorGroups = selectorText.split(",");
|
108
|
+
for (var c = 0, cs = selectorGroups.length; c < cs; c++) {
|
109
|
+
var selector = normalizeSelectorWhitespace(selectorGroups[c]) + SPACE_STRING;
|
110
|
+
var patches = [];
|
111
|
+
selectorGroups[c] = selector.replace(RE_SELECTOR_PARSE,
|
112
|
+
function(match, combinator, pseudo, attribute, index) {
|
113
|
+
if (combinator) {
|
114
|
+
if (patches.length>0) {
|
115
|
+
domPatches.push( { selector: selector.substring(0, index), patches: patches } )
|
116
|
+
patches = [];
|
117
|
+
}
|
118
|
+
return combinator;
|
119
|
+
}
|
120
|
+
else {
|
121
|
+
var patch = (pseudo) ? patchPseudoClass( pseudo ) : patchAttribute( attribute );
|
122
|
+
if (patch) {
|
123
|
+
patches.push(patch);
|
124
|
+
return "." + patch.className;
|
125
|
+
}
|
126
|
+
return match;
|
127
|
+
}
|
128
|
+
}
|
129
|
+
);
|
130
|
+
}
|
131
|
+
return prefix + selectorGroups.join(",");
|
132
|
+
});
|
133
|
+
};
|
134
|
+
|
135
|
+
// --[ patchAttribute() ]-----------------------------------------------
|
136
|
+
// returns a patch for an attribute selector.
|
137
|
+
function patchAttribute( attr ) {
|
138
|
+
return (!BROKEN_ATTR_IMPLEMENTATIONS || BROKEN_ATTR_IMPLEMENTATIONS.test(attr)) ?
|
139
|
+
{ className: createClassName(attr), applyClass: true } : null;
|
140
|
+
};
|
141
|
+
|
142
|
+
// --[ patchPseudoClass() ]---------------------------------------------
|
143
|
+
// returns a patch for a pseudo-class
|
144
|
+
function patchPseudoClass( pseudo ) {
|
145
|
+
|
146
|
+
var applyClass = true;
|
147
|
+
var className = createClassName(pseudo.slice(1));
|
148
|
+
var isNegated = pseudo.substring(0, 5) == ":not(";
|
149
|
+
var activateEventName;
|
150
|
+
var deactivateEventName;
|
151
|
+
|
152
|
+
// if negated, remove :not()
|
153
|
+
if (isNegated) {
|
154
|
+
pseudo = pseudo.slice(5, -1);
|
155
|
+
}
|
156
|
+
|
157
|
+
// bracket contents are irrelevant - remove them
|
158
|
+
var bracketIndex = pseudo.indexOf("(")
|
159
|
+
if (bracketIndex > -1) {
|
160
|
+
pseudo = pseudo.substring(0, bracketIndex);
|
161
|
+
}
|
162
|
+
|
163
|
+
// check we're still dealing with a pseudo-class
|
164
|
+
if (pseudo.charAt(0) == ":") {
|
165
|
+
switch (pseudo.slice(1)) {
|
166
|
+
|
167
|
+
case "root":
|
168
|
+
applyClass = function(e) {
|
169
|
+
return isNegated ? e != root : e == root;
|
170
|
+
}
|
171
|
+
break;
|
172
|
+
|
173
|
+
case "target":
|
174
|
+
// :target is only supported in IE8
|
175
|
+
if (ieVersion == 8) {
|
176
|
+
applyClass = function(e) {
|
177
|
+
var handler = function() {
|
178
|
+
var hash = location.hash;
|
179
|
+
var hashID = hash.slice(1);
|
180
|
+
return isNegated ? (hash == EMPTY_STRING || e.id != hashID) : (hash != EMPTY_STRING && e.id == hashID);
|
181
|
+
};
|
182
|
+
addEvent( win, "hashchange", function() {
|
183
|
+
toggleElementClass(e, className, handler());
|
184
|
+
})
|
185
|
+
return handler();
|
186
|
+
}
|
187
|
+
break;
|
188
|
+
}
|
189
|
+
return false;
|
190
|
+
|
191
|
+
case "checked":
|
192
|
+
applyClass = function(e) {
|
193
|
+
if (RE_INPUT_CHECKABLE_TYPES.test(e.type)) {
|
194
|
+
addEvent( e, "propertychange", function() {
|
195
|
+
if (event.propertyName == "checked") {
|
196
|
+
toggleElementClass( e, className, e.checked !== isNegated );
|
197
|
+
}
|
198
|
+
})
|
199
|
+
}
|
200
|
+
return e.checked !== isNegated;
|
201
|
+
}
|
202
|
+
break;
|
203
|
+
|
204
|
+
case "disabled":
|
205
|
+
isNegated = !isNegated;
|
206
|
+
|
207
|
+
case "enabled":
|
208
|
+
applyClass = function(e) {
|
209
|
+
if (RE_INPUT_ELEMENTS.test(e.tagName)) {
|
210
|
+
addEvent( e, "propertychange", function() {
|
211
|
+
if (event.propertyName == "$disabled") {
|
212
|
+
toggleElementClass( e, className, e.$disabled === isNegated );
|
213
|
+
}
|
214
|
+
});
|
215
|
+
enabledWatchers.push(e);
|
216
|
+
e.$disabled = e.disabled;
|
217
|
+
return e.disabled === isNegated;
|
218
|
+
}
|
219
|
+
return pseudo == ":enabled" ? isNegated : !isNegated;
|
220
|
+
}
|
221
|
+
break;
|
222
|
+
|
223
|
+
case "focus":
|
224
|
+
activateEventName = "focus";
|
225
|
+
deactivateEventName = "blur";
|
226
|
+
|
227
|
+
case "hover":
|
228
|
+
if (!activateEventName) {
|
229
|
+
activateEventName = "mouseenter";
|
230
|
+
deactivateEventName = "mouseleave";
|
231
|
+
}
|
232
|
+
applyClass = function(e) {
|
233
|
+
addEvent( e, isNegated ? deactivateEventName : activateEventName, function() {
|
234
|
+
toggleElementClass( e, className, true );
|
235
|
+
})
|
236
|
+
addEvent( e, isNegated ? activateEventName : deactivateEventName, function() {
|
237
|
+
toggleElementClass( e, className, false );
|
238
|
+
})
|
239
|
+
return isNegated;
|
240
|
+
}
|
241
|
+
break;
|
242
|
+
|
243
|
+
// everything else
|
244
|
+
default:
|
245
|
+
// If we don't support this pseudo-class don't create
|
246
|
+
// a patch for it
|
247
|
+
if (!RE_PSEUDO_STRUCTURAL.test(pseudo)) {
|
248
|
+
return false;
|
249
|
+
}
|
250
|
+
break;
|
251
|
+
}
|
252
|
+
}
|
253
|
+
return { className: className, applyClass: applyClass };
|
254
|
+
};
|
255
|
+
|
256
|
+
// --[ applyPatches() ]-------------------------------------------------
|
257
|
+
function applyPatches() {
|
258
|
+
var elms, selectorText, patches, domSelectorText;
|
259
|
+
|
260
|
+
for (var c=0; c<domPatches.length; c++) {
|
261
|
+
selectorText = domPatches[c].selector;
|
262
|
+
patches = domPatches[c].patches;
|
263
|
+
|
264
|
+
// Although some selector libraries can find :checked :enabled etc.
|
265
|
+
// we need to find all elements that could have that state because
|
266
|
+
// it can be changed by the user.
|
267
|
+
domSelectorText = selectorText.replace(RE_LIBRARY_INCOMPATIBLE_PSEUDOS, EMPTY_STRING);
|
268
|
+
|
269
|
+
// If the dom selector equates to an empty string or ends with
|
270
|
+
// whitespace then we need to append a universal selector (*) to it.
|
271
|
+
if (domSelectorText == EMPTY_STRING || domSelectorText.charAt(domSelectorText.length - 1) == SPACE_STRING) {
|
272
|
+
domSelectorText += "*";
|
273
|
+
}
|
274
|
+
|
275
|
+
// Ensure we catch errors from the selector library
|
276
|
+
try {
|
277
|
+
elms = selectorMethod( domSelectorText );
|
278
|
+
} catch (ex) {
|
279
|
+
// #DEBUG_START
|
280
|
+
log( "Selector '" + selectorText + "' threw exception '" + ex + "'" );
|
281
|
+
// #DEBUG_END
|
282
|
+
}
|
283
|
+
|
284
|
+
|
285
|
+
if (elms) {
|
286
|
+
for (var d = 0, dl = elms.length; d < dl; d++) {
|
287
|
+
var elm = elms[d];
|
288
|
+
var cssClasses = elm.className;
|
289
|
+
for (var f = 0, fl = patches.length; f < fl; f++) {
|
290
|
+
var patch = patches[f];
|
291
|
+
if (!hasPatch(elm, patch)) {
|
292
|
+
if (patch.applyClass && (patch.applyClass === true || patch.applyClass(elm) === true)) {
|
293
|
+
cssClasses = toggleClass(cssClasses, patch.className, true );
|
294
|
+
}
|
295
|
+
}
|
296
|
+
}
|
297
|
+
elm.className = cssClasses;
|
298
|
+
}
|
299
|
+
}
|
300
|
+
}
|
301
|
+
};
|
302
|
+
|
303
|
+
// --[ hasPatch() ]-----------------------------------------------------
|
304
|
+
// checks for the exsistence of a patch on an element
|
305
|
+
function hasPatch( elm, patch ) {
|
306
|
+
return new RegExp("(^|\\s)" + patch.className + "(\\s|$)").test(elm.className);
|
307
|
+
};
|
308
|
+
|
309
|
+
|
310
|
+
// =========================== Utility =================================
|
311
|
+
|
312
|
+
function createClassName( className ) {
|
313
|
+
return namespace + "-" + ((ieVersion == 6 && patchIE6MultipleClasses) ?
|
314
|
+
ie6PatchID++
|
315
|
+
:
|
316
|
+
className.replace(RE_PATCH_CLASS_NAME_REPLACE, function(a) { return a.charCodeAt(0) }));
|
317
|
+
};
|
318
|
+
|
319
|
+
// --[ log() ]----------------------------------------------------------
|
320
|
+
// #DEBUG_START
|
321
|
+
function log( message ) {
|
322
|
+
if (win.console) {
|
323
|
+
win.console.log(message);
|
324
|
+
}
|
325
|
+
};
|
326
|
+
// #DEBUG_END
|
327
|
+
|
328
|
+
// --[ trim() ]---------------------------------------------------------
|
329
|
+
// removes leading, trailing whitespace from a string
|
330
|
+
function trim( text ) {
|
331
|
+
return text.replace(RE_TIDY_TRIM_WHITESPACE, PLACEHOLDER_STRING);
|
332
|
+
};
|
333
|
+
|
334
|
+
// --[ normalizeWhitespace() ]------------------------------------------
|
335
|
+
// removes leading, trailing and consecutive whitespace from a string
|
336
|
+
function normalizeWhitespace( text ) {
|
337
|
+
return trim(text).replace(RE_TIDY_CONSECUTIVE_WHITESPACE, SPACE_STRING);
|
338
|
+
};
|
339
|
+
|
340
|
+
// --[ normalizeSelectorWhitespace() ]----------------------------------
|
341
|
+
// tidies whitespace around selector brackets and combinators
|
342
|
+
function normalizeSelectorWhitespace( selectorText ) {
|
343
|
+
return normalizeWhitespace(selectorText.
|
344
|
+
replace(RE_TIDY_TRAILING_WHITESPACE, PLACEHOLDER_STRING).
|
345
|
+
replace(RE_TIDY_LEADING_WHITESPACE, PLACEHOLDER_STRING)
|
346
|
+
);
|
347
|
+
};
|
348
|
+
|
349
|
+
// --[ toggleElementClass() ]-------------------------------------------
|
350
|
+
// toggles a single className on an element
|
351
|
+
function toggleElementClass( elm, className, on ) {
|
352
|
+
var oldClassName = elm.className;
|
353
|
+
var newClassName = toggleClass(oldClassName, className, on);
|
354
|
+
if (newClassName != oldClassName) {
|
355
|
+
elm.className = newClassName;
|
356
|
+
elm.parentNode.className += EMPTY_STRING;
|
357
|
+
}
|
358
|
+
};
|
359
|
+
|
360
|
+
// --[ toggleClass() ]--------------------------------------------------
|
361
|
+
// adds / removes a className from a string of classNames. Used to
|
362
|
+
// manage multiple class changes without forcing a DOM redraw
|
363
|
+
function toggleClass( classList, className, on ) {
|
364
|
+
var re = RegExp("(^|\\s)" + className + "(\\s|$)");
|
365
|
+
var classExists = re.test(classList);
|
366
|
+
if (on) {
|
367
|
+
return classExists ? classList : classList + SPACE_STRING + className;
|
368
|
+
} else {
|
369
|
+
return classExists ? trim(classList.replace(re, PLACEHOLDER_STRING)) : classList;
|
370
|
+
}
|
371
|
+
};
|
372
|
+
|
373
|
+
// --[ addEvent() ]-----------------------------------------------------
|
374
|
+
function addEvent(elm, eventName, eventHandler) {
|
375
|
+
elm.attachEvent("on" + eventName, eventHandler);
|
376
|
+
};
|
377
|
+
|
378
|
+
// --[ getXHRObject() ]-------------------------------------------------
|
379
|
+
function getXHRObject() {
|
380
|
+
if (win.XMLHttpRequest) {
|
381
|
+
return new XMLHttpRequest;
|
382
|
+
}
|
383
|
+
try {
|
384
|
+
return new ActiveXObject('Microsoft.XMLHTTP');
|
385
|
+
} catch(e) {
|
386
|
+
return null;
|
387
|
+
}
|
388
|
+
};
|
389
|
+
|
390
|
+
// --[ loadStyleSheet() ]-----------------------------------------------
|
391
|
+
function loadStyleSheet( url ) {
|
392
|
+
xhr.open("GET", url, false);
|
393
|
+
xhr.send();
|
394
|
+
return (xhr.status==200) ? xhr.responseText : EMPTY_STRING;
|
395
|
+
};
|
396
|
+
|
397
|
+
// --[ resolveUrl() ]---------------------------------------------------
|
398
|
+
// Converts a URL fragment to a fully qualified URL using the specified
|
399
|
+
// context URL. Returns null if same-origin policy is broken
|
400
|
+
function resolveUrl( url, contextUrl, ignoreSameOriginPolicy ) {
|
401
|
+
|
402
|
+
function getProtocol( url ) {
|
403
|
+
return url.substring(0, url.indexOf("//"));
|
404
|
+
};
|
405
|
+
|
406
|
+
function getProtocolAndHost( url ) {
|
407
|
+
return url.substring(0, url.indexOf("/", 8));
|
408
|
+
};
|
409
|
+
|
410
|
+
if (!contextUrl) {
|
411
|
+
contextUrl = baseUrl;
|
412
|
+
}
|
413
|
+
|
414
|
+
// protocol-relative path
|
415
|
+
if (url.substring(0,2)=="//") {
|
416
|
+
url = getProtocol(contextUrl) + url;
|
417
|
+
}
|
418
|
+
|
419
|
+
// absolute path
|
420
|
+
if (/^https?:\/\//i.test(url)) {
|
421
|
+
return !ignoreSameOriginPolicy && getProtocolAndHost(contextUrl) != getProtocolAndHost(url) ? null : url ;
|
422
|
+
}
|
423
|
+
|
424
|
+
// root-relative path
|
425
|
+
if (url.charAt(0)=="/") {
|
426
|
+
return getProtocolAndHost(contextUrl) + url;
|
427
|
+
}
|
428
|
+
|
429
|
+
// relative path
|
430
|
+
var contextUrlPath = contextUrl.split(/[?#]/)[0]; // ignore query string in the contextUrl
|
431
|
+
if (url.charAt(0) != "?" && contextUrlPath.charAt(contextUrlPath.length - 1) != "/") {
|
432
|
+
contextUrlPath = contextUrlPath.substring(0, contextUrlPath.lastIndexOf("/") + 1);
|
433
|
+
}
|
434
|
+
|
435
|
+
return contextUrlPath + url;
|
436
|
+
};
|
437
|
+
|
438
|
+
// --[ parseStyleSheet() ]----------------------------------------------
|
439
|
+
// Downloads the stylesheet specified by the URL, removes it's comments
|
440
|
+
// and recursivly replaces @import rules with their contents, ultimately
|
441
|
+
// returning the full cssText.
|
442
|
+
function parseStyleSheet( url ) {
|
443
|
+
if (url) {
|
444
|
+
return loadStyleSheet(url).replace(RE_COMMENT, EMPTY_STRING).
|
445
|
+
replace(RE_IMPORT, function( match, quoteChar, importUrl, quoteChar2, importUrl2, media ) {
|
446
|
+
var cssText = parseStyleSheet(resolveUrl(importUrl || importUrl2, url));
|
447
|
+
return (media) ? "@media " + media + " {" + cssText + "}" : cssText;
|
448
|
+
}).
|
449
|
+
replace(RE_ASSET_URL, function( match, isBehavior, quoteChar, assetUrl ) {
|
450
|
+
quoteChar = quoteChar || EMPTY_STRING;
|
451
|
+
return isBehavior ? match : " url(" + quoteChar + resolveUrl(assetUrl, url, true) + quoteChar + ") ";
|
452
|
+
});
|
453
|
+
}
|
454
|
+
return EMPTY_STRING;
|
455
|
+
};
|
456
|
+
|
457
|
+
// --[ getStyleSheets() ]-----------------------------------------------
|
458
|
+
function getStyleSheets() {
|
459
|
+
var url, stylesheet;
|
460
|
+
for (var c = 0; c < doc.styleSheets.length; c++) {
|
461
|
+
stylesheet = doc.styleSheets[c];
|
462
|
+
if (stylesheet.href != EMPTY_STRING) {
|
463
|
+
url = resolveUrl(stylesheet.href);
|
464
|
+
if (url) {
|
465
|
+
stylesheet.cssText = stylesheet["rawCssText"] = patchStyleSheet( parseStyleSheet( url ) );
|
466
|
+
}
|
467
|
+
}
|
468
|
+
}
|
469
|
+
};
|
470
|
+
|
471
|
+
// --[ init() ]---------------------------------------------------------
|
472
|
+
function init() {
|
473
|
+
applyPatches();
|
474
|
+
|
475
|
+
// :enabled & :disabled polling script (since we can't hook
|
476
|
+
// onpropertychange event when an element is disabled)
|
477
|
+
if (enabledWatchers.length > 0) {
|
478
|
+
setInterval( function() {
|
479
|
+
for (var c = 0, cl = enabledWatchers.length; c < cl; c++) {
|
480
|
+
var e = enabledWatchers[c];
|
481
|
+
if (e.disabled !== e.$disabled) {
|
482
|
+
if (e.disabled) {
|
483
|
+
e.disabled = false;
|
484
|
+
e.$disabled = true;
|
485
|
+
e.disabled = true;
|
486
|
+
}
|
487
|
+
else {
|
488
|
+
e.$disabled = e.disabled;
|
489
|
+
}
|
490
|
+
}
|
491
|
+
}
|
492
|
+
}, 250)
|
493
|
+
}
|
494
|
+
};
|
495
|
+
|
496
|
+
// Determine the baseUrl and download the stylesheets
|
497
|
+
var baseTags = doc.getElementsByTagName("BASE");
|
498
|
+
var baseUrl = (baseTags.length > 0) ? baseTags[0].href : doc.location.href;
|
499
|
+
getStyleSheets();
|
500
|
+
|
501
|
+
// Bind selectivizr to the ContentLoaded event.
|
502
|
+
ContentLoaded(win, function() {
|
503
|
+
// Determine the "best fit" selector engine
|
504
|
+
for (var engine in selectorEngines) {
|
505
|
+
var members, member, context = win;
|
506
|
+
if (win[engine]) {
|
507
|
+
members = selectorEngines[engine].replace("*", engine).split(".");
|
508
|
+
while ((member = members.shift()) && (context = context[member])) {}
|
509
|
+
if (typeof context == "function") {
|
510
|
+
selectorMethod = context;
|
511
|
+
init();
|
512
|
+
return;
|
513
|
+
}
|
514
|
+
}
|
515
|
+
}
|
516
|
+
});
|
517
|
+
|
518
|
+
|
519
|
+
|
520
|
+
/*!
|
521
|
+
* ContentLoaded.js by Diego Perini, modified for IE<9 only (to save space)
|
522
|
+
*
|
523
|
+
* Author: Diego Perini (diego.perini at gmail.com)
|
524
|
+
* Summary: cross-browser wrapper for DOMContentLoaded
|
525
|
+
* Updated: 20101020
|
526
|
+
* License: MIT
|
527
|
+
* Version: 1.2
|
528
|
+
*
|
529
|
+
* URL:
|
530
|
+
* http://javascript.nwbox.com/ContentLoaded/
|
531
|
+
* http://javascript.nwbox.com/ContentLoaded/MIT-LICENSE
|
532
|
+
*
|
533
|
+
*/
|
534
|
+
|
535
|
+
// @w window reference
|
536
|
+
// @f function reference
|
537
|
+
function ContentLoaded(win, fn) {
|
538
|
+
|
539
|
+
var done = false, top = true,
|
540
|
+
init = function(e) {
|
541
|
+
if (e.type == "readystatechange" && doc.readyState != "complete") return;
|
542
|
+
(e.type == "load" ? win : doc).detachEvent("on" + e.type, init, false);
|
543
|
+
if (!done && (done = true)) fn.call(win, e.type || e);
|
544
|
+
},
|
545
|
+
poll = function() {
|
546
|
+
try { root.doScroll("left"); } catch(e) { setTimeout(poll, 50); return; }
|
547
|
+
init('poll');
|
548
|
+
};
|
549
|
+
|
550
|
+
if (doc.readyState == "complete") fn.call(win, EMPTY_STRING);
|
551
|
+
else {
|
552
|
+
if (doc.createEventObject && root.doScroll) {
|
553
|
+
try { top = !win.frameElement; } catch(e) { }
|
554
|
+
if (top) poll();
|
555
|
+
}
|
556
|
+
addEvent(doc,"readystatechange", init);
|
557
|
+
addEvent(win,"load", init);
|
558
|
+
}
|
559
|
+
};
|
560
|
+
})(this);
|