Version Description
- ASync JS is now maintained by Frank Goossens (Optimizing Matters), thanks for the great job done David!
- Moved all Pro features into the standard version.
- Some code refactoring
- Made strings ready for translations
Download this release
Release Info
Developer | futtta |
Plugin | Async JavaScript |
Version | 2.18.03.10 |
Comparing to | |
See all releases |
Code changes from version 2.17.11.15 to 2.18.03.10
- assets/lib/chosen_v1.4.2/bower.json +53 -0
- assets/lib/chosen_v1.4.2/chosen-sprite.png +0 -0
- assets/lib/chosen_v1.4.2/chosen-sprite@2x.png +0 -0
- assets/lib/chosen_v1.4.2/chosen.css +450 -0
- assets/lib/chosen_v1.4.2/chosen.jquery.js +1257 -0
- assets/lib/chosen_v1.4.2/chosen.jquery.min.js +2 -0
- assets/lib/chosen_v1.4.2/chosen.min.css +3 -0
- assets/lib/chosen_v1.4.2/chosen.proto.js +1276 -0
- assets/lib/chosen_v1.4.2/chosen.proto.min.js +2 -0
- assets/lib/chosen_v1.4.2/docsupport/chosen.png +0 -0
- assets/lib/chosen_v1.4.2/docsupport/oss-credit.png +0 -0
- assets/lib/chosen_v1.4.2/docsupport/prism.css +108 -0
- assets/lib/chosen_v1.4.2/docsupport/prism.js +9 -0
- assets/lib/chosen_v1.4.2/docsupport/style.css +204 -0
- assets/lib/chosen_v1.4.2/index.html +1479 -0
- assets/lib/chosen_v1.4.2/index.proto.html +1483 -0
- assets/lib/chosen_v1.4.2/options.html +276 -0
- async-javascript.php +24 -1367
- asyncjsAllAjax.php +417 -0
- asyncjsBackendClass.php +349 -0
- asyncjsDashboardScreens.php +107 -0
- asyncjsFrontendClass.php +152 -0
- asyncjsHelpScreens.php +42 -0
- asyncjsPartnersScreens.php +101 -0
- asyncjsSettingsScreens.php +151 -0
- asyncjsStatusScreens.php +190 -0
- asyncjsWizardScreens.php +319 -0
- css/admin.css +1 -89
- css/admin.min.css +1 -1
- js/admin.js +1 -306
- js/admin.min.js +1 -1
- readme.txt +123 -255
assets/lib/chosen_v1.4.2/bower.json
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "chosen",
|
3 |
+
"description": "Chosen is a JavaScript plugin that makes long, unwieldy select boxes much more user-friendly. It is currently available in both jQuery and Prototype flavors.",
|
4 |
+
"version": "1.4.2",
|
5 |
+
"main": [
|
6 |
+
"chosen.jquery.min.js",
|
7 |
+
"chosen.css",
|
8 |
+
"chosen-sprite@2x.png",
|
9 |
+
"chosen-sprite.png"
|
10 |
+
],
|
11 |
+
"license": [
|
12 |
+
{
|
13 |
+
"type": "MIT",
|
14 |
+
"url": "https://github.com/harvesthq/chosen/blob/master/LICENSE.md"
|
15 |
+
}
|
16 |
+
],
|
17 |
+
"ignore": [],
|
18 |
+
"keywords": [
|
19 |
+
"select",
|
20 |
+
"multiselect",
|
21 |
+
"dropdown",
|
22 |
+
"form",
|
23 |
+
"input",
|
24 |
+
"ui"
|
25 |
+
],
|
26 |
+
"authors": [
|
27 |
+
{
|
28 |
+
"name": "Patrick Filler",
|
29 |
+
"url": "https://github.com/pfiller"
|
30 |
+
},
|
31 |
+
{
|
32 |
+
"name": "Christophe Coevoet",
|
33 |
+
"url": "https://github.com/stof"
|
34 |
+
},
|
35 |
+
{
|
36 |
+
"name": "Ken Earley",
|
37 |
+
"url": "https://github.com/kenearley"
|
38 |
+
},
|
39 |
+
{
|
40 |
+
"name": "Koen Punt",
|
41 |
+
"url": "https://github.com/koenpunt"
|
42 |
+
}
|
43 |
+
],
|
44 |
+
"homepage": "http://harvesthq.github.io/chosen/",
|
45 |
+
"repository": {
|
46 |
+
"type": "git",
|
47 |
+
"url": "https://github.com/harvesthq/chosen"
|
48 |
+
},
|
49 |
+
"dependencies": {
|
50 |
+
"jquery": ">=1.4.4"
|
51 |
+
},
|
52 |
+
"devDependencies": []
|
53 |
+
}
|
assets/lib/chosen_v1.4.2/chosen-sprite.png
ADDED
Binary file
|
assets/lib/chosen_v1.4.2/chosen-sprite@2x.png
ADDED
Binary file
|
assets/lib/chosen_v1.4.2/chosen.css
ADDED
@@ -0,0 +1,450 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
Chosen, a Select Box Enhancer for jQuery and Prototype
|
3 |
+
by Patrick Filler for Harvest, http://getharvest.com
|
4 |
+
|
5 |
+
Version 1.4.2
|
6 |
+
Full source at https://github.com/harvesthq/chosen
|
7 |
+
Copyright (c) 2011-2015 Harvest http://getharvest.com
|
8 |
+
|
9 |
+
MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
|
10 |
+
This file is generated by `grunt build`, do not edit it by hand.
|
11 |
+
*/
|
12 |
+
|
13 |
+
/* @group Base */
|
14 |
+
.chosen-container {
|
15 |
+
position: relative;
|
16 |
+
display: inline-block;
|
17 |
+
vertical-align: middle;
|
18 |
+
font-size: 13px;
|
19 |
+
zoom: 1;
|
20 |
+
*display: inline;
|
21 |
+
-webkit-user-select: none;
|
22 |
+
-moz-user-select: none;
|
23 |
+
user-select: none;
|
24 |
+
}
|
25 |
+
.chosen-container * {
|
26 |
+
-webkit-box-sizing: border-box;
|
27 |
+
-moz-box-sizing: border-box;
|
28 |
+
box-sizing: border-box;
|
29 |
+
}
|
30 |
+
.chosen-container .chosen-drop {
|
31 |
+
position: absolute;
|
32 |
+
top: 100%;
|
33 |
+
left: -9999px;
|
34 |
+
z-index: 1010;
|
35 |
+
width: 100%;
|
36 |
+
border: 1px solid #aaa;
|
37 |
+
border-top: 0;
|
38 |
+
background: #fff;
|
39 |
+
box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15);
|
40 |
+
}
|
41 |
+
.chosen-container.chosen-with-drop .chosen-drop {
|
42 |
+
left: 0;
|
43 |
+
}
|
44 |
+
.chosen-container a {
|
45 |
+
cursor: pointer;
|
46 |
+
}
|
47 |
+
.chosen-container .search-choice .group-name, .chosen-container .chosen-single .group-name {
|
48 |
+
margin-right: 4px;
|
49 |
+
overflow: hidden;
|
50 |
+
white-space: nowrap;
|
51 |
+
text-overflow: ellipsis;
|
52 |
+
font-weight: normal;
|
53 |
+
color: #999999;
|
54 |
+
}
|
55 |
+
.chosen-container .search-choice .group-name:after, .chosen-container .chosen-single .group-name:after {
|
56 |
+
content: ":";
|
57 |
+
padding-left: 2px;
|
58 |
+
vertical-align: top;
|
59 |
+
}
|
60 |
+
|
61 |
+
/* @end */
|
62 |
+
/* @group Single Chosen */
|
63 |
+
.chosen-container-single .chosen-single {
|
64 |
+
position: relative;
|
65 |
+
display: block;
|
66 |
+
overflow: hidden;
|
67 |
+
padding: 0 0 0 8px;
|
68 |
+
height: 25px;
|
69 |
+
border: 1px solid #aaa;
|
70 |
+
border-radius: 5px;
|
71 |
+
background-color: #fff;
|
72 |
+
background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #ffffff), color-stop(50%, #f6f6f6), color-stop(52%, #eeeeee), color-stop(100%, #f4f4f4));
|
73 |
+
background: -webkit-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
|
74 |
+
background: -moz-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
|
75 |
+
background: -o-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
|
76 |
+
background: linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
|
77 |
+
background-clip: padding-box;
|
78 |
+
box-shadow: 0 0 3px white inset, 0 1px 1px rgba(0, 0, 0, 0.1);
|
79 |
+
color: #444;
|
80 |
+
text-decoration: none;
|
81 |
+
white-space: nowrap;
|
82 |
+
line-height: 24px;
|
83 |
+
}
|
84 |
+
.chosen-container-single .chosen-default {
|
85 |
+
color: #999;
|
86 |
+
}
|
87 |
+
.chosen-container-single .chosen-single span {
|
88 |
+
display: block;
|
89 |
+
overflow: hidden;
|
90 |
+
margin-right: 26px;
|
91 |
+
text-overflow: ellipsis;
|
92 |
+
white-space: nowrap;
|
93 |
+
}
|
94 |
+
.chosen-container-single .chosen-single-with-deselect span {
|
95 |
+
margin-right: 38px;
|
96 |
+
}
|
97 |
+
.chosen-container-single .chosen-single abbr {
|
98 |
+
position: absolute;
|
99 |
+
top: 6px;
|
100 |
+
right: 26px;
|
101 |
+
display: block;
|
102 |
+
width: 12px;
|
103 |
+
height: 12px;
|
104 |
+
background: url('chosen-sprite.png') -42px 1px no-repeat;
|
105 |
+
font-size: 1px;
|
106 |
+
}
|
107 |
+
.chosen-container-single .chosen-single abbr:hover {
|
108 |
+
background-position: -42px -10px;
|
109 |
+
}
|
110 |
+
.chosen-container-single.chosen-disabled .chosen-single abbr:hover {
|
111 |
+
background-position: -42px -10px;
|
112 |
+
}
|
113 |
+
.chosen-container-single .chosen-single div {
|
114 |
+
position: absolute;
|
115 |
+
top: 0;
|
116 |
+
right: 0;
|
117 |
+
display: block;
|
118 |
+
width: 18px;
|
119 |
+
height: 100%;
|
120 |
+
}
|
121 |
+
.chosen-container-single .chosen-single div b {
|
122 |
+
display: block;
|
123 |
+
width: 100%;
|
124 |
+
height: 100%;
|
125 |
+
background: url('chosen-sprite.png') no-repeat 0px 2px;
|
126 |
+
}
|
127 |
+
.chosen-container-single .chosen-search {
|
128 |
+
position: relative;
|
129 |
+
z-index: 1010;
|
130 |
+
margin: 0;
|
131 |
+
padding: 3px 4px;
|
132 |
+
white-space: nowrap;
|
133 |
+
}
|
134 |
+
.chosen-container-single .chosen-search input[type="text"] {
|
135 |
+
margin: 1px 0;
|
136 |
+
padding: 4px 20px 4px 5px;
|
137 |
+
width: 100%;
|
138 |
+
height: auto;
|
139 |
+
outline: 0;
|
140 |
+
border: 1px solid #aaa;
|
141 |
+
background: white url('chosen-sprite.png') no-repeat 100% -20px;
|
142 |
+
background: url('chosen-sprite.png') no-repeat 100% -20px;
|
143 |
+
font-size: 1em;
|
144 |
+
font-family: sans-serif;
|
145 |
+
line-height: normal;
|
146 |
+
border-radius: 0;
|
147 |
+
}
|
148 |
+
.chosen-container-single .chosen-drop {
|
149 |
+
margin-top: -1px;
|
150 |
+
border-radius: 0 0 4px 4px;
|
151 |
+
background-clip: padding-box;
|
152 |
+
}
|
153 |
+
.chosen-container-single.chosen-container-single-nosearch .chosen-search {
|
154 |
+
position: absolute;
|
155 |
+
left: -9999px;
|
156 |
+
}
|
157 |
+
|
158 |
+
/* @end */
|
159 |
+
/* @group Results */
|
160 |
+
.chosen-container .chosen-results {
|
161 |
+
color: #444;
|
162 |
+
position: relative;
|
163 |
+
overflow-x: hidden;
|
164 |
+
overflow-y: auto;
|
165 |
+
margin: 0 4px 4px 0;
|
166 |
+
padding: 0 0 0 4px;
|
167 |
+
max-height: 240px;
|
168 |
+
-webkit-overflow-scrolling: touch;
|
169 |
+
}
|
170 |
+
.chosen-container .chosen-results li {
|
171 |
+
display: none;
|
172 |
+
margin: 0;
|
173 |
+
padding: 5px 6px;
|
174 |
+
list-style: none;
|
175 |
+
line-height: 15px;
|
176 |
+
word-wrap: break-word;
|
177 |
+
-webkit-touch-callout: none;
|
178 |
+
}
|
179 |
+
.chosen-container .chosen-results li.active-result {
|
180 |
+
display: list-item;
|
181 |
+
cursor: pointer;
|
182 |
+
}
|
183 |
+
.chosen-container .chosen-results li.disabled-result {
|
184 |
+
display: list-item;
|
185 |
+
color: #ccc;
|
186 |
+
cursor: default;
|
187 |
+
}
|
188 |
+
.chosen-container .chosen-results li.highlighted {
|
189 |
+
background-color: #3875d7;
|
190 |
+
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #3875d7), color-stop(90%, #2a62bc));
|
191 |
+
background-image: -webkit-linear-gradient(#3875d7 20%, #2a62bc 90%);
|
192 |
+
background-image: -moz-linear-gradient(#3875d7 20%, #2a62bc 90%);
|
193 |
+
background-image: -o-linear-gradient(#3875d7 20%, #2a62bc 90%);
|
194 |
+
background-image: linear-gradient(#3875d7 20%, #2a62bc 90%);
|
195 |
+
color: #fff;
|
196 |
+
}
|
197 |
+
.chosen-container .chosen-results li.no-results {
|
198 |
+
color: #777;
|
199 |
+
display: list-item;
|
200 |
+
background: #f4f4f4;
|
201 |
+
}
|
202 |
+
.chosen-container .chosen-results li.group-result {
|
203 |
+
display: list-item;
|
204 |
+
font-weight: bold;
|
205 |
+
cursor: default;
|
206 |
+
}
|
207 |
+
.chosen-container .chosen-results li.group-option {
|
208 |
+
padding-left: 15px;
|
209 |
+
}
|
210 |
+
.chosen-container .chosen-results li em {
|
211 |
+
font-style: normal;
|
212 |
+
text-decoration: underline;
|
213 |
+
}
|
214 |
+
|
215 |
+
/* @end */
|
216 |
+
/* @group Multi Chosen */
|
217 |
+
.chosen-container-multi .chosen-choices {
|
218 |
+
position: relative;
|
219 |
+
overflow: hidden;
|
220 |
+
margin: 0;
|
221 |
+
padding: 0 5px;
|
222 |
+
width: 100%;
|
223 |
+
height: auto !important;
|
224 |
+
height: 1%;
|
225 |
+
border: 1px solid #aaa;
|
226 |
+
background-color: #fff;
|
227 |
+
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(1%, #eeeeee), color-stop(15%, #ffffff));
|
228 |
+
background-image: -webkit-linear-gradient(#eeeeee 1%, #ffffff 15%);
|
229 |
+
background-image: -moz-linear-gradient(#eeeeee 1%, #ffffff 15%);
|
230 |
+
background-image: -o-linear-gradient(#eeeeee 1%, #ffffff 15%);
|
231 |
+
background-image: linear-gradient(#eeeeee 1%, #ffffff 15%);
|
232 |
+
cursor: text;
|
233 |
+
}
|
234 |
+
.chosen-container-multi .chosen-choices li {
|
235 |
+
float: left;
|
236 |
+
list-style: none;
|
237 |
+
}
|
238 |
+
.chosen-container-multi .chosen-choices li.search-field {
|
239 |
+
margin: 0;
|
240 |
+
padding: 0;
|
241 |
+
white-space: nowrap;
|
242 |
+
}
|
243 |
+
.chosen-container-multi .chosen-choices li.search-field input[type="text"] {
|
244 |
+
margin: 1px 0;
|
245 |
+
padding: 0;
|
246 |
+
height: 25px;
|
247 |
+
outline: 0;
|
248 |
+
border: 0 !important;
|
249 |
+
background: transparent !important;
|
250 |
+
box-shadow: none;
|
251 |
+
color: #999;
|
252 |
+
font-size: 100%;
|
253 |
+
font-family: sans-serif;
|
254 |
+
line-height: normal;
|
255 |
+
border-radius: 0;
|
256 |
+
}
|
257 |
+
.chosen-container-multi .chosen-choices li.search-choice {
|
258 |
+
position: relative;
|
259 |
+
margin: 3px 5px 3px 0;
|
260 |
+
padding: 3px 20px 3px 5px;
|
261 |
+
border: 1px solid #aaa;
|
262 |
+
max-width: 100%;
|
263 |
+
border-radius: 3px;
|
264 |
+
background-color: #eeeeee;
|
265 |
+
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
|
266 |
+
background-image: -webkit-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
267 |
+
background-image: -moz-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
268 |
+
background-image: -o-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
269 |
+
background-image: linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
270 |
+
background-size: 100% 19px;
|
271 |
+
background-repeat: repeat-x;
|
272 |
+
background-clip: padding-box;
|
273 |
+
box-shadow: 0 0 2px white inset, 0 1px 0 rgba(0, 0, 0, 0.05);
|
274 |
+
color: #333;
|
275 |
+
line-height: 13px;
|
276 |
+
cursor: default;
|
277 |
+
}
|
278 |
+
.chosen-container-multi .chosen-choices li.search-choice span {
|
279 |
+
word-wrap: break-word;
|
280 |
+
}
|
281 |
+
.chosen-container-multi .chosen-choices li.search-choice .search-choice-close {
|
282 |
+
position: absolute;
|
283 |
+
top: 4px;
|
284 |
+
right: 3px;
|
285 |
+
display: block;
|
286 |
+
width: 12px;
|
287 |
+
height: 12px;
|
288 |
+
background: url('chosen-sprite.png') -42px 1px no-repeat;
|
289 |
+
font-size: 1px;
|
290 |
+
}
|
291 |
+
.chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover {
|
292 |
+
background-position: -42px -10px;
|
293 |
+
}
|
294 |
+
.chosen-container-multi .chosen-choices li.search-choice-disabled {
|
295 |
+
padding-right: 5px;
|
296 |
+
border: 1px solid #ccc;
|
297 |
+
background-color: #e4e4e4;
|
298 |
+
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
|
299 |
+
background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
300 |
+
background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
301 |
+
background-image: -o-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
302 |
+
background-image: linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
|
303 |
+
color: #666;
|
304 |
+
}
|
305 |
+
.chosen-container-multi .chosen-choices li.search-choice-focus {
|
306 |
+
background: #d4d4d4;
|
307 |
+
}
|
308 |
+
.chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close {
|
309 |
+
background-position: -42px -10px;
|
310 |
+
}
|
311 |
+
.chosen-container-multi .chosen-results {
|
312 |
+
margin: 0;
|
313 |
+
padding: 0;
|
314 |
+
}
|
315 |
+
.chosen-container-multi .chosen-drop .result-selected {
|
316 |
+
display: list-item;
|
317 |
+
color: #ccc;
|
318 |
+
cursor: default;
|
319 |
+
}
|
320 |
+
|
321 |
+
/* @end */
|
322 |
+
/* @group Active */
|
323 |
+
.chosen-container-active .chosen-single {
|
324 |
+
border: 1px solid #5897fb;
|
325 |
+
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
|
326 |
+
}
|
327 |
+
.chosen-container-active.chosen-with-drop .chosen-single {
|
328 |
+
border: 1px solid #aaa;
|
329 |
+
-moz-border-radius-bottomright: 0;
|
330 |
+
border-bottom-right-radius: 0;
|
331 |
+
-moz-border-radius-bottomleft: 0;
|
332 |
+
border-bottom-left-radius: 0;
|
333 |
+
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #eeeeee), color-stop(80%, #ffffff));
|
334 |
+
background-image: -webkit-linear-gradient(#eeeeee 20%, #ffffff 80%);
|
335 |
+
background-image: -moz-linear-gradient(#eeeeee 20%, #ffffff 80%);
|
336 |
+
background-image: -o-linear-gradient(#eeeeee 20%, #ffffff 80%);
|
337 |
+
background-image: linear-gradient(#eeeeee 20%, #ffffff 80%);
|
338 |
+
box-shadow: 0 1px 0 #fff inset;
|
339 |
+
}
|
340 |
+
.chosen-container-active.chosen-with-drop .chosen-single div {
|
341 |
+
border-left: none;
|
342 |
+
background: transparent;
|
343 |
+
}
|
344 |
+
.chosen-container-active.chosen-with-drop .chosen-single div b {
|
345 |
+
background-position: -18px 2px;
|
346 |
+
}
|
347 |
+
.chosen-container-active .chosen-choices {
|
348 |
+
border: 1px solid #5897fb;
|
349 |
+
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
|
350 |
+
}
|
351 |
+
.chosen-container-active .chosen-choices li.search-field input[type="text"] {
|
352 |
+
color: #222 !important;
|
353 |
+
}
|
354 |
+
|
355 |
+
/* @end */
|
356 |
+
/* @group Disabled Support */
|
357 |
+
.chosen-disabled {
|
358 |
+
opacity: 0.5 !important;
|
359 |
+
cursor: default;
|
360 |
+
}
|
361 |
+
.chosen-disabled .chosen-single {
|
362 |
+
cursor: default;
|
363 |
+
}
|
364 |
+
.chosen-disabled .chosen-choices .search-choice .search-choice-close {
|
365 |
+
cursor: default;
|
366 |
+
}
|
367 |
+
|
368 |
+
/* @end */
|
369 |
+
/* @group Right to Left */
|
370 |
+
.chosen-rtl {
|
371 |
+
text-align: right;
|
372 |
+
}
|
373 |
+
.chosen-rtl .chosen-single {
|
374 |
+
overflow: visible;
|
375 |
+
padding: 0 8px 0 0;
|
376 |
+
}
|
377 |
+
.chosen-rtl .chosen-single span {
|
378 |
+
margin-right: 0;
|
379 |
+
margin-left: 26px;
|
380 |
+
direction: rtl;
|
381 |
+
}
|
382 |
+
.chosen-rtl .chosen-single-with-deselect span {
|
383 |
+
margin-left: 38px;
|
384 |
+
}
|
385 |
+
.chosen-rtl .chosen-single div {
|
386 |
+
right: auto;
|
387 |
+
left: 3px;
|
388 |
+
}
|
389 |
+
.chosen-rtl .chosen-single abbr {
|
390 |
+
right: auto;
|
391 |
+
left: 26px;
|
392 |
+
}
|
393 |
+
.chosen-rtl .chosen-choices li {
|
394 |
+
float: right;
|
395 |
+
}
|
396 |
+
.chosen-rtl .chosen-choices li.search-field input[type="text"] {
|
397 |
+
direction: rtl;
|
398 |
+
}
|
399 |
+
.chosen-rtl .chosen-choices li.search-choice {
|
400 |
+
margin: 3px 5px 3px 0;
|
401 |
+
padding: 3px 5px 3px 19px;
|
402 |
+
}
|
403 |
+
.chosen-rtl .chosen-choices li.search-choice .search-choice-close {
|
404 |
+
right: auto;
|
405 |
+
left: 4px;
|
406 |
+
}
|
407 |
+
.chosen-rtl.chosen-container-single-nosearch .chosen-search,
|
408 |
+
.chosen-rtl .chosen-drop {
|
409 |
+
left: 9999px;
|
410 |
+
}
|
411 |
+
.chosen-rtl.chosen-container-single .chosen-results {
|
412 |
+
margin: 0 0 4px 4px;
|
413 |
+
padding: 0 4px 0 0;
|
414 |
+
}
|
415 |
+
.chosen-rtl .chosen-results li.group-option {
|
416 |
+
padding-right: 15px;
|
417 |
+
padding-left: 0;
|
418 |
+
}
|
419 |
+
.chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div {
|
420 |
+
border-right: none;
|
421 |
+
}
|
422 |
+
.chosen-rtl .chosen-search input[type="text"] {
|
423 |
+
padding: 4px 5px 4px 20px;
|
424 |
+
background: white url('chosen-sprite.png') no-repeat -30px -20px;
|
425 |
+
background: url('chosen-sprite.png') no-repeat -30px -20px;
|
426 |
+
direction: rtl;
|
427 |
+
}
|
428 |
+
.chosen-rtl.chosen-container-single .chosen-single div b {
|
429 |
+
background-position: 6px 2px;
|
430 |
+
}
|
431 |
+
.chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b {
|
432 |
+
background-position: -12px 2px;
|
433 |
+
}
|
434 |
+
|
435 |
+
/* @end */
|
436 |
+
/* @group Retina compatibility */
|
437 |
+
@media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-resolution: 144dpi), only screen and (min-resolution: 1.5dppx) {
|
438 |
+
.chosen-rtl .chosen-search input[type="text"],
|
439 |
+
.chosen-container-single .chosen-single abbr,
|
440 |
+
.chosen-container-single .chosen-single div b,
|
441 |
+
.chosen-container-single .chosen-search input[type="text"],
|
442 |
+
.chosen-container-multi .chosen-choices .search-choice .search-choice-close,
|
443 |
+
.chosen-container .chosen-results-scroll-down span,
|
444 |
+
.chosen-container .chosen-results-scroll-up span {
|
445 |
+
background-image: url('chosen-sprite@2x.png') !important;
|
446 |
+
background-size: 52px 37px !important;
|
447 |
+
background-repeat: no-repeat !important;
|
448 |
+
}
|
449 |
+
}
|
450 |
+
/* @end */
|
assets/lib/chosen_v1.4.2/chosen.jquery.js
ADDED
@@ -0,0 +1,1257 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
Chosen, a Select Box Enhancer for jQuery and Prototype
|
3 |
+
by Patrick Filler for Harvest, http://getharvest.com
|
4 |
+
|
5 |
+
Version 1.4.2
|
6 |
+
Full source at https://github.com/harvesthq/chosen
|
7 |
+
Copyright (c) 2011-2015 Harvest http://getharvest.com
|
8 |
+
|
9 |
+
MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
|
10 |
+
This file is generated by `grunt build`, do not edit it by hand.
|
11 |
+
*/
|
12 |
+
|
13 |
+
(function() {
|
14 |
+
var $, AbstractChosen, Chosen, SelectParser, _ref,
|
15 |
+
__hasProp = {}.hasOwnProperty,
|
16 |
+
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
17 |
+
|
18 |
+
SelectParser = (function() {
|
19 |
+
function SelectParser() {
|
20 |
+
this.options_index = 0;
|
21 |
+
this.parsed = [];
|
22 |
+
}
|
23 |
+
|
24 |
+
SelectParser.prototype.add_node = function(child) {
|
25 |
+
if (child.nodeName.toUpperCase() === "OPTGROUP") {
|
26 |
+
return this.add_group(child);
|
27 |
+
} else {
|
28 |
+
return this.add_option(child);
|
29 |
+
}
|
30 |
+
};
|
31 |
+
|
32 |
+
SelectParser.prototype.add_group = function(group) {
|
33 |
+
var group_position, option, _i, _len, _ref, _results;
|
34 |
+
group_position = this.parsed.length;
|
35 |
+
this.parsed.push({
|
36 |
+
array_index: group_position,
|
37 |
+
group: true,
|
38 |
+
label: this.escapeExpression(group.label),
|
39 |
+
title: group.title ? group.title : void 0,
|
40 |
+
children: 0,
|
41 |
+
disabled: group.disabled,
|
42 |
+
classes: group.className
|
43 |
+
});
|
44 |
+
_ref = group.childNodes;
|
45 |
+
_results = [];
|
46 |
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
47 |
+
option = _ref[_i];
|
48 |
+
_results.push(this.add_option(option, group_position, group.disabled));
|
49 |
+
}
|
50 |
+
return _results;
|
51 |
+
};
|
52 |
+
|
53 |
+
SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
|
54 |
+
if (option.nodeName.toUpperCase() === "OPTION") {
|
55 |
+
if (option.text !== "") {
|
56 |
+
if (group_position != null) {
|
57 |
+
this.parsed[group_position].children += 1;
|
58 |
+
}
|
59 |
+
this.parsed.push({
|
60 |
+
array_index: this.parsed.length,
|
61 |
+
options_index: this.options_index,
|
62 |
+
value: option.value,
|
63 |
+
text: option.text,
|
64 |
+
html: option.innerHTML,
|
65 |
+
title: option.title ? option.title : void 0,
|
66 |
+
selected: option.selected,
|
67 |
+
disabled: group_disabled === true ? group_disabled : option.disabled,
|
68 |
+
group_array_index: group_position,
|
69 |
+
group_label: group_position != null ? this.parsed[group_position].label : null,
|
70 |
+
classes: option.className,
|
71 |
+
style: option.style.cssText
|
72 |
+
});
|
73 |
+
} else {
|
74 |
+
this.parsed.push({
|
75 |
+
array_index: this.parsed.length,
|
76 |
+
options_index: this.options_index,
|
77 |
+
empty: true
|
78 |
+
});
|
79 |
+
}
|
80 |
+
return this.options_index += 1;
|
81 |
+
}
|
82 |
+
};
|
83 |
+
|
84 |
+
SelectParser.prototype.escapeExpression = function(text) {
|
85 |
+
var map, unsafe_chars;
|
86 |
+
if ((text == null) || text === false) {
|
87 |
+
return "";
|
88 |
+
}
|
89 |
+
if (!/[\&\<\>\"\'\`]/.test(text)) {
|
90 |
+
return text;
|
91 |
+
}
|
92 |
+
map = {
|
93 |
+
"<": "<",
|
94 |
+
">": ">",
|
95 |
+
'"': """,
|
96 |
+
"'": "'",
|
97 |
+
"`": "`"
|
98 |
+
};
|
99 |
+
unsafe_chars = /&(?!\w+;)|[\<\>\"\'\`]/g;
|
100 |
+
return text.replace(unsafe_chars, function(chr) {
|
101 |
+
return map[chr] || "&";
|
102 |
+
});
|
103 |
+
};
|
104 |
+
|
105 |
+
return SelectParser;
|
106 |
+
|
107 |
+
})();
|
108 |
+
|
109 |
+
SelectParser.select_to_array = function(select) {
|
110 |
+
var child, parser, _i, _len, _ref;
|
111 |
+
parser = new SelectParser();
|
112 |
+
_ref = select.childNodes;
|
113 |
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
114 |
+
child = _ref[_i];
|
115 |
+
parser.add_node(child);
|
116 |
+
}
|
117 |
+
return parser.parsed;
|
118 |
+
};
|
119 |
+
|
120 |
+
AbstractChosen = (function() {
|
121 |
+
function AbstractChosen(form_field, options) {
|
122 |
+
this.form_field = form_field;
|
123 |
+
this.options = options != null ? options : {};
|
124 |
+
if (!AbstractChosen.browser_is_supported()) {
|
125 |
+
return;
|
126 |
+
}
|
127 |
+
this.is_multiple = this.form_field.multiple;
|
128 |
+
this.set_default_text();
|
129 |
+
this.set_default_values();
|
130 |
+
this.setup();
|
131 |
+
this.set_up_html();
|
132 |
+
this.register_observers();
|
133 |
+
this.on_ready();
|
134 |
+
}
|
135 |
+
|
136 |
+
AbstractChosen.prototype.set_default_values = function() {
|
137 |
+
var _this = this;
|
138 |
+
this.click_test_action = function(evt) {
|
139 |
+
return _this.test_active_click(evt);
|
140 |
+
};
|
141 |
+
this.activate_action = function(evt) {
|
142 |
+
return _this.activate_field(evt);
|
143 |
+
};
|
144 |
+
this.active_field = false;
|
145 |
+
this.mouse_on_container = false;
|
146 |
+
this.results_showing = false;
|
147 |
+
this.result_highlighted = null;
|
148 |
+
this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
|
149 |
+
this.disable_search_threshold = this.options.disable_search_threshold || 0;
|
150 |
+
this.disable_search = this.options.disable_search || false;
|
151 |
+
this.enable_split_word_search = this.options.enable_split_word_search != null ? this.options.enable_split_word_search : true;
|
152 |
+
this.group_search = this.options.group_search != null ? this.options.group_search : true;
|
153 |
+
this.search_contains = this.options.search_contains || false;
|
154 |
+
this.single_backstroke_delete = this.options.single_backstroke_delete != null ? this.options.single_backstroke_delete : true;
|
155 |
+
this.max_selected_options = this.options.max_selected_options || Infinity;
|
156 |
+
this.inherit_select_classes = this.options.inherit_select_classes || false;
|
157 |
+
this.display_selected_options = this.options.display_selected_options != null ? this.options.display_selected_options : true;
|
158 |
+
this.display_disabled_options = this.options.display_disabled_options != null ? this.options.display_disabled_options : true;
|
159 |
+
return this.include_group_label_in_selected = this.options.include_group_label_in_selected || false;
|
160 |
+
};
|
161 |
+
|
162 |
+
AbstractChosen.prototype.set_default_text = function() {
|
163 |
+
if (this.form_field.getAttribute("data-placeholder")) {
|
164 |
+
this.default_text = this.form_field.getAttribute("data-placeholder");
|
165 |
+
} else if (this.is_multiple) {
|
166 |
+
this.default_text = this.options.placeholder_text_multiple || this.options.placeholder_text || AbstractChosen.default_multiple_text;
|
167 |
+
} else {
|
168 |
+
this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || AbstractChosen.default_single_text;
|
169 |
+
}
|
170 |
+
return this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || AbstractChosen.default_no_result_text;
|
171 |
+
};
|
172 |
+
|
173 |
+
AbstractChosen.prototype.choice_label = function(item) {
|
174 |
+
if (this.include_group_label_in_selected && (item.group_label != null)) {
|
175 |
+
return "<b class='group-name'>" + item.group_label + "</b>" + item.html;
|
176 |
+
} else {
|
177 |
+
return item.html;
|
178 |
+
}
|
179 |
+
};
|
180 |
+
|
181 |
+
AbstractChosen.prototype.mouse_enter = function() {
|
182 |
+
return this.mouse_on_container = true;
|
183 |
+
};
|
184 |
+
|
185 |
+
AbstractChosen.prototype.mouse_leave = function() {
|
186 |
+
return this.mouse_on_container = false;
|
187 |
+
};
|
188 |
+
|
189 |
+
AbstractChosen.prototype.input_focus = function(evt) {
|
190 |
+
var _this = this;
|
191 |
+
if (this.is_multiple) {
|
192 |
+
if (!this.active_field) {
|
193 |
+
return setTimeout((function() {
|
194 |
+
return _this.container_mousedown();
|
195 |
+
}), 50);
|
196 |
+
}
|
197 |
+
} else {
|
198 |
+
if (!this.active_field) {
|
199 |
+
return this.activate_field();
|
200 |
+
}
|
201 |
+
}
|
202 |
+
};
|
203 |
+
|
204 |
+
AbstractChosen.prototype.input_blur = function(evt) {
|
205 |
+
var _this = this;
|
206 |
+
if (!this.mouse_on_container) {
|
207 |
+
this.active_field = false;
|
208 |
+
return setTimeout((function() {
|
209 |
+
return _this.blur_test();
|
210 |
+
}), 100);
|
211 |
+
}
|
212 |
+
};
|
213 |
+
|
214 |
+
AbstractChosen.prototype.results_option_build = function(options) {
|
215 |
+
var content, data, _i, _len, _ref;
|
216 |
+
content = '';
|
217 |
+
_ref = this.results_data;
|
218 |
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
219 |
+
data = _ref[_i];
|
220 |
+
if (data.group) {
|
221 |
+
content += this.result_add_group(data);
|
222 |
+
} else {
|
223 |
+
content += this.result_add_option(data);
|
224 |
+
}
|
225 |
+
if (options != null ? options.first : void 0) {
|
226 |
+
if (data.selected && this.is_multiple) {
|
227 |
+
this.choice_build(data);
|
228 |
+
} else if (data.selected && !this.is_multiple) {
|
229 |
+
this.single_set_selected_text(this.choice_label(data));
|
230 |
+
}
|
231 |
+
}
|
232 |
+
}
|
233 |
+
return content;
|
234 |
+
};
|
235 |
+
|
236 |
+
AbstractChosen.prototype.result_add_option = function(option) {
|
237 |
+
var classes, option_el;
|
238 |
+
if (!option.search_match) {
|
239 |
+
return '';
|
240 |
+
}
|
241 |
+
if (!this.include_option_in_results(option)) {
|
242 |
+
return '';
|
243 |
+
}
|
244 |
+
classes = [];
|
245 |
+
if (!option.disabled && !(option.selected && this.is_multiple)) {
|
246 |
+
classes.push("active-result");
|
247 |
+
}
|
248 |
+
if (option.disabled && !(option.selected && this.is_multiple)) {
|
249 |
+
classes.push("disabled-result");
|
250 |
+
}
|
251 |
+
if (option.selected) {
|
252 |
+
classes.push("result-selected");
|
253 |
+
}
|
254 |
+
if (option.group_array_index != null) {
|
255 |
+
classes.push("group-option");
|
256 |
+
}
|
257 |
+
if (option.classes !== "") {
|
258 |
+
classes.push(option.classes);
|
259 |
+
}
|
260 |
+
option_el = document.createElement("li");
|
261 |
+
option_el.className = classes.join(" ");
|
262 |
+
option_el.style.cssText = option.style;
|
263 |
+
option_el.setAttribute("data-option-array-index", option.array_index);
|
264 |
+
option_el.innerHTML = option.search_text;
|
265 |
+
if (option.title) {
|
266 |
+
option_el.title = option.title;
|
267 |
+
}
|
268 |
+
return this.outerHTML(option_el);
|
269 |
+
};
|
270 |
+
|
271 |
+
AbstractChosen.prototype.result_add_group = function(group) {
|
272 |
+
var classes, group_el;
|
273 |
+
if (!(group.search_match || group.group_match)) {
|
274 |
+
return '';
|
275 |
+
}
|
276 |
+
if (!(group.active_options > 0)) {
|
277 |
+
return '';
|
278 |
+
}
|
279 |
+
classes = [];
|
280 |
+
classes.push("group-result");
|
281 |
+
if (group.classes) {
|
282 |
+
classes.push(group.classes);
|
283 |
+
}
|
284 |
+
group_el = document.createElement("li");
|
285 |
+
group_el.className = classes.join(" ");
|
286 |
+
group_el.innerHTML = group.search_text;
|
287 |
+
if (group.title) {
|
288 |
+
group_el.title = group.title;
|
289 |
+
}
|
290 |
+
return this.outerHTML(group_el);
|
291 |
+
};
|
292 |
+
|
293 |
+
AbstractChosen.prototype.results_update_field = function() {
|
294 |
+
this.set_default_text();
|
295 |
+
if (!this.is_multiple) {
|
296 |
+
this.results_reset_cleanup();
|
297 |
+
}
|
298 |
+
this.result_clear_highlight();
|
299 |
+
this.results_build();
|
300 |
+
if (this.results_showing) {
|
301 |
+
return this.winnow_results();
|
302 |
+
}
|
303 |
+
};
|
304 |
+
|
305 |
+
AbstractChosen.prototype.reset_single_select_options = function() {
|
306 |
+
var result, _i, _len, _ref, _results;
|
307 |
+
_ref = this.results_data;
|
308 |
+
_results = [];
|
309 |
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
310 |
+
result = _ref[_i];
|
311 |
+
if (result.selected) {
|
312 |
+
_results.push(result.selected = false);
|
313 |
+
} else {
|
314 |
+
_results.push(void 0);
|
315 |
+
}
|
316 |
+
}
|
317 |
+
return _results;
|
318 |
+
};
|
319 |
+
|
320 |
+
AbstractChosen.prototype.results_toggle = function() {
|
321 |
+
if (this.results_showing) {
|
322 |
+
return this.results_hide();
|
323 |
+
} else {
|
324 |
+
return this.results_show();
|
325 |
+
}
|
326 |
+
};
|
327 |
+
|
328 |
+
AbstractChosen.prototype.results_search = function(evt) {
|
329 |
+
if (this.results_showing) {
|
330 |
+
return this.winnow_results();
|
331 |
+
} else {
|
332 |
+
return this.results_show();
|
333 |
+
}
|
334 |
+
};
|
335 |
+
|
336 |
+
AbstractChosen.prototype.winnow_results = function() {
|
337 |
+
var escapedSearchText, option, regex, results, results_group, searchText, startpos, text, zregex, _i, _len, _ref;
|
338 |
+
this.no_results_clear();
|
339 |
+
results = 0;
|
340 |
+
searchText = this.get_search_text();
|
341 |
+
escapedSearchText = searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
342 |
+
zregex = new RegExp(escapedSearchText, 'i');
|
343 |
+
regex = this.get_search_regex(escapedSearchText);
|
344 |
+
_ref = this.results_data;
|
345 |
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
346 |
+
option = _ref[_i];
|
347 |
+
option.search_match = false;
|
348 |
+
results_group = null;
|
349 |
+
if (this.include_option_in_results(option)) {
|
350 |
+
if (option.group) {
|
351 |
+
option.group_match = false;
|
352 |
+
option.active_options = 0;
|
353 |
+
}
|
354 |
+
if ((option.group_array_index != null) && this.results_data[option.group_array_index]) {
|
355 |
+
results_group = this.results_data[option.group_array_index];
|
356 |
+
if (results_group.active_options === 0 && results_group.search_match) {
|
357 |
+
results += 1;
|
358 |
+
}
|
359 |
+
results_group.active_options += 1;
|
360 |
+
}
|
361 |
+
option.search_text = option.group ? option.label : option.html;
|
362 |
+
if (!(option.group && !this.group_search)) {
|
363 |
+
option.search_match = this.search_string_match(option.search_text, regex);
|
364 |
+
if (option.search_match && !option.group) {
|
365 |
+
results += 1;
|
366 |
+
}
|
367 |
+
if (option.search_match) {
|
368 |
+
if (searchText.length) {
|
369 |
+
startpos = option.search_text.search(zregex);
|
370 |
+
text = option.search_text.substr(0, startpos + searchText.length) + '</em>' + option.search_text.substr(startpos + searchText.length);
|
371 |
+
option.search_text = text.substr(0, startpos) + '<em>' + text.substr(startpos);
|
372 |
+
}
|
373 |
+
if (results_group != null) {
|
374 |
+
results_group.group_match = true;
|
375 |
+
}
|
376 |
+
} else if ((option.group_array_index != null) && this.results_data[option.group_array_index].search_match) {
|
377 |
+
option.search_match = true;
|
378 |
+
}
|
379 |
+
}
|
380 |
+
}
|
381 |
+
}
|
382 |
+
this.result_clear_highlight();
|
383 |
+
if (results < 1 && searchText.length) {
|
384 |
+
this.update_results_content("");
|
385 |
+
return this.no_results(searchText);
|
386 |
+
} else {
|
387 |
+
this.update_results_content(this.results_option_build());
|
388 |
+
return this.winnow_results_set_highlight();
|
389 |
+
}
|
390 |
+
};
|
391 |
+
|
392 |
+
AbstractChosen.prototype.get_search_regex = function(escaped_search_string) {
|
393 |
+
var regex_anchor;
|
394 |
+
regex_anchor = this.search_contains ? "" : "^";
|
395 |
+
return new RegExp(regex_anchor + escaped_search_string, 'i');
|
396 |
+
};
|
397 |
+
|
398 |
+
AbstractChosen.prototype.search_string_match = function(search_string, regex) {
|
399 |
+
var part, parts, _i, _len;
|
400 |
+
if (regex.test(search_string)) {
|
401 |
+
return true;
|
402 |
+
} else if (this.enable_split_word_search && (search_string.indexOf(" ") >= 0 || search_string.indexOf("[") === 0)) {
|
403 |
+
parts = search_string.replace(/\[|\]/g, "").split(" ");
|
404 |
+
if (parts.length) {
|
405 |
+
for (_i = 0, _len = parts.length; _i < _len; _i++) {
|
406 |
+
part = parts[_i];
|
407 |
+
if (regex.test(part)) {
|
408 |
+
return true;
|
409 |
+
}
|
410 |
+
}
|
411 |
+
}
|
412 |
+
}
|
413 |
+
};
|
414 |
+
|
415 |
+
AbstractChosen.prototype.choices_count = function() {
|
416 |
+
var option, _i, _len, _ref;
|
417 |
+
if (this.selected_option_count != null) {
|
418 |
+
return this.selected_option_count;
|
419 |
+
}
|
420 |
+
this.selected_option_count = 0;
|
421 |
+
_ref = this.form_field.options;
|
422 |
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
423 |
+
option = _ref[_i];
|
424 |
+
if (option.selected) {
|
425 |
+
this.selected_option_count += 1;
|
426 |
+
}
|
427 |
+
}
|
428 |
+
return this.selected_option_count;
|
429 |
+
};
|
430 |
+
|
431 |
+
AbstractChosen.prototype.choices_click = function(evt) {
|
432 |
+
evt.preventDefault();
|
433 |
+
if (!(this.results_showing || this.is_disabled)) {
|
434 |
+
return this.results_show();
|
435 |
+
}
|
436 |
+
};
|
437 |
+
|
438 |
+
AbstractChosen.prototype.keyup_checker = function(evt) {
|
439 |
+
var stroke, _ref;
|
440 |
+
stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
|
441 |
+
this.search_field_scale();
|
442 |
+
switch (stroke) {
|
443 |
+
case 8:
|
444 |
+
if (this.is_multiple && this.backstroke_length < 1 && this.choices_count() > 0) {
|
445 |
+
return this.keydown_backstroke();
|
446 |
+
} else if (!this.pending_backstroke) {
|
447 |
+
this.result_clear_highlight();
|
448 |
+
return this.results_search();
|
449 |
+
}
|
450 |
+
break;
|
451 |
+
case 13:
|
452 |
+
evt.preventDefault();
|
453 |
+
if (this.results_showing) {
|
454 |
+
return this.result_select(evt);
|
455 |
+
}
|
456 |
+
break;
|
457 |
+
case 27:
|
458 |
+
if (this.results_showing) {
|
459 |
+
this.results_hide();
|
460 |
+
}
|
461 |
+
return true;
|
462 |
+
case 9:
|
463 |
+
case 38:
|
464 |
+
case 40:
|
465 |
+
case 16:
|
466 |
+
case 91:
|
467 |
+
case 17:
|
468 |
+
break;
|
469 |
+
default:
|
470 |
+
return this.results_search();
|
471 |
+
}
|
472 |
+
};
|
473 |
+
|
474 |
+
AbstractChosen.prototype.clipboard_event_checker = function(evt) {
|
475 |
+
var _this = this;
|
476 |
+
return setTimeout((function() {
|
477 |
+
return _this.results_search();
|
478 |
+
}), 50);
|
479 |
+
};
|
480 |
+
|
481 |
+
AbstractChosen.prototype.container_width = function() {
|
482 |
+
if (this.options.width != null) {
|
483 |
+
return this.options.width;
|
484 |
+
} else {
|
485 |
+
return "" + this.form_field.offsetWidth + "px";
|
486 |
+
}
|
487 |
+
};
|
488 |
+
|
489 |
+
AbstractChosen.prototype.include_option_in_results = function(option) {
|
490 |
+
if (this.is_multiple && (!this.display_selected_options && option.selected)) {
|
491 |
+
return false;
|
492 |
+
}
|
493 |
+
if (!this.display_disabled_options && option.disabled) {
|
494 |
+
return false;
|
495 |
+
}
|
496 |
+
if (option.empty) {
|
497 |
+
return false;
|
498 |
+
}
|
499 |
+
return true;
|
500 |
+
};
|
501 |
+
|
502 |
+
AbstractChosen.prototype.search_results_touchstart = function(evt) {
|
503 |
+
this.touch_started = true;
|
504 |
+
return this.search_results_mouseover(evt);
|
505 |
+
};
|
506 |
+
|
507 |
+
AbstractChosen.prototype.search_results_touchmove = function(evt) {
|
508 |
+
this.touch_started = false;
|
509 |
+
return this.search_results_mouseout(evt);
|
510 |
+
};
|
511 |
+
|
512 |
+
AbstractChosen.prototype.search_results_touchend = function(evt) {
|
513 |
+
if (this.touch_started) {
|
514 |
+
return this.search_results_mouseup(evt);
|
515 |
+
}
|
516 |
+
};
|
517 |
+
|
518 |
+
AbstractChosen.prototype.outerHTML = function(element) {
|
519 |
+
var tmp;
|
520 |
+
if (element.outerHTML) {
|
521 |
+
return element.outerHTML;
|
522 |
+
}
|
523 |
+
tmp = document.createElement("div");
|
524 |
+
tmp.appendChild(element);
|
525 |
+
return tmp.innerHTML;
|
526 |
+
};
|
527 |
+
|
528 |
+
AbstractChosen.browser_is_supported = function() {
|
529 |
+
if (window.navigator.appName === "Microsoft Internet Explorer") {
|
530 |
+
return document.documentMode >= 8;
|
531 |
+
}
|
532 |
+
if (/iP(od|hone)/i.test(window.navigator.userAgent)) {
|
533 |
+
return false;
|
534 |
+
}
|
535 |
+
if (/Android/i.test(window.navigator.userAgent)) {
|
536 |
+
if (/Mobile/i.test(window.navigator.userAgent)) {
|
537 |
+
return false;
|
538 |
+
}
|
539 |
+
}
|
540 |
+
return true;
|
541 |
+
};
|
542 |
+
|
543 |
+
AbstractChosen.default_multiple_text = "Select Some Options";
|
544 |
+
|
545 |
+
AbstractChosen.default_single_text = "Select an Option";
|
546 |
+
|
547 |
+
AbstractChosen.default_no_result_text = "No results match";
|
548 |
+
|
549 |
+
return AbstractChosen;
|
550 |
+
|
551 |
+
})();
|
552 |
+
|
553 |
+
$ = jQuery;
|
554 |
+
|
555 |
+
$.fn.extend({
|
556 |
+
chosen: function(options) {
|
557 |
+
if (!AbstractChosen.browser_is_supported()) {
|
558 |
+
return this;
|
559 |
+
}
|
560 |
+
return this.each(function(input_field) {
|
561 |
+
var $this, chosen;
|
562 |
+
$this = $(this);
|
563 |
+
chosen = $this.data('chosen');
|
564 |
+
if (options === 'destroy' && chosen instanceof Chosen) {
|
565 |
+
chosen.destroy();
|
566 |
+
} else if (!(chosen instanceof Chosen)) {
|
567 |
+
$this.data('chosen', new Chosen(this, options));
|
568 |
+
}
|
569 |
+
});
|
570 |
+
}
|
571 |
+
});
|
572 |
+
|
573 |
+
Chosen = (function(_super) {
|
574 |
+
__extends(Chosen, _super);
|
575 |
+
|
576 |
+
function Chosen() {
|
577 |
+
_ref = Chosen.__super__.constructor.apply(this, arguments);
|
578 |
+
return _ref;
|
579 |
+
}
|
580 |
+
|
581 |
+
Chosen.prototype.setup = function() {
|
582 |
+
this.form_field_jq = $(this.form_field);
|
583 |
+
this.current_selectedIndex = this.form_field.selectedIndex;
|
584 |
+
return this.is_rtl = this.form_field_jq.hasClass("chosen-rtl");
|
585 |
+
};
|
586 |
+
|
587 |
+
Chosen.prototype.set_up_html = function() {
|
588 |
+
var container_classes, container_props;
|
589 |
+
container_classes = ["chosen-container"];
|
590 |
+
container_classes.push("chosen-container-" + (this.is_multiple ? "multi" : "single"));
|
591 |
+
if (this.inherit_select_classes && this.form_field.className) {
|
592 |
+
container_classes.push(this.form_field.className);
|
593 |
+
}
|
594 |
+
if (this.is_rtl) {
|
595 |
+
container_classes.push("chosen-rtl");
|
596 |
+
}
|
597 |
+
container_props = {
|
598 |
+
'class': container_classes.join(' '),
|
599 |
+
'style': "width: " + (this.container_width()) + ";",
|
600 |
+
'title': this.form_field.title
|
601 |
+
};
|
602 |
+
if (this.form_field.id.length) {
|
603 |
+
container_props.id = this.form_field.id.replace(/[^\w]/g, '_') + "_chosen";
|
604 |
+
}
|
605 |
+
this.container = $("<div />", container_props);
|
606 |
+
if (this.is_multiple) {
|
607 |
+
this.container.html('<ul class="chosen-choices"><li class="search-field"><input type="text" value="' + this.default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>');
|
608 |
+
} else {
|
609 |
+
this.container.html('<a class="chosen-single chosen-default" tabindex="-1"><span>' + this.default_text + '</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>');
|
610 |
+
}
|
611 |
+
this.form_field_jq.hide().after(this.container);
|
612 |
+
this.dropdown = this.container.find('div.chosen-drop').first();
|
613 |
+
this.search_field = this.container.find('input').first();
|
614 |
+
this.search_results = this.container.find('ul.chosen-results').first();
|
615 |
+
this.search_field_scale();
|
616 |
+
this.search_no_results = this.container.find('li.no-results').first();
|
617 |
+
if (this.is_multiple) {
|
618 |
+
this.search_choices = this.container.find('ul.chosen-choices').first();
|
619 |
+
this.search_container = this.container.find('li.search-field').first();
|
620 |
+
} else {
|
621 |
+
this.search_container = this.container.find('div.chosen-search').first();
|
622 |
+
this.selected_item = this.container.find('.chosen-single').first();
|
623 |
+
}
|
624 |
+
this.results_build();
|
625 |
+
this.set_tab_index();
|
626 |
+
return this.set_label_behavior();
|
627 |
+
};
|
628 |
+
|
629 |
+
Chosen.prototype.on_ready = function() {
|
630 |
+
return this.form_field_jq.trigger("chosen:ready", {
|
631 |
+
chosen: this
|
632 |
+
});
|
633 |
+
};
|
634 |
+
|
635 |
+
Chosen.prototype.register_observers = function() {
|
636 |
+
var _this = this;
|
637 |
+
this.container.bind('touchstart.chosen', function(evt) {
|
638 |
+
_this.container_mousedown(evt);
|
639 |
+
return evt.preventDefault();
|
640 |
+
});
|
641 |
+
this.container.bind('touchend.chosen', function(evt) {
|
642 |
+
_this.container_mouseup(evt);
|
643 |
+
return evt.preventDefault();
|
644 |
+
});
|
645 |
+
this.container.bind('mousedown.chosen', function(evt) {
|
646 |
+
_this.container_mousedown(evt);
|
647 |
+
});
|
648 |
+
this.container.bind('mouseup.chosen', function(evt) {
|
649 |
+
_this.container_mouseup(evt);
|
650 |
+
});
|
651 |
+
this.container.bind('mouseenter.chosen', function(evt) {
|
652 |
+
_this.mouse_enter(evt);
|
653 |
+
});
|
654 |
+
this.container.bind('mouseleave.chosen', function(evt) {
|
655 |
+
_this.mouse_leave(evt);
|
656 |
+
});
|
657 |
+
this.search_results.bind('mouseup.chosen', function(evt) {
|
658 |
+
_this.search_results_mouseup(evt);
|
659 |
+
});
|
660 |
+
this.search_results.bind('mouseover.chosen', function(evt) {
|
661 |
+
_this.search_results_mouseover(evt);
|
662 |
+
});
|
663 |
+
this.search_results.bind('mouseout.chosen', function(evt) {
|
664 |
+
_this.search_results_mouseout(evt);
|
665 |
+
});
|
666 |
+
this.search_results.bind('mousewheel.chosen DOMMouseScroll.chosen', function(evt) {
|
667 |
+
_this.search_results_mousewheel(evt);
|
668 |
+
});
|
669 |
+
this.search_results.bind('touchstart.chosen', function(evt) {
|
670 |
+
_this.search_results_touchstart(evt);
|
671 |
+
});
|
672 |
+
this.search_results.bind('touchmove.chosen', function(evt) {
|
673 |
+
_this.search_results_touchmove(evt);
|
674 |
+
});
|
675 |
+
this.search_results.bind('touchend.chosen', function(evt) {
|
676 |
+
_this.search_results_touchend(evt);
|
677 |
+
});
|
678 |
+
this.form_field_jq.bind("chosen:updated.chosen", function(evt) {
|
679 |
+
_this.results_update_field(evt);
|
680 |
+
});
|
681 |
+
this.form_field_jq.bind("chosen:activate.chosen", function(evt) {
|
682 |
+
_this.activate_field(evt);
|
683 |
+
});
|
684 |
+
this.form_field_jq.bind("chosen:open.chosen", function(evt) {
|
685 |
+
_this.container_mousedown(evt);
|
686 |
+
});
|
687 |
+
this.form_field_jq.bind("chosen:close.chosen", function(evt) {
|
688 |
+
_this.input_blur(evt);
|
689 |
+
});
|
690 |
+
this.search_field.bind('blur.chosen', function(evt) {
|
691 |
+
_this.input_blur(evt);
|
692 |
+
});
|
693 |
+
this.search_field.bind('keyup.chosen', function(evt) {
|
694 |
+
_this.keyup_checker(evt);
|
695 |
+
});
|
696 |
+
this.search_field.bind('keydown.chosen', function(evt) {
|
697 |
+
_this.keydown_checker(evt);
|
698 |
+
});
|
699 |
+
this.search_field.bind('focus.chosen', function(evt) {
|
700 |
+
_this.input_focus(evt);
|
701 |
+
});
|
702 |
+
this.search_field.bind('cut.chosen', function(evt) {
|
703 |
+
_this.clipboard_event_checker(evt);
|
704 |
+
});
|
705 |
+
this.search_field.bind('paste.chosen', function(evt) {
|
706 |
+
_this.clipboard_event_checker(evt);
|
707 |
+
});
|
708 |
+
if (this.is_multiple) {
|
709 |
+
return this.search_choices.bind('click.chosen', function(evt) {
|
710 |
+
_this.choices_click(evt);
|
711 |
+
});
|
712 |
+
} else {
|
713 |
+
return this.container.bind('click.chosen', function(evt) {
|
714 |
+
evt.preventDefault();
|
715 |
+
});
|
716 |
+
}
|
717 |
+
};
|
718 |
+
|
719 |
+
Chosen.prototype.destroy = function() {
|
720 |
+
$(this.container[0].ownerDocument).unbind("click.chosen", this.click_test_action);
|
721 |
+
if (this.search_field[0].tabIndex) {
|
722 |
+
this.form_field_jq[0].tabIndex = this.search_field[0].tabIndex;
|
723 |
+
}
|
724 |
+
this.container.remove();
|
725 |
+
this.form_field_jq.removeData('chosen');
|
726 |
+
return this.form_field_jq.show();
|
727 |
+
};
|
728 |
+
|
729 |
+
Chosen.prototype.search_field_disabled = function() {
|
730 |
+
this.is_disabled = this.form_field_jq[0].disabled;
|
731 |
+
if (this.is_disabled) {
|
732 |
+
this.container.addClass('chosen-disabled');
|
733 |
+
this.search_field[0].disabled = true;
|
734 |
+
if (!this.is_multiple) {
|
735 |
+
this.selected_item.unbind("focus.chosen", this.activate_action);
|
736 |
+
}
|
737 |
+
return this.close_field();
|
738 |
+
} else {
|
739 |
+
this.container.removeClass('chosen-disabled');
|
740 |
+
this.search_field[0].disabled = false;
|
741 |
+
if (!this.is_multiple) {
|
742 |
+
return this.selected_item.bind("focus.chosen", this.activate_action);
|
743 |
+
}
|
744 |
+
}
|
745 |
+
};
|
746 |
+
|
747 |
+
Chosen.prototype.container_mousedown = function(evt) {
|
748 |
+
if (!this.is_disabled) {
|
749 |
+
if (evt && evt.type === "mousedown" && !this.results_showing) {
|
750 |
+
evt.preventDefault();
|
751 |
+
}
|
752 |
+
if (!((evt != null) && ($(evt.target)).hasClass("search-choice-close"))) {
|
753 |
+
if (!this.active_field) {
|
754 |
+
if (this.is_multiple) {
|
755 |
+
this.search_field.val("");
|
756 |
+
}
|
757 |
+
$(this.container[0].ownerDocument).bind('click.chosen', this.click_test_action);
|
758 |
+
this.results_show();
|
759 |
+
} else if (!this.is_multiple && evt && (($(evt.target)[0] === this.selected_item[0]) || $(evt.target).parents("a.chosen-single").length)) {
|
760 |
+
evt.preventDefault();
|
761 |
+
this.results_toggle();
|
762 |
+
}
|
763 |
+
return this.activate_field();
|
764 |
+
}
|
765 |
+
}
|
766 |
+
};
|
767 |
+
|
768 |
+
Chosen.prototype.container_mouseup = function(evt) {
|
769 |
+
if (evt.target.nodeName === "ABBR" && !this.is_disabled) {
|
770 |
+
return this.results_reset(evt);
|
771 |
+
}
|
772 |
+
};
|
773 |
+
|
774 |
+
Chosen.prototype.search_results_mousewheel = function(evt) {
|
775 |
+
var delta;
|
776 |
+
if (evt.originalEvent) {
|
777 |
+
delta = evt.originalEvent.deltaY || -evt.originalEvent.wheelDelta || evt.originalEvent.detail;
|
778 |
+
}
|
779 |
+
if (delta != null) {
|
780 |
+
evt.preventDefault();
|
781 |
+
if (evt.type === 'DOMMouseScroll') {
|
782 |
+
delta = delta * 40;
|
783 |
+
}
|
784 |
+
return this.search_results.scrollTop(delta + this.search_results.scrollTop());
|
785 |
+
}
|
786 |
+
};
|
787 |
+
|
788 |
+
Chosen.prototype.blur_test = function(evt) {
|
789 |
+
if (!this.active_field && this.container.hasClass("chosen-container-active")) {
|
790 |
+
return this.close_field();
|
791 |
+
}
|
792 |
+
};
|
793 |
+
|
794 |
+
Chosen.prototype.close_field = function() {
|
795 |
+
$(this.container[0].ownerDocument).unbind("click.chosen", this.click_test_action);
|
796 |
+
this.active_field = false;
|
797 |
+
this.results_hide();
|
798 |
+
this.container.removeClass("chosen-container-active");
|
799 |
+
this.clear_backstroke();
|
800 |
+
this.show_search_field_default();
|
801 |
+
return this.search_field_scale();
|
802 |
+
};
|
803 |
+
|
804 |
+
Chosen.prototype.activate_field = function() {
|
805 |
+
this.container.addClass("chosen-container-active");
|
806 |
+
this.active_field = true;
|
807 |
+
this.search_field.val(this.search_field.val());
|
808 |
+
return this.search_field.focus();
|
809 |
+
};
|
810 |
+
|
811 |
+
Chosen.prototype.test_active_click = function(evt) {
|
812 |
+
var active_container;
|
813 |
+
active_container = $(evt.target).closest('.chosen-container');
|
814 |
+
if (active_container.length && this.container[0] === active_container[0]) {
|
815 |
+
return this.active_field = true;
|
816 |
+
} else {
|
817 |
+
return this.close_field();
|
818 |
+
}
|
819 |
+
};
|
820 |
+
|
821 |
+
Chosen.prototype.results_build = function() {
|
822 |
+
this.parsing = true;
|
823 |
+
this.selected_option_count = null;
|
824 |
+
this.results_data = SelectParser.select_to_array(this.form_field);
|
825 |
+
if (this.is_multiple) {
|
826 |
+
this.search_choices.find("li.search-choice").remove();
|
827 |
+
} else if (!this.is_multiple) {
|
828 |
+
this.single_set_selected_text();
|
829 |
+
if (this.disable_search || this.form_field.options.length <= this.disable_search_threshold) {
|
830 |
+
this.search_field[0].readOnly = true;
|
831 |
+
this.container.addClass("chosen-container-single-nosearch");
|
832 |
+
} else {
|
833 |
+
this.search_field[0].readOnly = false;
|
834 |
+
this.container.removeClass("chosen-container-single-nosearch");
|
835 |
+
}
|
836 |
+
}
|
837 |
+
this.update_results_content(this.results_option_build({
|
838 |
+
first: true
|
839 |
+
}));
|
840 |
+
this.search_field_disabled();
|
841 |
+
this.show_search_field_default();
|
842 |
+
this.search_field_scale();
|
843 |
+
return this.parsing = false;
|
844 |
+
};
|
845 |
+
|
846 |
+
Chosen.prototype.result_do_highlight = function(el) {
|
847 |
+
var high_bottom, high_top, maxHeight, visible_bottom, visible_top;
|
848 |
+
if (el.length) {
|
849 |
+
this.result_clear_highlight();
|
850 |
+
this.result_highlight = el;
|
851 |
+
this.result_highlight.addClass("highlighted");
|
852 |
+
maxHeight = parseInt(this.search_results.css("maxHeight"), 10);
|
853 |
+
visible_top = this.search_results.scrollTop();
|
854 |
+
visible_bottom = maxHeight + visible_top;
|
855 |
+
high_top = this.result_highlight.position().top + this.search_results.scrollTop();
|
856 |
+
high_bottom = high_top + this.result_highlight.outerHeight();
|
857 |
+
if (high_bottom >= visible_bottom) {
|
858 |
+
return this.search_results.scrollTop((high_bottom - maxHeight) > 0 ? high_bottom - maxHeight : 0);
|
859 |
+
} else if (high_top < visible_top) {
|
860 |
+
return this.search_results.scrollTop(high_top);
|
861 |
+
}
|
862 |
+
}
|
863 |
+
};
|
864 |
+
|
865 |
+
Chosen.prototype.result_clear_highlight = function() {
|
866 |
+
if (this.result_highlight) {
|
867 |
+
this.result_highlight.removeClass("highlighted");
|
868 |
+
}
|
869 |
+
return this.result_highlight = null;
|
870 |
+
};
|
871 |
+
|
872 |
+
Chosen.prototype.results_show = function() {
|
873 |
+
if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
|
874 |
+
this.form_field_jq.trigger("chosen:maxselected", {
|
875 |
+
chosen: this
|
876 |
+
});
|
877 |
+
return false;
|
878 |
+
}
|
879 |
+
this.container.addClass("chosen-with-drop");
|
880 |
+
this.results_showing = true;
|
881 |
+
this.search_field.focus();
|
882 |
+
this.search_field.val(this.search_field.val());
|
883 |
+
this.winnow_results();
|
884 |
+
return this.form_field_jq.trigger("chosen:showing_dropdown", {
|
885 |
+
chosen: this
|
886 |
+
});
|
887 |
+
};
|
888 |
+
|
889 |
+
Chosen.prototype.update_results_content = function(content) {
|
890 |
+
return this.search_results.html(content);
|
891 |
+
};
|
892 |
+
|
893 |
+
Chosen.prototype.results_hide = function() {
|
894 |
+
if (this.results_showing) {
|
895 |
+
this.result_clear_highlight();
|
896 |
+
this.container.removeClass("chosen-with-drop");
|
897 |
+
this.form_field_jq.trigger("chosen:hiding_dropdown", {
|
898 |
+
chosen: this
|
899 |
+
});
|
900 |
+
}
|
901 |
+
return this.results_showing = false;
|
902 |
+
};
|
903 |
+
|
904 |
+
Chosen.prototype.set_tab_index = function(el) {
|
905 |
+
var ti;
|
906 |
+
if (this.form_field.tabIndex) {
|
907 |
+
ti = this.form_field.tabIndex;
|
908 |
+
this.form_field.tabIndex = -1;
|
909 |
+
return this.search_field[0].tabIndex = ti;
|
910 |
+
}
|
911 |
+
};
|
912 |
+
|
913 |
+
Chosen.prototype.set_label_behavior = function() {
|
914 |
+
var _this = this;
|
915 |
+
this.form_field_label = this.form_field_jq.parents("label");
|
916 |
+
if (!this.form_field_label.length && this.form_field.id.length) {
|
917 |
+
this.form_field_label = $("label[for='" + this.form_field.id + "']");
|
918 |
+
}
|
919 |
+
if (this.form_field_label.length > 0) {
|
920 |
+
return this.form_field_label.bind('click.chosen', function(evt) {
|
921 |
+
if (_this.is_multiple) {
|
922 |
+
return _this.container_mousedown(evt);
|
923 |
+
} else {
|
924 |
+
return _this.activate_field();
|
925 |
+
}
|
926 |
+
});
|
927 |
+
}
|
928 |
+
};
|
929 |
+
|
930 |
+
Chosen.prototype.show_search_field_default = function() {
|
931 |
+
if (this.is_multiple && this.choices_count() < 1 && !this.active_field) {
|
932 |
+
this.search_field.val(this.default_text);
|
933 |
+
return this.search_field.addClass("default");
|
934 |
+
} else {
|
935 |
+
this.search_field.val("");
|
936 |
+
return this.search_field.removeClass("default");
|
937 |
+
}
|
938 |
+
};
|
939 |
+
|
940 |
+
Chosen.prototype.search_results_mouseup = function(evt) {
|
941 |
+
var target;
|
942 |
+
target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
|
943 |
+
if (target.length) {
|
944 |
+
this.result_highlight = target;
|
945 |
+
this.result_select(evt);
|
946 |
+
return this.search_field.focus();
|
947 |
+
}
|
948 |
+
};
|
949 |
+
|
950 |
+
Chosen.prototype.search_results_mouseover = function(evt) {
|
951 |
+
var target;
|
952 |
+
target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
|
953 |
+
if (target) {
|
954 |
+
return this.result_do_highlight(target);
|
955 |
+
}
|
956 |
+
};
|
957 |
+
|
958 |
+
Chosen.prototype.search_results_mouseout = function(evt) {
|
959 |
+
if ($(evt.target).hasClass("active-result" || $(evt.target).parents('.active-result').first())) {
|
960 |
+
return this.result_clear_highlight();
|
961 |
+
}
|
962 |
+
};
|
963 |
+
|
964 |
+
Chosen.prototype.choice_build = function(item) {
|
965 |
+
var choice, close_link,
|
966 |
+
_this = this;
|
967 |
+
choice = $('<li />', {
|
968 |
+
"class": "search-choice"
|
969 |
+
}).html("<span>" + (this.choice_label(item)) + "</span>");
|
970 |
+
if (item.disabled) {
|
971 |
+
choice.addClass('search-choice-disabled');
|
972 |
+
} else {
|
973 |
+
close_link = $('<a />', {
|
974 |
+
"class": 'search-choice-close',
|
975 |
+
'data-option-array-index': item.array_index
|
976 |
+
});
|
977 |
+
close_link.bind('click.chosen', function(evt) {
|
978 |
+
return _this.choice_destroy_link_click(evt);
|
979 |
+
});
|
980 |
+
choice.append(close_link);
|
981 |
+
}
|
982 |
+
return this.search_container.before(choice);
|
983 |
+
};
|
984 |
+
|
985 |
+
Chosen.prototype.choice_destroy_link_click = function(evt) {
|
986 |
+
evt.preventDefault();
|
987 |
+
evt.stopPropagation();
|
988 |
+
if (!this.is_disabled) {
|
989 |
+
return this.choice_destroy($(evt.target));
|
990 |
+
}
|
991 |
+
};
|
992 |
+
|
993 |
+
Chosen.prototype.choice_destroy = function(link) {
|
994 |
+
if (this.result_deselect(link[0].getAttribute("data-option-array-index"))) {
|
995 |
+
this.show_search_field_default();
|
996 |
+
if (this.is_multiple && this.choices_count() > 0 && this.search_field.val().length < 1) {
|
997 |
+
this.results_hide();
|
998 |
+
}
|
999 |
+
link.parents('li').first().remove();
|
1000 |
+
return this.search_field_scale();
|
1001 |
+
}
|
1002 |
+
};
|
1003 |
+
|
1004 |
+
Chosen.prototype.results_reset = function() {
|
1005 |
+
this.reset_single_select_options();
|
1006 |
+
this.form_field.options[0].selected = true;
|
1007 |
+
this.single_set_selected_text();
|
1008 |
+
this.show_search_field_default();
|
1009 |
+
this.results_reset_cleanup();
|
1010 |
+
this.form_field_jq.trigger("change");
|
1011 |
+
if (this.active_field) {
|
1012 |
+
return this.results_hide();
|
1013 |
+
}
|
1014 |
+
};
|
1015 |
+
|
1016 |
+
Chosen.prototype.results_reset_cleanup = function() {
|
1017 |
+
this.current_selectedIndex = this.form_field.selectedIndex;
|
1018 |
+
return this.selected_item.find("abbr").remove();
|
1019 |
+
};
|
1020 |
+
|
1021 |
+
Chosen.prototype.result_select = function(evt) {
|
1022 |
+
var high, item;
|
1023 |
+
if (this.result_highlight) {
|
1024 |
+
high = this.result_highlight;
|
1025 |
+
this.result_clear_highlight();
|
1026 |
+
if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
|
1027 |
+
this.form_field_jq.trigger("chosen:maxselected", {
|
1028 |
+
chosen: this
|
1029 |
+
});
|
1030 |
+
return false;
|
1031 |
+
}
|
1032 |
+
if (this.is_multiple) {
|
1033 |
+
high.removeClass("active-result");
|
1034 |
+
} else {
|
1035 |
+
this.reset_single_select_options();
|
1036 |
+
}
|
1037 |
+
high.addClass("result-selected");
|
1038 |
+
item = this.results_data[high[0].getAttribute("data-option-array-index")];
|
1039 |
+
item.selected = true;
|
1040 |
+
this.form_field.options[item.options_index].selected = true;
|
1041 |
+
this.selected_option_count = null;
|
1042 |
+
if (this.is_multiple) {
|
1043 |
+
this.choice_build(item);
|
1044 |
+
} else {
|
1045 |
+
this.single_set_selected_text(this.choice_label(item));
|
1046 |
+
}
|
1047 |
+
if (!((evt.metaKey || evt.ctrlKey) && this.is_multiple)) {
|
1048 |
+
this.results_hide();
|
1049 |
+
}
|
1050 |
+
this.search_field.val("");
|
1051 |
+
if (this.is_multiple || this.form_field.selectedIndex !== this.current_selectedIndex) {
|
1052 |
+
this.form_field_jq.trigger("change", {
|
1053 |
+
'selected': this.form_field.options[item.options_index].value
|
1054 |
+
});
|
1055 |
+
}
|
1056 |
+
this.current_selectedIndex = this.form_field.selectedIndex;
|
1057 |
+
evt.preventDefault();
|
1058 |
+
return this.search_field_scale();
|
1059 |
+
}
|
1060 |
+
};
|
1061 |
+
|
1062 |
+
Chosen.prototype.single_set_selected_text = function(text) {
|
1063 |
+
if (text == null) {
|
1064 |
+
text = this.default_text;
|
1065 |
+
}
|
1066 |
+
if (text === this.default_text) {
|
1067 |
+
this.selected_item.addClass("chosen-default");
|
1068 |
+
} else {
|
1069 |
+
this.single_deselect_control_build();
|
1070 |
+
this.selected_item.removeClass("chosen-default");
|
1071 |
+
}
|
1072 |
+
return this.selected_item.find("span").html(text);
|
1073 |
+
};
|
1074 |
+
|
1075 |
+
Chosen.prototype.result_deselect = function(pos) {
|
1076 |
+
var result_data;
|
1077 |
+
result_data = this.results_data[pos];
|
1078 |
+
if (!this.form_field.options[result_data.options_index].disabled) {
|
1079 |
+
result_data.selected = false;
|
1080 |
+
this.form_field.options[result_data.options_index].selected = false;
|
1081 |
+
this.selected_option_count = null;
|
1082 |
+
this.result_clear_highlight();
|
1083 |
+
if (this.results_showing) {
|
1084 |
+
this.winnow_results();
|
1085 |
+
}
|
1086 |
+
this.form_field_jq.trigger("change", {
|
1087 |
+
deselected: this.form_field.options[result_data.options_index].value
|
1088 |
+
});
|
1089 |
+
this.search_field_scale();
|
1090 |
+
return true;
|
1091 |
+
} else {
|
1092 |
+
return false;
|
1093 |
+
}
|
1094 |
+
};
|
1095 |
+
|
1096 |
+
Chosen.prototype.single_deselect_control_build = function() {
|
1097 |
+
if (!this.allow_single_deselect) {
|
1098 |
+
return;
|
1099 |
+
}
|
1100 |
+
if (!this.selected_item.find("abbr").length) {
|
1101 |
+
this.selected_item.find("span").first().after("<abbr class=\"search-choice-close\"></abbr>");
|
1102 |
+
}
|
1103 |
+
return this.selected_item.addClass("chosen-single-with-deselect");
|
1104 |
+
};
|
1105 |
+
|
1106 |
+
Chosen.prototype.get_search_text = function() {
|
1107 |
+
return $('<div/>').text($.trim(this.search_field.val())).html();
|
1108 |
+
};
|
1109 |
+
|
1110 |
+
Chosen.prototype.winnow_results_set_highlight = function() {
|
1111 |
+
var do_high, selected_results;
|
1112 |
+
selected_results = !this.is_multiple ? this.search_results.find(".result-selected.active-result") : [];
|
1113 |
+
do_high = selected_results.length ? selected_results.first() : this.search_results.find(".active-result").first();
|
1114 |
+
if (do_high != null) {
|
1115 |
+
return this.result_do_highlight(do_high);
|
1116 |
+
}
|
1117 |
+
};
|
1118 |
+
|
1119 |
+
Chosen.prototype.no_results = function(terms) {
|
1120 |
+
var no_results_html;
|
1121 |
+
no_results_html = $('<li class="no-results">' + this.results_none_found + ' "<span></span>"</li>');
|
1122 |
+
no_results_html.find("span").first().html(terms);
|
1123 |
+
this.search_results.append(no_results_html);
|
1124 |
+
return this.form_field_jq.trigger("chosen:no_results", {
|
1125 |
+
chosen: this
|
1126 |
+
});
|
1127 |
+
};
|
1128 |
+
|
1129 |
+
Chosen.prototype.no_results_clear = function() {
|
1130 |
+
return this.search_results.find(".no-results").remove();
|
1131 |
+
};
|
1132 |
+
|
1133 |
+
Chosen.prototype.keydown_arrow = function() {
|
1134 |
+
var next_sib;
|
1135 |
+
if (this.results_showing && this.result_highlight) {
|
1136 |
+
next_sib = this.result_highlight.nextAll("li.active-result").first();
|
1137 |
+
if (next_sib) {
|
1138 |
+
return this.result_do_highlight(next_sib);
|
1139 |
+
}
|
1140 |
+
} else {
|
1141 |
+
return this.results_show();
|
1142 |
+
}
|
1143 |
+
};
|
1144 |
+
|
1145 |
+
Chosen.prototype.keyup_arrow = function() {
|
1146 |
+
var prev_sibs;
|
1147 |
+
if (!this.results_showing && !this.is_multiple) {
|
1148 |
+
return this.results_show();
|
1149 |
+
} else if (this.result_highlight) {
|
1150 |
+
prev_sibs = this.result_highlight.prevAll("li.active-result");
|
1151 |
+
if (prev_sibs.length) {
|
1152 |
+
return this.result_do_highlight(prev_sibs.first());
|
1153 |
+
} else {
|
1154 |
+
if (this.choices_count() > 0) {
|
1155 |
+
this.results_hide();
|
1156 |
+
}
|
1157 |
+
return this.result_clear_highlight();
|
1158 |
+
}
|
1159 |
+
}
|
1160 |
+
};
|
1161 |
+
|
1162 |
+
Chosen.prototype.keydown_backstroke = function() {
|
1163 |
+
var next_available_destroy;
|
1164 |
+
if (this.pending_backstroke) {
|
1165 |
+
this.choice_destroy(this.pending_backstroke.find("a").first());
|
1166 |
+
return this.clear_backstroke();
|
1167 |
+
} else {
|
1168 |
+
next_available_destroy = this.search_container.siblings("li.search-choice").last();
|
1169 |
+
if (next_available_destroy.length && !next_available_destroy.hasClass("search-choice-disabled")) {
|
1170 |
+
this.pending_backstroke = next_available_destroy;
|
1171 |
+
if (this.single_backstroke_delete) {
|
1172 |
+
return this.keydown_backstroke();
|
1173 |
+
} else {
|
1174 |
+
return this.pending_backstroke.addClass("search-choice-focus");
|
1175 |
+
}
|
1176 |
+
}
|
1177 |
+
}
|
1178 |
+
};
|
1179 |
+
|
1180 |
+
Chosen.prototype.clear_backstroke = function() {
|
1181 |
+
if (this.pending_backstroke) {
|
1182 |
+
this.pending_backstroke.removeClass("search-choice-focus");
|
1183 |
+
}
|
1184 |
+
return this.pending_backstroke = null;
|
1185 |
+
};
|
1186 |
+
|
1187 |
+
Chosen.prototype.keydown_checker = function(evt) {
|
1188 |
+
var stroke, _ref1;
|
1189 |
+
stroke = (_ref1 = evt.which) != null ? _ref1 : evt.keyCode;
|
1190 |
+
this.search_field_scale();
|
1191 |
+
if (stroke !== 8 && this.pending_backstroke) {
|
1192 |
+
this.clear_backstroke();
|
1193 |
+
}
|
1194 |
+
switch (stroke) {
|
1195 |
+
case 8:
|
1196 |
+
this.backstroke_length = this.search_field.val().length;
|
1197 |
+
break;
|
1198 |
+
case 9:
|
1199 |
+
if (this.results_showing && !this.is_multiple) {
|
1200 |
+
this.result_select(evt);
|
1201 |
+
}
|
1202 |
+
this.mouse_on_container = false;
|
1203 |
+
break;
|
1204 |
+
case 13:
|
1205 |
+
if (this.results_showing) {
|
1206 |
+
evt.preventDefault();
|
1207 |
+
}
|
1208 |
+
break;
|
1209 |
+
case 32:
|
1210 |
+
if (this.disable_search) {
|
1211 |
+
evt.preventDefault();
|
1212 |
+
}
|
1213 |
+
break;
|
1214 |
+
case 38:
|
1215 |
+
evt.preventDefault();
|
1216 |
+
this.keyup_arrow();
|
1217 |
+
break;
|
1218 |
+
case 40:
|
1219 |
+
evt.preventDefault();
|
1220 |
+
this.keydown_arrow();
|
1221 |
+
break;
|
1222 |
+
}
|
1223 |
+
};
|
1224 |
+
|
1225 |
+
Chosen.prototype.search_field_scale = function() {
|
1226 |
+
var div, f_width, h, style, style_block, styles, w, _i, _len;
|
1227 |
+
if (this.is_multiple) {
|
1228 |
+
h = 0;
|
1229 |
+
w = 0;
|
1230 |
+
style_block = "position:absolute; left: -1000px; top: -1000px; display:none;";
|
1231 |
+
styles = ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height', 'text-transform', 'letter-spacing'];
|
1232 |
+
for (_i = 0, _len = styles.length; _i < _len; _i++) {
|
1233 |
+
style = styles[_i];
|
1234 |
+
style_block += style + ":" + this.search_field.css(style) + ";";
|
1235 |
+
}
|
1236 |
+
div = $('<div />', {
|
1237 |
+
'style': style_block
|
1238 |
+
});
|
1239 |
+
div.text(this.search_field.val());
|
1240 |
+
$('body').append(div);
|
1241 |
+
w = div.width() + 25;
|
1242 |
+
div.remove();
|
1243 |
+
f_width = this.container.outerWidth();
|
1244 |
+
if (w > f_width - 10) {
|
1245 |
+
w = f_width - 10;
|
1246 |
+
}
|
1247 |
+
return this.search_field.css({
|
1248 |
+
'width': w + 'px'
|
1249 |
+
});
|
1250 |
+
}
|
1251 |
+
};
|
1252 |
+
|
1253 |
+
return Chosen;
|
1254 |
+
|
1255 |
+
})(AbstractChosen);
|
1256 |
+
|
1257 |
+
}).call(this);
|
assets/lib/chosen_v1.4.2/chosen.jquery.min.js
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
/* Chosen v1.4.2 | (c) 2011-2015 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
|
2 |
+
(function(){var a,AbstractChosen,Chosen,SelectParser,b,c={}.hasOwnProperty,d=function(a,b){function d(){this.constructor=a}for(var e in b)c.call(b,e)&&(a[e]=b[e]);return d.prototype=b.prototype,a.prototype=new d,a.__super__=b.prototype,a};SelectParser=function(){function SelectParser(){this.options_index=0,this.parsed=[]}return SelectParser.prototype.add_node=function(a){return"OPTGROUP"===a.nodeName.toUpperCase()?this.add_group(a):this.add_option(a)},SelectParser.prototype.add_group=function(a){var b,c,d,e,f,g;for(b=this.parsed.length,this.parsed.push({array_index:b,group:!0,label:this.escapeExpression(a.label),title:a.title?a.title:void 0,children:0,disabled:a.disabled,classes:a.className}),f=a.childNodes,g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push(this.add_option(c,b,a.disabled));return g},SelectParser.prototype.add_option=function(a,b,c){return"OPTION"===a.nodeName.toUpperCase()?(""!==a.text?(null!=b&&(this.parsed[b].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:a.value,text:a.text,html:a.innerHTML,title:a.title?a.title:void 0,selected:a.selected,disabled:c===!0?c:a.disabled,group_array_index:b,group_label:null!=b?this.parsed[b].label:null,classes:a.className,style:a.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1):void 0},SelectParser.prototype.escapeExpression=function(a){var b,c;return null==a||a===!1?"":/[\&\<\>\"\'\`]/.test(a)?(b={"<":"<",">":">",'"':""","'":"'","`":"`"},c=/&(?!\w+;)|[\<\>\"\'\`]/g,a.replace(c,function(a){return b[a]||"&"})):a},SelectParser}(),SelectParser.select_to_array=function(a){var b,c,d,e,f;for(c=new SelectParser,f=a.childNodes,d=0,e=f.length;e>d;d++)b=f[d],c.add_node(b);return c.parsed},AbstractChosen=function(){function AbstractChosen(a,b){this.form_field=a,this.options=null!=b?b:{},AbstractChosen.browser_is_supported()&&(this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers(),this.on_ready())}return AbstractChosen.prototype.set_default_values=function(){var a=this;return this.click_test_action=function(b){return a.test_active_click(b)},this.activate_action=function(b){return a.activate_field(b)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.allow_single_deselect=null!=this.options.allow_single_deselect&&null!=this.form_field.options[0]&&""===this.form_field.options[0].text?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=null!=this.options.enable_split_word_search?this.options.enable_split_word_search:!0,this.group_search=null!=this.options.group_search?this.options.group_search:!0,this.search_contains=this.options.search_contains||!1,this.single_backstroke_delete=null!=this.options.single_backstroke_delete?this.options.single_backstroke_delete:!0,this.max_selected_options=this.options.max_selected_options||1/0,this.inherit_select_classes=this.options.inherit_select_classes||!1,this.display_selected_options=null!=this.options.display_selected_options?this.options.display_selected_options:!0,this.display_disabled_options=null!=this.options.display_disabled_options?this.options.display_disabled_options:!0,this.include_group_label_in_selected=this.options.include_group_label_in_selected||!1},AbstractChosen.prototype.set_default_text=function(){return this.default_text=this.form_field.getAttribute("data-placeholder")?this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.options.placeholder_text_multiple||this.options.placeholder_text||AbstractChosen.default_multiple_text:this.options.placeholder_text_single||this.options.placeholder_text||AbstractChosen.default_single_text,this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||AbstractChosen.default_no_result_text},AbstractChosen.prototype.choice_label=function(a){return this.include_group_label_in_selected&&null!=a.group_label?"<b class='group-name'>"+a.group_label+"</b>"+a.html:a.html},AbstractChosen.prototype.mouse_enter=function(){return this.mouse_on_container=!0},AbstractChosen.prototype.mouse_leave=function(){return this.mouse_on_container=!1},AbstractChosen.prototype.input_focus=function(){var a=this;if(this.is_multiple){if(!this.active_field)return setTimeout(function(){return a.container_mousedown()},50)}else if(!this.active_field)return this.activate_field()},AbstractChosen.prototype.input_blur=function(){var a=this;return this.mouse_on_container?void 0:(this.active_field=!1,setTimeout(function(){return a.blur_test()},100))},AbstractChosen.prototype.results_option_build=function(a){var b,c,d,e,f;for(b="",f=this.results_data,d=0,e=f.length;e>d;d++)c=f[d],b+=c.group?this.result_add_group(c):this.result_add_option(c),(null!=a?a.first:void 0)&&(c.selected&&this.is_multiple?this.choice_build(c):c.selected&&!this.is_multiple&&this.single_set_selected_text(this.choice_label(c)));return b},AbstractChosen.prototype.result_add_option=function(a){var b,c;return a.search_match?this.include_option_in_results(a)?(b=[],a.disabled||a.selected&&this.is_multiple||b.push("active-result"),!a.disabled||a.selected&&this.is_multiple||b.push("disabled-result"),a.selected&&b.push("result-selected"),null!=a.group_array_index&&b.push("group-option"),""!==a.classes&&b.push(a.classes),c=document.createElement("li"),c.className=b.join(" "),c.style.cssText=a.style,c.setAttribute("data-option-array-index",a.array_index),c.innerHTML=a.search_text,a.title&&(c.title=a.title),this.outerHTML(c)):"":""},AbstractChosen.prototype.result_add_group=function(a){var b,c;return a.search_match||a.group_match?a.active_options>0?(b=[],b.push("group-result"),a.classes&&b.push(a.classes),c=document.createElement("li"),c.className=b.join(" "),c.innerHTML=a.search_text,a.title&&(c.title=a.title),this.outerHTML(c)):"":""},AbstractChosen.prototype.results_update_field=function(){return this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.results_build(),this.results_showing?this.winnow_results():void 0},AbstractChosen.prototype.reset_single_select_options=function(){var a,b,c,d,e;for(d=this.results_data,e=[],b=0,c=d.length;c>b;b++)a=d[b],a.selected?e.push(a.selected=!1):e.push(void 0);return e},AbstractChosen.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},AbstractChosen.prototype.results_search=function(){return this.results_showing?this.winnow_results():this.results_show()},AbstractChosen.prototype.winnow_results=function(){var a,b,c,d,e,f,g,h,i,j,k,l;for(this.no_results_clear(),d=0,f=this.get_search_text(),a=f.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),i=new RegExp(a,"i"),c=this.get_search_regex(a),l=this.results_data,j=0,k=l.length;k>j;j++)b=l[j],b.search_match=!1,e=null,this.include_option_in_results(b)&&(b.group&&(b.group_match=!1,b.active_options=0),null!=b.group_array_index&&this.results_data[b.group_array_index]&&(e=this.results_data[b.group_array_index],0===e.active_options&&e.search_match&&(d+=1),e.active_options+=1),b.search_text=b.group?b.label:b.html,(!b.group||this.group_search)&&(b.search_match=this.search_string_match(b.search_text,c),b.search_match&&!b.group&&(d+=1),b.search_match?(f.length&&(g=b.search_text.search(i),h=b.search_text.substr(0,g+f.length)+"</em>"+b.search_text.substr(g+f.length),b.search_text=h.substr(0,g)+"<em>"+h.substr(g)),null!=e&&(e.group_match=!0)):null!=b.group_array_index&&this.results_data[b.group_array_index].search_match&&(b.search_match=!0)));return this.result_clear_highlight(),1>d&&f.length?(this.update_results_content(""),this.no_results(f)):(this.update_results_content(this.results_option_build()),this.winnow_results_set_highlight())},AbstractChosen.prototype.get_search_regex=function(a){var b;return b=this.search_contains?"":"^",new RegExp(b+a,"i")},AbstractChosen.prototype.search_string_match=function(a,b){var c,d,e,f;if(b.test(a))return!0;if(this.enable_split_word_search&&(a.indexOf(" ")>=0||0===a.indexOf("["))&&(d=a.replace(/\[|\]/g,"").split(" "),d.length))for(e=0,f=d.length;f>e;e++)if(c=d[e],b.test(c))return!0},AbstractChosen.prototype.choices_count=function(){var a,b,c,d;if(null!=this.selected_option_count)return this.selected_option_count;for(this.selected_option_count=0,d=this.form_field.options,b=0,c=d.length;c>b;b++)a=d[b],a.selected&&(this.selected_option_count+=1);return this.selected_option_count},AbstractChosen.prototype.choices_click=function(a){return a.preventDefault(),this.results_showing||this.is_disabled?void 0:this.results_show()},AbstractChosen.prototype.keyup_checker=function(a){var b,c;switch(b=null!=(c=a.which)?c:a.keyCode,this.search_field_scale(),b){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices_count()>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:if(a.preventDefault(),this.results_showing)return this.result_select(a);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}},AbstractChosen.prototype.clipboard_event_checker=function(){var a=this;return setTimeout(function(){return a.results_search()},50)},AbstractChosen.prototype.container_width=function(){return null!=this.options.width?this.options.width:""+this.form_field.offsetWidth+"px"},AbstractChosen.prototype.include_option_in_results=function(a){return this.is_multiple&&!this.display_selected_options&&a.selected?!1:!this.display_disabled_options&&a.disabled?!1:a.empty?!1:!0},AbstractChosen.prototype.search_results_touchstart=function(a){return this.touch_started=!0,this.search_results_mouseover(a)},AbstractChosen.prototype.search_results_touchmove=function(a){return this.touch_started=!1,this.search_results_mouseout(a)},AbstractChosen.prototype.search_results_touchend=function(a){return this.touch_started?this.search_results_mouseup(a):void 0},AbstractChosen.prototype.outerHTML=function(a){var b;return a.outerHTML?a.outerHTML:(b=document.createElement("div"),b.appendChild(a),b.innerHTML)},AbstractChosen.browser_is_supported=function(){return"Microsoft Internet Explorer"===window.navigator.appName?document.documentMode>=8:/iP(od|hone)/i.test(window.navigator.userAgent)?!1:/Android/i.test(window.navigator.userAgent)&&/Mobile/i.test(window.navigator.userAgent)?!1:!0},AbstractChosen.default_multiple_text="Select Some Options",AbstractChosen.default_single_text="Select an Option",AbstractChosen.default_no_result_text="No results match",AbstractChosen}(),a=jQuery,a.fn.extend({chosen:function(b){return AbstractChosen.browser_is_supported()?this.each(function(){var c,d;c=a(this),d=c.data("chosen"),"destroy"===b&&d instanceof Chosen?d.destroy():d instanceof Chosen||c.data("chosen",new Chosen(this,b))}):this}}),Chosen=function(c){function Chosen(){return b=Chosen.__super__.constructor.apply(this,arguments)}return d(Chosen,c),Chosen.prototype.setup=function(){return this.form_field_jq=a(this.form_field),this.current_selectedIndex=this.form_field.selectedIndex,this.is_rtl=this.form_field_jq.hasClass("chosen-rtl")},Chosen.prototype.set_up_html=function(){var b,c;return b=["chosen-container"],b.push("chosen-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&b.push(this.form_field.className),this.is_rtl&&b.push("chosen-rtl"),c={"class":b.join(" "),style:"width: "+this.container_width()+";",title:this.form_field.title},this.form_field.id.length&&(c.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"),this.container=a("<div />",c),this.is_multiple?this.container.html('<ul class="chosen-choices"><li class="search-field"><input type="text" value="'+this.default_text+'" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>'):this.container.html('<a class="chosen-single chosen-default" tabindex="-1"><span>'+this.default_text+'</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>'),this.form_field_jq.hide().after(this.container),this.dropdown=this.container.find("div.chosen-drop").first(),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chosen-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chosen-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chosen-search").first(),this.selected_item=this.container.find(".chosen-single").first()),this.results_build(),this.set_tab_index(),this.set_label_behavior()},Chosen.prototype.on_ready=function(){return this.form_field_jq.trigger("chosen:ready",{chosen:this})},Chosen.prototype.register_observers=function(){var a=this;return this.container.bind("touchstart.chosen",function(b){return a.container_mousedown(b),b.preventDefault()}),this.container.bind("touchend.chosen",function(b){return a.container_mouseup(b),b.preventDefault()}),this.container.bind("mousedown.chosen",function(b){a.container_mousedown(b)}),this.container.bind("mouseup.chosen",function(b){a.container_mouseup(b)}),this.container.bind("mouseenter.chosen",function(b){a.mouse_enter(b)}),this.container.bind("mouseleave.chosen",function(b){a.mouse_leave(b)}),this.search_results.bind("mouseup.chosen",function(b){a.search_results_mouseup(b)}),this.search_results.bind("mouseover.chosen",function(b){a.search_results_mouseover(b)}),this.search_results.bind("mouseout.chosen",function(b){a.search_results_mouseout(b)}),this.search_results.bind("mousewheel.chosen DOMMouseScroll.chosen",function(b){a.search_results_mousewheel(b)}),this.search_results.bind("touchstart.chosen",function(b){a.search_results_touchstart(b)}),this.search_results.bind("touchmove.chosen",function(b){a.search_results_touchmove(b)}),this.search_results.bind("touchend.chosen",function(b){a.search_results_touchend(b)}),this.form_field_jq.bind("chosen:updated.chosen",function(b){a.results_update_field(b)}),this.form_field_jq.bind("chosen:activate.chosen",function(b){a.activate_field(b)}),this.form_field_jq.bind("chosen:open.chosen",function(b){a.container_mousedown(b)}),this.form_field_jq.bind("chosen:close.chosen",function(b){a.input_blur(b)}),this.search_field.bind("blur.chosen",function(b){a.input_blur(b)}),this.search_field.bind("keyup.chosen",function(b){a.keyup_checker(b)}),this.search_field.bind("keydown.chosen",function(b){a.keydown_checker(b)}),this.search_field.bind("focus.chosen",function(b){a.input_focus(b)}),this.search_field.bind("cut.chosen",function(b){a.clipboard_event_checker(b)}),this.search_field.bind("paste.chosen",function(b){a.clipboard_event_checker(b)}),this.is_multiple?this.search_choices.bind("click.chosen",function(b){a.choices_click(b)}):this.container.bind("click.chosen",function(a){a.preventDefault()})},Chosen.prototype.destroy=function(){return a(this.container[0].ownerDocument).unbind("click.chosen",this.click_test_action),this.search_field[0].tabIndex&&(this.form_field_jq[0].tabIndex=this.search_field[0].tabIndex),this.container.remove(),this.form_field_jq.removeData("chosen"),this.form_field_jq.show()},Chosen.prototype.search_field_disabled=function(){return this.is_disabled=this.form_field_jq[0].disabled,this.is_disabled?(this.container.addClass("chosen-disabled"),this.search_field[0].disabled=!0,this.is_multiple||this.selected_item.unbind("focus.chosen",this.activate_action),this.close_field()):(this.container.removeClass("chosen-disabled"),this.search_field[0].disabled=!1,this.is_multiple?void 0:this.selected_item.bind("focus.chosen",this.activate_action))},Chosen.prototype.container_mousedown=function(b){return this.is_disabled||(b&&"mousedown"===b.type&&!this.results_showing&&b.preventDefault(),null!=b&&a(b.target).hasClass("search-choice-close"))?void 0:(this.active_field?this.is_multiple||!b||a(b.target)[0]!==this.selected_item[0]&&!a(b.target).parents("a.chosen-single").length||(b.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),a(this.container[0].ownerDocument).bind("click.chosen",this.click_test_action),this.results_show()),this.activate_field())},Chosen.prototype.container_mouseup=function(a){return"ABBR"!==a.target.nodeName||this.is_disabled?void 0:this.results_reset(a)},Chosen.prototype.search_results_mousewheel=function(a){var b;return a.originalEvent&&(b=a.originalEvent.deltaY||-a.originalEvent.wheelDelta||a.originalEvent.detail),null!=b?(a.preventDefault(),"DOMMouseScroll"===a.type&&(b=40*b),this.search_results.scrollTop(b+this.search_results.scrollTop())):void 0},Chosen.prototype.blur_test=function(){return!this.active_field&&this.container.hasClass("chosen-container-active")?this.close_field():void 0},Chosen.prototype.close_field=function(){return a(this.container[0].ownerDocument).unbind("click.chosen",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClass("chosen-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},Chosen.prototype.activate_field=function(){return this.container.addClass("chosen-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},Chosen.prototype.test_active_click=function(b){var c;return c=a(b.target).closest(".chosen-container"),c.length&&this.container[0]===c[0]?this.active_field=!0:this.close_field()},Chosen.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=SelectParser.select_to_array(this.form_field),this.is_multiple?this.search_choices.find("li.search-choice").remove():this.is_multiple||(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field[0].readOnly=!0,this.container.addClass("chosen-container-single-nosearch")):(this.search_field[0].readOnly=!1,this.container.removeClass("chosen-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},Chosen.prototype.result_do_highlight=function(a){var b,c,d,e,f;if(a.length){if(this.result_clear_highlight(),this.result_highlight=a,this.result_highlight.addClass("highlighted"),d=parseInt(this.search_results.css("maxHeight"),10),f=this.search_results.scrollTop(),e=d+f,c=this.result_highlight.position().top+this.search_results.scrollTop(),b=c+this.result_highlight.outerHeight(),b>=e)return this.search_results.scrollTop(b-d>0?b-d:0);if(f>c)return this.search_results.scrollTop(c)}},Chosen.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},Chosen.prototype.results_show=function(){return this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.container.addClass("chosen-with-drop"),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.search_field.val()),this.winnow_results(),this.form_field_jq.trigger("chosen:showing_dropdown",{chosen:this}))},Chosen.prototype.update_results_content=function(a){return this.search_results.html(a)},Chosen.prototype.results_hide=function(){return this.results_showing&&(this.result_clear_highlight(),this.container.removeClass("chosen-with-drop"),this.form_field_jq.trigger("chosen:hiding_dropdown",{chosen:this})),this.results_showing=!1},Chosen.prototype.set_tab_index=function(){var a;return this.form_field.tabIndex?(a=this.form_field.tabIndex,this.form_field.tabIndex=-1,this.search_field[0].tabIndex=a):void 0},Chosen.prototype.set_label_behavior=function(){var b=this;return this.form_field_label=this.form_field_jq.parents("label"),!this.form_field_label.length&&this.form_field.id.length&&(this.form_field_label=a("label[for='"+this.form_field.id+"']")),this.form_field_label.length>0?this.form_field_label.bind("click.chosen",function(a){return b.is_multiple?b.container_mousedown(a):b.activate_field()}):void 0},Chosen.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices_count()<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},Chosen.prototype.search_results_mouseup=function(b){var c;return c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first(),c.length?(this.result_highlight=c,this.result_select(b),this.search_field.focus()):void 0},Chosen.prototype.search_results_mouseover=function(b){var c;return c=a(b.target).hasClass("active-result")?a(b.target):a(b.target).parents(".active-result").first(),c?this.result_do_highlight(c):void 0},Chosen.prototype.search_results_mouseout=function(b){return a(b.target).hasClass("active-result")?this.result_clear_highlight():void 0},Chosen.prototype.choice_build=function(b){var c,d,e=this;return c=a("<li />",{"class":"search-choice"}).html("<span>"+this.choice_label(b)+"</span>"),b.disabled?c.addClass("search-choice-disabled"):(d=a("<a />",{"class":"search-choice-close","data-option-array-index":b.array_index}),d.bind("click.chosen",function(a){return e.choice_destroy_link_click(a)}),c.append(d)),this.search_container.before(c)},Chosen.prototype.choice_destroy_link_click=function(b){return b.preventDefault(),b.stopPropagation(),this.is_disabled?void 0:this.choice_destroy(a(b.target))},Chosen.prototype.choice_destroy=function(a){return this.result_deselect(a[0].getAttribute("data-option-array-index"))?(this.show_search_field_default(),this.is_multiple&&this.choices_count()>0&&this.search_field.val().length<1&&this.results_hide(),a.parents("li").first().remove(),this.search_field_scale()):void 0},Chosen.prototype.results_reset=function(){return this.reset_single_select_options(),this.form_field.options[0].selected=!0,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),this.form_field_jq.trigger("change"),this.active_field?this.results_hide():void 0},Chosen.prototype.results_reset_cleanup=function(){return this.current_selectedIndex=this.form_field.selectedIndex,this.selected_item.find("abbr").remove()},Chosen.prototype.result_select=function(a){var b,c;return this.result_highlight?(b=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.is_multiple?b.removeClass("active-result"):this.reset_single_select_options(),b.addClass("result-selected"),c=this.results_data[b[0].getAttribute("data-option-array-index")],c.selected=!0,this.form_field.options[c.options_index].selected=!0,this.selected_option_count=null,this.is_multiple?this.choice_build(c):this.single_set_selected_text(this.choice_label(c)),(a.metaKey||a.ctrlKey)&&this.is_multiple||this.results_hide(),this.search_field.val(""),(this.is_multiple||this.form_field.selectedIndex!==this.current_selectedIndex)&&this.form_field_jq.trigger("change",{selected:this.form_field.options[c.options_index].value}),this.current_selectedIndex=this.form_field.selectedIndex,a.preventDefault(),this.search_field_scale())):void 0},Chosen.prototype.single_set_selected_text=function(a){return null==a&&(a=this.default_text),a===this.default_text?this.selected_item.addClass("chosen-default"):(this.single_deselect_control_build(),this.selected_item.removeClass("chosen-default")),this.selected_item.find("span").html(a)},Chosen.prototype.result_deselect=function(a){var b;return b=this.results_data[a],this.form_field.options[b.options_index].disabled?!1:(b.selected=!1,this.form_field.options[b.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),this.form_field_jq.trigger("change",{deselected:this.form_field.options[b.options_index].value}),this.search_field_scale(),!0)},Chosen.prototype.single_deselect_control_build=function(){return this.allow_single_deselect?(this.selected_item.find("abbr").length||this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>'),this.selected_item.addClass("chosen-single-with-deselect")):void 0},Chosen.prototype.get_search_text=function(){return a("<div/>").text(a.trim(this.search_field.val())).html()},Chosen.prototype.winnow_results_set_highlight=function(){var a,b;return b=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),a=b.length?b.first():this.search_results.find(".active-result").first(),null!=a?this.result_do_highlight(a):void 0},Chosen.prototype.no_results=function(b){var c;return c=a('<li class="no-results">'+this.results_none_found+' "<span></span>"</li>'),c.find("span").first().html(b),this.search_results.append(c),this.form_field_jq.trigger("chosen:no_results",{chosen:this})},Chosen.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},Chosen.prototype.keydown_arrow=function(){var a;return this.results_showing&&this.result_highlight?(a=this.result_highlight.nextAll("li.active-result").first())?this.result_do_highlight(a):void 0:this.results_show()},Chosen.prototype.keyup_arrow=function(){var a;return this.results_showing||this.is_multiple?this.result_highlight?(a=this.result_highlight.prevAll("li.active-result"),a.length?this.result_do_highlight(a.first()):(this.choices_count()>0&&this.results_hide(),this.result_clear_highlight())):void 0:this.results_show()},Chosen.prototype.keydown_backstroke=function(){var a;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(a=this.search_container.siblings("li.search-choice").last(),a.length&&!a.hasClass("search-choice-disabled")?(this.pending_backstroke=a,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")):void 0)},Chosen.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},Chosen.prototype.keydown_checker=function(a){var b,c;switch(b=null!=(c=a.which)?c:a.keyCode,this.search_field_scale(),8!==b&&this.pending_backstroke&&this.clear_backstroke(),b){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(a),this.mouse_on_container=!1;break;case 13:this.results_showing&&a.preventDefault();break;case 32:this.disable_search&&a.preventDefault();break;case 38:a.preventDefault(),this.keyup_arrow();break;case 40:a.preventDefault(),this.keydown_arrow()}},Chosen.prototype.search_field_scale=function(){var b,c,d,e,f,g,h,i,j;if(this.is_multiple){for(d=0,h=0,f="position:absolute; left: -1000px; top: -1000px; display:none;",g=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"],i=0,j=g.length;j>i;i++)e=g[i],f+=e+":"+this.search_field.css(e)+";";return b=a("<div />",{style:f}),b.text(this.search_field.val()),a("body").append(b),h=b.width()+25,b.remove(),c=this.container.outerWidth(),h>c-10&&(h=c-10),this.search_field.css({width:h+"px"})}},Chosen}(AbstractChosen)}).call(this);
|
assets/lib/chosen_v1.4.2/chosen.min.css
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
/* Chosen v1.4.2 | (c) 2011-2015 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
|
2 |
+
|
3 |
+
.chosen-container{position:relative;display:inline-block;vertical-align:middle;font-size:13px;zoom:1;*display:inline;-webkit-user-select:none;-moz-user-select:none;user-select:none}.chosen-container *{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.chosen-container .chosen-drop{position:absolute;top:100%;left:-9999px;z-index:1010;width:100%;border:1px solid #aaa;border-top:0;background:#fff;box-shadow:0 4px 5px rgba(0,0,0,.15)}.chosen-container.chosen-with-drop .chosen-drop{left:0}.chosen-container a{cursor:pointer}.chosen-container .search-choice .group-name,.chosen-container .chosen-single .group-name{margin-right:4px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-weight:400;color:#999}.chosen-container .search-choice .group-name:after,.chosen-container .chosen-single .group-name:after{content:":";padding-left:2px;vertical-align:top}.chosen-container-single .chosen-single{position:relative;display:block;overflow:hidden;padding:0 0 0 8px;height:25px;border:1px solid #aaa;border-radius:5px;background-color:#fff;background:-webkit-gradient(linear,50% 0,50% 100%,color-stop(20%,#fff),color-stop(50%,#f6f6f6),color-stop(52%,#eee),color-stop(100%,#f4f4f4));background:-webkit-linear-gradient(top,#fff 20%,#f6f6f6 50%,#eee 52%,#f4f4f4 100%);background:-moz-linear-gradient(top,#fff 20%,#f6f6f6 50%,#eee 52%,#f4f4f4 100%);background:-o-linear-gradient(top,#fff 20%,#f6f6f6 50%,#eee 52%,#f4f4f4 100%);background:linear-gradient(top,#fff 20%,#f6f6f6 50%,#eee 52%,#f4f4f4 100%);background-clip:padding-box;box-shadow:0 0 3px #fff inset,0 1px 1px rgba(0,0,0,.1);color:#444;text-decoration:none;white-space:nowrap;line-height:24px}.chosen-container-single .chosen-default{color:#999}.chosen-container-single .chosen-single span{display:block;overflow:hidden;margin-right:26px;text-overflow:ellipsis;white-space:nowrap}.chosen-container-single .chosen-single-with-deselect span{margin-right:38px}.chosen-container-single .chosen-single abbr{position:absolute;top:6px;right:26px;display:block;width:12px;height:12px;background:url(chosen-sprite.png) -42px 1px no-repeat;font-size:1px}.chosen-container-single .chosen-single abbr:hover{background-position:-42px -10px}.chosen-container-single.chosen-disabled .chosen-single abbr:hover{background-position:-42px -10px}.chosen-container-single .chosen-single div{position:absolute;top:0;right:0;display:block;width:18px;height:100%}.chosen-container-single .chosen-single div b{display:block;width:100%;height:100%;background:url(chosen-sprite.png) no-repeat 0 2px}.chosen-container-single .chosen-search{position:relative;z-index:1010;margin:0;padding:3px 4px;white-space:nowrap}.chosen-container-single .chosen-search input[type=text]{margin:1px 0;padding:4px 20px 4px 5px;width:100%;height:auto;outline:0;border:1px solid #aaa;background:#fff url(chosen-sprite.png) no-repeat 100% -20px;background:url(chosen-sprite.png) no-repeat 100% -20px;font-size:1em;font-family:sans-serif;line-height:normal;border-radius:0}.chosen-container-single .chosen-drop{margin-top:-1px;border-radius:0 0 4px 4px;background-clip:padding-box}.chosen-container-single.chosen-container-single-nosearch .chosen-search{position:absolute;left:-9999px}.chosen-container .chosen-results{color:#444;position:relative;overflow-x:hidden;overflow-y:auto;margin:0 4px 4px 0;padding:0 0 0 4px;max-height:240px;-webkit-overflow-scrolling:touch}.chosen-container .chosen-results li{display:none;margin:0;padding:5px 6px;list-style:none;line-height:15px;word-wrap:break-word;-webkit-touch-callout:none}.chosen-container .chosen-results li.active-result{display:list-item;cursor:pointer}.chosen-container .chosen-results li.disabled-result{display:list-item;color:#ccc;cursor:default}.chosen-container .chosen-results li.highlighted{background-color:#3875d7;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(20%,#3875d7),color-stop(90%,#2a62bc));background-image:-webkit-linear-gradient(#3875d7 20%,#2a62bc 90%);background-image:-moz-linear-gradient(#3875d7 20%,#2a62bc 90%);background-image:-o-linear-gradient(#3875d7 20%,#2a62bc 90%);background-image:linear-gradient(#3875d7 20%,#2a62bc 90%);color:#fff}.chosen-container .chosen-results li.no-results{color:#777;display:list-item;background:#f4f4f4}.chosen-container .chosen-results li.group-result{display:list-item;font-weight:700;cursor:default}.chosen-container .chosen-results li.group-option{padding-left:15px}.chosen-container .chosen-results li em{font-style:normal;text-decoration:underline}.chosen-container-multi .chosen-choices{position:relative;overflow:hidden;margin:0;padding:0 5px;width:100%;height:auto!important;height:1%;border:1px solid #aaa;background-color:#fff;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(1%,#eee),color-stop(15%,#fff));background-image:-webkit-linear-gradient(#eee 1%,#fff 15%);background-image:-moz-linear-gradient(#eee 1%,#fff 15%);background-image:-o-linear-gradient(#eee 1%,#fff 15%);background-image:linear-gradient(#eee 1%,#fff 15%);cursor:text}.chosen-container-multi .chosen-choices li{float:left;list-style:none}.chosen-container-multi .chosen-choices li.search-field{margin:0;padding:0;white-space:nowrap}.chosen-container-multi .chosen-choices li.search-field input[type=text]{margin:1px 0;padding:0;height:25px;outline:0;border:0!important;background:transparent!important;box-shadow:none;color:#999;font-size:100%;font-family:sans-serif;line-height:normal;border-radius:0}.chosen-container-multi .chosen-choices li.search-choice{position:relative;margin:3px 5px 3px 0;padding:3px 20px 3px 5px;border:1px solid #aaa;max-width:100%;border-radius:3px;background-color:#eee;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(20%,#f4f4f4),color-stop(50%,#f0f0f0),color-stop(52%,#e8e8e8),color-stop(100%,#eee));background-image:-webkit-linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:-moz-linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:-o-linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-size:100% 19px;background-repeat:repeat-x;background-clip:padding-box;box-shadow:0 0 2px #fff inset,0 1px 0 rgba(0,0,0,.05);color:#333;line-height:13px;cursor:default}.chosen-container-multi .chosen-choices li.search-choice span{word-wrap:break-word}.chosen-container-multi .chosen-choices li.search-choice .search-choice-close{position:absolute;top:4px;right:3px;display:block;width:12px;height:12px;background:url(chosen-sprite.png) -42px 1px no-repeat;font-size:1px}.chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover{background-position:-42px -10px}.chosen-container-multi .chosen-choices li.search-choice-disabled{padding-right:5px;border:1px solid #ccc;background-color:#e4e4e4;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(20%,#f4f4f4),color-stop(50%,#f0f0f0),color-stop(52%,#e8e8e8),color-stop(100%,#eee));background-image:-webkit-linear-gradient(top,#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:-moz-linear-gradient(top,#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:-o-linear-gradient(top,#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-image:linear-gradient(top,#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);color:#666}.chosen-container-multi .chosen-choices li.search-choice-focus{background:#d4d4d4}.chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close{background-position:-42px -10px}.chosen-container-multi .chosen-results{margin:0;padding:0}.chosen-container-multi .chosen-drop .result-selected{display:list-item;color:#ccc;cursor:default}.chosen-container-active .chosen-single{border:1px solid #5897fb;box-shadow:0 0 5px rgba(0,0,0,.3)}.chosen-container-active.chosen-with-drop .chosen-single{border:1px solid #aaa;-moz-border-radius-bottomright:0;border-bottom-right-radius:0;-moz-border-radius-bottomleft:0;border-bottom-left-radius:0;background-image:-webkit-gradient(linear,50% 0,50% 100%,color-stop(20%,#eee),color-stop(80%,#fff));background-image:-webkit-linear-gradient(#eee 20%,#fff 80%);background-image:-moz-linear-gradient(#eee 20%,#fff 80%);background-image:-o-linear-gradient(#eee 20%,#fff 80%);background-image:linear-gradient(#eee 20%,#fff 80%);box-shadow:0 1px 0 #fff inset}.chosen-container-active.chosen-with-drop .chosen-single div{border-left:0;background:transparent}.chosen-container-active.chosen-with-drop .chosen-single div b{background-position:-18px 2px}.chosen-container-active .chosen-choices{border:1px solid #5897fb;box-shadow:0 0 5px rgba(0,0,0,.3)}.chosen-container-active .chosen-choices li.search-field input[type=text]{color:#222!important}.chosen-disabled{opacity:.5!important;cursor:default}.chosen-disabled .chosen-single{cursor:default}.chosen-disabled .chosen-choices .search-choice .search-choice-close{cursor:default}.chosen-rtl{text-align:right}.chosen-rtl .chosen-single{overflow:visible;padding:0 8px 0 0}.chosen-rtl .chosen-single span{margin-right:0;margin-left:26px;direction:rtl}.chosen-rtl .chosen-single-with-deselect span{margin-left:38px}.chosen-rtl .chosen-single div{right:auto;left:3px}.chosen-rtl .chosen-single abbr{right:auto;left:26px}.chosen-rtl .chosen-choices li{float:right}.chosen-rtl .chosen-choices li.search-field input[type=text]{direction:rtl}.chosen-rtl .chosen-choices li.search-choice{margin:3px 5px 3px 0;padding:3px 5px 3px 19px}.chosen-rtl .chosen-choices li.search-choice .search-choice-close{right:auto;left:4px}.chosen-rtl.chosen-container-single-nosearch .chosen-search,.chosen-rtl .chosen-drop{left:9999px}.chosen-rtl.chosen-container-single .chosen-results{margin:0 0 4px 4px;padding:0 4px 0 0}.chosen-rtl .chosen-results li.group-option{padding-right:15px;padding-left:0}.chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div{border-right:0}.chosen-rtl .chosen-search input[type=text]{padding:4px 5px 4px 20px;background:#fff url(chosen-sprite.png) no-repeat -30px -20px;background:url(chosen-sprite.png) no-repeat -30px -20px;direction:rtl}.chosen-rtl.chosen-container-single .chosen-single div b{background-position:6px 2px}.chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b{background-position:-12px 2px}@media only screen and (-webkit-min-device-pixel-ratio:1.5),only screen and (min-resolution:144dpi),only screen and (min-resolution:1.5dppx){.chosen-rtl .chosen-search input[type=text],.chosen-container-single .chosen-single abbr,.chosen-container-single .chosen-single div b,.chosen-container-single .chosen-search input[type=text],.chosen-container-multi .chosen-choices .search-choice .search-choice-close,.chosen-container .chosen-results-scroll-down span,.chosen-container .chosen-results-scroll-up span{background-image:url(chosen-sprite@2x.png)!important;background-size:52px 37px!important;background-repeat:no-repeat!important}}
|
assets/lib/chosen_v1.4.2/chosen.proto.js
ADDED
@@ -0,0 +1,1276 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
Chosen, a Select Box Enhancer for jQuery and Prototype
|
3 |
+
by Patrick Filler for Harvest, http://getharvest.com
|
4 |
+
|
5 |
+
Version 1.4.2
|
6 |
+
Full source at https://github.com/harvesthq/chosen
|
7 |
+
Copyright (c) 2011-2015 Harvest http://getharvest.com
|
8 |
+
|
9 |
+
MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
|
10 |
+
This file is generated by `grunt build`, do not edit it by hand.
|
11 |
+
*/
|
12 |
+
|
13 |
+
(function() {
|
14 |
+
var AbstractChosen, SelectParser, _ref,
|
15 |
+
__hasProp = {}.hasOwnProperty,
|
16 |
+
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
17 |
+
|
18 |
+
SelectParser = (function() {
|
19 |
+
function SelectParser() {
|
20 |
+
this.options_index = 0;
|
21 |
+
this.parsed = [];
|
22 |
+
}
|
23 |
+
|
24 |
+
SelectParser.prototype.add_node = function(child) {
|
25 |
+
if (child.nodeName.toUpperCase() === "OPTGROUP") {
|
26 |
+
return this.add_group(child);
|
27 |
+
} else {
|
28 |
+
return this.add_option(child);
|
29 |
+
}
|
30 |
+
};
|
31 |
+
|
32 |
+
SelectParser.prototype.add_group = function(group) {
|
33 |
+
var group_position, option, _i, _len, _ref, _results;
|
34 |
+
group_position = this.parsed.length;
|
35 |
+
this.parsed.push({
|
36 |
+
array_index: group_position,
|
37 |
+
group: true,
|
38 |
+
label: this.escapeExpression(group.label),
|
39 |
+
title: group.title ? group.title : void 0,
|
40 |
+
children: 0,
|
41 |
+
disabled: group.disabled,
|
42 |
+
classes: group.className
|
43 |
+
});
|
44 |
+
_ref = group.childNodes;
|
45 |
+
_results = [];
|
46 |
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
47 |
+
option = _ref[_i];
|
48 |
+
_results.push(this.add_option(option, group_position, group.disabled));
|
49 |
+
}
|
50 |
+
return _results;
|
51 |
+
};
|
52 |
+
|
53 |
+
SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
|
54 |
+
if (option.nodeName.toUpperCase() === "OPTION") {
|
55 |
+
if (option.text !== "") {
|
56 |
+
if (group_position != null) {
|
57 |
+
this.parsed[group_position].children += 1;
|
58 |
+
}
|
59 |
+
this.parsed.push({
|
60 |
+
array_index: this.parsed.length,
|
61 |
+
options_index: this.options_index,
|
62 |
+
value: option.value,
|
63 |
+
text: option.text,
|
64 |
+
html: option.innerHTML,
|
65 |
+
title: option.title ? option.title : void 0,
|
66 |
+
selected: option.selected,
|
67 |
+
disabled: group_disabled === true ? group_disabled : option.disabled,
|
68 |
+
group_array_index: group_position,
|
69 |
+
group_label: group_position != null ? this.parsed[group_position].label : null,
|
70 |
+
classes: option.className,
|
71 |
+
style: option.style.cssText
|
72 |
+
});
|
73 |
+
} else {
|
74 |
+
this.parsed.push({
|
75 |
+
array_index: this.parsed.length,
|
76 |
+
options_index: this.options_index,
|
77 |
+
empty: true
|
78 |
+
});
|
79 |
+
}
|
80 |
+
return this.options_index += 1;
|
81 |
+
}
|
82 |
+
};
|
83 |
+
|
84 |
+
SelectParser.prototype.escapeExpression = function(text) {
|
85 |
+
var map, unsafe_chars;
|
86 |
+
if ((text == null) || text === false) {
|
87 |
+
return "";
|
88 |
+
}
|
89 |
+
if (!/[\&\<\>\"\'\`]/.test(text)) {
|
90 |
+
return text;
|
91 |
+
}
|
92 |
+
map = {
|
93 |
+
"<": "<",
|
94 |
+
">": ">",
|
95 |
+
'"': """,
|
96 |
+
"'": "'",
|
97 |
+
"`": "`"
|
98 |
+
};
|
99 |
+
unsafe_chars = /&(?!\w+;)|[\<\>\"\'\`]/g;
|
100 |
+
return text.replace(unsafe_chars, function(chr) {
|
101 |
+
return map[chr] || "&";
|
102 |
+
});
|
103 |
+
};
|
104 |
+
|
105 |
+
return SelectParser;
|
106 |
+
|
107 |
+
})();
|
108 |
+
|
109 |
+
SelectParser.select_to_array = function(select) {
|
110 |
+
var child, parser, _i, _len, _ref;
|
111 |
+
parser = new SelectParser();
|
112 |
+
_ref = select.childNodes;
|
113 |
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
114 |
+
child = _ref[_i];
|
115 |
+
parser.add_node(child);
|
116 |
+
}
|
117 |
+
return parser.parsed;
|
118 |
+
};
|
119 |
+
|
120 |
+
AbstractChosen = (function() {
|
121 |
+
function AbstractChosen(form_field, options) {
|
122 |
+
this.form_field = form_field;
|
123 |
+
this.options = options != null ? options : {};
|
124 |
+
if (!AbstractChosen.browser_is_supported()) {
|
125 |
+
return;
|
126 |
+
}
|
127 |
+
this.is_multiple = this.form_field.multiple;
|
128 |
+
this.set_default_text();
|
129 |
+
this.set_default_values();
|
130 |
+
this.setup();
|
131 |
+
this.set_up_html();
|
132 |
+
this.register_observers();
|
133 |
+
this.on_ready();
|
134 |
+
}
|
135 |
+
|
136 |
+
AbstractChosen.prototype.set_default_values = function() {
|
137 |
+
var _this = this;
|
138 |
+
this.click_test_action = function(evt) {
|
139 |
+
return _this.test_active_click(evt);
|
140 |
+
};
|
141 |
+
this.activate_action = function(evt) {
|
142 |
+
return _this.activate_field(evt);
|
143 |
+
};
|
144 |
+
this.active_field = false;
|
145 |
+
this.mouse_on_container = false;
|
146 |
+
this.results_showing = false;
|
147 |
+
this.result_highlighted = null;
|
148 |
+
this.allow_single_deselect = (this.options.allow_single_deselect != null) && (this.form_field.options[0] != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
|
149 |
+
this.disable_search_threshold = this.options.disable_search_threshold || 0;
|
150 |
+
this.disable_search = this.options.disable_search || false;
|
151 |
+
this.enable_split_word_search = this.options.enable_split_word_search != null ? this.options.enable_split_word_search : true;
|
152 |
+
this.group_search = this.options.group_search != null ? this.options.group_search : true;
|
153 |
+
this.search_contains = this.options.search_contains || false;
|
154 |
+
this.single_backstroke_delete = this.options.single_backstroke_delete != null ? this.options.single_backstroke_delete : true;
|
155 |
+
this.max_selected_options = this.options.max_selected_options || Infinity;
|
156 |
+
this.inherit_select_classes = this.options.inherit_select_classes || false;
|
157 |
+
this.display_selected_options = this.options.display_selected_options != null ? this.options.display_selected_options : true;
|
158 |
+
this.display_disabled_options = this.options.display_disabled_options != null ? this.options.display_disabled_options : true;
|
159 |
+
return this.include_group_label_in_selected = this.options.include_group_label_in_selected || false;
|
160 |
+
};
|
161 |
+
|
162 |
+
AbstractChosen.prototype.set_default_text = function() {
|
163 |
+
if (this.form_field.getAttribute("data-placeholder")) {
|
164 |
+
this.default_text = this.form_field.getAttribute("data-placeholder");
|
165 |
+
} else if (this.is_multiple) {
|
166 |
+
this.default_text = this.options.placeholder_text_multiple || this.options.placeholder_text || AbstractChosen.default_multiple_text;
|
167 |
+
} else {
|
168 |
+
this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || AbstractChosen.default_single_text;
|
169 |
+
}
|
170 |
+
return this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || AbstractChosen.default_no_result_text;
|
171 |
+
};
|
172 |
+
|
173 |
+
AbstractChosen.prototype.choice_label = function(item) {
|
174 |
+
if (this.include_group_label_in_selected && (item.group_label != null)) {
|
175 |
+
return "<b class='group-name'>" + item.group_label + "</b>" + item.html;
|
176 |
+
} else {
|
177 |
+
return item.html;
|
178 |
+
}
|
179 |
+
};
|
180 |
+
|
181 |
+
AbstractChosen.prototype.mouse_enter = function() {
|
182 |
+
return this.mouse_on_container = true;
|
183 |
+
};
|
184 |
+
|
185 |
+
AbstractChosen.prototype.mouse_leave = function() {
|
186 |
+
return this.mouse_on_container = false;
|
187 |
+
};
|
188 |
+
|
189 |
+
AbstractChosen.prototype.input_focus = function(evt) {
|
190 |
+
var _this = this;
|
191 |
+
if (this.is_multiple) {
|
192 |
+
if (!this.active_field) {
|
193 |
+
return setTimeout((function() {
|
194 |
+
return _this.container_mousedown();
|
195 |
+
}), 50);
|
196 |
+
}
|
197 |
+
} else {
|
198 |
+
if (!this.active_field) {
|
199 |
+
return this.activate_field();
|
200 |
+
}
|
201 |
+
}
|
202 |
+
};
|
203 |
+
|
204 |
+
AbstractChosen.prototype.input_blur = function(evt) {
|
205 |
+
var _this = this;
|
206 |
+
if (!this.mouse_on_container) {
|
207 |
+
this.active_field = false;
|
208 |
+
return setTimeout((function() {
|
209 |
+
return _this.blur_test();
|
210 |
+
}), 100);
|
211 |
+
}
|
212 |
+
};
|
213 |
+
|
214 |
+
AbstractChosen.prototype.results_option_build = function(options) {
|
215 |
+
var content, data, _i, _len, _ref;
|
216 |
+
content = '';
|
217 |
+
_ref = this.results_data;
|
218 |
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
219 |
+
data = _ref[_i];
|
220 |
+
if (data.group) {
|
221 |
+
content += this.result_add_group(data);
|
222 |
+
} else {
|
223 |
+
content += this.result_add_option(data);
|
224 |
+
}
|
225 |
+
if (options != null ? options.first : void 0) {
|
226 |
+
if (data.selected && this.is_multiple) {
|
227 |
+
this.choice_build(data);
|
228 |
+
} else if (data.selected && !this.is_multiple) {
|
229 |
+
this.single_set_selected_text(this.choice_label(data));
|
230 |
+
}
|
231 |
+
}
|
232 |
+
}
|
233 |
+
return content;
|
234 |
+
};
|
235 |
+
|
236 |
+
AbstractChosen.prototype.result_add_option = function(option) {
|
237 |
+
var classes, option_el;
|
238 |
+
if (!option.search_match) {
|
239 |
+
return '';
|
240 |
+
}
|
241 |
+
if (!this.include_option_in_results(option)) {
|
242 |
+
return '';
|
243 |
+
}
|
244 |
+
classes = [];
|
245 |
+
if (!option.disabled && !(option.selected && this.is_multiple)) {
|
246 |
+
classes.push("active-result");
|
247 |
+
}
|
248 |
+
if (option.disabled && !(option.selected && this.is_multiple)) {
|
249 |
+
classes.push("disabled-result");
|
250 |
+
}
|
251 |
+
if (option.selected) {
|
252 |
+
classes.push("result-selected");
|
253 |
+
}
|
254 |
+
if (option.group_array_index != null) {
|
255 |
+
classes.push("group-option");
|
256 |
+
}
|
257 |
+
if (option.classes !== "") {
|
258 |
+
classes.push(option.classes);
|
259 |
+
}
|
260 |
+
option_el = document.createElement("li");
|
261 |
+
option_el.className = classes.join(" ");
|
262 |
+
option_el.style.cssText = option.style;
|
263 |
+
option_el.setAttribute("data-option-array-index", option.array_index);
|
264 |
+
option_el.innerHTML = option.search_text;
|
265 |
+
if (option.title) {
|
266 |
+
option_el.title = option.title;
|
267 |
+
}
|
268 |
+
return this.outerHTML(option_el);
|
269 |
+
};
|
270 |
+
|
271 |
+
AbstractChosen.prototype.result_add_group = function(group) {
|
272 |
+
var classes, group_el;
|
273 |
+
if (!(group.search_match || group.group_match)) {
|
274 |
+
return '';
|
275 |
+
}
|
276 |
+
if (!(group.active_options > 0)) {
|
277 |
+
return '';
|
278 |
+
}
|
279 |
+
classes = [];
|
280 |
+
classes.push("group-result");
|
281 |
+
if (group.classes) {
|
282 |
+
classes.push(group.classes);
|
283 |
+
}
|
284 |
+
group_el = document.createElement("li");
|
285 |
+
group_el.className = classes.join(" ");
|
286 |
+
group_el.innerHTML = group.search_text;
|
287 |
+
if (group.title) {
|
288 |
+
group_el.title = group.title;
|
289 |
+
}
|
290 |
+
return this.outerHTML(group_el);
|
291 |
+
};
|
292 |
+
|
293 |
+
AbstractChosen.prototype.results_update_field = function() {
|
294 |
+
this.set_default_text();
|
295 |
+
if (!this.is_multiple) {
|
296 |
+
this.results_reset_cleanup();
|
297 |
+
}
|
298 |
+
this.result_clear_highlight();
|
299 |
+
this.results_build();
|
300 |
+
if (this.results_showing) {
|
301 |
+
return this.winnow_results();
|
302 |
+
}
|
303 |
+
};
|
304 |
+
|
305 |
+
AbstractChosen.prototype.reset_single_select_options = function() {
|
306 |
+
var result, _i, _len, _ref, _results;
|
307 |
+
_ref = this.results_data;
|
308 |
+
_results = [];
|
309 |
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
310 |
+
result = _ref[_i];
|
311 |
+
if (result.selected) {
|
312 |
+
_results.push(result.selected = false);
|
313 |
+
} else {
|
314 |
+
_results.push(void 0);
|
315 |
+
}
|
316 |
+
}
|
317 |
+
return _results;
|
318 |
+
};
|
319 |
+
|
320 |
+
AbstractChosen.prototype.results_toggle = function() {
|
321 |
+
if (this.results_showing) {
|
322 |
+
return this.results_hide();
|
323 |
+
} else {
|
324 |
+
return this.results_show();
|
325 |
+
}
|
326 |
+
};
|
327 |
+
|
328 |
+
AbstractChosen.prototype.results_search = function(evt) {
|
329 |
+
if (this.results_showing) {
|
330 |
+
return this.winnow_results();
|
331 |
+
} else {
|
332 |
+
return this.results_show();
|
333 |
+
}
|
334 |
+
};
|
335 |
+
|
336 |
+
AbstractChosen.prototype.winnow_results = function() {
|
337 |
+
var escapedSearchText, option, regex, results, results_group, searchText, startpos, text, zregex, _i, _len, _ref;
|
338 |
+
this.no_results_clear();
|
339 |
+
results = 0;
|
340 |
+
searchText = this.get_search_text();
|
341 |
+
escapedSearchText = searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
342 |
+
zregex = new RegExp(escapedSearchText, 'i');
|
343 |
+
regex = this.get_search_regex(escapedSearchText);
|
344 |
+
_ref = this.results_data;
|
345 |
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
346 |
+
option = _ref[_i];
|
347 |
+
option.search_match = false;
|
348 |
+
results_group = null;
|
349 |
+
if (this.include_option_in_results(option)) {
|
350 |
+
if (option.group) {
|
351 |
+
option.group_match = false;
|
352 |
+
option.active_options = 0;
|
353 |
+
}
|
354 |
+
if ((option.group_array_index != null) && this.results_data[option.group_array_index]) {
|
355 |
+
results_group = this.results_data[option.group_array_index];
|
356 |
+
if (results_group.active_options === 0 && results_group.search_match) {
|
357 |
+
results += 1;
|
358 |
+
}
|
359 |
+
results_group.active_options += 1;
|
360 |
+
}
|
361 |
+
option.search_text = option.group ? option.label : option.html;
|
362 |
+
if (!(option.group && !this.group_search)) {
|
363 |
+
option.search_match = this.search_string_match(option.search_text, regex);
|
364 |
+
if (option.search_match && !option.group) {
|
365 |
+
results += 1;
|
366 |
+
}
|
367 |
+
if (option.search_match) {
|
368 |
+
if (searchText.length) {
|
369 |
+
startpos = option.search_text.search(zregex);
|
370 |
+
text = option.search_text.substr(0, startpos + searchText.length) + '</em>' + option.search_text.substr(startpos + searchText.length);
|
371 |
+
option.search_text = text.substr(0, startpos) + '<em>' + text.substr(startpos);
|
372 |
+
}
|
373 |
+
if (results_group != null) {
|
374 |
+
results_group.group_match = true;
|
375 |
+
}
|
376 |
+
} else if ((option.group_array_index != null) && this.results_data[option.group_array_index].search_match) {
|
377 |
+
option.search_match = true;
|
378 |
+
}
|
379 |
+
}
|
380 |
+
}
|
381 |
+
}
|
382 |
+
this.result_clear_highlight();
|
383 |
+
if (results < 1 && searchText.length) {
|
384 |
+
this.update_results_content("");
|
385 |
+
return this.no_results(searchText);
|
386 |
+
} else {
|
387 |
+
this.update_results_content(this.results_option_build());
|
388 |
+
return this.winnow_results_set_highlight();
|
389 |
+
}
|
390 |
+
};
|
391 |
+
|
392 |
+
AbstractChosen.prototype.get_search_regex = function(escaped_search_string) {
|
393 |
+
var regex_anchor;
|
394 |
+
regex_anchor = this.search_contains ? "" : "^";
|
395 |
+
return new RegExp(regex_anchor + escaped_search_string, 'i');
|
396 |
+
};
|
397 |
+
|
398 |
+
AbstractChosen.prototype.search_string_match = function(search_string, regex) {
|
399 |
+
var part, parts, _i, _len;
|
400 |
+
if (regex.test(search_string)) {
|
401 |
+
return true;
|
402 |
+
} else if (this.enable_split_word_search && (search_string.indexOf(" ") >= 0 || search_string.indexOf("[") === 0)) {
|
403 |
+
parts = search_string.replace(/\[|\]/g, "").split(" ");
|
404 |
+
if (parts.length) {
|
405 |
+
for (_i = 0, _len = parts.length; _i < _len; _i++) {
|
406 |
+
part = parts[_i];
|
407 |
+
if (regex.test(part)) {
|
408 |
+
return true;
|
409 |
+
}
|
410 |
+
}
|
411 |
+
}
|
412 |
+
}
|
413 |
+
};
|
414 |
+
|
415 |
+
AbstractChosen.prototype.choices_count = function() {
|
416 |
+
var option, _i, _len, _ref;
|
417 |
+
if (this.selected_option_count != null) {
|
418 |
+
return this.selected_option_count;
|
419 |
+
}
|
420 |
+
this.selected_option_count = 0;
|
421 |
+
_ref = this.form_field.options;
|
422 |
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
423 |
+
option = _ref[_i];
|
424 |
+
if (option.selected) {
|
425 |
+
this.selected_option_count += 1;
|
426 |
+
}
|
427 |
+
}
|
428 |
+
return this.selected_option_count;
|
429 |
+
};
|
430 |
+
|
431 |
+
AbstractChosen.prototype.choices_click = function(evt) {
|
432 |
+
evt.preventDefault();
|
433 |
+
if (!(this.results_showing || this.is_disabled)) {
|
434 |
+
return this.results_show();
|
435 |
+
}
|
436 |
+
};
|
437 |
+
|
438 |
+
AbstractChosen.prototype.keyup_checker = function(evt) {
|
439 |
+
var stroke, _ref;
|
440 |
+
stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
|
441 |
+
this.search_field_scale();
|
442 |
+
switch (stroke) {
|
443 |
+
case 8:
|
444 |
+
if (this.is_multiple && this.backstroke_length < 1 && this.choices_count() > 0) {
|
445 |
+
return this.keydown_backstroke();
|
446 |
+
} else if (!this.pending_backstroke) {
|
447 |
+
this.result_clear_highlight();
|
448 |
+
return this.results_search();
|
449 |
+
}
|
450 |
+
break;
|
451 |
+
case 13:
|
452 |
+
evt.preventDefault();
|
453 |
+
if (this.results_showing) {
|
454 |
+
return this.result_select(evt);
|
455 |
+
}
|
456 |
+
break;
|
457 |
+
case 27:
|
458 |
+
if (this.results_showing) {
|
459 |
+
this.results_hide();
|
460 |
+
}
|
461 |
+
return true;
|
462 |
+
case 9:
|
463 |
+
case 38:
|
464 |
+
case 40:
|
465 |
+
case 16:
|
466 |
+
case 91:
|
467 |
+
case 17:
|
468 |
+
break;
|
469 |
+
default:
|
470 |
+
return this.results_search();
|
471 |
+
}
|
472 |
+
};
|
473 |
+
|
474 |
+
AbstractChosen.prototype.clipboard_event_checker = function(evt) {
|
475 |
+
var _this = this;
|
476 |
+
return setTimeout((function() {
|
477 |
+
return _this.results_search();
|
478 |
+
}), 50);
|
479 |
+
};
|
480 |
+
|
481 |
+
AbstractChosen.prototype.container_width = function() {
|
482 |
+
if (this.options.width != null) {
|
483 |
+
return this.options.width;
|
484 |
+
} else {
|
485 |
+
return "" + this.form_field.offsetWidth + "px";
|
486 |
+
}
|
487 |
+
};
|
488 |
+
|
489 |
+
AbstractChosen.prototype.include_option_in_results = function(option) {
|
490 |
+
if (this.is_multiple && (!this.display_selected_options && option.selected)) {
|
491 |
+
return false;
|
492 |
+
}
|
493 |
+
if (!this.display_disabled_options && option.disabled) {
|
494 |
+
return false;
|
495 |
+
}
|
496 |
+
if (option.empty) {
|
497 |
+
return false;
|
498 |
+
}
|
499 |
+
return true;
|
500 |
+
};
|
501 |
+
|
502 |
+
AbstractChosen.prototype.search_results_touchstart = function(evt) {
|
503 |
+
this.touch_started = true;
|
504 |
+
return this.search_results_mouseover(evt);
|
505 |
+
};
|
506 |
+
|
507 |
+
AbstractChosen.prototype.search_results_touchmove = function(evt) {
|
508 |
+
this.touch_started = false;
|
509 |
+
return this.search_results_mouseout(evt);
|
510 |
+
};
|
511 |
+
|
512 |
+
AbstractChosen.prototype.search_results_touchend = function(evt) {
|
513 |
+
if (this.touch_started) {
|
514 |
+
return this.search_results_mouseup(evt);
|
515 |
+
}
|
516 |
+
};
|
517 |
+
|
518 |
+
AbstractChosen.prototype.outerHTML = function(element) {
|
519 |
+
var tmp;
|
520 |
+
if (element.outerHTML) {
|
521 |
+
return element.outerHTML;
|
522 |
+
}
|
523 |
+
tmp = document.createElement("div");
|
524 |
+
tmp.appendChild(element);
|
525 |
+
return tmp.innerHTML;
|
526 |
+
};
|
527 |
+
|
528 |
+
AbstractChosen.browser_is_supported = function() {
|
529 |
+
if (window.navigator.appName === "Microsoft Internet Explorer") {
|
530 |
+
return document.documentMode >= 8;
|
531 |
+
}
|
532 |
+
if (/iP(od|hone)/i.test(window.navigator.userAgent)) {
|
533 |
+
return false;
|
534 |
+
}
|
535 |
+
if (/Android/i.test(window.navigator.userAgent)) {
|
536 |
+
if (/Mobile/i.test(window.navigator.userAgent)) {
|
537 |
+
return false;
|
538 |
+
}
|
539 |
+
}
|
540 |
+
return true;
|
541 |
+
};
|
542 |
+
|
543 |
+
AbstractChosen.default_multiple_text = "Select Some Options";
|
544 |
+
|
545 |
+
AbstractChosen.default_single_text = "Select an Option";
|
546 |
+
|
547 |
+
AbstractChosen.default_no_result_text = "No results match";
|
548 |
+
|
549 |
+
return AbstractChosen;
|
550 |
+
|
551 |
+
})();
|
552 |
+
|
553 |
+
this.Chosen = (function(_super) {
|
554 |
+
__extends(Chosen, _super);
|
555 |
+
|
556 |
+
function Chosen() {
|
557 |
+
_ref = Chosen.__super__.constructor.apply(this, arguments);
|
558 |
+
return _ref;
|
559 |
+
}
|
560 |
+
|
561 |
+
Chosen.prototype.setup = function() {
|
562 |
+
this.current_selectedIndex = this.form_field.selectedIndex;
|
563 |
+
return this.is_rtl = this.form_field.hasClassName("chosen-rtl");
|
564 |
+
};
|
565 |
+
|
566 |
+
Chosen.prototype.set_default_values = function() {
|
567 |
+
Chosen.__super__.set_default_values.call(this);
|
568 |
+
this.single_temp = new Template('<a class="chosen-single chosen-default" tabindex="-1"><span>#{default}</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>');
|
569 |
+
this.multi_temp = new Template('<ul class="chosen-choices"><li class="search-field"><input type="text" value="#{default}" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>');
|
570 |
+
return this.no_results_temp = new Template('<li class="no-results">' + this.results_none_found + ' "<span>#{terms}</span>"</li>');
|
571 |
+
};
|
572 |
+
|
573 |
+
Chosen.prototype.set_up_html = function() {
|
574 |
+
var container_classes, container_props;
|
575 |
+
container_classes = ["chosen-container"];
|
576 |
+
container_classes.push("chosen-container-" + (this.is_multiple ? "multi" : "single"));
|
577 |
+
if (this.inherit_select_classes && this.form_field.className) {
|
578 |
+
container_classes.push(this.form_field.className);
|
579 |
+
}
|
580 |
+
if (this.is_rtl) {
|
581 |
+
container_classes.push("chosen-rtl");
|
582 |
+
}
|
583 |
+
container_props = {
|
584 |
+
'class': container_classes.join(' '),
|
585 |
+
'style': "width: " + (this.container_width()) + ";",
|
586 |
+
'title': this.form_field.title
|
587 |
+
};
|
588 |
+
if (this.form_field.id.length) {
|
589 |
+
container_props.id = this.form_field.id.replace(/[^\w]/g, '_') + "_chosen";
|
590 |
+
}
|
591 |
+
this.container = this.is_multiple ? new Element('div', container_props).update(this.multi_temp.evaluate({
|
592 |
+
"default": this.default_text
|
593 |
+
})) : new Element('div', container_props).update(this.single_temp.evaluate({
|
594 |
+
"default": this.default_text
|
595 |
+
}));
|
596 |
+
this.form_field.hide().insert({
|
597 |
+
after: this.container
|
598 |
+
});
|
599 |
+
this.dropdown = this.container.down('div.chosen-drop');
|
600 |
+
this.search_field = this.container.down('input');
|
601 |
+
this.search_results = this.container.down('ul.chosen-results');
|
602 |
+
this.search_field_scale();
|
603 |
+
this.search_no_results = this.container.down('li.no-results');
|
604 |
+
if (this.is_multiple) {
|
605 |
+
this.search_choices = this.container.down('ul.chosen-choices');
|
606 |
+
this.search_container = this.container.down('li.search-field');
|
607 |
+
} else {
|
608 |
+
this.search_container = this.container.down('div.chosen-search');
|
609 |
+
this.selected_item = this.container.down('.chosen-single');
|
610 |
+
}
|
611 |
+
this.results_build();
|
612 |
+
this.set_tab_index();
|
613 |
+
return this.set_label_behavior();
|
614 |
+
};
|
615 |
+
|
616 |
+
Chosen.prototype.on_ready = function() {
|
617 |
+
return this.form_field.fire("chosen:ready", {
|
618 |
+
chosen: this
|
619 |
+
});
|
620 |
+
};
|
621 |
+
|
622 |
+
Chosen.prototype.register_observers = function() {
|
623 |
+
var _this = this;
|
624 |
+
this.container.observe("touchstart", function(evt) {
|
625 |
+
_this.container_mousedown(evt);
|
626 |
+
return evt.preventDefault();
|
627 |
+
});
|
628 |
+
this.container.observe("touchend", function(evt) {
|
629 |
+
_this.container_mouseup(evt);
|
630 |
+
return evt.preventDefault();
|
631 |
+
});
|
632 |
+
this.container.observe("mousedown", function(evt) {
|
633 |
+
return _this.container_mousedown(evt);
|
634 |
+
});
|
635 |
+
this.container.observe("mouseup", function(evt) {
|
636 |
+
return _this.container_mouseup(evt);
|
637 |
+
});
|
638 |
+
this.container.observe("mouseenter", function(evt) {
|
639 |
+
return _this.mouse_enter(evt);
|
640 |
+
});
|
641 |
+
this.container.observe("mouseleave", function(evt) {
|
642 |
+
return _this.mouse_leave(evt);
|
643 |
+
});
|
644 |
+
this.search_results.observe("mouseup", function(evt) {
|
645 |
+
return _this.search_results_mouseup(evt);
|
646 |
+
});
|
647 |
+
this.search_results.observe("mouseover", function(evt) {
|
648 |
+
return _this.search_results_mouseover(evt);
|
649 |
+
});
|
650 |
+
this.search_results.observe("mouseout", function(evt) {
|
651 |
+
return _this.search_results_mouseout(evt);
|
652 |
+
});
|
653 |
+
this.search_results.observe("mousewheel", function(evt) {
|
654 |
+
return _this.search_results_mousewheel(evt);
|
655 |
+
});
|
656 |
+
this.search_results.observe("DOMMouseScroll", function(evt) {
|
657 |
+
return _this.search_results_mousewheel(evt);
|
658 |
+
});
|
659 |
+
this.search_results.observe("touchstart", function(evt) {
|
660 |
+
return _this.search_results_touchstart(evt);
|
661 |
+
});
|
662 |
+
this.search_results.observe("touchmove", function(evt) {
|
663 |
+
return _this.search_results_touchmove(evt);
|
664 |
+
});
|
665 |
+
this.search_results.observe("touchend", function(evt) {
|
666 |
+
return _this.search_results_touchend(evt);
|
667 |
+
});
|
668 |
+
this.form_field.observe("chosen:updated", function(evt) {
|
669 |
+
return _this.results_update_field(evt);
|
670 |
+
});
|
671 |
+
this.form_field.observe("chosen:activate", function(evt) {
|
672 |
+
return _this.activate_field(evt);
|
673 |
+
});
|
674 |
+
this.form_field.observe("chosen:open", function(evt) {
|
675 |
+
return _this.container_mousedown(evt);
|
676 |
+
});
|
677 |
+
this.form_field.observe("chosen:close", function(evt) {
|
678 |
+
return _this.input_blur(evt);
|
679 |
+
});
|
680 |
+
this.search_field.observe("blur", function(evt) {
|
681 |
+
return _this.input_blur(evt);
|
682 |
+
});
|
683 |
+
this.search_field.observe("keyup", function(evt) {
|
684 |
+
return _this.keyup_checker(evt);
|
685 |
+
});
|
686 |
+
this.search_field.observe("keydown", function(evt) {
|
687 |
+
return _this.keydown_checker(evt);
|
688 |
+
});
|
689 |
+
this.search_field.observe("focus", function(evt) {
|
690 |
+
return _this.input_focus(evt);
|
691 |
+
});
|
692 |
+
this.search_field.observe("cut", function(evt) {
|
693 |
+
return _this.clipboard_event_checker(evt);
|
694 |
+
});
|
695 |
+
this.search_field.observe("paste", function(evt) {
|
696 |
+
return _this.clipboard_event_checker(evt);
|
697 |
+
});
|
698 |
+
if (this.is_multiple) {
|
699 |
+
return this.search_choices.observe("click", function(evt) {
|
700 |
+
return _this.choices_click(evt);
|
701 |
+
});
|
702 |
+
} else {
|
703 |
+
return this.container.observe("click", function(evt) {
|
704 |
+
return evt.preventDefault();
|
705 |
+
});
|
706 |
+
}
|
707 |
+
};
|
708 |
+
|
709 |
+
Chosen.prototype.destroy = function() {
|
710 |
+
this.container.ownerDocument.stopObserving("click", this.click_test_action);
|
711 |
+
this.form_field.stopObserving();
|
712 |
+
this.container.stopObserving();
|
713 |
+
this.search_results.stopObserving();
|
714 |
+
this.search_field.stopObserving();
|
715 |
+
if (this.form_field_label != null) {
|
716 |
+
this.form_field_label.stopObserving();
|
717 |
+
}
|
718 |
+
if (this.is_multiple) {
|
719 |
+
this.search_choices.stopObserving();
|
720 |
+
this.container.select(".search-choice-close").each(function(choice) {
|
721 |
+
return choice.stopObserving();
|
722 |
+
});
|
723 |
+
} else {
|
724 |
+
this.selected_item.stopObserving();
|
725 |
+
}
|
726 |
+
if (this.search_field.tabIndex) {
|
727 |
+
this.form_field.tabIndex = this.search_field.tabIndex;
|
728 |
+
}
|
729 |
+
this.container.remove();
|
730 |
+
return this.form_field.show();
|
731 |
+
};
|
732 |
+
|
733 |
+
Chosen.prototype.search_field_disabled = function() {
|
734 |
+
this.is_disabled = this.form_field.disabled;
|
735 |
+
if (this.is_disabled) {
|
736 |
+
this.container.addClassName('chosen-disabled');
|
737 |
+
this.search_field.disabled = true;
|
738 |
+
if (!this.is_multiple) {
|
739 |
+
this.selected_item.stopObserving("focus", this.activate_action);
|
740 |
+
}
|
741 |
+
return this.close_field();
|
742 |
+
} else {
|
743 |
+
this.container.removeClassName('chosen-disabled');
|
744 |
+
this.search_field.disabled = false;
|
745 |
+
if (!this.is_multiple) {
|
746 |
+
return this.selected_item.observe("focus", this.activate_action);
|
747 |
+
}
|
748 |
+
}
|
749 |
+
};
|
750 |
+
|
751 |
+
Chosen.prototype.container_mousedown = function(evt) {
|
752 |
+
if (!this.is_disabled) {
|
753 |
+
if (evt && evt.type === "mousedown" && !this.results_showing) {
|
754 |
+
evt.stop();
|
755 |
+
}
|
756 |
+
if (!((evt != null) && evt.target.hasClassName("search-choice-close"))) {
|
757 |
+
if (!this.active_field) {
|
758 |
+
if (this.is_multiple) {
|
759 |
+
this.search_field.clear();
|
760 |
+
}
|
761 |
+
this.container.ownerDocument.observe("click", this.click_test_action);
|
762 |
+
this.results_show();
|
763 |
+
} else if (!this.is_multiple && evt && (evt.target === this.selected_item || evt.target.up("a.chosen-single"))) {
|
764 |
+
this.results_toggle();
|
765 |
+
}
|
766 |
+
return this.activate_field();
|
767 |
+
}
|
768 |
+
}
|
769 |
+
};
|
770 |
+
|
771 |
+
Chosen.prototype.container_mouseup = function(evt) {
|
772 |
+
if (evt.target.nodeName === "ABBR" && !this.is_disabled) {
|
773 |
+
return this.results_reset(evt);
|
774 |
+
}
|
775 |
+
};
|
776 |
+
|
777 |
+
Chosen.prototype.search_results_mousewheel = function(evt) {
|
778 |
+
var delta;
|
779 |
+
delta = evt.deltaY || -evt.wheelDelta || evt.detail;
|
780 |
+
if (delta != null) {
|
781 |
+
evt.preventDefault();
|
782 |
+
if (evt.type === 'DOMMouseScroll') {
|
783 |
+
delta = delta * 40;
|
784 |
+
}
|
785 |
+
return this.search_results.scrollTop = delta + this.search_results.scrollTop;
|
786 |
+
}
|
787 |
+
};
|
788 |
+
|
789 |
+
Chosen.prototype.blur_test = function(evt) {
|
790 |
+
if (!this.active_field && this.container.hasClassName("chosen-container-active")) {
|
791 |
+
return this.close_field();
|
792 |
+
}
|
793 |
+
};
|
794 |
+
|
795 |
+
Chosen.prototype.close_field = function() {
|
796 |
+
this.container.ownerDocument.stopObserving("click", this.click_test_action);
|
797 |
+
this.active_field = false;
|
798 |
+
this.results_hide();
|
799 |
+
this.container.removeClassName("chosen-container-active");
|
800 |
+
this.clear_backstroke();
|
801 |
+
this.show_search_field_default();
|
802 |
+
return this.search_field_scale();
|
803 |
+
};
|
804 |
+
|
805 |
+
Chosen.prototype.activate_field = function() {
|
806 |
+
this.container.addClassName("chosen-container-active");
|
807 |
+
this.active_field = true;
|
808 |
+
this.search_field.value = this.search_field.value;
|
809 |
+
return this.search_field.focus();
|
810 |
+
};
|
811 |
+
|
812 |
+
Chosen.prototype.test_active_click = function(evt) {
|
813 |
+
if (evt.target.up('.chosen-container') === this.container) {
|
814 |
+
return this.active_field = true;
|
815 |
+
} else {
|
816 |
+
return this.close_field();
|
817 |
+
}
|
818 |
+
};
|
819 |
+
|
820 |
+
Chosen.prototype.results_build = function() {
|
821 |
+
this.parsing = true;
|
822 |
+
this.selected_option_count = null;
|
823 |
+
this.results_data = SelectParser.select_to_array(this.form_field);
|
824 |
+
if (this.is_multiple) {
|
825 |
+
this.search_choices.select("li.search-choice").invoke("remove");
|
826 |
+
} else if (!this.is_multiple) {
|
827 |
+
this.single_set_selected_text();
|
828 |
+
if (this.disable_search || this.form_field.options.length <= this.disable_search_threshold) {
|
829 |
+
this.search_field.readOnly = true;
|
830 |
+
this.container.addClassName("chosen-container-single-nosearch");
|
831 |
+
} else {
|
832 |
+
this.search_field.readOnly = false;
|
833 |
+
this.container.removeClassName("chosen-container-single-nosearch");
|
834 |
+
}
|
835 |
+
}
|
836 |
+
this.update_results_content(this.results_option_build({
|
837 |
+
first: true
|
838 |
+
}));
|
839 |
+
this.search_field_disabled();
|
840 |
+
this.show_search_field_default();
|
841 |
+
this.search_field_scale();
|
842 |
+
return this.parsing = false;
|
843 |
+
};
|
844 |
+
|
845 |
+
Chosen.prototype.result_do_highlight = function(el) {
|
846 |
+
var high_bottom, high_top, maxHeight, visible_bottom, visible_top;
|
847 |
+
this.result_clear_highlight();
|
848 |
+
this.result_highlight = el;
|
849 |
+
this.result_highlight.addClassName("highlighted");
|
850 |
+
maxHeight = parseInt(this.search_results.getStyle('maxHeight'), 10);
|
851 |
+
visible_top = this.search_results.scrollTop;
|
852 |
+
visible_bottom = maxHeight + visible_top;
|
853 |
+
high_top = this.result_highlight.positionedOffset().top;
|
854 |
+
high_bottom = high_top + this.result_highlight.getHeight();
|
855 |
+
if (high_bottom >= visible_bottom) {
|
856 |
+
return this.search_results.scrollTop = (high_bottom - maxHeight) > 0 ? high_bottom - maxHeight : 0;
|
857 |
+
} else if (high_top < visible_top) {
|
858 |
+
return this.search_results.scrollTop = high_top;
|
859 |
+
}
|
860 |
+
};
|
861 |
+
|
862 |
+
Chosen.prototype.result_clear_highlight = function() {
|
863 |
+
if (this.result_highlight) {
|
864 |
+
this.result_highlight.removeClassName('highlighted');
|
865 |
+
}
|
866 |
+
return this.result_highlight = null;
|
867 |
+
};
|
868 |
+
|
869 |
+
Chosen.prototype.results_show = function() {
|
870 |
+
if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
|
871 |
+
this.form_field.fire("chosen:maxselected", {
|
872 |
+
chosen: this
|
873 |
+
});
|
874 |
+
return false;
|
875 |
+
}
|
876 |
+
this.container.addClassName("chosen-with-drop");
|
877 |
+
this.results_showing = true;
|
878 |
+
this.search_field.focus();
|
879 |
+
this.search_field.value = this.search_field.value;
|
880 |
+
this.winnow_results();
|
881 |
+
return this.form_field.fire("chosen:showing_dropdown", {
|
882 |
+
chosen: this
|
883 |
+
});
|
884 |
+
};
|
885 |
+
|
886 |
+
Chosen.prototype.update_results_content = function(content) {
|
887 |
+
return this.search_results.update(content);
|
888 |
+
};
|
889 |
+
|
890 |
+
Chosen.prototype.results_hide = function() {
|
891 |
+
if (this.results_showing) {
|
892 |
+
this.result_clear_highlight();
|
893 |
+
this.container.removeClassName("chosen-with-drop");
|
894 |
+
this.form_field.fire("chosen:hiding_dropdown", {
|
895 |
+
chosen: this
|
896 |
+
});
|
897 |
+
}
|
898 |
+
return this.results_showing = false;
|
899 |
+
};
|
900 |
+
|
901 |
+
Chosen.prototype.set_tab_index = function(el) {
|
902 |
+
var ti;
|
903 |
+
if (this.form_field.tabIndex) {
|
904 |
+
ti = this.form_field.tabIndex;
|
905 |
+
this.form_field.tabIndex = -1;
|
906 |
+
return this.search_field.tabIndex = ti;
|
907 |
+
}
|
908 |
+
};
|
909 |
+
|
910 |
+
Chosen.prototype.set_label_behavior = function() {
|
911 |
+
var _this = this;
|
912 |
+
this.form_field_label = this.form_field.up("label");
|
913 |
+
if (this.form_field_label == null) {
|
914 |
+
this.form_field_label = $$("label[for='" + this.form_field.id + "']").first();
|
915 |
+
}
|
916 |
+
if (this.form_field_label != null) {
|
917 |
+
return this.form_field_label.observe("click", function(evt) {
|
918 |
+
if (_this.is_multiple) {
|
919 |
+
return _this.container_mousedown(evt);
|
920 |
+
} else {
|
921 |
+
return _this.activate_field();
|
922 |
+
}
|
923 |
+
});
|
924 |
+
}
|
925 |
+
};
|
926 |
+
|
927 |
+
Chosen.prototype.show_search_field_default = function() {
|
928 |
+
if (this.is_multiple && this.choices_count() < 1 && !this.active_field) {
|
929 |
+
this.search_field.value = this.default_text;
|
930 |
+
return this.search_field.addClassName("default");
|
931 |
+
} else {
|
932 |
+
this.search_field.value = "";
|
933 |
+
return this.search_field.removeClassName("default");
|
934 |
+
}
|
935 |
+
};
|
936 |
+
|
937 |
+
Chosen.prototype.search_results_mouseup = function(evt) {
|
938 |
+
var target;
|
939 |
+
target = evt.target.hasClassName("active-result") ? evt.target : evt.target.up(".active-result");
|
940 |
+
if (target) {
|
941 |
+
this.result_highlight = target;
|
942 |
+
this.result_select(evt);
|
943 |
+
return this.search_field.focus();
|
944 |
+
}
|
945 |
+
};
|
946 |
+
|
947 |
+
Chosen.prototype.search_results_mouseover = function(evt) {
|
948 |
+
var target;
|
949 |
+
target = evt.target.hasClassName("active-result") ? evt.target : evt.target.up(".active-result");
|
950 |
+
if (target) {
|
951 |
+
return this.result_do_highlight(target);
|
952 |
+
}
|
953 |
+
};
|
954 |
+
|
955 |
+
Chosen.prototype.search_results_mouseout = function(evt) {
|
956 |
+
if (evt.target.hasClassName('active-result') || evt.target.up('.active-result')) {
|
957 |
+
return this.result_clear_highlight();
|
958 |
+
}
|
959 |
+
};
|
960 |
+
|
961 |
+
Chosen.prototype.choice_build = function(item) {
|
962 |
+
var choice, close_link,
|
963 |
+
_this = this;
|
964 |
+
choice = new Element('li', {
|
965 |
+
"class": "search-choice"
|
966 |
+
}).update("<span>" + (this.choice_label(item)) + "</span>");
|
967 |
+
if (item.disabled) {
|
968 |
+
choice.addClassName('search-choice-disabled');
|
969 |
+
} else {
|
970 |
+
close_link = new Element('a', {
|
971 |
+
href: '#',
|
972 |
+
"class": 'search-choice-close',
|
973 |
+
rel: item.array_index
|
974 |
+
});
|
975 |
+
close_link.observe("click", function(evt) {
|
976 |
+
return _this.choice_destroy_link_click(evt);
|
977 |
+
});
|
978 |
+
choice.insert(close_link);
|
979 |
+
}
|
980 |
+
return this.search_container.insert({
|
981 |
+
before: choice
|
982 |
+
});
|
983 |
+
};
|
984 |
+
|
985 |
+
Chosen.prototype.choice_destroy_link_click = function(evt) {
|
986 |
+
evt.preventDefault();
|
987 |
+
evt.stopPropagation();
|
988 |
+
if (!this.is_disabled) {
|
989 |
+
return this.choice_destroy(evt.target);
|
990 |
+
}
|
991 |
+
};
|
992 |
+
|
993 |
+
Chosen.prototype.choice_destroy = function(link) {
|
994 |
+
if (this.result_deselect(link.readAttribute("rel"))) {
|
995 |
+
this.show_search_field_default();
|
996 |
+
if (this.is_multiple && this.choices_count() > 0 && this.search_field.value.length < 1) {
|
997 |
+
this.results_hide();
|
998 |
+
}
|
999 |
+
link.up('li').remove();
|
1000 |
+
return this.search_field_scale();
|
1001 |
+
}
|
1002 |
+
};
|
1003 |
+
|
1004 |
+
Chosen.prototype.results_reset = function() {
|
1005 |
+
this.reset_single_select_options();
|
1006 |
+
this.form_field.options[0].selected = true;
|
1007 |
+
this.single_set_selected_text();
|
1008 |
+
this.show_search_field_default();
|
1009 |
+
this.results_reset_cleanup();
|
1010 |
+
if (typeof Event.simulate === 'function') {
|
1011 |
+
this.form_field.simulate("change");
|
1012 |
+
}
|
1013 |
+
if (this.active_field) {
|
1014 |
+
return this.results_hide();
|
1015 |
+
}
|
1016 |
+
};
|
1017 |
+
|
1018 |
+
Chosen.prototype.results_reset_cleanup = function() {
|
1019 |
+
var deselect_trigger;
|
1020 |
+
this.current_selectedIndex = this.form_field.selectedIndex;
|
1021 |
+
deselect_trigger = this.selected_item.down("abbr");
|
1022 |
+
if (deselect_trigger) {
|
1023 |
+
return deselect_trigger.remove();
|
1024 |
+
}
|
1025 |
+
};
|
1026 |
+
|
1027 |
+
Chosen.prototype.result_select = function(evt) {
|
1028 |
+
var high, item;
|
1029 |
+
if (this.result_highlight) {
|
1030 |
+
high = this.result_highlight;
|
1031 |
+
this.result_clear_highlight();
|
1032 |
+
if (this.is_multiple && this.max_selected_options <= this.choices_count()) {
|
1033 |
+
this.form_field.fire("chosen:maxselected", {
|
1034 |
+
chosen: this
|
1035 |
+
});
|
1036 |
+
return false;
|
1037 |
+
}
|
1038 |
+
if (this.is_multiple) {
|
1039 |
+
high.removeClassName("active-result");
|
1040 |
+
} else {
|
1041 |
+
this.reset_single_select_options();
|
1042 |
+
}
|
1043 |
+
high.addClassName("result-selected");
|
1044 |
+
item = this.results_data[high.getAttribute("data-option-array-index")];
|
1045 |
+
item.selected = true;
|
1046 |
+
this.form_field.options[item.options_index].selected = true;
|
1047 |
+
this.selected_option_count = null;
|
1048 |
+
if (this.is_multiple) {
|
1049 |
+
this.choice_build(item);
|
1050 |
+
} else {
|
1051 |
+
this.single_set_selected_text(this.choice_label(item));
|
1052 |
+
}
|
1053 |
+
if (!((evt.metaKey || evt.ctrlKey) && this.is_multiple)) {
|
1054 |
+
this.results_hide();
|
1055 |
+
}
|
1056 |
+
this.search_field.value = "";
|
1057 |
+
if (typeof Event.simulate === 'function' && (this.is_multiple || this.form_field.selectedIndex !== this.current_selectedIndex)) {
|
1058 |
+
this.form_field.simulate("change");
|
1059 |
+
}
|
1060 |
+
this.current_selectedIndex = this.form_field.selectedIndex;
|
1061 |
+
evt.preventDefault();
|
1062 |
+
return this.search_field_scale();
|
1063 |
+
}
|
1064 |
+
};
|
1065 |
+
|
1066 |
+
Chosen.prototype.single_set_selected_text = function(text) {
|
1067 |
+
if (text == null) {
|
1068 |
+
text = this.default_text;
|
1069 |
+
}
|
1070 |
+
if (text === this.default_text) {
|
1071 |
+
this.selected_item.addClassName("chosen-default");
|
1072 |
+
} else {
|
1073 |
+
this.single_deselect_control_build();
|
1074 |
+
this.selected_item.removeClassName("chosen-default");
|
1075 |
+
}
|
1076 |
+
return this.selected_item.down("span").update(text);
|
1077 |
+
};
|
1078 |
+
|
1079 |
+
Chosen.prototype.result_deselect = function(pos) {
|
1080 |
+
var result_data;
|
1081 |
+
result_data = this.results_data[pos];
|
1082 |
+
if (!this.form_field.options[result_data.options_index].disabled) {
|
1083 |
+
result_data.selected = false;
|
1084 |
+
this.form_field.options[result_data.options_index].selected = false;
|
1085 |
+
this.selected_option_count = null;
|
1086 |
+
this.result_clear_highlight();
|
1087 |
+
if (this.results_showing) {
|
1088 |
+
this.winnow_results();
|
1089 |
+
}
|
1090 |
+
if (typeof Event.simulate === 'function') {
|
1091 |
+
this.form_field.simulate("change");
|
1092 |
+
}
|
1093 |
+
this.search_field_scale();
|
1094 |
+
return true;
|
1095 |
+
} else {
|
1096 |
+
return false;
|
1097 |
+
}
|
1098 |
+
};
|
1099 |
+
|
1100 |
+
Chosen.prototype.single_deselect_control_build = function() {
|
1101 |
+
if (!this.allow_single_deselect) {
|
1102 |
+
return;
|
1103 |
+
}
|
1104 |
+
if (!this.selected_item.down("abbr")) {
|
1105 |
+
this.selected_item.down("span").insert({
|
1106 |
+
after: "<abbr class=\"search-choice-close\"></abbr>"
|
1107 |
+
});
|
1108 |
+
}
|
1109 |
+
return this.selected_item.addClassName("chosen-single-with-deselect");
|
1110 |
+
};
|
1111 |
+
|
1112 |
+
Chosen.prototype.get_search_text = function() {
|
1113 |
+
return this.search_field.value.strip().escapeHTML();
|
1114 |
+
};
|
1115 |
+
|
1116 |
+
Chosen.prototype.winnow_results_set_highlight = function() {
|
1117 |
+
var do_high;
|
1118 |
+
if (!this.is_multiple) {
|
1119 |
+
do_high = this.search_results.down(".result-selected.active-result");
|
1120 |
+
}
|
1121 |
+
if (do_high == null) {
|
1122 |
+
do_high = this.search_results.down(".active-result");
|
1123 |
+
}
|
1124 |
+
if (do_high != null) {
|
1125 |
+
return this.result_do_highlight(do_high);
|
1126 |
+
}
|
1127 |
+
};
|
1128 |
+
|
1129 |
+
Chosen.prototype.no_results = function(terms) {
|
1130 |
+
this.search_results.insert(this.no_results_temp.evaluate({
|
1131 |
+
terms: terms
|
1132 |
+
}));
|
1133 |
+
return this.form_field.fire("chosen:no_results", {
|
1134 |
+
chosen: this
|
1135 |
+
});
|
1136 |
+
};
|
1137 |
+
|
1138 |
+
Chosen.prototype.no_results_clear = function() {
|
1139 |
+
var nr, _results;
|
1140 |
+
nr = null;
|
1141 |
+
_results = [];
|
1142 |
+
while (nr = this.search_results.down(".no-results")) {
|
1143 |
+
_results.push(nr.remove());
|
1144 |
+
}
|
1145 |
+
return _results;
|
1146 |
+
};
|
1147 |
+
|
1148 |
+
Chosen.prototype.keydown_arrow = function() {
|
1149 |
+
var next_sib;
|
1150 |
+
if (this.results_showing && this.result_highlight) {
|
1151 |
+
next_sib = this.result_highlight.next('.active-result');
|
1152 |
+
if (next_sib) {
|
1153 |
+
return this.result_do_highlight(next_sib);
|
1154 |
+
}
|
1155 |
+
} else {
|
1156 |
+
return this.results_show();
|
1157 |
+
}
|
1158 |
+
};
|
1159 |
+
|
1160 |
+
Chosen.prototype.keyup_arrow = function() {
|
1161 |
+
var actives, prevs, sibs;
|
1162 |
+
if (!this.results_showing && !this.is_multiple) {
|
1163 |
+
return this.results_show();
|
1164 |
+
} else if (this.result_highlight) {
|
1165 |
+
sibs = this.result_highlight.previousSiblings();
|
1166 |
+
actives = this.search_results.select("li.active-result");
|
1167 |
+
prevs = sibs.intersect(actives);
|
1168 |
+
if (prevs.length) {
|
1169 |
+
return this.result_do_highlight(prevs.first());
|
1170 |
+
} else {
|
1171 |
+
if (this.choices_count() > 0) {
|
1172 |
+
this.results_hide();
|
1173 |
+
}
|
1174 |
+
return this.result_clear_highlight();
|
1175 |
+
}
|
1176 |
+
}
|
1177 |
+
};
|
1178 |
+
|
1179 |
+
Chosen.prototype.keydown_backstroke = function() {
|
1180 |
+
var next_available_destroy;
|
1181 |
+
if (this.pending_backstroke) {
|
1182 |
+
this.choice_destroy(this.pending_backstroke.down("a"));
|
1183 |
+
return this.clear_backstroke();
|
1184 |
+
} else {
|
1185 |
+
next_available_destroy = this.search_container.siblings().last();
|
1186 |
+
if (next_available_destroy && next_available_destroy.hasClassName("search-choice") && !next_available_destroy.hasClassName("search-choice-disabled")) {
|
1187 |
+
this.pending_backstroke = next_available_destroy;
|
1188 |
+
if (this.pending_backstroke) {
|
1189 |
+
this.pending_backstroke.addClassName("search-choice-focus");
|
1190 |
+
}
|
1191 |
+
if (this.single_backstroke_delete) {
|
1192 |
+
return this.keydown_backstroke();
|
1193 |
+
} else {
|
1194 |
+
return this.pending_backstroke.addClassName("search-choice-focus");
|
1195 |
+
}
|
1196 |
+
}
|
1197 |
+
}
|
1198 |
+
};
|
1199 |
+
|
1200 |
+
Chosen.prototype.clear_backstroke = function() {
|
1201 |
+
if (this.pending_backstroke) {
|
1202 |
+
this.pending_backstroke.removeClassName("search-choice-focus");
|
1203 |
+
}
|
1204 |
+
return this.pending_backstroke = null;
|
1205 |
+
};
|
1206 |
+
|
1207 |
+
Chosen.prototype.keydown_checker = function(evt) {
|
1208 |
+
var stroke, _ref1;
|
1209 |
+
stroke = (_ref1 = evt.which) != null ? _ref1 : evt.keyCode;
|
1210 |
+
this.search_field_scale();
|
1211 |
+
if (stroke !== 8 && this.pending_backstroke) {
|
1212 |
+
this.clear_backstroke();
|
1213 |
+
}
|
1214 |
+
switch (stroke) {
|
1215 |
+
case 8:
|
1216 |
+
this.backstroke_length = this.search_field.value.length;
|
1217 |
+
break;
|
1218 |
+
case 9:
|
1219 |
+
if (this.results_showing && !this.is_multiple) {
|
1220 |
+
this.result_select(evt);
|
1221 |
+
}
|
1222 |
+
this.mouse_on_container = false;
|
1223 |
+
break;
|
1224 |
+
case 13:
|
1225 |
+
if (this.results_showing) {
|
1226 |
+
evt.preventDefault();
|
1227 |
+
}
|
1228 |
+
break;
|
1229 |
+
case 32:
|
1230 |
+
if (this.disable_search) {
|
1231 |
+
evt.preventDefault();
|
1232 |
+
}
|
1233 |
+
break;
|
1234 |
+
case 38:
|
1235 |
+
evt.preventDefault();
|
1236 |
+
this.keyup_arrow();
|
1237 |
+
break;
|
1238 |
+
case 40:
|
1239 |
+
evt.preventDefault();
|
1240 |
+
this.keydown_arrow();
|
1241 |
+
break;
|
1242 |
+
}
|
1243 |
+
};
|
1244 |
+
|
1245 |
+
Chosen.prototype.search_field_scale = function() {
|
1246 |
+
var div, f_width, h, style, style_block, styles, w, _i, _len;
|
1247 |
+
if (this.is_multiple) {
|
1248 |
+
h = 0;
|
1249 |
+
w = 0;
|
1250 |
+
style_block = "position:absolute; left: -1000px; top: -1000px; display:none;";
|
1251 |
+
styles = ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height', 'text-transform', 'letter-spacing'];
|
1252 |
+
for (_i = 0, _len = styles.length; _i < _len; _i++) {
|
1253 |
+
style = styles[_i];
|
1254 |
+
style_block += style + ":" + this.search_field.getStyle(style) + ";";
|
1255 |
+
}
|
1256 |
+
div = new Element('div', {
|
1257 |
+
'style': style_block
|
1258 |
+
}).update(this.search_field.value.escapeHTML());
|
1259 |
+
document.body.appendChild(div);
|
1260 |
+
w = Element.measure(div, 'width') + 25;
|
1261 |
+
div.remove();
|
1262 |
+
f_width = this.container.getWidth();
|
1263 |
+
if (w > f_width - 10) {
|
1264 |
+
w = f_width - 10;
|
1265 |
+
}
|
1266 |
+
return this.search_field.setStyle({
|
1267 |
+
'width': w + 'px'
|
1268 |
+
});
|
1269 |
+
}
|
1270 |
+
};
|
1271 |
+
|
1272 |
+
return Chosen;
|
1273 |
+
|
1274 |
+
})(AbstractChosen);
|
1275 |
+
|
1276 |
+
}).call(this);
|
assets/lib/chosen_v1.4.2/chosen.proto.min.js
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
/* Chosen v1.4.2 | (c) 2011-2015 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
|
2 |
+
(function(){var AbstractChosen,SelectParser,a,b={}.hasOwnProperty,c=function(a,c){function d(){this.constructor=a}for(var e in c)b.call(c,e)&&(a[e]=c[e]);return d.prototype=c.prototype,a.prototype=new d,a.__super__=c.prototype,a};SelectParser=function(){function SelectParser(){this.options_index=0,this.parsed=[]}return SelectParser.prototype.add_node=function(a){return"OPTGROUP"===a.nodeName.toUpperCase()?this.add_group(a):this.add_option(a)},SelectParser.prototype.add_group=function(a){var b,c,d,e,f,g;for(b=this.parsed.length,this.parsed.push({array_index:b,group:!0,label:this.escapeExpression(a.label),title:a.title?a.title:void 0,children:0,disabled:a.disabled,classes:a.className}),f=a.childNodes,g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push(this.add_option(c,b,a.disabled));return g},SelectParser.prototype.add_option=function(a,b,c){return"OPTION"===a.nodeName.toUpperCase()?(""!==a.text?(null!=b&&(this.parsed[b].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:a.value,text:a.text,html:a.innerHTML,title:a.title?a.title:void 0,selected:a.selected,disabled:c===!0?c:a.disabled,group_array_index:b,group_label:null!=b?this.parsed[b].label:null,classes:a.className,style:a.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1):void 0},SelectParser.prototype.escapeExpression=function(a){var b,c;return null==a||a===!1?"":/[\&\<\>\"\'\`]/.test(a)?(b={"<":"<",">":">",'"':""","'":"'","`":"`"},c=/&(?!\w+;)|[\<\>\"\'\`]/g,a.replace(c,function(a){return b[a]||"&"})):a},SelectParser}(),SelectParser.select_to_array=function(a){var b,c,d,e,f;for(c=new SelectParser,f=a.childNodes,d=0,e=f.length;e>d;d++)b=f[d],c.add_node(b);return c.parsed},AbstractChosen=function(){function AbstractChosen(a,b){this.form_field=a,this.options=null!=b?b:{},AbstractChosen.browser_is_supported()&&(this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers(),this.on_ready())}return AbstractChosen.prototype.set_default_values=function(){var a=this;return this.click_test_action=function(b){return a.test_active_click(b)},this.activate_action=function(b){return a.activate_field(b)},this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.allow_single_deselect=null!=this.options.allow_single_deselect&&null!=this.form_field.options[0]&&""===this.form_field.options[0].text?this.options.allow_single_deselect:!1,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=null!=this.options.enable_split_word_search?this.options.enable_split_word_search:!0,this.group_search=null!=this.options.group_search?this.options.group_search:!0,this.search_contains=this.options.search_contains||!1,this.single_backstroke_delete=null!=this.options.single_backstroke_delete?this.options.single_backstroke_delete:!0,this.max_selected_options=this.options.max_selected_options||1/0,this.inherit_select_classes=this.options.inherit_select_classes||!1,this.display_selected_options=null!=this.options.display_selected_options?this.options.display_selected_options:!0,this.display_disabled_options=null!=this.options.display_disabled_options?this.options.display_disabled_options:!0,this.include_group_label_in_selected=this.options.include_group_label_in_selected||!1},AbstractChosen.prototype.set_default_text=function(){return this.default_text=this.form_field.getAttribute("data-placeholder")?this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.options.placeholder_text_multiple||this.options.placeholder_text||AbstractChosen.default_multiple_text:this.options.placeholder_text_single||this.options.placeholder_text||AbstractChosen.default_single_text,this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||AbstractChosen.default_no_result_text},AbstractChosen.prototype.choice_label=function(a){return this.include_group_label_in_selected&&null!=a.group_label?"<b class='group-name'>"+a.group_label+"</b>"+a.html:a.html},AbstractChosen.prototype.mouse_enter=function(){return this.mouse_on_container=!0},AbstractChosen.prototype.mouse_leave=function(){return this.mouse_on_container=!1},AbstractChosen.prototype.input_focus=function(){var a=this;if(this.is_multiple){if(!this.active_field)return setTimeout(function(){return a.container_mousedown()},50)}else if(!this.active_field)return this.activate_field()},AbstractChosen.prototype.input_blur=function(){var a=this;return this.mouse_on_container?void 0:(this.active_field=!1,setTimeout(function(){return a.blur_test()},100))},AbstractChosen.prototype.results_option_build=function(a){var b,c,d,e,f;for(b="",f=this.results_data,d=0,e=f.length;e>d;d++)c=f[d],b+=c.group?this.result_add_group(c):this.result_add_option(c),(null!=a?a.first:void 0)&&(c.selected&&this.is_multiple?this.choice_build(c):c.selected&&!this.is_multiple&&this.single_set_selected_text(this.choice_label(c)));return b},AbstractChosen.prototype.result_add_option=function(a){var b,c;return a.search_match?this.include_option_in_results(a)?(b=[],a.disabled||a.selected&&this.is_multiple||b.push("active-result"),!a.disabled||a.selected&&this.is_multiple||b.push("disabled-result"),a.selected&&b.push("result-selected"),null!=a.group_array_index&&b.push("group-option"),""!==a.classes&&b.push(a.classes),c=document.createElement("li"),c.className=b.join(" "),c.style.cssText=a.style,c.setAttribute("data-option-array-index",a.array_index),c.innerHTML=a.search_text,a.title&&(c.title=a.title),this.outerHTML(c)):"":""},AbstractChosen.prototype.result_add_group=function(a){var b,c;return a.search_match||a.group_match?a.active_options>0?(b=[],b.push("group-result"),a.classes&&b.push(a.classes),c=document.createElement("li"),c.className=b.join(" "),c.innerHTML=a.search_text,a.title&&(c.title=a.title),this.outerHTML(c)):"":""},AbstractChosen.prototype.results_update_field=function(){return this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.results_build(),this.results_showing?this.winnow_results():void 0},AbstractChosen.prototype.reset_single_select_options=function(){var a,b,c,d,e;for(d=this.results_data,e=[],b=0,c=d.length;c>b;b++)a=d[b],a.selected?e.push(a.selected=!1):e.push(void 0);return e},AbstractChosen.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},AbstractChosen.prototype.results_search=function(){return this.results_showing?this.winnow_results():this.results_show()},AbstractChosen.prototype.winnow_results=function(){var a,b,c,d,e,f,g,h,i,j,k,l;for(this.no_results_clear(),d=0,f=this.get_search_text(),a=f.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),i=new RegExp(a,"i"),c=this.get_search_regex(a),l=this.results_data,j=0,k=l.length;k>j;j++)b=l[j],b.search_match=!1,e=null,this.include_option_in_results(b)&&(b.group&&(b.group_match=!1,b.active_options=0),null!=b.group_array_index&&this.results_data[b.group_array_index]&&(e=this.results_data[b.group_array_index],0===e.active_options&&e.search_match&&(d+=1),e.active_options+=1),b.search_text=b.group?b.label:b.html,(!b.group||this.group_search)&&(b.search_match=this.search_string_match(b.search_text,c),b.search_match&&!b.group&&(d+=1),b.search_match?(f.length&&(g=b.search_text.search(i),h=b.search_text.substr(0,g+f.length)+"</em>"+b.search_text.substr(g+f.length),b.search_text=h.substr(0,g)+"<em>"+h.substr(g)),null!=e&&(e.group_match=!0)):null!=b.group_array_index&&this.results_data[b.group_array_index].search_match&&(b.search_match=!0)));return this.result_clear_highlight(),1>d&&f.length?(this.update_results_content(""),this.no_results(f)):(this.update_results_content(this.results_option_build()),this.winnow_results_set_highlight())},AbstractChosen.prototype.get_search_regex=function(a){var b;return b=this.search_contains?"":"^",new RegExp(b+a,"i")},AbstractChosen.prototype.search_string_match=function(a,b){var c,d,e,f;if(b.test(a))return!0;if(this.enable_split_word_search&&(a.indexOf(" ")>=0||0===a.indexOf("["))&&(d=a.replace(/\[|\]/g,"").split(" "),d.length))for(e=0,f=d.length;f>e;e++)if(c=d[e],b.test(c))return!0},AbstractChosen.prototype.choices_count=function(){var a,b,c,d;if(null!=this.selected_option_count)return this.selected_option_count;for(this.selected_option_count=0,d=this.form_field.options,b=0,c=d.length;c>b;b++)a=d[b],a.selected&&(this.selected_option_count+=1);return this.selected_option_count},AbstractChosen.prototype.choices_click=function(a){return a.preventDefault(),this.results_showing||this.is_disabled?void 0:this.results_show()},AbstractChosen.prototype.keyup_checker=function(a){var b,c;switch(b=null!=(c=a.which)?c:a.keyCode,this.search_field_scale(),b){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices_count()>0)return this.keydown_backstroke();if(!this.pending_backstroke)return this.result_clear_highlight(),this.results_search();break;case 13:if(a.preventDefault(),this.results_showing)return this.result_select(a);break;case 27:return this.results_showing&&this.results_hide(),!0;case 9:case 38:case 40:case 16:case 91:case 17:break;default:return this.results_search()}},AbstractChosen.prototype.clipboard_event_checker=function(){var a=this;return setTimeout(function(){return a.results_search()},50)},AbstractChosen.prototype.container_width=function(){return null!=this.options.width?this.options.width:""+this.form_field.offsetWidth+"px"},AbstractChosen.prototype.include_option_in_results=function(a){return this.is_multiple&&!this.display_selected_options&&a.selected?!1:!this.display_disabled_options&&a.disabled?!1:a.empty?!1:!0},AbstractChosen.prototype.search_results_touchstart=function(a){return this.touch_started=!0,this.search_results_mouseover(a)},AbstractChosen.prototype.search_results_touchmove=function(a){return this.touch_started=!1,this.search_results_mouseout(a)},AbstractChosen.prototype.search_results_touchend=function(a){return this.touch_started?this.search_results_mouseup(a):void 0},AbstractChosen.prototype.outerHTML=function(a){var b;return a.outerHTML?a.outerHTML:(b=document.createElement("div"),b.appendChild(a),b.innerHTML)},AbstractChosen.browser_is_supported=function(){return"Microsoft Internet Explorer"===window.navigator.appName?document.documentMode>=8:/iP(od|hone)/i.test(window.navigator.userAgent)?!1:/Android/i.test(window.navigator.userAgent)&&/Mobile/i.test(window.navigator.userAgent)?!1:!0},AbstractChosen.default_multiple_text="Select Some Options",AbstractChosen.default_single_text="Select an Option",AbstractChosen.default_no_result_text="No results match",AbstractChosen}(),this.Chosen=function(b){function Chosen(){return a=Chosen.__super__.constructor.apply(this,arguments)}return c(Chosen,b),Chosen.prototype.setup=function(){return this.current_selectedIndex=this.form_field.selectedIndex,this.is_rtl=this.form_field.hasClassName("chosen-rtl")},Chosen.prototype.set_default_values=function(){return Chosen.__super__.set_default_values.call(this),this.single_temp=new Template('<a class="chosen-single chosen-default" tabindex="-1"><span>#{default}</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" /></div><ul class="chosen-results"></ul></div>'),this.multi_temp=new Template('<ul class="chosen-choices"><li class="search-field"><input type="text" value="#{default}" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chosen-drop"><ul class="chosen-results"></ul></div>'),this.no_results_temp=new Template('<li class="no-results">'+this.results_none_found+' "<span>#{terms}</span>"</li>')},Chosen.prototype.set_up_html=function(){var a,b;return a=["chosen-container"],a.push("chosen-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&a.push(this.form_field.className),this.is_rtl&&a.push("chosen-rtl"),b={"class":a.join(" "),style:"width: "+this.container_width()+";",title:this.form_field.title},this.form_field.id.length&&(b.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"),this.container=this.is_multiple?new Element("div",b).update(this.multi_temp.evaluate({"default":this.default_text})):new Element("div",b).update(this.single_temp.evaluate({"default":this.default_text})),this.form_field.hide().insert({after:this.container}),this.dropdown=this.container.down("div.chosen-drop"),this.search_field=this.container.down("input"),this.search_results=this.container.down("ul.chosen-results"),this.search_field_scale(),this.search_no_results=this.container.down("li.no-results"),this.is_multiple?(this.search_choices=this.container.down("ul.chosen-choices"),this.search_container=this.container.down("li.search-field")):(this.search_container=this.container.down("div.chosen-search"),this.selected_item=this.container.down(".chosen-single")),this.results_build(),this.set_tab_index(),this.set_label_behavior()},Chosen.prototype.on_ready=function(){return this.form_field.fire("chosen:ready",{chosen:this})},Chosen.prototype.register_observers=function(){var a=this;return this.container.observe("touchstart",function(b){return a.container_mousedown(b),b.preventDefault()}),this.container.observe("touchend",function(b){return a.container_mouseup(b),b.preventDefault()}),this.container.observe("mousedown",function(b){return a.container_mousedown(b)}),this.container.observe("mouseup",function(b){return a.container_mouseup(b)}),this.container.observe("mouseenter",function(b){return a.mouse_enter(b)}),this.container.observe("mouseleave",function(b){return a.mouse_leave(b)}),this.search_results.observe("mouseup",function(b){return a.search_results_mouseup(b)}),this.search_results.observe("mouseover",function(b){return a.search_results_mouseover(b)}),this.search_results.observe("mouseout",function(b){return a.search_results_mouseout(b)}),this.search_results.observe("mousewheel",function(b){return a.search_results_mousewheel(b)}),this.search_results.observe("DOMMouseScroll",function(b){return a.search_results_mousewheel(b)}),this.search_results.observe("touchstart",function(b){return a.search_results_touchstart(b)}),this.search_results.observe("touchmove",function(b){return a.search_results_touchmove(b)}),this.search_results.observe("touchend",function(b){return a.search_results_touchend(b)}),this.form_field.observe("chosen:updated",function(b){return a.results_update_field(b)}),this.form_field.observe("chosen:activate",function(b){return a.activate_field(b)}),this.form_field.observe("chosen:open",function(b){return a.container_mousedown(b)}),this.form_field.observe("chosen:close",function(b){return a.input_blur(b)}),this.search_field.observe("blur",function(b){return a.input_blur(b)}),this.search_field.observe("keyup",function(b){return a.keyup_checker(b)}),this.search_field.observe("keydown",function(b){return a.keydown_checker(b)}),this.search_field.observe("focus",function(b){return a.input_focus(b)}),this.search_field.observe("cut",function(b){return a.clipboard_event_checker(b)}),this.search_field.observe("paste",function(b){return a.clipboard_event_checker(b)}),this.is_multiple?this.search_choices.observe("click",function(b){return a.choices_click(b)}):this.container.observe("click",function(a){return a.preventDefault()})},Chosen.prototype.destroy=function(){return this.container.ownerDocument.stopObserving("click",this.click_test_action),this.form_field.stopObserving(),this.container.stopObserving(),this.search_results.stopObserving(),this.search_field.stopObserving(),null!=this.form_field_label&&this.form_field_label.stopObserving(),this.is_multiple?(this.search_choices.stopObserving(),this.container.select(".search-choice-close").each(function(a){return a.stopObserving()})):this.selected_item.stopObserving(),this.search_field.tabIndex&&(this.form_field.tabIndex=this.search_field.tabIndex),this.container.remove(),this.form_field.show()},Chosen.prototype.search_field_disabled=function(){return this.is_disabled=this.form_field.disabled,this.is_disabled?(this.container.addClassName("chosen-disabled"),this.search_field.disabled=!0,this.is_multiple||this.selected_item.stopObserving("focus",this.activate_action),this.close_field()):(this.container.removeClassName("chosen-disabled"),this.search_field.disabled=!1,this.is_multiple?void 0:this.selected_item.observe("focus",this.activate_action))},Chosen.prototype.container_mousedown=function(a){return this.is_disabled||(a&&"mousedown"===a.type&&!this.results_showing&&a.stop(),null!=a&&a.target.hasClassName("search-choice-close"))?void 0:(this.active_field?this.is_multiple||!a||a.target!==this.selected_item&&!a.target.up("a.chosen-single")||this.results_toggle():(this.is_multiple&&this.search_field.clear(),this.container.ownerDocument.observe("click",this.click_test_action),this.results_show()),this.activate_field())},Chosen.prototype.container_mouseup=function(a){return"ABBR"!==a.target.nodeName||this.is_disabled?void 0:this.results_reset(a)},Chosen.prototype.search_results_mousewheel=function(a){var b;return b=a.deltaY||-a.wheelDelta||a.detail,null!=b?(a.preventDefault(),"DOMMouseScroll"===a.type&&(b=40*b),this.search_results.scrollTop=b+this.search_results.scrollTop):void 0},Chosen.prototype.blur_test=function(){return!this.active_field&&this.container.hasClassName("chosen-container-active")?this.close_field():void 0},Chosen.prototype.close_field=function(){return this.container.ownerDocument.stopObserving("click",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClassName("chosen-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale()},Chosen.prototype.activate_field=function(){return this.container.addClassName("chosen-container-active"),this.active_field=!0,this.search_field.value=this.search_field.value,this.search_field.focus()},Chosen.prototype.test_active_click=function(a){return a.target.up(".chosen-container")===this.container?this.active_field=!0:this.close_field()},Chosen.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=SelectParser.select_to_array(this.form_field),this.is_multiple?this.search_choices.select("li.search-choice").invoke("remove"):this.is_multiple||(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field.readOnly=!0,this.container.addClassName("chosen-container-single-nosearch")):(this.search_field.readOnly=!1,this.container.removeClassName("chosen-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},Chosen.prototype.result_do_highlight=function(a){var b,c,d,e,f;return this.result_clear_highlight(),this.result_highlight=a,this.result_highlight.addClassName("highlighted"),d=parseInt(this.search_results.getStyle("maxHeight"),10),f=this.search_results.scrollTop,e=d+f,c=this.result_highlight.positionedOffset().top,b=c+this.result_highlight.getHeight(),b>=e?this.search_results.scrollTop=b-d>0?b-d:0:f>c?this.search_results.scrollTop=c:void 0},Chosen.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClassName("highlighted"),this.result_highlight=null},Chosen.prototype.results_show=function(){return this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field.fire("chosen:maxselected",{chosen:this}),!1):(this.container.addClassName("chosen-with-drop"),this.results_showing=!0,this.search_field.focus(),this.search_field.value=this.search_field.value,this.winnow_results(),this.form_field.fire("chosen:showing_dropdown",{chosen:this}))},Chosen.prototype.update_results_content=function(a){return this.search_results.update(a)},Chosen.prototype.results_hide=function(){return this.results_showing&&(this.result_clear_highlight(),this.container.removeClassName("chosen-with-drop"),this.form_field.fire("chosen:hiding_dropdown",{chosen:this})),this.results_showing=!1},Chosen.prototype.set_tab_index=function(){var a;return this.form_field.tabIndex?(a=this.form_field.tabIndex,this.form_field.tabIndex=-1,this.search_field.tabIndex=a):void 0},Chosen.prototype.set_label_behavior=function(){var a=this;return this.form_field_label=this.form_field.up("label"),null==this.form_field_label&&(this.form_field_label=$$("label[for='"+this.form_field.id+"']").first()),null!=this.form_field_label?this.form_field_label.observe("click",function(b){return a.is_multiple?a.container_mousedown(b):a.activate_field()}):void 0},Chosen.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices_count()<1&&!this.active_field?(this.search_field.value=this.default_text,this.search_field.addClassName("default")):(this.search_field.value="",this.search_field.removeClassName("default"))},Chosen.prototype.search_results_mouseup=function(a){var b;return b=a.target.hasClassName("active-result")?a.target:a.target.up(".active-result"),b?(this.result_highlight=b,this.result_select(a),this.search_field.focus()):void 0},Chosen.prototype.search_results_mouseover=function(a){var b;return b=a.target.hasClassName("active-result")?a.target:a.target.up(".active-result"),b?this.result_do_highlight(b):void 0},Chosen.prototype.search_results_mouseout=function(a){return a.target.hasClassName("active-result")||a.target.up(".active-result")?this.result_clear_highlight():void 0},Chosen.prototype.choice_build=function(a){var b,c,d=this;return b=new Element("li",{"class":"search-choice"}).update("<span>"+this.choice_label(a)+"</span>"),a.disabled?b.addClassName("search-choice-disabled"):(c=new Element("a",{href:"#","class":"search-choice-close",rel:a.array_index}),c.observe("click",function(a){return d.choice_destroy_link_click(a)}),b.insert(c)),this.search_container.insert({before:b})},Chosen.prototype.choice_destroy_link_click=function(a){return a.preventDefault(),a.stopPropagation(),this.is_disabled?void 0:this.choice_destroy(a.target)},Chosen.prototype.choice_destroy=function(a){return this.result_deselect(a.readAttribute("rel"))?(this.show_search_field_default(),this.is_multiple&&this.choices_count()>0&&this.search_field.value.length<1&&this.results_hide(),a.up("li").remove(),this.search_field_scale()):void 0},Chosen.prototype.results_reset=function(){return this.reset_single_select_options(),this.form_field.options[0].selected=!0,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),"function"==typeof Event.simulate&&this.form_field.simulate("change"),this.active_field?this.results_hide():void 0},Chosen.prototype.results_reset_cleanup=function(){var a;return this.current_selectedIndex=this.form_field.selectedIndex,a=this.selected_item.down("abbr"),a?a.remove():void 0},Chosen.prototype.result_select=function(a){var b,c;return this.result_highlight?(b=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field.fire("chosen:maxselected",{chosen:this}),!1):(this.is_multiple?b.removeClassName("active-result"):this.reset_single_select_options(),b.addClassName("result-selected"),c=this.results_data[b.getAttribute("data-option-array-index")],c.selected=!0,this.form_field.options[c.options_index].selected=!0,this.selected_option_count=null,this.is_multiple?this.choice_build(c):this.single_set_selected_text(this.choice_label(c)),(a.metaKey||a.ctrlKey)&&this.is_multiple||this.results_hide(),this.search_field.value="","function"!=typeof Event.simulate||!this.is_multiple&&this.form_field.selectedIndex===this.current_selectedIndex||this.form_field.simulate("change"),this.current_selectedIndex=this.form_field.selectedIndex,a.preventDefault(),this.search_field_scale())):void 0},Chosen.prototype.single_set_selected_text=function(a){return null==a&&(a=this.default_text),a===this.default_text?this.selected_item.addClassName("chosen-default"):(this.single_deselect_control_build(),this.selected_item.removeClassName("chosen-default")),this.selected_item.down("span").update(a)},Chosen.prototype.result_deselect=function(a){var b;return b=this.results_data[a],this.form_field.options[b.options_index].disabled?!1:(b.selected=!1,this.form_field.options[b.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),"function"==typeof Event.simulate&&this.form_field.simulate("change"),this.search_field_scale(),!0)},Chosen.prototype.single_deselect_control_build=function(){return this.allow_single_deselect?(this.selected_item.down("abbr")||this.selected_item.down("span").insert({after:'<abbr class="search-choice-close"></abbr>'}),this.selected_item.addClassName("chosen-single-with-deselect")):void 0},Chosen.prototype.get_search_text=function(){return this.search_field.value.strip().escapeHTML()},Chosen.prototype.winnow_results_set_highlight=function(){var a;return this.is_multiple||(a=this.search_results.down(".result-selected.active-result")),null==a&&(a=this.search_results.down(".active-result")),null!=a?this.result_do_highlight(a):void 0},Chosen.prototype.no_results=function(a){return this.search_results.insert(this.no_results_temp.evaluate({terms:a})),this.form_field.fire("chosen:no_results",{chosen:this})},Chosen.prototype.no_results_clear=function(){var a,b;for(a=null,b=[];a=this.search_results.down(".no-results");)b.push(a.remove());return b},Chosen.prototype.keydown_arrow=function(){var a;return this.results_showing&&this.result_highlight?(a=this.result_highlight.next(".active-result"))?this.result_do_highlight(a):void 0:this.results_show()},Chosen.prototype.keyup_arrow=function(){var a,b,c;return this.results_showing||this.is_multiple?this.result_highlight?(c=this.result_highlight.previousSiblings(),a=this.search_results.select("li.active-result"),b=c.intersect(a),b.length?this.result_do_highlight(b.first()):(this.choices_count()>0&&this.results_hide(),this.result_clear_highlight())):void 0:this.results_show()},Chosen.prototype.keydown_backstroke=function(){var a;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.down("a")),this.clear_backstroke()):(a=this.search_container.siblings().last(),a&&a.hasClassName("search-choice")&&!a.hasClassName("search-choice-disabled")?(this.pending_backstroke=a,this.pending_backstroke&&this.pending_backstroke.addClassName("search-choice-focus"),this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClassName("search-choice-focus")):void 0)},Chosen.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClassName("search-choice-focus"),this.pending_backstroke=null},Chosen.prototype.keydown_checker=function(a){var b,c;switch(b=null!=(c=a.which)?c:a.keyCode,this.search_field_scale(),8!==b&&this.pending_backstroke&&this.clear_backstroke(),b){case 8:this.backstroke_length=this.search_field.value.length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(a),this.mouse_on_container=!1;break;case 13:this.results_showing&&a.preventDefault();break;case 32:this.disable_search&&a.preventDefault();break;case 38:a.preventDefault(),this.keyup_arrow();break;case 40:a.preventDefault(),this.keydown_arrow()}},Chosen.prototype.search_field_scale=function(){var a,b,c,d,e,f,g,h,i;if(this.is_multiple){for(c=0,g=0,e="position:absolute; left: -1000px; top: -1000px; display:none;",f=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"],h=0,i=f.length;i>h;h++)d=f[h],e+=d+":"+this.search_field.getStyle(d)+";";return a=new Element("div",{style:e}).update(this.search_field.value.escapeHTML()),document.body.appendChild(a),g=Element.measure(a,"width")+25,a.remove(),b=this.container.getWidth(),g>b-10&&(g=b-10),this.search_field.setStyle({width:g+"px"})}},Chosen}(AbstractChosen)}).call(this);
|
assets/lib/chosen_v1.4.2/docsupport/chosen.png
ADDED
Binary file
|
assets/lib/chosen_v1.4.2/docsupport/oss-credit.png
ADDED
Binary file
|
assets/lib/chosen_v1.4.2/docsupport/prism.css
ADDED
@@ -0,0 +1,108 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* okaidia theme for JavaScript, CSS and HTML
|
3 |
+
* Loosely based on Monokai textmate theme by http://www.monokai.nl/
|
4 |
+
* @author ocodia
|
5 |
+
*/
|
6 |
+
|
7 |
+
code[class*="language-"],
|
8 |
+
pre[class*="language-"] {
|
9 |
+
color: #f8f8f2;
|
10 |
+
text-shadow: 0 1px rgba(0,0,0,0.3);
|
11 |
+
font-family: Consolas, Monaco, 'Andale Mono', monospace;
|
12 |
+
direction: ltr;
|
13 |
+
text-align: left;
|
14 |
+
white-space: pre;
|
15 |
+
word-spacing: normal;
|
16 |
+
|
17 |
+
-moz-tab-size: 4;
|
18 |
+
-o-tab-size: 4;
|
19 |
+
tab-size: 4;
|
20 |
+
|
21 |
+
-webkit-hyphens: none;
|
22 |
+
-moz-hyphens: none;
|
23 |
+
-ms-hyphens: none;
|
24 |
+
hyphens: none;
|
25 |
+
}
|
26 |
+
|
27 |
+
/* Code blocks */
|
28 |
+
pre[class*="language-"] {
|
29 |
+
padding: 1em;
|
30 |
+
margin: .5em 0;
|
31 |
+
overflow: auto;
|
32 |
+
border-radius: 0.3em;
|
33 |
+
}
|
34 |
+
|
35 |
+
:not(pre) > code[class*="language-"],
|
36 |
+
pre[class*="language-"] {
|
37 |
+
background: #272822;
|
38 |
+
}
|
39 |
+
|
40 |
+
/* Inline code */
|
41 |
+
:not(pre) > code[class*="language-"] {
|
42 |
+
padding: .1em;
|
43 |
+
border-radius: .3em;
|
44 |
+
}
|
45 |
+
|
46 |
+
.token.comment,
|
47 |
+
.token.prolog,
|
48 |
+
.token.doctype,
|
49 |
+
.token.cdata {
|
50 |
+
color: slategray;
|
51 |
+
}
|
52 |
+
|
53 |
+
.token.punctuation {
|
54 |
+
color: #f8f8f2;
|
55 |
+
}
|
56 |
+
|
57 |
+
.namespace {
|
58 |
+
opacity: .7;
|
59 |
+
}
|
60 |
+
|
61 |
+
.token.property,
|
62 |
+
.token.tag {
|
63 |
+
color: #f92672;
|
64 |
+
}
|
65 |
+
|
66 |
+
.token.boolean,
|
67 |
+
.token.number{
|
68 |
+
color: #ae81ff;
|
69 |
+
}
|
70 |
+
|
71 |
+
.token.selector,
|
72 |
+
.token.attr-name,
|
73 |
+
.token.string {
|
74 |
+
color: #a6e22e;
|
75 |
+
}
|
76 |
+
|
77 |
+
|
78 |
+
.token.operator,
|
79 |
+
.token.entity,
|
80 |
+
.token.url,
|
81 |
+
.language-css .token.string,
|
82 |
+
.style .token.string {
|
83 |
+
color: #f8f8f2;
|
84 |
+
}
|
85 |
+
|
86 |
+
.token.atrule,
|
87 |
+
.token.attr-value
|
88 |
+
{
|
89 |
+
color: #e6db74;
|
90 |
+
}
|
91 |
+
|
92 |
+
|
93 |
+
.token.keyword{
|
94 |
+
color: #66d9ef;
|
95 |
+
}
|
96 |
+
|
97 |
+
.token.regex,
|
98 |
+
.token.important {
|
99 |
+
color: #fd971f;
|
100 |
+
}
|
101 |
+
|
102 |
+
.token.important {
|
103 |
+
font-weight: bold;
|
104 |
+
}
|
105 |
+
|
106 |
+
.token.entity {
|
107 |
+
cursor: help;
|
108 |
+
}
|
assets/lib/chosen_v1.4.2/docsupport/prism.js
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Prism: Lightweight, robust, elegant syntax highlighting
|
3 |
+
* MIT license http://www.opensource.org/licenses/mit-license.php/
|
4 |
+
* @author Lea Verou http://lea.verou.me
|
5 |
+
*/(function(){var e=/\blang(?:uage)?-(?!\*)(\w+)\b/i,t=self.Prism={util:{type:function(e){return Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1]},clone:function(e){var n=t.util.type(e);switch(n){case"Object":var r={};for(var i in e)e.hasOwnProperty(i)&&(r[i]=t.util.clone(e[i]));return r;case"Array":return e.slice()}return e}},languages:{extend:function(e,n){var r=t.util.clone(t.languages[e]);for(var i in n)r[i]=n[i];return r},insertBefore:function(e,n,r,i){i=i||t.languages;var s=i[e],o={};for(var u in s)if(s.hasOwnProperty(u)){if(u==n)for(var a in r)r.hasOwnProperty(a)&&(o[a]=r[a]);o[u]=s[u]}return i[e]=o},DFS:function(e,n){for(var r in e){n.call(e,r,e[r]);t.util.type(e)==="Object"&&t.languages.DFS(e[r],n)}}},highlightAll:function(e,n){var r=document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code');for(var i=0,s;s=r[i++];)t.highlightElement(s,e===!0,n)},highlightElement:function(r,i,s){var o,u,a=r;while(a&&!e.test(a.className))a=a.parentNode;if(a){o=(a.className.match(e)||[,""])[1];u=t.languages[o]}if(!u)return;r.className=r.className.replace(e,"").replace(/\s+/g," ")+" language-"+o;a=r.parentNode;/pre/i.test(a.nodeName)&&(a.className=a.className.replace(e,"").replace(/\s+/g," ")+" language-"+o);var f=r.textContent;if(!f)return;f=f.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ");var l={element:r,language:o,grammar:u,code:f};t.hooks.run("before-highlight",l);if(i&&self.Worker){var c=new Worker(t.filename);c.onmessage=function(e){l.highlightedCode=n.stringify(JSON.parse(e.data),o);t.hooks.run("before-insert",l);l.element.innerHTML=l.highlightedCode;s&&s.call(l.element);t.hooks.run("after-highlight",l)};c.postMessage(JSON.stringify({language:l.language,code:l.code}))}else{l.highlightedCode=t.highlight(l.code,l.grammar,l.language);t.hooks.run("before-insert",l);l.element.innerHTML=l.highlightedCode;s&&s.call(r);t.hooks.run("after-highlight",l)}},highlight:function(e,r,i){return n.stringify(t.tokenize(e,r),i)},tokenize:function(e,n,r){var i=t.Token,s=[e],o=n.rest;if(o){for(var u in o)n[u]=o[u];delete n.rest}e:for(var u in n){if(!n.hasOwnProperty(u)||!n[u])continue;var a=n[u],f=a.inside,l=!!a.lookbehind,c=0;a=a.pattern||a;for(var h=0;h<s.length;h++){var p=s[h];if(s.length>e.length)break e;if(p instanceof i)continue;a.lastIndex=0;var d=a.exec(p);if(d){l&&(c=d[1].length);var v=d.index-1+c,d=d[0].slice(c),m=d.length,g=v+m,y=p.slice(0,v+1),b=p.slice(g+1),w=[h,1];y&&w.push(y);var E=new i(u,f?t.tokenize(d,f):d);w.push(E);b&&w.push(b);Array.prototype.splice.apply(s,w)}}}return s},hooks:{all:{},add:function(e,n){var r=t.hooks.all;r[e]=r[e]||[];r[e].push(n)},run:function(e,n){var r=t.hooks.all[e];if(!r||!r.length)return;for(var i=0,s;s=r[i++];)s(n)}}},n=t.Token=function(e,t){this.type=e;this.content=t};n.stringify=function(e,r,i){if(typeof e=="string")return e;if(Object.prototype.toString.call(e)=="[object Array]")return e.map(function(t){return n.stringify(t,r,e)}).join("");var s={type:e.type,content:n.stringify(e.content,r,i),tag:"span",classes:["token",e.type],attributes:{},language:r,parent:i};s.type=="comment"&&(s.attributes.spellcheck="true");t.hooks.run("wrap",s);var o="";for(var u in s.attributes)o+=u+'="'+(s.attributes[u]||"")+'"';return"<"+s.tag+' class="'+s.classes.join(" ")+'" '+o+">"+s.content+"</"+s.tag+">"};if(!self.document){self.addEventListener("message",function(e){var n=JSON.parse(e.data),r=n.language,i=n.code;self.postMessage(JSON.stringify(t.tokenize(i,t.languages[r])));self.close()},!1);return}var r=document.getElementsByTagName("script");r=r[r.length-1];if(r){t.filename=r.src;document.addEventListener&&!r.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",t.highlightAll)}})();;
|
6 |
+
Prism.languages.markup={comment:/<!--[\w\W]*?-->/g,prolog:/<\?.+?\?>/,doctype:/<!DOCTYPE.+?>/,cdata:/<!\[CDATA\[[\w\W]*?]]>/i,tag:{pattern:/<\/?[\w:-]+\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|\w+))?\s*)*\/?>/gi,inside:{tag:{pattern:/^<\/?[\w:-]+/i,inside:{punctuation:/^<\/?/,namespace:/^[\w-]+?:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/gi,inside:{punctuation:/=|>|"/g}},punctuation:/\/?>/g,"attr-name":{pattern:/[\w:-]+/g,inside:{namespace:/^[\w-]+?:/}}}},entity:/&#?[\da-z]{1,8};/gi};Prism.hooks.add("wrap",function(e){e.type==="entity"&&(e.attributes.title=e.content.replace(/&/,"&"))});;
|
7 |
+
Prism.languages.css={comment:/\/\*[\w\W]*?\*\//g,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*{))/gi,inside:{punctuation:/[;:]/g}},url:/url\((["']?).*?\1\)/gi,selector:/[^\{\}\s][^\{\};]*(?=\s*\{)/g,property:/(\b|\B)[\w-]+(?=\s*:)/ig,string:/("|')(\\?.)*?\1/g,important:/\B!important\b/gi,ignore:/&(lt|gt|amp);/gi,punctuation:/[\{\};:]/g};Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{style:{pattern:/(<|<)style[\w\W]*?(>|>)[\w\W]*?(<|<)\/style(>|>)/ig,inside:{tag:{pattern:/(<|<)style[\w\W]*?(>|>)|(<|<)\/style(>|>)/ig,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.css}}});;
|
8 |
+
Prism.languages.clike={comment:{pattern:/(^|[^\\])(\/\*[\w\W]*?\*\/|(^|[^:])\/\/.*?(\r?\n|$))/g,lookbehind:!0},string:/("|')(\\?.)*?\1/g,"class-name":{pattern:/((?:(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/ig,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|catch|finally|null|break|continue)\b/g,"boolean":/\b(true|false)\b/g,"function":{pattern:/[a-z0-9_]+\(/ig,inside:{punctuation:/\(/}}, number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,operator:/[-+]{1,2}|!|<=?|>=?|={1,3}|(&){1,2}|\|?\||\?|\*|\/|\~|\^|\%/g,ignore:/&(lt|gt|amp);/gi,punctuation:/[{}[\];(),.:]/g};;
|
9 |
+
Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(var|let|if|else|while|do|for|return|in|instanceof|function|new|with|typeof|try|catch|finally|null|break|continue)\b/g,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?|NaN|-?Infinity)\b/g});Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/g,lookbehind:!0}});Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/(<|<)script[\w\W]*?(>|>)[\w\W]*?(<|<)\/script(>|>)/ig,inside:{tag:{pattern:/(<|<)script[\w\W]*?(>|>)|(<|<)\/script(>|>)/ig,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.javascript}}});;
|
assets/lib/chosen_v1.4.2/docsupport/style.css
ADDED
@@ -0,0 +1,204 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* Reset */
|
2 |
+
html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, abbr, address, cite, code, del, dfn, em, img, ins, kbd, q, samp, small, strong, sub, sup, var, b, i, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, figcaption, figure, footer, header, hgroup, menu, nav, section, summary, time, mark, audio, video { margin: 0; padding: 0; border: 0; font-size: 100%; font: inherit; vertical-align: baseline; }
|
3 |
+
|
4 |
+
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section { display: block; }
|
5 |
+
|
6 |
+
blockquote, q { quotes: none; }
|
7 |
+
blockquote:before, blockquote:after, q:before, q:after { content: ""; content: none; }
|
8 |
+
ins { background-color: #ff9; color: #000; text-decoration: none; }
|
9 |
+
mark { background-color: #ff9; color: #000; font-style: italic; font-weight: bold; }
|
10 |
+
del { text-decoration: line-through; }
|
11 |
+
abbr[title], dfn[title] { border-bottom: 1px dotted; cursor: help; }
|
12 |
+
table { border-collapse: collapse; border-spacing: 0; }
|
13 |
+
hr { display: block; height: 1px; border: 0; border-top: 1px solid #ccc; margin: 1em 0; padding: 0; }
|
14 |
+
input, select { vertical-align: middle; }
|
15 |
+
|
16 |
+
body { font:13px/1.231 sans-serif; *font-size:small; } /* Hack retained to preserve specificity */
|
17 |
+
select, input, textarea, button { font:99% sans-serif; }
|
18 |
+
pre, code, kbd, samp { font-family: monospace, sans-serif; }
|
19 |
+
|
20 |
+
|
21 |
+
body { background: #EEE; color: #444; line-height: 1.4em; }
|
22 |
+
|
23 |
+
header h1 { color: black; font-size: 2em; line-height: 1.1em; display: inline-block; height: 27px; margin: 20px 0 25px; }
|
24 |
+
header h1 small { font-size: 0.6em; }
|
25 |
+
|
26 |
+
div#content { background: white; border: 1px solid #ccc; border-width: 0 1px 1px; margin: 0 auto; padding: 40px 50px 40px; width: 738px; }
|
27 |
+
|
28 |
+
footer { color: #999; padding-top: 40px; font-size: 0.8em; text-align: center; }
|
29 |
+
|
30 |
+
body { font-family: sans-serif; font-size: 1em; }
|
31 |
+
|
32 |
+
p { margin: 0 0 .7em; max-width: 700px; }
|
33 |
+
table+p { margin-top: 1em; }
|
34 |
+
|
35 |
+
h2 { border-bottom: 1px solid #ccc; font-size: 1.2em; margin: 3em 0 1em 0; font-weight: bold;}
|
36 |
+
h3 { font-weight: bold; }
|
37 |
+
|
38 |
+
h2.intro { border-bottom: none; font-size: 1em; font-weight: normal; margin-top:0; }
|
39 |
+
|
40 |
+
ul li { list-style: disc; margin-left: 1em; margin-bottom: 1.25em; }
|
41 |
+
ol li { margin-left: 1.25em; }
|
42 |
+
ol ul, ul ul { margin: .25em 0 0; }
|
43 |
+
ol ul li, ul ul li { list-style-type: circle; margin: 0 0 .25em 1em; }
|
44 |
+
|
45 |
+
li > p { margin-top: .25em; }
|
46 |
+
|
47 |
+
div.side-by-side { width: 100%; margin-bottom: 1em; }
|
48 |
+
div.side-by-side > div { float: left; width: 49%; }
|
49 |
+
div.side-by-side > div > em { margin-bottom: 10px; display: block; }
|
50 |
+
|
51 |
+
.faqs em { display: block; }
|
52 |
+
|
53 |
+
.clearfix:after {
|
54 |
+
content: "\0020";
|
55 |
+
display: block;
|
56 |
+
height: 0;
|
57 |
+
clear: both;
|
58 |
+
overflow: hidden;
|
59 |
+
visibility: hidden;
|
60 |
+
}
|
61 |
+
|
62 |
+
a { color: #F36C00; outline: none; text-decoration: none; }
|
63 |
+
a:hover { text-decoration: underline; }
|
64 |
+
|
65 |
+
ul.credits li { margin-bottom: .25em; }
|
66 |
+
|
67 |
+
strong { font-weight: bold; }
|
68 |
+
i { font-style: italic; }
|
69 |
+
|
70 |
+
.button {
|
71 |
+
background: #fafafa;
|
72 |
+
background: -webkit-linear-gradient(top, #ffffff, #eeeeee);
|
73 |
+
background: -moz-linear-gradient(top, #ffffff, #eeeeee);
|
74 |
+
background: -o-linear-gradient(top, #ffffff, #eeeeee);
|
75 |
+
background: linear-gradient(to bottom, #ffffff, #eeeeee);
|
76 |
+
border: 1px solid #bbbbbb;
|
77 |
+
border-radius: 4px;
|
78 |
+
box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.2);
|
79 |
+
color: #555555;
|
80 |
+
cursor: pointer;
|
81 |
+
display: inline-block;
|
82 |
+
font-family: "Helvetica Neue", Arial, Verdana, "Nimbus Sans L", sans-serif;
|
83 |
+
font-size: 13px;
|
84 |
+
font-weight: 500;
|
85 |
+
height: 31px;
|
86 |
+
line-height: 28px;
|
87 |
+
outline: none;
|
88 |
+
padding: 0 13px;
|
89 |
+
text-shadow: 0 1px 0 white;
|
90 |
+
text-decoration: none;
|
91 |
+
vertical-align: middle;
|
92 |
+
white-space: nowrap;
|
93 |
+
-webkit-font-smoothing: antialiased;
|
94 |
+
-webkit-box-sizing: border-box;
|
95 |
+
-moz-box-sizing: border-box;
|
96 |
+
box-sizing: border-box;
|
97 |
+
}
|
98 |
+
|
99 |
+
.button-blue {
|
100 |
+
background: #1385e5;
|
101 |
+
background: -webkit-linear-gradient(top, #53b2fc, #1385e5);
|
102 |
+
background: -moz-linear-gradient(top, #53b2fc, #1385e5);
|
103 |
+
background: -o-linear-gradient(top, #53b2fc, #1385e5);
|
104 |
+
background: linear-gradient(to bottom, #53b2fc, #1385e5);
|
105 |
+
border-color: #075fa9;
|
106 |
+
color: white;
|
107 |
+
font-weight: bold;
|
108 |
+
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.4);
|
109 |
+
}
|
110 |
+
|
111 |
+
|
112 |
+
/* Tweak navbar brand link to be super sleek
|
113 |
+
-------------------------------------------------- */
|
114 |
+
.oss-bar {
|
115 |
+
top: 0;
|
116 |
+
right: 20px;
|
117 |
+
position: fixed;
|
118 |
+
z-index: 1030;
|
119 |
+
}
|
120 |
+
.oss-bar ul {
|
121 |
+
float: right;
|
122 |
+
margin: 0;
|
123 |
+
list-style: none;
|
124 |
+
}
|
125 |
+
.oss-bar ul li {
|
126 |
+
list-style: none;
|
127 |
+
float: left;
|
128 |
+
line-height: 0;
|
129 |
+
margin: 0;
|
130 |
+
}
|
131 |
+
.oss-bar ul li a {
|
132 |
+
-moz-box-sizing: border-box;
|
133 |
+
-webkit-box-sizing: border-box;
|
134 |
+
-ms-box-sizing: border-box;
|
135 |
+
box-sizing: border-box;
|
136 |
+
border: 0;
|
137 |
+
margin-top: -10px;
|
138 |
+
display: block;
|
139 |
+
height: 58px;
|
140 |
+
background: #F36C00 url(oss-credit.png) no-repeat 20px 22px;
|
141 |
+
padding: 22px 20px 12px 20px;
|
142 |
+
text-indent: 120%; /* stupid padding */
|
143 |
+
white-space: nowrap;
|
144 |
+
overflow: hidden;
|
145 |
+
-webkit-transition: all 0.10s ease-in-out;
|
146 |
+
-moz-transition: all 0.10s ease-in-out;
|
147 |
+
transition: all 0.15s ease-in-out;
|
148 |
+
}
|
149 |
+
.oss-bar ul li a:hover {
|
150 |
+
margin-top: 0px;
|
151 |
+
}
|
152 |
+
.oss-bar a.harvest {
|
153 |
+
width: 196px;
|
154 |
+
background-color: #F36C00;
|
155 |
+
background-position: -142px 22px;
|
156 |
+
padding-right: 22px; /* optical illusion */
|
157 |
+
}
|
158 |
+
.oss-bar a.fork {
|
159 |
+
width: 162px;
|
160 |
+
background-color: #333333;
|
161 |
+
}
|
162 |
+
|
163 |
+
.docs-table th, .docs-table td {
|
164 |
+
border: 1px solid #000;
|
165 |
+
padding: 4px 6px;
|
166 |
+
white-space: nowrap;
|
167 |
+
}
|
168 |
+
|
169 |
+
.docs-table td:last-child {
|
170 |
+
white-space: normal;
|
171 |
+
}
|
172 |
+
|
173 |
+
.docs-table th {
|
174 |
+
font-weight: bold;
|
175 |
+
text-align: left;
|
176 |
+
}
|
177 |
+
|
178 |
+
#content pre[class*=language-] {
|
179 |
+
font-size: 14px;
|
180 |
+
margin-bottom: 20px;
|
181 |
+
}
|
182 |
+
|
183 |
+
#content pre[class*=language-] code {
|
184 |
+
font-size: 14px;
|
185 |
+
padding: 0;
|
186 |
+
}
|
187 |
+
|
188 |
+
#content code[class*=language-] {
|
189 |
+
font-size: 12px;
|
190 |
+
padding: 2px 4px;
|
191 |
+
}
|
192 |
+
|
193 |
+
.anchor {
|
194 |
+
color: inherit;
|
195 |
+
position: relative;
|
196 |
+
}
|
197 |
+
|
198 |
+
.anchor:hover {
|
199 |
+
background: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSI3Ij48ZyBmaWxsPSIjNDE0MDQyIj48cGF0aCBkPSJNOS44IDdoLS45bC0uOS0uMWMtLjctLjMtMS40LS43LTEuOC0xLjMtLjItLjEtLjMtLjMtLjMtLjVsLS4zLS40Yy0uMS0uNC0uMi0uOC0uMi0xLjIgMC0uNC4xLS44LjItMS4yaDEuN2MtLjMuNC0uNC44LS40IDEuMiAwIC40LjEuOC4zIDEuMS4xLjIuMi4zLjQuNC4xLjEuMi4yLjQuMy4zLjIuNy4zIDEgLjNoMy40YzEuMiAwIDIuMi0uOSAyLjItMi4xcy0xLTIuMS0yLjItMi4xaC0xLjRjLS4zLS42LS43LTEtMS4yLTEuNGgyLjZjMiAwIDMuNiAxLjYgMy42IDMuNXMtMS42IDMuNS0zLjYgMy41aC0yLjZ6TTguNCAyYy0uMS0uMS0uMi0uMy0uNC0uMy0uMy0uMi0uNy0uMy0xLS4zaC0zLjRjLTEuMiAwLTIuMi45LTIuMiAyLjEgMCAxLjIgMSAyLjEgMi4yIDIuMWgxLjRjLjMuNS43IDEgMS4yIDEuNGgtMi42Yy0yIDAtMy42LTEuNi0zLjYtMy41czEuNi0zLjUgMy42LTMuNWgzLjUwMDAwMDAwMDAwMDAwMDRsLjkuMWMuNy4yIDEuNC43IDEuOCAxLjMuMS4xLjIuMy4zLjUuMS4xLjIuMy4yLjUuMS40LjIuOC4yIDEuMiAwIC40LS4xLjgtLjIgMS4yaC0xLjZjLjMtLjUuNC0uOS40LTEuM3MtLjEtLjgtLjMtMS4xYy0uMS0uMi0uMi0uMy0uNC0uNHoiLz48L2c+PC9zdmc+) 0 50% no-repeat;
|
200 |
+
background-size: 21px 9px;
|
201 |
+
margin-left: -27px;
|
202 |
+
padding-left: 27px;
|
203 |
+
text-decoration: none;
|
204 |
+
}
|
assets/lib/chosen_v1.4.2/index.html
ADDED
@@ -0,0 +1,1479 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!doctype html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="utf-8">
|
5 |
+
<title>Chosen: A jQuery Plugin by Harvest to Tame Unwieldy Select Boxes</title>
|
6 |
+
<link rel="stylesheet" href="docsupport/style.css">
|
7 |
+
<link rel="stylesheet" href="docsupport/prism.css">
|
8 |
+
<link rel="stylesheet" href="chosen.css">
|
9 |
+
<style type="text/css" media="all">
|
10 |
+
/* fix rtl for demo */
|
11 |
+
.chosen-rtl .chosen-drop { left: -9000px; }
|
12 |
+
</style>
|
13 |
+
</head>
|
14 |
+
<body>
|
15 |
+
<form>
|
16 |
+
<div id="container">
|
17 |
+
<div id="content">
|
18 |
+
<header>
|
19 |
+
<h1>Chosen <small>(<span id="latest-version">v1.4.2</span>)</small></h1>
|
20 |
+
</header>
|
21 |
+
<p>Chosen is a jQuery plugin that makes long, unwieldy select boxes much more user-friendly.</p>
|
22 |
+
|
23 |
+
<p>
|
24 |
+
<a class="button button-blue" href="https://github.com/harvesthq/chosen/releases">Downloads</a>
|
25 |
+
<a class="button" href="https://github.com/harvesthq/chosen">Project Source</a>
|
26 |
+
<a class="button" href="https://github.com/harvesthq/chosen/blob/master/contributing.md">Contribute</a>
|
27 |
+
</p>
|
28 |
+
|
29 |
+
<h2><a name="standard-select" class="anchor" href="#standard-select">Standard Select</a></h2>
|
30 |
+
<div class="side-by-side clearfix">
|
31 |
+
<div>
|
32 |
+
<em>Turns This</em>
|
33 |
+
<select data-placeholder="Choose a Country..." style="width:350px;" tabindex="1">
|
34 |
+
<option value=""></option>
|
35 |
+
<option value="United States">United States</option>
|
36 |
+
<option value="United Kingdom">United Kingdom</option>
|
37 |
+
<option value="Afghanistan">Afghanistan</option>
|
38 |
+
<option value="Aland Islands">Aland Islands</option>
|
39 |
+
<option value="Albania">Albania</option>
|
40 |
+
<option value="Algeria">Algeria</option>
|
41 |
+
<option value="American Samoa">American Samoa</option>
|
42 |
+
<option value="Andorra">Andorra</option>
|
43 |
+
<option value="Angola">Angola</option>
|
44 |
+
<option value="Anguilla">Anguilla</option>
|
45 |
+
<option value="Antarctica">Antarctica</option>
|
46 |
+
<option value="Antigua and Barbuda">Antigua and Barbuda</option>
|
47 |
+
<option value="Argentina">Argentina</option>
|
48 |
+
<option value="Armenia">Armenia</option>
|
49 |
+
<option value="Aruba">Aruba</option>
|
50 |
+
<option value="Australia">Australia</option>
|
51 |
+
<option value="Austria">Austria</option>
|
52 |
+
<option value="Azerbaijan">Azerbaijan</option>
|
53 |
+
<option value="Bahamas">Bahamas</option>
|
54 |
+
<option value="Bahrain">Bahrain</option>
|
55 |
+
<option value="Bangladesh">Bangladesh</option>
|
56 |
+
<option value="Barbados">Barbados</option>
|
57 |
+
<option value="Belarus">Belarus</option>
|
58 |
+
<option value="Belgium">Belgium</option>
|
59 |
+
<option value="Belize">Belize</option>
|
60 |
+
<option value="Benin">Benin</option>
|
61 |
+
<option value="Bermuda">Bermuda</option>
|
62 |
+
<option value="Bhutan">Bhutan</option>
|
63 |
+
<option value="Bolivia, Plurinational State of">Bolivia, Plurinational State of</option>
|
64 |
+
<option value="Bonaire, Sint Eustatius and Saba">Bonaire, Sint Eustatius and Saba</option>
|
65 |
+
<option value="Bosnia and Herzegovina">Bosnia and Herzegovina</option>
|
66 |
+
<option value="Botswana">Botswana</option>
|
67 |
+
<option value="Bouvet Island">Bouvet Island</option>
|
68 |
+
<option value="Brazil">Brazil</option>
|
69 |
+
<option value="British Indian Ocean Territory">British Indian Ocean Territory</option>
|
70 |
+
<option value="Brunei Darussalam">Brunei Darussalam</option>
|
71 |
+
<option value="Bulgaria">Bulgaria</option>
|
72 |
+
<option value="Burkina Faso">Burkina Faso</option>
|
73 |
+
<option value="Burundi">Burundi</option>
|
74 |
+
<option value="Cambodia">Cambodia</option>
|
75 |
+
<option value="Cameroon">Cameroon</option>
|
76 |
+
<option value="Canada">Canada</option>
|
77 |
+
<option value="Cape Verde">Cape Verde</option>
|
78 |
+
<option value="Cayman Islands">Cayman Islands</option>
|
79 |
+
<option value="Central African Republic">Central African Republic</option>
|
80 |
+
<option value="Chad">Chad</option>
|
81 |
+
<option value="Chile">Chile</option>
|
82 |
+
<option value="China">China</option>
|
83 |
+
<option value="Christmas Island">Christmas Island</option>
|
84 |
+
<option value="Cocos (Keeling) Islands">Cocos (Keeling) Islands</option>
|
85 |
+
<option value="Colombia">Colombia</option>
|
86 |
+
<option value="Comoros">Comoros</option>
|
87 |
+
<option value="Congo">Congo</option>
|
88 |
+
<option value="Congo, The Democratic Republic of The">Congo, The Democratic Republic of The</option>
|
89 |
+
<option value="Cook Islands">Cook Islands</option>
|
90 |
+
<option value="Costa Rica">Costa Rica</option>
|
91 |
+
<option value="Cote D'ivoire">Cote D'ivoire</option>
|
92 |
+
<option value="Croatia">Croatia</option>
|
93 |
+
<option value="Cuba">Cuba</option>
|
94 |
+
<option value="Curacao">Curacao</option>
|
95 |
+
<option value="Cyprus">Cyprus</option>
|
96 |
+
<option value="Czech Republic">Czech Republic</option>
|
97 |
+
<option value="Denmark">Denmark</option>
|
98 |
+
<option value="Djibouti">Djibouti</option>
|
99 |
+
<option value="Dominica">Dominica</option>
|
100 |
+
<option value="Dominican Republic">Dominican Republic</option>
|
101 |
+
<option value="Ecuador">Ecuador</option>
|
102 |
+
<option value="Egypt">Egypt</option>
|
103 |
+
<option value="El Salvador">El Salvador</option>
|
104 |
+
<option value="Equatorial Guinea">Equatorial Guinea</option>
|
105 |
+
<option value="Eritrea">Eritrea</option>
|
106 |
+
<option value="Estonia">Estonia</option>
|
107 |
+
<option value="Ethiopia">Ethiopia</option>
|
108 |
+
<option value="Falkland Islands (Malvinas)">Falkland Islands (Malvinas)</option>
|
109 |
+
<option value="Faroe Islands">Faroe Islands</option>
|
110 |
+
<option value="Fiji">Fiji</option>
|
111 |
+
<option value="Finland">Finland</option>
|
112 |
+
<option value="France">France</option>
|
113 |
+
<option value="French Guiana">French Guiana</option>
|
114 |
+
<option value="French Polynesia">French Polynesia</option>
|
115 |
+
<option value="French Southern Territories">French Southern Territories</option>
|
116 |
+
<option value="Gabon">Gabon</option>
|
117 |
+
<option value="Gambia">Gambia</option>
|
118 |
+
<option value="Georgia">Georgia</option>
|
119 |
+
<option value="Germany">Germany</option>
|
120 |
+
<option value="Ghana">Ghana</option>
|
121 |
+
<option value="Gibraltar">Gibraltar</option>
|
122 |
+
<option value="Greece">Greece</option>
|
123 |
+
<option value="Greenland">Greenland</option>
|
124 |
+
<option value="Grenada">Grenada</option>
|
125 |
+
<option value="Guadeloupe">Guadeloupe</option>
|
126 |
+
<option value="Guam">Guam</option>
|
127 |
+
<option value="Guatemala">Guatemala</option>
|
128 |
+
<option value="Guernsey">Guernsey</option>
|
129 |
+
<option value="Guinea">Guinea</option>
|
130 |
+
<option value="Guinea-bissau">Guinea-bissau</option>
|
131 |
+
<option value="Guyana">Guyana</option>
|
132 |
+
<option value="Haiti">Haiti</option>
|
133 |
+
<option value="Heard Island and Mcdonald Islands">Heard Island and Mcdonald Islands</option>
|
134 |
+
<option value="Holy See (Vatican City State)">Holy See (Vatican City State)</option>
|
135 |
+
<option value="Honduras">Honduras</option>
|
136 |
+
<option value="Hong Kong">Hong Kong</option>
|
137 |
+
<option value="Hungary">Hungary</option>
|
138 |
+
<option value="Iceland">Iceland</option>
|
139 |
+
<option value="India">India</option>
|
140 |
+
<option value="Indonesia">Indonesia</option>
|
141 |
+
<option value="Iran, Islamic Republic of">Iran, Islamic Republic of</option>
|
142 |
+
<option value="Iraq">Iraq</option>
|
143 |
+
<option value="Ireland">Ireland</option>
|
144 |
+
<option value="Isle of Man">Isle of Man</option>
|
145 |
+
<option value="Israel">Israel</option>
|
146 |
+
<option value="Italy">Italy</option>
|
147 |
+
<option value="Jamaica">Jamaica</option>
|
148 |
+
<option value="Japan">Japan</option>
|
149 |
+
<option value="Jersey">Jersey</option>
|
150 |
+
<option value="Jordan">Jordan</option>
|
151 |
+
<option value="Kazakhstan">Kazakhstan</option>
|
152 |
+
<option value="Kenya">Kenya</option>
|
153 |
+
<option value="Kiribati">Kiribati</option>
|
154 |
+
<option value="Korea, Democratic People's Republic of">Korea, Democratic People's Republic of</option>
|
155 |
+
<option value="Korea, Republic of">Korea, Republic of</option>
|
156 |
+
<option value="Kuwait">Kuwait</option>
|
157 |
+
<option value="Kyrgyzstan">Kyrgyzstan</option>
|
158 |
+
<option value="Lao People's Democratic Republic">Lao People's Democratic Republic</option>
|
159 |
+
<option value="Latvia">Latvia</option>
|
160 |
+
<option value="Lebanon">Lebanon</option>
|
161 |
+
<option value="Lesotho">Lesotho</option>
|
162 |
+
<option value="Liberia">Liberia</option>
|
163 |
+
<option value="Libya">Libya</option>
|
164 |
+
<option value="Liechtenstein">Liechtenstein</option>
|
165 |
+
<option value="Lithuania">Lithuania</option>
|
166 |
+
<option value="Luxembourg">Luxembourg</option>
|
167 |
+
<option value="Macao">Macao</option>
|
168 |
+
<option value="Macedonia, The Former Yugoslav Republic of">Macedonia, The Former Yugoslav Republic of</option>
|
169 |
+
<option value="Madagascar">Madagascar</option>
|
170 |
+
<option value="Malawi">Malawi</option>
|
171 |
+
<option value="Malaysia">Malaysia</option>
|
172 |
+
<option value="Maldives">Maldives</option>
|
173 |
+
<option value="Mali">Mali</option>
|
174 |
+
<option value="Malta">Malta</option>
|
175 |
+
<option value="Marshall Islands">Marshall Islands</option>
|
176 |
+
<option value="Martinique">Martinique</option>
|
177 |
+
<option value="Mauritania">Mauritania</option>
|
178 |
+
<option value="Mauritius">Mauritius</option>
|
179 |
+
<option value="Mayotte">Mayotte</option>
|
180 |
+
<option value="Mexico">Mexico</option>
|
181 |
+
<option value="Micronesia, Federated States of">Micronesia, Federated States of</option>
|
182 |
+
<option value="Moldova, Republic of">Moldova, Republic of</option>
|
183 |
+
<option value="Monaco">Monaco</option>
|
184 |
+
<option value="Mongolia">Mongolia</option>
|
185 |
+
<option value="Montenegro">Montenegro</option>
|
186 |
+
<option value="Montserrat">Montserrat</option>
|
187 |
+
<option value="Morocco">Morocco</option>
|
188 |
+
<option value="Mozambique">Mozambique</option>
|
189 |
+
<option value="Myanmar">Myanmar</option>
|
190 |
+
<option value="Namibia">Namibia</option>
|
191 |
+
<option value="Nauru">Nauru</option>
|
192 |
+
<option value="Nepal">Nepal</option>
|
193 |
+
<option value="Netherlands">Netherlands</option>
|
194 |
+
<option value="New Caledonia">New Caledonia</option>
|
195 |
+
<option value="New Zealand">New Zealand</option>
|
196 |
+
<option value="Nicaragua">Nicaragua</option>
|
197 |
+
<option value="Niger">Niger</option>
|
198 |
+
<option value="Nigeria">Nigeria</option>
|
199 |
+
<option value="Niue">Niue</option>
|
200 |
+
<option value="Norfolk Island">Norfolk Island</option>
|
201 |
+
<option value="Northern Mariana Islands">Northern Mariana Islands</option>
|
202 |
+
<option value="Norway">Norway</option>
|
203 |
+
<option value="Oman">Oman</option>
|
204 |
+
<option value="Pakistan">Pakistan</option>
|
205 |
+
<option value="Palau">Palau</option>
|
206 |
+
<option value="Palestinian Territory, Occupied">Palestinian Territory, Occupied</option>
|
207 |
+
<option value="Panama">Panama</option>
|
208 |
+
<option value="Papua New Guinea">Papua New Guinea</option>
|
209 |
+
<option value="Paraguay">Paraguay</option>
|
210 |
+
<option value="Peru">Peru</option>
|
211 |
+
<option value="Philippines">Philippines</option>
|
212 |
+
<option value="Pitcairn">Pitcairn</option>
|
213 |
+
<option value="Poland">Poland</option>
|
214 |
+
<option value="Portugal">Portugal</option>
|
215 |
+
<option value="Puerto Rico">Puerto Rico</option>
|
216 |
+
<option value="Qatar">Qatar</option>
|
217 |
+
<option value="Reunion">Reunion</option>
|
218 |
+
<option value="Romania">Romania</option>
|
219 |
+
<option value="Russian Federation">Russian Federation</option>
|
220 |
+
<option value="Rwanda">Rwanda</option>
|
221 |
+
<option value="Saint Barthelemy">Saint Barthelemy</option>
|
222 |
+
<option value="Saint Helena, Ascension and Tristan da Cunha">Saint Helena, Ascension and Tristan da Cunha</option>
|
223 |
+
<option value="Saint Kitts and Nevis">Saint Kitts and Nevis</option>
|
224 |
+
<option value="Saint Lucia">Saint Lucia</option>
|
225 |
+
<option value="Saint Martin (French part)">Saint Martin (French part)</option>
|
226 |
+
<option value="Saint Pierre and Miquelon">Saint Pierre and Miquelon</option>
|
227 |
+
<option value="Saint Vincent and The Grenadines">Saint Vincent and The Grenadines</option>
|
228 |
+
<option value="Samoa">Samoa</option>
|
229 |
+
<option value="San Marino">San Marino</option>
|
230 |
+
<option value="Sao Tome and Principe">Sao Tome and Principe</option>
|
231 |
+
<option value="Saudi Arabia">Saudi Arabia</option>
|
232 |
+
<option value="Senegal">Senegal</option>
|
233 |
+
<option value="Serbia">Serbia</option>
|
234 |
+
<option value="Seychelles">Seychelles</option>
|
235 |
+
<option value="Sierra Leone">Sierra Leone</option>
|
236 |
+
<option value="Singapore">Singapore</option>
|
237 |
+
<option value="Sint Maarten (Dutch part)">Sint Maarten (Dutch part)</option>
|
238 |
+
<option value="Slovakia">Slovakia</option>
|
239 |
+
<option value="Slovenia">Slovenia</option>
|
240 |
+
<option value="Solomon Islands">Solomon Islands</option>
|
241 |
+
<option value="Somalia">Somalia</option>
|
242 |
+
<option value="South Africa">South Africa</option>
|
243 |
+
<option value="South Georgia and The South Sandwich Islands">South Georgia and The South Sandwich Islands</option>
|
244 |
+
<option value="South Sudan">South Sudan</option>
|
245 |
+
<option value="Spain">Spain</option>
|
246 |
+
<option value="Sri Lanka">Sri Lanka</option>
|
247 |
+
<option value="Sudan">Sudan</option>
|
248 |
+
<option value="Suriname">Suriname</option>
|
249 |
+
<option value="Svalbard and Jan Mayen">Svalbard and Jan Mayen</option>
|
250 |
+
<option value="Swaziland">Swaziland</option>
|
251 |
+
<option value="Sweden">Sweden</option>
|
252 |
+
<option value="Switzerland">Switzerland</option>
|
253 |
+
<option value="Syrian Arab Republic">Syrian Arab Republic</option>
|
254 |
+
<option value="Taiwan, Province of China">Taiwan, Province of China</option>
|
255 |
+
<option value="Tajikistan">Tajikistan</option>
|
256 |
+
<option value="Tanzania, United Republic of">Tanzania, United Republic of</option>
|
257 |
+
<option value="Thailand">Thailand</option>
|
258 |
+
<option value="Timor-leste">Timor-leste</option>
|
259 |
+
<option value="Togo">Togo</option>
|
260 |
+
<option value="Tokelau">Tokelau</option>
|
261 |
+
<option value="Tonga">Tonga</option>
|
262 |
+
<option value="Trinidad and Tobago">Trinidad and Tobago</option>
|
263 |
+
<option value="Tunisia">Tunisia</option>
|
264 |
+
<option value="Turkey">Turkey</option>
|
265 |
+
<option value="Turkmenistan">Turkmenistan</option>
|
266 |
+
<option value="Turks and Caicos Islands">Turks and Caicos Islands</option>
|
267 |
+
<option value="Tuvalu">Tuvalu</option>
|
268 |
+
<option value="Uganda">Uganda</option>
|
269 |
+
<option value="Ukraine">Ukraine</option>
|
270 |
+
<option value="United Arab Emirates">United Arab Emirates</option>
|
271 |
+
<option value="United Kingdom">United Kingdom</option>
|
272 |
+
<option value="United States">United States</option>
|
273 |
+
<option value="United States Minor Outlying Islands">United States Minor Outlying Islands</option>
|
274 |
+
<option value="Uruguay">Uruguay</option>
|
275 |
+
<option value="Uzbekistan">Uzbekistan</option>
|
276 |
+
<option value="Vanuatu">Vanuatu</option>
|
277 |
+
<option value="Venezuela, Bolivarian Republic of">Venezuela, Bolivarian Republic of</option>
|
278 |
+
<option value="Viet Nam">Viet Nam</option>
|
279 |
+
<option value="Virgin Islands, British">Virgin Islands, British</option>
|
280 |
+
<option value="Virgin Islands, U.S.">Virgin Islands, U.S.</option>
|
281 |
+
<option value="Wallis and Futuna">Wallis and Futuna</option>
|
282 |
+
<option value="Western Sahara">Western Sahara</option>
|
283 |
+
<option value="Yemen">Yemen</option>
|
284 |
+
<option value="Zambia">Zambia</option>
|
285 |
+
<option value="Zimbabwe">Zimbabwe</option>
|
286 |
+
</select>
|
287 |
+
</div>
|
288 |
+
<div>
|
289 |
+
<em>Into This</em>
|
290 |
+
<select data-placeholder="Choose a Country..." class="chosen-select" style="width:350px;" tabindex="2">
|
291 |
+
<option value=""></option>
|
292 |
+
<option value="United States">United States</option>
|
293 |
+
<option value="United Kingdom">United Kingdom</option>
|
294 |
+
<option value="Afghanistan">Afghanistan</option>
|
295 |
+
<option value="Aland Islands">Aland Islands</option>
|
296 |
+
<option value="Albania">Albania</option>
|
297 |
+
<option value="Algeria">Algeria</option>
|
298 |
+
<option value="American Samoa">American Samoa</option>
|
299 |
+
<option value="Andorra">Andorra</option>
|
300 |
+
<option value="Angola">Angola</option>
|
301 |
+
<option value="Anguilla">Anguilla</option>
|
302 |
+
<option value="Antarctica">Antarctica</option>
|
303 |
+
<option value="Antigua and Barbuda">Antigua and Barbuda</option>
|
304 |
+
<option value="Argentina">Argentina</option>
|
305 |
+
<option value="Armenia">Armenia</option>
|
306 |
+
<option value="Aruba">Aruba</option>
|
307 |
+
<option value="Australia">Australia</option>
|
308 |
+
<option value="Austria">Austria</option>
|
309 |
+
<option value="Azerbaijan">Azerbaijan</option>
|
310 |
+
<option value="Bahamas">Bahamas</option>
|
311 |
+
<option value="Bahrain">Bahrain</option>
|
312 |
+
<option value="Bangladesh">Bangladesh</option>
|
313 |
+
<option value="Barbados">Barbados</option>
|
314 |
+
<option value="Belarus">Belarus</option>
|
315 |
+
<option value="Belgium">Belgium</option>
|
316 |
+
<option value="Belize">Belize</option>
|
317 |
+
<option value="Benin">Benin</option>
|
318 |
+
<option value="Bermuda">Bermuda</option>
|
319 |
+
<option value="Bhutan">Bhutan</option>
|
320 |
+
<option value="Bolivia, Plurinational State of">Bolivia, Plurinational State of</option>
|
321 |
+
<option value="Bonaire, Sint Eustatius and Saba">Bonaire, Sint Eustatius and Saba</option>
|
322 |
+
<option value="Bosnia and Herzegovina">Bosnia and Herzegovina</option>
|
323 |
+
<option value="Botswana">Botswana</option>
|
324 |
+
<option value="Bouvet Island">Bouvet Island</option>
|
325 |
+
<option value="Brazil">Brazil</option>
|
326 |
+
<option value="British Indian Ocean Territory">British Indian Ocean Territory</option>
|
327 |
+
<option value="Brunei Darussalam">Brunei Darussalam</option>
|
328 |
+
<option value="Bulgaria">Bulgaria</option>
|
329 |
+
<option value="Burkina Faso">Burkina Faso</option>
|
330 |
+
<option value="Burundi">Burundi</option>
|
331 |
+
<option value="Cambodia">Cambodia</option>
|
332 |
+
<option value="Cameroon">Cameroon</option>
|
333 |
+
<option value="Canada">Canada</option>
|
334 |
+
<option value="Cape Verde">Cape Verde</option>
|
335 |
+
<option value="Cayman Islands">Cayman Islands</option>
|
336 |
+
<option value="Central African Republic">Central African Republic</option>
|
337 |
+
<option value="Chad">Chad</option>
|
338 |
+
<option value="Chile">Chile</option>
|
339 |
+
<option value="China">China</option>
|
340 |
+
<option value="Christmas Island">Christmas Island</option>
|
341 |
+
<option value="Cocos (Keeling) Islands">Cocos (Keeling) Islands</option>
|
342 |
+
<option value="Colombia">Colombia</option>
|
343 |
+
<option value="Comoros">Comoros</option>
|
344 |
+
<option value="Congo">Congo</option>
|
345 |
+
<option value="Congo, The Democratic Republic of The">Congo, The Democratic Republic of The</option>
|
346 |
+
<option value="Cook Islands">Cook Islands</option>
|
347 |
+
<option value="Costa Rica">Costa Rica</option>
|
348 |
+
<option value="Cote D'ivoire">Cote D'ivoire</option>
|
349 |
+
<option value="Croatia">Croatia</option>
|
350 |
+
<option value="Cuba">Cuba</option>
|
351 |
+
<option value="Curacao">Curacao</option>
|
352 |
+
<option value="Cyprus">Cyprus</option>
|
353 |
+
<option value="Czech Republic">Czech Republic</option>
|
354 |
+
<option value="Denmark">Denmark</option>
|
355 |
+
<option value="Djibouti">Djibouti</option>
|
356 |
+
<option value="Dominica">Dominica</option>
|
357 |
+
<option value="Dominican Republic">Dominican Republic</option>
|
358 |
+
<option value="Ecuador">Ecuador</option>
|
359 |
+
<option value="Egypt">Egypt</option>
|
360 |
+
<option value="El Salvador">El Salvador</option>
|
361 |
+
<option value="Equatorial Guinea">Equatorial Guinea</option>
|
362 |
+
<option value="Eritrea">Eritrea</option>
|
363 |
+
<option value="Estonia">Estonia</option>
|
364 |
+
<option value="Ethiopia">Ethiopia</option>
|
365 |
+
<option value="Falkland Islands (Malvinas)">Falkland Islands (Malvinas)</option>
|
366 |
+
<option value="Faroe Islands">Faroe Islands</option>
|
367 |
+
<option value="Fiji">Fiji</option>
|
368 |
+
<option value="Finland">Finland</option>
|
369 |
+
<option value="France">France</option>
|
370 |
+
<option value="French Guiana">French Guiana</option>
|
371 |
+
<option value="French Polynesia">French Polynesia</option>
|
372 |
+
<option value="French Southern Territories">French Southern Territories</option>
|
373 |
+
<option value="Gabon">Gabon</option>
|
374 |
+
<option value="Gambia">Gambia</option>
|
375 |
+
<option value="Georgia">Georgia</option>
|
376 |
+
<option value="Germany">Germany</option>
|
377 |
+
<option value="Ghana">Ghana</option>
|
378 |
+
<option value="Gibraltar">Gibraltar</option>
|
379 |
+
<option value="Greece">Greece</option>
|
380 |
+
<option value="Greenland">Greenland</option>
|
381 |
+
<option value="Grenada">Grenada</option>
|
382 |
+
<option value="Guadeloupe">Guadeloupe</option>
|
383 |
+
<option value="Guam">Guam</option>
|
384 |
+
<option value="Guatemala">Guatemala</option>
|
385 |
+
<option value="Guernsey">Guernsey</option>
|
386 |
+
<option value="Guinea">Guinea</option>
|
387 |
+
<option value="Guinea-bissau">Guinea-bissau</option>
|
388 |
+
<option value="Guyana">Guyana</option>
|
389 |
+
<option value="Haiti">Haiti</option>
|
390 |
+
<option value="Heard Island and Mcdonald Islands">Heard Island and Mcdonald Islands</option>
|
391 |
+
<option value="Holy See (Vatican City State)">Holy See (Vatican City State)</option>
|
392 |
+
<option value="Honduras">Honduras</option>
|
393 |
+
<option value="Hong Kong">Hong Kong</option>
|
394 |
+
<option value="Hungary">Hungary</option>
|
395 |
+
<option value="Iceland">Iceland</option>
|
396 |
+
<option value="India">India</option>
|
397 |
+
<option value="Indonesia">Indonesia</option>
|
398 |
+
<option value="Iran, Islamic Republic of">Iran, Islamic Republic of</option>
|
399 |
+
<option value="Iraq">Iraq</option>
|
400 |
+
<option value="Ireland">Ireland</option>
|
401 |
+
<option value="Isle of Man">Isle of Man</option>
|
402 |
+
<option value="Israel">Israel</option>
|
403 |
+
<option value="Italy">Italy</option>
|
404 |
+
<option value="Jamaica">Jamaica</option>
|
405 |
+
<option value="Japan">Japan</option>
|
406 |
+
<option value="Jersey">Jersey</option>
|
407 |
+
<option value="Jordan">Jordan</option>
|
408 |
+
<option value="Kazakhstan">Kazakhstan</option>
|
409 |
+
<option value="Kenya">Kenya</option>
|
410 |
+
<option value="Kiribati">Kiribati</option>
|
411 |
+
<option value="Korea, Democratic People's Republic of">Korea, Democratic People's Republic of</option>
|
412 |
+
<option value="Korea, Republic of">Korea, Republic of</option>
|
413 |
+
<option value="Kuwait">Kuwait</option>
|
414 |
+
<option value="Kyrgyzstan">Kyrgyzstan</option>
|
415 |
+
<option value="Lao People's Democratic Republic">Lao People's Democratic Republic</option>
|
416 |
+
<option value="Latvia">Latvia</option>
|
417 |
+
<option value="Lebanon">Lebanon</option>
|
418 |
+
<option value="Lesotho">Lesotho</option>
|
419 |
+
<option value="Liberia">Liberia</option>
|
420 |
+
<option value="Libya">Libya</option>
|
421 |
+
<option value="Liechtenstein">Liechtenstein</option>
|
422 |
+
<option value="Lithuania">Lithuania</option>
|
423 |
+
<option value="Luxembourg">Luxembourg</option>
|
424 |
+
<option value="Macao">Macao</option>
|
425 |
+
<option value="Macedonia, The Former Yugoslav Republic of">Macedonia, The Former Yugoslav Republic of</option>
|
426 |
+
<option value="Madagascar">Madagascar</option>
|
427 |
+
<option value="Malawi">Malawi</option>
|
428 |
+
<option value="Malaysia">Malaysia</option>
|
429 |
+
<option value="Maldives">Maldives</option>
|
430 |
+
<option value="Mali">Mali</option>
|
431 |
+
<option value="Malta">Malta</option>
|
432 |
+
<option value="Marshall Islands">Marshall Islands</option>
|
433 |
+
<option value="Martinique">Martinique</option>
|
434 |
+
<option value="Mauritania">Mauritania</option>
|
435 |
+
<option value="Mauritius">Mauritius</option>
|
436 |
+
<option value="Mayotte">Mayotte</option>
|
437 |
+
<option value="Mexico">Mexico</option>
|
438 |
+
<option value="Micronesia, Federated States of">Micronesia, Federated States of</option>
|
439 |
+
<option value="Moldova, Republic of">Moldova, Republic of</option>
|
440 |
+
<option value="Monaco">Monaco</option>
|
441 |
+
<option value="Mongolia">Mongolia</option>
|
442 |
+
<option value="Montenegro">Montenegro</option>
|
443 |
+
<option value="Montserrat">Montserrat</option>
|
444 |
+
<option value="Morocco">Morocco</option>
|
445 |
+
<option value="Mozambique">Mozambique</option>
|
446 |
+
<option value="Myanmar">Myanmar</option>
|
447 |
+
<option value="Namibia">Namibia</option>
|
448 |
+
<option value="Nauru">Nauru</option>
|
449 |
+
<option value="Nepal">Nepal</option>
|
450 |
+
<option value="Netherlands">Netherlands</option>
|
451 |
+
<option value="New Caledonia">New Caledonia</option>
|
452 |
+
<option value="New Zealand">New Zealand</option>
|
453 |
+
<option value="Nicaragua">Nicaragua</option>
|
454 |
+
<option value="Niger">Niger</option>
|
455 |
+
<option value="Nigeria">Nigeria</option>
|
456 |
+
<option value="Niue">Niue</option>
|
457 |
+
<option value="Norfolk Island">Norfolk Island</option>
|
458 |
+
<option value="Northern Mariana Islands">Northern Mariana Islands</option>
|
459 |
+
<option value="Norway">Norway</option>
|
460 |
+
<option value="Oman">Oman</option>
|
461 |
+
<option value="Pakistan">Pakistan</option>
|
462 |
+
<option value="Palau">Palau</option>
|
463 |
+
<option value="Palestinian Territory, Occupied">Palestinian Territory, Occupied</option>
|
464 |
+
<option value="Panama">Panama</option>
|
465 |
+
<option value="Papua New Guinea">Papua New Guinea</option>
|
466 |
+
<option value="Paraguay">Paraguay</option>
|
467 |
+
<option value="Peru">Peru</option>
|
468 |
+
<option value="Philippines">Philippines</option>
|
469 |
+
<option value="Pitcairn">Pitcairn</option>
|
470 |
+
<option value="Poland">Poland</option>
|
471 |
+
<option value="Portugal">Portugal</option>
|
472 |
+
<option value="Puerto Rico">Puerto Rico</option>
|
473 |
+
<option value="Qatar">Qatar</option>
|
474 |
+
<option value="Reunion">Reunion</option>
|
475 |
+
<option value="Romania">Romania</option>
|
476 |
+
<option value="Russian Federation">Russian Federation</option>
|
477 |
+
<option value="Rwanda">Rwanda</option>
|
478 |
+
<option value="Saint Barthelemy">Saint Barthelemy</option>
|
479 |
+
<option value="Saint Helena, Ascension and Tristan da Cunha">Saint Helena, Ascension and Tristan da Cunha</option>
|
480 |
+
<option value="Saint Kitts and Nevis">Saint Kitts and Nevis</option>
|
481 |
+
<option value="Saint Lucia">Saint Lucia</option>
|
482 |
+
<option value="Saint Martin (French part)">Saint Martin (French part)</option>
|
483 |
+
<option value="Saint Pierre and Miquelon">Saint Pierre and Miquelon</option>
|
484 |
+
<option value="Saint Vincent and The Grenadines">Saint Vincent and The Grenadines</option>
|
485 |
+
<option value="Samoa">Samoa</option>
|
486 |
+
<option value="San Marino">San Marino</option>
|
487 |
+
<option value="Sao Tome and Principe">Sao Tome and Principe</option>
|
488 |
+
<option value="Saudi Arabia">Saudi Arabia</option>
|
489 |
+
<option value="Senegal">Senegal</option>
|
490 |
+
<option value="Serbia">Serbia</option>
|
491 |
+
<option value="Seychelles">Seychelles</option>
|
492 |
+
<option value="Sierra Leone">Sierra Leone</option>
|
493 |
+
<option value="Singapore">Singapore</option>
|
494 |
+
<option value="Sint Maarten (Dutch part)">Sint Maarten (Dutch part)</option>
|
495 |
+
<option value="Slovakia">Slovakia</option>
|
496 |
+
<option value="Slovenia">Slovenia</option>
|
497 |
+
<option value="Solomon Islands">Solomon Islands</option>
|
498 |
+
<option value="Somalia">Somalia</option>
|
499 |
+
<option value="South Africa">South Africa</option>
|
500 |
+
<option value="South Georgia and The South Sandwich Islands">South Georgia and The South Sandwich Islands</option>
|
501 |
+
<option value="South Sudan">South Sudan</option>
|
502 |
+
<option value="Spain">Spain</option>
|
503 |
+
<option value="Sri Lanka">Sri Lanka</option>
|
504 |
+
<option value="Sudan">Sudan</option>
|
505 |
+
<option value="Suriname">Suriname</option>
|
506 |
+
<option value="Svalbard and Jan Mayen">Svalbard and Jan Mayen</option>
|
507 |
+
<option value="Swaziland">Swaziland</option>
|
508 |
+
<option value="Sweden">Sweden</option>
|
509 |
+
<option value="Switzerland">Switzerland</option>
|
510 |
+
<option value="Syrian Arab Republic">Syrian Arab Republic</option>
|
511 |
+
<option value="Taiwan, Province of China">Taiwan, Province of China</option>
|
512 |
+
<option value="Tajikistan">Tajikistan</option>
|
513 |
+
<option value="Tanzania, United Republic of">Tanzania, United Republic of</option>
|
514 |
+
<option value="Thailand">Thailand</option>
|
515 |
+
<option value="Timor-leste">Timor-leste</option>
|
516 |
+
<option value="Togo">Togo</option>
|
517 |
+
<option value="Tokelau">Tokelau</option>
|
518 |
+
<option value="Tonga">Tonga</option>
|
519 |
+
<option value="Trinidad and Tobago">Trinidad and Tobago</option>
|
520 |
+
<option value="Tunisia">Tunisia</option>
|
521 |
+
<option value="Turkey">Turkey</option>
|
522 |
+
<option value="Turkmenistan">Turkmenistan</option>
|
523 |
+
<option value="Turks and Caicos Islands">Turks and Caicos Islands</option>
|
524 |
+
<option value="Tuvalu">Tuvalu</option>
|
525 |
+
<option value="Uganda">Uganda</option>
|
526 |
+
<option value="Ukraine">Ukraine</option>
|
527 |
+
<option value="United Arab Emirates">United Arab Emirates</option>
|
528 |
+
<option value="United Kingdom">United Kingdom</option>
|
529 |
+
<option value="United States">United States</option>
|
530 |
+
<option value="United States Minor Outlying Islands">United States Minor Outlying Islands</option>
|
531 |
+
<option value="Uruguay">Uruguay</option>
|
532 |
+
<option value="Uzbekistan">Uzbekistan</option>
|
533 |
+
<option value="Vanuatu">Vanuatu</option>
|
534 |
+
<option value="Venezuela, Bolivarian Republic of">Venezuela, Bolivarian Republic of</option>
|
535 |
+
<option value="Viet Nam">Viet Nam</option>
|
536 |
+
<option value="Virgin Islands, British">Virgin Islands, British</option>
|
537 |
+
<option value="Virgin Islands, U.S.">Virgin Islands, U.S.</option>
|
538 |
+
<option value="Wallis and Futuna">Wallis and Futuna</option>
|
539 |
+
<option value="Western Sahara">Western Sahara</option>
|
540 |
+
<option value="Yemen">Yemen</option>
|
541 |
+
<option value="Zambia">Zambia</option>
|
542 |
+
<option value="Zimbabwe">Zimbabwe</option>
|
543 |
+
</select>
|
544 |
+
</div>
|
545 |
+
</div>
|
546 |
+
|
547 |
+
<h2><a name="multiple-select" class="anchor" href="#multiple-select">Multiple Select</a></h2>
|
548 |
+
<div class="side-by-side clearfix">
|
549 |
+
<div>
|
550 |
+
<em>Turns This</em>
|
551 |
+
<select data-placeholder="Choose a Country..." style="width:350px;" multiple tabindex="3">
|
552 |
+
<option value=""></option>
|
553 |
+
<option value="United States">United States</option>
|
554 |
+
<option value="United Kingdom">United Kingdom</option>
|
555 |
+
<option value="Afghanistan">Afghanistan</option>
|
556 |
+
<option value="Aland Islands">Aland Islands</option>
|
557 |
+
<option value="Albania">Albania</option>
|
558 |
+
<option value="Algeria">Algeria</option>
|
559 |
+
<option value="American Samoa">American Samoa</option>
|
560 |
+
<option value="Andorra">Andorra</option>
|
561 |
+
<option value="Angola">Angola</option>
|
562 |
+
<option value="Anguilla">Anguilla</option>
|
563 |
+
<option value="Antarctica">Antarctica</option>
|
564 |
+
<option value="Antigua and Barbuda">Antigua and Barbuda</option>
|
565 |
+
<option value="Argentina">Argentina</option>
|
566 |
+
<option value="Armenia">Armenia</option>
|
567 |
+
<option value="Aruba">Aruba</option>
|
568 |
+
<option value="Australia">Australia</option>
|
569 |
+
<option value="Austria">Austria</option>
|
570 |
+
<option value="Azerbaijan">Azerbaijan</option>
|
571 |
+
<option value="Bahamas">Bahamas</option>
|
572 |
+
<option value="Bahrain">Bahrain</option>
|
573 |
+
<option value="Bangladesh">Bangladesh</option>
|
574 |
+
<option value="Barbados">Barbados</option>
|
575 |
+
<option value="Belarus">Belarus</option>
|
576 |
+
<option value="Belgium">Belgium</option>
|
577 |
+
<option value="Belize">Belize</option>
|
578 |
+
<option value="Benin">Benin</option>
|
579 |
+
<option value="Bermuda">Bermuda</option>
|
580 |
+
<option value="Bhutan">Bhutan</option>
|
581 |
+
<option value="Bolivia, Plurinational State of">Bolivia, Plurinational State of</option>
|
582 |
+
<option value="Bonaire, Sint Eustatius and Saba">Bonaire, Sint Eustatius and Saba</option>
|
583 |
+
<option value="Bosnia and Herzegovina">Bosnia and Herzegovina</option>
|
584 |
+
<option value="Botswana">Botswana</option>
|
585 |
+
<option value="Bouvet Island">Bouvet Island</option>
|
586 |
+
<option value="Brazil">Brazil</option>
|
587 |
+
<option value="British Indian Ocean Territory">British Indian Ocean Territory</option>
|
588 |
+
<option value="Brunei Darussalam">Brunei Darussalam</option>
|
589 |
+
<option value="Bulgaria">Bulgaria</option>
|
590 |
+
<option value="Burkina Faso">Burkina Faso</option>
|
591 |
+
<option value="Burundi">Burundi</option>
|
592 |
+
<option value="Cambodia">Cambodia</option>
|
593 |
+
<option value="Cameroon">Cameroon</option>
|
594 |
+
<option value="Canada">Canada</option>
|
595 |
+
<option value="Cape Verde">Cape Verde</option>
|
596 |
+
<option value="Cayman Islands">Cayman Islands</option>
|
597 |
+
<option value="Central African Republic">Central African Republic</option>
|
598 |
+
<option value="Chad">Chad</option>
|
599 |
+
<option value="Chile">Chile</option>
|
600 |
+
<option value="China">China</option>
|
601 |
+
<option value="Christmas Island">Christmas Island</option>
|
602 |
+
<option value="Cocos (Keeling) Islands">Cocos (Keeling) Islands</option>
|
603 |
+
<option value="Colombia">Colombia</option>
|
604 |
+
<option value="Comoros">Comoros</option>
|
605 |
+
<option value="Congo">Congo</option>
|
606 |
+
<option value="Congo, The Democratic Republic of The">Congo, The Democratic Republic of The</option>
|
607 |
+
<option value="Cook Islands">Cook Islands</option>
|
608 |
+
<option value="Costa Rica">Costa Rica</option>
|
609 |
+
<option value="Cote D'ivoire">Cote D'ivoire</option>
|
610 |
+
<option value="Croatia">Croatia</option>
|
611 |
+
<option value="Cuba">Cuba</option>
|
612 |
+
<option value="Curacao">Curacao</option>
|
613 |
+
<option value="Cyprus">Cyprus</option>
|
614 |
+
<option value="Czech Republic">Czech Republic</option>
|
615 |
+
<option value="Denmark">Denmark</option>
|
616 |
+
<option value="Djibouti">Djibouti</option>
|
617 |
+
<option value="Dominica">Dominica</option>
|
618 |
+
<option value="Dominican Republic">Dominican Republic</option>
|
619 |
+
<option value="Ecuador">Ecuador</option>
|
620 |
+
<option value="Egypt">Egypt</option>
|
621 |
+
<option value="El Salvador">El Salvador</option>
|
622 |
+
<option value="Equatorial Guinea">Equatorial Guinea</option>
|
623 |
+
<option value="Eritrea">Eritrea</option>
|
624 |
+
<option value="Estonia">Estonia</option>
|
625 |
+
<option value="Ethiopia">Ethiopia</option>
|
626 |
+
<option value="Falkland Islands (Malvinas)">Falkland Islands (Malvinas)</option>
|
627 |
+
<option value="Faroe Islands">Faroe Islands</option>
|
628 |
+
<option value="Fiji">Fiji</option>
|
629 |
+
<option value="Finland">Finland</option>
|
630 |
+
<option value="France">France</option>
|
631 |
+
<option value="French Guiana">French Guiana</option>
|
632 |
+
<option value="French Polynesia">French Polynesia</option>
|
633 |
+
<option value="French Southern Territories">French Southern Territories</option>
|
634 |
+
<option value="Gabon">Gabon</option>
|
635 |
+
<option value="Gambia">Gambia</option>
|
636 |
+
<option value="Georgia">Georgia</option>
|
637 |
+
<option value="Germany">Germany</option>
|
638 |
+
<option value="Ghana">Ghana</option>
|
639 |
+
<option value="Gibraltar">Gibraltar</option>
|
640 |
+
<option value="Greece">Greece</option>
|
641 |
+
<option value="Greenland">Greenland</option>
|
642 |
+
<option value="Grenada">Grenada</option>
|
643 |
+
<option value="Guadeloupe">Guadeloupe</option>
|
644 |
+
<option value="Guam">Guam</option>
|
645 |
+
<option value="Guatemala">Guatemala</option>
|
646 |
+
<option value="Guernsey">Guernsey</option>
|
647 |
+
<option value="Guinea">Guinea</option>
|
648 |
+
<option value="Guinea-bissau">Guinea-bissau</option>
|
649 |
+
<option value="Guyana">Guyana</option>
|
650 |
+
<option value="Haiti">Haiti</option>
|
651 |
+
<option value="Heard Island and Mcdonald Islands">Heard Island and Mcdonald Islands</option>
|
652 |
+
<option value="Holy See (Vatican City State)">Holy See (Vatican City State)</option>
|
653 |
+
<option value="Honduras">Honduras</option>
|
654 |
+
<option value="Hong Kong">Hong Kong</option>
|
655 |
+
<option value="Hungary">Hungary</option>
|
656 |
+
<option value="Iceland">Iceland</option>
|
657 |
+
<option value="India">India</option>
|
658 |
+
<option value="Indonesia">Indonesia</option>
|
659 |
+
<option value="Iran, Islamic Republic of">Iran, Islamic Republic of</option>
|
660 |
+
<option value="Iraq">Iraq</option>
|
661 |
+
<option value="Ireland">Ireland</option>
|
662 |
+
<option value="Isle of Man">Isle of Man</option>
|
663 |
+
<option value="Israel">Israel</option>
|
664 |
+
<option value="Italy">Italy</option>
|
665 |
+
<option value="Jamaica">Jamaica</option>
|
666 |
+
<option value="Japan">Japan</option>
|
667 |
+
<option value="Jersey">Jersey</option>
|
668 |
+
<option value="Jordan">Jordan</option>
|
669 |
+
<option value="Kazakhstan">Kazakhstan</option>
|
670 |
+
<option value="Kenya">Kenya</option>
|
671 |
+
<option value="Kiribati">Kiribati</option>
|
672 |
+
<option value="Korea, Democratic People's Republic of">Korea, Democratic People's Republic of</option>
|
673 |
+
<option value="Korea, Republic of">Korea, Republic of</option>
|
674 |
+
<option value="Kuwait">Kuwait</option>
|
675 |
+
<option value="Kyrgyzstan">Kyrgyzstan</option>
|
676 |
+
<option value="Lao People's Democratic Republic">Lao People's Democratic Republic</option>
|
677 |
+
<option value="Latvia">Latvia</option>
|
678 |
+
<option value="Lebanon">Lebanon</option>
|
679 |
+
<option value="Lesotho">Lesotho</option>
|
680 |
+
<option value="Liberia">Liberia</option>
|
681 |
+
<option value="Libya">Libya</option>
|
682 |
+
<option value="Liechtenstein">Liechtenstein</option>
|
683 |
+
<option value="Lithuania">Lithuania</option>
|
684 |
+
<option value="Luxembourg">Luxembourg</option>
|
685 |
+
<option value="Macao">Macao</option>
|
686 |
+
<option value="Macedonia, The Former Yugoslav Republic of">Macedonia, The Former Yugoslav Republic of</option>
|
687 |
+
<option value="Madagascar">Madagascar</option>
|
688 |
+
<option value="Malawi">Malawi</option>
|
689 |
+
<option value="Malaysia">Malaysia</option>
|
690 |
+
<option value="Maldives">Maldives</option>
|
691 |
+
<option value="Mali">Mali</option>
|
692 |
+
<option value="Malta">Malta</option>
|
693 |
+
<option value="Marshall Islands">Marshall Islands</option>
|
694 |
+
<option value="Martinique">Martinique</option>
|
695 |
+
<option value="Mauritania">Mauritania</option>
|
696 |
+
<option value="Mauritius">Mauritius</option>
|
697 |
+
<option value="Mayotte">Mayotte</option>
|
698 |
+
<option value="Mexico">Mexico</option>
|
699 |
+
<option value="Micronesia, Federated States of">Micronesia, Federated States of</option>
|
700 |
+
<option value="Moldova, Republic of">Moldova, Republic of</option>
|
701 |
+
<option value="Monaco">Monaco</option>
|
702 |
+
<option value="Mongolia">Mongolia</option>
|
703 |
+
<option value="Montenegro">Montenegro</option>
|
704 |
+
<option value="Montserrat">Montserrat</option>
|
705 |
+
<option value="Morocco">Morocco</option>
|
706 |
+
<option value="Mozambique">Mozambique</option>
|
707 |
+
<option value="Myanmar">Myanmar</option>
|
708 |
+
<option value="Namibia">Namibia</option>
|
709 |
+
<option value="Nauru">Nauru</option>
|
710 |
+
<option value="Nepal">Nepal</option>
|
711 |
+
<option value="Netherlands">Netherlands</option>
|
712 |
+
<option value="New Caledonia">New Caledonia</option>
|
713 |
+
<option value="New Zealand">New Zealand</option>
|
714 |
+
<option value="Nicaragua">Nicaragua</option>
|
715 |
+
<option value="Niger">Niger</option>
|
716 |
+
<option value="Nigeria">Nigeria</option>
|
717 |
+
<option value="Niue">Niue</option>
|
718 |
+
<option value="Norfolk Island">Norfolk Island</option>
|
719 |
+
<option value="Northern Mariana Islands">Northern Mariana Islands</option>
|
720 |
+
<option value="Norway">Norway</option>
|
721 |
+
<option value="Oman">Oman</option>
|
722 |
+
<option value="Pakistan">Pakistan</option>
|
723 |
+
<option value="Palau">Palau</option>
|
724 |
+
<option value="Palestinian Territory, Occupied">Palestinian Territory, Occupied</option>
|
725 |
+
<option value="Panama">Panama</option>
|
726 |
+
<option value="Papua New Guinea">Papua New Guinea</option>
|
727 |
+
<option value="Paraguay">Paraguay</option>
|
728 |
+
<option value="Peru">Peru</option>
|
729 |
+
<option value="Philippines">Philippines</option>
|
730 |
+
<option value="Pitcairn">Pitcairn</option>
|
731 |
+
<option value="Poland">Poland</option>
|
732 |
+
<option value="Portugal">Portugal</option>
|
733 |
+
<option value="Puerto Rico">Puerto Rico</option>
|
734 |
+
<option value="Qatar">Qatar</option>
|
735 |
+
<option value="Reunion">Reunion</option>
|
736 |
+
<option value="Romania">Romania</option>
|
737 |
+
<option value="Russian Federation">Russian Federation</option>
|
738 |
+
<option value="Rwanda">Rwanda</option>
|
739 |
+
<option value="Saint Barthelemy">Saint Barthelemy</option>
|
740 |
+
<option value="Saint Helena, Ascension and Tristan da Cunha">Saint Helena, Ascension and Tristan da Cunha</option>
|
741 |
+
<option value="Saint Kitts and Nevis">Saint Kitts and Nevis</option>
|
742 |
+
<option value="Saint Lucia">Saint Lucia</option>
|
743 |
+
<option value="Saint Martin (French part)">Saint Martin (French part)</option>
|
744 |
+
<option value="Saint Pierre and Miquelon">Saint Pierre and Miquelon</option>
|
745 |
+
<option value="Saint Vincent and The Grenadines">Saint Vincent and The Grenadines</option>
|
746 |
+
<option value="Samoa">Samoa</option>
|
747 |
+
<option value="San Marino">San Marino</option>
|
748 |
+
<option value="Sao Tome and Principe">Sao Tome and Principe</option>
|
749 |
+
<option value="Saudi Arabia">Saudi Arabia</option>
|
750 |
+
<option value="Senegal">Senegal</option>
|
751 |
+
<option value="Serbia">Serbia</option>
|
752 |
+
<option value="Seychelles">Seychelles</option>
|
753 |
+
<option value="Sierra Leone">Sierra Leone</option>
|
754 |
+
<option value="Singapore">Singapore</option>
|
755 |
+
<option value="Sint Maarten (Dutch part)">Sint Maarten (Dutch part)</option>
|
756 |
+
<option value="Slovakia">Slovakia</option>
|
757 |
+
<option value="Slovenia">Slovenia</option>
|
758 |
+
<option value="Solomon Islands">Solomon Islands</option>
|
759 |
+
<option value="Somalia">Somalia</option>
|
760 |
+
<option value="South Africa">South Africa</option>
|
761 |
+
<option value="South Georgia and The South Sandwich Islands">South Georgia and The South Sandwich Islands</option>
|
762 |
+
<option value="South Sudan">South Sudan</option>
|
763 |
+
<option value="Spain">Spain</option>
|
764 |
+
<option value="Sri Lanka">Sri Lanka</option>
|
765 |
+
<option value="Sudan">Sudan</option>
|
766 |
+
<option value="Suriname">Suriname</option>
|
767 |
+
<option value="Svalbard and Jan Mayen">Svalbard and Jan Mayen</option>
|
768 |
+
<option value="Swaziland">Swaziland</option>
|
769 |
+
<option value="Sweden">Sweden</option>
|
770 |
+
<option value="Switzerland">Switzerland</option>
|
771 |
+
<option value="Syrian Arab Republic">Syrian Arab Republic</option>
|
772 |
+
<option value="Taiwan, Province of China">Taiwan, Province of China</option>
|
773 |
+
<option value="Tajikistan">Tajikistan</option>
|
774 |
+
<option value="Tanzania, United Republic of">Tanzania, United Republic of</option>
|
775 |
+
<option value="Thailand">Thailand</option>
|
776 |
+
<option value="Timor-leste">Timor-leste</option>
|
777 |
+
<option value="Togo">Togo</option>
|
778 |
+
<option value="Tokelau">Tokelau</option>
|
779 |
+
<option value="Tonga">Tonga</option>
|
780 |
+
<option value="Trinidad and Tobago">Trinidad and Tobago</option>
|
781 |
+
<option value="Tunisia">Tunisia</option>
|
782 |
+
<option value="Turkey">Turkey</option>
|
783 |
+
<option value="Turkmenistan">Turkmenistan</option>
|
784 |
+
<option value="Turks and Caicos Islands">Turks and Caicos Islands</option>
|
785 |
+
<option value="Tuvalu">Tuvalu</option>
|
786 |
+
<option value="Uganda">Uganda</option>
|
787 |
+
<option value="Ukraine">Ukraine</option>
|
788 |
+
<option value="United Arab Emirates">United Arab Emirates</option>
|
789 |
+
<option value="United Kingdom">United Kingdom</option>
|
790 |
+
<option value="United States">United States</option>
|
791 |
+
<option value="United States Minor Outlying Islands">United States Minor Outlying Islands</option>
|
792 |
+
<option value="Uruguay">Uruguay</option>
|
793 |
+
<option value="Uzbekistan">Uzbekistan</option>
|
794 |
+
<option value="Vanuatu">Vanuatu</option>
|
795 |
+
<option value="Venezuela, Bolivarian Republic of">Venezuela, Bolivarian Republic of</option>
|
796 |
+
<option value="Viet Nam">Viet Nam</option>
|
797 |
+
<option value="Virgin Islands, British">Virgin Islands, British</option>
|
798 |
+
<option value="Virgin Islands, U.S.">Virgin Islands, U.S.</option>
|
799 |
+
<option value="Wallis and Futuna">Wallis and Futuna</option>
|
800 |
+
<option value="Western Sahara">Western Sahara</option>
|
801 |
+
<option value="Yemen">Yemen</option>
|
802 |
+
<option value="Zambia">Zambia</option>
|
803 |
+
<option value="Zimbabwe">Zimbabwe</option>
|
804 |
+
</select>
|
805 |
+
</div>
|
806 |
+
<div>
|
807 |
+
<em>Into This</em>
|
808 |
+
<select data-placeholder="Choose a Country..." class="chosen-select" multiple style="width:350px;" tabindex="4">
|
809 |
+
<option value=""></option>
|
810 |
+
<option value="United States">United States</option>
|
811 |
+
<option value="United Kingdom">United Kingdom</option>
|
812 |
+
<option value="Afghanistan">Afghanistan</option>
|
813 |
+
<option value="Aland Islands">Aland Islands</option>
|
814 |
+
<option value="Albania">Albania</option>
|
815 |
+
<option value="Algeria">Algeria</option>
|
816 |
+
<option value="American Samoa">American Samoa</option>
|
817 |
+
<option value="Andorra">Andorra</option>
|
818 |
+
<option value="Angola">Angola</option>
|
819 |
+
<option value="Anguilla">Anguilla</option>
|
820 |
+
<option value="Antarctica">Antarctica</option>
|
821 |
+
<option value="Antigua and Barbuda">Antigua and Barbuda</option>
|
822 |
+
<option value="Argentina">Argentina</option>
|
823 |
+
<option value="Armenia">Armenia</option>
|
824 |
+
<option value="Aruba">Aruba</option>
|
825 |
+
<option value="Australia">Australia</option>
|
826 |
+
<option value="Austria">Austria</option>
|
827 |
+
<option value="Azerbaijan">Azerbaijan</option>
|
828 |
+
<option value="Bahamas">Bahamas</option>
|
829 |
+
<option value="Bahrain">Bahrain</option>
|
830 |
+
<option value="Bangladesh">Bangladesh</option>
|
831 |
+
<option value="Barbados">Barbados</option>
|
832 |
+
<option value="Belarus">Belarus</option>
|
833 |
+
<option value="Belgium">Belgium</option>
|
834 |
+
<option value="Belize">Belize</option>
|
835 |
+
<option value="Benin">Benin</option>
|
836 |
+
<option value="Bermuda">Bermuda</option>
|
837 |
+
<option value="Bhutan">Bhutan</option>
|
838 |
+
<option value="Bolivia, Plurinational State of">Bolivia, Plurinational State of</option>
|
839 |
+
<option value="Bonaire, Sint Eustatius and Saba">Bonaire, Sint Eustatius and Saba</option>
|
840 |
+
<option value="Bosnia and Herzegovina">Bosnia and Herzegovina</option>
|
841 |
+
<option value="Botswana">Botswana</option>
|
842 |
+
<option value="Bouvet Island">Bouvet Island</option>
|
843 |
+
<option value="Brazil">Brazil</option>
|
844 |
+
<option value="British Indian Ocean Territory">British Indian Ocean Territory</option>
|
845 |
+
<option value="Brunei Darussalam">Brunei Darussalam</option>
|
846 |
+
<option value="Bulgaria">Bulgaria</option>
|
847 |
+
<option value="Burkina Faso">Burkina Faso</option>
|
848 |
+
<option value="Burundi">Burundi</option>
|
849 |
+
<option value="Cambodia">Cambodia</option>
|
850 |
+
<option value="Cameroon">Cameroon</option>
|
851 |
+
<option value="Canada">Canada</option>
|
852 |
+
<option value="Cape Verde">Cape Verde</option>
|
853 |
+
<option value="Cayman Islands">Cayman Islands</option>
|
854 |
+
<option value="Central African Republic">Central African Republic</option>
|
855 |
+
<option value="Chad">Chad</option>
|
856 |
+
<option value="Chile">Chile</option>
|
857 |
+
<option value="China">China</option>
|
858 |
+
<option value="Christmas Island">Christmas Island</option>
|
859 |
+
<option value="Cocos (Keeling) Islands">Cocos (Keeling) Islands</option>
|
860 |
+
<option value="Colombia">Colombia</option>
|
861 |
+
<option value="Comoros">Comoros</option>
|
862 |
+
<option value="Congo">Congo</option>
|
863 |
+
<option value="Congo, The Democratic Republic of The">Congo, The Democratic Republic of The</option>
|
864 |
+
<option value="Cook Islands">Cook Islands</option>
|
865 |
+
<option value="Costa Rica">Costa Rica</option>
|
866 |
+
<option value="Cote D'ivoire">Cote D'ivoire</option>
|
867 |
+
<option value="Croatia">Croatia</option>
|
868 |
+
<option value="Cuba">Cuba</option>
|
869 |
+
<option value="Curacao">Curacao</option>
|
870 |
+
<option value="Cyprus">Cyprus</option>
|
871 |
+
<option value="Czech Republic">Czech Republic</option>
|
872 |
+
<option value="Denmark">Denmark</option>
|
873 |
+
<option value="Djibouti">Djibouti</option>
|
874 |
+
<option value="Dominica">Dominica</option>
|
875 |
+
<option value="Dominican Republic">Dominican Republic</option>
|
876 |
+
<option value="Ecuador">Ecuador</option>
|
877 |
+
<option value="Egypt">Egypt</option>
|
878 |
+
<option value="El Salvador">El Salvador</option>
|
879 |
+
<option value="Equatorial Guinea">Equatorial Guinea</option>
|
880 |
+
<option value="Eritrea">Eritrea</option>
|
881 |
+
<option value="Estonia">Estonia</option>
|
882 |
+
<option value="Ethiopia">Ethiopia</option>
|
883 |
+
<option value="Falkland Islands (Malvinas)">Falkland Islands (Malvinas)</option>
|
884 |
+
<option value="Faroe Islands">Faroe Islands</option>
|
885 |
+
<option value="Fiji">Fiji</option>
|
886 |
+
<option value="Finland">Finland</option>
|
887 |
+
<option value="France">France</option>
|
888 |
+
<option value="French Guiana">French Guiana</option>
|
889 |
+
<option value="French Polynesia">French Polynesia</option>
|
890 |
+
<option value="French Southern Territories">French Southern Territories</option>
|
891 |
+
<option value="Gabon">Gabon</option>
|
892 |
+
<option value="Gambia">Gambia</option>
|
893 |
+
<option value="Georgia">Georgia</option>
|
894 |
+
<option value="Germany">Germany</option>
|
895 |
+
<option value="Ghana">Ghana</option>
|
896 |
+
<option value="Gibraltar">Gibraltar</option>
|
897 |
+
<option value="Greece">Greece</option>
|
898 |
+
<option value="Greenland">Greenland</option>
|
899 |
+
<option value="Grenada">Grenada</option>
|
900 |
+
<option value="Guadeloupe">Guadeloupe</option>
|
901 |
+
<option value="Guam">Guam</option>
|
902 |
+
<option value="Guatemala">Guatemala</option>
|
903 |
+
<option value="Guernsey">Guernsey</option>
|
904 |
+
<option value="Guinea">Guinea</option>
|
905 |
+
<option value="Guinea-bissau">Guinea-bissau</option>
|
906 |
+
<option value="Guyana">Guyana</option>
|
907 |
+
<option value="Haiti">Haiti</option>
|
908 |
+
<option value="Heard Island and Mcdonald Islands">Heard Island and Mcdonald Islands</option>
|
909 |
+
<option value="Holy See (Vatican City State)">Holy See (Vatican City State)</option>
|
910 |
+
<option value="Honduras">Honduras</option>
|
911 |
+
<option value="Hong Kong">Hong Kong</option>
|
912 |
+
<option value="Hungary">Hungary</option>
|
913 |
+
<option value="Iceland">Iceland</option>
|
914 |
+
<option value="India">India</option>
|
915 |
+
<option value="Indonesia">Indonesia</option>
|
916 |
+
<option value="Iran, Islamic Republic of">Iran, Islamic Republic of</option>
|
917 |
+
<option value="Iraq">Iraq</option>
|
918 |
+
<option value="Ireland">Ireland</option>
|
919 |
+
<option value="Isle of Man">Isle of Man</option>
|
920 |
+
<option value="Israel">Israel</option>
|
921 |
+
<option value="Italy">Italy</option>
|
922 |
+
<option value="Jamaica">Jamaica</option>
|
923 |
+
<option value="Japan">Japan</option>
|
924 |
+
<option value="Jersey">Jersey</option>
|
925 |
+
<option value="Jordan">Jordan</option>
|
926 |
+
<option value="Kazakhstan">Kazakhstan</option>
|
927 |
+
<option value="Kenya">Kenya</option>
|
928 |
+
<option value="Kiribati">Kiribati</option>
|
929 |
+
<option value="Korea, Democratic People's Republic of">Korea, Democratic People's Republic of</option>
|
930 |
+
<option value="Korea, Republic of">Korea, Republic of</option>
|
931 |
+
<option value="Kuwait">Kuwait</option>
|
932 |
+
<option value="Kyrgyzstan">Kyrgyzstan</option>
|
933 |
+
<option value="Lao People's Democratic Republic">Lao People's Democratic Republic</option>
|
934 |
+
<option value="Latvia">Latvia</option>
|
935 |
+
<option value="Lebanon">Lebanon</option>
|
936 |
+
<option value="Lesotho">Lesotho</option>
|
937 |
+
<option value="Liberia">Liberia</option>
|
938 |
+
<option value="Libya">Libya</option>
|
939 |
+
<option value="Liechtenstein">Liechtenstein</option>
|
940 |
+
<option value="Lithuania">Lithuania</option>
|
941 |
+
<option value="Luxembourg">Luxembourg</option>
|
942 |
+
<option value="Macao">Macao</option>
|
943 |
+
<option value="Macedonia, The Former Yugoslav Republic of">Macedonia, The Former Yugoslav Republic of</option>
|
944 |
+
<option value="Madagascar">Madagascar</option>
|
945 |
+
<option value="Malawi">Malawi</option>
|
946 |
+
<option value="Malaysia">Malaysia</option>
|
947 |
+
<option value="Maldives">Maldives</option>
|
948 |
+
<option value="Mali">Mali</option>
|
949 |
+
<option value="Malta">Malta</option>
|
950 |
+
<option value="Marshall Islands">Marshall Islands</option>
|
951 |
+
<option value="Martinique">Martinique</option>
|
952 |
+
<option value="Mauritania">Mauritania</option>
|
953 |
+
<option value="Mauritius">Mauritius</option>
|
954 |
+
<option value="Mayotte">Mayotte</option>
|
955 |
+
<option value="Mexico">Mexico</option>
|
956 |
+
<option value="Micronesia, Federated States of">Micronesia, Federated States of</option>
|
957 |
+
<option value="Moldova, Republic of">Moldova, Republic of</option>
|
958 |
+
<option value="Monaco">Monaco</option>
|
959 |
+
<option value="Mongolia">Mongolia</option>
|
960 |
+
<option value="Montenegro">Montenegro</option>
|
961 |
+
<option value="Montserrat">Montserrat</option>
|
962 |
+
<option value="Morocco">Morocco</option>
|
963 |
+
<option value="Mozambique">Mozambique</option>
|
964 |
+
<option value="Myanmar">Myanmar</option>
|
965 |
+
<option value="Namibia">Namibia</option>
|
966 |
+
<option value="Nauru">Nauru</option>
|
967 |
+
<option value="Nepal">Nepal</option>
|
968 |
+
<option value="Netherlands">Netherlands</option>
|
969 |
+
<option value="New Caledonia">New Caledonia</option>
|
970 |
+
<option value="New Zealand">New Zealand</option>
|
971 |
+
<option value="Nicaragua">Nicaragua</option>
|
972 |
+
<option value="Niger">Niger</option>
|
973 |
+
<option value="Nigeria">Nigeria</option>
|
974 |
+
<option value="Niue">Niue</option>
|
975 |
+
<option value="Norfolk Island">Norfolk Island</option>
|
976 |
+
<option value="Northern Mariana Islands">Northern Mariana Islands</option>
|
977 |
+
<option value="Norway">Norway</option>
|
978 |
+
<option value="Oman">Oman</option>
|
979 |
+
<option value="Pakistan">Pakistan</option>
|
980 |
+
<option value="Palau">Palau</option>
|
981 |
+
<option value="Palestinian Territory, Occupied">Palestinian Territory, Occupied</option>
|
982 |
+
<option value="Panama">Panama</option>
|
983 |
+
<option value="Papua New Guinea">Papua New Guinea</option>
|
984 |
+
<option value="Paraguay">Paraguay</option>
|
985 |
+
<option value="Peru">Peru</option>
|
986 |
+
<option value="Philippines">Philippines</option>
|
987 |
+
<option value="Pitcairn">Pitcairn</option>
|
988 |
+
<option value="Poland">Poland</option>
|
989 |
+
<option value="Portugal">Portugal</option>
|
990 |
+
<option value="Puerto Rico">Puerto Rico</option>
|
991 |
+
<option value="Qatar">Qatar</option>
|
992 |
+
<option value="Reunion">Reunion</option>
|
993 |
+
<option value="Romania">Romania</option>
|
994 |
+
<option value="Russian Federation">Russian Federation</option>
|
995 |
+
<option value="Rwanda">Rwanda</option>
|
996 |
+
<option value="Saint Barthelemy">Saint Barthelemy</option>
|
997 |
+
<option value="Saint Helena, Ascension and Tristan da Cunha">Saint Helena, Ascension and Tristan da Cunha</option>
|
998 |
+
<option value="Saint Kitts and Nevis">Saint Kitts and Nevis</option>
|
999 |
+
<option value="Saint Lucia">Saint Lucia</option>
|
1000 |
+
<option value="Saint Martin (French part)">Saint Martin (French part)</option>
|
1001 |
+
<option value="Saint Pierre and Miquelon">Saint Pierre and Miquelon</option>
|
1002 |
+
<option value="Saint Vincent and The Grenadines">Saint Vincent and The Grenadines</option>
|
1003 |
+
<option value="Samoa">Samoa</option>
|
1004 |
+
<option value="San Marino">San Marino</option>
|
1005 |
+
<option value="Sao Tome and Principe">Sao Tome and Principe</option>
|
1006 |
+
<option value="Saudi Arabia">Saudi Arabia</option>
|
1007 |
+
<option value="Senegal">Senegal</option>
|
1008 |
+
<option value="Serbia">Serbia</option>
|
1009 |
+
<option value="Seychelles">Seychelles</option>
|
1010 |
+
<option value="Sierra Leone">Sierra Leone</option>
|
1011 |
+
<option value="Singapore">Singapore</option>
|
1012 |
+
<option value="Sint Maarten (Dutch part)">Sint Maarten (Dutch part)</option>
|
1013 |
+
<option value="Slovakia">Slovakia</option>
|
1014 |
+
<option value="Slovenia">Slovenia</option>
|
1015 |
+
<option value="Solomon Islands">Solomon Islands</option>
|
1016 |
+
<option value="Somalia">Somalia</option>
|
1017 |
+
<option value="South Africa">South Africa</option>
|
1018 |
+
<option value="South Georgia and The South Sandwich Islands">South Georgia and The South Sandwich Islands</option>
|
1019 |
+
<option value="South Sudan">South Sudan</option>
|
1020 |
+
<option value="Spain">Spain</option>
|
1021 |
+
<option value="Sri Lanka">Sri Lanka</option>
|
1022 |
+
<option value="Sudan">Sudan</option>
|
1023 |
+
<option value="Suriname">Suriname</option>
|
1024 |
+
<option value="Svalbard and Jan Mayen">Svalbard and Jan Mayen</option>
|
1025 |
+
<option value="Swaziland">Swaziland</option>
|
1026 |
+
<option value="Sweden">Sweden</option>
|
1027 |
+
<option value="Switzerland">Switzerland</option>
|
1028 |
+
<option value="Syrian Arab Republic">Syrian Arab Republic</option>
|
1029 |
+
<option value="Taiwan, Province of China">Taiwan, Province of China</option>
|
1030 |
+
<option value="Tajikistan">Tajikistan</option>
|
1031 |
+
<option value="Tanzania, United Republic of">Tanzania, United Republic of</option>
|
1032 |
+
<option value="Thailand">Thailand</option>
|
1033 |
+
<option value="Timor-leste">Timor-leste</option>
|
1034 |
+
<option value="Togo">Togo</option>
|
1035 |
+
<option value="Tokelau">Tokelau</option>
|
1036 |
+
<option value="Tonga">Tonga</option>
|
1037 |
+
<option value="Trinidad and Tobago">Trinidad and Tobago</option>
|
1038 |
+
<option value="Tunisia">Tunisia</option>
|
1039 |
+
<option value="Turkey">Turkey</option>
|
1040 |
+
<option value="Turkmenistan">Turkmenistan</option>
|
1041 |
+
<option value="Turks and Caicos Islands">Turks and Caicos Islands</option>
|
1042 |
+
<option value="Tuvalu">Tuvalu</option>
|
1043 |
+
<option value="Uganda">Uganda</option>
|
1044 |
+
<option value="Ukraine">Ukraine</option>
|
1045 |
+
<option value="United Arab Emirates">United Arab Emirates</option>
|
1046 |
+
<option value="United Kingdom">United Kingdom</option>
|
1047 |
+
<option value="United States">United States</option>
|
1048 |
+
<option value="United States Minor Outlying Islands">United States Minor Outlying Islands</option>
|
1049 |
+
<option value="Uruguay">Uruguay</option>
|
1050 |
+
<option value="Uzbekistan">Uzbekistan</option>
|
1051 |
+
<option value="Vanuatu">Vanuatu</option>
|
1052 |
+
<option value="Venezuela, Bolivarian Republic of">Venezuela, Bolivarian Republic of</option>
|
1053 |
+
<option value="Viet Nam">Viet Nam</option>
|
1054 |
+
<option value="Virgin Islands, British">Virgin Islands, British</option>
|
1055 |
+
<option value="Virgin Islands, U.S.">Virgin Islands, U.S.</option>
|
1056 |
+
<option value="Wallis and Futuna">Wallis and Futuna</option>
|
1057 |
+
<option value="Western Sahara">Western Sahara</option>
|
1058 |
+
<option value="Yemen">Yemen</option>
|
1059 |
+
<option value="Zambia">Zambia</option>
|
1060 |
+
<option value="Zimbabwe">Zimbabwe</option>
|
1061 |
+
</select>
|
1062 |
+
</div>
|
1063 |
+
</div>
|
1064 |
+
|
1065 |
+
<h2><a name="optgroup-support" class="anchor" href="#optgroup-support"><optgroup> Support</a></h2>
|
1066 |
+
<div class="side-by-side clearfix">
|
1067 |
+
<div>
|
1068 |
+
<em>Single Select with Groups</em>
|
1069 |
+
<select data-placeholder="Your Favorite Football Team" style="width:350px;" class="chosen-select" tabindex="5">
|
1070 |
+
<option value=""></option>
|
1071 |
+
<optgroup label="NFC EAST">
|
1072 |
+
<option>Dallas Cowboys</option>
|
1073 |
+
<option>New York Giants</option>
|
1074 |
+
<option>Philadelphia Eagles</option>
|
1075 |
+
<option>Washington Redskins</option>
|
1076 |
+
</optgroup>
|
1077 |
+
<optgroup label="NFC NORTH">
|
1078 |
+
<option>Chicago Bears</option>
|
1079 |
+
<option>Detroit Lions</option>
|
1080 |
+
<option>Green Bay Packers</option>
|
1081 |
+
<option>Minnesota Vikings</option>
|
1082 |
+
</optgroup>
|
1083 |
+
<optgroup label="NFC SOUTH">
|
1084 |
+
<option>Atlanta Falcons</option>
|
1085 |
+
<option>Carolina Panthers</option>
|
1086 |
+
<option>New Orleans Saints</option>
|
1087 |
+
<option>Tampa Bay Buccaneers</option>
|
1088 |
+
</optgroup>
|
1089 |
+
<optgroup label="NFC WEST">
|
1090 |
+
<option>Arizona Cardinals</option>
|
1091 |
+
<option>St. Louis Rams</option>
|
1092 |
+
<option>San Francisco 49ers</option>
|
1093 |
+
<option>Seattle Seahawks</option>
|
1094 |
+
</optgroup>
|
1095 |
+
<optgroup label="AFC EAST">
|
1096 |
+
<option>Buffalo Bills</option>
|
1097 |
+
<option>Miami Dolphins</option>
|
1098 |
+
<option>New England Patriots</option>
|
1099 |
+
<option>New York Jets</option>
|
1100 |
+
</optgroup>
|
1101 |
+
<optgroup label="AFC NORTH">
|
1102 |
+
<option>Baltimore Ravens</option>
|
1103 |
+
<option>Cincinnati Bengals</option>
|
1104 |
+
<option>Cleveland Browns</option>
|
1105 |
+
<option>Pittsburgh Steelers</option>
|
1106 |
+
</optgroup>
|
1107 |
+
<optgroup label="AFC SOUTH">
|
1108 |
+
<option>Houston Texans</option>
|
1109 |
+
<option>Indianapolis Colts</option>
|
1110 |
+
<option>Jacksonville Jaguars</option>
|
1111 |
+
<option>Tennessee Titans</option>
|
1112 |
+
</optgroup>
|
1113 |
+
<optgroup label="AFC WEST">
|
1114 |
+
<option>Denver Broncos</option>
|
1115 |
+
<option>Kansas City Chiefs</option>
|
1116 |
+
<option>Oakland Raiders</option>
|
1117 |
+
<option>San Diego Chargers</option>
|
1118 |
+
</optgroup>
|
1119 |
+
</select>
|
1120 |
+
</div>
|
1121 |
+
<div>
|
1122 |
+
<em>Multiple Select with Groups</em>
|
1123 |
+
<select data-placeholder="Your Favorite Football Team" style="width:350px;" class="chosen-select" multiple tabindex="6">
|
1124 |
+
<option value=""></option>
|
1125 |
+
<optgroup label="NFC EAST">
|
1126 |
+
<option>Dallas Cowboys</option>
|
1127 |
+
<option>New York Giants</option>
|
1128 |
+
<option>Philadelphia Eagles</option>
|
1129 |
+
<option>Washington Redskins</option>
|
1130 |
+
</optgroup>
|
1131 |
+
<optgroup label="NFC NORTH">
|
1132 |
+
<option>Chicago Bears</option>
|
1133 |
+
<option>Detroit Lions</option>
|
1134 |
+
<option>Green Bay Packers</option>
|
1135 |
+
<option>Minnesota Vikings</option>
|
1136 |
+
</optgroup>
|
1137 |
+
<optgroup label="NFC SOUTH">
|
1138 |
+
<option>Atlanta Falcons</option>
|
1139 |
+
<option>Carolina Panthers</option>
|
1140 |
+
<option>New Orleans Saints</option>
|
1141 |
+
<option>Tampa Bay Buccaneers</option>
|
1142 |
+
</optgroup>
|
1143 |
+
<optgroup label="NFC WEST">
|
1144 |
+
<option>Arizona Cardinals</option>
|
1145 |
+
<option>St. Louis Rams</option>
|
1146 |
+
<option>San Francisco 49ers</option>
|
1147 |
+
<option>Seattle Seahawks</option>
|
1148 |
+
</optgroup>
|
1149 |
+
<optgroup label="AFC EAST">
|
1150 |
+
<option>Buffalo Bills</option>
|
1151 |
+
<option>Miami Dolphins</option>
|
1152 |
+
<option>New England Patriots</option>
|
1153 |
+
<option>New York Jets</option>
|
1154 |
+
</optgroup>
|
1155 |
+
<optgroup label="AFC NORTH">
|
1156 |
+
<option>Baltimore Ravens</option>
|
1157 |
+
<option>Cincinnati Bengals</option>
|
1158 |
+
<option>Cleveland Browns</option>
|
1159 |
+
<option>Pittsburgh Steelers</option>
|
1160 |
+
</optgroup>
|
1161 |
+
<optgroup label="AFC SOUTH">
|
1162 |
+
<option>Houston Texans</option>
|
1163 |
+
<option>Indianapolis Colts</option>
|
1164 |
+
<option>Jacksonville Jaguars</option>
|
1165 |
+
<option>Tennessee Titans</option>
|
1166 |
+
</optgroup>
|
1167 |
+
<optgroup label="AFC WEST">
|
1168 |
+
<option>Denver Broncos</option>
|
1169 |
+
<option>Kansas City Chiefs</option>
|
1170 |
+
<option>Oakland Raiders</option>
|
1171 |
+
<option>San Diego Chargers</option>
|
1172 |
+
</optgroup>
|
1173 |
+
</select>
|
1174 |
+
</div>
|
1175 |
+
</div>
|
1176 |
+
|
1177 |
+
<h2><a name="selected-and-disabled-support" class="anchor" href="#selected-and-disabled-support">Selected and Disabled Support</a></h2>
|
1178 |
+
<div class="side-by-side clearfix">
|
1179 |
+
<p>Chosen automatically highlights selected options and removes disabled options.</p>
|
1180 |
+
<div>
|
1181 |
+
<em>Single Select</em>
|
1182 |
+
<select data-placeholder="Your Favorite Type of Bear" style="width:350px;" class="chosen-select" tabindex="7">
|
1183 |
+
<option value=""></option>
|
1184 |
+
<option>American Black Bear</option>
|
1185 |
+
<option>Asiatic Black Bear</option>
|
1186 |
+
<option>Brown Bear</option>
|
1187 |
+
<option>Giant Panda</option>
|
1188 |
+
<option selected>Sloth Bear</option>
|
1189 |
+
<option disabled>Sun Bear</option>
|
1190 |
+
<option>Polar Bear</option>
|
1191 |
+
<option disabled>Spectacled Bear</option>
|
1192 |
+
</select>
|
1193 |
+
</div>
|
1194 |
+
<div>
|
1195 |
+
<em>Multiple Select</em>
|
1196 |
+
<select data-placeholder="Your Favorite Types of Bear" style="width:350px;" multiple class="chosen-select" tabindex="8">
|
1197 |
+
<option value=""></option>
|
1198 |
+
<option>American Black Bear</option>
|
1199 |
+
<option>Asiatic Black Bear</option>
|
1200 |
+
<option>Brown Bear</option>
|
1201 |
+
<option>Giant Panda</option>
|
1202 |
+
<option selected>Sloth Bear</option>
|
1203 |
+
<option disabled>Sun Bear</option>
|
1204 |
+
<option selected>Polar Bear</option>
|
1205 |
+
<option disabled>Spectacled Bear</option>
|
1206 |
+
</select>
|
1207 |
+
</div>
|
1208 |
+
</div>
|
1209 |
+
|
1210 |
+
<h2><a name="hide-search-on-single-select" class="anchor" href="#hide-search-on-single-select">Hide Search on Single Select</a></h2>
|
1211 |
+
<div class="side-by-side clearfix">
|
1212 |
+
<p>The disable_search_threshold option can be specified to hide the search input on single selects if there are fewer than (n) options.</p>
|
1213 |
+
<pre><code class="language-javascript">$(".chosen-select").chosen({disable_search_threshold: 10});</code></pre>
|
1214 |
+
<p></p>
|
1215 |
+
<div>
|
1216 |
+
<select data-placeholder="Your Favorite Type of Bear" style="width:350px;" class="chosen-select-no-single" tabindex="9">
|
1217 |
+
<option value=""></option>
|
1218 |
+
<option>American Black Bear</option>
|
1219 |
+
<option>Asiatic Black Bear</option>
|
1220 |
+
<option>Brown Bear</option>
|
1221 |
+
<option>Giant Panda</option>
|
1222 |
+
<option selected disabled>Sloth Bear</option>
|
1223 |
+
<option disabled>Sun Bear</option>
|
1224 |
+
<option selected disabled>Paddington Bear</option>
|
1225 |
+
<option selected>Polar Bear</option>
|
1226 |
+
<option disabled>Spectacled Bear</option>
|
1227 |
+
</select>
|
1228 |
+
</div>
|
1229 |
+
</div>
|
1230 |
+
|
1231 |
+
<h2><a name="default-text-support" class="anchor" href="#default-text-support">Default Text Support</a></h2>
|
1232 |
+
<div class="side-by-side clearfix">
|
1233 |
+
<p>Chosen automatically sets the default field text ("Choose a country...") by reading the select element's data-placeholder value. If no data-placeholder value is present, it will default to "Select an Option" or "Select Some Options" depending on whether the select is single or multiple. You can change these elements in the plugin js file as you see fit.</p>
|
1234 |
+
<pre><code class="language-markup"><select <strong>data-placeholder="Choose a country..."</strong> style="width:350px;" multiple class="chosen-select"></code></pre>
|
1235 |
+
<p><strong>Note:</strong> on single selects, the first element is assumed to be selected by the browser. To take advantage of the default text support, you will need to include a blank option as the first element of your select list.</p>
|
1236 |
+
</div>
|
1237 |
+
|
1238 |
+
<h2><a name="no-results-text-support" class="anchor" href="#no-results-text-support">No Results Text Support</a></h2>
|
1239 |
+
<div class="side-by-side clearfix">
|
1240 |
+
<p>Setting the "No results" search text is as easy as passing an option when you create Chosen:</p>
|
1241 |
+
<pre><code class="language-javascript"> $(".chosen-select").chosen({no_results_text: "Oops, nothing found!"}); </code></pre>
|
1242 |
+
<p></p>
|
1243 |
+
<div>
|
1244 |
+
<em>Single Select</em>
|
1245 |
+
<select data-placeholder="Type 'C' to view" style="width:350px;" class="chosen-select-no-results" tabindex="10">
|
1246 |
+
<option value=""></option>
|
1247 |
+
<option>American Black Bear</option>
|
1248 |
+
<option>Asiatic Black Bear</option>
|
1249 |
+
<option>Brown Bear</option>
|
1250 |
+
<option>Giant Panda</option>
|
1251 |
+
<option>Sloth Bear</option>
|
1252 |
+
<option>Sun Bear</option>
|
1253 |
+
<option>Polar Bear</option>
|
1254 |
+
<option>Spectacled Bear</option>
|
1255 |
+
</select>
|
1256 |
+
</div>
|
1257 |
+
<div>
|
1258 |
+
<em>Multiple Select</em>
|
1259 |
+
<select data-placeholder="Type 'C' to view" style="width:350px;" multiple class="chosen-select-no-results" tabindex="11">
|
1260 |
+
<option value=""></option>
|
1261 |
+
<option>American Black Bear</option>
|
1262 |
+
<option>Asiatic Black Bear</option>
|
1263 |
+
<option>Brown Bear</option>
|
1264 |
+
<option>Giant Panda</option>
|
1265 |
+
<option>Sloth Bear</option>
|
1266 |
+
<option>Sun Bear</option>
|
1267 |
+
<option>Polar Bear</option>
|
1268 |
+
<option>Spectacled Bear</option>
|
1269 |
+
</select>
|
1270 |
+
</div>
|
1271 |
+
</div>
|
1272 |
+
|
1273 |
+
<h2><a name="limit-selected-options-in-multiselect" class="anchor" href="#limit-selected-options-in-multiselect">Limit Selected Options in Multiselect</a></h2>
|
1274 |
+
<div class="side-by-side clearfix">
|
1275 |
+
<p>You can easily limit how many options the user can select:</p>
|
1276 |
+
<pre><code class="language-javascript">$(".chosen-select").chosen({max_selected_options: 5});</code></pre>
|
1277 |
+
<p>If you try to select another option with limit reached <code class="language-javascript">chosen:maxselected</code> event is triggered:</p>
|
1278 |
+
<pre><code class="language-javascript"> $(".chosen-select").bind("chosen:maxselected", function () { ... }); </code></pre>
|
1279 |
+
</div>
|
1280 |
+
|
1281 |
+
<h2><a name="allow-deselect-on-single-selects" class="anchor" href="#allow-deselect-on-single-selects">Allow Deselect on Single Selects</a></h2>
|
1282 |
+
<div class="side-by-side clearfix">
|
1283 |
+
<p>When a single select box isn't a required field, you can set <code class="language-javascript">allow_single_deselect: true</code> and Chosen will add a UI element for option deselection. This will only work if the first option has blank text.</p>
|
1284 |
+
<div class="side-by-side clearfix">
|
1285 |
+
<select data-placeholder="Your Favorite Type of Bear" style="width:350px;" class="chosen-select-deselect" tabindex="12">
|
1286 |
+
<option value=""></option>
|
1287 |
+
<option>American Black Bear</option>
|
1288 |
+
<option>Asiatic Black Bear</option>
|
1289 |
+
<option>Brown Bear</option>
|
1290 |
+
<option>Giant Panda</option>
|
1291 |
+
<option selected>Sloth Bear</option>
|
1292 |
+
<option>Sun Bear</option>
|
1293 |
+
<option>Polar Bear</option>
|
1294 |
+
<option>Spectacled Bear</option>
|
1295 |
+
</select>
|
1296 |
+
</div>
|
1297 |
+
</div>
|
1298 |
+
|
1299 |
+
<h2><a name="right-to-left-support" class="anchor" href="#right-to-left-support">Right to Left Support</a></h2>
|
1300 |
+
<div class="side-by-side clearfix">
|
1301 |
+
<p>Chosen supports right to left select boxes too. just add <code class="language-javascript">"chosen-rtl"</code> in addition to <code class="language-javascript">"chosen-select"</code> to your select tags and you are good to go.</p>
|
1302 |
+
<pre><code class="language-markup"><select class="chosen-select <strong>chosen-rtl</strong>"></code></pre>
|
1303 |
+
<div>
|
1304 |
+
<em>Single right to left select</em>
|
1305 |
+
<select data-placeholder="Your Favorite Type of Bear" style="width:350px;" class="chosen-select chosen-rtl" tabindex="13">
|
1306 |
+
<option value=""></option>
|
1307 |
+
<option>American Black Bear</option>
|
1308 |
+
<option>Asiatic Black Bear</option>
|
1309 |
+
<option>Brown Bear</option>
|
1310 |
+
<option>Giant Panda</option>
|
1311 |
+
<option selected>Sloth Bear</option>
|
1312 |
+
<option>Polar Bear</option>
|
1313 |
+
</select>
|
1314 |
+
</div>
|
1315 |
+
<div>
|
1316 |
+
<em>Multiple right to left select</em>
|
1317 |
+
<select data-placeholder="Your Favorite Types of Bear" style="width:350px;" multiple class="chosen-select chosen-rtl" tabindex="14">
|
1318 |
+
<option value=""></option>
|
1319 |
+
<option>American Black Bear</option>
|
1320 |
+
<option>Asiatic Black Bear</option>
|
1321 |
+
<option>Brown Bear</option>
|
1322 |
+
<option>Giant Panda</option>
|
1323 |
+
<option selected>Sloth Bear</option>
|
1324 |
+
<option selected>Polar Bear</option>
|
1325 |
+
</select>
|
1326 |
+
</div>
|
1327 |
+
</div>
|
1328 |
+
|
1329 |
+
<h2><a name="change-update-events" class="anchor" href="#change-update-events">Change / Update Events</a></h2>
|
1330 |
+
<div class="side-by-side clearfix">
|
1331 |
+
<ul>
|
1332 |
+
<li>
|
1333 |
+
<h3>Form Field Change</h3>
|
1334 |
+
<p>When working with form fields, you often want to perform some behavior after a value has been selected or deselected. Whenever a user selects a field in Chosen, it triggers a "change" event* on the original form field. That let's you do something like this:</p>
|
1335 |
+
<pre><code class="language-javascript">$("#form_field").chosen().change( … );</code></pre>
|
1336 |
+
</li>
|
1337 |
+
<li>
|
1338 |
+
<h3>Updating Chosen Dynamically</h3>
|
1339 |
+
<p>If you need to update the options in your select field and want Chosen to pick up the changes, you'll need to trigger the "chosen:updated" event on the field. Chosen will re-build itself based on the updated content.</p>
|
1340 |
+
<pre><code class="language-javascript">$("#form_field").trigger("chosen:updated");</code></pre>
|
1341 |
+
</li>
|
1342 |
+
</ul>
|
1343 |
+
</div>
|
1344 |
+
|
1345 |
+
<h2><a name="custom-width-support" class="anchor" href="#custom-width-support">Custom Width Support</a></h2>
|
1346 |
+
<div class="side-by-side clearfix">
|
1347 |
+
<p>Using a custom width with Chosen is as easy as passing an option when you create Chosen:</p>
|
1348 |
+
<pre><code class="language-javascript"> $(".chosen-select").chosen({width: "95%"}); </code></pre>
|
1349 |
+
<div>
|
1350 |
+
<em>Single Select</em>
|
1351 |
+
<select data-placeholder="Your Favorite Types of Bear" class="chosen-select-width" tabindex="15">
|
1352 |
+
<option value=""></option>
|
1353 |
+
<option selected>American Black Bear</option>
|
1354 |
+
<option>Asiatic Black Bear</option>
|
1355 |
+
<option>Brown Bear</option>
|
1356 |
+
<option>Giant Panda</option>
|
1357 |
+
<option>Sloth Bear</option>
|
1358 |
+
<option>Sun Bear</option>
|
1359 |
+
<option>Polar Bear</option>
|
1360 |
+
<option>Spectacled Bear</option>
|
1361 |
+
</select>
|
1362 |
+
</div>
|
1363 |
+
<div>
|
1364 |
+
<em>Multiple Select</em>
|
1365 |
+
<select data-placeholder="Your Favorite Types of Bear" multiple class="chosen-select-width" tabindex="16">
|
1366 |
+
<option value=""></option>
|
1367 |
+
<option>American Black Bear</option>
|
1368 |
+
<option>Asiatic Black Bear</option>
|
1369 |
+
<option>Brown Bear</option>
|
1370 |
+
<option selected>Giant Panda</option>
|
1371 |
+
<option>Sloth Bear</option>
|
1372 |
+
<option>Sun Bear</option>
|
1373 |
+
<option>Polar Bear</option>
|
1374 |
+
<option>Spectacled Bear</option>
|
1375 |
+
</select>
|
1376 |
+
</div>
|
1377 |
+
</div>
|
1378 |
+
|
1379 |
+
<h2><a name="labels-work-too" class="anchor" href="#labels-work-too">Labels work, too</a></h2>
|
1380 |
+
<div class="side-by-side clearfix">
|
1381 |
+
<p>Use labels just like you would a standard select</p>
|
1382 |
+
<p></p>
|
1383 |
+
<div>
|
1384 |
+
<em><label for="single-label-example">Click to Highlight Single Select</label></em>
|
1385 |
+
<select data-placeholder="Your Favorite Types of Bear" class="chosen-select" style="width:350px;" tabindex="17" id="single-label-example">
|
1386 |
+
<option value=""></option>
|
1387 |
+
<option selected>American Black Bear</option>
|
1388 |
+
<option>Asiatic Black Bear</option>
|
1389 |
+
<option>Brown Bear</option>
|
1390 |
+
<option>Giant Panda</option>
|
1391 |
+
<option>Sloth Bear</option>
|
1392 |
+
<option>Sun Bear</option>
|
1393 |
+
<option>Polar Bear</option>
|
1394 |
+
<option>Spectacled Bear</option>
|
1395 |
+
</select>
|
1396 |
+
</div>
|
1397 |
+
<div>
|
1398 |
+
<em><label for="multiple-label-example">Click to Highlight Multiple Select</label></em>
|
1399 |
+
<select data-placeholder="Your Favorite Types of Bear" multiple class="chosen-select" style="width:350px;" tabindex="18" id="multiple-label-example">
|
1400 |
+
<option value=""></option>
|
1401 |
+
<option>American Black Bear</option>
|
1402 |
+
<option>Asiatic Black Bear</option>
|
1403 |
+
<option>Brown Bear</option>
|
1404 |
+
<option selected>Giant Panda</option>
|
1405 |
+
<option>Sloth Bear</option>
|
1406 |
+
<option>Sun Bear</option>
|
1407 |
+
<option>Polar Bear</option>
|
1408 |
+
<option>Spectacled Bear</option>
|
1409 |
+
</select>
|
1410 |
+
</div>
|
1411 |
+
</div>
|
1412 |
+
|
1413 |
+
<h2><a name="setup" class="anchor" href="#setup">Setup</a></h2>
|
1414 |
+
<p>Using Chosen is easy as can be.</p>
|
1415 |
+
<ol>
|
1416 |
+
<li><a href="https://github.com/harvesthq/chosen/releases">Download</a> the plugin and copy the chosen files to your app.</li>
|
1417 |
+
<li>Activate the plugin on the select boxes of your choice: <code class="language-javascript">$(".chosen-select").chosen()</code></li>
|
1418 |
+
<li><a href="http://www.youtube.com/watch?feature=player_detailpage&v=UkSPUDpe0U8#t=11s">Disco</a>.</li>
|
1419 |
+
</ol>
|
1420 |
+
|
1421 |
+
<h2><a name="faqs" class="anchor" href="#faqs">FAQs</a></h2>
|
1422 |
+
<ul class="faqs">
|
1423 |
+
<li>
|
1424 |
+
<h3>Do you have all the available options documented somewhere?</h3>
|
1425 |
+
<p>Yes! You can find them on <a href="options.html">the options page</a>.</p>
|
1426 |
+
</li>
|
1427 |
+
<li>
|
1428 |
+
<h3>Something doesn't work. Can you fix it?</h3>
|
1429 |
+
<p>Yes! Please report all issues using the <a href="http://github.com/harvesthq/chosen/issues">GitHub issue tracking tool</a>. Please include the plugin version (jQuery or Prototype), browser and OS. The more information provided, the easier it is to fix a problem.</p>
|
1430 |
+
</li>
|
1431 |
+
<li>
|
1432 |
+
<h3>What browsers are supported?</h3>
|
1433 |
+
<p>All modern desktop browsers are supported (Firefox, Chrome, Safari and IE9). Legacy support for IE8 is also enabled. Chosen is disabled on iPhone, iPod Touch, and Android mobile devices (<a href="https://github.com/harvesthq/chosen/pull/1388">more information</a>).</p>
|
1434 |
+
</li>
|
1435 |
+
<li>
|
1436 |
+
<h3>Didn't there used to be a Prototype version of Chosen?</h3>
|
1437 |
+
<p><a href="index.proto.html">There still is!</a></p>
|
1438 |
+
</li>
|
1439 |
+
</ul>
|
1440 |
+
|
1441 |
+
<h2><a name="credits" class="anchor" href="#credits">Credits</a></h2>
|
1442 |
+
|
1443 |
+
<ul class="credits">
|
1444 |
+
<li>Concept and development by <a href="http://patrickfiller.com">Patrick Filler</a> for <a href="https://getharvest.com">Harvest</a>.</li>
|
1445 |
+
<li>Design and CSS by <a href="http://matthewlettini.com">Matthew Lettini</a>.</li>
|
1446 |
+
<li>Repository maintained by <a href="https://github.com/pfiller">@pfiller</a>, <a href="https://github.com/kenearley">@kenearley</a>, <a href="https://github.com/stof">@stof</a>, <a href="https://github.com/koenpunt">@koenpunt</a>, and <a href="https://github.com/tjschuck">@tjschuck</a>.</li>
|
1447 |
+
<li>Chosen includes <a href="https://github.com/harvesthq/chosen/contributors">contributions by many fine folks</a>.</li>
|
1448 |
+
</ul>
|
1449 |
+
|
1450 |
+
<footer>
|
1451 |
+
© 2011–2015 <a href="http://www.getharvest.com/">Harvest</a>. Chosen is licensed under the <a href="https://github.com/harvesthq/chosen/blob/master/LICENSE.md">MIT license</a>.
|
1452 |
+
</footer>
|
1453 |
+
|
1454 |
+
</div>
|
1455 |
+
</div>
|
1456 |
+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
|
1457 |
+
<script src="chosen.jquery.js" type="text/javascript"></script>
|
1458 |
+
<script src="docsupport/prism.js" type="text/javascript" charset="utf-8"></script>
|
1459 |
+
<script type="text/javascript">
|
1460 |
+
var config = {
|
1461 |
+
'.chosen-select' : {},
|
1462 |
+
'.chosen-select-deselect' : {allow_single_deselect:true},
|
1463 |
+
'.chosen-select-no-single' : {disable_search_threshold:10},
|
1464 |
+
'.chosen-select-no-results': {no_results_text:'Oops, nothing found!'},
|
1465 |
+
'.chosen-select-width' : {width:"95%"}
|
1466 |
+
}
|
1467 |
+
for (var selector in config) {
|
1468 |
+
$(selector).chosen(config[selector]);
|
1469 |
+
}
|
1470 |
+
</script>
|
1471 |
+
</form>
|
1472 |
+
<div class="oss-bar">
|
1473 |
+
<ul>
|
1474 |
+
<li><a class="fork" href="https://github.com/harvesthq/chosen">Fork on Github</a></li>
|
1475 |
+
<li><a class="harvest" href="http://www.getharvest.com/">Built by Harvest</a></li>
|
1476 |
+
</ul>
|
1477 |
+
</div>
|
1478 |
+
</body>
|
1479 |
+
</html>
|
assets/lib/chosen_v1.4.2/index.proto.html
ADDED
@@ -0,0 +1,1483 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!doctype html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="utf-8">
|
5 |
+
<title>Chosen: A Prototype Plugin by Harvest to Tame Unwieldy Select Boxes</title>
|
6 |
+
<link rel="stylesheet" href="docsupport/style.css">
|
7 |
+
<link rel="stylesheet" href="docsupport/prism.css">
|
8 |
+
<link rel="stylesheet" href="chosen.css">
|
9 |
+
<style type="text/css" media="all">
|
10 |
+
/* fix rtl for demo */
|
11 |
+
.chosen-rtl .chosen-drop { left: -9000px; }
|
12 |
+
</style>
|
13 |
+
</head>
|
14 |
+
<body>
|
15 |
+
<div id="container">
|
16 |
+
<div id="content">
|
17 |
+
<header>
|
18 |
+
<h1>Chosen - Prototype Version <small>(<span id="latest-version">v1.4.2</span>)</small></h1>
|
19 |
+
</header>
|
20 |
+
<p>Chosen is a Prototype plugin that makes long, unwieldy select boxes much more user-friendly.</p>
|
21 |
+
|
22 |
+
<p>
|
23 |
+
<a class="button button-blue" href="https://github.com/harvesthq/chosen/releases">Downloads</a>
|
24 |
+
<a class="button" href="https://github.com/harvesthq/chosen">Project Source</a>
|
25 |
+
<a class="button" href="https://github.com/harvesthq/chosen/blob/master/contributing.md">Contribute</a>
|
26 |
+
</p>
|
27 |
+
|
28 |
+
<p style="margin-top: 40px; font-style: italic;">Looking for the <a href="index.html">jQuery version?</a></p>
|
29 |
+
|
30 |
+
<h2><a name="standard-select" class="anchor" href="#standard-select">Standard Select</a></h2>
|
31 |
+
<div class="side-by-side clearfix">
|
32 |
+
<div>
|
33 |
+
<em>Turns This</em>
|
34 |
+
<select data-placeholder="Choose a Country..." style="width:350px;" tabindex="1">
|
35 |
+
<option value=""></option>
|
36 |
+
<option value="United States">United States</option>
|
37 |
+
<option value="United Kingdom">United Kingdom</option>
|
38 |
+
<option value="Afghanistan">Afghanistan</option>
|
39 |
+
<option value="Aland Islands">Aland Islands</option>
|
40 |
+
<option value="Albania">Albania</option>
|
41 |
+
<option value="Algeria">Algeria</option>
|
42 |
+
<option value="American Samoa">American Samoa</option>
|
43 |
+
<option value="Andorra">Andorra</option>
|
44 |
+
<option value="Angola">Angola</option>
|
45 |
+
<option value="Anguilla">Anguilla</option>
|
46 |
+
<option value="Antarctica">Antarctica</option>
|
47 |
+
<option value="Antigua and Barbuda">Antigua and Barbuda</option>
|
48 |
+
<option value="Argentina">Argentina</option>
|
49 |
+
<option value="Armenia">Armenia</option>
|
50 |
+
<option value="Aruba">Aruba</option>
|
51 |
+
<option value="Australia">Australia</option>
|
52 |
+
<option value="Austria">Austria</option>
|
53 |
+
<option value="Azerbaijan">Azerbaijan</option>
|
54 |
+
<option value="Bahamas">Bahamas</option>
|
55 |
+
<option value="Bahrain">Bahrain</option>
|
56 |
+
<option value="Bangladesh">Bangladesh</option>
|
57 |
+
<option value="Barbados">Barbados</option>
|
58 |
+
<option value="Belarus">Belarus</option>
|
59 |
+
<option value="Belgium">Belgium</option>
|
60 |
+
<option value="Belize">Belize</option>
|
61 |
+
<option value="Benin">Benin</option>
|
62 |
+
<option value="Bermuda">Bermuda</option>
|
63 |
+
<option value="Bhutan">Bhutan</option>
|
64 |
+
<option value="Bolivia, Plurinational State of">Bolivia, Plurinational State of</option>
|
65 |
+
<option value="Bonaire, Sint Eustatius and Saba">Bonaire, Sint Eustatius and Saba</option>
|
66 |
+
<option value="Bosnia and Herzegovina">Bosnia and Herzegovina</option>
|
67 |
+
<option value="Botswana">Botswana</option>
|
68 |
+
<option value="Bouvet Island">Bouvet Island</option>
|
69 |
+
<option value="Brazil">Brazil</option>
|
70 |
+
<option value="British Indian Ocean Territory">British Indian Ocean Territory</option>
|
71 |
+
<option value="Brunei Darussalam">Brunei Darussalam</option>
|
72 |
+
<option value="Bulgaria">Bulgaria</option>
|
73 |
+
<option value="Burkina Faso">Burkina Faso</option>
|
74 |
+
<option value="Burundi">Burundi</option>
|
75 |
+
<option value="Cambodia">Cambodia</option>
|
76 |
+
<option value="Cameroon">Cameroon</option>
|
77 |
+
<option value="Canada">Canada</option>
|
78 |
+
<option value="Cape Verde">Cape Verde</option>
|
79 |
+
<option value="Cayman Islands">Cayman Islands</option>
|
80 |
+
<option value="Central African Republic">Central African Republic</option>
|
81 |
+
<option value="Chad">Chad</option>
|
82 |
+
<option value="Chile">Chile</option>
|
83 |
+
<option value="China">China</option>
|
84 |
+
<option value="Christmas Island">Christmas Island</option>
|
85 |
+
<option value="Cocos (Keeling) Islands">Cocos (Keeling) Islands</option>
|
86 |
+
<option value="Colombia">Colombia</option>
|
87 |
+
<option value="Comoros">Comoros</option>
|
88 |
+
<option value="Congo">Congo</option>
|
89 |
+
<option value="Congo, The Democratic Republic of The">Congo, The Democratic Republic of The</option>
|
90 |
+
<option value="Cook Islands">Cook Islands</option>
|
91 |
+
<option value="Costa Rica">Costa Rica</option>
|
92 |
+
<option value="Cote D'ivoire">Cote D'ivoire</option>
|
93 |
+
<option value="Croatia">Croatia</option>
|
94 |
+
<option value="Cuba">Cuba</option>
|
95 |
+
<option value="Curacao">Curacao</option>
|
96 |
+
<option value="Cyprus">Cyprus</option>
|
97 |
+
<option value="Czech Republic">Czech Republic</option>
|
98 |
+
<option value="Denmark">Denmark</option>
|
99 |
+
<option value="Djibouti">Djibouti</option>
|
100 |
+
<option value="Dominica">Dominica</option>
|
101 |
+
<option value="Dominican Republic">Dominican Republic</option>
|
102 |
+
<option value="Ecuador">Ecuador</option>
|
103 |
+
<option value="Egypt">Egypt</option>
|
104 |
+
<option value="El Salvador">El Salvador</option>
|
105 |
+
<option value="Equatorial Guinea">Equatorial Guinea</option>
|
106 |
+
<option value="Eritrea">Eritrea</option>
|
107 |
+
<option value="Estonia">Estonia</option>
|
108 |
+
<option value="Ethiopia">Ethiopia</option>
|
109 |
+
<option value="Falkland Islands (Malvinas)">Falkland Islands (Malvinas)</option>
|
110 |
+
<option value="Faroe Islands">Faroe Islands</option>
|
111 |
+
<option value="Fiji">Fiji</option>
|
112 |
+
<option value="Finland">Finland</option>
|
113 |
+
<option value="France">France</option>
|
114 |
+
<option value="French Guiana">French Guiana</option>
|
115 |
+
<option value="French Polynesia">French Polynesia</option>
|
116 |
+
<option value="French Southern Territories">French Southern Territories</option>
|
117 |
+
<option value="Gabon">Gabon</option>
|
118 |
+
<option value="Gambia">Gambia</option>
|
119 |
+
<option value="Georgia">Georgia</option>
|
120 |
+
<option value="Germany">Germany</option>
|
121 |
+
<option value="Ghana">Ghana</option>
|
122 |
+
<option value="Gibraltar">Gibraltar</option>
|
123 |
+
<option value="Greece">Greece</option>
|
124 |
+
<option value="Greenland">Greenland</option>
|
125 |
+
<option value="Grenada">Grenada</option>
|
126 |
+
<option value="Guadeloupe">Guadeloupe</option>
|
127 |
+
<option value="Guam">Guam</option>
|
128 |
+
<option value="Guatemala">Guatemala</option>
|
129 |
+
<option value="Guernsey">Guernsey</option>
|
130 |
+
<option value="Guinea">Guinea</option>
|
131 |
+
<option value="Guinea-bissau">Guinea-bissau</option>
|
132 |
+
<option value="Guyana">Guyana</option>
|
133 |
+
<option value="Haiti">Haiti</option>
|
134 |
+
<option value="Heard Island and Mcdonald Islands">Heard Island and Mcdonald Islands</option>
|
135 |
+
<option value="Holy See (Vatican City State)">Holy See (Vatican City State)</option>
|
136 |
+
<option value="Honduras">Honduras</option>
|
137 |
+
<option value="Hong Kong">Hong Kong</option>
|
138 |
+
<option value="Hungary">Hungary</option>
|
139 |
+
<option value="Iceland">Iceland</option>
|
140 |
+
<option value="India">India</option>
|
141 |
+
<option value="Indonesia">Indonesia</option>
|
142 |
+
<option value="Iran, Islamic Republic of">Iran, Islamic Republic of</option>
|
143 |
+
<option value="Iraq">Iraq</option>
|
144 |
+
<option value="Ireland">Ireland</option>
|
145 |
+
<option value="Isle of Man">Isle of Man</option>
|
146 |
+
<option value="Israel">Israel</option>
|
147 |
+
<option value="Italy">Italy</option>
|
148 |
+
<option value="Jamaica">Jamaica</option>
|
149 |
+
<option value="Japan">Japan</option>
|
150 |
+
<option value="Jersey">Jersey</option>
|
151 |
+
<option value="Jordan">Jordan</option>
|
152 |
+
<option value="Kazakhstan">Kazakhstan</option>
|
153 |
+
<option value="Kenya">Kenya</option>
|
154 |
+
<option value="Kiribati">Kiribati</option>
|
155 |
+
<option value="Korea, Democratic People's Republic of">Korea, Democratic People's Republic of</option>
|
156 |
+
<option value="Korea, Republic of">Korea, Republic of</option>
|
157 |
+
<option value="Kuwait">Kuwait</option>
|
158 |
+
<option value="Kyrgyzstan">Kyrgyzstan</option>
|
159 |
+
<option value="Lao People's Democratic Republic">Lao People's Democratic Republic</option>
|
160 |
+
<option value="Latvia">Latvia</option>
|
161 |
+
<option value="Lebanon">Lebanon</option>
|
162 |
+
<option value="Lesotho">Lesotho</option>
|
163 |
+
<option value="Liberia">Liberia</option>
|
164 |
+
<option value="Libya">Libya</option>
|
165 |
+
<option value="Liechtenstein">Liechtenstein</option>
|
166 |
+
<option value="Lithuania">Lithuania</option>
|
167 |
+
<option value="Luxembourg">Luxembourg</option>
|
168 |
+
<option value="Macao">Macao</option>
|
169 |
+
<option value="Macedonia, The Former Yugoslav Republic of">Macedonia, The Former Yugoslav Republic of</option>
|
170 |
+
<option value="Madagascar">Madagascar</option>
|
171 |
+
<option value="Malawi">Malawi</option>
|
172 |
+
<option value="Malaysia">Malaysia</option>
|
173 |
+
<option value="Maldives">Maldives</option>
|
174 |
+
<option value="Mali">Mali</option>
|
175 |
+
<option value="Malta">Malta</option>
|
176 |
+
<option value="Marshall Islands">Marshall Islands</option>
|
177 |
+
<option value="Martinique">Martinique</option>
|
178 |
+
<option value="Mauritania">Mauritania</option>
|
179 |
+
<option value="Mauritius">Mauritius</option>
|
180 |
+
<option value="Mayotte">Mayotte</option>
|
181 |
+
<option value="Mexico">Mexico</option>
|
182 |
+
<option value="Micronesia, Federated States of">Micronesia, Federated States of</option>
|
183 |
+
<option value="Moldova, Republic of">Moldova, Republic of</option>
|
184 |
+
<option value="Monaco">Monaco</option>
|
185 |
+
<option value="Mongolia">Mongolia</option>
|
186 |
+
<option value="Montenegro">Montenegro</option>
|
187 |
+
<option value="Montserrat">Montserrat</option>
|
188 |
+
<option value="Morocco">Morocco</option>
|
189 |
+
<option value="Mozambique">Mozambique</option>
|
190 |
+
<option value="Myanmar">Myanmar</option>
|
191 |
+
<option value="Namibia">Namibia</option>
|
192 |
+
<option value="Nauru">Nauru</option>
|
193 |
+
<option value="Nepal">Nepal</option>
|
194 |
+
<option value="Netherlands">Netherlands</option>
|
195 |
+
<option value="New Caledonia">New Caledonia</option>
|
196 |
+
<option value="New Zealand">New Zealand</option>
|
197 |
+
<option value="Nicaragua">Nicaragua</option>
|
198 |
+
<option value="Niger">Niger</option>
|
199 |
+
<option value="Nigeria">Nigeria</option>
|
200 |
+
<option value="Niue">Niue</option>
|
201 |
+
<option value="Norfolk Island">Norfolk Island</option>
|
202 |
+
<option value="Northern Mariana Islands">Northern Mariana Islands</option>
|
203 |
+
<option value="Norway">Norway</option>
|
204 |
+
<option value="Oman">Oman</option>
|
205 |
+
<option value="Pakistan">Pakistan</option>
|
206 |
+
<option value="Palau">Palau</option>
|
207 |
+
<option value="Palestinian Territory, Occupied">Palestinian Territory, Occupied</option>
|
208 |
+
<option value="Panama">Panama</option>
|
209 |
+
<option value="Papua New Guinea">Papua New Guinea</option>
|
210 |
+
<option value="Paraguay">Paraguay</option>
|
211 |
+
<option value="Peru">Peru</option>
|
212 |
+
<option value="Philippines">Philippines</option>
|
213 |
+
<option value="Pitcairn">Pitcairn</option>
|
214 |
+
<option value="Poland">Poland</option>
|
215 |
+
<option value="Portugal">Portugal</option>
|
216 |
+
<option value="Puerto Rico">Puerto Rico</option>
|
217 |
+
<option value="Qatar">Qatar</option>
|
218 |
+
<option value="Reunion">Reunion</option>
|
219 |
+
<option value="Romania">Romania</option>
|
220 |
+
<option value="Russian Federation">Russian Federation</option>
|
221 |
+
<option value="Rwanda">Rwanda</option>
|
222 |
+
<option value="Saint Barthelemy">Saint Barthelemy</option>
|
223 |
+
<option value="Saint Helena, Ascension and Tristan da Cunha">Saint Helena, Ascension and Tristan da Cunha</option>
|
224 |
+
<option value="Saint Kitts and Nevis">Saint Kitts and Nevis</option>
|
225 |
+
<option value="Saint Lucia">Saint Lucia</option>
|
226 |
+
<option value="Saint Martin (French part)">Saint Martin (French part)</option>
|
227 |
+
<option value="Saint Pierre and Miquelon">Saint Pierre and Miquelon</option>
|
228 |
+
<option value="Saint Vincent and The Grenadines">Saint Vincent and The Grenadines</option>
|
229 |
+
<option value="Samoa">Samoa</option>
|
230 |
+
<option value="San Marino">San Marino</option>
|
231 |
+
<option value="Sao Tome and Principe">Sao Tome and Principe</option>
|
232 |
+
<option value="Saudi Arabia">Saudi Arabia</option>
|
233 |
+
<option value="Senegal">Senegal</option>
|
234 |
+
<option value="Serbia">Serbia</option>
|
235 |
+
<option value="Seychelles">Seychelles</option>
|
236 |
+
<option value="Sierra Leone">Sierra Leone</option>
|
237 |
+
<option value="Singapore">Singapore</option>
|
238 |
+
<option value="Sint Maarten (Dutch part)">Sint Maarten (Dutch part)</option>
|
239 |
+
<option value="Slovakia">Slovakia</option>
|
240 |
+
<option value="Slovenia">Slovenia</option>
|
241 |
+
<option value="Solomon Islands">Solomon Islands</option>
|
242 |
+
<option value="Somalia">Somalia</option>
|
243 |
+
<option value="South Africa">South Africa</option>
|
244 |
+
<option value="South Georgia and The South Sandwich Islands">South Georgia and The South Sandwich Islands</option>
|
245 |
+
<option value="South Sudan">South Sudan</option>
|
246 |
+
<option value="Spain">Spain</option>
|
247 |
+
<option value="Sri Lanka">Sri Lanka</option>
|
248 |
+
<option value="Sudan">Sudan</option>
|
249 |
+
<option value="Suriname">Suriname</option>
|
250 |
+
<option value="Svalbard and Jan Mayen">Svalbard and Jan Mayen</option>
|
251 |
+
<option value="Swaziland">Swaziland</option>
|
252 |
+
<option value="Sweden">Sweden</option>
|
253 |
+
<option value="Switzerland">Switzerland</option>
|
254 |
+
<option value="Syrian Arab Republic">Syrian Arab Republic</option>
|
255 |
+
<option value="Taiwan, Province of China">Taiwan, Province of China</option>
|
256 |
+
<option value="Tajikistan">Tajikistan</option>
|
257 |
+
<option value="Tanzania, United Republic of">Tanzania, United Republic of</option>
|
258 |
+
<option value="Thailand">Thailand</option>
|
259 |
+
<option value="Timor-leste">Timor-leste</option>
|
260 |
+
<option value="Togo">Togo</option>
|
261 |
+
<option value="Tokelau">Tokelau</option>
|
262 |
+
<option value="Tonga">Tonga</option>
|
263 |
+
<option value="Trinidad and Tobago">Trinidad and Tobago</option>
|
264 |
+
<option value="Tunisia">Tunisia</option>
|
265 |
+
<option value="Turkey">Turkey</option>
|
266 |
+
<option value="Turkmenistan">Turkmenistan</option>
|
267 |
+
<option value="Turks and Caicos Islands">Turks and Caicos Islands</option>
|
268 |
+
<option value="Tuvalu">Tuvalu</option>
|
269 |
+
<option value="Uganda">Uganda</option>
|
270 |
+
<option value="Ukraine">Ukraine</option>
|
271 |
+
<option value="United Arab Emirates">United Arab Emirates</option>
|
272 |
+
<option value="United Kingdom">United Kingdom</option>
|
273 |
+
<option value="United States">United States</option>
|
274 |
+
<option value="United States Minor Outlying Islands">United States Minor Outlying Islands</option>
|
275 |
+
<option value="Uruguay">Uruguay</option>
|
276 |
+
<option value="Uzbekistan">Uzbekistan</option>
|
277 |
+
<option value="Vanuatu">Vanuatu</option>
|
278 |
+
<option value="Venezuela, Bolivarian Republic of">Venezuela, Bolivarian Republic of</option>
|
279 |
+
<option value="Viet Nam">Viet Nam</option>
|
280 |
+
<option value="Virgin Islands, British">Virgin Islands, British</option>
|
281 |
+
<option value="Virgin Islands, U.S.">Virgin Islands, U.S.</option>
|
282 |
+
<option value="Wallis and Futuna">Wallis and Futuna</option>
|
283 |
+
<option value="Western Sahara">Western Sahara</option>
|
284 |
+
<option value="Yemen">Yemen</option>
|
285 |
+
<option value="Zambia">Zambia</option>
|
286 |
+
<option value="Zimbabwe">Zimbabwe</option>
|
287 |
+
</select>
|
288 |
+
</div>
|
289 |
+
<div>
|
290 |
+
<em>Into This</em>
|
291 |
+
<select data-placeholder="Choose a Country..." class="chosen-select" style="width:350px;" tabindex="2">
|
292 |
+
<option value=""></option>
|
293 |
+
<option value="United States">United States</option>
|
294 |
+
<option value="United Kingdom">United Kingdom</option>
|
295 |
+
<option value="Afghanistan">Afghanistan</option>
|
296 |
+
<option value="Aland Islands">Aland Islands</option>
|
297 |
+
<option value="Albania">Albania</option>
|
298 |
+
<option value="Algeria">Algeria</option>
|
299 |
+
<option value="American Samoa">American Samoa</option>
|
300 |
+
<option value="Andorra">Andorra</option>
|
301 |
+
<option value="Angola">Angola</option>
|
302 |
+
<option value="Anguilla">Anguilla</option>
|
303 |
+
<option value="Antarctica">Antarctica</option>
|
304 |
+
<option value="Antigua and Barbuda">Antigua and Barbuda</option>
|
305 |
+
<option value="Argentina">Argentina</option>
|
306 |
+
<option value="Armenia">Armenia</option>
|
307 |
+
<option value="Aruba">Aruba</option>
|
308 |
+
<option value="Australia">Australia</option>
|
309 |
+
<option value="Austria">Austria</option>
|
310 |
+
<option value="Azerbaijan">Azerbaijan</option>
|
311 |
+
<option value="Bahamas">Bahamas</option>
|
312 |
+
<option value="Bahrain">Bahrain</option>
|
313 |
+
<option value="Bangladesh">Bangladesh</option>
|
314 |
+
<option value="Barbados">Barbados</option>
|
315 |
+
<option value="Belarus">Belarus</option>
|
316 |
+
<option value="Belgium">Belgium</option>
|
317 |
+
<option value="Belize">Belize</option>
|
318 |
+
<option value="Benin">Benin</option>
|
319 |
+
<option value="Bermuda">Bermuda</option>
|
320 |
+
<option value="Bhutan">Bhutan</option>
|
321 |
+
<option value="Bolivia, Plurinational State of">Bolivia, Plurinational State of</option>
|
322 |
+
<option value="Bonaire, Sint Eustatius and Saba">Bonaire, Sint Eustatius and Saba</option>
|
323 |
+
<option value="Bosnia and Herzegovina">Bosnia and Herzegovina</option>
|
324 |
+
<option value="Botswana">Botswana</option>
|
325 |
+
<option value="Bouvet Island">Bouvet Island</option>
|
326 |
+
<option value="Brazil">Brazil</option>
|
327 |
+
<option value="British Indian Ocean Territory">British Indian Ocean Territory</option>
|
328 |
+
<option value="Brunei Darussalam">Brunei Darussalam</option>
|
329 |
+
<option value="Bulgaria">Bulgaria</option>
|
330 |
+
<option value="Burkina Faso">Burkina Faso</option>
|
331 |
+
<option value="Burundi">Burundi</option>
|
332 |
+
<option value="Cambodia">Cambodia</option>
|
333 |
+
<option value="Cameroon">Cameroon</option>
|
334 |
+
<option value="Canada">Canada</option>
|
335 |
+
<option value="Cape Verde">Cape Verde</option>
|
336 |
+
<option value="Cayman Islands">Cayman Islands</option>
|
337 |
+
<option value="Central African Republic">Central African Republic</option>
|
338 |
+
<option value="Chad">Chad</option>
|
339 |
+
<option value="Chile">Chile</option>
|
340 |
+
<option value="China">China</option>
|
341 |
+
<option value="Christmas Island">Christmas Island</option>
|
342 |
+
<option value="Cocos (Keeling) Islands">Cocos (Keeling) Islands</option>
|
343 |
+
<option value="Colombia">Colombia</option>
|
344 |
+
<option value="Comoros">Comoros</option>
|
345 |
+
<option value="Congo">Congo</option>
|
346 |
+
<option value="Congo, The Democratic Republic of The">Congo, The Democratic Republic of The</option>
|
347 |
+
<option value="Cook Islands">Cook Islands</option>
|
348 |
+
<option value="Costa Rica">Costa Rica</option>
|
349 |
+
<option value="Cote D'ivoire">Cote D'ivoire</option>
|
350 |
+
<option value="Croatia">Croatia</option>
|
351 |
+
<option value="Cuba">Cuba</option>
|
352 |
+
<option value="Curacao">Curacao</option>
|
353 |
+
<option value="Cyprus">Cyprus</option>
|
354 |
+
<option value="Czech Republic">Czech Republic</option>
|
355 |
+
<option value="Denmark">Denmark</option>
|
356 |
+
<option value="Djibouti">Djibouti</option>
|
357 |
+
<option value="Dominica">Dominica</option>
|
358 |
+
<option value="Dominican Republic">Dominican Republic</option>
|
359 |
+
<option value="Ecuador">Ecuador</option>
|
360 |
+
<option value="Egypt">Egypt</option>
|
361 |
+
<option value="El Salvador">El Salvador</option>
|
362 |
+
<option value="Equatorial Guinea">Equatorial Guinea</option>
|
363 |
+
<option value="Eritrea">Eritrea</option>
|
364 |
+
<option value="Estonia">Estonia</option>
|
365 |
+
<option value="Ethiopia">Ethiopia</option>
|
366 |
+
<option value="Falkland Islands (Malvinas)">Falkland Islands (Malvinas)</option>
|
367 |
+
<option value="Faroe Islands">Faroe Islands</option>
|
368 |
+
<option value="Fiji">Fiji</option>
|
369 |
+
<option value="Finland">Finland</option>
|
370 |
+
<option value="France">France</option>
|
371 |
+
<option value="French Guiana">French Guiana</option>
|
372 |
+
<option value="French Polynesia">French Polynesia</option>
|
373 |
+
<option value="French Southern Territories">French Southern Territories</option>
|
374 |
+
<option value="Gabon">Gabon</option>
|
375 |
+
<option value="Gambia">Gambia</option>
|
376 |
+
<option value="Georgia">Georgia</option>
|
377 |
+
<option value="Germany">Germany</option>
|
378 |
+
<option value="Ghana">Ghana</option>
|
379 |
+
<option value="Gibraltar">Gibraltar</option>
|
380 |
+
<option value="Greece">Greece</option>
|
381 |
+
<option value="Greenland">Greenland</option>
|
382 |
+
<option value="Grenada">Grenada</option>
|
383 |
+
<option value="Guadeloupe">Guadeloupe</option>
|
384 |
+
<option value="Guam">Guam</option>
|
385 |
+
<option value="Guatemala">Guatemala</option>
|
386 |
+
<option value="Guernsey">Guernsey</option>
|
387 |
+
<option value="Guinea">Guinea</option>
|
388 |
+
<option value="Guinea-bissau">Guinea-bissau</option>
|
389 |
+
<option value="Guyana">Guyana</option>
|
390 |
+
<option value="Haiti">Haiti</option>
|
391 |
+
<option value="Heard Island and Mcdonald Islands">Heard Island and Mcdonald Islands</option>
|
392 |
+
<option value="Holy See (Vatican City State)">Holy See (Vatican City State)</option>
|
393 |
+
<option value="Honduras">Honduras</option>
|
394 |
+
<option value="Hong Kong">Hong Kong</option>
|
395 |
+
<option value="Hungary">Hungary</option>
|
396 |
+
<option value="Iceland">Iceland</option>
|
397 |
+
<option value="India">India</option>
|
398 |
+
<option value="Indonesia">Indonesia</option>
|
399 |
+
<option value="Iran, Islamic Republic of">Iran, Islamic Republic of</option>
|
400 |
+
<option value="Iraq">Iraq</option>
|
401 |
+
<option value="Ireland">Ireland</option>
|
402 |
+
<option value="Isle of Man">Isle of Man</option>
|
403 |
+
<option value="Israel">Israel</option>
|
404 |
+
<option value="Italy">Italy</option>
|
405 |
+
<option value="Jamaica">Jamaica</option>
|
406 |
+
<option value="Japan">Japan</option>
|
407 |
+
<option value="Jersey">Jersey</option>
|
408 |
+
<option value="Jordan">Jordan</option>
|
409 |
+
<option value="Kazakhstan">Kazakhstan</option>
|
410 |
+
<option value="Kenya">Kenya</option>
|
411 |
+
<option value="Kiribati">Kiribati</option>
|
412 |
+
<option value="Korea, Democratic People's Republic of">Korea, Democratic People's Republic of</option>
|
413 |
+
<option value="Korea, Republic of">Korea, Republic of</option>
|
414 |
+
<option value="Kuwait">Kuwait</option>
|
415 |
+
<option value="Kyrgyzstan">Kyrgyzstan</option>
|
416 |
+
<option value="Lao People's Democratic Republic">Lao People's Democratic Republic</option>
|
417 |
+
<option value="Latvia">Latvia</option>
|
418 |
+
<option value="Lebanon">Lebanon</option>
|
419 |
+
<option value="Lesotho">Lesotho</option>
|
420 |
+
<option value="Liberia">Liberia</option>
|
421 |
+
<option value="Libya">Libya</option>
|
422 |
+
<option value="Liechtenstein">Liechtenstein</option>
|
423 |
+
<option value="Lithuania">Lithuania</option>
|
424 |
+
<option value="Luxembourg">Luxembourg</option>
|
425 |
+
<option value="Macao">Macao</option>
|
426 |
+
<option value="Macedonia, The Former Yugoslav Republic of">Macedonia, The Former Yugoslav Republic of</option>
|
427 |
+
<option value="Madagascar">Madagascar</option>
|
428 |
+
<option value="Malawi">Malawi</option>
|
429 |
+
<option value="Malaysia">Malaysia</option>
|
430 |
+
<option value="Maldives">Maldives</option>
|
431 |
+
<option value="Mali">Mali</option>
|
432 |
+
<option value="Malta">Malta</option>
|
433 |
+
<option value="Marshall Islands">Marshall Islands</option>
|
434 |
+
<option value="Martinique">Martinique</option>
|
435 |
+
<option value="Mauritania">Mauritania</option>
|
436 |
+
<option value="Mauritius">Mauritius</option>
|
437 |
+
<option value="Mayotte">Mayotte</option>
|
438 |
+
<option value="Mexico">Mexico</option>
|
439 |
+
<option value="Micronesia, Federated States of">Micronesia, Federated States of</option>
|
440 |
+
<option value="Moldova, Republic of">Moldova, Republic of</option>
|
441 |
+
<option value="Monaco">Monaco</option>
|
442 |
+
<option value="Mongolia">Mongolia</option>
|
443 |
+
<option value="Montenegro">Montenegro</option>
|
444 |
+
<option value="Montserrat">Montserrat</option>
|
445 |
+
<option value="Morocco">Morocco</option>
|
446 |
+
<option value="Mozambique">Mozambique</option>
|
447 |
+
<option value="Myanmar">Myanmar</option>
|
448 |
+
<option value="Namibia">Namibia</option>
|
449 |
+
<option value="Nauru">Nauru</option>
|
450 |
+
<option value="Nepal">Nepal</option>
|
451 |
+
<option value="Netherlands">Netherlands</option>
|
452 |
+
<option value="New Caledonia">New Caledonia</option>
|
453 |
+
<option value="New Zealand">New Zealand</option>
|
454 |
+
<option value="Nicaragua">Nicaragua</option>
|
455 |
+
<option value="Niger">Niger</option>
|
456 |
+
<option value="Nigeria">Nigeria</option>
|
457 |
+
<option value="Niue">Niue</option>
|
458 |
+
<option value="Norfolk Island">Norfolk Island</option>
|
459 |
+
<option value="Northern Mariana Islands">Northern Mariana Islands</option>
|
460 |
+
<option value="Norway">Norway</option>
|
461 |
+
<option value="Oman">Oman</option>
|
462 |
+
<option value="Pakistan">Pakistan</option>
|
463 |
+
<option value="Palau">Palau</option>
|
464 |
+
<option value="Palestinian Territory, Occupied">Palestinian Territory, Occupied</option>
|
465 |
+
<option value="Panama">Panama</option>
|
466 |
+
<option value="Papua New Guinea">Papua New Guinea</option>
|
467 |
+
<option value="Paraguay">Paraguay</option>
|
468 |
+
<option value="Peru">Peru</option>
|
469 |
+
<option value="Philippines">Philippines</option>
|
470 |
+
<option value="Pitcairn">Pitcairn</option>
|
471 |
+
<option value="Poland">Poland</option>
|
472 |
+
<option value="Portugal">Portugal</option>
|
473 |
+
<option value="Puerto Rico">Puerto Rico</option>
|
474 |
+
<option value="Qatar">Qatar</option>
|
475 |
+
<option value="Reunion">Reunion</option>
|
476 |
+
<option value="Romania">Romania</option>
|
477 |
+
<option value="Russian Federation">Russian Federation</option>
|
478 |
+
<option value="Rwanda">Rwanda</option>
|
479 |
+
<option value="Saint Barthelemy">Saint Barthelemy</option>
|
480 |
+
<option value="Saint Helena, Ascension and Tristan da Cunha">Saint Helena, Ascension and Tristan da Cunha</option>
|
481 |
+
<option value="Saint Kitts and Nevis">Saint Kitts and Nevis</option>
|
482 |
+
<option value="Saint Lucia">Saint Lucia</option>
|
483 |
+
<option value="Saint Martin (French part)">Saint Martin (French part)</option>
|
484 |
+
<option value="Saint Pierre and Miquelon">Saint Pierre and Miquelon</option>
|
485 |
+
<option value="Saint Vincent and The Grenadines">Saint Vincent and The Grenadines</option>
|
486 |
+
<option value="Samoa">Samoa</option>
|
487 |
+
<option value="San Marino">San Marino</option>
|
488 |
+
<option value="Sao Tome and Principe">Sao Tome and Principe</option>
|
489 |
+
<option value="Saudi Arabia">Saudi Arabia</option>
|
490 |
+
<option value="Senegal">Senegal</option>
|
491 |
+
<option value="Serbia">Serbia</option>
|
492 |
+
<option value="Seychelles">Seychelles</option>
|
493 |
+
<option value="Sierra Leone">Sierra Leone</option>
|
494 |
+
<option value="Singapore">Singapore</option>
|
495 |
+
<option value="Sint Maarten (Dutch part)">Sint Maarten (Dutch part)</option>
|
496 |
+
<option value="Slovakia">Slovakia</option>
|
497 |
+
<option value="Slovenia">Slovenia</option>
|
498 |
+
<option value="Solomon Islands">Solomon Islands</option>
|
499 |
+
<option value="Somalia">Somalia</option>
|
500 |
+
<option value="South Africa">South Africa</option>
|
501 |
+
<option value="South Georgia and The South Sandwich Islands">South Georgia and The South Sandwich Islands</option>
|
502 |
+
<option value="South Sudan">South Sudan</option>
|
503 |
+
<option value="Spain">Spain</option>
|
504 |
+
<option value="Sri Lanka">Sri Lanka</option>
|
505 |
+
<option value="Sudan">Sudan</option>
|
506 |
+
<option value="Suriname">Suriname</option>
|
507 |
+
<option value="Svalbard and Jan Mayen">Svalbard and Jan Mayen</option>
|
508 |
+
<option value="Swaziland">Swaziland</option>
|
509 |
+
<option value="Sweden">Sweden</option>
|
510 |
+
<option value="Switzerland">Switzerland</option>
|
511 |
+
<option value="Syrian Arab Republic">Syrian Arab Republic</option>
|
512 |
+
<option value="Taiwan, Province of China">Taiwan, Province of China</option>
|
513 |
+
<option value="Tajikistan">Tajikistan</option>
|
514 |
+
<option value="Tanzania, United Republic of">Tanzania, United Republic of</option>
|
515 |
+
<option value="Thailand">Thailand</option>
|
516 |
+
<option value="Timor-leste">Timor-leste</option>
|
517 |
+
<option value="Togo">Togo</option>
|
518 |
+
<option value="Tokelau">Tokelau</option>
|
519 |
+
<option value="Tonga">Tonga</option>
|
520 |
+
<option value="Trinidad and Tobago">Trinidad and Tobago</option>
|
521 |
+
<option value="Tunisia">Tunisia</option>
|
522 |
+
<option value="Turkey">Turkey</option>
|
523 |
+
<option value="Turkmenistan">Turkmenistan</option>
|
524 |
+
<option value="Turks and Caicos Islands">Turks and Caicos Islands</option>
|
525 |
+
<option value="Tuvalu">Tuvalu</option>
|
526 |
+
<option value="Uganda">Uganda</option>
|
527 |
+
<option value="Ukraine">Ukraine</option>
|
528 |
+
<option value="United Arab Emirates">United Arab Emirates</option>
|
529 |
+
<option value="United Kingdom">United Kingdom</option>
|
530 |
+
<option value="United States">United States</option>
|
531 |
+
<option value="United States Minor Outlying Islands">United States Minor Outlying Islands</option>
|
532 |
+
<option value="Uruguay">Uruguay</option>
|
533 |
+
<option value="Uzbekistan">Uzbekistan</option>
|
534 |
+
<option value="Vanuatu">Vanuatu</option>
|
535 |
+
<option value="Venezuela, Bolivarian Republic of">Venezuela, Bolivarian Republic of</option>
|
536 |
+
<option value="Viet Nam">Viet Nam</option>
|
537 |
+
<option value="Virgin Islands, British">Virgin Islands, British</option>
|
538 |
+
<option value="Virgin Islands, U.S.">Virgin Islands, U.S.</option>
|
539 |
+
<option value="Wallis and Futuna">Wallis and Futuna</option>
|
540 |
+
<option value="Western Sahara">Western Sahara</option>
|
541 |
+
<option value="Yemen">Yemen</option>
|
542 |
+
<option value="Zambia">Zambia</option>
|
543 |
+
<option value="Zimbabwe">Zimbabwe</option>
|
544 |
+
</select>
|
545 |
+
</div>
|
546 |
+
</div>
|
547 |
+
|
548 |
+
<h2><a name="multiple-select" class="anchor" href="#multiple-select">Multiple Select</a></h2>
|
549 |
+
<div class="side-by-side clearfix">
|
550 |
+
<div>
|
551 |
+
<em>Turns This</em>
|
552 |
+
<select data-placeholder="Choose a Country..." style="width:350px;" multiple tabindex="3">
|
553 |
+
<option value=""></option>
|
554 |
+
<option value="United States">United States</option>
|
555 |
+
<option value="United Kingdom">United Kingdom</option>
|
556 |
+
<option value="Afghanistan">Afghanistan</option>
|
557 |
+
<option value="Aland Islands">Aland Islands</option>
|
558 |
+
<option value="Albania">Albania</option>
|
559 |
+
<option value="Algeria">Algeria</option>
|
560 |
+
<option value="American Samoa">American Samoa</option>
|
561 |
+
<option value="Andorra">Andorra</option>
|
562 |
+
<option value="Angola">Angola</option>
|
563 |
+
<option value="Anguilla">Anguilla</option>
|
564 |
+
<option value="Antarctica">Antarctica</option>
|
565 |
+
<option value="Antigua and Barbuda">Antigua and Barbuda</option>
|
566 |
+
<option value="Argentina">Argentina</option>
|
567 |
+
<option value="Armenia">Armenia</option>
|
568 |
+
<option value="Aruba">Aruba</option>
|
569 |
+
<option value="Australia">Australia</option>
|
570 |
+
<option value="Austria">Austria</option>
|
571 |
+
<option value="Azerbaijan">Azerbaijan</option>
|
572 |
+
<option value="Bahamas">Bahamas</option>
|
573 |
+
<option value="Bahrain">Bahrain</option>
|
574 |
+
<option value="Bangladesh">Bangladesh</option>
|
575 |
+
<option value="Barbados">Barbados</option>
|
576 |
+
<option value="Belarus">Belarus</option>
|
577 |
+
<option value="Belgium">Belgium</option>
|
578 |
+
<option value="Belize">Belize</option>
|
579 |
+
<option value="Benin">Benin</option>
|
580 |
+
<option value="Bermuda">Bermuda</option>
|
581 |
+
<option value="Bhutan">Bhutan</option>
|
582 |
+
<option value="Bolivia, Plurinational State of">Bolivia, Plurinational State of</option>
|
583 |
+
<option value="Bonaire, Sint Eustatius and Saba">Bonaire, Sint Eustatius and Saba</option>
|
584 |
+
<option value="Bosnia and Herzegovina">Bosnia and Herzegovina</option>
|
585 |
+
<option value="Botswana">Botswana</option>
|
586 |
+
<option value="Bouvet Island">Bouvet Island</option>
|
587 |
+
<option value="Brazil">Brazil</option>
|
588 |
+
<option value="British Indian Ocean Territory">British Indian Ocean Territory</option>
|
589 |
+
<option value="Brunei Darussalam">Brunei Darussalam</option>
|
590 |
+
<option value="Bulgaria">Bulgaria</option>
|
591 |
+
<option value="Burkina Faso">Burkina Faso</option>
|
592 |
+
<option value="Burundi">Burundi</option>
|
593 |
+
<option value="Cambodia">Cambodia</option>
|
594 |
+
<option value="Cameroon">Cameroon</option>
|
595 |
+
<option value="Canada">Canada</option>
|
596 |
+
<option value="Cape Verde">Cape Verde</option>
|
597 |
+
<option value="Cayman Islands">Cayman Islands</option>
|
598 |
+
<option value="Central African Republic">Central African Republic</option>
|
599 |
+
<option value="Chad">Chad</option>
|
600 |
+
<option value="Chile">Chile</option>
|
601 |
+
<option value="China">China</option>
|
602 |
+
<option value="Christmas Island">Christmas Island</option>
|
603 |
+
<option value="Cocos (Keeling) Islands">Cocos (Keeling) Islands</option>
|
604 |
+
<option value="Colombia">Colombia</option>
|
605 |
+
<option value="Comoros">Comoros</option>
|
606 |
+
<option value="Congo">Congo</option>
|
607 |
+
<option value="Congo, The Democratic Republic of The">Congo, The Democratic Republic of The</option>
|
608 |
+
<option value="Cook Islands">Cook Islands</option>
|
609 |
+
<option value="Costa Rica">Costa Rica</option>
|
610 |
+
<option value="Cote D'ivoire">Cote D'ivoire</option>
|
611 |
+
<option value="Croatia">Croatia</option>
|
612 |
+
<option value="Cuba">Cuba</option>
|
613 |
+
<option value="Curacao">Curacao</option>
|
614 |
+
<option value="Cyprus">Cyprus</option>
|
615 |
+
<option value="Czech Republic">Czech Republic</option>
|
616 |
+
<option value="Denmark">Denmark</option>
|
617 |
+
<option value="Djibouti">Djibouti</option>
|
618 |
+
<option value="Dominica">Dominica</option>
|
619 |
+
<option value="Dominican Republic">Dominican Republic</option>
|
620 |
+
<option value="Ecuador">Ecuador</option>
|
621 |
+
<option value="Egypt">Egypt</option>
|
622 |
+
<option value="El Salvador">El Salvador</option>
|
623 |
+
<option value="Equatorial Guinea">Equatorial Guinea</option>
|
624 |
+
<option value="Eritrea">Eritrea</option>
|
625 |
+
<option value="Estonia">Estonia</option>
|
626 |
+
<option value="Ethiopia">Ethiopia</option>
|
627 |
+
<option value="Falkland Islands (Malvinas)">Falkland Islands (Malvinas)</option>
|
628 |
+
<option value="Faroe Islands">Faroe Islands</option>
|
629 |
+
<option value="Fiji">Fiji</option>
|
630 |
+
<option value="Finland">Finland</option>
|
631 |
+
<option value="France">France</option>
|
632 |
+
<option value="French Guiana">French Guiana</option>
|
633 |
+
<option value="French Polynesia">French Polynesia</option>
|
634 |
+
<option value="French Southern Territories">French Southern Territories</option>
|
635 |
+
<option value="Gabon">Gabon</option>
|
636 |
+
<option value="Gambia">Gambia</option>
|
637 |
+
<option value="Georgia">Georgia</option>
|
638 |
+
<option value="Germany">Germany</option>
|
639 |
+
<option value="Ghana">Ghana</option>
|
640 |
+
<option value="Gibraltar">Gibraltar</option>
|
641 |
+
<option value="Greece">Greece</option>
|
642 |
+
<option value="Greenland">Greenland</option>
|
643 |
+
<option value="Grenada">Grenada</option>
|
644 |
+
<option value="Guadeloupe">Guadeloupe</option>
|
645 |
+
<option value="Guam">Guam</option>
|
646 |
+
<option value="Guatemala">Guatemala</option>
|
647 |
+
<option value="Guernsey">Guernsey</option>
|
648 |
+
<option value="Guinea">Guinea</option>
|
649 |
+
<option value="Guinea-bissau">Guinea-bissau</option>
|
650 |
+
<option value="Guyana">Guyana</option>
|
651 |
+
<option value="Haiti">Haiti</option>
|
652 |
+
<option value="Heard Island and Mcdonald Islands">Heard Island and Mcdonald Islands</option>
|
653 |
+
<option value="Holy See (Vatican City State)">Holy See (Vatican City State)</option>
|
654 |
+
<option value="Honduras">Honduras</option>
|
655 |
+
<option value="Hong Kong">Hong Kong</option>
|
656 |
+
<option value="Hungary">Hungary</option>
|
657 |
+
<option value="Iceland">Iceland</option>
|
658 |
+
<option value="India">India</option>
|
659 |
+
<option value="Indonesia">Indonesia</option>
|
660 |
+
<option value="Iran, Islamic Republic of">Iran, Islamic Republic of</option>
|
661 |
+
<option value="Iraq">Iraq</option>
|
662 |
+
<option value="Ireland">Ireland</option>
|
663 |
+
<option value="Isle of Man">Isle of Man</option>
|
664 |
+
<option value="Israel">Israel</option>
|
665 |
+
<option value="Italy">Italy</option>
|
666 |
+
<option value="Jamaica">Jamaica</option>
|
667 |
+
<option value="Japan">Japan</option>
|
668 |
+
<option value="Jersey">Jersey</option>
|
669 |
+
<option value="Jordan">Jordan</option>
|
670 |
+
<option value="Kazakhstan">Kazakhstan</option>
|
671 |
+
<option value="Kenya">Kenya</option>
|
672 |
+
<option value="Kiribati">Kiribati</option>
|
673 |
+
<option value="Korea, Democratic People's Republic of">Korea, Democratic People's Republic of</option>
|
674 |
+
<option value="Korea, Republic of">Korea, Republic of</option>
|
675 |
+
<option value="Kuwait">Kuwait</option>
|
676 |
+
<option value="Kyrgyzstan">Kyrgyzstan</option>
|
677 |
+
<option value="Lao People's Democratic Republic">Lao People's Democratic Republic</option>
|
678 |
+
<option value="Latvia">Latvia</option>
|
679 |
+
<option value="Lebanon">Lebanon</option>
|
680 |
+
<option value="Lesotho">Lesotho</option>
|
681 |
+
<option value="Liberia">Liberia</option>
|
682 |
+
<option value="Libya">Libya</option>
|
683 |
+
<option value="Liechtenstein">Liechtenstein</option>
|
684 |
+
<option value="Lithuania">Lithuania</option>
|
685 |
+
<option value="Luxembourg">Luxembourg</option>
|
686 |
+
<option value="Macao">Macao</option>
|
687 |
+
<option value="Macedonia, The Former Yugoslav Republic of">Macedonia, The Former Yugoslav Republic of</option>
|
688 |
+
<option value="Madagascar">Madagascar</option>
|
689 |
+
<option value="Malawi">Malawi</option>
|
690 |
+
<option value="Malaysia">Malaysia</option>
|
691 |
+
<option value="Maldives">Maldives</option>
|
692 |
+
<option value="Mali">Mali</option>
|
693 |
+
<option value="Malta">Malta</option>
|
694 |
+
<option value="Marshall Islands">Marshall Islands</option>
|
695 |
+
<option value="Martinique">Martinique</option>
|
696 |
+
<option value="Mauritania">Mauritania</option>
|
697 |
+
<option value="Mauritius">Mauritius</option>
|
698 |
+
<option value="Mayotte">Mayotte</option>
|
699 |
+
<option value="Mexico">Mexico</option>
|
700 |
+
<option value="Micronesia, Federated States of">Micronesia, Federated States of</option>
|
701 |
+
<option value="Moldova, Republic of">Moldova, Republic of</option>
|
702 |
+
<option value="Monaco">Monaco</option>
|
703 |
+
<option value="Mongolia">Mongolia</option>
|
704 |
+
<option value="Montenegro">Montenegro</option>
|
705 |
+
<option value="Montserrat">Montserrat</option>
|
706 |
+
<option value="Morocco">Morocco</option>
|
707 |
+
<option value="Mozambique">Mozambique</option>
|
708 |
+
<option value="Myanmar">Myanmar</option>
|
709 |
+
<option value="Namibia">Namibia</option>
|
710 |
+
<option value="Nauru">Nauru</option>
|
711 |
+
<option value="Nepal">Nepal</option>
|
712 |
+
<option value="Netherlands">Netherlands</option>
|
713 |
+
<option value="New Caledonia">New Caledonia</option>
|
714 |
+
<option value="New Zealand">New Zealand</option>
|
715 |
+
<option value="Nicaragua">Nicaragua</option>
|
716 |
+
<option value="Niger">Niger</option>
|
717 |
+
<option value="Nigeria">Nigeria</option>
|
718 |
+
<option value="Niue">Niue</option>
|
719 |
+
<option value="Norfolk Island">Norfolk Island</option>
|
720 |
+
<option value="Northern Mariana Islands">Northern Mariana Islands</option>
|
721 |
+
<option value="Norway">Norway</option>
|
722 |
+
<option value="Oman">Oman</option>
|
723 |
+
<option value="Pakistan">Pakistan</option>
|
724 |
+
<option value="Palau">Palau</option>
|
725 |
+
<option value="Palestinian Territory, Occupied">Palestinian Territory, Occupied</option>
|
726 |
+
<option value="Panama">Panama</option>
|
727 |
+
<option value="Papua New Guinea">Papua New Guinea</option>
|
728 |
+
<option value="Paraguay">Paraguay</option>
|
729 |
+
<option value="Peru">Peru</option>
|
730 |
+
<option value="Philippines">Philippines</option>
|
731 |
+
<option value="Pitcairn">Pitcairn</option>
|
732 |
+
<option value="Poland">Poland</option>
|
733 |
+
<option value="Portugal">Portugal</option>
|
734 |
+
<option value="Puerto Rico">Puerto Rico</option>
|
735 |
+
<option value="Qatar">Qatar</option>
|
736 |
+
<option value="Reunion">Reunion</option>
|
737 |
+
<option value="Romania">Romania</option>
|
738 |
+
<option value="Russian Federation">Russian Federation</option>
|
739 |
+
<option value="Rwanda">Rwanda</option>
|
740 |
+
<option value="Saint Barthelemy">Saint Barthelemy</option>
|
741 |
+
<option value="Saint Helena, Ascension and Tristan da Cunha">Saint Helena, Ascension and Tristan da Cunha</option>
|
742 |
+
<option value="Saint Kitts and Nevis">Saint Kitts and Nevis</option>
|
743 |
+
<option value="Saint Lucia">Saint Lucia</option>
|
744 |
+
<option value="Saint Martin (French part)">Saint Martin (French part)</option>
|
745 |
+
<option value="Saint Pierre and Miquelon">Saint Pierre and Miquelon</option>
|
746 |
+
<option value="Saint Vincent and The Grenadines">Saint Vincent and The Grenadines</option>
|
747 |
+
<option value="Samoa">Samoa</option>
|
748 |
+
<option value="San Marino">San Marino</option>
|
749 |
+
<option value="Sao Tome and Principe">Sao Tome and Principe</option>
|
750 |
+
<option value="Saudi Arabia">Saudi Arabia</option>
|
751 |
+
<option value="Senegal">Senegal</option>
|
752 |
+
<option value="Serbia">Serbia</option>
|
753 |
+
<option value="Seychelles">Seychelles</option>
|
754 |
+
<option value="Sierra Leone">Sierra Leone</option>
|
755 |
+
<option value="Singapore">Singapore</option>
|
756 |
+
<option value="Sint Maarten (Dutch part)">Sint Maarten (Dutch part)</option>
|
757 |
+
<option value="Slovakia">Slovakia</option>
|
758 |
+
<option value="Slovenia">Slovenia</option>
|
759 |
+
<option value="Solomon Islands">Solomon Islands</option>
|
760 |
+
<option value="Somalia">Somalia</option>
|
761 |
+
<option value="South Africa">South Africa</option>
|
762 |
+
<option value="South Georgia and The South Sandwich Islands">South Georgia and The South Sandwich Islands</option>
|
763 |
+
<option value="South Sudan">South Sudan</option>
|
764 |
+
<option value="Spain">Spain</option>
|
765 |
+
<option value="Sri Lanka">Sri Lanka</option>
|
766 |
+
<option value="Sudan">Sudan</option>
|
767 |
+
<option value="Suriname">Suriname</option>
|
768 |
+
<option value="Svalbard and Jan Mayen">Svalbard and Jan Mayen</option>
|
769 |
+
<option value="Swaziland">Swaziland</option>
|
770 |
+
<option value="Sweden">Sweden</option>
|
771 |
+
<option value="Switzerland">Switzerland</option>
|
772 |
+
<option value="Syrian Arab Republic">Syrian Arab Republic</option>
|
773 |
+
<option value="Taiwan, Province of China">Taiwan, Province of China</option>
|
774 |
+
<option value="Tajikistan">Tajikistan</option>
|
775 |
+
<option value="Tanzania, United Republic of">Tanzania, United Republic of</option>
|
776 |
+
<option value="Thailand">Thailand</option>
|
777 |
+
<option value="Timor-leste">Timor-leste</option>
|
778 |
+
<option value="Togo">Togo</option>
|
779 |
+
<option value="Tokelau">Tokelau</option>
|
780 |
+
<option value="Tonga">Tonga</option>
|
781 |
+
<option value="Trinidad and Tobago">Trinidad and Tobago</option>
|
782 |
+
<option value="Tunisia">Tunisia</option>
|
783 |
+
<option value="Turkey">Turkey</option>
|
784 |
+
<option value="Turkmenistan">Turkmenistan</option>
|
785 |
+
<option value="Turks and Caicos Islands">Turks and Caicos Islands</option>
|
786 |
+
<option value="Tuvalu">Tuvalu</option>
|
787 |
+
<option value="Uganda">Uganda</option>
|
788 |
+
<option value="Ukraine">Ukraine</option>
|
789 |
+
<option value="United Arab Emirates">United Arab Emirates</option>
|
790 |
+
<option value="United Kingdom">United Kingdom</option>
|
791 |
+
<option value="United States">United States</option>
|
792 |
+
<option value="United States Minor Outlying Islands">United States Minor Outlying Islands</option>
|
793 |
+
<option value="Uruguay">Uruguay</option>
|
794 |
+
<option value="Uzbekistan">Uzbekistan</option>
|
795 |
+
<option value="Vanuatu">Vanuatu</option>
|
796 |
+
<option value="Venezuela, Bolivarian Republic of">Venezuela, Bolivarian Republic of</option>
|
797 |
+
<option value="Viet Nam">Viet Nam</option>
|
798 |
+
<option value="Virgin Islands, British">Virgin Islands, British</option>
|
799 |
+
<option value="Virgin Islands, U.S.">Virgin Islands, U.S.</option>
|
800 |
+
<option value="Wallis and Futuna">Wallis and Futuna</option>
|
801 |
+
<option value="Western Sahara">Western Sahara</option>
|
802 |
+
<option value="Yemen">Yemen</option>
|
803 |
+
<option value="Zambia">Zambia</option>
|
804 |
+
<option value="Zimbabwe">Zimbabwe</option>
|
805 |
+
</select>
|
806 |
+
</div>
|
807 |
+
<div>
|
808 |
+
<em>Into This</em>
|
809 |
+
<select data-placeholder="Choose a Country..." class="chosen-select" multiple style="width:350px;" tabindex="4">
|
810 |
+
<option value=""></option>
|
811 |
+
<option value="United States">United States</option>
|
812 |
+
<option value="United Kingdom">United Kingdom</option>
|
813 |
+
<option value="Afghanistan">Afghanistan</option>
|
814 |
+
<option value="Aland Islands">Aland Islands</option>
|
815 |
+
<option value="Albania">Albania</option>
|
816 |
+
<option value="Algeria">Algeria</option>
|
817 |
+
<option value="American Samoa">American Samoa</option>
|
818 |
+
<option value="Andorra">Andorra</option>
|
819 |
+
<option value="Angola">Angola</option>
|
820 |
+
<option value="Anguilla">Anguilla</option>
|
821 |
+
<option value="Antarctica">Antarctica</option>
|
822 |
+
<option value="Antigua and Barbuda">Antigua and Barbuda</option>
|
823 |
+
<option value="Argentina">Argentina</option>
|
824 |
+
<option value="Armenia">Armenia</option>
|
825 |
+
<option value="Aruba">Aruba</option>
|
826 |
+
<option value="Australia">Australia</option>
|
827 |
+
<option value="Austria">Austria</option>
|
828 |
+
<option value="Azerbaijan">Azerbaijan</option>
|
829 |
+
<option value="Bahamas">Bahamas</option>
|
830 |
+
<option value="Bahrain">Bahrain</option>
|
831 |
+
<option value="Bangladesh">Bangladesh</option>
|
832 |
+
<option value="Barbados">Barbados</option>
|
833 |
+
<option value="Belarus">Belarus</option>
|
834 |
+
<option value="Belgium">Belgium</option>
|
835 |
+
<option value="Belize">Belize</option>
|
836 |
+
<option value="Benin">Benin</option>
|
837 |
+
<option value="Bermuda">Bermuda</option>
|
838 |
+
<option value="Bhutan">Bhutan</option>
|
839 |
+
<option value="Bolivia, Plurinational State of">Bolivia, Plurinational State of</option>
|
840 |
+
<option value="Bonaire, Sint Eustatius and Saba">Bonaire, Sint Eustatius and Saba</option>
|
841 |
+
<option value="Bosnia and Herzegovina">Bosnia and Herzegovina</option>
|
842 |
+
<option value="Botswana">Botswana</option>
|
843 |
+
<option value="Bouvet Island">Bouvet Island</option>
|
844 |
+
<option value="Brazil">Brazil</option>
|
845 |
+
<option value="British Indian Ocean Territory">British Indian Ocean Territory</option>
|
846 |
+
<option value="Brunei Darussalam">Brunei Darussalam</option>
|
847 |
+
<option value="Bulgaria">Bulgaria</option>
|
848 |
+
<option value="Burkina Faso">Burkina Faso</option>
|
849 |
+
<option value="Burundi">Burundi</option>
|
850 |
+
<option value="Cambodia">Cambodia</option>
|
851 |
+
<option value="Cameroon">Cameroon</option>
|
852 |
+
<option value="Canada">Canada</option>
|
853 |
+
<option value="Cape Verde">Cape Verde</option>
|
854 |
+
<option value="Cayman Islands">Cayman Islands</option>
|
855 |
+
<option value="Central African Republic">Central African Republic</option>
|
856 |
+
<option value="Chad">Chad</option>
|
857 |
+
<option value="Chile">Chile</option>
|
858 |
+
<option value="China">China</option>
|
859 |
+
<option value="Christmas Island">Christmas Island</option>
|
860 |
+
<option value="Cocos (Keeling) Islands">Cocos (Keeling) Islands</option>
|
861 |
+
<option value="Colombia">Colombia</option>
|
862 |
+
<option value="Comoros">Comoros</option>
|
863 |
+
<option value="Congo">Congo</option>
|
864 |
+
<option value="Congo, The Democratic Republic of The">Congo, The Democratic Republic of The</option>
|
865 |
+
<option value="Cook Islands">Cook Islands</option>
|
866 |
+
<option value="Costa Rica">Costa Rica</option>
|
867 |
+
<option value="Cote D'ivoire">Cote D'ivoire</option>
|
868 |
+
<option value="Croatia">Croatia</option>
|
869 |
+
<option value="Cuba">Cuba</option>
|
870 |
+
<option value="Curacao">Curacao</option>
|
871 |
+
<option value="Cyprus">Cyprus</option>
|
872 |
+
<option value="Czech Republic">Czech Republic</option>
|
873 |
+
<option value="Denmark">Denmark</option>
|
874 |
+
<option value="Djibouti">Djibouti</option>
|
875 |
+
<option value="Dominica">Dominica</option>
|
876 |
+
<option value="Dominican Republic">Dominican Republic</option>
|
877 |
+
<option value="Ecuador">Ecuador</option>
|
878 |
+
<option value="Egypt">Egypt</option>
|
879 |
+
<option value="El Salvador">El Salvador</option>
|
880 |
+
<option value="Equatorial Guinea">Equatorial Guinea</option>
|
881 |
+
<option value="Eritrea">Eritrea</option>
|
882 |
+
<option value="Estonia">Estonia</option>
|
883 |
+
<option value="Ethiopia">Ethiopia</option>
|
884 |
+
<option value="Falkland Islands (Malvinas)">Falkland Islands (Malvinas)</option>
|
885 |
+
<option value="Faroe Islands">Faroe Islands</option>
|
886 |
+
<option value="Fiji">Fiji</option>
|
887 |
+
<option value="Finland">Finland</option>
|
888 |
+
<option value="France">France</option>
|
889 |
+
<option value="French Guiana">French Guiana</option>
|
890 |
+
<option value="French Polynesia">French Polynesia</option>
|
891 |
+
<option value="French Southern Territories">French Southern Territories</option>
|
892 |
+
<option value="Gabon">Gabon</option>
|
893 |
+
<option value="Gambia">Gambia</option>
|
894 |
+
<option value="Georgia">Georgia</option>
|
895 |
+
<option value="Germany">Germany</option>
|
896 |
+
<option value="Ghana">Ghana</option>
|
897 |
+
<option value="Gibraltar">Gibraltar</option>
|
898 |
+
<option value="Greece">Greece</option>
|
899 |
+
<option value="Greenland">Greenland</option>
|
900 |
+
<option value="Grenada">Grenada</option>
|
901 |
+
<option value="Guadeloupe">Guadeloupe</option>
|
902 |
+
<option value="Guam">Guam</option>
|
903 |
+
<option value="Guatemala">Guatemala</option>
|
904 |
+
<option value="Guernsey">Guernsey</option>
|
905 |
+
<option value="Guinea">Guinea</option>
|
906 |
+
<option value="Guinea-bissau">Guinea-bissau</option>
|
907 |
+
<option value="Guyana">Guyana</option>
|
908 |
+
<option value="Haiti">Haiti</option>
|
909 |
+
<option value="Heard Island and Mcdonald Islands">Heard Island and Mcdonald Islands</option>
|
910 |
+
<option value="Holy See (Vatican City State)">Holy See (Vatican City State)</option>
|
911 |
+
<option value="Honduras">Honduras</option>
|
912 |
+
<option value="Hong Kong">Hong Kong</option>
|
913 |
+
<option value="Hungary">Hungary</option>
|
914 |
+
<option value="Iceland">Iceland</option>
|
915 |
+
<option value="India">India</option>
|
916 |
+
<option value="Indonesia">Indonesia</option>
|
917 |
+
<option value="Iran, Islamic Republic of">Iran, Islamic Republic of</option>
|
918 |
+
<option value="Iraq">Iraq</option>
|
919 |
+
<option value="Ireland">Ireland</option>
|
920 |
+
<option value="Isle of Man">Isle of Man</option>
|
921 |
+
<option value="Israel">Israel</option>
|
922 |
+
<option value="Italy">Italy</option>
|
923 |
+
<option value="Jamaica">Jamaica</option>
|
924 |
+
<option value="Japan">Japan</option>
|
925 |
+
<option value="Jersey">Jersey</option>
|
926 |
+
<option value="Jordan">Jordan</option>
|
927 |
+
<option value="Kazakhstan">Kazakhstan</option>
|
928 |
+
<option value="Kenya">Kenya</option>
|
929 |
+
<option value="Kiribati">Kiribati</option>
|
930 |
+
<option value="Korea, Democratic People's Republic of">Korea, Democratic People's Republic of</option>
|
931 |
+
<option value="Korea, Republic of">Korea, Republic of</option>
|
932 |
+
<option value="Kuwait">Kuwait</option>
|
933 |
+
<option value="Kyrgyzstan">Kyrgyzstan</option>
|
934 |
+
<option value="Lao People's Democratic Republic">Lao People's Democratic Republic</option>
|
935 |
+
<option value="Latvia">Latvia</option>
|
936 |
+
<option value="Lebanon">Lebanon</option>
|
937 |
+
<option value="Lesotho">Lesotho</option>
|
938 |
+
<option value="Liberia">Liberia</option>
|
939 |
+
<option value="Libya">Libya</option>
|
940 |
+
<option value="Liechtenstein">Liechtenstein</option>
|
941 |
+
<option value="Lithuania">Lithuania</option>
|
942 |
+
<option value="Luxembourg">Luxembourg</option>
|
943 |
+
<option value="Macao">Macao</option>
|
944 |
+
<option value="Macedonia, The Former Yugoslav Republic of">Macedonia, The Former Yugoslav Republic of</option>
|
945 |
+
<option value="Madagascar">Madagascar</option>
|
946 |
+
<option value="Malawi">Malawi</option>
|
947 |
+
<option value="Malaysia">Malaysia</option>
|
948 |
+
<option value="Maldives">Maldives</option>
|
949 |
+
<option value="Mali">Mali</option>
|
950 |
+
<option value="Malta">Malta</option>
|
951 |
+
<option value="Marshall Islands">Marshall Islands</option>
|
952 |
+
<option value="Martinique">Martinique</option>
|
953 |
+
<option value="Mauritania">Mauritania</option>
|
954 |
+
<option value="Mauritius">Mauritius</option>
|
955 |
+
<option value="Mayotte">Mayotte</option>
|
956 |
+
<option value="Mexico">Mexico</option>
|
957 |
+
<option value="Micronesia, Federated States of">Micronesia, Federated States of</option>
|
958 |
+
<option value="Moldova, Republic of">Moldova, Republic of</option>
|
959 |
+
<option value="Monaco">Monaco</option>
|
960 |
+
<option value="Mongolia">Mongolia</option>
|
961 |
+
<option value="Montenegro">Montenegro</option>
|
962 |
+
<option value="Montserrat">Montserrat</option>
|
963 |
+
<option value="Morocco">Morocco</option>
|
964 |
+
<option value="Mozambique">Mozambique</option>
|
965 |
+
<option value="Myanmar">Myanmar</option>
|
966 |
+
<option value="Namibia">Namibia</option>
|
967 |
+
<option value="Nauru">Nauru</option>
|
968 |
+
<option value="Nepal">Nepal</option>
|
969 |
+
<option value="Netherlands">Netherlands</option>
|
970 |
+
<option value="New Caledonia">New Caledonia</option>
|
971 |
+
<option value="New Zealand">New Zealand</option>
|
972 |
+
<option value="Nicaragua">Nicaragua</option>
|
973 |
+
<option value="Niger">Niger</option>
|
974 |
+
<option value="Nigeria">Nigeria</option>
|
975 |
+
<option value="Niue">Niue</option>
|
976 |
+
<option value="Norfolk Island">Norfolk Island</option>
|
977 |
+
<option value="Northern Mariana Islands">Northern Mariana Islands</option>
|
978 |
+
<option value="Norway">Norway</option>
|
979 |
+
<option value="Oman">Oman</option>
|
980 |
+
<option value="Pakistan">Pakistan</option>
|
981 |
+
<option value="Palau">Palau</option>
|
982 |
+
<option value="Palestinian Territory, Occupied">Palestinian Territory, Occupied</option>
|
983 |
+
<option value="Panama">Panama</option>
|
984 |
+
<option value="Papua New Guinea">Papua New Guinea</option>
|
985 |
+
<option value="Paraguay">Paraguay</option>
|
986 |
+
<option value="Peru">Peru</option>
|
987 |
+
<option value="Philippines">Philippines</option>
|
988 |
+
<option value="Pitcairn">Pitcairn</option>
|
989 |
+
<option value="Poland">Poland</option>
|
990 |
+
<option value="Portugal">Portugal</option>
|
991 |
+
<option value="Puerto Rico">Puerto Rico</option>
|
992 |
+
<option value="Qatar">Qatar</option>
|
993 |
+
<option value="Reunion">Reunion</option>
|
994 |
+
<option value="Romania">Romania</option>
|
995 |
+
<option value="Russian Federation">Russian Federation</option>
|
996 |
+
<option value="Rwanda">Rwanda</option>
|
997 |
+
<option value="Saint Barthelemy">Saint Barthelemy</option>
|
998 |
+
<option value="Saint Helena, Ascension and Tristan da Cunha">Saint Helena, Ascension and Tristan da Cunha</option>
|
999 |
+
<option value="Saint Kitts and Nevis">Saint Kitts and Nevis</option>
|
1000 |
+
<option value="Saint Lucia">Saint Lucia</option>
|
1001 |
+
<option value="Saint Martin (French part)">Saint Martin (French part)</option>
|
1002 |
+
<option value="Saint Pierre and Miquelon">Saint Pierre and Miquelon</option>
|
1003 |
+
<option value="Saint Vincent and The Grenadines">Saint Vincent and The Grenadines</option>
|
1004 |
+
<option value="Samoa">Samoa</option>
|
1005 |
+
<option value="San Marino">San Marino</option>
|
1006 |
+
<option value="Sao Tome and Principe">Sao Tome and Principe</option>
|
1007 |
+
<option value="Saudi Arabia">Saudi Arabia</option>
|
1008 |
+
<option value="Senegal">Senegal</option>
|
1009 |
+
<option value="Serbia">Serbia</option>
|
1010 |
+
<option value="Seychelles">Seychelles</option>
|
1011 |
+
<option value="Sierra Leone">Sierra Leone</option>
|
1012 |
+
<option value="Singapore">Singapore</option>
|
1013 |
+
<option value="Sint Maarten (Dutch part)">Sint Maarten (Dutch part)</option>
|
1014 |
+
<option value="Slovakia">Slovakia</option>
|
1015 |
+
<option value="Slovenia">Slovenia</option>
|
1016 |
+
<option value="Solomon Islands">Solomon Islands</option>
|
1017 |
+
<option value="Somalia">Somalia</option>
|
1018 |
+
<option value="South Africa">South Africa</option>
|
1019 |
+
<option value="South Georgia and The South Sandwich Islands">South Georgia and The South Sandwich Islands</option>
|
1020 |
+
<option value="South Sudan">South Sudan</option>
|
1021 |
+
<option value="Spain">Spain</option>
|
1022 |
+
<option value="Sri Lanka">Sri Lanka</option>
|
1023 |
+
<option value="Sudan">Sudan</option>
|
1024 |
+
<option value="Suriname">Suriname</option>
|
1025 |
+
<option value="Svalbard and Jan Mayen">Svalbard and Jan Mayen</option>
|
1026 |
+
<option value="Swaziland">Swaziland</option>
|
1027 |
+
<option value="Sweden">Sweden</option>
|
1028 |
+
<option value="Switzerland">Switzerland</option>
|
1029 |
+
<option value="Syrian Arab Republic">Syrian Arab Republic</option>
|
1030 |
+
<option value="Taiwan, Province of China">Taiwan, Province of China</option>
|
1031 |
+
<option value="Tajikistan">Tajikistan</option>
|
1032 |
+
<option value="Tanzania, United Republic of">Tanzania, United Republic of</option>
|
1033 |
+
<option value="Thailand">Thailand</option>
|
1034 |
+
<option value="Timor-leste">Timor-leste</option>
|
1035 |
+
<option value="Togo">Togo</option>
|
1036 |
+
<option value="Tokelau">Tokelau</option>
|
1037 |
+
<option value="Tonga">Tonga</option>
|
1038 |
+
<option value="Trinidad and Tobago">Trinidad and Tobago</option>
|
1039 |
+
<option value="Tunisia">Tunisia</option>
|
1040 |
+
<option value="Turkey">Turkey</option>
|
1041 |
+
<option value="Turkmenistan">Turkmenistan</option>
|
1042 |
+
<option value="Turks and Caicos Islands">Turks and Caicos Islands</option>
|
1043 |
+
<option value="Tuvalu">Tuvalu</option>
|
1044 |
+
<option value="Uganda">Uganda</option>
|
1045 |
+
<option value="Ukraine">Ukraine</option>
|
1046 |
+
<option value="United Arab Emirates">United Arab Emirates</option>
|
1047 |
+
<option value="United Kingdom">United Kingdom</option>
|
1048 |
+
<option value="United States">United States</option>
|
1049 |
+
<option value="United States Minor Outlying Islands">United States Minor Outlying Islands</option>
|
1050 |
+
<option value="Uruguay">Uruguay</option>
|
1051 |
+
<option value="Uzbekistan">Uzbekistan</option>
|
1052 |
+
<option value="Vanuatu">Vanuatu</option>
|
1053 |
+
<option value="Venezuela, Bolivarian Republic of">Venezuela, Bolivarian Republic of</option>
|
1054 |
+
<option value="Viet Nam">Viet Nam</option>
|
1055 |
+
<option value="Virgin Islands, British">Virgin Islands, British</option>
|
1056 |
+
<option value="Virgin Islands, U.S.">Virgin Islands, U.S.</option>
|
1057 |
+
<option value="Wallis and Futuna">Wallis and Futuna</option>
|
1058 |
+
<option value="Western Sahara">Western Sahara</option>
|
1059 |
+
<option value="Yemen">Yemen</option>
|
1060 |
+
<option value="Zambia">Zambia</option>
|
1061 |
+
<option value="Zimbabwe">Zimbabwe</option>
|
1062 |
+
</select>
|
1063 |
+
</div>
|
1064 |
+
</div>
|
1065 |
+
|
1066 |
+
<h2><a name="optgroup-support" class="anchor" href="#optgroup-support"><optgroup> Support</a></h2>
|
1067 |
+
<div class="side-by-side clearfix">
|
1068 |
+
<div>
|
1069 |
+
<em>Single Select with Groups</em>
|
1070 |
+
<select data-placeholder="Your Favorite Football Team" style="width:350px;" class="chosen-select" tabindex="5">
|
1071 |
+
<option value=""></option>
|
1072 |
+
<optgroup label="NFC EAST">
|
1073 |
+
<option>Dallas Cowboys</option>
|
1074 |
+
<option>New York Giants</option>
|
1075 |
+
<option>Philadelphia Eagles</option>
|
1076 |
+
<option>Washington Redskins</option>
|
1077 |
+
</optgroup>
|
1078 |
+
<optgroup label="NFC NORTH">
|
1079 |
+
<option>Chicago Bears</option>
|
1080 |
+
<option>Detroit Lions</option>
|
1081 |
+
<option>Green Bay Packers</option>
|
1082 |
+
<option>Minnesota Vikings</option>
|
1083 |
+
</optgroup>
|
1084 |
+
<optgroup label="NFC SOUTH">
|
1085 |
+
<option>Atlanta Falcons</option>
|
1086 |
+
<option>Carolina Panthers</option>
|
1087 |
+
<option>New Orleans Saints</option>
|
1088 |
+
<option>Tampa Bay Buccaneers</option>
|
1089 |
+
</optgroup>
|
1090 |
+
<optgroup label="NFC WEST">
|
1091 |
+
<option>Arizona Cardinals</option>
|
1092 |
+
<option>St. Louis Rams</option>
|
1093 |
+
<option>San Francisco 49ers</option>
|
1094 |
+
<option>Seattle Seahawks</option>
|
1095 |
+
</optgroup>
|
1096 |
+
<optgroup label="AFC EAST">
|
1097 |
+
<option>Buffalo Bills</option>
|
1098 |
+
<option>Miami Dolphins</option>
|
1099 |
+
<option>New England Patriots</option>
|
1100 |
+
<option>New York Jets</option>
|
1101 |
+
</optgroup>
|
1102 |
+
<optgroup label="AFC NORTH">
|
1103 |
+
<option>Baltimore Ravens</option>
|
1104 |
+
<option>Cincinnati Bengals</option>
|
1105 |
+
<option>Cleveland Browns</option>
|
1106 |
+
<option>Pittsburgh Steelers</option>
|
1107 |
+
</optgroup>
|
1108 |
+
<optgroup label="AFC SOUTH">
|
1109 |
+
<option>Houston Texans</option>
|
1110 |
+
<option>Indianapolis Colts</option>
|
1111 |
+
<option>Jacksonville Jaguars</option>
|
1112 |
+
<option>Tennessee Titans</option>
|
1113 |
+
</optgroup>
|
1114 |
+
<optgroup label="AFC WEST">
|
1115 |
+
<option>Denver Broncos</option>
|
1116 |
+
<option>Kansas City Chiefs</option>
|
1117 |
+
<option>Oakland Raiders</option>
|
1118 |
+
<option>San Diego Chargers</option>
|
1119 |
+
</optgroup>
|
1120 |
+
</select>
|
1121 |
+
</div>
|
1122 |
+
<div>
|
1123 |
+
<em>Multiple Select with Groups</em>
|
1124 |
+
<select data-placeholder="Your Favorite Football Team" style="width:350px;" class="chosen-select" multiple tabindex="6">
|
1125 |
+
<option value=""></option>
|
1126 |
+
<optgroup label="NFC EAST">
|
1127 |
+
<option>Dallas Cowboys</option>
|
1128 |
+
<option>New York Giants</option>
|
1129 |
+
<option>Philadelphia Eagles</option>
|
1130 |
+
<option>Washington Redskins</option>
|
1131 |
+
</optgroup>
|
1132 |
+
<optgroup label="NFC NORTH">
|
1133 |
+
<option>Chicago Bears</option>
|
1134 |
+
<option>Detroit Lions</option>
|
1135 |
+
<option>Green Bay Packers</option>
|
1136 |
+
<option>Minnesota Vikings</option>
|
1137 |
+
</optgroup>
|
1138 |
+
<optgroup label="NFC SOUTH">
|
1139 |
+
<option>Atlanta Falcons</option>
|
1140 |
+
<option>Carolina Panthers</option>
|
1141 |
+
<option>New Orleans Saints</option>
|
1142 |
+
<option>Tampa Bay Buccaneers</option>
|
1143 |
+
</optgroup>
|
1144 |
+
<optgroup label="NFC WEST">
|
1145 |
+
<option>Arizona Cardinals</option>
|
1146 |
+
<option>St. Louis Rams</option>
|
1147 |
+
<option>San Francisco 49ers</option>
|
1148 |
+
<option>Seattle Seahawks</option>
|
1149 |
+
</optgroup>
|
1150 |
+
<optgroup label="AFC EAST">
|
1151 |
+
<option>Buffalo Bills</option>
|
1152 |
+
<option>Miami Dolphins</option>
|
1153 |
+
<option>New England Patriots</option>
|
1154 |
+
<option>New York Jets</option>
|
1155 |
+
</optgroup>
|
1156 |
+
<optgroup label="AFC NORTH">
|
1157 |
+
<option>Baltimore Ravens</option>
|
1158 |
+
<option>Cincinnati Bengals</option>
|
1159 |
+
<option>Cleveland Browns</option>
|
1160 |
+
<option>Pittsburgh Steelers</option>
|
1161 |
+
</optgroup>
|
1162 |
+
<optgroup label="AFC SOUTH">
|
1163 |
+
<option>Houston Texans</option>
|
1164 |
+
<option>Indianapolis Colts</option>
|
1165 |
+
<option>Jacksonville Jaguars</option>
|
1166 |
+
<option>Tennessee Titans</option>
|
1167 |
+
</optgroup>
|
1168 |
+
<optgroup label="AFC WEST">
|
1169 |
+
<option>Denver Broncos</option>
|
1170 |
+
<option>Kansas City Chiefs</option>
|
1171 |
+
<option>Oakland Raiders</option>
|
1172 |
+
<option>San Diego Chargers</option>
|
1173 |
+
</optgroup>
|
1174 |
+
</select>
|
1175 |
+
</div>
|
1176 |
+
</div>
|
1177 |
+
|
1178 |
+
<h2><a name="selected-and-disabled-support" class="anchor" href="#selected-and-disabled-support">Selected and Disabled Support</a></h2>
|
1179 |
+
<div class="side-by-side clearfix">
|
1180 |
+
<p>Chosen automatically highlights selected options and removes disabled options.</p>
|
1181 |
+
<div>
|
1182 |
+
<em>Single Select</em>
|
1183 |
+
<select data-placeholder="Your Favorite Type of Bear" style="width:350px;" class="chosen-select" tabindex="7">
|
1184 |
+
<option value=""></option>
|
1185 |
+
<option>American Black Bear</option>
|
1186 |
+
<option>Asiatic Black Bear</option>
|
1187 |
+
<option>Brown Bear</option>
|
1188 |
+
<option>Giant Panda</option>
|
1189 |
+
<option selected>Sloth Bear</option>
|
1190 |
+
<option disabled>Sun Bear</option>
|
1191 |
+
<option>Polar Bear</option>
|
1192 |
+
<option disabled>Spectacled Bear</option>
|
1193 |
+
</select>
|
1194 |
+
</div>
|
1195 |
+
<div>
|
1196 |
+
<em>Multiple Select</em>
|
1197 |
+
<select data-placeholder="Your Favorite Types of Bear" style="width:350px;" multiple class="chosen-select" tabindex="8">
|
1198 |
+
<option value=""></option>
|
1199 |
+
<option>American Black Bear</option>
|
1200 |
+
<option>Asiatic Black Bear</option>
|
1201 |
+
<option>Brown Bear</option>
|
1202 |
+
<option>Giant Panda</option>
|
1203 |
+
<option selected>Sloth Bear</option>
|
1204 |
+
<option disabled>Sun Bear</option>
|
1205 |
+
<option selected>Polar Bear</option>
|
1206 |
+
<option disabled>Spectacled Bear</option>
|
1207 |
+
</select>
|
1208 |
+
</div>
|
1209 |
+
</div>
|
1210 |
+
|
1211 |
+
<h2><a name="hide-search-on-single-select" class="anchor" href="#hide-search-on-single-select">Hide Search on Single Select</a></h2>
|
1212 |
+
<div class="side-by-side clearfix">
|
1213 |
+
<p>The disable_search_threshold option can be specified to hide the search input on single selects if there are fewer than (n) options.</p>
|
1214 |
+
<pre><code class="language-javascript"> new Chosen($("chosen_select_field"),{disable_search_threshold: 10}); </code></pre>
|
1215 |
+
<p></p>
|
1216 |
+
<div>
|
1217 |
+
<select data-placeholder="Your Favorite Type of Bear" style="width:350px;" class="chosen-select-no-single" tabindex="9">
|
1218 |
+
<option value=""></option>
|
1219 |
+
<option>American Black Bear</option>
|
1220 |
+
<option>Asiatic Black Bear</option>
|
1221 |
+
<option>Brown Bear</option>
|
1222 |
+
<option>Giant Panda</option>
|
1223 |
+
<option selected disabled>Sloth Bear</option>
|
1224 |
+
<option disabled>Sun Bear</option>
|
1225 |
+
<option selected>Paddington Bear</option>
|
1226 |
+
<option selected>Polar Bear</option>
|
1227 |
+
<option disabled>Spectacled Bear</option>
|
1228 |
+
</select>
|
1229 |
+
</div>
|
1230 |
+
</div>
|
1231 |
+
|
1232 |
+
<h2><a name="default-text-support" class="anchor" href="#default-text-support">Default Text Support</a></h2>
|
1233 |
+
<div class="side-by-side clearfix">
|
1234 |
+
<p>Chosen automatically sets the default field text ("Choose a country...") by reading the select element's data-placeholder value. If no data-placeholder value is present, it will default to "Select an Option" or "Select Some Options" depending on whether the select is single or multiple. You can change these elements in the plugin js file as you see fit.</p>
|
1235 |
+
<pre><code class="language-markup"><select <strong>data-placeholder="Choose a country..."</strong> style="width:350px;" multiple class="chosen-select"></code></pre>
|
1236 |
+
<p><strong>Note:</strong> on single selects, the first element is assumed to be selected by the browser. To take advantage of the default text support, you will need to include a blank option as the first element of your select list.</p>
|
1237 |
+
</div>
|
1238 |
+
|
1239 |
+
<h2><a name="no-results-text-support" class="anchor" href="#no-results-text-support">No Results Text Support</a></h2>
|
1240 |
+
<div class="side-by-side clearfix">
|
1241 |
+
<p>Setting the "No results" search text is as easy as passing an option when you create Chosen:</p>
|
1242 |
+
<pre><code class="language-javascript">new Chosen($("chosen_select_field"),{no_results_text: "Oops, nothing found!"}); </code></pre>
|
1243 |
+
|
1244 |
+
<div>
|
1245 |
+
<em>Single Select</em>
|
1246 |
+
<select data-placeholder="Type 'C' to view" style="width:350px;" class="chosen-select-no-results" tabindex="10">
|
1247 |
+
<option value=""></option>
|
1248 |
+
<option>American Black Bear</option>
|
1249 |
+
<option>Asiatic Black Bear</option>
|
1250 |
+
<option>Brown Bear</option>
|
1251 |
+
<option>Giant Panda</option>
|
1252 |
+
<option>Sloth Bear</option>
|
1253 |
+
<option>Sun Bear</option>
|
1254 |
+
<option>Polar Bear</option>
|
1255 |
+
<option>Spectacled Bear</option>
|
1256 |
+
</select>
|
1257 |
+
</div>
|
1258 |
+
<div>
|
1259 |
+
<em>Multiple Select</em>
|
1260 |
+
<select data-placeholder="Type 'C' to view" style="width:350px;" multiple class="chosen-select-no-results" tabindex="11">
|
1261 |
+
<option value=""></option>
|
1262 |
+
<option>American Black Bear</option>
|
1263 |
+
<option>Asiatic Black Bear</option>
|
1264 |
+
<option>Brown Bear</option>
|
1265 |
+
<option>Giant Panda</option>
|
1266 |
+
<option>Sloth Bear</option>
|
1267 |
+
<option>Sun Bear</option>
|
1268 |
+
<option>Polar Bear</option>
|
1269 |
+
<option>Spectacled Bear</option>
|
1270 |
+
</select>
|
1271 |
+
</div>
|
1272 |
+
</div>
|
1273 |
+
|
1274 |
+
<h2><a name="limit-selected-options-in-multiselect" class="anchor" href="#limit-selected-options-in-multiselect">Limit Selected Options in Multiselect</a></h2>
|
1275 |
+
<div class="side-by-side clearfix">
|
1276 |
+
<p>You can easily limit how many options the user can select:</p>
|
1277 |
+
<pre><code class="language-javascript">new Chosen($("chosen_select_field"),{max_selected_options: 5}); </code></pre>
|
1278 |
+
<p>If you try to select another option with limit reached <code>chosen:maxselected</code> event is triggered:</p>
|
1279 |
+
<pre><code class="language-javascript">$("chosen_select_field").observe("chosen:maxselected", function(evt) { ... }); </code></pre>
|
1280 |
+
</div>
|
1281 |
+
|
1282 |
+
<h2><a name="allow-deselect-on-single-selects" class="anchor" href="#allow-deselect-on-single-selects">Allow Deselect on Single Selects</a></h2>
|
1283 |
+
<div class="side-by-side clearfix">
|
1284 |
+
<p>When a single select box isn't a required field, you can set <code class="language-javascript">allow_single_deselect: true</code> and Chosen will add a UI element for option deselection. This will only work if the first option has blank text.</p>
|
1285 |
+
<div class="side-by-side clearfix">
|
1286 |
+
<select data-placeholder="Your Favorite Type of Bear" style="width:350px;" class="chosen-select-deselect" tabindex="12">
|
1287 |
+
<option value=""></option>
|
1288 |
+
<option>American Black Bear</option>
|
1289 |
+
<option>Asiatic Black Bear</option>
|
1290 |
+
<option>Brown Bear</option>
|
1291 |
+
<option>Giant Panda</option>
|
1292 |
+
<option selected>Sloth Bear</option>
|
1293 |
+
<option>Sun Bear</option>
|
1294 |
+
<option>Polar Bear</option>
|
1295 |
+
<option>Spectacled Bear</option>
|
1296 |
+
</select>
|
1297 |
+
</div>
|
1298 |
+
</div>
|
1299 |
+
|
1300 |
+
<h2><a name="right-to-left-support" class="anchor" href="#right-to-left-support">Right to Left Support</a></h2>
|
1301 |
+
<div class="side-by-side clearfix">
|
1302 |
+
<p>Chosen supports right to left select boxes too. just add <code class="language-markup">"chosen-rtl"</code> in addition to <code class="language-markup">"chosen-select"</code> to your select tags and you are good to go.</p>
|
1303 |
+
<pre><code class="language-markup"><select class="chosen-select <strong>chosen-rtl</strong>"></code></pre>
|
1304 |
+
<div>
|
1305 |
+
<em>Single right to left select</em>
|
1306 |
+
<select data-placeholder="Your Favorite Type of Bear" style="width:350px;" class="chosen-select chosen-rtl" tabindex="13">
|
1307 |
+
<option value=""></option>
|
1308 |
+
<option>American Black Bear</option>
|
1309 |
+
<option>Asiatic Black Bear</option>
|
1310 |
+
<option>Brown Bear</option>
|
1311 |
+
<option>Giant Panda</option>
|
1312 |
+
<option selected>Sloth Bear</option>
|
1313 |
+
<option>Polar Bear</option>
|
1314 |
+
</select>
|
1315 |
+
</div>
|
1316 |
+
<div>
|
1317 |
+
<em>Multiple right to left select</em>
|
1318 |
+
<select data-placeholder="Your Favorite Types of Bear" style="width:350px;" multiple class="chosen-select chosen-rtl" tabindex="14">
|
1319 |
+
<option value=""></option>
|
1320 |
+
<option>American Black Bear</option>
|
1321 |
+
<option>Asiatic Black Bear</option>
|
1322 |
+
<option>Brown Bear</option>
|
1323 |
+
<option>Giant Panda</option>
|
1324 |
+
<option selected>Sloth Bear</option>
|
1325 |
+
<option selected>Polar Bear</option>
|
1326 |
+
</select>
|
1327 |
+
</div>
|
1328 |
+
</div>
|
1329 |
+
|
1330 |
+
<h2><a name="change-update-events" class="anchor" href="#change-update-events">Change / Update Events</a></h2>
|
1331 |
+
<div class="side-by-side clearfix">
|
1332 |
+
<ul>
|
1333 |
+
<li>
|
1334 |
+
<h3>Form Field Change</h3>
|
1335 |
+
<p>When working with form fields, you often want to perform some behavior after a value has been selected or deselected. Whenever a user selects a field in Chosen, it triggers a "change" event* on the original form field. That let's you do something like this:</p>
|
1336 |
+
<pre><code class="language-javascript">$("#form_field").chosen().change( … );</code></pre>
|
1337 |
+
<p><strong>Note:</strong> Prototype doesn't offer support for triggering standard browser events. <a href="https://github.com/kangax/protolicious/blob/5b56fdafcd7d7662c9d648534225039b2e78e371/event.simulate.js">Event.simulate</a> is required to trigger the change event when using the Prototype version.</p>
|
1338 |
+
</li>
|
1339 |
+
<li>
|
1340 |
+
<h3>Updating Chosen Dynamically</h3>
|
1341 |
+
<p>If you need to update the options in your select field and want Chosen to pick up the changes, you'll need to trigger the "chosen:updated" event on the field. Chosen will re-build itself based on the updated content.</p>
|
1342 |
+
<pre><code class="language-javascript">Event.fire($("form_field"), "chosen:updated");</code></pre>
|
1343 |
+
</li>
|
1344 |
+
</ul>
|
1345 |
+
</div>
|
1346 |
+
|
1347 |
+
<h2><a name="custom-width-support" class="anchor" href="#custom-width-support">Custom Width Support</a></h2>
|
1348 |
+
<div class="side-by-side clearfix">
|
1349 |
+
<p>Using a custom width with Chosen is as easy as passing an option when you create Chosen:</p>
|
1350 |
+
<pre><code class="language-javascript">new Chosen($("chosen_select_field"),{width: "95%"}); </code></pre>
|
1351 |
+
<div>
|
1352 |
+
<em>Single Select</em>
|
1353 |
+
<select data-placeholder="Your Favorite Types of Bear" class="chosen-select-width" tabindex="15">
|
1354 |
+
<option value=""></option>
|
1355 |
+
<option selected>American Black Bear</option>
|
1356 |
+
<option>Asiatic Black Bear</option>
|
1357 |
+
<option>Brown Bear</option>
|
1358 |
+
<option>Giant Panda</option>
|
1359 |
+
<option>Sloth Bear</option>
|
1360 |
+
<option>Sun Bear</option>
|
1361 |
+
<option>Polar Bear</option>
|
1362 |
+
<option>Spectacled Bear</option>
|
1363 |
+
</select>
|
1364 |
+
</div>
|
1365 |
+
<div>
|
1366 |
+
<em>Multiple Select</em>
|
1367 |
+
<select data-placeholder="Your Favorite Types of Bear" multiple class="chosen-select-width" tabindex="16">
|
1368 |
+
<option value=""></option>
|
1369 |
+
<option>American Black Bear</option>
|
1370 |
+
<option>Asiatic Black Bear</option>
|
1371 |
+
<option>Brown Bear</option>
|
1372 |
+
<option selected>Giant Panda</option>
|
1373 |
+
<option>Sloth Bear</option>
|
1374 |
+
<option>Sun Bear</option>
|
1375 |
+
<option>Polar Bear</option>
|
1376 |
+
<option>Spectacled Bear</option>
|
1377 |
+
</select>
|
1378 |
+
</div>
|
1379 |
+
</div>
|
1380 |
+
|
1381 |
+
<h2><a name="labels-work-too" class="anchor" href="#labels-work-too">Labels work, too</a></h2>
|
1382 |
+
<div class="side-by-side clearfix">
|
1383 |
+
<p>Use labels just like you would a standard select</p>
|
1384 |
+
<p></p>
|
1385 |
+
<div>
|
1386 |
+
<em><label for="single-label-example">Click to Highlight Single Select</label></em>
|
1387 |
+
<select data-placeholder="Your Favorite Types of Bear" class="chosen-select" style="width:350px;" tabindex="17" id="single-label-example">
|
1388 |
+
<option value=""></option>
|
1389 |
+
<option selected>American Black Bear</option>
|
1390 |
+
<option>Asiatic Black Bear</option>
|
1391 |
+
<option>Brown Bear</option>
|
1392 |
+
<option>Giant Panda</option>
|
1393 |
+
<option>Sloth Bear</option>
|
1394 |
+
<option>Sun Bear</option>
|
1395 |
+
<option>Polar Bear</option>
|
1396 |
+
<option>Spectacled Bear</option>
|
1397 |
+
</select>
|
1398 |
+
</div>
|
1399 |
+
<div>
|
1400 |
+
<em><label for="multiple-label-example">Click to Highlight Multiple Select</label></em>
|
1401 |
+
<select data-placeholder="Your Favorite Types of Bear" multiple class="chosen-select" style="width:350px;" tabindex="18" id="multiple-label-example">
|
1402 |
+
<option value=""></option>
|
1403 |
+
<option>American Black Bear</option>
|
1404 |
+
<option>Asiatic Black Bear</option>
|
1405 |
+
<option>Brown Bear</option>
|
1406 |
+
<option selected>Giant Panda</option>
|
1407 |
+
<option>Sloth Bear</option>
|
1408 |
+
<option>Sun Bear</option>
|
1409 |
+
<option>Polar Bear</option>
|
1410 |
+
<option>Spectacled Bear</option>
|
1411 |
+
</select>
|
1412 |
+
</div>
|
1413 |
+
</div>
|
1414 |
+
|
1415 |
+
<h2><a name="setup" class="anchor" href="#setup">Setup</a></h2>
|
1416 |
+
<p>Using Chosen is easy as can be.</p>
|
1417 |
+
<ol>
|
1418 |
+
<li><a href="https://github.com/harvesthq/chosen/releases">Download</a> the plugin and copy the chosen files to your app.</li>
|
1419 |
+
<li>Activate the plugin by creating a new instance of Chosen: New Chosen(<em>some_form_field</em>,<em>some_options</em>);</li>
|
1420 |
+
<li><a href="http://www.youtube.com/watch?feature=player_detailpage&v=UkSPUDpe0U8#t=11s">Disco</a>.</li>
|
1421 |
+
</ol>
|
1422 |
+
|
1423 |
+
<h2><a name="faqs" class="anchor" href="#faqs">FAQs</a></h2>
|
1424 |
+
<ul class="faqs">
|
1425 |
+
<li>
|
1426 |
+
<h3>Do you have all the available options documented somewhere?</h3>
|
1427 |
+
<p>Yes! You can find them on <a href="options.html">the options page</a>.</p>
|
1428 |
+
</li>
|
1429 |
+
<li>
|
1430 |
+
<h3>Something doesn't work. Can you fix it?</h3>
|
1431 |
+
<p>Yes! Please report all issues using the <a href="http://github.com/harvesthq/chosen/issues">GitHub issue tracking tool</a>. Please include the plugin version (jQuery or Prototype), browser and OS. The more information provided, the easier it is to fix a problem.</p>
|
1432 |
+
</li>
|
1433 |
+
<li>
|
1434 |
+
<h3>What browsers are supported?</h3>
|
1435 |
+
<p>All modern desktop browsers are supported (Firefox, Chrome, Safari and IE9). Legacy support for IE8 is also enabled. Chosen is disabled on iPhone, iPod Touch, and Android mobile devices (<a href="https://github.com/harvesthq/chosen/pull/1388">more information</a>).</p>
|
1436 |
+
</li>
|
1437 |
+
</ul>
|
1438 |
+
|
1439 |
+
<h2><a name="credits" class="anchor" href="#credits">Credits</a></h2>
|
1440 |
+
|
1441 |
+
<ul class="credits">
|
1442 |
+
<li>Concept and development by <a href="http://patrickfiller.com">Patrick Filler</a> for <a href="https://getharvest.com">Harvest</a>.</li>
|
1443 |
+
<li>Design and CSS by <a href="http://matthewlettini.com">Matthew Lettini</a>.</li>
|
1444 |
+
<li>Repository maintained by <a href="https://github.com/pfiller">@pfiller</a>, <a href="https://github.com/kenearley">@kenearley</a>, <a href="https://github.com/stof">@stof</a>, <a href="https://github.com/koenpunt">@koenpunt</a>, and <a href="https://github.com/tjschuck">@tjschuck</a>.</li>
|
1445 |
+
<li>Chosen includes <a href="https://github.com/harvesthq/chosen/contributors">contributions by many fine folks</a>.</li>
|
1446 |
+
</ul>
|
1447 |
+
|
1448 |
+
<footer>
|
1449 |
+
© 2011–2015 <a href="http://www.getharvest.com/">Harvest</a>. Chosen is licensed under the <a href="https://github.com/harvesthq/chosen/blob/master/LICENSE.md">MIT license</a>.
|
1450 |
+
</footer>
|
1451 |
+
|
1452 |
+
</div>
|
1453 |
+
</div>
|
1454 |
+
<script src="https://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js" type="text/javascript"></script>
|
1455 |
+
<script src="chosen.proto.js" type="text/javascript"></script>
|
1456 |
+
<script src="docsupport/prism.js" type="text/javascript" charset="utf-8"></script>
|
1457 |
+
<script type="text/javascript">
|
1458 |
+
document.observe('dom:loaded', function(evt) {
|
1459 |
+
var config = {
|
1460 |
+
'.chosen-select' : {},
|
1461 |
+
'.chosen-select-deselect' : {allow_single_deselect:true},
|
1462 |
+
'.chosen-select-no-single' : {disable_search_threshold:10},
|
1463 |
+
'.chosen-select-no-results': {no_results_text: "Oops, nothing found!"},
|
1464 |
+
'.chosen-select-width' : {width: "95%"}
|
1465 |
+
}
|
1466 |
+
var results = [];
|
1467 |
+
for (var selector in config) {
|
1468 |
+
var elements = $$(selector);
|
1469 |
+
for (var i = 0; i < elements.length; i++) {
|
1470 |
+
results.push(new Chosen(elements[i],config[selector]));
|
1471 |
+
}
|
1472 |
+
}
|
1473 |
+
return results;
|
1474 |
+
});
|
1475 |
+
</script>
|
1476 |
+
<div class="oss-bar">
|
1477 |
+
<ul>
|
1478 |
+
<li><a class="fork" href="https://github.com/harvesthq/chosen">Fork on Github</a></li>
|
1479 |
+
<li><a class="harvest" href="http://www.getharvest.com/">Built by Harvest</a></li>
|
1480 |
+
</ul>
|
1481 |
+
</div>
|
1482 |
+
</body>
|
1483 |
+
</html>
|
assets/lib/chosen_v1.4.2/options.html
ADDED
@@ -0,0 +1,276 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!doctype html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="utf-8">
|
5 |
+
<title>Chosen: A jQuery Plugin by Harvest to Tame Unwieldy Select Boxes</title>
|
6 |
+
<link rel="stylesheet" href="docsupport/style.css">
|
7 |
+
<link rel="stylesheet" href="docsupport/prism.css">
|
8 |
+
<link rel="stylesheet" href="chosen.css">
|
9 |
+
<style type="text/css" media="all">
|
10 |
+
/* fix rtl for demo */
|
11 |
+
.chosen-rtl .chosen-drop { left: -9000px; }
|
12 |
+
</style>
|
13 |
+
</head>
|
14 |
+
<body>
|
15 |
+
<div id="container">
|
16 |
+
<div id="content">
|
17 |
+
<header>
|
18 |
+
<h1>Chosen <small>(<span id="latest-version">v1.4.2</span>)</small></h1>
|
19 |
+
</header>
|
20 |
+
<p>Chosen has a number of options and attributes that allow you to have full control of your select boxes.</p>
|
21 |
+
|
22 |
+
<h2><a name="options" class="anchor" href="#options">Options</a></h2>
|
23 |
+
<p>The following options are available to pass into Chosen on instantiation.</p>
|
24 |
+
|
25 |
+
<h3>Example:</h3>
|
26 |
+
<pre>
|
27 |
+
<code class="language-javascript">$(".my_select_box").chosen({
|
28 |
+
disable_search_threshold: 10,
|
29 |
+
no_results_text: "Oops, nothing found!",
|
30 |
+
width: "95%"
|
31 |
+
});</code>
|
32 |
+
</pre>
|
33 |
+
|
34 |
+
<table class="docs-table">
|
35 |
+
<tr>
|
36 |
+
<th>Option</th><th>Default</th><th>Description</th>
|
37 |
+
</tr>
|
38 |
+
<tr>
|
39 |
+
<td>allow_single_deselect</td>
|
40 |
+
<td>false</td>
|
41 |
+
<td>When set to <code class="language-javascript">true</code> on a single select, Chosen adds a UI element which selects the first element (if it is blank).</td>
|
42 |
+
</tr>
|
43 |
+
<tr>
|
44 |
+
<td>disable_search</td>
|
45 |
+
<td>false</td>
|
46 |
+
<td>When set to <code class="language-javascript">true</code>, Chosen will not display the search field (single selects only).</td>
|
47 |
+
</tr>
|
48 |
+
<tr>
|
49 |
+
<td>disable_search_threshold</td>
|
50 |
+
<td>0</td>
|
51 |
+
<td>Hide the search input on single selects if there are fewer than (n) options.</td>
|
52 |
+
</tr>
|
53 |
+
<tr>
|
54 |
+
<td>enable_split_word_search</td>
|
55 |
+
<td>true</td>
|
56 |
+
<td>By default, searching will match on any word within an option tag. Set this option to <code class="language-javascript">false</code> if you want to only match on the entire text of an option tag.</td>
|
57 |
+
</tr>
|
58 |
+
<tr>
|
59 |
+
<td>inherit_select_classes</td>
|
60 |
+
<td>false</td>
|
61 |
+
<td>When set to <code class="language-javascript">true</code>, Chosen will grab any classes on the original select field and add them to Chosen’s container div.</td>
|
62 |
+
</tr>
|
63 |
+
<tr>
|
64 |
+
<td>max_selected_options</td>
|
65 |
+
<td>Infinity</td>
|
66 |
+
<td>Limits how many options the user can select. When the limit is reached, the <code class="language-javascript">chosen:maxselected</code> event is triggered.</td>
|
67 |
+
</tr>
|
68 |
+
<tr>
|
69 |
+
<td>no_results_text</td>
|
70 |
+
<td>"No results match"</td>
|
71 |
+
<td>The text to be displayed when no matching results are found. The current search is shown at the end of the text (<i>e.g.</i>,
|
72 |
+
No results match "Bad Search").</td>
|
73 |
+
</tr>
|
74 |
+
<tr>
|
75 |
+
<td>placeholder_text_multiple</td>
|
76 |
+
<td>"Select Some Options"</td>
|
77 |
+
<td>The text to be displayed as a placeholder when no options are selected for a multiple select.</td>
|
78 |
+
</tr>
|
79 |
+
<tr>
|
80 |
+
<td>placeholder_text_single</td>
|
81 |
+
<td>"Select an Option"</td>
|
82 |
+
<td>The text to be displayed as a placeholder when no options are selected for a single select.</td>
|
83 |
+
</tr>
|
84 |
+
<tr>
|
85 |
+
<td>search_contains</td>
|
86 |
+
<td>false</td>
|
87 |
+
<td>By default, Chosen’s search matches starting at the beginning of a word. Setting this option to <code class="language-javascript">true</code> allows matches starting from anywhere within a word. This is especially useful for options that include a lot of special characters or phrases in ()s and []s.</td>
|
88 |
+
</tr>
|
89 |
+
<tr>
|
90 |
+
<td>single_backstroke_delete</td>
|
91 |
+
<td>true</td>
|
92 |
+
<td>By default, pressing delete/backspace on multiple selects will remove a selected choice. When <code class="language-javascript">false</code>, pressing delete/backspace will highlight the last choice, and a second press deselects it.</td>
|
93 |
+
</tr>
|
94 |
+
<tr>
|
95 |
+
<td>width</td>
|
96 |
+
<td>Original select width.</td>
|
97 |
+
<td>The width of the Chosen select box. By default, Chosen attempts to match the width of the select box you are replacing. If your select is hidden when Chosen is instantiated, you must specify a width or the select will show up with a width of 0.</td>
|
98 |
+
</tr>
|
99 |
+
<tr>
|
100 |
+
<td>display_disabled_options</td>
|
101 |
+
<td>true</td>
|
102 |
+
<td>By default, Chosen includes disabled options in search results with a special styling. Setting this option to false will hide disabled results and exclude them from searches.</td>
|
103 |
+
</tr>
|
104 |
+
<tr>
|
105 |
+
<td>display_selected_options</td>
|
106 |
+
<td>true</td>
|
107 |
+
<td>
|
108 |
+
<p>By default, Chosen includes selected options in search results with a special styling. Setting this option to false will hide selected results and exclude them from searches.</p>
|
109 |
+
<p><strong>Note:</strong> this is for multiple selects only. In single selects, the selected result will always be displayed.</p>
|
110 |
+
</td>
|
111 |
+
</tr>
|
112 |
+
<tr>
|
113 |
+
<td>include_group_label_in_selected</td>
|
114 |
+
<td>false</td>
|
115 |
+
<td>
|
116 |
+
<p>By default, Chosen only shows the text of a selected option. Setting this option to <code class="language-javascript">true</code> will show the text and group (if any) of the selected option.</p>
|
117 |
+
</td>
|
118 |
+
</tr>
|
119 |
+
</table>
|
120 |
+
|
121 |
+
<h2><a name="attributes" class="anchor" href="#attributes">Attributes</a></h2>
|
122 |
+
<p>Certain attributes placed on the select tag or its options can be used to configure Chosen.</p>
|
123 |
+
|
124 |
+
<h3>Example:</h3>
|
125 |
+
|
126 |
+
<pre>
|
127 |
+
<code class="language-markup"><select class="my_select_box" data-placeholder="Select Your Options">
|
128 |
+
<option value="1">Option 1</option>
|
129 |
+
<option value="2" selected>Option 2</option>
|
130 |
+
<option value="3" disabled>Option 3</option>
|
131 |
+
</select></code>
|
132 |
+
</pre>
|
133 |
+
|
134 |
+
<table class="docs-table">
|
135 |
+
<tr>
|
136 |
+
<th>Attribute</th><th>Description</th>
|
137 |
+
</tr>
|
138 |
+
<tr>
|
139 |
+
<td>data-placeholder</td>
|
140 |
+
<td>
|
141 |
+
<p>The text to be displayed as a placeholder when no options are selected for a select. Defaults to "Select an Option" for single selects or "Select Some Options" for multiple selects.</p>
|
142 |
+
<p><strong>Note:</strong>This attribute overrides anything set in the <code class="language-javascript">placeholder_text_multiple</code> or <code class="language-javascript">placeholder_text_single</code> options.</p>
|
143 |
+
</td>
|
144 |
+
</tr>
|
145 |
+
<tr>
|
146 |
+
<td>multiple</td>
|
147 |
+
<td>The attribute <code class="language-html">multiple</code> on your select box dictates whether Chosen will render a multiple or single select.</td>
|
148 |
+
</tr>
|
149 |
+
<tr>
|
150 |
+
<td>selected, disabled</td>
|
151 |
+
<td>Chosen automatically highlights selected options and disables disabled options.</td>
|
152 |
+
</tr>
|
153 |
+
</table>
|
154 |
+
|
155 |
+
<h2><a name="classes" class="anchor" href="#classes">Classes</a></h2>
|
156 |
+
<p>Classes placed on the select tag can be used to configure Chosen.</p>
|
157 |
+
|
158 |
+
<h3>Example:</h3>
|
159 |
+
|
160 |
+
<pre>
|
161 |
+
<code class="language-markup"><select class="my_select_box chosen-rtl">
|
162 |
+
<option value="1">Option 1</option>
|
163 |
+
<option value="2">Option 2</option>
|
164 |
+
<option value="3">Option 3</option>
|
165 |
+
</select></code>
|
166 |
+
</pre>
|
167 |
+
|
168 |
+
<table class="docs-table">
|
169 |
+
<tr>
|
170 |
+
<th>Classname</th>
|
171 |
+
<th>Description</th>
|
172 |
+
</tr>
|
173 |
+
<tr>
|
174 |
+
<td>chosen-rtl</td>
|
175 |
+
<td>
|
176 |
+
<p>Chosen supports right-to-left text in select boxes. Add the class <code class="language-html">chosen-rtl</code> to your select tag to support right-to-left text options.</p>
|
177 |
+
<p><strong>Note:</strong> The <code class="language-html">chosen-rtl</code> class will pass through to the Chosen select even when the <code class="language-javascript">inherit_select_classes</code> option is set to <code class="language-javascript">false</code>.</p>
|
178 |
+
</td>
|
179 |
+
</tr>
|
180 |
+
</table>
|
181 |
+
|
182 |
+
<h2><a name="triggered-events" class="anchor" href="#triggered-events">Triggered Events</a></h2>
|
183 |
+
<p>Chosen triggers a number of standard and custom events on the original select field.</p>
|
184 |
+
|
185 |
+
<h3>Example:</h3>
|
186 |
+
|
187 |
+
<pre>
|
188 |
+
<code class="language-javascript">$('.my_select_box').on('change', function(evt, params) {
|
189 |
+
do_something(evt, params);
|
190 |
+
});</code>
|
191 |
+
</pre>
|
192 |
+
|
193 |
+
<table class="docs-table">
|
194 |
+
<tr>
|
195 |
+
<th>Event</th><th>Description</th>
|
196 |
+
</tr>
|
197 |
+
<tr>
|
198 |
+
<td>change</td>
|
199 |
+
<td>
|
200 |
+
<p>Chosen triggers the standard DOM event whenever a selection is made (it also sends a <code class="language-javascript">selected</code> or <code class="language-javascript">deselected</code> parameter that tells you which option was changed).</p>
|
201 |
+
<p><strong>Note:</strong> in order to use change in the Prototype version, you have to include the <a href="https://github.com/kangax/protolicious/blob/5b56fdafcd7d7662c9d648534225039b2e78e371/event.simulate.js">Event.simulate</a> class. The selected and deselected parameters are not available for Prototype.</p>
|
202 |
+
</td>
|
203 |
+
</tr>
|
204 |
+
<tr>
|
205 |
+
<td>chosen:ready</td>
|
206 |
+
<td>Triggered after Chosen has been fully instantiated.</td>
|
207 |
+
</tr>
|
208 |
+
<tr>
|
209 |
+
<td>chosen:maxselected</td>
|
210 |
+
<td>Triggered if <code class="language-javascript">max_selected_options</code> is set and that total is broken.</td>
|
211 |
+
</tr>
|
212 |
+
<tr>
|
213 |
+
<td>chosen:showing_dropdown</td>
|
214 |
+
<td>Triggered when Chosen’s dropdown is opened.</td>
|
215 |
+
</tr>
|
216 |
+
<tr>
|
217 |
+
<td>chosen:hiding_dropdown</td>
|
218 |
+
<td>Triggered when Chosen’s dropdown is closed.</td>
|
219 |
+
</tr>
|
220 |
+
<tr>
|
221 |
+
<td>chosen:no_results</td>
|
222 |
+
<td>Triggered when a search returns no matching results.</td>
|
223 |
+
</tr>
|
224 |
+
</table>
|
225 |
+
|
226 |
+
<p>
|
227 |
+
<strong>Note:</strong> all custom Chosen events (those that being with <code class="language-javascript">chosen:</code>) also include the <code class="language-javascript">chosen</code> object as a parameter.
|
228 |
+
</p>
|
229 |
+
|
230 |
+
<h2><a name="triggerable-events" class="anchor" href="#triggerable-events">Triggerable Events</a></h2>
|
231 |
+
<p>You can trigger several events on the original select field to invoke a behavior in Chosen.</p>
|
232 |
+
|
233 |
+
<h3>Example:</h3>
|
234 |
+
|
235 |
+
<pre>
|
236 |
+
<code class="language-javascript">// tell Chosen that a select has changed
|
237 |
+
$('.my_select_box').trigger('chosen:updated');</code>
|
238 |
+
</pre>
|
239 |
+
|
240 |
+
<table class="docs-table">
|
241 |
+
<tr>
|
242 |
+
<th>Event</th><th>Description</th>
|
243 |
+
</tr>
|
244 |
+
<tr>
|
245 |
+
<td>chosen:updated</td>
|
246 |
+
<td>This event should be triggered whenever Chosen’s underlying select element changes (such as a change in selected options).</td>
|
247 |
+
</tr>
|
248 |
+
<tr>
|
249 |
+
<td>chosen:activate</td>
|
250 |
+
<td>This is the equivalant of focusing a standard HTML select field. When activated, Chosen will capure keypress events as if you had clicked the field directly.</td>
|
251 |
+
</tr>
|
252 |
+
<tr>
|
253 |
+
<td>chosen:open</td>
|
254 |
+
<td>This event activates Chosen and also displays the search results.</td>
|
255 |
+
</tr>
|
256 |
+
<tr>
|
257 |
+
<td>chosen:close</td>
|
258 |
+
<td>This event deactivates Chosen and hides the search results.</td>
|
259 |
+
</tr>
|
260 |
+
</table>
|
261 |
+
|
262 |
+
<footer>
|
263 |
+
© 2011–2015 <a href="http://www.getharvest.com/">Harvest</a>. Chosen is licensed under the <a href="https://github.com/harvesthq/chosen/blob/master/LICENSE.md">MIT license</a>.
|
264 |
+
</footer>
|
265 |
+
|
266 |
+
</div>
|
267 |
+
</div>
|
268 |
+
<div class="oss-bar">
|
269 |
+
<ul>
|
270 |
+
<li><a class="fork" href="https://github.com/harvesthq/chosen">Fork on Github</a></li>
|
271 |
+
<li><a class="harvest" href="http://www.getharvest.com/">Built by Harvest</a></li>
|
272 |
+
</ul>
|
273 |
+
</div>
|
274 |
+
<script src="docsupport/prism.js" type="text/javascript" charset="utf-8"></script>
|
275 |
+
</body>
|
276 |
+
</html>
|
async-javascript.php
CHANGED
@@ -1,1367 +1,24 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
Plugin
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
Author:
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
define( 'AJ_ADMIN_POSITION', 3 );
|
26 |
-
define( 'AJ_ADMIN_URL', trailingslashit( admin_url() ) );
|
27 |
-
define( 'AJ_PLUGIN_URL', trailingslashit( plugin_dir_url( __FILE__ ) ) );
|
28 |
-
define( 'AJ_PLUGIN_DIR', trailingslashit( plugin_dir_path( __FILE__ ) ) );
|
29 |
-
define( 'AJ_VERSION', '2.17.11.15' );
|
30 |
-
define( 'AJ_UA', 'Async JavaScript/' . AJ_VERSION . ' (+https://cloughit.com.au/product/async-javascript/)' );
|
31 |
-
if ( !class_exists( 'Services_WTF_Test' ) ) {
|
32 |
-
require_once( AJ_PLUGIN_DIR . 'lib/gtmetrix/class.Services_WTF_Test.php' );
|
33 |
-
}
|
34 |
-
}
|
35 |
-
/**
|
36 |
-
* aj_enqueue_scripts()
|
37 |
-
*
|
38 |
-
* Register admin stylesheets and javascripts
|
39 |
-
*
|
40 |
-
*/
|
41 |
-
add_action( 'admin_enqueue_scripts', 'aj_enqueue_scripts' );
|
42 |
-
function aj_enqueue_scripts() {
|
43 |
-
wp_register_style(
|
44 |
-
'aj_admin_styles',
|
45 |
-
plugins_url( '/css/admin.min.css', __FILE__ )
|
46 |
-
);
|
47 |
-
wp_enqueue_style( 'aj_admin_styles' );
|
48 |
-
wp_enqueue_script(
|
49 |
-
'aj_admin_scripts',
|
50 |
-
plugins_url( '/js/admin.min.js', __FILE__ ),
|
51 |
-
array( 'jquery' ),
|
52 |
-
time()
|
53 |
-
);
|
54 |
-
$aj_localize = array(
|
55 |
-
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
56 |
-
'siteurl' => get_site_url(),
|
57 |
-
'pluginurl' => AJ_PLUGIN_URL,
|
58 |
-
'ajadminurl' => admin_url( 'options-general.php?page=async-javascript' )
|
59 |
-
);
|
60 |
-
wp_localize_script( 'aj_admin_scripts', 'aj_localize_admin', $aj_localize );
|
61 |
-
}
|
62 |
-
/**
|
63 |
-
* register_aj_dashboard_widget()
|
64 |
-
*
|
65 |
-
* Register dashboard widget
|
66 |
-
*
|
67 |
-
*/
|
68 |
-
add_action( 'wp_dashboard_setup', 'register_aj_dashboard_widget' );
|
69 |
-
function register_aj_dashboard_widget() {
|
70 |
-
if ( current_user_can( 'manage_options' ) ) {
|
71 |
-
global $wp_meta_boxes;
|
72 |
-
wp_add_dashboard_widget(
|
73 |
-
'aj_dashboard_widget',
|
74 |
-
AJ_TITLE,
|
75 |
-
'aj_dashboard_widget'
|
76 |
-
);
|
77 |
-
$dashboard = $wp_meta_boxes['dashboard']['normal']['core'];
|
78 |
-
$my_widget = array( 'aj_dashboard_widget' => $dashboard['aj_dashboard_widget'] );
|
79 |
-
unset( $dashboard['aj_dashboard_widget'] );
|
80 |
-
$sorted_dashboard = array_merge( $my_widget, $dashboard );
|
81 |
-
$wp_meta_boxes['dashboard']['normal']['core'] = $sorted_dashboard;
|
82 |
-
}
|
83 |
-
}
|
84 |
-
/**
|
85 |
-
* aj_dashboard_widget()
|
86 |
-
*
|
87 |
-
* Dashboard widget
|
88 |
-
*
|
89 |
-
*/
|
90 |
-
function aj_dashboard_widget() {
|
91 |
-
$site_url = trailingslashit( get_site_url() );
|
92 |
-
$aj_gtmetrix_username = get_option( 'aj_gtmetrix_username', '' );
|
93 |
-
$aj_gtmetrix_api_key = get_option( 'aj_gtmetrix_api_key', '' );
|
94 |
-
$aj_gtmetrix_server = get_option( 'aj_gtmetrix_server', '' );
|
95 |
-
$aj_enabled = ( get_option( 'aj_enabled', 0 ) == 1 ) ? 'Enabled' : 'Disabled';
|
96 |
-
$aj_method = ( get_option( 'aj_method', 'async' ) == 'async' ) ? 'Async' : 'Defer';
|
97 |
-
$aj_jquery = get_option( 'aj_jquery', 'async' );
|
98 |
-
$aj_jquery = ( $aj_jquery == 'same ' ) ? get_option( 'aj_method', 'async' ) : $aj_jquery;
|
99 |
-
$aj_jquery = ( $aj_jquery == 'async' ) ? 'Async' : ( $aj_jquery == 'defer' ) ? 'Defer' : 'Excluded';
|
100 |
-
$aj_exclusions = get_option( 'aj_exclusions', '' );
|
101 |
-
$aj_autoptimize_enabled = ( get_option( 'aj_autoptimize_enabled', 0 ) == 1 ) ? 'Enabled' : 'Disabled';
|
102 |
-
$aj_autoptimize_method = ( get_option( 'aj_autoptimize_method', 'async' ) == 'async' ) ? 'Async' : 'Defer';
|
103 |
-
?>
|
104 |
-
<div class="wrap aj">
|
105 |
-
<h3><?php echo AJ_TITLE; ?> Status</h3>
|
106 |
-
<ul>
|
107 |
-
<li><strong>Status:</strong> <?php echo $aj_enabled; ?></li>
|
108 |
-
<?php
|
109 |
-
if ( $aj_enabled == 'Enabled' ) {
|
110 |
-
?>
|
111 |
-
<li><strong>Method:</strong> <?php echo $aj_method; ?></li>
|
112 |
-
<li><strong>jQuery:</strong> <?php echo $aj_jquery; ?></li>
|
113 |
-
<li><strong>Exclusions:</strong> <?php echo $aj_exclusions; ?></li>
|
114 |
-
<?php
|
115 |
-
if ( is_plugin_active( 'autoptimize/autoptimize.php' ) ) {
|
116 |
-
?>
|
117 |
-
<li><strong>Autoptimize Status:</strong> <?php echo $aj_autoptimize_enabled; ?></li>
|
118 |
-
<?php
|
119 |
-
if ( $aj_autoptimize_enabled == 'Enabled' ) {
|
120 |
-
?>
|
121 |
-
<li><strong>Autoptimize Method:</strong> <?php echo $aj_autoptimize_method; ?></li>
|
122 |
-
<?php
|
123 |
-
}
|
124 |
-
} else {
|
125 |
-
?>
|
126 |
-
<li>Autoptimize not installed or activated.</li>
|
127 |
-
<?php
|
128 |
-
}
|
129 |
-
}
|
130 |
-
?>
|
131 |
-
</ul>
|
132 |
-
<hr />
|
133 |
-
<h3>Latest GTmetrix Results</h3>
|
134 |
-
<?php
|
135 |
-
$aj_gtmetrix_results = get_option( 'aj_gtmetrix_results', array() );
|
136 |
-
if ( isset( $aj_gtmetrix_results['latest'] ) ) {
|
137 |
-
$latest = $aj_gtmetrix_results['latest'];
|
138 |
-
//$screenshot = $latest['results']['report_url'] . '/screenshot.jpg';
|
139 |
-
$screenshot = $latest['screenshot'];
|
140 |
-
$pagespeed = $latest['results']['pagespeed_score'];
|
141 |
-
$yslow = $latest['results']['yslow_score'];
|
142 |
-
$pr = round( 255 * ( 1 - ( $pagespeed / 100 ) ), 0 );
|
143 |
-
$yr = round( 255 * ( 1 - ( $yslow / 100 ) ), 0 );
|
144 |
-
$pg = round( 255 * ( $pagespeed / 100 ), 0 );
|
145 |
-
$yg = round( 255 * ( $yslow / 100 ), 0 );
|
146 |
-
$pagespeed_style = ' style="color: rgb(' . $pr . ',' . $pg . ',0 )"';
|
147 |
-
$yslow_style = ' style="color: rgb(' . $yr . ',' . $yg . ',0 )"';
|
148 |
-
$flt = number_format( ( float )$latest['results']['fully_loaded_time'] / 1000, 2, '.', '' );
|
149 |
-
$tps = number_format( ( float )$latest['results']['page_bytes'] / 1024, 0, '.', '' );
|
150 |
-
$requests = $latest['results']['page_elements'];
|
151 |
-
$report = $latest['results']['report_url'];
|
152 |
-
$report_url = '<a href="' . $report . '" target="_blank">' . $report . '</a>';
|
153 |
-
?>
|
154 |
-
<table id="aj_latest_gtmetrix_results" class="form-table aj-steps-table" width="100%" cellpadding="10">
|
155 |
-
<tr>
|
156 |
-
<td scope="row" align="center"><img src="data:image/jpeg;base64,<?php echo $screenshot; ?>" class="aj_latest_screenshot aj_gtmetrix_screenshot_dashboard">
|
157 |
-
<td scope="row" align="center">
|
158 |
-
<h3>PageSpeed Score</h3>
|
159 |
-
<span class="aj_latest_pagespeed aj_gtmetrix_result"<?php echo $pagespeed_style; ?>><?php echo $pagespeed; ?>%</span>
|
160 |
-
</td>
|
161 |
-
<td scope="row" align="center">
|
162 |
-
<h3>YSlow Score</h3>
|
163 |
-
<span class="aj_latest_yslow aj_gtmetrix_result"<?php echo $yslow_style; ?>><?php echo $yslow; ?>%</span>
|
164 |
-
</td>
|
165 |
-
</tr>
|
166 |
-
<tr>
|
167 |
-
<td scope="row" align="center">
|
168 |
-
<h3>Fully Loaded Time</h3>
|
169 |
-
<span class="aj_latest_flt aj_gtmetrix_result"><?php echo $flt; ?>s</span>
|
170 |
-
</td>
|
171 |
-
<td scope="row" align="center">
|
172 |
-
<h3>Total Page Size</h3>
|
173 |
-
<span class="aj_latest_tps aj_gtmetrix_result"><?php echo $tps; ?>KB</span>
|
174 |
-
</td>
|
175 |
-
<td scope="row" align="center">
|
176 |
-
<h3>Requests</h3>
|
177 |
-
<span class="aj_latest_requests aj_gtmetrix_result"><?php echo $requests; ?></span>
|
178 |
-
</td>
|
179 |
-
</tr>
|
180 |
-
<tr><td scope="row" align="left" colspan="6">See full report: <span class="aj_latest_report"><?php echo $report_url; ?></span></td></tr>
|
181 |
-
</table>
|
182 |
-
<?php
|
183 |
-
}
|
184 |
-
?>
|
185 |
-
<p>Please click on the Settings button below to generate a new GTmetrix Report.</p>
|
186 |
-
<p><button data-id="aj_goto_settings" class="aj_steps_button">Settings</button></p>
|
187 |
-
</div>
|
188 |
-
<?php
|
189 |
-
}
|
190 |
-
/**
|
191 |
-
* async_javascript_menu()
|
192 |
-
*
|
193 |
-
* Register admin menu
|
194 |
-
*
|
195 |
-
*/
|
196 |
-
add_action( 'admin_menu', 'async_javascript_menu' );
|
197 |
-
function async_javascript_menu() {
|
198 |
-
add_submenu_page(
|
199 |
-
'options-general.php',
|
200 |
-
AJ_TITLE . ' Admin',
|
201 |
-
AJ_TITLE,
|
202 |
-
'manage_options',
|
203 |
-
'async-javascript',
|
204 |
-
'async_javascript_admin'
|
205 |
-
);
|
206 |
-
|
207 |
-
}
|
208 |
-
/**
|
209 |
-
* async_javascript_admin()
|
210 |
-
*
|
211 |
-
* Admin page
|
212 |
-
*
|
213 |
-
*/
|
214 |
-
function async_javascript_admin() {
|
215 |
-
// load settings from database
|
216 |
-
$tabs = array( 'wizard', 'status', 'settings', 'help' );
|
217 |
-
$active_tab = isset( $_GET[ 'tab' ] ) ? sanitize_text_field( $_GET[ 'tab' ] ) : 'wizard';
|
218 |
-
?>
|
219 |
-
<div class="wrap aj">
|
220 |
-
<input type="hidden" id="aj_nonce" value="<?php echo wp_create_nonce( "aj_nonce" ); ?>" />
|
221 |
-
<div id="aj_notification"></div>
|
222 |
-
<h2>Welcome to <?php echo AJ_TITLE; ?></h2>
|
223 |
-
<h2 class="nav-tab-wrapper">
|
224 |
-
<?php
|
225 |
-
foreach ($tabs as $tab ) {
|
226 |
-
$active = $active_tab == $tab ? 'nav-tab-active' : '';
|
227 |
-
echo '<a href="?page=async-javascript&tab=' . $tab . '" class="nav-tab ' . $active . '">' . ucfirst( $tab ) . '</a>';
|
228 |
-
}
|
229 |
-
?>
|
230 |
-
</h2>
|
231 |
-
<?php
|
232 |
-
if ( $active_tab == 'wizard' ) {
|
233 |
-
$site_url = trailingslashit( get_site_url() );
|
234 |
-
$aj_gtmetrix_username = get_option( 'aj_gtmetrix_username', '' );
|
235 |
-
$aj_gtmetrix_api_key = get_option( 'aj_gtmetrix_api_key', '' );
|
236 |
-
$aj_gtmetrix_server = get_option( 'aj_gtmetrix_server', '' );
|
237 |
-
if ( $aj_gtmetrix_username != '' && $aj_gtmetrix_api_key != '' ) {
|
238 |
-
$test = new Services_WTF_Test();
|
239 |
-
$test->api_username( $aj_gtmetrix_username );
|
240 |
-
$test->api_password( $aj_gtmetrix_api_key );
|
241 |
-
$test->user_agent( AJ_UA );
|
242 |
-
$status = $test->status();
|
243 |
-
$credits = $status['api_credits'];
|
244 |
-
} else {
|
245 |
-
$credits = 'N/A';
|
246 |
-
}
|
247 |
-
?>
|
248 |
-
<table class="form-table" width="100%" cellpadding="10">
|
249 |
-
<tr id="aj_intro">
|
250 |
-
<td scope="row" align="center" style="vertical-align: top !important;"><img src="<?php echo AJ_PLUGIN_URL; ?>images/finger_point_out_punch_hole_400_clr_17860.png" title="<?php echo AJ_TITLE; ?>" alt="<?php echo AJ_TITLE; ?>" class="aj_step_img"></td>
|
251 |
-
<td scope="row" align="left" style="vertical-align: top !important;">
|
252 |
-
<h3>Async JavaScript</h3>
|
253 |
-
<?php echo about_aj(); ?>
|
254 |
-
</td>
|
255 |
-
</tr>
|
256 |
-
<tr id="aj_step1">
|
257 |
-
<td scope="row" align="center" style="vertical-align: top !important;"><img src="<?php echo AJ_PLUGIN_URL; ?>images/number_one_break_hole_150_clr_18741.gif" title="Step 1" alt="GTmetrix API Key" class="aj_step_img"></td>
|
258 |
-
<td scope="row" align="left" style="vertical-align: top !important;">
|
259 |
-
<h3>Step 1: GTmetrix API Key</h3>
|
260 |
-
<p><strong><em>Please Note:</em></strong>You do not have to use this Wizard. All settings can be changed under the <a href="<?php echo menu_page_url( AJ_ADMIN_MENU_SLUG, false ) . '&tab=settings'; ?>">Settings</a> tab.</p>
|
261 |
-
<hr />
|
262 |
-
<p>If you haven't already done so, grab an API Key from GTmetrix so that Async JavaScript can obtain your PageSpeed / YSlow results. Here's how:</p>
|
263 |
-
<ol>
|
264 |
-
<li>Navigate to <a href="https://gtmetrix.com/api/" target="_blank">https://gtmetrix.com/api/</a> (link opens in a new tab)</li>
|
265 |
-
<li>If you do not already have an account with GTmetrix, go ahead and sign up (it's FREE!).</li>
|
266 |
-
<li>Log in to your GTmetrix account.</li>
|
267 |
-
<li>If you haven't yet generated your API Key, click on <strong>Generate API Key</strong></li>
|
268 |
-
<li>Copy your Username and API Key into the fields below:<br /><input type="text" id="aj_gtmetrix_username" value="<?php echo $aj_gtmetrix_username; ?>" placeholder="GTmetrix Username"><input type="text" id="aj_gtmetrix_api_key" value="<?php echo $aj_gtmetrix_api_key; ?>" placeholder="GTmetrix API Key"></li>
|
269 |
-
<li>Select the desired server.<br />
|
270 |
-
<select id="aj_gtmetrix_server">
|
271 |
-
<?php
|
272 |
-
$gtmetrix_locations = array(
|
273 |
-
'Vancouver, Canada' => 1,
|
274 |
-
'London, United Kingdom' => 2,
|
275 |
-
'Sydney, Australia' => 3,
|
276 |
-
'Dallas, United States' => 4,
|
277 |
-
'Mumbai, India' => 5
|
278 |
-
);
|
279 |
-
foreach ( $gtmetrix_locations as $location => $value ) {
|
280 |
-
$selected = ( $aj_gtmetrix_server == $value ) ? ' selected="selected"' : '';
|
281 |
-
echo '<option value="' . $value . '"' . $selected . '>' . $location . '</option>';
|
282 |
-
}
|
283 |
-
?>
|
284 |
-
</select>
|
285 |
-
</li>
|
286 |
-
<li>GTmetrix Credits Available: <span class="aj_gtmetrix_credits"><?php echo $credits; ?></span></li>
|
287 |
-
</ol>
|
288 |
-
<p><strong>Please Note:</strong> By clicking the button below you acknowledge that you understand that five (5) GTmetrix API credits will be used.</p>
|
289 |
-
<p><button data-id="aj_step2" class="aj_steps_button">Proceed to Step 2</button></p>
|
290 |
-
</td>
|
291 |
-
</tr>
|
292 |
-
<tr id="aj_step2" class="aj_steps_hidden">
|
293 |
-
<td scope="row" align="center"><img src="<?php echo AJ_PLUGIN_URL; ?>images/number_two_break_hole_150_clr_18753.gif" title="Step 2" alt="Initial Test Results" class="aj_step_img"></td>
|
294 |
-
<td scope="row" align="left">
|
295 |
-
<h3>Step 2: Initial Test Results</h3>
|
296 |
-
<p><?php echo AJ_TITLE; ?> will now query GTmetrix and retrieve your sites PageSpeed and YSlow scores.</p>
|
297 |
-
<p id="aj_step2_please_wait"><img src="<?php echo AJ_PLUGIN_URL; ?>images/loading.gif" title="Please Wait" alt="Please Wait" class="aj_step_img"></p>
|
298 |
-
<table id="aj_step2_gtmetrix_results" class="form-table aj-steps-table" width="100%" cellpadding="10">
|
299 |
-
<tr>
|
300 |
-
<td scope="row" align="center"><img src="" class="aj_step2_screenshot aj_gtmetrix_screenshot">
|
301 |
-
<td scope="row" align="center">
|
302 |
-
<h3>PageSpeed Score</h3>
|
303 |
-
<span class="aj_step2_pagespeed aj_gtmetrix_result"></span>
|
304 |
-
</td>
|
305 |
-
<td scope="row" align="center">
|
306 |
-
<h3>YSlow Score</h3>
|
307 |
-
<span class="aj_step2_yslow aj_gtmetrix_result"></span>
|
308 |
-
</td>
|
309 |
-
<td scope="row" align="center">
|
310 |
-
<h3>Fully Loaded Time</h3>
|
311 |
-
<span class="aj_step2_flt aj_gtmetrix_result"></span>
|
312 |
-
</td>
|
313 |
-
<td scope="row" align="center">
|
314 |
-
<h3>Total Page Size</h3>
|
315 |
-
<span class="aj_step2_tps aj_gtmetrix_result"></span>
|
316 |
-
</td>
|
317 |
-
<td scope="row" align="center">
|
318 |
-
<h3>Requests</h3>
|
319 |
-
<span class="aj_step2_requests aj_gtmetrix_result"></span>
|
320 |
-
</td>
|
321 |
-
</tr>
|
322 |
-
<tr><td scope="row" align="left" colspan="6">See full report: <span class="aj_step2_report"></span></td></tr>
|
323 |
-
<tr><td scope="row" align="left" colspan="6">Simulate <span class="aj_step2_gtmetrix"></span>: <a href="" class="aj_step2_url" target="_blank"></a></tr>
|
324 |
-
<p></p>
|
325 |
-
</table>
|
326 |
-
</td>
|
327 |
-
</tr>
|
328 |
-
<tr id="aj_step2b" class="aj_steps_hidden">
|
329 |
-
<td scope="row" align="center"></td>
|
330 |
-
<td scope="row" align="left">
|
331 |
-
<h3>Testing: Async</h3>
|
332 |
-
<p><?php echo AJ_TITLE; ?> will now query GTmetrix and retrieve your sites PageSpeed and YSlow scores whilst simulating the JavaScript 'async' method.</p>
|
333 |
-
<p id="aj_step2b_please_wait"><img src="<?php echo AJ_PLUGIN_URL; ?>images/loading.gif" title="Please Wait" alt="Please Wait" class="aj_step_img"></p>
|
334 |
-
<table id="aj_step2b_gtmetrix_results" class="form-table aj-steps-table" width="100%" cellpadding="10">
|
335 |
-
<tr>
|
336 |
-
<td scope="row" align="center"><img src="" class="aj_step2b_screenshot aj_gtmetrix_screenshot">
|
337 |
-
<td scope="row" align="center">
|
338 |
-
<h3>PageSpeed Score</h3>
|
339 |
-
<span class="aj_step2b_pagespeed aj_gtmetrix_result"></span>
|
340 |
-
</td>
|
341 |
-
<td scope="row" align="center">
|
342 |
-
<h3>YSlow Score</h3>
|
343 |
-
<span class="aj_step2b_yslow aj_gtmetrix_result"></span>
|
344 |
-
</td>
|
345 |
-
<td scope="row" align="center">
|
346 |
-
<h3>Fully Loaded Time</h3>
|
347 |
-
<span class="aj_step2b_flt aj_gtmetrix_result"></span>
|
348 |
-
</td>
|
349 |
-
<td scope="row" align="center">
|
350 |
-
<h3>Total Page Size</h3>
|
351 |
-
<span class="aj_step2b_tps aj_gtmetrix_result"></span>
|
352 |
-
</td>
|
353 |
-
<td scope="row" align="center">
|
354 |
-
<h3>Requests</h3>
|
355 |
-
<span class="aj_step2b_requests aj_gtmetrix_result"></span>
|
356 |
-
</td>
|
357 |
-
</tr>
|
358 |
-
<tr><td scope="row" align="left" colspan="6">See full report: <span class="aj_step2b_report"></span></td></tr>
|
359 |
-
<tr><td scope="row" align="left" colspan="6">Simulate <span class="aj_step2b_gtmetrix"></span>: <a href="" class="aj_step2b_url" target="_blank"></a></tr>
|
360 |
-
</table>
|
361 |
-
</td>
|
362 |
-
</tr>
|
363 |
-
<tr id="aj_step2c" class="aj_steps_hidden">
|
364 |
-
<td scope="row" align="center"></td>
|
365 |
-
<td scope="row" align="left">
|
366 |
-
<h3>Testing: Defer</h3>
|
367 |
-
<p><?php echo AJ_TITLE; ?> will now query GTmetrix and retrieve your sites PageSpeed and YSlow scores whilst simulating the JavaScript 'defer' method.</p>
|
368 |
-
<p id="aj_step2c_please_wait"><img src="<?php echo AJ_PLUGIN_URL; ?>images/loading.gif" title="Please Wait" alt="Please Wait" class="aj_step_img"></p>
|
369 |
-
<table id="aj_step2c_gtmetrix_results" class="form-table aj-steps-table" width="100%" cellpadding="10">
|
370 |
-
<tr>
|
371 |
-
<td scope="row" align="center"><img src="" class="aj_step2c_screenshot aj_gtmetrix_screenshot">
|
372 |
-
<td scope="row" align="center">
|
373 |
-
<h3>PageSpeed Score</h3>
|
374 |
-
<span class="aj_step2c_pagespeed aj_gtmetrix_result"></span>
|
375 |
-
</td>
|
376 |
-
<td scope="row" align="center">
|
377 |
-
<h3>YSlow Score</h3>
|
378 |
-
<span class="aj_step2c_yslow aj_gtmetrix_result"></span>
|
379 |
-
</td>
|
380 |
-
<td scope="row" align="center">
|
381 |
-
<h3>Fully Loaded Time</h3>
|
382 |
-
<span class="aj_step2c_flt aj_gtmetrix_result"></span>
|
383 |
-
</td>
|
384 |
-
<td scope="row" align="center">
|
385 |
-
<h3>Total Page Size</h3>
|
386 |
-
<span class="aj_step2c_tps aj_gtmetrix_result"></span>
|
387 |
-
</td>
|
388 |
-
<td scope="row" align="center">
|
389 |
-
<h3>Requests</h3>
|
390 |
-
<span class="aj_step2c_requests aj_gtmetrix_result"></span>
|
391 |
-
</td>
|
392 |
-
</tr>
|
393 |
-
<tr><td scope="row" align="left" colspan="6">See full report: <span class="aj_step2c_report"></span></td></tr>
|
394 |
-
<tr><td scope="row" align="left" colspan="6">Simulate <span class="aj_step2c_gtmetrix"></span>: <a href="" class="aj_step2c_url" target="_blank"></a></tr>
|
395 |
-
</table>
|
396 |
-
</td>
|
397 |
-
</tr>
|
398 |
-
<tr id="aj_step2d" class="aj_steps_hidden">
|
399 |
-
<td scope="row" align="center"></td>
|
400 |
-
<td scope="row" align="left">
|
401 |
-
<h3>Testing: Async (jQuery excluded)</h3>
|
402 |
-
<p><?php echo AJ_TITLE; ?> will now query GTmetrix and retrieve your sites PageSpeed and YSlow scores whilst simulating the JavaScript 'async' method but excluding jQuery.</p>
|
403 |
-
<p id="aj_step2d_please_wait"><img src="<?php echo AJ_PLUGIN_URL; ?>images/loading.gif" title="Please Wait" alt="Please Wait" class="aj_step_img"></p>
|
404 |
-
<table id="aj_step2d_gtmetrix_results" class="form-table aj-steps-table" width="100%" cellpadding="10">
|
405 |
-
<tr>
|
406 |
-
<td scope="row" align="center"><img src="" class="aj_step2d_screenshot aj_gtmetrix_screenshot">
|
407 |
-
<td scope="row" align="center">
|
408 |
-
<h3>PageSpeed Score</h3>
|
409 |
-
<span class="aj_step2d_pagespeed aj_gtmetrix_result"></span>
|
410 |
-
</td>
|
411 |
-
<td scope="row" align="center">
|
412 |
-
<h3>YSlow Score</h3>
|
413 |
-
<span class="aj_step2d_yslow aj_gtmetrix_result"></span>
|
414 |
-
</td>
|
415 |
-
<td scope="row" align="center">
|
416 |
-
<h3>Fully Loaded Time</h3>
|
417 |
-
<span class="aj_step2d_flt aj_gtmetrix_result"></span>
|
418 |
-
</td>
|
419 |
-
<td scope="row" align="center">
|
420 |
-
<h3>Total Page Size</h3>
|
421 |
-
<span class="aj_step2d_tps aj_gtmetrix_result"></span>
|
422 |
-
</td>
|
423 |
-
<td scope="row" align="center">
|
424 |
-
<h3>Requests</h3>
|
425 |
-
<span class="aj_step2d_requests aj_gtmetrix_result"></span>
|
426 |
-
</td>
|
427 |
-
</tr>
|
428 |
-
<tr><td scope="row" align="left" colspan="6">See full report: <span class="aj_step2d_report"></span></td></tr>
|
429 |
-
<tr><td scope="row" align="left" colspan="6">Simulate <span class="aj_step2d_gtmetrix"></span>: <a href="" class="aj_step2d_url" target="_blank"></a></tr>
|
430 |
-
</table>
|
431 |
-
</td>
|
432 |
-
</tr>
|
433 |
-
<tr id="aj_step2e" class="aj_steps_hidden">
|
434 |
-
<td scope="row" align="center"></td>
|
435 |
-
<td scope="row" align="left">
|
436 |
-
<h3>Testing: Defer (jQuery excluded)</h3>
|
437 |
-
<p><?php echo AJ_TITLE; ?> will now query GTmetrix and retrieve your sites PageSpeed and YSlow scores whilst simulating the JavaScript 'defer' method but excluding jQuery.</p>
|
438 |
-
<p id="aj_step2e_please_wait"><img src="<?php echo AJ_PLUGIN_URL; ?>images/loading.gif" title="Please Wait" alt="Please Wait" class="aj_step_img"></p>
|
439 |
-
<table id="aj_step2e_gtmetrix_results" class="form-table aj-steps-table" width="100%" cellpadding="10">
|
440 |
-
<tr>
|
441 |
-
<td scope="row" align="center"><img src="" class="aj_step2e_screenshot aj_gtmetrix_screenshot">
|
442 |
-
<td scope="row" align="center">
|
443 |
-
<h3>PageSpeed Score</h3>
|
444 |
-
<span class="aj_step2e_pagespeed aj_gtmetrix_result"></span>
|
445 |
-
</td>
|
446 |
-
<td scope="row" align="center">
|
447 |
-
<h3>YSlow Score</h3>
|
448 |
-
<span class="aj_step2e_yslow aj_gtmetrix_result"></span>
|
449 |
-
</td>
|
450 |
-
<td scope="row" align="center">
|
451 |
-
<h3>Fully Loaded Time</h3>
|
452 |
-
<span class="aj_step2e_flt aj_gtmetrix_result"></span>
|
453 |
-
</td>
|
454 |
-
<td scope="row" align="center">
|
455 |
-
<h3>Total Page Size</h3>
|
456 |
-
<span class="aj_step2e_tps aj_gtmetrix_result"></span>
|
457 |
-
</td>
|
458 |
-
<td scope="row" align="center">
|
459 |
-
<h3>Requests</h3>
|
460 |
-
<span class="aj_step2e_requests aj_gtmetrix_result"></span>
|
461 |
-
</td>
|
462 |
-
</tr>
|
463 |
-
<tr><td scope="row" align="left" colspan="6">See full report: <span class="aj_step2e_report"></span></td></tr>
|
464 |
-
<tr><td scope="row" align="left" colspan="6">Simulate <span class="aj_step2e_gtmetrix"></span>: <a href="" class="aj_step2e_url" target="_blank"></a></tr>
|
465 |
-
</table>
|
466 |
-
</td>
|
467 |
-
</tr>
|
468 |
-
<tr id="aj_step_results" class="aj_steps_hidden">
|
469 |
-
<td scope="row" align="center" style="vertical-align: top !important;"><img src="<?php echo AJ_PLUGIN_URL; ?>images/number_three_break_hole_150_clr_18837.gif" title="Results & Recommendations" alt="Results & Recommendations" class="aj_step_img"></td>
|
470 |
-
<td scope="row" align="left">
|
471 |
-
<h3>Step 3: Results & Recommendations</h3>
|
472 |
-
<p><?php echo AJ_TITLE; ?> has finished testing your site with the most common configuration options.</p>
|
473 |
-
<p>Based on the tests <?php echo AJ_TITLE; ?> has determined that <span class="aj_gtmetrix_config"></span> has resulted in <span id="aj_gtmetrix_inde_pagespeed"></span> in PageSpeed from <span id="aj_gtmetrix_baseline_pagespeed"></span> to <span id="aj_gtmetrix_best_pagespeed"></span> and <span id="aj_gtmetrix_inde_yslow"></span> in YSlow from <span id="aj_gtmetrix_baseline_yslow"></span> to <span id="aj_gtmetrix_best_yslow"></span>, with a Fully Loaded time of <span id="aj_gtmetrix_best_fullyloaded"></span>.</p>
|
474 |
-
<p>Before applying these settings it is important to check your site is still functioning correctly. Click the link below to open your site in a new tab / window to simulate the <?php echo AJ_TITLE; ?> settings and check that everything is working, and also be sure to check the console for any JavaScript errors (see <a href="https://codex.wordpress.org/Using_Your_Browser_to_Diagnose_JavaScript_Errors" target="_blank">Using Your Browser to Diagnose JavaScript Errors</a>)</p>
|
475 |
-
<ul>
|
476 |
-
<li>Simulate <span class="aj_gtmetrix_config"></span>: <a href="" id="aj_gtmetrix_best_url" target="_blank"></a></li>
|
477 |
-
</ul>
|
478 |
-
<p>Once you have simulated <span class="aj_gtmetrix_config"></span> click on the button below to continue.</p>
|
479 |
-
<p><button data-id="aj_step4" class="aj_steps_button">Proceed to Step 4</button></p>
|
480 |
-
</td>
|
481 |
-
</tr>
|
482 |
-
<tr id="aj_step4" class="aj_steps_hidden">
|
483 |
-
<td scope="row" align="center" style="vertical-align: top !important;"><img src="<?php echo AJ_PLUGIN_URL; ?>images/number_four_break_hole_150_clr_18840.gif" title="Apply Settings" alt="Apply Settings" class="aj_step_img"></td>
|
484 |
-
<td scope="row" align="left">
|
485 |
-
<h3>Step 4: Apply Settings</h3>
|
486 |
-
<p>Is your site still functioning properly and are there no JavaScript errors in the console?</p>
|
487 |
-
<p><input type="radio" name="aj_step4_check" value="y"> Yes <input type="radio" name="aj_step4_check" value="n"> No</p>
|
488 |
-
<div id="aj_step4_y">
|
489 |
-
<p>Great to hear! To apply these settings click the button below.</p>
|
490 |
-
<p><button data-id="aj_apply_settings" class="aj_steps_button">Apply Settings</button></p>
|
491 |
-
</div>
|
492 |
-
<div id="aj_step4_n">
|
493 |
-
<p>Ok, so you have run the simulation on <span class="aj_gtmetrix_config"></span> and although there has been an improvement in reported performance, the simulation shows that something is not right with your site.</p>
|
494 |
-
<div id="aj_step4_jquery_excluded">
|
495 |
-
<p>In most cases the issue being experienced relates to jQuery (usually due to inline JavaScript which relies on jQuery) and the solution is to exclude jQuery. However, in this simulation jQuery has already been exculded. As a result a different configuration may work better with a marginal sacrifice in site speed improvement.</p>
|
496 |
-
<p>Below are links that can be used to run simulations on each of the basic configurations. Click on each of the links and check the functionality of your site as well as the console for errors.</p>
|
497 |
-
<ul>
|
498 |
-
<li>Simulate <span class="aj_step2b_gtmetrix"></span>: <a href="" class="aj_step2b_url" target="_blank"></a></li>
|
499 |
-
<li>Simulate <span class="aj_step2c_gtmetrix"></span>: <a href="" class="aj_step2c_url" target="_blank"></a></li>
|
500 |
-
<li>Simulate <span class="aj_step2d_gtmetrix"></span>: <a href="" class="aj_step2d_url" target="_blank"></a></li>
|
501 |
-
<li>Simulate <span class="aj_step2e_gtmetrix"></span>: <a href="" class="aj_step2e_url" target="_blank"></a></li>
|
502 |
-
</ul>
|
503 |
-
<p>Click one of the buttons below to apply these settings or click the Settings button to go to the settings page for manual configuration.</p>
|
504 |
-
<p>
|
505 |
-
<button data-id="aj_step2b_apply" class="aj_steps_button">Apply <span class="aj_step2b_gtmetrix"></button>
|
506 |
-
<button data-id="aj_step2c_apply" class="aj_steps_button">Apply <span class="aj_step2c_gtmetrix"></button>
|
507 |
-
<button data-id="aj_step2d_apply" class="aj_steps_button">Apply <span class="aj_step2d_gtmetrix"></button>
|
508 |
-
<button data-id="aj_step2e_apply" class="aj_steps_button">Apply <span class="aj_step2e_gtmetrix"></button>
|
509 |
-
</p>
|
510 |
-
<p>
|
511 |
-
<button data-id="aj_goto_settings" class="aj_steps_button">Settings</button>
|
512 |
-
</p>
|
513 |
-
</div>
|
514 |
-
<div id="aj_step4_jquery_not_excluded">
|
515 |
-
<p>In most cases the issue being experienced relates to jQuery (usually due to inline JavaScript which relies on jQuery) and the solution is to exclude jQuery.</p>
|
516 |
-
<p>Below are links that can be used to run simulations on each of the configurations with jQuery excluded. Click on each of the links and check the functionality of your site as well as the console for errors.</p>
|
517 |
-
<ul>
|
518 |
-
<li>Simulate <span class="aj_step2d_gtmetrix"></span>: <a href="" class="aj_step2d_url" target="_blank"></a></li>
|
519 |
-
<li>Simulate <span class="aj_step2e_gtmetrix"></span>: <a href="" class="aj_step2e_url" target="_blank"></a></li>
|
520 |
-
</ul>
|
521 |
-
<p>Click one of the buttons below to apply these settings or click the Settings button to go to the settings page for manual configuration.</p>
|
522 |
-
<p>
|
523 |
-
<button data-id="aj_step2d_apply" class="aj_steps_button">Apply <span class="aj_step2d_gtmetrix"></button>
|
524 |
-
<button data-id="aj_step2e_apply" class="aj_steps_button">Apply <span class="aj_step2e_gtmetrix"></button>
|
525 |
-
</p>
|
526 |
-
<p>
|
527 |
-
<button data-id="aj_goto_settings" class="aj_steps_button">Settings</button>
|
528 |
-
</p>
|
529 |
-
</div>
|
530 |
-
</div>
|
531 |
-
</td>
|
532 |
-
</tr>
|
533 |
-
<tr id="aj_step5" class="aj_steps_hidden">
|
534 |
-
<td scope="row" align="center" style="vertical-align: top !important;"><img src="<?php echo AJ_PLUGIN_URL; ?>images/number_five_break_hole_150_clr_18842.gif" title="Further Hints & Tips" alt="Further Hints & Tips" class="aj_step_img"></td>
|
535 |
-
<td scope="row" align="left">
|
536 |
-
<?php echo hints_tips(); ?>
|
537 |
-
<p><button data-id="aj_goto_settings" class="aj_steps_button">Settings</button></p>
|
538 |
-
</td>
|
539 |
-
</tr>
|
540 |
-
</table>
|
541 |
-
<?php
|
542 |
-
} else if ( $active_tab == 'status' ) {
|
543 |
-
$site_url = trailingslashit( get_site_url() );
|
544 |
-
$aj_gtmetrix_username = get_option( 'aj_gtmetrix_username', '' );
|
545 |
-
$aj_gtmetrix_api_key = get_option( 'aj_gtmetrix_api_key', '' );
|
546 |
-
$aj_gtmetrix_server = get_option( 'aj_gtmetrix_server', '' );
|
547 |
-
if ( $aj_gtmetrix_username != '' && $aj_gtmetrix_api_key != '' ) {
|
548 |
-
$test = new Services_WTF_Test();
|
549 |
-
$test->api_username( $aj_gtmetrix_username );
|
550 |
-
$test->api_password( $aj_gtmetrix_api_key );
|
551 |
-
$test->user_agent( AJ_UA );
|
552 |
-
$status = $test->status();
|
553 |
-
$credits = $status['api_credits'];
|
554 |
-
} else {
|
555 |
-
$credits = 'N/A';
|
556 |
-
}
|
557 |
-
$aj_enabled = ( get_option( 'aj_enabled', 0 ) == 1 ) ? 'Enabled' : 'Disabled';
|
558 |
-
$aj_method = ( get_option( 'aj_method', 'async' ) == 'async' ) ? 'Async' : 'Defer';
|
559 |
-
$aj_jquery = get_option( 'aj_jquery', 'async' );
|
560 |
-
$aj_jquery = ( $aj_jquery == 'same ' ) ? get_option( 'aj_method', 'async' ) : $aj_jquery;
|
561 |
-
$aj_jquery = ( $aj_jquery == 'async' ) ? 'Async' : ( $aj_jquery == 'defer' ) ? 'Defer' : 'Excluded';
|
562 |
-
$aj_exclusions = get_option( 'aj_exclusions', '' );
|
563 |
-
$aj_autoptimize_enabled = ( get_option( 'aj_autoptimize_enabled', 0 ) == 1 ) ? 'Enabled' : 'Disabled';
|
564 |
-
$aj_autoptimize_method = ( get_option( 'aj_autoptimize_method', 'async' ) == 'async' ) ? 'Async' : 'Defer';
|
565 |
-
?>
|
566 |
-
<table class="form-table" width="100%" cellpadding="10">
|
567 |
-
<tr>
|
568 |
-
<td scope="row" align="center" style="vertical-align: top !important;"><img src="<?php echo AJ_PLUGIN_URL; ?>images/finger_point_out_punch_hole_400_clr_17860.png" title="Most Recent GTmetrix Results" alt="Most Recent GTmetrix Results" class="aj_step_img"></td>
|
569 |
-
<td scope="row" align="left">
|
570 |
-
<h3><?php echo AJ_TITLE; ?></h3>
|
571 |
-
<ul>
|
572 |
-
<li><strong>Status:</strong> <?php echo $aj_enabled; ?></li>
|
573 |
-
<?php
|
574 |
-
if ( $aj_enabled == 'Enabled' ) {
|
575 |
-
?>
|
576 |
-
<li><strong>Method:</strong> <?php echo $aj_method; ?></li>
|
577 |
-
<li><strong>jQuery:</strong> <?php echo $aj_jquery; ?></li>
|
578 |
-
<li><strong>Exclusions:</strong> <?php echo $aj_exclusions; ?></li>
|
579 |
-
<?php
|
580 |
-
if ( is_plugin_active( 'autoptimize/autoptimize.php' ) ) {
|
581 |
-
?>
|
582 |
-
<li><strong>Autoptimize Status:</strong> <?php echo $aj_autoptimize_enabled; ?></li>
|
583 |
-
<?php
|
584 |
-
if ( $aj_autoptimize_enabled == 'Enabled' ) {
|
585 |
-
?>
|
586 |
-
<li><strong>Autoptimize Method:</strong> <?php echo $aj_autoptimize_method; ?></li>
|
587 |
-
<?php
|
588 |
-
}
|
589 |
-
} else {
|
590 |
-
?>
|
591 |
-
<li>Autoptimize not installed or activated.</li>
|
592 |
-
<?php
|
593 |
-
}
|
594 |
-
}
|
595 |
-
?>
|
596 |
-
</ul>
|
597 |
-
<hr />
|
598 |
-
<h3>Latest GTmetrix Results</h3>
|
599 |
-
<?php
|
600 |
-
$aj_gtmetrix_results = get_option( 'aj_gtmetrix_results', array() );
|
601 |
-
if ( isset( $aj_gtmetrix_results['latest'] ) ) {
|
602 |
-
$latest = $aj_gtmetrix_results['latest'];
|
603 |
-
$screenshot = $latest['screenshot'];
|
604 |
-
$pagespeed = $latest['results']['pagespeed_score'];
|
605 |
-
$yslow = $latest['results']['yslow_score'];
|
606 |
-
$pr = round( 255 * ( 1 - ( $pagespeed / 100 ) ), 0 );
|
607 |
-
$yr = round( 255 * ( 1 - ( $yslow / 100 ) ), 0 );
|
608 |
-
$pg = round( 255 * ( $pagespeed / 100 ), 0 );
|
609 |
-
$yg = round( 255 * ( $yslow / 100 ), 0 );
|
610 |
-
$pagespeed_style = ' style="color: rgb(' . $pr . ',' . $pg . ',0 )"';
|
611 |
-
$yslow_style = ' style="color: rgb(' . $yr . ',' . $yg . ',0 )"';
|
612 |
-
$flt = number_format( ( float )$latest['results']['fully_loaded_time'] / 1000, 2, '.', '' );
|
613 |
-
$tps = number_format( ( float )$latest['results']['page_bytes'] / 1024, 0, '.', '' );
|
614 |
-
$requests = $latest['results']['page_elements'];
|
615 |
-
$report = $latest['results']['report_url'];
|
616 |
-
$report_url = '<a href="' . $report . '" target="_blank">' . $report . '</a>';
|
617 |
-
?>
|
618 |
-
<p id="aj_latest_please_wait"><img src="<?php echo AJ_PLUGIN_URL; ?>images/loading.gif" title="Please Wait" alt="Please Wait" class="aj_step_img"></p>
|
619 |
-
<table id="aj_latest_gtmetrix_results" class="form-table aj-steps-table" width="100%" cellpadding="10">
|
620 |
-
<tr>
|
621 |
-
<td scope="row" align="center"><img src="data:image/jpeg;base64,<?php echo $screenshot; ?>" class="aj_latest_screenshot aj_gtmetrix_screenshot">
|
622 |
-
<td scope="row" align="center">
|
623 |
-
<h3>PageSpeed Score</h3>
|
624 |
-
<span class="aj_latest_pagespeed aj_gtmetrix_result"<?php echo $pagespeed_style; ?>><?php echo $pagespeed; ?>%</span>
|
625 |
-
</td>
|
626 |
-
<td scope="row" align="center">
|
627 |
-
<h3>YSlow Score</h3>
|
628 |
-
<span class="aj_latest_yslow aj_gtmetrix_result"<?php echo $yslow_style; ?>><?php echo $yslow; ?>%</span>
|
629 |
-
</td>
|
630 |
-
<td scope="row" align="center">
|
631 |
-
<h3>Fully Loaded Time</h3>
|
632 |
-
<span class="aj_latest_flt aj_gtmetrix_result"><?php echo $flt; ?>s</span>
|
633 |
-
</td>
|
634 |
-
<td scope="row" align="center">
|
635 |
-
<h3>Total Page Size</h3>
|
636 |
-
<span class="aj_latest_tps aj_gtmetrix_result"><?php echo $tps; ?>KB</span>
|
637 |
-
</td>
|
638 |
-
<td scope="row" align="center">
|
639 |
-
<h3>Requests</h3>
|
640 |
-
<span class="aj_latest_requests aj_gtmetrix_result"><?php echo $requests; ?></span>
|
641 |
-
</td>
|
642 |
-
</tr>
|
643 |
-
<tr><td scope="row" align="left" colspan="6">See full report: <span class="aj_latest_report"><?php echo $report_url; ?></span></td></tr>
|
644 |
-
</table>
|
645 |
-
<hr />
|
646 |
-
<?php
|
647 |
-
} else {
|
648 |
-
?>
|
649 |
-
<table id="aj_latest_gtmetrix_results" class="form-table aj-steps-table" width="100%" cellpadding="10" style="display: none;">
|
650 |
-
<tr>
|
651 |
-
<td scope="row" align="center"><img src="" class="aj_latest_screenshot aj_gtmetrix_screenshot">
|
652 |
-
<td scope="row" align="center">
|
653 |
-
<h3>PageSpeed Score</h3>
|
654 |
-
<span class="aj_latest_pagespeed aj_gtmetrix_result"></span>
|
655 |
-
</td>
|
656 |
-
<td scope="row" align="center">
|
657 |
-
<h3>YSlow Score</h3>
|
658 |
-
<span class="aj_latest_yslow aj_gtmetrix_result"></span>
|
659 |
-
</td>
|
660 |
-
<td scope="row" align="center">
|
661 |
-
<h3>Fully Loaded Time</h3>
|
662 |
-
<span class="aj_latest_flt aj_gtmetrix_result"></span>
|
663 |
-
</td>
|
664 |
-
<td scope="row" align="center">
|
665 |
-
<h3>Total Page Size</h3>
|
666 |
-
<span class="aj_latest_tps aj_gtmetrix_result"></span>
|
667 |
-
</td>
|
668 |
-
<td scope="row" align="center">
|
669 |
-
<h3>Requests</h3>
|
670 |
-
<span class="aj_latest_requests aj_gtmetrix_result"></span>
|
671 |
-
</td>
|
672 |
-
</tr>
|
673 |
-
<tr><td scope="row" align="center" colspan="6">See full report: <span class="aj_latest_report"></span></td></tr>
|
674 |
-
</table>
|
675 |
-
<hr />
|
676 |
-
<?php
|
677 |
-
}
|
678 |
-
?>
|
679 |
-
<p>Please click on the button below to generate a new GTmetrix Report.</p>
|
680 |
-
<p><strong>Please Note:</strong> By clicking the button below you acknowledge that you understand that one (1) GTmetrix API credit will be used.</p>
|
681 |
-
<p><button data-id="aj_gtmetrix_test" class="aj_steps_button">Run GTmetrix Test</button></p>
|
682 |
-
<h3>GTmetrix API Key</h3>
|
683 |
-
<p>If you haven't already done so, grab an API Key from GTmetrix so that <?php echo AJ_TITLE; ?> can obtain your PageSpeed / YSlow results. Here's how:</p>
|
684 |
-
<ol>
|
685 |
-
<li>Navigate to <a href="https://gtmetrix.com/api/" target="_blank">https://gtmetrix.com/api/</a> (link opens in a new tab)</li>
|
686 |
-
<li>If you do not already have an account with GTmetrix, go ahead and sign up (it's FREE!).</li>
|
687 |
-
<li>Log in to your GTmetrix account.</li>
|
688 |
-
<li>If you haven't yet generated your API Key, click on <strong>Generate API Key</strong></li>
|
689 |
-
<li>Copy your Username and API Key into the fields below:<br /><input type="text" id="aj_gtmetrix_username" value="<?php echo $aj_gtmetrix_username; ?>" placeholder="GTmetrix Username"><input type="text" id="aj_gtmetrix_api_key" value="<?php echo $aj_gtmetrix_api_key; ?>" placeholder="GTmetrix API Key"></li>
|
690 |
-
<li>Select the desired server.<br />
|
691 |
-
<select id="aj_gtmetrix_server">
|
692 |
-
<?php
|
693 |
-
$gtmetrix_locations = array(
|
694 |
-
'Vancouver, Canada' => 1,
|
695 |
-
'London, United Kingdom' => 2,
|
696 |
-
'Sydney, Australia' => 3,
|
697 |
-
'Dallas, United States' => 4,
|
698 |
-
'Mumbai, India' => 5
|
699 |
-
);
|
700 |
-
foreach ( $gtmetrix_locations as $location => $value ) {
|
701 |
-
$selected = ( $aj_gtmetrix_server == $value ) ? ' selected="selected"' : '';
|
702 |
-
echo '<option value="' . $value . '"' . $selected . '>' . $location . '</option>';
|
703 |
-
}
|
704 |
-
?>
|
705 |
-
</select>
|
706 |
-
</li>
|
707 |
-
<li>GTmetrix Credits Available: <span class="aj_gtmetrix_credits"><?php echo $credits; ?></span></li>
|
708 |
-
</ol>
|
709 |
-
<hr />
|
710 |
-
<?php echo hints_tips(); ?>
|
711 |
-
</td>
|
712 |
-
</tr>
|
713 |
-
</table>
|
714 |
-
<?php
|
715 |
-
} else if ( $active_tab == 'settings' ) {
|
716 |
-
$site_url = trailingslashit( get_site_url() );
|
717 |
-
$aj_gtmetrix_username = get_option( 'aj_gtmetrix_username', '' );
|
718 |
-
$aj_gtmetrix_api_key = get_option( 'aj_gtmetrix_api_key', '' );
|
719 |
-
$aj_gtmetrix_server = get_option( 'aj_gtmetrix_server', '' );
|
720 |
-
$aj_enabled = get_option( 'aj_enabled', 0 );
|
721 |
-
$aj_enabled_checked = ( $aj_enabled == 1 ) ? ' checked="checked"' : '';
|
722 |
-
$aj_method = get_option( 'aj_method', 'async' );
|
723 |
-
$aj_method_async = ( $aj_method == 'async' ) ? ' checked="checked"' : '';
|
724 |
-
$aj_method_defer = ( $aj_method == 'defer' ) ? ' checked="checked"' : '';
|
725 |
-
$aj_jquery = get_option( 'aj_jquery', 'async' );
|
726 |
-
$aj_jquery = ( $aj_jquery == 'same ' ) ? $aj_method : $aj_jquery;
|
727 |
-
$aj_jquery_async = ( $aj_jquery == 'async' ) ? ' checked="checked"' : '';
|
728 |
-
$aj_jquery_defer = ( $aj_jquery == 'defer' ) ? ' checked="checked"' : '';
|
729 |
-
$aj_jquery_exclude = ( $aj_jquery == 'exclude' ) ? ' checked="checked"' : '';
|
730 |
-
$aj_exclusions = get_option( 'aj_exclusions', '' );
|
731 |
-
$aj_autoptimize_enabled = get_option( 'aj_autoptimize_enabled', 0 );
|
732 |
-
$aj_autoptimize_enabled_checked = ( $aj_autoptimize_enabled == 1 ) ? ' checked="checked"' : '';
|
733 |
-
$aj_autoptimize_method = get_option( 'aj_autoptimize_method', 'async' );
|
734 |
-
$aj_autoptimize_async = ( $aj_autoptimize_method == 'async' ) ? ' checked="checked"' : '';
|
735 |
-
$aj_autoptimize_defer = ( $aj_autoptimize_method == 'defer' ) ? ' checked="checked"' : '';
|
736 |
-
?>
|
737 |
-
<table class="form-table" width="100%" cellpadding="10">
|
738 |
-
<tr id="aj_intro">
|
739 |
-
<td scope="row" align="center" style="vertical-align: top !important;"><img src="<?php echo AJ_PLUGIN_URL; ?>images/finger_point_out_punch_hole_400_clr_17860.png" title="<?php echo AJ_TITLE; ?>" alt="<?php echo AJ_TITLE; ?>" class="aj_step_img"></td>
|
740 |
-
<td scope="row" align="left" style="vertical-align: top !important;">
|
741 |
-
<h3><?php echo AJ_TITLE; ?></h3>
|
742 |
-
<?php echo about_aj(); ?>
|
743 |
-
</td>
|
744 |
-
</tr>
|
745 |
-
<tr id="aj_settings_enable">
|
746 |
-
<td scope="row" align="center" style="vertical-align: top !important;"><img src="<?php echo AJ_PLUGIN_URL; ?>images/finger_point_out_punch_hole_400_clr_17860.png" title="Enable <?php echo AJ_TITLE; ?>" alt="Enable <?php echo AJ_TITLE; ?>" class="aj_step_img"></td>
|
747 |
-
<td scope="row" align="left" style="vertical-align: top !important;">
|
748 |
-
<h3>Enable <?php echo AJ_TITLE; ?></h3>
|
749 |
-
<p><label>Enable <?php echo AJ_TITLE; ?>? </label><input type="checkbox" id="aj_enabled" id="aj_enabled" value="1" <?php echo $aj_enabled_checked; ?> /></p>
|
750 |
-
<hr />
|
751 |
-
<h3><?php echo AJ_TITLE; ?> Method</h3>
|
752 |
-
<p>Please select the method (<strong>async</strong> or <strong>defer</strong>) that you wish to enable:</p>
|
753 |
-
<p><label>Method: </label><input type="radio" name="aj_method" value="async" <?php echo $aj_method_async; ?> /> Async <input type="radio" name="aj_method" value="defer" <?php echo $aj_method_defer; ?> /> Defer</p>
|
754 |
-
<hr />
|
755 |
-
<h3>jQuery</h3>
|
756 |
-
<p>Often if jQuery is loaded with <strong>async</strong> or <strong>defer</strong> it can break some jQuery functions, specifically inline scripts which require jQuery to be loaded before the scripts are run. <strong><em>Sometimes</em></strong> choosing a different method (<strong>async</strong> or <strong>defer</strong>) will work, otherwise it may be necessary to exclude jQuery from having <strong>async</strong> or <strong>defer</strong> applied.</p>
|
757 |
-
<p><label>jQuery Method: </label><input type="radio" name="aj_jquery" value="async" <?php echo $aj_jquery_async; ?> /> Async <input type="radio" name="aj_jquery" value="defer" <?php echo $aj_jquery_defer; ?> /> Defer <input type="radio" name="aj_jquery" value="exclude" <?php echo $aj_jquery_exclude; ?> /> Exclude</p>
|
758 |
-
<hr />
|
759 |
-
<h3>Script Exclusion</h3>
|
760 |
-
<p>Please list any scripts which you would like excluded from having <strong>async</strong> or <strong>defer</strong> applied during page load. (comma seperated list eg: jquery.js,jquery-ui.js)</p>
|
761 |
-
<p><label>Exclusions: </label><textarea id="aj_exclusions" style="width:95%;"><?php echo $aj_exclusions; ?></textarea></p>
|
762 |
-
<hr />
|
763 |
-
<h3><?php echo AJ_TITLE; ?> For Plugins</h3>
|
764 |
-
<p>Although not recommended, some themes / plugins can load JavaScript files without using the <strong><a href="https://codex.wordpress.org/Plugin_API/Action_Reference/wp_enqueue_scripts" target="_blank">wp_enqueue_script</a></strong> function. In some cases this is necessary for the functionality of the theme / plugin.</p>
|
765 |
-
<p>If these themes / plugins provide a hook that can be used to manipulate how the JavaScript file is loaded then <?php echo AJ_TITLE; ?> may be able to provide support for these themes / plugins.</p>
|
766 |
-
<p>If you have any active themes / plugins that <?php echo AJ_TITLE; ?> supports then these will be listed below.</p>
|
767 |
-
<p>If you think you have found a plugin that <?php echo AJ_TITLE; ?> may be able to provide support for please lodge a ticket at <a href="https://cloughit.com.au/support/?wpsc_category=8" target="_blank">https://cloughit.com.au/support/</a></p>
|
768 |
-
<?php
|
769 |
-
if ( is_plugin_active( 'autoptimize/autoptimize.php' ) ) {
|
770 |
-
?>
|
771 |
-
<div class="aj_plugin">
|
772 |
-
<h4>Plugin: Autoptimize</h4>
|
773 |
-
<p><a href="https://wordpress.org/plugins/autoptimize/" target="_blank">https://wordpress.org/plugins/autoptimize/</a></p>
|
774 |
-
<p><label>Enable Autoptimize Support: </label><input type="checkbox" id="aj_autoptimize_enabled" value="1" <?php echo $aj_autoptimize_enabled_checked; ?> /></p>
|
775 |
-
<p><label>jQuery Method: </label><input type="radio" name="aj_autoptimize_method" value="async" <?php echo $aj_autoptimize_async; ?> /> Async <input type="radio" name="aj_autoptimize_method" value="defer" <?php echo $aj_autoptimize_defer; ?> /> Defer</p>
|
776 |
-
</div>
|
777 |
-
<?php
|
778 |
-
}
|
779 |
-
?>
|
780 |
-
<p><button data-id="aj_save_settings" class="aj_steps_button">Save Settings</button></p>
|
781 |
-
</td>
|
782 |
-
</tr>
|
783 |
-
</table>
|
784 |
-
<?php
|
785 |
-
} else if ( $active_tab == 'help' ) {
|
786 |
-
?>
|
787 |
-
<table class="form-table" width="100%" cellpadding="10">
|
788 |
-
<tr>
|
789 |
-
<td scope="row" align="center" style="vertical-align: top !important;"><img src="<?php echo AJ_PLUGIN_URL; ?>images/stick_figure_panicking_150_clr_13267.gif" title="Help & Support" alt="Help & Support" class="aj_step_img"></td>
|
790 |
-
<td scope="row" align="left" style="vertical-align: top !important;">
|
791 |
-
<h3>Help & Support</h3>
|
792 |
-
<p>Below are some answers to some frequently asked questions about <?php echo AJ_TITLE; ?></p>
|
793 |
-
<hr />
|
794 |
-
<h3>Which browsers support the 'async' and 'defer' attributes?</h3>
|
795 |
-
<p>The 'async' attribute is new in HTML5. It is supported by the following browsers:</p>
|
796 |
-
<ul>
|
797 |
-
<li>Chrome</li>
|
798 |
-
<li>IE 10 and higher</li>
|
799 |
-
<li>Firefox 3.6 and higher</li>
|
800 |
-
<li>Safari</li>
|
801 |
-
<li>Opera</li>
|
802 |
-
</ul>
|
803 |
-
<hr />
|
804 |
-
<h3>Where can I get help?</h3>
|
805 |
-
<p><?php echo AJ_TITLE; ?> is supported exclusively via our Support Ticketing System at <a href="https://cloughit.com.au/support/?wpsc_category=8" target="_blank">https://cloughit.com.au/support/</a></p>
|
806 |
-
<hr />
|
807 |
-
<h3>What support do you provide?</h3>
|
808 |
-
<p>We will provide support for any functionality of the <?php echo AJ_TITLE; ?> plugin itself, suggestions for theme / plugin support and suggestions on how <?php echo AJ_TITLE; ?> could be improved.</p>
|
809 |
-
<hr />
|
810 |
-
<h3>What support don't you provide?</h3>
|
811 |
-
<p>We will not provide support for questions such as 'Why is <?php echo AJ_TITLE; ?> not making any improvement on my site?'. If you need this level of support we offer a bundled <?php echo AJ_TITLE; ?> Pro plus Installation & Configuration (homepage only) AUD $155.00 (<a href="https://cloughit.com.au/product/async-javascript-pro-plus-install/" target="_blank">buy now!</a>)</p>
|
812 |
-
<hr />
|
813 |
-
<h3>Can I use the WordPress Forums to get support for <?php echo AJ_TITLE; ?>?</h3>
|
814 |
-
<p>No. Support is provided via our Support Ticketing System at <a href="https://cloughit.com.au/support/?wpsc_category=8" target="_blank">https://cloughit.com.au/support/</a></p>
|
815 |
-
<hr />
|
816 |
-
<h3>Can I email the author directly to get support for <?php echo AJ_TITLE; ?>?</h3>
|
817 |
-
<p>No. Support is provided via our Support Ticketing System at <a href="https://cloughit.com.au/support/?wpsc_category=8" target="_blank">https://cloughit.com.au/support/</a></p>
|
818 |
-
<hr />
|
819 |
-
<h3>What about CSS?</h3>
|
820 |
-
<p>As the name implies, <?php echo AJ_TITLE; ?> is built to enhance JavaScript loading only. <?php echo AJ_TITLE; ?> does not have any impact on CSS.</p>
|
821 |
-
<p>We recommend using the awesome <a href="https://wordpress.org/plugins/autoptimize/" target="_blank">Autoptimize</a> plugin alongside <?php echo AJ_TITLE; ?> for CSS optimization.</p>
|
822 |
-
<hr />
|
823 |
-
<h3>Do you have a pro version?</h3>
|
824 |
-
<p>Yes we do! Here are some of the benefits of <?php echo AJ_TITLE; ?> Pro:</p>
|
825 |
-
<ul>
|
826 |
-
<li>Selective ‘async’ – choose which JavaScripts to apply ‘async’ to</li>
|
827 |
-
<li>Selective ‘defer’ – choose which JavaScripts to apply ‘defer’ to</li>
|
828 |
-
<li>Exclude individual scripts – choose which JavaScripts to ignore</li>
|
829 |
-
<li>Exclude plugins – choose local plugin JavaScripts to ignore</li>
|
830 |
-
<li>Exclude themes – choose local theme JavaScripts to ignore</li>
|
831 |
-
</ul>
|
832 |
-
<p><a href="https://cloughit.com.au/product/async-javascript-pro/" target="_blank">Buy Now!</a></p>
|
833 |
-
<hr />
|
834 |
-
<h3>I want out, how should I remove <?php echo AJ_TITLE; ?>?</h3>
|
835 |
-
<ul>
|
836 |
-
<li>Disable the plugin</li>
|
837 |
-
<li>Delete the plugin</li>
|
838 |
-
</ul>
|
839 |
-
</td>
|
840 |
-
</tr>
|
841 |
-
</table>
|
842 |
-
<?php
|
843 |
-
}
|
844 |
-
?>
|
845 |
-
</div>
|
846 |
-
<?php
|
847 |
-
}
|
848 |
-
/**
|
849 |
-
* about_aj()
|
850 |
-
*
|
851 |
-
* Return common text for about Async JavaScript
|
852 |
-
*
|
853 |
-
*/
|
854 |
-
function about_aj() {
|
855 |
-
$return = '';
|
856 |
-
$return .= '<p>When a JavaScript file is loaded via the <strong><a href="https://codex.wordpress.org/Plugin_API/Action_Reference/wp_enqueue_scripts" target="_blank">wp_enqueue_script</a></strong> function, ' . AJ_TITLE . ' will add an <strong>async</strong> or <strong>defer</strong> attribute.</p>';
|
857 |
-
$return .= '<p>There are several ways an external JavaScript file can be executed:</p>';
|
858 |
-
$return .= '<ul style="list-style:disc inside;">';
|
859 |
-
$return .= '<li>If <strong>async</strong> is present: The script is executed asynchronously with the rest of the page (the script will be executed while the page continues the parsing)</li>';
|
860 |
-
$return .= '<li>If <strong>defer</strong> is present and <strong>async</strong> is not present: The script is executed when the page has finished parsing</li>';
|
861 |
-
$return .= '<li>If neither <strong>async</strong> or <strong>defer</strong> is present: The script is fetched and executed immediately, before the browser continues parsing the page</li>';
|
862 |
-
$return .= '</ul>';
|
863 |
-
$return .= '<p>Using <strong>async</strong> or <strong>defer</strong> helps to eliminate render-blocking JavaScript in above-the-fold content. This can also help to increase your pagespeed which in turn can assist in improving your page ranking.</p>';
|
864 |
-
return $return;
|
865 |
-
}
|
866 |
-
/**
|
867 |
-
* hints_tips()
|
868 |
-
*
|
869 |
-
* Return common text for Hints & Tips
|
870 |
-
*
|
871 |
-
*/
|
872 |
-
function hints_tips() {
|
873 |
-
$return = '';
|
874 |
-
$return .= '<h3>Further Hints & Tips</h3>';
|
875 |
-
if ( is_plugin_active( 'autoptimize/autoptimize.php' ) ) {
|
876 |
-
$return .= '<p>' . AJ_TITLE . ' has detected that you have Autoptimize installed and active. ' . AJ_TITLE . ' can further enhance Autoptimize results by applying Async or Defer to the cache files used by Autoptimize.</p>';
|
877 |
-
} else {
|
878 |
-
$return .= '<p>' . AJ_TITLE . ' has detected that you do not have Autoptimize installed and active. Autoptimize can provide further optimization of JavaScript which can benefit the results of ' . AJ_TITLE . ' (and ' . AJ_TITLE . ' can also enhance Autoptimize results!)</p>';
|
879 |
-
$return .= '<p>You can install Autoptimize from the plugin repository, or download it from here: <a href="https://wordpress.org/plugins/autoptimize/" target="_blank">https://wordpress.org/plugins/autoptimize/</a></p>';
|
880 |
-
}
|
881 |
-
$return .= '<p>Through our testing the following common Autoptimize settings work well to achieve the best results. Of course each website is different so you may need to fine tune these settings to suit.</p>';
|
882 |
-
$return .= '<ol>';
|
883 |
-
$return .= '<li>Navigate to <strong>Settings > Autoptimize</strong></li>';
|
884 |
-
$return .= '<li>Click on the <strong>Show advanced settings</strong> button</li>';
|
885 |
-
$return .= '<li>Under <strong>JavaScript Options</strong> set the following:</li>';
|
886 |
-
$return .= '<ul>';
|
887 |
-
$return .= '<li><strong>Optimize JavaScript Code?</strong>: Checked</li>';
|
888 |
-
$return .= '<li><strong>Force JavaScript in <head>?</strong>: Unchecked</li>';
|
889 |
-
$return .= '<li><strong>Also aggregate inline JS?</strong>: Checked<br />(did you need to exclude jQuery in ' . AJ_TITLE . '? Enabling this option <strong><em>MAY</em></strong> help resolve jQuery errors caused by inline JavaScript / jQuery code)</li>';
|
890 |
-
$return .= '<li><strong>Exclude scripts from Autoptimize:</strong>: Leave as default (or add any other scripts that you may need to exclude)</li>';
|
891 |
-
$return .= '<li><strong>Add try-catch wrapping?</strong>: Unchecked</li>';
|
892 |
-
$return .= '</ul>';
|
893 |
-
$return .= '<li>Click on the <strong>Save Changes and Empty Cache</strong> button</li>';
|
894 |
-
$return .= '<li>Navigate to <strong>Settings > ' . AJ_TITLE . '</strong></li>';
|
895 |
-
$return .= '<li>Click on the <strong>Settings</strong> tab</li>';
|
896 |
-
$return .= '<li>Scroll down to <strong>' . AJ_TITLE . ' For Plugins</strong></li>';
|
897 |
-
$return .= '<li>Under <strong>Autoptimize</strong> set the following:</li>';
|
898 |
-
$return .= '<ul>';
|
899 |
-
$return .= '<li><strong>Enable Autoptimize Support</strong>: Checked</li>';
|
900 |
-
$return .= '<li><strong>Method</strong>: Select either <strong>Async</strong> or <strong>Defer</strong> (testing has found that <strong>Defer</strong> usually works best here!)</li>';
|
901 |
-
$return .= '</ul>';
|
902 |
-
$return .= '<li>Click on <strong>Save Changes</strong></li>';
|
903 |
-
$return .= '</ol>';
|
904 |
-
return $return;
|
905 |
-
}
|
906 |
-
/**
|
907 |
-
* async_js()
|
908 |
-
*
|
909 |
-
* Add 'async' or 'defer' attribute to '<script>' tasks called via wp_enqueue_script using the 'script_loader_tag' filter
|
910 |
-
*
|
911 |
-
*/
|
912 |
-
add_filter( 'script_loader_tag', 'async_js', 10, 3 );
|
913 |
-
function async_js( $tag, $handle, $src ) {
|
914 |
-
if ( isset( $_GET['aj_simulate'] ) ) {
|
915 |
-
$aj_enabled = true;
|
916 |
-
$aj_method = sanitize_text_field( $_GET['aj_simulate'] );
|
917 |
-
if ( isset( $_GET['aj_simulate_jquery'] ) ) {
|
918 |
-
$aj_jquery = sanitize_text_field( $_GET['aj_simulate_jquery'] );
|
919 |
-
} else {
|
920 |
-
$aj_jquery = $aj_method;
|
921 |
-
}
|
922 |
-
$array_exclusions = array();
|
923 |
-
} else {
|
924 |
-
$aj_enabled = ( get_option( 'aj_enabled', 0 ) == 1 ) ? true : false;
|
925 |
-
$aj_method = ( get_option( 'aj_method', 'async' ) == 'async' ) ? 'async' : 'defer';
|
926 |
-
$aj_jquery = get_option( 'aj_jquery', 'async' );
|
927 |
-
$aj_jquery = ( $aj_jquery == 'same ' ) ? $aj_method : $aj_jquery;
|
928 |
-
$aj_exclusions = get_option( 'aj_exclusions', '' );
|
929 |
-
$array_exclusions = ( $aj_exclusions != '' ) ? explode( ',', $aj_exclusions ) : array();
|
930 |
-
}
|
931 |
-
if ( false !== $aj_enabled && false === is_admin() ) {
|
932 |
-
if ( is_array( $array_exclusions ) && !empty( $array_exclusions ) ) {
|
933 |
-
foreach ( $array_exclusions as $exclusion ) {
|
934 |
-
$exclusion = trim( $exclusion );
|
935 |
-
if ( $exclusion != '' ) {
|
936 |
-
if ( false !== strpos( strtolower( $src ), strtolower( $exclusion ) ) ) {
|
937 |
-
return $tag;
|
938 |
-
}
|
939 |
-
}
|
940 |
-
}
|
941 |
-
}
|
942 |
-
if ( false !== strpos( strtolower( $src ), 'js/jquery/jquery.js' ) ) {
|
943 |
-
if ( $aj_jquery == 'async' || $aj_jquery == 'defer' ) {
|
944 |
-
$tag = str_replace( 'src=', $aj_jquery . "='" . $aj_jquery . "' src=", $tag );
|
945 |
-
return $tag;
|
946 |
-
} else if ( $aj_jquery == 'exclude' ) {
|
947 |
-
return $tag;
|
948 |
-
}
|
949 |
-
}
|
950 |
-
$tag = str_replace( 'src=', $aj_method . "='" . $aj_method . "' src=", $tag );
|
951 |
-
return $tag;
|
952 |
-
}
|
953 |
-
return $tag;
|
954 |
-
}
|
955 |
-
/**
|
956 |
-
* my_autoptimize_defer()
|
957 |
-
*
|
958 |
-
* Adds support for Autoptimize plugin. Adds 'async' attribute to '<script>' tasks called via autoptimize_filter_js_defer filter
|
959 |
-
* Autoptimize: https://wordpress.org/plugins/autoptimize/
|
960 |
-
*
|
961 |
-
*/
|
962 |
-
add_filter( 'autoptimize_filter_js_defer', 'my_autoptimize_defer', 11 );
|
963 |
-
function my_autoptimize_defer( $defer ) {
|
964 |
-
$aj_enabled = ( get_option( 'aj_enabled', 0 ) == 1 ) ? true : false;
|
965 |
-
$aj_method = ( get_option( 'aj_method', 'async' ) == 'async' ) ? 'async' : 'defer';
|
966 |
-
$aj_autoptimize_enabled = ( get_option( 'aj_autoptimize_enabled', 0 ) == 1 ) ? true : false;
|
967 |
-
$aj_autoptimize_method = ( get_option( 'aj_autoptimize_method', 'async' ) == 'async' ) ? 'async' : 'defer';
|
968 |
-
if ( false !== $aj_enabled && false === is_admin() ) {
|
969 |
-
if ( false !== $aj_autoptimize_enabled ) {
|
970 |
-
return " " . $aj_autoptimize_method . "='" . $aj_autoptimize_method . "' ";
|
971 |
-
}
|
972 |
-
}
|
973 |
-
}
|
974 |
-
function aj_steps() {
|
975 |
-
check_ajax_referer( 'aj_nonce', 'security' );
|
976 |
-
$aj_gtmetrix_results = get_option( 'aj_gtmetrix_results', array() );
|
977 |
-
if ( !isset( $_POST['sub_action'] ) ) {
|
978 |
-
$return = array(
|
979 |
-
'status' => false,
|
980 |
-
'error' => 'No sub action defined.'
|
981 |
-
);
|
982 |
-
} else {
|
983 |
-
$sub_action = sanitize_text_field( $_POST['sub_action'] );
|
984 |
-
switch ( $sub_action ) {
|
985 |
-
case 'aj_step2':
|
986 |
-
$aj_gtmetrix_username = sanitize_text_field( $_POST['aj_gtmetrix_username'] );
|
987 |
-
$aj_gtmetrix_api_key = sanitize_text_field( $_POST['aj_gtmetrix_api_key'] );
|
988 |
-
$aj_gtmetrix_server = sanitize_text_field( $_POST['aj_gtmetrix_server'] );
|
989 |
-
$site_url = trailingslashit( esc_url( $_POST['site_url'] ) );
|
990 |
-
update_option( 'aj_gtmetrix_username', $aj_gtmetrix_username );
|
991 |
-
update_option( 'aj_gtmetrix_api_key', $aj_gtmetrix_api_key );
|
992 |
-
update_option( 'aj_gtmetrix_server', $aj_gtmetrix_server );
|
993 |
-
$test = new Services_WTF_Test();
|
994 |
-
$test->api_username( $aj_gtmetrix_username );
|
995 |
-
$test->api_password( $aj_gtmetrix_api_key );
|
996 |
-
$test->user_agent( AJ_UA );
|
997 |
-
$args = array(
|
998 |
-
'url' => $site_url,
|
999 |
-
'location' => $aj_gtmetrix_server
|
1000 |
-
);
|
1001 |
-
$testid = $test->test( $args );
|
1002 |
-
if ( $testid ) {
|
1003 |
-
$test->get_results();
|
1004 |
-
if ( $test->error() ) {
|
1005 |
-
$return = array(
|
1006 |
-
'status' => false,
|
1007 |
-
'error' => $test->error()
|
1008 |
-
);
|
1009 |
-
} else {
|
1010 |
-
$testid = $test->get_test_id();
|
1011 |
-
$results = $test->results();
|
1012 |
-
$resources = $test->resources();
|
1013 |
-
$status = $test->status();
|
1014 |
-
$credits = $status['api_credits'];
|
1015 |
-
$return = array(
|
1016 |
-
'status' => true,
|
1017 |
-
'testid' => $testid,
|
1018 |
-
'results' => $results,
|
1019 |
-
'resources' => $resources,
|
1020 |
-
'id' => $sub_action,
|
1021 |
-
'name' => 'Baseline',
|
1022 |
-
'url' => $args['url'],
|
1023 |
-
'credits' => $credits
|
1024 |
-
);
|
1025 |
-
$aj_gtmetrix_results[$sub_action] = $return;
|
1026 |
-
update_option( 'aj_gtmetrix_results', $aj_gtmetrix_results );
|
1027 |
-
}
|
1028 |
-
} else {
|
1029 |
-
$return = array(
|
1030 |
-
'status' => false,
|
1031 |
-
'error' => $test->error()
|
1032 |
-
);
|
1033 |
-
}
|
1034 |
-
break;
|
1035 |
-
case 'aj_step2b':
|
1036 |
-
$aj_gtmetrix_username = sanitize_text_field( $_POST['aj_gtmetrix_username'] );
|
1037 |
-
$aj_gtmetrix_api_key = sanitize_text_field( $_POST['aj_gtmetrix_api_key'] );
|
1038 |
-
$aj_gtmetrix_server = sanitize_text_field( $_POST['aj_gtmetrix_server'] );
|
1039 |
-
$site_url = trailingslashit( esc_url( $_POST['site_url'] ) );
|
1040 |
-
update_option( 'aj_gtmetrix_username', $aj_gtmetrix_username );
|
1041 |
-
update_option( 'aj_gtmetrix_api_key', $aj_gtmetrix_api_key );
|
1042 |
-
update_option( 'aj_gtmetrix_server', $aj_gtmetrix_server );
|
1043 |
-
$test = new Services_WTF_Test();
|
1044 |
-
$test->api_username( $aj_gtmetrix_username );
|
1045 |
-
$test->api_password( $aj_gtmetrix_api_key );
|
1046 |
-
$test->user_agent( AJ_UA );
|
1047 |
-
$args = array(
|
1048 |
-
'url' => $site_url . '?aj_simulate=async',
|
1049 |
-
'location' => $aj_gtmetrix_server
|
1050 |
-
);
|
1051 |
-
$testid = $test->test( $args );
|
1052 |
-
if ( $testid ) {
|
1053 |
-
$test->get_results();
|
1054 |
-
if ( $test->error() ) {
|
1055 |
-
$return = array(
|
1056 |
-
'status' => false,
|
1057 |
-
'error' => $test->error()
|
1058 |
-
);
|
1059 |
-
} else {
|
1060 |
-
$testid = $test->get_test_id();
|
1061 |
-
$results = $test->results();
|
1062 |
-
$resources = $test->resources();
|
1063 |
-
$status = $test->status();
|
1064 |
-
$credits = $status['api_credits'];
|
1065 |
-
$return = array(
|
1066 |
-
'status' => true,
|
1067 |
-
'testid' => $testid,
|
1068 |
-
'results' => $results,
|
1069 |
-
'resources' => $resources,
|
1070 |
-
'id' => $sub_action,
|
1071 |
-
'name' => 'Async',
|
1072 |
-
'url' => $args['url'],
|
1073 |
-
'credits' => $credits
|
1074 |
-
);
|
1075 |
-
$aj_gtmetrix_results[$sub_action] = $return;
|
1076 |
-
update_option( 'aj_gtmetrix_results', $aj_gtmetrix_results );
|
1077 |
-
}
|
1078 |
-
} else {
|
1079 |
-
$return = array(
|
1080 |
-
'status' => false,
|
1081 |
-
'error' => $test->error()
|
1082 |
-
);
|
1083 |
-
}
|
1084 |
-
break;
|
1085 |
-
case 'aj_step2c':
|
1086 |
-
$aj_gtmetrix_username = sanitize_text_field( $_POST['aj_gtmetrix_username'] );
|
1087 |
-
$aj_gtmetrix_api_key = sanitize_text_field( $_POST['aj_gtmetrix_api_key'] );
|
1088 |
-
$aj_gtmetrix_server = sanitize_text_field( $_POST['aj_gtmetrix_server'] );
|
1089 |
-
$site_url = trailingslashit( esc_url( $_POST['site_url'] ) );
|
1090 |
-
update_option( 'aj_gtmetrix_username', $aj_gtmetrix_username );
|
1091 |
-
update_option( 'aj_gtmetrix_api_key', $aj_gtmetrix_api_key );
|
1092 |
-
update_option( 'aj_gtmetrix_server', $aj_gtmetrix_server );
|
1093 |
-
$test = new Services_WTF_Test();
|
1094 |
-
$test->api_username( $aj_gtmetrix_username );
|
1095 |
-
$test->api_password( $aj_gtmetrix_api_key );
|
1096 |
-
$test->user_agent( AJ_UA );
|
1097 |
-
$args = array(
|
1098 |
-
'url' => $site_url . '?aj_simulate=defer',
|
1099 |
-
'location' => $aj_gtmetrix_server
|
1100 |
-
);
|
1101 |
-
$testid = $test->test( $args );
|
1102 |
-
if ( $testid ) {
|
1103 |
-
$test->get_results();
|
1104 |
-
if ( $test->error() ) {
|
1105 |
-
$return = array(
|
1106 |
-
'status' => false,
|
1107 |
-
'error' => $test->error()
|
1108 |
-
);
|
1109 |
-
} else {
|
1110 |
-
$testid = $test->get_test_id();
|
1111 |
-
$results = $test->results();
|
1112 |
-
$resources = $test->resources();
|
1113 |
-
$status = $test->status();
|
1114 |
-
$credits = $status['api_credits'];
|
1115 |
-
$return = array(
|
1116 |
-
'status' => true,
|
1117 |
-
'testid' => $testid,
|
1118 |
-
'results' => $results,
|
1119 |
-
'resources' => $resources,
|
1120 |
-
'id' => $sub_action,
|
1121 |
-
'name' => 'Defer',
|
1122 |
-
'url' => $args['url'],
|
1123 |
-
'credits' => $credits
|
1124 |
-
);
|
1125 |
-
$aj_gtmetrix_results[$sub_action] = $return;
|
1126 |
-
update_option( 'aj_gtmetrix_results', $aj_gtmetrix_results );
|
1127 |
-
}
|
1128 |
-
} else {
|
1129 |
-
$return = array(
|
1130 |
-
'status' => false,
|
1131 |
-
'error' => $test->error()
|
1132 |
-
);
|
1133 |
-
}
|
1134 |
-
break;
|
1135 |
-
case 'aj_step2d':
|
1136 |
-
$aj_gtmetrix_username = sanitize_text_field( $_POST['aj_gtmetrix_username'] );
|
1137 |
-
$aj_gtmetrix_api_key = sanitize_text_field( $_POST['aj_gtmetrix_api_key'] );
|
1138 |
-
$aj_gtmetrix_server = sanitize_text_field( $_POST['aj_gtmetrix_server'] );
|
1139 |
-
$site_url = trailingslashit( esc_url( $_POST['site_url'] ) );
|
1140 |
-
update_option( 'aj_gtmetrix_username', $aj_gtmetrix_username );
|
1141 |
-
update_option( 'aj_gtmetrix_api_key', $aj_gtmetrix_api_key );
|
1142 |
-
update_option( 'aj_gtmetrix_server', $aj_gtmetrix_server );
|
1143 |
-
$test = new Services_WTF_Test();
|
1144 |
-
$test->api_username( $aj_gtmetrix_username );
|
1145 |
-
$test->api_password( $aj_gtmetrix_api_key );
|
1146 |
-
$test->user_agent( AJ_UA );
|
1147 |
-
$args = array(
|
1148 |
-
'url' => $site_url . '?aj_simulate=async&aj_simulate_jquery=exclude',
|
1149 |
-
'location' => $aj_gtmetrix_server
|
1150 |
-
);
|
1151 |
-
$testid = $test->test( $args );
|
1152 |
-
if ( $testid ) {
|
1153 |
-
$test->get_results();
|
1154 |
-
if ( $test->error() ) {
|
1155 |
-
$return = array(
|
1156 |
-
'status' => false,
|
1157 |
-
'error' => $test->error()
|
1158 |
-
);
|
1159 |
-
} else {
|
1160 |
-
$testid = $test->get_test_id();
|
1161 |
-
$results = $test->results();
|
1162 |
-
$resources = $test->resources();
|
1163 |
-
$status = $test->status();
|
1164 |
-
$credits = $status['api_credits'];
|
1165 |
-
$return = array(
|
1166 |
-
'status' => true,
|
1167 |
-
'testid' => $testid,
|
1168 |
-
'results' => $results,
|
1169 |
-
'resources' => $resources,
|
1170 |
-
'id' => $sub_action,
|
1171 |
-
'name' => 'Async (jQuery Excluded)',
|
1172 |
-
'url' => $args['url'],
|
1173 |
-
'credits' => $credits
|
1174 |
-
);
|
1175 |
-
$aj_gtmetrix_results[$sub_action] = $return;
|
1176 |
-
update_option( 'aj_gtmetrix_results', $aj_gtmetrix_results );
|
1177 |
-
}
|
1178 |
-
} else {
|
1179 |
-
$return = array(
|
1180 |
-
'status' => false,
|
1181 |
-
'error' => $test->error()
|
1182 |
-
);
|
1183 |
-
}
|
1184 |
-
break;
|
1185 |
-
case 'aj_step2e':
|
1186 |
-
$aj_gtmetrix_username = sanitize_text_field( $_POST['aj_gtmetrix_username'] );
|
1187 |
-
$aj_gtmetrix_api_key = sanitize_text_field( $_POST['aj_gtmetrix_api_key'] );
|
1188 |
-
$aj_gtmetrix_server = sanitize_text_field( $_POST['aj_gtmetrix_server'] );
|
1189 |
-
$site_url = trailingslashit( esc_url( $_POST['site_url'] ) );
|
1190 |
-
update_option( 'aj_gtmetrix_username', $aj_gtmetrix_username );
|
1191 |
-
update_option( 'aj_gtmetrix_api_key', $aj_gtmetrix_api_key );
|
1192 |
-
update_option( 'aj_gtmetrix_server', $aj_gtmetrix_server );
|
1193 |
-
$test = new Services_WTF_Test();
|
1194 |
-
$test->api_username( $aj_gtmetrix_username );
|
1195 |
-
$test->api_password( $aj_gtmetrix_api_key );
|
1196 |
-
$test->user_agent( AJ_UA );
|
1197 |
-
$args = array(
|
1198 |
-
'url' => $site_url . '?aj_simulate=defer&aj_simulate_jquery=exclude',
|
1199 |
-
'location' => $aj_gtmetrix_server
|
1200 |
-
);
|
1201 |
-
$testid = $test->test( $args );
|
1202 |
-
if ( $testid ) {
|
1203 |
-
$test->get_results();
|
1204 |
-
if ( $test->error() ) {
|
1205 |
-
$return = array(
|
1206 |
-
'status' => false,
|
1207 |
-
'error' => $test->error()
|
1208 |
-
);
|
1209 |
-
} else {
|
1210 |
-
$testid = $test->get_test_id();
|
1211 |
-
$results = $test->results();
|
1212 |
-
$resources = $test->resources();
|
1213 |
-
$status = $test->status();
|
1214 |
-
$credits = $status['api_credits'];
|
1215 |
-
$return = array(
|
1216 |
-
'status' => true,
|
1217 |
-
'testid' => $testid,
|
1218 |
-
'results' => $results,
|
1219 |
-
'resources' => $resources,
|
1220 |
-
'id' => $sub_action,
|
1221 |
-
'name' => 'Defer (jQuery Excluded)',
|
1222 |
-
'url' => $args['url'],
|
1223 |
-
'credits' => $credits
|
1224 |
-
);
|
1225 |
-
$aj_gtmetrix_results[$sub_action] = $return;
|
1226 |
-
update_option( 'aj_gtmetrix_results', $aj_gtmetrix_results );
|
1227 |
-
}
|
1228 |
-
} else {
|
1229 |
-
$return = array(
|
1230 |
-
'status' => false,
|
1231 |
-
'error' => $test->error()
|
1232 |
-
);
|
1233 |
-
}
|
1234 |
-
break;
|
1235 |
-
case 'aj_step_results':
|
1236 |
-
$best_pagespeed = 0;
|
1237 |
-
$best_yslow = 0;
|
1238 |
-
$best_overall = 0;
|
1239 |
-
$best_result = array();
|
1240 |
-
$baseline = $aj_gtmetrix_results['aj_step2'];
|
1241 |
-
foreach ( $aj_gtmetrix_results as $aj_step => $aj_gtmetrix_result ) {
|
1242 |
-
if ( $aj_step != 'aj_step2' ) {
|
1243 |
-
$pagespeed = $aj_gtmetrix_result['results']['pagespeed_score'];
|
1244 |
-
$yslow = $aj_gtmetrix_result['results']['yslow_score'];
|
1245 |
-
$combined = $pagespeed + $yslow;
|
1246 |
-
if ( $combined > $best_overall ) {
|
1247 |
-
$best_overall = $combined;
|
1248 |
-
$best_result = $aj_gtmetrix_result;
|
1249 |
-
}
|
1250 |
-
}
|
1251 |
-
}
|
1252 |
-
if ( !empty( $best_result ) ) {
|
1253 |
-
$return = $best_result;
|
1254 |
-
$return['status'] = true;
|
1255 |
-
$return['baseline_pagespeed'] = $baseline['results']['pagespeed_score'];
|
1256 |
-
$return['baseline_yslow'] = $baseline['results']['yslow_score'];
|
1257 |
-
$aj_gtmetrix_results['best_result'] = $return;
|
1258 |
-
update_option( 'aj_gtmetrix_results', $aj_gtmetrix_results );
|
1259 |
-
} else {
|
1260 |
-
$return = array(
|
1261 |
-
'status' => false,
|
1262 |
-
'error' => 'No detected increase'
|
1263 |
-
);
|
1264 |
-
}
|
1265 |
-
break;
|
1266 |
-
case 'aj_apply_settings':
|
1267 |
-
$settings = sanitize_text_field( $_POST['settings'] );
|
1268 |
-
if ( $settings != '' ) {
|
1269 |
-
$best_id = $settings;
|
1270 |
-
} else {
|
1271 |
-
$best_result = $aj_gtmetrix_results['best_result'];
|
1272 |
-
$best_id = $best_result['id'];
|
1273 |
-
}
|
1274 |
-
update_option( 'aj_enabled', 1 );
|
1275 |
-
if ( $best_id == 'aj_step2b' || $best_id == 'aj_step2d' ) {
|
1276 |
-
update_option( 'aj_method', 'async' );
|
1277 |
-
} else if ( $best_id == 'aj_step2c' || $best_id == 'aj_step2e' ) {
|
1278 |
-
update_option( 'aj_method', 'defer' );
|
1279 |
-
}
|
1280 |
-
if ( $best_id == 'aj_step2b' ) {
|
1281 |
-
update_option( 'aj_jquery', 'async' );
|
1282 |
-
} else if ( $best_id == 'aj_step2d' ) {
|
1283 |
-
update_option( 'aj_jquery', 'defer' );
|
1284 |
-
} else if ( $best_id == 'aj_step2c' || $best_id == 'aj_step2e' ) {
|
1285 |
-
update_option( 'aj_jquery', 'exclude' );
|
1286 |
-
}
|
1287 |
-
update_option( 'aj_exclusions', '' );
|
1288 |
-
$return['status'] = true;
|
1289 |
-
break;
|
1290 |
-
case 'aj_gtmetrix_test':
|
1291 |
-
$aj_gtmetrix_username = sanitize_text_field( $_POST['aj_gtmetrix_username'] );
|
1292 |
-
$aj_gtmetrix_api_key = sanitize_text_field( $_POST['aj_gtmetrix_api_key'] );
|
1293 |
-
$aj_gtmetrix_server = sanitize_text_field( $_POST['aj_gtmetrix_server'] );
|
1294 |
-
$site_url = trailingslashit( esc_url( $_POST['site_url'] ) );
|
1295 |
-
update_option( 'aj_gtmetrix_username', $aj_gtmetrix_username );
|
1296 |
-
update_option( 'aj_gtmetrix_api_key', $aj_gtmetrix_api_key );
|
1297 |
-
update_option( 'aj_gtmetrix_server', $aj_gtmetrix_server );
|
1298 |
-
$test = new Services_WTF_Test();
|
1299 |
-
$test->api_username( $aj_gtmetrix_username );
|
1300 |
-
$test->api_password( $aj_gtmetrix_api_key );
|
1301 |
-
$test->user_agent( AJ_UA );
|
1302 |
-
$args = array(
|
1303 |
-
'url' => $site_url,
|
1304 |
-
'location' => $aj_gtmetrix_server
|
1305 |
-
);
|
1306 |
-
$testid = $test->test( $args );
|
1307 |
-
if ( $testid ) {
|
1308 |
-
$test->get_results();
|
1309 |
-
if ( $test->error() ) {
|
1310 |
-
$return = array(
|
1311 |
-
'status' => false,
|
1312 |
-
'error' => $test->error()
|
1313 |
-
);
|
1314 |
-
} else {
|
1315 |
-
$testid = $test->get_test_id();
|
1316 |
-
$results = $test->results();
|
1317 |
-
$resources = $test->resources();
|
1318 |
-
$screenshot = base64_encode( file_get_contents( $results['report_url'] . '/screenshot.jpg' ) );
|
1319 |
-
$status = $test->status();
|
1320 |
-
$credits = $status['api_credits'];
|
1321 |
-
$return = array(
|
1322 |
-
'status' => true,
|
1323 |
-
'testid' => $testid,
|
1324 |
-
'results' => $results,
|
1325 |
-
'resources' => $resources,
|
1326 |
-
'id' => $sub_action,
|
1327 |
-
'name' => 'Latest',
|
1328 |
-
'url' => $args['url'],
|
1329 |
-
'credits' => $credits,
|
1330 |
-
'screenshot' => $screenshot
|
1331 |
-
);
|
1332 |
-
$aj_gtmetrix_results['latest'] = $return;
|
1333 |
-
update_option( 'aj_gtmetrix_results', $aj_gtmetrix_results );
|
1334 |
-
}
|
1335 |
-
} else {
|
1336 |
-
$return = array(
|
1337 |
-
'status' => false,
|
1338 |
-
'error' => $test->error()
|
1339 |
-
);
|
1340 |
-
}
|
1341 |
-
break;
|
1342 |
-
case 'aj_save_settings':
|
1343 |
-
$aj_enabled = sanitize_text_field( $_POST['aj_enabled'] );
|
1344 |
-
$aj_method = sanitize_text_field( $_POST['aj_method'] );
|
1345 |
-
$aj_jquery = sanitize_text_field( $_POST['aj_jquery'] );
|
1346 |
-
$aj_exclusions = sanitize_text_field( $_POST['aj_exclusions'] );
|
1347 |
-
$aj_autoptimize_enabled = sanitize_text_field( $_POST['aj_autoptimize_enabled'] );
|
1348 |
-
$aj_autoptimize_method = sanitize_text_field( $_POST['aj_autoptimize_method'] );
|
1349 |
-
update_option( 'aj_enabled', $aj_enabled );
|
1350 |
-
update_option( 'aj_method', $aj_method );
|
1351 |
-
update_option( 'aj_jquery', $aj_jquery );
|
1352 |
-
update_option( 'aj_exclusions', $aj_exclusions );
|
1353 |
-
update_option( 'aj_autoptimize_enabled', $aj_autoptimize_enabled );
|
1354 |
-
update_option( 'aj_autoptimize_method', $aj_autoptimize_method );
|
1355 |
-
$return['status'] = true;
|
1356 |
-
break;
|
1357 |
-
}
|
1358 |
-
}
|
1359 |
-
if( is_null( $return ) ) {
|
1360 |
-
$return = array(
|
1361 |
-
'status' => false
|
1362 |
-
);
|
1363 |
-
}
|
1364 |
-
echo json_encode( $return );
|
1365 |
-
wp_die();
|
1366 |
-
}
|
1367 |
-
add_action( 'wp_ajax_aj_steps', 'aj_steps' );
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Plugin Name: Async JavaScript
|
4 |
+
* Plugin URI: https://autoptimize.com/
|
5 |
+
* Description: Async JavaScript gives you full control of which scripts to add a 'async' or 'defer' attribute to or to exclude to help increase the performance of your WordPress website
|
6 |
+
* Version: 2.18.03.10
|
7 |
+
* Author: Frank Goossens (futtta)
|
8 |
+
* Author URI: https://autoptimize.com/
|
9 |
+
* Text Domain: async-javascript
|
10 |
+
* License: GNU General Public License v2 or later
|
11 |
+
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
12 |
+
*/
|
13 |
+
|
14 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
15 |
+
exit; // Exit if accessed directly
|
16 |
+
}
|
17 |
+
|
18 |
+
if (is_admin()) {
|
19 |
+
require_once('asyncjsBackendClass.php');
|
20 |
+
$ajBackend = new AsyncJavaScriptBackend();
|
21 |
+
} else {
|
22 |
+
require_once('asyncjsFrontendClass.php');
|
23 |
+
$ajFrontend = new AsyncJavaScriptFrontend();
|
24 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
asyncjsAllAjax.php
ADDED
@@ -0,0 +1,417 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
+
exit; // Exit if accessed directly
|
4 |
+
}
|
5 |
+
|
6 |
+
/*
|
7 |
+
* this file contains all AJAX backend logic
|
8 |
+
* for the wizard and to save settings
|
9 |
+
*/
|
10 |
+
|
11 |
+
$aj_gtmetrix_results = get_option( 'aj_gtmetrix_results', array() );
|
12 |
+
if ( !isset( $_POST['sub_action'] ) ) {
|
13 |
+
$return = array(
|
14 |
+
'status' => false,
|
15 |
+
'error' => 'No sub action defined.'
|
16 |
+
);
|
17 |
+
} else {
|
18 |
+
$sub_action = sanitize_text_field( $_POST['sub_action'] );
|
19 |
+
switch ( $sub_action ) {
|
20 |
+
case 'aj_step2':
|
21 |
+
$aj_gtmetrix_username = sanitize_text_field( $_POST['aj_gtmetrix_username'] );
|
22 |
+
$aj_gtmetrix_api_key = sanitize_text_field( $_POST['aj_gtmetrix_api_key'] );
|
23 |
+
$aj_gtmetrix_server = sanitize_text_field( $_POST['aj_gtmetrix_server'] );
|
24 |
+
$site_url = trailingslashit( sanitize_text_field( $_POST['site_url'] ) );
|
25 |
+
update_option( 'aj_gtmetrix_username', $aj_gtmetrix_username );
|
26 |
+
update_option( 'aj_gtmetrix_api_key', $aj_gtmetrix_api_key );
|
27 |
+
update_option( 'aj_gtmetrix_server', $aj_gtmetrix_server );
|
28 |
+
$test = new Services_WTF_Test();
|
29 |
+
$test->api_username( $aj_gtmetrix_username );
|
30 |
+
$test->api_password( $aj_gtmetrix_api_key );
|
31 |
+
$test->user_agent( AJ_UA );
|
32 |
+
$args = array(
|
33 |
+
'url' => $site_url,
|
34 |
+
'location' => $aj_gtmetrix_server
|
35 |
+
);
|
36 |
+
$testid = $test->test( $args );
|
37 |
+
if ( $testid ) {
|
38 |
+
$test->get_results();
|
39 |
+
if ( $test->error() ) {
|
40 |
+
$return = array(
|
41 |
+
'status' => false,
|
42 |
+
'error' => $test->error()
|
43 |
+
);
|
44 |
+
} else {
|
45 |
+
$testid = $test->get_test_id();
|
46 |
+
$results = $test->results();
|
47 |
+
$resources = $test->resources();
|
48 |
+
$status = $test->status();
|
49 |
+
$credits = $status['api_credits'];
|
50 |
+
$return = array(
|
51 |
+
'status' => true,
|
52 |
+
'testid' => $testid,
|
53 |
+
'results' => $results,
|
54 |
+
'resources' => $resources,
|
55 |
+
'id' => $sub_action,
|
56 |
+
'name' => 'Baseline',
|
57 |
+
'url' => $args['url'],
|
58 |
+
'credits' => $credits
|
59 |
+
);
|
60 |
+
$aj_gtmetrix_results[$sub_action] = $return;
|
61 |
+
update_option( 'aj_gtmetrix_results', $aj_gtmetrix_results );
|
62 |
+
}
|
63 |
+
} else {
|
64 |
+
$return = array(
|
65 |
+
'status' => false,
|
66 |
+
'error' => $test->error()
|
67 |
+
);
|
68 |
+
}
|
69 |
+
break;
|
70 |
+
case 'aj_step2b':
|
71 |
+
$aj_gtmetrix_username = sanitize_text_field( $_POST['aj_gtmetrix_username'] );
|
72 |
+
$aj_gtmetrix_api_key = sanitize_text_field( $_POST['aj_gtmetrix_api_key'] );
|
73 |
+
$aj_gtmetrix_server = sanitize_text_field( $_POST['aj_gtmetrix_server'] );
|
74 |
+
$site_url = trailingslashit( sanitize_text_field( $_POST['site_url'] ) );
|
75 |
+
update_option( 'aj_gtmetrix_username', $aj_gtmetrix_username );
|
76 |
+
update_option( 'aj_gtmetrix_api_key', $aj_gtmetrix_api_key );
|
77 |
+
update_option( 'aj_gtmetrix_server', $aj_gtmetrix_server );
|
78 |
+
$test = new Services_WTF_Test();
|
79 |
+
$test->api_username( $aj_gtmetrix_username );
|
80 |
+
$test->api_password( $aj_gtmetrix_api_key );
|
81 |
+
$test->user_agent( AJ_UA );
|
82 |
+
$args = array(
|
83 |
+
'url' => $site_url . '?aj_simulate=async',
|
84 |
+
'location' => $aj_gtmetrix_server
|
85 |
+
);
|
86 |
+
$testid = $test->test( $args );
|
87 |
+
if ( $testid ) {
|
88 |
+
$test->get_results();
|
89 |
+
if ( $test->error() ) {
|
90 |
+
$return = array(
|
91 |
+
'status' => false,
|
92 |
+
'error' => $test->error()
|
93 |
+
);
|
94 |
+
} else {
|
95 |
+
$testid = $test->get_test_id();
|
96 |
+
$results = $test->results();
|
97 |
+
$resources = $test->resources();
|
98 |
+
$status = $test->status();
|
99 |
+
$credits = $status['api_credits'];
|
100 |
+
$return = array(
|
101 |
+
'status' => true,
|
102 |
+
'testid' => $testid,
|
103 |
+
'results' => $results,
|
104 |
+
'resources' => $resources,
|
105 |
+
'id' => $sub_action,
|
106 |
+
'name' => 'Async',
|
107 |
+
'url' => $args['url'],
|
108 |
+
'credits' => $credits
|
109 |
+
);
|
110 |
+
$aj_gtmetrix_results[$sub_action] = $return;
|
111 |
+
update_option( 'aj_gtmetrix_results', $aj_gtmetrix_results );
|
112 |
+
}
|
113 |
+
} else {
|
114 |
+
$return = array(
|
115 |
+
'status' => false,
|
116 |
+
'error' => $test->error()
|
117 |
+
);
|
118 |
+
}
|
119 |
+
break;
|
120 |
+
case 'aj_step2c':
|
121 |
+
$aj_gtmetrix_username = sanitize_text_field( $_POST['aj_gtmetrix_username'] );
|
122 |
+
$aj_gtmetrix_api_key = sanitize_text_field( $_POST['aj_gtmetrix_api_key'] );
|
123 |
+
$aj_gtmetrix_server = sanitize_text_field( $_POST['aj_gtmetrix_server'] );
|
124 |
+
$site_url = trailingslashit( sanitize_text_field( $_POST['site_url'] ) );
|
125 |
+
update_option( 'aj_gtmetrix_username', $aj_gtmetrix_username );
|
126 |
+
update_option( 'aj_gtmetrix_api_key', $aj_gtmetrix_api_key );
|
127 |
+
update_option( 'aj_gtmetrix_server', $aj_gtmetrix_server );
|
128 |
+
$test = new Services_WTF_Test();
|
129 |
+
$test->api_username( $aj_gtmetrix_username );
|
130 |
+
$test->api_password( $aj_gtmetrix_api_key );
|
131 |
+
$test->user_agent( AJ_UA );
|
132 |
+
$args = array(
|
133 |
+
'url' => $site_url . '?aj_simulate=defer',
|
134 |
+
'location' => $aj_gtmetrix_server
|
135 |
+
);
|
136 |
+
$testid = $test->test( $args );
|
137 |
+
if ( $testid ) {
|
138 |
+
$test->get_results();
|
139 |
+
if ( $test->error() ) {
|
140 |
+
$return = array(
|
141 |
+
'status' => false,
|
142 |
+
'error' => $test->error()
|
143 |
+
);
|
144 |
+
} else {
|
145 |
+
$testid = $test->get_test_id();
|
146 |
+
$results = $test->results();
|
147 |
+
$resources = $test->resources();
|
148 |
+
$status = $test->status();
|
149 |
+
$credits = $status['api_credits'];
|
150 |
+
$return = array(
|
151 |
+
'status' => true,
|
152 |
+
'testid' => $testid,
|
153 |
+
'results' => $results,
|
154 |
+
'resources' => $resources,
|
155 |
+
'id' => $sub_action,
|
156 |
+
'name' => 'Defer',
|
157 |
+
'url' => $args['url'],
|
158 |
+
'credits' => $credits
|
159 |
+
);
|
160 |
+
$aj_gtmetrix_results[$sub_action] = $return;
|
161 |
+
update_option( 'aj_gtmetrix_results', $aj_gtmetrix_results );
|
162 |
+
}
|
163 |
+
} else {
|
164 |
+
$return = array(
|
165 |
+
'status' => false,
|
166 |
+
'error' => $test->error()
|
167 |
+
);
|
168 |
+
}
|
169 |
+
break;
|
170 |
+
case 'aj_step2d':
|
171 |
+
$aj_gtmetrix_username = sanitize_text_field( $_POST['aj_gtmetrix_username'] );
|
172 |
+
$aj_gtmetrix_api_key = sanitize_text_field( $_POST['aj_gtmetrix_api_key'] );
|
173 |
+
$aj_gtmetrix_server = sanitize_text_field( $_POST['aj_gtmetrix_server'] );
|
174 |
+
$site_url = trailingslashit( sanitize_text_field( $_POST['site_url'] ) );
|
175 |
+
update_option( 'aj_gtmetrix_username', $aj_gtmetrix_username );
|
176 |
+
update_option( 'aj_gtmetrix_api_key', $aj_gtmetrix_api_key );
|
177 |
+
update_option( 'aj_gtmetrix_server', $aj_gtmetrix_server );
|
178 |
+
$test = new Services_WTF_Test();
|
179 |
+
$test->api_username( $aj_gtmetrix_username );
|
180 |
+
$test->api_password( $aj_gtmetrix_api_key );
|
181 |
+
$test->user_agent( AJ_UA );
|
182 |
+
$args = array(
|
183 |
+
'url' => $site_url . '?aj_simulate=async&aj_simulate_jquery=exclude',
|
184 |
+
'location' => $aj_gtmetrix_server
|
185 |
+
);
|
186 |
+
$testid = $test->test( $args );
|
187 |
+
if ( $testid ) {
|
188 |
+
$test->get_results();
|
189 |
+
if ( $test->error() ) {
|
190 |
+
$return = array(
|
191 |
+
'status' => false,
|
192 |
+
'error' => $test->error()
|
193 |
+
);
|
194 |
+
} else {
|
195 |
+
$testid = $test->get_test_id();
|
196 |
+
$results = $test->results();
|
197 |
+
$resources = $test->resources();
|
198 |
+
$status = $test->status();
|
199 |
+
$credits = $status['api_credits'];
|
200 |
+
$return = array(
|
201 |
+
'status' => true,
|
202 |
+
'testid' => $testid,
|
203 |
+
'results' => $results,
|
204 |
+
'resources' => $resources,
|
205 |
+
'id' => $sub_action,
|
206 |
+
'name' => 'Async (jQuery Excluded)',
|
207 |
+
'url' => $args['url'],
|
208 |
+
'credits' => $credits
|
209 |
+
);
|
210 |
+
$aj_gtmetrix_results[$sub_action] = $return;
|
211 |
+
update_option( 'aj_gtmetrix_results', $aj_gtmetrix_results );
|
212 |
+
}
|
213 |
+
} else {
|
214 |
+
$return = array(
|
215 |
+
'status' => false,
|
216 |
+
'error' => $test->error()
|
217 |
+
);
|
218 |
+
}
|
219 |
+
break;
|
220 |
+
case 'aj_step2e':
|
221 |
+
$aj_gtmetrix_username = sanitize_text_field( $_POST['aj_gtmetrix_username'] );
|
222 |
+
$aj_gtmetrix_api_key = sanitize_text_field( $_POST['aj_gtmetrix_api_key'] );
|
223 |
+
$aj_gtmetrix_server = sanitize_text_field( $_POST['aj_gtmetrix_server'] );
|
224 |
+
$site_url = trailingslashit( sanitize_text_field( $_POST['site_url'] ) );
|
225 |
+
update_option( 'aj_gtmetrix_username', $aj_gtmetrix_username );
|
226 |
+
update_option( 'aj_gtmetrix_api_key', $aj_gtmetrix_api_key );
|
227 |
+
update_option( 'aj_gtmetrix_server', $aj_gtmetrix_server );
|
228 |
+
$test = new Services_WTF_Test();
|
229 |
+
$test->api_username( $aj_gtmetrix_username );
|
230 |
+
$test->api_password( $aj_gtmetrix_api_key );
|
231 |
+
$test->user_agent( AJ_UA );
|
232 |
+
$args = array(
|
233 |
+
'url' => $site_url . '?aj_simulate=defer&aj_simulate_jquery=exclude',
|
234 |
+
'location' => $aj_gtmetrix_server
|
235 |
+
);
|
236 |
+
$testid = $test->test( $args );
|
237 |
+
if ( $testid ) {
|
238 |
+
$test->get_results();
|
239 |
+
if ( $test->error() ) {
|
240 |
+
$return = array(
|
241 |
+
'status' => false,
|
242 |
+
'error' => $test->error()
|
243 |
+
);
|
244 |
+
} else {
|
245 |
+
$testid = $test->get_test_id();
|
246 |
+
$results = $test->results();
|
247 |
+
$resources = $test->resources();
|
248 |
+
$status = $test->status();
|
249 |
+
$credits = $status['api_credits'];
|
250 |
+
$return = array(
|
251 |
+
'status' => true,
|
252 |
+
'testid' => $testid,
|
253 |
+
'results' => $results,
|
254 |
+
'resources' => $resources,
|
255 |
+
'id' => $sub_action,
|
256 |
+
'name' => 'Defer (jQuery Excluded)',
|
257 |
+
'url' => $args['url'],
|
258 |
+
'credits' => $credits
|
259 |
+
);
|
260 |
+
$aj_gtmetrix_results[$sub_action] = $return;
|
261 |
+
update_option( 'aj_gtmetrix_results', $aj_gtmetrix_results );
|
262 |
+
}
|
263 |
+
} else {
|
264 |
+
$return = array(
|
265 |
+
'status' => false,
|
266 |
+
'error' => $test->error()
|
267 |
+
);
|
268 |
+
}
|
269 |
+
break;
|
270 |
+
case 'aj_step_results':
|
271 |
+
$best_pagespeed = 0;
|
272 |
+
$best_yslow = 0;
|
273 |
+
$best_overall = 0;
|
274 |
+
$best_result = array();
|
275 |
+
$baseline = $aj_gtmetrix_results['aj_step2'];
|
276 |
+
foreach ( $aj_gtmetrix_results as $aj_step => $aj_gtmetrix_result ) {
|
277 |
+
if ( $aj_step != 'aj_step2' ) {
|
278 |
+
$pagespeed = $aj_gtmetrix_result['results']['pagespeed_score'];
|
279 |
+
$yslow = $aj_gtmetrix_result['results']['yslow_score'];
|
280 |
+
$combined = $pagespeed + $yslow;
|
281 |
+
if ( $combined > $best_overall ) {
|
282 |
+
$best_overall = $combined;
|
283 |
+
$best_result = $aj_gtmetrix_result;
|
284 |
+
}
|
285 |
+
}
|
286 |
+
}
|
287 |
+
if ( !empty( $best_result ) ) {
|
288 |
+
$return = $best_result;
|
289 |
+
$return['status'] = true;
|
290 |
+
$return['baseline_pagespeed'] = $baseline['results']['pagespeed_score'];
|
291 |
+
$return['baseline_yslow'] = $baseline['results']['yslow_score'];
|
292 |
+
$aj_gtmetrix_results['best_result'] = $return;
|
293 |
+
update_option( 'aj_gtmetrix_results', $aj_gtmetrix_results );
|
294 |
+
} else {
|
295 |
+
$return = array(
|
296 |
+
'status' => false,
|
297 |
+
'error' => 'No detected increase'
|
298 |
+
);
|
299 |
+
}
|
300 |
+
break;
|
301 |
+
case 'aj_apply_settings':
|
302 |
+
$settings = sanitize_text_field( $_POST['settings'] );
|
303 |
+
if ( $settings != '' ) {
|
304 |
+
$best_id = $settings;
|
305 |
+
} else {
|
306 |
+
$best_result = $aj_gtmetrix_results['best_result'];
|
307 |
+
$best_id = $best_result['id'];
|
308 |
+
}
|
309 |
+
update_option( 'aj_enabled', 1 );
|
310 |
+
if ( $best_id == 'aj_step2b' || $best_id == 'aj_step2d' ) {
|
311 |
+
update_option( 'aj_method', 'async' );
|
312 |
+
} else if ( $best_id == 'aj_step2c' || $best_id == 'aj_step2e' ) {
|
313 |
+
update_option( 'aj_method', 'defer' );
|
314 |
+
}
|
315 |
+
if ( $best_id == 'aj_step2b' ) {
|
316 |
+
update_option( 'aj_jquery', 'async' );
|
317 |
+
} else if ( $best_id == 'aj_step2d' ) {
|
318 |
+
update_option( 'aj_jquery', 'defer' );
|
319 |
+
} else if ( $best_id == 'aj_step2c' || $best_id == 'aj_step2e' ) {
|
320 |
+
update_option( 'aj_jquery', 'exclude' );
|
321 |
+
}
|
322 |
+
update_option( 'aj_async', '' );
|
323 |
+
update_option( 'aj_defer', '' );
|
324 |
+
update_option( 'aj_exclusions', '' );
|
325 |
+
update_option( 'aj_plugin_exclusions', array() );
|
326 |
+
update_option( 'aj_theme_exclusions', array() );
|
327 |
+
update_option( 'aj_autoptimize_enabled', 0 );
|
328 |
+
update_option( 'aj_autoptimize_method', 'async' );
|
329 |
+
$return['status'] = true;
|
330 |
+
break;
|
331 |
+
case 'aj_gtmetrix_test':
|
332 |
+
$aj_gtmetrix_username = sanitize_text_field( $_POST['aj_gtmetrix_username'] );
|
333 |
+
$aj_gtmetrix_api_key = sanitize_text_field( $_POST['aj_gtmetrix_api_key'] );
|
334 |
+
$aj_gtmetrix_server = sanitize_text_field( $_POST['aj_gtmetrix_server'] );
|
335 |
+
$site_url = trailingslashit( sanitize_text_field( $_POST['site_url'] ) );
|
336 |
+
update_option( 'aj_gtmetrix_username', $aj_gtmetrix_username );
|
337 |
+
update_option( 'aj_gtmetrix_api_key', $aj_gtmetrix_api_key );
|
338 |
+
update_option( 'aj_gtmetrix_server', $aj_gtmetrix_server );
|
339 |
+
$test = new Services_WTF_Test();
|
340 |
+
$test->api_username( $aj_gtmetrix_username );
|
341 |
+
$test->api_password( $aj_gtmetrix_api_key );
|
342 |
+
$test->user_agent( AJ_UA );
|
343 |
+
$args = array(
|
344 |
+
'url' => $site_url,
|
345 |
+
'location' => $aj_gtmetrix_server
|
346 |
+
);
|
347 |
+
$testid = $test->test( $args );
|
348 |
+
if ( $testid ) {
|
349 |
+
$test->get_results();
|
350 |
+
if ( $test->error() ) {
|
351 |
+
$return = array(
|
352 |
+
'status' => false,
|
353 |
+
'error' => $test->error()
|
354 |
+
);
|
355 |
+
} else {
|
356 |
+
$testid = $test->get_test_id();
|
357 |
+
$results = $test->results();
|
358 |
+
$resources = $test->resources();
|
359 |
+
$screenshot = base64_encode( file_get_contents( $results['report_url'] . '/screenshot.jpg' ) );
|
360 |
+
$status = $test->status();
|
361 |
+
$credits = $status['api_credits'];
|
362 |
+
$return = array(
|
363 |
+
'status' => true,
|
364 |
+
'testid' => $testid,
|
365 |
+
'results' => $results,
|
366 |
+
'resources' => $resources,
|
367 |
+
'id' => $sub_action,
|
368 |
+
'name' => 'Latest',
|
369 |
+
'url' => $args['url'],
|
370 |
+
'credits' => $credits,
|
371 |
+
'screenshot' => $screenshot
|
372 |
+
);
|
373 |
+
$aj_gtmetrix_results['latest'] = $return;
|
374 |
+
update_option( 'aj_gtmetrix_results', $aj_gtmetrix_results );
|
375 |
+
}
|
376 |
+
} else {
|
377 |
+
$return = array(
|
378 |
+
'status' => false,
|
379 |
+
'error' => $test->error()
|
380 |
+
);
|
381 |
+
}
|
382 |
+
break;
|
383 |
+
case 'aj_save_settings':
|
384 |
+
$aj_enabled = sanitize_text_field( $_POST['aj_enabled'] );
|
385 |
+
$aj_method = sanitize_text_field( $_POST['aj_method'] );
|
386 |
+
$aj_jquery = sanitize_text_field( $_POST['aj_jquery'] );
|
387 |
+
$aj_async = sanitize_text_field( $_POST['aj_async'] );
|
388 |
+
$aj_defer = sanitize_text_field( $_POST['aj_defer'] );
|
389 |
+
$aj_exclusions = sanitize_text_field( $_POST['aj_exclusions'] );
|
390 |
+
$aj_plugin_exclusions = $_POST['aj_plugin_exclusions'];
|
391 |
+
$aj_theme_exclusions = $_POST['aj_theme_exclusions'];
|
392 |
+
$aj_autoptimize_enabled = sanitize_text_field( $_POST['aj_autoptimize_enabled'] );
|
393 |
+
$aj_autoptimize_method = sanitize_text_field( $_POST['aj_autoptimize_method'] );
|
394 |
+
update_option( 'aj_enabled', $aj_enabled );
|
395 |
+
update_option( 'aj_method', $aj_method );
|
396 |
+
update_option( 'aj_jquery', $aj_jquery );
|
397 |
+
update_option( 'aj_async', $aj_async );
|
398 |
+
update_option( 'aj_defer', $aj_defer );
|
399 |
+
update_option( 'aj_exclusions', $aj_exclusions );
|
400 |
+
update_option( 'aj_plugin_exclusions', $aj_plugin_exclusions );
|
401 |
+
update_option( 'aj_theme_exclusions', $aj_theme_exclusions );
|
402 |
+
update_option( 'aj_autoptimize_enabled', $aj_autoptimize_enabled );
|
403 |
+
update_option( 'aj_autoptimize_method', $aj_autoptimize_method );
|
404 |
+
$return['status'] = true;
|
405 |
+
break;
|
406 |
+
}
|
407 |
+
}
|
408 |
+
|
409 |
+
if( is_null( $return ) ) {
|
410 |
+
$return = array(
|
411 |
+
'status' => false
|
412 |
+
);
|
413 |
+
}
|
414 |
+
|
415 |
+
echo json_encode( $return );
|
416 |
+
|
417 |
+
wp_die();
|
asyncjsBackendClass.php
ADDED
@@ -0,0 +1,349 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
+
exit; // Exit if accessed directly
|
4 |
+
}
|
5 |
+
|
6 |
+
/*
|
7 |
+
* Backend logic: kicking in admin logic, screens & Ajax
|
8 |
+
*
|
9 |
+
*/
|
10 |
+
|
11 |
+
class AsyncJavaScriptBackend {
|
12 |
+
function __construct() {
|
13 |
+
define( 'AJ_TITLE', 'Async JavaScript' );
|
14 |
+
define( 'AJ_ADMIN_MENU_SLUG', 'async-javascript' );
|
15 |
+
define( 'AJ_ADMIN_ICON_URL', 'dashicons-performance' );
|
16 |
+
define( 'AJ_ADMIN_POSITION', 3 );
|
17 |
+
define( 'AJ_ADMIN_URL', trailingslashit( admin_url() ) );
|
18 |
+
define( 'AJ_PLUGIN_URL', trailingslashit( plugin_dir_url( __FILE__ ) ) );
|
19 |
+
define( 'AJ_PLUGIN_DIR', trailingslashit( plugin_dir_path( __FILE__ ) ) );
|
20 |
+
define( 'AJ_VERSION', '2.18.03.10' );
|
21 |
+
define( 'AJ_UA', 'Async JavaScript/' . AJ_VERSION . ' (+https://autoptimize.com/)' );
|
22 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'aj_enqueue_scripts' ) );
|
23 |
+
add_action( 'plugins_loaded', array( $this, 'aj_admin_init' ) );
|
24 |
+
add_action( 'admin_init', array( $this, 'aj_disable_pro' ) );
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* the plugin instance
|
29 |
+
*
|
30 |
+
*/
|
31 |
+
private static $instance = NULL;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* get the plugin instance
|
35 |
+
*
|
36 |
+
* @return AsyncJavaScript
|
37 |
+
*/
|
38 |
+
public static function get_instance() {
|
39 |
+
if ( NULL === self::$instance ) {
|
40 |
+
self::$instance = new self();
|
41 |
+
}
|
42 |
+
return self::$instance;
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* aj_activate()
|
47 |
+
*
|
48 |
+
*/
|
49 |
+
public static function aj_activate() {
|
50 |
+
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* plugin deactivate
|
55 |
+
*
|
56 |
+
*/
|
57 |
+
public static function aj_deactivate() {
|
58 |
+
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* plugin uninstaller
|
63 |
+
*
|
64 |
+
* removes (hopefully all) options
|
65 |
+
*
|
66 |
+
*/
|
67 |
+
public static function aj_uninstall() {
|
68 |
+
$optionsToRemove = array('aj_async','aj_autoptimize_enabled','aj_autoptimize_method','aj_defer','aj_enabled','aj_exclusions','aj_gtmetrix_api_key','aj_gtmetrix_results','aj_gtmetrix_server','aj_gtmetrix_username','aj_jquery','aj_method','aj_plugin_exclusions','aj_theme_exclusions','aj_version');
|
69 |
+
if ( !is_multisite() ) {
|
70 |
+
foreach ($delete_options as $del_opt) { delete_option( $del_opt ); }
|
71 |
+
} else {
|
72 |
+
global $wpdb;
|
73 |
+
$blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
|
74 |
+
$original_blog_id = get_current_blog_id();
|
75 |
+
foreach ( $blog_ids as $blog_id ) {
|
76 |
+
switch_to_blog( $blog_id );
|
77 |
+
foreach ($delete_options as $del_opt) { delete_option( $del_opt ); }
|
78 |
+
}
|
79 |
+
switch_to_blog( $original_blog_id );
|
80 |
+
}
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
* aj_enqueue_scripts()
|
85 |
+
*
|
86 |
+
* register admin stylesheets and javascripts
|
87 |
+
*
|
88 |
+
*/
|
89 |
+
public function aj_enqueue_scripts() {
|
90 |
+
// chosen
|
91 |
+
wp_enqueue_style('chosen', plugins_url( 'assets/lib/chosen_v1.4.2/chosen.min.css', __FILE__ ));
|
92 |
+
wp_enqueue_script('chosen', plugins_url( 'assets/lib/chosen_v1.4.2/chosen.jquery.min.js', __FILE__ ), array( 'jquery' ), AJ_VERSION, true);
|
93 |
+
|
94 |
+
// own JS & CSS
|
95 |
+
wp_enqueue_style('aj_admin_styles', plugins_url( '/css/admin.min.css', __FILE__ ));
|
96 |
+
wp_enqueue_script('aj_admin_scripts',plugins_url( '/js/admin.min.js', __FILE__ ),array( 'jquery', 'chosen' ), AJ_VERSION, true);
|
97 |
+
|
98 |
+
// ajaxy stuff
|
99 |
+
$aj_localize = array(
|
100 |
+
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
101 |
+
'siteurl' => get_site_url(),
|
102 |
+
'pluginurl' => AJ_PLUGIN_URL,
|
103 |
+
'ajadminurl' => admin_url( 'options-general.php?page=async-javascript' )
|
104 |
+
);
|
105 |
+
wp_localize_script( 'aj_admin_scripts', 'aj_localize_admin', $aj_localize );
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* aj_disable_pro()
|
110 |
+
*
|
111 |
+
* check if the old AJS_pro is active and deactivate if so
|
112 |
+
*
|
113 |
+
*/
|
114 |
+
public function aj_disable_pro() {
|
115 |
+
if ( is_plugin_active( 'async-javascript-pro/async-javascript-pro.php' ) ) {
|
116 |
+
deactivate_plugins( array( 'async-javascript-pro/async-javascript-pro.php' ) );
|
117 |
+
}
|
118 |
+
}
|
119 |
+
|
120 |
+
/**
|
121 |
+
* aj_admin_init()
|
122 |
+
*
|
123 |
+
* register admin stylesheets and javascripts
|
124 |
+
*
|
125 |
+
*/
|
126 |
+
public function aj_admin_init() {
|
127 |
+
global $wp, $wpdb;
|
128 |
+
register_activation_hook( __FILE__, array( $this, 'aj_activate' ) );
|
129 |
+
register_deactivation_hook( __FILE__, array( $this, 'aj_deactivate' ) );
|
130 |
+
|
131 |
+
if ( !class_exists( 'Services_WTF_Test' ) ) {
|
132 |
+
require_once( AJ_PLUGIN_DIR . 'lib/gtmetrix/class.Services_WTF_Test.php' );
|
133 |
+
}
|
134 |
+
|
135 |
+
// check if upgrading from early release so settings can be transferred
|
136 |
+
$aj_version = get_option( 'aj_version', '' );
|
137 |
+
if ( $aj_version == '' || $aj_version < '2017.04.25' ) {
|
138 |
+
$aj_enabled = get_option( 'aj_enabled', 0 );
|
139 |
+
$aj_method = get_option( 'aj_method', 'async' );
|
140 |
+
$aj_jquery = ( get_option( 'aj_jquery', 'async' ) == 'same' ) ? $aj_method : get_option( 'aj_jquery', 'async' );
|
141 |
+
$aj_async = get_option( 'aj_async', '' );
|
142 |
+
$aj_defer = get_option( 'aj_defer', '' );
|
143 |
+
$aj_exclusions = get_option( 'aj_exclusions', '' );
|
144 |
+
$aj_plugin_exclusions = ( is_array( get_option( 'aj_plugin_exclusions', array() ) ) && !is_null( get_option( 'aj_plugin_exclusions', array() ) ) ? get_option( 'aj_plugin_exclusions', array() ) : explode( ',', get_option( 'aj_plugin_exclusions', '' ) ) );
|
145 |
+
$aj_theme_exclusions = ( is_array( get_option( 'aj_theme_exclusions', array() ) ) && !is_null( get_option( 'aj_theme_exclusions', array() ) ) ? get_option( 'aj_theme_exclusions', array() ) : explode( ',', get_option( 'aj_theme_exclusions', '' ) ) );
|
146 |
+
$aj_autoptimize_enabled = get_option( 'aj_autoptimize_enabled', 0 );
|
147 |
+
$aj_autoptimize_method = get_option( 'aj_autoptimize_method', 'async' );
|
148 |
+
update_option( 'aj_enabled', $aj_enabled );
|
149 |
+
update_option( 'aj_method', $aj_method );
|
150 |
+
update_option( 'aj_jquery', $aj_jquery );
|
151 |
+
update_option( 'aj_async', $aj_async );
|
152 |
+
update_option( 'aj_defer', $aj_defer );
|
153 |
+
update_option( 'aj_exclusions', $aj_exclusions );
|
154 |
+
update_option( 'aj_plugin_exclusions', $aj_plugin_exclusions );
|
155 |
+
update_option( 'aj_theme_exclusions', $aj_theme_exclusions );
|
156 |
+
update_option( 'aj_autoptimize_enabled', $aj_autoptimize_enabled );
|
157 |
+
update_option( 'aj_autoptimize_method', $aj_autoptimize_method );
|
158 |
+
}
|
159 |
+
|
160 |
+
if ( $aj_version != AJ_VERSION ) {
|
161 |
+
update_option( 'aj_version', AJ_VERSION );
|
162 |
+
}
|
163 |
+
|
164 |
+
add_action( 'wp_dashboard_setup', array( $this, 'register_aj_dashboard_widget' ) );
|
165 |
+
add_action( 'admin_menu', array( $this, 'async_javascript_menu' ) );
|
166 |
+
add_action( 'wp_ajax_aj_steps', array( $this, 'aj_steps' ) );
|
167 |
+
add_action( 'admin_notices', array( $this, 'aj_admin_notice' ) );
|
168 |
+
}
|
169 |
+
|
170 |
+
/**
|
171 |
+
* register_aj_dashboard_widget()
|
172 |
+
*
|
173 |
+
* Register dashboard widget
|
174 |
+
*
|
175 |
+
*/
|
176 |
+
public function register_aj_dashboard_widget() {
|
177 |
+
if ( current_user_can( 'manage_options' ) ) {
|
178 |
+
global $wp_meta_boxes;
|
179 |
+
wp_add_dashboard_widget(
|
180 |
+
'aj_dashboard_widget',
|
181 |
+
AJ_TITLE,
|
182 |
+
array( $this, 'aj_dashboard_widget' )
|
183 |
+
);
|
184 |
+
$dashboard = $wp_meta_boxes['dashboard']['normal']['core'];
|
185 |
+
$aj_widget = array( 'aj_dashboard_widget' => $dashboard['aj_dashboard_widget'] );
|
186 |
+
unset( $dashboard['aj_dashboard_widget'] );
|
187 |
+
$sorted_dashboard = array_merge( $aj_widget, $dashboard );
|
188 |
+
$wp_meta_boxes['dashboard']['normal']['core'] = $sorted_dashboard;
|
189 |
+
}
|
190 |
+
}
|
191 |
+
|
192 |
+
/**
|
193 |
+
* aj_dashboard_widget()
|
194 |
+
*
|
195 |
+
* Dashboard widget
|
196 |
+
*
|
197 |
+
*/
|
198 |
+
public function aj_dashboard_widget() {
|
199 |
+
require_once('asyncjsDashboardScreens.php');
|
200 |
+
}
|
201 |
+
|
202 |
+
/**
|
203 |
+
* aj_admin_notice()
|
204 |
+
*
|
205 |
+
* check if async javascript (free) is active and display notice if so
|
206 |
+
* check if settings have been updated and display notice if so
|
207 |
+
*
|
208 |
+
* @param n/a
|
209 |
+
* @return n/a
|
210 |
+
*/
|
211 |
+
public function aj_admin_notice() {
|
212 |
+
if ( is_plugin_active( 'async-javascript-pro/async-javascript-pro.php' ) ) {
|
213 |
+
$class = 'update-nag';
|
214 |
+
$message = __('We have detected that Async JavaScript Pro is still active. Please disable from the plugin menu before using ','asyncjs') . AJ_TITLE;
|
215 |
+
echo "<div class=\"$class\">$message</div>";
|
216 |
+
}
|
217 |
+
}
|
218 |
+
|
219 |
+
/**
|
220 |
+
* async_javascript_menu()
|
221 |
+
*
|
222 |
+
* register admin menu
|
223 |
+
*
|
224 |
+
* @param n/a
|
225 |
+
* @return n/a
|
226 |
+
*/
|
227 |
+
public function async_javascript_menu() {
|
228 |
+
add_submenu_page(
|
229 |
+
'options-general.php',
|
230 |
+
AJ_TITLE . ' Admin',
|
231 |
+
AJ_TITLE,
|
232 |
+
'manage_options',
|
233 |
+
'async-javascript',
|
234 |
+
array( $this, 'async_javascript_admin' )
|
235 |
+
);
|
236 |
+
}
|
237 |
+
|
238 |
+
/**
|
239 |
+
* async_javascript_admin()
|
240 |
+
*
|
241 |
+
* admin page
|
242 |
+
*
|
243 |
+
* @param n/a
|
244 |
+
* @return n/a
|
245 |
+
*/
|
246 |
+
public function async_javascript_admin() {
|
247 |
+
$tabs = array( 'wizard', 'settings','status', 'help', 'Optimize More!' );
|
248 |
+
$active_tab = isset( $_GET[ 'tab' ] ) ? sanitize_text_field( $_GET[ 'tab' ] ) : 'settings';
|
249 |
+
?>
|
250 |
+
<div class="wrap aj">
|
251 |
+
<input type="hidden" id="aj_nonce" value="<?php echo wp_create_nonce( "aj_nonce" ); ?>" />
|
252 |
+
<div id="aj_notification"></div>
|
253 |
+
<h2>Welcome to <?php echo AJ_TITLE; ?></h2>
|
254 |
+
<h2 class="nav-tab-wrapper">
|
255 |
+
<?php
|
256 |
+
foreach ($tabs as $tab ) {
|
257 |
+
$active = $active_tab == $tab ? 'nav-tab-active' : '';
|
258 |
+
echo '<a href="?page=async-javascript&tab=' . $tab . '" class="nav-tab ' . $active . '">' . ucfirst( $tab ) . '</a>';
|
259 |
+
}
|
260 |
+
?>
|
261 |
+
</h2>
|
262 |
+
<?php
|
263 |
+
if ( $active_tab == 'wizard' ) {
|
264 |
+
require_once('asyncjsWizardScreens.php');
|
265 |
+
} else if ( $active_tab == 'status' ) {
|
266 |
+
require_once('asyncjsStatusScreens.php');
|
267 |
+
} else if ( $active_tab == 'settings' ) {
|
268 |
+
require_once('asyncjsSettingsScreens.php');
|
269 |
+
} else if ( $active_tab == 'help' ) {
|
270 |
+
require('asyncjsHelpScreens.php');
|
271 |
+
} else if ( $active_tab == 'Optimize More!' ) {
|
272 |
+
require('asyncjsPartnersScreens.php');
|
273 |
+
}
|
274 |
+
?>
|
275 |
+
</div>
|
276 |
+
<?php
|
277 |
+
}
|
278 |
+
|
279 |
+
/**
|
280 |
+
* about_aj()
|
281 |
+
*
|
282 |
+
* Return common text for about Async JavaScript
|
283 |
+
*
|
284 |
+
*/
|
285 |
+
private function about_aj() {
|
286 |
+
$return = '';
|
287 |
+
$return .= '<p>'.__('When a JavaScript file is loaded via the <strong><a href="https://codex.wordpress.org/Plugin_API/Action_Reference/wp_enqueue_scripts" target="_blank">wp_enqueue_script</a></strong> function, ' . AJ_TITLE . ' will add an <strong>async</strong> or <strong>defer</strong> attribute.','asyncjs').'</p>';
|
288 |
+
$return .= '<p>'.__('There are several ways an external JavaScript file can be executed:','asyncjs').'</p>';
|
289 |
+
$return .= '<ul style="list-style:disc inside;">';
|
290 |
+
$return .= '<li>'.__('If <strong>async</strong> is present: The script is executed asynchronously with the rest of the page (the script will be executed while the page continues the parsing)</li>','asyncjs');
|
291 |
+
$return .= '<li>'.__('If <strong>defer</strong> is present and <strong>async</strong> is not present: The script is executed when the page has finished parsing</li>','asyncjs');
|
292 |
+
$return .= '<li>'.__('If neither <strong>async</strong> or <strong>defer</strong> is present: The script is fetched and executed immediately, before the browser continues parsing the page</li>','asyncjs');
|
293 |
+
$return .= '</ul>';
|
294 |
+
$return .= '<p>'.__('Using <strong>async</strong> or <strong>defer</strong> helps to eliminate render-blocking JavaScript in above-the-fold content. This can also help to increase your pagespeed which in turn can assist in improving your page ranking.</p>','asyncjs');
|
295 |
+
return $return;
|
296 |
+
}
|
297 |
+
|
298 |
+
/**
|
299 |
+
* hints_tips()
|
300 |
+
*
|
301 |
+
* Return common text for Hints & Tips
|
302 |
+
*
|
303 |
+
*/
|
304 |
+
private function hints_tips() {
|
305 |
+
$return = '';
|
306 |
+
$return .= '<h3>'.__('Further Hints & Tips','asyncjs').'</h3>';
|
307 |
+
if ( is_plugin_active( 'autoptimize/autoptimize.php' ) ) {
|
308 |
+
$return .= '<p>' . AJ_TITLE . __(' has detected that you have Autoptimize installed and active. ','asyncjs') . AJ_TITLE . __(' can further enhance Autoptimize results by applying Async or Defer to the cache files used by Autoptimize.</p>','asyncjs');
|
309 |
+
} else {
|
310 |
+
$return .= '<p>' . AJ_TITLE . __(' has detected that you do not have Autoptimize installed and active. Autoptimize can provide further optimization of JavaScript which can benefit the results of ' . AJ_TITLE . ' (and ' . AJ_TITLE . ' can also enhance Autoptimize results!)</p>','asyncjs');
|
311 |
+
$return .= '<p>'. __('You can install Autoptimize from the plugin repository, or download it from here: ','asyncjs') .'<a href="https://wordpress.org/plugins/autoptimize/" target="_blank">https://wordpress.org/plugins/autoptimize/</a></p>';
|
312 |
+
}
|
313 |
+
$return .= '<p>'. __('Through our testing the following common Autoptimize settings work well to achieve the best results. Of course each website is different so you may need to fine tune these settings to suit.</p>','asyncjs');
|
314 |
+
$return .= '<ol>';
|
315 |
+
$return .= '<li>'. __('Navigate to <strong>Settings > Autoptimize</strong></li>','asyncjs');
|
316 |
+
$return .= '<li>'. __('Click on the <strong>Show advanced settings</strong> button</li>','asyncjs');
|
317 |
+
$return .= '<li>'. __('Under <strong>JavaScript Options</strong> set the following:</li>','asyncjs');
|
318 |
+
$return .= '<ul>';
|
319 |
+
$return .= '<li><strong>'. __('Optimize JavaScript Code?</strong>: Checked</li>','asyncjs');
|
320 |
+
$return .= '<li><strong>'. __('Force JavaScript in <head>?</strong>: Unchecked</li>','asyncjs');
|
321 |
+
$return .= '<li><strong>'. __('Also aggregate inline JS?</strong>: Checked<br />(did you need to exclude jQuery in ' . AJ_TITLE . '? Enabling this option <strong><em>MAY</em></strong> help resolve jQuery errors caused by inline JavaScript / jQuery code)</li>','asyncjs');
|
322 |
+
$return .= '<li><strong>'. __('Exclude scripts from Autoptimize:</strong>: Leave as default (or add any other scripts that you may need to exclude)</li>','asyncjs');
|
323 |
+
$return .= '<li><strong>'. __('Add try-catch wrapping?</strong>: Unchecked</li>','asyncjs');
|
324 |
+
$return .= '</ul>';
|
325 |
+
$return .= '<li>'. __('Click on the <strong>Save Changes and Empty Cache</strong> button</li>','asyncjs');
|
326 |
+
$return .= '<li>'. __('Navigate to <strong>Settings > ' . AJ_TITLE . '</strong></li>','asyncjs');
|
327 |
+
$return .= '<li>'. __('Click on the <strong>Settings</strong> tab</li>','asyncjs');
|
328 |
+
$return .= '<li>'. __('Scroll down to <strong>' . AJ_TITLE . ' For Plugins</strong></li>','asyncjs');
|
329 |
+
$return .= '<li>'. __('Under <strong>Autoptimize</strong> set the following:</li>','asyncjs');
|
330 |
+
$return .= '<ul>';
|
331 |
+
$return .= '<li><strong>'. __('Enable Autoptimize Support</strong>: Checked</li>','asyncjs');
|
332 |
+
$return .= '<li>'. __('<strong>Method</strong>: Select either <strong>Async</strong> or <strong>Defer</strong> (testing has found that <strong>Defer</strong> usually works best here!)</li>','asyncjs');
|
333 |
+
$return .= '</ul>';
|
334 |
+
$return .= '<li>'. __('Click on <strong>Save Changes</strong></li>','asyncjs');
|
335 |
+
$return .= '</ol>';
|
336 |
+
return $return;
|
337 |
+
}
|
338 |
+
|
339 |
+
/**
|
340 |
+
* aj_steps()
|
341 |
+
*
|
342 |
+
* all things Ajax (wizard, saving settings, ...)
|
343 |
+
* actual code moved to external file to tidy things up a bit
|
344 |
+
*
|
345 |
+
*/
|
346 |
+
public function aj_steps() {
|
347 |
+
require_once('asyncjsAllAjax.php');
|
348 |
+
}
|
349 |
+
}
|
asyncjsDashboardScreens.php
ADDED
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
+
exit; // Exit if accessed directly
|
4 |
+
}
|
5 |
+
|
6 |
+
$site_url = trailingslashit( get_site_url() );
|
7 |
+
$aj_gtmetrix_username = get_option( 'aj_gtmetrix_username', '' );
|
8 |
+
$aj_gtmetrix_api_key = get_option( 'aj_gtmetrix_api_key', '' );
|
9 |
+
$aj_gtmetrix_server = get_option( 'aj_gtmetrix_server', '' );
|
10 |
+
$aj_enabled = ( get_option( 'aj_enabled', 0 ) == 1 ) ? 'Enabled' : 'Disabled';
|
11 |
+
$aj_method = ( get_option( 'aj_method', 'async' ) == 'async' ) ? 'Async' : 'Defer';
|
12 |
+
$aj_jquery = get_option( 'aj_jquery', 'async' );
|
13 |
+
$aj_jquery = ( $aj_jquery == 'same ' ) ? get_option( 'aj_method', 'async' ) : $aj_jquery;
|
14 |
+
$aj_jquery = ( $aj_jquery == 'async' ) ? 'Async' : ( $aj_jquery == 'defer' ) ? 'Defer' : 'Excluded';
|
15 |
+
$aj_exclusions = get_option( 'aj_exclusions', '' );
|
16 |
+
$aj_plugin_exclusions = get_option( 'aj_plugin_exclusions', array() );
|
17 |
+
$aj_theme_exclusions = get_option( 'aj_theme_exclusions', array() );
|
18 |
+
$aj_autoptimize_enabled = ( get_option( 'aj_autoptimize_enabled', 0 ) == 1 ) ? 'Enabled' : 'Disabled';
|
19 |
+
$aj_autoptimize_method = ( get_option( 'aj_autoptimize_method', 'async' ) == 'async' ) ? 'Async' : 'Defer';
|
20 |
+
?>
|
21 |
+
<div class="wrap aj">
|
22 |
+
<h3><?php echo AJ_TITLE.__(' Status','asyncjs'); ?></h3>
|
23 |
+
<ul>
|
24 |
+
<li><strong><?php _e(' Status','asyncjs'); ?></strong> <?php echo $aj_enabled; ?></li>
|
25 |
+
<?php
|
26 |
+
if ( $aj_enabled == 'Enabled' ) {
|
27 |
+
?>
|
28 |
+
<li><strong><?php _e('Method:','asyncjs'); ?></strong> <?php echo $aj_method; ?></li>
|
29 |
+
<li><strong>jQuery:</strong> <?php echo $aj_jquery; ?></li>
|
30 |
+
<li><strong><?php _e('Exclusions:','asyncjs'); ?></strong> <?php echo $aj_exclusions; ?></li>
|
31 |
+
<li><strong><?php _e('Plugin Exclusions:','asyncjs'); ?></strong> <?php echo ( is_array( $aj_plugin_exclusions ) ) ? implode( ',', $aj_plugin_exclusions) : $aj_plugin_exclusions; ?></li>
|
32 |
+
<li><strong><?php _e('Theme Exclusions:','asyncjs'); ?></strong> <?php echo ( is_array( $aj_theme_exclusions ) ) ? implode( ',', $aj_theme_exclusions) : $aj_theme_exclusions; ?></li>
|
33 |
+
<?php
|
34 |
+
if ( is_plugin_active( 'autoptimize/autoptimize.php' ) ) {
|
35 |
+
?>
|
36 |
+
<li><strong><?php _e('Autoptimize Status:','asyncjs'); ?></strong> <?php echo $aj_autoptimize_enabled; ?></li>
|
37 |
+
<?php
|
38 |
+
if ( $aj_autoptimize_enabled == 'Enabled' ) {
|
39 |
+
?>
|
40 |
+
<li><strong><?php _e('Autoptimize Method:','asyncjs'); ?></strong> <?php echo $aj_autoptimize_method; ?></li>
|
41 |
+
<?php
|
42 |
+
}
|
43 |
+
} else {
|
44 |
+
?>
|
45 |
+
<li><?php _e('Autoptimize not installed or activated.','asyncjs'); ?></li>
|
46 |
+
<?php
|
47 |
+
}
|
48 |
+
}
|
49 |
+
?>
|
50 |
+
</ul>
|
51 |
+
<hr />
|
52 |
+
<h3><?php _e('Latest GTmetrix Results','asyncjs'); ?></h3>
|
53 |
+
<?php
|
54 |
+
$aj_gtmetrix_results = get_option( 'aj_gtmetrix_results', array() );
|
55 |
+
if ( isset( $aj_gtmetrix_results['latest'] ) ) {
|
56 |
+
$latest = $aj_gtmetrix_results['latest'];
|
57 |
+
$screenshot = $latest['screenshot'];
|
58 |
+
$pagespeed = $latest['results']['pagespeed_score'];
|
59 |
+
$yslow = $latest['results']['yslow_score'];
|
60 |
+
$pr = round( 255 * ( 1 - ( $pagespeed / 100 ) ), 0 );
|
61 |
+
$yr = round( 255 * ( 1 - ( $yslow / 100 ) ), 0 );
|
62 |
+
$pg = round( 255 * ( $pagespeed / 100 ), 0 );
|
63 |
+
$yg = round( 255 * ( $yslow / 100 ), 0 );
|
64 |
+
$pagespeed_style = ' style="color: rgb(' . $pr . ',' . $pg . ',0 )"';
|
65 |
+
$yslow_style = ' style="color: rgb(' . $yr . ',' . $yg . ',0 )"';
|
66 |
+
$flt = number_format( ( float )$latest['results']['fully_loaded_time'] / 1000, 2, '.', '' );
|
67 |
+
$tps = number_format( ( float )$latest['results']['page_bytes'] / 1024, 0, '.', '' );
|
68 |
+
$tps = ( $tps > 1024 ) ? number_format( ( float )$tps / 1024, 2, '.', '' ) . 'MB' : $tps . 'KB';
|
69 |
+
$requests = $latest['results']['page_elements'];
|
70 |
+
$report = $latest['results']['report_url'];
|
71 |
+
$report_url = '<a href="' . $report . '" target="_blank">' . $report . '</a>';
|
72 |
+
?>
|
73 |
+
<table id="aj_latest_gtmetrix_results" class="form-table aj-steps-table" width="100%" cellpadding="10">
|
74 |
+
<tr>
|
75 |
+
<td scope="row" align="center"><img src="data:image/jpeg;base64,<?php echo $screenshot; ?>" class="aj_latest_screenshot aj_gtmetrix_screenshot_dashboard">
|
76 |
+
<td scope="row" align="center">
|
77 |
+
<h3><?php _e('PageSpeed Score','asyncjs'); ?></h3>
|
78 |
+
<span class="aj_latest_pagespeed aj_gtmetrix_result"<?php echo $pagespeed_style; ?>><?php echo $pagespeed; ?>%</span>
|
79 |
+
</td>
|
80 |
+
<td scope="row" align="center">
|
81 |
+
<h3><?php _e('YSlow Score','asyncjs'); ?></h3>
|
82 |
+
<span class="aj_latest_yslow aj_gtmetrix_result"<?php echo $yslow_style; ?>><?php echo $yslow; ?>%</span>
|
83 |
+
</td>
|
84 |
+
</tr>
|
85 |
+
<tr>
|
86 |
+
<td scope="row" align="center">
|
87 |
+
<h3><?php _e('Fully Loaded Time','asyncjs'); ?></h3>
|
88 |
+
<span class="aj_latest_flt aj_gtmetrix_result"><?php echo $flt; ?>s</span>
|
89 |
+
</td>
|
90 |
+
<td scope="row" align="center">
|
91 |
+
<h3><?php _e('Total Page Size','asyncjs'); ?></h3>
|
92 |
+
<span class="aj_latest_tps aj_gtmetrix_result"><?php echo $tps; ?></span>
|
93 |
+
</td>
|
94 |
+
<td scope="row" align="center">
|
95 |
+
<h3><?php _e('Requests','asyncjs'); ?></h3>
|
96 |
+
<span class="aj_latest_requests aj_gtmetrix_result"><?php echo $requests; ?></span>
|
97 |
+
</td>
|
98 |
+
</tr>
|
99 |
+
<tr><td scope="row" align="left" colspan="6"><?php _e('See full report: ','asyncjs'); ?> <span class="aj_latest_report"><?php echo $report_url; ?></span></td></tr>
|
100 |
+
</table>
|
101 |
+
<?php
|
102 |
+
}
|
103 |
+
?>
|
104 |
+
<p><?php _e('Please click on the Settings button below to generate a new GTmetrix Report.','asyncjs'); ?></p>
|
105 |
+
<p><button data-id="aj_goto_settings" class="aj_steps_button"><?php _e('Settings','asyncjs'); ?></button></p>
|
106 |
+
</div>
|
107 |
+
<?php
|
asyncjsFrontendClass.php
ADDED
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
+
exit; // Exit if accessed directly
|
4 |
+
}
|
5 |
+
|
6 |
+
/*
|
7 |
+
* Frontend logic: add script attribute & change Autoptimize JS attrib if applicable
|
8 |
+
*/
|
9 |
+
|
10 |
+
class AsyncJavaScriptFrontend {
|
11 |
+
function __construct() {
|
12 |
+
add_filter( 'script_loader_tag', array( $this, 'aj_async_js' ), 20, 3 );
|
13 |
+
add_filter( 'autoptimize_filter_js_defer', array( $this, 'aj_autoptimize_defer' ), 11 );
|
14 |
+
}
|
15 |
+
|
16 |
+
/**
|
17 |
+
* the plugin instance
|
18 |
+
*/
|
19 |
+
private static $instance = NULL;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* get the plugin instance
|
23 |
+
*
|
24 |
+
* @return AsyncJavaScript
|
25 |
+
*/
|
26 |
+
public static function get_instance() {
|
27 |
+
if ( NULL === self::$instance ) {
|
28 |
+
self::$instance = new self();
|
29 |
+
}
|
30 |
+
return self::$instance;
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* aj_async_js()
|
35 |
+
*
|
36 |
+
* Main frontend function; adds 'async' or 'defer' attribute to '<script>' tasks called
|
37 |
+
* via wp_enqueue_script using the 'script_loader_tag' filter
|
38 |
+
*
|
39 |
+
*/
|
40 |
+
public function aj_async_js( $tag, $handle, $src ) {
|
41 |
+
if ( isset( $_GET['aj_simulate'] ) ) {
|
42 |
+
$aj_enabled = true;
|
43 |
+
$aj_method = sanitize_text_field( $_GET['aj_simulate'] );
|
44 |
+
if ( isset( $_GET['aj_simulate_jquery'] ) ) {
|
45 |
+
$aj_jquery = sanitize_text_field( $_GET['aj_simulate_jquery'] );
|
46 |
+
} else {
|
47 |
+
$aj_jquery = $aj_method;
|
48 |
+
}
|
49 |
+
$array_exclusions = array();
|
50 |
+
$array_async = array();
|
51 |
+
$array_defer = array();
|
52 |
+
$aj_plugin_exclusions = array();
|
53 |
+
$aj_theme_exclusions = array();
|
54 |
+
} else {
|
55 |
+
$aj_enabled = ( get_option( 'aj_enabled', 0 ) == 1 ) ? true : false;
|
56 |
+
$aj_method = ( get_option( 'aj_method', 'async' ) == 'async' ) ? 'async' : 'defer';
|
57 |
+
$aj_jquery = get_option( 'aj_jquery', 'async' );
|
58 |
+
$aj_jquery = ( $aj_jquery == 'same ' ) ? $aj_method : $aj_jquery;
|
59 |
+
$aj_exclusions = get_option( 'aj_exclusions', '' );
|
60 |
+
$array_exclusions = ( $aj_exclusions != '' ) ? explode( ',', $aj_exclusions ) : array();
|
61 |
+
$aj_async = get_option( 'aj_async', '' );
|
62 |
+
$array_async = ( $aj_async != '' ) ? explode( ',', $aj_async ) : array();
|
63 |
+
$aj_defer = get_option( 'aj_defer', '' );
|
64 |
+
$array_defer = ( $aj_defer != '' ) ? explode( ',', $aj_defer ) : array();
|
65 |
+
$aj_plugin_exclusions = get_option( 'aj_plugin_exclusions', array() );
|
66 |
+
$aj_theme_exclusions = get_option( 'aj_theme_exclusions', array() );
|
67 |
+
}
|
68 |
+
if ( false !== $aj_enabled && false === is_admin() ) {
|
69 |
+
if ( is_array( $aj_plugin_exclusions ) && !empty( $aj_plugin_exclusions ) ) {
|
70 |
+
foreach ( $aj_plugin_exclusions as $aj_plugin_exclusion ) {
|
71 |
+
$aj_plugin_exclusion = trim( $aj_plugin_exclusion );
|
72 |
+
if ( !empty( $aj_plugin_exclusion ) ) {
|
73 |
+
if ( false !== strpos( strtolower( $src ), strtolower( $aj_plugin_exclusion ) ) ) {
|
74 |
+
return $tag;
|
75 |
+
}
|
76 |
+
}
|
77 |
+
}
|
78 |
+
}
|
79 |
+
if ( is_array( $aj_theme_exclusions ) && !empty( $aj_theme_exclusions ) ) {
|
80 |
+
foreach ( $aj_theme_exclusions as $aj_theme_exclusion ) {
|
81 |
+
$aj_theme_exclusion = trim( $aj_theme_exclusion );
|
82 |
+
if ( !empty( $aj_theme_exclusion ) ) {
|
83 |
+
if ( false !== strpos( strtolower( $src ), strtolower( $aj_theme_exclusion ) ) ) {
|
84 |
+
return $tag;
|
85 |
+
}
|
86 |
+
}
|
87 |
+
}
|
88 |
+
}
|
89 |
+
if ( is_array( $array_exclusions ) && !empty( $array_exclusions ) ) {
|
90 |
+
foreach ( $array_exclusions as $exclusion ) {
|
91 |
+
$exclusion = trim( $exclusion );
|
92 |
+
if ( !empty( $exclusion ) ) {
|
93 |
+
if ( false !== strpos( strtolower( $src ), strtolower( $exclusion ) ) ) {
|
94 |
+
return $tag;
|
95 |
+
}
|
96 |
+
}
|
97 |
+
}
|
98 |
+
}
|
99 |
+
if ( false !== strpos( strtolower( $src ), 'js/jquery/jquery.js' ) ) {
|
100 |
+
if ( $aj_jquery == 'async' || $aj_jquery == 'defer' ) {
|
101 |
+
$tag = str_replace( 'src=', $aj_jquery . "='" . $aj_jquery . "' src=", $tag );
|
102 |
+
return $tag;
|
103 |
+
} else if ( $aj_jquery == 'exclude' ) {
|
104 |
+
return $tag;
|
105 |
+
}
|
106 |
+
}
|
107 |
+
if ( is_array( $array_async ) && !empty( $array_async ) ) {
|
108 |
+
foreach ( $array_async as $async ) {
|
109 |
+
$async = trim( $async );
|
110 |
+
if ( !empty( $async ) ) {
|
111 |
+
if ( false !== strpos( strtolower( $src ), strtolower( $async ) ) ) {
|
112 |
+
return str_replace( 'src=', "async='async' src=", $tag );
|
113 |
+
}
|
114 |
+
}
|
115 |
+
}
|
116 |
+
}
|
117 |
+
if ( is_array( $array_defer ) && !empty( $array_defer ) ) {
|
118 |
+
foreach ( $array_defer as $defer ) {
|
119 |
+
$defer = trim( $defer );
|
120 |
+
if ( !empty( $defer ) ) {
|
121 |
+
if ( false !== strpos( strtolower( $src ), strtolower( $defer ) ) ) {
|
122 |
+
return str_replace( 'src=', "defer='defer' src=", $tag );
|
123 |
+
}
|
124 |
+
}
|
125 |
+
}
|
126 |
+
}
|
127 |
+
$tag = str_replace( 'src=', $aj_method . "='" . $aj_method . "' src=", $tag );
|
128 |
+
return $tag;
|
129 |
+
}
|
130 |
+
return $tag;
|
131 |
+
}
|
132 |
+
|
133 |
+
/**
|
134 |
+
* aj_autoptimize_defer()
|
135 |
+
*
|
136 |
+
* Adds support for Autoptimize plugin. Adds 'async' attribute to '<script>' tasks called via autoptimize_filter_js_defer filter
|
137 |
+
* Autoptimize: https://wordpress.org/plugins/autoptimize/
|
138 |
+
*
|
139 |
+
*/
|
140 |
+
public function aj_autoptimize_defer( $defer ) {
|
141 |
+
$aj_enabled = ( get_option( 'aj_enabled', 0 ) == 1 ) ? true : false;
|
142 |
+
$aj_method = ( get_option( 'aj_method', 'async' ) == 'async' ) ? 'async' : 'defer';
|
143 |
+
$aj_autoptimize_enabled = ( get_option( 'aj_autoptimize_enabled', 0 ) == 1 ) ? true : false;
|
144 |
+
$aj_autoptimize_method = ( get_option( 'aj_autoptimize_method', 'async' ) == 'async' ) ? 'async' : 'defer';
|
145 |
+
if ( false !== $aj_enabled && false === is_admin() ) {
|
146 |
+
if ( false !== $aj_autoptimize_enabled ) {
|
147 |
+
return " " . $aj_autoptimize_method . "='" . $aj_autoptimize_method . "' ";
|
148 |
+
}
|
149 |
+
}
|
150 |
+
return '';
|
151 |
+
}
|
152 |
+
}
|
asyncjsHelpScreens.php
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
+
exit; // Exit if accessed directly
|
4 |
+
}
|
5 |
+
?>
|
6 |
+
<table class="form-table" width="100%" cellpadding="10">
|
7 |
+
<tr>
|
8 |
+
<td scope="row" align="center" style="vertical-align: top !important;"><img src="<?php echo AJ_PLUGIN_URL; ?>images/stick_figure_panicking_150_clr_13267.gif" title="Help & Support" alt="Help & Support" class="aj_step_img"></td>
|
9 |
+
<td scope="row" align="left" style="vertical-align: top !important;">
|
10 |
+
<h3><?php _e('Help & Support','asyncjs'); ?></h3>
|
11 |
+
<p style="font-size: 0.7em;"><strong><?php _e('Installed Version: ','asyncjs'); ?></strong><?php echo AJ_VERSION; ?></p>
|
12 |
+
<p><?php _e('Below are some answers to some frequently asked questions about ','asyncjs'); ?> <?php echo AJ_TITLE; ?></p>
|
13 |
+
<hr />
|
14 |
+
<h3><?php _e("Which browsers support the 'async' and 'defer' attributes?",'asyncjs'); ?></h3>
|
15 |
+
<p><?php _e("The 'async' attribute is new in HTML5. It is supported by the following browsers:",'asyncjs'); ?></p>
|
16 |
+
<ul>
|
17 |
+
<li>Chrome</li>
|
18 |
+
<li>IE 10 <?php _e('and higher','asyncjs'); ?></li>
|
19 |
+
<li>Firefox 3.6 <?php _e('and higher','asyncjs'); ?></li>
|
20 |
+
<li>Safari</li>
|
21 |
+
<li>Opera</li>
|
22 |
+
</ul>
|
23 |
+
<hr />
|
24 |
+
<h3><?php _e('Where can I get help?','asyncjs'); ?></h3>
|
25 |
+
<p><?php echo AJ_TITLE; ?> <?php _e('is supported exclusively via the wordpress.org support forum','asyncjs'); ?> <a href="https://wordpress.org/support/plugin/async-javascript" target="_blank">https://wordpress.org/support/plugin/async-javascript</a></p>
|
26 |
+
<hr />
|
27 |
+
<h3><?php _e('Do you provide premium support (configuration) or performance optimization services?','asyncjs'); ?></h3>
|
28 |
+
<p><?php _e('We offer premium services for Async JavaScript and also perform full web performance optimization services. More info at ','asyncjs'); ?><a href="https://autoptimize.com/?utm=asyncjs" target="_blank">https://autoptimize.com/</a></p>
|
29 |
+
<hr />
|
30 |
+
<h3><?php _e('What about CSS?','asyncjs'); ?></h3>
|
31 |
+
<p><?php _e('As the name implies, Async JavaScript is built to enhance JavaScript loading only. Async JavaScript does not have any impact on CSS.','asyncjs'); ?></p>
|
32 |
+
<p><?php _e('We recommend using the awesome <a href="https://wordpress.org/plugins/autoptimize/" target="_blank">Autoptimize</a> plugin alongside Async JavaScript for CSS optimization.','asyncjs'); ?></p>
|
33 |
+
<hr />
|
34 |
+
<h3><?php _e('I want out, how should I remove Async JavaScript?','asyncjs'); ?></h3>
|
35 |
+
<ul>
|
36 |
+
<li><?php _e('Disable the plugin','asyncjs'); ?></li>
|
37 |
+
<li><?php _e('Delete the plugin','asyncjs'); ?></li>
|
38 |
+
</ul>
|
39 |
+
</td>
|
40 |
+
</tr>
|
41 |
+
</table>
|
42 |
+
<?php
|
asyncjsPartnersScreens.php
ADDED
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
+
exit; // Exit if accessed directly
|
4 |
+
}
|
5 |
+
|
6 |
+
/*
|
7 |
+
* this contains style & logic to display partner information
|
8 |
+
* which is fetched as RSS-feed and cached automagically by WordPress
|
9 |
+
* this remote fetch can be disabled with a filter
|
10 |
+
*/
|
11 |
+
|
12 |
+
?>
|
13 |
+
<style>
|
14 |
+
.itemDetail {
|
15 |
+
list-style-type: none;
|
16 |
+
background: #fff;
|
17 |
+
width: 250px;
|
18 |
+
min-height: 290px;
|
19 |
+
border: 1px solid #ccc;
|
20 |
+
float: left;
|
21 |
+
padding: 15px;
|
22 |
+
position: relative;
|
23 |
+
margin: 0 10px 10px 0;
|
24 |
+
}
|
25 |
+
.itemTitle {
|
26 |
+
margin-top:0px;
|
27 |
+
margin-bottom:10px;
|
28 |
+
}
|
29 |
+
.itemImage {
|
30 |
+
text-align: center;
|
31 |
+
}
|
32 |
+
.itemImage img {
|
33 |
+
max-width: 95%;
|
34 |
+
max-height: 150px;
|
35 |
+
}
|
36 |
+
.itemDescription {
|
37 |
+
margin-bottom:30px;
|
38 |
+
}
|
39 |
+
.itemButtonRow {
|
40 |
+
position: absolute;
|
41 |
+
bottom: 10px;
|
42 |
+
right: 10px;
|
43 |
+
width:100%;
|
44 |
+
}
|
45 |
+
.itemButton {
|
46 |
+
float:right;
|
47 |
+
}
|
48 |
+
.itemButton a {
|
49 |
+
text-decoration: none;
|
50 |
+
color: #555;
|
51 |
+
}
|
52 |
+
.itemButton a:hover {
|
53 |
+
text-decoration: none;
|
54 |
+
color: #23282d;
|
55 |
+
}
|
56 |
+
</style>
|
57 |
+
<?php
|
58 |
+
echo '<h2>'. __("These related services can improve your site's performance even more!",'asyncjs') . '</h2>';
|
59 |
+
?>
|
60 |
+
<div>
|
61 |
+
<?php getasyncJSPartnerFeed(); ?>
|
62 |
+
</div>
|
63 |
+
|
64 |
+
<?php
|
65 |
+
function getasyncJSPartnerFeed() {
|
66 |
+
$noFeedText=__( 'Have a look at <a href="http://optimizingmatters.com/">optimizingmatters.com</a> for tools that can help you speed up your site even more!', 'asyncjs' );
|
67 |
+
|
68 |
+
if (apply_filters('asyncJS_settingsscreen_remotehttp',true)) {
|
69 |
+
$rss = fetch_feed( "http://feeds.feedburner.com/OptimizingMattersDownloads" );
|
70 |
+
$maxitems = 0;
|
71 |
+
|
72 |
+
if ( ! is_wp_error( $rss ) ) {
|
73 |
+
$maxitems = $rss->get_item_quantity( 20 );
|
74 |
+
$rss_items = $rss->get_items( 0, $maxitems );
|
75 |
+
} ?>
|
76 |
+
<ul>
|
77 |
+
<?php
|
78 |
+
if ( $maxitems == 0 ) {
|
79 |
+
echo $noFeedText;
|
80 |
+
} else {
|
81 |
+
foreach ( $rss_items as $item ) :
|
82 |
+
$itemURL = esc_url( $item->get_permalink() ); ?>
|
83 |
+
<li class="itemDetail">
|
84 |
+
<h3 class="itemTitle"><a href="<?php echo $itemURL; ?>" target="_blank"><?php echo esc_html( $item->get_title() ); ?></a></h3>
|
85 |
+
<?php
|
86 |
+
if (($enclosure = $item->get_enclosure()) && (strpos($enclosure->get_type(),"image")!==false) ) {
|
87 |
+
$itemImgURL=esc_url($enclosure->get_link());
|
88 |
+
echo "<div class=\"itemImage\"><a href=\"".$itemURL."\" target=\"_blank\"><img src=\"".$itemImgURL."\"/></a></div>";
|
89 |
+
}
|
90 |
+
?>
|
91 |
+
<div class="itemDescription"><?php echo wp_kses_post($item -> get_description() ); ?></div>
|
92 |
+
<div class="itemButtonRow"><div class="itemButton button-secondary"><a href="<?php echo $itemURL; ?>" target="_blank">More info</a></div></div>
|
93 |
+
</li>
|
94 |
+
<?php endforeach; ?>
|
95 |
+
<?php } ?>
|
96 |
+
</ul>
|
97 |
+
<?php
|
98 |
+
} else {
|
99 |
+
echo $noFeedText;
|
100 |
+
}
|
101 |
+
}
|
asyncjsSettingsScreens.php
ADDED
@@ -0,0 +1,151 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
+
exit; // Exit if accessed directly
|
4 |
+
}
|
5 |
+
|
6 |
+
$site_url = trailingslashit( get_site_url() );
|
7 |
+
$aj_gtmetrix_username = get_option( 'aj_gtmetrix_username', '' );
|
8 |
+
$aj_gtmetrix_api_key = get_option( 'aj_gtmetrix_api_key', '' );
|
9 |
+
$aj_gtmetrix_server = get_option( 'aj_gtmetrix_server', '' );
|
10 |
+
$aj_enabled = get_option( 'aj_enabled', 0 );
|
11 |
+
$aj_enabled_checked = ( $aj_enabled == 1 ) ? ' checked="checked"' : '';
|
12 |
+
$aj_method = get_option( 'aj_method', 'async' );
|
13 |
+
$aj_method_async = ( $aj_method == 'async' ) ? ' checked="checked"' : '';
|
14 |
+
$aj_method_defer = ( $aj_method == 'defer' ) ? ' checked="checked"' : '';
|
15 |
+
$aj_jquery = get_option( 'aj_jquery', 'async' );
|
16 |
+
$aj_jquery = ( $aj_jquery == 'same ' ) ? $aj_method : $aj_jquery;
|
17 |
+
$aj_jquery_async = ( $aj_jquery == 'async' ) ? ' checked="checked"' : '';
|
18 |
+
$aj_jquery_defer = ( $aj_jquery == 'defer' ) ? ' checked="checked"' : '';
|
19 |
+
$aj_jquery_exclude = ( $aj_jquery == 'exclude' ) ? ' checked="checked"' : '';
|
20 |
+
$aj_async = get_option( 'aj_async', '' );
|
21 |
+
$aj_defer = get_option( 'aj_defer', '' );
|
22 |
+
$aj_exclusions = get_option( 'aj_exclusions', '' );
|
23 |
+
$aj_plugin_exclusions = ( is_array( get_option( 'aj_plugin_exclusions', array() ) ) && !is_null( get_option( 'aj_plugin_exclusions', array() ) ) ? get_option( 'aj_plugin_exclusions', array() ) : explode( ',', get_option( 'aj_plugin_exclusions', '' ) ) );
|
24 |
+
$aj_theme_exclusions = ( is_array( get_option( 'aj_theme_exclusions', array() ) ) && !is_null( get_option( 'aj_theme_exclusions', array() ) ) ? get_option( 'aj_theme_exclusions', array() ) : explode( ',', get_option( 'aj_theme_exclusions', '' ) ) );
|
25 |
+
$aj_autoptimize_enabled = get_option( 'aj_autoptimize_enabled', 0 );
|
26 |
+
$aj_autoptimize_enabled_checked = ( $aj_autoptimize_enabled == 1 ) ? ' checked="checked"' : '';
|
27 |
+
$aj_autoptimize_method = get_option( 'aj_autoptimize_method', 'async' );
|
28 |
+
$aj_autoptimize_async = ( $aj_autoptimize_method == 'async' ) ? ' checked="checked"' : '';
|
29 |
+
$aj_autoptimize_defer = ( $aj_autoptimize_method == 'defer' ) ? ' checked="checked"' : '';
|
30 |
+
?>
|
31 |
+
<table class="form-table" width="100%" cellpadding="10">
|
32 |
+
<tr id="aj_intro">
|
33 |
+
<td scope="row" align="center" style="vertical-align: top !important;"><img src="<?php echo AJ_PLUGIN_URL; ?>images/finger_point_out_punch_hole_400_clr_17860.png" title="<?php echo AJ_TITLE; ?>" alt="<?php echo AJ_TITLE; ?>" class="aj_step_img"></td>
|
34 |
+
<td scope="row" align="left" style="vertical-align: top !important;">
|
35 |
+
<h3><?php echo AJ_TITLE; ?></h3>
|
36 |
+
<?php echo $this->about_aj(); ?>
|
37 |
+
</td>
|
38 |
+
</tr>
|
39 |
+
<tr id="aj_quick_settings">
|
40 |
+
<td scope="row" align="center" style="vertical-align: top !important;"><img src="<?php echo AJ_PLUGIN_URL; ?>images/clock_fast_times_text_10762.gif" title="Quick Settings" alt="Quick Settings" class="aj_step_img"></td>
|
41 |
+
<td scope="row" align="left" style="vertical-align: top !important;">
|
42 |
+
<h3><?php _e('Quick Settings','asyncjs'); ?></h3>
|
43 |
+
<p><?php _e('Use the buttons below to apply common settings.','asyncjs'); ?></p>
|
44 |
+
<p><?php _e('<strong>Note: </strong>Using the buttons below will erase any current settings within ','asyncjs'); ?><?php echo AJ_TITLE; ?>.</p>
|
45 |
+
<p>
|
46 |
+
<button data-id="aj_step2b_apply" class="aj_steps_button"><?php _e('Apply Async','asyncjs'); ?></button>
|
47 |
+
<button data-id="aj_step2c_apply" class="aj_steps_button"><?php _e('Apply Defer','asyncjs'); ?></button>
|
48 |
+
<button data-id="aj_step2d_apply" class="aj_steps_button"><?php _e('Apply Async','asyncjs'); _e(' (jQuery excluded)','asyncjs'); ?></button>
|
49 |
+
<button data-id="aj_step2e_apply" class="aj_steps_button"><?php _e('Apply Defer','asyncjs'); _e(' (jQuery excluded)','asyncjs'); ?></button>
|
50 |
+
</p>
|
51 |
+
</td>
|
52 |
+
</tr>
|
53 |
+
<tr id="aj_settings_enable">
|
54 |
+
<td scope="row" align="center" style="vertical-align: top !important;"><img src="<?php echo AJ_PLUGIN_URL; ?>images/finger_point_out_punch_hole_400_clr_17860.png" title="Enable <?php echo AJ_TITLE; ?>" alt="Enable <?php echo AJ_TITLE; ?>" class="aj_step_img"></td>
|
55 |
+
<td scope="row" align="left" style="vertical-align: top !important;">
|
56 |
+
<h3><?php _e('Enable ','asyncjs'); ?><?php echo AJ_TITLE; ?></h3>
|
57 |
+
<p><label><?php _e('Enable ','asyncjs'); ?><?php echo AJ_TITLE; ?>? </label><input type="checkbox" id="aj_enabled" id="aj_enabled" value="1" <?php echo $aj_enabled_checked; ?> /></p>
|
58 |
+
<hr />
|
59 |
+
<h3><?php echo AJ_TITLE; ?> Method</h3>
|
60 |
+
<p><?php _e('Please select the method (<strong>async</strong> or <strong>defer</strong>) that you wish to enable:','asyncjs'); ?></p>
|
61 |
+
<p><label><?php _e('Method: ','asyncjs'); ?></label><input type="radio" name="aj_method" value="async" <?php echo $aj_method_async; ?> /> Async <input type="radio" name="aj_method" value="defer" <?php echo $aj_method_defer; ?> /> Defer</p>
|
62 |
+
<hr />
|
63 |
+
<h3><?php _e('jQuery','asyncjs'); ?></h3>
|
64 |
+
<p><?php _e('Often if jQuery is loaded with <strong>async</strong> or <strong>defer</strong> it can break some jQuery functions, specifically inline scripts which require jQuery to be loaded before the scripts are run. <strong><em>Sometimes</em></strong> choosing a different method (<strong>async</strong> or <strong>defer</strong>) will work, otherwise it may be necessary to exclude jQuery from having <strong>async</strong> or <strong>defer</strong> applied.','asyncjs'); ?></p>
|
65 |
+
<p><label><?php _e('jQuery Method: ','asyncjs'); ?></label><input type="radio" name="aj_jquery" value="async" <?php echo $aj_jquery_async; ?> /> Async <input type="radio" name="aj_jquery" value="defer" <?php echo $aj_jquery_defer; ?> /> Defer <input type="radio" name="aj_jquery" value="exclude" <?php echo $aj_jquery_exclude; ?> /> <?php _e('Exclude','asyncjs'); ?></p>
|
66 |
+
<hr />
|
67 |
+
<h3><?php _e('Scripts to Async','asyncjs'); ?></h3>
|
68 |
+
<p><?php _e("Please list any scripts which you would like to apply the 'async' attribute to. (comma seperated list eg: jquery.js,jquery-ui.js)",'asyncjs'); ?></p>
|
69 |
+
<p><label><?php _e('Async Scripts:','asyncjs'); ?> </label><textarea id="aj_async" style="width:95%;"><?php echo $aj_async; ?></textarea></p>
|
70 |
+
<hr />
|
71 |
+
<h3><?php _e('Scripts to Defer','asyncjs'); ?></h3>
|
72 |
+
<p><?php _e("Please list any scripts which you would like to apply the 'defer' attribute to. (comma seperated list eg: jquery.js,jquery-ui.js)",'asyncjs'); ?></p>
|
73 |
+
<p><label><?php _e('Defer Scripts:','asyncjs'); ?> </label><textarea id="aj_defer" style="width:95%;"><?php echo $aj_defer; ?></textarea></p>
|
74 |
+
<hr />
|
75 |
+
<h3><?php _e('Script Exclusion','asyncjs'); ?></h3>
|
76 |
+
<p><?php _e('Please list any scripts which you would like excluded from having <strong>async</strong> or <strong>defer</strong> applied during page load. (comma seperated list eg: jquery.js,jquery-ui.js)','asyncjs'); ?></p>
|
77 |
+
<p><label><?php _e('Exclusions:','asyncjs'); ?> </label><textarea id="aj_exclusions" style="width:95%;"><?php echo $aj_exclusions; ?></textarea></p>
|
78 |
+
<hr />
|
79 |
+
<h3><?php _e('Plugin Exclusions','asyncjs'); ?></h3>
|
80 |
+
<p><?php _e('Please select one or more plugins. Scripts contained within the plugin will not have async / defer applied.','asyncjs'); ?></p>
|
81 |
+
<p><?php _e('<strong><em>Please Note:</em></strong> This will exclude any JavaScript files which are contained within the files of the selected Plugin(s). External JavaScripts loaded by the selected Plugin(s) are not affected.','asyncjs'); ?></p>
|
82 |
+
<p><?php _e('For Example: If a plugin is installed in path <strong>/wp-content/plugins/some-plugin/</strong> then and JavaScripts contained within this path will be excluded. If the plugin loads a JavaScript which is countained elsewhere then the Global Method will be used (ie async or defer)','asyncjs'); ?></p>
|
83 |
+
<p><label><?php _e('Exclusions: ','asyncjs'); ?></label>
|
84 |
+
<?php
|
85 |
+
$plugins = get_plugins();
|
86 |
+
$output = '';
|
87 |
+
if ( !empty( $plugins ) ) {
|
88 |
+
$output .= '<select id="aj_plugin_exclusions" class="aj_chosen" multiple="multiple" style="min-width:50%;" >';
|
89 |
+
foreach ( $plugins as $path=>$plugin ) {
|
90 |
+
$split = explode( '/', $path );
|
91 |
+
$text_domain = $split[0];
|
92 |
+
if ( $text_domain != 'async-javascript' ) {
|
93 |
+
//var_dump( $aj_plugin_exclusions );
|
94 |
+
$selected = ( in_array( $text_domain, $aj_plugin_exclusions ) ) ? ' selected="selected"' : '';
|
95 |
+
$output .= '<option value="' . $text_domain . '"' . $selected . '>' . $plugin['Name'] . '</option>';
|
96 |
+
}
|
97 |
+
}
|
98 |
+
$output .= '</select>';
|
99 |
+
} else {
|
100 |
+
$output .= '<p>'.__('No plugins found.','asyncjs').'</p>';
|
101 |
+
}
|
102 |
+
echo $output;
|
103 |
+
?>
|
104 |
+
</p>
|
105 |
+
<hr />
|
106 |
+
<h3><?php _e('Theme Exclusions','asyncjs'); ?></h3>
|
107 |
+
<p><?php _e('Please select one or more themes. Scripts contained within the theme will not have async / defer applied.','asyncjs'); ?></p>
|
108 |
+
<p><?php _e('<strong><em>Please Note:</em></strong> This will exclude any JavaScript files which are contained within the files of the selected Theme(s). External JavaScripts loaded by the selected Theme(s) are not affected.','asyncjs'); ?></p>
|
109 |
+
<p><?php _e('For Example: If a theme is installed in path <strong>/wp-content/themes/some-theme/</strong> then and JavaScripts contained within this path will be excluded. If the theme loads a JavaScript which is countained elsewhere then the Global Method will be used (ie async or defer)','asyncjs'); ?></p>
|
110 |
+
<p>
|
111 |
+
<label><?php _e('Exclusions:','asyncjs'); ?> </label>
|
112 |
+
<?php
|
113 |
+
$themes = wp_get_themes();
|
114 |
+
$output = '';
|
115 |
+
if ( !empty( $themes ) ) {
|
116 |
+
$output .= '<select id="aj_theme_exclusions" class="aj_chosen" multiple="multiple" style="min-width:50%;" >';
|
117 |
+
foreach ( $themes as $path=>$theme ) {
|
118 |
+
$text_domain = $path;
|
119 |
+
$selected = ( in_array( $text_domain, $aj_theme_exclusions ) ) ? ' selected="selected"' : '';
|
120 |
+
$output .= '<option value="' . $text_domain . '"' . $selected . '>' . $theme->Name . '</option>';
|
121 |
+
}
|
122 |
+
$output .= '</select>';
|
123 |
+
} else {
|
124 |
+
$output .= '<p>'. __('No themes found.','asyncjs').'</p>';
|
125 |
+
}
|
126 |
+
echo $output;
|
127 |
+
?>
|
128 |
+
</p>
|
129 |
+
<hr />
|
130 |
+
<h3><?php echo AJ_TITLE; ?> <?php _e('For Plugins','asyncjs'); ?></h3>
|
131 |
+
<p><?php _e('Although not recommended, some themes / plugins can load JavaScript files without using the <strong><a href="https://codex.wordpress.org/Plugin_API/Action_Reference/wp_enqueue_scripts" target="_blank">wp_enqueue_script</a></strong> function. In some cases this is necessary for the functionality of the theme / plugin.','asyncjs'); ?></p>
|
132 |
+
<p><?php _e('If these themes / plugins provide a hook that can be used to manipulate how the JavaScript file is loaded then <?php echo AJ_TITLE; ?> may be able to provide support for these themes / plugins.','asyncjs'); ?></p>
|
133 |
+
<p><?php _e('If you have any active themes / plugins that <?php echo AJ_TITLE; ?> supports then these will be listed below.','asyncjs'); ?></p>
|
134 |
+
<p><?php _e('If you think you have found a plugin that <?php echo AJ_TITLE; ?> may be able to provide support for please lodge a ticket at <a href="https://wordpress.org/support/plugin/async-javascript" target="_blank">https://wordpress.org/support/plugin/async-javascript</a>','asyncjs'); ?></p>
|
135 |
+
<?php
|
136 |
+
if ( is_plugin_active( 'autoptimize/autoptimize.php' ) ) {
|
137 |
+
?>
|
138 |
+
<div class="aj_plugin">
|
139 |
+
<h4><?php _e('Plugin: Autoptimize','asyncjs'); ?></h4>
|
140 |
+
<p><a href="https://wordpress.org/plugins/autoptimize/" target="_blank">https://wordpress.org/plugins/autoptimize/</a></p>
|
141 |
+
<p><label><?php _e('Enable Autoptimize Support:','asyncjs'); ?> </label><input type="checkbox" id="aj_autoptimize_enabled" value="1" <?php echo $aj_autoptimize_enabled_checked; ?> /></p>
|
142 |
+
<p><label><?php _e('jQuery Method:','asyncjs'); ?> </label><input type="radio" name="aj_autoptimize_method" value="async" <?php echo $aj_autoptimize_async; ?> /> Async <input type="radio" name="aj_autoptimize_method" value="defer" <?php echo $aj_autoptimize_defer; ?> /> Defer</p>
|
143 |
+
</div>
|
144 |
+
<?php
|
145 |
+
}
|
146 |
+
?>
|
147 |
+
<p><button data-id="aj_save_settings" class="aj_steps_button"><?php _e('Save Settings','asyncjs'); ?></button></p>
|
148 |
+
</td>
|
149 |
+
</tr>
|
150 |
+
</table>
|
151 |
+
<?php
|
asyncjsStatusScreens.php
ADDED
@@ -0,0 +1,190 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
+
exit; // Exit if accessed directly
|
4 |
+
}
|
5 |
+
|
6 |
+
$site_url = trailingslashit( get_site_url() );
|
7 |
+
$aj_gtmetrix_username = get_option( 'aj_gtmetrix_username', '' );
|
8 |
+
$aj_gtmetrix_api_key = get_option( 'aj_gtmetrix_api_key', '' );
|
9 |
+
$aj_gtmetrix_server = get_option( 'aj_gtmetrix_server', '' );
|
10 |
+
if ( $aj_gtmetrix_username != '' && $aj_gtmetrix_api_key != '' ) {
|
11 |
+
$test = new Services_WTF_Test();
|
12 |
+
$test->api_username( $aj_gtmetrix_username );
|
13 |
+
$test->api_password( $aj_gtmetrix_api_key );
|
14 |
+
$test->user_agent( AJ_UA );
|
15 |
+
$status = $test->status();
|
16 |
+
$credits = $status['api_credits'];
|
17 |
+
} else {
|
18 |
+
$credits = 'N/A';
|
19 |
+
}
|
20 |
+
$aj_enabled = ( get_option( 'aj_enabled', 0 ) == 1 ) ? 'Enabled' : 'Disabled';
|
21 |
+
$aj_method = ( get_option( 'aj_method', 'async' ) == 'async' ) ? 'Async' : 'Defer';
|
22 |
+
$aj_jquery = get_option( 'aj_jquery', 'async' );
|
23 |
+
$aj_jquery = ( $aj_jquery == 'same ' ) ? get_option( 'aj_method', 'async' ) : $aj_jquery;
|
24 |
+
$aj_jquery = ( $aj_jquery == 'async' ) ? 'Async' : ( $aj_jquery == 'defer' ) ? 'Defer' : 'Excluded';
|
25 |
+
$aj_async = get_option( 'aj_async', '' );
|
26 |
+
$aj_defer = get_option( 'aj_defer', '' );
|
27 |
+
$aj_exclusions = get_option( 'aj_exclusions', '' );
|
28 |
+
$aj_plugin_exclusions = ( is_array( get_option( 'aj_plugin_exclusions', array() ) ) && !is_null( get_option( 'aj_plugin_exclusions', array() ) ) ? get_option( 'aj_plugin_exclusions', array() ) : explode( ',', get_option( 'aj_plugin_exclusions', '' ) ) );
|
29 |
+
$aj_theme_exclusions = ( is_array( get_option( 'aj_theme_exclusions', array() ) ) && !is_null( get_option( 'aj_theme_exclusions', array() ) ) ? get_option( 'aj_theme_exclusions', array() ) : explode( ',', get_option( 'aj_theme_exclusions', '' ) ) );
|
30 |
+
$aj_autoptimize_enabled = ( get_option( 'aj_autoptimize_enabled', 0 ) == 1 ) ? 'Enabled' : 'Disabled';
|
31 |
+
$aj_autoptimize_method = ( get_option( 'aj_autoptimize_method', 'async' ) == 'async' ) ? 'Async' : 'Defer';
|
32 |
+
?>
|
33 |
+
<table class="form-table" width="100%" cellpadding="10">
|
34 |
+
<tr>
|
35 |
+
<td scope="row" align="center" style="vertical-align: top !important;"><img src="<?php echo AJ_PLUGIN_URL; ?>images/finger_point_out_punch_hole_400_clr_17860.png" title="Most Recent GTmetrix Results" alt="Most Recent GTmetrix Results" class="aj_step_img"></td>
|
36 |
+
<td scope="row" align="left">
|
37 |
+
<h3><?php echo AJ_TITLE; ?></h3>
|
38 |
+
<ul>
|
39 |
+
<li><strong><?php _e('Status','asyncjs'); ?>:</strong> <?php echo $aj_enabled; ?></li>
|
40 |
+
<?php
|
41 |
+
if ( $aj_enabled == 'Enabled' ) {
|
42 |
+
?>
|
43 |
+
<li><strong><?php _e('Method','asyncjs'); ?>:</strong> <?php echo $aj_method; ?></li>
|
44 |
+
<li><strong><?php _e('jQuery','asyncjs'); ?>:</strong> <?php echo $aj_jquery; ?></li>
|
45 |
+
<li><strong><?php _e('Async Scripts','asyncjs'); ?>:</strong> <?php echo $aj_async; ?></li>
|
46 |
+
<li><strong><?php _e('Defer Scripts','asyncjs'); ?>:</strong> <?php echo $aj_defer; ?></li>
|
47 |
+
<li><strong><?php _e('Exclusions','asyncjs'); ?>:</strong>
|
48 |
+
<ul>
|
49 |
+
<li><strong><?php _e('Scripts','asyncjs'); ?>:</strong> <?php echo $aj_exclusions; ?></li>
|
50 |
+
<li><strong><?php _e('Plugins','asyncjs'); ?>:</strong> <?php echo implode( ',', $aj_plugin_exclusions ); ?></li>
|
51 |
+
<li><strong><?php _e('Themes','asyncjs'); ?>:</strong> <?php echo implode( ',', $aj_theme_exclusions ); ?></li>
|
52 |
+
</ul>
|
53 |
+
</li>
|
54 |
+
<?php
|
55 |
+
if ( is_plugin_active( 'autoptimize/autoptimize.php' ) ) {
|
56 |
+
?>
|
57 |
+
<li><strong><?php _e('Autoptimize Status','asyncjs'); ?>:</strong> <?php echo $aj_autoptimize_enabled; ?></li>
|
58 |
+
<?php
|
59 |
+
if ( $aj_autoptimize_enabled == 'Enabled' ) {
|
60 |
+
?>
|
61 |
+
<li><strong><?php _e('Autoptimize Method','asyncjs'); ?>:</strong> <?php echo $aj_autoptimize_method; ?></li>
|
62 |
+
<?php
|
63 |
+
}
|
64 |
+
} else {
|
65 |
+
?>
|
66 |
+
<li><?php _e('Autoptimize not installed or activated.','asyncjs'); ?></li>
|
67 |
+
<?php
|
68 |
+
}
|
69 |
+
}
|
70 |
+
?>
|
71 |
+
</ul>
|
72 |
+
<hr />
|
73 |
+
<h3><?php _e('Latest GTmetrix Results','asyncjs'); ?></h3>
|
74 |
+
<?php
|
75 |
+
$aj_gtmetrix_results = get_option( 'aj_gtmetrix_results', array() );
|
76 |
+
if ( isset( $aj_gtmetrix_results['latest'] ) ) {
|
77 |
+
$latest = $aj_gtmetrix_results['latest'];
|
78 |
+
$screenshot = $latest['screenshot'];
|
79 |
+
$pagespeed = $latest['results']['pagespeed_score'];
|
80 |
+
$yslow = $latest['results']['yslow_score'];
|
81 |
+
$pr = round( 255 * ( 1 - ( $pagespeed / 100 ) ), 0 );
|
82 |
+
$yr = round( 255 * ( 1 - ( $yslow / 100 ) ), 0 );
|
83 |
+
$pg = round( 255 * ( $pagespeed / 100 ), 0 );
|
84 |
+
$yg = round( 255 * ( $yslow / 100 ), 0 );
|
85 |
+
$pagespeed_style = ' style="color: rgb(' . $pr . ',' . $pg . ',0 )"';
|
86 |
+
$yslow_style = ' style="color: rgb(' . $yr . ',' . $yg . ',0 )"';
|
87 |
+
$flt = number_format( ( float )$latest['results']['fully_loaded_time'] / 1000, 2, '.', '' );
|
88 |
+
$tps = number_format( ( float )$latest['results']['page_bytes'] / 1024, 0, '.', '' );
|
89 |
+
$tps = ( $tps > 1024 ) ? number_format( ( float )$tps / 1024, 2, '.', '' ) . 'MB' : $tps . 'KB';
|
90 |
+
$requests = $latest['results']['page_elements'];
|
91 |
+
$report = $latest['results']['report_url'];
|
92 |
+
$report_url = '<a href="' . $report . '" target="_blank">' . $report . '</a>';
|
93 |
+
?>
|
94 |
+
<p id="aj_latest_please_wait"><img src="<?php echo AJ_PLUGIN_URL; ?>images/loading.gif" title="<?php _e('Please Wait','asyncjs'); ?>" alt="<?php _e('Please Wait','asyncjs'); ?>" class="aj_step_img"></p>
|
95 |
+
<table id="aj_latest_gtmetrix_results" class="form-table aj-steps-table" width="100%" cellpadding="10">
|
96 |
+
<tr>
|
97 |
+
<td scope="row" align="center"><img src="data:image/jpeg;base64,<?php echo $screenshot; ?>" class="aj_latest_screenshot aj_gtmetrix_screenshot">
|
98 |
+
<td scope="row" align="center">
|
99 |
+
<h3><?php _e('PageSpeed Score','asyncjs'); ?></h3>
|
100 |
+
<span class="aj_latest_pagespeed aj_gtmetrix_result"<?php echo $pagespeed_style; ?>><?php echo $pagespeed; ?>%</span>
|
101 |
+
</td>
|
102 |
+
<td scope="row" align="center">
|
103 |
+
<h3><?php _e('YSlow Score','asyncjs'); ?></h3>
|
104 |
+
<span class="aj_latest_yslow aj_gtmetrix_result"<?php echo $yslow_style; ?>><?php echo $yslow; ?>%</span>
|
105 |
+
</td>
|
106 |
+
<td scope="row" align="center">
|
107 |
+
<h3><?php _e('Fully Loaded Time','asyncjs'); ?></h3>
|
108 |
+
<span class="aj_latest_flt aj_gtmetrix_result"><?php echo $flt; ?>s</span>
|
109 |
+
</td>
|
110 |
+
<td scope="row" align="center">
|
111 |
+
<h3><?php _e('Total Page Size','asyncjs'); ?></h3>
|
112 |
+
<span class="aj_latest_tps aj_gtmetrix_result"><?php echo $tps; ?></span>
|
113 |
+
</td>
|
114 |
+
<td scope="row" align="center">
|
115 |
+
<h3><?php _e('Requests','asyncjs'); ?></h3>
|
116 |
+
<span class="aj_latest_requests aj_gtmetrix_result"><?php echo $requests; ?></span>
|
117 |
+
</td>
|
118 |
+
</tr>
|
119 |
+
<tr><td scope="row" align="left" colspan="6"><?php _e('See full report:','asyncjs'); ?> <span class="aj_latest_report"><?php echo $report_url; ?></span></td></tr>
|
120 |
+
</table>
|
121 |
+
<hr />
|
122 |
+
<?php
|
123 |
+
} else {
|
124 |
+
?>
|
125 |
+
<table id="aj_latest_gtmetrix_results" class="form-table aj-steps-table" width="100%" cellpadding="10" style="display: none;">
|
126 |
+
<tr>
|
127 |
+
<td scope="row" align="center"><img src="" class="aj_latest_screenshot aj_gtmetrix_screenshot">
|
128 |
+
<td scope="row" align="center">
|
129 |
+
<h3><?php _e('PageSpeed Score','asyncjs'); ?></h3>
|
130 |
+
<span class="aj_latest_pagespeed aj_gtmetrix_result"></span>
|
131 |
+
</td>
|
132 |
+
<td scope="row" align="center">
|
133 |
+
<h3><?php _e('YSlow Score','asyncjs'); ?></h3>
|
134 |
+
<span class="aj_latest_yslow aj_gtmetrix_result"></span>
|
135 |
+
</td>
|
136 |
+
<td scope="row" align="center">
|
137 |
+
<h3><?php _e('Fully Loaded Time','asyncjs'); ?></h3>
|
138 |
+
<span class="aj_latest_flt aj_gtmetrix_result"></span>
|
139 |
+
</td>
|
140 |
+
<td scope="row" align="center">
|
141 |
+
<h3><?php _e('Total Page Size','asyncjs'); ?></h3>
|
142 |
+
<span class="aj_latest_tps aj_gtmetrix_result"></span>
|
143 |
+
</td>
|
144 |
+
<td scope="row" align="center">
|
145 |
+
<h3><?php _e('Requests','asyncjs'); ?></h3>
|
146 |
+
<span class="aj_latest_requests aj_gtmetrix_result"></span>
|
147 |
+
</td>
|
148 |
+
</tr>
|
149 |
+
<tr><td scope="row" align="center" colspan="6"><?php _e('See full report:','asyncjs'); ?> <span class="aj_latest_report"></span></td></tr>
|
150 |
+
</table>
|
151 |
+
<hr />
|
152 |
+
<?php
|
153 |
+
}
|
154 |
+
?>
|
155 |
+
<p><?php _e('Please click on the button below to generate a new GTmetrix Report.','asyncjs'); ?></p>
|
156 |
+
<p><?php _e('<strong>Please Note:</strong> By clicking the button below you acknowledge that you understand that one (1) GTmetrix API credit will be used.','asyncjs'); ?></p>
|
157 |
+
<p><button data-id="aj_gtmetrix_test" class="aj_steps_button"><?php _e('Run GTmetrix Test','asyncjs'); ?></button></p>
|
158 |
+
<h3><?php _e('GTmetrix API Key','asyncjs'); ?></h3>
|
159 |
+
<p><?php _e("If you haven't already done so, grab an API Key from GTmetrix so that Async JavaScript can obtain your PageSpeed / YSlow results. Here's how:",'asyncjs'); ?></p>
|
160 |
+
<ol>
|
161 |
+
<li><?php _e('Navigate to <a href="https://gtmetrix.com/api/" target="_blank">https://gtmetrix.com/api/</a> (link opens in a new tab)','asyncjs'); ?></li>
|
162 |
+
<li><?php _e("If you do not already have an account with GTmetrix, go ahead and sign up (it's FREE!).",'asyncjs'); ?></li>
|
163 |
+
<li><?php _e('Log in to your GTmetrix account.','asyncjs'); ?></li>
|
164 |
+
<li><?php _e("If you haven't yet generated your API Key, click on <strong>Generate API Key</strong>",'asyncjs'); ?></li>
|
165 |
+
<li><?php _e('Copy your Username and API Key into the fields below:','asyncjs'); ?><br /><input type="text" id="aj_gtmetrix_username" value="<?php echo $aj_gtmetrix_username; ?>" placeholder="GTmetrix Username"><input type="text" id="aj_gtmetrix_api_key" value="<?php echo $aj_gtmetrix_api_key; ?>" placeholder="GTmetrix API Key"></li>
|
166 |
+
<li><?php _e('Select the desired server.','asyncjs'); ?><br />
|
167 |
+
<select id="aj_gtmetrix_server">
|
168 |
+
<?php
|
169 |
+
$gtmetrix_locations = array(
|
170 |
+
'Vancouver, Canada' => 1,
|
171 |
+
'London, United Kingdom' => 2,
|
172 |
+
'Sydney, Australia' => 3,
|
173 |
+
'Dallas, United States' => 4,
|
174 |
+
'Mumbai, India' => 5
|
175 |
+
);
|
176 |
+
foreach ( $gtmetrix_locations as $location => $value ) {
|
177 |
+
$selected = ( $aj_gtmetrix_server == $value ) ? ' selected="selected"' : '';
|
178 |
+
echo '<option value="' . $value . '"' . $selected . '>' . $location . '</option>';
|
179 |
+
}
|
180 |
+
?>
|
181 |
+
</select>
|
182 |
+
</li>
|
183 |
+
<li><?php _e('GTmetrix Credits Available:','asyncjs'); ?> <span class="aj_gtmetrix_credits"><?php echo $credits; ?></span></li>
|
184 |
+
</ol>
|
185 |
+
<hr />
|
186 |
+
<?php echo $this->hints_tips(); ?>
|
187 |
+
</td>
|
188 |
+
</tr>
|
189 |
+
</table>
|
190 |
+
<?php
|
asyncjsWizardScreens.php
ADDED
@@ -0,0 +1,319 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
+
exit; // Exit if accessed directly
|
4 |
+
}
|
5 |
+
|
6 |
+
/*
|
7 |
+
* this displays the wizard screen
|
8 |
+
* uses the AJAX functions
|
9 |
+
*/
|
10 |
+
|
11 |
+
$site_url = trailingslashit( get_site_url() );
|
12 |
+
$aj_gtmetrix_username = get_option( 'aj_gtmetrix_username', '' );
|
13 |
+
$aj_gtmetrix_api_key = get_option( 'aj_gtmetrix_api_key', '' );
|
14 |
+
$aj_gtmetrix_server = get_option( 'aj_gtmetrix_server', '' );
|
15 |
+
if ( $aj_gtmetrix_username != '' && $aj_gtmetrix_api_key != '' ) {
|
16 |
+
$test = new Services_WTF_Test();
|
17 |
+
$test->api_username( $aj_gtmetrix_username );
|
18 |
+
$test->api_password( $aj_gtmetrix_api_key );
|
19 |
+
$test->user_agent( AJ_UA );
|
20 |
+
$status = $test->status();
|
21 |
+
$credits = $status['api_credits'];
|
22 |
+
} else {
|
23 |
+
$credits = 'N/A';
|
24 |
+
}
|
25 |
+
?>
|
26 |
+
<table class="form-table" width="100%" cellpadding="10">
|
27 |
+
<tr id="aj_intro">
|
28 |
+
<td scope="row" align="center" style="vertical-align: top !important;"><img src="<?php echo AJ_PLUGIN_URL; ?>images/finger_point_out_punch_hole_400_clr_17860.png" title="<?php echo AJ_TITLE; ?>" alt="<?php echo AJ_TITLE; ?>" class="aj_step_img"></td>
|
29 |
+
<td scope="row" align="left" style="vertical-align: top !important;">
|
30 |
+
<h3><?php echo AJ_TITLE; ?></h3>
|
31 |
+
<?php echo $this->about_aj(); ?>
|
32 |
+
</td>
|
33 |
+
</tr>
|
34 |
+
<tr id="aj_step1">
|
35 |
+
<td scope="row" align="center" style="vertical-align: top !important;"><img src="<?php echo AJ_PLUGIN_URL; ?>images/number_one_break_hole_150_clr_18741.gif" title="Step 1" alt="GTmetrix API Key" class="aj_step_img"></td>
|
36 |
+
<td scope="row" align="left" style="vertical-align: top !important;">
|
37 |
+
<h3><?php _e('Step 1: GTmetrix API Key','asyncjs'); ?></h3>
|
38 |
+
<p><?php _e('<strong><em>Please Note:</em></strong> You do not have to use this Wizard. All settings can be changed under the','asyncjs'); ?> <a href="<?php echo menu_page_url( AJ_ADMIN_MENU_SLUG, false ) . '&tab=settings'; ?>"><?php _e('Settings','asyncjs'); ?></a> <?php _e('tab.','asyncjs'); ?></p>
|
39 |
+
<hr />
|
40 |
+
<p><?php _e("If you haven't already done so, grab an API Key from GTmetrix so that Async JavaScript can obtain your PageSpeed / YSlow results. Here's how:",'asyncjs'); ?></p>
|
41 |
+
<ol>
|
42 |
+
<li><?php _e('Navigate to ','asyncjs'); ?><a href="https://gtmetrix.com/api/" target="_blank">https://gtmetrix.com/api/</a> <?php _e('(link opens in a new tab)','asyncjs'); ?></li>
|
43 |
+
<li><?php _e("If you do not already have an account with GTmetrix, go ahead and sign up (it's FREE!).",'asyncjs'); ?></li>
|
44 |
+
<li><?php _e('Log in to your GTmetrix account.','asyncjs'); ?></li>
|
45 |
+
<li><?php _e("If you haven't yet generated your API Key, click on <strong>Generate API Key</strong>",'asyncjs'); ?></li>
|
46 |
+
<li><?php _e('Copy your Username and API Key into the fields below:','asyncjs'); ?><br /><input type="text" id="aj_gtmetrix_username" value="<?php echo $aj_gtmetrix_username; ?>" placeholder="GTmetrix Username"><input type="text" id="aj_gtmetrix_api_key" value="<?php echo $aj_gtmetrix_api_key; ?>" placeholder="GTmetrix API Key"></li>
|
47 |
+
<li><?php _e('Select the desired server.','asyncjs'); ?><br />
|
48 |
+
<select id="aj_gtmetrix_server">
|
49 |
+
<?php
|
50 |
+
$gtmetrix_locations = array(
|
51 |
+
'Vancouver, Canada' => 1,
|
52 |
+
'London, United Kingdom' => 2,
|
53 |
+
'Sydney, Australia' => 3,
|
54 |
+
'Dallas, United States' => 4,
|
55 |
+
'Mumbai, India' => 5
|
56 |
+
);
|
57 |
+
foreach ( $gtmetrix_locations as $location => $value ) {
|
58 |
+
$selected = ( $aj_gtmetrix_server == $value ) ? ' selected="selected"' : '';
|
59 |
+
echo '<option value="' . $value . '"' . $selected . '>' . $location . '</option>';
|
60 |
+
}
|
61 |
+
?>
|
62 |
+
</select>
|
63 |
+
</li>
|
64 |
+
<li><?php _e('GTmetrix Credits Available: ','asyncjs'); ?><span class="aj_gtmetrix_credits"><?php echo $credits; ?></span></li>
|
65 |
+
</ol>
|
66 |
+
<p><?php _e('<strong>Please Note:</strong> By clicking the button below you acknowledge that you understand that five (5) GTmetrix API credits will be used.','asyncjs'); ?></p>
|
67 |
+
<p><button data-id="aj_step2" class="aj_steps_button"><?php _e('Proceed to Step 2','asyncjs'); ?></button></p>
|
68 |
+
</td>
|
69 |
+
</tr>
|
70 |
+
<tr id="aj_step2" class="aj_steps_hidden">
|
71 |
+
<td scope="row" align="center"><img src="<?php echo AJ_PLUGIN_URL; ?>images/number_two_break_hole_150_clr_18753.gif" title="Step 2" alt="Initial Test Results" class="aj_step_img"></td>
|
72 |
+
<td scope="row" align="left">
|
73 |
+
<h3><?php _e('Step 2: Initial Test Results','asyncjs'); ?></h3>
|
74 |
+
<p><?php echo AJ_TITLE; ?> <?php _e('will now query GTmetrix and retrieve your sites PageSpeed and YSlow scores.','asyncjs'); ?></p>
|
75 |
+
<p id="aj_step2_please_wait"><img src="<?php echo AJ_PLUGIN_URL; ?>images/loading.gif" title="<?php _e('Please Wait','asyncjs');?>" alt="<?php _e('Please Wait','asyncjs');?>" class="aj_step_img"></p>
|
76 |
+
<table id="aj_step2_gtmetrix_results" class="form-table aj-steps-table" width="100%" cellpadding="10">
|
77 |
+
<tr>
|
78 |
+
<td scope="row" align="center"><img src="" class="aj_step2_screenshot aj_gtmetrix_screenshot">
|
79 |
+
<td scope="row" align="center">
|
80 |
+
<h3><?php _e('PageSpeed Score','asyncjs'); ?></h3>
|
81 |
+
<span class="aj_step2_pagespeed aj_gtmetrix_result"></span>
|
82 |
+
</td>
|
83 |
+
<td scope="row" align="center">
|
84 |
+
<h3><?php _e('YSlow Score','asyncjs'); ?></h3>
|
85 |
+
<span class="aj_step2_yslow aj_gtmetrix_result"></span>
|
86 |
+
</td>
|
87 |
+
<td scope="row" align="center">
|
88 |
+
<h3><?php _e('Fully Loaded Time','asyncjs'); ?></h3>
|
89 |
+
<span class="aj_step2_flt aj_gtmetrix_result"></span>
|
90 |
+
</td>
|
91 |
+
<td scope="row" align="center">
|
92 |
+
<h3><?php _e('Total Page Size','asyncjs'); ?></h3>
|
93 |
+
<span class="aj_step2_tps aj_gtmetrix_result"></span>
|
94 |
+
</td>
|
95 |
+
<td scope="row" align="center">
|
96 |
+
<h3><?php _e('Requests','asyncjs'); ?></h3>
|
97 |
+
<span class="aj_step2_requests aj_gtmetrix_result"></span>
|
98 |
+
</td>
|
99 |
+
</tr>
|
100 |
+
<tr><td scope="row" align="left" colspan="6"><?php _e('See full report:','asyncjs'); ?> <span class="aj_step2_report"></span></td></tr>
|
101 |
+
<tr><td scope="row" align="left" colspan="6"><?php _e('Simulate','asyncjs'); ?> <span class="aj_step2_gtmetrix"></span>: <a href="" class="aj_step2_url" target="_blank"></a></tr>
|
102 |
+
<p></p>
|
103 |
+
</table>
|
104 |
+
</td>
|
105 |
+
</tr>
|
106 |
+
<tr id="aj_step2b" class="aj_steps_hidden">
|
107 |
+
<td scope="row" align="center"></td>
|
108 |
+
<td scope="row" align="left">
|
109 |
+
<h3><?php _e('Testing: Async','asyncjs');?></h3>
|
110 |
+
<p><?php echo AJ_TITLE; ?> <?php _e("will now query GTmetrix and retrieve your sites PageSpeed and YSlow scores whilst simulating the JavaScript 'async' method.",'asyncjs'); ?></p>
|
111 |
+
<p id="aj_step2b_please_wait"><img src="<?php echo AJ_PLUGIN_URL; ?>images/loading.gif" title="<?php _e('Please Wait','asyncjs');?>" alt="<?php _e('Please Wait','asyncjs');?>" class="aj_step_img"></p>
|
112 |
+
<table id="aj_step2b_gtmetrix_results" class="form-table aj-steps-table" width="100%" cellpadding="10">
|
113 |
+
<tr>
|
114 |
+
<td scope="row" align="center"><img src="" class="aj_step2b_screenshot aj_gtmetrix_screenshot">
|
115 |
+
<td scope="row" align="center">
|
116 |
+
<h3><?php _e('PageSpeed Score','asyncjs');?></h3>
|
117 |
+
<span class="aj_step2b_pagespeed aj_gtmetrix_result"></span>
|
118 |
+
</td>
|
119 |
+
<td scope="row" align="center">
|
120 |
+
<h3><?php _e('YSlow Score','asyncjs');?></h3>
|
121 |
+
<span class="aj_step2b_yslow aj_gtmetrix_result"></span>
|
122 |
+
</td>
|
123 |
+
<td scope="row" align="center">
|
124 |
+
<h3><?php _e('Fully Loaded Time','asyncjs');?></h3>
|
125 |
+
<span class="aj_step2b_flt aj_gtmetrix_result"></span>
|
126 |
+
</td>
|
127 |
+
<td scope="row" align="center">
|
128 |
+
<h3><?php _e('Total Page Size','asyncjs');?></h3>
|
129 |
+
<span class="aj_step2b_tps aj_gtmetrix_result"></span>
|
130 |
+
</td>
|
131 |
+
<td scope="row" align="center">
|
132 |
+
<h3><?php _e('Requests','asyncjs');?></h3>
|
133 |
+
<span class="aj_step2b_requests aj_gtmetrix_result"></span>
|
134 |
+
</td>
|
135 |
+
</tr>
|
136 |
+
<tr><td scope="row" align="left" colspan="6"><?php _e('See full report:','asyncjs');?> <span class="aj_step2b_report"></span></td></tr>
|
137 |
+
<tr><td scope="row" align="left" colspan="6"><?php _e('Simulate','asyncjs');?> <span class="aj_step2b_gtmetrix"></span>: <a href="" class="aj_step2b_url" target="_blank"></a></tr>
|
138 |
+
</table>
|
139 |
+
</td>
|
140 |
+
</tr>
|
141 |
+
<tr id="aj_step2c" class="aj_steps_hidden">
|
142 |
+
<td scope="row" align="center"></td>
|
143 |
+
<td scope="row" align="left">
|
144 |
+
<h3><?php _e('Testing: Defer','asyncjs');?></h3>
|
145 |
+
<p><?php echo AJ_TITLE; ?> <?php _e("will now query GTmetrix and retrieve your sites PageSpeed and YSlow scores whilst simulating the JavaScript 'defer' method.",'asyncjs');?></p>
|
146 |
+
<p id="aj_step2c_please_wait"><img src="<?php echo AJ_PLUGIN_URL; ?>images/loading.gif" title="<?php _e('Please Wait','asyncjs');?>" alt="<?php _e('Please Wait','asyncjs');?>" class="aj_step_img"></p>
|
147 |
+
<table id="aj_step2c_gtmetrix_results" class="form-table aj-steps-table" width="100%" cellpadding="10">
|
148 |
+
<tr>
|
149 |
+
<td scope="row" align="center"><img src="" class="aj_step2c_screenshot aj_gtmetrix_screenshot">
|
150 |
+
<td scope="row" align="center">
|
151 |
+
<h3><?php _e('PageSpeed Score','asyncjs');?></h3>
|
152 |
+
<span class="aj_step2c_pagespeed aj_gtmetrix_result"></span>
|
153 |
+
</td>
|
154 |
+
<td scope="row" align="center">
|
155 |
+
<h3><?php _e('YSlow Score','asyncjs');?></h3>
|
156 |
+
<span class="aj_step2c_yslow aj_gtmetrix_result"></span>
|
157 |
+
</td>
|
158 |
+
<td scope="row" align="center">
|
159 |
+
<h3><?php _e('Fully Loaded Time','asyncjs');?></h3>
|
160 |
+
<span class="aj_step2c_flt aj_gtmetrix_result"></span>
|
161 |
+
</td>
|
162 |
+
<td scope="row" align="center">
|
163 |
+
<h3><?php _e('Total Page Size','asyncjs');?></h3>
|
164 |
+
<span class="aj_step2c_tps aj_gtmetrix_result"></span>
|
165 |
+
</td>
|
166 |
+
<td scope="row" align="center">
|
167 |
+
<h3><?php _e('Requests','asyncjs');?></h3>
|
168 |
+
<span class="aj_step2c_requests aj_gtmetrix_result"></span>
|
169 |
+
</td>
|
170 |
+
</tr>
|
171 |
+
<tr><td scope="row" align="left" colspan="6"><?php _e('See full report:','asyncjs');?> <span class="aj_step2c_report"></span></td></tr>
|
172 |
+
<tr><td scope="row" align="left" colspan="6"><?php _e('Simulate','asyncjs');?> <span class="aj_step2c_gtmetrix"></span>: <a href="" class="aj_step2c_url" target="_blank"></a></tr>
|
173 |
+
</table>
|
174 |
+
</td>
|
175 |
+
</tr>
|
176 |
+
<tr id="aj_step2d" class="aj_steps_hidden">
|
177 |
+
<td scope="row" align="center"></td>
|
178 |
+
<td scope="row" align="left">
|
179 |
+
<h3><?php _e('Testing: Async (jQuery excluded)','asyncjs');?></h3>
|
180 |
+
<p><?php echo AJ_TITLE; ?> <?php _e("will now query GTmetrix and retrieve your sites PageSpeed and YSlow scores whilst simulating the JavaScript 'async' method but excluding jQuery.",'asyncjs');?></p>
|
181 |
+
<p id="aj_step2d_please_wait"><img src="<?php echo AJ_PLUGIN_URL; ?>images/loading.gif" title="<?php _e('Please Wait','asyncjs');?>" alt="<?php _e('Please Wait','asyncjs');?>" class="aj_step_img"></p>
|
182 |
+
<table id="aj_step2d_gtmetrix_results" class="form-table aj-steps-table" width="100%" cellpadding="10">
|
183 |
+
<tr>
|
184 |
+
<td scope="row" align="center"><img src="" class="aj_step2d_screenshot aj_gtmetrix_screenshot">
|
185 |
+
<td scope="row" align="center">
|
186 |
+
<h3><?php _e('PageSpeed Score','asyncjs');?></h3>
|
187 |
+
<span class="aj_step2d_pagespeed aj_gtmetrix_result"></span>
|
188 |
+
</td>
|
189 |
+
<td scope="row" align="center">
|
190 |
+
<h3><?php _e('YSlow Score','asyncjs');?></h3>
|
191 |
+
<span class="aj_step2d_yslow aj_gtmetrix_result"></span>
|
192 |
+
</td>
|
193 |
+
<td scope="row" align="center">
|
194 |
+
<h3><?php _e('Fully Loaded Time','asyncjs');?></h3>
|
195 |
+
<span class="aj_step2d_flt aj_gtmetrix_result"></span>
|
196 |
+
</td>
|
197 |
+
<td scope="row" align="center">
|
198 |
+
<h3><?php _e('Total Page Size','asyncjs');?></h3>
|
199 |
+
<span class="aj_step2d_tps aj_gtmetrix_result"></span>
|
200 |
+
</td>
|
201 |
+
<td scope="row" align="center">
|
202 |
+
<h3><?php _e('Requests','asyncjs');?></h3>
|
203 |
+
<span class="aj_step2d_requests aj_gtmetrix_result"></span>
|
204 |
+
</td>
|
205 |
+
</tr>
|
206 |
+
<tr><td scope="row" align="left" colspan="6"><?php _e('See full report:','asyncjs');?> <span class="aj_step2d_report"></span></td></tr>
|
207 |
+
<tr><td scope="row" align="left" colspan="6"><?php _e('Simulate','asyncjs');?> <span class="aj_step2d_gtmetrix"></span>: <a href="" class="aj_step2d_url" target="_blank"></a></tr>
|
208 |
+
</table>
|
209 |
+
</td>
|
210 |
+
</tr>
|
211 |
+
<tr id="aj_step2e" class="aj_steps_hidden">
|
212 |
+
<td scope="row" align="center"></td>
|
213 |
+
<td scope="row" align="left">
|
214 |
+
<h3><?php _e('Testing: Defer (jQuery excluded)','asyncjs');?></h3>
|
215 |
+
<p><?php echo AJ_TITLE; ?> <?php _e("will now query GTmetrix and retrieve your sites PageSpeed and YSlow scores whilst simulating the JavaScript 'defer' method but excluding jQuery.",'asyncjs');?></p>
|
216 |
+
<p id="aj_step2e_please_wait"><img src="<?php echo AJ_PLUGIN_URL; ?>images/loading.gif" title="<?php _e('Please Wait','asyncjs');?>" alt="<?php _e('Please Wait','asyncjs');?>" class="aj_step_img"></p>
|
217 |
+
<table id="aj_step2e_gtmetrix_results" class="form-table aj-steps-table" width="100%" cellpadding="10">
|
218 |
+
<tr>
|
219 |
+
<td scope="row" align="center"><img src="" class="aj_step2e_screenshot aj_gtmetrix_screenshot">
|
220 |
+
<td scope="row" align="center">
|
221 |
+
<h3><?php _e('PageSpeed Score','asyncjs');?></h3>
|
222 |
+
<span class="aj_step2e_pagespeed aj_gtmetrix_result"></span>
|
223 |
+
</td>
|
224 |
+
<td scope="row" align="center">
|
225 |
+
<h3><?php _e('YSlow Score','asyncjs');?></h3>
|
226 |
+
<span class="aj_step2e_yslow aj_gtmetrix_result"></span>
|
227 |
+
</td>
|
228 |
+
<td scope="row" align="center">
|
229 |
+
<h3><?php _e('Fully Loaded Time','asyncjs');?></h3>
|
230 |
+
<span class="aj_step2e_flt aj_gtmetrix_result"></span>
|
231 |
+
</td>
|
232 |
+
<td scope="row" align="center">
|
233 |
+
<h3><?php _e('Total Page Size','asyncjs');?></h3>
|
234 |
+
<span class="aj_step2e_tps aj_gtmetrix_result"></span>
|
235 |
+
</td>
|
236 |
+
<td scope="row" align="center">
|
237 |
+
<h3><?php _e('Requests','asyncjs');?></h3>
|
238 |
+
<span class="aj_step2e_requests aj_gtmetrix_result"></span>
|
239 |
+
</td>
|
240 |
+
</tr>
|
241 |
+
<tr><td scope="row" align="left" colspan="6"><?php _e('See full report:','asyncjs');?> <span class="aj_step2e_report"></span></td></tr>
|
242 |
+
<tr><td scope="row" align="left" colspan="6"><?php _e('Simulate','asyncjs');?> <span class="aj_step2e_gtmetrix"></span>: <a href="" class="aj_step2e_url" target="_blank"></a></tr>
|
243 |
+
</table>
|
244 |
+
</td>
|
245 |
+
</tr>
|
246 |
+
<tr id="aj_step_results" class="aj_steps_hidden">
|
247 |
+
<td scope="row" align="center" style="vertical-align: top !important;"><img src="<?php echo AJ_PLUGIN_URL; ?>images/number_three_break_hole_150_clr_18837.gif" title="Results & Recommendations" alt="Results & Recommendations" class="aj_step_img"></td>
|
248 |
+
<td scope="row" align="left">
|
249 |
+
<h3><?php _e('Step 3: Results & Recommendations','asyncjs');?></h3>
|
250 |
+
<p><?php echo AJ_TITLE; ?> <?php _e('has finished testing your site with the most common configuration options.','asyncjs');?></p>
|
251 |
+
<p><?php _e('Based on the tests Async JavaScript has determined that <span class="aj_gtmetrix_config"></span> has resuled in <span id="aj_gtmetrix_inde_pagespeed"></span> in PageSpeed from <span id="aj_gtmetrix_baseline_pagespeed"></span> to <span id="aj_gtmetrix_best_pagespeed"></span> and <span id="aj_gtmetrix_inde_yslow"></span> in YSlow from <span id="aj_gtmetrix_baseline_yslow"></span> to <span id="aj_gtmetrix_best_yslow"></span>, with a Fully Loaded time of','asyncjs');?> <span id="aj_gtmetrix_best_fullyloaded"></span>.</p>
|
252 |
+
<p><?php _e('Before applying these settings it is important to check your site is still functioning correctly. Click the link below to open your site in a new tab / window to simulate the <?php echo AJ_TITLE; ?> settings and check that everything is working, and also be sure to check the console for any JavaScript errors (see <a href="https://codex.wordpress.org/Using_Your_Browser_to_Diagnose_JavaScript_Errors" target="_blank">Using Your Browser to Diagnose JavaScript Errors</a>)','asyncjs');?></p>
|
253 |
+
<ul>
|
254 |
+
<li><?php _e('Simulate','asyncjs');?> <span class="aj_gtmetrix_config"></span>: <a href="" id="aj_gtmetrix_best_url" target="_blank"></a></li>
|
255 |
+
</ul>
|
256 |
+
<p><?php _e('Once you have simulated','asyncjs');?> <span class="aj_gtmetrix_config"></span> <?php _e('click on the button below to continue.','asyncjs');?></p>
|
257 |
+
<p><button data-id="aj_step4" class="aj_steps_button"><?php _e('Proceed to Step 4','asyncjs');?></button></p>
|
258 |
+
</td>
|
259 |
+
</tr>
|
260 |
+
<tr id="aj_step4" class="aj_steps_hidden">
|
261 |
+
<td scope="row" align="center" style="vertical-align: top !important;"><img src="<?php echo AJ_PLUGIN_URL; ?>images/number_four_break_hole_150_clr_18840.gif" title="Apply Settings" alt="Apply Settings" class="aj_step_img"></td>
|
262 |
+
<td scope="row" align="left">
|
263 |
+
<h3><?php _e('Step 4: Apply Settings','asyncjs');?></h3>
|
264 |
+
<p><?php _e('Is your site still functioning properly and are there no JavaScript errors in the console?','asyncjs');?></p>
|
265 |
+
<p><input type="radio" name="aj_step4_check" value="y"> <?php _e('Yes','asyncjs');?> <input type="radio" name="aj_step4_check" value="n"> <?php _e('No','asyncjs');?></p>
|
266 |
+
<div id="aj_step4_y">
|
267 |
+
<p><?php _e('Great to hear! To apply these settings click the button below.','asyncjs');?></p>
|
268 |
+
<p><button data-id="aj_apply_settings" class="aj_steps_button"><?php _e('Apply Settings','asyncjs');?></button></p>
|
269 |
+
</div>
|
270 |
+
<div id="aj_step4_n">
|
271 |
+
<p><?php _e('Ok, so you have run the simulation on <span class="aj_gtmetrix_config"></span> and although there has been an improvement in reported performance, the simulation shows that something is not right with your site.','asyncjs');?></p>
|
272 |
+
<div id="aj_step4_jquery_excluded">
|
273 |
+
<p><?php _e('In most cases the issue being experienced relates to jQuery (usually due to inline JavaScript which relies on jQuery) and the solution is to exclude jQuery. However, in this simulation jQuery has already been exculded. As a result a different configuration may work better with a marginal sacrifice in site speed improvement.','asyncjs');?></p>
|
274 |
+
<p><?php _e('Below are links that can be used to run simulations on each of the basic configurations. Click on each of the links and check the functionality of your site as well as the console for errors.','asyncjs');?></p>
|
275 |
+
<ul>
|
276 |
+
<li><?php _e('Simulate','asyncjs');?> <span class="aj_step2b_gtmetrix"></span>: <a href="" class="aj_step2b_url" target="_blank"></a></li>
|
277 |
+
<li><?php _e('Simulate','asyncjs');?> <span class="aj_step2c_gtmetrix"></span>: <a href="" class="aj_step2c_url" target="_blank"></a></li>
|
278 |
+
<li><?php _e('Simulate','asyncjs');?> <span class="aj_step2d_gtmetrix"></span>: <a href="" class="aj_step2d_url" target="_blank"></a></li>
|
279 |
+
<li><?php _e('Simulate','asyncjs');?> <span class="aj_step2e_gtmetrix"></span>: <a href="" class="aj_step2e_url" target="_blank"></a></li>
|
280 |
+
</ul>
|
281 |
+
<p><?php _e('Click one of the buttons below to apply these settings or click the Settings button to go to the settings page for manual configuration.','asyncjs');?></p>
|
282 |
+
<p>
|
283 |
+
<button data-id="aj_step2b_apply" class="aj_steps_button"><?php _e('Apply','asyncjs');?> <span class="aj_step2b_gtmetrix"></button>
|
284 |
+
<button data-id="aj_step2c_apply" class="aj_steps_button"><?php _e('Apply','asyncjs');?> <span class="aj_step2c_gtmetrix"></button>
|
285 |
+
<button data-id="aj_step2d_apply" class="aj_steps_button"><?php _e('Apply','asyncjs');?> <span class="aj_step2d_gtmetrix"></button>
|
286 |
+
<button data-id="aj_step2e_apply" class="aj_steps_button"><?php _e('Apply','asyncjs');?> <span class="aj_step2e_gtmetrix"></button>
|
287 |
+
</p>
|
288 |
+
<p>
|
289 |
+
<button data-id="aj_goto_settings" class="aj_steps_button"><?php _e('Settings','asyncjs');?></button>
|
290 |
+
</p>
|
291 |
+
</div>
|
292 |
+
<div id="aj_step4_jquery_not_excluded">
|
293 |
+
<p><?php _e('In most cases the issue being experienced relates to jQuery (usually due to inline JavaScript which relies on jQuery) and the solution is to exclude jQuery.','asyncjs');?></p>
|
294 |
+
<p><?php _e('Below are links that can be used to run simulations on each of the configurations with jQuery excluded. Click on each of the links and check the functionality of your site as well as the console for errors.','asyncjs');?></p>
|
295 |
+
<ul>
|
296 |
+
<li><?php _e('Simulate','asyncjs');?> <span class="aj_step2d_gtmetrix"></span>: <a href="" class="aj_step2d_url" target="_blank"></a></li>
|
297 |
+
<li><?php _e('Simulate','asyncjs');?> <span class="aj_step2e_gtmetrix"></span>: <a href="" class="aj_step2e_url" target="_blank"></a></li>
|
298 |
+
</ul>
|
299 |
+
<p><?php _e('Click one of the buttons below to apply these settings or click the Settings button to go to the settings page for manual configuration.','asyncjs');?></p>
|
300 |
+
<p>
|
301 |
+
<button data-id="aj_step2d_apply" class="aj_steps_button"><?php _e('Apply','asyncjs');?> <span class="aj_step2d_gtmetrix"></button>
|
302 |
+
<button data-id="aj_step2e_apply" class="aj_steps_button"><?php _e('Apply','asyncjs');?> <span class="aj_step2e_gtmetrix"></button>
|
303 |
+
</p>
|
304 |
+
<p>
|
305 |
+
<button data-id="aj_goto_settings" class="aj_steps_button"><?php _e('Settings','asyncjs');?></button>
|
306 |
+
</p>
|
307 |
+
</div>
|
308 |
+
</div>
|
309 |
+
</td>
|
310 |
+
</tr>
|
311 |
+
<tr id="aj_step5" class="aj_steps_hidden">
|
312 |
+
<td scope="row" align="center" style="vertical-align: top !important;"><img src="<?php echo AJ_PLUGIN_URL; ?>images/number_five_break_hole_150_clr_18842.gif" title="Further Hints & Tips" alt="Further Hints & Tips" class="aj_step_img"></td>
|
313 |
+
<td scope="row" align="left">
|
314 |
+
<?php echo $this->hints_tips(); ?>
|
315 |
+
<p><button data-id="aj_goto_settings" class="aj_steps_button">Settings</button></p>
|
316 |
+
</td>
|
317 |
+
</tr>
|
318 |
+
</table>
|
319 |
+
<?php
|
css/admin.css
CHANGED
@@ -1,89 +1 @@
|
|
1 |
-
.aj_method,
|
2 |
-
.aj_steps_hidden,
|
3 |
-
#aj_step2_gtmetrix_results,
|
4 |
-
#aj_step2b_gtmetrix_results,
|
5 |
-
#aj_step2c_gtmetrix_results,
|
6 |
-
#aj_step2d_gtmetrix_results,
|
7 |
-
#aj_step2e_gtmetrix_results,
|
8 |
-
#aj_latest_please_wait,
|
9 |
-
#aj_step4_y,
|
10 |
-
#aj_step4_n,
|
11 |
-
#aj_notification {
|
12 |
-
display:none;
|
13 |
-
}
|
14 |
-
#aj_step2_gtmetrix_results td,
|
15 |
-
#aj_step2b_gtmetrix_results td,
|
16 |
-
#aj_step2c_gtmetrix_results td,
|
17 |
-
#aj_step2d_gtmetrix_results td,
|
18 |
-
#aj_step2e_gtmetrix_results td {
|
19 |
-
vertical-align: top !important;
|
20 |
-
text-align: center !important;
|
21 |
-
}
|
22 |
-
.aj_gtmetrix_result {
|
23 |
-
font-size: 48px !important;
|
24 |
-
}
|
25 |
-
.aj_gtmetrix_screenshot,
|
26 |
-
#aj_notification {
|
27 |
-
-webkit-box-shadow: 0px 0px 15px 5px rgba(0,0,0,0.75);
|
28 |
-
-moz-box-shadow: 0px 0px 15px 5px rgba(0,0,0,0.75);
|
29 |
-
box-shadow: 0px 0px 15px 5px rgba(0,0,0,0.75);
|
30 |
-
max-width:200px;
|
31 |
-
}
|
32 |
-
.aj_gtmetrix_screenshot_dashboard {
|
33 |
-
-webkit-box-shadow: 0px 0px 15px 5px rgba(0,0,0,0.75);
|
34 |
-
-moz-box-shadow: 0px 0px 15px 5px rgba(0,0,0,0.75);
|
35 |
-
box-shadow: 0px 0px 15px 5px rgba(0,0,0,0.75);
|
36 |
-
max-width:125px;
|
37 |
-
}
|
38 |
-
|
39 |
-
.aj-steps-table h3 {
|
40 |
-
height: 2em !important;
|
41 |
-
}
|
42 |
-
.aj_step_img {
|
43 |
-
max-width:150px;
|
44 |
-
}
|
45 |
-
.aj_field_error {
|
46 |
-
border:solid 1px #00ffff !important;
|
47 |
-
}
|
48 |
-
#aj_notification {
|
49 |
-
position:fixed;
|
50 |
-
top:50%;
|
51 |
-
left:40%;
|
52 |
-
width:20%;
|
53 |
-
z-index:105;
|
54 |
-
text-align:center;
|
55 |
-
font-weight:normal;
|
56 |
-
font-size:14px;
|
57 |
-
font-weight:bold;
|
58 |
-
color:white;
|
59 |
-
background-color:#FF7800;
|
60 |
-
padding:5px;
|
61 |
-
}
|
62 |
-
#aj_notification span.aj_dismiss {
|
63 |
-
border:2px solid #FFF;
|
64 |
-
padding:0 5px;
|
65 |
-
cursor:pointer;
|
66 |
-
float:right;
|
67 |
-
margin-right:10px;
|
68 |
-
}
|
69 |
-
#aj_notification a {
|
70 |
-
color:white;
|
71 |
-
text-decoration:none;
|
72 |
-
font-weight:bold
|
73 |
-
}
|
74 |
-
.aj ol {
|
75 |
-
list-style-type: decimal !important;
|
76 |
-
}
|
77 |
-
.aj ul {
|
78 |
-
list-style-type: circle !important;
|
79 |
-
}
|
80 |
-
.aj ol,
|
81 |
-
.aj ul {
|
82 |
-
margin-left: 2em !important;
|
83 |
-
}
|
84 |
-
.aj_plugin {
|
85 |
-
border: solid 1px #cccccc;
|
86 |
-
padding: 15px;
|
87 |
-
background-color: #f5f5dc;
|
88 |
-
margin-top: 15px;
|
89 |
-
}
|
90 |
position:fixed;
|
91 |
top:50%;
|
92 |
left:40%;
|
93 |
width:20%;
|
94 |
z-index:105;
|
95 |
text-align:center;
|
96 |
font-weight:normal;
|
97 |
font-size:14px;
|
98 |
font-weight:bold;
|
99 |
color:white;
|
100 |
background-color:#FF7800;
|
101 |
padding:5px;
|
102 |
border:2px solid #FFF;
|
103 |
padding:0 5px;
|
104 |
cursor:pointer;
|
105 |
float:right;
|
106 |
margin-right:10px;
|
107 |
color:white;
|
108 |
text-decoration:none;
|
109 |
font-weight:bold
|
110 |
padding: 15px;
|
111 |
background-color: #f5f5dc;
|
112 |
margin-top: 15px;
|
1 |
+
.aj_method,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
position:fixed;
|
3 |
top:50%;
|
4 |
left:40%;
|
5 |
width:20%;
|
6 |
z-index:105;
|
7 |
text-align:center;
|
8 |
font-weight:normal;
|
9 |
font-size:14px;
|
10 |
font-weight:bold;
|
11 |
color:white;
|
12 |
background-color:#FF7800;
|
13 |
padding:5px;
|
14 |
border:2px solid #FFF;
|
15 |
padding:0 5px;
|
16 |
cursor:pointer;
|
17 |
float:right;
|
18 |
margin-right:10px;
|
19 |
color:white;
|
20 |
text-decoration:none;
|
21 |
font-weight:bold
|
22 |
padding: 15px;
|
23 |
background-color: #f5f5dc;
|
24 |
margin-top: 15px;
|
css/admin.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
#aj_latest_please_wait,#aj_notification,#aj_step2_gtmetrix_results,#aj_step2b_gtmetrix_results,#aj_step2c_gtmetrix_results,#aj_step2d_gtmetrix_results,#aj_step2e_gtmetrix_results,#aj_step4_n,#aj_step4_y,.aj_method,.aj_steps_hidden{display:none}#aj_step2_gtmetrix_results td,#aj_step2b_gtmetrix_results td,#aj_step2c_gtmetrix_results td,#aj_step2d_gtmetrix_results td,#aj_step2e_gtmetrix_results td{vertical-align:top!important;text-align:center!important}.aj_gtmetrix_result{font-size:
|
1 |
+
#aj_latest_please_wait,#aj_notification,#aj_step2_gtmetrix_results,#aj_step2b_gtmetrix_results,#aj_step2c_gtmetrix_results,#aj_step2d_gtmetrix_results,#aj_step2e_gtmetrix_results,#aj_step4_n,#aj_step4_y,.aj_method,.aj_steps_hidden{display:none}#aj_step2_gtmetrix_results td,#aj_step2b_gtmetrix_results td,#aj_step2c_gtmetrix_results td,#aj_step2d_gtmetrix_results td,#aj_step2e_gtmetrix_results td{vertical-align:top!important;text-align:center!important}.aj_gtmetrix_result{font-size:2.5rem!important}#aj_notification,.aj_gtmetrix_screenshot{-webkit-box-shadow:0 0 15px 5px rgba(0,0,0,.75);-moz-box-shadow:0 0 15px 5px rgba(0,0,0,.75);box-shadow:0 0 15px 5px rgba(0,0,0,.75);max-width:200px}.aj_gtmetrix_screenshot_dashboard{-webkit-box-shadow:0 0 15px 5px rgba(0,0,0,.75);-moz-box-shadow:0 0 15px 5px rgba(0,0,0,.75);box-shadow:0 0 15px 5px rgba(0,0,0,.75);max-width:125px}.aj-steps-table h3{height:2em!important}.aj_step_img{max-width:150px}.aj_field_error{border:1px solid red!important}#aj_notification{position:fixed;top:50%;left:40%;width:20%;z-index:105;text-align:center;font-size:14px;font-weight:700;color:#fff;background-color:#FF7800;padding:5px}#aj_notification span.aj_dismiss{border:2px solid #FFF;padding:0 5px;cursor:pointer;float:right;margin-right:10px}#aj_notification a{color:#fff;text-decoration:none;font-weight:700}.aj ol{list-style-type:decimal!important}.aj ul{list-style-type:circle!important}.aj ol,.aj ul{margin-left:2em!important}.aj_plugin{border:1px solid #ccc;padding:15px;background-color:beige;margin-top:15px}
|
js/admin.js
CHANGED
@@ -1,306 +1 @@
|
|
1 |
-
function aj_step( theStep ) {
|
2 |
-
var aj_nonce = jQuery( '#aj_nonce' ).val();
|
3 |
-
var aj_gtmetrix_username = jQuery( '#aj_gtmetrix_username' ).val();
|
4 |
-
var aj_gtmetrix_api_key = jQuery( '#aj_gtmetrix_api_key' ).val();
|
5 |
-
var aj_gtmetrix_server = jQuery( '#aj_gtmetrix_server' ).val();
|
6 |
-
if ( theStep == 'aj_step_results' ) {
|
7 |
-
var data = {
|
8 |
-
'action': 'aj_steps',
|
9 |
-
'sub_action': theStep,
|
10 |
-
'site_url': aj_localize_admin.siteurl,
|
11 |
-
'aj_gtmetrix_username': aj_gtmetrix_username,
|
12 |
-
'aj_gtmetrix_api_key': aj_gtmetrix_api_key,
|
13 |
-
'aj_gtmetrix_server': aj_gtmetrix_server,
|
14 |
-
'security': aj_nonce
|
15 |
-
};
|
16 |
-
jQuery.post(aj_localize_admin.ajaxurl, data, function( response ) {
|
17 |
-
try {
|
18 |
-
response = jQuery.parseJSON( response );
|
19 |
-
if ( response.status !== false ) {
|
20 |
-
var baseline_pagespeed = response.baseline_pagespeed;
|
21 |
-
var baseline_yslow = response.baseline_yslow;
|
22 |
-
var pagespeed = response.results.pagespeed_score;
|
23 |
-
var yslow = response.results.yslow_score;
|
24 |
-
var aj_gtmetrix_config = response.name;
|
25 |
-
var flt = parseFloat( response.results.fully_loaded_time / 1000 ).toFixed( 2 );
|
26 |
-
var url = response.url;
|
27 |
-
jQuery( '.aj_gtmetrix_config' ).html( aj_gtmetrix_config );
|
28 |
-
if ( pagespeed > baseline_pagespeed ) {
|
29 |
-
jQuery( '#aj_gtmetrix_inde_pagespeed' ).html( 'an increase' );
|
30 |
-
} else if ( pagespeed < baseline_pagespeed ) {
|
31 |
-
jQuery( '#aj_gtmetrix_inde_pagespeed' ).html( 'a decrease' );
|
32 |
-
} else {
|
33 |
-
jQuery( '#aj_gtmetrix_inde_pagespeed' ).html( 'no change' );
|
34 |
-
}
|
35 |
-
if ( yslow > baseline_yslow ) {
|
36 |
-
jQuery( '#aj_gtmetrix_inde_yslow' ).html( 'an increase' );
|
37 |
-
} else if ( yslow < baseline_yslow ) {
|
38 |
-
jQuery( '#aj_gtmetrix_inde_yslow' ).html( 'a decrease' );
|
39 |
-
} else {
|
40 |
-
jQuery( '#aj_gtmetrix_inde_yslow' ).html( 'no change' );
|
41 |
-
}
|
42 |
-
jQuery( '#aj_gtmetrix_baseline_pagespeed' ).html( baseline_pagespeed + '%' );
|
43 |
-
jQuery( '#aj_gtmetrix_best_pagespeed' ).html( pagespeed + '%' );
|
44 |
-
jQuery( '#aj_gtmetrix_baseline_yslow' ).html( baseline_yslow + '%' );
|
45 |
-
jQuery( '#aj_gtmetrix_best_yslow' ).html( yslow + '%' );
|
46 |
-
jQuery( '#aj_gtmetrix_best_fullyloaded' ).html( flt + 's' );
|
47 |
-
jQuery( '#aj_gtmetrix_best_url' ).attr( 'href', url ).html( url );
|
48 |
-
if ( response.id == 'aj_step2b' || response.id == 'aj_step2c' ) {
|
49 |
-
jQuery( '#aj_step4_jquery_excluded' ).hide();
|
50 |
-
jQuery( '#aj_step4_jquery_not_excluded' ).show();
|
51 |
-
} else if ( response.id == 'aj_step2d' || response.id == 'aj_step2e' ) {
|
52 |
-
jQuery( '#aj_step4_jquery_excluded' ).show();
|
53 |
-
jQuery( '#aj_step4_jquery_not_excluded' ).hide();
|
54 |
-
}
|
55 |
-
jQuery( '.aj_gtmetrix_credits' ).html( response.credits );
|
56 |
-
jQuery( '#aj_step_results' ).show();
|
57 |
-
} else {
|
58 |
-
console.log(response);
|
59 |
-
}
|
60 |
-
}
|
61 |
-
catch( err ) {
|
62 |
-
console.log( err );
|
63 |
-
}
|
64 |
-
});
|
65 |
-
} else {
|
66 |
-
var data = {
|
67 |
-
'action': 'aj_steps',
|
68 |
-
'sub_action': theStep,
|
69 |
-
'site_url': aj_localize_admin.siteurl,
|
70 |
-
'aj_gtmetrix_username': aj_gtmetrix_username,
|
71 |
-
'aj_gtmetrix_api_key': aj_gtmetrix_api_key,
|
72 |
-
'aj_gtmetrix_server': aj_gtmetrix_server,
|
73 |
-
'security': aj_nonce
|
74 |
-
};
|
75 |
-
jQuery.post(aj_localize_admin.ajaxurl, data, function( response ) {
|
76 |
-
try {
|
77 |
-
response = jQuery.parseJSON( response );
|
78 |
-
if ( response.status !== false ) {
|
79 |
-
var screenshot = response.results.report_url + '/screenshot.jpg';
|
80 |
-
var pagespeed = response.results.pagespeed_score;
|
81 |
-
var yslow = response.results.yslow_score;
|
82 |
-
var flt = parseFloat( response.results.fully_loaded_time / 1000 ).toFixed( 2 );
|
83 |
-
var tps = Math.floor( response.results.page_bytes / 1024 );
|
84 |
-
var requests = response.results.page_elements;
|
85 |
-
var report = '<a href="' + response.results.report_url + '" target="_blank">' + response.results.report_url + '</a>';
|
86 |
-
var report_url = report.replace( 'https://', 'https://' + aj_gtmetrix_username + ':' + aj_gtmetrix_api_key + '@' );
|
87 |
-
var step_name = response.name;
|
88 |
-
var step_url = response.url;
|
89 |
-
var pr = 255 * ( 1 - ( pagespeed / 100 ) );
|
90 |
-
var yr = 255 * ( 1 - ( yslow / 100 ) );
|
91 |
-
var pg = 255 * ( pagespeed / 100 );
|
92 |
-
var yg = 255 * ( yslow / 100 );
|
93 |
-
var prgb = 'rgb(' + Math.floor( pr ) + ',' + Math.floor( pg ) + ',0 )';
|
94 |
-
var yrgb = 'rgb(' + Math.floor( yr ) + ',' + Math.floor( yg ) + ',0 )';
|
95 |
-
if ( theStep == 'aj_gtmetrix_test' ) {
|
96 |
-
theStep = 'aj_latest';
|
97 |
-
}
|
98 |
-
jQuery( '#' + theStep + '_please_wait' ).hide();
|
99 |
-
jQuery( '.' + theStep + '_screenshot' ).attr( 'src', screenshot );
|
100 |
-
jQuery( '.' + theStep + '_pagespeed' ).html( pagespeed + '%' ).css( { color: prgb } );
|
101 |
-
jQuery( '.' + theStep + '_yslow' ).html( yslow + '%' ).css( { color: yrgb } );
|
102 |
-
jQuery( '.' + theStep + '_flt' ).html( flt + 's' );
|
103 |
-
jQuery( '.' + theStep + '_tps' ).html( tps + 'KB' );
|
104 |
-
jQuery( '.' + theStep + '_requests' ).html( requests );
|
105 |
-
jQuery( '.' + theStep + '_report' ).html( report_url );
|
106 |
-
jQuery( '#' + theStep + '_gtmetrix_results' ).show();
|
107 |
-
jQuery( '.' + theStep + '_gtmetrix' ).html( step_name );
|
108 |
-
jQuery( '.' + theStep + '_url' ).attr( 'href', step_url ).html( step_url );
|
109 |
-
jQuery( '.aj_gtmetrix_credits' ).html( response.credits );
|
110 |
-
if ( theStep == 'aj_step2' ) {
|
111 |
-
jQuery( '#aj_notification' ).fadeIn( 'slow' ).html( 'Settings Saved <span class="aj_dismiss"><a title="dismiss this notification">x</a></span>' );
|
112 |
-
jQuery( '#aj_step2b' ).show();
|
113 |
-
jQuery( 'html, body' ).animate({
|
114 |
-
scrollTop: jQuery( "#aj_step2b" ).offset().top
|
115 |
-
}, 1000 );
|
116 |
-
aj_step( 'aj_step2b' );
|
117 |
-
} else if ( theStep == 'aj_step2b' ) {
|
118 |
-
jQuery( '#aj_step2c' ).show();
|
119 |
-
jQuery( 'html, body' ).animate({
|
120 |
-
scrollTop: jQuery( "#aj_step2c" ).offset().top
|
121 |
-
}, 1000 );
|
122 |
-
aj_step( 'aj_step2c' );
|
123 |
-
} else if ( theStep == 'aj_step2c' ) {
|
124 |
-
jQuery( '#aj_step2d' ).show();
|
125 |
-
jQuery( 'html, body' ).animate({
|
126 |
-
scrollTop: jQuery( "#aj_step2d" ).offset().top
|
127 |
-
}, 1000 );
|
128 |
-
aj_step( 'aj_step2d' );
|
129 |
-
} else if ( theStep == 'aj_step2d' ) {
|
130 |
-
jQuery( '#aj_step2e' ).show();
|
131 |
-
jQuery( 'html, body' ).animate({
|
132 |
-
scrollTop: jQuery( "#aj_step2e" ).offset().top
|
133 |
-
}, 1000 );
|
134 |
-
aj_step( 'aj_step2e' );
|
135 |
-
} else if ( theStep == 'aj_step2e' ) {
|
136 |
-
jQuery( '#aj_step_results' ).show();
|
137 |
-
jQuery( 'html, body' ).animate({
|
138 |
-
scrollTop: jQuery( "#aj_step_results" ).offset().top
|
139 |
-
}, 1000 );
|
140 |
-
aj_step( 'aj_step_results' );
|
141 |
-
} else if ( theStep == 'aj_latest' ) {
|
142 |
-
jQuery( '#aj_notification' ).fadeIn( 'slow' ).html( 'Settings Saved <span class="aj_dismiss"><a title="dismiss this notification">x</a></span>' );
|
143 |
-
jQuery( '#aj_latest_gtmetrix_results' ).show();
|
144 |
-
jQuery( '#aj_latest_please_wait' ).hide();
|
145 |
-
jQuery( 'html, body' ).animate({
|
146 |
-
scrollTop: jQuery( "#aj_latest_please_wait" ).offset().top
|
147 |
-
}, 1000 );
|
148 |
-
}
|
149 |
-
} else {
|
150 |
-
console.log(response);
|
151 |
-
}
|
152 |
-
}
|
153 |
-
catch( err ) {
|
154 |
-
console.log( err );
|
155 |
-
}
|
156 |
-
});
|
157 |
-
}
|
158 |
-
}
|
159 |
-
|
160 |
-
/**
|
161 |
-
* functions and actions to load after document ready
|
162 |
-
*/
|
163 |
-
jQuery( document ).ready( function() {
|
164 |
-
|
165 |
-
jQuery( document ).on( 'click', '.aj-upgrade-notice .notice-dismiss', function() {
|
166 |
-
var aj_nonce = jQuery( '#aj_nonce' ).val();
|
167 |
-
var notice_id = jQuery( '.aj-upgrade-notice' ).attr( 'data-id' );
|
168 |
-
jQuery.ajax({
|
169 |
-
url: aj.ajaxurl,
|
170 |
-
data: {
|
171 |
-
'action': 'async_javascript_dismiss_upgrade',
|
172 |
-
'notice_id': notice_id,
|
173 |
-
'security': aj_nonce
|
174 |
-
}
|
175 |
-
});
|
176 |
-
});
|
177 |
-
|
178 |
-
jQuery( document ).on( 'click', '.aj_steps_button', function(e) {
|
179 |
-
e.preventDefault();
|
180 |
-
var aj_nonce = jQuery( '#aj_nonce' ).val();
|
181 |
-
var theStep = jQuery( this ).attr( 'data-id' );
|
182 |
-
if ( theStep == 'aj_goto_settings' ) {
|
183 |
-
var newURL = aj_localize_admin.ajadminurl + '&tab=settings';
|
184 |
-
window.location.href = newURL;
|
185 |
-
} else if ( theStep == 'aj_apply_settings' || theStep == 'aj_step2b_apply' || theStep == 'aj_step2c_apply' || theStep == 'aj_step2d_apply' || theStep == 'aj_step2e_apply') {
|
186 |
-
if ( theStep != 'aj_apply_settings' ) {
|
187 |
-
var settings = theStep.replace( '_apply', '' );
|
188 |
-
} else {
|
189 |
-
var settings = '';
|
190 |
-
jQuery( '#aj_notification' ).fadeIn( 'slow' ).html( 'Settings Saved <span class="aj_dismiss"><a title="dismiss this notification">x</a></span>' );
|
191 |
-
}
|
192 |
-
var data = {
|
193 |
-
'action': 'aj_steps',
|
194 |
-
'sub_action': 'aj_apply_settings',
|
195 |
-
'settings': settings,
|
196 |
-
'site_url': aj_localize_admin.siteurl,
|
197 |
-
'security': aj_nonce
|
198 |
-
};
|
199 |
-
jQuery.post(aj_localize_admin.ajaxurl, data, function( response ) {
|
200 |
-
try {
|
201 |
-
response = jQuery.parseJSON( response );
|
202 |
-
if ( response.status !== false ) {
|
203 |
-
jQuery( '#aj_step5' ).show();
|
204 |
-
jQuery( 'html, body' ).animate({
|
205 |
-
scrollTop: jQuery( "#aj_step5" ).offset().top
|
206 |
-
}, 1000 );
|
207 |
-
if ( settings != '' ) {
|
208 |
-
jQuery( '#aj_notification' ).fadeIn( 'slow' ).html( 'Settings Saved <span class="aj_dismiss"><a title="dismiss this notification">x</a></span>' );
|
209 |
-
}
|
210 |
-
} else {
|
211 |
-
console.log(response);
|
212 |
-
}
|
213 |
-
}
|
214 |
-
catch( err ) {
|
215 |
-
console.log( err );
|
216 |
-
}
|
217 |
-
});
|
218 |
-
} else if ( theStep == 'aj_save_settings' ) {
|
219 |
-
if ( jQuery( '#aj_enabled' ).is( ':checked' ) ) {
|
220 |
-
var aj_enabled = 1;
|
221 |
-
} else {
|
222 |
-
var aj_enabled = 0;
|
223 |
-
}
|
224 |
-
var aj_method = jQuery( 'input[type=radio][name=aj_method]:checked' ).val();
|
225 |
-
var aj_jquery = jQuery( 'input[type=radio][name=aj_jquery]:checked' ).val();
|
226 |
-
var aj_exclusions = jQuery( '#aj_exclusions' ).val();
|
227 |
-
if ( jQuery( '#aj_autoptimize_enabled' ).is( ':visible' ) ) {
|
228 |
-
if ( jQuery( '#aj_autoptimize_enabled' ).is( ':checked' ) ) {
|
229 |
-
var aj_autoptimize_enabled = 1;
|
230 |
-
var aj_autoptimize_method = jQuery( 'input[type=radio][name=aj_autoptimize_method]:checked' ).val();
|
231 |
-
} else {
|
232 |
-
var aj_autoptimize_enabled = 0;
|
233 |
-
var aj_autoptimize_method = jQuery( 'input[type=radio][name=aj_autoptimize_method]:checked' ).val();
|
234 |
-
}
|
235 |
-
} else {
|
236 |
-
var aj_autoptimize_enabled = 0;
|
237 |
-
var aj_autoptimize_method = 'async';
|
238 |
-
}
|
239 |
-
var data = {
|
240 |
-
'action': 'aj_steps',
|
241 |
-
'sub_action': 'aj_save_settings',
|
242 |
-
'aj_enabled': aj_enabled,
|
243 |
-
'aj_method': aj_method,
|
244 |
-
'aj_jquery': aj_jquery,
|
245 |
-
'aj_exclusions': aj_exclusions,
|
246 |
-
'aj_autoptimize_enabled': aj_autoptimize_enabled,
|
247 |
-
'aj_autoptimize_method': aj_autoptimize_method,
|
248 |
-
'security': aj_nonce
|
249 |
-
};
|
250 |
-
jQuery.post(aj_localize_admin.ajaxurl, data, function( response ) {
|
251 |
-
try {
|
252 |
-
response = jQuery.parseJSON( response );
|
253 |
-
if ( response.status !== false ) {
|
254 |
-
jQuery( '#aj_notification' ).fadeIn( 'slow' ).html( 'Settings Saved <span class="aj_dismiss"><a title="dismiss this notification">x</a></span>' );
|
255 |
-
} else {
|
256 |
-
console.log(response);
|
257 |
-
}
|
258 |
-
}
|
259 |
-
catch( err ) {
|
260 |
-
console.log( err );
|
261 |
-
}
|
262 |
-
});
|
263 |
-
} else {
|
264 |
-
var aj_gtmetrix_username = jQuery( '#aj_gtmetrix_username' ).val();
|
265 |
-
var aj_gtmetrix_api_key = jQuery( '#aj_gtmetrix_api_key' ).val();
|
266 |
-
var aj_gtmetrix_server = jQuery( '#aj_gtmetrix_server' ).val();
|
267 |
-
var isError = false;
|
268 |
-
if ( aj_gtmetrix_username == '' ) {
|
269 |
-
jQuery( '#aj_gtmetrix_username' ).addClass( 'aj_field_error' );
|
270 |
-
isError = true;
|
271 |
-
}
|
272 |
-
if ( aj_gtmetrix_api_key == '' ) {
|
273 |
-
jQuery( '#aj_gtmetrix_api_key' ).addClass( 'aj_field_error' );
|
274 |
-
isError = true;
|
275 |
-
}
|
276 |
-
if ( isError === false ) {
|
277 |
-
if ( theStep != 'aj_gtmetrix_test' ) {
|
278 |
-
jQuery( this ).hide();
|
279 |
-
jQuery( '#' + theStep ).show();
|
280 |
-
} else {
|
281 |
-
jQuery( '#aj_latest_please_wait' ).show();
|
282 |
-
}
|
283 |
-
aj_step( theStep );
|
284 |
-
} else {
|
285 |
-
return false;
|
286 |
-
}
|
287 |
-
}
|
288 |
-
});
|
289 |
-
|
290 |
-
jQuery( document ).on( 'change', 'input[type=radio][name=aj_step4_check]', function() {
|
291 |
-
var aj_nonce = jQuery( '#aj_nonce' ).val();
|
292 |
-
var theSelection = jQuery( this ).val();
|
293 |
-
if ( theSelection == 'y' ) {
|
294 |
-
jQuery( '#aj_step4_y' ).show();
|
295 |
-
jQuery( '#aj_step4_n' ).hide();
|
296 |
-
} else {
|
297 |
-
jQuery( '#aj_step4_n' ).show();
|
298 |
-
jQuery( '#aj_step4_y' ).hide();
|
299 |
-
}
|
300 |
-
});
|
301 |
-
|
302 |
-
jQuery( document ).on( 'click', '.aj_dismiss', function() {
|
303 |
-
var aj_nonce = jQuery( '#aj_nonce' ).val();
|
304 |
-
jQuery( '#aj_notification' ).fadeOut( 'slow' );
|
305 |
-
});
|
306 |
-
});
|
307 |
* functions and actions to load after document ready
|
308 |
*/
|
1 |
+
function aj_step( theStep ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
* functions and actions to load after document ready
|
3 |
*/
|
js/admin.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
function aj_step(e){var
|
1 |
+
function aj_step(e){var a=jQuery("#aj_nonce").val(),t=jQuery("#aj_gtmetrix_username").val(),s=jQuery("#aj_gtmetrix_api_key").val(),r=jQuery("#aj_gtmetrix_server").val();if("aj_step_results"==e){var _={action:"aj_steps",sub_action:e,site_url:aj_localize_admin.siteurl,aj_gtmetrix_username:t,aj_gtmetrix_api_key:s,aj_gtmetrix_server:r,security:a};jQuery.post(aj_localize_admin.ajaxurl,_,function(e){try{if(e=jQuery.parseJSON(e),e.status!==!1){var a=e.baseline_pagespeed,t=e.baseline_yslow,s=e.results.pagespeed_score,r=e.results.yslow_score,_=e.name,i=parseFloat(e.results.fully_loaded_time/1e3).toFixed(2),j=e.url;jQuery(".aj_gtmetrix_config").html(_),s>a?jQuery("#aj_gtmetrix_inde_pagespeed").html("an increase"):a>s?jQuery("#aj_gtmetrix_inde_pagespeed").html("a decrease"):jQuery("#aj_gtmetrix_inde_pagespeed").html("no change"),r>t?jQuery("#aj_gtmetrix_inde_yslow").html("an increase"):t>r?jQuery("#aj_gtmetrix_inde_yslow").html("a decrease"):jQuery("#aj_gtmetrix_inde_yslow").html("no change"),jQuery("#aj_gtmetrix_baseline_pagespeed").html(a+"%"),jQuery("#aj_gtmetrix_best_pagespeed").html(s+"%"),jQuery("#aj_gtmetrix_baseline_yslow").html(t+"%"),jQuery("#aj_gtmetrix_best_yslow").html(r+"%"),jQuery("#aj_gtmetrix_best_fullyloaded").html(i+"s"),jQuery("#aj_gtmetrix_best_url").attr("href",j).html(j),"aj_step2b"==e.id||"aj_step2c"==e.id?(jQuery("#aj_step4_jquery_excluded").hide(),jQuery("#aj_step4_jquery_not_excluded").show()):("aj_step2d"==e.id||"aj_step2e"==e.id)&&(jQuery("#aj_step4_jquery_excluded").show(),jQuery("#aj_step4_jquery_not_excluded").hide()),jQuery(".aj_gtmetrix_credits").html(e.credits),jQuery("#aj_step_results").show()}else console.log(e)}catch(l){console.log(l)}})}else{var _={action:"aj_steps",sub_action:e,site_url:aj_localize_admin.siteurl,aj_gtmetrix_username:t,aj_gtmetrix_api_key:s,aj_gtmetrix_server:r,security:a};jQuery.post(aj_localize_admin.ajaxurl,_,function(a){try{if(a=jQuery.parseJSON(a),a.status!==!1){var r=a.results.report_url+"/screenshot.jpg",_=a.results.pagespeed_score,i=a.results.yslow_score,j=parseFloat(a.results.fully_loaded_time/1e3).toFixed(2),l=Math.floor(a.results.page_bytes/1024);l>1024?l=l/1024+"MB":l+="KB";var o=a.results.page_elements,u='<a href="'+a.results.report_url+'" target="_blank">'+a.results.report_url+"</a>",n=u.replace("https://","https://"+t+":"+s+"@"),y=a.name,p=a.url,c=255*(1-_/100),d=255*(1-i/100),m=255*(_/100),Q=255*(i/100),h="rgb("+Math.floor(c)+","+Math.floor(m)+",0 )",g="rgb("+Math.floor(d)+","+Math.floor(Q)+",0 )";"aj_gtmetrix_test"==e&&(e="aj_latest"),jQuery("#"+e+"_please_wait").hide(),jQuery("."+e+"_screenshot").attr("src",r),jQuery("."+e+"_pagespeed").html(_+"%").css({color:h}),jQuery("."+e+"_yslow").html(i+"%").css({color:g}),jQuery("."+e+"_flt").html(j+"s"),jQuery("."+e+"_tps").html(l),jQuery("."+e+"_requests").html(o),jQuery("."+e+"_report").html(n),jQuery("#"+e+"_gtmetrix_results").show(),jQuery("."+e+"_gtmetrix").html(y),jQuery("."+e+"_url").attr("href",p).html(p),jQuery(".aj_gtmetrix_credits").html(a.credits),"aj_step2"==e?(jQuery("#aj_notification").fadeIn("slow").html('Settings Saved <span class="aj_dismiss"><a title="dismiss this notification">x</a></span>'),jQuery("#aj_step2b").show(),jQuery("html, body").animate({scrollTop:jQuery("#aj_step2b").offset().top},1e3),aj_step("aj_step2b")):"aj_step2b"==e?(jQuery("#aj_step2c").show(),jQuery("html, body").animate({scrollTop:jQuery("#aj_step2c").offset().top},1e3),aj_step("aj_step2c")):"aj_step2c"==e?(jQuery("#aj_step2d").show(),jQuery("html, body").animate({scrollTop:jQuery("#aj_step2d").offset().top},1e3),aj_step("aj_step2d")):"aj_step2d"==e?(jQuery("#aj_step2e").show(),jQuery("html, body").animate({scrollTop:jQuery("#aj_step2e").offset().top},1e3),aj_step("aj_step2e")):"aj_step2e"==e?(jQuery("#aj_step_results").show(),jQuery("html, body").animate({scrollTop:jQuery("#aj_step_results").offset().top},1e3),aj_step("aj_step_results")):"aj_latest"==e&&(jQuery("#aj_notification").fadeIn("slow").html('Settings Saved <span class="aj_dismiss"><a title="dismiss this notification">x</a></span>'),jQuery("#aj_latest_gtmetrix_results").show(),jQuery("#aj_latest_please_wait").hide(),jQuery("html, body").animate({scrollTop:jQuery("#aj_latest_please_wait").offset().top},1e3))}else console.log(a)}catch(f){console.log(f)}})}}jQuery(document).ready(function(){jQuery(".aj_chosen").chosen(),jQuery(document).on("click",".aj-upgrade-notice .notice-dismiss",function(){var e=jQuery("#aj_nonce").val(),a=jQuery(".aj-upgrade-notice").attr("data-id");jQuery.ajax({url:aj.ajaxurl,data:{action:"async_javascript_dismiss_upgrade",notice_id:a,security:e}})}),jQuery(document).on("click",".aj_steps_button",function(e){e.preventDefault();var a=jQuery("#aj_nonce").val(),t=jQuery(this).attr("data-id");if("aj_goto_settings"==t){var s=aj_localize_admin.ajadminurl+"&tab=settings";window.location.href=s}else if("aj_apply_settings"==t||"aj_step2b_apply"==t||"aj_step2c_apply"==t||"aj_step2d_apply"==t||"aj_step2e_apply"==t){if("aj_apply_settings"!=t)var r=t.replace("_apply","");else{var r="";jQuery("#aj_notification").fadeIn("slow").html('Settings Saved <span class="aj_dismiss"><a title="dismiss this notification">x</a></span>')}var _={action:"aj_steps",sub_action:"aj_apply_settings",settings:r,site_url:aj_localize_admin.siteurl,security:a};jQuery.post(aj_localize_admin.ajaxurl,_,function(e){try{if(e=jQuery.parseJSON(e),e.status!==!1){if(jQuery("#aj_step4").length)jQuery("#aj_step5").show(),jQuery("html, body").animate({scrollTop:jQuery("#aj_step5").offset().top},1e3),""!=r&&jQuery("#aj_notification").fadeIn("slow").html('Settings Saved <span class="aj_dismiss"><a title="dismiss this notification">x</a></span>');else if(""!=r){jQuery("#aj_notification").fadeIn("slow").html('Settings Saved <span class="aj_dismiss"><a title="dismiss this notification">x</a></span>');var a=aj_localize_admin.ajadminurl+"&tab=settings";window.location.href=a}}else console.log(e)}catch(t){console.log(t)}})}else if("aj_save_settings"==t){if(jQuery("#aj_enabled").is(":checked"))var i=1;else var i=0;var j=jQuery("input[type=radio][name=aj_method]:checked").val(),l=jQuery("input[type=radio][name=aj_jquery]:checked").val(),o=jQuery("#aj_async").val(),u=jQuery("#aj_defer").val(),n=jQuery("#aj_exclusions").val(),y=jQuery("#aj_plugin_exclusions").chosen().val(),p=jQuery("#aj_theme_exclusions").chosen().val();if(jQuery("#aj_autoptimize_enabled").is(":visible"))if(jQuery("#aj_autoptimize_enabled").is(":checked"))var c=1,d=jQuery("input[type=radio][name=aj_autoptimize_method]:checked").val();else var c=0,d=jQuery("input[type=radio][name=aj_autoptimize_method]:checked").val();else var c=0,d="async";var _={action:"aj_steps",sub_action:"aj_save_settings",aj_enabled:i,aj_method:j,aj_jquery:l,aj_async:o,aj_defer:u,aj_exclusions:n,aj_plugin_exclusions:y,aj_theme_exclusions:p,aj_autoptimize_enabled:c,aj_autoptimize_method:d,security:a};jQuery.post(aj_localize_admin.ajaxurl,_,function(e){try{e=jQuery.parseJSON(e),e.status!==!1?jQuery("#aj_notification").fadeIn("slow").html('Settings Saved <span class="aj_dismiss"><a title="dismiss this notification">x</a></span>'):console.log(e)}catch(a){console.log(a)}})}else{var m=jQuery("#aj_gtmetrix_username").val(),Q=jQuery("#aj_gtmetrix_api_key").val(),h=(jQuery("#aj_gtmetrix_server").val(),!1);if(""==m&&(jQuery("#aj_gtmetrix_username").addClass("aj_field_error"),h=!0),""==Q&&(jQuery("#aj_gtmetrix_api_key").addClass("aj_field_error"),h=!0),h!==!1)return!1;"aj_gtmetrix_test"!=t?(jQuery(this).hide(),jQuery("#"+t).show()):jQuery("#aj_latest_please_wait").show(),aj_step(t)}}),jQuery(document).on("change","input[type=radio][name=aj_step4_check]",function(){var e=(jQuery("#aj_nonce").val(),jQuery(this).val());"y"==e?(jQuery("#aj_step4_y").show(),jQuery("#aj_step4_n").hide()):(jQuery("#aj_step4_n").show(),jQuery("#aj_step4_y").hide())}),jQuery(document).on("click",".aj_dismiss",function(){jQuery("#aj_nonce").val();jQuery("#aj_notification").fadeOut("slow")})});
|
readme.txt
CHANGED
@@ -1,255 +1,123 @@
|
|
1 |
-
=== Async JavaScript ===
|
2 |
-
Contributors: (cloughit)
|
3 |
-
Donate link: http://
|
4 |
-
Tags: async,javascript,
|
5 |
-
Requires at least:
|
6 |
-
Tested up to: 4.9
|
7 |
-
Stable tag: 2.
|
8 |
-
License: GPLv2 or later
|
9 |
-
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
-
|
11 |
-
Async
|
12 |
-
|
13 |
-
== Description ==
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
=
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
=
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
*
|
86 |
-
*
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
*
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
*
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
* MOD: Dashboard Widget and Notices only available to Administrators
|
125 |
-
|
126 |
-
= 2.17.05.07 =
|
127 |
-
|
128 |
-
* MOD: Remove front facing JS and CSS as not needed
|
129 |
-
|
130 |
-
= 2.17.05.05 =
|
131 |
-
|
132 |
-
* FIX: Incorrect textarea identifier preventing exclusion save
|
133 |
-
|
134 |
-
= 2.17.05.04 =
|
135 |
-
|
136 |
-
* FIX: CSS / JS not loading
|
137 |
-
|
138 |
-
= 2.17.05.03 =
|
139 |
-
|
140 |
-
* MOD: Add test to advise running Wizard is not mandatory
|
141 |
-
|
142 |
-
= 2.17.04.25 =
|
143 |
-
|
144 |
-
* massive Massive MASSIVE rewrite of Async JavaScript!!!
|
145 |
-
* Now includes a setup Wizard, Status page, Settings page and a help page.
|
146 |
-
* Communicates directly with GTmetrix (account required)
|
147 |
-
|
148 |
-
= 1.17.02.06 =
|
149 |
-
|
150 |
-
* FIX: Remove variable notice
|
151 |
-
|
152 |
-
= 1.17.01.22 =
|
153 |
-
|
154 |
-
* MOD: Changes in notice functionality
|
155 |
-
|
156 |
-
= 1.17.01.14 =
|
157 |
-
|
158 |
-
* MOD: Update readme.txt information
|
159 |
-
* MOD: Minify plugin JS & CSS
|
160 |
-
|
161 |
-
= 1.16.12.12 =
|
162 |
-
|
163 |
-
* MOD: WordPress 4.7 Support
|
164 |
-
* AD: Christmas Sale Sale
|
165 |
-
|
166 |
-
= 1.16.10.25 =
|
167 |
-
|
168 |
-
* AD: Crazy One Week Sale
|
169 |
-
|
170 |
-
= 1.16.09.30 =
|
171 |
-
|
172 |
-
* MOD: Better detection of jQuery core file
|
173 |
-
|
174 |
-
= 1.16.08.17 =
|
175 |
-
|
176 |
-
* FIX: Typo in variable name
|
177 |
-
|
178 |
-
= 1.16.08.11 =
|
179 |
-
|
180 |
-
* NEW: Select jQuery handler
|
181 |
-
* NEW: Select Autoptimize handler
|
182 |
-
|
183 |
-
= 1.16.08.10 =
|
184 |
-
|
185 |
-
* FIX: Return $tag instead of $src
|
186 |
-
|
187 |
-
= 1.16.08.09 =
|
188 |
-
|
189 |
-
* MOD: Added ability to check for spaces in comma separated exclusion list
|
190 |
-
* MOD: Added support link
|
191 |
-
|
192 |
-
= 1.16.06.22 =
|
193 |
-
|
194 |
-
* MOD: Remove admin message marketing
|
195 |
-
* MOD: Moved menu item to Settings menu
|
196 |
-
* MOD: Fixed marketing image css
|
197 |
-
* MOD: Fixed spelling of 'JavaScript' to 'JavaScript'
|
198 |
-
|
199 |
-
= 1.16.06.21 =
|
200 |
-
|
201 |
-
* MOD: converted from 'clean_url' to 'script_loader_tag' filter
|
202 |
-
|
203 |
-
= 1.16.03.23 =
|
204 |
-
|
205 |
-
* FIX: added check for empty string entered in exclusions
|
206 |
-
|
207 |
-
= 1.16.03.13 =
|
208 |
-
|
209 |
-
* FIX: Fixed autoptomize settings
|
210 |
-
* FIX: Removed redundant settings
|
211 |
-
|
212 |
-
= 1.16.03.12 =
|
213 |
-
|
214 |
-
* FIX: Adjust code flow for registered settings
|
215 |
-
|
216 |
-
= 1.16.03.11 =
|
217 |
-
|
218 |
-
* FIX: Properly register options
|
219 |
-
|
220 |
-
= 1.16.02.18 =
|
221 |
-
|
222 |
-
* NEW: Added dismissable upgrade notice
|
223 |
-
|
224 |
-
= 1.16.02.17 =
|
225 |
-
|
226 |
-
* NEW: Added information for Async JavaScript Pro
|
227 |
-
|
228 |
-
= 1.15.02.23.1 =
|
229 |
-
|
230 |
-
* FIX: Code error fix
|
231 |
-
|
232 |
-
= 1.15.02.23 =
|
233 |
-
|
234 |
-
* NEW: Tested for WordPress v4.1.1
|
235 |
-
* NEW: Added ability to provide a comma seperated list of scripts to be excluded from async/defer (thanks to Nico Ryba for this suggestion)
|
236 |
-
|
237 |
-
= 1.14.12.19 =
|
238 |
-
|
239 |
-
* NEW: Tested for Wordpress v4.1
|
240 |
-
|
241 |
-
= 1.14.12.11.2 =
|
242 |
-
|
243 |
-
* FIX: Repaired broken SVN issue preventing plugin install
|
244 |
-
|
245 |
-
= 1.14.12.11.1 =
|
246 |
-
|
247 |
-
* FIX: Repaired broken SVN issue preventing plugin install
|
248 |
-
|
249 |
-
= 1.14.12.11 =
|
250 |
-
|
251 |
-
* FIX: Updated minor versioning issue
|
252 |
-
|
253 |
-
= 1.14.12.10 =
|
254 |
-
|
255 |
-
* Genesis
|
1 |
+
=== Async JavaScript ===
|
2 |
+
Contributors: (cloughit), optimizingmatters, futtta
|
3 |
+
Donate link: http://blog.futtta.be/2013/10/21/do-not-donate-to-me/
|
4 |
+
Tags: async, javascript, pagespeed, performance, render blocking
|
5 |
+
Requires at least: 4.4
|
6 |
+
Tested up to: 4.9
|
7 |
+
Stable tag: 2.18.03.10
|
8 |
+
License: GPLv2 or later
|
9 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
+
|
11 |
+
Async Javascript gives you lets you add 'async' or 'defer' attribute to scripts to exclude to help increase the performance of your WordPress website.
|
12 |
+
|
13 |
+
== Description ==
|
14 |
+
Eliminate Render-blocking Javascript in above-the-fold content with Async Javascript.
|
15 |
+
|
16 |
+
Render-blocking Javascript prevents above-the-fold content on your page from being rendered until the javascript has finished loading. This can impact on your page speed and ultimately your ranking within search engines. It can also impact your users experience.
|
17 |
+
|
18 |
+
Async JavaScript gives you full control of which scripts to add a 'async' or 'defer' attribute to or to exclude to help increase the performance of your WordPress website.
|
19 |
+
|
20 |
+
== Installation ==
|
21 |
+
Installation is very straightforward:
|
22 |
+
|
23 |
+
1. Upload the zip-file and unzip it in the /wp-content/plugins/ directory
|
24 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress
|
25 |
+
3. Go to `Settings` > `Async JavaScript` menu to load settings page
|
26 |
+
|
27 |
+
== Frequently Asked Questions ==
|
28 |
+
|
29 |
+
= Which browsers support the 'async' and 'defer' attributes =
|
30 |
+
|
31 |
+
The 'async' attribute is new in HTML5. It is supported by the following browsers:
|
32 |
+
|
33 |
+
* Chrome
|
34 |
+
* IE 10 and higher
|
35 |
+
* Firefox 3.6 and higher
|
36 |
+
* Safari
|
37 |
+
* Opera
|
38 |
+
|
39 |
+
= Where can I get help? =
|
40 |
+
|
41 |
+
Async JavaScript is supported via [the wordpress.org support forum](https://wordpress.org/support/plugin/async-javascript).
|
42 |
+
|
43 |
+
= Do you offer professional support/ configuration services? =
|
44 |
+
|
45 |
+
We offer premium services for Async JavaScript and full web performance optimization services at [https://autoptimize.com/](https://autoptimize.com/?utm=asyncjs)
|
46 |
+
|
47 |
+
= What about CSS? =
|
48 |
+
|
49 |
+
As the name implies, Async JavaScript is built to enhance JavaScript loading only. Async JavaScript does not have any impact on CSS.
|
50 |
+
|
51 |
+
We recommend using the awesome <a href="https://wordpress.org/plugins/autoptimize/">Autoptimize</a> plugin alongside Async JavaScript for CSS optimization.
|
52 |
+
|
53 |
+
= I want out, how should I remove Async JavaScript? =
|
54 |
+
|
55 |
+
* Disable the plugin
|
56 |
+
* Delete the plugin
|
57 |
+
|
58 |
+
== Screenshots ==
|
59 |
+
|
60 |
+
Coming soon!
|
61 |
+
|
62 |
+
== Changelog ==
|
63 |
+
|
64 |
+
= 2.18.03.10 =
|
65 |
+
|
66 |
+
* ASync JS is now maintained by Frank Goossens (Optimizing Matters), thanks for the great job done David!
|
67 |
+
* Moved all Pro features into the standard version.
|
68 |
+
* Some code refactoring
|
69 |
+
* Made strings ready for translations
|
70 |
+
|
71 |
+
= 2.17.11.15 =
|
72 |
+
|
73 |
+
* MOD: Added User Agent to GTMetrix requests
|
74 |
+
|
75 |
+
= 2.17.11.03 =
|
76 |
+
|
77 |
+
* MOD: Check for GTMetrix class existance prior to including class
|
78 |
+
|
79 |
+
= 2.17.10.18 =
|
80 |
+
|
81 |
+
* FIX: Issue converting array for plugin & theme exclusions
|
82 |
+
|
83 |
+
= 2.17.09.30 =
|
84 |
+
|
85 |
+
* FIX: Sanitise all $_GET and all $_POST
|
86 |
+
* FIX: Add nonce to ajax calls
|
87 |
+
|
88 |
+
= 2.17.06.13 =
|
89 |
+
|
90 |
+
* MOD: Dashboard Widget and Notices only available to Administrators
|
91 |
+
|
92 |
+
= 2.17.05.08 =
|
93 |
+
|
94 |
+
* NEW: Added quick settings buttons to allow common settings to be quickly applied
|
95 |
+
* NEW: Added current version info to help page
|
96 |
+
|
97 |
+
= 2.17.05.07 =
|
98 |
+
|
99 |
+
* FIX: Some installs not saving plugin / theme exclusions due to theme incompatibility
|
100 |
+
|
101 |
+
= 2.17.05.06 =
|
102 |
+
|
103 |
+
* MOD/FIX: On some WordPress installs is_plugin_active function being called too early. Moved is_plugin_active into dedicated function called via admin_init as per codex: https://codex.wordpress.org/Function_Reference/is_plugin_active
|
104 |
+
|
105 |
+
= 2.17.05.05 =
|
106 |
+
|
107 |
+
* FIX: Incorrect textarea identifier preventing exclusion save
|
108 |
+
|
109 |
+
= 2.17.05.04 =
|
110 |
+
|
111 |
+
* FIX: Resolve early loading of plugin causing fatal error due to function not available yet
|
112 |
+
* FIX: CSS / JS not loading
|
113 |
+
|
114 |
+
= 2.17.05.03 =
|
115 |
+
|
116 |
+
* MOD: Add text to advise running Wizard is not mandatory
|
117 |
+
|
118 |
+
= 2.17.05.01 =
|
119 |
+
|
120 |
+
* massive Massive MASSIVE rewrite of Async JavaScript!!!
|
121 |
+
* Now includes a setup Wizard, Status page, Settings page and a help page.
|
122 |
+
* Communicates directly with GTmetrix (account required)
|
123 |
+
* Automaticall transfers existing settings from Async JavaScript to Async JavaScript
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|