Version Description
- Added backward compatibility for [highlight]. Now it accepts bg and background attributes.
- Added backward compatibility for [label]. Now it accepts style and type attributes.
- Added backward compatibility for [dropcap]. Now it accepts 1, 2 and 3 as style values.
- Added backward compatibility for [permalink]. Now it accepts p and id attributes.
- Added backward compatibility for [button]. Need to test.
- Added backward compatibility for [members]. Now it accepts style and login attributes.
- Added backward compatibility for [box]. Now it accepts color and box_color attributes.
- Added backward compatibility for [note]. Now it accepts color and note_color attributes.
- Added backward compatibility for [column]. Now it accepts attribute last and can be not wrapped with [row].
- Added backward compatibility for [document]. Now it accepts file and url attributes.
Download this release
Release Info
Developer | gn_themes |
Plugin | Shortcodes Ultimate |
Version | 4.0.4 |
Comparing to | |
See all releases |
Code changes from version 4.0.3 to 4.0.4
- assets/css/box-shortcodes.css +303 -301
- assets/css/content-shortcodes.css +300 -300
- assets/css/galleries-shortcodes.css +454 -454
- assets/css/generator.css +334 -334
- assets/css/media-shortcodes.css +48 -48
- assets/css/options-page.css +310 -310
- assets/css/other-shortcodes.css +126 -126
- assets/css/players-shortcodes.css +296 -296
- assets/css/sunrise.css +153 -153
- assets/css/vote.css +48 -48
- assets/js/file-upload.js +1315 -1315
- assets/js/form.js +815 -815
- assets/js/galleries-shortcodes.js +61 -61
- assets/js/generator.js +443 -443
- assets/js/iframe-transport.js +205 -205
- assets/js/jplayer.js +106 -106
- assets/js/magnific-popup.js +2 -2
- assets/js/options-page.js +200 -200
- assets/js/other-shortcodes.js +54 -54
- assets/js/players-shortcodes.js +73 -73
- assets/js/qtip.js +21 -21
- assets/js/sunrise.js +210 -210
- assets/js/swiper.js +2305 -2305
- assets/js/vote.js +15 -15
- inc/core/class.assets.php +183 -183
- inc/core/class.data.php +1623 -1623
- inc/core/class.generator.php +302 -302
- inc/core/class.shortcodes-ultimate.php +190 -190
- inc/core/class.vote.php +55 -55
- inc/core/class.widget.php +101 -101
- inc/core/shortcodes.php +99 -64
- inc/core/tools.php +715 -715
- inc/example-addon.php +84 -84
- inc/vendor/class.image-meta.php +51 -51
- inc/vendor/class.media-upload.php +189 -189
- inc/vendor/class.sunrise-framework.php +323 -323
- inc/views/about.php +30 -46
assets/css/box-shortcodes.css
CHANGED
@@ -1,302 +1,304 @@
|
|
1 |
-
/*** Shortcodes Ultimate - box elements ***/
|
2 |
-
|
3 |
-
/* Tabs + Tab
|
4 |
-
---------------------------------------------------------------*/
|
5 |
-
|
6 |
-
.su-tabs {
|
7 |
-
margin: 0 0 1.5em 0;
|
8 |
-
padding: 3px;
|
9 |
-
-webkit-border-radius: 3px;
|
10 |
-
-moz-border-radius: 3px;
|
11 |
-
border-radius: 3px;
|
12 |
-
background: #eee;
|
13 |
-
}
|
14 |
-
.su-tabs-nav span {
|
15 |
-
display: inline-block;
|
16 |
-
margin-right: 3px;
|
17 |
-
padding: 0.5em 1em;
|
18 |
-
-webkit-border-top-left-radius: 3px;
|
19 |
-
-moz-border-radius-topleft: 3px;
|
20 |
-
border-top-left-radius: 3px;
|
21 |
-
-webkit-border-top-right-radius: 3px;
|
22 |
-
-moz-border-radius-topright: 3px;
|
23 |
-
border-top-right-radius: 3px;
|
24 |
-
color: #333;
|
25 |
-
cursor: pointer;
|
26 |
-
-webkit-transition: all .2s;
|
27 |
-
-moz-transition: all .2s;
|
28 |
-
-o-transition: all .2s;
|
29 |
-
transition: all .2s;
|
30 |
-
}
|
31 |
-
.su-tabs-nav span:hover { background: #f5f5f5; }
|
32 |
-
.su-tabs-nav span.su-tabs-current { background: #fff; }
|
33 |
-
.su-tabs-pane {
|
34 |
-
padding: 1em;
|
35 |
-
-webkit-box-sizing: border-box;
|
36 |
-
-moz-box-sizing: border-box;
|
37 |
-
box-sizing: border-box;
|
38 |
-
-webkit-border-bottom-right-radius: 3px;
|
39 |
-
-moz-border-radius-bottomright: 3px;
|
40 |
-
border-bottom-right-radius: 3px;
|
41 |
-
-webkit-border-bottom-left-radius: 3px;
|
42 |
-
-moz-border-radius-bottomleft: 3px;
|
43 |
-
border-bottom-left-radius: 3px;
|
44 |
-
background: #fff;
|
45 |
-
color: #333;
|
46 |
-
}
|
47 |
-
.su-tabs-vertical .su-tabs-nav {
|
48 |
-
width: 200px;
|
49 |
-
float: left;
|
50 |
-
}
|
51 |
-
.su-tabs-vertical .su-tabs-nav span {
|
52 |
-
display: block;
|
53 |
-
margin-right: 0;
|
54 |
-
-webkit-border-radius: 0;
|
55 |
-
-moz-border-radius: 0;
|
56 |
-
border-radius: 0;
|
57 |
-
-webkit-border-top-left-radius: 3px;
|
58 |
-
-moz-border-radius-topleft: 3px;
|
59 |
-
border-top-left-radius: 3px;
|
60 |
-
-webkit-border-bottom-left-radius: 3px;
|
61 |
-
-moz-border-radius-bottomleft: 3px;
|
62 |
-
border-bottom-left-radius: 3px;
|
63 |
-
}
|
64 |
-
.su-tabs-vertical .su-tabs-pane {
|
65 |
-
height: 100%;
|
66 |
-
margin-left: 200px;
|
67 |
-
}
|
68 |
-
|
69 |
-
/* Spoiler
|
70 |
-
---------------------------------------------------------------*/
|
71 |
-
|
72 |
-
.su-spoiler { margin-bottom: 1.5em; }
|
73 |
-
.su-spoiler .su-spoiler:last-child { margin-bottom: 0; }
|
74 |
-
.su-spoiler-content {
|
75 |
-
-webkit-transition: padding-top .2s;
|
76 |
-
-moz-transition: padding-top .2s;
|
77 |
-
-o-transition: padding-top .2s;
|
78 |
-
transition: padding-top .2s;
|
79 |
-
-ie-transition: padding-top .2s;
|
80 |
-
}
|
81 |
-
.su-spoiler.su-spoiler-closed > .su-spoiler-content {
|
82 |
-
width: 0;
|
83 |
-
height: 0;
|
84 |
-
margin: 0;
|
85 |
-
padding: 0;
|
86 |
-
overflow: hidden;
|
87 |
-
border: none;
|
88 |
-
opacity: 0;
|
89 |
-
}
|
90 |
-
.su-spoiler-title {
|
91 |
-
position: relative;
|
92 |
-
min-height: 16px;
|
93 |
-
padding: 4px 0 4px 24px;
|
94 |
-
background: #fff;
|
95 |
-
color: #333;
|
96 |
-
font-weight: bold;
|
97 |
-
line-height: 16px;
|
98 |
-
cursor: pointer;
|
99 |
-
}
|
100 |
-
.su-spoiler-title > .su-spoiler-icon {
|
101 |
-
position: absolute;
|
102 |
-
top: 4px;
|
103 |
-
left: 0;
|
104 |
-
display: block;
|
105 |
-
width: 16px;
|
106 |
-
height: 16px;
|
107 |
-
background: 0 -16px url('../images/spoiler.png') no-repeat;
|
108 |
-
}
|
109 |
-
.su-spoiler-closed > .su-spoiler-title > .su-spoiler-icon { background: 0 0 url('../images/spoiler.png') no-repeat; }
|
110 |
-
.su-spoiler-content {
|
111 |
-
padding: 1em 0 0 24px;
|
112 |
-
background: #fff;
|
113 |
-
color: #333;
|
114 |
-
}
|
115 |
-
|
116 |
-
/* Quote
|
117 |
-
---------------------------------------------------------------*/
|
118 |
-
|
119 |
-
.su-quote {
|
120 |
-
position: relative;
|
121 |
-
margin-bottom: 1.5em;
|
122 |
-
padding: 0.5em 3em;
|
123 |
-
font-style: italic;
|
124 |
-
}
|
125 |
-
.su-quote-has-cite { margin-bottom: 3em; }
|
126 |
-
.su-quote:before,
|
127 |
-
.su-quote:after {
|
128 |
-
position: absolute;
|
129 |
-
display: block;
|
130 |
-
width: 20px;
|
131 |
-
height: 20px;
|
132 |
-
background-image: url('../images/quote.png');
|
133 |
-
content: '';
|
134 |
-
}
|
135 |
-
.su-quote:before {
|
136 |
-
top: 0;
|
137 |
-
left: 0;
|
138 |
-
background-position: 0 0;
|
139 |
-
}
|
140 |
-
.su-quote:after {
|
141 |
-
right: 0;
|
142 |
-
bottom: 0;
|
143 |
-
background-position: -20px 0;
|
144 |
-
}
|
145 |
-
.su-quote-cite {
|
146 |
-
position: absolute;
|
147 |
-
right: 4em;
|
148 |
-
bottom: -1.5em;
|
149 |
-
font-style: normal;
|
150 |
-
}
|
151 |
-
.su-quote-cite a { text-decoration: underline; }
|
152 |
-
|
153 |
-
/* Pullquote
|
154 |
-
---------------------------------------------------------------*/
|
155 |
-
|
156 |
-
.su-pullquote {
|
157 |
-
display: block;
|
158 |
-
width: 30%;
|
159 |
-
padding: 0.5em 1em;
|
160 |
-
}
|
161 |
-
.su-pullquote-align-left {
|
162 |
-
margin: 0.5em 1.5em 1em 0;
|
163 |
-
padding-left: 0;
|
164 |
-
float: left;
|
165 |
-
border-right: 5px solid #eee;
|
166 |
-
}
|
167 |
-
.su-pullquote-align-right {
|
168 |
-
margin: 0.5em 0 1em 1.5em;
|
169 |
-
padding-right: 0;
|
170 |
-
float: right;
|
171 |
-
border-left: 5px solid #eee;
|
172 |
-
}
|
173 |
-
|
174 |
-
/* Row + Column
|
175 |
-
---------------------------------------------------------------*/
|
176 |
-
|
177 |
-
.su-row {
|
178 |
-
clear: both;
|
179 |
-
zoom: 1;
|
180 |
-
}
|
181 |
-
.su-row:before,
|
182 |
-
.su-row:after {
|
183 |
-
content: "";
|
184 |
-
display: table;
|
185 |
-
}
|
186 |
-
.su-row:after { clear: both }
|
187 |
-
.su-column {
|
188 |
-
display: block;
|
189 |
-
float: left;
|
190 |
-
margin: 0
|
191 |
-
-webkit-box-sizing: border-box;
|
192 |
-
-moz-box-sizing: border-box;
|
193 |
-
box-sizing: border-box;
|
194 |
-
}
|
195 |
-
.su-column
|
196 |
-
.su-column
|
197 |
-
.su-column
|
198 |
-
.su-column
|
199 |
-
.su-column
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
.su-column-size-1-
|
206 |
-
.su-column-size-2
|
207 |
-
.su-column-size-1-
|
208 |
-
.su-column-size-3
|
209 |
-
.su-column-size-1-
|
210 |
-
.su-column-size-
|
211 |
-
.su-column-size-
|
212 |
-
.su-column-size-
|
213 |
-
.su-column-size-
|
214 |
-
.su-column-size-5
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
.
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
box-shadow: none !important;
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
background-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
background-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
background-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
background-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
|
|
|
|
302 |
}
|
1 |
+
/*** Shortcodes Ultimate - box elements ***/
|
2 |
+
|
3 |
+
/* Tabs + Tab
|
4 |
+
---------------------------------------------------------------*/
|
5 |
+
|
6 |
+
.su-tabs {
|
7 |
+
margin: 0 0 1.5em 0;
|
8 |
+
padding: 3px;
|
9 |
+
-webkit-border-radius: 3px;
|
10 |
+
-moz-border-radius: 3px;
|
11 |
+
border-radius: 3px;
|
12 |
+
background: #eee;
|
13 |
+
}
|
14 |
+
.su-tabs-nav span {
|
15 |
+
display: inline-block;
|
16 |
+
margin-right: 3px;
|
17 |
+
padding: 0.5em 1em;
|
18 |
+
-webkit-border-top-left-radius: 3px;
|
19 |
+
-moz-border-radius-topleft: 3px;
|
20 |
+
border-top-left-radius: 3px;
|
21 |
+
-webkit-border-top-right-radius: 3px;
|
22 |
+
-moz-border-radius-topright: 3px;
|
23 |
+
border-top-right-radius: 3px;
|
24 |
+
color: #333;
|
25 |
+
cursor: pointer;
|
26 |
+
-webkit-transition: all .2s;
|
27 |
+
-moz-transition: all .2s;
|
28 |
+
-o-transition: all .2s;
|
29 |
+
transition: all .2s;
|
30 |
+
}
|
31 |
+
.su-tabs-nav span:hover { background: #f5f5f5; }
|
32 |
+
.su-tabs-nav span.su-tabs-current { background: #fff; }
|
33 |
+
.su-tabs-pane {
|
34 |
+
padding: 1em;
|
35 |
+
-webkit-box-sizing: border-box;
|
36 |
+
-moz-box-sizing: border-box;
|
37 |
+
box-sizing: border-box;
|
38 |
+
-webkit-border-bottom-right-radius: 3px;
|
39 |
+
-moz-border-radius-bottomright: 3px;
|
40 |
+
border-bottom-right-radius: 3px;
|
41 |
+
-webkit-border-bottom-left-radius: 3px;
|
42 |
+
-moz-border-radius-bottomleft: 3px;
|
43 |
+
border-bottom-left-radius: 3px;
|
44 |
+
background: #fff;
|
45 |
+
color: #333;
|
46 |
+
}
|
47 |
+
.su-tabs-vertical .su-tabs-nav {
|
48 |
+
width: 200px;
|
49 |
+
float: left;
|
50 |
+
}
|
51 |
+
.su-tabs-vertical .su-tabs-nav span {
|
52 |
+
display: block;
|
53 |
+
margin-right: 0;
|
54 |
+
-webkit-border-radius: 0;
|
55 |
+
-moz-border-radius: 0;
|
56 |
+
border-radius: 0;
|
57 |
+
-webkit-border-top-left-radius: 3px;
|
58 |
+
-moz-border-radius-topleft: 3px;
|
59 |
+
border-top-left-radius: 3px;
|
60 |
+
-webkit-border-bottom-left-radius: 3px;
|
61 |
+
-moz-border-radius-bottomleft: 3px;
|
62 |
+
border-bottom-left-radius: 3px;
|
63 |
+
}
|
64 |
+
.su-tabs-vertical .su-tabs-pane {
|
65 |
+
height: 100%;
|
66 |
+
margin-left: 200px;
|
67 |
+
}
|
68 |
+
|
69 |
+
/* Spoiler
|
70 |
+
---------------------------------------------------------------*/
|
71 |
+
|
72 |
+
.su-spoiler { margin-bottom: 1.5em; }
|
73 |
+
.su-spoiler .su-spoiler:last-child { margin-bottom: 0; }
|
74 |
+
.su-spoiler-content {
|
75 |
+
-webkit-transition: padding-top .2s;
|
76 |
+
-moz-transition: padding-top .2s;
|
77 |
+
-o-transition: padding-top .2s;
|
78 |
+
transition: padding-top .2s;
|
79 |
+
-ie-transition: padding-top .2s;
|
80 |
+
}
|
81 |
+
.su-spoiler.su-spoiler-closed > .su-spoiler-content {
|
82 |
+
width: 0;
|
83 |
+
height: 0;
|
84 |
+
margin: 0;
|
85 |
+
padding: 0;
|
86 |
+
overflow: hidden;
|
87 |
+
border: none;
|
88 |
+
opacity: 0;
|
89 |
+
}
|
90 |
+
.su-spoiler-title {
|
91 |
+
position: relative;
|
92 |
+
min-height: 16px;
|
93 |
+
padding: 4px 0 4px 24px;
|
94 |
+
background: #fff;
|
95 |
+
color: #333;
|
96 |
+
font-weight: bold;
|
97 |
+
line-height: 16px;
|
98 |
+
cursor: pointer;
|
99 |
+
}
|
100 |
+
.su-spoiler-title > .su-spoiler-icon {
|
101 |
+
position: absolute;
|
102 |
+
top: 4px;
|
103 |
+
left: 0;
|
104 |
+
display: block;
|
105 |
+
width: 16px;
|
106 |
+
height: 16px;
|
107 |
+
background: 0 -16px url('../images/spoiler.png') no-repeat;
|
108 |
+
}
|
109 |
+
.su-spoiler-closed > .su-spoiler-title > .su-spoiler-icon { background: 0 0 url('../images/spoiler.png') no-repeat; }
|
110 |
+
.su-spoiler-content {
|
111 |
+
padding: 1em 0 0 24px;
|
112 |
+
background: #fff;
|
113 |
+
color: #333;
|
114 |
+
}
|
115 |
+
|
116 |
+
/* Quote
|
117 |
+
---------------------------------------------------------------*/
|
118 |
+
|
119 |
+
.su-quote {
|
120 |
+
position: relative;
|
121 |
+
margin-bottom: 1.5em;
|
122 |
+
padding: 0.5em 3em;
|
123 |
+
font-style: italic;
|
124 |
+
}
|
125 |
+
.su-quote-has-cite { margin-bottom: 3em; }
|
126 |
+
.su-quote:before,
|
127 |
+
.su-quote:after {
|
128 |
+
position: absolute;
|
129 |
+
display: block;
|
130 |
+
width: 20px;
|
131 |
+
height: 20px;
|
132 |
+
background-image: url('../images/quote.png');
|
133 |
+
content: '';
|
134 |
+
}
|
135 |
+
.su-quote:before {
|
136 |
+
top: 0;
|
137 |
+
left: 0;
|
138 |
+
background-position: 0 0;
|
139 |
+
}
|
140 |
+
.su-quote:after {
|
141 |
+
right: 0;
|
142 |
+
bottom: 0;
|
143 |
+
background-position: -20px 0;
|
144 |
+
}
|
145 |
+
.su-quote-cite {
|
146 |
+
position: absolute;
|
147 |
+
right: 4em;
|
148 |
+
bottom: -1.5em;
|
149 |
+
font-style: normal;
|
150 |
+
}
|
151 |
+
.su-quote-cite a { text-decoration: underline; }
|
152 |
+
|
153 |
+
/* Pullquote
|
154 |
+
---------------------------------------------------------------*/
|
155 |
+
|
156 |
+
.su-pullquote {
|
157 |
+
display: block;
|
158 |
+
width: 30%;
|
159 |
+
padding: 0.5em 1em;
|
160 |
+
}
|
161 |
+
.su-pullquote-align-left {
|
162 |
+
margin: 0.5em 1.5em 1em 0;
|
163 |
+
padding-left: 0;
|
164 |
+
float: left;
|
165 |
+
border-right: 5px solid #eee;
|
166 |
+
}
|
167 |
+
.su-pullquote-align-right {
|
168 |
+
margin: 0.5em 0 1em 1.5em;
|
169 |
+
padding-right: 0;
|
170 |
+
float: right;
|
171 |
+
border-left: 5px solid #eee;
|
172 |
+
}
|
173 |
+
|
174 |
+
/* Row + Column
|
175 |
+
---------------------------------------------------------------*/
|
176 |
+
|
177 |
+
.su-row {
|
178 |
+
clear: both;
|
179 |
+
zoom: 1;
|
180 |
+
}
|
181 |
+
.su-row:before,
|
182 |
+
.su-row:after {
|
183 |
+
content: "";
|
184 |
+
display: table;
|
185 |
+
}
|
186 |
+
.su-row:after { clear: both }
|
187 |
+
.su-column {
|
188 |
+
display: block;
|
189 |
+
float: left;
|
190 |
+
margin: 0 4% 1em 0;
|
191 |
+
-webkit-box-sizing: border-box;
|
192 |
+
-moz-box-sizing: border-box;
|
193 |
+
box-sizing: border-box;
|
194 |
+
}
|
195 |
+
.su-column-last,
|
196 |
+
.su-row .su-column:first-child { margin-right: 0 }
|
197 |
+
.su-row .su-column { margin: 0 0 1em 4%; }
|
198 |
+
.su-column img,
|
199 |
+
.su-column iframe,
|
200 |
+
.su-column object,
|
201 |
+
.su-column embed { max-width: 100% }
|
202 |
+
@media only screen {
|
203 |
+
[class*="su-column"] + [class*="su-column"]:last-child { float: right }
|
204 |
+
}
|
205 |
+
.su-column-size-1-1 { width: 100% }
|
206 |
+
.su-column-size-1-2 { width: 48% }
|
207 |
+
.su-column-size-1-3 { width: 30.66% }
|
208 |
+
.su-column-size-2-3 { width: 65.33% }
|
209 |
+
.su-column-size-1-4 { width: 22% }
|
210 |
+
.su-column-size-3-4 { width: 74% }
|
211 |
+
.su-column-size-1-5 { width: 16.8% }
|
212 |
+
.su-column-size-2-5 { width: 37.6% }
|
213 |
+
.su-column-size-3-5 { width: 58.4% }
|
214 |
+
.su-column-size-4-5 { width: 79.2% }
|
215 |
+
.su-column-size-1-6 { width: 13.33% }
|
216 |
+
.su-column-size-5-6 { width: 82.66% }
|
217 |
+
/* Styles for screens that are less than 768px */
|
218 |
+
@media only screen and (max-width: 768px) {
|
219 |
+
.su-column {
|
220 |
+
width: 100% !important;
|
221 |
+
float: none !important;
|
222 |
+
margin: 0 0 1em 0;
|
223 |
+
}
|
224 |
+
}
|
225 |
+
|
226 |
+
/* Service
|
227 |
+
---------------------------------------------------------------*/
|
228 |
+
|
229 |
+
.su-service {
|
230 |
+
position: relative;
|
231 |
+
margin: 0 0 1.5em 0;
|
232 |
+
}
|
233 |
+
.su-service-title {
|
234 |
+
display: block;
|
235 |
+
margin: 0 0 5px 0;
|
236 |
+
color: #333;
|
237 |
+
font-weight: bold;
|
238 |
+
font-size: 1.15em;
|
239 |
+
line-height: 1.5;
|
240 |
+
}
|
241 |
+
.su-service-title img {
|
242 |
+
position: absolute;
|
243 |
+
top: 0;
|
244 |
+
left: 0;
|
245 |
+
display: block !important;
|
246 |
+
margin: 0 !important;
|
247 |
+
padding: 0 !important;
|
248 |
+
border: none !important;
|
249 |
+
border: none !important;
|
250 |
+
-webkit-box-shadow: none !important;
|
251 |
+
-moz-box-shadow: none !important;
|
252 |
+
box-shadow: none !important;
|
253 |
+
}
|
254 |
+
.su-service-content { line-height: 1.4; }
|
255 |
+
|
256 |
+
/* Box
|
257 |
+
---------------------------------------------------------------*/
|
258 |
+
|
259 |
+
.su-box {
|
260 |
+
margin: 0 0 1.5em 0;
|
261 |
+
border-width: 1px;
|
262 |
+
border-style: solid;
|
263 |
+
}
|
264 |
+
.su-box-title {
|
265 |
+
display: block;
|
266 |
+
padding: 0.5em 1em;
|
267 |
+
font-weight: bold;
|
268 |
+
font-size: 1.1em;
|
269 |
+
}
|
270 |
+
.su-box-content { padding: 1em; }
|
271 |
+
.su-box-style-soft .su-box-title {
|
272 |
+
background-image: url('../images/styles/style-soft.png');
|
273 |
+
background-position: 0 0;
|
274 |
+
background-repeat: repeat-x;
|
275 |
+
}
|
276 |
+
.su-box-style-glass .su-box-title {
|
277 |
+
background-image: url('../images/styles/style-glass.png');
|
278 |
+
background-position: 0 50%;
|
279 |
+
background-repeat: repeat-x;
|
280 |
+
}
|
281 |
+
.su-box-style-bubbles .su-box-title {
|
282 |
+
background-image: url('../images/styles/style-bubbles.png');
|
283 |
+
background-position: 0 50%;
|
284 |
+
background-repeat: repeat-x;
|
285 |
+
}
|
286 |
+
.su-box-style-noise .su-box-title {
|
287 |
+
background-image: url('../images/styles/style-noise.png');
|
288 |
+
background-position: 0 0;
|
289 |
+
background-repeat: repeat-x;
|
290 |
+
}
|
291 |
+
|
292 |
+
/* Note
|
293 |
+
---------------------------------------------------------------*/
|
294 |
+
|
295 |
+
.su-note {
|
296 |
+
margin: 0 0 1.5em 0;
|
297 |
+
border-width: 1px;
|
298 |
+
border-style: solid;
|
299 |
+
}
|
300 |
+
.su-note-inner {
|
301 |
+
padding: 1em;
|
302 |
+
border-width: 1px;
|
303 |
+
border-style: solid;
|
304 |
}
|
assets/css/content-shortcodes.css
CHANGED
@@ -1,301 +1,301 @@
|
|
1 |
-
/*** Shortcodes Ultimate - content elements ***/
|
2 |
-
|
3 |
-
/* Heading
|
4 |
-
---------------------------------------------------------------*/
|
5 |
-
|
6 |
-
.su-heading {
|
7 |
-
margin: 0 0 1.5em 0;
|
8 |
-
padding: 2px 0;
|
9 |
-
border-top: 1px solid #999;
|
10 |
-
border-bottom: 1px solid #999;
|
11 |
-
}
|
12 |
-
.su-heading-inner {
|
13 |
-
padding: 1em 0.5em;
|
14 |
-
border-top: 4px solid #eee;
|
15 |
-
border-bottom: 4px solid #eee;
|
16 |
-
}
|
17 |
-
.su-heading-align-left { text-align: left }
|
18 |
-
.su-heading-align-center { text-align: center }
|
19 |
-
.su-heading-align-right { text-align: right }
|
20 |
-
|
21 |
-
/* Divider
|
22 |
-
---------------------------------------------------------------*/
|
23 |
-
|
24 |
-
.su-divider {
|
25 |
-
clear: both;
|
26 |
-
position: relative;
|
27 |
-
height: 3px;
|
28 |
-
margin: 2.5em 0 1.5em 0;
|
29 |
-
background: #999;
|
30 |
-
}
|
31 |
-
.su-divider a {
|
32 |
-
position: absolute;
|
33 |
-
right: 0;
|
34 |
-
bottom: 5px;
|
35 |
-
display: inline-block;
|
36 |
-
color: #777;
|
37 |
-
font-size: 0.8em;
|
38 |
-
text-decoration: none;
|
39 |
-
}
|
40 |
-
|
41 |
-
/* Spacer
|
42 |
-
---------------------------------------------------------------*/
|
43 |
-
|
44 |
-
.su-spacer {
|
45 |
-
display: block;
|
46 |
-
height: 0;
|
47 |
-
clear: both;
|
48 |
-
overflow: hidden;
|
49 |
-
}
|
50 |
-
.su-spacer-5 { height: 5px }
|
51 |
-
.su-spacer-10 { height: 10px }
|
52 |
-
.su-spacer-20 { height: 20px }
|
53 |
-
.su-spacer-30 { height: 30px }
|
54 |
-
.su-spacer-40 { height: 40px }
|
55 |
-
|
56 |
-
/* Highlight
|
57 |
-
---------------------------------------------------------------*/
|
58 |
-
|
59 |
-
.su-highlight {
|
60 |
-
display: inline;
|
61 |
-
padding: 1px 0;
|
62 |
-
}
|
63 |
-
|
64 |
-
/* Label
|
65 |
-
---------------------------------------------------------------*/
|
66 |
-
|
67 |
-
.su-label {
|
68 |
-
display: inline;
|
69 |
-
margin-right: 0.3em;
|
70 |
-
padding: 0.1em 0.3em;
|
71 |
-
font-size: 0.8em;
|
72 |
-
height: 0.8em;
|
73 |
-
line-height: 0.8em;
|
74 |
-
color: #fff;
|
75 |
-
border-radius: 3px;
|
76 |
-
-moz-border-radius: 3px;
|
77 |
-
-webkit-border-radius: 3px;
|
78 |
-
}
|
79 |
-
.su-label-type-default { background: #999 }
|
80 |
-
.su-label-type-success { background: #090 }
|
81 |
-
.su-label-type-warning { background: #f90 }
|
82 |
-
.su-label-type-important { background: #f03 }
|
83 |
-
.su-label-type-black { background: #111 }
|
84 |
-
.su-label-type-info { background: #09c }
|
85 |
-
|
86 |
-
/* Dropcap
|
87 |
-
---------------------------------------------------------------*/
|
88 |
-
|
89 |
-
.su-dropcap {
|
90 |
-
float: left;
|
91 |
-
display: inline-block;
|
92 |
-
width: 2em;
|
93 |
-
height: 2em;
|
94 |
-
margin: 0.2em 0.5em 0.2em 0;
|
95 |
-
line-height: 2em;
|
96 |
-
text-align: center;
|
97 |
-
overflow: hidden;
|
98 |
-
text-transform: uppercase;
|
99 |
-
}
|
100 |
-
.su-dropcap-style-default {
|
101 |
-
color: #fff;
|
102 |
-
background: rgb(69, 72, 77); /* Old browsers */
|
103 |
-
background: -moz-linear-gradient(top, rgba(69, 72, 77, 1) 0%, rgba(0, 0, 0, 1) 100%); /* FF3.6+ */
|
104 |
-
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, rgba(69, 72, 77, 1)), color-stop(100%, rgba(0, 0, 0, 1))); /* Chrome,Safari4+ */
|
105 |
-
background: -webkit-linear-gradient(top, rgba(69, 72, 77, 1) 0%, rgba(0, 0, 0, 1) 100%); /* Chrome10+,Safari5.1+ */
|
106 |
-
background: -o-linear-gradient(top, rgba(69, 72, 77, 1) 0%, rgba(0, 0, 0, 1) 100%); /* Opera 11.10+ */
|
107 |
-
background: -ms-linear-gradient(top, rgba(69, 72, 77, 1) 0%, rgba(0, 0, 0, 1) 100%); /* IE10+ */
|
108 |
-
background: linear-gradient(to bottom, rgba(69, 72, 77, 1) 0%, rgba(0, 0, 0, 1) 100%); /* W3C */
|
109 |
-
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#45484d', endColorstr='#000000', GradientType=0); /* IE6-9 */
|
110 |
-
text-shadow: -1px -1px 0 #000;
|
111 |
-
-moz-text-shadow: -1px -1px 0 #000;
|
112 |
-
-webkit-text-shadow: -1px -1px 0 #000;
|
113 |
-
border-radius: 50%;
|
114 |
-
-moz-border-radius: 50%;
|
115 |
-
-webkit-border-radius: 50%;
|
116 |
-
}
|
117 |
-
.su-dropcap-style-flat {
|
118 |
-
background: #444;
|
119 |
-
color: #fff;
|
120 |
-
}
|
121 |
-
.su-dropcap-style-light {
|
122 |
-
color: #333;
|
123 |
-
border-radius: 50%;
|
124 |
-
-moz-border-radius: 50%;
|
125 |
-
-webkit-border-radius: 50%;
|
126 |
-
background: rgb(255, 255, 255); /* Old browsers */
|
127 |
-
background: -moz-linear-gradient(top, rgba(255, 255, 255, 1) 0%, rgba(234, 234, 234, 1) 100%); /* FF3.6+ */
|
128 |
-
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, rgba(255, 255, 255, 1)), color-stop(100%, rgba(234, 234, 234, 1))); /* Chrome,Safari4+ */
|
129 |
-
background: -webkit-linear-gradient(top, rgba(255, 255, 255, 1) 0%, rgba(234, 234, 234, 1) 100%); /* Chrome10+,Safari5.1+ */
|
130 |
-
background: -o-linear-gradient(top, rgba(255, 255, 255, 1) 0%, rgba(234, 234, 234, 1) 100%); /* Opera 11.10+ */
|
131 |
-
background: -ms-linear-gradient(top, rgba(255, 255, 255, 1) 0%, rgba(234, 234, 234, 1) 100%); /* IE10+ */
|
132 |
-
background: linear-gradient(to bottom, rgba(255, 255, 255, 1) 0%, rgba(234, 234, 234, 1) 100%); /* W3C */
|
133 |
-
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#eaeaea', GradientType=0); /* IE6-9 */
|
134 |
-
}
|
135 |
-
.su-dropcap-style-simple {
|
136 |
-
width: 1em;
|
137 |
-
height: 1em;
|
138 |
-
line-height: 1em;
|
139 |
-
text-align: left;
|
140 |
-
}
|
141 |
-
|
142 |
-
/* List
|
143 |
-
---------------------------------------------------------------*/
|
144 |
-
|
145 |
-
.su-list ul {
|
146 |
-
list-style: none !important;
|
147 |
-
margin: 0 0 1.5em 0 !important;
|
148 |
-
padding: 0 !important;
|
149 |
-
}
|
150 |
-
.su-list ul li {
|
151 |
-
list-style-type: none !important;
|
152 |
-
display: block !important;
|
153 |
-
margin: 0 !important;
|
154 |
-
padding: 0.15em 0 0.15em 26px !important;
|
155 |
-
}
|
156 |
-
.su-list-style-star li { background: 0 50% url('../images/lists/list-style-star.png') no-repeat !important }
|
157 |
-
.su-list-style-arrow li { background: 0 50% url('../images/lists/list-style-arrow.png') no-repeat !important }
|
158 |
-
.su-list-style-check li { background: 0 50% url('../images/lists/list-style-check.png') no-repeat !important }
|
159 |
-
.su-list-style-cross li { background: 0 50% url('../images/lists/list-style-cross.png') no-repeat !important }
|
160 |
-
.su-list-style-thumbs li { background: 0 50% url('../images/lists/list-style-thumbs.png') no-repeat !important }
|
161 |
-
.su-list-style-link li { background: 0 50% url('../images/lists/list-style-link.png') no-repeat !important }
|
162 |
-
.su-list-style-gear li { background: 0 50% url('../images/lists/list-style-gear.png') no-repeat !important }
|
163 |
-
.su-list-style-time li { background: 0 50% url('../images/lists/list-style-time.png') no-repeat !important }
|
164 |
-
.su-list-style-note li { background: 0 50% url('../images/lists/list-style-note.png') no-repeat !important }
|
165 |
-
.su-list-style-plus li { background: 0 50% url('../images/lists/list-style-plus.png') no-repeat !important }
|
166 |
-
.su-list-style-guard li { background: 0 50% url('../images/lists/list-style-guard.png') no-repeat !important }
|
167 |
-
.su-list-style-event li { background: 0 50% url('../images/lists/list-style-event.png') no-repeat !important }
|
168 |
-
.su-list-style-idea li { background: 0 50% url('../images/lists/list-style-idea.png') no-repeat !important }
|
169 |
-
.su-list-style-settings li { background: 0 50% url('../images/lists/list-style-settings.png') no-repeat !important }
|
170 |
-
.su-list-style-twitter li { background: 0 50% url('../images/lists/list-style-twitter.png') no-repeat !important }
|
171 |
-
.su-list-style-check li.x { background: 0 50% url('../images/lists/list-style-cross.png') no-repeat !important }
|
172 |
-
.su-list-style-cross li.v { background: 0 50% url('../images/lists/list-style-check.png') no-repeat !important }
|
173 |
-
|
174 |
-
/* Button
|
175 |
-
---------------------------------------------------------------*/
|
176 |
-
|
177 |
-
.su-button {
|
178 |
-
display: inline-block;
|
179 |
-
text-align: center;
|
180 |
-
text-decoration: none !important;
|
181 |
-
box-sizing: content-box !important;
|
182 |
-
-moz-box-sizing: content-box !important;
|
183 |
-
-webkit-box-sizing: content-box !important;
|
184 |
-
transition: all .2s;
|
185 |
-
-o-transition: all .2s;
|
186 |
-
-ie-transition: all .2s;
|
187 |
-
-moz-transition: all .2s;
|
188 |
-
-webkit-transition: all .2s;
|
189 |
-
}
|
190 |
-
.su-button-wide { display: block }
|
191 |
-
.su-button span {
|
192 |
-
display: block !important;
|
193 |
-
text-decoration: none !important;
|
194 |
-
box-sizing: content-box !important;
|
195 |
-
-moz-box-sizing: content-box !important;
|
196 |
-
-webkit-box-sizing: content-box !important;
|
197 |
-
transition: all .2s;
|
198 |
-
-o-transition: all .2s;
|
199 |
-
-ie-transition: all .2s;
|
200 |
-
-moz-transition: all .2s;
|
201 |
-
-webkit-transition: all .2s;
|
202 |
-
}
|
203 |
-
.su-button img {
|
204 |
-
border: none !important;
|
205 |
-
vertical-align: middle !important;
|
206 |
-
margin: -0.2em 0.4em 0 -0.3em !important;
|
207 |
-
box-shadow: none !important;
|
208 |
-
-moz-box-shadow: none !important;
|
209 |
-
-webkit-box-shadow: none !important;
|
210 |
-
}
|
211 |
-
.su-button.su-button-float-icon img { margin: 0 0.5em !important }
|
212 |
-
.su-button small {
|
213 |
-
display: block;
|
214 |
-
margin: -0.2em 0 0 0;
|
215 |
-
color: inherit;
|
216 |
-
text-align: center;
|
217 |
-
font-style: normal;
|
218 |
-
font-size: 0.8em;
|
219 |
-
line-height: 1;
|
220 |
-
opacity: 0.7;
|
221 |
-
filter: alpha(opacity=70);
|
222 |
-
}
|
223 |
-
.su-button-style-default {
|
224 |
-
border-width: 1px;
|
225 |
-
border-style: solid;
|
226 |
-
}
|
227 |
-
.su-button-style-default:hover {
|
228 |
-
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";
|
229 |
-
filter: alpha(opacity=70);
|
230 |
-
-moz-opacity: 0.7;
|
231 |
-
-khtml-opacity: 0.7;
|
232 |
-
opacity: 0.7;
|
233 |
-
}
|
234 |
-
.su-button-style-default span {
|
235 |
-
border-top-width: 1px;
|
236 |
-
border-bottom-width: 1px;
|
237 |
-
border-top-style: solid;
|
238 |
-
border-bottom-style: solid;
|
239 |
-
}
|
240 |
-
.su-button-style-flat,
|
241 |
-
.su-button-style-flat span { border: none }
|
242 |
-
.su-button-style-flat span { position: relative }
|
243 |
-
.su-button-style-flat:hover span { top: 1px }
|
244 |
-
.su-button-style-soft span { background: 0 -20px url('../images/styles/style-soft.png') repeat-x }
|
245 |
-
.su-button-style-soft:hover span { background: 0 0 url('../images/styles/style-soft.png') repeat-x }
|
246 |
-
.su-button-style-glass span { background: 0 50% url('../images/styles/style-glass.png') repeat-x }
|
247 |
-
.su-button-style-glass:hover span { background: 100% 50% url('../images/styles/style-glass.png') repeat-x }
|
248 |
-
.su-button-style-bubbles span { background: 0 50% url('../images/styles/style-bubbles.png') no-repeat }
|
249 |
-
.su-button-style-bubbles:hover span { background: -710px 50% url('../images/styles/style-bubbles.png') no-repeat }
|
250 |
-
.su-button-style-noise span { background: 0 0 url('../images/styles/style-noise.png') repeat-x }
|
251 |
-
.su-button-style-noise:hover span { background: 0 0 url('../images/styles/style-noise.png') repeat-x }
|
252 |
-
.su-button-style-stroked span {
|
253 |
-
margin: 1px;
|
254 |
-
border: 1px dashed #fff !important;
|
255 |
-
}
|
256 |
-
.su-button-style-stroked:hover span {
|
257 |
-
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";
|
258 |
-
filter: alpha(opacity=70);
|
259 |
-
-moz-opacity: 0.7;
|
260 |
-
-khtml-opacity: 0.7;
|
261 |
-
opacity: 0.7;
|
262 |
-
}
|
263 |
-
.su-button-style-3d {
|
264 |
-
border-bottom-style: solid;
|
265 |
-
border-bottom-width: 6px;
|
266 |
-
}
|
267 |
-
.su-button-style-3d span {
|
268 |
-
border-bottom-style: solid;
|
269 |
-
border-bottom-width: 1px;
|
270 |
-
}
|
271 |
-
.su-button-style-3d:hover {
|
272 |
-
position: relative;
|
273 |
-
top: 3px;
|
274 |
-
border-bottom-width: 3px;
|
275 |
-
}
|
276 |
-
|
277 |
-
/* Table
|
278 |
-
---------------------------------------------------------------*/
|
279 |
-
|
280 |
-
.su-table table {
|
281 |
-
width: 100% !important;
|
282 |
-
margin: 0 0 1.5em 0 !important;
|
283 |
-
border-collapse: collapse !important;
|
284 |
-
font-size: 1em !important;
|
285 |
-
border: 1px solid #ccc !important;
|
286 |
-
}
|
287 |
-
.su-table th {
|
288 |
-
text-align: center !important;
|
289 |
-
padding: 1em !important;
|
290 |
-
font-size: 1em !important;
|
291 |
-
font-weight: normal !important;
|
292 |
-
color: #333 !important;
|
293 |
-
border: 1px solid #ccc !important;
|
294 |
-
background: #f0f0f0 !important;
|
295 |
-
}
|
296 |
-
.su-table td {
|
297 |
-
padding: 0.5em 1em !important;
|
298 |
-
border: 1px solid #ccc !important;
|
299 |
-
background: #fff !important;
|
300 |
-
}
|
301 |
.su-table .su-even td { background: #f7f7f7 !important }
|
1 |
+
/*** Shortcodes Ultimate - content elements ***/
|
2 |
+
|
3 |
+
/* Heading
|
4 |
+
---------------------------------------------------------------*/
|
5 |
+
|
6 |
+
.su-heading {
|
7 |
+
margin: 0 0 1.5em 0;
|
8 |
+
padding: 2px 0;
|
9 |
+
border-top: 1px solid #999;
|
10 |
+
border-bottom: 1px solid #999;
|
11 |
+
}
|
12 |
+
.su-heading-inner {
|
13 |
+
padding: 1em 0.5em;
|
14 |
+
border-top: 4px solid #eee;
|
15 |
+
border-bottom: 4px solid #eee;
|
16 |
+
}
|
17 |
+
.su-heading-align-left { text-align: left }
|
18 |
+
.su-heading-align-center { text-align: center }
|
19 |
+
.su-heading-align-right { text-align: right }
|
20 |
+
|
21 |
+
/* Divider
|
22 |
+
---------------------------------------------------------------*/
|
23 |
+
|
24 |
+
.su-divider {
|
25 |
+
clear: both;
|
26 |
+
position: relative;
|
27 |
+
height: 3px;
|
28 |
+
margin: 2.5em 0 1.5em 0;
|
29 |
+
background: #999;
|
30 |
+
}
|
31 |
+
.su-divider a {
|
32 |
+
position: absolute;
|
33 |
+
right: 0;
|
34 |
+
bottom: 5px;
|
35 |
+
display: inline-block;
|
36 |
+
color: #777;
|
37 |
+
font-size: 0.8em;
|
38 |
+
text-decoration: none;
|
39 |
+
}
|
40 |
+
|
41 |
+
/* Spacer
|
42 |
+
---------------------------------------------------------------*/
|
43 |
+
|
44 |
+
.su-spacer {
|
45 |
+
display: block;
|
46 |
+
height: 0;
|
47 |
+
clear: both;
|
48 |
+
overflow: hidden;
|
49 |
+
}
|
50 |
+
.su-spacer-5 { height: 5px }
|
51 |
+
.su-spacer-10 { height: 10px }
|
52 |
+
.su-spacer-20 { height: 20px }
|
53 |
+
.su-spacer-30 { height: 30px }
|
54 |
+
.su-spacer-40 { height: 40px }
|
55 |
+
|
56 |
+
/* Highlight
|
57 |
+
---------------------------------------------------------------*/
|
58 |
+
|
59 |
+
.su-highlight {
|
60 |
+
display: inline;
|
61 |
+
padding: 1px 0;
|
62 |
+
}
|
63 |
+
|
64 |
+
/* Label
|
65 |
+
---------------------------------------------------------------*/
|
66 |
+
|
67 |
+
.su-label {
|
68 |
+
display: inline;
|
69 |
+
margin-right: 0.3em;
|
70 |
+
padding: 0.1em 0.3em;
|
71 |
+
font-size: 0.8em;
|
72 |
+
height: 0.8em;
|
73 |
+
line-height: 0.8em;
|
74 |
+
color: #fff;
|
75 |
+
border-radius: 3px;
|
76 |
+
-moz-border-radius: 3px;
|
77 |
+
-webkit-border-radius: 3px;
|
78 |
+
}
|
79 |
+
.su-label-type-default { background: #999 }
|
80 |
+
.su-label-type-success { background: #090 }
|
81 |
+
.su-label-type-warning { background: #f90 }
|
82 |
+
.su-label-type-important { background: #f03 }
|
83 |
+
.su-label-type-black { background: #111 }
|
84 |
+
.su-label-type-info { background: #09c }
|
85 |
+
|
86 |
+
/* Dropcap
|
87 |
+
---------------------------------------------------------------*/
|
88 |
+
|
89 |
+
.su-dropcap {
|
90 |
+
float: left;
|
91 |
+
display: inline-block;
|
92 |
+
width: 2em;
|
93 |
+
height: 2em;
|
94 |
+
margin: 0.2em 0.5em 0.2em 0;
|
95 |
+
line-height: 2em;
|
96 |
+
text-align: center;
|
97 |
+
overflow: hidden;
|
98 |
+
text-transform: uppercase;
|
99 |
+
}
|
100 |
+
.su-dropcap-style-default {
|
101 |
+
color: #fff;
|
102 |
+
background: rgb(69, 72, 77); /* Old browsers */
|
103 |
+
background: -moz-linear-gradient(top, rgba(69, 72, 77, 1) 0%, rgba(0, 0, 0, 1) 100%); /* FF3.6+ */
|
104 |
+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, rgba(69, 72, 77, 1)), color-stop(100%, rgba(0, 0, 0, 1))); /* Chrome,Safari4+ */
|
105 |
+
background: -webkit-linear-gradient(top, rgba(69, 72, 77, 1) 0%, rgba(0, 0, 0, 1) 100%); /* Chrome10+,Safari5.1+ */
|
106 |
+
background: -o-linear-gradient(top, rgba(69, 72, 77, 1) 0%, rgba(0, 0, 0, 1) 100%); /* Opera 11.10+ */
|
107 |
+
background: -ms-linear-gradient(top, rgba(69, 72, 77, 1) 0%, rgba(0, 0, 0, 1) 100%); /* IE10+ */
|
108 |
+
background: linear-gradient(to bottom, rgba(69, 72, 77, 1) 0%, rgba(0, 0, 0, 1) 100%); /* W3C */
|
109 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#45484d', endColorstr='#000000', GradientType=0); /* IE6-9 */
|
110 |
+
text-shadow: -1px -1px 0 #000;
|
111 |
+
-moz-text-shadow: -1px -1px 0 #000;
|
112 |
+
-webkit-text-shadow: -1px -1px 0 #000;
|
113 |
+
border-radius: 50%;
|
114 |
+
-moz-border-radius: 50%;
|
115 |
+
-webkit-border-radius: 50%;
|
116 |
+
}
|
117 |
+
.su-dropcap-style-flat {
|
118 |
+
background: #444;
|
119 |
+
color: #fff;
|
120 |
+
}
|
121 |
+
.su-dropcap-style-light {
|
122 |
+
color: #333;
|
123 |
+
border-radius: 50%;
|
124 |
+
-moz-border-radius: 50%;
|
125 |
+
-webkit-border-radius: 50%;
|
126 |
+
background: rgb(255, 255, 255); /* Old browsers */
|
127 |
+
background: -moz-linear-gradient(top, rgba(255, 255, 255, 1) 0%, rgba(234, 234, 234, 1) 100%); /* FF3.6+ */
|
128 |
+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, rgba(255, 255, 255, 1)), color-stop(100%, rgba(234, 234, 234, 1))); /* Chrome,Safari4+ */
|
129 |
+
background: -webkit-linear-gradient(top, rgba(255, 255, 255, 1) 0%, rgba(234, 234, 234, 1) 100%); /* Chrome10+,Safari5.1+ */
|
130 |
+
background: -o-linear-gradient(top, rgba(255, 255, 255, 1) 0%, rgba(234, 234, 234, 1) 100%); /* Opera 11.10+ */
|
131 |
+
background: -ms-linear-gradient(top, rgba(255, 255, 255, 1) 0%, rgba(234, 234, 234, 1) 100%); /* IE10+ */
|
132 |
+
background: linear-gradient(to bottom, rgba(255, 255, 255, 1) 0%, rgba(234, 234, 234, 1) 100%); /* W3C */
|
133 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#eaeaea', GradientType=0); /* IE6-9 */
|
134 |
+
}
|
135 |
+
.su-dropcap-style-simple {
|
136 |
+
width: 1em;
|
137 |
+
height: 1em;
|
138 |
+
line-height: 1em;
|
139 |
+
text-align: left;
|
140 |
+
}
|
141 |
+
|
142 |
+
/* List
|
143 |
+
---------------------------------------------------------------*/
|
144 |
+
|
145 |
+
.su-list ul {
|
146 |
+
list-style: none !important;
|
147 |
+
margin: 0 0 1.5em 0 !important;
|
148 |
+
padding: 0 !important;
|
149 |
+
}
|
150 |
+
.su-list ul li {
|
151 |
+
list-style-type: none !important;
|
152 |
+
display: block !important;
|
153 |
+
margin: 0 !important;
|
154 |
+
padding: 0.15em 0 0.15em 26px !important;
|
155 |
+
}
|
156 |
+
.su-list-style-star li { background: 0 50% url('../images/lists/list-style-star.png') no-repeat !important }
|
157 |
+
.su-list-style-arrow li { background: 0 50% url('../images/lists/list-style-arrow.png') no-repeat !important }
|
158 |
+
.su-list-style-check li { background: 0 50% url('../images/lists/list-style-check.png') no-repeat !important }
|
159 |
+
.su-list-style-cross li { background: 0 50% url('../images/lists/list-style-cross.png') no-repeat !important }
|
160 |
+
.su-list-style-thumbs li { background: 0 50% url('../images/lists/list-style-thumbs.png') no-repeat !important }
|
161 |
+
.su-list-style-link li { background: 0 50% url('../images/lists/list-style-link.png') no-repeat !important }
|
162 |
+
.su-list-style-gear li { background: 0 50% url('../images/lists/list-style-gear.png') no-repeat !important }
|
163 |
+
.su-list-style-time li { background: 0 50% url('../images/lists/list-style-time.png') no-repeat !important }
|
164 |
+
.su-list-style-note li { background: 0 50% url('../images/lists/list-style-note.png') no-repeat !important }
|
165 |
+
.su-list-style-plus li { background: 0 50% url('../images/lists/list-style-plus.png') no-repeat !important }
|
166 |
+
.su-list-style-guard li { background: 0 50% url('../images/lists/list-style-guard.png') no-repeat !important }
|
167 |
+
.su-list-style-event li { background: 0 50% url('../images/lists/list-style-event.png') no-repeat !important }
|
168 |
+
.su-list-style-idea li { background: 0 50% url('../images/lists/list-style-idea.png') no-repeat !important }
|
169 |
+
.su-list-style-settings li { background: 0 50% url('../images/lists/list-style-settings.png') no-repeat !important }
|
170 |
+
.su-list-style-twitter li { background: 0 50% url('../images/lists/list-style-twitter.png') no-repeat !important }
|
171 |
+
.su-list-style-check li.x { background: 0 50% url('../images/lists/list-style-cross.png') no-repeat !important }
|
172 |
+
.su-list-style-cross li.v { background: 0 50% url('../images/lists/list-style-check.png') no-repeat !important }
|
173 |
+
|
174 |
+
/* Button
|
175 |
+
---------------------------------------------------------------*/
|
176 |
+
|
177 |
+
.su-button {
|
178 |
+
display: inline-block;
|
179 |
+
text-align: center;
|
180 |
+
text-decoration: none !important;
|
181 |
+
box-sizing: content-box !important;
|
182 |
+
-moz-box-sizing: content-box !important;
|
183 |
+
-webkit-box-sizing: content-box !important;
|
184 |
+
transition: all .2s;
|
185 |
+
-o-transition: all .2s;
|
186 |
+
-ie-transition: all .2s;
|
187 |
+
-moz-transition: all .2s;
|
188 |
+
-webkit-transition: all .2s;
|
189 |
+
}
|
190 |
+
.su-button-wide { display: block }
|
191 |
+
.su-button span {
|
192 |
+
display: block !important;
|
193 |
+
text-decoration: none !important;
|
194 |
+
box-sizing: content-box !important;
|
195 |
+
-moz-box-sizing: content-box !important;
|
196 |
+
-webkit-box-sizing: content-box !important;
|
197 |
+
transition: all .2s;
|
198 |
+
-o-transition: all .2s;
|
199 |
+
-ie-transition: all .2s;
|
200 |
+
-moz-transition: all .2s;
|
201 |
+
-webkit-transition: all .2s;
|
202 |
+
}
|
203 |
+
.su-button img {
|
204 |
+
border: none !important;
|
205 |
+
vertical-align: middle !important;
|
206 |
+
margin: -0.2em 0.4em 0 -0.3em !important;
|
207 |
+
box-shadow: none !important;
|
208 |
+
-moz-box-shadow: none !important;
|
209 |
+
-webkit-box-shadow: none !important;
|
210 |
+
}
|
211 |
+
.su-button.su-button-float-icon img { margin: 0 0.5em !important }
|
212 |
+
.su-button small {
|
213 |
+
display: block;
|
214 |
+
margin: -0.2em 0 0 0;
|
215 |
+
color: inherit;
|
216 |
+
text-align: center;
|
217 |
+
font-style: normal;
|
218 |
+
font-size: 0.8em;
|
219 |
+
line-height: 1;
|
220 |
+
opacity: 0.7;
|
221 |
+
filter: alpha(opacity=70);
|
222 |
+
}
|
223 |
+
.su-button-style-default {
|
224 |
+
border-width: 1px;
|
225 |
+
border-style: solid;
|
226 |
+
}
|
227 |
+
.su-button-style-default:hover {
|
228 |
+
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";
|
229 |
+
filter: alpha(opacity=70);
|
230 |
+
-moz-opacity: 0.7;
|
231 |
+
-khtml-opacity: 0.7;
|
232 |
+
opacity: 0.7;
|
233 |
+
}
|
234 |
+
.su-button-style-default span {
|
235 |
+
border-top-width: 1px;
|
236 |
+
border-bottom-width: 1px;
|
237 |
+
border-top-style: solid;
|
238 |
+
border-bottom-style: solid;
|
239 |
+
}
|
240 |
+
.su-button-style-flat,
|
241 |
+
.su-button-style-flat span { border: none }
|
242 |
+
.su-button-style-flat span { position: relative }
|
243 |
+
.su-button-style-flat:hover span { top: 1px }
|
244 |
+
.su-button-style-soft span { background: 0 -20px url('../images/styles/style-soft.png') repeat-x }
|
245 |
+
.su-button-style-soft:hover span { background: 0 0 url('../images/styles/style-soft.png') repeat-x }
|
246 |
+
.su-button-style-glass span { background: 0 50% url('../images/styles/style-glass.png') repeat-x }
|
247 |
+
.su-button-style-glass:hover span { background: 100% 50% url('../images/styles/style-glass.png') repeat-x }
|
248 |
+
.su-button-style-bubbles span { background: 0 50% url('../images/styles/style-bubbles.png') no-repeat }
|
249 |
+
.su-button-style-bubbles:hover span { background: -710px 50% url('../images/styles/style-bubbles.png') no-repeat }
|
250 |
+
.su-button-style-noise span { background: 0 0 url('../images/styles/style-noise.png') repeat-x }
|
251 |
+
.su-button-style-noise:hover span { background: 0 0 url('../images/styles/style-noise.png') repeat-x }
|
252 |
+
.su-button-style-stroked span {
|
253 |
+
margin: 1px;
|
254 |
+
border: 1px dashed #fff !important;
|
255 |
+
}
|
256 |
+
.su-button-style-stroked:hover span {
|
257 |
+
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";
|
258 |
+
filter: alpha(opacity=70);
|
259 |
+
-moz-opacity: 0.7;
|
260 |
+
-khtml-opacity: 0.7;
|
261 |
+
opacity: 0.7;
|
262 |
+
}
|
263 |
+
.su-button-style-3d {
|
264 |
+
border-bottom-style: solid;
|
265 |
+
border-bottom-width: 6px;
|
266 |
+
}
|
267 |
+
.su-button-style-3d span {
|
268 |
+
border-bottom-style: solid;
|
269 |
+
border-bottom-width: 1px;
|
270 |
+
}
|
271 |
+
.su-button-style-3d:hover {
|
272 |
+
position: relative;
|
273 |
+
top: 3px;
|
274 |
+
border-bottom-width: 3px;
|
275 |
+
}
|
276 |
+
|
277 |
+
/* Table
|
278 |
+
---------------------------------------------------------------*/
|
279 |
+
|
280 |
+
.su-table table {
|
281 |
+
width: 100% !important;
|
282 |
+
margin: 0 0 1.5em 0 !important;
|
283 |
+
border-collapse: collapse !important;
|
284 |
+
font-size: 1em !important;
|
285 |
+
border: 1px solid #ccc !important;
|
286 |
+
}
|
287 |
+
.su-table th {
|
288 |
+
text-align: center !important;
|
289 |
+
padding: 1em !important;
|
290 |
+
font-size: 1em !important;
|
291 |
+
font-weight: normal !important;
|
292 |
+
color: #333 !important;
|
293 |
+
border: 1px solid #ccc !important;
|
294 |
+
background: #f0f0f0 !important;
|
295 |
+
}
|
296 |
+
.su-table td {
|
297 |
+
padding: 0.5em 1em !important;
|
298 |
+
border: 1px solid #ccc !important;
|
299 |
+
background: #fff !important;
|
300 |
+
}
|
301 |
.su-table .su-even td { background: #f7f7f7 !important }
|
assets/css/galleries-shortcodes.css
CHANGED
@@ -1,455 +1,455 @@
|
|
1 |
-
/*** Shortcodes Ultimate - galleries elements ***/
|
2 |
-
|
3 |
-
.su-slider {
|
4 |
-
position: relative;
|
5 |
-
margin-bottom: 1.5em;
|
6 |
-
overflow: hidden;
|
7 |
-
-webkit-backface-visibility: hidden;
|
8 |
-
-moz-backface-visibility: hidden;
|
9 |
-
-ms-backface-visibility: hidden;
|
10 |
-
-o-backface-visibility: hidden;
|
11 |
-
backface-visibility: hidden;
|
12 |
-
z-index: 1;
|
13 |
-
}
|
14 |
-
.su-slider-centered { margin: 0 auto 1.5em auto }
|
15 |
-
.su-slider-slides {
|
16 |
-
position: relative;
|
17 |
-
width: 100%;
|
18 |
-
-webkit-transition-property: -webkit-transform, left, top;
|
19 |
-
-webkit-transition-duration: 0s;
|
20 |
-
-webkit-transform: translate3d(0px, 0, 0);
|
21 |
-
-webkit-transition-timing-function: ease;
|
22 |
-
-moz-transition-property: -moz-transform, left, top;
|
23 |
-
-moz-transition-duration: 0s;
|
24 |
-
-moz-transform: translate3d(0px, 0, 0);
|
25 |
-
-moz-transition-timing-function: ease;
|
26 |
-
-o-transition-property: -o-transform, left, top;
|
27 |
-
-o-transition-duration: 0s;
|
28 |
-
-o-transform: translate3d(0px, 0, 0);
|
29 |
-
-o-transition-timing-function: ease;
|
30 |
-
-o-transform: translate(0px, 0px);
|
31 |
-
-ms-transition-property: -ms-transform, left, top;
|
32 |
-
-ms-transition-duration: 0s;
|
33 |
-
-ms-transform: translate3d(0px, 0, 0);
|
34 |
-
-ms-transition-timing-function: ease;
|
35 |
-
transition-property: transform, left, top;
|
36 |
-
transition-duration: 0s;
|
37 |
-
transform: translate3d(0px, 0, 0);
|
38 |
-
transition-timing-function: ease;
|
39 |
-
}
|
40 |
-
.swiper-free-mode > .su-slider-slides {
|
41 |
-
-webkit-transition-timing-function: ease-out;
|
42 |
-
-moz-transition-timing-function: ease-out;
|
43 |
-
-ms-transition-timing-function: ease-out;
|
44 |
-
-o-transition-timing-function: ease-out;
|
45 |
-
transition-timing-function: ease-out;
|
46 |
-
margin: 0 auto;
|
47 |
-
}
|
48 |
-
.su-slider-slide {
|
49 |
-
position: relative;
|
50 |
-
float: left;
|
51 |
-
}
|
52 |
-
.su-slider-slide > a,
|
53 |
-
.su-slider-slide > img,
|
54 |
-
.su-slider-slide > a > img {
|
55 |
-
position: relative;
|
56 |
-
display: block;
|
57 |
-
width: 100%;
|
58 |
-
height: 100%;
|
59 |
-
text-decoration: none;
|
60 |
-
}
|
61 |
-
.su-slider-responsive-yes .su-slider-slide > a,
|
62 |
-
.su-slider-responsive-yes .su-slider-slide > img,
|
63 |
-
.su-slider-responsive-yes .su-slider-slide > a > img { height: auto }
|
64 |
-
.su-slider-pages-no .su-slider-pagination { display: none }
|
65 |
-
.swiper-wp8-horizontal { -ms-touch-action: pan-y }
|
66 |
-
.swiper-wp8-vertical { -ms-touch-action: pan-x }
|
67 |
-
.su-slider-slide-title {
|
68 |
-
position: absolute;
|
69 |
-
left: 20px;
|
70 |
-
bottom: 20px;
|
71 |
-
display: block;
|
72 |
-
max-width: 90%;
|
73 |
-
padding: 5px 10px;
|
74 |
-
color: #fff;
|
75 |
-
line-height: 1.3;
|
76 |
-
background: rgb(0, 0, 0);
|
77 |
-
background: rgba(0, 0, 0, 0.5);
|
78 |
-
border-radius: 5px;
|
79 |
-
-moz-border-radius: 5px;
|
80 |
-
-webkit-border-radius: 5px;
|
81 |
-
box-sizing: border-box;
|
82 |
-
-moz-box-sizing: border-box;
|
83 |
-
-webkit-box-sizing: border-box;
|
84 |
-
filter: alpha(opacity=0);
|
85 |
-
opacity: 0;
|
86 |
-
transition: opacity 1s;
|
87 |
-
-o-transition: opacity 1s;
|
88 |
-
-ie-transition: opacity 1s;
|
89 |
-
-moz-transition: opacity 1s;
|
90 |
-
-webkit-transition: opacity 1s;
|
91 |
-
}
|
92 |
-
.su-slider-slide-visible .su-slider-slide-title {
|
93 |
-
filter: alpha(opacity=100);
|
94 |
-
opacity: 1;
|
95 |
-
}
|
96 |
-
.su-slider-prev,
|
97 |
-
.su-slider-next {
|
98 |
-
position: absolute;
|
99 |
-
top: 50%;
|
100 |
-
display: block;
|
101 |
-
width: 40px;
|
102 |
-
height: 40px;
|
103 |
-
margin-top: -20px !important;
|
104 |
-
background: rgb(0, 0, 0) 0 0 url('../images/swiper/default.png') no-repeat;
|
105 |
-
background-color: rgba(0, 0, 0, 0.5);
|
106 |
-
cursor: pointer;
|
107 |
-
border-radius: 50%;
|
108 |
-
-moz-border-radius: 50%;
|
109 |
-
-webkit-border-radius: 50%;
|
110 |
-
filter: alpha(opacity=0);
|
111 |
-
opacity: 0;
|
112 |
-
transition: all .2s;
|
113 |
-
-o-transition: all .2s;
|
114 |
-
-ie-transition: all .2s;
|
115 |
-
-moz-transition: all .2s;
|
116 |
-
-webkit-transition: all .2s;
|
117 |
-
}
|
118 |
-
.su-slider-prev {
|
119 |
-
right: 10px;
|
120 |
-
margin-right: 30px;
|
121 |
-
background-position: -40px 0;
|
122 |
-
}
|
123 |
-
.su-slider-next {
|
124 |
-
left: 10px;
|
125 |
-
margin-left: 30px;
|
126 |
-
background-position: 0 0;
|
127 |
-
}
|
128 |
-
.su-slider:hover .su-slider-prev,
|
129 |
-
.su-slider:hover .su-slider-next {
|
130 |
-
margin-left: 0;
|
131 |
-
margin-right: 0;
|
132 |
-
filter: alpha(opacity=70);
|
133 |
-
opacity: 0.7;
|
134 |
-
}
|
135 |
-
.su-slider .su-slider-prev:hover,
|
136 |
-
.su-slider .su-slider-next:hover {
|
137 |
-
filter: alpha(opacity=100);
|
138 |
-
opacity: 1;
|
139 |
-
}
|
140 |
-
.su-slider-pagination {
|
141 |
-
position: absolute;
|
142 |
-
left: 15%;
|
143 |
-
right: 15%;
|
144 |
-
top: 50%;
|
145 |
-
width: 70%;
|
146 |
-
height: 0;
|
147 |
-
margin-top: -7px;
|
148 |
-
text-align: center;
|
149 |
-
cursor: default;
|
150 |
-
filter: alpha(opacity=0);
|
151 |
-
opacity: 0;
|
152 |
-
transition: all .2s;
|
153 |
-
-o-transition: all .2s;
|
154 |
-
-ie-transition: all .2s;
|
155 |
-
-moz-transition: all .2s;
|
156 |
-
-webkit-transition: all .2s;
|
157 |
-
}
|
158 |
-
.su-slider:hover .su-slider-pagination {
|
159 |
-
bottom: 20px;
|
160 |
-
filter: alpha(opacity=100);
|
161 |
-
opacity: 1;
|
162 |
-
}
|
163 |
-
.su-slider-pagination span {
|
164 |
-
display: inline-block;
|
165 |
-
width: 14px;
|
166 |
-
height: 14px;
|
167 |
-
margin: 0;
|
168 |
-
background: rgb(0, 0, 0) 0 -999px url('../images/swiper/default.png') no-repeat;
|
169 |
-
background-color: rgba(0, 0, 0, 0.5);
|
170 |
-
cursor: pointer;
|
171 |
-
border-radius: 50%;
|
172 |
-
-moz-border-radius: 50%;
|
173 |
-
-webkit-border-radius: 50%;
|
174 |
-
transition: all .2s;
|
175 |
-
-o-transition: all .2s;
|
176 |
-
-ie-transition: all .2s;
|
177 |
-
-moz-transition: all .2s;
|
178 |
-
-webkit-transition: all .2s;
|
179 |
-
}
|
180 |
-
.su-slider:hover .su-slider-pagination span { margin: 0 3px }
|
181 |
-
.su-slider .su-slider-pagination span.swiper-visible-switch {
|
182 |
-
background-color: rgb(255, 255, 255);
|
183 |
-
background-color: rgba(255, 255, 255, 0.5);
|
184 |
-
}
|
185 |
-
.su-slider-pagination span:hover,
|
186 |
-
.su-slider-pagination span.swiper-active-switch { background-position: 0 -40px }
|
187 |
-
|
188 |
-
/* Carousel
|
189 |
-
---------------------------------------------------------------*/
|
190 |
-
|
191 |
-
.su-carousel {
|
192 |
-
position: relative;
|
193 |
-
margin-bottom: 1.5em;
|
194 |
-
overflow: hidden;
|
195 |
-
-webkit-backface-visibility: hidden;
|
196 |
-
-moz-backface-visibility: hidden;
|
197 |
-
-ms-backface-visibility: hidden;
|
198 |
-
-o-backface-visibility: hidden;
|
199 |
-
backface-visibility: hidden;
|
200 |
-
z-index: 1;
|
201 |
-
}
|
202 |
-
.su-carousel-centered { margin: 0 auto 1.5em auto }
|
203 |
-
.su-carousel-slides {
|
204 |
-
position: relative;
|
205 |
-
width: 100%;
|
206 |
-
-webkit-transition-property: -webkit-transform, left, top;
|
207 |
-
-webkit-transition-duration: 0s;
|
208 |
-
-webkit-transform: translate3d(0px, 0, 0);
|
209 |
-
-webkit-transition-timing-function: ease;
|
210 |
-
-moz-transition-property: -moz-transform, left, top;
|
211 |
-
-moz-transition-duration: 0s;
|
212 |
-
-moz-transform: translate3d(0px, 0, 0);
|
213 |
-
-moz-transition-timing-function: ease;
|
214 |
-
-o-transition-property: -o-transform, left, top;
|
215 |
-
-o-transition-duration: 0s;
|
216 |
-
-o-transform: translate3d(0px, 0, 0);
|
217 |
-
-o-transition-timing-function: ease;
|
218 |
-
-o-transform: translate(0px, 0px);
|
219 |
-
-ms-transition-property: -ms-transform, left, top;
|
220 |
-
-ms-transition-duration: 0s;
|
221 |
-
-ms-transform: translate3d(0px, 0, 0);
|
222 |
-
-ms-transition-timing-function: ease;
|
223 |
-
transition-property: transform, left, top;
|
224 |
-
transition-duration: 0s;
|
225 |
-
transform: translate3d(0px, 0, 0);
|
226 |
-
transition-timing-function: ease;
|
227 |
-
}
|
228 |
-
.swiper-free-mode > .su-carousel-slides {
|
229 |
-
-webkit-transition-timing-function: ease-out;
|
230 |
-
-moz-transition-timing-function: ease-out;
|
231 |
-
-ms-transition-timing-function: ease-out;
|
232 |
-
-o-transition-timing-function: ease-out;
|
233 |
-
transition-timing-function: ease-out;
|
234 |
-
margin: 0 auto;
|
235 |
-
}
|
236 |
-
.su-carousel-slide {
|
237 |
-
position: relative;
|
238 |
-
float: left;
|
239 |
-
}
|
240 |
-
.su-carousel-slide > a,
|
241 |
-
.su-carousel-slide > img,
|
242 |
-
.su-carousel-slide > a > img {
|
243 |
-
position: relative;
|
244 |
-
display: block;
|
245 |
-
width: 100%;
|
246 |
-
height: 100%;
|
247 |
-
text-decoration: none;
|
248 |
-
box-sizing: border-box;
|
249 |
-
-moz-box-sizing: border-box;
|
250 |
-
-webkit-box-sizing: border-box;
|
251 |
-
}
|
252 |
-
.su-carousel-responsive-yes .su-carousel-slide > a,
|
253 |
-
.su-carousel-responsive-yes .su-carousel-slide > img,
|
254 |
-
.su-carousel-responsive-yes .su-carousel-slide > a > img { height: auto }
|
255 |
-
.su-carousel-pages-no .su-carousel-pagination { display: none }
|
256 |
-
.swiper-wp8-horizontal { -ms-touch-action: pan-y }
|
257 |
-
.swiper-wp8-vertical { -ms-touch-action: pan-x }
|
258 |
-
.su-carousel { }
|
259 |
-
.su-carousel .su-carousel-slide a { padding: 0 5px }
|
260 |
-
.su-carousel .su-carousel-slide img {
|
261 |
-
padding: 3px;
|
262 |
-
border: 1px solid #ccc;
|
263 |
-
background: #fff;
|
264 |
-
border-radius: 5px;
|
265 |
-
-moz-border-radius: 5px;
|
266 |
-
-webkit-border-radius: 5px;
|
267 |
-
}
|
268 |
-
.su-carousel .su-carousel-slide-title {
|
269 |
-
position: absolute;
|
270 |
-
left: 9px;
|
271 |
-
right: 9px;
|
272 |
-
bottom: 4px;
|
273 |
-
display: block;
|
274 |
-
padding: 2px 3px;
|
275 |
-
color: #fff;
|
276 |
-
line-height: 1.2;
|
277 |
-
font-size: 11px;
|
278 |
-
background: rgb(0, 0, 0);
|
279 |
-
background: rgba(0, 0, 0, 0.5);
|
280 |
-
box-sizing: border-box;
|
281 |
-
-moz-box-sizing: border-box;
|
282 |
-
-webkit-box-sizing: border-box;
|
283 |
-
transition: opacity 1s;
|
284 |
-
-o-transition: opacity 1s;
|
285 |
-
-ie-transition: opacity 1s;
|
286 |
-
-moz-transition: opacity 1s;
|
287 |
-
-webkit-transition: opacity 1s;
|
288 |
-
}
|
289 |
-
.su-carousel .su-carousel-prev,
|
290 |
-
.su-carousel .su-carousel-next {
|
291 |
-
position: absolute;
|
292 |
-
top: 50%;
|
293 |
-
display: block;
|
294 |
-
width: 40px;
|
295 |
-
height: 40px;
|
296 |
-
margin-top: -20px;
|
297 |
-
background: rgb(0, 0, 0) 0 0 url('../images/swiper/default.png') no-repeat;
|
298 |
-
background-color: rgba(0, 0, 0, 0.5);
|
299 |
-
cursor: pointer;
|
300 |
-
border-radius: 50%;
|
301 |
-
-moz-border-radius: 50%;
|
302 |
-
-webkit-border-radius: 50%;
|
303 |
-
filter: alpha(opacity=0);
|
304 |
-
opacity: 0;
|
305 |
-
transition: all .2s;
|
306 |
-
-o-transition: all .2s;
|
307 |
-
-ie-transition: all .2s;
|
308 |
-
-moz-transition: all .2s;
|
309 |
-
-webkit-transition: all .2s;
|
310 |
-
}
|
311 |
-
.su-carousel .su-carousel-prev {
|
312 |
-
right: 20px;
|
313 |
-
margin-right: 40px;
|
314 |
-
background-position: -40px 0;
|
315 |
-
}
|
316 |
-
.su-carousel .su-carousel-next {
|
317 |
-
left: 20px;
|
318 |
-
margin-left: 40px;
|
319 |
-
background-position: 0 0;
|
320 |
-
}
|
321 |
-
.su-carousel:hover .su-carousel-prev,
|
322 |
-
.su-carousel:hover .su-carousel-next {
|
323 |
-
margin-left: 0;
|
324 |
-
margin-right: 0;
|
325 |
-
filter: alpha(opacity=70);
|
326 |
-
opacity: 0.7;
|
327 |
-
}
|
328 |
-
.su-carousel .su-carousel-prev:hover,
|
329 |
-
.su-carousel .su-carousel-next:hover {
|
330 |
-
filter: alpha(opacity=100);
|
331 |
-
opacity: 1;
|
332 |
-
}
|
333 |
-
.su-carousel .su-carousel-pagination {
|
334 |
-
position: absolute;
|
335 |
-
left: 15%;
|
336 |
-
right: 15%;
|
337 |
-
top: 50%;
|
338 |
-
width: 70%;
|
339 |
-
height: 0;
|
340 |
-
margin-top: -7px;
|
341 |
-
text-align: center;
|
342 |
-
cursor: default;
|
343 |
-
filter: alpha(opacity=0);
|
344 |
-
opacity: 0;
|
345 |
-
transition: all .2s;
|
346 |
-
-o-transition: all .2s;
|
347 |
-
-ie-transition: all .2s;
|
348 |
-
-moz-transition: all .2s;
|
349 |
-
-webkit-transition: all .2s;
|
350 |
-
}
|
351 |
-
.su-carousel:hover .su-carousel-pagination {
|
352 |
-
bottom: 20px;
|
353 |
-
filter: alpha(opacity=100);
|
354 |
-
opacity: 1;
|
355 |
-
}
|
356 |
-
.su-carousel .su-carousel-pagination span {
|
357 |
-
display: inline-block;
|
358 |
-
width: 14px;
|
359 |
-
height: 14px;
|
360 |
-
margin: 0;
|
361 |
-
background: rgb(0, 0, 0) 0 -999px url('../images/swiper/default.png') no-repeat;
|
362 |
-
background-color: rgba(0, 0, 0, 0.5);
|
363 |
-
cursor: pointer;
|
364 |
-
border-radius: 50%;
|
365 |
-
-moz-border-radius: 50%;
|
366 |
-
-webkit-border-radius: 50%;
|
367 |
-
transition: all .2s;
|
368 |
-
-o-transition: all .2s;
|
369 |
-
-ie-transition: all .2s;
|
370 |
-
-moz-transition: all .2s;
|
371 |
-
-webkit-transition: all .2s;
|
372 |
-
}
|
373 |
-
.su-carousel:hover .su-carousel-pagination span { margin: 0 3px }
|
374 |
-
.su-carousel .su-carousel-pagination span.swiper-visible-switch {
|
375 |
-
background-color: rgb(255, 255, 255);
|
376 |
-
background-color: rgba(255, 255, 255, 0.5);
|
377 |
-
}
|
378 |
-
.su-carousel .su-carousel-pagination span:hover,
|
379 |
-
.su-carousel .su-carousel-pagination span.swiper-active-switch { background-position: 0 -40px }
|
380 |
-
|
381 |
-
/* Custom gallery
|
382 |
-
---------------------------------------------------------------*/
|
383 |
-
|
384 |
-
.su-custom-gallery { margin-bottom: 1.5em }
|
385 |
-
.su-custom-gallery:after,
|
386 |
-
.su-custom-gallery:before {
|
387 |
-
content: "";
|
388 |
-
display: table;
|
389 |
-
}
|
390 |
-
.su-custom-gallery:after { clear: both }
|
391 |
-
.su-custom-gallery-slide {
|
392 |
-
position: relative;
|
393 |
-
float: left;
|
394 |
-
margin: 0.5em;
|
395 |
-
overflow: hidden;
|
396 |
-
}
|
397 |
-
.su-custom-gallery-slide a {
|
398 |
-
display: block;
|
399 |
-
width: 100%;
|
400 |
-
height: 100%;
|
401 |
-
}
|
402 |
-
.su-custom-gallery-slide img {
|
403 |
-
display: block;
|
404 |
-
margin: 0;
|
405 |
-
padding: 3px;
|
406 |
-
border: 1px solid #ccc;
|
407 |
-
background: #fff;
|
408 |
-
box-sizing: border-box;
|
409 |
-
-moz-box-sizing: border-box;
|
410 |
-
-webkit-box-sizing: border-box;
|
411 |
-
border-radius: 5px;
|
412 |
-
-moz-border-radius: 5px;
|
413 |
-
-webkit-border-radius: 5px;
|
414 |
-
box-shadow: none;
|
415 |
-
-moz-box-shadow: none;
|
416 |
-
-webkit-box-shadow: none;
|
417 |
-
transition: all .2s;
|
418 |
-
-o-transition: all .2s;
|
419 |
-
-ie-transition: all .2s;
|
420 |
-
-moz-transition: all .2s;
|
421 |
-
-webkit-transition: all .2s;
|
422 |
-
}
|
423 |
-
.su-custom-gallery-slide:hover img {
|
424 |
-
background: #eee;
|
425 |
-
border: 1px solid #aaa;
|
426 |
-
}
|
427 |
-
.su-custom-gallery-slide span {
|
428 |
-
position: absolute;
|
429 |
-
left: 4px;
|
430 |
-
bottom: 4px;
|
431 |
-
right: 4px;
|
432 |
-
display: block;
|
433 |
-
padding: 2px 4px;
|
434 |
-
font-size: 12px;
|
435 |
-
color: #fff;
|
436 |
-
background: rgb(0, 0, 0);
|
437 |
-
background: rgba(0, 0, 0, 0.5);
|
438 |
-
line-height: 1.3;
|
439 |
-
opacity: 0;
|
440 |
-
filter: alpha(opacity=0);
|
441 |
-
transition: all .2s;
|
442 |
-
-o-transition: all .2s;
|
443 |
-
-ie-transition: all .2s;
|
444 |
-
-moz-transition: all .2s;
|
445 |
-
-webkit-transition: all .2s;
|
446 |
-
}
|
447 |
-
.su-custom-gallery-slide:hover span {
|
448 |
-
opacity: 1;
|
449 |
-
filter: alpha(opacity=100);
|
450 |
-
}
|
451 |
-
.su-custom-gallery-title-never span { display: none }
|
452 |
-
.su-custom-gallery-title-always span {
|
453 |
-
opacity: 1;
|
454 |
-
filter: alpha(opacity=100);
|
455 |
}
|
1 |
+
/*** Shortcodes Ultimate - galleries elements ***/
|
2 |
+
|
3 |
+
.su-slider {
|
4 |
+
position: relative;
|
5 |
+
margin-bottom: 1.5em;
|
6 |
+
overflow: hidden;
|
7 |
+
-webkit-backface-visibility: hidden;
|
8 |
+
-moz-backface-visibility: hidden;
|
9 |
+
-ms-backface-visibility: hidden;
|
10 |
+
-o-backface-visibility: hidden;
|
11 |
+
backface-visibility: hidden;
|
12 |
+
z-index: 1;
|
13 |
+
}
|
14 |
+
.su-slider-centered { margin: 0 auto 1.5em auto }
|
15 |
+
.su-slider-slides {
|
16 |
+
position: relative;
|
17 |
+
width: 100%;
|
18 |
+
-webkit-transition-property: -webkit-transform, left, top;
|
19 |
+
-webkit-transition-duration: 0s;
|
20 |
+
-webkit-transform: translate3d(0px, 0, 0);
|
21 |
+
-webkit-transition-timing-function: ease;
|
22 |
+
-moz-transition-property: -moz-transform, left, top;
|
23 |
+
-moz-transition-duration: 0s;
|
24 |
+
-moz-transform: translate3d(0px, 0, 0);
|
25 |
+
-moz-transition-timing-function: ease;
|
26 |
+
-o-transition-property: -o-transform, left, top;
|
27 |
+
-o-transition-duration: 0s;
|
28 |
+
-o-transform: translate3d(0px, 0, 0);
|
29 |
+
-o-transition-timing-function: ease;
|
30 |
+
-o-transform: translate(0px, 0px);
|
31 |
+
-ms-transition-property: -ms-transform, left, top;
|
32 |
+
-ms-transition-duration: 0s;
|
33 |
+
-ms-transform: translate3d(0px, 0, 0);
|
34 |
+
-ms-transition-timing-function: ease;
|
35 |
+
transition-property: transform, left, top;
|
36 |
+
transition-duration: 0s;
|
37 |
+
transform: translate3d(0px, 0, 0);
|
38 |
+
transition-timing-function: ease;
|
39 |
+
}
|
40 |
+
.swiper-free-mode > .su-slider-slides {
|
41 |
+
-webkit-transition-timing-function: ease-out;
|
42 |
+
-moz-transition-timing-function: ease-out;
|
43 |
+
-ms-transition-timing-function: ease-out;
|
44 |
+
-o-transition-timing-function: ease-out;
|
45 |
+
transition-timing-function: ease-out;
|
46 |
+
margin: 0 auto;
|
47 |
+
}
|
48 |
+
.su-slider-slide {
|
49 |
+
position: relative;
|
50 |
+
float: left;
|
51 |
+
}
|
52 |
+
.su-slider-slide > a,
|
53 |
+
.su-slider-slide > img,
|
54 |
+
.su-slider-slide > a > img {
|
55 |
+
position: relative;
|
56 |
+
display: block;
|
57 |
+
width: 100%;
|
58 |
+
height: 100%;
|
59 |
+
text-decoration: none;
|
60 |
+
}
|
61 |
+
.su-slider-responsive-yes .su-slider-slide > a,
|
62 |
+
.su-slider-responsive-yes .su-slider-slide > img,
|
63 |
+
.su-slider-responsive-yes .su-slider-slide > a > img { height: auto }
|
64 |
+
.su-slider-pages-no .su-slider-pagination { display: none }
|
65 |
+
.swiper-wp8-horizontal { -ms-touch-action: pan-y }
|
66 |
+
.swiper-wp8-vertical { -ms-touch-action: pan-x }
|
67 |
+
.su-slider-slide-title {
|
68 |
+
position: absolute;
|
69 |
+
left: 20px;
|
70 |
+
bottom: 20px;
|
71 |
+
display: block;
|
72 |
+
max-width: 90%;
|
73 |
+
padding: 5px 10px;
|
74 |
+
color: #fff;
|
75 |
+
line-height: 1.3;
|
76 |
+
background: rgb(0, 0, 0);
|
77 |
+
background: rgba(0, 0, 0, 0.5);
|
78 |
+
border-radius: 5px;
|
79 |
+
-moz-border-radius: 5px;
|
80 |
+
-webkit-border-radius: 5px;
|
81 |
+
box-sizing: border-box;
|
82 |
+
-moz-box-sizing: border-box;
|
83 |
+
-webkit-box-sizing: border-box;
|
84 |
+
filter: alpha(opacity=0);
|
85 |
+
opacity: 0;
|
86 |
+
transition: opacity 1s;
|
87 |
+
-o-transition: opacity 1s;
|
88 |
+
-ie-transition: opacity 1s;
|
89 |
+
-moz-transition: opacity 1s;
|
90 |
+
-webkit-transition: opacity 1s;
|
91 |
+
}
|
92 |
+
.su-slider-slide-visible .su-slider-slide-title {
|
93 |
+
filter: alpha(opacity=100);
|
94 |
+
opacity: 1;
|
95 |
+
}
|
96 |
+
.su-slider-prev,
|
97 |
+
.su-slider-next {
|
98 |
+
position: absolute;
|
99 |
+
top: 50%;
|
100 |
+
display: block;
|
101 |
+
width: 40px;
|
102 |
+
height: 40px;
|
103 |
+
margin-top: -20px !important;
|
104 |
+
background: rgb(0, 0, 0) 0 0 url('../images/swiper/default.png') no-repeat;
|
105 |
+
background-color: rgba(0, 0, 0, 0.5);
|
106 |
+
cursor: pointer;
|
107 |
+
border-radius: 50%;
|
108 |
+
-moz-border-radius: 50%;
|
109 |
+
-webkit-border-radius: 50%;
|
110 |
+
filter: alpha(opacity=0);
|
111 |
+
opacity: 0;
|
112 |
+
transition: all .2s;
|
113 |
+
-o-transition: all .2s;
|
114 |
+
-ie-transition: all .2s;
|
115 |
+
-moz-transition: all .2s;
|
116 |
+
-webkit-transition: all .2s;
|
117 |
+
}
|
118 |
+
.su-slider-prev {
|
119 |
+
right: 10px;
|
120 |
+
margin-right: 30px;
|
121 |
+
background-position: -40px 0;
|
122 |
+
}
|
123 |
+
.su-slider-next {
|
124 |
+
left: 10px;
|
125 |
+
margin-left: 30px;
|
126 |
+
background-position: 0 0;
|
127 |
+
}
|
128 |
+
.su-slider:hover .su-slider-prev,
|
129 |
+
.su-slider:hover .su-slider-next {
|
130 |
+
margin-left: 0;
|
131 |
+
margin-right: 0;
|
132 |
+
filter: alpha(opacity=70);
|
133 |
+
opacity: 0.7;
|
134 |
+
}
|
135 |
+
.su-slider .su-slider-prev:hover,
|
136 |
+
.su-slider .su-slider-next:hover {
|
137 |
+
filter: alpha(opacity=100);
|
138 |
+
opacity: 1;
|
139 |
+
}
|
140 |
+
.su-slider-pagination {
|
141 |
+
position: absolute;
|
142 |
+
left: 15%;
|
143 |
+
right: 15%;
|
144 |
+
top: 50%;
|
145 |
+
width: 70%;
|
146 |
+
height: 0;
|
147 |
+
margin-top: -7px;
|
148 |
+
text-align: center;
|
149 |
+
cursor: default;
|
150 |
+
filter: alpha(opacity=0);
|
151 |
+
opacity: 0;
|
152 |
+
transition: all .2s;
|
153 |
+
-o-transition: all .2s;
|
154 |
+
-ie-transition: all .2s;
|
155 |
+
-moz-transition: all .2s;
|
156 |
+
-webkit-transition: all .2s;
|
157 |
+
}
|
158 |
+
.su-slider:hover .su-slider-pagination {
|
159 |
+
bottom: 20px;
|
160 |
+
filter: alpha(opacity=100);
|
161 |
+
opacity: 1;
|
162 |
+
}
|
163 |
+
.su-slider-pagination span {
|
164 |
+
display: inline-block;
|
165 |
+
width: 14px;
|
166 |
+
height: 14px;
|
167 |
+
margin: 0;
|
168 |
+
background: rgb(0, 0, 0) 0 -999px url('../images/swiper/default.png') no-repeat;
|
169 |
+
background-color: rgba(0, 0, 0, 0.5);
|
170 |
+
cursor: pointer;
|
171 |
+
border-radius: 50%;
|
172 |
+
-moz-border-radius: 50%;
|
173 |
+
-webkit-border-radius: 50%;
|
174 |
+
transition: all .2s;
|
175 |
+
-o-transition: all .2s;
|
176 |
+
-ie-transition: all .2s;
|
177 |
+
-moz-transition: all .2s;
|
178 |
+
-webkit-transition: all .2s;
|
179 |
+
}
|
180 |
+
.su-slider:hover .su-slider-pagination span { margin: 0 3px }
|
181 |
+
.su-slider .su-slider-pagination span.swiper-visible-switch {
|
182 |
+
background-color: rgb(255, 255, 255);
|
183 |
+
background-color: rgba(255, 255, 255, 0.5);
|
184 |
+
}
|
185 |
+
.su-slider-pagination span:hover,
|
186 |
+
.su-slider-pagination span.swiper-active-switch { background-position: 0 -40px }
|
187 |
+
|
188 |
+
/* Carousel
|
189 |
+
---------------------------------------------------------------*/
|
190 |
+
|
191 |
+
.su-carousel {
|
192 |
+
position: relative;
|
193 |
+
margin-bottom: 1.5em;
|
194 |
+
overflow: hidden;
|
195 |
+
-webkit-backface-visibility: hidden;
|
196 |
+
-moz-backface-visibility: hidden;
|
197 |
+
-ms-backface-visibility: hidden;
|
198 |
+
-o-backface-visibility: hidden;
|
199 |
+
backface-visibility: hidden;
|
200 |
+
z-index: 1;
|
201 |
+
}
|
202 |
+
.su-carousel-centered { margin: 0 auto 1.5em auto }
|
203 |
+
.su-carousel-slides {
|
204 |
+
position: relative;
|
205 |
+
width: 100%;
|
206 |
+
-webkit-transition-property: -webkit-transform, left, top;
|
207 |
+
-webkit-transition-duration: 0s;
|
208 |
+
-webkit-transform: translate3d(0px, 0, 0);
|
209 |
+
-webkit-transition-timing-function: ease;
|
210 |
+
-moz-transition-property: -moz-transform, left, top;
|
211 |
+
-moz-transition-duration: 0s;
|
212 |
+
-moz-transform: translate3d(0px, 0, 0);
|
213 |
+
-moz-transition-timing-function: ease;
|
214 |
+
-o-transition-property: -o-transform, left, top;
|
215 |
+
-o-transition-duration: 0s;
|
216 |
+
-o-transform: translate3d(0px, 0, 0);
|
217 |
+
-o-transition-timing-function: ease;
|
218 |
+
-o-transform: translate(0px, 0px);
|
219 |
+
-ms-transition-property: -ms-transform, left, top;
|
220 |
+
-ms-transition-duration: 0s;
|
221 |
+
-ms-transform: translate3d(0px, 0, 0);
|
222 |
+
-ms-transition-timing-function: ease;
|
223 |
+
transition-property: transform, left, top;
|
224 |
+
transition-duration: 0s;
|
225 |
+
transform: translate3d(0px, 0, 0);
|
226 |
+
transition-timing-function: ease;
|
227 |
+
}
|
228 |
+
.swiper-free-mode > .su-carousel-slides {
|
229 |
+
-webkit-transition-timing-function: ease-out;
|
230 |
+
-moz-transition-timing-function: ease-out;
|
231 |
+
-ms-transition-timing-function: ease-out;
|
232 |
+
-o-transition-timing-function: ease-out;
|
233 |
+
transition-timing-function: ease-out;
|
234 |
+
margin: 0 auto;
|
235 |
+
}
|
236 |
+
.su-carousel-slide {
|
237 |
+
position: relative;
|
238 |
+
float: left;
|
239 |
+
}
|
240 |
+
.su-carousel-slide > a,
|
241 |
+
.su-carousel-slide > img,
|
242 |
+
.su-carousel-slide > a > img {
|
243 |
+
position: relative;
|
244 |
+
display: block;
|
245 |
+
width: 100%;
|
246 |
+
height: 100%;
|
247 |
+
text-decoration: none;
|
248 |
+
box-sizing: border-box;
|
249 |
+
-moz-box-sizing: border-box;
|
250 |
+
-webkit-box-sizing: border-box;
|
251 |
+
}
|
252 |
+
.su-carousel-responsive-yes .su-carousel-slide > a,
|
253 |
+
.su-carousel-responsive-yes .su-carousel-slide > img,
|
254 |
+
.su-carousel-responsive-yes .su-carousel-slide > a > img { height: auto }
|
255 |
+
.su-carousel-pages-no .su-carousel-pagination { display: none }
|
256 |
+
.swiper-wp8-horizontal { -ms-touch-action: pan-y }
|
257 |
+
.swiper-wp8-vertical { -ms-touch-action: pan-x }
|
258 |
+
.su-carousel { }
|
259 |
+
.su-carousel .su-carousel-slide a { padding: 0 5px }
|
260 |
+
.su-carousel .su-carousel-slide img {
|
261 |
+
padding: 3px;
|
262 |
+
border: 1px solid #ccc;
|
263 |
+
background: #fff;
|
264 |
+
border-radius: 5px;
|
265 |
+
-moz-border-radius: 5px;
|
266 |
+
-webkit-border-radius: 5px;
|
267 |
+
}
|
268 |
+
.su-carousel .su-carousel-slide-title {
|
269 |
+
position: absolute;
|
270 |
+
left: 9px;
|
271 |
+
right: 9px;
|
272 |
+
bottom: 4px;
|
273 |
+
display: block;
|
274 |
+
padding: 2px 3px;
|
275 |
+
color: #fff;
|
276 |
+
line-height: 1.2;
|
277 |
+
font-size: 11px;
|
278 |
+
background: rgb(0, 0, 0);
|
279 |
+
background: rgba(0, 0, 0, 0.5);
|
280 |
+
box-sizing: border-box;
|
281 |
+
-moz-box-sizing: border-box;
|
282 |
+
-webkit-box-sizing: border-box;
|
283 |
+
transition: opacity 1s;
|
284 |
+
-o-transition: opacity 1s;
|
285 |
+
-ie-transition: opacity 1s;
|
286 |
+
-moz-transition: opacity 1s;
|
287 |
+
-webkit-transition: opacity 1s;
|
288 |
+
}
|
289 |
+
.su-carousel .su-carousel-prev,
|
290 |
+
.su-carousel .su-carousel-next {
|
291 |
+
position: absolute;
|
292 |
+
top: 50%;
|
293 |
+
display: block;
|
294 |
+
width: 40px;
|
295 |
+
height: 40px;
|
296 |
+
margin-top: -20px;
|
297 |
+
background: rgb(0, 0, 0) 0 0 url('../images/swiper/default.png') no-repeat;
|
298 |
+
background-color: rgba(0, 0, 0, 0.5);
|
299 |
+
cursor: pointer;
|
300 |
+
border-radius: 50%;
|
301 |
+
-moz-border-radius: 50%;
|
302 |
+
-webkit-border-radius: 50%;
|
303 |
+
filter: alpha(opacity=0);
|
304 |
+
opacity: 0;
|
305 |
+
transition: all .2s;
|
306 |
+
-o-transition: all .2s;
|
307 |
+
-ie-transition: all .2s;
|
308 |
+
-moz-transition: all .2s;
|
309 |
+
-webkit-transition: all .2s;
|
310 |
+
}
|
311 |
+
.su-carousel .su-carousel-prev {
|
312 |
+
right: 20px;
|
313 |
+
margin-right: 40px;
|
314 |
+
background-position: -40px 0;
|
315 |
+
}
|
316 |
+
.su-carousel .su-carousel-next {
|
317 |
+
left: 20px;
|
318 |
+
margin-left: 40px;
|
319 |
+
background-position: 0 0;
|
320 |
+
}
|
321 |
+
.su-carousel:hover .su-carousel-prev,
|
322 |
+
.su-carousel:hover .su-carousel-next {
|
323 |
+
margin-left: 0;
|
324 |
+
margin-right: 0;
|
325 |
+
filter: alpha(opacity=70);
|
326 |
+
opacity: 0.7;
|
327 |
+
}
|
328 |
+
.su-carousel .su-carousel-prev:hover,
|
329 |
+
.su-carousel .su-carousel-next:hover {
|
330 |
+
filter: alpha(opacity=100);
|
331 |
+
opacity: 1;
|
332 |
+
}
|
333 |
+
.su-carousel .su-carousel-pagination {
|
334 |
+
position: absolute;
|
335 |
+
left: 15%;
|
336 |
+
right: 15%;
|
337 |
+
top: 50%;
|
338 |
+
width: 70%;
|
339 |
+
height: 0;
|
340 |
+
margin-top: -7px;
|
341 |
+
text-align: center;
|
342 |
+
cursor: default;
|
343 |
+
filter: alpha(opacity=0);
|
344 |
+
opacity: 0;
|
345 |
+
transition: all .2s;
|
346 |
+
-o-transition: all .2s;
|
347 |
+
-ie-transition: all .2s;
|
348 |
+
-moz-transition: all .2s;
|
349 |
+
-webkit-transition: all .2s;
|
350 |
+
}
|
351 |
+
.su-carousel:hover .su-carousel-pagination {
|
352 |
+
bottom: 20px;
|
353 |
+
filter: alpha(opacity=100);
|
354 |
+
opacity: 1;
|
355 |
+
}
|
356 |
+
.su-carousel .su-carousel-pagination span {
|
357 |
+
display: inline-block;
|
358 |
+
width: 14px;
|
359 |
+
height: 14px;
|
360 |
+
margin: 0;
|
361 |
+
background: rgb(0, 0, 0) 0 -999px url('../images/swiper/default.png') no-repeat;
|
362 |
+
background-color: rgba(0, 0, 0, 0.5);
|
363 |
+
cursor: pointer;
|
364 |
+
border-radius: 50%;
|
365 |
+
-moz-border-radius: 50%;
|
366 |
+
-webkit-border-radius: 50%;
|
367 |
+
transition: all .2s;
|
368 |
+
-o-transition: all .2s;
|
369 |
+
-ie-transition: all .2s;
|
370 |
+
-moz-transition: all .2s;
|
371 |
+
-webkit-transition: all .2s;
|
372 |
+
}
|
373 |
+
.su-carousel:hover .su-carousel-pagination span { margin: 0 3px }
|
374 |
+
.su-carousel .su-carousel-pagination span.swiper-visible-switch {
|
375 |
+
background-color: rgb(255, 255, 255);
|
376 |
+
background-color: rgba(255, 255, 255, 0.5);
|
377 |
+
}
|
378 |
+
.su-carousel .su-carousel-pagination span:hover,
|
379 |
+
.su-carousel .su-carousel-pagination span.swiper-active-switch { background-position: 0 -40px }
|
380 |
+
|
381 |
+
/* Custom gallery
|
382 |
+
---------------------------------------------------------------*/
|
383 |
+
|
384 |
+
.su-custom-gallery { margin-bottom: 1.5em }
|
385 |
+
.su-custom-gallery:after,
|
386 |
+
.su-custom-gallery:before {
|
387 |
+
content: "";
|
388 |
+
display: table;
|
389 |
+
}
|
390 |
+
.su-custom-gallery:after { clear: both }
|
391 |
+
.su-custom-gallery-slide {
|
392 |
+
position: relative;
|
393 |
+
float: left;
|
394 |
+
margin: 0.5em;
|
395 |
+
overflow: hidden;
|
396 |
+
}
|
397 |
+
.su-custom-gallery-slide a {
|
398 |
+
display: block;
|
399 |
+
width: 100%;
|
400 |
+
height: 100%;
|
401 |
+
}
|
402 |
+
.su-custom-gallery-slide img {
|
403 |
+
display: block;
|
404 |
+
margin: 0;
|
405 |
+
padding: 3px;
|
406 |
+
border: 1px solid #ccc;
|
407 |
+
background: #fff;
|
408 |
+
box-sizing: border-box;
|
409 |
+
-moz-box-sizing: border-box;
|
410 |
+
-webkit-box-sizing: border-box;
|
411 |
+
border-radius: 5px;
|
412 |
+
-moz-border-radius: 5px;
|
413 |
+
-webkit-border-radius: 5px;
|
414 |
+
box-shadow: none;
|
415 |
+
-moz-box-shadow: none;
|
416 |
+
-webkit-box-shadow: none;
|
417 |
+
transition: all .2s;
|
418 |
+
-o-transition: all .2s;
|
419 |
+
-ie-transition: all .2s;
|
420 |
+
-moz-transition: all .2s;
|
421 |
+
-webkit-transition: all .2s;
|
422 |
+
}
|
423 |
+
.su-custom-gallery-slide:hover img {
|
424 |
+
background: #eee;
|
425 |
+
border: 1px solid #aaa;
|
426 |
+
}
|
427 |
+
.su-custom-gallery-slide span {
|
428 |
+
position: absolute;
|
429 |
+
left: 4px;
|
430 |
+
bottom: 4px;
|
431 |
+
right: 4px;
|
432 |
+
display: block;
|
433 |
+
padding: 2px 4px;
|
434 |
+
font-size: 12px;
|
435 |
+
color: #fff;
|
436 |
+
background: rgb(0, 0, 0);
|
437 |
+
background: rgba(0, 0, 0, 0.5);
|
438 |
+
line-height: 1.3;
|
439 |
+
opacity: 0;
|
440 |
+
filter: alpha(opacity=0);
|
441 |
+
transition: all .2s;
|
442 |
+
-o-transition: all .2s;
|
443 |
+
-ie-transition: all .2s;
|
444 |
+
-moz-transition: all .2s;
|
445 |
+
-webkit-transition: all .2s;
|
446 |
+
}
|
447 |
+
.su-custom-gallery-slide:hover span {
|
448 |
+
opacity: 1;
|
449 |
+
filter: alpha(opacity=100);
|
450 |
+
}
|
451 |
+
.su-custom-gallery-title-never span { display: none }
|
452 |
+
.su-custom-gallery-title-always span {
|
453 |
+
opacity: 1;
|
454 |
+
filter: alpha(opacity=100);
|
455 |
}
|
assets/css/generator.css
CHANGED
@@ -1,335 +1,335 @@
|
|
1 |
-
.su-generator-hidden { display: none !important; }
|
2 |
-
.su-generator-button img {
|
3 |
-
margin: -1px 2px 0 -5px;
|
4 |
-
vertical-align: middle;
|
5 |
-
}
|
6 |
-
.wp-media-buttons .su-generator-button img {
|
7 |
-
margin: -1px -1px 0 -8px;
|
8 |
-
vertical-align: middle;
|
9 |
-
}
|
10 |
-
|
11 |
-
#su-generator-wrap { display: none; }
|
12 |
-
#su-generator {
|
13 |
-
position: relative;
|
14 |
-
width: 85%;
|
15 |
-
max-width: 1000px;
|
16 |
-
margin: 28px auto 100px;
|
17 |
-
padding: 20px;
|
18 |
-
-webkit-border-bottom-right-radius: 5px;
|
19 |
-
-moz-border-radius-bottomright: 5px;
|
20 |
-
border-bottom-right-radius: 5px;
|
21 |
-
-webkit-border-bottom-left-radius: 5px;
|
22 |
-
-moz-border-radius-bottomleft: 5px;
|
23 |
-
border-bottom-left-radius: 5px;
|
24 |
-
background: #fff;
|
25 |
-
-webkit-box-shadow: 0 2px 25px #000;
|
26 |
-
-moz-box-shadow: 0 2px 25px #000;
|
27 |
-
box-shadow: 0 2px 25px #000;
|
28 |
-
-webkit-transition: max-width .2s;
|
29 |
-
-moz-transition: max-width .2s;
|
30 |
-
transition: max-width .2s;
|
31 |
-
}
|
32 |
-
#su-generator.su-generator-narrow { max-width: 500px; }
|
33 |
-
|
34 |
-
/* Generator tools */
|
35 |
-
#su-generator-tools {
|
36 |
-
margin-bottom: 20px;
|
37 |
-
}
|
38 |
-
#su-generator-tools span {
|
39 |
-
display: inline-block;
|
40 |
-
width: 1px;
|
41 |
-
height: 1em;
|
42 |
-
margin: 0 0.5em;
|
43 |
-
border-right: 1px dotted #555;
|
44 |
-
vertical-align: middle;
|
45 |
-
}
|
46 |
-
|
47 |
-
/* Search box */
|
48 |
-
#su-generator-search {
|
49 |
-
width: 100%;
|
50 |
-
margin-bottom: 30px;
|
51 |
-
padding: 10px 10px 10px 42px;
|
52 |
-
background: 5px 50% url('../images/generator/search.png') no-repeat;
|
53 |
-
font-size: 1.3em;
|
54 |
-
}
|
55 |
-
|
56 |
-
/* Filter box */
|
57 |
-
#su-generator-filter {
|
58 |
-
margin: 0 -20px;
|
59 |
-
padding: 14px 20px;
|
60 |
-
border-top: 1px solid #ccc;
|
61 |
-
border-bottom: 1px solid #ccc;
|
62 |
-
background: #eee;
|
63 |
-
color: #555;
|
64 |
-
text-align: center;
|
65 |
-
line-height: 24px;
|
66 |
-
}
|
67 |
-
#su-generator-filter a,
|
68 |
-
#su-generator-filter strong {
|
69 |
-
display: inline-block;
|
70 |
-
margin: 0 1em;
|
71 |
-
line-height: 1;
|
72 |
-
}
|
73 |
-
#su-generator-filter a {
|
74 |
-
border-bottom: 1px dotted #ccc;
|
75 |
-
text-decoration: none;
|
76 |
-
}
|
77 |
-
|
78 |
-
/* Dropdown choices */
|
79 |
-
#su-generator-choices {
|
80 |
-
margin-top: 20px;
|
81 |
-
text-align: center;
|
82 |
-
}
|
83 |
-
#su-generator-choices:after {
|
84 |
-
display: block;
|
85 |
-
clear: both;
|
86 |
-
content: '';
|
87 |
-
}
|
88 |
-
#su-generator-choices > span {
|
89 |
-
display: inline-block;
|
90 |
-
width: 88px;
|
91 |
-
height: 88px;
|
92 |
-
padding: 5px;
|
93 |
-
overflow: hidden;
|
94 |
-
border: 1px solid #fff;
|
95 |
-
border-bottom-style: dotted;
|
96 |
-
border-bottom-color: #e5e5e5;
|
97 |
-
-webkit-border-radius: 0;
|
98 |
-
-moz-border-radius: 0;
|
99 |
-
border-radius: 0;
|
100 |
-
color: #222;
|
101 |
-
vertical-align: top;
|
102 |
-
text-align: center;
|
103 |
-
cursor: pointer;
|
104 |
-
}
|
105 |
-
#su-generator-choices span:hover {
|
106 |
-
border: 1px solid #2687b3;
|
107 |
-
-webkit-border-radius: 5px;
|
108 |
-
-moz-border-radius: 5px;
|
109 |
-
border-radius: 5px;
|
110 |
-
background: #f5f5f5;
|
111 |
-
-webkit-box-shadow: 0 0 20px #fff inset;
|
112 |
-
-moz-box-shadow: 0 0 20px #fff inset;
|
113 |
-
box-shadow: 0 0 20px #fff inset;
|
114 |
-
}
|
115 |
-
#su-generator-choices span img {
|
116 |
-
display: inline;
|
117 |
-
width: 32px;
|
118 |
-
height: 32px;
|
119 |
-
margin: 12px 0;
|
120 |
-
opacity: 0.3;
|
121 |
-
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=30)";
|
122 |
-
filter: alpha(opacity=30);
|
123 |
-
-moz-opacity: 0.3;
|
124 |
-
-khtml-opacity: 0.3;
|
125 |
-
}
|
126 |
-
#su-generator-choices span:hover img {
|
127 |
-
opacity: 1;
|
128 |
-
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
|
129 |
-
filter: alpha(opacity=100);
|
130 |
-
-moz-opacity: 1;
|
131 |
-
-khtml-opacity: 1;
|
132 |
-
}
|
133 |
-
#su-generator-choices strong {
|
134 |
-
display: inline-block;
|
135 |
-
width: 88px;
|
136 |
-
height: 32px;
|
137 |
-
overflow: hidden;
|
138 |
-
text-transform: uppercase;
|
139 |
-
font-size: 0.9em;
|
140 |
-
}
|
141 |
-
|
142 |
-
/* Breadcrumbs */
|
143 |
-
#su-generator-breadcrumbs {
|
144 |
-
margin: 0 -20px;
|
145 |
-
padding: 14px 20px;
|
146 |
-
border-top: 1px solid #ccc;
|
147 |
-
border-bottom: 1px solid #ccc;
|
148 |
-
background: #eee;
|
149 |
-
color: #555;
|
150 |
-
line-height: 24px;
|
151 |
-
}
|
152 |
-
#su-generator-breadcrumbs span { font-weight: bold; }
|
153 |
-
#su-generator-breadcrumbs small {
|
154 |
-
margin-left: 1em;
|
155 |
-
color: #aaa;
|
156 |
-
font-weight: normal;
|
157 |
-
font-size: 0.9em;
|
158 |
-
}
|
159 |
-
|
160 |
-
/* Shortcode settings (attributes) */
|
161 |
-
#su-generator-settings { display: none; }
|
162 |
-
.su-loading-animation {
|
163 |
-
min-height: 100px;
|
164 |
-
background: 50% 50% url("../images/generator/loading.gif") no-repeat;
|
165 |
-
}
|
166 |
-
.su-loading-animation * { display: none; }
|
167 |
-
|
168 |
-
/* Attribute container */
|
169 |
-
#su-generator-settings .su-generator-attr-container {
|
170 |
-
margin: 0 -20px;
|
171 |
-
padding: 1.5em 20px;
|
172 |
-
border-bottom: 1px solid #ccc;
|
173 |
-
}
|
174 |
-
|
175 |
-
/* Attribute name */
|
176 |
-
#su-generator-settings h5,
|
177 |
-
#su-generator-preview h5 {
|
178 |
-
margin: 0 0 15px 0;
|
179 |
-
font-size: 1em;
|
180 |
-
}
|
181 |
-
|
182 |
-
/* Attribute description */
|
183 |
-
.su-generator-attr-desc {
|
184 |
-
margin-top: 15px;
|
185 |
-
color: #aaa;
|
186 |
-
font-style: italic;
|
187 |
-
line-height: 1.6;
|
188 |
-
}
|
189 |
-
.su-generator-attr-desc b { color: #999; }
|
190 |
-
|
191 |
-
/* Clickable values in attribute description */
|
192 |
-
.su-generator-attr-desc b.su-generator-set-value {
|
193 |
-
border-bottom: 1px dotted #999;
|
194 |
-
cursor: pointer;
|
195 |
-
}
|
196 |
-
.su-generator-attr-desc b.su-generator-set-value:hover {
|
197 |
-
border-bottom: 1px dotted #333;
|
198 |
-
color: #333;
|
199 |
-
}
|
200 |
-
|
201 |
-
/* Common attribute fields */
|
202 |
-
#su-generator-settings input,
|
203 |
-
#su-generator-settings textarea,
|
204 |
-
#su-generator-settings select {
|
205 |
-
width: 100%;
|
206 |
-
height: auto;
|
207 |
-
padding: 10px;
|
208 |
-
}
|
209 |
-
|
210 |
-
/* Upload fields */
|
211 |
-
.su-generator-upload-field-wrap { position: relative; }
|
212 |
-
.su-generator-upload-field {
|
213 |
-
display: inline-block;
|
214 |
-
width: 85%;
|
215 |
-
}
|
216 |
-
.su-generator-upload-button {
|
217 |
-
position: absolute;
|
218 |
-
top: 0;
|
219 |
-
right: 0;
|
220 |
-
display: inline-block;
|
221 |
-
width: 14%;
|
222 |
-
height: 100%;
|
223 |
-
overflow: hidden;
|
224 |
-
}
|
225 |
-
.su-generator-upload-button a.button {
|
226 |
-
position: absolute;
|
227 |
-
top: 0;
|
228 |
-
right: 0;
|
229 |
-
width: 100%;
|
230 |
-
height: 100%;
|
231 |
-
text-align: center;
|
232 |
-
font-weight: bold;
|
233 |
-
line-height: 40px;
|
234 |
-
}
|
235 |
-
.su-generator-upload-button input {
|
236 |
-
position: absolute;
|
237 |
-
top: 0;
|
238 |
-
right: 0;
|
239 |
-
height: 100%;
|
240 |
-
font-size: 10em;
|
241 |
-
opacity: 0;
|
242 |
-
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
|
243 |
-
filter: alpha(opacity=0);
|
244 |
-
cursor: pointer;
|
245 |
-
-moz-opacity: 0;
|
246 |
-
-khtml-opacity: 0;
|
247 |
-
}
|
248 |
-
.su-generator-uploading { background: 50% 50% url('../images/generator/loading.gif') no-repeat; }
|
249 |
-
#su-generator-settings .su-generator-uploading * {
|
250 |
-
opacity: 0;
|
251 |
-
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
|
252 |
-
filter: alpha(opacity=0);
|
253 |
-
-moz-opacity: 0;
|
254 |
-
-khtml-opacity: 0;
|
255 |
-
}
|
256 |
-
|
257 |
-
/* Switches */
|
258 |
-
.su-generator-switch {
|
259 |
-
display: inline-block;
|
260 |
-
width: 100%;
|
261 |
-
font-weight: bold;
|
262 |
-
cursor: pointer;
|
263 |
-
}
|
264 |
-
.su-generator-switch span {
|
265 |
-
display: none;
|
266 |
-
padding: 10px;
|
267 |
-
-webkit-border-radius: 3px;
|
268 |
-
-moz-border-radius: 3px;
|
269 |
-
border-radius: 3px;
|
270 |
-
}
|
271 |
-
.su-generator-switch-yes span.su-generator-yes {
|
272 |
-
display: block;
|
273 |
-
background: #e0ffe0;
|
274 |
-
color: #0c0;
|
275 |
-
}
|
276 |
-
.su-generator-switch-no span.su-generator-no {
|
277 |
-
display: block;
|
278 |
-
background: #f5f5f5;
|
279 |
-
color: #777;
|
280 |
-
}
|
281 |
-
|
282 |
-
/* Color pickers */
|
283 |
-
.su-generator-select-color {
|
284 |
-
position: relative;
|
285 |
-
}
|
286 |
-
.su-generator-select-color-wheel {
|
287 |
-
position: absolute;
|
288 |
-
top: 23px;
|
289 |
-
left: 0;
|
290 |
-
z-index: 9999;
|
291 |
-
display: none;
|
292 |
-
border: 1px solid #aaa;
|
293 |
-
background: #fff;
|
294 |
-
-webkit-box-shadow: 0 2px 5px #ccc;
|
295 |
-
-moz-box-shadow: 0 2px 5px #ccc;
|
296 |
-
box-shadow: 0 2px 5px #ccc;
|
297 |
-
}
|
298 |
-
|
299 |
-
/* Preview box */
|
300 |
-
#su-generator-preview {
|
301 |
-
display: none;
|
302 |
-
margin: 0 -20px;
|
303 |
-
padding: 1.5em 20px;
|
304 |
-
overflow: hidden;
|
305 |
-
border-bottom: 1px solid #ccc;
|
306 |
-
}
|
307 |
-
.su-preview-loading {
|
308 |
-
min-height: 60px;
|
309 |
-
background: 50% 50% url('../images/generator/loading.gif') no-repeat;
|
310 |
-
}
|
311 |
-
/* make some previews visible */
|
312 |
-
#su-generator-preview .su-column { outline: 1px dotted #ccc; }
|
313 |
-
|
314 |
-
/* Actions box */
|
315 |
-
.su-generator-actions {
|
316 |
-
margin: 0 -20px -20px;
|
317 |
-
padding: 1.5em 15px;
|
318 |
-
-webkit-border-bottom-right-radius: 5px;
|
319 |
-
-moz-border-radius-bottomright: 5px;
|
320 |
-
border-bottom-right-radius: 5px;
|
321 |
-
-webkit-border-bottom-left-radius: 5px;
|
322 |
-
-moz-border-radius-bottomleft: 5px;
|
323 |
-
border-bottom-left-radius: 5px;
|
324 |
-
background: #eee;
|
325 |
-
}
|
326 |
-
.su-generator-actions:after {
|
327 |
-
display: block;
|
328 |
-
clear: both;
|
329 |
-
content: '';
|
330 |
-
}
|
331 |
-
.su-generator-actions .button { margin: 0 5px }
|
332 |
-
#su-generator-insert {
|
333 |
-
color: #fff !important;
|
334 |
-
font-weight: bold;
|
335 |
}
|
1 |
+
.su-generator-hidden { display: none !important; }
|
2 |
+
.su-generator-button img {
|
3 |
+
margin: -1px 2px 0 -5px;
|
4 |
+
vertical-align: middle;
|
5 |
+
}
|
6 |
+
.wp-media-buttons .su-generator-button img {
|
7 |
+
margin: -1px -1px 0 -8px;
|
8 |
+
vertical-align: middle;
|
9 |
+
}
|
10 |
+
|
11 |
+
#su-generator-wrap { display: none; }
|
12 |
+
#su-generator {
|
13 |
+
position: relative;
|
14 |
+
width: 85%;
|
15 |
+
max-width: 1000px;
|
16 |
+
margin: 28px auto 100px;
|
17 |
+
padding: 20px;
|
18 |
+
-webkit-border-bottom-right-radius: 5px;
|
19 |
+
-moz-border-radius-bottomright: 5px;
|
20 |
+
border-bottom-right-radius: 5px;
|
21 |
+
-webkit-border-bottom-left-radius: 5px;
|
22 |
+
-moz-border-radius-bottomleft: 5px;
|
23 |
+
border-bottom-left-radius: 5px;
|
24 |
+
background: #fff;
|
25 |
+
-webkit-box-shadow: 0 2px 25px #000;
|
26 |
+
-moz-box-shadow: 0 2px 25px #000;
|
27 |
+
box-shadow: 0 2px 25px #000;
|
28 |
+
-webkit-transition: max-width .2s;
|
29 |
+
-moz-transition: max-width .2s;
|
30 |
+
transition: max-width .2s;
|
31 |
+
}
|
32 |
+
#su-generator.su-generator-narrow { max-width: 500px; }
|
33 |
+
|
34 |
+
/* Generator tools */
|
35 |
+
#su-generator-tools {
|
36 |
+
margin-bottom: 20px;
|
37 |
+
}
|
38 |
+
#su-generator-tools span {
|
39 |
+
display: inline-block;
|
40 |
+
width: 1px;
|
41 |
+
height: 1em;
|
42 |
+
margin: 0 0.5em;
|
43 |
+
border-right: 1px dotted #555;
|
44 |
+
vertical-align: middle;
|
45 |
+
}
|
46 |
+
|
47 |
+
/* Search box */
|
48 |
+
#su-generator-search {
|
49 |
+
width: 100%;
|
50 |
+
margin-bottom: 30px;
|
51 |
+
padding: 10px 10px 10px 42px;
|
52 |
+
background: 5px 50% url('../images/generator/search.png') no-repeat;
|
53 |
+
font-size: 1.3em;
|
54 |
+
}
|
55 |
+
|
56 |
+
/* Filter box */
|
57 |
+
#su-generator-filter {
|
58 |
+
margin: 0 -20px;
|
59 |
+
padding: 14px 20px;
|
60 |
+
border-top: 1px solid #ccc;
|
61 |
+
border-bottom: 1px solid #ccc;
|
62 |
+
background: #eee;
|
63 |
+
color: #555;
|
64 |
+
text-align: center;
|
65 |
+
line-height: 24px;
|
66 |
+
}
|
67 |
+
#su-generator-filter a,
|
68 |
+
#su-generator-filter strong {
|
69 |
+
display: inline-block;
|
70 |
+
margin: 0 1em;
|
71 |
+
line-height: 1;
|
72 |
+
}
|
73 |
+
#su-generator-filter a {
|
74 |
+
border-bottom: 1px dotted #ccc;
|
75 |
+
text-decoration: none;
|
76 |
+
}
|
77 |
+
|
78 |
+
/* Dropdown choices */
|
79 |
+
#su-generator-choices {
|
80 |
+
margin-top: 20px;
|
81 |
+
text-align: center;
|
82 |
+
}
|
83 |
+
#su-generator-choices:after {
|
84 |
+
display: block;
|
85 |
+
clear: both;
|
86 |
+
content: '';
|
87 |
+
}
|
88 |
+
#su-generator-choices > span {
|
89 |
+
display: inline-block;
|
90 |
+
width: 88px;
|
91 |
+
height: 88px;
|
92 |
+
padding: 5px;
|
93 |
+
overflow: hidden;
|
94 |
+
border: 1px solid #fff;
|
95 |
+
border-bottom-style: dotted;
|
96 |
+
border-bottom-color: #e5e5e5;
|
97 |
+
-webkit-border-radius: 0;
|
98 |
+
-moz-border-radius: 0;
|
99 |
+
border-radius: 0;
|
100 |
+
color: #222;
|
101 |
+
vertical-align: top;
|
102 |
+
text-align: center;
|
103 |
+
cursor: pointer;
|
104 |
+
}
|
105 |
+
#su-generator-choices span:hover {
|
106 |
+
border: 1px solid #2687b3;
|
107 |
+
-webkit-border-radius: 5px;
|
108 |
+
-moz-border-radius: 5px;
|
109 |
+
border-radius: 5px;
|
110 |
+
background: #f5f5f5;
|
111 |
+
-webkit-box-shadow: 0 0 20px #fff inset;
|
112 |
+
-moz-box-shadow: 0 0 20px #fff inset;
|
113 |
+
box-shadow: 0 0 20px #fff inset;
|
114 |
+
}
|
115 |
+
#su-generator-choices span img {
|
116 |
+
display: inline;
|
117 |
+
width: 32px;
|
118 |
+
height: 32px;
|
119 |
+
margin: 12px 0;
|
120 |
+
opacity: 0.3;
|
121 |
+
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=30)";
|
122 |
+
filter: alpha(opacity=30);
|
123 |
+
-moz-opacity: 0.3;
|
124 |
+
-khtml-opacity: 0.3;
|
125 |
+
}
|
126 |
+
#su-generator-choices span:hover img {
|
127 |
+
opacity: 1;
|
128 |
+
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
|
129 |
+
filter: alpha(opacity=100);
|
130 |
+
-moz-opacity: 1;
|
131 |
+
-khtml-opacity: 1;
|
132 |
+
}
|
133 |
+
#su-generator-choices strong {
|
134 |
+
display: inline-block;
|
135 |
+
width: 88px;
|
136 |
+
height: 32px;
|
137 |
+
overflow: hidden;
|
138 |
+
text-transform: uppercase;
|
139 |
+
font-size: 0.9em;
|
140 |
+
}
|
141 |
+
|
142 |
+
/* Breadcrumbs */
|
143 |
+
#su-generator-breadcrumbs {
|
144 |
+
margin: 0 -20px;
|
145 |
+
padding: 14px 20px;
|
146 |
+
border-top: 1px solid #ccc;
|
147 |
+
border-bottom: 1px solid #ccc;
|
148 |
+
background: #eee;
|
149 |
+
color: #555;
|
150 |
+
line-height: 24px;
|
151 |
+
}
|
152 |
+
#su-generator-breadcrumbs span { font-weight: bold; }
|
153 |
+
#su-generator-breadcrumbs small {
|
154 |
+
margin-left: 1em;
|
155 |
+
color: #aaa;
|
156 |
+
font-weight: normal;
|
157 |
+
font-size: 0.9em;
|
158 |
+
}
|
159 |
+
|
160 |
+
/* Shortcode settings (attributes) */
|
161 |
+
#su-generator-settings { display: none; }
|
162 |
+
.su-loading-animation {
|
163 |
+
min-height: 100px;
|
164 |
+
background: 50% 50% url("../images/generator/loading.gif") no-repeat;
|
165 |
+
}
|
166 |
+
.su-loading-animation * { display: none; }
|
167 |
+
|
168 |
+
/* Attribute container */
|
169 |
+
#su-generator-settings .su-generator-attr-container {
|
170 |
+
margin: 0 -20px;
|
171 |
+
padding: 1.5em 20px;
|
172 |
+
border-bottom: 1px solid #ccc;
|
173 |
+
}
|
174 |
+
|
175 |
+
/* Attribute name */
|
176 |
+
#su-generator-settings h5,
|
177 |
+
#su-generator-preview h5 {
|
178 |
+
margin: 0 0 15px 0;
|
179 |
+
font-size: 1em;
|
180 |
+
}
|
181 |
+
|
182 |
+
/* Attribute description */
|
183 |
+
.su-generator-attr-desc {
|
184 |
+
margin-top: 15px;
|
185 |
+
color: #aaa;
|
186 |
+
font-style: italic;
|
187 |
+
line-height: 1.6;
|
188 |
+
}
|
189 |
+
.su-generator-attr-desc b { color: #999; }
|
190 |
+
|
191 |
+
/* Clickable values in attribute description */
|
192 |
+
.su-generator-attr-desc b.su-generator-set-value {
|
193 |
+
border-bottom: 1px dotted #999;
|
194 |
+
cursor: pointer;
|
195 |
+
}
|
196 |
+
.su-generator-attr-desc b.su-generator-set-value:hover {
|
197 |
+
border-bottom: 1px dotted #333;
|
198 |
+
color: #333;
|
199 |
+
}
|
200 |
+
|
201 |
+
/* Common attribute fields */
|
202 |
+
#su-generator-settings input,
|
203 |
+
#su-generator-settings textarea,
|
204 |
+
#su-generator-settings select {
|
205 |
+
width: 100%;
|
206 |
+
height: auto;
|
207 |
+
padding: 10px;
|
208 |
+
}
|
209 |
+
|
210 |
+
/* Upload fields */
|
211 |
+
.su-generator-upload-field-wrap { position: relative; }
|
212 |
+
.su-generator-upload-field {
|
213 |
+
display: inline-block;
|
214 |
+
width: 85%;
|
215 |
+
}
|
216 |
+
.su-generator-upload-button {
|
217 |
+
position: absolute;
|
218 |
+
top: 0;
|
219 |
+
right: 0;
|
220 |
+
display: inline-block;
|
221 |
+
width: 14%;
|
222 |
+
height: 100%;
|
223 |
+
overflow: hidden;
|
224 |
+
}
|
225 |
+
.su-generator-upload-button a.button {
|
226 |
+
position: absolute;
|
227 |
+
top: 0;
|
228 |
+
right: 0;
|
229 |
+
width: 100%;
|
230 |
+
height: 100%;
|
231 |
+
text-align: center;
|
232 |
+
font-weight: bold;
|
233 |
+
line-height: 40px;
|
234 |
+
}
|
235 |
+
.su-generator-upload-button input {
|
236 |
+
position: absolute;
|
237 |
+
top: 0;
|
238 |
+
right: 0;
|
239 |
+
height: 100%;
|
240 |
+
font-size: 10em;
|
241 |
+
opacity: 0;
|
242 |
+
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
|
243 |
+
filter: alpha(opacity=0);
|
244 |
+
cursor: pointer;
|
245 |
+
-moz-opacity: 0;
|
246 |
+
-khtml-opacity: 0;
|
247 |
+
}
|
248 |
+
.su-generator-uploading { background: 50% 50% url('../images/generator/loading.gif') no-repeat; }
|
249 |
+
#su-generator-settings .su-generator-uploading * {
|
250 |
+
opacity: 0;
|
251 |
+
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
|
252 |
+
filter: alpha(opacity=0);
|
253 |
+
-moz-opacity: 0;
|
254 |
+
-khtml-opacity: 0;
|
255 |
+
}
|
256 |
+
|
257 |
+
/* Switches */
|
258 |
+
.su-generator-switch {
|
259 |
+
display: inline-block;
|
260 |
+
width: 100%;
|
261 |
+
font-weight: bold;
|
262 |
+
cursor: pointer;
|
263 |
+
}
|
264 |
+
.su-generator-switch span {
|
265 |
+
display: none;
|
266 |
+
padding: 10px;
|
267 |
+
-webkit-border-radius: 3px;
|
268 |
+
-moz-border-radius: 3px;
|
269 |
+
border-radius: 3px;
|
270 |
+
}
|
271 |
+
.su-generator-switch-yes span.su-generator-yes {
|
272 |
+
display: block;
|
273 |
+
background: #e0ffe0;
|
274 |
+
color: #0c0;
|
275 |
+
}
|
276 |
+
.su-generator-switch-no span.su-generator-no {
|
277 |
+
display: block;
|
278 |
+
background: #f5f5f5;
|
279 |
+
color: #777;
|
280 |
+
}
|
281 |
+
|
282 |
+
/* Color pickers */
|
283 |
+
.su-generator-select-color {
|
284 |
+
position: relative;
|
285 |
+
}
|
286 |
+
.su-generator-select-color-wheel {
|
287 |
+
position: absolute;
|
288 |
+
top: 23px;
|
289 |
+
left: 0;
|
290 |
+
z-index: 9999;
|
291 |
+
display: none;
|
292 |
+
border: 1px solid #aaa;
|
293 |
+
background: #fff;
|
294 |
+
-webkit-box-shadow: 0 2px 5px #ccc;
|
295 |
+
-moz-box-shadow: 0 2px 5px #ccc;
|
296 |
+
box-shadow: 0 2px 5px #ccc;
|
297 |
+
}
|
298 |
+
|
299 |
+
/* Preview box */
|
300 |
+
#su-generator-preview {
|
301 |
+
display: none;
|
302 |
+
margin: 0 -20px;
|
303 |
+
padding: 1.5em 20px;
|
304 |
+
overflow: hidden;
|
305 |
+
border-bottom: 1px solid #ccc;
|
306 |
+
}
|
307 |
+
.su-preview-loading {
|
308 |
+
min-height: 60px;
|
309 |
+
background: 50% 50% url('../images/generator/loading.gif') no-repeat;
|
310 |
+
}
|
311 |
+
/* make some previews visible */
|
312 |
+
#su-generator-preview .su-column { outline: 1px dotted #ccc; }
|
313 |
+
|
314 |
+
/* Actions box */
|
315 |
+
.su-generator-actions {
|
316 |
+
margin: 0 -20px -20px;
|
317 |
+
padding: 1.5em 15px;
|
318 |
+
-webkit-border-bottom-right-radius: 5px;
|
319 |
+
-moz-border-radius-bottomright: 5px;
|
320 |
+
border-bottom-right-radius: 5px;
|
321 |
+
-webkit-border-bottom-left-radius: 5px;
|
322 |
+
-moz-border-radius-bottomleft: 5px;
|
323 |
+
border-bottom-left-radius: 5px;
|
324 |
+
background: #eee;
|
325 |
+
}
|
326 |
+
.su-generator-actions:after {
|
327 |
+
display: block;
|
328 |
+
clear: both;
|
329 |
+
content: '';
|
330 |
+
}
|
331 |
+
.su-generator-actions .button { margin: 0 5px }
|
332 |
+
#su-generator-insert {
|
333 |
+
color: #fff !important;
|
334 |
+
font-weight: bold;
|
335 |
}
|
assets/css/media-shortcodes.css
CHANGED
@@ -1,49 +1,49 @@
|
|
1 |
-
/*** Shortcodes Ultimate - media elements ***/
|
2 |
-
|
3 |
-
/* Container for responsive media elements */
|
4 |
-
|
5 |
-
.su-responsive-media-yes {
|
6 |
-
position: relative;
|
7 |
-
padding-bottom: 56.25%;
|
8 |
-
height: 0;
|
9 |
-
overflow: hidden;
|
10 |
-
}
|
11 |
-
.su-responsive-media-yes iframe,
|
12 |
-
.su-responsive-media-yes object,
|
13 |
-
.su-responsive-media-yes embed {
|
14 |
-
position: absolute;
|
15 |
-
top: 0;
|
16 |
-
left: 0;
|
17 |
-
width: 100%;
|
18 |
-
height: 100%;
|
19 |
-
}
|
20 |
-
|
21 |
-
/* YouTube
|
22 |
-
---------------------------------------------------------------*/
|
23 |
-
|
24 |
-
.su-youtube { margin: 0 0 1.5em 0 }
|
25 |
-
.su-youtube iframe { border: none !important }
|
26 |
-
|
27 |
-
/* Vimeo
|
28 |
-
---------------------------------------------------------------*/
|
29 |
-
|
30 |
-
.su-vimeo { margin: 0 0 1.5em 0 }
|
31 |
-
.su-vimeo iframe { border: none !important }
|
32 |
-
|
33 |
-
/* Screenr
|
34 |
-
---------------------------------------------------------------*/
|
35 |
-
|
36 |
-
.su-screenr { margin: 0 0 1.5em 0 }
|
37 |
-
.su-screenr iframe { border: none !important }
|
38 |
-
|
39 |
-
/* Document
|
40 |
-
---------------------------------------------------------------*/
|
41 |
-
|
42 |
-
.su-document { margin: 0 0 1.5em 0 }
|
43 |
-
.su-document iframe { border: none !important }
|
44 |
-
|
45 |
-
/* Gmap
|
46 |
-
---------------------------------------------------------------*/
|
47 |
-
|
48 |
-
.su-gmap { margin: 0 0 1.5em 0 }
|
49 |
.su-gmap iframe { border: none !important }
|
1 |
+
/*** Shortcodes Ultimate - media elements ***/
|
2 |
+
|
3 |
+
/* Container for responsive media elements */
|
4 |
+
|
5 |
+
.su-responsive-media-yes {
|
6 |
+
position: relative;
|
7 |
+
padding-bottom: 56.25%;
|
8 |
+
height: 0;
|
9 |
+
overflow: hidden;
|
10 |
+
}
|
11 |
+
.su-responsive-media-yes iframe,
|
12 |
+
.su-responsive-media-yes object,
|
13 |
+
.su-responsive-media-yes embed {
|
14 |
+
position: absolute;
|
15 |
+
top: 0;
|
16 |
+
left: 0;
|
17 |
+
width: 100%;
|
18 |
+
height: 100%;
|
19 |
+
}
|
20 |
+
|
21 |
+
/* YouTube
|
22 |
+
---------------------------------------------------------------*/
|
23 |
+
|
24 |
+
.su-youtube { margin: 0 0 1.5em 0 }
|
25 |
+
.su-youtube iframe { border: none !important }
|
26 |
+
|
27 |
+
/* Vimeo
|
28 |
+
---------------------------------------------------------------*/
|
29 |
+
|
30 |
+
.su-vimeo { margin: 0 0 1.5em 0 }
|
31 |
+
.su-vimeo iframe { border: none !important }
|
32 |
+
|
33 |
+
/* Screenr
|
34 |
+
---------------------------------------------------------------*/
|
35 |
+
|
36 |
+
.su-screenr { margin: 0 0 1.5em 0 }
|
37 |
+
.su-screenr iframe { border: none !important }
|
38 |
+
|
39 |
+
/* Document
|
40 |
+
---------------------------------------------------------------*/
|
41 |
+
|
42 |
+
.su-document { margin: 0 0 1.5em 0 }
|
43 |
+
.su-document iframe { border: none !important }
|
44 |
+
|
45 |
+
/* Gmap
|
46 |
+
---------------------------------------------------------------*/
|
47 |
+
|
48 |
+
.su-gmap { margin: 0 0 1.5em 0 }
|
49 |
.su-gmap iframe { border: none !important }
|
assets/css/options-page.css
CHANGED
@@ -1,311 +1,311 @@
|
|
1 |
-
.su-clear {
|
2 |
-
height: 0;
|
3 |
-
clear: both;
|
4 |
-
}
|
5 |
-
|
6 |
-
/* About screen */
|
7 |
-
#su-about-screen { }
|
8 |
-
#su-about-screen h1 { margin: 1.5em 0 }
|
9 |
-
#su-about-screen h1 small {
|
10 |
-
display: block;
|
11 |
-
margin: 7px 0 0 20px;
|
12 |
-
font-size: 0.5em;
|
13 |
-
font-weight: normal;
|
14 |
-
color: #aaa;
|
15 |
-
}
|
16 |
-
#su-about-screen .su-about-column {
|
17 |
-
float: left;
|
18 |
-
width: 300px;
|
19 |
-
margin-right: 30px;
|
20 |
-
}
|
21 |
-
#su-links {
|
22 |
-
margin-bottom: 1.5em;
|
23 |
-
line-height: 1.6;
|
24 |
-
}
|
25 |
-
#su-links span {
|
26 |
-
display: inline-block;
|
27 |
-
width: 1px;
|
28 |
-
height: 1em;
|
29 |
-
margin: 0 0.5em;
|
30 |
-
border-right: 1px dotted #777;
|
31 |
-
vertical-align: middle;
|
32 |
-
}
|
33 |
-
#su-video {
|
34 |
-
width: 100%;
|
35 |
-
max-width: 630px;
|
36 |
-
min-width: 200px;
|
37 |
-
margin-top: 40px;
|
38 |
-
}
|
39 |
-
#su-video iframe {
|
40 |
-
width: 100%;
|
41 |
-
height: 370px;
|
42 |
-
}
|
43 |
-
|
44 |
-
/* CheatSheet screen */
|
45 |
-
.su-table-demos tr.even td { background: #fff }
|
46 |
-
.su-table-demos td { padding: 20px 10px }
|
47 |
-
.su-table-demos td small { color: #aaa }
|
48 |
-
.su-table-demos td a.su-preview {
|
49 |
-
position: relative;
|
50 |
-
display: block;
|
51 |
-
width: 100px;
|
52 |
-
height: 100px;
|
53 |
-
margin-bottom: 30px;
|
54 |
-
overflow: hidden;
|
55 |
-
padding: 3px;
|
56 |
-
background: #fff;
|
57 |
-
border: 2px solid #fff;
|
58 |
-
border-radius: 50%;
|
59 |
-
-moz-border-radius: 50%;
|
60 |
-
-webkit-border-radius: 50%;
|
61 |
-
box-shadow: 0 1px 5px #ccc;
|
62 |
-
-moz-box-shadow: 0 1px 5px #ccc;
|
63 |
-
-webkit-box-shadow: 0 1px 5px #ccc;
|
64 |
-
}
|
65 |
-
.su-table-demos td a.su-preview:after {
|
66 |
-
display: none;
|
67 |
-
content: '';
|
68 |
-
position: absolute;
|
69 |
-
left: 0;
|
70 |
-
top: 0;
|
71 |
-
height: 100%;
|
72 |
-
width: 100%;
|
73 |
-
background: rgb(0, 0, 0) 50% 120% url('../images/preview.png') no-repeat;
|
74 |
-
background-color: rgba(0, 0, 0, 0.5);
|
75 |
-
opacity: 0.7;
|
76 |
-
filter: alpha(opacity=70);
|
77 |
-
}
|
78 |
-
.su-table-demos td a.su-preview:hover:after { display: block }
|
79 |
-
.su-table-demos td a.su-preview img {
|
80 |
-
position: absolute;
|
81 |
-
top: -5%;
|
82 |
-
left: -50%;
|
83 |
-
display: block;
|
84 |
-
}
|
85 |
-
.su-table-demos td a.su-preview:hover:after {
|
86 |
-
display: block;
|
87 |
-
content: '';
|
88 |
-
position: absolute;
|
89 |
-
left: 0;
|
90 |
-
top: 0;
|
91 |
-
height: 100%;
|
92 |
-
width: 100%;
|
93 |
-
background: rgb(0, 0, 0) 50% 50% url('../images/preview.png') no-repeat;
|
94 |
-
background-color: rgba(0, 0, 0, 0.5);
|
95 |
-
}
|
96 |
-
.su-table-demos td h4 {
|
97 |
-
margin: 5px 0;
|
98 |
-
font-size: 1.2em;
|
99 |
-
}
|
100 |
-
.su-table-demos td span {
|
101 |
-
display: block;
|
102 |
-
margin-bottom: 10px;
|
103 |
-
}
|
104 |
-
.su-table-demos td strong {
|
105 |
-
display: block;
|
106 |
-
margin-bottom: 0.7em;
|
107 |
-
}
|
108 |
-
.su-table-demos .su-cheatsheet-parameter { line-height: 1.5 }
|
109 |
-
.su-table-demos td textarea {
|
110 |
-
height: 90px;
|
111 |
-
width: 100%;
|
112 |
-
border: none;
|
113 |
-
background: #ffffe6;
|
114 |
-
}
|
115 |
-
|
116 |
-
/* Galleries screen */
|
117 |
-
#su-galleries {
|
118 |
-
margin: 1em 0;
|
119 |
-
}
|
120 |
-
#su-galleries-actions { margin-bottom: 1.5em }
|
121 |
-
#su-galleries-not-found {
|
122 |
-
font-size: 1.5em;
|
123 |
-
color: #ccc;
|
124 |
-
font-weight: bold;
|
125 |
-
margin: 1em 0;
|
126 |
-
}
|
127 |
-
.su-gallery { margin: 1em 0 }
|
128 |
-
.su-gallery-title {
|
129 |
-
position: relative;
|
130 |
-
padding: 5px 15px;
|
131 |
-
color: #333;
|
132 |
-
border: 1px solid #dfdfdf;
|
133 |
-
border-radius: 5px;
|
134 |
-
-moz-border-radius: 5px;
|
135 |
-
-webkit-border-radius: 5px;
|
136 |
-
background: #fff;
|
137 |
-
background: -moz-linear-gradient(top, #fff 0%, #f8f8f8 2%, #ececec 100%);
|
138 |
-
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #fff), color-stop(2%, #f8f8f8), color-stop(100%, #ececec));
|
139 |
-
background: -webkit-linear-gradient(top, #fff 0%, #f8f8f8 2%, #ececec 100%);
|
140 |
-
background: -o-linear-gradient(top, #fff 0%, #f8f8f8 2%, #ececec 100%);
|
141 |
-
background: -ms-linear-gradient(top, #fff 0%, #f8f8f8 2%, #ececec 100%);
|
142 |
-
background: linear-gradient(to bottom, #fff 0%, #f8f8f8 2%, #ececec 100%);
|
143 |
-
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#ececec', GradientType=0);
|
144 |
-
}
|
145 |
-
.su-gallery-edit .su-gallery-title {
|
146 |
-
-webkit-border-bottom-right-radius: 0;
|
147 |
-
-webkit-border-bottom-left-radius: 0;
|
148 |
-
-moz-border-radius-bottomright: 0;
|
149 |
-
-moz-border-radius-bottomleft: 0;
|
150 |
-
border-bottom-right-radius: 0;
|
151 |
-
border-bottom-left-radius: 0;
|
152 |
-
}
|
153 |
-
input.su-gallery-name {
|
154 |
-
position: relative;
|
155 |
-
top: 1px;
|
156 |
-
width: 200px;
|
157 |
-
font-weight: bold;
|
158 |
-
border-width: 0;
|
159 |
-
background-color: transparent;
|
160 |
-
}
|
161 |
-
.su-gallery-edit input.su-gallery-name {
|
162 |
-
top: 0;
|
163 |
-
font-weight: normal;
|
164 |
-
border-width: 1px;
|
165 |
-
background-color: #fff;
|
166 |
-
}
|
167 |
-
.su-gallery-actions {
|
168 |
-
position: absolute;
|
169 |
-
top: 10px;
|
170 |
-
right: 15px;
|
171 |
-
}
|
172 |
-
.su-gallery-actions a { margin-left: 1em }
|
173 |
-
.su-gallery-close,
|
174 |
-
.su-gallery-save-close { display: none }
|
175 |
-
.su-gallery-edit .su-gallery-close,
|
176 |
-
.su-gallery-edit .su-gallery-save-close { display: inline }
|
177 |
-
.su-gallery-edit .su-gallery-open { display: none }
|
178 |
-
.su-gallery-delete { color: #f03 }
|
179 |
-
.su-gallery-edit .su-gallery-save-close { font-weight: bold }
|
180 |
-
|
181 |
-
.su-gallery-content {
|
182 |
-
height: 0;
|
183 |
-
overflow: hidden;
|
184 |
-
transition: padding-top .2s;
|
185 |
-
-o-transition: padding-top .2s;
|
186 |
-
-ie-transition: padding-top .2s;
|
187 |
-
-moz-transition: padding-top .2s;
|
188 |
-
-webkit-transition: padding-top .2s;
|
189 |
-
-webkit-border-bottom-right-radius: 5px;
|
190 |
-
-webkit-border-bottom-left-radius: 5px;
|
191 |
-
-moz-border-radius-bottomright: 5px;
|
192 |
-
-moz-border-radius-bottomleft: 5px;
|
193 |
-
border-bottom-right-radius: 5px;
|
194 |
-
border-bottom-left-radius: 5px;
|
195 |
-
}
|
196 |
-
.su-gallery-edit .su-gallery-content {
|
197 |
-
height: auto;
|
198 |
-
padding: 15px;
|
199 |
-
border: 1px solid #dfdfdf;
|
200 |
-
border-top: none;
|
201 |
-
}
|
202 |
-
.su-gallery-image {
|
203 |
-
position: relative;
|
204 |
-
min-height: 60px;
|
205 |
-
padding: 10px 0 10px 75px;
|
206 |
-
background: #fff;
|
207 |
-
border-bottom: 1px dotted #ddd;
|
208 |
-
}
|
209 |
-
.su-gallery-image-sort-handle {
|
210 |
-
position: absolute;
|
211 |
-
right: 0;
|
212 |
-
top: 10px;
|
213 |
-
display: block;
|
214 |
-
width: 30px;
|
215 |
-
height: 30px;
|
216 |
-
background: 50% 50% url('../images/galleries/move.png') no-repeat;
|
217 |
-
cursor: move;
|
218 |
-
}
|
219 |
-
.su-gallery-image-preview {
|
220 |
-
position: absolute;
|
221 |
-
left: 0;
|
222 |
-
top: 10px;
|
223 |
-
display: block;
|
224 |
-
width: 60px;
|
225 |
-
height: 60px;
|
226 |
-
}
|
227 |
-
.su-gallery-image-preview img {
|
228 |
-
width: 50px;
|
229 |
-
height: 50px;
|
230 |
-
padding: 3px;
|
231 |
-
border: 1px solid #ddd;
|
232 |
-
}
|
233 |
-
.su-gallery-image:last-child {
|
234 |
-
border: none;
|
235 |
-
margin: 0;
|
236 |
-
}
|
237 |
-
.su-gallery-image:nth-child(even) { background: #f8f8f8 }
|
238 |
-
|
239 |
-
.su-gallery-add-image {
|
240 |
-
position: relative;
|
241 |
-
height: 60px;
|
242 |
-
}
|
243 |
-
.su-gallery-add-image input {}
|
244 |
-
.su-gallery-image-uploading { background: 0 5px url('../images/galleries/loading.gif') no-repeat }
|
245 |
-
.su-gallery-image-uploading * {
|
246 |
-
position: absolute;
|
247 |
-
top: -9999px;
|
248 |
-
left: -9999px;
|
249 |
-
}
|
250 |
-
|
251 |
-
.su-gallery-image-header { height: auto }
|
252 |
-
.su-gallery-image-edit .su-gallery-image-header {
|
253 |
-
height: 0;
|
254 |
-
overflow: hidden;
|
255 |
-
}
|
256 |
-
.su-gallery-image-title {
|
257 |
-
display: inline-block;
|
258 |
-
margin: 7px 0;
|
259 |
-
font-weight: bold;
|
260 |
-
font-size: 1.1em;
|
261 |
-
text-decoration: none;
|
262 |
-
}
|
263 |
-
.su-gallery-image-actions { display: block }
|
264 |
-
.su-gallery-image-actions a {
|
265 |
-
margin-right: 1em;
|
266 |
-
font-size: 0.9em;
|
267 |
-
}
|
268 |
-
.su-gallery-image-actions a.su-gallery-image-delete { color: #f03 }
|
269 |
-
|
270 |
-
.su-gallery-image-data {
|
271 |
-
height: 0;
|
272 |
-
overflow: hidden;
|
273 |
-
}
|
274 |
-
.su-gallery-image-edit .su-gallery-image-data { height: auto }
|
275 |
-
.su-gallery-image-data label {
|
276 |
-
display: inline-block;
|
277 |
-
margin-bottom: 2px;
|
278 |
-
font-size: 0.9em;
|
279 |
-
}
|
280 |
-
.su-gallery-image-data input,
|
281 |
-
.su-gallery-image-data textarea {
|
282 |
-
width: 300px;
|
283 |
-
margin-bottom: 15px;
|
284 |
-
}
|
285 |
-
.su-gallery-image-data textarea { width: 90% }
|
286 |
-
|
287 |
-
/* Custom CSS screen */
|
288 |
-
#su-custom-css-screen { }
|
289 |
-
#su-custom-css-screen textarea {
|
290 |
-
width: 100%;
|
291 |
-
border: 1px solid #ccc;
|
292 |
-
}
|
293 |
-
|
294 |
-
.su-custom-css-originals,
|
295 |
-
.su-custom-css-vars {
|
296 |
-
margin: 1.5em 0;
|
297 |
-
line-height: 1.8;
|
298 |
-
}
|
299 |
-
.su-custom-css-originals span {
|
300 |
-
display: inline-block;
|
301 |
-
width: 1px;
|
302 |
-
height: 1em;
|
303 |
-
margin: 0 0.5em;
|
304 |
-
border-right: 1px dotted #777;
|
305 |
-
vertical-align: middle;
|
306 |
-
}
|
307 |
-
|
308 |
-
body.settings_page_shortcodesultimate .mfp-iframe-scaler iframe { background: #fff }
|
309 |
-
|
310 |
-
#sunrise-plugin-field-custom_css-editor { height: 300px }
|
311 |
#sunrise-plugin-field-custom_css-editor .ace_scrollbar { overflow-y: auto !important }
|
1 |
+
.su-clear {
|
2 |
+
height: 0;
|
3 |
+
clear: both;
|
4 |
+
}
|
5 |
+
|
6 |
+
/* About screen */
|
7 |
+
#su-about-screen { }
|
8 |
+
#su-about-screen h1 { margin: 1.5em 0 }
|
9 |
+
#su-about-screen h1 small {
|
10 |
+
display: block;
|
11 |
+
margin: 7px 0 0 20px;
|
12 |
+
font-size: 0.5em;
|
13 |
+
font-weight: normal;
|
14 |
+
color: #aaa;
|
15 |
+
}
|
16 |
+
#su-about-screen .su-about-column {
|
17 |
+
float: left;
|
18 |
+
width: 300px;
|
19 |
+
margin-right: 30px;
|
20 |
+
}
|
21 |
+
#su-links {
|
22 |
+
margin-bottom: 1.5em;
|
23 |
+
line-height: 1.6;
|
24 |
+
}
|
25 |
+
#su-links span {
|
26 |
+
display: inline-block;
|
27 |
+
width: 1px;
|
28 |
+
height: 1em;
|
29 |
+
margin: 0 0.5em;
|
30 |
+
border-right: 1px dotted #777;
|
31 |
+
vertical-align: middle;
|
32 |
+
}
|
33 |
+
#su-video {
|
34 |
+
width: 100%;
|
35 |
+
max-width: 630px;
|
36 |
+
min-width: 200px;
|
37 |
+
margin-top: 40px;
|
38 |
+
}
|
39 |
+
#su-video iframe {
|
40 |
+
width: 100%;
|
41 |
+
height: 370px;
|
42 |
+
}
|
43 |
+
|
44 |
+
/* CheatSheet screen */
|
45 |
+
.su-table-demos tr.even td { background: #fff }
|
46 |
+
.su-table-demos td { padding: 20px 10px }
|
47 |
+
.su-table-demos td small { color: #aaa }
|
48 |
+
.su-table-demos td a.su-preview {
|
49 |
+
position: relative;
|
50 |
+
display: block;
|
51 |
+
width: 100px;
|
52 |
+
height: 100px;
|
53 |
+
margin-bottom: 30px;
|
54 |
+
overflow: hidden;
|
55 |
+
padding: 3px;
|
56 |
+
background: #fff;
|
57 |
+
border: 2px solid #fff;
|
58 |
+
border-radius: 50%;
|
59 |
+
-moz-border-radius: 50%;
|
60 |
+
-webkit-border-radius: 50%;
|
61 |
+
box-shadow: 0 1px 5px #ccc;
|
62 |
+
-moz-box-shadow: 0 1px 5px #ccc;
|
63 |
+
-webkit-box-shadow: 0 1px 5px #ccc;
|
64 |
+
}
|
65 |
+
.su-table-demos td a.su-preview:after {
|
66 |
+
display: none;
|
67 |
+
content: '';
|
68 |
+
position: absolute;
|
69 |
+
left: 0;
|
70 |
+
top: 0;
|
71 |
+
height: 100%;
|
72 |
+
width: 100%;
|
73 |
+
background: rgb(0, 0, 0) 50% 120% url('../images/preview.png') no-repeat;
|
74 |
+
background-color: rgba(0, 0, 0, 0.5);
|
75 |
+
opacity: 0.7;
|
76 |
+
filter: alpha(opacity=70);
|
77 |
+
}
|
78 |
+
.su-table-demos td a.su-preview:hover:after { display: block }
|
79 |
+
.su-table-demos td a.su-preview img {
|
80 |
+
position: absolute;
|
81 |
+
top: -5%;
|
82 |
+
left: -50%;
|
83 |
+
display: block;
|
84 |
+
}
|
85 |
+
.su-table-demos td a.su-preview:hover:after {
|
86 |
+
display: block;
|
87 |
+
content: '';
|
88 |
+
position: absolute;
|
89 |
+
left: 0;
|
90 |
+
top: 0;
|
91 |
+
height: 100%;
|
92 |
+
width: 100%;
|
93 |
+
background: rgb(0, 0, 0) 50% 50% url('../images/preview.png') no-repeat;
|
94 |
+
background-color: rgba(0, 0, 0, 0.5);
|
95 |
+
}
|
96 |
+
.su-table-demos td h4 {
|
97 |
+
margin: 5px 0;
|
98 |
+
font-size: 1.2em;
|
99 |
+
}
|
100 |
+
.su-table-demos td span {
|
101 |
+
display: block;
|
102 |
+
margin-bottom: 10px;
|
103 |
+
}
|
104 |
+
.su-table-demos td strong {
|
105 |
+
display: block;
|
106 |
+
margin-bottom: 0.7em;
|
107 |
+
}
|
108 |
+
.su-table-demos .su-cheatsheet-parameter { line-height: 1.5 }
|
109 |
+
.su-table-demos td textarea {
|
110 |
+
height: 90px;
|
111 |
+
width: 100%;
|
112 |
+
border: none;
|
113 |
+
background: #ffffe6;
|
114 |
+
}
|
115 |
+
|
116 |
+
/* Galleries screen */
|
117 |
+
#su-galleries {
|
118 |
+
margin: 1em 0;
|
119 |
+
}
|
120 |
+
#su-galleries-actions { margin-bottom: 1.5em }
|
121 |
+
#su-galleries-not-found {
|
122 |
+
font-size: 1.5em;
|
123 |
+
color: #ccc;
|
124 |
+
font-weight: bold;
|
125 |
+
margin: 1em 0;
|
126 |
+
}
|
127 |
+
.su-gallery { margin: 1em 0 }
|
128 |
+
.su-gallery-title {
|
129 |
+
position: relative;
|
130 |
+
padding: 5px 15px;
|
131 |
+
color: #333;
|
132 |
+
border: 1px solid #dfdfdf;
|
133 |
+
border-radius: 5px;
|
134 |
+
-moz-border-radius: 5px;
|
135 |
+
-webkit-border-radius: 5px;
|
136 |
+
background: #fff;
|
137 |
+
background: -moz-linear-gradient(top, #fff 0%, #f8f8f8 2%, #ececec 100%);
|
138 |
+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #fff), color-stop(2%, #f8f8f8), color-stop(100%, #ececec));
|
139 |
+
background: -webkit-linear-gradient(top, #fff 0%, #f8f8f8 2%, #ececec 100%);
|
140 |
+
background: -o-linear-gradient(top, #fff 0%, #f8f8f8 2%, #ececec 100%);
|
141 |
+
background: -ms-linear-gradient(top, #fff 0%, #f8f8f8 2%, #ececec 100%);
|
142 |
+
background: linear-gradient(to bottom, #fff 0%, #f8f8f8 2%, #ececec 100%);
|
143 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#ececec', GradientType=0);
|
144 |
+
}
|
145 |
+
.su-gallery-edit .su-gallery-title {
|
146 |
+
-webkit-border-bottom-right-radius: 0;
|
147 |
+
-webkit-border-bottom-left-radius: 0;
|
148 |
+
-moz-border-radius-bottomright: 0;
|
149 |
+
-moz-border-radius-bottomleft: 0;
|
150 |
+
border-bottom-right-radius: 0;
|
151 |
+
border-bottom-left-radius: 0;
|
152 |
+
}
|
153 |
+
input.su-gallery-name {
|
154 |
+
position: relative;
|
155 |
+
top: 1px;
|
156 |
+
width: 200px;
|
157 |
+
font-weight: bold;
|
158 |
+
border-width: 0;
|
159 |
+
background-color: transparent;
|
160 |
+
}
|
161 |
+
.su-gallery-edit input.su-gallery-name {
|
162 |
+
top: 0;
|
163 |
+
font-weight: normal;
|
164 |
+
border-width: 1px;
|
165 |
+
background-color: #fff;
|
166 |
+
}
|
167 |
+
.su-gallery-actions {
|
168 |
+
position: absolute;
|
169 |
+
top: 10px;
|
170 |
+
right: 15px;
|
171 |
+
}
|
172 |
+
.su-gallery-actions a { margin-left: 1em }
|
173 |
+
.su-gallery-close,
|
174 |
+
.su-gallery-save-close { display: none }
|
175 |
+
.su-gallery-edit .su-gallery-close,
|
176 |
+
.su-gallery-edit .su-gallery-save-close { display: inline }
|
177 |
+
.su-gallery-edit .su-gallery-open { display: none }
|
178 |
+
.su-gallery-delete { color: #f03 }
|
179 |
+
.su-gallery-edit .su-gallery-save-close { font-weight: bold }
|
180 |
+
|
181 |
+
.su-gallery-content {
|
182 |
+
height: 0;
|
183 |
+
overflow: hidden;
|
184 |
+
transition: padding-top .2s;
|
185 |
+
-o-transition: padding-top .2s;
|
186 |
+
-ie-transition: padding-top .2s;
|
187 |
+
-moz-transition: padding-top .2s;
|
188 |
+
-webkit-transition: padding-top .2s;
|
189 |
+
-webkit-border-bottom-right-radius: 5px;
|
190 |
+
-webkit-border-bottom-left-radius: 5px;
|
191 |
+
-moz-border-radius-bottomright: 5px;
|
192 |
+
-moz-border-radius-bottomleft: 5px;
|
193 |
+
border-bottom-right-radius: 5px;
|
194 |
+
border-bottom-left-radius: 5px;
|
195 |
+
}
|
196 |
+
.su-gallery-edit .su-gallery-content {
|
197 |
+
height: auto;
|
198 |
+
padding: 15px;
|
199 |
+
border: 1px solid #dfdfdf;
|
200 |
+
border-top: none;
|
201 |
+
}
|
202 |
+
.su-gallery-image {
|
203 |
+
position: relative;
|
204 |
+
min-height: 60px;
|
205 |
+
padding: 10px 0 10px 75px;
|
206 |
+
background: #fff;
|
207 |
+
border-bottom: 1px dotted #ddd;
|
208 |
+
}
|
209 |
+
.su-gallery-image-sort-handle {
|
210 |
+
position: absolute;
|
211 |
+
right: 0;
|
212 |
+
top: 10px;
|
213 |
+
display: block;
|
214 |
+
width: 30px;
|
215 |
+
height: 30px;
|
216 |
+
background: 50% 50% url('../images/galleries/move.png') no-repeat;
|
217 |
+
cursor: move;
|
218 |
+
}
|
219 |
+
.su-gallery-image-preview {
|
220 |
+
position: absolute;
|
221 |
+
left: 0;
|
222 |
+
top: 10px;
|
223 |
+
display: block;
|
224 |
+
width: 60px;
|
225 |
+
height: 60px;
|
226 |
+
}
|
227 |
+
.su-gallery-image-preview img {
|
228 |
+
width: 50px;
|
229 |
+
height: 50px;
|
230 |
+
padding: 3px;
|
231 |
+
border: 1px solid #ddd;
|
232 |
+
}
|
233 |
+
.su-gallery-image:last-child {
|
234 |
+
border: none;
|
235 |
+
margin: 0;
|
236 |
+
}
|
237 |
+
.su-gallery-image:nth-child(even) { background: #f8f8f8 }
|
238 |
+
|
239 |
+
.su-gallery-add-image {
|
240 |
+
position: relative;
|
241 |
+
height: 60px;
|
242 |
+
}
|
243 |
+
.su-gallery-add-image input {}
|
244 |
+
.su-gallery-image-uploading { background: 0 5px url('../images/galleries/loading.gif') no-repeat }
|
245 |
+
.su-gallery-image-uploading * {
|
246 |
+
position: absolute;
|
247 |
+
top: -9999px;
|
248 |
+
left: -9999px;
|
249 |
+
}
|
250 |
+
|
251 |
+
.su-gallery-image-header { height: auto }
|
252 |
+
.su-gallery-image-edit .su-gallery-image-header {
|
253 |
+
height: 0;
|
254 |
+
overflow: hidden;
|
255 |
+
}
|
256 |
+
.su-gallery-image-title {
|
257 |
+
display: inline-block;
|
258 |
+
margin: 7px 0;
|
259 |
+
font-weight: bold;
|
260 |
+
font-size: 1.1em;
|
261 |
+
text-decoration: none;
|
262 |
+
}
|
263 |
+
.su-gallery-image-actions { display: block }
|
264 |
+
.su-gallery-image-actions a {
|
265 |
+
margin-right: 1em;
|
266 |
+
font-size: 0.9em;
|
267 |
+
}
|
268 |
+
.su-gallery-image-actions a.su-gallery-image-delete { color: #f03 }
|
269 |
+
|
270 |
+
.su-gallery-image-data {
|
271 |
+
height: 0;
|
272 |
+
overflow: hidden;
|
273 |
+
}
|
274 |
+
.su-gallery-image-edit .su-gallery-image-data { height: auto }
|
275 |
+
.su-gallery-image-data label {
|
276 |
+
display: inline-block;
|
277 |
+
margin-bottom: 2px;
|
278 |
+
font-size: 0.9em;
|
279 |
+
}
|
280 |
+
.su-gallery-image-data input,
|
281 |
+
.su-gallery-image-data textarea {
|
282 |
+
width: 300px;
|
283 |
+
margin-bottom: 15px;
|
284 |
+
}
|
285 |
+
.su-gallery-image-data textarea { width: 90% }
|
286 |
+
|
287 |
+
/* Custom CSS screen */
|
288 |
+
#su-custom-css-screen { }
|
289 |
+
#su-custom-css-screen textarea {
|
290 |
+
width: 100%;
|
291 |
+
border: 1px solid #ccc;
|
292 |
+
}
|
293 |
+
|
294 |
+
.su-custom-css-originals,
|
295 |
+
.su-custom-css-vars {
|
296 |
+
margin: 1.5em 0;
|
297 |
+
line-height: 1.8;
|
298 |
+
}
|
299 |
+
.su-custom-css-originals span {
|
300 |
+
display: inline-block;
|
301 |
+
width: 1px;
|
302 |
+
height: 1em;
|
303 |
+
margin: 0 0.5em;
|
304 |
+
border-right: 1px dotted #777;
|
305 |
+
vertical-align: middle;
|
306 |
+
}
|
307 |
+
|
308 |
+
body.settings_page_shortcodesultimate .mfp-iframe-scaler iframe { background: #fff }
|
309 |
+
|
310 |
+
#sunrise-plugin-field-custom_css-editor { height: 300px }
|
311 |
#sunrise-plugin-field-custom_css-editor .ace_scrollbar { overflow-y: auto !important }
|
assets/css/other-shortcodes.css
CHANGED
@@ -1,127 +1,127 @@
|
|
1 |
-
/*** Shortcodes Ultimate - other elements ***/
|
2 |
-
|
3 |
-
/* Private
|
4 |
-
---------------------------------------------------------------*/
|
5 |
-
|
6 |
-
.su-private { margin: 0 0 1.5em 0 }
|
7 |
-
|
8 |
-
/* Members
|
9 |
-
---------------------------------------------------------------*/
|
10 |
-
|
11 |
-
.su-members {
|
12 |
-
margin-bottom: 1.5em;
|
13 |
-
padding: 1em;
|
14 |
-
border-width: 1px 0;
|
15 |
-
border-style: solid;
|
16 |
-
text-align: center;
|
17 |
-
}
|
18 |
-
.su-members a {
|
19 |
-
text-decoration: underline;
|
20 |
-
color: inherit;
|
21 |
-
}
|
22 |
-
|
23 |
-
/* Guests
|
24 |
-
---------------------------------------------------------------*/
|
25 |
-
|
26 |
-
.su-guests { margin-bottom: 1.5em }
|
27 |
-
|
28 |
-
/* Posts
|
29 |
-
---------------------------------------------------------------*/
|
30 |
-
|
31 |
-
.su-posts-default-loop { }
|
32 |
-
.su-posts-default-loop .su-post {
|
33 |
-
margin-bottom: 2.5em;
|
34 |
-
line-height: 1.5;
|
35 |
-
}
|
36 |
-
.su-posts-default-loop .su-post:after {
|
37 |
-
content: '';
|
38 |
-
display: table;
|
39 |
-
clear: both;
|
40 |
-
}
|
41 |
-
.su-posts-default-loop .su-post-thumbnail {
|
42 |
-
float: left;
|
43 |
-
display: block;
|
44 |
-
width: 100px;
|
45 |
-
height: 100px;
|
46 |
-
margin-right: 1em;
|
47 |
-
}
|
48 |
-
.su-posts-default-loop .su-post-thumbnail img {
|
49 |
-
max-width: 100px;
|
50 |
-
max-height: 100px;
|
51 |
-
}
|
52 |
-
.su-posts-default-loop h2.su-post-title {
|
53 |
-
clear: none;
|
54 |
-
margin: 0 0 0.3em 0;
|
55 |
-
font-size: 1.2em;
|
56 |
-
font-weight: bold;
|
57 |
-
}
|
58 |
-
.su-posts-default-loop .su-post-meta {
|
59 |
-
margin-bottom: 0.7em;
|
60 |
-
font-size: 0.8em;
|
61 |
-
opacity: 0.6;
|
62 |
-
filter: alpha(opacity=60);
|
63 |
-
}
|
64 |
-
.su-posts-default-loop .su-post-excerpt { margin-bottom: 0.5em }
|
65 |
-
.su-posts-default-loop .su-post-excerpt p:last-child { margin-bottom: 0 }
|
66 |
-
.su-posts-default-loop .su-post-comments-link { font-size: 0.9em }
|
67 |
-
.su-posts-teaser-loop { }
|
68 |
-
.su-posts-teaser-loop .su-post {
|
69 |
-
margin-bottom: 1.5em;
|
70 |
-
line-height: 1.2;
|
71 |
-
}
|
72 |
-
.su-posts-teaser-loop .su-post:after {
|
73 |
-
content: '';
|
74 |
-
display: table;
|
75 |
-
clear: both;
|
76 |
-
}
|
77 |
-
.su-posts-teaser-loop .su-post-thumbnail {
|
78 |
-
float: left;
|
79 |
-
display: block;
|
80 |
-
width: 56px;
|
81 |
-
height: 56px;
|
82 |
-
margin: 0 1em 0 0;
|
83 |
-
}
|
84 |
-
.su-posts-teaser-loop .su-post-thumbnail img {
|
85 |
-
display: block;
|
86 |
-
margin: 0;
|
87 |
-
padding: 2px;
|
88 |
-
border: 1px solid #ccc;
|
89 |
-
border-radius: 5px;
|
90 |
-
-moz-border-radius: 5px;
|
91 |
-
-webkit-border-radius: 5px;
|
92 |
-
max-width: 100%;
|
93 |
-
max-height: 100%;
|
94 |
-
}
|
95 |
-
.su-posts-teaser-loop h2.su-post-title {
|
96 |
-
display: block;
|
97 |
-
margin: 0;
|
98 |
-
padding: 0;
|
99 |
-
border: none;
|
100 |
-
font-size: 0.9em;
|
101 |
-
font-weight: normal;
|
102 |
-
clear: none;
|
103 |
-
}
|
104 |
-
.su-posts-single-post { }
|
105 |
-
.su-posts-single-post .su-post {
|
106 |
-
margin-bottom: 2.5em;
|
107 |
-
line-height: 1.5;
|
108 |
-
}
|
109 |
-
.su-posts-single-post .su-post:after {
|
110 |
-
content: '';
|
111 |
-
display: table;
|
112 |
-
clear: both;
|
113 |
-
}
|
114 |
-
.su-posts-single-post h1.su-post-title {
|
115 |
-
clear: none;
|
116 |
-
margin: 0 0 0.3em 0;
|
117 |
-
font-size: 1.2em;
|
118 |
-
font-weight: bold;
|
119 |
-
}
|
120 |
-
.su-posts-single-post .su-post-meta {
|
121 |
-
margin-bottom: 0.7em;
|
122 |
-
font-size: 0.8em;
|
123 |
-
opacity: 0.6;
|
124 |
-
filter: alpha(opacity=60);
|
125 |
-
}
|
126 |
-
.su-posts-single-post .su-post-content { margin-bottom: 0.5em }
|
127 |
.su-posts-single-post .su-post-content p:last-child { margin-bottom: 0 }
|
1 |
+
/*** Shortcodes Ultimate - other elements ***/
|
2 |
+
|
3 |
+
/* Private
|
4 |
+
---------------------------------------------------------------*/
|
5 |
+
|
6 |
+
.su-private { margin: 0 0 1.5em 0 }
|
7 |
+
|
8 |
+
/* Members
|
9 |
+
---------------------------------------------------------------*/
|
10 |
+
|
11 |
+
.su-members {
|
12 |
+
margin-bottom: 1.5em;
|
13 |
+
padding: 1em;
|
14 |
+
border-width: 1px 0;
|
15 |
+
border-style: solid;
|
16 |
+
text-align: center;
|
17 |
+
}
|
18 |
+
.su-members a {
|
19 |
+
text-decoration: underline;
|
20 |
+
color: inherit;
|
21 |
+
}
|
22 |
+
|
23 |
+
/* Guests
|
24 |
+
---------------------------------------------------------------*/
|
25 |
+
|
26 |
+
.su-guests { margin-bottom: 1.5em }
|
27 |
+
|
28 |
+
/* Posts
|
29 |
+
---------------------------------------------------------------*/
|
30 |
+
|
31 |
+
.su-posts-default-loop { }
|
32 |
+
.su-posts-default-loop .su-post {
|
33 |
+
margin-bottom: 2.5em;
|
34 |
+
line-height: 1.5;
|
35 |
+
}
|
36 |
+
.su-posts-default-loop .su-post:after {
|
37 |
+
content: '';
|
38 |
+
display: table;
|
39 |
+
clear: both;
|
40 |
+
}
|
41 |
+
.su-posts-default-loop .su-post-thumbnail {
|
42 |
+
float: left;
|
43 |
+
display: block;
|
44 |
+
width: 100px;
|
45 |
+
height: 100px;
|
46 |
+
margin-right: 1em;
|
47 |
+
}
|
48 |
+
.su-posts-default-loop .su-post-thumbnail img {
|
49 |
+
max-width: 100px;
|
50 |
+
max-height: 100px;
|
51 |
+
}
|
52 |
+
.su-posts-default-loop h2.su-post-title {
|
53 |
+
clear: none;
|
54 |
+
margin: 0 0 0.3em 0;
|
55 |
+
font-size: 1.2em;
|
56 |
+
font-weight: bold;
|
57 |
+
}
|
58 |
+
.su-posts-default-loop .su-post-meta {
|
59 |
+
margin-bottom: 0.7em;
|
60 |
+
font-size: 0.8em;
|
61 |
+
opacity: 0.6;
|
62 |
+
filter: alpha(opacity=60);
|
63 |
+
}
|
64 |
+
.su-posts-default-loop .su-post-excerpt { margin-bottom: 0.5em }
|
65 |
+
.su-posts-default-loop .su-post-excerpt p:last-child { margin-bottom: 0 }
|
66 |
+
.su-posts-default-loop .su-post-comments-link { font-size: 0.9em }
|
67 |
+
.su-posts-teaser-loop { }
|
68 |
+
.su-posts-teaser-loop .su-post {
|
69 |
+
margin-bottom: 1.5em;
|
70 |
+
line-height: 1.2;
|
71 |
+
}
|
72 |
+
.su-posts-teaser-loop .su-post:after {
|
73 |
+
content: '';
|
74 |
+
display: table;
|
75 |
+
clear: both;
|
76 |
+
}
|
77 |
+
.su-posts-teaser-loop .su-post-thumbnail {
|
78 |
+
float: left;
|
79 |
+
display: block;
|
80 |
+
width: 56px;
|
81 |
+
height: 56px;
|
82 |
+
margin: 0 1em 0 0;
|
83 |
+
}
|
84 |
+
.su-posts-teaser-loop .su-post-thumbnail img {
|
85 |
+
display: block;
|
86 |
+
margin: 0;
|
87 |
+
padding: 2px;
|
88 |
+
border: 1px solid #ccc;
|
89 |
+
border-radius: 5px;
|
90 |
+
-moz-border-radius: 5px;
|
91 |
+
-webkit-border-radius: 5px;
|
92 |
+
max-width: 100%;
|
93 |
+
max-height: 100%;
|
94 |
+
}
|
95 |
+
.su-posts-teaser-loop h2.su-post-title {
|
96 |
+
display: block;
|
97 |
+
margin: 0;
|
98 |
+
padding: 0;
|
99 |
+
border: none;
|
100 |
+
font-size: 0.9em;
|
101 |
+
font-weight: normal;
|
102 |
+
clear: none;
|
103 |
+
}
|
104 |
+
.su-posts-single-post { }
|
105 |
+
.su-posts-single-post .su-post {
|
106 |
+
margin-bottom: 2.5em;
|
107 |
+
line-height: 1.5;
|
108 |
+
}
|
109 |
+
.su-posts-single-post .su-post:after {
|
110 |
+
content: '';
|
111 |
+
display: table;
|
112 |
+
clear: both;
|
113 |
+
}
|
114 |
+
.su-posts-single-post h1.su-post-title {
|
115 |
+
clear: none;
|
116 |
+
margin: 0 0 0.3em 0;
|
117 |
+
font-size: 1.2em;
|
118 |
+
font-weight: bold;
|
119 |
+
}
|
120 |
+
.su-posts-single-post .su-post-meta {
|
121 |
+
margin-bottom: 0.7em;
|
122 |
+
font-size: 0.8em;
|
123 |
+
opacity: 0.6;
|
124 |
+
filter: alpha(opacity=60);
|
125 |
+
}
|
126 |
+
.su-posts-single-post .su-post-content { margin-bottom: 0.5em }
|
127 |
.su-posts-single-post .su-post-content p:last-child { margin-bottom: 0 }
|
assets/css/players-shortcodes.css
CHANGED
@@ -1,297 +1,297 @@
|
|
1 |
-
/*** Shortcodes Ultimate - players elements ***/
|
2 |
-
|
3 |
-
/* Audio
|
4 |
-
---------------------------------------------------------------*/
|
5 |
-
|
6 |
-
.su-audio { }
|
7 |
-
.su-audio {
|
8 |
-
position: relative;
|
9 |
-
width: 100%;
|
10 |
-
height: 30px;
|
11 |
-
margin-bottom: 1.5em;
|
12 |
-
background: #7c8781; /* Old browsers */
|
13 |
-
background: -moz-linear-gradient(top, #7c8781 0%, #0a0809 100%); /* FF3.6+ */
|
14 |
-
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #7c8781), color-stop(100%, #0a0809)); /* Chrome,Safari4+ */
|
15 |
-
background: -webkit-linear-gradient(top, #7c8781 0%, #0a0809 100%); /* Chrome10+,Safari5.1+ */
|
16 |
-
background: -o-linear-gradient(top, #7c8781 0%, #0a0809 100%); /* Opera 11.10+ */
|
17 |
-
background: -ms-linear-gradient(top, #7c8781 0%, #0a0809 100%); /* IE10+ */
|
18 |
-
background: linear-gradient(to bottom, #7c8781 0%, #0a0809 100%); /* W3C */
|
19 |
-
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#7c8781', endColorstr='#0a0809', GradientType=0); /* IE6-9 */
|
20 |
-
border-radius: 3px;
|
21 |
-
-moz-border-radius: 3px;
|
22 |
-
-webkit-border-radius: 3px;
|
23 |
-
}
|
24 |
-
.su-audio .jp-play,
|
25 |
-
.su-audio .jp-pause {
|
26 |
-
position: absolute;
|
27 |
-
left: 0;
|
28 |
-
top: 0;
|
29 |
-
display: block;
|
30 |
-
width: 30px;
|
31 |
-
height: 30px;
|
32 |
-
-webkit-border-top-left-radius: 3px;
|
33 |
-
-webkit-border-bottom-left-radius: 3px;
|
34 |
-
-moz-border-radius-topleft: 3px;
|
35 |
-
-moz-border-radius-bottomleft: 3px;
|
36 |
-
border-top-left-radius: 3px;
|
37 |
-
border-bottom-left-radius: 3px;
|
38 |
-
cursor: pointer;
|
39 |
-
border-right: 1px solid #454947;
|
40 |
-
background-image: url('../images/player/default.png');
|
41 |
-
background-repeat: no-repeat;
|
42 |
-
}
|
43 |
-
.su-audio .jp-play { background-position: 0 0 }
|
44 |
-
.su-audio .jp-pause { background-position: -30px 0 }
|
45 |
-
.su-audio .jp-current-time,
|
46 |
-
.su-audio .jp-duration {
|
47 |
-
position: absolute;
|
48 |
-
top: 0;
|
49 |
-
display: block;
|
50 |
-
height: 30px;
|
51 |
-
line-height: 30px;
|
52 |
-
font-size: 10px;
|
53 |
-
color: #eee;
|
54 |
-
text-shadow: 0 -1px 0 #000;
|
55 |
-
-moz-text-shadow: 0 -1px 0 #000;
|
56 |
-
-webkit-text-shadow: 0 -1px 0 #000;
|
57 |
-
}
|
58 |
-
.su-audio .jp-current-time { left: 45px }
|
59 |
-
.su-audio .jp-duration { right: 10px }
|
60 |
-
.su-audio .jp-seek-bar,
|
61 |
-
.su-audio .jp-play-bar {
|
62 |
-
position: absolute;
|
63 |
-
top: 0;
|
64 |
-
left: 0;
|
65 |
-
height: 10px;
|
66 |
-
border-radius: 3px;
|
67 |
-
-moz-border-radius: 3px;
|
68 |
-
-webkit-border-radius: 3px;
|
69 |
-
cursor: pointer;
|
70 |
-
}
|
71 |
-
.su-audio .jp-progress {
|
72 |
-
position: absolute;
|
73 |
-
top: 10px;
|
74 |
-
left: 85px;
|
75 |
-
right: 50px;
|
76 |
-
height: 10px;
|
77 |
-
background: #333;
|
78 |
-
box-shadow: 0 0 5px #000 inset;
|
79 |
-
-moz-box-shadow: 0 0 5px #000 inset;
|
80 |
-
-webkit-box-shadow: 0 0 5px #000 inset;
|
81 |
-
border-radius: 3px;
|
82 |
-
-moz-border-radius: 3px;
|
83 |
-
-webkit-border-radius: 3px;
|
84 |
-
}
|
85 |
-
.su-audio .jp-seek-bar {
|
86 |
-
background: #0b0b0b; /* Old browsers */
|
87 |
-
background: -moz-linear-gradient(top, #0b0b0b 0%, #666 100%); /* FF3.6+ */
|
88 |
-
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #0b0b0b), color-stop(100%, #666)); /* Chrome,Safari4+ */
|
89 |
-
background: -webkit-linear-gradient(top, #0b0b0b 0%, #666 100%); /* Chrome10+,Safari5.1+ */
|
90 |
-
background: -o-linear-gradient(top, #0b0b0b 0%, #666 100%); /* Opera 11.10+ */
|
91 |
-
background: -ms-linear-gradient(top, #0b0b0b 0%, #666 100%); /* IE10+ */
|
92 |
-
background: linear-gradient(to bottom, #0b0b0b 0%, #666 100%); /* W3C */
|
93 |
-
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0b0b0b', endColorstr='#666666', GradientType=0); /* IE6-9 */
|
94 |
-
}
|
95 |
-
.su-audio .jp-play-bar {
|
96 |
-
background: #6db3f2; /* Old browsers */
|
97 |
-
background: -moz-linear-gradient(top, #6db3f2 0%, #54a3ee 50%, #3690f0 51%, #1e69de 100%); /* FF3.6+ */
|
98 |
-
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #6db3f2), color-stop(50%, #54a3ee), color-stop(51%, #3690f0), color-stop(100%, #1e69de)); /* Chrome,Safari4+ */
|
99 |
-
background: -webkit-linear-gradient(top, #6db3f2 0%, #54a3ee 50%, #3690f0 51%, #1e69de 100%); /* Chrome10+,Safari5.1+ */
|
100 |
-
background: -o-linear-gradient(top, #6db3f2 0%, #54a3ee 50%, #3690f0 51%, #1e69de 100%); /* Opera 11.10+ */
|
101 |
-
background: -ms-linear-gradient(top, #6db3f2 0%, #54a3ee 50%, #3690f0 51%, #1e69de 100%); /* IE10+ */
|
102 |
-
background: linear-gradient(to bottom, #6db3f2 0%, #54a3ee 50%, #3690f0 51%, #1e69de 100%); /* W3C */
|
103 |
-
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#6db3f2', endColorstr='#1e69de', GradientType=0); /* IE6-9 */
|
104 |
-
}
|
105 |
-
|
106 |
-
/* Video
|
107 |
-
---------------------------------------------------------------*/
|
108 |
-
|
109 |
-
.su-video {
|
110 |
-
position: relative;
|
111 |
-
margin-bottom: 1.5em;
|
112 |
-
overflow: hidden;
|
113 |
-
}
|
114 |
-
.su-video .jp-title {
|
115 |
-
position: absolute;
|
116 |
-
top: -100px;
|
117 |
-
left: 0;
|
118 |
-
width: 100%;
|
119 |
-
height: 30px;
|
120 |
-
padding: 0 1em;
|
121 |
-
line-height: 30px;
|
122 |
-
font-size: 0.9em;
|
123 |
-
background: rgb(0, 0, 0);
|
124 |
-
background: rgba(0, 0, 0, 0.5);
|
125 |
-
color: #fff;
|
126 |
-
transition: top .2s;
|
127 |
-
-o-transition: top .2s;
|
128 |
-
-ie-transition: top .2s;
|
129 |
-
-moz-transition: top .2s;
|
130 |
-
-webkit-transition: top .2s;
|
131 |
-
}
|
132 |
-
.su-video:hover .jp-title { top: 0 }
|
133 |
-
.su-video .jp-start {
|
134 |
-
position: absolute;
|
135 |
-
left: 0;
|
136 |
-
top: 0;
|
137 |
-
width: 100%;
|
138 |
-
height: 100%;
|
139 |
-
cursor: pointer;
|
140 |
-
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
|
141 |
-
filter: alpha(opacity=50);
|
142 |
-
-moz-opacity: 0.5;
|
143 |
-
-khtml-opacity: 0.5;
|
144 |
-
opacity: 0.5;
|
145 |
-
transition: opacity .2s;
|
146 |
-
-moz-transition: opacity .2s;
|
147 |
-
-webkit-transition: opacity .2s;
|
148 |
-
-o-transition: opacity .2s;
|
149 |
-
}
|
150 |
-
.su-video:hover .jp-start {
|
151 |
-
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=80)";
|
152 |
-
filter: alpha(opacity=80);
|
153 |
-
-moz-opacity: 0.8;
|
154 |
-
-khtml-opacity: 0.8;
|
155 |
-
opacity: 0.8;
|
156 |
-
}
|
157 |
-
.su-video.jp-video-full {
|
158 |
-
position: fixed;
|
159 |
-
left: 0;
|
160 |
-
top: 0;
|
161 |
-
width: 100%;
|
162 |
-
height: 100%;
|
163 |
-
}
|
164 |
-
.su-video.jp-video-full .jp-jplayer {
|
165 |
-
position: fixed !important;
|
166 |
-
left: 0;
|
167 |
-
top: 0;
|
168 |
-
overflow: hidden;
|
169 |
-
}
|
170 |
-
.su-video .jp-gui { position: relative }
|
171 |
-
.su-video.jp-video-full .jp-gui {
|
172 |
-
position: fixed;
|
173 |
-
left: 0;
|
174 |
-
bottom: 0;
|
175 |
-
width: 100%;
|
176 |
-
}
|
177 |
-
.su-video-controls-no .jp-gui {
|
178 |
-
position: absolute !important;
|
179 |
-
bottom: -100px;
|
180 |
-
left: 0;
|
181 |
-
right: 0;
|
182 |
-
transition: bottom .2s;
|
183 |
-
-o-transition: bottom .2s;
|
184 |
-
-ie-transition: bottom .2s;
|
185 |
-
-moz-transition: bottom .2s;
|
186 |
-
-webkit-transition: bottom .2s;
|
187 |
-
}
|
188 |
-
.su-video-controls-no:hover .jp-gui { bottom: 0 }
|
189 |
-
.su-video img {
|
190 |
-
border-radius: 0 !important;
|
191 |
-
-moz-border-radius: 0 !important;
|
192 |
-
-webkit-border-radius: 0 !important;
|
193 |
-
border: none !important;
|
194 |
-
margin: 0 !important;
|
195 |
-
padding: 0 !important;
|
196 |
-
}
|
197 |
-
.su-video .jp-start { background: 50% 50% url('../images/player/default-start.png') no-repeat }
|
198 |
-
.su-video .jp-gui {
|
199 |
-
height: 30px;
|
200 |
-
background: #7c8781; /* Old browsers */
|
201 |
-
background: -moz-linear-gradient(top, #7c8781 0%, #0a0809 100%); /* FF3.6+ */
|
202 |
-
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #7c8781), color-stop(100%, #0a0809)); /* Chrome,Safari4+ */
|
203 |
-
background: -webkit-linear-gradient(top, #7c8781 0%, #0a0809 100%); /* Chrome10+,Safari5.1+ */
|
204 |
-
background: -o-linear-gradient(top, #7c8781 0%, #0a0809 100%); /* Opera 11.10+ */
|
205 |
-
background: -ms-linear-gradient(top, #7c8781 0%, #0a0809 100%); /* IE10+ */
|
206 |
-
background: linear-gradient(to bottom, #7c8781 0%, #0a0809 100%); /* W3C */
|
207 |
-
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#7c8781', endColorstr='#0a0809', GradientType=0); /* IE6-9 */
|
208 |
-
-webkit-border-bottom-right-radius: 3px;
|
209 |
-
-webkit-border-bottom-left-radius: 3px;
|
210 |
-
-moz-border-radius-bottomright: 3px;
|
211 |
-
-moz-border-radius-bottomleft: 3px;
|
212 |
-
border-bottom-right-radius: 3px;
|
213 |
-
border-bottom-left-radius: 3px;
|
214 |
-
}
|
215 |
-
.su-video .jp-gui .jp-play,
|
216 |
-
.su-video .jp-gui .jp-pause {
|
217 |
-
position: absolute;
|
218 |
-
left: 0;
|
219 |
-
top: 0;
|
220 |
-
display: block;
|
221 |
-
width: 30px;
|
222 |
-
height: 30px;
|
223 |
-
border-right: 1px solid #454947;
|
224 |
-
cursor: pointer;
|
225 |
-
}
|
226 |
-
.su-video .jp-gui .jp-play { background: 0 0 url('../images/player/default.png') no-repeat }
|
227 |
-
.su-video .jp-gui .jp-pause { background: -30px 0 url('../images/player/default.png') no-repeat }
|
228 |
-
.su-video .jp-full-screen,
|
229 |
-
.su-video .jp-restore-screen {
|
230 |
-
position: absolute;
|
231 |
-
top: 0;
|
232 |
-
right: 0;
|
233 |
-
display: block;
|
234 |
-
width: 30px;
|
235 |
-
height: 30px;
|
236 |
-
border-left: 1px solid #454947;
|
237 |
-
cursor: pointer;
|
238 |
-
}
|
239 |
-
.su-video .jp-full-screen { background: 0 -30px url('../images/player/default.png') no-repeat }
|
240 |
-
.su-video .jp-restore-screen { background: -30px -30px url('../images/player/default.png') no-repeat }
|
241 |
-
.su-video .jp-progress {
|
242 |
-
position: absolute;
|
243 |
-
top: 10px;
|
244 |
-
left: 90px;
|
245 |
-
right: 90px;
|
246 |
-
height: 10px;
|
247 |
-
background: #333;
|
248 |
-
border-radius: 3px;
|
249 |
-
-moz-border-radius: 3px;
|
250 |
-
-webkit-border-radius: 3px;
|
251 |
-
box-shadow: 0 0 5px #000 inset;
|
252 |
-
-moz-box-shadow: 0 0 5px #000 inset;
|
253 |
-
-webkit-box-shadow: 0 0 5px #000 inset;
|
254 |
-
}
|
255 |
-
.su-video .jp-seek-bar,
|
256 |
-
.su-video .jp-play-bar {
|
257 |
-
position: absolute;
|
258 |
-
top: 0;
|
259 |
-
left: 0;
|
260 |
-
height: 100%;
|
261 |
-
cursor: pointer;
|
262 |
-
border-radius: 3px;
|
263 |
-
-moz-border-radius: 3px;
|
264 |
-
-webkit-border-radius: 3px;
|
265 |
-
}
|
266 |
-
.su-video .jp-seek-bar {
|
267 |
-
background: #0b0b0b; /* Old browsers */
|
268 |
-
background: -moz-linear-gradient(top, #0b0b0b 0%, #666 100%); /* FF3.6+ */
|
269 |
-
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #0b0b0b), color-stop(100%, #666)); /* Chrome,Safari4+ */
|
270 |
-
background: -webkit-linear-gradient(top, #0b0b0b 0%, #666 100%); /* Chrome10+,Safari5.1+ */
|
271 |
-
background: -o-linear-gradient(top, #0b0b0b 0%, #666 100%); /* Opera 11.10+ */
|
272 |
-
background: -ms-linear-gradient(top, #0b0b0b 0%, #666 100%); /* IE10+ */
|
273 |
-
background: linear-gradient(to bottom, #0b0b0b 0%, #666 100%); /* W3C */
|
274 |
-
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0b0b0b', endColorstr='#666666', GradientType=0); /* IE6-9 */
|
275 |
-
}
|
276 |
-
.su-video .jp-play-bar {
|
277 |
-
background: #6db3f2; /* Old browsers */
|
278 |
-
background: -moz-linear-gradient(top, #6db3f2 0%, #54a3ee 50%, #3690f0 51%, #1e69de 100%); /* FF3.6+ */
|
279 |
-
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #6db3f2), color-stop(50%, #54a3ee), color-stop(51%, #3690f0), color-stop(100%, #1e69de)); /* Chrome,Safari4+ */
|
280 |
-
background: -webkit-linear-gradient(top, #6db3f2 0%, #54a3ee 50%, #3690f0 51%, #1e69de 100%); /* Chrome10+,Safari5.1+ */
|
281 |
-
background: -o-linear-gradient(top, #6db3f2 0%, #54a3ee 50%, #3690f0 51%, #1e69de 100%); /* Opera 11.10+ */
|
282 |
-
background: -ms-linear-gradient(top, #6db3f2 0%, #54a3ee 50%, #3690f0 51%, #1e69de 100%); /* IE10+ */
|
283 |
-
background: linear-gradient(to bottom, #6db3f2 0%, #54a3ee 50%, #3690f0 51%, #1e69de 100%); /* W3C */
|
284 |
-
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#6db3f2', endColorstr='#1e69de', GradientType=0); /* IE6-9 */
|
285 |
-
}
|
286 |
-
.su-video .jp-current-time,
|
287 |
-
.su-video .jp-duration {
|
288 |
-
position: absolute;
|
289 |
-
top: 0;
|
290 |
-
display: block;
|
291 |
-
height: 30px;
|
292 |
-
line-height: 30px;
|
293 |
-
color: #f5f5f5;
|
294 |
-
font-size: 10px;
|
295 |
-
}
|
296 |
-
.su-video .jp-current-time { left: 50px }
|
297 |
.su-video .jp-duration { right: 50px }
|
1 |
+
/*** Shortcodes Ultimate - players elements ***/
|
2 |
+
|
3 |
+
/* Audio
|
4 |
+
---------------------------------------------------------------*/
|
5 |
+
|
6 |
+
.su-audio { }
|
7 |
+
.su-audio {
|
8 |
+
position: relative;
|
9 |
+
width: 100%;
|
10 |
+
height: 30px;
|
11 |
+
margin-bottom: 1.5em;
|
12 |
+
background: #7c8781; /* Old browsers */
|
13 |
+
background: -moz-linear-gradient(top, #7c8781 0%, #0a0809 100%); /* FF3.6+ */
|
14 |
+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #7c8781), color-stop(100%, #0a0809)); /* Chrome,Safari4+ */
|
15 |
+
background: -webkit-linear-gradient(top, #7c8781 0%, #0a0809 100%); /* Chrome10+,Safari5.1+ */
|
16 |
+
background: -o-linear-gradient(top, #7c8781 0%, #0a0809 100%); /* Opera 11.10+ */
|
17 |
+
background: -ms-linear-gradient(top, #7c8781 0%, #0a0809 100%); /* IE10+ */
|
18 |
+
background: linear-gradient(to bottom, #7c8781 0%, #0a0809 100%); /* W3C */
|
19 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#7c8781', endColorstr='#0a0809', GradientType=0); /* IE6-9 */
|
20 |
+
border-radius: 3px;
|
21 |
+
-moz-border-radius: 3px;
|
22 |
+
-webkit-border-radius: 3px;
|
23 |
+
}
|
24 |
+
.su-audio .jp-play,
|
25 |
+
.su-audio .jp-pause {
|
26 |
+
position: absolute;
|
27 |
+
left: 0;
|
28 |
+
top: 0;
|
29 |
+
display: block;
|
30 |
+
width: 30px;
|
31 |
+
height: 30px;
|
32 |
+
-webkit-border-top-left-radius: 3px;
|
33 |
+
-webkit-border-bottom-left-radius: 3px;
|
34 |
+
-moz-border-radius-topleft: 3px;
|
35 |
+
-moz-border-radius-bottomleft: 3px;
|
36 |
+
border-top-left-radius: 3px;
|
37 |
+
border-bottom-left-radius: 3px;
|
38 |
+
cursor: pointer;
|
39 |
+
border-right: 1px solid #454947;
|
40 |
+
background-image: url('../images/player/default.png');
|
41 |
+
background-repeat: no-repeat;
|
42 |
+
}
|
43 |
+
.su-audio .jp-play { background-position: 0 0 }
|
44 |
+
.su-audio .jp-pause { background-position: -30px 0 }
|
45 |
+
.su-audio .jp-current-time,
|
46 |
+
.su-audio .jp-duration {
|
47 |
+
position: absolute;
|
48 |
+
top: 0;
|
49 |
+
display: block;
|
50 |
+
height: 30px;
|
51 |
+
line-height: 30px;
|
52 |
+
font-size: 10px;
|
53 |
+
color: #eee;
|
54 |
+
text-shadow: 0 -1px 0 #000;
|
55 |
+
-moz-text-shadow: 0 -1px 0 #000;
|
56 |
+
-webkit-text-shadow: 0 -1px 0 #000;
|
57 |
+
}
|
58 |
+
.su-audio .jp-current-time { left: 45px }
|
59 |
+
.su-audio .jp-duration { right: 10px }
|
60 |
+
.su-audio .jp-seek-bar,
|
61 |
+
.su-audio .jp-play-bar {
|
62 |
+
position: absolute;
|
63 |
+
top: 0;
|
64 |
+
left: 0;
|
65 |
+
height: 10px;
|
66 |
+
border-radius: 3px;
|
67 |
+
-moz-border-radius: 3px;
|
68 |
+
-webkit-border-radius: 3px;
|
69 |
+
cursor: pointer;
|
70 |
+
}
|
71 |
+
.su-audio .jp-progress {
|
72 |
+
position: absolute;
|
73 |
+
top: 10px;
|
74 |
+
left: 85px;
|
75 |
+
right: 50px;
|
76 |
+
height: 10px;
|
77 |
+
background: #333;
|
78 |
+
box-shadow: 0 0 5px #000 inset;
|
79 |
+
-moz-box-shadow: 0 0 5px #000 inset;
|
80 |
+
-webkit-box-shadow: 0 0 5px #000 inset;
|
81 |
+
border-radius: 3px;
|
82 |
+
-moz-border-radius: 3px;
|
83 |
+
-webkit-border-radius: 3px;
|
84 |
+
}
|
85 |
+
.su-audio .jp-seek-bar {
|
86 |
+
background: #0b0b0b; /* Old browsers */
|
87 |
+
background: -moz-linear-gradient(top, #0b0b0b 0%, #666 100%); /* FF3.6+ */
|
88 |
+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #0b0b0b), color-stop(100%, #666)); /* Chrome,Safari4+ */
|
89 |
+
background: -webkit-linear-gradient(top, #0b0b0b 0%, #666 100%); /* Chrome10+,Safari5.1+ */
|
90 |
+
background: -o-linear-gradient(top, #0b0b0b 0%, #666 100%); /* Opera 11.10+ */
|
91 |
+
background: -ms-linear-gradient(top, #0b0b0b 0%, #666 100%); /* IE10+ */
|
92 |
+
background: linear-gradient(to bottom, #0b0b0b 0%, #666 100%); /* W3C */
|
93 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0b0b0b', endColorstr='#666666', GradientType=0); /* IE6-9 */
|
94 |
+
}
|
95 |
+
.su-audio .jp-play-bar {
|
96 |
+
background: #6db3f2; /* Old browsers */
|
97 |
+
background: -moz-linear-gradient(top, #6db3f2 0%, #54a3ee 50%, #3690f0 51%, #1e69de 100%); /* FF3.6+ */
|
98 |
+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #6db3f2), color-stop(50%, #54a3ee), color-stop(51%, #3690f0), color-stop(100%, #1e69de)); /* Chrome,Safari4+ */
|
99 |
+
background: -webkit-linear-gradient(top, #6db3f2 0%, #54a3ee 50%, #3690f0 51%, #1e69de 100%); /* Chrome10+,Safari5.1+ */
|
100 |
+
background: -o-linear-gradient(top, #6db3f2 0%, #54a3ee 50%, #3690f0 51%, #1e69de 100%); /* Opera 11.10+ */
|
101 |
+
background: -ms-linear-gradient(top, #6db3f2 0%, #54a3ee 50%, #3690f0 51%, #1e69de 100%); /* IE10+ */
|
102 |
+
background: linear-gradient(to bottom, #6db3f2 0%, #54a3ee 50%, #3690f0 51%, #1e69de 100%); /* W3C */
|
103 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#6db3f2', endColorstr='#1e69de', GradientType=0); /* IE6-9 */
|
104 |
+
}
|
105 |
+
|
106 |
+
/* Video
|
107 |
+
---------------------------------------------------------------*/
|
108 |
+
|
109 |
+
.su-video {
|
110 |
+
position: relative;
|
111 |
+
margin-bottom: 1.5em;
|
112 |
+
overflow: hidden;
|
113 |
+
}
|
114 |
+
.su-video .jp-title {
|
115 |
+
position: absolute;
|
116 |
+
top: -100px;
|
117 |
+
left: 0;
|
118 |
+
width: 100%;
|
119 |
+
height: 30px;
|
120 |
+
padding: 0 1em;
|
121 |
+
line-height: 30px;
|
122 |
+
font-size: 0.9em;
|
123 |
+
background: rgb(0, 0, 0);
|
124 |
+
background: rgba(0, 0, 0, 0.5);
|
125 |
+
color: #fff;
|
126 |
+
transition: top .2s;
|
127 |
+
-o-transition: top .2s;
|
128 |
+
-ie-transition: top .2s;
|
129 |
+
-moz-transition: top .2s;
|
130 |
+
-webkit-transition: top .2s;
|
131 |
+
}
|
132 |
+
.su-video:hover .jp-title { top: 0 }
|
133 |
+
.su-video .jp-start {
|
134 |
+
position: absolute;
|
135 |
+
left: 0;
|
136 |
+
top: 0;
|
137 |
+
width: 100%;
|
138 |
+
height: 100%;
|
139 |
+
cursor: pointer;
|
140 |
+
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
|
141 |
+
filter: alpha(opacity=50);
|
142 |
+
-moz-opacity: 0.5;
|
143 |
+
-khtml-opacity: 0.5;
|
144 |
+
opacity: 0.5;
|
145 |
+
transition: opacity .2s;
|
146 |
+
-moz-transition: opacity .2s;
|
147 |
+
-webkit-transition: opacity .2s;
|
148 |
+
-o-transition: opacity .2s;
|
149 |
+
}
|
150 |
+
.su-video:hover .jp-start {
|
151 |
+
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=80)";
|
152 |
+
filter: alpha(opacity=80);
|
153 |
+
-moz-opacity: 0.8;
|
154 |
+
-khtml-opacity: 0.8;
|
155 |
+
opacity: 0.8;
|
156 |
+
}
|
157 |
+
.su-video.jp-video-full {
|
158 |
+
position: fixed;
|
159 |
+
left: 0;
|
160 |
+
top: 0;
|
161 |
+
width: 100%;
|
162 |
+
height: 100%;
|
163 |
+
}
|
164 |
+
.su-video.jp-video-full .jp-jplayer {
|
165 |
+
position: fixed !important;
|
166 |
+
left: 0;
|
167 |
+
top: 0;
|
168 |
+
overflow: hidden;
|
169 |
+
}
|
170 |
+
.su-video .jp-gui { position: relative }
|
171 |
+
.su-video.jp-video-full .jp-gui {
|
172 |
+
position: fixed;
|
173 |
+
left: 0;
|
174 |
+
bottom: 0;
|
175 |
+
width: 100%;
|
176 |
+
}
|
177 |
+
.su-video-controls-no .jp-gui {
|
178 |
+
position: absolute !important;
|
179 |
+
bottom: -100px;
|
180 |
+
left: 0;
|
181 |
+
right: 0;
|
182 |
+
transition: bottom .2s;
|
183 |
+
-o-transition: bottom .2s;
|
184 |
+
-ie-transition: bottom .2s;
|
185 |
+
-moz-transition: bottom .2s;
|
186 |
+
-webkit-transition: bottom .2s;
|
187 |
+
}
|
188 |
+
.su-video-controls-no:hover .jp-gui { bottom: 0 }
|
189 |
+
.su-video img {
|
190 |
+
border-radius: 0 !important;
|
191 |
+
-moz-border-radius: 0 !important;
|
192 |
+
-webkit-border-radius: 0 !important;
|
193 |
+
border: none !important;
|
194 |
+
margin: 0 !important;
|
195 |
+
padding: 0 !important;
|
196 |
+
}
|
197 |
+
.su-video .jp-start { background: 50% 50% url('../images/player/default-start.png') no-repeat }
|
198 |
+
.su-video .jp-gui {
|
199 |
+
height: 30px;
|
200 |
+
background: #7c8781; /* Old browsers */
|
201 |
+
background: -moz-linear-gradient(top, #7c8781 0%, #0a0809 100%); /* FF3.6+ */
|
202 |
+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #7c8781), color-stop(100%, #0a0809)); /* Chrome,Safari4+ */
|
203 |
+
background: -webkit-linear-gradient(top, #7c8781 0%, #0a0809 100%); /* Chrome10+,Safari5.1+ */
|
204 |
+
background: -o-linear-gradient(top, #7c8781 0%, #0a0809 100%); /* Opera 11.10+ */
|
205 |
+
background: -ms-linear-gradient(top, #7c8781 0%, #0a0809 100%); /* IE10+ */
|
206 |
+
background: linear-gradient(to bottom, #7c8781 0%, #0a0809 100%); /* W3C */
|
207 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#7c8781', endColorstr='#0a0809', GradientType=0); /* IE6-9 */
|
208 |
+
-webkit-border-bottom-right-radius: 3px;
|
209 |
+
-webkit-border-bottom-left-radius: 3px;
|
210 |
+
-moz-border-radius-bottomright: 3px;
|
211 |
+
-moz-border-radius-bottomleft: 3px;
|
212 |
+
border-bottom-right-radius: 3px;
|
213 |
+
border-bottom-left-radius: 3px;
|
214 |
+
}
|
215 |
+
.su-video .jp-gui .jp-play,
|
216 |
+
.su-video .jp-gui .jp-pause {
|
217 |
+
position: absolute;
|
218 |
+
left: 0;
|
219 |
+
top: 0;
|
220 |
+
display: block;
|
221 |
+
width: 30px;
|
222 |
+
height: 30px;
|
223 |
+
border-right: 1px solid #454947;
|
224 |
+
cursor: pointer;
|
225 |
+
}
|
226 |
+
.su-video .jp-gui .jp-play { background: 0 0 url('../images/player/default.png') no-repeat }
|
227 |
+
.su-video .jp-gui .jp-pause { background: -30px 0 url('../images/player/default.png') no-repeat }
|
228 |
+
.su-video .jp-full-screen,
|
229 |
+
.su-video .jp-restore-screen {
|
230 |
+
position: absolute;
|
231 |
+
top: 0;
|
232 |
+
right: 0;
|
233 |
+
display: block;
|
234 |
+
width: 30px;
|
235 |
+
height: 30px;
|
236 |
+
border-left: 1px solid #454947;
|
237 |
+
cursor: pointer;
|
238 |
+
}
|
239 |
+
.su-video .jp-full-screen { background: 0 -30px url('../images/player/default.png') no-repeat }
|
240 |
+
.su-video .jp-restore-screen { background: -30px -30px url('../images/player/default.png') no-repeat }
|
241 |
+
.su-video .jp-progress {
|
242 |
+
position: absolute;
|
243 |
+
top: 10px;
|
244 |
+
left: 90px;
|
245 |
+
right: 90px;
|
246 |
+
height: 10px;
|
247 |
+
background: #333;
|
248 |
+
border-radius: 3px;
|
249 |
+
-moz-border-radius: 3px;
|
250 |
+
-webkit-border-radius: 3px;
|
251 |
+
box-shadow: 0 0 5px #000 inset;
|
252 |
+
-moz-box-shadow: 0 0 5px #000 inset;
|
253 |
+
-webkit-box-shadow: 0 0 5px #000 inset;
|
254 |
+
}
|
255 |
+
.su-video .jp-seek-bar,
|
256 |
+
.su-video .jp-play-bar {
|
257 |
+
position: absolute;
|
258 |
+
top: 0;
|
259 |
+
left: 0;
|
260 |
+
height: 100%;
|
261 |
+
cursor: pointer;
|
262 |
+
border-radius: 3px;
|
263 |
+
-moz-border-radius: 3px;
|
264 |
+
-webkit-border-radius: 3px;
|
265 |
+
}
|
266 |
+
.su-video .jp-seek-bar {
|
267 |
+
background: #0b0b0b; /* Old browsers */
|
268 |
+
background: -moz-linear-gradient(top, #0b0b0b 0%, #666 100%); /* FF3.6+ */
|
269 |
+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #0b0b0b), color-stop(100%, #666)); /* Chrome,Safari4+ */
|
270 |
+
background: -webkit-linear-gradient(top, #0b0b0b 0%, #666 100%); /* Chrome10+,Safari5.1+ */
|
271 |
+
background: -o-linear-gradient(top, #0b0b0b 0%, #666 100%); /* Opera 11.10+ */
|
272 |
+
background: -ms-linear-gradient(top, #0b0b0b 0%, #666 100%); /* IE10+ */
|
273 |
+
background: linear-gradient(to bottom, #0b0b0b 0%, #666 100%); /* W3C */
|
274 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0b0b0b', endColorstr='#666666', GradientType=0); /* IE6-9 */
|
275 |
+
}
|
276 |
+
.su-video .jp-play-bar {
|
277 |
+
background: #6db3f2; /* Old browsers */
|
278 |
+
background: -moz-linear-gradient(top, #6db3f2 0%, #54a3ee 50%, #3690f0 51%, #1e69de 100%); /* FF3.6+ */
|
279 |
+
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #6db3f2), color-stop(50%, #54a3ee), color-stop(51%, #3690f0), color-stop(100%, #1e69de)); /* Chrome,Safari4+ */
|
280 |
+
background: -webkit-linear-gradient(top, #6db3f2 0%, #54a3ee 50%, #3690f0 51%, #1e69de 100%); /* Chrome10+,Safari5.1+ */
|
281 |
+
background: -o-linear-gradient(top, #6db3f2 0%, #54a3ee 50%, #3690f0 51%, #1e69de 100%); /* Opera 11.10+ */
|
282 |
+
background: -ms-linear-gradient(top, #6db3f2 0%, #54a3ee 50%, #3690f0 51%, #1e69de 100%); /* IE10+ */
|
283 |
+
background: linear-gradient(to bottom, #6db3f2 0%, #54a3ee 50%, #3690f0 51%, #1e69de 100%); /* W3C */
|
284 |
+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#6db3f2', endColorstr='#1e69de', GradientType=0); /* IE6-9 */
|
285 |
+
}
|
286 |
+
.su-video .jp-current-time,
|
287 |
+
.su-video .jp-duration {
|
288 |
+
position: absolute;
|
289 |
+
top: 0;
|
290 |
+
display: block;
|
291 |
+
height: 30px;
|
292 |
+
line-height: 30px;
|
293 |
+
color: #f5f5f5;
|
294 |
+
font-size: 10px;
|
295 |
+
}
|
296 |
+
.su-video .jp-current-time { left: 50px }
|
297 |
.su-video .jp-duration { right: 50px }
|
assets/css/sunrise.css
CHANGED
@@ -1,154 +1,154 @@
|
|
1 |
-
/***********************************
|
2 |
-
Common styles
|
3 |
-
***********************************/
|
4 |
-
|
5 |
-
.sunrise-plugin-onehalf {
|
6 |
-
float: left;
|
7 |
-
width: 46%;
|
8 |
-
margin: 0 4% 1em 0;
|
9 |
-
}
|
10 |
-
.sunrise-plugin-onethird {
|
11 |
-
float: left;
|
12 |
-
width: 31%;
|
13 |
-
margin: 0 2% 1em 0;
|
14 |
-
}
|
15 |
-
.sunrise-plugin-clear {
|
16 |
-
display: block;
|
17 |
-
height: 0;
|
18 |
-
overflow: hidden;
|
19 |
-
clear: both;
|
20 |
-
}
|
21 |
-
.sunrise-plugin-hidden { display: none }
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
/***********************************
|
26 |
-
Nav tabs
|
27 |
-
***********************************/
|
28 |
-
|
29 |
-
#sunrise-plugin-tabs {}
|
30 |
-
#sunrise-plugin-tabs span { cursor: pointer }
|
31 |
-
#sunrise-plugin-tabs .nav-tab-active,
|
32 |
-
#sunrise-plugin-tabs span:hover { color: #464646 }
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
/***********************************
|
37 |
-
Panes
|
38 |
-
***********************************/
|
39 |
-
|
40 |
-
.sunrise-plugin-pane {
|
41 |
-
margin: 20px 0;
|
42 |
-
padding-bottom: 20px;
|
43 |
-
border-bottom: 3px solid #f0f0f0;
|
44 |
-
}
|
45 |
-
.js .sunrise-plugin-pane {
|
46 |
-
padding-bottom: 0;
|
47 |
-
border: none;
|
48 |
-
}
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
/***********************************
|
53 |
-
Fields
|
54 |
-
***********************************/
|
55 |
-
|
56 |
-
#sunrise-plugin-settings .form-table td,
|
57 |
-
#sunrise-plugin-settings .form-table th { padding-bottom: 20px }
|
58 |
-
|
59 |
-
#sunrise-plugin-settings .description {
|
60 |
-
display: block;
|
61 |
-
margin-top: 5px;
|
62 |
-
}
|
63 |
-
|
64 |
-
.sunrise-plugin-textarea {
|
65 |
-
width: 80%;
|
66 |
-
min-width: 25em;
|
67 |
-
max-width: 50em;
|
68 |
-
}
|
69 |
-
|
70 |
-
.sunrise-plugin-code {
|
71 |
-
width: 80%;
|
72 |
-
min-width: 25em;
|
73 |
-
max-width: 50em;
|
74 |
-
padding: 4px;
|
75 |
-
font-size: 13px;
|
76 |
-
font-family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important;
|
77 |
-
line-height: 21px !important;
|
78 |
-
background: scroll url('../images/code.png');
|
79 |
-
}
|
80 |
-
|
81 |
-
.sunrise-plugin-select {
|
82 |
-
width: 40%;
|
83 |
-
min-width: 25em;
|
84 |
-
max-width: 50em;
|
85 |
-
}
|
86 |
-
|
87 |
-
.sunrise-plugin-checkbox-group label {
|
88 |
-
display: inline-block;
|
89 |
-
margin: 0 0 5px 0;
|
90 |
-
}
|
91 |
-
|
92 |
-
|
93 |
-
/***********************************
|
94 |
-
Color picker
|
95 |
-
***********************************/
|
96 |
-
|
97 |
-
.sunrise-plugin-color-picker {
|
98 |
-
position: relative;
|
99 |
-
width: 300px;
|
100 |
-
}
|
101 |
-
.sunrise-plugin-color-picker-preview {
|
102 |
-
position: absolute;
|
103 |
-
right: 0;
|
104 |
-
top: 0;
|
105 |
-
display: none;
|
106 |
-
background: #fff;
|
107 |
-
border: 1px solid #eee;
|
108 |
-
z-index: 4;
|
109 |
-
}
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
/***********************************
|
114 |
-
Notifications
|
115 |
-
***********************************/
|
116 |
-
|
117 |
-
#sunrise-plugin-settings .sunrise-plugin-notification {
|
118 |
-
position: relative;
|
119 |
-
margin: 20px 0;
|
120 |
-
}
|
121 |
-
#sunrise-plugin-settings .sunrise-plugin-notification small {
|
122 |
-
float: right;
|
123 |
-
display: none;
|
124 |
-
color: #555;
|
125 |
-
}
|
126 |
-
.js #sunrise-plugin-settings .sunrise-plugin-notification:hover small { display: inline }
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
/***********************************
|
131 |
-
Actions bar
|
132 |
-
***********************************/
|
133 |
-
|
134 |
-
.sunrise-plugin-actions-bar {
|
135 |
-
margin-top: 20px;
|
136 |
-
padding: 10px;
|
137 |
-
background: #f5f5f5;
|
138 |
-
border-top: 1px solid #eee;
|
139 |
-
-webkit-border-bottom-right-radius: 5px;
|
140 |
-
-webkit-border-bottom-left-radius: 5px;
|
141 |
-
-moz-border-radius-bottomright: 5px;
|
142 |
-
-moz-border-radius-bottomleft: 5px;
|
143 |
-
border-bottom-right-radius: 5px;
|
144 |
-
border-bottom-left-radius: 5px;
|
145 |
-
}
|
146 |
-
|
147 |
-
.sunrise-plugin-spin,
|
148 |
-
.sunrise-plugin-success-tip {
|
149 |
-
display: none;
|
150 |
-
margin-left: 10px;
|
151 |
-
}
|
152 |
-
.sunrise-plugin-success-tip { color: #0b0 }
|
153 |
-
.sunrise-plugin-spin img,
|
154 |
.sunrise-plugin-success-tip img { margin: 0 5px -3px 0 }
|
1 |
+
/***********************************
|
2 |
+
Common styles
|
3 |
+
***********************************/
|
4 |
+
|
5 |
+
.sunrise-plugin-onehalf {
|
6 |
+
float: left;
|
7 |
+
width: 46%;
|
8 |
+
margin: 0 4% 1em 0;
|
9 |
+
}
|
10 |
+
.sunrise-plugin-onethird {
|
11 |
+
float: left;
|
12 |
+
width: 31%;
|
13 |
+
margin: 0 2% 1em 0;
|
14 |
+
}
|
15 |
+
.sunrise-plugin-clear {
|
16 |
+
display: block;
|
17 |
+
height: 0;
|
18 |
+
overflow: hidden;
|
19 |
+
clear: both;
|
20 |
+
}
|
21 |
+
.sunrise-plugin-hidden { display: none }
|
22 |
+
|
23 |
+
|
24 |
+
|
25 |
+
/***********************************
|
26 |
+
Nav tabs
|
27 |
+
***********************************/
|
28 |
+
|
29 |
+
#sunrise-plugin-tabs {}
|
30 |
+
#sunrise-plugin-tabs span { cursor: pointer }
|
31 |
+
#sunrise-plugin-tabs .nav-tab-active,
|
32 |
+
#sunrise-plugin-tabs span:hover { color: #464646 }
|
33 |
+
|
34 |
+
|
35 |
+
|
36 |
+
/***********************************
|
37 |
+
Panes
|
38 |
+
***********************************/
|
39 |
+
|
40 |
+
.sunrise-plugin-pane {
|
41 |
+
margin: 20px 0;
|
42 |
+
padding-bottom: 20px;
|
43 |
+
border-bottom: 3px solid #f0f0f0;
|
44 |
+
}
|
45 |
+
.js .sunrise-plugin-pane {
|
46 |
+
padding-bottom: 0;
|
47 |
+
border: none;
|
48 |
+
}
|
49 |
+
|
50 |
+
|
51 |
+
|
52 |
+
/***********************************
|
53 |
+
Fields
|
54 |
+
***********************************/
|
55 |
+
|
56 |
+
#sunrise-plugin-settings .form-table td,
|
57 |
+
#sunrise-plugin-settings .form-table th { padding-bottom: 20px }
|
58 |
+
|
59 |
+
#sunrise-plugin-settings .description {
|
60 |
+
display: block;
|
61 |
+
margin-top: 5px;
|
62 |
+
}
|
63 |
+
|
64 |
+
.sunrise-plugin-textarea {
|
65 |
+
width: 80%;
|
66 |
+
min-width: 25em;
|
67 |
+
max-width: 50em;
|
68 |
+
}
|
69 |
+
|
70 |
+
.sunrise-plugin-code {
|
71 |
+
width: 80%;
|
72 |
+
min-width: 25em;
|
73 |
+
max-width: 50em;
|
74 |
+
padding: 4px;
|
75 |
+
font-size: 13px;
|
76 |
+
font-family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important;
|
77 |
+
line-height: 21px !important;
|
78 |
+
background: scroll url('../images/code.png');
|
79 |
+
}
|
80 |
+
|
81 |
+
.sunrise-plugin-select {
|
82 |
+
width: 40%;
|
83 |
+
min-width: 25em;
|
84 |
+
max-width: 50em;
|
85 |
+
}
|
86 |
+
|
87 |
+
.sunrise-plugin-checkbox-group label {
|
88 |
+
display: inline-block;
|
89 |
+
margin: 0 0 5px 0;
|
90 |
+
}
|
91 |
+
|
92 |
+
|
93 |
+
/***********************************
|
94 |
+
Color picker
|
95 |
+
***********************************/
|
96 |
+
|
97 |
+
.sunrise-plugin-color-picker {
|
98 |
+
position: relative;
|
99 |
+
width: 300px;
|
100 |
+
}
|
101 |
+
.sunrise-plugin-color-picker-preview {
|
102 |
+
position: absolute;
|
103 |
+
right: 0;
|
104 |
+
top: 0;
|
105 |
+
display: none;
|
106 |
+
background: #fff;
|
107 |
+
border: 1px solid #eee;
|
108 |
+
z-index: 4;
|
109 |
+
}
|
110 |
+
|
111 |
+
|
112 |
+
|
113 |
+
/***********************************
|
114 |
+
Notifications
|
115 |
+
***********************************/
|
116 |
+
|
117 |
+
#sunrise-plugin-settings .sunrise-plugin-notification {
|
118 |
+
position: relative;
|
119 |
+
margin: 20px 0;
|
120 |
+
}
|
121 |
+
#sunrise-plugin-settings .sunrise-plugin-notification small {
|
122 |
+
float: right;
|
123 |
+
display: none;
|
124 |
+
color: #555;
|
125 |
+
}
|
126 |
+
.js #sunrise-plugin-settings .sunrise-plugin-notification:hover small { display: inline }
|
127 |
+
|
128 |
+
|
129 |
+
|
130 |
+
/***********************************
|
131 |
+
Actions bar
|
132 |
+
***********************************/
|
133 |
+
|
134 |
+
.sunrise-plugin-actions-bar {
|
135 |
+
margin-top: 20px;
|
136 |
+
padding: 10px;
|
137 |
+
background: #f5f5f5;
|
138 |
+
border-top: 1px solid #eee;
|
139 |
+
-webkit-border-bottom-right-radius: 5px;
|
140 |
+
-webkit-border-bottom-left-radius: 5px;
|
141 |
+
-moz-border-radius-bottomright: 5px;
|
142 |
+
-moz-border-radius-bottomleft: 5px;
|
143 |
+
border-bottom-right-radius: 5px;
|
144 |
+
border-bottom-left-radius: 5px;
|
145 |
+
}
|
146 |
+
|
147 |
+
.sunrise-plugin-spin,
|
148 |
+
.sunrise-plugin-success-tip {
|
149 |
+
display: none;
|
150 |
+
margin-left: 10px;
|
151 |
+
}
|
152 |
+
.sunrise-plugin-success-tip { color: #0b0 }
|
153 |
+
.sunrise-plugin-spin img,
|
154 |
.sunrise-plugin-success-tip img { margin: 0 5px -3px 0 }
|
assets/css/vote.css
CHANGED
@@ -1,49 +1,49 @@
|
|
1 |
-
.su-vote {
|
2 |
-
overflow: auto;
|
3 |
-
background: #2685B0;
|
4 |
-
color: #111;
|
5 |
-
}
|
6 |
-
.su-vote-wrap {
|
7 |
-
margin: 1em;
|
8 |
-
background: #eee;
|
9 |
-
-webkit-border-radius: 5px;
|
10 |
-
-moz-border-radius: 5px;
|
11 |
-
border-radius: 5px;
|
12 |
-
-webkit-box-shadow: 0 0 10px #173859;
|
13 |
-
-moz-box-shadow: 0 0 10px #173859;
|
14 |
-
box-shadow: 0 0 10px #173859;
|
15 |
-
|
16 |
-
}
|
17 |
-
.su-vote-clear {
|
18 |
-
height: 0;
|
19 |
-
clear: both;
|
20 |
-
}
|
21 |
-
.su-vote-gravatar {
|
22 |
-
float: left;
|
23 |
-
width: 70px;
|
24 |
-
}
|
25 |
-
.su-vote-gravatar img {
|
26 |
-
margin: 10px;
|
27 |
-
-webkit-border-radius: 50%;
|
28 |
-
-moz-border-radius: 50%;
|
29 |
-
border-radius: 50%;
|
30 |
-
}
|
31 |
-
.su-vote-message {
|
32 |
-
overflow: auto;
|
33 |
-
margin-left: 70px;
|
34 |
-
padding: 0 2em;
|
35 |
-
background: #fff;
|
36 |
-
border-left: 1px solid #ddd;
|
37 |
-
-webkit-border-top-right-radius: 5px;
|
38 |
-
-webkit-border-bottom-right-radius: 5px;
|
39 |
-
-moz-border-radius-topright: 5px;
|
40 |
-
-moz-border-radius-bottomright: 5px;
|
41 |
-
border-top-right-radius: 5px;
|
42 |
-
border-bottom-right-radius: 5px;
|
43 |
-
}
|
44 |
-
.su-vote-message p {
|
45 |
-
margin: 1.5em 0;
|
46 |
-
line-height: 1.5;
|
47 |
-
}
|
48 |
-
.su-vote-message a.button,
|
49 |
.su-vote-message span { margin-right: 0.5em; }
|
1 |
+
.su-vote {
|
2 |
+
overflow: auto;
|
3 |
+
background: #2685B0;
|
4 |
+
color: #111;
|
5 |
+
}
|
6 |
+
.su-vote-wrap {
|
7 |
+
margin: 1em;
|
8 |
+
background: #eee;
|
9 |
+
-webkit-border-radius: 5px;
|
10 |
+
-moz-border-radius: 5px;
|
11 |
+
border-radius: 5px;
|
12 |
+
-webkit-box-shadow: 0 0 10px #173859;
|
13 |
+
-moz-box-shadow: 0 0 10px #173859;
|
14 |
+
box-shadow: 0 0 10px #173859;
|
15 |
+
|
16 |
+
}
|
17 |
+
.su-vote-clear {
|
18 |
+
height: 0;
|
19 |
+
clear: both;
|
20 |
+
}
|
21 |
+
.su-vote-gravatar {
|
22 |
+
float: left;
|
23 |
+
width: 70px;
|
24 |
+
}
|
25 |
+
.su-vote-gravatar img {
|
26 |
+
margin: 10px;
|
27 |
+
-webkit-border-radius: 50%;
|
28 |
+
-moz-border-radius: 50%;
|
29 |
+
border-radius: 50%;
|
30 |
+
}
|
31 |
+
.su-vote-message {
|
32 |
+
overflow: auto;
|
33 |
+
margin-left: 70px;
|
34 |
+
padding: 0 2em;
|
35 |
+
background: #fff;
|
36 |
+
border-left: 1px solid #ddd;
|
37 |
+
-webkit-border-top-right-radius: 5px;
|
38 |
+
-webkit-border-bottom-right-radius: 5px;
|
39 |
+
-moz-border-radius-topright: 5px;
|
40 |
+
-moz-border-radius-bottomright: 5px;
|
41 |
+
border-top-right-radius: 5px;
|
42 |
+
border-bottom-right-radius: 5px;
|
43 |
+
}
|
44 |
+
.su-vote-message p {
|
45 |
+
margin: 1.5em 0;
|
46 |
+
line-height: 1.5;
|
47 |
+
}
|
48 |
+
.su-vote-message a.button,
|
49 |
.su-vote-message span { margin-right: 0.5em; }
|
assets/js/file-upload.js
CHANGED
@@ -1,1315 +1,1315 @@
|
|
1 |
-
/*
|
2 |
-
* jQuery File Upload Plugin 5.31.6
|
3 |
-
* https://github.com/blueimp/jQuery-File-Upload
|
4 |
-
*
|
5 |
-
* Copyright 2010, Sebastian Tschan
|
6 |
-
* https://blueimp.net
|
7 |
-
*
|
8 |
-
* Licensed under the MIT license:
|
9 |
-
* http://www.opensource.org/licenses/MIT
|
10 |
-
*/
|
11 |
-
|
12 |
-
/*jslint nomen: true, unparam: true, regexp: true */
|
13 |
-
/*global define, window, document, location, File, Blob, FormData */
|
14 |
-
|
15 |
-
(function (factory) {
|
16 |
-
'use strict';
|
17 |
-
if (typeof define === 'function' && define.amd) {
|
18 |
-
// Register as an anonymous AMD module:
|
19 |
-
define([
|
20 |
-
'jquery',
|
21 |
-
'jquery.ui.widget'
|
22 |
-
], factory);
|
23 |
-
} else {
|
24 |
-
// Browser globals:
|
25 |
-
factory(window.jQuery);
|
26 |
-
}
|
27 |
-
}(function ($) {
|
28 |
-
'use strict';
|
29 |
-
|
30 |
-
// The FileReader API is not actually used, but works as feature detection,
|
31 |
-
// as e.g. Safari supports XHR file uploads via the FormData API,
|
32 |
-
// but not non-multipart XHR file uploads:
|
33 |
-
$.support.xhrFileUpload = !!(window.XMLHttpRequestUpload && window.FileReader);
|
34 |
-
$.support.xhrFormDataFileUpload = !!window.FormData;
|
35 |
-
|
36 |
-
// Detect support for Blob slicing (required for chunked uploads):
|
37 |
-
$.support.blobSlice = window.Blob && (Blob.prototype.slice ||
|
38 |
-
Blob.prototype.webkitSlice || Blob.prototype.mozSlice);
|
39 |
-
|
40 |
-
// The fileupload widget listens for change events on file input fields defined
|
41 |
-
// via fileInput setting and paste or drop events of the given dropZone.
|
42 |
-
// In addition to the default jQuery Widget methods, the fileupload widget
|
43 |
-
// exposes the "add" and "send" methods, to add or directly send files using
|
44 |
-
// the fileupload API.
|
45 |
-
// By default, files added via file input selection, paste, drag & drop or
|
46 |
-
// "add" method are uploaded immediately, but it is possible to override
|
47 |
-
// the "add" callback option to queue file uploads.
|
48 |
-
$.widget('blueimp.fileupload', {
|
49 |
-
|
50 |
-
options: {
|
51 |
-
// The drop target element(s), by the default the complete document.
|
52 |
-
// Set to null to disable drag & drop support:
|
53 |
-
dropZone: $(document),
|
54 |
-
// The paste target element(s), by the default the complete document.
|
55 |
-
// Set to null to disable paste support:
|
56 |
-
pasteZone: $(document),
|
57 |
-
// The file input field(s), that are listened to for change events.
|
58 |
-
// If undefined, it is set to the file input fields inside
|
59 |
-
// of the widget element on plugin initialization.
|
60 |
-
// Set to null to disable the change listener.
|
61 |
-
fileInput: undefined,
|
62 |
-
// By default, the file input field is replaced with a clone after
|
63 |
-
// each input field change event. This is required for iframe transport
|
64 |
-
// queues and allows change events to be fired for the same file
|
65 |
-
// selection, but can be disabled by setting the following option to false:
|
66 |
-
replaceFileInput: true,
|
67 |
-
// The parameter name for the file form data (the request argument name).
|
68 |
-
// If undefined or empty, the name property of the file input field is
|
69 |
-
// used, or "files[]" if the file input name property is also empty,
|
70 |
-
// can be a string or an array of strings:
|
71 |
-
paramName: undefined,
|
72 |
-
// By default, each file of a selection is uploaded using an individual
|
73 |
-
// request for XHR type uploads. Set to false to upload file
|
74 |
-
// selections in one request each:
|
75 |
-
singleFileUploads: true,
|
76 |
-
// To limit the number of files uploaded with one XHR request,
|
77 |
-
// set the following option to an integer greater than 0:
|
78 |
-
limitMultiFileUploads: undefined,
|
79 |
-
// Set the following option to true to issue all file upload requests
|
80 |
-
// in a sequential order:
|
81 |
-
sequentialUploads: false,
|
82 |
-
// To limit the number of concurrent uploads,
|
83 |
-
// set the following option to an integer greater than 0:
|
84 |
-
limitConcurrentUploads: undefined,
|
85 |
-
// Set the following option to true to force iframe transport uploads:
|
86 |
-
forceIframeTransport: false,
|
87 |
-
// Set the following option to the location of a redirect url on the
|
88 |
-
// origin server, for cross-domain iframe transport uploads:
|
89 |
-
redirect: undefined,
|
90 |
-
// The parameter name for the redirect url, sent as part of the form
|
91 |
-
// data and set to 'redirect' if this option is empty:
|
92 |
-
redirectParamName: undefined,
|
93 |
-
// Set the following option to the location of a postMessage window,
|
94 |
-
// to enable postMessage transport uploads:
|
95 |
-
postMessage: undefined,
|
96 |
-
// By default, XHR file uploads are sent as multipart/form-data.
|
97 |
-
// The iframe transport is always using multipart/form-data.
|
98 |
-
// Set to false to enable non-multipart XHR uploads:
|
99 |
-
multipart: true,
|
100 |
-
// To upload large files in smaller chunks, set the following option
|
101 |
-
// to a preferred maximum chunk size. If set to 0, null or undefined,
|
102 |
-
// or the browser does not support the required Blob API, files will
|
103 |
-
// be uploaded as a whole.
|
104 |
-
maxChunkSize: undefined,
|
105 |
-
// When a non-multipart upload or a chunked multipart upload has been
|
106 |
-
// aborted, this option can be used to resume the upload by setting
|
107 |
-
// it to the size of the already uploaded bytes. This option is most
|
108 |
-
// useful when modifying the options object inside of the "add" or
|
109 |
-
// "send" callbacks, as the options are cloned for each file upload.
|
110 |
-
uploadedBytes: undefined,
|
111 |
-
// By default, failed (abort or error) file uploads are removed from the
|
112 |
-
// global progress calculation. Set the following option to false to
|
113 |
-
// prevent recalculating the global progress data:
|
114 |
-
recalculateProgress: true,
|
115 |
-
// Interval in milliseconds to calculate and trigger progress events:
|
116 |
-
progressInterval: 100,
|
117 |
-
// Interval in milliseconds to calculate progress bitrate:
|
118 |
-
bitrateInterval: 500,
|
119 |
-
// By default, uploads are started automatically when adding files:
|
120 |
-
autoUpload: true,
|
121 |
-
|
122 |
-
// Error and info messages:
|
123 |
-
messages: {
|
124 |
-
uploadedBytes: 'Uploaded bytes exceed file size'
|
125 |
-
},
|
126 |
-
|
127 |
-
// Translation function, gets the message key to be translated
|
128 |
-
// and an object with context specific data as arguments:
|
129 |
-
i18n: function (message, context) {
|
130 |
-
message = this.messages[message] || message.toString();
|
131 |
-
if (context) {
|
132 |
-
$.each(context, function (key, value) {
|
133 |
-
message = message.replace('{' + key + '}', value);
|
134 |
-
});
|
135 |
-
}
|
136 |
-
return message;
|
137 |
-
},
|
138 |
-
|
139 |
-
// Additional form data to be sent along with the file uploads can be set
|
140 |
-
// using this option, which accepts an array of objects with name and
|
141 |
-
// value properties, a function returning such an array, a FormData
|
142 |
-
// object (for XHR file uploads), or a simple object.
|
143 |
-
// The form of the first fileInput is given as parameter to the function:
|
144 |
-
formData: function (form) {
|
145 |
-
return form.serializeArray();
|
146 |
-
},
|
147 |
-
|
148 |
-
// The add callback is invoked as soon as files are added to the fileupload
|
149 |
-
// widget (via file input selection, drag & drop, paste or add API call).
|
150 |
-
// If the singleFileUploads option is enabled, this callback will be
|
151 |
-
// called once for each file in the selection for XHR file uploads, else
|
152 |
-
// once for each file selection.
|
153 |
-
//
|
154 |
-
// The upload starts when the submit method is invoked on the data parameter.
|
155 |
-
// The data object contains a files property holding the added files
|
156 |
-
// and allows you to override plugin options as well as define ajax settings.
|
157 |
-
//
|
158 |
-
// Listeners for this callback can also be bound the following way:
|
159 |
-
// .bind('fileuploadadd', func);
|
160 |
-
//
|
161 |
-
// data.submit() returns a Promise object and allows to attach additional
|
162 |
-
// handlers using jQuery's Deferred callbacks:
|
163 |
-
// data.submit().done(func).fail(func).always(func);
|
164 |
-
add: function (e, data) {
|
165 |
-
if (data.autoUpload || (data.autoUpload !== false &&
|
166 |
-
$(this).fileupload('option', 'autoUpload'))) {
|
167 |
-
data.process().done(function () {
|
168 |
-
data.submit();
|
169 |
-
});
|
170 |
-
}
|
171 |
-
},
|
172 |
-
|
173 |
-
// Other callbacks:
|
174 |
-
|
175 |
-
// Callback for the submit event of each file upload:
|
176 |
-
// submit: function (e, data) {}, // .bind('fileuploadsubmit', func);
|
177 |
-
|
178 |
-
// Callback for the start of each file upload request:
|
179 |
-
// send: function (e, data) {}, // .bind('fileuploadsend', func);
|
180 |
-
|
181 |
-
// Callback for successful uploads:
|
182 |
-
// done: function (e, data) {}, // .bind('fileuploaddone', func);
|
183 |
-
|
184 |
-
// Callback for failed (abort or error) uploads:
|
185 |
-
// fail: function (e, data) {}, // .bind('fileuploadfail', func);
|
186 |
-
|
187 |
-
// Callback for completed (success, abort or error) requests:
|
188 |
-
// always: function (e, data) {}, // .bind('fileuploadalways', func);
|
189 |
-
|
190 |
-
// Callback for upload progress events:
|
191 |
-
// progress: function (e, data) {}, // .bind('fileuploadprogress', func);
|
192 |
-
|
193 |
-
// Callback for global upload progress events:
|
194 |
-
// progressall: function (e, data) {}, // .bind('fileuploadprogressall', func);
|
195 |
-
|
196 |
-
// Callback for uploads start, equivalent to the global ajaxStart event:
|
197 |
-
// start: function (e) {}, // .bind('fileuploadstart', func);
|
198 |
-
|
199 |
-
// Callback for uploads stop, equivalent to the global ajaxStop event:
|
200 |
-
// stop: function (e) {}, // .bind('fileuploadstop', func);
|
201 |
-
|
202 |
-
// Callback for change events of the fileInput(s):
|
203 |
-
// change: function (e, data) {}, // .bind('fileuploadchange', func);
|
204 |
-
|
205 |
-
// Callback for paste events to the pasteZone(s):
|
206 |
-
// paste: function (e, data) {}, // .bind('fileuploadpaste', func);
|
207 |
-
|
208 |
-
// Callback for drop events of the dropZone(s):
|
209 |
-
// drop: function (e, data) {}, // .bind('fileuploaddrop', func);
|
210 |
-
|
211 |
-
// Callback for dragover events of the dropZone(s):
|
212 |
-
// dragover: function (e) {}, // .bind('fileuploaddragover', func);
|
213 |
-
|
214 |
-
// Callback for the start of each chunk upload request:
|
215 |
-
// chunksend: function (e, data) {}, // .bind('fileuploadchunksend', func);
|
216 |
-
|
217 |
-
// Callback for successful chunk uploads:
|
218 |
-
// chunkdone: function (e, data) {}, // .bind('fileuploadchunkdone', func);
|
219 |
-
|
220 |
-
// Callback for failed (abort or error) chunk uploads:
|
221 |
-
// chunkfail: function (e, data) {}, // .bind('fileuploadchunkfail', func);
|
222 |
-
|
223 |
-
// Callback for completed (success, abort or error) chunk upload requests:
|
224 |
-
// chunkalways: function (e, data) {}, // .bind('fileuploadchunkalways', func);
|
225 |
-
|
226 |
-
// The plugin options are used as settings object for the ajax calls.
|
227 |
-
// The following are jQuery ajax settings required for the file uploads:
|
228 |
-
processData: false,
|
229 |
-
contentType: false,
|
230 |
-
cache: false
|
231 |
-
},
|
232 |
-
|
233 |
-
// A list of options that require reinitializing event listeners and/or
|
234 |
-
// special initialization code:
|
235 |
-
_specialOptions: [
|
236 |
-
'fileInput',
|
237 |
-
'dropZone',
|
238 |
-
'pasteZone',
|
239 |
-
'multipart',
|
240 |
-
'forceIframeTransport'
|
241 |
-
],
|
242 |
-
|
243 |
-
_blobSlice: $.support.blobSlice && function () {
|
244 |
-
var slice = this.slice || this.webkitSlice || this.mozSlice;
|
245 |
-
return slice.apply(this, arguments);
|
246 |
-
},
|
247 |
-
|
248 |
-
_BitrateTimer: function () {
|
249 |
-
this.timestamp = ((Date.now) ? Date.now() : (new Date()).getTime());
|
250 |
-
this.loaded = 0;
|
251 |
-
this.bitrate = 0;
|
252 |
-
this.getBitrate = function (now, loaded, interval) {
|
253 |
-
var timeDiff = now - this.timestamp;
|
254 |
-
if (!this.bitrate || !interval || timeDiff > interval) {
|
255 |
-
this.bitrate = (loaded - this.loaded) * (1000 / timeDiff) * 8;
|
256 |
-
this.loaded = loaded;
|
257 |
-
this.timestamp = now;
|
258 |
-
}
|
259 |
-
return this.bitrate;
|
260 |
-
};
|
261 |
-
},
|
262 |
-
|
263 |
-
_isXHRUpload: function (options) {
|
264 |
-
return !options.forceIframeTransport &&
|
265 |
-
((!options.multipart && $.support.xhrFileUpload) ||
|
266 |
-
$.support.xhrFormDataFileUpload);
|
267 |
-
},
|
268 |
-
|
269 |
-
_getFormData: function (options) {
|
270 |
-
var formData;
|
271 |
-
if (typeof options.formData === 'function') {
|
272 |
-
return options.formData(options.form);
|
273 |
-
}
|
274 |
-
if ($.isArray(options.formData)) {
|
275 |
-
return options.formData;
|
276 |
-
}
|
277 |
-
if ($.type(options.formData) === 'object') {
|
278 |
-
formData = [];
|
279 |
-
$.each(options.formData, function (name, value) {
|
280 |
-
formData.push({name: name, value: value});
|
281 |
-
});
|
282 |
-
return formData;
|
283 |
-
}
|
284 |
-
return [];
|
285 |
-
},
|
286 |
-
|
287 |
-
_getTotal: function (files) {
|
288 |
-
var total = 0;
|
289 |
-
$.each(files, function (index, file) {
|
290 |
-
total += file.size || 1;
|
291 |
-
});
|
292 |
-
return total;
|
293 |
-
},
|
294 |
-
|
295 |
-
_initProgressObject: function (obj) {
|
296 |
-
var progress = {
|
297 |
-
loaded: 0,
|
298 |
-
total: 0,
|
299 |
-
bitrate: 0
|
300 |
-
};
|
301 |
-
if (obj._progress) {
|
302 |
-
$.extend(obj._progress, progress);
|
303 |
-
} else {
|
304 |
-
obj._progress = progress;
|
305 |
-
}
|
306 |
-
},
|
307 |
-
|
308 |
-
_initResponseObject: function (obj) {
|
309 |
-
var prop;
|
310 |
-
if (obj._response) {
|
311 |
-
for (prop in obj._response) {
|
312 |
-
if (obj._response.hasOwnProperty(prop)) {
|
313 |
-
delete obj._response[prop];
|
314 |
-
}
|
315 |
-
}
|
316 |
-
} else {
|
317 |
-
obj._response = {};
|
318 |
-
}
|
319 |
-
},
|
320 |
-
|
321 |
-
_onProgress: function (e, data) {
|
322 |
-
if (e.lengthComputable) {
|
323 |
-
var now = ((Date.now) ? Date.now() : (new Date()).getTime()),
|
324 |
-
loaded;
|
325 |
-
if (data._time && data.progressInterval &&
|
326 |
-
(now - data._time < data.progressInterval) &&
|
327 |
-
e.loaded !== e.total) {
|
328 |
-
return;
|
329 |
-
}
|
330 |
-
data._time = now;
|
331 |
-
loaded = Math.floor(
|
332 |
-
e.loaded / e.total * (data.chunkSize || data._progress.total)
|
333 |
-
) + (data.uploadedBytes || 0);
|
334 |
-
// Add the difference from the previously loaded state
|
335 |
-
// to the global loaded counter:
|
336 |
-
this._progress.loaded += (loaded - data._progress.loaded);
|
337 |
-
this._progress.bitrate = this._bitrateTimer.getBitrate(
|
338 |
-
now,
|
339 |
-
this._progress.loaded,
|
340 |
-
data.bitrateInterval
|
341 |
-
);
|
342 |
-
data._progress.loaded = data.loaded = loaded;
|
343 |
-
data._progress.bitrate = data.bitrate = data._bitrateTimer.getBitrate(
|
344 |
-
now,
|
345 |
-
loaded,
|
346 |
-
data.bitrateInterval
|
347 |
-
);
|
348 |
-
// Trigger a custom progress event with a total data property set
|
349 |
-
// to the file size(s) of the current upload and a loaded data
|
350 |
-
// property calculated accordingly:
|
351 |
-
this._trigger('progress', e, data);
|
352 |
-
// Trigger a global progress event for all current file uploads,
|
353 |
-
// including ajax calls queued for sequential file uploads:
|
354 |
-
this._trigger('progressall', e, this._progress);
|
355 |
-
}
|
356 |
-
},
|
357 |
-
|
358 |
-
_initProgressListener: function (options) {
|
359 |
-
var that = this,
|
360 |
-
xhr = options.xhr ? options.xhr() : $.ajaxSettings.xhr();
|
361 |
-
// Accesss to the native XHR object is required to add event listeners
|
362 |
-
// for the upload progress event:
|
363 |
-
if (xhr.upload) {
|
364 |
-
$(xhr.upload).bind('progress', function (e) {
|
365 |
-
var oe = e.originalEvent;
|
366 |
-
// Make sure the progress event properties get copied over:
|
367 |
-
e.lengthComputable = oe.lengthComputable;
|
368 |
-
e.loaded = oe.loaded;
|
369 |
-
e.total = oe.total;
|
370 |
-
that._onProgress(e, options);
|
371 |
-
});
|
372 |
-
options.xhr = function () {
|
373 |
-
return xhr;
|
374 |
-
};
|
375 |
-
}
|
376 |
-
},
|
377 |
-
|
378 |
-
_isInstanceOf: function (type, obj) {
|
379 |
-
// Cross-frame instanceof check
|
380 |
-
return Object.prototype.toString.call(obj) === '[object ' + type + ']';
|
381 |
-
},
|
382 |
-
|
383 |
-
_initXHRData: function (options) {
|
384 |
-
var that = this,
|
385 |
-
formData,
|
386 |
-
file = options.files[0],
|
387 |
-
// Ignore non-multipart setting if not supported:
|
388 |
-
multipart = options.multipart || !$.support.xhrFileUpload,
|
389 |
-
paramName = options.paramName[0];
|
390 |
-
options.headers = options.headers || {};
|
391 |
-
if (options.contentRange) {
|
392 |
-
options.headers['Content-Range'] = options.contentRange;
|
393 |
-
}
|
394 |
-
if (!multipart || options.blob || !this._isInstanceOf('File', file)) {
|
395 |
-
options.headers['Content-Disposition'] = 'attachment; filename="' +
|
396 |
-
encodeURI(file.name) + '"';
|
397 |
-
}
|
398 |
-
if (!multipart) {
|
399 |
-
options.contentType = file.type;
|
400 |
-
options.data = options.blob || file;
|
401 |
-
} else if ($.support.xhrFormDataFileUpload) {
|
402 |
-
if (options.postMessage) {
|
403 |
-
// window.postMessage does not allow sending FormData
|
404 |
-
// objects, so we just add the File/Blob objects to
|
405 |
-
// the formData array and let the postMessage window
|
406 |
-
// create the FormData object out of this array:
|
407 |
-
formData = this._getFormData(options);
|
408 |
-
if (options.blob) {
|
409 |
-
formData.push({
|
410 |
-
name: paramName,
|
411 |
-
value: options.blob
|
412 |
-
});
|
413 |
-
} else {
|
414 |
-
$.each(options.files, function (index, file) {
|
415 |
-
formData.push({
|
416 |
-
name: options.paramName[index] || paramName,
|
417 |
-
value: file
|
418 |
-
});
|
419 |
-
});
|
420 |
-
}
|
421 |
-
} else {
|
422 |
-
if (that._isInstanceOf('FormData', options.formData)) {
|
423 |
-
formData = options.formData;
|
424 |
-
} else {
|
425 |
-
formData = new FormData();
|
426 |
-
$.each(this._getFormData(options), function (index, field) {
|
427 |
-
formData.append(field.name, field.value);
|
428 |
-
});
|
429 |
-
}
|
430 |
-
if (options.blob) {
|
431 |
-
formData.append(paramName, options.blob, file.name);
|
432 |
-
} else {
|
433 |
-
$.each(options.files, function (index, file) {
|
434 |
-
// This check allows the tests to run with
|
435 |
-
// dummy objects:
|
436 |
-
if (that._isInstanceOf('File', file) ||
|
437 |
-
that._isInstanceOf('Blob', file)) {
|
438 |
-
formData.append(
|
439 |
-
options.paramName[index] || paramName,
|
440 |
-
file,
|
441 |
-
file.name
|
442 |
-
);
|
443 |
-
}
|
444 |
-
});
|
445 |
-
}
|
446 |
-
}
|
447 |
-
options.data = formData;
|
448 |
-
}
|
449 |
-
// Blob reference is not needed anymore, free memory:
|
450 |
-
options.blob = null;
|
451 |
-
},
|
452 |
-
|
453 |
-
_initIframeSettings: function (options) {
|
454 |
-
var targetHost = $('<a></a>').prop('href', options.url).prop('host');
|
455 |
-
// Setting the dataType to iframe enables the iframe transport:
|
456 |
-
options.dataType = 'iframe ' + (options.dataType || '');
|
457 |
-
// The iframe transport accepts a serialized array as form data:
|
458 |
-
options.formData = this._getFormData(options);
|
459 |
-
// Add redirect url to form data on cross-domain uploads:
|
460 |
-
if (options.redirect && targetHost && targetHost !== location.host) {
|
461 |
-
options.formData.push({
|
462 |
-
name: options.redirectParamName || 'redirect',
|
463 |
-
value: options.redirect
|
464 |
-
});
|
465 |
-
}
|
466 |
-
},
|
467 |
-
|
468 |
-
_initDataSettings: function (options) {
|
469 |
-
if (this._isXHRUpload(options)) {
|
470 |
-
if (!this._chunkedUpload(options, true)) {
|
471 |
-
if (!options.data) {
|
472 |
-
this._initXHRData(options);
|
473 |
-
}
|
474 |
-
this._initProgressListener(options);
|
475 |
-
}
|
476 |
-
if (options.postMessage) {
|
477 |
-
// Setting the dataType to postmessage enables the
|
478 |
-
// postMessage transport:
|
479 |
-
options.dataType = 'postmessage ' + (options.dataType || '');
|
480 |
-
}
|
481 |
-
} else {
|
482 |
-
this._initIframeSettings(options);
|
483 |
-
}
|
484 |
-
},
|
485 |
-
|
486 |
-
_getParamName: function (options) {
|
487 |
-
var fileInput = $(options.fileInput),
|
488 |
-
paramName = options.paramName;
|
489 |
-
if (!paramName) {
|
490 |
-
paramName = [];
|
491 |
-
fileInput.each(function () {
|
492 |
-
var input = $(this),
|
493 |
-
name = input.prop('name') || 'files[]',
|
494 |
-
i = (input.prop('files') || [1]).length;
|
495 |
-
while (i) {
|
496 |
-
paramName.push(name);
|
497 |
-
i -= 1;
|
498 |
-
}
|
499 |
-
});
|
500 |
-
if (!paramName.length) {
|
501 |
-
paramName = [fileInput.prop('name') || 'files[]'];
|
502 |
-
}
|
503 |
-
} else if (!$.isArray(paramName)) {
|
504 |
-
paramName = [paramName];
|
505 |
-
}
|
506 |
-
return paramName;
|
507 |
-
},
|
508 |
-
|
509 |
-
_initFormSettings: function (options) {
|
510 |
-
// Retrieve missing options from the input field and the
|
511 |
-
// associated form, if available:
|
512 |
-
if (!options.form || !options.form.length) {
|
513 |
-
options.form = $(options.fileInput.prop('form'));
|
514 |
-
// If the given file input doesn't have an associated form,
|
515 |
-
// use the default widget file input's form:
|
516 |
-
if (!options.form.length) {
|
517 |
-
options.form = $(this.options.fileInput.prop('form'));
|
518 |
-
}
|
519 |
-
}
|
520 |
-
options.paramName = this._getParamName(options);
|
521 |
-
if (!options.url) {
|
522 |
-
options.url = options.form.prop('action') || location.href;
|
523 |
-
}
|
524 |
-
// The HTTP request method must be "POST" or "PUT":
|
525 |
-
options.type = (options.type || options.form.prop('method') || '')
|
526 |
-
.toUpperCase();
|
527 |
-
if (options.type !== 'POST' && options.type !== 'PUT' &&
|
528 |
-
options.type !== 'PATCH') {
|
529 |
-
options.type = 'POST';
|
530 |
-
}
|
531 |
-
if (!options.formAcceptCharset) {
|
532 |
-
options.formAcceptCharset = options.form.attr('accept-charset');
|
533 |
-
}
|
534 |
-
},
|
535 |
-
|
536 |
-
_getAJAXSettings: function (data) {
|
537 |
-
var options = $.extend({}, this.options, data);
|
538 |
-
this._initFormSettings(options);
|
539 |
-
this._initDataSettings(options);
|
540 |
-
return options;
|
541 |
-
},
|
542 |
-
|
543 |
-
// jQuery 1.6 doesn't provide .state(),
|
544 |
-
// while jQuery 1.8+ removed .isRejected() and .isResolved():
|
545 |
-
_getDeferredState: function (deferred) {
|
546 |
-
if (deferred.state) {
|
547 |
-
return deferred.state();
|
548 |
-
}
|
549 |
-
if (deferred.isResolved()) {
|
550 |
-
return 'resolved';
|
551 |
-
}
|
552 |
-
if (deferred.isRejected()) {
|
553 |
-
return 'rejected';
|
554 |
-
}
|
555 |
-
return 'pending';
|
556 |
-
},
|
557 |
-
|
558 |
-
// Maps jqXHR callbacks to the equivalent
|
559 |
-
// methods of the given Promise object:
|
560 |
-
_enhancePromise: function (promise) {
|
561 |
-
promise.success = promise.done;
|
562 |
-
promise.error = promise.fail;
|
563 |
-
promise.complete = promise.always;
|
564 |
-
return promise;
|
565 |
-
},
|
566 |
-
|
567 |
-
// Creates and returns a Promise object enhanced with
|
568 |
-
// the jqXHR methods abort, success, error and complete:
|
569 |
-
_getXHRPromise: function (resolveOrReject, context, args) {
|
570 |
-
var dfd = $.Deferred(),
|
571 |
-
promise = dfd.promise();
|
572 |
-
context = context || this.options.context || promise;
|
573 |
-
if (resolveOrReject === true) {
|
574 |
-
dfd.resolveWith(context, args);
|
575 |
-
} else if (resolveOrReject === false) {
|
576 |
-
dfd.rejectWith(context, args);
|
577 |
-
}
|
578 |
-
promise.abort = dfd.promise;
|
579 |
-
return this._enhancePromise(promise);
|
580 |
-
},
|
581 |
-
|
582 |
-
// Adds convenience methods to the data callback argument:
|
583 |
-
_addConvenienceMethods: function (e, data) {
|
584 |
-
var that = this,
|
585 |
-
getPromise = function (data) {
|
586 |
-
return $.Deferred().resolveWith(that, [data]).promise();
|
587 |
-
};
|
588 |
-
data.process = function (resolveFunc, rejectFunc) {
|
589 |
-
if (resolveFunc || rejectFunc) {
|
590 |
-
data._processQueue = this._processQueue =
|
591 |
-
(this._processQueue || getPromise(this))
|
592 |
-
.pipe(resolveFunc, rejectFunc);
|
593 |
-
}
|
594 |
-
return this._processQueue || getPromise(this);
|
595 |
-
};
|
596 |
-
data.submit = function () {
|
597 |
-
if (this.state() !== 'pending') {
|
598 |
-
data.jqXHR = this.jqXHR =
|
599 |
-
(that._trigger('submit', e, this) !== false) &&
|
600 |
-
that._onSend(e, this);
|
601 |
-
}
|
602 |
-
return this.jqXHR || that._getXHRPromise();
|
603 |
-
};
|
604 |
-
data.abort = function () {
|
605 |
-
if (this.jqXHR) {
|
606 |
-
return this.jqXHR.abort();
|
607 |
-
}
|
608 |
-
return that._getXHRPromise();
|
609 |
-
};
|
610 |
-
data.state = function () {
|
611 |
-
if (this.jqXHR) {
|
612 |
-
return that._getDeferredState(this.jqXHR);
|
613 |
-
}
|
614 |
-
if (this._processQueue) {
|
615 |
-
return that._getDeferredState(this._processQueue);
|
616 |
-
}
|
617 |
-
};
|
618 |
-
data.progress = function () {
|
619 |
-
return this._progress;
|
620 |
-
};
|
621 |
-
data.response = function () {
|
622 |
-
return this._response;
|
623 |
-
};
|
624 |
-
},
|
625 |
-
|
626 |
-
// Parses the Range header from the server response
|
627 |
-
// and returns the uploaded bytes:
|
628 |
-
_getUploadedBytes: function (jqXHR) {
|
629 |
-
var range = jqXHR.getResponseHeader('Range'),
|
630 |
-
parts = range && range.split('-'),
|
631 |
-
upperBytesPos = parts && parts.length > 1 &&
|
632 |
-
parseInt(parts[1], 10);
|
633 |
-
return upperBytesPos && upperBytesPos + 1;
|
634 |
-
},
|
635 |
-
|
636 |
-
// Uploads a file in multiple, sequential requests
|
637 |
-
// by splitting the file up in multiple blob chunks.
|
638 |
-
// If the second parameter is true, only tests if the file
|
639 |
-
// should be uploaded in chunks, but does not invoke any
|
640 |
-
// upload requests:
|
641 |
-
_chunkedUpload: function (options, testOnly) {
|
642 |
-
options.uploadedBytes = options.uploadedBytes || 0;
|
643 |
-
var that = this,
|
644 |
-
file = options.files[0],
|
645 |
-
fs = file.size,
|
646 |
-
ub = options.uploadedBytes,
|
647 |
-
mcs = options.maxChunkSize || fs,
|
648 |
-
slice = this._blobSlice,
|
649 |
-
dfd = $.Deferred(),
|
650 |
-
promise = dfd.promise(),
|
651 |
-
jqXHR,
|
652 |
-
upload;
|
653 |
-
if (!(this._isXHRUpload(options) && slice && (ub || mcs < fs)) ||
|
654 |
-
options.data) {
|
655 |
-
return false;
|
656 |
-
}
|
657 |
-
if (testOnly) {
|
658 |
-
return true;
|
659 |
-
}
|
660 |
-
if (ub >= fs) {
|
661 |
-
file.error = options.i18n('uploadedBytes');
|
662 |
-
return this._getXHRPromise(
|
663 |
-
false,
|
664 |
-
options.context,
|
665 |
-
[null, 'error', file.error]
|
666 |
-
);
|
667 |
-
}
|
668 |
-
// The chunk upload method:
|
669 |
-
upload = function () {
|
670 |
-
// Clone the options object for each chunk upload:
|
671 |
-
var o = $.extend({}, options),
|
672 |
-
currentLoaded = o._progress.loaded;
|
673 |
-
o.blob = slice.call(
|
674 |
-
file,
|
675 |
-
ub,
|
676 |
-
ub + mcs,
|
677 |
-
file.type
|
678 |
-
);
|
679 |
-
// Store the current chunk size, as the blob itself
|
680 |
-
// will be dereferenced after data processing:
|
681 |
-
o.chunkSize = o.blob.size;
|
682 |
-
// Expose the chunk bytes position range:
|
683 |
-
o.contentRange = 'bytes ' + ub + '-' +
|
684 |
-
(ub + o.chunkSize - 1) + '/' + fs;
|
685 |
-
// Process the upload data (the blob and potential form data):
|
686 |
-
that._initXHRData(o);
|
687 |
-
// Add progress listeners for this chunk upload:
|
688 |
-
that._initProgressListener(o);
|
689 |
-
jqXHR = ((that._trigger('chunksend', null, o) !== false && $.ajax(o)) ||
|
690 |
-
that._getXHRPromise(false, o.context))
|
691 |
-
.done(function (result, textStatus, jqXHR) {
|
692 |
-
ub = that._getUploadedBytes(jqXHR) ||
|
693 |
-
(ub + o.chunkSize);
|
694 |
-
// Create a progress event if no final progress event
|
695 |
-
// with loaded equaling total has been triggered
|
696 |
-
// for this chunk:
|
697 |
-
if (currentLoaded + o.chunkSize - o._progress.loaded) {
|
698 |
-
that._onProgress($.Event('progress', {
|
699 |
-
lengthComputable: true,
|
700 |
-
loaded: ub - o.uploadedBytes,
|
701 |
-
total: ub - o.uploadedBytes
|
702 |
-
}), o);
|
703 |
-
}
|
704 |
-
options.uploadedBytes = o.uploadedBytes = ub;
|
705 |
-
o.result = result;
|
706 |
-
o.textStatus = textStatus;
|
707 |
-
o.jqXHR = jqXHR;
|
708 |
-
that._trigger('chunkdone', null, o);
|
709 |
-
that._trigger('chunkalways', null, o);
|
710 |
-
if (ub < fs) {
|
711 |
-
// File upload not yet complete,
|
712 |
-
// continue with the next chunk:
|
713 |
-
upload();
|
714 |
-
} else {
|
715 |
-
dfd.resolveWith(
|
716 |
-
o.context,
|
717 |
-
[result, textStatus, jqXHR]
|
718 |
-
);
|
719 |
-
}
|
720 |
-
})
|
721 |
-
.fail(function (jqXHR, textStatus, errorThrown) {
|
722 |
-
o.jqXHR = jqXHR;
|
723 |
-
o.textStatus = textStatus;
|
724 |
-
o.errorThrown = errorThrown;
|
725 |
-
that._trigger('chunkfail', null, o);
|
726 |
-
that._trigger('chunkalways', null, o);
|
727 |
-
dfd.rejectWith(
|
728 |
-
o.context,
|
729 |
-
[jqXHR, textStatus, errorThrown]
|
730 |
-
);
|
731 |
-
});
|
732 |
-
};
|
733 |
-
this._enhancePromise(promise);
|
734 |
-
promise.abort = function () {
|
735 |
-
return jqXHR.abort();
|
736 |
-
};
|
737 |
-
upload();
|
738 |
-
return promise;
|
739 |
-
},
|
740 |
-
|
741 |
-
_beforeSend: function (e, data) {
|
742 |
-
if (this._active === 0) {
|
743 |
-
// the start callback is triggered when an upload starts
|
744 |
-
// and no other uploads are currently running,
|
745 |
-
// equivalent to the global ajaxStart event:
|
746 |
-
this._trigger('start');
|
747 |
-
// Set timer for global bitrate progress calculation:
|
748 |
-
this._bitrateTimer = new this._BitrateTimer();
|
749 |
-
// Reset the global progress values:
|
750 |
-
this._progress.loaded = this._progress.total = 0;
|
751 |
-
this._progress.bitrate = 0;
|
752 |
-
}
|
753 |
-
// Make sure the container objects for the .response() and
|
754 |
-
// .progress() methods on the data object are available
|
755 |
-
// and reset to their initial state:
|
756 |
-
this._initResponseObject(data);
|
757 |
-
this._initProgressObject(data);
|
758 |
-
data._progress.loaded = data.loaded = data.uploadedBytes || 0;
|
759 |
-
data._progress.total = data.total = this._getTotal(data.files) || 1;
|
760 |
-
data._progress.bitrate = data.bitrate = 0;
|
761 |
-
this._active += 1;
|
762 |
-
// Initialize the global progress values:
|
763 |
-
this._progress.loaded += data.loaded;
|
764 |
-
this._progress.total += data.total;
|
765 |
-
},
|
766 |
-
|
767 |
-
_onDone: function (result, textStatus, jqXHR, options) {
|
768 |
-
var total = options._progress.total,
|
769 |
-
response = options._response;
|
770 |
-
if (options._progress.loaded < total) {
|
771 |
-
// Create a progress event if no final progress event
|
772 |
-
// with loaded equaling total has been triggered:
|
773 |
-
this._onProgress($.Event('progress', {
|
774 |
-
lengthComputable: true,
|
775 |
-
loaded: total,
|
776 |
-
total: total
|
777 |
-
}), options);
|
778 |
-
}
|
779 |
-
response.result = options.result = result;
|
780 |
-
response.textStatus = options.textStatus = textStatus;
|
781 |
-
response.jqXHR = options.jqXHR = jqXHR;
|
782 |
-
this._trigger('done', null, options);
|
783 |
-
},
|
784 |
-
|
785 |
-
_onFail: function (jqXHR, textStatus, errorThrown, options) {
|
786 |
-
var response = options._response;
|
787 |
-
if (options.recalculateProgress) {
|
788 |
-
// Remove the failed (error or abort) file upload from
|
789 |
-
// the global progress calculation:
|
790 |
-
this._progress.loaded -= options._progress.loaded;
|
791 |
-
this._progress.total -= options._progress.total;
|
792 |
-
}
|
793 |
-
response.jqXHR = options.jqXHR = jqXHR;
|
794 |
-
response.textStatus = options.textStatus = textStatus;
|
795 |
-
response.errorThrown = options.errorThrown = errorThrown;
|
796 |
-
this._trigger('fail', null, options);
|
797 |
-
},
|
798 |
-
|
799 |
-
_onAlways: function (jqXHRorResult, textStatus, jqXHRorError, options) {
|
800 |
-
// jqXHRorResult, textStatus and jqXHRorError are added to the
|
801 |
-
// options object via done and fail callbacks
|
802 |
-
this._trigger('always', null, options);
|
803 |
-
},
|
804 |
-
|
805 |
-
_onSend: function (e, data) {
|
806 |
-
if (!data.submit) {
|
807 |
-
this._addConvenienceMethods(e, data);
|
808 |
-
}
|
809 |
-
var that = this,
|
810 |
-
jqXHR,
|
811 |
-
aborted,
|
812 |
-
slot,
|
813 |
-
pipe,
|
814 |
-
options = that._getAJAXSettings(data),
|
815 |
-
send = function () {
|
816 |
-
that._sending += 1;
|
817 |
-
// Set timer for bitrate progress calculation:
|
818 |
-
options._bitrateTimer = new that._BitrateTimer();
|
819 |
-
jqXHR = jqXHR || (
|
820 |
-
((aborted || that._trigger('send', e, options) === false) &&
|
821 |
-
that._getXHRPromise(false, options.context, aborted)) ||
|
822 |
-
that._chunkedUpload(options) || $.ajax(options)
|
823 |
-
).done(function (result, textStatus, jqXHR) {
|
824 |
-
that._onDone(result, textStatus, jqXHR, options);
|
825 |
-
}).fail(function (jqXHR, textStatus, errorThrown) {
|
826 |
-
that._onFail(jqXHR, textStatus, errorThrown, options);
|
827 |
-
}).always(function (jqXHRorResult, textStatus, jqXHRorError) {
|
828 |
-
that._onAlways(
|
829 |
-
jqXHRorResult,
|
830 |
-
textStatus,
|
831 |
-
jqXHRorError,
|
832 |
-
options
|
833 |
-
);
|
834 |
-
that._sending -= 1;
|
835 |
-
that._active -= 1;
|
836 |
-
if (options.limitConcurrentUploads &&
|
837 |
-
options.limitConcurrentUploads > that._sending) {
|
838 |
-
// Start the next queued upload,
|
839 |
-
// that has not been aborted:
|
840 |
-
var nextSlot = that._slots.shift();
|
841 |
-
while (nextSlot) {
|
842 |
-
if (that._getDeferredState(nextSlot) === 'pending') {
|
843 |
-
nextSlot.resolve();
|
844 |
-
break;
|
845 |
-
}
|
846 |
-
nextSlot = that._slots.shift();
|
847 |
-
}
|
848 |
-
}
|
849 |
-
if (that._active === 0) {
|
850 |
-
// The stop callback is triggered when all uploads have
|
851 |
-
// been completed, equivalent to the global ajaxStop event:
|
852 |
-
that._trigger('stop');
|
853 |
-
}
|
854 |
-
});
|
855 |
-
return jqXHR;
|
856 |
-
};
|
857 |
-
this._beforeSend(e, options);
|
858 |
-
if (this.options.sequentialUploads ||
|
859 |
-
(this.options.limitConcurrentUploads &&
|
860 |
-
this.options.limitConcurrentUploads <= this._sending)) {
|
861 |
-
if (this.options.limitConcurrentUploads > 1) {
|
862 |
-
slot = $.Deferred();
|
863 |
-
this._slots.push(slot);
|
864 |
-
pipe = slot.pipe(send);
|
865 |
-
} else {
|
866 |
-
this._sequence = this._sequence.pipe(send, send);
|
867 |
-
pipe = this._sequence;
|
868 |
-
}
|
869 |
-
// Return the piped Promise object, enhanced with an abort method,
|
870 |
-
// which is delegated to the jqXHR object of the current upload,
|
871 |
-
// and jqXHR callbacks mapped to the equivalent Promise methods:
|
872 |
-
pipe.abort = function () {
|
873 |
-
aborted = [undefined, 'abort', 'abort'];
|
874 |
-
if (!jqXHR) {
|
875 |
-
if (slot) {
|
876 |
-
slot.rejectWith(options.context, aborted);
|
877 |
-
}
|
878 |
-
return send();
|
879 |
-
}
|
880 |
-
return jqXHR.abort();
|
881 |
-
};
|
882 |
-
return this._enhancePromise(pipe);
|
883 |
-
}
|
884 |
-
return send();
|
885 |
-
},
|
886 |
-
|
887 |
-
_onAdd: function (e, data) {
|
888 |
-
var that = this,
|
889 |
-
result = true,
|
890 |
-
options = $.extend({}, this.options, data),
|
891 |
-
limit = options.limitMultiFileUploads,
|
892 |
-
paramName = this._getParamName(options),
|
893 |
-
paramNameSet,
|
894 |
-
paramNameSlice,
|
895 |
-
fileSet,
|
896 |
-
i;
|
897 |
-
if (!(options.singleFileUploads || limit) ||
|
898 |
-
!this._isXHRUpload(options)) {
|
899 |
-
fileSet = [data.files];
|
900 |
-
paramNameSet = [paramName];
|
901 |
-
} else if (!options.singleFileUploads && limit) {
|
902 |
-
fileSet = [];
|
903 |
-
paramNameSet = [];
|
904 |
-
for (i = 0; i < data.files.length; i += limit) {
|
905 |
-
fileSet.push(data.files.slice(i, i + limit));
|
906 |
-
paramNameSlice = paramName.slice(i, i + limit);
|
907 |
-
if (!paramNameSlice.length) {
|
908 |
-
paramNameSlice = paramName;
|
909 |
-
}
|
910 |
-
paramNameSet.push(paramNameSlice);
|
911 |
-
}
|
912 |
-
} else {
|
913 |
-
paramNameSet = paramName;
|
914 |
-
}
|
915 |
-
data.originalFiles = data.files;
|
916 |
-
$.each(fileSet || data.files, function (index, element) {
|
917 |
-
var newData = $.extend({}, data);
|
918 |
-
newData.files = fileSet ? element : [element];
|
919 |
-
newData.paramName = paramNameSet[index];
|
920 |
-
that._initResponseObject(newData);
|
921 |
-
that._initProgressObject(newData);
|
922 |
-
that._addConvenienceMethods(e, newData);
|
923 |
-
result = that._trigger('add', e, newData);
|
924 |
-
return result;
|
925 |
-
});
|
926 |
-
return result;
|
927 |
-
},
|
928 |
-
|
929 |
-
_replaceFileInput: function (input) {
|
930 |
-
var inputClone = input.clone(true);
|
931 |
-
$('<form></form>').append(inputClone)[0].reset();
|
932 |
-
// Detaching allows to insert the fileInput on another form
|
933 |
-
// without loosing the file input value:
|
934 |
-
input.after(inputClone).detach();
|
935 |
-
// Avoid memory leaks with the detached file input:
|
936 |
-
$.cleanData(input.unbind('remove'));
|
937 |
-
// Replace the original file input element in the fileInput
|
938 |
-
// elements set with the clone, which has been copied including
|
939 |
-
// event handlers:
|
940 |
-
this.options.fileInput = this.options.fileInput.map(function (i, el) {
|
941 |
-
if (el === input[0]) {
|
942 |
-
return inputClone[0];
|
943 |
-
}
|
944 |
-
return el;
|
945 |
-
});
|
946 |
-
// If the widget has been initialized on the file input itself,
|
947 |
-
// override this.element with the file input clone:
|
948 |
-
if (input[0] === this.element[0]) {
|
949 |
-
this.element = inputClone;
|
950 |
-
}
|
951 |
-
},
|
952 |
-
|
953 |
-
_handleFileTreeEntry: function (entry, path) {
|
954 |
-
var that = this,
|
955 |
-
dfd = $.Deferred(),
|
956 |
-
errorHandler = function (e) {
|
957 |
-
if (e && !e.entry) {
|
958 |
-
e.entry = entry;
|
959 |
-
}
|
960 |
-
// Since $.when returns immediately if one
|
961 |
-
// Deferred is rejected, we use resolve instead.
|
962 |
-
// This allows valid files and invalid items
|
963 |
-
// to be returned together in one set:
|
964 |
-
dfd.resolve([e]);
|
965 |
-
},
|
966 |
-
dirReader;
|
967 |
-
path = path || '';
|
968 |
-
if (entry.isFile) {
|
969 |
-
if (entry._file) {
|
970 |
-
// Workaround for Chrome bug #149735
|
971 |
-
entry._file.relativePath = path;
|
972 |
-
dfd.resolve(entry._file);
|
973 |
-
} else {
|
974 |
-
entry.file(function (file) {
|
975 |
-
file.relativePath = path;
|
976 |
-
dfd.resolve(file);
|
977 |
-
}, errorHandler);
|
978 |
-
}
|
979 |
-
} else if (entry.isDirectory) {
|
980 |
-
dirReader = entry.createReader();
|
981 |
-
dirReader.readEntries(function (entries) {
|
982 |
-
that._handleFileTreeEntries(
|
983 |
-
entries,
|
984 |
-
path + entry.name + '/'
|
985 |
-
).done(function (files) {
|
986 |
-
dfd.resolve(files);
|
987 |
-
}).fail(errorHandler);
|
988 |
-
}, errorHandler);
|
989 |
-
} else {
|
990 |
-
// Return an empy list for file system items
|
991 |
-
// other than files or directories:
|
992 |
-
dfd.resolve([]);
|
993 |
-
}
|
994 |
-
return dfd.promise();
|
995 |
-
},
|
996 |
-
|
997 |
-
_handleFileTreeEntries: function (entries, path) {
|
998 |
-
var that = this;
|
999 |
-
return $.when.apply(
|
1000 |
-
$,
|
1001 |
-
$.map(entries, function (entry) {
|
1002 |
-
return that._handleFileTreeEntry(entry, path);
|
1003 |
-
})
|
1004 |
-
).pipe(function () {
|
1005 |
-
return Array.prototype.concat.apply(
|
1006 |
-
[],
|
1007 |
-
arguments
|
1008 |
-
);
|
1009 |
-
});
|
1010 |
-
},
|
1011 |
-
|
1012 |
-
_getDroppedFiles: function (dataTransfer) {
|
1013 |
-
dataTransfer = dataTransfer || {};
|
1014 |
-
var items = dataTransfer.items;
|
1015 |
-
if (items && items.length && (items[0].webkitGetAsEntry ||
|
1016 |
-
items[0].getAsEntry)) {
|
1017 |
-
return this._handleFileTreeEntries(
|
1018 |
-
$.map(items, function (item) {
|
1019 |
-
var entry;
|
1020 |
-
if (item.webkitGetAsEntry) {
|
1021 |
-
entry = item.webkitGetAsEntry();
|
1022 |
-
if (entry) {
|
1023 |
-
// Workaround for Chrome bug #149735:
|
1024 |
-
entry._file = item.getAsFile();
|
1025 |
-
}
|
1026 |
-
return entry;
|
1027 |
-
}
|
1028 |
-
return item.getAsEntry();
|
1029 |
-
})
|
1030 |
-
);
|
1031 |
-
}
|
1032 |
-
return $.Deferred().resolve(
|
1033 |
-
$.makeArray(dataTransfer.files)
|
1034 |
-
).promise();
|
1035 |
-
},
|
1036 |
-
|
1037 |
-
_getSingleFileInputFiles: function (fileInput) {
|
1038 |
-
fileInput = $(fileInput);
|
1039 |
-
var entries = fileInput.prop('webkitEntries') ||
|
1040 |
-
fileInput.prop('entries'),
|
1041 |
-
files,
|
1042 |
-
value;
|
1043 |
-
if (entries && entries.length) {
|
1044 |
-
return this._handleFileTreeEntries(entries);
|
1045 |
-
}
|
1046 |
-
files = $.makeArray(fileInput.prop('files'));
|
1047 |
-
if (!files.length) {
|
1048 |
-
value = fileInput.prop('value');
|
1049 |
-
if (!value) {
|
1050 |
-
return $.Deferred().resolve([]).promise();
|
1051 |
-
}
|
1052 |
-
// If the files property is not available, the browser does not
|
1053 |
-
// support the File API and we add a pseudo File object with
|
1054 |
-
// the input value as name with path information removed:
|
1055 |
-
files = [{name: value.replace(/^.*\\/, '')}];
|
1056 |
-
} else if (files[0].name === undefined && files[0].fileName) {
|
1057 |
-
// File normalization for Safari 4 and Firefox 3:
|
1058 |
-
$.each(files, function (index, file) {
|
1059 |
-
file.name = file.fileName;
|
1060 |
-
file.size = file.fileSize;
|
1061 |
-
});
|
1062 |
-
}
|
1063 |
-
return $.Deferred().resolve(files).promise();
|
1064 |
-
},
|
1065 |
-
|
1066 |
-
_getFileInputFiles: function (fileInput) {
|
1067 |
-
if (!(fileInput instanceof $) || fileInput.length === 1) {
|
1068 |
-
return this._getSingleFileInputFiles(fileInput);
|
1069 |
-
}
|
1070 |
-
return $.when.apply(
|
1071 |
-
$,
|
1072 |
-
$.map(fileInput, this._getSingleFileInputFiles)
|
1073 |
-
).pipe(function () {
|
1074 |
-
return Array.prototype.concat.apply(
|
1075 |
-
[],
|
1076 |
-
arguments
|
1077 |
-
);
|
1078 |
-
});
|
1079 |
-
},
|
1080 |
-
|
1081 |
-
_onChange: function (e) {
|
1082 |
-
var that = this,
|
1083 |
-
data = {
|
1084 |
-
fileInput: $(e.target),
|
1085 |
-
form: $(e.target.form)
|
1086 |
-
};
|
1087 |
-
this._getFileInputFiles(data.fileInput).always(function (files) {
|
1088 |
-
data.files = files;
|
1089 |
-
if (that.options.replaceFileInput) {
|
1090 |
-
that._replaceFileInput(data.fileInput);
|
1091 |
-
}
|
1092 |
-
if (that._trigger('change', e, data) !== false) {
|
1093 |
-
that._onAdd(e, data);
|
1094 |
-
}
|
1095 |
-
});
|
1096 |
-
},
|
1097 |
-
|
1098 |
-
_onPaste: function (e) {
|
1099 |
-
var items = e.originalEvent && e.originalEvent.clipboardData &&
|
1100 |
-
e.originalEvent.clipboardData.items,
|
1101 |
-
data = {files: []};
|
1102 |
-
if (items && items.length) {
|
1103 |
-
$.each(items, function (index, item) {
|
1104 |
-
var file = item.getAsFile && item.getAsFile();
|
1105 |
-
if (file) {
|
1106 |
-
data.files.push(file);
|
1107 |
-
}
|
1108 |
-
});
|
1109 |
-
if (this._trigger('paste', e, data) === false ||
|
1110 |
-
this._onAdd(e, data) === false) {
|
1111 |
-
return false;
|
1112 |
-
}
|
1113 |
-
}
|
1114 |
-
},
|
1115 |
-
|
1116 |
-
_onDrop: function (e) {
|
1117 |
-
e.dataTransfer = e.originalEvent && e.originalEvent.dataTransfer;
|
1118 |
-
var that = this,
|
1119 |
-
dataTransfer = e.dataTransfer,
|
1120 |
-
data = {};
|
1121 |
-
if (dataTransfer && dataTransfer.files && dataTransfer.files.length) {
|
1122 |
-
e.preventDefault();
|
1123 |
-
this._getDroppedFiles(dataTransfer).always(function (files) {
|
1124 |
-
data.files = files;
|
1125 |
-
if (that._trigger('drop', e, data) !== false) {
|
1126 |
-
that._onAdd(e, data);
|
1127 |
-
}
|
1128 |
-
});
|
1129 |
-
}
|
1130 |
-
},
|
1131 |
-
|
1132 |
-
_onDragOver: function (e) {
|
1133 |
-
e.dataTransfer = e.originalEvent && e.originalEvent.dataTransfer;
|
1134 |
-
var dataTransfer = e.dataTransfer;
|
1135 |
-
if (dataTransfer) {
|
1136 |
-
if (this._trigger('dragover', e) === false) {
|
1137 |
-
return false;
|
1138 |
-
}
|
1139 |
-
if ($.inArray('Files', dataTransfer.types) !== -1) {
|
1140 |
-
dataTransfer.dropEffect = 'copy';
|
1141 |
-
e.preventDefault();
|
1142 |
-
}
|
1143 |
-
}
|
1144 |
-
},
|
1145 |
-
|
1146 |
-
_initEventHandlers: function () {
|
1147 |
-
if (this._isXHRUpload(this.options)) {
|
1148 |
-
this._on(this.options.dropZone, {
|
1149 |
-
dragover: this._onDragOver,
|
1150 |
-
drop: this._onDrop
|
1151 |
-
});
|
1152 |
-
this._on(this.options.pasteZone, {
|
1153 |
-
paste: this._onPaste
|
1154 |
-
});
|
1155 |
-
}
|
1156 |
-
this._on(this.options.fileInput, {
|
1157 |
-
change: this._onChange
|
1158 |
-
});
|
1159 |
-
},
|
1160 |
-
|
1161 |
-
_destroyEventHandlers: function () {
|
1162 |
-
this._off(this.options.dropZone, 'dragover drop');
|
1163 |
-
this._off(this.options.pasteZone, 'paste');
|
1164 |
-
this._off(this.options.fileInput, 'change');
|
1165 |
-
},
|
1166 |
-
|
1167 |
-
_setOption: function (key, value) {
|
1168 |
-
var reinit = $.inArray(key, this._specialOptions) !== -1;
|
1169 |
-
if (reinit) {
|
1170 |
-
this._destroyEventHandlers();
|
1171 |
-
}
|
1172 |
-
this._super(key, value);
|
1173 |
-
if (reinit) {
|
1174 |
-
this._initSpecialOptions();
|
1175 |
-
this._initEventHandlers();
|
1176 |
-
}
|
1177 |
-
},
|
1178 |
-
|
1179 |
-
_initSpecialOptions: function () {
|
1180 |
-
var options = this.options;
|
1181 |
-
if (options.fileInput === undefined) {
|
1182 |
-
options.fileInput = this.element.is('input[type="file"]') ?
|
1183 |
-
this.element : this.element.find('input[type="file"]');
|
1184 |
-
} else if (!(options.fileInput instanceof $)) {
|
1185 |
-
options.fileInput = $(options.fileInput);
|
1186 |
-
}
|
1187 |
-
if (!(options.dropZone instanceof $)) {
|
1188 |
-
options.dropZone = $(options.dropZone);
|
1189 |
-
}
|
1190 |
-
if (!(options.pasteZone instanceof $)) {
|
1191 |
-
options.pasteZone = $(options.pasteZone);
|
1192 |
-
}
|
1193 |
-
},
|
1194 |
-
|
1195 |
-
_getRegExp: function (str) {
|
1196 |
-
var parts = str.split('/'),
|
1197 |
-
modifiers = parts.pop();
|
1198 |
-
parts.shift();
|
1199 |
-
return new RegExp(parts.join('/'), modifiers);
|
1200 |
-
},
|
1201 |
-
|
1202 |
-
_isRegExpOption: function (key, value) {
|
1203 |
-
return key !== 'url' && $.type(value) === 'string' &&
|
1204 |
-
/^\/.*\/[igm]{0,3}$/.test(value);
|
1205 |
-
},
|
1206 |
-
|
1207 |
-
_initDataAttributes: function () {
|
1208 |
-
var that = this,
|
1209 |
-
options = this.options;
|
1210 |
-
// Initialize options set via HTML5 data-attributes:
|
1211 |
-
$.each(
|
1212 |
-
$(this.element[0].cloneNode(false)).data(),
|
1213 |
-
function (key, value) {
|
1214 |
-
if (that._isRegExpOption(key, value)) {
|
1215 |
-
value = that._getRegExp(value);
|
1216 |
-
}
|
1217 |
-
options[key] = value;
|
1218 |
-
}
|
1219 |
-
);
|
1220 |
-
},
|
1221 |
-
|
1222 |
-
_create: function () {
|
1223 |
-
this._initDataAttributes();
|
1224 |
-
this._initSpecialOptions();
|
1225 |
-
this._slots = [];
|
1226 |
-
this._sequence = this._getXHRPromise(true);
|
1227 |
-
this._sending = this._active = 0;
|
1228 |
-
this._initProgressObject(this);
|
1229 |
-
this._initEventHandlers();
|
1230 |
-
},
|
1231 |
-
|
1232 |
-
// This method is exposed to the widget API and allows to query
|
1233 |
-
// the number of active uploads:
|
1234 |
-
active: function () {
|
1235 |
-
return this._active;
|
1236 |
-
},
|
1237 |
-
|
1238 |
-
// This method is exposed to the widget API and allows to query
|
1239 |
-
// the widget upload progress.
|
1240 |
-
// It returns an object with loaded, total and bitrate properties
|
1241 |
-
// for the running uploads:
|
1242 |
-
progress: function () {
|
1243 |
-
return this._progress;
|
1244 |
-
},
|
1245 |
-
|
1246 |
-
// This method is exposed to the widget API and allows adding files
|
1247 |
-
// using the fileupload API. The data parameter accepts an object which
|
1248 |
-
// must have a files property and can contain additional options:
|
1249 |
-
// .fileupload('add', {files: filesList});
|
1250 |
-
add: function (data) {
|
1251 |
-
var that = this;
|
1252 |
-
if (!data || this.options.disabled) {
|
1253 |
-
return;
|
1254 |
-
}
|
1255 |
-
if (data.fileInput && !data.files) {
|
1256 |
-
this._getFileInputFiles(data.fileInput).always(function (files) {
|
1257 |
-
data.files = files;
|
1258 |
-
that._onAdd(null, data);
|
1259 |
-
});
|
1260 |
-
} else {
|
1261 |
-
data.files = $.makeArray(data.files);
|
1262 |
-
this._onAdd(null, data);
|
1263 |
-
}
|
1264 |
-
},
|
1265 |
-
|
1266 |
-
// This method is exposed to the widget API and allows sending files
|
1267 |
-
// using the fileupload API. The data parameter accepts an object which
|
1268 |
-
// must have a files or fileInput property and can contain additional options:
|
1269 |
-
// .fileupload('send', {files: filesList});
|
1270 |
-
// The method returns a Promise object for the file upload call.
|
1271 |
-
send: function (data) {
|
1272 |
-
if (data && !this.options.disabled) {
|
1273 |
-
if (data.fileInput && !data.files) {
|
1274 |
-
var that = this,
|
1275 |
-
dfd = $.Deferred(),
|
1276 |
-
promise = dfd.promise(),
|
1277 |
-
jqXHR,
|
1278 |
-
aborted;
|
1279 |
-
promise.abort = function () {
|
1280 |
-
aborted = true;
|
1281 |
-
if (jqXHR) {
|
1282 |
-
return jqXHR.abort();
|
1283 |
-
}
|
1284 |
-
dfd.reject(null, 'abort', 'abort');
|
1285 |
-
return promise;
|
1286 |
-
};
|
1287 |
-
this._getFileInputFiles(data.fileInput).always(
|
1288 |
-
function (files) {
|
1289 |
-
if (aborted) {
|
1290 |
-
return;
|
1291 |
-
}
|
1292 |
-
data.files = files;
|
1293 |
-
jqXHR = that._onSend(null, data).then(
|
1294 |
-
function (result, textStatus, jqXHR) {
|
1295 |
-
dfd.resolve(result, textStatus, jqXHR);
|
1296 |
-
},
|
1297 |
-
function (jqXHR, textStatus, errorThrown) {
|
1298 |
-
dfd.reject(jqXHR, textStatus, errorThrown);
|
1299 |
-
}
|
1300 |
-
);
|
1301 |
-
}
|
1302 |
-
);
|
1303 |
-
return this._enhancePromise(promise);
|
1304 |
-
}
|
1305 |
-
data.files = $.makeArray(data.files);
|
1306 |
-
if (data.files.length) {
|
1307 |
-
return this._onSend(null, data);
|
1308 |
-
}
|
1309 |
-
}
|
1310 |
-
return this._getXHRPromise(false, data && data.context);
|
1311 |
-
}
|
1312 |
-
|
1313 |
-
});
|
1314 |
-
|
1315 |
-
}));
|
1 |
+
/*
|
2 |
+
* jQuery File Upload Plugin 5.31.6
|
3 |
+
* https://github.com/blueimp/jQuery-File-Upload
|
4 |
+
*
|
5 |
+
* Copyright 2010, Sebastian Tschan
|
6 |
+
* https://blueimp.net
|
7 |
+
*
|
8 |
+
* Licensed under the MIT license:
|
9 |
+
* http://www.opensource.org/licenses/MIT
|
10 |
+
*/
|
11 |
+
|
12 |
+
/*jslint nomen: true, unparam: true, regexp: true */
|
13 |
+
/*global define, window, document, location, File, Blob, FormData */
|
14 |
+
|
15 |
+
(function (factory) {
|
16 |
+
'use strict';
|
17 |
+
if (typeof define === 'function' && define.amd) {
|
18 |
+
// Register as an anonymous AMD module:
|
19 |
+
define([
|
20 |
+
'jquery',
|
21 |
+
'jquery.ui.widget'
|
22 |
+
], factory);
|
23 |
+
} else {
|
24 |
+
// Browser globals:
|
25 |
+
factory(window.jQuery);
|
26 |
+
}
|
27 |
+
}(function ($) {
|
28 |
+
'use strict';
|
29 |
+
|
30 |
+
// The FileReader API is not actually used, but works as feature detection,
|
31 |
+
// as e.g. Safari supports XHR file uploads via the FormData API,
|
32 |
+
// but not non-multipart XHR file uploads:
|
33 |
+
$.support.xhrFileUpload = !!(window.XMLHttpRequestUpload && window.FileReader);
|
34 |
+
$.support.xhrFormDataFileUpload = !!window.FormData;
|
35 |
+
|
36 |
+
// Detect support for Blob slicing (required for chunked uploads):
|
37 |
+
$.support.blobSlice = window.Blob && (Blob.prototype.slice ||
|
38 |
+
Blob.prototype.webkitSlice || Blob.prototype.mozSlice);
|
39 |
+
|
40 |
+
// The fileupload widget listens for change events on file input fields defined
|
41 |
+
// via fileInput setting and paste or drop events of the given dropZone.
|
42 |
+
// In addition to the default jQuery Widget methods, the fileupload widget
|
43 |
+
// exposes the "add" and "send" methods, to add or directly send files using
|
44 |
+
// the fileupload API.
|
45 |
+
// By default, files added via file input selection, paste, drag & drop or
|
46 |
+
// "add" method are uploaded immediately, but it is possible to override
|
47 |
+
// the "add" callback option to queue file uploads.
|
48 |
+
$.widget('blueimp.fileupload', {
|
49 |
+
|
50 |
+
options: {
|
51 |
+
// The drop target element(s), by the default the complete document.
|
52 |
+
// Set to null to disable drag & drop support:
|
53 |
+
dropZone: $(document),
|
54 |
+
// The paste target element(s), by the default the complete document.
|
55 |
+
// Set to null to disable paste support:
|
56 |
+
pasteZone: $(document),
|
57 |
+
// The file input field(s), that are listened to for change events.
|
58 |
+
// If undefined, it is set to the file input fields inside
|
59 |
+
// of the widget element on plugin initialization.
|
60 |
+
// Set to null to disable the change listener.
|
61 |
+
fileInput: undefined,
|
62 |
+
// By default, the file input field is replaced with a clone after
|
63 |
+
// each input field change event. This is required for iframe transport
|
64 |
+
// queues and allows change events to be fired for the same file
|
65 |
+
// selection, but can be disabled by setting the following option to false:
|
66 |
+
replaceFileInput: true,
|
67 |
+
// The parameter name for the file form data (the request argument name).
|
68 |
+
// If undefined or empty, the name property of the file input field is
|
69 |
+
// used, or "files[]" if the file input name property is also empty,
|
70 |
+
// can be a string or an array of strings:
|
71 |
+
paramName: undefined,
|
72 |
+
// By default, each file of a selection is uploaded using an individual
|
73 |
+
// request for XHR type uploads. Set to false to upload file
|
74 |
+
// selections in one request each:
|
75 |
+
singleFileUploads: true,
|
76 |
+
// To limit the number of files uploaded with one XHR request,
|
77 |
+
// set the following option to an integer greater than 0:
|
78 |
+
limitMultiFileUploads: undefined,
|
79 |
+
// Set the following option to true to issue all file upload requests
|
80 |
+
// in a sequential order:
|
81 |
+
sequentialUploads: false,
|
82 |
+
// To limit the number of concurrent uploads,
|
83 |
+
// set the following option to an integer greater than 0:
|
84 |
+
limitConcurrentUploads: undefined,
|
85 |
+
// Set the following option to true to force iframe transport uploads:
|
86 |
+
forceIframeTransport: false,
|
87 |
+
// Set the following option to the location of a redirect url on the
|
88 |
+
// origin server, for cross-domain iframe transport uploads:
|
89 |
+
redirect: undefined,
|
90 |
+
// The parameter name for the redirect url, sent as part of the form
|
91 |
+
// data and set to 'redirect' if this option is empty:
|
92 |
+
redirectParamName: undefined,
|
93 |
+
// Set the following option to the location of a postMessage window,
|
94 |
+
// to enable postMessage transport uploads:
|
95 |
+
postMessage: undefined,
|
96 |
+
// By default, XHR file uploads are sent as multipart/form-data.
|
97 |
+
// The iframe transport is always using multipart/form-data.
|
98 |
+
// Set to false to enable non-multipart XHR uploads:
|
99 |
+
multipart: true,
|
100 |
+
// To upload large files in smaller chunks, set the following option
|
101 |
+
// to a preferred maximum chunk size. If set to 0, null or undefined,
|
102 |
+
// or the browser does not support the required Blob API, files will
|
103 |
+
// be uploaded as a whole.
|
104 |
+
maxChunkSize: undefined,
|
105 |
+
// When a non-multipart upload or a chunked multipart upload has been
|
106 |
+
// aborted, this option can be used to resume the upload by setting
|
107 |
+
// it to the size of the already uploaded bytes. This option is most
|
108 |
+
// useful when modifying the options object inside of the "add" or
|
109 |
+
// "send" callbacks, as the options are cloned for each file upload.
|
110 |
+
uploadedBytes: undefined,
|
111 |
+
// By default, failed (abort or error) file uploads are removed from the
|
112 |
+
// global progress calculation. Set the following option to false to
|
113 |
+
// prevent recalculating the global progress data:
|
114 |
+
recalculateProgress: true,
|
115 |
+
// Interval in milliseconds to calculate and trigger progress events:
|
116 |
+
progressInterval: 100,
|
117 |
+
// Interval in milliseconds to calculate progress bitrate:
|
118 |
+
bitrateInterval: 500,
|
119 |
+
// By default, uploads are started automatically when adding files:
|
120 |
+
autoUpload: true,
|
121 |
+
|
122 |
+
// Error and info messages:
|
123 |
+
messages: {
|
124 |
+
uploadedBytes: 'Uploaded bytes exceed file size'
|
125 |
+
},
|
126 |
+
|
127 |
+
// Translation function, gets the message key to be translated
|
128 |
+
// and an object with context specific data as arguments:
|
129 |
+
i18n: function (message, context) {
|
130 |
+
message = this.messages[message] || message.toString();
|
131 |
+
if (context) {
|
132 |
+
$.each(context, function (key, value) {
|
133 |
+
message = message.replace('{' + key + '}', value);
|
134 |
+
});
|
135 |
+
}
|
136 |
+
return message;
|
137 |
+
},
|
138 |
+
|
139 |
+
// Additional form data to be sent along with the file uploads can be set
|
140 |
+
// using this option, which accepts an array of objects with name and
|
141 |
+
// value properties, a function returning such an array, a FormData
|
142 |
+
// object (for XHR file uploads), or a simple object.
|
143 |
+
// The form of the first fileInput is given as parameter to the function:
|
144 |
+
formData: function (form) {
|
145 |
+
return form.serializeArray();
|
146 |
+
},
|
147 |
+
|
148 |
+
// The add callback is invoked as soon as files are added to the fileupload
|
149 |
+
// widget (via file input selection, drag & drop, paste or add API call).
|
150 |
+
// If the singleFileUploads option is enabled, this callback will be
|
151 |
+
// called once for each file in the selection for XHR file uploads, else
|
152 |
+
// once for each file selection.
|
153 |
+
//
|
154 |
+
// The upload starts when the submit method is invoked on the data parameter.
|
155 |
+
// The data object contains a files property holding the added files
|
156 |
+
// and allows you to override plugin options as well as define ajax settings.
|
157 |
+
//
|
158 |
+
// Listeners for this callback can also be bound the following way:
|
159 |
+
// .bind('fileuploadadd', func);
|
160 |
+
//
|
161 |
+
// data.submit() returns a Promise object and allows to attach additional
|
162 |
+
// handlers using jQuery's Deferred callbacks:
|
163 |
+
// data.submit().done(func).fail(func).always(func);
|
164 |
+
add: function (e, data) {
|
165 |
+
if (data.autoUpload || (data.autoUpload !== false &&
|
166 |
+
$(this).fileupload('option', 'autoUpload'))) {
|
167 |
+
data.process().done(function () {
|
168 |
+
data.submit();
|
169 |
+
});
|
170 |
+
}
|
171 |
+
},
|
172 |
+
|
173 |
+
// Other callbacks:
|
174 |
+
|
175 |
+
// Callback for the submit event of each file upload:
|
176 |
+
// submit: function (e, data) {}, // .bind('fileuploadsubmit', func);
|
177 |
+
|
178 |
+
// Callback for the start of each file upload request:
|
179 |
+
// send: function (e, data) {}, // .bind('fileuploadsend', func);
|
180 |
+
|
181 |
+
// Callback for successful uploads:
|
182 |
+
// done: function (e, data) {}, // .bind('fileuploaddone', func);
|
183 |
+
|
184 |
+
// Callback for failed (abort or error) uploads:
|
185 |
+
// fail: function (e, data) {}, // .bind('fileuploadfail', func);
|
186 |
+
|
187 |
+
// Callback for completed (success, abort or error) requests:
|
188 |
+
// always: function (e, data) {}, // .bind('fileuploadalways', func);
|
189 |
+
|
190 |
+
// Callback for upload progress events:
|
191 |
+
// progress: function (e, data) {}, // .bind('fileuploadprogress', func);
|
192 |
+
|
193 |
+
// Callback for global upload progress events:
|
194 |
+
// progressall: function (e, data) {}, // .bind('fileuploadprogressall', func);
|
195 |
+
|
196 |
+
// Callback for uploads start, equivalent to the global ajaxStart event:
|
197 |
+
// start: function (e) {}, // .bind('fileuploadstart', func);
|
198 |
+
|
199 |
+
// Callback for uploads stop, equivalent to the global ajaxStop event:
|
200 |
+
// stop: function (e) {}, // .bind('fileuploadstop', func);
|
201 |
+
|
202 |
+
// Callback for change events of the fileInput(s):
|
203 |
+
// change: function (e, data) {}, // .bind('fileuploadchange', func);
|
204 |
+
|
205 |
+
// Callback for paste events to the pasteZone(s):
|
206 |
+
// paste: function (e, data) {}, // .bind('fileuploadpaste', func);
|
207 |
+
|
208 |
+
// Callback for drop events of the dropZone(s):
|
209 |
+
// drop: function (e, data) {}, // .bind('fileuploaddrop', func);
|
210 |
+
|
211 |
+
// Callback for dragover events of the dropZone(s):
|
212 |
+
// dragover: function (e) {}, // .bind('fileuploaddragover', func);
|
213 |
+
|
214 |
+
// Callback for the start of each chunk upload request:
|
215 |
+
// chunksend: function (e, data) {}, // .bind('fileuploadchunksend', func);
|
216 |
+
|
217 |
+
// Callback for successful chunk uploads:
|
218 |
+
// chunkdone: function (e, data) {}, // .bind('fileuploadchunkdone', func);
|
219 |
+
|
220 |
+
// Callback for failed (abort or error) chunk uploads:
|
221 |
+
// chunkfail: function (e, data) {}, // .bind('fileuploadchunkfail', func);
|
222 |
+
|
223 |
+
// Callback for completed (success, abort or error) chunk upload requests:
|
224 |
+
// chunkalways: function (e, data) {}, // .bind('fileuploadchunkalways', func);
|
225 |
+
|
226 |
+
// The plugin options are used as settings object for the ajax calls.
|
227 |
+
// The following are jQuery ajax settings required for the file uploads:
|
228 |
+
processData: false,
|
229 |
+
contentType: false,
|
230 |
+
cache: false
|
231 |
+
},
|
232 |
+
|
233 |
+
// A list of options that require reinitializing event listeners and/or
|
234 |
+
// special initialization code:
|
235 |
+
_specialOptions: [
|
236 |
+
'fileInput',
|
237 |
+
'dropZone',
|
238 |
+
'pasteZone',
|
239 |
+
'multipart',
|
240 |
+
'forceIframeTransport'
|
241 |
+
],
|
242 |
+
|
243 |
+
_blobSlice: $.support.blobSlice && function () {
|
244 |
+
var slice = this.slice || this.webkitSlice || this.mozSlice;
|
245 |
+
return slice.apply(this, arguments);
|
246 |
+
},
|
247 |
+
|
248 |
+
_BitrateTimer: function () {
|
249 |
+
this.timestamp = ((Date.now) ? Date.now() : (new Date()).getTime());
|
250 |
+
this.loaded = 0;
|
251 |
+
this.bitrate = 0;
|
252 |
+
this.getBitrate = function (now, loaded, interval) {
|
253 |
+
var timeDiff = now - this.timestamp;
|
254 |
+
if (!this.bitrate || !interval || timeDiff > interval) {
|
255 |
+
this.bitrate = (loaded - this.loaded) * (1000 / timeDiff) * 8;
|
256 |
+
this.loaded = loaded;
|
257 |
+
this.timestamp = now;
|
258 |
+
}
|
259 |
+
return this.bitrate;
|
260 |
+
};
|
261 |
+
},
|
262 |
+
|
263 |
+
_isXHRUpload: function (options) {
|
264 |
+
return !options.forceIframeTransport &&
|
265 |
+
((!options.multipart && $.support.xhrFileUpload) ||
|
266 |
+
$.support.xhrFormDataFileUpload);
|
267 |
+
},
|
268 |
+
|
269 |
+
_getFormData: function (options) {
|
270 |
+
var formData;
|
271 |
+
if (typeof options.formData === 'function') {
|
272 |
+
return options.formData(options.form);
|
273 |
+
}
|
274 |
+
if ($.isArray(options.formData)) {
|
275 |
+
return options.formData;
|
276 |
+
}
|
277 |
+
if ($.type(options.formData) === 'object') {
|
278 |
+
formData = [];
|
279 |
+
$.each(options.formData, function (name, value) {
|
280 |
+
formData.push({name: name, value: value});
|
281 |
+
});
|
282 |
+
return formData;
|
283 |
+
}
|
284 |
+
return [];
|
285 |
+
},
|
286 |
+
|
287 |
+
_getTotal: function (files) {
|
288 |
+
var total = 0;
|
289 |
+
$.each(files, function (index, file) {
|
290 |
+
total += file.size || 1;
|
291 |
+
});
|
292 |
+
return total;
|
293 |
+
},
|
294 |
+
|
295 |
+
_initProgressObject: function (obj) {
|
296 |
+
var progress = {
|
297 |
+
loaded: 0,
|
298 |
+
total: 0,
|
299 |
+
bitrate: 0
|
300 |
+
};
|
301 |
+
if (obj._progress) {
|
302 |
+
$.extend(obj._progress, progress);
|
303 |
+
} else {
|
304 |
+
obj._progress = progress;
|
305 |
+
}
|
306 |
+
},
|
307 |
+
|
308 |
+
_initResponseObject: function (obj) {
|
309 |
+
var prop;
|
310 |
+
if (obj._response) {
|
311 |
+
for (prop in obj._response) {
|
312 |
+
if (obj._response.hasOwnProperty(prop)) {
|
313 |
+
delete obj._response[prop];
|
314 |
+
}
|
315 |
+
}
|
316 |
+
} else {
|
317 |
+
obj._response = {};
|
318 |
+
}
|
319 |
+
},
|
320 |
+
|
321 |
+
_onProgress: function (e, data) {
|
322 |
+
if (e.lengthComputable) {
|
323 |
+
var now = ((Date.now) ? Date.now() : (new Date()).getTime()),
|
324 |
+
loaded;
|
325 |
+
if (data._time && data.progressInterval &&
|
326 |
+
(now - data._time < data.progressInterval) &&
|
327 |
+
e.loaded !== e.total) {
|
328 |
+
return;
|
329 |
+
}
|
330 |
+
data._time = now;
|
331 |
+
loaded = Math.floor(
|
332 |
+
e.loaded / e.total * (data.chunkSize || data._progress.total)
|
333 |
+
) + (data.uploadedBytes || 0);
|
334 |
+
// Add the difference from the previously loaded state
|
335 |
+
// to the global loaded counter:
|
336 |
+
this._progress.loaded += (loaded - data._progress.loaded);
|
337 |
+
this._progress.bitrate = this._bitrateTimer.getBitrate(
|
338 |
+
now,
|
339 |
+
this._progress.loaded,
|
340 |
+
data.bitrateInterval
|
341 |
+
);
|
342 |
+
data._progress.loaded = data.loaded = loaded;
|
343 |
+
data._progress.bitrate = data.bitrate = data._bitrateTimer.getBitrate(
|
344 |
+
now,
|
345 |
+
loaded,
|
346 |
+
data.bitrateInterval
|
347 |
+
);
|
348 |
+
// Trigger a custom progress event with a total data property set
|
349 |
+
// to the file size(s) of the current upload and a loaded data
|
350 |
+
// property calculated accordingly:
|
351 |
+
this._trigger('progress', e, data);
|
352 |
+
// Trigger a global progress event for all current file uploads,
|
353 |
+
// including ajax calls queued for sequential file uploads:
|
354 |
+
this._trigger('progressall', e, this._progress);
|
355 |
+
}
|
356 |
+
},
|
357 |
+
|
358 |
+
_initProgressListener: function (options) {
|
359 |
+
var that = this,
|
360 |
+
xhr = options.xhr ? options.xhr() : $.ajaxSettings.xhr();
|
361 |
+
// Accesss to the native XHR object is required to add event listeners
|
362 |
+
// for the upload progress event:
|
363 |
+
if (xhr.upload) {
|
364 |
+
$(xhr.upload).bind('progress', function (e) {
|
365 |
+
var oe = e.originalEvent;
|
366 |
+
// Make sure the progress event properties get copied over:
|
367 |
+
e.lengthComputable = oe.lengthComputable;
|
368 |
+
e.loaded = oe.loaded;
|
369 |
+
e.total = oe.total;
|
370 |
+
that._onProgress(e, options);
|
371 |
+
});
|
372 |
+
options.xhr = function () {
|
373 |
+
return xhr;
|
374 |
+
};
|
375 |
+
}
|
376 |
+
},
|
377 |
+
|
378 |
+
_isInstanceOf: function (type, obj) {
|
379 |
+
// Cross-frame instanceof check
|
380 |
+
return Object.prototype.toString.call(obj) === '[object ' + type + ']';
|
381 |
+
},
|
382 |
+
|
383 |
+
_initXHRData: function (options) {
|
384 |
+
var that = this,
|
385 |
+
formData,
|
386 |
+
file = options.files[0],
|
387 |
+
// Ignore non-multipart setting if not supported:
|
388 |
+
multipart = options.multipart || !$.support.xhrFileUpload,
|
389 |
+
paramName = options.paramName[0];
|
390 |
+
options.headers = options.headers || {};
|
391 |
+
if (options.contentRange) {
|
392 |
+
options.headers['Content-Range'] = options.contentRange;
|
393 |
+
}
|
394 |
+
if (!multipart || options.blob || !this._isInstanceOf('File', file)) {
|
395 |
+
options.headers['Content-Disposition'] = 'attachment; filename="' +
|
396 |
+
encodeURI(file.name) + '"';
|
397 |
+
}
|
398 |
+
if (!multipart) {
|
399 |
+
options.contentType = file.type;
|
400 |
+
options.data = options.blob || file;
|
401 |
+
} else if ($.support.xhrFormDataFileUpload) {
|
402 |
+
if (options.postMessage) {
|
403 |
+
// window.postMessage does not allow sending FormData
|
404 |
+
// objects, so we just add the File/Blob objects to
|
405 |
+
// the formData array and let the postMessage window
|
406 |
+
// create the FormData object out of this array:
|
407 |
+
formData = this._getFormData(options);
|
408 |
+
if (options.blob) {
|
409 |
+
formData.push({
|
410 |
+
name: paramName,
|
411 |
+
value: options.blob
|
412 |
+
});
|
413 |
+
} else {
|
414 |
+
$.each(options.files, function (index, file) {
|
415 |
+
formData.push({
|
416 |
+
name: options.paramName[index] || paramName,
|
417 |
+
value: file
|
418 |
+
});
|
419 |
+
});
|
420 |
+
}
|
421 |
+
} else {
|
422 |
+
if (that._isInstanceOf('FormData', options.formData)) {
|
423 |
+
formData = options.formData;
|
424 |
+
} else {
|
425 |
+
formData = new FormData();
|
426 |
+
$.each(this._getFormData(options), function (index, field) {
|
427 |
+
formData.append(field.name, field.value);
|
428 |
+
});
|
429 |
+
}
|
430 |
+
if (options.blob) {
|
431 |
+
formData.append(paramName, options.blob, file.name);
|
432 |
+
} else {
|
433 |
+
$.each(options.files, function (index, file) {
|
434 |
+
// This check allows the tests to run with
|
435 |
+
// dummy objects:
|
436 |
+
if (that._isInstanceOf('File', file) ||
|
437 |
+
that._isInstanceOf('Blob', file)) {
|
438 |
+
formData.append(
|
439 |
+
options.paramName[index] || paramName,
|
440 |
+
file,
|
441 |
+
file.name
|
442 |
+
);
|
443 |
+
}
|
444 |
+
});
|
445 |
+
}
|
446 |
+
}
|
447 |
+
options.data = formData;
|
448 |
+
}
|
449 |
+
// Blob reference is not needed anymore, free memory:
|
450 |
+
options.blob = null;
|
451 |
+
},
|
452 |
+
|
453 |
+
_initIframeSettings: function (options) {
|
454 |
+
var targetHost = $('<a></a>').prop('href', options.url).prop('host');
|
455 |
+
// Setting the dataType to iframe enables the iframe transport:
|
456 |
+
options.dataType = 'iframe ' + (options.dataType || '');
|
457 |
+
// The iframe transport accepts a serialized array as form data:
|
458 |
+
options.formData = this._getFormData(options);
|
459 |
+
// Add redirect url to form data on cross-domain uploads:
|
460 |
+
if (options.redirect && targetHost && targetHost !== location.host) {
|
461 |
+
options.formData.push({
|
462 |
+
name: options.redirectParamName || 'redirect',
|
463 |
+
value: options.redirect
|
464 |
+
});
|
465 |
+
}
|
466 |
+
},
|
467 |
+
|
468 |
+
_initDataSettings: function (options) {
|
469 |
+
if (this._isXHRUpload(options)) {
|
470 |
+
if (!this._chunkedUpload(options, true)) {
|
471 |
+
if (!options.data) {
|
472 |
+
this._initXHRData(options);
|
473 |
+
}
|
474 |
+
this._initProgressListener(options);
|
475 |
+
}
|
476 |
+
if (options.postMessage) {
|
477 |
+
// Setting the dataType to postmessage enables the
|
478 |
+
// postMessage transport:
|
479 |
+
options.dataType = 'postmessage ' + (options.dataType || '');
|
480 |
+
}
|
481 |
+
} else {
|
482 |
+
this._initIframeSettings(options);
|
483 |
+
}
|
484 |
+
},
|
485 |
+
|
486 |
+
_getParamName: function (options) {
|
487 |
+
var fileInput = $(options.fileInput),
|
488 |
+
paramName = options.paramName;
|
489 |
+
if (!paramName) {
|
490 |
+
paramName = [];
|
491 |
+
fileInput.each(function () {
|
492 |
+
var input = $(this),
|
493 |
+
name = input.prop('name') || 'files[]',
|
494 |
+
i = (input.prop('files') || [1]).length;
|
495 |
+
while (i) {
|
496 |
+
paramName.push(name);
|
497 |
+
i -= 1;
|
498 |
+
}
|
499 |
+
});
|
500 |
+
if (!paramName.length) {
|
501 |
+
paramName = [fileInput.prop('name') || 'files[]'];
|
502 |
+
}
|
503 |
+
} else if (!$.isArray(paramName)) {
|
504 |
+
paramName = [paramName];
|
505 |
+
}
|
506 |
+
return paramName;
|
507 |
+
},
|
508 |
+
|
509 |
+
_initFormSettings: function (options) {
|
510 |
+
// Retrieve missing options from the input field and the
|
511 |
+
// associated form, if available:
|
512 |
+
if (!options.form || !options.form.length) {
|
513 |
+
options.form = $(options.fileInput.prop('form'));
|
514 |
+
// If the given file input doesn't have an associated form,
|
515 |
+
// use the default widget file input's form:
|
516 |
+
if (!options.form.length) {
|
517 |
+
options.form = $(this.options.fileInput.prop('form'));
|
518 |
+
}
|
519 |
+
}
|
520 |
+
options.paramName = this._getParamName(options);
|
521 |
+
if (!options.url) {
|
522 |
+
options.url = options.form.prop('action') || location.href;
|
523 |
+
}
|
524 |
+
// The HTTP request method must be "POST" or "PUT":
|
525 |
+
options.type = (options.type || options.form.prop('method') || '')
|
526 |
+
.toUpperCase();
|
527 |
+
if (options.type !== 'POST' && options.type !== 'PUT' &&
|
528 |
+
options.type !== 'PATCH') {
|
529 |
+
options.type = 'POST';
|
530 |
+
}
|
531 |
+
if (!options.formAcceptCharset) {
|
532 |
+
options.formAcceptCharset = options.form.attr('accept-charset');
|
533 |
+
}
|
534 |
+
},
|
535 |
+
|
536 |
+
_getAJAXSettings: function (data) {
|
537 |
+
var options = $.extend({}, this.options, data);
|
538 |
+
this._initFormSettings(options);
|
539 |
+
this._initDataSettings(options);
|
540 |
+
return options;
|
541 |
+
},
|
542 |
+
|
543 |
+
// jQuery 1.6 doesn't provide .state(),
|
544 |
+
// while jQuery 1.8+ removed .isRejected() and .isResolved():
|
545 |
+
_getDeferredState: function (deferred) {
|
546 |
+
if (deferred.state) {
|
547 |
+
return deferred.state();
|
548 |
+
}
|
549 |
+
if (deferred.isResolved()) {
|
550 |
+
return 'resolved';
|
551 |
+
}
|
552 |
+
if (deferred.isRejected()) {
|
553 |
+
return 'rejected';
|
554 |
+
}
|
555 |
+
return 'pending';
|
556 |
+
},
|
557 |
+
|
558 |
+
// Maps jqXHR callbacks to the equivalent
|
559 |
+
// methods of the given Promise object:
|
560 |
+
_enhancePromise: function (promise) {
|
561 |
+
promise.success = promise.done;
|
562 |
+
promise.error = promise.fail;
|
563 |
+
promise.complete = promise.always;
|
564 |
+
return promise;
|
565 |
+
},
|
566 |
+
|
567 |
+
// Creates and returns a Promise object enhanced with
|
568 |
+
// the jqXHR methods abort, success, error and complete:
|
569 |
+
_getXHRPromise: function (resolveOrReject, context, args) {
|
570 |
+
var dfd = $.Deferred(),
|
571 |
+
promise = dfd.promise();
|
572 |
+
context = context || this.options.context || promise;
|
573 |
+
if (resolveOrReject === true) {
|
574 |
+
dfd.resolveWith(context, args);
|
575 |
+
} else if (resolveOrReject === false) {
|
576 |
+
dfd.rejectWith(context, args);
|
577 |
+
}
|
578 |
+
promise.abort = dfd.promise;
|
579 |
+
return this._enhancePromise(promise);
|
580 |
+
},
|
581 |
+
|
582 |
+
// Adds convenience methods to the data callback argument:
|
583 |
+
_addConvenienceMethods: function (e, data) {
|
584 |
+
var that = this,
|
585 |
+
getPromise = function (data) {
|
586 |
+
return $.Deferred().resolveWith(that, [data]).promise();
|
587 |
+
};
|
588 |
+
data.process = function (resolveFunc, rejectFunc) {
|
589 |
+
if (resolveFunc || rejectFunc) {
|
590 |
+
data._processQueue = this._processQueue =
|
591 |
+
(this._processQueue || getPromise(this))
|
592 |
+
.pipe(resolveFunc, rejectFunc);
|
593 |
+
}
|
594 |
+
return this._processQueue || getPromise(this);
|
595 |
+
};
|
596 |
+
data.submit = function () {
|
597 |
+
if (this.state() !== 'pending') {
|
598 |
+
data.jqXHR = this.jqXHR =
|
599 |
+
(that._trigger('submit', e, this) !== false) &&
|
600 |
+
that._onSend(e, this);
|
601 |
+
}
|
602 |
+
return this.jqXHR || that._getXHRPromise();
|
603 |
+
};
|
604 |
+
data.abort = function () {
|
605 |
+
if (this.jqXHR) {
|
606 |
+
return this.jqXHR.abort();
|
607 |
+
}
|
608 |
+
return that._getXHRPromise();
|
609 |
+
};
|
610 |
+
data.state = function () {
|
611 |
+
if (this.jqXHR) {
|
612 |
+
return that._getDeferredState(this.jqXHR);
|
613 |
+
}
|
614 |
+
if (this._processQueue) {
|
615 |
+
return that._getDeferredState(this._processQueue);
|
616 |
+
}
|
617 |
+
};
|
618 |
+
data.progress = function () {
|
619 |
+
return this._progress;
|
620 |
+
};
|
621 |
+
data.response = function () {
|
622 |
+
return this._response;
|
623 |
+
};
|
624 |
+
},
|
625 |
+
|
626 |
+
// Parses the Range header from the server response
|
627 |
+
// and returns the uploaded bytes:
|
628 |
+
_getUploadedBytes: function (jqXHR) {
|
629 |
+
var range = jqXHR.getResponseHeader('Range'),
|
630 |
+
parts = range && range.split('-'),
|
631 |
+
upperBytesPos = parts && parts.length > 1 &&
|
632 |
+
parseInt(parts[1], 10);
|
633 |
+
return upperBytesPos && upperBytesPos + 1;
|
634 |
+
},
|
635 |
+
|
636 |
+
// Uploads a file in multiple, sequential requests
|
637 |
+
// by splitting the file up in multiple blob chunks.
|
638 |
+
// If the second parameter is true, only tests if the file
|
639 |
+
// should be uploaded in chunks, but does not invoke any
|
640 |
+
// upload requests:
|
641 |
+
_chunkedUpload: function (options, testOnly) {
|
642 |
+
options.uploadedBytes = options.uploadedBytes || 0;
|
643 |
+
var that = this,
|
644 |
+
file = options.files[0],
|
645 |
+
fs = file.size,
|
646 |
+
ub = options.uploadedBytes,
|
647 |
+
mcs = options.maxChunkSize || fs,
|
648 |
+
slice = this._blobSlice,
|
649 |
+
dfd = $.Deferred(),
|
650 |
+
promise = dfd.promise(),
|
651 |
+
jqXHR,
|
652 |
+
upload;
|
653 |
+
if (!(this._isXHRUpload(options) && slice && (ub || mcs < fs)) ||
|
654 |
+
options.data) {
|
655 |
+
return false;
|
656 |
+
}
|
657 |
+
if (testOnly) {
|
658 |
+
return true;
|
659 |
+
}
|
660 |
+
if (ub >= fs) {
|
661 |
+
file.error = options.i18n('uploadedBytes');
|
662 |
+
return this._getXHRPromise(
|
663 |
+
false,
|
664 |
+
options.context,
|
665 |
+
[null, 'error', file.error]
|
666 |
+
);
|
667 |
+
}
|
668 |
+
// The chunk upload method:
|
669 |
+
upload = function () {
|
670 |
+
// Clone the options object for each chunk upload:
|
671 |
+
var o = $.extend({}, options),
|
672 |
+
currentLoaded = o._progress.loaded;
|
673 |
+
o.blob = slice.call(
|
674 |
+
file,
|
675 |
+
ub,
|
676 |
+
ub + mcs,
|
677 |
+
file.type
|
678 |
+
);
|
679 |
+
// Store the current chunk size, as the blob itself
|
680 |
+
// will be dereferenced after data processing:
|
681 |
+
o.chunkSize = o.blob.size;
|
682 |
+
// Expose the chunk bytes position range:
|
683 |
+
o.contentRange = 'bytes ' + ub + '-' +
|
684 |
+
(ub + o.chunkSize - 1) + '/' + fs;
|
685 |
+
// Process the upload data (the blob and potential form data):
|
686 |
+
that._initXHRData(o);
|
687 |
+
// Add progress listeners for this chunk upload:
|
688 |
+
that._initProgressListener(o);
|
689 |
+
jqXHR = ((that._trigger('chunksend', null, o) !== false && $.ajax(o)) ||
|
690 |
+
that._getXHRPromise(false, o.context))
|
691 |
+
.done(function (result, textStatus, jqXHR) {
|
692 |
+
ub = that._getUploadedBytes(jqXHR) ||
|
693 |
+
(ub + o.chunkSize);
|
694 |
+
// Create a progress event if no final progress event
|
695 |
+
// with loaded equaling total has been triggered
|
696 |
+
// for this chunk:
|
697 |
+
if (currentLoaded + o.chunkSize - o._progress.loaded) {
|
698 |
+
that._onProgress($.Event('progress', {
|
699 |
+
lengthComputable: true,
|
700 |
+
loaded: ub - o.uploadedBytes,
|
701 |
+
total: ub - o.uploadedBytes
|
702 |
+
}), o);
|
703 |
+
}
|
704 |
+
options.uploadedBytes = o.uploadedBytes = ub;
|
705 |
+
o.result = result;
|
706 |
+
o.textStatus = textStatus;
|
707 |
+
o.jqXHR = jqXHR;
|
708 |
+
that._trigger('chunkdone', null, o);
|
709 |
+
that._trigger('chunkalways', null, o);
|
710 |
+
if (ub < fs) {
|
711 |
+
// File upload not yet complete,
|
712 |
+
// continue with the next chunk:
|
713 |
+
upload();
|
714 |
+
} else {
|
715 |
+
dfd.resolveWith(
|
716 |
+
o.context,
|
717 |
+
[result, textStatus, jqXHR]
|
718 |
+
);
|
719 |
+
}
|
720 |
+
})
|
721 |
+
.fail(function (jqXHR, textStatus, errorThrown) {
|
722 |
+
o.jqXHR = jqXHR;
|
723 |
+
o.textStatus = textStatus;
|
724 |
+
o.errorThrown = errorThrown;
|
725 |
+
that._trigger('chunkfail', null, o);
|
726 |
+
that._trigger('chunkalways', null, o);
|
727 |
+
dfd.rejectWith(
|
728 |
+
o.context,
|
729 |
+
[jqXHR, textStatus, errorThrown]
|
730 |
+
);
|
731 |
+
});
|
732 |
+
};
|
733 |
+
this._enhancePromise(promise);
|
734 |
+
promise.abort = function () {
|
735 |
+
return jqXHR.abort();
|
736 |
+
};
|
737 |
+
upload();
|
738 |
+
return promise;
|
739 |
+
},
|
740 |
+
|
741 |
+
_beforeSend: function (e, data) {
|
742 |
+
if (this._active === 0) {
|
743 |
+
// the start callback is triggered when an upload starts
|
744 |
+
// and no other uploads are currently running,
|
745 |
+
// equivalent to the global ajaxStart event:
|
746 |
+
this._trigger('start');
|
747 |
+
// Set timer for global bitrate progress calculation:
|
748 |
+
this._bitrateTimer = new this._BitrateTimer();
|
749 |
+
// Reset the global progress values:
|
750 |
+
this._progress.loaded = this._progress.total = 0;
|
751 |
+
this._progress.bitrate = 0;
|
752 |
+
}
|
753 |
+
// Make sure the container objects for the .response() and
|
754 |
+
// .progress() methods on the data object are available
|
755 |
+
// and reset to their initial state:
|
756 |
+
this._initResponseObject(data);
|
757 |
+
this._initProgressObject(data);
|
758 |
+
data._progress.loaded = data.loaded = data.uploadedBytes || 0;
|
759 |
+
data._progress.total = data.total = this._getTotal(data.files) || 1;
|
760 |
+
data._progress.bitrate = data.bitrate = 0;
|
761 |
+
this._active += 1;
|
762 |
+
// Initialize the global progress values:
|
763 |
+
this._progress.loaded += data.loaded;
|
764 |
+
this._progress.total += data.total;
|
765 |
+
},
|
766 |
+
|
767 |
+
_onDone: function (result, textStatus, jqXHR, options) {
|
768 |
+
var total = options._progress.total,
|
769 |
+
response = options._response;
|
770 |
+
if (options._progress.loaded < total) {
|
771 |
+
// Create a progress event if no final progress event
|
772 |
+
// with loaded equaling total has been triggered:
|
773 |
+
this._onProgress($.Event('progress', {
|
774 |
+
lengthComputable: true,
|
775 |
+
loaded: total,
|
776 |
+
total: total
|
777 |
+
}), options);
|
778 |
+
}
|
779 |
+
response.result = options.result = result;
|
780 |
+
response.textStatus = options.textStatus = textStatus;
|
781 |
+
response.jqXHR = options.jqXHR = jqXHR;
|
782 |
+
this._trigger('done', null, options);
|
783 |
+
},
|
784 |
+
|
785 |
+
_onFail: function (jqXHR, textStatus, errorThrown, options) {
|
786 |
+
var response = options._response;
|
787 |
+
if (options.recalculateProgress) {
|
788 |
+
// Remove the failed (error or abort) file upload from
|
789 |
+
// the global progress calculation:
|
790 |
+
this._progress.loaded -= options._progress.loaded;
|
791 |
+
this._progress.total -= options._progress.total;
|
792 |
+
}
|
793 |
+
response.jqXHR = options.jqXHR = jqXHR;
|
794 |
+
response.textStatus = options.textStatus = textStatus;
|
795 |
+
response.errorThrown = options.errorThrown = errorThrown;
|
796 |
+
this._trigger('fail', null, options);
|
797 |
+
},
|
798 |
+
|
799 |
+
_onAlways: function (jqXHRorResult, textStatus, jqXHRorError, options) {
|
800 |
+
// jqXHRorResult, textStatus and jqXHRorError are added to the
|
801 |
+
// options object via done and fail callbacks
|
802 |
+
this._trigger('always', null, options);
|
803 |
+
},
|
804 |
+
|
805 |
+
_onSend: function (e, data) {
|
806 |
+
if (!data.submit) {
|
807 |
+
this._addConvenienceMethods(e, data);
|
808 |
+
}
|
809 |
+
var that = this,
|
810 |
+
jqXHR,
|
811 |
+
aborted,
|
812 |
+
slot,
|
813 |
+
pipe,
|
814 |
+
options = that._getAJAXSettings(data),
|
815 |
+
send = function () {
|
816 |
+
that._sending += 1;
|
817 |
+
// Set timer for bitrate progress calculation:
|
818 |
+
options._bitrateTimer = new that._BitrateTimer();
|
819 |
+
jqXHR = jqXHR || (
|
820 |
+
((aborted || that._trigger('send', e, options) === false) &&
|
821 |
+
that._getXHRPromise(false, options.context, aborted)) ||
|
822 |
+
that._chunkedUpload(options) || $.ajax(options)
|
823 |
+
).done(function (result, textStatus, jqXHR) {
|
824 |
+
that._onDone(result, textStatus, jqXHR, options);
|
825 |
+
}).fail(function (jqXHR, textStatus, errorThrown) {
|
826 |
+
that._onFail(jqXHR, textStatus, errorThrown, options);
|
827 |
+
}).always(function (jqXHRorResult, textStatus, jqXHRorError) {
|
828 |
+
that._onAlways(
|
829 |
+
jqXHRorResult,
|
830 |
+
textStatus,
|
831 |
+
jqXHRorError,
|
832 |
+
options
|
833 |
+
);
|
834 |
+
that._sending -= 1;
|
835 |
+
that._active -= 1;
|
836 |
+
if (options.limitConcurrentUploads &&
|
837 |
+
options.limitConcurrentUploads > that._sending) {
|
838 |
+
// Start the next queued upload,
|
839 |
+
// that has not been aborted:
|
840 |
+
var nextSlot = that._slots.shift();
|
841 |
+
while (nextSlot) {
|
842 |
+
if (that._getDeferredState(nextSlot) === 'pending') {
|
843 |
+
nextSlot.resolve();
|
844 |
+
break;
|
845 |
+
}
|
846 |
+
nextSlot = that._slots.shift();
|
847 |
+
}
|
848 |
+
}
|
849 |
+
if (that._active === 0) {
|
850 |
+
// The stop callback is triggered when all uploads have
|
851 |
+
// been completed, equivalent to the global ajaxStop event:
|
852 |
+
that._trigger('stop');
|
853 |
+
}
|
854 |
+
});
|
855 |
+
return jqXHR;
|
856 |
+
};
|
857 |
+
this._beforeSend(e, options);
|
858 |
+
if (this.options.sequentialUploads ||
|
859 |
+
(this.options.limitConcurrentUploads &&
|
860 |
+
this.options.limitConcurrentUploads <= this._sending)) {
|
861 |
+
if (this.options.limitConcurrentUploads > 1) {
|
862 |
+
slot = $.Deferred();
|
863 |
+
this._slots.push(slot);
|
864 |
+
pipe = slot.pipe(send);
|
865 |
+
} else {
|
866 |
+
this._sequence = this._sequence.pipe(send, send);
|
867 |
+
pipe = this._sequence;
|
868 |
+
}
|
869 |
+
// Return the piped Promise object, enhanced with an abort method,
|
870 |
+
// which is delegated to the jqXHR object of the current upload,
|
871 |
+
// and jqXHR callbacks mapped to the equivalent Promise methods:
|
872 |
+
pipe.abort = function () {
|
873 |
+
aborted = [undefined, 'abort', 'abort'];
|
874 |
+
if (!jqXHR) {
|
875 |
+
if (slot) {
|
876 |
+
slot.rejectWith(options.context, aborted);
|
877 |
+
}
|
878 |
+
return send();
|
879 |
+
}
|
880 |
+
return jqXHR.abort();
|
881 |
+
};
|
882 |
+
return this._enhancePromise(pipe);
|
883 |
+
}
|
884 |
+
return send();
|
885 |
+
},
|
886 |
+
|
887 |
+
_onAdd: function (e, data) {
|
888 |
+
var that = this,
|
889 |
+
result = true,
|
890 |
+
options = $.extend({}, this.options, data),
|
891 |
+
limit = options.limitMultiFileUploads,
|
892 |
+
paramName = this._getParamName(options),
|
893 |
+
paramNameSet,
|
894 |
+
paramNameSlice,
|
895 |
+
fileSet,
|
896 |
+
i;
|
897 |
+
if (!(options.singleFileUploads || limit) ||
|
898 |
+
!this._isXHRUpload(options)) {
|
899 |
+
fileSet = [data.files];
|
900 |
+
paramNameSet = [paramName];
|
901 |
+
} else if (!options.singleFileUploads && limit) {
|
902 |
+
fileSet = [];
|
903 |
+
paramNameSet = [];
|
904 |
+
for (i = 0; i < data.files.length; i += limit) {
|
905 |
+
fileSet.push(data.files.slice(i, i + limit));
|
906 |
+
paramNameSlice = paramName.slice(i, i + limit);
|
907 |
+
if (!paramNameSlice.length) {
|
908 |
+
paramNameSlice = paramName;
|
909 |
+
}
|
910 |
+
paramNameSet.push(paramNameSlice);
|
911 |
+
}
|
912 |
+
} else {
|
913 |
+
paramNameSet = paramName;
|
914 |
+
}
|
915 |
+
data.originalFiles = data.files;
|
916 |
+
$.each(fileSet || data.files, function (index, element) {
|
917 |
+
var newData = $.extend({}, data);
|
918 |
+
newData.files = fileSet ? element : [element];
|
919 |
+
newData.paramName = paramNameSet[index];
|
920 |
+
that._initResponseObject(newData);
|
921 |
+
that._initProgressObject(newData);
|
922 |
+
that._addConvenienceMethods(e, newData);
|
923 |
+
result = that._trigger('add', e, newData);
|
924 |
+
return result;
|
925 |
+
});
|
926 |
+
return result;
|
927 |
+
},
|
928 |
+
|
929 |
+
_replaceFileInput: function (input) {
|
930 |
+
var inputClone = input.clone(true);
|
931 |
+
$('<form></form>').append(inputClone)[0].reset();
|
932 |
+
// Detaching allows to insert the fileInput on another form
|
933 |
+
// without loosing the file input value:
|
934 |
+
input.after(inputClone).detach();
|
935 |
+
// Avoid memory leaks with the detached file input:
|
936 |
+
$.cleanData(input.unbind('remove'));
|
937 |
+
// Replace the original file input element in the fileInput
|
938 |
+
// elements set with the clone, which has been copied including
|
939 |
+
// event handlers:
|
940 |
+
this.options.fileInput = this.options.fileInput.map(function (i, el) {
|
941 |
+
if (el === input[0]) {
|
942 |
+
return inputClone[0];
|
943 |
+
}
|
944 |
+
return el;
|
945 |
+
});
|
946 |
+
// If the widget has been initialized on the file input itself,
|
947 |
+
// override this.element with the file input clone:
|
948 |
+
if (input[0] === this.element[0]) {
|
949 |
+
this.element = inputClone;
|
950 |
+
}
|
951 |
+
},
|
952 |
+
|
953 |
+
_handleFileTreeEntry: function (entry, path) {
|
954 |
+
var that = this,
|
955 |
+
dfd = $.Deferred(),
|
956 |
+
errorHandler = function (e) {
|
957 |
+
if (e && !e.entry) {
|
958 |
+
e.entry = entry;
|
959 |
+
}
|
960 |
+
// Since $.when returns immediately if one
|
961 |
+
// Deferred is rejected, we use resolve instead.
|
962 |
+
// This allows valid files and invalid items
|
963 |
+
// to be returned together in one set:
|
964 |
+
dfd.resolve([e]);
|
965 |
+
},
|
966 |
+
dirReader;
|
967 |
+
path = path || '';
|
968 |
+
if (entry.isFile) {
|
969 |
+
if (entry._file) {
|
970 |
+
// Workaround for Chrome bug #149735
|
971 |
+
entry._file.relativePath = path;
|
972 |
+
dfd.resolve(entry._file);
|
973 |
+
} else {
|
974 |
+
entry.file(function (file) {
|
975 |
+
file.relativePath = path;
|
976 |
+
dfd.resolve(file);
|
977 |
+
}, errorHandler);
|
978 |
+
}
|
979 |
+
} else if (entry.isDirectory) {
|
980 |
+
dirReader = entry.createReader();
|
981 |
+
dirReader.readEntries(function (entries) {
|
982 |
+
that._handleFileTreeEntries(
|
983 |
+
entries,
|
984 |
+
path + entry.name + '/'
|
985 |
+
).done(function (files) {
|
986 |
+
dfd.resolve(files);
|
987 |
+
}).fail(errorHandler);
|
988 |
+
}, errorHandler);
|
989 |
+
} else {
|
990 |
+
// Return an empy list for file system items
|
991 |
+
// other than files or directories:
|
992 |
+
dfd.resolve([]);
|
993 |
+
}
|
994 |
+
return dfd.promise();
|
995 |
+
},
|
996 |
+
|
997 |
+
_handleFileTreeEntries: function (entries, path) {
|
998 |
+
var that = this;
|
999 |
+
return $.when.apply(
|
1000 |
+
$,
|
1001 |
+
$.map(entries, function (entry) {
|
1002 |
+
return that._handleFileTreeEntry(entry, path);
|
1003 |
+
})
|
1004 |
+
).pipe(function () {
|
1005 |
+
return Array.prototype.concat.apply(
|
1006 |
+
[],
|
1007 |
+
arguments
|
1008 |
+
);
|
1009 |
+
});
|
1010 |
+
},
|
1011 |
+
|
1012 |
+
_getDroppedFiles: function (dataTransfer) {
|
1013 |
+
dataTransfer = dataTransfer || {};
|
1014 |
+
var items = dataTransfer.items;
|
1015 |
+
if (items && items.length && (items[0].webkitGetAsEntry ||
|
1016 |
+
items[0].getAsEntry)) {
|
1017 |
+
return this._handleFileTreeEntries(
|
1018 |
+
$.map(items, function (item) {
|
1019 |
+
var entry;
|
1020 |
+
if (item.webkitGetAsEntry) {
|
1021 |
+
entry = item.webkitGetAsEntry();
|
1022 |
+
if (entry) {
|
1023 |
+
// Workaround for Chrome bug #149735:
|
1024 |
+
entry._file = item.getAsFile();
|
1025 |
+
}
|
1026 |
+
return entry;
|
1027 |
+
}
|
1028 |
+
return item.getAsEntry();
|
1029 |
+
})
|
1030 |
+
);
|
1031 |
+
}
|
1032 |
+
return $.Deferred().resolve(
|
1033 |
+
$.makeArray(dataTransfer.files)
|
1034 |
+
).promise();
|
1035 |
+
},
|
1036 |
+
|
1037 |
+
_getSingleFileInputFiles: function (fileInput) {
|
1038 |
+
fileInput = $(fileInput);
|
1039 |
+
var entries = fileInput.prop('webkitEntries') ||
|
1040 |
+
fileInput.prop('entries'),
|
1041 |
+
files,
|
1042 |
+
value;
|
1043 |
+
if (entries && entries.length) {
|
1044 |
+
return this._handleFileTreeEntries(entries);
|
1045 |
+
}
|
1046 |
+
files = $.makeArray(fileInput.prop('files'));
|
1047 |
+
if (!files.length) {
|
1048 |
+
value = fileInput.prop('value');
|
1049 |
+
if (!value) {
|
1050 |
+
return $.Deferred().resolve([]).promise();
|
1051 |
+
}
|
1052 |
+
// If the files property is not available, the browser does not
|
1053 |
+
// support the File API and we add a pseudo File object with
|
1054 |
+
// the input value as name with path information removed:
|
1055 |
+
files = [{name: value.replace(/^.*\\/, '')}];
|
1056 |
+
} else if (files[0].name === undefined && files[0].fileName) {
|
1057 |
+
// File normalization for Safari 4 and Firefox 3:
|
1058 |
+
$.each(files, function (index, file) {
|
1059 |
+
file.name = file.fileName;
|
1060 |
+
file.size = file.fileSize;
|
1061 |
+
});
|
1062 |
+
}
|
1063 |
+
return $.Deferred().resolve(files).promise();
|
1064 |
+
},
|
1065 |
+
|
1066 |
+
_getFileInputFiles: function (fileInput) {
|
1067 |
+
if (!(fileInput instanceof $) || fileInput.length === 1) {
|
1068 |
+
return this._getSingleFileInputFiles(fileInput);
|
1069 |
+
}
|
1070 |
+
return $.when.apply(
|
1071 |
+
$,
|
1072 |
+
$.map(fileInput, this._getSingleFileInputFiles)
|
1073 |
+
).pipe(function () {
|
1074 |
+
return Array.prototype.concat.apply(
|
1075 |
+
[],
|
1076 |
+
arguments
|
1077 |
+
);
|
1078 |
+
});
|
1079 |
+
},
|
1080 |
+
|
1081 |
+
_onChange: function (e) {
|
1082 |
+
var that = this,
|
1083 |
+
data = {
|
1084 |
+
fileInput: $(e.target),
|
1085 |
+
form: $(e.target.form)
|
1086 |
+
};
|
1087 |
+
this._getFileInputFiles(data.fileInput).always(function (files) {
|
1088 |
+
data.files = files;
|
1089 |
+
if (that.options.replaceFileInput) {
|
1090 |
+
that._replaceFileInput(data.fileInput);
|
1091 |
+
}
|
1092 |
+
if (that._trigger('change', e, data) !== false) {
|
1093 |
+
that._onAdd(e, data);
|
1094 |
+
}
|
1095 |
+
});
|
1096 |
+
},
|
1097 |
+
|
1098 |
+
_onPaste: function (e) {
|
1099 |
+
var items = e.originalEvent && e.originalEvent.clipboardData &&
|
1100 |
+
e.originalEvent.clipboardData.items,
|
1101 |
+
data = {files: []};
|
1102 |
+
if (items && items.length) {
|
1103 |
+
$.each(items, function (index, item) {
|
1104 |
+
var file = item.getAsFile && item.getAsFile();
|
1105 |
+
if (file) {
|
1106 |
+
data.files.push(file);
|
1107 |
+
}
|
1108 |
+
});
|
1109 |
+
if (this._trigger('paste', e, data) === false ||
|
1110 |
+
this._onAdd(e, data) === false) {
|
1111 |
+
return false;
|
1112 |
+
}
|
1113 |
+
}
|
1114 |
+
},
|
1115 |
+
|
1116 |
+
_onDrop: function (e) {
|
1117 |
+
e.dataTransfer = e.originalEvent && e.originalEvent.dataTransfer;
|
1118 |
+
var that = this,
|
1119 |
+
dataTransfer = e.dataTransfer,
|
1120 |
+
data = {};
|
1121 |
+
if (dataTransfer && dataTransfer.files && dataTransfer.files.length) {
|
1122 |
+
e.preventDefault();
|
1123 |
+
this._getDroppedFiles(dataTransfer).always(function (files) {
|
1124 |
+
data.files = files;
|
1125 |
+
if (that._trigger('drop', e, data) !== false) {
|
1126 |
+
that._onAdd(e, data);
|
1127 |
+
}
|
1128 |
+
});
|
1129 |
+
}
|
1130 |
+
},
|
1131 |
+
|
1132 |
+
_onDragOver: function (e) {
|
1133 |
+
e.dataTransfer = e.originalEvent && e.originalEvent.dataTransfer;
|
1134 |
+
var dataTransfer = e.dataTransfer;
|
1135 |
+
if (dataTransfer) {
|
1136 |
+
if (this._trigger('dragover', e) === false) {
|
1137 |
+
return false;
|
1138 |
+
}
|
1139 |
+
if ($.inArray('Files', dataTransfer.types) !== -1) {
|
1140 |
+
dataTransfer.dropEffect = 'copy';
|
1141 |
+
e.preventDefault();
|
1142 |
+
}
|
1143 |
+
}
|
1144 |
+
},
|
1145 |
+
|
1146 |
+
_initEventHandlers: function () {
|
1147 |
+
if (this._isXHRUpload(this.options)) {
|
1148 |
+
this._on(this.options.dropZone, {
|
1149 |
+
dragover: this._onDragOver,
|
1150 |
+
drop: this._onDrop
|
1151 |
+
});
|
1152 |
+
this._on(this.options.pasteZone, {
|
1153 |
+
paste: this._onPaste
|
1154 |
+
});
|
1155 |
+
}
|
1156 |
+
this._on(this.options.fileInput, {
|
1157 |
+
change: this._onChange
|
1158 |
+
});
|
1159 |
+
},
|
1160 |
+
|
1161 |
+
_destroyEventHandlers: function () {
|
1162 |
+
this._off(this.options.dropZone, 'dragover drop');
|
1163 |
+
this._off(this.options.pasteZone, 'paste');
|
1164 |
+
this._off(this.options.fileInput, 'change');
|
1165 |
+
},
|
1166 |
+
|
1167 |
+
_setOption: function (key, value) {
|
1168 |
+
var reinit = $.inArray(key, this._specialOptions) !== -1;
|
1169 |
+
if (reinit) {
|
1170 |
+
this._destroyEventHandlers();
|
1171 |
+
}
|
1172 |
+
this._super(key, value);
|
1173 |
+
if (reinit) {
|
1174 |
+
this._initSpecialOptions();
|
1175 |
+
this._initEventHandlers();
|
1176 |
+
}
|
1177 |
+
},
|
1178 |
+
|
1179 |
+
_initSpecialOptions: function () {
|
1180 |
+
var options = this.options;
|
1181 |
+
if (options.fileInput === undefined) {
|
1182 |
+
options.fileInput = this.element.is('input[type="file"]') ?
|
1183 |
+
this.element : this.element.find('input[type="file"]');
|
1184 |
+
} else if (!(options.fileInput instanceof $)) {
|
1185 |
+
options.fileInput = $(options.fileInput);
|
1186 |
+
}
|
1187 |
+
if (!(options.dropZone instanceof $)) {
|
1188 |
+
options.dropZone = $(options.dropZone);
|
1189 |
+
}
|
1190 |
+
if (!(options.pasteZone instanceof $)) {
|
1191 |
+
options.pasteZone = $(options.pasteZone);
|
1192 |
+
}
|
1193 |
+
},
|
1194 |
+
|
1195 |
+
_getRegExp: function (str) {
|
1196 |
+
var parts = str.split('/'),
|
1197 |
+
modifiers = parts.pop();
|
1198 |
+
parts.shift();
|
1199 |
+
return new RegExp(parts.join('/'), modifiers);
|
1200 |
+
},
|
1201 |
+
|
1202 |
+
_isRegExpOption: function (key, value) {
|
1203 |
+
return key !== 'url' && $.type(value) === 'string' &&
|
1204 |
+
/^\/.*\/[igm]{0,3}$/.test(value);
|
1205 |
+
},
|
1206 |
+
|
1207 |
+
_initDataAttributes: function () {
|
1208 |
+
var that = this,
|
1209 |
+
options = this.options;
|
1210 |
+
// Initialize options set via HTML5 data-attributes:
|
1211 |
+
$.each(
|
1212 |
+
$(this.element[0].cloneNode(false)).data(),
|
1213 |
+
function (key, value) {
|
1214 |
+
if (that._isRegExpOption(key, value)) {
|
1215 |
+
value = that._getRegExp(value);
|
1216 |
+
}
|
1217 |
+
options[key] = value;
|
1218 |
+
}
|
1219 |
+
);
|
1220 |
+
},
|
1221 |
+
|
1222 |
+
_create: function () {
|
1223 |
+
this._initDataAttributes();
|
1224 |
+
this._initSpecialOptions();
|
1225 |
+
this._slots = [];
|
1226 |
+
this._sequence = this._getXHRPromise(true);
|
1227 |
+
this._sending = this._active = 0;
|
1228 |
+
this._initProgressObject(this);
|
1229 |
+
this._initEventHandlers();
|
1230 |
+
},
|
1231 |
+
|
1232 |
+
// This method is exposed to the widget API and allows to query
|
1233 |
+
// the number of active uploads:
|
1234 |
+
active: function () {
|
1235 |
+
return this._active;
|
1236 |
+
},
|
1237 |
+
|
1238 |
+
// This method is exposed to the widget API and allows to query
|
1239 |
+
// the widget upload progress.
|
1240 |
+
// It returns an object with loaded, total and bitrate properties
|
1241 |
+
// for the running uploads:
|
1242 |
+
progress: function () {
|
1243 |
+
return this._progress;
|
1244 |
+
},
|
1245 |
+
|
1246 |
+
// This method is exposed to the widget API and allows adding files
|
1247 |
+
// using the fileupload API. The data parameter accepts an object which
|
1248 |
+
// must have a files property and can contain additional options:
|
1249 |
+
// .fileupload('add', {files: filesList});
|
1250 |
+
add: function (data) {
|
1251 |
+
var that = this;
|
1252 |
+
if (!data || this.options.disabled) {
|
1253 |
+
return;
|
1254 |
+
}
|
1255 |
+
if (data.fileInput && !data.files) {
|
1256 |
+
this._getFileInputFiles(data.fileInput).always(function (files) {
|
1257 |
+
data.files = files;
|
1258 |
+
that._onAdd(null, data);
|
1259 |
+
});
|
1260 |
+
} else {
|
1261 |
+
data.files = $.makeArray(data.files);
|
1262 |
+
this._onAdd(null, data);
|
1263 |
+
}
|
1264 |
+
},
|
1265 |
+
|
1266 |
+
// This method is exposed to the widget API and allows sending files
|
1267 |
+
// using the fileupload API. The data parameter accepts an object which
|
1268 |
+
// must have a files or fileInput property and can contain additional options:
|
1269 |
+
// .fileupload('send', {files: filesList});
|
1270 |
+
// The method returns a Promise object for the file upload call.
|
1271 |
+
send: function (data) {
|
1272 |
+
if (data && !this.options.disabled) {
|
1273 |
+
if (data.fileInput && !data.files) {
|
1274 |
+
var that = this,
|
1275 |
+
dfd = $.Deferred(),
|
1276 |
+
promise = dfd.promise(),
|
1277 |
+
jqXHR,
|
1278 |
+
aborted;
|
1279 |
+
promise.abort = function () {
|
1280 |
+
aborted = true;
|
1281 |
+
if (jqXHR) {
|
1282 |
+
return jqXHR.abort();
|
1283 |
+
}
|
1284 |
+
dfd.reject(null, 'abort', 'abort');
|
1285 |
+
return promise;
|
1286 |
+
};
|
1287 |
+
this._getFileInputFiles(data.fileInput).always(
|
1288 |
+
function (files) {
|
1289 |
+
if (aborted) {
|
1290 |
+
return;
|
1291 |
+
}
|
1292 |
+
data.files = files;
|
1293 |
+
jqXHR = that._onSend(null, data).then(
|
1294 |
+
function (result, textStatus, jqXHR) {
|
1295 |
+
dfd.resolve(result, textStatus, jqXHR);
|
1296 |
+
},
|
1297 |
+
function (jqXHR, textStatus, errorThrown) {
|
1298 |
+
dfd.reject(jqXHR, textStatus, errorThrown);
|
1299 |
+
}
|
1300 |
+
);
|
1301 |
+
}
|
1302 |
+
);
|
1303 |
+
return this._enhancePromise(promise);
|
1304 |
+
}
|
1305 |
+
data.files = $.makeArray(data.files);
|
1306 |
+
if (data.files.length) {
|
1307 |
+
return this._onSend(null, data);
|
1308 |
+
}
|
1309 |
+
}
|
1310 |
+
return this._getXHRPromise(false, data && data.context);
|
1311 |
+
}
|
1312 |
+
|
1313 |
+
});
|
1314 |
+
|
1315 |
+
}));
|
assets/js/form.js
CHANGED
@@ -1,815 +1,815 @@
|
|
1 |
-
/*!
|
2 |
-
* jQuery Form Plugin
|
3 |
-
* version: 2.69 (06-APR-2011)
|
4 |
-
* @requires jQuery v1.3.2 or later
|
5 |
-
*
|
6 |
-
* Examples and documentation at: http://malsup.com/jquery/form/
|
7 |
-
* Dual licensed under the MIT and GPL licenses:
|
8 |
-
* http://www.opensource.org/licenses/mit-license.php
|
9 |
-
* http://www.gnu.org/licenses/gpl.html
|
10 |
-
*/
|
11 |
-
;(function($) {
|
12 |
-
|
13 |
-
/*
|
14 |
-
Usage Note:
|
15 |
-
-----------
|
16 |
-
Do not use both ajaxSubmit and ajaxForm on the same form. These
|
17 |
-
functions are intended to be exclusive. Use ajaxSubmit if you want
|
18 |
-
to bind your own submit handler to the form. For example,
|
19 |
-
|
20 |
-
$(document).ready(function() {
|
21 |
-
$('#myForm').bind('submit', function(e) {
|
22 |
-
e.preventDefault(); // <-- important
|
23 |
-
$(this).ajaxSubmit({
|
24 |
-
target: '#output'
|
25 |
-
});
|
26 |
-
});
|
27 |
-
});
|
28 |
-
|
29 |
-
Use ajaxForm when you want the plugin to manage all the event binding
|
30 |
-
for you. For example,
|
31 |
-
|
32 |
-
$(document).ready(function() {
|
33 |
-
$('#myForm').ajaxForm({
|
34 |
-
target: '#output'
|
35 |
-
});
|
36 |
-
});
|
37 |
-
|
38 |
-
When using ajaxForm, the ajaxSubmit function will be invoked for you
|
39 |
-
at the appropriate time.
|
40 |
-
*/
|
41 |
-
|
42 |
-
/**
|
43 |
-
* ajaxSubmit() provides a mechanism for immediately submitting
|
44 |
-
* an HTML form using AJAX.
|
45 |
-
*/
|
46 |
-
$.fn.ajaxSubmit = function(options) {
|
47 |
-
// fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
|
48 |
-
if (!this.length) {
|
49 |
-
log('ajaxSubmit: skipping submit process - no element selected');
|
50 |
-
return this;
|
51 |
-
}
|
52 |
-
|
53 |
-
if (typeof options == 'function') {
|
54 |
-
options = { success: options };
|
55 |
-
}
|
56 |
-
|
57 |
-
var action = this.attr('action');
|
58 |
-
var url = (typeof action === 'string') ? $.trim(action) : '';
|
59 |
-
if (url) {
|
60 |
-
// clean url (don't include hash vaue)
|
61 |
-
url = (url.match(/^([^#]+)/)||[])[1];
|
62 |
-
}
|
63 |
-
url = url || window.location.href || '';
|
64 |
-
|
65 |
-
options = $.extend(true, {
|
66 |
-
url: url,
|
67 |
-
success: $.ajaxSettings.success,
|
68 |
-
type: this[0].getAttribute('method') || 'GET', // IE7 massage (see issue 57)
|
69 |
-
iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank'
|
70 |
-
}, options);
|
71 |
-
|
72 |
-
// hook for manipulating the form data before it is extracted;
|
73 |
-
// convenient for use with rich editors like tinyMCE or FCKEditor
|
74 |
-
var veto = {};
|
75 |
-
this.trigger('form-pre-serialize', [this, options, veto]);
|
76 |
-
if (veto.veto) {
|
77 |
-
log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
|
78 |
-
return this;
|
79 |
-
}
|
80 |
-
|
81 |
-
// provide opportunity to alter form data before it is serialized
|
82 |
-
if (options.beforeSerialize && options.beforeSerialize(this, options) === false) {
|
83 |
-
log('ajaxSubmit: submit aborted via beforeSerialize callback');
|
84 |
-
return this;
|
85 |
-
}
|
86 |
-
|
87 |
-
var n,v,a = this.formToArray(options.semantic);
|
88 |
-
if (options.data) {
|
89 |
-
options.extraData = options.data;
|
90 |
-
for (n in options.data) {
|
91 |
-
if(options.data[n] instanceof Array) {
|
92 |
-
for (var k in options.data[n]) {
|
93 |
-
a.push( { name: n, value: options.data[n][k] } );
|
94 |
-
}
|
95 |
-
}
|
96 |
-
else {
|
97 |
-
v = options.data[n];
|
98 |
-
v = $.isFunction(v) ? v() : v; // if value is fn, invoke it
|
99 |
-
a.push( { name: n, value: v } );
|
100 |
-
}
|
101 |
-
}
|
102 |
-
}
|
103 |
-
|
104 |
-
// give pre-submit callback an opportunity to abort the submit
|
105 |
-
if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
|
106 |
-
log('ajaxSubmit: submit aborted via beforeSubmit callback');
|
107 |
-
return this;
|
108 |
-
}
|
109 |
-
|
110 |
-
// fire vetoable 'validate' event
|
111 |
-
this.trigger('form-submit-validate', [a, this, options, veto]);
|
112 |
-
if (veto.veto) {
|
113 |
-
log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
|
114 |
-
return this;
|
115 |
-
}
|
116 |
-
|
117 |
-
var q = $.param(a);
|
118 |
-
|
119 |
-
if (options.type.toUpperCase() == 'GET') {
|
120 |
-
options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
|
121 |
-
options.data = null; // data is null for 'get'
|
122 |
-
}
|
123 |
-
else {
|
124 |
-
options.data = q; // data is the query string for 'post'
|
125 |
-
}
|
126 |
-
|
127 |
-
var $form = this, callbacks = [];
|
128 |
-
if (options.resetForm) {
|
129 |
-
callbacks.push(function() { $form.resetForm(); });
|
130 |
-
}
|
131 |
-
if (options.clearForm) {
|
132 |
-
callbacks.push(function() { $form.clearForm(); });
|
133 |
-
}
|
134 |
-
|
135 |
-
// perform a load on the target only if dataType is not provided
|
136 |
-
if (!options.dataType && options.target) {
|
137 |
-
var oldSuccess = options.success || function(){};
|
138 |
-
callbacks.push(function(data) {
|
139 |
-
var fn = options.replaceTarget ? 'replaceWith' : 'html';
|
140 |
-
$(options.target)[fn](data).each(oldSuccess, arguments);
|
141 |
-
});
|
142 |
-
}
|
143 |
-
else if (options.success) {
|
144 |
-
callbacks.push(options.success);
|
145 |
-
}
|
146 |
-
|
147 |
-
options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg
|
148 |
-
var context = options.context || options; // jQuery 1.4+ supports scope context
|
149 |
-
for (var i=0, max=callbacks.length; i < max; i++) {
|
150 |
-
callbacks[i].apply(context, [data, status, xhr || $form, $form]);
|
151 |
-
}
|
152 |
-
};
|
153 |
-
|
154 |
-
// are there files to upload?
|
155 |
-
var fileInputs = $('input:file', this).length > 0;
|
156 |
-
var mp = 'multipart/form-data';
|
157 |
-
var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp);
|
158 |
-
|
159 |
-
// options.iframe allows user to force iframe mode
|
160 |
-
// 06-NOV-09: now defaulting to iframe mode if file input is detected
|
161 |
-
if (options.iframe !== false && (fileInputs || options.iframe || multipart)) {
|
162 |
-
// hack to fix Safari hang (thanks to Tim Molendijk for this)
|
163 |
-
// see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
|
164 |
-
if (options.closeKeepAlive) {
|
165 |
-
$.get(options.closeKeepAlive, fileUpload);
|
166 |
-
}
|
167 |
-
else {
|
168 |
-
fileUpload();
|
169 |
-
}
|
170 |
-
}
|
171 |
-
else {
|
172 |
-
$.ajax(options);
|
173 |
-
}
|
174 |
-
|
175 |
-
// fire 'notify' event
|
176 |
-
this.trigger('form-submit-notify', [this, options]);
|
177 |
-
return this;
|
178 |
-
|
179 |
-
|
180 |
-
// private function for handling file uploads (hat tip to YAHOO!)
|
181 |
-
function fileUpload() {
|
182 |
-
var form = $form[0];
|
183 |
-
|
184 |
-
if ($(':input[name=submit],:input[id=submit]', form).length) {
|
185 |
-
// if there is an input with a name or id of 'submit' then we won't be
|
186 |
-
// able to invoke the submit fn on the form (at least not x-browser)
|
187 |
-
alert('Error: Form elements must not have name or id of "submit".');
|
188 |
-
return;
|
189 |
-
}
|
190 |
-
|
191 |
-
var s = $.extend(true, {}, $.ajaxSettings, options);
|
192 |
-
s.context = s.context || s;
|
193 |
-
var id = 'jqFormIO' + (new Date().getTime()), fn = '_'+id;
|
194 |
-
var $io = $('<iframe id="' + id + '" name="' + id + '" src="'+ s.iframeSrc +'" />');
|
195 |
-
var io = $io[0];
|
196 |
-
|
197 |
-
$io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
|
198 |
-
|
199 |
-
var xhr = { // mock object
|
200 |
-
aborted: 0,
|
201 |
-
responseText: null,
|
202 |
-
responseXML: null,
|
203 |
-
status: 0,
|
204 |
-
statusText: 'n/a',
|
205 |
-
getAllResponseHeaders: function() {},
|
206 |
-
getResponseHeader: function() {},
|
207 |
-
setRequestHeader: function() {},
|
208 |
-
abort: function() {
|
209 |
-
log('aborting upload...');
|
210 |
-
var e = 'aborted';
|
211 |
-
this.aborted = 1;
|
212 |
-
$io.attr('src', s.iframeSrc); // abort op in progress
|
213 |
-
xhr.error = e;
|
214 |
-
s.error && s.error.call(s.context, xhr, 'error', e);
|
215 |
-
g && $.event.trigger("ajaxError", [xhr, s, e]);
|
216 |
-
s.complete && s.complete.call(s.context, xhr, 'error');
|
217 |
-
}
|
218 |
-
};
|
219 |
-
|
220 |
-
var g = s.global;
|
221 |
-
// trigger ajax global events so that activity/block indicators work like normal
|
222 |
-
if (g && ! $.active++) {
|
223 |
-
$.event.trigger("ajaxStart");
|
224 |
-
}
|
225 |
-
if (g) {
|
226 |
-
$.event.trigger("ajaxSend", [xhr, s]);
|
227 |
-
}
|
228 |
-
|
229 |
-
if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {
|
230 |
-
if (s.global) {
|
231 |
-
$.active--;
|
232 |
-
}
|
233 |
-
return;
|
234 |
-
}
|
235 |
-
if (xhr.aborted) {
|
236 |
-
return;
|
237 |
-
}
|
238 |
-
|
239 |
-
var timedOut = 0;
|
240 |
-
|
241 |
-
// add submitting element to data if we know it
|
242 |
-
var sub = form.clk;
|
243 |
-
if (sub) {
|
244 |
-
var n = sub.name;
|
245 |
-
if (n && !sub.disabled) {
|
246 |
-
s.extraData = s.extraData || {};
|
247 |
-
s.extraData[n] = sub.value;
|
248 |
-
if (sub.type == "image") {
|
249 |
-
s.extraData[n+'.x'] = form.clk_x;
|
250 |
-
s.extraData[n+'.y'] = form.clk_y;
|
251 |
-
}
|
252 |
-
}
|
253 |
-
}
|
254 |
-
|
255 |
-
// take a breath so that pending repaints get some cpu time before the upload starts
|
256 |
-
function doSubmit() {
|
257 |
-
// make sure form attrs are set
|
258 |
-
var t = $form.attr('target'), a = $form.attr('action');
|
259 |
-
|
260 |
-
// update form attrs in IE friendly way
|
261 |
-
form.setAttribute('target',id);
|
262 |
-
if (form.getAttribute('method') != 'POST') {
|
263 |
-
form.setAttribute('method', 'POST');
|
264 |
-
}
|
265 |
-
if (form.getAttribute('action') != s.url) {
|
266 |
-
form.setAttribute('action', s.url);
|
267 |
-
}
|
268 |
-
|
269 |
-
// ie borks in some cases when setting encoding
|
270 |
-
if (! s.skipEncodingOverride) {
|
271 |
-
$form.attr({
|
272 |
-
encoding: 'multipart/form-data',
|
273 |
-
enctype: 'multipart/form-data'
|
274 |
-
});
|
275 |
-
}
|
276 |
-
|
277 |
-
// support timout
|
278 |
-
if (s.timeout) {
|
279 |
-
setTimeout(function() { timedOut = true; cb(); }, s.timeout);
|
280 |
-
}
|
281 |
-
|
282 |
-
// add "extra" data to form if provided in options
|
283 |
-
var extraInputs = [];
|
284 |
-
try {
|
285 |
-
if (s.extraData) {
|
286 |
-
for (var n in s.extraData) {
|
287 |
-
extraInputs.push(
|
288 |
-
$('<input type="hidden" name="'+n+'" value="'+s.extraData[n]+'" />')
|
289 |
-
.appendTo(form)[0]);
|
290 |
-
}
|
291 |
-
}
|
292 |
-
|
293 |
-
// add iframe to doc and submit the form
|
294 |
-
$io.appendTo('body');
|
295 |
-
io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);
|
296 |
-
form.submit();
|
297 |
-
}
|
298 |
-
finally {
|
299 |
-
// reset attrs and remove "extra" input elements
|
300 |
-
form.setAttribute('action',a);
|
301 |
-
if(t) {
|
302 |
-
form.setAttribute('target', t);
|
303 |
-
} else {
|
304 |
-
$form.removeAttr('target');
|
305 |
-
}
|
306 |
-
$(extraInputs).remove();
|
307 |
-
}
|
308 |
-
}
|
309 |
-
|
310 |
-
if (s.forceSync) {
|
311 |
-
doSubmit();
|
312 |
-
}
|
313 |
-
else {
|
314 |
-
setTimeout(doSubmit, 10); // this lets dom updates render
|
315 |
-
}
|
316 |
-
|
317 |
-
var data, doc, domCheckCount = 50;
|
318 |
-
|
319 |
-
function cb() {
|
320 |
-
if (xhr.aborted) {
|
321 |
-
return;
|
322 |
-
}
|
323 |
-
|
324 |
-
var doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
|
325 |
-
if (!doc || doc.location.href == s.iframeSrc) {
|
326 |
-
// response not received yet
|
327 |
-
if (!timedOut)
|
328 |
-
return;
|
329 |
-
}
|
330 |
-
io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);
|
331 |
-
|
332 |
-
var ok = true;
|
333 |
-
try {
|
334 |
-
if (timedOut) {
|
335 |
-
throw 'timeout';
|
336 |
-
}
|
337 |
-
|
338 |
-
var isXml = s.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc);
|
339 |
-
log('isXml='+isXml);
|
340 |
-
if (!isXml && window.opera && (doc.body == null || doc.body.innerHTML == '')) {
|
341 |
-
if (--domCheckCount) {
|
342 |
-
// in some browsers (Opera) the iframe DOM is not always traversable when
|
343 |
-
// the onload callback fires, so we loop a bit to accommodate
|
344 |
-
log('requeing onLoad callback, DOM not available');
|
345 |
-
setTimeout(cb, 250);
|
346 |
-
return;
|
347 |
-
}
|
348 |
-
// let this fall through because server response could be an empty document
|
349 |
-
//log('Could not access iframe DOM after mutiple tries.');
|
350 |
-
//throw 'DOMException: not available';
|
351 |
-
}
|
352 |
-
|
353 |
-
//log('response detected');
|
354 |
-
xhr.responseText = doc.body ? doc.body.innerHTML : doc.documentElement ? doc.documentElement.innerHTML : null;
|
355 |
-
xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
|
356 |
-
xhr.getResponseHeader = function(header){
|
357 |
-
var headers = {'content-type': s.dataType};
|
358 |
-
return headers[header];
|
359 |
-
};
|
360 |
-
|
361 |
-
var scr = /(json|script)/.test(s.dataType);
|
362 |
-
if (scr || s.textarea) {
|
363 |
-
// see if user embedded response in textarea
|
364 |
-
var ta = doc.getElementsByTagName('textarea')[0];
|
365 |
-
if (ta) {
|
366 |
-
xhr.responseText = ta.value;
|
367 |
-
}
|
368 |
-
else if (scr) {
|
369 |
-
// account for browsers injecting pre around json response
|
370 |
-
var pre = doc.getElementsByTagName('pre')[0];
|
371 |
-
var b = doc.getElementsByTagName('body')[0];
|
372 |
-
if (pre) {
|
373 |
-
xhr.responseText = pre.textContent;
|
374 |
-
}
|
375 |
-
else if (b) {
|
376 |
-
xhr.responseText = b.innerHTML;
|
377 |
-
}
|
378 |
-
}
|
379 |
-
}
|
380 |
-
else if (s.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) {
|
381 |
-
xhr.responseXML = toXml(xhr.responseText);
|
382 |
-
}
|
383 |
-
|
384 |
-
data = httpData(xhr, s.dataType, s);
|
385 |
-
}
|
386 |
-
catch(e){
|
387 |
-
log('error caught:',e);
|
388 |
-
ok = false;
|
389 |
-
xhr.error = e;
|
390 |
-
s.error && s.error.call(s.context, xhr, 'error', e);
|
391 |
-
g && $.event.trigger("ajaxError", [xhr, s, e]);
|
392 |
-
}
|
393 |
-
|
394 |
-
if (xhr.aborted) {
|
395 |
-
log('upload aborted');
|
396 |
-
ok = false;
|
397 |
-
}
|
398 |
-
|
399 |
-
// ordering of these callbacks/triggers is odd, but that's how $.ajax does it
|
400 |
-
if (ok) {
|
401 |
-
s.success && s.success.call(s.context, data, 'success', xhr);
|
402 |
-
g && $.event.trigger("ajaxSuccess", [xhr, s]);
|
403 |
-
}
|
404 |
-
|
405 |
-
g && $.event.trigger("ajaxComplete", [xhr, s]);
|
406 |
-
|
407 |
-
if (g && ! --$.active) {
|
408 |
-
$.event.trigger("ajaxStop");
|
409 |
-
}
|
410 |
-
|
411 |
-
s.complete && s.complete.call(s.context, xhr, ok ? 'success' : 'error');
|
412 |
-
|
413 |
-
// clean up
|
414 |
-
setTimeout(function() {
|
415 |
-
$io.removeData('form-plugin-onload');
|
416 |
-
$io.remove();
|
417 |
-
xhr.responseXML = null;
|
418 |
-
}, 100);
|
419 |
-
}
|
420 |
-
|
421 |
-
var toXml = $.parseXML || function(s, doc) { // use parseXML if available (jQuery 1.5+)
|
422 |
-
if (window.ActiveXObject) {
|
423 |
-
doc = new ActiveXObject('Microsoft.XMLDOM');
|
424 |
-
doc.async = 'false';
|
425 |
-
doc.loadXML(s);
|
426 |
-
}
|
427 |
-
else {
|
428 |
-
doc = (new DOMParser()).parseFromString(s, 'text/xml');
|
429 |
-
}
|
430 |
-
return (doc && doc.documentElement && doc.documentElement.nodeName != 'parsererror') ? doc : null;
|
431 |
-
};
|
432 |
-
var parseJSON = $.parseJSON || function(s) {
|
433 |
-
return window['eval']('(' + s + ')');
|
434 |
-
};
|
435 |
-
|
436 |
-
var httpData = function( xhr, type, s ) { // mostly lifted from jq1.4.4
|
437 |
-
var ct = xhr.getResponseHeader('content-type') || '',
|
438 |
-
xml = type === 'xml' || !type && ct.indexOf('xml') >= 0,
|
439 |
-
data = xml ? xhr.responseXML : xhr.responseText;
|
440 |
-
|
441 |
-
if (xml && data.documentElement.nodeName === 'parsererror') {
|
442 |
-
$.error && $.error('parsererror');
|
443 |
-
}
|
444 |
-
if (s && s.dataFilter) {
|
445 |
-
data = s.dataFilter(data, type);
|
446 |
-
}
|
447 |
-
if (typeof data === 'string') {
|
448 |
-
if (type === 'json' || !type && ct.indexOf('json') >= 0) {
|
449 |
-
data = parseJSON(data);
|
450 |
-
} else if (type === "script" || !type && ct.indexOf("javascript") >= 0) {
|
451 |
-
$.globalEval(data);
|
452 |
-
}
|
453 |
-
}
|
454 |
-
return data;
|
455 |
-
};
|
456 |
-
}
|
457 |
-
};
|
458 |
-
|
459 |
-
/**
|
460 |
-
* ajaxForm() provides a mechanism for fully automating form submission.
|
461 |
-
*
|
462 |
-
* The advantages of using this method instead of ajaxSubmit() are:
|
463 |
-
*
|
464 |
-
* 1: This method will include coordinates for <input type="image" /> elements (if the element
|
465 |
-
* is used to submit the form).
|
466 |
-
* 2. This method will include the submit element's name/value data (for the element that was
|
467 |
-
* used to submit the form).
|
468 |
-
* 3. This method binds the submit() method to the form for you.
|
469 |
-
*
|
470 |
-
* The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely
|
471 |
-
* passes the options argument along after properly binding events for submit elements and
|
472 |
-
* the form itself.
|
473 |
-
*/
|
474 |
-
$.fn.ajaxForm = function(options) {
|
475 |
-
// in jQuery 1.3+ we can fix mistakes with the ready state
|
476 |
-
if (this.length === 0) {
|
477 |
-
var o = { s: this.selector, c: this.context };
|
478 |
-
if (!$.isReady && o.s) {
|
479 |
-
log('DOM not ready, queuing ajaxForm');
|
480 |
-
$(function() {
|
481 |
-
$(o.s,o.c).ajaxForm(options);
|
482 |
-
});
|
483 |
-
return this;
|
484 |
-
}
|
485 |
-
// is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
|
486 |
-
log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
|
487 |
-
return this;
|
488 |
-
}
|
489 |
-
|
490 |
-
return this.ajaxFormUnbind().bind('submit.form-plugin', function(e) {
|
491 |
-
if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed
|
492 |
-
e.preventDefault();
|
493 |
-
$(this).ajaxSubmit(options);
|
494 |
-
}
|
495 |
-
}).bind('click.form-plugin', function(e) {
|
496 |
-
var target = e.target;
|
497 |
-
var $el = $(target);
|
498 |
-
if (!($el.is(":submit,input:image"))) {
|
499 |
-
// is this a child element of the submit el? (ex: a span within a button)
|
500 |
-
var t = $el.closest(':submit');
|
501 |
-
if (t.length == 0) {
|
502 |
-
return;
|
503 |
-
}
|
504 |
-
target = t[0];
|
505 |
-
}
|
506 |
-
var form = this;
|
507 |
-
form.clk = target;
|
508 |
-
if (target.type == 'image') {
|
509 |
-
if (e.offsetX != undefined) {
|
510 |
-
form.clk_x = e.offsetX;
|
511 |
-
form.clk_y = e.offsetY;
|
512 |
-
} else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin
|
513 |
-
var offset = $el.offset();
|
514 |
-
form.clk_x = e.pageX - offset.left;
|
515 |
-
form.clk_y = e.pageY - offset.top;
|
516 |
-
} else {
|
517 |
-
form.clk_x = e.pageX - target.offsetLeft;
|
518 |
-
form.clk_y = e.pageY - target.offsetTop;
|
519 |
-
}
|
520 |
-
}
|
521 |
-
// clear form vars
|
522 |
-
setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 100);
|
523 |
-
});
|
524 |
-
};
|
525 |
-
|
526 |
-
// ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
|
527 |
-
$.fn.ajaxFormUnbind = function() {
|
528 |
-
return this.unbind('submit.form-plugin click.form-plugin');
|
529 |
-
};
|
530 |
-
|
531 |
-
/**
|
532 |
-
* formToArray() gathers form element data into an array of objects that can
|
533 |
-
* be passed to any of the following ajax functions: $.get, $.post, or load.
|
534 |
-
* Each object in the array has both a 'name' and 'value' property. An example of
|
535 |
-
* an array for a simple login form might be:
|
536 |
-
*
|
537 |
-
* [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
|
538 |
-
*
|
539 |
-
* It is this array that is passed to pre-submit callback functions provided to the
|
540 |
-
* ajaxSubmit() and ajaxForm() methods.
|
541 |
-
*/
|
542 |
-
$.fn.formToArray = function(semantic) {
|
543 |
-
var a = [];
|
544 |
-
if (this.length === 0) {
|
545 |
-
return a;
|
546 |
-
}
|
547 |
-
|
548 |
-
var form = this[0];
|
549 |
-
var els = semantic ? form.getElementsByTagName('*') : form.elements;
|
550 |
-
if (!els) {
|
551 |
-
return a;
|
552 |
-
}
|
553 |
-
|
554 |
-
var i,j,n,v,el,max,jmax;
|
555 |
-
for(i=0, max=els.length; i < max; i++) {
|
556 |
-
el = els[i];
|
557 |
-
n = el.name;
|
558 |
-
if (!n) {
|
559 |
-
continue;
|
560 |
-
}
|
561 |
-
|
562 |
-
if (semantic && form.clk && el.type == "image") {
|
563 |
-
// handle image inputs on the fly when semantic == true
|
564 |
-
if(!el.disabled && form.clk == el) {
|
565 |
-
a.push({name: n, value: $(el).val()});
|
566 |
-
a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
|
567 |
-
}
|
568 |
-
continue;
|
569 |
-
}
|
570 |
-
|
571 |
-
v = $.fieldValue(el, true);
|
572 |
-
if (v && v.constructor == Array) {
|
573 |
-
for(j=0, jmax=v.length; j < jmax; j++) {
|
574 |
-
a.push({name: n, value: v[j]});
|
575 |
-
}
|
576 |
-
}
|
577 |
-
else if (v !== null && typeof v != 'undefined') {
|
578 |
-
a.push({name: n, value: v});
|
579 |
-
}
|
580 |
-
}
|
581 |
-
|
582 |
-
if (!semantic && form.clk) {
|
583 |
-
// input type=='image' are not found in elements array! handle it here
|
584 |
-
var $input = $(form.clk), input = $input[0];
|
585 |
-
n = input.name;
|
586 |
-
if (n && !input.disabled && input.type == 'image') {
|
587 |
-
a.push({name: n, value: $input.val()});
|
588 |
-
a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
|
589 |
-
}
|
590 |
-
}
|
591 |
-
return a;
|
592 |
-
};
|
593 |
-
|
594 |
-
/**
|
595 |
-
* Serializes form data into a 'submittable' string. This method will return a string
|
596 |
-
* in the format: name1=value1&name2=value2
|
597 |
-
*/
|
598 |
-
$.fn.formSerialize = function(semantic) {
|
599 |
-
//hand off to jQuery.param for proper encoding
|
600 |
-
return $.param(this.formToArray(semantic));
|
601 |
-
};
|
602 |
-
|
603 |
-
/**
|
604 |
-
* Serializes all field elements in the jQuery object into a query string.
|
605 |
-
* This method will return a string in the format: name1=value1&name2=value2
|
606 |
-
*/
|
607 |
-
$.fn.fieldSerialize = function(successful) {
|
608 |
-
var a = [];
|
609 |
-
this.each(function() {
|
610 |
-
var n = this.name;
|
611 |
-
if (!n) {
|
612 |
-
return;
|
613 |
-
}
|
614 |
-
var v = $.fieldValue(this, successful);
|
615 |
-
if (v && v.constructor == Array) {
|
616 |
-
for (var i=0,max=v.length; i < max; i++) {
|
617 |
-
a.push({name: n, value: v[i]});
|
618 |
-
}
|
619 |
-
}
|
620 |
-
else if (v !== null && typeof v != 'undefined') {
|
621 |
-
a.push({name: this.name, value: v});
|
622 |
-
}
|
623 |
-
});
|
624 |
-
//hand off to jQuery.param for proper encoding
|
625 |
-
return $.param(a);
|
626 |
-
};
|
627 |
-
|
628 |
-
/**
|
629 |
-
* Returns the value(s) of the element in the matched set. For example, consider the following form:
|
630 |
-
*
|
631 |
-
* <form><fieldset>
|
632 |
-
* <input name="A" type="text" />
|
633 |
-
* <input name="A" type="text" />
|
634 |
-
* <input name="B" type="checkbox" value="B1" />
|
635 |
-
* <input name="B" type="checkbox" value="B2"/>
|
636 |
-
* <input name="C" type="radio" value="C1" />
|
637 |
-
* <input name="C" type="radio" value="C2" />
|
638 |
-
* </fieldset></form>
|
639 |
-
*
|
640 |
-
* var v = $(':text').fieldValue();
|
641 |
-
* // if no values are entered into the text inputs
|
642 |
-
* v == ['','']
|
643 |
-
* // if values entered into the text inputs are 'foo' and 'bar'
|
644 |
-
* v == ['foo','bar']
|
645 |
-
*
|
646 |
-
* var v = $(':checkbox').fieldValue();
|
647 |
-
* // if neither checkbox is checked
|
648 |
-
* v === undefined
|
649 |
-
* // if both checkboxes are checked
|
650 |
-
* v == ['B1', 'B2']
|
651 |
-
*
|
652 |
-
* var v = $(':radio').fieldValue();
|
653 |
-
* // if neither radio is checked
|
654 |
-
* v === undefined
|
655 |
-
* // if first radio is checked
|
656 |
-
* v == ['C1']
|
657 |
-
*
|
658 |
-
* The successful argument controls whether or not the field element must be 'successful'
|
659 |
-
* (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
|
660 |
-
* The default value of the successful argument is true. If this value is false the value(s)
|
661 |
-
* for each element is returned.
|
662 |
-
*
|
663 |
-
* Note: This method *always* returns an array. If no valid value can be determined the
|
664 |
-
* array will be empty, otherwise it will contain one or more values.
|
665 |
-
*/
|
666 |
-
$.fn.fieldValue = function(successful) {
|
667 |
-
for (var val=[], i=0, max=this.length; i < max; i++) {
|
668 |
-
var el = this[i];
|
669 |
-
var v = $.fieldValue(el, successful);
|
670 |
-
if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) {
|
671 |
-
continue;
|
672 |
-
}
|
673 |
-
v.constructor == Array ? $.merge(val, v) : val.push(v);
|
674 |
-
}
|
675 |
-
return val;
|
676 |
-
};
|
677 |
-
|
678 |
-
/**
|
679 |
-
* Returns the value of the field element.
|
680 |
-
*/
|
681 |
-
$.fieldValue = function(el, successful) {
|
682 |
-
var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
|
683 |
-
if (successful === undefined) {
|
684 |
-
successful = true;
|
685 |
-
}
|
686 |
-
|
687 |
-
if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
|
688 |
-
(t == 'checkbox' || t == 'radio') && !el.checked ||
|
689 |
-
(t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
|
690 |
-
tag == 'select' && el.selectedIndex == -1)) {
|
691 |
-
return null;
|
692 |
-
}
|
693 |
-
|
694 |
-
if (tag == 'select') {
|
695 |
-
var index = el.selectedIndex;
|
696 |
-
if (index < 0) {
|
697 |
-
return null;
|
698 |
-
}
|
699 |
-
var a = [], ops = el.options;
|
700 |
-
var one = (t == 'select-one');
|
701 |
-
var max = (one ? index+1 : ops.length);
|
702 |
-
for(var i=(one ? index : 0); i < max; i++) {
|
703 |
-
var op = ops[i];
|
704 |
-
if (op.selected) {
|
705 |
-
var v = op.value;
|
706 |
-
if (!v) { // extra pain for IE...
|
707 |
-
v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
|
708 |
-
}
|
709 |
-
if (one) {
|
710 |
-
return v;
|
711 |
-
}
|
712 |
-
a.push(v);
|
713 |
-
}
|
714 |
-
}
|
715 |
-
return a;
|
716 |
-
}
|
717 |
-
return $(el).val();
|
718 |
-
};
|
719 |
-
|
720 |
-
/**
|
721 |
-
* Clears the form data. Takes the following actions on the form's input fields:
|
722 |
-
* - input text fields will have their 'value' property set to the empty string
|
723 |
-
* - select elements will have their 'selectedIndex' property set to -1
|
724 |
-
* - checkbox and radio inputs will have their 'checked' property set to false
|
725 |
-
* - inputs of type submit, button, reset, and hidden will *not* be effected
|
726 |
-
* - button elements will *not* be effected
|
727 |
-
*/
|
728 |
-
$.fn.clearForm = function() {
|
729 |
-
return this.each(function() {
|
730 |
-
$('input,select,textarea', this).clearFields();
|
731 |
-
});
|
732 |
-
};
|
733 |
-
|
734 |
-
/**
|
735 |
-
* Clears the selected form elements.
|
736 |
-
*/
|
737 |
-
$.fn.clearFields = $.fn.clearInputs = function() {
|
738 |
-
return this.each(function() {
|
739 |
-
var t = this.type, tag = this.tagName.toLowerCase();
|
740 |
-
if (t == 'text' || t == 'password' || tag == 'textarea') {
|
741 |
-
this.value = '';
|
742 |
-
}
|
743 |
-
else if (t == 'checkbox' || t == 'radio') {
|
744 |
-
this.checked = false;
|
745 |
-
}
|
746 |
-
else if (tag == 'select') {
|
747 |
-
this.selectedIndex = -1;
|
748 |
-
}
|
749 |
-
});
|
750 |
-
};
|
751 |
-
|
752 |
-
/**
|
753 |
-
* Resets the form data. Causes all form elements to be reset to their original value.
|
754 |
-
*/
|
755 |
-
$.fn.resetForm = function() {
|
756 |
-
return this.each(function() {
|
757 |
-
// guard against an input with the name of 'reset'
|
758 |
-
// note that IE reports the reset function as an 'object'
|
759 |
-
if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) {
|
760 |
-
this.reset();
|
761 |
-
}
|
762 |
-
});
|
763 |
-
};
|
764 |
-
|
765 |
-
/**
|
766 |
-
* Enables or disables any matching elements.
|
767 |
-
*/
|
768 |
-
$.fn.enable = function(b) {
|
769 |
-
if (b === undefined) {
|
770 |
-
b = true;
|
771 |
-
}
|
772 |
-
return this.each(function() {
|
773 |
-
this.disabled = !b;
|
774 |
-
});
|
775 |
-
};
|
776 |
-
|
777 |
-
/**
|
778 |
-
* Checks/unchecks any matching checkboxes or radio buttons and
|
779 |
-
* selects/deselects and matching option elements.
|
780 |
-
*/
|
781 |
-
$.fn.selected = function(select) {
|
782 |
-
if (select === undefined) {
|
783 |
-
select = true;
|
784 |
-
}
|
785 |
-
return this.each(function() {
|
786 |
-
var t = this.type;
|
787 |
-
if (t == 'checkbox' || t == 'radio') {
|
788 |
-
this.checked = select;
|
789 |
-
}
|
790 |
-
else if (this.tagName.toLowerCase() == 'option') {
|
791 |
-
var $sel = $(this).parent('select');
|
792 |
-
if (select && $sel[0] && $sel[0].type == 'select-one') {
|
793 |
-
// deselect all other options
|
794 |
-
$sel.find('option').selected(false);
|
795 |
-
}
|
796 |
-
this.selected = select;
|
797 |
-
}
|
798 |
-
});
|
799 |
-
};
|
800 |
-
|
801 |
-
// helper fn for console logging
|
802 |
-
// set $.fn.ajaxSubmit.debug to true to enable debug logging
|
803 |
-
function log() {
|
804 |
-
if ($.fn.ajaxSubmit.debug) {
|
805 |
-
var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,'');
|
806 |
-
if (window.console && window.console.log) {
|
807 |
-
window.console.log(msg);
|
808 |
-
}
|
809 |
-
else if (window.opera && window.opera.postError) {
|
810 |
-
window.opera.postError(msg);
|
811 |
-
}
|
812 |
-
}
|
813 |
-
};
|
814 |
-
|
815 |
-
})(jQuery);
|
1 |
+
/*!
|
2 |
+
* jQuery Form Plugin
|
3 |
+
* version: 2.69 (06-APR-2011)
|
4 |
+
* @requires jQuery v1.3.2 or later
|
5 |
+
*
|
6 |
+
* Examples and documentation at: http://malsup.com/jquery/form/
|
7 |
+
* Dual licensed under the MIT and GPL licenses:
|
8 |
+
* http://www.opensource.org/licenses/mit-license.php
|
9 |
+
* http://www.gnu.org/licenses/gpl.html
|
10 |
+
*/
|
11 |
+
;(function($) {
|
12 |
+
|
13 |
+
/*
|
14 |
+
Usage Note:
|
15 |
+
-----------
|
16 |
+
Do not use both ajaxSubmit and ajaxForm on the same form. These
|
17 |
+
functions are intended to be exclusive. Use ajaxSubmit if you want
|
18 |
+
to bind your own submit handler to the form. For example,
|
19 |
+
|
20 |
+
$(document).ready(function() {
|
21 |
+
$('#myForm').bind('submit', function(e) {
|
22 |
+
e.preventDefault(); // <-- important
|
23 |
+
$(this).ajaxSubmit({
|
24 |
+
target: '#output'
|
25 |
+
});
|
26 |
+
});
|
27 |
+
});
|
28 |
+
|
29 |
+
Use ajaxForm when you want the plugin to manage all the event binding
|
30 |
+
for you. For example,
|
31 |
+
|
32 |
+
$(document).ready(function() {
|
33 |
+
$('#myForm').ajaxForm({
|
34 |
+
target: '#output'
|
35 |
+
});
|
36 |
+
});
|
37 |
+
|
38 |
+
When using ajaxForm, the ajaxSubmit function will be invoked for you
|
39 |
+
at the appropriate time.
|
40 |
+
*/
|
41 |
+
|
42 |
+
/**
|
43 |
+
* ajaxSubmit() provides a mechanism for immediately submitting
|
44 |
+
* an HTML form using AJAX.
|
45 |
+
*/
|
46 |
+
$.fn.ajaxSubmit = function(options) {
|
47 |
+
// fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
|
48 |
+
if (!this.length) {
|
49 |
+
log('ajaxSubmit: skipping submit process - no element selected');
|
50 |
+
return this;
|
51 |
+
}
|
52 |
+
|
53 |
+
if (typeof options == 'function') {
|
54 |
+
options = { success: options };
|
55 |
+
}
|
56 |
+
|
57 |
+
var action = this.attr('action');
|
58 |
+
var url = (typeof action === 'string') ? $.trim(action) : '';
|
59 |
+
if (url) {
|
60 |
+
// clean url (don't include hash vaue)
|
61 |
+
url = (url.match(/^([^#]+)/)||[])[1];
|
62 |
+
}
|
63 |
+
url = url || window.location.href || '';
|
64 |
+
|
65 |
+
options = $.extend(true, {
|
66 |
+
url: url,
|
67 |
+
success: $.ajaxSettings.success,
|
68 |
+
type: this[0].getAttribute('method') || 'GET', // IE7 massage (see issue 57)
|
69 |
+
iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank'
|
70 |
+
}, options);
|
71 |
+
|
72 |
+
// hook for manipulating the form data before it is extracted;
|
73 |
+
// convenient for use with rich editors like tinyMCE or FCKEditor
|
74 |
+
var veto = {};
|
75 |
+
this.trigger('form-pre-serialize', [this, options, veto]);
|
76 |
+
if (veto.veto) {
|
77 |
+
log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
|
78 |
+
return this;
|
79 |
+
}
|
80 |
+
|
81 |
+
// provide opportunity to alter form data before it is serialized
|
82 |
+
if (options.beforeSerialize && options.beforeSerialize(this, options) === false) {
|
83 |
+
log('ajaxSubmit: submit aborted via beforeSerialize callback');
|
84 |
+
return this;
|
85 |
+
}
|
86 |
+
|
87 |
+
var n,v,a = this.formToArray(options.semantic);
|
88 |
+
if (options.data) {
|
89 |
+
options.extraData = options.data;
|
90 |
+
for (n in options.data) {
|
91 |
+
if(options.data[n] instanceof Array) {
|
92 |
+
for (var k in options.data[n]) {
|
93 |
+
a.push( { name: n, value: options.data[n][k] } );
|
94 |
+
}
|
95 |
+
}
|
96 |
+
else {
|
97 |
+
v = options.data[n];
|
98 |
+
v = $.isFunction(v) ? v() : v; // if value is fn, invoke it
|
99 |
+
a.push( { name: n, value: v } );
|
100 |
+
}
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
// give pre-submit callback an opportunity to abort the submit
|
105 |
+
if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
|
106 |
+
log('ajaxSubmit: submit aborted via beforeSubmit callback');
|
107 |
+
return this;
|
108 |
+
}
|
109 |
+
|
110 |
+
// fire vetoable 'validate' event
|
111 |
+
this.trigger('form-submit-validate', [a, this, options, veto]);
|
112 |
+
if (veto.veto) {
|
113 |
+
log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
|
114 |
+
return this;
|
115 |
+
}
|
116 |
+
|
117 |
+
var q = $.param(a);
|
118 |
+
|
119 |
+
if (options.type.toUpperCase() == 'GET') {
|
120 |
+
options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
|
121 |
+
options.data = null; // data is null for 'get'
|
122 |
+
}
|
123 |
+
else {
|
124 |
+
options.data = q; // data is the query string for 'post'
|
125 |
+
}
|
126 |
+
|
127 |
+
var $form = this, callbacks = [];
|
128 |
+
if (options.resetForm) {
|
129 |
+
callbacks.push(function() { $form.resetForm(); });
|
130 |
+
}
|
131 |
+
if (options.clearForm) {
|
132 |
+
callbacks.push(function() { $form.clearForm(); });
|
133 |
+
}
|
134 |
+
|
135 |
+
// perform a load on the target only if dataType is not provided
|
136 |
+
if (!options.dataType && options.target) {
|
137 |
+
var oldSuccess = options.success || function(){};
|
138 |
+
callbacks.push(function(data) {
|
139 |
+
var fn = options.replaceTarget ? 'replaceWith' : 'html';
|
140 |
+
$(options.target)[fn](data).each(oldSuccess, arguments);
|
141 |
+
});
|
142 |
+
}
|
143 |
+
else if (options.success) {
|
144 |
+
callbacks.push(options.success);
|
145 |
+
}
|
146 |
+
|
147 |
+
options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg
|
148 |
+
var context = options.context || options; // jQuery 1.4+ supports scope context
|
149 |
+
for (var i=0, max=callbacks.length; i < max; i++) {
|
150 |
+
callbacks[i].apply(context, [data, status, xhr || $form, $form]);
|
151 |
+
}
|
152 |
+
};
|
153 |
+
|
154 |
+
// are there files to upload?
|
155 |
+
var fileInputs = $('input:file', this).length > 0;
|
156 |
+
var mp = 'multipart/form-data';
|
157 |
+
var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp);
|
158 |
+
|
159 |
+
// options.iframe allows user to force iframe mode
|
160 |
+
// 06-NOV-09: now defaulting to iframe mode if file input is detected
|
161 |
+
if (options.iframe !== false && (fileInputs || options.iframe || multipart)) {
|
162 |
+
// hack to fix Safari hang (thanks to Tim Molendijk for this)
|
163 |
+
// see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
|
164 |
+
if (options.closeKeepAlive) {
|
165 |
+
$.get(options.closeKeepAlive, fileUpload);
|
166 |
+
}
|
167 |
+
else {
|
168 |
+
fileUpload();
|
169 |
+
}
|
170 |
+
}
|
171 |
+
else {
|
172 |
+
$.ajax(options);
|
173 |
+
}
|
174 |
+
|
175 |
+
// fire 'notify' event
|
176 |
+
this.trigger('form-submit-notify', [this, options]);
|
177 |
+
return this;
|
178 |
+
|
179 |
+
|
180 |
+
// private function for handling file uploads (hat tip to YAHOO!)
|
181 |
+
function fileUpload() {
|
182 |
+
var form = $form[0];
|
183 |
+
|
184 |
+
if ($(':input[name=submit],:input[id=submit]', form).length) {
|
185 |
+
// if there is an input with a name or id of 'submit' then we won't be
|
186 |
+
// able to invoke the submit fn on the form (at least not x-browser)
|
187 |
+
alert('Error: Form elements must not have name or id of "submit".');
|
188 |
+
return;
|
189 |
+
}
|
190 |
+
|
191 |
+
var s = $.extend(true, {}, $.ajaxSettings, options);
|
192 |
+
s.context = s.context || s;
|
193 |
+
var id = 'jqFormIO' + (new Date().getTime()), fn = '_'+id;
|
194 |
+
var $io = $('<iframe id="' + id + '" name="' + id + '" src="'+ s.iframeSrc +'" />');
|
195 |
+
var io = $io[0];
|
196 |
+
|
197 |
+
$io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
|
198 |
+
|
199 |
+
var xhr = { // mock object
|
200 |
+
aborted: 0,
|
201 |
+
responseText: null,
|
202 |
+
responseXML: null,
|
203 |
+
status: 0,
|
204 |
+
statusText: 'n/a',
|
205 |
+
getAllResponseHeaders: function() {},
|
206 |
+
getResponseHeader: function() {},
|
207 |
+
setRequestHeader: function() {},
|
208 |
+
abort: function() {
|
209 |
+
log('aborting upload...');
|
210 |
+
var e = 'aborted';
|
211 |
+
this.aborted = 1;
|
212 |
+
$io.attr('src', s.iframeSrc); // abort op in progress
|
213 |
+
xhr.error = e;
|
214 |
+
s.error && s.error.call(s.context, xhr, 'error', e);
|
215 |
+
g && $.event.trigger("ajaxError", [xhr, s, e]);
|
216 |
+
s.complete && s.complete.call(s.context, xhr, 'error');
|
217 |
+
}
|
218 |
+
};
|
219 |
+
|
220 |
+
var g = s.global;
|
221 |
+
// trigger ajax global events so that activity/block indicators work like normal
|
222 |
+
if (g && ! $.active++) {
|
223 |
+
$.event.trigger("ajaxStart");
|
224 |
+
}
|
225 |
+
if (g) {
|
226 |
+
$.event.trigger("ajaxSend", [xhr, s]);
|
227 |
+
}
|
228 |
+
|
229 |
+
if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {
|
230 |
+
if (s.global) {
|
231 |
+
$.active--;
|
232 |
+
}
|
233 |
+
return;
|
234 |
+
}
|
235 |
+
if (xhr.aborted) {
|
236 |
+
return;
|
237 |
+
}
|
238 |
+
|
239 |
+
var timedOut = 0;
|
240 |
+
|
241 |
+
// add submitting element to data if we know it
|
242 |
+
var sub = form.clk;
|
243 |
+
if (sub) {
|
244 |
+
var n = sub.name;
|
245 |
+
if (n && !sub.disabled) {
|
246 |
+
s.extraData = s.extraData || {};
|
247 |
+
s.extraData[n] = sub.value;
|
248 |
+
if (sub.type == "image") {
|
249 |
+
s.extraData[n+'.x'] = form.clk_x;
|
250 |
+
s.extraData[n+'.y'] = form.clk_y;
|
251 |
+
}
|
252 |
+
}
|
253 |
+
}
|
254 |
+
|
255 |
+
// take a breath so that pending repaints get some cpu time before the upload starts
|
256 |
+
function doSubmit() {
|
257 |
+
// make sure form attrs are set
|
258 |
+
var t = $form.attr('target'), a = $form.attr('action');
|
259 |
+
|
260 |
+
// update form attrs in IE friendly way
|
261 |
+
form.setAttribute('target',id);
|
262 |
+
if (form.getAttribute('method') != 'POST') {
|
263 |
+
form.setAttribute('method', 'POST');
|
264 |
+
}
|
265 |
+
if (form.getAttribute('action') != s.url) {
|
266 |
+
form.setAttribute('action', s.url);
|
267 |
+
}
|
268 |
+
|
269 |
+
// ie borks in some cases when setting encoding
|
270 |
+
if (! s.skipEncodingOverride) {
|
271 |
+
$form.attr({
|
272 |
+
encoding: 'multipart/form-data',
|
273 |
+
enctype: 'multipart/form-data'
|
274 |
+
});
|
275 |
+
}
|
276 |
+
|
277 |
+
// support timout
|
278 |
+
if (s.timeout) {
|
279 |
+
setTimeout(function() { timedOut = true; cb(); }, s.timeout);
|
280 |
+
}
|
281 |
+
|
282 |
+
// add "extra" data to form if provided in options
|
283 |
+
var extraInputs = [];
|
284 |
+
try {
|
285 |
+
if (s.extraData) {
|
286 |
+
for (var n in s.extraData) {
|
287 |
+
extraInputs.push(
|
288 |
+
$('<input type="hidden" name="'+n+'" value="'+s.extraData[n]+'" />')
|
289 |
+
.appendTo(form)[0]);
|
290 |
+
}
|
291 |
+
}
|
292 |
+
|
293 |
+
// add iframe to doc and submit the form
|
294 |
+
$io.appendTo('body');
|
295 |
+
io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);
|
296 |
+
form.submit();
|
297 |
+
}
|
298 |
+
finally {
|
299 |
+
// reset attrs and remove "extra" input elements
|
300 |
+
form.setAttribute('action',a);
|
301 |
+
if(t) {
|
302 |
+
form.setAttribute('target', t);
|
303 |
+
} else {
|
304 |
+
$form.removeAttr('target');
|
305 |
+
}
|
306 |
+
$(extraInputs).remove();
|
307 |
+
}
|
308 |
+
}
|
309 |
+
|
310 |
+
if (s.forceSync) {
|
311 |
+
doSubmit();
|
312 |
+
}
|
313 |
+
else {
|
314 |
+
setTimeout(doSubmit, 10); // this lets dom updates render
|
315 |
+
}
|
316 |
+
|
317 |
+
var data, doc, domCheckCount = 50;
|
318 |
+
|
319 |
+
function cb() {
|
320 |
+
if (xhr.aborted) {
|
321 |
+
return;
|
322 |
+
}
|
323 |
+
|
324 |
+
var doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
|
325 |
+
if (!doc || doc.location.href == s.iframeSrc) {
|
326 |
+
// response not received yet
|
327 |
+
if (!timedOut)
|
328 |
+
return;
|
329 |
+
}
|
330 |
+
io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);
|
331 |
+
|
332 |
+
var ok = true;
|
333 |
+
try {
|
334 |
+
if (timedOut) {
|
335 |
+
throw 'timeout';
|
336 |
+
}
|
337 |
+
|
338 |
+
var isXml = s.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc);
|
339 |
+
log('isXml='+isXml);
|
340 |
+
if (!isXml && window.opera && (doc.body == null || doc.body.innerHTML == '')) {
|
341 |
+
if (--domCheckCount) {
|
342 |
+
// in some browsers (Opera) the iframe DOM is not always traversable when
|
343 |
+
// the onload callback fires, so we loop a bit to accommodate
|
344 |
+
log('requeing onLoad callback, DOM not available');
|
345 |
+
setTimeout(cb, 250);
|
346 |
+
return;
|
347 |
+
}
|
348 |
+
// let this fall through because server response could be an empty document
|
349 |
+
//log('Could not access iframe DOM after mutiple tries.');
|
350 |
+
//throw 'DOMException: not available';
|
351 |
+
}
|
352 |
+
|
353 |
+
//log('response detected');
|
354 |
+
xhr.responseText = doc.body ? doc.body.innerHTML : doc.documentElement ? doc.documentElement.innerHTML : null;
|
355 |
+
xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
|
356 |
+
xhr.getResponseHeader = function(header){
|
357 |
+
var headers = {'content-type': s.dataType};
|
358 |
+
return headers[header];
|
359 |
+
};
|
360 |
+
|
361 |
+
var scr = /(json|script)/.test(s.dataType);
|
362 |
+
if (scr || s.textarea) {
|
363 |
+
// see if user embedded response in textarea
|
364 |
+
var ta = doc.getElementsByTagName('textarea')[0];
|
365 |
+
if (ta) {
|
366 |
+
xhr.responseText = ta.value;
|
367 |
+
}
|
368 |
+
else if (scr) {
|
369 |
+
// account for browsers injecting pre around json response
|
370 |
+
var pre = doc.getElementsByTagName('pre')[0];
|
371 |
+
var b = doc.getElementsByTagName('body')[0];
|
372 |
+
if (pre) {
|
373 |
+
xhr.responseText = pre.textContent;
|
374 |
+
}
|
375 |
+
else if (b) {
|
376 |
+
xhr.responseText = b.innerHTML;
|
377 |
+
}
|
378 |
+
}
|
379 |
+
}
|
380 |
+
else if (s.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) {
|
381 |
+
xhr.responseXML = toXml(xhr.responseText);
|
382 |
+
}
|
383 |
+
|
384 |
+
data = httpData(xhr, s.dataType, s);
|
385 |
+
}
|
386 |
+
catch(e){
|
387 |
+
log('error caught:',e);
|
388 |
+
ok = false;
|
389 |
+
xhr.error = e;
|
390 |
+
s.error && s.error.call(s.context, xhr, 'error', e);
|
391 |
+
g && $.event.trigger("ajaxError", [xhr, s, e]);
|
392 |
+
}
|
393 |
+
|
394 |
+
if (xhr.aborted) {
|
395 |
+
log('upload aborted');
|
396 |
+
ok = false;
|
397 |
+
}
|
398 |
+
|
399 |
+
// ordering of these callbacks/triggers is odd, but that's how $.ajax does it
|
400 |
+
if (ok) {
|
401 |
+
s.success && s.success.call(s.context, data, 'success', xhr);
|
402 |
+
g && $.event.trigger("ajaxSuccess", [xhr, s]);
|
403 |
+
}
|
404 |
+
|
405 |
+
g && $.event.trigger("ajaxComplete", [xhr, s]);
|
406 |
+
|
407 |
+
if (g && ! --$.active) {
|
408 |
+
$.event.trigger("ajaxStop");
|
409 |
+
}
|
410 |
+
|
411 |
+
s.complete && s.complete.call(s.context, xhr, ok ? 'success' : 'error');
|
412 |
+
|
413 |
+
// clean up
|
414 |
+
setTimeout(function() {
|
415 |
+
$io.removeData('form-plugin-onload');
|
416 |
+
$io.remove();
|
417 |
+
xhr.responseXML = null;
|
418 |
+
}, 100);
|
419 |
+
}
|
420 |
+
|
421 |
+
var toXml = $.parseXML || function(s, doc) { // use parseXML if available (jQuery 1.5+)
|
422 |
+
if (window.ActiveXObject) {
|
423 |
+
doc = new ActiveXObject('Microsoft.XMLDOM');
|
424 |
+
doc.async = 'false';
|
425 |
+
doc.loadXML(s);
|
426 |
+
}
|
427 |
+
else {
|
428 |
+
doc = (new DOMParser()).parseFromString(s, 'text/xml');
|
429 |
+
}
|
430 |
+
return (doc && doc.documentElement && doc.documentElement.nodeName != 'parsererror') ? doc : null;
|
431 |
+
};
|
432 |
+
var parseJSON = $.parseJSON || function(s) {
|
433 |
+
return window['eval']('(' + s + ')');
|
434 |
+
};
|
435 |
+
|
436 |
+
var httpData = function( xhr, type, s ) { // mostly lifted from jq1.4.4
|
437 |
+
var ct = xhr.getResponseHeader('content-type') || '',
|
438 |
+
xml = type === 'xml' || !type && ct.indexOf('xml') >= 0,
|
439 |
+
data = xml ? xhr.responseXML : xhr.responseText;
|
440 |
+
|
441 |
+
if (xml && data.documentElement.nodeName === 'parsererror') {
|
442 |
+
$.error && $.error('parsererror');
|
443 |
+
}
|
444 |
+
if (s && s.dataFilter) {
|
445 |
+
data = s.dataFilter(data, type);
|
446 |
+
}
|
447 |
+
if (typeof data === 'string') {
|
448 |
+
if (type === 'json' || !type && ct.indexOf('json') >= 0) {
|
449 |
+
data = parseJSON(data);
|
450 |
+
} else if (type === "script" || !type && ct.indexOf("javascript") >= 0) {
|
451 |
+
$.globalEval(data);
|
452 |
+
}
|
453 |
+
}
|
454 |
+
return data;
|
455 |
+
};
|
456 |
+
}
|
457 |
+
};
|
458 |
+
|
459 |
+
/**
|
460 |
+
* ajaxForm() provides a mechanism for fully automating form submission.
|
461 |
+
*
|
462 |
+
* The advantages of using this method instead of ajaxSubmit() are:
|
463 |
+
*
|
464 |
+
* 1: This method will include coordinates for <input type="image" /> elements (if the element
|
465 |
+
* is used to submit the form).
|
466 |
+
* 2. This method will include the submit element's name/value data (for the element that was
|
467 |
+
* used to submit the form).
|
468 |
+
* 3. This method binds the submit() method to the form for you.
|
469 |
+
*
|
470 |
+
* The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely
|
471 |
+
* passes the options argument along after properly binding events for submit elements and
|
472 |
+
* the form itself.
|
473 |
+
*/
|
474 |
+
$.fn.ajaxForm = function(options) {
|
475 |
+
// in jQuery 1.3+ we can fix mistakes with the ready state
|
476 |
+
if (this.length === 0) {
|
477 |
+
var o = { s: this.selector, c: this.context };
|
478 |
+
if (!$.isReady && o.s) {
|
479 |
+
log('DOM not ready, queuing ajaxForm');
|
480 |
+
$(function() {
|
481 |
+
$(o.s,o.c).ajaxForm(options);
|
482 |
+
});
|
483 |
+
return this;
|
484 |
+
}
|
485 |
+
// is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
|
486 |
+
log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
|
487 |
+
return this;
|
488 |
+
}
|
489 |
+
|
490 |
+
return this.ajaxFormUnbind().bind('submit.form-plugin', function(e) {
|
491 |
+
if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed
|
492 |
+
e.preventDefault();
|
493 |
+
$(this).ajaxSubmit(options);
|
494 |
+
}
|
495 |
+
}).bind('click.form-plugin', function(e) {
|
496 |
+
var target = e.target;
|
497 |
+
var $el = $(target);
|
498 |
+
if (!($el.is(":submit,input:image"))) {
|
499 |
+
// is this a child element of the submit el? (ex: a span within a button)
|
500 |
+
var t = $el.closest(':submit');
|
501 |
+
if (t.length == 0) {
|
502 |
+
return;
|
503 |
+
}
|
504 |
+
target = t[0];
|
505 |
+
}
|
506 |
+
var form = this;
|
507 |
+
form.clk = target;
|
508 |
+
if (target.type == 'image') {
|
509 |
+
if (e.offsetX != undefined) {
|
510 |
+
form.clk_x = e.offsetX;
|
511 |
+
form.clk_y = e.offsetY;
|
512 |
+
} else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin
|
513 |
+
var offset = $el.offset();
|
514 |
+
form.clk_x = e.pageX - offset.left;
|
515 |
+
form.clk_y = e.pageY - offset.top;
|
516 |
+
} else {
|
517 |
+
form.clk_x = e.pageX - target.offsetLeft;
|
518 |
+
form.clk_y = e.pageY - target.offsetTop;
|
519 |
+
}
|
520 |
+
}
|
521 |
+
// clear form vars
|
522 |
+
setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 100);
|
523 |
+
});
|
524 |
+
};
|
525 |
+
|
526 |
+
// ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
|
527 |
+
$.fn.ajaxFormUnbind = function() {
|
528 |
+
return this.unbind('submit.form-plugin click.form-plugin');
|
529 |
+
};
|
530 |
+
|
531 |
+
/**
|
532 |
+
* formToArray() gathers form element data into an array of objects that can
|
533 |
+
* be passed to any of the following ajax functions: $.get, $.post, or load.
|
534 |
+
* Each object in the array has both a 'name' and 'value' property. An example of
|
535 |
+
* an array for a simple login form might be:
|
536 |
+
*
|
537 |
+
* [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
|
538 |
+
*
|
539 |
+
* It is this array that is passed to pre-submit callback functions provided to the
|
540 |
+
* ajaxSubmit() and ajaxForm() methods.
|
541 |
+
*/
|
542 |
+
$.fn.formToArray = function(semantic) {
|
543 |
+
var a = [];
|
544 |
+
if (this.length === 0) {
|
545 |
+
return a;
|
546 |
+
}
|
547 |
+
|
548 |
+
var form = this[0];
|
549 |
+
var els = semantic ? form.getElementsByTagName('*') : form.elements;
|
550 |
+
if (!els) {
|
551 |
+
return a;
|
552 |
+
}
|
553 |
+
|
554 |
+
var i,j,n,v,el,max,jmax;
|
555 |
+
for(i=0, max=els.length; i < max; i++) {
|
556 |
+
el = els[i];
|
557 |
+
n = el.name;
|
558 |
+
if (!n) {
|
559 |
+
continue;
|
560 |
+
}
|
561 |
+
|
562 |
+
if (semantic && form.clk && el.type == "image") {
|
563 |
+
// handle image inputs on the fly when semantic == true
|
564 |
+
if(!el.disabled && form.clk == el) {
|
565 |
+
a.push({name: n, value: $(el).val()});
|
566 |
+
a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
|
567 |
+
}
|
568 |
+
continue;
|
569 |
+
}
|
570 |
+
|
571 |
+
v = $.fieldValue(el, true);
|
572 |
+
if (v && v.constructor == Array) {
|
573 |
+
for(j=0, jmax=v.length; j < jmax; j++) {
|
574 |
+
a.push({name: n, value: v[j]});
|
575 |
+
}
|
576 |
+
}
|
577 |
+
else if (v !== null && typeof v != 'undefined') {
|
578 |
+
a.push({name: n, value: v});
|
579 |
+
}
|
580 |
+
}
|
581 |
+
|
582 |
+
if (!semantic && form.clk) {
|
583 |
+
// input type=='image' are not found in elements array! handle it here
|
584 |
+
var $input = $(form.clk), input = $input[0];
|
585 |
+
n = input.name;
|
586 |
+
if (n && !input.disabled && input.type == 'image') {
|
587 |
+
a.push({name: n, value: $input.val()});
|
588 |
+
a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
|
589 |
+
}
|
590 |
+
}
|
591 |
+
return a;
|
592 |
+
};
|
593 |
+
|
594 |
+
/**
|
595 |
+
* Serializes form data into a 'submittable' string. This method will return a string
|
596 |
+
* in the format: name1=value1&name2=value2
|
597 |
+
*/
|
598 |
+
$.fn.formSerialize = function(semantic) {
|
599 |
+
//hand off to jQuery.param for proper encoding
|
600 |
+
return $.param(this.formToArray(semantic));
|
601 |
+
};
|
602 |
+
|
603 |
+
/**
|
604 |
+
* Serializes all field elements in the jQuery object into a query string.
|
605 |
+
* This method will return a string in the format: name1=value1&name2=value2
|
606 |
+
*/
|
607 |
+
$.fn.fieldSerialize = function(successful) {
|
608 |
+
var a = [];
|
609 |
+
this.each(function() {
|
610 |
+
var n = this.name;
|
611 |
+
if (!n) {
|
612 |
+
return;
|
613 |
+
}
|
614 |
+
var v = $.fieldValue(this, successful);
|
615 |
+
if (v && v.constructor == Array) {
|
616 |
+
for (var i=0,max=v.length; i < max; i++) {
|
617 |
+
a.push({name: n, value: v[i]});
|
618 |
+
}
|
619 |
+
}
|
620 |
+
else if (v !== null && typeof v != 'undefined') {
|
621 |
+
a.push({name: this.name, value: v});
|
622 |
+
}
|
623 |
+
});
|
624 |
+
//hand off to jQuery.param for proper encoding
|
625 |
+
return $.param(a);
|
626 |
+
};
|
627 |
+
|
628 |
+
/**
|
629 |
+
* Returns the value(s) of the element in the matched set. For example, consider the following form:
|
630 |
+
*
|
631 |
+
* <form><fieldset>
|
632 |
+
* <input name="A" type="text" />
|
633 |
+
* <input name="A" type="text" />
|
634 |
+
* <input name="B" type="checkbox" value="B1" />
|
635 |
+
* <input name="B" type="checkbox" value="B2"/>
|
636 |
+
* <input name="C" type="radio" value="C1" />
|
637 |
+
* <input name="C" type="radio" value="C2" />
|
638 |
+
* </fieldset></form>
|
639 |
+
*
|
640 |
+
* var v = $(':text').fieldValue();
|
641 |
+
* // if no values are entered into the text inputs
|
642 |
+
* v == ['','']
|
643 |
+
* // if values entered into the text inputs are 'foo' and 'bar'
|
644 |
+
* v == ['foo','bar']
|
645 |
+
*
|
646 |
+
* var v = $(':checkbox').fieldValue();
|
647 |
+
* // if neither checkbox is checked
|
648 |
+
* v === undefined
|
649 |
+
* // if both checkboxes are checked
|
650 |
+
* v == ['B1', 'B2']
|
651 |
+
*
|
652 |
+
* var v = $(':radio').fieldValue();
|
653 |
+
* // if neither radio is checked
|
654 |
+
* v === undefined
|
655 |
+
* // if first radio is checked
|
656 |
+
* v == ['C1']
|
657 |
+
*
|
658 |
+
* The successful argument controls whether or not the field element must be 'successful'
|
659 |
+
* (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
|
660 |
+
* The default value of the successful argument is true. If this value is false the value(s)
|
661 |
+
* for each element is returned.
|
662 |
+
*
|
663 |
+
* Note: This method *always* returns an array. If no valid value can be determined the
|
664 |
+
* array will be empty, otherwise it will contain one or more values.
|
665 |
+
*/
|
666 |
+
$.fn.fieldValue = function(successful) {
|
667 |
+
for (var val=[], i=0, max=this.length; i < max; i++) {
|
668 |
+
var el = this[i];
|
669 |
+
var v = $.fieldValue(el, successful);
|
670 |
+
if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) {
|
671 |
+
continue;
|
672 |
+
}
|
673 |
+
v.constructor == Array ? $.merge(val, v) : val.push(v);
|
674 |
+
}
|
675 |
+
return val;
|
676 |
+
};
|
677 |
+
|
678 |
+
/**
|
679 |
+
* Returns the value of the field element.
|
680 |
+
*/
|
681 |
+
$.fieldValue = function(el, successful) {
|
682 |
+
var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
|
683 |
+
if (successful === undefined) {
|
684 |
+
successful = true;
|
685 |
+
}
|
686 |
+
|
687 |
+
if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
|
688 |
+
(t == 'checkbox' || t == 'radio') && !el.checked ||
|
689 |
+
(t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
|
690 |
+
tag == 'select' && el.selectedIndex == -1)) {
|
691 |
+
return null;
|
692 |
+
}
|
693 |
+
|
694 |
+
if (tag == 'select') {
|
695 |
+
var index = el.selectedIndex;
|
696 |
+
if (index < 0) {
|
697 |
+
return null;
|
698 |
+
}
|
699 |
+
var a = [], ops = el.options;
|
700 |
+
var one = (t == 'select-one');
|
701 |
+
var max = (one ? index+1 : ops.length);
|
702 |
+
for(var i=(one ? index : 0); i < max; i++) {
|
703 |
+
var op = ops[i];
|
704 |
+
if (op.selected) {
|
705 |
+
var v = op.value;
|
706 |
+
if (!v) { // extra pain for IE...
|
707 |
+
v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
|
708 |
+
}
|
709 |
+
if (one) {
|
710 |
+
return v;
|
711 |
+
}
|
712 |
+
a.push(v);
|
713 |
+
}
|
714 |
+
}
|
715 |
+
return a;
|
716 |
+
}
|
717 |
+
return $(el).val();
|
718 |
+
};
|
719 |
+
|
720 |
+
/**
|
721 |
+
* Clears the form data. Takes the following actions on the form's input fields:
|
722 |
+
* - input text fields will have their 'value' property set to the empty string
|
723 |
+
* - select elements will have their 'selectedIndex' property set to -1
|
724 |
+
* - checkbox and radio inputs will have their 'checked' property set to false
|
725 |
+
* - inputs of type submit, button, reset, and hidden will *not* be effected
|
726 |
+
* - button elements will *not* be effected
|
727 |
+
*/
|
728 |
+
$.fn.clearForm = function() {
|
729 |
+
return this.each(function() {
|
730 |
+
$('input,select,textarea', this).clearFields();
|
731 |
+
});
|
732 |
+
};
|
733 |
+
|
734 |
+
/**
|
735 |
+
* Clears the selected form elements.
|
736 |
+
*/
|
737 |
+
$.fn.clearFields = $.fn.clearInputs = function() {
|
738 |
+
return this.each(function() {
|
739 |
+
var t = this.type, tag = this.tagName.toLowerCase();
|
740 |
+
if (t == 'text' || t == 'password' || tag == 'textarea') {
|
741 |
+
this.value = '';
|
742 |
+
}
|
743 |
+
else if (t == 'checkbox' || t == 'radio') {
|
744 |
+
this.checked = false;
|
745 |
+
}
|
746 |
+
else if (tag == 'select') {
|
747 |
+
this.selectedIndex = -1;
|
748 |
+
}
|
749 |
+
});
|
750 |
+
};
|
751 |
+
|
752 |
+
/**
|
753 |
+
* Resets the form data. Causes all form elements to be reset to their original value.
|
754 |
+
*/
|
755 |
+
$.fn.resetForm = function() {
|
756 |
+
return this.each(function() {
|
757 |
+
// guard against an input with the name of 'reset'
|
758 |
+
// note that IE reports the reset function as an 'object'
|
759 |
+
if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) {
|
760 |
+
this.reset();
|
761 |
+
}
|
762 |
+
});
|
763 |
+
};
|
764 |
+
|
765 |
+
/**
|
766 |
+
* Enables or disables any matching elements.
|
767 |
+
*/
|
768 |
+
$.fn.enable = function(b) {
|
769 |
+
if (b === undefined) {
|
770 |
+
b = true;
|
771 |
+
}
|
772 |
+
return this.each(function() {
|
773 |
+
this.disabled = !b;
|
774 |
+
});
|
775 |
+
};
|
776 |
+
|
777 |
+
/**
|
778 |
+
* Checks/unchecks any matching checkboxes or radio buttons and
|
779 |
+
* selects/deselects and matching option elements.
|
780 |
+
*/
|
781 |
+
$.fn.selected = function(select) {
|
782 |
+
if (select === undefined) {
|
783 |
+
select = true;
|
784 |
+
}
|
785 |
+
return this.each(function() {
|
786 |
+
var t = this.type;
|
787 |
+
if (t == 'checkbox' || t == 'radio') {
|
788 |
+
this.checked = select;
|
789 |
+
}
|
790 |
+
else if (this.tagName.toLowerCase() == 'option') {
|
791 |
+
var $sel = $(this).parent('select');
|
792 |
+
if (select && $sel[0] && $sel[0].type == 'select-one') {
|
793 |
+
// deselect all other options
|
794 |
+
$sel.find('option').selected(false);
|
795 |
+
}
|
796 |
+
this.selected = select;
|
797 |
+
}
|
798 |
+
});
|
799 |
+
};
|
800 |
+
|
801 |
+
// helper fn for console logging
|
802 |
+
// set $.fn.ajaxSubmit.debug to true to enable debug logging
|
803 |
+
function log() {
|
804 |
+
if ($.fn.ajaxSubmit.debug) {
|
805 |
+
var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,'');
|
806 |
+
if (window.console && window.console.log) {
|
807 |
+
window.console.log(msg);
|
808 |
+
}
|
809 |
+
else if (window.opera && window.opera.postError) {
|
810 |
+
window.opera.postError(msg);
|
811 |
+
}
|
812 |
+
}
|
813 |
+
};
|
814 |
+
|
815 |
+
})(jQuery);
|
assets/js/galleries-shortcodes.js
CHANGED
@@ -1,62 +1,62 @@
|
|
1 |
-
jQuery( document ).ready( function ( $ ) {
|
2 |
-
// Enable sliders
|
3 |
-
$( '.su-slider' ).each( function () {
|
4 |
-
// Prepare data
|
5 |
-
var $slider = $( this );
|
6 |
-
// Apply Swiper
|
7 |
-
var $swiper = $slider.swiper( {
|
8 |
-
wrapperClass: 'su-slider-slides',
|
9 |
-
slideClass: 'su-slider-slide',
|
10 |
-
slideActiveClass: 'su-slider-slide-active',
|
11 |
-
slideVisibleClass: 'su-slider-slide-visible',
|
12 |
-
pagination: '#' + $slider.attr( 'id' ) + ' .su-slider-pagination',
|
13 |
-
autoplay: $slider.data( 'autoplay' ),
|
14 |
-
paginationClickable: true,
|
15 |
-
grabCursor: true,
|
16 |
-
mode: 'horizontal',
|
17 |
-
mousewheelControl: $slider.data( 'mousewheel' ),
|
18 |
-
speed: $slider.data( 'speed' ),
|
19 |
-
calculateHeight: $slider.hasClass( 'su-slider-responsive-yes' ),
|
20 |
-
loop: true
|
21 |
-
} );
|
22 |
-
// Prev button
|
23 |
-
$slider.find( '.su-slider-prev' ).click( function ( e ) {
|
24 |
-
$swiper.swipeNext();
|
25 |
-
} );
|
26 |
-
// Next button
|
27 |
-
$slider.find( '.su-slider-next' ).click( function ( e ) {
|
28 |
-
$swiper.swipePrev();
|
29 |
-
} );
|
30 |
-
} );
|
31 |
-
// Enable carousels
|
32 |
-
$( '.su-carousel' ).each( function () {
|
33 |
-
// Prepare data
|
34 |
-
var $carousel = $( this ), $slides = $carousel.find( '.su-carousel-slide' );
|
35 |
-
// Apply Swiper
|
36 |
-
var $swiper = $carousel.swiper( {
|
37 |
-
wrapperClass: 'su-carousel-slides',
|
38 |
-
slideClass: 'su-carousel-slide',
|
39 |
-
slideActiveClass: 'su-carousel-slide-active',
|
40 |
-
slideVisibleClass: 'su-carousel-slide-visible',
|
41 |
-
pagination: '#' + $carousel.attr( 'id' ) + ' .su-carousel-pagination',
|
42 |
-
autoplay: $carousel.data( 'autoplay' ),
|
43 |
-
paginationClickable: true,
|
44 |
-
grabCursor: true,
|
45 |
-
mode: 'horizontal',
|
46 |
-
mousewheelControl: $carousel.data( 'mousewheel' ),
|
47 |
-
speed: $carousel.data( 'speed' ),
|
48 |
-
slidesPerView: ($carousel.data( 'items' ) > $slides.length) ? $slides.length : $carousel.data( 'items' ),
|
49 |
-
slidesPerGroup: $carousel.data( 'scroll' ),
|
50 |
-
calculateHeight: $carousel.hasClass( 'su-carousel-responsive-yes' ),
|
51 |
-
loop: true
|
52 |
-
} );
|
53 |
-
// Prev button
|
54 |
-
$carousel.find( '.su-carousel-prev' ).click( function ( e ) {
|
55 |
-
$swiper.swipeNext();
|
56 |
-
} );
|
57 |
-
// Next button
|
58 |
-
$carousel.find( '.su-carousel-next' ).click( function ( e ) {
|
59 |
-
$swiper.swipePrev();
|
60 |
-
} );
|
61 |
-
} );
|
62 |
} );
|
1 |
+
jQuery( document ).ready( function ( $ ) {
|
2 |
+
// Enable sliders
|
3 |
+
$( '.su-slider' ).each( function () {
|
4 |
+
// Prepare data
|
5 |
+
var $slider = $( this );
|
6 |
+
// Apply Swiper
|
7 |
+
var $swiper = $slider.swiper( {
|
8 |
+
wrapperClass: 'su-slider-slides',
|
9 |
+
slideClass: 'su-slider-slide',
|
10 |
+
slideActiveClass: 'su-slider-slide-active',
|
11 |
+
slideVisibleClass: 'su-slider-slide-visible',
|
12 |
+
pagination: '#' + $slider.attr( 'id' ) + ' .su-slider-pagination',
|
13 |
+
autoplay: $slider.data( 'autoplay' ),
|
14 |
+
paginationClickable: true,
|
15 |
+
grabCursor: true,
|
16 |
+
mode: 'horizontal',
|
17 |
+
mousewheelControl: $slider.data( 'mousewheel' ),
|
18 |
+
speed: $slider.data( 'speed' ),
|
19 |
+
calculateHeight: $slider.hasClass( 'su-slider-responsive-yes' ),
|
20 |
+
loop: true
|
21 |
+
} );
|
22 |
+
// Prev button
|
23 |
+
$slider.find( '.su-slider-prev' ).click( function ( e ) {
|
24 |
+
$swiper.swipeNext();
|
25 |
+
} );
|
26 |
+
// Next button
|
27 |
+
$slider.find( '.su-slider-next' ).click( function ( e ) {
|
28 |
+
$swiper.swipePrev();
|
29 |
+
} );
|
30 |
+
} );
|
31 |
+
// Enable carousels
|
32 |
+
$( '.su-carousel' ).each( function () {
|
33 |
+
// Prepare data
|
34 |
+
var $carousel = $( this ), $slides = $carousel.find( '.su-carousel-slide' );
|
35 |
+
// Apply Swiper
|
36 |
+
var $swiper = $carousel.swiper( {
|
37 |
+
wrapperClass: 'su-carousel-slides',
|
38 |
+
slideClass: 'su-carousel-slide',
|
39 |
+
slideActiveClass: 'su-carousel-slide-active',
|
40 |
+
slideVisibleClass: 'su-carousel-slide-visible',
|
41 |
+
pagination: '#' + $carousel.attr( 'id' ) + ' .su-carousel-pagination',
|
42 |
+
autoplay: $carousel.data( 'autoplay' ),
|
43 |
+
paginationClickable: true,
|
44 |
+
grabCursor: true,
|
45 |
+
mode: 'horizontal',
|
46 |
+
mousewheelControl: $carousel.data( 'mousewheel' ),
|
47 |
+
speed: $carousel.data( 'speed' ),
|
48 |
+
slidesPerView: ($carousel.data( 'items' ) > $slides.length) ? $slides.length : $carousel.data( 'items' ),
|
49 |
+
slidesPerGroup: $carousel.data( 'scroll' ),
|
50 |
+
calculateHeight: $carousel.hasClass( 'su-carousel-responsive-yes' ),
|
51 |
+
loop: true
|
52 |
+
} );
|
53 |
+
// Prev button
|
54 |
+
$carousel.find( '.su-carousel-prev' ).click( function ( e ) {
|
55 |
+
$swiper.swipeNext();
|
56 |
+
} );
|
57 |
+
// Next button
|
58 |
+
$carousel.find( '.su-carousel-next' ).click( function ( e ) {
|
59 |
+
$swiper.swipePrev();
|
60 |
+
} );
|
61 |
+
} );
|
62 |
} );
|
assets/js/generator.js
CHANGED
@@ -1,444 +1,444 @@
|
|
1 |
-
jQuery(document).ready(function ($) {
|
2 |
-
|
3 |
-
// Prepare data
|
4 |
-
var $generator = $('#su-generator'),
|
5 |
-
$search = $('#su-generator-search'),
|
6 |
-
$filter = $('#su-generator-filter'),
|
7 |
-
$filters = $filter.children('a'),
|
8 |
-
$choices = $('#su-generator-choices'),
|
9 |
-
$choice = $choices.find('span'),
|
10 |
-
$settings = $('#su-generator-settings'),
|
11 |
-
$button = $('.su-generator-button'),
|
12 |
-
$cancel = $('.su-generator-cancel'),
|
13 |
-
$insert = $('#su-generator-insert'),
|
14 |
-
$prefix = $('#su-compatibility-mode-prefix'),
|
15 |
-
$another = $('#su-generator-select-another'),
|
16 |
-
$result = $('#su-generator-result'),
|
17 |
-
$selected = $('#su-generator-selected'),
|
18 |
-
$preview_link = $('#su-generator-preview-link'),
|
19 |
-
mce_selection = '';
|
20 |
-
|
21 |
-
// Apply qTip to choices
|
22 |
-
$choice.each(function () {
|
23 |
-
var $c = $(this);
|
24 |
-
if ($c.attr('title') != '') $c.qtip({
|
25 |
-
style: {
|
26 |
-
name: 'dark',
|
27 |
-
tip: 'bottomMiddle',
|
28 |
-
background: '#303030',
|
29 |
-
border: {
|
30 |
-
width: 3,
|
31 |
-
radius: 5
|
32 |
-
}
|
33 |
-
},
|
34 |
-
show: {
|
35 |
-
effect: {
|
36 |
-
length: 0
|
37 |
-
}
|
38 |
-
},
|
39 |
-
position: {
|
40 |
-
corner: {
|
41 |
-
tooltip: 'bottomMiddle',
|
42 |
-
target: 'topMiddle'
|
43 |
-
}
|
44 |
-
}
|
45 |
-
});
|
46 |
-
});
|
47 |
-
|
48 |
-
// Generator button
|
49 |
-
$button.live('click', function (e) {
|
50 |
-
e.preventDefault();
|
51 |
-
// Save the target
|
52 |
-
window.su_generator_target = $(this).data('target');
|
53 |
-
// Get open shortcode
|
54 |
-
var shortcode = $(this).data('shortcode');
|
55 |
-
// Open magnificPopup
|
56 |
-
$(this).magnificPopup({
|
57 |
-
type: 'inline',
|
58 |
-
alignTop: true,
|
59 |
-
callbacks: {
|
60 |
-
open: function () {
|
61 |
-
// Open queried shortcode
|
62 |
-
if (shortcode) $choice.filter('[data-shortcode="' + shortcode + '"]').trigger('click');
|
63 |
-
// Focus search field when popup is opened
|
64 |
-
else window.setTimeout(function () {
|
65 |
-
$search.focus();
|
66 |
-
}, 200);
|
67 |
-
// Save selection
|
68 |
-
mce_selection = (typeof tinyMCE !== 'undefined') ? tinyMCE.activeEditor.selection.getContent({
|
69 |
-
format: "text"
|
70 |
-
}) : '';
|
71 |
-
},
|
72 |
-
close: function () {
|
73 |
-
// Clear search field
|
74 |
-
$search.val('');
|
75 |
-
// Hide settings
|
76 |
-
$settings.html('').hide();
|
77 |
-
// Remove narrow class
|
78 |
-
$generator.removeClass('su-generator-narrow');
|
79 |
-
// Show filters
|
80 |
-
$filter.show();
|
81 |
-
// Show choices panel
|
82 |
-
$choices.show();
|
83 |
-
$choice.show();
|
84 |
-
// Clear selection
|
85 |
-
mce_selection = '';
|
86 |
-
}
|
87 |
-
}
|
88 |
-
}).magnificPopup('open');
|
89 |
-
});
|
90 |
-
|
91 |
-
// Filters
|
92 |
-
$filters.click(function (e) {
|
93 |
-
// Prepare data
|
94 |
-
var filter = $(this).data('filter');
|
95 |
-
// If filter All, show all choices
|
96 |
-
if (filter === 'all') $choice.show();
|
97 |
-
// Else run search
|
98 |
-
else {
|
99 |
-
var regex = new RegExp(filter, 'gi');
|
100 |
-
// Hide all choices
|
101 |
-
$choice.hide();
|
102 |
-
// Find searched choices and show
|
103 |
-
$choice.each(function () {
|
104 |
-
// Get shortcode name
|
105 |
-
var group = $(this).data('group');
|
106 |
-
// Show choice if matched
|
107 |
-
if (group.match(regex) !== null) $(this).show();
|
108 |
-
});
|
109 |
-
}
|
110 |
-
e.preventDefault();
|
111 |
-
});
|
112 |
-
|
113 |
-
// Select another shortcode link
|
114 |
-
$another.live('click', function (e) {
|
115 |
-
// Clear search field
|
116 |
-
$search.val('');
|
117 |
-
// Hide settings
|
118 |
-
$settings.html('').hide();
|
119 |
-
// Remove narrow class
|
120 |
-
$generator.removeClass('su-generator-narrow');
|
121 |
-
// Show filters
|
122 |
-
$filter.show();
|
123 |
-
// Show choices panel
|
124 |
-
$choices.show();
|
125 |
-
$choice.show();
|
126 |
-
// Clear selection
|
127 |
-
mce_selection = '';
|
128 |
-
// Focus search field
|
129 |
-
$search.focus();
|
130 |
-
e.preventDefault();
|
131 |
-
});
|
132 |
-
|
133 |
-
// Generator close button
|
134 |
-
$cancel.live('click', function (e) {
|
135 |
-
// Close popup
|
136 |
-
$.magnificPopup.close();
|
137 |
-
// Prevent default action
|
138 |
-
e.preventDefault();
|
139 |
-
});
|
140 |
-
|
141 |
-
// Search field
|
142 |
-
$search.on({
|
143 |
-
focus: function () {
|
144 |
-
// Clear field
|
145 |
-
$(this).val('');
|
146 |
-
// Hide settings
|
147 |
-
$settings.html('').hide();
|
148 |
-
// Remove narrow class
|
149 |
-
$generator.removeClass('su-generator-narrow');
|
150 |
-
// Show choices panel
|
151 |
-
$choices.show();
|
152 |
-
$choice.show();
|
153 |
-
// Show filters
|
154 |
-
$filter.show();
|
155 |
-
},
|
156 |
-
blur: function () {},
|
157 |
-
keyup: function (e) {
|
158 |
-
var val = $(this).val(),
|
159 |
-
regex = new RegExp(val, 'gi');
|
160 |
-
// Hide all choices
|
161 |
-
$choice.hide();
|
162 |
-
// Find searched choices and show
|
163 |
-
$choice.each(function () {
|
164 |
-
// Get shortcode name
|
165 |
-
var name = $(this).children('strong').text(),
|
166 |
-
desc = $(this).data('desc'),
|
167 |
-
group = $(this).data('group');
|
168 |
-
// Show choice if matched
|
169 |
-
if (name.match(regex) !== null) $(this).show();
|
170 |
-
else
|
171 |
-
if (desc.match(regex) !== null) $(this).show();
|
172 |
-
else
|
173 |
-
if (group.match(regex) !== null) $(this).show();
|
174 |
-
});
|
175 |
-
}
|
176 |
-
});
|
177 |
-
|
178 |
-
// Click on shortcode choice
|
179 |
-
$choice.on('click', function (e) {
|
180 |
-
// Prepare data
|
181 |
-
var shortcode = $(this).data('shortcode');
|
182 |
-
// Load shortcode options
|
183 |
-
$.ajax({
|
184 |
-
type: 'POST',
|
185 |
-
url: ajaxurl,
|
186 |
-
data: {
|
187 |
-
action: 'su_generator_settings',
|
188 |
-
shortcode: shortcode
|
189 |
-
},
|
190 |
-
beforeSend: function () {
|
191 |
-
// Hide preview box
|
192 |
-
$('#su-generator-preview').hide();
|
193 |
-
// Hide choices panel
|
194 |
-
$choices.hide();
|
195 |
-
// Show loading animation
|
196 |
-
$settings.addClass('su-loading-animation').show();
|
197 |
-
// Add narrow class
|
198 |
-
$generator.addClass('su-generator-narrow');
|
199 |
-
// Hide filters
|
200 |
-
$filter.hide();
|
201 |
-
},
|
202 |
-
success: function (data) {
|
203 |
-
// Hide loading animation
|
204 |
-
$settings.removeClass('su-loading-animation');
|
205 |
-
// Insert new HTML
|
206 |
-
$settings.html(data);
|
207 |
-
// Apply selected text to the content field
|
208 |
-
if (typeof mce_selection !== 'undefined' && mce_selection !== '') $('#su-generator-content').val(mce_selection);
|
209 |
-
// Init color pickers
|
210 |
-
$('.su-generator-select-color').each(function (index) {
|
211 |
-
$(this).find('.su-generator-select-color-wheel').filter(':first').farbtastic('.su-generator-select-color-value:eq(' +
|
212 |
-
index + ')');
|
213 |
-
$(this).find('.su-generator-select-color-value').focus(function () {
|
214 |
-
$('.su-generator-select-color-wheel:eq(' + index + ')').show();
|
215 |
-
});
|
216 |
-
$(this).find('.su-generator-select-color-value').blur(function () {
|
217 |
-
$('.su-generator-select-color-wheel:eq(' + index + ')').hide();
|
218 |
-
});
|
219 |
-
});
|
220 |
-
// Init reload galleries links
|
221 |
-
$('.su-generator-reload-galleries').each(function () {
|
222 |
-
var $attr = $(this).parents('.su-generator-attr-container'),
|
223 |
-
$list = $attr.find('select:first');
|
224 |
-
$(this).click(function (e) {
|
225 |
-
e.preventDefault();
|
226 |
-
// Perform request
|
227 |
-
$.ajax({
|
228 |
-
type: 'POST',
|
229 |
-
url: ajaxurl,
|
230 |
-
data: {
|
231 |
-
action: 'su_generator_galleries'
|
232 |
-
},
|
233 |
-
beforeSend: function () {
|
234 |
-
$attr.addClass('su-generator-uploading');
|
235 |
-
$list.html('<option value="0">' + $list.data('loading') + '…</option>');
|
236 |
-
},
|
237 |
-
success: function (data) {
|
238 |
-
$list.html(data).trigger('change');
|
239 |
-
$attr.removeClass('su-generator-uploading');
|
240 |
-
}
|
241 |
-
});
|
242 |
-
});
|
243 |
-
});
|
244 |
-
// Init upload buttons
|
245 |
-
$('.su-generator-upload-button input:file').each(function () {
|
246 |
-
// Prepare data
|
247 |
-
var $container = $(this).parent('span').parent('div'),
|
248 |
-
$value = $container.find('.su-generator-upload-field').children('input:text');
|
249 |
-
$(this).fileupload({
|
250 |
-
paramName: 'file',
|
251 |
-
url: ajaxurl,
|
252 |
-
formData: {
|
253 |
-
action: 'su_generator_upload'
|
254 |
-
},
|
255 |
-
dataType: 'html',
|
256 |
-
autoUpload: true,
|
257 |
-
beforeSend: function () {
|
258 |
-
// Show loading animation
|
259 |
-
$container.addClass('su-generator-uploading');
|
260 |
-
},
|
261 |
-
done: function (ev, data) {
|
262 |
-
// Hide loading animation
|
263 |
-
$container.removeClass('su-generator-uploading');
|
264 |
-
// Update text field value
|
265 |
-
$value.val(data.result).trigger('change');
|
266 |
-
}
|
267 |
-
});
|
268 |
-
});
|
269 |
-
// Init switches
|
270 |
-
$('.su-generator-switch').click(function (e) {
|
271 |
-
// Prepare data
|
272 |
-
var $switch = $(this),
|
273 |
-
$value = $switch.parent().children('input'),
|
274 |
-
is_on = !! ($value.val() ===
|
275 |
-
'yes');
|
276 |
-
// Disable
|
277 |
-
if (is_on) {
|
278 |
-
// Change class
|
279 |
-
$switch.removeClass('su-generator-switch-yes').addClass('su-generator-switch-no');
|
280 |
-
// Change value
|
281 |
-
$value.val('no').trigger('change');
|
282 |
-
}
|
283 |
-
// Enable
|
284 |
-
else {
|
285 |
-
// Change class
|
286 |
-
$switch.removeClass('su-generator-switch-no').addClass('su-generator-switch-yes');
|
287 |
-
// Change value
|
288 |
-
$value.val('yes').trigger('change');
|
289 |
-
}
|
290 |
-
e.preventDefault();
|
291 |
-
});
|
292 |
-
// Init tax_term selects
|
293 |
-
$('select#su-generator-attr-taxonomy').on('change', function () {
|
294 |
-
var $taxonomy = $(this),
|
295 |
-
taxonomy = $taxonomy.val(),
|
296 |
-
$terms = $('select#su-generator-attr-tax_term');
|
297 |
-
// Load new options
|
298 |
-
window.su_generator_get_terms = $.ajax({
|
299 |
-
type: 'POST',
|
300 |
-
url: ajaxurl,
|
301 |
-
data: {
|
302 |
-
action: 'su_generator_get_terms',
|
303 |
-
taxonomy: taxonomy
|
304 |
-
},
|
305 |
-
dataType: 'json',
|
306 |
-
beforeSend: function () {
|
307 |
-
// Check previous requests
|
308 |
-
if (typeof window.su_generator_get_terms ===
|
309 |
-
'object') window.su_generator_get_terms.abort();
|
310 |
-
// Show loading animation
|
311 |
-
$terms.parent().addClass('su-generator-uploading');
|
312 |
-
},
|
313 |
-
success: function (data) {
|
314 |
-
// Remove previous options
|
315 |
-
$terms.find('option').remove();
|
316 |
-
// Append new options
|
317 |
-
for (var slug in data) {
|
318 |
-
$terms.append('<option value="' + slug + '">' + data[slug] + '</option>');
|
319 |
-
}
|
320 |
-
// Hide loading animation
|
321 |
-
$terms.parent().removeClass('su-generator-uploading');
|
322 |
-
}
|
323 |
-
});
|
324 |
-
});
|
325 |
-
// Remove skip class when setting is changed
|
326 |
-
$settings.find('input, textarea, select').on('change keyup blur', function () {
|
327 |
-
var $cnt = $(this).parents('.su-generator-attr-container'),
|
328 |
-
_default = $cnt.data('default'),
|
329 |
-
val = $(this).val();
|
330 |
-
// Value is changed
|
331 |
-
if (val != _default) $cnt.removeClass('su-generator-skip');
|
332 |
-
else $cnt.addClass('su-generator-skip');
|
333 |
-
});
|
334 |
-
// Init value setters
|
335 |
-
$('.su-generator-set-value').click(function (e) {
|
336 |
-
$(this).parents('.su-generator-attr-container').find('input').val($(this).text()).trigger('change');
|
337 |
-
});
|
338 |
-
// Save selected value
|
339 |
-
$selected.val(shortcode);
|
340 |
-
},
|
341 |
-
dataType: 'html'
|
342 |
-
});
|
343 |
-
});
|
344 |
-
|
345 |
-
// Insert shortcode
|
346 |
-
$insert.live('click', function (e) {
|
347 |
-
// Prepare data
|
348 |
-
var shortcode = su_generator_parse();
|
349 |
-
if (typeof window.su_generator_target !== 'undefined' && window.su_generator_target !== 'content') {
|
350 |
-
// Prepare target
|
351 |
-
var $target = $('#' + window.su_generator_target);
|
352 |
-
// Insert into target
|
353 |
-
$target.val($target.val() + shortcode);
|
354 |
-
}
|
355 |
-
// Insert into editor
|
356 |
-
else window.wp.media.editor.insert(shortcode);
|
357 |
-
// Close popup
|
358 |
-
$.magnificPopup.close();
|
359 |
-
// Save shortcode to div
|
360 |
-
$result.text(shortcode);
|
361 |
-
// Prevent default action
|
362 |
-
e.preventDefault();
|
363 |
-
});
|
364 |
-
|
365 |
-
// Preview shortcode
|
366 |
-
$preview_link.live('click', function (e) {
|
367 |
-
// Prepare data
|
368 |
-
var $button = $(this);
|
369 |
-
// Update link text
|
370 |
-
$button.hide(); //.text($button.data('update-text'));
|
371 |
-
// Bind updating on settings changes
|
372 |
-
if (!$button.hasClass('su-preview-enabled')) $settings.find('input, textarea, select').on('change keyup blur', function () {
|
373 |
-
su_generator_update_preview();
|
374 |
-
});
|
375 |
-
// Add ready-class
|
376 |
-
$button.addClass('su-preview-enabled');
|
377 |
-
// Update preview box
|
378 |
-
su_generator_update_preview();
|
379 |
-
// Prevent default action
|
380 |
-
e.preventDefault();
|
381 |
-
});
|
382 |
-
|
383 |
-
function su_generator_parse() {
|
384 |
-
// Prepare data
|
385 |
-
var query = $selected.val(),
|
386 |
-
prefix = $prefix.val(),
|
387 |
-
$settings = $('#su-generator-settings .su-generator-attr-container:not(.su-generator-skip) .su-generator-attr'),
|
388 |
-
content = $('#su-generator-content').val(),
|
389 |
-
result = new String('');
|
390 |
-
// Open shortcode
|
391 |
-
result += '[' + prefix + query;
|
392 |
-
// Add shortcode attributes
|
393 |
-
$settings.each(function () {
|
394 |
-
// Prepare field and value
|
395 |
-
var $this = $(this),
|
396 |
-
value = '';
|
397 |
-
// Selects
|
398 |
-
if ($this.is('select')) value = $this.find('option:selected').val();
|
399 |
-
// Other fields
|
400 |
-
else value = $this.val();
|
401 |
-
// Check that value is not empty
|
402 |
-
if (value == null) value = '';
|
403 |
-
else if (value !== '') result += ' ' + $(this).attr('name') + '="' + $(this).val() + '"';
|
404 |
-
});
|
405 |
-
// End of opening tag
|
406 |
-
result += ']';
|
407 |
-
// Wrap shortcode if content presented
|
408 |
-
if (content != 'false') result += content + '[/' + prefix + query + ']';
|
409 |
-
// Return result
|
410 |
-
return result;
|
411 |
-
}
|
412 |
-
|
413 |
-
function su_generator_update_preview() {
|
414 |
-
// Prepare data
|
415 |
-
var $preview = $('#su-generator-preview'),
|
416 |
-
shortcode = su_generator_parse(),
|
417 |
-
previous = $result.text();
|
418 |
-
// Request new preview
|
419 |
-
if (shortcode !== previous || !$preview.is(':visible')) window.su_generator_preview_request = $.ajax({
|
420 |
-
type: 'POST',
|
421 |
-
url: ajaxurl,
|
422 |
-
cache: false,
|
423 |
-
data: {
|
424 |
-
action: 'su_generator_preview',
|
425 |
-
shortcode: shortcode
|
426 |
-
},
|
427 |
-
beforeSend: function () {
|
428 |
-
// Abort previous requests
|
429 |
-
if (typeof window.su_generator_preview_request ===
|
430 |
-
'object') window.su_generator_preview_request.abort();
|
431 |
-
// Show loading animation
|
432 |
-
$preview.addClass('su-preview-loading').html('').show();
|
433 |
-
},
|
434 |
-
success: function (data) {
|
435 |
-
// Hide loading animation and set new HTML
|
436 |
-
$preview.html(data).removeClass('su-preview-loading');
|
437 |
-
},
|
438 |
-
dataType: 'html'
|
439 |
-
});
|
440 |
-
// Save shortcode to div
|
441 |
-
$result.text(shortcode);
|
442 |
-
}
|
443 |
-
|
444 |
});
|
1 |
+
jQuery(document).ready(function ($) {
|
2 |
+
|
3 |
+
// Prepare data
|
4 |
+
var $generator = $('#su-generator'),
|
5 |
+
$search = $('#su-generator-search'),
|
6 |
+
$filter = $('#su-generator-filter'),
|
7 |
+
$filters = $filter.children('a'),
|
8 |
+
$choices = $('#su-generator-choices'),
|
9 |
+
$choice = $choices.find('span'),
|
10 |
+
$settings = $('#su-generator-settings'),
|
11 |
+
$button = $('.su-generator-button'),
|
12 |
+
$cancel = $('.su-generator-cancel'),
|
13 |
+
$insert = $('#su-generator-insert'),
|
14 |
+
$prefix = $('#su-compatibility-mode-prefix'),
|
15 |
+
$another = $('#su-generator-select-another'),
|
16 |
+
$result = $('#su-generator-result'),
|
17 |
+
$selected = $('#su-generator-selected'),
|
18 |
+
$preview_link = $('#su-generator-preview-link'),
|
19 |
+
mce_selection = '';
|
20 |
+
|
21 |
+
// Apply qTip to choices
|
22 |
+
$choice.each(function () {
|
23 |
+
var $c = $(this);
|
24 |
+
if ($c.attr('title') != '') $c.qtip({
|
25 |
+
style: {
|
26 |
+
name: 'dark',
|
27 |
+
tip: 'bottomMiddle',
|
28 |
+
background: '#303030',
|
29 |
+
border: {
|
30 |
+
width: 3,
|
31 |
+
radius: 5
|
32 |
+
}
|
33 |
+
},
|
34 |
+
show: {
|
35 |
+
effect: {
|
36 |
+
length: 0
|
37 |
+
}
|
38 |
+
},
|
39 |
+
position: {
|
40 |
+
corner: {
|
41 |
+
tooltip: 'bottomMiddle',
|
42 |
+
target: 'topMiddle'
|
43 |
+
}
|
44 |
+
}
|
45 |
+
});
|
46 |
+
});
|
47 |
+
|
48 |
+
// Generator button
|
49 |
+
$button.live('click', function (e) {
|
50 |
+
e.preventDefault();
|
51 |
+
// Save the target
|
52 |
+
window.su_generator_target = $(this).data('target');
|
53 |
+
// Get open shortcode
|
54 |
+
var shortcode = $(this).data('shortcode');
|
55 |
+
// Open magnificPopup
|
56 |
+
$(this).magnificPopup({
|
57 |
+
type: 'inline',
|
58 |
+
alignTop: true,
|
59 |
+
callbacks: {
|
60 |
+
open: function () {
|
61 |
+
// Open queried shortcode
|
62 |
+
if (shortcode) $choice.filter('[data-shortcode="' + shortcode + '"]').trigger('click');
|
63 |
+
// Focus search field when popup is opened
|
64 |
+
else window.setTimeout(function () {
|
65 |
+
$search.focus();
|
66 |
+
}, 200);
|
67 |
+
// Save selection
|
68 |
+
mce_selection = (typeof tinyMCE !== 'undefined') ? tinyMCE.activeEditor.selection.getContent({
|
69 |
+
format: "text"
|
70 |
+
}) : '';
|
71 |
+
},
|
72 |
+
close: function () {
|
73 |
+
// Clear search field
|
74 |
+
$search.val('');
|
75 |
+
// Hide settings
|
76 |
+
$settings.html('').hide();
|
77 |
+
// Remove narrow class
|
78 |
+
$generator.removeClass('su-generator-narrow');
|
79 |
+
// Show filters
|
80 |
+
$filter.show();
|
81 |
+
// Show choices panel
|
82 |
+
$choices.show();
|
83 |
+
$choice.show();
|
84 |
+
// Clear selection
|
85 |
+
mce_selection = '';
|
86 |
+
}
|
87 |
+
}
|
88 |
+
}).magnificPopup('open');
|
89 |
+
});
|
90 |
+
|
91 |
+
// Filters
|
92 |
+
$filters.click(function (e) {
|
93 |
+
// Prepare data
|
94 |
+
var filter = $(this).data('filter');
|
95 |
+
// If filter All, show all choices
|
96 |
+
if (filter === 'all') $choice.show();
|
97 |
+
// Else run search
|
98 |
+
else {
|
99 |
+
var regex = new RegExp(filter, 'gi');
|
100 |
+
// Hide all choices
|
101 |
+
$choice.hide();
|
102 |
+
// Find searched choices and show
|
103 |
+
$choice.each(function () {
|
104 |
+
// Get shortcode name
|
105 |
+
var group = $(this).data('group');
|
106 |
+
// Show choice if matched
|
107 |
+
if (group.match(regex) !== null) $(this).show();
|
108 |
+
});
|
109 |
+
}
|
110 |
+
e.preventDefault();
|
111 |
+
});
|
112 |
+
|
113 |
+
// Select another shortcode link
|
114 |
+
$another.live('click', function (e) {
|
115 |
+
// Clear search field
|
116 |
+
$search.val('');
|
117 |
+
// Hide settings
|
118 |
+
$settings.html('').hide();
|
119 |
+
// Remove narrow class
|
120 |
+
$generator.removeClass('su-generator-narrow');
|
121 |
+
// Show filters
|
122 |
+
$filter.show();
|
123 |
+
// Show choices panel
|
124 |
+
$choices.show();
|
125 |
+
$choice.show();
|
126 |
+
// Clear selection
|
127 |
+
mce_selection = '';
|
128 |
+
// Focus search field
|
129 |
+
$search.focus();
|
130 |
+
e.preventDefault();
|
131 |
+
});
|
132 |
+
|
133 |
+
// Generator close button
|
134 |
+
$cancel.live('click', function (e) {
|
135 |
+
// Close popup
|
136 |
+
$.magnificPopup.close();
|
137 |
+
// Prevent default action
|
138 |
+
e.preventDefault();
|
139 |
+
});
|
140 |
+
|
141 |
+
// Search field
|
142 |
+
$search.on({
|
143 |
+
focus: function () {
|
144 |
+
// Clear field
|
145 |
+
$(this).val('');
|
146 |
+
// Hide settings
|
147 |
+
$settings.html('').hide();
|
148 |
+
// Remove narrow class
|
149 |
+
$generator.removeClass('su-generator-narrow');
|
150 |
+
// Show choices panel
|
151 |
+
$choices.show();
|
152 |
+
$choice.show();
|
153 |
+
// Show filters
|
154 |
+
$filter.show();
|
155 |
+
},
|
156 |
+
blur: function () {},
|
157 |
+
keyup: function (e) {
|
158 |
+
var val = $(this).val(),
|
159 |
+
regex = new RegExp(val, 'gi');
|
160 |
+
// Hide all choices
|
161 |
+
$choice.hide();
|
162 |
+
// Find searched choices and show
|
163 |
+
$choice.each(function () {
|
164 |
+
// Get shortcode name
|
165 |
+
var name = $(this).children('strong').text(),
|
166 |
+
desc = $(this).data('desc'),
|
167 |
+
group = $(this).data('group');
|
168 |
+
// Show choice if matched
|
169 |
+
if (name.match(regex) !== null) $(this).show();
|
170 |
+
else
|
171 |
+
if (desc.match(regex) !== null) $(this).show();
|
172 |
+
else
|
173 |
+
if (group.match(regex) !== null) $(this).show();
|
174 |
+
});
|
175 |
+
}
|
176 |
+
});
|
177 |
+
|
178 |
+
// Click on shortcode choice
|
179 |
+
$choice.on('click', function (e) {
|
180 |
+
// Prepare data
|
181 |
+
var shortcode = $(this).data('shortcode');
|
182 |
+
// Load shortcode options
|
183 |
+
$.ajax({
|
184 |
+
type: 'POST',
|
185 |
+
url: ajaxurl,
|
186 |
+
data: {
|
187 |
+
action: 'su_generator_settings',
|
188 |
+
shortcode: shortcode
|
189 |
+
},
|
190 |
+
beforeSend: function () {
|
191 |
+
// Hide preview box
|
192 |
+
$('#su-generator-preview').hide();
|
193 |
+
// Hide choices panel
|
194 |
+
$choices.hide();
|
195 |
+
// Show loading animation
|
196 |
+
$settings.addClass('su-loading-animation').show();
|
197 |
+
// Add narrow class
|
198 |
+
$generator.addClass('su-generator-narrow');
|
199 |
+
// Hide filters
|
200 |
+
$filter.hide();
|
201 |
+
},
|
202 |
+
success: function (data) {
|
203 |
+
// Hide loading animation
|
204 |
+
$settings.removeClass('su-loading-animation');
|
205 |
+
// Insert new HTML
|
206 |
+
$settings.html(data);
|
207 |
+
// Apply selected text to the content field
|
208 |
+
if (typeof mce_selection !== 'undefined' && mce_selection !== '') $('#su-generator-content').val(mce_selection);
|
209 |
+
// Init color pickers
|
210 |
+
$('.su-generator-select-color').each(function (index) {
|
211 |
+
$(this).find('.su-generator-select-color-wheel').filter(':first').farbtastic('.su-generator-select-color-value:eq(' +
|
212 |
+
index + ')');
|
213 |
+
$(this).find('.su-generator-select-color-value').focus(function () {
|
214 |
+
$('.su-generator-select-color-wheel:eq(' + index + ')').show();
|
215 |
+
});
|
216 |
+
$(this).find('.su-generator-select-color-value').blur(function () {
|
217 |
+
$('.su-generator-select-color-wheel:eq(' + index + ')').hide();
|
218 |
+
});
|
219 |
+
});
|
220 |
+
// Init reload galleries links
|
221 |
+
$('.su-generator-reload-galleries').each(function () {
|
222 |
+
var $attr = $(this).parents('.su-generator-attr-container'),
|
223 |
+
$list = $attr.find('select:first');
|
224 |
+
$(this).click(function (e) {
|
225 |
+
e.preventDefault();
|
226 |
+
// Perform request
|
227 |
+
$.ajax({
|
228 |
+
type: 'POST',
|
229 |
+
url: ajaxurl,
|
230 |
+
data: {
|
231 |
+
action: 'su_generator_galleries'
|
232 |
+
},
|
233 |
+
beforeSend: function () {
|
234 |
+
$attr.addClass('su-generator-uploading');
|
235 |
+
$list.html('<option value="0">' + $list.data('loading') + '…</option>');
|
236 |
+
},
|
237 |
+
success: function (data) {
|
238 |
+
$list.html(data).trigger('change');
|
239 |
+
$attr.removeClass('su-generator-uploading');
|
240 |
+
}
|
241 |
+
});
|
242 |
+
});
|
243 |
+
});
|
244 |
+
// Init upload buttons
|
245 |
+
$('.su-generator-upload-button input:file').each(function () {
|
246 |
+
// Prepare data
|
247 |
+
var $container = $(this).parent('span').parent('div'),
|
248 |
+
$value = $container.find('.su-generator-upload-field').children('input:text');
|
249 |
+
$(this).fileupload({
|
250 |
+
paramName: 'file',
|
251 |
+
url: ajaxurl,
|
252 |
+
formData: {
|
253 |
+
action: 'su_generator_upload'
|
254 |
+
},
|
255 |
+
dataType: 'html',
|
256 |
+
autoUpload: true,
|
257 |
+
beforeSend: function () {
|
258 |
+
// Show loading animation
|
259 |
+
$container.addClass('su-generator-uploading');
|
260 |
+
},
|
261 |
+
done: function (ev, data) {
|
262 |
+
// Hide loading animation
|
263 |
+
$container.removeClass('su-generator-uploading');
|
264 |
+
// Update text field value
|
265 |
+
$value.val(data.result).trigger('change');
|
266 |
+
}
|
267 |
+
});
|
268 |
+
});
|
269 |
+
// Init switches
|
270 |
+
$('.su-generator-switch').click(function (e) {
|
271 |
+
// Prepare data
|
272 |
+
var $switch = $(this),
|
273 |
+
$value = $switch.parent().children('input'),
|
274 |
+
is_on = !! ($value.val() ===
|
275 |
+
'yes');
|
276 |
+
// Disable
|
277 |
+
if (is_on) {
|
278 |
+
// Change class
|
279 |
+
$switch.removeClass('su-generator-switch-yes').addClass('su-generator-switch-no');
|
280 |
+
// Change value
|
281 |
+
$value.val('no').trigger('change');
|
282 |
+
}
|
283 |
+
// Enable
|
284 |
+
else {
|
285 |
+
// Change class
|
286 |
+
$switch.removeClass('su-generator-switch-no').addClass('su-generator-switch-yes');
|
287 |
+
// Change value
|
288 |
+
$value.val('yes').trigger('change');
|
289 |
+
}
|
290 |
+
e.preventDefault();
|
291 |
+
});
|
292 |
+
// Init tax_term selects
|
293 |
+
$('select#su-generator-attr-taxonomy').on('change', function () {
|
294 |
+
var $taxonomy = $(this),
|
295 |
+
taxonomy = $taxonomy.val(),
|
296 |
+
$terms = $('select#su-generator-attr-tax_term');
|
297 |
+
// Load new options
|
298 |
+
window.su_generator_get_terms = $.ajax({
|
299 |
+
type: 'POST',
|
300 |
+
url: ajaxurl,
|
301 |
+
data: {
|
302 |
+
action: 'su_generator_get_terms',
|
303 |
+
taxonomy: taxonomy
|
304 |
+
},
|
305 |
+
dataType: 'json',
|
306 |
+
beforeSend: function () {
|
307 |
+
// Check previous requests
|
308 |
+
if (typeof window.su_generator_get_terms ===
|
309 |
+
'object') window.su_generator_get_terms.abort();
|
310 |
+
// Show loading animation
|
311 |
+
$terms.parent().addClass('su-generator-uploading');
|
312 |
+
},
|
313 |
+
success: function (data) {
|
314 |
+
// Remove previous options
|
315 |
+
$terms.find('option').remove();
|
316 |
+
// Append new options
|
317 |
+
for (var slug in data) {
|
318 |
+
$terms.append('<option value="' + slug + '">' + data[slug] + '</option>');
|
319 |
+
}
|
320 |
+
// Hide loading animation
|
321 |
+
$terms.parent().removeClass('su-generator-uploading');
|
322 |
+
}
|
323 |
+
});
|
324 |
+
});
|
325 |
+
// Remove skip class when setting is changed
|
326 |
+
$settings.find('input, textarea, select').on('change keyup blur', function () {
|
327 |
+
var $cnt = $(this).parents('.su-generator-attr-container'),
|
328 |
+
_default = $cnt.data('default'),
|
329 |
+
val = $(this).val();
|
330 |
+
// Value is changed
|
331 |
+
if (val != _default) $cnt.removeClass('su-generator-skip');
|
332 |
+
else $cnt.addClass('su-generator-skip');
|
333 |
+
});
|
334 |
+
// Init value setters
|
335 |
+
$('.su-generator-set-value').click(function (e) {
|
336 |
+
$(this).parents('.su-generator-attr-container').find('input').val($(this).text()).trigger('change');
|
337 |
+
});
|
338 |
+
// Save selected value
|
339 |
+
$selected.val(shortcode);
|
340 |
+
},
|
341 |
+
dataType: 'html'
|
342 |
+
});
|
343 |
+
});
|
344 |
+
|
345 |
+
// Insert shortcode
|
346 |
+
$insert.live('click', function (e) {
|
347 |
+
// Prepare data
|
348 |
+
var shortcode = su_generator_parse();
|
349 |
+
if (typeof window.su_generator_target !== 'undefined' && window.su_generator_target !== 'content') {
|
350 |
+
// Prepare target
|
351 |
+
var $target = $('#' + window.su_generator_target);
|
352 |
+
// Insert into target
|
353 |
+
$target.val($target.val() + shortcode);
|
354 |
+
}
|
355 |
+
// Insert into editor
|
356 |
+
else window.wp.media.editor.insert(shortcode);
|
357 |
+
// Close popup
|
358 |
+
$.magnificPopup.close();
|
359 |
+
// Save shortcode to div
|
360 |
+
$result.text(shortcode);
|
361 |
+
// Prevent default action
|
362 |
+
e.preventDefault();
|
363 |
+
});
|
364 |
+
|
365 |
+
// Preview shortcode
|
366 |
+
$preview_link.live('click', function (e) {
|
367 |
+
// Prepare data
|
368 |
+
var $button = $(this);
|
369 |
+
// Update link text
|
370 |
+
$button.hide(); //.text($button.data('update-text'));
|
371 |
+
// Bind updating on settings changes
|
372 |
+
if (!$button.hasClass('su-preview-enabled')) $settings.find('input, textarea, select').on('change keyup blur', function () {
|
373 |
+
su_generator_update_preview();
|
374 |
+
});
|
375 |
+
// Add ready-class
|
376 |
+
$button.addClass('su-preview-enabled');
|
377 |
+
// Update preview box
|
378 |
+
su_generator_update_preview();
|
379 |
+
// Prevent default action
|
380 |
+
e.preventDefault();
|
381 |
+
});
|
382 |
+
|
383 |
+
function su_generator_parse() {
|
384 |
+
// Prepare data
|
385 |
+
var query = $selected.val(),
|
386 |
+
prefix = $prefix.val(),
|
387 |
+
$settings = $('#su-generator-settings .su-generator-attr-container:not(.su-generator-skip) .su-generator-attr'),
|
388 |
+
content = $('#su-generator-content').val(),
|
389 |
+
result = new String('');
|
390 |
+
// Open shortcode
|
391 |
+
result += '[' + prefix + query;
|
392 |
+
// Add shortcode attributes
|
393 |
+
$settings.each(function () {
|
394 |
+
// Prepare field and value
|
395 |
+
var $this = $(this),
|
396 |
+
value = '';
|
397 |
+
// Selects
|
398 |
+
if ($this.is('select')) value = $this.find('option:selected').val();
|
399 |
+
// Other fields
|
400 |
+
else value = $this.val();
|
401 |
+
// Check that value is not empty
|
402 |
+
if (value == null) value = '';
|
403 |
+
else if (value !== '') result += ' ' + $(this).attr('name') + '="' + $(this).val() + '"';
|
404 |
+
});
|
405 |
+
// End of opening tag
|
406 |
+
result += ']';
|
407 |
+
// Wrap shortcode if content presented
|
408 |
+
if (content != 'false') result += content + '[/' + prefix + query + ']';
|
409 |
+
// Return result
|
410 |
+
return result;
|
411 |
+
}
|
412 |
+
|
413 |
+
function su_generator_update_preview() {
|
414 |
+
// Prepare data
|
415 |
+
var $preview = $('#su-generator-preview'),
|
416 |
+
shortcode = su_generator_parse(),
|
417 |
+
previous = $result.text();
|
418 |
+
// Request new preview
|
419 |
+
if (shortcode !== previous || !$preview.is(':visible')) window.su_generator_preview_request = $.ajax({
|
420 |
+
type: 'POST',
|
421 |
+
url: ajaxurl,
|
422 |
+
cache: false,
|
423 |
+
data: {
|
424 |
+
action: 'su_generator_preview',
|
425 |
+
shortcode: shortcode
|
426 |
+
},
|
427 |
+
beforeSend: function () {
|
428 |
+
// Abort previous requests
|
429 |
+
if (typeof window.su_generator_preview_request ===
|
430 |
+
'object') window.su_generator_preview_request.abort();
|
431 |
+
// Show loading animation
|
432 |
+
$preview.addClass('su-preview-loading').html('').show();
|
433 |
+
},
|
434 |
+
success: function (data) {
|
435 |
+
// Hide loading animation and set new HTML
|
436 |
+
$preview.html(data).removeClass('su-preview-loading');
|
437 |
+
},
|
438 |
+
dataType: 'html'
|
439 |
+
});
|
440 |
+
// Save shortcode to div
|
441 |
+
$result.text(shortcode);
|
442 |
+
}
|
443 |
+
|
444 |
});
|
assets/js/iframe-transport.js
CHANGED
@@ -1,205 +1,205 @@
|
|
1 |
-
/*
|
2 |
-
* jQuery Iframe Transport Plugin 1.7
|
3 |
-
* https://github.com/blueimp/jQuery-File-Upload
|
4 |
-
*
|
5 |
-
* Copyright 2011, Sebastian Tschan
|
6 |
-
* https://blueimp.net
|
7 |
-
*
|
8 |
-
* Licensed under the MIT license:
|
9 |
-
* http://www.opensource.org/licenses/MIT
|
10 |
-
*/
|
11 |
-
|
12 |
-
/*jslint unparam: true, nomen: true */
|
13 |
-
/*global define, window, document */
|
14 |
-
|
15 |
-
(function (factory) {
|
16 |
-
'use strict';
|
17 |
-
if (typeof define === 'function' && define.amd) {
|
18 |
-
// Register as an anonymous AMD module:
|
19 |
-
define(['jquery'], factory);
|
20 |
-
} else {
|
21 |
-
// Browser globals:
|
22 |
-
factory(window.jQuery);
|
23 |
-
}
|
24 |
-
}(function ($) {
|
25 |
-
'use strict';
|
26 |
-
|
27 |
-
// Helper variable to create unique names for the transport iframes:
|
28 |
-
var counter = 0;
|
29 |
-
|
30 |
-
// The iframe transport accepts three additional options:
|
31 |
-
// options.fileInput: a jQuery collection of file input fields
|
32 |
-
// options.paramName: the parameter name for the file form data,
|
33 |
-
// overrides the name property of the file input field(s),
|
34 |
-
// can be a string or an array of strings.
|
35 |
-
// options.formData: an array of objects with name and value properties,
|
36 |
-
// equivalent to the return data of .serializeArray(), e.g.:
|
37 |
-
// [{name: 'a', value: 1}, {name: 'b', value: 2}]
|
38 |
-
$.ajaxTransport('iframe', function (options) {
|
39 |
-
if (options.async) {
|
40 |
-
var form,
|
41 |
-
iframe,
|
42 |
-
addParamChar;
|
43 |
-
return {
|
44 |
-
send: function (_, completeCallback) {
|
45 |
-
form = $('<form style="display:none;"></form>');
|
46 |
-
form.attr('accept-charset', options.formAcceptCharset);
|
47 |
-
addParamChar = /\?/.test(options.url) ? '&' : '?';
|
48 |
-
// XDomainRequest only supports GET and POST:
|
49 |
-
if (options.type === 'DELETE') {
|
50 |
-
options.url = options.url + addParamChar + '_method=DELETE';
|
51 |
-
options.type = 'POST';
|
52 |
-
} else if (options.type === 'PUT') {
|
53 |
-
options.url = options.url + addParamChar + '_method=PUT';
|
54 |
-
options.type = 'POST';
|
55 |
-
} else if (options.type === 'PATCH') {
|
56 |
-
options.url = options.url + addParamChar + '_method=PATCH';
|
57 |
-
options.type = 'POST';
|
58 |
-
}
|
59 |
-
// javascript:false as initial iframe src
|
60 |
-
// prevents warning popups on HTTPS in IE6.
|
61 |
-
// IE versions below IE8 cannot set the name property of
|
62 |
-
// elements that have already been added to the DOM,
|
63 |
-
// so we set the name along with the iframe HTML markup:
|
64 |
-
counter += 1;
|
65 |
-
iframe = $(
|
66 |
-
'<iframe src="javascript:false;" name="iframe-transport-' +
|
67 |
-
counter + '"></iframe>'
|
68 |
-
).bind('load', function () {
|
69 |
-
var fileInputClones,
|
70 |
-
paramNames = $.isArray(options.paramName) ?
|
71 |
-
options.paramName : [options.paramName];
|
72 |
-
iframe
|
73 |
-
.unbind('load')
|
74 |
-
.bind('load', function () {
|
75 |
-
var response;
|
76 |
-
// Wrap in a try/catch block to catch exceptions thrown
|
77 |
-
// when trying to access cross-domain iframe contents:
|
78 |
-
try {
|
79 |
-
response = iframe.contents();
|
80 |
-
// Google Chrome and Firefox do not throw an
|
81 |
-
// exception when calling iframe.contents() on
|
82 |
-
// cross-domain requests, so we unify the response:
|
83 |
-
if (!response.length || !response[0].firstChild) {
|
84 |
-
throw new Error();
|
85 |
-
}
|
86 |
-
} catch (e) {
|
87 |
-
response = undefined;
|
88 |
-
}
|
89 |
-
// The complete callback returns the
|
90 |
-
// iframe content document as response object:
|
91 |
-
completeCallback(
|
92 |
-
200,
|
93 |
-
'success',
|
94 |
-
{'iframe': response}
|
95 |
-
);
|
96 |
-
// Fix for IE endless progress bar activity bug
|
97 |
-
// (happens on form submits to iframe targets):
|
98 |
-
$('<iframe src="javascript:false;"></iframe>')
|
99 |
-
.appendTo(form);
|
100 |
-
window.setTimeout(function () {
|
101 |
-
// Removing the form in a setTimeout call
|
102 |
-
// allows Chrome's developer tools to display
|
103 |
-
// the response result
|
104 |
-
form.remove();
|
105 |
-
}, 0);
|
106 |
-
});
|
107 |
-
form
|
108 |
-
.prop('target', iframe.prop('name'))
|
109 |
-
.prop('action', options.url)
|
110 |
-
.prop('method', options.type);
|
111 |
-
if (options.formData) {
|
112 |
-
$.each(options.formData, function (index, field) {
|
113 |
-
$('<input type="hidden"/>')
|
114 |
-
.prop('name', field.name)
|
115 |
-
.val(field.value)
|
116 |
-
.appendTo(form);
|
117 |
-
});
|
118 |
-
}
|
119 |
-
if (options.fileInput && options.fileInput.length &&
|
120 |
-
options.type === 'POST') {
|
121 |
-
fileInputClones = options.fileInput.clone();
|
122 |
-
// Insert a clone for each file input field:
|
123 |
-
options.fileInput.after(function (index) {
|
124 |
-
return fileInputClones[index];
|
125 |
-
});
|
126 |
-
if (options.paramName) {
|
127 |
-
options.fileInput.each(function (index) {
|
128 |
-
$(this).prop(
|
129 |
-
'name',
|
130 |
-
paramNames[index] || options.paramName
|
131 |
-
);
|
132 |
-
});
|
133 |
-
}
|
134 |
-
// Appending the file input fields to the hidden form
|
135 |
-
// removes them from their original location:
|
136 |
-
form
|
137 |
-
.append(options.fileInput)
|
138 |
-
.prop('enctype', 'multipart/form-data')
|
139 |
-
// enctype must be set as encoding for IE:
|
140 |
-
.prop('encoding', 'multipart/form-data');
|
141 |
-
}
|
142 |
-
form.submit();
|
143 |
-
// Insert the file input fields at their original location
|
144 |
-
// by replacing the clones with the originals:
|
145 |
-
if (fileInputClones && fileInputClones.length) {
|
146 |
-
options.fileInput.each(function (index, input) {
|
147 |
-
var clone = $(fileInputClones[index]);
|
148 |
-
$(input).prop('name', clone.prop('name'));
|
149 |
-
clone.replaceWith(input);
|
150 |
-
});
|
151 |
-
}
|
152 |
-
});
|
153 |
-
form.append(iframe).appendTo(document.body);
|
154 |
-
},
|
155 |
-
abort: function () {
|
156 |
-
if (iframe) {
|
157 |
-
// javascript:false as iframe src aborts the request
|
158 |
-
// and prevents warning popups on HTTPS in IE6.
|
159 |
-
// concat is used to avoid the "Script URL" JSLint error:
|
160 |
-
iframe
|
161 |
-
.unbind('load')
|
162 |
-
.prop('src', 'javascript'.concat(':false;'));
|
163 |
-
}
|
164 |
-
if (form) {
|
165 |
-
form.remove();
|
166 |
-
}
|
167 |
-
}
|
168 |
-
};
|
169 |
-
}
|
170 |
-
});
|
171 |
-
|
172 |
-
// The iframe transport returns the iframe content document as response.
|
173 |
-
// The following adds converters from iframe to text, json, html, xml
|
174 |
-
// and script.
|
175 |
-
// Please note that the Content-Type for JSON responses has to be text/plain
|
176 |
-
// or text/html, if the browser doesn't include application/json in the
|
177 |
-
// Accept header, else IE will show a download dialog.
|
178 |
-
// The Content-Type for XML responses on the other hand has to be always
|
179 |
-
// application/xml or text/xml, so IE properly parses the XML response.
|
180 |
-
// See also
|
181 |
-
// https://github.com/blueimp/jQuery-File-Upload/wiki/Setup#content-type-negotiation
|
182 |
-
$.ajaxSetup({
|
183 |
-
converters: {
|
184 |
-
'iframe text': function (iframe) {
|
185 |
-
return iframe && $(iframe[0].body).text();
|
186 |
-
},
|
187 |
-
'iframe json': function (iframe) {
|
188 |
-
return iframe && $.parseJSON($(iframe[0].body).text());
|
189 |
-
},
|
190 |
-
'iframe html': function (iframe) {
|
191 |
-
return iframe && $(iframe[0].body).html();
|
192 |
-
},
|
193 |
-
'iframe xml': function (iframe) {
|
194 |
-
var xmlDoc = iframe && iframe[0];
|
195 |
-
return xmlDoc && $.isXMLDoc(xmlDoc) ? xmlDoc :
|
196 |
-
$.parseXML((xmlDoc.XMLDocument && xmlDoc.XMLDocument.xml) ||
|
197 |
-
$(xmlDoc.body).html());
|
198 |
-
},
|
199 |
-
'iframe script': function (iframe) {
|
200 |
-
return iframe && $.globalEval($(iframe[0].body).text());
|
201 |
-
}
|
202 |
-
}
|
203 |
-
});
|
204 |
-
|
205 |
-
}));
|
1 |
+
/*
|
2 |
+
* jQuery Iframe Transport Plugin 1.7
|
3 |
+
* https://github.com/blueimp/jQuery-File-Upload
|
4 |
+
*
|
5 |
+
* Copyright 2011, Sebastian Tschan
|
6 |
+
* https://blueimp.net
|
7 |
+
*
|
8 |
+
* Licensed under the MIT license:
|
9 |
+
* http://www.opensource.org/licenses/MIT
|
10 |
+
*/
|
11 |
+
|
12 |
+
/*jslint unparam: true, nomen: true */
|
13 |
+
/*global define, window, document */
|
14 |
+
|
15 |
+
(function (factory) {
|
16 |
+
'use strict';
|
17 |
+
if (typeof define === 'function' && define.amd) {
|
18 |
+
// Register as an anonymous AMD module:
|
19 |
+
define(['jquery'], factory);
|
20 |
+
} else {
|
21 |
+
// Browser globals:
|
22 |
+
factory(window.jQuery);
|
23 |
+
}
|
24 |
+
}(function ($) {
|
25 |
+
'use strict';
|
26 |
+
|
27 |
+
// Helper variable to create unique names for the transport iframes:
|
28 |
+
var counter = 0;
|
29 |
+
|
30 |
+
// The iframe transport accepts three additional options:
|
31 |
+
// options.fileInput: a jQuery collection of file input fields
|
32 |
+
// options.paramName: the parameter name for the file form data,
|
33 |
+
// overrides the name property of the file input field(s),
|
34 |
+
// can be a string or an array of strings.
|
35 |
+
// options.formData: an array of objects with name and value properties,
|
36 |
+
// equivalent to the return data of .serializeArray(), e.g.:
|
37 |
+
// [{name: 'a', value: 1}, {name: 'b', value: 2}]
|
38 |
+
$.ajaxTransport('iframe', function (options) {
|
39 |
+
if (options.async) {
|
40 |
+
var form,
|
41 |
+
iframe,
|
42 |
+
addParamChar;
|
43 |
+
return {
|
44 |
+
send: function (_, completeCallback) {
|
45 |
+
form = $('<form style="display:none;"></form>');
|
46 |
+
form.attr('accept-charset', options.formAcceptCharset);
|
47 |
+
addParamChar = /\?/.test(options.url) ? '&' : '?';
|
48 |
+
// XDomainRequest only supports GET and POST:
|
49 |
+
if (options.type === 'DELETE') {
|
50 |
+
options.url = options.url + addParamChar + '_method=DELETE';
|
51 |
+
options.type = 'POST';
|
52 |
+
} else if (options.type === 'PUT') {
|
53 |
+
options.url = options.url + addParamChar + '_method=PUT';
|
54 |
+
options.type = 'POST';
|
55 |
+
} else if (options.type === 'PATCH') {
|
56 |
+
options.url = options.url + addParamChar + '_method=PATCH';
|
57 |
+
options.type = 'POST';
|
58 |
+
}
|
59 |
+
// javascript:false as initial iframe src
|
60 |
+
// prevents warning popups on HTTPS in IE6.
|
61 |
+
// IE versions below IE8 cannot set the name property of
|
62 |
+
// elements that have already been added to the DOM,
|
63 |
+
// so we set the name along with the iframe HTML markup:
|
64 |
+
counter += 1;
|
65 |
+
iframe = $(
|
66 |
+
'<iframe src="javascript:false;" name="iframe-transport-' +
|
67 |
+
counter + '"></iframe>'
|
68 |
+
).bind('load', function () {
|
69 |
+
var fileInputClones,
|
70 |
+
paramNames = $.isArray(options.paramName) ?
|
71 |
+
options.paramName : [options.paramName];
|
72 |
+
iframe
|
73 |
+
.unbind('load')
|
74 |
+
.bind('load', function () {
|
75 |
+
var response;
|
76 |
+
// Wrap in a try/catch block to catch exceptions thrown
|
77 |
+
// when trying to access cross-domain iframe contents:
|
78 |
+
try {
|
79 |
+
response = iframe.contents();
|
80 |
+
// Google Chrome and Firefox do not throw an
|
81 |
+
// exception when calling iframe.contents() on
|
82 |
+
// cross-domain requests, so we unify the response:
|
83 |
+
if (!response.length || !response[0].firstChild) {
|
84 |
+
throw new Error();
|
85 |
+
}
|
86 |
+
} catch (e) {
|
87 |
+
response = undefined;
|
88 |
+
}
|
89 |
+
// The complete callback returns the
|
90 |
+
// iframe content document as response object:
|
91 |
+
completeCallback(
|
92 |
+
200,
|
93 |
+
'success',
|
94 |
+
{'iframe': response}
|
95 |
+
);
|
96 |
+
// Fix for IE endless progress bar activity bug
|
97 |
+
// (happens on form submits to iframe targets):
|
98 |
+
$('<iframe src="javascript:false;"></iframe>')
|
99 |
+
.appendTo(form);
|
100 |
+
window.setTimeout(function () {
|
101 |
+
// Removing the form in a setTimeout call
|
102 |
+
// allows Chrome's developer tools to display
|
103 |
+
// the response result
|
104 |
+
form.remove();
|
105 |
+
}, 0);
|
106 |
+
});
|
107 |
+
form
|
108 |
+
.prop('target', iframe.prop('name'))
|
109 |
+
.prop('action', options.url)
|
110 |
+
.prop('method', options.type);
|
111 |
+
if (options.formData) {
|
112 |
+
$.each(options.formData, function (index, field) {
|
113 |
+
$('<input type="hidden"/>')
|
114 |
+
.prop('name', field.name)
|
115 |
+
.val(field.value)
|
116 |
+
.appendTo(form);
|
117 |
+
});
|
118 |
+
}
|
119 |
+
if (options.fileInput && options.fileInput.length &&
|
120 |
+
options.type === 'POST') {
|
121 |
+
fileInputClones = options.fileInput.clone();
|
122 |
+
// Insert a clone for each file input field:
|
123 |
+
options.fileInput.after(function (index) {
|
124 |
+
return fileInputClones[index];
|
125 |
+
});
|
126 |
+
if (options.paramName) {
|
127 |
+
options.fileInput.each(function (index) {
|
128 |
+
$(this).prop(
|
129 |
+
'name',
|
130 |
+
paramNames[index] || options.paramName
|
131 |
+
);
|
132 |
+
});
|
133 |
+
}
|
134 |
+
// Appending the file input fields to the hidden form
|
135 |
+
// removes them from their original location:
|
136 |
+
form
|
137 |
+
.append(options.fileInput)
|
138 |
+
.prop('enctype', 'multipart/form-data')
|
139 |
+
// enctype must be set as encoding for IE:
|
140 |
+
.prop('encoding', 'multipart/form-data');
|
141 |
+
}
|
142 |
+
form.submit();
|
143 |
+
// Insert the file input fields at their original location
|
144 |
+
// by replacing the clones with the originals:
|
145 |
+
if (fileInputClones && fileInputClones.length) {
|
146 |
+
options.fileInput.each(function (index, input) {
|
147 |
+
var clone = $(fileInputClones[index]);
|
148 |
+
$(input).prop('name', clone.prop('name'));
|
149 |
+
clone.replaceWith(input);
|
150 |
+
});
|
151 |
+
}
|
152 |
+
});
|
153 |
+
form.append(iframe).appendTo(document.body);
|
154 |
+
},
|
155 |
+
abort: function () {
|
156 |
+
if (iframe) {
|
157 |
+
// javascript:false as iframe src aborts the request
|
158 |
+
// and prevents warning popups on HTTPS in IE6.
|
159 |
+
// concat is used to avoid the "Script URL" JSLint error:
|
160 |
+
iframe
|
161 |
+
.unbind('load')
|
162 |
+
.prop('src', 'javascript'.concat(':false;'));
|
163 |
+
}
|
164 |
+
if (form) {
|
165 |
+
form.remove();
|
166 |
+
}
|
167 |
+
}
|
168 |
+
};
|
169 |
+
}
|
170 |
+
});
|
171 |
+
|
172 |
+
// The iframe transport returns the iframe content document as response.
|
173 |
+
// The following adds converters from iframe to text, json, html, xml
|
174 |
+
// and script.
|
175 |
+
// Please note that the Content-Type for JSON responses has to be text/plain
|
176 |
+
// or text/html, if the browser doesn't include application/json in the
|
177 |
+
// Accept header, else IE will show a download dialog.
|
178 |
+
// The Content-Type for XML responses on the other hand has to be always
|
179 |
+
// application/xml or text/xml, so IE properly parses the XML response.
|
180 |
+
// See also
|
181 |
+
// https://github.com/blueimp/jQuery-File-Upload/wiki/Setup#content-type-negotiation
|
182 |
+
$.ajaxSetup({
|
183 |
+
converters: {
|
184 |
+
'iframe text': function (iframe) {
|
185 |
+
return iframe && $(iframe[0].body).text();
|
186 |
+
},
|
187 |
+
'iframe json': function (iframe) {
|
188 |
+
return iframe && $.parseJSON($(iframe[0].body).text());
|
189 |
+
},
|
190 |
+
'iframe html': function (iframe) {
|
191 |
+
return iframe && $(iframe[0].body).html();
|
192 |
+
},
|
193 |
+
'iframe xml': function (iframe) {
|
194 |
+
var xmlDoc = iframe && iframe[0];
|
195 |
+
return xmlDoc && $.isXMLDoc(xmlDoc) ? xmlDoc :
|
196 |
+
$.parseXML((xmlDoc.XMLDocument && xmlDoc.XMLDocument.xml) ||
|
197 |
+
$(xmlDoc.body).html());
|
198 |
+
},
|
199 |
+
'iframe script': function (iframe) {
|
200 |
+
return iframe && $.globalEval($(iframe[0].body).text());
|
201 |
+
}
|
202 |
+
}
|
203 |
+
});
|
204 |
+
|
205 |
+
}));
|
assets/js/jplayer.js
CHANGED
@@ -1,107 +1,107 @@
|
|
1 |
-
/*
|
2 |
-
* jPlayer Plugin for jQuery JavaScript Library
|
3 |
-
* http://www.jplayer.org
|
4 |
-
*
|
5 |
-
* Copyright (c) 2009 - 2013 Happyworm Ltd
|
6 |
-
* Licensed under the MIT license.
|
7 |
-
* http://opensource.org/licenses/MIT
|
8 |
-
*
|
9 |
-
* Author: Mark J Panaghiston
|
10 |
-
* Version: 2.4.0
|
11 |
-
* Date: 5th June 2013
|
12 |
-
*/
|
13 |
-
|
14 |
-
(function(b,f){"function"===typeof define&&define.amd?define(["jquery"],f):b.jQuery?f(b.jQuery):f(b.Zepto)})(this,function(b,f){b.fn.jPlayer=function(a){var c="string"===typeof a,d=Array.prototype.slice.call(arguments,1),e=this;a=!c&&d.length?b.extend.apply(null,[!0,a].concat(d)):a;if(c&&"_"===a.charAt(0))return e;c?this.each(function(){var c=b(this).data("jPlayer"),h=c&&b.isFunction(c[a])?c[a].apply(c,d):c;if(h!==c&&h!==f)return e=h,!1}):this.each(function(){var c=b(this).data("jPlayer");c?c.option(a||
|
15 |
-
{}):b(this).data("jPlayer",new b.jPlayer(a,this))});return e};b.jPlayer=function(a,c){if(arguments.length){this.element=b(c);this.options=b.extend(!0,{},this.options,a);var d=this;this.element.bind("remove.jPlayer",function(){d.destroy()});this._init()}};"function"!==typeof b.fn.stop&&(b.fn.stop=function(){});b.jPlayer.emulateMethods="load play pause";b.jPlayer.emulateStatus="src readyState networkState currentTime duration paused ended playbackRate";b.jPlayer.emulateOptions="muted volume";b.jPlayer.reservedEvent=
|
16 |
-
"ready flashreset resize repeat error warning";b.jPlayer.event={};b.each("ready flashreset resize repeat click error warning loadstart progress suspend abort emptied stalled play pause loadedmetadata loadeddata waiting playing canplay canplaythrough seeking seeked timeupdate ended ratechange durationchange volumechange".split(" "),function(){b.jPlayer.event[this]="jPlayer_"+this});b.jPlayer.htmlEvent="loadstart abort emptied stalled loadedmetadata loadeddata canplay canplaythrough ratechange".split(" ");
|
17 |
-
b.jPlayer.pause=function(){b.each(b.jPlayer.prototype.instances,function(a,c){c.data("jPlayer").status.srcSet&&c.jPlayer("pause")})};b.jPlayer.timeFormat={showHour:!1,showMin:!0,showSec:!0,padHour:!1,padMin:!0,padSec:!0,sepHour:":",sepMin:":",sepSec:""};var l=function(){this.init()};l.prototype={init:function(){this.options={timeFormat:b.jPlayer.timeFormat}},time:function(a){var c=new Date(1E3*(a&&"number"===typeof a?a:0)),b=c.getUTCHours();a=this.options.timeFormat.showHour?c.getUTCMinutes():c.getUTCMinutes()+
|
18 |
-
60*b;c=this.options.timeFormat.showMin?c.getUTCSeconds():c.getUTCSeconds()+60*a;b=this.options.timeFormat.padHour&&10>b?"0"+b:b;a=this.options.timeFormat.padMin&&10>a?"0"+a:a;c=this.options.timeFormat.padSec&&10>c?"0"+c:c;b=""+(this.options.timeFormat.showHour?b+this.options.timeFormat.sepHour:"");b+=this.options.timeFormat.showMin?a+this.options.timeFormat.sepMin:"";return b+=this.options.timeFormat.showSec?c+this.options.timeFormat.sepSec:""}};var m=new l;b.jPlayer.convertTime=function(a){return m.time(a)};
|
19 |
-
b.jPlayer.uaBrowser=function(a){a=a.toLowerCase();var b=/(opera)(?:.*version)?[ \/]([\w.]+)/,d=/(msie) ([\w.]+)/,e=/(mozilla)(?:.*? rv:([\w.]+))?/;a=/(webkit)[ \/]([\w.]+)/.exec(a)||b.exec(a)||d.exec(a)||0>a.indexOf("compatible")&&e.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}};b.jPlayer.uaPlatform=function(a){var b=a.toLowerCase(),d=/(android)/,e=/(mobile)/;a=/(ipad|iphone|ipod|android|blackberry|playbook|windows ce|webos)/.exec(b)||[];b=/(ipad|playbook)/.exec(b)||!e.exec(b)&&d.exec(b)||
|
20 |
-
[];a[1]&&(a[1]=a[1].replace(/\s/g,"_"));return{platform:a[1]||"",tablet:b[1]||""}};b.jPlayer.browser={};b.jPlayer.platform={};var j=b.jPlayer.uaBrowser(navigator.userAgent);j.browser&&(b.jPlayer.browser[j.browser]=!0,b.jPlayer.browser.version=j.version);j=b.jPlayer.uaPlatform(navigator.userAgent);j.platform&&(b.jPlayer.platform[j.platform]=!0,b.jPlayer.platform.mobile=!j.tablet,b.jPlayer.platform.tablet=!!j.tablet);b.jPlayer.getDocMode=function(){var a;b.jPlayer.browser.msie&&(document.documentMode?
|
21 |
-
a=document.documentMode:(a=5,document.compatMode&&"CSS1Compat"===document.compatMode&&(a=7)));return a};b.jPlayer.browser.documentMode=b.jPlayer.getDocMode();b.jPlayer.nativeFeatures={init:function(){var a=document,b=a.createElement("video"),d={w3c:"fullscreenEnabled fullscreenElement requestFullscreen exitFullscreen fullscreenchange fullscreenerror".split(" "),moz:"mozFullScreenEnabled mozFullScreenElement mozRequestFullScreen mozCancelFullScreen mozfullscreenchange mozfullscreenerror".split(" "),
|
22 |
-
webkit:" webkitCurrentFullScreenElement webkitRequestFullScreen webkitCancelFullScreen webkitfullscreenchange ".split(" "),webkitVideo:"webkitSupportsFullscreen webkitDisplayingFullscreen webkitEnterFullscreen webkitExitFullscreen ".split(" ")},e=["w3c","moz","webkit","webkitVideo"],g,h;this.fullscreen=b={support:{w3c:!!a[d.w3c[0]],moz:!!a[d.moz[0]],webkit:"function"===typeof a[d.webkit[3]],webkitVideo:"function"===typeof b[d.webkitVideo[2]]},used:{}};g=0;for(h=e.length;g<h;g++){var f=e[g];if(b.support[f]){b.spec=
|
23 |
-
f;b.used[f]=!0;break}}if(b.spec){var k=d[b.spec];b.api={fullscreenEnabled:!0,fullscreenElement:function(b){b=b?b:a;return b[k[1]]},requestFullscreen:function(a){return a[k[2]]()},exitFullscreen:function(b){b=b?b:a;return b[k[3]]()}};b.event={fullscreenchange:k[4],fullscreenerror:k[5]}}else b.api={fullscreenEnabled:!1,fullscreenElement:function(){return null},requestFullscreen:function(){},exitFullscreen:function(){}},b.event={}}};b.jPlayer.nativeFeatures.init();b.jPlayer.focus=null;b.jPlayer.keyIgnoreElementNames=
|
24 |
-
"INPUT TEXTAREA";var n=function(a){var c=b.jPlayer.focus,d;c&&(b.each(b.jPlayer.keyIgnoreElementNames.split(/\s+/g),function(b,c){if(a.target.nodeName.toUpperCase()===c.toUpperCase())return d=!0,!1}),d||b.each(c.options.keyBindings,function(d,g){if(g&&a.which===g.key&&b.isFunction(g.fn))return a.preventDefault(),g.fn(c),!1}))};b.jPlayer.keys=function(a){b(document.documentElement).unbind("keydown.jPlayer");a&&b(document.documentElement).bind("keydown.jPlayer",n)};b.jPlayer.keys(!0);b.jPlayer.prototype=
|
25 |
-
{count:0,version:{script:"2.4.0",needFlash:"2.4.0",flash:"unknown"},options:{swfPath:"js",solution:"html, flash",supplied:"mp3",preload:"metadata",volume:0.8,muted:!1,wmode:"opaque",backgroundColor:"#000000",cssSelectorAncestor:"#jp_container_1",cssSelector:{videoPlay:".jp-video-play",play:".jp-play",pause:".jp-pause",stop:".jp-stop",seekBar:".jp-seek-bar",playBar:".jp-play-bar",mute:".jp-mute",unmute:".jp-unmute",volumeBar:".jp-volume-bar",volumeBarValue:".jp-volume-bar-value",volumeMax:".jp-volume-max",
|
26 |
-
currentTime:".jp-current-time",duration:".jp-duration",fullScreen:".jp-full-screen",restoreScreen:".jp-restore-screen",repeat:".jp-repeat",repeatOff:".jp-repeat-off",gui:".jp-gui",noSolution:".jp-no-solution"},smoothPlayBar:!1,fullScreen:!1,fullWindow:!1,autohide:{restored:!1,full:!0,fadeIn:200,fadeOut:600,hold:1E3},loop:!1,repeat:function(a){a.jPlayer.options.loop?b(this).unbind(".jPlayerRepeat").bind(b.jPlayer.event.ended+".jPlayer.jPlayerRepeat",function(){b(this).jPlayer("play")}):b(this).unbind(".jPlayerRepeat")},
|
27 |
-
nativeVideoControls:{},noFullWindow:{msie:/msie [0-6]\./,ipad:/ipad.*?os [0-4]\./,iphone:/iphone/,ipod:/ipod/,android_pad:/android [0-3]\.(?!.*?mobile)/,android_phone:/android.*?mobile/,blackberry:/blackberry/,windows_ce:/windows ce/,iemobile:/iemobile/,webos:/webos/},noVolume:{ipad:/ipad/,iphone:/iphone/,ipod:/ipod/,android_pad:/android(?!.*?mobile)/,android_phone:/android.*?mobile/,blackberry:/blackberry/,windows_ce:/windows ce/,iemobile:/iemobile/,webos:/webos/,playbook:/playbook/},timeFormat:{},
|
28 |
-
keyEnabled:!1,audioFullScreen:!1,keyBindings:{play:{key:32,fn:function(a){a.status.paused?a.play():a.pause()}},fullScreen:{key:13,fn:function(a){(a.status.video||a.options.audioFullScreen)&&a._setOption("fullScreen",!a.options.fullScreen)}},muted:{key:8,fn:function(a){a._muted(!a.options.muted)}},volumeUp:{key:38,fn:function(a){a.volume(a.options.volume+0.1)}},volumeDown:{key:40,fn:function(a){a.volume(a.options.volume-0.1)}}},verticalVolume:!1,idPrefix:"jp",noConflict:"jQuery",emulateHtml:!1,errorAlerts:!1,
|
29 |
-
warningAlerts:!1},optionsAudio:{size:{width:"0px",height:"0px",cssClass:""},sizeFull:{width:"0px",height:"0px",cssClass:""}},optionsVideo:{size:{width:"480px",height:"270px",cssClass:"jp-video-270p"},sizeFull:{width:"100%",height:"100%",cssClass:"jp-video-full"}},instances:{},status:{src:"",media:{},paused:!0,format:{},formatType:"",waitForPlay:!0,waitForLoad:!0,srcSet:!1,video:!1,seekPercent:0,currentPercentRelative:0,currentPercentAbsolute:0,currentTime:0,duration:0,videoWidth:0,videoHeight:0,readyState:0,
|
30 |
-
networkState:0,playbackRate:1,ended:0},internal:{ready:!1},solution:{html:!0,flash:!0},format:{mp3:{codec:'audio/mpeg; codecs="mp3"',flashCanPlay:!0,media:"audio"},m4a:{codec:'audio/mp4; codecs="mp4a.40.2"',flashCanPlay:!0,media:"audio"},oga:{codec:'audio/ogg; codecs="vorbis"',flashCanPlay:!1,media:"audio"},wav:{codec:'audio/wav; codecs="1"',flashCanPlay:!1,media:"audio"},webma:{codec:'audio/webm; codecs="vorbis"',flashCanPlay:!1,media:"audio"},fla:{codec:"audio/x-flv",flashCanPlay:!0,media:"audio"},
|
31 |
-
rtmpa:{codec:'audio/rtmp; codecs="rtmp"',flashCanPlay:!0,media:"audio"},m4v:{codec:'video/mp4; codecs="avc1.42E01E, mp4a.40.2"',flashCanPlay:!0,media:"video"},ogv:{codec:'video/ogg; codecs="theora, vorbis"',flashCanPlay:!1,media:"video"},webmv:{codec:'video/webm; codecs="vorbis, vp8"',flashCanPlay:!1,media:"video"},flv:{codec:"video/x-flv",flashCanPlay:!0,media:"video"},rtmpv:{codec:'video/rtmp; codecs="rtmp"',flashCanPlay:!0,media:"video"}},_init:function(){var a=this;this.element.empty();this.status=
|
32 |
-
b.extend({},this.status);this.internal=b.extend({},this.internal);this.options.timeFormat=b.extend({},b.jPlayer.timeFormat,this.options.timeFormat);this.internal.cmdsIgnored=b.jPlayer.platform.ipad||b.jPlayer.platform.iphone||b.jPlayer.platform.ipod;this.internal.domNode=this.element.get(0);this.options.keyEnabled&&!b.jPlayer.focus&&(b.jPlayer.focus=this);this.formats=[];this.solutions=[];this.require={};this.htmlElement={};this.html={};this.html.audio={};this.html.video={};this.flash={};this.css=
|
33 |
-
{};this.css.cs={};this.css.jq={};this.ancestorJq=[];this.options.volume=this._limitValue(this.options.volume,0,1);b.each(this.options.supplied.toLowerCase().split(","),function(c,d){var e=d.replace(/^\s+|\s+$/g,"");if(a.format[e]){var f=!1;b.each(a.formats,function(a,b){if(e===b)return f=!0,!1});f||a.formats.push(e)}});b.each(this.options.solution.toLowerCase().split(","),function(c,d){var e=d.replace(/^\s+|\s+$/g,"");if(a.solution[e]){var f=!1;b.each(a.solutions,function(a,b){if(e===b)return f=!0,
|
34 |
-
!1});f||a.solutions.push(e)}});this.internal.instance="jp_"+this.count;this.instances[this.internal.instance]=this.element;this.element.attr("id")||this.element.attr("id",this.options.idPrefix+"_jplayer_"+this.count);this.internal.self=b.extend({},{id:this.element.attr("id"),jq:this.element});this.internal.audio=b.extend({},{id:this.options.idPrefix+"_audio_"+this.count,jq:f});this.internal.video=b.extend({},{id:this.options.idPrefix+"_video_"+this.count,jq:f});this.internal.flash=b.extend({},{id:this.options.idPrefix+
|
35 |
-
"_flash_"+this.count,jq:f,swf:this.options.swfPath+(".swf"!==this.options.swfPath.toLowerCase().slice(-4)?(this.options.swfPath&&"/"!==this.options.swfPath.slice(-1)?"/":"")+"Jplayer.swf":"")});this.internal.poster=b.extend({},{id:this.options.idPrefix+"_poster_"+this.count,jq:f});b.each(b.jPlayer.event,function(b,c){a.options[b]!==f&&(a.element.bind(c+".jPlayer",a.options[b]),a.options[b]=f)});this.require.audio=!1;this.require.video=!1;b.each(this.formats,function(b,c){a.require[a.format[c].media]=
|
36 |
-
!0});this.options=this.require.video?b.extend(!0,{},this.optionsVideo,this.options):b.extend(!0,{},this.optionsAudio,this.options);this._setSize();this.status.nativeVideoControls=this._uaBlocklist(this.options.nativeVideoControls);this.status.noFullWindow=this._uaBlocklist(this.options.noFullWindow);this.status.noVolume=this._uaBlocklist(this.options.noVolume);b.jPlayer.nativeFeatures.fullscreen.api.fullscreenEnabled&&this._fullscreenAddEventListeners();this._restrictNativeVideoControls();this.htmlElement.poster=
|
37 |
-
document.createElement("img");this.htmlElement.poster.id=this.internal.poster.id;this.htmlElement.poster.onload=function(){(!a.status.video||a.status.waitForPlay)&&a.internal.poster.jq.show()};this.element.append(this.htmlElement.poster);this.internal.poster.jq=b("#"+this.internal.poster.id);this.internal.poster.jq.css({width:this.status.width,height:this.status.height});this.internal.poster.jq.hide();this.internal.poster.jq.bind("click.jPlayer",function(){a._trigger(b.jPlayer.event.click)});this.html.audio.available=
|
38 |
-
!1;this.require.audio&&(this.htmlElement.audio=document.createElement("audio"),this.htmlElement.audio.id=this.internal.audio.id,this.html.audio.available=!!this.htmlElement.audio.canPlayType&&this._testCanPlayType(this.htmlElement.audio));this.html.video.available=!1;this.require.video&&(this.htmlElement.video=document.createElement("video"),this.htmlElement.video.id=this.internal.video.id,this.html.video.available=!!this.htmlElement.video.canPlayType&&this._testCanPlayType(this.htmlElement.video));
|
39 |
-
this.flash.available=this._checkForFlash(10.1);this.html.canPlay={};this.flash.canPlay={};b.each(this.formats,function(b,c){a.html.canPlay[c]=a.html[a.format[c].media].available&&""!==a.htmlElement[a.format[c].media].canPlayType(a.format[c].codec);a.flash.canPlay[c]=a.format[c].flashCanPlay&&a.flash.available});this.html.desired=!1;this.flash.desired=!1;b.each(this.solutions,function(c,d){if(0===c)a[d].desired=!0;else{var e=!1,f=!1;b.each(a.formats,function(b,c){a[a.solutions[0]].canPlay[c]&&("video"===
|
40 |
-
a.format[c].media?f=!0:e=!0)});a[d].desired=a.require.audio&&!e||a.require.video&&!f}});this.html.support={};this.flash.support={};b.each(this.formats,function(b,c){a.html.support[c]=a.html.canPlay[c]&&a.html.desired;a.flash.support[c]=a.flash.canPlay[c]&&a.flash.desired});this.html.used=!1;this.flash.used=!1;b.each(this.solutions,function(c,d){b.each(a.formats,function(b,c){if(a[d].support[c])return a[d].used=!0,!1})});this._resetActive();this._resetGate();this._cssSelectorAncestor(this.options.cssSelectorAncestor);
|
41 |
-
!this.html.used&&!this.flash.used?(this._error({type:b.jPlayer.error.NO_SOLUTION,context:"{solution:'"+this.options.solution+"', supplied:'"+this.options.supplied+"'}",message:b.jPlayer.errorMsg.NO_SOLUTION,hint:b.jPlayer.errorHint.NO_SOLUTION}),this.css.jq.noSolution.length&&this.css.jq.noSolution.show()):this.css.jq.noSolution.length&&this.css.jq.noSolution.hide();if(this.flash.used){var c,d="jQuery="+encodeURI(this.options.noConflict)+"&id="+encodeURI(this.internal.self.id)+"&vol="+this.options.volume+
|
42 |
-
"&muted="+this.options.muted;if(b.jPlayer.browser.msie&&(9>Number(b.jPlayer.browser.version)||9>b.jPlayer.browser.documentMode)){d=['<param name="movie" value="'+this.internal.flash.swf+'" />','<param name="FlashVars" value="'+d+'" />','<param name="allowScriptAccess" value="always" />','<param name="bgcolor" value="'+this.options.backgroundColor+'" />','<param name="wmode" value="'+this.options.wmode+'" />'];c=document.createElement('<object id="'+this.internal.flash.id+'" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="0" height="0" tabindex="-1"></object>');
|
43 |
-
for(var e=0;e<d.length;e++)c.appendChild(document.createElement(d[e]))}else e=function(a,b,c){var d=document.createElement("param");d.setAttribute("name",b);d.setAttribute("value",c);a.appendChild(d)},c=document.createElement("object"),c.setAttribute("id",this.internal.flash.id),c.setAttribute("name",this.internal.flash.id),c.setAttribute("data",this.internal.flash.swf),c.setAttribute("type","application/x-shockwave-flash"),c.setAttribute("width","1"),c.setAttribute("height","1"),c.setAttribute("tabindex",
|
44 |
-
"-1"),e(c,"flashvars",d),e(c,"allowscriptaccess","always"),e(c,"bgcolor",this.options.backgroundColor),e(c,"wmode",this.options.wmode);this.element.append(c);this.internal.flash.jq=b(c)}this.html.used&&(this.html.audio.available&&(this._addHtmlEventListeners(this.htmlElement.audio,this.html.audio),this.element.append(this.htmlElement.audio),this.internal.audio.jq=b("#"+this.internal.audio.id)),this.html.video.available&&(this._addHtmlEventListeners(this.htmlElement.video,this.html.video),this.element.append(this.htmlElement.video),
|
45 |
-
this.internal.video.jq=b("#"+this.internal.video.id),this.status.nativeVideoControls?this.internal.video.jq.css({width:this.status.width,height:this.status.height}):this.internal.video.jq.css({width:"0px",height:"0px"}),this.internal.video.jq.bind("click.jPlayer",function(){a._trigger(b.jPlayer.event.click)})));this.options.emulateHtml&&this._emulateHtmlBridge();this.html.used&&!this.flash.used&&setTimeout(function(){a.internal.ready=!0;a.version.flash="n/a";a._trigger(b.jPlayer.event.repeat);a._trigger(b.jPlayer.event.ready)},
|
46 |
-
100);this._updateNativeVideoControls();this.css.jq.videoPlay.length&&this.css.jq.videoPlay.hide();b.jPlayer.prototype.count++},destroy:function(){this.clearMedia();this._removeUiClass();this.css.jq.currentTime.length&&this.css.jq.currentTime.text("");this.css.jq.duration.length&&this.css.jq.duration.text("");b.each(this.css.jq,function(a,b){b.length&&b.unbind(".jPlayer")});this.internal.poster.jq.unbind(".jPlayer");this.internal.video.jq&&this.internal.video.jq.unbind(".jPlayer");this._fullscreenRemoveEventListeners();
|
47 |
-
this===b.jPlayer.focus&&(b.jPlayer.focus=null);this.options.emulateHtml&&this._destroyHtmlBridge();this.element.removeData("jPlayer");this.element.unbind(".jPlayer");this.element.empty();delete this.instances[this.internal.instance]},enable:function(){},disable:function(){},_testCanPlayType:function(a){try{return a.canPlayType(this.format.mp3.codec),!0}catch(b){return!1}},_uaBlocklist:function(a){var c=navigator.userAgent.toLowerCase(),d=!1;b.each(a,function(a,b){if(b&&b.test(c))return d=!0,!1});
|
48 |
-
return d},_restrictNativeVideoControls:function(){this.require.audio&&this.status.nativeVideoControls&&(this.status.nativeVideoControls=!1,this.status.noFullWindow=!0)},_updateNativeVideoControls:function(){this.html.video.available&&this.html.used&&(this.htmlElement.video.controls=this.status.nativeVideoControls,this._updateAutohide(),this.status.nativeVideoControls&&this.require.video?(this.internal.poster.jq.hide(),this.internal.video.jq.css({width:this.status.width,height:this.status.height})):
|
49 |
-
this.status.waitForPlay&&this.status.video&&(this.internal.poster.jq.show(),this.internal.video.jq.css({width:"0px",height:"0px"})))},_addHtmlEventListeners:function(a,c){var d=this;a.preload=this.options.preload;a.muted=this.options.muted;a.volume=this.options.volume;a.addEventListener("progress",function(){c.gate&&(d.internal.cmdsIgnored&&0<this.readyState&&(d.internal.cmdsIgnored=!1),d._getHtmlStatus(a),d._updateInterface(),d._trigger(b.jPlayer.event.progress))},!1);a.addEventListener("timeupdate",
|
50 |
-
function(){c.gate&&(d._getHtmlStatus(a),d._updateInterface(),d._trigger(b.jPlayer.event.timeupdate))},!1);a.addEventListener("durationchange",function(){c.gate&&(d._getHtmlStatus(a),d._updateInterface(),d._trigger(b.jPlayer.event.durationchange))},!1);a.addEventListener("play",function(){c.gate&&(d._updateButtons(!0),d._html_checkWaitForPlay(),d._trigger(b.jPlayer.event.play))},!1);a.addEventListener("playing",function(){c.gate&&(d._updateButtons(!0),d._seeked(),d._trigger(b.jPlayer.event.playing))},
|
51 |
-
!1);a.addEventListener("pause",function(){c.gate&&(d._updateButtons(!1),d._trigger(b.jPlayer.event.pause))},!1);a.addEventListener("waiting",function(){c.gate&&(d._seeking(),d._trigger(b.jPlayer.event.waiting))},!1);a.addEventListener("seeking",function(){c.gate&&(d._seeking(),d._trigger(b.jPlayer.event.seeking))},!1);a.addEventListener("seeked",function(){c.gate&&(d._seeked(),d._trigger(b.jPlayer.event.seeked))},!1);a.addEventListener("volumechange",function(){c.gate&&(d.options.volume=a.volume,
|
52 |
-
d.options.muted=a.muted,d._updateMute(),d._updateVolume(),d._trigger(b.jPlayer.event.volumechange))},!1);a.addEventListener("suspend",function(){c.gate&&(d._seeked(),d._trigger(b.jPlayer.event.suspend))},!1);a.addEventListener("ended",function(){c.gate&&(b.jPlayer.browser.webkit||(d.htmlElement.media.currentTime=0),d.htmlElement.media.pause(),d._updateButtons(!1),d._getHtmlStatus(a,!0),d._updateInterface(),d._trigger(b.jPlayer.event.ended))},!1);a.addEventListener("error",function(){c.gate&&(d._updateButtons(!1),
|
53 |
-
d._seeked(),d.status.srcSet&&(clearTimeout(d.internal.htmlDlyCmdId),d.status.waitForLoad=!0,d.status.waitForPlay=!0,d.status.video&&!d.status.nativeVideoControls&&d.internal.video.jq.css({width:"0px",height:"0px"}),d._validString(d.status.media.poster)&&!d.status.nativeVideoControls&&d.internal.poster.jq.show(),d.css.jq.videoPlay.length&&d.css.jq.videoPlay.show(),d._error({type:b.jPlayer.error.URL,context:d.status.src,message:b.jPlayer.errorMsg.URL,hint:b.jPlayer.errorHint.URL})))},!1);b.each(b.jPlayer.htmlEvent,
|
54 |
-
function(e,g){a.addEventListener(this,function(){c.gate&&d._trigger(b.jPlayer.event[g])},!1)})},_getHtmlStatus:function(a,b){var d=0,e=0,g=0,f=0;isFinite(a.duration)&&(this.status.duration=a.duration);d=a.currentTime;e=0<this.status.duration?100*d/this.status.duration:0;"object"===typeof a.seekable&&0<a.seekable.length?(g=0<this.status.duration?100*a.seekable.end(a.seekable.length-1)/this.status.duration:100,f=0<this.status.duration?100*a.currentTime/a.seekable.end(a.seekable.length-1):0):(g=100,
|
55 |
-
f=e);b&&(e=f=d=0);this.status.seekPercent=g;this.status.currentPercentRelative=f;this.status.currentPercentAbsolute=e;this.status.currentTime=d;this.status.videoWidth=a.videoWidth;this.status.videoHeight=a.videoHeight;this.status.readyState=a.readyState;this.status.networkState=a.networkState;this.status.playbackRate=a.playbackRate;this.status.ended=a.ended},_resetStatus:function(){this.status=b.extend({},this.status,b.jPlayer.prototype.status)},_trigger:function(a,c,d){a=b.Event(a);a.jPlayer={};
|
56 |
-
a.jPlayer.version=b.extend({},this.version);a.jPlayer.options=b.extend(!0,{},this.options);a.jPlayer.status=b.extend(!0,{},this.status);a.jPlayer.html=b.extend(!0,{},this.html);a.jPlayer.flash=b.extend(!0,{},this.flash);c&&(a.jPlayer.error=b.extend({},c));d&&(a.jPlayer.warning=b.extend({},d));this.element.trigger(a)},jPlayerFlashEvent:function(a,c){if(a===b.jPlayer.event.ready)if(this.internal.ready){if(this.flash.gate){if(this.status.srcSet){var d=this.status.currentTime,e=this.status.paused;this.setMedia(this.status.media);
|
57 |
-
0<d&&(e?this.pause(d):this.play(d))}this._trigger(b.jPlayer.event.flashreset)}}else this.internal.ready=!0,this.internal.flash.jq.css({width:"0px",height:"0px"}),this.version.flash=c.version,this.version.needFlash!==this.version.flash&&this._error({type:b.jPlayer.error.VERSION,context:this.version.flash,message:b.jPlayer.errorMsg.VERSION+this.version.flash,hint:b.jPlayer.errorHint.VERSION}),this._trigger(b.jPlayer.event.repeat),this._trigger(a);if(this.flash.gate)switch(a){case b.jPlayer.event.progress:this._getFlashStatus(c);
|
58 |
-
this._updateInterface();this._trigger(a);break;case b.jPlayer.event.timeupdate:this._getFlashStatus(c);this._updateInterface();this._trigger(a);break;case b.jPlayer.event.play:this._seeked();this._updateButtons(!0);this._trigger(a);break;case b.jPlayer.event.pause:this._updateButtons(!1);this._trigger(a);break;case b.jPlayer.event.ended:this._updateButtons(!1);this._trigger(a);break;case b.jPlayer.event.click:this._trigger(a);break;case b.jPlayer.event.error:this.status.waitForLoad=!0;this.status.waitForPlay=
|
59 |
-
!0;this.status.video&&this.internal.flash.jq.css({width:"0px",height:"0px"});this._validString(this.status.media.poster)&&this.internal.poster.jq.show();this.css.jq.videoPlay.length&&this.status.video&&this.css.jq.videoPlay.show();this.status.video?this._flash_setVideo(this.status.media):this._flash_setAudio(this.status.media);this._updateButtons(!1);this._error({type:b.jPlayer.error.URL,context:c.src,message:b.jPlayer.errorMsg.URL,hint:b.jPlayer.errorHint.URL});break;case b.jPlayer.event.seeking:this._seeking();
|
60 |
-
this._trigger(a);break;case b.jPlayer.event.seeked:this._seeked();this._trigger(a);break;case b.jPlayer.event.ready:break;default:this._trigger(a)}return!1},_getFlashStatus:function(a){this.status.seekPercent=a.seekPercent;this.status.currentPercentRelative=a.currentPercentRelative;this.status.currentPercentAbsolute=a.currentPercentAbsolute;this.status.currentTime=a.currentTime;this.status.duration=a.duration;this.status.videoWidth=a.videoWidth;this.status.videoHeight=a.videoHeight;this.status.readyState=
|
61 |
-
4;this.status.networkState=0;this.status.playbackRate=1;this.status.ended=!1},_updateButtons:function(a){a===f?a=!this.status.paused:this.status.paused=!a;this.css.jq.play.length&&this.css.jq.pause.length&&(a?(this.css.jq.play.hide(),this.css.jq.pause.show()):(this.css.jq.play.show(),this.css.jq.pause.hide()));this.css.jq.restoreScreen.length&&this.css.jq.fullScreen.length&&(this.status.noFullWindow?(this.css.jq.fullScreen.hide(),this.css.jq.restoreScreen.hide()):this.options.fullWindow?(this.css.jq.fullScreen.hide(),
|
62 |
-
this.css.jq.restoreScreen.show()):(this.css.jq.fullScreen.show(),this.css.jq.restoreScreen.hide()));this.css.jq.repeat.length&&this.css.jq.repeatOff.length&&(this.options.loop?(this.css.jq.repeat.hide(),this.css.jq.repeatOff.show()):(this.css.jq.repeat.show(),this.css.jq.repeatOff.hide()))},_updateInterface:function(){this.css.jq.seekBar.length&&this.css.jq.seekBar.width(this.status.seekPercent+"%");this.css.jq.playBar.length&&(this.options.smoothPlayBar?this.css.jq.playBar.stop().animate({width:this.status.currentPercentAbsolute+
|
63 |
-
"%"},250,"linear"):this.css.jq.playBar.width(this.status.currentPercentRelative+"%"));this.css.jq.currentTime.length&&this.css.jq.currentTime.text(this._convertTime(this.status.currentTime));this.css.jq.duration.length&&this.css.jq.duration.text(this._convertTime(this.status.duration))},_convertTime:l.prototype.time,_seeking:function(){this.css.jq.seekBar.length&&this.css.jq.seekBar.addClass("jp-seeking-bg")},_seeked:function(){this.css.jq.seekBar.length&&this.css.jq.seekBar.removeClass("jp-seeking-bg")},
|
64 |
-
_resetGate:function(){this.html.audio.gate=!1;this.html.video.gate=!1;this.flash.gate=!1},_resetActive:function(){this.html.active=!1;this.flash.active=!1},setMedia:function(a){var c=this,d=!1,e=this.status.media.poster!==a.poster;this._resetMedia();this._resetGate();this._resetActive();b.each(this.formats,function(e,f){var j="video"===c.format[f].media;b.each(c.solutions,function(b,e){if(c[e].support[f]&&c._validString(a[f])){var g="html"===e;j?(g?(c.html.video.gate=!0,c._html_setVideo(a),c.html.active=
|
65 |
-
!0):(c.flash.gate=!0,c._flash_setVideo(a),c.flash.active=!0),c.css.jq.videoPlay.length&&c.css.jq.videoPlay.show(),c.status.video=!0):(g?(c.html.audio.gate=!0,c._html_setAudio(a),c.html.active=!0):(c.flash.gate=!0,c._flash_setAudio(a),c.flash.active=!0),c.css.jq.videoPlay.length&&c.css.jq.videoPlay.hide(),c.status.video=!1);d=!0;return!1}});if(d)return!1});if(d){if((!this.status.nativeVideoControls||!this.html.video.gate)&&this._validString(a.poster))e?this.htmlElement.poster.src=a.poster:this.internal.poster.jq.show();
|
66 |
-
this.status.srcSet=!0;this.status.media=b.extend({},a);this._updateButtons(!1);this._updateInterface()}else this._error({type:b.jPlayer.error.NO_SUPPORT,context:"{supplied:'"+this.options.supplied+"'}",message:b.jPlayer.errorMsg.NO_SUPPORT,hint:b.jPlayer.errorHint.NO_SUPPORT})},_resetMedia:function(){this._resetStatus();this._updateButtons(!1);this._updateInterface();this._seeked();this.internal.poster.jq.hide();clearTimeout(this.internal.htmlDlyCmdId);this.html.active?this._html_resetMedia():this.flash.active&&
|
67 |
-
this._flash_resetMedia()},clearMedia:function(){this._resetMedia();this.html.active?this._html_clearMedia():this.flash.active&&this._flash_clearMedia();this._resetGate();this._resetActive()},load:function(){this.status.srcSet?this.html.active?this._html_load():this.flash.active&&this._flash_load():this._urlNotSetError("load")},focus:function(){this.options.keyEnabled&&(b.jPlayer.focus=this)},play:function(a){a="number"===typeof a?a:NaN;this.status.srcSet?(this.focus(),this.html.active?this._html_play(a):
|
68 |
-
this.flash.active&&this._flash_play(a)):this._urlNotSetError("play")},videoPlay:function(){this.play()},pause:function(a){a="number"===typeof a?a:NaN;this.status.srcSet?this.html.active?this._html_pause(a):this.flash.active&&this._flash_pause(a):this._urlNotSetError("pause")},pauseOthers:function(){var a=this;b.each(this.instances,function(b,d){a.element!==d&&d.data("jPlayer").status.srcSet&&d.jPlayer("pause")})},stop:function(){this.status.srcSet?this.html.active?this._html_pause(0):this.flash.active&&
|
69 |
-
this._flash_pause(0):this._urlNotSetError("stop")},playHead:function(a){a=this._limitValue(a,0,100);this.status.srcSet?this.html.active?this._html_playHead(a):this.flash.active&&this._flash_playHead(a):this._urlNotSetError("playHead")},_muted:function(a){this.options.muted=a;this.html.used&&this._html_mute(a);this.flash.used&&this._flash_mute(a);!this.html.video.gate&&!this.html.audio.gate&&(this._updateMute(a),this._updateVolume(this.options.volume),this._trigger(b.jPlayer.event.volumechange))},
|
70 |
-
mute:function(a){a=a===f?!0:!!a;this._muted(a)},unmute:function(a){a=a===f?!0:!!a;this._muted(!a)},_updateMute:function(a){a===f&&(a=this.options.muted);this.css.jq.mute.length&&this.css.jq.unmute.length&&(this.status.noVolume?(this.css.jq.mute.hide(),this.css.jq.unmute.hide()):a?(this.css.jq.mute.hide(),this.css.jq.unmute.show()):(this.css.jq.mute.show(),this.css.jq.unmute.hide()))},volume:function(a){a=this._limitValue(a,0,1);this.options.volume=a;this.html.used&&this._html_volume(a);this.flash.used&&
|
71 |
-
this._flash_volume(a);!this.html.video.gate&&!this.html.audio.gate&&(this._updateVolume(a),this._trigger(b.jPlayer.event.volumechange))},volumeBar:function(a){if(this.css.jq.volumeBar.length){var c=b(a.currentTarget),d=c.offset(),e=a.pageX-d.left,g=c.width();a=c.height()-a.pageY+d.top;c=c.height();this.options.verticalVolume?this.volume(a/c):this.volume(e/g)}this.options.muted&&this._muted(!1)},volumeBarValue:function(){},_updateVolume:function(a){a===f&&(a=this.options.volume);a=this.options.muted?
|
72 |
-
0:a;this.status.noVolume?(this.css.jq.volumeBar.length&&this.css.jq.volumeBar.hide(),this.css.jq.volumeBarValue.length&&this.css.jq.volumeBarValue.hide(),this.css.jq.volumeMax.length&&this.css.jq.volumeMax.hide()):(this.css.jq.volumeBar.length&&this.css.jq.volumeBar.show(),this.css.jq.volumeBarValue.length&&(this.css.jq.volumeBarValue.show(),this.css.jq.volumeBarValue[this.options.verticalVolume?"height":"width"](100*a+"%")),this.css.jq.volumeMax.length&&this.css.jq.volumeMax.show())},volumeMax:function(){this.volume(1);
|
73 |
-
this.options.muted&&this._muted(!1)},_cssSelectorAncestor:function(a){var c=this;this.options.cssSelectorAncestor=a;this._removeUiClass();this.ancestorJq=a?b(a):[];a&&1!==this.ancestorJq.length&&this._warning({type:b.jPlayer.warning.CSS_SELECTOR_COUNT,context:a,message:b.jPlayer.warningMsg.CSS_SELECTOR_COUNT+this.ancestorJq.length+" found for cssSelectorAncestor.",hint:b.jPlayer.warningHint.CSS_SELECTOR_COUNT});this._addUiClass();b.each(this.options.cssSelector,function(a,b){c._cssSelector(a,b)});
|
74 |
-
this._updateInterface();this._updateButtons();this._updateAutohide();this._updateVolume();this._updateMute()},_cssSelector:function(a,c){var d=this;"string"===typeof c?b.jPlayer.prototype.options.cssSelector[a]?(this.css.jq[a]&&this.css.jq[a].length&&this.css.jq[a].unbind(".jPlayer"),this.options.cssSelector[a]=c,this.css.cs[a]=this.options.cssSelectorAncestor+" "+c,this.css.jq[a]=c?b(this.css.cs[a]):[],this.css.jq[a].length&&this.css.jq[a].bind("click.jPlayer",function(c){c.preventDefault();d[a](c);
|
75 |
-
b(this).blur()}),c&&1!==this.css.jq[a].length&&this._warning({type:b.jPlayer.warning.CSS_SELECTOR_COUNT,context:this.css.cs[a],message:b.jPlayer.warningMsg.CSS_SELECTOR_COUNT+this.css.jq[a].length+" found for "+a+" method.",hint:b.jPlayer.warningHint.CSS_SELECTOR_COUNT})):this._warning({type:b.jPlayer.warning.CSS_SELECTOR_METHOD,context:a,message:b.jPlayer.warningMsg.CSS_SELECTOR_METHOD,hint:b.jPlayer.warningHint.CSS_SELECTOR_METHOD}):this._warning({type:b.jPlayer.warning.CSS_SELECTOR_STRING,context:c,
|
76 |
-
message:b.jPlayer.warningMsg.CSS_SELECTOR_STRING,hint:b.jPlayer.warningHint.CSS_SELECTOR_STRING})},seekBar:function(a){if(this.css.jq.seekBar.length){var c=b(a.currentTarget),d=c.offset();a=a.pageX-d.left;c=c.width();this.playHead(100*a/c)}},playBar:function(){},repeat:function(){this._loop(!0)},repeatOff:function(){this._loop(!1)},_loop:function(a){this.options.loop!==a&&(this.options.loop=a,this._updateButtons(),this._trigger(b.jPlayer.event.repeat))},currentTime:function(){},duration:function(){},
|
77 |
-
gui:function(){},noSolution:function(){},option:function(a,c){var d=a;if(0===arguments.length)return b.extend(!0,{},this.options);if("string"===typeof a){var e=a.split(".");if(c===f){for(var d=b.extend(!0,{},this.options),g=0;g<e.length;g++)if(d[e[g]]!==f)d=d[e[g]];else return this._warning({type:b.jPlayer.warning.OPTION_KEY,context:a,message:b.jPlayer.warningMsg.OPTION_KEY,hint:b.jPlayer.warningHint.OPTION_KEY}),f;return d}for(var g=d={},h=0;h<e.length;h++)h<e.length-1?(g[e[h]]={},g=g[e[h]]):g[e[h]]=
|
78 |
-
c}this._setOptions(d);return this},_setOptions:function(a){var c=this;b.each(a,function(a,b){c._setOption(a,b)});return this},_setOption:function(a,c){var d=this;switch(a){case "volume":this.volume(c);break;case "muted":this._muted(c);break;case "cssSelectorAncestor":this._cssSelectorAncestor(c);break;case "cssSelector":b.each(c,function(a,b){d._cssSelector(a,b)});break;case "fullScreen":if(this.options[a]!==c){var e=b.jPlayer.nativeFeatures.fullscreen.used.webkitVideo;if(!e||e&&!this.status.waitForPlay)e||
|
79 |
-
(this.options[a]=c),c?this._requestFullscreen():this._exitFullscreen(),e||this._setOption("fullWindow",c)}break;case "fullWindow":this.options[a]!==c&&(this._removeUiClass(),this.options[a]=c,this._refreshSize());break;case "size":!this.options.fullWindow&&this.options[a].cssClass!==c.cssClass&&this._removeUiClass();this.options[a]=b.extend({},this.options[a],c);this._refreshSize();break;case "sizeFull":this.options.fullWindow&&this.options[a].cssClass!==c.cssClass&&this._removeUiClass();this.options[a]=
|
80 |
-
b.extend({},this.options[a],c);this._refreshSize();break;case "autohide":this.options[a]=b.extend({},this.options[a],c);this._updateAutohide();break;case "loop":this._loop(c);break;case "nativeVideoControls":this.options[a]=b.extend({},this.options[a],c);this.status.nativeVideoControls=this._uaBlocklist(this.options.nativeVideoControls);this._restrictNativeVideoControls();this._updateNativeVideoControls();break;case "noFullWindow":this.options[a]=b.extend({},this.options[a],c);this.status.nativeVideoControls=
|
81 |
-
this._uaBlocklist(this.options.nativeVideoControls);this.status.noFullWindow=this._uaBlocklist(this.options.noFullWindow);this._restrictNativeVideoControls();this._updateButtons();break;case "noVolume":this.options[a]=b.extend({},this.options[a],c);this.status.noVolume=this._uaBlocklist(this.options.noVolume);this._updateVolume();this._updateMute();break;case "emulateHtml":this.options[a]!==c&&((this.options[a]=c)?this._emulateHtmlBridge():this._destroyHtmlBridge());break;case "timeFormat":this.options[a]=
|
82 |
-
b.extend({},this.options[a],c);break;case "keyEnabled":this.options[a]=c;!c&&this===b.jPlayer.focus&&(b.jPlayer.focus=null);break;case "keyBindings":this.options[a]=b.extend(!0,{},this.options[a],c);break;case "audioFullScreen":this.options[a]=c}return this},_refreshSize:function(){this._setSize();this._addUiClass();this._updateSize();this._updateButtons();this._updateAutohide();this._trigger(b.jPlayer.event.resize)},_setSize:function(){this.options.fullWindow?(this.status.width=this.options.sizeFull.width,
|
83 |
-
this.status.height=this.options.sizeFull.height,this.status.cssClass=this.options.sizeFull.cssClass):(this.status.width=this.options.size.width,this.status.height=this.options.size.height,this.status.cssClass=this.options.size.cssClass);this.element.css({width:this.status.width,height:this.status.height})},_addUiClass:function(){this.ancestorJq.length&&this.ancestorJq.addClass(this.status.cssClass)},_removeUiClass:function(){this.ancestorJq.length&&this.ancestorJq.removeClass(this.status.cssClass)},
|
84 |
-
_updateSize:function(){this.internal.poster.jq.css({width:this.status.width,height:this.status.height});!this.status.waitForPlay&&this.html.active&&this.status.video||this.html.video.available&&this.html.used&&this.status.nativeVideoControls?this.internal.video.jq.css({width:this.status.width,height:this.status.height}):!this.status.waitForPlay&&(this.flash.active&&this.status.video)&&this.internal.flash.jq.css({width:this.status.width,height:this.status.height})},_updateAutohide:function(){var a=
|
85 |
-
this,b=function(){a.css.jq.gui.fadeIn(a.options.autohide.fadeIn,function(){clearTimeout(a.internal.autohideId);a.internal.autohideId=setTimeout(function(){a.css.jq.gui.fadeOut(a.options.autohide.fadeOut)},a.options.autohide.hold)})};this.css.jq.gui.length&&(this.css.jq.gui.stop(!0,!0),clearTimeout(this.internal.autohideId),this.element.unbind(".jPlayerAutohide"),this.css.jq.gui.unbind(".jPlayerAutohide"),this.status.nativeVideoControls?this.css.jq.gui.hide():this.options.fullWindow&&this.options.autohide.full||
|
86 |
-
!this.options.fullWindow&&this.options.autohide.restored?(this.element.bind("mousemove.jPlayer.jPlayerAutohide",b),this.css.jq.gui.bind("mousemove.jPlayer.jPlayerAutohide",b),this.css.jq.gui.hide()):this.css.jq.gui.show())},fullScreen:function(){this._setOption("fullScreen",!0)},restoreScreen:function(){this._setOption("fullScreen",!1)},_fullscreenAddEventListeners:function(){var a=this,c=b.jPlayer.nativeFeatures.fullscreen;c.api.fullscreenEnabled&&c.event.fullscreenchange&&("function"!==typeof this.internal.fullscreenchangeHandler&&
|
87 |
-
(this.internal.fullscreenchangeHandler=function(){a._fullscreenchange()}),document.addEventListener(c.event.fullscreenchange,this.internal.fullscreenchangeHandler,!1))},_fullscreenRemoveEventListeners:function(){var a=b.jPlayer.nativeFeatures.fullscreen;this.internal.fullscreenchangeHandler&&document.addEventListener(a.event.fullscreenchange,this.internal.fullscreenchangeHandler,!1)},_fullscreenchange:function(){this.options.fullScreen&&!b.jPlayer.nativeFeatures.fullscreen.api.fullscreenElement()&&
|
88 |
-
this._setOption("fullScreen",!1)},_requestFullscreen:function(){var a=this.ancestorJq.length?this.ancestorJq[0]:this.element[0],c=b.jPlayer.nativeFeatures.fullscreen;c.used.webkitVideo&&(a=this.htmlElement.video);c.api.fullscreenEnabled&&c.api.requestFullscreen(a)},_exitFullscreen:function(){var a=b.jPlayer.nativeFeatures.fullscreen,c;a.used.webkitVideo&&(c=this.htmlElement.video);a.api.fullscreenEnabled&&a.api.exitFullscreen(c)},_html_initMedia:function(a){var c=b(this.htmlElement.media).empty();
|
89 |
-
b.each(a.track||[],function(a,b){var g=document.createElement("track");g.setAttribute("kind",b.kind?b.kind:"");g.setAttribute("src",b.src?b.src:"");g.setAttribute("srclang",b.srclang?b.srclang:"");g.setAttribute("label",b.label?b.label:"");b.def&&g.setAttribute("default",b.def);c.append(g)});this.htmlElement.media.src=this.status.src;"none"!==this.options.preload&&this._html_load();this._trigger(b.jPlayer.event.timeupdate)},_html_setFormat:function(a){var c=this;b.each(this.formats,function(b,e){if(c.html.support[e]&&
|
90 |
-
a[e])return c.status.src=a[e],c.status.format[e]=!0,c.status.formatType=e,!1})},_html_setAudio:function(a){this._html_setFormat(a);this.htmlElement.media=this.htmlElement.audio;this._html_initMedia(a)},_html_setVideo:function(a){this._html_setFormat(a);this.status.nativeVideoControls&&(this.htmlElement.video.poster=this._validString(a.poster)?a.poster:"");this.htmlElement.media=this.htmlElement.video;this._html_initMedia(a)},_html_resetMedia:function(){this.htmlElement.media&&(this.htmlElement.media.id===
|
91 |
-
this.internal.video.id&&!this.status.nativeVideoControls&&this.internal.video.jq.css({width:"0px",height:"0px"}),this.htmlElement.media.pause())},_html_clearMedia:function(){this.htmlElement.media&&(this.htmlElement.media.src="about:blank",this.htmlElement.media.load())},_html_load:function(){this.status.waitForLoad&&(this.status.waitForLoad=!1,this.htmlElement.media.load());clearTimeout(this.internal.htmlDlyCmdId)},_html_play:function(a){var b=this,d=this.htmlElement.media;this._html_load();if(isNaN(a))d.play();
|
92 |
-
else{this.internal.cmdsIgnored&&d.play();try{if(!d.seekable||"object"===typeof d.seekable&&0<d.seekable.length)d.currentTime=a,d.play();else throw 1;}catch(e){this.internal.htmlDlyCmdId=setTimeout(function(){b.play(a)},250);return}}this._html_checkWaitForPlay()},_html_pause:function(a){var b=this,d=this.htmlElement.media;0<a?this._html_load():clearTimeout(this.internal.htmlDlyCmdId);d.pause();if(!isNaN(a))try{if(!d.seekable||"object"===typeof d.seekable&&0<d.seekable.length)d.currentTime=a;else throw 1;
|
93 |
-
}catch(e){this.internal.htmlDlyCmdId=setTimeout(function(){b.pause(a)},250);return}0<a&&this._html_checkWaitForPlay()},_html_playHead:function(a){var b=this,d=this.htmlElement.media;this._html_load();try{if("object"===typeof d.seekable&&0<d.seekable.length)d.currentTime=a*d.seekable.end(d.seekable.length-1)/100;else if(0<d.duration&&!isNaN(d.duration))d.currentTime=a*d.duration/100;else throw"e";}catch(e){this.internal.htmlDlyCmdId=setTimeout(function(){b.playHead(a)},250);return}this.status.waitForLoad||
|
94 |
-
this._html_checkWaitForPlay()},_html_checkWaitForPlay:function(){this.status.waitForPlay&&(this.status.waitForPlay=!1,this.css.jq.videoPlay.length&&this.css.jq.videoPlay.hide(),this.status.video&&(this.internal.poster.jq.hide(),this.internal.video.jq.css({width:this.status.width,height:this.status.height})))},_html_volume:function(a){this.html.audio.available&&(this.htmlElement.audio.volume=a);this.html.video.available&&(this.htmlElement.video.volume=a)},_html_mute:function(a){this.html.audio.available&&
|
95 |
-
(this.htmlElement.audio.muted=a);this.html.video.available&&(this.htmlElement.video.muted=a)},_flash_setAudio:function(a){var c=this;try{b.each(this.formats,function(b,d){if(c.flash.support[d]&&a[d]){switch(d){case "m4a":case "fla":c._getMovie().fl_setAudio_m4a(a[d]);break;case "mp3":c._getMovie().fl_setAudio_mp3(a[d]);break;case "rtmpa":c._getMovie().fl_setAudio_rtmp(a[d])}c.status.src=a[d];c.status.format[d]=!0;c.status.formatType=d;return!1}}),"auto"===this.options.preload&&(this._flash_load(),
|
96 |
-
this.status.waitForLoad=!1)}catch(d){this._flashError(d)}},_flash_setVideo:function(a){var c=this;try{b.each(this.formats,function(b,d){if(c.flash.support[d]&&a[d]){switch(d){case "m4v":case "flv":c._getMovie().fl_setVideo_m4v(a[d]);break;case "rtmpv":c._getMovie().fl_setVideo_rtmp(a[d])}c.status.src=a[d];c.status.format[d]=!0;c.status.formatType=d;return!1}}),"auto"===this.options.preload&&(this._flash_load(),this.status.waitForLoad=!1)}catch(d){this._flashError(d)}},_flash_resetMedia:function(){this.internal.flash.jq.css({width:"0px",
|
97 |
-
height:"0px"});this._flash_pause(NaN)},_flash_clearMedia:function(){try{this._getMovie().fl_clearMedia()}catch(a){this._flashError(a)}},_flash_load:function(){try{this._getMovie().fl_load()}catch(a){this._flashError(a)}this.status.waitForLoad=!1},_flash_play:function(a){try{this._getMovie().fl_play(a)}catch(b){this._flashError(b)}this.status.waitForLoad=!1;this._flash_checkWaitForPlay()},_flash_pause:function(a){try{this._getMovie().fl_pause(a)}catch(b){this._flashError(b)}0<a&&(this.status.waitForLoad=
|
98 |
-
!1,this._flash_checkWaitForPlay())},_flash_playHead:function(a){try{this._getMovie().fl_play_head(a)}catch(b){this._flashError(b)}this.status.waitForLoad||this._flash_checkWaitForPlay()},_flash_checkWaitForPlay:function(){this.status.waitForPlay&&(this.status.waitForPlay=!1,this.css.jq.videoPlay.length&&this.css.jq.videoPlay.hide(),this.status.video&&(this.internal.poster.jq.hide(),this.internal.flash.jq.css({width:this.status.width,height:this.status.height})))},_flash_volume:function(a){try{this._getMovie().fl_volume(a)}catch(b){this._flashError(b)}},
|
99 |
-
_flash_mute:function(a){try{this._getMovie().fl_mute(a)}catch(b){this._flashError(b)}},_getMovie:function(){return document[this.internal.flash.id]},_getFlashPluginVersion:function(){var a=0,b;if(window.ActiveXObject)try{if(b=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")){var d=b.GetVariable("$version");d&&(d=d.split(" ")[1].split(","),a=parseInt(d[0],10)+"."+parseInt(d[1],10))}}catch(e){}else navigator.plugins&&0<navigator.mimeTypes.length&&(b=navigator.plugins["Shockwave Flash"])&&(a=navigator.plugins["Shockwave Flash"].description.replace(/.*\s(\d+\.\d+).*/,
|
100 |
-
"$1"));return 1*a},_checkForFlash:function(a){var b=!1;this._getFlashPluginVersion()>=a&&(b=!0);return b},_validString:function(a){return a&&"string"===typeof a},_limitValue:function(a,b,d){return a<b?b:a>d?d:a},_urlNotSetError:function(a){this._error({type:b.jPlayer.error.URL_NOT_SET,context:a,message:b.jPlayer.errorMsg.URL_NOT_SET,hint:b.jPlayer.errorHint.URL_NOT_SET})},_flashError:function(a){var c;c=this.internal.ready?"FLASH_DISABLED":"FLASH";this._error({type:b.jPlayer.error[c],context:this.internal.flash.swf,
|
101 |
-
message:b.jPlayer.errorMsg[c]+a.message,hint:b.jPlayer.errorHint[c]});this.internal.flash.jq.css({width:"1px",height:"1px"})},_error:function(a){this._trigger(b.jPlayer.event.error,a);this.options.errorAlerts&&this._alert("Error!"+(a.message?"\n\n"+a.message:"")+(a.hint?"\n\n"+a.hint:"")+"\n\nContext: "+a.context)},_warning:function(a){this._trigger(b.jPlayer.event.warning,f,a);this.options.warningAlerts&&this._alert("Warning!"+(a.message?"\n\n"+a.message:"")+(a.hint?"\n\n"+a.hint:"")+"\n\nContext: "+
|
102 |
-
a.context)},_alert:function(a){alert("jPlayer "+this.version.script+" : id='"+this.internal.self.id+"' : "+a)},_emulateHtmlBridge:function(){var a=this;b.each(b.jPlayer.emulateMethods.split(/\s+/g),function(b,d){a.internal.domNode[d]=function(b){a[d](b)}});b.each(b.jPlayer.event,function(c,d){var e=!0;b.each(b.jPlayer.reservedEvent.split(/\s+/g),function(a,b){if(b===c)return e=!1});e&&a.element.bind(d+".jPlayer.jPlayerHtml",function(){a._emulateHtmlUpdate();var b=document.createEvent("Event");b.initEvent(c,
|
103 |
-
!1,!0);a.internal.domNode.dispatchEvent(b)})})},_emulateHtmlUpdate:function(){var a=this;b.each(b.jPlayer.emulateStatus.split(/\s+/g),function(b,d){a.internal.domNode[d]=a.status[d]});b.each(b.jPlayer.emulateOptions.split(/\s+/g),function(b,d){a.internal.domNode[d]=a.options[d]})},_destroyHtmlBridge:function(){var a=this;this.element.unbind(".jPlayerHtml");b.each((b.jPlayer.emulateMethods+" "+b.jPlayer.emulateStatus+" "+b.jPlayer.emulateOptions).split(/\s+/g),function(b,d){delete a.internal.domNode[d]})}};
|
104 |
-
b.jPlayer.error={FLASH:"e_flash",FLASH_DISABLED:"e_flash_disabled",NO_SOLUTION:"e_no_solution",NO_SUPPORT:"e_no_support",URL:"e_url",URL_NOT_SET:"e_url_not_set",VERSION:"e_version"};b.jPlayer.errorMsg={FLASH:"jPlayer's Flash fallback is not configured correctly, or a command was issued before the jPlayer Ready event. Details: ",FLASH_DISABLED:"jPlayer's Flash fallback has been disabled by the browser due to the CSS rules you have used. Details: ",NO_SOLUTION:"No solution can be found by jPlayer in this browser. Neither HTML nor Flash can be used.",
|
105 |
-
NO_SUPPORT:"It is not possible to play any media format provided in setMedia() on this browser using your current options.",URL:"Media URL could not be loaded.",URL_NOT_SET:"Attempt to issue media playback commands, while no media url is set.",VERSION:"jPlayer "+b.jPlayer.prototype.version.script+" needs Jplayer.swf version "+b.jPlayer.prototype.version.needFlash+" but found "};b.jPlayer.errorHint={FLASH:"Check your swfPath option and that Jplayer.swf is there.",FLASH_DISABLED:"Check that you have not display:none; the jPlayer entity or any ancestor.",
|
106 |
-
NO_SOLUTION:"Review the jPlayer options: support and supplied.",NO_SUPPORT:"Video or audio formats defined in the supplied option are missing.",URL:"Check media URL is valid.",URL_NOT_SET:"Use setMedia() to set the media URL.",VERSION:"Update jPlayer files."};b.jPlayer.warning={CSS_SELECTOR_COUNT:"e_css_selector_count",CSS_SELECTOR_METHOD:"e_css_selector_method",CSS_SELECTOR_STRING:"e_css_selector_string",OPTION_KEY:"e_option_key"};b.jPlayer.warningMsg={CSS_SELECTOR_COUNT:"The number of css selectors found did not equal one: ",
|
107 |
CSS_SELECTOR_METHOD:"The methodName given in jPlayer('cssSelector') is not a valid jPlayer method.",CSS_SELECTOR_STRING:"The methodCssSelector given in jPlayer('cssSelector') is not a String or is empty.",OPTION_KEY:"The option requested in jPlayer('option') is undefined."};b.jPlayer.warningHint={CSS_SELECTOR_COUNT:"Check your css selector and the ancestor.",CSS_SELECTOR_METHOD:"Check your method name.",CSS_SELECTOR_STRING:"Check your css selector is a string.",OPTION_KEY:"Check your option name."}});
|
1 |
+
/*
|
2 |
+
* jPlayer Plugin for jQuery JavaScript Library
|
3 |
+
* http://www.jplayer.org
|
4 |
+
*
|
5 |
+
* Copyright (c) 2009 - 2013 Happyworm Ltd
|
6 |
+
* Licensed under the MIT license.
|
7 |
+
* http://opensource.org/licenses/MIT
|
8 |
+
*
|
9 |
+
* Author: Mark J Panaghiston
|
10 |
+
* Version: 2.4.0
|
11 |
+
* Date: 5th June 2013
|
12 |
+
*/
|
13 |
+
|
14 |
+
(function(b,f){"function"===typeof define&&define.amd?define(["jquery"],f):b.jQuery?f(b.jQuery):f(b.Zepto)})(this,function(b,f){b.fn.jPlayer=function(a){var c="string"===typeof a,d=Array.prototype.slice.call(arguments,1),e=this;a=!c&&d.length?b.extend.apply(null,[!0,a].concat(d)):a;if(c&&"_"===a.charAt(0))return e;c?this.each(function(){var c=b(this).data("jPlayer"),h=c&&b.isFunction(c[a])?c[a].apply(c,d):c;if(h!==c&&h!==f)return e=h,!1}):this.each(function(){var c=b(this).data("jPlayer");c?c.option(a||
|
15 |
+
{}):b(this).data("jPlayer",new b.jPlayer(a,this))});return e};b.jPlayer=function(a,c){if(arguments.length){this.element=b(c);this.options=b.extend(!0,{},this.options,a);var d=this;this.element.bind("remove.jPlayer",function(){d.destroy()});this._init()}};"function"!==typeof b.fn.stop&&(b.fn.stop=function(){});b.jPlayer.emulateMethods="load play pause";b.jPlayer.emulateStatus="src readyState networkState currentTime duration paused ended playbackRate";b.jPlayer.emulateOptions="muted volume";b.jPlayer.reservedEvent=
|
16 |
+
"ready flashreset resize repeat error warning";b.jPlayer.event={};b.each("ready flashreset resize repeat click error warning loadstart progress suspend abort emptied stalled play pause loadedmetadata loadeddata waiting playing canplay canplaythrough seeking seeked timeupdate ended ratechange durationchange volumechange".split(" "),function(){b.jPlayer.event[this]="jPlayer_"+this});b.jPlayer.htmlEvent="loadstart abort emptied stalled loadedmetadata loadeddata canplay canplaythrough ratechange".split(" ");
|
17 |
+
b.jPlayer.pause=function(){b.each(b.jPlayer.prototype.instances,function(a,c){c.data("jPlayer").status.srcSet&&c.jPlayer("pause")})};b.jPlayer.timeFormat={showHour:!1,showMin:!0,showSec:!0,padHour:!1,padMin:!0,padSec:!0,sepHour:":",sepMin:":",sepSec:""};var l=function(){this.init()};l.prototype={init:function(){this.options={timeFormat:b.jPlayer.timeFormat}},time:function(a){var c=new Date(1E3*(a&&"number"===typeof a?a:0)),b=c.getUTCHours();a=this.options.timeFormat.showHour?c.getUTCMinutes():c.getUTCMinutes()+
|
18 |
+
60*b;c=this.options.timeFormat.showMin?c.getUTCSeconds():c.getUTCSeconds()+60*a;b=this.options.timeFormat.padHour&&10>b?"0"+b:b;a=this.options.timeFormat.padMin&&10>a?"0"+a:a;c=this.options.timeFormat.padSec&&10>c?"0"+c:c;b=""+(this.options.timeFormat.showHour?b+this.options.timeFormat.sepHour:"");b+=this.options.timeFormat.showMin?a+this.options.timeFormat.sepMin:"";return b+=this.options.timeFormat.showSec?c+this.options.timeFormat.sepSec:""}};var m=new l;b.jPlayer.convertTime=function(a){return m.time(a)};
|
19 |
+
b.jPlayer.uaBrowser=function(a){a=a.toLowerCase();var b=/(opera)(?:.*version)?[ \/]([\w.]+)/,d=/(msie) ([\w.]+)/,e=/(mozilla)(?:.*? rv:([\w.]+))?/;a=/(webkit)[ \/]([\w.]+)/.exec(a)||b.exec(a)||d.exec(a)||0>a.indexOf("compatible")&&e.exec(a)||[];return{browser:a[1]||"",version:a[2]||"0"}};b.jPlayer.uaPlatform=function(a){var b=a.toLowerCase(),d=/(android)/,e=/(mobile)/;a=/(ipad|iphone|ipod|android|blackberry|playbook|windows ce|webos)/.exec(b)||[];b=/(ipad|playbook)/.exec(b)||!e.exec(b)&&d.exec(b)||
|
20 |
+
[];a[1]&&(a[1]=a[1].replace(/\s/g,"_"));return{platform:a[1]||"",tablet:b[1]||""}};b.jPlayer.browser={};b.jPlayer.platform={};var j=b.jPlayer.uaBrowser(navigator.userAgent);j.browser&&(b.jPlayer.browser[j.browser]=!0,b.jPlayer.browser.version=j.version);j=b.jPlayer.uaPlatform(navigator.userAgent);j.platform&&(b.jPlayer.platform[j.platform]=!0,b.jPlayer.platform.mobile=!j.tablet,b.jPlayer.platform.tablet=!!j.tablet);b.jPlayer.getDocMode=function(){var a;b.jPlayer.browser.msie&&(document.documentMode?
|
21 |
+
a=document.documentMode:(a=5,document.compatMode&&"CSS1Compat"===document.compatMode&&(a=7)));return a};b.jPlayer.browser.documentMode=b.jPlayer.getDocMode();b.jPlayer.nativeFeatures={init:function(){var a=document,b=a.createElement("video"),d={w3c:"fullscreenEnabled fullscreenElement requestFullscreen exitFullscreen fullscreenchange fullscreenerror".split(" "),moz:"mozFullScreenEnabled mozFullScreenElement mozRequestFullScreen mozCancelFullScreen mozfullscreenchange mozfullscreenerror".split(" "),
|
22 |
+
webkit:" webkitCurrentFullScreenElement webkitRequestFullScreen webkitCancelFullScreen webkitfullscreenchange ".split(" "),webkitVideo:"webkitSupportsFullscreen webkitDisplayingFullscreen webkitEnterFullscreen webkitExitFullscreen ".split(" ")},e=["w3c","moz","webkit","webkitVideo"],g,h;this.fullscreen=b={support:{w3c:!!a[d.w3c[0]],moz:!!a[d.moz[0]],webkit:"function"===typeof a[d.webkit[3]],webkitVideo:"function"===typeof b[d.webkitVideo[2]]},used:{}};g=0;for(h=e.length;g<h;g++){var f=e[g];if(b.support[f]){b.spec=
|
23 |
+
f;b.used[f]=!0;break}}if(b.spec){var k=d[b.spec];b.api={fullscreenEnabled:!0,fullscreenElement:function(b){b=b?b:a;return b[k[1]]},requestFullscreen:function(a){return a[k[2]]()},exitFullscreen:function(b){b=b?b:a;return b[k[3]]()}};b.event={fullscreenchange:k[4],fullscreenerror:k[5]}}else b.api={fullscreenEnabled:!1,fullscreenElement:function(){return null},requestFullscreen:function(){},exitFullscreen:function(){}},b.event={}}};b.jPlayer.nativeFeatures.init();b.jPlayer.focus=null;b.jPlayer.keyIgnoreElementNames=
|
24 |
+
"INPUT TEXTAREA";var n=function(a){var c=b.jPlayer.focus,d;c&&(b.each(b.jPlayer.keyIgnoreElementNames.split(/\s+/g),function(b,c){if(a.target.nodeName.toUpperCase()===c.toUpperCase())return d=!0,!1}),d||b.each(c.options.keyBindings,function(d,g){if(g&&a.which===g.key&&b.isFunction(g.fn))return a.preventDefault(),g.fn(c),!1}))};b.jPlayer.keys=function(a){b(document.documentElement).unbind("keydown.jPlayer");a&&b(document.documentElement).bind("keydown.jPlayer",n)};b.jPlayer.keys(!0);b.jPlayer.prototype=
|
25 |
+
{count:0,version:{script:"2.4.0",needFlash:"2.4.0",flash:"unknown"},options:{swfPath:"js",solution:"html, flash",supplied:"mp3",preload:"metadata",volume:0.8,muted:!1,wmode:"opaque",backgroundColor:"#000000",cssSelectorAncestor:"#jp_container_1",cssSelector:{videoPlay:".jp-video-play",play:".jp-play",pause:".jp-pause",stop:".jp-stop",seekBar:".jp-seek-bar",playBar:".jp-play-bar",mute:".jp-mute",unmute:".jp-unmute",volumeBar:".jp-volume-bar",volumeBarValue:".jp-volume-bar-value",volumeMax:".jp-volume-max",
|
26 |
+
currentTime:".jp-current-time",duration:".jp-duration",fullScreen:".jp-full-screen",restoreScreen:".jp-restore-screen",repeat:".jp-repeat",repeatOff:".jp-repeat-off",gui:".jp-gui",noSolution:".jp-no-solution"},smoothPlayBar:!1,fullScreen:!1,fullWindow:!1,autohide:{restored:!1,full:!0,fadeIn:200,fadeOut:600,hold:1E3},loop:!1,repeat:function(a){a.jPlayer.options.loop?b(this).unbind(".jPlayerRepeat").bind(b.jPlayer.event.ended+".jPlayer.jPlayerRepeat",function(){b(this).jPlayer("play")}):b(this).unbind(".jPlayerRepeat")},
|
27 |
+
nativeVideoControls:{},noFullWindow:{msie:/msie [0-6]\./,ipad:/ipad.*?os [0-4]\./,iphone:/iphone/,ipod:/ipod/,android_pad:/android [0-3]\.(?!.*?mobile)/,android_phone:/android.*?mobile/,blackberry:/blackberry/,windows_ce:/windows ce/,iemobile:/iemobile/,webos:/webos/},noVolume:{ipad:/ipad/,iphone:/iphone/,ipod:/ipod/,android_pad:/android(?!.*?mobile)/,android_phone:/android.*?mobile/,blackberry:/blackberry/,windows_ce:/windows ce/,iemobile:/iemobile/,webos:/webos/,playbook:/playbook/},timeFormat:{},
|
28 |
+
keyEnabled:!1,audioFullScreen:!1,keyBindings:{play:{key:32,fn:function(a){a.status.paused?a.play():a.pause()}},fullScreen:{key:13,fn:function(a){(a.status.video||a.options.audioFullScreen)&&a._setOption("fullScreen",!a.options.fullScreen)}},muted:{key:8,fn:function(a){a._muted(!a.options.muted)}},volumeUp:{key:38,fn:function(a){a.volume(a.options.volume+0.1)}},volumeDown:{key:40,fn:function(a){a.volume(a.options.volume-0.1)}}},verticalVolume:!1,idPrefix:"jp",noConflict:"jQuery",emulateHtml:!1,errorAlerts:!1,
|
29 |
+
warningAlerts:!1},optionsAudio:{size:{width:"0px",height:"0px",cssClass:""},sizeFull:{width:"0px",height:"0px",cssClass:""}},optionsVideo:{size:{width:"480px",height:"270px",cssClass:"jp-video-270p"},sizeFull:{width:"100%",height:"100%",cssClass:"jp-video-full"}},instances:{},status:{src:"",media:{},paused:!0,format:{},formatType:"",waitForPlay:!0,waitForLoad:!0,srcSet:!1,video:!1,seekPercent:0,currentPercentRelative:0,currentPercentAbsolute:0,currentTime:0,duration:0,videoWidth:0,videoHeight:0,readyState:0,
|
30 |
+
networkState:0,playbackRate:1,ended:0},internal:{ready:!1},solution:{html:!0,flash:!0},format:{mp3:{codec:'audio/mpeg; codecs="mp3"',flashCanPlay:!0,media:"audio"},m4a:{codec:'audio/mp4; codecs="mp4a.40.2"',flashCanPlay:!0,media:"audio"},oga:{codec:'audio/ogg; codecs="vorbis"',flashCanPlay:!1,media:"audio"},wav:{codec:'audio/wav; codecs="1"',flashCanPlay:!1,media:"audio"},webma:{codec:'audio/webm; codecs="vorbis"',flashCanPlay:!1,media:"audio"},fla:{codec:"audio/x-flv",flashCanPlay:!0,media:"audio"},
|
31 |
+
rtmpa:{codec:'audio/rtmp; codecs="rtmp"',flashCanPlay:!0,media:"audio"},m4v:{codec:'video/mp4; codecs="avc1.42E01E, mp4a.40.2"',flashCanPlay:!0,media:"video"},ogv:{codec:'video/ogg; codecs="theora, vorbis"',flashCanPlay:!1,media:"video"},webmv:{codec:'video/webm; codecs="vorbis, vp8"',flashCanPlay:!1,media:"video"},flv:{codec:"video/x-flv",flashCanPlay:!0,media:"video"},rtmpv:{codec:'video/rtmp; codecs="rtmp"',flashCanPlay:!0,media:"video"}},_init:function(){var a=this;this.element.empty();this.status=
|
32 |
+
b.extend({},this.status);this.internal=b.extend({},this.internal);this.options.timeFormat=b.extend({},b.jPlayer.timeFormat,this.options.timeFormat);this.internal.cmdsIgnored=b.jPlayer.platform.ipad||b.jPlayer.platform.iphone||b.jPlayer.platform.ipod;this.internal.domNode=this.element.get(0);this.options.keyEnabled&&!b.jPlayer.focus&&(b.jPlayer.focus=this);this.formats=[];this.solutions=[];this.require={};this.htmlElement={};this.html={};this.html.audio={};this.html.video={};this.flash={};this.css=
|
33 |
+
{};this.css.cs={};this.css.jq={};this.ancestorJq=[];this.options.volume=this._limitValue(this.options.volume,0,1);b.each(this.options.supplied.toLowerCase().split(","),function(c,d){var e=d.replace(/^\s+|\s+$/g,"");if(a.format[e]){var f=!1;b.each(a.formats,function(a,b){if(e===b)return f=!0,!1});f||a.formats.push(e)}});b.each(this.options.solution.toLowerCase().split(","),function(c,d){var e=d.replace(/^\s+|\s+$/g,"");if(a.solution[e]){var f=!1;b.each(a.solutions,function(a,b){if(e===b)return f=!0,
|
34 |
+
!1});f||a.solutions.push(e)}});this.internal.instance="jp_"+this.count;this.instances[this.internal.instance]=this.element;this.element.attr("id")||this.element.attr("id",this.options.idPrefix+"_jplayer_"+this.count);this.internal.self=b.extend({},{id:this.element.attr("id"),jq:this.element});this.internal.audio=b.extend({},{id:this.options.idPrefix+"_audio_"+this.count,jq:f});this.internal.video=b.extend({},{id:this.options.idPrefix+"_video_"+this.count,jq:f});this.internal.flash=b.extend({},{id:this.options.idPrefix+
|
35 |
+
"_flash_"+this.count,jq:f,swf:this.options.swfPath+(".swf"!==this.options.swfPath.toLowerCase().slice(-4)?(this.options.swfPath&&"/"!==this.options.swfPath.slice(-1)?"/":"")+"Jplayer.swf":"")});this.internal.poster=b.extend({},{id:this.options.idPrefix+"_poster_"+this.count,jq:f});b.each(b.jPlayer.event,function(b,c){a.options[b]!==f&&(a.element.bind(c+".jPlayer",a.options[b]),a.options[b]=f)});this.require.audio=!1;this.require.video=!1;b.each(this.formats,function(b,c){a.require[a.format[c].media]=
|
36 |
+
!0});this.options=this.require.video?b.extend(!0,{},this.optionsVideo,this.options):b.extend(!0,{},this.optionsAudio,this.options);this._setSize();this.status.nativeVideoControls=this._uaBlocklist(this.options.nativeVideoControls);this.status.noFullWindow=this._uaBlocklist(this.options.noFullWindow);this.status.noVolume=this._uaBlocklist(this.options.noVolume);b.jPlayer.nativeFeatures.fullscreen.api.fullscreenEnabled&&this._fullscreenAddEventListeners();this._restrictNativeVideoControls();this.htmlElement.poster=
|
37 |
+
document.createElement("img");this.htmlElement.poster.id=this.internal.poster.id;this.htmlElement.poster.onload=function(){(!a.status.video||a.status.waitForPlay)&&a.internal.poster.jq.show()};this.element.append(this.htmlElement.poster);this.internal.poster.jq=b("#"+this.internal.poster.id);this.internal.poster.jq.css({width:this.status.width,height:this.status.height});this.internal.poster.jq.hide();this.internal.poster.jq.bind("click.jPlayer",function(){a._trigger(b.jPlayer.event.click)});this.html.audio.available=
|
38 |
+
!1;this.require.audio&&(this.htmlElement.audio=document.createElement("audio"),this.htmlElement.audio.id=this.internal.audio.id,this.html.audio.available=!!this.htmlElement.audio.canPlayType&&this._testCanPlayType(this.htmlElement.audio));this.html.video.available=!1;this.require.video&&(this.htmlElement.video=document.createElement("video"),this.htmlElement.video.id=this.internal.video.id,this.html.video.available=!!this.htmlElement.video.canPlayType&&this._testCanPlayType(this.htmlElement.video));
|
39 |
+
this.flash.available=this._checkForFlash(10.1);this.html.canPlay={};this.flash.canPlay={};b.each(this.formats,function(b,c){a.html.canPlay[c]=a.html[a.format[c].media].available&&""!==a.htmlElement[a.format[c].media].canPlayType(a.format[c].codec);a.flash.canPlay[c]=a.format[c].flashCanPlay&&a.flash.available});this.html.desired=!1;this.flash.desired=!1;b.each(this.solutions,function(c,d){if(0===c)a[d].desired=!0;else{var e=!1,f=!1;b.each(a.formats,function(b,c){a[a.solutions[0]].canPlay[c]&&("video"===
|
40 |
+
a.format[c].media?f=!0:e=!0)});a[d].desired=a.require.audio&&!e||a.require.video&&!f}});this.html.support={};this.flash.support={};b.each(this.formats,function(b,c){a.html.support[c]=a.html.canPlay[c]&&a.html.desired;a.flash.support[c]=a.flash.canPlay[c]&&a.flash.desired});this.html.used=!1;this.flash.used=!1;b.each(this.solutions,function(c,d){b.each(a.formats,function(b,c){if(a[d].support[c])return a[d].used=!0,!1})});this._resetActive();this._resetGate();this._cssSelectorAncestor(this.options.cssSelectorAncestor);
|
41 |
+
!this.html.used&&!this.flash.used?(this._error({type:b.jPlayer.error.NO_SOLUTION,context:"{solution:'"+this.options.solution+"', supplied:'"+this.options.supplied+"'}",message:b.jPlayer.errorMsg.NO_SOLUTION,hint:b.jPlayer.errorHint.NO_SOLUTION}),this.css.jq.noSolution.length&&this.css.jq.noSolution.show()):this.css.jq.noSolution.length&&this.css.jq.noSolution.hide();if(this.flash.used){var c,d="jQuery="+encodeURI(this.options.noConflict)+"&id="+encodeURI(this.internal.self.id)+"&vol="+this.options.volume+
|
42 |
+
"&muted="+this.options.muted;if(b.jPlayer.browser.msie&&(9>Number(b.jPlayer.browser.version)||9>b.jPlayer.browser.documentMode)){d=['<param name="movie" value="'+this.internal.flash.swf+'" />','<param name="FlashVars" value="'+d+'" />','<param name="allowScriptAccess" value="always" />','<param name="bgcolor" value="'+this.options.backgroundColor+'" />','<param name="wmode" value="'+this.options.wmode+'" />'];c=document.createElement('<object id="'+this.internal.flash.id+'" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="0" height="0" tabindex="-1"></object>');
|
43 |
+
for(var e=0;e<d.length;e++)c.appendChild(document.createElement(d[e]))}else e=function(a,b,c){var d=document.createElement("param");d.setAttribute("name",b);d.setAttribute("value",c);a.appendChild(d)},c=document.createElement("object"),c.setAttribute("id",this.internal.flash.id),c.setAttribute("name",this.internal.flash.id),c.setAttribute("data",this.internal.flash.swf),c.setAttribute("type","application/x-shockwave-flash"),c.setAttribute("width","1"),c.setAttribute("height","1"),c.setAttribute("tabindex",
|
44 |
+
"-1"),e(c,"flashvars",d),e(c,"allowscriptaccess","always"),e(c,"bgcolor",this.options.backgroundColor),e(c,"wmode",this.options.wmode);this.element.append(c);this.internal.flash.jq=b(c)}this.html.used&&(this.html.audio.available&&(this._addHtmlEventListeners(this.htmlElement.audio,this.html.audio),this.element.append(this.htmlElement.audio),this.internal.audio.jq=b("#"+this.internal.audio.id)),this.html.video.available&&(this._addHtmlEventListeners(this.htmlElement.video,this.html.video),this.element.append(this.htmlElement.video),
|
45 |
+
this.internal.video.jq=b("#"+this.internal.video.id),this.status.nativeVideoControls?this.internal.video.jq.css({width:this.status.width,height:this.status.height}):this.internal.video.jq.css({width:"0px",height:"0px"}),this.internal.video.jq.bind("click.jPlayer",function(){a._trigger(b.jPlayer.event.click)})));this.options.emulateHtml&&this._emulateHtmlBridge();this.html.used&&!this.flash.used&&setTimeout(function(){a.internal.ready=!0;a.version.flash="n/a";a._trigger(b.jPlayer.event.repeat);a._trigger(b.jPlayer.event.ready)},
|
46 |
+
100);this._updateNativeVideoControls();this.css.jq.videoPlay.length&&this.css.jq.videoPlay.hide();b.jPlayer.prototype.count++},destroy:function(){this.clearMedia();this._removeUiClass();this.css.jq.currentTime.length&&this.css.jq.currentTime.text("");this.css.jq.duration.length&&this.css.jq.duration.text("");b.each(this.css.jq,function(a,b){b.length&&b.unbind(".jPlayer")});this.internal.poster.jq.unbind(".jPlayer");this.internal.video.jq&&this.internal.video.jq.unbind(".jPlayer");this._fullscreenRemoveEventListeners();
|
47 |
+
this===b.jPlayer.focus&&(b.jPlayer.focus=null);this.options.emulateHtml&&this._destroyHtmlBridge();this.element.removeData("jPlayer");this.element.unbind(".jPlayer");this.element.empty();delete this.instances[this.internal.instance]},enable:function(){},disable:function(){},_testCanPlayType:function(a){try{return a.canPlayType(this.format.mp3.codec),!0}catch(b){return!1}},_uaBlocklist:function(a){var c=navigator.userAgent.toLowerCase(),d=!1;b.each(a,function(a,b){if(b&&b.test(c))return d=!0,!1});
|
48 |
+
return d},_restrictNativeVideoControls:function(){this.require.audio&&this.status.nativeVideoControls&&(this.status.nativeVideoControls=!1,this.status.noFullWindow=!0)},_updateNativeVideoControls:function(){this.html.video.available&&this.html.used&&(this.htmlElement.video.controls=this.status.nativeVideoControls,this._updateAutohide(),this.status.nativeVideoControls&&this.require.video?(this.internal.poster.jq.hide(),this.internal.video.jq.css({width:this.status.width,height:this.status.height})):
|
49 |
+
this.status.waitForPlay&&this.status.video&&(this.internal.poster.jq.show(),this.internal.video.jq.css({width:"0px",height:"0px"})))},_addHtmlEventListeners:function(a,c){var d=this;a.preload=this.options.preload;a.muted=this.options.muted;a.volume=this.options.volume;a.addEventListener("progress",function(){c.gate&&(d.internal.cmdsIgnored&&0<this.readyState&&(d.internal.cmdsIgnored=!1),d._getHtmlStatus(a),d._updateInterface(),d._trigger(b.jPlayer.event.progress))},!1);a.addEventListener("timeupdate",
|
50 |
+
function(){c.gate&&(d._getHtmlStatus(a),d._updateInterface(),d._trigger(b.jPlayer.event.timeupdate))},!1);a.addEventListener("durationchange",function(){c.gate&&(d._getHtmlStatus(a),d._updateInterface(),d._trigger(b.jPlayer.event.durationchange))},!1);a.addEventListener("play",function(){c.gate&&(d._updateButtons(!0),d._html_checkWaitForPlay(),d._trigger(b.jPlayer.event.play))},!1);a.addEventListener("playing",function(){c.gate&&(d._updateButtons(!0),d._seeked(),d._trigger(b.jPlayer.event.playing))},
|
51 |
+
!1);a.addEventListener("pause",function(){c.gate&&(d._updateButtons(!1),d._trigger(b.jPlayer.event.pause))},!1);a.addEventListener("waiting",function(){c.gate&&(d._seeking(),d._trigger(b.jPlayer.event.waiting))},!1);a.addEventListener("seeking",function(){c.gate&&(d._seeking(),d._trigger(b.jPlayer.event.seeking))},!1);a.addEventListener("seeked",function(){c.gate&&(d._seeked(),d._trigger(b.jPlayer.event.seeked))},!1);a.addEventListener("volumechange",function(){c.gate&&(d.options.volume=a.volume,
|
52 |
+
d.options.muted=a.muted,d._updateMute(),d._updateVolume(),d._trigger(b.jPlayer.event.volumechange))},!1);a.addEventListener("suspend",function(){c.gate&&(d._seeked(),d._trigger(b.jPlayer.event.suspend))},!1);a.addEventListener("ended",function(){c.gate&&(b.jPlayer.browser.webkit||(d.htmlElement.media.currentTime=0),d.htmlElement.media.pause(),d._updateButtons(!1),d._getHtmlStatus(a,!0),d._updateInterface(),d._trigger(b.jPlayer.event.ended))},!1);a.addEventListener("error",function(){c.gate&&(d._updateButtons(!1),
|
53 |
+
d._seeked(),d.status.srcSet&&(clearTimeout(d.internal.htmlDlyCmdId),d.status.waitForLoad=!0,d.status.waitForPlay=!0,d.status.video&&!d.status.nativeVideoControls&&d.internal.video.jq.css({width:"0px",height:"0px"}),d._validString(d.status.media.poster)&&!d.status.nativeVideoControls&&d.internal.poster.jq.show(),d.css.jq.videoPlay.length&&d.css.jq.videoPlay.show(),d._error({type:b.jPlayer.error.URL,context:d.status.src,message:b.jPlayer.errorMsg.URL,hint:b.jPlayer.errorHint.URL})))},!1);b.each(b.jPlayer.htmlEvent,
|
54 |
+
function(e,g){a.addEventListener(this,function(){c.gate&&d._trigger(b.jPlayer.event[g])},!1)})},_getHtmlStatus:function(a,b){var d=0,e=0,g=0,f=0;isFinite(a.duration)&&(this.status.duration=a.duration);d=a.currentTime;e=0<this.status.duration?100*d/this.status.duration:0;"object"===typeof a.seekable&&0<a.seekable.length?(g=0<this.status.duration?100*a.seekable.end(a.seekable.length-1)/this.status.duration:100,f=0<this.status.duration?100*a.currentTime/a.seekable.end(a.seekable.length-1):0):(g=100,
|
55 |
+
f=e);b&&(e=f=d=0);this.status.seekPercent=g;this.status.currentPercentRelative=f;this.status.currentPercentAbsolute=e;this.status.currentTime=d;this.status.videoWidth=a.videoWidth;this.status.videoHeight=a.videoHeight;this.status.readyState=a.readyState;this.status.networkState=a.networkState;this.status.playbackRate=a.playbackRate;this.status.ended=a.ended},_resetStatus:function(){this.status=b.extend({},this.status,b.jPlayer.prototype.status)},_trigger:function(a,c,d){a=b.Event(a);a.jPlayer={};
|
56 |
+
a.jPlayer.version=b.extend({},this.version);a.jPlayer.options=b.extend(!0,{},this.options);a.jPlayer.status=b.extend(!0,{},this.status);a.jPlayer.html=b.extend(!0,{},this.html);a.jPlayer.flash=b.extend(!0,{},this.flash);c&&(a.jPlayer.error=b.extend({},c));d&&(a.jPlayer.warning=b.extend({},d));this.element.trigger(a)},jPlayerFlashEvent:function(a,c){if(a===b.jPlayer.event.ready)if(this.internal.ready){if(this.flash.gate){if(this.status.srcSet){var d=this.status.currentTime,e=this.status.paused;this.setMedia(this.status.media);
|
57 |
+
0<d&&(e?this.pause(d):this.play(d))}this._trigger(b.jPlayer.event.flashreset)}}else this.internal.ready=!0,this.internal.flash.jq.css({width:"0px",height:"0px"}),this.version.flash=c.version,this.version.needFlash!==this.version.flash&&this._error({type:b.jPlayer.error.VERSION,context:this.version.flash,message:b.jPlayer.errorMsg.VERSION+this.version.flash,hint:b.jPlayer.errorHint.VERSION}),this._trigger(b.jPlayer.event.repeat),this._trigger(a);if(this.flash.gate)switch(a){case b.jPlayer.event.progress:this._getFlashStatus(c);
|
58 |
+
this._updateInterface();this._trigger(a);break;case b.jPlayer.event.timeupdate:this._getFlashStatus(c);this._updateInterface();this._trigger(a);break;case b.jPlayer.event.play:this._seeked();this._updateButtons(!0);this._trigger(a);break;case b.jPlayer.event.pause:this._updateButtons(!1);this._trigger(a);break;case b.jPlayer.event.ended:this._updateButtons(!1);this._trigger(a);break;case b.jPlayer.event.click:this._trigger(a);break;case b.jPlayer.event.error:this.status.waitForLoad=!0;this.status.waitForPlay=
|
59 |
+
!0;this.status.video&&this.internal.flash.jq.css({width:"0px",height:"0px"});this._validString(this.status.media.poster)&&this.internal.poster.jq.show();this.css.jq.videoPlay.length&&this.status.video&&this.css.jq.videoPlay.show();this.status.video?this._flash_setVideo(this.status.media):this._flash_setAudio(this.status.media);this._updateButtons(!1);this._error({type:b.jPlayer.error.URL,context:c.src,message:b.jPlayer.errorMsg.URL,hint:b.jPlayer.errorHint.URL});break;case b.jPlayer.event.seeking:this._seeking();
|
60 |
+
this._trigger(a);break;case b.jPlayer.event.seeked:this._seeked();this._trigger(a);break;case b.jPlayer.event.ready:break;default:this._trigger(a)}return!1},_getFlashStatus:function(a){this.status.seekPercent=a.seekPercent;this.status.currentPercentRelative=a.currentPercentRelative;this.status.currentPercentAbsolute=a.currentPercentAbsolute;this.status.currentTime=a.currentTime;this.status.duration=a.duration;this.status.videoWidth=a.videoWidth;this.status.videoHeight=a.videoHeight;this.status.readyState=
|
61 |
+
4;this.status.networkState=0;this.status.playbackRate=1;this.status.ended=!1},_updateButtons:function(a){a===f?a=!this.status.paused:this.status.paused=!a;this.css.jq.play.length&&this.css.jq.pause.length&&(a?(this.css.jq.play.hide(),this.css.jq.pause.show()):(this.css.jq.play.show(),this.css.jq.pause.hide()));this.css.jq.restoreScreen.length&&this.css.jq.fullScreen.length&&(this.status.noFullWindow?(this.css.jq.fullScreen.hide(),this.css.jq.restoreScreen.hide()):this.options.fullWindow?(this.css.jq.fullScreen.hide(),
|
62 |
+
this.css.jq.restoreScreen.show()):(this.css.jq.fullScreen.show(),this.css.jq.restoreScreen.hide()));this.css.jq.repeat.length&&this.css.jq.repeatOff.length&&(this.options.loop?(this.css.jq.repeat.hide(),this.css.jq.repeatOff.show()):(this.css.jq.repeat.show(),this.css.jq.repeatOff.hide()))},_updateInterface:function(){this.css.jq.seekBar.length&&this.css.jq.seekBar.width(this.status.seekPercent+"%");this.css.jq.playBar.length&&(this.options.smoothPlayBar?this.css.jq.playBar.stop().animate({width:this.status.currentPercentAbsolute+
|
63 |
+
"%"},250,"linear"):this.css.jq.playBar.width(this.status.currentPercentRelative+"%"));this.css.jq.currentTime.length&&this.css.jq.currentTime.text(this._convertTime(this.status.currentTime));this.css.jq.duration.length&&this.css.jq.duration.text(this._convertTime(this.status.duration))},_convertTime:l.prototype.time,_seeking:function(){this.css.jq.seekBar.length&&this.css.jq.seekBar.addClass("jp-seeking-bg")},_seeked:function(){this.css.jq.seekBar.length&&this.css.jq.seekBar.removeClass("jp-seeking-bg")},
|
64 |
+
_resetGate:function(){this.html.audio.gate=!1;this.html.video.gate=!1;this.flash.gate=!1},_resetActive:function(){this.html.active=!1;this.flash.active=!1},setMedia:function(a){var c=this,d=!1,e=this.status.media.poster!==a.poster;this._resetMedia();this._resetGate();this._resetActive();b.each(this.formats,function(e,f){var j="video"===c.format[f].media;b.each(c.solutions,function(b,e){if(c[e].support[f]&&c._validString(a[f])){var g="html"===e;j?(g?(c.html.video.gate=!0,c._html_setVideo(a),c.html.active=
|
65 |
+
!0):(c.flash.gate=!0,c._flash_setVideo(a),c.flash.active=!0),c.css.jq.videoPlay.length&&c.css.jq.videoPlay.show(),c.status.video=!0):(g?(c.html.audio.gate=!0,c._html_setAudio(a),c.html.active=!0):(c.flash.gate=!0,c._flash_setAudio(a),c.flash.active=!0),c.css.jq.videoPlay.length&&c.css.jq.videoPlay.hide(),c.status.video=!1);d=!0;return!1}});if(d)return!1});if(d){if((!this.status.nativeVideoControls||!this.html.video.gate)&&this._validString(a.poster))e?this.htmlElement.poster.src=a.poster:this.internal.poster.jq.show();
|
66 |
+
this.status.srcSet=!0;this.status.media=b.extend({},a);this._updateButtons(!1);this._updateInterface()}else this._error({type:b.jPlayer.error.NO_SUPPORT,context:"{supplied:'"+this.options.supplied+"'}",message:b.jPlayer.errorMsg.NO_SUPPORT,hint:b.jPlayer.errorHint.NO_SUPPORT})},_resetMedia:function(){this._resetStatus();this._updateButtons(!1);this._updateInterface();this._seeked();this.internal.poster.jq.hide();clearTimeout(this.internal.htmlDlyCmdId);this.html.active?this._html_resetMedia():this.flash.active&&
|
67 |
+
this._flash_resetMedia()},clearMedia:function(){this._resetMedia();this.html.active?this._html_clearMedia():this.flash.active&&this._flash_clearMedia();this._resetGate();this._resetActive()},load:function(){this.status.srcSet?this.html.active?this._html_load():this.flash.active&&this._flash_load():this._urlNotSetError("load")},focus:function(){this.options.keyEnabled&&(b.jPlayer.focus=this)},play:function(a){a="number"===typeof a?a:NaN;this.status.srcSet?(this.focus(),this.html.active?this._html_play(a):
|
68 |
+
this.flash.active&&this._flash_play(a)):this._urlNotSetError("play")},videoPlay:function(){this.play()},pause:function(a){a="number"===typeof a?a:NaN;this.status.srcSet?this.html.active?this._html_pause(a):this.flash.active&&this._flash_pause(a):this._urlNotSetError("pause")},pauseOthers:function(){var a=this;b.each(this.instances,function(b,d){a.element!==d&&d.data("jPlayer").status.srcSet&&d.jPlayer("pause")})},stop:function(){this.status.srcSet?this.html.active?this._html_pause(0):this.flash.active&&
|
69 |
+
this._flash_pause(0):this._urlNotSetError("stop")},playHead:function(a){a=this._limitValue(a,0,100);this.status.srcSet?this.html.active?this._html_playHead(a):this.flash.active&&this._flash_playHead(a):this._urlNotSetError("playHead")},_muted:function(a){this.options.muted=a;this.html.used&&this._html_mute(a);this.flash.used&&this._flash_mute(a);!this.html.video.gate&&!this.html.audio.gate&&(this._updateMute(a),this._updateVolume(this.options.volume),this._trigger(b.jPlayer.event.volumechange))},
|
70 |
+
mute:function(a){a=a===f?!0:!!a;this._muted(a)},unmute:function(a){a=a===f?!0:!!a;this._muted(!a)},_updateMute:function(a){a===f&&(a=this.options.muted);this.css.jq.mute.length&&this.css.jq.unmute.length&&(this.status.noVolume?(this.css.jq.mute.hide(),this.css.jq.unmute.hide()):a?(this.css.jq.mute.hide(),this.css.jq.unmute.show()):(this.css.jq.mute.show(),this.css.jq.unmute.hide()))},volume:function(a){a=this._limitValue(a,0,1);this.options.volume=a;this.html.used&&this._html_volume(a);this.flash.used&&
|
71 |
+
this._flash_volume(a);!this.html.video.gate&&!this.html.audio.gate&&(this._updateVolume(a),this._trigger(b.jPlayer.event.volumechange))},volumeBar:function(a){if(this.css.jq.volumeBar.length){var c=b(a.currentTarget),d=c.offset(),e=a.pageX-d.left,g=c.width();a=c.height()-a.pageY+d.top;c=c.height();this.options.verticalVolume?this.volume(a/c):this.volume(e/g)}this.options.muted&&this._muted(!1)},volumeBarValue:function(){},_updateVolume:function(a){a===f&&(a=this.options.volume);a=this.options.muted?
|
72 |
+
0:a;this.status.noVolume?(this.css.jq.volumeBar.length&&this.css.jq.volumeBar.hide(),this.css.jq.volumeBarValue.length&&this.css.jq.volumeBarValue.hide(),this.css.jq.volumeMax.length&&this.css.jq.volumeMax.hide()):(this.css.jq.volumeBar.length&&this.css.jq.volumeBar.show(),this.css.jq.volumeBarValue.length&&(this.css.jq.volumeBarValue.show(),this.css.jq.volumeBarValue[this.options.verticalVolume?"height":"width"](100*a+"%")),this.css.jq.volumeMax.length&&this.css.jq.volumeMax.show())},volumeMax:function(){this.volume(1);
|
73 |
+
this.options.muted&&this._muted(!1)},_cssSelectorAncestor:function(a){var c=this;this.options.cssSelectorAncestor=a;this._removeUiClass();this.ancestorJq=a?b(a):[];a&&1!==this.ancestorJq.length&&this._warning({type:b.jPlayer.warning.CSS_SELECTOR_COUNT,context:a,message:b.jPlayer.warningMsg.CSS_SELECTOR_COUNT+this.ancestorJq.length+" found for cssSelectorAncestor.",hint:b.jPlayer.warningHint.CSS_SELECTOR_COUNT});this._addUiClass();b.each(this.options.cssSelector,function(a,b){c._cssSelector(a,b)});
|
74 |
+
this._updateInterface();this._updateButtons();this._updateAutohide();this._updateVolume();this._updateMute()},_cssSelector:function(a,c){var d=this;"string"===typeof c?b.jPlayer.prototype.options.cssSelector[a]?(this.css.jq[a]&&this.css.jq[a].length&&this.css.jq[a].unbind(".jPlayer"),this.options.cssSelector[a]=c,this.css.cs[a]=this.options.cssSelectorAncestor+" "+c,this.css.jq[a]=c?b(this.css.cs[a]):[],this.css.jq[a].length&&this.css.jq[a].bind("click.jPlayer",function(c){c.preventDefault();d[a](c);
|
75 |
+
b(this).blur()}),c&&1!==this.css.jq[a].length&&this._warning({type:b.jPlayer.warning.CSS_SELECTOR_COUNT,context:this.css.cs[a],message:b.jPlayer.warningMsg.CSS_SELECTOR_COUNT+this.css.jq[a].length+" found for "+a+" method.",hint:b.jPlayer.warningHint.CSS_SELECTOR_COUNT})):this._warning({type:b.jPlayer.warning.CSS_SELECTOR_METHOD,context:a,message:b.jPlayer.warningMsg.CSS_SELECTOR_METHOD,hint:b.jPlayer.warningHint.CSS_SELECTOR_METHOD}):this._warning({type:b.jPlayer.warning.CSS_SELECTOR_STRING,context:c,
|
76 |
+
message:b.jPlayer.warningMsg.CSS_SELECTOR_STRING,hint:b.jPlayer.warningHint.CSS_SELECTOR_STRING})},seekBar:function(a){if(this.css.jq.seekBar.length){var c=b(a.currentTarget),d=c.offset();a=a.pageX-d.left;c=c.width();this.playHead(100*a/c)}},playBar:function(){},repeat:function(){this._loop(!0)},repeatOff:function(){this._loop(!1)},_loop:function(a){this.options.loop!==a&&(this.options.loop=a,this._updateButtons(),this._trigger(b.jPlayer.event.repeat))},currentTime:function(){},duration:function(){},
|
77 |
+
gui:function(){},noSolution:function(){},option:function(a,c){var d=a;if(0===arguments.length)return b.extend(!0,{},this.options);if("string"===typeof a){var e=a.split(".");if(c===f){for(var d=b.extend(!0,{},this.options),g=0;g<e.length;g++)if(d[e[g]]!==f)d=d[e[g]];else return this._warning({type:b.jPlayer.warning.OPTION_KEY,context:a,message:b.jPlayer.warningMsg.OPTION_KEY,hint:b.jPlayer.warningHint.OPTION_KEY}),f;return d}for(var g=d={},h=0;h<e.length;h++)h<e.length-1?(g[e[h]]={},g=g[e[h]]):g[e[h]]=
|
78 |
+
c}this._setOptions(d);return this},_setOptions:function(a){var c=this;b.each(a,function(a,b){c._setOption(a,b)});return this},_setOption:function(a,c){var d=this;switch(a){case "volume":this.volume(c);break;case "muted":this._muted(c);break;case "cssSelectorAncestor":this._cssSelectorAncestor(c);break;case "cssSelector":b.each(c,function(a,b){d._cssSelector(a,b)});break;case "fullScreen":if(this.options[a]!==c){var e=b.jPlayer.nativeFeatures.fullscreen.used.webkitVideo;if(!e||e&&!this.status.waitForPlay)e||
|
79 |
+
(this.options[a]=c),c?this._requestFullscreen():this._exitFullscreen(),e||this._setOption("fullWindow",c)}break;case "fullWindow":this.options[a]!==c&&(this._removeUiClass(),this.options[a]=c,this._refreshSize());break;case "size":!this.options.fullWindow&&this.options[a].cssClass!==c.cssClass&&this._removeUiClass();this.options[a]=b.extend({},this.options[a],c);this._refreshSize();break;case "sizeFull":this.options.fullWindow&&this.options[a].cssClass!==c.cssClass&&this._removeUiClass();this.options[a]=
|
80 |
+
b.extend({},this.options[a],c);this._refreshSize();break;case "autohide":this.options[a]=b.extend({},this.options[a],c);this._updateAutohide();break;case "loop":this._loop(c);break;case "nativeVideoControls":this.options[a]=b.extend({},this.options[a],c);this.status.nativeVideoControls=this._uaBlocklist(this.options.nativeVideoControls);this._restrictNativeVideoControls();this._updateNativeVideoControls();break;case "noFullWindow":this.options[a]=b.extend({},this.options[a],c);this.status.nativeVideoControls=
|
81 |
+
this._uaBlocklist(this.options.nativeVideoControls);this.status.noFullWindow=this._uaBlocklist(this.options.noFullWindow);this._restrictNativeVideoControls();this._updateButtons();break;case "noVolume":this.options[a]=b.extend({},this.options[a],c);this.status.noVolume=this._uaBlocklist(this.options.noVolume);this._updateVolume();this._updateMute();break;case "emulateHtml":this.options[a]!==c&&((this.options[a]=c)?this._emulateHtmlBridge():this._destroyHtmlBridge());break;case "timeFormat":this.options[a]=
|
82 |
+
b.extend({},this.options[a],c);break;case "keyEnabled":this.options[a]=c;!c&&this===b.jPlayer.focus&&(b.jPlayer.focus=null);break;case "keyBindings":this.options[a]=b.extend(!0,{},this.options[a],c);break;case "audioFullScreen":this.options[a]=c}return this},_refreshSize:function(){this._setSize();this._addUiClass();this._updateSize();this._updateButtons();this._updateAutohide();this._trigger(b.jPlayer.event.resize)},_setSize:function(){this.options.fullWindow?(this.status.width=this.options.sizeFull.width,
|
83 |
+
this.status.height=this.options.sizeFull.height,this.status.cssClass=this.options.sizeFull.cssClass):(this.status.width=this.options.size.width,this.status.height=this.options.size.height,this.status.cssClass=this.options.size.cssClass);this.element.css({width:this.status.width,height:this.status.height})},_addUiClass:function(){this.ancestorJq.length&&this.ancestorJq.addClass(this.status.cssClass)},_removeUiClass:function(){this.ancestorJq.length&&this.ancestorJq.removeClass(this.status.cssClass)},
|
84 |
+
_updateSize:function(){this.internal.poster.jq.css({width:this.status.width,height:this.status.height});!this.status.waitForPlay&&this.html.active&&this.status.video||this.html.video.available&&this.html.used&&this.status.nativeVideoControls?this.internal.video.jq.css({width:this.status.width,height:this.status.height}):!this.status.waitForPlay&&(this.flash.active&&this.status.video)&&this.internal.flash.jq.css({width:this.status.width,height:this.status.height})},_updateAutohide:function(){var a=
|
85 |
+
this,b=function(){a.css.jq.gui.fadeIn(a.options.autohide.fadeIn,function(){clearTimeout(a.internal.autohideId);a.internal.autohideId=setTimeout(function(){a.css.jq.gui.fadeOut(a.options.autohide.fadeOut)},a.options.autohide.hold)})};this.css.jq.gui.length&&(this.css.jq.gui.stop(!0,!0),clearTimeout(this.internal.autohideId),this.element.unbind(".jPlayerAutohide"),this.css.jq.gui.unbind(".jPlayerAutohide"),this.status.nativeVideoControls?this.css.jq.gui.hide():this.options.fullWindow&&this.options.autohide.full||
|
86 |
+
!this.options.fullWindow&&this.options.autohide.restored?(this.element.bind("mousemove.jPlayer.jPlayerAutohide",b),this.css.jq.gui.bind("mousemove.jPlayer.jPlayerAutohide",b),this.css.jq.gui.hide()):this.css.jq.gui.show())},fullScreen:function(){this._setOption("fullScreen",!0)},restoreScreen:function(){this._setOption("fullScreen",!1)},_fullscreenAddEventListeners:function(){var a=this,c=b.jPlayer.nativeFeatures.fullscreen;c.api.fullscreenEnabled&&c.event.fullscreenchange&&("function"!==typeof this.internal.fullscreenchangeHandler&&
|
87 |
+
(this.internal.fullscreenchangeHandler=function(){a._fullscreenchange()}),document.addEventListener(c.event.fullscreenchange,this.internal.fullscreenchangeHandler,!1))},_fullscreenRemoveEventListeners:function(){var a=b.jPlayer.nativeFeatures.fullscreen;this.internal.fullscreenchangeHandler&&document.addEventListener(a.event.fullscreenchange,this.internal.fullscreenchangeHandler,!1)},_fullscreenchange:function(){this.options.fullScreen&&!b.jPlayer.nativeFeatures.fullscreen.api.fullscreenElement()&&
|
88 |
+
this._setOption("fullScreen",!1)},_requestFullscreen:function(){var a=this.ancestorJq.length?this.ancestorJq[0]:this.element[0],c=b.jPlayer.nativeFeatures.fullscreen;c.used.webkitVideo&&(a=this.htmlElement.video);c.api.fullscreenEnabled&&c.api.requestFullscreen(a)},_exitFullscreen:function(){var a=b.jPlayer.nativeFeatures.fullscreen,c;a.used.webkitVideo&&(c=this.htmlElement.video);a.api.fullscreenEnabled&&a.api.exitFullscreen(c)},_html_initMedia:function(a){var c=b(this.htmlElement.media).empty();
|
89 |
+
b.each(a.track||[],function(a,b){var g=document.createElement("track");g.setAttribute("kind",b.kind?b.kind:"");g.setAttribute("src",b.src?b.src:"");g.setAttribute("srclang",b.srclang?b.srclang:"");g.setAttribute("label",b.label?b.label:"");b.def&&g.setAttribute("default",b.def);c.append(g)});this.htmlElement.media.src=this.status.src;"none"!==this.options.preload&&this._html_load();this._trigger(b.jPlayer.event.timeupdate)},_html_setFormat:function(a){var c=this;b.each(this.formats,function(b,e){if(c.html.support[e]&&
|
90 |
+
a[e])return c.status.src=a[e],c.status.format[e]=!0,c.status.formatType=e,!1})},_html_setAudio:function(a){this._html_setFormat(a);this.htmlElement.media=this.htmlElement.audio;this._html_initMedia(a)},_html_setVideo:function(a){this._html_setFormat(a);this.status.nativeVideoControls&&(this.htmlElement.video.poster=this._validString(a.poster)?a.poster:"");this.htmlElement.media=this.htmlElement.video;this._html_initMedia(a)},_html_resetMedia:function(){this.htmlElement.media&&(this.htmlElement.media.id===
|
91 |
+
this.internal.video.id&&!this.status.nativeVideoControls&&this.internal.video.jq.css({width:"0px",height:"0px"}),this.htmlElement.media.pause())},_html_clearMedia:function(){this.htmlElement.media&&(this.htmlElement.media.src="about:blank",this.htmlElement.media.load())},_html_load:function(){this.status.waitForLoad&&(this.status.waitForLoad=!1,this.htmlElement.media.load());clearTimeout(this.internal.htmlDlyCmdId)},_html_play:function(a){var b=this,d=this.htmlElement.media;this._html_load();if(isNaN(a))d.play();
|
92 |
+
else{this.internal.cmdsIgnored&&d.play();try{if(!d.seekable||"object"===typeof d.seekable&&0<d.seekable.length)d.currentTime=a,d.play();else throw 1;}catch(e){this.internal.htmlDlyCmdId=setTimeout(function(){b.play(a)},250);return}}this._html_checkWaitForPlay()},_html_pause:function(a){var b=this,d=this.htmlElement.media;0<a?this._html_load():clearTimeout(this.internal.htmlDlyCmdId);d.pause();if(!isNaN(a))try{if(!d.seekable||"object"===typeof d.seekable&&0<d.seekable.length)d.currentTime=a;else throw 1;
|
93 |
+
}catch(e){this.internal.htmlDlyCmdId=setTimeout(function(){b.pause(a)},250);return}0<a&&this._html_checkWaitForPlay()},_html_playHead:function(a){var b=this,d=this.htmlElement.media;this._html_load();try{if("object"===typeof d.seekable&&0<d.seekable.length)d.currentTime=a*d.seekable.end(d.seekable.length-1)/100;else if(0<d.duration&&!isNaN(d.duration))d.currentTime=a*d.duration/100;else throw"e";}catch(e){this.internal.htmlDlyCmdId=setTimeout(function(){b.playHead(a)},250);return}this.status.waitForLoad||
|
94 |
+
this._html_checkWaitForPlay()},_html_checkWaitForPlay:function(){this.status.waitForPlay&&(this.status.waitForPlay=!1,this.css.jq.videoPlay.length&&this.css.jq.videoPlay.hide(),this.status.video&&(this.internal.poster.jq.hide(),this.internal.video.jq.css({width:this.status.width,height:this.status.height})))},_html_volume:function(a){this.html.audio.available&&(this.htmlElement.audio.volume=a);this.html.video.available&&(this.htmlElement.video.volume=a)},_html_mute:function(a){this.html.audio.available&&
|
95 |
+
(this.htmlElement.audio.muted=a);this.html.video.available&&(this.htmlElement.video.muted=a)},_flash_setAudio:function(a){var c=this;try{b.each(this.formats,function(b,d){if(c.flash.support[d]&&a[d]){switch(d){case "m4a":case "fla":c._getMovie().fl_setAudio_m4a(a[d]);break;case "mp3":c._getMovie().fl_setAudio_mp3(a[d]);break;case "rtmpa":c._getMovie().fl_setAudio_rtmp(a[d])}c.status.src=a[d];c.status.format[d]=!0;c.status.formatType=d;return!1}}),"auto"===this.options.preload&&(this._flash_load(),
|
96 |
+
this.status.waitForLoad=!1)}catch(d){this._flashError(d)}},_flash_setVideo:function(a){var c=this;try{b.each(this.formats,function(b,d){if(c.flash.support[d]&&a[d]){switch(d){case "m4v":case "flv":c._getMovie().fl_setVideo_m4v(a[d]);break;case "rtmpv":c._getMovie().fl_setVideo_rtmp(a[d])}c.status.src=a[d];c.status.format[d]=!0;c.status.formatType=d;return!1}}),"auto"===this.options.preload&&(this._flash_load(),this.status.waitForLoad=!1)}catch(d){this._flashError(d)}},_flash_resetMedia:function(){this.internal.flash.jq.css({width:"0px",
|
97 |
+
height:"0px"});this._flash_pause(NaN)},_flash_clearMedia:function(){try{this._getMovie().fl_clearMedia()}catch(a){this._flashError(a)}},_flash_load:function(){try{this._getMovie().fl_load()}catch(a){this._flashError(a)}this.status.waitForLoad=!1},_flash_play:function(a){try{this._getMovie().fl_play(a)}catch(b){this._flashError(b)}this.status.waitForLoad=!1;this._flash_checkWaitForPlay()},_flash_pause:function(a){try{this._getMovie().fl_pause(a)}catch(b){this._flashError(b)}0<a&&(this.status.waitForLoad=
|
98 |
+
!1,this._flash_checkWaitForPlay())},_flash_playHead:function(a){try{this._getMovie().fl_play_head(a)}catch(b){this._flashError(b)}this.status.waitForLoad||this._flash_checkWaitForPlay()},_flash_checkWaitForPlay:function(){this.status.waitForPlay&&(this.status.waitForPlay=!1,this.css.jq.videoPlay.length&&this.css.jq.videoPlay.hide(),this.status.video&&(this.internal.poster.jq.hide(),this.internal.flash.jq.css({width:this.status.width,height:this.status.height})))},_flash_volume:function(a){try{this._getMovie().fl_volume(a)}catch(b){this._flashError(b)}},
|
99 |
+
_flash_mute:function(a){try{this._getMovie().fl_mute(a)}catch(b){this._flashError(b)}},_getMovie:function(){return document[this.internal.flash.id]},_getFlashPluginVersion:function(){var a=0,b;if(window.ActiveXObject)try{if(b=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")){var d=b.GetVariable("$version");d&&(d=d.split(" ")[1].split(","),a=parseInt(d[0],10)+"."+parseInt(d[1],10))}}catch(e){}else navigator.plugins&&0<navigator.mimeTypes.length&&(b=navigator.plugins["Shockwave Flash"])&&(a=navigator.plugins["Shockwave Flash"].description.replace(/.*\s(\d+\.\d+).*/,
|
100 |
+
"$1"));return 1*a},_checkForFlash:function(a){var b=!1;this._getFlashPluginVersion()>=a&&(b=!0);return b},_validString:function(a){return a&&"string"===typeof a},_limitValue:function(a,b,d){return a<b?b:a>d?d:a},_urlNotSetError:function(a){this._error({type:b.jPlayer.error.URL_NOT_SET,context:a,message:b.jPlayer.errorMsg.URL_NOT_SET,hint:b.jPlayer.errorHint.URL_NOT_SET})},_flashError:function(a){var c;c=this.internal.ready?"FLASH_DISABLED":"FLASH";this._error({type:b.jPlayer.error[c],context:this.internal.flash.swf,
|
101 |
+
message:b.jPlayer.errorMsg[c]+a.message,hint:b.jPlayer.errorHint[c]});this.internal.flash.jq.css({width:"1px",height:"1px"})},_error:function(a){this._trigger(b.jPlayer.event.error,a);this.options.errorAlerts&&this._alert("Error!"+(a.message?"\n\n"+a.message:"")+(a.hint?"\n\n"+a.hint:"")+"\n\nContext: "+a.context)},_warning:function(a){this._trigger(b.jPlayer.event.warning,f,a);this.options.warningAlerts&&this._alert("Warning!"+(a.message?"\n\n"+a.message:"")+(a.hint?"\n\n"+a.hint:"")+"\n\nContext: "+
|
102 |
+
a.context)},_alert:function(a){alert("jPlayer "+this.version.script+" : id='"+this.internal.self.id+"' : "+a)},_emulateHtmlBridge:function(){var a=this;b.each(b.jPlayer.emulateMethods.split(/\s+/g),function(b,d){a.internal.domNode[d]=function(b){a[d](b)}});b.each(b.jPlayer.event,function(c,d){var e=!0;b.each(b.jPlayer.reservedEvent.split(/\s+/g),function(a,b){if(b===c)return e=!1});e&&a.element.bind(d+".jPlayer.jPlayerHtml",function(){a._emulateHtmlUpdate();var b=document.createEvent("Event");b.initEvent(c,
|
103 |
+
!1,!0);a.internal.domNode.dispatchEvent(b)})})},_emulateHtmlUpdate:function(){var a=this;b.each(b.jPlayer.emulateStatus.split(/\s+/g),function(b,d){a.internal.domNode[d]=a.status[d]});b.each(b.jPlayer.emulateOptions.split(/\s+/g),function(b,d){a.internal.domNode[d]=a.options[d]})},_destroyHtmlBridge:function(){var a=this;this.element.unbind(".jPlayerHtml");b.each((b.jPlayer.emulateMethods+" "+b.jPlayer.emulateStatus+" "+b.jPlayer.emulateOptions).split(/\s+/g),function(b,d){delete a.internal.domNode[d]})}};
|
104 |
+
b.jPlayer.error={FLASH:"e_flash",FLASH_DISABLED:"e_flash_disabled",NO_SOLUTION:"e_no_solution",NO_SUPPORT:"e_no_support",URL:"e_url",URL_NOT_SET:"e_url_not_set",VERSION:"e_version"};b.jPlayer.errorMsg={FLASH:"jPlayer's Flash fallback is not configured correctly, or a command was issued before the jPlayer Ready event. Details: ",FLASH_DISABLED:"jPlayer's Flash fallback has been disabled by the browser due to the CSS rules you have used. Details: ",NO_SOLUTION:"No solution can be found by jPlayer in this browser. Neither HTML nor Flash can be used.",
|
105 |
+
NO_SUPPORT:"It is not possible to play any media format provided in setMedia() on this browser using your current options.",URL:"Media URL could not be loaded.",URL_NOT_SET:"Attempt to issue media playback commands, while no media url is set.",VERSION:"jPlayer "+b.jPlayer.prototype.version.script+" needs Jplayer.swf version "+b.jPlayer.prototype.version.needFlash+" but found "};b.jPlayer.errorHint={FLASH:"Check your swfPath option and that Jplayer.swf is there.",FLASH_DISABLED:"Check that you have not display:none; the jPlayer entity or any ancestor.",
|
106 |
+
NO_SOLUTION:"Review the jPlayer options: support and supplied.",NO_SUPPORT:"Video or audio formats defined in the supplied option are missing.",URL:"Check media URL is valid.",URL_NOT_SET:"Use setMedia() to set the media URL.",VERSION:"Update jPlayer files."};b.jPlayer.warning={CSS_SELECTOR_COUNT:"e_css_selector_count",CSS_SELECTOR_METHOD:"e_css_selector_method",CSS_SELECTOR_STRING:"e_css_selector_string",OPTION_KEY:"e_option_key"};b.jPlayer.warningMsg={CSS_SELECTOR_COUNT:"The number of css selectors found did not equal one: ",
|
107 |
CSS_SELECTOR_METHOD:"The methodName given in jPlayer('cssSelector') is not a valid jPlayer method.",CSS_SELECTOR_STRING:"The methodCssSelector given in jPlayer('cssSelector') is not a String or is empty.",OPTION_KEY:"The option requested in jPlayer('option') is undefined."};b.jPlayer.warningHint={CSS_SELECTOR_COUNT:"Check your css selector and the ancestor.",CSS_SELECTOR_METHOD:"Check your method name.",CSS_SELECTOR_STRING:"Check your css selector is a string.",OPTION_KEY:"Check your option name."}});
|
assets/js/magnific-popup.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
// Magnific Popup v0.9.5 by Dmitry Semenov
|
2 |
-
// http://bit.ly/magnific-popup#build=inline+image+ajax+iframe+gallery+retina+imagezoom+fastclick
|
3 |
(function(a){var b="Close",c="BeforeClose",d="AfterClose",e="BeforeAppend",f="MarkupParse",g="Open",h="Change",i="mfp",j="."+i,k="mfp-ready",l="mfp-removing",m="mfp-prevent-close",n,o=function(){},p=!!window.jQuery,q,r=a(window),s,t,u,v,w,x=function(a,b){n.ev.on(i+a+j,b)},y=function(b,c,d,e){var f=document.createElement("div");return f.className="mfp-"+b,d&&(f.innerHTML=d),e?c&&c.appendChild(f):(f=a(f),c&&f.appendTo(c)),f},z=function(b,c){n.ev.triggerHandler(i+b,c),n.st.callbacks&&(b=b.charAt(0).toLowerCase()+b.slice(1),n.st.callbacks[b]&&n.st.callbacks[b].apply(n,a.isArray(c)?c:[c]))},A=function(){(n.st.focus?n.content.find(n.st.focus).eq(0):n.wrap).focus()},B=function(b){if(b!==w||!n.currTemplate.closeBtn)n.currTemplate.closeBtn=a(n.st.closeMarkup.replace("%title%",n.st.tClose)),w=b;return n.currTemplate.closeBtn},C=function(){a.magnificPopup.instance||(n=new o,n.init(),a.magnificPopup.instance=n)},D=function(b){if(a(b).hasClass(m))return;var c=n.st.closeOnContentClick,d=n.st.closeOnBgClick;if(c&&d)return!0;if(!n.content||a(b).hasClass("mfp-close")||n.preloader&&b===n.preloader[0])return!0;if(b!==n.content[0]&&!a.contains(n.content[0],b)){if(d&&a.contains(document,b))return!0}else if(c)return!0;return!1},E=function(){var a=document.createElement("p").style,b=["ms","O","Moz","Webkit"];if(a.transition!==undefined)return!0;while(b.length)if(b.pop()+"Transition"in a)return!0;return!1};o.prototype={constructor:o,init:function(){var b=navigator.appVersion;n.isIE7=b.indexOf("MSIE 7.")!==-1,n.isIE8=b.indexOf("MSIE 8.")!==-1,n.isLowIE=n.isIE7||n.isIE8,n.isAndroid=/android/gi.test(b),n.isIOS=/iphone|ipad|ipod/gi.test(b),n.supportsTransition=E(),n.probablyMobile=n.isAndroid||n.isIOS||/(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent),s=a(document.body),t=a(document),n.popupsCache={}},open:function(b){var c;if(b.isObj===!1){n.items=b.items.toArray(),n.index=0;var d=b.items,e;for(c=0;c<d.length;c++){e=d[c],e.parsed&&(e=e.el[0]);if(e===b.el[0]){n.index=c;break}}}else n.items=a.isArray(b.items)?b.items:[b.items],n.index=b.index||0;if(n.isOpen){n.updateItemHTML();return}n.types=[],v="",b.mainEl&&b.mainEl.length?n.ev=b.mainEl.eq(0):n.ev=t,b.key?(n.popupsCache[b.key]||(n.popupsCache[b.key]={}),n.currTemplate=n.popupsCache[b.key]):n.currTemplate={},n.st=a.extend(!0,{},a.magnificPopup.defaults,b),n.fixedContentPos=n.st.fixedContentPos==="auto"?!n.probablyMobile:n.st.fixedContentPos,n.st.modal&&(n.st.closeOnContentClick=!1,n.st.closeOnBgClick=!1,n.st.showCloseBtn=!1,n.st.enableEscapeKey=!1),n.bgOverlay||(n.bgOverlay=y("bg").on("click"+j,function(){n.close()}),n.wrap=y("wrap").attr("tabindex",-1).on("click"+j,function(a){D(a.target)&&n.close()}),n.container=y("container",n.wrap)),n.contentContainer=y("content"),n.st.preloader&&(n.preloader=y("preloader",n.container,n.st.tLoading));var h=a.magnificPopup.modules;for(c=0;c<h.length;c++){var i=h[c];i=i.charAt(0).toUpperCase()+i.slice(1),n["init"+i].call(n)}z("BeforeOpen"),n.st.showCloseBtn&&(n.st.closeBtnInside?(x(f,function(a,b,c,d){c.close_replaceWith=B(d.type)}),v+=" mfp-close-btn-in"):n.wrap.append(B())),n.st.alignTop&&(v+=" mfp-align-top"),n.fixedContentPos?n.wrap.css({overflow:n.st.overflowY,overflowX:"hidden",overflowY:n.st.overflowY}):n.wrap.css({top:r.scrollTop(),position:"absolute"}),(n.st.fixedBgPos===!1||n.st.fixedBgPos==="auto"&&!n.fixedContentPos)&&n.bgOverlay.css({height:t.height(),position:"absolute"}),n.st.enableEscapeKey&&t.on("keyup"+j,function(a){a.keyCode===27&&n.close()}),r.on("resize"+j,function(){n.updateSize()}),n.st.closeOnContentClick||(v+=" mfp-auto-cursor"),v&&n.wrap.addClass(v);var l=n.wH=r.height(),m={};if(n.fixedContentPos&&n._hasScrollBar(l)){var o=n._getScrollbarSize();o&&(m.paddingRight=o)}n.fixedContentPos&&(n.isIE7?a("body, html").css("overflow","hidden"):m.overflow="hidden");var p=n.st.mainClass;n.isIE7&&(p+=" mfp-ie7"),p&&n._addClassToMFP(p),n.updateItemHTML(),z("BuildControls"),a("html").css(m),n.bgOverlay.add(n.wrap).prependTo(document.body),n._lastFocusedEl=document.activeElement,setTimeout(function(){n.content?(n._addClassToMFP(k),A()):n.bgOverlay.addClass(k),t.on("focusin"+j,function(b){if(b.target!==n.wrap[0]&&!a.contains(n.wrap[0],b.target))return A(),!1})},16),n.isOpen=!0,n.updateSize(l),z(g)},close:function(){if(!n.isOpen)return;z(c),n.isOpen=!1,n.st.removalDelay&&!n.isLowIE&&n.supportsTransition?(n._addClassToMFP(l),setTimeout(function(){n._close()},n.st.removalDelay)):n._close()},_close:function(){z(b);var c=l+" "+k+" ";n.bgOverlay.detach(),n.wrap.detach(),n.container.empty(),n.st.mainClass&&(c+=n.st.mainClass+" "),n._removeClassFromMFP(c);if(n.fixedContentPos){var e={paddingRight:""};n.isIE7?a("body, html").css("overflow",""):e.overflow="",a("html").css(e)}t.off("keyup"+j+" focusin"+j),n.ev.off(j),n.wrap.attr("class","mfp-wrap").removeAttr("style"),n.bgOverlay.attr("class","mfp-bg"),n.container.attr("class","mfp-container"),n.st.showCloseBtn&&(!n.st.closeBtnInside||n.currTemplate[n.currItem.type]===!0)&&n.currTemplate.closeBtn&&n.currTemplate.closeBtn.detach(),n._lastFocusedEl&&a(n._lastFocusedEl).focus(),n.currItem=null,n.content=null,n.currTemplate=null,n.prevHeight=0,z(d)},updateSize:function(a){if(n.isIOS){var b=document.documentElement.clientWidth/window.innerWidth,c=window.innerHeight*b;n.wrap.css("height",c),n.wH=c}else n.wH=a||r.height();n.fixedContentPos||n.wrap.css("height",n.wH),z("Resize")},updateItemHTML:function(){var b=n.items[n.index];n.contentContainer.detach(),n.content&&n.content.detach(),b.parsed||(b=n.parseEl(n.index));var c=b.type;z("BeforeChange",[n.currItem?n.currItem.type:"",c]),n.currItem=b;if(!n.currTemplate[c]){var d=n.st[c]?n.st[c].markup:!1;z("FirstMarkupParse",d),d?n.currTemplate[c]=a(d):n.currTemplate[c]=!0}u&&u!==b.type&&n.container.removeClass("mfp-"+u+"-holder");var e=n["get"+c.charAt(0).toUpperCase()+c.slice(1)](b,n.currTemplate[c]);n.appendContent(e,c),b.preloaded=!0,z(h,b),u=b.type,n.container.prepend(n.contentContainer),z("AfterChange")},appendContent:function(a,b){n.content=a,a?n.st.showCloseBtn&&n.st.closeBtnInside&&n.currTemplate[b]===!0?n.content.find(".mfp-close").length||n.content.append(B()):n.content=a:n.content="",z(e),n.container.addClass("mfp-"+b+"-holder"),n.contentContainer.append(n.content)},parseEl:function(b){var c=n.items[b],d=c.type;c.tagName?c={el:a(c)}:c={data:c,src:c.src};if(c.el){var e=n.types;for(var f=0;f<e.length;f++)if(c.el.hasClass("mfp-"+e[f])){d=e[f];break}c.src=c.el.attr("data-mfp-src"),c.src||(c.src=c.el.attr("href"))}return c.type=d||n.st.type||"inline",c.index=b,c.parsed=!0,n.items[b]=c,z("ElementParse",c),n.items[b]},addGroup:function(a,b){var c=function(c){c.mfpEl=this,n._openClick(c,a,b)};b||(b={});var d="click.magnificPopup";b.mainEl=a,b.items?(b.isObj=!0,a.off(d).on(d,c)):(b.isObj=!1,b.delegate?a.off(d).on(d,b.delegate,c):(b.items=a,a.off(d).on(d,c)))},_openClick:function(b,c,d){var e=d.midClick!==undefined?d.midClick:a.magnificPopup.defaults.midClick;if(!e&&(b.which===2||b.ctrlKey||b.metaKey))return;var f=d.disableOn!==undefined?d.disableOn:a.magnificPopup.defaults.disableOn;if(f)if(a.isFunction(f)){if(!f.call(n))return!0}else if(r.width()<f)return!0;b.type&&(b.preventDefault(),n.isOpen&&b.stopPropagation()),d.el=a(b.mfpEl),d.delegate&&(d.items=c.find(d.delegate)),n.open(d)},updateStatus:function(a,b){if(n.preloader){q!==a&&n.container.removeClass("mfp-s-"+q),!b&&a==="loading"&&(b=n.st.tLoading);var c={status:a,text:b};z("UpdateStatus",c),a=c.status,b=c.text,n.preloader.html(b),n.preloader.find("a").on("click",function(a){a.stopImmediatePropagation()}),n.container.addClass("mfp-s-"+a),q=a}},_addClassToMFP:function(a){n.bgOverlay.addClass(a),n.wrap.addClass(a)},_removeClassFromMFP:function(a){this.bgOverlay.removeClass(a),n.wrap.removeClass(a)},_hasScrollBar:function(a){return(n.isIE7?t.height():document.body.scrollHeight)>(a||r.height())},_parseMarkup:function(b,c,d){var e;d.data&&(c=a.extend(d.data,c)),z(f,[b,c,d]),a.each(c,function(a,c){if(c===undefined||c===!1)return!0;e=a.split("_");if(e.length>1){var d=b.find(j+"-"+e[0]);if(d.length>0){var f=e[1];f==="replaceWith"?d[0]!==c[0]&&d.replaceWith(c):f==="img"?d.is("img")?d.attr("src",c):d.replaceWith('<img src="'+c+'" class="'+d.attr("class")+'" />'):d.attr(e[1],c)}}else b.find(j+"-"+a).html(c)})},_getScrollbarSize:function(){if(n.scrollbarSize===undefined){var a=document.createElement("div");a.id="mfp-sbm",a.style.cssText="width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;",document.body.appendChild(a),n.scrollbarSize=a.offsetWidth-a.clientWidth,document.body.removeChild(a)}return n.scrollbarSize}},a.magnificPopup={instance:null,proto:o.prototype,modules:[],open:function(a,b){return C(),a||(a={}),a.isObj=!0,a.index=b||0,this.instance.open(a)},close:function(){return a.magnificPopup.instance.close()},registerModule:function(b,c){c.options&&(a.magnificPopup.defaults[b]=c.options),a.extend(this.proto,c.proto),this.modules.push(b)},defaults:{disableOn:0,key:null,midClick:!1,mainClass:"",preloader:!0,focus:"",closeOnContentClick:!1,closeOnBgClick:!0,closeBtnInside:!0,showCloseBtn:!0,enableEscapeKey:!0,modal:!1,alignTop:!1,removalDelay:0,fixedContentPos:"auto",fixedBgPos:"auto",overflowY:"auto",closeMarkup:'<button title="%title%" type="button" class="mfp-close">×</button>',tClose:"Close (Esc)",tLoading:"Loading..."}},a.fn.magnificPopup=function(b){C();var c=a(this);if(typeof b=="string")if(b==="open"){var d,e=p?c.data("magnificPopup"):c[0].magnificPopup,f=parseInt(arguments[1],10)||0;e.items?d=e.items[f]:(d=c,e.delegate&&(d=d.find(e.delegate)),d=d.eq(f)),n._openClick({mfpEl:d},c,e)}else n.isOpen&&n[b].apply(n,Array.prototype.slice.call(arguments,1));else p?c.data("magnificPopup",b):c[0].magnificPopup=b,n.addGroup(c,b);return c};var F="inline",G,H,I,J=function(){I&&(H.after(I.addClass(G)).detach(),I=null)};a.magnificPopup.registerModule(F,{options:{hiddenClass:"hide",markup:"",tNotFound:"Content not found"},proto:{initInline:function(){n.types.push(F),x(b+"."+F,function(){J()})},getInline:function(b,c){J();if(b.src){var d=n.st.inline,e=a(b.src);if(e.length){var f=e[0].parentNode;f&&f.tagName&&(H||(G=d.hiddenClass,H=y(G),G="mfp-"+G),I=e.after(H).detach().removeClass(G)),n.updateStatus("ready")}else n.updateStatus("error",d.tNotFound),e=a("<div>");return b.inlineElement=e,e}return n.updateStatus("ready"),n._parseMarkup(c,{},b),c}}});var K="ajax",L,M=function(){L&&s.removeClass(L)};a.magnificPopup.registerModule(K,{options:{settings:null,cursor:"mfp-ajax-cur",tError:'<a href="%url%">The content</a> could not be loaded.'},proto:{initAjax:function(){n.types.push(K),L=n.st.ajax.cursor,x(b+"."+K,function(){M(),n.req&&n.req.abort()})},getAjax:function(b){L&&s.addClass(L),n.updateStatus("loading");var c=a.extend({url:b.src,success:function(c,d,e){var f={data:c,xhr:e};z("ParseAjax",f),n.appendContent(a(f.data),K),b.finished=!0,M(),A(),setTimeout(function(){n.wrap.addClass(k)},16),n.updateStatus("ready"),z("AjaxContentAdded")},error:function(){M(),b.finished=b.loadError=!0,n.updateStatus("error",n.st.ajax.tError.replace("%url%",b.src))}},n.st.ajax.settings);return n.req=a.ajax(c),""}}});var N,O=function(b){if(b.data&&b.data.title!==undefined)return b.data.title;var c=n.st.image.titleSrc;if(c){if(a.isFunction(c))return c.call(n,b);if(b.el)return b.el.attr(c)||""}return""};a.magnificPopup.registerModule("image",{options:{markup:'<div class="mfp-figure"><div class="mfp-close"></div><div class="mfp-img"></div><div class="mfp-bottom-bar"><div class="mfp-title"></div><div class="mfp-counter"></div></div></div>',cursor:"mfp-zoom-out-cur",titleSrc:"title",verticalFit:!0,tError:'<a href="%url%">The image</a> could not be loaded.'},proto:{initImage:function(){var a=n.st.image,c=".image";n.types.push("image"),x(g+c,function(){n.currItem.type==="image"&&a.cursor&&s.addClass(a.cursor)}),x(b+c,function(){a.cursor&&s.removeClass(a.cursor),r.off("resize"+j)}),x("Resize"+c,n.resizeImage),n.isLowIE&&x("AfterChange",n.resizeImage)},resizeImage:function(){var a=n.currItem;if(!a||!a.img)return;if(n.st.image.verticalFit){var b=0;n.isLowIE&&(b=parseInt(a.img.css("padding-top"),10)+parseInt(a.img.css("padding-bottom"),10)),a.img.css("max-height",n.wH-b)}},_onImageHasSize:function(a){a.img&&(a.hasSize=!0,N&&clearInterval(N),a.isCheckingImgSize=!1,z("ImageHasSize",a),a.imgHidden&&(n.content&&n.content.removeClass("mfp-loading"),a.imgHidden=!1))},findImageSize:function(a){var b=0,c=a.img[0],d=function(e){N&&clearInterval(N),N=setInterval(function(){if(c.naturalWidth>0){n._onImageHasSize(a);return}b>200&&clearInterval(N),b++,b===3?d(10):b===40?d(50):b===100&&d(500)},e)};d(1)},getImage:function(b,c){var d=0,e=function(){b&&(b.img[0].complete?(b.img.off(".mfploader"),b===n.currItem&&(n._onImageHasSize(b),n.updateStatus("ready")),b.hasSize=!0,b.loaded=!0,z("ImageLoadComplete")):(d++,d<200?setTimeout(e,100):f()))},f=function(){b&&(b.img.off(".mfploader"),b===n.currItem&&(n._onImageHasSize(b),n.updateStatus("error",g.tError.replace("%url%",b.src))),b.hasSize=!0,b.loaded=!0,b.loadError=!0)},g=n.st.image,h=c.find(".mfp-img");if(h.length){var i=document.createElement("img");i.className="mfp-img",b.img=a(i).on("load.mfploader",e).on("error.mfploader",f),i.src=b.src,h.is("img")&&(b.img=b.img.clone()),b.img[0].naturalWidth>0&&(b.hasSize=!0)}return n._parseMarkup(c,{title:O(b),img_replaceWith:b.img},b),n.resizeImage(),b.hasSize?(N&&clearInterval(N),b.loadError?(c.addClass("mfp-loading"),n.updateStatus("error",g.tError.replace("%url%",b.src))):(c.removeClass("mfp-loading"),n.updateStatus("ready")),c):(n.updateStatus("loading"),b.loading=!0,b.hasSize||(b.imgHidden=!0,c.addClass("mfp-loading"),n.findImageSize(b)),c)}}});var P,Q=function(){return P===undefined&&(P=document.createElement("p").style.MozTransform!==undefined),P};a.magnificPopup.registerModule("zoom",{options:{enabled:!1,easing:"ease-in-out",duration:300,opener:function(a){return a.is("img")?a:a.find("img")}},proto:{initZoom:function(){var a=n.st.zoom,d=".zoom";if(!a.enabled||!n.supportsTransition)return;var e=a.duration,f=function(b){var c=b.clone().removeAttr("style").removeAttr("class").addClass("mfp-animated-image"),d="all "+a.duration/1e3+"s "+a.easing,e={position:"fixed",zIndex:9999,left:0,top:0,"-webkit-backface-visibility":"hidden"},f="transition";return e["-webkit-"+f]=e["-moz-"+f]=e["-o-"+f]=e[f]=d,c.css(e),c},g=function(){n.content.css("visibility","visible")},h,i;x("BuildControls"+d,function(){if(n._allowZoom()){clearTimeout(h),n.content.css("visibility","hidden"),image=n._getItemToZoom();if(!image){g();return}i=f(image),i.css(n._getOffset()),n.wrap.append(i),h=setTimeout(function(){i.css(n._getOffset(!0)),h=setTimeout(function(){g(),setTimeout(function(){i.remove(),image=i=null,z("ZoomAnimationEnded")},16)},e)},16)}}),x(c+d,function(){if(n._allowZoom()){clearTimeout(h),n.st.removalDelay=e;if(!image){image=n._getItemToZoom();if(!image)return;i=f(image)}i.css(n._getOffset(!0)),n.wrap.append(i),n.content.css("visibility","hidden"),setTimeout(function(){i.css(n._getOffset())},16)}}),x(b+d,function(){n._allowZoom()&&(g(),i&&i.remove())})},_allowZoom:function(){return n.currItem.type==="image"},_getItemToZoom:function(){return n.currItem.hasSize?n.currItem.img:!1},_getOffset:function(b){var c;b?c=n.currItem.img:c=n.st.zoom.opener(n.currItem.el||n.currItem);var d=c.offset(),e=parseInt(c.css("padding-top"),10),f=parseInt(c.css("padding-bottom"),10);d.top-=a(window).scrollTop()-e;var g={width:c.width(),height:(p?c.innerHeight():c[0].offsetHeight)-f-e};return Q()?g["-moz-transform"]=g.transform="translate("+d.left+"px,"+d.top+"px)":(g.left=d.left,g.top=d.top),g}}});var R="iframe",S="//about:blank",T=function(a){if(n.currTemplate[R]){var b=n.currTemplate[R].find("iframe");b.length&&(a||(b[0].src=S),n.isIE8&&b.css("display",a?"block":"none"))}};a.magnificPopup.registerModule(R,{options:{markup:'<div class="mfp-iframe-scaler"><div class="mfp-close"></div><iframe class="mfp-iframe" src="//about:blank" frameborder="0" allowfullscreen></iframe></div>',srcAction:"iframe_src",patterns:{youtube:{index:"youtube.com",id:"v=",src:"//www.youtube.com/embed/%id%?autoplay=1"},vimeo:{index:"vimeo.com/",id:"/",src:"//player.vimeo.com/video/%id%?autoplay=1"},gmaps:{index:"//maps.google.",src:"%id%&output=embed"}}},proto:{initIframe:function(){n.types.push(R),x("BeforeChange",function(a,b,c){b!==c&&(b===R?T():c===R&&T(!0))}),x(b+"."+R,function(){T()})},getIframe:function(b,c){var d=b.src,e=n.st.iframe;a.each(e.patterns,function(){if(d.indexOf(this.index)>-1)return this.id&&(typeof this.id=="string"?d=d.substr(d.lastIndexOf(this.id)+this.id.length,d.length):d=this.id.call(this,d)),d=this.src.replace("%id%",d),!1});var f={};return e.srcAction&&(f[e.srcAction]=d),n._parseMarkup(c,f,b),n.updateStatus("ready"),c}}});var U=function(a){var b=n.items.length;return a>b-1?a-b:a<0?b+a:a},V=function(a,b,c){return a.replace("%curr%",b+1).replace("%total%",c)};a.magnificPopup.registerModule("gallery",{options:{enabled:!1,arrowMarkup:'<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>',preload:[0,2],navigateByImgClick:!0,arrows:!0,tPrev:"Previous (Left arrow key)",tNext:"Next (Right arrow key)",tCounter:"%curr% of %total%"},proto:{initGallery:function(){var c=n.st.gallery,d=".mfp-gallery",e=Boolean(a.fn.mfpFastClick);n.direction=!0;if(!c||!c.enabled)return!1;v+=" mfp-gallery",x(g+d,function(){c.navigateByImgClick&&n.wrap.on("click"+d,".mfp-img",function(){if(n.items.length>1)return n.next(),!1}),t.on("keydown"+d,function(a){a.keyCode===37?n.prev():a.keyCode===39&&n.next()})}),x("UpdateStatus"+d,function(a,b){b.text&&(b.text=V(b.text,n.currItem.index,n.items.length))}),x(f+d,function(a,b,d,e){var f=n.items.length;d.counter=f>1?V(c.tCounter,e.index,f):""}),x("BuildControls"+d,function(){if(n.items.length>1&&c.arrows&&!n.arrowLeft){var b=c.arrowMarkup,d=n.arrowLeft=a(b.replace("%title%",c.tPrev).replace("%dir%","left")).addClass(m),f=n.arrowRight=a(b.replace("%title%",c.tNext).replace("%dir%","right")).addClass(m),g=e?"mfpFastClick":"click";d[g](function(){n.prev()}),f[g](function(){n.next()}),n.isIE7&&(y("b",d[0],!1,!0),y("a",d[0],!1,!0),y("b",f[0],!1,!0),y("a",f[0],!1,!0)),n.container.append(d.add(f))}}),x(h+d,function(){n._preloadTimeout&&clearTimeout(n._preloadTimeout),n._preloadTimeout=setTimeout(function(){n.preloadNearbyImages(),n._preloadTimeout=null},16)}),x(b+d,function(){t.off(d),n.wrap.off("click"+d),n.arrowLeft&&e&&n.arrowLeft.add(n.arrowRight).destroyMfpFastClick(),n.arrowRight=n.arrowLeft=null})},next:function(){n.direction=!0,n.index=U(n.index+1),n.updateItemHTML()},prev:function(){n.direction=!1,n.index=U(n.index-1),n.updateItemHTML()},goTo:function(a){n.direction=a>=n.index,n.index=a,n.updateItemHTML()},preloadNearbyImages:function(){var a=n.st.gallery.preload,b=Math.min(a[0],n.items.length),c=Math.min(a[1],n.items.length),d;for(d=1;d<=(n.direction?c:b);d++)n._preloadItem(n.index+d);for(d=1;d<=(n.direction?b:c);d++)n._preloadItem(n.index-d)},_preloadItem:function(b){b=U(b);if(n.items[b].preloaded)return;var c=n.items[b];c.parsed||(c=n.parseEl(b)),z("LazyLoad",c),c.type==="image"&&(c.img=a('<img class="mfp-img" />').on("load.mfploader",function(){c.hasSize=!0}).on("error.mfploader",function(){c.hasSize=!0,c.loadError=!0,z("LazyLoadError",c)}).attr("src",c.src)),c.preloaded=!0}}});var W="retina";a.magnificPopup.registerModule(W,{options:{replaceSrc:function(a){return a.src.replace(/\.\w+$/,function(a){return"@2x"+a})},ratio:1},proto:{initRetina:function(){if(window.devicePixelRatio>1){var a=n.st.retina,b=a.ratio;b=isNaN(b)?b():b,b>1&&(x("ImageHasSize."+W,function(a,c){c.img.css({"max-width":c.img[0].naturalWidth/b,width:"100%"})}),x("ElementParse."+W,function(c,d){d.src=a.replaceSrc(d,b)}))}}}}),function(){var b=1e3,c="ontouchstart"in window,d=function(){r.off("touchmove"+f+" touchend"+f)},e="mfpFastClick",f="."+e;a.fn.mfpFastClick=function(e){return a(this).each(function(){var g=a(this),h;if(c){var i,j,k,l,m,n;g.on("touchstart"+f,function(a){l=!1,n=1,m=a.originalEvent?a.originalEvent.touches[0]:a.touches[0],j=m.clientX,k=m.clientY,r.on("touchmove"+f,function(a){m=a.originalEvent?a.originalEvent.touches:a.touches,n=m.length,m=m[0];if(Math.abs(m.clientX-j)>10||Math.abs(m.clientY-k)>10)l=!0,d()}).on("touchend"+f,function(a){d();if(l||n>1)return;h=!0,a.preventDefault(),clearTimeout(i),i=setTimeout(function(){h=!1},b),e()})})}g.on("click"+f,function(){h||e()})})},a.fn.destroyMfpFastClick=function(){a(this).off("touchstart"+f+" click"+f),c&&r.off("touchmove"+f+" touchend"+f)}}()})(window.jQuery||window.Zepto)
|
1 |
+
// Magnific Popup v0.9.5 by Dmitry Semenov
|
2 |
+
// http://bit.ly/magnific-popup#build=inline+image+ajax+iframe+gallery+retina+imagezoom+fastclick
|
3 |
(function(a){var b="Close",c="BeforeClose",d="AfterClose",e="BeforeAppend",f="MarkupParse",g="Open",h="Change",i="mfp",j="."+i,k="mfp-ready",l="mfp-removing",m="mfp-prevent-close",n,o=function(){},p=!!window.jQuery,q,r=a(window),s,t,u,v,w,x=function(a,b){n.ev.on(i+a+j,b)},y=function(b,c,d,e){var f=document.createElement("div");return f.className="mfp-"+b,d&&(f.innerHTML=d),e?c&&c.appendChild(f):(f=a(f),c&&f.appendTo(c)),f},z=function(b,c){n.ev.triggerHandler(i+b,c),n.st.callbacks&&(b=b.charAt(0).toLowerCase()+b.slice(1),n.st.callbacks[b]&&n.st.callbacks[b].apply(n,a.isArray(c)?c:[c]))},A=function(){(n.st.focus?n.content.find(n.st.focus).eq(0):n.wrap).focus()},B=function(b){if(b!==w||!n.currTemplate.closeBtn)n.currTemplate.closeBtn=a(n.st.closeMarkup.replace("%title%",n.st.tClose)),w=b;return n.currTemplate.closeBtn},C=function(){a.magnificPopup.instance||(n=new o,n.init(),a.magnificPopup.instance=n)},D=function(b){if(a(b).hasClass(m))return;var c=n.st.closeOnContentClick,d=n.st.closeOnBgClick;if(c&&d)return!0;if(!n.content||a(b).hasClass("mfp-close")||n.preloader&&b===n.preloader[0])return!0;if(b!==n.content[0]&&!a.contains(n.content[0],b)){if(d&&a.contains(document,b))return!0}else if(c)return!0;return!1},E=function(){var a=document.createElement("p").style,b=["ms","O","Moz","Webkit"];if(a.transition!==undefined)return!0;while(b.length)if(b.pop()+"Transition"in a)return!0;return!1};o.prototype={constructor:o,init:function(){var b=navigator.appVersion;n.isIE7=b.indexOf("MSIE 7.")!==-1,n.isIE8=b.indexOf("MSIE 8.")!==-1,n.isLowIE=n.isIE7||n.isIE8,n.isAndroid=/android/gi.test(b),n.isIOS=/iphone|ipad|ipod/gi.test(b),n.supportsTransition=E(),n.probablyMobile=n.isAndroid||n.isIOS||/(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent),s=a(document.body),t=a(document),n.popupsCache={}},open:function(b){var c;if(b.isObj===!1){n.items=b.items.toArray(),n.index=0;var d=b.items,e;for(c=0;c<d.length;c++){e=d[c],e.parsed&&(e=e.el[0]);if(e===b.el[0]){n.index=c;break}}}else n.items=a.isArray(b.items)?b.items:[b.items],n.index=b.index||0;if(n.isOpen){n.updateItemHTML();return}n.types=[],v="",b.mainEl&&b.mainEl.length?n.ev=b.mainEl.eq(0):n.ev=t,b.key?(n.popupsCache[b.key]||(n.popupsCache[b.key]={}),n.currTemplate=n.popupsCache[b.key]):n.currTemplate={},n.st=a.extend(!0,{},a.magnificPopup.defaults,b),n.fixedContentPos=n.st.fixedContentPos==="auto"?!n.probablyMobile:n.st.fixedContentPos,n.st.modal&&(n.st.closeOnContentClick=!1,n.st.closeOnBgClick=!1,n.st.showCloseBtn=!1,n.st.enableEscapeKey=!1),n.bgOverlay||(n.bgOverlay=y("bg").on("click"+j,function(){n.close()}),n.wrap=y("wrap").attr("tabindex",-1).on("click"+j,function(a){D(a.target)&&n.close()}),n.container=y("container",n.wrap)),n.contentContainer=y("content"),n.st.preloader&&(n.preloader=y("preloader",n.container,n.st.tLoading));var h=a.magnificPopup.modules;for(c=0;c<h.length;c++){var i=h[c];i=i.charAt(0).toUpperCase()+i.slice(1),n["init"+i].call(n)}z("BeforeOpen"),n.st.showCloseBtn&&(n.st.closeBtnInside?(x(f,function(a,b,c,d){c.close_replaceWith=B(d.type)}),v+=" mfp-close-btn-in"):n.wrap.append(B())),n.st.alignTop&&(v+=" mfp-align-top"),n.fixedContentPos?n.wrap.css({overflow:n.st.overflowY,overflowX:"hidden",overflowY:n.st.overflowY}):n.wrap.css({top:r.scrollTop(),position:"absolute"}),(n.st.fixedBgPos===!1||n.st.fixedBgPos==="auto"&&!n.fixedContentPos)&&n.bgOverlay.css({height:t.height(),position:"absolute"}),n.st.enableEscapeKey&&t.on("keyup"+j,function(a){a.keyCode===27&&n.close()}),r.on("resize"+j,function(){n.updateSize()}),n.st.closeOnContentClick||(v+=" mfp-auto-cursor"),v&&n.wrap.addClass(v);var l=n.wH=r.height(),m={};if(n.fixedContentPos&&n._hasScrollBar(l)){var o=n._getScrollbarSize();o&&(m.paddingRight=o)}n.fixedContentPos&&(n.isIE7?a("body, html").css("overflow","hidden"):m.overflow="hidden");var p=n.st.mainClass;n.isIE7&&(p+=" mfp-ie7"),p&&n._addClassToMFP(p),n.updateItemHTML(),z("BuildControls"),a("html").css(m),n.bgOverlay.add(n.wrap).prependTo(document.body),n._lastFocusedEl=document.activeElement,setTimeout(function(){n.content?(n._addClassToMFP(k),A()):n.bgOverlay.addClass(k),t.on("focusin"+j,function(b){if(b.target!==n.wrap[0]&&!a.contains(n.wrap[0],b.target))return A(),!1})},16),n.isOpen=!0,n.updateSize(l),z(g)},close:function(){if(!n.isOpen)return;z(c),n.isOpen=!1,n.st.removalDelay&&!n.isLowIE&&n.supportsTransition?(n._addClassToMFP(l),setTimeout(function(){n._close()},n.st.removalDelay)):n._close()},_close:function(){z(b);var c=l+" "+k+" ";n.bgOverlay.detach(),n.wrap.detach(),n.container.empty(),n.st.mainClass&&(c+=n.st.mainClass+" "),n._removeClassFromMFP(c);if(n.fixedContentPos){var e={paddingRight:""};n.isIE7?a("body, html").css("overflow",""):e.overflow="",a("html").css(e)}t.off("keyup"+j+" focusin"+j),n.ev.off(j),n.wrap.attr("class","mfp-wrap").removeAttr("style"),n.bgOverlay.attr("class","mfp-bg"),n.container.attr("class","mfp-container"),n.st.showCloseBtn&&(!n.st.closeBtnInside||n.currTemplate[n.currItem.type]===!0)&&n.currTemplate.closeBtn&&n.currTemplate.closeBtn.detach(),n._lastFocusedEl&&a(n._lastFocusedEl).focus(),n.currItem=null,n.content=null,n.currTemplate=null,n.prevHeight=0,z(d)},updateSize:function(a){if(n.isIOS){var b=document.documentElement.clientWidth/window.innerWidth,c=window.innerHeight*b;n.wrap.css("height",c),n.wH=c}else n.wH=a||r.height();n.fixedContentPos||n.wrap.css("height",n.wH),z("Resize")},updateItemHTML:function(){var b=n.items[n.index];n.contentContainer.detach(),n.content&&n.content.detach(),b.parsed||(b=n.parseEl(n.index));var c=b.type;z("BeforeChange",[n.currItem?n.currItem.type:"",c]),n.currItem=b;if(!n.currTemplate[c]){var d=n.st[c]?n.st[c].markup:!1;z("FirstMarkupParse",d),d?n.currTemplate[c]=a(d):n.currTemplate[c]=!0}u&&u!==b.type&&n.container.removeClass("mfp-"+u+"-holder");var e=n["get"+c.charAt(0).toUpperCase()+c.slice(1)](b,n.currTemplate[c]);n.appendContent(e,c),b.preloaded=!0,z(h,b),u=b.type,n.container.prepend(n.contentContainer),z("AfterChange")},appendContent:function(a,b){n.content=a,a?n.st.showCloseBtn&&n.st.closeBtnInside&&n.currTemplate[b]===!0?n.content.find(".mfp-close").length||n.content.append(B()):n.content=a:n.content="",z(e),n.container.addClass("mfp-"+b+"-holder"),n.contentContainer.append(n.content)},parseEl:function(b){var c=n.items[b],d=c.type;c.tagName?c={el:a(c)}:c={data:c,src:c.src};if(c.el){var e=n.types;for(var f=0;f<e.length;f++)if(c.el.hasClass("mfp-"+e[f])){d=e[f];break}c.src=c.el.attr("data-mfp-src"),c.src||(c.src=c.el.attr("href"))}return c.type=d||n.st.type||"inline",c.index=b,c.parsed=!0,n.items[b]=c,z("ElementParse",c),n.items[b]},addGroup:function(a,b){var c=function(c){c.mfpEl=this,n._openClick(c,a,b)};b||(b={});var d="click.magnificPopup";b.mainEl=a,b.items?(b.isObj=!0,a.off(d).on(d,c)):(b.isObj=!1,b.delegate?a.off(d).on(d,b.delegate,c):(b.items=a,a.off(d).on(d,c)))},_openClick:function(b,c,d){var e=d.midClick!==undefined?d.midClick:a.magnificPopup.defaults.midClick;if(!e&&(b.which===2||b.ctrlKey||b.metaKey))return;var f=d.disableOn!==undefined?d.disableOn:a.magnificPopup.defaults.disableOn;if(f)if(a.isFunction(f)){if(!f.call(n))return!0}else if(r.width()<f)return!0;b.type&&(b.preventDefault(),n.isOpen&&b.stopPropagation()),d.el=a(b.mfpEl),d.delegate&&(d.items=c.find(d.delegate)),n.open(d)},updateStatus:function(a,b){if(n.preloader){q!==a&&n.container.removeClass("mfp-s-"+q),!b&&a==="loading"&&(b=n.st.tLoading);var c={status:a,text:b};z("UpdateStatus",c),a=c.status,b=c.text,n.preloader.html(b),n.preloader.find("a").on("click",function(a){a.stopImmediatePropagation()}),n.container.addClass("mfp-s-"+a),q=a}},_addClassToMFP:function(a){n.bgOverlay.addClass(a),n.wrap.addClass(a)},_removeClassFromMFP:function(a){this.bgOverlay.removeClass(a),n.wrap.removeClass(a)},_hasScrollBar:function(a){return(n.isIE7?t.height():document.body.scrollHeight)>(a||r.height())},_parseMarkup:function(b,c,d){var e;d.data&&(c=a.extend(d.data,c)),z(f,[b,c,d]),a.each(c,function(a,c){if(c===undefined||c===!1)return!0;e=a.split("_");if(e.length>1){var d=b.find(j+"-"+e[0]);if(d.length>0){var f=e[1];f==="replaceWith"?d[0]!==c[0]&&d.replaceWith(c):f==="img"?d.is("img")?d.attr("src",c):d.replaceWith('<img src="'+c+'" class="'+d.attr("class")+'" />'):d.attr(e[1],c)}}else b.find(j+"-"+a).html(c)})},_getScrollbarSize:function(){if(n.scrollbarSize===undefined){var a=document.createElement("div");a.id="mfp-sbm",a.style.cssText="width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;",document.body.appendChild(a),n.scrollbarSize=a.offsetWidth-a.clientWidth,document.body.removeChild(a)}return n.scrollbarSize}},a.magnificPopup={instance:null,proto:o.prototype,modules:[],open:function(a,b){return C(),a||(a={}),a.isObj=!0,a.index=b||0,this.instance.open(a)},close:function(){return a.magnificPopup.instance.close()},registerModule:function(b,c){c.options&&(a.magnificPopup.defaults[b]=c.options),a.extend(this.proto,c.proto),this.modules.push(b)},defaults:{disableOn:0,key:null,midClick:!1,mainClass:"",preloader:!0,focus:"",closeOnContentClick:!1,closeOnBgClick:!0,closeBtnInside:!0,showCloseBtn:!0,enableEscapeKey:!0,modal:!1,alignTop:!1,removalDelay:0,fixedContentPos:"auto",fixedBgPos:"auto",overflowY:"auto",closeMarkup:'<button title="%title%" type="button" class="mfp-close">×</button>',tClose:"Close (Esc)",tLoading:"Loading..."}},a.fn.magnificPopup=function(b){C();var c=a(this);if(typeof b=="string")if(b==="open"){var d,e=p?c.data("magnificPopup"):c[0].magnificPopup,f=parseInt(arguments[1],10)||0;e.items?d=e.items[f]:(d=c,e.delegate&&(d=d.find(e.delegate)),d=d.eq(f)),n._openClick({mfpEl:d},c,e)}else n.isOpen&&n[b].apply(n,Array.prototype.slice.call(arguments,1));else p?c.data("magnificPopup",b):c[0].magnificPopup=b,n.addGroup(c,b);return c};var F="inline",G,H,I,J=function(){I&&(H.after(I.addClass(G)).detach(),I=null)};a.magnificPopup.registerModule(F,{options:{hiddenClass:"hide",markup:"",tNotFound:"Content not found"},proto:{initInline:function(){n.types.push(F),x(b+"."+F,function(){J()})},getInline:function(b,c){J();if(b.src){var d=n.st.inline,e=a(b.src);if(e.length){var f=e[0].parentNode;f&&f.tagName&&(H||(G=d.hiddenClass,H=y(G),G="mfp-"+G),I=e.after(H).detach().removeClass(G)),n.updateStatus("ready")}else n.updateStatus("error",d.tNotFound),e=a("<div>");return b.inlineElement=e,e}return n.updateStatus("ready"),n._parseMarkup(c,{},b),c}}});var K="ajax",L,M=function(){L&&s.removeClass(L)};a.magnificPopup.registerModule(K,{options:{settings:null,cursor:"mfp-ajax-cur",tError:'<a href="%url%">The content</a> could not be loaded.'},proto:{initAjax:function(){n.types.push(K),L=n.st.ajax.cursor,x(b+"."+K,function(){M(),n.req&&n.req.abort()})},getAjax:function(b){L&&s.addClass(L),n.updateStatus("loading");var c=a.extend({url:b.src,success:function(c,d,e){var f={data:c,xhr:e};z("ParseAjax",f),n.appendContent(a(f.data),K),b.finished=!0,M(),A(),setTimeout(function(){n.wrap.addClass(k)},16),n.updateStatus("ready"),z("AjaxContentAdded")},error:function(){M(),b.finished=b.loadError=!0,n.updateStatus("error",n.st.ajax.tError.replace("%url%",b.src))}},n.st.ajax.settings);return n.req=a.ajax(c),""}}});var N,O=function(b){if(b.data&&b.data.title!==undefined)return b.data.title;var c=n.st.image.titleSrc;if(c){if(a.isFunction(c))return c.call(n,b);if(b.el)return b.el.attr(c)||""}return""};a.magnificPopup.registerModule("image",{options:{markup:'<div class="mfp-figure"><div class="mfp-close"></div><div class="mfp-img"></div><div class="mfp-bottom-bar"><div class="mfp-title"></div><div class="mfp-counter"></div></div></div>',cursor:"mfp-zoom-out-cur",titleSrc:"title",verticalFit:!0,tError:'<a href="%url%">The image</a> could not be loaded.'},proto:{initImage:function(){var a=n.st.image,c=".image";n.types.push("image"),x(g+c,function(){n.currItem.type==="image"&&a.cursor&&s.addClass(a.cursor)}),x(b+c,function(){a.cursor&&s.removeClass(a.cursor),r.off("resize"+j)}),x("Resize"+c,n.resizeImage),n.isLowIE&&x("AfterChange",n.resizeImage)},resizeImage:function(){var a=n.currItem;if(!a||!a.img)return;if(n.st.image.verticalFit){var b=0;n.isLowIE&&(b=parseInt(a.img.css("padding-top"),10)+parseInt(a.img.css("padding-bottom"),10)),a.img.css("max-height",n.wH-b)}},_onImageHasSize:function(a){a.img&&(a.hasSize=!0,N&&clearInterval(N),a.isCheckingImgSize=!1,z("ImageHasSize",a),a.imgHidden&&(n.content&&n.content.removeClass("mfp-loading"),a.imgHidden=!1))},findImageSize:function(a){var b=0,c=a.img[0],d=function(e){N&&clearInterval(N),N=setInterval(function(){if(c.naturalWidth>0){n._onImageHasSize(a);return}b>200&&clearInterval(N),b++,b===3?d(10):b===40?d(50):b===100&&d(500)},e)};d(1)},getImage:function(b,c){var d=0,e=function(){b&&(b.img[0].complete?(b.img.off(".mfploader"),b===n.currItem&&(n._onImageHasSize(b),n.updateStatus("ready")),b.hasSize=!0,b.loaded=!0,z("ImageLoadComplete")):(d++,d<200?setTimeout(e,100):f()))},f=function(){b&&(b.img.off(".mfploader"),b===n.currItem&&(n._onImageHasSize(b),n.updateStatus("error",g.tError.replace("%url%",b.src))),b.hasSize=!0,b.loaded=!0,b.loadError=!0)},g=n.st.image,h=c.find(".mfp-img");if(h.length){var i=document.createElement("img");i.className="mfp-img",b.img=a(i).on("load.mfploader",e).on("error.mfploader",f),i.src=b.src,h.is("img")&&(b.img=b.img.clone()),b.img[0].naturalWidth>0&&(b.hasSize=!0)}return n._parseMarkup(c,{title:O(b),img_replaceWith:b.img},b),n.resizeImage(),b.hasSize?(N&&clearInterval(N),b.loadError?(c.addClass("mfp-loading"),n.updateStatus("error",g.tError.replace("%url%",b.src))):(c.removeClass("mfp-loading"),n.updateStatus("ready")),c):(n.updateStatus("loading"),b.loading=!0,b.hasSize||(b.imgHidden=!0,c.addClass("mfp-loading"),n.findImageSize(b)),c)}}});var P,Q=function(){return P===undefined&&(P=document.createElement("p").style.MozTransform!==undefined),P};a.magnificPopup.registerModule("zoom",{options:{enabled:!1,easing:"ease-in-out",duration:300,opener:function(a){return a.is("img")?a:a.find("img")}},proto:{initZoom:function(){var a=n.st.zoom,d=".zoom";if(!a.enabled||!n.supportsTransition)return;var e=a.duration,f=function(b){var c=b.clone().removeAttr("style").removeAttr("class").addClass("mfp-animated-image"),d="all "+a.duration/1e3+"s "+a.easing,e={position:"fixed",zIndex:9999,left:0,top:0,"-webkit-backface-visibility":"hidden"},f="transition";return e["-webkit-"+f]=e["-moz-"+f]=e["-o-"+f]=e[f]=d,c.css(e),c},g=function(){n.content.css("visibility","visible")},h,i;x("BuildControls"+d,function(){if(n._allowZoom()){clearTimeout(h),n.content.css("visibility","hidden"),image=n._getItemToZoom();if(!image){g();return}i=f(image),i.css(n._getOffset()),n.wrap.append(i),h=setTimeout(function(){i.css(n._getOffset(!0)),h=setTimeout(function(){g(),setTimeout(function(){i.remove(),image=i=null,z("ZoomAnimationEnded")},16)},e)},16)}}),x(c+d,function(){if(n._allowZoom()){clearTimeout(h),n.st.removalDelay=e;if(!image){image=n._getItemToZoom();if(!image)return;i=f(image)}i.css(n._getOffset(!0)),n.wrap.append(i),n.content.css("visibility","hidden"),setTimeout(function(){i.css(n._getOffset())},16)}}),x(b+d,function(){n._allowZoom()&&(g(),i&&i.remove())})},_allowZoom:function(){return n.currItem.type==="image"},_getItemToZoom:function(){return n.currItem.hasSize?n.currItem.img:!1},_getOffset:function(b){var c;b?c=n.currItem.img:c=n.st.zoom.opener(n.currItem.el||n.currItem);var d=c.offset(),e=parseInt(c.css("padding-top"),10),f=parseInt(c.css("padding-bottom"),10);d.top-=a(window).scrollTop()-e;var g={width:c.width(),height:(p?c.innerHeight():c[0].offsetHeight)-f-e};return Q()?g["-moz-transform"]=g.transform="translate("+d.left+"px,"+d.top+"px)":(g.left=d.left,g.top=d.top),g}}});var R="iframe",S="//about:blank",T=function(a){if(n.currTemplate[R]){var b=n.currTemplate[R].find("iframe");b.length&&(a||(b[0].src=S),n.isIE8&&b.css("display",a?"block":"none"))}};a.magnificPopup.registerModule(R,{options:{markup:'<div class="mfp-iframe-scaler"><div class="mfp-close"></div><iframe class="mfp-iframe" src="//about:blank" frameborder="0" allowfullscreen></iframe></div>',srcAction:"iframe_src",patterns:{youtube:{index:"youtube.com",id:"v=",src:"//www.youtube.com/embed/%id%?autoplay=1"},vimeo:{index:"vimeo.com/",id:"/",src:"//player.vimeo.com/video/%id%?autoplay=1"},gmaps:{index:"//maps.google.",src:"%id%&output=embed"}}},proto:{initIframe:function(){n.types.push(R),x("BeforeChange",function(a,b,c){b!==c&&(b===R?T():c===R&&T(!0))}),x(b+"."+R,function(){T()})},getIframe:function(b,c){var d=b.src,e=n.st.iframe;a.each(e.patterns,function(){if(d.indexOf(this.index)>-1)return this.id&&(typeof this.id=="string"?d=d.substr(d.lastIndexOf(this.id)+this.id.length,d.length):d=this.id.call(this,d)),d=this.src.replace("%id%",d),!1});var f={};return e.srcAction&&(f[e.srcAction]=d),n._parseMarkup(c,f,b),n.updateStatus("ready"),c}}});var U=function(a){var b=n.items.length;return a>b-1?a-b:a<0?b+a:a},V=function(a,b,c){return a.replace("%curr%",b+1).replace("%total%",c)};a.magnificPopup.registerModule("gallery",{options:{enabled:!1,arrowMarkup:'<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>',preload:[0,2],navigateByImgClick:!0,arrows:!0,tPrev:"Previous (Left arrow key)",tNext:"Next (Right arrow key)",tCounter:"%curr% of %total%"},proto:{initGallery:function(){var c=n.st.gallery,d=".mfp-gallery",e=Boolean(a.fn.mfpFastClick);n.direction=!0;if(!c||!c.enabled)return!1;v+=" mfp-gallery",x(g+d,function(){c.navigateByImgClick&&n.wrap.on("click"+d,".mfp-img",function(){if(n.items.length>1)return n.next(),!1}),t.on("keydown"+d,function(a){a.keyCode===37?n.prev():a.keyCode===39&&n.next()})}),x("UpdateStatus"+d,function(a,b){b.text&&(b.text=V(b.text,n.currItem.index,n.items.length))}),x(f+d,function(a,b,d,e){var f=n.items.length;d.counter=f>1?V(c.tCounter,e.index,f):""}),x("BuildControls"+d,function(){if(n.items.length>1&&c.arrows&&!n.arrowLeft){var b=c.arrowMarkup,d=n.arrowLeft=a(b.replace("%title%",c.tPrev).replace("%dir%","left")).addClass(m),f=n.arrowRight=a(b.replace("%title%",c.tNext).replace("%dir%","right")).addClass(m),g=e?"mfpFastClick":"click";d[g](function(){n.prev()}),f[g](function(){n.next()}),n.isIE7&&(y("b",d[0],!1,!0),y("a",d[0],!1,!0),y("b",f[0],!1,!0),y("a",f[0],!1,!0)),n.container.append(d.add(f))}}),x(h+d,function(){n._preloadTimeout&&clearTimeout(n._preloadTimeout),n._preloadTimeout=setTimeout(function(){n.preloadNearbyImages(),n._preloadTimeout=null},16)}),x(b+d,function(){t.off(d),n.wrap.off("click"+d),n.arrowLeft&&e&&n.arrowLeft.add(n.arrowRight).destroyMfpFastClick(),n.arrowRight=n.arrowLeft=null})},next:function(){n.direction=!0,n.index=U(n.index+1),n.updateItemHTML()},prev:function(){n.direction=!1,n.index=U(n.index-1),n.updateItemHTML()},goTo:function(a){n.direction=a>=n.index,n.index=a,n.updateItemHTML()},preloadNearbyImages:function(){var a=n.st.gallery.preload,b=Math.min(a[0],n.items.length),c=Math.min(a[1],n.items.length),d;for(d=1;d<=(n.direction?c:b);d++)n._preloadItem(n.index+d);for(d=1;d<=(n.direction?b:c);d++)n._preloadItem(n.index-d)},_preloadItem:function(b){b=U(b);if(n.items[b].preloaded)return;var c=n.items[b];c.parsed||(c=n.parseEl(b)),z("LazyLoad",c),c.type==="image"&&(c.img=a('<img class="mfp-img" />').on("load.mfploader",function(){c.hasSize=!0}).on("error.mfploader",function(){c.hasSize=!0,c.loadError=!0,z("LazyLoadError",c)}).attr("src",c.src)),c.preloaded=!0}}});var W="retina";a.magnificPopup.registerModule(W,{options:{replaceSrc:function(a){return a.src.replace(/\.\w+$/,function(a){return"@2x"+a})},ratio:1},proto:{initRetina:function(){if(window.devicePixelRatio>1){var a=n.st.retina,b=a.ratio;b=isNaN(b)?b():b,b>1&&(x("ImageHasSize."+W,function(a,c){c.img.css({"max-width":c.img[0].naturalWidth/b,width:"100%"})}),x("ElementParse."+W,function(c,d){d.src=a.replaceSrc(d,b)}))}}}}),function(){var b=1e3,c="ontouchstart"in window,d=function(){r.off("touchmove"+f+" touchend"+f)},e="mfpFastClick",f="."+e;a.fn.mfpFastClick=function(e){return a(this).each(function(){var g=a(this),h;if(c){var i,j,k,l,m,n;g.on("touchstart"+f,function(a){l=!1,n=1,m=a.originalEvent?a.originalEvent.touches[0]:a.touches[0],j=m.clientX,k=m.clientY,r.on("touchmove"+f,function(a){m=a.originalEvent?a.originalEvent.touches:a.touches,n=m.length,m=m[0];if(Math.abs(m.clientX-j)>10||Math.abs(m.clientY-k)>10)l=!0,d()}).on("touchend"+f,function(a){d();if(l||n>1)return;h=!0,a.preventDefault(),clearTimeout(i),i=setTimeout(function(){h=!1},b),e()})})}g.on("click"+f,function(){h||e()})})},a.fn.destroyMfpFastClick=function(){a(this).off("touchstart"+f+" click"+f),c&&r.off("touchmove"+f+" touchend"+f)}}()})(window.jQuery||window.Zepto)
|
assets/js/options-page.js
CHANGED
@@ -1,201 +1,201 @@
|
|
1 |
-
// Wait DOM
|
2 |
-
jQuery(document).ready(function ($) {
|
3 |
-
|
4 |
-
// ########## Custom CSS screen ##########
|
5 |
-
|
6 |
-
$('.su-custom-css-originals a').magnificPopup({
|
7 |
-
type: 'iframe'
|
8 |
-
});
|
9 |
-
|
10 |
-
var editor = ace.edit('sunrise-plugin-field-custom_css-editor'),
|
11 |
-
$textarea = $('#sunrise-plugin-field-custom_css').hide();
|
12 |
-
editor.getSession().setValue($textarea.val());
|
13 |
-
editor.getSession().on('change', function () {
|
14 |
-
$textarea.val(editor.getSession().getValue());
|
15 |
-
});
|
16 |
-
editor.getSession().setMode('ace/mode/css');
|
17 |
-
editor.setTheme('ace/theme/monokai');
|
18 |
-
editor.getSession().setUseWrapMode(true);
|
19 |
-
editor.getSession().setWrapLimitRange(null, null);
|
20 |
-
editor.renderer.setShowPrintMargin(null);
|
21 |
-
editor.session.setUseSoftTabs(null);
|
22 |
-
|
23 |
-
// ########## Demos screen ##########
|
24 |
-
|
25 |
-
// Even class for tables
|
26 |
-
$('.su-table-demos tbody tr:even').addClass('even');
|
27 |
-
// Shortcodes preview
|
28 |
-
$('.su-preview').magnificPopup({
|
29 |
-
type: 'image',
|
30 |
-
gallery: {
|
31 |
-
enabled: true
|
32 |
-
}
|
33 |
-
});
|
34 |
-
|
35 |
-
// ########## Galleries screen ##########
|
36 |
-
|
37 |
-
// Create new gallery
|
38 |
-
$('.su-gallery-create').click(function (e) {
|
39 |
-
// Prepare data
|
40 |
-
var $last = $('#su-galleries .su-gallery:last'),
|
41 |
-
id = ($last.length > 0) ? $last.data('id') + 1 : 0,
|
42 |
-
$gallery = $(tmpl('su_new_gallery_template', {
|
43 |
-
id: id
|
44 |
-
}));
|
45 |
-
// Hide not found message
|
46 |
-
$('#su-galleries-not-found').hide();
|
47 |
-
// Place new gallery
|
48 |
-
$gallery.appendTo('#su-galleries');
|
49 |
-
// Focus gallery name input
|
50 |
-
$gallery.find('.su-gallery-name').focus();
|
51 |
-
// Apply upload buttons actions
|
52 |
-
apply_uploads();
|
53 |
-
// Apply sortable
|
54 |
-
apply_sortable()
|
55 |
-
e.preventDefault();
|
56 |
-
});
|
57 |
-
// Open/close gallery
|
58 |
-
$('.su-gallery-open, .su-gallery-close').live('click', function (e) {
|
59 |
-
$(this).parents('.su-gallery').toggleClass('su-gallery-edit');
|
60 |
-
$(this).parents('.su-gallery').find('.su-gallery-image').removeClass('su-gallery-image-edit');
|
61 |
-
e.preventDefault();
|
62 |
-
});
|
63 |
-
// Close and save gallery
|
64 |
-
$('.su-gallery-save-close').live('click', function (e) {
|
65 |
-
$(this).parents('.su-gallery').removeClass('su-gallery-edit');
|
66 |
-
$(this).parents('.su-gallery').find('.su-gallery-image').removeClass('su-gallery-image-edit');
|
67 |
-
$('#sunrise-plugin-options-form').submit();
|
68 |
-
e.preventDefault();
|
69 |
-
});
|
70 |
-
// Image preview
|
71 |
-
$('.su-gallery-image-preview').live('click', function (e) {
|
72 |
-
$(this).magnificPopup({
|
73 |
-
type: 'image'
|
74 |
-
}).magnificPopup('open');
|
75 |
-
e.preventDefault();
|
76 |
-
});
|
77 |
-
// Delete gallery
|
78 |
-
$('.su-gallery-delete').live('click', function (e) {
|
79 |
-
var message = $('#su-galleries').data('delete-gallery-message');
|
80 |
-
if (confirm(message)) {
|
81 |
-
$(this).parents('.su-gallery').remove();
|
82 |
-
$('#sunrise-plugin-options-form').submit();
|
83 |
-
}
|
84 |
-
e.preventDefault();
|
85 |
-
});
|
86 |
-
// Add new image, apply upload buttons actions
|
87 |
-
apply_uploads();
|
88 |
-
// Update images indexes
|
89 |
-
update_images();
|
90 |
-
// Apply sortables
|
91 |
-
apply_sortable();
|
92 |
-
// Open/close image
|
93 |
-
$('.su-gallery-image-open, .su-gallery-image-title, .su-gallery-image-ok').live('click', function (e) {
|
94 |
-
var $image = $(this).parents('.su-gallery-image');
|
95 |
-
// Change image container class
|
96 |
-
$image.toggleClass('su-gallery-image-edit');
|
97 |
-
// Update image title
|
98 |
-
$image.find('.su-gallery-image-title').text($image.find('.su-gallery-image-title-value').val());
|
99 |
-
e.preventDefault();
|
100 |
-
});
|
101 |
-
// Delete image
|
102 |
-
$('.su-gallery-image-delete').live('click', function (e) {
|
103 |
-
// Get message
|
104 |
-
var message = $('#su-galleries').data('delete-image-message');
|
105 |
-
// Confirm deletion
|
106 |
-
if (confirm(message)) $(this).parents('.su-gallery-image').remove();
|
107 |
-
// Update images indexes
|
108 |
-
update_images();
|
109 |
-
e.preventDefault();
|
110 |
-
});
|
111 |
-
|
112 |
-
// Apply sortable
|
113 |
-
|
114 |
-
function apply_sortable() {
|
115 |
-
$('.su-gallery-content').sortable({
|
116 |
-
items: '> .su-gallery-image',
|
117 |
-
handle: '.su-gallery-image-sort-handle',
|
118 |
-
axis: 'y',
|
119 |
-
stop: function (event, ui) {
|
120 |
-
update_images();
|
121 |
-
}
|
122 |
-
});
|
123 |
-
}
|
124 |
-
|
125 |
-
function apply_uploads() {
|
126 |
-
$('.su-gallery-add-image:not(.su-gallery-add-image-ready) input:file').each(function () {
|
127 |
-
// Prepare data
|
128 |
-
var $container = $(this).parent(),
|
129 |
-
$gallery = $(this).parents('.su-gallery');
|
130 |
-
// Add ready class
|
131 |
-
$(this).addClass('su-gallery-add-image-ready');
|
132 |
-
// Apply upload actions
|
133 |
-
$(this).fileupload({
|
134 |
-
paramName: 'file',
|
135 |
-
url: ajaxurl,
|
136 |
-
formData: {
|
137 |
-
action: 'su_generator_upload'
|
138 |
-
},
|
139 |
-
dataType: 'html',
|
140 |
-
autoUpload: true,
|
141 |
-
beforeSend: function () {
|
142 |
-
// Show loading animation
|
143 |
-
$container.addClass('su-gallery-image-uploading');
|
144 |
-
},
|
145 |
-
done: function (ev, data) {
|
146 |
-
// Hide loading animation
|
147 |
-
$container.removeClass('su-gallery-image-uploading');
|
148 |
-
// Check result
|
149 |
-
if (data.result == '') return;
|
150 |
-
// Create new image section
|
151 |
-
var $image = $(tmpl('su_new_image_template', {
|
152 |
-
id: 999,
|
153 |
-
title: get_file_title(data.result),
|
154 |
-
gallery_id: $gallery.data('id'),
|
155 |
-
image: data.result
|
156 |
-
}));
|
157 |
-
// Append new image to gallery content
|
158 |
-
$container.after($image);
|
159 |
-
// Update images indexes
|
160 |
-
update_images();
|
161 |
-
}
|
162 |
-
})
|
163 |
-
});
|
164 |
-
}
|
165 |
-
|
166 |
-
function update_images() {
|
167 |
-
// Loop through galleries
|
168 |
-
$('#su-galleries .su-gallery').each(function () {
|
169 |
-
// Prepare gallery data
|
170 |
-
var $gallery = $(this),
|
171 |
-
id = $gallery.data('id');
|
172 |
-
// Loop through images
|
173 |
-
$gallery.find('.su-gallery-image').each(function (i) {
|
174 |
-
// Loop through fields
|
175 |
-
$(this).find('[data-field]').each(function () {
|
176 |
-
$(this).attr('name', 'galleries[' + id + '][items][' + i + '][' + $(this).data('field') +
|
177 |
-
']')
|
178 |
-
});
|
179 |
-
});
|
180 |
-
|
181 |
-
});
|
182 |
-
}
|
183 |
-
|
184 |
-
/* Get filename from url */
|
185 |
-
|
186 |
-
function get_file_title(url) {
|
187 |
-
if (url) return url.substring(url.lastIndexOf("/") + 1, url.lastIndexOf("."));
|
188 |
-
return "";
|
189 |
-
}
|
190 |
-
|
191 |
-
/* Tiny template system */
|
192 |
-
(function () {
|
193 |
-
var a = {};
|
194 |
-
this.tmpl = function b(c, d) {
|
195 |
-
var e = !/\W/.test(c) ? a[c] = a[c] || b(document.getElementById(c).innerHTML) : new Function("obj", "var p=[],print=function(){p.push.apply(p,arguments);};" + "with(obj){p.push('" +
|
196 |
-
c.replace(/[\r\t\n]/g, " ").split("<%").join(" ").replace(/((^|%>)[^\t]*)'/g, "$1\r").replace(/\t=(.*?)%>/g, "',$1,'").split(" ").join("');").split("%>").join("p.push('").split("\r").join("\\'") +
|
197 |
-
"');}return p.join('');");
|
198 |
-
return d ? e(d) : e
|
199 |
-
}
|
200 |
-
})();
|
201 |
});
|
1 |
+
// Wait DOM
|
2 |
+
jQuery(document).ready(function ($) {
|
3 |
+
|
4 |
+
// ########## Custom CSS screen ##########
|
5 |
+
|
6 |
+
$('.su-custom-css-originals a').magnificPopup({
|
7 |
+
type: 'iframe'
|
8 |
+
});
|
9 |
+
|
10 |
+
var editor = ace.edit('sunrise-plugin-field-custom_css-editor'),
|
11 |
+
$textarea = $('#sunrise-plugin-field-custom_css').hide();
|
12 |
+
editor.getSession().setValue($textarea.val());
|
13 |
+
editor.getSession().on('change', function () {
|
14 |
+
$textarea.val(editor.getSession().getValue());
|
15 |
+
});
|
16 |
+
editor.getSession().setMode('ace/mode/css');
|
17 |
+
editor.setTheme('ace/theme/monokai');
|
18 |
+
editor.getSession().setUseWrapMode(true);
|
19 |
+
editor.getSession().setWrapLimitRange(null, null);
|
20 |
+
editor.renderer.setShowPrintMargin(null);
|
21 |
+
editor.session.setUseSoftTabs(null);
|
22 |
+
|
23 |
+
// ########## Demos screen ##########
|
24 |
+
|
25 |
+
// Even class for tables
|
26 |
+
$('.su-table-demos tbody tr:even').addClass('even');
|
27 |
+
// Shortcodes preview
|
28 |
+
$('.su-preview').magnificPopup({
|
29 |
+
type: 'image',
|
30 |
+
gallery: {
|
31 |
+
enabled: true
|
32 |
+
}
|
33 |
+
});
|
34 |
+
|
35 |
+
// ########## Galleries screen ##########
|
36 |
+
|
37 |
+
// Create new gallery
|
38 |
+
$('.su-gallery-create').click(function (e) {
|
39 |
+
// Prepare data
|
40 |
+
var $last = $('#su-galleries .su-gallery:last'),
|
41 |
+
id = ($last.length > 0) ? $last.data('id') + 1 : 0,
|
42 |
+
$gallery = $(tmpl('su_new_gallery_template', {
|
43 |
+
id: id
|
44 |
+
}));
|
45 |
+
// Hide not found message
|
46 |
+
$('#su-galleries-not-found').hide();
|
47 |
+
// Place new gallery
|
48 |
+
$gallery.appendTo('#su-galleries');
|
49 |
+
// Focus gallery name input
|
50 |
+
$gallery.find('.su-gallery-name').focus();
|
51 |
+
// Apply upload buttons actions
|
52 |
+
apply_uploads();
|
53 |
+
// Apply sortable
|
54 |
+
apply_sortable()
|
55 |
+
e.preventDefault();
|
56 |
+
});
|
57 |
+
// Open/close gallery
|
58 |
+
$('.su-gallery-open, .su-gallery-close').live('click', function (e) {
|
59 |
+
$(this).parents('.su-gallery').toggleClass('su-gallery-edit');
|
60 |
+
$(this).parents('.su-gallery').find('.su-gallery-image').removeClass('su-gallery-image-edit');
|
61 |
+
e.preventDefault();
|
62 |
+
});
|
63 |
+
// Close and save gallery
|
64 |
+
$('.su-gallery-save-close').live('click', function (e) {
|
65 |
+
$(this).parents('.su-gallery').removeClass('su-gallery-edit');
|
66 |
+
$(this).parents('.su-gallery').find('.su-gallery-image').removeClass('su-gallery-image-edit');
|
67 |
+
$('#sunrise-plugin-options-form').submit();
|
68 |
+
e.preventDefault();
|
69 |
+
});
|
70 |
+
// Image preview
|
71 |
+
$('.su-gallery-image-preview').live('click', function (e) {
|
72 |
+
$(this).magnificPopup({
|
73 |
+
type: 'image'
|
74 |
+
}).magnificPopup('open');
|
75 |
+
e.preventDefault();
|
76 |
+
});
|
77 |
+
// Delete gallery
|
78 |
+
$('.su-gallery-delete').live('click', function (e) {
|
79 |
+
var message = $('#su-galleries').data('delete-gallery-message');
|
80 |
+
if (confirm(message)) {
|
81 |
+
$(this).parents('.su-gallery').remove();
|
82 |
+
$('#sunrise-plugin-options-form').submit();
|
83 |
+
}
|
84 |
+
e.preventDefault();
|
85 |
+
});
|
86 |
+
// Add new image, apply upload buttons actions
|
87 |
+
apply_uploads();
|
88 |
+
// Update images indexes
|
89 |
+
update_images();
|
90 |
+
// Apply sortables
|
91 |
+
apply_sortable();
|
92 |
+
// Open/close image
|
93 |
+
$('.su-gallery-image-open, .su-gallery-image-title, .su-gallery-image-ok').live('click', function (e) {
|
94 |
+
var $image = $(this).parents('.su-gallery-image');
|
95 |
+
// Change image container class
|
96 |
+
$image.toggleClass('su-gallery-image-edit');
|
97 |
+
// Update image title
|
98 |
+
$image.find('.su-gallery-image-title').text($image.find('.su-gallery-image-title-value').val());
|
99 |
+
e.preventDefault();
|
100 |
+
});
|
101 |
+
// Delete image
|
102 |
+
$('.su-gallery-image-delete').live('click', function (e) {
|
103 |
+
// Get message
|
104 |
+
var message = $('#su-galleries').data('delete-image-message');
|
105 |
+
// Confirm deletion
|
106 |
+
if (confirm(message)) $(this).parents('.su-gallery-image').remove();
|
107 |
+
// Update images indexes
|
108 |
+
update_images();
|
109 |
+
e.preventDefault();
|
110 |
+
});
|
111 |
+
|
112 |
+
// Apply sortable
|
113 |
+
|
114 |
+
function apply_sortable() {
|
115 |
+
$('.su-gallery-content').sortable({
|
116 |
+
items: '> .su-gallery-image',
|
117 |
+
handle: '.su-gallery-image-sort-handle',
|
118 |
+
axis: 'y',
|
119 |
+
stop: function (event, ui) {
|
120 |
+
update_images();
|
121 |
+
}
|
122 |
+
});
|
123 |
+
}
|
124 |
+
|
125 |
+
function apply_uploads() {
|
126 |
+
$('.su-gallery-add-image:not(.su-gallery-add-image-ready) input:file').each(function () {
|
127 |
+
// Prepare data
|
128 |
+
var $container = $(this).parent(),
|
129 |
+
$gallery = $(this).parents('.su-gallery');
|
130 |
+
// Add ready class
|
131 |
+
$(this).addClass('su-gallery-add-image-ready');
|
132 |
+
// Apply upload actions
|
133 |
+
$(this).fileupload({
|
134 |
+
paramName: 'file',
|
135 |
+
url: ajaxurl,
|
136 |
+
formData: {
|
137 |
+
action: 'su_generator_upload'
|
138 |
+
},
|
139 |
+
dataType: 'html',
|
140 |
+
autoUpload: true,
|
141 |
+
beforeSend: function () {
|
142 |
+
// Show loading animation
|
143 |
+
$container.addClass('su-gallery-image-uploading');
|
144 |
+
},
|
145 |
+
done: function (ev, data) {
|
146 |
+
// Hide loading animation
|
147 |
+
$container.removeClass('su-gallery-image-uploading');
|
148 |
+
// Check result
|
149 |
+
if (data.result == '') return;
|
150 |
+
// Create new image section
|
151 |
+
var $image = $(tmpl('su_new_image_template', {
|
152 |
+
id: 999,
|
153 |
+
title: get_file_title(data.result),
|
154 |
+
gallery_id: $gallery.data('id'),
|
155 |
+
image: data.result
|
156 |
+
}));
|
157 |
+
// Append new image to gallery content
|
158 |
+
$container.after($image);
|
159 |
+
// Update images indexes
|
160 |
+
update_images();
|
161 |
+
}
|
162 |
+
})
|
163 |
+
});
|
164 |
+
}
|
165 |
+
|
166 |
+
function update_images() {
|
167 |
+
// Loop through galleries
|
168 |
+
$('#su-galleries .su-gallery').each(function () {
|
169 |
+
// Prepare gallery data
|
170 |
+
var $gallery = $(this),
|
171 |
+
id = $gallery.data('id');
|
172 |
+
// Loop through images
|
173 |
+
$gallery.find('.su-gallery-image').each(function (i) {
|
174 |
+
// Loop through fields
|
175 |
+
$(this).find('[data-field]').each(function () {
|
176 |
+
$(this).attr('name', 'galleries[' + id + '][items][' + i + '][' + $(this).data('field') +
|
177 |
+
']')
|
178 |
+
});
|
179 |
+
});
|
180 |
+
|
181 |
+
});
|
182 |
+
}
|
183 |
+
|
184 |
+
/* Get filename from url */
|
185 |
+
|
186 |
+
function get_file_title(url) {
|
187 |
+
if (url) return url.substring(url.lastIndexOf("/") + 1, url.lastIndexOf("."));
|
188 |
+
return "";
|
189 |
+
}
|
190 |
+
|
191 |
+
/* Tiny template system */
|
192 |
+
(function () {
|
193 |
+
var a = {};
|
194 |
+
this.tmpl = function b(c, d) {
|
195 |
+
var e = !/\W/.test(c) ? a[c] = a[c] || b(document.getElementById(c).innerHTML) : new Function("obj", "var p=[],print=function(){p.push.apply(p,arguments);};" + "with(obj){p.push('" +
|
196 |
+
c.replace(/[\r\t\n]/g, " ").split("<%").join(" ").replace(/((^|%>)[^\t]*)'/g, "$1\r").replace(/\t=(.*?)%>/g, "',$1,'").split(" ").join("');").split("%>").join("p.push('").split("\r").join("\\'") +
|
197 |
+
"');}return p.join('');");
|
198 |
+
return d ? e(d) : e
|
199 |
+
}
|
200 |
+
})();
|
201 |
});
|
assets/js/other-shortcodes.js
CHANGED
@@ -1,55 +1,55 @@
|
|
1 |
-
jQuery(document).ready(function ($) {
|
2 |
-
// Spoiler
|
3 |
-
$('.su-spoiler-title').click(function (e) {
|
4 |
-
var // Spoiler elements
|
5 |
-
$title = $(this),
|
6 |
-
$spoiler = $title.parent();
|
7 |
-
// Open/close spoiler
|
8 |
-
$spoiler.toggleClass('su-spoiler-closed');
|
9 |
-
// Close other spoilers in accordion
|
10 |
-
$spoiler.parent('.su-accordion').children('.su-spoiler').not($spoiler).addClass('su-spoiler-closed');
|
11 |
-
e.preventDefault();
|
12 |
-
});
|
13 |
-
// Accordion
|
14 |
-
$('.su-accordion .su-spoiler-title').click(function (e) {
|
15 |
-
if ($(this).hasClass('su-spoiler-closed')) $(this).parent().siblings().addClass('su-spoiler-closed');
|
16 |
-
e.preventDefault();
|
17 |
-
});
|
18 |
-
// Tabs
|
19 |
-
$('.su-tabs-nav').delegate('span:not(.su-tabs-current)', 'click', function () {
|
20 |
-
var index = $(this).index();
|
21 |
-
$(this).addClass('su-tabs-current').siblings().removeClass('su-tabs-current').parents('.su-tabs').find('.su-tabs-pane').hide().eq($(this).index()).show();
|
22 |
-
su_set_tabs_height();
|
23 |
-
$(this).parents('.su-tabs').find('.su-tabs-pane').eq(index).find('.su-gmap iframe:not(.su-gmap-reloaded)').each(function() {
|
24 |
-
$(this).attr('src', $(this).attr('src')).addClass('su-gmap-reloaded');
|
25 |
-
});
|
26 |
-
});
|
27 |
-
$('.su-tabs-pane').hide();
|
28 |
-
$('.su-tabs-nav span:first-child').click();
|
29 |
-
su_set_tabs_height();
|
30 |
-
|
31 |
-
function su_set_tabs_height() {
|
32 |
-
$('.su-tabs-vertical').each(function () {
|
33 |
-
var $tabs = $(this),
|
34 |
-
$panes = $(this).children('.su-tabs-panes'),
|
35 |
-
height = 0;
|
36 |
-
$panes.css('height', 'auto').css('height', $tabs.height());
|
37 |
-
});
|
38 |
-
}
|
39 |
-
// Tables
|
40 |
-
$('.su-table tr:even').addClass('su-even');
|
41 |
-
// Magnific popup
|
42 |
-
$('.su-lightbox').each(function () {
|
43 |
-
$(this).click(function (e) {
|
44 |
-
e.preventDefault();
|
45 |
-
e.stopPropagation();
|
46 |
-
if ($(this).parent().attr('id') === 'su-generator-preview') $(this).html(su_other_shortcodes.no_preview);
|
47 |
-
else {
|
48 |
-
var type = $(this).data('mfp-type');
|
49 |
-
$(this).magnificPopup({
|
50 |
-
type: type
|
51 |
-
}).magnificPopup('open');
|
52 |
-
}
|
53 |
-
});
|
54 |
-
});
|
55 |
});
|
1 |
+
jQuery(document).ready(function ($) {
|
2 |
+
// Spoiler
|
3 |
+
$('.su-spoiler-title').click(function (e) {
|
4 |
+
var // Spoiler elements
|
5 |
+
$title = $(this),
|
6 |
+
$spoiler = $title.parent();
|
7 |
+
// Open/close spoiler
|
8 |
+
$spoiler.toggleClass('su-spoiler-closed');
|
9 |
+
// Close other spoilers in accordion
|
10 |
+
$spoiler.parent('.su-accordion').children('.su-spoiler').not($spoiler).addClass('su-spoiler-closed');
|
11 |
+
e.preventDefault();
|
12 |
+
});
|
13 |
+
// Accordion
|
14 |
+
$('.su-accordion .su-spoiler-title').click(function (e) {
|
15 |
+
if ($(this).hasClass('su-spoiler-closed')) $(this).parent().siblings().addClass('su-spoiler-closed');
|
16 |
+
e.preventDefault();
|
17 |
+
});
|
18 |
+
// Tabs
|
19 |
+
$('.su-tabs-nav').delegate('span:not(.su-tabs-current)', 'click', function () {
|
20 |
+
var index = $(this).index();
|
21 |
+
$(this).addClass('su-tabs-current').siblings().removeClass('su-tabs-current').parents('.su-tabs').find('.su-tabs-pane').hide().eq($(this).index()).show();
|
22 |
+
su_set_tabs_height();
|
23 |
+
$(this).parents('.su-tabs').find('.su-tabs-pane').eq(index).find('.su-gmap iframe:not(.su-gmap-reloaded)').each(function() {
|
24 |
+
$(this).attr('src', $(this).attr('src')).addClass('su-gmap-reloaded');
|
25 |
+
});
|
26 |
+
});
|
27 |
+
$('.su-tabs-pane').hide();
|
28 |
+
$('.su-tabs-nav span:first-child').click();
|
29 |
+
su_set_tabs_height();
|
30 |
+
|
31 |
+
function su_set_tabs_height() {
|
32 |
+
$('.su-tabs-vertical').each(function () {
|
33 |
+
var $tabs = $(this),
|
34 |
+
$panes = $(this).children('.su-tabs-panes'),
|
35 |
+
height = 0;
|
36 |
+
$panes.css('height', 'auto').css('height', $tabs.height());
|
37 |
+
});
|
38 |
+
}
|
39 |
+
// Tables
|
40 |
+
$('.su-table tr:even').addClass('su-even');
|
41 |
+
// Magnific popup
|
42 |
+
$('.su-lightbox').each(function () {
|
43 |
+
$(this).click(function (e) {
|
44 |
+
e.preventDefault();
|
45 |
+
e.stopPropagation();
|
46 |
+
if ($(this).parent().attr('id') === 'su-generator-preview') $(this).html(su_other_shortcodes.no_preview);
|
47 |
+
else {
|
48 |
+
var type = $(this).data('mfp-type');
|
49 |
+
$(this).magnificPopup({
|
50 |
+
type: type
|
51 |
+
}).magnificPopup('open');
|
52 |
+
}
|
53 |
+
});
|
54 |
+
});
|
55 |
});
|
assets/js/players-shortcodes.js
CHANGED
@@ -1,74 +1,74 @@
|
|
1 |
-
jQuery(document).ready(function ($) {
|
2 |
-
// Audio player
|
3 |
-
$('.su-audio').each(function () {
|
4 |
-
// Prepare data
|
5 |
-
var $this = $(this),
|
6 |
-
id = $this.data('id'),
|
7 |
-
selector = '#' + id,
|
8 |
-
$player = $(selector),
|
9 |
-
audio = $this.data('audio'),
|
10 |
-
swf = $this.data('swf');
|
11 |
-
// Init jPlayer
|
12 |
-
$player.jPlayer({
|
13 |
-
ready: function (e) {
|
14 |
-
// Set media
|
15 |
-
$player.jPlayer('setMedia', {
|
16 |
-
mp3: audio
|
17 |
-
});
|
18 |
-
// Autoplay
|
19 |
-
if ($this.data('autoplay') === 'yes') $player.jPlayer('play');
|
20 |
-
// Loop
|
21 |
-
if ($this.data('loop') === 'yes') $player.bind($.jPlayer.event.ended + '.repeat', function () {
|
22 |
-
$player.jPlayer('play');
|
23 |
-
});
|
24 |
-
},
|
25 |
-
cssSelectorAncestor: selector + '_container',
|
26 |
-
volume: 1,
|
27 |
-
keyEnabled: true,
|
28 |
-
smoothPlayBar: true,
|
29 |
-
swfPath: swf,
|
30 |
-
supplied: 'mp3'
|
31 |
-
});
|
32 |
-
});
|
33 |
-
// Video player
|
34 |
-
$('.su-video').each(function () {
|
35 |
-
// Prepare data
|
36 |
-
var $video = $(this),
|
37 |
-
id = $video.attr('id'),
|
38 |
-
$player = $('#' + id + '_player'),
|
39 |
-
file = $video.data('video'),
|
40 |
-
swf = $video.data('swf'),
|
41 |
-
poster = $video.data('poster'),
|
42 |
-
size = {
|
43 |
-
width: $player.width(),
|
44 |
-
height: $player.height()
|
45 |
-
};
|
46 |
-
// Init jPlayer
|
47 |
-
$player.jPlayer({
|
48 |
-
ready: function (e) {
|
49 |
-
// Set media
|
50 |
-
$player.jPlayer('setMedia', {
|
51 |
-
mp4: file,
|
52 |
-
flv: file,
|
53 |
-
poster: poster
|
54 |
-
});
|
55 |
-
// Autoplay
|
56 |
-
if ($video.data('autoplay') === 'yes') $player.jPlayer('play');
|
57 |
-
// Loop
|
58 |
-
if ($video.data('loop') === 'yes') $player.bind($.jPlayer.event.ended + '.repeat', function () {
|
59 |
-
$player.jPlayer('play');
|
60 |
-
});
|
61 |
-
},
|
62 |
-
cssSelector: {
|
63 |
-
gui: '.jp-gui, .jp-title'
|
64 |
-
},
|
65 |
-
size: size,
|
66 |
-
cssSelectorAncestor: '#' + id,
|
67 |
-
volume: 1,
|
68 |
-
keyEnabled: true,
|
69 |
-
smoothPlayBar: true,
|
70 |
-
swfPath: swf,
|
71 |
-
supplied: 'mp4, flv'
|
72 |
-
});
|
73 |
-
});
|
74 |
});
|
1 |
+
jQuery(document).ready(function ($) {
|
2 |
+
// Audio player
|
3 |
+
$('.su-audio').each(function () {
|
4 |
+
// Prepare data
|
5 |
+
var $this = $(this),
|
6 |
+
id = $this.data('id'),
|
7 |
+
selector = '#' + id,
|
8 |
+
$player = $(selector),
|
9 |
+
audio = $this.data('audio'),
|
10 |
+
swf = $this.data('swf');
|
11 |
+
// Init jPlayer
|
12 |
+
$player.jPlayer({
|
13 |
+
ready: function (e) {
|
14 |
+
// Set media
|
15 |
+
$player.jPlayer('setMedia', {
|
16 |
+
mp3: audio
|
17 |
+
});
|
18 |
+
// Autoplay
|
19 |
+
if ($this.data('autoplay') === 'yes') $player.jPlayer('play');
|
20 |
+
// Loop
|
21 |
+
if ($this.data('loop') === 'yes') $player.bind($.jPlayer.event.ended + '.repeat', function () {
|
22 |
+
$player.jPlayer('play');
|
23 |
+
});
|
24 |
+
},
|
25 |
+
cssSelectorAncestor: selector + '_container',
|
26 |
+
volume: 1,
|
27 |
+
keyEnabled: true,
|
28 |
+
smoothPlayBar: true,
|
29 |
+
swfPath: swf,
|
30 |
+
supplied: 'mp3'
|
31 |
+
});
|
32 |
+
});
|
33 |
+
// Video player
|
34 |
+
$('.su-video').each(function () {
|
35 |
+
// Prepare data
|
36 |
+
var $video = $(this),
|
37 |
+
id = $video.attr('id'),
|
38 |
+
$player = $('#' + id + '_player'),
|
39 |
+
file = $video.data('video'),
|
40 |
+
swf = $video.data('swf'),
|
41 |
+
poster = $video.data('poster'),
|
42 |
+
size = {
|
43 |
+
width: $player.width(),
|
44 |
+
height: $player.height()
|
45 |
+
};
|
46 |
+
// Init jPlayer
|
47 |
+
$player.jPlayer({
|
48 |
+
ready: function (e) {
|
49 |
+
// Set media
|
50 |
+
$player.jPlayer('setMedia', {
|
51 |
+
mp4: file,
|
52 |
+
flv: file,
|
53 |
+
poster: poster
|
54 |
+
});
|
55 |
+
// Autoplay
|
56 |
+
if ($video.data('autoplay') === 'yes') $player.jPlayer('play');
|
57 |
+
// Loop
|
58 |
+
if ($video.data('loop') === 'yes') $player.bind($.jPlayer.event.ended + '.repeat', function () {
|
59 |
+
$player.jPlayer('play');
|
60 |
+
});
|
61 |
+
},
|
62 |
+
cssSelector: {
|
63 |
+
gui: '.jp-gui, .jp-title'
|
64 |
+
},
|
65 |
+
size: size,
|
66 |
+
cssSelectorAncestor: '#' + id,
|
67 |
+
volume: 1,
|
68 |
+
keyEnabled: true,
|
69 |
+
smoothPlayBar: true,
|
70 |
+
swfPath: swf,
|
71 |
+
supplied: 'mp4, flv'
|
72 |
+
});
|
73 |
+
});
|
74 |
});
|
assets/js/qtip.js
CHANGED
@@ -1,21 +1,21 @@
|
|
1 |
-
/*
|
2 |
-
* jquery.qtip. The jQuery tooltip plugin
|
3 |
-
*
|
4 |
-
* Copyright (c) 2009 Craig Thompson
|
5 |
-
* http://craigsworks.com
|
6 |
-
*
|
7 |
-
* Licensed under MIT
|
8 |
-
* http://www.opensource.org/licenses/mit-license.php
|
9 |
-
*
|
10 |
-
* Launch : February 2009
|
11 |
-
* Version : 1.0.0-rc3
|
12 |
-
* Released: Tuesday 12th May, 2009 - 00:00
|
13 |
-
* Debug: jquery.qtip.debug.js
|
14 |
-
*/
|
15 |
-
(function(f){f.fn.qtip=function(B,u){var y,t,A,s,x,w,v,z;if(typeof B=="string"){if(typeof f(this).data("qtip")!=="object"){f.fn.qtip.log.error.call(self,1,f.fn.qtip.constants.NO_TOOLTIP_PRESENT,false)}if(B=="api"){return f(this).data("qtip").interfaces[f(this).data("qtip").current]}else{if(B=="interfaces"){return f(this).data("qtip").interfaces}}}else{if(!B){B={}}if(typeof B.content!=="object"||(B.content.jquery&&B.content.length>0)){B.content={text:B.content}}if(typeof B.content.title!=="object"){B.content.title={text:B.content.title}}if(typeof B.position!=="object"){B.position={corner:B.position}}if(typeof B.position.corner!=="object"){B.position.corner={target:B.position.corner,tooltip:B.position.corner}}if(typeof B.show!=="object"){B.show={when:B.show}}if(typeof B.show.when!=="object"){B.show.when={event:B.show.when}}if(typeof B.show.effect!=="object"){B.show.effect={type:B.show.effect}}if(typeof B.hide!=="object"){B.hide={when:B.hide}}if(typeof B.hide.when!=="object"){B.hide.when={event:B.hide.when}}if(typeof B.hide.effect!=="object"){B.hide.effect={type:B.hide.effect}}if(typeof B.style!=="object"){B.style={name:B.style}}B.style=c(B.style);s=f.extend(true,{},f.fn.qtip.defaults,B);s.style=a.call({options:s},s.style);s.user=f.extend(true,{},B)}return f(this).each(function(){if(typeof B=="string"){w=B.toLowerCase();A=f(this).qtip("interfaces");if(typeof A=="object"){if(u===true&&w=="destroy"){while(A.length>0){A[A.length-1].destroy()}}else{if(u!==true){A=[f(this).qtip("api")]}for(y=0;y<A.length;y++){if(w=="destroy"){A[y].destroy()}else{if(A[y].status.rendered===true){if(w=="show"){A[y].show()}else{if(w=="hide"){A[y].hide()}else{if(w=="focus"){A[y].focus()}else{if(w=="disable"){A[y].disable(true)}else{if(w=="enable"){A[y].disable(false)}}}}}}}}}}}else{v=f.extend(true,{},s);v.hide.effect.length=s.hide.effect.length;v.show.effect.length=s.show.effect.length;if(v.position.container===false){v.position.container=f(document.body)}if(v.position.target===false){v.position.target=f(this)}if(v.show.when.target===false){v.show.when.target=f(this)}if(v.hide.when.target===false){v.hide.when.target=f(this)}t=f.fn.qtip.interfaces.length;for(y=0;y<t;y++){if(typeof f.fn.qtip.interfaces[y]=="undefined"){t=y;break}}x=new d(f(this),v,t);f.fn.qtip.interfaces[t]=x;if(typeof f(this).data("qtip")=="object"){if(typeof f(this).attr("qtip")==="undefined"){f(this).data("qtip").current=f(this).data("qtip").interfaces.length}f(this).data("qtip").interfaces.push(x)}else{f(this).data("qtip",{current:0,interfaces:[x]})}if(v.content.prerender===false&&v.show.when.event!==false&&v.show.ready!==true){v.show.when.target.bind(v.show.when.event+".qtip-"+t+"-create",{qtip:t},function(C){z=f.fn.qtip.interfaces[C.data.qtip];z.options.show.when.target.unbind(z.options.show.when.event+".qtip-"+C.data.qtip+"-create");z.cache.mouse={x:C.pageX,y:C.pageY};p.call(z);z.options.show.when.target.trigger(z.options.show.when.event)})}else{x.cache.mouse={x:v.show.when.target.offset().left,y:v.show.when.target.offset().top};p.call(x)}}})};function d(u,t,v){var s=this;s.id=v;s.options=t;s.status={animated:false,rendered:false,disabled:false,focused:false};s.elements={target:u.addClass(s.options.style.classes.target),tooltip:null,wrapper:null,content:null,contentWrapper:null,title:null,button:null,tip:null,bgiframe:null};s.cache={mouse:{},position:{},toggle:0};s.timers={};f.extend(s,s.options.api,{show:function(y){var x,z;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"show")}if(s.elements.tooltip.css("display")!=="none"){return s}s.elements.tooltip.stop(true,false);x=s.beforeShow.call(s,y);if(x===false){return s}function w(){if(s.options.position.type!=="static"){s.focus()}s.onShow.call(s,y);if(f.browser.msie){s.elements.tooltip.get(0).style.removeAttribute("filter")}}s.cache.toggle=1;if(s.options.position.type!=="static"){s.updatePosition(y,(s.options.show.effect.length>0))}if(typeof s.options.show.solo=="object"){z=f(s.options.show.solo)}else{if(s.options.show.solo===true){z=f("div.qtip").not(s.elements.tooltip)}}if(z){z.each(function(){if(f(this).qtip("api").status.rendered===true){f(this).qtip("api").hide()}})}if(typeof s.options.show.effect.type=="function"){s.options.show.effect.type.call(s.elements.tooltip,s.options.show.effect.length);s.elements.tooltip.queue(function(){w();f(this).dequeue()})}else{switch(s.options.show.effect.type.toLowerCase()){case"fade":s.elements.tooltip.fadeIn(s.options.show.effect.length,w);break;case"slide":s.elements.tooltip.slideDown(s.options.show.effect.length,function(){w();if(s.options.position.type!=="static"){s.updatePosition(y,true)}});break;case"grow":s.elements.tooltip.show(s.options.show.effect.length,w);break;default:s.elements.tooltip.show(null,w);break}s.elements.tooltip.addClass(s.options.style.classes.active)}return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_SHOWN,"show")},hide:function(y){var x;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"hide")}else{if(s.elements.tooltip.css("display")==="none"){return s}}clearTimeout(s.timers.show);s.elements.tooltip.stop(true,false);x=s.beforeHide.call(s,y);if(x===false){return s}function w(){s.onHide.call(s,y)}s.cache.toggle=0;if(typeof s.options.hide.effect.type=="function"){s.options.hide.effect.type.call(s.elements.tooltip,s.options.hide.effect.length);s.elements.tooltip.queue(function(){w();f(this).dequeue()})}else{switch(s.options.hide.effect.type.toLowerCase()){case"fade":s.elements.tooltip.fadeOut(s.options.hide.effect.length,w);break;case"slide":s.elements.tooltip.slideUp(s.options.hide.effect.length,w);break;case"grow":s.elements.tooltip.hide(s.options.hide.effect.length,w);break;default:s.elements.tooltip.hide(null,w);break}s.elements.tooltip.removeClass(s.options.style.classes.active)}return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_HIDDEN,"hide")},updatePosition:function(w,x){var C,G,L,J,H,E,y,I,B,D,K,A,F,z;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"updatePosition")}else{if(s.options.position.type=="static"){return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.CANNOT_POSITION_STATIC,"updatePosition")}}G={position:{left:0,top:0},dimensions:{height:0,width:0},corner:s.options.position.corner.target};L={position:s.getPosition(),dimensions:s.getDimensions(),corner:s.options.position.corner.tooltip};if(s.options.position.target!=="mouse"){if(s.options.position.target.get(0).nodeName.toLowerCase()=="area"){J=s.options.position.target.attr("coords").split(",");for(C=0;C<J.length;C++){J[C]=parseInt(J[C])}H=s.options.position.target.parent("map").attr("name");E=f('img[usemap="#'+H+'"]:first').offset();G.position={left:Math.floor(E.left+J[0]),top:Math.floor(E.top+J[1])};switch(s.options.position.target.attr("shape").toLowerCase()){case"rect":G.dimensions={width:Math.ceil(Math.abs(J[2]-J[0])),height:Math.ceil(Math.abs(J[3]-J[1]))};break;case"circle":G.dimensions={width:J[2]+1,height:J[2]+1};break;case"poly":G.dimensions={width:J[0],height:J[1]};for(C=0;C<J.length;C++){if(C%2==0){if(J[C]>G.dimensions.width){G.dimensions.width=J[C]}if(J[C]<J[0]){G.position.left=Math.floor(E.left+J[C])}}else{if(J[C]>G.dimensions.height){G.dimensions.height=J[C]}if(J[C]<J[1]){G.position.top=Math.floor(E.top+J[C])}}}G.dimensions.width=G.dimensions.width-(G.position.left-E.left);G.dimensions.height=G.dimensions.height-(G.position.top-E.top);break;default:return f.fn.qtip.log.error.call(s,4,f.fn.qtip.constants.INVALID_AREA_SHAPE,"updatePosition");break}G.dimensions.width-=2;G.dimensions.height-=2}else{if(s.options.position.target.add(document.body).length===1){G.position={left:f(document).scrollLeft(),top:f(document).scrollTop()};G.dimensions={height:f(window).height(),width:f(window).width()}}else{if(typeof s.options.position.target.attr("qtip")!=="undefined"){G.position=s.options.position.target.qtip("api").cache.position}else{G.position=s.options.position.target.offset()}G.dimensions={height:s.options.position.target.outerHeight(),width:s.options.position.target.outerWidth()}}}y=f.extend({},G.position);if(G.corner.search(/right/i)!==-1){y.left+=G.dimensions.width}if(G.corner.search(/bottom/i)!==-1){y.top+=G.dimensions.height}if(G.corner.search(/((top|bottom)Middle)|center/)!==-1){y.left+=(G.dimensions.width/2)}if(G.corner.search(/((left|right)Middle)|center/)!==-1){y.top+=(G.dimensions.height/2)}}else{G.position=y={left:s.cache.mouse.x,top:s.cache.mouse.y};G.dimensions={height:1,width:1}}if(L.corner.search(/right/i)!==-1){y.left-=L.dimensions.width}if(L.corner.search(/bottom/i)!==-1){y.top-=L.dimensions.height}if(L.corner.search(/((top|bottom)Middle)|center/)!==-1){y.left-=(L.dimensions.width/2)}if(L.corner.search(/((left|right)Middle)|center/)!==-1){y.top-=(L.dimensions.height/2)}I=(f.browser.msie)?1:0;B=(f.browser.msie&&parseInt(f.browser.version.charAt(0))===6)?1:0;if(s.options.style.border.radius>0){if(L.corner.search(/Left/)!==-1){y.left-=s.options.style.border.radius}else{if(L.corner.search(/Right/)!==-1){y.left+=s.options.style.border.radius}}if(L.corner.search(/Top/)!==-1){y.top-=s.options.style.border.radius}else{if(L.corner.search(/Bottom/)!==-1){y.top+=s.options.style.border.radius}}}if(I){if(L.corner.search(/top/)!==-1){y.top-=I}else{if(L.corner.search(/bottom/)!==-1){y.top+=I}}if(L.corner.search(/left/)!==-1){y.left-=I}else{if(L.corner.search(/right/)!==-1){y.left+=I}}if(L.corner.search(/leftMiddle|rightMiddle/)!==-1){y.top-=1}}if(s.options.position.adjust.screen===true){y=o.call(s,y,G,L)}if(s.options.position.target==="mouse"&&s.options.position.adjust.mouse===true){if(s.options.position.adjust.screen===true&&s.elements.tip){K=s.elements.tip.attr("rel")}else{K=s.options.position.corner.tooltip}y.left+=(K.search(/right/i)!==-1)?-6:6;y.top+=(K.search(/bottom/i)!==-1)?-6:6}if(!s.elements.bgiframe&&f.browser.msie&&parseInt(f.browser.version.charAt(0))==6){f("select, object").each(function(){A=f(this).offset();A.bottom=A.top+f(this).height();A.right=A.left+f(this).width();if(y.top+L.dimensions.height>=A.top&&y.left+L.dimensions.width>=A.left){k.call(s)}})}y.left+=s.options.position.adjust.x;y.top+=s.options.position.adjust.y;F=s.getPosition();if(y.left!=F.left||y.top!=F.top){z=s.beforePositionUpdate.call(s,w);if(z===false){return s}s.cache.position=y;if(x===true){s.status.animated=true;s.elements.tooltip.animate(y,200,"swing",function(){s.status.animated=false})}else{s.elements.tooltip.css(y)}s.onPositionUpdate.call(s,w);if(typeof w!=="undefined"&&w.type&&w.type!=="mousemove"){f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_POSITION_UPDATED,"updatePosition")}}return s},updateWidth:function(w){var x;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"updateWidth")}else{if(w&&typeof w!=="number"){return f.fn.qtip.log.error.call(s,2,"newWidth must be of type number","updateWidth")}}x=s.elements.contentWrapper.siblings().add(s.elements.tip).add(s.elements.button);if(!w){if(typeof s.options.style.width.value=="number"){w=s.options.style.width.value}else{s.elements.tooltip.css({width:"auto"});x.hide();if(f.browser.msie){s.elements.wrapper.add(s.elements.contentWrapper.children()).css({zoom:"normal"})}w=s.getDimensions().width+1;if(!s.options.style.width.value){if(w>s.options.style.width.max){w=s.options.style.width.max}if(w<s.options.style.width.min){w=s.options.style.width.min}}}}if(w%2!==0){w-=1}s.elements.tooltip.width(w);x.show();if(s.options.style.border.radius){s.elements.tooltip.find(".qtip-betweenCorners").each(function(y){f(this).width(w-(s.options.style.border.radius*2))})}if(f.browser.msie){s.elements.wrapper.add(s.elements.contentWrapper.children()).css({zoom:"1"});s.elements.wrapper.width(w);if(s.elements.bgiframe){s.elements.bgiframe.width(w).height(s.getDimensions.height)}}return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_WIDTH_UPDATED,"updateWidth")},updateStyle:function(w){var z,A,x,y,B;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"updateStyle")}else{if(typeof w!=="string"||!f.fn.qtip.styles[w]){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.STYLE_NOT_DEFINED,"updateStyle")}}s.options.style=a.call(s,f.fn.qtip.styles[w],s.options.user.style);s.elements.content.css(q(s.options.style));if(s.options.content.title.text!==false){s.elements.title.css(q(s.options.style.title,true))}s.elements.contentWrapper.css({borderColor:s.options.style.border.color});if(s.options.style.tip.corner!==false){if(f("<canvas>").get(0).getContext){z=s.elements.tooltip.find(".qtip-tip canvas:first");x=z.get(0).getContext("2d");x.clearRect(0,0,300,300);y=z.parent("div[rel]:first").attr("rel");B=b(y,s.options.style.tip.size.width,s.options.style.tip.size.height);h.call(s,z,B,s.options.style.tip.color||s.options.style.border.color)}else{if(f.browser.msie){z=s.elements.tooltip.find('.qtip-tip [nodeName="shape"]');z.attr("fillcolor",s.options.style.tip.color||s.options.style.border.color)}}}if(s.options.style.border.radius>0){s.elements.tooltip.find(".qtip-betweenCorners").css({backgroundColor:s.options.style.border.color});if(f("<canvas>").get(0).getContext){A=g(s.options.style.border.radius);s.elements.tooltip.find(".qtip-wrapper canvas").each(function(){x=f(this).get(0).getContext("2d");x.clearRect(0,0,300,300);y=f(this).parent("div[rel]:first").attr("rel");r.call(s,f(this),A[y],s.options.style.border.radius,s.options.style.border.color)})}else{if(f.browser.msie){s.elements.tooltip.find('.qtip-wrapper [nodeName="arc"]').each(function(){f(this).attr("fillcolor",s.options.style.border.color)})}}}return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_STYLE_UPDATED,"updateStyle")},updateContent:function(A,y){var z,x,w;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"updateContent")}else{if(!A){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.NO_CONTENT_PROVIDED,"updateContent")}}z=s.beforeContentUpdate.call(s,A);if(typeof z=="string"){A=z}else{if(z===false){return}}if(f.browser.msie){s.elements.contentWrapper.children().css({zoom:"normal"})}if(A.jquery&&A.length>0){A.clone(true).appendTo(s.elements.content).show()}else{s.elements.content.html(A)}x=s.elements.content.find("img[complete=false]");if(x.length>0){w=0;x.each(function(C){f('<img src="'+f(this).attr("src")+'" />').load(function(){if(++w==x.length){B()}})})}else{B()}function B(){s.updateWidth();if(y!==false){if(s.options.position.type!=="static"){s.updatePosition(s.elements.tooltip.is(":visible"),true)}if(s.options.style.tip.corner!==false){n.call(s)}}}s.onContentUpdate.call(s);return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_CONTENT_UPDATED,"loadContent")},loadContent:function(w,z,A){var y;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"loadContent")}y=s.beforeContentLoad.call(s);if(y===false){return s}if(A=="post"){f.post(w,z,x)}else{f.get(w,z,x)}function x(B){s.onContentLoad.call(s);f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_CONTENT_LOADED,"loadContent");s.updateContent(B)}return s},updateTitle:function(w){if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"updateTitle")}else{if(!w){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.NO_CONTENT_PROVIDED,"updateTitle")}}returned=s.beforeTitleUpdate.call(s);if(returned===false){return s}if(s.elements.button){s.elements.button=s.elements.button.clone(true)}s.elements.title.html(w);if(s.elements.button){s.elements.title.prepend(s.elements.button)}s.onTitleUpdate.call(s);return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_TITLE_UPDATED,"updateTitle")},focus:function(A){var y,x,w,z;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"focus")}else{if(s.options.position.type=="static"){return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.CANNOT_FOCUS_STATIC,"focus")}}y=parseInt(s.elements.tooltip.css("z-index"));x=6000+f("div.qtip[qtip]").length-1;if(!s.status.focused&&y!==x){z=s.beforeFocus.call(s,A);if(z===false){return s}f("div.qtip[qtip]").not(s.elements.tooltip).each(function(){if(f(this).qtip("api").status.rendered===true){w=parseInt(f(this).css("z-index"));if(typeof w=="number"&&w>-1){f(this).css({zIndex:parseInt(f(this).css("z-index"))-1})}f(this).qtip("api").status.focused=false}});s.elements.tooltip.css({zIndex:x});s.status.focused=true;s.onFocus.call(s,A);f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_FOCUSED,"focus")}return s},disable:function(w){if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"disable")}if(w){if(!s.status.disabled){s.status.disabled=true;f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_DISABLED,"disable")}else{f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.TOOLTIP_ALREADY_DISABLED,"disable")}}else{if(s.status.disabled){s.status.disabled=false;f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_ENABLED,"disable")}else{f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.TOOLTIP_ALREADY_ENABLED,"disable")}}return s},destroy:function(){var w,x,y;x=s.beforeDestroy.call(s);if(x===false){return s}if(s.status.rendered){s.options.show.when.target.unbind("mousemove.qtip",s.updatePosition);s.options.show.when.target.unbind("mouseout.qtip",s.hide);s.options.show.when.target.unbind(s.options.show.when.event+".qtip");s.options.hide.when.target.unbind(s.options.hide.when.event+".qtip");s.elements.tooltip.unbind(s.options.hide.when.event+".qtip");s.elements.tooltip.unbind("mouseover.qtip",s.focus);s.elements.tooltip.remove()}else{s.options.show.when.target.unbind(s.options.show.when.event+".qtip-create")}if(typeof s.elements.target.data("qtip")=="object"){y=s.elements.target.data("qtip").interfaces;if(typeof y=="object"&&y.length>0){for(w=0;w<y.length-1;w++){if(y[w].id==s.id){y.splice(w,1)}}}}delete f.fn.qtip.interfaces[s.id];if(typeof y=="object"&&y.length>0){s.elements.target.data("qtip").current=y.length-1}else{s.elements.target.removeData("qtip")}s.onDestroy.call(s);f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_DESTROYED,"destroy");return s.elements.target},getPosition:function(){var w,x;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"getPosition")}w=(s.elements.tooltip.css("display")!=="none")?false:true;if(w){s.elements.tooltip.css({visiblity:"hidden"}).show()}x=s.elements.tooltip.offset();if(w){s.elements.tooltip.css({visiblity:"visible"}).hide()}return x},getDimensions:function(){var w,x;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"getDimensions")}w=(!s.elements.tooltip.is(":visible"))?true:false;if(w){s.elements.tooltip.css({visiblity:"hidden"}).show()}x={height:s.elements.tooltip.outerHeight(),width:s.elements.tooltip.outerWidth()};if(w){s.elements.tooltip.css({visiblity:"visible"}).hide()}return x}})}function p(){var s,w,u,t,v,y,x;s=this;s.beforeRender.call(s);s.status.rendered=true;s.elements.tooltip='<div qtip="'+s.id+'" class="qtip '+(s.options.style.classes.tooltip||s.options.style)+'"style="display:none; -moz-border-radius:0; -webkit-border-radius:0; border-radius:0;position:'+s.options.position.type+';"> <div class="qtip-wrapper" style="position:relative; overflow:hidden; text-align:left;"> <div class="qtip-contentWrapper" style="overflow:hidden;"> <div class="qtip-content '+s.options.style.classes.content+'"></div></div></div></div>';s.elements.tooltip=f(s.elements.tooltip);s.elements.tooltip.appendTo(s.options.position.container);s.elements.tooltip.data("qtip",{current:0,interfaces:[s]});s.elements.wrapper=s.elements.tooltip.children("div:first");s.elements.contentWrapper=s.elements.wrapper.children("div:first").css({background:s.options.style.background});s.elements.content=s.elements.contentWrapper.children("div:first").css(q(s.options.style));if(f.browser.msie){s.elements.wrapper.add(s.elements.content).css({zoom:1})}if(s.options.hide.when.event=="unfocus"){s.elements.tooltip.attr("unfocus",true)}if(typeof s.options.style.width.value=="number"){s.updateWidth()}if(f("<canvas>").get(0).getContext||f.browser.msie){if(s.options.style.border.radius>0){m.call(s)}else{s.elements.contentWrapper.css({border:s.options.style.border.width+"px solid "+s.options.style.border.color})}if(s.options.style.tip.corner!==false){e.call(s)}}else{s.elements.contentWrapper.css({border:s.options.style.border.width+"px solid "+s.options.style.border.color});s.options.style.border.radius=0;s.options.style.tip.corner=false;f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.CANVAS_VML_NOT_SUPPORTED,"render")}if((typeof s.options.content.text=="string"&&s.options.content.text.length>0)||(s.options.content.text.jquery&&s.options.content.text.length>0)){u=s.options.content.text}else{if(typeof s.elements.target.attr("title")=="string"&&s.elements.target.attr("title").length>0){u=s.elements.target.attr("title").replace("\\n","<br />");s.elements.target.attr("title","")}else{if(typeof s.elements.target.attr("alt")=="string"&&s.elements.target.attr("alt").length>0){u=s.elements.target.attr("alt").replace("\\n","<br />");s.elements.target.attr("alt","")}else{u=" ";f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.NO_VALID_CONTENT,"render")}}}if(s.options.content.title.text!==false){j.call(s)}s.updateContent(u);l.call(s);if(s.options.show.ready===true){s.show()}if(s.options.content.url!==false){t=s.options.content.url;v=s.options.content.data;y=s.options.content.method||"get";s.loadContent(t,v,y)}s.onRender.call(s);f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_RENDERED,"render")}function m(){var F,z,t,B,x,E,u,G,D,y,w,C,A,s,v;F=this;F.elements.wrapper.find(".qtip-borderBottom, .qtip-borderTop").remove();t=F.options.style.border.width;B=F.options.style.border.radius;x=F.options.style.border.color||F.options.style.tip.color;E=g(B);u={};for(z in E){u[z]='<div rel="'+z+'" style="'+((z.search(/Left/)!==-1)?"left":"right")+":0; position:absolute; height:"+B+"px; width:"+B+'px; overflow:hidden; line-height:0.1px; font-size:1px">';if(f("<canvas>").get(0).getContext){u[z]+='<canvas height="'+B+'" width="'+B+'" style="vertical-align: top"></canvas>'}else{if(f.browser.msie){G=B*2+3;u[z]+='<v:arc stroked="false" fillcolor="'+x+'" startangle="'+E[z][0]+'" endangle="'+E[z][1]+'" style="width:'+G+"px; height:"+G+"px; margin-top:"+((z.search(/bottom/)!==-1)?-2:-1)+"px; margin-left:"+((z.search(/Right/)!==-1)?E[z][2]-3.5:-1)+'px; vertical-align:top; display:inline-block; behavior:url(#default#VML)"></v:arc>'}}u[z]+="</div>"}D=F.getDimensions().width-(Math.max(t,B)*2);y='<div class="qtip-betweenCorners" style="height:'+B+"px; width:"+D+"px; overflow:hidden; background-color:"+x+'; line-height:0.1px; font-size:1px;">';w='<div class="qtip-borderTop" dir="ltr" style="height:'+B+"px; margin-left:"+B+'px; line-height:0.1px; font-size:1px; padding:0;">'+u.topLeft+u.topRight+y;F.elements.wrapper.prepend(w);C='<div class="qtip-borderBottom" dir="ltr" style="height:'+B+"px; margin-left:"+B+'px; line-height:0.1px; font-size:1px; padding:0;">'+u.bottomLeft+u.bottomRight+y;F.elements.wrapper.append(C);if(f("<canvas>").get(0).getContext){F.elements.wrapper.find("canvas").each(function(){A=E[f(this).parent("[rel]:first").attr("rel")];r.call(F,f(this),A,B,x)})}else{if(f.browser.msie){F.elements.tooltip.append('<v:image style="behavior:url(#default#VML);"></v:image>')}}s=Math.max(B,(B+(t-B)));v=Math.max(t-B,0);F.elements.contentWrapper.css({border:"0px solid "+x,borderWidth:v+"px "+s+"px"})}function r(u,w,s,t){var v=u.get(0).getContext("2d");v.fillStyle=t;v.beginPath();v.arc(w[0],w[1],s,0,Math.PI*2,false);v.fill()}function e(v){var t,s,x,u,w;t=this;if(t.elements.tip!==null){t.elements.tip.remove()}s=t.options.style.tip.color||t.options.style.border.color;if(t.options.style.tip.corner===false){return}else{if(!v){v=t.options.style.tip.corner}}x=b(v,t.options.style.tip.size.width,t.options.style.tip.size.height);t.elements.tip='<div class="'+t.options.style.classes.tip+'" dir="ltr" rel="'+v+'" style="position:absolute; height:'+t.options.style.tip.size.height+"px; width:"+t.options.style.tip.size.width+'px; margin:0 auto; line-height:0.1px; font-size:1px;">';if(f("<canvas>").get(0).getContext){t.elements.tip+='<canvas height="'+t.options.style.tip.size.height+'" width="'+t.options.style.tip.size.width+'"></canvas>'}else{if(f.browser.msie){u=t.options.style.tip.size.width+","+t.options.style.tip.size.height;w="m"+x[0][0]+","+x[0][1];w+=" l"+x[1][0]+","+x[1][1];w+=" "+x[2][0]+","+x[2][1];w+=" xe";t.elements.tip+='<v:shape fillcolor="'+s+'" stroked="false" filled="true" path="'+w+'" coordsize="'+u+'" style="width:'+t.options.style.tip.size.width+"px; height:"+t.options.style.tip.size.height+"px; line-height:0.1px; display:inline-block; behavior:url(#default#VML); vertical-align:"+((v.search(/top/)!==-1)?"bottom":"top")+'"></v:shape>';t.elements.tip+='<v:image style="behavior:url(#default#VML);"></v:image>';t.elements.contentWrapper.css("position","relative")}}t.elements.tooltip.prepend(t.elements.tip+"</div>");t.elements.tip=t.elements.tooltip.find("."+t.options.style.classes.tip).eq(0);if(f("<canvas>").get(0).getContext){h.call(t,t.elements.tip.find("canvas:first"),x,s)}if(v.search(/top/)!==-1&&f.browser.msie&&parseInt(f.browser.version.charAt(0))===6){t.elements.tip.css({marginTop:-4})}n.call(t,v)}function h(t,v,s){var u=t.get(0).getContext("2d");u.fillStyle=s;u.beginPath();u.moveTo(v[0][0],v[0][1]);u.lineTo(v[1][0],v[1][1]);u.lineTo(v[2][0],v[2][1]);u.fill()}function n(u){var t,w,s,x,v;t=this;if(t.options.style.tip.corner===false||!t.elements.tip){return}if(!u){u=t.elements.tip.attr("rel")}w=positionAdjust=(f.browser.msie)?1:0;t.elements.tip.css(u.match(/left|right|top|bottom/)[0],0);if(u.search(/top|bottom/)!==-1){if(f.browser.msie){if(parseInt(f.browser.version.charAt(0))===6){positionAdjust=(u.search(/top/)!==-1)?-3:1}else{positionAdjust=(u.search(/top/)!==-1)?1:2}}if(u.search(/Middle/)!==-1){t.elements.tip.css({left:"50%",marginLeft:-(t.options.style.tip.size.width/2)})}else{if(u.search(/Left/)!==-1){t.elements.tip.css({left:t.options.style.border.radius-w})}else{if(u.search(/Right/)!==-1){t.elements.tip.css({right:t.options.style.border.radius+w})}}}if(u.search(/top/)!==-1){t.elements.tip.css({top:-positionAdjust})}else{t.elements.tip.css({bottom:positionAdjust})}}else{if(u.search(/left|right/)!==-1){if(f.browser.msie){positionAdjust=(parseInt(f.browser.version.charAt(0))===6)?1:((u.search(/left/)!==-1)?1:2)}if(u.search(/Middle/)!==-1){t.elements.tip.css({top:"50%",marginTop:-(t.options.style.tip.size.height/2)})}else{if(u.search(/Top/)!==-1){t.elements.tip.css({top:t.options.style.border.radius-w})}else{if(u.search(/Bottom/)!==-1){t.elements.tip.css({bottom:t.options.style.border.radius+w})}}}if(u.search(/left/)!==-1){t.elements.tip.css({left:-positionAdjust})}else{t.elements.tip.css({right:positionAdjust})}}}s="padding-"+u.match(/left|right|top|bottom/)[0];x=t.options.style.tip.size[(s.search(/left|right/)!==-1)?"width":"height"];t.elements.tooltip.css("padding",0);t.elements.tooltip.css(s,x);if(f.browser.msie&&parseInt(f.browser.version.charAt(0))==6){v=parseInt(t.elements.tip.css("margin-top"))||0;v+=parseInt(t.elements.content.css("margin-top"))||0;t.elements.tip.css({marginTop:v})}}function j(){var s=this;if(s.elements.title!==null){s.elements.title.remove()}s.elements.title=f('<div class="'+s.options.style.classes.title+'">').css(q(s.options.style.title,true)).css({zoom:(f.browser.msie)?1:0}).prependTo(s.elements.contentWrapper);if(s.options.content.title.text){s.updateTitle.call(s,s.options.content.title.text)}if(s.options.content.title.button!==false&&typeof s.options.content.title.button=="string"){s.elements.button=f('<a class="'+s.options.style.classes.button+'" style="float:right; position: relative"></a>').css(q(s.options.style.button,true)).html(s.options.content.title.button).prependTo(s.elements.title).click(function(t){if(!s.status.disabled){s.hide(t)}})}}function l(){var t,v,u,s;t=this;v=t.options.show.when.target;u=t.options.hide.when.target;if(t.options.hide.fixed){u=u.add(t.elements.tooltip)}if(t.options.hide.when.event=="inactive"){s=["click","dblclick","mousedown","mouseup","mousemove","mouseout","mouseenter","mouseleave","mouseover"];function y(z){if(t.status.disabled===true){return}clearTimeout(t.timers.inactive);t.timers.inactive=setTimeout(function(){f(s).each(function(){u.unbind(this+".qtip-inactive");t.elements.content.unbind(this+".qtip-inactive")});t.hide(z)},t.options.hide.delay)}}else{if(t.options.hide.fixed===true){t.elements.tooltip.bind("mouseover.qtip",function(){if(t.status.disabled===true){return}clearTimeout(t.timers.hide)})}}function x(z){if(t.status.disabled===true){return}if(t.options.hide.when.event=="inactive"){f(s).each(function(){u.bind(this+".qtip-inactive",y);t.elements.content.bind(this+".qtip-inactive",y)});y()}clearTimeout(t.timers.show);clearTimeout(t.timers.hide);t.timers.show=setTimeout(function(){t.show(z)},t.options.show.delay)}function w(z){if(t.status.disabled===true){return}if(t.options.hide.fixed===true&&t.options.hide.when.event.search(/mouse(out|leave)/i)!==-1&&f(z.relatedTarget).parents("div.qtip[qtip]").length>0){z.stopPropagation();z.preventDefault();clearTimeout(t.timers.hide);return false}clearTimeout(t.timers.show);clearTimeout(t.timers.hide);t.elements.tooltip.stop(true,true);t.timers.hide=setTimeout(function(){t.hide(z)},t.options.hide.delay)}if((t.options.show.when.target.add(t.options.hide.when.target).length===1&&t.options.show.when.event==t.options.hide.when.event&&t.options.hide.when.event!=="inactive")||t.options.hide.when.event=="unfocus"){t.cache.toggle=0;v.bind(t.options.show.when.event+".qtip",function(z){if(t.cache.toggle==0){x(z)}else{w(z)}})}else{v.bind(t.options.show.when.event+".qtip",x);if(t.options.hide.when.event!=="inactive"){u.bind(t.options.hide.when.event+".qtip",w)}}if(t.options.position.type.search(/(fixed|absolute)/)!==-1){t.elements.tooltip.bind("mouseover.qtip",t.focus)}if(t.options.position.target==="mouse"&&t.options.position.type!=="static"){v.bind("mousemove.qtip",function(z){t.cache.mouse={x:z.pageX,y:z.pageY};if(t.status.disabled===false&&t.options.position.adjust.mouse===true&&t.options.position.type!=="static"&&t.elements.tooltip.css("display")!=="none"){t.updatePosition(z)}})}}function o(u,v,A){var z,s,x,y,t,w;z=this;if(A.corner=="center"){return v.position}s=f.extend({},u);y={x:false,y:false};t={left:(s.left<f.fn.qtip.cache.screen.scroll.left),right:(s.left+A.dimensions.width+2>=f.fn.qtip.cache.screen.width+f.fn.qtip.cache.screen.scroll.left),top:(s.top<f.fn.qtip.cache.screen.scroll.top),bottom:(s.top+A.dimensions.height+2>=f.fn.qtip.cache.screen.height+f.fn.qtip.cache.screen.scroll.top)};x={left:(t.left&&(A.corner.search(/right/i)!=-1||(A.corner.search(/right/i)==-1&&!t.right))),right:(t.right&&(A.corner.search(/left/i)!=-1||(A.corner.search(/left/i)==-1&&!t.left))),top:(t.top&&A.corner.search(/top/i)==-1),bottom:(t.bottom&&A.corner.search(/bottom/i)==-1)};if(x.left){if(z.options.position.target!=="mouse"){s.left=v.position.left+v.dimensions.width}else{s.left=z.cache.mouse.x}y.x="Left"}else{if(x.right){if(z.options.position.target!=="mouse"){s.left=v.position.left-A.dimensions.width}else{s.left=z.cache.mouse.x-A.dimensions.width}y.x="Right"}}if(x.top){if(z.options.position.target!=="mouse"){s.top=v.position.top+v.dimensions.height}else{s.top=z.cache.mouse.y}y.y="top"}else{if(x.bottom){if(z.options.position.target!=="mouse"){s.top=v.position.top-A.dimensions.height}else{s.top=z.cache.mouse.y-A.dimensions.height}y.y="bottom"}}if(s.left<0){s.left=u.left;y.x=false}if(s.top<0){s.top=u.top;y.y=false}if(z.options.style.tip.corner!==false){s.corner=new String(A.corner);if(y.x!==false){s.corner=s.corner.replace(/Left|Right|Middle/,y.x)}if(y.y!==false){s.corner=s.corner.replace(/top|bottom/,y.y)}if(s.corner!==z.elements.tip.attr("rel")){e.call(z,s.corner)}}return s}function q(u,t){var v,s;v=f.extend(true,{},u);for(s in v){if(t===true&&s.search(/(tip|classes)/i)!==-1){delete v[s]}else{if(!t&&s.search(/(width|border|tip|title|classes|user)/i)!==-1){delete v[s]}}}return v}function c(s){if(typeof s.tip!=="object"){s.tip={corner:s.tip}}if(typeof s.tip.size!=="object"){s.tip.size={width:s.tip.size,height:s.tip.size}}if(typeof s.border!=="object"){s.border={width:s.border}}if(typeof s.width!=="object"){s.width={value:s.width}}if(typeof s.width.max=="string"){s.width.max=parseInt(s.width.max.replace(/([0-9]+)/i,"$1"))}if(typeof s.width.min=="string"){s.width.min=parseInt(s.width.min.replace(/([0-9]+)/i,"$1"))}if(typeof s.tip.size.x=="number"){s.tip.size.width=s.tip.size.x;delete s.tip.size.x}if(typeof s.tip.size.y=="number"){s.tip.size.height=s.tip.size.y;delete s.tip.size.y}return s}function a(){var s,t,u,x,v,w;s=this;u=[true,{}];for(t=0;t<arguments.length;t++){u.push(arguments[t])}x=[f.extend.apply(f,u)];while(typeof x[0].name=="string"){x.unshift(c(f.fn.qtip.styles[x[0].name]))}x.unshift(true,{classes:{tooltip:"qtip-"+(arguments[0].name||"defaults")}},f.fn.qtip.styles.defaults);v=f.extend.apply(f,x);w=(f.browser.msie)?1:0;v.tip.size.width+=w;v.tip.size.height+=w;if(v.tip.size.width%2>0){v.tip.size.width+=1}if(v.tip.size.height%2>0){v.tip.size.height+=1}if(v.tip.corner===true){v.tip.corner=(s.options.position.corner.tooltip==="center")?false:s.options.position.corner.tooltip}return v}function b(v,u,t){var s={bottomRight:[[0,0],[u,t],[u,0]],bottomLeft:[[0,0],[u,0],[0,t]],topRight:[[0,t],[u,0],[u,t]],topLeft:[[0,0],[0,t],[u,t]],topMiddle:[[0,t],[u/2,0],[u,t]],bottomMiddle:[[0,0],[u,0],[u/2,t]],rightMiddle:[[0,0],[u,t/2],[0,t]],leftMiddle:[[u,0],[u,t],[0,t/2]]};s.leftTop=s.bottomRight;s.rightTop=s.bottomLeft;s.leftBottom=s.topRight;s.rightBottom=s.topLeft;return s[v]}function g(s){var t;if(f("<canvas>").get(0).getContext){t={topLeft:[s,s],topRight:[0,s],bottomLeft:[s,0],bottomRight:[0,0]}}else{if(f.browser.msie){t={topLeft:[-90,90,0],topRight:[-90,90,-s],bottomLeft:[90,270,0],bottomRight:[90,270,-s]}}}return t}function k(){var s,t,u;s=this;u=s.getDimensions();t='<iframe class="qtip-bgiframe" frameborder="0" tabindex="-1" src="javascript:false" style="display:block; position:absolute; z-index:-1; filter:alpha(opacity=\'0\'); border: 1px solid red; height:'+u.height+"px; width:"+u.width+'px" />';s.elements.bgiframe=s.elements.wrapper.prepend(t).children(".qtip-bgiframe:first")}f(document).ready(function(){f.fn.qtip.cache={screen:{scroll:{left:f(window).scrollLeft(),top:f(window).scrollTop()},width:f(window).width(),height:f(window).height()}};var s;f(window).bind("resize scroll",function(t){clearTimeout(s);s=setTimeout(function(){if(t.type==="scroll"){f.fn.qtip.cache.screen.scroll={left:f(window).scrollLeft(),top:f(window).scrollTop()}}else{f.fn.qtip.cache.screen.width=f(window).width();f.fn.qtip.cache.screen.height=f(window).height()}for(i=0;i<f.fn.qtip.interfaces.length;i++){var u=f.fn.qtip.interfaces[i];if(u.status.rendered===true&&(u.options.position.type!=="static"||u.options.position.adjust.scroll&&t.type==="scroll"||u.options.position.adjust.resize&&t.type==="resize")){u.updatePosition(t,true)}}},100)});f(document).bind("mousedown.qtip",function(t){if(f(t.target).parents("div.qtip").length===0){f(".qtip[unfocus]").each(function(){var u=f(this).qtip("api");if(f(this).is(":visible")&&!u.status.disabled&&f(t.target).add(u.elements.target).length>1){u.hide(t)}})}})});f.fn.qtip.interfaces=[];f.fn.qtip.log={error:function(){return this}};f.fn.qtip.constants={};f.fn.qtip.defaults={content:{prerender:false,text:false,url:false,data:null,title:{text:false,button:false}},position:{target:false,corner:{target:"bottomRight",tooltip:"topLeft"},adjust:{x:0,y:0,mouse:true,screen:false,scroll:true,resize:true},type:"absolute",container:false},show:{when:{target:false,event:"mouseover"},effect:{type:"fade",length:100},delay:140,solo:false,ready:false},hide:{when:{target:false,event:"mouseout"},effect:{type:"fade",length:100},delay:0,fixed:false},api:{beforeRender:function(){},onRender:function(){},beforePositionUpdate:function(){},onPositionUpdate:function(){},beforeShow:function(){},onShow:function(){},beforeHide:function(){},onHide:function(){},beforeContentUpdate:function(){},onContentUpdate:function(){},beforeContentLoad:function(){},onContentLoad:function(){},beforeTitleUpdate:function(){},onTitleUpdate:function(){},beforeDestroy:function(){},onDestroy:function(){},beforeFocus:function(){},onFocus:function(){}}};f.fn.qtip.styles={defaults:{background:"white",color:"#111",overflow:"hidden",textAlign:"left",width:{min:0,max:250},padding:"5px 9px",border:{width:1,radius:0,color:"#d3d3d3"},tip:{corner:false,color:false,size:{width:13,height:13},opacity:1},title:{background:"#e1e1e1",fontWeight:"bold",padding:"7px 12px"},button:{cursor:"pointer"},classes:{target:"",tip:"qtip-tip",title:"qtip-title",button:"qtip-button",content:"qtip-content",active:"qtip-active"}},cream:{border:{width:3,radius:0,color:"#F9E98E"},title:{background:"#F0DE7D",color:"#A27D35"},background:"#FBF7AA",color:"#A27D35",classes:{tooltip:"qtip-cream"}},light:{border:{width:3,radius:0,color:"#E2E2E2"},title:{background:"#f1f1f1",color:"#454545"},background:"white",color:"#454545",classes:{tooltip:"qtip-light"}},dark:{border:{width:3,radius:0,color:"#303030"},title:{background:"#404040",color:"#f3f3f3"},background:"#505050",color:"#f3f3f3",classes:{tooltip:"qtip-dark"}},red:{border:{width:3,radius:0,color:"#CE6F6F"},title:{background:"#f28279",color:"#9C2F2F"},background:"#F79992",color:"#9C2F2F",classes:{tooltip:"qtip-red"}},green:{border:{width:3,radius:0,color:"#A9DB66"},title:{background:"#b9db8c",color:"#58792E"},background:"#CDE6AC",color:"#58792E",classes:{tooltip:"qtip-green"}},blue:{border:{width:3,radius:0,color:"#ADD9ED"},title:{background:"#D0E9F5",color:"#5E99BD"},background:"#E5F6FE",color:"#4D9FBF",classes:{tooltip:"qtip-blue"}}}})(jQuery);
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
1 |
+
/*
|
2 |
+
* jquery.qtip. The jQuery tooltip plugin
|
3 |
+
*
|
4 |
+
* Copyright (c) 2009 Craig Thompson
|
5 |
+
* http://craigsworks.com
|
6 |
+
*
|
7 |
+
* Licensed under MIT
|
8 |
+
* http://www.opensource.org/licenses/mit-license.php
|
9 |
+
*
|
10 |
+
* Launch : February 2009
|
11 |
+
* Version : 1.0.0-rc3
|
12 |
+
* Released: Tuesday 12th May, 2009 - 00:00
|
13 |
+
* Debug: jquery.qtip.debug.js
|
14 |
+
*/
|
15 |
+
(function(f){f.fn.qtip=function(B,u){var y,t,A,s,x,w,v,z;if(typeof B=="string"){if(typeof f(this).data("qtip")!=="object"){f.fn.qtip.log.error.call(self,1,f.fn.qtip.constants.NO_TOOLTIP_PRESENT,false)}if(B=="api"){return f(this).data("qtip").interfaces[f(this).data("qtip").current]}else{if(B=="interfaces"){return f(this).data("qtip").interfaces}}}else{if(!B){B={}}if(typeof B.content!=="object"||(B.content.jquery&&B.content.length>0)){B.content={text:B.content}}if(typeof B.content.title!=="object"){B.content.title={text:B.content.title}}if(typeof B.position!=="object"){B.position={corner:B.position}}if(typeof B.position.corner!=="object"){B.position.corner={target:B.position.corner,tooltip:B.position.corner}}if(typeof B.show!=="object"){B.show={when:B.show}}if(typeof B.show.when!=="object"){B.show.when={event:B.show.when}}if(typeof B.show.effect!=="object"){B.show.effect={type:B.show.effect}}if(typeof B.hide!=="object"){B.hide={when:B.hide}}if(typeof B.hide.when!=="object"){B.hide.when={event:B.hide.when}}if(typeof B.hide.effect!=="object"){B.hide.effect={type:B.hide.effect}}if(typeof B.style!=="object"){B.style={name:B.style}}B.style=c(B.style);s=f.extend(true,{},f.fn.qtip.defaults,B);s.style=a.call({options:s},s.style);s.user=f.extend(true,{},B)}return f(this).each(function(){if(typeof B=="string"){w=B.toLowerCase();A=f(this).qtip("interfaces");if(typeof A=="object"){if(u===true&&w=="destroy"){while(A.length>0){A[A.length-1].destroy()}}else{if(u!==true){A=[f(this).qtip("api")]}for(y=0;y<A.length;y++){if(w=="destroy"){A[y].destroy()}else{if(A[y].status.rendered===true){if(w=="show"){A[y].show()}else{if(w=="hide"){A[y].hide()}else{if(w=="focus"){A[y].focus()}else{if(w=="disable"){A[y].disable(true)}else{if(w=="enable"){A[y].disable(false)}}}}}}}}}}}else{v=f.extend(true,{},s);v.hide.effect.length=s.hide.effect.length;v.show.effect.length=s.show.effect.length;if(v.position.container===false){v.position.container=f(document.body)}if(v.position.target===false){v.position.target=f(this)}if(v.show.when.target===false){v.show.when.target=f(this)}if(v.hide.when.target===false){v.hide.when.target=f(this)}t=f.fn.qtip.interfaces.length;for(y=0;y<t;y++){if(typeof f.fn.qtip.interfaces[y]=="undefined"){t=y;break}}x=new d(f(this),v,t);f.fn.qtip.interfaces[t]=x;if(typeof f(this).data("qtip")=="object"){if(typeof f(this).attr("qtip")==="undefined"){f(this).data("qtip").current=f(this).data("qtip").interfaces.length}f(this).data("qtip").interfaces.push(x)}else{f(this).data("qtip",{current:0,interfaces:[x]})}if(v.content.prerender===false&&v.show.when.event!==false&&v.show.ready!==true){v.show.when.target.bind(v.show.when.event+".qtip-"+t+"-create",{qtip:t},function(C){z=f.fn.qtip.interfaces[C.data.qtip];z.options.show.when.target.unbind(z.options.show.when.event+".qtip-"+C.data.qtip+"-create");z.cache.mouse={x:C.pageX,y:C.pageY};p.call(z);z.options.show.when.target.trigger(z.options.show.when.event)})}else{x.cache.mouse={x:v.show.when.target.offset().left,y:v.show.when.target.offset().top};p.call(x)}}})};function d(u,t,v){var s=this;s.id=v;s.options=t;s.status={animated:false,rendered:false,disabled:false,focused:false};s.elements={target:u.addClass(s.options.style.classes.target),tooltip:null,wrapper:null,content:null,contentWrapper:null,title:null,button:null,tip:null,bgiframe:null};s.cache={mouse:{},position:{},toggle:0};s.timers={};f.extend(s,s.options.api,{show:function(y){var x,z;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"show")}if(s.elements.tooltip.css("display")!=="none"){return s}s.elements.tooltip.stop(true,false);x=s.beforeShow.call(s,y);if(x===false){return s}function w(){if(s.options.position.type!=="static"){s.focus()}s.onShow.call(s,y);if(f.browser.msie){s.elements.tooltip.get(0).style.removeAttribute("filter")}}s.cache.toggle=1;if(s.options.position.type!=="static"){s.updatePosition(y,(s.options.show.effect.length>0))}if(typeof s.options.show.solo=="object"){z=f(s.options.show.solo)}else{if(s.options.show.solo===true){z=f("div.qtip").not(s.elements.tooltip)}}if(z){z.each(function(){if(f(this).qtip("api").status.rendered===true){f(this).qtip("api").hide()}})}if(typeof s.options.show.effect.type=="function"){s.options.show.effect.type.call(s.elements.tooltip,s.options.show.effect.length);s.elements.tooltip.queue(function(){w();f(this).dequeue()})}else{switch(s.options.show.effect.type.toLowerCase()){case"fade":s.elements.tooltip.fadeIn(s.options.show.effect.length,w);break;case"slide":s.elements.tooltip.slideDown(s.options.show.effect.length,function(){w();if(s.options.position.type!=="static"){s.updatePosition(y,true)}});break;case"grow":s.elements.tooltip.show(s.options.show.effect.length,w);break;default:s.elements.tooltip.show(null,w);break}s.elements.tooltip.addClass(s.options.style.classes.active)}return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_SHOWN,"show")},hide:function(y){var x;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"hide")}else{if(s.elements.tooltip.css("display")==="none"){return s}}clearTimeout(s.timers.show);s.elements.tooltip.stop(true,false);x=s.beforeHide.call(s,y);if(x===false){return s}function w(){s.onHide.call(s,y)}s.cache.toggle=0;if(typeof s.options.hide.effect.type=="function"){s.options.hide.effect.type.call(s.elements.tooltip,s.options.hide.effect.length);s.elements.tooltip.queue(function(){w();f(this).dequeue()})}else{switch(s.options.hide.effect.type.toLowerCase()){case"fade":s.elements.tooltip.fadeOut(s.options.hide.effect.length,w);break;case"slide":s.elements.tooltip.slideUp(s.options.hide.effect.length,w);break;case"grow":s.elements.tooltip.hide(s.options.hide.effect.length,w);break;default:s.elements.tooltip.hide(null,w);break}s.elements.tooltip.removeClass(s.options.style.classes.active)}return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_HIDDEN,"hide")},updatePosition:function(w,x){var C,G,L,J,H,E,y,I,B,D,K,A,F,z;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"updatePosition")}else{if(s.options.position.type=="static"){return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.CANNOT_POSITION_STATIC,"updatePosition")}}G={position:{left:0,top:0},dimensions:{height:0,width:0},corner:s.options.position.corner.target};L={position:s.getPosition(),dimensions:s.getDimensions(),corner:s.options.position.corner.tooltip};if(s.options.position.target!=="mouse"){if(s.options.position.target.get(0).nodeName.toLowerCase()=="area"){J=s.options.position.target.attr("coords").split(",");for(C=0;C<J.length;C++){J[C]=parseInt(J[C])}H=s.options.position.target.parent("map").attr("name");E=f('img[usemap="#'+H+'"]:first').offset();G.position={left:Math.floor(E.left+J[0]),top:Math.floor(E.top+J[1])};switch(s.options.position.target.attr("shape").toLowerCase()){case"rect":G.dimensions={width:Math.ceil(Math.abs(J[2]-J[0])),height:Math.ceil(Math.abs(J[3]-J[1]))};break;case"circle":G.dimensions={width:J[2]+1,height:J[2]+1};break;case"poly":G.dimensions={width:J[0],height:J[1]};for(C=0;C<J.length;C++){if(C%2==0){if(J[C]>G.dimensions.width){G.dimensions.width=J[C]}if(J[C]<J[0]){G.position.left=Math.floor(E.left+J[C])}}else{if(J[C]>G.dimensions.height){G.dimensions.height=J[C]}if(J[C]<J[1]){G.position.top=Math.floor(E.top+J[C])}}}G.dimensions.width=G.dimensions.width-(G.position.left-E.left);G.dimensions.height=G.dimensions.height-(G.position.top-E.top);break;default:return f.fn.qtip.log.error.call(s,4,f.fn.qtip.constants.INVALID_AREA_SHAPE,"updatePosition");break}G.dimensions.width-=2;G.dimensions.height-=2}else{if(s.options.position.target.add(document.body).length===1){G.position={left:f(document).scrollLeft(),top:f(document).scrollTop()};G.dimensions={height:f(window).height(),width:f(window).width()}}else{if(typeof s.options.position.target.attr("qtip")!=="undefined"){G.position=s.options.position.target.qtip("api").cache.position}else{G.position=s.options.position.target.offset()}G.dimensions={height:s.options.position.target.outerHeight(),width:s.options.position.target.outerWidth()}}}y=f.extend({},G.position);if(G.corner.search(/right/i)!==-1){y.left+=G.dimensions.width}if(G.corner.search(/bottom/i)!==-1){y.top+=G.dimensions.height}if(G.corner.search(/((top|bottom)Middle)|center/)!==-1){y.left+=(G.dimensions.width/2)}if(G.corner.search(/((left|right)Middle)|center/)!==-1){y.top+=(G.dimensions.height/2)}}else{G.position=y={left:s.cache.mouse.x,top:s.cache.mouse.y};G.dimensions={height:1,width:1}}if(L.corner.search(/right/i)!==-1){y.left-=L.dimensions.width}if(L.corner.search(/bottom/i)!==-1){y.top-=L.dimensions.height}if(L.corner.search(/((top|bottom)Middle)|center/)!==-1){y.left-=(L.dimensions.width/2)}if(L.corner.search(/((left|right)Middle)|center/)!==-1){y.top-=(L.dimensions.height/2)}I=(f.browser.msie)?1:0;B=(f.browser.msie&&parseInt(f.browser.version.charAt(0))===6)?1:0;if(s.options.style.border.radius>0){if(L.corner.search(/Left/)!==-1){y.left-=s.options.style.border.radius}else{if(L.corner.search(/Right/)!==-1){y.left+=s.options.style.border.radius}}if(L.corner.search(/Top/)!==-1){y.top-=s.options.style.border.radius}else{if(L.corner.search(/Bottom/)!==-1){y.top+=s.options.style.border.radius}}}if(I){if(L.corner.search(/top/)!==-1){y.top-=I}else{if(L.corner.search(/bottom/)!==-1){y.top+=I}}if(L.corner.search(/left/)!==-1){y.left-=I}else{if(L.corner.search(/right/)!==-1){y.left+=I}}if(L.corner.search(/leftMiddle|rightMiddle/)!==-1){y.top-=1}}if(s.options.position.adjust.screen===true){y=o.call(s,y,G,L)}if(s.options.position.target==="mouse"&&s.options.position.adjust.mouse===true){if(s.options.position.adjust.screen===true&&s.elements.tip){K=s.elements.tip.attr("rel")}else{K=s.options.position.corner.tooltip}y.left+=(K.search(/right/i)!==-1)?-6:6;y.top+=(K.search(/bottom/i)!==-1)?-6:6}if(!s.elements.bgiframe&&f.browser.msie&&parseInt(f.browser.version.charAt(0))==6){f("select, object").each(function(){A=f(this).offset();A.bottom=A.top+f(this).height();A.right=A.left+f(this).width();if(y.top+L.dimensions.height>=A.top&&y.left+L.dimensions.width>=A.left){k.call(s)}})}y.left+=s.options.position.adjust.x;y.top+=s.options.position.adjust.y;F=s.getPosition();if(y.left!=F.left||y.top!=F.top){z=s.beforePositionUpdate.call(s,w);if(z===false){return s}s.cache.position=y;if(x===true){s.status.animated=true;s.elements.tooltip.animate(y,200,"swing",function(){s.status.animated=false})}else{s.elements.tooltip.css(y)}s.onPositionUpdate.call(s,w);if(typeof w!=="undefined"&&w.type&&w.type!=="mousemove"){f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_POSITION_UPDATED,"updatePosition")}}return s},updateWidth:function(w){var x;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"updateWidth")}else{if(w&&typeof w!=="number"){return f.fn.qtip.log.error.call(s,2,"newWidth must be of type number","updateWidth")}}x=s.elements.contentWrapper.siblings().add(s.elements.tip).add(s.elements.button);if(!w){if(typeof s.options.style.width.value=="number"){w=s.options.style.width.value}else{s.elements.tooltip.css({width:"auto"});x.hide();if(f.browser.msie){s.elements.wrapper.add(s.elements.contentWrapper.children()).css({zoom:"normal"})}w=s.getDimensions().width+1;if(!s.options.style.width.value){if(w>s.options.style.width.max){w=s.options.style.width.max}if(w<s.options.style.width.min){w=s.options.style.width.min}}}}if(w%2!==0){w-=1}s.elements.tooltip.width(w);x.show();if(s.options.style.border.radius){s.elements.tooltip.find(".qtip-betweenCorners").each(function(y){f(this).width(w-(s.options.style.border.radius*2))})}if(f.browser.msie){s.elements.wrapper.add(s.elements.contentWrapper.children()).css({zoom:"1"});s.elements.wrapper.width(w);if(s.elements.bgiframe){s.elements.bgiframe.width(w).height(s.getDimensions.height)}}return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_WIDTH_UPDATED,"updateWidth")},updateStyle:function(w){var z,A,x,y,B;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"updateStyle")}else{if(typeof w!=="string"||!f.fn.qtip.styles[w]){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.STYLE_NOT_DEFINED,"updateStyle")}}s.options.style=a.call(s,f.fn.qtip.styles[w],s.options.user.style);s.elements.content.css(q(s.options.style));if(s.options.content.title.text!==false){s.elements.title.css(q(s.options.style.title,true))}s.elements.contentWrapper.css({borderColor:s.options.style.border.color});if(s.options.style.tip.corner!==false){if(f("<canvas>").get(0).getContext){z=s.elements.tooltip.find(".qtip-tip canvas:first");x=z.get(0).getContext("2d");x.clearRect(0,0,300,300);y=z.parent("div[rel]:first").attr("rel");B=b(y,s.options.style.tip.size.width,s.options.style.tip.size.height);h.call(s,z,B,s.options.style.tip.color||s.options.style.border.color)}else{if(f.browser.msie){z=s.elements.tooltip.find('.qtip-tip [nodeName="shape"]');z.attr("fillcolor",s.options.style.tip.color||s.options.style.border.color)}}}if(s.options.style.border.radius>0){s.elements.tooltip.find(".qtip-betweenCorners").css({backgroundColor:s.options.style.border.color});if(f("<canvas>").get(0).getContext){A=g(s.options.style.border.radius);s.elements.tooltip.find(".qtip-wrapper canvas").each(function(){x=f(this).get(0).getContext("2d");x.clearRect(0,0,300,300);y=f(this).parent("div[rel]:first").attr("rel");r.call(s,f(this),A[y],s.options.style.border.radius,s.options.style.border.color)})}else{if(f.browser.msie){s.elements.tooltip.find('.qtip-wrapper [nodeName="arc"]').each(function(){f(this).attr("fillcolor",s.options.style.border.color)})}}}return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_STYLE_UPDATED,"updateStyle")},updateContent:function(A,y){var z,x,w;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"updateContent")}else{if(!A){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.NO_CONTENT_PROVIDED,"updateContent")}}z=s.beforeContentUpdate.call(s,A);if(typeof z=="string"){A=z}else{if(z===false){return}}if(f.browser.msie){s.elements.contentWrapper.children().css({zoom:"normal"})}if(A.jquery&&A.length>0){A.clone(true).appendTo(s.elements.content).show()}else{s.elements.content.html(A)}x=s.elements.content.find("img[complete=false]");if(x.length>0){w=0;x.each(function(C){f('<img src="'+f(this).attr("src")+'" />').load(function(){if(++w==x.length){B()}})})}else{B()}function B(){s.updateWidth();if(y!==false){if(s.options.position.type!=="static"){s.updatePosition(s.elements.tooltip.is(":visible"),true)}if(s.options.style.tip.corner!==false){n.call(s)}}}s.onContentUpdate.call(s);return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_CONTENT_UPDATED,"loadContent")},loadContent:function(w,z,A){var y;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"loadContent")}y=s.beforeContentLoad.call(s);if(y===false){return s}if(A=="post"){f.post(w,z,x)}else{f.get(w,z,x)}function x(B){s.onContentLoad.call(s);f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_CONTENT_LOADED,"loadContent");s.updateContent(B)}return s},updateTitle:function(w){if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"updateTitle")}else{if(!w){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.NO_CONTENT_PROVIDED,"updateTitle")}}returned=s.beforeTitleUpdate.call(s);if(returned===false){return s}if(s.elements.button){s.elements.button=s.elements.button.clone(true)}s.elements.title.html(w);if(s.elements.button){s.elements.title.prepend(s.elements.button)}s.onTitleUpdate.call(s);return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_TITLE_UPDATED,"updateTitle")},focus:function(A){var y,x,w,z;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"focus")}else{if(s.options.position.type=="static"){return f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.CANNOT_FOCUS_STATIC,"focus")}}y=parseInt(s.elements.tooltip.css("z-index"));x=6000+f("div.qtip[qtip]").length-1;if(!s.status.focused&&y!==x){z=s.beforeFocus.call(s,A);if(z===false){return s}f("div.qtip[qtip]").not(s.elements.tooltip).each(function(){if(f(this).qtip("api").status.rendered===true){w=parseInt(f(this).css("z-index"));if(typeof w=="number"&&w>-1){f(this).css({zIndex:parseInt(f(this).css("z-index"))-1})}f(this).qtip("api").status.focused=false}});s.elements.tooltip.css({zIndex:x});s.status.focused=true;s.onFocus.call(s,A);f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_FOCUSED,"focus")}return s},disable:function(w){if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"disable")}if(w){if(!s.status.disabled){s.status.disabled=true;f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_DISABLED,"disable")}else{f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.TOOLTIP_ALREADY_DISABLED,"disable")}}else{if(s.status.disabled){s.status.disabled=false;f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_ENABLED,"disable")}else{f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.TOOLTIP_ALREADY_ENABLED,"disable")}}return s},destroy:function(){var w,x,y;x=s.beforeDestroy.call(s);if(x===false){return s}if(s.status.rendered){s.options.show.when.target.unbind("mousemove.qtip",s.updatePosition);s.options.show.when.target.unbind("mouseout.qtip",s.hide);s.options.show.when.target.unbind(s.options.show.when.event+".qtip");s.options.hide.when.target.unbind(s.options.hide.when.event+".qtip");s.elements.tooltip.unbind(s.options.hide.when.event+".qtip");s.elements.tooltip.unbind("mouseover.qtip",s.focus);s.elements.tooltip.remove()}else{s.options.show.when.target.unbind(s.options.show.when.event+".qtip-create")}if(typeof s.elements.target.data("qtip")=="object"){y=s.elements.target.data("qtip").interfaces;if(typeof y=="object"&&y.length>0){for(w=0;w<y.length-1;w++){if(y[w].id==s.id){y.splice(w,1)}}}}delete f.fn.qtip.interfaces[s.id];if(typeof y=="object"&&y.length>0){s.elements.target.data("qtip").current=y.length-1}else{s.elements.target.removeData("qtip")}s.onDestroy.call(s);f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_DESTROYED,"destroy");return s.elements.target},getPosition:function(){var w,x;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"getPosition")}w=(s.elements.tooltip.css("display")!=="none")?false:true;if(w){s.elements.tooltip.css({visiblity:"hidden"}).show()}x=s.elements.tooltip.offset();if(w){s.elements.tooltip.css({visiblity:"visible"}).hide()}return x},getDimensions:function(){var w,x;if(!s.status.rendered){return f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.TOOLTIP_NOT_RENDERED,"getDimensions")}w=(!s.elements.tooltip.is(":visible"))?true:false;if(w){s.elements.tooltip.css({visiblity:"hidden"}).show()}x={height:s.elements.tooltip.outerHeight(),width:s.elements.tooltip.outerWidth()};if(w){s.elements.tooltip.css({visiblity:"visible"}).hide()}return x}})}function p(){var s,w,u,t,v,y,x;s=this;s.beforeRender.call(s);s.status.rendered=true;s.elements.tooltip='<div qtip="'+s.id+'" class="qtip '+(s.options.style.classes.tooltip||s.options.style)+'"style="display:none; -moz-border-radius:0; -webkit-border-radius:0; border-radius:0;position:'+s.options.position.type+';"> <div class="qtip-wrapper" style="position:relative; overflow:hidden; text-align:left;"> <div class="qtip-contentWrapper" style="overflow:hidden;"> <div class="qtip-content '+s.options.style.classes.content+'"></div></div></div></div>';s.elements.tooltip=f(s.elements.tooltip);s.elements.tooltip.appendTo(s.options.position.container);s.elements.tooltip.data("qtip",{current:0,interfaces:[s]});s.elements.wrapper=s.elements.tooltip.children("div:first");s.elements.contentWrapper=s.elements.wrapper.children("div:first").css({background:s.options.style.background});s.elements.content=s.elements.contentWrapper.children("div:first").css(q(s.options.style));if(f.browser.msie){s.elements.wrapper.add(s.elements.content).css({zoom:1})}if(s.options.hide.when.event=="unfocus"){s.elements.tooltip.attr("unfocus",true)}if(typeof s.options.style.width.value=="number"){s.updateWidth()}if(f("<canvas>").get(0).getContext||f.browser.msie){if(s.options.style.border.radius>0){m.call(s)}else{s.elements.contentWrapper.css({border:s.options.style.border.width+"px solid "+s.options.style.border.color})}if(s.options.style.tip.corner!==false){e.call(s)}}else{s.elements.contentWrapper.css({border:s.options.style.border.width+"px solid "+s.options.style.border.color});s.options.style.border.radius=0;s.options.style.tip.corner=false;f.fn.qtip.log.error.call(s,2,f.fn.qtip.constants.CANVAS_VML_NOT_SUPPORTED,"render")}if((typeof s.options.content.text=="string"&&s.options.content.text.length>0)||(s.options.content.text.jquery&&s.options.content.text.length>0)){u=s.options.content.text}else{if(typeof s.elements.target.attr("title")=="string"&&s.elements.target.attr("title").length>0){u=s.elements.target.attr("title").replace("\\n","<br />");s.elements.target.attr("title","")}else{if(typeof s.elements.target.attr("alt")=="string"&&s.elements.target.attr("alt").length>0){u=s.elements.target.attr("alt").replace("\\n","<br />");s.elements.target.attr("alt","")}else{u=" ";f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.NO_VALID_CONTENT,"render")}}}if(s.options.content.title.text!==false){j.call(s)}s.updateContent(u);l.call(s);if(s.options.show.ready===true){s.show()}if(s.options.content.url!==false){t=s.options.content.url;v=s.options.content.data;y=s.options.content.method||"get";s.loadContent(t,v,y)}s.onRender.call(s);f.fn.qtip.log.error.call(s,1,f.fn.qtip.constants.EVENT_RENDERED,"render")}function m(){var F,z,t,B,x,E,u,G,D,y,w,C,A,s,v;F=this;F.elements.wrapper.find(".qtip-borderBottom, .qtip-borderTop").remove();t=F.options.style.border.width;B=F.options.style.border.radius;x=F.options.style.border.color||F.options.style.tip.color;E=g(B);u={};for(z in E){u[z]='<div rel="'+z+'" style="'+((z.search(/Left/)!==-1)?"left":"right")+":0; position:absolute; height:"+B+"px; width:"+B+'px; overflow:hidden; line-height:0.1px; font-size:1px">';if(f("<canvas>").get(0).getContext){u[z]+='<canvas height="'+B+'" width="'+B+'" style="vertical-align: top"></canvas>'}else{if(f.browser.msie){G=B*2+3;u[z]+='<v:arc stroked="false" fillcolor="'+x+'" startangle="'+E[z][0]+'" endangle="'+E[z][1]+'" style="width:'+G+"px; height:"+G+"px; margin-top:"+((z.search(/bottom/)!==-1)?-2:-1)+"px; margin-left:"+((z.search(/Right/)!==-1)?E[z][2]-3.5:-1)+'px; vertical-align:top; display:inline-block; behavior:url(#default#VML)"></v:arc>'}}u[z]+="</div>"}D=F.getDimensions().width-(Math.max(t,B)*2);y='<div class="qtip-betweenCorners" style="height:'+B+"px; width:"+D+"px; overflow:hidden; background-color:"+x+'; line-height:0.1px; font-size:1px;">';w='<div class="qtip-borderTop" dir="ltr" style="height:'+B+"px; margin-left:"+B+'px; line-height:0.1px; font-size:1px; padding:0;">'+u.topLeft+u.topRight+y;F.elements.wrapper.prepend(w);C='<div class="qtip-borderBottom" dir="ltr" style="height:'+B+"px; margin-left:"+B+'px; line-height:0.1px; font-size:1px; padding:0;">'+u.bottomLeft+u.bottomRight+y;F.elements.wrapper.append(C);if(f("<canvas>").get(0).getContext){F.elements.wrapper.find("canvas").each(function(){A=E[f(this).parent("[rel]:first").attr("rel")];r.call(F,f(this),A,B,x)})}else{if(f.browser.msie){F.elements.tooltip.append('<v:image style="behavior:url(#default#VML);"></v:image>')}}s=Math.max(B,(B+(t-B)));v=Math.max(t-B,0);F.elements.contentWrapper.css({border:"0px solid "+x,borderWidth:v+"px "+s+"px"})}function r(u,w,s,t){var v=u.get(0).getContext("2d");v.fillStyle=t;v.beginPath();v.arc(w[0],w[1],s,0,Math.PI*2,false);v.fill()}function e(v){var t,s,x,u,w;t=this;if(t.elements.tip!==null){t.elements.tip.remove()}s=t.options.style.tip.color||t.options.style.border.color;if(t.options.style.tip.corner===false){return}else{if(!v){v=t.options.style.tip.corner}}x=b(v,t.options.style.tip.size.width,t.options.style.tip.size.height);t.elements.tip='<div class="'+t.options.style.classes.tip+'" dir="ltr" rel="'+v+'" style="position:absolute; height:'+t.options.style.tip.size.height+"px; width:"+t.options.style.tip.size.width+'px; margin:0 auto; line-height:0.1px; font-size:1px;">';if(f("<canvas>").get(0).getContext){t.elements.tip+='<canvas height="'+t.options.style.tip.size.height+'" width="'+t.options.style.tip.size.width+'"></canvas>'}else{if(f.browser.msie){u=t.options.style.tip.size.width+","+t.options.style.tip.size.height;w="m"+x[0][0]+","+x[0][1];w+=" l"+x[1][0]+","+x[1][1];w+=" "+x[2][0]+","+x[2][1];w+=" xe";t.elements.tip+='<v:shape fillcolor="'+s+'" stroked="false" filled="true" path="'+w+'" coordsize="'+u+'" style="width:'+t.options.style.tip.size.width+"px; height:"+t.options.style.tip.size.height+"px; line-height:0.1px; display:inline-block; behavior:url(#default#VML); vertical-align:"+((v.search(/top/)!==-1)?"bottom":"top")+'"></v:shape>';t.elements.tip+='<v:image style="behavior:url(#default#VML);"></v:image>';t.elements.contentWrapper.css("position","relative")}}t.elements.tooltip.prepend(t.elements.tip+"</div>");t.elements.tip=t.elements.tooltip.find("."+t.options.style.classes.tip).eq(0);if(f("<canvas>").get(0).getContext){h.call(t,t.elements.tip.find("canvas:first"),x,s)}if(v.search(/top/)!==-1&&f.browser.msie&&parseInt(f.browser.version.charAt(0))===6){t.elements.tip.css({marginTop:-4})}n.call(t,v)}function h(t,v,s){var u=t.get(0).getContext("2d");u.fillStyle=s;u.beginPath();u.moveTo(v[0][0],v[0][1]);u.lineTo(v[1][0],v[1][1]);u.lineTo(v[2][0],v[2][1]);u.fill()}function n(u){var t,w,s,x,v;t=this;if(t.options.style.tip.corner===false||!t.elements.tip){return}if(!u){u=t.elements.tip.attr("rel")}w=positionAdjust=(f.browser.msie)?1:0;t.elements.tip.css(u.match(/left|right|top|bottom/)[0],0);if(u.search(/top|bottom/)!==-1){if(f.browser.msie){if(parseInt(f.browser.version.charAt(0))===6){positionAdjust=(u.search(/top/)!==-1)?-3:1}else{positionAdjust=(u.search(/top/)!==-1)?1:2}}if(u.search(/Middle/)!==-1){t.elements.tip.css({left:"50%",marginLeft:-(t.options.style.tip.size.width/2)})}else{if(u.search(/Left/)!==-1){t.elements.tip.css({left:t.options.style.border.radius-w})}else{if(u.search(/Right/)!==-1){t.elements.tip.css({right:t.options.style.border.radius+w})}}}if(u.search(/top/)!==-1){t.elements.tip.css({top:-positionAdjust})}else{t.elements.tip.css({bottom:positionAdjust})}}else{if(u.search(/left|right/)!==-1){if(f.browser.msie){positionAdjust=(parseInt(f.browser.version.charAt(0))===6)?1:((u.search(/left/)!==-1)?1:2)}if(u.search(/Middle/)!==-1){t.elements.tip.css({top:"50%",marginTop:-(t.options.style.tip.size.height/2)})}else{if(u.search(/Top/)!==-1){t.elements.tip.css({top:t.options.style.border.radius-w})}else{if(u.search(/Bottom/)!==-1){t.elements.tip.css({bottom:t.options.style.border.radius+w})}}}if(u.search(/left/)!==-1){t.elements.tip.css({left:-positionAdjust})}else{t.elements.tip.css({right:positionAdjust})}}}s="padding-"+u.match(/left|right|top|bottom/)[0];x=t.options.style.tip.size[(s.search(/left|right/)!==-1)?"width":"height"];t.elements.tooltip.css("padding",0);t.elements.tooltip.css(s,x);if(f.browser.msie&&parseInt(f.browser.version.charAt(0))==6){v=parseInt(t.elements.tip.css("margin-top"))||0;v+=parseInt(t.elements.content.css("margin-top"))||0;t.elements.tip.css({marginTop:v})}}function j(){var s=this;if(s.elements.title!==null){s.elements.title.remove()}s.elements.title=f('<div class="'+s.options.style.classes.title+'">').css(q(s.options.style.title,true)).css({zoom:(f.browser.msie)?1:0}).prependTo(s.elements.contentWrapper);if(s.options.content.title.text){s.updateTitle.call(s,s.options.content.title.text)}if(s.options.content.title.button!==false&&typeof s.options.content.title.button=="string"){s.elements.button=f('<a class="'+s.options.style.classes.button+'" style="float:right; position: relative"></a>').css(q(s.options.style.button,true)).html(s.options.content.title.button).prependTo(s.elements.title).click(function(t){if(!s.status.disabled){s.hide(t)}})}}function l(){var t,v,u,s;t=this;v=t.options.show.when.target;u=t.options.hide.when.target;if(t.options.hide.fixed){u=u.add(t.elements.tooltip)}if(t.options.hide.when.event=="inactive"){s=["click","dblclick","mousedown","mouseup","mousemove","mouseout","mouseenter","mouseleave","mouseover"];function y(z){if(t.status.disabled===true){return}clearTimeout(t.timers.inactive);t.timers.inactive=setTimeout(function(){f(s).each(function(){u.unbind(this+".qtip-inactive");t.elements.content.unbind(this+".qtip-inactive")});t.hide(z)},t.options.hide.delay)}}else{if(t.options.hide.fixed===true){t.elements.tooltip.bind("mouseover.qtip",function(){if(t.status.disabled===true){return}clearTimeout(t.timers.hide)})}}function x(z){if(t.status.disabled===true){return}if(t.options.hide.when.event=="inactive"){f(s).each(function(){u.bind(this+".qtip-inactive",y);t.elements.content.bind(this+".qtip-inactive",y)});y()}clearTimeout(t.timers.show);clearTimeout(t.timers.hide);t.timers.show=setTimeout(function(){t.show(z)},t.options.show.delay)}function w(z){if(t.status.disabled===true){return}if(t.options.hide.fixed===true&&t.options.hide.when.event.search(/mouse(out|leave)/i)!==-1&&f(z.relatedTarget).parents("div.qtip[qtip]").length>0){z.stopPropagation();z.preventDefault();clearTimeout(t.timers.hide);return false}clearTimeout(t.timers.show);clearTimeout(t.timers.hide);t.elements.tooltip.stop(true,true);t.timers.hide=setTimeout(function(){t.hide(z)},t.options.hide.delay)}if((t.options.show.when.target.add(t.options.hide.when.target).length===1&&t.options.show.when.event==t.options.hide.when.event&&t.options.hide.when.event!=="inactive")||t.options.hide.when.event=="unfocus"){t.cache.toggle=0;v.bind(t.options.show.when.event+".qtip",function(z){if(t.cache.toggle==0){x(z)}else{w(z)}})}else{v.bind(t.options.show.when.event+".qtip",x);if(t.options.hide.when.event!=="inactive"){u.bind(t.options.hide.when.event+".qtip",w)}}if(t.options.position.type.search(/(fixed|absolute)/)!==-1){t.elements.tooltip.bind("mouseover.qtip",t.focus)}if(t.options.position.target==="mouse"&&t.options.position.type!=="static"){v.bind("mousemove.qtip",function(z){t.cache.mouse={x:z.pageX,y:z.pageY};if(t.status.disabled===false&&t.options.position.adjust.mouse===true&&t.options.position.type!=="static"&&t.elements.tooltip.css("display")!=="none"){t.updatePosition(z)}})}}function o(u,v,A){var z,s,x,y,t,w;z=this;if(A.corner=="center"){return v.position}s=f.extend({},u);y={x:false,y:false};t={left:(s.left<f.fn.qtip.cache.screen.scroll.left),right:(s.left+A.dimensions.width+2>=f.fn.qtip.cache.screen.width+f.fn.qtip.cache.screen.scroll.left),top:(s.top<f.fn.qtip.cache.screen.scroll.top),bottom:(s.top+A.dimensions.height+2>=f.fn.qtip.cache.screen.height+f.fn.qtip.cache.screen.scroll.top)};x={left:(t.left&&(A.corner.search(/right/i)!=-1||(A.corner.search(/right/i)==-1&&!t.right))),right:(t.right&&(A.corner.search(/left/i)!=-1||(A.corner.search(/left/i)==-1&&!t.left))),top:(t.top&&A.corner.search(/top/i)==-1),bottom:(t.bottom&&A.corner.search(/bottom/i)==-1)};if(x.left){if(z.options.position.target!=="mouse"){s.left=v.position.left+v.dimensions.width}else{s.left=z.cache.mouse.x}y.x="Left"}else{if(x.right){if(z.options.position.target!=="mouse"){s.left=v.position.left-A.dimensions.width}else{s.left=z.cache.mouse.x-A.dimensions.width}y.x="Right"}}if(x.top){if(z.options.position.target!=="mouse"){s.top=v.position.top+v.dimensions.height}else{s.top=z.cache.mouse.y}y.y="top"}else{if(x.bottom){if(z.options.position.target!=="mouse"){s.top=v.position.top-A.dimensions.height}else{s.top=z.cache.mouse.y-A.dimensions.height}y.y="bottom"}}if(s.left<0){s.left=u.left;y.x=false}if(s.top<0){s.top=u.top;y.y=false}if(z.options.style.tip.corner!==false){s.corner=new String(A.corner);if(y.x!==false){s.corner=s.corner.replace(/Left|Right|Middle/,y.x)}if(y.y!==false){s.corner=s.corner.replace(/top|bottom/,y.y)}if(s.corner!==z.elements.tip.attr("rel")){e.call(z,s.corner)}}return s}function q(u,t){var v,s;v=f.extend(true,{},u);for(s in v){if(t===true&&s.search(/(tip|classes)/i)!==-1){delete v[s]}else{if(!t&&s.search(/(width|border|tip|title|classes|user)/i)!==-1){delete v[s]}}}return v}function c(s){if(typeof s.tip!=="object"){s.tip={corner:s.tip}}if(typeof s.tip.size!=="object"){s.tip.size={width:s.tip.size,height:s.tip.size}}if(typeof s.border!=="object"){s.border={width:s.border}}if(typeof s.width!=="object"){s.width={value:s.width}}if(typeof s.width.max=="string"){s.width.max=parseInt(s.width.max.replace(/([0-9]+)/i,"$1"))}if(typeof s.width.min=="string"){s.width.min=parseInt(s.width.min.replace(/([0-9]+)/i,"$1"))}if(typeof s.tip.size.x=="number"){s.tip.size.width=s.tip.size.x;delete s.tip.size.x}if(typeof s.tip.size.y=="number"){s.tip.size.height=s.tip.size.y;delete s.tip.size.y}return s}function a(){var s,t,u,x,v,w;s=this;u=[true,{}];for(t=0;t<arguments.length;t++){u.push(arguments[t])}x=[f.extend.apply(f,u)];while(typeof x[0].name=="string"){x.unshift(c(f.fn.qtip.styles[x[0].name]))}x.unshift(true,{classes:{tooltip:"qtip-"+(arguments[0].name||"defaults")}},f.fn.qtip.styles.defaults);v=f.extend.apply(f,x);w=(f.browser.msie)?1:0;v.tip.size.width+=w;v.tip.size.height+=w;if(v.tip.size.width%2>0){v.tip.size.width+=1}if(v.tip.size.height%2>0){v.tip.size.height+=1}if(v.tip.corner===true){v.tip.corner=(s.options.position.corner.tooltip==="center")?false:s.options.position.corner.tooltip}return v}function b(v,u,t){var s={bottomRight:[[0,0],[u,t],[u,0]],bottomLeft:[[0,0],[u,0],[0,t]],topRight:[[0,t],[u,0],[u,t]],topLeft:[[0,0],[0,t],[u,t]],topMiddle:[[0,t],[u/2,0],[u,t]],bottomMiddle:[[0,0],[u,0],[u/2,t]],rightMiddle:[[0,0],[u,t/2],[0,t]],leftMiddle:[[u,0],[u,t],[0,t/2]]};s.leftTop=s.bottomRight;s.rightTop=s.bottomLeft;s.leftBottom=s.topRight;s.rightBottom=s.topLeft;return s[v]}function g(s){var t;if(f("<canvas>").get(0).getContext){t={topLeft:[s,s],topRight:[0,s],bottomLeft:[s,0],bottomRight:[0,0]}}else{if(f.browser.msie){t={topLeft:[-90,90,0],topRight:[-90,90,-s],bottomLeft:[90,270,0],bottomRight:[90,270,-s]}}}return t}function k(){var s,t,u;s=this;u=s.getDimensions();t='<iframe class="qtip-bgiframe" frameborder="0" tabindex="-1" src="javascript:false" style="display:block; position:absolute; z-index:-1; filter:alpha(opacity=\'0\'); border: 1px solid red; height:'+u.height+"px; width:"+u.width+'px" />';s.elements.bgiframe=s.elements.wrapper.prepend(t).children(".qtip-bgiframe:first")}f(document).ready(function(){f.fn.qtip.cache={screen:{scroll:{left:f(window).scrollLeft(),top:f(window).scrollTop()},width:f(window).width(),height:f(window).height()}};var s;f(window).bind("resize scroll",function(t){clearTimeout(s);s=setTimeout(function(){if(t.type==="scroll"){f.fn.qtip.cache.screen.scroll={left:f(window).scrollLeft(),top:f(window).scrollTop()}}else{f.fn.qtip.cache.screen.width=f(window).width();f.fn.qtip.cache.screen.height=f(window).height()}for(i=0;i<f.fn.qtip.interfaces.length;i++){var u=f.fn.qtip.interfaces[i];if(u.status.rendered===true&&(u.options.position.type!=="static"||u.options.position.adjust.scroll&&t.type==="scroll"||u.options.position.adjust.resize&&t.type==="resize")){u.updatePosition(t,true)}}},100)});f(document).bind("mousedown.qtip",function(t){if(f(t.target).parents("div.qtip").length===0){f(".qtip[unfocus]").each(function(){var u=f(this).qtip("api");if(f(this).is(":visible")&&!u.status.disabled&&f(t.target).add(u.elements.target).length>1){u.hide(t)}})}})});f.fn.qtip.interfaces=[];f.fn.qtip.log={error:function(){return this}};f.fn.qtip.constants={};f.fn.qtip.defaults={content:{prerender:false,text:false,url:false,data:null,title:{text:false,button:false}},position:{target:false,corner:{target:"bottomRight",tooltip:"topLeft"},adjust:{x:0,y:0,mouse:true,screen:false,scroll:true,resize:true},type:"absolute",container:false},show:{when:{target:false,event:"mouseover"},effect:{type:"fade",length:100},delay:140,solo:false,ready:false},hide:{when:{target:false,event:"mouseout"},effect:{type:"fade",length:100},delay:0,fixed:false},api:{beforeRender:function(){},onRender:function(){},beforePositionUpdate:function(){},onPositionUpdate:function(){},beforeShow:function(){},onShow:function(){},beforeHide:function(){},onHide:function(){},beforeContentUpdate:function(){},onContentUpdate:function(){},beforeContentLoad:function(){},onContentLoad:function(){},beforeTitleUpdate:function(){},onTitleUpdate:function(){},beforeDestroy:function(){},onDestroy:function(){},beforeFocus:function(){},onFocus:function(){}}};f.fn.qtip.styles={defaults:{background:"white",color:"#111",overflow:"hidden",textAlign:"left",width:{min:0,max:250},padding:"5px 9px",border:{width:1,radius:0,color:"#d3d3d3"},tip:{corner:false,color:false,size:{width:13,height:13},opacity:1},title:{background:"#e1e1e1",fontWeight:"bold",padding:"7px 12px"},button:{cursor:"pointer"},classes:{target:"",tip:"qtip-tip",title:"qtip-title",button:"qtip-button",content:"qtip-content",active:"qtip-active"}},cream:{border:{width:3,radius:0,color:"#F9E98E"},title:{background:"#F0DE7D",color:"#A27D35"},background:"#FBF7AA",color:"#A27D35",classes:{tooltip:"qtip-cream"}},light:{border:{width:3,radius:0,color:"#E2E2E2"},title:{background:"#f1f1f1",color:"#454545"},background:"white",color:"#454545",classes:{tooltip:"qtip-light"}},dark:{border:{width:3,radius:0,color:"#303030"},title:{background:"#404040",color:"#f3f3f3"},background:"#505050",color:"#f3f3f3",classes:{tooltip:"qtip-dark"}},red:{border:{width:3,radius:0,color:"#CE6F6F"},title:{background:"#f28279",color:"#9C2F2F"},background:"#F79992",color:"#9C2F2F",classes:{tooltip:"qtip-red"}},green:{border:{width:3,radius:0,color:"#A9DB66"},title:{background:"#b9db8c",color:"#58792E"},background:"#CDE6AC",color:"#58792E",classes:{tooltip:"qtip-green"}},blue:{border:{width:3,radius:0,color:"#ADD9ED"},title:{background:"#D0E9F5",color:"#5E99BD"},background:"#E5F6FE",color:"#4D9FBF",classes:{tooltip:"qtip-blue"}}}})(jQuery);
|
16 |
+
|
17 |
+
|
18 |
+
|
19 |
+
|
20 |
+
|
21 |
+
|
assets/js/sunrise.js
CHANGED
@@ -1,211 +1,211 @@
|
|
1 |
-
// Wait DOM
|
2 |
-
jQuery(document).ready(function($) {
|
3 |
-
|
4 |
-
|
5 |
-
// ########## Tabs ##########
|
6 |
-
|
7 |
-
// Nav tab click
|
8 |
-
$('#sunrise-plugin-tabs span').click(function(event) {
|
9 |
-
// Hide tips
|
10 |
-
$('.sunrise-plugin-spin, .sunrise-plugin-success-tip').hide();
|
11 |
-
// Remove active class from all tabs
|
12 |
-
$('#sunrise-plugin-tabs span').removeClass('nav-tab-active');
|
13 |
-
// Hide all panes
|
14 |
-
$('.sunrise-plugin-pane').hide();
|
15 |
-
// Add active class to current tab
|
16 |
-
$(this).addClass('nav-tab-active');
|
17 |
-
// Show current pane
|
18 |
-
$('.sunrise-plugin-pane:eq(' + $(this).index() + ')').show();
|
19 |
-
// Save tab to cookies
|
20 |
-
sunriseCreateCookie( pagenow + '_last_tab', $(this).index(), 365 );
|
21 |
-
});
|
22 |
-
|
23 |
-
// Auto-open tab by link with hash
|
24 |
-
if ( sunriseStrpos( document.location.hash, '#tab-' ) !== false )
|
25 |
-
$('#sunrise-plugin-tabs span:eq(' + document.location.hash.replace('#tab-','') + ')').trigger('click');
|
26 |
-
// Auto-open tab by cookies
|
27 |
-
else if ( sunriseReadCookie( pagenow + '_last_tab' ) != null )
|
28 |
-
$('#sunrise-plugin-tabs span:eq(' + sunriseReadCookie( pagenow + '_last_tab' ) + ')').trigger('click');
|
29 |
-
// Open first tab by default
|
30 |
-
else
|
31 |
-
$('#sunrise-plugin-tabs span:eq(0)').trigger('click');
|
32 |
-
|
33 |
-
|
34 |
-
// ########## Ajaxed form ##########
|
35 |
-
|
36 |
-
$('#sunrise-plugin-options-form').ajaxForm({
|
37 |
-
beforeSubmit: function() {
|
38 |
-
$('.sunrise-plugin-success-tip').hide();
|
39 |
-
$('.sunrise-plugin-spin').fadeIn(200);
|
40 |
-
$('.sunrise-plugin-submit').attr('disabled', true);
|
41 |
-
},
|
42 |
-
success: function() {
|
43 |
-
$('.sunrise-plugin-spin').hide();
|
44 |
-
$('.sunrise-plugin-success-tip').show();
|
45 |
-
setTimeout(function() {
|
46 |
-
$('.sunrise-plugin-success-tip').fadeOut(200);
|
47 |
-
}, 2000);
|
48 |
-
$('.sunrise-plugin-submit').attr('disabled', false);
|
49 |
-
}
|
50 |
-
});
|
51 |
-
|
52 |
-
|
53 |
-
// ########## Reset settings confirmation ##########
|
54 |
-
|
55 |
-
$('.sunrise-plugin-reset').click(function() {
|
56 |
-
if (!confirm($(this).attr('title')))
|
57 |
-
return false;
|
58 |
-
else
|
59 |
-
return true;
|
60 |
-
});
|
61 |
-
|
62 |
-
|
63 |
-
// ########## Notifications ##########
|
64 |
-
|
65 |
-
$('.sunrise-plugin-notification').css({
|
66 |
-
cursor: 'pointer'
|
67 |
-
}).on('click', function(event) {
|
68 |
-
$(this).fadeOut(100, function() {
|
69 |
-
$(this).remove();
|
70 |
-
});
|
71 |
-
});
|
72 |
-
|
73 |
-
|
74 |
-
// ########## Triggables ##########
|
75 |
-
|
76 |
-
// Select
|
77 |
-
$('tr[data-trigger-type="select"] select').each(function(i) {
|
78 |
-
|
79 |
-
var // Input data
|
80 |
-
name = $(this).attr('name'),
|
81 |
-
index = $(this).find(':selected').index();
|
82 |
-
|
83 |
-
//alert( name + ' - ' + index );
|
84 |
-
|
85 |
-
// Hide all related triggables
|
86 |
-
$('tr.sunrise-plugin-triggable[data-triggable^="' + name + '="]').hide();
|
87 |
-
|
88 |
-
// Show selected triggable
|
89 |
-
$('tr.sunrise-plugin-triggable[data-triggable="' + name + '=' + index + '"]').show();
|
90 |
-
|
91 |
-
$(this).change(function() {
|
92 |
-
|
93 |
-
index = $(this).find(':selected').index();
|
94 |
-
|
95 |
-
// Hide all related triggables
|
96 |
-
$('tr.sunrise-plugin-triggable[data-triggable^="' + name + '="]').hide();
|
97 |
-
|
98 |
-
// Show selected triggable
|
99 |
-
$('tr.sunrise-plugin-triggable[data-triggable="' + name + '=' + index + '"]').show();
|
100 |
-
});
|
101 |
-
});
|
102 |
-
|
103 |
-
// Radio
|
104 |
-
$('tr[data-trigger-type="radio"] .sunrise-plugin-radio-group').each(function(i) {
|
105 |
-
|
106 |
-
var // Input data
|
107 |
-
name = $(this).find(':checked').attr('name'),
|
108 |
-
index = $(this).find(':checked').parent('label').parent('div').index();
|
109 |
-
|
110 |
-
// Hide all related triggables
|
111 |
-
$('tr.sunrise-plugin-triggable[data-triggable^="' + name + '="]').hide();
|
112 |
-
|
113 |
-
// Show selected triggable
|
114 |
-
$('tr.sunrise-plugin-triggable[data-triggable="' + name + '=' + index + '"]').show();
|
115 |
-
|
116 |
-
$(this).find('input:radio').each(function(i2) {
|
117 |
-
|
118 |
-
$(this).change(function() {
|
119 |
-
|
120 |
-
alert();
|
121 |
-
|
122 |
-
// Hide all related triggables
|
123 |
-
$('tr.sunrise-plugin-triggable[data-triggable^="' + name + '="]').hide();
|
124 |
-
|
125 |
-
// Show selected triggable
|
126 |
-
$('tr.sunrise-plugin-triggable[data-triggable="' + name + '=' + i2 + '"]').show();
|
127 |
-
});
|
128 |
-
});
|
129 |
-
});
|
130 |
-
|
131 |
-
|
132 |
-
// ########## Clickouts ##########
|
133 |
-
|
134 |
-
$(document).on('click', function(event) {
|
135 |
-
if ( $('.sunrise-plugin-prevent-clickout:hover').length == 0 )
|
136 |
-
$('.sunrise-plugin-clickout').hide();
|
137 |
-
});
|
138 |
-
|
139 |
-
|
140 |
-
// ########## Upload buttons ##########
|
141 |
-
|
142 |
-
$('.sunrise-plugin-upload-button').click(function(event) {
|
143 |
-
|
144 |
-
// Define upload field
|
145 |
-
window.sunrise_current_upload = $(this).attr('rel');
|
146 |
-
|
147 |
-
// Show thickbox with uploader
|
148 |
-
tb_show('', 'media-upload.php?type=image&TB_iframe=true');
|
149 |
-
|
150 |
-
// Prevent click
|
151 |
-
event.preventDefault();
|
152 |
-
});
|
153 |
-
|
154 |
-
window.send_to_editor = function(html) {
|
155 |
-
|
156 |
-
var url;
|
157 |
-
|
158 |
-
if ( jQuery(html).filter('img:first').length > 0 )
|
159 |
-
url = jQuery(html).filter('img:first').attr('src');
|
160 |
-
else
|
161 |
-
url = jQuery(html).filter('a:first').attr('href');
|
162 |
-
|
163 |
-
// Update upload textfield value
|
164 |
-
$('#sunrise-plugin-field-' + window.sunrise_current_upload).val(url);
|
165 |
-
|
166 |
-
// Hide thickbox
|
167 |
-
tb_remove();
|
168 |
-
}
|
169 |
-
|
170 |
-
|
171 |
-
// ########## Color picker ##########
|
172 |
-
|
173 |
-
$('.sunrise-plugin-color-picker-preview').each(function(index) {
|
174 |
-
$(this).farbtastic('.sunrise-plugin-color-picker-value:eq(' + index + ')');
|
175 |
-
$('.sunrise-plugin-color-picker-value:eq(' + index + ')').focus(function(event) {
|
176 |
-
$('.sunrise-plugin-color-picker-preview').hide();
|
177 |
-
$('.sunrise-plugin-color-picker-preview:eq(' + index + ')').show();
|
178 |
-
});
|
179 |
-
});
|
180 |
-
|
181 |
-
});
|
182 |
-
|
183 |
-
|
184 |
-
// ########## Cookie utilities ##########
|
185 |
-
|
186 |
-
function sunriseCreateCookie(name,value,days){
|
187 |
-
if(days){
|
188 |
-
var date=new Date();
|
189 |
-
date.setTime(date.getTime()+(days*24*60*60*1000));
|
190 |
-
var expires="; expires="+date.toGMTString()
|
191 |
-
}else var expires="";
|
192 |
-
document.cookie=name+"="+value+expires+"; path=/"
|
193 |
-
}
|
194 |
-
function sunriseReadCookie(name){
|
195 |
-
var nameEQ=name+"=";
|
196 |
-
var ca=document.cookie.split(';');
|
197 |
-
for(var i=0;i<ca.length;i++){
|
198 |
-
var c=ca[i];
|
199 |
-
while(c.charAt(0)==' ')c=c.substring(1,c.length);
|
200 |
-
if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length)
|
201 |
-
}
|
202 |
-
return null
|
203 |
-
}
|
204 |
-
|
205 |
-
|
206 |
-
// ########## Strpos tool ##########
|
207 |
-
|
208 |
-
function sunriseStrpos( haystack, needle, offset) {
|
209 |
-
var i = haystack.indexOf( needle, offset );
|
210 |
-
return i >= 0 ? i : false;
|
211 |
}
|
1 |
+
// Wait DOM
|
2 |
+
jQuery(document).ready(function($) {
|
3 |
+
|
4 |
+
|
5 |
+
// ########## Tabs ##########
|
6 |
+
|
7 |
+
// Nav tab click
|
8 |
+
$('#sunrise-plugin-tabs span').click(function(event) {
|
9 |
+
// Hide tips
|
10 |
+
$('.sunrise-plugin-spin, .sunrise-plugin-success-tip').hide();
|
11 |
+
// Remove active class from all tabs
|
12 |
+
$('#sunrise-plugin-tabs span').removeClass('nav-tab-active');
|
13 |
+
// Hide all panes
|
14 |
+
$('.sunrise-plugin-pane').hide();
|
15 |
+
// Add active class to current tab
|
16 |
+
$(this).addClass('nav-tab-active');
|
17 |
+
// Show current pane
|
18 |
+
$('.sunrise-plugin-pane:eq(' + $(this).index() + ')').show();
|
19 |
+
// Save tab to cookies
|
20 |
+
sunriseCreateCookie( pagenow + '_last_tab', $(this).index(), 365 );
|
21 |
+
});
|
22 |
+
|
23 |
+
// Auto-open tab by link with hash
|
24 |
+
if ( sunriseStrpos( document.location.hash, '#tab-' ) !== false )
|
25 |
+
$('#sunrise-plugin-tabs span:eq(' + document.location.hash.replace('#tab-','') + ')').trigger('click');
|
26 |
+
// Auto-open tab by cookies
|
27 |
+
else if ( sunriseReadCookie( pagenow + '_last_tab' ) != null )
|
28 |
+
$('#sunrise-plugin-tabs span:eq(' + sunriseReadCookie( pagenow + '_last_tab' ) + ')').trigger('click');
|
29 |
+
// Open first tab by default
|
30 |
+
else
|
31 |
+
$('#sunrise-plugin-tabs span:eq(0)').trigger('click');
|
32 |
+
|
33 |
+
|
34 |
+
// ########## Ajaxed form ##########
|
35 |
+
|
36 |
+
$('#sunrise-plugin-options-form').ajaxForm({
|
37 |
+
beforeSubmit: function() {
|
38 |
+
$('.sunrise-plugin-success-tip').hide();
|
39 |
+
$('.sunrise-plugin-spin').fadeIn(200);
|
40 |
+
$('.sunrise-plugin-submit').attr('disabled', true);
|
41 |
+
},
|
42 |
+
success: function() {
|
43 |
+
$('.sunrise-plugin-spin').hide();
|
44 |
+
$('.sunrise-plugin-success-tip').show();
|
45 |
+
setTimeout(function() {
|
46 |
+
$('.sunrise-plugin-success-tip').fadeOut(200);
|
47 |
+
}, 2000);
|
48 |
+
$('.sunrise-plugin-submit').attr('disabled', false);
|
49 |
+
}
|
50 |
+
});
|
51 |
+
|
52 |
+
|
53 |
+
// ########## Reset settings confirmation ##########
|
54 |
+
|
55 |
+
$('.sunrise-plugin-reset').click(function() {
|
56 |
+
if (!confirm($(this).attr('title')))
|
57 |
+
return false;
|
58 |
+
else
|
59 |
+
return true;
|
60 |
+
});
|
61 |
+
|
62 |
+
|
63 |
+
// ########## Notifications ##########
|
64 |
+
|
65 |
+
$('.sunrise-plugin-notification').css({
|
66 |
+
cursor: 'pointer'
|
67 |
+
}).on('click', function(event) {
|
68 |
+
$(this).fadeOut(100, function() {
|
69 |
+
$(this).remove();
|
70 |
+
});
|
71 |
+
});
|
72 |
+
|
73 |
+
|
74 |
+
// ########## Triggables ##########
|
75 |
+
|
76 |
+
// Select
|
77 |
+
$('tr[data-trigger-type="select"] select').each(function(i) {
|
78 |
+
|
79 |
+
var // Input data
|
80 |
+
name = $(this).attr('name'),
|
81 |
+
index = $(this).find(':selected').index();
|
82 |
+
|
83 |
+
//alert( name + ' - ' + index );
|
84 |
+
|
85 |
+
// Hide all related triggables
|
86 |
+
$('tr.sunrise-plugin-triggable[data-triggable^="' + name + '="]').hide();
|
87 |
+
|
88 |
+
// Show selected triggable
|
89 |
+
$('tr.sunrise-plugin-triggable[data-triggable="' + name + '=' + index + '"]').show();
|
90 |
+
|
91 |
+
$(this).change(function() {
|
92 |
+
|
93 |
+
index = $(this).find(':selected').index();
|
94 |
+
|
95 |
+
// Hide all related triggables
|
96 |
+
$('tr.sunrise-plugin-triggable[data-triggable^="' + name + '="]').hide();
|
97 |
+
|
98 |
+
// Show selected triggable
|
99 |
+
$('tr.sunrise-plugin-triggable[data-triggable="' + name + '=' + index + '"]').show();
|
100 |
+
});
|
101 |
+
});
|
102 |
+
|
103 |
+
// Radio
|
104 |
+
$('tr[data-trigger-type="radio"] .sunrise-plugin-radio-group').each(function(i) {
|
105 |
+
|
106 |
+
var // Input data
|
107 |
+
name = $(this).find(':checked').attr('name'),
|
108 |
+
index = $(this).find(':checked').parent('label').parent('div').index();
|
109 |
+
|
110 |
+
// Hide all related triggables
|
111 |
+
$('tr.sunrise-plugin-triggable[data-triggable^="' + name + '="]').hide();
|
112 |
+
|
113 |
+
// Show selected triggable
|
114 |
+
$('tr.sunrise-plugin-triggable[data-triggable="' + name + '=' + index + '"]').show();
|
115 |
+
|
116 |
+
$(this).find('input:radio').each(function(i2) {
|
117 |
+
|
118 |
+
$(this).change(function() {
|
119 |
+
|
120 |
+
alert();
|
121 |
+
|
122 |
+
// Hide all related triggables
|
123 |
+
$('tr.sunrise-plugin-triggable[data-triggable^="' + name + '="]').hide();
|
124 |
+
|
125 |
+
// Show selected triggable
|
126 |
+
$('tr.sunrise-plugin-triggable[data-triggable="' + name + '=' + i2 + '"]').show();
|
127 |
+
});
|
128 |
+
});
|
129 |
+
});
|
130 |
+
|
131 |
+
|
132 |
+
// ########## Clickouts ##########
|
133 |
+
|
134 |
+
$(document).on('click', function(event) {
|
135 |
+
if ( $('.sunrise-plugin-prevent-clickout:hover').length == 0 )
|
136 |
+
$('.sunrise-plugin-clickout').hide();
|
137 |
+
});
|
138 |
+
|
139 |
+
|
140 |
+
// ########## Upload buttons ##########
|
141 |
+
|
142 |
+
$('.sunrise-plugin-upload-button').click(function(event) {
|
143 |
+
|
144 |
+
// Define upload field
|
145 |
+
window.sunrise_current_upload = $(this).attr('rel');
|
146 |
+
|
147 |
+
// Show thickbox with uploader
|
148 |
+
tb_show('', 'media-upload.php?type=image&TB_iframe=true');
|
149 |
+
|
150 |
+
// Prevent click
|
151 |
+
event.preventDefault();
|
152 |
+
});
|
153 |
+
|
154 |
+
window.send_to_editor = function(html) {
|
155 |
+
|
156 |
+
var url;
|
157 |
+
|
158 |
+
if ( jQuery(html).filter('img:first').length > 0 )
|
159 |
+
url = jQuery(html).filter('img:first').attr('src');
|
160 |
+
else
|
161 |
+
url = jQuery(html).filter('a:first').attr('href');
|
162 |
+
|
163 |
+
// Update upload textfield value
|
164 |
+
$('#sunrise-plugin-field-' + window.sunrise_current_upload).val(url);
|
165 |
+
|
166 |
+
// Hide thickbox
|
167 |
+
tb_remove();
|
168 |
+
}
|
169 |
+
|
170 |
+
|
171 |
+
// ########## Color picker ##########
|
172 |
+
|
173 |
+
$('.sunrise-plugin-color-picker-preview').each(function(index) {
|
174 |
+
$(this).farbtastic('.sunrise-plugin-color-picker-value:eq(' + index + ')');
|
175 |
+
$('.sunrise-plugin-color-picker-value:eq(' + index + ')').focus(function(event) {
|
176 |
+
$('.sunrise-plugin-color-picker-preview').hide();
|
177 |
+
$('.sunrise-plugin-color-picker-preview:eq(' + index + ')').show();
|
178 |
+
});
|
179 |
+
});
|
180 |
+
|
181 |
+
});
|
182 |
+
|
183 |
+
|
184 |
+
// ########## Cookie utilities ##########
|
185 |
+
|
186 |
+
function sunriseCreateCookie(name,value,days){
|
187 |
+
if(days){
|
188 |
+
var date=new Date();
|
189 |
+
date.setTime(date.getTime()+(days*24*60*60*1000));
|
190 |
+
var expires="; expires="+date.toGMTString()
|
191 |
+
}else var expires="";
|
192 |
+
document.cookie=name+"="+value+expires+"; path=/"
|
193 |
+
}
|
194 |
+
function sunriseReadCookie(name){
|
195 |
+
var nameEQ=name+"=";
|
196 |
+
var ca=document.cookie.split(';');
|
197 |
+
for(var i=0;i<ca.length;i++){
|
198 |
+
var c=ca[i];
|
199 |
+
while(c.charAt(0)==' ')c=c.substring(1,c.length);
|
200 |
+
if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length)
|
201 |
+
}
|
202 |
+
return null
|
203 |
+
}
|
204 |
+
|
205 |
+
|
206 |
+
// ########## Strpos tool ##########
|
207 |
+
|
208 |
+
function sunriseStrpos( haystack, needle, offset) {
|
209 |
+
var i = haystack.indexOf( needle, offset );
|
210 |
+
return i >= 0 ? i : false;
|
211 |
}
|
assets/js/swiper.js
CHANGED
@@ -1,2306 +1,2306 @@
|
|
1 |
-
/*
|
2 |
-
* Swiper 2.0 - Mobile Touch Slider
|
3 |
-
* http://www.idangero.us/sliders/swiper/
|
4 |
-
*
|
5 |
-
* Copyright 2012-2013, Vladimir Kharlampidi
|
6 |
-
* The iDangero.us
|
7 |
-
* http://www.idangero.us/
|
8 |
-
*
|
9 |
-
* Licensed under GPL & MIT
|
10 |
-
*
|
11 |
-
* Updated on: June 9, 2013
|
12 |
-
*/
|
13 |
-
var Swiper = function (selector, params) {
|
14 |
-
/*=========================
|
15 |
-
A little bit dirty but required part for IE8 and old FF support
|
16 |
-
===========================*/
|
17 |
-
if (document.body.__defineGetter__) {
|
18 |
-
if (HTMLElement) {
|
19 |
-
var element = HTMLElement.prototype;
|
20 |
-
if (element.__defineGetter__) {
|
21 |
-
element.__defineGetter__("outerHTML", function () {
|
22 |
-
return new XMLSerializer().serializeToString(this);
|
23 |
-
});
|
24 |
-
}
|
25 |
-
}
|
26 |
-
}
|
27 |
-
|
28 |
-
if (!window.getComputedStyle) {
|
29 |
-
window.getComputedStyle = function (el, pseudo) {
|
30 |
-
this.el = el;
|
31 |
-
this.getPropertyValue = function (prop) {
|
32 |
-
var re = /(\-([a-z]){1})/g;
|
33 |
-
if (prop === 'float') prop = 'styleFloat';
|
34 |
-
if (re.test(prop)) {
|
35 |
-
prop = prop.replace(re, function () {
|
36 |
-
return arguments[2].toUpperCase();
|
37 |
-
});
|
38 |
-
}
|
39 |
-
return el.currentStyle[prop] ? el.currentStyle[prop] : null;
|
40 |
-
}
|
41 |
-
return this;
|
42 |
-
}
|
43 |
-
}
|
44 |
-
if (!Array.prototype.indexOf) {
|
45 |
-
Array.prototype.indexOf = function (obj, start) {
|
46 |
-
for (var i = (start || 0), j = this.length; i < j; i++) {
|
47 |
-
if (this[i] === obj) {
|
48 |
-
return i;
|
49 |
-
}
|
50 |
-
}
|
51 |
-
return -1;
|
52 |
-
}
|
53 |
-
}
|
54 |
-
if (!document.querySelectorAll) {
|
55 |
-
if (!window.jQuery) return;
|
56 |
-
}
|
57 |
-
|
58 |
-
function $$(s) {
|
59 |
-
if (document.querySelectorAll) return document.querySelectorAll(s);
|
60 |
-
else return jQuery(s);
|
61 |
-
}
|
62 |
-
|
63 |
-
/*=========================
|
64 |
-
Check for correct selector
|
65 |
-
===========================*/
|
66 |
-
if (typeof selector === 'undefined') return;
|
67 |
-
|
68 |
-
if (!(selector.nodeType)) {
|
69 |
-
if ($$(selector).length === 0) return;
|
70 |
-
}
|
71 |
-
|
72 |
-
/*=========================
|
73 |
-
_this
|
74 |
-
===========================*/
|
75 |
-
var _this = this;
|
76 |
-
|
77 |
-
/*=========================
|
78 |
-
Default Flags and vars
|
79 |
-
===========================*/
|
80 |
-
_this.touches = {
|
81 |
-
start: 0,
|
82 |
-
startX: 0,
|
83 |
-
startY: 0,
|
84 |
-
current: 0,
|
85 |
-
currentX: 0,
|
86 |
-
currentY: 0,
|
87 |
-
diff: 0,
|
88 |
-
abs: 0
|
89 |
-
};
|
90 |
-
_this.positions = {
|
91 |
-
start: 0,
|
92 |
-
abs: 0,
|
93 |
-
diff: 0,
|
94 |
-
current: 0
|
95 |
-
};
|
96 |
-
_this.times = {
|
97 |
-
start: 0,
|
98 |
-
end: 0
|
99 |
-
};
|
100 |
-
|
101 |
-
_this.id = (new Date()).getTime();
|
102 |
-
_this.container = (selector.nodeType) ? selector : $$(selector)[0];
|
103 |
-
_this.isTouched = false;
|
104 |
-
_this.isMoved = false;
|
105 |
-
_this.activeIndex = 0;
|
106 |
-
_this.activeLoaderIndex = 0;
|
107 |
-
_this.activeLoopIndex = 0;
|
108 |
-
_this.previousIndex = null;
|
109 |
-
_this.velocity = 0;
|
110 |
-
_this.snapGrid = [];
|
111 |
-
_this.slidesGrid = [];
|
112 |
-
_this.imagesToLoad = [];
|
113 |
-
_this.imagesLoaded = 0;
|
114 |
-
_this.wrapperLeft = 0;
|
115 |
-
_this.wrapperRight = 0;
|
116 |
-
_this.wrapperTop = 0;
|
117 |
-
_this.wrapperBottom = 0;
|
118 |
-
var wrapper, slideSize, wrapperSize, direction, isScrolling, containerSize;
|
119 |
-
|
120 |
-
/*=========================
|
121 |
-
Default Parameters
|
122 |
-
===========================*/
|
123 |
-
var defaults = {
|
124 |
-
mode: 'horizontal',
|
125 |
-
// or 'vertical'
|
126 |
-
touchRatio: 1,
|
127 |
-
speed: 300,
|
128 |
-
freeMode: false,
|
129 |
-
freeModeFluid: false,
|
130 |
-
momentumRatio: 1,
|
131 |
-
momentumBounce: true,
|
132 |
-
momentumBounceRatio: 1,
|
133 |
-
slidesPerView: 1,
|
134 |
-
slidesPerGroup: 1,
|
135 |
-
simulateTouch: true,
|
136 |
-
followFinger: true,
|
137 |
-
shortSwipes: true,
|
138 |
-
moveStartThreshold: false,
|
139 |
-
autoplay: false,
|
140 |
-
onlyExternal: false,
|
141 |
-
createPagination: true,
|
142 |
-
pagination: false,
|
143 |
-
paginationElement: 'span',
|
144 |
-
paginationClickable: false,
|
145 |
-
paginationAsRange: true,
|
146 |
-
resistance: true,
|
147 |
-
// or false or 100%
|
148 |
-
scrollContainer: false,
|
149 |
-
preventLinks: true,
|
150 |
-
noSwiping: false,
|
151 |
-
// or class
|
152 |
-
noSwipingClass: 'swiper-no-swiping',
|
153 |
-
//:)
|
154 |
-
initialSlide: 0,
|
155 |
-
keyboardControl: false,
|
156 |
-
mousewheelControl: false,
|
157 |
-
useCSS3Transforms: true,
|
158 |
-
//Loop mode
|
159 |
-
loop: false,
|
160 |
-
loopAdditionalSlides: 0,
|
161 |
-
//Auto Height
|
162 |
-
calculateHeight: false,
|
163 |
-
//Images Preloader
|
164 |
-
updateOnImagesReady: true,
|
165 |
-
//Form elements
|
166 |
-
releaseFormElements: true,
|
167 |
-
//Watch for active slide, useful when use effects on different slide states
|
168 |
-
watchActiveIndex: false,
|
169 |
-
//Slides Visibility Fit
|
170 |
-
visibilityFullFit: false,
|
171 |
-
//Slides Offset
|
172 |
-
offsetPxBefore: 0,
|
173 |
-
offsetPxAfter: 0,
|
174 |
-
offsetSlidesBefore: 0,
|
175 |
-
offsetSlidesAfter: 0,
|
176 |
-
centeredSlides: false,
|
177 |
-
//Queue callbacks
|
178 |
-
queueStartCallbacks: false,
|
179 |
-
queueEndCallbacks: false,
|
180 |
-
//Auto Resize
|
181 |
-
autoResize: true,
|
182 |
-
resizeReInit: false,
|
183 |
-
//DOMAnimation
|
184 |
-
DOMAnimation: true,
|
185 |
-
//Slides Loader
|
186 |
-
loader: {
|
187 |
-
slides: [],
|
188 |
-
//array with slides
|
189 |
-
slidesHTMLType: 'inner',
|
190 |
-
// or 'outer'
|
191 |
-
surroundGroups: 1,
|
192 |
-
//keep preloaded slides groups around view
|
193 |
-
logic: 'reload',
|
194 |
-
//or 'change'
|
195 |
-
loadAllSlides: false
|
196 |
-
},
|
197 |
-
//Namespace
|
198 |
-
slideElement: 'div',
|
199 |
-
slideClass: 'swiper-slide',
|
200 |
-
slideActiveClass: 'swiper-slide-active',
|
201 |
-
slideVisibleClass: 'swiper-slide-visible',
|
202 |
-
wrapperClass: 'swiper-wrapper',
|
203 |
-
paginationElementClass: 'swiper-pagination-switch',
|
204 |
-
paginationActiveClass: 'swiper-active-switch',
|
205 |
-
paginationVisibleClass: 'swiper-visible-switch'
|
206 |
-
}
|
207 |
-
params = params || {};
|
208 |
-
for (var prop in defaults) {
|
209 |
-
if (prop in params && typeof params[prop] === 'object') {
|
210 |
-
for (var subProp in defaults[prop]) {
|
211 |
-
if (!(subProp in params[prop])) {
|
212 |
-
params[prop][subProp] = defaults[prop][subProp];
|
213 |
-
}
|
214 |
-
}
|
215 |
-
} else if (!(prop in params)) {
|
216 |
-
params[prop] = defaults[prop]
|
217 |
-
}
|
218 |
-
}
|
219 |
-
_this.params = params;
|
220 |
-
if (params.scrollContainer) {
|
221 |
-
params.freeMode = true;
|
222 |
-
params.freeModeFluid = true;
|
223 |
-
}
|
224 |
-
if (params.loop) {
|
225 |
-
params.resistance = '100%';
|
226 |
-
}
|
227 |
-
var isH = params.mode === 'horizontal';
|
228 |
-
|
229 |
-
/*=========================
|
230 |
-
Define Touch Events
|
231 |
-
===========================*/
|
232 |
-
|
233 |
-
_this.touchEvents = {
|
234 |
-
touchStart: _this.support.touch || !params.simulateTouch ? 'touchstart' : (_this.browser.ie10 ? 'MSPointerDown' : 'mousedown'),
|
235 |
-
touchMove: _this.support.touch || !params.simulateTouch ? 'touchmove' : (_this.browser.ie10 ? 'MSPointerMove' : 'mousemove'),
|
236 |
-
touchEnd: _this.support.touch || !params.simulateTouch ? 'touchend' : (_this.browser.ie10 ? 'MSPointerUp' : 'mouseup')
|
237 |
-
};
|
238 |
-
|
239 |
-
/*=========================
|
240 |
-
Wrapper
|
241 |
-
===========================*/
|
242 |
-
for (var i = _this.container.childNodes.length - 1; i >= 0; i--) {
|
243 |
-
if (_this.container.childNodes[i].className) {
|
244 |
-
var _wrapperClasses = _this.container.childNodes[i].className.split(' ')
|
245 |
-
for (var j = 0; j < _wrapperClasses.length; j++) {
|
246 |
-
if (_wrapperClasses[j] === params.wrapperClass) {
|
247 |
-
wrapper = _this.container.childNodes[i];
|
248 |
-
}
|
249 |
-
};
|
250 |
-
}
|
251 |
-
};
|
252 |
-
|
253 |
-
_this.wrapper = wrapper;
|
254 |
-
/*=========================
|
255 |
-
Slide API
|
256 |
-
===========================*/
|
257 |
-
_this._extendSwiperSlide = function (el) {
|
258 |
-
el.append = function () {
|
259 |
-
if (params.loop) {
|
260 |
-
el.insertAfter(_this.slides.length - _this.loopedSlides);
|
261 |
-
_this.removeLoopedSlides();
|
262 |
-
_this.calcSlides();
|
263 |
-
_this.createLoop();
|
264 |
-
} else {
|
265 |
-
_this.wrapper.appendChild(el);
|
266 |
-
}
|
267 |
-
|
268 |
-
_this.reInit();
|
269 |
-
return el;
|
270 |
-
}
|
271 |
-
el.prepend = function () {
|
272 |
-
if (params.loop) {
|
273 |
-
_this.wrapper.insertBefore(el, _this.slides[_this.loopedSlides]);
|
274 |
-
_this.removeLoopedSlides();
|
275 |
-
_this.calcSlides();
|
276 |
-
_this.createLoop();
|
277 |
-
} else {
|
278 |
-
_this.wrapper.insertBefore(el, _this.wrapper.firstChild);
|
279 |
-
}
|
280 |
-
_this.reInit();
|
281 |
-
return el;
|
282 |
-
}
|
283 |
-
el.insertAfter = function (index) {
|
284 |
-
if (typeof index === 'undefined') return false;
|
285 |
-
var beforeSlide;
|
286 |
-
|
287 |
-
if (params.loop) {
|
288 |
-
beforeSlide = _this.slides[index + 1 + _this.loopedSlides];
|
289 |
-
_this.wrapper.insertBefore(el, beforeSlide);
|
290 |
-
_this.removeLoopedSlides();
|
291 |
-
_this.calcSlides();
|
292 |
-
_this.createLoop();
|
293 |
-
} else {
|
294 |
-
beforeSlide = _this.slides[index + 1];
|
295 |
-
_this.wrapper.insertBefore(el, beforeSlide)
|
296 |
-
}
|
297 |
-
_this.reInit();
|
298 |
-
return el;
|
299 |
-
}
|
300 |
-
el.clone = function () {
|
301 |
-
return _this._extendSwiperSlide(el.cloneNode(true))
|
302 |
-
}
|
303 |
-
el.remove = function () {
|
304 |
-
_this.wrapper.removeChild(el);
|
305 |
-
_this.reInit();
|
306 |
-
}
|
307 |
-
el.html = function (html) {
|
308 |
-
if (typeof html === 'undefined') {
|
309 |
-
return el.innerHTML;
|
310 |
-
} else {
|
311 |
-
el.innerHTML = html;
|
312 |
-
return el;
|
313 |
-
}
|
314 |
-
}
|
315 |
-
el.index = function () {
|
316 |
-
var index;
|
317 |
-
for (var i = _this.slides.length - 1; i >= 0; i--) {
|
318 |
-
if (el === _this.slides[i]) index = i;
|
319 |
-
}
|
320 |
-
return index;
|
321 |
-
}
|
322 |
-
el.isActive = function () {
|
323 |
-
if (el.index() === _this.activeIndex) return true;
|
324 |
-
else return false;
|
325 |
-
}
|
326 |
-
if (!el.swiperSlideDataStorage) el.swiperSlideDataStorage = {};
|
327 |
-
el.getData = function (name) {
|
328 |
-
return el.swiperSlideDataStorage[name];
|
329 |
-
}
|
330 |
-
el.setData = function (name, value) {
|
331 |
-
el.swiperSlideDataStorage[name] = value;
|
332 |
-
return el;
|
333 |
-
}
|
334 |
-
el.data = function (name, value) {
|
335 |
-
if (!value) {
|
336 |
-
return el.getAttribute('data-' + name);
|
337 |
-
} else {
|
338 |
-
el.setAttribute('data-' + name, value);
|
339 |
-
return el;
|
340 |
-
}
|
341 |
-
}
|
342 |
-
el.getWidth = function (outer) {
|
343 |
-
return _this.h.getWidth(el, outer);
|
344 |
-
}
|
345 |
-
el.getHeight = function (outer) {
|
346 |
-
return _this.h.getHeight(el, outer);
|
347 |
-
}
|
348 |
-
el.getOffset = function () {
|
349 |
-
return _this.h.getOffset(el);
|
350 |
-
}
|
351 |
-
return el;
|
352 |
-
}
|
353 |
-
|
354 |
-
//Calculate information about number of slides
|
355 |
-
_this.calcSlides = function (forceCalcSlides) {
|
356 |
-
var oldNumber = _this.slides ? _this.slides.length : false;
|
357 |
-
_this.slides = [];
|
358 |
-
_this.displaySlides = [];
|
359 |
-
for (var i = 0; i < _this.wrapper.childNodes.length; i++) {
|
360 |
-
if (_this.wrapper.childNodes[i].className) {
|
361 |
-
var _className = _this.wrapper.childNodes[i].className;
|
362 |
-
var _slideClasses = _className.split(' ');
|
363 |
-
for (var j = 0; j < _slideClasses.length; j++) {
|
364 |
-
if (_slideClasses[j] === params.slideClass) {
|
365 |
-
_this.slides.push(_this.wrapper.childNodes[i]);
|
366 |
-
}
|
367 |
-
}
|
368 |
-
}
|
369 |
-
}
|
370 |
-
for (i = _this.slides.length - 1; i >= 0; i--) {
|
371 |
-
_this._extendSwiperSlide(_this.slides[i]);
|
372 |
-
}
|
373 |
-
if (!oldNumber) return;
|
374 |
-
if (oldNumber !== _this.slides.length || forceCalcSlides) {
|
375 |
-
// Number of slides has been changed
|
376 |
-
removeSlideEvents();
|
377 |
-
addSlideEvents();
|
378 |
-
_this.updateActiveSlide();
|
379 |
-
if (params.createPagination && _this.params.pagination) _this.createPagination();
|
380 |
-
_this.callPlugins('numberOfSlidesChanged');
|
381 |
-
}
|
382 |
-
}
|
383 |
-
|
384 |
-
//Create Slide
|
385 |
-
_this.createSlide = function (html, slideClassList, el) {
|
386 |
-
var slideClassList = slideClassList || _this.params.slideClass;
|
387 |
-
var el = el || params.slideElement;
|
388 |
-
var newSlide = document.createElement(el);
|
389 |
-
newSlide.innerHTML = html || '';
|
390 |
-
newSlide.className = slideClassList;
|
391 |
-
return _this._extendSwiperSlide(newSlide);
|
392 |
-
}
|
393 |
-
|
394 |
-
//Append Slide
|
395 |
-
_this.appendSlide = function (html, slideClassList, el) {
|
396 |
-
if (!html) return;
|
397 |
-
if (html.nodeType) {
|
398 |
-
return _this._extendSwiperSlide(html).append()
|
399 |
-
} else {
|
400 |
-
return _this.createSlide(html, slideClassList, el).append()
|
401 |
-
}
|
402 |
-
}
|
403 |
-
_this.prependSlide = function (html, slideClassList, el) {
|
404 |
-
if (!html) return;
|
405 |
-
if (html.nodeType) {
|
406 |
-
return _this._extendSwiperSlide(html).prepend()
|
407 |
-
} else {
|
408 |
-
return _this.createSlide(html, slideClassList, el).prepend()
|
409 |
-
}
|
410 |
-
}
|
411 |
-
_this.insertSlideAfter = function (index, html, slideClassList, el) {
|
412 |
-
if (typeof index === 'undefined') return false;
|
413 |
-
if (html.nodeType) {
|
414 |
-
return _this._extendSwiperSlide(html).insertAfter(index);
|
415 |
-
} else {
|
416 |
-
return _this.createSlide(html, slideClassList, el).insertAfter(index);
|
417 |
-
}
|
418 |
-
}
|
419 |
-
_this.removeSlide = function (index) {
|
420 |
-
if (_this.slides[index]) {
|
421 |
-
if (params.loop) {
|
422 |
-
if (!_this.slides[index + _this.loopedSlides]) return false;
|
423 |
-
_this.slides[index + _this.loopedSlides].remove();
|
424 |
-
_this.removeLoopedSlides();
|
425 |
-
_this.calcSlides();
|
426 |
-
_this.createLoop();
|
427 |
-
} else _this.slides[index].remove();
|
428 |
-
return true;
|
429 |
-
} else return false;
|
430 |
-
}
|
431 |
-
_this.removeLastSlide = function () {
|
432 |
-
if (_this.slides.length > 0) {
|
433 |
-
if (params.loop) {
|
434 |
-
_this.slides[_this.slides.length - 1 - _this.loopedSlides].remove();
|
435 |
-
_this.removeLoopedSlides();
|
436 |
-
_this.calcSlides();
|
437 |
-
_this.createLoop();
|
438 |
-
} else _this.slides[(_this.slides.length - 1)].remove();
|
439 |
-
return true;
|
440 |
-
} else {
|
441 |
-
return false;
|
442 |
-
}
|
443 |
-
}
|
444 |
-
_this.removeAllSlides = function () {
|
445 |
-
for (var i = _this.slides.length - 1; i >= 0; i--) {
|
446 |
-
_this.slides[i].remove()
|
447 |
-
}
|
448 |
-
}
|
449 |
-
_this.getSlide = function (index) {
|
450 |
-
return _this.slides[index]
|
451 |
-
}
|
452 |
-
_this.getLastSlide = function () {
|
453 |
-
return _this.slides[_this.slides.length - 1]
|
454 |
-
}
|
455 |
-
_this.getFirstSlide = function () {
|
456 |
-
return _this.slides[0]
|
457 |
-
}
|
458 |
-
|
459 |
-
//Currently Active Slide
|
460 |
-
_this.activeSlide = function () {
|
461 |
-
return _this.slides[_this.activeIndex]
|
462 |
-
}
|
463 |
-
|
464 |
-
/*=========================
|
465 |
-
Plugins API
|
466 |
-
===========================*/
|
467 |
-
var _plugins = [];
|
468 |
-
for (var plugin in _this.plugins) {
|
469 |
-
if (params[plugin]) {
|
470 |
-
var p = _this.plugins[plugin](_this, params[plugin]);
|
471 |
-
if (p) _plugins.push(p);
|
472 |
-
}
|
473 |
-
}
|
474 |
-
_this.callPlugins = function (method, args) {
|
475 |
-
if (!args) args = {}
|
476 |
-
for (var i = 0; i < _plugins.length; i++) {
|
477 |
-
if (method in _plugins[i]) {
|
478 |
-
_plugins[i][method](args);
|
479 |
-
}
|
480 |
-
}
|
481 |
-
}
|
482 |
-
|
483 |
-
/*=========================
|
484 |
-
WP8 Fix
|
485 |
-
===========================*/
|
486 |
-
if (_this.browser.ie10 && !params.onlyExternal) {
|
487 |
-
if (isH) _this.wrapper.classList.add('swiper-wp8-horizontal');
|
488 |
-
else _this.wrapper.classList.add('swiper-wp8-vertical');
|
489 |
-
}
|
490 |
-
|
491 |
-
/*=========================
|
492 |
-
Free Mode Class
|
493 |
-
===========================*/
|
494 |
-
if (params.freeMode) {
|
495 |
-
_this.container.className += ' swiper-free-mode';
|
496 |
-
}
|
497 |
-
|
498 |
-
/*==================================================
|
499 |
-
Init/Re-init/Resize Fix
|
500 |
-
====================================================*/
|
501 |
-
_this.initialized = false;
|
502 |
-
_this.init = function (force, forceCalcSlides) {
|
503 |
-
var _width = _this.h.getWidth(_this.container);
|
504 |
-
var _height = _this.h.getHeight(_this.container);
|
505 |
-
if (_width === _this.width && _height === _this.height && !force) return;
|
506 |
-
_this.width = _width;
|
507 |
-
_this.height = _height;
|
508 |
-
|
509 |
-
containerSize = isH ? _width : _height;
|
510 |
-
var wrapper = _this.wrapper;
|
511 |
-
|
512 |
-
if (force) {
|
513 |
-
_this.calcSlides(forceCalcSlides);
|
514 |
-
}
|
515 |
-
|
516 |
-
if (params.slidesPerView === 'auto') {
|
517 |
-
//Auto mode
|
518 |
-
var slidesWidth = 0;
|
519 |
-
var slidesHeight = 0;
|
520 |
-
|
521 |
-
//Unset Styles
|
522 |
-
if (params.slidesOffset > 0) {
|
523 |
-
wrapper.style.paddingLeft = '';
|
524 |
-
wrapper.style.paddingRight = '';
|
525 |
-
wrapper.style.paddingTop = '';
|
526 |
-
wrapper.style.paddingBottom = '';
|
527 |
-
}
|
528 |
-
wrapper.style.width = '';
|
529 |
-
wrapper.style.height = '';
|
530 |
-
if (params.offsetPxBefore > 0) {
|
531 |
-
if (isH) _this.wrapperLeft = params.offsetPxBefore;
|
532 |
-
else _this.wrapperTop = params.offsetPxBefore;
|
533 |
-
}
|
534 |
-
if (params.offsetPxAfter > 0) {
|
535 |
-
if (isH) _this.wrapperRight = params.offsetPxAfter;
|
536 |
-
else _this.wrapperBottom = params.offsetPxAfter;
|
537 |
-
}
|
538 |
-
|
539 |
-
if (params.centeredSlides) {
|
540 |
-
if (isH) {
|
541 |
-
_this.wrapperLeft = (containerSize - this.slides[0].getWidth(true)) / 2;
|
542 |
-
_this.wrapperRight = (containerSize - _this.slides[_this.slides.length - 1].getWidth(true)) / 2;
|
543 |
-
} else {
|
544 |
-
_this.wrapperTop = (containerSize - _this.slides[0].getHeight(true)) / 2;
|
545 |
-
_this.wrapperBottom = (containerSize - _this.slides[_this.slides.length - 1].getHeight(true)) / 2;
|
546 |
-
}
|
547 |
-
}
|
548 |
-
|
549 |
-
if (isH) {
|
550 |
-
if (_this.wrapperLeft >= 0) wrapper.style.paddingLeft = _this.wrapperLeft + 'px';
|
551 |
-
if (_this.wrapperRight >= 0) wrapper.style.paddingRight = _this.wrapperRight + 'px';
|
552 |
-
} else {
|
553 |
-
if (_this.wrapperTop >= 0) wrapper.style.paddingTop = _this.wrapperTop + 'px';
|
554 |
-
if (_this.wrapperBottom >= 0) wrapper.style.paddingBottom = _this.wrapperBottom + 'px';
|
555 |
-
}
|
556 |
-
var slideLeft = 0;
|
557 |
-
var centeredSlideLeft = 0;
|
558 |
-
_this.snapGrid = [];
|
559 |
-
_this.slidesGrid = [];
|
560 |
-
|
561 |
-
var slideMaxHeight = 0;
|
562 |
-
for (var i = 0; i < _this.slides.length; i++) {
|
563 |
-
var slideWidth = _this.slides[i].getWidth(true);
|
564 |
-
var slideHeight = _this.slides[i].getHeight(true);
|
565 |
-
if (params.calculateHeight) {
|
566 |
-
slideMaxHeight = Math.max(slideMaxHeight, slideHeight)
|
567 |
-
}
|
568 |
-
var _slideSize = isH ? slideWidth : slideHeight;
|
569 |
-
if (params.centeredSlides) {
|
570 |
-
var nextSlideWidth = i === _this.slides.length - 1 ? 0 : _this.slides[i + 1].getWidth(true);
|
571 |
-
var nextSlideHeight = i === _this.slides.length - 1 ? 0 : _this.slides[i + 1].getHeight(true);
|
572 |
-
var nextSlideSize = isH ? nextSlideWidth : nextSlideHeight;
|
573 |
-
if (_slideSize > containerSize) {
|
574 |
-
for (var j = 0; j <= Math.floor(_slideSize / (containerSize + _this.wrapperLeft)); j++) {
|
575 |
-
if (j === 0) _this.snapGrid.push(slideLeft + _this.wrapperLeft);
|
576 |
-
else _this.snapGrid.push(slideLeft + _this.wrapperLeft + containerSize * j);
|
577 |
-
}
|
578 |
-
_this.slidesGrid.push(slideLeft + _this.wrapperLeft);
|
579 |
-
} else {
|
580 |
-
_this.snapGrid.push(centeredSlideLeft);
|
581 |
-
_this.slidesGrid.push(centeredSlideLeft);
|
582 |
-
}
|
583 |
-
|
584 |
-
centeredSlideLeft += _slideSize / 2 + nextSlideSize / 2;
|
585 |
-
|
586 |
-
} else {
|
587 |
-
if (_slideSize > containerSize) {
|
588 |
-
for (var j = 0; j <= Math.floor(_slideSize / containerSize); j++) {
|
589 |
-
_this.snapGrid.push(slideLeft + containerSize * j);
|
590 |
-
}
|
591 |
-
} else {
|
592 |
-
_this.snapGrid.push(slideLeft);
|
593 |
-
}
|
594 |
-
_this.slidesGrid.push(slideLeft);
|
595 |
-
}
|
596 |
-
|
597 |
-
slideLeft += _slideSize;
|
598 |
-
|
599 |
-
slidesWidth += slideWidth;
|
600 |
-
slidesHeight += slideHeight;
|
601 |
-
}
|
602 |
-
if (params.calculateHeight) _this.height = slideMaxHeight;
|
603 |
-
if (isH) {
|
604 |
-
wrapperSize = slidesWidth + _this.wrapperRight + _this.wrapperLeft;
|
605 |
-
wrapper.style.width = (slidesWidth) + 'px';
|
606 |
-
wrapper.style.height = (_this.height) + 'px';
|
607 |
-
} else {
|
608 |
-
wrapperSize = slidesHeight + _this.wrapperTop + _this.wrapperBottom;
|
609 |
-
wrapper.style.width = (_this.width) + 'px';
|
610 |
-
wrapper.style.height = (slidesHeight) + 'px';
|
611 |
-
}
|
612 |
-
|
613 |
-
} else if (params.scrollContainer) {
|
614 |
-
//Scroll Container
|
615 |
-
wrapper.style.width = '';
|
616 |
-
wrapper.style.height = '';
|
617 |
-
var wrapperWidth = _this.slides[0].getWidth(true);
|
618 |
-
var wrapperHeight = _this.slides[0].getHeight(true);
|
619 |
-
wrapperSize = isH ? wrapperWidth : wrapperHeight;
|
620 |
-
wrapper.style.width = wrapperWidth + 'px';
|
621 |
-
wrapper.style.height = wrapperHeight + 'px';
|
622 |
-
slideSize = isH ? wrapperWidth : wrapperHeight;
|
623 |
-
|
624 |
-
} else {
|
625 |
-
//For usual slides
|
626 |
-
if (params.calculateHeight) {
|
627 |
-
var slideMaxHeight = 0;
|
628 |
-
var wrapperHeight = 0;
|
629 |
-
//ResetWrapperSize
|
630 |
-
if (!isH) _this.container.style.height = '';
|
631 |
-
wrapper.style.height = '';
|
632 |
-
|
633 |
-
for (var i = 0; i < _this.slides.length; i++) {
|
634 |
-
//ResetSlideSize
|
635 |
-
_this.slides[i].style.height = '';
|
636 |
-
slideMaxHeight = Math.max(_this.slides[i].getHeight(true), slideMaxHeight);
|
637 |
-
if (!isH) wrapperHeight += _this.slides[i].getHeight(true);
|
638 |
-
}
|
639 |
-
var slideHeight = slideMaxHeight;
|
640 |
-
if (isH) var wrapperHeight = slideHeight;
|
641 |
-
containerSize = _this.height = slideHeight;
|
642 |
-
if (!isH) _this.container.style.height = containerSize + 'px';
|
643 |
-
} else {
|
644 |
-
var slideHeight = isH ? _this.height : _this.height / params.slidesPerView;
|
645 |
-
var wrapperHeight = isH ? _this.height : _this.slides.length * slideHeight;
|
646 |
-
}
|
647 |
-
var slideWidth = isH ? _this.width / params.slidesPerView : _this.width;
|
648 |
-
var wrapperWidth = isH ? _this.slides.length * slideWidth : _this.width;
|
649 |
-
slideSize = isH ? slideWidth : slideHeight;
|
650 |
-
|
651 |
-
if (params.offsetSlidesBefore > 0) {
|
652 |
-
if (isH) _this.wrapperLeft = slideSize * params.offsetSlidesBefore;
|
653 |
-
else _this.wrapperTop = slideSize * params.offsetSlidesBefore;
|
654 |
-
}
|
655 |
-
if (params.offsetSlidesAfter > 0) {
|
656 |
-
if (isH) _this.wrapperRight = slideSize * params.offsetSlidesAfter;
|
657 |
-
else _this.wrapperBottom = slideSize * params.offsetSlidesAfter;
|
658 |
-
}
|
659 |
-
if (params.offsetPxBefore > 0) {
|
660 |
-
if (isH) _this.wrapperLeft = params.offsetPxBefore;
|
661 |
-
else _this.wrapperTop = params.offsetPxBefore;
|
662 |
-
}
|
663 |
-
if (params.offsetPxAfter > 0) {
|
664 |
-
if (isH) _this.wrapperRight = params.offsetPxAfter;
|
665 |
-
else _this.wrapperBottom = params.offsetPxAfter;
|
666 |
-
}
|
667 |
-
if (params.centeredSlides) {
|
668 |
-
if (isH) {
|
669 |
-
_this.wrapperLeft = (containerSize - slideSize) / 2;
|
670 |
-
_this.wrapperRight = (containerSize - slideSize) / 2;
|
671 |
-
} else {
|
672 |
-
_this.wrapperTop = (containerSize - slideSize) / 2;
|
673 |
-
_this.wrapperBottom = (containerSize - slideSize) / 2;
|
674 |
-
}
|
675 |
-
}
|
676 |
-
if (isH) {
|
677 |
-
if (_this.wrapperLeft > 0) wrapper.style.paddingLeft = _this.wrapperLeft + 'px';
|
678 |
-
if (_this.wrapperRight > 0) wrapper.style.paddingRight = _this.wrapperRight + 'px';
|
679 |
-
} else {
|
680 |
-
if (_this.wrapperTop > 0) wrapper.style.paddingTop = _this.wrapperTop + 'px';
|
681 |
-
if (_this.wrapperBottom > 0) wrapper.style.paddingBottom = _this.wrapperBottom + 'px';
|
682 |
-
}
|
683 |
-
|
684 |
-
wrapperSize = isH ? wrapperWidth + _this.wrapperRight + _this.wrapperLeft : wrapperHeight + _this.wrapperTop + _this.wrapperBottom;
|
685 |
-
wrapper.style.width = wrapperWidth + 'px';
|
686 |
-
wrapper.style.height = wrapperHeight + 'px';
|
687 |
-
var slideLeft = 0;
|
688 |
-
_this.snapGrid = [];
|
689 |
-
_this.slidesGrid = [];
|
690 |
-
for (var i = 0; i < _this.slides.length; i++) {
|
691 |
-
_this.snapGrid.push(slideLeft);
|
692 |
-
_this.slidesGrid.push(slideLeft);
|
693 |
-
slideLeft += slideSize;
|
694 |
-
_this.slides[i].style.width = slideWidth + 'px';
|
695 |
-
_this.slides[i].style.height = slideHeight + 'px';
|
696 |
-
}
|
697 |
-
|
698 |
-
}
|
699 |
-
|
700 |
-
if (!_this.initialized) _this.callPlugins('onFirstInit');
|
701 |
-
else _this.callPlugins('onInit');
|
702 |
-
_this.initialized = true;
|
703 |
-
}
|
704 |
-
_this.reInit = function (forceCalcSlides) {
|
705 |
-
_this.init(true, forceCalcSlides);
|
706 |
-
}
|
707 |
-
_this.resizeFix = function (reInit) {
|
708 |
-
_this.callPlugins('beforeResizeFix');
|
709 |
-
_this.init(params.resizeReInit || reInit);
|
710 |
-
if (!params.freeMode) {
|
711 |
-
if (params.loop) _this.swipeTo(_this.activeLoopIndex, 0, false);
|
712 |
-
else _this.swipeTo(_this.activeIndex, 0, false);
|
713 |
-
} else {
|
714 |
-
var pos = isH ? _this.getWrapperTranslate('x') : _this.getWrapperTranslate('y');
|
715 |
-
if (pos < -maxWrapperPosition()) {
|
716 |
-
var x = isH ? -maxWrapperPosition() : 0;
|
717 |
-
var y = isH ? 0 : -maxWrapperPosition();
|
718 |
-
_this.setWrapperTransition(0);
|
719 |
-
_this.setWrapperTranslate(x, y, 0);
|
720 |
-
}
|
721 |
-
}
|
722 |
-
_this.callPlugins('afterResizeFix');
|
723 |
-
}
|
724 |
-
|
725 |
-
/*==========================================
|
726 |
-
Max and Min Positions
|
727 |
-
============================================*/
|
728 |
-
function maxWrapperPosition() {
|
729 |
-
var a = (wrapperSize - containerSize);
|
730 |
-
if (params.freeMode) {
|
731 |
-
a = wrapperSize - containerSize;
|
732 |
-
}
|
733 |
-
// if (params.loop) a -= containerSize;
|
734 |
-
if (params.slidesPerView > _this.slides.length) a = 0;
|
735 |
-
if (a < 0) a = 0;
|
736 |
-
return a;
|
737 |
-
}
|
738 |
-
|
739 |
-
function minWrapperPosition() {
|
740 |
-
var a = 0;
|
741 |
-
// if (params.loop) a = containerSize;
|
742 |
-
return a;
|
743 |
-
}
|
744 |
-
|
745 |
-
/*==========================================
|
746 |
-
Event Listeners
|
747 |
-
============================================*/
|
748 |
-
function initEvents() {
|
749 |
-
//Touch Events
|
750 |
-
if (!_this.browser.ie10) {
|
751 |
-
if (_this.support.touch) {
|
752 |
-
_this.h.addEventListener(_this.wrapper, 'touchstart', onTouchStart, false);
|
753 |
-
_this.h.addEventListener(_this.wrapper, 'touchmove', onTouchMove, false);
|
754 |
-
_this.h.addEventListener(_this.wrapper, 'touchend', onTouchEnd, false);
|
755 |
-
}
|
756 |
-
if (params.simulateTouch) {
|
757 |
-
_this.h.addEventListener(_this.wrapper, 'mousedown', onTouchStart, false);
|
758 |
-
_this.h.addEventListener(document, 'mousemove', onTouchMove, false);
|
759 |
-
_this.h.addEventListener(document, 'mouseup', onTouchEnd, false);
|
760 |
-
}
|
761 |
-
} else {
|
762 |
-
_this.h.addEventListener(_this.wrapper, _this.touchEvents.touchStart, onTouchStart, false);
|
763 |
-
_this.h.addEventListener(document, _this.touchEvents.touchMove, onTouchMove, false);
|
764 |
-
_this.h.addEventListener(document, _this.touchEvents.touchEnd, onTouchEnd, false);
|
765 |
-
}
|
766 |
-
//Resize Event
|
767 |
-
if (params.autoResize) {
|
768 |
-
_this.h.addEventListener(window, 'resize', _this.resizeFix, false);
|
769 |
-
}
|
770 |
-
//Slide Events
|
771 |
-
addSlideEvents();
|
772 |
-
//Mousewheel
|
773 |
-
_this._wheelEvent = false;
|
774 |
-
if (params.mousewheelControl) {
|
775 |
-
if (document.onmousewheel !== undefined) {
|
776 |
-
_this._wheelEvent = "mousewheel";
|
777 |
-
}
|
778 |
-
try {
|
779 |
-
WheelEvent("wheel");
|
780 |
-
_this._wheelEvent = "wheel";
|
781 |
-
} catch (e) {}
|
782 |
-
if (!_this._wheelEvent) {
|
783 |
-
_this._wheelEvent = "DOMMouseScroll";
|
784 |
-
}
|
785 |
-
|
786 |
-
if (_this._wheelEvent) {
|
787 |
-
_this.h.addEventListener(_this.container, _this._wheelEvent, handleMousewheel, false);
|
788 |
-
}
|
789 |
-
}
|
790 |
-
|
791 |
-
//Keyboard
|
792 |
-
if (params.keyboardControl) {
|
793 |
-
_this.h.addEventListener(document, 'keydown', handleKeyboardKeys, false);
|
794 |
-
}
|
795 |
-
if (params.updateOnImagesReady) {
|
796 |
-
if (document.querySelectorAll) _this.imagesToLoad = _this.container.querySelectorAll('img');
|
797 |
-
else if (window.jQuery) _this.imagesToLoad = $$(_this.container).find('img');
|
798 |
-
|
799 |
-
for (var i = 0; i < _this.imagesToLoad.length; i++) {
|
800 |
-
_loadImage(_this.imagesToLoad[i].getAttribute('src'))
|
801 |
-
}
|
802 |
-
}
|
803 |
-
|
804 |
-
function _loadImage(src) {
|
805 |
-
var image = new Image();
|
806 |
-
image.onload = function () {
|
807 |
-
_this.imagesLoaded++;
|
808 |
-
if (_this.imagesLoaded == _this.imagesToLoad.length) {
|
809 |
-
_this.reInit();
|
810 |
-
if (params.onImagesReady) params.onImagesReady(_this);
|
811 |
-
}
|
812 |
-
}
|
813 |
-
image.src = src;
|
814 |
-
}
|
815 |
-
}
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
//Remove Event Listeners
|
820 |
-
_this.destroy = function (removeResizeFix) {
|
821 |
-
//Touch Events
|
822 |
-
if (!_this.browser.ie10) {
|
823 |
-
if (_this.support.touch) {
|
824 |
-
_this.h.removeEventListener(_this.wrapper, 'touchstart', onTouchStart, false);
|
825 |
-
_this.h.removeEventListener(_this.wrapper, 'touchmove', onTouchMove, false);
|
826 |
-
_this.h.removeEventListener(_this.wrapper, 'touchend', onTouchEnd, false);
|
827 |
-
}
|
828 |
-
if (params.simulateTouch) {
|
829 |
-
_this.h.removeEventListener(_this.wrapper, 'mousedown', onTouchStart, false);
|
830 |
-
_this.h.removeEventListener(document, 'mousemove', onTouchMove, false);
|
831 |
-
_this.h.removeEventListener(document, 'mouseup', onTouchEnd, false);
|
832 |
-
}
|
833 |
-
} else {
|
834 |
-
_this.h.removeEventListener(_this.wrapper, _this.touchEvents.touchStart, onTouchStart, false);
|
835 |
-
_this.h.removeEventListener(document, _this.touchEvents.touchMove, onTouchMove, false);
|
836 |
-
_this.h.removeEventListener(document, _this.touchEvents.touchEnd, onTouchEnd, false);
|
837 |
-
}
|
838 |
-
//Resize Event
|
839 |
-
if (params.autoResize) {
|
840 |
-
_this.h.removeEventListener(window, 'resize', _this.resizeFix, false);
|
841 |
-
}
|
842 |
-
//Init Slide Events
|
843 |
-
removeSlideEvents();
|
844 |
-
|
845 |
-
//Pagination
|
846 |
-
if (params.paginationClickable) {
|
847 |
-
removePaginationEvents();
|
848 |
-
}
|
849 |
-
|
850 |
-
//Mousewheel
|
851 |
-
if (params.mousewheelControl && _this._wheelEvent) {
|
852 |
-
_this.h.removeEventListener(_this.container, _this._wheelEvent, handleMousewheel, false);
|
853 |
-
}
|
854 |
-
|
855 |
-
//Keyboard
|
856 |
-
if (params.keyboardControl) {
|
857 |
-
_this.h.removeEventListener(document, 'keydown', handleKeyboardKeys, false);
|
858 |
-
}
|
859 |
-
|
860 |
-
//Stop autoplay
|
861 |
-
if (params.autoplay) {
|
862 |
-
_this.stopAutoplay();
|
863 |
-
}
|
864 |
-
|
865 |
-
_this.callPlugins('onDestroy');
|
866 |
-
}
|
867 |
-
|
868 |
-
function addSlideEvents() {
|
869 |
-
//Prevent Links Events
|
870 |
-
if (params.preventLinks) {
|
871 |
-
var links = [];
|
872 |
-
if (document.querySelectorAll) {
|
873 |
-
links = _this.container.querySelectorAll('a');
|
874 |
-
} else if (window.jQuery) {
|
875 |
-
links = $$(_this.container).find('a');
|
876 |
-
}
|
877 |
-
for (var i = 0; i < links.length; i++) {
|
878 |
-
_this.h.addEventListener(links[i], 'click', preventClick, false);
|
879 |
-
}
|
880 |
-
}
|
881 |
-
//Release Form Elements
|
882 |
-
if (params.releaseFormElements) {
|
883 |
-
var formElements = document.querySelectorAll ? _this.container.querySelectorAll('input, textarea, select') : $$(_this.container).find('input, textarea, select');
|
884 |
-
for (var i = 0; i < formElements.length; i++) {
|
885 |
-
_this.h.addEventListener(formElements[i], _this.touchEvents.touchStart, releaseForms, true);
|
886 |
-
}
|
887 |
-
}
|
888 |
-
|
889 |
-
//Slide Clicks & Touches
|
890 |
-
if (params.onSlideClick) {
|
891 |
-
for (var i = 0; i < _this.slides.length; i++) {
|
892 |
-
_this.h.addEventListener(_this.slides[i], 'click', slideClick, false);
|
893 |
-
}
|
894 |
-
}
|
895 |
-
if (params.onSlideTouch) {
|
896 |
-
for (var i = 0; i < _this.slides.length; i++) {
|
897 |
-
_this.h.addEventListener(_this.slides[i], _this.touchEvents.touchStart, slideTouch, false);
|
898 |
-
}
|
899 |
-
}
|
900 |
-
}
|
901 |
-
|
902 |
-
function removeSlideEvents() {
|
903 |
-
//Slide Clicks & Touches
|
904 |
-
if (params.onSlideClick) {
|
905 |
-
for (var i = 0; i < _this.slides.length; i++) {
|
906 |
-
_this.h.removeEventListener(_this.slides[i], 'click', slideClick, false);
|
907 |
-
}
|
908 |
-
}
|
909 |
-
if (params.onSlideTouch) {
|
910 |
-
for (var i = 0; i < _this.slides.length; i++) {
|
911 |
-
_this.h.removeEventListener(_this.slides[i], _this.touchEvents.touchStart, slideTouch, false);
|
912 |
-
}
|
913 |
-
}
|
914 |
-
//Release Form Elements
|
915 |
-
if (params.releaseFormElements) {
|
916 |
-
var formElements = document.querySelectorAll ? _this.container.querySelectorAll('input, textarea, select') : $$(_this.container).find('input, textarea, select');
|
917 |
-
for (var i = 0; i < formElements.length; i++) {
|
918 |
-
_this.h.removeEventListener(formElements[i], _this.touchEvents.touchStart, releaseForms, true);
|
919 |
-
}
|
920 |
-
}
|
921 |
-
//Prevent Links Events
|
922 |
-
if (params.preventLinks) {
|
923 |
-
var links = [];
|
924 |
-
if (document.querySelectorAll) {
|
925 |
-
links = _this.container.querySelectorAll('a');
|
926 |
-
} else if (window.jQuery) {
|
927 |
-
links = $$(_this.container).find('a');
|
928 |
-
}
|
929 |
-
for (var i = 0; i < links.length; i++) {
|
930 |
-
_this.h.removeEventListener(links[i], 'click', preventClick, false);
|
931 |
-
}
|
932 |
-
}
|
933 |
-
}
|
934 |
-
/*==========================================
|
935 |
-
Keyboard Control
|
936 |
-
============================================*/
|
937 |
-
function handleKeyboardKeys(e) {
|
938 |
-
var kc = e.keyCode || e.charCode;
|
939 |
-
if (kc == 37 || kc == 39 || kc == 38 || kc == 40) {
|
940 |
-
var inView = false;
|
941 |
-
//Check that swiper should be inside of visible area of window
|
942 |
-
var swiperOffset = _this.h.getOffset(_this.container);
|
943 |
-
var scrollLeft = _this.h.windowScroll().left;
|
944 |
-
var scrollTop = _this.h.windowScroll().top;
|
945 |
-
var windowWidth = _this.h.windowWidth();
|
946 |
-
var windowHeight = _this.h.windowHeight();
|
947 |
-
var swiperCoord = [
|
948 |
-
[swiperOffset.left, swiperOffset.top],
|
949 |
-
[swiperOffset.left + _this.width, swiperOffset.top],
|
950 |
-
[swiperOffset.left, swiperOffset.top + _this.height],
|
951 |
-
[swiperOffset.left + _this.width, swiperOffset.top + _this.height]
|
952 |
-
]
|
953 |
-
for (var i = 0; i < swiperCoord.length; i++) {
|
954 |
-
var point = swiperCoord[i];
|
955 |
-
if (
|
956 |
-
point[0] >= scrollLeft && point[0] <= scrollLeft + windowWidth && point[1] >= scrollTop && point[1] <= scrollTop + windowHeight) {
|
957 |
-
inView = true;
|
958 |
-
}
|
959 |
-
|
960 |
-
}
|
961 |
-
if (!inView) return;
|
962 |
-
}
|
963 |
-
if (isH) {
|
964 |
-
if (kc == 37 || kc == 39) {
|
965 |
-
if (e.preventDefault) e.preventDefault();
|
966 |
-
else e.returnValue = false;
|
967 |
-
}
|
968 |
-
if (kc == 39) _this.swipeNext();
|
969 |
-
if (kc == 37) _this.swipePrev();
|
970 |
-
} else {
|
971 |
-
if (kc == 38 || kc == 40) {
|
972 |
-
if (e.preventDefault) e.preventDefault();
|
973 |
-
else e.returnValue = false;
|
974 |
-
}
|
975 |
-
if (kc == 40) _this.swipeNext();
|
976 |
-
if (kc == 38) _this.swipePrev();
|
977 |
-
}
|
978 |
-
}
|
979 |
-
|
980 |
-
/*==========================================
|
981 |
-
Mousewheel Control
|
982 |
-
============================================*/
|
983 |
-
function handleMousewheel(e) {
|
984 |
-
var we = _this._wheelEvent;
|
985 |
-
var delta;
|
986 |
-
//Opera & IE
|
987 |
-
if (e.detail) delta = -e.detail;
|
988 |
-
//WebKits
|
989 |
-
else if (we == 'mousewheel') delta = e.wheelDelta;
|
990 |
-
//Old FireFox
|
991 |
-
else if (we == 'DOMMouseScroll') delta = -e.detail;
|
992 |
-
//New FireFox
|
993 |
-
else if (we == 'wheel') {
|
994 |
-
delta = Math.abs(e.deltaX) > Math.abs(e.deltaY) ? -e.deltaX : -e.deltaY;
|
995 |
-
}
|
996 |
-
if (!params.freeMode) {
|
997 |
-
if (delta < 0) _this.swipeNext();
|
998 |
-
else _this.swipePrev();
|
999 |
-
} else {
|
1000 |
-
//Freemode or scrollContainer:
|
1001 |
-
var currentTransform = isH ? _this.getWrapperTranslate('x') : _this.getWrapperTranslate('y');
|
1002 |
-
var x, y;
|
1003 |
-
if (isH) {
|
1004 |
-
x = _this.getWrapperTranslate('x') + delta;
|
1005 |
-
y = _this.getWrapperTranslate('y');
|
1006 |
-
if (x > 0) x = 0;
|
1007 |
-
if (x < -maxWrapperPosition()) x = -maxWrapperPosition();
|
1008 |
-
} else {
|
1009 |
-
x = _this.getWrapperTranslate('x');
|
1010 |
-
y = _this.getWrapperTranslate('y') + delta;
|
1011 |
-
if (y > 0) y = 0;
|
1012 |
-
if (y < -maxWrapperPosition()) y = -maxWrapperPosition();
|
1013 |
-
}
|
1014 |
-
_this.setWrapperTransition(0);
|
1015 |
-
_this.setWrapperTranslate(x, y, 0);
|
1016 |
-
}
|
1017 |
-
if (params.autoplay) _this.stopAutoplay();
|
1018 |
-
|
1019 |
-
if (e.preventDefault) e.preventDefault();
|
1020 |
-
else e.returnValue = false;
|
1021 |
-
return false;
|
1022 |
-
}
|
1023 |
-
|
1024 |
-
/*=========================
|
1025 |
-
Grab Cursor
|
1026 |
-
===========================*/
|
1027 |
-
if (params.grabCursor) {
|
1028 |
-
_this.container.style.cursor = 'move';
|
1029 |
-
_this.container.style.cursor = 'grab';
|
1030 |
-
_this.container.style.cursor = '-moz-grab';
|
1031 |
-
_this.container.style.cursor = '-webkit-grab';
|
1032 |
-
}
|
1033 |
-
|
1034 |
-
/*=========================
|
1035 |
-
Slides Events Handlers
|
1036 |
-
===========================*/
|
1037 |
-
_this.allowSlideClick = true;
|
1038 |
-
|
1039 |
-
function slideClick(e) {
|
1040 |
-
if (_this.allowSlideClick) {
|
1041 |
-
_this.clickedSlide = this;
|
1042 |
-
_this.clickedSlideIndex = _this.slides.indexOf(this);
|
1043 |
-
params.onSlideClick(_this);
|
1044 |
-
}
|
1045 |
-
}
|
1046 |
-
|
1047 |
-
function slideTouch(e) {
|
1048 |
-
_this.clickedSlide = this;
|
1049 |
-
_this.clickedSlideIndex = _this.slides.indexOf(this);
|
1050 |
-
params.onSlideTouch(_this);
|
1051 |
-
}
|
1052 |
-
_this.allowLinks = true;
|
1053 |
-
|
1054 |
-
function preventClick(e) {
|
1055 |
-
if (!_this.allowLinks) {
|
1056 |
-
if (e.preventDefault) e.preventDefault();
|
1057 |
-
else e.returnValue = false;
|
1058 |
-
return false;
|
1059 |
-
}
|
1060 |
-
}
|
1061 |
-
|
1062 |
-
function releaseForms(e) {
|
1063 |
-
if (e.stopPropagation) e.stopPropagation();
|
1064 |
-
else e.returnValue = false;
|
1065 |
-
return false;
|
1066 |
-
}
|
1067 |
-
|
1068 |
-
/*==================================================
|
1069 |
-
Event Handlers
|
1070 |
-
====================================================*/
|
1071 |
-
var isTouchEvent = false;
|
1072 |
-
var allowThresholdMove;
|
1073 |
-
var allowMomentumBounce = true;
|
1074 |
-
|
1075 |
-
function onTouchStart(event) {
|
1076 |
-
if (params.preventLinks) _this.allowLinks = true;
|
1077 |
-
//Exit if slider is already was touched
|
1078 |
-
if (_this.isTouched || params.onlyExternal) {
|
1079 |
-
return false;
|
1080 |
-
}
|
1081 |
-
|
1082 |
-
if (params.noSwiping && event.target && event.target.className && event.target.className.indexOf(params.noSwipingClass) > -1) return false;
|
1083 |
-
allowMomentumBounce = false;
|
1084 |
-
|
1085 |
-
//Check For Nested Swipers
|
1086 |
-
_this.isTouched = true;
|
1087 |
-
isTouchEvent = event.type == 'touchstart';
|
1088 |
-
|
1089 |
-
if (!isTouchEvent || event.targetTouches.length == 1) {
|
1090 |
-
if (params.loop) _this.fixLoop();
|
1091 |
-
_this.callPlugins('onTouchStartBegin');
|
1092 |
-
|
1093 |
-
if (!isTouchEvent) {
|
1094 |
-
if (event.preventDefault) event.preventDefault();
|
1095 |
-
else event.returnValue = false;
|
1096 |
-
}
|
1097 |
-
|
1098 |
-
var pageX = isTouchEvent ? event.targetTouches[0].pageX : (event.pageX || event.clientX);
|
1099 |
-
var pageY = isTouchEvent ? event.targetTouches[0].pageY : (event.pageY || event.clientY);
|
1100 |
-
|
1101 |
-
//Start Touches to check the scrolling
|
1102 |
-
_this.touches.startX = _this.touches.currentX = pageX;
|
1103 |
-
_this.touches.startY = _this.touches.currentY = pageY;
|
1104 |
-
|
1105 |
-
_this.touches.start = _this.touches.current = isH ? pageX : pageY;
|
1106 |
-
|
1107 |
-
//Set Transition Time to 0
|
1108 |
-
_this.setWrapperTransition(0);
|
1109 |
-
|
1110 |
-
//Get Start Translate Position
|
1111 |
-
_this.positions.start = _this.positions.current = isH ? _this.getWrapperTranslate('x') : _this.getWrapperTranslate('y');
|
1112 |
-
|
1113 |
-
//Set Transform
|
1114 |
-
if (isH) {
|
1115 |
-
_this.setWrapperTranslate(_this.positions.start, 0, 0);
|
1116 |
-
} else {
|
1117 |
-
_this.setWrapperTranslate(0, _this.positions.start, 0);
|
1118 |
-
}
|
1119 |
-
|
1120 |
-
//TouchStartTime
|
1121 |
-
_this.times.start = (new Date()).getTime();
|
1122 |
-
|
1123 |
-
//Unset Scrolling
|
1124 |
-
isScrolling = undefined;
|
1125 |
-
|
1126 |
-
//Set Treshold
|
1127 |
-
if (params.moveStartThreshold > 0) allowThresholdMove = false;
|
1128 |
-
|
1129 |
-
//CallBack
|
1130 |
-
if (params.onTouchStart) params.onTouchStart(_this);
|
1131 |
-
_this.callPlugins('onTouchStartEnd');
|
1132 |
-
|
1133 |
-
}
|
1134 |
-
}
|
1135 |
-
var velocityPrevPosition, velocityPrevTime;
|
1136 |
-
|
1137 |
-
function onTouchMove(event) {
|
1138 |
-
// If slider is not touched - exit
|
1139 |
-
if (!_this.isTouched || params.onlyExternal) return;
|
1140 |
-
if (isTouchEvent && event.type == 'mousemove') return;
|
1141 |
-
|
1142 |
-
var pageX = isTouchEvent ? event.targetTouches[0].pageX : (event.pageX || event.clientX);
|
1143 |
-
var pageY = isTouchEvent ? event.targetTouches[0].pageY : (event.pageY || event.clientY);
|
1144 |
-
|
1145 |
-
//check for scrolling
|
1146 |
-
if (typeof isScrolling === 'undefined' && isH) {
|
1147 |
-
isScrolling = !! (isScrolling || Math.abs(pageY - _this.touches.startY) > Math.abs(pageX - _this.touches.startX));
|
1148 |
-
}
|
1149 |
-
if (typeof isScrolling === 'undefined' && !isH) {
|
1150 |
-
isScrolling = !! (isScrolling || Math.abs(pageY - _this.touches.startY) < Math.abs(pageX - _this.touches.startX));
|
1151 |
-
}
|
1152 |
-
if (isScrolling) {
|
1153 |
-
_this.isTouched = false;
|
1154 |
-
return
|
1155 |
-
}
|
1156 |
-
|
1157 |
-
//Check For Nested Swipers
|
1158 |
-
if (event.assignedToSwiper) {
|
1159 |
-
_this.isTouched = false;
|
1160 |
-
return
|
1161 |
-
}
|
1162 |
-
event.assignedToSwiper = true;
|
1163 |
-
|
1164 |
-
//Moved Flag
|
1165 |
-
_this.isMoved = true;
|
1166 |
-
|
1167 |
-
//Block inner links
|
1168 |
-
if (params.preventLinks) {
|
1169 |
-
_this.allowLinks = false;
|
1170 |
-
}
|
1171 |
-
if (params.onSlideClick) {
|
1172 |
-
_this.allowSlideClick = false;
|
1173 |
-
}
|
1174 |
-
|
1175 |
-
//Stop AutoPlay if exist
|
1176 |
-
if (params.autoplay) {
|
1177 |
-
_this.stopAutoplay();
|
1178 |
-
}
|
1179 |
-
if (!isTouchEvent || event.touches.length == 1) {
|
1180 |
-
|
1181 |
-
_this.callPlugins('onTouchMoveStart');
|
1182 |
-
|
1183 |
-
if (event.preventDefault) event.preventDefault();
|
1184 |
-
else event.returnValue = false;
|
1185 |
-
|
1186 |
-
_this.touches.current = isH ? pageX : pageY;
|
1187 |
-
|
1188 |
-
_this.positions.current = (_this.touches.current - _this.touches.start) * params.touchRatio + _this.positions.start;
|
1189 |
-
|
1190 |
-
//Resistance Callbacks
|
1191 |
-
if (_this.positions.current > 0 && params.onResistanceBefore) {
|
1192 |
-
params.onResistanceBefore(_this, _this.positions.current);
|
1193 |
-
}
|
1194 |
-
if (_this.positions.current < -maxWrapperPosition() && params.onResistanceBefore) {
|
1195 |
-
params.onResistanceAfter(_this, Math.abs(_this.positions.current + maxWrapperPosition()));
|
1196 |
-
}
|
1197 |
-
//Resistance
|
1198 |
-
if (params.resistance && params.resistance != '100%') {
|
1199 |
-
//Resistance for Negative-Back sliding
|
1200 |
-
if (_this.positions.current > 0) {
|
1201 |
-
var resistance = 1 - _this.positions.current / containerSize / 2;
|
1202 |
-
if (resistance < 0.5) _this.positions.current = (containerSize / 2);
|
1203 |
-
else _this.positions.current = _this.positions.current * resistance;
|
1204 |
-
}
|
1205 |
-
//Resistance for After-End Sliding
|
1206 |
-
if (_this.positions.current < -maxWrapperPosition()) {
|
1207 |
-
|
1208 |
-
var diff = (_this.touches.current - _this.touches.start) * params.touchRatio + (maxWrapperPosition() + _this.positions.start);
|
1209 |
-
var resistance = (containerSize + diff) / (containerSize);
|
1210 |
-
var newPos = _this.positions.current - diff * (1 - resistance) / 2;
|
1211 |
-
var stopPos = -maxWrapperPosition() - containerSize / 2;
|
1212 |
-
|
1213 |
-
if (newPos < stopPos || resistance <= 0) _this.positions.current = stopPos;
|
1214 |
-
else _this.positions.current = newPos;
|
1215 |
-
}
|
1216 |
-
}
|
1217 |
-
if (params.resistance && params.resistance == '100%') {
|
1218 |
-
//Resistance for Negative-Back sliding
|
1219 |
-
if (_this.positions.current > 0 && !(params.freeMode && !params.freeModeFluid)) {
|
1220 |
-
_this.positions.current = 0;
|
1221 |
-
}
|
1222 |
-
//Resistance for After-End Sliding
|
1223 |
-
if ((_this.positions.current) < -maxWrapperPosition() && !(params.freeMode && !params.freeModeFluid)) {
|
1224 |
-
_this.positions.current = -maxWrapperPosition();
|
1225 |
-
}
|
1226 |
-
}
|
1227 |
-
//Move Slides
|
1228 |
-
if (!params.followFinger) return
|
1229 |
-
|
1230 |
-
if (!params.moveStartThreshold) {
|
1231 |
-
if (isH) _this.setWrapperTranslate(_this.positions.current, 0, 0);
|
1232 |
-
else _this.setWrapperTranslate(0, _this.positions.current, 0);
|
1233 |
-
} else {
|
1234 |
-
if (Math.abs(_this.touches.current - _this.touches.start) > params.moveStartThreshold || allowThresholdMove) {
|
1235 |
-
allowThresholdMove = true;
|
1236 |
-
if (isH) _this.setWrapperTranslate(_this.positions.current, 0, 0);
|
1237 |
-
else _this.setWrapperTranslate(0, _this.positions.current, 0);
|
1238 |
-
} else {
|
1239 |
-
_this.positions.current = _this.positions.start;
|
1240 |
-
}
|
1241 |
-
}
|
1242 |
-
|
1243 |
-
if (params.freeMode || params.watchActiveIndex) {
|
1244 |
-
_this.updateActiveSlide(_this.positions.current);
|
1245 |
-
}
|
1246 |
-
|
1247 |
-
//Grab Cursor
|
1248 |
-
if (params.grabCursor) {
|
1249 |
-
_this.container.style.cursor = 'move';
|
1250 |
-
_this.container.style.cursor = 'grabbing';
|
1251 |
-
_this.container.style.cursor = '-moz-grabbin';
|
1252 |
-
_this.container.style.cursor = '-webkit-grabbing';
|
1253 |
-
}
|
1254 |
-
//Velocity
|
1255 |
-
if (!velocityPrevPosition) velocityPrevPosition = _this.touches.current;
|
1256 |
-
if (!velocityPrevTime) velocityPrevTime = (new Date).getTime();
|
1257 |
-
_this.velocity = (_this.touches.current - velocityPrevPosition) / ((new Date).getTime() - velocityPrevTime) / 2;
|
1258 |
-
if (Math.abs(_this.touches.current - velocityPrevPosition) < 2) _this.velocity = 0;
|
1259 |
-
velocityPrevPosition = _this.touches.current;
|
1260 |
-
velocityPrevTime = (new Date).getTime();
|
1261 |
-
//Callbacks
|
1262 |
-
_this.callPlugins('onTouchMoveEnd');
|
1263 |
-
if (params.onTouchMove) params.onTouchMove(_this);
|
1264 |
-
|
1265 |
-
return false;
|
1266 |
-
}
|
1267 |
-
}
|
1268 |
-
|
1269 |
-
function onTouchEnd(event) {
|
1270 |
-
//Check For scrolling
|
1271 |
-
if (isScrolling) {
|
1272 |
-
_this.swipeReset();
|
1273 |
-
}
|
1274 |
-
// If slider is not touched exit
|
1275 |
-
if (params.onlyExternal || !_this.isTouched) return;
|
1276 |
-
_this.isTouched = false
|
1277 |
-
|
1278 |
-
//Return Grab Cursor
|
1279 |
-
if (params.grabCursor) {
|
1280 |
-
_this.container.style.cursor = 'move';
|
1281 |
-
_this.container.style.cursor = 'grab';
|
1282 |
-
_this.container.style.cursor = '-moz-grab';
|
1283 |
-
_this.container.style.cursor = '-webkit-grab';
|
1284 |
-
}
|
1285 |
-
|
1286 |
-
//Check for Current Position
|
1287 |
-
if (!_this.positions.current && _this.positions.current !== 0) {
|
1288 |
-
_this.positions.current = _this.positions.start
|
1289 |
-
}
|
1290 |
-
|
1291 |
-
//For case if slider touched but not moved
|
1292 |
-
if (params.followFinger) {
|
1293 |
-
if (isH) _this.setWrapperTranslate(_this.positions.current, 0, 0)
|
1294 |
-
else _this.setWrapperTranslate(0, _this.positions.current, 0)
|
1295 |
-
}
|
1296 |
-
//--
|
1297 |
-
|
1298 |
-
// TouchEndTime
|
1299 |
-
_this.times.end = (new Date()).getTime();
|
1300 |
-
|
1301 |
-
//Difference
|
1302 |
-
_this.touches.diff = _this.touches.current - _this.touches.start
|
1303 |
-
_this.touches.abs = Math.abs(_this.touches.diff)
|
1304 |
-
|
1305 |
-
_this.positions.diff = _this.positions.current - _this.positions.start
|
1306 |
-
_this.positions.abs = Math.abs(_this.positions.diff)
|
1307 |
-
|
1308 |
-
var diff = _this.positions.diff;
|
1309 |
-
var diffAbs = _this.positions.abs;
|
1310 |
-
var timeDiff = _this.times.end - _this.times.start
|
1311 |
-
|
1312 |
-
if (diffAbs < 5 && (timeDiff) < 300 && _this.allowLinks == false) {
|
1313 |
-
if (!params.freeMode && diffAbs != 0) _this.swipeReset()
|
1314 |
-
//Release inner links
|
1315 |
-
if (params.preventLinks) {
|
1316 |
-
_this.allowLinks = true;
|
1317 |
-
}
|
1318 |
-
if (params.onSlideClick) {
|
1319 |
-
_this.allowSlideClick = true;
|
1320 |
-
}
|
1321 |
-
}
|
1322 |
-
setTimeout(function () {
|
1323 |
-
//Release inner links
|
1324 |
-
if (params.preventLinks) {
|
1325 |
-
_this.allowLinks = true;
|
1326 |
-
}
|
1327 |
-
if (params.onSlideClick) {
|
1328 |
-
_this.allowSlideClick = true;
|
1329 |
-
}
|
1330 |
-
}, 100)
|
1331 |
-
|
1332 |
-
|
1333 |
-
//Exit if not moved
|
1334 |
-
if (!_this.isMoved) {
|
1335 |
-
_this.isMoved = false;
|
1336 |
-
if (params.onTouchEnd) params.onTouchEnd(_this)
|
1337 |
-
_this.callPlugins('onTouchEnd');
|
1338 |
-
return;
|
1339 |
-
}
|
1340 |
-
_this.isMoved = false;
|
1341 |
-
|
1342 |
-
var maxPosition = maxWrapperPosition();
|
1343 |
-
|
1344 |
-
//Prevent Negative Back Sliding
|
1345 |
-
if (_this.positions.current > 0) {
|
1346 |
-
_this.swipeReset()
|
1347 |
-
if (params.onTouchEnd) params.onTouchEnd(_this)
|
1348 |
-
_this.callPlugins('onTouchEnd');
|
1349 |
-
return;
|
1350 |
-
}
|
1351 |
-
//Prevent After-End Sliding
|
1352 |
-
if (_this.positions.current < -maxPosition) {
|
1353 |
-
_this.swipeReset()
|
1354 |
-
if (params.onTouchEnd) params.onTouchEnd(_this)
|
1355 |
-
_this.callPlugins('onTouchEnd');
|
1356 |
-
return;
|
1357 |
-
}
|
1358 |
-
|
1359 |
-
//Free Mode
|
1360 |
-
if (params.freeMode) {
|
1361 |
-
if (params.freeModeFluid) {
|
1362 |
-
var momentumDuration = 1000 * params.momentumRatio;
|
1363 |
-
var momentumDistance = _this.velocity * momentumDuration;
|
1364 |
-
var newPosition = _this.positions.current + momentumDistance
|
1365 |
-
var doBounce = false;
|
1366 |
-
var afterBouncePosition;
|
1367 |
-
var bounceAmount = Math.abs(_this.velocity) * 20 * params.momentumBounceRatio;
|
1368 |
-
if (newPosition < -maxPosition) {
|
1369 |
-
if (params.momentumBounce && _this.support.transitions) {
|
1370 |
-
if (newPosition + maxPosition < -bounceAmount) newPosition = -maxPosition - bounceAmount;
|
1371 |
-
afterBouncePosition = -maxPosition;
|
1372 |
-
doBounce = true;
|
1373 |
-
allowMomentumBounce = true;
|
1374 |
-
} else newPosition = -maxPosition;
|
1375 |
-
}
|
1376 |
-
if (newPosition > 0) {
|
1377 |
-
if (params.momentumBounce && _this.support.transitions) {
|
1378 |
-
if (newPosition > bounceAmount) newPosition = bounceAmount;
|
1379 |
-
afterBouncePosition = 0
|
1380 |
-
doBounce = true;
|
1381 |
-
allowMomentumBounce = true;
|
1382 |
-
} else newPosition = 0;
|
1383 |
-
}
|
1384 |
-
//Fix duration
|
1385 |
-
if (_this.velocity != 0) momentumDuration = Math.abs((newPosition - _this.positions.current) / _this.velocity)
|
1386 |
-
|
1387 |
-
if (isH) _this.setWrapperTranslate(newPosition, 0, 0);
|
1388 |
-
else _this.setWrapperTranslate(0, newPosition, 0);
|
1389 |
-
|
1390 |
-
_this.setWrapperTransition(momentumDuration);
|
1391 |
-
|
1392 |
-
if (params.momentumBounce && doBounce) {
|
1393 |
-
_this.wrapperTransitionEnd(function () {
|
1394 |
-
if (!allowMomentumBounce) return;
|
1395 |
-
if (params.onMomentumBounce) params.onMomentumBounce(_this);
|
1396 |
-
if (isH) _this.setWrapperTranslate(afterBouncePosition, 0, 0);
|
1397 |
-
else _this.setWrapperTranslate(0, afterBouncePosition, 0);
|
1398 |
-
_this.setWrapperTransition(300);
|
1399 |
-
})
|
1400 |
-
}
|
1401 |
-
|
1402 |
-
_this.updateActiveSlide(newPosition)
|
1403 |
-
}
|
1404 |
-
if (!params.freeModeFluid || timeDiff >= 300) _this.updateActiveSlide(_this.positions.current)
|
1405 |
-
|
1406 |
-
if (params.onTouchEnd) params.onTouchEnd(_this)
|
1407 |
-
_this.callPlugins('onTouchEnd');
|
1408 |
-
return;
|
1409 |
-
}
|
1410 |
-
|
1411 |
-
//Direction
|
1412 |
-
direction = diff < 0 ? "toNext" : "toPrev"
|
1413 |
-
|
1414 |
-
//Short Touches
|
1415 |
-
if (direction == "toNext" && (timeDiff <= 300)) {
|
1416 |
-
if (diffAbs < 30 || !params.shortSwipes) _this.swipeReset()
|
1417 |
-
else _this.swipeNext(true);
|
1418 |
-
}
|
1419 |
-
|
1420 |
-
if (direction == "toPrev" && (timeDiff <= 300)) {
|
1421 |
-
if (diffAbs < 30 || !params.shortSwipes) _this.swipeReset()
|
1422 |
-
else _this.swipePrev(true);
|
1423 |
-
}
|
1424 |
-
|
1425 |
-
//Long Touches
|
1426 |
-
var targetSlideSize = 0;
|
1427 |
-
if (params.slidesPerView == 'auto') {
|
1428 |
-
//Define current slide's width
|
1429 |
-
var currentPosition = Math.abs(isH ? _this.getWrapperTranslate('x') : _this.getWrapperTranslate('y'));
|
1430 |
-
var slidesOffset = 0;
|
1431 |
-
var _slideSize;
|
1432 |
-
for (var i = 0; i < _this.slides.length; i++) {
|
1433 |
-
_slideSize = isH ? _this.slides[i].getWidth(true) : _this.slides[i].getHeight(true);
|
1434 |
-
slidesOffset += _slideSize;
|
1435 |
-
if (slidesOffset > currentPosition) {
|
1436 |
-
targetSlideSize = _slideSize;
|
1437 |
-
break;
|
1438 |
-
}
|
1439 |
-
}
|
1440 |
-
if (targetSlideSize > containerSize) targetSlideSize = containerSize;
|
1441 |
-
} else {
|
1442 |
-
targetSlideSize = slideSize * params.slidesPerView;
|
1443 |
-
}
|
1444 |
-
if (direction == "toNext" && (timeDiff > 300)) {
|
1445 |
-
if (diffAbs >= targetSlideSize * 0.5) {
|
1446 |
-
_this.swipeNext(true)
|
1447 |
-
} else {
|
1448 |
-
_this.swipeReset()
|
1449 |
-
}
|
1450 |
-
}
|
1451 |
-
if (direction == "toPrev" && (timeDiff > 300)) {
|
1452 |
-
if (diffAbs >= targetSlideSize * 0.5) {
|
1453 |
-
_this.swipePrev(true);
|
1454 |
-
} else {
|
1455 |
-
_this.swipeReset()
|
1456 |
-
}
|
1457 |
-
}
|
1458 |
-
if (params.onTouchEnd) params.onTouchEnd(_this)
|
1459 |
-
_this.callPlugins('onTouchEnd');
|
1460 |
-
}
|
1461 |
-
|
1462 |
-
/*==================================================
|
1463 |
-
Swipe Functions
|
1464 |
-
====================================================*/
|
1465 |
-
_this.swipeNext = function (internal) {
|
1466 |
-
if (!internal && params.loop) _this.fixLoop();
|
1467 |
-
_this.callPlugins('onSwipeNext');
|
1468 |
-
var currentPosition = isH ? _this.getWrapperTranslate('x') : _this.getWrapperTranslate('y');
|
1469 |
-
var newPosition = currentPosition;
|
1470 |
-
if (params.slidesPerView == 'auto') {
|
1471 |
-
for (var i = 0; i < _this.snapGrid.length; i++) {
|
1472 |
-
if (-currentPosition >= _this.snapGrid[i] && -currentPosition < _this.snapGrid[i + 1]) {
|
1473 |
-
newPosition = -_this.snapGrid[i + 1]
|
1474 |
-
break;
|
1475 |
-
}
|
1476 |
-
}
|
1477 |
-
} else {
|
1478 |
-
var groupSize = slideSize * params.slidesPerGroup;
|
1479 |
-
newPosition = -(Math.floor(Math.abs(currentPosition) / Math.floor(groupSize)) * groupSize + groupSize);
|
1480 |
-
}
|
1481 |
-
if (newPosition < -maxWrapperPosition()) {
|
1482 |
-
newPosition = -maxWrapperPosition()
|
1483 |
-
};
|
1484 |
-
|
1485 |
-
if (newPosition == currentPosition) return false;
|
1486 |
-
|
1487 |
-
swipeToPosition(newPosition, 'next');
|
1488 |
-
return true
|
1489 |
-
}
|
1490 |
-
_this.swipePrev = function (internal) {
|
1491 |
-
if (!internal && params.loop) _this.fixLoop();
|
1492 |
-
if (!internal && params.autoplay) _this.stopAutoplay();
|
1493 |
-
_this.callPlugins('onSwipePrev');
|
1494 |
-
|
1495 |
-
var currentPosition = Math.ceil(isH ? _this.getWrapperTranslate('x') : _this.getWrapperTranslate('y'));
|
1496 |
-
var newPosition;
|
1497 |
-
if (params.slidesPerView == 'auto') {
|
1498 |
-
newPosition = 0;
|
1499 |
-
for (var i = 1; i < _this.snapGrid.length; i++) {
|
1500 |
-
if (-currentPosition == _this.snapGrid[i]) {
|
1501 |
-
newPosition = -_this.snapGrid[i - 1]
|
1502 |
-
break;
|
1503 |
-
}
|
1504 |
-
if (-currentPosition > _this.snapGrid[i] && -currentPosition < _this.snapGrid[i + 1]) {
|
1505 |
-
newPosition = -_this.snapGrid[i]
|
1506 |
-
break;
|
1507 |
-
}
|
1508 |
-
}
|
1509 |
-
} else {
|
1510 |
-
var groupSize = slideSize * params.slidesPerGroup;
|
1511 |
-
newPosition = -(Math.ceil(-currentPosition / groupSize) - 1) * groupSize;
|
1512 |
-
}
|
1513 |
-
|
1514 |
-
if (newPosition > 0) newPosition = 0;
|
1515 |
-
|
1516 |
-
if (newPosition == currentPosition) return false;
|
1517 |
-
swipeToPosition(newPosition, 'prev');
|
1518 |
-
return true;
|
1519 |
-
|
1520 |
-
}
|
1521 |
-
_this.swipeReset = function () {
|
1522 |
-
_this.callPlugins('onSwipeReset');
|
1523 |
-
var currentPosition = isH ? _this.getWrapperTranslate('x') : _this.getWrapperTranslate('y');
|
1524 |
-
var groupSize = slideSize * params.slidesPerGroup;
|
1525 |
-
var newPosition;
|
1526 |
-
var maxPosition = -maxWrapperPosition();
|
1527 |
-
if (params.slidesPerView == 'auto') {
|
1528 |
-
newPosition = 0;
|
1529 |
-
for (var i = 0; i < _this.snapGrid.length; i++) {
|
1530 |
-
if (-currentPosition === _this.snapGrid[i]) return;
|
1531 |
-
if (-currentPosition >= _this.snapGrid[i] && -currentPosition < _this.snapGrid[i + 1]) {
|
1532 |
-
if (_this.positions.diff > 0) newPosition = -_this.snapGrid[i + 1]
|
1533 |
-
else newPosition = -_this.snapGrid[i]
|
1534 |
-
break;
|
1535 |
-
}
|
1536 |
-
}
|
1537 |
-
if (-currentPosition >= _this.snapGrid[_this.snapGrid.length - 1]) newPosition = -_this.snapGrid[_this.snapGrid.length - 1];
|
1538 |
-
if (currentPosition <= -maxWrapperPosition()) newPosition = -maxWrapperPosition()
|
1539 |
-
} else {
|
1540 |
-
newPosition = currentPosition < 0 ? Math.round(currentPosition / groupSize) * groupSize : 0
|
1541 |
-
}
|
1542 |
-
if (params.scrollContainer) {
|
1543 |
-
newPosition = currentPosition < 0 ? currentPosition : 0;
|
1544 |
-
}
|
1545 |
-
if (newPosition < -maxWrapperPosition()) {
|
1546 |
-
newPosition = -maxWrapperPosition()
|
1547 |
-
}
|
1548 |
-
if (params.scrollContainer && (containerSize > slideSize)) {
|
1549 |
-
newPosition = 0;
|
1550 |
-
}
|
1551 |
-
|
1552 |
-
if (newPosition == currentPosition) return false;
|
1553 |
-
|
1554 |
-
swipeToPosition(newPosition, 'reset');
|
1555 |
-
return true;
|
1556 |
-
}
|
1557 |
-
_this.swipeTo = function (index, speed, runCallbacks) {
|
1558 |
-
index = parseInt(index, 10);
|
1559 |
-
_this.callPlugins('onSwipeTo', {
|
1560 |
-
index: index,
|
1561 |
-
speed: speed
|
1562 |
-
});
|
1563 |
-
if (params.loop) index = index + _this.loopedSlides;
|
1564 |
-
var currentPosition = isH ? _this.getWrapperTranslate('x') : _this.getWrapperTranslate('y');
|
1565 |
-
if (index > (_this.slides.length - 1)) return;
|
1566 |
-
if (index < 0) return;
|
1567 |
-
var newPosition
|
1568 |
-
if (params.slidesPerView == 'auto') {
|
1569 |
-
newPosition = -_this.slidesGrid[index];
|
1570 |
-
} else {
|
1571 |
-
newPosition = -index * slideSize;
|
1572 |
-
}
|
1573 |
-
if (newPosition < -maxWrapperPosition()) {
|
1574 |
-
newPosition = -maxWrapperPosition();
|
1575 |
-
};
|
1576 |
-
|
1577 |
-
if (newPosition == currentPosition) return false;
|
1578 |
-
|
1579 |
-
runCallbacks = runCallbacks === false ? false : true;
|
1580 |
-
swipeToPosition(newPosition, 'to', {
|
1581 |
-
index: index,
|
1582 |
-
speed: speed,
|
1583 |
-
runCallbacks: runCallbacks
|
1584 |
-
});
|
1585 |
-
return true;
|
1586 |
-
}
|
1587 |
-
|
1588 |
-
function swipeToPosition(newPosition, action, toOptions) {
|
1589 |
-
if (_this.support.transitions || !params.DOMAnimation) {
|
1590 |
-
if (isH) _this.setWrapperTranslate(newPosition, 0, 0);
|
1591 |
-
else _this.setWrapperTranslate(0, newPosition, 0);
|
1592 |
-
var speed = (action == 'to' && toOptions.speed >= 0) ? toOptions.speed : params.speed;
|
1593 |
-
_this.setWrapperTransition(speed);
|
1594 |
-
} else {
|
1595 |
-
//Try the DOM animation
|
1596 |
-
var currentPosition = isH ? _this.getWrapperTranslate('x') : _this.getWrapperTranslate('y');
|
1597 |
-
var speed = (action == 'to' && toOptions.speed >= 0) ? toOptions.speed : params.speed;
|
1598 |
-
var animationStep = Math.ceil((newPosition - currentPosition) / speed * (1000 / 60));
|
1599 |
-
var direction = currentPosition > newPosition ? 'toNext' : 'toPrev';
|
1600 |
-
var condition = direction == 'toNext' ? currentPosition > newPosition : currentPosition < newPosition;
|
1601 |
-
if (_this._DOMAnimating) return;
|
1602 |
-
|
1603 |
-
anim()
|
1604 |
-
}
|
1605 |
-
|
1606 |
-
function anim() {
|
1607 |
-
currentPosition += animationStep;
|
1608 |
-
condition = direction == 'toNext' ? currentPosition > newPosition : currentPosition < newPosition;
|
1609 |
-
if (condition) {
|
1610 |
-
if (isH) _this.setWrapperTranslate(Math.round(currentPosition), 0)
|
1611 |
-
else _this.setWrapperTranslate(0, Math.round(currentPosition))
|
1612 |
-
_this._DOMAnimating = true
|
1613 |
-
window.setTimeout(function () {
|
1614 |
-
anim()
|
1615 |
-
}, 1000 / 60)
|
1616 |
-
} else {
|
1617 |
-
if (params.onSlideChangeEnd) params.onSlideChangeEnd(_this)
|
1618 |
-
if (isH) _this.setWrapperTranslate(newPosition, 0);
|
1619 |
-
else _this.setWrapperTranslate(0, newPosition);
|
1620 |
-
_this._DOMAnimating = false;
|
1621 |
-
}
|
1622 |
-
}
|
1623 |
-
|
1624 |
-
//Update Active Slide Index
|
1625 |
-
_this.updateActiveSlide(newPosition);
|
1626 |
-
|
1627 |
-
//Callbacks
|
1628 |
-
if (params.onSlideNext && action == 'next') {
|
1629 |
-
params.onSlideNext(_this, newPosition)
|
1630 |
-
}
|
1631 |
-
if (params.onSlidePrev && action == 'prev') {
|
1632 |
-
params.onSlidePrev(_this, newPosition)
|
1633 |
-
}
|
1634 |
-
//"Reset" Callback
|
1635 |
-
if (params.onSlideReset && action == 'reset') {
|
1636 |
-
params.onSlideReset(_this, newPosition)
|
1637 |
-
}
|
1638 |
-
|
1639 |
-
//"Next", "Prev" and "To" Callbacks
|
1640 |
-
if (action == 'next' || action == 'prev' || (action == 'to' && toOptions.runCallbacks == true)) slideChangeCallbacks()
|
1641 |
-
}
|
1642 |
-
/*==================================================
|
1643 |
-
Transition Callbacks
|
1644 |
-
====================================================*/
|
1645 |
-
//Prevent Multiple Callbacks
|
1646 |
-
_this._queueStartCallbacks = false;
|
1647 |
-
_this._queueEndCallbacks = false;
|
1648 |
-
|
1649 |
-
function slideChangeCallbacks() {
|
1650 |
-
//Transition Start Callback
|
1651 |
-
_this.callPlugins('onSlideChangeStart');
|
1652 |
-
if (params.onSlideChangeStart) {
|
1653 |
-
if (params.queueStartCallbacks && _this.support.transitions) {
|
1654 |
-
if (_this._queueStartCallbacks) return;
|
1655 |
-
_this._queueStartCallbacks = true;
|
1656 |
-
params.onSlideChangeStart(_this)
|
1657 |
-
_this.wrapperTransitionEnd(function () {
|
1658 |
-
_this._queueStartCallbacks = false;
|
1659 |
-
})
|
1660 |
-
} else params.onSlideChangeStart(_this)
|
1661 |
-
}
|
1662 |
-
//Transition End Callback
|
1663 |
-
if (params.onSlideChangeEnd) {
|
1664 |
-
if (_this.support.transitions) {
|
1665 |
-
if (params.queueEndCallbacks) {
|
1666 |
-
if (_this._queueEndCallbacks) return;
|
1667 |
-
_this._queueEndCallbacks = true;
|
1668 |
-
_this.wrapperTransitionEnd(params.onSlideChangeEnd)
|
1669 |
-
} else _this.wrapperTransitionEnd(params.onSlideChangeEnd)
|
1670 |
-
} else {
|
1671 |
-
if (!params.DOMAnimation) {
|
1672 |
-
setTimeout(function () {
|
1673 |
-
params.onSlideChangeEnd(_this)
|
1674 |
-
}, 10)
|
1675 |
-
}
|
1676 |
-
}
|
1677 |
-
}
|
1678 |
-
}
|
1679 |
-
/*==================================================
|
1680 |
-
Update Active Slide Index
|
1681 |
-
====================================================*/
|
1682 |
-
_this.updateActiveSlide = function (position) {
|
1683 |
-
if (!_this.initialized) return;
|
1684 |
-
if (_this.slides.length == 0) return;
|
1685 |
-
_this.previousIndex = _this.activeIndex;
|
1686 |
-
if (position > 0) position = 0;
|
1687 |
-
if (typeof position == 'undefined') position = isH ? _this.getWrapperTranslate('x') : _this.getWrapperTranslate('y');
|
1688 |
-
|
1689 |
-
if (params.slidesPerView == 'auto') {
|
1690 |
-
var slidesOffset = 0;
|
1691 |
-
_this.activeIndex = _this.slidesGrid.indexOf(-position);
|
1692 |
-
if (_this.activeIndex < 0) {
|
1693 |
-
for (var i = 0; i < _this.slidesGrid.length - 1; i++) {
|
1694 |
-
if (-position > _this.slidesGrid[i] && -position < _this.slidesGrid[i + 1]) {
|
1695 |
-
break;
|
1696 |
-
}
|
1697 |
-
}
|
1698 |
-
var leftDistance = Math.abs(_this.slidesGrid[i] + position)
|
1699 |
-
var rightDistance = Math.abs(_this.slidesGrid[i + 1] + position)
|
1700 |
-
if (leftDistance <= rightDistance) _this.activeIndex = i;
|
1701 |
-
else _this.activeIndex = i + 1;
|
1702 |
-
}
|
1703 |
-
} else {
|
1704 |
-
if (params.visibilityFullFit) _this.activeIndex = Math.ceil(-position / slideSize);
|
1705 |
-
else _this.activeIndex = Math.round(-position / slideSize);
|
1706 |
-
}
|
1707 |
-
if (_this.activeIndex == _this.slides.length) _this.activeIndex = _this.slides.length - 1;
|
1708 |
-
if (_this.activeIndex < 0) _this.activeIndex = 0;
|
1709 |
-
// Check for slide
|
1710 |
-
if (!_this.slides[_this.activeIndex]) return;
|
1711 |
-
// Calc Visible slides
|
1712 |
-
_this.calcVisibleSlides(position);
|
1713 |
-
|
1714 |
-
// Mark visible and active slides with additonal classes
|
1715 |
-
var activeClassRegexp = new RegExp("\\s*" + params.slideActiveClass);
|
1716 |
-
var inViewClassRegexp = new RegExp("\\s*" + params.slideVisibleClass);
|
1717 |
-
|
1718 |
-
for (var i = 0; i < _this.slides.length; i++) {
|
1719 |
-
_this.slides[i].className = _this.slides[i].className.replace(activeClassRegexp, '').replace(inViewClassRegexp, '');
|
1720 |
-
if (_this.visibleSlides.indexOf(_this.slides[i]) >= 0) {
|
1721 |
-
_this.slides[i].className += ' ' + params.slideVisibleClass;
|
1722 |
-
}
|
1723 |
-
|
1724 |
-
}
|
1725 |
-
_this.slides[_this.activeIndex].className += ' ' + params.slideActiveClass;
|
1726 |
-
|
1727 |
-
//Update loop index
|
1728 |
-
if (params.loop) {
|
1729 |
-
var ls = _this.loopedSlides;
|
1730 |
-
_this.activeLoopIndex = _this.activeIndex - ls;
|
1731 |
-
if (_this.activeLoopIndex >= _this.slides.length - ls * 2) {
|
1732 |
-
_this.activeLoopIndex = _this.slides.length - ls * 2 - _this.activeLoopIndex;
|
1733 |
-
}
|
1734 |
-
if (_this.activeLoopIndex < 0) {
|
1735 |
-
_this.activeLoopIndex = _this.slides.length - ls * 2 + _this.activeLoopIndex;
|
1736 |
-
}
|
1737 |
-
} else {
|
1738 |
-
_this.activeLoopIndex = _this.activeIndex;
|
1739 |
-
}
|
1740 |
-
//Update Pagination
|
1741 |
-
if (params.pagination) {
|
1742 |
-
_this.updatePagination(position);
|
1743 |
-
}
|
1744 |
-
}
|
1745 |
-
/*==================================================
|
1746 |
-
Pagination
|
1747 |
-
====================================================*/
|
1748 |
-
_this.createPagination = function (firstInit) {
|
1749 |
-
if (params.paginationClickable && _this.paginationButtons) {
|
1750 |
-
removePaginationEvents();
|
1751 |
-
}
|
1752 |
-
var paginationHTML = "";
|
1753 |
-
var numOfSlides = _this.slides.length;
|
1754 |
-
var numOfButtons = numOfSlides;
|
1755 |
-
if (params.loop) numOfButtons -= _this.loopedSlides * 2
|
1756 |
-
for (var i = 0; i < numOfButtons; i++) {
|
1757 |
-
paginationHTML += '<' + params.paginationElement + ' class="' + params.paginationElementClass + '"></' + params.paginationElement + '>'
|
1758 |
-
}
|
1759 |
-
_this.paginationContainer = params.pagination.nodeType ? params.pagination : $$(params.pagination)[0];
|
1760 |
-
_this.paginationContainer.innerHTML = paginationHTML;
|
1761 |
-
_this.paginationButtons = []
|
1762 |
-
if (document.querySelectorAll) _this.paginationButtons = _this.paginationContainer.querySelectorAll('.' + params.paginationElementClass);
|
1763 |
-
else if (window.jQuery) _this.paginationButtons = $$(_this.paginationContainer).find('.' + params.paginationElementClass);
|
1764 |
-
|
1765 |
-
if (!firstInit) _this.updatePagination()
|
1766 |
-
_this.callPlugins('onCreatePagination');
|
1767 |
-
if (params.paginationClickable) {
|
1768 |
-
addPaginationEvents();
|
1769 |
-
}
|
1770 |
-
}
|
1771 |
-
|
1772 |
-
function removePaginationEvents() {
|
1773 |
-
var pagers = _this.paginationButtons;
|
1774 |
-
for (var i = 0; i < pagers.length; i++) {
|
1775 |
-
_this.h.removeEventListener(pagers[i], 'click', paginationClick, false)
|
1776 |
-
}
|
1777 |
-
}
|
1778 |
-
|
1779 |
-
function addPaginationEvents() {
|
1780 |
-
var pagers = _this.paginationButtons;
|
1781 |
-
for (var i = 0; i < pagers.length; i++) {
|
1782 |
-
_this.h.addEventListener(pagers[i], 'click', paginationClick, false)
|
1783 |
-
}
|
1784 |
-
}
|
1785 |
-
|
1786 |
-
function paginationClick(e) {
|
1787 |
-
var index;
|
1788 |
-
var target = e.target || e.srcElement;
|
1789 |
-
var pagers = _this.paginationButtons;
|
1790 |
-
for (var i = 0; i < pagers.length; i++) {
|
1791 |
-
if (target === pagers[i]) index = i;
|
1792 |
-
}
|
1793 |
-
_this.swipeTo(index)
|
1794 |
-
}
|
1795 |
-
_this.updatePagination = function (position) {
|
1796 |
-
if (_this.slides.length < 1) return;
|
1797 |
-
|
1798 |
-
if (document.querySelectorAll) var activePagers = _this.paginationContainer.querySelectorAll('.' + params.paginationActiveClass)
|
1799 |
-
else if (window.jQuery) var activePagers = $$(_this.paginationContainer).find('.' + params.paginationActiveClass);
|
1800 |
-
|
1801 |
-
if (!activePagers) return
|
1802 |
-
//Reset all Buttons' class to not active
|
1803 |
-
var pagers = _this.paginationButtons;
|
1804 |
-
for (var i = 0; i < pagers.length; i++) {
|
1805 |
-
pagers[i].className = params.paginationElementClass
|
1806 |
-
}
|
1807 |
-
var indexOffset = params.loop ? _this.loopedSlides : 0;
|
1808 |
-
if (params.paginationAsRange) {
|
1809 |
-
if (!_this.visibleSlides) _this.calcVisibleSlides(position)
|
1810 |
-
//Get Visible Indexes
|
1811 |
-
var visibleIndexes = [];
|
1812 |
-
for (var i = 0; i < _this.visibleSlides.length; i++) {
|
1813 |
-
var visIndex = _this.slides.indexOf(_this.visibleSlides[i]) - indexOffset
|
1814 |
-
|
1815 |
-
if (params.loop && visIndex < 0) {
|
1816 |
-
visIndex = _this.slides.length - _this.loopedSlides * 2 + visIndex;
|
1817 |
-
}
|
1818 |
-
if (params.loop && visIndex >= _this.slides.length - _this.loopedSlides * 2) {
|
1819 |
-
visIndex = _this.slides.length - _this.loopedSlides * 2 - visIndex;
|
1820 |
-
visIndex = Math.abs(visIndex)
|
1821 |
-
}
|
1822 |
-
visibleIndexes.push(visIndex)
|
1823 |
-
}
|
1824 |
-
for (i = 0; i < visibleIndexes.length; i++) {
|
1825 |
-
if (pagers[visibleIndexes[i]]) pagers[visibleIndexes[i]].className += ' ' + params.paginationVisibleClass;
|
1826 |
-
}
|
1827 |
-
if (params.loop) {
|
1828 |
-
pagers[_this.activeLoopIndex].className += ' ' + params.paginationActiveClass;
|
1829 |
-
} else {
|
1830 |
-
pagers[_this.activeIndex].className += ' ' + params.paginationActiveClass;
|
1831 |
-
}
|
1832 |
-
} else {
|
1833 |
-
if (params.loop) {
|
1834 |
-
pagers[_this.activeLoopIndex].className += ' ' + params.paginationActiveClass + ' ' + params.paginationVisibleClass;
|
1835 |
-
} else {
|
1836 |
-
pagers[_this.activeIndex].className += ' ' + params.paginationActiveClass + ' ' + params.paginationVisibleClass;
|
1837 |
-
}
|
1838 |
-
|
1839 |
-
}
|
1840 |
-
|
1841 |
-
}
|
1842 |
-
_this.calcVisibleSlides = function (position) {
|
1843 |
-
var visibleSlides = [];
|
1844 |
-
var _slideLeft = 0,
|
1845 |
-
_slideSize = 0,
|
1846 |
-
_slideRight = 0;
|
1847 |
-
if (isH && _this.wrapperLeft > 0) position = position + _this.wrapperLeft;
|
1848 |
-
if (!isH && _this.wrapperTop > 0) position = position + _this.wrapperTop;
|
1849 |
-
|
1850 |
-
for (var i = 0; i < _this.slides.length; i++) {
|
1851 |
-
_slideLeft += _slideSize;
|
1852 |
-
if (params.slidesPerView == 'auto') _slideSize = isH ? _this.h.getWidth(_this.slides[i], true) : _this.h.getHeight(_this.slides[i], true);
|
1853 |
-
else _slideSize = slideSize;
|
1854 |
-
|
1855 |
-
_slideRight = _slideLeft + _slideSize;
|
1856 |
-
var isVisibile = false;
|
1857 |
-
if (params.visibilityFullFit) {
|
1858 |
-
if (_slideLeft >= -position && _slideRight <= -position + containerSize) isVisibile = true;
|
1859 |
-
if (_slideLeft <= -position && _slideRight >= -position + containerSize) isVisibile = true;
|
1860 |
-
} else {
|
1861 |
-
|
1862 |
-
if (_slideRight > -position && _slideRight <= ((-position + containerSize))) isVisibile = true;
|
1863 |
-
if (_slideLeft >= -position && _slideLeft < ((-position + containerSize))) isVisibile = true;
|
1864 |
-
if (_slideLeft < -position && _slideRight > ((-position + containerSize))) isVisibile = true;
|
1865 |
-
}
|
1866 |
-
|
1867 |
-
if (isVisibile) visibleSlides.push(_this.slides[i])
|
1868 |
-
|
1869 |
-
}
|
1870 |
-
if (visibleSlides.length == 0) visibleSlides = [_this.slides[_this.activeIndex]]
|
1871 |
-
|
1872 |
-
_this.visibleSlides = visibleSlides;
|
1873 |
-
}
|
1874 |
-
|
1875 |
-
/*==========================================
|
1876 |
-
Autoplay
|
1877 |
-
============================================*/
|
1878 |
-
_this.autoPlayIntervalId = undefined;
|
1879 |
-
_this.startAutoplay = function () {
|
1880 |
-
if (typeof _this.autoPlayIntervalId !== 'undefined') return false;
|
1881 |
-
if (params.autoplay && !params.loop) {
|
1882 |
-
_this.autoPlayIntervalId = setInterval(function () {
|
1883 |
-
if (!_this.swipeNext(true)) _this.swipeTo(0);
|
1884 |
-
}, params.autoplay)
|
1885 |
-
}
|
1886 |
-
if (params.autoplay && params.loop) {
|
1887 |
-
_this.autoPlayIntervalId = setInterval(function () {
|
1888 |
-
_this.swipeNext();
|
1889 |
-
}, params.autoplay)
|
1890 |
-
}
|
1891 |
-
_this.callPlugins('onAutoplayStart');
|
1892 |
-
}
|
1893 |
-
_this.stopAutoplay = function () {
|
1894 |
-
if (_this.autoPlayIntervalId) clearInterval(_this.autoPlayIntervalId);
|
1895 |
-
_this.autoPlayIntervalId = undefined;
|
1896 |
-
_this.callPlugins('onAutoplayStop');
|
1897 |
-
}
|
1898 |
-
/*==================================================
|
1899 |
-
Loop
|
1900 |
-
====================================================*/
|
1901 |
-
_this.loopCreated = false;
|
1902 |
-
_this.removeLoopedSlides = function () {
|
1903 |
-
if (_this.loopCreated) {
|
1904 |
-
for (var i = 0; i < _this.slides.length; i++) {
|
1905 |
-
if (_this.slides[i].getData('looped') === true) _this.wrapper.removeChild(_this.slides[i]);
|
1906 |
-
}
|
1907 |
-
}
|
1908 |
-
}
|
1909 |
-
_this.createLoop = function () {
|
1910 |
-
if (_this.slides.length == 0) return;
|
1911 |
-
_this.loopedSlides = params.slidesPerView + params.loopAdditionalSlides;
|
1912 |
-
|
1913 |
-
var slideFirstHTML = '';
|
1914 |
-
var slideLastHTML = '';
|
1915 |
-
|
1916 |
-
//Grab First Slides
|
1917 |
-
for (var i = 0; i < _this.loopedSlides; i++) {
|
1918 |
-
slideFirstHTML += _this.slides[i].outerHTML
|
1919 |
-
}
|
1920 |
-
//Grab Last Slides
|
1921 |
-
for (i = _this.slides.length - _this.loopedSlides; i < _this.slides.length; i++) {
|
1922 |
-
slideLastHTML += _this.slides[i].outerHTML
|
1923 |
-
}
|
1924 |
-
wrapper.innerHTML = slideLastHTML + wrapper.innerHTML + slideFirstHTML;
|
1925 |
-
|
1926 |
-
_this.loopCreated = true;
|
1927 |
-
_this.calcSlides();
|
1928 |
-
|
1929 |
-
//Update Looped Slides with special class
|
1930 |
-
for (i = 0; i < _this.slides.length; i++) {
|
1931 |
-
if (i < _this.loopedSlides || i >= _this.slides.length - _this.loopedSlides) _this.slides[i].setData('looped', true);
|
1932 |
-
}
|
1933 |
-
_this.callPlugins('onCreateLoop');
|
1934 |
-
|
1935 |
-
}
|
1936 |
-
_this.fixLoop = function () {
|
1937 |
-
//Fix For Negative Oversliding
|
1938 |
-
if (_this.activeIndex < _this.loopedSlides) {
|
1939 |
-
var newIndex = _this.slides.length - _this.loopedSlides * 3 + _this.activeIndex;
|
1940 |
-
_this.swipeTo(newIndex, 0, false)
|
1941 |
-
}
|
1942 |
-
//Fix For Positive Oversliding
|
1943 |
-
else if (_this.activeIndex > _this.slides.length - params.slidesPerView * 2) {
|
1944 |
-
var newIndex = -_this.slides.length + _this.activeIndex + _this.loopedSlides
|
1945 |
-
_this.swipeTo(newIndex, 0, false)
|
1946 |
-
}
|
1947 |
-
}
|
1948 |
-
/*==================================================
|
1949 |
-
Slides Loader
|
1950 |
-
====================================================*/
|
1951 |
-
_this.loadSlides = function () {
|
1952 |
-
var slidesHTML = '';
|
1953 |
-
_this.activeLoaderIndex = 0;
|
1954 |
-
var slides = params.loader.slides;
|
1955 |
-
var slidesToLoad = params.loader.loadAllSlides ? slides.length : params.slidesPerView * (1 + params.loader.surroundGroups);
|
1956 |
-
for (var i = 0; i < slidesToLoad; i++) {
|
1957 |
-
if (params.loader.slidesHTMLType == 'outer') slidesHTML += slides[i];
|
1958 |
-
else {
|
1959 |
-
slidesHTML += '<' + params.slideElement + ' class="' + params.slideClass + '" data-swiperindex="' + i + '">' + slides[i] + '</' + params.slideElement + '>';
|
1960 |
-
}
|
1961 |
-
}
|
1962 |
-
_this.wrapper.innerHTML = slidesHTML;
|
1963 |
-
_this.calcSlides(true);
|
1964 |
-
//Add permanent transitionEnd callback
|
1965 |
-
if (!params.loader.loadAllSlides) {
|
1966 |
-
_this.wrapperTransitionEnd(_this.reloadSlides, true);
|
1967 |
-
}
|
1968 |
-
}
|
1969 |
-
_this.reloadSlides = function () {
|
1970 |
-
var slides = params.loader.slides;
|
1971 |
-
var newActiveIndex = parseInt(_this.activeSlide().data('swiperindex'), 10)
|
1972 |
-
if (newActiveIndex < 0 || newActiveIndex > slides.length - 1) return //<-- Exit
|
1973 |
-
_this.activeLoaderIndex = newActiveIndex;
|
1974 |
-
var firstIndex = Math.max(0, newActiveIndex - params.slidesPerView * params.loader.surroundGroups)
|
1975 |
-
var lastIndex = Math.min(newActiveIndex + params.slidesPerView * (1 + params.loader.surroundGroups) - 1, slides.length - 1)
|
1976 |
-
//Update Transforms
|
1977 |
-
if (newActiveIndex > 0) {
|
1978 |
-
var newTransform = -slideSize * (newActiveIndex - firstIndex)
|
1979 |
-
if (isH) _this.setWrapperTranslate(newTransform, 0, 0)
|
1980 |
-
else _this.setWrapperTranslate(0, newTransform, 0)
|
1981 |
-
_this.setWrapperTransition(0)
|
1982 |
-
}
|
1983 |
-
//New Slides
|
1984 |
-
if (params.loader.logic === 'reload') {
|
1985 |
-
_this.wrapper.innerHTML = '';
|
1986 |
-
var slidesHTML = '';
|
1987 |
-
for (var i = firstIndex; i <= lastIndex; i++) {
|
1988 |
-
slidesHTML += params.loader.slidesHTMLType == 'outer' ? slides[i] : '<' + params.slideElement + ' class="' + params.slideClass + '" data-swiperindex="' + i + '">' + slides[i] + '</' + params.slideElement + '>';
|
1989 |
-
}
|
1990 |
-
_this.wrapper.innerHTML = slidesHTML;
|
1991 |
-
} else {
|
1992 |
-
var minExistIndex = 1000;
|
1993 |
-
var maxExistIndex = 0;
|
1994 |
-
for (var i = 0; i < _this.slides.length; i++) {
|
1995 |
-
var index = _this.slides[i].data('swiperindex');
|
1996 |
-
if (index < firstIndex || index > lastIndex) {
|
1997 |
-
_this.wrapper.removeChild(_this.slides[i]);
|
1998 |
-
} else {
|
1999 |
-
minExistIndex = Math.min(index, minExistIndex)
|
2000 |
-
maxExistIndex = Math.max(index, maxExistIndex)
|
2001 |
-
}
|
2002 |
-
}
|
2003 |
-
for (var i = firstIndex; i <= lastIndex; i++) {
|
2004 |
-
if (i < minExistIndex) {
|
2005 |
-
var newSlide = document.createElement(params.slideElement);
|
2006 |
-
newSlide.className = params.slideClass;
|
2007 |
-
newSlide.setAttribute('data-swiperindex', i);
|
2008 |
-
newSlide.innerHTML = slides[i];
|
2009 |
-
_this.wrapper.insertBefore(newSlide, _this.wrapper.firstChild);
|
2010 |
-
}
|
2011 |
-
if (i > maxExistIndex) {
|
2012 |
-
var newSlide = document.createElement(params.slideElement);
|
2013 |
-
newSlide.className = params.slideClass;
|
2014 |
-
newSlide.setAttribute('data-swiperindex', i);
|
2015 |
-
newSlide.innerHTML = slides[i];
|
2016 |
-
_this.wrapper.appendChild(newSlide);
|
2017 |
-
}
|
2018 |
-
}
|
2019 |
-
}
|
2020 |
-
//reInit
|
2021 |
-
_this.reInit(true);
|
2022 |
-
}
|
2023 |
-
/*==================================================
|
2024 |
-
Make Swiper
|
2025 |
-
====================================================*/
|
2026 |
-
function makeSwiper() {
|
2027 |
-
_this.calcSlides();
|
2028 |
-
if (params.loader.slides.length > 0 && _this.slides.length == 0) {
|
2029 |
-
_this.loadSlides();
|
2030 |
-
}
|
2031 |
-
if (params.loop) {
|
2032 |
-
_this.createLoop();
|
2033 |
-
}
|
2034 |
-
_this.init();
|
2035 |
-
initEvents();
|
2036 |
-
if (params.pagination && params.createPagination) {
|
2037 |
-
_this.createPagination(true);
|
2038 |
-
}
|
2039 |
-
if (params.loop || params.initialSlide > 0) {
|
2040 |
-
_this.swipeTo(params.initialSlide, 0, false);
|
2041 |
-
} else {
|
2042 |
-
_this.updateActiveSlide(0);
|
2043 |
-
}
|
2044 |
-
if (params.autoplay) {
|
2045 |
-
_this.startAutoplay();
|
2046 |
-
}
|
2047 |
-
|
2048 |
-
}
|
2049 |
-
makeSwiper();
|
2050 |
-
}
|
2051 |
-
|
2052 |
-
Swiper.prototype = {
|
2053 |
-
plugins: {},
|
2054 |
-
/*==================================================
|
2055 |
-
Wrapper Operations
|
2056 |
-
====================================================*/
|
2057 |
-
wrapperTransitionEnd: function (callback, permanent) {
|
2058 |
-
var a = this
|
2059 |
-
var el = a.wrapper
|
2060 |
-
var events = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd', 'MSTransitionEnd', 'msTransitionEnd'];
|
2061 |
-
|
2062 |
-
function fireCallBack() {
|
2063 |
-
callback(a)
|
2064 |
-
if (a.params.queueEndCallbacks) a._queueEndCallbacks = false
|
2065 |
-
if (!permanent) {
|
2066 |
-
for (var i = 0; i < events.length; i++) {
|
2067 |
-
el.removeEventListener(events[i], fireCallBack, false)
|
2068 |
-
}
|
2069 |
-
}
|
2070 |
-
}
|
2071 |
-
if (callback) {
|
2072 |
-
for (var i = 0; i < events.length; i++) {
|
2073 |
-
el.addEventListener(events[i], fireCallBack, false)
|
2074 |
-
}
|
2075 |
-
}
|
2076 |
-
},
|
2077 |
-
|
2078 |
-
getWrapperTranslate: function (axis) {
|
2079 |
-
var el = this.wrapper
|
2080 |
-
var matrix;
|
2081 |
-
var curTransform;
|
2082 |
-
if (window.WebKitCSSMatrix) {
|
2083 |
-
var transformMatrix = new WebKitCSSMatrix(window.getComputedStyle(el, null).webkitTransform)
|
2084 |
-
matrix = transformMatrix.toString().split(',');
|
2085 |
-
} else {
|
2086 |
-
var transformMatrix = window.getComputedStyle(el, null).MozTransform || window.getComputedStyle(el, null).OTransform || window.getComputedStyle(el, null).MsTransform || window.getComputedStyle(el, null).msTransform || window.getComputedStyle(el, null).transform || window.getComputedStyle(el, null).getPropertyValue("transform").replace("translate(", "matrix(1, 0, 0, 1,");
|
2087 |
-
matrix = transformMatrix.toString().split(',');
|
2088 |
-
|
2089 |
-
}
|
2090 |
-
if (this.params.useCSS3Transforms) {
|
2091 |
-
if (axis == 'x') {
|
2092 |
-
//Crazy IE10 Matrix
|
2093 |
-
if (matrix.length == 16) curTransform = parseFloat(matrix[12])
|
2094 |
-
//Latest Chrome and webkits Fix
|
2095 |
-
else if (window.WebKitCSSMatrix) curTransform = transformMatrix.m41
|
2096 |
-
//Normal Browsers
|
2097 |
-
else curTransform = parseFloat(matrix[4])
|
2098 |
-
}
|
2099 |
-
if (axis == 'y') {
|
2100 |
-
//Crazy IE10 Matrix
|
2101 |
-
if (matrix.length == 16) curTransform = parseFloat(matrix[13])
|
2102 |
-
//Latest Chrome and webkits Fix
|
2103 |
-
else if (window.WebKitCSSMatrix) curTransform = transformMatrix.m42
|
2104 |
-
//Normal Browsers
|
2105 |
-
else curTransform = parseFloat(matrix[5])
|
2106 |
-
}
|
2107 |
-
} else {
|
2108 |
-
if (axis == 'x') curTransform = parseFloat(el.style.left, 10) || 0
|
2109 |
-
if (axis == 'y') curTransform = parseFloat(el.style.top, 10) || 0
|
2110 |
-
}
|
2111 |
-
return curTransform || 0;
|
2112 |
-
},
|
2113 |
-
|
2114 |
-
setWrapperTranslate: function (x, y, z) {
|
2115 |
-
var es = this.wrapper.style
|
2116 |
-
x = x || 0;
|
2117 |
-
y = y || 0;
|
2118 |
-
z = z || 0;
|
2119 |
-
if (this.params.useCSS3Transforms) {
|
2120 |
-
if (this.support.transforms3d) {
|
2121 |
-
es.webkitTransform = es.MsTransform = es.msTransform = es.MozTransform = es.OTransform = es.transform = 'translate3d(' + x + 'px, ' + y + 'px, ' + z + 'px)'
|
2122 |
-
} else {
|
2123 |
-
|
2124 |
-
es.webkitTransform = es.MsTransform = es.msTransform = es.MozTransform = es.OTransform = es.transform = 'translate(' + x + 'px, ' + y + 'px)'
|
2125 |
-
if (!this.support.transforms) {
|
2126 |
-
es.left = x + 'px'
|
2127 |
-
es.top = y + 'px'
|
2128 |
-
}
|
2129 |
-
}
|
2130 |
-
} else {
|
2131 |
-
es.left = x + 'px';
|
2132 |
-
es.top = y + 'px';
|
2133 |
-
}
|
2134 |
-
this.callPlugins('onSetWrapperTransform', {
|
2135 |
-
x: x,
|
2136 |
-
y: y,
|
2137 |
-
z: z
|
2138 |
-
})
|
2139 |
-
},
|
2140 |
-
|
2141 |
-
setWrapperTransition: function (duration) {
|
2142 |
-
var es = this.wrapper.style
|
2143 |
-
es.webkitTransitionDuration = es.MsTransitionDuration = es.msTransitionDuration = es.MozTransitionDuration = es.OTransitionDuration = es.transitionDuration = duration / 1000 + 's';
|
2144 |
-
this.callPlugins('onSetWrapperTransition', {
|
2145 |
-
duration: duration
|
2146 |
-
})
|
2147 |
-
},
|
2148 |
-
|
2149 |
-
/*==================================================
|
2150 |
-
Helpers
|
2151 |
-
====================================================*/
|
2152 |
-
h: {
|
2153 |
-
getWidth: function (el, outer) {
|
2154 |
-
var width = window.getComputedStyle(el, null).getPropertyValue('width')
|
2155 |
-
var returnWidth = parseFloat(width);
|
2156 |
-
//IE Fixes
|
2157 |
-
if (isNaN(returnWidth) || width.indexOf('%') > 0) {
|
2158 |
-
returnWidth = el.offsetWidth - parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-left')) - parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-right'));
|
2159 |
-
}
|
2160 |
-
if (outer) returnWidth += parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-left')) + parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-right'))
|
2161 |
-
|
2162 |
-
return returnWidth;
|
2163 |
-
},
|
2164 |
-
getHeight: function (el, outer) {
|
2165 |
-
if (outer) return el.offsetHeight;
|
2166 |
-
|
2167 |
-
var height = window.getComputedStyle(el, null).getPropertyValue('height')
|
2168 |
-
var returnHeight = parseFloat(height);
|
2169 |
-
//IE Fixes
|
2170 |
-
if (isNaN(returnHeight) || height.indexOf('%') > 0) {
|
2171 |
-
returnHeight = el.offsetHeight - parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-top')) - parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-bottom'));
|
2172 |
-
}
|
2173 |
-
if (outer) returnHeight += parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-top')) + parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-bottom'))
|
2174 |
-
return returnHeight;
|
2175 |
-
},
|
2176 |
-
getOffset: function (el) {
|
2177 |
-
var box = el.getBoundingClientRect();
|
2178 |
-
var body = document.body;
|
2179 |
-
var clientTop = el.clientTop || body.clientTop || 0;
|
2180 |
-
var clientLeft = el.clientLeft || body.clientLeft || 0;
|
2181 |
-
var scrollTop = window.pageYOffset || el.scrollTop;
|
2182 |
-
var scrollLeft = window.pageXOffset || el.scrollLeft;
|
2183 |
-
if (document.documentElement && !window.pageYOffset) {
|
2184 |
-
//IE7-8
|
2185 |
-
scrollTop = document.documentElement.scrollTop;
|
2186 |
-
scrollLeft = document.documentElement.scrollLeft;
|
2187 |
-
}
|
2188 |
-
return {
|
2189 |
-
top: box.top + scrollTop - clientTop,
|
2190 |
-
left: box.left + scrollLeft - clientLeft
|
2191 |
-
};
|
2192 |
-
},
|
2193 |
-
windowWidth: function () {
|
2194 |
-
if (window.innerWidth) return window.innerWidth
|
2195 |
-
else if (document.documentElement && document.documentElement.clientWidth) return document.documentElement.clientWidth;
|
2196 |
-
},
|
2197 |
-
windowHeight: function () {
|
2198 |
-
if (window.innerHeight) return window.innerHeight
|
2199 |
-
else if (document.documentElement && document.documentElement.clientHeight) return document.documentElement.clientHeight;
|
2200 |
-
},
|
2201 |
-
windowScroll: function () {
|
2202 |
-
var left = 0,
|
2203 |
-
top = 0;
|
2204 |
-
if (typeof pageYOffset != 'undefined') {
|
2205 |
-
return {
|
2206 |
-
left: window.pageXOffset,
|
2207 |
-
top: window.pageYOffset
|
2208 |
-
}
|
2209 |
-
} else if (document.documentElement) {
|
2210 |
-
return {
|
2211 |
-
left: document.documentElement.scrollLeft,
|
2212 |
-
top: document.documentElement.scrollTop
|
2213 |
-
}
|
2214 |
-
}
|
2215 |
-
},
|
2216 |
-
|
2217 |
-
addEventListener: function (el, event, listener, useCapture) {
|
2218 |
-
if (el.addEventListener) {
|
2219 |
-
el.addEventListener(event, listener, useCapture)
|
2220 |
-
} else if (el.attachEvent) {
|
2221 |
-
el.attachEvent('on' + event, listener)
|
2222 |
-
}
|
2223 |
-
},
|
2224 |
-
removeEventListener: function (el, event, listener, useCapture) {
|
2225 |
-
if (el.removeEventListener) {
|
2226 |
-
el.removeEventListener(event, listener, useCapture)
|
2227 |
-
} else if (el.detachEvent) {
|
2228 |
-
el.detachEvent('on' + event, listener)
|
2229 |
-
}
|
2230 |
-
}
|
2231 |
-
},
|
2232 |
-
setTransform: function (el, transform) {
|
2233 |
-
var es = el.style
|
2234 |
-
es.webkitTransform = es.MsTransform = es.msTransform = es.MozTransform = es.OTransform = es.transform = transform
|
2235 |
-
},
|
2236 |
-
setTranslate: function (el, translate) {
|
2237 |
-
var es = el.style
|
2238 |
-
var pos = {
|
2239 |
-
x: translate.x || 0,
|
2240 |
-
y: translate.y || 0,
|
2241 |
-
z: translate.z || 0
|
2242 |
-
};
|
2243 |
-
var transformString = this.support.transforms3d ? 'translate3d(' + (pos.x) + 'px,' + (pos.y) + 'px,' + (pos.z) + 'px)' : 'translate(' + (pos.x) + 'px,' + (pos.y) + 'px)';
|
2244 |
-
es.webkitTransform = es.MsTransform = es.msTransform = es.MozTransform = es.OTransform = es.transform = transformString;
|
2245 |
-
if (!this.support.transforms) {
|
2246 |
-
es.left = pos.x + 'px'
|
2247 |
-
es.top = pos.y + 'px'
|
2248 |
-
}
|
2249 |
-
},
|
2250 |
-
setTransition: function (el, duration) {
|
2251 |
-
var es = el.style
|
2252 |
-
es.webkitTransitionDuration = es.MsTransitionDuration = es.msTransitionDuration = es.MozTransitionDuration = es.OTransitionDuration = es.transitionDuration = duration + 'ms';
|
2253 |
-
},
|
2254 |
-
/*==================================================
|
2255 |
-
Feature Detection
|
2256 |
-
====================================================*/
|
2257 |
-
support: {
|
2258 |
-
|
2259 |
-
touch: (window.Modernizr && Modernizr.touch === true) || (function () {
|
2260 |
-
return !!(("ontouchstart" in window) || window.DocumentTouch && document instanceof DocumentTouch);
|
2261 |
-
})(),
|
2262 |
-
|
2263 |
-
transforms3d: (window.Modernizr && Modernizr.csstransforms3d === true) || (function () {
|
2264 |
-
var div = document.createElement('div');
|
2265 |
-
return ("webkitPerspective" in div.style || "MozPerspective" in div.style || "OPerspective" in div.style || "MsPerspective" in div.style || "perspective" in div.style);
|
2266 |
-
})(),
|
2267 |
-
|
2268 |
-
transforms: (window.Modernizr && Modernizr.csstransforms === true) || (function () {
|
2269 |
-
var div = document.createElement('div').style
|
2270 |
-
return ('transform' in div) || ('WebkitTransform' in div) || ('MozTransform' in div) || ('msTransform' in div) || ('MsTransform' in div) || ('OTransform' in div);
|
2271 |
-
})(),
|
2272 |
-
|
2273 |
-
transitions: (window.Modernizr && Modernizr.csstransitions === true) || (function () {
|
2274 |
-
var div = document.createElement('div').style
|
2275 |
-
return ('transition' in div) || ('WebkitTransition' in div) || ('MozTransition' in div) || ('msTransition' in div) || ('MsTransition' in div) || ('OTransition' in div);
|
2276 |
-
})()
|
2277 |
-
},
|
2278 |
-
|
2279 |
-
browser: {
|
2280 |
-
|
2281 |
-
ie8: (function () {
|
2282 |
-
var rv = -1; // Return value assumes failure.
|
2283 |
-
if (navigator.appName == 'Microsoft Internet Explorer') {
|
2284 |
-
var ua = navigator.userAgent;
|
2285 |
-
var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
|
2286 |
-
if (re.exec(ua) != null) rv = parseFloat(RegExp.$1);
|
2287 |
-
}
|
2288 |
-
return rv != -1 && rv < 9;
|
2289 |
-
})(),
|
2290 |
-
|
2291 |
-
ie10: window.navigator.msPointerEnabled
|
2292 |
-
}
|
2293 |
-
}
|
2294 |
-
|
2295 |
-
/*=========================
|
2296 |
-
jQuery & Zepto Plugins
|
2297 |
-
===========================*/
|
2298 |
-
if (window.jQuery || window.Zepto) {
|
2299 |
-
(function ($) {
|
2300 |
-
$.fn.swiper = function (params) {
|
2301 |
-
var s = new Swiper($(this)[0], params)
|
2302 |
-
$(this).data('swiper', s);
|
2303 |
-
return s;
|
2304 |
-
}
|
2305 |
-
})(window.jQuery || window.Zepto);
|
2306 |
}
|
1 |
+
/*
|
2 |
+
* Swiper 2.0 - Mobile Touch Slider
|
3 |
+
* http://www.idangero.us/sliders/swiper/
|
4 |
+
*
|
5 |
+
* Copyright 2012-2013, Vladimir Kharlampidi
|
6 |
+
* The iDangero.us
|
7 |
+
* http://www.idangero.us/
|
8 |
+
*
|
9 |
+
* Licensed under GPL & MIT
|
10 |
+
*
|
11 |
+
* Updated on: June 9, 2013
|
12 |
+
*/
|
13 |
+
var Swiper = function (selector, params) {
|
14 |
+
/*=========================
|
15 |
+
A little bit dirty but required part for IE8 and old FF support
|
16 |
+
===========================*/
|
17 |
+
if (document.body.__defineGetter__) {
|
18 |
+
if (HTMLElement) {
|
19 |
+
var element = HTMLElement.prototype;
|
20 |
+
if (element.__defineGetter__) {
|
21 |
+
element.__defineGetter__("outerHTML", function () {
|
22 |
+
return new XMLSerializer().serializeToString(this);
|
23 |
+
});
|
24 |
+
}
|
25 |
+
}
|
26 |
+
}
|
27 |
+
|
28 |
+
if (!window.getComputedStyle) {
|
29 |
+
window.getComputedStyle = function (el, pseudo) {
|
30 |
+
this.el = el;
|
31 |
+
this.getPropertyValue = function (prop) {
|
32 |
+
var re = /(\-([a-z]){1})/g;
|
33 |
+
if (prop === 'float') prop = 'styleFloat';
|
34 |
+
if (re.test(prop)) {
|
35 |
+
prop = prop.replace(re, function () {
|
36 |
+
return arguments[2].toUpperCase();
|
37 |
+
});
|
38 |
+
}
|
39 |
+
return el.currentStyle[prop] ? el.currentStyle[prop] : null;
|
40 |
+
}
|
41 |
+
return this;
|
42 |
+
}
|
43 |
+
}
|
44 |
+
if (!Array.prototype.indexOf) {
|
45 |
+
Array.prototype.indexOf = function (obj, start) {
|
46 |
+
for (var i = (start || 0), j = this.length; i < j; i++) {
|
47 |
+
if (this[i] === obj) {
|
48 |
+
return i;
|
49 |
+
}
|
50 |
+
}
|
51 |
+
return -1;
|
52 |
+
}
|
53 |
+
}
|
54 |
+
if (!document.querySelectorAll) {
|
55 |
+
if (!window.jQuery) return;
|
56 |
+
}
|
57 |
+
|
58 |
+
function $$(s) {
|
59 |
+
if (document.querySelectorAll) return document.querySelectorAll(s);
|
60 |
+
else return jQuery(s);
|
61 |
+
}
|
62 |
+
|
63 |
+
/*=========================
|
64 |
+
Check for correct selector
|
65 |
+
===========================*/
|
66 |
+
if (typeof selector === 'undefined') return;
|
67 |
+
|
68 |
+
if (!(selector.nodeType)) {
|
69 |
+
if ($$(selector).length === 0) return;
|
70 |
+
}
|
71 |
+
|
72 |
+
/*=========================
|
73 |
+
_this
|
74 |
+
===========================*/
|
75 |
+
var _this = this;
|
76 |
+
|
77 |
+
/*=========================
|
78 |
+
Default Flags and vars
|
79 |
+
===========================*/
|
80 |
+
_this.touches = {
|
81 |
+
start: 0,
|
82 |
+
startX: 0,
|
83 |
+
startY: 0,
|
84 |
+
current: 0,
|
85 |
+
currentX: 0,
|
86 |
+
currentY: 0,
|
87 |
+
diff: 0,
|
88 |
+
abs: 0
|
89 |
+
};
|
90 |
+
_this.positions = {
|
91 |
+
start: 0,
|
92 |
+
abs: 0,
|
93 |
+
diff: 0,
|
94 |
+
current: 0
|
95 |
+
};
|
96 |
+
_this.times = {
|
97 |
+
start: 0,
|
98 |
+
end: 0
|
99 |
+
};
|
100 |
+
|
101 |
+
_this.id = (new Date()).getTime();
|
102 |
+
_this.container = (selector.nodeType) ? selector : $$(selector)[0];
|
103 |
+
_this.isTouched = false;
|
104 |
+
_this.isMoved = false;
|
105 |
+
_this.activeIndex = 0;
|
106 |
+
_this.activeLoaderIndex = 0;
|
107 |
+
_this.activeLoopIndex = 0;
|
108 |
+
_this.previousIndex = null;
|
109 |
+
_this.velocity = 0;
|
110 |
+
_this.snapGrid = [];
|
111 |
+
_this.slidesGrid = [];
|
112 |
+
_this.imagesToLoad = [];
|
113 |
+
_this.imagesLoaded = 0;
|
114 |
+
_this.wrapperLeft = 0;
|
115 |
+
_this.wrapperRight = 0;
|
116 |
+
_this.wrapperTop = 0;
|
117 |
+
_this.wrapperBottom = 0;
|
118 |
+
var wrapper, slideSize, wrapperSize, direction, isScrolling, containerSize;
|
119 |
+
|
120 |
+
/*=========================
|
121 |
+
Default Parameters
|
122 |
+
===========================*/
|
123 |
+
var defaults = {
|
124 |
+
mode: 'horizontal',
|
125 |
+
// or 'vertical'
|
126 |
+
touchRatio: 1,
|
127 |
+
speed: 300,
|
128 |
+
freeMode: false,
|
129 |
+
freeModeFluid: false,
|
130 |
+
momentumRatio: 1,
|
131 |
+
momentumBounce: true,
|
132 |
+
momentumBounceRatio: 1,
|
133 |
+
slidesPerView: 1,
|
134 |
+
slidesPerGroup: 1,
|
135 |
+
simulateTouch: true,
|
136 |
+
followFinger: true,
|
137 |
+
shortSwipes: true,
|
138 |
+
moveStartThreshold: false,
|
139 |
+
autoplay: false,
|
140 |
+
onlyExternal: false,
|
141 |
+
createPagination: true,
|
142 |
+
pagination: false,
|
143 |
+
paginationElement: 'span',
|
144 |
+
paginationClickable: false,
|
145 |
+
paginationAsRange: true,
|
146 |
+
resistance: true,
|
147 |
+
// or false or 100%
|
148 |
+
scrollContainer: false,
|
149 |
+
preventLinks: true,
|
150 |
+
noSwiping: false,
|
151 |
+
// or class
|
152 |
+
noSwipingClass: 'swiper-no-swiping',
|
153 |
+
//:)
|
154 |
+
initialSlide: 0,
|
155 |
+
keyboardControl: false,
|
156 |
+
mousewheelControl: false,
|
157 |
+
useCSS3Transforms: true,
|
158 |
+
//Loop mode
|
159 |
+
loop: false,
|
160 |
+
loopAdditionalSlides: 0,
|
161 |
+
//Auto Height
|
162 |
+
calculateHeight: false,
|
163 |
+
//Images Preloader
|
164 |
+
updateOnImagesReady: true,
|
165 |
+
//Form elements
|
166 |
+
releaseFormElements: true,
|
167 |
+
//Watch for active slide, useful when use effects on different slide states
|
168 |
+
watchActiveIndex: false,
|
169 |
+
//Slides Visibility Fit
|
170 |
+
visibilityFullFit: false,
|
171 |
+
//Slides Offset
|
172 |
+
offsetPxBefore: 0,
|
173 |
+
offsetPxAfter: 0,
|
174 |
+
offsetSlidesBefore: 0,
|
175 |
+
offsetSlidesAfter: 0,
|
176 |
+
centeredSlides: false,
|
177 |
+
//Queue callbacks
|
178 |
+
queueStartCallbacks: false,
|
179 |
+
queueEndCallbacks: false,
|
180 |
+
//Auto Resize
|
181 |
+
autoResize: true,
|
182 |
+
resizeReInit: false,
|
183 |
+
//DOMAnimation
|
184 |
+
DOMAnimation: true,
|
185 |
+
//Slides Loader
|
186 |
+
loader: {
|
187 |
+
slides: [],
|
188 |
+
//array with slides
|
189 |
+
slidesHTMLType: 'inner',
|
190 |
+
// or 'outer'
|
191 |
+
surroundGroups: 1,
|
192 |
+
//keep preloaded slides groups around view
|
193 |
+
logic: 'reload',
|
194 |
+
//or 'change'
|
195 |
+
loadAllSlides: false
|
196 |
+
},
|
197 |
+
//Namespace
|
198 |
+
slideElement: 'div',
|
199 |
+
slideClass: 'swiper-slide',
|
200 |
+
slideActiveClass: 'swiper-slide-active',
|
201 |
+
slideVisibleClass: 'swiper-slide-visible',
|
202 |
+
wrapperClass: 'swiper-wrapper',
|
203 |
+
paginationElementClass: 'swiper-pagination-switch',
|
204 |
+
paginationActiveClass: 'swiper-active-switch',
|
205 |
+
paginationVisibleClass: 'swiper-visible-switch'
|
206 |
+
}
|
207 |
+
params = params || {};
|
208 |
+
for (var prop in defaults) {
|
209 |
+
if (prop in params && typeof params[prop] === 'object') {
|
210 |
+
for (var subProp in defaults[prop]) {
|
211 |
+
if (!(subProp in params[prop])) {
|
212 |
+
params[prop][subProp] = defaults[prop][subProp];
|
213 |
+
}
|
214 |
+
}
|
215 |
+
} else if (!(prop in params)) {
|
216 |
+
params[prop] = defaults[prop]
|
217 |
+
}
|
218 |
+
}
|
219 |
+
_this.params = params;
|
220 |
+
if (params.scrollContainer) {
|
221 |
+
params.freeMode = true;
|
222 |
+
params.freeModeFluid = true;
|
223 |
+
}
|
224 |
+
if (params.loop) {
|
225 |
+
params.resistance = '100%';
|
226 |
+
}
|
227 |
+
var isH = params.mode === 'horizontal';
|
228 |
+
|
229 |
+
/*=========================
|
230 |
+
Define Touch Events
|
231 |
+
===========================*/
|
232 |
+
|
233 |
+
_this.touchEvents = {
|
234 |
+
touchStart: _this.support.touch || !params.simulateTouch ? 'touchstart' : (_this.browser.ie10 ? 'MSPointerDown' : 'mousedown'),
|
235 |
+
touchMove: _this.support.touch || !params.simulateTouch ? 'touchmove' : (_this.browser.ie10 ? 'MSPointerMove' : 'mousemove'),
|
236 |
+
touchEnd: _this.support.touch || !params.simulateTouch ? 'touchend' : (_this.browser.ie10 ? 'MSPointerUp' : 'mouseup')
|
237 |
+
};
|
238 |
+
|
239 |
+
/*=========================
|
240 |
+
Wrapper
|
241 |
+
===========================*/
|
242 |
+
for (var i = _this.container.childNodes.length - 1; i >= 0; i--) {
|
243 |
+
if (_this.container.childNodes[i].className) {
|
244 |
+
var _wrapperClasses = _this.container.childNodes[i].className.split(' ')
|
245 |
+
for (var j = 0; j < _wrapperClasses.length; j++) {
|
246 |
+
if (_wrapperClasses[j] === params.wrapperClass) {
|
247 |
+
wrapper = _this.container.childNodes[i];
|
248 |
+
}
|
249 |
+
};
|
250 |
+
}
|
251 |
+
};
|
252 |
+
|
253 |
+
_this.wrapper = wrapper;
|
254 |
+
/*=========================
|
255 |
+
Slide API
|
256 |
+
===========================*/
|
257 |
+
_this._extendSwiperSlide = function (el) {
|
258 |
+
el.append = function () {
|
259 |
+
if (params.loop) {
|
260 |
+
el.insertAfter(_this.slides.length - _this.loopedSlides);
|
261 |
+
_this.removeLoopedSlides();
|
262 |
+
_this.calcSlides();
|
263 |
+
_this.createLoop();
|
264 |
+
} else {
|
265 |
+
_this.wrapper.appendChild(el);
|
266 |
+
}
|
267 |
+
|
268 |
+
_this.reInit();
|
269 |
+
return el;
|
270 |
+
}
|
271 |
+
el.prepend = function () {
|
272 |
+
if (params.loop) {
|
273 |
+
_this.wrapper.insertBefore(el, _this.slides[_this.loopedSlides]);
|
274 |
+
_this.removeLoopedSlides();
|
275 |
+
_this.calcSlides();
|
276 |
+
_this.createLoop();
|
277 |
+
} else {
|
278 |
+
_this.wrapper.insertBefore(el, _this.wrapper.firstChild);
|
279 |
+
}
|
280 |
+
_this.reInit();
|
281 |
+
return el;
|
282 |
+
}
|
283 |
+
el.insertAfter = function (index) {
|
284 |
+
if (typeof index === 'undefined') return false;
|
285 |
+
var beforeSlide;
|
286 |
+
|
287 |
+
if (params.loop) {
|
288 |
+
beforeSlide = _this.slides[index + 1 + _this.loopedSlides];
|
289 |
+
_this.wrapper.insertBefore(el, beforeSlide);
|
290 |
+
_this.removeLoopedSlides();
|
291 |
+
_this.calcSlides();
|
292 |
+
_this.createLoop();
|
293 |
+
} else {
|
294 |
+
beforeSlide = _this.slides[index + 1];
|
295 |
+
_this.wrapper.insertBefore(el, beforeSlide)
|
296 |
+
}
|
297 |
+
_this.reInit();
|
298 |
+
return el;
|
299 |
+
}
|
300 |
+
el.clone = function () {
|
301 |
+
return _this._extendSwiperSlide(el.cloneNode(true))
|
302 |
+
}
|
303 |
+
el.remove = function () {
|
304 |
+
_this.wrapper.removeChild(el);
|
305 |
+
_this.reInit();
|
306 |
+
}
|
307 |
+
el.html = function (html) {
|
308 |
+
if (typeof html === 'undefined') {
|
309 |
+
return el.innerHTML;
|
310 |
+
} else {
|
311 |
+
el.innerHTML = html;
|
312 |
+
return el;
|
313 |
+
}
|
314 |
+
}
|
315 |
+
el.index = function () {
|
316 |
+
var index;
|
317 |
+
for (var i = _this.slides.length - 1; i >= 0; i--) {
|
318 |
+
if (el === _this.slides[i]) index = i;
|
319 |
+
}
|
320 |
+
return index;
|
321 |
+
}
|
322 |
+
el.isActive = function () {
|
323 |
+
if (el.index() === _this.activeIndex) return true;
|
324 |
+
else return false;
|
325 |
+
}
|
326 |
+
if (!el.swiperSlideDataStorage) el.swiperSlideDataStorage = {};
|
327 |
+
el.getData = function (name) {
|
328 |
+
return el.swiperSlideDataStorage[name];
|
329 |
+
}
|
330 |
+
el.setData = function (name, value) {
|
331 |
+
el.swiperSlideDataStorage[name] = value;
|
332 |
+
return el;
|
333 |
+
}
|
334 |
+
el.data = function (name, value) {
|
335 |
+
if (!value) {
|
336 |
+
return el.getAttribute('data-' + name);
|
337 |
+
} else {
|
338 |
+
el.setAttribute('data-' + name, value);
|
339 |
+
return el;
|
340 |
+
}
|
341 |
+
}
|
342 |
+
el.getWidth = function (outer) {
|
343 |
+
return _this.h.getWidth(el, outer);
|
344 |
+
}
|
345 |
+
el.getHeight = function (outer) {
|
346 |
+
return _this.h.getHeight(el, outer);
|
347 |
+
}
|
348 |
+
el.getOffset = function () {
|
349 |
+
return _this.h.getOffset(el);
|
350 |
+
}
|
351 |
+
return el;
|
352 |
+
}
|
353 |
+
|
354 |
+
//Calculate information about number of slides
|
355 |
+
_this.calcSlides = function (forceCalcSlides) {
|
356 |
+
var oldNumber = _this.slides ? _this.slides.length : false;
|
357 |
+
_this.slides = [];
|
358 |
+
_this.displaySlides = [];
|
359 |
+
for (var i = 0; i < _this.wrapper.childNodes.length; i++) {
|
360 |
+
if (_this.wrapper.childNodes[i].className) {
|
361 |
+
var _className = _this.wrapper.childNodes[i].className;
|
362 |
+
var _slideClasses = _className.split(' ');
|
363 |
+
for (var j = 0; j < _slideClasses.length; j++) {
|
364 |
+
if (_slideClasses[j] === params.slideClass) {
|
365 |
+
_this.slides.push(_this.wrapper.childNodes[i]);
|
366 |
+
}
|
367 |
+
}
|
368 |
+
}
|
369 |
+
}
|
370 |
+
for (i = _this.slides.length - 1; i >= 0; i--) {
|
371 |
+
_this._extendSwiperSlide(_this.slides[i]);
|
372 |
+
}
|
373 |
+
if (!oldNumber) return;
|
374 |
+
if (oldNumber !== _this.slides.length || forceCalcSlides) {
|
375 |
+
// Number of slides has been changed
|
376 |
+
removeSlideEvents();
|
377 |
+
addSlideEvents();
|
378 |
+
_this.updateActiveSlide();
|
379 |
+
if (params.createPagination && _this.params.pagination) _this.createPagination();
|
380 |
+
_this.callPlugins('numberOfSlidesChanged');
|
381 |
+
}
|
382 |
+
}
|
383 |
+
|
384 |
+
//Create Slide
|
385 |
+
_this.createSlide = function (html, slideClassList, el) {
|
386 |
+
var slideClassList = slideClassList || _this.params.slideClass;
|
387 |
+
var el = el || params.slideElement;
|
388 |
+
var newSlide = document.createElement(el);
|
389 |
+
newSlide.innerHTML = html || '';
|
390 |
+
newSlide.className = slideClassList;
|
391 |
+
return _this._extendSwiperSlide(newSlide);
|
392 |
+
}
|
393 |
+
|
394 |
+
//Append Slide
|
395 |
+
_this.appendSlide = function (html, slideClassList, el) {
|
396 |
+
if (!html) return;
|
397 |
+
if (html.nodeType) {
|
398 |
+
return _this._extendSwiperSlide(html).append()
|
399 |
+
} else {
|
400 |
+
return _this.createSlide(html, slideClassList, el).append()
|
401 |
+
}
|
402 |
+
}
|
403 |
+
_this.prependSlide = function (html, slideClassList, el) {
|
404 |
+
if (!html) return;
|
405 |
+
if (html.nodeType) {
|
406 |
+
return _this._extendSwiperSlide(html).prepend()
|
407 |
+
} else {
|
408 |
+
return _this.createSlide(html, slideClassList, el).prepend()
|
409 |
+
}
|
410 |
+
}
|
411 |
+
_this.insertSlideAfter = function (index, html, slideClassList, el) {
|
412 |
+
if (typeof index === 'undefined') return false;
|
413 |
+
if (html.nodeType) {
|
414 |
+
return _this._extendSwiperSlide(html).insertAfter(index);
|
415 |
+
} else {
|
416 |
+
return _this.createSlide(html, slideClassList, el).insertAfter(index);
|
417 |
+
}
|
418 |
+
}
|
419 |
+
_this.removeSlide = function (index) {
|
420 |
+
if (_this.slides[index]) {
|
421 |
+
if (params.loop) {
|
422 |
+
if (!_this.slides[index + _this.loopedSlides]) return false;
|
423 |
+
_this.slides[index + _this.loopedSlides].remove();
|
424 |
+
_this.removeLoopedSlides();
|
425 |
+
_this.calcSlides();
|
426 |
+
_this.createLoop();
|
427 |
+
} else _this.slides[index].remove();
|
428 |
+
return true;
|
429 |
+
} else return false;
|
430 |
+
}
|
431 |
+
_this.removeLastSlide = function () {
|
432 |
+
if (_this.slides.length > 0) {
|
433 |
+
if (params.loop) {
|
434 |
+
_this.slides[_this.slides.length - 1 - _this.loopedSlides].remove();
|
435 |
+
_this.removeLoopedSlides();
|
436 |
+
_this.calcSlides();
|
437 |
+
_this.createLoop();
|
438 |
+
} else _this.slides[(_this.slides.length - 1)].remove();
|
439 |
+
return true;
|
440 |
+
} else {
|
441 |
+
return false;
|
442 |
+
}
|
443 |
+
}
|
444 |
+
_this.removeAllSlides = function () {
|
445 |
+
for (var i = _this.slides.length - 1; i >= 0; i--) {
|
446 |
+
_this.slides[i].remove()
|
447 |
+
}
|
448 |
+
}
|
449 |
+
_this.getSlide = function (index) {
|
450 |
+
return _this.slides[index]
|
451 |
+
}
|
452 |
+
_this.getLastSlide = function () {
|
453 |
+
return _this.slides[_this.slides.length - 1]
|
454 |
+
}
|
455 |
+
_this.getFirstSlide = function () {
|
456 |
+
return _this.slides[0]
|
457 |
+
}
|
458 |
+
|
459 |
+
//Currently Active Slide
|
460 |
+
_this.activeSlide = function () {
|
461 |
+
return _this.slides[_this.activeIndex]
|
462 |
+
}
|
463 |
+
|
464 |
+
/*=========================
|
465 |
+
Plugins API
|
466 |
+
===========================*/
|
467 |
+
var _plugins = [];
|
468 |
+
for (var plugin in _this.plugins) {
|
469 |
+
if (params[plugin]) {
|
470 |
+
var p = _this.plugins[plugin](_this, params[plugin]);
|
471 |
+
if (p) _plugins.push(p);
|
472 |
+
}
|
473 |
+
}
|
474 |
+
_this.callPlugins = function (method, args) {
|
475 |
+
if (!args) args = {}
|
476 |
+
for (var i = 0; i < _plugins.length; i++) {
|
477 |
+
if (method in _plugins[i]) {
|
478 |
+
_plugins[i][method](args);
|
479 |
+
}
|
480 |
+
}
|
481 |
+
}
|
482 |
+
|
483 |
+
/*=========================
|
484 |
+
WP8 Fix
|
485 |
+
===========================*/
|
486 |
+
if (_this.browser.ie10 && !params.onlyExternal) {
|
487 |
+
if (isH) _this.wrapper.classList.add('swiper-wp8-horizontal');
|
488 |
+
else _this.wrapper.classList.add('swiper-wp8-vertical');
|
489 |
+
}
|
490 |
+
|
491 |
+
/*=========================
|
492 |
+
Free Mode Class
|
493 |
+
===========================*/
|
494 |
+
if (params.freeMode) {
|
495 |
+
_this.container.className += ' swiper-free-mode';
|
496 |
+
}
|
497 |
+
|
498 |
+
/*==================================================
|
499 |
+
Init/Re-init/Resize Fix
|
500 |
+
====================================================*/
|
501 |
+
_this.initialized = false;
|
502 |
+
_this.init = function (force, forceCalcSlides) {
|
503 |
+
var _width = _this.h.getWidth(_this.container);
|
504 |
+
var _height = _this.h.getHeight(_this.container);
|
505 |
+
if (_width === _this.width && _height === _this.height && !force) return;
|
506 |
+
_this.width = _width;
|
507 |
+
_this.height = _height;
|
508 |
+
|
509 |
+
containerSize = isH ? _width : _height;
|
510 |
+
var wrapper = _this.wrapper;
|
511 |
+
|
512 |
+
if (force) {
|
513 |
+
_this.calcSlides(forceCalcSlides);
|
514 |
+
}
|
515 |
+
|
516 |
+
if (params.slidesPerView === 'auto') {
|
517 |
+
//Auto mode
|
518 |
+
var slidesWidth = 0;
|
519 |
+
var slidesHeight = 0;
|
520 |
+
|
521 |
+
//Unset Styles
|
522 |
+
if (params.slidesOffset > 0) {
|
523 |
+
wrapper.style.paddingLeft = '';
|
524 |
+
wrapper.style.paddingRight = '';
|
525 |
+
wrapper.style.paddingTop = '';
|
526 |
+
wrapper.style.paddingBottom = '';
|
527 |
+
}
|
528 |
+
wrapper.style.width = '';
|
529 |
+
wrapper.style.height = '';
|
530 |
+
if (params.offsetPxBefore > 0) {
|
531 |
+
if (isH) _this.wrapperLeft = params.offsetPxBefore;
|
532 |
+
else _this.wrapperTop = params.offsetPxBefore;
|
533 |
+
}
|
534 |
+
if (params.offsetPxAfter > 0) {
|
535 |
+
if (isH) _this.wrapperRight = params.offsetPxAfter;
|
536 |
+
else _this.wrapperBottom = params.offsetPxAfter;
|
537 |
+
}
|
538 |
+
|
539 |
+
if (params.centeredSlides) {
|
540 |
+
if (isH) {
|
541 |
+
_this.wrapperLeft = (containerSize - this.slides[0].getWidth(true)) / 2;
|
542 |
+
_this.wrapperRight = (containerSize - _this.slides[_this.slides.length - 1].getWidth(true)) / 2;
|
543 |
+
} else {
|
544 |
+
_this.wrapperTop = (containerSize - _this.slides[0].getHeight(true)) / 2;
|
545 |
+
_this.wrapperBottom = (containerSize - _this.slides[_this.slides.length - 1].getHeight(true)) / 2;
|
546 |
+
}
|
547 |
+
}
|
548 |
+
|
549 |
+
if (isH) {
|
550 |
+
if (_this.wrapperLeft >= 0) wrapper.style.paddingLeft = _this.wrapperLeft + 'px';
|
551 |
+
if (_this.wrapperRight >= 0) wrapper.style.paddingRight = _this.wrapperRight + 'px';
|
552 |
+
} else {
|
553 |
+
if (_this.wrapperTop >= 0) wrapper.style.paddingTop = _this.wrapperTop + 'px';
|
554 |
+
if (_this.wrapperBottom >= 0) wrapper.style.paddingBottom = _this.wrapperBottom + 'px';
|
555 |
+
}
|
556 |
+
var slideLeft = 0;
|
557 |
+
var centeredSlideLeft = 0;
|
558 |
+
_this.snapGrid = [];
|
559 |
+
_this.slidesGrid = [];
|
560 |
+
|
561 |
+
var slideMaxHeight = 0;
|
562 |
+
for (var i = 0; i < _this.slides.length; i++) {
|
563 |
+
var slideWidth = _this.slides[i].getWidth(true);
|
564 |
+
var slideHeight = _this.slides[i].getHeight(true);
|
565 |
+
if (params.calculateHeight) {
|
566 |
+
slideMaxHeight = Math.max(slideMaxHeight, slideHeight)
|
567 |
+
}
|
568 |
+
var _slideSize = isH ? slideWidth : slideHeight;
|
569 |
+
if (params.centeredSlides) {
|
570 |
+
var nextSlideWidth = i === _this.slides.length - 1 ? 0 : _this.slides[i + 1].getWidth(true);
|
571 |
+
var nextSlideHeight = i === _this.slides.length - 1 ? 0 : _this.slides[i + 1].getHeight(true);
|
572 |
+
var nextSlideSize = isH ? nextSlideWidth : nextSlideHeight;
|
573 |
+
if (_slideSize > containerSize) {
|
574 |
+
for (var j = 0; j <= Math.floor(_slideSize / (containerSize + _this.wrapperLeft)); j++) {
|
575 |
+
if (j === 0) _this.snapGrid.push(slideLeft + _this.wrapperLeft);
|
576 |
+
else _this.snapGrid.push(slideLeft + _this.wrapperLeft + containerSize * j);
|
577 |
+
}
|
578 |
+
_this.slidesGrid.push(slideLeft + _this.wrapperLeft);
|
579 |
+
} else {
|
580 |
+
_this.snapGrid.push(centeredSlideLeft);
|
581 |
+
_this.slidesGrid.push(centeredSlideLeft);
|
582 |
+
}
|
583 |
+
|
584 |
+
centeredSlideLeft += _slideSize / 2 + nextSlideSize / 2;
|
585 |
+
|
586 |
+
} else {
|
587 |
+
if (_slideSize > containerSize) {
|
588 |
+
for (var j = 0; j <= Math.floor(_slideSize / containerSize); j++) {
|
589 |
+
_this.snapGrid.push(slideLeft + containerSize * j);
|
590 |
+
}
|
591 |
+
} else {
|
592 |
+
_this.snapGrid.push(slideLeft);
|
593 |
+
}
|
594 |
+
_this.slidesGrid.push(slideLeft);
|
595 |
+
}
|
596 |
+
|
597 |
+
slideLeft += _slideSize;
|
598 |
+
|
599 |
+
slidesWidth += slideWidth;
|
600 |
+
slidesHeight += slideHeight;
|
601 |
+
}
|
602 |
+
if (params.calculateHeight) _this.height = slideMaxHeight;
|
603 |
+
if (isH) {
|
604 |
+
wrapperSize = slidesWidth + _this.wrapperRight + _this.wrapperLeft;
|
605 |
+
wrapper.style.width = (slidesWidth) + 'px';
|
606 |
+
wrapper.style.height = (_this.height) + 'px';
|
607 |
+
} else {
|
608 |
+
wrapperSize = slidesHeight + _this.wrapperTop + _this.wrapperBottom;
|
609 |
+
wrapper.style.width = (_this.width) + 'px';
|
610 |
+
wrapper.style.height = (slidesHeight) + 'px';
|
611 |
+
}
|
612 |
+
|
613 |
+
} else if (params.scrollContainer) {
|
614 |
+
//Scroll Container
|
615 |
+
wrapper.style.width = '';
|
616 |
+
wrapper.style.height = '';
|
617 |
+
var wrapperWidth = _this.slides[0].getWidth(true);
|
618 |
+
var wrapperHeight = _this.slides[0].getHeight(true);
|
619 |
+
wrapperSize = isH ? wrapperWidth : wrapperHeight;
|
620 |
+
wrapper.style.width = wrapperWidth + 'px';
|
621 |
+
wrapper.style.height = wrapperHeight + 'px';
|
622 |
+
slideSize = isH ? wrapperWidth : wrapperHeight;
|
623 |
+
|
624 |
+
} else {
|
625 |
+
//For usual slides
|
626 |
+
if (params.calculateHeight) {
|
627 |
+
var slideMaxHeight = 0;
|
628 |
+
var wrapperHeight = 0;
|
629 |
+
//ResetWrapperSize
|
630 |
+
if (!isH) _this.container.style.height = '';
|
631 |
+
wrapper.style.height = '';
|
632 |
+
|
633 |
+
for (var i = 0; i < _this.slides.length; i++) {
|
634 |
+
//ResetSlideSize
|
635 |
+
_this.slides[i].style.height = '';
|
636 |
+
slideMaxHeight = Math.max(_this.slides[i].getHeight(true), slideMaxHeight);
|
637 |
+
if (!isH) wrapperHeight += _this.slides[i].getHeight(true);
|
638 |
+
}
|
639 |
+
var slideHeight = slideMaxHeight;
|
640 |
+
if (isH) var wrapperHeight = slideHeight;
|
641 |
+
containerSize = _this.height = slideHeight;
|
642 |
+
if (!isH) _this.container.style.height = containerSize + 'px';
|
643 |
+
} else {
|
644 |
+
var slideHeight = isH ? _this.height : _this.height / params.slidesPerView;
|
645 |
+
var wrapperHeight = isH ? _this.height : _this.slides.length * slideHeight;
|
646 |
+
}
|
647 |
+
var slideWidth = isH ? _this.width / params.slidesPerView : _this.width;
|
648 |
+
var wrapperWidth = isH ? _this.slides.length * slideWidth : _this.width;
|
649 |
+
slideSize = isH ? slideWidth : slideHeight;
|
650 |
+
|
651 |
+
if (params.offsetSlidesBefore > 0) {
|
652 |
+
if (isH) _this.wrapperLeft = slideSize * params.offsetSlidesBefore;
|
653 |
+
else _this.wrapperTop = slideSize * params.offsetSlidesBefore;
|
654 |
+
}
|
655 |
+
if (params.offsetSlidesAfter > 0) {
|
656 |
+
if (isH) _this.wrapperRight = slideSize * params.offsetSlidesAfter;
|
657 |
+
else _this.wrapperBottom = slideSize * params.offsetSlidesAfter;
|
658 |
+
}
|
659 |
+
if (params.offsetPxBefore > 0) {
|
660 |
+
if (isH) _this.wrapperLeft = params.offsetPxBefore;
|
661 |
+
else _this.wrapperTop = params.offsetPxBefore;
|
662 |
+
}
|
663 |
+
if (params.offsetPxAfter > 0) {
|
664 |
+
if (isH) _this.wrapperRight = params.offsetPxAfter;
|
665 |
+
else _this.wrapperBottom = params.offsetPxAfter;
|
666 |
+
}
|
667 |
+
if (params.centeredSlides) {
|
668 |
+
if (isH) {
|
669 |
+
_this.wrapperLeft = (containerSize - slideSize) / 2;
|
670 |
+
_this.wrapperRight = (containerSize - slideSize) / 2;
|
671 |
+
} else {
|
672 |
+
_this.wrapperTop = (containerSize - slideSize) / 2;
|
673 |
+
_this.wrapperBottom = (containerSize - slideSize) / 2;
|
674 |
+
}
|
675 |
+
}
|
676 |
+
if (isH) {
|
677 |
+
if (_this.wrapperLeft > 0) wrapper.style.paddingLeft = _this.wrapperLeft + 'px';
|
678 |
+
if (_this.wrapperRight > 0) wrapper.style.paddingRight = _this.wrapperRight + 'px';
|
679 |
+
} else {
|
680 |
+
if (_this.wrapperTop > 0) wrapper.style.paddingTop = _this.wrapperTop + 'px';
|
681 |
+
if (_this.wrapperBottom > 0) wrapper.style.paddingBottom = _this.wrapperBottom + 'px';
|
682 |
+
}
|
683 |
+
|
684 |
+
wrapperSize = isH ? wrapperWidth + _this.wrapperRight + _this.wrapperLeft : wrapperHeight + _this.wrapperTop + _this.wrapperBottom;
|
685 |
+
wrapper.style.width = wrapperWidth + 'px';
|
686 |
+
wrapper.style.height = wrapperHeight + 'px';
|
687 |
+
var slideLeft = 0;
|
688 |
+
_this.snapGrid = [];
|
689 |
+
_this.slidesGrid = [];
|
690 |
+
for (var i = 0; i < _this.slides.length; i++) {
|
691 |
+
_this.snapGrid.push(slideLeft);
|
692 |
+
_this.slidesGrid.push(slideLeft);
|
693 |
+
slideLeft += slideSize;
|
694 |
+
_this.slides[i].style.width = slideWidth + 'px';
|
695 |
+
_this.slides[i].style.height = slideHeight + 'px';
|
696 |
+
}
|
697 |
+
|
698 |
+
}
|
699 |
+
|
700 |
+
if (!_this.initialized) _this.callPlugins('onFirstInit');
|
701 |
+
else _this.callPlugins('onInit');
|
702 |
+
_this.initialized = true;
|
703 |
+
}
|
704 |
+
_this.reInit = function (forceCalcSlides) {
|
705 |
+
_this.init(true, forceCalcSlides);
|
706 |
+
}
|
707 |
+
_this.resizeFix = function (reInit) {
|
708 |
+
_this.callPlugins('beforeResizeFix');
|
709 |
+
_this.init(params.resizeReInit || reInit);
|
710 |
+
if (!params.freeMode) {
|
711 |
+
if (params.loop) _this.swipeTo(_this.activeLoopIndex, 0, false);
|
712 |
+
else _this.swipeTo(_this.activeIndex, 0, false);
|
713 |
+
} else {
|
714 |
+
var pos = isH ? _this.getWrapperTranslate('x') : _this.getWrapperTranslate('y');
|
715 |
+
if (pos < -maxWrapperPosition()) {
|
716 |
+
var x = isH ? -maxWrapperPosition() : 0;
|
717 |
+
var y = isH ? 0 : -maxWrapperPosition();
|
718 |
+
_this.setWrapperTransition(0);
|
719 |
+
_this.setWrapperTranslate(x, y, 0);
|
720 |
+
}
|
721 |
+
}
|
722 |
+
_this.callPlugins('afterResizeFix');
|
723 |
+
}
|
724 |
+
|
725 |
+
/*==========================================
|
726 |
+
Max and Min Positions
|
727 |
+
============================================*/
|
728 |
+
function maxWrapperPosition() {
|
729 |
+
var a = (wrapperSize - containerSize);
|
730 |
+
if (params.freeMode) {
|
731 |
+
a = wrapperSize - containerSize;
|
732 |
+
}
|
733 |
+
// if (params.loop) a -= containerSize;
|
734 |
+
if (params.slidesPerView > _this.slides.length) a = 0;
|
735 |
+
if (a < 0) a = 0;
|
736 |
+
return a;
|
737 |
+
}
|
738 |
+
|
739 |
+
function minWrapperPosition() {
|
740 |
+
var a = 0;
|
741 |
+
// if (params.loop) a = containerSize;
|
742 |
+
return a;
|
743 |
+
}
|
744 |
+
|
745 |
+
/*==========================================
|
746 |
+
Event Listeners
|
747 |
+
============================================*/
|
748 |
+
function initEvents() {
|
749 |
+
//Touch Events
|
750 |
+
if (!_this.browser.ie10) {
|
751 |
+
if (_this.support.touch) {
|
752 |
+
_this.h.addEventListener(_this.wrapper, 'touchstart', onTouchStart, false);
|
753 |
+
_this.h.addEventListener(_this.wrapper, 'touchmove', onTouchMove, false);
|
754 |
+
_this.h.addEventListener(_this.wrapper, 'touchend', onTouchEnd, false);
|
755 |
+
}
|
756 |
+
if (params.simulateTouch) {
|
757 |
+
_this.h.addEventListener(_this.wrapper, 'mousedown', onTouchStart, false);
|
758 |
+
_this.h.addEventListener(document, 'mousemove', onTouchMove, false);
|
759 |
+
_this.h.addEventListener(document, 'mouseup', onTouchEnd, false);
|
760 |
+
}
|
761 |
+
} else {
|
762 |
+
_this.h.addEventListener(_this.wrapper, _this.touchEvents.touchStart, onTouchStart, false);
|
763 |
+
_this.h.addEventListener(document, _this.touchEvents.touchMove, onTouchMove, false);
|
764 |
+
_this.h.addEventListener(document, _this.touchEvents.touchEnd, onTouchEnd, false);
|
765 |
+
}
|
766 |
+
//Resize Event
|
767 |
+
if (params.autoResize) {
|
768 |
+
_this.h.addEventListener(window, 'resize', _this.resizeFix, false);
|
769 |
+
}
|
770 |
+
//Slide Events
|
771 |
+
addSlideEvents();
|
772 |
+
//Mousewheel
|
773 |
+
_this._wheelEvent = false;
|
774 |
+
if (params.mousewheelControl) {
|
775 |
+
if (document.onmousewheel !== undefined) {
|
776 |
+
_this._wheelEvent = "mousewheel";
|
777 |
+
}
|
778 |
+
try {
|
779 |
+
WheelEvent("wheel");
|
780 |
+
_this._wheelEvent = "wheel";
|
781 |
+
} catch (e) {}
|
782 |
+
if (!_this._wheelEvent) {
|
783 |
+
_this._wheelEvent = "DOMMouseScroll";
|
784 |
+
}
|
785 |
+
|
786 |
+
if (_this._wheelEvent) {
|
787 |
+
_this.h.addEventListener(_this.container, _this._wheelEvent, handleMousewheel, false);
|
788 |
+
}
|
789 |
+
}
|
790 |
+
|
791 |
+
//Keyboard
|
792 |
+
if (params.keyboardControl) {
|
793 |
+
_this.h.addEventListener(document, 'keydown', handleKeyboardKeys, false);
|
794 |
+
}
|
795 |
+
if (params.updateOnImagesReady) {
|
796 |
+
if (document.querySelectorAll) _this.imagesToLoad = _this.container.querySelectorAll('img');
|
797 |
+
else if (window.jQuery) _this.imagesToLoad = $$(_this.container).find('img');
|
798 |
+
|
799 |
+
for (var i = 0; i < _this.imagesToLoad.length; i++) {
|
800 |
+
_loadImage(_this.imagesToLoad[i].getAttribute('src'))
|
801 |
+
}
|
802 |
+
}
|
803 |
+
|
804 |
+
function _loadImage(src) {
|
805 |
+
var image = new Image();
|
806 |
+
image.onload = function () {
|
807 |
+
_this.imagesLoaded++;
|
808 |
+
if (_this.imagesLoaded == _this.imagesToLoad.length) {
|
809 |
+
_this.reInit();
|
810 |
+
if (params.onImagesReady) params.onImagesReady(_this);
|
811 |
+
}
|
812 |
+
}
|
813 |
+
image.src = src;
|
814 |
+
}
|
815 |
+
}
|
816 |
+
|
817 |
+
|
818 |
+
|
819 |
+
//Remove Event Listeners
|
820 |
+
_this.destroy = function (removeResizeFix) {
|
821 |
+
//Touch Events
|
822 |
+
if (!_this.browser.ie10) {
|
823 |
+
if (_this.support.touch) {
|
824 |
+
_this.h.removeEventListener(_this.wrapper, 'touchstart', onTouchStart, false);
|
825 |
+
_this.h.removeEventListener(_this.wrapper, 'touchmove', onTouchMove, false);
|
826 |
+
_this.h.removeEventListener(_this.wrapper, 'touchend', onTouchEnd, false);
|
827 |
+
}
|
828 |
+
if (params.simulateTouch) {
|
829 |
+
_this.h.removeEventListener(_this.wrapper, 'mousedown', onTouchStart, false);
|
830 |
+
_this.h.removeEventListener(document, 'mousemove', onTouchMove, false);
|
831 |
+
_this.h.removeEventListener(document, 'mouseup', onTouchEnd, false);
|
832 |
+
}
|
833 |
+
} else {
|
834 |
+
_this.h.removeEventListener(_this.wrapper, _this.touchEvents.touchStart, onTouchStart, false);
|
835 |
+
_this.h.removeEventListener(document, _this.touchEvents.touchMove, onTouchMove, false);
|
836 |
+
_this.h.removeEventListener(document, _this.touchEvents.touchEnd, onTouchEnd, false);
|
837 |
+
}
|
838 |
+
//Resize Event
|
839 |
+
if (params.autoResize) {
|
840 |
+
_this.h.removeEventListener(window, 'resize', _this.resizeFix, false);
|
841 |
+
}
|
842 |
+
//Init Slide Events
|
843 |
+
removeSlideEvents();
|
844 |
+
|
845 |
+
//Pagination
|
846 |
+
if (params.paginationClickable) {
|
847 |
+
removePaginationEvents();
|
848 |
+
}
|
849 |
+
|
850 |
+
//Mousewheel
|
851 |
+
if (params.mousewheelControl && _this._wheelEvent) {
|
852 |
+
_this.h.removeEventListener(_this.container, _this._wheelEvent, handleMousewheel, false);
|
853 |
+
}
|
854 |
+
|
855 |
+
//Keyboard
|
856 |
+
if (params.keyboardControl) {
|
857 |
+
_this.h.removeEventListener(document, 'keydown', handleKeyboardKeys, false);
|
858 |
+
}
|
859 |
+
|
860 |
+
//Stop autoplay
|
861 |
+
if (params.autoplay) {
|
862 |
+
_this.stopAutoplay();
|
863 |
+
}
|
864 |
+
|
865 |
+
_this.callPlugins('onDestroy');
|
866 |
+
}
|
867 |
+
|
868 |
+
function addSlideEvents() {
|
869 |
+
//Prevent Links Events
|
870 |
+
if (params.preventLinks) {
|
871 |
+
var links = [];
|
872 |
+
if (document.querySelectorAll) {
|
873 |
+
links = _this.container.querySelectorAll('a');
|
874 |
+
} else if (window.jQuery) {
|
875 |
+
links = $$(_this.container).find('a');
|
876 |
+
}
|
877 |
+
for (var i = 0; i < links.length; i++) {
|
878 |
+
_this.h.addEventListener(links[i], 'click', preventClick, false);
|
879 |
+
}
|
880 |
+
}
|
881 |
+
//Release Form Elements
|
882 |
+
if (params.releaseFormElements) {
|
883 |
+
var formElements = document.querySelectorAll ? _this.container.querySelectorAll('input, textarea, select') : $$(_this.container).find('input, textarea, select');
|
884 |
+
for (var i = 0; i < formElements.length; i++) {
|
885 |
+
_this.h.addEventListener(formElements[i], _this.touchEvents.touchStart, releaseForms, true);
|
886 |
+
}
|
887 |
+
}
|
888 |
+
|
889 |
+
//Slide Clicks & Touches
|
890 |
+
if (params.onSlideClick) {
|
891 |
+
for (var i = 0; i < _this.slides.length; i++) {
|
892 |
+
_this.h.addEventListener(_this.slides[i], 'click', slideClick, false);
|
893 |
+
}
|
894 |
+
}
|
895 |
+
if (params.onSlideTouch) {
|
896 |
+
for (var i = 0; i < _this.slides.length; i++) {
|
897 |
+
_this.h.addEventListener(_this.slides[i], _this.touchEvents.touchStart, slideTouch, false);
|
898 |
+
}
|
899 |
+
}
|
900 |
+
}
|
901 |
+
|
902 |
+
function removeSlideEvents() {
|
903 |
+
//Slide Clicks & Touches
|
904 |
+
if (params.onSlideClick) {
|
905 |
+
for (var i = 0; i < _this.slides.length; i++) {
|
906 |
+
_this.h.removeEventListener(_this.slides[i], 'click', slideClick, false);
|
907 |
+
}
|
908 |
+
}
|
909 |
+
if (params.onSlideTouch) {
|
910 |
+
for (var i = 0; i < _this.slides.length; i++) {
|
911 |
+
_this.h.removeEventListener(_this.slides[i], _this.touchEvents.touchStart, slideTouch, false);
|
912 |
+
}
|
913 |
+
}
|
914 |
+
//Release Form Elements
|
915 |
+
if (params.releaseFormElements) {
|
916 |
+
var formElements = document.querySelectorAll ? _this.container.querySelectorAll('input, textarea, select') : $$(_this.container).find('input, textarea, select');
|
917 |
+
for (var i = 0; i < formElements.length; i++) {
|
918 |
+
_this.h.removeEventListener(formElements[i], _this.touchEvents.touchStart, releaseForms, true);
|
919 |
+
}
|
920 |
+
}
|
921 |
+
//Prevent Links Events
|
922 |
+
if (params.preventLinks) {
|
923 |
+
var links = [];
|
924 |
+
if (document.querySelectorAll) {
|
925 |
+
links = _this.container.querySelectorAll('a');
|
926 |
+
} else if (window.jQuery) {
|
927 |
+
links = $$(_this.container).find('a');
|
928 |
+
}
|
929 |
+
for (var i = 0; i < links.length; i++) {
|
930 |
+
_this.h.removeEventListener(links[i], 'click', preventClick, false);
|
931 |
+
}
|
932 |
+
}
|
933 |
+
}
|
934 |
+
/*==========================================
|
935 |
+
Keyboard Control
|
936 |
+
============================================*/
|
937 |
+
function handleKeyboardKeys(e) {
|
938 |
+
var kc = e.keyCode || e.charCode;
|
939 |
+
if (kc == 37 || kc == 39 || kc == 38 || kc == 40) {
|
940 |
+
var inView = false;
|
941 |
+
//Check that swiper should be inside of visible area of window
|
942 |
+
var swiperOffset = _this.h.getOffset(_this.container);
|
943 |
+
var scrollLeft = _this.h.windowScroll().left;
|
944 |
+
var scrollTop = _this.h.windowScroll().top;
|
945 |
+
var windowWidth = _this.h.windowWidth();
|
946 |
+
var windowHeight = _this.h.windowHeight();
|
947 |
+
var swiperCoord = [
|
948 |
+
[swiperOffset.left, swiperOffset.top],
|
949 |
+
[swiperOffset.left + _this.width, swiperOffset.top],
|
950 |
+
[swiperOffset.left, swiperOffset.top + _this.height],
|
951 |
+
[swiperOffset.left + _this.width, swiperOffset.top + _this.height]
|
952 |
+
]
|
953 |
+
for (var i = 0; i < swiperCoord.length; i++) {
|
954 |
+
var point = swiperCoord[i];
|
955 |
+
if (
|
956 |
+
point[0] >= scrollLeft && point[0] <= scrollLeft + windowWidth && point[1] >= scrollTop && point[1] <= scrollTop + windowHeight) {
|
957 |
+
inView = true;
|
958 |
+
}
|
959 |
+
|
960 |
+
}
|
961 |
+
if (!inView) return;
|
962 |
+
}
|
963 |
+
if (isH) {
|
964 |
+
if (kc == 37 || kc == 39) {
|
965 |
+
if (e.preventDefault) e.preventDefault();
|
966 |
+
else e.returnValue = false;
|
967 |
+
}
|
968 |
+
if (kc == 39) _this.swipeNext();
|
969 |
+
if (kc == 37) _this.swipePrev();
|
970 |
+
} else {
|
971 |
+
if (kc == 38 || kc == 40) {
|
972 |
+
if (e.preventDefault) e.preventDefault();
|
973 |
+
else e.returnValue = false;
|
974 |
+
}
|
975 |
+
if (kc == 40) _this.swipeNext();
|
976 |
+
if (kc == 38) _this.swipePrev();
|
977 |
+
}
|
978 |
+
}
|
979 |
+
|
980 |
+
/*==========================================
|
981 |
+
Mousewheel Control
|
982 |
+
============================================*/
|
983 |
+
function handleMousewheel(e) {
|
984 |
+
var we = _this._wheelEvent;
|
985 |
+
var delta;
|
986 |
+
//Opera & IE
|
987 |
+
if (e.detail) delta = -e.detail;
|
988 |
+
//WebKits
|
989 |
+
else if (we == 'mousewheel') delta = e.wheelDelta;
|
990 |
+
//Old FireFox
|
991 |
+
else if (we == 'DOMMouseScroll') delta = -e.detail;
|
992 |
+
//New FireFox
|
993 |
+
else if (we == 'wheel') {
|
994 |
+
delta = Math.abs(e.deltaX) > Math.abs(e.deltaY) ? -e.deltaX : -e.deltaY;
|
995 |
+
}
|
996 |
+
if (!params.freeMode) {
|
997 |
+
if (delta < 0) _this.swipeNext();
|
998 |
+
else _this.swipePrev();
|
999 |
+
} else {
|
1000 |
+
//Freemode or scrollContainer:
|
1001 |
+
var currentTransform = isH ? _this.getWrapperTranslate('x') : _this.getWrapperTranslate('y');
|
1002 |
+
var x, y;
|
1003 |
+
if (isH) {
|
1004 |
+
x = _this.getWrapperTranslate('x') + delta;
|
1005 |
+
y = _this.getWrapperTranslate('y');
|
1006 |
+
if (x > 0) x = 0;
|
1007 |
+
if (x < -maxWrapperPosition()) x = -maxWrapperPosition();
|
1008 |
+
} else {
|
1009 |
+
x = _this.getWrapperTranslate('x');
|
1010 |
+
y = _this.getWrapperTranslate('y') + delta;
|
1011 |
+
if (y > 0) y = 0;
|
1012 |
+
if (y < -maxWrapperPosition()) y = -maxWrapperPosition();
|
1013 |
+
}
|
1014 |
+
_this.setWrapperTransition(0);
|
1015 |
+
_this.setWrapperTranslate(x, y, 0);
|
1016 |
+
}
|
1017 |
+
if (params.autoplay) _this.stopAutoplay();
|
1018 |
+
|
1019 |
+
if (e.preventDefault) e.preventDefault();
|
1020 |
+
else e.returnValue = false;
|
1021 |
+
return false;
|
1022 |
+
}
|
1023 |
+
|
1024 |
+
/*=========================
|
1025 |
+
Grab Cursor
|
1026 |
+
===========================*/
|
1027 |
+
if (params.grabCursor) {
|
1028 |
+
_this.container.style.cursor = 'move';
|
1029 |
+
_this.container.style.cursor = 'grab';
|
1030 |
+
_this.container.style.cursor = '-moz-grab';
|
1031 |
+
_this.container.style.cursor = '-webkit-grab';
|
1032 |
+
}
|
1033 |
+
|
1034 |
+
/*=========================
|
1035 |
+
Slides Events Handlers
|
1036 |
+
===========================*/
|
1037 |
+
_this.allowSlideClick = true;
|
1038 |
+
|
1039 |
+
function slideClick(e) {
|
1040 |
+
if (_this.allowSlideClick) {
|
1041 |
+
_this.clickedSlide = this;
|
1042 |
+
_this.clickedSlideIndex = _this.slides.indexOf(this);
|
1043 |
+
params.onSlideClick(_this);
|
1044 |
+
}
|
1045 |
+
}
|
1046 |
+
|
1047 |
+
function slideTouch(e) {
|
1048 |
+
_this.clickedSlide = this;
|
1049 |
+
_this.clickedSlideIndex = _this.slides.indexOf(this);
|
1050 |
+
params.onSlideTouch(_this);
|
1051 |
+
}
|
1052 |
+
_this.allowLinks = true;
|
1053 |
+
|
1054 |
+
function preventClick(e) {
|
1055 |
+
if (!_this.allowLinks) {
|
1056 |
+
if (e.preventDefault) e.preventDefault();
|
1057 |
+
else e.returnValue = false;
|
1058 |
+
return false;
|
1059 |
+
}
|
1060 |
+
}
|
1061 |
+
|
1062 |
+
function releaseForms(e) {
|
1063 |
+
if (e.stopPropagation) e.stopPropagation();
|
1064 |
+
else e.returnValue = false;
|
1065 |
+
return false;
|
1066 |
+
}
|
1067 |
+
|
1068 |
+
/*==================================================
|
1069 |
+
Event Handlers
|
1070 |
+
====================================================*/
|
1071 |
+
var isTouchEvent = false;
|
1072 |
+
var allowThresholdMove;
|
1073 |
+
var allowMomentumBounce = true;
|
1074 |
+
|
1075 |
+
function onTouchStart(event) {
|
1076 |
+
if (params.preventLinks) _this.allowLinks = true;
|
1077 |
+
//Exit if slider is already was touched
|
1078 |
+
if (_this.isTouched || params.onlyExternal) {
|
1079 |
+
return false;
|
1080 |
+
}
|
1081 |
+
|
1082 |
+
if (params.noSwiping && event.target && event.target.className && event.target.className.indexOf(params.noSwipingClass) > -1) return false;
|
1083 |
+
allowMomentumBounce = false;
|
1084 |
+
|
1085 |
+
//Check For Nested Swipers
|
1086 |
+
_this.isTouched = true;
|
1087 |
+
isTouchEvent = event.type == 'touchstart';
|
1088 |
+
|
1089 |
+
if (!isTouchEvent || event.targetTouches.length == 1) {
|
1090 |
+
if (params.loop) _this.fixLoop();
|
1091 |
+
_this.callPlugins('onTouchStartBegin');
|
1092 |
+
|
1093 |
+
if (!isTouchEvent) {
|
1094 |
+
if (event.preventDefault) event.preventDefault();
|
1095 |
+
else event.returnValue = false;
|
1096 |
+
}
|
1097 |
+
|
1098 |
+
var pageX = isTouchEvent ? event.targetTouches[0].pageX : (event.pageX || event.clientX);
|
1099 |
+
var pageY = isTouchEvent ? event.targetTouches[0].pageY : (event.pageY || event.clientY);
|
1100 |
+
|
1101 |
+
//Start Touches to check the scrolling
|
1102 |
+
_this.touches.startX = _this.touches.currentX = pageX;
|
1103 |
+
_this.touches.startY = _this.touches.currentY = pageY;
|
1104 |
+
|
1105 |
+
_this.touches.start = _this.touches.current = isH ? pageX : pageY;
|
1106 |
+
|
1107 |
+
//Set Transition Time to 0
|
1108 |
+
_this.setWrapperTransition(0);
|
1109 |
+
|
1110 |
+
//Get Start Translate Position
|
1111 |
+
_this.positions.start = _this.positions.current = isH ? _this.getWrapperTranslate('x') : _this.getWrapperTranslate('y');
|
1112 |
+
|
1113 |
+
//Set Transform
|
1114 |
+
if (isH) {
|
1115 |
+
_this.setWrapperTranslate(_this.positions.start, 0, 0);
|
1116 |
+
} else {
|
1117 |
+
_this.setWrapperTranslate(0, _this.positions.start, 0);
|
1118 |
+
}
|
1119 |
+
|
1120 |
+
//TouchStartTime
|
1121 |
+
_this.times.start = (new Date()).getTime();
|
1122 |
+
|
1123 |
+
//Unset Scrolling
|
1124 |
+
isScrolling = undefined;
|
1125 |
+
|
1126 |
+
//Set Treshold
|
1127 |
+
if (params.moveStartThreshold > 0) allowThresholdMove = false;
|
1128 |
+
|
1129 |
+
//CallBack
|
1130 |
+
if (params.onTouchStart) params.onTouchStart(_this);
|
1131 |
+
_this.callPlugins('onTouchStartEnd');
|
1132 |
+
|
1133 |
+
}
|
1134 |
+
}
|
1135 |
+
var velocityPrevPosition, velocityPrevTime;
|
1136 |
+
|
1137 |
+
function onTouchMove(event) {
|
1138 |
+
// If slider is not touched - exit
|
1139 |
+
if (!_this.isTouched || params.onlyExternal) return;
|
1140 |
+
if (isTouchEvent && event.type == 'mousemove') return;
|
1141 |
+
|
1142 |
+
var pageX = isTouchEvent ? event.targetTouches[0].pageX : (event.pageX || event.clientX);
|
1143 |
+
var pageY = isTouchEvent ? event.targetTouches[0].pageY : (event.pageY || event.clientY);
|
1144 |
+
|
1145 |
+
//check for scrolling
|
1146 |
+
if (typeof isScrolling === 'undefined' && isH) {
|
1147 |
+
isScrolling = !! (isScrolling || Math.abs(pageY - _this.touches.startY) > Math.abs(pageX - _this.touches.startX));
|
1148 |
+
}
|
1149 |
+
if (typeof isScrolling === 'undefined' && !isH) {
|
1150 |
+
isScrolling = !! (isScrolling || Math.abs(pageY - _this.touches.startY) < Math.abs(pageX - _this.touches.startX));
|
1151 |
+
}
|
1152 |
+
if (isScrolling) {
|
1153 |
+
_this.isTouched = false;
|
1154 |
+
return
|
1155 |
+
}
|
1156 |
+
|
1157 |
+
//Check For Nested Swipers
|
1158 |
+
if (event.assignedToSwiper) {
|
1159 |
+
_this.isTouched = false;
|
1160 |
+
return
|
1161 |
+
}
|
1162 |
+
event.assignedToSwiper = true;
|
1163 |
+
|
1164 |
+
//Moved Flag
|
1165 |
+
_this.isMoved = true;
|
1166 |
+
|
1167 |
+
//Block inner links
|
1168 |
+
if (params.preventLinks) {
|
1169 |
+
_this.allowLinks = false;
|
1170 |
+
}
|
1171 |
+
if (params.onSlideClick) {
|
1172 |
+
_this.allowSlideClick = false;
|
1173 |
+
}
|
1174 |
+
|
1175 |
+
//Stop AutoPlay if exist
|
1176 |
+
if (params.autoplay) {
|
1177 |
+
_this.stopAutoplay();
|
1178 |
+
}
|
1179 |
+
if (!isTouchEvent || event.touches.length == 1) {
|
1180 |
+
|
1181 |
+
_this.callPlugins('onTouchMoveStart');
|
1182 |
+
|
1183 |
+
if (event.preventDefault) event.preventDefault();
|
1184 |
+
else event.returnValue = false;
|
1185 |
+
|
1186 |
+
_this.touches.current = isH ? pageX : pageY;
|
1187 |
+
|
1188 |
+
_this.positions.current = (_this.touches.current - _this.touches.start) * params.touchRatio + _this.positions.start;
|
1189 |
+
|
1190 |
+
//Resistance Callbacks
|
1191 |
+
if (_this.positions.current > 0 && params.onResistanceBefore) {
|
1192 |
+
params.onResistanceBefore(_this, _this.positions.current);
|
1193 |
+
}
|
1194 |
+
if (_this.positions.current < -maxWrapperPosition() && params.onResistanceBefore) {
|
1195 |
+
params.onResistanceAfter(_this, Math.abs(_this.positions.current + maxWrapperPosition()));
|
1196 |
+
}
|
1197 |
+
//Resistance
|
1198 |
+
if (params.resistance && params.resistance != '100%') {
|
1199 |
+
//Resistance for Negative-Back sliding
|
1200 |
+
if (_this.positions.current > 0) {
|
1201 |
+
var resistance = 1 - _this.positions.current / containerSize / 2;
|
1202 |
+
if (resistance < 0.5) _this.positions.current = (containerSize / 2);
|
1203 |
+
else _this.positions.current = _this.positions.current * resistance;
|
1204 |
+
}
|
1205 |
+
//Resistance for After-End Sliding
|
1206 |
+
if (_this.positions.current < -maxWrapperPosition()) {
|
1207 |
+
|
1208 |
+
var diff = (_this.touches.current - _this.touches.start) * params.touchRatio + (maxWrapperPosition() + _this.positions.start);
|
1209 |
+
var resistance = (containerSize + diff) / (containerSize);
|
1210 |
+
var newPos = _this.positions.current - diff * (1 - resistance) / 2;
|
1211 |
+
var stopPos = -maxWrapperPosition() - containerSize / 2;
|
1212 |
+
|
1213 |
+
if (newPos < stopPos || resistance <= 0) _this.positions.current = stopPos;
|
1214 |
+
else _this.positions.current = newPos;
|
1215 |
+
}
|
1216 |
+
}
|
1217 |
+
if (params.resistance && params.resistance == '100%') {
|
1218 |
+
//Resistance for Negative-Back sliding
|
1219 |
+
if (_this.positions.current > 0 && !(params.freeMode && !params.freeModeFluid)) {
|
1220 |
+
_this.positions.current = 0;
|
1221 |
+
}
|
1222 |
+
//Resistance for After-End Sliding
|
1223 |
+
if ((_this.positions.current) < -maxWrapperPosition() && !(params.freeMode && !params.freeModeFluid)) {
|
1224 |
+
_this.positions.current = -maxWrapperPosition();
|
1225 |
+
}
|
1226 |
+
}
|
1227 |
+
//Move Slides
|
1228 |
+
if (!params.followFinger) return
|
1229 |
+
|
1230 |
+
if (!params.moveStartThreshold) {
|
1231 |
+
if (isH) _this.setWrapperTranslate(_this.positions.current, 0, 0);
|
1232 |
+
else _this.setWrapperTranslate(0, _this.positions.current, 0);
|
1233 |
+
} else {
|
1234 |
+
if (Math.abs(_this.touches.current - _this.touches.start) > params.moveStartThreshold || allowThresholdMove) {
|
1235 |
+
allowThresholdMove = true;
|
1236 |
+
if (isH) _this.setWrapperTranslate(_this.positions.current, 0, 0);
|
1237 |
+
else _this.setWrapperTranslate(0, _this.positions.current, 0);
|
1238 |
+
} else {
|
1239 |
+
_this.positions.current = _this.positions.start;
|
1240 |
+
}
|
1241 |
+
}
|
1242 |
+
|
1243 |
+
if (params.freeMode || params.watchActiveIndex) {
|
1244 |
+
_this.updateActiveSlide(_this.positions.current);
|
1245 |
+
}
|
1246 |
+
|
1247 |
+
//Grab Cursor
|
1248 |
+
if (params.grabCursor) {
|
1249 |
+
_this.container.style.cursor = 'move';
|
1250 |
+
_this.container.style.cursor = 'grabbing';
|
1251 |
+
_this.container.style.cursor = '-moz-grabbin';
|
1252 |
+
_this.container.style.cursor = '-webkit-grabbing';
|
1253 |
+
}
|
1254 |
+
//Velocity
|
1255 |
+
if (!velocityPrevPosition) velocityPrevPosition = _this.touches.current;
|
1256 |
+
if (!velocityPrevTime) velocityPrevTime = (new Date).getTime();
|
1257 |
+
_this.velocity = (_this.touches.current - velocityPrevPosition) / ((new Date).getTime() - velocityPrevTime) / 2;
|
1258 |
+
if (Math.abs(_this.touches.current - velocityPrevPosition) < 2) _this.velocity = 0;
|
1259 |
+
velocityPrevPosition = _this.touches.current;
|
1260 |
+
velocityPrevTime = (new Date).getTime();
|
1261 |
+
//Callbacks
|
1262 |
+
_this.callPlugins('onTouchMoveEnd');
|
1263 |
+
if (params.onTouchMove) params.onTouchMove(_this);
|
1264 |
+
|
1265 |
+
return false;
|
1266 |
+
}
|
1267 |
+
}
|
1268 |
+
|
1269 |
+
function onTouchEnd(event) {
|
1270 |
+
//Check For scrolling
|
1271 |
+
if (isScrolling) {
|
1272 |
+
_this.swipeReset();
|
1273 |
+
}
|
1274 |
+
// If slider is not touched exit
|
1275 |
+
if (params.onlyExternal || !_this.isTouched) return;
|
1276 |
+
_this.isTouched = false
|
1277 |
+
|
1278 |
+
//Return Grab Cursor
|
1279 |
+
if (params.grabCursor) {
|
1280 |
+
_this.container.style.cursor = 'move';
|
1281 |
+
_this.container.style.cursor = 'grab';
|
1282 |
+
_this.container.style.cursor = '-moz-grab';
|
1283 |
+
_this.container.style.cursor = '-webkit-grab';
|
1284 |
+
}
|
1285 |
+
|
1286 |
+
//Check for Current Position
|
1287 |
+
if (!_this.positions.current && _this.positions.current !== 0) {
|
1288 |
+
_this.positions.current = _this.positions.start
|
1289 |
+
}
|
1290 |
+
|
1291 |
+
//For case if slider touched but not moved
|
1292 |
+
if (params.followFinger) {
|
1293 |
+
if (isH) _this.setWrapperTranslate(_this.positions.current, 0, 0)
|
1294 |
+
else _this.setWrapperTranslate(0, _this.positions.current, 0)
|
1295 |
+
}
|
1296 |
+
//--
|
1297 |
+
|
1298 |
+
// TouchEndTime
|
1299 |
+
_this.times.end = (new Date()).getTime();
|
1300 |
+
|
1301 |
+
//Difference
|
1302 |
+
_this.touches.diff = _this.touches.current - _this.touches.start
|
1303 |
+
_this.touches.abs = Math.abs(_this.touches.diff)
|
1304 |
+
|
1305 |
+
_this.positions.diff = _this.positions.current - _this.positions.start
|
1306 |
+
_this.positions.abs = Math.abs(_this.positions.diff)
|
1307 |
+
|
1308 |
+
var diff = _this.positions.diff;
|
1309 |
+
var diffAbs = _this.positions.abs;
|
1310 |
+
var timeDiff = _this.times.end - _this.times.start
|
1311 |
+
|
1312 |
+
if (diffAbs < 5 && (timeDiff) < 300 && _this.allowLinks == false) {
|
1313 |
+
if (!params.freeMode && diffAbs != 0) _this.swipeReset()
|
1314 |
+
//Release inner links
|
1315 |
+
if (params.preventLinks) {
|
1316 |
+
_this.allowLinks = true;
|
1317 |
+
}
|
1318 |
+
if (params.onSlideClick) {
|
1319 |
+
_this.allowSlideClick = true;
|
1320 |
+
}
|
1321 |
+
}
|
1322 |
+
setTimeout(function () {
|
1323 |
+
//Release inner links
|
1324 |
+
if (params.preventLinks) {
|
1325 |
+
_this.allowLinks = true;
|
1326 |
+
}
|
1327 |
+
if (params.onSlideClick) {
|
1328 |
+
_this.allowSlideClick = true;
|
1329 |
+
}
|
1330 |
+
}, 100)
|
1331 |
+
|
1332 |
+
|
1333 |
+
//Exit if not moved
|
1334 |
+
if (!_this.isMoved) {
|
1335 |
+
_this.isMoved = false;
|
1336 |
+
if (params.onTouchEnd) params.onTouchEnd(_this)
|
1337 |
+
_this.callPlugins('onTouchEnd');
|
1338 |
+
return;
|
1339 |
+
}
|
1340 |
+
_this.isMoved = false;
|
1341 |
+
|
1342 |
+
var maxPosition = maxWrapperPosition();
|
1343 |
+
|
1344 |
+
//Prevent Negative Back Sliding
|
1345 |
+
if (_this.positions.current > 0) {
|
1346 |
+
_this.swipeReset()
|
1347 |
+
if (params.onTouchEnd) params.onTouchEnd(_this)
|
1348 |
+
_this.callPlugins('onTouchEnd');
|
1349 |
+
return;
|
1350 |
+
}
|
1351 |
+
//Prevent After-End Sliding
|
1352 |
+
if (_this.positions.current < -maxPosition) {
|
1353 |
+
_this.swipeReset()
|
1354 |
+
if (params.onTouchEnd) params.onTouchEnd(_this)
|
1355 |
+
_this.callPlugins('onTouchEnd');
|
1356 |
+
return;
|
1357 |
+
}
|
1358 |
+
|
1359 |
+
//Free Mode
|
1360 |
+
if (params.freeMode) {
|
1361 |
+
if (params.freeModeFluid) {
|
1362 |
+
var momentumDuration = 1000 * params.momentumRatio;
|
1363 |
+
var momentumDistance = _this.velocity * momentumDuration;
|
1364 |
+
var newPosition = _this.positions.current + momentumDistance
|
1365 |
+
var doBounce = false;
|
1366 |
+
var afterBouncePosition;
|
1367 |
+
var bounceAmount = Math.abs(_this.velocity) * 20 * params.momentumBounceRatio;
|
1368 |
+
if (newPosition < -maxPosition) {
|
1369 |
+
if (params.momentumBounce && _this.support.transitions) {
|
1370 |
+
if (newPosition + maxPosition < -bounceAmount) newPosition = -maxPosition - bounceAmount;
|
1371 |
+
afterBouncePosition = -maxPosition;
|
1372 |
+
doBounce = true;
|
1373 |
+
allowMomentumBounce = true;
|
1374 |
+
} else newPosition = -maxPosition;
|
1375 |
+
}
|
1376 |
+
if (newPosition > 0) {
|
1377 |
+
if (params.momentumBounce && _this.support.transitions) {
|
1378 |
+
if (newPosition > bounceAmount) newPosition = bounceAmount;
|
1379 |
+
afterBouncePosition = 0
|
1380 |
+
doBounce = true;
|
1381 |
+
allowMomentumBounce = true;
|
1382 |
+
} else newPosition = 0;
|
1383 |
+
}
|
1384 |
+
//Fix duration
|
1385 |
+
if (_this.velocity != 0) momentumDuration = Math.abs((newPosition - _this.positions.current) / _this.velocity)
|
1386 |
+
|
1387 |
+
if (isH) _this.setWrapperTranslate(newPosition, 0, 0);
|
1388 |
+
else _this.setWrapperTranslate(0, newPosition, 0);
|
1389 |
+
|
1390 |
+
_this.setWrapperTransition(momentumDuration);
|
1391 |
+
|
1392 |
+
if (params.momentumBounce && doBounce) {
|
1393 |
+
_this.wrapperTransitionEnd(function () {
|
1394 |
+
if (!allowMomentumBounce) return;
|
1395 |
+
if (params.onMomentumBounce) params.onMomentumBounce(_this);
|
1396 |
+
if (isH) _this.setWrapperTranslate(afterBouncePosition, 0, 0);
|
1397 |
+
else _this.setWrapperTranslate(0, afterBouncePosition, 0);
|
1398 |
+
_this.setWrapperTransition(300);
|
1399 |
+
})
|
1400 |
+
}
|
1401 |
+
|
1402 |
+
_this.updateActiveSlide(newPosition)
|
1403 |
+
}
|
1404 |
+
if (!params.freeModeFluid || timeDiff >= 300) _this.updateActiveSlide(_this.positions.current)
|
1405 |
+
|
1406 |
+
if (params.onTouchEnd) params.onTouchEnd(_this)
|
1407 |
+
_this.callPlugins('onTouchEnd');
|
1408 |
+
return;
|
1409 |
+
}
|
1410 |
+
|
1411 |
+
//Direction
|
1412 |
+
direction = diff < 0 ? "toNext" : "toPrev"
|
1413 |
+
|
1414 |
+
//Short Touches
|
1415 |
+
if (direction == "toNext" && (timeDiff <= 300)) {
|
1416 |
+
if (diffAbs < 30 || !params.shortSwipes) _this.swipeReset()
|
1417 |
+
else _this.swipeNext(true);
|
1418 |
+
}
|
1419 |
+
|
1420 |
+
if (direction == "toPrev" && (timeDiff <= 300)) {
|
1421 |
+
if (diffAbs < 30 || !params.shortSwipes) _this.swipeReset()
|
1422 |
+
else _this.swipePrev(true);
|
1423 |
+
}
|
1424 |
+
|
1425 |
+
//Long Touches
|
1426 |
+
var targetSlideSize = 0;
|
1427 |
+
if (params.slidesPerView == 'auto') {
|
1428 |
+
//Define current slide's width
|
1429 |
+
var currentPosition = Math.abs(isH ? _this.getWrapperTranslate('x') : _this.getWrapperTranslate('y'));
|
1430 |
+
var slidesOffset = 0;
|
1431 |
+
var _slideSize;
|
1432 |
+
for (var i = 0; i < _this.slides.length; i++) {
|
1433 |
+
_slideSize = isH ? _this.slides[i].getWidth(true) : _this.slides[i].getHeight(true);
|
1434 |
+
slidesOffset += _slideSize;
|
1435 |
+
if (slidesOffset > currentPosition) {
|
1436 |
+
targetSlideSize = _slideSize;
|
1437 |
+
break;
|
1438 |
+
}
|
1439 |
+
}
|
1440 |
+
if (targetSlideSize > containerSize) targetSlideSize = containerSize;
|
1441 |
+
} else {
|
1442 |
+
targetSlideSize = slideSize * params.slidesPerView;
|
1443 |
+
}
|
1444 |
+
if (direction == "toNext" && (timeDiff > 300)) {
|
1445 |
+
if (diffAbs >= targetSlideSize * 0.5) {
|
1446 |
+
_this.swipeNext(true)
|
1447 |
+
} else {
|
1448 |
+
_this.swipeReset()
|
1449 |
+
}
|
1450 |
+
}
|
1451 |
+
if (direction == "toPrev" && (timeDiff > 300)) {
|
1452 |
+
if (diffAbs >= targetSlideSize * 0.5) {
|
1453 |
+
_this.swipePrev(true);
|
1454 |
+
} else {
|
1455 |
+
_this.swipeReset()
|
1456 |
+
}
|
1457 |
+
}
|
1458 |
+
if (params.onTouchEnd) params.onTouchEnd(_this)
|
1459 |
+
_this.callPlugins('onTouchEnd');
|
1460 |
+
}
|
1461 |
+
|
1462 |
+
/*==================================================
|
1463 |
+
Swipe Functions
|
1464 |
+
====================================================*/
|
1465 |
+
_this.swipeNext = function (internal) {
|
1466 |
+
if (!internal && params.loop) _this.fixLoop();
|
1467 |
+
_this.callPlugins('onSwipeNext');
|
1468 |
+
var currentPosition = isH ? _this.getWrapperTranslate('x') : _this.getWrapperTranslate('y');
|
1469 |
+
var newPosition = currentPosition;
|
1470 |
+
if (params.slidesPerView == 'auto') {
|
1471 |
+
for (var i = 0; i < _this.snapGrid.length; i++) {
|
1472 |
+
if (-currentPosition >= _this.snapGrid[i] && -currentPosition < _this.snapGrid[i + 1]) {
|
1473 |
+
newPosition = -_this.snapGrid[i + 1]
|
1474 |
+
break;
|
1475 |
+
}
|
1476 |
+
}
|
1477 |
+
} else {
|
1478 |
+
var groupSize = slideSize * params.slidesPerGroup;
|
1479 |
+
newPosition = -(Math.floor(Math.abs(currentPosition) / Math.floor(groupSize)) * groupSize + groupSize);
|
1480 |
+
}
|
1481 |
+
if (newPosition < -maxWrapperPosition()) {
|
1482 |
+
newPosition = -maxWrapperPosition()
|
1483 |
+
};
|
1484 |
+
|
1485 |
+
if (newPosition == currentPosition) return false;
|
1486 |
+
|
1487 |
+
swipeToPosition(newPosition, 'next');
|
1488 |
+
return true
|
1489 |
+
}
|
1490 |
+
_this.swipePrev = function (internal) {
|
1491 |
+
if (!internal && params.loop) _this.fixLoop();
|
1492 |
+
if (!internal && params.autoplay) _this.stopAutoplay();
|
1493 |
+
_this.callPlugins('onSwipePrev');
|
1494 |
+
|
1495 |
+
var currentPosition = Math.ceil(isH ? _this.getWrapperTranslate('x') : _this.getWrapperTranslate('y'));
|
1496 |
+
var newPosition;
|
1497 |
+
if (params.slidesPerView == 'auto') {
|
1498 |
+
newPosition = 0;
|
1499 |
+
for (var i = 1; i < _this.snapGrid.length; i++) {
|
1500 |
+
if (-currentPosition == _this.snapGrid[i]) {
|
1501 |
+
newPosition = -_this.snapGrid[i - 1]
|
1502 |
+
break;
|
1503 |
+
}
|
1504 |
+
if (-currentPosition > _this.snapGrid[i] && -currentPosition < _this.snapGrid[i + 1]) {
|
1505 |
+
newPosition = -_this.snapGrid[i]
|
1506 |
+
break;
|
1507 |
+
}
|
1508 |
+
}
|
1509 |
+
} else {
|
1510 |
+
var groupSize = slideSize * params.slidesPerGroup;
|
1511 |
+
newPosition = -(Math.ceil(-currentPosition / groupSize) - 1) * groupSize;
|
1512 |
+
}
|
1513 |
+
|
1514 |
+
if (newPosition > 0) newPosition = 0;
|
1515 |
+
|
1516 |
+
if (newPosition == currentPosition) return false;
|
1517 |
+
swipeToPosition(newPosition, 'prev');
|
1518 |
+
return true;
|
1519 |
+
|
1520 |
+
}
|
1521 |
+
_this.swipeReset = function () {
|
1522 |
+
_this.callPlugins('onSwipeReset');
|
1523 |
+
var currentPosition = isH ? _this.getWrapperTranslate('x') : _this.getWrapperTranslate('y');
|
1524 |
+
var groupSize = slideSize * params.slidesPerGroup;
|
1525 |
+
var newPosition;
|
1526 |
+
var maxPosition = -maxWrapperPosition();
|
1527 |
+
if (params.slidesPerView == 'auto') {
|
1528 |
+
newPosition = 0;
|
1529 |
+
for (var i = 0; i < _this.snapGrid.length; i++) {
|
1530 |
+
if (-currentPosition === _this.snapGrid[i]) return;
|
1531 |
+
if (-currentPosition >= _this.snapGrid[i] && -currentPosition < _this.snapGrid[i + 1]) {
|
1532 |
+
if (_this.positions.diff > 0) newPosition = -_this.snapGrid[i + 1]
|
1533 |
+
else newPosition = -_this.snapGrid[i]
|
1534 |
+
break;
|
1535 |
+
}
|
1536 |
+
}
|
1537 |
+
if (-currentPosition >= _this.snapGrid[_this.snapGrid.length - 1]) newPosition = -_this.snapGrid[_this.snapGrid.length - 1];
|
1538 |
+
if (currentPosition <= -maxWrapperPosition()) newPosition = -maxWrapperPosition()
|
1539 |
+
} else {
|
1540 |
+
newPosition = currentPosition < 0 ? Math.round(currentPosition / groupSize) * groupSize : 0
|
1541 |
+
}
|
1542 |
+
if (params.scrollContainer) {
|
1543 |
+
newPosition = currentPosition < 0 ? currentPosition : 0;
|
1544 |
+
}
|
1545 |
+
if (newPosition < -maxWrapperPosition()) {
|
1546 |
+
newPosition = -maxWrapperPosition()
|
1547 |
+
}
|
1548 |
+
if (params.scrollContainer && (containerSize > slideSize)) {
|
1549 |
+
newPosition = 0;
|
1550 |
+
}
|
1551 |
+
|
1552 |
+
if (newPosition == currentPosition) return false;
|
1553 |
+
|
1554 |
+
swipeToPosition(newPosition, 'reset');
|
1555 |
+
return true;
|
1556 |
+
}
|
1557 |
+
_this.swipeTo = function (index, speed, runCallbacks) {
|
1558 |
+
index = parseInt(index, 10);
|
1559 |
+
_this.callPlugins('onSwipeTo', {
|
1560 |
+
index: index,
|
1561 |
+
speed: speed
|
1562 |
+
});
|
1563 |
+
if (params.loop) index = index + _this.loopedSlides;
|
1564 |
+
var currentPosition = isH ? _this.getWrapperTranslate('x') : _this.getWrapperTranslate('y');
|
1565 |
+
if (index > (_this.slides.length - 1)) return;
|
1566 |
+
if (index < 0) return;
|
1567 |
+
var newPosition
|
1568 |
+
if (params.slidesPerView == 'auto') {
|
1569 |
+
newPosition = -_this.slidesGrid[index];
|
1570 |
+
} else {
|
1571 |
+
newPosition = -index * slideSize;
|
1572 |
+
}
|
1573 |
+
if (newPosition < -maxWrapperPosition()) {
|
1574 |
+
newPosition = -maxWrapperPosition();
|
1575 |
+
};
|
1576 |
+
|
1577 |
+
if (newPosition == currentPosition) return false;
|
1578 |
+
|
1579 |
+
runCallbacks = runCallbacks === false ? false : true;
|
1580 |
+
swipeToPosition(newPosition, 'to', {
|
1581 |
+
index: index,
|
1582 |
+
speed: speed,
|
1583 |
+
runCallbacks: runCallbacks
|
1584 |
+
});
|
1585 |
+
return true;
|
1586 |
+
}
|
1587 |
+
|
1588 |
+
function swipeToPosition(newPosition, action, toOptions) {
|
1589 |
+
if (_this.support.transitions || !params.DOMAnimation) {
|
1590 |
+
if (isH) _this.setWrapperTranslate(newPosition, 0, 0);
|
1591 |
+
else _this.setWrapperTranslate(0, newPosition, 0);
|
1592 |
+
var speed = (action == 'to' && toOptions.speed >= 0) ? toOptions.speed : params.speed;
|
1593 |
+
_this.setWrapperTransition(speed);
|
1594 |
+
} else {
|
1595 |
+
//Try the DOM animation
|
1596 |
+
var currentPosition = isH ? _this.getWrapperTranslate('x') : _this.getWrapperTranslate('y');
|
1597 |
+
var speed = (action == 'to' && toOptions.speed >= 0) ? toOptions.speed : params.speed;
|
1598 |
+
var animationStep = Math.ceil((newPosition - currentPosition) / speed * (1000 / 60));
|
1599 |
+
var direction = currentPosition > newPosition ? 'toNext' : 'toPrev';
|
1600 |
+
var condition = direction == 'toNext' ? currentPosition > newPosition : currentPosition < newPosition;
|
1601 |
+
if (_this._DOMAnimating) return;
|
1602 |
+
|
1603 |
+
anim()
|
1604 |
+
}
|
1605 |
+
|
1606 |
+
function anim() {
|
1607 |
+
currentPosition += animationStep;
|
1608 |
+
condition = direction == 'toNext' ? currentPosition > newPosition : currentPosition < newPosition;
|
1609 |
+
if (condition) {
|
1610 |
+
if (isH) _this.setWrapperTranslate(Math.round(currentPosition), 0)
|
1611 |
+
else _this.setWrapperTranslate(0, Math.round(currentPosition))
|
1612 |
+
_this._DOMAnimating = true
|
1613 |
+
window.setTimeout(function () {
|
1614 |
+
anim()
|
1615 |
+
}, 1000 / 60)
|
1616 |
+
} else {
|
1617 |
+
if (params.onSlideChangeEnd) params.onSlideChangeEnd(_this)
|
1618 |
+
if (isH) _this.setWrapperTranslate(newPosition, 0);
|
1619 |
+
else _this.setWrapperTranslate(0, newPosition);
|
1620 |
+
_this._DOMAnimating = false;
|
1621 |
+
}
|
1622 |
+
}
|
1623 |
+
|
1624 |
+
//Update Active Slide Index
|
1625 |
+
_this.updateActiveSlide(newPosition);
|
1626 |
+
|
1627 |
+
//Callbacks
|
1628 |
+
if (params.onSlideNext && action == 'next') {
|
1629 |
+
params.onSlideNext(_this, newPosition)
|
1630 |
+
}
|
1631 |
+
if (params.onSlidePrev && action == 'prev') {
|
1632 |
+
params.onSlidePrev(_this, newPosition)
|
1633 |
+
}
|
1634 |
+
//"Reset" Callback
|
1635 |
+
if (params.onSlideReset && action == 'reset') {
|
1636 |
+
params.onSlideReset(_this, newPosition)
|
1637 |
+
}
|
1638 |
+
|
1639 |
+
//"Next", "Prev" and "To" Callbacks
|
1640 |
+
if (action == 'next' || action == 'prev' || (action == 'to' && toOptions.runCallbacks == true)) slideChangeCallbacks()
|
1641 |
+
}
|
1642 |
+
/*==================================================
|
1643 |
+
Transition Callbacks
|
1644 |
+
====================================================*/
|
1645 |
+
//Prevent Multiple Callbacks
|
1646 |
+
_this._queueStartCallbacks = false;
|
1647 |
+
_this._queueEndCallbacks = false;
|
1648 |
+
|
1649 |
+
function slideChangeCallbacks() {
|
1650 |
+
//Transition Start Callback
|
1651 |
+
_this.callPlugins('onSlideChangeStart');
|
1652 |
+
if (params.onSlideChangeStart) {
|
1653 |
+
if (params.queueStartCallbacks && _this.support.transitions) {
|
1654 |
+
if (_this._queueStartCallbacks) return;
|
1655 |
+
_this._queueStartCallbacks = true;
|
1656 |
+
params.onSlideChangeStart(_this)
|
1657 |
+
_this.wrapperTransitionEnd(function () {
|
1658 |
+
_this._queueStartCallbacks = false;
|
1659 |
+
})
|
1660 |
+
} else params.onSlideChangeStart(_this)
|
1661 |
+
}
|
1662 |
+
//Transition End Callback
|
1663 |
+
if (params.onSlideChangeEnd) {
|
1664 |
+
if (_this.support.transitions) {
|
1665 |
+
if (params.queueEndCallbacks) {
|
1666 |
+
if (_this._queueEndCallbacks) return;
|
1667 |
+
_this._queueEndCallbacks = true;
|
1668 |
+
_this.wrapperTransitionEnd(params.onSlideChangeEnd)
|
1669 |
+
} else _this.wrapperTransitionEnd(params.onSlideChangeEnd)
|
1670 |
+
} else {
|
1671 |
+
if (!params.DOMAnimation) {
|
1672 |
+
setTimeout(function () {
|
1673 |
+
params.onSlideChangeEnd(_this)
|
1674 |
+
}, 10)
|
1675 |
+
}
|
1676 |
+
}
|
1677 |
+
}
|
1678 |
+
}
|
1679 |
+
/*==================================================
|
1680 |
+
Update Active Slide Index
|
1681 |
+
====================================================*/
|
1682 |
+
_this.updateActiveSlide = function (position) {
|
1683 |
+
if (!_this.initialized) return;
|
1684 |
+
if (_this.slides.length == 0) return;
|
1685 |
+
_this.previousIndex = _this.activeIndex;
|
1686 |
+
if (position > 0) position = 0;
|
1687 |
+
if (typeof position == 'undefined') position = isH ? _this.getWrapperTranslate('x') : _this.getWrapperTranslate('y');
|
1688 |
+
|
1689 |
+
if (params.slidesPerView == 'auto') {
|
1690 |
+
var slidesOffset = 0;
|
1691 |
+
_this.activeIndex = _this.slidesGrid.indexOf(-position);
|
1692 |
+
if (_this.activeIndex < 0) {
|
1693 |
+
for (var i = 0; i < _this.slidesGrid.length - 1; i++) {
|
1694 |
+
if (-position > _this.slidesGrid[i] && -position < _this.slidesGrid[i + 1]) {
|
1695 |
+
break;
|
1696 |
+
}
|
1697 |
+
}
|
1698 |
+
var leftDistance = Math.abs(_this.slidesGrid[i] + position)
|
1699 |
+
var rightDistance = Math.abs(_this.slidesGrid[i + 1] + position)
|
1700 |
+
if (leftDistance <= rightDistance) _this.activeIndex = i;
|
1701 |
+
else _this.activeIndex = i + 1;
|
1702 |
+
}
|
1703 |
+
} else {
|
1704 |
+
if (params.visibilityFullFit) _this.activeIndex = Math.ceil(-position / slideSize);
|
1705 |
+
else _this.activeIndex = Math.round(-position / slideSize);
|
1706 |
+
}
|
1707 |
+
if (_this.activeIndex == _this.slides.length) _this.activeIndex = _this.slides.length - 1;
|
1708 |
+
if (_this.activeIndex < 0) _this.activeIndex = 0;
|
1709 |
+
// Check for slide
|
1710 |
+
if (!_this.slides[_this.activeIndex]) return;
|
1711 |
+
// Calc Visible slides
|
1712 |
+
_this.calcVisibleSlides(position);
|
1713 |
+
|
1714 |
+
// Mark visible and active slides with additonal classes
|
1715 |
+
var activeClassRegexp = new RegExp("\\s*" + params.slideActiveClass);
|
1716 |
+
var inViewClassRegexp = new RegExp("\\s*" + params.slideVisibleClass);
|
1717 |
+
|
1718 |
+
for (var i = 0; i < _this.slides.length; i++) {
|
1719 |
+
_this.slides[i].className = _this.slides[i].className.replace(activeClassRegexp, '').replace(inViewClassRegexp, '');
|
1720 |
+
if (_this.visibleSlides.indexOf(_this.slides[i]) >= 0) {
|
1721 |
+
_this.slides[i].className += ' ' + params.slideVisibleClass;
|
1722 |
+
}
|
1723 |
+
|
1724 |
+
}
|
1725 |
+
_this.slides[_this.activeIndex].className += ' ' + params.slideActiveClass;
|
1726 |
+
|
1727 |
+
//Update loop index
|
1728 |
+
if (params.loop) {
|
1729 |
+
var ls = _this.loopedSlides;
|
1730 |
+
_this.activeLoopIndex = _this.activeIndex - ls;
|
1731 |
+
if (_this.activeLoopIndex >= _this.slides.length - ls * 2) {
|
1732 |
+
_this.activeLoopIndex = _this.slides.length - ls * 2 - _this.activeLoopIndex;
|
1733 |
+
}
|
1734 |
+
if (_this.activeLoopIndex < 0) {
|
1735 |
+
_this.activeLoopIndex = _this.slides.length - ls * 2 + _this.activeLoopIndex;
|
1736 |
+
}
|
1737 |
+
} else {
|
1738 |
+
_this.activeLoopIndex = _this.activeIndex;
|
1739 |
+
}
|
1740 |
+
//Update Pagination
|
1741 |
+
if (params.pagination) {
|
1742 |
+
_this.updatePagination(position);
|
1743 |
+
}
|
1744 |
+
}
|
1745 |
+
/*==================================================
|
1746 |
+
Pagination
|
1747 |
+
====================================================*/
|
1748 |
+
_this.createPagination = function (firstInit) {
|
1749 |
+
if (params.paginationClickable && _this.paginationButtons) {
|
1750 |
+
removePaginationEvents();
|
1751 |
+
}
|
1752 |
+
var paginationHTML = "";
|
1753 |
+
var numOfSlides = _this.slides.length;
|
1754 |
+
var numOfButtons = numOfSlides;
|
1755 |
+
if (params.loop) numOfButtons -= _this.loopedSlides * 2
|
1756 |
+
for (var i = 0; i < numOfButtons; i++) {
|
1757 |
+
paginationHTML += '<' + params.paginationElement + ' class="' + params.paginationElementClass + '"></' + params.paginationElement + '>'
|
1758 |
+
}
|
1759 |
+
_this.paginationContainer = params.pagination.nodeType ? params.pagination : $$(params.pagination)[0];
|
1760 |
+
_this.paginationContainer.innerHTML = paginationHTML;
|
1761 |
+
_this.paginationButtons = []
|
1762 |
+
if (document.querySelectorAll) _this.paginationButtons = _this.paginationContainer.querySelectorAll('.' + params.paginationElementClass);
|
1763 |
+
else if (window.jQuery) _this.paginationButtons = $$(_this.paginationContainer).find('.' + params.paginationElementClass);
|
1764 |
+
|
1765 |
+
if (!firstInit) _this.updatePagination()
|
1766 |
+
_this.callPlugins('onCreatePagination');
|
1767 |
+
if (params.paginationClickable) {
|
1768 |
+
addPaginationEvents();
|
1769 |
+
}
|
1770 |
+
}
|
1771 |
+
|
1772 |
+
function removePaginationEvents() {
|
1773 |
+
var pagers = _this.paginationButtons;
|
1774 |
+
for (var i = 0; i < pagers.length; i++) {
|
1775 |
+
_this.h.removeEventListener(pagers[i], 'click', paginationClick, false)
|
1776 |
+
}
|
1777 |
+
}
|
1778 |
+
|
1779 |
+
function addPaginationEvents() {
|
1780 |
+
var pagers = _this.paginationButtons;
|
1781 |
+
for (var i = 0; i < pagers.length; i++) {
|
1782 |
+
_this.h.addEventListener(pagers[i], 'click', paginationClick, false)
|
1783 |
+
}
|
1784 |
+
}
|
1785 |
+
|
1786 |
+
function paginationClick(e) {
|
1787 |
+
var index;
|
1788 |
+
var target = e.target || e.srcElement;
|
1789 |
+
var pagers = _this.paginationButtons;
|
1790 |
+
for (var i = 0; i < pagers.length; i++) {
|
1791 |
+
if (target === pagers[i]) index = i;
|
1792 |
+
}
|
1793 |
+
_this.swipeTo(index)
|
1794 |
+
}
|
1795 |
+
_this.updatePagination = function (position) {
|
1796 |
+
if (_this.slides.length < 1) return;
|
1797 |
+
|
1798 |
+
if (document.querySelectorAll) var activePagers = _this.paginationContainer.querySelectorAll('.' + params.paginationActiveClass)
|
1799 |
+
else if (window.jQuery) var activePagers = $$(_this.paginationContainer).find('.' + params.paginationActiveClass);
|
1800 |
+
|
1801 |
+
if (!activePagers) return
|
1802 |
+
//Reset all Buttons' class to not active
|
1803 |
+
var pagers = _this.paginationButtons;
|
1804 |
+
for (var i = 0; i < pagers.length; i++) {
|
1805 |
+
pagers[i].className = params.paginationElementClass
|
1806 |
+
}
|
1807 |
+
var indexOffset = params.loop ? _this.loopedSlides : 0;
|
1808 |
+
if (params.paginationAsRange) {
|
1809 |
+
if (!_this.visibleSlides) _this.calcVisibleSlides(position)
|
1810 |
+
//Get Visible Indexes
|
1811 |
+
var visibleIndexes = [];
|
1812 |
+
for (var i = 0; i < _this.visibleSlides.length; i++) {
|
1813 |
+
var visIndex = _this.slides.indexOf(_this.visibleSlides[i]) - indexOffset
|
1814 |
+
|
1815 |
+
if (params.loop && visIndex < 0) {
|
1816 |
+
visIndex = _this.slides.length - _this.loopedSlides * 2 + visIndex;
|
1817 |
+
}
|
1818 |
+
if (params.loop && visIndex >= _this.slides.length - _this.loopedSlides * 2) {
|
1819 |
+
visIndex = _this.slides.length - _this.loopedSlides * 2 - visIndex;
|
1820 |
+
visIndex = Math.abs(visIndex)
|
1821 |
+
}
|
1822 |
+
visibleIndexes.push(visIndex)
|
1823 |
+
}
|
1824 |
+
for (i = 0; i < visibleIndexes.length; i++) {
|
1825 |
+
if (pagers[visibleIndexes[i]]) pagers[visibleIndexes[i]].className += ' ' + params.paginationVisibleClass;
|
1826 |
+
}
|
1827 |
+
if (params.loop) {
|
1828 |
+
pagers[_this.activeLoopIndex].className += ' ' + params.paginationActiveClass;
|
1829 |
+
} else {
|
1830 |
+
pagers[_this.activeIndex].className += ' ' + params.paginationActiveClass;
|
1831 |
+
}
|
1832 |
+
} else {
|
1833 |
+
if (params.loop) {
|
1834 |
+
pagers[_this.activeLoopIndex].className += ' ' + params.paginationActiveClass + ' ' + params.paginationVisibleClass;
|
1835 |
+
} else {
|
1836 |
+
pagers[_this.activeIndex].className += ' ' + params.paginationActiveClass + ' ' + params.paginationVisibleClass;
|
1837 |
+
}
|
1838 |
+
|
1839 |
+
}
|
1840 |
+
|
1841 |
+
}
|
1842 |
+
_this.calcVisibleSlides = function (position) {
|
1843 |
+
var visibleSlides = [];
|
1844 |
+
var _slideLeft = 0,
|
1845 |
+
_slideSize = 0,
|
1846 |
+
_slideRight = 0;
|
1847 |
+
if (isH && _this.wrapperLeft > 0) position = position + _this.wrapperLeft;
|
1848 |
+
if (!isH && _this.wrapperTop > 0) position = position + _this.wrapperTop;
|
1849 |
+
|
1850 |
+
for (var i = 0; i < _this.slides.length; i++) {
|
1851 |
+
_slideLeft += _slideSize;
|
1852 |
+
if (params.slidesPerView == 'auto') _slideSize = isH ? _this.h.getWidth(_this.slides[i], true) : _this.h.getHeight(_this.slides[i], true);
|
1853 |
+
else _slideSize = slideSize;
|
1854 |
+
|
1855 |
+
_slideRight = _slideLeft + _slideSize;
|
1856 |
+
var isVisibile = false;
|
1857 |
+
if (params.visibilityFullFit) {
|
1858 |
+
if (_slideLeft >= -position && _slideRight <= -position + containerSize) isVisibile = true;
|
1859 |
+
if (_slideLeft <= -position && _slideRight >= -position + containerSize) isVisibile = true;
|
1860 |
+
} else {
|
1861 |
+
|
1862 |
+
if (_slideRight > -position && _slideRight <= ((-position + containerSize))) isVisibile = true;
|
1863 |
+
if (_slideLeft >= -position && _slideLeft < ((-position + containerSize))) isVisibile = true;
|
1864 |
+
if (_slideLeft < -position && _slideRight > ((-position + containerSize))) isVisibile = true;
|
1865 |
+
}
|
1866 |
+
|
1867 |
+
if (isVisibile) visibleSlides.push(_this.slides[i])
|
1868 |
+
|
1869 |
+
}
|
1870 |
+
if (visibleSlides.length == 0) visibleSlides = [_this.slides[_this.activeIndex]]
|
1871 |
+
|
1872 |
+
_this.visibleSlides = visibleSlides;
|
1873 |
+
}
|
1874 |
+
|
1875 |
+
/*==========================================
|
1876 |
+
Autoplay
|
1877 |
+
============================================*/
|
1878 |
+
_this.autoPlayIntervalId = undefined;
|
1879 |
+
_this.startAutoplay = function () {
|
1880 |
+
if (typeof _this.autoPlayIntervalId !== 'undefined') return false;
|
1881 |
+
if (params.autoplay && !params.loop) {
|
1882 |
+
_this.autoPlayIntervalId = setInterval(function () {
|
1883 |
+
if (!_this.swipeNext(true)) _this.swipeTo(0);
|
1884 |
+
}, params.autoplay)
|
1885 |
+
}
|
1886 |
+
if (params.autoplay && params.loop) {
|
1887 |
+
_this.autoPlayIntervalId = setInterval(function () {
|
1888 |
+
_this.swipeNext();
|
1889 |
+
}, params.autoplay)
|
1890 |
+
}
|
1891 |
+
_this.callPlugins('onAutoplayStart');
|
1892 |
+
}
|
1893 |
+
_this.stopAutoplay = function () {
|
1894 |
+
if (_this.autoPlayIntervalId) clearInterval(_this.autoPlayIntervalId);
|
1895 |
+
_this.autoPlayIntervalId = undefined;
|
1896 |
+
_this.callPlugins('onAutoplayStop');
|
1897 |
+
}
|
1898 |
+
/*==================================================
|
1899 |
+
Loop
|
1900 |
+
====================================================*/
|
1901 |
+
_this.loopCreated = false;
|
1902 |
+
_this.removeLoopedSlides = function () {
|
1903 |
+
if (_this.loopCreated) {
|
1904 |
+
for (var i = 0; i < _this.slides.length; i++) {
|
1905 |
+
if (_this.slides[i].getData('looped') === true) _this.wrapper.removeChild(_this.slides[i]);
|
1906 |
+
}
|
1907 |
+
}
|
1908 |
+
}
|
1909 |
+
_this.createLoop = function () {
|
1910 |
+
if (_this.slides.length == 0) return;
|
1911 |
+
_this.loopedSlides = params.slidesPerView + params.loopAdditionalSlides;
|
1912 |
+
|
1913 |
+
var slideFirstHTML = '';
|
1914 |
+
var slideLastHTML = '';
|
1915 |
+
|
1916 |
+
//Grab First Slides
|
1917 |
+
for (var i = 0; i < _this.loopedSlides; i++) {
|
1918 |
+
slideFirstHTML += _this.slides[i].outerHTML
|
1919 |
+
}
|
1920 |
+
//Grab Last Slides
|
1921 |
+
for (i = _this.slides.length - _this.loopedSlides; i < _this.slides.length; i++) {
|
1922 |
+
slideLastHTML += _this.slides[i].outerHTML
|
1923 |
+
}
|
1924 |
+
wrapper.innerHTML = slideLastHTML + wrapper.innerHTML + slideFirstHTML;
|
1925 |
+
|
1926 |
+
_this.loopCreated = true;
|
1927 |
+
_this.calcSlides();
|
1928 |
+
|
1929 |
+
//Update Looped Slides with special class
|
1930 |
+
for (i = 0; i < _this.slides.length; i++) {
|
1931 |
+
if (i < _this.loopedSlides || i >= _this.slides.length - _this.loopedSlides) _this.slides[i].setData('looped', true);
|
1932 |
+
}
|
1933 |
+
_this.callPlugins('onCreateLoop');
|
1934 |
+
|
1935 |
+
}
|
1936 |
+
_this.fixLoop = function () {
|
1937 |
+
//Fix For Negative Oversliding
|
1938 |
+
if (_this.activeIndex < _this.loopedSlides) {
|
1939 |
+
var newIndex = _this.slides.length - _this.loopedSlides * 3 + _this.activeIndex;
|
1940 |
+
_this.swipeTo(newIndex, 0, false)
|
1941 |
+
}
|
1942 |
+
//Fix For Positive Oversliding
|
1943 |
+
else if (_this.activeIndex > _this.slides.length - params.slidesPerView * 2) {
|
1944 |
+
var newIndex = -_this.slides.length + _this.activeIndex + _this.loopedSlides
|
1945 |
+
_this.swipeTo(newIndex, 0, false)
|
1946 |
+
}
|
1947 |
+
}
|
1948 |
+
/*==================================================
|
1949 |
+
Slides Loader
|
1950 |
+
====================================================*/
|
1951 |
+
_this.loadSlides = function () {
|
1952 |
+
var slidesHTML = '';
|
1953 |
+
_this.activeLoaderIndex = 0;
|
1954 |
+
var slides = params.loader.slides;
|
1955 |
+
var slidesToLoad = params.loader.loadAllSlides ? slides.length : params.slidesPerView * (1 + params.loader.surroundGroups);
|
1956 |
+
for (var i = 0; i < slidesToLoad; i++) {
|
1957 |
+
if (params.loader.slidesHTMLType == 'outer') slidesHTML += slides[i];
|
1958 |
+
else {
|
1959 |
+
slidesHTML += '<' + params.slideElement + ' class="' + params.slideClass + '" data-swiperindex="' + i + '">' + slides[i] + '</' + params.slideElement + '>';
|
1960 |
+
}
|
1961 |
+
}
|
1962 |
+
_this.wrapper.innerHTML = slidesHTML;
|
1963 |
+
_this.calcSlides(true);
|
1964 |
+
//Add permanent transitionEnd callback
|
1965 |
+
if (!params.loader.loadAllSlides) {
|
1966 |
+
_this.wrapperTransitionEnd(_this.reloadSlides, true);
|
1967 |
+
}
|
1968 |
+
}
|
1969 |
+
_this.reloadSlides = function () {
|
1970 |
+
var slides = params.loader.slides;
|
1971 |
+
var newActiveIndex = parseInt(_this.activeSlide().data('swiperindex'), 10)
|
1972 |
+
if (newActiveIndex < 0 || newActiveIndex > slides.length - 1) return //<-- Exit
|
1973 |
+
_this.activeLoaderIndex = newActiveIndex;
|
1974 |
+
var firstIndex = Math.max(0, newActiveIndex - params.slidesPerView * params.loader.surroundGroups)
|
1975 |
+
var lastIndex = Math.min(newActiveIndex + params.slidesPerView * (1 + params.loader.surroundGroups) - 1, slides.length - 1)
|
1976 |
+
//Update Transforms
|
1977 |
+
if (newActiveIndex > 0) {
|
1978 |
+
var newTransform = -slideSize * (newActiveIndex - firstIndex)
|
1979 |
+
if (isH) _this.setWrapperTranslate(newTransform, 0, 0)
|
1980 |
+
else _this.setWrapperTranslate(0, newTransform, 0)
|
1981 |
+
_this.setWrapperTransition(0)
|
1982 |
+
}
|
1983 |
+
//New Slides
|
1984 |
+
if (params.loader.logic === 'reload') {
|
1985 |
+
_this.wrapper.innerHTML = '';
|
1986 |
+
var slidesHTML = '';
|
1987 |
+
for (var i = firstIndex; i <= lastIndex; i++) {
|
1988 |
+
slidesHTML += params.loader.slidesHTMLType == 'outer' ? slides[i] : '<' + params.slideElement + ' class="' + params.slideClass + '" data-swiperindex="' + i + '">' + slides[i] + '</' + params.slideElement + '>';
|
1989 |
+
}
|
1990 |
+
_this.wrapper.innerHTML = slidesHTML;
|
1991 |
+
} else {
|
1992 |
+
var minExistIndex = 1000;
|
1993 |
+
var maxExistIndex = 0;
|
1994 |
+
for (var i = 0; i < _this.slides.length; i++) {
|
1995 |
+
var index = _this.slides[i].data('swiperindex');
|
1996 |
+
if (index < firstIndex || index > lastIndex) {
|
1997 |
+
_this.wrapper.removeChild(_this.slides[i]);
|
1998 |
+
} else {
|
1999 |
+
minExistIndex = Math.min(index, minExistIndex)
|
2000 |
+
maxExistIndex = Math.max(index, maxExistIndex)
|
2001 |
+
}
|
2002 |
+
}
|
2003 |
+
for (var i = firstIndex; i <= lastIndex; i++) {
|
2004 |
+
if (i < minExistIndex) {
|
2005 |
+
var newSlide = document.createElement(params.slideElement);
|
2006 |
+
newSlide.className = params.slideClass;
|
2007 |
+
newSlide.setAttribute('data-swiperindex', i);
|
2008 |
+
newSlide.innerHTML = slides[i];
|
2009 |
+
_this.wrapper.insertBefore(newSlide, _this.wrapper.firstChild);
|
2010 |
+
}
|
2011 |
+
if (i > maxExistIndex) {
|
2012 |
+
var newSlide = document.createElement(params.slideElement);
|
2013 |
+
newSlide.className = params.slideClass;
|
2014 |
+
newSlide.setAttribute('data-swiperindex', i);
|
2015 |
+
newSlide.innerHTML = slides[i];
|
2016 |
+
_this.wrapper.appendChild(newSlide);
|
2017 |
+
}
|
2018 |
+
}
|
2019 |
+
}
|
2020 |
+
//reInit
|
2021 |
+
_this.reInit(true);
|
2022 |
+
}
|
2023 |
+
/*==================================================
|
2024 |
+
Make Swiper
|
2025 |
+
====================================================*/
|
2026 |
+
function makeSwiper() {
|
2027 |
+
_this.calcSlides();
|
2028 |
+
if (params.loader.slides.length > 0 && _this.slides.length == 0) {
|
2029 |
+
_this.loadSlides();
|
2030 |
+
}
|
2031 |
+
if (params.loop) {
|
2032 |
+
_this.createLoop();
|
2033 |
+
}
|
2034 |
+
_this.init();
|
2035 |
+
initEvents();
|
2036 |
+
if (params.pagination && params.createPagination) {
|
2037 |
+
_this.createPagination(true);
|
2038 |
+
}
|
2039 |
+
if (params.loop || params.initialSlide > 0) {
|
2040 |
+
_this.swipeTo(params.initialSlide, 0, false);
|
2041 |
+
} else {
|
2042 |
+
_this.updateActiveSlide(0);
|
2043 |
+
}
|
2044 |
+
if (params.autoplay) {
|
2045 |
+
_this.startAutoplay();
|
2046 |
+
}
|
2047 |
+
|
2048 |
+
}
|
2049 |
+
makeSwiper();
|
2050 |
+
}
|
2051 |
+
|
2052 |
+
Swiper.prototype = {
|
2053 |
+
plugins: {},
|
2054 |
+
/*==================================================
|
2055 |
+
Wrapper Operations
|
2056 |
+
====================================================*/
|
2057 |
+
wrapperTransitionEnd: function (callback, permanent) {
|
2058 |
+
var a = this
|
2059 |
+
var el = a.wrapper
|
2060 |
+
var events = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd', 'MSTransitionEnd', 'msTransitionEnd'];
|
2061 |
+
|
2062 |
+
function fireCallBack() {
|
2063 |
+
callback(a)
|
2064 |
+
if (a.params.queueEndCallbacks) a._queueEndCallbacks = false
|
2065 |
+
if (!permanent) {
|
2066 |
+
for (var i = 0; i < events.length; i++) {
|
2067 |
+
el.removeEventListener(events[i], fireCallBack, false)
|
2068 |
+
}
|
2069 |
+
}
|
2070 |
+
}
|
2071 |
+
if (callback) {
|
2072 |
+
for (var i = 0; i < events.length; i++) {
|
2073 |
+
el.addEventListener(events[i], fireCallBack, false)
|
2074 |
+
}
|
2075 |
+
}
|
2076 |
+
},
|
2077 |
+
|
2078 |
+
getWrapperTranslate: function (axis) {
|
2079 |
+
var el = this.wrapper
|
2080 |
+
var matrix;
|
2081 |
+
var curTransform;
|
2082 |
+
if (window.WebKitCSSMatrix) {
|
2083 |
+
var transformMatrix = new WebKitCSSMatrix(window.getComputedStyle(el, null).webkitTransform)
|
2084 |
+
matrix = transformMatrix.toString().split(',');
|
2085 |
+
} else {
|
2086 |
+
var transformMatrix = window.getComputedStyle(el, null).MozTransform || window.getComputedStyle(el, null).OTransform || window.getComputedStyle(el, null).MsTransform || window.getComputedStyle(el, null).msTransform || window.getComputedStyle(el, null).transform || window.getComputedStyle(el, null).getPropertyValue("transform").replace("translate(", "matrix(1, 0, 0, 1,");
|
2087 |
+
matrix = transformMatrix.toString().split(',');
|
2088 |
+
|
2089 |
+
}
|
2090 |
+
if (this.params.useCSS3Transforms) {
|
2091 |
+
if (axis == 'x') {
|
2092 |
+
//Crazy IE10 Matrix
|
2093 |
+
if (matrix.length == 16) curTransform = parseFloat(matrix[12])
|
2094 |
+
//Latest Chrome and webkits Fix
|
2095 |
+
else if (window.WebKitCSSMatrix) curTransform = transformMatrix.m41
|
2096 |
+
//Normal Browsers
|
2097 |
+
else curTransform = parseFloat(matrix[4])
|
2098 |
+
}
|
2099 |
+
if (axis == 'y') {
|
2100 |
+
//Crazy IE10 Matrix
|
2101 |
+
if (matrix.length == 16) curTransform = parseFloat(matrix[13])
|
2102 |
+
//Latest Chrome and webkits Fix
|
2103 |
+
else if (window.WebKitCSSMatrix) curTransform = transformMatrix.m42
|
2104 |
+
//Normal Browsers
|
2105 |
+
else curTransform = parseFloat(matrix[5])
|
2106 |
+
}
|
2107 |
+
} else {
|
2108 |
+
if (axis == 'x') curTransform = parseFloat(el.style.left, 10) || 0
|
2109 |
+
if (axis == 'y') curTransform = parseFloat(el.style.top, 10) || 0
|
2110 |
+
}
|
2111 |
+
return curTransform || 0;
|
2112 |
+
},
|
2113 |
+
|
2114 |
+
setWrapperTranslate: function (x, y, z) {
|
2115 |
+
var es = this.wrapper.style
|
2116 |
+
x = x || 0;
|
2117 |
+
y = y || 0;
|
2118 |
+
z = z || 0;
|
2119 |
+
if (this.params.useCSS3Transforms) {
|
2120 |
+
if (this.support.transforms3d) {
|
2121 |
+
es.webkitTransform = es.MsTransform = es.msTransform = es.MozTransform = es.OTransform = es.transform = 'translate3d(' + x + 'px, ' + y + 'px, ' + z + 'px)'
|
2122 |
+
} else {
|
2123 |
+
|
2124 |
+
es.webkitTransform = es.MsTransform = es.msTransform = es.MozTransform = es.OTransform = es.transform = 'translate(' + x + 'px, ' + y + 'px)'
|
2125 |
+
if (!this.support.transforms) {
|
2126 |
+
es.left = x + 'px'
|
2127 |
+
es.top = y + 'px'
|
2128 |
+
}
|
2129 |
+
}
|
2130 |
+
} else {
|
2131 |
+
es.left = x + 'px';
|
2132 |
+
es.top = y + 'px';
|
2133 |
+
}
|
2134 |
+
this.callPlugins('onSetWrapperTransform', {
|
2135 |
+
x: x,
|
2136 |
+
y: y,
|
2137 |
+
z: z
|
2138 |
+
})
|
2139 |
+
},
|
2140 |
+
|
2141 |
+
setWrapperTransition: function (duration) {
|
2142 |
+
var es = this.wrapper.style
|
2143 |
+
es.webkitTransitionDuration = es.MsTransitionDuration = es.msTransitionDuration = es.MozTransitionDuration = es.OTransitionDuration = es.transitionDuration = duration / 1000 + 's';
|
2144 |
+
this.callPlugins('onSetWrapperTransition', {
|
2145 |
+
duration: duration
|
2146 |
+
})
|
2147 |
+
},
|
2148 |
+
|
2149 |
+
/*==================================================
|
2150 |
+
Helpers
|
2151 |
+
====================================================*/
|
2152 |
+
h: {
|
2153 |
+
getWidth: function (el, outer) {
|
2154 |
+
var width = window.getComputedStyle(el, null).getPropertyValue('width')
|
2155 |
+
var returnWidth = parseFloat(width);
|
2156 |
+
//IE Fixes
|
2157 |
+
if (isNaN(returnWidth) || width.indexOf('%') > 0) {
|
2158 |
+
returnWidth = el.offsetWidth - parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-left')) - parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-right'));
|
2159 |
+
}
|
2160 |
+
if (outer) returnWidth += parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-left')) + parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-right'))
|
2161 |
+
|
2162 |
+
return returnWidth;
|
2163 |
+
},
|
2164 |
+
getHeight: function (el, outer) {
|
2165 |
+
if (outer) return el.offsetHeight;
|
2166 |
+
|
2167 |
+
var height = window.getComputedStyle(el, null).getPropertyValue('height')
|
2168 |
+
var returnHeight = parseFloat(height);
|
2169 |
+
//IE Fixes
|
2170 |
+
if (isNaN(returnHeight) || height.indexOf('%') > 0) {
|
2171 |
+
returnHeight = el.offsetHeight - parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-top')) - parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-bottom'));
|
2172 |
+
}
|
2173 |
+
if (outer) returnHeight += parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-top')) + parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-bottom'))
|
2174 |
+
return returnHeight;
|
2175 |
+
},
|
2176 |
+
getOffset: function (el) {
|
2177 |
+
var box = el.getBoundingClientRect();
|
2178 |
+
var body = document.body;
|
2179 |
+
var clientTop = el.clientTop || body.clientTop || 0;
|
2180 |
+
var clientLeft = el.clientLeft || body.clientLeft || 0;
|
2181 |
+
var scrollTop = window.pageYOffset || el.scrollTop;
|
2182 |
+
var scrollLeft = window.pageXOffset || el.scrollLeft;
|
2183 |
+
if (document.documentElement && !window.pageYOffset) {
|
2184 |
+
//IE7-8
|
2185 |
+
scrollTop = document.documentElement.scrollTop;
|
2186 |
+
scrollLeft = document.documentElement.scrollLeft;
|
2187 |
+
}
|
2188 |
+
return {
|
2189 |
+
top: box.top + scrollTop - clientTop,
|
2190 |
+
left: box.left + scrollLeft - clientLeft
|
2191 |
+
};
|
2192 |
+
},
|
2193 |
+
windowWidth: function () {
|
2194 |
+
if (window.innerWidth) return window.innerWidth
|
2195 |
+
else if (document.documentElement && document.documentElement.clientWidth) return document.documentElement.clientWidth;
|
2196 |
+
},
|
2197 |
+
windowHeight: function () {
|
2198 |
+
if (window.innerHeight) return window.innerHeight
|
2199 |
+
else if (document.documentElement && document.documentElement.clientHeight) return document.documentElement.clientHeight;
|
2200 |
+
},
|
2201 |
+
windowScroll: function () {
|
2202 |
+
var left = 0,
|
2203 |
+
top = 0;
|
2204 |
+
if (typeof pageYOffset != 'undefined') {
|
2205 |
+
return {
|
2206 |
+
left: window.pageXOffset,
|
2207 |
+
top: window.pageYOffset
|
2208 |
+
}
|
2209 |
+
} else if (document.documentElement) {
|
2210 |
+
return {
|
2211 |
+
left: document.documentElement.scrollLeft,
|
2212 |
+
top: document.documentElement.scrollTop
|
2213 |
+
}
|
2214 |
+
}
|
2215 |
+
},
|
2216 |
+
|
2217 |
+
addEventListener: function (el, event, listener, useCapture) {
|
2218 |
+
if (el.addEventListener) {
|
2219 |
+
el.addEventListener(event, listener, useCapture)
|
2220 |
+
} else if (el.attachEvent) {
|
2221 |
+
el.attachEvent('on' + event, listener)
|
2222 |
+
}
|
2223 |
+
},
|
2224 |
+
removeEventListener: function (el, event, listener, useCapture) {
|
2225 |
+
if (el.removeEventListener) {
|
2226 |
+
el.removeEventListener(event, listener, useCapture)
|
2227 |
+
} else if (el.detachEvent) {
|
2228 |
+
el.detachEvent('on' + event, listener)
|
2229 |
+
}
|
2230 |
+
}
|
2231 |
+
},
|
2232 |
+
setTransform: function (el, transform) {
|
2233 |
+
var es = el.style
|
2234 |
+
es.webkitTransform = es.MsTransform = es.msTransform = es.MozTransform = es.OTransform = es.transform = transform
|
2235 |
+
},
|
2236 |
+
setTranslate: function (el, translate) {
|
2237 |
+
var es = el.style
|
2238 |
+
var pos = {
|
2239 |
+
x: translate.x || 0,
|
2240 |
+
y: translate.y || 0,
|
2241 |
+
z: translate.z || 0
|
2242 |
+
};
|
2243 |
+
var transformString = this.support.transforms3d ? 'translate3d(' + (pos.x) + 'px,' + (pos.y) + 'px,' + (pos.z) + 'px)' : 'translate(' + (pos.x) + 'px,' + (pos.y) + 'px)';
|
2244 |
+
es.webkitTransform = es.MsTransform = es.msTransform = es.MozTransform = es.OTransform = es.transform = transformString;
|
2245 |
+
if (!this.support.transforms) {
|
2246 |
+
es.left = pos.x + 'px'
|
2247 |
+
es.top = pos.y + 'px'
|
2248 |
+
}
|
2249 |
+
},
|
2250 |
+
setTransition: function (el, duration) {
|
2251 |
+
var es = el.style
|
2252 |
+
es.webkitTransitionDuration = es.MsTransitionDuration = es.msTransitionDuration = es.MozTransitionDuration = es.OTransitionDuration = es.transitionDuration = duration + 'ms';
|
2253 |
+
},
|
2254 |
+
/*==================================================
|
2255 |
+
Feature Detection
|
2256 |
+
====================================================*/
|
2257 |
+
support: {
|
2258 |
+
|
2259 |
+
touch: (window.Modernizr && Modernizr.touch === true) || (function () {
|
2260 |
+
return !!(("ontouchstart" in window) || window.DocumentTouch && document instanceof DocumentTouch);
|
2261 |
+
})(),
|
2262 |
+
|
2263 |
+
transforms3d: (window.Modernizr && Modernizr.csstransforms3d === true) || (function () {
|
2264 |
+
var div = document.createElement('div');
|
2265 |
+
return ("webkitPerspective" in div.style || "MozPerspective" in div.style || "OPerspective" in div.style || "MsPerspective" in div.style || "perspective" in div.style);
|
2266 |
+
})(),
|
2267 |
+
|
2268 |
+
transforms: (window.Modernizr && Modernizr.csstransforms === true) || (function () {
|
2269 |
+
var div = document.createElement('div').style
|
2270 |
+
return ('transform' in div) || ('WebkitTransform' in div) || ('MozTransform' in div) || ('msTransform' in div) || ('MsTransform' in div) || ('OTransform' in div);
|
2271 |
+
})(),
|
2272 |
+
|
2273 |
+
transitions: (window.Modernizr && Modernizr.csstransitions === true) || (function () {
|
2274 |
+
var div = document.createElement('div').style
|
2275 |
+
return ('transition' in div) || ('WebkitTransition' in div) || ('MozTransition' in div) || ('msTransition' in div) || ('MsTransition' in div) || ('OTransition' in div);
|
2276 |
+
})()
|
2277 |
+
},
|
2278 |
+
|
2279 |
+
browser: {
|
2280 |
+
|
2281 |
+
ie8: (function () {
|
2282 |
+
var rv = -1; // Return value assumes failure.
|
2283 |
+
if (navigator.appName == 'Microsoft Internet Explorer') {
|
2284 |
+
var ua = navigator.userAgent;
|
2285 |
+
var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
|
2286 |
+
if (re.exec(ua) != null) rv = parseFloat(RegExp.$1);
|
2287 |
+
}
|
2288 |
+
return rv != -1 && rv < 9;
|
2289 |
+
})(),
|
2290 |
+
|
2291 |
+
ie10: window.navigator.msPointerEnabled
|
2292 |
+
}
|
2293 |
+
}
|
2294 |
+
|
2295 |
+
/*=========================
|
2296 |
+
jQuery & Zepto Plugins
|
2297 |
+
===========================*/
|
2298 |
+
if (window.jQuery || window.Zepto) {
|
2299 |
+
(function ($) {
|
2300 |
+
$.fn.swiper = function (params) {
|
2301 |
+
var s = new Swiper($(this)[0], params)
|
2302 |
+
$(this).data('swiper', s);
|
2303 |
+
return s;
|
2304 |
+
}
|
2305 |
+
})(window.jQuery || window.Zepto);
|
2306 |
}
|
assets/js/vote.js
CHANGED
@@ -1,16 +1,16 @@
|
|
1 |
-
jQuery(document).ready(function ($) {
|
2 |
-
$('#wpwrap').before($('.su-vote').slideDown());
|
3 |
-
$('.su-vote-action').on('click', function (e) {
|
4 |
-
var $this = $(this);
|
5 |
-
e.preventDefault();
|
6 |
-
$.ajax({
|
7 |
-
type: 'get',
|
8 |
-
url: $this.attr('href'),
|
9 |
-
beforeSend: function () {
|
10 |
-
$('.su-vote').slideUp();
|
11 |
-
if (typeof $this.data('action') !== 'undefined') window.open($this.data('action'));
|
12 |
-
},
|
13 |
-
success: function (data) {}
|
14 |
-
});
|
15 |
-
});
|
16 |
});
|
1 |
+
jQuery(document).ready(function ($) {
|
2 |
+
$('#wpwrap').before($('.su-vote').slideDown());
|
3 |
+
$('.su-vote-action').on('click', function (e) {
|
4 |
+
var $this = $(this);
|
5 |
+
e.preventDefault();
|
6 |
+
$.ajax({
|
7 |
+
type: 'get',
|
8 |
+
url: $this.attr('href'),
|
9 |
+
beforeSend: function () {
|
10 |
+
$('.su-vote').slideUp();
|
11 |
+
if (typeof $this.data('action') !== 'undefined') window.open($this.data('action'));
|
12 |
+
},
|
13 |
+
success: function (data) {}
|
14 |
+
});
|
15 |
+
});
|
16 |
});
|
inc/core/class.assets.php
CHANGED
@@ -1,183 +1,183 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Class for managing plugin assets
|
5 |
-
*/
|
6 |
-
class Shortcodes_Ultimate_Assets {
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Set of queried assets
|
10 |
-
*
|
11 |
-
* @var array
|
12 |
-
*/
|
13 |
-
static $assets = array( 'css' => array(), 'js' => array() );
|
14 |
-
|
15 |
-
/**
|
16 |
-
* Constructor
|
17 |
-
*/
|
18 |
-
function __construct() {
|
19 |
-
// Register
|
20 |
-
add_action( 'wp_head', array( __CLASS__, 'register' ) );
|
21 |
-
add_action( 'admin_head', array( __CLASS__, 'register' ) );
|
22 |
-
add_action( 'su/generator/preview/before', array( __CLASS__, 'register' ) );
|
23 |
-
// Enqueue
|
24 |
-
add_action( 'wp_footer', array( __CLASS__, 'enqueue' ) );
|
25 |
-
add_action( 'admin_footer', array( __CLASS__, 'enqueue' ) );
|
26 |
-
// Print
|
27 |
-
add_action( 'su/generator/preview/after', array( __CLASS__, 'prnt' ) );
|
28 |
-
// Custom CSS
|
29 |
-
add_action( 'wp_footer', array( __CLASS__, 'custom_css' ), 99 );
|
30 |
-
add_action( 'su/generator/preview/after', array( __CLASS__, 'custom_css' ), 99 );
|
31 |
-
// Options page assets
|
32 |
-
add_action( 'sunrise_page_before', array( __CLASS__, 'options_page' ) );
|
33 |
-
}
|
34 |
-
|
35 |
-
/**
|
36 |
-
* Register assets
|
37 |
-
*/
|
38 |
-
public static function register() {
|
39 |
-
// Get plugin object
|
40 |
-
$shult = shortcodes_ultimate();
|
41 |
-
// qTip
|
42 |
-
wp_register_script( 'qtip', $shult->assets( 'js', 'qtip.js' ), array( 'jquery' ), '1.0.0-rc3', true );
|
43 |
-
// Magnific Popup
|
44 |
-
wp_register_style( 'magnific-popup', $shult->assets( 'css', 'magnific-popup.css' ), false, '0.9.5', 'all' );
|
45 |
-
wp_register_script( 'magnific-popup', $shult->assets( 'js', 'magnific-popup.js' ), array( 'jquery' ), '0.9.5', true );
|
46 |
-
// Ace
|
47 |
-
wp_register_script( 'ace', $shult->assets( 'js', 'ace/ace.js' ), false, '1.1.01', true );
|
48 |
-
// Iframe transport
|
49 |
-
wp_register_script( 'iframe-transport', $shult->assets( 'js', 'iframe-transport.js' ), array( 'jquery' ), '1.7', true );
|
50 |
-
// File upload
|
51 |
-
wp_register_script( 'file-upload', $shult->assets( 'js', 'file-upload.js' ), array( 'iframe-transport', 'jquery-ui-widget' ), '5.31.6', true );
|
52 |
-
// Swiper
|
53 |
-
wp_register_script( 'swiper', $shult->assets( 'js', 'swiper.js' ), array( 'jquery' ), $shult->version, true );
|
54 |
-
// jPlayer
|
55 |
-
wp_register_script( 'jplayer', $shult->assets( 'js', 'jplayer.js' ), array( 'jquery' ), $shult->version, true );
|
56 |
-
// Options page
|
57 |
-
wp_register_style( 'su-options-page', $shult->assets( 'css', 'options-page.css' ), false, $shult->version, 'all' );
|
58 |
-
wp_register_script( 'su-options-page', $shult->assets( 'js', 'options-page.js' ), array( 'magnific-popup', 'file-upload', 'jquery-ui-sortable', 'ace' ), $shult->version, true );
|
59 |
-
// Generator
|
60 |
-
wp_register_style( 'su-generator', $shult->assets( 'css', 'generator.css' ), array( 'farbtastic', 'magnific-popup' ), $shult->version, 'all' );
|
61 |
-
wp_register_script( 'su-generator', $shult->assets( 'js', 'generator.js' ), array( 'file-upload', 'farbtastic', 'magnific-popup', 'qtip' ), $shult->version, true );
|
62 |
-
// Shortcodes stylesheets
|
63 |
-
wp_register_style( 'su-content-shortcodes', self::skin_url( 'content-shortcodes.css' ), false, $shult->version, 'all' );
|
64 |
-
wp_register_style( 'su-box-shortcodes', self::skin_url( 'box-shortcodes.css' ), false, $shult->version, 'all' );
|
65 |
-
wp_register_style( 'su-media-shortcodes', self::skin_url( 'media-shortcodes.css' ), false, $shult->version, 'all' );
|
66 |
-
wp_register_style( 'su-other-shortcodes', self::skin_url( 'other-shortcodes.css' ), false, $shult->version, 'all' );
|
67 |
-
wp_register_style( 'su-galleries-shortcodes', self::skin_url( 'galleries-shortcodes.css' ), false, $shult->version, 'all' );
|
68 |
-
wp_register_style( 'su-players-shortcodes', self::skin_url( 'players-shortcodes.css' ), false, $shult->version, 'all' );
|
69 |
-
// Shortcodes scripts
|
70 |
-
wp_register_script( 'su-galleries-shortcodes', $shult->assets( 'js', 'galleries-shortcodes.js' ), array( 'jquery', 'swiper' ), $shult->version, true );
|
71 |
-
wp_register_script( 'su-players-shortcodes', $shult->assets( 'js', 'players-shortcodes.js' ), array( 'jquery', 'jplayer' ), $shult->version, true );
|
72 |
-
wp_register_script( 'su-other-shortcodes', $shult->assets( 'js', 'other-shortcodes.js' ), array( 'jquery' ), $shult->version, true );
|
73 |
-
wp_localize_script( 'su-other-shortcodes', 'su_other_shortcodes', array( 'no_preview' => __( 'This shortcode doesn\'t work in live preview. Please insert it into editor and preview on the site.', 'su' ) ) );
|
74 |
-
// Hook to deregister assets or add custom
|
75 |
-
do_action( 'su/assets/register' );
|
76 |
-
}
|
77 |
-
|
78 |
-
/**
|
79 |
-
* Enqueue assets
|
80 |
-
*/
|
81 |
-
public static function enqueue() {
|
82 |
-
// Get assets query and plugin object
|
83 |
-
$assets = self::assets();
|
84 |
-
// Enqueue stylesheets
|
85 |
-
foreach ( $assets['css'] as $style ) wp_enqueue_style( $style );
|
86 |
-
// Enqueue scripts
|
87 |
-
foreach ( $assets['js'] as $script ) wp_enqueue_script( $script );
|
88 |
-
// Hook to dequeue assets or add custom
|
89 |
-
do_action( 'su/assets/enqueue' );
|
90 |
-
}
|
91 |
-
|
92 |
-
/**
|
93 |
-
* Print assets without enqueuing
|
94 |
-
*/
|
95 |
-
public static function prnt() {
|
96 |
-
// Prepare assets set
|
97 |
-
$assets = self::assets();
|
98 |
-
// Enqueue stylesheets
|
99 |
-
wp_print_styles( $assets['css'] );
|
100 |
-
// Enqueue scripts
|
101 |
-
wp_print_scripts( $assets['js'] );
|
102 |
-
// Hook
|
103 |
-
do_action( 'su/assets/print' );
|
104 |
-
}
|
105 |
-
|
106 |
-
/**
|
107 |
-
* Print custom CSS
|
108 |
-
*/
|
109 |
-
public static function custom_css() {
|
110 |
-
$shult = shortcodes_ultimate();
|
111 |
-
// Get custom CSS and apply filters to it
|
112 |
-
$custom_css = apply_filters( 'su/assets/custom_css', str_replace( ''', '\'', html_entity_decode( $shult->get_option( 'custom_css' ) ) ) );
|
113 |
-
// Print CSS if exists
|
114 |
-
if ( $custom_css ) echo "\n\n<!-- Shortcodes Ultimate custom CSS - begin -->\n<style type='text/css'>\n" . stripslashes( str_replace( array( '%theme_url%', '%home_url%', '%plugin_url%' ), array( get_stylesheet_directory_uri(), get_option( 'home' ), $shult->url ), $custom_css ) ) . "\n</style>\n<!-- Shortcodes Ultimate custom CSS - end -->\n\n";
|
115 |
-
}
|
116 |
-
|
117 |
-
/**
|
118 |
-
* Add asset to the query
|
119 |
-
*/
|
120 |
-
public static function add( $type, $handle ) {
|
121 |
-
// Array with handles
|
122 |
-
if ( is_array( $handle ) ) { foreach ( $handle as $h ) self::$assets[$type][$h] = $h; }
|
123 |
-
// Single handle
|
124 |
-
else self::$assets[$type][$handle] = $handle;
|
125 |
-
}
|
126 |
-
/**
|
127 |
-
* Get queried assets
|
128 |
-
*/
|
129 |
-
public static function assets() {
|
130 |
-
// Get assets query
|
131 |
-
$assets = self::$assets;
|
132 |
-
// Apply filters to assets set
|
133 |
-
$assets['css'] = array_unique( ( array ) apply_filters( 'su/assets/css', ( array ) array_unique( $assets['css'] ) ) );
|
134 |
-
$assets['js'] = array_unique( ( array ) apply_filters( 'su/assets/js', ( array ) array_unique( $assets['js'] ) ) );
|
135 |
-
// Return set
|
136 |
-
return $assets;
|
137 |
-
}
|
138 |
-
|
139 |
-
/**
|
140 |
-
* Add options page assets
|
141 |
-
*/
|
142 |
-
public static function options_page() {
|
143 |
-
$shult = shortcodes_ultimate();
|
144 |
-
// Check this is Shortcodes Ultimate settings page
|
145 |
-
if ( $_GET['page'] !== $shult->slug ) return;
|
146 |
-
// Request assets
|
147 |
-
self::add( 'css', array( 'magnific-popup', 'ace', 'su-options-page' ) );
|
148 |
-
self::add( 'js', array( 'jquery', 'magnific-popup', 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-mouse', 'jquery-ui-sortable', 'iframe-transport', 'file-upload', 'css', 'su-options-page' ) );
|
149 |
-
}
|
150 |
-
|
151 |
-
/**
|
152 |
-
* Helper to get full URL of a skin file
|
153 |
-
*/
|
154 |
-
public static function skin_url( $file = '' ) {
|
155 |
-
$shult = shortcodes_ultimate();
|
156 |
-
$skin = $shult->get_option( 'skin' );
|
157 |
-
$uploads = wp_upload_dir(); $uploads = $uploads['baseurl'];
|
158 |
-
// Prepare url to skin directory
|
159 |
-
$url = ( $skin === 'default' ) ? $shult->assets( 'css', '' ) : $uploads . '/shortcodes-ultimate-skins/' . $skin;
|
160 |
-
return trailingslashit( apply_filters( 'su/assets/skin', $url ) ) . $file;
|
161 |
-
}
|
162 |
-
}
|
163 |
-
|
164 |
-
$shult_assets = new Shortcodes_Ultimate_Assets;
|
165 |
-
|
166 |
-
/**
|
167 |
-
* Helper function to add asset to the query
|
168 |
-
*
|
169 |
-
* @param string $type Asset type (css|js)
|
170 |
-
* @param mixed $handle Asset handle or array with handles
|
171 |
-
*/
|
172 |
-
function su_query_asset( $type, $handle ) {
|
173 |
-
Shortcodes_Ultimate_Assets::add( $type, $handle );
|
174 |
-
}
|
175 |
-
|
176 |
-
/**
|
177 |
-
* Helper function to get current skin url
|
178 |
-
*
|
179 |
-
* @param string $file Asset file name. Example value: box-shortcodes.css
|
180 |
-
*/
|
181 |
-
function su_skin_url( $file ) {
|
182 |
-
return Shortcodes_Ultimate_Assets::skin_url( $file );
|
183 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class for managing plugin assets
|
5 |
+
*/
|
6 |
+
class Shortcodes_Ultimate_Assets {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Set of queried assets
|
10 |
+
*
|
11 |
+
* @var array
|
12 |
+
*/
|
13 |
+
static $assets = array( 'css' => array(), 'js' => array() );
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Constructor
|
17 |
+
*/
|
18 |
+
function __construct() {
|
19 |
+
// Register
|
20 |
+
add_action( 'wp_head', array( __CLASS__, 'register' ) );
|
21 |
+
add_action( 'admin_head', array( __CLASS__, 'register' ) );
|
22 |
+
add_action( 'su/generator/preview/before', array( __CLASS__, 'register' ) );
|
23 |
+
// Enqueue
|
24 |
+
add_action( 'wp_footer', array( __CLASS__, 'enqueue' ) );
|
25 |
+
add_action( 'admin_footer', array( __CLASS__, 'enqueue' ) );
|
26 |
+
// Print
|
27 |
+
add_action( 'su/generator/preview/after', array( __CLASS__, 'prnt' ) );
|
28 |
+
// Custom CSS
|
29 |
+
add_action( 'wp_footer', array( __CLASS__, 'custom_css' ), 99 );
|
30 |
+
add_action( 'su/generator/preview/after', array( __CLASS__, 'custom_css' ), 99 );
|
31 |
+
// Options page assets
|
32 |
+
add_action( 'sunrise_page_before', array( __CLASS__, 'options_page' ) );
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Register assets
|
37 |
+
*/
|
38 |
+
public static function register() {
|
39 |
+
// Get plugin object
|
40 |
+
$shult = shortcodes_ultimate();
|
41 |
+
// qTip
|
42 |
+
wp_register_script( 'qtip', $shult->assets( 'js', 'qtip.js' ), array( 'jquery' ), '1.0.0-rc3', true );
|
43 |
+
// Magnific Popup
|
44 |
+
wp_register_style( 'magnific-popup', $shult->assets( 'css', 'magnific-popup.css' ), false, '0.9.5', 'all' );
|
45 |
+
wp_register_script( 'magnific-popup', $shult->assets( 'js', 'magnific-popup.js' ), array( 'jquery' ), '0.9.5', true );
|
46 |
+
// Ace
|
47 |
+
wp_register_script( 'ace', $shult->assets( 'js', 'ace/ace.js' ), false, '1.1.01', true );
|
48 |
+
// Iframe transport
|
49 |
+
wp_register_script( 'iframe-transport', $shult->assets( 'js', 'iframe-transport.js' ), array( 'jquery' ), '1.7', true );
|
50 |
+
// File upload
|
51 |
+
wp_register_script( 'file-upload', $shult->assets( 'js', 'file-upload.js' ), array( 'iframe-transport', 'jquery-ui-widget' ), '5.31.6', true );
|
52 |
+
// Swiper
|
53 |
+
wp_register_script( 'swiper', $shult->assets( 'js', 'swiper.js' ), array( 'jquery' ), $shult->version, true );
|
54 |
+
// jPlayer
|
55 |
+
wp_register_script( 'jplayer', $shult->assets( 'js', 'jplayer.js' ), array( 'jquery' ), $shult->version, true );
|
56 |
+
// Options page
|
57 |
+
wp_register_style( 'su-options-page', $shult->assets( 'css', 'options-page.css' ), false, $shult->version, 'all' );
|
58 |
+
wp_register_script( 'su-options-page', $shult->assets( 'js', 'options-page.js' ), array( 'magnific-popup', 'file-upload', 'jquery-ui-sortable', 'ace' ), $shult->version, true );
|
59 |
+
// Generator
|
60 |
+
wp_register_style( 'su-generator', $shult->assets( 'css', 'generator.css' ), array( 'farbtastic', 'magnific-popup' ), $shult->version, 'all' );
|
61 |
+
wp_register_script( 'su-generator', $shult->assets( 'js', 'generator.js' ), array( 'file-upload', 'farbtastic', 'magnific-popup', 'qtip' ), $shult->version, true );
|
62 |
+
// Shortcodes stylesheets
|
63 |
+
wp_register_style( 'su-content-shortcodes', self::skin_url( 'content-shortcodes.css' ), false, $shult->version, 'all' );
|
64 |
+
wp_register_style( 'su-box-shortcodes', self::skin_url( 'box-shortcodes.css' ), false, $shult->version, 'all' );
|
65 |
+
wp_register_style( 'su-media-shortcodes', self::skin_url( 'media-shortcodes.css' ), false, $shult->version, 'all' );
|
66 |
+
wp_register_style( 'su-other-shortcodes', self::skin_url( 'other-shortcodes.css' ), false, $shult->version, 'all' );
|
67 |
+
wp_register_style( 'su-galleries-shortcodes', self::skin_url( 'galleries-shortcodes.css' ), false, $shult->version, 'all' );
|
68 |
+
wp_register_style( 'su-players-shortcodes', self::skin_url( 'players-shortcodes.css' ), false, $shult->version, 'all' );
|
69 |
+
// Shortcodes scripts
|
70 |
+
wp_register_script( 'su-galleries-shortcodes', $shult->assets( 'js', 'galleries-shortcodes.js' ), array( 'jquery', 'swiper' ), $shult->version, true );
|
71 |
+
wp_register_script( 'su-players-shortcodes', $shult->assets( 'js', 'players-shortcodes.js' ), array( 'jquery', 'jplayer' ), $shult->version, true );
|
72 |
+
wp_register_script( 'su-other-shortcodes', $shult->assets( 'js', 'other-shortcodes.js' ), array( 'jquery' ), $shult->version, true );
|
73 |
+
wp_localize_script( 'su-other-shortcodes', 'su_other_shortcodes', array( 'no_preview' => __( 'This shortcode doesn\'t work in live preview. Please insert it into editor and preview on the site.', 'su' ) ) );
|
74 |
+
// Hook to deregister assets or add custom
|
75 |
+
do_action( 'su/assets/register' );
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Enqueue assets
|
80 |
+
*/
|
81 |
+
public static function enqueue() {
|
82 |
+
// Get assets query and plugin object
|
83 |
+
$assets = self::assets();
|
84 |
+
// Enqueue stylesheets
|
85 |
+
foreach ( $assets['css'] as $style ) wp_enqueue_style( $style );
|
86 |
+
// Enqueue scripts
|
87 |
+
foreach ( $assets['js'] as $script ) wp_enqueue_script( $script );
|
88 |
+
// Hook to dequeue assets or add custom
|
89 |
+
do_action( 'su/assets/enqueue' );
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Print assets without enqueuing
|
94 |
+
*/
|
95 |
+
public static function prnt() {
|
96 |
+
// Prepare assets set
|
97 |
+
$assets = self::assets();
|
98 |
+
// Enqueue stylesheets
|
99 |
+
wp_print_styles( $assets['css'] );
|
100 |
+
// Enqueue scripts
|
101 |
+
wp_print_scripts( $assets['js'] );
|
102 |
+
// Hook
|
103 |
+
do_action( 'su/assets/print' );
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Print custom CSS
|
108 |
+
*/
|
109 |
+
public static function custom_css() {
|
110 |
+
$shult = shortcodes_ultimate();
|
111 |
+
// Get custom CSS and apply filters to it
|
112 |
+
$custom_css = apply_filters( 'su/assets/custom_css', str_replace( ''', '\'', html_entity_decode( $shult->get_option( 'custom_css' ) ) ) );
|
113 |
+
// Print CSS if exists
|
114 |
+
if ( $custom_css ) echo "\n\n<!-- Shortcodes Ultimate custom CSS - begin -->\n<style type='text/css'>\n" . stripslashes( str_replace( array( '%theme_url%', '%home_url%', '%plugin_url%' ), array( get_stylesheet_directory_uri(), get_option( 'home' ), $shult->url ), $custom_css ) ) . "\n</style>\n<!-- Shortcodes Ultimate custom CSS - end -->\n\n";
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* Add asset to the query
|
119 |
+
*/
|
120 |
+
public static function add( $type, $handle ) {
|
121 |
+
// Array with handles
|
122 |
+
if ( is_array( $handle ) ) { foreach ( $handle as $h ) self::$assets[$type][$h] = $h; }
|
123 |
+
// Single handle
|
124 |
+
else self::$assets[$type][$handle] = $handle;
|
125 |
+
}
|
126 |
+
/**
|
127 |
+
* Get queried assets
|
128 |
+
*/
|
129 |
+
public static function assets() {
|
130 |
+
// Get assets query
|
131 |
+
$assets = self::$assets;
|
132 |
+
// Apply filters to assets set
|
133 |
+
$assets['css'] = array_unique( ( array ) apply_filters( 'su/assets/css', ( array ) array_unique( $assets['css'] ) ) );
|
134 |
+
$assets['js'] = array_unique( ( array ) apply_filters( 'su/assets/js', ( array ) array_unique( $assets['js'] ) ) );
|
135 |
+
// Return set
|
136 |
+
return $assets;
|
137 |
+
}
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Add options page assets
|
141 |
+
*/
|
142 |
+
public static function options_page() {
|
143 |
+
$shult = shortcodes_ultimate();
|
144 |
+
// Check this is Shortcodes Ultimate settings page
|
145 |
+
if ( $_GET['page'] !== $shult->slug ) return;
|
146 |
+
// Request assets
|
147 |
+
self::add( 'css', array( 'magnific-popup', 'ace', 'su-options-page' ) );
|
148 |
+
self::add( 'js', array( 'jquery', 'magnific-popup', 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-mouse', 'jquery-ui-sortable', 'iframe-transport', 'file-upload', 'css', 'su-options-page' ) );
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* Helper to get full URL of a skin file
|
153 |
+
*/
|
154 |
+
public static function skin_url( $file = '' ) {
|
155 |
+
$shult = shortcodes_ultimate();
|
156 |
+
$skin = $shult->get_option( 'skin' );
|
157 |
+
$uploads = wp_upload_dir(); $uploads = $uploads['baseurl'];
|
158 |
+
// Prepare url to skin directory
|
159 |
+
$url = ( $skin === 'default' ) ? $shult->assets( 'css', '' ) : $uploads . '/shortcodes-ultimate-skins/' . $skin;
|
160 |
+
return trailingslashit( apply_filters( 'su/assets/skin', $url ) ) . $file;
|
161 |
+
}
|
162 |
+
}
|
163 |
+
|
164 |
+
$shult_assets = new Shortcodes_Ultimate_Assets;
|
165 |
+
|
166 |
+
/**
|
167 |
+
* Helper function to add asset to the query
|
168 |
+
*
|
169 |
+
* @param string $type Asset type (css|js)
|
170 |
+
* @param mixed $handle Asset handle or array with handles
|
171 |
+
*/
|
172 |
+
function su_query_asset( $type, $handle ) {
|
173 |
+
Shortcodes_Ultimate_Assets::add( $type, $handle );
|
174 |
+
}
|
175 |
+
|
176 |
+
/**
|
177 |
+
* Helper function to get current skin url
|
178 |
+
*
|
179 |
+
* @param string $file Asset file name. Example value: box-shortcodes.css
|
180 |
+
*/
|
181 |
+
function su_skin_url( $file ) {
|
182 |
+
return Shortcodes_Ultimate_Assets::skin_url( $file );
|
183 |
+
}
|
inc/core/class.data.php
CHANGED
@@ -1,1623 +1,1623 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Class for managing plugin data
|
4 |
-
*/
|
5 |
-
class Shortcodes_Ultimate_Data {
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Constructor
|
9 |
-
*/
|
10 |
-
function __construct() {
|
11 |
-
add_action( 'init', array( __CLASS__, 'register' ) );
|
12 |
-
}
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Register shortcodes
|
16 |
-
*/
|
17 |
-
public static function register() {
|
18 |
-
// Loop through shortcodes
|
19 |
-
foreach ( ( array ) self::shortcodes() as $shortcode => $data ) {
|
20 |
-
// Prepare shortcode function name
|
21 |
-
$function = ( isset( $data['function'] ) ) ? $data['function'] : 'su_' . $shortcode . '_shortcode';
|
22 |
-
// Register shortcode
|
23 |
-
add_shortcode( su_compatibility_mode_prefix() . $shortcode, $function );
|
24 |
-
}
|
25 |
-
}
|
26 |
-
|
27 |
-
/**
|
28 |
-
* Shortcode groups
|
29 |
-
*/
|
30 |
-
public static function groups() {
|
31 |
-
return ( array ) apply_filters( 'su/data/groups', array(
|
32 |
-
'all' => __( 'All', 'su' ),
|
33 |
-
'content' => __( 'Content', 'su' ),
|
34 |
-
'box' => __( 'Box', 'su' ),
|
35 |
-
'media' => __( 'Media', 'su' ),
|
36 |
-
'gallery' => __( 'Gallery', 'su' ),
|
37 |
-
'other' => __( 'Other', 'su' )
|
38 |
-
) );
|
39 |
-
}
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Shortcodes
|
43 |
-
*/
|
44 |
-
public static function shortcodes( $shortcode = false ) {
|
45 |
-
$shortcodes = apply_filters( 'su/data/shortcodes', array(
|
46 |
-
// heading
|
47 |
-
'heading' => array(
|
48 |
-
'name' => __( 'Heading', 'su' ),
|
49 |
-
'type' => 'wrap',
|
50 |
-
'group' => 'content',
|
51 |
-
'atts' => array(
|
52 |
-
'size' => array(
|
53 |
-
'type' => 'number',
|
54 |
-
'min' => 1,
|
55 |
-
'max' => 18,
|
56 |
-
'step' => 1,
|
57 |
-
'default' => 3,
|
58 |
-
'name' => __( 'Size', 'su' ), 'desc' => __( 'Select heading size', 'su' )
|
59 |
-
),
|
60 |
-
'align' => array(
|
61 |
-
'type' => 'select',
|
62 |
-
'values' => array(
|
63 |
-
'left' => __( 'Left', 'su' ),
|
64 |
-
'center' => __( 'Center', 'su' ),
|
65 |
-
'right' => __( 'Right', 'su' )
|
66 |
-
),
|
67 |
-
'default' => 'center',
|
68 |
-
'name' => __( 'Align', 'su' ), 'desc' => __( 'Heading text alignment', 'su' )
|
69 |
-
),
|
70 |
-
'class' => array(
|
71 |
-
'default' => '',
|
72 |
-
'name' => __( 'Class', 'su' ),
|
73 |
-
'desc' => __( 'Extra CSS class', 'su' )
|
74 |
-
)
|
75 |
-
),
|
76 |
-
'usage' => '[heading] Content [/heading]<br/>[heading size="5"] Content [/heading]', 'content' => __( 'Heading text', 'su' ),
|
77 |
-
'desc' => __( 'Styled heading', 'su' )
|
78 |
-
),
|
79 |
-
// tabs
|
80 |
-
'tabs' => array(
|
81 |
-
'name' => __( 'Tabs', 'su' ),
|
82 |
-
'type' => 'wrap',
|
83 |
-
'group' => 'box',
|
84 |
-
'atts' => array(
|
85 |
-
'vertical' => array(
|
86 |
-
'type' => 'switch',
|
87 |
-
'default' => 'no',
|
88 |
-
'name' => __( 'Vertical', 'su' ),
|
89 |
-
'desc' => __( 'Show tabs vertically', 'su' )
|
90 |
-
),
|
91 |
-
'class' => array(
|
92 |
-
'default' => '',
|
93 |
-
'name' => __( 'Class', 'su' ),
|
94 |
-
'desc' => __( 'Extra CSS class', 'su' )
|
95 |
-
)
|
96 |
-
),
|
97 |
-
'usage' => '[tabs style="default"] [tab title="Tab name"] Tab content [/tab] [/tabs]',
|
98 |
-
'content' => __( "[tab title=\"Title 1\"]Content 1[/tab]\n[tab title=\"Title 2\"]Content 2[/tab]\n[tab title=\"Title 3\"]Content 3[/tab]", 'su' ),
|
99 |
-
'desc' => __( 'Tabs container', 'su' )
|
100 |
-
),
|
101 |
-
// tab
|
102 |
-
'tab' => array(
|
103 |
-
'name' => __( 'Tab', 'su' ),
|
104 |
-
'type' => 'wrap',
|
105 |
-
'group' => 'box',
|
106 |
-
'atts' => array(
|
107 |
-
'title' => array(
|
108 |
-
'values' => array( ),
|
109 |
-
'default' => __( 'Tab name', 'su' ),
|
110 |
-
'name' => __( 'Title', 'su' ),
|
111 |
-
'desc' => __( 'Enter tab name', 'su' )
|
112 |
-
),
|
113 |
-
'class' => array(
|
114 |
-
'default' => '',
|
115 |
-
'name' => __( 'Class', 'su' ),
|
116 |
-
'desc' => __( 'Extra CSS class', 'su' )
|
117 |
-
)
|
118 |
-
),
|
119 |
-
'usage' => '[tabs] [tab title="Tab name"] Tab content [/tab] [/tabs]', 'content' => __( 'Tab content', 'su' ),
|
120 |
-
'desc' => __( 'Single tab', 'su' )
|
121 |
-
),
|
122 |
-
// spoiler
|
123 |
-
'spoiler' => array(
|
124 |
-
'name' => __( 'Spoiler', 'su' ),
|
125 |
-
'type' => 'wrap',
|
126 |
-
'group' => 'box',
|
127 |
-
'atts' => array(
|
128 |
-
'title' => array(
|
129 |
-
'values' => array( ),
|
130 |
-
'default' => __( 'Spoiler title', 'su' ),
|
131 |
-
'name' => __( 'Title', 'su' ), 'desc' => __( 'Text in spoiler title', 'su' )
|
132 |
-
),
|
133 |
-
'open' => array(
|
134 |
-
'type' => 'switch',
|
135 |
-
'default' => 'no',
|
136 |
-
'name' => __( 'Open', 'su' ),
|
137 |
-
'desc' => __( 'Is spoiler content visible by default', 'su' )
|
138 |
-
),
|
139 |
-
'class' => array(
|
140 |
-
'default' => '',
|
141 |
-
'name' => __( 'Class', 'su' ),
|
142 |
-
'desc' => __( 'Extra CSS class', 'su' )
|
143 |
-
)
|
144 |
-
),
|
145 |
-
'usage' => '[spoiler title="Spoiler title"] Hidden text [/spoiler]', 'content' => __( 'Hidden content', 'su' ), 'desc' => __( 'Spoiler with hidden content', 'su' )
|
146 |
-
),
|
147 |
-
// accordion
|
148 |
-
'accordion' => array(
|
149 |
-
'name' => __( 'Accordion', 'su' ),
|
150 |
-
'type' => 'wrap',
|
151 |
-
'group' => 'box',
|
152 |
-
'atts' => array(
|
153 |
-
'class' => array(
|
154 |
-
'default' => '',
|
155 |
-
'name' => __( 'Class', 'su' ),
|
156 |
-
'desc' => __( 'Extra CSS class', 'su' )
|
157 |
-
)
|
158 |
-
),
|
159 |
-
'usage' => '[accordion]<br/>[spoiler open="yes"] content [/spoiler]<br/>[spoiler] content [/spoiler]<br/>[spoiler] content [/spoiler]<br/>[/accordion]',
|
160 |
-
'content' => __( "[spoiler]Content[/spoiler]\n[spoiler]Content[/spoiler]\n[spoiler]Content[/spoiler]", 'su' ), 'desc' => __( 'Accordion with spoilers', 'su' )
|
161 |
-
),
|
162 |
-
// divider
|
163 |
-
'divider' => array(
|
164 |
-
'name' => __( 'Divider', 'su' ),
|
165 |
-
'type' => 'single',
|
166 |
-
'group' => 'content',
|
167 |
-
'atts' => array(
|
168 |
-
'top' => array(
|
169 |
-
'type' => 'switch',
|
170 |
-
'default' => 'yes',
|
171 |
-
'name' => __( 'Show TOP link', 'su' ),
|
172 |
-
'desc' => __( 'Show link to top of the page or not', 'su' )
|
173 |
-
),
|
174 |
-
'text' => array(
|
175 |
-
'values' => array( ),
|
176 |
-
'default' => __( 'Go to top', 'su' ),
|
177 |
-
'name' => __( 'Link text', 'su' ), 'desc' => __( 'Text for the GO TOP link', 'su' )
|
178 |
-
),
|
179 |
-
'class' => array(
|
180 |
-
'default' => '',
|
181 |
-
'name' => __( 'Class', 'su' ),
|
182 |
-
'desc' => __( 'Extra CSS class', 'su' )
|
183 |
-
)
|
184 |
-
),
|
185 |
-
'usage' => '[divider top="yes" text="Go to top"]',
|
186 |
-
'desc' => __( 'Content divider with optional TOP link', 'su' )
|
187 |
-
),
|
188 |
-
// spacer
|
189 |
-
'spacer' => array(
|
190 |
-
'name' => __( 'Spacer', 'su' ),
|
191 |
-
'type' => 'single',
|
192 |
-
'group' => 'content other',
|
193 |
-
'atts' => array(
|
194 |
-
'size' => array(
|
195 |
-
'type' => 'number',
|
196 |
-
'min' => 0,
|
197 |
-
'max' => 10000,
|
198 |
-
'step' => 5,
|
199 |
-
'default' => 20,
|
200 |
-
'name' => __( 'Height', 'su' ), 'desc' => __( 'Height of the spacer in pixels', 'su' )
|
201 |
-
),
|
202 |
-
'class' => array(
|
203 |
-
'default' => '',
|
204 |
-
'name' => __( 'Class', 'su' ),
|
205 |
-
'desc' => __( 'Extra CSS class', 'su' )
|
206 |
-
)
|
207 |
-
),
|
208 |
-
'usage' => '[spacer size="20"]',
|
209 |
-
'desc' => __( 'Empty space with adjustable height', 'su' )
|
210 |
-
),
|
211 |
-
// highlight
|
212 |
-
'highlight' => array(
|
213 |
-
'name' => __( 'Highlight', 'su' ),
|
214 |
-
'type' => 'wrap',
|
215 |
-
'group' => 'content',
|
216 |
-
'atts' => array(
|
217 |
-
'background' => array(
|
218 |
-
'type' => 'color',
|
219 |
-
'values' => array( ),
|
220 |
-
'default' => '#DDFF99',
|
221 |
-
'name' => __( 'Background', 'su' ),
|
222 |
-
'desc' => __( 'Highlighted text background color', 'su' )
|
223 |
-
),
|
224 |
-
'color' => array(
|
225 |
-
'type' => 'color',
|
226 |
-
'values' => array( ),
|
227 |
-
'default' => '#000000',
|
228 |
-
'name' => __( 'Text color', 'su' ), 'desc' => __( 'Highlighted text color', 'su' )
|
229 |
-
),
|
230 |
-
'class' => array(
|
231 |
-
'default' => '',
|
232 |
-
'name' => __( 'Class', 'su' ),
|
233 |
-
'desc' => __( 'Extra CSS class', 'su' )
|
234 |
-
)
|
235 |
-
),
|
236 |
-
'usage' => '[highlight background="#DDFF99" color="#000000"] Content [/highlight]', 'content' => __( 'Highlighted text', 'su' ),
|
237 |
-
'desc' => __( 'Highlighted text', 'su' )
|
238 |
-
),
|
239 |
-
// label
|
240 |
-
'label' => array(
|
241 |
-
'name' => __( 'Label', 'su' ),
|
242 |
-
'type' => 'wrap',
|
243 |
-
'group' => 'content',
|
244 |
-
'atts' => array(
|
245 |
-
'type' => array(
|
246 |
-
'type' => 'select',
|
247 |
-
'values' => array(
|
248 |
-
'default' => __( 'Default', 'su' ),
|
249 |
-
'success' => __( 'Success', 'su' ),
|
250 |
-
'warning' => __( 'Warning', 'su' ),
|
251 |
-
'important' => __( 'Important', 'su' ),
|
252 |
-
'black' => __( 'Black', 'su' ),
|
253 |
-
'info' => __( 'Info', 'su' )
|
254 |
-
),
|
255 |
-
'default' => 'default',
|
256 |
-
'name' => __( 'Type', 'su' ),
|
257 |
-
'desc' => __( 'Style of the label', 'su' )
|
258 |
-
),
|
259 |
-
'class' => array(
|
260 |
-
'default' => '',
|
261 |
-
'name' => __( 'Class', 'su' ),
|
262 |
-
'desc' => __( 'Extra CSS class', 'su' )
|
263 |
-
)
|
264 |
-
),
|
265 |
-
'usage' => '[label type="info"] Information [/label]', 'content' => __( 'Label', 'su' ),
|
266 |
-
'desc' => __( 'Styled label', 'su' )
|
267 |
-
),
|
268 |
-
// quote
|
269 |
-
'quote' => array(
|
270 |
-
'name' => __( 'Quote', 'su' ),
|
271 |
-
'type' => 'wrap',
|
272 |
-
'group' => 'box',
|
273 |
-
'atts' => array(
|
274 |
-
'cite' => array(
|
275 |
-
'values' => array( ),
|
276 |
-
'default' => '',
|
277 |
-
'name' => __( 'Cite', 'su' ),
|
278 |
-
'desc' => __( 'Quote author name', 'su' )
|
279 |
-
),
|
280 |
-
'url' => array(
|
281 |
-
'values' => array( ),
|
282 |
-
'default' => '',
|
283 |
-
'name' => __( 'Cite url', 'su' ),
|
284 |
-
'desc' => __( 'Url of the quote author. Leave empty to disable link', 'su' )
|
285 |
-
),
|
286 |
-
'class' => array(
|
287 |
-
'default' => '',
|
288 |
-
'name' => __( 'Class', 'su' ),
|
289 |
-
'desc' => __( 'Extra CSS class', 'su' )
|
290 |
-
)
|
291 |
-
),
|
292 |
-
'usage' => '[quote style="default"] Content [/quote]', 'content' => __( 'Quote', 'su' ),
|
293 |
-
'desc' => __( 'Blockquote alternative', 'su' )
|
294 |
-
),
|
295 |
-
// pullquote
|
296 |
-
'pullquote' => array(
|
297 |
-
'name' => __( 'Pullquote', 'su' ),
|
298 |
-
'type' => 'wrap',
|
299 |
-
'group' => 'box',
|
300 |
-
'atts' => array(
|
301 |
-
'align' => array(
|
302 |
-
'type' => 'select',
|
303 |
-
'values' => array(
|
304 |
-
'left' => __( 'Left', 'su' ),
|
305 |
-
'right' => __( 'Right', 'su' )
|
306 |
-
),
|
307 |
-
'default' => 'left',
|
308 |
-
'name' => __( 'Align', 'su' ), 'desc' => __( 'Pullquote alignment (float)', 'su' )
|
309 |
-
),
|
310 |
-
'class' => array(
|
311 |
-
'default' => '',
|
312 |
-
'name' => __( 'Class', 'su' ),
|
313 |
-
'desc' => __( 'Extra CSS class', 'su' )
|
314 |
-
)
|
315 |
-
),
|
316 |
-
'usage' => '[pullquote align="left"] Content [/pullquote]', 'content' => __( 'Pullquote', 'su' ),
|
317 |
-
'desc' => __( 'Pullquote', 'su' )
|
318 |
-
),
|
319 |
-
// dropcap
|
320 |
-
'dropcap' => array(
|
321 |
-
'name' => __( 'Dropcap', 'su' ),
|
322 |
-
'type' => 'wrap',
|
323 |
-
'group' => 'content',
|
324 |
-
'atts' => array(
|
325 |
-
'style' => array(
|
326 |
-
'type' => 'select',
|
327 |
-
'values' => array(
|
328 |
-
'default' => __( 'Default', 'su' ),
|
329 |
-
'flat' => __( 'Flat', 'su' ),
|
330 |
-
'light' => __( 'Light', 'su' ),
|
331 |
-
'simple' => __( 'Simple', 'su' )
|
332 |
-
),
|
333 |
-
'default' => 'default',
|
334 |
-
'name' => __( 'Style', 'su' ), 'desc' => __( 'Dropcap style preset', 'su' )
|
335 |
-
),
|
336 |
-
'size' => array(
|
337 |
-
'type' => 'select',
|
338 |
-
'values' => array( 1, 2, 3, 4, 5 ), 'default' => 3,
|
339 |
-
'name' => __( 'Size', 'su' ), 'desc' => __( 'Choose dropcap size', 'su' )
|
340 |
-
),
|
341 |
-
'class' => array(
|
342 |
-
'default' => '',
|
343 |
-
'name' => __( 'Class', 'su' ),
|
344 |
-
'desc' => __( 'Extra CSS class', 'su' )
|
345 |
-
)
|
346 |
-
),
|
347 |
-
'usage' => '[dropcap style="default"]D[/dropcap]ropcap', 'content' => __( 'D', 'su' ),
|
348 |
-
'desc' => __( 'Dropcap', 'su' )
|
349 |
-
),
|
350 |
-
// row
|
351 |
-
'row' => array(
|
352 |
-
'name' => __( 'Row', 'su' ),
|
353 |
-
'type' => 'wrap',
|
354 |
-
'group' => 'box',
|
355 |
-
'atts' => array(
|
356 |
-
'class' => array(
|
357 |
-
'default' => '',
|
358 |
-
'name' => __( 'Class', 'su' ),
|
359 |
-
'desc' => __( 'Extra CSS class', 'su' )
|
360 |
-
)
|
361 |
-
),
|
362 |
-
'usage' => '[row]<br/>[column size="1/2"] 50% [/column]<br/>[column size="1/4"] 25% [/column]<br/>[column size="1/4"] 25% [/column]<br/>[/row]',
|
363 |
-
'content' => __( "[column size=\"1/3\"]Content[/column]\n[column size=\"1/3\"]Content[/column]\n[column size=\"1/3\"]Content[/column]", 'su' ), 'desc' => __( 'Row for flexible columns', 'su' )
|
364 |
-
),
|
365 |
-
// column
|
366 |
-
'column' => array(
|
367 |
-
'name' => __( 'Column', 'su' ),
|
368 |
-
'type' => 'wrap',
|
369 |
-
'group' => 'box',
|
370 |
-
'atts' => array(
|
371 |
-
'size' => array(
|
372 |
-
'type' => 'select',
|
373 |
-
'values' => array(
|
374 |
-
'1/1' => __( 'Full width', 'su' ),
|
375 |
-
'1/2' => __( 'One half', 'su' ),
|
376 |
-
'1/3' => __( 'One third', 'su' ),
|
377 |
-
'2/3' => __( 'Two third', 'su' ),
|
378 |
-
'1/4' => __( 'One fourth', 'su' ),
|
379 |
-
'3/4' => __( 'Three fourth', 'su' ),
|
380 |
-
'1/5' => __( 'One fifth', 'su' ),
|
381 |
-
'2/5' => __( 'Two fifth', 'su' ),
|
382 |
-
'3/5' => __( 'Three fifth', 'su' ),
|
383 |
-
'4/5' => __( 'Four fifth', 'su' ),
|
384 |
-
'1/6' => __( 'One sixth', 'su' ),
|
385 |
-
'5/6' => __( 'Five sixth', 'su' )
|
386 |
-
),
|
387 |
-
'default' => '1/2',
|
388 |
-
'name' => __( 'Size', 'su' ),
|
389 |
-
'desc' => __( 'Select column width. This width will be calculated depend page width', 'su' )
|
390 |
-
),
|
391 |
-
'class' => array(
|
392 |
-
'default' => '',
|
393 |
-
'name' => __( 'Class', 'su' ),
|
394 |
-
'desc' => __( 'Extra CSS class', 'su' )
|
395 |
-
)
|
396 |
-
),
|
397 |
-
'usage' => '[row]<br/>[column size="6"] 50% [/column]<br/>[column size="3"] 25% [/column]<br/>[column size="3"] 25% [/column]<br/>[/row]', 'content' => __( 'Column content', 'su' ), 'desc' => __( 'Flexible and responsive columns', 'su' )
|
398 |
-
),
|
399 |
-
// list
|
400 |
-
'list' => array(
|
401 |
-
'name' => __( 'List', 'su' ),
|
402 |
-
'type' => 'wrap',
|
403 |
-
'group' => 'content',
|
404 |
-
'atts' => array(
|
405 |
-
'style' => array(
|
406 |
-
'type' => 'select',
|
407 |
-
'values' => array(
|
408 |
-
'star' => __( 'Star', 'su' ),
|
409 |
-
'arrow' => __( 'Arrow', 'su' ),
|
410 |
-
'check' => __( 'Check', 'su' ),
|
411 |
-
'cross' => __( 'Cross', 'su' ),
|
412 |
-
'thumbs' => __( 'Thumbs up', 'su' ),
|
413 |
-
'link' => __( 'Link', 'su' ),
|
414 |
-
'gear' => __( 'Gear', 'su' ),
|
415 |
-
'time' => __( 'Time', 'su' ),
|
416 |
-
'note' => __( 'Note', 'su' ),
|
417 |
-
'plus' => __( 'Plus', 'su' ),
|
418 |
-
'guard' => __( 'Guard', 'su' ),
|
419 |
-
'event' => __( 'Event', 'su' ),
|
420 |
-
'idea' => __( 'Idea', 'su' ),
|
421 |
-
'settings' => __( 'Settings', 'su' ),
|
422 |
-
'twitter' => __( 'Twitter', 'su' )
|
423 |
-
),
|
424 |
-
'default' => 'star',
|
425 |
-
'name' => __( 'Style', 'su' ), 'desc' => __( 'List items style/icons', 'su' )
|
426 |
-
),
|
427 |
-
'class' => array(
|
428 |
-
'default' => '',
|
429 |
-
'name' => __( 'Class', 'su' ),
|
430 |
-
'desc' => __( 'Extra CSS class', 'su' )
|
431 |
-
)
|
432 |
-
),
|
433 |
-
'usage' => '[list style="check"] <ul> <li> List item </li> </ul> [/list]',
|
434 |
-
'content' => __( "<ul>\n<li>List item</li>\n<li>List item</li>\n<li>List item</li>\n</ul>", 'su' ), 'desc' => __( 'Styled unordered list', 'su' )
|
435 |
-
),
|
436 |
-
// button
|
437 |
-
'button' => array(
|
438 |
-
'name' => __( 'Button', 'su' ),
|
439 |
-
'type' => 'wrap',
|
440 |
-
'group' => 'content',
|
441 |
-
'atts' => array(
|
442 |
-
'url' => array(
|
443 |
-
'values' => array( ),
|
444 |
-
'default' => get_option( 'home' ),
|
445 |
-
'name' => __( 'Link', 'su' ),
|
446 |
-
'desc' => __( 'Button link', 'su' )
|
447 |
-
),
|
448 |
-
'target' => array(
|
449 |
-
'type' => 'select',
|
450 |
-
'values' => array(
|
451 |
-
'self' => __( 'Same tab', 'su' ),
|
452 |
-
'blank' => __( 'New tab', 'su' )
|
453 |
-
),
|
454 |
-
'default' => 'self',
|
455 |
-
'name' => __( 'Target', 'su' ),
|
456 |
-
'desc' => __( 'Button link target', 'su' )
|
457 |
-
),
|
458 |
-
'style' => array(
|
459 |
-
'type' => 'select',
|
460 |
-
'values' => array(
|
461 |
-
'default' => __( 'Default', 'su' ),
|
462 |
-
'flat' => __( 'Flat', 'su' ),
|
463 |
-
'soft' => __( 'Soft', 'su' ),
|
464 |
-
'glass' => __( 'Glass', 'su' ),
|
465 |
-
'bubbles' => __( 'Bubbles', 'su' ),
|
466 |
-
'noise' => __( 'Noise', 'su' ),
|
467 |
-
'stroked' => __( 'Stroked', 'su' ),
|
468 |
-
'3d' => __( '3D', 'su' )
|
469 |
-
),
|
470 |
-
'default' => 'default',
|
471 |
-
'name' => __( 'Style', 'su' ), 'desc' => __( 'Button background style preset', 'su' )
|
472 |
-
),
|
473 |
-
'background' => array(
|
474 |
-
'type' => 'color',
|
475 |
-
'values' => array( ),
|
476 |
-
'default' => '#2D89EF',
|
477 |
-
'name' => __( 'Background', 'su' ), 'desc' => __( 'Button background color', 'su' )
|
478 |
-
),
|
479 |
-
'color' => array(
|
480 |
-
'type' => 'color',
|
481 |
-
'values' => array( ),
|
482 |
-
'default' => '#FFFFFF',
|
483 |
-
'name' => __( 'Text color', 'su' ),
|
484 |
-
'desc' => __( 'Button text color', 'su' )
|
485 |
-
),
|
486 |
-
'size' => array(
|
487 |
-
'type' => 'select',
|
488 |
-
'values' => array( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ), 'default' => 3,
|
489 |
-
'name' => __( 'Size', 'su' ),
|
490 |
-
'desc' => __( 'Button size', 'su' )
|
491 |
-
),
|
492 |
-
'wide' => array(
|
493 |
-
'type' => 'switch',
|
494 |
-
'default' => 'no',
|
495 |
-
'name' => __( 'Fluid', 'su' ), 'desc' => __( 'Fluid buttons has 100% width', 'su' )
|
496 |
-
),
|
497 |
-
'radius' => array(
|
498 |
-
'type' => 'select',
|
499 |
-
'values' => array( 'auto', 'round', '0', '5', '10', '20' ),
|
500 |
-
'default' => 'auto',
|
501 |
-
'name' => __( 'Radius', 'su' ),
|
502 |
-
'desc' => __( 'Radius of button corners. Auto-radius calculation based on button size', 'su' )
|
503 |
-
),
|
504 |
-
'icon' => array(
|
505 |
-
'type' => 'upload',
|
506 |
-
'default' => '',
|
507 |
-
'name' => __( 'Icon', 'su' ),
|
508 |
-
'desc' => __( 'You can upload custom icon for this button. Try to begin with <a href="http://webdesign.tutsplus.com/freebies/icons-freebies/exclusive-freebie-50-crisp-web-app-icons/" target="_blank">these free high-quality icons</a>. Download archive, unpack icons and upload in this field', 'su' )
|
509 |
-
),
|
510 |
-
'ts_color' => array(
|
511 |
-
'type' => 'select',
|
512 |
-
'values' => array(
|
513 |
-
'light' => __( 'Light', 'su' ),
|
514 |
-
'dark' => __( 'Dark', 'su' )
|
515 |
-
),
|
516 |
-
'default' => 'dark',
|
517 |
-
'name' => __( 'Text shadow color', 'su' ), 'desc' => __( 'Color of button text shadow', 'su' )
|
518 |
-
),
|
519 |
-
'ts_pos' => array(
|
520 |
-
'type' => 'select',
|
521 |
-
'values' => array(
|
522 |
-
'none' => __( 'None', 'su' ),
|
523 |
-
'top' => __( 'Top', 'su' ),
|
524 |
-
'right' => __( 'Right', 'su' ),
|
525 |
-
'bottom' => __( 'Bottom', 'su' ),
|
526 |
-
'left' => __( 'Left', 'su' ),
|
527 |
-
'top-right' => __( 'Top right', 'su' ),
|
528 |
-
'top-left' => __( 'Top left', 'su' ), 'bottom-right' => __( 'Bottom right', 'su' ), 'bottom-left' => __( 'Bottom left', 'su' )
|
529 |
-
),
|
530 |
-
'default' => 'none', 'name' => __( 'Text shadow position', 'su' ), 'desc' => __( 'Position of button text shadow', 'su' )
|
531 |
-
),
|
532 |
-
'desc' => array(
|
533 |
-
'default' => '',
|
534 |
-
'name' => __( 'Description', 'su' ),
|
535 |
-
'desc' => __( 'Small description under button text. This option is incompatible with icon.', 'su' )
|
536 |
-
),
|
537 |
-
'class' => array(
|
538 |
-
'default' => '',
|
539 |
-
'name' => __( 'Class', 'su' ),
|
540 |
-
'desc' => __( 'Extra CSS class', 'su' )
|
541 |
-
)
|
542 |
-
),
|
543 |
-
'usage' => '[button url="#" background="#b00" size="3" style="default"] Button text [/button]', 'content' => __( 'Button text', 'su' ),
|
544 |
-
'desc' => __( 'Styled button', 'su' )
|
545 |
-
),
|
546 |
-
// service
|
547 |
-
'service' => array(
|
548 |
-
'name' => __( 'Service', 'su' ),
|
549 |
-
'type' => 'wrap',
|
550 |
-
'group' => 'box',
|
551 |
-
'atts' => array(
|
552 |
-
'title' => array(
|
553 |
-
'values' => array( ),
|
554 |
-
'default' => __( 'Service title', 'su' ),
|
555 |
-
'name' => __( 'Title', 'su' ),
|
556 |
-
'desc' => __( 'Service name', 'su' )
|
557 |
-
),
|
558 |
-
'icon' => array(
|
559 |
-
'type' => 'upload',
|
560 |
-
'default' => '',
|
561 |
-
'name' => __( 'Icon', 'su' ),
|
562 |
-
'desc' => __( 'You can upload custom icon for this box', 'su' )
|
563 |
-
),
|
564 |
-
'size' => array(
|
565 |
-
'type' => 'select',
|
566 |
-
'values' => array( 16, 24, 32, 48 ),
|
567 |
-
'default' => 32,
|
568 |
-
'name' => __( 'Icon size', 'su' ),
|
569 |
-
'desc' => __( 'Size of the uploaded icon in pixels', 'su' )
|
570 |
-
),
|
571 |
-
'class' => array(
|
572 |
-
'default' => '',
|
573 |
-
'name' => __( 'Class', 'su' ),
|
574 |
-
'desc' => __( 'Extra CSS class', 'su' )
|
575 |
-
)
|
576 |
-
),
|
577 |
-
'usage' => '[service title="Service title" icon="service.png" size="32"] Service description [/service]', 'content' => __( 'Service description', 'su' ), 'desc' => __( 'Service box with title', 'su' )
|
578 |
-
),
|
579 |
-
// box
|
580 |
-
'box' => array(
|
581 |
-
'name' => __( 'Box', 'su' ),
|
582 |
-
'type' => 'wrap',
|
583 |
-
'group' => 'box',
|
584 |
-
'atts' => array(
|
585 |
-
'title' => array(
|
586 |
-
'values' => array( ),
|
587 |
-
'default' => __( 'Box title', 'su' ),
|
588 |
-
'name' => __( 'Title', 'su' ), 'desc' => __( 'Text for the box title', 'su' )
|
589 |
-
),
|
590 |
-
'style' => array(
|
591 |
-
'type' => 'select',
|
592 |
-
'values' => array(
|
593 |
-
'default' => __( 'Default', 'su' ),
|
594 |
-
'soft' => __( 'Soft', 'su' ),
|
595 |
-
'glass' => __( 'Glass', 'su' ),
|
596 |
-
'bubbles' => __( 'Bubbles', 'su' ),
|
597 |
-
'noise' => __( 'Noise', 'su' )
|
598 |
-
),
|
599 |
-
'default' => 'default',
|
600 |
-
'name' => __( 'Style', 'su' ),
|
601 |
-
'desc' => __( 'Box style preset', 'su' )
|
602 |
-
),
|
603 |
-
'box_color' => array(
|
604 |
-
'type' => 'color',
|
605 |
-
'values' => array( ),
|
606 |
-
'default' => '#333333',
|
607 |
-
'name' => __( 'Color', 'su' ),
|
608 |
-
'desc' => __( 'Color for the box title and borders', 'su' )
|
609 |
-
),
|
610 |
-
'title_color' => array(
|
611 |
-
'type' => 'color',
|
612 |
-
'values' => array( ),
|
613 |
-
'default' => '#FFFFFF',
|
614 |
-
'name' => __( 'Title text color', 'su' ), 'desc' => __( 'Color for the box title text', 'su' )
|
615 |
-
),
|
616 |
-
'radius' => array(
|
617 |
-
'type' => 'select',
|
618 |
-
'values' => array( '0', '3', '5', '10', '20' ),
|
619 |
-
'default' => '3',
|
620 |
-
'name' => __( 'Radius', 'su' ),
|
621 |
-
'desc' => __( 'Box corners radius', 'su' )
|
622 |
-
),
|
623 |
-
'class' => array(
|
624 |
-
'default' => '',
|
625 |
-
'name' => __( 'Class', 'su' ),
|
626 |
-
'desc' => __( 'Extra CSS class', 'su' )
|
627 |
-
)
|
628 |
-
),
|
629 |
-
'usage' => '[box title="Box title"] Content [/box]',
|
630 |
-
'content' => __( 'Box content', 'su' ),
|
631 |
-
'desc' => __( 'Colored box with caption', 'su' )
|
632 |
-
),
|
633 |
-
// note
|
634 |
-
'note' => array(
|
635 |
-
'name' => __( 'Note', 'su' ),
|
636 |
-
'type' => 'wrap',
|
637 |
-
'group' => 'box',
|
638 |
-
'atts' => array(
|
639 |
-
'
|
640 |
-
'type' => 'color',
|
641 |
-
'values' => array( ),
|
642 |
-
'default' => '#FFFF66',
|
643 |
-
'name' => __( 'Background', 'su' ), 'desc' => __( 'Note background color', 'su' )
|
644 |
-
),
|
645 |
-
'
|
646 |
-
'type' => 'color',
|
647 |
-
'values' => array( ),
|
648 |
-
'default' => '#333333',
|
649 |
-
'name' => __( 'Text color', 'su' ),
|
650 |
-
'desc' => __( 'Note text color', 'su' )
|
651 |
-
),
|
652 |
-
'radius' => array(
|
653 |
-
'type' => 'select',
|
654 |
-
'values' => array( '0', '3', '5', '10', '20' ),
|
655 |
-
'default' => '3',
|
656 |
-
'name' => __( 'Radius', 'su' ), 'desc' => __( 'Note corners radius', 'su' )
|
657 |
-
),
|
658 |
-
'class' => array(
|
659 |
-
'default' => '',
|
660 |
-
'name' => __( 'Class', 'su' ),
|
661 |
-
'desc' => __( 'Extra CSS class', 'su' )
|
662 |
-
)
|
663 |
-
),
|
664 |
-
'usage' => '[note background="#FFCC00"] Content [/note]', 'content' => __( 'Note text', 'su' ),
|
665 |
-
'desc' => __( 'Colored box', 'su' )
|
666 |
-
),
|
667 |
-
// lightbox
|
668 |
-
'lightbox' => array(
|
669 |
-
'name' => __( 'Lightbox', 'su' ),
|
670 |
-
'type' => 'wrap',
|
671 |
-
'group' => 'gallery',
|
672 |
-
'atts' => array(
|
673 |
-
'type' => array(
|
674 |
-
'type' => 'select',
|
675 |
-
'values' => array(
|
676 |
-
'iframe' => __( 'Iframe', 'su' ),
|
677 |
-
'image' => __( 'Image', 'su' ),
|
678 |
-
'inline' => __( 'Inline (html content)', 'su' )
|
679 |
-
),
|
680 |
-
'default' => 'iframe',
|
681 |
-
'name' => __( 'Content type', 'su' ),
|
682 |
-
'desc' => __( 'Select type of the lightbox window content', 'su' )
|
683 |
-
),
|
684 |
-
'src' => array(
|
685 |
-
'default' => 'http://www.youtube.com/watch?v=NbE8INOjTKM',
|
686 |
-
'name' => __( 'Content source', 'su' ),
|
687 |
-
'desc' => __( 'Insert here URL or CSS selector. Use URL for Iframe and Image content types. Use CSS selector for Inline content type.<br />Example values:<br /><b%value>http://www.youtube.com/watch?v=NbE8INOjTKM</b> - YouTube video (iframe)<br /><b%value>http://example.com/wp-content/uploads/image.jpg</b> - uploaded image (image)<br /><b%value>http://example.com/</b> - any web page (iframe)<br /><b%value>#contact-form</b> - any HTML content (inline)', 'su' )
|
688 |
-
),
|
689 |
-
'class' => array(
|
690 |
-
'default' => '',
|
691 |
-
'name' => __( 'Class', 'su' ),
|
692 |
-
'desc' => __( 'Extra CSS class', 'su' )
|
693 |
-
)
|
694 |
-
),
|
695 |
-
'usage' => '[lightbox src="http://example.com/" type="iframe"] Open example.com [/lightbox]',
|
696 |
-
'content' => __( '[button] Click Here to Watch the Video [/button]', 'su' ),
|
697 |
-
'desc' => __( 'Lightbox window with custom content', 'su' )
|
698 |
-
),
|
699 |
-
// private
|
700 |
-
'private' => array(
|
701 |
-
'name' => __( 'Private', 'su' ),
|
702 |
-
'type' => 'wrap',
|
703 |
-
'group' => 'other',
|
704 |
-
'atts' => array(
|
705 |
-
'class' => array(
|
706 |
-
'default' => '',
|
707 |
-
'name' => __( 'Class', 'su' ),
|
708 |
-
'desc' => __( 'Extra CSS class', 'su' )
|
709 |
-
)
|
710 |
-
),
|
711 |
-
'usage' => '[private] Private content [/private]', 'content' => __( 'Private note text', 'su' ), 'desc' => __( 'Private note for post authors', 'su' )
|
712 |
-
),
|
713 |
-
// youtube
|
714 |
-
'youtube' => array(
|
715 |
-
'name' => __( 'YouTube', 'su' ),
|
716 |
-
'type' => 'single',
|
717 |
-
'group' => 'media',
|
718 |
-
'atts' => array(
|
719 |
-
'url' => array(
|
720 |
-
'values' => array( ),
|
721 |
-
'default' => '',
|
722 |
-
'name' => __( 'Url', 'su' ),
|
723 |
-
'desc' => __( 'Url of YouTube page with video. Ex: http://youtube.com/watch?v=XXXXXX', 'su' )
|
724 |
-
),
|
725 |
-
'width' => array(
|
726 |
-
'type' => 'number',
|
727 |
-
'min' => 0,
|
728 |
-
'max' => 10000,
|
729 |
-
'step' => 20,
|
730 |
-
'default' => 600,
|
731 |
-
'name' => __( 'Width', 'su' ),
|
732 |
-
'desc' => __( 'Player width', 'su' )
|
733 |
-
),
|
734 |
-
'height' => array(
|
735 |
-
'type' => 'number',
|
736 |
-
'min' => 0,
|
737 |
-
'max' => 10000,
|
738 |
-
'step' => 20,
|
739 |
-
'default' => 400,
|
740 |
-
'name' => __( 'Height', 'su' ),
|
741 |
-
'desc' => __( 'Player height', 'su' )
|
742 |
-
),
|
743 |
-
'responsive' => array(
|
744 |
-
'type' => 'switch',
|
745 |
-
'default' => 'yes',
|
746 |
-
'name' => __( 'Responsive', 'su' ),
|
747 |
-
'desc' => __( 'Ignore width and height parameters and make player responsive', 'su' )
|
748 |
-
),
|
749 |
-
'autoplay' => array(
|
750 |
-
'type' => 'switch',
|
751 |
-
'default' => 'no',
|
752 |
-
'name' => __( 'Autoplay', 'su' ),
|
753 |
-
'desc' => __( 'Play video automatically when page is loaded', 'su' )
|
754 |
-
),
|
755 |
-
'class' => array(
|
756 |
-
'default' => '',
|
757 |
-
'name' => __( 'Class', 'su' ),
|
758 |
-
'desc' => __( 'Extra CSS class', 'su' )
|
759 |
-
)
|
760 |
-
),
|
761 |
-
'usage' => '[youtube url="http://www.youtube.com/watch?v=NbE8INOjTKM"]', 'desc' => __( 'YouTube video', 'su' )
|
762 |
-
),
|
763 |
-
// vimeo
|
764 |
-
'vimeo' => array(
|
765 |
-
'name' => __( 'Vimeo', 'su' ),
|
766 |
-
'type' => 'single',
|
767 |
-
'group' => 'media',
|
768 |
-
'atts' => array(
|
769 |
-
'url' => array(
|
770 |
-
'values' => array( ),
|
771 |
-
'default' => '',
|
772 |
-
'name' => __( 'Url', 'su' ), 'desc' => __( 'Url of Vimeo page with video', 'su' )
|
773 |
-
),
|
774 |
-
'width' => array(
|
775 |
-
'type' => 'number',
|
776 |
-
'min' => 0,
|
777 |
-
'max' => 10000,
|
778 |
-
'step' => 20,
|
779 |
-
'default' => 600,
|
780 |
-
'name' => __( 'Width', 'su' ),
|
781 |
-
'desc' => __( 'Player width', 'su' )
|
782 |
-
),
|
783 |
-
'height' => array(
|
784 |
-
'type' => 'number',
|
785 |
-
'min' => 0,
|
786 |
-
'max' => 10000,
|
787 |
-
'step' => 20,
|
788 |
-
'default' => 400,
|
789 |
-
'name' => __( 'Height', 'su' ),
|
790 |
-
'desc' => __( 'Player height', 'su' )
|
791 |
-
),
|
792 |
-
'responsive' => array(
|
793 |
-
'type' => 'switch',
|
794 |
-
'default' => 'yes',
|
795 |
-
'name' => __( 'Responsive', 'su' ),
|
796 |
-
'desc' => __( 'Ignore width and height parameters and make player responsive', 'su' )
|
797 |
-
),
|
798 |
-
'autoplay' => array(
|
799 |
-
'type' => 'switch',
|
800 |
-
'default' => 'no',
|
801 |
-
'name' => __( 'Autoplay', 'su' ),
|
802 |
-
'desc' => __( 'Play video automatically when page is loaded', 'su' )
|
803 |
-
),
|
804 |
-
'class' => array(
|
805 |
-
'default' => '',
|
806 |
-
'name' => __( 'Class', 'su' ),
|
807 |
-
'desc' => __( 'Extra CSS class', 'su' )
|
808 |
-
)
|
809 |
-
),
|
810 |
-
'usage' => '[vimeo url="http://vimeo.com/21294655"]', 'desc' => __( 'Vimeo video', 'su' )
|
811 |
-
),
|
812 |
-
// screenr
|
813 |
-
'screenr' => array(
|
814 |
-
'name' => __( 'Screenr', 'su' ),
|
815 |
-
'type' => 'single',
|
816 |
-
'group' => 'media',
|
817 |
-
'atts' => array(
|
818 |
-
'url' => array(
|
819 |
-
'default' => '',
|
820 |
-
'name' => __( 'Url', 'su' ), 'desc' => __( 'Url of Screenr page with video', 'su' )
|
821 |
-
),
|
822 |
-
'width' => array(
|
823 |
-
'type' => 'number',
|
824 |
-
'min' => 0,
|
825 |
-
'max' => 10000,
|
826 |
-
'step' => 20,
|
827 |
-
'default' => 600,
|
828 |
-
'name' => __( 'Width', 'su' ),
|
829 |
-
'desc' => __( 'Player width', 'su' )
|
830 |
-
),
|
831 |
-
'height' => array(
|
832 |
-
'type' => 'number',
|
833 |
-
'min' => 0,
|
834 |
-
'max' => 10000,
|
835 |
-
'step' => 20,
|
836 |
-
'default' => 400,
|
837 |
-
'name' => __( 'Height', 'su' ),
|
838 |
-
'desc' => __( 'Player height', 'su' )
|
839 |
-
),
|
840 |
-
'responsive' => array(
|
841 |
-
'type' => 'switch',
|
842 |
-
'default' => 'yes',
|
843 |
-
'name' => __( 'Responsive', 'su' ),
|
844 |
-
'desc' => __( 'Ignore width and height parameters and make player responsive', 'su' )
|
845 |
-
),
|
846 |
-
'class' => array(
|
847 |
-
'default' => '',
|
848 |
-
'name' => __( 'Class', 'su' ),
|
849 |
-
'desc' => __( 'Extra CSS class', 'su' )
|
850 |
-
)
|
851 |
-
),
|
852 |
-
'usage' => '[screenr url="http://www.screenr.com/OuWH"]', 'desc' => __( 'Screenr video', 'su' )
|
853 |
-
),
|
854 |
-
// audio
|
855 |
-
'audio' => array(
|
856 |
-
'name' => __( 'Audio', 'su' ),
|
857 |
-
'type' => 'single',
|
858 |
-
'group' => 'media',
|
859 |
-
'atts' => array(
|
860 |
-
'url' => array(
|
861 |
-
'type' => 'upload',
|
862 |
-
'default' => '',
|
863 |
-
'name' => __( 'File', 'su' ),
|
864 |
-
'desc' => __( 'Audio file url. Supported formats: mp3, ogg', 'su' )
|
865 |
-
),
|
866 |
-
'width' => array(
|
867 |
-
'values' => array(),
|
868 |
-
'default' => '100%',
|
869 |
-
'name' => __( 'Width', 'su' ),
|
870 |
-
'desc' => __( 'Player width. You can specify width in percents and player will be responsive. Example values: <b%value>200px</b>, <b%value>100%</b>', 'su' )
|
871 |
-
),
|
872 |
-
'autoplay' => array(
|
873 |
-
'type' => 'switch',
|
874 |
-
'default' => 'no',
|
875 |
-
'name' => __( 'Autoplay', 'su' ),
|
876 |
-
'desc' => __( 'Play file automatically when page is loaded', 'su' )
|
877 |
-
),
|
878 |
-
'loop' => array(
|
879 |
-
'type' => 'switch',
|
880 |
-
'default' => 'no',
|
881 |
-
'name' => __( 'Loop', 'su' ),
|
882 |
-
'desc' => __( 'Repeat when playback is ended', 'su' )
|
883 |
-
),
|
884 |
-
'class' => array(
|
885 |
-
'default' => '',
|
886 |
-
'name' => __( 'Class', 'su' ),
|
887 |
-
'desc' => __( 'Extra CSS class', 'su' )
|
888 |
-
)
|
889 |
-
),
|
890 |
-
'usage' => '[audio url="http://example.com/audio.mp3"]',
|
891 |
-
'desc' => __( 'Custom audio player', 'su' )
|
892 |
-
),
|
893 |
-
// video
|
894 |
-
'video' => array(
|
895 |
-
'name' => __( 'Video', 'su' ),
|
896 |
-
'type' => 'single',
|
897 |
-
'group' => 'media',
|
898 |
-
'atts' => array(
|
899 |
-
'url' => array(
|
900 |
-
'type' => 'upload',
|
901 |
-
'default' => '',
|
902 |
-
'name' => __( 'File', 'su' ),
|
903 |
-
'desc' => __( 'Url to mp4/flv video-file', 'su' )
|
904 |
-
),
|
905 |
-
'poster' => array(
|
906 |
-
'type' => 'upload',
|
907 |
-
'default' => '',
|
908 |
-
'name' => __( 'Poster', 'su' ),
|
909 |
-
'desc' => __( 'Url to poster image, that will be shown before playback', 'su' )
|
910 |
-
),
|
911 |
-
'title' => array(
|
912 |
-
'values' => array( ),
|
913 |
-
'default' => '',
|
914 |
-
'name' => __( 'Title', 'su' ),
|
915 |
-
'desc' => __( 'Player title', 'su' )
|
916 |
-
),
|
917 |
-
'width' => array(
|
918 |
-
'type' => 'number',
|
919 |
-
'min' => 0,
|
920 |
-
'max' => 10000,
|
921 |
-
'step' => 20,
|
922 |
-
'default' => 600,
|
923 |
-
'name' => __( 'Width', 'su' ),
|
924 |
-
'desc' => __( 'Player width', 'su' )
|
925 |
-
),
|
926 |
-
'height' => array(
|
927 |
-
'type' => 'number',
|
928 |
-
'min' => 0,
|
929 |
-
'max' => 10000,
|
930 |
-
'step' => 20,
|
931 |
-
'default' => 300,
|
932 |
-
'name' => __( 'Height', 'su' ),
|
933 |
-
'desc' => __( 'Player height', 'su' )
|
934 |
-
),
|
935 |
-
'controls' => array(
|
936 |
-
'type' => 'switch',
|
937 |
-
'default' => 'yes',
|
938 |
-
'name' => __( 'Controls', 'su' ),
|
939 |
-
'desc' => __( 'Show player controls (play/pause etc.) or not', 'su' )
|
940 |
-
),
|
941 |
-
'autoplay' => array(
|
942 |
-
'type' => 'switch',
|
943 |
-
'default' => 'no',
|
944 |
-
'name' => __( 'Autoplay', 'su' ),
|
945 |
-
'desc' => __( 'Play file automatically when page is loaded', 'su' )
|
946 |
-
),
|
947 |
-
'loop' => array(
|
948 |
-
'type' => 'switch',
|
949 |
-
'default' => 'no',
|
950 |
-
'name' => __( 'Loop', 'su' ),
|
951 |
-
'desc' => __( 'Repeat when playback is ended', 'su' )
|
952 |
-
),
|
953 |
-
'class' => array(
|
954 |
-
'default' => '',
|
955 |
-
'name' => __( 'Class', 'su' ),
|
956 |
-
'desc' => __( 'Extra CSS class', 'su' )
|
957 |
-
)
|
958 |
-
),
|
959 |
-
'usage' => '[video url="http://example.com/video.mp4"]',
|
960 |
-
'desc' => __( 'Custom video player', 'su' )
|
961 |
-
),
|
962 |
-
// table
|
963 |
-
'table' => array(
|
964 |
-
'name' => __( 'Table', 'su' ),
|
965 |
-
'type' => 'mixed',
|
966 |
-
'group' => 'content',
|
967 |
-
'atts' => array(
|
968 |
-
'url' => array(
|
969 |
-
'type' => 'upload',
|
970 |
-
'default' => '',
|
971 |
-
'name' => __( 'CSV file', 'su' ),
|
972 |
-
'desc' => __( 'Upload CSV file if you want to create HTML-table from file', 'su' )
|
973 |
-
),
|
974 |
-
'class' => array(
|
975 |
-
'default' => '',
|
976 |
-
'name' => __( 'Class', 'su' ),
|
977 |
-
'desc' => __( 'Extra CSS class', 'su' )
|
978 |
-
)
|
979 |
-
),
|
980 |
-
'usage' => '[table style="default"] <table> ... </table> [/table]<br/>[table style="default" url="http://example.com/file.csv"] [/table]',
|
981 |
-
'content' => __( "<table>\n<tr>\n\t<td>Table</td>\n\t<td>Table</td>\n</tr>\n<tr>\n\t<td>Table</td>\n\t<td>Table</td>\n</tr>\n</table>", 'su' ),
|
982 |
-
'desc' => __( 'Styled table from HTML or CSV file', 'su' )
|
983 |
-
),
|
984 |
-
// permalink
|
985 |
-
'permalink' => array(
|
986 |
-
'name' => __( 'Permalink', 'su' ),
|
987 |
-
'type' => 'mixed',
|
988 |
-
'group' => 'content other',
|
989 |
-
'atts' => array(
|
990 |
-
'id' => array(
|
991 |
-
'values' => array( ), 'default' => 1,
|
992 |
-
'name' => __( 'ID', 'su' ),
|
993 |
-
'desc' => __( 'Post or page ID', 'su' )
|
994 |
-
),
|
995 |
-
'target' => array(
|
996 |
-
'type' => 'select',
|
997 |
-
'values' => array(
|
998 |
-
'self' => __( 'Same tab', 'su' ),
|
999 |
-
'blank' => __( 'New tab', 'su' )
|
1000 |
-
),
|
1001 |
-
'default' => 'self',
|
1002 |
-
'name' => __( 'Target', 'su' ),
|
1003 |
-
'desc' => __( 'Link target. blank - link will be opened in new window/tab', 'su' )
|
1004 |
-
),
|
1005 |
-
'class' => array(
|
1006 |
-
'default' => '',
|
1007 |
-
'name' => __( 'Class', 'su' ),
|
1008 |
-
'desc' => __( 'Extra CSS class', 'su' )
|
1009 |
-
)
|
1010 |
-
),
|
1011 |
-
'usage' => '[permalink id=52]<br/>[permalink id="52" target="blank"] Content [/permalink]',
|
1012 |
-
'content' => '', 'desc' => __( 'Permalink to specified post/page', 'su' )
|
1013 |
-
),
|
1014 |
-
// members
|
1015 |
-
'members' => array(
|
1016 |
-
'name' => __( 'Members', 'su' ),
|
1017 |
-
'type' => 'wrap',
|
1018 |
-
'group' => 'other',
|
1019 |
-
'atts' => array(
|
1020 |
-
'message' => array(
|
1021 |
-
'default' => __( 'This content is for registered users only. Please %login%.', 'su' ),
|
1022 |
-
'name' => __( 'Message', 'su' ), 'desc' => __( 'Message for not logged users', 'su' )
|
1023 |
-
),
|
1024 |
-
'color' => array(
|
1025 |
-
'type' => 'color',
|
1026 |
-
'default' => '#ffcc00',
|
1027 |
-
'name' => __( 'Box color', 'su' ), 'desc' => __( 'This color will applied only to box for not logged users', 'su' )
|
1028 |
-
),
|
1029 |
-
'login_text' => array(
|
1030 |
-
'default' => __( 'login', 'su' ),
|
1031 |
-
'name' => __( 'Login link text', 'su' ), 'desc' => __( 'Text for the login link', 'su' )
|
1032 |
-
),
|
1033 |
-
'login_url' => array(
|
1034 |
-
'default' => wp_login_url( get_permalink( get_the_ID() ) ),
|
1035 |
-
'name' => __( 'Login link url', 'su' ), 'desc' => __( 'Login link url', 'su' )
|
1036 |
-
),
|
1037 |
-
'class' => array(
|
1038 |
-
'default' => '',
|
1039 |
-
'name' => __( 'Class', 'su' ),
|
1040 |
-
'desc' => __( 'Extra CSS class', 'su' )
|
1041 |
-
)
|
1042 |
-
),
|
1043 |
-
'usage' => '[members style="default"] Content for logged members [/members]', 'content' => __( 'Content for logged members', 'su' ),
|
1044 |
-
'desc' => __( 'Content for logged in members only', 'su' )
|
1045 |
-
),
|
1046 |
-
// guests
|
1047 |
-
'guests' => array(
|
1048 |
-
'name' => __( 'Guests', 'su' ),
|
1049 |
-
'type' => 'wrap',
|
1050 |
-
'group' => 'other',
|
1051 |
-
'atts' => array(
|
1052 |
-
'class' => array(
|
1053 |
-
'default' => '',
|
1054 |
-
'name' => __( 'Class', 'su' ),
|
1055 |
-
'desc' => __( 'Extra CSS class', 'su' )
|
1056 |
-
)
|
1057 |
-
),
|
1058 |
-
'usage' => '[guests] Content for guests [/guests]', 'content' => __( 'Content for guests', 'su' ), 'desc' => __( 'Content for guests only', 'su' )
|
1059 |
-
),
|
1060 |
-
// feed
|
1061 |
-
'feed' => array(
|
1062 |
-
'name' => __( 'RSS Feed', 'su' ),
|
1063 |
-
'type' => 'single',
|
1064 |
-
'group' => 'content other',
|
1065 |
-
'atts' => array(
|
1066 |
-
'url' => array(
|
1067 |
-
'values' => array( ),
|
1068 |
-
'default' => '',
|
1069 |
-
'name' => __( 'Url', 'su' ),
|
1070 |
-
'desc' => __( 'Url to RSS-feed', 'su' )
|
1071 |
-
),
|
1072 |
-
'limit' => array(
|
1073 |
-
'type' => 'select',
|
1074 |
-
'values' => array( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ), 'default' => 3,
|
1075 |
-
'name' => __( 'Limit', 'su' ), 'desc' => __( 'Number of items to show', 'su' )
|
1076 |
-
),
|
1077 |
-
'class' => array(
|
1078 |
-
'default' => '',
|
1079 |
-
'name' => __( 'Class', 'su' ),
|
1080 |
-
'desc' => __( 'Extra CSS class', 'su' )
|
1081 |
-
)
|
1082 |
-
),
|
1083 |
-
'usage' => '[feed url="http://rss1.smashingmagazine.com/feed/" limit="5"]', 'desc' => __( 'Feed grabber', 'su' )
|
1084 |
-
),
|
1085 |
-
// menu
|
1086 |
-
'menu' => array(
|
1087 |
-
'name' => __( 'Menu', 'su' ),
|
1088 |
-
'type' => 'single',
|
1089 |
-
'group' => 'other',
|
1090 |
-
'atts' => array(
|
1091 |
-
'name' => array(
|
1092 |
-
'values' => array( ),
|
1093 |
-
'default' => '',
|
1094 |
-
'name' => __( 'Menu name', 'su' ), 'desc' => __( 'Custom menu name. Ex: Main menu', 'su' )
|
1095 |
-
),
|
1096 |
-
'class' => array(
|
1097 |
-
'default' => '',
|
1098 |
-
'name' => __( 'Class', 'su' ),
|
1099 |
-
'desc' => __( 'Extra CSS class', 'su' )
|
1100 |
-
)
|
1101 |
-
),
|
1102 |
-
'usage' => '[menu name="Main menu"]', 'desc' => __( 'Custom menu by name', 'su' )
|
1103 |
-
),
|
1104 |
-
// subpages
|
1105 |
-
'subpages' => array(
|
1106 |
-
'name' => __( 'Sub pages', 'su' ),
|
1107 |
-
'type' => 'single',
|
1108 |
-
'group' => 'other',
|
1109 |
-
'atts' => array(
|
1110 |
-
'depth' => array(
|
1111 |
-
'type' => 'select',
|
1112 |
-
'values' => array( 1, 2, 3, 4, 5 ), 'default' => 1,
|
1113 |
-
'name' => __( 'Depth', 'su' ),
|
1114 |
-
'desc' => __( 'Max depth level of children pages', 'su' )
|
1115 |
-
),
|
1116 |
-
'p' => array(
|
1117 |
-
'values' => array( ),
|
1118 |
-
'default' => '',
|
1119 |
-
'name' => __( 'Parent ID', 'su' ),
|
1120 |
-
'desc' => __( 'ID of the parent page. Leave blank to use current page', 'su' )
|
1121 |
-
),
|
1122 |
-
'class' => array(
|
1123 |
-
'default' => '',
|
1124 |
-
'name' => __( 'Class', 'su' ),
|
1125 |
-
'desc' => __( 'Extra CSS class', 'su' )
|
1126 |
-
)
|
1127 |
-
),
|
1128 |
-
'usage' => '[subpages]<br/>[subpages depth="2" p="122"]', 'desc' => __( 'List of sub pages', 'su' )
|
1129 |
-
),
|
1130 |
-
// siblings
|
1131 |
-
'siblings' => array(
|
1132 |
-
'name' => __( 'Siblings', 'su' ),
|
1133 |
-
'type' => 'single',
|
1134 |
-
'group' => 'other',
|
1135 |
-
'atts' => array(
|
1136 |
-
'depth' => array(
|
1137 |
-
'type' => 'select',
|
1138 |
-
'values' => array( 1, 2, 3 ), 'default' => 1,
|
1139 |
-
'name' => __( 'Depth', 'su' ),
|
1140 |
-
'desc' => __( 'Max depth level', 'su' )
|
1141 |
-
),
|
1142 |
-
'class' => array(
|
1143 |
-
'default' => '',
|
1144 |
-
'name' => __( 'Class', 'su' ),
|
1145 |
-
'desc' => __( 'Extra CSS class', 'su' )
|
1146 |
-
)
|
1147 |
-
),
|
1148 |
-
'usage' => '[siblings]<br/>[siblings depth="2"]', 'desc' => __( 'List of cureent page siblings', 'su' )
|
1149 |
-
),
|
1150 |
-
// document
|
1151 |
-
'document' => array(
|
1152 |
-
'name' => __( 'Document', 'su' ),
|
1153 |
-
'type' => 'single',
|
1154 |
-
'group' => 'media',
|
1155 |
-
'atts' => array(
|
1156 |
-
'url' => array(
|
1157 |
-
'type' => 'upload',
|
1158 |
-
'default' => '',
|
1159 |
-
'name' => __( 'Url', 'su' ),
|
1160 |
-
'desc' => __( 'Url to uploaded document. Supported formats: doc, xls, pdf etc.', 'su' )
|
1161 |
-
),
|
1162 |
-
'width' => array(
|
1163 |
-
'type' => 'number',
|
1164 |
-
'min' => 0,
|
1165 |
-
'max' => 10000,
|
1166 |
-
'step' => 20,
|
1167 |
-
'default' => 600,
|
1168 |
-
'name' => __( 'Width', 'su' ),
|
1169 |
-
'desc' => __( 'Viewer width', 'su' )
|
1170 |
-
),
|
1171 |
-
'height' => array(
|
1172 |
-
'type' => 'number',
|
1173 |
-
'min' => 0,
|
1174 |
-
'max' => 10000,
|
1175 |
-
'step' => 20,
|
1176 |
-
'default' => 600,
|
1177 |
-
'name' => __( 'Height', 'su' ),
|
1178 |
-
'desc' => __( 'Viewer height', 'su' )
|
1179 |
-
),
|
1180 |
-
'responsive' => array(
|
1181 |
-
'type' => 'switch',
|
1182 |
-
'default' => 'yes',
|
1183 |
-
'name' => __( 'Responsive', 'su' ),
|
1184 |
-
'desc' => __( 'Ignore width and height parameters and make viewer responsive', 'su' )
|
1185 |
-
),
|
1186 |
-
'class' => array(
|
1187 |
-
'default' => '',
|
1188 |
-
'name' => __( 'Class', 'su' ),
|
1189 |
-
'desc' => __( 'Extra CSS class', 'su' )
|
1190 |
-
)
|
1191 |
-
),
|
1192 |
-
'usage' => '[document url="file.doc" width="600" height="400"]', 'desc' => __( 'Document viewer by Google', 'su' )
|
1193 |
-
),
|
1194 |
-
// gmap
|
1195 |
-
'gmap' => array(
|
1196 |
-
'name' => __( 'Gmap', 'su' ),
|
1197 |
-
'type' => 'single',
|
1198 |
-
'group' => 'media',
|
1199 |
-
'atts' => array(
|
1200 |
-
'width' => array(
|
1201 |
-
'type' => 'number',
|
1202 |
-
'min' => 0,
|
1203 |
-
'max' => 10000,
|
1204 |
-
'step' => 20,
|
1205 |
-
'default' => 600,
|
1206 |
-
'name' => __( 'Width', 'su' ),
|
1207 |
-
'desc' => __( 'Map width', 'su' )
|
1208 |
-
),
|
1209 |
-
'height' => array(
|
1210 |
-
'type' => 'number',
|
1211 |
-
'min' => 0,
|
1212 |
-
'max' => 10000,
|
1213 |
-
'step' => 20,
|
1214 |
-
'default' => 400,
|
1215 |
-
'name' => __( 'Height', 'su' ),
|
1216 |
-
'desc' => __( 'Map height', 'su' )
|
1217 |
-
),
|
1218 |
-
'responsive' => array(
|
1219 |
-
'type' => 'switch',
|
1220 |
-
'default' => 'yes',
|
1221 |
-
'name' => __( 'Responsive', 'su' ),
|
1222 |
-
'desc' => __( 'Ignore width and height parameters and make map responsive', 'su' )
|
1223 |
-
),
|
1224 |
-
'address' => array(
|
1225 |
-
'values' => array( ),
|
1226 |
-
'default' => '',
|
1227 |
-
'name' => __( 'Marker', 'su' ),
|
1228 |
-
'desc' => __( 'Address for the marker. You can type it in any language', 'su' )
|
1229 |
-
),
|
1230 |
-
'class' => array(
|
1231 |
-
'default' => '',
|
1232 |
-
'name' => __( 'Class', 'su' ),
|
1233 |
-
'desc' => __( 'Extra CSS class', 'su' )
|
1234 |
-
)
|
1235 |
-
),
|
1236 |
-
'usage' => '[gmap width="600" height="400" address="New York"]', 'desc' => __( 'Maps by Google', 'su' )
|
1237 |
-
),
|
1238 |
-
// slider
|
1239 |
-
'slider' => array(
|
1240 |
-
'name' => __( 'Slider', 'su' ),
|
1241 |
-
'type' => 'single',
|
1242 |
-
'group' => 'gallery',
|
1243 |
-
'atts' => array(
|
1244 |
-
'gallery' => array(
|
1245 |
-
'type' => 'gallery',
|
1246 |
-
'name' => __( 'Gallery', 'su' ),
|
1247 |
-
'desc' => __( 'Choose source gallery, that will be used for this slider', 'su' )
|
1248 |
-
),
|
1249 |
-
'width' => array(
|
1250 |
-
'type' => 'number',
|
1251 |
-
'min' => 0,
|
1252 |
-
'max' => 10000,
|
1253 |
-
'step' => 20,
|
1254 |
-
'default' => 600,
|
1255 |
-
'name' => __( 'Width', 'su' ), 'desc' => __( 'Slider width (in pixels)', 'su' )
|
1256 |
-
),
|
1257 |
-
'height' => array(
|
1258 |
-
'type' => 'number',
|
1259 |
-
'min' => 0,
|
1260 |
-
'max' => 10000,
|
1261 |
-
'step' => 20,
|
1262 |
-
'default' => 300,
|
1263 |
-
'name' => __( 'Height', 'su' ), 'desc' => __( 'Slider height (in pixels)', 'su' )
|
1264 |
-
),
|
1265 |
-
'responsive' => array(
|
1266 |
-
'type' => 'switch',
|
1267 |
-
'default' => 'yes',
|
1268 |
-
'name' => __( 'Responsive', 'su' ),
|
1269 |
-
'desc' => __( 'Ignore width and height parameters and make slider responsive', 'su' )
|
1270 |
-
),
|
1271 |
-
'title' => array(
|
1272 |
-
'type' => 'switch',
|
1273 |
-
'default' => 'yes',
|
1274 |
-
'name' => __( 'Show titles', 'su' ), 'desc' => __( 'Display slide titles', 'su' )
|
1275 |
-
),
|
1276 |
-
'centered' => array(
|
1277 |
-
'type' => 'switch',
|
1278 |
-
'default' => 'yes',
|
1279 |
-
'name' => __( 'Center', 'su' ), 'desc' => __( 'Is slider centered on the page', 'su' )
|
1280 |
-
),
|
1281 |
-
'arrows' => array(
|
1282 |
-
'type' => 'switch',
|
1283 |
-
'default' => 'yes',
|
1284 |
-
'name' => __( 'Arrows', 'su' ), 'desc' => __( 'Show left and right arrows', 'su' )
|
1285 |
-
),
|
1286 |
-
'pages' => array(
|
1287 |
-
'type' => 'switch',
|
1288 |
-
'default' => 'yes',
|
1289 |
-
'name' => __( 'Pagination', 'su' ),
|
1290 |
-
'desc' => __( 'Show pagination', 'su' )
|
1291 |
-
),
|
1292 |
-
'mousewheel' => array(
|
1293 |
-
'type' => 'switch',
|
1294 |
-
'default' => 'yes', 'name' => __( 'Mouse wheel control', 'su' ),
|
1295 |
-
'desc' => __( 'Allow to change slides with mouse wheel', 'su' )
|
1296 |
-
),
|
1297 |
-
'autoplay' => array(
|
1298 |
-
'type' => 'number',
|
1299 |
-
'min' => 0,
|
1300 |
-
'max' => 100000,
|
1301 |
-
'step' => 100,
|
1302 |
-
'default' => 5000,
|
1303 |
-
'name' => __( 'Autoplay', 'su' ),
|
1304 |
-
'desc' => __( 'Choose interval between slide animations. Set to 0 to disable autoplay', 'su' )
|
1305 |
-
),
|
1306 |
-
'speed' => array(
|
1307 |
-
'type' => 'number',
|
1308 |
-
'min' => 0,
|
1309 |
-
'max' => 20000,
|
1310 |
-
'step' => 100,
|
1311 |
-
'default' => 600,
|
1312 |
-
'name' => __( 'Speed', 'su' ), 'desc' => __( 'Specify animation speed', 'su' )
|
1313 |
-
),
|
1314 |
-
'target' => array(
|
1315 |
-
'type' => 'switch',
|
1316 |
-
'default' => 'yes',
|
1317 |
-
'name' => __( 'Links target', 'su' ),
|
1318 |
-
'desc' => __( 'Open slides links in new window/tab', 'su' )
|
1319 |
-
),
|
1320 |
-
'class' => array(
|
1321 |
-
'default' => '',
|
1322 |
-
'name' => __( 'Class', 'su' ),
|
1323 |
-
'desc' => __( 'Extra CSS class', 'su' )
|
1324 |
-
)
|
1325 |
-
),
|
1326 |
-
'usage' => '[slider gallery="1"]', 'desc' => __( 'Customizable image slider', 'su' )
|
1327 |
-
),
|
1328 |
-
// carousel
|
1329 |
-
'carousel' => array(
|
1330 |
-
'name' => __( 'Carousel', 'su' ),
|
1331 |
-
'type' => 'single',
|
1332 |
-
'group' => 'gallery',
|
1333 |
-
'atts' => array(
|
1334 |
-
'gallery' => array(
|
1335 |
-
'type' => 'gallery',
|
1336 |
-
'name' => __( 'Gallery', 'su' ),
|
1337 |
-
'desc' => __( 'Choose source gallery, that will be used for this carousel', 'su' )
|
1338 |
-
),
|
1339 |
-
'width' => array(
|
1340 |
-
'type' => 'number',
|
1341 |
-
'min' => 0,
|
1342 |
-
'max' => 10000,
|
1343 |
-
'step' => 20,
|
1344 |
-
'default' => 600,
|
1345 |
-
'name' => __( 'Width', 'su' ), 'desc' => __( 'Carousel width (in pixels)', 'su' )
|
1346 |
-
),
|
1347 |
-
'height' => array(
|
1348 |
-
'type' => 'number',
|
1349 |
-
'min' => 0,
|
1350 |
-
'max' => 10000,
|
1351 |
-
'step' => 20,
|
1352 |
-
'default' => 100,
|
1353 |
-
'name' => __( 'Height', 'su' ), 'desc' => __( 'Carousel height (in pixels)', 'su' )
|
1354 |
-
),
|
1355 |
-
'responsive' => array(
|
1356 |
-
'type' => 'switch',
|
1357 |
-
'default' => 'yes',
|
1358 |
-
'name' => __( 'Responsive', 'su' ),
|
1359 |
-
'desc' => __( 'Ignore width and height parameters and make carousel responsive', 'su' )
|
1360 |
-
),
|
1361 |
-
'items' => array(
|
1362 |
-
'type' => 'number',
|
1363 |
-
'min' => 1,
|
1364 |
-
'max' => 20,
|
1365 |
-
'step' => 1, 'default' => 3,
|
1366 |
-
'name' => __( 'Items to show', 'su' ),
|
1367 |
-
'desc' => __( 'How much carousel items is visible', 'su' )
|
1368 |
-
),
|
1369 |
-
'scroll' => array(
|
1370 |
-
'type' => 'number',
|
1371 |
-
'min' => 1,
|
1372 |
-
'max' => 20,
|
1373 |
-
'step' => 1, 'default' => 1,
|
1374 |
-
'name' => __( 'Scroll number', 'su' ),
|
1375 |
-
'desc' => __( 'How much items are scrolled in one transition', 'su' )
|
1376 |
-
),
|
1377 |
-
'title' => array(
|
1378 |
-
'type' => 'switch',
|
1379 |
-
'default' => 'yes',
|
1380 |
-
'name' => __( 'Show titles', 'su' ), 'desc' => __( 'Display titles for each item', 'su' )
|
1381 |
-
),
|
1382 |
-
'centered' => array(
|
1383 |
-
'type' => 'switch',
|
1384 |
-
'default' => 'yes',
|
1385 |
-
'name' => __( 'Center', 'su' ), 'desc' => __( 'Is carousel centered on the page', 'su' )
|
1386 |
-
),
|
1387 |
-
'arrows' => array(
|
1388 |
-
'type' => 'switch',
|
1389 |
-
'default' => 'yes',
|
1390 |
-
'name' => __( 'Arrows', 'su' ), 'desc' => __( 'Show left and right arrows', 'su' )
|
1391 |
-
),
|
1392 |
-
'pages' => array(
|
1393 |
-
'type' => 'switch',
|
1394 |
-
'default' => 'no',
|
1395 |
-
'name' => __( 'Pagination', 'su' ),
|
1396 |
-
'desc' => __( 'Show pagination', 'su' )
|
1397 |
-
),
|
1398 |
-
'mousewheel' => array(
|
1399 |
-
'type' => 'switch',
|
1400 |
-
'default' => 'yes', 'name' => __( 'Mouse wheel control', 'su' ),
|
1401 |
-
'desc' => __( 'Allow to rotate carousel with mouse wheel', 'su' )
|
1402 |
-
),
|
1403 |
-
'autoplay' => array(
|
1404 |
-
'type' => 'number',
|
1405 |
-
'min' => 0,
|
1406 |
-
'max' => 100000,
|
1407 |
-
'step' => 100,
|
1408 |
-
'default' => 5000,
|
1409 |
-
'name' => __( 'Autoplay', 'su' ),
|
1410 |
-
'desc' => __( 'Choose interval between auto animations. Set to 0 to disable autoplay', 'su' )
|
1411 |
-
),
|
1412 |
-
'speed' => array(
|
1413 |
-
'type' => 'number',
|
1414 |
-
'min' => 0,
|
1415 |
-
'max' => 20000,
|
1416 |
-
'step' => 100,
|
1417 |
-
'default' => 600,
|
1418 |
-
'name' => __( 'Speed', 'su' ), 'desc' => __( 'Specify animation speed', 'su' )
|
1419 |
-
),
|
1420 |
-
'target' => array(
|
1421 |
-
'type' => 'switch',
|
1422 |
-
'default' => 'yes',
|
1423 |
-
'name' => __( 'Links target', 'su' ),
|
1424 |
-
'desc' => __( 'Open carousel links in new window/tab', 'su' )
|
1425 |
-
),
|
1426 |
-
'class' => array(
|
1427 |
-
'default' => '',
|
1428 |
-
'name' => __( 'Class', 'su' ),
|
1429 |
-
'desc' => __( 'Extra CSS class', 'su' )
|
1430 |
-
)
|
1431 |
-
),
|
1432 |
-
'usage' => '[carousel gallery="1"]', 'desc' => __( 'Customizable image carousel', 'su' )
|
1433 |
-
),
|
1434 |
-
// custom_gallery
|
1435 |
-
'custom_gallery' => array(
|
1436 |
-
'name' => __( 'Gallery', 'su' ),
|
1437 |
-
'type' => 'single',
|
1438 |
-
'group' => 'gallery',
|
1439 |
-
'atts' => array(
|
1440 |
-
'gallery' => array(
|
1441 |
-
'type' => 'gallery',
|
1442 |
-
'name' => __( 'Gallery', 'su' ),
|
1443 |
-
'desc' => __( 'Choose source gallery, that will be used for this shortcode', 'su' )
|
1444 |
-
),
|
1445 |
-
'width' => array(
|
1446 |
-
'type' => 'number',
|
1447 |
-
'min' => 20,
|
1448 |
-
'max' => 2000,
|
1449 |
-
'step' => 20,
|
1450 |
-
'default' => 90,
|
1451 |
-
'name' => __( 'Width', 'su' ), 'desc' => __( 'Single item width (in pixels)', 'su' )
|
1452 |
-
),
|
1453 |
-
'height' => array(
|
1454 |
-
'type' => 'number',
|
1455 |
-
'min' => 20,
|
1456 |
-
'max' => 2000,
|
1457 |
-
'step' => 20,
|
1458 |
-
'default' => 90,
|
1459 |
-
'name' => __( 'Height', 'su' ), 'desc' => __( 'Single item height (in pixels)', 'su' )
|
1460 |
-
),
|
1461 |
-
'title' => array(
|
1462 |
-
'type' => 'select',
|
1463 |
-
'values' => array(
|
1464 |
-
'never' => __( 'Never', 'su' ),
|
1465 |
-
'hover' => __( 'On mouse over', 'su' ),
|
1466 |
-
'always' => __( 'Always', 'su' )
|
1467 |
-
),
|
1468 |
-
'default' => 'hover',
|
1469 |
-
'name' => __( 'Show titles', 'su' ),
|
1470 |
-
'desc' => __( 'Title display mode', 'su' )
|
1471 |
-
),
|
1472 |
-
'target' => array(
|
1473 |
-
'type' => 'switch',
|
1474 |
-
'default' => 'yes',
|
1475 |
-
'name' => __( 'Links target', 'su' ), 'desc' => __( 'Open links in new window/tab', 'su' )
|
1476 |
-
),
|
1477 |
-
'class' => array(
|
1478 |
-
'default' => '',
|
1479 |
-
'name' => __( 'Class', 'su' ),
|
1480 |
-
'desc' => __( 'Extra CSS class', 'su' )
|
1481 |
-
)
|
1482 |
-
),
|
1483 |
-
'usage' => '[custom_gallery gallery="1"]', 'desc' => __( 'Customizable image gallery', 'su' )
|
1484 |
-
),
|
1485 |
-
// posts
|
1486 |
-
'posts' => array(
|
1487 |
-
'name' => __( 'Posts', 'su' ),
|
1488 |
-
'type' => 'single',
|
1489 |
-
'group' => 'other',
|
1490 |
-
'atts' => array(
|
1491 |
-
'template' => array(
|
1492 |
-
'default' => 'templates/default-loop.php', 'name' => __( 'Template', 'su' ),
|
1493 |
-
'desc' => __( '<b>Do not change this field value if you do not understand description below.</b><br/>Relative path to the template file. Default templates is placed under the plugin directory (templates folder). You can copy it under your theme directory and modify as you want. You can use following default templates that already available in the plugin directory:<br/><b%value>templates/default-loop.php</b> - posts loop<br/><b%value>templates/teaser-loop.php</b> - posts loop with thumbnail and title<br/><b%value>templates/single-post.php</b> - single post template<br/><b%value>templates/list-loop.php</b> - unordered list with posts titles', 'su' )
|
1494 |
-
),
|
1495 |
-
'id' => array(
|
1496 |
-
'default' => '',
|
1497 |
-
'name' => __( 'Post ID\'s', 'su' ),
|
1498 |
-
'desc' => __( 'Enter comma separated ID\'s of the posts that you want to show', 'su' )
|
1499 |
-
),
|
1500 |
-
'posts_per_page' => array(
|
1501 |
-
'type' => 'number',
|
1502 |
-
'min' => -1,
|
1503 |
-
'max' => 10000,
|
1504 |
-
'step' => 1,
|
1505 |
-
'default' => get_option( 'posts_per_page' ),
|
1506 |
-
'name' => __( 'Posts per page', 'su' ),
|
1507 |
-
'desc' => __( 'Specify number of posts that you want to show. Enter -1 to get all posts', 'su' )
|
1508 |
-
),
|
1509 |
-
'post_type' => array(
|
1510 |
-
'type' => 'select',
|
1511 |
-
'multiple' => true,
|
1512 |
-
'values' => su_get_post_types(),
|
1513 |
-
'default' => 'default',
|
1514 |
-
'name' => __( 'Post types', 'su' ),
|
1515 |
-
'desc' => __( 'Select post types. Hold Ctrl key to select multiple post types', 'su' )
|
1516 |
-
),
|
1517 |
-
'taxonomy' => array(
|
1518 |
-
'type' => 'select',
|
1519 |
-
'values' => su_get_taxonomies(),
|
1520 |
-
'default' => '',
|
1521 |
-
'name' => __( 'Taxonomy', 'su' ),
|
1522 |
-
'desc' => __( 'Select taxonomy to show posts from', 'su' )
|
1523 |
-
),
|
1524 |
-
'tax_term' => array(
|
1525 |
-
'type' => 'select',
|
1526 |
-
'multiple' => true,
|
1527 |
-
'values' => su_get_terms( su_get_taxonomies( true ) ),
|
1528 |
-
'default' => '',
|
1529 |
-
'name' => __( 'Terms', 'su' ), 'desc' => __( 'Select terms to show posts from', 'su' )
|
1530 |
-
),
|
1531 |
-
'tax_operator' => array(
|
1532 |
-
'type' => 'select',
|
1533 |
-
'values' => array( 'IN', 'NOT IN', 'AND' ),
|
1534 |
-
'default' => 'IN', 'name' => __( 'Taxonomy term operator', 'su' ),
|
1535 |
-
'desc' => __( 'IN - posts that have any of selected categories terms<br/>NOT IN - posts that is does not have any of selected terms<br/>AND - posts that have all selected terms', 'su' )
|
1536 |
-
),
|
1537 |
-
'author' => array(
|
1538 |
-
'type' => 'select',
|
1539 |
-
'multiple' => true,
|
1540 |
-
'values' => su_get_users(),
|
1541 |
-
'default' => 'default',
|
1542 |
-
'name' => __( 'Authors', 'su' ),
|
1543 |
-
'desc' => __( 'Choose the authors whose posts you want to show', 'su' )
|
1544 |
-
),
|
1545 |
-
'meta_key' => array(
|
1546 |
-
'default' => '',
|
1547 |
-
'name' => __( 'Meta key', 'su' ),
|
1548 |
-
'desc' => __( 'Enter meta key name to show posts that have this key', 'su' )
|
1549 |
-
),
|
1550 |
-
'offset' => array(
|
1551 |
-
'type' => 'number',
|
1552 |
-
'min' => 0,
|
1553 |
-
'max' => 10000,
|
1554 |
-
'step' => 1, 'default' => 0,
|
1555 |
-
'name' => __( 'Offset', 'su' ),
|
1556 |
-
'desc' => __( 'Specify offset to start posts loop not from first post', 'su' )
|
1557 |
-
),
|
1558 |
-
'order' => array(
|
1559 |
-
'type' => 'select',
|
1560 |
-
'values' => array(
|
1561 |
-
'desc' => __( 'Descending', 'su' ),
|
1562 |
-
'asc' => __( 'Ascending', 'su' )
|
1563 |
-
),
|
1564 |
-
'default' => 'DESC',
|
1565 |
-
'name' => __( 'Order', 'su' ),
|
1566 |
-
'desc' => __( 'Posts order', 'su' )
|
1567 |
-
),
|
1568 |
-
'orderby' => array(
|
1569 |
-
'type' => 'select',
|
1570 |
-
'values' => array(
|
1571 |
-
'none' => __( 'None', 'su' ),
|
1572 |
-
'id' => __( 'Post ID', 'su' ),
|
1573 |
-
'author' => __( 'Post author', 'su' ),
|
1574 |
-
'title' => __( 'Post title', 'su' ),
|
1575 |
-
'name' => __( 'Post slug', 'su' ),
|
1576 |
-
'date' => __( 'Date', 'su' ), 'modified' => __( 'Last modified date', 'su' ),
|
1577 |
-
'parent' => __( 'Post parent', 'su' ),
|
1578 |
-
'rand' => __( 'Random', 'su' ), 'comment_count' => __( 'Comments number', 'su' ),
|
1579 |
-
'menu_order' => __( 'Menu order', 'su' ), 'meta_value' => __( 'Meta key values', 'su' ),
|
1580 |
-
),
|
1581 |
-
'default' => 'date',
|
1582 |
-
'name' => __( 'Order by', 'su' ),
|
1583 |
-
'desc' => __( 'Order posts by', 'su' )
|
1584 |
-
),
|
1585 |
-
'post_parent' => array(
|
1586 |
-
'default' => '',
|
1587 |
-
'name' => __( 'Post parent', 'su' ),
|
1588 |
-
'desc' => __( 'Show childrens of entered post (enter post ID)', 'su' )
|
1589 |
-
),
|
1590 |
-
'post_status' => array(
|
1591 |
-
'type' => 'select',
|
1592 |
-
'values' => array(
|
1593 |
-
'publish' => __( 'Published', 'su' ),
|
1594 |
-
'pending' => __( 'Pending', 'su' ),
|
1595 |
-
'draft' => __( 'Draft', 'su' ),
|
1596 |
-
'auto-draft' => __( 'Auto-draft', 'su' ),
|
1597 |
-
'future' => __( 'Future post', 'su' ),
|
1598 |
-
'private' => __( 'Private post', 'su' ),
|
1599 |
-
'inherit' => __( 'Inherit', 'su' ),
|
1600 |
-
'trash' => __( 'Trashed', 'su' ),
|
1601 |
-
'any' => __( 'Any', 'su' ),
|
1602 |
-
),
|
1603 |
-
'default' => 'publish',
|
1604 |
-
'name' => __( 'Post status', 'su' ),
|
1605 |
-
'desc' => __( 'Show only posts with selected status', 'su' )
|
1606 |
-
),
|
1607 |
-
'ignore_sticky_posts' => array(
|
1608 |
-
'type' => 'switch',
|
1609 |
-
'default' => 'no',
|
1610 |
-
'name' => __( 'Ignore sticky', 'su' ),
|
1611 |
-
'desc' => __( 'Select Yes to ignore posts that is sticked', 'su' )
|
1612 |
-
)
|
1613 |
-
),
|
1614 |
-
'usage' => '[posts template="templates/posts.php"]',
|
1615 |
-
'desc' => __( 'Custom posts query with customizable template', 'su' )
|
1616 |
-
)
|
1617 |
-
) );
|
1618 |
-
// Return result
|
1619 |
-
return ( is_string( $shortcode ) ) ? $shortcodes[sanitize_text_field( $shortcode )] : $shortcodes;
|
1620 |
-
}
|
1621 |
-
}
|
1622 |
-
|
1623 |
-
new Shortcodes_Ultimate_Data;
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Class for managing plugin data
|
4 |
+
*/
|
5 |
+
class Shortcodes_Ultimate_Data {
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Constructor
|
9 |
+
*/
|
10 |
+
function __construct() {
|
11 |
+
add_action( 'init', array( __CLASS__, 'register' ) );
|
12 |
+
}
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Register shortcodes
|
16 |
+
*/
|
17 |
+
public static function register() {
|
18 |
+
// Loop through shortcodes
|
19 |
+
foreach ( ( array ) self::shortcodes() as $shortcode => $data ) {
|
20 |
+
// Prepare shortcode function name
|
21 |
+
$function = ( isset( $data['function'] ) ) ? $data['function'] : 'su_' . $shortcode . '_shortcode';
|
22 |
+
// Register shortcode
|
23 |
+
add_shortcode( su_compatibility_mode_prefix() . $shortcode, $function );
|
24 |
+
}
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Shortcode groups
|
29 |
+
*/
|
30 |
+
public static function groups() {
|
31 |
+
return ( array ) apply_filters( 'su/data/groups', array(
|
32 |
+
'all' => __( 'All', 'su' ),
|
33 |
+
'content' => __( 'Content', 'su' ),
|
34 |
+
'box' => __( 'Box', 'su' ),
|
35 |
+
'media' => __( 'Media', 'su' ),
|
36 |
+
'gallery' => __( 'Gallery', 'su' ),
|
37 |
+
'other' => __( 'Other', 'su' )
|
38 |
+
) );
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Shortcodes
|
43 |
+
*/
|
44 |
+
public static function shortcodes( $shortcode = false ) {
|
45 |
+
$shortcodes = apply_filters( 'su/data/shortcodes', array(
|
46 |
+
// heading
|
47 |
+
'heading' => array(
|
48 |
+
'name' => __( 'Heading', 'su' ),
|
49 |
+
'type' => 'wrap',
|
50 |
+
'group' => 'content',
|
51 |
+
'atts' => array(
|
52 |
+
'size' => array(
|
53 |
+
'type' => 'number',
|
54 |
+
'min' => 1,
|
55 |
+
'max' => 18,
|
56 |
+
'step' => 1,
|
57 |
+
'default' => 3,
|
58 |
+
'name' => __( 'Size', 'su' ), 'desc' => __( 'Select heading size', 'su' )
|
59 |
+
),
|
60 |
+
'align' => array(
|
61 |
+
'type' => 'select',
|
62 |
+
'values' => array(
|
63 |
+
'left' => __( 'Left', 'su' ),
|
64 |
+
'center' => __( 'Center', 'su' ),
|
65 |
+
'right' => __( 'Right', 'su' )
|
66 |
+
),
|
67 |
+
'default' => 'center',
|
68 |
+
'name' => __( 'Align', 'su' ), 'desc' => __( 'Heading text alignment', 'su' )
|
69 |
+
),
|
70 |
+
'class' => array(
|
71 |
+
'default' => '',
|
72 |
+
'name' => __( 'Class', 'su' ),
|
73 |
+
'desc' => __( 'Extra CSS class', 'su' )
|
74 |
+
)
|
75 |
+
),
|
76 |
+
'usage' => '[heading] Content [/heading]<br/>[heading size="5"] Content [/heading]', 'content' => __( 'Heading text', 'su' ),
|
77 |
+
'desc' => __( 'Styled heading', 'su' )
|
78 |
+
),
|
79 |
+
// tabs
|
80 |
+
'tabs' => array(
|
81 |
+
'name' => __( 'Tabs', 'su' ),
|
82 |
+
'type' => 'wrap',
|
83 |
+
'group' => 'box',
|
84 |
+
'atts' => array(
|
85 |
+
'vertical' => array(
|
86 |
+
'type' => 'switch',
|
87 |
+
'default' => 'no',
|
88 |
+
'name' => __( 'Vertical', 'su' ),
|
89 |
+
'desc' => __( 'Show tabs vertically', 'su' )
|
90 |
+
),
|
91 |
+
'class' => array(
|
92 |
+
'default' => '',
|
93 |
+
'name' => __( 'Class', 'su' ),
|
94 |
+
'desc' => __( 'Extra CSS class', 'su' )
|
95 |
+
)
|
96 |
+
),
|
97 |
+
'usage' => '[tabs style="default"] [tab title="Tab name"] Tab content [/tab] [/tabs]',
|
98 |
+
'content' => __( "[tab title=\"Title 1\"]Content 1[/tab]\n[tab title=\"Title 2\"]Content 2[/tab]\n[tab title=\"Title 3\"]Content 3[/tab]", 'su' ),
|
99 |
+
'desc' => __( 'Tabs container', 'su' )
|
100 |
+
),
|
101 |
+
// tab
|
102 |
+
'tab' => array(
|
103 |
+
'name' => __( 'Tab', 'su' ),
|
104 |
+
'type' => 'wrap',
|
105 |
+
'group' => 'box',
|
106 |
+
'atts' => array(
|
107 |
+
'title' => array(
|
108 |
+
'values' => array( ),
|
109 |
+
'default' => __( 'Tab name', 'su' ),
|
110 |
+
'name' => __( 'Title', 'su' ),
|
111 |
+
'desc' => __( 'Enter tab name', 'su' )
|
112 |
+
),
|
113 |
+
'class' => array(
|
114 |
+
'default' => '',
|
115 |
+
'name' => __( 'Class', 'su' ),
|
116 |
+
'desc' => __( 'Extra CSS class', 'su' )
|
117 |
+
)
|
118 |
+
),
|
119 |
+
'usage' => '[tabs] [tab title="Tab name"] Tab content [/tab] [/tabs]', 'content' => __( 'Tab content', 'su' ),
|
120 |
+
'desc' => __( 'Single tab', 'su' )
|
121 |
+
),
|
122 |
+
// spoiler
|
123 |
+
'spoiler' => array(
|
124 |
+
'name' => __( 'Spoiler', 'su' ),
|
125 |
+
'type' => 'wrap',
|
126 |
+
'group' => 'box',
|
127 |
+
'atts' => array(
|
128 |
+
'title' => array(
|
129 |
+
'values' => array( ),
|
130 |
+
'default' => __( 'Spoiler title', 'su' ),
|
131 |
+
'name' => __( 'Title', 'su' ), 'desc' => __( 'Text in spoiler title', 'su' )
|
132 |
+
),
|
133 |
+
'open' => array(
|
134 |
+
'type' => 'switch',
|
135 |
+
'default' => 'no',
|
136 |
+
'name' => __( 'Open', 'su' ),
|
137 |
+
'desc' => __( 'Is spoiler content visible by default', 'su' )
|
138 |
+
),
|
139 |
+
'class' => array(
|
140 |
+
'default' => '',
|
141 |
+
'name' => __( 'Class', 'su' ),
|
142 |
+
'desc' => __( 'Extra CSS class', 'su' )
|
143 |
+
)
|
144 |
+
),
|
145 |
+
'usage' => '[spoiler title="Spoiler title"] Hidden text [/spoiler]', 'content' => __( 'Hidden content', 'su' ), 'desc' => __( 'Spoiler with hidden content', 'su' )
|
146 |
+
),
|
147 |
+
// accordion
|
148 |
+
'accordion' => array(
|
149 |
+
'name' => __( 'Accordion', 'su' ),
|
150 |
+
'type' => 'wrap',
|
151 |
+
'group' => 'box',
|
152 |
+
'atts' => array(
|
153 |
+
'class' => array(
|
154 |
+
'default' => '',
|
155 |
+
'name' => __( 'Class', 'su' ),
|
156 |
+
'desc' => __( 'Extra CSS class', 'su' )
|
157 |
+
)
|
158 |
+
),
|
159 |
+
'usage' => '[accordion]<br/>[spoiler open="yes"] content [/spoiler]<br/>[spoiler] content [/spoiler]<br/>[spoiler] content [/spoiler]<br/>[/accordion]',
|
160 |
+
'content' => __( "[spoiler]Content[/spoiler]\n[spoiler]Content[/spoiler]\n[spoiler]Content[/spoiler]", 'su' ), 'desc' => __( 'Accordion with spoilers', 'su' )
|
161 |
+
),
|
162 |
+
// divider
|
163 |
+
'divider' => array(
|
164 |
+
'name' => __( 'Divider', 'su' ),
|
165 |
+
'type' => 'single',
|
166 |
+
'group' => 'content',
|
167 |
+
'atts' => array(
|
168 |
+
'top' => array(
|
169 |
+
'type' => 'switch',
|
170 |
+
'default' => 'yes',
|
171 |
+
'name' => __( 'Show TOP link', 'su' ),
|
172 |
+
'desc' => __( 'Show link to top of the page or not', 'su' )
|
173 |
+
),
|
174 |
+
'text' => array(
|
175 |
+
'values' => array( ),
|
176 |
+
'default' => __( 'Go to top', 'su' ),
|
177 |
+
'name' => __( 'Link text', 'su' ), 'desc' => __( 'Text for the GO TOP link', 'su' )
|
178 |
+
),
|
179 |
+
'class' => array(
|
180 |
+
'default' => '',
|
181 |
+
'name' => __( 'Class', 'su' ),
|
182 |
+
'desc' => __( 'Extra CSS class', 'su' )
|
183 |
+
)
|
184 |
+
),
|
185 |
+
'usage' => '[divider top="yes" text="Go to top"]',
|
186 |
+
'desc' => __( 'Content divider with optional TOP link', 'su' )
|
187 |
+
),
|
188 |
+
// spacer
|
189 |
+
'spacer' => array(
|
190 |
+
'name' => __( 'Spacer', 'su' ),
|
191 |
+
'type' => 'single',
|
192 |
+
'group' => 'content other',
|
193 |
+
'atts' => array(
|
194 |
+
'size' => array(
|
195 |
+
'type' => 'number',
|
196 |
+
'min' => 0,
|
197 |
+
'max' => 10000,
|
198 |
+
'step' => 5,
|
199 |
+
'default' => 20,
|
200 |
+
'name' => __( 'Height', 'su' ), 'desc' => __( 'Height of the spacer in pixels', 'su' )
|
201 |
+
),
|
202 |
+
'class' => array(
|
203 |
+
'default' => '',
|
204 |
+
'name' => __( 'Class', 'su' ),
|
205 |
+
'desc' => __( 'Extra CSS class', 'su' )
|
206 |
+
)
|
207 |
+
),
|
208 |
+
'usage' => '[spacer size="20"]',
|
209 |
+
'desc' => __( 'Empty space with adjustable height', 'su' )
|
210 |
+
),
|
211 |
+
// highlight
|
212 |
+
'highlight' => array(
|
213 |
+
'name' => __( 'Highlight', 'su' ),
|
214 |
+
'type' => 'wrap',
|
215 |
+
'group' => 'content',
|
216 |
+
'atts' => array(
|
217 |
+
'background' => array(
|
218 |
+
'type' => 'color',
|
219 |
+
'values' => array( ),
|
220 |
+
'default' => '#DDFF99',
|
221 |
+
'name' => __( 'Background', 'su' ),
|
222 |
+
'desc' => __( 'Highlighted text background color', 'su' )
|
223 |
+
),
|
224 |
+
'color' => array(
|
225 |
+
'type' => 'color',
|
226 |
+
'values' => array( ),
|
227 |
+
'default' => '#000000',
|
228 |
+
'name' => __( 'Text color', 'su' ), 'desc' => __( 'Highlighted text color', 'su' )
|
229 |
+
),
|
230 |
+
'class' => array(
|
231 |
+
'default' => '',
|
232 |
+
'name' => __( 'Class', 'su' ),
|
233 |
+
'desc' => __( 'Extra CSS class', 'su' )
|
234 |
+
)
|
235 |
+
),
|
236 |
+
'usage' => '[highlight background="#DDFF99" color="#000000"] Content [/highlight]', 'content' => __( 'Highlighted text', 'su' ),
|
237 |
+
'desc' => __( 'Highlighted text', 'su' )
|
238 |
+
),
|
239 |
+
// label
|
240 |
+
'label' => array(
|
241 |
+
'name' => __( 'Label', 'su' ),
|
242 |
+
'type' => 'wrap',
|
243 |
+
'group' => 'content',
|
244 |
+
'atts' => array(
|
245 |
+
'type' => array(
|
246 |
+
'type' => 'select',
|
247 |
+
'values' => array(
|
248 |
+
'default' => __( 'Default', 'su' ),
|
249 |
+
'success' => __( 'Success', 'su' ),
|
250 |
+
'warning' => __( 'Warning', 'su' ),
|
251 |
+
'important' => __( 'Important', 'su' ),
|
252 |
+
'black' => __( 'Black', 'su' ),
|
253 |
+
'info' => __( 'Info', 'su' )
|
254 |
+
),
|
255 |
+
'default' => 'default',
|
256 |
+
'name' => __( 'Type', 'su' ),
|
257 |
+
'desc' => __( 'Style of the label', 'su' )
|
258 |
+
),
|
259 |
+
'class' => array(
|
260 |
+
'default' => '',
|
261 |
+
'name' => __( 'Class', 'su' ),
|
262 |
+
'desc' => __( 'Extra CSS class', 'su' )
|
263 |
+
)
|
264 |
+
),
|
265 |
+
'usage' => '[label type="info"] Information [/label]', 'content' => __( 'Label', 'su' ),
|
266 |
+
'desc' => __( 'Styled label', 'su' )
|
267 |
+
),
|
268 |
+
// quote
|
269 |
+
'quote' => array(
|
270 |
+
'name' => __( 'Quote', 'su' ),
|
271 |
+
'type' => 'wrap',
|
272 |
+
'group' => 'box',
|
273 |
+
'atts' => array(
|
274 |
+
'cite' => array(
|
275 |
+
'values' => array( ),
|
276 |
+
'default' => '',
|
277 |
+
'name' => __( 'Cite', 'su' ),
|
278 |
+
'desc' => __( 'Quote author name', 'su' )
|
279 |
+
),
|
280 |
+
'url' => array(
|
281 |
+
'values' => array( ),
|
282 |
+
'default' => '',
|
283 |
+
'name' => __( 'Cite url', 'su' ),
|
284 |
+
'desc' => __( 'Url of the quote author. Leave empty to disable link', 'su' )
|
285 |
+
),
|
286 |
+
'class' => array(
|
287 |
+
'default' => '',
|
288 |
+
'name' => __( 'Class', 'su' ),
|
289 |
+
'desc' => __( 'Extra CSS class', 'su' )
|
290 |
+
)
|
291 |
+
),
|
292 |
+
'usage' => '[quote style="default"] Content [/quote]', 'content' => __( 'Quote', 'su' ),
|
293 |
+
'desc' => __( 'Blockquote alternative', 'su' )
|
294 |
+
),
|
295 |
+
// pullquote
|
296 |
+
'pullquote' => array(
|
297 |
+
'name' => __( 'Pullquote', 'su' ),
|
298 |
+
'type' => 'wrap',
|
299 |
+
'group' => 'box',
|
300 |
+
'atts' => array(
|
301 |
+
'align' => array(
|
302 |
+
'type' => 'select',
|
303 |
+
'values' => array(
|
304 |
+
'left' => __( 'Left', 'su' ),
|
305 |
+
'right' => __( 'Right', 'su' )
|
306 |
+
),
|
307 |
+
'default' => 'left',
|
308 |
+
'name' => __( 'Align', 'su' ), 'desc' => __( 'Pullquote alignment (float)', 'su' )
|
309 |
+
),
|
310 |
+
'class' => array(
|
311 |
+
'default' => '',
|
312 |
+
'name' => __( 'Class', 'su' ),
|
313 |
+
'desc' => __( 'Extra CSS class', 'su' )
|
314 |
+
)
|
315 |
+
),
|
316 |
+
'usage' => '[pullquote align="left"] Content [/pullquote]', 'content' => __( 'Pullquote', 'su' ),
|
317 |
+
'desc' => __( 'Pullquote', 'su' )
|
318 |
+
),
|
319 |
+
// dropcap
|
320 |
+
'dropcap' => array(
|
321 |
+
'name' => __( 'Dropcap', 'su' ),
|
322 |
+
'type' => 'wrap',
|
323 |
+
'group' => 'content',
|
324 |
+
'atts' => array(
|
325 |
+
'style' => array(
|
326 |
+
'type' => 'select',
|
327 |
+
'values' => array(
|
328 |
+
'default' => __( 'Default', 'su' ),
|
329 |
+
'flat' => __( 'Flat', 'su' ),
|
330 |
+
'light' => __( 'Light', 'su' ),
|
331 |
+
'simple' => __( 'Simple', 'su' )
|
332 |
+
),
|
333 |
+
'default' => 'default',
|
334 |
+
'name' => __( 'Style', 'su' ), 'desc' => __( 'Dropcap style preset', 'su' )
|
335 |
+
),
|
336 |
+
'size' => array(
|
337 |
+
'type' => 'select',
|
338 |
+
'values' => array( 1, 2, 3, 4, 5 ), 'default' => 3,
|
339 |
+
'name' => __( 'Size', 'su' ), 'desc' => __( 'Choose dropcap size', 'su' )
|
340 |
+
),
|
341 |
+
'class' => array(
|
342 |
+
'default' => '',
|
343 |
+
'name' => __( 'Class', 'su' ),
|
344 |
+
'desc' => __( 'Extra CSS class', 'su' )
|
345 |
+
)
|
346 |
+
),
|
347 |
+
'usage' => '[dropcap style="default"]D[/dropcap]ropcap', 'content' => __( 'D', 'su' ),
|
348 |
+
'desc' => __( 'Dropcap', 'su' )
|
349 |
+
),
|
350 |
+
// row
|
351 |
+
'row' => array(
|
352 |
+
'name' => __( 'Row', 'su' ),
|
353 |
+
'type' => 'wrap',
|
354 |
+
'group' => 'box',
|
355 |
+
'atts' => array(
|
356 |
+
'class' => array(
|
357 |
+
'default' => '',
|
358 |
+
'name' => __( 'Class', 'su' ),
|
359 |
+
'desc' => __( 'Extra CSS class', 'su' )
|
360 |
+
)
|
361 |
+
),
|
362 |
+
'usage' => '[row]<br/>[column size="1/2"] 50% [/column]<br/>[column size="1/4"] 25% [/column]<br/>[column size="1/4"] 25% [/column]<br/>[/row]',
|
363 |
+
'content' => __( "[column size=\"1/3\"]Content[/column]\n[column size=\"1/3\"]Content[/column]\n[column size=\"1/3\"]Content[/column]", 'su' ), 'desc' => __( 'Row for flexible columns', 'su' )
|
364 |
+
),
|
365 |
+
// column
|
366 |
+
'column' => array(
|
367 |
+
'name' => __( 'Column', 'su' ),
|
368 |
+
'type' => 'wrap',
|
369 |
+
'group' => 'box',
|
370 |
+
'atts' => array(
|
371 |
+
'size' => array(
|
372 |
+
'type' => 'select',
|
373 |
+
'values' => array(
|
374 |
+
'1/1' => __( 'Full width', 'su' ),
|
375 |
+
'1/2' => __( 'One half', 'su' ),
|
376 |
+
'1/3' => __( 'One third', 'su' ),
|
377 |
+
'2/3' => __( 'Two third', 'su' ),
|
378 |
+
'1/4' => __( 'One fourth', 'su' ),
|
379 |
+
'3/4' => __( 'Three fourth', 'su' ),
|
380 |
+
'1/5' => __( 'One fifth', 'su' ),
|
381 |
+
'2/5' => __( 'Two fifth', 'su' ),
|
382 |
+
'3/5' => __( 'Three fifth', 'su' ),
|
383 |
+
'4/5' => __( 'Four fifth', 'su' ),
|
384 |
+
'1/6' => __( 'One sixth', 'su' ),
|
385 |
+
'5/6' => __( 'Five sixth', 'su' )
|
386 |
+
),
|
387 |
+
'default' => '1/2',
|
388 |
+
'name' => __( 'Size', 'su' ),
|
389 |
+
'desc' => __( 'Select column width. This width will be calculated depend page width', 'su' )
|
390 |
+
),
|
391 |
+
'class' => array(
|
392 |
+
'default' => '',
|
393 |
+
'name' => __( 'Class', 'su' ),
|
394 |
+
'desc' => __( 'Extra CSS class', 'su' )
|
395 |
+
)
|
396 |
+
),
|
397 |
+
'usage' => '[row]<br/>[column size="6"] 50% [/column]<br/>[column size="3"] 25% [/column]<br/>[column size="3"] 25% [/column]<br/>[/row]', 'content' => __( 'Column content', 'su' ), 'desc' => __( 'Flexible and responsive columns', 'su' )
|
398 |
+
),
|
399 |
+
// list
|
400 |
+
'list' => array(
|
401 |
+
'name' => __( 'List', 'su' ),
|
402 |
+
'type' => 'wrap',
|
403 |
+
'group' => 'content',
|
404 |
+
'atts' => array(
|
405 |
+
'style' => array(
|
406 |
+
'type' => 'select',
|
407 |
+
'values' => array(
|
408 |
+
'star' => __( 'Star', 'su' ),
|
409 |
+
'arrow' => __( 'Arrow', 'su' ),
|
410 |
+
'check' => __( 'Check', 'su' ),
|
411 |
+
'cross' => __( 'Cross', 'su' ),
|
412 |
+
'thumbs' => __( 'Thumbs up', 'su' ),
|
413 |
+
'link' => __( 'Link', 'su' ),
|
414 |
+
'gear' => __( 'Gear', 'su' ),
|
415 |
+
'time' => __( 'Time', 'su' ),
|
416 |
+
'note' => __( 'Note', 'su' ),
|
417 |
+
'plus' => __( 'Plus', 'su' ),
|
418 |
+
'guard' => __( 'Guard', 'su' ),
|
419 |
+
'event' => __( 'Event', 'su' ),
|
420 |
+
'idea' => __( 'Idea', 'su' ),
|
421 |
+
'settings' => __( 'Settings', 'su' ),
|
422 |
+
'twitter' => __( 'Twitter', 'su' )
|
423 |
+
),
|
424 |
+
'default' => 'star',
|
425 |
+
'name' => __( 'Style', 'su' ), 'desc' => __( 'List items style/icons', 'su' )
|
426 |
+
),
|
427 |
+
'class' => array(
|
428 |
+
'default' => '',
|
429 |
+
'name' => __( 'Class', 'su' ),
|
430 |
+
'desc' => __( 'Extra CSS class', 'su' )
|
431 |
+
)
|
432 |
+
),
|
433 |
+
'usage' => '[list style="check"] <ul> <li> List item </li> </ul> [/list]',
|
434 |
+
'content' => __( "<ul>\n<li>List item</li>\n<li>List item</li>\n<li>List item</li>\n</ul>", 'su' ), 'desc' => __( 'Styled unordered list', 'su' )
|
435 |
+
),
|
436 |
+
// button
|
437 |
+
'button' => array(
|
438 |
+
'name' => __( 'Button', 'su' ),
|
439 |
+
'type' => 'wrap',
|
440 |
+
'group' => 'content',
|
441 |
+
'atts' => array(
|
442 |
+
'url' => array(
|
443 |
+
'values' => array( ),
|
444 |
+
'default' => get_option( 'home' ),
|
445 |
+
'name' => __( 'Link', 'su' ),
|
446 |
+
'desc' => __( 'Button link', 'su' )
|
447 |
+
),
|
448 |
+
'target' => array(
|
449 |
+
'type' => 'select',
|
450 |
+
'values' => array(
|
451 |
+
'self' => __( 'Same tab', 'su' ),
|
452 |
+
'blank' => __( 'New tab', 'su' )
|
453 |
+
),
|
454 |
+
'default' => 'self',
|
455 |
+
'name' => __( 'Target', 'su' ),
|
456 |
+
'desc' => __( 'Button link target', 'su' )
|
457 |
+
),
|
458 |
+
'style' => array(
|
459 |
+
'type' => 'select',
|
460 |
+
'values' => array(
|
461 |
+
'default' => __( 'Default', 'su' ),
|
462 |
+
'flat' => __( 'Flat', 'su' ),
|
463 |
+
'soft' => __( 'Soft', 'su' ),
|
464 |
+
'glass' => __( 'Glass', 'su' ),
|
465 |
+
'bubbles' => __( 'Bubbles', 'su' ),
|
466 |
+
'noise' => __( 'Noise', 'su' ),
|
467 |
+
'stroked' => __( 'Stroked', 'su' ),
|
468 |
+
'3d' => __( '3D', 'su' )
|
469 |
+
),
|
470 |
+
'default' => 'default',
|
471 |
+
'name' => __( 'Style', 'su' ), 'desc' => __( 'Button background style preset', 'su' )
|
472 |
+
),
|
473 |
+
'background' => array(
|
474 |
+
'type' => 'color',
|
475 |
+
'values' => array( ),
|
476 |
+
'default' => '#2D89EF',
|
477 |
+
'name' => __( 'Background', 'su' ), 'desc' => __( 'Button background color', 'su' )
|
478 |
+
),
|
479 |
+
'color' => array(
|
480 |
+
'type' => 'color',
|
481 |
+
'values' => array( ),
|
482 |
+
'default' => '#FFFFFF',
|
483 |
+
'name' => __( 'Text color', 'su' ),
|
484 |
+
'desc' => __( 'Button text color', 'su' )
|
485 |
+
),
|
486 |
+
'size' => array(
|
487 |
+
'type' => 'select',
|
488 |
+
'values' => array( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ), 'default' => 3,
|
489 |
+
'name' => __( 'Size', 'su' ),
|
490 |
+
'desc' => __( 'Button size', 'su' )
|
491 |
+
),
|
492 |
+
'wide' => array(
|
493 |
+
'type' => 'switch',
|
494 |
+
'default' => 'no',
|
495 |
+
'name' => __( 'Fluid', 'su' ), 'desc' => __( 'Fluid buttons has 100% width', 'su' )
|
496 |
+
),
|
497 |
+
'radius' => array(
|
498 |
+
'type' => 'select',
|
499 |
+
'values' => array( 'auto', 'round', '0', '5', '10', '20' ),
|
500 |
+
'default' => 'auto',
|
501 |
+
'name' => __( 'Radius', 'su' ),
|
502 |
+
'desc' => __( 'Radius of button corners. Auto-radius calculation based on button size', 'su' )
|
503 |
+
),
|
504 |
+
'icon' => array(
|
505 |
+
'type' => 'upload',
|
506 |
+
'default' => '',
|
507 |
+
'name' => __( 'Icon', 'su' ),
|
508 |
+
'desc' => __( 'You can upload custom icon for this button. Try to begin with <a href="http://webdesign.tutsplus.com/freebies/icons-freebies/exclusive-freebie-50-crisp-web-app-icons/" target="_blank">these free high-quality icons</a>. Download archive, unpack icons and upload in this field', 'su' )
|
509 |
+
),
|
510 |
+
'ts_color' => array(
|
511 |
+
'type' => 'select',
|
512 |
+
'values' => array(
|
513 |
+
'light' => __( 'Light', 'su' ),
|
514 |
+
'dark' => __( 'Dark', 'su' )
|
515 |
+
),
|
516 |
+
'default' => 'dark',
|
517 |
+
'name' => __( 'Text shadow color', 'su' ), 'desc' => __( 'Color of button text shadow', 'su' )
|
518 |
+
),
|
519 |
+
'ts_pos' => array(
|
520 |
+
'type' => 'select',
|
521 |
+
'values' => array(
|
522 |
+
'none' => __( 'None', 'su' ),
|
523 |
+
'top' => __( 'Top', 'su' ),
|
524 |
+
'right' => __( 'Right', 'su' ),
|
525 |
+
'bottom' => __( 'Bottom', 'su' ),
|
526 |
+
'left' => __( 'Left', 'su' ),
|
527 |
+
'top-right' => __( 'Top right', 'su' ),
|
528 |
+
'top-left' => __( 'Top left', 'su' ), 'bottom-right' => __( 'Bottom right', 'su' ), 'bottom-left' => __( 'Bottom left', 'su' )
|
529 |
+
),
|
530 |
+
'default' => 'none', 'name' => __( 'Text shadow position', 'su' ), 'desc' => __( 'Position of button text shadow', 'su' )
|
531 |
+
),
|
532 |
+
'desc' => array(
|
533 |
+
'default' => '',
|
534 |
+
'name' => __( 'Description', 'su' ),
|
535 |
+
'desc' => __( 'Small description under button text. This option is incompatible with icon.', 'su' )
|
536 |
+
),
|
537 |
+
'class' => array(
|
538 |
+
'default' => '',
|
539 |
+
'name' => __( 'Class', 'su' ),
|
540 |
+
'desc' => __( 'Extra CSS class', 'su' )
|
541 |
+
)
|
542 |
+
),
|
543 |
+
'usage' => '[button url="#" background="#b00" size="3" style="default"] Button text [/button]', 'content' => __( 'Button text', 'su' ),
|
544 |
+
'desc' => __( 'Styled button', 'su' )
|
545 |
+
),
|
546 |
+
// service
|
547 |
+
'service' => array(
|
548 |
+
'name' => __( 'Service', 'su' ),
|
549 |
+
'type' => 'wrap',
|
550 |
+
'group' => 'box',
|
551 |
+
'atts' => array(
|
552 |
+
'title' => array(
|
553 |
+
'values' => array( ),
|
554 |
+
'default' => __( 'Service title', 'su' ),
|
555 |
+
'name' => __( 'Title', 'su' ),
|
556 |
+
'desc' => __( 'Service name', 'su' )
|
557 |
+
),
|
558 |
+
'icon' => array(
|
559 |
+
'type' => 'upload',
|
560 |
+
'default' => '',
|
561 |
+
'name' => __( 'Icon', 'su' ),
|
562 |
+
'desc' => __( 'You can upload custom icon for this box', 'su' )
|
563 |
+
),
|
564 |
+
'size' => array(
|
565 |
+
'type' => 'select',
|
566 |
+
'values' => array( 16, 24, 32, 48 ),
|
567 |
+
'default' => 32,
|
568 |
+
'name' => __( 'Icon size', 'su' ),
|
569 |
+
'desc' => __( 'Size of the uploaded icon in pixels', 'su' )
|
570 |
+
),
|
571 |
+
'class' => array(
|
572 |
+
'default' => '',
|
573 |
+
'name' => __( 'Class', 'su' ),
|
574 |
+
'desc' => __( 'Extra CSS class', 'su' )
|
575 |
+
)
|
576 |
+
),
|
577 |
+
'usage' => '[service title="Service title" icon="service.png" size="32"] Service description [/service]', 'content' => __( 'Service description', 'su' ), 'desc' => __( 'Service box with title', 'su' )
|
578 |
+
),
|
579 |
+
// box
|
580 |
+
'box' => array(
|
581 |
+
'name' => __( 'Box', 'su' ),
|
582 |
+
'type' => 'wrap',
|
583 |
+
'group' => 'box',
|
584 |
+
'atts' => array(
|
585 |
+
'title' => array(
|
586 |
+
'values' => array( ),
|
587 |
+
'default' => __( 'Box title', 'su' ),
|
588 |
+
'name' => __( 'Title', 'su' ), 'desc' => __( 'Text for the box title', 'su' )
|
589 |
+
),
|
590 |
+
'style' => array(
|
591 |
+
'type' => 'select',
|
592 |
+
'values' => array(
|
593 |
+
'default' => __( 'Default', 'su' ),
|
594 |
+
'soft' => __( 'Soft', 'su' ),
|
595 |
+
'glass' => __( 'Glass', 'su' ),
|
596 |
+
'bubbles' => __( 'Bubbles', 'su' ),
|
597 |
+
'noise' => __( 'Noise', 'su' )
|
598 |
+
),
|
599 |
+
'default' => 'default',
|
600 |
+
'name' => __( 'Style', 'su' ),
|
601 |
+
'desc' => __( 'Box style preset', 'su' )
|
602 |
+
),
|
603 |
+
'box_color' => array(
|
604 |
+
'type' => 'color',
|
605 |
+
'values' => array( ),
|
606 |
+
'default' => '#333333',
|
607 |
+
'name' => __( 'Color', 'su' ),
|
608 |
+
'desc' => __( 'Color for the box title and borders', 'su' )
|
609 |
+
),
|
610 |
+
'title_color' => array(
|
611 |
+
'type' => 'color',
|
612 |
+
'values' => array( ),
|
613 |
+
'default' => '#FFFFFF',
|
614 |
+
'name' => __( 'Title text color', 'su' ), 'desc' => __( 'Color for the box title text', 'su' )
|
615 |
+
),
|
616 |
+
'radius' => array(
|
617 |
+
'type' => 'select',
|
618 |
+
'values' => array( '0', '3', '5', '10', '20' ),
|
619 |
+
'default' => '3',
|
620 |
+
'name' => __( 'Radius', 'su' ),
|
621 |
+
'desc' => __( 'Box corners radius', 'su' )
|
622 |
+
),
|
623 |
+
'class' => array(
|
624 |
+
'default' => '',
|
625 |
+
'name' => __( 'Class', 'su' ),
|
626 |
+
'desc' => __( 'Extra CSS class', 'su' )
|
627 |
+
)
|
628 |
+
),
|
629 |
+
'usage' => '[box title="Box title"] Content [/box]',
|
630 |
+
'content' => __( 'Box content', 'su' ),
|
631 |
+
'desc' => __( 'Colored box with caption', 'su' )
|
632 |
+
),
|
633 |
+
// note
|
634 |
+
'note' => array(
|
635 |
+
'name' => __( 'Note', 'su' ),
|
636 |
+
'type' => 'wrap',
|
637 |
+
'group' => 'box',
|
638 |
+
'atts' => array(
|
639 |
+
'note_color' => array(
|
640 |
+
'type' => 'color',
|
641 |
+
'values' => array( ),
|
642 |
+
'default' => '#FFFF66',
|
643 |
+
'name' => __( 'Background', 'su' ), 'desc' => __( 'Note background color', 'su' )
|
644 |
+
),
|
645 |
+
'text_color' => array(
|
646 |
+
'type' => 'color',
|
647 |
+
'values' => array( ),
|
648 |
+
'default' => '#333333',
|
649 |
+
'name' => __( 'Text color', 'su' ),
|
650 |
+
'desc' => __( 'Note text color', 'su' )
|
651 |
+
),
|
652 |
+
'radius' => array(
|
653 |
+
'type' => 'select',
|
654 |
+
'values' => array( '0', '3', '5', '10', '20' ),
|
655 |
+
'default' => '3',
|
656 |
+
'name' => __( 'Radius', 'su' ), 'desc' => __( 'Note corners radius', 'su' )
|
657 |
+
),
|
658 |
+
'class' => array(
|
659 |
+
'default' => '',
|
660 |
+
'name' => __( 'Class', 'su' ),
|
661 |
+
'desc' => __( 'Extra CSS class', 'su' )
|
662 |
+
)
|
663 |
+
),
|
664 |
+
'usage' => '[note background="#FFCC00"] Content [/note]', 'content' => __( 'Note text', 'su' ),
|
665 |
+
'desc' => __( 'Colored box', 'su' )
|
666 |
+
),
|
667 |
+
// lightbox
|
668 |
+
'lightbox' => array(
|
669 |
+
'name' => __( 'Lightbox', 'su' ),
|
670 |
+
'type' => 'wrap',
|
671 |
+
'group' => 'gallery',
|
672 |
+
'atts' => array(
|
673 |
+
'type' => array(
|
674 |
+
'type' => 'select',
|
675 |
+
'values' => array(
|
676 |
+
'iframe' => __( 'Iframe', 'su' ),
|
677 |
+
'image' => __( 'Image', 'su' ),
|
678 |
+
'inline' => __( 'Inline (html content)', 'su' )
|
679 |
+
),
|
680 |
+
'default' => 'iframe',
|
681 |
+
'name' => __( 'Content type', 'su' ),
|
682 |
+
'desc' => __( 'Select type of the lightbox window content', 'su' )
|
683 |
+
),
|
684 |
+
'src' => array(
|
685 |
+
'default' => 'http://www.youtube.com/watch?v=NbE8INOjTKM',
|
686 |
+
'name' => __( 'Content source', 'su' ),
|
687 |
+
'desc' => __( 'Insert here URL or CSS selector. Use URL for Iframe and Image content types. Use CSS selector for Inline content type.<br />Example values:<br /><b%value>http://www.youtube.com/watch?v=NbE8INOjTKM</b> - YouTube video (iframe)<br /><b%value>http://example.com/wp-content/uploads/image.jpg</b> - uploaded image (image)<br /><b%value>http://example.com/</b> - any web page (iframe)<br /><b%value>#contact-form</b> - any HTML content (inline)', 'su' )
|
688 |
+
),
|
689 |
+
'class' => array(
|
690 |
+
'default' => '',
|
691 |
+
'name' => __( 'Class', 'su' ),
|
692 |
+
'desc' => __( 'Extra CSS class', 'su' )
|
693 |
+
)
|
694 |
+
),
|
695 |
+
'usage' => '[lightbox src="http://example.com/" type="iframe"] Open example.com [/lightbox]',
|
696 |
+
'content' => __( '[button] Click Here to Watch the Video [/button]', 'su' ),
|
697 |
+
'desc' => __( 'Lightbox window with custom content', 'su' )
|
698 |
+
),
|
699 |
+
// private
|
700 |
+
'private' => array(
|
701 |
+
'name' => __( 'Private', 'su' ),
|
702 |
+
'type' => 'wrap',
|
703 |
+
'group' => 'other',
|
704 |
+
'atts' => array(
|
705 |
+
'class' => array(
|
706 |
+
'default' => '',
|
707 |
+
'name' => __( 'Class', 'su' ),
|
708 |
+
'desc' => __( 'Extra CSS class', 'su' )
|
709 |
+
)
|
710 |
+
),
|
711 |
+
'usage' => '[private] Private content [/private]', 'content' => __( 'Private note text', 'su' ), 'desc' => __( 'Private note for post authors', 'su' )
|
712 |
+
),
|
713 |
+
// youtube
|
714 |
+
'youtube' => array(
|
715 |
+
'name' => __( 'YouTube', 'su' ),
|
716 |
+
'type' => 'single',
|
717 |
+
'group' => 'media',
|
718 |
+
'atts' => array(
|
719 |
+
'url' => array(
|
720 |
+
'values' => array( ),
|
721 |
+
'default' => '',
|
722 |
+
'name' => __( 'Url', 'su' ),
|
723 |
+
'desc' => __( 'Url of YouTube page with video. Ex: http://youtube.com/watch?v=XXXXXX', 'su' )
|
724 |
+
),
|
725 |
+
'width' => array(
|
726 |
+
'type' => 'number',
|
727 |
+
'min' => 0,
|
728 |
+
'max' => 10000,
|
729 |
+
'step' => 20,
|
730 |
+
'default' => 600,
|
731 |
+
'name' => __( 'Width', 'su' ),
|
732 |
+
'desc' => __( 'Player width', 'su' )
|
733 |
+
),
|
734 |
+
'height' => array(
|
735 |
+
'type' => 'number',
|
736 |
+
'min' => 0,
|
737 |
+
'max' => 10000,
|
738 |
+
'step' => 20,
|
739 |
+
'default' => 400,
|
740 |
+
'name' => __( 'Height', 'su' ),
|
741 |
+
'desc' => __( 'Player height', 'su' )
|
742 |
+
),
|
743 |
+
'responsive' => array(
|
744 |
+
'type' => 'switch',
|
745 |
+
'default' => 'yes',
|
746 |
+
'name' => __( 'Responsive', 'su' ),
|
747 |
+
'desc' => __( 'Ignore width and height parameters and make player responsive', 'su' )
|
748 |
+
),
|
749 |
+
'autoplay' => array(
|
750 |
+
'type' => 'switch',
|
751 |
+
'default' => 'no',
|
752 |
+
'name' => __( 'Autoplay', 'su' ),
|
753 |
+
'desc' => __( 'Play video automatically when page is loaded', 'su' )
|
754 |
+
),
|
755 |
+
'class' => array(
|
756 |
+
'default' => '',
|
757 |
+
'name' => __( 'Class', 'su' ),
|
758 |
+
'desc' => __( 'Extra CSS class', 'su' )
|
759 |
+
)
|
760 |
+
),
|
761 |
+
'usage' => '[youtube url="http://www.youtube.com/watch?v=NbE8INOjTKM"]', 'desc' => __( 'YouTube video', 'su' )
|
762 |
+
),
|
763 |
+
// vimeo
|
764 |
+
'vimeo' => array(
|
765 |
+
'name' => __( 'Vimeo', 'su' ),
|
766 |
+
'type' => 'single',
|
767 |
+
'group' => 'media',
|
768 |
+
'atts' => array(
|
769 |
+
'url' => array(
|
770 |
+
'values' => array( ),
|
771 |
+
'default' => '',
|
772 |
+
'name' => __( 'Url', 'su' ), 'desc' => __( 'Url of Vimeo page with video', 'su' )
|
773 |
+
),
|
774 |
+
'width' => array(
|
775 |
+
'type' => 'number',
|
776 |
+
'min' => 0,
|
777 |
+
'max' => 10000,
|
778 |
+
'step' => 20,
|
779 |
+
'default' => 600,
|
780 |
+
'name' => __( 'Width', 'su' ),
|
781 |
+
'desc' => __( 'Player width', 'su' )
|
782 |
+
),
|
783 |
+
'height' => array(
|
784 |
+
'type' => 'number',
|
785 |
+
'min' => 0,
|
786 |
+
'max' => 10000,
|
787 |
+
'step' => 20,
|
788 |
+
'default' => 400,
|
789 |
+
'name' => __( 'Height', 'su' ),
|
790 |
+
'desc' => __( 'Player height', 'su' )
|
791 |
+
),
|
792 |
+
'responsive' => array(
|
793 |
+
'type' => 'switch',
|
794 |
+
'default' => 'yes',
|
795 |
+
'name' => __( 'Responsive', 'su' ),
|
796 |
+
'desc' => __( 'Ignore width and height parameters and make player responsive', 'su' )
|
797 |
+
),
|
798 |
+
'autoplay' => array(
|
799 |
+
'type' => 'switch',
|
800 |
+
'default' => 'no',
|
801 |
+
'name' => __( 'Autoplay', 'su' ),
|
802 |
+
'desc' => __( 'Play video automatically when page is loaded', 'su' )
|
803 |
+
),
|
804 |
+
'class' => array(
|
805 |
+
'default' => '',
|
806 |
+
'name' => __( 'Class', 'su' ),
|
807 |
+
'desc' => __( 'Extra CSS class', 'su' )
|
808 |
+
)
|
809 |
+
),
|
810 |
+
'usage' => '[vimeo url="http://vimeo.com/21294655"]', 'desc' => __( 'Vimeo video', 'su' )
|
811 |
+
),
|
812 |
+
// screenr
|
813 |
+
'screenr' => array(
|
814 |
+
'name' => __( 'Screenr', 'su' ),
|
815 |
+
'type' => 'single',
|
816 |
+
'group' => 'media',
|
817 |
+
'atts' => array(
|
818 |
+
'url' => array(
|
819 |
+
'default' => '',
|
820 |
+
'name' => __( 'Url', 'su' ), 'desc' => __( 'Url of Screenr page with video', 'su' )
|
821 |
+
),
|
822 |
+
'width' => array(
|
823 |
+
'type' => 'number',
|
824 |
+
'min' => 0,
|
825 |
+
'max' => 10000,
|
826 |
+
'step' => 20,
|
827 |
+
'default' => 600,
|
828 |
+
'name' => __( 'Width', 'su' ),
|
829 |
+
'desc' => __( 'Player width', 'su' )
|
830 |
+
),
|
831 |
+
'height' => array(
|
832 |
+
'type' => 'number',
|
833 |
+
'min' => 0,
|
834 |
+
'max' => 10000,
|
835 |
+
'step' => 20,
|
836 |
+
'default' => 400,
|
837 |
+
'name' => __( 'Height', 'su' ),
|
838 |
+
'desc' => __( 'Player height', 'su' )
|
839 |
+
),
|
840 |
+
'responsive' => array(
|
841 |
+
'type' => 'switch',
|
842 |
+
'default' => 'yes',
|
843 |
+
'name' => __( 'Responsive', 'su' ),
|
844 |
+
'desc' => __( 'Ignore width and height parameters and make player responsive', 'su' )
|
845 |
+
),
|
846 |
+
'class' => array(
|
847 |
+
'default' => '',
|
848 |
+
'name' => __( 'Class', 'su' ),
|
849 |
+
'desc' => __( 'Extra CSS class', 'su' )
|
850 |
+
)
|
851 |
+
),
|
852 |
+
'usage' => '[screenr url="http://www.screenr.com/OuWH"]', 'desc' => __( 'Screenr video', 'su' )
|
853 |
+
),
|
854 |
+
// audio
|
855 |
+
'audio' => array(
|
856 |
+
'name' => __( 'Audio', 'su' ),
|
857 |
+
'type' => 'single',
|
858 |
+
'group' => 'media',
|
859 |
+
'atts' => array(
|
860 |
+
'url' => array(
|
861 |
+
'type' => 'upload',
|
862 |
+
'default' => '',
|
863 |
+
'name' => __( 'File', 'su' ),
|
864 |
+
'desc' => __( 'Audio file url. Supported formats: mp3, ogg', 'su' )
|
865 |
+
),
|
866 |
+
'width' => array(
|
867 |
+
'values' => array(),
|
868 |
+
'default' => '100%',
|
869 |
+
'name' => __( 'Width', 'su' ),
|
870 |
+
'desc' => __( 'Player width. You can specify width in percents and player will be responsive. Example values: <b%value>200px</b>, <b%value>100%</b>', 'su' )
|
871 |
+
),
|
872 |
+
'autoplay' => array(
|
873 |
+
'type' => 'switch',
|
874 |
+
'default' => 'no',
|
875 |
+
'name' => __( 'Autoplay', 'su' ),
|
876 |
+
'desc' => __( 'Play file automatically when page is loaded', 'su' )
|
877 |
+
),
|
878 |
+
'loop' => array(
|
879 |
+
'type' => 'switch',
|
880 |
+
'default' => 'no',
|
881 |
+
'name' => __( 'Loop', 'su' ),
|
882 |
+
'desc' => __( 'Repeat when playback is ended', 'su' )
|
883 |
+
),
|
884 |
+
'class' => array(
|
885 |
+
'default' => '',
|
886 |
+
'name' => __( 'Class', 'su' ),
|
887 |
+
'desc' => __( 'Extra CSS class', 'su' )
|
888 |
+
)
|
889 |
+
),
|
890 |
+
'usage' => '[audio url="http://example.com/audio.mp3"]',
|
891 |
+
'desc' => __( 'Custom audio player', 'su' )
|
892 |
+
),
|
893 |
+
// video
|
894 |
+
'video' => array(
|
895 |
+
'name' => __( 'Video', 'su' ),
|
896 |
+
'type' => 'single',
|
897 |
+
'group' => 'media',
|
898 |
+
'atts' => array(
|
899 |
+
'url' => array(
|
900 |
+
'type' => 'upload',
|
901 |
+
'default' => '',
|
902 |
+
'name' => __( 'File', 'su' ),
|
903 |
+
'desc' => __( 'Url to mp4/flv video-file', 'su' )
|
904 |
+
),
|
905 |
+
'poster' => array(
|
906 |
+
'type' => 'upload',
|
907 |
+
'default' => '',
|
908 |
+
'name' => __( 'Poster', 'su' ),
|
909 |
+
'desc' => __( 'Url to poster image, that will be shown before playback', 'su' )
|
910 |
+
),
|
911 |
+
'title' => array(
|
912 |
+
'values' => array( ),
|
913 |
+
'default' => '',
|
914 |
+
'name' => __( 'Title', 'su' ),
|
915 |
+
'desc' => __( 'Player title', 'su' )
|
916 |
+
),
|
917 |
+
'width' => array(
|
918 |
+
'type' => 'number',
|
919 |
+
'min' => 0,
|
920 |
+
'max' => 10000,
|
921 |
+
'step' => 20,
|
922 |
+
'default' => 600,
|
923 |
+
'name' => __( 'Width', 'su' ),
|
924 |
+
'desc' => __( 'Player width', 'su' )
|
925 |
+
),
|
926 |
+
'height' => array(
|
927 |
+
'type' => 'number',
|
928 |
+
'min' => 0,
|
929 |
+
'max' => 10000,
|
930 |
+
'step' => 20,
|
931 |
+
'default' => 300,
|
932 |
+
'name' => __( 'Height', 'su' ),
|
933 |
+
'desc' => __( 'Player height', 'su' )
|
934 |
+
),
|
935 |
+
'controls' => array(
|
936 |
+
'type' => 'switch',
|
937 |
+
'default' => 'yes',
|
938 |
+
'name' => __( 'Controls', 'su' ),
|
939 |
+
'desc' => __( 'Show player controls (play/pause etc.) or not', 'su' )
|
940 |
+
),
|
941 |
+
'autoplay' => array(
|
942 |
+
'type' => 'switch',
|
943 |
+
'default' => 'no',
|
944 |
+
'name' => __( 'Autoplay', 'su' ),
|
945 |
+
'desc' => __( 'Play file automatically when page is loaded', 'su' )
|
946 |
+
),
|
947 |
+
'loop' => array(
|
948 |
+
'type' => 'switch',
|
949 |
+
'default' => 'no',
|
950 |
+
'name' => __( 'Loop', 'su' ),
|
951 |
+
'desc' => __( 'Repeat when playback is ended', 'su' )
|
952 |
+
),
|
953 |
+
'class' => array(
|
954 |
+
'default' => '',
|
955 |
+
'name' => __( 'Class', 'su' ),
|
956 |
+
'desc' => __( 'Extra CSS class', 'su' )
|
957 |
+
)
|
958 |
+
),
|
959 |
+
'usage' => '[video url="http://example.com/video.mp4"]',
|
960 |
+
'desc' => __( 'Custom video player', 'su' )
|
961 |
+
),
|
962 |
+
// table
|
963 |
+
'table' => array(
|
964 |
+
'name' => __( 'Table', 'su' ),
|
965 |
+
'type' => 'mixed',
|
966 |
+
'group' => 'content',
|
967 |
+
'atts' => array(
|
968 |
+
'url' => array(
|
969 |
+
'type' => 'upload',
|
970 |
+
'default' => '',
|
971 |
+
'name' => __( 'CSV file', 'su' ),
|
972 |
+
'desc' => __( 'Upload CSV file if you want to create HTML-table from file', 'su' )
|
973 |
+
),
|
974 |
+
'class' => array(
|
975 |
+
'default' => '',
|
976 |
+
'name' => __( 'Class', 'su' ),
|
977 |
+
'desc' => __( 'Extra CSS class', 'su' )
|
978 |
+
)
|
979 |
+
),
|
980 |
+
'usage' => '[table style="default"] <table> ... </table> [/table]<br/>[table style="default" url="http://example.com/file.csv"] [/table]',
|
981 |
+
'content' => __( "<table>\n<tr>\n\t<td>Table</td>\n\t<td>Table</td>\n</tr>\n<tr>\n\t<td>Table</td>\n\t<td>Table</td>\n</tr>\n</table>", 'su' ),
|
982 |
+
'desc' => __( 'Styled table from HTML or CSV file', 'su' )
|
983 |
+
),
|
984 |
+
// permalink
|
985 |
+
'permalink' => array(
|
986 |
+
'name' => __( 'Permalink', 'su' ),
|
987 |
+
'type' => 'mixed',
|
988 |
+
'group' => 'content other',
|
989 |
+
'atts' => array(
|
990 |
+
'id' => array(
|
991 |
+
'values' => array( ), 'default' => 1,
|
992 |
+
'name' => __( 'ID', 'su' ),
|
993 |
+
'desc' => __( 'Post or page ID', 'su' )
|
994 |
+
),
|
995 |
+
'target' => array(
|
996 |
+
'type' => 'select',
|
997 |
+
'values' => array(
|
998 |
+
'self' => __( 'Same tab', 'su' ),
|
999 |
+
'blank' => __( 'New tab', 'su' )
|
1000 |
+
),
|
1001 |
+
'default' => 'self',
|
1002 |
+
'name' => __( 'Target', 'su' ),
|
1003 |
+
'desc' => __( 'Link target. blank - link will be opened in new window/tab', 'su' )
|
1004 |
+
),
|
1005 |
+
'class' => array(
|
1006 |
+
'default' => '',
|
1007 |
+
'name' => __( 'Class', 'su' ),
|
1008 |
+
'desc' => __( 'Extra CSS class', 'su' )
|
1009 |
+
)
|
1010 |
+
),
|
1011 |
+
'usage' => '[permalink id=52]<br/>[permalink id="52" target="blank"] Content [/permalink]',
|
1012 |
+
'content' => '', 'desc' => __( 'Permalink to specified post/page', 'su' )
|
1013 |
+
),
|
1014 |
+
// members
|
1015 |
+
'members' => array(
|
1016 |
+
'name' => __( 'Members', 'su' ),
|
1017 |
+
'type' => 'wrap',
|
1018 |
+
'group' => 'other',
|
1019 |
+
'atts' => array(
|
1020 |
+
'message' => array(
|
1021 |
+
'default' => __( 'This content is for registered users only. Please %login%.', 'su' ),
|
1022 |
+
'name' => __( 'Message', 'su' ), 'desc' => __( 'Message for not logged users', 'su' )
|
1023 |
+
),
|
1024 |
+
'color' => array(
|
1025 |
+
'type' => 'color',
|
1026 |
+
'default' => '#ffcc00',
|
1027 |
+
'name' => __( 'Box color', 'su' ), 'desc' => __( 'This color will applied only to box for not logged users', 'su' )
|
1028 |
+
),
|
1029 |
+
'login_text' => array(
|
1030 |
+
'default' => __( 'login', 'su' ),
|
1031 |
+
'name' => __( 'Login link text', 'su' ), 'desc' => __( 'Text for the login link', 'su' )
|
1032 |
+
),
|
1033 |
+
'login_url' => array(
|
1034 |
+
'default' => wp_login_url( get_permalink( get_the_ID() ) ),
|
1035 |
+
'name' => __( 'Login link url', 'su' ), 'desc' => __( 'Login link url', 'su' )
|
1036 |
+
),
|
1037 |
+
'class' => array(
|
1038 |
+
'default' => '',
|
1039 |
+
'name' => __( 'Class', 'su' ),
|
1040 |
+
'desc' => __( 'Extra CSS class', 'su' )
|
1041 |
+
)
|
1042 |
+
),
|
1043 |
+
'usage' => '[members style="default"] Content for logged members [/members]', 'content' => __( 'Content for logged members', 'su' ),
|
1044 |
+
'desc' => __( 'Content for logged in members only', 'su' )
|
1045 |
+
),
|
1046 |
+
// guests
|
1047 |
+
'guests' => array(
|
1048 |
+
'name' => __( 'Guests', 'su' ),
|
1049 |
+
'type' => 'wrap',
|
1050 |
+
'group' => 'other',
|
1051 |
+
'atts' => array(
|
1052 |
+
'class' => array(
|
1053 |
+
'default' => '',
|
1054 |
+
'name' => __( 'Class', 'su' ),
|
1055 |
+
'desc' => __( 'Extra CSS class', 'su' )
|
1056 |
+
)
|
1057 |
+
),
|
1058 |
+
'usage' => '[guests] Content for guests [/guests]', 'content' => __( 'Content for guests', 'su' ), 'desc' => __( 'Content for guests only', 'su' )
|
1059 |
+
),
|
1060 |
+
// feed
|
1061 |
+
'feed' => array(
|
1062 |
+
'name' => __( 'RSS Feed', 'su' ),
|
1063 |
+
'type' => 'single',
|
1064 |
+
'group' => 'content other',
|
1065 |
+
'atts' => array(
|
1066 |
+
'url' => array(
|
1067 |
+
'values' => array( ),
|
1068 |
+
'default' => '',
|
1069 |
+
'name' => __( 'Url', 'su' ),
|
1070 |
+
'desc' => __( 'Url to RSS-feed', 'su' )
|
1071 |
+
),
|
1072 |
+
'limit' => array(
|
1073 |
+
'type' => 'select',
|
1074 |
+
'values' => array( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ), 'default' => 3,
|
1075 |
+
'name' => __( 'Limit', 'su' ), 'desc' => __( 'Number of items to show', 'su' )
|
1076 |
+
),
|
1077 |
+
'class' => array(
|
1078 |
+
'default' => '',
|
1079 |
+
'name' => __( 'Class', 'su' ),
|
1080 |
+
'desc' => __( 'Extra CSS class', 'su' )
|
1081 |
+
)
|
1082 |
+
),
|
1083 |
+
'usage' => '[feed url="http://rss1.smashingmagazine.com/feed/" limit="5"]', 'desc' => __( 'Feed grabber', 'su' )
|
1084 |
+
),
|
1085 |
+
// menu
|
1086 |
+
'menu' => array(
|
1087 |
+
'name' => __( 'Menu', 'su' ),
|
1088 |
+
'type' => 'single',
|
1089 |
+
'group' => 'other',
|
1090 |
+
'atts' => array(
|
1091 |
+
'name' => array(
|
1092 |
+
'values' => array( ),
|
1093 |
+
'default' => '',
|
1094 |
+
'name' => __( 'Menu name', 'su' ), 'desc' => __( 'Custom menu name. Ex: Main menu', 'su' )
|
1095 |
+
),
|
1096 |
+
'class' => array(
|
1097 |
+
'default' => '',
|
1098 |
+
'name' => __( 'Class', 'su' ),
|
1099 |
+
'desc' => __( 'Extra CSS class', 'su' )
|
1100 |
+
)
|
1101 |
+
),
|
1102 |
+
'usage' => '[menu name="Main menu"]', 'desc' => __( 'Custom menu by name', 'su' )
|
1103 |
+
),
|
1104 |
+
// subpages
|
1105 |
+
'subpages' => array(
|
1106 |
+
'name' => __( 'Sub pages', 'su' ),
|
1107 |
+
'type' => 'single',
|
1108 |
+
'group' => 'other',
|
1109 |
+
'atts' => array(
|
1110 |
+
'depth' => array(
|
1111 |
+
'type' => 'select',
|
1112 |
+
'values' => array( 1, 2, 3, 4, 5 ), 'default' => 1,
|
1113 |
+
'name' => __( 'Depth', 'su' ),
|
1114 |
+
'desc' => __( 'Max depth level of children pages', 'su' )
|
1115 |
+
),
|
1116 |
+
'p' => array(
|
1117 |
+
'values' => array( ),
|
1118 |
+
'default' => '',
|
1119 |
+
'name' => __( 'Parent ID', 'su' ),
|
1120 |
+
'desc' => __( 'ID of the parent page. Leave blank to use current page', 'su' )
|
1121 |
+
),
|
1122 |
+
'class' => array(
|
1123 |
+
'default' => '',
|
1124 |
+
'name' => __( 'Class', 'su' ),
|
1125 |
+
'desc' => __( 'Extra CSS class', 'su' )
|
1126 |
+
)
|
1127 |
+
),
|
1128 |
+
'usage' => '[subpages]<br/>[subpages depth="2" p="122"]', 'desc' => __( 'List of sub pages', 'su' )
|
1129 |
+
),
|
1130 |
+
// siblings
|
1131 |
+
'siblings' => array(
|
1132 |
+
'name' => __( 'Siblings', 'su' ),
|
1133 |
+
'type' => 'single',
|
1134 |
+
'group' => 'other',
|
1135 |
+
'atts' => array(
|
1136 |
+
'depth' => array(
|
1137 |
+
'type' => 'select',
|
1138 |
+
'values' => array( 1, 2, 3 ), 'default' => 1,
|
1139 |
+
'name' => __( 'Depth', 'su' ),
|
1140 |
+
'desc' => __( 'Max depth level', 'su' )
|
1141 |
+
),
|
1142 |
+
'class' => array(
|
1143 |
+
'default' => '',
|
1144 |
+
'name' => __( 'Class', 'su' ),
|
1145 |
+
'desc' => __( 'Extra CSS class', 'su' )
|
1146 |
+
)
|
1147 |
+
),
|
1148 |
+
'usage' => '[siblings]<br/>[siblings depth="2"]', 'desc' => __( 'List of cureent page siblings', 'su' )
|
1149 |
+
),
|
1150 |
+
// document
|
1151 |
+
'document' => array(
|
1152 |
+
'name' => __( 'Document', 'su' ),
|
1153 |
+
'type' => 'single',
|
1154 |
+
'group' => 'media',
|
1155 |
+
'atts' => array(
|
1156 |
+
'url' => array(
|
1157 |
+
'type' => 'upload',
|
1158 |
+
'default' => '',
|
1159 |
+
'name' => __( 'Url', 'su' ),
|
1160 |
+
'desc' => __( 'Url to uploaded document. Supported formats: doc, xls, pdf etc.', 'su' )
|
1161 |
+
),
|
1162 |
+
'width' => array(
|
1163 |
+
'type' => 'number',
|
1164 |
+
'min' => 0,
|
1165 |
+
'max' => 10000,
|
1166 |
+
'step' => 20,
|
1167 |
+
'default' => 600,
|
1168 |
+
'name' => __( 'Width', 'su' ),
|
1169 |
+
'desc' => __( 'Viewer width', 'su' )
|
1170 |
+
),
|
1171 |
+
'height' => array(
|
1172 |
+
'type' => 'number',
|
1173 |
+
'min' => 0,
|
1174 |
+
'max' => 10000,
|
1175 |
+
'step' => 20,
|
1176 |
+
'default' => 600,
|
1177 |
+
'name' => __( 'Height', 'su' ),
|
1178 |
+
'desc' => __( 'Viewer height', 'su' )
|
1179 |
+
),
|
1180 |
+
'responsive' => array(
|
1181 |
+
'type' => 'switch',
|
1182 |
+
'default' => 'yes',
|
1183 |
+
'name' => __( 'Responsive', 'su' ),
|
1184 |
+
'desc' => __( 'Ignore width and height parameters and make viewer responsive', 'su' )
|
1185 |
+
),
|
1186 |
+
'class' => array(
|
1187 |
+
'default' => '',
|
1188 |
+
'name' => __( 'Class', 'su' ),
|
1189 |
+
'desc' => __( 'Extra CSS class', 'su' )
|
1190 |
+
)
|
1191 |
+
),
|
1192 |
+
'usage' => '[document url="file.doc" width="600" height="400"]', 'desc' => __( 'Document viewer by Google', 'su' )
|
1193 |
+
),
|
1194 |
+
// gmap
|
1195 |
+
'gmap' => array(
|
1196 |
+
'name' => __( 'Gmap', 'su' ),
|
1197 |
+
'type' => 'single',
|
1198 |
+
'group' => 'media',
|
1199 |
+
'atts' => array(
|
1200 |
+
'width' => array(
|
1201 |
+
'type' => 'number',
|
1202 |
+
'min' => 0,
|
1203 |
+
'max' => 10000,
|
1204 |
+
'step' => 20,
|
1205 |
+
'default' => 600,
|
1206 |
+
'name' => __( 'Width', 'su' ),
|
1207 |
+
'desc' => __( 'Map width', 'su' )
|
1208 |
+
),
|
1209 |
+
'height' => array(
|
1210 |
+
'type' => 'number',
|
1211 |
+
'min' => 0,
|
1212 |
+
'max' => 10000,
|
1213 |
+
'step' => 20,
|
1214 |
+
'default' => 400,
|
1215 |
+
'name' => __( 'Height', 'su' ),
|
1216 |
+
'desc' => __( 'Map height', 'su' )
|
1217 |
+
),
|
1218 |
+
'responsive' => array(
|
1219 |
+
'type' => 'switch',
|
1220 |
+
'default' => 'yes',
|
1221 |
+
'name' => __( 'Responsive', 'su' ),
|
1222 |
+
'desc' => __( 'Ignore width and height parameters and make map responsive', 'su' )
|
1223 |
+
),
|
1224 |
+
'address' => array(
|
1225 |
+
'values' => array( ),
|
1226 |
+
'default' => '',
|
1227 |
+
'name' => __( 'Marker', 'su' ),
|
1228 |
+
'desc' => __( 'Address for the marker. You can type it in any language', 'su' )
|
1229 |
+
),
|
1230 |
+
'class' => array(
|
1231 |
+
'default' => '',
|
1232 |
+
'name' => __( 'Class', 'su' ),
|
1233 |
+
'desc' => __( 'Extra CSS class', 'su' )
|
1234 |
+
)
|
1235 |
+
),
|
1236 |
+
'usage' => '[gmap width="600" height="400" address="New York"]', 'desc' => __( 'Maps by Google', 'su' )
|
1237 |
+
),
|
1238 |
+
// slider
|
1239 |
+
'slider' => array(
|
1240 |
+
'name' => __( 'Slider', 'su' ),
|
1241 |
+
'type' => 'single',
|
1242 |
+
'group' => 'gallery',
|
1243 |
+
'atts' => array(
|
1244 |
+
'gallery' => array(
|
1245 |
+
'type' => 'gallery',
|
1246 |
+
'name' => __( 'Gallery', 'su' ),
|
1247 |
+
'desc' => __( 'Choose source gallery, that will be used for this slider', 'su' )
|
1248 |
+
),
|
1249 |
+
'width' => array(
|
1250 |
+
'type' => 'number',
|
1251 |
+
'min' => 0,
|
1252 |
+
'max' => 10000,
|
1253 |
+
'step' => 20,
|
1254 |
+
'default' => 600,
|
1255 |
+
'name' => __( 'Width', 'su' ), 'desc' => __( 'Slider width (in pixels)', 'su' )
|
1256 |
+
),
|
1257 |
+
'height' => array(
|
1258 |
+
'type' => 'number',
|
1259 |
+
'min' => 0,
|
1260 |
+
'max' => 10000,
|
1261 |
+
'step' => 20,
|
1262 |
+
'default' => 300,
|
1263 |
+
'name' => __( 'Height', 'su' ), 'desc' => __( 'Slider height (in pixels)', 'su' )
|
1264 |
+
),
|
1265 |
+
'responsive' => array(
|
1266 |
+
'type' => 'switch',
|
1267 |
+
'default' => 'yes',
|
1268 |
+
'name' => __( 'Responsive', 'su' ),
|
1269 |
+
'desc' => __( 'Ignore width and height parameters and make slider responsive', 'su' )
|
1270 |
+
),
|
1271 |
+
'title' => array(
|
1272 |
+
'type' => 'switch',
|
1273 |
+
'default' => 'yes',
|
1274 |
+
'name' => __( 'Show titles', 'su' ), 'desc' => __( 'Display slide titles', 'su' )
|
1275 |
+
),
|
1276 |
+
'centered' => array(
|
1277 |
+
'type' => 'switch',
|
1278 |
+
'default' => 'yes',
|
1279 |
+
'name' => __( 'Center', 'su' ), 'desc' => __( 'Is slider centered on the page', 'su' )
|
1280 |
+
),
|
1281 |
+
'arrows' => array(
|
1282 |
+
'type' => 'switch',
|
1283 |
+
'default' => 'yes',
|
1284 |
+
'name' => __( 'Arrows', 'su' ), 'desc' => __( 'Show left and right arrows', 'su' )
|
1285 |
+
),
|
1286 |
+
'pages' => array(
|
1287 |
+
'type' => 'switch',
|
1288 |
+
'default' => 'yes',
|
1289 |
+
'name' => __( 'Pagination', 'su' ),
|
1290 |
+
'desc' => __( 'Show pagination', 'su' )
|
1291 |
+
),
|
1292 |
+
'mousewheel' => array(
|
1293 |
+
'type' => 'switch',
|
1294 |
+
'default' => 'yes', 'name' => __( 'Mouse wheel control', 'su' ),
|
1295 |
+
'desc' => __( 'Allow to change slides with mouse wheel', 'su' )
|
1296 |
+
),
|
1297 |
+
'autoplay' => array(
|
1298 |
+
'type' => 'number',
|
1299 |
+
'min' => 0,
|
1300 |
+
'max' => 100000,
|
1301 |
+
'step' => 100,
|
1302 |
+
'default' => 5000,
|
1303 |
+
'name' => __( 'Autoplay', 'su' ),
|
1304 |
+
'desc' => __( 'Choose interval between slide animations. Set to 0 to disable autoplay', 'su' )
|
1305 |
+
),
|
1306 |
+
'speed' => array(
|
1307 |
+
'type' => 'number',
|
1308 |
+
'min' => 0,
|
1309 |
+
'max' => 20000,
|
1310 |
+
'step' => 100,
|
1311 |
+
'default' => 600,
|
1312 |
+
'name' => __( 'Speed', 'su' ), 'desc' => __( 'Specify animation speed', 'su' )
|
1313 |
+
),
|
1314 |
+
'target' => array(
|
1315 |
+
'type' => 'switch',
|
1316 |
+
'default' => 'yes',
|
1317 |
+
'name' => __( 'Links target', 'su' ),
|
1318 |
+
'desc' => __( 'Open slides links in new window/tab', 'su' )
|
1319 |
+
),
|
1320 |
+
'class' => array(
|
1321 |
+
'default' => '',
|
1322 |
+
'name' => __( 'Class', 'su' ),
|
1323 |
+
'desc' => __( 'Extra CSS class', 'su' )
|
1324 |
+
)
|
1325 |
+
),
|
1326 |
+
'usage' => '[slider gallery="1"]', 'desc' => __( 'Customizable image slider', 'su' )
|
1327 |
+
),
|
1328 |
+
// carousel
|
1329 |
+
'carousel' => array(
|
1330 |
+
'name' => __( 'Carousel', 'su' ),
|
1331 |
+
'type' => 'single',
|
1332 |
+
'group' => 'gallery',
|
1333 |
+
'atts' => array(
|
1334 |
+
'gallery' => array(
|
1335 |
+
'type' => 'gallery',
|
1336 |
+
'name' => __( 'Gallery', 'su' ),
|
1337 |
+
'desc' => __( 'Choose source gallery, that will be used for this carousel', 'su' )
|
1338 |
+
),
|
1339 |
+
'width' => array(
|
1340 |
+
'type' => 'number',
|
1341 |
+
'min' => 0,
|
1342 |
+
'max' => 10000,
|
1343 |
+
'step' => 20,
|
1344 |
+
'default' => 600,
|
1345 |
+
'name' => __( 'Width', 'su' ), 'desc' => __( 'Carousel width (in pixels)', 'su' )
|
1346 |
+
),
|
1347 |
+
'height' => array(
|
1348 |
+
'type' => 'number',
|
1349 |
+
'min' => 0,
|
1350 |
+
'max' => 10000,
|
1351 |
+
'step' => 20,
|
1352 |
+
'default' => 100,
|
1353 |
+
'name' => __( 'Height', 'su' ), 'desc' => __( 'Carousel height (in pixels)', 'su' )
|
1354 |
+
),
|
1355 |
+
'responsive' => array(
|
1356 |
+
'type' => 'switch',
|
1357 |
+
'default' => 'yes',
|
1358 |
+
'name' => __( 'Responsive', 'su' ),
|
1359 |
+
'desc' => __( 'Ignore width and height parameters and make carousel responsive', 'su' )
|
1360 |
+
),
|
1361 |
+
'items' => array(
|
1362 |
+
'type' => 'number',
|
1363 |
+
'min' => 1,
|
1364 |
+
'max' => 20,
|
1365 |
+
'step' => 1, 'default' => 3,
|
1366 |
+
'name' => __( 'Items to show', 'su' ),
|
1367 |
+
'desc' => __( 'How much carousel items is visible', 'su' )
|
1368 |
+
),
|
1369 |
+
'scroll' => array(
|
1370 |
+
'type' => 'number',
|
1371 |
+
'min' => 1,
|
1372 |
+
'max' => 20,
|
1373 |
+
'step' => 1, 'default' => 1,
|
1374 |
+
'name' => __( 'Scroll number', 'su' ),
|
1375 |
+
'desc' => __( 'How much items are scrolled in one transition', 'su' )
|
1376 |
+
),
|
1377 |
+
'title' => array(
|
1378 |
+
'type' => 'switch',
|
1379 |
+
'default' => 'yes',
|
1380 |
+
'name' => __( 'Show titles', 'su' ), 'desc' => __( 'Display titles for each item', 'su' )
|
1381 |
+
),
|
1382 |
+
'centered' => array(
|
1383 |
+
'type' => 'switch',
|
1384 |
+
'default' => 'yes',
|
1385 |
+
'name' => __( 'Center', 'su' ), 'desc' => __( 'Is carousel centered on the page', 'su' )
|
1386 |
+
),
|
1387 |
+
'arrows' => array(
|
1388 |
+
'type' => 'switch',
|
1389 |
+
'default' => 'yes',
|
1390 |
+
'name' => __( 'Arrows', 'su' ), 'desc' => __( 'Show left and right arrows', 'su' )
|
1391 |
+
),
|
1392 |
+
'pages' => array(
|
1393 |
+
'type' => 'switch',
|
1394 |
+
'default' => 'no',
|
1395 |
+
'name' => __( 'Pagination', 'su' ),
|
1396 |
+
'desc' => __( 'Show pagination', 'su' )
|
1397 |
+
),
|
1398 |
+
'mousewheel' => array(
|
1399 |
+
'type' => 'switch',
|
1400 |
+
'default' => 'yes', 'name' => __( 'Mouse wheel control', 'su' ),
|
1401 |
+
'desc' => __( 'Allow to rotate carousel with mouse wheel', 'su' )
|
1402 |
+
),
|
1403 |
+
'autoplay' => array(
|
1404 |
+
'type' => 'number',
|
1405 |
+
'min' => 0,
|
1406 |
+
'max' => 100000,
|
1407 |
+
'step' => 100,
|
1408 |
+
'default' => 5000,
|
1409 |
+
'name' => __( 'Autoplay', 'su' ),
|
1410 |
+
'desc' => __( 'Choose interval between auto animations. Set to 0 to disable autoplay', 'su' )
|
1411 |
+
),
|
1412 |
+
'speed' => array(
|
1413 |
+
'type' => 'number',
|
1414 |
+
'min' => 0,
|
1415 |
+
'max' => 20000,
|
1416 |
+
'step' => 100,
|
1417 |
+
'default' => 600,
|
1418 |
+
'name' => __( 'Speed', 'su' ), 'desc' => __( 'Specify animation speed', 'su' )
|
1419 |
+
),
|
1420 |
+
'target' => array(
|
1421 |
+
'type' => 'switch',
|
1422 |
+
'default' => 'yes',
|
1423 |
+
'name' => __( 'Links target', 'su' ),
|
1424 |
+
'desc' => __( 'Open carousel links in new window/tab', 'su' )
|
1425 |
+
),
|
1426 |
+
'class' => array(
|
1427 |
+
'default' => '',
|
1428 |
+
'name' => __( 'Class', 'su' ),
|
1429 |
+
'desc' => __( 'Extra CSS class', 'su' )
|
1430 |
+
)
|
1431 |
+
),
|
1432 |
+
'usage' => '[carousel gallery="1"]', 'desc' => __( 'Customizable image carousel', 'su' )
|
1433 |
+
),
|
1434 |
+
// custom_gallery
|
1435 |
+
'custom_gallery' => array(
|
1436 |
+
'name' => __( 'Gallery', 'su' ),
|
1437 |
+
'type' => 'single',
|
1438 |
+
'group' => 'gallery',
|
1439 |
+
'atts' => array(
|
1440 |
+
'gallery' => array(
|
1441 |
+
'type' => 'gallery',
|
1442 |
+
'name' => __( 'Gallery', 'su' ),
|
1443 |
+
'desc' => __( 'Choose source gallery, that will be used for this shortcode', 'su' )
|
1444 |
+
),
|
1445 |
+
'width' => array(
|
1446 |
+
'type' => 'number',
|
1447 |
+
'min' => 20,
|
1448 |
+
'max' => 2000,
|
1449 |
+
'step' => 20,
|
1450 |
+
'default' => 90,
|
1451 |
+
'name' => __( 'Width', 'su' ), 'desc' => __( 'Single item width (in pixels)', 'su' )
|
1452 |
+
),
|
1453 |
+
'height' => array(
|
1454 |
+
'type' => 'number',
|
1455 |
+
'min' => 20,
|
1456 |
+
'max' => 2000,
|
1457 |
+
'step' => 20,
|
1458 |
+
'default' => 90,
|
1459 |
+
'name' => __( 'Height', 'su' ), 'desc' => __( 'Single item height (in pixels)', 'su' )
|
1460 |
+
),
|
1461 |
+
'title' => array(
|
1462 |
+
'type' => 'select',
|
1463 |
+
'values' => array(
|
1464 |
+
'never' => __( 'Never', 'su' ),
|
1465 |
+
'hover' => __( 'On mouse over', 'su' ),
|
1466 |
+
'always' => __( 'Always', 'su' )
|
1467 |
+
),
|
1468 |
+
'default' => 'hover',
|
1469 |
+
'name' => __( 'Show titles', 'su' ),
|
1470 |
+
'desc' => __( 'Title display mode', 'su' )
|
1471 |
+
),
|
1472 |
+
'target' => array(
|
1473 |
+
'type' => 'switch',
|
1474 |
+
'default' => 'yes',
|
1475 |
+
'name' => __( 'Links target', 'su' ), 'desc' => __( 'Open links in new window/tab', 'su' )
|
1476 |
+
),
|
1477 |
+
'class' => array(
|
1478 |
+
'default' => '',
|
1479 |
+
'name' => __( 'Class', 'su' ),
|
1480 |
+
'desc' => __( 'Extra CSS class', 'su' )
|
1481 |
+
)
|
1482 |
+
),
|
1483 |
+
'usage' => '[custom_gallery gallery="1"]', 'desc' => __( 'Customizable image gallery', 'su' )
|
1484 |
+
),
|
1485 |
+
// posts
|
1486 |
+
'posts' => array(
|
1487 |
+
'name' => __( 'Posts', 'su' ),
|
1488 |
+
'type' => 'single',
|
1489 |
+
'group' => 'other',
|
1490 |
+
'atts' => array(
|
1491 |
+
'template' => array(
|
1492 |
+
'default' => 'templates/default-loop.php', 'name' => __( 'Template', 'su' ),
|
1493 |
+
'desc' => __( '<b>Do not change this field value if you do not understand description below.</b><br/>Relative path to the template file. Default templates is placed under the plugin directory (templates folder). You can copy it under your theme directory and modify as you want. You can use following default templates that already available in the plugin directory:<br/><b%value>templates/default-loop.php</b> - posts loop<br/><b%value>templates/teaser-loop.php</b> - posts loop with thumbnail and title<br/><b%value>templates/single-post.php</b> - single post template<br/><b%value>templates/list-loop.php</b> - unordered list with posts titles', 'su' )
|
1494 |
+
),
|
1495 |
+
'id' => array(
|
1496 |
+
'default' => '',
|
1497 |
+
'name' => __( 'Post ID\'s', 'su' ),
|
1498 |
+
'desc' => __( 'Enter comma separated ID\'s of the posts that you want to show', 'su' )
|
1499 |
+
),
|
1500 |
+
'posts_per_page' => array(
|
1501 |
+
'type' => 'number',
|
1502 |
+
'min' => -1,
|
1503 |
+
'max' => 10000,
|
1504 |
+
'step' => 1,
|
1505 |
+
'default' => get_option( 'posts_per_page' ),
|
1506 |
+
'name' => __( 'Posts per page', 'su' ),
|
1507 |
+
'desc' => __( 'Specify number of posts that you want to show. Enter -1 to get all posts', 'su' )
|
1508 |
+
),
|
1509 |
+
'post_type' => array(
|
1510 |
+
'type' => 'select',
|
1511 |
+
'multiple' => true,
|
1512 |
+
'values' => su_get_post_types(),
|
1513 |
+
'default' => 'default',
|
1514 |
+
'name' => __( 'Post types', 'su' ),
|
1515 |
+
'desc' => __( 'Select post types. Hold Ctrl key to select multiple post types', 'su' )
|
1516 |
+
),
|
1517 |
+
'taxonomy' => array(
|
1518 |
+
'type' => 'select',
|
1519 |
+
'values' => su_get_taxonomies(),
|
1520 |
+
'default' => '',
|
1521 |
+
'name' => __( 'Taxonomy', 'su' ),
|
1522 |
+
'desc' => __( 'Select taxonomy to show posts from', 'su' )
|
1523 |
+
),
|
1524 |
+
'tax_term' => array(
|
1525 |
+
'type' => 'select',
|
1526 |
+
'multiple' => true,
|
1527 |
+
'values' => su_get_terms( su_get_taxonomies( true ) ),
|
1528 |
+
'default' => '',
|
1529 |
+
'name' => __( 'Terms', 'su' ), 'desc' => __( 'Select terms to show posts from', 'su' )
|
1530 |
+
),
|
1531 |
+
'tax_operator' => array(
|
1532 |
+
'type' => 'select',
|
1533 |
+
'values' => array( 'IN', 'NOT IN', 'AND' ),
|
1534 |
+
'default' => 'IN', 'name' => __( 'Taxonomy term operator', 'su' ),
|
1535 |
+
'desc' => __( 'IN - posts that have any of selected categories terms<br/>NOT IN - posts that is does not have any of selected terms<br/>AND - posts that have all selected terms', 'su' )
|
1536 |
+
),
|
1537 |
+
'author' => array(
|
1538 |
+
'type' => 'select',
|
1539 |
+
'multiple' => true,
|
1540 |
+
'values' => su_get_users(),
|
1541 |
+
'default' => 'default',
|
1542 |
+
'name' => __( 'Authors', 'su' ),
|
1543 |
+
'desc' => __( 'Choose the authors whose posts you want to show', 'su' )
|
1544 |
+
),
|
1545 |
+
'meta_key' => array(
|
1546 |
+
'default' => '',
|
1547 |
+
'name' => __( 'Meta key', 'su' ),
|
1548 |
+
'desc' => __( 'Enter meta key name to show posts that have this key', 'su' )
|
1549 |
+
),
|
1550 |
+
'offset' => array(
|
1551 |
+
'type' => 'number',
|
1552 |
+
'min' => 0,
|
1553 |
+
'max' => 10000,
|
1554 |
+
'step' => 1, 'default' => 0,
|
1555 |
+
'name' => __( 'Offset', 'su' ),
|
1556 |
+
'desc' => __( 'Specify offset to start posts loop not from first post', 'su' )
|
1557 |
+
),
|
1558 |
+
'order' => array(
|
1559 |
+
'type' => 'select',
|
1560 |
+
'values' => array(
|
1561 |
+
'desc' => __( 'Descending', 'su' ),
|
1562 |
+
'asc' => __( 'Ascending', 'su' )
|
1563 |
+
),
|
1564 |
+
'default' => 'DESC',
|
1565 |
+
'name' => __( 'Order', 'su' ),
|
1566 |
+
'desc' => __( 'Posts order', 'su' )
|
1567 |
+
),
|
1568 |
+
'orderby' => array(
|
1569 |
+
'type' => 'select',
|
1570 |
+
'values' => array(
|
1571 |
+
'none' => __( 'None', 'su' ),
|
1572 |
+
'id' => __( 'Post ID', 'su' ),
|
1573 |
+
'author' => __( 'Post author', 'su' ),
|
1574 |
+
'title' => __( 'Post title', 'su' ),
|
1575 |
+
'name' => __( 'Post slug', 'su' ),
|
1576 |
+
'date' => __( 'Date', 'su' ), 'modified' => __( 'Last modified date', 'su' ),
|
1577 |
+
'parent' => __( 'Post parent', 'su' ),
|
1578 |
+
'rand' => __( 'Random', 'su' ), 'comment_count' => __( 'Comments number', 'su' ),
|
1579 |
+
'menu_order' => __( 'Menu order', 'su' ), 'meta_value' => __( 'Meta key values', 'su' ),
|
1580 |
+
),
|
1581 |
+
'default' => 'date',
|
1582 |
+
'name' => __( 'Order by', 'su' ),
|
1583 |
+
'desc' => __( 'Order posts by', 'su' )
|
1584 |
+
),
|
1585 |
+
'post_parent' => array(
|
1586 |
+
'default' => '',
|
1587 |
+
'name' => __( 'Post parent', 'su' ),
|
1588 |
+
'desc' => __( 'Show childrens of entered post (enter post ID)', 'su' )
|
1589 |
+
),
|
1590 |
+
'post_status' => array(
|
1591 |
+
'type' => 'select',
|
1592 |
+
'values' => array(
|
1593 |
+
'publish' => __( 'Published', 'su' ),
|
1594 |
+
'pending' => __( 'Pending', 'su' ),
|
1595 |
+
'draft' => __( 'Draft', 'su' ),
|
1596 |
+
'auto-draft' => __( 'Auto-draft', 'su' ),
|
1597 |
+
'future' => __( 'Future post', 'su' ),
|
1598 |
+
'private' => __( 'Private post', 'su' ),
|
1599 |
+
'inherit' => __( 'Inherit', 'su' ),
|
1600 |
+
'trash' => __( 'Trashed', 'su' ),
|
1601 |
+
'any' => __( 'Any', 'su' ),
|
1602 |
+
),
|
1603 |
+
'default' => 'publish',
|
1604 |
+
'name' => __( 'Post status', 'su' ),
|
1605 |
+
'desc' => __( 'Show only posts with selected status', 'su' )
|
1606 |
+
),
|
1607 |
+
'ignore_sticky_posts' => array(
|
1608 |
+
'type' => 'switch',
|
1609 |
+
'default' => 'no',
|
1610 |
+
'name' => __( 'Ignore sticky', 'su' ),
|
1611 |
+
'desc' => __( 'Select Yes to ignore posts that is sticked', 'su' )
|
1612 |
+
)
|
1613 |
+
),
|
1614 |
+
'usage' => '[posts template="templates/posts.php"]',
|
1615 |
+
'desc' => __( 'Custom posts query with customizable template', 'su' )
|
1616 |
+
)
|
1617 |
+
) );
|
1618 |
+
// Return result
|
1619 |
+
return ( is_string( $shortcode ) ) ? $shortcodes[sanitize_text_field( $shortcode )] : $shortcodes;
|
1620 |
+
}
|
1621 |
+
}
|
1622 |
+
|
1623 |
+
new Shortcodes_Ultimate_Data;
|
inc/core/class.generator.php
CHANGED
@@ -1,302 +1,302 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Class for managing shortcodes generator
|
5 |
-
*/
|
6 |
-
class Shortcodes_Ultimate_Generator {
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Constructor
|
10 |
-
*/
|
11 |
-
function __construct() {
|
12 |
-
add_action( 'media_buttons', array( __CLASS__, 'button' ), 100 );
|
13 |
-
add_action( 'su/activation', array( __CLASS__, 'reset' ) );
|
14 |
-
add_action( 'sunrise_page_before', array( __CLASS__, 'reset' ) );
|
15 |
-
add_action( 'wp_ajax_su_generator_settings', array( __CLASS__, 'settings' ) );
|
16 |
-
add_action( 'wp_ajax_su_generator_preview', array( __CLASS__, 'preview' ) );
|
17 |
-
add_action( 'wp_ajax_su_generator_get_terms', array( __CLASS__, 'get_terms' ) );
|
18 |
-
add_action( 'wp_ajax_su_generator_upload', array( __CLASS__, 'upload' ) );
|
19 |
-
add_action( 'wp_ajax_su_generator_galleries', array( __CLASS__, 'galleries' ) );
|
20 |
-
}
|
21 |
-
|
22 |
-
/**
|
23 |
-
* Generator button
|
24 |
-
*
|
25 |
-
* @param string $target
|
26 |
-
* @param unknown
|
27 |
-
* @param string $class
|
28 |
-
* @param bool $icon
|
29 |
-
* @param bool $echo
|
30 |
-
*
|
31 |
-
* @return string
|
32 |
-
*/
|
33 |
-
public static function button( $args = array() ) {
|
34 |
-
$shult = shortcodes_ultimate();
|
35 |
-
// Prepare args
|
36 |
-
$args = wp_parse_args( $args, array(
|
37 |
-
'target' => 'content',
|
38 |
-
'text' => __( 'Insert shortcode', 'su' ),
|
39 |
-
'class' => 'button',
|
40 |
-
'icon' => $shult->assets( 'images/generator', 'icon.png' ),
|
41 |
-
'echo' => true,
|
42 |
-
'shortcode' => false
|
43 |
-
) );
|
44 |
-
// Prepare icon
|
45 |
-
$args['icon'] = ( $args['icon'] ) ? '<img src="' . $args['icon'] . '" /> ' : '';
|
46 |
-
// Print button
|
47 |
-
$button = '<a href="javascript:void(0);" class="su-generator-button ' . $args['class'] . '" title="' . $args['text'] . '" data-target="' . $args['target'] . '" data-mfp-src="#su-generator" data-shortcode="' . (string) $args['shortcode'] . '">' . $args['icon'] . $args['text'] . '</a>';
|
48 |
-
// Show generator popup
|
49 |
-
add_action( 'wp_footer', array( __CLASS__, 'popup' ) );
|
50 |
-
add_action( 'admin_footer', array( __CLASS__, 'popup' ) );
|
51 |
-
// Request assets
|
52 |
-
su_query_asset( 'css', array( 'farbtastic', 'magnific-popup', 'su-generator' ) );
|
53 |
-
su_query_asset( 'js', array( 'jquery', 'jquery-ui-widget', 'iframe-transport', 'fileupload', 'farbtastic', 'qtip', 'magnific-popup', 'su-generator' ) );
|
54 |
-
// Print/return result
|
55 |
-
if ( $args['echo'] ) echo $button;
|
56 |
-
else return $button;
|
57 |
-
}
|
58 |
-
|
59 |
-
/**
|
60 |
-
* Delete cache on plugin activation
|
61 |
-
*/
|
62 |
-
public static function reset() {
|
63 |
-
// Clear popup cache
|
64 |
-
delete_transient( 'su/generator/popup' );
|
65 |
-
// Clear shortcodes settings cache
|
66 |
-
foreach ( (array) Shortcodes_Ultimate_Data::shortcodes() as $name => $data )
|
67 |
-
delete_transient( 'su/generator/settings/' . $name );
|
68 |
-
}
|
69 |
-
|
70 |
-
/**
|
71 |
-
* Generator popup form
|
72 |
-
*/
|
73 |
-
public static function popup() {
|
74 |
-
// Get cache
|
75 |
-
$output = get_transient( 'su/generator/popup' );
|
76 |
-
if ( $output ) echo $output;
|
77 |
-
// Cache not found
|
78 |
-
else {
|
79 |
-
ob_start();
|
80 |
-
$shult = shortcodes_ultimate();
|
81 |
-
$tools = apply_filters( 'su/generator/tools', array(
|
82 |
-
'<a href="' . $shult->admin_url . '#tab-1" target="_blank" title="' . __( 'Settings', 'su' ) . '">' . __( 'Plugin settings', 'su' ) . '</a>',
|
83 |
-
'<a href="http://gndev.info/shortcodes-ultimate/" target="_blank" title="' . __( 'Plugin homepage', 'su' ) . '">' . __( 'Plugin homepage', 'su' ) . '</a>',
|
84 |
-
'<a href="http://wordpress.org/support/plugin/shortcodes-ultimate/" target="_blank" title="' . __( 'Support forums', 'su' ) . '">' . __( 'Support forums', 'su' ) . '</a>'
|
85 |
-
) );
|
86 |
-
?>
|
87 |
-
<div id="su-generator-wrap" style="display:none">
|
88 |
-
<div id="su-generator">
|
89 |
-
<div id="su-generator-header">
|
90 |
-
<div id="su-generator-tools"><?php echo implode( ' <span></span> ', $tools ); ?></div>
|
91 |
-
<input type="text" name="su_generator_search" id="su-generator-search" value="" placeholder="<?php _e( 'Search for shortcodes', 'su' ); ?>" />
|
92 |
-
<div id="su-generator-filter">
|
93 |
-
<strong><?php _e( 'Filter by type', 'su' ); ?></strong>
|
94 |
-
<?php foreach ( (array) Shortcodes_Ultimate_Data::groups() as $group => $label ) echo '<a href="#" data-filter="' . $group . '">' . $label . '</a>'; ?>
|
95 |
-
</div>
|
96 |
-
<div id="su-generator-choices">
|
97 |
-
<?php
|
98 |
-
// Choices loop
|
99 |
-
foreach ( (array) Shortcodes_Ultimate_Data::shortcodes() as $name => $shortcode ) {
|
100 |
-
$icon = ( isset( $shortcode['icon'] ) ) ? $shortcode['icon'] : $shult->assets( 'images/icons', $name ) . '.png';
|
101 |
-
echo '<span data-shortcode="' . $name . '" title="' . esc_attr( $shortcode['desc'] ) . '" data-desc="' . esc_attr( $shortcode['desc'] ) . '" data-group="' . $shortcode['group'] . '"><img src="' . $icon . '" alt="" width="32" height="32" /><strong>' . $shortcode['name'] . '</strong></span>' . "\n";
|
102 |
-
}
|
103 |
-
?>
|
104 |
-
</div>
|
105 |
-
</div>
|
106 |
-
<div id="su-generator-settings"></div>
|
107 |
-
<input type="hidden" name="su-generator-selected" id="su-generator-selected" value="<?php echo $shult->url; ?>" />
|
108 |
-
<input type="hidden" name="su-generator-url" id="su-generator-url" value="<?php echo $shult->url; ?>" />
|
109 |
-
<input type="hidden" name="su-compatibility-mode-prefix" id="su-compatibility-mode-prefix" value="<?php echo su_compatibility_mode_prefix(); ?>" />
|
110 |
-
<div id="su-generator-result" style="display:none"></div>
|
111 |
-
</div>
|
112 |
-
</div>
|
113 |
-
<?php
|
114 |
-
$output = ob_get_contents();
|
115 |
-
set_transient( 'su/generator/popup', $output, 60*60*24*30 );
|
116 |
-
ob_end_clean();
|
117 |
-
echo $output;
|
118 |
-
}
|
119 |
-
}
|
120 |
-
|
121 |
-
/**
|
122 |
-
* Process AJAX request
|
123 |
-
*/
|
124 |
-
public static function settings() {
|
125 |
-
$shult = shortcodes_ultimate();
|
126 |
-
// Capability check
|
127 |
-
if ( !current_user_can( 'edit_posts' ) ) wp_die( __( 'Access denied', 'su' ) );
|
128 |
-
// Param check
|
129 |
-
if ( empty( $_REQUEST['shortcode'] ) ) wp_die( __( 'Shortcode not specified', 'su' ) );
|
130 |
-
// Get cache
|
131 |
-
$output = get_transient( 'su/generator/settings/' . sanitize_text_field( $_REQUEST['shortcode'] ) );
|
132 |
-
if ( $output ) echo $output;
|
133 |
-
// Cache not found
|
134 |
-
else {
|
135 |
-
// Request queried shortcode
|
136 |
-
$shortcode = Shortcodes_Ultimate_Data::shortcodes( $_REQUEST['shortcode'] );
|
137 |
-
// Prepare skip-if-default option
|
138 |
-
$skip = ( $shult->get_option( 'skip' ) === 'on' ) ? ' su-generator-skip' : '';
|
139 |
-
// Prepare actions
|
140 |
-
$actions = apply_filters( 'su/generator/actions', array(
|
141 |
-
'insert' => '<a href="#" class="button button-primary button-large" id="su-generator-insert">' . __( 'Insert shortcode', 'su' ) . '</a>',
|
142 |
-
'preview' => '<a href="#" class="button button-large" id="su-generator-preview-link">' . __( 'Live preview', 'su' ) . '</a>',
|
143 |
-
'close' => '<a href="#" class="button alignright button-large su-generator-cancel">' . __( 'Close window', 'su' ) . '</a>'
|
144 |
-
) );
|
145 |
-
// Shortcode header
|
146 |
-
$return = '<div id="su-generator-breadcrumbs">';
|
147 |
-
$return .= apply_filters( 'su/generator/breadcrumbs', '<a href="#" id="su-generator-select-another" title="' . __( 'Click to return to the shortcodes list', 'su' ) . '">' . __( 'All shortcodes', 'su' ) . '</a> → <span>' . $shortcode['name'] . '</span> <small>' . $shortcode['desc'] . '</small>' );
|
148 |
-
$return .= '</div>';
|
149 |
-
// Shortcode has atts
|
150 |
-
if ( count( $shortcode['atts'] ) && $shortcode['atts'] ) {
|
151 |
-
// Loop through shortcode parameters
|
152 |
-
foreach ( $shortcode['atts'] as $attr_name => $attr_info ) {
|
153 |
-
// Prepare default value
|
154 |
-
$default = (string) ( isset( $attr_info['default'] ) ) ? $attr_info['default'] : '';
|
155 |
-
$return .= '<div class="su-generator-attr-container' . $skip . '" data-default="' . esc_attr( $default ) . '">';
|
156 |
-
$return .= '<h5>' . $attr_info['name'] . '</h5>';
|
157 |
-
// Create field types
|
158 |
-
if ( !isset( $attr_info['type'] ) ) $attr_info['type'] = 'text';
|
159 |
-
switch ( $attr_info['type'] ) {
|
160 |
-
// Select
|
161 |
-
case 'select':
|
162 |
-
// Detect array type (numbers or strings with translations)
|
163 |
-
$is_numbers = is_numeric( implode( '', array_keys( $attr_info['values'] ) ) ) ? true : false;
|
164 |
-
// Multiple selects
|
165 |
-
$multiple = ( isset( $attr_info['multiple'] ) ) ? ' multiple' : '';
|
166 |
-
$return .= '<select name="' . $attr_name . '" id="su-generator-attr-' . $attr_name . '" class="su-generator-attr"' . $multiple . '>';
|
167 |
-
// Create options
|
168 |
-
foreach ( $attr_info['values'] as $option_value => $option_title ) {
|
169 |
-
// Values is indexed array, replace array keys by titles
|
170 |
-
if ( $is_numbers ) $option_value = $option_title;
|
171 |
-
// Is this option selected
|
172 |
-
$selected = ( $attr_info['default'] == $option_value ) ? ' selected="selected"' : '';
|
173 |
-
// Create option
|
174 |
-
$return .= '<option value="' . $option_value . '"' . $selected . '>' . $option_title . '</option>';
|
175 |
-
}
|
176 |
-
$return .= '</select>';
|
177 |
-
break;
|
178 |
-
// Switch
|
179 |
-
case 'switch':
|
180 |
-
$return .= '<span class="su-generator-switch su-generator-switch-' . $attr_info['default'] . '"><span class="su-generator-yes">' . __( 'Yes', 'su' ) . '</span><span class="su-generator-no">' . __( 'No', 'su' ) . '</span></span><input type="hidden" name="' . $attr_name . '" value="' . esc_attr( $attr_info['default'] ) . '" id="su-generator-attr-' . $attr_name . '" class="su-generator-attr" />';
|
181 |
-
break;
|
182 |
-
// Upload
|
183 |
-
case 'upload':
|
184 |
-
$return .= '<div class="su-generator-upload-field-wrap"><span class="su-generator-upload-field"><input type="text" name="' . $attr_name . '" value="' . esc_attr( $attr_info['default'] ) . '" id="su-generator-attr-' . $attr_name . '" class="su-generator-attr" /></span><span class="su-generator-upload-button"><a href="#" class="button">…</a><input type="file" name="su_generator_file_upload" /></span></div><small class="description">' . __( 'Max upload file size', 'su' ) . ': ' . floor( wp_max_upload_size() / 1024 / 1024 ) . __( 'Mb', 'su' ) . '. <a href="http://www.wpbeginner.com/wp-tutorials/how-to-increase-the-maximum-file-upload-size-in-wordpress/" target="_blank">' . __( 'How to increase', 'su' ) . '</a>.</small>';
|
185 |
-
break;
|
186 |
-
// Color
|
187 |
-
case 'color':
|
188 |
-
$return .= '<span class="su-generator-select-color"><span class="su-generator-select-color-wheel"></span><input type="text" name="' . $attr_name . '" value="' . $attr_info['default'] . '" id="su-generator-attr-' . $attr_name . '" class="su-generator-attr su-generator-select-color-value" /></span>';
|
189 |
-
break;
|
190 |
-
// Gallery
|
191 |
-
case 'gallery':
|
192 |
-
// Prepare galleries list
|
193 |
-
$galleries = $shult->get_option( 'galleries' );
|
194 |
-
$created = ( is_array( $galleries ) && count( $galleries ) ) ? true : false;
|
195 |
-
$return .= '<select name="' . $attr_name . '" id="su-generator-attr-' . $attr_name . '" class="su-generator-attr" data-loading="' . __( 'Please wait', 'su' ) . '">';
|
196 |
-
// Check that galleries is set
|
197 |
-
if ( $created ) // Create options
|
198 |
-
foreach ( $galleries as $g_id => $gallery ) {
|
199 |
-
// Is this option selected
|
200 |
-
$selected = ( $g_id == 0 ) ? ' selected="selected"' : '';
|
201 |
-
// Prepare title
|
202 |
-
$gallery['name'] = ( $gallery['name'] == '' ) ? __( 'Untitled gallery', 'su' ) : stripslashes( $gallery['name'] );
|
203 |
-
// Create option
|
204 |
-
$return .= '<option value="' . ( $g_id + 1 ) . '"' . $selected . '>' . $gallery['name'] . '</option>';
|
205 |
-
}
|
206 |
-
// Galleries not created
|
207 |
-
else
|
208 |
-
$return .= '<option value="0" selected>' . __( 'Galleries not found', 'su' ) . '</option>';
|
209 |
-
$return .= '</select><small class="description"><a href="' . $shult->admin_url . '#tab-3" target="_blank">' . __( 'Manage galleries', 'su' ) . '</a> <a href="javascript:;" class="su-generator-reload-galleries">' . __( 'Reload galleries', 'su' ) . '</a></small>';
|
210 |
-
break;
|
211 |
-
// Number
|
212 |
-
case 'number':
|
213 |
-
$return .= '<input type="number" name="' . $attr_name . '" value="' . esc_attr( $attr_info['default'] ) . '" id="su-generator-attr-' . $attr_name . '" min="' . $attr_info['min'] . '" max="' . $attr_info['max'] . '" step="' . $attr_info['step'] . '" class="su-generator-attr" />';
|
214 |
-
break;
|
215 |
-
// Text and other types
|
216 |
-
default:
|
217 |
-
$return .= '<input type="text" name="' . $attr_name . '" value="' . esc_attr( $attr_info['default'] ) . '" id="su-generator-attr-' . $attr_name . '" class="su-generator-attr" />';
|
218 |
-
break;
|
219 |
-
}
|
220 |
-
if ( isset( $attr_info['desc'] ) ) $return .= '<div class="su-generator-attr-desc">' . str_replace( '<b%value>', '<b class="su-generator-set-value" title="' . __( 'Click to set this value', 'su' ) . '">', $attr_info['desc'] ) . '</div>';
|
221 |
-
$return .= '</div>';
|
222 |
-
}
|
223 |
-
}
|
224 |
-
// Single shortcode (not closed)
|
225 |
-
if ( $shortcode['type'] == 'single' ) $return .= '<input type="hidden" name="su-generator-content" id="su-generator-content" value="false" />';
|
226 |
-
// Wrapping shortcode
|
227 |
-
else $return .= '<div class="su-generator-attr-container"><h5>' . __( 'Content', 'su' ) . '</h5><textarea name="su-generator-content" id="su-generator-content" rows="3">' . esc_attr( $shortcode['content'] ) . '</textarea></div>';
|
228 |
-
$return .= '<div id="su-generator-preview"></div>';
|
229 |
-
$return .= '<div class="su-generator-actions">' . implode( ' ', array_values( $actions ) ) . '</div>';
|
230 |
-
set_transient( 'su/generator/settings/' . sanitize_text_field( $_REQUEST['shortcode'] ), $return, 60*60*24*30 );
|
231 |
-
echo $return;
|
232 |
-
}
|
233 |
-
exit;
|
234 |
-
}
|
235 |
-
|
236 |
-
/**
|
237 |
-
* Process AJAX request and generate preview HTML
|
238 |
-
*/
|
239 |
-
public static function preview() {
|
240 |
-
// Check authentication
|
241 |
-
if ( !current_user_can( 'edit_posts' ) ) die( __( 'Access denied', 'su' ) );
|
242 |
-
// Output results
|
243 |
-
do_action( 'su/generator/preview/before' );
|
244 |
-
echo '<h5>' . __( 'Preview', 'su' ) . '</h5>';
|
245 |
-
echo do_shortcode( str_replace( '\"', '"', $_POST['shortcode'] ) );
|
246 |
-
echo '<div class="su-spacer"></div>';
|
247 |
-
do_action( 'su/generator/preview/after' );
|
248 |
-
die();
|
249 |
-
}
|
250 |
-
|
251 |
-
/**
|
252 |
-
* Process AJAX request and generate json-encoded array with terms
|
253 |
-
*/
|
254 |
-
public static function get_terms() {
|
255 |
-
// Check authentication
|
256 |
-
if ( !current_user_can( 'edit_posts' ) ) die( __( 'Access denied', 'su' ) );
|
257 |
-
die( json_encode( su_get_terms( sanitize_text_field( $_POST['taxonomy'] ) ) ) );
|
258 |
-
}
|
259 |
-
|
260 |
-
/**
|
261 |
-
* Function to handle uploads
|
262 |
-
*/
|
263 |
-
public static function upload() {
|
264 |
-
// Check capability
|
265 |
-
if ( !current_user_can( 'edit_posts' ) ) die( __( 'Access denied', 'su' ) );
|
266 |
-
// Create mew upload instance
|
267 |
-
$upload = new MediaUpload;
|
268 |
-
// Save file
|
269 |
-
$file = $upload->saveUpload( $field_name = 'file' );
|
270 |
-
// Print result
|
271 |
-
die( wp_get_attachment_url( $file['attachment_id'] ) );
|
272 |
-
}
|
273 |
-
|
274 |
-
/**
|
275 |
-
* Print json-encoded list of galleries
|
276 |
-
*/
|
277 |
-
public static function galleries() {
|
278 |
-
$shult = shortcodes_ultimate();
|
279 |
-
// Check user
|
280 |
-
if ( !is_user_logged_in() ) return;
|
281 |
-
// Prepare galleries list
|
282 |
-
$galleries = $shult->get_option( 'galleries' );
|
283 |
-
$options = array();
|
284 |
-
// Check that galleries is set
|
285 |
-
if ( is_array( $galleries ) && count( $galleries ) )
|
286 |
-
foreach ( $galleries as $id => $gallery ) {
|
287 |
-
// Is this option selected
|
288 |
-
$selected = ( $id == 0 ) ? ' selected' : '';
|
289 |
-
// Prepare title
|
290 |
-
$gallery['name'] = ( $gallery['name'] == '' ) ? __( 'Untitled gallery', 'su' ) : stripslashes( $gallery['name'] );
|
291 |
-
// Create option
|
292 |
-
$options[] = '<option value="' . ( $id + 1 ) . '"' . $selected . '>' . $gallery['name'] . '</option>';
|
293 |
-
}
|
294 |
-
// Galleries not created
|
295 |
-
else
|
296 |
-
$options[] = '<option value="0" selected>' . __( 'Galleries not found', 'su' ) . '</option>';
|
297 |
-
// Print result
|
298 |
-
die( implode( '', $options ) );
|
299 |
-
}
|
300 |
-
}
|
301 |
-
|
302 |
-
new Shortcodes_Ultimate_Generator;
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class for managing shortcodes generator
|
5 |
+
*/
|
6 |
+
class Shortcodes_Ultimate_Generator {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Constructor
|
10 |
+
*/
|
11 |
+
function __construct() {
|
12 |
+
add_action( 'media_buttons', array( __CLASS__, 'button' ), 100 );
|
13 |
+
add_action( 'su/activation', array( __CLASS__, 'reset' ) );
|
14 |
+
add_action( 'sunrise_page_before', array( __CLASS__, 'reset' ) );
|
15 |
+
add_action( 'wp_ajax_su_generator_settings', array( __CLASS__, 'settings' ) );
|
16 |
+
add_action( 'wp_ajax_su_generator_preview', array( __CLASS__, 'preview' ) );
|
17 |
+
add_action( 'wp_ajax_su_generator_get_terms', array( __CLASS__, 'get_terms' ) );
|
18 |
+
add_action( 'wp_ajax_su_generator_upload', array( __CLASS__, 'upload' ) );
|
19 |
+
add_action( 'wp_ajax_su_generator_galleries', array( __CLASS__, 'galleries' ) );
|
20 |
+
}
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Generator button
|
24 |
+
*
|
25 |
+
* @param string $target
|
26 |
+
* @param unknown
|
27 |
+
* @param string $class
|
28 |
+
* @param bool $icon
|
29 |
+
* @param bool $echo
|
30 |
+
*
|
31 |
+
* @return string
|
32 |
+
*/
|
33 |
+
public static function button( $args = array() ) {
|
34 |
+
$shult = shortcodes_ultimate();
|
35 |
+
// Prepare args
|
36 |
+
$args = wp_parse_args( $args, array(
|
37 |
+
'target' => 'content',
|
38 |
+
'text' => __( 'Insert shortcode', 'su' ),
|
39 |
+
'class' => 'button',
|
40 |
+
'icon' => $shult->assets( 'images/generator', 'icon.png' ),
|
41 |
+
'echo' => true,
|
42 |
+
'shortcode' => false
|
43 |
+
) );
|
44 |
+
// Prepare icon
|
45 |
+
$args['icon'] = ( $args['icon'] ) ? '<img src="' . $args['icon'] . '" /> ' : '';
|
46 |
+
// Print button
|
47 |
+
$button = '<a href="javascript:void(0);" class="su-generator-button ' . $args['class'] . '" title="' . $args['text'] . '" data-target="' . $args['target'] . '" data-mfp-src="#su-generator" data-shortcode="' . (string) $args['shortcode'] . '">' . $args['icon'] . $args['text'] . '</a>';
|
48 |
+
// Show generator popup
|
49 |
+
add_action( 'wp_footer', array( __CLASS__, 'popup' ) );
|
50 |
+
add_action( 'admin_footer', array( __CLASS__, 'popup' ) );
|
51 |
+
// Request assets
|
52 |
+
su_query_asset( 'css', array( 'farbtastic', 'magnific-popup', 'su-generator' ) );
|
53 |
+
su_query_asset( 'js', array( 'jquery', 'jquery-ui-widget', 'iframe-transport', 'fileupload', 'farbtastic', 'qtip', 'magnific-popup', 'su-generator' ) );
|
54 |
+
// Print/return result
|
55 |
+
if ( $args['echo'] ) echo $button;
|
56 |
+
else return $button;
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Delete cache on plugin activation
|
61 |
+
*/
|
62 |
+
public static function reset() {
|
63 |
+
// Clear popup cache
|
64 |
+
delete_transient( 'su/generator/popup' );
|
65 |
+
// Clear shortcodes settings cache
|
66 |
+
foreach ( (array) Shortcodes_Ultimate_Data::shortcodes() as $name => $data )
|
67 |
+
delete_transient( 'su/generator/settings/' . $name );
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Generator popup form
|
72 |
+
*/
|
73 |
+
public static function popup() {
|
74 |
+
// Get cache
|
75 |
+
$output = get_transient( 'su/generator/popup' );
|
76 |
+
if ( $output ) echo $output;
|
77 |
+
// Cache not found
|
78 |
+
else {
|
79 |
+
ob_start();
|
80 |
+
$shult = shortcodes_ultimate();
|
81 |
+
$tools = apply_filters( 'su/generator/tools', array(
|
82 |
+
'<a href="' . $shult->admin_url . '#tab-1" target="_blank" title="' . __( 'Settings', 'su' ) . '">' . __( 'Plugin settings', 'su' ) . '</a>',
|
83 |
+
'<a href="http://gndev.info/shortcodes-ultimate/" target="_blank" title="' . __( 'Plugin homepage', 'su' ) . '">' . __( 'Plugin homepage', 'su' ) . '</a>',
|
84 |
+
'<a href="http://wordpress.org/support/plugin/shortcodes-ultimate/" target="_blank" title="' . __( 'Support forums', 'su' ) . '">' . __( 'Support forums', 'su' ) . '</a>'
|
85 |
+
) );
|
86 |
+
?>
|
87 |
+
<div id="su-generator-wrap" style="display:none">
|
88 |
+
<div id="su-generator">
|
89 |
+
<div id="su-generator-header">
|
90 |
+
<div id="su-generator-tools"><?php echo implode( ' <span></span> ', $tools ); ?></div>
|
91 |
+
<input type="text" name="su_generator_search" id="su-generator-search" value="" placeholder="<?php _e( 'Search for shortcodes', 'su' ); ?>" />
|
92 |
+
<div id="su-generator-filter">
|
93 |
+
<strong><?php _e( 'Filter by type', 'su' ); ?></strong>
|
94 |
+
<?php foreach ( (array) Shortcodes_Ultimate_Data::groups() as $group => $label ) echo '<a href="#" data-filter="' . $group . '">' . $label . '</a>'; ?>
|
95 |
+
</div>
|
96 |
+
<div id="su-generator-choices">
|
97 |
+
<?php
|
98 |
+
// Choices loop
|
99 |
+
foreach ( (array) Shortcodes_Ultimate_Data::shortcodes() as $name => $shortcode ) {
|
100 |
+
$icon = ( isset( $shortcode['icon'] ) ) ? $shortcode['icon'] : $shult->assets( 'images/icons', $name ) . '.png';
|
101 |
+
echo '<span data-shortcode="' . $name . '" title="' . esc_attr( $shortcode['desc'] ) . '" data-desc="' . esc_attr( $shortcode['desc'] ) . '" data-group="' . $shortcode['group'] . '"><img src="' . $icon . '" alt="" width="32" height="32" /><strong>' . $shortcode['name'] . '</strong></span>' . "\n";
|
102 |
+
}
|
103 |
+
?>
|
104 |
+
</div>
|
105 |
+
</div>
|
106 |
+
<div id="su-generator-settings"></div>
|
107 |
+
<input type="hidden" name="su-generator-selected" id="su-generator-selected" value="<?php echo $shult->url; ?>" />
|
108 |
+
<input type="hidden" name="su-generator-url" id="su-generator-url" value="<?php echo $shult->url; ?>" />
|
109 |
+
<input type="hidden" name="su-compatibility-mode-prefix" id="su-compatibility-mode-prefix" value="<?php echo su_compatibility_mode_prefix(); ?>" />
|
110 |
+
<div id="su-generator-result" style="display:none"></div>
|
111 |
+
</div>
|
112 |
+
</div>
|
113 |
+
<?php
|
114 |
+
$output = ob_get_contents();
|
115 |
+
set_transient( 'su/generator/popup', $output, 60*60*24*30 );
|
116 |
+
ob_end_clean();
|
117 |
+
echo $output;
|
118 |
+
}
|
119 |
+
}
|
120 |
+
|
121 |
+
/**
|
122 |
+
* Process AJAX request
|
123 |
+
*/
|
124 |
+
public static function settings() {
|
125 |
+
$shult = shortcodes_ultimate();
|
126 |
+
// Capability check
|
127 |
+
if ( !current_user_can( 'edit_posts' ) ) wp_die( __( 'Access denied', 'su' ) );
|
128 |
+
// Param check
|
129 |
+
if ( empty( $_REQUEST['shortcode'] ) ) wp_die( __( 'Shortcode not specified', 'su' ) );
|
130 |
+
// Get cache
|
131 |
+
$output = get_transient( 'su/generator/settings/' . sanitize_text_field( $_REQUEST['shortcode'] ) );
|
132 |
+
if ( $output ) echo $output;
|
133 |
+
// Cache not found
|
134 |
+
else {
|
135 |
+
// Request queried shortcode
|
136 |
+
$shortcode = Shortcodes_Ultimate_Data::shortcodes( $_REQUEST['shortcode'] );
|
137 |
+
// Prepare skip-if-default option
|
138 |
+
$skip = ( $shult->get_option( 'skip' ) === 'on' ) ? ' su-generator-skip' : '';
|
139 |
+
// Prepare actions
|
140 |
+
$actions = apply_filters( 'su/generator/actions', array(
|
141 |
+
'insert' => '<a href="#" class="button button-primary button-large" id="su-generator-insert">' . __( 'Insert shortcode', 'su' ) . '</a>',
|
142 |
+
'preview' => '<a href="#" class="button button-large" id="su-generator-preview-link">' . __( 'Live preview', 'su' ) . '</a>',
|
143 |
+
'close' => '<a href="#" class="button alignright button-large su-generator-cancel">' . __( 'Close window', 'su' ) . '</a>'
|
144 |
+
) );
|
145 |
+
// Shortcode header
|
146 |
+
$return = '<div id="su-generator-breadcrumbs">';
|
147 |
+
$return .= apply_filters( 'su/generator/breadcrumbs', '<a href="#" id="su-generator-select-another" title="' . __( 'Click to return to the shortcodes list', 'su' ) . '">' . __( 'All shortcodes', 'su' ) . '</a> → <span>' . $shortcode['name'] . '</span> <small>' . $shortcode['desc'] . '</small>' );
|
148 |
+
$return .= '</div>';
|
149 |
+
// Shortcode has atts
|
150 |
+
if ( count( $shortcode['atts'] ) && $shortcode['atts'] ) {
|
151 |
+
// Loop through shortcode parameters
|
152 |
+
foreach ( $shortcode['atts'] as $attr_name => $attr_info ) {
|
153 |
+
// Prepare default value
|
154 |
+
$default = (string) ( isset( $attr_info['default'] ) ) ? $attr_info['default'] : '';
|
155 |
+
$return .= '<div class="su-generator-attr-container' . $skip . '" data-default="' . esc_attr( $default ) . '">';
|
156 |
+
$return .= '<h5>' . $attr_info['name'] . '</h5>';
|
157 |
+
// Create field types
|
158 |
+
if ( !isset( $attr_info['type'] ) ) $attr_info['type'] = 'text';
|
159 |
+
switch ( $attr_info['type'] ) {
|
160 |
+
// Select
|
161 |
+
case 'select':
|
162 |
+
// Detect array type (numbers or strings with translations)
|
163 |
+
$is_numbers = is_numeric( implode( '', array_keys( $attr_info['values'] ) ) ) ? true : false;
|
164 |
+
// Multiple selects
|
165 |
+
$multiple = ( isset( $attr_info['multiple'] ) ) ? ' multiple' : '';
|
166 |
+
$return .= '<select name="' . $attr_name . '" id="su-generator-attr-' . $attr_name . '" class="su-generator-attr"' . $multiple . '>';
|
167 |
+
// Create options
|
168 |
+
foreach ( $attr_info['values'] as $option_value => $option_title ) {
|
169 |
+
// Values is indexed array, replace array keys by titles
|
170 |
+
if ( $is_numbers ) $option_value = $option_title;
|
171 |
+
// Is this option selected
|
172 |
+
$selected = ( $attr_info['default'] == $option_value ) ? ' selected="selected"' : '';
|
173 |
+
// Create option
|
174 |
+
$return .= '<option value="' . $option_value . '"' . $selected . '>' . $option_title . '</option>';
|
175 |
+
}
|
176 |
+
$return .= '</select>';
|
177 |
+
break;
|
178 |
+
// Switch
|
179 |
+
case 'switch':
|
180 |
+
$return .= '<span class="su-generator-switch su-generator-switch-' . $attr_info['default'] . '"><span class="su-generator-yes">' . __( 'Yes', 'su' ) . '</span><span class="su-generator-no">' . __( 'No', 'su' ) . '</span></span><input type="hidden" name="' . $attr_name . '" value="' . esc_attr( $attr_info['default'] ) . '" id="su-generator-attr-' . $attr_name . '" class="su-generator-attr" />';
|
181 |
+
break;
|
182 |
+
// Upload
|
183 |
+
case 'upload':
|
184 |
+
$return .= '<div class="su-generator-upload-field-wrap"><span class="su-generator-upload-field"><input type="text" name="' . $attr_name . '" value="' . esc_attr( $attr_info['default'] ) . '" id="su-generator-attr-' . $attr_name . '" class="su-generator-attr" /></span><span class="su-generator-upload-button"><a href="#" class="button">…</a><input type="file" name="su_generator_file_upload" /></span></div><small class="description">' . __( 'Max upload file size', 'su' ) . ': ' . floor( wp_max_upload_size() / 1024 / 1024 ) . __( 'Mb', 'su' ) . '. <a href="http://www.wpbeginner.com/wp-tutorials/how-to-increase-the-maximum-file-upload-size-in-wordpress/" target="_blank">' . __( 'How to increase', 'su' ) . '</a>.</small>';
|
185 |
+
break;
|
186 |
+
// Color
|
187 |
+
case 'color':
|
188 |
+
$return .= '<span class="su-generator-select-color"><span class="su-generator-select-color-wheel"></span><input type="text" name="' . $attr_name . '" value="' . $attr_info['default'] . '" id="su-generator-attr-' . $attr_name . '" class="su-generator-attr su-generator-select-color-value" /></span>';
|
189 |
+
break;
|
190 |
+
// Gallery
|
191 |
+
case 'gallery':
|
192 |
+
// Prepare galleries list
|
193 |
+
$galleries = $shult->get_option( 'galleries' );
|
194 |
+
$created = ( is_array( $galleries ) && count( $galleries ) ) ? true : false;
|
195 |
+
$return .= '<select name="' . $attr_name . '" id="su-generator-attr-' . $attr_name . '" class="su-generator-attr" data-loading="' . __( 'Please wait', 'su' ) . '">';
|
196 |
+
// Check that galleries is set
|
197 |
+
if ( $created ) // Create options
|
198 |
+
foreach ( $galleries as $g_id => $gallery ) {
|
199 |
+
// Is this option selected
|
200 |
+
$selected = ( $g_id == 0 ) ? ' selected="selected"' : '';
|
201 |
+
// Prepare title
|
202 |
+
$gallery['name'] = ( $gallery['name'] == '' ) ? __( 'Untitled gallery', 'su' ) : stripslashes( $gallery['name'] );
|
203 |
+
// Create option
|
204 |
+
$return .= '<option value="' . ( $g_id + 1 ) . '"' . $selected . '>' . $gallery['name'] . '</option>';
|
205 |
+
}
|
206 |
+
// Galleries not created
|
207 |
+
else
|
208 |
+
$return .= '<option value="0" selected>' . __( 'Galleries not found', 'su' ) . '</option>';
|
209 |
+
$return .= '</select><small class="description"><a href="' . $shult->admin_url . '#tab-3" target="_blank">' . __( 'Manage galleries', 'su' ) . '</a> <a href="javascript:;" class="su-generator-reload-galleries">' . __( 'Reload galleries', 'su' ) . '</a></small>';
|
210 |
+
break;
|
211 |
+
// Number
|
212 |
+
case 'number':
|
213 |
+
$return .= '<input type="number" name="' . $attr_name . '" value="' . esc_attr( $attr_info['default'] ) . '" id="su-generator-attr-' . $attr_name . '" min="' . $attr_info['min'] . '" max="' . $attr_info['max'] . '" step="' . $attr_info['step'] . '" class="su-generator-attr" />';
|
214 |
+
break;
|
215 |
+
// Text and other types
|
216 |
+
default:
|
217 |
+
$return .= '<input type="text" name="' . $attr_name . '" value="' . esc_attr( $attr_info['default'] ) . '" id="su-generator-attr-' . $attr_name . '" class="su-generator-attr" />';
|
218 |
+
break;
|
219 |
+
}
|
220 |
+
if ( isset( $attr_info['desc'] ) ) $return .= '<div class="su-generator-attr-desc">' . str_replace( '<b%value>', '<b class="su-generator-set-value" title="' . __( 'Click to set this value', 'su' ) . '">', $attr_info['desc'] ) . '</div>';
|
221 |
+
$return .= '</div>';
|
222 |
+
}
|
223 |
+
}
|
224 |
+
// Single shortcode (not closed)
|
225 |
+
if ( $shortcode['type'] == 'single' ) $return .= '<input type="hidden" name="su-generator-content" id="su-generator-content" value="false" />';
|
226 |
+
// Wrapping shortcode
|
227 |
+
else $return .= '<div class="su-generator-attr-container"><h5>' . __( 'Content', 'su' ) . '</h5><textarea name="su-generator-content" id="su-generator-content" rows="3">' . esc_attr( $shortcode['content'] ) . '</textarea></div>';
|
228 |
+
$return .= '<div id="su-generator-preview"></div>';
|
229 |
+
$return .= '<div class="su-generator-actions">' . implode( ' ', array_values( $actions ) ) . '</div>';
|
230 |
+
set_transient( 'su/generator/settings/' . sanitize_text_field( $_REQUEST['shortcode'] ), $return, 60*60*24*30 );
|
231 |
+
echo $return;
|
232 |
+
}
|
233 |
+
exit;
|
234 |
+
}
|
235 |
+
|
236 |
+
/**
|
237 |
+
* Process AJAX request and generate preview HTML
|
238 |
+
*/
|
239 |
+
public static function preview() {
|
240 |
+
// Check authentication
|
241 |
+
if ( !current_user_can( 'edit_posts' ) ) die( __( 'Access denied', 'su' ) );
|
242 |
+
// Output results
|
243 |
+
do_action( 'su/generator/preview/before' );
|
244 |
+
echo '<h5>' . __( 'Preview', 'su' ) . '</h5>';
|
245 |
+
echo do_shortcode( str_replace( '\"', '"', $_POST['shortcode'] ) );
|
246 |
+
echo '<div class="su-spacer"></div>';
|
247 |
+
do_action( 'su/generator/preview/after' );
|
248 |
+
die();
|
249 |
+
}
|
250 |
+
|
251 |
+
/**
|
252 |
+
* Process AJAX request and generate json-encoded array with terms
|
253 |
+
*/
|
254 |
+
public static function get_terms() {
|
255 |
+
// Check authentication
|
256 |
+
if ( !current_user_can( 'edit_posts' ) ) die( __( 'Access denied', 'su' ) );
|
257 |
+
die( json_encode( su_get_terms( sanitize_text_field( $_POST['taxonomy'] ) ) ) );
|
258 |
+
}
|
259 |
+
|
260 |
+
/**
|
261 |
+
* Function to handle uploads
|
262 |
+
*/
|
263 |
+
public static function upload() {
|
264 |
+
// Check capability
|
265 |
+
if ( !current_user_can( 'edit_posts' ) ) die( __( 'Access denied', 'su' ) );
|
266 |
+
// Create mew upload instance
|
267 |
+
$upload = new MediaUpload;
|
268 |
+
// Save file
|
269 |
+
$file = $upload->saveUpload( $field_name = 'file' );
|
270 |
+
// Print result
|
271 |
+
die( wp_get_attachment_url( $file['attachment_id'] ) );
|
272 |
+
}
|
273 |
+
|
274 |
+
/**
|
275 |
+
* Print json-encoded list of galleries
|
276 |
+
*/
|
277 |
+
public static function galleries() {
|
278 |
+
$shult = shortcodes_ultimate();
|
279 |
+
// Check user
|
280 |
+
if ( !is_user_logged_in() ) return;
|
281 |
+
// Prepare galleries list
|
282 |
+
$galleries = $shult->get_option( 'galleries' );
|
283 |
+
$options = array();
|
284 |
+
// Check that galleries is set
|
285 |
+
if ( is_array( $galleries ) && count( $galleries ) )
|
286 |
+
foreach ( $galleries as $id => $gallery ) {
|
287 |
+
// Is this option selected
|
288 |
+
$selected = ( $id == 0 ) ? ' selected' : '';
|
289 |
+
// Prepare title
|
290 |
+
$gallery['name'] = ( $gallery['name'] == '' ) ? __( 'Untitled gallery', 'su' ) : stripslashes( $gallery['name'] );
|
291 |
+
// Create option
|
292 |
+
$options[] = '<option value="' . ( $id + 1 ) . '"' . $selected . '>' . $gallery['name'] . '</option>';
|
293 |
+
}
|
294 |
+
// Galleries not created
|
295 |
+
else
|
296 |
+
$options[] = '<option value="0" selected>' . __( 'Galleries not found', 'su' ) . '</option>';
|
297 |
+
// Print result
|
298 |
+
die( implode( '', $options ) );
|
299 |
+
}
|
300 |
+
}
|
301 |
+
|
302 |
+
new Shortcodes_Ultimate_Generator;
|
inc/core/class.shortcodes-ultimate.php
CHANGED
@@ -1,190 +1,190 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Shortcodes_Ultimate {
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Constructor
|
7 |
-
*/
|
8 |
-
function __construct() {
|
9 |
-
add_action( 'plugins_loaded', array( __CLASS__, 'init' ) );
|
10 |
-
register_activation_hook( SU_PLUGIN_FILE, array( __CLASS__, 'activation' ) );
|
11 |
-
register_activation_hook( SU_PLUGIN_FILE, array( __CLASS__, 'deactivation' ) );
|
12 |
-
}
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Plugin init
|
16 |
-
*/
|
17 |
-
public static function init() {
|
18 |
-
// Prepare variable for global plugin helper instance
|
19 |
-
global $shult;
|
20 |
-
// Create plugin helper instance
|
21 |
-
$shult = new Sunrise_Plugin_Framework_2( SU_PLUGIN_FILE );
|
22 |
-
// Register settings page
|
23 |
-
$shult->add_options_page( array( 'link' => false ), self::options() );
|
24 |
-
// Translate plugin meta
|
25 |
-
__( 'Shortcodes Ultimate', 'su' );
|
26 |
-
__( 'Vladimir Anokhin', 'su' );
|
27 |
-
__( 'Supercharge your WordPress theme with mega pack of shortcodes', 'su' );
|
28 |
-
// Add plugin actions links
|
29 |
-
add_filter( 'plugin_action_links_' . $shult->basename, array( __CLASS__, 'actions_links' ), -10 );
|
30 |
-
// Add plugin meta links
|
31 |
-
add_filter( 'plugin_row_meta', array( __CLASS__, 'meta_links' ), 10, 2 );
|
32 |
-
// Shortcodes Ultimate is ready
|
33 |
-
do_action( 'su/init' );
|
34 |
-
}
|
35 |
-
|
36 |
-
/**
|
37 |
-
* Plugin activation
|
38 |
-
*/
|
39 |
-
public static function activation() {
|
40 |
-
self::timestamp();
|
41 |
-
self::check_requirements();
|
42 |
-
self::create_skins_dir();
|
43 |
-
do_action( 'su/activation' );
|
44 |
-
}
|
45 |
-
|
46 |
-
/**
|
47 |
-
* Plugin deactivation
|
48 |
-
*/
|
49 |
-
public static function deactivation() {
|
50 |
-
do_action( 'su/deactivation' );
|
51 |
-
}
|
52 |
-
|
53 |
-
/**
|
54 |
-
* Add timestamp
|
55 |
-
*/
|
56 |
-
public static function timestamp() {
|
57 |
-
if ( !get_option( 'su_installed' ) ) update_option( 'su_installed', time() );
|
58 |
-
}
|
59 |
-
|
60 |
-
/**
|
61 |
-
* Check WordPress and PHP versions
|
62 |
-
*/
|
63 |
-
public static function check_requirements() {
|
64 |
-
// Prepare versions
|
65 |
-
$min_wp = '3.4';
|
66 |
-
$min_php = '5.1';
|
67 |
-
$wp = get_bloginfo( 'version' );
|
68 |
-
$php = phpversion();
|
69 |
-
// Load textdomain
|
70 |
-
load_plugin_textdomain( 'shortcodes-ultimate', false, dirname( plugin_basename( SU_PLUGIN_FILE ) ), '/languages/' );
|
71 |
-
// Prepare messages
|
72 |
-
$message_wp = sprintf( __( '<h1>Oops! Plugin not activated…</h1> <p>Shortcodes Ultimate is not fully compatible with your version of WordPress (%s).<br />Reccomended WordPress version – %s (or higher).</p><a href="%s">← Return to the plugins screen</a> <a href="%s"%s>Continue and activate anyway →</a>', 'su' ), $wp, $min_wp, network_admin_url( 'plugins.php?deactivate=true' ), $_SERVER['REQUEST_URI'] . '&continue=true', ' style="float:right;font-weight:bold"' );
|
73 |
-
$message_php = sprintf( __( '<h1>Oops! Plugin not activated…</h1> <p>Shortcodes Ultimate is not fully compatible with your PHP version (%s).<br />Reccomended PHP version – %s (or higher).</p><a href="%s">← Return to the plugins screen</a> <a href="%s"%s>Continue and activate anyway →</a>', 'su' ), $php, $min_php, network_admin_url( 'plugins.php?deactivate=true' ), $_SERVER['REQUEST_URI'] . '&continue=true', ' style="float:right;font-weight:bold"' );
|
74 |
-
// Check Forced activation
|
75 |
-
if ( isset( $_GET['continue'] ) ) return;
|
76 |
-
// WP version is too low
|
77 |
-
if ( version_compare( $min_wp, $wp, '>' ) ) {
|
78 |
-
deactivate_plugins( plugin_basename( SU_PLUGIN_FILE ) );
|
79 |
-
wp_die( $message_wp );
|
80 |
-
}
|
81 |
-
// PHP version is too low
|
82 |
-
elseif ( version_compare( $min_php, $php, '>' ) ) {
|
83 |
-
deactivate_plugins( plugin_basename( SU_PLUGIN_FILE ) );
|
84 |
-
wp_die( $message_php );
|
85 |
-
}
|
86 |
-
}
|
87 |
-
|
88 |
-
/**
|
89 |
-
* Create directory /wp-content/uploads/shortcodes-ultimate-skins/ on activation
|
90 |
-
*/
|
91 |
-
public static function create_skins_dir() {
|
92 |
-
$upload_dir = wp_upload_dir();
|
93 |
-
$path = trailingslashit( path_join( $upload_dir['basedir'], 'shortcodes-ultimate-skins' ) );
|
94 |
-
if ( !file_exists( $path ) ) mkdir( $path, 0755 );
|
95 |
-
}
|
96 |
-
|
97 |
-
/**
|
98 |
-
* Add plugin actions links
|
99 |
-
*/
|
100 |
-
public static function actions_links( $links ) {
|
101 |
-
$shult = shortcodes_ultimate();
|
102 |
-
$links[] = '<a href="' . $shult->admin_url . '#tab-0">' . __( 'Where to start?', 'su' ) . '</a>';
|
103 |
-
return $links;
|
104 |
-
}
|
105 |
-
|
106 |
-
/**
|
107 |
-
* Add plugin meta links
|
108 |
-
*/
|
109 |
-
public static function meta_links( $links, $file ) {
|
110 |
-
global $shult;
|
111 |
-
// Check plugin
|
112 |
-
if ( $file === $shult->basename ) {
|
113 |
-
unset( $links[2] );
|
114 |
-
$links[] = '<a href="http://gndev.info/shortcodes-ultimate/" target="_blank">' . __( 'Project homepage', 'su' ) . '</a>';
|
115 |
-
$links[] = '<a href="http://wordpress.org/support/plugin/shortcodes-ultimate/" target="_blank">' . __( 'Support forum', 'su' ) . '</a>';
|
116 |
-
$links[] = '<a href="http://wordpress.org/extend/plugins/shortcodes-ultimate/changelog/" target="_blank">' . __( 'Changelog', 'su' ) . '</a>';
|
117 |
-
}
|
118 |
-
return $links;
|
119 |
-
}
|
120 |
-
|
121 |
-
/**
|
122 |
-
* Plugin options
|
123 |
-
*/
|
124 |
-
public static function options() {
|
125 |
-
return apply_filters( 'su/options', array(
|
126 |
-
array( 'name' => __( 'About', 'su' ), 'type' => 'opentab' ),
|
127 |
-
array( 'type' => 'about' ),
|
128 |
-
array( 'type' => 'closetab', 'actions' => false ),
|
129 |
-
array( 'name' => __( 'Settings', 'su' ), 'type' => 'opentab' ),
|
130 |
-
array(
|
131 |
-
'name' => __( 'Custom formatting', 'su' ),
|
132 |
-
'desc' => __( 'Disable this option if you have some problems with other plugins or content formatting', 'su' ) . '<br /><a href="http://gndev.info/kb/custom-formatting/" target="_blank">' . __( 'Documentation article', 'su' ) . '</a>',
|
133 |
-
'std' => 'on',
|
134 |
-
'id' => 'custom_formatting',
|
135 |
-
'type' => 'checkbox',
|
136 |
-
'label' => __( 'Enabled', 'su' )
|
137 |
-
),
|
138 |
-
array(
|
139 |
-
'name' => __( 'Compatibility mode', 'su' ),
|
140 |
-
'desc' => __( 'Enable this option if you have some problems with other plugins that uses similar shortcode names', 'su' ) . '<br /><code>[button] => [su_button]</code> ' . __( 'etc.', 'su' ) . '<br /><a href="http://gndev.info/kb/compatibility-mode/" target="_blank">' . __( 'Documentation article', 'su' ) . '</a>',
|
141 |
-
'std' => '',
|
142 |
-
'id' => 'compatibility_mode',
|
143 |
-
'type' => 'checkbox',
|
144 |
-
'label' => __( 'Enabled', 'su' )
|
145 |
-
),
|
146 |
-
array(
|
147 |
-
'name' => __( 'Skip default values', 'su' ),
|
148 |
-
'desc' => __( 'Enable this option and the generator will insert a shortcode without default attribute values that you have not changed. As a result, the generated code will be shorter.', 'su' ),
|
149 |
-
'std' => 'on',
|
150 |
-
'id' => 'skip',
|
151 |
-
'type' => 'checkbox',
|
152 |
-
'label' => __( 'Enabled', 'su' )
|
153 |
-
),
|
154 |
-
array(
|
155 |
-
'name' => __( 'Skin', 'su' ),
|
156 |
-
'desc' => sprintf( __( 'Choose skin for shortcodes.<br /><a href="%s" target="_blank">Learn how to create custom skin</a><br /><a href="%s" target="_blank"><b>Download more skins</b></a>', 'su' ), 'http://gndev.info/kb/how-to-create-custom-skin-for-shortcodes-ultimate/', 'http://gndev.info/shortcodes-ultimate/' ),
|
157 |
-
'std' => 'default',
|
158 |
-
'id' => 'skin',
|
159 |
-
'type' => 'skin'
|
160 |
-
),
|
161 |
-
array( 'type' => 'closetab' ),
|
162 |
-
array( 'name' => __( 'Custom CSS', 'su' ), 'type' => 'opentab' ),
|
163 |
-
array( 'id' => 'custom_css', 'type' => 'css' ),
|
164 |
-
array( 'type' => 'closetab' ),
|
165 |
-
array( 'name' => __( 'Galleries', 'su' ), 'type' => 'opentab' ),
|
166 |
-
array( 'id' => 'galleries', 'type' => 'galleries' ),
|
167 |
-
array( 'type' => 'closetab' ),
|
168 |
-
array( 'name' => __( 'Cheatsheet', 'su' ), 'type' => 'opentab' ),
|
169 |
-
array( 'type' => 'cheatsheet' ),
|
170 |
-
array( 'type' => 'closetab', 'actions' => false ) ) );
|
171 |
-
}
|
172 |
-
}
|
173 |
-
|
174 |
-
// Define global plugin helper instance
|
175 |
-
$shult = null;
|
176 |
-
|
177 |
-
/**
|
178 |
-
* Register main plugin function to perform checks that plugin is installed
|
179 |
-
*
|
180 |
-
* Useful for integration with themes and other plugins
|
181 |
-
*
|
182 |
-
* @global Sunrise_Plugin_Framework_2 $shult
|
183 |
-
* @return \Sunrise_Plugin_Framework_2
|
184 |
-
*/
|
185 |
-
function shortcodes_ultimate() {
|
186 |
-
global $shult;
|
187 |
-
return $shult;
|
188 |
-
}
|
189 |
-
|
190 |
-
new Shortcodes_Ultimate;
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Shortcodes_Ultimate {
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Constructor
|
7 |
+
*/
|
8 |
+
function __construct() {
|
9 |
+
add_action( 'plugins_loaded', array( __CLASS__, 'init' ) );
|
10 |
+
register_activation_hook( SU_PLUGIN_FILE, array( __CLASS__, 'activation' ) );
|
11 |
+
register_activation_hook( SU_PLUGIN_FILE, array( __CLASS__, 'deactivation' ) );
|
12 |
+
}
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Plugin init
|
16 |
+
*/
|
17 |
+
public static function init() {
|
18 |
+
// Prepare variable for global plugin helper instance
|
19 |
+
global $shult;
|
20 |
+
// Create plugin helper instance
|
21 |
+
$shult = new Sunrise_Plugin_Framework_2( SU_PLUGIN_FILE );
|
22 |
+
// Register settings page
|
23 |
+
$shult->add_options_page( array( 'link' => false ), self::options() );
|
24 |
+
// Translate plugin meta
|
25 |
+
__( 'Shortcodes Ultimate', 'su' );
|
26 |
+
__( 'Vladimir Anokhin', 'su' );
|
27 |
+
__( 'Supercharge your WordPress theme with mega pack of shortcodes', 'su' );
|
28 |
+
// Add plugin actions links
|
29 |
+
add_filter( 'plugin_action_links_' . $shult->basename, array( __CLASS__, 'actions_links' ), -10 );
|
30 |
+
// Add plugin meta links
|
31 |
+
add_filter( 'plugin_row_meta', array( __CLASS__, 'meta_links' ), 10, 2 );
|
32 |
+
// Shortcodes Ultimate is ready
|
33 |
+
do_action( 'su/init' );
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Plugin activation
|
38 |
+
*/
|
39 |
+
public static function activation() {
|
40 |
+
self::timestamp();
|
41 |
+
self::check_requirements();
|
42 |
+
self::create_skins_dir();
|
43 |
+
do_action( 'su/activation' );
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Plugin deactivation
|
48 |
+
*/
|
49 |
+
public static function deactivation() {
|
50 |
+
do_action( 'su/deactivation' );
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Add timestamp
|
55 |
+
*/
|
56 |
+
public static function timestamp() {
|
57 |
+
if ( !get_option( 'su_installed' ) ) update_option( 'su_installed', time() );
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Check WordPress and PHP versions
|
62 |
+
*/
|
63 |
+
public static function check_requirements() {
|
64 |
+
// Prepare versions
|
65 |
+
$min_wp = '3.4';
|
66 |
+
$min_php = '5.1';
|
67 |
+
$wp = get_bloginfo( 'version' );
|
68 |
+
$php = phpversion();
|
69 |
+
// Load textdomain
|
70 |
+
load_plugin_textdomain( 'shortcodes-ultimate', false, dirname( plugin_basename( SU_PLUGIN_FILE ) ), '/languages/' );
|
71 |
+
// Prepare messages
|
72 |
+
$message_wp = sprintf( __( '<h1>Oops! Plugin not activated…</h1> <p>Shortcodes Ultimate is not fully compatible with your version of WordPress (%s).<br />Reccomended WordPress version – %s (or higher).</p><a href="%s">← Return to the plugins screen</a> <a href="%s"%s>Continue and activate anyway →</a>', 'su' ), $wp, $min_wp, network_admin_url( 'plugins.php?deactivate=true' ), $_SERVER['REQUEST_URI'] . '&continue=true', ' style="float:right;font-weight:bold"' );
|
73 |
+
$message_php = sprintf( __( '<h1>Oops! Plugin not activated…</h1> <p>Shortcodes Ultimate is not fully compatible with your PHP version (%s).<br />Reccomended PHP version – %s (or higher).</p><a href="%s">← Return to the plugins screen</a> <a href="%s"%s>Continue and activate anyway →</a>', 'su' ), $php, $min_php, network_admin_url( 'plugins.php?deactivate=true' ), $_SERVER['REQUEST_URI'] . '&continue=true', ' style="float:right;font-weight:bold"' );
|
74 |
+
// Check Forced activation
|
75 |
+
if ( isset( $_GET['continue'] ) ) return;
|
76 |
+
// WP version is too low
|
77 |
+
if ( version_compare( $min_wp, $wp, '>' ) ) {
|
78 |
+
deactivate_plugins( plugin_basename( SU_PLUGIN_FILE ) );
|
79 |
+
wp_die( $message_wp );
|
80 |
+
}
|
81 |
+
// PHP version is too low
|
82 |
+
elseif ( version_compare( $min_php, $php, '>' ) ) {
|
83 |
+
deactivate_plugins( plugin_basename( SU_PLUGIN_FILE ) );
|
84 |
+
wp_die( $message_php );
|
85 |
+
}
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Create directory /wp-content/uploads/shortcodes-ultimate-skins/ on activation
|
90 |
+
*/
|
91 |
+
public static function create_skins_dir() {
|
92 |
+
$upload_dir = wp_upload_dir();
|
93 |
+
$path = trailingslashit( path_join( $upload_dir['basedir'], 'shortcodes-ultimate-skins' ) );
|
94 |
+
if ( !file_exists( $path ) ) mkdir( $path, 0755 );
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Add plugin actions links
|
99 |
+
*/
|
100 |
+
public static function actions_links( $links ) {
|
101 |
+
$shult = shortcodes_ultimate();
|
102 |
+
$links[] = '<a href="' . $shult->admin_url . '#tab-0">' . __( 'Where to start?', 'su' ) . '</a>';
|
103 |
+
return $links;
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Add plugin meta links
|
108 |
+
*/
|
109 |
+
public static function meta_links( $links, $file ) {
|
110 |
+
global $shult;
|
111 |
+
// Check plugin
|
112 |
+
if ( $file === $shult->basename ) {
|
113 |
+
unset( $links[2] );
|
114 |
+
$links[] = '<a href="http://gndev.info/shortcodes-ultimate/" target="_blank">' . __( 'Project homepage', 'su' ) . '</a>';
|
115 |
+
$links[] = '<a href="http://wordpress.org/support/plugin/shortcodes-ultimate/" target="_blank">' . __( 'Support forum', 'su' ) . '</a>';
|
116 |
+
$links[] = '<a href="http://wordpress.org/extend/plugins/shortcodes-ultimate/changelog/" target="_blank">' . __( 'Changelog', 'su' ) . '</a>';
|
117 |
+
}
|
118 |
+
return $links;
|
119 |
+
}
|
120 |
+
|
121 |
+
/**
|
122 |
+
* Plugin options
|
123 |
+
*/
|
124 |
+
public static function options() {
|
125 |
+
return apply_filters( 'su/options', array(
|
126 |
+
array( 'name' => __( 'About', 'su' ), 'type' => 'opentab' ),
|
127 |
+
array( 'type' => 'about' ),
|
128 |
+
array( 'type' => 'closetab', 'actions' => false ),
|
129 |
+
array( 'name' => __( 'Settings', 'su' ), 'type' => 'opentab' ),
|
130 |
+
array(
|
131 |
+
'name' => __( 'Custom formatting', 'su' ),
|
132 |
+
'desc' => __( 'Disable this option if you have some problems with other plugins or content formatting', 'su' ) . '<br /><a href="http://gndev.info/kb/custom-formatting/" target="_blank">' . __( 'Documentation article', 'su' ) . '</a>',
|
133 |
+
'std' => 'on',
|
134 |
+
'id' => 'custom_formatting',
|
135 |
+
'type' => 'checkbox',
|
136 |
+
'label' => __( 'Enabled', 'su' )
|
137 |
+
),
|
138 |
+
array(
|
139 |
+
'name' => __( 'Compatibility mode', 'su' ),
|
140 |
+
'desc' => __( 'Enable this option if you have some problems with other plugins that uses similar shortcode names', 'su' ) . '<br /><code>[button] => [su_button]</code> ' . __( 'etc.', 'su' ) . '<br /><a href="http://gndev.info/kb/compatibility-mode/" target="_blank">' . __( 'Documentation article', 'su' ) . '</a>',
|
141 |
+
'std' => '',
|
142 |
+
'id' => 'compatibility_mode',
|
143 |
+
'type' => 'checkbox',
|
144 |
+
'label' => __( 'Enabled', 'su' )
|
145 |
+
),
|
146 |
+
array(
|
147 |
+
'name' => __( 'Skip default values', 'su' ),
|
148 |
+
'desc' => __( 'Enable this option and the generator will insert a shortcode without default attribute values that you have not changed. As a result, the generated code will be shorter.', 'su' ),
|
149 |
+
'std' => 'on',
|
150 |
+
'id' => 'skip',
|
151 |
+
'type' => 'checkbox',
|
152 |
+
'label' => __( 'Enabled', 'su' )
|
153 |
+
),
|
154 |
+
array(
|
155 |
+
'name' => __( 'Skin', 'su' ),
|
156 |
+
'desc' => sprintf( __( 'Choose skin for shortcodes.<br /><a href="%s" target="_blank">Learn how to create custom skin</a><br /><a href="%s" target="_blank"><b>Download more skins</b></a>', 'su' ), 'http://gndev.info/kb/how-to-create-custom-skin-for-shortcodes-ultimate/', 'http://gndev.info/shortcodes-ultimate/' ),
|
157 |
+
'std' => 'default',
|
158 |
+
'id' => 'skin',
|
159 |
+
'type' => 'skin'
|
160 |
+
),
|
161 |
+
array( 'type' => 'closetab' ),
|
162 |
+
array( 'name' => __( 'Custom CSS', 'su' ), 'type' => 'opentab' ),
|
163 |
+
array( 'id' => 'custom_css', 'type' => 'css' ),
|
164 |
+
array( 'type' => 'closetab' ),
|
165 |
+
array( 'name' => __( 'Galleries', 'su' ), 'type' => 'opentab' ),
|
166 |
+
array( 'id' => 'galleries', 'type' => 'galleries' ),
|
167 |
+
array( 'type' => 'closetab' ),
|
168 |
+
array( 'name' => __( 'Cheatsheet', 'su' ), 'type' => 'opentab' ),
|
169 |
+
array( 'type' => 'cheatsheet' ),
|
170 |
+
array( 'type' => 'closetab', 'actions' => false ) ) );
|
171 |
+
}
|
172 |
+
}
|
173 |
+
|
174 |
+
// Define global plugin helper instance
|
175 |
+
$shult = null;
|
176 |
+
|
177 |
+
/**
|
178 |
+
* Register main plugin function to perform checks that plugin is installed
|
179 |
+
*
|
180 |
+
* Useful for integration with themes and other plugins
|
181 |
+
*
|
182 |
+
* @global Sunrise_Plugin_Framework_2 $shult
|
183 |
+
* @return \Sunrise_Plugin_Framework_2
|
184 |
+
*/
|
185 |
+
function shortcodes_ultimate() {
|
186 |
+
global $shult;
|
187 |
+
return $shult;
|
188 |
+
}
|
189 |
+
|
190 |
+
new Shortcodes_Ultimate;
|
inc/core/class.vote.php
CHANGED
@@ -1,55 +1,55 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Shortcodes_Ultimate_Vote {
|
4 |
-
function __construct() {
|
5 |
-
add_action( 'load-plugins.php', array( __CLASS__, 'init' ) );
|
6 |
-
add_action( 'wp_ajax_su_vote', array( __CLASS__, 'vote' ) );
|
7 |
-
}
|
8 |
-
public static function init() {
|
9 |
-
Shortcodes_Ultimate::timestamp();
|
10 |
-
$vote = get_option( 'su_vote' );
|
11 |
-
$timeout = time() > ( get_option( 'su_installed' ) + 60*60*24*3 );
|
12 |
-
if ( $vote === 'yes' || $vote === 'no' || !$timeout ) return;
|
13 |
-
add_action( 'in_admin_footer', array( __CLASS__, 'message' ) );
|
14 |
-
add_action( 'admin_head', array( __CLASS__, 'register' ) );
|
15 |
-
add_action( 'admin_footer', array( __CLASS__, 'enqueue' ) );
|
16 |
-
}
|
17 |
-
public static function register() {
|
18 |
-
$shult = shortcodes_ultimate();
|
19 |
-
wp_register_style( 'su-vote', $shult->assets( 'css', 'vote.css' ), false, $shult->version, 'all' );
|
20 |
-
wp_register_script( 'su-vote', $shult->assets( 'js', 'vote.js' ), array( 'jquery' ), $shult->version, true );
|
21 |
-
}
|
22 |
-
public static function enqueue() {
|
23 |
-
wp_enqueue_style( 'su-vote' );
|
24 |
-
wp_enqueue_script( 'su-vote' );
|
25 |
-
}
|
26 |
-
public static function vote() {
|
27 |
-
$vote = sanitize_key( $_GET['vote'] );
|
28 |
-
if ( !is_user_logged_in() || !in_array( $vote, array( 'yes', 'no', 'later', 'tweet' ) ) ) die( 'error' );
|
29 |
-
update_option( 'su_vote', $vote );
|
30 |
-
if ( $vote === 'later' ) update_option( 'su_installed', time() );
|
31 |
-
die( 'OK: ' . $vote );
|
32 |
-
}
|
33 |
-
public static function message() {
|
34 |
-
?>
|
35 |
-
<div class="su-vote" style="display:none">
|
36 |
-
<div class="su-vote-wrap">
|
37 |
-
<div class="su-vote-gravatar"><a href="http://profiles.wordpress.org/gn_themes" target="_blank"><img src="http://www.gravatar.com/avatar/54fda46c150e45d18d105b9185017aea.png" alt="<?php _e( 'Vladimir Anokhin', 'su' ); ?>" width="50" height="50"></a></div>
|
38 |
-
<div class="su-vote-message">
|
39 |
-
<p><?php _e( 'Hello, my name is Vladimir Anokhin, and I am developer of plugin <b>Shortcodes Ultimate</b>.<br>If you like this plugin, please write a few words about it at the wordpress.org or twitter. It will help other people find this useful plugin more quickly.<br><b>Thank you!</b>', 'su' ); ?></p>
|
40 |
-
<p>
|
41 |
-
<a href="<?php echo admin_url( 'admin-ajax.php' ); ?>?action=su_vote&vote=yes" class="su-vote-action button button-small button-primary" data-action="http://wordpress.org/support/view/plugin-reviews/shortcodes-ultimate?rate=5#postform"><?php _e( 'Rate plugin', 'su' ); ?></a>
|
42 |
-
<a href="<?php echo admin_url( 'admin-ajax.php' ); ?>?action=su_vote&vote=tweet" class="su-vote-action button button-small" data-action="http://twitter.com/share?url=http://bit.ly/1blZb7u&text=<?php echo urlencode( __( 'Shortcodes Ultimate - must have WordPress plugin #shortcodesultimate', 'su' ) ); ?>"><?php _e( 'Tweet', 'su' ); ?></a>
|
43 |
-
<a href="<?php echo admin_url( 'admin-ajax.php' ); ?>?action=su_vote&vote=no" class="su-vote-action button button-small"><?php _e( 'No, thanks', 'su' ); ?></a>
|
44 |
-
<span><?php _e( 'or', 'su' ); ?></span>
|
45 |
-
<a href="<?php echo admin_url( 'admin-ajax.php' ); ?>?action=su_vote&vote=later" class="su-vote-action button button-small"><?php _e( 'Remind me later', 'su' ); ?></a>
|
46 |
-
</p>
|
47 |
-
</div>
|
48 |
-
<div class="su-vote-clear"></div>
|
49 |
-
</div>
|
50 |
-
</div>
|
51 |
-
<?php
|
52 |
-
}
|
53 |
-
}
|
54 |
-
|
55 |
-
new Shortcodes_Ultimate_Vote;
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Shortcodes_Ultimate_Vote {
|
4 |
+
function __construct() {
|
5 |
+
add_action( 'load-plugins.php', array( __CLASS__, 'init' ) );
|
6 |
+
add_action( 'wp_ajax_su_vote', array( __CLASS__, 'vote' ) );
|
7 |
+
}
|
8 |
+
public static function init() {
|
9 |
+
Shortcodes_Ultimate::timestamp();
|
10 |
+
$vote = get_option( 'su_vote' );
|
11 |
+
$timeout = time() > ( get_option( 'su_installed' ) + 60*60*24*3 );
|
12 |
+
if ( $vote === 'yes' || $vote === 'no' || !$timeout ) return;
|
13 |
+
add_action( 'in_admin_footer', array( __CLASS__, 'message' ) );
|
14 |
+
add_action( 'admin_head', array( __CLASS__, 'register' ) );
|
15 |
+
add_action( 'admin_footer', array( __CLASS__, 'enqueue' ) );
|
16 |
+
}
|
17 |
+
public static function register() {
|
18 |
+
$shult = shortcodes_ultimate();
|
19 |
+
wp_register_style( 'su-vote', $shult->assets( 'css', 'vote.css' ), false, $shult->version, 'all' );
|
20 |
+
wp_register_script( 'su-vote', $shult->assets( 'js', 'vote.js' ), array( 'jquery' ), $shult->version, true );
|
21 |
+
}
|
22 |
+
public static function enqueue() {
|
23 |
+
wp_enqueue_style( 'su-vote' );
|
24 |
+
wp_enqueue_script( 'su-vote' );
|
25 |
+
}
|
26 |
+
public static function vote() {
|
27 |
+
$vote = sanitize_key( $_GET['vote'] );
|
28 |
+
if ( !is_user_logged_in() || !in_array( $vote, array( 'yes', 'no', 'later', 'tweet' ) ) ) die( 'error' );
|
29 |
+
update_option( 'su_vote', $vote );
|
30 |
+
if ( $vote === 'later' ) update_option( 'su_installed', time() );
|
31 |
+
die( 'OK: ' . $vote );
|
32 |
+
}
|
33 |
+
public static function message() {
|
34 |
+
?>
|
35 |
+
<div class="su-vote" style="display:none">
|
36 |
+
<div class="su-vote-wrap">
|
37 |
+
<div class="su-vote-gravatar"><a href="http://profiles.wordpress.org/gn_themes" target="_blank"><img src="http://www.gravatar.com/avatar/54fda46c150e45d18d105b9185017aea.png" alt="<?php _e( 'Vladimir Anokhin', 'su' ); ?>" width="50" height="50"></a></div>
|
38 |
+
<div class="su-vote-message">
|
39 |
+
<p><?php _e( 'Hello, my name is Vladimir Anokhin, and I am developer of plugin <b>Shortcodes Ultimate</b>.<br>If you like this plugin, please write a few words about it at the wordpress.org or twitter. It will help other people find this useful plugin more quickly.<br><b>Thank you!</b>', 'su' ); ?></p>
|
40 |
+
<p>
|
41 |
+
<a href="<?php echo admin_url( 'admin-ajax.php' ); ?>?action=su_vote&vote=yes" class="su-vote-action button button-small button-primary" data-action="http://wordpress.org/support/view/plugin-reviews/shortcodes-ultimate?rate=5#postform"><?php _e( 'Rate plugin', 'su' ); ?></a>
|
42 |
+
<a href="<?php echo admin_url( 'admin-ajax.php' ); ?>?action=su_vote&vote=tweet" class="su-vote-action button button-small" data-action="http://twitter.com/share?url=http://bit.ly/1blZb7u&text=<?php echo urlencode( __( 'Shortcodes Ultimate - must have WordPress plugin #shortcodesultimate', 'su' ) ); ?>"><?php _e( 'Tweet', 'su' ); ?></a>
|
43 |
+
<a href="<?php echo admin_url( 'admin-ajax.php' ); ?>?action=su_vote&vote=no" class="su-vote-action button button-small"><?php _e( 'No, thanks', 'su' ); ?></a>
|
44 |
+
<span><?php _e( 'or', 'su' ); ?></span>
|
45 |
+
<a href="<?php echo admin_url( 'admin-ajax.php' ); ?>?action=su_vote&vote=later" class="su-vote-action button button-small"><?php _e( 'Remind me later', 'su' ); ?></a>
|
46 |
+
</p>
|
47 |
+
</div>
|
48 |
+
<div class="su-vote-clear"></div>
|
49 |
+
</div>
|
50 |
+
</div>
|
51 |
+
<?php
|
52 |
+
}
|
53 |
+
}
|
54 |
+
|
55 |
+
new Shortcodes_Ultimate_Vote;
|
inc/core/class.widget.php
CHANGED
@@ -1,101 +1,101 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Add function to widgets_init that'll load our widget.
|
4 |
-
*
|
5 |
-
* @since 0.1
|
6 |
-
*/
|
7 |
-
add_action( 'widgets_init', 'shortcodes_ultimate_load_widgets' );
|
8 |
-
|
9 |
-
/**
|
10 |
-
* Register widget
|
11 |
-
*/
|
12 |
-
if ( !function_exists( 'shortcodes_ultimate_load_widgets' ) ) {
|
13 |
-
|
14 |
-
function shortcodes_ultimate_load_widgets() {
|
15 |
-
register_widget( 'Shortcodes_Ultimate_Widget' );
|
16 |
-
}
|
17 |
-
|
18 |
-
}
|
19 |
-
|
20 |
-
/**
|
21 |
-
* Example Widget class.
|
22 |
-
* This class handles everything that needs to be handled with the widget:
|
23 |
-
* the settings, form, display, and update. Nice!
|
24 |
-
*
|
25 |
-
* @since 0.1
|
26 |
-
*/
|
27 |
-
if ( !class_exists( 'Shortcodes_Ultimate_Widget' ) ) {
|
28 |
-
|
29 |
-
class Shortcodes_Ultimate_Widget extends WP_Widget {
|
30 |
-
|
31 |
-
/**
|
32 |
-
* Widget setup.
|
33 |
-
*/
|
34 |
-
function Shortcodes_Ultimate_Widget() {
|
35 |
-
/* Widget settings. */
|
36 |
-
$widget_ops = array( 'classname' => 'shortcodes-ultimate', 'description' => __( 'Special Shortcodes Ultimate widget', 'su' ) );
|
37 |
-
/* Widget control settings. */
|
38 |
-
$control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'shortcodes-ultimate' );
|
39 |
-
/* Create the widget. */
|
40 |
-
$this->WP_Widget( 'shortcodes-ultimate', __( 'Shortcodes Ultimate', 'su' ), $widget_ops, $control_ops );
|
41 |
-
}
|
42 |
-
|
43 |
-
/**
|
44 |
-
* How to display the widget on the screen.
|
45 |
-
*/
|
46 |
-
function widget( $args, $instance ) {
|
47 |
-
extract( $args );
|
48 |
-
/* Our variables from the widget settings. */
|
49 |
-
$title = apply_filters( 'widget_title', $instance['title'] );
|
50 |
-
$content = $instance['content'];
|
51 |
-
/* Before widget (defined by themes). */
|
52 |
-
echo $before_widget;
|
53 |
-
/* Display the widget title if one was input (before and after defined by themes). */
|
54 |
-
if ( $title )
|
55 |
-
echo $before_title . $title . $after_title;
|
56 |
-
/* Display name from widget settings if one was input. */
|
57 |
-
echo '<div class="textwidget">' . do_shortcode( $content ) . '</div>';
|
58 |
-
/* After widget (defined by themes). */
|
59 |
-
echo $after_widget;
|
60 |
-
}
|
61 |
-
|
62 |
-
/**
|
63 |
-
* Update the widget settings.
|
64 |
-
*/
|
65 |
-
function update( $new_instance, $old_instance ) {
|
66 |
-
$instance = $old_instance;
|
67 |
-
|
68 |
-
/* Strip tags for title */
|
69 |
-
$instance['title'] = strip_tags( $new_instance['title'] );
|
70 |
-
$instance['content'] = $new_instance['content'];
|
71 |
-
|
72 |
-
return $instance;
|
73 |
-
}
|
74 |
-
|
75 |
-
/**
|
76 |
-
* Displays the widget settings controls on the widget panel.
|
77 |
-
* Make use of the get_field_id() and get_field_name() function
|
78 |
-
* when creating your form elements. This handles the confusing stuff.
|
79 |
-
*/
|
80 |
-
function form( $instance ) {
|
81 |
-
/* Set up some default widget settings. */
|
82 |
-
$defaults = array( 'title' => __( 'Shortcodes Ultimate', 'su' ), 'content' => '' );
|
83 |
-
$instance = wp_parse_args( ( array ) $instance, $defaults );
|
84 |
-
?>
|
85 |
-
<!-- Widget Title: Text Input -->
|
86 |
-
<p>
|
87 |
-
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'su' ); ?></label>
|
88 |
-
<input type="text" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" class="widefat" />
|
89 |
-
</p>
|
90 |
-
<!-- Content: Textarea -->
|
91 |
-
<p>
|
92 |
-
<?php Shortcodes_Ultimate_Generator::button( array( 'target' => $this->get_field_id( 'content' ) ) ); ?><br/>
|
93 |
-
<textarea name="<?php echo $this->get_field_name( 'content' ); ?>" id="<?php echo $this->get_field_id( 'content' ); ?>" rows="7" class="widefat" style="margin-top:10px"><?php echo $instance['content']; ?></textarea>
|
94 |
-
</p>
|
95 |
-
<?php
|
96 |
-
}
|
97 |
-
|
98 |
-
}
|
99 |
-
|
100 |
-
}
|
101 |
-
?>
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Add function to widgets_init that'll load our widget.
|
4 |
+
*
|
5 |
+
* @since 0.1
|
6 |
+
*/
|
7 |
+
add_action( 'widgets_init', 'shortcodes_ultimate_load_widgets' );
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Register widget
|
11 |
+
*/
|
12 |
+
if ( !function_exists( 'shortcodes_ultimate_load_widgets' ) ) {
|
13 |
+
|
14 |
+
function shortcodes_ultimate_load_widgets() {
|
15 |
+
register_widget( 'Shortcodes_Ultimate_Widget' );
|
16 |
+
}
|
17 |
+
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Example Widget class.
|
22 |
+
* This class handles everything that needs to be handled with the widget:
|
23 |
+
* the settings, form, display, and update. Nice!
|
24 |
+
*
|
25 |
+
* @since 0.1
|
26 |
+
*/
|
27 |
+
if ( !class_exists( 'Shortcodes_Ultimate_Widget' ) ) {
|
28 |
+
|
29 |
+
class Shortcodes_Ultimate_Widget extends WP_Widget {
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Widget setup.
|
33 |
+
*/
|
34 |
+
function Shortcodes_Ultimate_Widget() {
|
35 |
+
/* Widget settings. */
|
36 |
+
$widget_ops = array( 'classname' => 'shortcodes-ultimate', 'description' => __( 'Special Shortcodes Ultimate widget', 'su' ) );
|
37 |
+
/* Widget control settings. */
|
38 |
+
$control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'shortcodes-ultimate' );
|
39 |
+
/* Create the widget. */
|
40 |
+
$this->WP_Widget( 'shortcodes-ultimate', __( 'Shortcodes Ultimate', 'su' ), $widget_ops, $control_ops );
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* How to display the widget on the screen.
|
45 |
+
*/
|
46 |
+
function widget( $args, $instance ) {
|
47 |
+
extract( $args );
|
48 |
+
/* Our variables from the widget settings. */
|
49 |
+
$title = apply_filters( 'widget_title', $instance['title'] );
|
50 |
+
$content = $instance['content'];
|
51 |
+
/* Before widget (defined by themes). */
|
52 |
+
echo $before_widget;
|
53 |
+
/* Display the widget title if one was input (before and after defined by themes). */
|
54 |
+
if ( $title )
|
55 |
+
echo $before_title . $title . $after_title;
|
56 |
+
/* Display name from widget settings if one was input. */
|
57 |
+
echo '<div class="textwidget">' . do_shortcode( $content ) . '</div>';
|
58 |
+
/* After widget (defined by themes). */
|
59 |
+
echo $after_widget;
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Update the widget settings.
|
64 |
+
*/
|
65 |
+
function update( $new_instance, $old_instance ) {
|
66 |
+
$instance = $old_instance;
|
67 |
+
|
68 |
+
/* Strip tags for title */
|
69 |
+
$instance['title'] = strip_tags( $new_instance['title'] );
|
70 |
+
$instance['content'] = $new_instance['content'];
|
71 |
+
|
72 |
+
return $instance;
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Displays the widget settings controls on the widget panel.
|
77 |
+
* Make use of the get_field_id() and get_field_name() function
|
78 |
+
* when creating your form elements. This handles the confusing stuff.
|
79 |
+
*/
|
80 |
+
function form( $instance ) {
|
81 |
+
/* Set up some default widget settings. */
|
82 |
+
$defaults = array( 'title' => __( 'Shortcodes Ultimate', 'su' ), 'content' => '' );
|
83 |
+
$instance = wp_parse_args( ( array ) $instance, $defaults );
|
84 |
+
?>
|
85 |
+
<!-- Widget Title: Text Input -->
|
86 |
+
<p>
|
87 |
+
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'su' ); ?></label>
|
88 |
+
<input type="text" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" class="widefat" />
|
89 |
+
</p>
|
90 |
+
<!-- Content: Textarea -->
|
91 |
+
<p>
|
92 |
+
<?php Shortcodes_Ultimate_Generator::button( array( 'target' => $this->get_field_id( 'content' ) ) ); ?><br/>
|
93 |
+
<textarea name="<?php echo $this->get_field_name( 'content' ); ?>" id="<?php echo $this->get_field_id( 'content' ); ?>" rows="7" class="widefat" style="margin-top:10px"><?php echo $instance['content']; ?></textarea>
|
94 |
+
</p>
|
95 |
+
<?php
|
96 |
+
}
|
97 |
+
|
98 |
+
}
|
99 |
+
|
100 |
+
}
|
101 |
+
?>
|
inc/core/shortcodes.php
CHANGED
@@ -139,11 +139,16 @@ function su_spacer_shortcode( $atts, $content = null ) {
|
|
139 |
* @return string Output html
|
140 |
*/
|
141 |
function su_highlight_shortcode( $atts, $content = null ) {
|
142 |
-
$atts = shortcode_atts( array(
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
su_query_asset( 'css', 'su-content-shortcodes' );
|
144 |
return
|
145 |
-
'<span class="su-highlight' . su_ecssc( $atts ) . '" style="background:' . $atts['background'] . ';color:' .
|
146 |
-
$atts['color'] . '"> ' . $content . ' </span>';
|
147 |
}
|
148 |
|
149 |
/**
|
@@ -155,7 +160,12 @@ function su_highlight_shortcode( $atts, $content = null ) {
|
|
155 |
* @return string Output html
|
156 |
*/
|
157 |
function su_label_shortcode( $atts, $content = null ) {
|
158 |
-
$atts = shortcode_atts( array(
|
|
|
|
|
|
|
|
|
|
|
159 |
su_query_asset( 'css', 'su-content-shortcodes' );
|
160 |
return '<span class="su-label su-label-type-' . $atts['type'] . su_ecssc( $atts ) . '">' . $content . '</span>';
|
161 |
}
|
@@ -203,7 +213,12 @@ function su_pullquote_shortcode( $atts, $content = null ) {
|
|
203 |
* @return string Output html
|
204 |
*/
|
205 |
function su_dropcap_shortcode( $atts, $content = null ) {
|
206 |
-
$atts = shortcode_atts( array(
|
|
|
|
|
|
|
|
|
|
|
207 |
// Calculate font-size
|
208 |
$em = $atts['size'] * 0.5 . 'em';
|
209 |
su_query_asset( 'css', 'su-content-shortcodes' );
|
@@ -234,10 +249,14 @@ function su_row_shortcode( $atts = null, $content = null ) {
|
|
234 |
* @return string Output html
|
235 |
*/
|
236 |
function su_column_shortcode( $atts, $content = null ) {
|
237 |
-
$atts = shortcode_atts( array(
|
|
|
|
|
|
|
|
|
|
|
238 |
su_query_asset( 'css', 'su-box-shortcodes' );
|
239 |
-
return '<div class="su-column su-column-size-' . str_replace( '/', '-', $atts['size'] ) . su_ecssc( $atts ) .
|
240 |
-
'"><div class="su-column-inner">' . su_do_shortcode( $content, 'c' ) . '</div></div>';
|
241 |
}
|
242 |
|
243 |
/**
|
@@ -266,10 +285,12 @@ function su_list_shortcode( $atts, $content = null ) {
|
|
266 |
function su_button_shortcode( $atts, $content = null ) {
|
267 |
$atts = shortcode_atts( array(
|
268 |
'url' => get_option( 'home' ),
|
|
|
269 |
'target' => 'self',
|
270 |
'style' => 'default',
|
271 |
'background' => '#2D89EF',
|
272 |
'color' => '#FFFFFF',
|
|
|
273 |
'size' => 3,
|
274 |
'wide' => 'no',
|
275 |
'radius' => 'auto',
|
@@ -280,6 +301,13 @@ function su_button_shortcode( $atts, $content = null ) {
|
|
280 |
'class' => ''
|
281 |
), $atts );
|
282 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
283 |
// Prepare vars
|
284 |
$a_css = array();
|
285 |
$span_css = array();
|
@@ -393,17 +421,14 @@ function su_button_shortcode( $atts, $content = null ) {
|
|
393 |
*/
|
394 |
function su_service_shortcode( $atts, $content = null ) {
|
395 |
$shult = shortcodes_ultimate();
|
396 |
-
$atts = shortcode_atts( array(
|
397 |
-
'
|
398 |
-
'
|
399 |
-
'
|
|
|
|
|
400 |
su_query_asset( 'css', 'su-box-shortcodes' );
|
401 |
-
return '<div class="su-service' . su_ecssc( $atts ) . '"><div class="su-service-title" style="padding:' .
|
402 |
-
round( ( $atts['size'] - 16 ) / 2 ) . 'px 0 ' . round( ( $atts['size'] - 16 ) / 2 ) . 'px ' .
|
403 |
-
( $atts['size'] + 15 ) . 'px"><img src="' . $atts['icon'] . '" width="' . $atts['size'] . '" height="' .
|
404 |
-
$atts['size'] . '" alt="' . $atts['title'] . '" /> ' . $atts['title'] .
|
405 |
-
'</div><div class="su-service-content" style="padding:0 0 0 ' . ( $atts['size'] + 15 ) . 'px">' .
|
406 |
-
do_shortcode( $content ) . '</div></div>';
|
407 |
}
|
408 |
|
409 |
/**
|
@@ -415,12 +440,16 @@ function su_service_shortcode( $atts, $content = null ) {
|
|
415 |
* @return string Output html
|
416 |
*/
|
417 |
function su_box_shortcode( $atts, $content = null ) {
|
418 |
-
$atts = shortcode_atts( array(
|
419 |
-
'
|
420 |
-
'
|
|
|
421 |
'title_color' => '#FFFFFF',
|
422 |
-
'
|
423 |
-
'
|
|
|
|
|
|
|
424 |
// Prepare border-radius
|
425 |
$radius = ( $atts['radius'] != '0' ) ?
|
426 |
'border-radius:' . $atts['radius'] . 'px;-moz-border-radius:' . $atts['radius'] .
|
@@ -449,21 +478,20 @@ function su_box_shortcode( $atts, $content = null ) {
|
|
449 |
* @return string Output html
|
450 |
*/
|
451 |
function su_note_shortcode( $atts, $content = null ) {
|
452 |
-
$atts = shortcode_atts( array(
|
453 |
-
'
|
454 |
-
'
|
455 |
-
'
|
|
|
|
|
|
|
|
|
|
|
|
|
456 |
// Prepare border-radius
|
457 |
-
$radius = ( $atts['radius'] != '0' ) ?
|
458 |
-
'border-radius:' . $atts['radius'] . 'px;-moz-border-radius:' . $atts['radius'] .
|
459 |
-
'px;-webkit-border-radius:' . $atts['radius'] . 'px;' : '';
|
460 |
su_query_asset( 'css', 'su-box-shortcodes' );
|
461 |
-
return
|
462 |
-
'<div class="su-note' . su_ecssc( $atts ) . '" style="border-color:' .
|
463 |
-
su_hex_shift( $atts['background'], 'darker', 10 ) . ';' . $radius .
|
464 |
-
'"><div class="su-note-inner" style="background-color:' . $atts['background'] . ';border-color:' .
|
465 |
-
su_hex_shift( $atts['background'], 'lighter', 80 ) . ';color:' . $atts['color'] . ';' . $radius . '">' .
|
466 |
-
su_do_shortcode( $content, 'n' ) . '</div></div>';
|
467 |
}
|
468 |
|
469 |
/**
|
@@ -711,12 +739,16 @@ function su_table_shortcode( $atts, $content = null ) {
|
|
711 |
* @return string Output html
|
712 |
*/
|
713 |
function su_permalink_shortcode( $atts, $content = null ) {
|
714 |
-
$atts = shortcode_atts( array(
|
|
|
|
|
|
|
|
|
|
|
|
|
715 |
// Prepare link text
|
716 |
$text = ( $content ) ? $content : get_the_title( $atts['id'] );
|
717 |
-
return
|
718 |
-
'<a href="' . get_permalink( $atts['id'] ) . '" class="' . su_ecssc( $atts ) . '" title="' . $text .
|
719 |
-
'" target="_' . $atts['target'] . '">' . $text . '</a>';
|
720 |
}
|
721 |
|
722 |
/**
|
@@ -729,16 +761,20 @@ function su_permalink_shortcode( $atts, $content = null ) {
|
|
729 |
*/
|
730 |
function su_members_shortcode( $atts, $content = null ) {
|
731 |
$atts = shortcode_atts( array(
|
732 |
-
'message'
|
733 |
-
'color'
|
|
|
734 |
'login_text' => __( 'login', 'su' ),
|
735 |
-
'login_url'
|
736 |
-
'
|
|
|
737 |
), $atts );
|
|
|
738 |
// Check feed
|
739 |
if ( is_feed() ) return;
|
740 |
// Check authorization
|
741 |
if ( !is_user_logged_in() ) {
|
|
|
742 |
// Prepare login link
|
743 |
$login = '<a href="' . esc_attr( $atts['login_url'] ) . '">' . $atts['login_text'] . '</a>';
|
744 |
su_query_asset( 'css', 'su-other-shortcodes' );
|
@@ -871,17 +907,17 @@ function su_menu_shortcode_fb_cb() {
|
|
871 |
* @return string Output html
|
872 |
*/
|
873 |
function su_document_shortcode( $atts, $content = null ) {
|
874 |
-
$atts = shortcode_atts( array(
|
875 |
-
'
|
876 |
-
'
|
|
|
|
|
877 |
'responsive' => 'yes',
|
878 |
-
'class'
|
|
|
|
|
879 |
su_query_asset( 'css', 'su-media-shortcodes' );
|
880 |
-
return
|
881 |
-
'<div class="su-document su-responsive-media-' . $atts['responsive'] .
|
882 |
-
'"><iframe src="http://docs.google.com/viewer?embedded=true&url=' . $atts['url'] . '" width="' .
|
883 |
-
$atts['width'] . '" height="' . $atts['height'] . '" class="su-document' . su_ecssc( $atts ) .
|
884 |
-
'"></iframe></div>';
|
885 |
}
|
886 |
|
887 |
/**
|
@@ -893,16 +929,15 @@ function su_document_shortcode( $atts, $content = null ) {
|
|
893 |
* @return string Output html
|
894 |
*/
|
895 |
function su_gmap_shortcode( $atts, $content = null ) {
|
896 |
-
$atts = shortcode_atts( array(
|
897 |
-
'
|
|
|
898 |
'responsive' => 'yes',
|
899 |
-
'address'
|
900 |
-
'class'
|
|
|
901 |
su_query_asset( 'css', 'su-media-shortcodes' );
|
902 |
-
return
|
903 |
-
'<div class="su-gmap su-responsive-media-' . $atts['responsive'] . su_ecssc( $atts ) . '"><iframe width="' .
|
904 |
-
$atts['width'] . '" height="' . $atts['height'] . '" src="http://maps.google.com/maps?q=' .
|
905 |
-
urlencode( $atts['address'] ) . '&output=embed"></iframe></div>';
|
906 |
}
|
907 |
|
908 |
/**
|
@@ -931,7 +966,7 @@ function su_slider_shortcode( $atts, $content = null ) {
|
|
931 |
'speed' => 600,
|
932 |
'target' => 'yes',
|
933 |
'class' => ''
|
934 |
-
|
935 |
// Prepare unique ID
|
936 |
$id = uniqid( 'su_slider_' );
|
937 |
// Links target
|
@@ -1017,7 +1052,7 @@ function su_carousel_shortcode( $atts, $content = null ) {
|
|
1017 |
'speed' => 600,
|
1018 |
'target' => 'yes',
|
1019 |
'class' => ''
|
1020 |
-
|
1021 |
// Prepare unique ID
|
1022 |
$id = uniqid( 'su_carousel_' );
|
1023 |
// Links target
|
@@ -1094,7 +1129,7 @@ function su_custom_gallery_shortcode( $atts, $content = null ) {
|
|
1094 |
'title' => 'hover',
|
1095 |
'target' => 'yes',
|
1096 |
'class' => ''
|
1097 |
-
|
1098 |
// Links target
|
1099 |
$target = ( $atts['target'] === 'yes' ) ? ' target="_blank"' : '';
|
1100 |
// Prepare gallery
|
139 |
* @return string Output html
|
140 |
*/
|
141 |
function su_highlight_shortcode( $atts, $content = null ) {
|
142 |
+
$atts = shortcode_atts( array(
|
143 |
+
'background' => '#ddff99',
|
144 |
+
'bg' => null, // 3.x
|
145 |
+
'color' => '#000000',
|
146 |
+
'class' => ''
|
147 |
+
), $atts );
|
148 |
+
if ( $atts['bg'] !== null ) $atts['background'] = $atts['bg'];
|
149 |
su_query_asset( 'css', 'su-content-shortcodes' );
|
150 |
return
|
151 |
+
'<span class="su-highlight' . su_ecssc( $atts ) . '" style="background:' . $atts['background'] . ';color:' . $atts['color'] . '"> ' . $content . ' </span>';
|
|
|
152 |
}
|
153 |
|
154 |
/**
|
160 |
* @return string Output html
|
161 |
*/
|
162 |
function su_label_shortcode( $atts, $content = null ) {
|
163 |
+
$atts = shortcode_atts( array(
|
164 |
+
'type' => 'default',
|
165 |
+
'style' => null, // 3.x
|
166 |
+
'class' => ''
|
167 |
+
), $atts );
|
168 |
+
if ( $atts['style'] !== null ) $atts['type'] = $atts['style'];
|
169 |
su_query_asset( 'css', 'su-content-shortcodes' );
|
170 |
return '<span class="su-label su-label-type-' . $atts['type'] . su_ecssc( $atts ) . '">' . $content . '</span>';
|
171 |
}
|
213 |
* @return string Output html
|
214 |
*/
|
215 |
function su_dropcap_shortcode( $atts, $content = null ) {
|
216 |
+
$atts = shortcode_atts( array(
|
217 |
+
'style' => 'default',
|
218 |
+
'size' => 3,
|
219 |
+
'class' => ''
|
220 |
+
), $atts );
|
221 |
+
$atts['style'] = str_replace( array( '1', '2', '3' ), array( 'default', 'light', 'default' ), $atts['style'] ); // 3.x
|
222 |
// Calculate font-size
|
223 |
$em = $atts['size'] * 0.5 . 'em';
|
224 |
su_query_asset( 'css', 'su-content-shortcodes' );
|
249 |
* @return string Output html
|
250 |
*/
|
251 |
function su_column_shortcode( $atts, $content = null ) {
|
252 |
+
$atts = shortcode_atts( array(
|
253 |
+
'size' => '1/2',
|
254 |
+
'last' => null,
|
255 |
+
'class' => ''
|
256 |
+
), $atts );
|
257 |
+
if ( $atts['last'] !== null && $atts['last'] == '1' ) $atts['class'] .= ' su-column-last';
|
258 |
su_query_asset( 'css', 'su-box-shortcodes' );
|
259 |
+
return '<div class="su-column su-column-size-' . str_replace( '/', '-', $atts['size'] ) . su_ecssc( $atts ) . '"><div class="su-column-inner">' . su_do_shortcode( $content, 'c' ) . '</div></div>';
|
|
|
260 |
}
|
261 |
|
262 |
/**
|
285 |
function su_button_shortcode( $atts, $content = null ) {
|
286 |
$atts = shortcode_atts( array(
|
287 |
'url' => get_option( 'home' ),
|
288 |
+
'link' => null, // 3.x
|
289 |
'target' => 'self',
|
290 |
'style' => 'default',
|
291 |
'background' => '#2D89EF',
|
292 |
'color' => '#FFFFFF',
|
293 |
+
'dark' => null,
|
294 |
'size' => 3,
|
295 |
'wide' => 'no',
|
296 |
'radius' => 'auto',
|
301 |
'class' => ''
|
302 |
), $atts );
|
303 |
|
304 |
+
if ( $atts['link'] !== null ) $atts['url'] = $atts['link'];
|
305 |
+
if ( $atts['dark'] !== null ) {
|
306 |
+
$atts['background'] = $atts['color'];
|
307 |
+
$atts['color'] = ( $atts['dark'] ) ? '#000' : '#fff';
|
308 |
+
}
|
309 |
+
$atts['style'] = str_replace( array( '1', '2', '3', '4', '5' ), array( 'default', 'glass', 'bubbles', 'noise', 'stroked' ), $atts['style'] ); // 3.x
|
310 |
+
|
311 |
// Prepare vars
|
312 |
$a_css = array();
|
313 |
$span_css = array();
|
421 |
*/
|
422 |
function su_service_shortcode( $atts, $content = null ) {
|
423 |
$shult = shortcodes_ultimate();
|
424 |
+
$atts = shortcode_atts( array(
|
425 |
+
'title' => __( 'Service title', 'su' ),
|
426 |
+
'icon' => $shult->assets( 'images', 'service.png' ),
|
427 |
+
'size' => 32,
|
428 |
+
'class' => ''
|
429 |
+
), $atts );
|
430 |
su_query_asset( 'css', 'su-box-shortcodes' );
|
431 |
+
return '<div class="su-service' . su_ecssc( $atts ) . '"><div class="su-service-title" style="padding:' . round( ( $atts['size'] - 16 ) / 2 ) . 'px 0 ' . round( ( $atts['size'] - 16 ) / 2 ) . 'px ' . ( $atts['size'] + 15 ) . 'px"><img src="' . $atts['icon'] . '" width="' . $atts['size'] . '" height="' . $atts['size'] . '" alt="' . $atts['title'] . '" /> ' . $atts['title'] . '</div><div class="su-service-content" style="padding:0 0 0 ' . ( $atts['size'] + 15 ) . 'px">' . do_shortcode( $content ) . '</div></div>';
|
|
|
|
|
|
|
|
|
|
|
432 |
}
|
433 |
|
434 |
/**
|
440 |
* @return string Output html
|
441 |
*/
|
442 |
function su_box_shortcode( $atts, $content = null ) {
|
443 |
+
$atts = shortcode_atts( array(
|
444 |
+
'title' => __( 'This is box title', 'su' ),
|
445 |
+
'style' => 'default',
|
446 |
+
'box_color' => '#333333',
|
447 |
'title_color' => '#FFFFFF',
|
448 |
+
'color' => null, // 3.x
|
449 |
+
'radius' => '3',
|
450 |
+
'class' => ''
|
451 |
+
), $atts );
|
452 |
+
if ( $atts['color'] !== null ) $atts['box_color'] = $atts['color'];
|
453 |
// Prepare border-radius
|
454 |
$radius = ( $atts['radius'] != '0' ) ?
|
455 |
'border-radius:' . $atts['radius'] . 'px;-moz-border-radius:' . $atts['radius'] .
|
478 |
* @return string Output html
|
479 |
*/
|
480 |
function su_note_shortcode( $atts, $content = null ) {
|
481 |
+
$atts = shortcode_atts( array(
|
482 |
+
'note_color' => '#FFFF66',
|
483 |
+
'text_color' => '#333333',
|
484 |
+
'background' => null, // 3.x
|
485 |
+
'color' => null, // 3.x
|
486 |
+
'radius' => '3',
|
487 |
+
'class' => ''
|
488 |
+
), $atts );
|
489 |
+
if ( $atts['color'] !== null ) $atts['note_color'] = $atts['color'];
|
490 |
+
if ( $atts['background'] !== null ) $atts['note_color'] = $atts['background'];
|
491 |
// Prepare border-radius
|
492 |
+
$radius = ( $atts['radius'] != '0' ) ? 'border-radius:' . $atts['radius'] . 'px;-moz-border-radius:' . $atts['radius'] . 'px;-webkit-border-radius:' . $atts['radius'] . 'px;' : '';
|
|
|
|
|
493 |
su_query_asset( 'css', 'su-box-shortcodes' );
|
494 |
+
return '<div class="su-note' . su_ecssc( $atts ) . '" style="border-color:' . su_hex_shift( $atts['note_color'], 'darker', 10 ) . ';' . $radius . '"><div class="su-note-inner" style="background-color:' . $atts['note_color'] . ';border-color:' . su_hex_shift( $atts['note_color'], 'lighter', 80 ) . ';color:' . $atts['text_color'] . ';' . $radius . '">' . su_do_shortcode( $content, 'n' ) . '</div></div>';
|
|
|
|
|
|
|
|
|
|
|
495 |
}
|
496 |
|
497 |
/**
|
739 |
* @return string Output html
|
740 |
*/
|
741 |
function su_permalink_shortcode( $atts, $content = null ) {
|
742 |
+
$atts = shortcode_atts( array(
|
743 |
+
'id' => 1,
|
744 |
+
'p' => null, // 3.x
|
745 |
+
'target' => 'self',
|
746 |
+
'class' => ''
|
747 |
+
), $atts );
|
748 |
+
if ( $atts['p'] !== null ) $atts['id'] = $atts['p'];
|
749 |
// Prepare link text
|
750 |
$text = ( $content ) ? $content : get_the_title( $atts['id'] );
|
751 |
+
return '<a href="' . get_permalink( $atts['id'] ) . '" class="' . su_ecssc( $atts ) . '" title="' . $text . '" target="_' . $atts['target'] . '">' . $text . '</a>';
|
|
|
|
|
752 |
}
|
753 |
|
754 |
/**
|
761 |
*/
|
762 |
function su_members_shortcode( $atts, $content = null ) {
|
763 |
$atts = shortcode_atts( array(
|
764 |
+
'message' => __( 'This content is for registered users only. Please %login%.', 'su' ),
|
765 |
+
'color' => '#ffcc00',
|
766 |
+
'style' => null, // 3.x
|
767 |
'login_text' => __( 'login', 'su' ),
|
768 |
+
'login_url' => wp_login_url(),
|
769 |
+
'login' => null, // 3.x
|
770 |
+
'class' => ''
|
771 |
), $atts );
|
772 |
+
if ( $atts['style'] !== null ) $atts['color'] = str_replace( array( '0', '1', '2' ), array( '#fff', '#FFFF29', '#1F9AFF' ), $atts['style'] );
|
773 |
// Check feed
|
774 |
if ( is_feed() ) return;
|
775 |
// Check authorization
|
776 |
if ( !is_user_logged_in() ) {
|
777 |
+
if ( $atts['login'] !== null && $atts['login'] == '0' ) return; // 3.x
|
778 |
// Prepare login link
|
779 |
$login = '<a href="' . esc_attr( $atts['login_url'] ) . '">' . $atts['login_text'] . '</a>';
|
780 |
su_query_asset( 'css', 'su-other-shortcodes' );
|
907 |
* @return string Output html
|
908 |
*/
|
909 |
function su_document_shortcode( $atts, $content = null ) {
|
910 |
+
$atts = shortcode_atts( array(
|
911 |
+
'url' => '',
|
912 |
+
'file' => null, // 3.x
|
913 |
+
'width' => 600,
|
914 |
+
'height' => 400,
|
915 |
'responsive' => 'yes',
|
916 |
+
'class' => ''
|
917 |
+
), $atts );
|
918 |
+
if ( $atts['file'] !== null ) $atts['url'] = $atts['file'];
|
919 |
su_query_asset( 'css', 'su-media-shortcodes' );
|
920 |
+
return '<div class="su-document su-responsive-media-' . $atts['responsive'] . '"><iframe src="http://docs.google.com/viewer?embedded=true&url=' . $atts['url'] . '" width="' . $atts['width'] . '" height="' . $atts['height'] . '" class="su-document' . su_ecssc( $atts ) . '"></iframe></div>';
|
|
|
|
|
|
|
|
|
921 |
}
|
922 |
|
923 |
/**
|
929 |
* @return string Output html
|
930 |
*/
|
931 |
function su_gmap_shortcode( $atts, $content = null ) {
|
932 |
+
$atts = shortcode_atts( array(
|
933 |
+
'width' => 600,
|
934 |
+
'height' => 400,
|
935 |
'responsive' => 'yes',
|
936 |
+
'address' => 'New York',
|
937 |
+
'class' => ''
|
938 |
+
), $atts );
|
939 |
su_query_asset( 'css', 'su-media-shortcodes' );
|
940 |
+
return '<div class="su-gmap su-responsive-media-' . $atts['responsive'] . su_ecssc( $atts ) . '"><iframe width="' . $atts['width'] . '" height="' . $atts['height'] . '" src="http://maps.google.com/maps?q=' . urlencode( $atts['address'] ) . '&output=embed"></iframe></div>';
|
|
|
|
|
|
|
941 |
}
|
942 |
|
943 |
/**
|
966 |
'speed' => 600,
|
967 |
'target' => 'yes',
|
968 |
'class' => ''
|
969 |
+
), $atts );
|
970 |
// Prepare unique ID
|
971 |
$id = uniqid( 'su_slider_' );
|
972 |
// Links target
|
1052 |
'speed' => 600,
|
1053 |
'target' => 'yes',
|
1054 |
'class' => ''
|
1055 |
+
), $atts );
|
1056 |
// Prepare unique ID
|
1057 |
$id = uniqid( 'su_carousel_' );
|
1058 |
// Links target
|
1129 |
'title' => 'hover',
|
1130 |
'target' => 'yes',
|
1131 |
'class' => ''
|
1132 |
+
), $atts );
|
1133 |
// Links target
|
1134 |
$target = ( $atts['target'] === 'yes' ) ? ' target="_blank"' : '';
|
1135 |
// Prepare gallery
|
inc/core/tools.php
CHANGED
@@ -1,715 +1,715 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Csv files parser
|
5 |
-
* Converts csv-files to html-tables
|
6 |
-
*
|
7 |
-
* @param type $file File url to parse
|
8 |
-
*/
|
9 |
-
function su_parse_csv( $file ) {
|
10 |
-
$csv_lines = file( $file );
|
11 |
-
if ( is_array( $csv_lines ) ) {
|
12 |
-
$cnt = count( $csv_lines );
|
13 |
-
for ( $i = 0; $i < $cnt; $i++ ) {
|
14 |
-
$line = $csv_lines[$i];
|
15 |
-
$line = trim( $line );
|
16 |
-
$first_char = true;
|
17 |
-
$col_num = 0;
|
18 |
-
$length = strlen( $line );
|
19 |
-
for ( $b = 0; $b < $length; $b++ ) {
|
20 |
-
if ( $skip_char != true ) {
|
21 |
-
$process = true;
|
22 |
-
if ( $first_char == true ) {
|
23 |
-
if ( $line[$b] == '"' ) {
|
24 |
-
$terminator = '";';
|
25 |
-
$process = false;
|
26 |
-
}
|
27 |
-
else
|
28 |
-
$terminator = ';';
|
29 |
-
$first_char = false;
|
30 |
-
}
|
31 |
-
if ( $line[$b] == '"' ) {
|
32 |
-
$next_char = $line[$b + 1];
|
33 |
-
if ( $next_char == '"' ) $skip_char = true;
|
34 |
-
elseif ( $next_char == ';' ) {
|
35 |
-
if ( $terminator == '";' ) {
|
36 |
-
$first_char = true;
|
37 |
-
$process = false;
|
38 |
-
$skip_char = true;
|
39 |
-
}
|
40 |
-
}
|
41 |
-
}
|
42 |
-
if ( $process == true ) {
|
43 |
-
if ( $line[$b] == ';' ) {
|
44 |
-
if ( $terminator == ';' ) {
|
45 |
-
$first_char = true;
|
46 |
-
$process = false;
|
47 |
-
}
|
48 |
-
}
|
49 |
-
}
|
50 |
-
if ( $process == true ) $column .= $line[$b];
|
51 |
-
if ( $b == ( $length - 1 ) ) $first_char = true;
|
52 |
-
if ( $first_char == true ) {
|
53 |
-
$values[$i][$col_num] = $column;
|
54 |
-
$column = '';
|
55 |
-
$col_num++;
|
56 |
-
}
|
57 |
-
}
|
58 |
-
else
|
59 |
-
$skip_char = false;
|
60 |
-
}
|
61 |
-
}
|
62 |
-
}
|
63 |
-
$return = '<table><tr>';
|
64 |
-
foreach ( $values[0] as $value ) $return .= '<th>' . $value . '</th>';
|
65 |
-
$return .= '</tr>';
|
66 |
-
array_shift( $values );
|
67 |
-
foreach ( $values as $rows ) {
|
68 |
-
$return .= '<tr>';
|
69 |
-
foreach ( $rows as $col ) {
|
70 |
-
$return .= '<td>' . $col . '</td>';
|
71 |
-
}
|
72 |
-
$return .= '</tr>';
|
73 |
-
}
|
74 |
-
$return .= '</table>';
|
75 |
-
return $return;
|
76 |
-
}
|
77 |
-
|
78 |
-
/**
|
79 |
-
* Color shift a hex value by a specific percentage factor
|
80 |
-
*
|
81 |
-
* @param string $supplied_hex Any valid hex value. Short forms e.g. #333 accepted.
|
82 |
-
* @param string $shift_method How to shift the value e.g( +,up,lighter,>)
|
83 |
-
* @param integer $percentage Percentage in range of [0-100] to shift provided hex value by
|
84 |
-
*
|
85 |
-
* @return string shifted hex value
|
86 |
-
* @version 1.0 2008-03-28
|
87 |
-
*/
|
88 |
-
function su_hex_shift( $supplied_hex, $shift_method, $percentage = 50 ) {
|
89 |
-
$shifted_hex_value = null;
|
90 |
-
$valid_shift_option = false;
|
91 |
-
$current_set = 1;
|
92 |
-
$RGB_values = array();
|
93 |
-
$valid_shift_up_args = array( 'up', '+', 'lighter', '>' );
|
94 |
-
$valid_shift_down_args = array( 'down', '-', 'darker', '<' );
|
95 |
-
$shift_method = strtolower( trim( $shift_method ) );
|
96 |
-
// Check Factor
|
97 |
-
if ( !is_numeric( $percentage ) || ( $percentage = ( int ) $percentage ) < 0 || $percentage > 100
|
98 |
-
) trigger_error( "Invalid factor", E_USER_NOTICE );
|
99 |
-
// Check shift method
|
100 |
-
foreach ( array( $valid_shift_down_args, $valid_shift_up_args ) as $options ) {
|
101 |
-
foreach ( $options as $method ) {
|
102 |
-
if ( $method == $shift_method ) {
|
103 |
-
$valid_shift_option = !$valid_shift_option;
|
104 |
-
$shift_method = ( $current_set === 1 ) ? '+' : '-';
|
105 |
-
break 2;
|
106 |
-
}
|
107 |
-
}
|
108 |
-
++$current_set;
|
109 |
-
}
|
110 |
-
if ( !$valid_shift_option ) trigger_error( "Invalid shift method", E_USER_NOTICE );
|
111 |
-
// Check Hex string
|
112 |
-
switch ( strlen( $supplied_hex = ( str_replace( '#', '', trim( $supplied_hex ) ) ) ) ) {
|
113 |
-
case 3:
|
114 |
-
if ( preg_match( '/^([0-9a-f])([0-9a-f])([0-9a-f])/i', $supplied_hex ) ) {
|
115 |
-
$supplied_hex = preg_replace( '/^([0-9a-f])([0-9a-f])([0-9a-f])/i', '\\1\\1\\2\\2\\3\\3',
|
116 |
-
$supplied_hex );
|
117 |
-
}
|
118 |
-
else {
|
119 |
-
trigger_error( "Invalid hex color value", E_USER_NOTICE );
|
120 |
-
}
|
121 |
-
break;
|
122 |
-
case 6:
|
123 |
-
if ( !preg_match( '/^[0-9a-f]{2}[0-9a-f]{2}[0-9a-f]{2}$/i', $supplied_hex ) ) {
|
124 |
-
trigger_error( "Invalid hex color value", E_USER_NOTICE );
|
125 |
-
}
|
126 |
-
break;
|
127 |
-
default:
|
128 |
-
trigger_error( "Invalid hex color length", E_USER_NOTICE );
|
129 |
-
}
|
130 |
-
// Start shifting
|
131 |
-
$RGB_values['R'] = hexdec( $supplied_hex{0} . $supplied_hex{1} );
|
132 |
-
$RGB_values['G'] = hexdec( $supplied_hex{2} . $supplied_hex{3} );
|
133 |
-
$RGB_values['B'] = hexdec( $supplied_hex{4} . $supplied_hex{5} );
|
134 |
-
foreach ( $RGB_values as $c => $v ) {
|
135 |
-
switch ( $shift_method ) {
|
136 |
-
case '-':
|
137 |
-
$amount = round( ( ( 255 - $v ) / 100 ) * $percentage ) + $v;
|
138 |
-
break;
|
139 |
-
case '+':
|
140 |
-
$amount = $v - round( ( $v / 100 ) * $percentage );
|
141 |
-
break;
|
142 |
-
default:
|
143 |
-
trigger_error( "Oops. Unexpected shift method", E_USER_NOTICE );
|
144 |
-
}
|
145 |
-
$shifted_hex_value .= $current_value = ( strlen( $decimal_to_hex = dechex( $amount ) ) < 2 ) ?
|
146 |
-
'0' . $decimal_to_hex : $decimal_to_hex;
|
147 |
-
}
|
148 |
-
return '#' . $shifted_hex_value;
|
149 |
-
}
|
150 |
-
|
151 |
-
/**
|
152 |
-
* Apply all custom formatting options of plugin
|
153 |
-
*/
|
154 |
-
function su_apply_formatting() {
|
155 |
-
// Get plugin object
|
156 |
-
global $shult;
|
157 |
-
// Enable shortcodes in text widgets
|
158 |
-
add_filter( 'widget_text', 'do_shortcode' );
|
159 |
-
// Enable shortcodes in category descriptions
|
160 |
-
add_filter( 'category_description', 'do_shortcode' );
|
161 |
-
// Enable auto-formatting
|
162 |
-
if ( $shult->get_option( 'custom_formatting' ) == 'on' ) {
|
163 |
-
// Disable WordPress native content formatters
|
164 |
-
remove_filter( 'the_content', 'wpautop' );
|
165 |
-
remove_filter( 'the_content', 'wptexturize' );
|
166 |
-
// Apply custom formatter function
|
167 |
-
add_filter( 'the_content', 'su_custom_formatter', 99 );
|
168 |
-
add_filter( 'widget_text', 'su_custom_formatter', 99 );
|
169 |
-
add_filter( 'category_description', 'su_custom_formatter', 99 );
|
170 |
-
}
|
171 |
-
// Fix for large posts, http://core.trac.wordpress.org/ticket/8553
|
172 |
-
@ini_set( 'pcre.backtrack_limit', 500000 );
|
173 |
-
}
|
174 |
-
|
175 |
-
add_action( 'init', 'su_apply_formatting' );
|
176 |
-
|
177 |
-
/**
|
178 |
-
* Custom formatter function
|
179 |
-
*
|
180 |
-
* @param string $content
|
181 |
-
*
|
182 |
-
* @return string Formatted content with clean shortcodes content
|
183 |
-
*/
|
184 |
-
function su_custom_formatter( $content ) {
|
185 |
-
// Prepare variables
|
186 |
-
$new_content = '';
|
187 |
-
// Matches the contents and the open and closing tags
|
188 |
-
$pattern_full = '{(\[raw\].*?\[/raw\])}is';
|
189 |
-
// Matches just the contents
|
190 |
-
$pattern_contents = '{\[raw\](.*?)\[/raw\]}is';
|
191 |
-
// Divide content into pieces
|
192 |
-
$pieces = preg_split( $pattern_full, $content, -1, PREG_SPLIT_DELIM_CAPTURE );
|
193 |
-
// Loop over pieces
|
194 |
-
foreach ( $pieces as $piece ) {
|
195 |
-
// Look for presence of the shortcode, Append to content (no formatting)
|
196 |
-
if ( preg_match( $pattern_contents, $piece, $matches ) ) $new_content .= $matches[1];
|
197 |
-
// Format and append to content
|
198 |
-
else $new_content .= wptexturize( wpautop( $piece ) );
|
199 |
-
}
|
200 |
-
// Return formatted content
|
201 |
-
return $new_content;
|
202 |
-
}
|
203 |
-
|
204 |
-
/**
|
205 |
-
* Custom do_shortcode function for nested shortcodes
|
206 |
-
*
|
207 |
-
* @param string $content Shortcode content
|
208 |
-
* @param string $pre First shortcode letter
|
209 |
-
*
|
210 |
-
* @return string Formatted content
|
211 |
-
*/
|
212 |
-
function su_do_shortcode( $content, $pre ) {
|
213 |
-
if ( strpos( $content, '[_' ) !== false ) $content = preg_replace( '@(\[_*)_(' . $pre . '|/)@', "$1$2", $content );
|
214 |
-
return do_shortcode( $content );
|
215 |
-
}
|
216 |
-
|
217 |
-
/**
|
218 |
-
* Shortcode names prefix in compatibility mode
|
219 |
-
*
|
220 |
-
* @return string Special prefix
|
221 |
-
*/
|
222 |
-
function su_compatibility_mode_prefix() {
|
223 |
-
global $shult;
|
224 |
-
$option = get_option( 'su_compatibility_mode_prefix' );
|
225 |
-
if ( $shult->get_option( 'compatibility_mode' ) === 'on' ) return ( $option ) ? $option : 'su_';
|
226 |
-
else return '';
|
227 |
-
}
|
228 |
-
|
229 |
-
/**
|
230 |
-
* Tweet relative time (like: 5 seconds ago)
|
231 |
-
*/
|
232 |
-
function su_rel_time( $original, $do_more = 0 ) {
|
233 |
-
// array of time period chunks
|
234 |
-
$chunks = array( array( 60 * 60 * 24 * 365, __( 'year', 'su' ) ),
|
235 |
-
array( 60 * 60 * 24 * 30, __( 'month', 'su' ) ),
|
236 |
-
array( 60 * 60 * 24 * 7, __( 'week', 'su' ) ),
|
237 |
-
array( 60 * 60 * 24, __( 'day', 'su' ) ),
|
238 |
-
array( 60 * 60, __( 'hour', 'su' ) ),
|
239 |
-
array( 60, __( 'minute', 'su' ) ), );
|
240 |
-
$today = time();
|
241 |
-
$since = $today - $original;
|
242 |
-
for ( $i = 0, $j = count( $chunks ); $i < $j; $i++ ) {
|
243 |
-
$seconds = $chunks[$i][0];
|
244 |
-
$name = $chunks[$i][1];
|
245 |
-
|
246 |
-
if ( ( $count = floor( $since / $seconds ) ) != 0 ) break;
|
247 |
-
}
|
248 |
-
$return = ( $count == 1 ) ? '1 ' . $name : "$count {$name}" . __( 's', 'su' );
|
249 |
-
if ( $i + 1 < $j ) {
|
250 |
-
$seconds2 = $chunks[$i + 1][0];
|
251 |
-
$name2 = $chunks[$i + 1][1];
|
252 |
-
|
253 |
-
// add second item if it's greater than 0
|
254 |
-
if ( ( ( $count2 = floor( ( $since - ( $seconds * $count ) ) / $seconds2 ) ) != 0 ) && $do_more
|
255 |
-
) $return .= ( $count2 == 1 ) ? ', 1 ' . $name2 : ", $count2 {$name2}" . __( 's', 'su' );
|
256 |
-
}
|
257 |
-
return $return;
|
258 |
-
}
|
259 |
-
|
260 |
-
/**
|
261 |
-
* Add hyperlinks to tweets
|
262 |
-
*/
|
263 |
-
function su_parse_links( $text ) {
|
264 |
-
// Props to Allen Shaw & webmancers.com
|
265 |
-
// match protocol://address/path/file.extension?some=variable&another=asf%
|
266 |
-
$text = preg_replace( '/\b([a-zA-Z]+:\/\/[\w_.\-]+\.[a-zA-Z]{2,6}[\/\w\-~.?=&%#+$*!]*)\b/i',
|
267 |
-
"<a href=\"$1\" class=\"twitter-link\">$1</a>", $text );
|
268 |
-
// match www.something.domain/path/file.extension?some=variable&another=asf%
|
269 |
-
$text = preg_replace( '/\b(?<!:\/\/)(www\.[\w_.\-]+\.[a-zA-Z]{2,6}[\/\w\-~.?=&%#+$*!]*)\b/i',
|
270 |
-
"<a href=\"http://$1\" class=\"twitter-link\">$1</a>", $text );
|
271 |
-
|
272 |
-
// match name@address
|
273 |
-
$text = preg_replace( "/\b([a-zA-Z][a-zA-Z0-9\_\.\-]*[a-zA-Z]*\@[a-zA-Z][a-zA-Z0-9\_\.\-]*[a-zA-Z]{2,6})\b/i",
|
274 |
-
"<a href=\"mailto://$1\" class=\"twitter-link\">$1</a>", $text );
|
275 |
-
//mach #trendingtopics. Props to Michael Voigt
|
276 |
-
$text = preg_replace( '/([\.|\,|\:|\¡|\¿|\>|\{|\(]?)#{1}(\w*)([\.|\,|\:|\!|\?|\>|\}|\)]?)\s/i',
|
277 |
-
"$1<a href=\"http://twitter.com/#search?q=$2\" class=\"twitter-link\">#$2</a>$3 ",
|
278 |
-
$text );
|
279 |
-
return $text;
|
280 |
-
}
|
281 |
-
|
282 |
-
/**
|
283 |
-
* Get tweets by username
|
284 |
-
*/
|
285 |
-
function su_get_tweets( $username, $limit, $show_time ) {
|
286 |
-
// Get tweets
|
287 |
-
$tweets = json_decode( file_get_contents( 'https://api.twitter.com/1/statuses/user_timeline.json?screen_name=' .
|
288 |
-
$username . '&count=' . $limit ) );
|
289 |
-
// No username
|
290 |
-
if ( !$username ) {
|
291 |
-
$return = __( 'username not specified', 'su' );
|
292 |
-
$error = true;
|
293 |
-
}
|
294 |
-
// No messages
|
295 |
-
if ( !count( $tweets ) ) {
|
296 |
-
$return = __( 'no public messages', 'su' );
|
297 |
-
$error = true;
|
298 |
-
}
|
299 |
-
// Loop tweets
|
300 |
-
if ( count( $tweets ) ) foreach ( $tweets as $num => $tweet ) {
|
301 |
-
// Prepare relative time
|
302 |
-
$time = ( $show_time ) ?
|
303 |
-
'<span class="su-tweet-time">' . su_rel_time( strtotime( $tweet->created_at ) ) . '</span>' : '';
|
304 |
-
// Prepare last tweet class
|
305 |
-
$last_tweet_class = ( $num == ( $limit - 1 ) ) ? ' su-tweet-last' : '';
|
306 |
-
// Prepare markup
|
307 |
-
$return = '<div class="su-tweet' . $last_tweet_class . '">';
|
308 |
-
$return .=
|
309 |
-
'<a href="http://twitter.com/' . $username . '" class="su-tweet-username">@' . $username . '</a>: ';
|
310 |
-
$return .= su_parse_links( $tweet->text );
|
311 |
-
$return .= $time;
|
312 |
-
$return .= '</div>';
|
313 |
-
}
|
314 |
-
// Return results
|
315 |
-
return ( $error ) ? '<p class="su-error"><strong>Tweets:</strong> ' . $return . '</p>' : $return;
|
316 |
-
}
|
317 |
-
|
318 |
-
function su_get_categories() {
|
319 |
-
$cats = array();
|
320 |
-
foreach ( ( array ) get_terms( 'category' ) as $cat ) {
|
321 |
-
$cats[$cat->slug] = $cat->name;
|
322 |
-
}
|
323 |
-
return $cats;
|
324 |
-
}
|
325 |
-
|
326 |
-
function su_get_post_types() {
|
327 |
-
$types = array();
|
328 |
-
foreach ( ( array ) get_post_types( '', 'objects' ) as $cpt => $cpt_data ) {
|
329 |
-
$types[$cpt] = $cpt_data->label;
|
330 |
-
}
|
331 |
-
return $types;
|
332 |
-
}
|
333 |
-
|
334 |
-
function su_get_users() {
|
335 |
-
$users = array();
|
336 |
-
foreach ( ( array ) get_users() as $user ) {
|
337 |
-
$users[$user->ID] = $user->data->display_name;
|
338 |
-
}
|
339 |
-
return $users;
|
340 |
-
}
|
341 |
-
|
342 |
-
function su_get_taxonomies( $first = false ) {
|
343 |
-
$taxes = array();
|
344 |
-
foreach ( ( array ) get_taxonomies( '', 'objects' ) as $tax ) {
|
345 |
-
$taxes[$tax->name] = $tax->label;
|
346 |
-
}
|
347 |
-
// Return only first taxonomy name
|
348 |
-
if ( $first ) {
|
349 |
-
reset( $taxes );
|
350 |
-
return key( $taxes );
|
351 |
-
}
|
352 |
-
return $taxes;
|
353 |
-
}
|
354 |
-
|
355 |
-
function su_get_terms( $taxonomy ) {
|
356 |
-
$terms = array();
|
357 |
-
// Get the terms
|
358 |
-
foreach ( ( array ) get_terms( $taxonomy ) as $term ) {
|
359 |
-
$terms[$term->slug] = $term->name;
|
360 |
-
}
|
361 |
-
return $terms;
|
362 |
-
}
|
363 |
-
|
364 |
-
/**
|
365 |
-
* Extra CSS class helper
|
366 |
-
*
|
367 |
-
* @param array $atts Shortcode attributes
|
368 |
-
*
|
369 |
-
* @return string
|
370 |
-
*/
|
371 |
-
function su_ecssc( $atts ) {
|
372 |
-
return ( $atts['class'] ) ? ' ' . $atts['class'] : '';
|
373 |
-
}
|
374 |
-
|
375 |
-
/**
|
376 |
-
* Resizes an image and returns an array containing the resized URL, width, height and file type. Uses native Wordpress functionality.
|
377 |
-
*
|
378 |
-
* @author Matthew Ruddy (http://easinglider.com)
|
379 |
-
* @return array An array containing the resized image URL, width, height and file type.
|
380 |
-
*/
|
381 |
-
function su_image_resize( $url, $width = NULL, $height = NULL, $crop = true, $retina = false ) {
|
382 |
-
global $wp_version;
|
383 |
-
|
384 |
-
//######################################################################
|
385 |
-
// First implementation
|
386 |
-
//######################################################################
|
387 |
-
if ( isset( $wp_version ) && version_compare( $wp_version, '3.5' ) >= 0 ) {
|
388 |
-
|
389 |
-
global $wpdb;
|
390 |
-
|
391 |
-
if ( empty( $url ) )
|
392 |
-
return new WP_Error( 'no_image_url', 'No image URL has been entered.', $url );
|
393 |
-
|
394 |
-
// Get default size from database
|
395 |
-
$width = ( $width ) ? $width : get_option( 'thumbnail_size_w' );
|
396 |
-
$height = ( $height ) ? $height : get_option( 'thumbnail_size_h' );
|
397 |
-
|
398 |
-
// Allow for different retina sizes
|
399 |
-
$retina = $retina ? ( $retina === true ? 2 : $retina ) : 1;
|
400 |
-
|
401 |
-
// Get the image file path
|
402 |
-
$file_path = parse_url( $url );
|
403 |
-
$file_path = $_SERVER['DOCUMENT_ROOT'] . $file_path['path'];
|
404 |
-
|
405 |
-
// Check for Multisite
|
406 |
-
if ( is_multisite() ) {
|
407 |
-
global $blog_id;
|
408 |
-
$blog_details = get_blog_details( $blog_id );
|
409 |
-
$file_path = str_replace( $blog_details->path . 'files/', '/wp-content/blogs.dir/' . $blog_id . '/files/', $file_path );
|
410 |
-
}
|
411 |
-
|
412 |
-
// Destination width and height variables
|
413 |
-
$dest_width = $width * $retina;
|
414 |
-
$dest_height = $height * $retina;
|
415 |
-
|
416 |
-
// File name suffix (appended to original file name)
|
417 |
-
$suffix = "{$dest_width}x{$dest_height}";
|
418 |
-
|
419 |
-
// Some additional info about the image
|
420 |
-
$info = pathinfo( $file_path );
|
421 |
-
$dir = $info['dirname'];
|
422 |
-
$ext = $info['extension'];
|
423 |
-
$name = wp_basename( $file_path, ".$ext" );
|
424 |
-
|
425 |
-
// Suffix applied to filename
|
426 |
-
$suffix = "{$dest_width}x{$dest_height}";
|
427 |
-
|
428 |
-
// Get the destination file name
|
429 |
-
$dest_file_name = "{$dir}/{$name}-{$suffix}.{$ext}";
|
430 |
-
|
431 |
-
if ( !file_exists( $dest_file_name ) ) {
|
432 |
-
|
433 |
-
/*
|
434 |
-
* Bail if this image isn't in the Media Library.
|
435 |
-
* We only want to resize Media Library images, so we can be sure they get deleted correctly when appropriate.
|
436 |
-
*/
|
437 |
-
$query = $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE guid='%s'", $url );
|
438 |
-
$get_attachment = $wpdb->get_results( $query );
|
439 |
-
if ( !$get_attachment )
|
440 |
-
return array( 'url' => $url, 'width' => $width, 'height' => $height );
|
441 |
-
|
442 |
-
// Load Wordpress Image Editor
|
443 |
-
$editor = wp_get_image_editor( $file_path );
|
444 |
-
if ( is_wp_error( $editor ) )
|
445 |
-
return array( 'url' => $url, 'width' => $width, 'height' => $height );
|
446 |
-
|
447 |
-
// Get the original image size
|
448 |
-
$size = $editor->get_size();
|
449 |
-
$orig_width = $size['width'];
|
450 |
-
$orig_height = $size['height'];
|
451 |
-
|
452 |
-
$src_x = $src_y = 0;
|
453 |
-
$src_w = $orig_width;
|
454 |
-
$src_h = $orig_height;
|
455 |
-
|
456 |
-
if ( $crop ) {
|
457 |
-
|
458 |
-
$cmp_x = $orig_width / $dest_width;
|
459 |
-
$cmp_y = $orig_height / $dest_height;
|
460 |
-
|
461 |
-
// Calculate x or y coordinate, and width or height of source
|
462 |
-
if ( $cmp_x > $cmp_y ) {
|
463 |
-
$src_w = round( $orig_width / $cmp_x * $cmp_y );
|
464 |
-
$src_x = round( ( $orig_width - ( $orig_width / $cmp_x * $cmp_y ) ) / 2 );
|
465 |
-
}
|
466 |
-
else if ( $cmp_y > $cmp_x ) {
|
467 |
-
$src_h = round( $orig_height / $cmp_y * $cmp_x );
|
468 |
-
$src_y = round( ( $orig_height - ( $orig_height / $cmp_y * $cmp_x ) ) / 2 );
|
469 |
-
}
|
470 |
-
}
|
471 |
-
|
472 |
-
// Time to crop the image!
|
473 |
-
$editor->crop( $src_x, $src_y, $src_w, $src_h, $dest_width, $dest_height );
|
474 |
-
|
475 |
-
// Now let's save the image
|
476 |
-
$saved = $editor->save( $dest_file_name );
|
477 |
-
|
478 |
-
// Get resized image information
|
479 |
-
$resized_url = str_replace( basename( $url ), basename( $saved['path'] ), $url );
|
480 |
-
$resized_width = $saved['width'];
|
481 |
-
$resized_height = $saved['height'];
|
482 |
-
$resized_type = $saved['mime-type'];
|
483 |
-
|
484 |
-
// Add the resized dimensions to original image metadata (so we can delete our resized images when the original image is delete from the Media Library)
|
485 |
-
$metadata = wp_get_attachment_metadata( $get_attachment[0]->ID );
|
486 |
-
if ( isset( $metadata['image_meta'] ) ) {
|
487 |
-
$metadata['image_meta']['resized_images'][] = $resized_width . 'x' . $resized_height;
|
488 |
-
wp_update_attachment_metadata( $get_attachment[0]->ID, $metadata );
|
489 |
-
}
|
490 |
-
|
491 |
-
// Create the image array
|
492 |
-
$image_array = array(
|
493 |
-
'url' => $resized_url,
|
494 |
-
'width' => $resized_width,
|
495 |
-
'height' => $resized_height,
|
496 |
-
'type' => $resized_type
|
497 |
-
);
|
498 |
-
}
|
499 |
-
else {
|
500 |
-
$image_array = array(
|
501 |
-
'url' => str_replace( basename( $url ), basename( $dest_file_name ), $url ),
|
502 |
-
'width' => $dest_width,
|
503 |
-
'height' => $dest_height,
|
504 |
-
'type' => $ext
|
505 |
-
);
|
506 |
-
}
|
507 |
-
|
508 |
-
// Return image array
|
509 |
-
return $image_array;
|
510 |
-
}
|
511 |
-
|
512 |
-
//######################################################################
|
513 |
-
// Second implementation
|
514 |
-
//######################################################################
|
515 |
-
else {
|
516 |
-
global $wpdb;
|
517 |
-
|
518 |
-
if ( empty( $url ) )
|
519 |
-
return new WP_Error( 'no_image_url', 'No image URL has been entered.', $url );
|
520 |
-
|
521 |
-
// Bail if GD Library doesn't exist
|
522 |
-
if ( !extension_loaded( 'gd' ) || !function_exists( 'gd_info' ) )
|
523 |
-
return array( 'url' => $url, 'width' => $width, 'height' => $height );
|
524 |
-
|
525 |
-
// Get default size from database
|
526 |
-
$width = ( $width ) ? $width : get_option( 'thumbnail_size_w' );
|
527 |
-
$height = ( $height ) ? $height : get_option( 'thumbnail_size_h' );
|
528 |
-
|
529 |
-
// Allow for different retina sizes
|
530 |
-
$retina = $retina ? ( $retina === true ? 2 : $retina ) : 1;
|
531 |
-
|
532 |
-
// Destination width and height variables
|
533 |
-
$dest_width = $width * $retina;
|
534 |
-
$dest_height = $height * $retina;
|
535 |
-
|
536 |
-
// Get image file path
|
537 |
-
$file_path = parse_url( $url );
|
538 |
-
$file_path = $_SERVER['DOCUMENT_ROOT'] . $file_path['path'];
|
539 |
-
|
540 |
-
// Check for Multisite
|
541 |
-
if ( is_multisite() ) {
|
542 |
-
global $blog_id;
|
543 |
-
$blog_details = get_blog_details( $blog_id );
|
544 |
-
$file_path = str_replace( $blog_details->path . 'files/', '/wp-content/blogs.dir/' . $blog_id . '/files/', $file_path );
|
545 |
-
}
|
546 |
-
|
547 |
-
// Some additional info about the image
|
548 |
-
$info = pathinfo( $file_path );
|
549 |
-
$dir = $info['dirname'];
|
550 |
-
$ext = $info['extension'];
|
551 |
-
$name = wp_basename( $file_path, ".$ext" );
|
552 |
-
|
553 |
-
// Suffix applied to filename
|
554 |
-
$suffix = "{$dest_width}x{$dest_height}";
|
555 |
-
|
556 |
-
// Get the destination file name
|
557 |
-
$dest_file_name = "{$dir}/{$name}-{$suffix}.{$ext}";
|
558 |
-
|
559 |
-
// No need to resize & create a new image if it already exists!
|
560 |
-
if ( !file_exists( $dest_file_name ) ) {
|
561 |
-
|
562 |
-
/*
|
563 |
-
* Bail if this image isn't in the Media Library either.
|
564 |
-
* We only want to resize Media Library images, so we can be sure they get deleted correctly when appropriate.
|
565 |
-
*/
|
566 |
-
$query = $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE guid='%s'", $url );
|
567 |
-
$get_attachment = $wpdb->get_results( $query );
|
568 |
-
if ( !$get_attachment )
|
569 |
-
return array( 'url' => $url, 'width' => $width, 'height' => $height );
|
570 |
-
|
571 |
-
$image = wp_load_image( $file_path );
|
572 |
-
if ( !is_resource( $image ) )
|
573 |
-
return new WP_Error( 'error_loading_image_as_resource', $image, $file_path );
|
574 |
-
|
575 |
-
// Get the current image dimensions and type
|
576 |
-
$size = @getimagesize( $file_path );
|
577 |
-
if ( !$size )
|
578 |
-
return new WP_Error( 'file_path_getimagesize_failed', 'Failed to get $file_path information using getimagesize.' );
|
579 |
-
list( $orig_width, $orig_height, $orig_type ) = $size;
|
580 |
-
|
581 |
-
// Create new image
|
582 |
-
$new_image = wp_imagecreatetruecolor( $dest_width, $dest_height );
|
583 |
-
|
584 |
-
// Do some proportional cropping if enabled
|
585 |
-
if ( $crop ) {
|
586 |
-
|
587 |
-
$src_x = $src_y = 0;
|
588 |
-
$src_w = $orig_width;
|
589 |
-
$src_h = $orig_height;
|
590 |
-
|
591 |
-
$cmp_x = $orig_width / $dest_width;
|
592 |
-
$cmp_y = $orig_height / $dest_height;
|
593 |
-
|
594 |
-
// Calculate x or y coordinate, and width or height of source
|
595 |
-
if ( $cmp_x > $cmp_y ) {
|
596 |
-
$src_w = round( $orig_width / $cmp_x * $cmp_y );
|
597 |
-
$src_x = round( ( $orig_width - ( $orig_width / $cmp_x * $cmp_y ) ) / 2 );
|
598 |
-
}
|
599 |
-
else if ( $cmp_y > $cmp_x ) {
|
600 |
-
$src_h = round( $orig_height / $cmp_y * $cmp_x );
|
601 |
-
$src_y = round( ( $orig_height - ( $orig_height / $cmp_y * $cmp_x ) ) / 2 );
|
602 |
-
}
|
603 |
-
|
604 |
-
// Create the resampled image
|
605 |
-
imagecopyresampled( $new_image, $image, 0, 0, $src_x, $src_y, $dest_width, $dest_height, $src_w, $src_h );
|
606 |
-
}
|
607 |
-
else
|
608 |
-
imagecopyresampled( $new_image, $image, 0, 0, 0, 0, $dest_width, $dest_height, $orig_width, $orig_height );
|
609 |
-
|
610 |
-
// Convert from full colors to index colors, like original PNG.
|
611 |
-
if ( IMAGETYPE_PNG == $orig_type && function_exists( 'imageistruecolor' ) && !imageistruecolor( $image ) )
|
612 |
-
imagetruecolortopalette( $new_image, false, imagecolorstotal( $image ) );
|
613 |
-
|
614 |
-
// Remove the original image from memory (no longer needed)
|
615 |
-
imagedestroy( $image );
|
616 |
-
|
617 |
-
// Check the image is the correct file type
|
618 |
-
if ( IMAGETYPE_GIF == $orig_type ) {
|
619 |
-
if ( !imagegif( $new_image, $dest_file_name ) )
|
620 |
-
return new WP_Error( 'resize_path_invalid', 'Resize path invalid (GIF)' );
|
621 |
-
}
|
622 |
-
elseif ( IMAGETYPE_PNG == $orig_type ) {
|
623 |
-
if ( !imagepng( $new_image, $dest_file_name ) )
|
624 |
-
return new WP_Error( 'resize_path_invalid', 'Resize path invalid (PNG).' );
|
625 |
-
}
|
626 |
-
else {
|
627 |
-
|
628 |
-
// All other formats are converted to jpg
|
629 |
-
if ( 'jpg' != $ext && 'jpeg' != $ext )
|
630 |
-
$dest_file_name = "{$dir}/{$name}-{$suffix}.jpg";
|
631 |
-
if ( !imagejpeg( $new_image, $dest_file_name, apply_filters( 'resize_jpeg_quality', 90 ) ) )
|
632 |
-
return new WP_Error( 'resize_path_invalid', 'Resize path invalid (JPG).' );
|
633 |
-
}
|
634 |
-
|
635 |
-
// Remove new image from memory (no longer needed as well)
|
636 |
-
imagedestroy( $new_image );
|
637 |
-
|
638 |
-
// Set correct file permissions
|
639 |
-
$stat = stat( dirname( $dest_file_name ) );
|
640 |
-
$perms = $stat['mode'] & 0000666;
|
641 |
-
@chmod( $dest_file_name, $perms );
|
642 |
-
|
643 |
-
// Get some information about the resized image
|
644 |
-
$new_size = @getimagesize( $dest_file_name );
|
645 |
-
if ( !$new_size )
|
646 |
-
return new WP_Error( 'resize_path_getimagesize_failed', 'Failed to get $dest_file_name (resized image) info via @getimagesize', $dest_file_name );
|
647 |
-
list( $resized_width, $resized_height, $resized_type ) = $new_size;
|
648 |
-
|
649 |
-
// Get the new image URL
|
650 |
-
$resized_url = str_replace( basename( $url ), basename( $dest_file_name ), $url );
|
651 |
-
|
652 |
-
// Add the resized dimensions to original image metadata (so we can delete our resized images when the original image is delete from the Media Library)
|
653 |
-
$metadata = wp_get_attachment_metadata( $get_attachment[0]->ID );
|
654 |
-
if ( isset( $metadata['image_meta'] ) ) {
|
655 |
-
$metadata['image_meta']['resized_images'][] = $resized_width . 'x' . $resized_height;
|
656 |
-
wp_update_attachment_metadata( $get_attachment[0]->ID, $metadata );
|
657 |
-
}
|
658 |
-
|
659 |
-
// Return array with resized image information
|
660 |
-
$image_array = array(
|
661 |
-
'url' => $resized_url,
|
662 |
-
'width' => $resized_width,
|
663 |
-
'height' => $resized_height,
|
664 |
-
'type' => $resized_type
|
665 |
-
);
|
666 |
-
}
|
667 |
-
else {
|
668 |
-
$image_array = array(
|
669 |
-
'url' => str_replace( basename( $url ), basename( $dest_file_name ), $url ),
|
670 |
-
'width' => $dest_width,
|
671 |
-
'height' => $dest_height,
|
672 |
-
'type' => $ext
|
673 |
-
);
|
674 |
-
}
|
675 |
-
|
676 |
-
return $image_array;
|
677 |
-
}
|
678 |
-
}
|
679 |
-
|
680 |
-
/**
|
681 |
-
* Deletes the resized images when the original image is deleted from the Wordpress Media Library.
|
682 |
-
*
|
683 |
-
* @author Matthew Ruddy
|
684 |
-
*/
|
685 |
-
function su_delete_resized_images( $post_id ) {
|
686 |
-
|
687 |
-
// Get attachment image metadata
|
688 |
-
$metadata = wp_get_attachment_metadata( $post_id );
|
689 |
-
if ( !$metadata )
|
690 |
-
return;
|
691 |
-
|
692 |
-
// Do some bailing if we cannot continue
|
693 |
-
if ( !isset( $metadata['file'] ) || !isset( $metadata['image_meta']['resized_images'] ) )
|
694 |
-
return;
|
695 |
-
$pathinfo = pathinfo( $metadata['file'] );
|
696 |
-
$resized_images = $metadata['image_meta']['resized_images'];
|
697 |
-
|
698 |
-
// Get Wordpress uploads directory (and bail if it doesn't exist)
|
699 |
-
$wp_upload_dir = wp_upload_dir();
|
700 |
-
$upload_dir = $wp_upload_dir['basedir'];
|
701 |
-
if ( !is_dir( $upload_dir ) )
|
702 |
-
return;
|
703 |
-
|
704 |
-
// Delete the resized images
|
705 |
-
foreach ( $resized_images as $dims ) {
|
706 |
-
|
707 |
-
// Get the resized images filename
|
708 |
-
$file = $upload_dir . '/' . $pathinfo['dirname'] . '/' . $pathinfo['filename'] . '-' . $dims . '.' . $pathinfo['extension'];
|
709 |
-
|
710 |
-
// Delete the resized image
|
711 |
-
@unlink( $file );
|
712 |
-
}
|
713 |
-
}
|
714 |
-
|
715 |
-
add_action( 'delete_attachment', 'su_delete_resized_images' );
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Csv files parser
|
5 |
+
* Converts csv-files to html-tables
|
6 |
+
*
|
7 |
+
* @param type $file File url to parse
|
8 |
+
*/
|
9 |
+
function su_parse_csv( $file ) {
|
10 |
+
$csv_lines = file( $file );
|
11 |
+
if ( is_array( $csv_lines ) ) {
|
12 |
+
$cnt = count( $csv_lines );
|
13 |
+
for ( $i = 0; $i < $cnt; $i++ ) {
|
14 |
+
$line = $csv_lines[$i];
|
15 |
+
$line = trim( $line );
|
16 |
+
$first_char = true;
|
17 |
+
$col_num = 0;
|
18 |
+
$length = strlen( $line );
|
19 |
+
for ( $b = 0; $b < $length; $b++ ) {
|
20 |
+
if ( $skip_char != true ) {
|
21 |
+
$process = true;
|
22 |
+
if ( $first_char == true ) {
|
23 |
+
if ( $line[$b] == '"' ) {
|
24 |
+
$terminator = '";';
|
25 |
+
$process = false;
|
26 |
+
}
|
27 |
+
else
|
28 |
+
$terminator = ';';
|
29 |
+
$first_char = false;
|
30 |
+
}
|
31 |
+
if ( $line[$b] == '"' ) {
|
32 |
+
$next_char = $line[$b + 1];
|
33 |
+
if ( $next_char == '"' ) $skip_char = true;
|
34 |
+
elseif ( $next_char == ';' ) {
|
35 |
+
if ( $terminator == '";' ) {
|
36 |
+
$first_char = true;
|
37 |
+
$process = false;
|
38 |
+
$skip_char = true;
|
39 |
+
}
|
40 |
+
}
|
41 |
+
}
|
42 |
+
if ( $process == true ) {
|
43 |
+
if ( $line[$b] == ';' ) {
|
44 |
+
if ( $terminator == ';' ) {
|
45 |
+
$first_char = true;
|
46 |
+
$process = false;
|
47 |
+
}
|
48 |
+
}
|
49 |
+
}
|
50 |
+
if ( $process == true ) $column .= $line[$b];
|
51 |
+
if ( $b == ( $length - 1 ) ) $first_char = true;
|
52 |
+
if ( $first_char == true ) {
|
53 |
+
$values[$i][$col_num] = $column;
|
54 |
+
$column = '';
|
55 |
+
$col_num++;
|
56 |
+
}
|
57 |
+
}
|
58 |
+
else
|
59 |
+
$skip_char = false;
|
60 |
+
}
|
61 |
+
}
|
62 |
+
}
|
63 |
+
$return = '<table><tr>';
|
64 |
+
foreach ( $values[0] as $value ) $return .= '<th>' . $value . '</th>';
|
65 |
+
$return .= '</tr>';
|
66 |
+
array_shift( $values );
|
67 |
+
foreach ( $values as $rows ) {
|
68 |
+
$return .= '<tr>';
|
69 |
+
foreach ( $rows as $col ) {
|
70 |
+
$return .= '<td>' . $col . '</td>';
|
71 |
+
}
|
72 |
+
$return .= '</tr>';
|
73 |
+
}
|
74 |
+
$return .= '</table>';
|
75 |
+
return $return;
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Color shift a hex value by a specific percentage factor
|
80 |
+
*
|
81 |
+
* @param string $supplied_hex Any valid hex value. Short forms e.g. #333 accepted.
|
82 |
+
* @param string $shift_method How to shift the value e.g( +,up,lighter,>)
|
83 |
+
* @param integer $percentage Percentage in range of [0-100] to shift provided hex value by
|
84 |
+
*
|
85 |
+
* @return string shifted hex value
|
86 |
+
* @version 1.0 2008-03-28
|
87 |
+
*/
|
88 |
+
function su_hex_shift( $supplied_hex, $shift_method, $percentage = 50 ) {
|
89 |
+
$shifted_hex_value = null;
|
90 |
+
$valid_shift_option = false;
|
91 |
+
$current_set = 1;
|
92 |
+
$RGB_values = array();
|
93 |
+
$valid_shift_up_args = array( 'up', '+', 'lighter', '>' );
|
94 |
+
$valid_shift_down_args = array( 'down', '-', 'darker', '<' );
|
95 |
+
$shift_method = strtolower( trim( $shift_method ) );
|
96 |
+
// Check Factor
|
97 |
+
if ( !is_numeric( $percentage ) || ( $percentage = ( int ) $percentage ) < 0 || $percentage > 100
|
98 |
+
) trigger_error( "Invalid factor", E_USER_NOTICE );
|
99 |
+
// Check shift method
|
100 |
+
foreach ( array( $valid_shift_down_args, $valid_shift_up_args ) as $options ) {
|
101 |
+
foreach ( $options as $method ) {
|
102 |
+
if ( $method == $shift_method ) {
|
103 |
+
$valid_shift_option = !$valid_shift_option;
|
104 |
+
$shift_method = ( $current_set === 1 ) ? '+' : '-';
|
105 |
+
break 2;
|
106 |
+
}
|
107 |
+
}
|
108 |
+
++$current_set;
|
109 |
+
}
|
110 |
+
if ( !$valid_shift_option ) trigger_error( "Invalid shift method", E_USER_NOTICE );
|
111 |
+
// Check Hex string
|
112 |
+
switch ( strlen( $supplied_hex = ( str_replace( '#', '', trim( $supplied_hex ) ) ) ) ) {
|
113 |
+
case 3:
|
114 |
+
if ( preg_match( '/^([0-9a-f])([0-9a-f])([0-9a-f])/i', $supplied_hex ) ) {
|
115 |
+
$supplied_hex = preg_replace( '/^([0-9a-f])([0-9a-f])([0-9a-f])/i', '\\1\\1\\2\\2\\3\\3',
|
116 |
+
$supplied_hex );
|
117 |
+
}
|
118 |
+
else {
|
119 |
+
trigger_error( "Invalid hex color value", E_USER_NOTICE );
|
120 |
+
}
|
121 |
+
break;
|
122 |
+
case 6:
|
123 |
+
if ( !preg_match( '/^[0-9a-f]{2}[0-9a-f]{2}[0-9a-f]{2}$/i', $supplied_hex ) ) {
|
124 |
+
trigger_error( "Invalid hex color value", E_USER_NOTICE );
|
125 |
+
}
|
126 |
+
break;
|
127 |
+
default:
|
128 |
+
trigger_error( "Invalid hex color length", E_USER_NOTICE );
|
129 |
+
}
|
130 |
+
// Start shifting
|
131 |
+
$RGB_values['R'] = hexdec( $supplied_hex{0} . $supplied_hex{1} );
|
132 |
+
$RGB_values['G'] = hexdec( $supplied_hex{2} . $supplied_hex{3} );
|
133 |
+
$RGB_values['B'] = hexdec( $supplied_hex{4} . $supplied_hex{5} );
|
134 |
+
foreach ( $RGB_values as $c => $v ) {
|
135 |
+
switch ( $shift_method ) {
|
136 |
+
case '-':
|
137 |
+
$amount = round( ( ( 255 - $v ) / 100 ) * $percentage ) + $v;
|
138 |
+
break;
|
139 |
+
case '+':
|
140 |
+
$amount = $v - round( ( $v / 100 ) * $percentage );
|
141 |
+
break;
|
142 |
+
default:
|
143 |
+
trigger_error( "Oops. Unexpected shift method", E_USER_NOTICE );
|
144 |
+
}
|
145 |
+
$shifted_hex_value .= $current_value = ( strlen( $decimal_to_hex = dechex( $amount ) ) < 2 ) ?
|
146 |
+
'0' . $decimal_to_hex : $decimal_to_hex;
|
147 |
+
}
|
148 |
+
return '#' . $shifted_hex_value;
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* Apply all custom formatting options of plugin
|
153 |
+
*/
|
154 |
+
function su_apply_formatting() {
|
155 |
+
// Get plugin object
|
156 |
+
global $shult;
|
157 |
+
// Enable shortcodes in text widgets
|
158 |
+
add_filter( 'widget_text', 'do_shortcode' );
|
159 |
+
// Enable shortcodes in category descriptions
|
160 |
+
add_filter( 'category_description', 'do_shortcode' );
|
161 |
+
// Enable auto-formatting
|
162 |
+
if ( $shult->get_option( 'custom_formatting' ) == 'on' ) {
|
163 |
+
// Disable WordPress native content formatters
|
164 |
+
remove_filter( 'the_content', 'wpautop' );
|
165 |
+
remove_filter( 'the_content', 'wptexturize' );
|
166 |
+
// Apply custom formatter function
|
167 |
+
add_filter( 'the_content', 'su_custom_formatter', 99 );
|
168 |
+
add_filter( 'widget_text', 'su_custom_formatter', 99 );
|
169 |
+
add_filter( 'category_description', 'su_custom_formatter', 99 );
|
170 |
+
}
|
171 |
+
// Fix for large posts, http://core.trac.wordpress.org/ticket/8553
|
172 |
+
@ini_set( 'pcre.backtrack_limit', 500000 );
|
173 |
+
}
|
174 |
+
|
175 |
+
add_action( 'init', 'su_apply_formatting' );
|
176 |
+
|
177 |
+
/**
|
178 |
+
* Custom formatter function
|
179 |
+
*
|
180 |
+
* @param string $content
|
181 |
+
*
|
182 |
+
* @return string Formatted content with clean shortcodes content
|
183 |
+
*/
|
184 |
+
function su_custom_formatter( $content ) {
|
185 |
+
// Prepare variables
|
186 |
+
$new_content = '';
|
187 |
+
// Matches the contents and the open and closing tags
|
188 |
+
$pattern_full = '{(\[raw\].*?\[/raw\])}is';
|
189 |
+
// Matches just the contents
|
190 |
+
$pattern_contents = '{\[raw\](.*?)\[/raw\]}is';
|
191 |
+
// Divide content into pieces
|
192 |
+
$pieces = preg_split( $pattern_full, $content, -1, PREG_SPLIT_DELIM_CAPTURE );
|
193 |
+
// Loop over pieces
|
194 |
+
foreach ( $pieces as $piece ) {
|
195 |
+
// Look for presence of the shortcode, Append to content (no formatting)
|
196 |
+
if ( preg_match( $pattern_contents, $piece, $matches ) ) $new_content .= $matches[1];
|
197 |
+
// Format and append to content
|
198 |
+
else $new_content .= wptexturize( wpautop( $piece ) );
|
199 |
+
}
|
200 |
+
// Return formatted content
|
201 |
+
return $new_content;
|
202 |
+
}
|
203 |
+
|
204 |
+
/**
|
205 |
+
* Custom do_shortcode function for nested shortcodes
|
206 |
+
*
|
207 |
+
* @param string $content Shortcode content
|
208 |
+
* @param string $pre First shortcode letter
|
209 |
+
*
|
210 |
+
* @return string Formatted content
|
211 |
+
*/
|
212 |
+
function su_do_shortcode( $content, $pre ) {
|
213 |
+
if ( strpos( $content, '[_' ) !== false ) $content = preg_replace( '@(\[_*)_(' . $pre . '|/)@', "$1$2", $content );
|
214 |
+
return do_shortcode( $content );
|
215 |
+
}
|
216 |
+
|
217 |
+
/**
|
218 |
+
* Shortcode names prefix in compatibility mode
|
219 |
+
*
|
220 |
+
* @return string Special prefix
|
221 |
+
*/
|
222 |
+
function su_compatibility_mode_prefix() {
|
223 |
+
global $shult;
|
224 |
+
$option = get_option( 'su_compatibility_mode_prefix' );
|
225 |
+
if ( $shult->get_option( 'compatibility_mode' ) === 'on' ) return ( $option ) ? $option : 'su_';
|
226 |
+
else return '';
|
227 |
+
}
|
228 |
+
|
229 |
+
/**
|
230 |
+
* Tweet relative time (like: 5 seconds ago)
|
231 |
+
*/
|
232 |
+
function su_rel_time( $original, $do_more = 0 ) {
|
233 |
+
// array of time period chunks
|
234 |
+
$chunks = array( array( 60 * 60 * 24 * 365, __( 'year', 'su' ) ),
|
235 |
+
array( 60 * 60 * 24 * 30, __( 'month', 'su' ) ),
|
236 |
+
array( 60 * 60 * 24 * 7, __( 'week', 'su' ) ),
|
237 |
+
array( 60 * 60 * 24, __( 'day', 'su' ) ),
|
238 |
+
array( 60 * 60, __( 'hour', 'su' ) ),
|
239 |
+
array( 60, __( 'minute', 'su' ) ), );
|
240 |
+
$today = time();
|
241 |
+
$since = $today - $original;
|
242 |
+
for ( $i = 0, $j = count( $chunks ); $i < $j; $i++ ) {
|
243 |
+
$seconds = $chunks[$i][0];
|
244 |
+
$name = $chunks[$i][1];
|
245 |
+
|
246 |
+
if ( ( $count = floor( $since / $seconds ) ) != 0 ) break;
|
247 |
+
}
|
248 |
+
$return = ( $count == 1 ) ? '1 ' . $name : "$count {$name}" . __( 's', 'su' );
|
249 |
+
if ( $i + 1 < $j ) {
|
250 |
+
$seconds2 = $chunks[$i + 1][0];
|
251 |
+
$name2 = $chunks[$i + 1][1];
|
252 |
+
|
253 |
+
// add second item if it's greater than 0
|
254 |
+
if ( ( ( $count2 = floor( ( $since - ( $seconds * $count ) ) / $seconds2 ) ) != 0 ) && $do_more
|
255 |
+
) $return .= ( $count2 == 1 ) ? ', 1 ' . $name2 : ", $count2 {$name2}" . __( 's', 'su' );
|
256 |
+
}
|
257 |
+
return $return;
|
258 |
+
}
|
259 |
+
|
260 |
+
/**
|
261 |
+
* Add hyperlinks to tweets
|
262 |
+
*/
|
263 |
+
function su_parse_links( $text ) {
|
264 |
+
// Props to Allen Shaw & webmancers.com
|
265 |
+
// match protocol://address/path/file.extension?some=variable&another=asf%
|
266 |
+
$text = preg_replace( '/\b([a-zA-Z]+:\/\/[\w_.\-]+\.[a-zA-Z]{2,6}[\/\w\-~.?=&%#+$*!]*)\b/i',
|
267 |
+
"<a href=\"$1\" class=\"twitter-link\">$1</a>", $text );
|
268 |
+
// match www.something.domain/path/file.extension?some=variable&another=asf%
|
269 |
+
$text = preg_replace( '/\b(?<!:\/\/)(www\.[\w_.\-]+\.[a-zA-Z]{2,6}[\/\w\-~.?=&%#+$*!]*)\b/i',
|
270 |
+
"<a href=\"http://$1\" class=\"twitter-link\">$1</a>", $text );
|
271 |
+
|
272 |
+
// match name@address
|
273 |
+
$text = preg_replace( "/\b([a-zA-Z][a-zA-Z0-9\_\.\-]*[a-zA-Z]*\@[a-zA-Z][a-zA-Z0-9\_\.\-]*[a-zA-Z]{2,6})\b/i",
|
274 |
+
"<a href=\"mailto://$1\" class=\"twitter-link\">$1</a>", $text );
|
275 |
+
//mach #trendingtopics. Props to Michael Voigt
|
276 |
+
$text = preg_replace( '/([\.|\,|\:|\¡|\¿|\>|\{|\(]?)#{1}(\w*)([\.|\,|\:|\!|\?|\>|\}|\)]?)\s/i',
|
277 |
+
"$1<a href=\"http://twitter.com/#search?q=$2\" class=\"twitter-link\">#$2</a>$3 ",
|
278 |
+
$text );
|
279 |
+
return $text;
|
280 |
+
}
|
281 |
+
|
282 |
+
/**
|
283 |
+
* Get tweets by username
|
284 |
+
*/
|
285 |
+
function su_get_tweets( $username, $limit, $show_time ) {
|
286 |
+
// Get tweets
|
287 |
+
$tweets = json_decode( file_get_contents( 'https://api.twitter.com/1/statuses/user_timeline.json?screen_name=' .
|
288 |
+
$username . '&count=' . $limit ) );
|
289 |
+
// No username
|
290 |
+
if ( !$username ) {
|
291 |
+
$return = __( 'username not specified', 'su' );
|
292 |
+
$error = true;
|
293 |
+
}
|
294 |
+
// No messages
|
295 |
+
if ( !count( $tweets ) ) {
|
296 |
+
$return = __( 'no public messages', 'su' );
|
297 |
+
$error = true;
|
298 |
+
}
|
299 |
+
// Loop tweets
|
300 |
+
if ( count( $tweets ) ) foreach ( $tweets as $num => $tweet ) {
|
301 |
+
// Prepare relative time
|
302 |
+
$time = ( $show_time ) ?
|
303 |
+
'<span class="su-tweet-time">' . su_rel_time( strtotime( $tweet->created_at ) ) . '</span>' : '';
|
304 |
+
// Prepare last tweet class
|
305 |
+
$last_tweet_class = ( $num == ( $limit - 1 ) ) ? ' su-tweet-last' : '';
|
306 |
+
// Prepare markup
|
307 |
+
$return = '<div class="su-tweet' . $last_tweet_class . '">';
|
308 |
+
$return .=
|
309 |
+
'<a href="http://twitter.com/' . $username . '" class="su-tweet-username">@' . $username . '</a>: ';
|
310 |
+
$return .= su_parse_links( $tweet->text );
|
311 |
+
$return .= $time;
|
312 |
+
$return .= '</div>';
|
313 |
+
}
|
314 |
+
// Return results
|
315 |
+
return ( $error ) ? '<p class="su-error"><strong>Tweets:</strong> ' . $return . '</p>' : $return;
|
316 |
+
}
|
317 |
+
|
318 |
+
function su_get_categories() {
|
319 |
+
$cats = array();
|
320 |
+
foreach ( ( array ) get_terms( 'category' ) as $cat ) {
|
321 |
+
$cats[$cat->slug] = $cat->name;
|
322 |
+
}
|
323 |
+
return $cats;
|
324 |
+
}
|
325 |
+
|
326 |
+
function su_get_post_types() {
|
327 |
+
$types = array();
|
328 |
+
foreach ( ( array ) get_post_types( '', 'objects' ) as $cpt => $cpt_data ) {
|
329 |
+
$types[$cpt] = $cpt_data->label;
|
330 |
+
}
|
331 |
+
return $types;
|
332 |
+
}
|
333 |
+
|
334 |
+
function su_get_users() {
|
335 |
+
$users = array();
|
336 |
+
foreach ( ( array ) get_users() as $user ) {
|
337 |
+
$users[$user->ID] = $user->data->display_name;
|
338 |
+
}
|
339 |
+
return $users;
|
340 |
+
}
|
341 |
+
|
342 |
+
function su_get_taxonomies( $first = false ) {
|
343 |
+
$taxes = array();
|
344 |
+
foreach ( ( array ) get_taxonomies( '', 'objects' ) as $tax ) {
|
345 |
+
$taxes[$tax->name] = $tax->label;
|
346 |
+
}
|
347 |
+
// Return only first taxonomy name
|
348 |
+
if ( $first ) {
|
349 |
+
reset( $taxes );
|
350 |
+
return key( $taxes );
|
351 |
+
}
|
352 |
+
return $taxes;
|
353 |
+
}
|
354 |
+
|
355 |
+
function su_get_terms( $taxonomy ) {
|
356 |
+
$terms = array();
|
357 |
+
// Get the terms
|
358 |
+
foreach ( ( array ) get_terms( $taxonomy ) as $term ) {
|
359 |
+
$terms[$term->slug] = $term->name;
|
360 |
+
}
|
361 |
+
return $terms;
|
362 |
+
}
|
363 |
+
|
364 |
+
/**
|
365 |
+
* Extra CSS class helper
|
366 |
+
*
|
367 |
+
* @param array $atts Shortcode attributes
|
368 |
+
*
|
369 |
+
* @return string
|
370 |
+
*/
|
371 |
+
function su_ecssc( $atts ) {
|
372 |
+
return ( $atts['class'] ) ? ' ' . $atts['class'] : '';
|
373 |
+
}
|
374 |
+
|
375 |
+
/**
|
376 |
+
* Resizes an image and returns an array containing the resized URL, width, height and file type. Uses native Wordpress functionality.
|
377 |
+
*
|
378 |
+
* @author Matthew Ruddy (http://easinglider.com)
|
379 |
+
* @return array An array containing the resized image URL, width, height and file type.
|
380 |
+
*/
|
381 |
+
function su_image_resize( $url, $width = NULL, $height = NULL, $crop = true, $retina = false ) {
|
382 |
+
global $wp_version;
|
383 |
+
|
384 |
+
//######################################################################
|
385 |
+
// First implementation
|
386 |
+
//######################################################################
|
387 |
+
if ( isset( $wp_version ) && version_compare( $wp_version, '3.5' ) >= 0 ) {
|
388 |
+
|
389 |
+
global $wpdb;
|
390 |
+
|
391 |
+
if ( empty( $url ) )
|
392 |
+
return new WP_Error( 'no_image_url', 'No image URL has been entered.', $url );
|
393 |
+
|
394 |
+
// Get default size from database
|
395 |
+
$width = ( $width ) ? $width : get_option( 'thumbnail_size_w' );
|
396 |
+
$height = ( $height ) ? $height : get_option( 'thumbnail_size_h' );
|
397 |
+
|
398 |
+
// Allow for different retina sizes
|
399 |
+
$retina = $retina ? ( $retina === true ? 2 : $retina ) : 1;
|
400 |
+
|
401 |
+
// Get the image file path
|
402 |
+
$file_path = parse_url( $url );
|
403 |
+
$file_path = $_SERVER['DOCUMENT_ROOT'] . $file_path['path'];
|
404 |
+
|
405 |
+
// Check for Multisite
|
406 |
+
if ( is_multisite() ) {
|
407 |
+
global $blog_id;
|
408 |
+
$blog_details = get_blog_details( $blog_id );
|
409 |
+
$file_path = str_replace( $blog_details->path . 'files/', '/wp-content/blogs.dir/' . $blog_id . '/files/', $file_path );
|
410 |
+
}
|
411 |
+
|
412 |
+
// Destination width and height variables
|
413 |
+
$dest_width = $width * $retina;
|
414 |
+
$dest_height = $height * $retina;
|
415 |
+
|
416 |
+
// File name suffix (appended to original file name)
|
417 |
+
$suffix = "{$dest_width}x{$dest_height}";
|
418 |
+
|
419 |
+
// Some additional info about the image
|
420 |
+
$info = pathinfo( $file_path );
|
421 |
+
$dir = $info['dirname'];
|
422 |
+
$ext = $info['extension'];
|
423 |
+
$name = wp_basename( $file_path, ".$ext" );
|
424 |
+
|
425 |
+
// Suffix applied to filename
|
426 |
+
$suffix = "{$dest_width}x{$dest_height}";
|
427 |
+
|
428 |
+
// Get the destination file name
|
429 |
+
$dest_file_name = "{$dir}/{$name}-{$suffix}.{$ext}";
|
430 |
+
|
431 |
+
if ( !file_exists( $dest_file_name ) ) {
|
432 |
+
|
433 |
+
/*
|
434 |
+
* Bail if this image isn't in the Media Library.
|
435 |
+
* We only want to resize Media Library images, so we can be sure they get deleted correctly when appropriate.
|
436 |
+
*/
|
437 |
+
$query = $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE guid='%s'", $url );
|
438 |
+
$get_attachment = $wpdb->get_results( $query );
|
439 |
+
if ( !$get_attachment )
|
440 |
+
return array( 'url' => $url, 'width' => $width, 'height' => $height );
|
441 |
+
|
442 |
+
// Load Wordpress Image Editor
|
443 |
+
$editor = wp_get_image_editor( $file_path );
|
444 |
+
if ( is_wp_error( $editor ) )
|
445 |
+
return array( 'url' => $url, 'width' => $width, 'height' => $height );
|
446 |
+
|
447 |
+
// Get the original image size
|
448 |
+
$size = $editor->get_size();
|
449 |
+
$orig_width = $size['width'];
|
450 |
+
$orig_height = $size['height'];
|
451 |
+
|
452 |
+
$src_x = $src_y = 0;
|
453 |
+
$src_w = $orig_width;
|
454 |
+
$src_h = $orig_height;
|
455 |
+
|
456 |
+
if ( $crop ) {
|
457 |
+
|
458 |
+
$cmp_x = $orig_width / $dest_width;
|
459 |
+
$cmp_y = $orig_height / $dest_height;
|
460 |
+
|
461 |
+
// Calculate x or y coordinate, and width or height of source
|
462 |
+
if ( $cmp_x > $cmp_y ) {
|
463 |
+
$src_w = round( $orig_width / $cmp_x * $cmp_y );
|
464 |
+
$src_x = round( ( $orig_width - ( $orig_width / $cmp_x * $cmp_y ) ) / 2 );
|
465 |
+
}
|
466 |
+
else if ( $cmp_y > $cmp_x ) {
|
467 |
+
$src_h = round( $orig_height / $cmp_y * $cmp_x );
|
468 |
+
$src_y = round( ( $orig_height - ( $orig_height / $cmp_y * $cmp_x ) ) / 2 );
|
469 |
+
}
|
470 |
+
}
|
471 |
+
|
472 |
+
// Time to crop the image!
|
473 |
+
$editor->crop( $src_x, $src_y, $src_w, $src_h, $dest_width, $dest_height );
|
474 |
+
|
475 |
+
// Now let's save the image
|
476 |
+
$saved = $editor->save( $dest_file_name );
|
477 |
+
|
478 |
+
// Get resized image information
|
479 |
+
$resized_url = str_replace( basename( $url ), basename( $saved['path'] ), $url );
|
480 |
+
$resized_width = $saved['width'];
|
481 |
+
$resized_height = $saved['height'];
|
482 |
+
$resized_type = $saved['mime-type'];
|
483 |
+
|
484 |
+
// Add the resized dimensions to original image metadata (so we can delete our resized images when the original image is delete from the Media Library)
|
485 |
+
$metadata = wp_get_attachment_metadata( $get_attachment[0]->ID );
|
486 |
+
if ( isset( $metadata['image_meta'] ) ) {
|
487 |
+
$metadata['image_meta']['resized_images'][] = $resized_width . 'x' . $resized_height;
|
488 |
+
wp_update_attachment_metadata( $get_attachment[0]->ID, $metadata );
|
489 |
+
}
|
490 |
+
|
491 |
+
// Create the image array
|
492 |
+
$image_array = array(
|
493 |
+
'url' => $resized_url,
|
494 |
+
'width' => $resized_width,
|
495 |
+
'height' => $resized_height,
|
496 |
+
'type' => $resized_type
|
497 |
+
);
|
498 |
+
}
|
499 |
+
else {
|
500 |
+
$image_array = array(
|
501 |
+
'url' => str_replace( basename( $url ), basename( $dest_file_name ), $url ),
|
502 |
+
'width' => $dest_width,
|
503 |
+
'height' => $dest_height,
|
504 |
+
'type' => $ext
|
505 |
+
);
|
506 |
+
}
|
507 |
+
|
508 |
+
// Return image array
|
509 |
+
return $image_array;
|
510 |
+
}
|
511 |
+
|
512 |
+
//######################################################################
|
513 |
+
// Second implementation
|
514 |
+
//######################################################################
|
515 |
+
else {
|
516 |
+
global $wpdb;
|
517 |
+
|
518 |
+
if ( empty( $url ) )
|
519 |
+
return new WP_Error( 'no_image_url', 'No image URL has been entered.', $url );
|
520 |
+
|
521 |
+
// Bail if GD Library doesn't exist
|
522 |
+
if ( !extension_loaded( 'gd' ) || !function_exists( 'gd_info' ) )
|
523 |
+
return array( 'url' => $url, 'width' => $width, 'height' => $height );
|
524 |
+
|
525 |
+
// Get default size from database
|
526 |
+
$width = ( $width ) ? $width : get_option( 'thumbnail_size_w' );
|
527 |
+
$height = ( $height ) ? $height : get_option( 'thumbnail_size_h' );
|
528 |
+
|
529 |
+
// Allow for different retina sizes
|
530 |
+
$retina = $retina ? ( $retina === true ? 2 : $retina ) : 1;
|
531 |
+
|
532 |
+
// Destination width and height variables
|
533 |
+
$dest_width = $width * $retina;
|
534 |
+
$dest_height = $height * $retina;
|
535 |
+
|
536 |
+
// Get image file path
|
537 |
+
$file_path = parse_url( $url );
|
538 |
+
$file_path = $_SERVER['DOCUMENT_ROOT'] . $file_path['path'];
|
539 |
+
|
540 |
+
// Check for Multisite
|
541 |
+
if ( is_multisite() ) {
|
542 |
+
global $blog_id;
|
543 |
+
$blog_details = get_blog_details( $blog_id );
|
544 |
+
$file_path = str_replace( $blog_details->path . 'files/', '/wp-content/blogs.dir/' . $blog_id . '/files/', $file_path );
|
545 |
+
}
|
546 |
+
|
547 |
+
// Some additional info about the image
|
548 |
+
$info = pathinfo( $file_path );
|
549 |
+
$dir = $info['dirname'];
|
550 |
+
$ext = $info['extension'];
|
551 |
+
$name = wp_basename( $file_path, ".$ext" );
|
552 |
+
|
553 |
+
// Suffix applied to filename
|
554 |
+
$suffix = "{$dest_width}x{$dest_height}";
|
555 |
+
|
556 |
+
// Get the destination file name
|
557 |
+
$dest_file_name = "{$dir}/{$name}-{$suffix}.{$ext}";
|
558 |
+
|
559 |
+
// No need to resize & create a new image if it already exists!
|
560 |
+
if ( !file_exists( $dest_file_name ) ) {
|
561 |
+
|
562 |
+
/*
|
563 |
+
* Bail if this image isn't in the Media Library either.
|
564 |
+
* We only want to resize Media Library images, so we can be sure they get deleted correctly when appropriate.
|
565 |
+
*/
|
566 |
+
$query = $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE guid='%s'", $url );
|
567 |
+
$get_attachment = $wpdb->get_results( $query );
|
568 |
+
if ( !$get_attachment )
|
569 |
+
return array( 'url' => $url, 'width' => $width, 'height' => $height );
|
570 |
+
|
571 |
+
$image = wp_load_image( $file_path );
|
572 |
+
if ( !is_resource( $image ) )
|
573 |
+
return new WP_Error( 'error_loading_image_as_resource', $image, $file_path );
|
574 |
+
|
575 |
+
// Get the current image dimensions and type
|
576 |
+
$size = @getimagesize( $file_path );
|
577 |
+
if ( !$size )
|
578 |
+
return new WP_Error( 'file_path_getimagesize_failed', 'Failed to get $file_path information using getimagesize.' );
|
579 |
+
list( $orig_width, $orig_height, $orig_type ) = $size;
|
580 |
+
|
581 |
+
// Create new image
|
582 |
+
$new_image = wp_imagecreatetruecolor( $dest_width, $dest_height );
|
583 |
+
|
584 |
+
// Do some proportional cropping if enabled
|
585 |
+
if ( $crop ) {
|
586 |
+
|
587 |
+
$src_x = $src_y = 0;
|
588 |
+
$src_w = $orig_width;
|
589 |
+
$src_h = $orig_height;
|
590 |
+
|
591 |
+
$cmp_x = $orig_width / $dest_width;
|
592 |
+
$cmp_y = $orig_height / $dest_height;
|
593 |
+
|
594 |
+
// Calculate x or y coordinate, and width or height of source
|
595 |
+
if ( $cmp_x > $cmp_y ) {
|
596 |
+
$src_w = round( $orig_width / $cmp_x * $cmp_y );
|
597 |
+
$src_x = round( ( $orig_width - ( $orig_width / $cmp_x * $cmp_y ) ) / 2 );
|
598 |
+
}
|
599 |
+
else if ( $cmp_y > $cmp_x ) {
|
600 |
+
$src_h = round( $orig_height / $cmp_y * $cmp_x );
|
601 |
+
$src_y = round( ( $orig_height - ( $orig_height / $cmp_y * $cmp_x ) ) / 2 );
|
602 |
+
}
|
603 |
+
|
604 |
+
// Create the resampled image
|
605 |
+
imagecopyresampled( $new_image, $image, 0, 0, $src_x, $src_y, $dest_width, $dest_height, $src_w, $src_h );
|
606 |
+
}
|
607 |
+
else
|
608 |
+
imagecopyresampled( $new_image, $image, 0, 0, 0, 0, $dest_width, $dest_height, $orig_width, $orig_height );
|
609 |
+
|
610 |
+
// Convert from full colors to index colors, like original PNG.
|
611 |
+
if ( IMAGETYPE_PNG == $orig_type && function_exists( 'imageistruecolor' ) && !imageistruecolor( $image ) )
|
612 |
+
imagetruecolortopalette( $new_image, false, imagecolorstotal( $image ) );
|
613 |
+
|
614 |
+
// Remove the original image from memory (no longer needed)
|
615 |
+
imagedestroy( $image );
|
616 |
+
|
617 |
+
// Check the image is the correct file type
|
618 |
+
if ( IMAGETYPE_GIF == $orig_type ) {
|
619 |
+
if ( !imagegif( $new_image, $dest_file_name ) )
|
620 |
+
return new WP_Error( 'resize_path_invalid', 'Resize path invalid (GIF)' );
|
621 |
+
}
|
622 |
+
elseif ( IMAGETYPE_PNG == $orig_type ) {
|
623 |
+
if ( !imagepng( $new_image, $dest_file_name ) )
|
624 |
+
return new WP_Error( 'resize_path_invalid', 'Resize path invalid (PNG).' );
|
625 |
+
}
|
626 |
+
else {
|
627 |
+
|
628 |
+
// All other formats are converted to jpg
|
629 |
+
if ( 'jpg' != $ext && 'jpeg' != $ext )
|
630 |
+
$dest_file_name = "{$dir}/{$name}-{$suffix}.jpg";
|
631 |
+
if ( !imagejpeg( $new_image, $dest_file_name, apply_filters( 'resize_jpeg_quality', 90 ) ) )
|
632 |
+
return new WP_Error( 'resize_path_invalid', 'Resize path invalid (JPG).' );
|
633 |
+
}
|
634 |
+
|
635 |
+
// Remove new image from memory (no longer needed as well)
|
636 |
+
imagedestroy( $new_image );
|
637 |
+
|
638 |
+
// Set correct file permissions
|
639 |
+
$stat = stat( dirname( $dest_file_name ) );
|
640 |
+
$perms = $stat['mode'] & 0000666;
|
641 |
+
@chmod( $dest_file_name, $perms );
|
642 |
+
|
643 |
+
// Get some information about the resized image
|
644 |
+
$new_size = @getimagesize( $dest_file_name );
|
645 |
+
if ( !$new_size )
|
646 |
+
return new WP_Error( 'resize_path_getimagesize_failed', 'Failed to get $dest_file_name (resized image) info via @getimagesize', $dest_file_name );
|
647 |
+
list( $resized_width, $resized_height, $resized_type ) = $new_size;
|
648 |
+
|
649 |
+
// Get the new image URL
|
650 |
+
$resized_url = str_replace( basename( $url ), basename( $dest_file_name ), $url );
|
651 |
+
|
652 |
+
// Add the resized dimensions to original image metadata (so we can delete our resized images when the original image is delete from the Media Library)
|
653 |
+
$metadata = wp_get_attachment_metadata( $get_attachment[0]->ID );
|
654 |
+
if ( isset( $metadata['image_meta'] ) ) {
|
655 |
+
$metadata['image_meta']['resized_images'][] = $resized_width . 'x' . $resized_height;
|
656 |
+
wp_update_attachment_metadata( $get_attachment[0]->ID, $metadata );
|
657 |
+
}
|
658 |
+
|
659 |
+
// Return array with resized image information
|
660 |
+
$image_array = array(
|
661 |
+
'url' => $resized_url,
|
662 |
+
'width' => $resized_width,
|
663 |
+
'height' => $resized_height,
|
664 |
+
'type' => $resized_type
|
665 |
+
);
|
666 |
+
}
|
667 |
+
else {
|
668 |
+
$image_array = array(
|
669 |
+
'url' => str_replace( basename( $url ), basename( $dest_file_name ), $url ),
|
670 |
+
'width' => $dest_width,
|
671 |
+
'height' => $dest_height,
|
672 |
+
'type' => $ext
|
673 |
+
);
|
674 |
+
}
|
675 |
+
|
676 |
+
return $image_array;
|
677 |
+
}
|
678 |
+
}
|
679 |
+
|
680 |
+
/**
|
681 |
+
* Deletes the resized images when the original image is deleted from the Wordpress Media Library.
|
682 |
+
*
|
683 |
+
* @author Matthew Ruddy
|
684 |
+
*/
|
685 |
+
function su_delete_resized_images( $post_id ) {
|
686 |
+
|
687 |
+
// Get attachment image metadata
|
688 |
+
$metadata = wp_get_attachment_metadata( $post_id );
|
689 |
+
if ( !$metadata )
|
690 |
+
return;
|
691 |
+
|
692 |
+
// Do some bailing if we cannot continue
|
693 |
+
if ( !isset( $metadata['file'] ) || !isset( $metadata['image_meta']['resized_images'] ) )
|
694 |
+
return;
|
695 |
+
$pathinfo = pathinfo( $metadata['file'] );
|
696 |
+
$resized_images = $metadata['image_meta']['resized_images'];
|
697 |
+
|
698 |
+
// Get Wordpress uploads directory (and bail if it doesn't exist)
|
699 |
+
$wp_upload_dir = wp_upload_dir();
|
700 |
+
$upload_dir = $wp_upload_dir['basedir'];
|
701 |
+
if ( !is_dir( $upload_dir ) )
|
702 |
+
return;
|
703 |
+
|
704 |
+
// Delete the resized images
|
705 |
+
foreach ( $resized_images as $dims ) {
|
706 |
+
|
707 |
+
// Get the resized images filename
|
708 |
+
$file = $upload_dir . '/' . $pathinfo['dirname'] . '/' . $pathinfo['filename'] . '-' . $dims . '.' . $pathinfo['extension'];
|
709 |
+
|
710 |
+
// Delete the resized image
|
711 |
+
@unlink( $file );
|
712 |
+
}
|
713 |
+
}
|
714 |
+
|
715 |
+
add_action( 'delete_attachment', 'su_delete_resized_images' );
|
inc/example-addon.php
CHANGED
@@ -1,85 +1,85 @@
|
|
1 |
-
<?php
|
2 |
-
add_action( 'admin_notices', 'my_admin_notice' );
|
3 |
-
|
4 |
-
/**
|
5 |
-
* Function to show admin notice if Shortcodes Ultimate is not installed
|
6 |
-
*/
|
7 |
-
function my_admin_notice() {
|
8 |
-
// Check that plugin is not installed
|
9 |
-
if ( function_exists( 'shortcodes_ultimate' ) ) return;
|
10 |
-
?>
|
11 |
-
<div class="error">
|
12 |
-
<p>For full functionality of this theme you need to install and activate plugin <strong>Shortcodes Ultimate</strong>. <a href="<?php echo admin_url( 'plugin-install.php?tab=search&s=shortcodes+ultimate' ); ?>">Install now ›</a></p>
|
13 |
-
</div>
|
14 |
-
<?php
|
15 |
-
}
|
16 |
-
|
17 |
-
add_filter( 'shortcodes_ultimate_data', 'register_my_custom_shortcode' );
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Filter to modify original shortcodes data and add custom shortcodes
|
21 |
-
*
|
22 |
-
* @param array $shortcodes Basic plugin shortcodes
|
23 |
-
* @return array Modified array
|
24 |
-
*/
|
25 |
-
function register_my_custom_shortcode( $shortcodes ) {
|
26 |
-
// Add new shortcode
|
27 |
-
$shortcodes['heading2'] = array(
|
28 |
-
// Shortcode name
|
29 |
-
'name' => __( 'Heading 2', 'textdomain' ),
|
30 |
-
// Shortcode type. Can be 'wrap' or 'single'
|
31 |
-
// Example: [b]this is wrapped[/b], [this_is_single]
|
32 |
-
'type' => 'wrap',
|
33 |
-
// Shortcode group. Can be 'content', 'box', 'media' or 'other'. Groups can be mixed, for example 'content box'
|
34 |
-
'group' => 'content',
|
35 |
-
// List of shortcode params (attributes)
|
36 |
-
'atts' => array(
|
37 |
-
// Style attribute
|
38 |
-
'style' => array(
|
39 |
-
// Attribute type. Can be 'select', 'color', 'switch', 'gallery' or 'text'
|
40 |
-
'type' => 'select',
|
41 |
-
// Available values
|
42 |
-
'values' => array(
|
43 |
-
'default' => __( 'Default', 'textdomain' ),
|
44 |
-
'small' => __( 'Small', 'textdomain' )
|
45 |
-
),
|
46 |
-
// Default value
|
47 |
-
'default' => 'default',
|
48 |
-
// Attribute name
|
49 |
-
'name' => __( 'Style', 'textdomain' ),
|
50 |
-
// Attribute description
|
51 |
-
'desc' => __( 'Heading 2 style', 'textdomain' )
|
52 |
-
)
|
53 |
-
),
|
54 |
-
// Example of usage for cheatsheet
|
55 |
-
'usage' => '[heading2] Content [/heading2]<br/>[heading2 style="2"] Content [/heading2]',
|
56 |
-
// Default content for generator (for wrap-type shortcodes)
|
57 |
-
'content' => __( 'Heading 2 text', 'textdomain' ),
|
58 |
-
// Shortcode description for cheatsheet and generator
|
59 |
-
'desc' => __( 'Styled heading 2', 'textdomain' ),
|
60 |
-
// Custom icon url for Generator (example)
|
61 |
-
'icon' => '/wp-content/plugins/shortcodes-ultimate-addon/img/icon.png',
|
62 |
-
// Custom demo image url for cheatsheet (example)
|
63 |
-
'demo' => '/wp-content/plugins/shortcodes-ultimate-addon/img/demo.png',
|
64 |
-
// Name of custom shortcode function
|
65 |
-
'function' => 'su_heading2_shortcode'
|
66 |
-
);
|
67 |
-
// Return modified data
|
68 |
-
return $shortcodes;
|
69 |
-
}
|
70 |
-
|
71 |
-
/**
|
72 |
-
* Shortcode function
|
73 |
-
*
|
74 |
-
* @param array $atts Shortcode attributes
|
75 |
-
* @param string $content Shortcode content
|
76 |
-
* @return string Shortcode markup
|
77 |
-
*/
|
78 |
-
function su_heading2_shortcode( $atts, $content = null ) {
|
79 |
-
$atts = shortcode_atts( array(
|
80 |
-
'style' => 'default',
|
81 |
-
'align' => 'center'
|
82 |
-
), $atts );
|
83 |
-
return '<div class="su-heading su-heading-style-' . $atts['style'] . '" style="text-align:' . $atts['align'] . '"><div class="su-heading-inner">' . $content . '</div></div>';
|
84 |
-
}
|
85 |
?>
|
1 |
+
<?php
|
2 |
+
add_action( 'admin_notices', 'my_admin_notice' );
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Function to show admin notice if Shortcodes Ultimate is not installed
|
6 |
+
*/
|
7 |
+
function my_admin_notice() {
|
8 |
+
// Check that plugin is not installed
|
9 |
+
if ( function_exists( 'shortcodes_ultimate' ) ) return;
|
10 |
+
?>
|
11 |
+
<div class="error">
|
12 |
+
<p>For full functionality of this theme you need to install and activate plugin <strong>Shortcodes Ultimate</strong>. <a href="<?php echo admin_url( 'plugin-install.php?tab=search&s=shortcodes+ultimate' ); ?>">Install now ›</a></p>
|
13 |
+
</div>
|
14 |
+
<?php
|
15 |
+
}
|
16 |
+
|
17 |
+
add_filter( 'shortcodes_ultimate_data', 'register_my_custom_shortcode' );
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Filter to modify original shortcodes data and add custom shortcodes
|
21 |
+
*
|
22 |
+
* @param array $shortcodes Basic plugin shortcodes
|
23 |
+
* @return array Modified array
|
24 |
+
*/
|
25 |
+
function register_my_custom_shortcode( $shortcodes ) {
|
26 |
+
// Add new shortcode
|
27 |
+
$shortcodes['heading2'] = array(
|
28 |
+
// Shortcode name
|
29 |
+
'name' => __( 'Heading 2', 'textdomain' ),
|
30 |
+
// Shortcode type. Can be 'wrap' or 'single'
|
31 |
+
// Example: [b]this is wrapped[/b], [this_is_single]
|
32 |
+
'type' => 'wrap',
|
33 |
+
// Shortcode group. Can be 'content', 'box', 'media' or 'other'. Groups can be mixed, for example 'content box'
|
34 |
+
'group' => 'content',
|
35 |
+
// List of shortcode params (attributes)
|
36 |
+
'atts' => array(
|
37 |
+
// Style attribute
|
38 |
+
'style' => array(
|
39 |
+
// Attribute type. Can be 'select', 'color', 'switch', 'gallery' or 'text'
|
40 |
+
'type' => 'select',
|
41 |
+
// Available values
|
42 |
+
'values' => array(
|
43 |
+
'default' => __( 'Default', 'textdomain' ),
|
44 |
+
'small' => __( 'Small', 'textdomain' )
|
45 |
+
),
|
46 |
+
// Default value
|
47 |
+
'default' => 'default',
|
48 |
+
// Attribute name
|
49 |
+
'name' => __( 'Style', 'textdomain' ),
|
50 |
+
// Attribute description
|
51 |
+
'desc' => __( 'Heading 2 style', 'textdomain' )
|
52 |
+
)
|
53 |
+
),
|
54 |
+
// Example of usage for cheatsheet
|
55 |
+
'usage' => '[heading2] Content [/heading2]<br/>[heading2 style="2"] Content [/heading2]',
|
56 |
+
// Default content for generator (for wrap-type shortcodes)
|
57 |
+
'content' => __( 'Heading 2 text', 'textdomain' ),
|
58 |
+
// Shortcode description for cheatsheet and generator
|
59 |
+
'desc' => __( 'Styled heading 2', 'textdomain' ),
|
60 |
+
// Custom icon url for Generator (example)
|
61 |
+
'icon' => '/wp-content/plugins/shortcodes-ultimate-addon/img/icon.png',
|
62 |
+
// Custom demo image url for cheatsheet (example)
|
63 |
+
'demo' => '/wp-content/plugins/shortcodes-ultimate-addon/img/demo.png',
|
64 |
+
// Name of custom shortcode function
|
65 |
+
'function' => 'su_heading2_shortcode'
|
66 |
+
);
|
67 |
+
// Return modified data
|
68 |
+
return $shortcodes;
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Shortcode function
|
73 |
+
*
|
74 |
+
* @param array $atts Shortcode attributes
|
75 |
+
* @param string $content Shortcode content
|
76 |
+
* @return string Shortcode markup
|
77 |
+
*/
|
78 |
+
function su_heading2_shortcode( $atts, $content = null ) {
|
79 |
+
$atts = shortcode_atts( array(
|
80 |
+
'style' => 'default',
|
81 |
+
'align' => 'center'
|
82 |
+
), $atts );
|
83 |
+
return '<div class="su-heading su-heading-style-' . $atts['style'] . '" style="text-align:' . $atts['align'] . '"><div class="su-heading-inner">' . $content . '</div></div>';
|
84 |
+
}
|
85 |
?>
|
inc/vendor/class.image-meta.php
CHANGED
@@ -1,52 +1,52 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
if ( !class_exists( 'ImageMeta' ) ) {
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Handle manipulating and processing of image meta information.
|
7 |
-
*/
|
8 |
-
Class ImageMeta {
|
9 |
-
|
10 |
-
/**
|
11 |
-
* Parse the iptc info and retrive the given value.
|
12 |
-
*
|
13 |
-
* Ref. http://codex.wordpress.org/Function_Reference/wp_read_image_metadata#Parameters
|
14 |
-
* WP already adds some IPTC data
|
15 |
-
*
|
16 |
-
* @param $value The item you want returned
|
17 |
-
* @param $image The image you want info from
|
18 |
-
*/
|
19 |
-
public function iptcParser( $value = null, $image = null ) {
|
20 |
-
|
21 |
-
$size = getimagesize( $image, $info );
|
22 |
-
|
23 |
-
if ( !isset( $info['APP13'] ) )
|
24 |
-
return;
|
25 |
-
|
26 |
-
$iptc = iptcparse( $info['APP13'] );
|
27 |
-
|
28 |
-
switch ( $value ) {
|
29 |
-
case 'keywords':
|
30 |
-
if ( isset( $iptc['2#025'] ) )
|
31 |
-
return $iptc['2#025'];
|
32 |
-
|
33 |
-
case 'city':
|
34 |
-
if ( isset( $iptc['2#090'][0] ) )
|
35 |
-
return $iptc['2#090'][0];
|
36 |
-
|
37 |
-
case 'region':
|
38 |
-
if ( isset( $iptc['2#095'][0] ) )
|
39 |
-
return $iptc['2#095'][0];
|
40 |
-
|
41 |
-
case 'country':
|
42 |
-
if ( isset( $iptc['2#101'][0] ) )
|
43 |
-
return $iptc['2#101'][0];
|
44 |
-
|
45 |
-
default:
|
46 |
-
return false;
|
47 |
-
}
|
48 |
-
}
|
49 |
-
|
50 |
-
}
|
51 |
-
|
52 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if ( !class_exists( 'ImageMeta' ) ) {
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Handle manipulating and processing of image meta information.
|
7 |
+
*/
|
8 |
+
Class ImageMeta {
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Parse the iptc info and retrive the given value.
|
12 |
+
*
|
13 |
+
* Ref. http://codex.wordpress.org/Function_Reference/wp_read_image_metadata#Parameters
|
14 |
+
* WP already adds some IPTC data
|
15 |
+
*
|
16 |
+
* @param $value The item you want returned
|
17 |
+
* @param $image The image you want info from
|
18 |
+
*/
|
19 |
+
public function iptcParser( $value = null, $image = null ) {
|
20 |
+
|
21 |
+
$size = getimagesize( $image, $info );
|
22 |
+
|
23 |
+
if ( !isset( $info['APP13'] ) )
|
24 |
+
return;
|
25 |
+
|
26 |
+
$iptc = iptcparse( $info['APP13'] );
|
27 |
+
|
28 |
+
switch ( $value ) {
|
29 |
+
case 'keywords':
|
30 |
+
if ( isset( $iptc['2#025'] ) )
|
31 |
+
return $iptc['2#025'];
|
32 |
+
|
33 |
+
case 'city':
|
34 |
+
if ( isset( $iptc['2#090'][0] ) )
|
35 |
+
return $iptc['2#090'][0];
|
36 |
+
|
37 |
+
case 'region':
|
38 |
+
if ( isset( $iptc['2#095'][0] ) )
|
39 |
+
return $iptc['2#095'][0];
|
40 |
+
|
41 |
+
case 'country':
|
42 |
+
if ( isset( $iptc['2#101'][0] ) )
|
43 |
+
return $iptc['2#101'][0];
|
44 |
+
|
45 |
+
default:
|
46 |
+
return false;
|
47 |
+
}
|
48 |
+
}
|
49 |
+
|
50 |
+
}
|
51 |
+
|
52 |
}
|
inc/vendor/class.media-upload.php
CHANGED
@@ -1,190 +1,190 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Permissions NOT handled here!
|
5 |
-
*
|
6 |
-
* A series of related methods for managing file uploads within
|
7 |
-
* WordPress.
|
8 |
-
*
|
9 |
-
* @author Zane M. Kolnik zanematthew[at]gmail[dot]com
|
10 |
-
*/
|
11 |
-
if ( !class_exists( 'MediaUpload' ) ) {
|
12 |
-
|
13 |
-
Class MediaUpload {
|
14 |
-
|
15 |
-
public $upload_dir;
|
16 |
-
private $attachment_id;
|
17 |
-
|
18 |
-
public function __construct() {
|
19 |
-
|
20 |
-
$this->upload_dir = wp_upload_dir();
|
21 |
-
|
22 |
-
if ( is_admin() )
|
23 |
-
add_action( 'post_edit_form_tag', array( &$this, 'addEnctype' ) );
|
24 |
-
}
|
25 |
-
|
26 |
-
/**
|
27 |
-
* Handles the saving, i.e. creates a post type of attachment.
|
28 |
-
*
|
29 |
-
* During form submission run the method:
|
30 |
-
* $class->fileUpload( $field_name='form_field_name' );
|
31 |
-
*
|
32 |
-
* @return $final_file An array of array of f*cking cool stuff
|
33 |
-
* I guess if you think arrays are cool i like (*)(*)s
|
34 |
-
* $final_file['attachment_id'] = $this->attachment_id;
|
35 |
-
* $final_file['file'] = $uploaded_file['file'];
|
36 |
-
* $final_file['file_info'] = $file_info[];
|
37 |
-
*/
|
38 |
-
public function saveUpload( $field_name = null, $user_id = null ) {
|
39 |
-
|
40 |
-
if ( is_null( $field_name ) )
|
41 |
-
die( 'Need field_name' );
|
42 |
-
|
43 |
-
// Move the file to the uploads directory, returns an array
|
44 |
-
// of information from $_FILES
|
45 |
-
$uploaded_file = $this->handleUpload( $_FILES[$field_name] );
|
46 |
-
|
47 |
-
if ( !isset( $uploaded_file['file'] ) )
|
48 |
-
return false;
|
49 |
-
|
50 |
-
// If we were to have a unique user account for uploading
|
51 |
-
if ( is_null( $user_id ) ) {
|
52 |
-
$current_user = wp_get_current_user();
|
53 |
-
$user_id = $current_user->ID;
|
54 |
-
}
|
55 |
-
|
56 |
-
// Build the Global Unique Identifier
|
57 |
-
$guid = $this->buildGuid( $uploaded_file['file'] );
|
58 |
-
|
59 |
-
// Build our array of data to be inserted as a post
|
60 |
-
$attachment = array(
|
61 |
-
'post_mime_type' => $_FILES[$field_name]['type'],
|
62 |
-
'guid' => $guid,
|
63 |
-
'post_title' => 'Uploaded : ' . $this->mediaTitle( $uploaded_file['file'] ),
|
64 |
-
'post_content' => '',
|
65 |
-
'post_author' => $user_id,
|
66 |
-
'post_status' => 'inherit',
|
67 |
-
'post_date' => date( 'Y-m-d H:i:s' ),
|
68 |
-
'post_date_gmt' => date( 'Y-m-d H:i:s' )
|
69 |
-
);
|
70 |
-
|
71 |
-
// Add the file to the media library and generate thumbnail.
|
72 |
-
$this->attachment_id = wp_insert_attachment( $attachment, $uploaded_file['file'] );
|
73 |
-
|
74 |
-
// @todo bug, this does NOT work when used in a PLUGIN!, so you'll have to make
|
75 |
-
// your OWN thumbnail sizes!
|
76 |
-
require_once( ABSPATH . "wp-admin" . '/includes/image.php' );
|
77 |
-
$meta = wp_generate_attachment_metadata( $this->attachment_id, $uploaded_file['file'] );
|
78 |
-
|
79 |
-
$image_meta = wp_read_image_metadata( $uploaded_file['file'] );
|
80 |
-
$meta['image_meta'] = $image_meta;
|
81 |
-
|
82 |
-
$image = New ImageMeta;
|
83 |
-
$meta['image_meta']['keywords'] = $image->iptcParser( 'keywords', $uploaded_file['file'] );
|
84 |
-
$meta['image_meta']['city'] = $image->iptcParser( 'city', $uploaded_file['file'] );
|
85 |
-
$meta['image_meta']['region'] = $image->iptcParser( 'region', $uploaded_file['file'] );
|
86 |
-
$meta['image_meta']['country'] = $image->iptcParser( 'country', $uploaded_file['file'] );
|
87 |
-
wp_update_attachment_metadata( $this->attachment_id, $meta );
|
88 |
-
|
89 |
-
$file_info = pathinfo( $uploaded_file['file'] );
|
90 |
-
|
91 |
-
// Set the feedback flag to false, since the upload was successful
|
92 |
-
$upload_feedback = false;
|
93 |
-
|
94 |
-
$final_file = array( );
|
95 |
-
$final_file['attachment_id'] = $this->attachment_id;
|
96 |
-
$final_file['file'] = $uploaded_file['file'];
|
97 |
-
$final_file['file_info'] = $file_info;
|
98 |
-
|
99 |
-
return $final_file;
|
100 |
-
}
|
101 |
-
|
102 |
-
/**
|
103 |
-
* Do some set-up before calling the wp_handle_upload function
|
104 |
-
*/
|
105 |
-
public function handleUpload( $file = array( ) ) {
|
106 |
-
require_once( ABSPATH . "wp-admin" . '/includes/file.php' );
|
107 |
-
return wp_handle_upload( $file, array( 'test_form' => false ), date( 'Y/m' ) );
|
108 |
-
}
|
109 |
-
|
110 |
-
/**
|
111 |
-
* Builds the GUID for a given file from the media library
|
112 |
-
* @param full/path/to/file.jpg
|
113 |
-
* @return guid
|
114 |
-
*/
|
115 |
-
public function buildGuid( $file = null ) {
|
116 |
-
// $wp_upload_dir = wp_upload_dir();
|
117 |
-
return $this->upload_dir['baseurl'] . '/' . _wp_relative_upload_path( $file );
|
118 |
-
}
|
119 |
-
|
120 |
-
/**
|
121 |
-
* Parse the title of the media based on the file name
|
122 |
-
* @return title
|
123 |
-
*/
|
124 |
-
public function mediaTitle( $file ) {
|
125 |
-
return addslashes( preg_replace( '/\.[^.]+$/', '', basename( $file ) ) );
|
126 |
-
}
|
127 |
-
|
128 |
-
/**
|
129 |
-
* Adds the enctype for file upload, used with the hook
|
130 |
-
* post_edit_form_tag for adding uploader to post meta
|
131 |
-
*/
|
132 |
-
public function addEnctype() {
|
133 |
-
echo ' enctype="multipart/form-data"';
|
134 |
-
}
|
135 |
-
|
136 |
-
/**
|
137 |
-
* Resize images based on the "type"
|
138 |
-
*
|
139 |
-
* Normally this is done in WordPress, but for some reason
|
140 |
-
* wp_generate_attachment_metadata() does not work when
|
141 |
-
* used in a plugin.
|
142 |
-
*
|
143 |
-
* @param $file = /my/file/path/image.jpg
|
144 |
-
* @param $type = thumb|square|main
|
145 |
-
*
|
146 |
-
* @todo Since images are NOT "registered" with WordPress
|
147 |
-
* they will NOT be deleted from the media library when the
|
148 |
-
* original image is deleted!
|
149 |
-
*
|
150 |
-
* @todo use wp_update_attachment_metadata() to update
|
151 |
-
* the postmeta thumbnails ref. the array in
|
152 |
-
* wp_generate_attachment_metadata()
|
153 |
-
*
|
154 |
-
* @todo remove hardcoded sizes and suffix, possibly a
|
155 |
-
* public variable.
|
156 |
-
*
|
157 |
-
* @return same as image_resize() wp_error
|
158 |
-
*/
|
159 |
-
public function resizeImage( $file = null, $type = null ) {
|
160 |
-
switch ( $type ) {
|
161 |
-
case 'thumb':
|
162 |
-
$max_w = 104;
|
163 |
-
$max_h = 70;
|
164 |
-
$suffix = 'zm-thumb';
|
165 |
-
break;
|
166 |
-
|
167 |
-
case 'square':
|
168 |
-
$max_w = 50;
|
169 |
-
$max_h = 50;
|
170 |
-
$suffix = 'zm-square';
|
171 |
-
break;
|
172 |
-
|
173 |
-
case 'main':
|
174 |
-
$max_w = 454;
|
175 |
-
$max_h = 300;
|
176 |
-
$suffix = 'zm-main';
|
177 |
-
break;
|
178 |
-
|
179 |
-
default:
|
180 |
-
# code...
|
181 |
-
break;
|
182 |
-
}
|
183 |
-
|
184 |
-
return image_resize( $file, $max_w, $max_h, $crop = true, $suffix, $path = $this->upload_dir['path'] );
|
185 |
-
}
|
186 |
-
|
187 |
-
}
|
188 |
-
|
189 |
-
// End 'MediaUpload'
|
190 |
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Permissions NOT handled here!
|
5 |
+
*
|
6 |
+
* A series of related methods for managing file uploads within
|
7 |
+
* WordPress.
|
8 |
+
*
|
9 |
+
* @author Zane M. Kolnik zanematthew[at]gmail[dot]com
|
10 |
+
*/
|
11 |
+
if ( !class_exists( 'MediaUpload' ) ) {
|
12 |
+
|
13 |
+
Class MediaUpload {
|
14 |
+
|
15 |
+
public $upload_dir;
|
16 |
+
private $attachment_id;
|
17 |
+
|
18 |
+
public function __construct() {
|
19 |
+
|
20 |
+
$this->upload_dir = wp_upload_dir();
|
21 |
+
|
22 |
+
if ( is_admin() )
|
23 |
+
add_action( 'post_edit_form_tag', array( &$this, 'addEnctype' ) );
|
24 |
+
}
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Handles the saving, i.e. creates a post type of attachment.
|
28 |
+
*
|
29 |
+
* During form submission run the method:
|
30 |
+
* $class->fileUpload( $field_name='form_field_name' );
|
31 |
+
*
|
32 |
+
* @return $final_file An array of array of f*cking cool stuff
|
33 |
+
* I guess if you think arrays are cool i like (*)(*)s
|
34 |
+
* $final_file['attachment_id'] = $this->attachment_id;
|
35 |
+
* $final_file['file'] = $uploaded_file['file'];
|
36 |
+
* $final_file['file_info'] = $file_info[];
|
37 |
+
*/
|
38 |
+
public function saveUpload( $field_name = null, $user_id = null ) {
|
39 |
+
|
40 |
+
if ( is_null( $field_name ) )
|
41 |
+
die( 'Need field_name' );
|
42 |
+
|
43 |
+
// Move the file to the uploads directory, returns an array
|
44 |
+
// of information from $_FILES
|
45 |
+
$uploaded_file = $this->handleUpload( $_FILES[$field_name] );
|
46 |
+
|
47 |
+
if ( !isset( $uploaded_file['file'] ) )
|
48 |
+
return false;
|
49 |
+
|
50 |
+
// If we were to have a unique user account for uploading
|
51 |
+
if ( is_null( $user_id ) ) {
|
52 |
+
$current_user = wp_get_current_user();
|
53 |
+
$user_id = $current_user->ID;
|
54 |
+
}
|
55 |
+
|
56 |
+
// Build the Global Unique Identifier
|
57 |
+
$guid = $this->buildGuid( $uploaded_file['file'] );
|
58 |
+
|
59 |
+
// Build our array of data to be inserted as a post
|
60 |
+
$attachment = array(
|
61 |
+
'post_mime_type' => $_FILES[$field_name]['type'],
|
62 |
+
'guid' => $guid,
|
63 |
+
'post_title' => 'Uploaded : ' . $this->mediaTitle( $uploaded_file['file'] ),
|
64 |
+
'post_content' => '',
|
65 |
+
'post_author' => $user_id,
|
66 |
+
'post_status' => 'inherit',
|
67 |
+
'post_date' => date( 'Y-m-d H:i:s' ),
|
68 |
+
'post_date_gmt' => date( 'Y-m-d H:i:s' )
|
69 |
+
);
|
70 |
+
|
71 |
+
// Add the file to the media library and generate thumbnail.
|
72 |
+
$this->attachment_id = wp_insert_attachment( $attachment, $uploaded_file['file'] );
|
73 |
+
|
74 |
+
// @todo bug, this does NOT work when used in a PLUGIN!, so you'll have to make
|
75 |
+
// your OWN thumbnail sizes!
|
76 |
+
require_once( ABSPATH . "wp-admin" . '/includes/image.php' );
|
77 |
+
$meta = wp_generate_attachment_metadata( $this->attachment_id, $uploaded_file['file'] );
|
78 |
+
|
79 |
+
$image_meta = wp_read_image_metadata( $uploaded_file['file'] );
|
80 |
+
$meta['image_meta'] = $image_meta;
|
81 |
+
|
82 |
+
$image = New ImageMeta;
|
83 |
+
$meta['image_meta']['keywords'] = $image->iptcParser( 'keywords', $uploaded_file['file'] );
|
84 |
+
$meta['image_meta']['city'] = $image->iptcParser( 'city', $uploaded_file['file'] );
|
85 |
+
$meta['image_meta']['region'] = $image->iptcParser( 'region', $uploaded_file['file'] );
|
86 |
+
$meta['image_meta']['country'] = $image->iptcParser( 'country', $uploaded_file['file'] );
|
87 |
+
wp_update_attachment_metadata( $this->attachment_id, $meta );
|
88 |
+
|
89 |
+
$file_info = pathinfo( $uploaded_file['file'] );
|
90 |
+
|
91 |
+
// Set the feedback flag to false, since the upload was successful
|
92 |
+
$upload_feedback = false;
|
93 |
+
|
94 |
+
$final_file = array( );
|
95 |
+
$final_file['attachment_id'] = $this->attachment_id;
|
96 |
+
$final_file['file'] = $uploaded_file['file'];
|
97 |
+
$final_file['file_info'] = $file_info;
|
98 |
+
|
99 |
+
return $final_file;
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* Do some set-up before calling the wp_handle_upload function
|
104 |
+
*/
|
105 |
+
public function handleUpload( $file = array( ) ) {
|
106 |
+
require_once( ABSPATH . "wp-admin" . '/includes/file.php' );
|
107 |
+
return wp_handle_upload( $file, array( 'test_form' => false ), date( 'Y/m' ) );
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Builds the GUID for a given file from the media library
|
112 |
+
* @param full/path/to/file.jpg
|
113 |
+
* @return guid
|
114 |
+
*/
|
115 |
+
public function buildGuid( $file = null ) {
|
116 |
+
// $wp_upload_dir = wp_upload_dir();
|
117 |
+
return $this->upload_dir['baseurl'] . '/' . _wp_relative_upload_path( $file );
|
118 |
+
}
|
119 |
+
|
120 |
+
/**
|
121 |
+
* Parse the title of the media based on the file name
|
122 |
+
* @return title
|
123 |
+
*/
|
124 |
+
public function mediaTitle( $file ) {
|
125 |
+
return addslashes( preg_replace( '/\.[^.]+$/', '', basename( $file ) ) );
|
126 |
+
}
|
127 |
+
|
128 |
+
/**
|
129 |
+
* Adds the enctype for file upload, used with the hook
|
130 |
+
* post_edit_form_tag for adding uploader to post meta
|
131 |
+
*/
|
132 |
+
public function addEnctype() {
|
133 |
+
echo ' enctype="multipart/form-data"';
|
134 |
+
}
|
135 |
+
|
136 |
+
/**
|
137 |
+
* Resize images based on the "type"
|
138 |
+
*
|
139 |
+
* Normally this is done in WordPress, but for some reason
|
140 |
+
* wp_generate_attachment_metadata() does not work when
|
141 |
+
* used in a plugin.
|
142 |
+
*
|
143 |
+
* @param $file = /my/file/path/image.jpg
|
144 |
+
* @param $type = thumb|square|main
|
145 |
+
*
|
146 |
+
* @todo Since images are NOT "registered" with WordPress
|
147 |
+
* they will NOT be deleted from the media library when the
|
148 |
+
* original image is deleted!
|
149 |
+
*
|
150 |
+
* @todo use wp_update_attachment_metadata() to update
|
151 |
+
* the postmeta thumbnails ref. the array in
|
152 |
+
* wp_generate_attachment_metadata()
|
153 |
+
*
|
154 |
+
* @todo remove hardcoded sizes and suffix, possibly a
|
155 |
+
* public variable.
|
156 |
+
*
|
157 |
+
* @return same as image_resize() wp_error
|
158 |
+
*/
|
159 |
+
public function resizeImage( $file = null, $type = null ) {
|
160 |
+
switch ( $type ) {
|
161 |
+
case 'thumb':
|
162 |
+
$max_w = 104;
|
163 |
+
$max_h = 70;
|
164 |
+
$suffix = 'zm-thumb';
|
165 |
+
break;
|
166 |
+
|
167 |
+
case 'square':
|
168 |
+
$max_w = 50;
|
169 |
+
$max_h = 50;
|
170 |
+
$suffix = 'zm-square';
|
171 |
+
break;
|
172 |
+
|
173 |
+
case 'main':
|
174 |
+
$max_w = 454;
|
175 |
+
$max_h = 300;
|
176 |
+
$suffix = 'zm-main';
|
177 |
+
break;
|
178 |
+
|
179 |
+
default:
|
180 |
+
# code...
|
181 |
+
break;
|
182 |
+
}
|
183 |
+
|
184 |
+
return image_resize( $file, $max_w, $max_h, $crop = true, $suffix, $path = $this->upload_dir['path'] );
|
185 |
+
}
|
186 |
+
|
187 |
+
}
|
188 |
+
|
189 |
+
// End 'MediaUpload'
|
190 |
}
|
inc/vendor/class.sunrise-framework.php
CHANGED
@@ -1,324 +1,324 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// Check that class doesn't exists
|
4 |
-
if ( !class_exists( 'Sunrise_Plugin_Framework_2' ) ) {
|
5 |
-
|
6 |
-
/**
|
7 |
-
* Sunrise Plugin Framework Class
|
8 |
-
*
|
9 |
-
* @author Vladimir Anokhin <ano.vladimir@gmail.com>
|
10 |
-
* @link http://gndev.info/sunrise/
|
11 |
-
*/
|
12 |
-
class Sunrise_Plugin_Framework_2 {
|
13 |
-
|
14 |
-
/** @var string Plugin meta */
|
15 |
-
var $meta;
|
16 |
-
|
17 |
-
/** @var string Plugin base name */
|
18 |
-
var $basename;
|
19 |
-
|
20 |
-
/** @var string Short plugin slug */
|
21 |
-
var $slug;
|
22 |
-
|
23 |
-
/** @var string Plugin version */
|
24 |
-
var $version;
|
25 |
-
|
26 |
-
/** @var string Plugin textdomain */
|
27 |
-
var $textdomain;
|
28 |
-
|
29 |
-
/** @var string Full plugin name */
|
30 |
-
var $name;
|
31 |
-
|
32 |
-
/** @var string Plugin directory URL - http://example.com/wp-content/plugins/plugin-slug */
|
33 |
-
var $url;
|
34 |
-
|
35 |
-
/** @var string Relative path to includes directory */
|
36 |
-
var $includes;
|
37 |
-
|
38 |
-
/** @var string Relative path to views directory */
|
39 |
-
var $views;
|
40 |
-
|
41 |
-
/** @var string Relative path to assets directory */
|
42 |
-
var $assets;
|
43 |
-
|
44 |
-
/** @var string Plugin control panel URL */
|
45 |
-
var $admin_url;
|
46 |
-
|
47 |
-
/** @var string Plugin option name. This option contains all plugin settings */
|
48 |
-
var $option;
|
49 |
-
|
50 |
-
/** @var array Set of fields for options page */
|
51 |
-
var $options;
|
52 |
-
|
53 |
-
/** @var string Options page config */
|
54 |
-
var $settings;
|
55 |
-
|
56 |
-
/**
|
57 |
-
* Constructor
|
58 |
-
*
|
59 |
-
* @param $file
|
60 |
-
* @param array $args
|
61 |
-
*/
|
62 |
-
function __construct( $file, $args = array() ) {
|
63 |
-
// Default args
|
64 |
-
$defaults = array( 'includes' => 'inc', 'views' => 'inc/views', 'assets' => 'assets' );
|
65 |
-
// Prepare initial data
|
66 |
-
$this->file = $file;
|
67 |
-
$this->args = wp_parse_args( $args, $defaults );
|
68 |
-
// Check that function get_plugin_data exists
|
69 |
-
if ( !function_exists( 'get_plugin_data' ) )
|
70 |
-
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
71 |
-
// Read plugin meta
|
72 |
-
$this->meta = get_plugin_data( $this->file, false );
|
73 |
-
// Init plugin data
|
74 |
-
$this->basename = plugin_basename( $this->file );
|
75 |
-
$this->slug = sanitize_key( $this->meta['Name'] );
|
76 |
-
$this->version = sanitize_text_field( $this->meta['Version'] );
|
77 |
-
$this->textdomain = sanitize_html_class( $this->meta['TextDomain'] );
|
78 |
-
$this->name = $this->meta['Name'];
|
79 |
-
$this->url = plugins_url( '', $this->file );
|
80 |
-
$this->option = $this->slug . '_options';
|
81 |
-
$this->includes = trailingslashit( path_join( plugin_dir_path( $this->file ), trim( $this->args['includes'], '/' ) ) );
|
82 |
-
$this->views = trailingslashit( path_join( plugin_dir_path( $this->file ), trim( $this->args['views'], '/' ) ) );
|
83 |
-
$this->assets = trim( $this->args['assets'], '/' );
|
84 |
-
// Make plugin available for translation
|
85 |
-
load_plugin_textdomain( $this->textdomain, false, trailingslashit( path_join( dirname( $this->basename ), trim( $this->meta['DomainPath'], '/' ) ) ) );
|
86 |
-
}
|
87 |
-
|
88 |
-
function debug() {
|
89 |
-
die( '<pre>' . print_r( $this, true ) . '</pre>' );
|
90 |
-
}
|
91 |
-
|
92 |
-
/**
|
93 |
-
* Conditional tag to check there is settings page
|
94 |
-
*/
|
95 |
-
function is_settings() {
|
96 |
-
global $pagenow;
|
97 |
-
return is_admin() && $pagenow == $this->settings['parent'] && $_GET['page'] == $this->slug;
|
98 |
-
}
|
99 |
-
|
100 |
-
/**
|
101 |
-
* Register assets
|
102 |
-
*/
|
103 |
-
function register_assets() {
|
104 |
-
wp_register_style( 'sunrise-plugin-framework', $this->assets( 'css', 'sunrise.css' ), false, $this->version, 'all' );
|
105 |
-
wp_register_script( 'sunrise-plugin-framework-form', $this->assets( 'js', 'form.js' ), array( 'jquery' ), $this->version, false );
|
106 |
-
wp_register_script( 'sunrise-plugin-framework', $this->assets( 'js', 'sunrise.js' ), array( 'sunrise-plugin-framework-form' ), $this->version, false );
|
107 |
-
}
|
108 |
-
|
109 |
-
/**
|
110 |
-
* Enqueue assets
|
111 |
-
*/
|
112 |
-
function enqueue_assets() {
|
113 |
-
if ( !$this->is_settings() ) return;
|
114 |
-
foreach ( array( 'thickbox', 'farbtastic', 'sunrise-plugin-framework' ) as $style ) {
|
115 |
-
wp_enqueue_style( $style );
|
116 |
-
}
|
117 |
-
foreach ( array( 'jquery', 'media-upload', 'thickbox', 'farbtastic', 'sunrise-plugin-framework-form',
|
118 |
-
'sunrise-plugin-framework' ) as $script ) {
|
119 |
-
wp_enqueue_script( $script );
|
120 |
-
}
|
121 |
-
}
|
122 |
-
|
123 |
-
/**
|
124 |
-
* Helper function to get assets url by type
|
125 |
-
*/
|
126 |
-
function assets( $type = 'css', $file = 'sunrise.css' ) {
|
127 |
-
return implode( '/', array_filter( array( trim( $this->url, '/' ), trim( $this->assets, '/' ),
|
128 |
-
trim( $type, '/' ), trim( $file, '/' ) ) ) );
|
129 |
-
}
|
130 |
-
|
131 |
-
/**
|
132 |
-
* Set plugin settings to default
|
133 |
-
*/
|
134 |
-
function default_settings( $manual = false ) {
|
135 |
-
// Settings page is created
|
136 |
-
if ( $manual || !get_option( $this->option ) ) {
|
137 |
-
// Create array with default options
|
138 |
-
$defaults = array();
|
139 |
-
// Loop through available options
|
140 |
-
foreach ( (array) $this->options as $value ) $defaults[$value['id']] = $value['std'];
|
141 |
-
// Insert default options
|
142 |
-
update_option( $this->option, $defaults );
|
143 |
-
}
|
144 |
-
}
|
145 |
-
|
146 |
-
/**
|
147 |
-
* Get single option value
|
148 |
-
*
|
149 |
-
* @param mixed $option Option ID to return. If false, all options will be returned
|
150 |
-
*
|
151 |
-
* @return mixed $option Returns option by specified key
|
152 |
-
*/
|
153 |
-
function get_option( $option = false ) {
|
154 |
-
// Get options from database
|
155 |
-
$options = get_option( $this->option );
|
156 |
-
// Check option is specified
|
157 |
-
$value = ( $option ) ? $options[$option] : $options;
|
158 |
-
// Return result
|
159 |
-
return ( is_array( $value ) ) ? array_filter( $value, 'esc_attr' ) : esc_attr( stripslashes( $value ) );
|
160 |
-
}
|
161 |
-
|
162 |
-
/**
|
163 |
-
* Update single option value
|
164 |
-
*
|
165 |
-
* @param mixed $key Option ID to update
|
166 |
-
* @param mixed $value New value
|
167 |
-
*
|
168 |
-
* @return mixed $option Returns option by specified key
|
169 |
-
*/
|
170 |
-
function update_option( $key = false, $value = false ) {
|
171 |
-
// Prepare variables
|
172 |
-
$settings = get_option( $this->option );
|
173 |
-
$new_settings = array();
|
174 |
-
// Prepare data
|
175 |
-
foreach ( $settings as $id => $val ) $new_settings[$id] = ( $id == $key ) ? $value : $val;
|
176 |
-
// Update option and return operation result
|
177 |
-
return update_option( $this->option, $new_settings );
|
178 |
-
}
|
179 |
-
|
180 |
-
/**
|
181 |
-
* Action to save/reset options
|
182 |
-
*/
|
183 |
-
function manage_options() {
|
184 |
-
// Check this is settings page
|
185 |
-
if ( !$this->is_settings() ) return;
|
186 |
-
// ACTION: RESET
|
187 |
-
if ( $_GET['action'] == 'reset' ) {
|
188 |
-
// Prepare variables
|
189 |
-
$new_options = array();
|
190 |
-
// Prepare data
|
191 |
-
foreach ( $this->options as $value ) $new_options[$value['id']] = $value['std'];
|
192 |
-
// Save new options
|
193 |
-
if ( update_option( $this->option, $new_options ) ) {
|
194 |
-
// Redirect
|
195 |
-
wp_redirect( $this->admin_url . '&message=1' );
|
196 |
-
exit;
|
197 |
-
}
|
198 |
-
// Option doesn't updated
|
199 |
-
else {
|
200 |
-
// Redirect
|
201 |
-
wp_redirect( $this->admin_url . '&message=2' );
|
202 |
-
exit;
|
203 |
-
}
|
204 |
-
}
|
205 |
-
// ACTION: SAVE
|
206 |
-
elseif ( $_POST['action'] == 'save' ) {
|
207 |
-
// Prepare vars
|
208 |
-
$new_options = array();
|
209 |
-
// Prepare data
|
210 |
-
foreach ( $this->options as $value ) {
|
211 |
-
$new_options[$value['id']] = ( is_array( $_POST[$value['id']] ) ) ? $_POST[$value['id']]
|
212 |
-
: htmlspecialchars( $_POST[$value['id']] );
|
213 |
-
}
|
214 |
-
// Save new options
|
215 |
-
if ( update_option( $this->option, $new_options ) ) {
|
216 |
-
// Redirect
|
217 |
-
wp_redirect( $this->admin_url . '&message=3' );
|
218 |
-
exit;
|
219 |
-
}
|
220 |
-
// Options not saved
|
221 |
-
else {
|
222 |
-
// Redirect
|
223 |
-
wp_redirect( $this->admin_url . '&message=4' );
|
224 |
-
exit;
|
225 |
-
}
|
226 |
-
}
|
227 |
-
}
|
228 |
-
|
229 |
-
/**
|
230 |
-
* Register options page
|
231 |
-
*
|
232 |
-
* @param array $args Options page config
|
233 |
-
* @param array $options Set of fields for options page
|
234 |
-
*/
|
235 |
-
function add_options_page( $args, $options = array() ) {
|
236 |
-
// Save options
|
237 |
-
$this->options = $options;
|
238 |
-
// Prepare defaults
|
239 |
-
$defaults = array( 'parent' => 'options-general.php', 'menu_title' => $this->name,
|
240 |
-
'page_title' => $this->name, 'capability' => 'manage_options', 'link' => true );
|
241 |
-
// Parse args
|
242 |
-
$this->settings = wp_parse_args( $args, $defaults );
|
243 |
-
// Define admin url
|
244 |
-
$this->admin_url = admin_url( $this->settings['parent'] . '?page=' . $this->slug );
|
245 |
-
// Register and enqueue assets
|
246 |
-
add_action( 'admin_head', array( &$this, 'register_assets' ) );
|
247 |
-
add_action( 'admin_footer', array( &$this, 'enqueue_assets' ) );
|
248 |
-
// Insert default settings if it's doesn't exists
|
249 |
-
add_action( 'admin_init', array( &$this, 'default_settings' ) );
|
250 |
-
// Manage options
|
251 |
-
add_action( 'admin_menu', array( &$this, 'manage_options' ) );
|
252 |
-
// Add settings page
|
253 |
-
add_action( 'admin_menu', array( &$this, 'options_page' ) );
|
254 |
-
// Add settings link to plugins dashboard
|
255 |
-
if ( $this->settings['link'] ) add_filter( 'plugin_action_links_' . $this->basename, array( &$this,
|
256 |
-
'add_settings_link' ) );
|
257 |
-
}
|
258 |
-
|
259 |
-
/**
|
260 |
-
* Register settings page
|
261 |
-
*/
|
262 |
-
function options_page() {
|
263 |
-
add_submenu_page( $this->settings['parent'], __( $this->settings['page_title'], $this->textdomain ), __( $this->settings['menu_title'], $this->textdomain ), $this->settings['capability'], $this->slug, array( &$this,
|
264 |
-
'render_options_page' ) );
|
265 |
-
}
|
266 |
-
|
267 |
-
/**
|
268 |
-
* Display settings page
|
269 |
-
*/
|
270 |
-
function render_options_page() {
|
271 |
-
$backend_file = $this->views . 'settings.php';
|
272 |
-
if ( file_exists( $backend_file ) ) require_once $backend_file;
|
273 |
-
}
|
274 |
-
|
275 |
-
/**
|
276 |
-
* Add settings link to plugins dashboard
|
277 |
-
*/
|
278 |
-
function add_settings_link( $links ) {
|
279 |
-
$links[] = '<a href="' . $this->admin_url . '">' . __( 'Settings', $this->textdomain ) . '</a>';
|
280 |
-
return $links;
|
281 |
-
}
|
282 |
-
|
283 |
-
/**
|
284 |
-
* Display settings panes
|
285 |
-
*/
|
286 |
-
function render_panes() {
|
287 |
-
// Get current settings
|
288 |
-
$settings = get_option( $this->option );
|
289 |
-
// Options loop
|
290 |
-
foreach ( $this->options as $option ) {
|
291 |
-
// Get option file path
|
292 |
-
$option_file = $this->views . $option['type'] . '.php';
|
293 |
-
// Check that file exists and include it
|
294 |
-
if ( file_exists( $option_file ) ) include( $option_file );
|
295 |
-
else
|
296 |
-
trigger_error( 'Option file <strong>' . $option_file . '</strong> not found!', E_USER_NOTICE );
|
297 |
-
}
|
298 |
-
}
|
299 |
-
|
300 |
-
/**
|
301 |
-
* Display settings tabs
|
302 |
-
*/
|
303 |
-
function render_tabs() {
|
304 |
-
foreach ( $this->options as $option ) {
|
305 |
-
if ( $option['type'] == 'opentab' ) {
|
306 |
-
$active = ( isset( $active ) ) ? ' sunrise-plugin-tab-inactive'
|
307 |
-
: ' nav-tab-active sunrise-plugin-tab-active';
|
308 |
-
echo '<span class="nav-tab' . $active . '">' . $option['name'] . '</span>';
|
309 |
-
}
|
310 |
-
}
|
311 |
-
}
|
312 |
-
|
313 |
-
/**
|
314 |
-
* Show notifications
|
315 |
-
*/
|
316 |
-
function notifications( $notifications ) {
|
317 |
-
$file = $this->views . 'notifications.php';
|
318 |
-
if ( file_exists( $file ) ) include $file;
|
319 |
-
}
|
320 |
-
|
321 |
-
}
|
322 |
-
|
323 |
-
}
|
324 |
?>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// Check that class doesn't exists
|
4 |
+
if ( !class_exists( 'Sunrise_Plugin_Framework_2' ) ) {
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Sunrise Plugin Framework Class
|
8 |
+
*
|
9 |
+
* @author Vladimir Anokhin <ano.vladimir@gmail.com>
|
10 |
+
* @link http://gndev.info/sunrise/
|
11 |
+
*/
|
12 |
+
class Sunrise_Plugin_Framework_2 {
|
13 |
+
|
14 |
+
/** @var string Plugin meta */
|
15 |
+
var $meta;
|
16 |
+
|
17 |
+
/** @var string Plugin base name */
|
18 |
+
var $basename;
|
19 |
+
|
20 |
+
/** @var string Short plugin slug */
|
21 |
+
var $slug;
|
22 |
+
|
23 |
+
/** @var string Plugin version */
|
24 |
+
var $version;
|
25 |
+
|
26 |
+
/** @var string Plugin textdomain */
|
27 |
+
var $textdomain;
|
28 |
+
|
29 |
+
/** @var string Full plugin name */
|
30 |
+
var $name;
|
31 |
+
|
32 |
+
/** @var string Plugin directory URL - http://example.com/wp-content/plugins/plugin-slug */
|
33 |
+
var $url;
|
34 |
+
|
35 |
+
/** @var string Relative path to includes directory */
|
36 |
+
var $includes;
|
37 |
+
|
38 |
+
/** @var string Relative path to views directory */
|
39 |
+
var $views;
|
40 |
+
|
41 |
+
/** @var string Relative path to assets directory */
|
42 |
+
var $assets;
|
43 |
+
|
44 |
+
/** @var string Plugin control panel URL */
|
45 |
+
var $admin_url;
|
46 |
+
|
47 |
+
/** @var string Plugin option name. This option contains all plugin settings */
|
48 |
+
var $option;
|
49 |
+
|
50 |
+
/** @var array Set of fields for options page */
|
51 |
+
var $options;
|
52 |
+
|
53 |
+
/** @var string Options page config */
|
54 |
+
var $settings;
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Constructor
|
58 |
+
*
|
59 |
+
* @param $file
|
60 |
+
* @param array $args
|
61 |
+
*/
|
62 |
+
function __construct( $file, $args = array() ) {
|
63 |
+
// Default args
|
64 |
+
$defaults = array( 'includes' => 'inc', 'views' => 'inc/views', 'assets' => 'assets' );
|
65 |
+
// Prepare initial data
|
66 |
+
$this->file = $file;
|
67 |
+
$this->args = wp_parse_args( $args, $defaults );
|
68 |
+
// Check that function get_plugin_data exists
|
69 |
+
if ( !function_exists( 'get_plugin_data' ) )
|
70 |
+
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
71 |
+
// Read plugin meta
|
72 |
+
$this->meta = get_plugin_data( $this->file, false );
|
73 |
+
// Init plugin data
|
74 |
+
$this->basename = plugin_basename( $this->file );
|
75 |
+
$this->slug = sanitize_key( $this->meta['Name'] );
|
76 |
+
$this->version = sanitize_text_field( $this->meta['Version'] );
|
77 |
+
$this->textdomain = sanitize_html_class( $this->meta['TextDomain'] );
|
78 |
+
$this->name = $this->meta['Name'];
|
79 |
+
$this->url = plugins_url( '', $this->file );
|
80 |
+
$this->option = $this->slug . '_options';
|
81 |
+
$this->includes = trailingslashit( path_join( plugin_dir_path( $this->file ), trim( $this->args['includes'], '/' ) ) );
|
82 |
+
$this->views = trailingslashit( path_join( plugin_dir_path( $this->file ), trim( $this->args['views'], '/' ) ) );
|
83 |
+
$this->assets = trim( $this->args['assets'], '/' );
|
84 |
+
// Make plugin available for translation
|
85 |
+
load_plugin_textdomain( $this->textdomain, false, trailingslashit( path_join( dirname( $this->basename ), trim( $this->meta['DomainPath'], '/' ) ) ) );
|
86 |
+
}
|
87 |
+
|
88 |
+
function debug() {
|
89 |
+
die( '<pre>' . print_r( $this, true ) . '</pre>' );
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* Conditional tag to check there is settings page
|
94 |
+
*/
|
95 |
+
function is_settings() {
|
96 |
+
global $pagenow;
|
97 |
+
return is_admin() && $pagenow == $this->settings['parent'] && $_GET['page'] == $this->slug;
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Register assets
|
102 |
+
*/
|
103 |
+
function register_assets() {
|
104 |
+
wp_register_style( 'sunrise-plugin-framework', $this->assets( 'css', 'sunrise.css' ), false, $this->version, 'all' );
|
105 |
+
wp_register_script( 'sunrise-plugin-framework-form', $this->assets( 'js', 'form.js' ), array( 'jquery' ), $this->version, false );
|
106 |
+
wp_register_script( 'sunrise-plugin-framework', $this->assets( 'js', 'sunrise.js' ), array( 'sunrise-plugin-framework-form' ), $this->version, false );
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Enqueue assets
|
111 |
+
*/
|
112 |
+
function enqueue_assets() {
|
113 |
+
if ( !$this->is_settings() ) return;
|
114 |
+
foreach ( array( 'thickbox', 'farbtastic', 'sunrise-plugin-framework' ) as $style ) {
|
115 |
+
wp_enqueue_style( $style );
|
116 |
+
}
|
117 |
+
foreach ( array( 'jquery', 'media-upload', 'thickbox', 'farbtastic', 'sunrise-plugin-framework-form',
|
118 |
+
'sunrise-plugin-framework' ) as $script ) {
|
119 |
+
wp_enqueue_script( $script );
|
120 |
+
}
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* Helper function to get assets url by type
|
125 |
+
*/
|
126 |
+
function assets( $type = 'css', $file = 'sunrise.css' ) {
|
127 |
+
return implode( '/', array_filter( array( trim( $this->url, '/' ), trim( $this->assets, '/' ),
|
128 |
+
trim( $type, '/' ), trim( $file, '/' ) ) ) );
|
129 |
+
}
|
130 |
+
|
131 |
+
/**
|
132 |
+
* Set plugin settings to default
|
133 |
+
*/
|
134 |
+
function default_settings( $manual = false ) {
|
135 |
+
// Settings page is created
|
136 |
+
if ( $manual || !get_option( $this->option ) ) {
|
137 |
+
// Create array with default options
|
138 |
+
$defaults = array();
|
139 |
+
// Loop through available options
|
140 |
+
foreach ( (array) $this->options as $value ) $defaults[$value['id']] = $value['std'];
|
141 |
+
// Insert default options
|
142 |
+
update_option( $this->option, $defaults );
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Get single option value
|
148 |
+
*
|
149 |
+
* @param mixed $option Option ID to return. If false, all options will be returned
|
150 |
+
*
|
151 |
+
* @return mixed $option Returns option by specified key
|
152 |
+
*/
|
153 |
+
function get_option( $option = false ) {
|
154 |
+
// Get options from database
|
155 |
+
$options = get_option( $this->option );
|
156 |
+
// Check option is specified
|
157 |
+
$value = ( $option ) ? $options[$option] : $options;
|
158 |
+
// Return result
|
159 |
+
return ( is_array( $value ) ) ? array_filter( $value, 'esc_attr' ) : esc_attr( stripslashes( $value ) );
|
160 |
+
}
|
161 |
+
|
162 |
+
/**
|
163 |
+
* Update single option value
|
164 |
+
*
|
165 |
+
* @param mixed $key Option ID to update
|
166 |
+
* @param mixed $value New value
|
167 |
+
*
|
168 |
+
* @return mixed $option Returns option by specified key
|
169 |
+
*/
|
170 |
+
function update_option( $key = false, $value = false ) {
|
171 |
+
// Prepare variables
|
172 |
+
$settings = get_option( $this->option );
|
173 |
+
$new_settings = array();
|
174 |
+
// Prepare data
|
175 |
+
foreach ( $settings as $id => $val ) $new_settings[$id] = ( $id == $key ) ? $value : $val;
|
176 |
+
// Update option and return operation result
|
177 |
+
return update_option( $this->option, $new_settings );
|
178 |
+
}
|
179 |
+
|
180 |
+
/**
|
181 |
+
* Action to save/reset options
|
182 |
+
*/
|
183 |
+
function manage_options() {
|
184 |
+
// Check this is settings page
|
185 |
+
if ( !$this->is_settings() ) return;
|
186 |
+
// ACTION: RESET
|
187 |
+
if ( $_GET['action'] == 'reset' ) {
|
188 |
+
// Prepare variables
|
189 |
+
$new_options = array();
|
190 |
+
// Prepare data
|
191 |
+
foreach ( $this->options as $value ) $new_options[$value['id']] = $value['std'];
|
192 |
+
// Save new options
|
193 |
+
if ( update_option( $this->option, $new_options ) ) {
|
194 |
+
// Redirect
|
195 |
+
wp_redirect( $this->admin_url . '&message=1' );
|
196 |
+
exit;
|
197 |
+
}
|
198 |
+
// Option doesn't updated
|
199 |
+
else {
|
200 |
+
// Redirect
|
201 |
+
wp_redirect( $this->admin_url . '&message=2' );
|
202 |
+
exit;
|
203 |
+
}
|
204 |
+
}
|
205 |
+
// ACTION: SAVE
|
206 |
+
elseif ( $_POST['action'] == 'save' ) {
|
207 |
+
// Prepare vars
|
208 |
+
$new_options = array();
|
209 |
+
// Prepare data
|
210 |
+
foreach ( $this->options as $value ) {
|
211 |
+
$new_options[$value['id']] = ( is_array( $_POST[$value['id']] ) ) ? $_POST[$value['id']]
|
212 |
+
: htmlspecialchars( $_POST[$value['id']] );
|
213 |
+
}
|
214 |
+
// Save new options
|
215 |
+
if ( update_option( $this->option, $new_options ) ) {
|
216 |
+
// Redirect
|
217 |
+
wp_redirect( $this->admin_url . '&message=3' );
|
218 |
+
exit;
|
219 |
+
}
|
220 |
+
// Options not saved
|
221 |
+
else {
|
222 |
+
// Redirect
|
223 |
+
wp_redirect( $this->admin_url . '&message=4' );
|
224 |
+
exit;
|
225 |
+
}
|
226 |
+
}
|
227 |
+
}
|
228 |
+
|
229 |
+
/**
|
230 |
+
* Register options page
|
231 |
+
*
|
232 |
+
* @param array $args Options page config
|
233 |
+
* @param array $options Set of fields for options page
|
234 |
+
*/
|
235 |
+
function add_options_page( $args, $options = array() ) {
|
236 |
+
// Save options
|
237 |
+
$this->options = $options;
|
238 |
+
// Prepare defaults
|
239 |
+
$defaults = array( 'parent' => 'options-general.php', 'menu_title' => $this->name,
|
240 |
+
'page_title' => $this->name, 'capability' => 'manage_options', 'link' => true );
|
241 |
+
// Parse args
|
242 |
+
$this->settings = wp_parse_args( $args, $defaults );
|
243 |
+
// Define admin url
|
244 |
+
$this->admin_url = admin_url( $this->settings['parent'] . '?page=' . $this->slug );
|
245 |
+
// Register and enqueue assets
|
246 |
+
add_action( 'admin_head', array( &$this, 'register_assets' ) );
|
247 |
+
add_action( 'admin_footer', array( &$this, 'enqueue_assets' ) );
|
248 |
+
// Insert default settings if it's doesn't exists
|
249 |
+
add_action( 'admin_init', array( &$this, 'default_settings' ) );
|
250 |
+
// Manage options
|
251 |
+
add_action( 'admin_menu', array( &$this, 'manage_options' ) );
|
252 |
+
// Add settings page
|
253 |
+
add_action( 'admin_menu', array( &$this, 'options_page' ) );
|
254 |
+
// Add settings link to plugins dashboard
|
255 |
+
if ( $this->settings['link'] ) add_filter( 'plugin_action_links_' . $this->basename, array( &$this,
|
256 |
+
'add_settings_link' ) );
|
257 |
+
}
|
258 |
+
|
259 |
+
/**
|
260 |
+
* Register settings page
|
261 |
+
*/
|
262 |
+
function options_page() {
|
263 |
+
add_submenu_page( $this->settings['parent'], __( $this->settings['page_title'], $this->textdomain ), __( $this->settings['menu_title'], $this->textdomain ), $this->settings['capability'], $this->slug, array( &$this,
|
264 |
+
'render_options_page' ) );
|
265 |
+
}
|
266 |
+
|
267 |
+
/**
|
268 |
+
* Display settings page
|
269 |
+
*/
|
270 |
+
function render_options_page() {
|
271 |
+
$backend_file = $this->views . 'settings.php';
|
272 |
+
if ( file_exists( $backend_file ) ) require_once $backend_file;
|
273 |
+
}
|
274 |
+
|
275 |
+
/**
|
276 |
+
* Add settings link to plugins dashboard
|
277 |
+
*/
|
278 |
+
function add_settings_link( $links ) {
|
279 |
+
$links[] = '<a href="' . $this->admin_url . '">' . __( 'Settings', $this->textdomain ) . '</a>';
|
280 |
+
return $links;
|
281 |
+
}
|
282 |
+
|
283 |
+
/**
|
284 |
+
* Display settings panes
|
285 |
+
*/
|
286 |
+
function render_panes() {
|
287 |
+
// Get current settings
|
288 |
+
$settings = get_option( $this->option );
|
289 |
+
// Options loop
|
290 |
+
foreach ( $this->options as $option ) {
|
291 |
+
// Get option file path
|
292 |
+
$option_file = $this->views . $option['type'] . '.php';
|
293 |
+
// Check that file exists and include it
|
294 |
+
if ( file_exists( $option_file ) ) include( $option_file );
|
295 |
+
else
|
296 |
+
trigger_error( 'Option file <strong>' . $option_file . '</strong> not found!', E_USER_NOTICE );
|
297 |
+
}
|
298 |
+
}
|
299 |
+
|
300 |
+
/**
|
301 |
+
* Display settings tabs
|
302 |
+
*/
|
303 |
+
function render_tabs() {
|
304 |
+
foreach ( $this->options as $option ) {
|
305 |
+
if ( $option['type'] == 'opentab' ) {
|
306 |
+
$active = ( isset( $active ) ) ? ' sunrise-plugin-tab-inactive'
|
307 |
+
: ' nav-tab-active sunrise-plugin-tab-active';
|
308 |
+
echo '<span class="nav-tab' . $active . '">' . $option['name'] . '</span>';
|
309 |
+
}
|
310 |
+
}
|
311 |
+
}
|
312 |
+
|
313 |
+
/**
|
314 |
+
* Show notifications
|
315 |
+
*/
|
316 |
+
function notifications( $notifications ) {
|
317 |
+
$file = $this->views . 'notifications.php';
|
318 |
+
if ( file_exists( $file ) ) include $file;
|
319 |
+
}
|
320 |
+
|
321 |
+
}
|
322 |
+
|
323 |
+
}
|
324 |
?>
|
inc/views/about.php
CHANGED
@@ -1,47 +1,47 @@
|
|
1 |
-
<div id="su-about-screen">
|
2 |
-
<h1><?php _e( 'Welcome to Shortcodes Ultimate', $this->textdomain ); ?> <small><?php _e( 'A real swiss army knife for WordPress', $this->textdomain ); ?></small></h1>
|
3 |
-
<div id="su-links">
|
4 |
-
<a href="http://gndev.info/shortcodes-ultimate/" target="_blank"><strong><?php _e( 'Project homepage', $this->textdomain ); ?></strong></a>
|
5 |
-
<span></span>
|
6 |
-
<a href="http://gndev.info/shortcodes-ultimate/#Addons" target="_blank"><?php _e( 'Addons', $this->textdomain ); ?></a>
|
7 |
-
<span></span>
|
8 |
-
<a href="http://gndev.info/kb/" target="_blank"><?php _e( 'Documentation', $this->textdomain ); ?></a>
|
9 |
-
<span></span>
|
10 |
-
<a href="http://wordpress.org/support/plugin/shortcodes-ultimate/" target="_blank"><?php _e( 'Support forum', $this->textdomain ); ?></a>
|
11 |
-
<span></span>
|
12 |
-
<a href="http://wordpress.org/extend/plugins/shortcodes-ultimate/changelog/" target="_blank"><?php _e( 'Changelog', $this->textdomain ); ?></a>
|
13 |
-
<span></span>
|
14 |
-
<a href="https://github.com/gndev/shortcodes-ultimate" target="_blank"><?php _e( 'GitHub', $this->textdomain ); ?></a>
|
15 |
-
<span></span>
|
16 |
-
<a href="http://gndev.info/feedback/" target="_blank"><?php _e( 'Contact author', $this->textdomain ); ?></a>
|
17 |
-
</div>
|
18 |
-
<div class="su-about-column">
|
19 |
-
<h3><?php _e( 'Plugin features', $this->textdomain ); ?></h3>
|
20 |
-
<ul>
|
21 |
-
<li><?php _e( '35+ amazing shortcodes', $this->textdomain ); ?></li>
|
22 |
-
<li><?php _e( 'Power of CSS3 transitions', $this->textdomain ); ?></li>
|
23 |
-
<li><?php _e( 'Handy shortcodes generator', $this->textdomain ) ?></li>
|
24 |
-
<li><?php _e( 'International', $this->textdomain ); ?></li>
|
25 |
-
<li><?php _e( 'Documented API', $this->textdomain ); ?></li>
|
26 |
-
</ul>
|
27 |
-
</div>
|
28 |
-
<div class="su-about-column">
|
29 |
-
<h3><?php _e( 'What is a shortcode?', $this->textdomain ); ?></h3>
|
30 |
-
<p><?php _e( '<strong>Shortcode</strong> is a WordPress-specific code that lets you do nifty things with very little effort.', $this->
|
31 |
-
<p><?php _e( 'Shortcodes can embed files or create objects that would normally require lots of complicated, ugly code in just one line. Shortcode = shortcut.', $this->textdomain ); ?></p>
|
32 |
-
</div>
|
33 |
-
<div class="su-clear"></div>
|
34 |
-
<div class="su-about-column">
|
35 |
-
<h3><?php _e( 'How does it works', $this->textdomain ); ?></h3>
|
36 |
-
<iframe style="width:100%" width="220" height="170" src="http://www.youtube.com/embed/DR2c266yWEA" frameborder="0" allowfullscreen=""></iframe>
|
37 |
-
</div>
|
38 |
-
<div class="su-about-column">
|
39 |
-
<h3><?php _e( 'More videos', $this->textdomain ); ?></h3>
|
40 |
-
<ul>
|
41 |
-
<li><a href="http://www.youtube.com/watch?v=IjmaXz-b55I" target="_blank"><?php _e( 'Shortcodes Ultimate Tutorial', $this->textdomain ); ?></a></li>
|
42 |
-
<li><a href="http://www.youtube.com/watch?v=YU3Zu6C5ZfA" target="_blank"><?php _e( 'How to use special widget', $this->textdomain ); ?></a></li>
|
43 |
-
<li><a href="http://www.screenr.com/BK0H" target="_blank"><?php _e( 'How to create Carousel', $this->textdomain ); ?></a></li>
|
44 |
-
</ul>
|
45 |
-
</div>
|
46 |
-
<div class="su-clear"></div>
|
1 |
+
<div id="su-about-screen">
|
2 |
+
<h1><?php _e( 'Welcome to Shortcodes Ultimate', $this->textdomain ); ?> <small><?php _e( 'A real swiss army knife for WordPress', $this->textdomain ); ?></small></h1>
|
3 |
+
<div id="su-links">
|
4 |
+
<a href="http://gndev.info/shortcodes-ultimate/" target="_blank"><strong><?php _e( 'Project homepage', $this->textdomain ); ?></strong></a>
|
5 |
+
<span></span>
|
6 |
+
<a href="http://gndev.info/shortcodes-ultimate/#Addons" target="_blank"><?php _e( 'Addons', $this->textdomain ); ?></a>
|
7 |
+
<span></span>
|
8 |
+
<a href="http://gndev.info/kb/" target="_blank"><?php _e( 'Documentation', $this->textdomain ); ?></a>
|
9 |
+
<span></span>
|
10 |
+
<a href="http://wordpress.org/support/plugin/shortcodes-ultimate/" target="_blank"><?php _e( 'Support forum', $this->textdomain ); ?></a>
|
11 |
+
<span></span>
|
12 |
+
<a href="http://wordpress.org/extend/plugins/shortcodes-ultimate/changelog/" target="_blank"><?php _e( 'Changelog', $this->textdomain ); ?></a>
|
13 |
+
<span></span>
|
14 |
+
<a href="https://github.com/gndev/shortcodes-ultimate" target="_blank"><?php _e( 'GitHub', $this->textdomain ); ?></a>
|
15 |
+
<span></span>
|
16 |
+
<a href="http://gndev.info/feedback/" target="_blank"><?php _e( 'Contact author', $this->textdomain ); ?></a>
|
17 |
+
</div>
|
18 |
+
<div class="su-about-column">
|
19 |
+
<h3><?php _e( 'Plugin features', $this->textdomain ); ?></h3>
|
20 |
+
<ul>
|
21 |
+
<li><?php _e( '35+ amazing shortcodes', $this->textdomain ); ?></li>
|
22 |
+
<li><?php _e( 'Power of CSS3 transitions', $this->textdomain ); ?></li>
|
23 |
+
<li><?php _e( 'Handy shortcodes generator', $this->textdomain ) ?></li>
|
24 |
+
<li><?php _e( 'International', $this->textdomain ); ?></li>
|
25 |
+
<li><?php _e( 'Documented API', $this->textdomain ); ?></li>
|
26 |
+
</ul>
|
27 |
+
</div>
|
28 |
+
<div class="su-about-column">
|
29 |
+
<h3><?php _e( 'What is a shortcode?', $this->textdomain ); ?></h3>
|
30 |
+
<p><?php _e( '<strong>Shortcode</strong> is a WordPress-specific code that lets you do nifty things with very little effort.', $this->textdoma
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|