Version Description
13-06-2022 =
Update: plugin structure change and add more features.
Download this release
Release Info
Developer | EmranAhmed |
Plugin | WooCommerce Variation Swatches |
Version | 2.0.0 |
Comparing to | |
See all releases |
Code changes from version 1.1.19 to 2.0.0
- README.txt +38 -7
- assets/css/admin.css +218 -232
- assets/css/admin.min.css +1 -8
- assets/css/frontend-tooltip.css +0 -130
- assets/css/frontend-tooltip.min.css +0 -8
- assets/css/frontend.css +770 -255
- assets/css/frontend.min.css +1 -8
- assets/css/gwp-admin-notice.css +0 -317
- assets/css/gwp-admin-notice.min.css +0 -8
- assets/css/gwp-admin.css +0 -384
- assets/css/gwp-admin.min.css +0 -8
- assets/css/wvs-theme-override.css +0 -272
- assets/css/wvs-theme-override.min.css +0 -8
- assets/js/admin.js +771 -349
- assets/js/admin.min.js +1 -1
- assets/js/bluebird.js +0 -5647
- assets/js/bluebird.min.js +0 -1
- assets/js/divi_woo_layout_injector.js +0 -326
- assets/js/divi_woo_layout_injector.min.js +0 -1
- assets/js/form-field-dependency.js +0 -809
- assets/js/form-field-dependency.min.js +0 -1
- assets/js/frontend.js +435 -447
- assets/js/frontend.min.js +1 -1
- assets/js/gwp-admin.js +0 -184
- assets/js/gwp-admin.min.js +0 -1
- assets/js/gwp-backbone-modal.js +0 -182
- assets/js/gwp-backbone-modal.min.js +0 -1
- assets/js/jquery.serializejson.js +338 -0
- assets/js/jquery.serializejson.min.js +338 -0
- assets/js/wp-color-picker-alpha.js +710 -583
- assets/js/wp-color-picker-alpha.min.js +1 -1
- includes/class-woo-variation-swatches-backend.php +289 -0
- includes/class-woo-variation-swatches-compatibility.php +60 -0
- includes/class-woo-variation-swatches-deactivate-feedback.php +101 -0
- includes/class-woo-variation-swatches-export-import.php +256 -242
- includes/class-woo-variation-swatches-frontend.php +290 -0
- includes/class-woo-variation-swatches-manage-cache.php +70 -0
- includes/class-woo-variation-swatches-product-page.php +731 -0
- includes/class-woo-variation-swatches-settings.php +762 -0
- includes/class-woo-variation-swatches-term-meta.php +415 -0
- includes/class-woo-variation-swatches.php +206 -0
- includes/class-wvs-customize-alpha-color-control.php +0 -42
- includes/class-wvs-customize-heading.php +0 -63
- includes/class-wvs-customizer.php +0 -144
- includes/class-wvs-settings-api.php +0 -795
- includes/class-wvs-term-meta.php +0 -326
- includes/functions.php +0 -1084
README.txt
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
=== Variation Swatches for WooCommerce ===
|
2 |
Contributors: EmranAhmed, getwooplugins
|
3 |
Tags: woocommerce variation swatches, woocommerce variation, woocommerce, variation swatches, woocommerce attributes, product attributes, product color, product size, variable product attributes, variation product swatches, color variation swatch, image variation swatch, printful color swatches
|
4 |
-
Requires PHP:
|
5 |
-
Requires at least:
|
6 |
-
|
7 |
-
|
8 |
-
WC tested up to: 5
|
9 |
Stable tag: trunk
|
10 |
License: GPLv3
|
11 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
@@ -188,6 +188,8 @@ There are many other useful plugins that serve different purposes, and many user
|
|
188 |
|
189 |
[youtube https://www.youtube.com/watch?v=1IhEZiGzJHs]
|
190 |
|
|
|
|
|
191 |
👉 Auto Convert All Dropdowns to Image Swatch If Variation Has a Featured Image Set
|
192 |
|
193 |
If you have already set featured images for variations, then it will automatically convert all dropdowns to image swatch. That means you don’t need the hassle to do it manually which in return will save your valuable time.
|
@@ -352,6 +354,14 @@ The Variation Swatches for WooCommerce plugin converts filter products by attrib
|
|
352 |
|
353 |
[Live Demo & Documentation](http://bit.ly/filter-widget-link-doc)
|
354 |
<hr />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
355 |
👉 Compatible with Printful, Alidrop, and Multivendor Plugins
|
356 |
|
357 |
This Variation Swatches plugin is compatible with major themes and most popular plugins for WooCommerce. On top of that, it is also compatible with printful, alidrop and multi-vendor plugins.
|
@@ -384,7 +394,7 @@ Clear button allows you to clear the selected attribute variation. The Woocommer
|
|
384 |
👉 Customize swatches colors, background and border sizes
|
385 |
👉 Automatic updates
|
386 |
|
387 |
-
Keeping your plugin updated is crucial for security and stability of your site. We update
|
388 |
|
389 |
👉 Exclusive technical support
|
390 |
|
@@ -507,11 +517,25 @@ We provide exclusive technical support to our customers. Our plugin has plenty o
|
|
507 |
</ul>
|
508 |
</blockquote>
|
509 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
510 |
== Installation ==
|
511 |
|
512 |
### Automatic Install From WordPress Dashboard
|
513 |
|
514 |
-
1. Login to your
|
515 |
2. Navigate to Plugins -> Add New
|
516 |
3. Search **Variation Swatches for WooCommerce**
|
517 |
4. Click install and activate respectively.
|
@@ -593,6 +617,10 @@ And your are ready to go.
|
|
593 |
|
594 |
== Changelog ==
|
595 |
|
|
|
|
|
|
|
|
|
596 |
= 1.1.19 - 07-09-2021 =
|
597 |
|
598 |
* Fix: show_option_none value
|
@@ -1093,3 +1121,6 @@ And your are ready to go.
|
|
1093 |
* Initial release
|
1094 |
|
1095 |
== Upgrade Notice ==
|
|
|
|
|
|
1 |
=== Variation Swatches for WooCommerce ===
|
2 |
Contributors: EmranAhmed, getwooplugins
|
3 |
Tags: woocommerce variation swatches, woocommerce variation, woocommerce, variation swatches, woocommerce attributes, product attributes, product color, product size, variable product attributes, variation product swatches, color variation swatch, image variation swatch, printful color swatches
|
4 |
+
Requires PHP: 7.0
|
5 |
+
Requires at least: 5.5
|
6 |
+
Tested up to: 6.0
|
7 |
+
WC requires at least: 5.5
|
8 |
+
WC tested up to: 6.5
|
9 |
Stable tag: trunk
|
10 |
License: GPLv3
|
11 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
188 |
|
189 |
[youtube https://www.youtube.com/watch?v=1IhEZiGzJHs]
|
190 |
|
191 |
+
Besides adding swatches on the product page, you can show [WooCommerce variation swatches on shop page](https://getwooplugins.com/plugins/woocommerce-variation-swatches/)
|
192 |
+
|
193 |
👉 Auto Convert All Dropdowns to Image Swatch If Variation Has a Featured Image Set
|
194 |
|
195 |
If you have already set featured images for variations, then it will automatically convert all dropdowns to image swatch. That means you don’t need the hassle to do it manually which in return will save your valuable time.
|
354 |
|
355 |
[Live Demo & Documentation](http://bit.ly/filter-widget-link-doc)
|
356 |
<hr />
|
357 |
+
|
358 |
+
👉 Create Categoried & Grouped Variation Swatches
|
359 |
+
|
360 |
+
Users may feel confused to select desired variation swatches among many options. Category and Group swatches feature makes it easy to select the right product variation with ease.
|
361 |
+
|
362 |
+
[Live Demo & Documentation](https://getwooplugins.com/documentation/woocommerce-variation-swatches/#category-group-swatches)
|
363 |
+
<hr />
|
364 |
+
|
365 |
👉 Compatible with Printful, Alidrop, and Multivendor Plugins
|
366 |
|
367 |
This Variation Swatches plugin is compatible with major themes and most popular plugins for WooCommerce. On top of that, it is also compatible with printful, alidrop and multi-vendor plugins.
|
394 |
👉 Customize swatches colors, background and border sizes
|
395 |
👉 Automatic updates
|
396 |
|
397 |
+
Keeping your plugin updated is crucial for security and stability of your site. We try to update our [variation swatches for woocommerce pro](https://wordpress.org/support/topic/the-best-support-ever-thank-you-guys/) plugin regularly. You can enable auto update for this swatch plugin directly from your WordPress dashboard.
|
398 |
|
399 |
👉 Exclusive technical support
|
400 |
|
517 |
</ul>
|
518 |
</blockquote>
|
519 |
|
520 |
+
= Featured on Poular Blog Sites =
|
521 |
+
|
522 |
+
<blockquote>
|
523 |
+
|
524 |
+
<ul>
|
525 |
+
<li><a target="_blank" href="https://wpcred.com">wpcred.com</a></li>
|
526 |
+
</ul>
|
527 |
+
<ul>
|
528 |
+
<li><a target="_blank" href="https://storepress.com">storepress.com</a></li>
|
529 |
+
</ul>
|
530 |
+
|
531 |
+
</blockquote>
|
532 |
+
|
533 |
+
|
534 |
== Installation ==
|
535 |
|
536 |
### Automatic Install From WordPress Dashboard
|
537 |
|
538 |
+
1. Login to your admin panel
|
539 |
2. Navigate to Plugins -> Add New
|
540 |
3. Search **Variation Swatches for WooCommerce**
|
541 |
4. Click install and activate respectively.
|
617 |
|
618 |
== Changelog ==
|
619 |
|
620 |
+
= 2.0.0 - 13-06-2022 =
|
621 |
+
|
622 |
+
* Update: plugin structure change and add more features.
|
623 |
+
|
624 |
= 1.1.19 - 07-09-2021 =
|
625 |
|
626 |
* Fix: show_option_none value
|
1121 |
* Initial release
|
1122 |
|
1123 |
== Upgrade Notice ==
|
1124 |
+
|
1125 |
+
= 2.0 =
|
1126 |
+
If you are using PRO version of this plugin please disable it first. This version has a lot of update.
|
assets/css/admin.css
CHANGED
@@ -1,74 +1,49 @@
|
|
1 |
/*!
|
2 |
-
* Variation Swatches for WooCommerce
|
3 |
*
|
4 |
* Author: Emran Ahmed ( emran.bd.08@gmail.com )
|
5 |
-
* Date:
|
6 |
* Released under the GPLv3 license.
|
7 |
*/
|
8 |
.button.button-danger {
|
9 |
color: #FFFFFF;
|
10 |
background-color: #AF2D2B;
|
11 |
border-color: #A62D2B;
|
12 |
-
box-shadow: 0 1px 0 #A72D2B;
|
|
|
13 |
vertical-align: top;
|
14 |
}
|
15 |
-
|
16 |
-
.button.button-danger:hover,
|
17 |
-
.button.button-danger:focus,
|
18 |
-
.button.button-danger:active,
|
19 |
-
.button.button-danger.active {
|
20 |
color: #FFFFFF;
|
21 |
background: #C9302C;
|
22 |
}
|
23 |
|
24 |
-
[data-
|
25 |
-
display: none;
|
26 |
}
|
27 |
|
28 |
.meta-image-field-wrapper {
|
29 |
display: table;
|
30 |
}
|
31 |
-
|
32 |
.meta-image-field-wrapper .button {
|
33 |
margin: 5px 0;
|
34 |
display: block;
|
35 |
}
|
36 |
-
|
37 |
.meta-image-field-wrapper .image-preview {
|
38 |
display: table-cell;
|
39 |
width: 60px;
|
40 |
padding-right: 10px;
|
41 |
}
|
42 |
-
|
43 |
.meta-image-field-wrapper .button-wrapper {
|
44 |
display: table-cell;
|
45 |
vertical-align: top;
|
46 |
}
|
47 |
|
48 |
-
.
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
}
|
54 |
-
|
55 |
-
.gwp-rate-stars svg,
|
56 |
-
.gwp-rate-stars svg a {
|
57 |
-
fill: #FFB900;
|
58 |
-
stroke: #FFB900;
|
59 |
-
cursor: pointer;
|
60 |
-
}
|
61 |
-
|
62 |
-
.gwp-rate-stars svg:hover,
|
63 |
-
.gwp-rate-stars svg a:hover {
|
64 |
-
fill: #FFB900;
|
65 |
-
}
|
66 |
-
|
67 |
-
.gwp-rate-stars svg:hover ~ svg,
|
68 |
-
.gwp-rate-stars svg:hover ~ svg a,
|
69 |
-
.gwp-rate-stars svg a:hover ~ svg,
|
70 |
-
.gwp-rate-stars svg a:hover ~ svg a {
|
71 |
-
fill: none;
|
72 |
}
|
73 |
|
74 |
#wvs-meta-preview {
|
@@ -81,280 +56,291 @@
|
|
81 |
border: #000000 1px solid;
|
82 |
}
|
83 |
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
#woo-variation-swatches-settings-wrap #settings-tabs h2 {
|
89 |
-
font-size: 1.5em;
|
90 |
-
margin-bottom: 10px;
|
91 |
}
|
92 |
|
93 |
-
#woo-variation-swatches-
|
94 |
-
|
95 |
-
background: #FFFFFF;
|
96 |
border-radius: 2px;
|
97 |
-
|
98 |
}
|
99 |
-
|
100 |
-
#woo-variation-swatches-settings-wrap #settings-tabs .form-table tr {
|
101 |
-
border-bottom: 1px solid #EEEEEE;
|
102 |
-
display: block;
|
103 |
-
}
|
104 |
-
|
105 |
-
#woo-variation-swatches-settings-wrap #settings-tabs .form-table tr:last-child {
|
106 |
-
border: 0;
|
107 |
-
}
|
108 |
-
|
109 |
-
#woo-variation-swatches-settings-wrap #settings-tabs .form-table th {
|
110 |
-
padding: 20px 10px 20px 20px;
|
111 |
-
}
|
112 |
-
|
113 |
-
#woo-variation-swatches-settings-wrap #settings-tabs #style .form-table,
|
114 |
-
#woo-variation-swatches-settings-wrap #settings-tabs #special .form-table {
|
115 |
-
margin-bottom: 30px;
|
116 |
-
}
|
117 |
-
|
118 |
-
#woo-variation-swatches-settings-wrap #tutorial .form-table tr {
|
119 |
-
padding: 0 !important;
|
120 |
-
}
|
121 |
-
|
122 |
-
#woo-variation-swatches-settings-wrap #tutorial .gwp-tutorials-wrapper img {
|
123 |
width: 100%;
|
124 |
}
|
125 |
-
|
126 |
-
#woo-variation-swatches-settings-wrap #tutorial .gwp-tutorials-wrapper ul {
|
127 |
margin: 0;
|
128 |
}
|
129 |
-
|
130 |
-
#woo-variation-swatches-settings-wrap #tutorial .gwp-tutorials-wrapper li {
|
131 |
overflow: hidden;
|
|
|
|
|
132 |
display: flex;
|
133 |
-
align
|
|
|
|
|
134 |
padding: 50px 30px;
|
135 |
margin: 0;
|
136 |
border-bottom: 1px solid #DDDDDD;
|
137 |
position: relative;
|
138 |
}
|
139 |
-
|
140 |
-
#woo-variation-swatches-settings-wrap #tutorial .gwp-tutorials-wrapper li:last-child {
|
141 |
border: 0;
|
142 |
}
|
143 |
-
|
144 |
-
#woo-variation-swatches-settings-wrap #tutorial .gwp-tutorials-wrapper .tutorial-image-wrapper,
|
145 |
-
#woo-variation-swatches-settings-wrap #tutorial .gwp-tutorials-wrapper .tutorial-description-wrapper {
|
146 |
float: left;
|
147 |
padding: 0 20px;
|
148 |
-
box-sizing: border-box;
|
|
|
149 |
}
|
150 |
-
|
151 |
-
|
152 |
width: 60%;
|
153 |
}
|
154 |
-
|
155 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
width: 40%;
|
157 |
}
|
158 |
-
|
159 |
-
#woo-variation-swatches-settings-wrap #tutorial .gwp-tutorials-wrapper .tutorial-description-wrapper h3 {
|
160 |
margin: 0 0 20px;
|
161 |
font-size: 1.5em;
|
162 |
}
|
163 |
-
|
164 |
-
#woo-variation-swatches-settings-wrap #tutorial .gwp-tutorials-wrapper .tutorial-description-wrapper .tutorial-contents {
|
165 |
font-size: 15px;
|
166 |
line-height: 1.5em;
|
167 |
margin-bottom: 20px;
|
168 |
}
|
169 |
-
|
170 |
-
#woo-variation-swatches-settings-wrap #tutorial .gwp-tutorials-wrapper .tutorial-description-wrapper .tutorial-buttons .button {
|
171 |
border-radius: 3px;
|
172 |
line-height: 1;
|
173 |
padding: 13px 20px;
|
174 |
font-size: 13px;
|
175 |
height: 40px;
|
176 |
-
box-shadow: none;
|
|
|
177 |
text-shadow: none;
|
178 |
}
|
179 |
-
|
180 |
-
#woo-variation-swatches-settings-wrap #tutorial .gwp-tutorials-wrapper .tutorial-description-wrapper .tutorial-buttons .button:active {
|
181 |
-webkit-transform: translateY(0);
|
|
|
182 |
transform: translateY(0);
|
183 |
}
|
184 |
-
|
185 |
-
#woo-variation-swatches-settings-wrap #tutorial .gwp-tutorials-wrapper .tutorial-description-wrapper .tutorial-buttons .button.button-live-demo {
|
186 |
background-color: #F44336;
|
187 |
color: #fff;
|
188 |
border: 0;
|
189 |
}
|
190 |
-
|
191 |
-
#woo-variation-swatches-settings-wrap #tutorial .gwp-tutorials-wrapper .tutorial-description-wrapper .tutorial-buttons .button.button-live-demo:hover {
|
192 |
background: #c71609;
|
193 |
}
|
194 |
-
|
195 |
-
#woo-variation-swatches-settings-wrap #tutorial .gwp-tutorials-wrapper .tutorial-description-wrapper .tutorial-buttons .button.button-docs {
|
196 |
background-color: #36373A;
|
197 |
color: #FFFFFF;
|
198 |
border: 0;
|
199 |
}
|
200 |
-
|
201 |
-
#woo-variation-swatches-settings-wrap #tutorial .gwp-tutorials-wrapper .tutorial-description-wrapper .tutorial-buttons .button.button-docs:hover {
|
202 |
background: #5D5E61;
|
203 |
border-color: #5D5E61;
|
204 |
}
|
205 |
-
|
206 |
-
#woo-variation-swatches-settings-wrap #tutorial .gwp-tutorials-wrapper .tutorial-description-wrapper .tutorial-buttons .button.button-pro {
|
207 |
background-color: #39B54A;
|
208 |
color: #FFFFFF;
|
209 |
border: 1px solid #39B54A;
|
210 |
}
|
211 |
-
|
212 |
-
#woo-variation-swatches-settings-wrap #tutorial .gwp-tutorials-wrapper .tutorial-description-wrapper .tutorial-buttons .button.button-pro:hover {
|
213 |
background: #3FC851;
|
214 |
border-color: #3FC851;
|
215 |
}
|
216 |
|
217 |
-
|
218 |
-
|
219 |
}
|
220 |
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
top: -5px;
|
225 |
-
z-index: 1;
|
226 |
-
overflow: hidden;
|
227 |
-
width: 75px;
|
228 |
-
height: 75px;
|
229 |
-
text-align: right;
|
230 |
-
margin: 1px 22px;
|
231 |
}
|
232 |
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
width: 100px;
|
243 |
-
display: block;
|
244 |
-
background: #BC0808;
|
245 |
-
box-shadow: 0 3px 10px -5px black;
|
246 |
-
position: absolute;
|
247 |
-
top: 19px;
|
248 |
-
left: -21px;
|
249 |
}
|
250 |
-
|
251 |
-
|
252 |
-
content: "";
|
253 |
-
position: absolute;
|
254 |
-
left: 0px;
|
255 |
-
top: 100%;
|
256 |
-
z-index: -1;
|
257 |
-
border-width: 3px;
|
258 |
-
border-style: solid;
|
259 |
-
border-color: #8f0808 transparent transparent #8f0808;
|
260 |
}
|
261 |
-
|
262 |
-
|
263 |
-
content: "";
|
264 |
-
position: absolute;
|
265 |
-
right: 0px;
|
266 |
-
top: 100%;
|
267 |
-
z-index: -1;
|
268 |
-
border-width: 3px;
|
269 |
-
border-style: solid;
|
270 |
-
border-color: #8f0808 #8f0808 transparent transparent;
|
271 |
}
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
|
|
|
|
|
|
|
|
276 |
}
|
277 |
-
|
278 |
-
|
279 |
-
#woo-variation-swatches-settings-wrap .nav-tab-wrapper [data-pro-text]::after,
|
280 |
-
#woo-variation-swatches-settings-wrap .nav-tab-wrapper [data-new-text]::before,
|
281 |
-
#woo-variation-swatches-settings-wrap .nav-tab-wrapper [data-new-text]::after {
|
282 |
-
-webkit-transform: translateY(-50%);
|
283 |
-
transform: translateY(-50%);
|
284 |
-
position: absolute;
|
285 |
-
right: 5px;
|
286 |
-
top: 0;
|
287 |
-
color: #FFFFFF;
|
288 |
-
font-size: 8px;
|
289 |
-
font-weight: normal;
|
290 |
-
text-transform: uppercase;
|
291 |
-
padding: 3px 5px;
|
292 |
-
line-height: 1;
|
293 |
-
border-radius: 10px;
|
294 |
}
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
}
|
300 |
-
|
301 |
-
|
302 |
-
content: attr(data-new-text);
|
303 |
-
background: #2196F3;
|
304 |
}
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
|
|
|
|
|
|
|
|
|
|
319 |
}
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
}
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
329 |
}
|
330 |
-
|
331 |
-
|
332 |
-
|
|
|
333 |
}
|
334 |
-
|
335 |
-
|
336 |
-
display: block;
|
337 |
}
|
338 |
-
|
339 |
-
|
340 |
-
padding: 2px 4px;
|
341 |
-
background: #fa0000;
|
342 |
-
color: #fff;
|
343 |
-
text-transform: uppercase;
|
344 |
-
font-size: 9px;
|
345 |
-
border-radius: 2px;
|
346 |
}
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
text-transform: uppercase;
|
353 |
-
font-style: italic;
|
354 |
-
text-decoration: underline;
|
355 |
padding: 0 5px;
|
356 |
}
|
357 |
-
|
358 |
-
|
359 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
360 |
}
|
1 |
/*!
|
2 |
+
* Variation Swatches for WooCommerce
|
3 |
*
|
4 |
* Author: Emran Ahmed ( emran.bd.08@gmail.com )
|
5 |
+
* Date: 6/13/2022, 4:04:45 PM
|
6 |
* Released under the GPLv3 license.
|
7 |
*/
|
8 |
.button.button-danger {
|
9 |
color: #FFFFFF;
|
10 |
background-color: #AF2D2B;
|
11 |
border-color: #A62D2B;
|
12 |
+
-webkit-box-shadow: 0 1px 0 #A72D2B;
|
13 |
+
box-shadow: 0 1px 0 #A72D2B;
|
14 |
vertical-align: top;
|
15 |
}
|
16 |
+
.button.button-danger:hover, .button.button-danger:focus, .button.button-danger:active, .button.button-danger.active {
|
|
|
|
|
|
|
|
|
17 |
color: #FFFFFF;
|
18 |
background: #C9302C;
|
19 |
}
|
20 |
|
21 |
+
[data-dependency]:not(.dependency-show) {
|
22 |
+
display: none !important;
|
23 |
}
|
24 |
|
25 |
.meta-image-field-wrapper {
|
26 |
display: table;
|
27 |
}
|
|
|
28 |
.meta-image-field-wrapper .button {
|
29 |
margin: 5px 0;
|
30 |
display: block;
|
31 |
}
|
|
|
32 |
.meta-image-field-wrapper .image-preview {
|
33 |
display: table-cell;
|
34 |
width: 60px;
|
35 |
padding-right: 10px;
|
36 |
}
|
|
|
37 |
.meta-image-field-wrapper .button-wrapper {
|
38 |
display: table-cell;
|
39 |
vertical-align: top;
|
40 |
}
|
41 |
|
42 |
+
.wvs-go-pro-action-link > a {
|
43 |
+
font-weight: bold;
|
44 |
+
text-transform: capitalize;
|
45 |
+
color: #9c27b0;
|
46 |
+
text-shadow: 1px 1px 1px #eee;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
}
|
48 |
|
49 |
#wvs-meta-preview {
|
56 |
border: #000000 1px solid;
|
57 |
}
|
58 |
|
59 |
+
.woo-variation-swatches-pro_tab.pro-inactive a {
|
60 |
+
background-color: var(--wc-primary);
|
61 |
+
color: var(--wc-content-bg);
|
|
|
|
|
|
|
|
|
62 |
}
|
63 |
|
64 |
+
#woo-variation-swatches-tutorials-wrapper {
|
65 |
+
background: #fff;
|
|
|
66 |
border-radius: 2px;
|
67 |
+
border: 1px solid #DDDDDD;
|
68 |
}
|
69 |
+
#woo-variation-swatches-tutorials-wrapper img {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
width: 100%;
|
71 |
}
|
72 |
+
#woo-variation-swatches-tutorials-wrapper ul {
|
|
|
73 |
margin: 0;
|
74 |
}
|
75 |
+
#woo-variation-swatches-tutorials-wrapper li {
|
|
|
76 |
overflow: hidden;
|
77 |
+
display: -webkit-box;
|
78 |
+
display: -ms-flexbox;
|
79 |
display: flex;
|
80 |
+
-webkit-box-align: center;
|
81 |
+
-ms-flex-align: center;
|
82 |
+
align-items: center;
|
83 |
padding: 50px 30px;
|
84 |
margin: 0;
|
85 |
border-bottom: 1px solid #DDDDDD;
|
86 |
position: relative;
|
87 |
}
|
88 |
+
#woo-variation-swatches-tutorials-wrapper li:last-child {
|
|
|
89 |
border: 0;
|
90 |
}
|
91 |
+
#woo-variation-swatches-tutorials-wrapper .tutorial-image-wrapper, #woo-variation-swatches-tutorials-wrapper .tutorial-description-wrapper {
|
|
|
|
|
92 |
float: left;
|
93 |
padding: 0 20px;
|
94 |
+
-webkit-box-sizing: border-box;
|
95 |
+
box-sizing: border-box;
|
96 |
}
|
97 |
+
#woo-variation-swatches-tutorials-wrapper .tutorial-image-wrapper {
|
98 |
+
position: relative;
|
99 |
width: 60%;
|
100 |
}
|
101 |
+
#woo-variation-swatches-tutorials-wrapper .tutorial-image-wrapper .ribbon {
|
102 |
+
position: absolute;
|
103 |
+
left: -5px;
|
104 |
+
top: -5px;
|
105 |
+
z-index: 1;
|
106 |
+
overflow: hidden;
|
107 |
+
width: 75px;
|
108 |
+
height: 75px;
|
109 |
+
text-align: right;
|
110 |
+
margin: 1px 22px;
|
111 |
+
}
|
112 |
+
#woo-variation-swatches-tutorials-wrapper .tutorial-image-wrapper .ribbon span {
|
113 |
+
font-size: 10px;
|
114 |
+
font-weight: bold;
|
115 |
+
color: #FFFFFF;
|
116 |
+
text-transform: uppercase;
|
117 |
+
text-align: center;
|
118 |
+
line-height: 20px;
|
119 |
+
-webkit-transform: rotate(-45deg);
|
120 |
+
-ms-transform: rotate(-45deg);
|
121 |
+
transform: rotate(-45deg);
|
122 |
+
width: 100px;
|
123 |
+
display: block;
|
124 |
+
background: #BC0808;
|
125 |
+
-webkit-box-shadow: 0 3px 10px -5px black;
|
126 |
+
box-shadow: 0 3px 10px -5px black;
|
127 |
+
position: absolute;
|
128 |
+
top: 19px;
|
129 |
+
left: -21px;
|
130 |
+
}
|
131 |
+
#woo-variation-swatches-tutorials-wrapper .tutorial-image-wrapper .ribbon span::after {
|
132 |
+
content: "";
|
133 |
+
position: absolute;
|
134 |
+
right: 0;
|
135 |
+
top: 100%;
|
136 |
+
z-index: -1;
|
137 |
+
border-width: 3px;
|
138 |
+
border-style: solid;
|
139 |
+
border-color: #8f0808 #8f0808 transparent transparent;
|
140 |
+
}
|
141 |
+
#woo-variation-swatches-tutorials-wrapper .tutorial-description-wrapper {
|
142 |
width: 40%;
|
143 |
}
|
144 |
+
#woo-variation-swatches-tutorials-wrapper .tutorial-description-wrapper h3 {
|
|
|
145 |
margin: 0 0 20px;
|
146 |
font-size: 1.5em;
|
147 |
}
|
148 |
+
#woo-variation-swatches-tutorials-wrapper .tutorial-description-wrapper .tutorial-contents {
|
|
|
149 |
font-size: 15px;
|
150 |
line-height: 1.5em;
|
151 |
margin-bottom: 20px;
|
152 |
}
|
153 |
+
#woo-variation-swatches-tutorials-wrapper .tutorial-description-wrapper .tutorial-buttons .button {
|
|
|
154 |
border-radius: 3px;
|
155 |
line-height: 1;
|
156 |
padding: 13px 20px;
|
157 |
font-size: 13px;
|
158 |
height: 40px;
|
159 |
+
-webkit-box-shadow: none;
|
160 |
+
box-shadow: none;
|
161 |
text-shadow: none;
|
162 |
}
|
163 |
+
#woo-variation-swatches-tutorials-wrapper .tutorial-description-wrapper .tutorial-buttons .button:active {
|
|
|
164 |
-webkit-transform: translateY(0);
|
165 |
+
-ms-transform: translateY(0);
|
166 |
transform: translateY(0);
|
167 |
}
|
168 |
+
#woo-variation-swatches-tutorials-wrapper .tutorial-description-wrapper .tutorial-buttons .button.button-live-demo {
|
|
|
169 |
background-color: #F44336;
|
170 |
color: #fff;
|
171 |
border: 0;
|
172 |
}
|
173 |
+
#woo-variation-swatches-tutorials-wrapper .tutorial-description-wrapper .tutorial-buttons .button.button-live-demo:hover {
|
|
|
174 |
background: #c71609;
|
175 |
}
|
176 |
+
#woo-variation-swatches-tutorials-wrapper .tutorial-description-wrapper .tutorial-buttons .button.button-docs {
|
|
|
177 |
background-color: #36373A;
|
178 |
color: #FFFFFF;
|
179 |
border: 0;
|
180 |
}
|
181 |
+
#woo-variation-swatches-tutorials-wrapper .tutorial-description-wrapper .tutorial-buttons .button.button-docs:hover {
|
|
|
182 |
background: #5D5E61;
|
183 |
border-color: #5D5E61;
|
184 |
}
|
185 |
+
#woo-variation-swatches-tutorials-wrapper .tutorial-description-wrapper .tutorial-buttons .button.button-pro {
|
|
|
186 |
background-color: #39B54A;
|
187 |
color: #FFFFFF;
|
188 |
border: 1px solid #39B54A;
|
189 |
}
|
190 |
+
#woo-variation-swatches-tutorials-wrapper .tutorial-description-wrapper .tutorial-buttons .button.button-pro:hover {
|
|
|
191 |
background: #3FC851;
|
192 |
border-color: #3FC851;
|
193 |
}
|
194 |
|
195 |
+
.woo-variation-swatches-group-table-list tbody > :nth-child(odd) {
|
196 |
+
background-color: #f6f7f7;
|
197 |
}
|
198 |
|
199 |
+
.woo-variation-swatches-group-section-wrapper .woocommerce-BlankState-message::before {
|
200 |
+
font-family: "Dashicons";
|
201 |
+
content: "\F307";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
202 |
}
|
203 |
|
204 |
+
.woo-variation-swatches-variation-product-options-wrapper {
|
205 |
+
/*.woo-variation-swatches-settings-heading {
|
206 |
+
font-weight: 600 !important;
|
207 |
+
color: #252a2e;
|
208 |
+
font-size: 14px;
|
209 |
+
!*border-top: 1px solid #c3c4c7;
|
210 |
+
border-bottom: 1px solid #c3c4c7;*!
|
211 |
+
padding: 15px 10px !important;
|
212 |
+
}*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
}
|
214 |
+
.woo-variation-swatches-variation-product-options-wrapper .woocommerce-message {
|
215 |
+
margin: 10px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
216 |
}
|
217 |
+
.woo-variation-swatches-variation-product-options-wrapper #saved-message {
|
218 |
+
display: none;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
}
|
220 |
+
.woo-variation-swatches-variation-product-options-wrapper h4 {
|
221 |
+
margin: 0 !important;
|
222 |
+
padding: 10px 18px;
|
223 |
+
font-size: 1em !important;
|
224 |
+
overflow: hidden;
|
225 |
+
-webkit-box-align: center;
|
226 |
+
-ms-flex-align: center;
|
227 |
+
align-items: center;
|
228 |
}
|
229 |
+
.woo-variation-swatches-variation-product-options-wrapper .woocommerce-help-tip {
|
230 |
+
margin: 0 5px !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
}
|
232 |
+
.woo-variation-swatches-variation-product-options-wrapper [data-gwpdepends].has-dependent-data.show {
|
233 |
+
display: -webkit-box;
|
234 |
+
display: -ms-flexbox;
|
235 |
+
display: flex;
|
236 |
}
|
237 |
+
.woo-variation-swatches-variation-product-options-wrapper .product-label-settings {
|
238 |
+
background-color: #fff;
|
|
|
|
|
239 |
}
|
240 |
+
.woo-variation-swatches-variation-product-options-wrapper .form-settings-group {
|
241 |
+
padding: 5px;
|
242 |
+
border-bottom: 1px solid #eee;
|
243 |
+
display: -webkit-box;
|
244 |
+
display: -ms-flexbox;
|
245 |
+
display: flex;
|
246 |
+
-ms-flex-wrap: wrap;
|
247 |
+
flex-wrap: wrap;
|
248 |
+
-webkit-box-orient: horizontal;
|
249 |
+
-webkit-box-direction: normal;
|
250 |
+
-ms-flex-direction: row;
|
251 |
+
flex-direction: row;
|
252 |
+
}
|
253 |
+
.woo-variation-swatches-variation-product-options-wrapper .form-settings-group .form-label {
|
254 |
+
vertical-align: middle;
|
255 |
+
line-height: 2;
|
256 |
+
width: 280px;
|
257 |
+
margin: 5px 10px;
|
258 |
+
font-weight: bold;
|
259 |
}
|
260 |
+
.woo-variation-swatches-variation-product-options-wrapper .form-settings-group .form-field {
|
261 |
+
vertical-align: middle;
|
262 |
+
line-height: 2;
|
263 |
+
margin: 5px 10px;
|
264 |
}
|
265 |
+
.woo-variation-swatches-variation-product-options-wrapper .form-settings-group .form-field .description {
|
266 |
+
display: inline-block;
|
267 |
+
vertical-align: middle;
|
268 |
+
padding: 0 10px;
|
269 |
+
}
|
270 |
+
.woo-variation-swatches-variation-product-options-wrapper .form-settings-group:last-child {
|
271 |
+
/*border-bottom: 0;*/
|
272 |
+
}
|
273 |
+
.woo-variation-swatches-variation-product-options-wrapper .form-settings-group-inline {
|
274 |
+
display: -webkit-inline-box;
|
275 |
+
display: -ms-inline-flexbox;
|
276 |
+
display: inline-flex;
|
277 |
+
-webkit-box-align: center;
|
278 |
+
-ms-flex-align: center;
|
279 |
+
align-items: center;
|
280 |
+
}
|
281 |
+
.woo-variation-swatches-variation-product-options-wrapper .wc-metabox {
|
282 |
+
display: -webkit-box;
|
283 |
+
display: -ms-flexbox;
|
284 |
+
display: flex;
|
285 |
+
-webkit-box-orient: vertical;
|
286 |
+
-webkit-box-direction: normal;
|
287 |
+
-ms-flex-direction: column;
|
288 |
+
flex-direction: column;
|
289 |
+
/*border: 1px solid #eeeeee;*/
|
290 |
+
border-bottom: none !important;
|
291 |
+
border-radius: 0 !important;
|
292 |
+
}
|
293 |
+
.woo-variation-swatches-variation-product-options-wrapper .wc-metabox > h4 {
|
294 |
+
cursor: pointer;
|
295 |
+
background-color: #fafafa;
|
296 |
+
display: -webkit-box;
|
297 |
+
display: -ms-flexbox;
|
298 |
+
display: flex;
|
299 |
+
border-bottom: 1px solid #eeeeee;
|
300 |
}
|
301 |
+
.woo-variation-swatches-variation-product-options-wrapper .wc-metabox > h4 .attribute-label {
|
302 |
+
-webkit-box-flex: 1;
|
303 |
+
-ms-flex-positive: 1;
|
304 |
+
flex-grow: 1;
|
305 |
}
|
306 |
+
.woo-variation-swatches-variation-product-options-wrapper .wc-metabox.open > h4 {
|
307 |
+
background-color: #eeeeee;
|
|
|
308 |
}
|
309 |
+
.woo-variation-swatches-variation-product-options-wrapper .wc-metabox .wc-metabox {
|
310 |
+
border: 1px solid #eeeeee;
|
|
|
|
|
|
|
|
|
|
|
|
|
311 |
}
|
312 |
+
.woo-variation-swatches-variation-product-options-wrapper .woo-variation-swatches-attribute-data {
|
313 |
+
background-color: #fff;
|
314 |
+
}
|
315 |
+
.woo-variation-swatches-variation-product-options-wrapper .woo-variation-swatches-attribute-data-inner {
|
316 |
+
margin: 5px 0;
|
|
|
|
|
|
|
317 |
padding: 0 5px;
|
318 |
}
|
319 |
+
.woo-variation-swatches-variation-product-options-wrapper .product-term-label-settings {
|
320 |
+
margin: 15px;
|
321 |
+
}
|
322 |
+
.woo-variation-swatches-variation-product-options-wrapper .product-term-label-settings-contents {
|
323 |
+
/* border-left: 1px solid #c3c4c7;
|
324 |
+
border-right: 1px solid #c3c4c7;*/
|
325 |
+
}
|
326 |
+
.woo-variation-swatches-variation-product-options-wrapper .product-term-label-settings-pagination {
|
327 |
+
/*border-top: 1px solid #eeeeee;*/
|
328 |
+
margin: 10px 0;
|
329 |
+
}
|
330 |
+
.woo-variation-swatches-variation-product-options-wrapper .product-term-label-settings-pagination .tablenav-pages {
|
331 |
+
display: -webkit-box;
|
332 |
+
display: -ms-flexbox;
|
333 |
+
display: flex;
|
334 |
+
-webkit-box-orient: horizontal;
|
335 |
+
-webkit-box-direction: normal;
|
336 |
+
-ms-flex-direction: row;
|
337 |
+
flex-direction: row;
|
338 |
+
-webkit-box-pack: end;
|
339 |
+
-ms-flex-pack: end;
|
340 |
+
justify-content: flex-end;
|
341 |
+
line-height: 2;
|
342 |
+
vertical-align: center;
|
343 |
+
}
|
344 |
+
.woo-variation-swatches-variation-product-options-wrapper .product-term-label-settings-pagination .tablenav-pages .displaying-num {
|
345 |
+
padding: 0 2px;
|
346 |
}
|
assets/css/admin.min.css
CHANGED
@@ -1,8 +1 @@
|
|
1 |
-
|
2 |
-
* Variation Swatches for WooCommerce v1.1.19
|
3 |
-
*
|
4 |
-
* Author: Emran Ahmed ( emran.bd.08@gmail.com )
|
5 |
-
* Date: 07/09/2021
|
6 |
-
* Released under the GPLv3 license.
|
7 |
-
*/
|
8 |
-
.button.button-danger{color:#fff;background-color:#af2d2b;border-color:#a62d2b;box-shadow:0 1px 0 #a72d2b;vertical-align:top}.button.button-danger.active,.button.button-danger:active,.button.button-danger:focus,.button.button-danger:hover{color:#fff;background:#c9302c}[data-wvsdepends]{display:none}.meta-image-field-wrapper{display:table}.meta-image-field-wrapper .button{margin:5px 0;display:block}.meta-image-field-wrapper .image-preview{display:table-cell;width:60px;padding-right:10px}.meta-image-field-wrapper .button-wrapper{display:table-cell;vertical-align:top}.gwp-rate-stars{display:inline-block;color:#ffb900;position:relative;top:3px}.gwp-rate-stars svg,.gwp-rate-stars svg a{fill:#ffb900;stroke:#ffb900;cursor:pointer}.gwp-rate-stars svg:hover,.gwp-rate-stars svg a:hover{fill:#ffb900}.gwp-rate-stars svg:hover~svg,.gwp-rate-stars svg:hover~svg a,.gwp-rate-stars svg a:hover~svg,.gwp-rate-stars svg a:hover~svg a{fill:none}#wvs-meta-preview{width:30px}.wvs-preview{width:30px;height:30px;border:1px solid #000}#woo-variation-swatches-settings-wrap #settings-tabs{margin-top:30px}#woo-variation-swatches-settings-wrap #settings-tabs h2{font-size:1.5em;margin-bottom:10px}#woo-variation-swatches-settings-wrap #settings-tabs .form-table{margin-top:15px;background:#fff;border-radius:2px;box-shadow:0 0 0 1px rgba(0,0,0,.07),0 1px 1px rgba(0,0,0,.04)}#woo-variation-swatches-settings-wrap #settings-tabs .form-table tr{border-bottom:1px solid #eee;display:block}#woo-variation-swatches-settings-wrap #settings-tabs .form-table tr:last-child{border:0}#woo-variation-swatches-settings-wrap #settings-tabs .form-table th{padding:20px 10px 20px 20px}#woo-variation-swatches-settings-wrap #settings-tabs #special .form-table,#woo-variation-swatches-settings-wrap #settings-tabs #style .form-table{margin-bottom:30px}#woo-variation-swatches-settings-wrap #tutorial .form-table tr{padding:0!important}#woo-variation-swatches-settings-wrap #tutorial .gwp-tutorials-wrapper img{width:100%}#woo-variation-swatches-settings-wrap #tutorial .gwp-tutorials-wrapper ul{margin:0}#woo-variation-swatches-settings-wrap #tutorial .gwp-tutorials-wrapper li{overflow:hidden;display:flex;align-items:center;padding:50px 30px;margin:0;border-bottom:1px solid #ddd;position:relative}#woo-variation-swatches-settings-wrap #tutorial .gwp-tutorials-wrapper li:last-child{border:0}#woo-variation-swatches-settings-wrap #tutorial .gwp-tutorials-wrapper .tutorial-description-wrapper,#woo-variation-swatches-settings-wrap #tutorial .gwp-tutorials-wrapper .tutorial-image-wrapper{float:left;padding:0 20px;box-sizing:border-box}#woo-variation-swatches-settings-wrap #tutorial .gwp-tutorials-wrapper .tutorial-image-wrapper{width:60%}#woo-variation-swatches-settings-wrap #tutorial .gwp-tutorials-wrapper .tutorial-description-wrapper{width:40%}#woo-variation-swatches-settings-wrap #tutorial .gwp-tutorials-wrapper .tutorial-description-wrapper h3{margin:0 0 20px;font-size:1.5em}#woo-variation-swatches-settings-wrap #tutorial .gwp-tutorials-wrapper .tutorial-description-wrapper .tutorial-contents{font-size:15px;line-height:1.5em;margin-bottom:20px}#woo-variation-swatches-settings-wrap #tutorial .gwp-tutorials-wrapper .tutorial-description-wrapper .tutorial-buttons .button{border-radius:3px;line-height:1;padding:13px 20px;font-size:13px;height:40px;box-shadow:none;text-shadow:none}#woo-variation-swatches-settings-wrap #tutorial .gwp-tutorials-wrapper .tutorial-description-wrapper .tutorial-buttons .button:active{-webkit-transform:translateY(0);transform:translateY(0)}#woo-variation-swatches-settings-wrap #tutorial .gwp-tutorials-wrapper .tutorial-description-wrapper .tutorial-buttons .button.button-live-demo{background-color:#f44336;color:#fff;border:0}#woo-variation-swatches-settings-wrap #tutorial .gwp-tutorials-wrapper .tutorial-description-wrapper .tutorial-buttons .button.button-live-demo:hover{background:#c71609}#woo-variation-swatches-settings-wrap #tutorial .gwp-tutorials-wrapper .tutorial-description-wrapper .tutorial-buttons .button.button-docs{background-color:#36373a;color:#fff;border:0}#woo-variation-swatches-settings-wrap #tutorial .gwp-tutorials-wrapper .tutorial-description-wrapper .tutorial-buttons .button.button-docs:hover{background:#5d5e61;border-color:#5d5e61}#woo-variation-swatches-settings-wrap #tutorial .gwp-tutorials-wrapper .tutorial-description-wrapper .tutorial-buttons .button.button-pro{background-color:#39b54a;color:#fff;border:1px solid #39b54a}#woo-variation-swatches-settings-wrap #tutorial .gwp-tutorials-wrapper .tutorial-description-wrapper .tutorial-buttons .button.button-pro:hover{background:#3fc851;border-color:#3fc851}#woo-variation-swatches-settings-wrap #tutorial .gwp-tutorials-wrapper .tutorial-image-wrapper{position:relative}#woo-variation-swatches-settings-wrap #tutorial .gwp-tutorials-wrapper .tutorial-image-wrapper .ribbon{position:absolute;left:-5px;top:-5px;z-index:1;overflow:hidden;width:75px;height:75px;text-align:right;margin:1px 22px}#woo-variation-swatches-settings-wrap #tutorial .gwp-tutorials-wrapper .tutorial-image-wrapper .ribbon span{font-size:10px;font-weight:700;color:#fff;text-transform:uppercase;text-align:center;line-height:20px;-webkit-transform:rotate(-45deg);transform:rotate(-45deg);width:100px;display:block;background:#bc0808;box-shadow:0 3px 10px -5px #000;position:absolute;top:19px;left:-21px}#woo-variation-swatches-settings-wrap #tutorial .gwp-tutorials-wrapper .tutorial-image-wrapper .ribbon span:before{content:"";position:absolute;left:0;top:100%;z-index:-1;border-width:3px;border-style:solid;border-color:#8f0808 transparent transparent #8f0808}#woo-variation-swatches-settings-wrap #tutorial .gwp-tutorials-wrapper .tutorial-image-wrapper .ribbon span:after{content:"";position:absolute;right:0;top:100%;z-index:-1;border-width:3px;border-style:solid;border-color:#8f0808 #8f0808 transparent transparent}#woo-variation-swatches-settings-wrap .nav-tab-wrapper [data-new-text],#woo-variation-swatches-settings-wrap .nav-tab-wrapper [data-pro-text]{position:relative}#woo-variation-swatches-settings-wrap .nav-tab-wrapper [data-new-text]:after,#woo-variation-swatches-settings-wrap .nav-tab-wrapper [data-new-text]:before,#woo-variation-swatches-settings-wrap .nav-tab-wrapper [data-pro-text]:after,#woo-variation-swatches-settings-wrap .nav-tab-wrapper [data-pro-text]:before{-webkit-transform:translateY(-50%);transform:translateY(-50%);position:absolute;right:5px;top:0;color:#fff;font-size:8px;font-weight:400;text-transform:uppercase;padding:3px 5px;line-height:1;border-radius:10px}#woo-variation-swatches-settings-wrap .nav-tab-wrapper [data-pro-text]:before{content:attr(data-pro-text);background:#f44336}#woo-variation-swatches-settings-wrap .nav-tab-wrapper [data-new-text]:after{content:attr(data-new-text);background:#2196f3}#woo-variation-swatches-settings-wrap .wvs-setting-tab .wvs-new-feature-tick{position:relative;right:-5px;top:-2px;color:#fff;background:#ff5722;font-size:8px;font-weight:400;text-transform:uppercase;padding:3px 5px;line-height:1;border-radius:10px}#woo-variation-swatches-settings-wrap .wvs-setting-tab .description{font-size:small;font-style:italic}.woo-variation-swatches-pro_tab.pro-inactive a{background-color:var(--wc-primary);color:var(--wc-content-bg)}.wvs-settings-field-content{position:relative}.wvs-show-pro-label{display:block}.wvs-show-pro-label span{padding:2px 4px;background:#fa0000;color:#fff;text-transform:uppercase;font-size:9px;border-radius:2px}.wvs-show-pro-contents{display:inline-block;color:#fa0000;font-size:11px;text-transform:uppercase;font-style:italic;text-decoration:underline;padding:0 5px}.wvs-button-wrapper .reset{color:#a00}
|
1 |
+
.button.button-danger{color:#fff;background-color:#af2d2b;border-color:#a62d2b;-webkit-box-shadow:0 1px 0 #a72d2b;box-shadow:0 1px 0 #a72d2b;vertical-align:top}.button.button-danger.active,.button.button-danger:active,.button.button-danger:focus,.button.button-danger:hover{color:#fff;background:#c9302c}[data-dependency]:not(.dependency-show){display:none!important}.meta-image-field-wrapper{display:table}.meta-image-field-wrapper .button{margin:5px 0;display:block}.meta-image-field-wrapper .image-preview{display:table-cell;width:60px;padding-right:10px}.meta-image-field-wrapper .button-wrapper{display:table-cell;vertical-align:top}.wvs-go-pro-action-link>a{font-weight:700;text-transform:capitalize;color:#9c27b0;text-shadow:1px 1px 1px #eee}#wvs-meta-preview{width:30px}.wvs-preview{width:30px;height:30px;border:1px solid #000}.woo-variation-swatches-pro_tab.pro-inactive a{background-color:var(--wc-primary);color:var(--wc-content-bg)}#woo-variation-swatches-tutorials-wrapper{background:#fff;border-radius:2px;border:1px solid #ddd}#woo-variation-swatches-tutorials-wrapper img{width:100%}#woo-variation-swatches-tutorials-wrapper ul{margin:0}#woo-variation-swatches-tutorials-wrapper li{overflow:hidden;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:50px 30px;margin:0;border-bottom:1px solid #ddd;position:relative}#woo-variation-swatches-tutorials-wrapper li:last-child{border:0}#woo-variation-swatches-tutorials-wrapper .tutorial-description-wrapper,#woo-variation-swatches-tutorials-wrapper .tutorial-image-wrapper{float:left;padding:0 20px;-webkit-box-sizing:border-box;box-sizing:border-box}#woo-variation-swatches-tutorials-wrapper .tutorial-image-wrapper{position:relative;width:60%}#woo-variation-swatches-tutorials-wrapper .tutorial-image-wrapper .ribbon{position:absolute;left:-5px;top:-5px;z-index:1;overflow:hidden;width:75px;height:75px;text-align:right;margin:1px 22px}#woo-variation-swatches-tutorials-wrapper .tutorial-image-wrapper .ribbon span{font-size:10px;font-weight:700;color:#fff;text-transform:uppercase;text-align:center;line-height:20px;-webkit-transform:rotate(-45deg);-ms-transform:rotate(-45deg);transform:rotate(-45deg);width:100px;display:block;background:#bc0808;-webkit-box-shadow:0 3px 10px -5px #000;box-shadow:0 3px 10px -5px #000;position:absolute;top:19px;left:-21px}#woo-variation-swatches-tutorials-wrapper .tutorial-image-wrapper .ribbon span:after{content:"";position:absolute;right:0;top:100%;z-index:-1;border-color:#8f0808 #8f0808 transparent transparent;border-style:solid;border-width:3px}#woo-variation-swatches-tutorials-wrapper .tutorial-description-wrapper{width:40%}#woo-variation-swatches-tutorials-wrapper .tutorial-description-wrapper h3{margin:0 0 20px;font-size:1.5em}#woo-variation-swatches-tutorials-wrapper .tutorial-description-wrapper .tutorial-contents{font-size:15px;line-height:1.5em;margin-bottom:20px}#woo-variation-swatches-tutorials-wrapper .tutorial-description-wrapper .tutorial-buttons .button{border-radius:3px;line-height:1;padding:13px 20px;font-size:13px;height:40px;-webkit-box-shadow:none;box-shadow:none;text-shadow:none}#woo-variation-swatches-tutorials-wrapper .tutorial-description-wrapper .tutorial-buttons .button:active{-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}#woo-variation-swatches-tutorials-wrapper .tutorial-description-wrapper .tutorial-buttons .button.button-live-demo{background-color:#f44336;color:#fff;border:0}#woo-variation-swatches-tutorials-wrapper .tutorial-description-wrapper .tutorial-buttons .button.button-live-demo:hover{background:#c71609}#woo-variation-swatches-tutorials-wrapper .tutorial-description-wrapper .tutorial-buttons .button.button-docs{background-color:#36373a;color:#fff;border:0}#woo-variation-swatches-tutorials-wrapper .tutorial-description-wrapper .tutorial-buttons .button.button-docs:hover{background:#5d5e61;border-color:#5d5e61}#woo-variation-swatches-tutorials-wrapper .tutorial-description-wrapper .tutorial-buttons .button.button-pro{background-color:#39b54a;color:#fff;border:1px solid #39b54a}#woo-variation-swatches-tutorials-wrapper .tutorial-description-wrapper .tutorial-buttons .button.button-pro:hover{background:#3fc851;border-color:#3fc851}.woo-variation-swatches-group-table-list tbody>:nth-child(odd){background-color:#f6f7f7}.woo-variation-swatches-group-section-wrapper .woocommerce-BlankState-message:before{font-family:Dashicons;content:"\F307"}.woo-variation-swatches-variation-product-options-wrapper .woocommerce-message{margin:10px}.woo-variation-swatches-variation-product-options-wrapper #saved-message{display:none}.woo-variation-swatches-variation-product-options-wrapper h4{margin:0!important;padding:10px 18px;font-size:1em!important;overflow:hidden;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.woo-variation-swatches-variation-product-options-wrapper .woocommerce-help-tip{margin:0 5px!important}.woo-variation-swatches-variation-product-options-wrapper [data-gwpdepends].has-dependent-data.show{display:-webkit-box;display:-ms-flexbox;display:flex}.woo-variation-swatches-variation-product-options-wrapper .product-label-settings{background-color:#fff}.woo-variation-swatches-variation-product-options-wrapper .form-settings-group{padding:5px;border-bottom:1px solid #eee;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row}.woo-variation-swatches-variation-product-options-wrapper .form-settings-group .form-label{vertical-align:middle;line-height:2;width:280px;margin:5px 10px;font-weight:700}.woo-variation-swatches-variation-product-options-wrapper .form-settings-group .form-field{vertical-align:middle;line-height:2;margin:5px 10px}.woo-variation-swatches-variation-product-options-wrapper .form-settings-group .form-field .description{display:inline-block;vertical-align:middle;padding:0 10px}.woo-variation-swatches-variation-product-options-wrapper .form-settings-group-inline{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.woo-variation-swatches-variation-product-options-wrapper .wc-metabox{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;border-bottom:none!important;border-radius:0!important}.woo-variation-swatches-variation-product-options-wrapper .wc-metabox>h4{cursor:pointer;background-color:#fafafa;display:-webkit-box;display:-ms-flexbox;display:flex;border-bottom:1px solid #eee}.woo-variation-swatches-variation-product-options-wrapper .wc-metabox>h4 .attribute-label{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1}.woo-variation-swatches-variation-product-options-wrapper .wc-metabox.open>h4{background-color:#eee}.woo-variation-swatches-variation-product-options-wrapper .wc-metabox .wc-metabox{border:1px solid #eee}.woo-variation-swatches-variation-product-options-wrapper .woo-variation-swatches-attribute-data{background-color:#fff}.woo-variation-swatches-variation-product-options-wrapper .woo-variation-swatches-attribute-data-inner{margin:5px 0;padding:0 5px}.woo-variation-swatches-variation-product-options-wrapper .product-term-label-settings{margin:15px}.woo-variation-swatches-variation-product-options-wrapper .product-term-label-settings-pagination{margin:10px 0}.woo-variation-swatches-variation-product-options-wrapper .product-term-label-settings-pagination .tablenav-pages{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end;line-height:2;vertical-align:center}.woo-variation-swatches-variation-product-options-wrapper .product-term-label-settings-pagination .tablenav-pages .displaying-num{padding:0 2px}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/css/frontend-tooltip.css
DELETED
@@ -1,130 +0,0 @@
|
|
1 |
-
/*!
|
2 |
-
* Variation Swatches for WooCommerce v1.1.19
|
3 |
-
*
|
4 |
-
* Author: Emran Ahmed ( emran.bd.08@gmail.com )
|
5 |
-
* Date: 07/09/2021
|
6 |
-
* Released under the GPLv3 license.
|
7 |
-
*/
|
8 |
-
.woo-variation-swatches .radio-variable-item[data-wvstooltip] {
|
9 |
-
position: relative;
|
10 |
-
}
|
11 |
-
|
12 |
-
.woo-variation-swatches .radio-variable-item[data-wvstooltip]::before,
|
13 |
-
.woo-variation-swatches .radio-variable-item[data-wvstooltip]::after {
|
14 |
-
left: 8px;
|
15 |
-
bottom: 100%;
|
16 |
-
}
|
17 |
-
|
18 |
-
.woo-variation-swatches .radio-variable-item .image-tooltip-wrapper {
|
19 |
-
-webkit-transform: translateX(-50%);
|
20 |
-
transform: translateX(-50%);
|
21 |
-
left: 8px;
|
22 |
-
}
|
23 |
-
|
24 |
-
.woo-variation-swatches.wvs-archive-align-center .wvs-archive-variation-wrapper .radio-variable-item[data-wvstooltip]::before,
|
25 |
-
.woo-variation-swatches.wvs-archive-align-center .wvs-archive-variation-wrapper .radio-variable-item[data-wvstooltip]::after {
|
26 |
-
left: 50%;
|
27 |
-
}
|
28 |
-
|
29 |
-
.woo-variation-swatches.wvs-archive-align-center .wvs-archive-variation-wrapper .radio-variable-item .image-tooltip-wrapper {
|
30 |
-
-webkit-transform: translateX(-50%);
|
31 |
-
transform: translateX(-50%);
|
32 |
-
left: 50%;
|
33 |
-
}
|
34 |
-
|
35 |
-
.woo-variation-swatches.wvs-archive-align-right .wvs-archive-variation-wrapper .radio-variable-item[data-wvstooltip]::before,
|
36 |
-
.woo-variation-swatches.wvs-archive-align-right .wvs-archive-variation-wrapper .radio-variable-item[data-wvstooltip]::after {
|
37 |
-
left: 100%;
|
38 |
-
}
|
39 |
-
|
40 |
-
.woo-variation-swatches.wvs-archive-align-right .wvs-archive-variation-wrapper .radio-variable-item .image-tooltip-wrapper {
|
41 |
-
-webkit-transform: translateX(-50%);
|
42 |
-
transform: translateX(-50%);
|
43 |
-
left: 100%;
|
44 |
-
}
|
45 |
-
|
46 |
-
[data-wvstooltip],
|
47 |
-
.wvs-has-image-tooltip {
|
48 |
-
position: relative;
|
49 |
-
cursor: pointer;
|
50 |
-
outline: none;
|
51 |
-
}
|
52 |
-
|
53 |
-
[data-wvstooltip]:before,
|
54 |
-
[data-wvstooltip]:after,
|
55 |
-
.wvs-has-image-tooltip:before,
|
56 |
-
.wvs-has-image-tooltip:after {
|
57 |
-
visibility: hidden;
|
58 |
-
opacity: 0;
|
59 |
-
pointer-events: none;
|
60 |
-
box-sizing: inherit;
|
61 |
-
position: absolute;
|
62 |
-
bottom: 130%;
|
63 |
-
left: 50%;
|
64 |
-
z-index: 999;
|
65 |
-
-webkit-transform: translateZ(0);
|
66 |
-
transform: translateZ(0);
|
67 |
-
box-shadow: 0 7px 15px rgba(0, 0, 0, 0.3);
|
68 |
-
transition: opacity 300ms linear, bottom 300ms linear;
|
69 |
-
}
|
70 |
-
|
71 |
-
[data-wvstooltip]:before,
|
72 |
-
.wvs-has-image-tooltip:before {
|
73 |
-
margin-bottom: 5px;
|
74 |
-
-webkit-transform: translateX(-50%);
|
75 |
-
transform: translateX(-50%);
|
76 |
-
padding: 7px;
|
77 |
-
border-radius: 3px;
|
78 |
-
background-color: #000;
|
79 |
-
background-color: rgba(51, 51, 51, 0.9);
|
80 |
-
color: #fff;
|
81 |
-
text-align: center;
|
82 |
-
font-size: 14px;
|
83 |
-
line-height: 1.2;
|
84 |
-
}
|
85 |
-
|
86 |
-
[data-wvstooltip]:before {
|
87 |
-
min-width: 100px;
|
88 |
-
content: attr(data-wvstooltip);
|
89 |
-
}
|
90 |
-
|
91 |
-
.wvs-has-image-tooltip:before {
|
92 |
-
content: attr(data-title);
|
93 |
-
background-image: var(--tooltip-background);
|
94 |
-
background-repeat: no-repeat;
|
95 |
-
width: var(--tooltip-width);
|
96 |
-
height: calc( var(--tooltip-height) + 20px);
|
97 |
-
background-size: contain;
|
98 |
-
border: 2px solid;
|
99 |
-
background-position: center top;
|
100 |
-
padding: 0;
|
101 |
-
line-height: 20px;
|
102 |
-
display: flex;
|
103 |
-
align-items: flex-end;
|
104 |
-
justify-content: center;
|
105 |
-
font-size: 12px;
|
106 |
-
-webkit-backface-visibility: hidden;
|
107 |
-
backface-visibility: hidden;
|
108 |
-
}
|
109 |
-
|
110 |
-
[data-wvstooltip]:after,
|
111 |
-
.wvs-has-image-tooltip:after {
|
112 |
-
margin-left: -5px;
|
113 |
-
width: 0;
|
114 |
-
border-top: 5px solid #000000;
|
115 |
-
border-top: 5px solid rgba(51, 51, 51, 0.9);
|
116 |
-
border-right: 5px solid transparent;
|
117 |
-
border-left: 5px solid transparent;
|
118 |
-
content: " ";
|
119 |
-
font-size: 0;
|
120 |
-
line-height: 0;
|
121 |
-
}
|
122 |
-
|
123 |
-
[data-wvstooltip]:hover:before,
|
124 |
-
[data-wvstooltip]:hover:after,
|
125 |
-
.wvs-has-image-tooltip:hover:before,
|
126 |
-
.wvs-has-image-tooltip:hover:after {
|
127 |
-
bottom: 120%;
|
128 |
-
visibility: visible;
|
129 |
-
opacity: 1;
|
130 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/css/frontend-tooltip.min.css
DELETED
@@ -1,8 +0,0 @@
|
|
1 |
-
/*!
|
2 |
-
* Variation Swatches for WooCommerce v1.1.19
|
3 |
-
*
|
4 |
-
* Author: Emran Ahmed ( emran.bd.08@gmail.com )
|
5 |
-
* Date: 07/09/2021
|
6 |
-
* Released under the GPLv3 license.
|
7 |
-
*/
|
8 |
-
.woo-variation-swatches .radio-variable-item[data-wvstooltip]{position:relative}.woo-variation-swatches .radio-variable-item[data-wvstooltip]:after,.woo-variation-swatches .radio-variable-item[data-wvstooltip]:before{left:8px;bottom:100%}.woo-variation-swatches .radio-variable-item .image-tooltip-wrapper{-webkit-transform:translateX(-50%);transform:translateX(-50%);left:8px}.woo-variation-swatches.wvs-archive-align-center .wvs-archive-variation-wrapper .radio-variable-item[data-wvstooltip]:after,.woo-variation-swatches.wvs-archive-align-center .wvs-archive-variation-wrapper .radio-variable-item[data-wvstooltip]:before{left:50%}.woo-variation-swatches.wvs-archive-align-center .wvs-archive-variation-wrapper .radio-variable-item .image-tooltip-wrapper{-webkit-transform:translateX(-50%);transform:translateX(-50%);left:50%}.woo-variation-swatches.wvs-archive-align-right .wvs-archive-variation-wrapper .radio-variable-item[data-wvstooltip]:after,.woo-variation-swatches.wvs-archive-align-right .wvs-archive-variation-wrapper .radio-variable-item[data-wvstooltip]:before{left:100%}.woo-variation-swatches.wvs-archive-align-right .wvs-archive-variation-wrapper .radio-variable-item .image-tooltip-wrapper{-webkit-transform:translateX(-50%);transform:translateX(-50%);left:100%}.wvs-has-image-tooltip,[data-wvstooltip]{position:relative;cursor:pointer;outline:none}.wvs-has-image-tooltip:after,.wvs-has-image-tooltip:before,[data-wvstooltip]:after,[data-wvstooltip]:before{visibility:hidden;opacity:0;pointer-events:none;box-sizing:inherit;position:absolute;bottom:130%;left:50%;z-index:999;-webkit-transform:translateZ(0);transform:translateZ(0);box-shadow:0 7px 15px rgba(0,0,0,.3);transition:opacity .3s linear,bottom .3s linear}.wvs-has-image-tooltip:before,[data-wvstooltip]:before{margin-bottom:5px;-webkit-transform:translateX(-50%);transform:translateX(-50%);padding:7px;border-radius:3px;background-color:#000;background-color:rgba(51,51,51,.9);color:#fff;text-align:center;font-size:14px;line-height:1.2}[data-wvstooltip]:before{min-width:100px;content:attr(data-wvstooltip)}.wvs-has-image-tooltip:before{content:attr(data-title);background-image:var(--tooltip-background);background-repeat:no-repeat;width:var(--tooltip-width);height:calc(var(--tooltip-height) + 20px);background-size:contain;border:2px solid;background-position:top;padding:0;line-height:20px;display:flex;align-items:flex-end;justify-content:center;font-size:12px;-webkit-backface-visibility:hidden;backface-visibility:hidden}.wvs-has-image-tooltip:after,[data-wvstooltip]:after{margin-left:-5px;width:0;border-top:5px solid #000;border-top:5px solid rgba(51,51,51,.9);border-right:5px solid transparent;border-left:5px solid transparent;content:" ";font-size:0;line-height:0}.wvs-has-image-tooltip:hover:after,.wvs-has-image-tooltip:hover:before,[data-wvstooltip]:hover:after,[data-wvstooltip]:hover:before{bottom:120%;visibility:visible;opacity:1}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/css/frontend.css
CHANGED
@@ -1,60 +1,597 @@
|
|
1 |
/*!
|
2 |
-
* Variation Swatches for WooCommerce
|
3 |
*
|
4 |
* Author: Emran Ahmed ( emran.bd.08@gmail.com )
|
5 |
-
* Date:
|
6 |
* Released under the GPLv3 license.
|
7 |
*/
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
display: none !important;
|
11 |
}
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
.woo-variation-swatches .wvs-widget-layered-nav-list__item-color > a {
|
14 |
display: inline-block;
|
15 |
position: relative;
|
16 |
}
|
17 |
-
|
18 |
.woo-variation-swatches .wvs-widget-layered-nav-list__item-color > a .wvs-widget-item-wrapper {
|
19 |
display: inline-block;
|
20 |
}
|
21 |
-
|
22 |
.woo-variation-swatches .wvs-widget-layered-nav-list__item-color .item {
|
23 |
display: inline-block;
|
24 |
float: left;
|
25 |
padding: 9px;
|
26 |
margin: 0 4px;
|
27 |
-
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
|
|
|
28 |
height: 20px;
|
29 |
width: 20px;
|
30 |
}
|
31 |
-
|
32 |
.woo-variation-swatches .wvs-widget-layered-nav-list__item-color .text {
|
33 |
display: inline-block;
|
34 |
}
|
35 |
-
|
36 |
.woo-variation-swatches .wvs-widget-layered-nav-list__item-color .text :after {
|
37 |
-
content:
|
38 |
display: inline;
|
39 |
clear: both;
|
40 |
}
|
41 |
-
|
42 |
.woo-variation-swatches .wvs-widget-layered-nav-list__item-color.woocommerce-widget-layered-nav-list__item--chosen .item {
|
43 |
-
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.9);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
}
|
45 |
-
|
46 |
.woo-variation-swatches .variable-items-wrapper {
|
|
|
|
|
47 |
display: flex;
|
48 |
-
flex-wrap: wrap;
|
49 |
-
|
|
|
|
|
|
|
|
|
50 |
padding: 0;
|
51 |
list-style: none;
|
52 |
}
|
53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
.woo-variation-swatches .variable-items-wrapper .variable-item {
|
55 |
margin: 0;
|
56 |
padding: 0;
|
57 |
list-style: none;
|
|
|
|
|
58 |
transition: all 200ms ease;
|
59 |
-webkit-user-select: none;
|
60 |
-moz-user-select: none;
|
@@ -62,23 +599,29 @@
|
|
62 |
user-select: none;
|
63 |
outline: none;
|
64 |
}
|
65 |
-
|
66 |
.woo-variation-swatches .variable-items-wrapper .variable-item .variable-item-contents {
|
|
|
|
|
67 |
display: flex;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
width: 100%;
|
69 |
height: 100%;
|
70 |
}
|
71 |
-
|
72 |
@supports (display: contents) {
|
73 |
.woo-variation-swatches .variable-items-wrapper .variable-item .variable-item-contents {
|
74 |
-
display: contents
|
75 |
}
|
76 |
}
|
77 |
-
|
78 |
.woo-variation-swatches .variable-items-wrapper .variable-item.variation-disabled {
|
79 |
display: none !important;
|
80 |
}
|
81 |
-
|
82 |
.woo-variation-swatches .variable-items-wrapper .variable-item img {
|
83 |
margin: 0;
|
84 |
/** Storefront FIX */
|
@@ -89,279 +632,213 @@
|
|
89 |
height: 100%;
|
90 |
pointer-events: none;
|
91 |
}
|
92 |
-
|
93 |
-
.woo-variation-swatches .variable-items-wrapper .variable-item span {
|
94 |
pointer-events: none;
|
95 |
}
|
96 |
-
|
97 |
-
.woo-variation-swatches .variable-items-wrapper.radio-variable-wrapper {
|
98 |
-
display: block;
|
99 |
-
}
|
100 |
-
|
101 |
-
.woo-variation-swatches .variable-items-wrapper.radio-variable-wrapper .radio-variable-item {
|
102 |
-
box-sizing: border-box;
|
103 |
-
display: block;
|
104 |
-
list-style: none;
|
105 |
-
cursor: pointer;
|
106 |
-
margin: 0;
|
107 |
-
}
|
108 |
-
|
109 |
-
.woo-variation-swatches .variable-items-wrapper.radio-variable-wrapper .radio-variable-item label,
|
110 |
-
.woo-variation-swatches .variable-items-wrapper.radio-variable-wrapper .radio-variable-item input {
|
111 |
-
cursor: pointer;
|
112 |
-
}
|
113 |
-
|
114 |
-
.woo-variation-swatches .variable-items-wrapper.radio-variable-wrapper .radio-variable-item input {
|
115 |
-
/*width: auto;*/
|
116 |
-
margin-right: 5px;
|
117 |
-
}
|
118 |
-
|
119 |
-
.woo-variation-swatches .variable-items-wrapper.radio-variable-wrapper .radio-variable-item label {
|
120 |
-
font-weight: normal;
|
121 |
-
font-size: 14px;
|
122 |
-
display: inline-block;
|
123 |
-
}
|
124 |
-
|
125 |
.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item) {
|
126 |
-
box-sizing: border-box;
|
|
|
127 |
cursor: pointer;
|
|
|
|
|
128 |
display: flex;
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
padding: 2px;
|
134 |
-
margin: 4px
|
|
|
|
|
135 |
}
|
136 |
-
|
137 |
-
|
|
|
|
|
138 |
margin-right: 0;
|
139 |
}
|
140 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item):hover {
|
142 |
-
box-shadow: 0 0 0 3px
|
|
|
|
|
|
|
143 |
}
|
144 |
-
|
145 |
.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item):focus {
|
146 |
-
box-shadow: 0 0 0 3px
|
|
|
147 |
}
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
}
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
height: 100%;
|
157 |
position: relative;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
display: block;
|
|
|
|
|
|
|
|
|
|
|
159 |
}
|
160 |
-
|
161 |
-
.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).color-variable-item .variable-item-span-color::after {
|
162 |
position: absolute;
|
163 |
-
content: "";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
width: 100%;
|
165 |
height: 100%;
|
166 |
-
|
167 |
-
|
168 |
-
box-shadow: inset 0 0 1px 0 rgba(0, 0, 0, 0.5);
|
169 |
}
|
170 |
-
|
171 |
.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).button-variable-item {
|
172 |
text-align: center;
|
|
|
173 |
}
|
174 |
-
|
175 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
border-radius: 100%;
|
177 |
}
|
178 |
-
|
179 |
-
.woo-variation-swatches.wvs-style-rounded .variable-items-wrapper .variable-item .variable-item-span,
|
180 |
-
.woo-variation-swatches.wvs-style-rounded .variable-items-wrapper .variable-item img,
|
181 |
-
.woo-variation-swatches.wvs-style-rounded .variable-items-wrapper .variable-item .variable-item-span::after {
|
182 |
border-radius: 100%;
|
|
|
|
|
|
|
183 |
}
|
184 |
-
|
185 |
-
.woo-variation-swatches.wvs-style-squared .variable-items-wrapper .variable-item {
|
186 |
border-radius: 2px;
|
187 |
}
|
188 |
-
|
189 |
-
|
|
|
|
|
|
|
|
|
|
|
190 |
width: auto;
|
|
|
191 |
}
|
192 |
-
|
193 |
-
.woo-variation-swatches.wvs-style-squared .variable-items-wrapper .variable-item.button-variable-item .variable-item-span {
|
194 |
padding: 0 5px;
|
195 |
}
|
196 |
-
|
197 |
-
.woo-variation-swatches.wvs-style-squared .variable-items-wrapper .variable-item.color-variable-item span::after {
|
198 |
border-radius: 0;
|
199 |
}
|
200 |
-
|
201 |
-
|
202 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).disabled:hover,
|
203 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock,
|
204 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock:hover {
|
205 |
-
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05);
|
206 |
-
pointer-events: none;
|
207 |
-
cursor: not-allowed;
|
208 |
-
position: relative;
|
209 |
-
overflow: hidden;
|
210 |
-
}
|
211 |
-
|
212 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).disabled img,
|
213 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).disabled span,
|
214 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).disabled .variable-item-contents,
|
215 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).disabled:hover img,
|
216 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).disabled:hover span,
|
217 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).disabled:hover .variable-item-contents,
|
218 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock img,
|
219 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock span,
|
220 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock .variable-item-contents,
|
221 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock:hover img,
|
222 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock:hover span,
|
223 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock:hover .variable-item-contents {
|
224 |
-
opacity: .3;
|
225 |
-
}
|
226 |
-
|
227 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).disabled .variable-item-contents::before,
|
228 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).disabled .variable-item-contents::after,
|
229 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).disabled:hover .variable-item-contents::before,
|
230 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).disabled:hover .variable-item-contents::after,
|
231 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock .variable-item-contents::before,
|
232 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock .variable-item-contents::after,
|
233 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock:hover .variable-item-contents::before,
|
234 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock:hover .variable-item-contents::after {
|
235 |
-
position: absolute;
|
236 |
-
content: " " !important;
|
237 |
-
width: 100%;
|
238 |
-
height: 1px;
|
239 |
-
background: #FF0000 !important;
|
240 |
-
left: 0;
|
241 |
-
right: 0;
|
242 |
-
bottom: 0;
|
243 |
-
top: 50%;
|
244 |
-
visibility: visible;
|
245 |
-
opacity: 1;
|
246 |
-
border: 0;
|
247 |
-
margin: 0 !important;
|
248 |
-
padding: 0 !important;
|
249 |
-
min-width: auto;
|
250 |
-
-webkit-transform-origin: center;
|
251 |
-
transform-origin: center;
|
252 |
-
z-index: 0;
|
253 |
}
|
254 |
-
|
255 |
-
|
256 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).disabled:hover .variable-item-contents::before,
|
257 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock .variable-item-contents::before,
|
258 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock:hover .variable-item-contents::before {
|
259 |
-
-webkit-transform: rotate(45deg);
|
260 |
-
transform: rotate(45deg);
|
261 |
}
|
262 |
-
|
263 |
-
|
264 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).disabled:hover .variable-item-contents::after,
|
265 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock .variable-item-contents::after,
|
266 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock:hover .variable-item-contents::after {
|
267 |
-
-webkit-transform: rotate(-45deg);
|
268 |
-
transform: rotate(-45deg);
|
269 |
}
|
270 |
-
|
271 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock,
|
272 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock:hover {
|
273 |
-
overflow: visible;
|
274 |
-
pointer-events: auto;
|
275 |
-
cursor: pointer;
|
276 |
-
}
|
277 |
-
|
278 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock img,
|
279 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock span,
|
280 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock .variable-item-contents,
|
281 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock:hover img,
|
282 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock:hover span,
|
283 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock:hover .variable-item-contents {
|
284 |
-
opacity: .6;
|
285 |
-
}
|
286 |
-
|
287 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .radio-variable-item.disabled label,
|
288 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .radio-variable-item.disabled input,
|
289 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .radio-variable-item.disabled:hover label,
|
290 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .radio-variable-item.disabled:hover input {
|
291 |
cursor: not-allowed;
|
292 |
text-decoration: line-through;
|
293 |
-
opacity: .5;
|
294 |
}
|
295 |
-
|
296 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .radio-variable-item.disabled::before,
|
297 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .radio-variable-item.disabled::after,
|
298 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .radio-variable-item.disabled:hover::before,
|
299 |
-
.woo-variation-swatches.wvs-attr-behavior-blur .radio-variable-item.disabled:hover::after {
|
300 |
display: none;
|
301 |
}
|
302 |
-
|
303 |
-
|
304 |
-
.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).disabled:hover,
|
305 |
-
.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).out-of-stock,
|
306 |
-
.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).out-of-stock:hover {
|
307 |
-
pointer-events: none;
|
308 |
-
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05);
|
309 |
-
position: relative;
|
310 |
-
overflow: hidden;
|
311 |
-
cursor: not-allowed;
|
312 |
-
}
|
313 |
-
|
314 |
-
.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).disabled img,
|
315 |
-
.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).disabled span,
|
316 |
-
.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).disabled .variable-item-contents,
|
317 |
-
.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).disabled:hover img,
|
318 |
-
.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).disabled:hover span,
|
319 |
-
.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).disabled:hover .variable-item-contents,
|
320 |
-
.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).out-of-stock img,
|
321 |
-
.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).out-of-stock span,
|
322 |
-
.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).out-of-stock .variable-item-contents,
|
323 |
-
.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).out-of-stock:hover img,
|
324 |
-
.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).out-of-stock:hover span,
|
325 |
-
.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).out-of-stock:hover .variable-item-contents {
|
326 |
-
opacity: .3;
|
327 |
-
}
|
328 |
-
|
329 |
-
.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).out-of-stock,
|
330 |
-
.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).out-of-stock:hover {
|
331 |
-
overflow: visible;
|
332 |
-
pointer-events: auto;
|
333 |
-
cursor: pointer;
|
334 |
-
}
|
335 |
-
|
336 |
-
.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).out-of-stock img,
|
337 |
-
.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).out-of-stock span,
|
338 |
-
.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).out-of-stock .variable-item-contents,
|
339 |
-
.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).out-of-stock:hover img,
|
340 |
-
.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).out-of-stock:hover span,
|
341 |
-
.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).out-of-stock:hover .variable-item-contents {
|
342 |
-
opacity: .6;
|
343 |
}
|
344 |
-
|
345 |
-
.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .radio-variable-item.disabled,
|
346 |
-
.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .radio-variable-item.disabled:hover {
|
347 |
overflow: hidden;
|
348 |
}
|
349 |
-
|
350 |
-
.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .radio-variable-item.disabled label,
|
351 |
-
.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .radio-variable-item.disabled input,
|
352 |
-
.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .radio-variable-item.disabled:hover label,
|
353 |
-
.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .radio-variable-item.disabled:hover input {
|
354 |
pointer-events: none;
|
355 |
-
opacity: .3;
|
356 |
}
|
357 |
-
|
358 |
-
.woo-variation-swatches.wvs-attr-behavior-hide .variable-item.disabled {
|
359 |
opacity: 0;
|
360 |
visibility: hidden;
|
361 |
-webkit-transform: scale(0);
|
|
|
362 |
transform: scale(0);
|
363 |
-webkit-transform-origin: center;
|
|
|
364 |
transform-origin: center;
|
|
|
365 |
width: 0 !important;
|
366 |
height: 0 !important;
|
367 |
padding: 0 !important;
|
@@ -369,49 +846,87 @@
|
|
369 |
min-width: 0 !important;
|
370 |
min-height: 0 !important;
|
371 |
}
|
372 |
-
|
373 |
-
.woo-variation-swatches.wvs-attr-behavior-hide .variable-item.disabled.radio-variable-item {
|
374 |
width: auto !important;
|
375 |
}
|
376 |
-
|
|
|
|
|
377 |
.woo-variation-swatches.rtl table.variations td.label {
|
378 |
/*padding-left: 15px;
|
379 |
-
|
380 |
-
|
381 |
}
|
382 |
-
|
383 |
.woo-variation-swatches.rtl .variable-items-wrapper .variable-item {
|
384 |
text-align: right;
|
385 |
}
|
386 |
-
|
387 |
.woo-variation-swatches.rtl .variable-items-wrapper .variable-item:not(.radio-variable-item) {
|
388 |
margin: 4px 0 4px 8px;
|
389 |
}
|
390 |
-
|
391 |
.woo-variation-swatches.rtl .variable-items-wrapper.radio-variable-wrapper .radio-variable-item input {
|
392 |
margin-right: 0;
|
393 |
margin-left: 5px;
|
394 |
}
|
395 |
-
|
396 |
.woo-variation-swatches.woocommerce .product.elementor table.variations td.value:before {
|
397 |
display: none !important;
|
398 |
}
|
399 |
-
|
400 |
.woo-variation-swatches.woo-variation-swatches-ie11 .variable-items-wrapper {
|
401 |
display: block !important;
|
402 |
}
|
403 |
-
|
404 |
.woo-variation-swatches.woo-variation-swatches-ie11 .variable-items-wrapper .variable-item:not(.radio-variable-item) {
|
405 |
float: left;
|
406 |
}
|
407 |
-
|
408 |
-
.woo-variation-swatches.wvs-show-label .variations td {
|
409 |
display: block;
|
410 |
width: auto !important;
|
411 |
}
|
412 |
-
|
413 |
-
.woo-variation-swatches.wvs-show-label .variations td label,
|
414 |
-
.woo-variation-swatches.wvs-show-label .variations td .woo-selected-variation-item-name {
|
415 |
display: inline-block;
|
416 |
margin: 0 2px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
417 |
}
|
1 |
/*!
|
2 |
+
* Variation Swatches for WooCommerce
|
3 |
*
|
4 |
* Author: Emran Ahmed ( emran.bd.08@gmail.com )
|
5 |
+
* Date: 6/13/2022, 4:04:45 PM
|
6 |
* Released under the GPLv3 license.
|
7 |
*/
|
8 |
+
:root {
|
9 |
+
--wvs-cross: url('data:image/svg+xml;utf8,%3Csvg filter="drop-shadow(0px 0px 5px rgb(255 255 255 / .6))" xmlns="http://www.w3.org/2000/svg" width="72px" height="72px" viewBox="0 0 24 24"%3E%3Cpath fill="none" stroke="%23ff0000" stroke-linecap="round" stroke-width="0.6" d="M5 5L19 19M19 5L5 19"/%3E%3C/svg%3E');
|
10 |
+
--wvs-tick: url('data:image/svg+xml;utf8,%3Csvg filter="drop-shadow(0px 0px 2px rgb(0 0 0 / .8))" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30"%3E%3Cpath fill="none" stroke="%23ffffff" stroke-linecap="round" stroke-linejoin="round" stroke-width="4" d="M4 16L11 23 27 7"/%3E%3C/svg%3E');
|
11 |
+
}
|
12 |
+
|
13 |
+
.woo-variation-swatches.wvs-tooltip .radio-variable-item[data-wvstooltip] {
|
14 |
+
position: relative;
|
15 |
+
}
|
16 |
+
.woo-variation-swatches.wvs-tooltip .radio-variable-item[data-wvstooltip]::before, .woo-variation-swatches.wvs-tooltip .radio-variable-item[data-wvstooltip]::after {
|
17 |
+
left: 8px;
|
18 |
+
bottom: 100%;
|
19 |
+
}
|
20 |
+
.woo-variation-swatches.wvs-tooltip .radio-variable-item .image-tooltip-wrapper {
|
21 |
+
-webkit-transform: translateX(-50%);
|
22 |
+
-ms-transform: translateX(-50%);
|
23 |
+
transform: translateX(-50%);
|
24 |
+
left: 8px;
|
25 |
+
}
|
26 |
+
.woo-variation-swatches.wvs-tooltip.wvs-archive-align-center .wvs-archive-variation-wrapper .radio-variable-item[data-wvstooltip]::before, .woo-variation-swatches.wvs-tooltip.wvs-archive-align-center .wvs-archive-variation-wrapper .radio-variable-item[data-wvstooltip]::after {
|
27 |
+
left: 50%;
|
28 |
+
}
|
29 |
+
.woo-variation-swatches.wvs-tooltip.wvs-archive-align-center .wvs-archive-variation-wrapper .radio-variable-item .image-tooltip-wrapper {
|
30 |
+
-webkit-transform: translateX(-50%);
|
31 |
+
-ms-transform: translateX(-50%);
|
32 |
+
transform: translateX(-50%);
|
33 |
+
left: 50%;
|
34 |
+
}
|
35 |
+
.woo-variation-swatches.wvs-tooltip.wvs-archive-align-right .wvs-archive-variation-wrapper .radio-variable-item[data-wvstooltip]::before, .woo-variation-swatches.wvs-tooltip.wvs-archive-align-right .wvs-archive-variation-wrapper .radio-variable-item[data-wvstooltip]::after {
|
36 |
+
left: 100%;
|
37 |
+
}
|
38 |
+
.woo-variation-swatches.wvs-tooltip.wvs-archive-align-right .wvs-archive-variation-wrapper .radio-variable-item .image-tooltip-wrapper {
|
39 |
+
-webkit-transform: translateX(-50%);
|
40 |
+
-ms-transform: translateX(-50%);
|
41 |
+
transform: translateX(-50%);
|
42 |
+
left: 100%;
|
43 |
+
}
|
44 |
+
|
45 |
+
[data-wvstooltip],
|
46 |
+
.wvs-has-image-tooltip {
|
47 |
+
position: relative;
|
48 |
+
cursor: pointer;
|
49 |
+
outline: none;
|
50 |
+
}
|
51 |
+
|
52 |
+
[data-wvstooltip]:before,
|
53 |
+
[data-wvstooltip]:after,
|
54 |
+
.wvs-has-image-tooltip:before,
|
55 |
+
.wvs-has-image-tooltip:after {
|
56 |
+
visibility: hidden;
|
57 |
+
opacity: 0;
|
58 |
+
pointer-events: none;
|
59 |
+
-webkit-box-sizing: inherit;
|
60 |
+
box-sizing: inherit;
|
61 |
+
position: absolute;
|
62 |
+
bottom: 130%;
|
63 |
+
left: 50%;
|
64 |
+
z-index: 999;
|
65 |
+
-webkit-transform: translateZ(0);
|
66 |
+
transform: translateZ(0);
|
67 |
+
-webkit-box-shadow: 0 7px 15px rgba(0, 0, 0, 0.3);
|
68 |
+
box-shadow: 0 7px 15px rgba(0, 0, 0, 0.3);
|
69 |
+
-webkit-transition: opacity 500ms ease-in-out;
|
70 |
+
-o-transition: opacity 500ms ease-in-out;
|
71 |
+
transition: opacity 500ms ease-in-out;
|
72 |
+
}
|
73 |
+
|
74 |
+
[data-wvstooltip]:before,
|
75 |
+
.wvs-has-image-tooltip:before {
|
76 |
+
margin-bottom: 5px;
|
77 |
+
-webkit-transform: translateX(-50%);
|
78 |
+
-ms-transform: translateX(-50%);
|
79 |
+
transform: translateX(-50%);
|
80 |
+
padding: 7px;
|
81 |
+
border-radius: 3px;
|
82 |
+
background-color: var(--wvs-tooltip-background-color, #333333);
|
83 |
+
color: var(--wvs-tooltip-text-color, #FFFFFF);
|
84 |
+
text-align: center;
|
85 |
+
font-size: 14px;
|
86 |
+
line-height: 1.2;
|
87 |
+
}
|
88 |
+
|
89 |
+
[data-wvstooltip]:before {
|
90 |
+
min-width: 100px;
|
91 |
+
content: attr(data-wvstooltip) " " attr(data-wvstooltip-out-of-stock);
|
92 |
+
}
|
93 |
+
|
94 |
+
.wvs-has-image-tooltip:before {
|
95 |
+
content: attr(data-title);
|
96 |
+
background-image: var(--tooltip-background);
|
97 |
+
background-repeat: no-repeat;
|
98 |
+
width: var(--tooltip-width);
|
99 |
+
height: calc(var(--tooltip-height) + 20px);
|
100 |
+
background-size: contain;
|
101 |
+
background-position: center top;
|
102 |
+
padding: 0;
|
103 |
+
line-height: 20px;
|
104 |
+
display: -webkit-box;
|
105 |
+
display: -ms-flexbox;
|
106 |
+
display: flex;
|
107 |
+
-webkit-box-align: center;
|
108 |
+
-ms-flex-align: center;
|
109 |
+
align-items: center;
|
110 |
+
-webkit-box-orient: vertical;
|
111 |
+
-webkit-box-direction: normal;
|
112 |
+
-ms-flex-direction: column;
|
113 |
+
flex-direction: column;
|
114 |
+
-webkit-box-pack: end;
|
115 |
+
-ms-flex-pack: end;
|
116 |
+
justify-content: flex-end;
|
117 |
+
-ms-flex-line-pack: center;
|
118 |
+
align-content: center;
|
119 |
+
font-size: 12px;
|
120 |
+
-webkit-backface-visibility: hidden;
|
121 |
+
backface-visibility: hidden;
|
122 |
+
}
|
123 |
+
|
124 |
+
[data-wvstooltip]:after,
|
125 |
+
.wvs-has-image-tooltip:after {
|
126 |
+
margin-left: -5px;
|
127 |
+
width: 0;
|
128 |
+
border-top: 5px solid var(--wvs-tooltip-background-color, #333333);
|
129 |
+
border-right: 5px solid transparent;
|
130 |
+
border-left: 5px solid transparent;
|
131 |
+
content: " ";
|
132 |
+
font-size: 0;
|
133 |
+
line-height: 0;
|
134 |
+
}
|
135 |
+
|
136 |
+
[data-wvstooltip]:hover:before,
|
137 |
+
[data-wvstooltip]:hover:after,
|
138 |
+
.wvs-has-image-tooltip:hover:before,
|
139 |
+
.wvs-has-image-tooltip:hover:after {
|
140 |
+
bottom: 120%;
|
141 |
+
visibility: visible;
|
142 |
+
opacity: 1;
|
143 |
+
}
|
144 |
+
|
145 |
+
.wvs-theme-sober .product form.cart .variations .variable,
|
146 |
+
.wvs-theme-child-sober .product form.cart .variations .variable {
|
147 |
+
margin-bottom: 15px !important;
|
148 |
+
}
|
149 |
+
.wvs-theme-sober .product form.cart .variations .variable-options,
|
150 |
+
.wvs-theme-child-sober .product form.cart .variations .variable-options {
|
151 |
+
border: 0 !important;
|
152 |
+
}
|
153 |
+
.wvs-theme-sober .product form.cart .variations .variable-options::after,
|
154 |
+
.wvs-theme-child-sober .product form.cart .variations .variable-options::after {
|
155 |
+
display: none;
|
156 |
+
}
|
157 |
+
.wvs-theme-sober .product form.cart .variations .arrow,
|
158 |
+
.wvs-theme-child-sober .product form.cart .variations .arrow {
|
159 |
+
display: none;
|
160 |
+
}
|
161 |
+
.wvs-theme-sober .product form.cart .variations .label,
|
162 |
+
.wvs-theme-child-sober .product form.cart .variations .label {
|
163 |
+
display: block;
|
164 |
+
text-align: right;
|
165 |
+
margin-right: 10px;
|
166 |
+
}
|
167 |
+
.wvs-theme-sober .product form.cart .variations .value,
|
168 |
+
.wvs-theme-child-sober .product form.cart .variations .value {
|
169 |
+
-webkit-box-flex: unset;
|
170 |
+
-ms-flex-positive: unset;
|
171 |
+
flex-grow: unset;
|
172 |
+
}
|
173 |
+
.wvs-theme-sober .product form.cart .variations select,
|
174 |
+
.wvs-theme-child-sober .product form.cart .variations select {
|
175 |
+
border: 1px solid #E4E6EB !important;
|
176 |
+
padding: 0.5em 1em !important;
|
177 |
+
text-align: left !important;
|
178 |
+
-moz-text-align-last: left !important;
|
179 |
+
text-align-last: left !important;
|
180 |
+
-webkit-appearance: menulist-button !important;
|
181 |
+
}
|
182 |
+
.wvs-theme-sober .product form.cart .radio-variable-item,
|
183 |
+
.wvs-theme-child-sober .product form.cart .radio-variable-item {
|
184 |
+
margin: 5px;
|
185 |
+
text-align: left;
|
186 |
+
}
|
187 |
+
.wvs-theme-sober .product form.cart .radio-variable-item:last-child,
|
188 |
+
.wvs-theme-child-sober .product form.cart .radio-variable-item:last-child {
|
189 |
+
margin-right: 0;
|
190 |
+
}
|
191 |
+
.wvs-theme-sober .product form.cart .radio-variable-item label,
|
192 |
+
.wvs-theme-child-sober .product form.cart .radio-variable-item label {
|
193 |
+
padding-left: 30px;
|
194 |
+
margin: 0;
|
195 |
+
}
|
196 |
+
.wvs-theme-sober .product form.cart .radio-variable-item label::before,
|
197 |
+
.wvs-theme-child-sober .product form.cart .radio-variable-item label::before {
|
198 |
+
top: 0;
|
199 |
+
border-radius: 100%;
|
200 |
+
}
|
201 |
+
.wvs-theme-sober .product form.cart .radio-variable-item label::after,
|
202 |
+
.wvs-theme-child-sober .product form.cart .radio-variable-item label::after {
|
203 |
+
top: 8px;
|
204 |
+
}
|
205 |
+
|
206 |
+
.wvs-theme-shophistic-lite.woocommerce #main .entry-summary .variations {
|
207 |
+
display: block !important;
|
208 |
+
}
|
209 |
+
.wvs-theme-shophistic-lite .ql_custom_variations {
|
210 |
+
display: none !important;
|
211 |
+
}
|
212 |
+
.wvs-theme-shophistic-lite .radio-variable-item input[type=radio] {
|
213 |
+
display: inline-block;
|
214 |
+
margin: 0;
|
215 |
+
}
|
216 |
+
|
217 |
+
.wvs-theme-flatsome .variations .reset_variations {
|
218 |
+
position: relative;
|
219 |
+
bottom: 0;
|
220 |
+
left: 0;
|
221 |
+
}
|
222 |
+
|
223 |
+
.wvs-theme-storefront.single-product div.product,
|
224 |
+
.wvs-theme-child-storefront.single-product div.product {
|
225 |
+
overflow: visible !important;
|
226 |
+
}
|
227 |
+
|
228 |
+
.wvs-theme-stockholm .variations .reset_variations {
|
229 |
+
position: relative;
|
230 |
+
bottom: 0;
|
231 |
+
left: 0;
|
232 |
+
-webkit-transform: none;
|
233 |
+
-ms-transform: none;
|
234 |
+
transform: none;
|
235 |
+
}
|
236 |
+
|
237 |
+
.wvs-theme-kalium .image-variable-item img,
|
238 |
+
.wvs-theme-kalium-child .image-variable-item img {
|
239 |
+
width: 100% !important;
|
240 |
+
}
|
241 |
+
.wvs-theme-kalium .radio-variable-item input,
|
242 |
+
.wvs-theme-kalium-child .radio-variable-item input {
|
243 |
+
width: 16px !important;
|
244 |
+
height: 16px !important;
|
245 |
+
}
|
246 |
+
.wvs-theme-kalium .woo-variation-items-wrapper .select-option-ui,
|
247 |
+
.wvs-theme-kalium-child .woo-variation-items-wrapper .select-option-ui {
|
248 |
+
display: none;
|
249 |
+
}
|
250 |
+
|
251 |
+
.wvs-theme-aurum .variable-items-wrapper .image-variable-item > img,
|
252 |
+
.wvs-theme-child-aurum .variable-items-wrapper .image-variable-item > img {
|
253 |
+
width: 100%;
|
254 |
+
}
|
255 |
+
|
256 |
+
.wvs-theme-hestia .woo-variation-items-wrapper.value::before {
|
257 |
+
display: none !important;
|
258 |
+
}
|
259 |
+
|
260 |
+
.wvs-theme-thegem .woo-variation-items-wrapper .combobox-wrapper,
|
261 |
+
.wvs-theme-child-thegem .woo-variation-items-wrapper .combobox-wrapper,
|
262 |
+
.wvs-theme-thegem-elementor .woo-variation-items-wrapper .combobox-wrapper {
|
263 |
+
display: none;
|
264 |
+
}
|
265 |
+
.wvs-theme-thegem .wvs-archive-variation-wrapper .variations,
|
266 |
+
.wvs-theme-child-thegem .wvs-archive-variation-wrapper .variations,
|
267 |
+
.wvs-theme-thegem-elementor .wvs-archive-variation-wrapper .variations {
|
268 |
+
padding: 0;
|
269 |
+
}
|
270 |
+
|
271 |
+
.wvs-theme-ushop .variations_form,
|
272 |
+
.wvs-theme-child-ushop .variations_form {
|
273 |
+
overflow: visible !important;
|
274 |
+
}
|
275 |
+
.wvs-theme-ushop .single-product-summary .product_meta,
|
276 |
+
.wvs-theme-child-ushop .single-product-summary .product_meta {
|
277 |
+
display: inline-table;
|
278 |
+
}
|
279 |
+
|
280 |
+
.wvs-theme-savoy .woo-variation-items-wrapper,
|
281 |
+
.wvs-theme-child-savoy .woo-variation-items-wrapper {
|
282 |
+
position: relative !important;
|
283 |
+
}
|
284 |
+
.wvs-theme-savoy .woo-variation-items-wrapper .sod_select,
|
285 |
+
.wvs-theme-child-savoy .woo-variation-items-wrapper .sod_select {
|
286 |
+
display: none !important;
|
287 |
+
}
|
288 |
+
.wvs-theme-savoy .nm-variation-row,
|
289 |
+
.wvs-theme-child-savoy .nm-variation-row {
|
290 |
+
display: -webkit-box;
|
291 |
+
display: -ms-flexbox;
|
292 |
+
display: flex;
|
293 |
+
}
|
294 |
+
|
295 |
+
.wvs-theme-woodstock .woo-variation-items-wrapper .variation-select,
|
296 |
+
.wvs-theme-child-woodstock .woo-variation-items-wrapper .variation-select {
|
297 |
display: none !important;
|
298 |
}
|
299 |
|
300 |
+
.wvs-theme-woodmart .woo-variation-items-wrapper > .swatches-select,
|
301 |
+
.wvs-theme-child-woodmart .woo-variation-items-wrapper > .swatches-select {
|
302 |
+
display: none;
|
303 |
+
}
|
304 |
+
.wvs-theme-woodmart .wd-attr-selected,
|
305 |
+
.wvs-theme-child-woodmart .wd-attr-selected {
|
306 |
+
display: none;
|
307 |
+
}
|
308 |
+
|
309 |
+
.wvs-theme-gecko .variations .value.woo-variation-items-wrapper,
|
310 |
+
.wvs-theme-gecko-child .variations .value.woo-variation-items-wrapper {
|
311 |
+
border: 0 !important;
|
312 |
+
}
|
313 |
+
.wvs-theme-gecko .variations .value.woo-variation-items-wrapper::after,
|
314 |
+
.wvs-theme-gecko-child .variations .value.woo-variation-items-wrapper::after {
|
315 |
+
display: none !important;
|
316 |
+
}
|
317 |
+
|
318 |
+
.woo-variation-gallery-theme-child-massive-dynamic .woo-variation-items-wrapper .clear-selection,
|
319 |
+
.woo-variation-gallery-theme-massive-dynamic .woo-variation-items-wrapper .clear-selection {
|
320 |
+
border: 0;
|
321 |
+
height: auto;
|
322 |
+
width: auto;
|
323 |
+
}
|
324 |
+
.woo-variation-gallery-theme-child-massive-dynamic .woo-variation-items-wrapper .clear-selection .reset_variations,
|
325 |
+
.woo-variation-gallery-theme-massive-dynamic .woo-variation-items-wrapper .clear-selection .reset_variations {
|
326 |
+
font-size: 8px !important;
|
327 |
+
width: 20px;
|
328 |
+
height: 20px;
|
329 |
+
padding: 5px;
|
330 |
+
-webkit-box-sizing: border-box;
|
331 |
+
box-sizing: border-box;
|
332 |
+
border-radius: 100%;
|
333 |
+
border: 1px solid #F04040;
|
334 |
+
color: #F04040;
|
335 |
+
}
|
336 |
+
|
337 |
+
.wvs-theme-claue .woo-variation-items-wrapper,
|
338 |
+
.wvs-theme-child-claue .woo-variation-items-wrapper {
|
339 |
+
border: none;
|
340 |
+
}
|
341 |
+
.wvs-theme-claue .woo-variation-items-wrapper::after,
|
342 |
+
.wvs-theme-child-claue .woo-variation-items-wrapper::after {
|
343 |
+
display: none;
|
344 |
+
}
|
345 |
+
|
346 |
+
.wvs-theme-jupiter table.variations,
|
347 |
+
.wvs-theme-child-jupiter table.variations {
|
348 |
+
overflow: initial;
|
349 |
+
}
|
350 |
+
|
351 |
+
.wvs-theme-oxygen .woo-variation-items-wrapper .select-wrapper,
|
352 |
+
.wvs-theme-child-oxygen .woo-variation-items-wrapper .select-wrapper {
|
353 |
+
display: none;
|
354 |
+
}
|
355 |
+
.wvs-theme-oxygen .variable-items-wrapper.radio-variable-wrapper .radio-variable-item input,
|
356 |
+
.wvs-theme-child-oxygen .variable-items-wrapper.radio-variable-wrapper .radio-variable-item input {
|
357 |
+
width: 18px;
|
358 |
+
}
|
359 |
+
|
360 |
+
.wvs-theme-simple-elegant .woo-variation-items-wrapper .wi-nice-select,
|
361 |
+
.wvs-theme-child-simple-elegant .woo-variation-items-wrapper .wi-nice-select {
|
362 |
+
display: none;
|
363 |
+
}
|
364 |
+
|
365 |
+
.wvs-theme-twentytwenty table.variations,
|
366 |
+
.wvs-theme-child-twentytwenty table.variations {
|
367 |
+
overflow: auto;
|
368 |
+
}
|
369 |
+
|
370 |
+
.wvs-theme-divi .et_pb_wc_add_to_cart form.variations_form.cart .variations td.value span:after,
|
371 |
+
.wvs-theme-child-divi .et_pb_wc_add_to_cart form.variations_form.cart .variations td.value span:after {
|
372 |
+
display: none !important;
|
373 |
+
}
|
374 |
+
|
375 |
+
.wvs-theme-jevelin .sh-woo-layout table.variations td select.woo-variation-raw-select,
|
376 |
+
.wvs-theme-child-jevelin .sh-woo-layout table.variations td select.woo-variation-raw-select {
|
377 |
+
display: none !important;
|
378 |
+
}
|
379 |
+
.wvs-theme-jevelin .sh-woo-layout table.variations,
|
380 |
+
.wvs-theme-child-jevelin .sh-woo-layout table.variations {
|
381 |
+
max-width: 100%;
|
382 |
+
}
|
383 |
+
.wvs-theme-jevelin .radio-variable-item label,
|
384 |
+
.wvs-theme-child-jevelin .radio-variable-item label {
|
385 |
+
line-height: 1 !important;
|
386 |
+
}
|
387 |
+
|
388 |
+
.wvs-theme-stockie .woo-variation-raw-select + .select-styled,
|
389 |
+
.wvs-theme-child-stockie .woo-variation-raw-select + .select-styled {
|
390 |
+
display: none !important;
|
391 |
+
}
|
392 |
+
|
393 |
+
.woo-variation-swatches .woo-variation-raw-select + .select2 {
|
394 |
+
display: none !important;
|
395 |
+
}
|
396 |
.woo-variation-swatches .wvs-widget-layered-nav-list__item-color > a {
|
397 |
display: inline-block;
|
398 |
position: relative;
|
399 |
}
|
|
|
400 |
.woo-variation-swatches .wvs-widget-layered-nav-list__item-color > a .wvs-widget-item-wrapper {
|
401 |
display: inline-block;
|
402 |
}
|
|
|
403 |
.woo-variation-swatches .wvs-widget-layered-nav-list__item-color .item {
|
404 |
display: inline-block;
|
405 |
float: left;
|
406 |
padding: 9px;
|
407 |
margin: 0 4px;
|
408 |
+
-webkit-box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
|
409 |
+
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
|
410 |
height: 20px;
|
411 |
width: 20px;
|
412 |
}
|
|
|
413 |
.woo-variation-swatches .wvs-widget-layered-nav-list__item-color .text {
|
414 |
display: inline-block;
|
415 |
}
|
|
|
416 |
.woo-variation-swatches .wvs-widget-layered-nav-list__item-color .text :after {
|
417 |
+
content: "";
|
418 |
display: inline;
|
419 |
clear: both;
|
420 |
}
|
|
|
421 |
.woo-variation-swatches .wvs-widget-layered-nav-list__item-color.woocommerce-widget-layered-nav-list__item--chosen .item {
|
422 |
+
-webkit-box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.9);
|
423 |
+
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.9);
|
424 |
+
}
|
425 |
+
.woo-variation-swatches .woo-variation-raw-select {
|
426 |
+
display: none !important;
|
427 |
+
}
|
428 |
+
.woo-variation-swatches .woo-variation-raw-select:before, .woo-variation-swatches .woo-variation-raw-select:after {
|
429 |
+
display: none !important;
|
430 |
+
}
|
431 |
+
.woo-variation-swatches .variations td.value > span:before, .woo-variation-swatches .variations td.value > span:after {
|
432 |
+
display: none !important;
|
433 |
+
}
|
434 |
+
.woo-variation-swatches .woo-variation-swatches-variable-item-more {
|
435 |
+
-webkit-box-align: center;
|
436 |
+
-ms-flex-align: center;
|
437 |
+
align-items: center;
|
438 |
+
display: -webkit-box;
|
439 |
+
display: -ms-flexbox;
|
440 |
+
display: flex;
|
441 |
+
}
|
442 |
+
.woo-variation-swatches .wvs-archive-variations-wrapper {
|
443 |
+
display: block;
|
444 |
+
width: 100%;
|
445 |
+
}
|
446 |
+
.woo-variation-swatches .wvs-archive-variations-wrapper .variable-items-wrapper .variable-item:not(.radio-variable-item) {
|
447 |
+
width: var(--wvs-archive-product-item-width, 30px);
|
448 |
+
height: var(--wvs-archive-product-item-height, 30px);
|
449 |
+
}
|
450 |
+
.woo-variation-swatches .wvs-archive-variations-wrapper .variable-items-wrapper .variable-item:not(.radio-variable-item).button-variable-item {
|
451 |
+
font-size: var(--wvs-archive-product-item-font-size, 16px);
|
452 |
+
min-width: var(--wvs-archive-product-item-width, 30px) !important;
|
453 |
+
}
|
454 |
+
.woo-variation-swatches ul.variations {
|
455 |
+
list-style: none;
|
456 |
+
margin: 0;
|
457 |
+
padding: 0;
|
458 |
+
display: -webkit-box;
|
459 |
+
display: -ms-flexbox;
|
460 |
+
display: flex;
|
461 |
+
-webkit-box-orient: vertical;
|
462 |
+
-webkit-box-direction: normal;
|
463 |
+
-ms-flex-direction: column;
|
464 |
+
flex-direction: column;
|
465 |
+
}
|
466 |
+
.woo-variation-swatches ul.variations > li {
|
467 |
+
display: -webkit-box;
|
468 |
+
display: -ms-flexbox;
|
469 |
+
display: flex;
|
470 |
+
-webkit-box-pack: var(--wvs-position);
|
471 |
+
-ms-flex-pack: var(--wvs-position);
|
472 |
+
justify-content: var(--wvs-position);
|
473 |
+
-webkit-box-orient: horizontal;
|
474 |
+
-webkit-box-direction: normal;
|
475 |
+
-ms-flex-direction: row;
|
476 |
+
flex-direction: row;
|
477 |
+
margin: 5px 0;
|
478 |
+
}
|
479 |
+
.woo-variation-swatches ul.variations .wvs_archive_reset_variations.hide {
|
480 |
+
visibility: hidden;
|
481 |
+
}
|
482 |
+
.woo-variation-swatches ul.variations .wvs_archive_reset_variations.show {
|
483 |
+
visibility: visible;
|
484 |
}
|
|
|
485 |
.woo-variation-swatches .variable-items-wrapper {
|
486 |
+
display: -webkit-box;
|
487 |
+
display: -ms-flexbox;
|
488 |
display: flex;
|
489 |
+
-ms-flex-wrap: wrap;
|
490 |
+
flex-wrap: wrap;
|
491 |
+
-webkit-box-pack: start;
|
492 |
+
-ms-flex-pack: start;
|
493 |
+
justify-content: flex-start;
|
494 |
+
margin: 0 5px;
|
495 |
padding: 0;
|
496 |
list-style: none;
|
497 |
}
|
498 |
+
.woo-variation-swatches .variable-items-wrapper.enabled-large-size .variable-item:not(.radio-variable-item) {
|
499 |
+
width: var(--wvs-single-product-large-item-width, 40px);
|
500 |
+
height: var(--wvs-single-product-large-item-height, 40px);
|
501 |
+
}
|
502 |
+
.woo-variation-swatches .variable-items-wrapper.enabled-large-size .variable-item:not(.radio-variable-item).button-variable-item {
|
503 |
+
font-size: var(--wvs-single-product-large-item-font-size, 16px);
|
504 |
+
}
|
505 |
+
.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper {
|
506 |
+
-webkit-box-orient: vertical;
|
507 |
+
-webkit-box-direction: normal;
|
508 |
+
-ms-flex-direction: column;
|
509 |
+
flex-direction: column;
|
510 |
+
-webkit-box-align: start;
|
511 |
+
-ms-flex-align: start;
|
512 |
+
align-items: flex-start;
|
513 |
+
}
|
514 |
+
.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item {
|
515 |
+
-webkit-box-sizing: border-box;
|
516 |
+
box-sizing: border-box;
|
517 |
+
display: block;
|
518 |
+
list-style: none;
|
519 |
+
cursor: pointer;
|
520 |
+
/*margin: 5px 0;*/
|
521 |
+
padding: 0 5px;
|
522 |
+
}
|
523 |
+
.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item label, .woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item input {
|
524 |
+
cursor: pointer;
|
525 |
+
vertical-align: middle;
|
526 |
+
}
|
527 |
+
.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item input {
|
528 |
+
margin: 5px;
|
529 |
+
width: 20px;
|
530 |
+
height: 20px;
|
531 |
+
}
|
532 |
+
.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item .variable-item-radio-value-wrapper {
|
533 |
+
display: inline-block;
|
534 |
+
}
|
535 |
+
.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item .variable-item-radio-value-wrapper img {
|
536 |
+
width: 40px;
|
537 |
+
display: inline-block;
|
538 |
+
margin: 0;
|
539 |
+
padding: 0;
|
540 |
+
vertical-align: middle;
|
541 |
+
}
|
542 |
+
.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item .variable-item-radio-value-wrapper .out-of-stock {
|
543 |
+
display: inline-block;
|
544 |
+
margin: 0;
|
545 |
+
padding: 0;
|
546 |
+
}
|
547 |
+
.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item label {
|
548 |
+
width: auto;
|
549 |
+
display: inline-block;
|
550 |
+
padding: 2px 0;
|
551 |
+
}
|
552 |
+
.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.disabled, .woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.disabled:hover {
|
553 |
+
-webkit-box-shadow: none;
|
554 |
+
box-shadow: none;
|
555 |
+
}
|
556 |
+
.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.disabled label, .woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.disabled input, .woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.disabled:hover label, .woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.disabled:hover input {
|
557 |
+
cursor: not-allowed;
|
558 |
+
opacity: 0.5;
|
559 |
+
}
|
560 |
+
.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.disabled .variable-item-radio-value, .woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.disabled:hover .variable-item-radio-value {
|
561 |
+
text-decoration: line-through;
|
562 |
+
}
|
563 |
+
.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.disabled::before, .woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.disabled::after, .woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.disabled:hover::before, .woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.disabled:hover::after {
|
564 |
+
display: none;
|
565 |
+
}
|
566 |
+
.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.disabled:focus, .woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.disabled:hover:focus {
|
567 |
+
-webkit-box-shadow: none;
|
568 |
+
box-shadow: none;
|
569 |
+
}
|
570 |
+
.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.no-stock label, .woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.no-stock input, .woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.no-stock:hover label, .woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.no-stock:hover input {
|
571 |
+
text-decoration: line-through;
|
572 |
+
opacity: 0.6;
|
573 |
+
}
|
574 |
+
.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.no-stock .variable-item-radio-value, .woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.no-stock:hover .variable-item-radio-value {
|
575 |
+
text-decoration: line-through;
|
576 |
+
}
|
577 |
+
.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item:hover {
|
578 |
+
-webkit-box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
|
579 |
+
box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
|
580 |
+
}
|
581 |
+
.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item:focus {
|
582 |
+
-webkit-box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.3);
|
583 |
+
box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.3);
|
584 |
+
}
|
585 |
+
.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.selected, .woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.selected:hover {
|
586 |
+
-webkit-box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.9);
|
587 |
+
box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.9);
|
588 |
+
}
|
589 |
.woo-variation-swatches .variable-items-wrapper .variable-item {
|
590 |
margin: 0;
|
591 |
padding: 0;
|
592 |
list-style: none;
|
593 |
+
-webkit-transition: all 200ms ease;
|
594 |
+
-o-transition: all 200ms ease;
|
595 |
transition: all 200ms ease;
|
596 |
-webkit-user-select: none;
|
597 |
-moz-user-select: none;
|
599 |
user-select: none;
|
600 |
outline: none;
|
601 |
}
|
|
|
602 |
.woo-variation-swatches .variable-items-wrapper .variable-item .variable-item-contents {
|
603 |
+
display: -webkit-box;
|
604 |
+
display: -ms-flexbox;
|
605 |
display: flex;
|
606 |
+
-webkit-box-orient: vertical;
|
607 |
+
-webkit-box-direction: normal;
|
608 |
+
-ms-flex-direction: column;
|
609 |
+
flex-direction: column;
|
610 |
+
-webkit-box-pack: center;
|
611 |
+
-ms-flex-pack: center;
|
612 |
+
justify-content: center;
|
613 |
+
position: relative;
|
614 |
width: 100%;
|
615 |
height: 100%;
|
616 |
}
|
|
|
617 |
@supports (display: contents) {
|
618 |
.woo-variation-swatches .variable-items-wrapper .variable-item .variable-item-contents {
|
619 |
+
/* display: contents;*/
|
620 |
}
|
621 |
}
|
|
|
622 |
.woo-variation-swatches .variable-items-wrapper .variable-item.variation-disabled {
|
623 |
display: none !important;
|
624 |
}
|
|
|
625 |
.woo-variation-swatches .variable-items-wrapper .variable-item img {
|
626 |
margin: 0;
|
627 |
/** Storefront FIX */
|
632 |
height: 100%;
|
633 |
pointer-events: none;
|
634 |
}
|
635 |
+
.woo-variation-swatches .variable-items-wrapper .variable-item > span {
|
|
|
636 |
pointer-events: none;
|
637 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
638 |
.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item) {
|
639 |
+
-webkit-box-sizing: border-box;
|
640 |
+
box-sizing: border-box;
|
641 |
cursor: pointer;
|
642 |
+
display: -webkit-box;
|
643 |
+
display: -ms-flexbox;
|
644 |
display: flex;
|
645 |
+
position: relative;
|
646 |
+
-webkit-box-pack: center;
|
647 |
+
-ms-flex-pack: center;
|
648 |
+
justify-content: center;
|
649 |
+
-webkit-box-align: center;
|
650 |
+
-ms-flex-align: center;
|
651 |
+
align-items: center;
|
652 |
+
background-color: var(--wvs-item-background-color, #FFFFFF);
|
653 |
+
color: var(--wvs-item-text-color, #000000);
|
654 |
+
-webkit-box-shadow: var(--wvs-item-box-shadow, 0 0 0 1px #A8A8A8);
|
655 |
+
box-shadow: var(--wvs-item-box-shadow, 0 0 0 1px #A8A8A8);
|
656 |
padding: 2px;
|
657 |
+
margin: 4px;
|
658 |
+
width: var(--wvs-single-product-item-width, 30px);
|
659 |
+
height: var(--wvs-single-product-item-height, 30px);
|
660 |
}
|
661 |
+
.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item):first-child {
|
662 |
+
margin-left: 0;
|
663 |
+
}
|
664 |
+
.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item):last-child {
|
665 |
margin-right: 0;
|
666 |
}
|
667 |
+
.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).no-stock img, .woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).no-stock span, .woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).no-stock .variable-item-contents {
|
668 |
+
opacity: 0.6;
|
669 |
+
}
|
670 |
+
.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).no-stock .variable-item-contents::before {
|
671 |
+
position: absolute;
|
672 |
+
content: " ";
|
673 |
+
display: block;
|
674 |
+
background-image: var(--wvs-cross);
|
675 |
+
background-repeat: no-repeat;
|
676 |
+
background-position: center center;
|
677 |
+
height: 100%;
|
678 |
+
width: 100%;
|
679 |
+
}
|
680 |
.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item):hover {
|
681 |
+
-webkit-box-shadow: var(--wvs-hover-item-box-shadow, 0 0 0 3px #dddddd);
|
682 |
+
box-shadow: var(--wvs-hover-item-box-shadow, 0 0 0 3px #dddddd);
|
683 |
+
background-color: var(--wvs-hover-item-background-color, #FFFFFF);
|
684 |
+
color: var(--wvs-hover-item-text-color, #000000);
|
685 |
}
|
|
|
686 |
.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item):focus {
|
687 |
+
-webkit-box-shadow: var(--wvs-hover-item-box-shadow, 0 0 0 3px #dddddd);
|
688 |
+
box-shadow: var(--wvs-hover-item-box-shadow, 0 0 0 3px #dddddd);
|
689 |
}
|
690 |
+
.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).selected, .woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).selected:hover {
|
691 |
+
-webkit-box-shadow: var(--wvs-selected-item-box-shadow, 0 0 0 2px #000);
|
692 |
+
box-shadow: var(--wvs-selected-item-box-shadow, 0 0 0 2px #000);
|
693 |
+
color: var(--wvs-selected-item-text-color, #000000);
|
694 |
}
|
695 |
+
.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).disabled, .woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).disabled:hover {
|
696 |
+
pointer-events: none;
|
697 |
+
cursor: not-allowed;
|
|
|
698 |
position: relative;
|
699 |
+
overflow: hidden;
|
700 |
+
}
|
701 |
+
.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).disabled img, .woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).disabled span, .woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).disabled .variable-item-contents, .woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).disabled:hover img, .woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).disabled:hover span, .woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).disabled:hover .variable-item-contents {
|
702 |
+
opacity: 0.6;
|
703 |
+
}
|
704 |
+
.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).disabled .variable-item-contents::before, .woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).disabled:hover .variable-item-contents::before {
|
705 |
+
position: absolute;
|
706 |
+
content: " ";
|
707 |
display: block;
|
708 |
+
background-image: var(--wvs-cross);
|
709 |
+
background-repeat: no-repeat;
|
710 |
+
background-position: center center;
|
711 |
+
height: 100%;
|
712 |
+
width: 100%;
|
713 |
}
|
714 |
+
.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).color-variable-item.selected:not(.no-stock) .variable-item-contents::before, .woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).image-variable-item.selected:not(.no-stock) .variable-item-contents::before {
|
|
|
715 |
position: absolute;
|
716 |
+
content: " ";
|
717 |
+
display: block;
|
718 |
+
background-image: var(--wvs-tick);
|
719 |
+
background-repeat: no-repeat;
|
720 |
+
background-position: center center;
|
721 |
+
background-size: 60%;
|
722 |
+
height: 100%;
|
723 |
+
width: 100%;
|
724 |
+
}
|
725 |
+
.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).color-variable-item .variable-item-span-color, .woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).image-variable-item .variable-item-span-color {
|
726 |
width: 100%;
|
727 |
height: 100%;
|
728 |
+
/*position: relative;*/
|
729 |
+
display: block;
|
|
|
730 |
}
|
|
|
731 |
.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).button-variable-item {
|
732 |
text-align: center;
|
733 |
+
font-size: var(--wvs-single-product-item-font-size, 16px);
|
734 |
}
|
735 |
+
.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).button-variable-item.selected:not(.no-stock) {
|
736 |
+
background-color: var(--wvs-selected-item-text-color, #000000);
|
737 |
+
color: var(--wvs-selected-item-background-color, #FFFFFF);
|
738 |
+
}
|
739 |
+
.woo-variation-swatches .variable-items-wrapper .variable-item.wvs-show-stock-left-info:not(.disabled):not(.radio-variable-item) .wvs-stock-left-info::before {
|
740 |
+
content: " ";
|
741 |
+
position: absolute;
|
742 |
+
top: calc(100% - 1px);
|
743 |
+
left: 50%;
|
744 |
+
margin-left: -3px;
|
745 |
+
width: 0;
|
746 |
+
border-bottom: 3px solid #de8604;
|
747 |
+
border-right: 3px solid transparent;
|
748 |
+
border-left: 3px solid transparent;
|
749 |
+
z-index: 1;
|
750 |
+
}
|
751 |
+
.woo-variation-swatches .variable-items-wrapper .variable-item.wvs-show-stock-left-info:not(.disabled):not(.radio-variable-item) .wvs-stock-left-info::after {
|
752 |
+
position: absolute;
|
753 |
+
left: 50%;
|
754 |
+
-webkit-transform: translateX(-50%);
|
755 |
+
-ms-transform: translateX(-50%);
|
756 |
+
transform: translateX(-50%);
|
757 |
+
top: calc(100% + 2px);
|
758 |
+
min-width: 36px;
|
759 |
+
text-align: center;
|
760 |
+
}
|
761 |
+
.woo-variation-swatches .variable-items-wrapper .variable-item.wvs-show-stock-left-info:not(.disabled) .wvs-stock-left-info::after {
|
762 |
+
content: attr(data-wvs-stock-info);
|
763 |
+
line-height: 1;
|
764 |
+
font-size: 10px;
|
765 |
+
font-style: italic;
|
766 |
+
background: #de8604;
|
767 |
+
color: #fff;
|
768 |
+
padding: 2px;
|
769 |
+
border-radius: 2px !important;
|
770 |
+
text-shadow: 0 1px #00000040;
|
771 |
+
-webkit-box-shadow: 0 0 2px #00000061;
|
772 |
+
box-shadow: 0 0 2px #00000061;
|
773 |
+
}
|
774 |
+
.woo-variation-swatches .variable-items-wrapper .variable-item.wvs-show-stock-left-info:not(.disabled).radio-variable-item .wvs-stock-left-info::after {
|
775 |
+
margin-left: 5px;
|
776 |
+
}
|
777 |
+
.woo-variation-swatches .wvs-style-rounded.variable-items-wrapper .variable-item:not(.radio-variable-item) {
|
778 |
border-radius: 100%;
|
779 |
}
|
780 |
+
.woo-variation-swatches .wvs-style-rounded.variable-items-wrapper .variable-item:not(.radio-variable-item) .variable-item-span, .woo-variation-swatches .wvs-style-rounded.variable-items-wrapper .variable-item:not(.radio-variable-item) img {
|
|
|
|
|
|
|
781 |
border-radius: 100%;
|
782 |
+
overflow: hidden;
|
783 |
+
line-height: 1;
|
784 |
+
margin: 0;
|
785 |
}
|
786 |
+
.woo-variation-swatches .wvs-style-rounded.variable-items-wrapper .variable-item.radio-variable-item {
|
|
|
787 |
border-radius: 2px;
|
788 |
}
|
789 |
+
.woo-variation-swatches .wvs-style-rounded.variable-items-wrapper .variable-item.radio-variable-item img {
|
790 |
+
border-radius: 100%;
|
791 |
+
}
|
792 |
+
.woo-variation-swatches .wvs-style-squared.variable-items-wrapper .variable-item:not(.radio-variable-item) {
|
793 |
+
border-radius: 2px;
|
794 |
+
}
|
795 |
+
.woo-variation-swatches .wvs-style-squared.variable-items-wrapper .variable-item:not(.radio-variable-item).button-variable-item {
|
796 |
width: auto;
|
797 |
+
min-width: var(--wvs-single-product-item-width);
|
798 |
}
|
799 |
+
.woo-variation-swatches .wvs-style-squared.variable-items-wrapper .variable-item:not(.radio-variable-item).button-variable-item .variable-item-span {
|
|
|
800 |
padding: 0 5px;
|
801 |
}
|
802 |
+
.woo-variation-swatches .wvs-style-squared.variable-items-wrapper .variable-item:not(.radio-variable-item).color-variable-item span::after {
|
|
|
803 |
border-radius: 0;
|
804 |
}
|
805 |
+
.woo-variation-swatches .wvs-style-squared.variable-items-wrapper .variable-item.radio-variable-item {
|
806 |
+
border-radius: 2px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
807 |
}
|
808 |
+
.woo-variation-swatches .wvs-style-squared.variable-items-wrapper .variable-item.radio-variable-item img {
|
809 |
+
border-radius: 5px;
|
|
|
|
|
|
|
|
|
|
|
810 |
}
|
811 |
+
.woo-variation-swatches.wvs-behavior-blur .variable-items-wrapper .variable-item:not(.radio-variable-item).disabled .variable-item-contents::before, .woo-variation-swatches.wvs-behavior-blur .variable-items-wrapper .variable-item:not(.radio-variable-item).disabled:hover .variable-item-contents::before {
|
812 |
+
/*background: none;*/
|
|
|
|
|
|
|
|
|
|
|
813 |
}
|
814 |
+
.woo-variation-swatches.wvs-behavior-blur .variable-items-wrapper .radio-variable-item.disabled label, .woo-variation-swatches.wvs-behavior-blur .variable-items-wrapper .radio-variable-item.disabled input, .woo-variation-swatches.wvs-behavior-blur .variable-items-wrapper .radio-variable-item.disabled:hover label, .woo-variation-swatches.wvs-behavior-blur .variable-items-wrapper .radio-variable-item.disabled:hover input {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
815 |
cursor: not-allowed;
|
816 |
text-decoration: line-through;
|
817 |
+
opacity: 0.5;
|
818 |
}
|
819 |
+
.woo-variation-swatches.wvs-behavior-blur .variable-items-wrapper .radio-variable-item.disabled::before, .woo-variation-swatches.wvs-behavior-blur .variable-items-wrapper .radio-variable-item.disabled::after, .woo-variation-swatches.wvs-behavior-blur .variable-items-wrapper .radio-variable-item.disabled:hover::before, .woo-variation-swatches.wvs-behavior-blur .variable-items-wrapper .radio-variable-item.disabled:hover::after {
|
|
|
|
|
|
|
|
|
820 |
display: none;
|
821 |
}
|
822 |
+
.woo-variation-swatches.wvs-behavior-blur-no-cross .variable-items-wrapper .variable-item:not(.radio-variable-item).disabled .variable-item-contents::before, .woo-variation-swatches.wvs-behavior-blur-no-cross .variable-items-wrapper .variable-item:not(.radio-variable-item).disabled:hover .variable-item-contents::before, .woo-variation-swatches.wvs-behavior-blur-no-cross .variable-items-wrapper .variable-item:not(.radio-variable-item).no-stock .variable-item-contents::before, .woo-variation-swatches.wvs-behavior-blur-no-cross .variable-items-wrapper .variable-item:not(.radio-variable-item).no-stock:hover .variable-item-contents::before {
|
823 |
+
background-image: none;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
824 |
}
|
825 |
+
.woo-variation-swatches.wvs-behavior-blur-no-cross .variable-items-wrapper .radio-variable-item.disabled, .woo-variation-swatches.wvs-behavior-blur-no-cross .variable-items-wrapper .radio-variable-item.disabled:hover {
|
|
|
|
|
826 |
overflow: hidden;
|
827 |
}
|
828 |
+
.woo-variation-swatches.wvs-behavior-blur-no-cross .variable-items-wrapper .radio-variable-item.disabled label, .woo-variation-swatches.wvs-behavior-blur-no-cross .variable-items-wrapper .radio-variable-item.disabled input, .woo-variation-swatches.wvs-behavior-blur-no-cross .variable-items-wrapper .radio-variable-item.disabled:hover label, .woo-variation-swatches.wvs-behavior-blur-no-cross .variable-items-wrapper .radio-variable-item.disabled:hover input {
|
|
|
|
|
|
|
|
|
829 |
pointer-events: none;
|
830 |
+
opacity: 0.3;
|
831 |
}
|
832 |
+
.woo-variation-swatches.wvs-behavior-hide .variable-items-wrapper .variable-item.disabled {
|
|
|
833 |
opacity: 0;
|
834 |
visibility: hidden;
|
835 |
-webkit-transform: scale(0);
|
836 |
+
-ms-transform: scale(0);
|
837 |
transform: scale(0);
|
838 |
-webkit-transform-origin: center;
|
839 |
+
-ms-transform-origin: center;
|
840 |
transform-origin: center;
|
841 |
+
font-size: 0;
|
842 |
width: 0 !important;
|
843 |
height: 0 !important;
|
844 |
padding: 0 !important;
|
846 |
min-width: 0 !important;
|
847 |
min-height: 0 !important;
|
848 |
}
|
849 |
+
.woo-variation-swatches.wvs-behavior-hide .variable-items-wrapper .variable-item.disabled.radio-variable-item {
|
|
|
850 |
width: auto !important;
|
851 |
}
|
852 |
+
.woo-variation-swatches.wvs-behavior-hide .variable-items-wrapper .variable-item.no-stock .variable-item-contents::before {
|
853 |
+
background-image: none;
|
854 |
+
}
|
855 |
.woo-variation-swatches.rtl table.variations td.label {
|
856 |
/*padding-left: 15px;
|
857 |
+
padding-right: 0;
|
858 |
+
text-align: right;*/
|
859 |
}
|
|
|
860 |
.woo-variation-swatches.rtl .variable-items-wrapper .variable-item {
|
861 |
text-align: right;
|
862 |
}
|
|
|
863 |
.woo-variation-swatches.rtl .variable-items-wrapper .variable-item:not(.radio-variable-item) {
|
864 |
margin: 4px 0 4px 8px;
|
865 |
}
|
|
|
866 |
.woo-variation-swatches.rtl .variable-items-wrapper.radio-variable-wrapper .radio-variable-item input {
|
867 |
margin-right: 0;
|
868 |
margin-left: 5px;
|
869 |
}
|
|
|
870 |
.woo-variation-swatches.woocommerce .product.elementor table.variations td.value:before {
|
871 |
display: none !important;
|
872 |
}
|
|
|
873 |
.woo-variation-swatches.woo-variation-swatches-ie11 .variable-items-wrapper {
|
874 |
display: block !important;
|
875 |
}
|
|
|
876 |
.woo-variation-swatches.woo-variation-swatches-ie11 .variable-items-wrapper .variable-item:not(.radio-variable-item) {
|
877 |
float: left;
|
878 |
}
|
879 |
+
.woo-variation-swatches.wvs-show-label .variations th, .woo-variation-swatches.wvs-show-label .variations td {
|
|
|
880 |
display: block;
|
881 |
width: auto !important;
|
882 |
}
|
883 |
+
.woo-variation-swatches.wvs-show-label .variations th label, .woo-variation-swatches.wvs-show-label .variations th .woo-selected-variation-item-name, .woo-variation-swatches.wvs-show-label .variations td label, .woo-variation-swatches.wvs-show-label .variations td .woo-selected-variation-item-name {
|
|
|
|
|
884 |
display: inline-block;
|
885 |
margin: 0 2px;
|
886 |
+
}
|
887 |
+
.woo-variation-swatches .grouped-variable-items {
|
888 |
+
display: -webkit-box;
|
889 |
+
display: -ms-flexbox;
|
890 |
+
display: flex;
|
891 |
+
-ms-flex-wrap: wrap;
|
892 |
+
flex-wrap: wrap;
|
893 |
+
list-style: none !important;
|
894 |
+
}
|
895 |
+
.woo-variation-swatches .grouped-variable-items.grouped-variable-items-display-vertical {
|
896 |
+
-webkit-box-orient: vertical;
|
897 |
+
-webkit-box-direction: normal;
|
898 |
+
-ms-flex-direction: column;
|
899 |
+
flex-direction: column;
|
900 |
+
}
|
901 |
+
.woo-variation-swatches .grouped-variable-items.grouped-variable-items-display-vertical .group-variable-items-wrapper {
|
902 |
+
margin-top: 10px;
|
903 |
+
}
|
904 |
+
.woo-variation-swatches .grouped-variable-items.grouped-variable-items-display-vertical .no-group-variable-items-wrapper {
|
905 |
+
margin-top: 20px;
|
906 |
+
}
|
907 |
+
.woo-variation-swatches .grouped-variable-items.grouped-variable-items-display-horizontal {
|
908 |
+
-webkit-box-align: end;
|
909 |
+
-ms-flex-align: end;
|
910 |
+
align-items: flex-end;
|
911 |
+
}
|
912 |
+
.woo-variation-swatches .grouped-variable-items.grouped-variable-items-display-horizontal .group-variable-items-wrapper {
|
913 |
+
margin-top: 10px;
|
914 |
+
margin-right: 20px;
|
915 |
+
}
|
916 |
+
.woo-variation-swatches .grouped-variable-items.grouped-variable-items-display-horizontal .group-variable-items-wrapper:last-child {
|
917 |
+
margin-right: 0;
|
918 |
+
}
|
919 |
+
.woo-variation-swatches .grouped-variable-items.grouped-variable-items-display-horizontal .no-group-variable-items-wrapper {
|
920 |
+
margin-right: 0;
|
921 |
+
}
|
922 |
+
.woo-variation-swatches .grouped-variable-items .group-variable-item-wrapper {
|
923 |
+
display: -webkit-box;
|
924 |
+
display: -ms-flexbox;
|
925 |
+
display: flex;
|
926 |
+
margin: 0;
|
927 |
+
-ms-flex-wrap: wrap;
|
928 |
+
flex-wrap: wrap;
|
929 |
+
}
|
930 |
+
.woo-variation-swatches .grouped-variable-items .group-variable-items-name {
|
931 |
+
font-style: italic;
|
932 |
}
|
assets/css/frontend.min.css
CHANGED
@@ -1,8 +1 @@
|
|
1 |
-
/*!
|
2 |
-
* Variation Swatches for WooCommerce v1.1.19
|
3 |
-
*
|
4 |
-
* Author: Emran Ahmed ( emran.bd.08@gmail.com )
|
5 |
-
* Date: 07/09/2021
|
6 |
-
* Released under the GPLv3 license.
|
7 |
-
*/
|
8 |
-
.woo-variation-swatches .woo-variation-raw-select,.woo-variation-swatches .woo-variation-raw-select+.select2{display:none!important}.woo-variation-swatches .wvs-widget-layered-nav-list__item-color>a{display:inline-block;position:relative}.woo-variation-swatches .wvs-widget-layered-nav-list__item-color>a .wvs-widget-item-wrapper{display:inline-block}.woo-variation-swatches .wvs-widget-layered-nav-list__item-color .item{display:inline-block;float:left;padding:9px;margin:0 4px;box-shadow:0 0 0 1px rgba(0,0,0,.5);height:20px;width:20px}.woo-variation-swatches .wvs-widget-layered-nav-list__item-color .text{display:inline-block}.woo-variation-swatches .wvs-widget-layered-nav-list__item-color .text :after{content:"";display:inline;clear:both}.woo-variation-swatches .wvs-widget-layered-nav-list__item-color.woocommerce-widget-layered-nav-list__item--chosen .item{box-shadow:0 0 0 1px rgba(0,0,0,.9)}.woo-variation-swatches .variable-items-wrapper{display:flex;flex-wrap:wrap;margin:0!important;padding:0;list-style:none}.woo-variation-swatches .variable-items-wrapper .variable-item{margin:0;padding:0;list-style:none;transition:all .2s ease;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;outline:none}.woo-variation-swatches .variable-items-wrapper .variable-item .variable-item-contents{display:flex;width:100%;height:100%}@supports (display:contents){.woo-variation-swatches .variable-items-wrapper .variable-item .variable-item-contents{display:contents}}.woo-variation-swatches .variable-items-wrapper .variable-item.variation-disabled{display:none!important}.woo-variation-swatches .variable-items-wrapper .variable-item img{margin:0;padding:0;width:100%;height:100%;pointer-events:none}.woo-variation-swatches .variable-items-wrapper .variable-item span{pointer-events:none}.woo-variation-swatches .variable-items-wrapper.radio-variable-wrapper{display:block}.woo-variation-swatches .variable-items-wrapper.radio-variable-wrapper .radio-variable-item{box-sizing:border-box;display:block;list-style:none;cursor:pointer;margin:0}.woo-variation-swatches .variable-items-wrapper.radio-variable-wrapper .radio-variable-item input,.woo-variation-swatches .variable-items-wrapper.radio-variable-wrapper .radio-variable-item label{cursor:pointer}.woo-variation-swatches .variable-items-wrapper.radio-variable-wrapper .radio-variable-item input{margin-right:5px}.woo-variation-swatches .variable-items-wrapper.radio-variable-wrapper .radio-variable-item label{font-weight:400;font-size:14px;display:inline-block}.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item){box-sizing:border-box;cursor:pointer;display:flex;justify-content:center;align-items:center;background-color:#fff;box-shadow:0 0 0 1px rgba(0,0,0,.3);padding:2px;margin:4px 8px 4px 0}.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item):last-of-type{margin-right:0}.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item):hover{box-shadow:0 0 0 3px rgba(0,0,0,.1)}.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item):focus{box-shadow:0 0 0 3px rgba(0,0,0,.3)}.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).selected,.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).selected:hover{box-shadow:0 0 0 2px rgba(0,0,0,.9)}.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).color-variable-item .variable-item-span-color{width:100%;height:100%;position:relative;display:block}.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).color-variable-item .variable-item-span-color:after{position:absolute;content:"";width:100%;height:100%;top:0;left:0;box-shadow:inset 0 0 1px 0 rgba(0,0,0,.5)}.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).button-variable-item{text-align:center}.woo-variation-swatches.wvs-style-rounded .variable-items-wrapper .variable-item,.woo-variation-swatches.wvs-style-rounded .variable-items-wrapper .variable-item .variable-item-span,.woo-variation-swatches.wvs-style-rounded .variable-items-wrapper .variable-item .variable-item-span:after,.woo-variation-swatches.wvs-style-rounded .variable-items-wrapper .variable-item img{border-radius:100%}.woo-variation-swatches.wvs-style-squared .variable-items-wrapper .variable-item{border-radius:2px}.woo-variation-swatches.wvs-style-squared .variable-items-wrapper .variable-item.button-variable-item{width:auto}.woo-variation-swatches.wvs-style-squared .variable-items-wrapper .variable-item.button-variable-item .variable-item-span{padding:0 5px}.woo-variation-swatches.wvs-style-squared .variable-items-wrapper .variable-item.color-variable-item span:after{border-radius:0}.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).disabled,.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).disabled:hover,.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock,.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock:hover{box-shadow:0 0 0 1px rgba(0,0,0,.05);pointer-events:none;cursor:not-allowed;position:relative;overflow:hidden}.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).disabled .variable-item-contents,.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).disabled:hover .variable-item-contents,.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).disabled:hover img,.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).disabled:hover span,.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).disabled img,.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).disabled span,.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock .variable-item-contents,.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock:hover .variable-item-contents,.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock:hover img,.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock:hover span,.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock img,.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock span{opacity:.3}.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).disabled .variable-item-contents:after,.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).disabled .variable-item-contents:before,.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).disabled:hover .variable-item-contents:after,.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).disabled:hover .variable-item-contents:before,.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock .variable-item-contents:after,.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock .variable-item-contents:before,.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock:hover .variable-item-contents:after,.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock:hover .variable-item-contents:before{position:absolute;content:" "!important;width:100%;height:1px;background:red!important;left:0;right:0;bottom:0;top:50%;visibility:visible;opacity:1;border:0;margin:0!important;padding:0!important;min-width:auto;-webkit-transform-origin:center;transform-origin:center;z-index:0}.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).disabled .variable-item-contents:before,.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).disabled:hover .variable-item-contents:before,.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock .variable-item-contents:before,.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock:hover .variable-item-contents:before{-webkit-transform:rotate(45deg);transform:rotate(45deg)}.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).disabled .variable-item-contents:after,.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).disabled:hover .variable-item-contents:after,.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock .variable-item-contents:after,.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock:hover .variable-item-contents:after{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock,.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock:hover{overflow:visible;pointer-events:auto;cursor:pointer}.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock .variable-item-contents,.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock:hover .variable-item-contents,.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock:hover img,.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock:hover span,.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock img,.woo-variation-swatches.wvs-attr-behavior-blur .variable-item:not(.radio-variable-item).out-of-stock span{opacity:.6}.woo-variation-swatches.wvs-attr-behavior-blur .radio-variable-item.disabled:hover input,.woo-variation-swatches.wvs-attr-behavior-blur .radio-variable-item.disabled:hover label,.woo-variation-swatches.wvs-attr-behavior-blur .radio-variable-item.disabled input,.woo-variation-swatches.wvs-attr-behavior-blur .radio-variable-item.disabled label{cursor:not-allowed;text-decoration:line-through;opacity:.5}.woo-variation-swatches.wvs-attr-behavior-blur .radio-variable-item.disabled:after,.woo-variation-swatches.wvs-attr-behavior-blur .radio-variable-item.disabled:before,.woo-variation-swatches.wvs-attr-behavior-blur .radio-variable-item.disabled:hover:after,.woo-variation-swatches.wvs-attr-behavior-blur .radio-variable-item.disabled:hover:before{display:none}.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).disabled,.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).disabled:hover,.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).out-of-stock,.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).out-of-stock:hover{pointer-events:none;box-shadow:0 0 0 1px rgba(0,0,0,.05);position:relative;overflow:hidden;cursor:not-allowed}.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).disabled .variable-item-contents,.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).disabled:hover .variable-item-contents,.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).disabled:hover img,.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).disabled:hover span,.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).disabled img,.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).disabled span,.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).out-of-stock .variable-item-contents,.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).out-of-stock:hover .variable-item-contents,.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).out-of-stock:hover img,.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).out-of-stock:hover span,.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).out-of-stock img,.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).out-of-stock span{opacity:.3}.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).out-of-stock,.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).out-of-stock:hover{overflow:visible;pointer-events:auto;cursor:pointer}.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).out-of-stock .variable-item-contents,.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).out-of-stock:hover .variable-item-contents,.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).out-of-stock:hover img,.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).out-of-stock:hover span,.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).out-of-stock img,.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .variable-item:not(.radio-variable-item).out-of-stock span{opacity:.6}.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .radio-variable-item.disabled,.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .radio-variable-item.disabled:hover{overflow:hidden}.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .radio-variable-item.disabled:hover input,.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .radio-variable-item.disabled:hover label,.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .radio-variable-item.disabled input,.woo-variation-swatches.wvs-attr-behavior-blur-no-cross .radio-variable-item.disabled label{pointer-events:none;opacity:.3}.woo-variation-swatches.wvs-attr-behavior-hide .variable-item.disabled{opacity:0;visibility:hidden;-webkit-transform:scale(0);transform:scale(0);-webkit-transform-origin:center;transform-origin:center;width:0!important;height:0!important;padding:0!important;margin:0!important;min-width:0!important;min-height:0!important}.woo-variation-swatches.wvs-attr-behavior-hide .variable-item.disabled.radio-variable-item{width:auto!important}.woo-variation-swatches.rtl .variable-items-wrapper .variable-item{text-align:right}.woo-variation-swatches.rtl .variable-items-wrapper .variable-item:not(.radio-variable-item){margin:4px 0 4px 8px}.woo-variation-swatches.rtl .variable-items-wrapper.radio-variable-wrapper .radio-variable-item input{margin-right:0;margin-left:5px}.woo-variation-swatches.woocommerce .product.elementor table.variations td.value:before{display:none!important}.woo-variation-swatches.woo-variation-swatches-ie11 .variable-items-wrapper{display:block!important}.woo-variation-swatches.woo-variation-swatches-ie11 .variable-items-wrapper .variable-item:not(.radio-variable-item){float:left}.woo-variation-swatches.wvs-show-label .variations td{display:block;width:auto!important}.woo-variation-swatches.wvs-show-label .variations td .woo-selected-variation-item-name,.woo-variation-swatches.wvs-show-label .variations td label{display:inline-block;margin:0 2px}
|
1 |
+
:root{--wvs-cross:url('data:image/svg+xml;utf8,%3Csvg filter="drop-shadow(0px 0px 5px rgb(255 255 255 / .6))" xmlns="http://www.w3.org/2000/svg" width="72px" height="72px" viewBox="0 0 24 24"%3E%3Cpath fill="none" stroke="%23ff0000" stroke-linecap="round" stroke-width="0.6" d="M5 5L19 19M19 5L5 19"/%3E%3C/svg%3E');--wvs-tick:url('data:image/svg+xml;utf8,%3Csvg filter="drop-shadow(0px 0px 2px rgb(0 0 0 / .8))" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30"%3E%3Cpath fill="none" stroke="%23ffffff" stroke-linecap="round" stroke-linejoin="round" stroke-width="4" d="M4 16L11 23 27 7"/%3E%3C/svg%3E')}.woo-variation-swatches.wvs-tooltip .radio-variable-item[data-wvstooltip]{position:relative}.woo-variation-swatches.wvs-tooltip .radio-variable-item[data-wvstooltip]:after,.woo-variation-swatches.wvs-tooltip .radio-variable-item[data-wvstooltip]:before{left:8px;bottom:100%}.woo-variation-swatches.wvs-tooltip .radio-variable-item .image-tooltip-wrapper{-webkit-transform:translateX(-50%);-ms-transform:translateX(-50%);transform:translateX(-50%);left:8px}.woo-variation-swatches.wvs-tooltip.wvs-archive-align-center .wvs-archive-variation-wrapper .radio-variable-item[data-wvstooltip]:after,.woo-variation-swatches.wvs-tooltip.wvs-archive-align-center .wvs-archive-variation-wrapper .radio-variable-item[data-wvstooltip]:before{left:50%}.woo-variation-swatches.wvs-tooltip.wvs-archive-align-center .wvs-archive-variation-wrapper .radio-variable-item .image-tooltip-wrapper{-webkit-transform:translateX(-50%);-ms-transform:translateX(-50%);transform:translateX(-50%);left:50%}.woo-variation-swatches.wvs-tooltip.wvs-archive-align-right .wvs-archive-variation-wrapper .radio-variable-item[data-wvstooltip]:after,.woo-variation-swatches.wvs-tooltip.wvs-archive-align-right .wvs-archive-variation-wrapper .radio-variable-item[data-wvstooltip]:before{left:100%}.woo-variation-swatches.wvs-tooltip.wvs-archive-align-right .wvs-archive-variation-wrapper .radio-variable-item .image-tooltip-wrapper{-webkit-transform:translateX(-50%);-ms-transform:translateX(-50%);transform:translateX(-50%);left:100%}.wvs-has-image-tooltip,[data-wvstooltip]{position:relative;cursor:pointer;outline:none}.wvs-has-image-tooltip:after,.wvs-has-image-tooltip:before,[data-wvstooltip]:after,[data-wvstooltip]:before{visibility:hidden;opacity:0;pointer-events:none;-webkit-box-sizing:inherit;box-sizing:inherit;position:absolute;bottom:130%;left:50%;z-index:999;-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-box-shadow:0 7px 15px rgba(0,0,0,.3);box-shadow:0 7px 15px rgba(0,0,0,.3);-webkit-transition:opacity .5s ease-in-out;-o-transition:opacity .5s ease-in-out;transition:opacity .5s ease-in-out}.wvs-has-image-tooltip:before,[data-wvstooltip]:before{margin-bottom:5px;-webkit-transform:translateX(-50%);-ms-transform:translateX(-50%);transform:translateX(-50%);padding:7px;border-radius:3px;background-color:var(--wvs-tooltip-background-color,#333);color:var(--wvs-tooltip-text-color,#fff);text-align:center;font-size:14px;line-height:1.2}[data-wvstooltip]:before{min-width:100px;content:attr(data-wvstooltip) " " attr(data-wvstooltip-out-of-stock)}.wvs-has-image-tooltip:before{content:attr(data-title);background-image:var(--tooltip-background);background-repeat:no-repeat;width:var(--tooltip-width);height:calc(var(--tooltip-height) + 20px);background-size:contain;background-position:top;padding:0;line-height:20px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end;-ms-flex-line-pack:center;align-content:center;font-size:12px;-webkit-backface-visibility:hidden;backface-visibility:hidden}.wvs-has-image-tooltip:after,[data-wvstooltip]:after{margin-left:-5px;width:0;border-top:5px solid var(--wvs-tooltip-background-color,#333);border-right:5px solid transparent;border-left:5px solid transparent;content:" ";font-size:0;line-height:0}.wvs-has-image-tooltip:hover:after,.wvs-has-image-tooltip:hover:before,[data-wvstooltip]:hover:after,[data-wvstooltip]:hover:before{bottom:120%;visibility:visible;opacity:1}.wvs-theme-child-sober .product form.cart .variations .variable,.wvs-theme-sober .product form.cart .variations .variable{margin-bottom:15px!important}.wvs-theme-child-sober .product form.cart .variations .variable-options,.wvs-theme-sober .product form.cart .variations .variable-options{border:0!important}.wvs-theme-child-sober .product form.cart .variations .arrow,.wvs-theme-child-sober .product form.cart .variations .variable-options:after,.wvs-theme-sober .product form.cart .variations .arrow,.wvs-theme-sober .product form.cart .variations .variable-options:after{display:none}.wvs-theme-child-sober .product form.cart .variations .label,.wvs-theme-sober .product form.cart .variations .label{display:block;text-align:right;margin-right:10px}.wvs-theme-child-sober .product form.cart .variations .value,.wvs-theme-sober .product form.cart .variations .value{-webkit-box-flex:unset;-ms-flex-positive:unset;flex-grow:unset}.wvs-theme-child-sober .product form.cart .variations select,.wvs-theme-sober .product form.cart .variations select{border:1px solid #e4e6eb!important;padding:.5em 1em!important;text-align:left!important;-moz-text-align-last:left!important;text-align-last:left!important;-webkit-appearance:menulist-button!important}.wvs-theme-child-sober .product form.cart .radio-variable-item,.wvs-theme-sober .product form.cart .radio-variable-item{margin:5px;text-align:left}.wvs-theme-child-sober .product form.cart .radio-variable-item:last-child,.wvs-theme-sober .product form.cart .radio-variable-item:last-child{margin-right:0}.wvs-theme-child-sober .product form.cart .radio-variable-item label,.wvs-theme-sober .product form.cart .radio-variable-item label{padding-left:30px;margin:0}.wvs-theme-child-sober .product form.cart .radio-variable-item label:before,.wvs-theme-sober .product form.cart .radio-variable-item label:before{top:0;border-radius:100%}.wvs-theme-child-sober .product form.cart .radio-variable-item label:after,.wvs-theme-sober .product form.cart .radio-variable-item label:after{top:8px}.wvs-theme-shophistic-lite.woocommerce #main .entry-summary .variations{display:block!important}.wvs-theme-shophistic-lite .ql_custom_variations{display:none!important}.wvs-theme-shophistic-lite .radio-variable-item input[type=radio]{display:inline-block;margin:0}.wvs-theme-flatsome .variations .reset_variations{position:relative;bottom:0;left:0}.wvs-theme-child-storefront.single-product div.product,.wvs-theme-storefront.single-product div.product{overflow:visible!important}.wvs-theme-stockholm .variations .reset_variations{position:relative;bottom:0;left:0;-webkit-transform:none;-ms-transform:none;transform:none}.wvs-theme-kalium-child .image-variable-item img,.wvs-theme-kalium .image-variable-item img{width:100%!important}.wvs-theme-kalium-child .radio-variable-item input,.wvs-theme-kalium .radio-variable-item input{width:16px!important;height:16px!important}.wvs-theme-kalium-child .woo-variation-items-wrapper .select-option-ui,.wvs-theme-kalium .woo-variation-items-wrapper .select-option-ui{display:none}.wvs-theme-aurum .variable-items-wrapper .image-variable-item>img,.wvs-theme-child-aurum .variable-items-wrapper .image-variable-item>img{width:100%}.wvs-theme-hestia .woo-variation-items-wrapper.value:before{display:none!important}.wvs-theme-child-thegem .woo-variation-items-wrapper .combobox-wrapper,.wvs-theme-thegem-elementor .woo-variation-items-wrapper .combobox-wrapper,.wvs-theme-thegem .woo-variation-items-wrapper .combobox-wrapper{display:none}.wvs-theme-child-thegem .wvs-archive-variation-wrapper .variations,.wvs-theme-thegem-elementor .wvs-archive-variation-wrapper .variations,.wvs-theme-thegem .wvs-archive-variation-wrapper .variations{padding:0}.wvs-theme-child-ushop .variations_form,.wvs-theme-ushop .variations_form{overflow:visible!important}.wvs-theme-child-ushop .single-product-summary .product_meta,.wvs-theme-ushop .single-product-summary .product_meta{display:inline-table}.wvs-theme-child-savoy .woo-variation-items-wrapper,.wvs-theme-savoy .woo-variation-items-wrapper{position:relative!important}.wvs-theme-child-savoy .woo-variation-items-wrapper .sod_select,.wvs-theme-savoy .woo-variation-items-wrapper .sod_select{display:none!important}.wvs-theme-child-savoy .nm-variation-row,.wvs-theme-savoy .nm-variation-row{display:-webkit-box;display:-ms-flexbox;display:flex}.wvs-theme-child-woodstock .woo-variation-items-wrapper .variation-select,.wvs-theme-woodstock .woo-variation-items-wrapper .variation-select{display:none!important}.wvs-theme-child-woodmart .wd-attr-selected,.wvs-theme-child-woodmart .woo-variation-items-wrapper>.swatches-select,.wvs-theme-woodmart .wd-attr-selected,.wvs-theme-woodmart .woo-variation-items-wrapper>.swatches-select{display:none}.wvs-theme-gecko-child .variations .value.woo-variation-items-wrapper,.wvs-theme-gecko .variations .value.woo-variation-items-wrapper{border:0!important}.wvs-theme-gecko-child .variations .value.woo-variation-items-wrapper:after,.wvs-theme-gecko .variations .value.woo-variation-items-wrapper:after{display:none!important}.woo-variation-gallery-theme-child-massive-dynamic .woo-variation-items-wrapper .clear-selection,.woo-variation-gallery-theme-massive-dynamic .woo-variation-items-wrapper .clear-selection{border:0;height:auto;width:auto}.woo-variation-gallery-theme-child-massive-dynamic .woo-variation-items-wrapper .clear-selection .reset_variations,.woo-variation-gallery-theme-massive-dynamic .woo-variation-items-wrapper .clear-selection .reset_variations{font-size:8px!important;width:20px;height:20px;padding:5px;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:100%;border:1px solid #f04040;color:#f04040}.wvs-theme-child-claue .woo-variation-items-wrapper,.wvs-theme-claue .woo-variation-items-wrapper{border:none}.wvs-theme-child-claue .woo-variation-items-wrapper:after,.wvs-theme-claue .woo-variation-items-wrapper:after{display:none}.wvs-theme-child-jupiter table.variations,.wvs-theme-jupiter table.variations{overflow:initial}.wvs-theme-child-oxygen .woo-variation-items-wrapper .select-wrapper,.wvs-theme-oxygen .woo-variation-items-wrapper .select-wrapper{display:none}.wvs-theme-child-oxygen .variable-items-wrapper.radio-variable-wrapper .radio-variable-item input,.wvs-theme-oxygen .variable-items-wrapper.radio-variable-wrapper .radio-variable-item input{width:18px}.wvs-theme-child-simple-elegant .woo-variation-items-wrapper .wi-nice-select,.wvs-theme-simple-elegant .woo-variation-items-wrapper .wi-nice-select{display:none}.wvs-theme-child-twentytwenty table.variations,.wvs-theme-twentytwenty table.variations{overflow:auto}.wvs-theme-child-divi .et_pb_wc_add_to_cart form.variations_form.cart .variations td.value span:after,.wvs-theme-child-jevelin .sh-woo-layout table.variations td select.woo-variation-raw-select,.wvs-theme-divi .et_pb_wc_add_to_cart form.variations_form.cart .variations td.value span:after,.wvs-theme-jevelin .sh-woo-layout table.variations td select.woo-variation-raw-select{display:none!important}.wvs-theme-child-jevelin .sh-woo-layout table.variations,.wvs-theme-jevelin .sh-woo-layout table.variations{max-width:100%}.wvs-theme-child-jevelin .radio-variable-item label,.wvs-theme-jevelin .radio-variable-item label{line-height:1!important}.woo-variation-swatches .woo-variation-raw-select+.select2,.wvs-theme-child-stockie .woo-variation-raw-select+.select-styled,.wvs-theme-stockie .woo-variation-raw-select+.select-styled{display:none!important}.woo-variation-swatches .wvs-widget-layered-nav-list__item-color>a{display:inline-block;position:relative}.woo-variation-swatches .wvs-widget-layered-nav-list__item-color>a .wvs-widget-item-wrapper{display:inline-block}.woo-variation-swatches .wvs-widget-layered-nav-list__item-color .item{display:inline-block;float:left;padding:9px;margin:0 4px;-webkit-box-shadow:0 0 0 1px rgba(0,0,0,.5);box-shadow:0 0 0 1px rgba(0,0,0,.5);height:20px;width:20px}.woo-variation-swatches .wvs-widget-layered-nav-list__item-color .text{display:inline-block}.woo-variation-swatches .wvs-widget-layered-nav-list__item-color .text :after{content:"";display:inline;clear:both}.woo-variation-swatches .wvs-widget-layered-nav-list__item-color.woocommerce-widget-layered-nav-list__item--chosen .item{-webkit-box-shadow:0 0 0 1px rgba(0,0,0,.9);box-shadow:0 0 0 1px rgba(0,0,0,.9)}.woo-variation-swatches .variations td.value>span:after,.woo-variation-swatches .variations td.value>span:before,.woo-variation-swatches .woo-variation-raw-select,.woo-variation-swatches .woo-variation-raw-select:after,.woo-variation-swatches .woo-variation-raw-select:before{display:none!important}.woo-variation-swatches .woo-variation-swatches-variable-item-more{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex}.woo-variation-swatches .wvs-archive-variations-wrapper{display:block;width:100%}.woo-variation-swatches .wvs-archive-variations-wrapper .variable-items-wrapper .variable-item:not(.radio-variable-item){width:var(--wvs-archive-product-item-width,30px);height:var(--wvs-archive-product-item-height,30px)}.woo-variation-swatches .wvs-archive-variations-wrapper .variable-items-wrapper .variable-item:not(.radio-variable-item).button-variable-item{font-size:var(--wvs-archive-product-item-font-size,16px);min-width:var(--wvs-archive-product-item-width,30px)!important}.woo-variation-swatches ul.variations{list-style:none;margin:0;padding:0;-webkit-box-orient:vertical;-ms-flex-direction:column;flex-direction:column}.woo-variation-swatches ul.variations,.woo-variation-swatches ul.variations>li{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-direction:normal}.woo-variation-swatches ul.variations>li{-webkit-box-pack:var(--wvs-position);-ms-flex-pack:var(--wvs-position);justify-content:var(--wvs-position);-webkit-box-orient:horizontal;-ms-flex-direction:row;flex-direction:row;margin:5px 0}.woo-variation-swatches ul.variations .wvs_archive_reset_variations.hide{visibility:hidden}.woo-variation-swatches ul.variations .wvs_archive_reset_variations.show{visibility:visible}.woo-variation-swatches .variable-items-wrapper{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;margin:0 5px;padding:0;list-style:none}.woo-variation-swatches .variable-items-wrapper.enabled-large-size .variable-item:not(.radio-variable-item){width:var(--wvs-single-product-large-item-width,40px);height:var(--wvs-single-product-large-item-height,40px)}.woo-variation-swatches .variable-items-wrapper.enabled-large-size .variable-item:not(.radio-variable-item).button-variable-item{font-size:var(--wvs-single-product-large-item-font-size,16px)}.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start}.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item{-webkit-box-sizing:border-box;box-sizing:border-box;display:block;list-style:none;cursor:pointer;padding:0 5px}.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item input,.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item label{cursor:pointer;vertical-align:middle}.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item input{margin:5px;width:20px;height:20px}.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item .variable-item-radio-value-wrapper{display:inline-block}.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item .variable-item-radio-value-wrapper img{width:40px;display:inline-block;margin:0;padding:0;vertical-align:middle}.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item .variable-item-radio-value-wrapper .out-of-stock{display:inline-block;margin:0;padding:0}.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item label{width:auto;display:inline-block;padding:2px 0}.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.disabled,.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.disabled:hover{-webkit-box-shadow:none;box-shadow:none}.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.disabled:hover input,.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.disabled:hover label,.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.disabled input,.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.disabled label{cursor:not-allowed;opacity:.5}.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.disabled .variable-item-radio-value,.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.disabled:hover .variable-item-radio-value{text-decoration:line-through}.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.disabled:after,.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.disabled:before,.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.disabled:hover:after,.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.disabled:hover:before{display:none}.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.disabled:focus,.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.disabled:hover:focus{-webkit-box-shadow:none;box-shadow:none}.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.no-stock:hover input,.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.no-stock:hover label,.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.no-stock input,.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.no-stock label{text-decoration:line-through;opacity:.6}.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.no-stock .variable-item-radio-value,.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.no-stock:hover .variable-item-radio-value{text-decoration:line-through}.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item:hover{-webkit-box-shadow:0 0 0 3px rgba(0,0,0,.1);box-shadow:0 0 0 3px rgba(0,0,0,.1)}.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item:focus{-webkit-box-shadow:0 0 0 3px rgba(0,0,0,.3);box-shadow:0 0 0 3px rgba(0,0,0,.3)}.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.selected,.woo-variation-swatches .variable-items-wrapper.radio-variable-items-wrapper .radio-variable-item.selected:hover{-webkit-box-shadow:0 0 0 2px rgba(0,0,0,.9);box-shadow:0 0 0 2px rgba(0,0,0,.9)}.woo-variation-swatches .variable-items-wrapper .variable-item{margin:0;padding:0;list-style:none;-webkit-transition:all .2s ease;-o-transition:all .2s ease;transition:all .2s ease;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;outline:none}.woo-variation-swatches .variable-items-wrapper .variable-item .variable-item-contents{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;position:relative;width:100%;height:100%}.woo-variation-swatches .variable-items-wrapper .variable-item.variation-disabled{display:none!important}.woo-variation-swatches .variable-items-wrapper .variable-item img{margin:0;padding:0;width:100%;height:100%;pointer-events:none}.woo-variation-swatches .variable-items-wrapper .variable-item>span{pointer-events:none}.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item){-webkit-box-sizing:border-box;box-sizing:border-box;cursor:pointer;display:-webkit-box;display:-ms-flexbox;display:flex;position:relative;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-color:var(--wvs-item-background-color,#fff);color:var(--wvs-item-text-color,#000);-webkit-box-shadow:var(--wvs-item-box-shadow,0 0 0 1px #a8a8a8);box-shadow:var(--wvs-item-box-shadow,0 0 0 1px #a8a8a8);padding:2px;margin:4px;width:var(--wvs-single-product-item-width,30px);height:var(--wvs-single-product-item-height,30px)}.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item):first-child{margin-left:0}.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item):last-child{margin-right:0}.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).no-stock .variable-item-contents,.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).no-stock img,.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).no-stock span{opacity:.6}.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).no-stock .variable-item-contents:before{position:absolute;content:" ";display:block;background-image:var(--wvs-cross);background-repeat:no-repeat;background-position:50%;height:100%;width:100%}.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item):hover{background-color:var(--wvs-hover-item-background-color,#fff);color:var(--wvs-hover-item-text-color,#000)}.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item):focus,.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item):hover{-webkit-box-shadow:var(--wvs-hover-item-box-shadow,0 0 0 3px #ddd);box-shadow:var(--wvs-hover-item-box-shadow,0 0 0 3px #ddd)}.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).selected,.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).selected:hover{-webkit-box-shadow:var(--wvs-selected-item-box-shadow,0 0 0 2px #000);box-shadow:var(--wvs-selected-item-box-shadow,0 0 0 2px #000);color:var(--wvs-selected-item-text-color,#000)}.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).disabled,.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).disabled:hover{pointer-events:none;cursor:not-allowed;position:relative;overflow:hidden}.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).disabled .variable-item-contents,.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).disabled:hover .variable-item-contents,.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).disabled:hover img,.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).disabled:hover span,.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).disabled img,.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).disabled span{opacity:.6}.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).disabled .variable-item-contents:before,.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).disabled:hover .variable-item-contents:before{position:absolute;content:" ";display:block;background-image:var(--wvs-cross);background-repeat:no-repeat;background-position:50%;height:100%;width:100%}.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).color-variable-item.selected:not(.no-stock) .variable-item-contents:before,.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).image-variable-item.selected:not(.no-stock) .variable-item-contents:before{position:absolute;content:" ";display:block;background-image:var(--wvs-tick);background-repeat:no-repeat;background-position:50%;background-size:60%;height:100%;width:100%}.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).color-variable-item .variable-item-span-color,.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).image-variable-item .variable-item-span-color{width:100%;height:100%;display:block}.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).button-variable-item{text-align:center;font-size:var(--wvs-single-product-item-font-size,16px)}.woo-variation-swatches .variable-items-wrapper .variable-item:not(.radio-variable-item).button-variable-item.selected:not(.no-stock){background-color:var(--wvs-selected-item-text-color,#000);color:var(--wvs-selected-item-background-color,#fff)}.woo-variation-swatches .variable-items-wrapper .variable-item.wvs-show-stock-left-info:not(.disabled):not(.radio-variable-item) .wvs-stock-left-info:before{content:" ";position:absolute;top:calc(100% - 1px);left:50%;margin-left:-3px;width:0;border-bottom:3px solid #de8604;border-right:3px solid transparent;border-left:3px solid transparent;z-index:1}.woo-variation-swatches .variable-items-wrapper .variable-item.wvs-show-stock-left-info:not(.disabled):not(.radio-variable-item) .wvs-stock-left-info:after{position:absolute;left:50%;-webkit-transform:translateX(-50%);-ms-transform:translateX(-50%);transform:translateX(-50%);top:calc(100% + 2px);min-width:36px;text-align:center}.woo-variation-swatches .variable-items-wrapper .variable-item.wvs-show-stock-left-info:not(.disabled) .wvs-stock-left-info:after{content:attr(data-wvs-stock-info);line-height:1;font-size:10px;font-style:italic;background:#de8604;color:#fff;padding:2px;border-radius:2px!important;text-shadow:0 1px rgba(0,0,0,.25098039215686274);-webkit-box-shadow:0 0 2px rgba(0,0,0,.3803921568627451);box-shadow:0 0 2px rgba(0,0,0,.3803921568627451)}.woo-variation-swatches .variable-items-wrapper .variable-item.wvs-show-stock-left-info:not(.disabled).radio-variable-item .wvs-stock-left-info:after{margin-left:5px}.woo-variation-swatches .wvs-style-rounded.variable-items-wrapper .variable-item:not(.radio-variable-item){border-radius:100%}.woo-variation-swatches .wvs-style-rounded.variable-items-wrapper .variable-item:not(.radio-variable-item) .variable-item-span,.woo-variation-swatches .wvs-style-rounded.variable-items-wrapper .variable-item:not(.radio-variable-item) img{border-radius:100%;overflow:hidden;line-height:1;margin:0}.woo-variation-swatches .wvs-style-rounded.variable-items-wrapper .variable-item.radio-variable-item{border-radius:2px}.woo-variation-swatches .wvs-style-rounded.variable-items-wrapper .variable-item.radio-variable-item img{border-radius:100%}.woo-variation-swatches .wvs-style-squared.variable-items-wrapper .variable-item:not(.radio-variable-item){border-radius:2px}.woo-variation-swatches .wvs-style-squared.variable-items-wrapper .variable-item:not(.radio-variable-item).button-variable-item{width:auto;min-width:var(--wvs-single-product-item-width)}.woo-variation-swatches .wvs-style-squared.variable-items-wrapper .variable-item:not(.radio-variable-item).button-variable-item .variable-item-span{padding:0 5px}.woo-variation-swatches .wvs-style-squared.variable-items-wrapper .variable-item:not(.radio-variable-item).color-variable-item span:after{border-radius:0}.woo-variation-swatches .wvs-style-squared.variable-items-wrapper .variable-item.radio-variable-item{border-radius:2px}.woo-variation-swatches .wvs-style-squared.variable-items-wrapper .variable-item.radio-variable-item img{border-radius:5px}.woo-variation-swatches.wvs-behavior-blur .variable-items-wrapper .radio-variable-item.disabled:hover input,.woo-variation-swatches.wvs-behavior-blur .variable-items-wrapper .radio-variable-item.disabled:hover label,.woo-variation-swatches.wvs-behavior-blur .variable-items-wrapper .radio-variable-item.disabled input,.woo-variation-swatches.wvs-behavior-blur .variable-items-wrapper .radio-variable-item.disabled label{cursor:not-allowed;text-decoration:line-through;opacity:.5}.woo-variation-swatches.wvs-behavior-blur .variable-items-wrapper .radio-variable-item.disabled:after,.woo-variation-swatches.wvs-behavior-blur .variable-items-wrapper .radio-variable-item.disabled:before,.woo-variation-swatches.wvs-behavior-blur .variable-items-wrapper .radio-variable-item.disabled:hover:after,.woo-variation-swatches.wvs-behavior-blur .variable-items-wrapper .radio-variable-item.disabled:hover:before{display:none}.woo-variation-swatches.wvs-behavior-blur-no-cross .variable-items-wrapper .variable-item:not(.radio-variable-item).disabled .variable-item-contents:before,.woo-variation-swatches.wvs-behavior-blur-no-cross .variable-items-wrapper .variable-item:not(.radio-variable-item).disabled:hover .variable-item-contents:before,.woo-variation-swatches.wvs-behavior-blur-no-cross .variable-items-wrapper .variable-item:not(.radio-variable-item).no-stock .variable-item-contents:before,.woo-variation-swatches.wvs-behavior-blur-no-cross .variable-items-wrapper .variable-item:not(.radio-variable-item).no-stock:hover .variable-item-contents:before{background-image:none}.woo-variation-swatches.wvs-behavior-blur-no-cross .variable-items-wrapper .radio-variable-item.disabled,.woo-variation-swatches.wvs-behavior-blur-no-cross .variable-items-wrapper .radio-variable-item.disabled:hover{overflow:hidden}.woo-variation-swatches.wvs-behavior-blur-no-cross .variable-items-wrapper .radio-variable-item.disabled:hover input,.woo-variation-swatches.wvs-behavior-blur-no-cross .variable-items-wrapper .radio-variable-item.disabled:hover label,.woo-variation-swatches.wvs-behavior-blur-no-cross .variable-items-wrapper .radio-variable-item.disabled input,.woo-variation-swatches.wvs-behavior-blur-no-cross .variable-items-wrapper .radio-variable-item.disabled label{pointer-events:none;opacity:.3}.woo-variation-swatches.wvs-behavior-hide .variable-items-wrapper .variable-item.disabled{opacity:0;visibility:hidden;-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0);-webkit-transform-origin:center;-ms-transform-origin:center;transform-origin:center;font-size:0;width:0!important;height:0!important;padding:0!important;margin:0!important;min-width:0!important;min-height:0!important}.woo-variation-swatches.wvs-behavior-hide .variable-items-wrapper .variable-item.disabled.radio-variable-item{width:auto!important}.woo-variation-swatches.wvs-behavior-hide .variable-items-wrapper .variable-item.no-stock .variable-item-contents:before{background-image:none}.woo-variation-swatches.rtl .variable-items-wrapper .variable-item{text-align:right}.woo-variation-swatches.rtl .variable-items-wrapper .variable-item:not(.radio-variable-item){margin:4px 0 4px 8px}.woo-variation-swatches.rtl .variable-items-wrapper.radio-variable-wrapper .radio-variable-item input{margin-right:0;margin-left:5px}.woo-variation-swatches.woocommerce .product.elementor table.variations td.value:before{display:none!important}.woo-variation-swatches.woo-variation-swatches-ie11 .variable-items-wrapper{display:block!important}.woo-variation-swatches.woo-variation-swatches-ie11 .variable-items-wrapper .variable-item:not(.radio-variable-item){float:left}.woo-variation-swatches.wvs-show-label .variations td,.woo-variation-swatches.wvs-show-label .variations th{display:block;width:auto!important}.woo-variation-swatches.wvs-show-label .variations td .woo-selected-variation-item-name,.woo-variation-swatches.wvs-show-label .variations td label,.woo-variation-swatches.wvs-show-label .variations th .woo-selected-variation-item-name,.woo-variation-swatches.wvs-show-label .variations th label{display:inline-block;margin:0 2px}.woo-variation-swatches .grouped-variable-items{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;list-style:none!important}.woo-variation-swatches .grouped-variable-items.grouped-variable-items-display-vertical{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.woo-variation-swatches .grouped-variable-items.grouped-variable-items-display-vertical .group-variable-items-wrapper{margin-top:10px}.woo-variation-swatches .grouped-variable-items.grouped-variable-items-display-vertical .no-group-variable-items-wrapper{margin-top:20px}.woo-variation-swatches .grouped-variable-items.grouped-variable-items-display-horizontal{-webkit-box-align:end;-ms-flex-align:end;align-items:flex-end}.woo-variation-swatches .grouped-variable-items.grouped-variable-items-display-horizontal .group-variable-items-wrapper{margin-top:10px;margin-right:20px}.woo-variation-swatches .grouped-variable-items.grouped-variable-items-display-horizontal .group-variable-items-wrapper:last-child,.woo-variation-swatches .grouped-variable-items.grouped-variable-items-display-horizontal .no-group-variable-items-wrapper{margin-right:0}.woo-variation-swatches .grouped-variable-items .group-variable-item-wrapper{display:-webkit-box;display:-ms-flexbox;display:flex;margin:0;-ms-flex-wrap:wrap;flex-wrap:wrap}.woo-variation-swatches .grouped-variable-items .group-variable-items-name{font-style:italic}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/css/gwp-admin-notice.css
DELETED
@@ -1,317 +0,0 @@
|
|
1 |
-
/*!
|
2 |
-
* Variation Swatches for WooCommerce v1.1.19
|
3 |
-
*
|
4 |
-
* Author: Emran Ahmed ( emran.bd.08@gmail.com )
|
5 |
-
* Date: 07/09/2021
|
6 |
-
* Released under the GPLv3 license.
|
7 |
-
*/
|
8 |
-
.gwp-live-feed-contents {
|
9 |
-
position: relative;
|
10 |
-
clear: both;
|
11 |
-
overflow: hidden;
|
12 |
-
}
|
13 |
-
|
14 |
-
.gwp-live-feed-contents.notice-info:before {
|
15 |
-
content: "\F161";
|
16 |
-
background: #72aee6;
|
17 |
-
}
|
18 |
-
|
19 |
-
.gwp-live-feed-contents.gwp-ad-gallery:before {
|
20 |
-
content: "\F161";
|
21 |
-
background: #72aee6;
|
22 |
-
}
|
23 |
-
|
24 |
-
.gwp-live-feed-contents.notice-success:before {
|
25 |
-
content: "\F147";
|
26 |
-
background: #46B450;
|
27 |
-
}
|
28 |
-
|
29 |
-
.gwp-live-feed-contents.notice-error:before {
|
30 |
-
content: "\F158";
|
31 |
-
background: #DC3232;
|
32 |
-
}
|
33 |
-
|
34 |
-
.gwp-live-feed-contents.notice-warning:before {
|
35 |
-
content: "\F534";
|
36 |
-
background: #F6BA33;
|
37 |
-
}
|
38 |
-
|
39 |
-
.gwp-live-feed-contents.gwp-notice-required:before {
|
40 |
-
content: "\F463";
|
41 |
-
background: #CE3100;
|
42 |
-
text-shadow: 0 -1px 1px #CE3100;
|
43 |
-
}
|
44 |
-
|
45 |
-
.gwp-live-feed-contents.gwp-notice-recommended:before {
|
46 |
-
content: "\F529";
|
47 |
-
background: #3D4046;
|
48 |
-
text-shadow: 0 -1px 1px #3D4046;
|
49 |
-
}
|
50 |
-
|
51 |
-
.gwp-live-feed-contents.notice-info,
|
52 |
-
.gwp-live-feed-contents.notice-success,
|
53 |
-
.gwp-live-feed-contents.notice-error,
|
54 |
-
.gwp-live-feed-contents.notice-warning,
|
55 |
-
.gwp-live-feed-contents.gwp-notice-required,
|
56 |
-
.gwp-live-feed-contents.gwp-notice-recommended,
|
57 |
-
.gwp-live-feed-contents.gwp-ad-gallery {
|
58 |
-
display: flex;
|
59 |
-
align-items: stretch;
|
60 |
-
padding: 0;
|
61 |
-
border-radius: 4px;
|
62 |
-
}
|
63 |
-
|
64 |
-
.gwp-live-feed-contents.notice-info:before,
|
65 |
-
.gwp-live-feed-contents.notice-success:before,
|
66 |
-
.gwp-live-feed-contents.notice-error:before,
|
67 |
-
.gwp-live-feed-contents.notice-warning:before,
|
68 |
-
.gwp-live-feed-contents.gwp-notice-required:before,
|
69 |
-
.gwp-live-feed-contents.gwp-notice-recommended:before,
|
70 |
-
.gwp-live-feed-contents.gwp-ad-gallery:before {
|
71 |
-
font-family: dashicons;
|
72 |
-
font-size: 20px;
|
73 |
-
color: #FFFFFF;
|
74 |
-
padding: 10px;
|
75 |
-
display: flex;
|
76 |
-
align-items: center;
|
77 |
-
}
|
78 |
-
|
79 |
-
.gwp-live-feed-contents.notice-info .feed-message-wrapper,
|
80 |
-
.gwp-live-feed-contents.notice-success .feed-message-wrapper,
|
81 |
-
.gwp-live-feed-contents.notice-error .feed-message-wrapper,
|
82 |
-
.gwp-live-feed-contents.notice-warning .feed-message-wrapper,
|
83 |
-
.gwp-live-feed-contents.gwp-notice-required .feed-message-wrapper,
|
84 |
-
.gwp-live-feed-contents.gwp-notice-recommended .feed-message-wrapper,
|
85 |
-
.gwp-live-feed-contents.gwp-ad-gallery .feed-message-wrapper {
|
86 |
-
padding: 10px 60px 10px 20px;
|
87 |
-
}
|
88 |
-
|
89 |
-
.gwp-live-feed-contents.gwp-notice-discount {
|
90 |
-
border-radius: 5px;
|
91 |
-
border: 0;
|
92 |
-
display: flex;
|
93 |
-
align-items: center;
|
94 |
-
padding: 0;
|
95 |
-
max-width: 750px;
|
96 |
-
margin-left: auto;
|
97 |
-
margin-right: auto;
|
98 |
-
background: #594679;
|
99 |
-
}
|
100 |
-
|
101 |
-
.gwp-live-feed-contents.gwp-notice-discount .feed-thumbnail-wrapper .attachment-thumbnail {
|
102 |
-
display: block;
|
103 |
-
}
|
104 |
-
|
105 |
-
.gwp-live-feed-contents.gwp-notice-discount .feed-message-wrapper {
|
106 |
-
display: flex;
|
107 |
-
justify-content: space-between;
|
108 |
-
align-items: center;
|
109 |
-
width: 100%;
|
110 |
-
color: #FFFFFF;
|
111 |
-
text-shadow: 0 -1px 1px #594679;
|
112 |
-
padding: 20px 30px 20px 20px;
|
113 |
-
}
|
114 |
-
|
115 |
-
.gwp-live-feed-contents.gwp-notice-discount .feed-message-wrapper p {
|
116 |
-
font-size: 14px;
|
117 |
-
margin: 0;
|
118 |
-
padding: 0;
|
119 |
-
}
|
120 |
-
|
121 |
-
.gwp-live-feed-contents.gwp-notice-discount .feed-message-wrapper span.big {
|
122 |
-
font-weight: 400;
|
123 |
-
font-size: 18px;
|
124 |
-
}
|
125 |
-
|
126 |
-
.gwp-live-feed-contents.gwp-notice-discount .feed-message-wrapper strong {
|
127 |
-
font-weight: 800;
|
128 |
-
}
|
129 |
-
|
130 |
-
.gwp-live-feed-contents.gwp-notice-discount .feed-message-wrapper .button-primary {
|
131 |
-
font-size: 16px;
|
132 |
-
border-radius: 30px;
|
133 |
-
padding: 0 25px;
|
134 |
-
border: 0;
|
135 |
-
height: 40px;
|
136 |
-
line-height: 40px;
|
137 |
-
}
|
138 |
-
|
139 |
-
.gwp-live-feed-contents.gwp-notice-discount .gwp-live-feed-close {
|
140 |
-
color: #FFFFFF;
|
141 |
-
opacity: .5;
|
142 |
-
font-size: 12px;
|
143 |
-
}
|
144 |
-
|
145 |
-
.gwp-live-feed-contents.gwp-notice-discount .gwp-live-feed-close:hover {
|
146 |
-
opacity: 1;
|
147 |
-
}
|
148 |
-
|
149 |
-
.gwp-live-feed-contents.gwp-notice-discount .gwp-live-feed-close:before {
|
150 |
-
color: #FFFFFF;
|
151 |
-
}
|
152 |
-
|
153 |
-
.gwp-live-feed-contents.gwp-notice-pro {
|
154 |
-
border-radius: 5px;
|
155 |
-
border: 0;
|
156 |
-
display: flex;
|
157 |
-
align-items: center;
|
158 |
-
padding: 0;
|
159 |
-
max-width: 750px;
|
160 |
-
margin-left: auto;
|
161 |
-
margin-right: auto;
|
162 |
-
background: #2196F3;
|
163 |
-
}
|
164 |
-
|
165 |
-
.gwp-live-feed-contents.gwp-notice-pro .feed-message-wrapper {
|
166 |
-
display: flex;
|
167 |
-
justify-content: space-between;
|
168 |
-
align-items: center;
|
169 |
-
width: 100%;
|
170 |
-
color: #FFFFFF;
|
171 |
-
text-shadow: 0 -1px 1px #2196F3;
|
172 |
-
padding: 20px;
|
173 |
-
}
|
174 |
-
|
175 |
-
.gwp-live-feed-contents.gwp-notice-pro .feed-message-wrapper p {
|
176 |
-
font-size: 14px;
|
177 |
-
margin: 0;
|
178 |
-
padding: 0;
|
179 |
-
}
|
180 |
-
|
181 |
-
.gwp-live-feed-contents.gwp-notice-pro .feed-message-wrapper span.big {
|
182 |
-
font-weight: 400;
|
183 |
-
font-size: 18px;
|
184 |
-
}
|
185 |
-
|
186 |
-
.gwp-live-feed-contents.gwp-notice-pro .feed-message-wrapper strong {
|
187 |
-
font-weight: 800;
|
188 |
-
}
|
189 |
-
|
190 |
-
.gwp-live-feed-contents.gwp-notice-pro .feed-message-wrapper .button-upgrade {
|
191 |
-
position: relative;
|
192 |
-
font-size: 16px;
|
193 |
-
color: #FFFFFF;
|
194 |
-
font-weight: 600;
|
195 |
-
text-decoration: none;
|
196 |
-
padding: 25px 25px 25px 80px;
|
197 |
-
display: block;
|
198 |
-
margin: -20px;
|
199 |
-
background: #673AB7;
|
200 |
-
text-shadow: 0 -1px 1px #673AB7;
|
201 |
-
}
|
202 |
-
|
203 |
-
.gwp-live-feed-contents.gwp-notice-pro .feed-message-wrapper .button-upgrade small {
|
204 |
-
font-weight: 300;
|
205 |
-
display: block;
|
206 |
-
}
|
207 |
-
|
208 |
-
.gwp-live-feed-contents.gwp-notice-pro .feed-message-wrapper .button-upgrade i {
|
209 |
-
position: absolute;
|
210 |
-
left: 25px;
|
211 |
-
font-size: 36px;
|
212 |
-
top: 50%;
|
213 |
-
-webkit-transform: translateY(-50%);
|
214 |
-
transform: translateY(-50%);
|
215 |
-
width: 36px;
|
216 |
-
height: 36px;
|
217 |
-
}
|
218 |
-
|
219 |
-
.gwp-live-feed-contents.gwp-notice-pro .feed-message-wrapper .button-upgrade:hover {
|
220 |
-
background: #305AF3;
|
221 |
-
text-shadow: 0 -1px 1px #305AF3;
|
222 |
-
}
|
223 |
-
|
224 |
-
.gwp-live-feed-contents.gwp-notice-pro .gwp-live-feed-close {
|
225 |
-
color: #FFFFFF;
|
226 |
-
opacity: .5;
|
227 |
-
font-size: 12px;
|
228 |
-
z-index: 1;
|
229 |
-
}
|
230 |
-
|
231 |
-
.gwp-live-feed-contents.gwp-notice-pro .gwp-live-feed-close:hover {
|
232 |
-
opacity: 1;
|
233 |
-
}
|
234 |
-
|
235 |
-
.gwp-live-feed-contents.gwp-notice-pro .gwp-live-feed-close:before {
|
236 |
-
color: #FFFFFF;
|
237 |
-
}
|
238 |
-
|
239 |
-
.gwp-live-feed-contents.gwp-notice-new {
|
240 |
-
border: 0;
|
241 |
-
padding: 0;
|
242 |
-
max-width: 750px;
|
243 |
-
margin-left: auto;
|
244 |
-
margin-right: auto;
|
245 |
-
background: transparent;
|
246 |
-
box-shadow: none;
|
247 |
-
}
|
248 |
-
|
249 |
-
.gwp-live-feed-contents.gwp-notice-new .feed-message-wrapper {
|
250 |
-
padding: 0;
|
251 |
-
margin: 0;
|
252 |
-
}
|
253 |
-
|
254 |
-
.gwp-live-feed-contents.gwp-notice-new .feed-message-wrapper p {
|
255 |
-
margin: 0;
|
256 |
-
padding: 0;
|
257 |
-
}
|
258 |
-
|
259 |
-
.gwp-live-feed-contents.gwp-notice-new .feed-message-wrapper img {
|
260 |
-
padding: 0;
|
261 |
-
margin: 0;
|
262 |
-
}
|
263 |
-
|
264 |
-
.gwp-live-feed-contents.gwp-notice-new .gwp-live-feed-close {
|
265 |
-
color: rgba(0, 0, 0, 0.5);
|
266 |
-
opacity: .5;
|
267 |
-
font-size: 12px;
|
268 |
-
}
|
269 |
-
|
270 |
-
.gwp-live-feed-contents.gwp-notice-new .gwp-live-feed-close:hover {
|
271 |
-
opacity: 1;
|
272 |
-
}
|
273 |
-
|
274 |
-
.gwp-live-feed-contents.gwp-notice-new .gwp-live-feed-close:before {
|
275 |
-
color: rgba(0, 0, 0, 0.5);
|
276 |
-
}
|
277 |
-
|
278 |
-
.gwp-live-feed-contents .button-primary {
|
279 |
-
background: #56BFD4;
|
280 |
-
border-color: #3A9DB1;
|
281 |
-
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
|
282 |
-
text-shadow: 0 -1px 1px #238EA5;
|
283 |
-
}
|
284 |
-
|
285 |
-
.gwp-live-feed-contents .button-primary:hover,
|
286 |
-
.gwp-live-feed-contents .button-primary:active,
|
287 |
-
.gwp-live-feed-contents .button-primary:focus {
|
288 |
-
background: #39B1CA;
|
289 |
-
border-color: #3A9DB1;
|
290 |
-
}
|
291 |
-
|
292 |
-
.gwp-live-feed-contents .gwp-live-feed-close {
|
293 |
-
display: flex;
|
294 |
-
right: 0;
|
295 |
-
text-decoration: none;
|
296 |
-
padding: 10px 10px 10px 25px;
|
297 |
-
}
|
298 |
-
|
299 |
-
.gwp-live-feed-contents .gwp-live-feed-close:before {
|
300 |
-
display: inline-block;
|
301 |
-
}
|
302 |
-
|
303 |
-
.gwp-live-feed-contents .gwp-live-feed-close-plain {
|
304 |
-
display: flex;
|
305 |
-
right: 0;
|
306 |
-
text-decoration: none;
|
307 |
-
padding: 15px;
|
308 |
-
}
|
309 |
-
|
310 |
-
.gwp-live-feed-contents .gwp-live-feed-close-plain:before {
|
311 |
-
display: inline-block;
|
312 |
-
}
|
313 |
-
|
314 |
-
.wp-admin.rtl .gwp-live-feed-contents .gwp-live-feed-close-plain {
|
315 |
-
left: 0;
|
316 |
-
right: auto;
|
317 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/css/gwp-admin-notice.min.css
DELETED
@@ -1,8 +0,0 @@
|
|
1 |
-
/*!
|
2 |
-
* Variation Swatches for WooCommerce v1.1.19
|
3 |
-
*
|
4 |
-
* Author: Emran Ahmed ( emran.bd.08@gmail.com )
|
5 |
-
* Date: 07/09/2021
|
6 |
-
* Released under the GPLv3 license.
|
7 |
-
*/
|
8 |
-
.gwp-live-feed-contents{position:relative;clear:both;overflow:hidden}.gwp-live-feed-contents.gwp-ad-gallery:before,.gwp-live-feed-contents.notice-info:before{content:"\F161";background:#72aee6}.gwp-live-feed-contents.notice-success:before{content:"\F147";background:#46b450}.gwp-live-feed-contents.notice-error:before{content:"\F158";background:#dc3232}.gwp-live-feed-contents.notice-warning:before{content:"\F534";background:#f6ba33}.gwp-live-feed-contents.gwp-notice-required:before{content:"\F463";background:#ce3100;text-shadow:0 -1px 1px #ce3100}.gwp-live-feed-contents.gwp-notice-recommended:before{content:"\F529";background:#3d4046;text-shadow:0 -1px 1px #3d4046}.gwp-live-feed-contents.gwp-ad-gallery,.gwp-live-feed-contents.gwp-notice-recommended,.gwp-live-feed-contents.gwp-notice-required,.gwp-live-feed-contents.notice-error,.gwp-live-feed-contents.notice-info,.gwp-live-feed-contents.notice-success,.gwp-live-feed-contents.notice-warning{display:flex;align-items:stretch;padding:0;border-radius:4px}.gwp-live-feed-contents.gwp-ad-gallery:before,.gwp-live-feed-contents.gwp-notice-recommended:before,.gwp-live-feed-contents.gwp-notice-required:before,.gwp-live-feed-contents.notice-error:before,.gwp-live-feed-contents.notice-info:before,.gwp-live-feed-contents.notice-success:before,.gwp-live-feed-contents.notice-warning:before{font-family:dashicons;font-size:20px;color:#fff;padding:10px;display:flex;align-items:center}.gwp-live-feed-contents.gwp-ad-gallery .feed-message-wrapper,.gwp-live-feed-contents.gwp-notice-recommended .feed-message-wrapper,.gwp-live-feed-contents.gwp-notice-required .feed-message-wrapper,.gwp-live-feed-contents.notice-error .feed-message-wrapper,.gwp-live-feed-contents.notice-info .feed-message-wrapper,.gwp-live-feed-contents.notice-success .feed-message-wrapper,.gwp-live-feed-contents.notice-warning .feed-message-wrapper{padding:10px 60px 10px 20px}.gwp-live-feed-contents.gwp-notice-discount{border-radius:5px;border:0;display:flex;align-items:center;padding:0;max-width:750px;margin-left:auto;margin-right:auto;background:#594679}.gwp-live-feed-contents.gwp-notice-discount .feed-thumbnail-wrapper .attachment-thumbnail{display:block}.gwp-live-feed-contents.gwp-notice-discount .feed-message-wrapper{display:flex;justify-content:space-between;align-items:center;width:100%;color:#fff;text-shadow:0 -1px 1px #594679;padding:20px 30px 20px 20px}.gwp-live-feed-contents.gwp-notice-discount .feed-message-wrapper p{font-size:14px;margin:0;padding:0}.gwp-live-feed-contents.gwp-notice-discount .feed-message-wrapper span.big{font-weight:400;font-size:18px}.gwp-live-feed-contents.gwp-notice-discount .feed-message-wrapper strong{font-weight:800}.gwp-live-feed-contents.gwp-notice-discount .feed-message-wrapper .button-primary{font-size:16px;border-radius:30px;padding:0 25px;border:0;height:40px;line-height:40px}.gwp-live-feed-contents.gwp-notice-discount .gwp-live-feed-close{color:#fff;opacity:.5;font-size:12px}.gwp-live-feed-contents.gwp-notice-discount .gwp-live-feed-close:hover{opacity:1}.gwp-live-feed-contents.gwp-notice-discount .gwp-live-feed-close:before{color:#fff}.gwp-live-feed-contents.gwp-notice-pro{border-radius:5px;border:0;display:flex;align-items:center;padding:0;max-width:750px;margin-left:auto;margin-right:auto;background:#2196f3}.gwp-live-feed-contents.gwp-notice-pro .feed-message-wrapper{display:flex;justify-content:space-between;align-items:center;width:100%;color:#fff;text-shadow:0 -1px 1px #2196f3;padding:20px}.gwp-live-feed-contents.gwp-notice-pro .feed-message-wrapper p{font-size:14px;margin:0;padding:0}.gwp-live-feed-contents.gwp-notice-pro .feed-message-wrapper span.big{font-weight:400;font-size:18px}.gwp-live-feed-contents.gwp-notice-pro .feed-message-wrapper strong{font-weight:800}.gwp-live-feed-contents.gwp-notice-pro .feed-message-wrapper .button-upgrade{position:relative;font-size:16px;color:#fff;font-weight:600;text-decoration:none;padding:25px 25px 25px 80px;display:block;margin:-20px;background:#673ab7;text-shadow:0 -1px 1px #673ab7}.gwp-live-feed-contents.gwp-notice-pro .feed-message-wrapper .button-upgrade small{font-weight:300;display:block}.gwp-live-feed-contents.gwp-notice-pro .feed-message-wrapper .button-upgrade i{position:absolute;left:25px;font-size:36px;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);width:36px;height:36px}.gwp-live-feed-contents.gwp-notice-pro .feed-message-wrapper .button-upgrade:hover{background:#305af3;text-shadow:0 -1px 1px #305af3}.gwp-live-feed-contents.gwp-notice-pro .gwp-live-feed-close{color:#fff;opacity:.5;font-size:12px;z-index:1}.gwp-live-feed-contents.gwp-notice-pro .gwp-live-feed-close:hover{opacity:1}.gwp-live-feed-contents.gwp-notice-pro .gwp-live-feed-close:before{color:#fff}.gwp-live-feed-contents.gwp-notice-new{border:0;padding:0;max-width:750px;margin-left:auto;margin-right:auto;background:transparent;box-shadow:none}.gwp-live-feed-contents.gwp-notice-new .feed-message-wrapper,.gwp-live-feed-contents.gwp-notice-new .feed-message-wrapper img,.gwp-live-feed-contents.gwp-notice-new .feed-message-wrapper p{padding:0;margin:0}.gwp-live-feed-contents.gwp-notice-new .gwp-live-feed-close{color:rgba(0,0,0,.5);opacity:.5;font-size:12px}.gwp-live-feed-contents.gwp-notice-new .gwp-live-feed-close:hover{opacity:1}.gwp-live-feed-contents.gwp-notice-new .gwp-live-feed-close:before{color:rgba(0,0,0,.5)}.gwp-live-feed-contents .button-primary{background:#56bfd4;border-color:#3a9db1;box-shadow:inset 0 1px 0 hsla(0,0%,100%,.3);text-shadow:0 -1px 1px #238ea5}.gwp-live-feed-contents .button-primary:active,.gwp-live-feed-contents .button-primary:focus,.gwp-live-feed-contents .button-primary:hover{background:#39b1ca;border-color:#3a9db1}.gwp-live-feed-contents .gwp-live-feed-close{display:flex;right:0;text-decoration:none;padding:10px 10px 10px 25px}.gwp-live-feed-contents .gwp-live-feed-close:before{display:inline-block}.gwp-live-feed-contents .gwp-live-feed-close-plain{display:flex;right:0;text-decoration:none;padding:15px}.gwp-live-feed-contents .gwp-live-feed-close-plain:before{display:inline-block}.wp-admin.rtl .gwp-live-feed-contents .gwp-live-feed-close-plain{left:0;right:auto}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/css/gwp-admin.css
DELETED
@@ -1,384 +0,0 @@
|
|
1 |
-
/*!
|
2 |
-
* Variation Swatches for WooCommerce v1.1.19
|
3 |
-
*
|
4 |
-
* Author: Emran Ahmed ( emran.bd.08@gmail.com )
|
5 |
-
* Date: 07/09/2021
|
6 |
-
* Released under the GPLv3 license.
|
7 |
-
*/
|
8 |
-
/**
|
9 |
-
* GWP Backbone modal dialog
|
10 |
-
*/
|
11 |
-
|
12 |
-
.gwp-backbone-modal * {
|
13 |
-
box-sizing: border-box;
|
14 |
-
}
|
15 |
-
|
16 |
-
.gwp-backbone-modal .gwp-backbone-modal-content {
|
17 |
-
position: fixed;
|
18 |
-
background: #FFFFFF;
|
19 |
-
z-index: 100000;
|
20 |
-
left: 50%;
|
21 |
-
top: 50%;
|
22 |
-
-webkit-transform: translate(-50%, -50%);
|
23 |
-
transform: translate(-50%, -50%);
|
24 |
-
max-width: 100%;
|
25 |
-
min-width: 300px;
|
26 |
-
}
|
27 |
-
|
28 |
-
.gwp-backbone-modal .gwp-backbone-modal-content article {
|
29 |
-
overflow: auto;
|
30 |
-
}
|
31 |
-
|
32 |
-
.gwp-backbone-modal .gwp-backbone-modal-content {
|
33 |
-
width: 40%;
|
34 |
-
}
|
35 |
-
|
36 |
-
.gwp-backbone-modal .gwp-feedback-dialog-form-body h2 {
|
37 |
-
font-weight: 700;
|
38 |
-
font-size: 15px;
|
39 |
-
color: #495157;
|
40 |
-
margin: 0 0 20px 0;
|
41 |
-
}
|
42 |
-
|
43 |
-
.gwp-backbone-modal .gwp-feedback-dialog-form-body .feedback-dialog-form-body .feedback-dialog-input-wrapper {
|
44 |
-
line-height: 1.3;
|
45 |
-
overflow: hidden;
|
46 |
-
margin-bottom: 15px;
|
47 |
-
}
|
48 |
-
|
49 |
-
.gwp-backbone-modal .gwp-feedback-dialog-form-body .feedback-dialog-form-body .feedback-dialog-input {
|
50 |
-
float: left;
|
51 |
-
margin: 0 10px 0 0;
|
52 |
-
box-shadow: none;
|
53 |
-
}
|
54 |
-
|
55 |
-
.gwp-backbone-modal .gwp-feedback-dialog-form-body .feedback-dialog-form-body .feedback-text {
|
56 |
-
margin: 10px 0 0 25px;
|
57 |
-
padding: 5px;
|
58 |
-
font-size: 13px;
|
59 |
-
box-shadow: none;
|
60 |
-
background-color: #FFFFFF;
|
61 |
-
width: 92%;
|
62 |
-
display: none;
|
63 |
-
}
|
64 |
-
|
65 |
-
.gwp-backbone-modal .gwp-feedback-dialog-form-body .feedback-dialog-form-body .feedback-alert {
|
66 |
-
color: #0273A9;
|
67 |
-
background-color: #FFFFFF;
|
68 |
-
font-weight: 600;
|
69 |
-
}
|
70 |
-
|
71 |
-
.gwp-backbone-modal .gwp-feedback-dialog-form-body .feedback-dialog-form-body .feedback-dialog-label {
|
72 |
-
display: block;
|
73 |
-
font-size: 13px;
|
74 |
-
color: #6D7882;
|
75 |
-
}
|
76 |
-
|
77 |
-
.gwp-backbone-modal footer {
|
78 |
-
margin-top: 30px;
|
79 |
-
overflow: hidden;
|
80 |
-
clear: both;
|
81 |
-
}
|
82 |
-
|
83 |
-
.gwp-backbone-modal footer .feedback-dialog-form-button-send {
|
84 |
-
background-color: #56BFD4;
|
85 |
-
border-radius: 3px;
|
86 |
-
color: #FFFFFF;
|
87 |
-
line-height: 1;
|
88 |
-
padding: 12px 20px;
|
89 |
-
font-size: 13px;
|
90 |
-
height: 40px;
|
91 |
-
border: 0;
|
92 |
-
box-shadow: none;
|
93 |
-
text-shadow: none;
|
94 |
-
float: left;
|
95 |
-
}
|
96 |
-
|
97 |
-
.gwp-backbone-modal footer .feedback-dialog-form-button-send:hover {
|
98 |
-
background: #389DB1;
|
99 |
-
}
|
100 |
-
|
101 |
-
.gwp-backbone-modal footer .feedback-dialog-form-button-send:active {
|
102 |
-
-webkit-transform: translateY(0);
|
103 |
-
transform: translateY(0);
|
104 |
-
}
|
105 |
-
|
106 |
-
.gwp-backbone-modal footer .feedback-dialog-form-button-skip {
|
107 |
-
font-size: 12px;
|
108 |
-
color: #A4AFB7;
|
109 |
-
background: none;
|
110 |
-
float: right;
|
111 |
-
width: auto;
|
112 |
-
cursor: pointer;
|
113 |
-
padding: 10px 0;
|
114 |
-
outline: 0;
|
115 |
-
text-decoration: none;
|
116 |
-
}
|
117 |
-
|
118 |
-
.gwp-backbone-modal footer .feedback-dialog-form-button-skip:focus {
|
119 |
-
box-shadow: none;
|
120 |
-
}
|
121 |
-
|
122 |
-
.gwp-backbone-modal footer .feedback-dialog-form-button-skip:hover {
|
123 |
-
text-decoration: underline;
|
124 |
-
}
|
125 |
-
|
126 |
-
.woo-variation-gallery-message {
|
127 |
-
background-color: #7f54b3;
|
128 |
-
color: #fff;
|
129 |
-
padding: 5px 10px;
|
130 |
-
border-radius: 5px;
|
131 |
-
display: none;
|
132 |
-
}
|
133 |
-
|
134 |
-
.woo-variation-gallery-message a {
|
135 |
-
color: #fff;
|
136 |
-
}
|
137 |
-
|
138 |
-
.woo-variation-gallery-message.enable {
|
139 |
-
display: block;
|
140 |
-
}
|
141 |
-
|
142 |
-
.woo-variation-gallery-message.loading {
|
143 |
-
display: block;
|
144 |
-
}
|
145 |
-
|
146 |
-
@media screen and (max-width: 782px) {
|
147 |
-
.gwp-backbone-modal .gwp-backbone-modal-content {
|
148 |
-
width: 100%;
|
149 |
-
height: 100%;
|
150 |
-
min-width: 100%;
|
151 |
-
}
|
152 |
-
}
|
153 |
-
|
154 |
-
.gwp-backbone-modal-backdrop {
|
155 |
-
position: fixed;
|
156 |
-
top: 0;
|
157 |
-
left: 0;
|
158 |
-
right: 0;
|
159 |
-
bottom: 0;
|
160 |
-
min-height: 360px;
|
161 |
-
background: #000000;
|
162 |
-
opacity: 0.7;
|
163 |
-
z-index: 99900;
|
164 |
-
}
|
165 |
-
|
166 |
-
.gwp-backbone-modal-main {
|
167 |
-
padding-bottom: 55px;
|
168 |
-
}
|
169 |
-
|
170 |
-
.gwp-backbone-modal-main header,
|
171 |
-
.gwp-backbone-modal-main article {
|
172 |
-
display: block;
|
173 |
-
position: relative;
|
174 |
-
}
|
175 |
-
|
176 |
-
.gwp-backbone-modal-main .gwp-backbone-modal-header {
|
177 |
-
height: auto;
|
178 |
-
background: #FCFCFC;
|
179 |
-
padding: 1em 1.5em;
|
180 |
-
border-bottom: 1px solid #DDDDDD;
|
181 |
-
}
|
182 |
-
|
183 |
-
.gwp-backbone-modal-main .gwp-backbone-modal-header h1 {
|
184 |
-
margin: 0;
|
185 |
-
color: #495157;
|
186 |
-
font-weight: 700;
|
187 |
-
font-size: 14px;
|
188 |
-
background: transparent;
|
189 |
-
line-height: 2em;
|
190 |
-
text-transform: uppercase;
|
191 |
-
border: 0;
|
192 |
-
}
|
193 |
-
|
194 |
-
.gwp-backbone-modal-main .gwp-backbone-modal-header .modal-close-link {
|
195 |
-
cursor: pointer;
|
196 |
-
color: #777777;
|
197 |
-
height: 54px;
|
198 |
-
width: 54px;
|
199 |
-
padding: 0;
|
200 |
-
position: absolute;
|
201 |
-
top: 0;
|
202 |
-
right: 0;
|
203 |
-
text-align: center;
|
204 |
-
border: 0;
|
205 |
-
border-left: 1px solid #DDDDDD;
|
206 |
-
background-color: transparent;
|
207 |
-
transition: color 0.1s ease-in-out, background 0.1s ease-in-out;
|
208 |
-
}
|
209 |
-
|
210 |
-
.gwp-backbone-modal-main .gwp-backbone-modal-header .modal-close-link::before {
|
211 |
-
font: normal 22px/50px "dashicons" !important;
|
212 |
-
color: #666666;
|
213 |
-
display: block;
|
214 |
-
content: "\F335";
|
215 |
-
font-weight: 300;
|
216 |
-
}
|
217 |
-
|
218 |
-
.gwp-backbone-modal-main .gwp-backbone-modal-header .modal-close-link:hover,
|
219 |
-
.gwp-backbone-modal-main .gwp-backbone-modal-header .modal-close-link:focus {
|
220 |
-
background: #DDDDDD;
|
221 |
-
border-color: #CCCCCC;
|
222 |
-
color: #000000;
|
223 |
-
}
|
224 |
-
|
225 |
-
.gwp-backbone-modal-main .gwp-backbone-modal-header .modal-close-link:focus {
|
226 |
-
outline: none;
|
227 |
-
}
|
228 |
-
|
229 |
-
.gwp-backbone-modal-main article {
|
230 |
-
padding: 1.5em;
|
231 |
-
}
|
232 |
-
|
233 |
-
.gwp-backbone-modal-main article p {
|
234 |
-
margin: 1.5em 0;
|
235 |
-
}
|
236 |
-
|
237 |
-
.gwp-backbone-modal-main article p:first-child {
|
238 |
-
margin-top: 0;
|
239 |
-
}
|
240 |
-
|
241 |
-
.gwp-backbone-modal-main article p:last-child {
|
242 |
-
margin-bottom: 0;
|
243 |
-
}
|
244 |
-
|
245 |
-
.gwp-backbone-modal-main article .pagination {
|
246 |
-
padding: 10px 0 0;
|
247 |
-
text-align: center;
|
248 |
-
}
|
249 |
-
|
250 |
-
.gwp-backbone-modal-main article table.widefat {
|
251 |
-
margin: 0;
|
252 |
-
width: 100%;
|
253 |
-
border: 0;
|
254 |
-
box-shadow: none;
|
255 |
-
}
|
256 |
-
|
257 |
-
.gwp-backbone-modal-main article table.widefat thead th {
|
258 |
-
padding: 0 1em 1em 1em;
|
259 |
-
text-align: left;
|
260 |
-
}
|
261 |
-
|
262 |
-
.gwp-backbone-modal-main article table.widefat thead th:first-child {
|
263 |
-
padding-left: 0;
|
264 |
-
}
|
265 |
-
|
266 |
-
.gwp-backbone-modal-main article table.widefat thead th:last-child {
|
267 |
-
padding-right: 0;
|
268 |
-
text-align: right;
|
269 |
-
}
|
270 |
-
|
271 |
-
.gwp-backbone-modal-main article table.widefat tbody td,
|
272 |
-
.gwp-backbone-modal-main article table.widefat tbody th {
|
273 |
-
padding: 1em;
|
274 |
-
text-align: left;
|
275 |
-
vertical-align: middle;
|
276 |
-
}
|
277 |
-
|
278 |
-
.gwp-backbone-modal-main article table.widefat tbody td:first-child,
|
279 |
-
.gwp-backbone-modal-main article table.widefat tbody th:first-child {
|
280 |
-
padding-left: 0;
|
281 |
-
}
|
282 |
-
|
283 |
-
.gwp-backbone-modal-main article table.widefat tbody td:last-child,
|
284 |
-
.gwp-backbone-modal-main article table.widefat tbody th:last-child {
|
285 |
-
padding-right: 0;
|
286 |
-
text-align: right;
|
287 |
-
}
|
288 |
-
|
289 |
-
.gwp-backbone-modal-main article table.widefat tbody td select,
|
290 |
-
.gwp-backbone-modal-main article table.widefat tbody td .select2-container,
|
291 |
-
.gwp-backbone-modal-main article table.widefat tbody th select,
|
292 |
-
.gwp-backbone-modal-main article table.widefat tbody th .select2-container {
|
293 |
-
width: 100%;
|
294 |
-
}
|
295 |
-
|
296 |
-
.gwp-backbone-modal-main footer {
|
297 |
-
position: absolute;
|
298 |
-
left: 0;
|
299 |
-
right: 0;
|
300 |
-
bottom: 0;
|
301 |
-
z-index: 100;
|
302 |
-
padding: 1em 1.5em;
|
303 |
-
background: #FCFCFC;
|
304 |
-
border-top: 1px solid #DFDFDF;
|
305 |
-
box-shadow: 0 -4px 4px -4px rgba(0, 0, 0, 0.1);
|
306 |
-
}
|
307 |
-
|
308 |
-
.gwp-backbone-modal-main footer .inner {
|
309 |
-
text-align: right;
|
310 |
-
line-height: 23px;
|
311 |
-
}
|
312 |
-
|
313 |
-
.gwp-backbone-modal-main footer .inner .button {
|
314 |
-
margin-bottom: 0;
|
315 |
-
}
|
316 |
-
|
317 |
-
.gwp-backbone-modal-main footer .inner .gwp-action-button-group {
|
318 |
-
display: inline-block;
|
319 |
-
float: left;
|
320 |
-
}
|
321 |
-
|
322 |
-
.gwp-backbone-modal-main footer .inner .button.button-large {
|
323 |
-
margin-left: 10px;
|
324 |
-
padding: 0 10px !important;
|
325 |
-
line-height: 28px;
|
326 |
-
height: auto;
|
327 |
-
display: inline-block;
|
328 |
-
}
|
329 |
-
|
330 |
-
.gwp-action-button-group {
|
331 |
-
vertical-align: middle;
|
332 |
-
line-height: 26px;
|
333 |
-
text-align: left;
|
334 |
-
}
|
335 |
-
|
336 |
-
.gwp-action-button-group .gwp-action-button-group__items {
|
337 |
-
display: inline-flex;
|
338 |
-
flex-flow: row wrap;
|
339 |
-
align-content: flex-start;
|
340 |
-
justify-content: flex-start;
|
341 |
-
}
|
342 |
-
|
343 |
-
.gwp-action-button-group .gwp-action-button {
|
344 |
-
margin: 0 0 0 -1px !important;
|
345 |
-
border: 1px solid #CCCCCC;
|
346 |
-
padding: 0 10px !important;
|
347 |
-
border-radius: 0 !important;
|
348 |
-
float: none;
|
349 |
-
line-height: 28px;
|
350 |
-
height: auto;
|
351 |
-
z-index: 1;
|
352 |
-
position: relative;
|
353 |
-
overflow: hidden;
|
354 |
-
text-overflow: ellipsis;
|
355 |
-
flex: 1 0 auto;
|
356 |
-
box-sizing: border-box;
|
357 |
-
text-align: center;
|
358 |
-
white-space: nowrap;
|
359 |
-
}
|
360 |
-
|
361 |
-
.gwp-action-button-group .gwp-action-button:hover,
|
362 |
-
.gwp-action-button-group .gwp-action-button:focus {
|
363 |
-
border: 1px solid #999999;
|
364 |
-
z-index: 2;
|
365 |
-
}
|
366 |
-
|
367 |
-
.gwp-action-button-group .gwp-action-button:first-child {
|
368 |
-
margin-left: 0 !important;
|
369 |
-
border-top-left-radius: 3px !important;
|
370 |
-
border-bottom-left-radius: 3px !important;
|
371 |
-
}
|
372 |
-
|
373 |
-
.gwp-action-button-group .gwp-action-button:last-child {
|
374 |
-
border-top-right-radius: 3px !important;
|
375 |
-
border-bottom-right-radius: 3px !important;
|
376 |
-
}
|
377 |
-
|
378 |
-
.gwp-action-button-group .spinner {
|
379 |
-
margin: 10px;
|
380 |
-
}
|
381 |
-
|
382 |
-
.gwp-action-button-group .spinner.visible {
|
383 |
-
visibility: visible;
|
384 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/css/gwp-admin.min.css
DELETED
@@ -1,8 +0,0 @@
|
|
1 |
-
/*!
|
2 |
-
* Variation Swatches for WooCommerce v1.1.19
|
3 |
-
*
|
4 |
-
* Author: Emran Ahmed ( emran.bd.08@gmail.com )
|
5 |
-
* Date: 07/09/2021
|
6 |
-
* Released under the GPLv3 license.
|
7 |
-
*/
|
8 |
-
.gwp-backbone-modal *{box-sizing:border-box}.gwp-backbone-modal .gwp-backbone-modal-content{position:fixed;background:#fff;z-index:100000;left:50%;top:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);max-width:100%;min-width:300px}.gwp-backbone-modal .gwp-backbone-modal-content article{overflow:auto}.gwp-backbone-modal .gwp-backbone-modal-content{width:40%}.gwp-backbone-modal .gwp-feedback-dialog-form-body h2{font-weight:700;font-size:15px;color:#495157;margin:0 0 20px}.gwp-backbone-modal .gwp-feedback-dialog-form-body .feedback-dialog-form-body .feedback-dialog-input-wrapper{line-height:1.3;overflow:hidden;margin-bottom:15px}.gwp-backbone-modal .gwp-feedback-dialog-form-body .feedback-dialog-form-body .feedback-dialog-input{float:left;margin:0 10px 0 0;box-shadow:none}.gwp-backbone-modal .gwp-feedback-dialog-form-body .feedback-dialog-form-body .feedback-text{margin:10px 0 0 25px;padding:5px;font-size:13px;box-shadow:none;background-color:#fff;width:92%;display:none}.gwp-backbone-modal .gwp-feedback-dialog-form-body .feedback-dialog-form-body .feedback-alert{color:#0273a9;background-color:#fff;font-weight:600}.gwp-backbone-modal .gwp-feedback-dialog-form-body .feedback-dialog-form-body .feedback-dialog-label{display:block;font-size:13px;color:#6d7882}.gwp-backbone-modal footer{margin-top:30px;overflow:hidden;clear:both}.gwp-backbone-modal footer .feedback-dialog-form-button-send{background-color:#56bfd4;border-radius:3px;color:#fff;line-height:1;padding:12px 20px;font-size:13px;height:40px;border:0;box-shadow:none;text-shadow:none;float:left}.gwp-backbone-modal footer .feedback-dialog-form-button-send:hover{background:#389db1}.gwp-backbone-modal footer .feedback-dialog-form-button-send:active{-webkit-transform:translateY(0);transform:translateY(0)}.gwp-backbone-modal footer .feedback-dialog-form-button-skip{font-size:12px;color:#a4afb7;background:none;float:right;width:auto;cursor:pointer;padding:10px 0;outline:0;text-decoration:none}.gwp-backbone-modal footer .feedback-dialog-form-button-skip:focus{box-shadow:none}.gwp-backbone-modal footer .feedback-dialog-form-button-skip:hover{text-decoration:underline}.woo-variation-gallery-message{background-color:#7f54b3;color:#fff;padding:5px 10px;border-radius:5px;display:none}.woo-variation-gallery-message a{color:#fff}.woo-variation-gallery-message.enable,.woo-variation-gallery-message.loading{display:block}@media screen and (max-width:782px){.gwp-backbone-modal .gwp-backbone-modal-content{width:100%;height:100%;min-width:100%}}.gwp-backbone-modal-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;min-height:360px;background:#000;opacity:.7;z-index:99900}.gwp-backbone-modal-main{padding-bottom:55px}.gwp-backbone-modal-main article,.gwp-backbone-modal-main header{display:block;position:relative}.gwp-backbone-modal-main .gwp-backbone-modal-header{height:auto;background:#fcfcfc;padding:1em 1.5em;border-bottom:1px solid #ddd}.gwp-backbone-modal-main .gwp-backbone-modal-header h1{margin:0;color:#495157;font-weight:700;font-size:14px;background:transparent;line-height:2em;text-transform:uppercase;border:0}.gwp-backbone-modal-main .gwp-backbone-modal-header .modal-close-link{cursor:pointer;color:#777;height:54px;width:54px;padding:0;position:absolute;top:0;right:0;text-align:center;border:0;border-left:1px solid #ddd;background-color:transparent;transition:color .1s ease-in-out,background .1s ease-in-out}.gwp-backbone-modal-main .gwp-backbone-modal-header .modal-close-link:before{font:normal 22px/50px dashicons!important;color:#666;display:block;content:"\F335";font-weight:300}.gwp-backbone-modal-main .gwp-backbone-modal-header .modal-close-link:focus,.gwp-backbone-modal-main .gwp-backbone-modal-header .modal-close-link:hover{background:#ddd;border-color:#ccc;color:#000}.gwp-backbone-modal-main .gwp-backbone-modal-header .modal-close-link:focus{outline:none}.gwp-backbone-modal-main article{padding:1.5em}.gwp-backbone-modal-main article p{margin:1.5em 0}.gwp-backbone-modal-main article p:first-child{margin-top:0}.gwp-backbone-modal-main article p:last-child{margin-bottom:0}.gwp-backbone-modal-main article .pagination{padding:10px 0 0;text-align:center}.gwp-backbone-modal-main article table.widefat{margin:0;width:100%;border:0;box-shadow:none}.gwp-backbone-modal-main article table.widefat thead th{padding:0 1em 1em;text-align:left}.gwp-backbone-modal-main article table.widefat thead th:first-child{padding-left:0}.gwp-backbone-modal-main article table.widefat thead th:last-child{padding-right:0;text-align:right}.gwp-backbone-modal-main article table.widefat tbody td,.gwp-backbone-modal-main article table.widefat tbody th{padding:1em;text-align:left;vertical-align:middle}.gwp-backbone-modal-main article table.widefat tbody td:first-child,.gwp-backbone-modal-main article table.widefat tbody th:first-child{padding-left:0}.gwp-backbone-modal-main article table.widefat tbody td:last-child,.gwp-backbone-modal-main article table.widefat tbody th:last-child{padding-right:0;text-align:right}.gwp-backbone-modal-main article table.widefat tbody td .select2-container,.gwp-backbone-modal-main article table.widefat tbody td select,.gwp-backbone-modal-main article table.widefat tbody th .select2-container,.gwp-backbone-modal-main article table.widefat tbody th select{width:100%}.gwp-backbone-modal-main footer{position:absolute;left:0;right:0;bottom:0;z-index:100;padding:1em 1.5em;background:#fcfcfc;border-top:1px solid #dfdfdf;box-shadow:0 -4px 4px -4px rgba(0,0,0,.1)}.gwp-backbone-modal-main footer .inner{text-align:right;line-height:23px}.gwp-backbone-modal-main footer .inner .button{margin-bottom:0}.gwp-backbone-modal-main footer .inner .gwp-action-button-group{display:inline-block;float:left}.gwp-backbone-modal-main footer .inner .button.button-large{margin-left:10px;padding:0 10px!important;line-height:28px;height:auto;display:inline-block}.gwp-action-button-group{vertical-align:middle;line-height:26px;text-align:left}.gwp-action-button-group .gwp-action-button-group__items{display:inline-flex;flex-flow:row wrap;align-content:flex-start;justify-content:flex-start}.gwp-action-button-group .gwp-action-button{margin:0 0 0 -1px!important;border:1px solid #ccc;padding:0 10px!important;border-radius:0!important;float:none;line-height:28px;height:auto;z-index:1;position:relative;overflow:hidden;text-overflow:ellipsis;flex:1 0 auto;box-sizing:border-box;text-align:center;white-space:nowrap}.gwp-action-button-group .gwp-action-button:focus,.gwp-action-button-group .gwp-action-button:hover{border:1px solid #999;z-index:2}.gwp-action-button-group .gwp-action-button:first-child{margin-left:0!important;border-top-left-radius:3px!important;border-bottom-left-radius:3px!important}.gwp-action-button-group .gwp-action-button:last-child{border-top-right-radius:3px!important;border-bottom-right-radius:3px!important}.gwp-action-button-group .spinner{margin:10px}.gwp-action-button-group .spinner.visible{visibility:visible}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/css/wvs-theme-override.css
DELETED
@@ -1,272 +0,0 @@
|
|
1 |
-
/*!
|
2 |
-
* Variation Swatches for WooCommerce v1.1.19
|
3 |
-
*
|
4 |
-
* Author: Emran Ahmed ( emran.bd.08@gmail.com )
|
5 |
-
* Date: 07/09/2021
|
6 |
-
* Released under the GPLv3 license.
|
7 |
-
*/
|
8 |
-
.wvs-theme-sober .product form.cart .variations .variable,
|
9 |
-
.wvs-theme-child-sober .product form.cart .variations .variable {
|
10 |
-
margin-bottom: 15px !important;
|
11 |
-
}
|
12 |
-
|
13 |
-
.wvs-theme-sober .product form.cart .variations .variable-options,
|
14 |
-
.wvs-theme-child-sober .product form.cart .variations .variable-options {
|
15 |
-
border: 0 !important;
|
16 |
-
}
|
17 |
-
|
18 |
-
.wvs-theme-sober .product form.cart .variations .variable-options::after,
|
19 |
-
.wvs-theme-child-sober .product form.cart .variations .variable-options::after {
|
20 |
-
display: none;
|
21 |
-
}
|
22 |
-
|
23 |
-
.wvs-theme-sober .product form.cart .variations .arrow,
|
24 |
-
.wvs-theme-child-sober .product form.cart .variations .arrow {
|
25 |
-
display: none;
|
26 |
-
}
|
27 |
-
|
28 |
-
.wvs-theme-sober .product form.cart .variations .label,
|
29 |
-
.wvs-theme-child-sober .product form.cart .variations .label {
|
30 |
-
display: block;
|
31 |
-
text-align: right;
|
32 |
-
margin-right: 10px;
|
33 |
-
}
|
34 |
-
|
35 |
-
.wvs-theme-sober .product form.cart .variations .value,
|
36 |
-
.wvs-theme-child-sober .product form.cart .variations .value {
|
37 |
-
flex-grow: unset;
|
38 |
-
}
|
39 |
-
|
40 |
-
.wvs-theme-sober .product form.cart .variations select,
|
41 |
-
.wvs-theme-child-sober .product form.cart .variations select {
|
42 |
-
border: 1px solid #E4E6EB !important;
|
43 |
-
padding: .5em 1em !important;
|
44 |
-
text-align: left !important;
|
45 |
-
-moz-text-align-last: left !important;
|
46 |
-
text-align-last: left !important;
|
47 |
-
-webkit-appearance: menulist-button !important;
|
48 |
-
}
|
49 |
-
|
50 |
-
.wvs-theme-sober .product form.cart .radio-variable-item,
|
51 |
-
.wvs-theme-child-sober .product form.cart .radio-variable-item {
|
52 |
-
margin: 5px;
|
53 |
-
text-align: left;
|
54 |
-
}
|
55 |
-
|
56 |
-
.wvs-theme-sober .product form.cart .radio-variable-item:last-child,
|
57 |
-
.wvs-theme-child-sober .product form.cart .radio-variable-item:last-child {
|
58 |
-
margin-right: 0;
|
59 |
-
}
|
60 |
-
|
61 |
-
.wvs-theme-sober .product form.cart .radio-variable-item label,
|
62 |
-
.wvs-theme-child-sober .product form.cart .radio-variable-item label {
|
63 |
-
padding-left: 30px;
|
64 |
-
margin: 0;
|
65 |
-
}
|
66 |
-
|
67 |
-
.wvs-theme-sober .product form.cart .radio-variable-item label::before,
|
68 |
-
.wvs-theme-child-sober .product form.cart .radio-variable-item label::before {
|
69 |
-
top: 0;
|
70 |
-
border-radius: 100%;
|
71 |
-
}
|
72 |
-
|
73 |
-
.wvs-theme-sober .product form.cart .radio-variable-item label::after,
|
74 |
-
.wvs-theme-child-sober .product form.cart .radio-variable-item label::after {
|
75 |
-
top: 8px;
|
76 |
-
}
|
77 |
-
|
78 |
-
.wvs-theme-shophistic-lite.woocommerce #main .entry-summary .variations {
|
79 |
-
display: block !important;
|
80 |
-
}
|
81 |
-
|
82 |
-
.wvs-theme-shophistic-lite .ql_custom_variations {
|
83 |
-
display: none !important;
|
84 |
-
}
|
85 |
-
|
86 |
-
.wvs-theme-shophistic-lite .radio-variable-item input[type="radio"] {
|
87 |
-
display: inline-block;
|
88 |
-
margin: 0;
|
89 |
-
}
|
90 |
-
|
91 |
-
.wvs-theme-flatsome .variations .reset_variations {
|
92 |
-
position: relative;
|
93 |
-
bottom: 0;
|
94 |
-
left: 0;
|
95 |
-
}
|
96 |
-
|
97 |
-
.wvs-theme-storefront.single-product div.product,
|
98 |
-
.wvs-theme-child-storefront.single-product div.product {
|
99 |
-
overflow: visible !important;
|
100 |
-
}
|
101 |
-
|
102 |
-
.wvs-theme-stockholm .variations .reset_variations {
|
103 |
-
position: relative;
|
104 |
-
bottom: 0;
|
105 |
-
left: 0;
|
106 |
-
-webkit-transform: none;
|
107 |
-
transform: none;
|
108 |
-
}
|
109 |
-
|
110 |
-
.wvs-theme-kalium .image-variable-item img,
|
111 |
-
.wvs-theme-kalium-child .image-variable-item img {
|
112 |
-
width: 100% !important;
|
113 |
-
}
|
114 |
-
|
115 |
-
.wvs-theme-kalium .radio-variable-item input,
|
116 |
-
.wvs-theme-kalium-child .radio-variable-item input {
|
117 |
-
width: 16px !important;
|
118 |
-
height: 16px !important;
|
119 |
-
}
|
120 |
-
|
121 |
-
.wvs-theme-kalium .woo-variation-items-wrapper .select-option-ui,
|
122 |
-
.wvs-theme-kalium-child .woo-variation-items-wrapper .select-option-ui {
|
123 |
-
display: none;
|
124 |
-
}
|
125 |
-
|
126 |
-
.wvs-theme-aurum .variable-items-wrapper .image-variable-item > img,
|
127 |
-
.wvs-theme-child-aurum .variable-items-wrapper .image-variable-item > img {
|
128 |
-
width: 100%;
|
129 |
-
}
|
130 |
-
|
131 |
-
.wvs-theme-hestia .woo-variation-items-wrapper.value::before {
|
132 |
-
display: none !important;
|
133 |
-
}
|
134 |
-
|
135 |
-
.wvs-theme-thegem .woo-variation-items-wrapper .combobox-wrapper,
|
136 |
-
.wvs-theme-child-thegem .woo-variation-items-wrapper .combobox-wrapper {
|
137 |
-
display: none;
|
138 |
-
}
|
139 |
-
|
140 |
-
.wvs-theme-thegem .wvs-archive-variation-wrapper .variations,
|
141 |
-
.wvs-theme-child-thegem .wvs-archive-variation-wrapper .variations {
|
142 |
-
padding: 0;
|
143 |
-
}
|
144 |
-
|
145 |
-
.wvs-theme-ushop .variations_form,
|
146 |
-
.wvs-theme-child-ushop .variations_form {
|
147 |
-
overflow: visible !important;
|
148 |
-
}
|
149 |
-
|
150 |
-
.wvs-theme-ushop .single-product-summary .product_meta,
|
151 |
-
.wvs-theme-child-ushop .single-product-summary .product_meta {
|
152 |
-
display: inline-table;
|
153 |
-
}
|
154 |
-
|
155 |
-
.wvs-theme-savoy .woo-variation-items-wrapper,
|
156 |
-
.wvs-theme-child-savoy .woo-variation-items-wrapper {
|
157 |
-
position: relative !important;
|
158 |
-
}
|
159 |
-
|
160 |
-
.wvs-theme-savoy .woo-variation-items-wrapper .sod_select,
|
161 |
-
.wvs-theme-child-savoy .woo-variation-items-wrapper .sod_select {
|
162 |
-
display: none !important;
|
163 |
-
}
|
164 |
-
|
165 |
-
.wvs-theme-savoy .nm-variation-row,
|
166 |
-
.wvs-theme-child-savoy .nm-variation-row {
|
167 |
-
display: flex;
|
168 |
-
}
|
169 |
-
|
170 |
-
.wvs-theme-woodstock .woo-variation-items-wrapper .variation-select,
|
171 |
-
.wvs-theme-child-woodstock .woo-variation-items-wrapper .variation-select {
|
172 |
-
display: none !important;
|
173 |
-
}
|
174 |
-
|
175 |
-
.wvs-theme-woodmart .woo-variation-items-wrapper > .swatches-select,
|
176 |
-
.wvs-theme-child-woodmart .woo-variation-items-wrapper > .swatches-select {
|
177 |
-
display: none;
|
178 |
-
}
|
179 |
-
|
180 |
-
.wvs-theme-woodmart .wd-attr-selected,
|
181 |
-
.wvs-theme-child-woodmart .wd-attr-selected {
|
182 |
-
display: none;
|
183 |
-
}
|
184 |
-
|
185 |
-
.wvs-theme-gecko .variations .value.woo-variation-items-wrapper,
|
186 |
-
.wvs-theme-gecko-child .variations .value.woo-variation-items-wrapper {
|
187 |
-
border: 0 !important;
|
188 |
-
}
|
189 |
-
|
190 |
-
.wvs-theme-gecko .variations .value.woo-variation-items-wrapper::after,
|
191 |
-
.wvs-theme-gecko-child .variations .value.woo-variation-items-wrapper::after {
|
192 |
-
display: none !important;
|
193 |
-
}
|
194 |
-
|
195 |
-
.woo-variation-gallery-theme-child-massive-dynamic .woo-variation-items-wrapper .clear-selection,
|
196 |
-
.woo-variation-gallery-theme-massive-dynamic .woo-variation-items-wrapper .clear-selection {
|
197 |
-
border: 0;
|
198 |
-
height: auto;
|
199 |
-
width: auto;
|
200 |
-
}
|
201 |
-
|
202 |
-
.woo-variation-gallery-theme-child-massive-dynamic .woo-variation-items-wrapper .clear-selection .reset_variations,
|
203 |
-
.woo-variation-gallery-theme-massive-dynamic .woo-variation-items-wrapper .clear-selection .reset_variations {
|
204 |
-
font-size: 8px !important;
|
205 |
-
width: 20px;
|
206 |
-
height: 20px;
|
207 |
-
padding: 5px;
|
208 |
-
box-sizing: border-box;
|
209 |
-
border-radius: 100%;
|
210 |
-
border: 1px solid #F04040;
|
211 |
-
color: #F04040;
|
212 |
-
}
|
213 |
-
|
214 |
-
.wvs-theme-claue .woo-variation-items-wrapper,
|
215 |
-
.wvs-theme-child-claue .woo-variation-items-wrapper {
|
216 |
-
border: none;
|
217 |
-
}
|
218 |
-
|
219 |
-
.wvs-theme-claue .woo-variation-items-wrapper::after,
|
220 |
-
.wvs-theme-child-claue .woo-variation-items-wrapper::after {
|
221 |
-
display: none;
|
222 |
-
}
|
223 |
-
|
224 |
-
.wvs-theme-jupiter table.variations,
|
225 |
-
.wvs-theme-child-jupiter table.variations {
|
226 |
-
overflow: initial;
|
227 |
-
}
|
228 |
-
|
229 |
-
.wvs-theme-oxygen .woo-variation-items-wrapper .select-wrapper,
|
230 |
-
.wvs-theme-child-oxygen .woo-variation-items-wrapper .select-wrapper {
|
231 |
-
display: none;
|
232 |
-
}
|
233 |
-
|
234 |
-
.wvs-theme-oxygen .variable-items-wrapper.radio-variable-wrapper .radio-variable-item input,
|
235 |
-
.wvs-theme-child-oxygen .variable-items-wrapper.radio-variable-wrapper .radio-variable-item input {
|
236 |
-
width: 18px;
|
237 |
-
}
|
238 |
-
|
239 |
-
.wvs-theme-simple-elegant .woo-variation-items-wrapper .wi-nice-select,
|
240 |
-
.wvs-theme-child-simple-elegant .woo-variation-items-wrapper .wi-nice-select {
|
241 |
-
display: none;
|
242 |
-
}
|
243 |
-
|
244 |
-
.wvs-theme-twentytwenty table.variations,
|
245 |
-
.wvs-theme-child-twentytwenty table.variations {
|
246 |
-
overflow: auto;
|
247 |
-
}
|
248 |
-
|
249 |
-
.wvs-theme-divi .et_pb_wc_add_to_cart form.variations_form.cart .variations td.value span:after,
|
250 |
-
.wvs-theme-child-divi .et_pb_wc_add_to_cart form.variations_form.cart .variations td.value span:after {
|
251 |
-
display: none !important;
|
252 |
-
}
|
253 |
-
|
254 |
-
.wvs-theme-jevelin .sh-woo-layout table.variations td select.woo-variation-raw-select,
|
255 |
-
.wvs-theme-child-jevelin .sh-woo-layout table.variations td select.woo-variation-raw-select {
|
256 |
-
display: none !important;
|
257 |
-
}
|
258 |
-
|
259 |
-
.wvs-theme-jevelin .sh-woo-layout table.variations,
|
260 |
-
.wvs-theme-child-jevelin .sh-woo-layout table.variations {
|
261 |
-
max-width: 100%;
|
262 |
-
}
|
263 |
-
|
264 |
-
.wvs-theme-jevelin .radio-variable-item label,
|
265 |
-
.wvs-theme-child-jevelin .radio-variable-item label {
|
266 |
-
line-height: 1 !important;
|
267 |
-
}
|
268 |
-
|
269 |
-
.wvs-theme-stockie .woo-variation-raw-select + .select-styled,
|
270 |
-
.wvs-theme-child-stockie .woo-variation-raw-select + .select-styled {
|
271 |
-
display: none !important;
|
272 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/css/wvs-theme-override.min.css
DELETED
@@ -1,8 +0,0 @@
|
|
1 |
-
/*!
|
2 |
-
* Variation Swatches for WooCommerce v1.1.19
|
3 |
-
*
|
4 |
-
* Author: Emran Ahmed ( emran.bd.08@gmail.com )
|
5 |
-
* Date: 07/09/2021
|
6 |
-
* Released under the GPLv3 license.
|
7 |
-
*/
|
8 |
-
.wvs-theme-child-sober .product form.cart .variations .variable,.wvs-theme-sober .product form.cart .variations .variable{margin-bottom:15px!important}.wvs-theme-child-sober .product form.cart .variations .variable-options,.wvs-theme-sober .product form.cart .variations .variable-options{border:0!important}.wvs-theme-child-sober .product form.cart .variations .arrow,.wvs-theme-child-sober .product form.cart .variations .variable-options:after,.wvs-theme-sober .product form.cart .variations .arrow,.wvs-theme-sober .product form.cart .variations .variable-options:after{display:none}.wvs-theme-child-sober .product form.cart .variations .label,.wvs-theme-sober .product form.cart .variations .label{display:block;text-align:right;margin-right:10px}.wvs-theme-child-sober .product form.cart .variations .value,.wvs-theme-sober .product form.cart .variations .value{flex-grow:unset}.wvs-theme-child-sober .product form.cart .variations select,.wvs-theme-sober .product form.cart .variations select{border:1px solid #e4e6eb!important;padding:.5em 1em!important;text-align:left!important;-moz-text-align-last:left!important;text-align-last:left!important;-webkit-appearance:menulist-button!important}.wvs-theme-child-sober .product form.cart .radio-variable-item,.wvs-theme-sober .product form.cart .radio-variable-item{margin:5px;text-align:left}.wvs-theme-child-sober .product form.cart .radio-variable-item:last-child,.wvs-theme-sober .product form.cart .radio-variable-item:last-child{margin-right:0}.wvs-theme-child-sober .product form.cart .radio-variable-item label,.wvs-theme-sober .product form.cart .radio-variable-item label{padding-left:30px;margin:0}.wvs-theme-child-sober .product form.cart .radio-variable-item label:before,.wvs-theme-sober .product form.cart .radio-variable-item label:before{top:0;border-radius:100%}.wvs-theme-child-sober .product form.cart .radio-variable-item label:after,.wvs-theme-sober .product form.cart .radio-variable-item label:after{top:8px}.wvs-theme-shophistic-lite.woocommerce #main .entry-summary .variations{display:block!important}.wvs-theme-shophistic-lite .ql_custom_variations{display:none!important}.wvs-theme-shophistic-lite .radio-variable-item input[type=radio]{display:inline-block;margin:0}.wvs-theme-flatsome .variations .reset_variations{position:relative;bottom:0;left:0}.wvs-theme-child-storefront.single-product div.product,.wvs-theme-storefront.single-product div.product{overflow:visible!important}.wvs-theme-stockholm .variations .reset_variations{position:relative;bottom:0;left:0;-webkit-transform:none;transform:none}.wvs-theme-kalium-child .image-variable-item img,.wvs-theme-kalium .image-variable-item img{width:100%!important}.wvs-theme-kalium-child .radio-variable-item input,.wvs-theme-kalium .radio-variable-item input{width:16px!important;height:16px!important}.wvs-theme-kalium-child .woo-variation-items-wrapper .select-option-ui,.wvs-theme-kalium .woo-variation-items-wrapper .select-option-ui{display:none}.wvs-theme-aurum .variable-items-wrapper .image-variable-item>img,.wvs-theme-child-aurum .variable-items-wrapper .image-variable-item>img{width:100%}.wvs-theme-hestia .woo-variation-items-wrapper.value:before{display:none!important}.wvs-theme-child-thegem .woo-variation-items-wrapper .combobox-wrapper,.wvs-theme-thegem .woo-variation-items-wrapper .combobox-wrapper{display:none}.wvs-theme-child-thegem .wvs-archive-variation-wrapper .variations,.wvs-theme-thegem .wvs-archive-variation-wrapper .variations{padding:0}.wvs-theme-child-ushop .variations_form,.wvs-theme-ushop .variations_form{overflow:visible!important}.wvs-theme-child-ushop .single-product-summary .product_meta,.wvs-theme-ushop .single-product-summary .product_meta{display:inline-table}.wvs-theme-child-savoy .woo-variation-items-wrapper,.wvs-theme-savoy .woo-variation-items-wrapper{position:relative!important}.wvs-theme-child-savoy .woo-variation-items-wrapper .sod_select,.wvs-theme-savoy .woo-variation-items-wrapper .sod_select{display:none!important}.wvs-theme-child-savoy .nm-variation-row,.wvs-theme-savoy .nm-variation-row{display:flex}.wvs-theme-child-woodstock .woo-variation-items-wrapper .variation-select,.wvs-theme-woodstock .woo-variation-items-wrapper .variation-select{display:none!important}.wvs-theme-child-woodmart .wd-attr-selected,.wvs-theme-child-woodmart .woo-variation-items-wrapper>.swatches-select,.wvs-theme-woodmart .wd-attr-selected,.wvs-theme-woodmart .woo-variation-items-wrapper>.swatches-select{display:none}.wvs-theme-gecko-child .variations .value.woo-variation-items-wrapper,.wvs-theme-gecko .variations .value.woo-variation-items-wrapper{border:0!important}.wvs-theme-gecko-child .variations .value.woo-variation-items-wrapper:after,.wvs-theme-gecko .variations .value.woo-variation-items-wrapper:after{display:none!important}.woo-variation-gallery-theme-child-massive-dynamic .woo-variation-items-wrapper .clear-selection,.woo-variation-gallery-theme-massive-dynamic .woo-variation-items-wrapper .clear-selection{border:0;height:auto;width:auto}.woo-variation-gallery-theme-child-massive-dynamic .woo-variation-items-wrapper .clear-selection .reset_variations,.woo-variation-gallery-theme-massive-dynamic .woo-variation-items-wrapper .clear-selection .reset_variations{font-size:8px!important;width:20px;height:20px;padding:5px;box-sizing:border-box;border-radius:100%;border:1px solid #f04040;color:#f04040}.wvs-theme-child-claue .woo-variation-items-wrapper,.wvs-theme-claue .woo-variation-items-wrapper{border:none}.wvs-theme-child-claue .woo-variation-items-wrapper:after,.wvs-theme-claue .woo-variation-items-wrapper:after{display:none}.wvs-theme-child-jupiter table.variations,.wvs-theme-jupiter table.variations{overflow:initial}.wvs-theme-child-oxygen .woo-variation-items-wrapper .select-wrapper,.wvs-theme-oxygen .woo-variation-items-wrapper .select-wrapper{display:none}.wvs-theme-child-oxygen .variable-items-wrapper.radio-variable-wrapper .radio-variable-item input,.wvs-theme-oxygen .variable-items-wrapper.radio-variable-wrapper .radio-variable-item input{width:18px}.wvs-theme-child-simple-elegant .woo-variation-items-wrapper .wi-nice-select,.wvs-theme-simple-elegant .woo-variation-items-wrapper .wi-nice-select{display:none}.wvs-theme-child-twentytwenty table.variations,.wvs-theme-twentytwenty table.variations{overflow:auto}.wvs-theme-child-divi .et_pb_wc_add_to_cart form.variations_form.cart .variations td.value span:after,.wvs-theme-child-jevelin .sh-woo-layout table.variations td select.woo-variation-raw-select,.wvs-theme-divi .et_pb_wc_add_to_cart form.variations_form.cart .variations td.value span:after,.wvs-theme-jevelin .sh-woo-layout table.variations td select.woo-variation-raw-select{display:none!important}.wvs-theme-child-jevelin .sh-woo-layout table.variations,.wvs-theme-jevelin .sh-woo-layout table.variations{max-width:100%}.wvs-theme-child-jevelin .radio-variable-item label,.wvs-theme-jevelin .radio-variable-item label{line-height:1!important}.wvs-theme-child-stockie .woo-variation-raw-select+.select-styled,.wvs-theme-stockie .woo-variation-raw-select+.select-styled{display:none!important}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/admin.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
/*!
|
2 |
-
* Variation Swatches for WooCommerce
|
3 |
*
|
4 |
* Author: Emran Ahmed ( emran.bd.08@gmail.com )
|
5 |
-
* Date:
|
6 |
* Released under the GPLv3 license.
|
7 |
*/
|
8 |
/******/ (function(modules) { // webpackBootstrap
|
@@ -43,14 +43,34 @@
|
|
43 |
/******/ // define getter function for harmony exports
|
44 |
/******/ __webpack_require__.d = function(exports, name, getter) {
|
45 |
/******/ if(!__webpack_require__.o(exports, name)) {
|
46 |
-
/******/ Object.defineProperty(exports, name, {
|
47 |
-
/******/ configurable: false,
|
48 |
-
/******/ enumerable: true,
|
49 |
-
/******/ get: getter
|
50 |
-
/******/ });
|
51 |
/******/ }
|
52 |
/******/ };
|
53 |
/******/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
55 |
/******/ __webpack_require__.n = function(module) {
|
56 |
/******/ var getter = module && module.__esModule ?
|
@@ -64,405 +84,807 @@
|
|
64 |
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
65 |
/******/
|
66 |
/******/ // __webpack_public_path__
|
67 |
-
/******/ __webpack_require__.p = "";
|
|
|
68 |
/******/
|
69 |
/******/ // Load entry module and return exports
|
70 |
/******/ return __webpack_require__(__webpack_require__.s = 0);
|
71 |
/******/ })
|
72 |
/************************************************************************/
|
73 |
-
/******/ (
|
74 |
-
/* 0 */
|
75 |
-
/***/ (function(module, exports, __webpack_require__) {
|
76 |
-
|
77 |
-
__webpack_require__(1);
|
78 |
-
__webpack_require__(3);
|
79 |
-
__webpack_require__(4);
|
80 |
-
__webpack_require__(5);
|
81 |
-
__webpack_require__(6);
|
82 |
-
__webpack_require__(7);
|
83 |
-
module.exports = __webpack_require__(8);
|
84 |
-
|
85 |
-
|
86 |
-
/***/ }),
|
87 |
-
/* 1 */
|
88 |
-
/***/ (function(module, exports, __webpack_require__) {
|
89 |
-
|
90 |
-
jQuery(function ($) {
|
91 |
-
Promise.resolve().then(function () {
|
92 |
-
return __webpack_require__(2);
|
93 |
-
}).then(function (_ref) {
|
94 |
-
var PluginHelper = _ref.PluginHelper;
|
95 |
-
|
96 |
-
|
97 |
-
PluginHelper.GWPAdmin();
|
98 |
-
PluginHelper.SelectWoo();
|
99 |
-
PluginHelper.ColorPicker();
|
100 |
-
PluginHelper.FieldDependency();
|
101 |
-
PluginHelper.ImageUploader();
|
102 |
-
PluginHelper.AttributeDialog();
|
103 |
-
|
104 |
-
$('#woocommerce-product-data').on('woocommerce_variations_loaded', function () {
|
105 |
-
PluginHelper.GalleryNotification();
|
106 |
-
});
|
107 |
-
|
108 |
-
$('#variable_product_options').on('woocommerce_variations_added', function () {
|
109 |
-
PluginHelper.GalleryNotification();
|
110 |
-
});
|
111 |
-
|
112 |
-
$(document.body).on('woocommerce_added_attribute', function () {
|
113 |
-
PluginHelper.SelectWoo();
|
114 |
-
PluginHelper.ColorPicker();
|
115 |
-
PluginHelper.ImageUploader();
|
116 |
-
PluginHelper.AttributeDialog();
|
117 |
-
});
|
118 |
-
|
119 |
-
$(document.body).on('wvs_pro_product_swatches_variation_loaded', function () {
|
120 |
-
PluginHelper.ColorPicker();
|
121 |
-
PluginHelper.ImageUploader();
|
122 |
-
});
|
123 |
-
});
|
124 |
-
}); // end of jquery main wrapper
|
125 |
|
126 |
-
/***/
|
127 |
-
/* 2 */
|
128 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
129 |
|
130 |
"use strict";
|
131 |
-
|
132 |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PluginHelper", function() { return PluginHelper; });
|
133 |
-
|
134 |
|
135 |
-
|
|
|
|
|
136 |
|
137 |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
138 |
|
139 |
-
|
|
|
|
|
140 |
|
|
|
141 |
var PluginHelper = function ($) {
|
142 |
-
|
143 |
-
|
144 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
}
|
146 |
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
}
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
169 |
|
170 |
-
|
171 |
-
|
172 |
-
} else {
|
173 |
-
$(this).closest('.data').find('.woo-variation-gallery-message').removeClass('enable');
|
174 |
-
}
|
175 |
-
});
|
176 |
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
});
|
204 |
-
});
|
205 |
-
}
|
206 |
-
}, {
|
207 |
-
key: 'ImageUploader',
|
208 |
-
value: function ImageUploader() {
|
209 |
-
$(document).off('click', 'button.wvs_upload_image_button');
|
210 |
-
$(document).on('click', 'button.wvs_upload_image_button', this.AddImage);
|
211 |
-
$(document).on('click', 'button.wvs_remove_image_button', this.RemoveImage);
|
212 |
}
|
213 |
-
|
214 |
-
|
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 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
var attachment = wp.media.attachment(current);
|
262 |
-
attachment.fetch();
|
263 |
-
selection.add(attachment ? [attachment] : []);
|
264 |
-
});
|
265 |
-
|
266 |
-
// Finally, open the modal.
|
267 |
-
file_frame.open();
|
268 |
}
|
|
|
269 |
}
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
282 |
}
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
293 |
}
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
302 |
}
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
|
|
|
|
307 |
|
308 |
-
|
309 |
-
|
310 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
311 |
}
|
312 |
-
}, {
|
313 |
-
key: 'savingDialog',
|
314 |
-
value: function savingDialog($wrapper, $dialog, taxonomy) {
|
315 |
-
|
316 |
-
var data = {};
|
317 |
-
var term = '';
|
318 |
-
|
319 |
-
// @TODO: We should use form data, because we have to pick array based data also :)
|
320 |
-
|
321 |
-
$dialog.find('input, select').each(function () {
|
322 |
-
var key = $(this).attr('name');
|
323 |
-
var value = $(this).val();
|
324 |
-
if (key) {
|
325 |
-
if (key === 'tag_name') {
|
326 |
-
term = value;
|
327 |
-
} else {
|
328 |
-
data[key] = value;
|
329 |
-
}
|
330 |
-
$(this).val('');
|
331 |
-
}
|
332 |
-
});
|
333 |
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
action: 'woocommerce_add_new_attribute',
|
345 |
-
taxonomy: taxonomy,
|
346 |
-
term: term,
|
347 |
-
security: woocommerce_admin_meta_boxes.add_attribute_nonce
|
348 |
-
}, data);
|
349 |
-
|
350 |
-
$.post(woocommerce_admin_meta_boxes.ajax_url, ajax_data, function (response) {
|
351 |
-
|
352 |
-
if (response.error) {
|
353 |
-
// Error.
|
354 |
-
window.alert(response.error);
|
355 |
-
} else if (response.slug) {
|
356 |
-
// Success.
|
357 |
-
$wrapper.find('select.attribute_values').append('<option value="' + response.term_id + '" selected="selected">' + response.name + '</option>');
|
358 |
-
$wrapper.find('select.attribute_values').change();
|
359 |
-
}
|
360 |
-
|
361 |
-
$('.product_attributes').unblock();
|
362 |
-
});
|
363 |
-
} else {
|
364 |
-
$('.product_attributes').unblock();
|
365 |
-
}
|
366 |
}
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
"ui-dialog": "wp-dialog wvs-attribute-dialog"
|
385 |
-
},
|
386 |
-
autoOpen: false,
|
387 |
-
draggable: true,
|
388 |
-
width: 'auto',
|
389 |
-
modal: true,
|
390 |
-
resizable: false,
|
391 |
-
closeOnEscape: true,
|
392 |
-
position: {
|
393 |
-
my: "center",
|
394 |
-
at: "center",
|
395 |
-
of: window
|
396 |
-
},
|
397 |
-
open: function open() {
|
398 |
-
// close dialog by clicking the overlay behind it
|
399 |
-
$('.ui-widget-overlay').bind('click', function () {
|
400 |
-
$('#attribute-dialog').dialog('close');
|
401 |
-
});
|
402 |
-
},
|
403 |
-
create: function create() {
|
404 |
-
// style fix for WordPress admin
|
405 |
-
// $('.ui-dialog-titlebar-close').addClass('ui-button');
|
406 |
-
}
|
407 |
-
}).dialog("option", "title", title).dialog("option", "buttons", [{
|
408 |
-
text: WVSPluginObject.dialog_save,
|
409 |
-
click: function click() {
|
410 |
-
self.savingDialog($wrapper, $(this), attribute);
|
411 |
-
$(this).dialog("close").dialog("destroy");
|
412 |
-
}
|
413 |
-
}, {
|
414 |
-
text: WVSPluginObject.dialog_cancel,
|
415 |
-
click: function click() {
|
416 |
-
$(this).dialog("close").dialog("destroy");
|
417 |
-
}
|
418 |
-
}]).dialog('open');
|
419 |
-
});
|
420 |
}
|
421 |
-
}]);
|
422 |
|
423 |
-
|
424 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
425 |
|
426 |
return PluginHelper;
|
|
|
|
|
|
|
427 |
}(jQuery);
|
428 |
|
429 |
|
430 |
|
431 |
/***/ }),
|
432 |
-
/* 3 */
|
433 |
-
/***/ (function(module, exports) {
|
434 |
|
435 |
-
|
|
|
436 |
|
437 |
-
|
438 |
-
/* 4 */
|
439 |
-
/***/ (function(module, exports) {
|
440 |
|
441 |
-
|
442 |
|
443 |
-
|
444 |
-
/* 5 */
|
445 |
-
/***/ (function(module, exports) {
|
446 |
|
447 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
448 |
|
449 |
/***/ }),
|
450 |
-
|
|
|
451 |
/***/ (function(module, exports) {
|
452 |
|
453 |
// removed by extract-text-webpack-plugin
|
454 |
|
455 |
/***/ }),
|
456 |
-
|
|
|
457 |
/***/ (function(module, exports) {
|
458 |
|
459 |
// removed by extract-text-webpack-plugin
|
460 |
|
461 |
/***/ }),
|
462 |
-
/* 8 */
|
463 |
-
/***/ (function(module, exports) {
|
464 |
|
465 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
466 |
|
467 |
/***/ })
|
468 |
-
|
|
1 |
/*!
|
2 |
+
* Variation Swatches for WooCommerce
|
3 |
*
|
4 |
* Author: Emran Ahmed ( emran.bd.08@gmail.com )
|
5 |
+
* Date: 6/13/2022, 4:04:45 PM
|
6 |
* Released under the GPLv3 license.
|
7 |
*/
|
8 |
/******/ (function(modules) { // webpackBootstrap
|
43 |
/******/ // define getter function for harmony exports
|
44 |
/******/ __webpack_require__.d = function(exports, name, getter) {
|
45 |
/******/ if(!__webpack_require__.o(exports, name)) {
|
46 |
+
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
|
|
|
|
|
|
|
|
47 |
/******/ }
|
48 |
/******/ };
|
49 |
/******/
|
50 |
+
/******/ // define __esModule on exports
|
51 |
+
/******/ __webpack_require__.r = function(exports) {
|
52 |
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
53 |
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
54 |
+
/******/ }
|
55 |
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
56 |
+
/******/ };
|
57 |
+
/******/
|
58 |
+
/******/ // create a fake namespace object
|
59 |
+
/******/ // mode & 1: value is a module id, require it
|
60 |
+
/******/ // mode & 2: merge all properties of value into the ns
|
61 |
+
/******/ // mode & 4: return value when already ns object
|
62 |
+
/******/ // mode & 8|1: behave like require
|
63 |
+
/******/ __webpack_require__.t = function(value, mode) {
|
64 |
+
/******/ if(mode & 1) value = __webpack_require__(value);
|
65 |
+
/******/ if(mode & 8) return value;
|
66 |
+
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
67 |
+
/******/ var ns = Object.create(null);
|
68 |
+
/******/ __webpack_require__.r(ns);
|
69 |
+
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
70 |
+
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
71 |
+
/******/ return ns;
|
72 |
+
/******/ };
|
73 |
+
/******/
|
74 |
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
75 |
/******/ __webpack_require__.n = function(module) {
|
76 |
/******/ var getter = module && module.__esModule ?
|
84 |
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
85 |
/******/
|
86 |
/******/ // __webpack_public_path__
|
87 |
+
/******/ __webpack_require__.p = "/";
|
88 |
+
/******/
|
89 |
/******/
|
90 |
/******/ // Load entry module and return exports
|
91 |
/******/ return __webpack_require__(__webpack_require__.s = 0);
|
92 |
/******/ })
|
93 |
/************************************************************************/
|
94 |
+
/******/ ({
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
|
96 |
+
/***/ "./src/js/PluginHelper.js":
|
|
|
97 |
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
98 |
|
99 |
"use strict";
|
100 |
+
__webpack_require__.r(__webpack_exports__);
|
101 |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PluginHelper", function() { return PluginHelper; });
|
102 |
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
103 |
|
104 |
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
105 |
+
|
106 |
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
107 |
|
108 |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
109 |
|
110 |
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
111 |
+
|
112 |
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
113 |
|
114 |
+
/*global woo_variation_swatches_admin, wp, woocommerce_admin_meta_boxes*/
|
115 |
var PluginHelper = function ($) {
|
116 |
+
var PluginHelper = /*#__PURE__*/function () {
|
117 |
+
function PluginHelper() {
|
118 |
+
_classCallCheck(this, PluginHelper);
|
119 |
+
}
|
120 |
+
|
121 |
+
_createClass(PluginHelper, null, [{
|
122 |
+
key: "GWPAdmin",
|
123 |
+
value: function GWPAdmin() {
|
124 |
+
if ($().gwp_live_feed) {
|
125 |
+
$().gwp_live_feed();
|
126 |
}
|
127 |
|
128 |
+
if ($().gwp_deactivate_popup) {
|
129 |
+
$().gwp_deactivate_popup('woo-variation-swatches');
|
130 |
+
}
|
131 |
+
}
|
132 |
+
}, {
|
133 |
+
key: "GalleryNotification",
|
134 |
+
value: function GalleryNotification() {
|
135 |
+
$('.woocommerce_variation').each(function () {
|
136 |
+
var optionsWrapper = $(this).find('.options:first');
|
137 |
+
var galleryWrapper = $(this).find('.woo-variation-gallery-message');
|
138 |
+
galleryWrapper.insertBefore(optionsWrapper);
|
139 |
+
});
|
140 |
+
$('input.upload_image_id').on('change', function (event) {
|
141 |
+
var value = $.trim($(this).val());
|
142 |
+
|
143 |
+
if (value) {
|
144 |
+
$(this).closest('.data').find('.woo-variation-gallery-message').addClass('enable');
|
145 |
+
} else {
|
146 |
+
$(this).closest('.data').find('.woo-variation-gallery-message').removeClass('enable');
|
147 |
+
}
|
148 |
+
});
|
149 |
+
$('a.install-woo-variation-gallery-action').on('click', function (event) {
|
150 |
+
event.preventDefault();
|
151 |
+
var $parent = $(this).parent();
|
152 |
+
var installing = $parent.data('installing');
|
153 |
+
var activated = $parent.data('activated');
|
154 |
+
var nonce = $parent.data('nonce');
|
155 |
+
$parent.text(installing);
|
156 |
+
wp.ajax.send('install_woo_variation_gallery', {
|
157 |
+
data: {
|
158 |
+
'nonce': nonce
|
159 |
+
},
|
160 |
+
success: function success(response) {
|
161 |
+
$parent.text(activated);
|
162 |
+
|
163 |
+
_.delay(function () {
|
164 |
+
$('.woocommerce_variable_attributes .woo-variation-gallery-message').remove();
|
165 |
+
}, 5000);
|
166 |
+
},
|
167 |
+
error: function error(response) {
|
168 |
+
$parent.text(activated);
|
169 |
+
|
170 |
+
_.delay(function () {
|
171 |
+
$('.woocommerce_variable_attributes .woo-variation-gallery-message').remove();
|
172 |
+
}, 5000);
|
173 |
}
|
174 |
+
});
|
175 |
+
});
|
176 |
+
}
|
177 |
+
}, {
|
178 |
+
key: "PaginationAjax",
|
179 |
+
value: function PaginationAjax($product_id, $attribute_id, $attribute_name, $offset, $selector) {
|
180 |
+
$.ajax({
|
181 |
+
global: false,
|
182 |
+
url: woo_variation_swatches_admin.wc_ajax_url.toString().replace('%%endpoint%%', 'woo_variation_swatches_load_product_terms'),
|
183 |
+
method: 'POST',
|
184 |
+
data: {
|
185 |
+
offset: $offset,
|
186 |
+
product_id: $product_id,
|
187 |
+
attribute_id: $attribute_id,
|
188 |
+
attribute_name: $attribute_name,
|
189 |
+
nonce: woo_variation_swatches_admin.nonce
|
190 |
+
},
|
191 |
+
beforeSend: function beforeSend(xhr, settings) {
|
192 |
+
$selector.block({
|
193 |
+
message: null,
|
194 |
+
overlayCSS: {
|
195 |
+
background: '#DDDDDD',
|
196 |
+
opacity: 0.6
|
197 |
+
}
|
198 |
+
});
|
199 |
+
}
|
200 |
+
}).fail(function (jqXHR, textStatus) {
|
201 |
+
console.error("not available on: ".concat($product_id, " ").concat($attribute_key, "."), textStatus);
|
202 |
+
}).always(function () {
|
203 |
+
$selector.unblock();
|
204 |
+
}).done(function (termsMarkup) {
|
205 |
+
if (termsMarkup) {
|
206 |
+
$selector.html(termsMarkup);
|
207 |
+
$(document.body).trigger('woo_variation_swatches_product_term_paging_done', $selector); //$('#woocommerce-product-data').trigger('woocommerce_variations_loaded');
|
208 |
+
}
|
209 |
+
});
|
210 |
+
}
|
211 |
+
}, {
|
212 |
+
key: "MetaboxToggle",
|
213 |
+
value: function MetaboxToggle() {
|
214 |
+
// Meta-Boxes - Open/close
|
215 |
+
var $wrapper = $('#woo_variation_swatches_variation_product_options');
|
216 |
+
$wrapper.on('click', '.wc-metabox > h4', function (event) {
|
217 |
+
var box = $(this).parent('.wc-metabox');
|
218 |
+
var content = $(this).next('.wc-metabox-content'); // If the user clicks on some form input inside the h3, like a select list (for variations), the box should not be toggled
|
219 |
+
|
220 |
+
if ($(event.target).filter(':input, option, .sort, select, label, .select2-selection__rendered').length) {
|
221 |
+
return false;
|
222 |
+
}
|
223 |
+
|
224 |
+
if (box.hasClass('closed')) {
|
225 |
+
box.removeClass('closed open').addClass('open');
|
226 |
+
content.slideDown();
|
227 |
+
} else {
|
228 |
+
box.removeClass('closed open').addClass('closed');
|
229 |
+
content.slideUp();
|
230 |
+
}
|
231 |
+
});
|
232 |
+
}
|
233 |
+
}, {
|
234 |
+
key: "AttributeTypeSwitch",
|
235 |
+
value: function AttributeTypeSwitch() {
|
236 |
+
var $wrapper = $('#woo_variation_swatches_variation_product_options') // ATTRIBUTE TYPE
|
237 |
+
.on('change', 'select.woo_variation_swatches_attribute_type_switch', function (event) {
|
238 |
+
var value = $(this).val();
|
239 |
+
|
240 |
+
if (['select'].includes(value)) {// $(this).closest('.wc-metabox').find('.wc-metabox-content select.woo_variation_swatches_attribute_term_type_switch').val('').trigger('change');
|
241 |
+
}
|
242 |
+
|
243 |
+
if (['image', 'color', 'button'].includes(value)) {
|
244 |
+
$(this).closest('.wc-metabox').find('.wc-metabox-content select.woo_variation_swatches_attribute_term_type_switch').val(value).trigger('change');
|
245 |
+
}
|
246 |
+
}) // TERM TYPE
|
247 |
+
.on('change', 'select.woo_variation_swatches_attribute_term_type_switch', function (event) {
|
248 |
+
var attribute_type = $(this).closest('.woo-variation-swatches-attribute-options-wrapper').find('select.woo_variation_swatches_attribute_type_switch').val();
|
249 |
+
|
250 |
+
if ($(this).val() !== attribute_type) {
|
251 |
+
$(this).closest('.woo-variation-swatches-attribute-options-wrapper').find('select.woo_variation_swatches_attribute_type_switch').val('mixed').trigger('change');
|
252 |
+
}
|
253 |
+
});
|
254 |
+
}
|
255 |
+
}, {
|
256 |
+
key: "SetAttributeTypePaging",
|
257 |
+
value: function SetAttributeTypePaging(selector) {
|
258 |
+
var attribute_type_val = $(selector).closest('.woo-variation-swatches-attribute-options-wrapper').find('select.woo_variation_swatches_attribute_type_switch').val();
|
259 |
+
var new_mode = $(selector).find('select.woo_variation_swatches_attribute_term_type_switch').hasClass('new-mode'); // Set based on attribute value
|
260 |
+
|
261 |
+
if (['image', 'color', 'button'].includes(attribute_type_val)) {
|
262 |
+
$(selector).find('select.woo_variation_swatches_attribute_term_type_switch.new-mode').val(attribute_type_val).trigger('change');
|
263 |
+
}
|
264 |
|
265 |
+
$(selector).find('select.woo_variation_swatches_attribute_term_type_switch.new-mode').each(function () {
|
266 |
+
var value = $(this).val();
|
|
|
|
|
|
|
|
|
267 |
|
268 |
+
if (!value) {// $(this).trigger('change')
|
269 |
+
}
|
270 |
+
});
|
271 |
+
}
|
272 |
+
}, {
|
273 |
+
key: "LoadProductAttributes",
|
274 |
+
value: function LoadProductAttributes() {
|
275 |
+
$('#woocommerce-product-data').on('woocommerce_variations_loaded', function (event) {
|
276 |
+
var $wrapper = $('#woo_variation_swatches_variation_product_options');
|
277 |
+
var product_id = $wrapper.data('product_id');
|
278 |
+
$.ajax({
|
279 |
+
global: false,
|
280 |
+
url: woo_variation_swatches_admin.wc_ajax_url.toString().replace('%%endpoint%%', 'woo_variation_swatches_load_product_options'),
|
281 |
+
method: 'POST',
|
282 |
+
data: {
|
283 |
+
product_id: product_id,
|
284 |
+
nonce: woo_variation_swatches_admin.nonce
|
285 |
+
},
|
286 |
+
beforeSend: function beforeSend(xhr, settings) {
|
287 |
+
$('#woo_variation_swatches_variation_product_options_inner').block({
|
288 |
+
message: null,
|
289 |
+
overlayCSS: {
|
290 |
+
background: '#DDDDDD',
|
291 |
+
opacity: 0.6
|
292 |
+
}
|
293 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
294 |
}
|
295 |
+
}).fail(function (jqXHR, textStatus) {
|
296 |
+
console.error("not load option: ".concat(product_id, "."), textStatus);
|
297 |
+
}).always(function () {
|
298 |
+
$('#woo_variation_swatches_variation_product_options_inner').unblock();
|
299 |
+
}).done(function (contents) {
|
300 |
+
$(document.body).trigger('woo_variation_swatches_variation_product_options_loaded', product_id);
|
301 |
+
});
|
302 |
+
});
|
303 |
+
}
|
304 |
+
}, {
|
305 |
+
key: "SaveProductAttributes",
|
306 |
+
value: function SaveProductAttributes() {
|
307 |
+
var changed = false;
|
308 |
+
var $wrapper = $('#woo_variation_swatches_variation_product_options');
|
309 |
+
$wrapper.on('change input color-changed', ':input:not(.wvs-skip-field)', function () {
|
310 |
+
if (!changed) {
|
311 |
+
window.onbeforeunload = function () {
|
312 |
+
return woo_variation_swatches_admin.nav_warning;
|
313 |
+
};
|
314 |
+
|
315 |
+
changed = true;
|
316 |
+
}
|
317 |
+
}).on('click', '.woo_variation_swatches_save_product_attributes, .woo_variation_swatches_reset_product_attributes', function () {
|
318 |
+
window.onbeforeunload = '';
|
319 |
+
}).on('click', '.woo_variation_swatches_save_product_attributes', function (event) {
|
320 |
+
event.preventDefault();
|
321 |
+
var data = $wrapper.find(':input:not(.wvs-skip-field)').serializeJSON({
|
322 |
+
disableColonTypes: true
|
323 |
+
});
|
324 |
+
var key = Object.keys(data) ? Object.keys(data).shift() : 'woo_variation_swatches_product_options';
|
325 |
+
var product_id = $wrapper.data('product_id');
|
326 |
+
var timeOut;
|
327 |
+
$.ajax({
|
328 |
+
global: false,
|
329 |
+
url: woo_variation_swatches_admin.wc_ajax_url.toString().replace('%%endpoint%%', 'woo_variation_swatches_save_product_options'),
|
330 |
+
method: 'POST',
|
331 |
+
data: {
|
332 |
+
data: data[key],
|
333 |
+
product_id: product_id,
|
334 |
+
nonce: woo_variation_swatches_admin.nonce
|
335 |
+
},
|
336 |
+
beforeSend: function beforeSend(xhr, settings) {
|
337 |
+
clearTimeout(timeOut);
|
338 |
+
$('#woo_variation_swatches_variation_product_options_inner').block({
|
339 |
+
message: null,
|
340 |
+
overlayCSS: {
|
341 |
+
background: '#DDDDDD',
|
342 |
+
opacity: 0.6
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
343 |
}
|
344 |
+
});
|
345 |
}
|
346 |
+
}).fail(function (jqXHR, textStatus) {
|
347 |
+
console.error("not saved on: ".concat(product_id, "."), textStatus);
|
348 |
+
}).always(function () {
|
349 |
+
$('#woo_variation_swatches_variation_product_options_inner').unblock();
|
350 |
+
}).done(function (contents) {
|
351 |
+
$('#saved-message').show();
|
352 |
+
timeOut = setTimeout(function () {
|
353 |
+
$('#saved-message').hide(600);
|
354 |
+
}, 5000);
|
355 |
+
$(document.body).trigger('woo_variation_swatches_variation_product_options_saved', product_id);
|
356 |
+
});
|
357 |
+
}).on('click', '.woo_variation_swatches_reset_product_attributes', function (event) {
|
358 |
+
event.preventDefault();
|
359 |
+
|
360 |
+
if (confirm(woo_variation_swatches_admin.reset_notice)) {
|
361 |
+
var product_id = $(this).data('product_id');
|
362 |
+
$.ajax({
|
363 |
+
global: false,
|
364 |
+
url: woo_variation_swatches_admin.wc_ajax_url.toString().replace('%%endpoint%%', 'woo_variation_swatches_reset_product_options'),
|
365 |
+
method: 'POST',
|
366 |
+
data: {
|
367 |
+
product_id: product_id,
|
368 |
+
nonce: woo_variation_swatches_admin.nonce
|
369 |
+
},
|
370 |
+
beforeSend: function beforeSend(xhr, settings) {
|
371 |
+
$('#woo_variation_swatches_variation_product_options_inner').block({
|
372 |
+
message: null,
|
373 |
+
overlayCSS: {
|
374 |
+
background: '#DDDDDD',
|
375 |
+
opacity: 0.6
|
376 |
+
}
|
377 |
+
});
|
378 |
+
}
|
379 |
+
}).fail(function (jqXHR, textStatus) {
|
380 |
+
console.error("not reset on: ".concat(product_id, "."), textStatus);
|
381 |
+
}).always(function () {
|
382 |
+
$('#woo_variation_swatches_variation_product_options_inner').unblock();
|
383 |
+
}).done(function (contents) {
|
384 |
+
var $html = $(contents).find('#woo_variation_swatches_variation_product_options_inner').html();
|
385 |
+
$('#woo_variation_swatches_variation_product_options_inner').html($html); // $('#woocommerce-product-data').trigger('woocommerce_variations_loaded')
|
386 |
+
|
387 |
+
$(document.body).trigger('woo_variation_swatches_variation_product_options_reset', product_id);
|
388 |
+
});
|
389 |
+
}
|
390 |
+
});
|
391 |
+
}
|
392 |
+
}, {
|
393 |
+
key: "ResetProductAttributes",
|
394 |
+
value: function ResetProductAttributes() {
|
395 |
+
var $wrapper = $('#woo_variation_swatches_variation_product_options');
|
396 |
+
}
|
397 |
+
}, {
|
398 |
+
key: "Pagination",
|
399 |
+
value: function Pagination() {
|
400 |
+
var _this = this;
|
401 |
+
|
402 |
+
var changed = false;
|
403 |
+
var $wrapper = $('#woo_variation_swatches_variation_product_options');
|
404 |
+
$wrapper.on('change input color-changed', ':input:not(.wvs-skip-field)', function (event) {
|
405 |
+
if (!changed) {
|
406 |
+
changed = true;
|
407 |
+
}
|
408 |
+
}).on('click', '.woo_variation_swatches_reset_product_attributes', function (event) {
|
409 |
+
event.preventDefault();
|
410 |
+
changed = false;
|
411 |
+
}).on('click', '.woo_variation_swatches_save_product_attributes', function (event) {
|
412 |
+
event.preventDefault();
|
413 |
+
changed = false;
|
414 |
+
}).on('click', '.first-page:not(.disabled), .prev-page:not(.disabled), .last-page:not(.disabled), .next-page:not(.disabled)', function (event) {
|
415 |
+
if (changed) {
|
416 |
+
event.preventDefault();
|
417 |
+
event.stopPropagation();
|
418 |
+
event.stopImmediatePropagation();
|
419 |
+
alert(woo_variation_swatches_admin.nav_warning);
|
420 |
+
}
|
421 |
+
}).on('click', '.first-page.disabled, .prev-page.disabled, .last-page.disabled, .next-page.disabled', function (event) {
|
422 |
+
event.preventDefault();
|
423 |
+
}).on('click', '.first-page:not(.disabled)', function (event) {
|
424 |
+
event.preventDefault();
|
425 |
+
var $selector = $(event.currentTarget).closest('.product-term-label-settings').find('.product-term-label-settings-contents');
|
426 |
+
var $this = $(event.currentTarget).closest('.product-term-label-settings-pagination');
|
427 |
+
var $product_id = $selector.data('product_id');
|
428 |
+
var $attribute_id = $selector.data('attribute_id');
|
429 |
+
var $attribute_name = $selector.data('attribute_name');
|
430 |
+
var $offset = 0;
|
431 |
+
|
432 |
+
_this.PaginationAjax($product_id, $attribute_id, $attribute_name, $offset, $selector);
|
433 |
+
|
434 |
+
$this.find('.next-page, .last-page').removeClass('disabled');
|
435 |
+
$this.find('.current-page').text(1);
|
436 |
+
$selector.data('current', 1);
|
437 |
+
$this.find('.first-page, .prev-page').addClass('disabled');
|
438 |
+
}).on('click', '.prev-page:not(.disabled)', function (event) {
|
439 |
+
event.preventDefault();
|
440 |
+
var $selector = $(event.currentTarget).closest('.product-term-label-settings').find('.product-term-label-settings-contents');
|
441 |
+
var $this = $(event.currentTarget).closest('.product-term-label-settings-pagination');
|
442 |
+
$selector.block({
|
443 |
+
message: null,
|
444 |
+
overlayCSS: {
|
445 |
+
background: '#DDDDDD',
|
446 |
+
opacity: 0.6
|
447 |
}
|
448 |
+
});
|
449 |
+
var $product_id = $selector.data('product_id');
|
450 |
+
var $pages = $selector.data('pages');
|
451 |
+
var $attribute_id = $selector.data('attribute_id');
|
452 |
+
var $attribute_name = $selector.data('attribute_name');
|
453 |
+
var $current = $selector.data('current'); // 1
|
454 |
+
|
455 |
+
var $limit = $selector.data('limit'); // 3
|
456 |
+
|
457 |
+
var $total = $selector.data('total');
|
458 |
+
var $offset = ($current - 1) * $limit - $limit;
|
459 |
+
var $prev = $current - 1;
|
460 |
+
|
461 |
+
_this.PaginationAjax($product_id, $attribute_id, $attribute_name, $offset, $selector);
|
462 |
+
|
463 |
+
$this.find('.next-page, .last-page').removeClass('disabled');
|
464 |
+
$this.find('.current-page').text($prev);
|
465 |
+
$selector.data('current', $prev);
|
466 |
+
|
467 |
+
if ($offset === 0) {
|
468 |
+
$this.find('.first-page, .prev-page').addClass('disabled');
|
469 |
+
}
|
470 |
+
}).on('click', '.next-page:not(.disabled)', function (event) {
|
471 |
+
event.preventDefault();
|
472 |
+
var $selector = $(event.currentTarget).closest('.product-term-label-settings').find('.product-term-label-settings-contents');
|
473 |
+
var $this = $(event.currentTarget).closest('.product-term-label-settings-pagination');
|
474 |
+
$selector.block({
|
475 |
+
message: null,
|
476 |
+
overlayCSS: {
|
477 |
+
background: '#DDDDDD',
|
478 |
+
opacity: 0.6
|
479 |
}
|
480 |
+
});
|
481 |
+
var $product_id = $selector.data('product_id');
|
482 |
+
var $pages = $selector.data('pages');
|
483 |
+
var $attribute_id = $selector.data('attribute_id');
|
484 |
+
var $attribute_name = $selector.data('attribute_name');
|
485 |
+
var $current = $selector.data('current'); // 1
|
486 |
+
|
487 |
+
var $limit = $selector.data('limit'); // 3
|
488 |
+
|
489 |
+
var $total = $selector.data('total');
|
490 |
+
var $offset = $current * $limit;
|
491 |
+
var $next = $current + 1;
|
492 |
+
|
493 |
+
_this.PaginationAjax($product_id, $attribute_id, $attribute_name, $offset, $selector);
|
494 |
+
|
495 |
+
$this.find('.first-page, .prev-page').removeClass('disabled');
|
496 |
+
$this.find('.current-page').text($next);
|
497 |
+
$selector.data('current', $next);
|
498 |
+
|
499 |
+
if ($pages === $next) {
|
500 |
+
$this.find('.next-page, .last-page').addClass('disabled');
|
501 |
+
}
|
502 |
+
}).on('click', '.last-page:not(.disabled)', function (event) {
|
503 |
+
event.preventDefault();
|
504 |
+
var $selector = $(event.currentTarget).closest('.product-term-label-settings').find('.product-term-label-settings-contents');
|
505 |
+
var $this = $(event.currentTarget).closest('.product-term-label-settings-pagination');
|
506 |
+
$selector.block({
|
507 |
+
message: null,
|
508 |
+
overlayCSS: {
|
509 |
+
background: '#DDDDDD',
|
510 |
+
opacity: 0.6
|
511 |
}
|
512 |
+
});
|
513 |
+
var $product_id = $selector.data('product_id');
|
514 |
+
var $pages = $selector.data('pages');
|
515 |
+
var $attribute_id = $selector.data('attribute_id');
|
516 |
+
var $attribute_name = $selector.data('attribute_name');
|
517 |
+
var $current = $selector.data('current'); // 1
|
518 |
|
519 |
+
var $limit = $selector.data('limit'); // 3
|
520 |
+
|
521 |
+
var $offset = $pages * $limit - $limit;
|
522 |
+
|
523 |
+
_this.PaginationAjax($product_id, $attribute_id, $attribute_name, $offset, $selector);
|
524 |
+
|
525 |
+
$this.find('.first-page, .prev-page').removeClass('disabled');
|
526 |
+
$this.find('.current-page').text($pages);
|
527 |
+
$selector.data('current', $pages);
|
528 |
+
$this.find('.next-page, .last-page').addClass('disabled');
|
529 |
+
});
|
530 |
+
}
|
531 |
+
}, {
|
532 |
+
key: "ResetAfterTermCreate",
|
533 |
+
value: function ResetAfterTermCreate() {
|
534 |
+
$(document).ajaxComplete(function (event, request, settings) {
|
535 |
+
try {
|
536 |
+
var data = Object.fromEntries(new URLSearchParams(settings.data));
|
537 |
+
|
538 |
+
if ('add-tag' === data.action && '' === $('#tag-name').val()) {
|
539 |
+
$(document.body).trigger('woo_variation_swatches_admin_term_meta_added', data);
|
540 |
+
}
|
541 |
+
} catch (err) {}
|
542 |
+
});
|
543 |
+
}
|
544 |
+
}, {
|
545 |
+
key: "ImageUploader",
|
546 |
+
value: function ImageUploader() {
|
547 |
+
$(document.body).off('click', 'button.wvs_upload_image_button');
|
548 |
+
$(document.body).on('click', 'button.wvs_upload_image_button', this.AddImage);
|
549 |
+
$(document.body).on('click', 'button.wvs_remove_image_button', this.RemoveImage);
|
550 |
+
$(document.body).on('woo_variation_swatches_admin_term_meta_added', this.ClearImagePicker);
|
551 |
+
$(document.body).on('woo_variation_swatches_admin_term_meta_added', this.ClearColorPicker); // $(document.body).on('woo_variation_swatches_admin_term_meta_added', this.ResetTagForm);
|
552 |
+
}
|
553 |
+
}, {
|
554 |
+
key: "AddImage",
|
555 |
+
value: function AddImage(event) {
|
556 |
+
var _this2 = this;
|
557 |
+
|
558 |
+
event.preventDefault();
|
559 |
+
event.stopPropagation();
|
560 |
+
var file_frame;
|
561 |
+
|
562 |
+
if (typeof wp !== 'undefined' && wp.media && wp.media.editor) {
|
563 |
+
// If the media frame already exists, reopen it.
|
564 |
+
if (file_frame) {
|
565 |
+
file_frame.open();
|
566 |
+
return;
|
567 |
+
} // Create the media frame.
|
568 |
+
|
569 |
+
|
570 |
+
file_frame = wp.media.frames.select_image = wp.media({
|
571 |
+
title: woo_variation_swatches_admin.media_title,
|
572 |
+
button: {
|
573 |
+
text: woo_variation_swatches_admin.button_title
|
574 |
+
},
|
575 |
+
multiple: false
|
576 |
+
}); // When an image is selected, run a callback.
|
577 |
+
|
578 |
+
file_frame.on('select', function () {
|
579 |
+
var attachment = file_frame.state().get('selection').first().toJSON();
|
580 |
+
|
581 |
+
if ($.trim(attachment.id) !== '') {
|
582 |
+
var url = typeof attachment.sizes.thumbnail === 'undefined' ? attachment.sizes.full.url : attachment.sizes.thumbnail.url;
|
583 |
+
$(_this2).prev().val(attachment.id);
|
584 |
+
$(_this2).closest('.meta-image-field-wrapper').find('img').attr('src', url);
|
585 |
+
$(_this2).next().show();
|
586 |
+
} //file_frame.close();
|
587 |
+
|
588 |
+
}); // When open select selected
|
589 |
+
|
590 |
+
file_frame.on('open', function () {
|
591 |
+
// Grab our attachment selection and construct a JSON representation of the model.
|
592 |
+
var selection = file_frame.state().get('selection');
|
593 |
+
var current = $(_this2).prev().val();
|
594 |
+
var attachment = wp.media.attachment(current);
|
595 |
+
attachment.fetch();
|
596 |
+
selection.add(attachment ? [attachment] : []);
|
597 |
+
}); // Finally, open the modal.
|
598 |
+
|
599 |
+
file_frame.open();
|
600 |
+
}
|
601 |
+
}
|
602 |
+
}, {
|
603 |
+
key: "RemoveImage",
|
604 |
+
value: function RemoveImage(event) {
|
605 |
+
event.preventDefault();
|
606 |
+
event.stopPropagation();
|
607 |
+
var placeholder = $(this).closest('.meta-image-field-wrapper').find('img').data('placeholder');
|
608 |
+
$(this).closest('.meta-image-field-wrapper').find('img').attr('src', placeholder);
|
609 |
+
$(this).prev().prev().val('');
|
610 |
+
$(this).hide();
|
611 |
+
return false;
|
612 |
+
}
|
613 |
+
}, {
|
614 |
+
key: "ClearImagePicker",
|
615 |
+
value: function ClearImagePicker() {
|
616 |
+
$('#addtag').find('.wvs_remove_image_button').trigger('click');
|
617 |
+
}
|
618 |
+
}, {
|
619 |
+
key: "__SelectWoo",
|
620 |
+
value: function __SelectWoo() {
|
621 |
+
var selector = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'select.wvs-select-woo';
|
622 |
+
|
623 |
+
try {
|
624 |
+
$(document.body).on('woo_variation_swatches_select_woo_init', function (event) {
|
625 |
+
$(selector).selectWoo({
|
626 |
+
allowClear: true
|
627 |
+
});
|
628 |
+
}).trigger('woo_variation_swatches_select_woo_init');
|
629 |
+
} catch (err) {
|
630 |
+
// If failed (conflict?) log the error but don't stop other scripts breaking.
|
631 |
+
window.console.log(err);
|
632 |
+
}
|
633 |
+
}
|
634 |
+
}, {
|
635 |
+
key: "InitTooltip",
|
636 |
+
value: function InitTooltip() {
|
637 |
+
$(document.body).trigger('init_tooltips');
|
638 |
+
}
|
639 |
+
}, {
|
640 |
+
key: "SelectWoo",
|
641 |
+
value: function SelectWoo() {
|
642 |
+
try {
|
643 |
+
$(document.body).trigger('wc-enhanced-select-init');
|
644 |
+
} catch (err) {
|
645 |
+
// If failed (conflict?) log the error but don't stop other scripts breaking.
|
646 |
+
window.console.log(err);
|
647 |
+
}
|
648 |
+
}
|
649 |
+
}, {
|
650 |
+
key: "ColorPicker",
|
651 |
+
value: function ColorPicker() {
|
652 |
+
var selector = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'input.wvs-color-picker';
|
653 |
+
|
654 |
+
try {
|
655 |
+
$(document.body).on('woo_variation_swatches_color_picker_init', function (event) {
|
656 |
+
$(selector).wpColorPicker({
|
657 |
+
change: function change(event, ui) {
|
658 |
+
$(selector).trigger('color-changed');
|
659 |
+
},
|
660 |
+
clear: function clear() {
|
661 |
+
$(selector).trigger('color-changed');
|
662 |
+
}
|
663 |
+
});
|
664 |
+
}).trigger('woo_variation_swatches_color_picker_init');
|
665 |
+
} catch (err) {
|
666 |
+
// If failed (conflict?) log the error but don't stop other scripts breaking.
|
667 |
+
window.console.log(err);
|
668 |
+
}
|
669 |
+
}
|
670 |
+
}, {
|
671 |
+
key: "ClearColorPicker",
|
672 |
+
value: function ClearColorPicker() {
|
673 |
+
$('#addtag').find('.wp-picker-clear').trigger('click');
|
674 |
+
}
|
675 |
+
}, {
|
676 |
+
key: "FieldDependency",
|
677 |
+
value: function FieldDependency() {
|
678 |
+
var selector = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '[data-dependency]';
|
679 |
+
|
680 |
+
try {
|
681 |
+
$(document.body).on('init_form_field_dependency', function () {
|
682 |
+
$(selector).GWPFormFieldDependency();
|
683 |
+
}).trigger('init_form_field_dependency');
|
684 |
+
} catch (err) {
|
685 |
+
// If failed (conflict?) log the error but don't stop other scripts breaking.
|
686 |
+
window.console.log(err);
|
687 |
+
}
|
688 |
+
}
|
689 |
+
}, {
|
690 |
+
key: "savingDialog",
|
691 |
+
value: function savingDialog($wrapper, $dialog, taxonomy) {
|
692 |
+
var data = {};
|
693 |
+
var term = ''; // @TODO: We should use form data, because we have to pick array based data also :)
|
694 |
+
|
695 |
+
$dialog.find("input, select").each(function () {
|
696 |
+
var key = $(this).attr('name');
|
697 |
+
var value = $(this).val();
|
698 |
+
|
699 |
+
if (key) {
|
700 |
+
if (key === 'tag_name') {
|
701 |
+
term = value;
|
702 |
+
} else {
|
703 |
+
data[key] = value;
|
704 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
705 |
|
706 |
+
$(this).val('');
|
707 |
+
}
|
708 |
+
});
|
709 |
+
|
710 |
+
if (term) {
|
711 |
+
$('.product_attributes').block({
|
712 |
+
message: null,
|
713 |
+
overlayCSS: {
|
714 |
+
background: '#FFFFFF',
|
715 |
+
opacity: 0.6
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
716 |
}
|
717 |
+
});
|
718 |
+
|
719 |
+
var ajax_data = _objectSpread({
|
720 |
+
action: 'woocommerce_add_new_attribute',
|
721 |
+
taxonomy: taxonomy,
|
722 |
+
term: term,
|
723 |
+
security: woocommerce_admin_meta_boxes.add_attribute_nonce
|
724 |
+
}, data);
|
725 |
+
|
726 |
+
$.post(woocommerce_admin_meta_boxes.ajax_url, ajax_data, function (response) {
|
727 |
+
if (response.error) {
|
728 |
+
// Error.
|
729 |
+
window.alert(response.error);
|
730 |
+
} else if (response.slug) {
|
731 |
+
// Success.
|
732 |
+
$wrapper.find('select.attribute_values').append('<option value="' + response.term_id + '" selected="selected">' + response.name + '</option>');
|
733 |
+
$wrapper.find('select.attribute_values').change();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
734 |
}
|
|
|
735 |
|
736 |
+
$('.product_attributes').unblock();
|
737 |
+
});
|
738 |
+
} else {
|
739 |
+
$('.product_attributes').unblock();
|
740 |
+
}
|
741 |
+
}
|
742 |
+
}, {
|
743 |
+
key: "AttributeDialog",
|
744 |
+
value: function AttributeDialog() {
|
745 |
+
var self = this;
|
746 |
+
$('.product_attributes').on('click', 'button.wvs_add_new_attribute', function (event) {
|
747 |
+
event.preventDefault();
|
748 |
+
var $wrapper = $(this).closest('.woocommerce_attribute');
|
749 |
+
var attribute = $wrapper.data('taxonomy');
|
750 |
+
var title = $(this).data('dialog_title');
|
751 |
+
$('.wvs-attribute-dialog-for-' + attribute).dialog({
|
752 |
+
title: '',
|
753 |
+
dialogClass: 'wp-dialog wvs-attribute-dialog',
|
754 |
+
classes: {
|
755 |
+
"ui-dialog": "wp-dialog wvs-attribute-dialog"
|
756 |
+
},
|
757 |
+
autoOpen: false,
|
758 |
+
draggable: true,
|
759 |
+
width: 'auto',
|
760 |
+
modal: true,
|
761 |
+
resizable: false,
|
762 |
+
closeOnEscape: true,
|
763 |
+
position: {
|
764 |
+
my: "center",
|
765 |
+
at: "center",
|
766 |
+
of: window
|
767 |
+
},
|
768 |
+
open: function open() {
|
769 |
+
// close dialog by clicking the overlay behind it
|
770 |
+
$('.ui-widget-overlay').bind('click', function () {
|
771 |
+
$('#attribute-dialog').dialog('close');
|
772 |
+
});
|
773 |
+
},
|
774 |
+
create: function create() {// style fix for WordPress admin
|
775 |
+
// $('.ui-dialog-titlebar-close').addClass('ui-button');
|
776 |
+
}
|
777 |
+
}).dialog("option", "title", title).dialog("option", "buttons", [{
|
778 |
+
text: woo_variation_swatches_admin.dialog_save,
|
779 |
+
click: function click() {
|
780 |
+
self.savingDialog($wrapper, $(this), attribute);
|
781 |
+
$(this).dialog("close").dialog("destroy");
|
782 |
+
}
|
783 |
+
}, {
|
784 |
+
text: woo_variation_swatches_admin.dialog_cancel,
|
785 |
+
click: function click() {
|
786 |
+
$(this).dialog("close").dialog("destroy");
|
787 |
+
}
|
788 |
+
}]).dialog('open');
|
789 |
+
});
|
790 |
+
}
|
791 |
+
}]);
|
792 |
|
793 |
return PluginHelper;
|
794 |
+
}();
|
795 |
+
|
796 |
+
return PluginHelper;
|
797 |
}(jQuery);
|
798 |
|
799 |
|
800 |
|
801 |
/***/ }),
|
|
|
|
|
802 |
|
803 |
+
/***/ "./src/js/backend.js":
|
804 |
+
/***/ (function(module, exports, __webpack_require__) {
|
805 |
|
806 |
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
|
|
|
807 |
|
808 |
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
809 |
|
810 |
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
|
|
|
811 |
|
812 |
+
jQuery(function ($) {
|
813 |
+
Promise.resolve().then(function () {
|
814 |
+
return _interopRequireWildcard(__webpack_require__("./src/js/PluginHelper.js"));
|
815 |
+
}).then(function (_ref) {
|
816 |
+
var PluginHelper = _ref.PluginHelper;
|
817 |
+
// PluginHelper.GWPAdmin();
|
818 |
+
// TERM PAGE
|
819 |
+
PluginHelper.ResetAfterTermCreate();
|
820 |
+
PluginHelper.ColorPicker();
|
821 |
+
PluginHelper.ImageUploader();
|
822 |
+
PluginHelper.FieldDependency(); // PRODUCT PAGE
|
823 |
+
|
824 |
+
PluginHelper.Pagination();
|
825 |
+
PluginHelper.MetaboxToggle();
|
826 |
+
PluginHelper.AttributeTypeSwitch();
|
827 |
+
PluginHelper.SaveProductAttributes(); // PluginHelper.ResetProductAttributes();
|
828 |
+
// PluginHelper.AttributeDialog();
|
829 |
+
|
830 |
+
/*$(document.body).on('woo_variation_swatches_variation_product_options_reset', (event, $selector) => {
|
831 |
+
PluginHelper.InitTooltip();
|
832 |
+
PluginHelper.SelectWoo();
|
833 |
+
PluginHelper.ColorPicker();
|
834 |
+
PluginHelper.FieldDependency();
|
835 |
+
PluginHelper.SetAttributeTypePaging($selector);
|
836 |
+
})*/
|
837 |
+
|
838 |
+
$(document.body).on('woo_variation_swatches_variation_product_options_reset woo_variation_swatches_product_term_paging_done', function (event, $selector) {
|
839 |
+
PluginHelper.InitTooltip();
|
840 |
+
PluginHelper.SelectWoo();
|
841 |
+
PluginHelper.ColorPicker();
|
842 |
+
PluginHelper.FieldDependency();
|
843 |
+
PluginHelper.SetAttributeTypePaging($selector);
|
844 |
+
});
|
845 |
+
/*$('#woocommerce-product-data').on('woocommerce_variations_loaded', function () {
|
846 |
+
PluginHelper.GalleryNotification();
|
847 |
+
});
|
848 |
+
$('#variable_product_options').on('woocommerce_variations_added', function () {
|
849 |
+
PluginHelper.GalleryNotification();
|
850 |
+
});
|
851 |
+
$(document.body).on('woocommerce_added_attribute', function () {
|
852 |
+
PluginHelper.SelectWoo();
|
853 |
+
PluginHelper.ColorPicker();
|
854 |
+
PluginHelper.ImageUploader();
|
855 |
+
PluginHelper.AttributeDialog();
|
856 |
+
});
|
857 |
+
$(document.body).on('wvs_pro_product_swatches_variation_loaded', () => {
|
858 |
+
PluginHelper.ColorPicker();
|
859 |
+
PluginHelper.ImageUploader();
|
860 |
+
});*/
|
861 |
+
});
|
862 |
+
}); // end of jquery main wrapper
|
863 |
|
864 |
/***/ }),
|
865 |
+
|
866 |
+
/***/ "./src/scss/backend.scss":
|
867 |
/***/ (function(module, exports) {
|
868 |
|
869 |
// removed by extract-text-webpack-plugin
|
870 |
|
871 |
/***/ }),
|
872 |
+
|
873 |
+
/***/ "./src/scss/frontend.scss":
|
874 |
/***/ (function(module, exports) {
|
875 |
|
876 |
// removed by extract-text-webpack-plugin
|
877 |
|
878 |
/***/ }),
|
|
|
|
|
879 |
|
880 |
+
/***/ 0:
|
881 |
+
/***/ (function(module, exports, __webpack_require__) {
|
882 |
+
|
883 |
+
__webpack_require__("./src/js/backend.js");
|
884 |
+
__webpack_require__("./src/scss/backend.scss");
|
885 |
+
module.exports = __webpack_require__("./src/scss/frontend.scss");
|
886 |
+
|
887 |
|
888 |
/***/ })
|
889 |
+
|
890 |
+
/******/ });
|
assets/js/admin.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e){var t={};function o(i){if(t[i])return t[i].exports;var a=t[i]={i:i,l:!1,exports:{}};return e[i].call(a.exports,a,a.exports,o),a.l=!0,a.exports}o.m=e,o.c=t,o.d=function(e,t,i){o.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:i})},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=0)}([function(e,t,o){o(1),o(3),o(4),o(5),o(6),o(7),e.exports=o(8)},function(e,t,o){jQuery(function(e){Promise.resolve().then(function(){return o(2)}).then(function(t){var o=t.PluginHelper;o.GWPAdmin(),o.SelectWoo(),o.ColorPicker(),o.FieldDependency(),o.ImageUploader(),o.AttributeDialog(),e("#woocommerce-product-data").on("woocommerce_variations_loaded",function(){o.GalleryNotification()}),e("#variable_product_options").on("woocommerce_variations_added",function(){o.GalleryNotification()}),e(document.body).on("woocommerce_added_attribute",function(){o.SelectWoo(),o.ColorPicker(),o.ImageUploader(),o.AttributeDialog()}),e(document.body).on("wvs_pro_product_swatches_variation_loaded",function(){o.ColorPicker(),o.ImageUploader()})})})},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),o.d(t,"PluginHelper",function(){return r});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(e[i]=o[i])}return e},a=function(){function e(e,t){for(var o=0;o<t.length;o++){var i=t[o];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,o,i){return o&&e(t.prototype,o),i&&e(t,i),t}}();var n,r=(n=jQuery,function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return a(e,null,[{key:"GWPAdmin",value:function(){n().gwp_live_feed&&n().gwp_live_feed(),n().gwp_deactivate_popup&&n().gwp_deactivate_popup("woo-variation-swatches")}},{key:"GalleryNotification",value:function(){n(".woocommerce_variation").each(function(){var e=n(this).find(".options:first");n(this).find(".woo-variation-gallery-message").insertBefore(e)}),n("input.upload_image_id").on("change",function(e){n.trim(n(this).val())?n(this).closest(".data").find(".woo-variation-gallery-message").addClass("enable"):n(this).closest(".data").find(".woo-variation-gallery-message").removeClass("enable")}),n("a.install-woo-variation-gallery-action").on("click",function(e){e.preventDefault();var t=n(this).parent(),o=t.data("installing"),i=t.data("activated"),a=t.data("nonce");t.text(o),wp.ajax.send("install_woo_variation_gallery",{data:{nonce:a},success:function(e){t.text(i),_.delay(function(){n(".woocommerce_variable_attributes .woo-variation-gallery-message").remove()},5e3)},error:function(e){t.text(i),_.delay(function(){n(".woocommerce_variable_attributes .woo-variation-gallery-message").remove()},5e3)}})})}},{key:"ImageUploader",value:function(){n(document).off("click","button.wvs_upload_image_button"),n(document).on("click","button.wvs_upload_image_button",this.AddImage),n(document).on("click","button.wvs_remove_image_button",this.RemoveImage)}},{key:"AddImage",value:function(e){var t=this;e.preventDefault(),e.stopPropagation();var o=void 0;if("undefined"!=typeof wp&&wp.media&&wp.media.editor){if(o)return void o.open();(o=wp.media.frames.select_image=wp.media({title:WVSPluginObject.media_title,button:{text:WVSPluginObject.button_title},multiple:!1})).on("select",function(){var e=o.state().get("selection").first().toJSON();if(""!==n.trim(e.id)){var i=void 0===e.sizes.thumbnail?e.sizes.full.url:e.sizes.thumbnail.url;n(t).prev().val(e.id),n(t).closest(".meta-image-field-wrapper").find("img").attr("src",i),n(t).next().show()}}),o.on("open",function(){var e=o.state().get("selection"),i=n(t).prev().val(),a=wp.media.attachment(i);a.fetch(),e.add(a?[a]:[])}),o.open()}}},{key:"RemoveImage",value:function(e){e.preventDefault(),e.stopPropagation();var t=n(this).closest(".meta-image-field-wrapper").find("img").data("placeholder");return n(this).closest(".meta-image-field-wrapper").find("img").attr("src",t),n(this).prev().prev().val(""),n(this).hide(),!1}},{key:"SelectWoo",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"select.wvs-selectwoo";n().selectWoo&&n(e).selectWoo({allowClear:!0})}},{key:"ColorPicker",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"input.wvs-color-picker";n().wpColorPicker&&n(e).wpColorPicker()}},{key:"FieldDependency",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"[data-wvsdepends]";n().FormFieldDependency&&n(e).FormFieldDependency()}},{key:"savingDialog",value:function(e,t,o){var a={},r="";if(t.find("input, select").each(function(){var e=n(this).attr("name"),t=n(this).val();e&&("tag_name"===e?r=t:a[e]=t,n(this).val(""))}),r){n(".product_attributes").block({message:null,overlayCSS:{background:"#FFFFFF",opacity:.6}});var l=i({action:"woocommerce_add_new_attribute",taxonomy:o,term:r,security:woocommerce_admin_meta_boxes.add_attribute_nonce},a);n.post(woocommerce_admin_meta_boxes.ajax_url,l,function(t){t.error?window.alert(t.error):t.slug&&(e.find("select.attribute_values").append('<option value="'+t.term_id+'" selected="selected">'+t.name+"</option>"),e.find("select.attribute_values").change()),n(".product_attributes").unblock()})}else n(".product_attributes").unblock()}},{key:"AttributeDialog",value:function(){var e=this;n(".product_attributes").on("click","button.wvs_add_new_attribute",function(t){t.preventDefault();var o=n(this).closest(".woocommerce_attribute"),i=o.data("taxonomy"),a=n(this).data("dialog_title");n(".wvs-attribute-dialog-for-"+i).dialog({title:"",dialogClass:"wp-dialog wvs-attribute-dialog",classes:{"ui-dialog":"wp-dialog wvs-attribute-dialog"},autoOpen:!1,draggable:!0,width:"auto",modal:!0,resizable:!1,closeOnEscape:!0,position:{my:"center",at:"center",of:window},open:function(){n(".ui-widget-overlay").bind("click",function(){n("#attribute-dialog").dialog("close")})},create:function(){}}).dialog("option","title",a).dialog("option","buttons",[{text:WVSPluginObject.dialog_save,click:function(){e.savingDialog(o,n(this),i),n(this).dialog("close").dialog("destroy")}},{text:WVSPluginObject.dialog_cancel,click:function(){n(this).dialog("close").dialog("destroy")}}]).dialog("open")})}}]),e}())},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){}]);
|
1 |
+
!function(t){var e={};function o(a){if(e[a])return e[a].exports;var n=e[a]={i:a,l:!1,exports:{}};return t[a].call(n.exports,n,n.exports,o),n.l=!0,n.exports}o.m=t,o.c=e,o.d=function(t,e,a){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:a})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(o.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)o.d(a,n,function(e){return t[e]}.bind(null,n));return a},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="/",o(o.s=0)}([function(t,e,o){o(1),o(8),t.exports=o(13)},function(t,e,o){function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function n(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,o=new WeakMap;return(n=function(t){return t?o:e})(t)}jQuery((function(t){Promise.resolve().then((function(){return function(t,e){if(!e&&t&&t.__esModule)return t;if(null===t||"object"!==a(t)&&"function"!=typeof t)return{default:t};var o=n(e);if(o&&o.has(t))return o.get(t);var i={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var c in t)if("default"!==c&&Object.prototype.hasOwnProperty.call(t,c)){var s=r?Object.getOwnPropertyDescriptor(t,c):null;s&&(s.get||s.set)?Object.defineProperty(i,c,s):i[c]=t[c]}return i.default=t,o&&o.set(t,i),i}(o(2))})).then((function(e){var o=e.PluginHelper;o.ResetAfterTermCreate(),o.ColorPicker(),o.ImageUploader(),o.FieldDependency(),o.Pagination(),o.MetaboxToggle(),o.AttributeTypeSwitch(),o.SaveProductAttributes(),t(document.body).on("woo_variation_swatches_variation_product_options_reset woo_variation_swatches_product_term_paging_done",(function(t,e){o.InitTooltip(),o.SelectWoo(),o.ColorPicker(),o.FieldDependency(),o.SetAttributeTypePaging(e)}))}))}))},function(t,e,o){"use strict";function a(t,e){var o=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),o.push.apply(o,a)}return o}function n(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function i(t,e){for(var o=0;o<e.length;o++){var a=e[o];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}o.r(e),o.d(e,"PluginHelper",(function(){return c}));var r,c=(r=jQuery,function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,o,c;return e=t,c=[{key:"GWPAdmin",value:function(){r().gwp_live_feed&&r().gwp_live_feed(),r().gwp_deactivate_popup&&r().gwp_deactivate_popup("woo-variation-swatches")}},{key:"GalleryNotification",value:function(){r(".woocommerce_variation").each((function(){var t=r(this).find(".options:first");r(this).find(".woo-variation-gallery-message").insertBefore(t)})),r("input.upload_image_id").on("change",(function(t){r.trim(r(this).val())?r(this).closest(".data").find(".woo-variation-gallery-message").addClass("enable"):r(this).closest(".data").find(".woo-variation-gallery-message").removeClass("enable")})),r("a.install-woo-variation-gallery-action").on("click",(function(t){t.preventDefault();var e=r(this).parent(),o=e.data("installing"),a=e.data("activated"),n=e.data("nonce");e.text(o),wp.ajax.send("install_woo_variation_gallery",{data:{nonce:n},success:function(t){e.text(a),_.delay((function(){r(".woocommerce_variable_attributes .woo-variation-gallery-message").remove()}),5e3)},error:function(t){e.text(a),_.delay((function(){r(".woocommerce_variable_attributes .woo-variation-gallery-message").remove()}),5e3)}})}))}},{key:"PaginationAjax",value:function(t,e,o,a,n){r.ajax({global:!1,url:woo_variation_swatches_admin.wc_ajax_url.toString().replace("%%endpoint%%","woo_variation_swatches_load_product_terms"),method:"POST",data:{offset:a,product_id:t,attribute_id:e,attribute_name:o,nonce:woo_variation_swatches_admin.nonce},beforeSend:function(t,e){n.block({message:null,overlayCSS:{background:"#DDDDDD",opacity:.6}})}}).fail((function(e,o){console.error("not available on: ".concat(t," ").concat($attribute_key,"."),o)})).always((function(){n.unblock()})).done((function(t){t&&(n.html(t),r(document.body).trigger("woo_variation_swatches_product_term_paging_done",n))}))}},{key:"MetaboxToggle",value:function(){r("#woo_variation_swatches_variation_product_options").on("click",".wc-metabox > h4",(function(t){var e=r(this).parent(".wc-metabox"),o=r(this).next(".wc-metabox-content");if(r(t.target).filter(":input, option, .sort, select, label, .select2-selection__rendered").length)return!1;e.hasClass("closed")?(e.removeClass("closed open").addClass("open"),o.slideDown()):(e.removeClass("closed open").addClass("closed"),o.slideUp())}))}},{key:"AttributeTypeSwitch",value:function(){r("#woo_variation_swatches_variation_product_options").on("change","select.woo_variation_swatches_attribute_type_switch",(function(t){var e=r(this).val();["select"].includes(e),["image","color","button"].includes(e)&&r(this).closest(".wc-metabox").find(".wc-metabox-content select.woo_variation_swatches_attribute_term_type_switch").val(e).trigger("change")})).on("change","select.woo_variation_swatches_attribute_term_type_switch",(function(t){var e=r(this).closest(".woo-variation-swatches-attribute-options-wrapper").find("select.woo_variation_swatches_attribute_type_switch").val();r(this).val()!==e&&r(this).closest(".woo-variation-swatches-attribute-options-wrapper").find("select.woo_variation_swatches_attribute_type_switch").val("mixed").trigger("change")}))}},{key:"SetAttributeTypePaging",value:function(t){var e=r(t).closest(".woo-variation-swatches-attribute-options-wrapper").find("select.woo_variation_swatches_attribute_type_switch").val();r(t).find("select.woo_variation_swatches_attribute_term_type_switch").hasClass("new-mode"),["image","color","button"].includes(e)&&r(t).find("select.woo_variation_swatches_attribute_term_type_switch.new-mode").val(e).trigger("change"),r(t).find("select.woo_variation_swatches_attribute_term_type_switch.new-mode").each((function(){r(this).val()}))}},{key:"LoadProductAttributes",value:function(){r("#woocommerce-product-data").on("woocommerce_variations_loaded",(function(t){var e=r("#woo_variation_swatches_variation_product_options").data("product_id");r.ajax({global:!1,url:woo_variation_swatches_admin.wc_ajax_url.toString().replace("%%endpoint%%","woo_variation_swatches_load_product_options"),method:"POST",data:{product_id:e,nonce:woo_variation_swatches_admin.nonce},beforeSend:function(t,e){r("#woo_variation_swatches_variation_product_options_inner").block({message:null,overlayCSS:{background:"#DDDDDD",opacity:.6}})}}).fail((function(t,o){console.error("not load option: ".concat(e,"."),o)})).always((function(){r("#woo_variation_swatches_variation_product_options_inner").unblock()})).done((function(t){r(document.body).trigger("woo_variation_swatches_variation_product_options_loaded",e)}))}))}},{key:"SaveProductAttributes",value:function(){var t=!1,e=r("#woo_variation_swatches_variation_product_options");e.on("change input color-changed",":input:not(.wvs-skip-field)",(function(){t||(window.onbeforeunload=function(){return woo_variation_swatches_admin.nav_warning},t=!0)})).on("click",".woo_variation_swatches_save_product_attributes, .woo_variation_swatches_reset_product_attributes",(function(){window.onbeforeunload=""})).on("click",".woo_variation_swatches_save_product_attributes",(function(t){t.preventDefault();var o,a=e.find(":input:not(.wvs-skip-field)").serializeJSON({disableColonTypes:!0}),n=Object.keys(a)?Object.keys(a).shift():"woo_variation_swatches_product_options",i=e.data("product_id");r.ajax({global:!1,url:woo_variation_swatches_admin.wc_ajax_url.toString().replace("%%endpoint%%","woo_variation_swatches_save_product_options"),method:"POST",data:{data:a[n],product_id:i,nonce:woo_variation_swatches_admin.nonce},beforeSend:function(t,e){clearTimeout(o),r("#woo_variation_swatches_variation_product_options_inner").block({message:null,overlayCSS:{background:"#DDDDDD",opacity:.6}})}}).fail((function(t,e){console.error("not saved on: ".concat(i,"."),e)})).always((function(){r("#woo_variation_swatches_variation_product_options_inner").unblock()})).done((function(t){r("#saved-message").show(),o=setTimeout((function(){r("#saved-message").hide(600)}),5e3),r(document.body).trigger("woo_variation_swatches_variation_product_options_saved",i)}))})).on("click",".woo_variation_swatches_reset_product_attributes",(function(t){if(t.preventDefault(),confirm(woo_variation_swatches_admin.reset_notice)){var e=r(this).data("product_id");r.ajax({global:!1,url:woo_variation_swatches_admin.wc_ajax_url.toString().replace("%%endpoint%%","woo_variation_swatches_reset_product_options"),method:"POST",data:{product_id:e,nonce:woo_variation_swatches_admin.nonce},beforeSend:function(t,e){r("#woo_variation_swatches_variation_product_options_inner").block({message:null,overlayCSS:{background:"#DDDDDD",opacity:.6}})}}).fail((function(t,o){console.error("not reset on: ".concat(e,"."),o)})).always((function(){r("#woo_variation_swatches_variation_product_options_inner").unblock()})).done((function(t){var o=r(t).find("#woo_variation_swatches_variation_product_options_inner").html();r("#woo_variation_swatches_variation_product_options_inner").html(o),r(document.body).trigger("woo_variation_swatches_variation_product_options_reset",e)}))}}))}},{key:"ResetProductAttributes",value:function(){r("#woo_variation_swatches_variation_product_options")}},{key:"Pagination",value:function(){var t=this,e=!1;r("#woo_variation_swatches_variation_product_options").on("change input color-changed",":input:not(.wvs-skip-field)",(function(t){e||(e=!0)})).on("click",".woo_variation_swatches_reset_product_attributes",(function(t){t.preventDefault(),e=!1})).on("click",".woo_variation_swatches_save_product_attributes",(function(t){t.preventDefault(),e=!1})).on("click",".first-page:not(.disabled), .prev-page:not(.disabled), .last-page:not(.disabled), .next-page:not(.disabled)",(function(t){e&&(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),alert(woo_variation_swatches_admin.nav_warning))})).on("click",".first-page.disabled, .prev-page.disabled, .last-page.disabled, .next-page.disabled",(function(t){t.preventDefault()})).on("click",".first-page:not(.disabled)",(function(e){e.preventDefault();var o=r(e.currentTarget).closest(".product-term-label-settings").find(".product-term-label-settings-contents"),a=r(e.currentTarget).closest(".product-term-label-settings-pagination"),n=o.data("product_id"),i=o.data("attribute_id"),c=o.data("attribute_name");t.PaginationAjax(n,i,c,0,o),a.find(".next-page, .last-page").removeClass("disabled"),a.find(".current-page").text(1),o.data("current",1),a.find(".first-page, .prev-page").addClass("disabled")})).on("click",".prev-page:not(.disabled)",(function(e){e.preventDefault();var o=r(e.currentTarget).closest(".product-term-label-settings").find(".product-term-label-settings-contents"),a=r(e.currentTarget).closest(".product-term-label-settings-pagination");o.block({message:null,overlayCSS:{background:"#DDDDDD",opacity:.6}});var n=o.data("product_id"),i=(o.data("pages"),o.data("attribute_id")),c=o.data("attribute_name"),s=o.data("current"),l=o.data("limit"),d=(o.data("total"),(s-1)*l-l),u=s-1;t.PaginationAjax(n,i,c,d,o),a.find(".next-page, .last-page").removeClass("disabled"),a.find(".current-page").text(u),o.data("current",u),0===d&&a.find(".first-page, .prev-page").addClass("disabled")})).on("click",".next-page:not(.disabled)",(function(e){e.preventDefault();var o=r(e.currentTarget).closest(".product-term-label-settings").find(".product-term-label-settings-contents"),a=r(e.currentTarget).closest(".product-term-label-settings-pagination");o.block({message:null,overlayCSS:{background:"#DDDDDD",opacity:.6}});var n=o.data("product_id"),i=o.data("pages"),c=o.data("attribute_id"),s=o.data("attribute_name"),l=o.data("current"),d=o.data("limit"),u=(o.data("total"),l*d),_=l+1;t.PaginationAjax(n,c,s,u,o),a.find(".first-page, .prev-page").removeClass("disabled"),a.find(".current-page").text(_),o.data("current",_),i===_&&a.find(".next-page, .last-page").addClass("disabled")})).on("click",".last-page:not(.disabled)",(function(e){e.preventDefault();var o=r(e.currentTarget).closest(".product-term-label-settings").find(".product-term-label-settings-contents"),a=r(e.currentTarget).closest(".product-term-label-settings-pagination");o.block({message:null,overlayCSS:{background:"#DDDDDD",opacity:.6}});var n=o.data("product_id"),i=o.data("pages"),c=o.data("attribute_id"),s=o.data("attribute_name"),l=(o.data("current"),o.data("limit")),d=i*l-l;t.PaginationAjax(n,c,s,d,o),a.find(".first-page, .prev-page").removeClass("disabled"),a.find(".current-page").text(i),o.data("current",i),a.find(".next-page, .last-page").addClass("disabled")}))}},{key:"ResetAfterTermCreate",value:function(){r(document).ajaxComplete((function(t,e,o){try{var a=Object.fromEntries(new URLSearchParams(o.data));"add-tag"===a.action&&""===r("#tag-name").val()&&r(document.body).trigger("woo_variation_swatches_admin_term_meta_added",a)}catch(t){}}))}},{key:"ImageUploader",value:function(){r(document.body).off("click","button.wvs_upload_image_button"),r(document.body).on("click","button.wvs_upload_image_button",this.AddImage),r(document.body).on("click","button.wvs_remove_image_button",this.RemoveImage),r(document.body).on("woo_variation_swatches_admin_term_meta_added",this.ClearImagePicker),r(document.body).on("woo_variation_swatches_admin_term_meta_added",this.ClearColorPicker)}},{key:"AddImage",value:function(t){var e,o=this;if(t.preventDefault(),t.stopPropagation(),"undefined"!=typeof wp&&wp.media&&wp.media.editor){if(e)return void e.open();(e=wp.media.frames.select_image=wp.media({title:woo_variation_swatches_admin.media_title,button:{text:woo_variation_swatches_admin.button_title},multiple:!1})).on("select",(function(){var t=e.state().get("selection").first().toJSON();if(""!==r.trim(t.id)){var a=void 0===t.sizes.thumbnail?t.sizes.full.url:t.sizes.thumbnail.url;r(o).prev().val(t.id),r(o).closest(".meta-image-field-wrapper").find("img").attr("src",a),r(o).next().show()}})),e.on("open",(function(){var t=e.state().get("selection"),a=r(o).prev().val(),n=wp.media.attachment(a);n.fetch(),t.add(n?[n]:[])})),e.open()}}},{key:"RemoveImage",value:function(t){t.preventDefault(),t.stopPropagation();var e=r(this).closest(".meta-image-field-wrapper").find("img").data("placeholder");return r(this).closest(".meta-image-field-wrapper").find("img").attr("src",e),r(this).prev().prev().val(""),r(this).hide(),!1}},{key:"ClearImagePicker",value:function(){r("#addtag").find(".wvs_remove_image_button").trigger("click")}},{key:"__SelectWoo",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"select.wvs-select-woo";try{r(document.body).on("woo_variation_swatches_select_woo_init",(function(e){r(t).selectWoo({allowClear:!0})})).trigger("woo_variation_swatches_select_woo_init")}catch(t){window.console.log(t)}}},{key:"InitTooltip",value:function(){r(document.body).trigger("init_tooltips")}},{key:"SelectWoo",value:function(){try{r(document.body).trigger("wc-enhanced-select-init")}catch(t){window.console.log(t)}}},{key:"ColorPicker",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"input.wvs-color-picker";try{r(document.body).on("woo_variation_swatches_color_picker_init",(function(e){r(t).wpColorPicker({change:function(e,o){r(t).trigger("color-changed")},clear:function(){r(t).trigger("color-changed")}})})).trigger("woo_variation_swatches_color_picker_init")}catch(t){window.console.log(t)}}},{key:"ClearColorPicker",value:function(){r("#addtag").find(".wp-picker-clear").trigger("click")}},{key:"FieldDependency",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"[data-dependency]";try{r(document.body).on("init_form_field_dependency",(function(){r(t).GWPFormFieldDependency()})).trigger("init_form_field_dependency")}catch(t){window.console.log(t)}}},{key:"savingDialog",value:function(t,e,o){var i={},c="";if(e.find("input, select").each((function(){var t=r(this).attr("name"),e=r(this).val();t&&("tag_name"===t?c=e:i[t]=e,r(this).val(""))})),c){r(".product_attributes").block({message:null,overlayCSS:{background:"#FFFFFF",opacity:.6}});var s=function(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{};e%2?a(Object(o),!0).forEach((function(e){n(t,e,o[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):a(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}({action:"woocommerce_add_new_attribute",taxonomy:o,term:c,security:woocommerce_admin_meta_boxes.add_attribute_nonce},i);r.post(woocommerce_admin_meta_boxes.ajax_url,s,(function(e){e.error?window.alert(e.error):e.slug&&(t.find("select.attribute_values").append('<option value="'+e.term_id+'" selected="selected">'+e.name+"</option>"),t.find("select.attribute_values").change()),r(".product_attributes").unblock()}))}else r(".product_attributes").unblock()}},{key:"AttributeDialog",value:function(){var t=this;r(".product_attributes").on("click","button.wvs_add_new_attribute",(function(e){e.preventDefault();var o=r(this).closest(".woocommerce_attribute"),a=o.data("taxonomy"),n=r(this).data("dialog_title");r(".wvs-attribute-dialog-for-"+a).dialog({title:"",dialogClass:"wp-dialog wvs-attribute-dialog",classes:{"ui-dialog":"wp-dialog wvs-attribute-dialog"},autoOpen:!1,draggable:!0,width:"auto",modal:!0,resizable:!1,closeOnEscape:!0,position:{my:"center",at:"center",of:window},open:function(){r(".ui-widget-overlay").bind("click",(function(){r("#attribute-dialog").dialog("close")}))},create:function(){}}).dialog("option","title",n).dialog("option","buttons",[{text:woo_variation_swatches_admin.dialog_save,click:function(){t.savingDialog(o,r(this),a),r(this).dialog("close").dialog("destroy")}},{text:woo_variation_swatches_admin.dialog_cancel,click:function(){r(this).dialog("close").dialog("destroy")}}]).dialog("open")}))}}],(o=null)&&i(e.prototype,o),c&&i(e,c),t}())},,,,,,function(t,e){},,,,,function(t,e){}]);
|
assets/js/bluebird.js
DELETED
@@ -1,5647 +0,0 @@
|
|
1 |
-
/* @preserve
|
2 |
-
* The MIT License (MIT)
|
3 |
-
*
|
4 |
-
* Copyright (c) 2013-2018 Petka Antonov
|
5 |
-
*
|
6 |
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
7 |
-
* of this software and associated documentation files (the "Software"), to deal
|
8 |
-
* in the Software without restriction, including without limitation the rights
|
9 |
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10 |
-
* copies of the Software, and to permit persons to whom the Software is
|
11 |
-
* furnished to do so, subject to the following conditions:
|
12 |
-
*
|
13 |
-
* The above copyright notice and this permission notice shall be included in
|
14 |
-
* all copies or substantial portions of the Software.
|
15 |
-
*
|
16 |
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17 |
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18 |
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19 |
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20 |
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21 |
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22 |
-
* THE SOFTWARE.
|
23 |
-
*
|
24 |
-
*/
|
25 |
-
/**
|
26 |
-
* bluebird build version 3.5.3
|
27 |
-
* Features enabled: core, race, call_get, generators, map, nodeify, promisify, props, reduce, settle, some, using, timers, filter, any, each
|
28 |
-
*/
|
29 |
-
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.Promise=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof _dereq_=="function"&&_dereq_;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof _dereq_=="function"&&_dereq_;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
|
30 |
-
"use strict";
|
31 |
-
module.exports = function(Promise) {
|
32 |
-
var SomePromiseArray = Promise._SomePromiseArray;
|
33 |
-
function any(promises) {
|
34 |
-
var ret = new SomePromiseArray(promises);
|
35 |
-
var promise = ret.promise();
|
36 |
-
ret.setHowMany(1);
|
37 |
-
ret.setUnwrap();
|
38 |
-
ret.init();
|
39 |
-
return promise;
|
40 |
-
}
|
41 |
-
|
42 |
-
Promise.any = function (promises) {
|
43 |
-
return any(promises);
|
44 |
-
};
|
45 |
-
|
46 |
-
Promise.prototype.any = function () {
|
47 |
-
return any(this);
|
48 |
-
};
|
49 |
-
|
50 |
-
};
|
51 |
-
|
52 |
-
},{}],2:[function(_dereq_,module,exports){
|
53 |
-
"use strict";
|
54 |
-
var firstLineError;
|
55 |
-
try {throw new Error(); } catch (e) {firstLineError = e;}
|
56 |
-
var schedule = _dereq_("./schedule");
|
57 |
-
var Queue = _dereq_("./queue");
|
58 |
-
var util = _dereq_("./util");
|
59 |
-
|
60 |
-
function Async() {
|
61 |
-
this._customScheduler = false;
|
62 |
-
this._isTickUsed = false;
|
63 |
-
this._lateQueue = new Queue(16);
|
64 |
-
this._normalQueue = new Queue(16);
|
65 |
-
this._haveDrainedQueues = false;
|
66 |
-
this._trampolineEnabled = true;
|
67 |
-
var self = this;
|
68 |
-
this.drainQueues = function () {
|
69 |
-
self._drainQueues();
|
70 |
-
};
|
71 |
-
this._schedule = schedule;
|
72 |
-
}
|
73 |
-
|
74 |
-
Async.prototype.setScheduler = function(fn) {
|
75 |
-
var prev = this._schedule;
|
76 |
-
this._schedule = fn;
|
77 |
-
this._customScheduler = true;
|
78 |
-
return prev;
|
79 |
-
};
|
80 |
-
|
81 |
-
Async.prototype.hasCustomScheduler = function() {
|
82 |
-
return this._customScheduler;
|
83 |
-
};
|
84 |
-
|
85 |
-
Async.prototype.enableTrampoline = function() {
|
86 |
-
this._trampolineEnabled = true;
|
87 |
-
};
|
88 |
-
|
89 |
-
Async.prototype.disableTrampolineIfNecessary = function() {
|
90 |
-
if (util.hasDevTools) {
|
91 |
-
this._trampolineEnabled = false;
|
92 |
-
}
|
93 |
-
};
|
94 |
-
|
95 |
-
Async.prototype.haveItemsQueued = function () {
|
96 |
-
return this._isTickUsed || this._haveDrainedQueues;
|
97 |
-
};
|
98 |
-
|
99 |
-
|
100 |
-
Async.prototype.fatalError = function(e, isNode) {
|
101 |
-
if (isNode) {
|
102 |
-
process.stderr.write("Fatal " + (e instanceof Error ? e.stack : e) +
|
103 |
-
"\n");
|
104 |
-
process.exit(2);
|
105 |
-
} else {
|
106 |
-
this.throwLater(e);
|
107 |
-
}
|
108 |
-
};
|
109 |
-
|
110 |
-
Async.prototype.throwLater = function(fn, arg) {
|
111 |
-
if (arguments.length === 1) {
|
112 |
-
arg = fn;
|
113 |
-
fn = function () { throw arg; };
|
114 |
-
}
|
115 |
-
if (typeof setTimeout !== "undefined") {
|
116 |
-
setTimeout(function() {
|
117 |
-
fn(arg);
|
118 |
-
}, 0);
|
119 |
-
} else try {
|
120 |
-
this._schedule(function() {
|
121 |
-
fn(arg);
|
122 |
-
});
|
123 |
-
} catch (e) {
|
124 |
-
throw new Error("No async scheduler available\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
125 |
-
}
|
126 |
-
};
|
127 |
-
|
128 |
-
function AsyncInvokeLater(fn, receiver, arg) {
|
129 |
-
this._lateQueue.push(fn, receiver, arg);
|
130 |
-
this._queueTick();
|
131 |
-
}
|
132 |
-
|
133 |
-
function AsyncInvoke(fn, receiver, arg) {
|
134 |
-
this._normalQueue.push(fn, receiver, arg);
|
135 |
-
this._queueTick();
|
136 |
-
}
|
137 |
-
|
138 |
-
function AsyncSettlePromises(promise) {
|
139 |
-
this._normalQueue._pushOne(promise);
|
140 |
-
this._queueTick();
|
141 |
-
}
|
142 |
-
|
143 |
-
if (!util.hasDevTools) {
|
144 |
-
Async.prototype.invokeLater = AsyncInvokeLater;
|
145 |
-
Async.prototype.invoke = AsyncInvoke;
|
146 |
-
Async.prototype.settlePromises = AsyncSettlePromises;
|
147 |
-
} else {
|
148 |
-
Async.prototype.invokeLater = function (fn, receiver, arg) {
|
149 |
-
if (this._trampolineEnabled) {
|
150 |
-
AsyncInvokeLater.call(this, fn, receiver, arg);
|
151 |
-
} else {
|
152 |
-
this._schedule(function() {
|
153 |
-
setTimeout(function() {
|
154 |
-
fn.call(receiver, arg);
|
155 |
-
}, 100);
|
156 |
-
});
|
157 |
-
}
|
158 |
-
};
|
159 |
-
|
160 |
-
Async.prototype.invoke = function (fn, receiver, arg) {
|
161 |
-
if (this._trampolineEnabled) {
|
162 |
-
AsyncInvoke.call(this, fn, receiver, arg);
|
163 |
-
} else {
|
164 |
-
this._schedule(function() {
|
165 |
-
fn.call(receiver, arg);
|
166 |
-
});
|
167 |
-
}
|
168 |
-
};
|
169 |
-
|
170 |
-
Async.prototype.settlePromises = function(promise) {
|
171 |
-
if (this._trampolineEnabled) {
|
172 |
-
AsyncSettlePromises.call(this, promise);
|
173 |
-
} else {
|
174 |
-
this._schedule(function() {
|
175 |
-
promise._settlePromises();
|
176 |
-
});
|
177 |
-
}
|
178 |
-
};
|
179 |
-
}
|
180 |
-
|
181 |
-
function _drainQueue(queue) {
|
182 |
-
while (queue.length() > 0) {
|
183 |
-
_drainQueueStep(queue);
|
184 |
-
}
|
185 |
-
}
|
186 |
-
|
187 |
-
function _drainQueueStep(queue) {
|
188 |
-
var fn = queue.shift();
|
189 |
-
if (typeof fn !== "function") {
|
190 |
-
fn._settlePromises();
|
191 |
-
} else {
|
192 |
-
var receiver = queue.shift();
|
193 |
-
var arg = queue.shift();
|
194 |
-
fn.call(receiver, arg);
|
195 |
-
}
|
196 |
-
}
|
197 |
-
|
198 |
-
Async.prototype._drainQueues = function () {
|
199 |
-
_drainQueue(this._normalQueue);
|
200 |
-
this._reset();
|
201 |
-
this._haveDrainedQueues = true;
|
202 |
-
_drainQueue(this._lateQueue);
|
203 |
-
};
|
204 |
-
|
205 |
-
Async.prototype._queueTick = function () {
|
206 |
-
if (!this._isTickUsed) {
|
207 |
-
this._isTickUsed = true;
|
208 |
-
this._schedule(this.drainQueues);
|
209 |
-
}
|
210 |
-
};
|
211 |
-
|
212 |
-
Async.prototype._reset = function () {
|
213 |
-
this._isTickUsed = false;
|
214 |
-
};
|
215 |
-
|
216 |
-
module.exports = Async;
|
217 |
-
module.exports.firstLineError = firstLineError;
|
218 |
-
|
219 |
-
},{"./queue":26,"./schedule":29,"./util":36}],3:[function(_dereq_,module,exports){
|
220 |
-
"use strict";
|
221 |
-
module.exports = function(Promise, INTERNAL, tryConvertToPromise, debug) {
|
222 |
-
var calledBind = false;
|
223 |
-
var rejectThis = function(_, e) {
|
224 |
-
this._reject(e);
|
225 |
-
};
|
226 |
-
|
227 |
-
var targetRejected = function(e, context) {
|
228 |
-
context.promiseRejectionQueued = true;
|
229 |
-
context.bindingPromise._then(rejectThis, rejectThis, null, this, e);
|
230 |
-
};
|
231 |
-
|
232 |
-
var bindingResolved = function(thisArg, context) {
|
233 |
-
if (((this._bitField & 50397184) === 0)) {
|
234 |
-
this._resolveCallback(context.target);
|
235 |
-
}
|
236 |
-
};
|
237 |
-
|
238 |
-
var bindingRejected = function(e, context) {
|
239 |
-
if (!context.promiseRejectionQueued) this._reject(e);
|
240 |
-
};
|
241 |
-
|
242 |
-
Promise.prototype.bind = function (thisArg) {
|
243 |
-
if (!calledBind) {
|
244 |
-
calledBind = true;
|
245 |
-
Promise.prototype._propagateFrom = debug.propagateFromFunction();
|
246 |
-
Promise.prototype._boundValue = debug.boundValueFunction();
|
247 |
-
}
|
248 |
-
var maybePromise = tryConvertToPromise(thisArg);
|
249 |
-
var ret = new Promise(INTERNAL);
|
250 |
-
ret._propagateFrom(this, 1);
|
251 |
-
var target = this._target();
|
252 |
-
ret._setBoundTo(maybePromise);
|
253 |
-
if (maybePromise instanceof Promise) {
|
254 |
-
var context = {
|
255 |
-
promiseRejectionQueued: false,
|
256 |
-
promise: ret,
|
257 |
-
target: target,
|
258 |
-
bindingPromise: maybePromise
|
259 |
-
};
|
260 |
-
target._then(INTERNAL, targetRejected, undefined, ret, context);
|
261 |
-
maybePromise._then(
|
262 |
-
bindingResolved, bindingRejected, undefined, ret, context);
|
263 |
-
ret._setOnCancel(maybePromise);
|
264 |
-
} else {
|
265 |
-
ret._resolveCallback(target);
|
266 |
-
}
|
267 |
-
return ret;
|
268 |
-
};
|
269 |
-
|
270 |
-
Promise.prototype._setBoundTo = function (obj) {
|
271 |
-
if (obj !== undefined) {
|
272 |
-
this._bitField = this._bitField | 2097152;
|
273 |
-
this._boundTo = obj;
|
274 |
-
} else {
|
275 |
-
this._bitField = this._bitField & (~2097152);
|
276 |
-
}
|
277 |
-
};
|
278 |
-
|
279 |
-
Promise.prototype._isBound = function () {
|
280 |
-
return (this._bitField & 2097152) === 2097152;
|
281 |
-
};
|
282 |
-
|
283 |
-
Promise.bind = function (thisArg, value) {
|
284 |
-
return Promise.resolve(value).bind(thisArg);
|
285 |
-
};
|
286 |
-
};
|
287 |
-
|
288 |
-
},{}],4:[function(_dereq_,module,exports){
|
289 |
-
"use strict";
|
290 |
-
var old;
|
291 |
-
if (typeof Promise !== "undefined") old = Promise;
|
292 |
-
function noConflict() {
|
293 |
-
try { if (Promise === bluebird) Promise = old; }
|
294 |
-
catch (e) {}
|
295 |
-
return bluebird;
|
296 |
-
}
|
297 |
-
var bluebird = _dereq_("./promise")();
|
298 |
-
bluebird.noConflict = noConflict;
|
299 |
-
module.exports = bluebird;
|
300 |
-
|
301 |
-
},{"./promise":22}],5:[function(_dereq_,module,exports){
|
302 |
-
"use strict";
|
303 |
-
var cr = Object.create;
|
304 |
-
if (cr) {
|
305 |
-
var callerCache = cr(null);
|
306 |
-
var getterCache = cr(null);
|
307 |
-
callerCache[" size"] = getterCache[" size"] = 0;
|
308 |
-
}
|
309 |
-
|
310 |
-
module.exports = function(Promise) {
|
311 |
-
var util = _dereq_("./util");
|
312 |
-
var canEvaluate = util.canEvaluate;
|
313 |
-
var isIdentifier = util.isIdentifier;
|
314 |
-
|
315 |
-
var getMethodCaller;
|
316 |
-
var getGetter;
|
317 |
-
if (!true) {
|
318 |
-
var makeMethodCaller = function (methodName) {
|
319 |
-
return new Function("ensureMethod", " \n\
|
320 |
-
return function(obj) { \n\
|
321 |
-
'use strict' \n\
|
322 |
-
var len = this.length; \n\
|
323 |
-
ensureMethod(obj, 'methodName'); \n\
|
324 |
-
switch(len) { \n\
|
325 |
-
case 1: return obj.methodName(this[0]); \n\
|
326 |
-
case 2: return obj.methodName(this[0], this[1]); \n\
|
327 |
-
case 3: return obj.methodName(this[0], this[1], this[2]); \n\
|
328 |
-
case 0: return obj.methodName(); \n\
|
329 |
-
default: \n\
|
330 |
-
return obj.methodName.apply(obj, this); \n\
|
331 |
-
} \n\
|
332 |
-
}; \n\
|
333 |
-
".replace(/methodName/g, methodName))(ensureMethod);
|
334 |
-
};
|
335 |
-
|
336 |
-
var makeGetter = function (propertyName) {
|
337 |
-
return new Function("obj", " \n\
|
338 |
-
'use strict'; \n\
|
339 |
-
return obj.propertyName; \n\
|
340 |
-
".replace("propertyName", propertyName));
|
341 |
-
};
|
342 |
-
|
343 |
-
var getCompiled = function(name, compiler, cache) {
|
344 |
-
var ret = cache[name];
|
345 |
-
if (typeof ret !== "function") {
|
346 |
-
if (!isIdentifier(name)) {
|
347 |
-
return null;
|
348 |
-
}
|
349 |
-
ret = compiler(name);
|
350 |
-
cache[name] = ret;
|
351 |
-
cache[" size"]++;
|
352 |
-
if (cache[" size"] > 512) {
|
353 |
-
var keys = Object.keys(cache);
|
354 |
-
for (var i = 0; i < 256; ++i) delete cache[keys[i]];
|
355 |
-
cache[" size"] = keys.length - 256;
|
356 |
-
}
|
357 |
-
}
|
358 |
-
return ret;
|
359 |
-
};
|
360 |
-
|
361 |
-
getMethodCaller = function(name) {
|
362 |
-
return getCompiled(name, makeMethodCaller, callerCache);
|
363 |
-
};
|
364 |
-
|
365 |
-
getGetter = function(name) {
|
366 |
-
return getCompiled(name, makeGetter, getterCache);
|
367 |
-
};
|
368 |
-
}
|
369 |
-
|
370 |
-
function ensureMethod(obj, methodName) {
|
371 |
-
var fn;
|
372 |
-
if (obj != null) fn = obj[methodName];
|
373 |
-
if (typeof fn !== "function") {
|
374 |
-
var message = "Object " + util.classString(obj) + " has no method '" +
|
375 |
-
util.toString(methodName) + "'";
|
376 |
-
throw new Promise.TypeError(message);
|
377 |
-
}
|
378 |
-
return fn;
|
379 |
-
}
|
380 |
-
|
381 |
-
function caller(obj) {
|
382 |
-
var methodName = this.pop();
|
383 |
-
var fn = ensureMethod(obj, methodName);
|
384 |
-
return fn.apply(obj, this);
|
385 |
-
}
|
386 |
-
Promise.prototype.call = function (methodName) {
|
387 |
-
var args = [].slice.call(arguments, 1);;
|
388 |
-
if (!true) {
|
389 |
-
if (canEvaluate) {
|
390 |
-
var maybeCaller = getMethodCaller(methodName);
|
391 |
-
if (maybeCaller !== null) {
|
392 |
-
return this._then(
|
393 |
-
maybeCaller, undefined, undefined, args, undefined);
|
394 |
-
}
|
395 |
-
}
|
396 |
-
}
|
397 |
-
args.push(methodName);
|
398 |
-
return this._then(caller, undefined, undefined, args, undefined);
|
399 |
-
};
|
400 |
-
|
401 |
-
function namedGetter(obj) {
|
402 |
-
return obj[this];
|
403 |
-
}
|
404 |
-
function indexedGetter(obj) {
|
405 |
-
var index = +this;
|
406 |
-
if (index < 0) index = Math.max(0, index + obj.length);
|
407 |
-
return obj[index];
|
408 |
-
}
|
409 |
-
Promise.prototype.get = function (propertyName) {
|
410 |
-
var isIndex = (typeof propertyName === "number");
|
411 |
-
var getter;
|
412 |
-
if (!isIndex) {
|
413 |
-
if (canEvaluate) {
|
414 |
-
var maybeGetter = getGetter(propertyName);
|
415 |
-
getter = maybeGetter !== null ? maybeGetter : namedGetter;
|
416 |
-
} else {
|
417 |
-
getter = namedGetter;
|
418 |
-
}
|
419 |
-
} else {
|
420 |
-
getter = indexedGetter;
|
421 |
-
}
|
422 |
-
return this._then(getter, undefined, undefined, propertyName, undefined);
|
423 |
-
};
|
424 |
-
};
|
425 |
-
|
426 |
-
},{"./util":36}],6:[function(_dereq_,module,exports){
|
427 |
-
"use strict";
|
428 |
-
module.exports = function(Promise, PromiseArray, apiRejection, debug) {
|
429 |
-
var util = _dereq_("./util");
|
430 |
-
var tryCatch = util.tryCatch;
|
431 |
-
var errorObj = util.errorObj;
|
432 |
-
var async = Promise._async;
|
433 |
-
|
434 |
-
Promise.prototype["break"] = Promise.prototype.cancel = function() {
|
435 |
-
if (!debug.cancellation()) return this._warn("cancellation is disabled");
|
436 |
-
|
437 |
-
var promise = this;
|
438 |
-
var child = promise;
|
439 |
-
while (promise._isCancellable()) {
|
440 |
-
if (!promise._cancelBy(child)) {
|
441 |
-
if (child._isFollowing()) {
|
442 |
-
child._followee().cancel();
|
443 |
-
} else {
|
444 |
-
child._cancelBranched();
|
445 |
-
}
|
446 |
-
break;
|
447 |
-
}
|
448 |
-
|
449 |
-
var parent = promise._cancellationParent;
|
450 |
-
if (parent == null || !parent._isCancellable()) {
|
451 |
-
if (promise._isFollowing()) {
|
452 |
-
promise._followee().cancel();
|
453 |
-
} else {
|
454 |
-
promise._cancelBranched();
|
455 |
-
}
|
456 |
-
break;
|
457 |
-
} else {
|
458 |
-
if (promise._isFollowing()) promise._followee().cancel();
|
459 |
-
promise._setWillBeCancelled();
|
460 |
-
child = promise;
|
461 |
-
promise = parent;
|
462 |
-
}
|
463 |
-
}
|
464 |
-
};
|
465 |
-
|
466 |
-
Promise.prototype._branchHasCancelled = function() {
|
467 |
-
this._branchesRemainingToCancel--;
|
468 |
-
};
|
469 |
-
|
470 |
-
Promise.prototype._enoughBranchesHaveCancelled = function() {
|
471 |
-
return this._branchesRemainingToCancel === undefined ||
|
472 |
-
this._branchesRemainingToCancel <= 0;
|
473 |
-
};
|
474 |
-
|
475 |
-
Promise.prototype._cancelBy = function(canceller) {
|
476 |
-
if (canceller === this) {
|
477 |
-
this._branchesRemainingToCancel = 0;
|
478 |
-
this._invokeOnCancel();
|
479 |
-
return true;
|
480 |
-
} else {
|
481 |
-
this._branchHasCancelled();
|
482 |
-
if (this._enoughBranchesHaveCancelled()) {
|
483 |
-
this._invokeOnCancel();
|
484 |
-
return true;
|
485 |
-
}
|
486 |
-
}
|
487 |
-
return false;
|
488 |
-
};
|
489 |
-
|
490 |
-
Promise.prototype._cancelBranched = function() {
|
491 |
-
if (this._enoughBranchesHaveCancelled()) {
|
492 |
-
this._cancel();
|
493 |
-
}
|
494 |
-
};
|
495 |
-
|
496 |
-
Promise.prototype._cancel = function() {
|
497 |
-
if (!this._isCancellable()) return;
|
498 |
-
this._setCancelled();
|
499 |
-
async.invoke(this._cancelPromises, this, undefined);
|
500 |
-
};
|
501 |
-
|
502 |
-
Promise.prototype._cancelPromises = function() {
|
503 |
-
if (this._length() > 0) this._settlePromises();
|
504 |
-
};
|
505 |
-
|
506 |
-
Promise.prototype._unsetOnCancel = function() {
|
507 |
-
this._onCancelField = undefined;
|
508 |
-
};
|
509 |
-
|
510 |
-
Promise.prototype._isCancellable = function() {
|
511 |
-
return this.isPending() && !this._isCancelled();
|
512 |
-
};
|
513 |
-
|
514 |
-
Promise.prototype.isCancellable = function() {
|
515 |
-
return this.isPending() && !this.isCancelled();
|
516 |
-
};
|
517 |
-
|
518 |
-
Promise.prototype._doInvokeOnCancel = function(onCancelCallback, internalOnly) {
|
519 |
-
if (util.isArray(onCancelCallback)) {
|
520 |
-
for (var i = 0; i < onCancelCallback.length; ++i) {
|
521 |
-
this._doInvokeOnCancel(onCancelCallback[i], internalOnly);
|
522 |
-
}
|
523 |
-
} else if (onCancelCallback !== undefined) {
|
524 |
-
if (typeof onCancelCallback === "function") {
|
525 |
-
if (!internalOnly) {
|
526 |
-
var e = tryCatch(onCancelCallback).call(this._boundValue());
|
527 |
-
if (e === errorObj) {
|
528 |
-
this._attachExtraTrace(e.e);
|
529 |
-
async.throwLater(e.e);
|
530 |
-
}
|
531 |
-
}
|
532 |
-
} else {
|
533 |
-
onCancelCallback._resultCancelled(this);
|
534 |
-
}
|
535 |
-
}
|
536 |
-
};
|
537 |
-
|
538 |
-
Promise.prototype._invokeOnCancel = function() {
|
539 |
-
var onCancelCallback = this._onCancel();
|
540 |
-
this._unsetOnCancel();
|
541 |
-
async.invoke(this._doInvokeOnCancel, this, onCancelCallback);
|
542 |
-
};
|
543 |
-
|
544 |
-
Promise.prototype._invokeInternalOnCancel = function() {
|
545 |
-
if (this._isCancellable()) {
|
546 |
-
this._doInvokeOnCancel(this._onCancel(), true);
|
547 |
-
this._unsetOnCancel();
|
548 |
-
}
|
549 |
-
};
|
550 |
-
|
551 |
-
Promise.prototype._resultCancelled = function() {
|
552 |
-
this.cancel();
|
553 |
-
};
|
554 |
-
|
555 |
-
};
|
556 |
-
|
557 |
-
},{"./util":36}],7:[function(_dereq_,module,exports){
|
558 |
-
"use strict";
|
559 |
-
module.exports = function(NEXT_FILTER) {
|
560 |
-
var util = _dereq_("./util");
|
561 |
-
var getKeys = _dereq_("./es5").keys;
|
562 |
-
var tryCatch = util.tryCatch;
|
563 |
-
var errorObj = util.errorObj;
|
564 |
-
|
565 |
-
function catchFilter(instances, cb, promise) {
|
566 |
-
return function(e) {
|
567 |
-
var boundTo = promise._boundValue();
|
568 |
-
predicateLoop: for (var i = 0; i < instances.length; ++i) {
|
569 |
-
var item = instances[i];
|
570 |
-
|
571 |
-
if (item === Error ||
|
572 |
-
(item != null && item.prototype instanceof Error)) {
|
573 |
-
if (e instanceof item) {
|
574 |
-
return tryCatch(cb).call(boundTo, e);
|
575 |
-
}
|
576 |
-
} else if (typeof item === "function") {
|
577 |
-
var matchesPredicate = tryCatch(item).call(boundTo, e);
|
578 |
-
if (matchesPredicate === errorObj) {
|
579 |
-
return matchesPredicate;
|
580 |
-
} else if (matchesPredicate) {
|
581 |
-
return tryCatch(cb).call(boundTo, e);
|
582 |
-
}
|
583 |
-
} else if (util.isObject(e)) {
|
584 |
-
var keys = getKeys(item);
|
585 |
-
for (var j = 0; j < keys.length; ++j) {
|
586 |
-
var key = keys[j];
|
587 |
-
if (item[key] != e[key]) {
|
588 |
-
continue predicateLoop;
|
589 |
-
}
|
590 |
-
}
|
591 |
-
return tryCatch(cb).call(boundTo, e);
|
592 |
-
}
|
593 |
-
}
|
594 |
-
return NEXT_FILTER;
|
595 |
-
};
|
596 |
-
}
|
597 |
-
|
598 |
-
return catchFilter;
|
599 |
-
};
|
600 |
-
|
601 |
-
},{"./es5":13,"./util":36}],8:[function(_dereq_,module,exports){
|
602 |
-
"use strict";
|
603 |
-
module.exports = function(Promise) {
|
604 |
-
var longStackTraces = false;
|
605 |
-
var contextStack = [];
|
606 |
-
|
607 |
-
Promise.prototype._promiseCreated = function() {};
|
608 |
-
Promise.prototype._pushContext = function() {};
|
609 |
-
Promise.prototype._popContext = function() {return null;};
|
610 |
-
Promise._peekContext = Promise.prototype._peekContext = function() {};
|
611 |
-
|
612 |
-
function Context() {
|
613 |
-
this._trace = new Context.CapturedTrace(peekContext());
|
614 |
-
}
|
615 |
-
Context.prototype._pushContext = function () {
|
616 |
-
if (this._trace !== undefined) {
|
617 |
-
this._trace._promiseCreated = null;
|
618 |
-
contextStack.push(this._trace);
|
619 |
-
}
|
620 |
-
};
|
621 |
-
|
622 |
-
Context.prototype._popContext = function () {
|
623 |
-
if (this._trace !== undefined) {
|
624 |
-
var trace = contextStack.pop();
|
625 |
-
var ret = trace._promiseCreated;
|
626 |
-
trace._promiseCreated = null;
|
627 |
-
return ret;
|
628 |
-
}
|
629 |
-
return null;
|
630 |
-
};
|
631 |
-
|
632 |
-
function createContext() {
|
633 |
-
if (longStackTraces) return new Context();
|
634 |
-
}
|
635 |
-
|
636 |
-
function peekContext() {
|
637 |
-
var lastIndex = contextStack.length - 1;
|
638 |
-
if (lastIndex >= 0) {
|
639 |
-
return contextStack[lastIndex];
|
640 |
-
}
|
641 |
-
return undefined;
|
642 |
-
}
|
643 |
-
Context.CapturedTrace = null;
|
644 |
-
Context.create = createContext;
|
645 |
-
Context.deactivateLongStackTraces = function() {};
|
646 |
-
Context.activateLongStackTraces = function() {
|
647 |
-
var Promise_pushContext = Promise.prototype._pushContext;
|
648 |
-
var Promise_popContext = Promise.prototype._popContext;
|
649 |
-
var Promise_PeekContext = Promise._peekContext;
|
650 |
-
var Promise_peekContext = Promise.prototype._peekContext;
|
651 |
-
var Promise_promiseCreated = Promise.prototype._promiseCreated;
|
652 |
-
Context.deactivateLongStackTraces = function() {
|
653 |
-
Promise.prototype._pushContext = Promise_pushContext;
|
654 |
-
Promise.prototype._popContext = Promise_popContext;
|
655 |
-
Promise._peekContext = Promise_PeekContext;
|
656 |
-
Promise.prototype._peekContext = Promise_peekContext;
|
657 |
-
Promise.prototype._promiseCreated = Promise_promiseCreated;
|
658 |
-
longStackTraces = false;
|
659 |
-
};
|
660 |
-
longStackTraces = true;
|
661 |
-
Promise.prototype._pushContext = Context.prototype._pushContext;
|
662 |
-
Promise.prototype._popContext = Context.prototype._popContext;
|
663 |
-
Promise._peekContext = Promise.prototype._peekContext = peekContext;
|
664 |
-
Promise.prototype._promiseCreated = function() {
|
665 |
-
var ctx = this._peekContext();
|
666 |
-
if (ctx && ctx._promiseCreated == null) ctx._promiseCreated = this;
|
667 |
-
};
|
668 |
-
};
|
669 |
-
return Context;
|
670 |
-
};
|
671 |
-
|
672 |
-
},{}],9:[function(_dereq_,module,exports){
|
673 |
-
"use strict";
|
674 |
-
module.exports = function(Promise, Context) {
|
675 |
-
var getDomain = Promise._getDomain;
|
676 |
-
var async = Promise._async;
|
677 |
-
var Warning = _dereq_("./errors").Warning;
|
678 |
-
var util = _dereq_("./util");
|
679 |
-
var es5 = _dereq_("./es5");
|
680 |
-
var canAttachTrace = util.canAttachTrace;
|
681 |
-
var unhandledRejectionHandled;
|
682 |
-
var possiblyUnhandledRejection;
|
683 |
-
var bluebirdFramePattern =
|
684 |
-
/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/;
|
685 |
-
var nodeFramePattern = /\((?:timers\.js):\d+:\d+\)/;
|
686 |
-
var parseLinePattern = /[\/<\(](.+?):(\d+):(\d+)\)?\s*$/;
|
687 |
-
var stackFramePattern = null;
|
688 |
-
var formatStack = null;
|
689 |
-
var indentStackFrames = false;
|
690 |
-
var printWarning;
|
691 |
-
var debugging = !!(util.env("BLUEBIRD_DEBUG") != 0 &&
|
692 |
-
(true ||
|
693 |
-
util.env("BLUEBIRD_DEBUG") ||
|
694 |
-
util.env("NODE_ENV") === "development"));
|
695 |
-
|
696 |
-
var warnings = !!(util.env("BLUEBIRD_WARNINGS") != 0 &&
|
697 |
-
(debugging || util.env("BLUEBIRD_WARNINGS")));
|
698 |
-
|
699 |
-
var longStackTraces = !!(util.env("BLUEBIRD_LONG_STACK_TRACES") != 0 &&
|
700 |
-
(debugging || util.env("BLUEBIRD_LONG_STACK_TRACES")));
|
701 |
-
|
702 |
-
var wForgottenReturn = util.env("BLUEBIRD_W_FORGOTTEN_RETURN") != 0 &&
|
703 |
-
(warnings || !!util.env("BLUEBIRD_W_FORGOTTEN_RETURN"));
|
704 |
-
|
705 |
-
Promise.prototype.suppressUnhandledRejections = function() {
|
706 |
-
var target = this._target();
|
707 |
-
target._bitField = ((target._bitField & (~1048576)) |
|
708 |
-
524288);
|
709 |
-
};
|
710 |
-
|
711 |
-
Promise.prototype._ensurePossibleRejectionHandled = function () {
|
712 |
-
if ((this._bitField & 524288) !== 0) return;
|
713 |
-
this._setRejectionIsUnhandled();
|
714 |
-
var self = this;
|
715 |
-
setTimeout(function() {
|
716 |
-
self._notifyUnhandledRejection();
|
717 |
-
}, 1);
|
718 |
-
};
|
719 |
-
|
720 |
-
Promise.prototype._notifyUnhandledRejectionIsHandled = function () {
|
721 |
-
fireRejectionEvent("rejectionHandled",
|
722 |
-
unhandledRejectionHandled, undefined, this);
|
723 |
-
};
|
724 |
-
|
725 |
-
Promise.prototype._setReturnedNonUndefined = function() {
|
726 |
-
this._bitField = this._bitField | 268435456;
|
727 |
-
};
|
728 |
-
|
729 |
-
Promise.prototype._returnedNonUndefined = function() {
|
730 |
-
return (this._bitField & 268435456) !== 0;
|
731 |
-
};
|
732 |
-
|
733 |
-
Promise.prototype._notifyUnhandledRejection = function () {
|
734 |
-
if (this._isRejectionUnhandled()) {
|
735 |
-
var reason = this._settledValue();
|
736 |
-
this._setUnhandledRejectionIsNotified();
|
737 |
-
fireRejectionEvent("unhandledRejection",
|
738 |
-
possiblyUnhandledRejection, reason, this);
|
739 |
-
}
|
740 |
-
};
|
741 |
-
|
742 |
-
Promise.prototype._setUnhandledRejectionIsNotified = function () {
|
743 |
-
this._bitField = this._bitField | 262144;
|
744 |
-
};
|
745 |
-
|
746 |
-
Promise.prototype._unsetUnhandledRejectionIsNotified = function () {
|
747 |
-
this._bitField = this._bitField & (~262144);
|
748 |
-
};
|
749 |
-
|
750 |
-
Promise.prototype._isUnhandledRejectionNotified = function () {
|
751 |
-
return (this._bitField & 262144) > 0;
|
752 |
-
};
|
753 |
-
|
754 |
-
Promise.prototype._setRejectionIsUnhandled = function () {
|
755 |
-
this._bitField = this._bitField | 1048576;
|
756 |
-
};
|
757 |
-
|
758 |
-
Promise.prototype._unsetRejectionIsUnhandled = function () {
|
759 |
-
this._bitField = this._bitField & (~1048576);
|
760 |
-
if (this._isUnhandledRejectionNotified()) {
|
761 |
-
this._unsetUnhandledRejectionIsNotified();
|
762 |
-
this._notifyUnhandledRejectionIsHandled();
|
763 |
-
}
|
764 |
-
};
|
765 |
-
|
766 |
-
Promise.prototype._isRejectionUnhandled = function () {
|
767 |
-
return (this._bitField & 1048576) > 0;
|
768 |
-
};
|
769 |
-
|
770 |
-
Promise.prototype._warn = function(message, shouldUseOwnTrace, promise) {
|
771 |
-
return warn(message, shouldUseOwnTrace, promise || this);
|
772 |
-
};
|
773 |
-
|
774 |
-
Promise.onPossiblyUnhandledRejection = function (fn) {
|
775 |
-
var domain = getDomain();
|
776 |
-
possiblyUnhandledRejection =
|
777 |
-
typeof fn === "function" ? (domain === null ?
|
778 |
-
fn : util.domainBind(domain, fn))
|
779 |
-
: undefined;
|
780 |
-
};
|
781 |
-
|
782 |
-
Promise.onUnhandledRejectionHandled = function (fn) {
|
783 |
-
var domain = getDomain();
|
784 |
-
unhandledRejectionHandled =
|
785 |
-
typeof fn === "function" ? (domain === null ?
|
786 |
-
fn : util.domainBind(domain, fn))
|
787 |
-
: undefined;
|
788 |
-
};
|
789 |
-
|
790 |
-
var disableLongStackTraces = function() {};
|
791 |
-
Promise.longStackTraces = function () {
|
792 |
-
if (async.haveItemsQueued() && !config.longStackTraces) {
|
793 |
-
throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
794 |
-
}
|
795 |
-
if (!config.longStackTraces && longStackTracesIsSupported()) {
|
796 |
-
var Promise_captureStackTrace = Promise.prototype._captureStackTrace;
|
797 |
-
var Promise_attachExtraTrace = Promise.prototype._attachExtraTrace;
|
798 |
-
var Promise_dereferenceTrace = Promise.prototype._dereferenceTrace;
|
799 |
-
config.longStackTraces = true;
|
800 |
-
disableLongStackTraces = function() {
|
801 |
-
if (async.haveItemsQueued() && !config.longStackTraces) {
|
802 |
-
throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
803 |
-
}
|
804 |
-
Promise.prototype._captureStackTrace = Promise_captureStackTrace;
|
805 |
-
Promise.prototype._attachExtraTrace = Promise_attachExtraTrace;
|
806 |
-
Promise.prototype._dereferenceTrace = Promise_dereferenceTrace;
|
807 |
-
Context.deactivateLongStackTraces();
|
808 |
-
async.enableTrampoline();
|
809 |
-
config.longStackTraces = false;
|
810 |
-
};
|
811 |
-
Promise.prototype._captureStackTrace = longStackTracesCaptureStackTrace;
|
812 |
-
Promise.prototype._attachExtraTrace = longStackTracesAttachExtraTrace;
|
813 |
-
Promise.prototype._dereferenceTrace = longStackTracesDereferenceTrace;
|
814 |
-
Context.activateLongStackTraces();
|
815 |
-
async.disableTrampolineIfNecessary();
|
816 |
-
}
|
817 |
-
};
|
818 |
-
|
819 |
-
Promise.hasLongStackTraces = function () {
|
820 |
-
return config.longStackTraces && longStackTracesIsSupported();
|
821 |
-
};
|
822 |
-
|
823 |
-
var fireDomEvent = (function() {
|
824 |
-
try {
|
825 |
-
if (typeof CustomEvent === "function") {
|
826 |
-
var event = new CustomEvent("CustomEvent");
|
827 |
-
util.global.dispatchEvent(event);
|
828 |
-
return function(name, event) {
|
829 |
-
var eventData = {
|
830 |
-
detail: event,
|
831 |
-
cancelable: true
|
832 |
-
};
|
833 |
-
es5.defineProperty(
|
834 |
-
eventData, "promise", {value: event.promise});
|
835 |
-
es5.defineProperty(eventData, "reason", {value: event.reason});
|
836 |
-
var domEvent = new CustomEvent(name.toLowerCase(), eventData);
|
837 |
-
return !util.global.dispatchEvent(domEvent);
|
838 |
-
};
|
839 |
-
} else if (typeof Event === "function") {
|
840 |
-
var event = new Event("CustomEvent");
|
841 |
-
util.global.dispatchEvent(event);
|
842 |
-
return function(name, event) {
|
843 |
-
var domEvent = new Event(name.toLowerCase(), {
|
844 |
-
cancelable: true
|
845 |
-
});
|
846 |
-
domEvent.detail = event;
|
847 |
-
es5.defineProperty(domEvent, "promise", {value: event.promise});
|
848 |
-
es5.defineProperty(domEvent, "reason", {value: event.reason});
|
849 |
-
return !util.global.dispatchEvent(domEvent);
|
850 |
-
};
|
851 |
-
} else {
|
852 |
-
var event = document.createEvent("CustomEvent");
|
853 |
-
event.initCustomEvent("testingtheevent", false, true, {});
|
854 |
-
util.global.dispatchEvent(event);
|
855 |
-
return function(name, event) {
|
856 |
-
var domEvent = document.createEvent("CustomEvent");
|
857 |
-
domEvent.initCustomEvent(name.toLowerCase(), false, true,
|
858 |
-
event);
|
859 |
-
return !util.global.dispatchEvent(domEvent);
|
860 |
-
};
|
861 |
-
}
|
862 |
-
} catch (e) {}
|
863 |
-
return function() {
|
864 |
-
return false;
|
865 |
-
};
|
866 |
-
})();
|
867 |
-
|
868 |
-
var fireGlobalEvent = (function() {
|
869 |
-
if (util.isNode) {
|
870 |
-
return function() {
|
871 |
-
return process.emit.apply(process, arguments);
|
872 |
-
};
|
873 |
-
} else {
|
874 |
-
if (!util.global) {
|
875 |
-
return function() {
|
876 |
-
return false;
|
877 |
-
};
|
878 |
-
}
|
879 |
-
return function(name) {
|
880 |
-
var methodName = "on" + name.toLowerCase();
|
881 |
-
var method = util.global[methodName];
|
882 |
-
if (!method) return false;
|
883 |
-
method.apply(util.global, [].slice.call(arguments, 1));
|
884 |
-
return true;
|
885 |
-
};
|
886 |
-
}
|
887 |
-
})();
|
888 |
-
|
889 |
-
function generatePromiseLifecycleEventObject(name, promise) {
|
890 |
-
return {promise: promise};
|
891 |
-
}
|
892 |
-
|
893 |
-
var eventToObjectGenerator = {
|
894 |
-
promiseCreated: generatePromiseLifecycleEventObject,
|
895 |
-
promiseFulfilled: generatePromiseLifecycleEventObject,
|
896 |
-
promiseRejected: generatePromiseLifecycleEventObject,
|
897 |
-
promiseResolved: generatePromiseLifecycleEventObject,
|
898 |
-
promiseCancelled: generatePromiseLifecycleEventObject,
|
899 |
-
promiseChained: function(name, promise, child) {
|
900 |
-
return {promise: promise, child: child};
|
901 |
-
},
|
902 |
-
warning: function(name, warning) {
|
903 |
-
return {warning: warning};
|
904 |
-
},
|
905 |
-
unhandledRejection: function (name, reason, promise) {
|
906 |
-
return {reason: reason, promise: promise};
|
907 |
-
},
|
908 |
-
rejectionHandled: generatePromiseLifecycleEventObject
|
909 |
-
};
|
910 |
-
|
911 |
-
var activeFireEvent = function (name) {
|
912 |
-
var globalEventFired = false;
|
913 |
-
try {
|
914 |
-
globalEventFired = fireGlobalEvent.apply(null, arguments);
|
915 |
-
} catch (e) {
|
916 |
-
async.throwLater(e);
|
917 |
-
globalEventFired = true;
|
918 |
-
}
|
919 |
-
|
920 |
-
var domEventFired = false;
|
921 |
-
try {
|
922 |
-
domEventFired = fireDomEvent(name,
|
923 |
-
eventToObjectGenerator[name].apply(null, arguments));
|
924 |
-
} catch (e) {
|
925 |
-
async.throwLater(e);
|
926 |
-
domEventFired = true;
|
927 |
-
}
|
928 |
-
|
929 |
-
return domEventFired || globalEventFired;
|
930 |
-
};
|
931 |
-
|
932 |
-
Promise.config = function(opts) {
|
933 |
-
opts = Object(opts);
|
934 |
-
if ("longStackTraces" in opts) {
|
935 |
-
if (opts.longStackTraces) {
|
936 |
-
Promise.longStackTraces();
|
937 |
-
} else if (!opts.longStackTraces && Promise.hasLongStackTraces()) {
|
938 |
-
disableLongStackTraces();
|
939 |
-
}
|
940 |
-
}
|
941 |
-
if ("warnings" in opts) {
|
942 |
-
var warningsOption = opts.warnings;
|
943 |
-
config.warnings = !!warningsOption;
|
944 |
-
wForgottenReturn = config.warnings;
|
945 |
-
|
946 |
-
if (util.isObject(warningsOption)) {
|
947 |
-
if ("wForgottenReturn" in warningsOption) {
|
948 |
-
wForgottenReturn = !!warningsOption.wForgottenReturn;
|
949 |
-
}
|
950 |
-
}
|
951 |
-
}
|
952 |
-
if ("cancellation" in opts && opts.cancellation && !config.cancellation) {
|
953 |
-
if (async.haveItemsQueued()) {
|
954 |
-
throw new Error(
|
955 |
-
"cannot enable cancellation after promises are in use");
|
956 |
-
}
|
957 |
-
Promise.prototype._clearCancellationData =
|
958 |
-
cancellationClearCancellationData;
|
959 |
-
Promise.prototype._propagateFrom = cancellationPropagateFrom;
|
960 |
-
Promise.prototype._onCancel = cancellationOnCancel;
|
961 |
-
Promise.prototype._setOnCancel = cancellationSetOnCancel;
|
962 |
-
Promise.prototype._attachCancellationCallback =
|
963 |
-
cancellationAttachCancellationCallback;
|
964 |
-
Promise.prototype._execute = cancellationExecute;
|
965 |
-
propagateFromFunction = cancellationPropagateFrom;
|
966 |
-
config.cancellation = true;
|
967 |
-
}
|
968 |
-
if ("monitoring" in opts) {
|
969 |
-
if (opts.monitoring && !config.monitoring) {
|
970 |
-
config.monitoring = true;
|
971 |
-
Promise.prototype._fireEvent = activeFireEvent;
|
972 |
-
} else if (!opts.monitoring && config.monitoring) {
|
973 |
-
config.monitoring = false;
|
974 |
-
Promise.prototype._fireEvent = defaultFireEvent;
|
975 |
-
}
|
976 |
-
}
|
977 |
-
return Promise;
|
978 |
-
};
|
979 |
-
|
980 |
-
function defaultFireEvent() { return false; }
|
981 |
-
|
982 |
-
Promise.prototype._fireEvent = defaultFireEvent;
|
983 |
-
Promise.prototype._execute = function(executor, resolve, reject) {
|
984 |
-
try {
|
985 |
-
executor(resolve, reject);
|
986 |
-
} catch (e) {
|
987 |
-
return e;
|
988 |
-
}
|
989 |
-
};
|
990 |
-
Promise.prototype._onCancel = function () {};
|
991 |
-
Promise.prototype._setOnCancel = function (handler) { ; };
|
992 |
-
Promise.prototype._attachCancellationCallback = function(onCancel) {
|
993 |
-
;
|
994 |
-
};
|
995 |
-
Promise.prototype._captureStackTrace = function () {};
|
996 |
-
Promise.prototype._attachExtraTrace = function () {};
|
997 |
-
Promise.prototype._dereferenceTrace = function () {};
|
998 |
-
Promise.prototype._clearCancellationData = function() {};
|
999 |
-
Promise.prototype._propagateFrom = function (parent, flags) {
|
1000 |
-
;
|
1001 |
-
;
|
1002 |
-
};
|
1003 |
-
|
1004 |
-
function cancellationExecute(executor, resolve, reject) {
|
1005 |
-
var promise = this;
|
1006 |
-
try {
|
1007 |
-
executor(resolve, reject, function(onCancel) {
|
1008 |
-
if (typeof onCancel !== "function") {
|
1009 |
-
throw new TypeError("onCancel must be a function, got: " +
|
1010 |
-
util.toString(onCancel));
|
1011 |
-
}
|
1012 |
-
promise._attachCancellationCallback(onCancel);
|
1013 |
-
});
|
1014 |
-
} catch (e) {
|
1015 |
-
return e;
|
1016 |
-
}
|
1017 |
-
}
|
1018 |
-
|
1019 |
-
function cancellationAttachCancellationCallback(onCancel) {
|
1020 |
-
if (!this._isCancellable()) return this;
|
1021 |
-
|
1022 |
-
var previousOnCancel = this._onCancel();
|
1023 |
-
if (previousOnCancel !== undefined) {
|
1024 |
-
if (util.isArray(previousOnCancel)) {
|
1025 |
-
previousOnCancel.push(onCancel);
|
1026 |
-
} else {
|
1027 |
-
this._setOnCancel([previousOnCancel, onCancel]);
|
1028 |
-
}
|
1029 |
-
} else {
|
1030 |
-
this._setOnCancel(onCancel);
|
1031 |
-
}
|
1032 |
-
}
|
1033 |
-
|
1034 |
-
function cancellationOnCancel() {
|
1035 |
-
return this._onCancelField;
|
1036 |
-
}
|
1037 |
-
|
1038 |
-
function cancellationSetOnCancel(onCancel) {
|
1039 |
-
this._onCancelField = onCancel;
|
1040 |
-
}
|
1041 |
-
|
1042 |
-
function cancellationClearCancellationData() {
|
1043 |
-
this._cancellationParent = undefined;
|
1044 |
-
this._onCancelField = undefined;
|
1045 |
-
}
|
1046 |
-
|
1047 |
-
function cancellationPropagateFrom(parent, flags) {
|
1048 |
-
if ((flags & 1) !== 0) {
|
1049 |
-
this._cancellationParent = parent;
|
1050 |
-
var branchesRemainingToCancel = parent._branchesRemainingToCancel;
|
1051 |
-
if (branchesRemainingToCancel === undefined) {
|
1052 |
-
branchesRemainingToCancel = 0;
|
1053 |
-
}
|
1054 |
-
parent._branchesRemainingToCancel = branchesRemainingToCancel + 1;
|
1055 |
-
}
|
1056 |
-
if ((flags & 2) !== 0 && parent._isBound()) {
|
1057 |
-
this._setBoundTo(parent._boundTo);
|
1058 |
-
}
|
1059 |
-
}
|
1060 |
-
|
1061 |
-
function bindingPropagateFrom(parent, flags) {
|
1062 |
-
if ((flags & 2) !== 0 && parent._isBound()) {
|
1063 |
-
this._setBoundTo(parent._boundTo);
|
1064 |
-
}
|
1065 |
-
}
|
1066 |
-
var propagateFromFunction = bindingPropagateFrom;
|
1067 |
-
|
1068 |
-
function boundValueFunction() {
|
1069 |
-
var ret = this._boundTo;
|
1070 |
-
if (ret !== undefined) {
|
1071 |
-
if (ret instanceof Promise) {
|
1072 |
-
if (ret.isFulfilled()) {
|
1073 |
-
return ret.value();
|
1074 |
-
} else {
|
1075 |
-
return undefined;
|
1076 |
-
}
|
1077 |
-
}
|
1078 |
-
}
|
1079 |
-
return ret;
|
1080 |
-
}
|
1081 |
-
|
1082 |
-
function longStackTracesCaptureStackTrace() {
|
1083 |
-
this._trace = new CapturedTrace(this._peekContext());
|
1084 |
-
}
|
1085 |
-
|
1086 |
-
function longStackTracesAttachExtraTrace(error, ignoreSelf) {
|
1087 |
-
if (canAttachTrace(error)) {
|
1088 |
-
var trace = this._trace;
|
1089 |
-
if (trace !== undefined) {
|
1090 |
-
if (ignoreSelf) trace = trace._parent;
|
1091 |
-
}
|
1092 |
-
if (trace !== undefined) {
|
1093 |
-
trace.attachExtraTrace(error);
|
1094 |
-
} else if (!error.__stackCleaned__) {
|
1095 |
-
var parsed = parseStackAndMessage(error);
|
1096 |
-
util.notEnumerableProp(error, "stack",
|
1097 |
-
parsed.message + "\n" + parsed.stack.join("\n"));
|
1098 |
-
util.notEnumerableProp(error, "__stackCleaned__", true);
|
1099 |
-
}
|
1100 |
-
}
|
1101 |
-
}
|
1102 |
-
|
1103 |
-
function longStackTracesDereferenceTrace() {
|
1104 |
-
this._trace = undefined;
|
1105 |
-
}
|
1106 |
-
|
1107 |
-
function checkForgottenReturns(returnValue, promiseCreated, name, promise,
|
1108 |
-
parent) {
|
1109 |
-
if (returnValue === undefined && promiseCreated !== null &&
|
1110 |
-
wForgottenReturn) {
|
1111 |
-
if (parent !== undefined && parent._returnedNonUndefined()) return;
|
1112 |
-
if ((promise._bitField & 65535) === 0) return;
|
1113 |
-
|
1114 |
-
if (name) name = name + " ";
|
1115 |
-
var handlerLine = "";
|
1116 |
-
var creatorLine = "";
|
1117 |
-
if (promiseCreated._trace) {
|
1118 |
-
var traceLines = promiseCreated._trace.stack.split("\n");
|
1119 |
-
var stack = cleanStack(traceLines);
|
1120 |
-
for (var i = stack.length - 1; i >= 0; --i) {
|
1121 |
-
var line = stack[i];
|
1122 |
-
if (!nodeFramePattern.test(line)) {
|
1123 |
-
var lineMatches = line.match(parseLinePattern);
|
1124 |
-
if (lineMatches) {
|
1125 |
-
handlerLine = "at " + lineMatches[1] +
|
1126 |
-
":" + lineMatches[2] + ":" + lineMatches[3] + " ";
|
1127 |
-
}
|
1128 |
-
break;
|
1129 |
-
}
|
1130 |
-
}
|
1131 |
-
|
1132 |
-
if (stack.length > 0) {
|
1133 |
-
var firstUserLine = stack[0];
|
1134 |
-
for (var i = 0; i < traceLines.length; ++i) {
|
1135 |
-
|
1136 |
-
if (traceLines[i] === firstUserLine) {
|
1137 |
-
if (i > 0) {
|
1138 |
-
creatorLine = "\n" + traceLines[i - 1];
|
1139 |
-
}
|
1140 |
-
break;
|
1141 |
-
}
|
1142 |
-
}
|
1143 |
-
|
1144 |
-
}
|
1145 |
-
}
|
1146 |
-
var msg = "a promise was created in a " + name +
|
1147 |
-
"handler " + handlerLine + "but was not returned from it, " +
|
1148 |
-
"see http://goo.gl/rRqMUw" +
|
1149 |
-
creatorLine;
|
1150 |
-
promise._warn(msg, true, promiseCreated);
|
1151 |
-
}
|
1152 |
-
}
|
1153 |
-
|
1154 |
-
function deprecated(name, replacement) {
|
1155 |
-
var message = name +
|
1156 |
-
" is deprecated and will be removed in a future version.";
|
1157 |
-
if (replacement) message += " Use " + replacement + " instead.";
|
1158 |
-
return warn(message);
|
1159 |
-
}
|
1160 |
-
|
1161 |
-
function warn(message, shouldUseOwnTrace, promise) {
|
1162 |
-
if (!config.warnings) return;
|
1163 |
-
var warning = new Warning(message);
|
1164 |
-
var ctx;
|
1165 |
-
if (shouldUseOwnTrace) {
|
1166 |
-
promise._attachExtraTrace(warning);
|
1167 |
-
} else if (config.longStackTraces && (ctx = Promise._peekContext())) {
|
1168 |
-
ctx.attachExtraTrace(warning);
|
1169 |
-
} else {
|
1170 |
-
var parsed = parseStackAndMessage(warning);
|
1171 |
-
warning.stack = parsed.message + "\n" + parsed.stack.join("\n");
|
1172 |
-
}
|
1173 |
-
|
1174 |
-
if (!activeFireEvent("warning", warning)) {
|
1175 |
-
formatAndLogError(warning, "", true);
|
1176 |
-
}
|
1177 |
-
}
|
1178 |
-
|
1179 |
-
function reconstructStack(message, stacks) {
|
1180 |
-
for (var i = 0; i < stacks.length - 1; ++i) {
|
1181 |
-
stacks[i].push("From previous event:");
|
1182 |
-
stacks[i] = stacks[i].join("\n");
|
1183 |
-
}
|
1184 |
-
if (i < stacks.length) {
|
1185 |
-
stacks[i] = stacks[i].join("\n");
|
1186 |
-
}
|
1187 |
-
return message + "\n" + stacks.join("\n");
|
1188 |
-
}
|
1189 |
-
|
1190 |
-
function removeDuplicateOrEmptyJumps(stacks) {
|
1191 |
-
for (var i = 0; i < stacks.length; ++i) {
|
1192 |
-
if (stacks[i].length === 0 ||
|
1193 |
-
((i + 1 < stacks.length) && stacks[i][0] === stacks[i+1][0])) {
|
1194 |
-
stacks.splice(i, 1);
|
1195 |
-
i--;
|
1196 |
-
}
|
1197 |
-
}
|
1198 |
-
}
|
1199 |
-
|
1200 |
-
function removeCommonRoots(stacks) {
|
1201 |
-
var current = stacks[0];
|
1202 |
-
for (var i = 1; i < stacks.length; ++i) {
|
1203 |
-
var prev = stacks[i];
|
1204 |
-
var currentLastIndex = current.length - 1;
|
1205 |
-
var currentLastLine = current[currentLastIndex];
|
1206 |
-
var commonRootMeetPoint = -1;
|
1207 |
-
|
1208 |
-
for (var j = prev.length - 1; j >= 0; --j) {
|
1209 |
-
if (prev[j] === currentLastLine) {
|
1210 |
-
commonRootMeetPoint = j;
|
1211 |
-
break;
|
1212 |
-
}
|
1213 |
-
}
|
1214 |
-
|
1215 |
-
for (var j = commonRootMeetPoint; j >= 0; --j) {
|
1216 |
-
var line = prev[j];
|
1217 |
-
if (current[currentLastIndex] === line) {
|
1218 |
-
current.pop();
|
1219 |
-
currentLastIndex--;
|
1220 |
-
} else {
|
1221 |
-
break;
|
1222 |
-
}
|
1223 |
-
}
|
1224 |
-
current = prev;
|
1225 |
-
}
|
1226 |
-
}
|
1227 |
-
|
1228 |
-
function cleanStack(stack) {
|
1229 |
-
var ret = [];
|
1230 |
-
for (var i = 0; i < stack.length; ++i) {
|
1231 |
-
var line = stack[i];
|
1232 |
-
var isTraceLine = " (No stack trace)" === line ||
|
1233 |
-
stackFramePattern.test(line);
|
1234 |
-
var isInternalFrame = isTraceLine && shouldIgnore(line);
|
1235 |
-
if (isTraceLine && !isInternalFrame) {
|
1236 |
-
if (indentStackFrames && line.charAt(0) !== " ") {
|
1237 |
-
line = " " + line;
|
1238 |
-
}
|
1239 |
-
ret.push(line);
|
1240 |
-
}
|
1241 |
-
}
|
1242 |
-
return ret;
|
1243 |
-
}
|
1244 |
-
|
1245 |
-
function stackFramesAsArray(error) {
|
1246 |
-
var stack = error.stack.replace(/\s+$/g, "").split("\n");
|
1247 |
-
for (var i = 0; i < stack.length; ++i) {
|
1248 |
-
var line = stack[i];
|
1249 |
-
if (" (No stack trace)" === line || stackFramePattern.test(line)) {
|
1250 |
-
break;
|
1251 |
-
}
|
1252 |
-
}
|
1253 |
-
if (i > 0 && error.name != "SyntaxError") {
|
1254 |
-
stack = stack.slice(i);
|
1255 |
-
}
|
1256 |
-
return stack;
|
1257 |
-
}
|
1258 |
-
|
1259 |
-
function parseStackAndMessage(error) {
|
1260 |
-
var stack = error.stack;
|
1261 |
-
var message = error.toString();
|
1262 |
-
stack = typeof stack === "string" && stack.length > 0
|
1263 |
-
? stackFramesAsArray(error) : [" (No stack trace)"];
|
1264 |
-
return {
|
1265 |
-
message: message,
|
1266 |
-
stack: error.name == "SyntaxError" ? stack : cleanStack(stack)
|
1267 |
-
};
|
1268 |
-
}
|
1269 |
-
|
1270 |
-
function formatAndLogError(error, title, isSoft) {
|
1271 |
-
if (typeof console !== "undefined") {
|
1272 |
-
var message;
|
1273 |
-
if (util.isObject(error)) {
|
1274 |
-
var stack = error.stack;
|
1275 |
-
message = title + formatStack(stack, error);
|
1276 |
-
} else {
|
1277 |
-
message = title + String(error);
|
1278 |
-
}
|
1279 |
-
if (typeof printWarning === "function") {
|
1280 |
-
printWarning(message, isSoft);
|
1281 |
-
} else if (typeof console.log === "function" ||
|
1282 |
-
typeof console.log === "object") {
|
1283 |
-
console.log(message);
|
1284 |
-
}
|
1285 |
-
}
|
1286 |
-
}
|
1287 |
-
|
1288 |
-
function fireRejectionEvent(name, localHandler, reason, promise) {
|
1289 |
-
var localEventFired = false;
|
1290 |
-
try {
|
1291 |
-
if (typeof localHandler === "function") {
|
1292 |
-
localEventFired = true;
|
1293 |
-
if (name === "rejectionHandled") {
|
1294 |
-
localHandler(promise);
|
1295 |
-
} else {
|
1296 |
-
localHandler(reason, promise);
|
1297 |
-
}
|
1298 |
-
}
|
1299 |
-
} catch (e) {
|
1300 |
-
async.throwLater(e);
|
1301 |
-
}
|
1302 |
-
|
1303 |
-
if (name === "unhandledRejection") {
|
1304 |
-
if (!activeFireEvent(name, reason, promise) && !localEventFired) {
|
1305 |
-
formatAndLogError(reason, "Unhandled rejection ");
|
1306 |
-
}
|
1307 |
-
} else {
|
1308 |
-
activeFireEvent(name, promise);
|
1309 |
-
}
|
1310 |
-
}
|
1311 |
-
|
1312 |
-
function formatNonError(obj) {
|
1313 |
-
var str;
|
1314 |
-
if (typeof obj === "function") {
|
1315 |
-
str = "[function " +
|
1316 |
-
(obj.name || "anonymous") +
|
1317 |
-
"]";
|
1318 |
-
} else {
|
1319 |
-
str = obj && typeof obj.toString === "function"
|
1320 |
-
? obj.toString() : util.toString(obj);
|
1321 |
-
var ruselessToString = /\[object [a-zA-Z0-9$_]+\]/;
|
1322 |
-
if (ruselessToString.test(str)) {
|
1323 |
-
try {
|
1324 |
-
var newStr = JSON.stringify(obj);
|
1325 |
-
str = newStr;
|
1326 |
-
}
|
1327 |
-
catch(e) {
|
1328 |
-
|
1329 |
-
}
|
1330 |
-
}
|
1331 |
-
if (str.length === 0) {
|
1332 |
-
str = "(empty array)";
|
1333 |
-
}
|
1334 |
-
}
|
1335 |
-
return ("(<" + snip(str) + ">, no stack trace)");
|
1336 |
-
}
|
1337 |
-
|
1338 |
-
function snip(str) {
|
1339 |
-
var maxChars = 41;
|
1340 |
-
if (str.length < maxChars) {
|
1341 |
-
return str;
|
1342 |
-
}
|
1343 |
-
return str.substr(0, maxChars - 3) + "...";
|
1344 |
-
}
|
1345 |
-
|
1346 |
-
function longStackTracesIsSupported() {
|
1347 |
-
return typeof captureStackTrace === "function";
|
1348 |
-
}
|
1349 |
-
|
1350 |
-
var shouldIgnore = function() { return false; };
|
1351 |
-
var parseLineInfoRegex = /[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;
|
1352 |
-
function parseLineInfo(line) {
|
1353 |
-
var matches = line.match(parseLineInfoRegex);
|
1354 |
-
if (matches) {
|
1355 |
-
return {
|
1356 |
-
fileName: matches[1],
|
1357 |
-
line: parseInt(matches[2], 10)
|
1358 |
-
};
|
1359 |
-
}
|
1360 |
-
}
|
1361 |
-
|
1362 |
-
function setBounds(firstLineError, lastLineError) {
|
1363 |
-
if (!longStackTracesIsSupported()) return;
|
1364 |
-
var firstStackLines = firstLineError.stack.split("\n");
|
1365 |
-
var lastStackLines = lastLineError.stack.split("\n");
|
1366 |
-
var firstIndex = -1;
|
1367 |
-
var lastIndex = -1;
|
1368 |
-
var firstFileName;
|
1369 |
-
var lastFileName;
|
1370 |
-
for (var i = 0; i < firstStackLines.length; ++i) {
|
1371 |
-
var result = parseLineInfo(firstStackLines[i]);
|
1372 |
-
if (result) {
|
1373 |
-
firstFileName = result.fileName;
|
1374 |
-
firstIndex = result.line;
|
1375 |
-
break;
|
1376 |
-
}
|
1377 |
-
}
|
1378 |
-
for (var i = 0; i < lastStackLines.length; ++i) {
|
1379 |
-
var result = parseLineInfo(lastStackLines[i]);
|
1380 |
-
if (result) {
|
1381 |
-
lastFileName = result.fileName;
|
1382 |
-
lastIndex = result.line;
|
1383 |
-
break;
|
1384 |
-
}
|
1385 |
-
}
|
1386 |
-
if (firstIndex < 0 || lastIndex < 0 || !firstFileName || !lastFileName ||
|
1387 |
-
firstFileName !== lastFileName || firstIndex >= lastIndex) {
|
1388 |
-
return;
|
1389 |
-
}
|
1390 |
-
|
1391 |
-
shouldIgnore = function(line) {
|
1392 |
-
if (bluebirdFramePattern.test(line)) return true;
|
1393 |
-
var info = parseLineInfo(line);
|
1394 |
-
if (info) {
|
1395 |
-
if (info.fileName === firstFileName &&
|
1396 |
-
(firstIndex <= info.line && info.line <= lastIndex)) {
|
1397 |
-
return true;
|
1398 |
-
}
|
1399 |
-
}
|
1400 |
-
return false;
|
1401 |
-
};
|
1402 |
-
}
|
1403 |
-
|
1404 |
-
function CapturedTrace(parent) {
|
1405 |
-
this._parent = parent;
|
1406 |
-
this._promisesCreated = 0;
|
1407 |
-
var length = this._length = 1 + (parent === undefined ? 0 : parent._length);
|
1408 |
-
captureStackTrace(this, CapturedTrace);
|
1409 |
-
if (length > 32) this.uncycle();
|
1410 |
-
}
|
1411 |
-
util.inherits(CapturedTrace, Error);
|
1412 |
-
Context.CapturedTrace = CapturedTrace;
|
1413 |
-
|
1414 |
-
CapturedTrace.prototype.uncycle = function() {
|
1415 |
-
var length = this._length;
|
1416 |
-
if (length < 2) return;
|
1417 |
-
var nodes = [];
|
1418 |
-
var stackToIndex = {};
|
1419 |
-
|
1420 |
-
for (var i = 0, node = this; node !== undefined; ++i) {
|
1421 |
-
nodes.push(node);
|
1422 |
-
node = node._parent;
|
1423 |
-
}
|
1424 |
-
length = this._length = i;
|
1425 |
-
for (var i = length - 1; i >= 0; --i) {
|
1426 |
-
var stack = nodes[i].stack;
|
1427 |
-
if (stackToIndex[stack] === undefined) {
|
1428 |
-
stackToIndex[stack] = i;
|
1429 |
-
}
|
1430 |
-
}
|
1431 |
-
for (var i = 0; i < length; ++i) {
|
1432 |
-
var currentStack = nodes[i].stack;
|
1433 |
-
var index = stackToIndex[currentStack];
|
1434 |
-
if (index !== undefined && index !== i) {
|
1435 |
-
if (index > 0) {
|
1436 |
-
nodes[index - 1]._parent = undefined;
|
1437 |
-
nodes[index - 1]._length = 1;
|
1438 |
-
}
|
1439 |
-
nodes[i]._parent = undefined;
|
1440 |
-
nodes[i]._length = 1;
|
1441 |
-
var cycleEdgeNode = i > 0 ? nodes[i - 1] : this;
|
1442 |
-
|
1443 |
-
if (index < length - 1) {
|
1444 |
-
cycleEdgeNode._parent = nodes[index + 1];
|
1445 |
-
cycleEdgeNode._parent.uncycle();
|
1446 |
-
cycleEdgeNode._length =
|
1447 |
-
cycleEdgeNode._parent._length + 1;
|
1448 |
-
} else {
|
1449 |
-
cycleEdgeNode._parent = undefined;
|
1450 |
-
cycleEdgeNode._length = 1;
|
1451 |
-
}
|
1452 |
-
var currentChildLength = cycleEdgeNode._length + 1;
|
1453 |
-
for (var j = i - 2; j >= 0; --j) {
|
1454 |
-
nodes[j]._length = currentChildLength;
|
1455 |
-
currentChildLength++;
|
1456 |
-
}
|
1457 |
-
return;
|
1458 |
-
}
|
1459 |
-
}
|
1460 |
-
};
|
1461 |
-
|
1462 |
-
CapturedTrace.prototype.attachExtraTrace = function(error) {
|
1463 |
-
if (error.__stackCleaned__) return;
|
1464 |
-
this.uncycle();
|
1465 |
-
var parsed = parseStackAndMessage(error);
|
1466 |
-
var message = parsed.message;
|
1467 |
-
var stacks = [parsed.stack];
|
1468 |
-
|
1469 |
-
var trace = this;
|
1470 |
-
while (trace !== undefined) {
|
1471 |
-
stacks.push(cleanStack(trace.stack.split("\n")));
|
1472 |
-
trace = trace._parent;
|
1473 |
-
}
|
1474 |
-
removeCommonRoots(stacks);
|
1475 |
-
removeDuplicateOrEmptyJumps(stacks);
|
1476 |
-
util.notEnumerableProp(error, "stack", reconstructStack(message, stacks));
|
1477 |
-
util.notEnumerableProp(error, "__stackCleaned__", true);
|
1478 |
-
};
|
1479 |
-
|
1480 |
-
var captureStackTrace = (function stackDetection() {
|
1481 |
-
var v8stackFramePattern = /^\s*at\s*/;
|
1482 |
-
var v8stackFormatter = function(stack, error) {
|
1483 |
-
if (typeof stack === "string") return stack;
|
1484 |
-
|
1485 |
-
if (error.name !== undefined &&
|
1486 |
-
error.message !== undefined) {
|
1487 |
-
return error.toString();
|
1488 |
-
}
|
1489 |
-
return formatNonError(error);
|
1490 |
-
};
|
1491 |
-
|
1492 |
-
if (typeof Error.stackTraceLimit === "number" &&
|
1493 |
-
typeof Error.captureStackTrace === "function") {
|
1494 |
-
Error.stackTraceLimit += 6;
|
1495 |
-
stackFramePattern = v8stackFramePattern;
|
1496 |
-
formatStack = v8stackFormatter;
|
1497 |
-
var captureStackTrace = Error.captureStackTrace;
|
1498 |
-
|
1499 |
-
shouldIgnore = function(line) {
|
1500 |
-
return bluebirdFramePattern.test(line);
|
1501 |
-
};
|
1502 |
-
return function(receiver, ignoreUntil) {
|
1503 |
-
Error.stackTraceLimit += 6;
|
1504 |
-
captureStackTrace(receiver, ignoreUntil);
|
1505 |
-
Error.stackTraceLimit -= 6;
|
1506 |
-
};
|
1507 |
-
}
|
1508 |
-
var err = new Error();
|
1509 |
-
|
1510 |
-
if (typeof err.stack === "string" &&
|
1511 |
-
err.stack.split("\n")[0].indexOf("stackDetection@") >= 0) {
|
1512 |
-
stackFramePattern = /@/;
|
1513 |
-
formatStack = v8stackFormatter;
|
1514 |
-
indentStackFrames = true;
|
1515 |
-
return function captureStackTrace(o) {
|
1516 |
-
o.stack = new Error().stack;
|
1517 |
-
};
|
1518 |
-
}
|
1519 |
-
|
1520 |
-
var hasStackAfterThrow;
|
1521 |
-
try { throw new Error(); }
|
1522 |
-
catch(e) {
|
1523 |
-
hasStackAfterThrow = ("stack" in e);
|
1524 |
-
}
|
1525 |
-
if (!("stack" in err) && hasStackAfterThrow &&
|
1526 |
-
typeof Error.stackTraceLimit === "number") {
|
1527 |
-
stackFramePattern = v8stackFramePattern;
|
1528 |
-
formatStack = v8stackFormatter;
|
1529 |
-
return function captureStackTrace(o) {
|
1530 |
-
Error.stackTraceLimit += 6;
|
1531 |
-
try { throw new Error(); }
|
1532 |
-
catch(e) { o.stack = e.stack; }
|
1533 |
-
Error.stackTraceLimit -= 6;
|
1534 |
-
};
|
1535 |
-
}
|
1536 |
-
|
1537 |
-
formatStack = function(stack, error) {
|
1538 |
-
if (typeof stack === "string") return stack;
|
1539 |
-
|
1540 |
-
if ((typeof error === "object" ||
|
1541 |
-
typeof error === "function") &&
|
1542 |
-
error.name !== undefined &&
|
1543 |
-
error.message !== undefined) {
|
1544 |
-
return error.toString();
|
1545 |
-
}
|
1546 |
-
return formatNonError(error);
|
1547 |
-
};
|
1548 |
-
|
1549 |
-
return null;
|
1550 |
-
|
1551 |
-
})([]);
|
1552 |
-
|
1553 |
-
if (typeof console !== "undefined" && typeof console.warn !== "undefined") {
|
1554 |
-
printWarning = function (message) {
|
1555 |
-
console.warn(message);
|
1556 |
-
};
|
1557 |
-
if (util.isNode && process.stderr.isTTY) {
|
1558 |
-
printWarning = function(message, isSoft) {
|
1559 |
-
var color = isSoft ? "\u001b[33m" : "\u001b[31m";
|
1560 |
-
console.warn(color + message + "\u001b[0m\n");
|
1561 |
-
};
|
1562 |
-
} else if (!util.isNode && typeof (new Error().stack) === "string") {
|
1563 |
-
printWarning = function(message, isSoft) {
|
1564 |
-
console.warn("%c" + message,
|
1565 |
-
isSoft ? "color: darkorange" : "color: red");
|
1566 |
-
};
|
1567 |
-
}
|
1568 |
-
}
|
1569 |
-
|
1570 |
-
var config = {
|
1571 |
-
warnings: warnings,
|
1572 |
-
longStackTraces: false,
|
1573 |
-
cancellation: false,
|
1574 |
-
monitoring: false
|
1575 |
-
};
|
1576 |
-
|
1577 |
-
if (longStackTraces) Promise.longStackTraces();
|
1578 |
-
|
1579 |
-
return {
|
1580 |
-
longStackTraces: function() {
|
1581 |
-
return config.longStackTraces;
|
1582 |
-
},
|
1583 |
-
warnings: function() {
|
1584 |
-
return config.warnings;
|
1585 |
-
},
|
1586 |
-
cancellation: function() {
|
1587 |
-
return config.cancellation;
|
1588 |
-
},
|
1589 |
-
monitoring: function() {
|
1590 |
-
return config.monitoring;
|
1591 |
-
},
|
1592 |
-
propagateFromFunction: function() {
|
1593 |
-
return propagateFromFunction;
|
1594 |
-
},
|
1595 |
-
boundValueFunction: function() {
|
1596 |
-
return boundValueFunction;
|
1597 |
-
},
|
1598 |
-
checkForgottenReturns: checkForgottenReturns,
|
1599 |
-
setBounds: setBounds,
|
1600 |
-
warn: warn,
|
1601 |
-
deprecated: deprecated,
|
1602 |
-
CapturedTrace: CapturedTrace,
|
1603 |
-
fireDomEvent: fireDomEvent,
|
1604 |
-
fireGlobalEvent: fireGlobalEvent
|
1605 |
-
};
|
1606 |
-
};
|
1607 |
-
|
1608 |
-
},{"./errors":12,"./es5":13,"./util":36}],10:[function(_dereq_,module,exports){
|
1609 |
-
"use strict";
|
1610 |
-
module.exports = function(Promise) {
|
1611 |
-
function returner() {
|
1612 |
-
return this.value;
|
1613 |
-
}
|
1614 |
-
function thrower() {
|
1615 |
-
throw this.reason;
|
1616 |
-
}
|
1617 |
-
|
1618 |
-
Promise.prototype["return"] =
|
1619 |
-
Promise.prototype.thenReturn = function (value) {
|
1620 |
-
if (value instanceof Promise) value.suppressUnhandledRejections();
|
1621 |
-
return this._then(
|
1622 |
-
returner, undefined, undefined, {value: value}, undefined);
|
1623 |
-
};
|
1624 |
-
|
1625 |
-
Promise.prototype["throw"] =
|
1626 |
-
Promise.prototype.thenThrow = function (reason) {
|
1627 |
-
return this._then(
|
1628 |
-
thrower, undefined, undefined, {reason: reason}, undefined);
|
1629 |
-
};
|
1630 |
-
|
1631 |
-
Promise.prototype.catchThrow = function (reason) {
|
1632 |
-
if (arguments.length <= 1) {
|
1633 |
-
return this._then(
|
1634 |
-
undefined, thrower, undefined, {reason: reason}, undefined);
|
1635 |
-
} else {
|
1636 |
-
var _reason = arguments[1];
|
1637 |
-
var handler = function() {throw _reason;};
|
1638 |
-
return this.caught(reason, handler);
|
1639 |
-
}
|
1640 |
-
};
|
1641 |
-
|
1642 |
-
Promise.prototype.catchReturn = function (value) {
|
1643 |
-
if (arguments.length <= 1) {
|
1644 |
-
if (value instanceof Promise) value.suppressUnhandledRejections();
|
1645 |
-
return this._then(
|
1646 |
-
undefined, returner, undefined, {value: value}, undefined);
|
1647 |
-
} else {
|
1648 |
-
var _value = arguments[1];
|
1649 |
-
if (_value instanceof Promise) _value.suppressUnhandledRejections();
|
1650 |
-
var handler = function() {return _value;};
|
1651 |
-
return this.caught(value, handler);
|
1652 |
-
}
|
1653 |
-
};
|
1654 |
-
};
|
1655 |
-
|
1656 |
-
},{}],11:[function(_dereq_,module,exports){
|
1657 |
-
"use strict";
|
1658 |
-
module.exports = function(Promise, INTERNAL) {
|
1659 |
-
var PromiseReduce = Promise.reduce;
|
1660 |
-
var PromiseAll = Promise.all;
|
1661 |
-
|
1662 |
-
function promiseAllThis() {
|
1663 |
-
return PromiseAll(this);
|
1664 |
-
}
|
1665 |
-
|
1666 |
-
function PromiseMapSeries(promises, fn) {
|
1667 |
-
return PromiseReduce(promises, fn, INTERNAL, INTERNAL);
|
1668 |
-
}
|
1669 |
-
|
1670 |
-
Promise.prototype.each = function (fn) {
|
1671 |
-
return PromiseReduce(this, fn, INTERNAL, 0)
|
1672 |
-
._then(promiseAllThis, undefined, undefined, this, undefined);
|
1673 |
-
};
|
1674 |
-
|
1675 |
-
Promise.prototype.mapSeries = function (fn) {
|
1676 |
-
return PromiseReduce(this, fn, INTERNAL, INTERNAL);
|
1677 |
-
};
|
1678 |
-
|
1679 |
-
Promise.each = function (promises, fn) {
|
1680 |
-
return PromiseReduce(promises, fn, INTERNAL, 0)
|
1681 |
-
._then(promiseAllThis, undefined, undefined, promises, undefined);
|
1682 |
-
};
|
1683 |
-
|
1684 |
-
Promise.mapSeries = PromiseMapSeries;
|
1685 |
-
};
|
1686 |
-
|
1687 |
-
|
1688 |
-
},{}],12:[function(_dereq_,module,exports){
|
1689 |
-
"use strict";
|
1690 |
-
var es5 = _dereq_("./es5");
|
1691 |
-
var Objectfreeze = es5.freeze;
|
1692 |
-
var util = _dereq_("./util");
|
1693 |
-
var inherits = util.inherits;
|
1694 |
-
var notEnumerableProp = util.notEnumerableProp;
|
1695 |
-
|
1696 |
-
function subError(nameProperty, defaultMessage) {
|
1697 |
-
function SubError(message) {
|
1698 |
-
if (!(this instanceof SubError)) return new SubError(message);
|
1699 |
-
notEnumerableProp(this, "message",
|
1700 |
-
typeof message === "string" ? message : defaultMessage);
|
1701 |
-
notEnumerableProp(this, "name", nameProperty);
|
1702 |
-
if (Error.captureStackTrace) {
|
1703 |
-
Error.captureStackTrace(this, this.constructor);
|
1704 |
-
} else {
|
1705 |
-
Error.call(this);
|
1706 |
-
}
|
1707 |
-
}
|
1708 |
-
inherits(SubError, Error);
|
1709 |
-
return SubError;
|
1710 |
-
}
|
1711 |
-
|
1712 |
-
var _TypeError, _RangeError;
|
1713 |
-
var Warning = subError("Warning", "warning");
|
1714 |
-
var CancellationError = subError("CancellationError", "cancellation error");
|
1715 |
-
var TimeoutError = subError("TimeoutError", "timeout error");
|
1716 |
-
var AggregateError = subError("AggregateError", "aggregate error");
|
1717 |
-
try {
|
1718 |
-
_TypeError = TypeError;
|
1719 |
-
_RangeError = RangeError;
|
1720 |
-
} catch(e) {
|
1721 |
-
_TypeError = subError("TypeError", "type error");
|
1722 |
-
_RangeError = subError("RangeError", "range error");
|
1723 |
-
}
|
1724 |
-
|
1725 |
-
var methods = ("join pop push shift unshift slice filter forEach some " +
|
1726 |
-
"every map indexOf lastIndexOf reduce reduceRight sort reverse").split(" ");
|
1727 |
-
|
1728 |
-
for (var i = 0; i < methods.length; ++i) {
|
1729 |
-
if (typeof Array.prototype[methods[i]] === "function") {
|
1730 |
-
AggregateError.prototype[methods[i]] = Array.prototype[methods[i]];
|
1731 |
-
}
|
1732 |
-
}
|
1733 |
-
|
1734 |
-
es5.defineProperty(AggregateError.prototype, "length", {
|
1735 |
-
value: 0,
|
1736 |
-
configurable: false,
|
1737 |
-
writable: true,
|
1738 |
-
enumerable: true
|
1739 |
-
});
|
1740 |
-
AggregateError.prototype["isOperational"] = true;
|
1741 |
-
var level = 0;
|
1742 |
-
AggregateError.prototype.toString = function() {
|
1743 |
-
var indent = Array(level * 4 + 1).join(" ");
|
1744 |
-
var ret = "\n" + indent + "AggregateError of:" + "\n";
|
1745 |
-
level++;
|
1746 |
-
indent = Array(level * 4 + 1).join(" ");
|
1747 |
-
for (var i = 0; i < this.length; ++i) {
|
1748 |
-
var str = this[i] === this ? "[Circular AggregateError]" : this[i] + "";
|
1749 |
-
var lines = str.split("\n");
|
1750 |
-
for (var j = 0; j < lines.length; ++j) {
|
1751 |
-
lines[j] = indent + lines[j];
|
1752 |
-
}
|
1753 |
-
str = lines.join("\n");
|
1754 |
-
ret += str + "\n";
|
1755 |
-
}
|
1756 |
-
level--;
|
1757 |
-
return ret;
|
1758 |
-
};
|
1759 |
-
|
1760 |
-
function OperationalError(message) {
|
1761 |
-
if (!(this instanceof OperationalError))
|
1762 |
-
return new OperationalError(message);
|
1763 |
-
notEnumerableProp(this, "name", "OperationalError");
|
1764 |
-
notEnumerableProp(this, "message", message);
|
1765 |
-
this.cause = message;
|
1766 |
-
this["isOperational"] = true;
|
1767 |
-
|
1768 |
-
if (message instanceof Error) {
|
1769 |
-
notEnumerableProp(this, "message", message.message);
|
1770 |
-
notEnumerableProp(this, "stack", message.stack);
|
1771 |
-
} else if (Error.captureStackTrace) {
|
1772 |
-
Error.captureStackTrace(this, this.constructor);
|
1773 |
-
}
|
1774 |
-
|
1775 |
-
}
|
1776 |
-
inherits(OperationalError, Error);
|
1777 |
-
|
1778 |
-
var errorTypes = Error["__BluebirdErrorTypes__"];
|
1779 |
-
if (!errorTypes) {
|
1780 |
-
errorTypes = Objectfreeze({
|
1781 |
-
CancellationError: CancellationError,
|
1782 |
-
TimeoutError: TimeoutError,
|
1783 |
-
OperationalError: OperationalError,
|
1784 |
-
RejectionError: OperationalError,
|
1785 |
-
AggregateError: AggregateError
|
1786 |
-
});
|
1787 |
-
es5.defineProperty(Error, "__BluebirdErrorTypes__", {
|
1788 |
-
value: errorTypes,
|
1789 |
-
writable: false,
|
1790 |
-
enumerable: false,
|
1791 |
-
configurable: false
|
1792 |
-
});
|
1793 |
-
}
|
1794 |
-
|
1795 |
-
module.exports = {
|
1796 |
-
Error: Error,
|
1797 |
-
TypeError: _TypeError,
|
1798 |
-
RangeError: _RangeError,
|
1799 |
-
CancellationError: errorTypes.CancellationError,
|
1800 |
-
OperationalError: errorTypes.OperationalError,
|
1801 |
-
TimeoutError: errorTypes.TimeoutError,
|
1802 |
-
AggregateError: errorTypes.AggregateError,
|
1803 |
-
Warning: Warning
|
1804 |
-
};
|
1805 |
-
|
1806 |
-
},{"./es5":13,"./util":36}],13:[function(_dereq_,module,exports){
|
1807 |
-
var isES5 = (function(){
|
1808 |
-
"use strict";
|
1809 |
-
return this === undefined;
|
1810 |
-
})();
|
1811 |
-
|
1812 |
-
if (isES5) {
|
1813 |
-
module.exports = {
|
1814 |
-
freeze: Object.freeze,
|
1815 |
-
defineProperty: Object.defineProperty,
|
1816 |
-
getDescriptor: Object.getOwnPropertyDescriptor,
|
1817 |
-
keys: Object.keys,
|
1818 |
-
names: Object.getOwnPropertyNames,
|
1819 |
-
getPrototypeOf: Object.getPrototypeOf,
|
1820 |
-
isArray: Array.isArray,
|
1821 |
-
isES5: isES5,
|
1822 |
-
propertyIsWritable: function(obj, prop) {
|
1823 |
-
var descriptor = Object.getOwnPropertyDescriptor(obj, prop);
|
1824 |
-
return !!(!descriptor || descriptor.writable || descriptor.set);
|
1825 |
-
}
|
1826 |
-
};
|
1827 |
-
} else {
|
1828 |
-
var has = {}.hasOwnProperty;
|
1829 |
-
var str = {}.toString;
|
1830 |
-
var proto = {}.constructor.prototype;
|
1831 |
-
|
1832 |
-
var ObjectKeys = function (o) {
|
1833 |
-
var ret = [];
|
1834 |
-
for (var key in o) {
|
1835 |
-
if (has.call(o, key)) {
|
1836 |
-
ret.push(key);
|
1837 |
-
}
|
1838 |
-
}
|
1839 |
-
return ret;
|
1840 |
-
};
|
1841 |
-
|
1842 |
-
var ObjectGetDescriptor = function(o, key) {
|
1843 |
-
return {value: o[key]};
|
1844 |
-
};
|
1845 |
-
|
1846 |
-
var ObjectDefineProperty = function (o, key, desc) {
|
1847 |
-
o[key] = desc.value;
|
1848 |
-
return o;
|
1849 |
-
};
|
1850 |
-
|
1851 |
-
var ObjectFreeze = function (obj) {
|
1852 |
-
return obj;
|
1853 |
-
};
|
1854 |
-
|
1855 |
-
var ObjectGetPrototypeOf = function (obj) {
|
1856 |
-
try {
|
1857 |
-
return Object(obj).constructor.prototype;
|
1858 |
-
}
|
1859 |
-
catch (e) {
|
1860 |
-
return proto;
|
1861 |
-
}
|
1862 |
-
};
|
1863 |
-
|
1864 |
-
var ArrayIsArray = function (obj) {
|
1865 |
-
try {
|
1866 |
-
return str.call(obj) === "[object Array]";
|
1867 |
-
}
|
1868 |
-
catch(e) {
|
1869 |
-
return false;
|
1870 |
-
}
|
1871 |
-
};
|
1872 |
-
|
1873 |
-
module.exports = {
|
1874 |
-
isArray: ArrayIsArray,
|
1875 |
-
keys: ObjectKeys,
|
1876 |
-
names: ObjectKeys,
|
1877 |
-
defineProperty: ObjectDefineProperty,
|
1878 |
-
getDescriptor: ObjectGetDescriptor,
|
1879 |
-
freeze: ObjectFreeze,
|
1880 |
-
getPrototypeOf: ObjectGetPrototypeOf,
|
1881 |
-
isES5: isES5,
|
1882 |
-
propertyIsWritable: function() {
|
1883 |
-
return true;
|
1884 |
-
}
|
1885 |
-
};
|
1886 |
-
}
|
1887 |
-
|
1888 |
-
},{}],14:[function(_dereq_,module,exports){
|
1889 |
-
"use strict";
|
1890 |
-
module.exports = function(Promise, INTERNAL) {
|
1891 |
-
var PromiseMap = Promise.map;
|
1892 |
-
|
1893 |
-
Promise.prototype.filter = function (fn, options) {
|
1894 |
-
return PromiseMap(this, fn, options, INTERNAL);
|
1895 |
-
};
|
1896 |
-
|
1897 |
-
Promise.filter = function (promises, fn, options) {
|
1898 |
-
return PromiseMap(promises, fn, options, INTERNAL);
|
1899 |
-
};
|
1900 |
-
};
|
1901 |
-
|
1902 |
-
},{}],15:[function(_dereq_,module,exports){
|
1903 |
-
"use strict";
|
1904 |
-
module.exports = function(Promise, tryConvertToPromise, NEXT_FILTER) {
|
1905 |
-
var util = _dereq_("./util");
|
1906 |
-
var CancellationError = Promise.CancellationError;
|
1907 |
-
var errorObj = util.errorObj;
|
1908 |
-
var catchFilter = _dereq_("./catch_filter")(NEXT_FILTER);
|
1909 |
-
|
1910 |
-
function PassThroughHandlerContext(promise, type, handler) {
|
1911 |
-
this.promise = promise;
|
1912 |
-
this.type = type;
|
1913 |
-
this.handler = handler;
|
1914 |
-
this.called = false;
|
1915 |
-
this.cancelPromise = null;
|
1916 |
-
}
|
1917 |
-
|
1918 |
-
PassThroughHandlerContext.prototype.isFinallyHandler = function() {
|
1919 |
-
return this.type === 0;
|
1920 |
-
};
|
1921 |
-
|
1922 |
-
function FinallyHandlerCancelReaction(finallyHandler) {
|
1923 |
-
this.finallyHandler = finallyHandler;
|
1924 |
-
}
|
1925 |
-
|
1926 |
-
FinallyHandlerCancelReaction.prototype._resultCancelled = function() {
|
1927 |
-
checkCancel(this.finallyHandler);
|
1928 |
-
};
|
1929 |
-
|
1930 |
-
function checkCancel(ctx, reason) {
|
1931 |
-
if (ctx.cancelPromise != null) {
|
1932 |
-
if (arguments.length > 1) {
|
1933 |
-
ctx.cancelPromise._reject(reason);
|
1934 |
-
} else {
|
1935 |
-
ctx.cancelPromise._cancel();
|
1936 |
-
}
|
1937 |
-
ctx.cancelPromise = null;
|
1938 |
-
return true;
|
1939 |
-
}
|
1940 |
-
return false;
|
1941 |
-
}
|
1942 |
-
|
1943 |
-
function succeed() {
|
1944 |
-
return finallyHandler.call(this, this.promise._target()._settledValue());
|
1945 |
-
}
|
1946 |
-
function fail(reason) {
|
1947 |
-
if (checkCancel(this, reason)) return;
|
1948 |
-
errorObj.e = reason;
|
1949 |
-
return errorObj;
|
1950 |
-
}
|
1951 |
-
function finallyHandler(reasonOrValue) {
|
1952 |
-
var promise = this.promise;
|
1953 |
-
var handler = this.handler;
|
1954 |
-
|
1955 |
-
if (!this.called) {
|
1956 |
-
this.called = true;
|
1957 |
-
var ret = this.isFinallyHandler()
|
1958 |
-
? handler.call(promise._boundValue())
|
1959 |
-
: handler.call(promise._boundValue(), reasonOrValue);
|
1960 |
-
if (ret === NEXT_FILTER) {
|
1961 |
-
return ret;
|
1962 |
-
} else if (ret !== undefined) {
|
1963 |
-
promise._setReturnedNonUndefined();
|
1964 |
-
var maybePromise = tryConvertToPromise(ret, promise);
|
1965 |
-
if (maybePromise instanceof Promise) {
|
1966 |
-
if (this.cancelPromise != null) {
|
1967 |
-
if (maybePromise._isCancelled()) {
|
1968 |
-
var reason =
|
1969 |
-
new CancellationError("late cancellation observer");
|
1970 |
-
promise._attachExtraTrace(reason);
|
1971 |
-
errorObj.e = reason;
|
1972 |
-
return errorObj;
|
1973 |
-
} else if (maybePromise.isPending()) {
|
1974 |
-
maybePromise._attachCancellationCallback(
|
1975 |
-
new FinallyHandlerCancelReaction(this));
|
1976 |
-
}
|
1977 |
-
}
|
1978 |
-
return maybePromise._then(
|
1979 |
-
succeed, fail, undefined, this, undefined);
|
1980 |
-
}
|
1981 |
-
}
|
1982 |
-
}
|
1983 |
-
|
1984 |
-
if (promise.isRejected()) {
|
1985 |
-
checkCancel(this);
|
1986 |
-
errorObj.e = reasonOrValue;
|
1987 |
-
return errorObj;
|
1988 |
-
} else {
|
1989 |
-
checkCancel(this);
|
1990 |
-
return reasonOrValue;
|
1991 |
-
}
|
1992 |
-
}
|
1993 |
-
|
1994 |
-
Promise.prototype._passThrough = function(handler, type, success, fail) {
|
1995 |
-
if (typeof handler !== "function") return this.then();
|
1996 |
-
return this._then(success,
|
1997 |
-
fail,
|
1998 |
-
undefined,
|
1999 |
-
new PassThroughHandlerContext(this, type, handler),
|
2000 |
-
undefined);
|
2001 |
-
};
|
2002 |
-
|
2003 |
-
Promise.prototype.lastly =
|
2004 |
-
Promise.prototype["finally"] = function (handler) {
|
2005 |
-
return this._passThrough(handler,
|
2006 |
-
0,
|
2007 |
-
finallyHandler,
|
2008 |
-
finallyHandler);
|
2009 |
-
};
|
2010 |
-
|
2011 |
-
|
2012 |
-
Promise.prototype.tap = function (handler) {
|
2013 |
-
return this._passThrough(handler, 1, finallyHandler);
|
2014 |
-
};
|
2015 |
-
|
2016 |
-
Promise.prototype.tapCatch = function (handlerOrPredicate) {
|
2017 |
-
var len = arguments.length;
|
2018 |
-
if(len === 1) {
|
2019 |
-
return this._passThrough(handlerOrPredicate,
|
2020 |
-
1,
|
2021 |
-
undefined,
|
2022 |
-
finallyHandler);
|
2023 |
-
} else {
|
2024 |
-
var catchInstances = new Array(len - 1),
|
2025 |
-
j = 0, i;
|
2026 |
-
for (i = 0; i < len - 1; ++i) {
|
2027 |
-
var item = arguments[i];
|
2028 |
-
if (util.isObject(item)) {
|
2029 |
-
catchInstances[j++] = item;
|
2030 |
-
} else {
|
2031 |
-
return Promise.reject(new TypeError(
|
2032 |
-
"tapCatch statement predicate: "
|
2033 |
-
+ "expecting an object but got " + util.classString(item)
|
2034 |
-
));
|
2035 |
-
}
|
2036 |
-
}
|
2037 |
-
catchInstances.length = j;
|
2038 |
-
var handler = arguments[i];
|
2039 |
-
return this._passThrough(catchFilter(catchInstances, handler, this),
|
2040 |
-
1,
|
2041 |
-
undefined,
|
2042 |
-
finallyHandler);
|
2043 |
-
}
|
2044 |
-
|
2045 |
-
};
|
2046 |
-
|
2047 |
-
return PassThroughHandlerContext;
|
2048 |
-
};
|
2049 |
-
|
2050 |
-
},{"./catch_filter":7,"./util":36}],16:[function(_dereq_,module,exports){
|
2051 |
-
"use strict";
|
2052 |
-
module.exports = function(Promise,
|
2053 |
-
apiRejection,
|
2054 |
-
INTERNAL,
|
2055 |
-
tryConvertToPromise,
|
2056 |
-
Proxyable,
|
2057 |
-
debug) {
|
2058 |
-
var errors = _dereq_("./errors");
|
2059 |
-
var TypeError = errors.TypeError;
|
2060 |
-
var util = _dereq_("./util");
|
2061 |
-
var errorObj = util.errorObj;
|
2062 |
-
var tryCatch = util.tryCatch;
|
2063 |
-
var yieldHandlers = [];
|
2064 |
-
|
2065 |
-
function promiseFromYieldHandler(value, yieldHandlers, traceParent) {
|
2066 |
-
for (var i = 0; i < yieldHandlers.length; ++i) {
|
2067 |
-
traceParent._pushContext();
|
2068 |
-
var result = tryCatch(yieldHandlers[i])(value);
|
2069 |
-
traceParent._popContext();
|
2070 |
-
if (result === errorObj) {
|
2071 |
-
traceParent._pushContext();
|
2072 |
-
var ret = Promise.reject(errorObj.e);
|
2073 |
-
traceParent._popContext();
|
2074 |
-
return ret;
|
2075 |
-
}
|
2076 |
-
var maybePromise = tryConvertToPromise(result, traceParent);
|
2077 |
-
if (maybePromise instanceof Promise) return maybePromise;
|
2078 |
-
}
|
2079 |
-
return null;
|
2080 |
-
}
|
2081 |
-
|
2082 |
-
function PromiseSpawn(generatorFunction, receiver, yieldHandler, stack) {
|
2083 |
-
if (debug.cancellation()) {
|
2084 |
-
var internal = new Promise(INTERNAL);
|
2085 |
-
var _finallyPromise = this._finallyPromise = new Promise(INTERNAL);
|
2086 |
-
this._promise = internal.lastly(function() {
|
2087 |
-
return _finallyPromise;
|
2088 |
-
});
|
2089 |
-
internal._captureStackTrace();
|
2090 |
-
internal._setOnCancel(this);
|
2091 |
-
} else {
|
2092 |
-
var promise = this._promise = new Promise(INTERNAL);
|
2093 |
-
promise._captureStackTrace();
|
2094 |
-
}
|
2095 |
-
this._stack = stack;
|
2096 |
-
this._generatorFunction = generatorFunction;
|
2097 |
-
this._receiver = receiver;
|
2098 |
-
this._generator = undefined;
|
2099 |
-
this._yieldHandlers = typeof yieldHandler === "function"
|
2100 |
-
? [yieldHandler].concat(yieldHandlers)
|
2101 |
-
: yieldHandlers;
|
2102 |
-
this._yieldedPromise = null;
|
2103 |
-
this._cancellationPhase = false;
|
2104 |
-
}
|
2105 |
-
util.inherits(PromiseSpawn, Proxyable);
|
2106 |
-
|
2107 |
-
PromiseSpawn.prototype._isResolved = function() {
|
2108 |
-
return this._promise === null;
|
2109 |
-
};
|
2110 |
-
|
2111 |
-
PromiseSpawn.prototype._cleanup = function() {
|
2112 |
-
this._promise = this._generator = null;
|
2113 |
-
if (debug.cancellation() && this._finallyPromise !== null) {
|
2114 |
-
this._finallyPromise._fulfill();
|
2115 |
-
this._finallyPromise = null;
|
2116 |
-
}
|
2117 |
-
};
|
2118 |
-
|
2119 |
-
PromiseSpawn.prototype._promiseCancelled = function() {
|
2120 |
-
if (this._isResolved()) return;
|
2121 |
-
var implementsReturn = typeof this._generator["return"] !== "undefined";
|
2122 |
-
|
2123 |
-
var result;
|
2124 |
-
if (!implementsReturn) {
|
2125 |
-
var reason = new Promise.CancellationError(
|
2126 |
-
"generator .return() sentinel");
|
2127 |
-
Promise.coroutine.returnSentinel = reason;
|
2128 |
-
this._promise._attachExtraTrace(reason);
|
2129 |
-
this._promise._pushContext();
|
2130 |
-
result = tryCatch(this._generator["throw"]).call(this._generator,
|
2131 |
-
reason);
|
2132 |
-
this._promise._popContext();
|
2133 |
-
} else {
|
2134 |
-
this._promise._pushContext();
|
2135 |
-
result = tryCatch(this._generator["return"]).call(this._generator,
|
2136 |
-
undefined);
|
2137 |
-
this._promise._popContext();
|
2138 |
-
}
|
2139 |
-
this._cancellationPhase = true;
|
2140 |
-
this._yieldedPromise = null;
|
2141 |
-
this._continue(result);
|
2142 |
-
};
|
2143 |
-
|
2144 |
-
PromiseSpawn.prototype._promiseFulfilled = function(value) {
|
2145 |
-
this._yieldedPromise = null;
|
2146 |
-
this._promise._pushContext();
|
2147 |
-
var result = tryCatch(this._generator.next).call(this._generator, value);
|
2148 |
-
this._promise._popContext();
|
2149 |
-
this._continue(result);
|
2150 |
-
};
|
2151 |
-
|
2152 |
-
PromiseSpawn.prototype._promiseRejected = function(reason) {
|
2153 |
-
this._yieldedPromise = null;
|
2154 |
-
this._promise._attachExtraTrace(reason);
|
2155 |
-
this._promise._pushContext();
|
2156 |
-
var result = tryCatch(this._generator["throw"])
|
2157 |
-
.call(this._generator, reason);
|
2158 |
-
this._promise._popContext();
|
2159 |
-
this._continue(result);
|
2160 |
-
};
|
2161 |
-
|
2162 |
-
PromiseSpawn.prototype._resultCancelled = function() {
|
2163 |
-
if (this._yieldedPromise instanceof Promise) {
|
2164 |
-
var promise = this._yieldedPromise;
|
2165 |
-
this._yieldedPromise = null;
|
2166 |
-
promise.cancel();
|
2167 |
-
}
|
2168 |
-
};
|
2169 |
-
|
2170 |
-
PromiseSpawn.prototype.promise = function () {
|
2171 |
-
return this._promise;
|
2172 |
-
};
|
2173 |
-
|
2174 |
-
PromiseSpawn.prototype._run = function () {
|
2175 |
-
this._generator = this._generatorFunction.call(this._receiver);
|
2176 |
-
this._receiver =
|
2177 |
-
this._generatorFunction = undefined;
|
2178 |
-
this._promiseFulfilled(undefined);
|
2179 |
-
};
|
2180 |
-
|
2181 |
-
PromiseSpawn.prototype._continue = function (result) {
|
2182 |
-
var promise = this._promise;
|
2183 |
-
if (result === errorObj) {
|
2184 |
-
this._cleanup();
|
2185 |
-
if (this._cancellationPhase) {
|
2186 |
-
return promise.cancel();
|
2187 |
-
} else {
|
2188 |
-
return promise._rejectCallback(result.e, false);
|
2189 |
-
}
|
2190 |
-
}
|
2191 |
-
|
2192 |
-
var value = result.value;
|
2193 |
-
if (result.done === true) {
|
2194 |
-
this._cleanup();
|
2195 |
-
if (this._cancellationPhase) {
|
2196 |
-
return promise.cancel();
|
2197 |
-
} else {
|
2198 |
-
return promise._resolveCallback(value);
|
2199 |
-
}
|
2200 |
-
} else {
|
2201 |
-
var maybePromise = tryConvertToPromise(value, this._promise);
|
2202 |
-
if (!(maybePromise instanceof Promise)) {
|
2203 |
-
maybePromise =
|
2204 |
-
promiseFromYieldHandler(maybePromise,
|
2205 |
-
this._yieldHandlers,
|
2206 |
-
this._promise);
|
2207 |
-
if (maybePromise === null) {
|
2208 |
-
this._promiseRejected(
|
2209 |
-
new TypeError(
|
2210 |
-
"A value %s was yielded that could not be treated as a promise\u000a\u000a See http://goo.gl/MqrFmX\u000a\u000a".replace("%s", String(value)) +
|
2211 |
-
"From coroutine:\u000a" +
|
2212 |
-
this._stack.split("\n").slice(1, -7).join("\n")
|
2213 |
-
)
|
2214 |
-
);
|
2215 |
-
return;
|
2216 |
-
}
|
2217 |
-
}
|
2218 |
-
maybePromise = maybePromise._target();
|
2219 |
-
var bitField = maybePromise._bitField;
|
2220 |
-
;
|
2221 |
-
if (((bitField & 50397184) === 0)) {
|
2222 |
-
this._yieldedPromise = maybePromise;
|
2223 |
-
maybePromise._proxy(this, null);
|
2224 |
-
} else if (((bitField & 33554432) !== 0)) {
|
2225 |
-
Promise._async.invoke(
|
2226 |
-
this._promiseFulfilled, this, maybePromise._value()
|
2227 |
-
);
|
2228 |
-
} else if (((bitField & 16777216) !== 0)) {
|
2229 |
-
Promise._async.invoke(
|
2230 |
-
this._promiseRejected, this, maybePromise._reason()
|
2231 |
-
);
|
2232 |
-
} else {
|
2233 |
-
this._promiseCancelled();
|
2234 |
-
}
|
2235 |
-
}
|
2236 |
-
};
|
2237 |
-
|
2238 |
-
Promise.coroutine = function (generatorFunction, options) {
|
2239 |
-
if (typeof generatorFunction !== "function") {
|
2240 |
-
throw new TypeError("generatorFunction must be a function\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
2241 |
-
}
|
2242 |
-
var yieldHandler = Object(options).yieldHandler;
|
2243 |
-
var PromiseSpawn$ = PromiseSpawn;
|
2244 |
-
var stack = new Error().stack;
|
2245 |
-
return function () {
|
2246 |
-
var generator = generatorFunction.apply(this, arguments);
|
2247 |
-
var spawn = new PromiseSpawn$(undefined, undefined, yieldHandler,
|
2248 |
-
stack);
|
2249 |
-
var ret = spawn.promise();
|
2250 |
-
spawn._generator = generator;
|
2251 |
-
spawn._promiseFulfilled(undefined);
|
2252 |
-
return ret;
|
2253 |
-
};
|
2254 |
-
};
|
2255 |
-
|
2256 |
-
Promise.coroutine.addYieldHandler = function(fn) {
|
2257 |
-
if (typeof fn !== "function") {
|
2258 |
-
throw new TypeError("expecting a function but got " + util.classString(fn));
|
2259 |
-
}
|
2260 |
-
yieldHandlers.push(fn);
|
2261 |
-
};
|
2262 |
-
|
2263 |
-
Promise.spawn = function (generatorFunction) {
|
2264 |
-
debug.deprecated("Promise.spawn()", "Promise.coroutine()");
|
2265 |
-
if (typeof generatorFunction !== "function") {
|
2266 |
-
return apiRejection("generatorFunction must be a function\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
2267 |
-
}
|
2268 |
-
var spawn = new PromiseSpawn(generatorFunction, this);
|
2269 |
-
var ret = spawn.promise();
|
2270 |
-
spawn._run(Promise.spawn);
|
2271 |
-
return ret;
|
2272 |
-
};
|
2273 |
-
};
|
2274 |
-
|
2275 |
-
},{"./errors":12,"./util":36}],17:[function(_dereq_,module,exports){
|
2276 |
-
"use strict";
|
2277 |
-
module.exports =
|
2278 |
-
function(Promise, PromiseArray, tryConvertToPromise, INTERNAL, async,
|
2279 |
-
getDomain) {
|
2280 |
-
var util = _dereq_("./util");
|
2281 |
-
var canEvaluate = util.canEvaluate;
|
2282 |
-
var tryCatch = util.tryCatch;
|
2283 |
-
var errorObj = util.errorObj;
|
2284 |
-
var reject;
|
2285 |
-
|
2286 |
-
if (!true) {
|
2287 |
-
if (canEvaluate) {
|
2288 |
-
var thenCallback = function(i) {
|
2289 |
-
return new Function("value", "holder", " \n\
|
2290 |
-
'use strict'; \n\
|
2291 |
-
holder.pIndex = value; \n\
|
2292 |
-
holder.checkFulfillment(this); \n\
|
2293 |
-
".replace(/Index/g, i));
|
2294 |
-
};
|
2295 |
-
|
2296 |
-
var promiseSetter = function(i) {
|
2297 |
-
return new Function("promise", "holder", " \n\
|
2298 |
-
'use strict'; \n\
|
2299 |
-
holder.pIndex = promise; \n\
|
2300 |
-
".replace(/Index/g, i));
|
2301 |
-
};
|
2302 |
-
|
2303 |
-
var generateHolderClass = function(total) {
|
2304 |
-
var props = new Array(total);
|
2305 |
-
for (var i = 0; i < props.length; ++i) {
|
2306 |
-
props[i] = "this.p" + (i+1);
|
2307 |
-
}
|
2308 |
-
var assignment = props.join(" = ") + " = null;";
|
2309 |
-
var cancellationCode= "var promise;\n" + props.map(function(prop) {
|
2310 |
-
return " \n\
|
2311 |
-
promise = " + prop + "; \n\
|
2312 |
-
if (promise instanceof Promise) { \n\
|
2313 |
-
promise.cancel(); \n\
|
2314 |
-
} \n\
|
2315 |
-
";
|
2316 |
-
}).join("\n");
|
2317 |
-
var passedArguments = props.join(", ");
|
2318 |
-
var name = "Holder$" + total;
|
2319 |
-
|
2320 |
-
|
2321 |
-
var code = "return function(tryCatch, errorObj, Promise, async) { \n\
|
2322 |
-
'use strict'; \n\
|
2323 |
-
function [TheName](fn) { \n\
|
2324 |
-
[TheProperties] \n\
|
2325 |
-
this.fn = fn; \n\
|
2326 |
-
this.asyncNeeded = true; \n\
|
2327 |
-
this.now = 0; \n\
|
2328 |
-
} \n\
|
2329 |
-
\n\
|
2330 |
-
[TheName].prototype._callFunction = function(promise) { \n\
|
2331 |
-
promise._pushContext(); \n\
|
2332 |
-
var ret = tryCatch(this.fn)([ThePassedArguments]); \n\
|
2333 |
-
promise._popContext(); \n\
|
2334 |
-
if (ret === errorObj) { \n\
|
2335 |
-
promise._rejectCallback(ret.e, false); \n\
|
2336 |
-
} else { \n\
|
2337 |
-
promise._resolveCallback(ret); \n\
|
2338 |
-
} \n\
|
2339 |
-
}; \n\
|
2340 |
-
\n\
|
2341 |
-
[TheName].prototype.checkFulfillment = function(promise) { \n\
|
2342 |
-
var now = ++this.now; \n\
|
2343 |
-
if (now === [TheTotal]) { \n\
|
2344 |
-
if (this.asyncNeeded) { \n\
|
2345 |
-
async.invoke(this._callFunction, this, promise); \n\
|
2346 |
-
} else { \n\
|
2347 |
-
this._callFunction(promise); \n\
|
2348 |
-
} \n\
|
2349 |
-
\n\
|
2350 |
-
} \n\
|
2351 |
-
}; \n\
|
2352 |
-
\n\
|
2353 |
-
[TheName].prototype._resultCancelled = function() { \n\
|
2354 |
-
[CancellationCode] \n\
|
2355 |
-
}; \n\
|
2356 |
-
\n\
|
2357 |
-
return [TheName]; \n\
|
2358 |
-
}(tryCatch, errorObj, Promise, async); \n\
|
2359 |
-
";
|
2360 |
-
|
2361 |
-
code = code.replace(/\[TheName\]/g, name)
|
2362 |
-
.replace(/\[TheTotal\]/g, total)
|
2363 |
-
.replace(/\[ThePassedArguments\]/g, passedArguments)
|
2364 |
-
.replace(/\[TheProperties\]/g, assignment)
|
2365 |
-
.replace(/\[CancellationCode\]/g, cancellationCode);
|
2366 |
-
|
2367 |
-
return new Function("tryCatch", "errorObj", "Promise", "async", code)
|
2368 |
-
(tryCatch, errorObj, Promise, async);
|
2369 |
-
};
|
2370 |
-
|
2371 |
-
var holderClasses = [];
|
2372 |
-
var thenCallbacks = [];
|
2373 |
-
var promiseSetters = [];
|
2374 |
-
|
2375 |
-
for (var i = 0; i < 8; ++i) {
|
2376 |
-
holderClasses.push(generateHolderClass(i + 1));
|
2377 |
-
thenCallbacks.push(thenCallback(i + 1));
|
2378 |
-
promiseSetters.push(promiseSetter(i + 1));
|
2379 |
-
}
|
2380 |
-
|
2381 |
-
reject = function (reason) {
|
2382 |
-
this._reject(reason);
|
2383 |
-
};
|
2384 |
-
}}
|
2385 |
-
|
2386 |
-
Promise.join = function () {
|
2387 |
-
var last = arguments.length - 1;
|
2388 |
-
var fn;
|
2389 |
-
if (last > 0 && typeof arguments[last] === "function") {
|
2390 |
-
fn = arguments[last];
|
2391 |
-
if (!true) {
|
2392 |
-
if (last <= 8 && canEvaluate) {
|
2393 |
-
var ret = new Promise(INTERNAL);
|
2394 |
-
ret._captureStackTrace();
|
2395 |
-
var HolderClass = holderClasses[last - 1];
|
2396 |
-
var holder = new HolderClass(fn);
|
2397 |
-
var callbacks = thenCallbacks;
|
2398 |
-
|
2399 |
-
for (var i = 0; i < last; ++i) {
|
2400 |
-
var maybePromise = tryConvertToPromise(arguments[i], ret);
|
2401 |
-
if (maybePromise instanceof Promise) {
|
2402 |
-
maybePromise = maybePromise._target();
|
2403 |
-
var bitField = maybePromise._bitField;
|
2404 |
-
;
|
2405 |
-
if (((bitField & 50397184) === 0)) {
|
2406 |
-
maybePromise._then(callbacks[i], reject,
|
2407 |
-
undefined, ret, holder);
|
2408 |
-
promiseSetters[i](maybePromise, holder);
|
2409 |
-
holder.asyncNeeded = false;
|
2410 |
-
} else if (((bitField & 33554432) !== 0)) {
|
2411 |
-
callbacks[i].call(ret,
|
2412 |
-
maybePromise._value(), holder);
|
2413 |
-
} else if (((bitField & 16777216) !== 0)) {
|
2414 |
-
ret._reject(maybePromise._reason());
|
2415 |
-
} else {
|
2416 |
-
ret._cancel();
|
2417 |
-
}
|
2418 |
-
} else {
|
2419 |
-
callbacks[i].call(ret, maybePromise, holder);
|
2420 |
-
}
|
2421 |
-
}
|
2422 |
-
|
2423 |
-
if (!ret._isFateSealed()) {
|
2424 |
-
if (holder.asyncNeeded) {
|
2425 |
-
var domain = getDomain();
|
2426 |
-
if (domain !== null) {
|
2427 |
-
holder.fn = util.domainBind(domain, holder.fn);
|
2428 |
-
}
|
2429 |
-
}
|
2430 |
-
ret._setAsyncGuaranteed();
|
2431 |
-
ret._setOnCancel(holder);
|
2432 |
-
}
|
2433 |
-
return ret;
|
2434 |
-
}
|
2435 |
-
}
|
2436 |
-
}
|
2437 |
-
var args = [].slice.call(arguments);;
|
2438 |
-
if (fn) args.pop();
|
2439 |
-
var ret = new PromiseArray(args).promise();
|
2440 |
-
return fn !== undefined ? ret.spread(fn) : ret;
|
2441 |
-
};
|
2442 |
-
|
2443 |
-
};
|
2444 |
-
|
2445 |
-
},{"./util":36}],18:[function(_dereq_,module,exports){
|
2446 |
-
"use strict";
|
2447 |
-
module.exports = function(Promise,
|
2448 |
-
PromiseArray,
|
2449 |
-
apiRejection,
|
2450 |
-
tryConvertToPromise,
|
2451 |
-
INTERNAL,
|
2452 |
-
debug) {
|
2453 |
-
var getDomain = Promise._getDomain;
|
2454 |
-
var util = _dereq_("./util");
|
2455 |
-
var tryCatch = util.tryCatch;
|
2456 |
-
var errorObj = util.errorObj;
|
2457 |
-
var async = Promise._async;
|
2458 |
-
|
2459 |
-
function MappingPromiseArray(promises, fn, limit, _filter) {
|
2460 |
-
this.constructor$(promises);
|
2461 |
-
this._promise._captureStackTrace();
|
2462 |
-
var domain = getDomain();
|
2463 |
-
this._callback = domain === null ? fn : util.domainBind(domain, fn);
|
2464 |
-
this._preservedValues = _filter === INTERNAL
|
2465 |
-
? new Array(this.length())
|
2466 |
-
: null;
|
2467 |
-
this._limit = limit;
|
2468 |
-
this._inFlight = 0;
|
2469 |
-
this._queue = [];
|
2470 |
-
async.invoke(this._asyncInit, this, undefined);
|
2471 |
-
}
|
2472 |
-
util.inherits(MappingPromiseArray, PromiseArray);
|
2473 |
-
|
2474 |
-
MappingPromiseArray.prototype._asyncInit = function() {
|
2475 |
-
this._init$(undefined, -2);
|
2476 |
-
};
|
2477 |
-
|
2478 |
-
MappingPromiseArray.prototype._init = function () {};
|
2479 |
-
|
2480 |
-
MappingPromiseArray.prototype._promiseFulfilled = function (value, index) {
|
2481 |
-
var values = this._values;
|
2482 |
-
var length = this.length();
|
2483 |
-
var preservedValues = this._preservedValues;
|
2484 |
-
var limit = this._limit;
|
2485 |
-
|
2486 |
-
if (index < 0) {
|
2487 |
-
index = (index * -1) - 1;
|
2488 |
-
values[index] = value;
|
2489 |
-
if (limit >= 1) {
|
2490 |
-
this._inFlight--;
|
2491 |
-
this._drainQueue();
|
2492 |
-
if (this._isResolved()) return true;
|
2493 |
-
}
|
2494 |
-
} else {
|
2495 |
-
if (limit >= 1 && this._inFlight >= limit) {
|
2496 |
-
values[index] = value;
|
2497 |
-
this._queue.push(index);
|
2498 |
-
return false;
|
2499 |
-
}
|
2500 |
-
if (preservedValues !== null) preservedValues[index] = value;
|
2501 |
-
|
2502 |
-
var promise = this._promise;
|
2503 |
-
var callback = this._callback;
|
2504 |
-
var receiver = promise._boundValue();
|
2505 |
-
promise._pushContext();
|
2506 |
-
var ret = tryCatch(callback).call(receiver, value, index, length);
|
2507 |
-
var promiseCreated = promise._popContext();
|
2508 |
-
debug.checkForgottenReturns(
|
2509 |
-
ret,
|
2510 |
-
promiseCreated,
|
2511 |
-
preservedValues !== null ? "Promise.filter" : "Promise.map",
|
2512 |
-
promise
|
2513 |
-
);
|
2514 |
-
if (ret === errorObj) {
|
2515 |
-
this._reject(ret.e);
|
2516 |
-
return true;
|
2517 |
-
}
|
2518 |
-
|
2519 |
-
var maybePromise = tryConvertToPromise(ret, this._promise);
|
2520 |
-
if (maybePromise instanceof Promise) {
|
2521 |
-
maybePromise = maybePromise._target();
|
2522 |
-
var bitField = maybePromise._bitField;
|
2523 |
-
;
|
2524 |
-
if (((bitField & 50397184) === 0)) {
|
2525 |
-
if (limit >= 1) this._inFlight++;
|
2526 |
-
values[index] = maybePromise;
|
2527 |
-
maybePromise._proxy(this, (index + 1) * -1);
|
2528 |
-
return false;
|
2529 |
-
} else if (((bitField & 33554432) !== 0)) {
|
2530 |
-
ret = maybePromise._value();
|
2531 |
-
} else if (((bitField & 16777216) !== 0)) {
|
2532 |
-
this._reject(maybePromise._reason());
|
2533 |
-
return true;
|
2534 |
-
} else {
|
2535 |
-
this._cancel();
|
2536 |
-
return true;
|
2537 |
-
}
|
2538 |
-
}
|
2539 |
-
values[index] = ret;
|
2540 |
-
}
|
2541 |
-
var totalResolved = ++this._totalResolved;
|
2542 |
-
if (totalResolved >= length) {
|
2543 |
-
if (preservedValues !== null) {
|
2544 |
-
this._filter(values, preservedValues);
|
2545 |
-
} else {
|
2546 |
-
this._resolve(values);
|
2547 |
-
}
|
2548 |
-
return true;
|
2549 |
-
}
|
2550 |
-
return false;
|
2551 |
-
};
|
2552 |
-
|
2553 |
-
MappingPromiseArray.prototype._drainQueue = function () {
|
2554 |
-
var queue = this._queue;
|
2555 |
-
var limit = this._limit;
|
2556 |
-
var values = this._values;
|
2557 |
-
while (queue.length > 0 && this._inFlight < limit) {
|
2558 |
-
if (this._isResolved()) return;
|
2559 |
-
var index = queue.pop();
|
2560 |
-
this._promiseFulfilled(values[index], index);
|
2561 |
-
}
|
2562 |
-
};
|
2563 |
-
|
2564 |
-
MappingPromiseArray.prototype._filter = function (booleans, values) {
|
2565 |
-
var len = values.length;
|
2566 |
-
var ret = new Array(len);
|
2567 |
-
var j = 0;
|
2568 |
-
for (var i = 0; i < len; ++i) {
|
2569 |
-
if (booleans[i]) ret[j++] = values[i];
|
2570 |
-
}
|
2571 |
-
ret.length = j;
|
2572 |
-
this._resolve(ret);
|
2573 |
-
};
|
2574 |
-
|
2575 |
-
MappingPromiseArray.prototype.preservedValues = function () {
|
2576 |
-
return this._preservedValues;
|
2577 |
-
};
|
2578 |
-
|
2579 |
-
function map(promises, fn, options, _filter) {
|
2580 |
-
if (typeof fn !== "function") {
|
2581 |
-
return apiRejection("expecting a function but got " + util.classString(fn));
|
2582 |
-
}
|
2583 |
-
|
2584 |
-
var limit = 0;
|
2585 |
-
if (options !== undefined) {
|
2586 |
-
if (typeof options === "object" && options !== null) {
|
2587 |
-
if (typeof options.concurrency !== "number") {
|
2588 |
-
return Promise.reject(
|
2589 |
-
new TypeError("'concurrency' must be a number but it is " +
|
2590 |
-
util.classString(options.concurrency)));
|
2591 |
-
}
|
2592 |
-
limit = options.concurrency;
|
2593 |
-
} else {
|
2594 |
-
return Promise.reject(new TypeError(
|
2595 |
-
"options argument must be an object but it is " +
|
2596 |
-
util.classString(options)));
|
2597 |
-
}
|
2598 |
-
}
|
2599 |
-
limit = typeof limit === "number" &&
|
2600 |
-
isFinite(limit) && limit >= 1 ? limit : 0;
|
2601 |
-
return new MappingPromiseArray(promises, fn, limit, _filter).promise();
|
2602 |
-
}
|
2603 |
-
|
2604 |
-
Promise.prototype.map = function (fn, options) {
|
2605 |
-
return map(this, fn, options, null);
|
2606 |
-
};
|
2607 |
-
|
2608 |
-
Promise.map = function (promises, fn, options, _filter) {
|
2609 |
-
return map(promises, fn, options, _filter);
|
2610 |
-
};
|
2611 |
-
|
2612 |
-
|
2613 |
-
};
|
2614 |
-
|
2615 |
-
},{"./util":36}],19:[function(_dereq_,module,exports){
|
2616 |
-
"use strict";
|
2617 |
-
module.exports =
|
2618 |
-
function(Promise, INTERNAL, tryConvertToPromise, apiRejection, debug) {
|
2619 |
-
var util = _dereq_("./util");
|
2620 |
-
var tryCatch = util.tryCatch;
|
2621 |
-
|
2622 |
-
Promise.method = function (fn) {
|
2623 |
-
if (typeof fn !== "function") {
|
2624 |
-
throw new Promise.TypeError("expecting a function but got " + util.classString(fn));
|
2625 |
-
}
|
2626 |
-
return function () {
|
2627 |
-
var ret = new Promise(INTERNAL);
|
2628 |
-
ret._captureStackTrace();
|
2629 |
-
ret._pushContext();
|
2630 |
-
var value = tryCatch(fn).apply(this, arguments);
|
2631 |
-
var promiseCreated = ret._popContext();
|
2632 |
-
debug.checkForgottenReturns(
|
2633 |
-
value, promiseCreated, "Promise.method", ret);
|
2634 |
-
ret._resolveFromSyncValue(value);
|
2635 |
-
return ret;
|
2636 |
-
};
|
2637 |
-
};
|
2638 |
-
|
2639 |
-
Promise.attempt = Promise["try"] = function (fn) {
|
2640 |
-
if (typeof fn !== "function") {
|
2641 |
-
return apiRejection("expecting a function but got " + util.classString(fn));
|
2642 |
-
}
|
2643 |
-
var ret = new Promise(INTERNAL);
|
2644 |
-
ret._captureStackTrace();
|
2645 |
-
ret._pushContext();
|
2646 |
-
var value;
|
2647 |
-
if (arguments.length > 1) {
|
2648 |
-
debug.deprecated("calling Promise.try with more than 1 argument");
|
2649 |
-
var arg = arguments[1];
|
2650 |
-
var ctx = arguments[2];
|
2651 |
-
value = util.isArray(arg) ? tryCatch(fn).apply(ctx, arg)
|
2652 |
-
: tryCatch(fn).call(ctx, arg);
|
2653 |
-
} else {
|
2654 |
-
value = tryCatch(fn)();
|
2655 |
-
}
|
2656 |
-
var promiseCreated = ret._popContext();
|
2657 |
-
debug.checkForgottenReturns(
|
2658 |
-
value, promiseCreated, "Promise.try", ret);
|
2659 |
-
ret._resolveFromSyncValue(value);
|
2660 |
-
return ret;
|
2661 |
-
};
|
2662 |
-
|
2663 |
-
Promise.prototype._resolveFromSyncValue = function (value) {
|
2664 |
-
if (value === util.errorObj) {
|
2665 |
-
this._rejectCallback(value.e, false);
|
2666 |
-
} else {
|
2667 |
-
this._resolveCallback(value, true);
|
2668 |
-
}
|
2669 |
-
};
|
2670 |
-
};
|
2671 |
-
|
2672 |
-
},{"./util":36}],20:[function(_dereq_,module,exports){
|
2673 |
-
"use strict";
|
2674 |
-
var util = _dereq_("./util");
|
2675 |
-
var maybeWrapAsError = util.maybeWrapAsError;
|
2676 |
-
var errors = _dereq_("./errors");
|
2677 |
-
var OperationalError = errors.OperationalError;
|
2678 |
-
var es5 = _dereq_("./es5");
|
2679 |
-
|
2680 |
-
function isUntypedError(obj) {
|
2681 |
-
return obj instanceof Error &&
|
2682 |
-
es5.getPrototypeOf(obj) === Error.prototype;
|
2683 |
-
}
|
2684 |
-
|
2685 |
-
var rErrorKey = /^(?:name|message|stack|cause)$/;
|
2686 |
-
function wrapAsOperationalError(obj) {
|
2687 |
-
var ret;
|
2688 |
-
if (isUntypedError(obj)) {
|
2689 |
-
ret = new OperationalError(obj);
|
2690 |
-
ret.name = obj.name;
|
2691 |
-
ret.message = obj.message;
|
2692 |
-
ret.stack = obj.stack;
|
2693 |
-
var keys = es5.keys(obj);
|
2694 |
-
for (var i = 0; i < keys.length; ++i) {
|
2695 |
-
var key = keys[i];
|
2696 |
-
if (!rErrorKey.test(key)) {
|
2697 |
-
ret[key] = obj[key];
|
2698 |
-
}
|
2699 |
-
}
|
2700 |
-
return ret;
|
2701 |
-
}
|
2702 |
-
util.markAsOriginatingFromRejection(obj);
|
2703 |
-
return obj;
|
2704 |
-
}
|
2705 |
-
|
2706 |
-
function nodebackForPromise(promise, multiArgs) {
|
2707 |
-
return function(err, value) {
|
2708 |
-
if (promise === null) return;
|
2709 |
-
if (err) {
|
2710 |
-
var wrapped = wrapAsOperationalError(maybeWrapAsError(err));
|
2711 |
-
promise._attachExtraTrace(wrapped);
|
2712 |
-
promise._reject(wrapped);
|
2713 |
-
} else if (!multiArgs) {
|
2714 |
-
promise._fulfill(value);
|
2715 |
-
} else {
|
2716 |
-
var args = [].slice.call(arguments, 1);;
|
2717 |
-
promise._fulfill(args);
|
2718 |
-
}
|
2719 |
-
promise = null;
|
2720 |
-
};
|
2721 |
-
}
|
2722 |
-
|
2723 |
-
module.exports = nodebackForPromise;
|
2724 |
-
|
2725 |
-
},{"./errors":12,"./es5":13,"./util":36}],21:[function(_dereq_,module,exports){
|
2726 |
-
"use strict";
|
2727 |
-
module.exports = function(Promise) {
|
2728 |
-
var util = _dereq_("./util");
|
2729 |
-
var async = Promise._async;
|
2730 |
-
var tryCatch = util.tryCatch;
|
2731 |
-
var errorObj = util.errorObj;
|
2732 |
-
|
2733 |
-
function spreadAdapter(val, nodeback) {
|
2734 |
-
var promise = this;
|
2735 |
-
if (!util.isArray(val)) return successAdapter.call(promise, val, nodeback);
|
2736 |
-
var ret =
|
2737 |
-
tryCatch(nodeback).apply(promise._boundValue(), [null].concat(val));
|
2738 |
-
if (ret === errorObj) {
|
2739 |
-
async.throwLater(ret.e);
|
2740 |
-
}
|
2741 |
-
}
|
2742 |
-
|
2743 |
-
function successAdapter(val, nodeback) {
|
2744 |
-
var promise = this;
|
2745 |
-
var receiver = promise._boundValue();
|
2746 |
-
var ret = val === undefined
|
2747 |
-
? tryCatch(nodeback).call(receiver, null)
|
2748 |
-
: tryCatch(nodeback).call(receiver, null, val);
|
2749 |
-
if (ret === errorObj) {
|
2750 |
-
async.throwLater(ret.e);
|
2751 |
-
}
|
2752 |
-
}
|
2753 |
-
function errorAdapter(reason, nodeback) {
|
2754 |
-
var promise = this;
|
2755 |
-
if (!reason) {
|
2756 |
-
var newReason = new Error(reason + "");
|
2757 |
-
newReason.cause = reason;
|
2758 |
-
reason = newReason;
|
2759 |
-
}
|
2760 |
-
var ret = tryCatch(nodeback).call(promise._boundValue(), reason);
|
2761 |
-
if (ret === errorObj) {
|
2762 |
-
async.throwLater(ret.e);
|
2763 |
-
}
|
2764 |
-
}
|
2765 |
-
|
2766 |
-
Promise.prototype.asCallback = Promise.prototype.nodeify = function (nodeback,
|
2767 |
-
options) {
|
2768 |
-
if (typeof nodeback == "function") {
|
2769 |
-
var adapter = successAdapter;
|
2770 |
-
if (options !== undefined && Object(options).spread) {
|
2771 |
-
adapter = spreadAdapter;
|
2772 |
-
}
|
2773 |
-
this._then(
|
2774 |
-
adapter,
|
2775 |
-
errorAdapter,
|
2776 |
-
undefined,
|
2777 |
-
this,
|
2778 |
-
nodeback
|
2779 |
-
);
|
2780 |
-
}
|
2781 |
-
return this;
|
2782 |
-
};
|
2783 |
-
};
|
2784 |
-
|
2785 |
-
},{"./util":36}],22:[function(_dereq_,module,exports){
|
2786 |
-
"use strict";
|
2787 |
-
module.exports = function() {
|
2788 |
-
var makeSelfResolutionError = function () {
|
2789 |
-
return new TypeError("circular promise resolution chain\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
2790 |
-
};
|
2791 |
-
var reflectHandler = function() {
|
2792 |
-
return new Promise.PromiseInspection(this._target());
|
2793 |
-
};
|
2794 |
-
var apiRejection = function(msg) {
|
2795 |
-
return Promise.reject(new TypeError(msg));
|
2796 |
-
};
|
2797 |
-
function Proxyable() {}
|
2798 |
-
var UNDEFINED_BINDING = {};
|
2799 |
-
var util = _dereq_("./util");
|
2800 |
-
|
2801 |
-
var getDomain;
|
2802 |
-
if (util.isNode) {
|
2803 |
-
getDomain = function() {
|
2804 |
-
var ret = process.domain;
|
2805 |
-
if (ret === undefined) ret = null;
|
2806 |
-
return ret;
|
2807 |
-
};
|
2808 |
-
} else {
|
2809 |
-
getDomain = function() {
|
2810 |
-
return null;
|
2811 |
-
};
|
2812 |
-
}
|
2813 |
-
util.notEnumerableProp(Promise, "_getDomain", getDomain);
|
2814 |
-
|
2815 |
-
var es5 = _dereq_("./es5");
|
2816 |
-
var Async = _dereq_("./async");
|
2817 |
-
var async = new Async();
|
2818 |
-
es5.defineProperty(Promise, "_async", {value: async});
|
2819 |
-
var errors = _dereq_("./errors");
|
2820 |
-
var TypeError = Promise.TypeError = errors.TypeError;
|
2821 |
-
Promise.RangeError = errors.RangeError;
|
2822 |
-
var CancellationError = Promise.CancellationError = errors.CancellationError;
|
2823 |
-
Promise.TimeoutError = errors.TimeoutError;
|
2824 |
-
Promise.OperationalError = errors.OperationalError;
|
2825 |
-
Promise.RejectionError = errors.OperationalError;
|
2826 |
-
Promise.AggregateError = errors.AggregateError;
|
2827 |
-
var INTERNAL = function(){};
|
2828 |
-
var APPLY = {};
|
2829 |
-
var NEXT_FILTER = {};
|
2830 |
-
var tryConvertToPromise = _dereq_("./thenables")(Promise, INTERNAL);
|
2831 |
-
var PromiseArray =
|
2832 |
-
_dereq_("./promise_array")(Promise, INTERNAL,
|
2833 |
-
tryConvertToPromise, apiRejection, Proxyable);
|
2834 |
-
var Context = _dereq_("./context")(Promise);
|
2835 |
-
/*jshint unused:false*/
|
2836 |
-
var createContext = Context.create;
|
2837 |
-
var debug = _dereq_("./debuggability")(Promise, Context);
|
2838 |
-
var CapturedTrace = debug.CapturedTrace;
|
2839 |
-
var PassThroughHandlerContext =
|
2840 |
-
_dereq_("./finally")(Promise, tryConvertToPromise, NEXT_FILTER);
|
2841 |
-
var catchFilter = _dereq_("./catch_filter")(NEXT_FILTER);
|
2842 |
-
var nodebackForPromise = _dereq_("./nodeback");
|
2843 |
-
var errorObj = util.errorObj;
|
2844 |
-
var tryCatch = util.tryCatch;
|
2845 |
-
function check(self, executor) {
|
2846 |
-
if (self == null || self.constructor !== Promise) {
|
2847 |
-
throw new TypeError("the promise constructor cannot be invoked directly\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
2848 |
-
}
|
2849 |
-
if (typeof executor !== "function") {
|
2850 |
-
throw new TypeError("expecting a function but got " + util.classString(executor));
|
2851 |
-
}
|
2852 |
-
|
2853 |
-
}
|
2854 |
-
|
2855 |
-
function Promise(executor) {
|
2856 |
-
if (executor !== INTERNAL) {
|
2857 |
-
check(this, executor);
|
2858 |
-
}
|
2859 |
-
this._bitField = 0;
|
2860 |
-
this._fulfillmentHandler0 = undefined;
|
2861 |
-
this._rejectionHandler0 = undefined;
|
2862 |
-
this._promise0 = undefined;
|
2863 |
-
this._receiver0 = undefined;
|
2864 |
-
this._resolveFromExecutor(executor);
|
2865 |
-
this._promiseCreated();
|
2866 |
-
this._fireEvent("promiseCreated", this);
|
2867 |
-
}
|
2868 |
-
|
2869 |
-
Promise.prototype.toString = function () {
|
2870 |
-
return "[object Promise]";
|
2871 |
-
};
|
2872 |
-
|
2873 |
-
Promise.prototype.caught = Promise.prototype["catch"] = function (fn) {
|
2874 |
-
var len = arguments.length;
|
2875 |
-
if (len > 1) {
|
2876 |
-
var catchInstances = new Array(len - 1),
|
2877 |
-
j = 0, i;
|
2878 |
-
for (i = 0; i < len - 1; ++i) {
|
2879 |
-
var item = arguments[i];
|
2880 |
-
if (util.isObject(item)) {
|
2881 |
-
catchInstances[j++] = item;
|
2882 |
-
} else {
|
2883 |
-
return apiRejection("Catch statement predicate: " +
|
2884 |
-
"expecting an object but got " + util.classString(item));
|
2885 |
-
}
|
2886 |
-
}
|
2887 |
-
catchInstances.length = j;
|
2888 |
-
fn = arguments[i];
|
2889 |
-
return this.then(undefined, catchFilter(catchInstances, fn, this));
|
2890 |
-
}
|
2891 |
-
return this.then(undefined, fn);
|
2892 |
-
};
|
2893 |
-
|
2894 |
-
Promise.prototype.reflect = function () {
|
2895 |
-
return this._then(reflectHandler,
|
2896 |
-
reflectHandler, undefined, this, undefined);
|
2897 |
-
};
|
2898 |
-
|
2899 |
-
Promise.prototype.then = function (didFulfill, didReject) {
|
2900 |
-
if (debug.warnings() && arguments.length > 0 &&
|
2901 |
-
typeof didFulfill !== "function" &&
|
2902 |
-
typeof didReject !== "function") {
|
2903 |
-
var msg = ".then() only accepts functions but was passed: " +
|
2904 |
-
util.classString(didFulfill);
|
2905 |
-
if (arguments.length > 1) {
|
2906 |
-
msg += ", " + util.classString(didReject);
|
2907 |
-
}
|
2908 |
-
this._warn(msg);
|
2909 |
-
}
|
2910 |
-
return this._then(didFulfill, didReject, undefined, undefined, undefined);
|
2911 |
-
};
|
2912 |
-
|
2913 |
-
Promise.prototype.done = function (didFulfill, didReject) {
|
2914 |
-
var promise =
|
2915 |
-
this._then(didFulfill, didReject, undefined, undefined, undefined);
|
2916 |
-
promise._setIsFinal();
|
2917 |
-
};
|
2918 |
-
|
2919 |
-
Promise.prototype.spread = function (fn) {
|
2920 |
-
if (typeof fn !== "function") {
|
2921 |
-
return apiRejection("expecting a function but got " + util.classString(fn));
|
2922 |
-
}
|
2923 |
-
return this.all()._then(fn, undefined, undefined, APPLY, undefined);
|
2924 |
-
};
|
2925 |
-
|
2926 |
-
Promise.prototype.toJSON = function () {
|
2927 |
-
var ret = {
|
2928 |
-
isFulfilled: false,
|
2929 |
-
isRejected: false,
|
2930 |
-
fulfillmentValue: undefined,
|
2931 |
-
rejectionReason: undefined
|
2932 |
-
};
|
2933 |
-
if (this.isFulfilled()) {
|
2934 |
-
ret.fulfillmentValue = this.value();
|
2935 |
-
ret.isFulfilled = true;
|
2936 |
-
} else if (this.isRejected()) {
|
2937 |
-
ret.rejectionReason = this.reason();
|
2938 |
-
ret.isRejected = true;
|
2939 |
-
}
|
2940 |
-
return ret;
|
2941 |
-
};
|
2942 |
-
|
2943 |
-
Promise.prototype.all = function () {
|
2944 |
-
if (arguments.length > 0) {
|
2945 |
-
this._warn(".all() was passed arguments but it does not take any");
|
2946 |
-
}
|
2947 |
-
return new PromiseArray(this).promise();
|
2948 |
-
};
|
2949 |
-
|
2950 |
-
Promise.prototype.error = function (fn) {
|
2951 |
-
return this.caught(util.originatesFromRejection, fn);
|
2952 |
-
};
|
2953 |
-
|
2954 |
-
Promise.getNewLibraryCopy = module.exports;
|
2955 |
-
|
2956 |
-
Promise.is = function (val) {
|
2957 |
-
return val instanceof Promise;
|
2958 |
-
};
|
2959 |
-
|
2960 |
-
Promise.fromNode = Promise.fromCallback = function(fn) {
|
2961 |
-
var ret = new Promise(INTERNAL);
|
2962 |
-
ret._captureStackTrace();
|
2963 |
-
var multiArgs = arguments.length > 1 ? !!Object(arguments[1]).multiArgs
|
2964 |
-
: false;
|
2965 |
-
var result = tryCatch(fn)(nodebackForPromise(ret, multiArgs));
|
2966 |
-
if (result === errorObj) {
|
2967 |
-
ret._rejectCallback(result.e, true);
|
2968 |
-
}
|
2969 |
-
if (!ret._isFateSealed()) ret._setAsyncGuaranteed();
|
2970 |
-
return ret;
|
2971 |
-
};
|
2972 |
-
|
2973 |
-
Promise.all = function (promises) {
|
2974 |
-
return new PromiseArray(promises).promise();
|
2975 |
-
};
|
2976 |
-
|
2977 |
-
Promise.cast = function (obj) {
|
2978 |
-
var ret = tryConvertToPromise(obj);
|
2979 |
-
if (!(ret instanceof Promise)) {
|
2980 |
-
ret = new Promise(INTERNAL);
|
2981 |
-
ret._captureStackTrace();
|
2982 |
-
ret._setFulfilled();
|
2983 |
-
ret._rejectionHandler0 = obj;
|
2984 |
-
}
|
2985 |
-
return ret;
|
2986 |
-
};
|
2987 |
-
|
2988 |
-
Promise.resolve = Promise.fulfilled = Promise.cast;
|
2989 |
-
|
2990 |
-
Promise.reject = Promise.rejected = function (reason) {
|
2991 |
-
var ret = new Promise(INTERNAL);
|
2992 |
-
ret._captureStackTrace();
|
2993 |
-
ret._rejectCallback(reason, true);
|
2994 |
-
return ret;
|
2995 |
-
};
|
2996 |
-
|
2997 |
-
Promise.setScheduler = function(fn) {
|
2998 |
-
if (typeof fn !== "function") {
|
2999 |
-
throw new TypeError("expecting a function but got " + util.classString(fn));
|
3000 |
-
}
|
3001 |
-
return async.setScheduler(fn);
|
3002 |
-
};
|
3003 |
-
|
3004 |
-
Promise.prototype._then = function (
|
3005 |
-
didFulfill,
|
3006 |
-
didReject,
|
3007 |
-
_, receiver,
|
3008 |
-
internalData
|
3009 |
-
) {
|
3010 |
-
var haveInternalData = internalData !== undefined;
|
3011 |
-
var promise = haveInternalData ? internalData : new Promise(INTERNAL);
|
3012 |
-
var target = this._target();
|
3013 |
-
var bitField = target._bitField;
|
3014 |
-
|
3015 |
-
if (!haveInternalData) {
|
3016 |
-
promise._propagateFrom(this, 3);
|
3017 |
-
promise._captureStackTrace();
|
3018 |
-
if (receiver === undefined &&
|
3019 |
-
((this._bitField & 2097152) !== 0)) {
|
3020 |
-
if (!((bitField & 50397184) === 0)) {
|
3021 |
-
receiver = this._boundValue();
|
3022 |
-
} else {
|
3023 |
-
receiver = target === this ? undefined : this._boundTo;
|
3024 |
-
}
|
3025 |
-
}
|
3026 |
-
this._fireEvent("promiseChained", this, promise);
|
3027 |
-
}
|
3028 |
-
|
3029 |
-
var domain = getDomain();
|
3030 |
-
if (!((bitField & 50397184) === 0)) {
|
3031 |
-
var handler, value, settler = target._settlePromiseCtx;
|
3032 |
-
if (((bitField & 33554432) !== 0)) {
|
3033 |
-
value = target._rejectionHandler0;
|
3034 |
-
handler = didFulfill;
|
3035 |
-
} else if (((bitField & 16777216) !== 0)) {
|
3036 |
-
value = target._fulfillmentHandler0;
|
3037 |
-
handler = didReject;
|
3038 |
-
target._unsetRejectionIsUnhandled();
|
3039 |
-
} else {
|
3040 |
-
settler = target._settlePromiseLateCancellationObserver;
|
3041 |
-
value = new CancellationError("late cancellation observer");
|
3042 |
-
target._attachExtraTrace(value);
|
3043 |
-
handler = didReject;
|
3044 |
-
}
|
3045 |
-
|
3046 |
-
async.invoke(settler, target, {
|
3047 |
-
handler: domain === null ? handler
|
3048 |
-
: (typeof handler === "function" &&
|
3049 |
-
util.domainBind(domain, handler)),
|
3050 |
-
promise: promise,
|
3051 |
-
receiver: receiver,
|
3052 |
-
value: value
|
3053 |
-
});
|
3054 |
-
} else {
|
3055 |
-
target._addCallbacks(didFulfill, didReject, promise, receiver, domain);
|
3056 |
-
}
|
3057 |
-
|
3058 |
-
return promise;
|
3059 |
-
};
|
3060 |
-
|
3061 |
-
Promise.prototype._length = function () {
|
3062 |
-
return this._bitField & 65535;
|
3063 |
-
};
|
3064 |
-
|
3065 |
-
Promise.prototype._isFateSealed = function () {
|
3066 |
-
return (this._bitField & 117506048) !== 0;
|
3067 |
-
};
|
3068 |
-
|
3069 |
-
Promise.prototype._isFollowing = function () {
|
3070 |
-
return (this._bitField & 67108864) === 67108864;
|
3071 |
-
};
|
3072 |
-
|
3073 |
-
Promise.prototype._setLength = function (len) {
|
3074 |
-
this._bitField = (this._bitField & -65536) |
|
3075 |
-
(len & 65535);
|
3076 |
-
};
|
3077 |
-
|
3078 |
-
Promise.prototype._setFulfilled = function () {
|
3079 |
-
this._bitField = this._bitField | 33554432;
|
3080 |
-
this._fireEvent("promiseFulfilled", this);
|
3081 |
-
};
|
3082 |
-
|
3083 |
-
Promise.prototype._setRejected = function () {
|
3084 |
-
this._bitField = this._bitField | 16777216;
|
3085 |
-
this._fireEvent("promiseRejected", this);
|
3086 |
-
};
|
3087 |
-
|
3088 |
-
Promise.prototype._setFollowing = function () {
|
3089 |
-
this._bitField = this._bitField | 67108864;
|
3090 |
-
this._fireEvent("promiseResolved", this);
|
3091 |
-
};
|
3092 |
-
|
3093 |
-
Promise.prototype._setIsFinal = function () {
|
3094 |
-
this._bitField = this._bitField | 4194304;
|
3095 |
-
};
|
3096 |
-
|
3097 |
-
Promise.prototype._isFinal = function () {
|
3098 |
-
return (this._bitField & 4194304) > 0;
|
3099 |
-
};
|
3100 |
-
|
3101 |
-
Promise.prototype._unsetCancelled = function() {
|
3102 |
-
this._bitField = this._bitField & (~65536);
|
3103 |
-
};
|
3104 |
-
|
3105 |
-
Promise.prototype._setCancelled = function() {
|
3106 |
-
this._bitField = this._bitField | 65536;
|
3107 |
-
this._fireEvent("promiseCancelled", this);
|
3108 |
-
};
|
3109 |
-
|
3110 |
-
Promise.prototype._setWillBeCancelled = function() {
|
3111 |
-
this._bitField = this._bitField | 8388608;
|
3112 |
-
};
|
3113 |
-
|
3114 |
-
Promise.prototype._setAsyncGuaranteed = function() {
|
3115 |
-
if (async.hasCustomScheduler()) return;
|
3116 |
-
this._bitField = this._bitField | 134217728;
|
3117 |
-
};
|
3118 |
-
|
3119 |
-
Promise.prototype._receiverAt = function (index) {
|
3120 |
-
var ret = index === 0 ? this._receiver0 : this[
|
3121 |
-
index * 4 - 4 + 3];
|
3122 |
-
if (ret === UNDEFINED_BINDING) {
|
3123 |
-
return undefined;
|
3124 |
-
} else if (ret === undefined && this._isBound()) {
|
3125 |
-
return this._boundValue();
|
3126 |
-
}
|
3127 |
-
return ret;
|
3128 |
-
};
|
3129 |
-
|
3130 |
-
Promise.prototype._promiseAt = function (index) {
|
3131 |
-
return this[
|
3132 |
-
index * 4 - 4 + 2];
|
3133 |
-
};
|
3134 |
-
|
3135 |
-
Promise.prototype._fulfillmentHandlerAt = function (index) {
|
3136 |
-
return this[
|
3137 |
-
index * 4 - 4 + 0];
|
3138 |
-
};
|
3139 |
-
|
3140 |
-
Promise.prototype._rejectionHandlerAt = function (index) {
|
3141 |
-
return this[
|
3142 |
-
index * 4 - 4 + 1];
|
3143 |
-
};
|
3144 |
-
|
3145 |
-
Promise.prototype._boundValue = function() {};
|
3146 |
-
|
3147 |
-
Promise.prototype._migrateCallback0 = function (follower) {
|
3148 |
-
var bitField = follower._bitField;
|
3149 |
-
var fulfill = follower._fulfillmentHandler0;
|
3150 |
-
var reject = follower._rejectionHandler0;
|
3151 |
-
var promise = follower._promise0;
|
3152 |
-
var receiver = follower._receiverAt(0);
|
3153 |
-
if (receiver === undefined) receiver = UNDEFINED_BINDING;
|
3154 |
-
this._addCallbacks(fulfill, reject, promise, receiver, null);
|
3155 |
-
};
|
3156 |
-
|
3157 |
-
Promise.prototype._migrateCallbackAt = function (follower, index) {
|
3158 |
-
var fulfill = follower._fulfillmentHandlerAt(index);
|
3159 |
-
var reject = follower._rejectionHandlerAt(index);
|
3160 |
-
var promise = follower._promiseAt(index);
|
3161 |
-
var receiver = follower._receiverAt(index);
|
3162 |
-
if (receiver === undefined) receiver = UNDEFINED_BINDING;
|
3163 |
-
this._addCallbacks(fulfill, reject, promise, receiver, null);
|
3164 |
-
};
|
3165 |
-
|
3166 |
-
Promise.prototype._addCallbacks = function (
|
3167 |
-
fulfill,
|
3168 |
-
reject,
|
3169 |
-
promise,
|
3170 |
-
receiver,
|
3171 |
-
domain
|
3172 |
-
) {
|
3173 |
-
var index = this._length();
|
3174 |
-
|
3175 |
-
if (index >= 65535 - 4) {
|
3176 |
-
index = 0;
|
3177 |
-
this._setLength(0);
|
3178 |
-
}
|
3179 |
-
|
3180 |
-
if (index === 0) {
|
3181 |
-
this._promise0 = promise;
|
3182 |
-
this._receiver0 = receiver;
|
3183 |
-
if (typeof fulfill === "function") {
|
3184 |
-
this._fulfillmentHandler0 =
|
3185 |
-
domain === null ? fulfill : util.domainBind(domain, fulfill);
|
3186 |
-
}
|
3187 |
-
if (typeof reject === "function") {
|
3188 |
-
this._rejectionHandler0 =
|
3189 |
-
domain === null ? reject : util.domainBind(domain, reject);
|
3190 |
-
}
|
3191 |
-
} else {
|
3192 |
-
var base = index * 4 - 4;
|
3193 |
-
this[base + 2] = promise;
|
3194 |
-
this[base + 3] = receiver;
|
3195 |
-
if (typeof fulfill === "function") {
|
3196 |
-
this[base + 0] =
|
3197 |
-
domain === null ? fulfill : util.domainBind(domain, fulfill);
|
3198 |
-
}
|
3199 |
-
if (typeof reject === "function") {
|
3200 |
-
this[base + 1] =
|
3201 |
-
domain === null ? reject : util.domainBind(domain, reject);
|
3202 |
-
}
|
3203 |
-
}
|
3204 |
-
this._setLength(index + 1);
|
3205 |
-
return index;
|
3206 |
-
};
|
3207 |
-
|
3208 |
-
Promise.prototype._proxy = function (proxyable, arg) {
|
3209 |
-
this._addCallbacks(undefined, undefined, arg, proxyable, null);
|
3210 |
-
};
|
3211 |
-
|
3212 |
-
Promise.prototype._resolveCallback = function(value, shouldBind) {
|
3213 |
-
if (((this._bitField & 117506048) !== 0)) return;
|
3214 |
-
if (value === this)
|
3215 |
-
return this._rejectCallback(makeSelfResolutionError(), false);
|
3216 |
-
var maybePromise = tryConvertToPromise(value, this);
|
3217 |
-
if (!(maybePromise instanceof Promise)) return this._fulfill(value);
|
3218 |
-
|
3219 |
-
if (shouldBind) this._propagateFrom(maybePromise, 2);
|
3220 |
-
|
3221 |
-
var promise = maybePromise._target();
|
3222 |
-
|
3223 |
-
if (promise === this) {
|
3224 |
-
this._reject(makeSelfResolutionError());
|
3225 |
-
return;
|
3226 |
-
}
|
3227 |
-
|
3228 |
-
var bitField = promise._bitField;
|
3229 |
-
if (((bitField & 50397184) === 0)) {
|
3230 |
-
var len = this._length();
|
3231 |
-
if (len > 0) promise._migrateCallback0(this);
|
3232 |
-
for (var i = 1; i < len; ++i) {
|
3233 |
-
promise._migrateCallbackAt(this, i);
|
3234 |
-
}
|
3235 |
-
this._setFollowing();
|
3236 |
-
this._setLength(0);
|
3237 |
-
this._setFollowee(promise);
|
3238 |
-
} else if (((bitField & 33554432) !== 0)) {
|
3239 |
-
this._fulfill(promise._value());
|
3240 |
-
} else if (((bitField & 16777216) !== 0)) {
|
3241 |
-
this._reject(promise._reason());
|
3242 |
-
} else {
|
3243 |
-
var reason = new CancellationError("late cancellation observer");
|
3244 |
-
promise._attachExtraTrace(reason);
|
3245 |
-
this._reject(reason);
|
3246 |
-
}
|
3247 |
-
};
|
3248 |
-
|
3249 |
-
Promise.prototype._rejectCallback =
|
3250 |
-
function(reason, synchronous, ignoreNonErrorWarnings) {
|
3251 |
-
var trace = util.ensureErrorObject(reason);
|
3252 |
-
var hasStack = trace === reason;
|
3253 |
-
if (!hasStack && !ignoreNonErrorWarnings && debug.warnings()) {
|
3254 |
-
var message = "a promise was rejected with a non-error: " +
|
3255 |
-
util.classString(reason);
|
3256 |
-
this._warn(message, true);
|
3257 |
-
}
|
3258 |
-
this._attachExtraTrace(trace, synchronous ? hasStack : false);
|
3259 |
-
this._reject(reason);
|
3260 |
-
};
|
3261 |
-
|
3262 |
-
Promise.prototype._resolveFromExecutor = function (executor) {
|
3263 |
-
if (executor === INTERNAL) return;
|
3264 |
-
var promise = this;
|
3265 |
-
this._captureStackTrace();
|
3266 |
-
this._pushContext();
|
3267 |
-
var synchronous = true;
|
3268 |
-
var r = this._execute(executor, function(value) {
|
3269 |
-
promise._resolveCallback(value);
|
3270 |
-
}, function (reason) {
|
3271 |
-
promise._rejectCallback(reason, synchronous);
|
3272 |
-
});
|
3273 |
-
synchronous = false;
|
3274 |
-
this._popContext();
|
3275 |
-
|
3276 |
-
if (r !== undefined) {
|
3277 |
-
promise._rejectCallback(r, true);
|
3278 |
-
}
|
3279 |
-
};
|
3280 |
-
|
3281 |
-
Promise.prototype._settlePromiseFromHandler = function (
|
3282 |
-
handler, receiver, value, promise
|
3283 |
-
) {
|
3284 |
-
var bitField = promise._bitField;
|
3285 |
-
if (((bitField & 65536) !== 0)) return;
|
3286 |
-
promise._pushContext();
|
3287 |
-
var x;
|
3288 |
-
if (receiver === APPLY) {
|
3289 |
-
if (!value || typeof value.length !== "number") {
|
3290 |
-
x = errorObj;
|
3291 |
-
x.e = new TypeError("cannot .spread() a non-array: " +
|
3292 |
-
util.classString(value));
|
3293 |
-
} else {
|
3294 |
-
x = tryCatch(handler).apply(this._boundValue(), value);
|
3295 |
-
}
|
3296 |
-
} else {
|
3297 |
-
x = tryCatch(handler).call(receiver, value);
|
3298 |
-
}
|
3299 |
-
var promiseCreated = promise._popContext();
|
3300 |
-
bitField = promise._bitField;
|
3301 |
-
if (((bitField & 65536) !== 0)) return;
|
3302 |
-
|
3303 |
-
if (x === NEXT_FILTER) {
|
3304 |
-
promise._reject(value);
|
3305 |
-
} else if (x === errorObj) {
|
3306 |
-
promise._rejectCallback(x.e, false);
|
3307 |
-
} else {
|
3308 |
-
debug.checkForgottenReturns(x, promiseCreated, "", promise, this);
|
3309 |
-
promise._resolveCallback(x);
|
3310 |
-
}
|
3311 |
-
};
|
3312 |
-
|
3313 |
-
Promise.prototype._target = function() {
|
3314 |
-
var ret = this;
|
3315 |
-
while (ret._isFollowing()) ret = ret._followee();
|
3316 |
-
return ret;
|
3317 |
-
};
|
3318 |
-
|
3319 |
-
Promise.prototype._followee = function() {
|
3320 |
-
return this._rejectionHandler0;
|
3321 |
-
};
|
3322 |
-
|
3323 |
-
Promise.prototype._setFollowee = function(promise) {
|
3324 |
-
this._rejectionHandler0 = promise;
|
3325 |
-
};
|
3326 |
-
|
3327 |
-
Promise.prototype._settlePromise = function(promise, handler, receiver, value) {
|
3328 |
-
var isPromise = promise instanceof Promise;
|
3329 |
-
var bitField = this._bitField;
|
3330 |
-
var asyncGuaranteed = ((bitField & 134217728) !== 0);
|
3331 |
-
if (((bitField & 65536) !== 0)) {
|
3332 |
-
if (isPromise) promise._invokeInternalOnCancel();
|
3333 |
-
|
3334 |
-
if (receiver instanceof PassThroughHandlerContext &&
|
3335 |
-
receiver.isFinallyHandler()) {
|
3336 |
-
receiver.cancelPromise = promise;
|
3337 |
-
if (tryCatch(handler).call(receiver, value) === errorObj) {
|
3338 |
-
promise._reject(errorObj.e);
|
3339 |
-
}
|
3340 |
-
} else if (handler === reflectHandler) {
|
3341 |
-
promise._fulfill(reflectHandler.call(receiver));
|
3342 |
-
} else if (receiver instanceof Proxyable) {
|
3343 |
-
receiver._promiseCancelled(promise);
|
3344 |
-
} else if (isPromise || promise instanceof PromiseArray) {
|
3345 |
-
promise._cancel();
|
3346 |
-
} else {
|
3347 |
-
receiver.cancel();
|
3348 |
-
}
|
3349 |
-
} else if (typeof handler === "function") {
|
3350 |
-
if (!isPromise) {
|
3351 |
-
handler.call(receiver, value, promise);
|
3352 |
-
} else {
|
3353 |
-
if (asyncGuaranteed) promise._setAsyncGuaranteed();
|
3354 |
-
this._settlePromiseFromHandler(handler, receiver, value, promise);
|
3355 |
-
}
|
3356 |
-
} else if (receiver instanceof Proxyable) {
|
3357 |
-
if (!receiver._isResolved()) {
|
3358 |
-
if (((bitField & 33554432) !== 0)) {
|
3359 |
-
receiver._promiseFulfilled(value, promise);
|
3360 |
-
} else {
|
3361 |
-
receiver._promiseRejected(value, promise);
|
3362 |
-
}
|
3363 |
-
}
|
3364 |
-
} else if (isPromise) {
|
3365 |
-
if (asyncGuaranteed) promise._setAsyncGuaranteed();
|
3366 |
-
if (((bitField & 33554432) !== 0)) {
|
3367 |
-
promise._fulfill(value);
|
3368 |
-
} else {
|
3369 |
-
promise._reject(value);
|
3370 |
-
}
|
3371 |
-
}
|
3372 |
-
};
|
3373 |
-
|
3374 |
-
Promise.prototype._settlePromiseLateCancellationObserver = function(ctx) {
|
3375 |
-
var handler = ctx.handler;
|
3376 |
-
var promise = ctx.promise;
|
3377 |
-
var receiver = ctx.receiver;
|
3378 |
-
var value = ctx.value;
|
3379 |
-
if (typeof handler === "function") {
|
3380 |
-
if (!(promise instanceof Promise)) {
|
3381 |
-
handler.call(receiver, value, promise);
|
3382 |
-
} else {
|
3383 |
-
this._settlePromiseFromHandler(handler, receiver, value, promise);
|
3384 |
-
}
|
3385 |
-
} else if (promise instanceof Promise) {
|
3386 |
-
promise._reject(value);
|
3387 |
-
}
|
3388 |
-
};
|
3389 |
-
|
3390 |
-
Promise.prototype._settlePromiseCtx = function(ctx) {
|
3391 |
-
this._settlePromise(ctx.promise, ctx.handler, ctx.receiver, ctx.value);
|
3392 |
-
};
|
3393 |
-
|
3394 |
-
Promise.prototype._settlePromise0 = function(handler, value, bitField) {
|
3395 |
-
var promise = this._promise0;
|
3396 |
-
var receiver = this._receiverAt(0);
|
3397 |
-
this._promise0 = undefined;
|
3398 |
-
this._receiver0 = undefined;
|
3399 |
-
this._settlePromise(promise, handler, receiver, value);
|
3400 |
-
};
|
3401 |
-
|
3402 |
-
Promise.prototype._clearCallbackDataAtIndex = function(index) {
|
3403 |
-
var base = index * 4 - 4;
|
3404 |
-
this[base + 2] =
|
3405 |
-
this[base + 3] =
|
3406 |
-
this[base + 0] =
|
3407 |
-
this[base + 1] = undefined;
|
3408 |
-
};
|
3409 |
-
|
3410 |
-
Promise.prototype._fulfill = function (value) {
|
3411 |
-
var bitField = this._bitField;
|
3412 |
-
if (((bitField & 117506048) >>> 16)) return;
|
3413 |
-
if (value === this) {
|
3414 |
-
var err = makeSelfResolutionError();
|
3415 |
-
this._attachExtraTrace(err);
|
3416 |
-
return this._reject(err);
|
3417 |
-
}
|
3418 |
-
this._setFulfilled();
|
3419 |
-
this._rejectionHandler0 = value;
|
3420 |
-
|
3421 |
-
if ((bitField & 65535) > 0) {
|
3422 |
-
if (((bitField & 134217728) !== 0)) {
|
3423 |
-
this._settlePromises();
|
3424 |
-
} else {
|
3425 |
-
async.settlePromises(this);
|
3426 |
-
}
|
3427 |
-
this._dereferenceTrace();
|
3428 |
-
}
|
3429 |
-
};
|
3430 |
-
|
3431 |
-
Promise.prototype._reject = function (reason) {
|
3432 |
-
var bitField = this._bitField;
|
3433 |
-
if (((bitField & 117506048) >>> 16)) return;
|
3434 |
-
this._setRejected();
|
3435 |
-
this._fulfillmentHandler0 = reason;
|
3436 |
-
|
3437 |
-
if (this._isFinal()) {
|
3438 |
-
return async.fatalError(reason, util.isNode);
|
3439 |
-
}
|
3440 |
-
|
3441 |
-
if ((bitField & 65535) > 0) {
|
3442 |
-
async.settlePromises(this);
|
3443 |
-
} else {
|
3444 |
-
this._ensurePossibleRejectionHandled();
|
3445 |
-
}
|
3446 |
-
};
|
3447 |
-
|
3448 |
-
Promise.prototype._fulfillPromises = function (len, value) {
|
3449 |
-
for (var i = 1; i < len; i++) {
|
3450 |
-
var handler = this._fulfillmentHandlerAt(i);
|
3451 |
-
var promise = this._promiseAt(i);
|
3452 |
-
var receiver = this._receiverAt(i);
|
3453 |
-
this._clearCallbackDataAtIndex(i);
|
3454 |
-
this._settlePromise(promise, handler, receiver, value);
|
3455 |
-
}
|
3456 |
-
};
|
3457 |
-
|
3458 |
-
Promise.prototype._rejectPromises = function (len, reason) {
|
3459 |
-
for (var i = 1; i < len; i++) {
|
3460 |
-
var handler = this._rejectionHandlerAt(i);
|
3461 |
-
var promise = this._promiseAt(i);
|
3462 |
-
var receiver = this._receiverAt(i);
|
3463 |
-
this._clearCallbackDataAtIndex(i);
|
3464 |
-
this._settlePromise(promise, handler, receiver, reason);
|
3465 |
-
}
|
3466 |
-
};
|
3467 |
-
|
3468 |
-
Promise.prototype._settlePromises = function () {
|
3469 |
-
var bitField = this._bitField;
|
3470 |
-
var len = (bitField & 65535);
|
3471 |
-
|
3472 |
-
if (len > 0) {
|
3473 |
-
if (((bitField & 16842752) !== 0)) {
|
3474 |
-
var reason = this._fulfillmentHandler0;
|
3475 |
-
this._settlePromise0(this._rejectionHandler0, reason, bitField);
|
3476 |
-
this._rejectPromises(len, reason);
|
3477 |
-
} else {
|
3478 |
-
var value = this._rejectionHandler0;
|
3479 |
-
this._settlePromise0(this._fulfillmentHandler0, value, bitField);
|
3480 |
-
this._fulfillPromises(len, value);
|
3481 |
-
}
|
3482 |
-
this._setLength(0);
|
3483 |
-
}
|
3484 |
-
this._clearCancellationData();
|
3485 |
-
};
|
3486 |
-
|
3487 |
-
Promise.prototype._settledValue = function() {
|
3488 |
-
var bitField = this._bitField;
|
3489 |
-
if (((bitField & 33554432) !== 0)) {
|
3490 |
-
return this._rejectionHandler0;
|
3491 |
-
} else if (((bitField & 16777216) !== 0)) {
|
3492 |
-
return this._fulfillmentHandler0;
|
3493 |
-
}
|
3494 |
-
};
|
3495 |
-
|
3496 |
-
function deferResolve(v) {this.promise._resolveCallback(v);}
|
3497 |
-
function deferReject(v) {this.promise._rejectCallback(v, false);}
|
3498 |
-
|
3499 |
-
Promise.defer = Promise.pending = function() {
|
3500 |
-
debug.deprecated("Promise.defer", "new Promise");
|
3501 |
-
var promise = new Promise(INTERNAL);
|
3502 |
-
return {
|
3503 |
-
promise: promise,
|
3504 |
-
resolve: deferResolve,
|
3505 |
-
reject: deferReject
|
3506 |
-
};
|
3507 |
-
};
|
3508 |
-
|
3509 |
-
util.notEnumerableProp(Promise,
|
3510 |
-
"_makeSelfResolutionError",
|
3511 |
-
makeSelfResolutionError);
|
3512 |
-
|
3513 |
-
_dereq_("./method")(Promise, INTERNAL, tryConvertToPromise, apiRejection,
|
3514 |
-
debug);
|
3515 |
-
_dereq_("./bind")(Promise, INTERNAL, tryConvertToPromise, debug);
|
3516 |
-
_dereq_("./cancel")(Promise, PromiseArray, apiRejection, debug);
|
3517 |
-
_dereq_("./direct_resolve")(Promise);
|
3518 |
-
_dereq_("./synchronous_inspection")(Promise);
|
3519 |
-
_dereq_("./join")(
|
3520 |
-
Promise, PromiseArray, tryConvertToPromise, INTERNAL, async, getDomain);
|
3521 |
-
Promise.Promise = Promise;
|
3522 |
-
Promise.version = "3.5.3";
|
3523 |
-
_dereq_('./map.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug);
|
3524 |
-
_dereq_('./call_get.js')(Promise);
|
3525 |
-
_dereq_('./using.js')(Promise, apiRejection, tryConvertToPromise, createContext, INTERNAL, debug);
|
3526 |
-
_dereq_('./timers.js')(Promise, INTERNAL, debug);
|
3527 |
-
_dereq_('./generators.js')(Promise, apiRejection, INTERNAL, tryConvertToPromise, Proxyable, debug);
|
3528 |
-
_dereq_('./nodeify.js')(Promise);
|
3529 |
-
_dereq_('./promisify.js')(Promise, INTERNAL);
|
3530 |
-
_dereq_('./props.js')(Promise, PromiseArray, tryConvertToPromise, apiRejection);
|
3531 |
-
_dereq_('./race.js')(Promise, INTERNAL, tryConvertToPromise, apiRejection);
|
3532 |
-
_dereq_('./reduce.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL, debug);
|
3533 |
-
_dereq_('./settle.js')(Promise, PromiseArray, debug);
|
3534 |
-
_dereq_('./some.js')(Promise, PromiseArray, apiRejection);
|
3535 |
-
_dereq_('./filter.js')(Promise, INTERNAL);
|
3536 |
-
_dereq_('./each.js')(Promise, INTERNAL);
|
3537 |
-
_dereq_('./any.js')(Promise);
|
3538 |
-
|
3539 |
-
util.toFastProperties(Promise);
|
3540 |
-
util.toFastProperties(Promise.prototype);
|
3541 |
-
function fillTypes(value) {
|
3542 |
-
var p = new Promise(INTERNAL);
|
3543 |
-
p._fulfillmentHandler0 = value;
|
3544 |
-
p._rejectionHandler0 = value;
|
3545 |
-
p._promise0 = value;
|
3546 |
-
p._receiver0 = value;
|
3547 |
-
}
|
3548 |
-
// Complete slack tracking, opt out of field-type tracking and
|
3549 |
-
// stabilize map
|
3550 |
-
fillTypes({a: 1});
|
3551 |
-
fillTypes({b: 2});
|
3552 |
-
fillTypes({c: 3});
|
3553 |
-
fillTypes(1);
|
3554 |
-
fillTypes(function(){});
|
3555 |
-
fillTypes(undefined);
|
3556 |
-
fillTypes(false);
|
3557 |
-
fillTypes(new Promise(INTERNAL));
|
3558 |
-
debug.setBounds(Async.firstLineError, util.lastLineError);
|
3559 |
-
return Promise;
|
3560 |
-
|
3561 |
-
};
|
3562 |
-
|
3563 |
-
},{"./any.js":1,"./async":2,"./bind":3,"./call_get.js":5,"./cancel":6,"./catch_filter":7,"./context":8,"./debuggability":9,"./direct_resolve":10,"./each.js":11,"./errors":12,"./es5":13,"./filter.js":14,"./finally":15,"./generators.js":16,"./join":17,"./map.js":18,"./method":19,"./nodeback":20,"./nodeify.js":21,"./promise_array":23,"./promisify.js":24,"./props.js":25,"./race.js":27,"./reduce.js":28,"./settle.js":30,"./some.js":31,"./synchronous_inspection":32,"./thenables":33,"./timers.js":34,"./using.js":35,"./util":36}],23:[function(_dereq_,module,exports){
|
3564 |
-
"use strict";
|
3565 |
-
module.exports = function(Promise, INTERNAL, tryConvertToPromise,
|
3566 |
-
apiRejection, Proxyable) {
|
3567 |
-
var util = _dereq_("./util");
|
3568 |
-
var isArray = util.isArray;
|
3569 |
-
|
3570 |
-
function toResolutionValue(val) {
|
3571 |
-
switch(val) {
|
3572 |
-
case -2: return [];
|
3573 |
-
case -3: return {};
|
3574 |
-
case -6: return new Map();
|
3575 |
-
}
|
3576 |
-
}
|
3577 |
-
|
3578 |
-
function PromiseArray(values) {
|
3579 |
-
var promise = this._promise = new Promise(INTERNAL);
|
3580 |
-
if (values instanceof Promise) {
|
3581 |
-
promise._propagateFrom(values, 3);
|
3582 |
-
}
|
3583 |
-
promise._setOnCancel(this);
|
3584 |
-
this._values = values;
|
3585 |
-
this._length = 0;
|
3586 |
-
this._totalResolved = 0;
|
3587 |
-
this._init(undefined, -2);
|
3588 |
-
}
|
3589 |
-
util.inherits(PromiseArray, Proxyable);
|
3590 |
-
|
3591 |
-
PromiseArray.prototype.length = function () {
|
3592 |
-
return this._length;
|
3593 |
-
};
|
3594 |
-
|
3595 |
-
PromiseArray.prototype.promise = function () {
|
3596 |
-
return this._promise;
|
3597 |
-
};
|
3598 |
-
|
3599 |
-
PromiseArray.prototype._init = function init(_, resolveValueIfEmpty) {
|
3600 |
-
var values = tryConvertToPromise(this._values, this._promise);
|
3601 |
-
if (values instanceof Promise) {
|
3602 |
-
values = values._target();
|
3603 |
-
var bitField = values._bitField;
|
3604 |
-
;
|
3605 |
-
this._values = values;
|
3606 |
-
|
3607 |
-
if (((bitField & 50397184) === 0)) {
|
3608 |
-
this._promise._setAsyncGuaranteed();
|
3609 |
-
return values._then(
|
3610 |
-
init,
|
3611 |
-
this._reject,
|
3612 |
-
undefined,
|
3613 |
-
this,
|
3614 |
-
resolveValueIfEmpty
|
3615 |
-
);
|
3616 |
-
} else if (((bitField & 33554432) !== 0)) {
|
3617 |
-
values = values._value();
|
3618 |
-
} else if (((bitField & 16777216) !== 0)) {
|
3619 |
-
return this._reject(values._reason());
|
3620 |
-
} else {
|
3621 |
-
return this._cancel();
|
3622 |
-
}
|
3623 |
-
}
|
3624 |
-
values = util.asArray(values);
|
3625 |
-
if (values === null) {
|
3626 |
-
var err = apiRejection(
|
3627 |
-
"expecting an array or an iterable object but got " + util.classString(values)).reason();
|
3628 |
-
this._promise._rejectCallback(err, false);
|
3629 |
-
return;
|
3630 |
-
}
|
3631 |
-
|
3632 |
-
if (values.length === 0) {
|
3633 |
-
if (resolveValueIfEmpty === -5) {
|
3634 |
-
this._resolveEmptyArray();
|
3635 |
-
}
|
3636 |
-
else {
|
3637 |
-
this._resolve(toResolutionValue(resolveValueIfEmpty));
|
3638 |
-
}
|
3639 |
-
return;
|
3640 |
-
}
|
3641 |
-
this._iterate(values);
|
3642 |
-
};
|
3643 |
-
|
3644 |
-
PromiseArray.prototype._iterate = function(values) {
|
3645 |
-
var len = this.getActualLength(values.length);
|
3646 |
-
this._length = len;
|
3647 |
-
this._values = this.shouldCopyValues() ? new Array(len) : this._values;
|
3648 |
-
var result = this._promise;
|
3649 |
-
var isResolved = false;
|
3650 |
-
var bitField = null;
|
3651 |
-
for (var i = 0; i < len; ++i) {
|
3652 |
-
var maybePromise = tryConvertToPromise(values[i], result);
|
3653 |
-
|
3654 |
-
if (maybePromise instanceof Promise) {
|
3655 |
-
maybePromise = maybePromise._target();
|
3656 |
-
bitField = maybePromise._bitField;
|
3657 |
-
} else {
|
3658 |
-
bitField = null;
|
3659 |
-
}
|
3660 |
-
|
3661 |
-
if (isResolved) {
|
3662 |
-
if (bitField !== null) {
|
3663 |
-
maybePromise.suppressUnhandledRejections();
|
3664 |
-
}
|
3665 |
-
} else if (bitField !== null) {
|
3666 |
-
if (((bitField & 50397184) === 0)) {
|
3667 |
-
maybePromise._proxy(this, i);
|
3668 |
-
this._values[i] = maybePromise;
|
3669 |
-
} else if (((bitField & 33554432) !== 0)) {
|
3670 |
-
isResolved = this._promiseFulfilled(maybePromise._value(), i);
|
3671 |
-
} else if (((bitField & 16777216) !== 0)) {
|
3672 |
-
isResolved = this._promiseRejected(maybePromise._reason(), i);
|
3673 |
-
} else {
|
3674 |
-
isResolved = this._promiseCancelled(i);
|
3675 |
-
}
|
3676 |
-
} else {
|
3677 |
-
isResolved = this._promiseFulfilled(maybePromise, i);
|
3678 |
-
}
|
3679 |
-
}
|
3680 |
-
if (!isResolved) result._setAsyncGuaranteed();
|
3681 |
-
};
|
3682 |
-
|
3683 |
-
PromiseArray.prototype._isResolved = function () {
|
3684 |
-
return this._values === null;
|
3685 |
-
};
|
3686 |
-
|
3687 |
-
PromiseArray.prototype._resolve = function (value) {
|
3688 |
-
this._values = null;
|
3689 |
-
this._promise._fulfill(value);
|
3690 |
-
};
|
3691 |
-
|
3692 |
-
PromiseArray.prototype._cancel = function() {
|
3693 |
-
if (this._isResolved() || !this._promise._isCancellable()) return;
|
3694 |
-
this._values = null;
|
3695 |
-
this._promise._cancel();
|
3696 |
-
};
|
3697 |
-
|
3698 |
-
PromiseArray.prototype._reject = function (reason) {
|
3699 |
-
this._values = null;
|
3700 |
-
this._promise._rejectCallback(reason, false);
|
3701 |
-
};
|
3702 |
-
|
3703 |
-
PromiseArray.prototype._promiseFulfilled = function (value, index) {
|
3704 |
-
this._values[index] = value;
|
3705 |
-
var totalResolved = ++this._totalResolved;
|
3706 |
-
if (totalResolved >= this._length) {
|
3707 |
-
this._resolve(this._values);
|
3708 |
-
return true;
|
3709 |
-
}
|
3710 |
-
return false;
|
3711 |
-
};
|
3712 |
-
|
3713 |
-
PromiseArray.prototype._promiseCancelled = function() {
|
3714 |
-
this._cancel();
|
3715 |
-
return true;
|
3716 |
-
};
|
3717 |
-
|
3718 |
-
PromiseArray.prototype._promiseRejected = function (reason) {
|
3719 |
-
this._totalResolved++;
|
3720 |
-
this._reject(reason);
|
3721 |
-
return true;
|
3722 |
-
};
|
3723 |
-
|
3724 |
-
PromiseArray.prototype._resultCancelled = function() {
|
3725 |
-
if (this._isResolved()) return;
|
3726 |
-
var values = this._values;
|
3727 |
-
this._cancel();
|
3728 |
-
if (values instanceof Promise) {
|
3729 |
-
values.cancel();
|
3730 |
-
} else {
|
3731 |
-
for (var i = 0; i < values.length; ++i) {
|
3732 |
-
if (values[i] instanceof Promise) {
|
3733 |
-
values[i].cancel();
|
3734 |
-
}
|
3735 |
-
}
|
3736 |
-
}
|
3737 |
-
};
|
3738 |
-
|
3739 |
-
PromiseArray.prototype.shouldCopyValues = function () {
|
3740 |
-
return true;
|
3741 |
-
};
|
3742 |
-
|
3743 |
-
PromiseArray.prototype.getActualLength = function (len) {
|
3744 |
-
return len;
|
3745 |
-
};
|
3746 |
-
|
3747 |
-
return PromiseArray;
|
3748 |
-
};
|
3749 |
-
|
3750 |
-
},{"./util":36}],24:[function(_dereq_,module,exports){
|
3751 |
-
"use strict";
|
3752 |
-
module.exports = function(Promise, INTERNAL) {
|
3753 |
-
var THIS = {};
|
3754 |
-
var util = _dereq_("./util");
|
3755 |
-
var nodebackForPromise = _dereq_("./nodeback");
|
3756 |
-
var withAppended = util.withAppended;
|
3757 |
-
var maybeWrapAsError = util.maybeWrapAsError;
|
3758 |
-
var canEvaluate = util.canEvaluate;
|
3759 |
-
var TypeError = _dereq_("./errors").TypeError;
|
3760 |
-
var defaultSuffix = "Async";
|
3761 |
-
var defaultPromisified = {__isPromisified__: true};
|
3762 |
-
var noCopyProps = [
|
3763 |
-
"arity", "length",
|
3764 |
-
"name",
|
3765 |
-
"arguments",
|
3766 |
-
"caller",
|
3767 |
-
"callee",
|
3768 |
-
"prototype",
|
3769 |
-
"__isPromisified__"
|
3770 |
-
];
|
3771 |
-
var noCopyPropsPattern = new RegExp("^(?:" + noCopyProps.join("|") + ")$");
|
3772 |
-
|
3773 |
-
var defaultFilter = function(name) {
|
3774 |
-
return util.isIdentifier(name) &&
|
3775 |
-
name.charAt(0) !== "_" &&
|
3776 |
-
name !== "constructor";
|
3777 |
-
};
|
3778 |
-
|
3779 |
-
function propsFilter(key) {
|
3780 |
-
return !noCopyPropsPattern.test(key);
|
3781 |
-
}
|
3782 |
-
|
3783 |
-
function isPromisified(fn) {
|
3784 |
-
try {
|
3785 |
-
return fn.__isPromisified__ === true;
|
3786 |
-
}
|
3787 |
-
catch (e) {
|
3788 |
-
return false;
|
3789 |
-
}
|
3790 |
-
}
|
3791 |
-
|
3792 |
-
function hasPromisified(obj, key, suffix) {
|
3793 |
-
var val = util.getDataPropertyOrDefault(obj, key + suffix,
|
3794 |
-
defaultPromisified);
|
3795 |
-
return val ? isPromisified(val) : false;
|
3796 |
-
}
|
3797 |
-
function checkValid(ret, suffix, suffixRegexp) {
|
3798 |
-
for (var i = 0; i < ret.length; i += 2) {
|
3799 |
-
var key = ret[i];
|
3800 |
-
if (suffixRegexp.test(key)) {
|
3801 |
-
var keyWithoutAsyncSuffix = key.replace(suffixRegexp, "");
|
3802 |
-
for (var j = 0; j < ret.length; j += 2) {
|
3803 |
-
if (ret[j] === keyWithoutAsyncSuffix) {
|
3804 |
-
throw new TypeError("Cannot promisify an API that has normal methods with '%s'-suffix\u000a\u000a See http://goo.gl/MqrFmX\u000a"
|
3805 |
-
.replace("%s", suffix));
|
3806 |
-
}
|
3807 |
-
}
|
3808 |
-
}
|
3809 |
-
}
|
3810 |
-
}
|
3811 |
-
|
3812 |
-
function promisifiableMethods(obj, suffix, suffixRegexp, filter) {
|
3813 |
-
var keys = util.inheritedDataKeys(obj);
|
3814 |
-
var ret = [];
|
3815 |
-
for (var i = 0; i < keys.length; ++i) {
|
3816 |
-
var key = keys[i];
|
3817 |
-
var value = obj[key];
|
3818 |
-
var passesDefaultFilter = filter === defaultFilter
|
3819 |
-
? true : defaultFilter(key, value, obj);
|
3820 |
-
if (typeof value === "function" &&
|
3821 |
-
!isPromisified(value) &&
|
3822 |
-
!hasPromisified(obj, key, suffix) &&
|
3823 |
-
filter(key, value, obj, passesDefaultFilter)) {
|
3824 |
-
ret.push(key, value);
|
3825 |
-
}
|
3826 |
-
}
|
3827 |
-
checkValid(ret, suffix, suffixRegexp);
|
3828 |
-
return ret;
|
3829 |
-
}
|
3830 |
-
|
3831 |
-
var escapeIdentRegex = function(str) {
|
3832 |
-
return str.replace(/([$])/, "\\$");
|
3833 |
-
};
|
3834 |
-
|
3835 |
-
var makeNodePromisifiedEval;
|
3836 |
-
if (!true) {
|
3837 |
-
var switchCaseArgumentOrder = function(likelyArgumentCount) {
|
3838 |
-
var ret = [likelyArgumentCount];
|
3839 |
-
var min = Math.max(0, likelyArgumentCount - 1 - 3);
|
3840 |
-
for(var i = likelyArgumentCount - 1; i >= min; --i) {
|
3841 |
-
ret.push(i);
|
3842 |
-
}
|
3843 |
-
for(var i = likelyArgumentCount + 1; i <= 3; ++i) {
|
3844 |
-
ret.push(i);
|
3845 |
-
}
|
3846 |
-
return ret;
|
3847 |
-
};
|
3848 |
-
|
3849 |
-
var argumentSequence = function(argumentCount) {
|
3850 |
-
return util.filledRange(argumentCount, "_arg", "");
|
3851 |
-
};
|
3852 |
-
|
3853 |
-
var parameterDeclaration = function(parameterCount) {
|
3854 |
-
return util.filledRange(
|
3855 |
-
Math.max(parameterCount, 3), "_arg", "");
|
3856 |
-
};
|
3857 |
-
|
3858 |
-
var parameterCount = function(fn) {
|
3859 |
-
if (typeof fn.length === "number") {
|
3860 |
-
return Math.max(Math.min(fn.length, 1023 + 1), 0);
|
3861 |
-
}
|
3862 |
-
return 0;
|
3863 |
-
};
|
3864 |
-
|
3865 |
-
makeNodePromisifiedEval =
|
3866 |
-
function(callback, receiver, originalName, fn, _, multiArgs) {
|
3867 |
-
var newParameterCount = Math.max(0, parameterCount(fn) - 1);
|
3868 |
-
var argumentOrder = switchCaseArgumentOrder(newParameterCount);
|
3869 |
-
var shouldProxyThis = typeof callback === "string" || receiver === THIS;
|
3870 |
-
|
3871 |
-
function generateCallForArgumentCount(count) {
|
3872 |
-
var args = argumentSequence(count).join(", ");
|
3873 |
-
var comma = count > 0 ? ", " : "";
|
3874 |
-
var ret;
|
3875 |
-
if (shouldProxyThis) {
|
3876 |
-
ret = "ret = callback.call(this, {{args}}, nodeback); break;\n";
|
3877 |
-
} else {
|
3878 |
-
ret = receiver === undefined
|
3879 |
-
? "ret = callback({{args}}, nodeback); break;\n"
|
3880 |
-
: "ret = callback.call(receiver, {{args}}, nodeback); break;\n";
|
3881 |
-
}
|
3882 |
-
return ret.replace("{{args}}", args).replace(", ", comma);
|
3883 |
-
}
|
3884 |
-
|
3885 |
-
function generateArgumentSwitchCase() {
|
3886 |
-
var ret = "";
|
3887 |
-
for (var i = 0; i < argumentOrder.length; ++i) {
|
3888 |
-
ret += "case " + argumentOrder[i] +":" +
|
3889 |
-
generateCallForArgumentCount(argumentOrder[i]);
|
3890 |
-
}
|
3891 |
-
|
3892 |
-
ret += " \n\
|
3893 |
-
default: \n\
|
3894 |
-
var args = new Array(len + 1); \n\
|
3895 |
-
var i = 0; \n\
|
3896 |
-
for (var i = 0; i < len; ++i) { \n\
|
3897 |
-
args[i] = arguments[i]; \n\
|
3898 |
-
} \n\
|
3899 |
-
args[i] = nodeback; \n\
|
3900 |
-
[CodeForCall] \n\
|
3901 |
-
break; \n\
|
3902 |
-
".replace("[CodeForCall]", (shouldProxyThis
|
3903 |
-
? "ret = callback.apply(this, args);\n"
|
3904 |
-
: "ret = callback.apply(receiver, args);\n"));
|
3905 |
-
return ret;
|
3906 |
-
}
|
3907 |
-
|
3908 |
-
var getFunctionCode = typeof callback === "string"
|
3909 |
-
? ("this != null ? this['"+callback+"'] : fn")
|
3910 |
-
: "fn";
|
3911 |
-
var body = "'use strict'; \n\
|
3912 |
-
var ret = function (Parameters) { \n\
|
3913 |
-
'use strict'; \n\
|
3914 |
-
var len = arguments.length; \n\
|
3915 |
-
var promise = new Promise(INTERNAL); \n\
|
3916 |
-
promise._captureStackTrace(); \n\
|
3917 |
-
var nodeback = nodebackForPromise(promise, " + multiArgs + "); \n\
|
3918 |
-
var ret; \n\
|
3919 |
-
var callback = tryCatch([GetFunctionCode]); \n\
|
3920 |
-
switch(len) { \n\
|
3921 |
-
[CodeForSwitchCase] \n\
|
3922 |
-
} \n\
|
3923 |
-
if (ret === errorObj) { \n\
|
3924 |
-
promise._rejectCallback(maybeWrapAsError(ret.e), true, true);\n\
|
3925 |
-
} \n\
|
3926 |
-
if (!promise._isFateSealed()) promise._setAsyncGuaranteed(); \n\
|
3927 |
-
return promise; \n\
|
3928 |
-
}; \n\
|
3929 |
-
notEnumerableProp(ret, '__isPromisified__', true); \n\
|
3930 |
-
return ret; \n\
|
3931 |
-
".replace("[CodeForSwitchCase]", generateArgumentSwitchCase())
|
3932 |
-
.replace("[GetFunctionCode]", getFunctionCode);
|
3933 |
-
body = body.replace("Parameters", parameterDeclaration(newParameterCount));
|
3934 |
-
return new Function("Promise",
|
3935 |
-
"fn",
|
3936 |
-
"receiver",
|
3937 |
-
"withAppended",
|
3938 |
-
"maybeWrapAsError",
|
3939 |
-
"nodebackForPromise",
|
3940 |
-
"tryCatch",
|
3941 |
-
"errorObj",
|
3942 |
-
"notEnumerableProp",
|
3943 |
-
"INTERNAL",
|
3944 |
-
body)(
|
3945 |
-
Promise,
|
3946 |
-
fn,
|
3947 |
-
receiver,
|
3948 |
-
withAppended,
|
3949 |
-
maybeWrapAsError,
|
3950 |
-
nodebackForPromise,
|
3951 |
-
util.tryCatch,
|
3952 |
-
util.errorObj,
|
3953 |
-
util.notEnumerableProp,
|
3954 |
-
INTERNAL);
|
3955 |
-
};
|
3956 |
-
}
|
3957 |
-
|
3958 |
-
function makeNodePromisifiedClosure(callback, receiver, _, fn, __, multiArgs) {
|
3959 |
-
var defaultThis = (function() {return this;})();
|
3960 |
-
var method = callback;
|
3961 |
-
if (typeof method === "string") {
|
3962 |
-
callback = fn;
|
3963 |
-
}
|
3964 |
-
function promisified() {
|
3965 |
-
var _receiver = receiver;
|
3966 |
-
if (receiver === THIS) _receiver = this;
|
3967 |
-
var promise = new Promise(INTERNAL);
|
3968 |
-
promise._captureStackTrace();
|
3969 |
-
var cb = typeof method === "string" && this !== defaultThis
|
3970 |
-
? this[method] : callback;
|
3971 |
-
var fn = nodebackForPromise(promise, multiArgs);
|
3972 |
-
try {
|
3973 |
-
cb.apply(_receiver, withAppended(arguments, fn));
|
3974 |
-
} catch(e) {
|
3975 |
-
promise._rejectCallback(maybeWrapAsError(e), true, true);
|
3976 |
-
}
|
3977 |
-
if (!promise._isFateSealed()) promise._setAsyncGuaranteed();
|
3978 |
-
return promise;
|
3979 |
-
}
|
3980 |
-
util.notEnumerableProp(promisified, "__isPromisified__", true);
|
3981 |
-
return promisified;
|
3982 |
-
}
|
3983 |
-
|
3984 |
-
var makeNodePromisified = canEvaluate
|
3985 |
-
? makeNodePromisifiedEval
|
3986 |
-
: makeNodePromisifiedClosure;
|
3987 |
-
|
3988 |
-
function promisifyAll(obj, suffix, filter, promisifier, multiArgs) {
|
3989 |
-
var suffixRegexp = new RegExp(escapeIdentRegex(suffix) + "$");
|
3990 |
-
var methods =
|
3991 |
-
promisifiableMethods(obj, suffix, suffixRegexp, filter);
|
3992 |
-
|
3993 |
-
for (var i = 0, len = methods.length; i < len; i+= 2) {
|
3994 |
-
var key = methods[i];
|
3995 |
-
var fn = methods[i+1];
|
3996 |
-
var promisifiedKey = key + suffix;
|
3997 |
-
if (promisifier === makeNodePromisified) {
|
3998 |
-
obj[promisifiedKey] =
|
3999 |
-
makeNodePromisified(key, THIS, key, fn, suffix, multiArgs);
|
4000 |
-
} else {
|
4001 |
-
var promisified = promisifier(fn, function() {
|
4002 |
-
return makeNodePromisified(key, THIS, key,
|
4003 |
-
fn, suffix, multiArgs);
|
4004 |
-
});
|
4005 |
-
util.notEnumerableProp(promisified, "__isPromisified__", true);
|
4006 |
-
obj[promisifiedKey] = promisified;
|
4007 |
-
}
|
4008 |
-
}
|
4009 |
-
util.toFastProperties(obj);
|
4010 |
-
return obj;
|
4011 |
-
}
|
4012 |
-
|
4013 |
-
function promisify(callback, receiver, multiArgs) {
|
4014 |
-
return makeNodePromisified(callback, receiver, undefined,
|
4015 |
-
callback, null, multiArgs);
|
4016 |
-
}
|
4017 |
-
|
4018 |
-
Promise.promisify = function (fn, options) {
|
4019 |
-
if (typeof fn !== "function") {
|
4020 |
-
throw new TypeError("expecting a function but got " + util.classString(fn));
|
4021 |
-
}
|
4022 |
-
if (isPromisified(fn)) {
|
4023 |
-
return fn;
|
4024 |
-
}
|
4025 |
-
options = Object(options);
|
4026 |
-
var receiver = options.context === undefined ? THIS : options.context;
|
4027 |
-
var multiArgs = !!options.multiArgs;
|
4028 |
-
var ret = promisify(fn, receiver, multiArgs);
|
4029 |
-
util.copyDescriptors(fn, ret, propsFilter);
|
4030 |
-
return ret;
|
4031 |
-
};
|
4032 |
-
|
4033 |
-
Promise.promisifyAll = function (target, options) {
|
4034 |
-
if (typeof target !== "function" && typeof target !== "object") {
|
4035 |
-
throw new TypeError("the target of promisifyAll must be an object or a function\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
4036 |
-
}
|
4037 |
-
options = Object(options);
|
4038 |
-
var multiArgs = !!options.multiArgs;
|
4039 |
-
var suffix = options.suffix;
|
4040 |
-
if (typeof suffix !== "string") suffix = defaultSuffix;
|
4041 |
-
var filter = options.filter;
|
4042 |
-
if (typeof filter !== "function") filter = defaultFilter;
|
4043 |
-
var promisifier = options.promisifier;
|
4044 |
-
if (typeof promisifier !== "function") promisifier = makeNodePromisified;
|
4045 |
-
|
4046 |
-
if (!util.isIdentifier(suffix)) {
|
4047 |
-
throw new RangeError("suffix must be a valid identifier\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
4048 |
-
}
|
4049 |
-
|
4050 |
-
var keys = util.inheritedDataKeys(target);
|
4051 |
-
for (var i = 0; i < keys.length; ++i) {
|
4052 |
-
var value = target[keys[i]];
|
4053 |
-
if (keys[i] !== "constructor" &&
|
4054 |
-
util.isClass(value)) {
|
4055 |
-
promisifyAll(value.prototype, suffix, filter, promisifier,
|
4056 |
-
multiArgs);
|
4057 |
-
promisifyAll(value, suffix, filter, promisifier, multiArgs);
|
4058 |
-
}
|
4059 |
-
}
|
4060 |
-
|
4061 |
-
return promisifyAll(target, suffix, filter, promisifier, multiArgs);
|
4062 |
-
};
|
4063 |
-
};
|
4064 |
-
|
4065 |
-
|
4066 |
-
},{"./errors":12,"./nodeback":20,"./util":36}],25:[function(_dereq_,module,exports){
|
4067 |
-
"use strict";
|
4068 |
-
module.exports = function(
|
4069 |
-
Promise, PromiseArray, tryConvertToPromise, apiRejection) {
|
4070 |
-
var util = _dereq_("./util");
|
4071 |
-
var isObject = util.isObject;
|
4072 |
-
var es5 = _dereq_("./es5");
|
4073 |
-
var Es6Map;
|
4074 |
-
if (typeof Map === "function") Es6Map = Map;
|
4075 |
-
|
4076 |
-
var mapToEntries = (function() {
|
4077 |
-
var index = 0;
|
4078 |
-
var size = 0;
|
4079 |
-
|
4080 |
-
function extractEntry(value, key) {
|
4081 |
-
this[index] = value;
|
4082 |
-
this[index + size] = key;
|
4083 |
-
index++;
|
4084 |
-
}
|
4085 |
-
|
4086 |
-
return function mapToEntries(map) {
|
4087 |
-
size = map.size;
|
4088 |
-
index = 0;
|
4089 |
-
var ret = new Array(map.size * 2);
|
4090 |
-
map.forEach(extractEntry, ret);
|
4091 |
-
return ret;
|
4092 |
-
};
|
4093 |
-
})();
|
4094 |
-
|
4095 |
-
var entriesToMap = function(entries) {
|
4096 |
-
var ret = new Es6Map();
|
4097 |
-
var length = entries.length / 2 | 0;
|
4098 |
-
for (var i = 0; i < length; ++i) {
|
4099 |
-
var key = entries[length + i];
|
4100 |
-
var value = entries[i];
|
4101 |
-
ret.set(key, value);
|
4102 |
-
}
|
4103 |
-
return ret;
|
4104 |
-
};
|
4105 |
-
|
4106 |
-
function PropertiesPromiseArray(obj) {
|
4107 |
-
var isMap = false;
|
4108 |
-
var entries;
|
4109 |
-
if (Es6Map !== undefined && obj instanceof Es6Map) {
|
4110 |
-
entries = mapToEntries(obj);
|
4111 |
-
isMap = true;
|
4112 |
-
} else {
|
4113 |
-
var keys = es5.keys(obj);
|
4114 |
-
var len = keys.length;
|
4115 |
-
entries = new Array(len * 2);
|
4116 |
-
for (var i = 0; i < len; ++i) {
|
4117 |
-
var key = keys[i];
|
4118 |
-
entries[i] = obj[key];
|
4119 |
-
entries[i + len] = key;
|
4120 |
-
}
|
4121 |
-
}
|
4122 |
-
this.constructor$(entries);
|
4123 |
-
this._isMap = isMap;
|
4124 |
-
this._init$(undefined, isMap ? -6 : -3);
|
4125 |
-
}
|
4126 |
-
util.inherits(PropertiesPromiseArray, PromiseArray);
|
4127 |
-
|
4128 |
-
PropertiesPromiseArray.prototype._init = function () {};
|
4129 |
-
|
4130 |
-
PropertiesPromiseArray.prototype._promiseFulfilled = function (value, index) {
|
4131 |
-
this._values[index] = value;
|
4132 |
-
var totalResolved = ++this._totalResolved;
|
4133 |
-
if (totalResolved >= this._length) {
|
4134 |
-
var val;
|
4135 |
-
if (this._isMap) {
|
4136 |
-
val = entriesToMap(this._values);
|
4137 |
-
} else {
|
4138 |
-
val = {};
|
4139 |
-
var keyOffset = this.length();
|
4140 |
-
for (var i = 0, len = this.length(); i < len; ++i) {
|
4141 |
-
val[this._values[i + keyOffset]] = this._values[i];
|
4142 |
-
}
|
4143 |
-
}
|
4144 |
-
this._resolve(val);
|
4145 |
-
return true;
|
4146 |
-
}
|
4147 |
-
return false;
|
4148 |
-
};
|
4149 |
-
|
4150 |
-
PropertiesPromiseArray.prototype.shouldCopyValues = function () {
|
4151 |
-
return false;
|
4152 |
-
};
|
4153 |
-
|
4154 |
-
PropertiesPromiseArray.prototype.getActualLength = function (len) {
|
4155 |
-
return len >> 1;
|
4156 |
-
};
|
4157 |
-
|
4158 |
-
function props(promises) {
|
4159 |
-
var ret;
|
4160 |
-
var castValue = tryConvertToPromise(promises);
|
4161 |
-
|
4162 |
-
if (!isObject(castValue)) {
|
4163 |
-
return apiRejection("cannot await properties of a non-object\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
4164 |
-
} else if (castValue instanceof Promise) {
|
4165 |
-
ret = castValue._then(
|
4166 |
-
Promise.props, undefined, undefined, undefined, undefined);
|
4167 |
-
} else {
|
4168 |
-
ret = new PropertiesPromiseArray(castValue).promise();
|
4169 |
-
}
|
4170 |
-
|
4171 |
-
if (castValue instanceof Promise) {
|
4172 |
-
ret._propagateFrom(castValue, 2);
|
4173 |
-
}
|
4174 |
-
return ret;
|
4175 |
-
}
|
4176 |
-
|
4177 |
-
Promise.prototype.props = function () {
|
4178 |
-
return props(this);
|
4179 |
-
};
|
4180 |
-
|
4181 |
-
Promise.props = function (promises) {
|
4182 |
-
return props(promises);
|
4183 |
-
};
|
4184 |
-
};
|
4185 |
-
|
4186 |
-
},{"./es5":13,"./util":36}],26:[function(_dereq_,module,exports){
|
4187 |
-
"use strict";
|
4188 |
-
function arrayMove(src, srcIndex, dst, dstIndex, len) {
|
4189 |
-
for (var j = 0; j < len; ++j) {
|
4190 |
-
dst[j + dstIndex] = src[j + srcIndex];
|
4191 |
-
src[j + srcIndex] = void 0;
|
4192 |
-
}
|
4193 |
-
}
|
4194 |
-
|
4195 |
-
function Queue(capacity) {
|
4196 |
-
this._capacity = capacity;
|
4197 |
-
this._length = 0;
|
4198 |
-
this._front = 0;
|
4199 |
-
}
|
4200 |
-
|
4201 |
-
Queue.prototype._willBeOverCapacity = function (size) {
|
4202 |
-
return this._capacity < size;
|
4203 |
-
};
|
4204 |
-
|
4205 |
-
Queue.prototype._pushOne = function (arg) {
|
4206 |
-
var length = this.length();
|
4207 |
-
this._checkCapacity(length + 1);
|
4208 |
-
var i = (this._front + length) & (this._capacity - 1);
|
4209 |
-
this[i] = arg;
|
4210 |
-
this._length = length + 1;
|
4211 |
-
};
|
4212 |
-
|
4213 |
-
Queue.prototype.push = function (fn, receiver, arg) {
|
4214 |
-
var length = this.length() + 3;
|
4215 |
-
if (this._willBeOverCapacity(length)) {
|
4216 |
-
this._pushOne(fn);
|
4217 |
-
this._pushOne(receiver);
|
4218 |
-
this._pushOne(arg);
|
4219 |
-
return;
|
4220 |
-
}
|
4221 |
-
var j = this._front + length - 3;
|
4222 |
-
this._checkCapacity(length);
|
4223 |
-
var wrapMask = this._capacity - 1;
|
4224 |
-
this[(j + 0) & wrapMask] = fn;
|
4225 |
-
this[(j + 1) & wrapMask] = receiver;
|
4226 |
-
this[(j + 2) & wrapMask] = arg;
|
4227 |
-
this._length = length;
|
4228 |
-
};
|
4229 |
-
|
4230 |
-
Queue.prototype.shift = function () {
|
4231 |
-
var front = this._front,
|
4232 |
-
ret = this[front];
|
4233 |
-
|
4234 |
-
this[front] = undefined;
|
4235 |
-
this._front = (front + 1) & (this._capacity - 1);
|
4236 |
-
this._length--;
|
4237 |
-
return ret;
|
4238 |
-
};
|
4239 |
-
|
4240 |
-
Queue.prototype.length = function () {
|
4241 |
-
return this._length;
|
4242 |
-
};
|
4243 |
-
|
4244 |
-
Queue.prototype._checkCapacity = function (size) {
|
4245 |
-
if (this._capacity < size) {
|
4246 |
-
this._resizeTo(this._capacity << 1);
|
4247 |
-
}
|
4248 |
-
};
|
4249 |
-
|
4250 |
-
Queue.prototype._resizeTo = function (capacity) {
|
4251 |
-
var oldCapacity = this._capacity;
|
4252 |
-
this._capacity = capacity;
|
4253 |
-
var front = this._front;
|
4254 |
-
var length = this._length;
|
4255 |
-
var moveItemsCount = (front + length) & (oldCapacity - 1);
|
4256 |
-
arrayMove(this, 0, this, oldCapacity, moveItemsCount);
|
4257 |
-
};
|
4258 |
-
|
4259 |
-
module.exports = Queue;
|
4260 |
-
|
4261 |
-
},{}],27:[function(_dereq_,module,exports){
|
4262 |
-
"use strict";
|
4263 |
-
module.exports = function(
|
4264 |
-
Promise, INTERNAL, tryConvertToPromise, apiRejection) {
|
4265 |
-
var util = _dereq_("./util");
|
4266 |
-
|
4267 |
-
var raceLater = function (promise) {
|
4268 |
-
return promise.then(function(array) {
|
4269 |
-
return race(array, promise);
|
4270 |
-
});
|
4271 |
-
};
|
4272 |
-
|
4273 |
-
function race(promises, parent) {
|
4274 |
-
var maybePromise = tryConvertToPromise(promises);
|
4275 |
-
|
4276 |
-
if (maybePromise instanceof Promise) {
|
4277 |
-
return raceLater(maybePromise);
|
4278 |
-
} else {
|
4279 |
-
promises = util.asArray(promises);
|
4280 |
-
if (promises === null)
|
4281 |
-
return apiRejection("expecting an array or an iterable object but got " + util.classString(promises));
|
4282 |
-
}
|
4283 |
-
|
4284 |
-
var ret = new Promise(INTERNAL);
|
4285 |
-
if (parent !== undefined) {
|
4286 |
-
ret._propagateFrom(parent, 3);
|
4287 |
-
}
|
4288 |
-
var fulfill = ret._fulfill;
|
4289 |
-
var reject = ret._reject;
|
4290 |
-
for (var i = 0, len = promises.length; i < len; ++i) {
|
4291 |
-
var val = promises[i];
|
4292 |
-
|
4293 |
-
if (val === undefined && !(i in promises)) {
|
4294 |
-
continue;
|
4295 |
-
}
|
4296 |
-
|
4297 |
-
Promise.cast(val)._then(fulfill, reject, undefined, ret, null);
|
4298 |
-
}
|
4299 |
-
return ret;
|
4300 |
-
}
|
4301 |
-
|
4302 |
-
Promise.race = function (promises) {
|
4303 |
-
return race(promises, undefined);
|
4304 |
-
};
|
4305 |
-
|
4306 |
-
Promise.prototype.race = function () {
|
4307 |
-
return race(this, undefined);
|
4308 |
-
};
|
4309 |
-
|
4310 |
-
};
|
4311 |
-
|
4312 |
-
},{"./util":36}],28:[function(_dereq_,module,exports){
|
4313 |
-
"use strict";
|
4314 |
-
module.exports = function(Promise,
|
4315 |
-
PromiseArray,
|
4316 |
-
apiRejection,
|
4317 |
-
tryConvertToPromise,
|
4318 |
-
INTERNAL,
|
4319 |
-
debug) {
|
4320 |
-
var getDomain = Promise._getDomain;
|
4321 |
-
var util = _dereq_("./util");
|
4322 |
-
var tryCatch = util.tryCatch;
|
4323 |
-
|
4324 |
-
function ReductionPromiseArray(promises, fn, initialValue, _each) {
|
4325 |
-
this.constructor$(promises);
|
4326 |
-
var domain = getDomain();
|
4327 |
-
this._fn = domain === null ? fn : util.domainBind(domain, fn);
|
4328 |
-
if (initialValue !== undefined) {
|
4329 |
-
initialValue = Promise.resolve(initialValue);
|
4330 |
-
initialValue._attachCancellationCallback(this);
|
4331 |
-
}
|
4332 |
-
this._initialValue = initialValue;
|
4333 |
-
this._currentCancellable = null;
|
4334 |
-
if(_each === INTERNAL) {
|
4335 |
-
this._eachValues = Array(this._length);
|
4336 |
-
} else if (_each === 0) {
|
4337 |
-
this._eachValues = null;
|
4338 |
-
} else {
|
4339 |
-
this._eachValues = undefined;
|
4340 |
-
}
|
4341 |
-
this._promise._captureStackTrace();
|
4342 |
-
this._init$(undefined, -5);
|
4343 |
-
}
|
4344 |
-
util.inherits(ReductionPromiseArray, PromiseArray);
|
4345 |
-
|
4346 |
-
ReductionPromiseArray.prototype._gotAccum = function(accum) {
|
4347 |
-
if (this._eachValues !== undefined &&
|
4348 |
-
this._eachValues !== null &&
|
4349 |
-
accum !== INTERNAL) {
|
4350 |
-
this._eachValues.push(accum);
|
4351 |
-
}
|
4352 |
-
};
|
4353 |
-
|
4354 |
-
ReductionPromiseArray.prototype._eachComplete = function(value) {
|
4355 |
-
if (this._eachValues !== null) {
|
4356 |
-
this._eachValues.push(value);
|
4357 |
-
}
|
4358 |
-
return this._eachValues;
|
4359 |
-
};
|
4360 |
-
|
4361 |
-
ReductionPromiseArray.prototype._init = function() {};
|
4362 |
-
|
4363 |
-
ReductionPromiseArray.prototype._resolveEmptyArray = function() {
|
4364 |
-
this._resolve(this._eachValues !== undefined ? this._eachValues
|
4365 |
-
: this._initialValue);
|
4366 |
-
};
|
4367 |
-
|
4368 |
-
ReductionPromiseArray.prototype.shouldCopyValues = function () {
|
4369 |
-
return false;
|
4370 |
-
};
|
4371 |
-
|
4372 |
-
ReductionPromiseArray.prototype._resolve = function(value) {
|
4373 |
-
this._promise._resolveCallback(value);
|
4374 |
-
this._values = null;
|
4375 |
-
};
|
4376 |
-
|
4377 |
-
ReductionPromiseArray.prototype._resultCancelled = function(sender) {
|
4378 |
-
if (sender === this._initialValue) return this._cancel();
|
4379 |
-
if (this._isResolved()) return;
|
4380 |
-
this._resultCancelled$();
|
4381 |
-
if (this._currentCancellable instanceof Promise) {
|
4382 |
-
this._currentCancellable.cancel();
|
4383 |
-
}
|
4384 |
-
if (this._initialValue instanceof Promise) {
|
4385 |
-
this._initialValue.cancel();
|
4386 |
-
}
|
4387 |
-
};
|
4388 |
-
|
4389 |
-
ReductionPromiseArray.prototype._iterate = function (values) {
|
4390 |
-
this._values = values;
|
4391 |
-
var value;
|
4392 |
-
var i;
|
4393 |
-
var length = values.length;
|
4394 |
-
if (this._initialValue !== undefined) {
|
4395 |
-
value = this._initialValue;
|
4396 |
-
i = 0;
|
4397 |
-
} else {
|
4398 |
-
value = Promise.resolve(values[0]);
|
4399 |
-
i = 1;
|
4400 |
-
}
|
4401 |
-
|
4402 |
-
this._currentCancellable = value;
|
4403 |
-
|
4404 |
-
if (!value.isRejected()) {
|
4405 |
-
for (; i < length; ++i) {
|
4406 |
-
var ctx = {
|
4407 |
-
accum: null,
|
4408 |
-
value: values[i],
|
4409 |
-
index: i,
|
4410 |
-
length: length,
|
4411 |
-
array: this
|
4412 |
-
};
|
4413 |
-
value = value._then(gotAccum, undefined, undefined, ctx, undefined);
|
4414 |
-
}
|
4415 |
-
}
|
4416 |
-
|
4417 |
-
if (this._eachValues !== undefined) {
|
4418 |
-
value = value
|
4419 |
-
._then(this._eachComplete, undefined, undefined, this, undefined);
|
4420 |
-
}
|
4421 |
-
value._then(completed, completed, undefined, value, this);
|
4422 |
-
};
|
4423 |
-
|
4424 |
-
Promise.prototype.reduce = function (fn, initialValue) {
|
4425 |
-
return reduce(this, fn, initialValue, null);
|
4426 |
-
};
|
4427 |
-
|
4428 |
-
Promise.reduce = function (promises, fn, initialValue, _each) {
|
4429 |
-
return reduce(promises, fn, initialValue, _each);
|
4430 |
-
};
|
4431 |
-
|
4432 |
-
function completed(valueOrReason, array) {
|
4433 |
-
if (this.isFulfilled()) {
|
4434 |
-
array._resolve(valueOrReason);
|
4435 |
-
} else {
|
4436 |
-
array._reject(valueOrReason);
|
4437 |
-
}
|
4438 |
-
}
|
4439 |
-
|
4440 |
-
function reduce(promises, fn, initialValue, _each) {
|
4441 |
-
if (typeof fn !== "function") {
|
4442 |
-
return apiRejection("expecting a function but got " + util.classString(fn));
|
4443 |
-
}
|
4444 |
-
var array = new ReductionPromiseArray(promises, fn, initialValue, _each);
|
4445 |
-
return array.promise();
|
4446 |
-
}
|
4447 |
-
|
4448 |
-
function gotAccum(accum) {
|
4449 |
-
this.accum = accum;
|
4450 |
-
this.array._gotAccum(accum);
|
4451 |
-
var value = tryConvertToPromise(this.value, this.array._promise);
|
4452 |
-
if (value instanceof Promise) {
|
4453 |
-
this.array._currentCancellable = value;
|
4454 |
-
return value._then(gotValue, undefined, undefined, this, undefined);
|
4455 |
-
} else {
|
4456 |
-
return gotValue.call(this, value);
|
4457 |
-
}
|
4458 |
-
}
|
4459 |
-
|
4460 |
-
function gotValue(value) {
|
4461 |
-
var array = this.array;
|
4462 |
-
var promise = array._promise;
|
4463 |
-
var fn = tryCatch(array._fn);
|
4464 |
-
promise._pushContext();
|
4465 |
-
var ret;
|
4466 |
-
if (array._eachValues !== undefined) {
|
4467 |
-
ret = fn.call(promise._boundValue(), value, this.index, this.length);
|
4468 |
-
} else {
|
4469 |
-
ret = fn.call(promise._boundValue(),
|
4470 |
-
this.accum, value, this.index, this.length);
|
4471 |
-
}
|
4472 |
-
if (ret instanceof Promise) {
|
4473 |
-
array._currentCancellable = ret;
|
4474 |
-
}
|
4475 |
-
var promiseCreated = promise._popContext();
|
4476 |
-
debug.checkForgottenReturns(
|
4477 |
-
ret,
|
4478 |
-
promiseCreated,
|
4479 |
-
array._eachValues !== undefined ? "Promise.each" : "Promise.reduce",
|
4480 |
-
promise
|
4481 |
-
);
|
4482 |
-
return ret;
|
4483 |
-
}
|
4484 |
-
};
|
4485 |
-
|
4486 |
-
},{"./util":36}],29:[function(_dereq_,module,exports){
|
4487 |
-
"use strict";
|
4488 |
-
var util = _dereq_("./util");
|
4489 |
-
var schedule;
|
4490 |
-
var noAsyncScheduler = function() {
|
4491 |
-
throw new Error("No async scheduler available\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
4492 |
-
};
|
4493 |
-
var NativePromise = util.getNativePromise();
|
4494 |
-
if (util.isNode && typeof MutationObserver === "undefined") {
|
4495 |
-
var GlobalSetImmediate = global.setImmediate;
|
4496 |
-
var ProcessNextTick = process.nextTick;
|
4497 |
-
schedule = util.isRecentNode
|
4498 |
-
? function(fn) { GlobalSetImmediate.call(global, fn); }
|
4499 |
-
: function(fn) { ProcessNextTick.call(process, fn); };
|
4500 |
-
} else if (typeof NativePromise === "function" &&
|
4501 |
-
typeof NativePromise.resolve === "function") {
|
4502 |
-
var nativePromise = NativePromise.resolve();
|
4503 |
-
schedule = function(fn) {
|
4504 |
-
nativePromise.then(fn);
|
4505 |
-
};
|
4506 |
-
} else if ((typeof MutationObserver !== "undefined") &&
|
4507 |
-
!(typeof window !== "undefined" &&
|
4508 |
-
window.navigator &&
|
4509 |
-
(window.navigator.standalone || window.cordova))) {
|
4510 |
-
schedule = (function() {
|
4511 |
-
var div = document.createElement("div");
|
4512 |
-
var opts = {attributes: true};
|
4513 |
-
var toggleScheduled = false;
|
4514 |
-
var div2 = document.createElement("div");
|
4515 |
-
var o2 = new MutationObserver(function() {
|
4516 |
-
div.classList.toggle("foo");
|
4517 |
-
toggleScheduled = false;
|
4518 |
-
});
|
4519 |
-
o2.observe(div2, opts);
|
4520 |
-
|
4521 |
-
var scheduleToggle = function() {
|
4522 |
-
if (toggleScheduled) return;
|
4523 |
-
toggleScheduled = true;
|
4524 |
-
div2.classList.toggle("foo");
|
4525 |
-
};
|
4526 |
-
|
4527 |
-
return function schedule(fn) {
|
4528 |
-
var o = new MutationObserver(function() {
|
4529 |
-
o.disconnect();
|
4530 |
-
fn();
|
4531 |
-
});
|
4532 |
-
o.observe(div, opts);
|
4533 |
-
scheduleToggle();
|
4534 |
-
};
|
4535 |
-
})();
|
4536 |
-
} else if (typeof setImmediate !== "undefined") {
|
4537 |
-
schedule = function (fn) {
|
4538 |
-
setImmediate(fn);
|
4539 |
-
};
|
4540 |
-
} else if (typeof setTimeout !== "undefined") {
|
4541 |
-
schedule = function (fn) {
|
4542 |
-
setTimeout(fn, 0);
|
4543 |
-
};
|
4544 |
-
} else {
|
4545 |
-
schedule = noAsyncScheduler;
|
4546 |
-
}
|
4547 |
-
module.exports = schedule;
|
4548 |
-
|
4549 |
-
},{"./util":36}],30:[function(_dereq_,module,exports){
|
4550 |
-
"use strict";
|
4551 |
-
module.exports =
|
4552 |
-
function(Promise, PromiseArray, debug) {
|
4553 |
-
var PromiseInspection = Promise.PromiseInspection;
|
4554 |
-
var util = _dereq_("./util");
|
4555 |
-
|
4556 |
-
function SettledPromiseArray(values) {
|
4557 |
-
this.constructor$(values);
|
4558 |
-
}
|
4559 |
-
util.inherits(SettledPromiseArray, PromiseArray);
|
4560 |
-
|
4561 |
-
SettledPromiseArray.prototype._promiseResolved = function (index, inspection) {
|
4562 |
-
this._values[index] = inspection;
|
4563 |
-
var totalResolved = ++this._totalResolved;
|
4564 |
-
if (totalResolved >= this._length) {
|
4565 |
-
this._resolve(this._values);
|
4566 |
-
return true;
|
4567 |
-
}
|
4568 |
-
return false;
|
4569 |
-
};
|
4570 |
-
|
4571 |
-
SettledPromiseArray.prototype._promiseFulfilled = function (value, index) {
|
4572 |
-
var ret = new PromiseInspection();
|
4573 |
-
ret._bitField = 33554432;
|
4574 |
-
ret._settledValueField = value;
|
4575 |
-
return this._promiseResolved(index, ret);
|
4576 |
-
};
|
4577 |
-
SettledPromiseArray.prototype._promiseRejected = function (reason, index) {
|
4578 |
-
var ret = new PromiseInspection();
|
4579 |
-
ret._bitField = 16777216;
|
4580 |
-
ret._settledValueField = reason;
|
4581 |
-
return this._promiseResolved(index, ret);
|
4582 |
-
};
|
4583 |
-
|
4584 |
-
Promise.settle = function (promises) {
|
4585 |
-
debug.deprecated(".settle()", ".reflect()");
|
4586 |
-
return new SettledPromiseArray(promises).promise();
|
4587 |
-
};
|
4588 |
-
|
4589 |
-
Promise.prototype.settle = function () {
|
4590 |
-
return Promise.settle(this);
|
4591 |
-
};
|
4592 |
-
};
|
4593 |
-
|
4594 |
-
},{"./util":36}],31:[function(_dereq_,module,exports){
|
4595 |
-
"use strict";
|
4596 |
-
module.exports =
|
4597 |
-
function(Promise, PromiseArray, apiRejection) {
|
4598 |
-
var util = _dereq_("./util");
|
4599 |
-
var RangeError = _dereq_("./errors").RangeError;
|
4600 |
-
var AggregateError = _dereq_("./errors").AggregateError;
|
4601 |
-
var isArray = util.isArray;
|
4602 |
-
var CANCELLATION = {};
|
4603 |
-
|
4604 |
-
|
4605 |
-
function SomePromiseArray(values) {
|
4606 |
-
this.constructor$(values);
|
4607 |
-
this._howMany = 0;
|
4608 |
-
this._unwrap = false;
|
4609 |
-
this._initialized = false;
|
4610 |
-
}
|
4611 |
-
util.inherits(SomePromiseArray, PromiseArray);
|
4612 |
-
|
4613 |
-
SomePromiseArray.prototype._init = function () {
|
4614 |
-
if (!this._initialized) {
|
4615 |
-
return;
|
4616 |
-
}
|
4617 |
-
if (this._howMany === 0) {
|
4618 |
-
this._resolve([]);
|
4619 |
-
return;
|
4620 |
-
}
|
4621 |
-
this._init$(undefined, -5);
|
4622 |
-
var isArrayResolved = isArray(this._values);
|
4623 |
-
if (!this._isResolved() &&
|
4624 |
-
isArrayResolved &&
|
4625 |
-
this._howMany > this._canPossiblyFulfill()) {
|
4626 |
-
this._reject(this._getRangeError(this.length()));
|
4627 |
-
}
|
4628 |
-
};
|
4629 |
-
|
4630 |
-
SomePromiseArray.prototype.init = function () {
|
4631 |
-
this._initialized = true;
|
4632 |
-
this._init();
|
4633 |
-
};
|
4634 |
-
|
4635 |
-
SomePromiseArray.prototype.setUnwrap = function () {
|
4636 |
-
this._unwrap = true;
|
4637 |
-
};
|
4638 |
-
|
4639 |
-
SomePromiseArray.prototype.howMany = function () {
|
4640 |
-
return this._howMany;
|
4641 |
-
};
|
4642 |
-
|
4643 |
-
SomePromiseArray.prototype.setHowMany = function (count) {
|
4644 |
-
this._howMany = count;
|
4645 |
-
};
|
4646 |
-
|
4647 |
-
SomePromiseArray.prototype._promiseFulfilled = function (value) {
|
4648 |
-
this._addFulfilled(value);
|
4649 |
-
if (this._fulfilled() === this.howMany()) {
|
4650 |
-
this._values.length = this.howMany();
|
4651 |
-
if (this.howMany() === 1 && this._unwrap) {
|
4652 |
-
this._resolve(this._values[0]);
|
4653 |
-
} else {
|
4654 |
-
this._resolve(this._values);
|
4655 |
-
}
|
4656 |
-
return true;
|
4657 |
-
}
|
4658 |
-
return false;
|
4659 |
-
|
4660 |
-
};
|
4661 |
-
SomePromiseArray.prototype._promiseRejected = function (reason) {
|
4662 |
-
this._addRejected(reason);
|
4663 |
-
return this._checkOutcome();
|
4664 |
-
};
|
4665 |
-
|
4666 |
-
SomePromiseArray.prototype._promiseCancelled = function () {
|
4667 |
-
if (this._values instanceof Promise || this._values == null) {
|
4668 |
-
return this._cancel();
|
4669 |
-
}
|
4670 |
-
this._addRejected(CANCELLATION);
|
4671 |
-
return this._checkOutcome();
|
4672 |
-
};
|
4673 |
-
|
4674 |
-
SomePromiseArray.prototype._checkOutcome = function() {
|
4675 |
-
if (this.howMany() > this._canPossiblyFulfill()) {
|
4676 |
-
var e = new AggregateError();
|
4677 |
-
for (var i = this.length(); i < this._values.length; ++i) {
|
4678 |
-
if (this._values[i] !== CANCELLATION) {
|
4679 |
-
e.push(this._values[i]);
|
4680 |
-
}
|
4681 |
-
}
|
4682 |
-
if (e.length > 0) {
|
4683 |
-
this._reject(e);
|
4684 |
-
} else {
|
4685 |
-
this._cancel();
|
4686 |
-
}
|
4687 |
-
return true;
|
4688 |
-
}
|
4689 |
-
return false;
|
4690 |
-
};
|
4691 |
-
|
4692 |
-
SomePromiseArray.prototype._fulfilled = function () {
|
4693 |
-
return this._totalResolved;
|
4694 |
-
};
|
4695 |
-
|
4696 |
-
SomePromiseArray.prototype._rejected = function () {
|
4697 |
-
return this._values.length - this.length();
|
4698 |
-
};
|
4699 |
-
|
4700 |
-
SomePromiseArray.prototype._addRejected = function (reason) {
|
4701 |
-
this._values.push(reason);
|
4702 |
-
};
|
4703 |
-
|
4704 |
-
SomePromiseArray.prototype._addFulfilled = function (value) {
|
4705 |
-
this._values[this._totalResolved++] = value;
|
4706 |
-
};
|
4707 |
-
|
4708 |
-
SomePromiseArray.prototype._canPossiblyFulfill = function () {
|
4709 |
-
return this.length() - this._rejected();
|
4710 |
-
};
|
4711 |
-
|
4712 |
-
SomePromiseArray.prototype._getRangeError = function (count) {
|
4713 |
-
var message = "Input array must contain at least " +
|
4714 |
-
this._howMany + " items but contains only " + count + " items";
|
4715 |
-
return new RangeError(message);
|
4716 |
-
};
|
4717 |
-
|
4718 |
-
SomePromiseArray.prototype._resolveEmptyArray = function () {
|
4719 |
-
this._reject(this._getRangeError(0));
|
4720 |
-
};
|
4721 |
-
|
4722 |
-
function some(promises, howMany) {
|
4723 |
-
if ((howMany | 0) !== howMany || howMany < 0) {
|
4724 |
-
return apiRejection("expecting a positive integer\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
4725 |
-
}
|
4726 |
-
var ret = new SomePromiseArray(promises);
|
4727 |
-
var promise = ret.promise();
|
4728 |
-
ret.setHowMany(howMany);
|
4729 |
-
ret.init();
|
4730 |
-
return promise;
|
4731 |
-
}
|
4732 |
-
|
4733 |
-
Promise.some = function (promises, howMany) {
|
4734 |
-
return some(promises, howMany);
|
4735 |
-
};
|
4736 |
-
|
4737 |
-
Promise.prototype.some = function (howMany) {
|
4738 |
-
return some(this, howMany);
|
4739 |
-
};
|
4740 |
-
|
4741 |
-
Promise._SomePromiseArray = SomePromiseArray;
|
4742 |
-
};
|
4743 |
-
|
4744 |
-
},{"./errors":12,"./util":36}],32:[function(_dereq_,module,exports){
|
4745 |
-
"use strict";
|
4746 |
-
module.exports = function(Promise) {
|
4747 |
-
function PromiseInspection(promise) {
|
4748 |
-
if (promise !== undefined) {
|
4749 |
-
promise = promise._target();
|
4750 |
-
this._bitField = promise._bitField;
|
4751 |
-
this._settledValueField = promise._isFateSealed()
|
4752 |
-
? promise._settledValue() : undefined;
|
4753 |
-
}
|
4754 |
-
else {
|
4755 |
-
this._bitField = 0;
|
4756 |
-
this._settledValueField = undefined;
|
4757 |
-
}
|
4758 |
-
}
|
4759 |
-
|
4760 |
-
PromiseInspection.prototype._settledValue = function() {
|
4761 |
-
return this._settledValueField;
|
4762 |
-
};
|
4763 |
-
|
4764 |
-
var value = PromiseInspection.prototype.value = function () {
|
4765 |
-
if (!this.isFulfilled()) {
|
4766 |
-
throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
4767 |
-
}
|
4768 |
-
return this._settledValue();
|
4769 |
-
};
|
4770 |
-
|
4771 |
-
var reason = PromiseInspection.prototype.error =
|
4772 |
-
PromiseInspection.prototype.reason = function () {
|
4773 |
-
if (!this.isRejected()) {
|
4774 |
-
throw new TypeError("cannot get rejection reason of a non-rejected promise\u000a\u000a See http://goo.gl/MqrFmX\u000a");
|
4775 |
-
}
|
4776 |
-
return this._settledValue();
|
4777 |
-
};
|
4778 |
-
|
4779 |
-
var isFulfilled = PromiseInspection.prototype.isFulfilled = function() {
|
4780 |
-
return (this._bitField & 33554432) !== 0;
|
4781 |
-
};
|
4782 |
-
|
4783 |
-
var isRejected = PromiseInspection.prototype.isRejected = function () {
|
4784 |
-
return (this._bitField & 16777216) !== 0;
|
4785 |
-
};
|
4786 |
-
|
4787 |
-
var isPending = PromiseInspection.prototype.isPending = function () {
|
4788 |
-
return (this._bitField & 50397184) === 0;
|
4789 |
-
};
|
4790 |
-
|
4791 |
-
var isResolved = PromiseInspection.prototype.isResolved = function () {
|
4792 |
-
return (this._bitField & 50331648) !== 0;
|
4793 |
-
};
|
4794 |
-
|
4795 |
-
PromiseInspection.prototype.isCancelled = function() {
|
4796 |
-
return (this._bitField & 8454144) !== 0;
|
4797 |
-
};
|
4798 |
-
|
4799 |
-
Promise.prototype.__isCancelled = function() {
|
4800 |
-
return (this._bitField & 65536) === 65536;
|
4801 |
-
};
|
4802 |
-
|
4803 |
-
Promise.prototype._isCancelled = function() {
|
4804 |
-
return this._target().__isCancelled();
|
4805 |
-
};
|
4806 |
-
|
4807 |
-
Promise.prototype.isCancelled = function() {
|
4808 |
-
return (this._target()._bitField & 8454144) !== 0;
|
4809 |
-
};
|
4810 |
-
|
4811 |
-
Promise.prototype.isPending = function() {
|
4812 |
-
return isPending.call(this._target());
|
4813 |
-
};
|
4814 |
-
|
4815 |
-
Promise.prototype.isRejected = function() {
|
4816 |
-
return isRejected.call(this._target());
|
4817 |
-
};
|
4818 |
-
|
4819 |
-
Promise.prototype.isFulfilled = function() {
|
4820 |
-
return isFulfilled.call(this._target());
|
4821 |
-
};
|
4822 |
-
|
4823 |
-
Promise.prototype.isResolved = function() {
|
4824 |
-
return isResolved.call(this._target());
|
4825 |
-
};
|
4826 |
-
|
4827 |
-
Promise.prototype.value = function() {
|
4828 |
-
return value.call(this._target());
|
4829 |
-
};
|
4830 |
-
|
4831 |
-
Promise.prototype.reason = function() {
|
4832 |
-
var target = this._target();
|
4833 |
-
target._unsetRejectionIsUnhandled();
|
4834 |
-
return reason.call(target);
|
4835 |
-
};
|
4836 |
-
|
4837 |
-
Promise.prototype._value = function() {
|
4838 |
-
return this._settledValue();
|
4839 |
-
};
|
4840 |
-
|
4841 |
-
Promise.prototype._reason = function() {
|
4842 |
-
this._unsetRejectionIsUnhandled();
|
4843 |
-
return this._settledValue();
|
4844 |
-
};
|
4845 |
-
|
4846 |
-
Promise.PromiseInspection = PromiseInspection;
|
4847 |
-
};
|
4848 |
-
|
4849 |
-
},{}],33:[function(_dereq_,module,exports){
|
4850 |
-
"use strict";
|
4851 |
-
module.exports = function(Promise, INTERNAL) {
|
4852 |
-
var util = _dereq_("./util");
|
4853 |
-
var errorObj = util.errorObj;
|
4854 |
-
var isObject = util.isObject;
|
4855 |
-
|
4856 |
-
function tryConvertToPromise(obj, context) {
|
4857 |
-
if (isObject(obj)) {
|
4858 |
-
if (obj instanceof Promise) return obj;
|
4859 |
-
var then = getThen(obj);
|
4860 |
-
if (then === errorObj) {
|
4861 |
-
if (context) context._pushContext();
|
4862 |
-
var ret = Promise.reject(then.e);
|
4863 |
-
if (context) context._popContext();
|
4864 |
-
return ret;
|
4865 |
-
} else if (typeof then === "function") {
|
4866 |
-
if (isAnyBluebirdPromise(obj)) {
|
4867 |
-
var ret = new Promise(INTERNAL);
|
4868 |
-
obj._then(
|
4869 |
-
ret._fulfill,
|
4870 |
-
ret._reject,
|
4871 |
-
undefined,
|
4872 |
-
ret,
|
4873 |
-
null
|
4874 |
-
);
|
4875 |
-
return ret;
|
4876 |
-
}
|
4877 |
-
return doThenable(obj, then, context);
|
4878 |
-
}
|
4879 |
-
}
|
4880 |
-
return obj;
|
4881 |
-
}
|
4882 |
-
|
4883 |
-
function doGetThen(obj) {
|
4884 |
-
return obj.then;
|
4885 |
-
}
|
4886 |
-
|
4887 |
-
function getThen(obj) {
|
4888 |
-
try {
|
4889 |
-
return doGetThen(obj);
|
4890 |
-
} catch (e) {
|
4891 |
-
errorObj.e = e;
|
4892 |
-
return errorObj;
|
4893 |
-
}
|
4894 |
-
}
|
4895 |
-
|
4896 |
-
var hasProp = {}.hasOwnProperty;
|
4897 |
-
function isAnyBluebirdPromise(obj) {
|
4898 |
-
try {
|
4899 |
-
return hasProp.call(obj, "_promise0");
|
4900 |
-
} catch (e) {
|
4901 |
-
return false;
|
4902 |
-
}
|
4903 |
-
}
|
4904 |
-
|
4905 |
-
function doThenable(x, then, context) {
|
4906 |
-
var promise = new Promise(INTERNAL);
|
4907 |
-
var ret = promise;
|
4908 |
-
if (context) context._pushContext();
|
4909 |
-
promise._captureStackTrace();
|
4910 |
-
if (context) context._popContext();
|
4911 |
-
var synchronous = true;
|
4912 |
-
var result = util.tryCatch(then).call(x, resolve, reject);
|
4913 |
-
synchronous = false;
|
4914 |
-
|
4915 |
-
if (promise && result === errorObj) {
|
4916 |
-
promise._rejectCallback(result.e, true, true);
|
4917 |
-
promise = null;
|
4918 |
-
}
|
4919 |
-
|
4920 |
-
function resolve(value) {
|
4921 |
-
if (!promise) return;
|
4922 |
-
promise._resolveCallback(value);
|
4923 |
-
promise = null;
|
4924 |
-
}
|
4925 |
-
|
4926 |
-
function reject(reason) {
|
4927 |
-
if (!promise) return;
|
4928 |
-
promise._rejectCallback(reason, synchronous, true);
|
4929 |
-
promise = null;
|
4930 |
-
}
|
4931 |
-
return ret;
|
4932 |
-
}
|
4933 |
-
|
4934 |
-
return tryConvertToPromise;
|
4935 |
-
};
|
4936 |
-
|
4937 |
-
},{"./util":36}],34:[function(_dereq_,module,exports){
|
4938 |
-
"use strict";
|
4939 |
-
module.exports = function(Promise, INTERNAL, debug) {
|
4940 |
-
var util = _dereq_("./util");
|
4941 |
-
var TimeoutError = Promise.TimeoutError;
|
4942 |
-
|
4943 |
-
function HandleWrapper(handle) {
|
4944 |
-
this.handle = handle;
|
4945 |
-
}
|
4946 |
-
|
4947 |
-
HandleWrapper.prototype._resultCancelled = function() {
|
4948 |
-
clearTimeout(this.handle);
|
4949 |
-
};
|
4950 |
-
|
4951 |
-
var afterValue = function(value) { return delay(+this).thenReturn(value); };
|
4952 |
-
var delay = Promise.delay = function (ms, value) {
|
4953 |
-
var ret;
|
4954 |
-
var handle;
|
4955 |
-
if (value !== undefined) {
|
4956 |
-
ret = Promise.resolve(value)
|
4957 |
-
._then(afterValue, null, null, ms, undefined);
|
4958 |
-
if (debug.cancellation() && value instanceof Promise) {
|
4959 |
-
ret._setOnCancel(value);
|
4960 |
-
}
|
4961 |
-
} else {
|
4962 |
-
ret = new Promise(INTERNAL);
|
4963 |
-
handle = setTimeout(function() { ret._fulfill(); }, +ms);
|
4964 |
-
if (debug.cancellation()) {
|
4965 |
-
ret._setOnCancel(new HandleWrapper(handle));
|
4966 |
-
}
|
4967 |
-
ret._captureStackTrace();
|
4968 |
-
}
|
4969 |
-
ret._setAsyncGuaranteed();
|
4970 |
-
return ret;
|
4971 |
-
};
|
4972 |
-
|
4973 |
-
Promise.prototype.delay = function (ms) {
|
4974 |
-
return delay(ms, this);
|
4975 |
-
};
|
4976 |
-
|
4977 |
-
var afterTimeout = function (promise, message, parent) {
|
4978 |
-
var err;
|
4979 |
-
if (typeof message !== "string") {
|
4980 |
-
if (message instanceof Error) {
|
4981 |
-
err = message;
|
4982 |
-
} else {
|
4983 |
-
err = new TimeoutError("operation timed out");
|
4984 |
-
}
|
4985 |
-
} else {
|
4986 |
-
err = new TimeoutError(message);
|
4987 |
-
}
|
4988 |
-
util.markAsOriginatingFromRejection(err);
|
4989 |
-
promise._attachExtraTrace(err);
|
4990 |
-
promise._reject(err);
|
4991 |
-
|
4992 |
-
if (parent != null) {
|
4993 |
-
parent.cancel();
|
4994 |
-
}
|
4995 |
-
};
|
4996 |
-
|
4997 |
-
function successClear(value) {
|
4998 |
-
clearTimeout(this.handle);
|
4999 |
-
return value;
|
5000 |
-
}
|
5001 |
-
|
5002 |
-
function failureClear(reason) {
|
5003 |
-
clearTimeout(this.handle);
|
5004 |
-
throw reason;
|
5005 |
-
}
|
5006 |
-
|
5007 |
-
Promise.prototype.timeout = function (ms, message) {
|
5008 |
-
ms = +ms;
|
5009 |
-
var ret, parent;
|
5010 |
-
|
5011 |
-
var handleWrapper = new HandleWrapper(setTimeout(function timeoutTimeout() {
|
5012 |
-
if (ret.isPending()) {
|
5013 |
-
afterTimeout(ret, message, parent);
|
5014 |
-
}
|
5015 |
-
}, ms));
|
5016 |
-
|
5017 |
-
if (debug.cancellation()) {
|
5018 |
-
parent = this.then();
|
5019 |
-
ret = parent._then(successClear, failureClear,
|
5020 |
-
undefined, handleWrapper, undefined);
|
5021 |
-
ret._setOnCancel(handleWrapper);
|
5022 |
-
} else {
|
5023 |
-
ret = this._then(successClear, failureClear,
|
5024 |
-
undefined, handleWrapper, undefined);
|
5025 |
-
}
|
5026 |
-
|
5027 |
-
return ret;
|
5028 |
-
};
|
5029 |
-
|
5030 |
-
};
|
5031 |
-
|
5032 |
-
},{"./util":36}],35:[function(_dereq_,module,exports){
|
5033 |
-
"use strict";
|
5034 |
-
module.exports = function (Promise, apiRejection, tryConvertToPromise,
|
5035 |
-
createContext, INTERNAL, debug) {
|
5036 |
-
var util = _dereq_("./util");
|
5037 |
-
var TypeError = _dereq_("./errors").TypeError;
|
5038 |
-
var inherits = _dereq_("./util").inherits;
|
5039 |
-
var errorObj = util.errorObj;
|
5040 |
-
var tryCatch = util.tryCatch;
|
5041 |
-
var NULL = {};
|
5042 |
-
|
5043 |
-
function thrower(e) {
|
5044 |
-
setTimeout(function(){throw e;}, 0);
|
5045 |
-
}
|
5046 |
-
|
5047 |
-
function castPreservingDisposable(thenable) {
|
5048 |
-
var maybePromise = tryConvertToPromise(thenable);
|
5049 |
-
if (maybePromise !== thenable &&
|
5050 |
-
typeof thenable._isDisposable === "function" &&
|
5051 |
-
typeof thenable._getDisposer === "function" &&
|
5052 |
-
thenable._isDisposable()) {
|
5053 |
-
maybePromise._setDisposable(thenable._getDisposer());
|
5054 |
-
}
|
5055 |
-
return maybePromise;
|
5056 |
-
}
|
5057 |
-
function dispose(resources, inspection) {
|
5058 |
-
var i = 0;
|
5059 |
-
var len = resources.length;
|
5060 |
-
var ret = new Promise(INTERNAL);
|
5061 |
-
function iterator() {
|
5062 |
-
if (i >= len) return ret._fulfill();
|
5063 |
-
var maybePromise = castPreservingDisposable(resources[i++]);
|
5064 |
-
if (maybePromise instanceof Promise &&
|
5065 |
-
maybePromise._isDisposable()) {
|
5066 |
-
try {
|
5067 |
-
maybePromise = tryConvertToPromise(
|
5068 |
-
maybePromise._getDisposer().tryDispose(inspection),
|
5069 |
-
resources.promise);
|
5070 |
-
} catch (e) {
|
5071 |
-
return thrower(e);
|
5072 |
-
}
|
5073 |
-
if (maybePromise instanceof Promise) {
|
5074 |
-
return maybePromise._then(iterator, thrower,
|
5075 |
-
null, null, null);
|
5076 |
-
}
|
5077 |
-
}
|
5078 |
-
iterator();
|
5079 |
-
}
|
5080 |
-
iterator();
|
5081 |
-
return ret;
|
5082 |
-
}
|
5083 |
-
|
5084 |
-
function Disposer(data, promise, context) {
|
5085 |
-
this._data = data;
|
5086 |
-
this._promise = promise;
|
5087 |
-
this._context = context;
|
5088 |
-
}
|
5089 |
-
|
5090 |
-
Disposer.prototype.data = function () {
|
5091 |
-
return this._data;
|
5092 |
-
};
|
5093 |
-
|
5094 |
-
Disposer.prototype.promise = function () {
|
5095 |
-
return this._promise;
|
5096 |
-
};
|
5097 |
-
|
5098 |
-
Disposer.prototype.resource = function () {
|
5099 |
-
if (this.promise().isFulfilled()) {
|
5100 |
-
return this.promise().value();
|
5101 |
-
}
|
5102 |
-
return NULL;
|
5103 |
-
};
|
5104 |
-
|
5105 |
-
Disposer.prototype.tryDispose = function(inspection) {
|
5106 |
-
var resource = this.resource();
|
5107 |
-
var context = this._context;
|
5108 |
-
if (context !== undefined) context._pushContext();
|
5109 |
-
var ret = resource !== NULL
|
5110 |
-
? this.doDispose(resource, inspection) : null;
|
5111 |
-
if (context !== undefined) context._popContext();
|
5112 |
-
this._promise._unsetDisposable();
|
5113 |
-
this._data = null;
|
5114 |
-
return ret;
|
5115 |
-
};
|
5116 |
-
|
5117 |
-
Disposer.isDisposer = function (d) {
|
5118 |
-
return (d != null &&
|
5119 |
-
typeof d.resource === "function" &&
|
5120 |
-
typeof d.tryDispose === "function");
|
5121 |
-
};
|
5122 |
-
|
5123 |
-
function FunctionDisposer(fn, promise, context) {
|
5124 |
-
this.constructor$(fn, promise, context);
|
5125 |
-
}
|
5126 |
-
inherits(FunctionDisposer, Disposer);
|
5127 |
-
|
5128 |
-
FunctionDisposer.prototype.doDispose = function (resource, inspection) {
|
5129 |
-
var fn = this.data();
|
5130 |
-
return fn.call(resource, resource, inspection);
|
5131 |
-
};
|
5132 |
-
|
5133 |
-
function maybeUnwrapDisposer(value) {
|
5134 |
-
if (Disposer.isDisposer(value)) {
|
5135 |
-
this.resources[this.index]._setDisposable(value);
|
5136 |
-
return value.promise();
|
5137 |
-
}
|
5138 |
-
return value;
|
5139 |
-
}
|
5140 |
-
|
5141 |
-
function ResourceList(length) {
|
5142 |
-
this.length = length;
|
5143 |
-
this.promise = null;
|
5144 |
-
this[length-1] = null;
|
5145 |
-
}
|
5146 |
-
|
5147 |
-
ResourceList.prototype._resultCancelled = function() {
|
5148 |
-
var len = this.length;
|
5149 |
-
for (var i = 0; i < len; ++i) {
|
5150 |
-
var item = this[i];
|
5151 |
-
if (item instanceof Promise) {
|
5152 |
-
item.cancel();
|
5153 |
-
}
|
5154 |
-
}
|
5155 |
-
};
|
5156 |
-
|
5157 |
-
Promise.using = function () {
|
5158 |
-
var len = arguments.length;
|
5159 |
-
if (len < 2) return apiRejection(
|
5160 |
-
"you must pass at least 2 arguments to Promise.using");
|
5161 |
-
var fn = arguments[len - 1];
|
5162 |
-
if (typeof fn !== "function") {
|
5163 |
-
return apiRejection("expecting a function but got " + util.classString(fn));
|
5164 |
-
}
|
5165 |
-
var input;
|
5166 |
-
var spreadArgs = true;
|
5167 |
-
if (len === 2 && Array.isArray(arguments[0])) {
|
5168 |
-
input = arguments[0];
|
5169 |
-
len = input.length;
|
5170 |
-
spreadArgs = false;
|
5171 |
-
} else {
|
5172 |
-
input = arguments;
|
5173 |
-
len--;
|
5174 |
-
}
|
5175 |
-
var resources = new ResourceList(len);
|
5176 |
-
for (var i = 0; i < len; ++i) {
|
5177 |
-
var resource = input[i];
|
5178 |
-
if (Disposer.isDisposer(resource)) {
|
5179 |
-
var disposer = resource;
|
5180 |
-
resource = resource.promise();
|
5181 |
-
resource._setDisposable(disposer);
|
5182 |
-
} else {
|
5183 |
-
var maybePromise = tryConvertToPromise(resource);
|
5184 |
-
if (maybePromise instanceof Promise) {
|
5185 |
-
resource =
|
5186 |
-
maybePromise._then(maybeUnwrapDisposer, null, null, {
|
5187 |
-
resources: resources,
|
5188 |
-
index: i
|
5189 |
-
}, undefined);
|
5190 |
-
}
|
5191 |
-
}
|
5192 |
-
resources[i] = resource;
|
5193 |
-
}
|
5194 |
-
|
5195 |
-
var reflectedResources = new Array(resources.length);
|
5196 |
-
for (var i = 0; i < reflectedResources.length; ++i) {
|
5197 |
-
reflectedResources[i] = Promise.resolve(resources[i]).reflect();
|
5198 |
-
}
|
5199 |
-
|
5200 |
-
var resultPromise = Promise.all(reflectedResources)
|
5201 |
-
.then(function(inspections) {
|
5202 |
-
for (var i = 0; i < inspections.length; ++i) {
|
5203 |
-
var inspection = inspections[i];
|
5204 |
-
if (inspection.isRejected()) {
|
5205 |
-
errorObj.e = inspection.error();
|
5206 |
-
return errorObj;
|
5207 |
-
} else if (!inspection.isFulfilled()) {
|
5208 |
-
resultPromise.cancel();
|
5209 |
-
return;
|
5210 |
-
}
|
5211 |
-
inspections[i] = inspection.value();
|
5212 |
-
}
|
5213 |
-
promise._pushContext();
|
5214 |
-
|
5215 |
-
fn = tryCatch(fn);
|
5216 |
-
var ret = spreadArgs
|
5217 |
-
? fn.apply(undefined, inspections) : fn(inspections);
|
5218 |
-
var promiseCreated = promise._popContext();
|
5219 |
-
debug.checkForgottenReturns(
|
5220 |
-
ret, promiseCreated, "Promise.using", promise);
|
5221 |
-
return ret;
|
5222 |
-
});
|
5223 |
-
|
5224 |
-
var promise = resultPromise.lastly(function() {
|
5225 |
-
var inspection = new Promise.PromiseInspection(resultPromise);
|
5226 |
-
return dispose(resources, inspection);
|
5227 |
-
});
|
5228 |
-
resources.promise = promise;
|
5229 |
-
promise._setOnCancel(resources);
|
5230 |
-
return promise;
|
5231 |
-
};
|
5232 |
-
|
5233 |
-
Promise.prototype._setDisposable = function (disposer) {
|
5234 |
-
this._bitField = this._bitField | 131072;
|
5235 |
-
this._disposer = disposer;
|
5236 |
-
};
|
5237 |
-
|
5238 |
-
Promise.prototype._isDisposable = function () {
|
5239 |
-
return (this._bitField & 131072) > 0;
|
5240 |
-
};
|
5241 |
-
|
5242 |
-
Promise.prototype._getDisposer = function () {
|
5243 |
-
return this._disposer;
|
5244 |
-
};
|
5245 |
-
|
5246 |
-
Promise.prototype._unsetDisposable = function () {
|
5247 |
-
this._bitField = this._bitField & (~131072);
|
5248 |
-
this._disposer = undefined;
|
5249 |
-
};
|
5250 |
-
|
5251 |
-
Promise.prototype.disposer = function (fn) {
|
5252 |
-
if (typeof fn === "function") {
|
5253 |
-
return new FunctionDisposer(fn, this, createContext());
|
5254 |
-
}
|
5255 |
-
throw new TypeError();
|
5256 |
-
};
|
5257 |
-
|
5258 |
-
};
|
5259 |
-
|
5260 |
-
},{"./errors":12,"./util":36}],36:[function(_dereq_,module,exports){
|
5261 |
-
"use strict";
|
5262 |
-
var es5 = _dereq_("./es5");
|
5263 |
-
var canEvaluate = typeof navigator == "undefined";
|
5264 |
-
|
5265 |
-
var errorObj = {e: {}};
|
5266 |
-
var tryCatchTarget;
|
5267 |
-
var globalObject = typeof self !== "undefined" ? self :
|
5268 |
-
typeof window !== "undefined" ? window :
|
5269 |
-
typeof global !== "undefined" ? global :
|
5270 |
-
this !== undefined ? this : null;
|
5271 |
-
|
5272 |
-
function tryCatcher() {
|
5273 |
-
try {
|
5274 |
-
var target = tryCatchTarget;
|
5275 |
-
tryCatchTarget = null;
|
5276 |
-
return target.apply(this, arguments);
|
5277 |
-
} catch (e) {
|
5278 |
-
errorObj.e = e;
|
5279 |
-
return errorObj;
|
5280 |
-
}
|
5281 |
-
}
|
5282 |
-
function tryCatch(fn) {
|
5283 |
-
tryCatchTarget = fn;
|
5284 |
-
return tryCatcher;
|
5285 |
-
}
|
5286 |
-
|
5287 |
-
var inherits = function(Child, Parent) {
|
5288 |
-
var hasProp = {}.hasOwnProperty;
|
5289 |
-
|
5290 |
-
function T() {
|
5291 |
-
this.constructor = Child;
|
5292 |
-
this.constructor$ = Parent;
|
5293 |
-
for (var propertyName in Parent.prototype) {
|
5294 |
-
if (hasProp.call(Parent.prototype, propertyName) &&
|
5295 |
-
propertyName.charAt(propertyName.length-1) !== "$"
|
5296 |
-
) {
|
5297 |
-
this[propertyName + "$"] = Parent.prototype[propertyName];
|
5298 |
-
}
|
5299 |
-
}
|
5300 |
-
}
|
5301 |
-
T.prototype = Parent.prototype;
|
5302 |
-
Child.prototype = new T();
|
5303 |
-
return Child.prototype;
|
5304 |
-
};
|
5305 |
-
|
5306 |
-
|
5307 |
-
function isPrimitive(val) {
|
5308 |
-
return val == null || val === true || val === false ||
|
5309 |
-
typeof val === "string" || typeof val === "number";
|
5310 |
-
|
5311 |
-
}
|
5312 |
-
|
5313 |
-
function isObject(value) {
|
5314 |
-
return typeof value === "function" ||
|
5315 |
-
typeof value === "object" && value !== null;
|
5316 |
-
}
|
5317 |
-
|
5318 |
-
function maybeWrapAsError(maybeError) {
|
5319 |
-
if (!isPrimitive(maybeError)) return maybeError;
|
5320 |
-
|
5321 |
-
return new Error(safeToString(maybeError));
|
5322 |
-
}
|
5323 |
-
|
5324 |
-
function withAppended(target, appendee) {
|
5325 |
-
var len = target.length;
|
5326 |
-
var ret = new Array(len + 1);
|
5327 |
-
var i;
|
5328 |
-
for (i = 0; i < len; ++i) {
|
5329 |
-
ret[i] = target[i];
|
5330 |
-
}
|
5331 |
-
ret[i] = appendee;
|
5332 |
-
return ret;
|
5333 |
-
}
|
5334 |
-
|
5335 |
-
function getDataPropertyOrDefault(obj, key, defaultValue) {
|
5336 |
-
if (es5.isES5) {
|
5337 |
-
var desc = Object.getOwnPropertyDescriptor(obj, key);
|
5338 |
-
|
5339 |
-
if (desc != null) {
|
5340 |
-
return desc.get == null && desc.set == null
|
5341 |
-
? desc.value
|
5342 |
-
: defaultValue;
|
5343 |
-
}
|
5344 |
-
} else {
|
5345 |
-
return {}.hasOwnProperty.call(obj, key) ? obj[key] : undefined;
|
5346 |
-
}
|
5347 |
-
}
|
5348 |
-
|
5349 |
-
function notEnumerableProp(obj, name, value) {
|
5350 |
-
if (isPrimitive(obj)) return obj;
|
5351 |
-
var descriptor = {
|
5352 |
-
value: value,
|
5353 |
-
configurable: true,
|
5354 |
-
enumerable: false,
|
5355 |
-
writable: true
|
5356 |
-
};
|
5357 |
-
es5.defineProperty(obj, name, descriptor);
|
5358 |
-
return obj;
|
5359 |
-
}
|
5360 |
-
|
5361 |
-
function thrower(r) {
|
5362 |
-
throw r;
|
5363 |
-
}
|
5364 |
-
|
5365 |
-
var inheritedDataKeys = (function() {
|
5366 |
-
var excludedPrototypes = [
|
5367 |
-
Array.prototype,
|
5368 |
-
Object.prototype,
|
5369 |
-
Function.prototype
|
5370 |
-
];
|
5371 |
-
|
5372 |
-
var isExcludedProto = function(val) {
|
5373 |
-
for (var i = 0; i < excludedPrototypes.length; ++i) {
|
5374 |
-
if (excludedPrototypes[i] === val) {
|
5375 |
-
return true;
|
5376 |
-
}
|
5377 |
-
}
|
5378 |
-
return false;
|
5379 |
-
};
|
5380 |
-
|
5381 |
-
if (es5.isES5) {
|
5382 |
-
var getKeys = Object.getOwnPropertyNames;
|
5383 |
-
return function(obj) {
|
5384 |
-
var ret = [];
|
5385 |
-
var visitedKeys = Object.create(null);
|
5386 |
-
while (obj != null && !isExcludedProto(obj)) {
|
5387 |
-
var keys;
|
5388 |
-
try {
|
5389 |
-
keys = getKeys(obj);
|
5390 |
-
} catch (e) {
|
5391 |
-
return ret;
|
5392 |
-
}
|
5393 |
-
for (var i = 0; i < keys.length; ++i) {
|
5394 |
-
var key = keys[i];
|
5395 |
-
if (visitedKeys[key]) continue;
|
5396 |
-
visitedKeys[key] = true;
|
5397 |
-
var desc = Object.getOwnPropertyDescriptor(obj, key);
|
5398 |
-
if (desc != null && desc.get == null && desc.set == null) {
|
5399 |
-
ret.push(key);
|
5400 |
-
}
|
5401 |
-
}
|
5402 |
-
obj = es5.getPrototypeOf(obj);
|
5403 |
-
}
|
5404 |
-
return ret;
|
5405 |
-
};
|
5406 |
-
} else {
|
5407 |
-
var hasProp = {}.hasOwnProperty;
|
5408 |
-
return function(obj) {
|
5409 |
-
if (isExcludedProto(obj)) return [];
|
5410 |
-
var ret = [];
|
5411 |
-
|
5412 |
-
/*jshint forin:false */
|
5413 |
-
enumeration: for (var key in obj) {
|
5414 |
-
if (hasProp.call(obj, key)) {
|
5415 |
-
ret.push(key);
|
5416 |
-
} else {
|
5417 |
-
for (var i = 0; i < excludedPrototypes.length; ++i) {
|
5418 |
-
if (hasProp.call(excludedPrototypes[i], key)) {
|
5419 |
-
continue enumeration;
|
5420 |
-
}
|
5421 |
-
}
|
5422 |
-
ret.push(key);
|
5423 |
-
}
|
5424 |
-
}
|
5425 |
-
return ret;
|
5426 |
-
};
|
5427 |
-
}
|
5428 |
-
|
5429 |
-
})();
|
5430 |
-
|
5431 |
-
var thisAssignmentPattern = /this\s*\.\s*\S+\s*=/;
|
5432 |
-
function isClass(fn) {
|
5433 |
-
try {
|
5434 |
-
if (typeof fn === "function") {
|
5435 |
-
var keys = es5.names(fn.prototype);
|
5436 |
-
|
5437 |
-
var hasMethods = es5.isES5 && keys.length > 1;
|
5438 |
-
var hasMethodsOtherThanConstructor = keys.length > 0 &&
|
5439 |
-
!(keys.length === 1 && keys[0] === "constructor");
|
5440 |
-
var hasThisAssignmentAndStaticMethods =
|
5441 |
-
thisAssignmentPattern.test(fn + "") && es5.names(fn).length > 0;
|
5442 |
-
|
5443 |
-
if (hasMethods || hasMethodsOtherThanConstructor ||
|
5444 |
-
hasThisAssignmentAndStaticMethods) {
|
5445 |
-
return true;
|
5446 |
-
}
|
5447 |
-
}
|
5448 |
-
return false;
|
5449 |
-
} catch (e) {
|
5450 |
-
return false;
|
5451 |
-
}
|
5452 |
-
}
|
5453 |
-
|
5454 |
-
function toFastProperties(obj) {
|
5455 |
-
/*jshint -W027,-W055,-W031*/
|
5456 |
-
function FakeConstructor() {}
|
5457 |
-
FakeConstructor.prototype = obj;
|
5458 |
-
var receiver = new FakeConstructor();
|
5459 |
-
function ic() {
|
5460 |
-
return typeof receiver.foo;
|
5461 |
-
}
|
5462 |
-
ic();
|
5463 |
-
ic();
|
5464 |
-
return obj;
|
5465 |
-
eval(obj);
|
5466 |
-
}
|
5467 |
-
|
5468 |
-
var rident = /^[a-z$_][a-z$_0-9]*$/i;
|
5469 |
-
function isIdentifier(str) {
|
5470 |
-
return rident.test(str);
|
5471 |
-
}
|
5472 |
-
|
5473 |
-
function filledRange(count, prefix, suffix) {
|
5474 |
-
var ret = new Array(count);
|
5475 |
-
for(var i = 0; i < count; ++i) {
|
5476 |
-
ret[i] = prefix + i + suffix;
|
5477 |
-
}
|
5478 |
-
return ret;
|
5479 |
-
}
|
5480 |
-
|
5481 |
-
function safeToString(obj) {
|
5482 |
-
try {
|
5483 |
-
return obj + "";
|
5484 |
-
} catch (e) {
|
5485 |
-
return "[no string representation]";
|
5486 |
-
}
|
5487 |
-
}
|
5488 |
-
|
5489 |
-
function isError(obj) {
|
5490 |
-
return obj instanceof Error ||
|
5491 |
-
(obj !== null &&
|
5492 |
-
typeof obj === "object" &&
|
5493 |
-
typeof obj.message === "string" &&
|
5494 |
-
typeof obj.name === "string");
|
5495 |
-
}
|
5496 |
-
|
5497 |
-
function markAsOriginatingFromRejection(e) {
|
5498 |
-
try {
|
5499 |
-
notEnumerableProp(e, "isOperational", true);
|
5500 |
-
}
|
5501 |
-
catch(ignore) {}
|
5502 |
-
}
|
5503 |
-
|
5504 |
-
function originatesFromRejection(e) {
|
5505 |
-
if (e == null) return false;
|
5506 |
-
return ((e instanceof Error["__BluebirdErrorTypes__"].OperationalError) ||
|
5507 |
-
e["isOperational"] === true);
|
5508 |
-
}
|
5509 |
-
|
5510 |
-
function canAttachTrace(obj) {
|
5511 |
-
return isError(obj) && es5.propertyIsWritable(obj, "stack");
|
5512 |
-
}
|
5513 |
-
|
5514 |
-
var ensureErrorObject = (function() {
|
5515 |
-
if (!("stack" in new Error())) {
|
5516 |
-
return function(value) {
|
5517 |
-
if (canAttachTrace(value)) return value;
|
5518 |
-
try {throw new Error(safeToString(value));}
|
5519 |
-
catch(err) {return err;}
|
5520 |
-
};
|
5521 |
-
} else {
|
5522 |
-
return function(value) {
|
5523 |
-
if (canAttachTrace(value)) return value;
|
5524 |
-
return new Error(safeToString(value));
|
5525 |
-
};
|
5526 |
-
}
|
5527 |
-
})();
|
5528 |
-
|
5529 |
-
function classString(obj) {
|
5530 |
-
return {}.toString.call(obj);
|
5531 |
-
}
|
5532 |
-
|
5533 |
-
function copyDescriptors(from, to, filter) {
|
5534 |
-
var keys = es5.names(from);
|
5535 |
-
for (var i = 0; i < keys.length; ++i) {
|
5536 |
-
var key = keys[i];
|
5537 |
-
if (filter(key)) {
|
5538 |
-
try {
|
5539 |
-
es5.defineProperty(to, key, es5.getDescriptor(from, key));
|
5540 |
-
} catch (ignore) {}
|
5541 |
-
}
|
5542 |
-
}
|
5543 |
-
}
|
5544 |
-
|
5545 |
-
var asArray = function(v) {
|
5546 |
-
if (es5.isArray(v)) {
|
5547 |
-
return v;
|
5548 |
-
}
|
5549 |
-
return null;
|
5550 |
-
};
|
5551 |
-
|
5552 |
-
if (typeof Symbol !== "undefined" && Symbol.iterator) {
|
5553 |
-
var ArrayFrom = typeof Array.from === "function" ? function(v) {
|
5554 |
-
return Array.from(v);
|
5555 |
-
} : function(v) {
|
5556 |
-
var ret = [];
|
5557 |
-
var it = v[Symbol.iterator]();
|
5558 |
-
var itResult;
|
5559 |
-
while (!((itResult = it.next()).done)) {
|
5560 |
-
ret.push(itResult.value);
|
5561 |
-
}
|
5562 |
-
return ret;
|
5563 |
-
};
|
5564 |
-
|
5565 |
-
asArray = function(v) {
|
5566 |
-
if (es5.isArray(v)) {
|
5567 |
-
return v;
|
5568 |
-
} else if (v != null && typeof v[Symbol.iterator] === "function") {
|
5569 |
-
return ArrayFrom(v);
|
5570 |
-
}
|
5571 |
-
return null;
|
5572 |
-
};
|
5573 |
-
}
|
5574 |
-
|
5575 |
-
var isNode = typeof process !== "undefined" &&
|
5576 |
-
classString(process).toLowerCase() === "[object process]";
|
5577 |
-
|
5578 |
-
var hasEnvVariables = typeof process !== "undefined" &&
|
5579 |
-
typeof process.env !== "undefined";
|
5580 |
-
|
5581 |
-
function env(key) {
|
5582 |
-
return hasEnvVariables ? process.env[key] : undefined;
|
5583 |
-
}
|
5584 |
-
|
5585 |
-
function getNativePromise() {
|
5586 |
-
if (typeof Promise === "function") {
|
5587 |
-
try {
|
5588 |
-
var promise = new Promise(function(){});
|
5589 |
-
if ({}.toString.call(promise) === "[object Promise]") {
|
5590 |
-
return Promise;
|
5591 |
-
}
|
5592 |
-
} catch (e) {}
|
5593 |
-
}
|
5594 |
-
}
|
5595 |
-
|
5596 |
-
function domainBind(self, cb) {
|
5597 |
-
return self.bind(cb);
|
5598 |
-
}
|
5599 |
-
|
5600 |
-
var ret = {
|
5601 |
-
isClass: isClass,
|
5602 |
-
isIdentifier: isIdentifier,
|
5603 |
-
inheritedDataKeys: inheritedDataKeys,
|
5604 |
-
getDataPropertyOrDefault: getDataPropertyOrDefault,
|
5605 |
-
thrower: thrower,
|
5606 |
-
isArray: es5.isArray,
|
5607 |
-
asArray: asArray,
|
5608 |
-
notEnumerableProp: notEnumerableProp,
|
5609 |
-
isPrimitive: isPrimitive,
|
5610 |
-
isObject: isObject,
|
5611 |
-
isError: isError,
|
5612 |
-
canEvaluate: canEvaluate,
|
5613 |
-
errorObj: errorObj,
|
5614 |
-
tryCatch: tryCatch,
|
5615 |
-
inherits: inherits,
|
5616 |
-
withAppended: withAppended,
|
5617 |
-
maybeWrapAsError: maybeWrapAsError,
|
5618 |
-
toFastProperties: toFastProperties,
|
5619 |
-
filledRange: filledRange,
|
5620 |
-
toString: safeToString,
|
5621 |
-
canAttachTrace: canAttachTrace,
|
5622 |
-
ensureErrorObject: ensureErrorObject,
|
5623 |
-
originatesFromRejection: originatesFromRejection,
|
5624 |
-
markAsOriginatingFromRejection: markAsOriginatingFromRejection,
|
5625 |
-
classString: classString,
|
5626 |
-
copyDescriptors: copyDescriptors,
|
5627 |
-
hasDevTools: typeof chrome !== "undefined" && chrome &&
|
5628 |
-
typeof chrome.loadTimes === "function",
|
5629 |
-
isNode: isNode,
|
5630 |
-
hasEnvVariables: hasEnvVariables,
|
5631 |
-
env: env,
|
5632 |
-
global: globalObject,
|
5633 |
-
getNativePromise: getNativePromise,
|
5634 |
-
domainBind: domainBind
|
5635 |
-
};
|
5636 |
-
ret.isRecentNode = ret.isNode && (function() {
|
5637 |
-
var version = process.versions.node.split(".").map(Number);
|
5638 |
-
return (version[0] === 0 && version[1] > 10) || (version[0] > 0);
|
5639 |
-
})();
|
5640 |
-
|
5641 |
-
if (ret.isNode) ret.toFastProperties(process);
|
5642 |
-
|
5643 |
-
try {throw new Error(); } catch (e) {ret.lastLineError = e;}
|
5644 |
-
module.exports = ret;
|
5645 |
-
|
5646 |
-
},{"./es5":13}]},{},[4])(4)
|
5647 |
-
}); ;if (typeof window !== 'undefined' && window !== null) { window.P = window.Promise; } else if (typeof self !== 'undefined' && self !== null) { self.P = self.Promise; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/bluebird.min.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
!function(t){var e;"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):("undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.Promise=t())}(function(){var t,e,n;return function r(i,o,s){function a(n,t){if(!o[n]){if(!i[n]){var e="function"==typeof _dereq_&&_dereq_;if(!t&&e)return e(n,!0);if(c)return c(n,!0);e=new Error("Cannot find module '"+n+"'");throw e.code="MODULE_NOT_FOUND",e}e=o[n]={exports:{}};i[n][0].call(e.exports,function(t){var e=i[n][1][t];return a(e||t)},e,e.exports,r,i,o,s)}return o[n].exports}for(var c="function"==typeof _dereq_&&_dereq_,t=0;t<s.length;t++)a(s[t]);return a}({1:[function(t,e,n){"use strict";e.exports=function(t){var n=t._SomePromiseArray;function e(t){var e=new n(t),t=e.promise();return e.setHowMany(1),e.setUnwrap(),e.init(),t}t.any=e,t.prototype.any=function(){return e(this)}}},{}],2:[function(t,e,n){"use strict";var r;try{throw new Error}catch(t){r=t}var i=t("./schedule"),o=t("./queue"),s=t("./util");function a(){this._customScheduler=!1,this._isTickUsed=!1,this._lateQueue=new o(16),this._normalQueue=new o(16),this._haveDrainedQueues=!1,this._trampolineEnabled=!0;var t=this;this.drainQueues=function(){t._drainQueues()},this._schedule=i}function c(t,e,n){this._lateQueue.push(t,e,n),this._queueTick()}function l(t,e,n){this._normalQueue.push(t,e,n),this._queueTick()}function u(t){this._normalQueue._pushOne(t),this._queueTick()}function p(t){for(;0<t.length();)!function(t){var e=t.shift();{var n;"function"!=typeof e?e._settlePromises():(n=t.shift(),t=t.shift(),e.call(n,t))}}(t)}a.prototype.setScheduler=function(t){var e=this._schedule;return this._schedule=t,this._customScheduler=!0,e},a.prototype.hasCustomScheduler=function(){return this._customScheduler},a.prototype.enableTrampoline=function(){this._trampolineEnabled=!0},a.prototype.disableTrampolineIfNecessary=function(){s.hasDevTools&&(this._trampolineEnabled=!1)},a.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues},a.prototype.fatalError=function(t,e){e?(process.stderr.write("Fatal "+(t instanceof Error?t.stack:t)+"\n"),process.exit(2)):this.throwLater(t)},a.prototype.throwLater=function(t,e){if(1===arguments.length&&(e=t,t=function(){throw e}),"undefined"!=typeof setTimeout)setTimeout(function(){t(e)},0);else try{this._schedule(function(){t(e)})}catch(t){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")}},s.hasDevTools?(a.prototype.invokeLater=function(t,e,n){this._trampolineEnabled?c.call(this,t,e,n):this._schedule(function(){setTimeout(function(){t.call(e,n)},100)})},a.prototype.invoke=function(t,e,n){this._trampolineEnabled?l.call(this,t,e,n):this._schedule(function(){t.call(e,n)})},a.prototype.settlePromises=function(t){this._trampolineEnabled?u.call(this,t):this._schedule(function(){t._settlePromises()})}):(a.prototype.invokeLater=c,a.prototype.invoke=l,a.prototype.settlePromises=u),a.prototype._drainQueues=function(){p(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,p(this._lateQueue)},a.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},a.prototype._reset=function(){this._isTickUsed=!1},e.exports=a,e.exports.firstLineError=r},{"./queue":26,"./schedule":29,"./util":36}],3:[function(t,e,n){"use strict";e.exports=function(i,o,s,a){function n(t,e){this._reject(e)}function c(t,e){e.promiseRejectionQueued=!0,e.bindingPromise._then(n,n,null,this,t)}function l(t,e){0==(50397184&this._bitField)&&this._resolveCallback(e.target)}function u(t,e){e.promiseRejectionQueued||this._reject(t)}var p=!1;i.prototype.bind=function(t){p||(p=!0,i.prototype._propagateFrom=a.propagateFromFunction(),i.prototype._boundValue=a.boundValueFunction());var e=s(t),n=new i(o);n._propagateFrom(this,1);var r=this._target();return n._setBoundTo(e),e instanceof i?(r._then(o,c,void 0,n,t={promiseRejectionQueued:!1,promise:n,target:r,bindingPromise:e}),e._then(l,u,void 0,n,t),n._setOnCancel(e)):n._resolveCallback(r),n},i.prototype._setBoundTo=function(t){void 0!==t?(this._bitField=2097152|this._bitField,this._boundTo=t):this._bitField=-2097153&this._bitField},i.prototype._isBound=function(){return 2097152==(2097152&this._bitField)},i.bind=function(t,e){return i.resolve(e).bind(t)}}},{}],4:[function(t,e,n){"use strict";var r;"undefined"!=typeof Promise&&(r=Promise);var i=t("./promise")();i.noConflict=function(){try{Promise===i&&(Promise=r)}catch(t){}return i},e.exports=i},{"./promise":22}],5:[function(t,e,n){"use strict";var r,i=Object.create;i&&(r=i(null),i=i(null),r[" size"]=i[" size"]=0),e.exports=function(r){var n,i=t("./util"),o=i.canEvaluate;i.isIdentifier;function e(t,e){var n;if("function"==typeof(n=null!=t?t[e]:n))return n;e="Object "+i.classString(t)+" has no method '"+i.toString(e)+"'";throw new r.TypeError(e)}function s(t){return e(t,this.pop()).apply(t,this)}function a(t){return t[this]}function c(t){var e=+this;return t[e=e<0?Math.max(0,e+t.length):e]}r.prototype.call=function(t){var e=[].slice.call(arguments,1);return e.push(t),this._then(s,void 0,void 0,e,void 0)},r.prototype.get=function(t){var e;return e="number"==typeof t?c:o&&null!==(e=n(t))?e:a,this._then(e,void 0,void 0,t,void 0)}}},{"./util":36}],6:[function(c,t,e){"use strict";t.exports=function(t,e,n,r){var i=c("./util"),o=i.tryCatch,s=i.errorObj,a=t._async;t.prototype.break=t.prototype.cancel=function(){if(!r.cancellation())return this._warn("cancellation is disabled");for(var t=this,e=t;t._isCancellable();){if(!t._cancelBy(e)){e._isFollowing()?e._followee().cancel():e._cancelBranched();break}var n=t._cancellationParent;if(null==n||!n._isCancellable()){t._isFollowing()?t._followee().cancel():t._cancelBranched();break}t._isFollowing()&&t._followee().cancel(),t._setWillBeCancelled(),e=t,t=n}},t.prototype._branchHasCancelled=function(){this._branchesRemainingToCancel--},t.prototype._enoughBranchesHaveCancelled=function(){return void 0===this._branchesRemainingToCancel||this._branchesRemainingToCancel<=0},t.prototype._cancelBy=function(t){return t===this?(this._branchesRemainingToCancel=0,this._invokeOnCancel(),!0):(this._branchHasCancelled(),!!this._enoughBranchesHaveCancelled()&&(this._invokeOnCancel(),!0))},t.prototype._cancelBranched=function(){this._enoughBranchesHaveCancelled()&&this._cancel()},t.prototype._cancel=function(){this._isCancellable()&&(this._setCancelled(),a.invoke(this._cancelPromises,this,void 0))},t.prototype._cancelPromises=function(){0<this._length()&&this._settlePromises()},t.prototype._unsetOnCancel=function(){this._onCancelField=void 0},t.prototype._isCancellable=function(){return this.isPending()&&!this._isCancelled()},t.prototype.isCancellable=function(){return this.isPending()&&!this.isCancelled()},t.prototype._doInvokeOnCancel=function(t,e){var n;if(i.isArray(t))for(var r=0;r<t.length;++r)this._doInvokeOnCancel(t[r],e);else void 0!==t&&("function"==typeof t?e||(n=o(t).call(this._boundValue()))===s&&(this._attachExtraTrace(n.e),a.throwLater(n.e)):t._resultCancelled(this))},t.prototype._invokeOnCancel=function(){var t=this._onCancel();this._unsetOnCancel(),a.invoke(this._doInvokeOnCancel,this,t)},t.prototype._invokeInternalOnCancel=function(){this._isCancellable()&&(this._doInvokeOnCancel(this._onCancel(),!0),this._unsetOnCancel())},t.prototype._resultCancelled=function(){this.cancel()}}},{"./util":36}],7:[function(t,e,n){"use strict";e.exports=function(p){var h=t("./util"),f=t("./es5").keys,_=h.tryCatch,d=h.errorObj;return function(c,l,u){return function(t){var e=u._boundValue();t:for(var n=0;n<c.length;++n){var r=c[n];if(r===Error||null!=r&&r.prototype instanceof Error){if(t instanceof r)return _(l).call(e,t)}else if("function"==typeof r){var i=_(r).call(e,t);if(i===d)return i;if(i)return _(l).call(e,t)}else if(h.isObject(t)){for(var o=f(r),s=0;s<o.length;++s){var a=o[s];if(r[a]!=t[a])continue t}return _(l).call(e,t)}}return p}}}},{"./es5":13,"./util":36}],8:[function(t,e,n){"use strict";e.exports=function(o){var s=!1,n=[];function a(){this._trace=new a.CapturedTrace(c())}function c(){var t=n.length-1;if(0<=t)return n[t]}return o.prototype._promiseCreated=function(){},o.prototype._pushContext=function(){},o.prototype._popContext=function(){return null},o._peekContext=o.prototype._peekContext=function(){},a.prototype._pushContext=function(){void 0!==this._trace&&(this._trace._promiseCreated=null,n.push(this._trace))},a.prototype._popContext=function(){if(void 0===this._trace)return null;var t=n.pop(),e=t._promiseCreated;return t._promiseCreated=null,e},a.CapturedTrace=null,a.create=function(){if(s)return new a},a.deactivateLongStackTraces=function(){},a.activateLongStackTraces=function(){var t=o.prototype._pushContext,e=o.prototype._popContext,n=o._peekContext,r=o.prototype._peekContext,i=o.prototype._promiseCreated;a.deactivateLongStackTraces=function(){o.prototype._pushContext=t,o.prototype._popContext=e,o._peekContext=n,o.prototype._peekContext=r,o.prototype._promiseCreated=i,s=!1},s=!0,o.prototype._pushContext=a.prototype._pushContext,o.prototype._popContext=a.prototype._popContext,o._peekContext=o.prototype._peekContext=c,o.prototype._promiseCreated=function(){var t=this._peekContext();t&&null==t._promiseCreated&&(t._promiseCreated=this)}},a}},{}],9:[function(J,t,e){"use strict";t.exports=function(i,r){var n,o,s,a=i._getDomain,c=i._async,l=J("./errors").Warning,u=J("./util"),p=J("./es5"),h=u.canAttachTrace,f=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,_=/\((?:timers\.js):\d+:\d+\)/,d=/[\/<\(](.+?):(\d+):(\d+)\)?\s*$/,v=null,y=null,m=!1,t=!(0==u.env("BLUEBIRD_DEBUG")),e=!(0==u.env("BLUEBIRD_WARNINGS")||!t&&!u.env("BLUEBIRD_WARNINGS")),t=!(0==u.env("BLUEBIRD_LONG_STACK_TRACES")||!t&&!u.env("BLUEBIRD_LONG_STACK_TRACES")),g=0!=u.env("BLUEBIRD_W_FORGOTTEN_RETURN")&&(e||!!u.env("BLUEBIRD_W_FORGOTTEN_RETURN"));i.prototype.suppressUnhandledRejections=function(){var t=this._target();t._bitField=-1048577&t._bitField|524288},i.prototype._ensurePossibleRejectionHandled=function(){var t;0==(524288&this._bitField)&&(this._setRejectionIsUnhandled(),t=this,setTimeout(function(){t._notifyUnhandledRejection()},1))},i.prototype._notifyUnhandledRejectionIsHandled=function(){M("rejectionHandled",n,void 0,this)},i.prototype._setReturnedNonUndefined=function(){this._bitField=268435456|this._bitField},i.prototype._returnedNonUndefined=function(){return 0!=(268435456&this._bitField)},i.prototype._notifyUnhandledRejection=function(){var t;this._isRejectionUnhandled()&&(t=this._settledValue(),this._setUnhandledRejectionIsNotified(),M("unhandledRejection",o,t,this))},i.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=262144|this._bitField},i.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=-262145&this._bitField},i.prototype._isUnhandledRejectionNotified=function(){return 0<(262144&this._bitField)},i.prototype._setRejectionIsUnhandled=function(){this._bitField=1048576|this._bitField},i.prototype._unsetRejectionIsUnhandled=function(){this._bitField=-1048577&this._bitField,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},i.prototype._isRejectionUnhandled=function(){return 0<(1048576&this._bitField)},i.prototype._warn=function(t,e,n){return H(t,e,n||this)},i.onPossiblyUnhandledRejection=function(t){var e=a();o="function"==typeof t?null===e?t:u.domainBind(e,t):void 0},i.onUnhandledRejectionHandled=function(t){var e=a();n="function"==typeof t?null===e?t:u.domainBind(e,t):void 0};var b=function(){};i.longStackTraces=function(){if(c.haveItemsQueued()&&!K.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");var t,e,n;!K.longStackTraces&&$()&&(t=i.prototype._captureStackTrace,e=i.prototype._attachExtraTrace,n=i.prototype._dereferenceTrace,K.longStackTraces=!0,b=function(){if(c.haveItemsQueued()&&!K.longStackTraces)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");i.prototype._captureStackTrace=t,i.prototype._attachExtraTrace=e,i.prototype._dereferenceTrace=n,r.deactivateLongStackTraces(),c.enableTrampoline(),K.longStackTraces=!1},i.prototype._captureStackTrace=V,i.prototype._attachExtraTrace=I,i.prototype._dereferenceTrace=L,r.activateLongStackTraces(),c.disableTrampolineIfNecessary())},i.hasLongStackTraces=function(){return K.longStackTraces&&$()};var w=function(){try{if("function"==typeof CustomEvent){var t=new CustomEvent("CustomEvent");return u.global.dispatchEvent(t),function(t,e){var n={detail:e,cancelable:!0};p.defineProperty(n,"promise",{value:e.promise}),p.defineProperty(n,"reason",{value:e.reason});n=new CustomEvent(t.toLowerCase(),n);return!u.global.dispatchEvent(n)}}if("function"!=typeof Event)return(t=document.createEvent("CustomEvent")).initCustomEvent("testingtheevent",!1,!0,{}),u.global.dispatchEvent(t),function(t,e){var n=document.createEvent("CustomEvent");return n.initCustomEvent(t.toLowerCase(),!1,!0,e),!u.global.dispatchEvent(n)};var t=new Event("CustomEvent");return u.global.dispatchEvent(t),function(t,e){t=new Event(t.toLowerCase(),{cancelable:!0});return t.detail=e,p.defineProperty(t,"promise",{value:e.promise}),p.defineProperty(t,"reason",{value:e.reason}),!u.global.dispatchEvent(t)}}catch(t){}return function(){return!1}}(),C=u.isNode?function(){return process.emit.apply(process,arguments)}:u.global?function(t){t="on"+t.toLowerCase(),t=u.global[t];return!!t&&(t.apply(u.global,[].slice.call(arguments,1)),!0)}:function(){return!1};function j(t,e){return{promise:e}}var E={promiseCreated:j,promiseFulfilled:j,promiseRejected:j,promiseResolved:j,promiseCancelled:j,promiseChained:function(t,e,n){return{promise:e,child:n}},warning:function(t,e){return{warning:e}},unhandledRejection:function(t,e,n){return{reason:e,promise:n}},rejectionHandled:j},k=function(t){var e=!1;try{e=C.apply(null,arguments)}catch(t){c.throwLater(t),e=!0}var n=!1;try{n=w(t,E[t].apply(null,arguments))}catch(t){c.throwLater(t),n=!0}return n||e};function F(){return!1}function T(t,e,n){var r=this;try{t(e,n,function(t){if("function"!=typeof t)throw new TypeError("onCancel must be a function, got: "+u.toString(t));r._attachCancellationCallback(t)})}catch(t){return t}}function x(t){if(!this._isCancellable())return this;var e=this._onCancel();void 0!==e?u.isArray(e)?e.push(t):this._setOnCancel([e,t]):this._setOnCancel(t)}function P(){return this._onCancelField}function R(t){this._onCancelField=t}function S(){this._cancellationParent=void 0,this._onCancelField=void 0}function O(t,e){var n;0!=(1&e)&&(n=(this._cancellationParent=t)._branchesRemainingToCancel,t._branchesRemainingToCancel=(n=void 0===n?0:n)+1),0!=(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)}i.config=function(t){var e;if("longStackTraces"in(t=Object(t))&&(t.longStackTraces?i.longStackTraces():!t.longStackTraces&&i.hasLongStackTraces()&&b()),"warnings"in t&&(e=t.warnings,K.warnings=!!e,g=K.warnings,u.isObject(e)&&"wForgottenReturn"in e&&(g=!!e.wForgottenReturn)),"cancellation"in t&&t.cancellation&&!K.cancellation){if(c.haveItemsQueued())throw new Error("cannot enable cancellation after promises are in use");i.prototype._clearCancellationData=S,i.prototype._propagateFrom=O,i.prototype._onCancel=P,i.prototype._setOnCancel=R,i.prototype._attachCancellationCallback=x,i.prototype._execute=T,A=O,K.cancellation=!0}return"monitoring"in t&&(t.monitoring&&!K.monitoring?(K.monitoring=!0,i.prototype._fireEvent=k):!t.monitoring&&K.monitoring&&(K.monitoring=!1,i.prototype._fireEvent=F)),i},i.prototype._fireEvent=F,i.prototype._execute=function(t,e,n){try{t(e,n)}catch(t){return t}},i.prototype._onCancel=function(){},i.prototype._setOnCancel=function(t){},i.prototype._attachCancellationCallback=function(t){},i.prototype._captureStackTrace=function(){},i.prototype._attachExtraTrace=function(){},i.prototype._dereferenceTrace=function(){},i.prototype._clearCancellationData=function(){},i.prototype._propagateFrom=function(t,e){};var A=function(t,e){0!=(2&e)&&t._isBound()&&this._setBoundTo(t._boundTo)};function D(){var t=this._boundTo;return void 0!==t&&t instanceof i?t.isFulfilled()?t.value():void 0:t}function V(){this._trace=new X(this._peekContext())}function I(t,e){var n;h(t)&&(void 0!==(n=void 0!==(n=this._trace)&&e?n._parent:n)?n.attachExtraTrace(t):t.__stackCleaned__||(n=U(t),u.notEnumerableProp(t,"stack",n.message+"\n"+n.stack.join("\n")),u.notEnumerableProp(t,"__stackCleaned__",!0)))}function L(){this._trace=void 0}function H(t,e,n){var r;K.warnings&&(t=new l(t),e?n._attachExtraTrace(t):K.longStackTraces&&(r=i._peekContext())?r.attachExtraTrace(t):(r=U(t),t.stack=r.message+"\n"+r.stack.join("\n")),k("warning",t)||B(t,"",!0))}function N(t){for(var e=[],n=0;n<t.length;++n){var r=t[n],i=" (No stack trace)"===r||v.test(r),o=i&&Q(r);i&&!o&&(m&&" "!==r.charAt(0)&&(r=" "+r),e.push(r))}return e}function U(t){var e=t.stack,n=t.toString(),e="string"==typeof e&&0<e.length?function(t){for(var e=t.stack.replace(/\s+$/g,"").split("\n"),n=0;n<e.length;++n){var r=e[n];if(" (No stack trace)"===r||v.test(r))break}return e=0<n&&"SyntaxError"!=t.name?e.slice(n):e}(t):[" (No stack trace)"];return{message:n,stack:"SyntaxError"==t.name?e:N(e)}}function B(t,e,n){var r;"undefined"!=typeof console&&(t=u.isObject(t)?(r=t.stack,e+y(r,t)):e+String(t),"function"==typeof s&&s(t,n))}function M(t,e,n,r){var i=!1;try{"function"==typeof e&&(i=!0,"rejectionHandled"===t?e(r):e(n,r))}catch(t){c.throwLater(t)}"unhandledRejection"===t?k(t,n,r)||i||B(n,"Unhandled rejection "):k(t,r)}function q(t){if("function"==typeof t)e="[function "+(t.name||"anonymous")+"]";else{e=t&&"function"==typeof t.toString?t.toString():u.toString(t);if(/\[object [a-zA-Z0-9$_]+\]/.test(e))try{var e=JSON.stringify(t)}catch(t){}0===e.length&&(e="(empty array)")}return"(<"+function(t){if(t.length<41)return t;return t.substr(0,38)+"..."}(e)+">, no stack trace)"}function $(){return"function"==typeof W}var Q=function(){return!1},z=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;function G(t){t=t.match(z);if(t)return{fileName:t[1],line:parseInt(t[2],10)}}function X(t){this._parent=t,this._promisesCreated=0;t=this._length=1+(void 0===t?0:t._length);W(this,X),32<t&&this.uncycle()}u.inherits(X,Error),(r.CapturedTrace=X).prototype.uncycle=function(){if(!((i=this._length)<2)){for(var t=[],e={},n=0,r=this;void 0!==r;++n)t.push(r),r=r._parent;for(var i,n=(i=this._length=n)-1;0<=n;--n){var o=t[n].stack;void 0===e[o]&&(e[o]=n)}for(n=0;n<i;++n){var s=e[t[n].stack];if(void 0!==s&&s!==n){0<s&&(t[s-1]._parent=void 0,t[s-1]._length=1),t[n]._parent=void 0,t[n]._length=1;var a=0<n?t[n-1]:this;s<i-1?(a._parent=t[s+1],a._parent.uncycle(),a._length=a._parent._length+1):(a._parent=void 0,a._length=1);for(var c=a._length+1,l=n-2;0<=l;--l)t[l]._length=c,c++;return}}}},X.prototype.attachExtraTrace=function(t){if(!t.__stackCleaned__){this.uncycle();for(var e=U(t),n=e.message,r=[e.stack],i=this;void 0!==i;)r.push(N(i.stack.split("\n"))),i=i._parent;!function(t){for(var e=t[0],n=1;n<t.length;++n){for(var r=t[n],i=e.length-1,o=e[i],s=-1,a=r.length-1;0<=a;--a)if(r[a]===o){s=a;break}for(a=s;0<=a;--a){var c=r[a];if(e[i]!==c)break;e.pop(),i--}e=r}}(r),function(t){for(var e=0;e<t.length;++e)(0===t[e].length||e+1<t.length&&t[e][0]===t[e+1][0])&&(t.splice(e,1),e--)}(r),u.notEnumerableProp(t,"stack",function(t,e){for(var n=0;n<e.length-1;++n)e[n].push("From previous event:"),e[n]=e[n].join("\n");return n<e.length&&(e[n]=e[n].join("\n")),t+"\n"+e.join("\n")}(n,r)),u.notEnumerableProp(t,"__stackCleaned__",!0)}};var W=function(){function t(t,e){return"string"==typeof t?t:void 0!==e.name&&void 0!==e.message?e.toString():q(e)}var e=/^\s*at\s*/;if("number"==typeof Error.stackTraceLimit&&"function"==typeof Error.captureStackTrace){Error.stackTraceLimit+=6,v=e,y=t;var n=Error.captureStackTrace;return Q=function(t){return f.test(t)},function(t,e){Error.stackTraceLimit+=6,n(t,e),Error.stackTraceLimit-=6}}var r,i=new Error;if("string"==typeof i.stack&&0<=i.stack.split("\n")[0].indexOf("stackDetection@"))return v=/@/,y=t,m=!0,function(t){t.stack=(new Error).stack};try{throw new Error}catch(t){r="stack"in t}return"stack"in i||!r||"number"!=typeof Error.stackTraceLimit?(y=function(t,e){return"string"==typeof t?t:"object"!=typeof e&&"function"!=typeof e||void 0===e.name||void 0===e.message?q(e):e.toString()},null):(v=e,y=t,function(e){Error.stackTraceLimit+=6;try{throw new Error}catch(t){e.stack=t.stack}Error.stackTraceLimit-=6})}();"undefined"!=typeof console&&void 0!==console.warn&&(s=function(t){},u.isNode&&process.stderr.isTTY?s=function(t,e){}:u.isNode||"string"!=typeof(new Error).stack||(s=function(t,e){}));var K={warnings:e,longStackTraces:!1,cancellation:!1,monitoring:!1};return t&&i.longStackTraces(),{longStackTraces:function(){return K.longStackTraces},warnings:function(){return K.warnings},cancellation:function(){return K.cancellation},monitoring:function(){return K.monitoring},propagateFromFunction:function(){return A},boundValueFunction:function(){return D},checkForgottenReturns:function(t,e,n,r,i){if(void 0===t&&null!==e&&g&&(void 0===i||!i._returnedNonUndefined())&&0!=(65535&r._bitField)){n&&(n+=" ");var o="",s="";if(e._trace){for(var a=e._trace.stack.split("\n"),c=N(a),l=c.length-1;0<=l;--l){var u=c[l];if(!_.test(u)){u=u.match(d);u&&(o="at "+u[1]+":"+u[2]+":"+u[3]+" ");break}}if(0<c.length)for(var p=c[0],l=0;l<a.length;++l)if(a[l]===p){0<l&&(s="\n"+a[l-1]);break}}r._warn("a promise was created in a "+n+"handler "+o+"but was not returned from it, see http://goo.gl/rRqMUw"+s,!0,e)}},setBounds:function(t,e){if($()){for(var n,r,i=t.stack.split("\n"),o=e.stack.split("\n"),s=-1,a=-1,c=0;c<i.length;++c)if(l=G(i[c])){n=l.fileName,s=l.line;break}for(var l,c=0;c<o.length;++c)if(l=G(o[c])){r=l.fileName,a=l.line;break}s<0||a<0||!n||!r||n!==r||a<=s||(Q=function(t){if(f.test(t))return!0;t=G(t);return!!(t&&t.fileName===n&&s<=t.line&&t.line<=a)})}},warn:H,deprecated:function(t,e){return t+=" is deprecated and will be removed in a future version.",e&&(t+=" Use "+e+" instead."),H(t)},CapturedTrace:X,fireDomEvent:w,fireGlobalEvent:C}}},{"./errors":12,"./es5":13,"./util":36}],10:[function(t,e,n){"use strict";e.exports=function(n){function r(){return this.value}function i(){throw this.reason}n.prototype.return=n.prototype.thenReturn=function(t){return t instanceof n&&t.suppressUnhandledRejections(),this._then(r,void 0,void 0,{value:t},void 0)},n.prototype.throw=n.prototype.thenThrow=function(t){return this._then(i,void 0,void 0,{reason:t},void 0)},n.prototype.catchThrow=function(t){if(arguments.length<=1)return this._then(void 0,i,void 0,{reason:t},void 0);var e=arguments[1];return this.caught(t,function(){throw e})},n.prototype.catchReturn=function(t){if(arguments.length<=1)return t instanceof n&&t.suppressUnhandledRejections(),this._then(void 0,r,void 0,{value:t},void 0);var e=arguments[1];e instanceof n&&e.suppressUnhandledRejections();return this.caught(t,function(){return e})}}},{}],11:[function(t,e,n){"use strict";e.exports=function(t,n){var r=t.reduce,e=t.all;function i(){return e(this)}t.prototype.each=function(t){return r(this,t,n,0)._then(i,void 0,void 0,this,void 0)},t.prototype.mapSeries=function(t){return r(this,t,n,n)},t.each=function(t,e){return r(t,e,n,0)._then(i,void 0,void 0,t,void 0)},t.mapSeries=function(t,e){return r(t,e,n,n)}}},{}],12:[function(t,e,n){"use strict";var r,i,o=t("./es5"),s=o.freeze,a=t("./util"),c=a.inherits,l=a.notEnumerableProp;function u(e,n){function r(t){if(!(this instanceof r))return new r(t);l(this,"message","string"==typeof t?t:n),l(this,"name",e),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this)}return c(r,Error),r}var p=u("Warning","warning"),h=u("CancellationError","cancellation error"),t=u("TimeoutError","timeout error"),f=u("AggregateError","aggregate error");try{r=TypeError,i=RangeError}catch(t){r=u("TypeError","type error"),i=u("RangeError","range error")}for(var _="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),d=0;d<_.length;++d)"function"==typeof Array.prototype[_[d]]&&(f.prototype[_[d]]=Array.prototype[_[d]]);o.defineProperty(f.prototype,"length",{value:0,configurable:!1,writable:!0,enumerable:!0}),f.prototype.isOperational=!0;var v=0;function y(t){if(!(this instanceof y))return new y(t);l(this,"name","OperationalError"),l(this,"message",t),this.cause=t,this.isOperational=!0,t instanceof Error?(l(this,"message",t.message),l(this,"stack",t.stack)):Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}f.prototype.toString=function(){var t="\n"+(e=Array(4*v+1).join(" "))+"AggregateError of:\n";v++;for(var e=Array(4*v+1).join(" "),n=0;n<this.length;++n){for(var r=this[n]===this?"[Circular AggregateError]":this[n]+"",i=r.split("\n"),o=0;o<i.length;++o)i[o]=e+i[o];t+=(r=i.join("\n"))+"\n"}return v--,t},c(y,Error);a=Error.__BluebirdErrorTypes__;a||(a=s({CancellationError:h,TimeoutError:t,OperationalError:y,RejectionError:y,AggregateError:f}),o.defineProperty(Error,"__BluebirdErrorTypes__",{value:a,writable:!1,enumerable:!1,configurable:!1})),e.exports={Error:Error,TypeError:r,RangeError:i,CancellationError:a.CancellationError,OperationalError:a.OperationalError,TimeoutError:a.TimeoutError,AggregateError:a.AggregateError,Warning:p}},{"./es5":13,"./util":36}],13:[function(t,e,n){var r,i,o,s=function(){"use strict";return void 0===this}();s?e.exports={freeze:Object.freeze,defineProperty:Object.defineProperty,getDescriptor:Object.getOwnPropertyDescriptor,keys:Object.keys,names:Object.getOwnPropertyNames,getPrototypeOf:Object.getPrototypeOf,isArray:Array.isArray,isES5:s,propertyIsWritable:function(t,e){e=Object.getOwnPropertyDescriptor(t,e);return!(e&&!e.writable&&!e.set)}}:(r={}.hasOwnProperty,i={}.toString,o={}.constructor.prototype,e.exports={isArray:function(t){try{return"[object Array]"===i.call(t)}catch(t){return!1}},keys:e=function(t){var e,n=[];for(e in t)r.call(t,e)&&n.push(e);return n},names:e,defineProperty:function(t,e,n){return t[e]=n.value,t},getDescriptor:function(t,e){return{value:t[e]}},freeze:function(t){return t},getPrototypeOf:function(t){try{return Object(t).constructor.prototype}catch(t){return o}},isES5:s,propertyIsWritable:function(){return!0}})},{}],14:[function(t,e,n){"use strict";e.exports=function(t,r){var i=t.map;t.prototype.filter=function(t,e){return i(this,t,e,r)},t.filter=function(t,e,n){return i(t,e,n,r)}}},{}],15:[function(t,e,n){"use strict";e.exports=function(s,i,o){var a=t("./util"),c=s.CancellationError,l=a.errorObj,u=t("./catch_filter")(o);function p(t,e,n){this.promise=t,this.type=e,this.handler=n,this.called=!1,this.cancelPromise=null}function h(t){this.finallyHandler=t}function f(t,e){return null!=t.cancelPromise&&(1<arguments.length?t.cancelPromise._reject(e):t.cancelPromise._cancel(),t.cancelPromise=null,1)}function _(){return v.call(this,this.promise._target()._settledValue())}function d(t){if(!f(this,t))return l.e=t,l}function v(t){var e=this.promise,n=this.handler;if(!this.called){this.called=!0;var r=this.isFinallyHandler()?n.call(e._boundValue()):n.call(e._boundValue(),t);if(r===o)return r;if(void 0!==r){e._setReturnedNonUndefined();n=i(r,e);if(n instanceof s){if(null!=this.cancelPromise){if(n._isCancelled()){r=new c("late cancellation observer");return e._attachExtraTrace(r),l.e=r,l}n.isPending()&&n._attachCancellationCallback(new h(this))}return n._then(_,d,void 0,this,void 0)}}}return e.isRejected()?(f(this),l.e=t,l):(f(this),t)}return p.prototype.isFinallyHandler=function(){return 0===this.type},h.prototype._resultCancelled=function(){f(this.finallyHandler)},s.prototype._passThrough=function(t,e,n,r){return"function"!=typeof t?this.then():this._then(n,r,void 0,new p(this,e,t),void 0)},s.prototype.lastly=s.prototype.finally=function(t){return this._passThrough(t,0,v,v)},s.prototype.tap=function(t){return this._passThrough(t,1,v)},s.prototype.tapCatch=function(t){var e=arguments.length;if(1===e)return this._passThrough(t,1,void 0,v);for(var n=new Array(e-1),r=0,i=0;i<e-1;++i){var o=arguments[i];if(!a.isObject(o))return s.reject(new TypeError("tapCatch statement predicate: expecting an object but got "+a.classString(o)));n[r++]=o}return n.length=r,this._passThrough(u(n,arguments[i],this),1,void 0,v)},p}},{"./catch_filter":7,"./util":36}],16:[function(r,t,e){"use strict";t.exports=function(s,n,a,c,t,l){var u=r("./errors").TypeError,e=r("./util"),p=e.errorObj,h=e.tryCatch,f=[];function _(t,e,n,r){var i,o;l.cancellation()?(i=new s(a),o=this._finallyPromise=new s(a),this._promise=i.lastly(function(){return o}),i._captureStackTrace(),i._setOnCancel(this)):(this._promise=new s(a))._captureStackTrace(),this._stack=r,this._generatorFunction=t,this._receiver=e,this._generator=void 0,this._yieldHandlers="function"==typeof n?[n].concat(f):f,this._yieldedPromise=null,this._cancellationPhase=!1}e.inherits(_,t),_.prototype._isResolved=function(){return null===this._promise},_.prototype._cleanup=function(){this._promise=this._generator=null,l.cancellation()&&null!==this._finallyPromise&&(this._finallyPromise._fulfill(),this._finallyPromise=null)},_.prototype._promiseCancelled=function(){var t;this._isResolved()||(t=void 0!==this._generator.return?(this._promise._pushContext(),h(this._generator.return).call(this._generator,void 0)):(t=new s.CancellationError("generator .return() sentinel"),s.coroutine.returnSentinel=t,this._promise._attachExtraTrace(t),this._promise._pushContext(),h(this._generator.throw).call(this._generator,t)),this._promise._popContext(),this._cancellationPhase=!0,this._yieldedPromise=null,this._continue(t))},_.prototype._promiseFulfilled=function(t){this._yieldedPromise=null,this._promise._pushContext();t=h(this._generator.next).call(this._generator,t);this._promise._popContext(),this._continue(t)},_.prototype._promiseRejected=function(t){this._yieldedPromise=null,this._promise._attachExtraTrace(t),this._promise._pushContext();t=h(this._generator.throw).call(this._generator,t);this._promise._popContext(),this._continue(t)},_.prototype._resultCancelled=function(){var t;this._yieldedPromise instanceof s&&(t=this._yieldedPromise,this._yieldedPromise=null,t.cancel())},_.prototype.promise=function(){return this._promise},_.prototype._run=function(){this._generator=this._generatorFunction.call(this._receiver),this._receiver=this._generatorFunction=void 0,this._promiseFulfilled(void 0)},_.prototype._continue=function(t){var e=this._promise;if(t===p)return this._cleanup(),this._cancellationPhase?e.cancel():e._rejectCallback(t.e,!1);var n=t.value;if(!0===t.done)return this._cleanup(),this._cancellationPhase?e.cancel():e._resolveCallback(n);t=c(n,this._promise);t instanceof s||null!==(t=function(t,e,n){for(var r=0;r<e.length;++r){n._pushContext();var i=h(e[r])(t);if(n._popContext(),i===p){n._pushContext();var o=s.reject(p.e);return n._popContext(),o}i=c(i,n);if(i instanceof s)return i}return null}(t,this._yieldHandlers,this._promise))?0==(50397184&(e=(t=t._target())._bitField))?(this._yieldedPromise=t)._proxy(this,null):0!=(33554432&e)?s._async.invoke(this._promiseFulfilled,this,t._value()):0!=(16777216&e)?s._async.invoke(this._promiseRejected,this,t._reason()):this._promiseCancelled():this._promiseRejected(new u("A value %s was yielded that could not be treated as a promise\n\n See http://goo.gl/MqrFmX\n\n".replace("%s",String(n))+"From coroutine:\n"+this._stack.split("\n").slice(1,-7).join("\n")))},s.coroutine=function(r,t){if("function"!=typeof r)throw new u("generatorFunction must be a function\n\n See http://goo.gl/MqrFmX\n");var i=Object(t).yieldHandler,o=_,s=(new Error).stack;return function(){var t=r.apply(this,arguments),e=new o(void 0,void 0,i,s),n=e.promise();return e._generator=t,e._promiseFulfilled(void 0),n}},s.coroutine.addYieldHandler=function(t){if("function"!=typeof t)throw new u("expecting a function but got "+e.classString(t));f.push(t)},s.spawn=function(t){if(l.deprecated("Promise.spawn()","Promise.coroutine()"),"function"!=typeof t)return n("generatorFunction must be a function\n\n See http://goo.gl/MqrFmX\n");var e=new _(t,this),t=e.promise();return e._run(s.spawn),t}}},{"./errors":12,"./util":36}],17:[function(a,t,e){"use strict";t.exports=function(t,n,e,r,i,o){var s=a("./util");s.canEvaluate,s.tryCatch,s.errorObj;t.join=function(){var t,e=arguments.length-1;0<e&&"function"==typeof arguments[e]&&(t=arguments[e]);var e=[].slice.call(arguments);t&&e.pop();e=new n(e).promise();return void 0!==t?e.spread(t):e}}},{"./util":36}],18:[function(e,t,n){"use strict";t.exports=function(l,t,o,u,i,p){var s=l._getDomain,a=e("./util"),h=a.tryCatch,f=a.errorObj,c=l._async;function _(t,e,n,r){this.constructor$(t),this._promise._captureStackTrace();t=s();this._callback=null===t?e:a.domainBind(t,e),this._preservedValues=r===i?new Array(this.length()):null,this._limit=n,this._inFlight=0,this._queue=[],c.invoke(this._asyncInit,this,void 0)}function n(t,e,n,r){if("function"!=typeof e)return o("expecting a function but got "+a.classString(e));var i=0;if(void 0!==n){if("object"!=typeof n||null===n)return l.reject(new TypeError("options argument must be an object but it is "+a.classString(n)));if("number"!=typeof n.concurrency)return l.reject(new TypeError("'concurrency' must be a number but it is "+a.classString(n.concurrency)));i=n.concurrency}return new _(t,e,i="number"==typeof i&&isFinite(i)&&1<=i?i:0,r).promise()}a.inherits(_,t),_.prototype._asyncInit=function(){this._init$(void 0,-2)},_.prototype._init=function(){},_.prototype._promiseFulfilled=function(t,e){var n=this._values,r=this.length(),i=this._preservedValues,o=this._limit;if(e<0){if(n[e=-1*e-1]=t,1<=o&&(this._inFlight--,this._drainQueue(),this._isResolved()))return!0}else{if(1<=o&&this._inFlight>=o)return n[e]=t,this._queue.push(e),!1;null!==i&&(i[e]=t);var s=this._promise,a=this._callback,c=s._boundValue();s._pushContext();c=h(a).call(c,t,e,r),t=s._popContext();if(p.checkForgottenReturns(c,t,null!==i?"Promise.filter":"Promise.map",s),c===f)return this._reject(c.e),!0;if((t=u(c,this._promise))instanceof l){s=(t=t._target())._bitField;if(0==(50397184&s))return 1<=o&&this._inFlight++,(n[e]=t)._proxy(this,-1*(e+1)),!1;if(0==(33554432&s))return 0!=(16777216&s)?this._reject(t._reason()):this._cancel(),!0;c=t._value()}n[e]=c}return r<=++this._totalResolved&&(null!==i?this._filter(n,i):this._resolve(n),!0)},_.prototype._drainQueue=function(){for(var t=this._queue,e=this._limit,n=this._values;0<t.length&&this._inFlight<e;){if(this._isResolved())return;var r=t.pop();this._promiseFulfilled(n[r],r)}},_.prototype._filter=function(t,e){for(var n=e.length,r=new Array(n),i=0,o=0;o<n;++o)t[o]&&(r[i++]=e[o]);r.length=i,this._resolve(r)},_.prototype.preservedValues=function(){return this._preservedValues},l.prototype.map=function(t,e){return n(this,t,e,null)},l.map=n}},{"./util":36}],19:[function(e,t,n){"use strict";t.exports=function(i,o,t,s,a){var c=e("./util"),l=c.tryCatch;i.method=function(r){if("function"!=typeof r)throw new i.TypeError("expecting a function but got "+c.classString(r));return function(){var t=new i(o);t._captureStackTrace(),t._pushContext();var e=l(r).apply(this,arguments),n=t._popContext();return a.checkForgottenReturns(e,n,"Promise.method",t),t._resolveFromSyncValue(e),t}},i.attempt=i.try=function(t){if("function"!=typeof t)return s("expecting a function but got "+c.classString(t));var e,n,r=new i(o);r._captureStackTrace(),r._pushContext(),n=1<arguments.length?(a.deprecated("calling Promise.try with more than 1 argument"),n=arguments[1],e=arguments[2],c.isArray(n)?l(t).apply(e,n):l(t).call(e,n)):l(t)();t=r._popContext();return a.checkForgottenReturns(n,t,"Promise.try",r),r._resolveFromSyncValue(n),r},i.prototype._resolveFromSyncValue=function(t){t===c.errorObj?this._rejectCallback(t.e,!1):this._resolveCallback(t,!0)}}},{"./util":36}],20:[function(t,e,n){"use strict";var s=t("./util"),o=s.maybeWrapAsError,a=t("./errors").OperationalError,c=t("./es5");var l=/^(?:name|message|stack|cause)$/;function u(t){var e,n;if((n=t)instanceof Error&&c.getPrototypeOf(n)===Error.prototype){(e=new a(t)).name=t.name,e.message=t.message,e.stack=t.stack;for(var r=c.keys(t),i=0;i<r.length;++i){var o=r[i];l.test(o)||(e[o]=t[o])}return e}return s.markAsOriginatingFromRejection(t),t}e.exports=function(r,i){return function(t,e){var n;null!==r&&(t?(n=u(o(t)),r._attachExtraTrace(n),r._reject(n)):i?(n=[].slice.call(arguments,1),r._fulfill(n)):r._fulfill(e),r=null)}}},{"./errors":12,"./es5":13,"./util":36}],21:[function(e,t,n){"use strict";t.exports=function(t){var n=e("./util"),r=t._async,i=n.tryCatch,o=n.errorObj;function s(t,e){if(!n.isArray(t))return a.call(this,t,e);t=i(e).apply(this._boundValue(),[null].concat(t));t===o&&r.throwLater(t.e)}function a(t,e){var n=this._boundValue(),t=void 0===t?i(e).call(n,null):i(e).call(n,null,t);t===o&&r.throwLater(t.e)}function c(t,e){var n;t||((n=new Error(t+"")).cause=t,t=n);t=i(e).call(this._boundValue(),t);t===o&&r.throwLater(t.e)}t.prototype.asCallback=t.prototype.nodeify=function(t,e){var n;return"function"==typeof t&&(n=a,void 0!==e&&Object(e).spread&&(n=s),this._then(n,c,void 0,this,t)),this}}},{"./util":36}],22:[function(x,P,t){"use strict";P.exports=function(){function s(){return new u("circular promise resolution chain\n\n See http://goo.gl/MqrFmX\n")}function a(){return new k.PromiseInspection(this._target())}function c(t){return k.reject(new u(t))}function l(){}var o={},p=x("./util"),h=p.isNode?function(){var t=process.domain;return t=void 0===t?null:t}:function(){return null};p.notEnumerableProp(k,"_getDomain",h);var t=x("./es5"),e=x("./async"),f=new e;t.defineProperty(k,"_async",{value:f});var n=x("./errors"),u=k.TypeError=n.TypeError;k.RangeError=n.RangeError;var _=k.CancellationError=n.CancellationError;k.TimeoutError=n.TimeoutError,k.OperationalError=n.OperationalError,k.RejectionError=n.OperationalError,k.AggregateError=n.AggregateError;var d=function(){},v={},y={},m=x("./thenables")(k,d),g=x("./promise_array")(k,d,m,c,l),t=x("./context")(k),n=t.create,b=x("./debuggability")(k,t),w=(b.CapturedTrace,x("./finally")(k,m,y)),C=x("./catch_filter")(y),r=x("./nodeback"),j=p.errorObj,E=p.tryCatch;function k(t){t!==d&&function(t,e){if(null==t||t.constructor!==k)throw new u("the promise constructor cannot be invoked directly\n\n See http://goo.gl/MqrFmX\n");if("function"!=typeof e)throw new u("expecting a function but got "+p.classString(e))}(this,t),this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,this._resolveFromExecutor(t),this._promiseCreated(),this._fireEvent("promiseCreated",this)}function i(t){this.promise._resolveCallback(t)}function F(t){this.promise._rejectCallback(t,!1)}function T(t){var e=new k(d);e._fulfillmentHandler0=t,e._rejectionHandler0=t,e._promise0=t,e._receiver0=t}return k.prototype.toString=function(){return"[object Promise]"},k.prototype.caught=k.prototype.catch=function(t){var e=arguments.length;if(1<e){for(var n=new Array(e-1),r=0,i=0;i<e-1;++i){var o=arguments[i];if(!p.isObject(o))return c("Catch statement predicate: expecting an object but got "+p.classString(o));n[r++]=o}return n.length=r,this.then(void 0,C(n,t=arguments[i],this))}return this.then(void 0,t)},k.prototype.reflect=function(){return this._then(a,a,void 0,this,void 0)},k.prototype.then=function(t,e){var n;return b.warnings()&&0<arguments.length&&"function"!=typeof t&&"function"!=typeof e&&(n=".then() only accepts functions but was passed: "+p.classString(t),1<arguments.length&&(n+=", "+p.classString(e)),this._warn(n)),this._then(t,e,void 0,void 0,void 0)},k.prototype.done=function(t,e){this._then(t,e,void 0,void 0,void 0)._setIsFinal()},k.prototype.spread=function(t){return"function"!=typeof t?c("expecting a function but got "+p.classString(t)):this.all()._then(t,void 0,void 0,v,void 0)},k.prototype.toJSON=function(){var t={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(t.fulfillmentValue=this.value(),t.isFulfilled=!0):this.isRejected()&&(t.rejectionReason=this.reason(),t.isRejected=!0),t},k.prototype.all=function(){return 0<arguments.length&&this._warn(".all() was passed arguments but it does not take any"),new g(this).promise()},k.prototype.error=function(t){return this.caught(p.originatesFromRejection,t)},k.getNewLibraryCopy=P.exports,k.is=function(t){return t instanceof k},k.fromNode=k.fromCallback=function(t){var e=new k(d);e._captureStackTrace();var n=1<arguments.length&&!!Object(arguments[1]).multiArgs,n=E(t)(r(e,n));return n===j&&e._rejectCallback(n.e,!0),e._isFateSealed()||e._setAsyncGuaranteed(),e},k.all=function(t){return new g(t).promise()},k.resolve=k.fulfilled=k.cast=function(t){var e=m(t);return e instanceof k||((e=new k(d))._captureStackTrace(),e._setFulfilled(),e._rejectionHandler0=t),e},k.reject=k.rejected=function(t){var e=new k(d);return e._captureStackTrace(),e._rejectCallback(t,!0),e},k.setScheduler=function(t){if("function"!=typeof t)throw new u("expecting a function but got "+p.classString(t));return f.setScheduler(t)},k.prototype._then=function(t,e,n,r,i){var o=void 0!==i,s=o?i:new k(d),a=this._target(),c=a._bitField;o||(s._propagateFrom(this,3),s._captureStackTrace(),void 0===r&&0!=(2097152&this._bitField)&&(r=0!=(50397184&c)?this._boundValue():a===this?void 0:this._boundTo),this._fireEvent("promiseChained",this,s));var l,u,i=h();return 0!=(50397184&c)?(o=a._settlePromiseCtx,0!=(33554432&c)?(u=a._rejectionHandler0,l=t):0!=(16777216&c)?(u=a._fulfillmentHandler0,l=e,a._unsetRejectionIsUnhandled()):(o=a._settlePromiseLateCancellationObserver,u=new _("late cancellation observer"),a._attachExtraTrace(u),l=e),f.invoke(o,a,{handler:null===i?l:"function"==typeof l&&p.domainBind(i,l),promise:s,receiver:r,value:u})):a._addCallbacks(t,e,s,r,i),s},k.prototype._length=function(){return 65535&this._bitField},k.prototype._isFateSealed=function(){return 0!=(117506048&this._bitField)},k.prototype._isFollowing=function(){return 67108864==(67108864&this._bitField)},k.prototype._setLength=function(t){this._bitField=-65536&this._bitField|65535&t},k.prototype._setFulfilled=function(){this._bitField=33554432|this._bitField,this._fireEvent("promiseFulfilled",this)},k.prototype._setRejected=function(){this._bitField=16777216|this._bitField,this._fireEvent("promiseRejected",this)},k.prototype._setFollowing=function(){this._bitField=67108864|this._bitField,this._fireEvent("promiseResolved",this)},k.prototype._setIsFinal=function(){this._bitField=4194304|this._bitField},k.prototype._isFinal=function(){return 0<(4194304&this._bitField)},k.prototype._unsetCancelled=function(){this._bitField=-65537&this._bitField},k.prototype._setCancelled=function(){this._bitField=65536|this._bitField,this._fireEvent("promiseCancelled",this)},k.prototype._setWillBeCancelled=function(){this._bitField=8388608|this._bitField},k.prototype._setAsyncGuaranteed=function(){f.hasCustomScheduler()||(this._bitField=134217728|this._bitField)},k.prototype._receiverAt=function(t){t=0===t?this._receiver0:this[4*t-4+3];if(t!==o)return void 0===t&&this._isBound()?this._boundValue():t},k.prototype._promiseAt=function(t){return this[4*t-4+2]},k.prototype._fulfillmentHandlerAt=function(t){return this[4*t-4]},k.prototype._rejectionHandlerAt=function(t){return this[4*t-4+1]},k.prototype._boundValue=function(){},k.prototype._migrateCallback0=function(t){t._bitField;var e=t._fulfillmentHandler0,n=t._rejectionHandler0,r=t._promise0,t=t._receiverAt(0);this._addCallbacks(e,n,r,t=void 0===t?o:t,null)},k.prototype._migrateCallbackAt=function(t,e){var n=t._fulfillmentHandlerAt(e),r=t._rejectionHandlerAt(e),i=t._promiseAt(e),e=t._receiverAt(e);this._addCallbacks(n,r,i,e=void 0===e?o:e,null)},k.prototype._addCallbacks=function(t,e,n,r,i){var o,s=this._length();return 65531<=s&&this._setLength(s=0),0===s?(this._promise0=n,this._receiver0=r,"function"==typeof t&&(this._fulfillmentHandler0=null===i?t:p.domainBind(i,t)),"function"==typeof e&&(this._rejectionHandler0=null===i?e:p.domainBind(i,e))):(this[2+(o=4*s-4)]=n,this[3+o]=r,"function"==typeof t&&(this[o]=null===i?t:p.domainBind(i,t)),"function"==typeof e&&(this[1+o]=null===i?e:p.domainBind(i,e))),this._setLength(s+1),s},k.prototype._proxy=function(t,e){this._addCallbacks(void 0,void 0,e,t,null)},k.prototype._resolveCallback=function(t,e){if(0==(117506048&this._bitField)){if(t===this)return this._rejectCallback(s(),!1);var n=m(t,this);if(!(n instanceof k))return this._fulfill(t);e&&this._propagateFrom(n,2);var r=n._target();if(r!==this){n=r._bitField;if(0==(50397184&n)){var i=this._length();0<i&&r._migrateCallback0(this);for(var o=1;o<i;++o)r._migrateCallbackAt(this,o);this._setFollowing(),this._setLength(0),this._setFollowee(r)}else 0!=(33554432&n)?this._fulfill(r._value()):0!=(16777216&n)?this._reject(r._reason()):(n=new _("late cancellation observer"),r._attachExtraTrace(n),this._reject(n))}else this._reject(s())}},k.prototype._rejectCallback=function(t,e,n){var r=p.ensureErrorObject(t),i=r===t;i||n||!b.warnings()||(n="a promise was rejected with a non-error: "+p.classString(t),this._warn(n,!0)),this._attachExtraTrace(r,!!e&&i),this._reject(t)},k.prototype._resolveFromExecutor=function(t){var e,n;t!==d&&((e=this)._captureStackTrace(),this._pushContext(),n=!0,t=this._execute(t,function(t){e._resolveCallback(t)},function(t){e._rejectCallback(t,n)}),n=!1,this._popContext(),void 0!==t&&e._rejectCallback(t,!0))},k.prototype._settlePromiseFromHandler=function(t,e,n,r){var i;0==(65536&r._bitField)&&(r._pushContext(),e===v?n&&"number"==typeof n.length?i=E(t).apply(this._boundValue(),n):(i=j).e=new u("cannot .spread() a non-array: "+p.classString(n)):i=E(t).call(e,n),e=r._popContext(),0==(65536&r._bitField)&&(i===y?r._reject(n):i===j?r._rejectCallback(i.e,!1):(b.checkForgottenReturns(i,e,"",r,this),r._resolveCallback(i))))},k.prototype._target=function(){for(var t=this;t._isFollowing();)t=t._followee();return t},k.prototype._followee=function(){return this._rejectionHandler0},k.prototype._setFollowee=function(t){this._rejectionHandler0=t},k.prototype._settlePromise=function(t,e,n,r){var i=t instanceof k,o=this._bitField,s=0!=(134217728&o);0!=(65536&o)?(i&&t._invokeInternalOnCancel(),n instanceof w&&n.isFinallyHandler()?(n.cancelPromise=t,E(e).call(n,r)===j&&t._reject(j.e)):e===a?t._fulfill(a.call(n)):n instanceof l?n._promiseCancelled(t):i||t instanceof g?t._cancel():n.cancel()):"function"==typeof e?i?(s&&t._setAsyncGuaranteed(),this._settlePromiseFromHandler(e,n,r,t)):e.call(n,r,t):n instanceof l?n._isResolved()||(0!=(33554432&o)?n._promiseFulfilled(r,t):n._promiseRejected(r,t)):i&&(s&&t._setAsyncGuaranteed(),0!=(33554432&o)?t._fulfill(r):t._reject(r))},k.prototype._settlePromiseLateCancellationObserver=function(t){var e=t.handler,n=t.promise,r=t.receiver,t=t.value;"function"==typeof e?n instanceof k?this._settlePromiseFromHandler(e,r,t,n):e.call(r,t,n):n instanceof k&&n._reject(t)},k.prototype._settlePromiseCtx=function(t){this._settlePromise(t.promise,t.handler,t.receiver,t.value)},k.prototype._settlePromise0=function(t,e,n){var r=this._promise0,i=this._receiverAt(0);this._promise0=void 0,this._receiver0=void 0,this._settlePromise(r,t,i,e)},k.prototype._clearCallbackDataAtIndex=function(t){t=4*t-4;this[2+t]=this[3+t]=this[t]=this[1+t]=void 0},k.prototype._fulfill=function(t){var e=this._bitField;if(!((117506048&e)>>>16)){if(t===this){var n=s();return this._attachExtraTrace(n),this._reject(n)}this._setFulfilled(),this._rejectionHandler0=t,0<(65535&e)&&(0!=(134217728&e)?this._settlePromises():f.settlePromises(this),this._dereferenceTrace())}},k.prototype._reject=function(t){var e=this._bitField;if(!((117506048&e)>>>16)){if(this._setRejected(),this._fulfillmentHandler0=t,this._isFinal())return f.fatalError(t,p.isNode);0<(65535&e)?f.settlePromises(this):this._ensurePossibleRejectionHandled()}},k.prototype._fulfillPromises=function(t,e){for(var n=1;n<t;n++){var r=this._fulfillmentHandlerAt(n),i=this._promiseAt(n),o=this._receiverAt(n);this._clearCallbackDataAtIndex(n),this._settlePromise(i,r,o,e)}},k.prototype._rejectPromises=function(t,e){for(var n=1;n<t;n++){var r=this._rejectionHandlerAt(n),i=this._promiseAt(n),o=this._receiverAt(n);this._clearCallbackDataAtIndex(n),this._settlePromise(i,r,o,e)}},k.prototype._settlePromises=function(){var t,e=this._bitField,n=65535&e;0<n&&(0!=(16842752&e)?(t=this._fulfillmentHandler0,this._settlePromise0(this._rejectionHandler0,t,e),this._rejectPromises(n,t)):(t=this._rejectionHandler0,this._settlePromise0(this._fulfillmentHandler0,t,e),this._fulfillPromises(n,t)),this._setLength(0)),this._clearCancellationData()},k.prototype._settledValue=function(){var t=this._bitField;return 0!=(33554432&t)?this._rejectionHandler0:0!=(16777216&t)?this._fulfillmentHandler0:void 0},k.defer=k.pending=function(){return b.deprecated("Promise.defer","new Promise"),{promise:new k(d),resolve:i,reject:F}},p.notEnumerableProp(k,"_makeSelfResolutionError",s),x("./method")(k,d,m,c,b),x("./bind")(k,d,m,b),x("./cancel")(k,g,c,b),x("./direct_resolve")(k),x("./synchronous_inspection")(k),x("./join")(k,g,m,d,f,h),(k.Promise=k).version="3.5.3",x("./map.js")(k,g,c,m,d,b),x("./call_get.js")(k),x("./using.js")(k,c,m,n,d,b),x("./timers.js")(k,d,b),x("./generators.js")(k,c,d,m,l,b),x("./nodeify.js")(k),x("./promisify.js")(k,d),x("./props.js")(k,g,m,c),x("./race.js")(k,d,m,c),x("./reduce.js")(k,g,c,m,d,b),x("./settle.js")(k,g,b),x("./some.js")(k,g,c),x("./filter.js")(k,d),x("./each.js")(k,d),x("./any.js")(k),p.toFastProperties(k),p.toFastProperties(k.prototype),T({a:1}),T({b:2}),T({c:3}),T(1),T(function(){}),T(void 0),T(!1),T(new k(d)),b.setBounds(e.firstLineError,p.lastLineError),k}},{"./any.js":1,"./async":2,"./bind":3,"./call_get.js":5,"./cancel":6,"./catch_filter":7,"./context":8,"./debuggability":9,"./direct_resolve":10,"./each.js":11,"./errors":12,"./es5":13,"./filter.js":14,"./finally":15,"./generators.js":16,"./join":17,"./map.js":18,"./method":19,"./nodeback":20,"./nodeify.js":21,"./promise_array":23,"./promisify.js":24,"./props.js":25,"./race.js":27,"./reduce.js":28,"./settle.js":30,"./some.js":31,"./synchronous_inspection":32,"./thenables":33,"./timers.js":34,"./using.js":35,"./util":36}],23:[function(r,t,e){"use strict";t.exports=function(a,n,c,o,t){var s=r("./util");s.isArray;function e(t){var e=this._promise=new a(n);t instanceof a&&e._propagateFrom(t,3),e._setOnCancel(this),this._values=t,this._length=0,this._totalResolved=0,this._init(void 0,-2)}return s.inherits(e,t),e.prototype.length=function(){return this._length},e.prototype.promise=function(){return this._promise},e.prototype._init=function t(e,n){if((r=c(this._values,this._promise))instanceof a){var r,i=(r=r._target())._bitField;if(this._values=r,0==(50397184&i))return this._promise._setAsyncGuaranteed(),r._then(t,this._reject,void 0,this,n);if(0==(33554432&i))return 0!=(16777216&i)?this._reject(r._reason()):this._cancel();r=r._value()}null!==(r=s.asArray(r))?0!==r.length?this._iterate(r):-5===n?this._resolveEmptyArray():this._resolve(function(t){switch(t){case-2:return[];case-3:return{};case-6:return new Map}}(n)):(r=o("expecting an array or an iterable object but got "+s.classString(r)).reason(),this._promise._rejectCallback(r,!1))},e.prototype._iterate=function(t){var e=this.getActualLength(t.length);this._length=e,this._values=this.shouldCopyValues()?new Array(e):this._values;for(var n=this._promise,r=!1,i=null,o=0;o<e;++o){var s=c(t[o],n),i=s instanceof a?(s=s._target())._bitField:null;r?null!==i&&s.suppressUnhandledRejections():null!==i?0==(50397184&i)?(s._proxy(this,o),this._values[o]=s):r=0!=(33554432&i)?this._promiseFulfilled(s._value(),o):0!=(16777216&i)?this._promiseRejected(s._reason(),o):this._promiseCancelled(o):r=this._promiseFulfilled(s,o)}r||n._setAsyncGuaranteed()},e.prototype._isResolved=function(){return null===this._values},e.prototype._resolve=function(t){this._values=null,this._promise._fulfill(t)},e.prototype._cancel=function(){!this._isResolved()&&this._promise._isCancellable()&&(this._values=null,this._promise._cancel())},e.prototype._reject=function(t){this._values=null,this._promise._rejectCallback(t,!1)},e.prototype._promiseFulfilled=function(t,e){return this._values[e]=t,++this._totalResolved>=this._length&&(this._resolve(this._values),!0)},e.prototype._promiseCancelled=function(){return this._cancel(),!0},e.prototype._promiseRejected=function(t){return this._totalResolved++,this._reject(t),!0},e.prototype._resultCancelled=function(){if(!this._isResolved()){var t=this._values;if(this._cancel(),t instanceof a)t.cancel();else for(var e=0;e<t.length;++e)t[e]instanceof a&&t[e].cancel()}},e.prototype.shouldCopyValues=function(){return!0},e.prototype.getActualLength=function(t){return t},e}},{"./util":36}],24:[function(r,t,e){"use strict";t.exports=function(l,u){var f={},_=r("./util"),p=r("./nodeback"),h=_.withAppended,d=_.maybeWrapAsError,t=_.canEvaluate,v=r("./errors").TypeError,y={__isPromisified__:!0},e=new RegExp("^(?:"+["arity","length","name","arguments","caller","callee","prototype","__isPromisified__"].join("|")+")$"),m=function(t){return _.isIdentifier(t)&&"_"!==t.charAt(0)&&"constructor"!==t};function i(t){return!e.test(t)}function g(t){try{return!0===t.__isPromisified__}catch(t){return!1}}function b(t,e,n,r){for(var i,o,s,a=_.inheritedDataKeys(t),c=[],l=0;l<a.length;++l){var u=a[l],p=t[u],h=r===m||m(u,p,t);"function"!=typeof p||g(p)||(i=t,o=u,s=e,(s=_.getDataPropertyOrDefault(i,o+s,y))&&g(s))||!r(u,p,t,h)||c.push(u,p)}return function(t,e,n){for(var r=0;r<t.length;r+=2){var i=t[r];if(n.test(i))for(var o=i.replace(n,""),s=0;s<t.length;s+=2)if(t[s]===o)throw new v("Cannot promisify an API that has normal methods with '%s'-suffix\n\n See http://goo.gl/MqrFmX\n".replace("%s",e))}}(c,e,n),c}var n,w=function(t){return t.replace(/([$])/,"\\$")};var C=t?n:function(i,o,t,e,n,s){var a=function(){return this}(),c=i;function r(){var t=o;o===f&&(t=this);var e=new l(u);e._captureStackTrace();var n="string"==typeof c&&this!==a?this[c]:i,r=p(e,s);try{n.apply(t,h(arguments,r))}catch(t){e._rejectCallback(d(t),!0,!0)}return e._isFateSealed()||e._setAsyncGuaranteed(),e}return"string"==typeof c&&(i=e),_.notEnumerableProp(r,"__isPromisified__",!0),r};function j(t,e,n,r,i){for(var o=new RegExp(w(e)+"$"),s=b(t,e,o,n),a=0,c=s.length;a<c;a+=2){var l,u=s[a],p=s[a+1],h=u+e;r===C?t[h]=C(u,f,u,p,e,i):(l=r(p,function(){return C(u,f,u,p,e,i)}),_.notEnumerableProp(l,"__isPromisified__",!0),t[h]=l)}return _.toFastProperties(t),t}l.promisify=function(t,e){if("function"!=typeof t)throw new v("expecting a function but got "+_.classString(t));if(g(t))return t;var n=void 0===(e=Object(e)).context?f:e.context,r=!!e.multiArgs,r=C(e=t,n,void 0,e,null,r);return _.copyDescriptors(t,r,i),r},l.promisifyAll=function(t,e){if("function"!=typeof t&&"object"!=typeof t)throw new v("the target of promisifyAll must be an object or a function\n\n See http://goo.gl/MqrFmX\n");var n=!!(e=Object(e)).multiArgs,r=e.suffix,i=e.filter;"function"!=typeof i&&(i=m);var o=e.promisifier;if("function"!=typeof o&&(o=C),!_.isIdentifier(r="string"!=typeof r?"Async":r))throw new RangeError("suffix must be a valid identifier\n\n See http://goo.gl/MqrFmX\n");for(var s=_.inheritedDataKeys(t),a=0;a<s.length;++a){var c=t[s[a]];"constructor"!==s[a]&&_.isClass(c)&&(j(c.prototype,r,i,o,n),j(c,r,i,o,n))}return j(t,r,i,o,n)}}},{"./errors":12,"./nodeback":20,"./util":36}],25:[function(_,t,e){"use strict";t.exports=function(n,t,r,i){var a,e=_("./util"),o=e.isObject,c=_("./es5");"function"==typeof Map&&(a=Map);var s,l,u=(l=0,function(t){s=t.size,l=0;var e=new Array(2*t.size);return t.forEach(p,e),e});function p(t,e){this[l]=t,this[l+s]=e,l++}function h(t){var e=!1;if(void 0!==a&&t instanceof a)i=u(t),e=!0;else for(var n=c.keys(t),r=n.length,i=new Array(2*r),o=0;o<r;++o){var s=n[o];i[o]=t[s],i[o+r]=s}this.constructor$(i),this._isMap=e,this._init$(void 0,e?-6:-3)}function f(t){var e=r(t);return o(e)?(t=e instanceof n?e._then(n.props,void 0,void 0,void 0,void 0):new h(e).promise(),e instanceof n&&t._propagateFrom(e,2),t):i("cannot await properties of a non-object\n\n See http://goo.gl/MqrFmX\n")}e.inherits(h,t),h.prototype._init=function(){},h.prototype._promiseFulfilled=function(t,e){if(this._values[e]=t,++this._totalResolved>=this._length){if(this._isMap)n=function(t){for(var e=new a,n=t.length/2|0,r=0;r<n;++r){var i=t[n+r],o=t[r];e.set(i,o)}return e}(this._values);else for(var n={},r=this.length(),i=0,o=this.length();i<o;++i)n[this._values[i+r]]=this._values[i];return this._resolve(n),!0}return!1},h.prototype.shouldCopyValues=function(){return!1},h.prototype.getActualLength=function(t){return t>>1},n.prototype.props=function(){return f(this)},n.props=f}},{"./es5":13,"./util":36}],26:[function(t,e,n){"use strict";function r(t){this._capacity=t,this._length=0,this._front=0}r.prototype._willBeOverCapacity=function(t){return this._capacity<t},r.prototype._pushOne=function(t){var e=this.length();this._checkCapacity(e+1),this[this._front+e&this._capacity-1]=t,this._length=e+1},r.prototype.push=function(t,e,n){var r=this.length()+3;if(this._willBeOverCapacity(r))return this._pushOne(t),this._pushOne(e),void this._pushOne(n);var i=this._front+r-3;this._checkCapacity(r);var o=this._capacity-1;this[i&o]=t,this[1+i&o]=e,this[2+i&o]=n,this._length=r},r.prototype.shift=function(){var t=this._front,e=this[t];return this[t]=void 0,this._front=t+1&this._capacity-1,this._length--,e},r.prototype.length=function(){return this._length},r.prototype._checkCapacity=function(t){this._capacity<t&&this._resizeTo(this._capacity<<1)},r.prototype._resizeTo=function(t){var e=this._capacity;this._capacity=t,function(t,e,n,r,i){for(var o=0;o<i;++o)n[o+r]=t[o+e],t[o+e]=void 0}(this,0,this,e,this._front+this._length&e-1)},e.exports=r},{}],27:[function(t,e,n){"use strict";e.exports=function(l,u,p,h){var f=t("./util"),_=function(e){return e.then(function(t){return n(t,e)})};function n(t,e){var n=p(t);if(n instanceof l)return _(n);if(null===(t=f.asArray(t)))return h("expecting an array or an iterable object but got "+f.classString(t));var r=new l(u);void 0!==e&&r._propagateFrom(e,3);for(var i=r._fulfill,o=r._reject,s=0,a=t.length;s<a;++s){var c=t[s];(void 0!==c||s in t)&&l.cast(c)._then(i,o,void 0,r,null)}return r}l.race=function(t){return n(t,void 0)},l.prototype.race=function(){return n(this,void 0)}}},{"./util":36}],28:[function(_,t,e){"use strict";t.exports=function(o,t,i,e,s,a){var c=o._getDomain,l=_("./util"),u=l.tryCatch;function p(t,e,n,r){this.constructor$(t);t=c();this._fn=null===t?e:l.domainBind(t,e),void 0!==n&&(n=o.resolve(n))._attachCancellationCallback(this),this._initialValue=n,this._currentCancellable=null,this._eachValues=r===s?Array(this._length):0===r?null:void 0,this._promise._captureStackTrace(),this._init$(void 0,-5)}function h(t,e){this.isFulfilled()?e._resolve(t):e._reject(t)}function n(t,e,n,r){return"function"!=typeof e?i("expecting a function but got "+l.classString(e)):new p(t,e,n,r).promise()}function f(t){this.accum=t,this.array._gotAccum(t);t=e(this.value,this.array._promise);return t instanceof o?(this.array._currentCancellable=t)._then(r,void 0,void 0,this,void 0):r.call(this,t)}function r(t){var e=this.array,n=e._promise,r=u(e._fn);n._pushContext(),(r=void 0!==e._eachValues?r.call(n._boundValue(),t,this.index,this.length):r.call(n._boundValue(),this.accum,t,this.index,this.length))instanceof o&&(e._currentCancellable=r);t=n._popContext();return a.checkForgottenReturns(r,t,void 0!==e._eachValues?"Promise.each":"Promise.reduce",n),r}l.inherits(p,t),p.prototype._gotAccum=function(t){void 0!==this._eachValues&&null!==this._eachValues&&t!==s&&this._eachValues.push(t)},p.prototype._eachComplete=function(t){return null!==this._eachValues&&this._eachValues.push(t),this._eachValues},p.prototype._init=function(){},p.prototype._resolveEmptyArray=function(){this._resolve(void 0!==this._eachValues?this._eachValues:this._initialValue)},p.prototype.shouldCopyValues=function(){return!1},p.prototype._resolve=function(t){this._promise._resolveCallback(t),this._values=null},p.prototype._resultCancelled=function(t){if(t===this._initialValue)return this._cancel();this._isResolved()||(this._resultCancelled$(),this._currentCancellable instanceof o&&this._currentCancellable.cancel(),this._initialValue instanceof o&&this._initialValue.cancel())},p.prototype._iterate=function(t){var e=(this._values=t).length,n=void 0!==this._initialValue?(i=this._initialValue,0):(i=o.resolve(t[0]),1);if(!(this._currentCancellable=i).isRejected())for(;n<e;++n)var r={accum:null,value:t[n],index:n,length:e,array:this},i=i._then(f,void 0,void 0,r,void 0);(i=void 0!==this._eachValues?i._then(this._eachComplete,void 0,void 0,this,void 0):i)._then(h,h,void 0,i,this)},o.prototype.reduce=function(t,e){return n(this,t,e,null)},o.reduce=n}},{"./util":36}],29:[function(t,e,n){"use strict";var r,i,o,s=t("./util"),t=s.getNativePromise();t=s.isNode&&"undefined"==typeof MutationObserver?(r=global.setImmediate,i=process.nextTick,s.isRecentNode?function(t){r.call(global,t)}:function(t){i.call(process,t)}):"function"==typeof t&&"function"==typeof t.resolve?(o=t.resolve(),function(t){o.then(t)}):"undefined"==typeof MutationObserver||"undefined"!=typeof window&&window.navigator&&(window.navigator.standalone||window.cordova)?"undefined"!=typeof setImmediate?function(t){setImmediate(t)}:"undefined"!=typeof setTimeout?function(t){setTimeout(t,0)}:function(){throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n")}:function(){var n=document.createElement("div"),r={attributes:!0},i=!1,o=document.createElement("div");new MutationObserver(function(){n.classList.toggle("foo"),i=!1}).observe(o,r);return function(t){var e=new MutationObserver(function(){e.disconnect(),t()});e.observe(n,r),i||(i=!0,o.classList.toggle("foo"))}}(),e.exports=t},{"./util":36}],30:[function(o,t,e){"use strict";t.exports=function(t,e,n){var r=t.PromiseInspection;function i(t){this.constructor$(t)}o("./util").inherits(i,e),i.prototype._promiseResolved=function(t,e){return this._values[t]=e,++this._totalResolved>=this._length&&(this._resolve(this._values),!0)},i.prototype._promiseFulfilled=function(t,e){var n=new r;return n._bitField=33554432,n._settledValueField=t,this._promiseResolved(e,n)},i.prototype._promiseRejected=function(t,e){var n=new r;return n._bitField=16777216,n._settledValueField=t,this._promiseResolved(e,n)},t.settle=function(t){return n.deprecated(".settle()",".reflect()"),new i(t).promise()},t.prototype.settle=function(){return t.settle(this)}}},{"./util":36}],31:[function(u,t,e){"use strict";t.exports=function(t,e,r){var n=u("./util"),i=u("./errors").RangeError,o=u("./errors").AggregateError,s=n.isArray,a={};function c(t){this.constructor$(t),this._howMany=0,this._unwrap=!1,this._initialized=!1}function l(t,e){if((0|e)!==e||e<0)return r("expecting a positive integer\n\n See http://goo.gl/MqrFmX\n");var n=new c(t),t=n.promise();return n.setHowMany(e),n.init(),t}n.inherits(c,e),c.prototype._init=function(){var t;this._initialized&&(0!==this._howMany?(this._init$(void 0,-5),t=s(this._values),!this._isResolved()&&t&&this._howMany>this._canPossiblyFulfill()&&this._reject(this._getRangeError(this.length()))):this._resolve([]))},c.prototype.init=function(){this._initialized=!0,this._init()},c.prototype.setUnwrap=function(){this._unwrap=!0},c.prototype.howMany=function(){return this._howMany},c.prototype.setHowMany=function(t){this._howMany=t},c.prototype._promiseFulfilled=function(t){return this._addFulfilled(t),this._fulfilled()===this.howMany()&&(this._values.length=this.howMany(),1===this.howMany()&&this._unwrap?this._resolve(this._values[0]):this._resolve(this._values),!0)},c.prototype._promiseRejected=function(t){return this._addRejected(t),this._checkOutcome()},c.prototype._promiseCancelled=function(){return this._values instanceof t||null==this._values?this._cancel():(this._addRejected(a),this._checkOutcome())},c.prototype._checkOutcome=function(){if(this.howMany()>this._canPossiblyFulfill()){for(var t=new o,e=this.length();e<this._values.length;++e)this._values[e]!==a&&t.push(this._values[e]);return 0<t.length?this._reject(t):this._cancel(),!0}return!1},c.prototype._fulfilled=function(){return this._totalResolved},c.prototype._rejected=function(){return this._values.length-this.length()},c.prototype._addRejected=function(t){this._values.push(t)},c.prototype._addFulfilled=function(t){this._values[this._totalResolved++]=t},c.prototype._canPossiblyFulfill=function(){return this.length()-this._rejected()},c.prototype._getRangeError=function(t){t="Input array must contain at least "+this._howMany+" items but contains only "+t+" items";return new i(t)},c.prototype._resolveEmptyArray=function(){this._reject(this._getRangeError(0))},t.some=l,t.prototype.some=function(t){return l(this,t)},t._SomePromiseArray=c}},{"./errors":12,"./util":36}],32:[function(t,e,n){"use strict";e.exports=function(t){function e(t){void 0!==t?(t=t._target(),this._bitField=t._bitField,this._settledValueField=t._isFateSealed()?t._settledValue():void 0):(this._bitField=0,this._settledValueField=void 0)}e.prototype._settledValue=function(){return this._settledValueField};var n=e.prototype.value=function(){if(!this.isFulfilled())throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},r=e.prototype.error=e.prototype.reason=function(){if(!this.isRejected())throw new TypeError("cannot get rejection reason of a non-rejected promise\n\n See http://goo.gl/MqrFmX\n");return this._settledValue()},i=e.prototype.isFulfilled=function(){return 0!=(33554432&this._bitField)},o=e.prototype.isRejected=function(){return 0!=(16777216&this._bitField)},s=e.prototype.isPending=function(){return 0==(50397184&this._bitField)},a=e.prototype.isResolved=function(){return 0!=(50331648&this._bitField)};e.prototype.isCancelled=function(){return 0!=(8454144&this._bitField)},t.prototype.__isCancelled=function(){return 65536==(65536&this._bitField)},t.prototype._isCancelled=function(){return this._target().__isCancelled()},t.prototype.isCancelled=function(){return 0!=(8454144&this._target()._bitField)},t.prototype.isPending=function(){return s.call(this._target())},t.prototype.isRejected=function(){return o.call(this._target())},t.prototype.isFulfilled=function(){return i.call(this._target())},t.prototype.isResolved=function(){return a.call(this._target())},t.prototype.value=function(){return n.call(this._target())},t.prototype.reason=function(){var t=this._target();return t._unsetRejectionIsUnhandled(),r.call(t)},t.prototype._value=function(){return this._settledValue()},t.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue()},t.PromiseInspection=e}},{}],33:[function(t,e,n){"use strict";e.exports=function(s,a){var c=t("./util"),l=c.errorObj,i=c.isObject;var o={}.hasOwnProperty;return function(t,e){if(i(t)){if(t instanceof s)return t;var n=function(t){try{return t.then}catch(t){return l.e=t,l}}(t);if(n===l){e&&e._pushContext();var r=s.reject(n.e);return e&&e._popContext(),r}if("function"==typeof n){if(function(t){try{return o.call(t,"_promise0")}catch(t){return!1}}(t)){r=new s(a);return t._then(r._fulfill,r._reject,void 0,r,null),r}return function(t,e,n){var r=new s(a),i=r;n&&n._pushContext();r._captureStackTrace(),n&&n._popContext();var o=!0,t=c.tryCatch(e).call(t,function(t){r&&(r._resolveCallback(t),r=null)},function(t){r&&(r._rejectCallback(t,o,!0),r=null)});o=!1,r&&t===l&&(r._rejectCallback(t.e,!0,!0),r=null);return i}(t,n,e)}}return t}}},{"./util":36}],34:[function(t,e,n){"use strict";e.exports=function(r,i,o){var s=t("./util"),a=r.TimeoutError;function c(t){this.handle=t}c.prototype._resultCancelled=function(){clearTimeout(this.handle)};function l(t){return e(+this).thenReturn(t)}var e=r.delay=function(t,e){var n;return void 0!==e?(n=r.resolve(e)._then(l,null,null,t,void 0),o.cancellation()&&e instanceof r&&n._setOnCancel(e)):(n=new r(i),t=setTimeout(function(){n._fulfill()},+t),o.cancellation()&&n._setOnCancel(new c(t)),n._captureStackTrace()),n._setAsyncGuaranteed(),n};r.prototype.delay=function(t){return e(t,this)};function u(t){return clearTimeout(this.handle),t}function p(t){throw clearTimeout(this.handle),t}r.prototype.timeout=function(t,e){var n,r;t=+t;t=new c(setTimeout(function(){n.isPending()&&function(t,e,n){e="string"!=typeof e?e instanceof Error?e:new a("operation timed out"):new a(e);s.markAsOriginatingFromRejection(e),t._attachExtraTrace(e),t._reject(e),null!=n&&n.cancel()}(n,e,r)},t));return o.cancellation()?(r=this.then(),(n=r._then(u,p,void 0,t,void 0))._setOnCancel(t)):n=this._then(u,p,void 0,t,void 0),n}}},{"./util":36}],35:[function(s,t,e){"use strict";t.exports=function(p,h,f,e,t,_){var d=s("./util"),n=s("./errors").TypeError,r=s("./util").inherits,v=d.errorObj,y=d.tryCatch,i={};function c(t){setTimeout(function(){throw t},0)}function m(r,i){var o=0,s=r.length,a=new p(t);return function t(){if(s<=o)return a._fulfill();var e,n=(e=r[o++],(n=f(e))!==e&&"function"==typeof e._isDisposable&&"function"==typeof e._getDisposer&&e._isDisposable()&&n._setDisposable(e._getDisposer()),n);if(n instanceof p&&n._isDisposable()){try{n=f(n._getDisposer().tryDispose(i),r.promise)}catch(t){return c(t)}if(n instanceof p)return n._then(t,c,null,null,null)}t()}(),a}function g(t,e,n){this._data=t,this._promise=e,this._context=n}function o(t,e,n){this.constructor$(t,e,n)}function b(t){return g.isDisposer(t)?(this.resources[this.index]._setDisposable(t),t.promise()):t}function w(t){this.length=t,this.promise=null,this[t-1]=null}g.prototype.data=function(){return this._data},g.prototype.promise=function(){return this._promise},g.prototype.resource=function(){return this.promise().isFulfilled()?this.promise().value():i},g.prototype.tryDispose=function(t){var e=this.resource(),n=this._context;void 0!==n&&n._pushContext();t=e!==i?this.doDispose(e,t):null;return void 0!==n&&n._popContext(),this._promise._unsetDisposable(),this._data=null,t},g.isDisposer=function(t){return null!=t&&"function"==typeof t.resource&&"function"==typeof t.tryDispose},r(o,g),o.prototype.doDispose=function(t,e){return this.data().call(t,t,e)},w.prototype._resultCancelled=function(){for(var t=this.length,e=0;e<t;++e){var n=this[e];n instanceof p&&n.cancel()}},p.using=function(){var t=arguments.length;if(t<2)return h("you must pass at least 2 arguments to Promise.using");var e,o=arguments[t-1];if("function"!=typeof o)return h("expecting a function but got "+d.classString(o));var s=!0;2===t&&Array.isArray(arguments[0])?(t=(e=arguments[0]).length,s=!1):(e=arguments,t--);for(var n=new w(t),r=0;r<t;++r){var i,a=e[r];g.isDisposer(a)?(a=(i=a).promise())._setDisposable(i):(i=f(a))instanceof p&&(a=i._then(b,null,null,{resources:n,index:r},void 0)),n[r]=a}for(var c=new Array(n.length),r=0;r<c.length;++r)c[r]=p.resolve(n[r]).reflect();var l=p.all(c).then(function(t){for(var e=0;e<t.length;++e){var n=t[e];if(n.isRejected())return v.e=n.error(),v;if(!n.isFulfilled())return void l.cancel();t[e]=n.value()}u._pushContext(),o=y(o);var r=s?o.apply(void 0,t):o(t),i=u._popContext();return _.checkForgottenReturns(r,i,"Promise.using",u),r}),u=l.lastly(function(){var t=new p.PromiseInspection(l);return m(n,t)});return(n.promise=u)._setOnCancel(n),u},p.prototype._setDisposable=function(t){this._bitField=131072|this._bitField,this._disposer=t},p.prototype._isDisposable=function(){return 0<(131072&this._bitField)},p.prototype._getDisposer=function(){return this._disposer},p.prototype._unsetDisposable=function(){this._bitField=-131073&this._bitField,this._disposer=void 0},p.prototype.disposer=function(t){if("function"==typeof t)return new o(t,this,e());throw new n}}},{"./errors":12,"./util":36}],36:[function(t,e,n){"use strict";var l=t("./es5"),r="undefined"==typeof navigator,i={e:{}},o,s="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:void 0!==this?this:null;function a(){try{var t=o;return o=null,t.apply(this,arguments)}catch(t){return i.e=t,i}}function c(t){return o=t,a}var u=function(e,n){var r={}.hasOwnProperty;function t(){for(var t in this.constructor=e,(this.constructor$=n).prototype)r.call(n.prototype,t)&&"$"!==t.charAt(t.length-1)&&(this[t+"$"]=n.prototype[t])}return t.prototype=n.prototype,e.prototype=new t,e.prototype};function p(t){return null==t||!0===t||!1===t||"string"==typeof t||"number"==typeof t}function h(t){return"function"==typeof t||"object"==typeof t&&null!==t}function f(t){return p(t)?new Error(k(t)):t}function _(t,e){for(var n=t.length,r=new Array(n+1),i=0;i<n;++i)r[i]=t[i];return r[i]=e,r}function d(t,e,n){if(!l.isES5)return{}.hasOwnProperty.call(t,e)?t[e]:void 0;e=Object.getOwnPropertyDescriptor(t,e);return null!=e?null==e.get&&null==e.set?e.value:n:void 0}function v(t,e,n){return p(t)||l.defineProperty(t,e,{value:n,configurable:!0,enumerable:!1,writable:!0}),t}function y(t){throw t}var m=function(){function a(t){for(var e=0;e<i.length;++e)if(i[e]===t)return 1}var i=[Array.prototype,Object.prototype,Function.prototype];if(l.isES5){var c=Object.getOwnPropertyNames;return function(t){for(var e,n=[],r=Object.create(null);null!=t&&!a(t);){try{e=c(t)}catch(t){return n}for(var i=0;i<e.length;++i){var o,s=e[i];r[s]||(r[s]=!0,null!=(o=Object.getOwnPropertyDescriptor(t,s))&&null==o.get&&null==o.set&&n.push(s))}t=l.getPrototypeOf(t)}return n}}var o={}.hasOwnProperty;return function(t){if(a(t))return[];var e=[];t:for(var n in t)if(o.call(t,n))e.push(n);else{for(var r=0;r<i.length;++r)if(o.call(i[r],n))continue t;e.push(n)}return e}}(),g=/this\s*\.\s*\S+\s*=/;function b(t){try{if("function"==typeof t){var e=l.names(t.prototype),n=l.isES5&&1<e.length,r=0<e.length&&!(1===e.length&&"constructor"===e[0]),i=g.test(t+"")&&0<l.names(t).length;if(n||r||i)return!0}return!1}catch(t){return!1}}function w(t){function e(){}e.prototype=t;var n=new e;function r(){return n.foo,1}return r(),r(),t}var C=/^[a-z$_][a-z$_0-9]*$/i;function j(t){return C.test(t)}function E(t,e,n){for(var r=new Array(t),i=0;i<t;++i)r[i]=e+i+n;return r}function k(t){try{return t+""}catch(t){return"[no string representation]"}}function F(t){return t instanceof Error||null!==t&&"object"==typeof t&&"string"==typeof t.message&&"string"==typeof t.name}function T(t){try{v(t,"isOperational",!0)}catch(t){}}function x(t){return null!=t&&(t instanceof Error.__BluebirdErrorTypes__.OperationalError||!0===t.isOperational)}function P(t){return F(t)&&l.propertyIsWritable(t,"stack")}var R="stack"in new Error?function(t){return P(t)?t:new Error(k(t))}:function(t){if(P(t))return t;try{throw new Error(k(t))}catch(t){return t}};function S(t){return{}.toString.call(t)}function O(t,e,n){for(var r=l.names(t),i=0;i<r.length;++i){var o=r[i];if(n(o))try{l.defineProperty(e,o,l.getDescriptor(t,o))}catch(t){}}}var A=function(t){return l.isArray(t)?t:null},D,A;"undefined"!=typeof Symbol&&Symbol.iterator&&(D="function"==typeof Array.from?function(t){return Array.from(t)}:function(t){for(var e,n=[],r=t[Symbol.iterator]();!(e=r.next()).done;)n.push(e.value);return n},A=function(t){return l.isArray(t)?t:null!=t&&"function"==typeof t[Symbol.iterator]?D(t):null});var V="undefined"!=typeof process&&"[object process]"===S(process).toLowerCase(),I="undefined"!=typeof process&&void 0!==process.env;function L(t){return I?process.env[t]:void 0}function H(){if("function"==typeof Promise)try{var t=new Promise(function(){});if("[object Promise]"==={}.toString.call(t))return Promise}catch(t){}}function N(t,e){return t.bind(e)}var U={isClass:b,isIdentifier:j,inheritedDataKeys:m,getDataPropertyOrDefault:d,thrower:y,isArray:l.isArray,asArray:A,notEnumerableProp:v,isPrimitive:p,isObject:h,isError:F,canEvaluate:r,errorObj:i,tryCatch:c,inherits:u,withAppended:_,maybeWrapAsError:f,toFastProperties:w,filledRange:E,toString:k,canAttachTrace:P,ensureErrorObject:R,originatesFromRejection:x,markAsOriginatingFromRejection:T,classString:S,copyDescriptors:O,hasDevTools:"undefined"!=typeof chrome&&chrome&&"function"==typeof chrome.loadTimes,isNode:V,hasEnvVariables:I,env:L,global:s,getNativePromise:H,domainBind:N},B;U.isRecentNode=U.isNode&&(B=process.versions.node.split(".").map(Number),0===B[0]&&10<B[1]||0<B[0]),U.isNode&&U.toFastProperties(process);try{throw new Error}catch(t){U.lastLineError=t}e.exports=U},{"./es5":13}]},{},[4])(4)}),"undefined"!=typeof window&&null!==window?window.P=window.Promise:"undefined"!=typeof self&&null!==self&&(self.P=self.Promise);
|
|
assets/js/divi_woo_layout_injector.js
DELETED
@@ -1,326 +0,0 @@
|
|
1 |
-
// SCRIPT Woo Layout Injector version: 4.5, script.js
|
2 |
-
|
3 |
-
jQuery(document).ready(function () {
|
4 |
-
|
5 |
-
if (jQuery('.single-product .sb_woo_product_image').length) {
|
6 |
-
if (!jQuery('.single-product .sb_woo_product_image').hasClass('sb_woo_image_disable_zoom')) {
|
7 |
-
jQuery('.single-product .sb_woo_product_image').zoom({
|
8 |
-
callback: function callback() {
|
9 |
-
if (!jQuery('.single-product .sb_woo_product_image').hasClass('sb_woo_image_disable_lightbox')) {
|
10 |
-
jQuery(this).colorbox({
|
11 |
-
href: jQuery('.single-product .sb_woo_product_image img').attr('src')
|
12 |
-
});
|
13 |
-
}
|
14 |
-
}
|
15 |
-
});
|
16 |
-
} else {
|
17 |
-
if (!jQuery('.single-product .sb_woo_product_image').hasClass('sb_woo_image_disable_lightbox')) {
|
18 |
-
jQuery('.sb_woo_product_image').colorbox({
|
19 |
-
href: jQuery('.single-product .sb_woo_product_image img').attr('src')
|
20 |
-
});
|
21 |
-
}
|
22 |
-
}
|
23 |
-
}
|
24 |
-
|
25 |
-
if (jQuery('.single-product .cart.variations_form')) {
|
26 |
-
////////////////////////////////////////////////
|
27 |
-
jQuery('.single-product .cart.variations_form .variations .value select').each(function (index, attr) {
|
28 |
-
jQuery(this).change(function () {
|
29 |
-
sb_woo_variation_image();
|
30 |
-
});
|
31 |
-
});
|
32 |
-
////////////////////////////////////////////////
|
33 |
-
}
|
34 |
-
|
35 |
-
if (jQuery('.woocommerce-remove-coupon').length) {
|
36 |
-
jQuery('.et_pb_woo_checkout_coupon').slideUp();
|
37 |
-
}
|
38 |
-
|
39 |
-
//to handle removing items from the cart with a blank response. Note to edit this if no empty cart layout specified
|
40 |
-
jQuery(document.body).on('wc_fragments_refreshed', function () {
|
41 |
-
//if (jQuery('body.woocommerce-cart').length && (!jQuery('.woocommerce-cart-form').length && !jQuery('.sb_et_woo_li_cart_empty').length)) {
|
42 |
-
//console.log('Woo Injector Refreshing Cart');
|
43 |
-
//location.reload(); //refresh the page
|
44 |
-
//}
|
45 |
-
});
|
46 |
-
|
47 |
-
if (jQuery('body').hasClass('wli_injected')) {
|
48 |
-
|
49 |
-
if (jQuery('.wpcf7').length > 0) {
|
50 |
-
var wli_post_id,
|
51 |
-
matches = document.body.className.match(/(^|\s)postid-(\d+)(\s|$)/);
|
52 |
-
if (matches) {
|
53 |
-
jQuery("input[name='_wpcf7_container_post']").val(matches[2]);
|
54 |
-
jQuery(".wpcf7-submit").addClass('button');
|
55 |
-
jQuery(".wpcf7-form > p").addClass('form-row');
|
56 |
-
jQuery(".wpcf7-form > p .wpcf7-form-control-wrap input").addClass('input-text');
|
57 |
-
}
|
58 |
-
}
|
59 |
-
|
60 |
-
//to add class of button to thr add to cart ajax function for consistency
|
61 |
-
jQuery(document.body).on('added_to_cart', function () {
|
62 |
-
setTimeout(function () {
|
63 |
-
jQuery('.added_to_cart').addClass('button');
|
64 |
-
}, 50);
|
65 |
-
});
|
66 |
-
|
67 |
-
//to recalculate the product count in cart
|
68 |
-
jQuery(document.body).on('wc_fragments_loaded', function () {
|
69 |
-
wli_refresh_cart_count();
|
70 |
-
});
|
71 |
-
|
72 |
-
//to recalculate the product count in cart
|
73 |
-
jQuery(document.body).on('wc_fragments_refreshed', function () {
|
74 |
-
wli_refresh_cart_count();
|
75 |
-
});
|
76 |
-
|
77 |
-
//to handle showing the coupon system in a lightbox
|
78 |
-
jQuery(document.body).on("checkout_error", function () {
|
79 |
-
|
80 |
-
if (jQuery('.woocommerce-NoticeGroup').length) {
|
81 |
-
sb_woo_popup_notice(jQuery('.woocommerce-NoticeGroup').html());
|
82 |
-
setTimeout(function () {
|
83 |
-
jQuery('.woocommerce-NoticeGroup').remove();
|
84 |
-
}, 250);
|
85 |
-
}
|
86 |
-
});
|
87 |
-
|
88 |
-
//to handle showing the coupon system in a lightbox
|
89 |
-
jQuery(document.body).on("updated_wc_div", function () {
|
90 |
-
|
91 |
-
if (jQuery('.woocommerce .woocommerce-error').length) {
|
92 |
-
sb_woo_popup_notice(jQuery('.woocommerce .woocommerce-error'));
|
93 |
-
jQuery('.entry-content .woocommerce .woocommerce-error').remove();
|
94 |
-
}
|
95 |
-
if (jQuery('.woocommerce .woocommerce-message').length) {
|
96 |
-
sb_woo_popup_notice(jQuery('.woocommerce .woocommerce-message').clone().wrap("<div />"));
|
97 |
-
jQuery('.entry-content .woocommerce .woocommerce-message').remove();
|
98 |
-
}
|
99 |
-
if (jQuery('.cart-empty').length > 0) {
|
100 |
-
jQuery('.et_pb_woo_cart_totals').remove();
|
101 |
-
}
|
102 |
-
});
|
103 |
-
|
104 |
-
//to handle showing the coupon system in a lightbox
|
105 |
-
jQuery(document.body).on("applied_coupon", function () {
|
106 |
-
|
107 |
-
if (jQuery('.woocommerce .woocommerce-error').length) {
|
108 |
-
sb_woo_popup_notice(jQuery('.woocommerce .woocommerce-error'));
|
109 |
-
jQuery('.entry-content .woocommerce .woocommerce-error').remove();
|
110 |
-
}
|
111 |
-
});
|
112 |
-
|
113 |
-
//to handle showing the coupon removed in a lightbox
|
114 |
-
jQuery(document.body).on("removed_coupon", function () {
|
115 |
-
|
116 |
-
if (jQuery('.woocommerce .woocommerce-message').length) {
|
117 |
-
sb_woo_popup_notice(jQuery('.woocommerce .woocommerce-message').clone().wrap("<div />"));
|
118 |
-
jQuery('.entry-content .woocommerce .woocommerce-message').remove();
|
119 |
-
}
|
120 |
-
});
|
121 |
-
|
122 |
-
//to handle showing the coupon system in a lightbox
|
123 |
-
jQuery(document.body).on("update_checkout", function () {
|
124 |
-
|
125 |
-
if (jQuery('.wli_wrapper_checkout-form-coupon .woocommerce-error').length) {
|
126 |
-
sb_woo_popup_notice(jQuery('.wli_wrapper_checkout-form-coupon .woocommerce-error').clone().wrap("<div />"));
|
127 |
-
jQuery('.et_pb_woo_checkout_coupon').slideDown();
|
128 |
-
} else if (jQuery('.wli_wrapper_checkout-form-coupon .woocommerce-message').length) {
|
129 |
-
sb_woo_popup_notice(jQuery('.wli_wrapper_checkout-form-coupon .woocommerce-message').clone().wrap("<div />"));
|
130 |
-
jQuery('.coupon-module').val('');
|
131 |
-
|
132 |
-
if (jQuery('.woocommerce-remove-coupon').length) {
|
133 |
-
jQuery('.et_pb_woo_checkout_coupon').slideDown();
|
134 |
-
} else {
|
135 |
-
jQuery('.et_pb_woo_checkout_coupon').slideUp();
|
136 |
-
}
|
137 |
-
} else if (jQuery('.woocommerce .woocommerce-message').length) {
|
138 |
-
sb_woo_popup_notice(jQuery('.woocommerce .woocommerce-message').clone().wrap("<div />"));
|
139 |
-
setTimeout(function () {
|
140 |
-
jQuery('.entry-content > .woocommerce > .woocommerce-message').remove();
|
141 |
-
}, 250);
|
142 |
-
}
|
143 |
-
});
|
144 |
-
}
|
145 |
-
});
|
146 |
-
|
147 |
-
function wli_refresh_cart_count() {
|
148 |
-
var wli_new_count = 0;
|
149 |
-
|
150 |
-
if (jQuery('.sb_woo_mini_cart ul li').length) {
|
151 |
-
jQuery('.sb_woo_mini_cart ul li').each(function () {
|
152 |
-
var wli_quantity = jQuery(this).children('.quantity').text();
|
153 |
-
var wli_quantity_nums = wli_quantity.split(' ');
|
154 |
-
var wli_quantity_num = parseInt(wli_quantity_nums[0]);
|
155 |
-
|
156 |
-
wli_new_count += wli_quantity_num;
|
157 |
-
});
|
158 |
-
}
|
159 |
-
|
160 |
-
if (wli_new_count <= 0) {
|
161 |
-
wli_new_count = '';
|
162 |
-
}
|
163 |
-
|
164 |
-
jQuery('.sb_woo_prod_cart_container .et-cart-info span').text(wli_new_count);
|
165 |
-
}
|
166 |
-
|
167 |
-
function sb_woo_popup_notice(popup_object) {
|
168 |
-
jQuery('html, body').scrollTop(0);
|
169 |
-
|
170 |
-
jQuery.colorbox({
|
171 |
-
html: popup_object,
|
172 |
-
width: "50%",
|
173 |
-
className: "woocommerce"
|
174 |
-
});
|
175 |
-
}
|
176 |
-
|
177 |
-
function sb_woo_maybe_submit_checkout_coupon() {
|
178 |
-
jQuery(this).keypress(function (e) {
|
179 |
-
if (e.which == 13) {
|
180 |
-
sb_woo_submit_checkout_coupon();
|
181 |
-
}
|
182 |
-
});
|
183 |
-
}
|
184 |
-
|
185 |
-
function sb_woo_submit_checkout_coupon() {
|
186 |
-
if (jQuery('.coupon-module').length) {
|
187 |
-
jQuery('.coupon-module').parent().removeClass('woocommerce-invalid').removeClass('woocommerce-validated');
|
188 |
-
|
189 |
-
var coupon = jQuery('.coupon-module').val();
|
190 |
-
|
191 |
-
if (coupon != '') {
|
192 |
-
jQuery('#coupon_code').val(coupon);
|
193 |
-
jQuery('.checkout_coupon').submit();
|
194 |
-
} else {
|
195 |
-
jQuery('.coupon-module').parent().addClass('woocommerce-invalid').removeClass('woocommerce-validated');
|
196 |
-
}
|
197 |
-
}
|
198 |
-
|
199 |
-
return false;
|
200 |
-
}
|
201 |
-
|
202 |
-
function sb_woo_variation_image() {
|
203 |
-
//get variation data and store in sb_woo_attr_data
|
204 |
-
var sb_woo_attr_data = jQuery('.single-product .cart.variations_form').data('product_variations');
|
205 |
-
var sb_woo_attr_val = '';
|
206 |
-
var sb_woo_attr_id = '';
|
207 |
-
var sb_woo_attr_name = '';
|
208 |
-
var sb_woo_attr_set = [];
|
209 |
-
var sb_woo_attr_set_l = 0;
|
210 |
-
var sb_woo_attr_set_matched = 0;
|
211 |
-
var sb_woo_found_set = [];
|
212 |
-
var sb_woo_large_image = '';
|
213 |
-
|
214 |
-
////////////////////////////////////////////////////
|
215 |
-
|
216 |
-
//cache current variation choices in "sb_woo_attr_set"
|
217 |
-
jQuery('.single-product .cart.variations_form .variations .value select').each(function (index2, attr2) {
|
218 |
-
sb_woo_attr_val = jQuery(this).val();
|
219 |
-
sb_woo_attr_id = jQuery(this).attr('id');
|
220 |
-
sb_woo_attr_name = 'attribute_' + sb_woo_attr_id;
|
221 |
-
|
222 |
-
if (sb_woo_attr_val) {
|
223 |
-
sb_woo_attr_set.push([sb_woo_attr_name, sb_woo_attr_val]);
|
224 |
-
sb_woo_attr_set_l++;
|
225 |
-
}
|
226 |
-
});
|
227 |
-
|
228 |
-
////////////////////////////////////////////////////
|
229 |
-
|
230 |
-
if (sb_woo_attr_set_l > 0) {
|
231 |
-
//foreach of the stored attribute variables
|
232 |
-
jQuery(sb_woo_attr_data).each(function (index3, attr3) {
|
233 |
-
//loop variation prices
|
234 |
-
var sb_woo_attrs = attr3.attributes;
|
235 |
-
sb_woo_attr_set_matched = 0; //reset to 0
|
236 |
-
|
237 |
-
//loop attributes linked to this attribute set
|
238 |
-
jQuery(sb_woo_attrs).each(function (index4, attr4) {
|
239 |
-
jQuery(attr4).each(function (index4, attr4) {
|
240 |
-
jQuery(sb_woo_attr_set).each(function (index5, attr5) {
|
241 |
-
if (attr4[attr5[0]] == attr5[1] || attr4[attr5[0]] == "") {
|
242 |
-
sb_woo_attr_set_matched++;
|
243 |
-
}
|
244 |
-
});
|
245 |
-
});
|
246 |
-
});
|
247 |
-
|
248 |
-
if (sb_woo_attr_set_matched >= sb_woo_attr_set_l) {
|
249 |
-
sb_woo_found_set = attr3; //we found a matching set... store it!
|
250 |
-
}
|
251 |
-
});
|
252 |
-
|
253 |
-
if (typeof sb_woo_found_set.image !== 'undefined') {
|
254 |
-
sb_woo_large_image = sb_woo_found_set.image.full_src;
|
255 |
-
} else {
|
256 |
-
sb_woo_large_image = jQuery('.sb_woo_product_thumb_col_num_1 a').data('large_image');
|
257 |
-
}
|
258 |
-
|
259 |
-
sb_woo_product_thumb_replace_by_url(sb_woo_large_image, jQuery('.sb_woo_product_image_container')); //we aren't selecting the same element here so just grab the image directly
|
260 |
-
}
|
261 |
-
}
|
262 |
-
|
263 |
-
function sb_woo_product_thumb_replace_by_url(large_image, image_object) {
|
264 |
-
if (jQuery('.single-product .sb_woo_product_image img').attr('src') == large_image) {
|
265 |
-
return;
|
266 |
-
}
|
267 |
-
|
268 |
-
var parent_object = image_object.closest('.sb_woo_product_image_container');
|
269 |
-
|
270 |
-
if (parent_object.length == 0) {
|
271 |
-
var parent_object = jQuery('.sb_woo_product_image_container');
|
272 |
-
}
|
273 |
-
|
274 |
-
if (parent_object.length) {
|
275 |
-
|
276 |
-
parent_object.find('.sb_woo_product_image img').trigger('zoom.destroy'); // remove zoom
|
277 |
-
parent_object.find('.sb_woo_product_image img.zoomImg').remove(); //remove old zoom image
|
278 |
-
|
279 |
-
var image_height = parent_object.find('.sb_woo_product_image img').height();
|
280 |
-
|
281 |
-
parent_object.find('.sb_woo_product_image').css('height', image_height + 'px');
|
282 |
-
|
283 |
-
parent_object.find('.sb_woo_product_image img').fadeOut(400, function () {
|
284 |
-
parent_object.find('.sb_woo_product_image img').attr('src', large_image);
|
285 |
-
|
286 |
-
parent_object.find('.sb_woo_product_image').imagesLoaded(function () {
|
287 |
-
var image_height = parent_object.find('.sb_woo_product_image img').height();
|
288 |
-
|
289 |
-
parent_object.find('.sb_woo_product_image').css('height', image_height + 'px');
|
290 |
-
|
291 |
-
parent_object.find('.sb_woo_product_image img').fadeIn(400, function () {
|
292 |
-
if (!parent_object.find('.sb_woo_product_image').hasClass('sb_woo_image_disable_zoom')) {
|
293 |
-
parent_object.find('.sb_woo_product_image').zoom({
|
294 |
-
callback: function callback() {
|
295 |
-
if (!parent_object.find('.sb_woo_product_image').hasClass('sb_woo_image_disable_lightbox')) {
|
296 |
-
jQuery(this).colorbox({
|
297 |
-
href: parent_object.find('.sb_woo_product_image img').attr('src')
|
298 |
-
});
|
299 |
-
}
|
300 |
-
}
|
301 |
-
});
|
302 |
-
} else {
|
303 |
-
if (!parent_object.find('.sb_woo_product_image').hasClass('sb_woo_image_disable_lightbox')) {
|
304 |
-
jQuery('.sb_woo_product_image').colorbox({
|
305 |
-
href: parent_object.find('.sb_woo_product_image img').attr('src')
|
306 |
-
});
|
307 |
-
}
|
308 |
-
}
|
309 |
-
});
|
310 |
-
});
|
311 |
-
});
|
312 |
-
} else {
|
313 |
-
//
|
314 |
-
// Removed Code that conflict with WooCommerce Variation Swatches
|
315 |
-
//
|
316 |
-
/*jQuery.colorbox({
|
317 |
-
href: large_image
|
318 |
-
});*/
|
319 |
-
}
|
320 |
-
}
|
321 |
-
|
322 |
-
function sb_woo_product_thumb_replace(image_object) {
|
323 |
-
var large_image = image_object.data('large_image');
|
324 |
-
|
325 |
-
sb_woo_product_thumb_replace_by_url(large_image, image_object);
|
326 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/divi_woo_layout_injector.min.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
function wli_refresh_cart_count(){var e=0;jQuery(".sb_woo_mini_cart ul li").length&&jQuery(".sb_woo_mini_cart ul li").each(function(){var o=jQuery(this).children(".quantity").text().split(" "),o=parseInt(o[0]);e+=o}),e<=0&&(e=""),jQuery(".sb_woo_prod_cart_container .et-cart-info span").text(e)}function sb_woo_popup_notice(o){jQuery("html, body").scrollTop(0),jQuery.colorbox({html:o,width:"50%",className:"woocommerce"})}function sb_woo_maybe_submit_checkout_coupon(){jQuery(this).keypress(function(o){13==o.which&&sb_woo_submit_checkout_coupon()})}function sb_woo_submit_checkout_coupon(){var o;return jQuery(".coupon-module").length&&(jQuery(".coupon-module").parent().removeClass("woocommerce-invalid").removeClass("woocommerce-validated"),""!=(o=jQuery(".coupon-module").val())?(jQuery("#coupon_code").val(o),jQuery(".checkout_coupon").submit()):jQuery(".coupon-module").parent().addClass("woocommerce-invalid").removeClass("woocommerce-validated")),!1}function sb_woo_variation_image(){var r,c,t,o=jQuery(".single-product .cart.variations_form").data("product_variations"),u=[],_=0,n=0,m=[];jQuery(".single-product .cart.variations_form .variations .value select").each(function(o,e){r=jQuery(this).val(),c=jQuery(this).attr("id"),t="attribute_"+c,r&&(u.push([t,r]),_++)}),0<_&&(jQuery(o).each(function(o,e){var r=e.attributes;n=0,jQuery(r).each(function(o,e){jQuery(e).each(function(o,r){jQuery(u).each(function(o,e){r[e[0]]!=e[1]&&""!=r[e[0]]||n++})})}),_<=n&&(m=e)}),sb_woo_product_thumb_replace_by_url(void 0!==m.image?m.image.full_src:jQuery(".sb_woo_product_thumb_col_num_1 a").data("large_image"),jQuery(".sb_woo_product_image_container")))}function sb_woo_product_thumb_replace_by_url(o,e){var r;jQuery(".single-product .sb_woo_product_image img").attr("src")==o||(r=0==(r=e.closest(".sb_woo_product_image_container")).length?jQuery(".sb_woo_product_image_container"):r).length&&(r.find(".sb_woo_product_image img").trigger("zoom.destroy"),r.find(".sb_woo_product_image img.zoomImg").remove(),e=r.find(".sb_woo_product_image img").height(),r.find(".sb_woo_product_image").css("height",e+"px"),r.find(".sb_woo_product_image img").fadeOut(400,function(){r.find(".sb_woo_product_image img").attr("src",o),r.find(".sb_woo_product_image").imagesLoaded(function(){var o=r.find(".sb_woo_product_image img").height();r.find(".sb_woo_product_image").css("height",o+"px"),r.find(".sb_woo_product_image img").fadeIn(400,function(){r.find(".sb_woo_product_image").hasClass("sb_woo_image_disable_zoom")?r.find(".sb_woo_product_image").hasClass("sb_woo_image_disable_lightbox")||jQuery(".sb_woo_product_image").colorbox({href:r.find(".sb_woo_product_image img").attr("src")}):r.find(".sb_woo_product_image").zoom({callback:function(){r.find(".sb_woo_product_image").hasClass("sb_woo_image_disable_lightbox")||jQuery(this).colorbox({href:r.find(".sb_woo_product_image img").attr("src")})}})})})}))}function sb_woo_product_thumb_replace(o){sb_woo_product_thumb_replace_by_url(o.data("large_image"),o)}jQuery(document).ready(function(){var o;jQuery(".single-product .sb_woo_product_image").length&&(jQuery(".single-product .sb_woo_product_image").hasClass("sb_woo_image_disable_zoom")?jQuery(".single-product .sb_woo_product_image").hasClass("sb_woo_image_disable_lightbox")||jQuery(".sb_woo_product_image").colorbox({href:jQuery(".single-product .sb_woo_product_image img").attr("src")}):jQuery(".single-product .sb_woo_product_image").zoom({callback:function(){jQuery(".single-product .sb_woo_product_image").hasClass("sb_woo_image_disable_lightbox")||jQuery(this).colorbox({href:jQuery(".single-product .sb_woo_product_image img").attr("src")})}})),jQuery(".single-product .cart.variations_form")&&jQuery(".single-product .cart.variations_form .variations .value select").each(function(o,e){jQuery(this).change(function(){sb_woo_variation_image()})}),jQuery(".woocommerce-remove-coupon").length&&jQuery(".et_pb_woo_checkout_coupon").slideUp(),jQuery(document.body).on("wc_fragments_refreshed",function(){}),jQuery("body").hasClass("wli_injected")&&(0<jQuery(".wpcf7").length&&((o=document.body.className.match(/(^|\s)postid-(\d+)(\s|$)/))&&(jQuery("input[name='_wpcf7_container_post']").val(o[2]),jQuery(".wpcf7-submit").addClass("button"),jQuery(".wpcf7-form > p").addClass("form-row"),jQuery(".wpcf7-form > p .wpcf7-form-control-wrap input").addClass("input-text"))),jQuery(document.body).on("added_to_cart",function(){setTimeout(function(){jQuery(".added_to_cart").addClass("button")},50)}),jQuery(document.body).on("wc_fragments_loaded",function(){wli_refresh_cart_count()}),jQuery(document.body).on("wc_fragments_refreshed",function(){wli_refresh_cart_count()}),jQuery(document.body).on("checkout_error",function(){jQuery(".woocommerce-NoticeGroup").length&&(sb_woo_popup_notice(jQuery(".woocommerce-NoticeGroup").html()),setTimeout(function(){jQuery(".woocommerce-NoticeGroup").remove()},250))}),jQuery(document.body).on("updated_wc_div",function(){jQuery(".woocommerce .woocommerce-error").length&&(sb_woo_popup_notice(jQuery(".woocommerce .woocommerce-error")),jQuery(".entry-content .woocommerce .woocommerce-error").remove()),jQuery(".woocommerce .woocommerce-message").length&&(sb_woo_popup_notice(jQuery(".woocommerce .woocommerce-message").clone().wrap("<div />")),jQuery(".entry-content .woocommerce .woocommerce-message").remove()),0<jQuery(".cart-empty").length&&jQuery(".et_pb_woo_cart_totals").remove()}),jQuery(document.body).on("applied_coupon",function(){jQuery(".woocommerce .woocommerce-error").length&&(sb_woo_popup_notice(jQuery(".woocommerce .woocommerce-error")),jQuery(".entry-content .woocommerce .woocommerce-error").remove())}),jQuery(document.body).on("removed_coupon",function(){jQuery(".woocommerce .woocommerce-message").length&&(sb_woo_popup_notice(jQuery(".woocommerce .woocommerce-message").clone().wrap("<div />")),jQuery(".entry-content .woocommerce .woocommerce-message").remove())}),jQuery(document.body).on("update_checkout",function(){jQuery(".wli_wrapper_checkout-form-coupon .woocommerce-error").length?(sb_woo_popup_notice(jQuery(".wli_wrapper_checkout-form-coupon .woocommerce-error").clone().wrap("<div />")),jQuery(".et_pb_woo_checkout_coupon").slideDown()):jQuery(".wli_wrapper_checkout-form-coupon .woocommerce-message").length?(sb_woo_popup_notice(jQuery(".wli_wrapper_checkout-form-coupon .woocommerce-message").clone().wrap("<div />")),jQuery(".coupon-module").val(""),jQuery(".woocommerce-remove-coupon").length?jQuery(".et_pb_woo_checkout_coupon").slideDown():jQuery(".et_pb_woo_checkout_coupon").slideUp()):jQuery(".woocommerce .woocommerce-message").length&&(sb_woo_popup_notice(jQuery(".woocommerce .woocommerce-message").clone().wrap("<div />")),setTimeout(function(){jQuery(".entry-content > .woocommerce > .woocommerce-message").remove()},250))}))});
|
|
assets/js/form-field-dependency.js
DELETED
@@ -1,809 +0,0 @@
|
|
1 |
-
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
2 |
-
|
3 |
-
(function ($) {
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Use on your css file
|
7 |
-
* [data-depends].has-dependent-data {
|
8 |
-
* display : none;
|
9 |
-
* }
|
10 |
-
* @param options
|
11 |
-
* @constructor
|
12 |
-
*/
|
13 |
-
$.fn.FormFieldDependency = function (options) {
|
14 |
-
|
15 |
-
/**
|
16 |
-
* Plugin Settings
|
17 |
-
* @type {void|*}
|
18 |
-
*/
|
19 |
-
var settings = $.extend({
|
20 |
-
'attribute': 'wvsdepends', // data-wvsdepends="[...]"
|
21 |
-
'rules': {}
|
22 |
-
}, options);
|
23 |
-
|
24 |
-
/**
|
25 |
-
* Check array exists on array
|
26 |
-
* @param needleArray
|
27 |
-
* @param haystackArray
|
28 |
-
* @param strict
|
29 |
-
* @returns {boolean}
|
30 |
-
*/
|
31 |
-
var arrayInArraysHelper = function arrayInArraysHelper(needleArray, haystackArray, strict) {
|
32 |
-
|
33 |
-
if (typeof strict == 'undefined') {
|
34 |
-
strict = false;
|
35 |
-
}
|
36 |
-
|
37 |
-
if (needleArray == null) {
|
38 |
-
needleArray = [];
|
39 |
-
}
|
40 |
-
|
41 |
-
if (strict == true) {
|
42 |
-
return needleArray.sort().join(',').toLowerCase() == haystackArray.sort().join(',').toLowerCase();
|
43 |
-
} else {
|
44 |
-
for (var i = 0; i < needleArray.length; i++) {
|
45 |
-
if (haystackArray.indexOf(needleArray[i]) >= 0) {
|
46 |
-
return true;
|
47 |
-
}
|
48 |
-
}
|
49 |
-
return false;
|
50 |
-
}
|
51 |
-
};
|
52 |
-
|
53 |
-
/**
|
54 |
-
* Check string exist on array value
|
55 |
-
* @param needleString
|
56 |
-
* @param haystackArray
|
57 |
-
* @returns {boolean}
|
58 |
-
*/
|
59 |
-
var stringInArraysHelper = function stringInArraysHelper(needleString, haystackArray) {
|
60 |
-
return $.inArray(needleString, haystackArray) >= 0 && $.isArray(haystackArray);
|
61 |
-
};
|
62 |
-
|
63 |
-
/**
|
64 |
-
* Check value is empty or not
|
65 |
-
* @param value
|
66 |
-
* @returns {boolean}
|
67 |
-
*/
|
68 |
-
|
69 |
-
var isEmpty = function isEmpty(value) {
|
70 |
-
|
71 |
-
if (typeof value == 'null' || typeof value == 'undefined') {
|
72 |
-
return true;
|
73 |
-
}
|
74 |
-
|
75 |
-
if (typeof value == 'string') {
|
76 |
-
return value.trim() == '';
|
77 |
-
}
|
78 |
-
|
79 |
-
if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) == 'object') {
|
80 |
-
if ($.isArray(value)) {
|
81 |
-
var _tmp = $.map(value, function (val, i) {
|
82 |
-
return val.trim() == '' ? null : val;
|
83 |
-
});
|
84 |
-
return $.isEmptyObject(_tmp);
|
85 |
-
} else {
|
86 |
-
return $.isEmptyObject(value);
|
87 |
-
}
|
88 |
-
}
|
89 |
-
};
|
90 |
-
|
91 |
-
/**
|
92 |
-
* For Regular Expression Dependency
|
93 |
-
* @param element
|
94 |
-
* @param depObject
|
95 |
-
* @param parent
|
96 |
-
* @param useEvent
|
97 |
-
*/
|
98 |
-
var typeRegExpDependency = function typeRegExpDependency(element, depObject, parent, useEvent) {
|
99 |
-
|
100 |
-
if (typeof useEvent == 'undefined') {
|
101 |
-
useEvent = false;
|
102 |
-
}
|
103 |
-
|
104 |
-
if (typeof $(parent).prop('tagName') == 'undefined') {
|
105 |
-
return false;
|
106 |
-
}
|
107 |
-
|
108 |
-
var tag = $(parent).prop('tagName').toLowerCase();
|
109 |
-
var type = $(parent).prop('type').toLowerCase();
|
110 |
-
var name = tag + ':' + type;
|
111 |
-
var value = $(parent).val().trim();
|
112 |
-
|
113 |
-
switch (name) {
|
114 |
-
case 'input:text':
|
115 |
-
case 'input:password':
|
116 |
-
case 'input:number':
|
117 |
-
case 'input:date':
|
118 |
-
case 'input:email':
|
119 |
-
case 'input:url':
|
120 |
-
case 'input:tel':
|
121 |
-
case 'textarea:textarea':
|
122 |
-
|
123 |
-
var modifier = typeof depObject.modifier == 'undefined' ? '' : depObject.modifier;
|
124 |
-
var pattern = new RegExp(depObject.pattern, modifier);
|
125 |
-
|
126 |
-
if (pattern.test(value)) {
|
127 |
-
$(element).show();
|
128 |
-
} else {
|
129 |
-
$(element).hide();
|
130 |
-
}
|
131 |
-
break;
|
132 |
-
}
|
133 |
-
|
134 |
-
if (useEvent) {
|
135 |
-
$(document.body).on('input', $(parent), function (e) {
|
136 |
-
typeRegExpDependency(element, depObject, parent, false);
|
137 |
-
});
|
138 |
-
}
|
139 |
-
};
|
140 |
-
|
141 |
-
/**
|
142 |
-
* For Empty TextBox
|
143 |
-
* @param element
|
144 |
-
* @param depObject
|
145 |
-
* @param parent
|
146 |
-
* @param useEvent
|
147 |
-
*/
|
148 |
-
var typeEmptyDependency = function typeEmptyDependency(element, depObject, parent, useEvent) {
|
149 |
-
|
150 |
-
if (typeof useEvent == 'undefined') {
|
151 |
-
useEvent = false;
|
152 |
-
}
|
153 |
-
|
154 |
-
if (typeof $(parent).prop('tagName') == 'undefined') {
|
155 |
-
return false;
|
156 |
-
}
|
157 |
-
|
158 |
-
var tag = $(parent).prop('tagName').toLowerCase();
|
159 |
-
var type = $(parent).prop('type').toLowerCase();
|
160 |
-
var name = tag + ':' + type;
|
161 |
-
var value = $(parent).val();
|
162 |
-
|
163 |
-
switch (name) {
|
164 |
-
case 'input:text':
|
165 |
-
case 'input:password':
|
166 |
-
case 'input:number':
|
167 |
-
case 'input:date':
|
168 |
-
case 'input:email':
|
169 |
-
case 'input:url':
|
170 |
-
case 'input:tel':
|
171 |
-
case 'textarea:textarea':
|
172 |
-
case 'select:select-one':
|
173 |
-
|
174 |
-
if (value.trim() == '') {
|
175 |
-
$(element).show();
|
176 |
-
} else {
|
177 |
-
$(element).hide();
|
178 |
-
}
|
179 |
-
break;
|
180 |
-
|
181 |
-
case 'input:checkbox':
|
182 |
-
if ($(parent).is(':checked') && value.trim() != '') {
|
183 |
-
$(element).hide();
|
184 |
-
} else {
|
185 |
-
$(element).show();
|
186 |
-
}
|
187 |
-
break;
|
188 |
-
|
189 |
-
case 'select:select-multiple':
|
190 |
-
|
191 |
-
if (isEmpty(value)) {
|
192 |
-
$(element).show();
|
193 |
-
} else {
|
194 |
-
$(element).hide();
|
195 |
-
}
|
196 |
-
|
197 |
-
break;
|
198 |
-
}
|
199 |
-
|
200 |
-
if (useEvent) {
|
201 |
-
$(document.body).on('input change', $(parent), function (e) {
|
202 |
-
typeEmptyDependency(element, depObject, parent, false);
|
203 |
-
});
|
204 |
-
}
|
205 |
-
};
|
206 |
-
|
207 |
-
/**
|
208 |
-
* For non empty TextBox
|
209 |
-
* @param element
|
210 |
-
* @param depObject
|
211 |
-
* @param parent
|
212 |
-
* @param useEvent
|
213 |
-
*/
|
214 |
-
var typeNotEmptyDependency = function typeNotEmptyDependency(element, depObject, parent, useEvent) {
|
215 |
-
|
216 |
-
if (typeof useEvent == 'undefined') {
|
217 |
-
useEvent = false;
|
218 |
-
}
|
219 |
-
|
220 |
-
if (typeof $(parent).prop('tagName') == 'undefined') {
|
221 |
-
return false;
|
222 |
-
}
|
223 |
-
|
224 |
-
var tag = $(parent).prop('tagName').toLowerCase();
|
225 |
-
var type = $(parent).prop('type').toLowerCase();
|
226 |
-
var name = tag + ':' + type;
|
227 |
-
var value = $(parent).val();
|
228 |
-
|
229 |
-
switch (name) {
|
230 |
-
case 'input:text':
|
231 |
-
case 'input:password':
|
232 |
-
case 'input:number':
|
233 |
-
case 'input:date':
|
234 |
-
case 'input:email':
|
235 |
-
case 'input:url':
|
236 |
-
case 'input:tel':
|
237 |
-
case 'textarea:textarea':
|
238 |
-
case 'select:select-one':
|
239 |
-
|
240 |
-
if (value.trim() != '') {
|
241 |
-
$(element).show();
|
242 |
-
} else {
|
243 |
-
$(element).hide();
|
244 |
-
}
|
245 |
-
break;
|
246 |
-
|
247 |
-
case 'input:checkbox':
|
248 |
-
if ($(parent).is(':checked') && value.trim() != '') {
|
249 |
-
$(element).show();
|
250 |
-
} else {
|
251 |
-
$(element).hide();
|
252 |
-
}
|
253 |
-
break;
|
254 |
-
|
255 |
-
case 'select:select-multiple':
|
256 |
-
|
257 |
-
if (isEmpty(value)) {
|
258 |
-
$(element).hide();
|
259 |
-
} else {
|
260 |
-
$(element).show();
|
261 |
-
}
|
262 |
-
|
263 |
-
break;
|
264 |
-
}
|
265 |
-
|
266 |
-
if (useEvent) {
|
267 |
-
$(document.body).on('input change', $(parent), function (e) {
|
268 |
-
typeNotEmptyDependency(element, depObject, parent, false);
|
269 |
-
});
|
270 |
-
}
|
271 |
-
};
|
272 |
-
|
273 |
-
/**
|
274 |
-
* TextBox value matched with value or with array values
|
275 |
-
* @param element
|
276 |
-
* @param depObject
|
277 |
-
* @param parent
|
278 |
-
* @param useEvent
|
279 |
-
*/
|
280 |
-
var typeEqualDependency = function typeEqualDependency(element, depObject, parent, useEvent) {
|
281 |
-
|
282 |
-
if (typeof useEvent == 'undefined') {
|
283 |
-
useEvent = false;
|
284 |
-
}
|
285 |
-
|
286 |
-
if (typeof $(parent).prop('tagName') == 'undefined') {
|
287 |
-
return false;
|
288 |
-
}
|
289 |
-
|
290 |
-
var tag = $(parent).prop('tagName').toLowerCase();
|
291 |
-
var type = $(parent).prop('type').toLowerCase();
|
292 |
-
var name = tag + ':' + type;
|
293 |
-
var value = $(parent).val();
|
294 |
-
|
295 |
-
var equalLike = typeof depObject.like == 'undefined' ? false : true;
|
296 |
-
|
297 |
-
// show if empty?. default false
|
298 |
-
depObject.empty = typeof depObject.empty == 'undefined' ? false : depObject.empty;
|
299 |
-
|
300 |
-
depObject.strict = typeof depObject.strict == 'undefined' ? false : depObject.strict;
|
301 |
-
|
302 |
-
if (equalLike) {
|
303 |
-
|
304 |
-
var eqtag = $(depObject.like).prop('tagName').toLowerCase();
|
305 |
-
var eqtype = $(depObject.like).prop('type').toLowerCase();
|
306 |
-
var eqname = eqtag + ':' + eqtype;
|
307 |
-
|
308 |
-
if (eqname == 'input:checkbox' || eqname == 'input:radio') {
|
309 |
-
depObject.value = $(depObject.like + ':checked').map(function () {
|
310 |
-
return this.value;
|
311 |
-
}).get();
|
312 |
-
} else {
|
313 |
-
|
314 |
-
depObject.value = $(depObject.like).val();
|
315 |
-
|
316 |
-
if (!showOnEmptyValue) {
|
317 |
-
depObject.value = $(depObject.like).val().trim() == '' ? null : $(depObject.like).val();
|
318 |
-
}
|
319 |
-
}
|
320 |
-
}
|
321 |
-
|
322 |
-
switch (name) {
|
323 |
-
case 'input:text':
|
324 |
-
case 'input:password':
|
325 |
-
case 'input:number':
|
326 |
-
case 'input:date':
|
327 |
-
case 'input:email':
|
328 |
-
case 'input:url':
|
329 |
-
case 'input:tel':
|
330 |
-
case 'textarea:textarea':
|
331 |
-
case 'select:select-one':
|
332 |
-
|
333 |
-
if (value.trim() == depObject.value) {
|
334 |
-
$(element).show();
|
335 |
-
} else if (stringInArraysHelper(value, depObject.value)) {
|
336 |
-
$(element).show();
|
337 |
-
} else {
|
338 |
-
if (value.trim() == '' && depObject.empty) {
|
339 |
-
$(element).show();
|
340 |
-
} else {
|
341 |
-
$(element).hide();
|
342 |
-
}
|
343 |
-
}
|
344 |
-
break;
|
345 |
-
|
346 |
-
case 'input:checkbox':
|
347 |
-
case 'input:radio':
|
348 |
-
|
349 |
-
var value = $(parent + ':checked').map(function () {
|
350 |
-
return this.value;
|
351 |
-
}).get();
|
352 |
-
|
353 |
-
if (value == depObject.value) {
|
354 |
-
$(element).show();
|
355 |
-
} else if (stringInArraysHelper(value, depObject.value)) {
|
356 |
-
$(element).show();
|
357 |
-
} else if (arrayInArraysHelper(value, depObject.value, depObject.strict)) {
|
358 |
-
$(element).show();
|
359 |
-
} else {
|
360 |
-
if (isEmpty(value) && depObject.empty) {
|
361 |
-
$(element).show();
|
362 |
-
} else {
|
363 |
-
$(element).hide();
|
364 |
-
}
|
365 |
-
}
|
366 |
-
break;
|
367 |
-
|
368 |
-
case 'select:select-multiple':
|
369 |
-
|
370 |
-
if (arrayInArraysHelper(value, depObject.value, depObject.strict)) {
|
371 |
-
$(element).show();
|
372 |
-
} else {
|
373 |
-
|
374 |
-
if (value == null && depObject.empty) {
|
375 |
-
$(element).show();
|
376 |
-
} else {
|
377 |
-
$(element).hide();
|
378 |
-
}
|
379 |
-
}
|
380 |
-
break;
|
381 |
-
}
|
382 |
-
|
383 |
-
if (useEvent) {
|
384 |
-
$(document.body).on('input change', $(parent), function (e) {
|
385 |
-
typeEqualDependency(element, depObject, parent, false);
|
386 |
-
});
|
387 |
-
}
|
388 |
-
};
|
389 |
-
|
390 |
-
/**
|
391 |
-
* TextBox value not equal with value or with array values
|
392 |
-
* @param element
|
393 |
-
* @param depObject
|
394 |
-
* @param parent
|
395 |
-
* @param useEvent
|
396 |
-
*/
|
397 |
-
var typeNotEqualDependency = function typeNotEqualDependency(element, depObject, parent, useEvent) {
|
398 |
-
|
399 |
-
if (typeof useEvent == 'undefined') {
|
400 |
-
useEvent = false;
|
401 |
-
}
|
402 |
-
|
403 |
-
if (typeof $(parent).prop('tagName') == 'undefined') {
|
404 |
-
return false;
|
405 |
-
}
|
406 |
-
|
407 |
-
var tag = $(parent).prop('tagName').toLowerCase();
|
408 |
-
var type = $(parent).prop('type').toLowerCase();
|
409 |
-
var name = tag + ':' + type;
|
410 |
-
var value = $(parent).val();
|
411 |
-
|
412 |
-
var equalLike = typeof depObject.like == 'undefined' ? false : true;
|
413 |
-
depObject.strict = typeof depObject.strict == 'undefined' ? false : depObject.strict;
|
414 |
-
|
415 |
-
// show if empty? default is true
|
416 |
-
depObject.empty = typeof depObject.empty == 'undefined' ? true : depObject.empty;
|
417 |
-
|
418 |
-
if (equalLike) {
|
419 |
-
|
420 |
-
var eqtag = $(depObject.like).prop('tagName').toLowerCase();
|
421 |
-
var eqtype = $(depObject.like).prop('type').toLowerCase();
|
422 |
-
var eqname = eqtag + ':' + eqtype;
|
423 |
-
|
424 |
-
if (eqname == 'input:checkbox' || eqname == 'input:radio') {
|
425 |
-
depObject.value = $(depObject.like + ':checked').map(function () {
|
426 |
-
return this.value;
|
427 |
-
}).get();
|
428 |
-
} else {
|
429 |
-
|
430 |
-
depObject.value = $(depObject.like).val();
|
431 |
-
|
432 |
-
if (!showOnEmptyValue) {
|
433 |
-
depObject.value = $(depObject.like).val().trim() == '' ? null : $(depObject.like).val();
|
434 |
-
}
|
435 |
-
}
|
436 |
-
}
|
437 |
-
|
438 |
-
switch (name) {
|
439 |
-
case 'input:text':
|
440 |
-
case 'input:password':
|
441 |
-
case 'input:number':
|
442 |
-
case 'input:date':
|
443 |
-
case 'input:email':
|
444 |
-
case 'input:url':
|
445 |
-
case 'input:tel':
|
446 |
-
case 'textarea:textarea':
|
447 |
-
case 'select:select-one':
|
448 |
-
|
449 |
-
if (value == depObject.value) {
|
450 |
-
$(element).hide();
|
451 |
-
} else if (stringInArraysHelper(value, depObject.value)) {
|
452 |
-
$(element).hide();
|
453 |
-
} else {
|
454 |
-
if (value.trim() == '' && !depObject.empty) {
|
455 |
-
$(element).hide();
|
456 |
-
} else {
|
457 |
-
$(element).show();
|
458 |
-
}
|
459 |
-
}
|
460 |
-
break;
|
461 |
-
|
462 |
-
case 'input:checkbox':
|
463 |
-
case 'input:radio':
|
464 |
-
|
465 |
-
value = $(parent + ':checked').map(function () {
|
466 |
-
return this.value;
|
467 |
-
}).get();
|
468 |
-
|
469 |
-
if (typeof depObject.strict == 'undefined') {
|
470 |
-
depObject.strict = false;
|
471 |
-
}
|
472 |
-
|
473 |
-
if (value == depObject.value) {
|
474 |
-
|
475 |
-
$(element).hide();
|
476 |
-
} else if (stringInArraysHelper(value, depObject.value)) {
|
477 |
-
|
478 |
-
$(element).hide();
|
479 |
-
} else if (arrayInArraysHelper(value, depObject.value, depObject.strict)) {
|
480 |
-
|
481 |
-
$(element).hide();
|
482 |
-
} else {
|
483 |
-
if (isEmpty(value) && !depObject.empty) {
|
484 |
-
$(element).hide();
|
485 |
-
} else {
|
486 |
-
$(element).show();
|
487 |
-
}
|
488 |
-
}
|
489 |
-
|
490 |
-
break;
|
491 |
-
|
492 |
-
case 'select:select-multiple':
|
493 |
-
|
494 |
-
if (arrayInArraysHelper(value, depObject.value, depObject.strict)) {
|
495 |
-
$(element).hide();
|
496 |
-
} else {
|
497 |
-
if (value == null && !depObject.empty) {
|
498 |
-
$(element).hide();
|
499 |
-
} else {
|
500 |
-
$(element).show();
|
501 |
-
}
|
502 |
-
}
|
503 |
-
|
504 |
-
break;
|
505 |
-
}
|
506 |
-
|
507 |
-
if (useEvent) {
|
508 |
-
$(document.body).on('input change', $(parent), function (e) {
|
509 |
-
typeNotEqualDependency(element, depObject, parent, false);
|
510 |
-
});
|
511 |
-
}
|
512 |
-
};
|
513 |
-
|
514 |
-
/**
|
515 |
-
* TextBox value compare
|
516 |
-
* @param element
|
517 |
-
* @param depObject
|
518 |
-
* @param parent
|
519 |
-
* @param useEvent
|
520 |
-
*/
|
521 |
-
var typeCompareDependency = function typeCompareDependency(element, depObject, parent, useEvent) {
|
522 |
-
|
523 |
-
if (typeof useEvent == 'undefined') {
|
524 |
-
useEvent = false;
|
525 |
-
}
|
526 |
-
|
527 |
-
if (typeof $(parent).prop('tagName') == 'undefined') {
|
528 |
-
return false;
|
529 |
-
}
|
530 |
-
|
531 |
-
var tag = $(parent).prop('tagName').toLowerCase();
|
532 |
-
var type = $(parent).prop('type').toLowerCase();
|
533 |
-
var name = tag + ':' + type;
|
534 |
-
var value = parseInt($(parent).val());
|
535 |
-
depObject.value = parseInt(depObject.value);
|
536 |
-
|
537 |
-
switch (depObject.sign) {
|
538 |
-
case '<':
|
539 |
-
case 'lt':
|
540 |
-
case 'lessthen':
|
541 |
-
case 'less-then':
|
542 |
-
case 'LessThen':
|
543 |
-
if (value < depObject.value) {
|
544 |
-
$(element).show();
|
545 |
-
} else {
|
546 |
-
$(element).hide();
|
547 |
-
}
|
548 |
-
break;
|
549 |
-
|
550 |
-
case '<=':
|
551 |
-
case 'lteq':
|
552 |
-
case 'lessthenequal':
|
553 |
-
case 'less-then-equal':
|
554 |
-
case 'LessThenEqual':
|
555 |
-
case 'eqlt':
|
556 |
-
if (value <= depObject.value) {
|
557 |
-
$(element).show();
|
558 |
-
} else {
|
559 |
-
$(element).hide();
|
560 |
-
}
|
561 |
-
break;
|
562 |
-
|
563 |
-
case '>=':
|
564 |
-
case 'gteq':
|
565 |
-
case 'greaterthenequal':
|
566 |
-
case 'greater-then-equal':
|
567 |
-
case 'GreaterThenEqual':
|
568 |
-
case 'eqgt':
|
569 |
-
if (value >= depObject.value) {
|
570 |
-
$(element).show();
|
571 |
-
} else {
|
572 |
-
$(element).hide();
|
573 |
-
}
|
574 |
-
break;
|
575 |
-
|
576 |
-
case '>':
|
577 |
-
case 'gt':
|
578 |
-
case 'greaterthen':
|
579 |
-
case 'greater-then':
|
580 |
-
case 'GreaterThen':
|
581 |
-
if (value > depObject.value) {
|
582 |
-
$(element).show();
|
583 |
-
} else {
|
584 |
-
$(element).hide();
|
585 |
-
}
|
586 |
-
break;
|
587 |
-
|
588 |
-
}
|
589 |
-
|
590 |
-
if (useEvent) {
|
591 |
-
$(document.body).on('input change', $(parent), function (e) {
|
592 |
-
typeCompareDependency(element, depObject, parent, false);
|
593 |
-
});
|
594 |
-
}
|
595 |
-
};
|
596 |
-
|
597 |
-
/**
|
598 |
-
* TextBox value range
|
599 |
-
* @param element
|
600 |
-
* @param depObject
|
601 |
-
* @param parent
|
602 |
-
* @param useEvent
|
603 |
-
*/
|
604 |
-
var typeRangeDependency = function typeRangeDependency(element, depObject, parent, useEvent) {
|
605 |
-
|
606 |
-
if (typeof useEvent == 'undefined') {
|
607 |
-
useEvent = false;
|
608 |
-
}
|
609 |
-
|
610 |
-
if (typeof $(parent).prop('tagName') == 'undefined') {
|
611 |
-
return false;
|
612 |
-
}
|
613 |
-
|
614 |
-
var tag = $(parent).prop('tagName').toLowerCase();
|
615 |
-
var type = $(parent).prop('type').toLowerCase();
|
616 |
-
var name = tag + ':' + type;
|
617 |
-
var value = parseInt($(parent).val());
|
618 |
-
var min, max;
|
619 |
-
|
620 |
-
// value = [50, 100]
|
621 |
-
|
622 |
-
if ($.isArray(depObject.value)) {
|
623 |
-
min = parseInt(depObject.value[0]);
|
624 |
-
max = parseInt(depObject.value[1]);
|
625 |
-
}
|
626 |
-
|
627 |
-
if (typeof depObject.value == 'undefined') {
|
628 |
-
min = parseInt(depObject.min);
|
629 |
-
max = parseInt(depObject.max);
|
630 |
-
}
|
631 |
-
|
632 |
-
if (min < value && value < max) {
|
633 |
-
$(element).show();
|
634 |
-
} else {
|
635 |
-
$(element).hide();
|
636 |
-
}
|
637 |
-
|
638 |
-
if (useEvent) {
|
639 |
-
$(document.body).on('input change', $(parent), function (e) {
|
640 |
-
typeRangeDependency(element, depObject, parent, false);
|
641 |
-
});
|
642 |
-
}
|
643 |
-
};
|
644 |
-
|
645 |
-
/**
|
646 |
-
* TextBox value length
|
647 |
-
* @param element
|
648 |
-
* @param depObject
|
649 |
-
* @param parent
|
650 |
-
* @param useEvent
|
651 |
-
*/
|
652 |
-
var typeLengthDependency = function typeLengthDependency(element, depObject, parent, useEvent) {
|
653 |
-
|
654 |
-
if (typeof useEvent == 'undefined') {
|
655 |
-
useEvent = false;
|
656 |
-
}
|
657 |
-
|
658 |
-
if (typeof $(parent).prop('tagName') == 'undefined') {
|
659 |
-
return false;
|
660 |
-
}
|
661 |
-
|
662 |
-
var tag = $(parent).prop('tagName').toLowerCase();
|
663 |
-
var type = $(parent).prop('type').toLowerCase();
|
664 |
-
var name = tag + ':' + type;
|
665 |
-
var value = $(parent).val().length;
|
666 |
-
depObject.value = parseInt(depObject.value);
|
667 |
-
|
668 |
-
switch (depObject.sign) {
|
669 |
-
case '<':
|
670 |
-
case 'lt':
|
671 |
-
case 'lessthen':
|
672 |
-
case 'less-then':
|
673 |
-
case 'LessThen':
|
674 |
-
if (value < depObject.value) {
|
675 |
-
$(element).show();
|
676 |
-
} else {
|
677 |
-
$(element).hide();
|
678 |
-
}
|
679 |
-
break;
|
680 |
-
|
681 |
-
case '<=':
|
682 |
-
case 'lteq':
|
683 |
-
case 'lessthenequal':
|
684 |
-
case 'less-then-equal':
|
685 |
-
case 'LessThenEqual':
|
686 |
-
case 'eqlt':
|
687 |
-
if (value <= depObject.value) {
|
688 |
-
$(element).show();
|
689 |
-
} else {
|
690 |
-
$(element).hide();
|
691 |
-
}
|
692 |
-
break;
|
693 |
-
|
694 |
-
case '>=':
|
695 |
-
case 'gteq':
|
696 |
-
case 'greaterthenequal':
|
697 |
-
case 'greater-then-equal':
|
698 |
-
case 'GreaterThenEqual':
|
699 |
-
case 'eqgt':
|
700 |
-
if (value >= depObject.value) {
|
701 |
-
$(element).show();
|
702 |
-
} else {
|
703 |
-
$(element).hide();
|
704 |
-
}
|
705 |
-
break;
|
706 |
-
|
707 |
-
case '>':
|
708 |
-
case 'gt':
|
709 |
-
case 'greaterthen':
|
710 |
-
case 'greater-then':
|
711 |
-
case 'GreaterThen':
|
712 |
-
if (value > depObject.value) {
|
713 |
-
$(element).show();
|
714 |
-
} else {
|
715 |
-
$(element).hide();
|
716 |
-
}
|
717 |
-
break;
|
718 |
-
|
719 |
-
}
|
720 |
-
|
721 |
-
if (useEvent) {
|
722 |
-
$(document.body).on('input change', $(parent), function (e) {
|
723 |
-
//e.stopPropagation();
|
724 |
-
//e.stopImmediatePropagation();
|
725 |
-
typeLengthDependency(element, depObject, parent, false);
|
726 |
-
});
|
727 |
-
}
|
728 |
-
};
|
729 |
-
|
730 |
-
/**
|
731 |
-
* Using Types
|
732 |
-
* @param $el
|
733 |
-
* @param $data
|
734 |
-
*/
|
735 |
-
var useTypes = function useTypes($el, $data) {
|
736 |
-
$.each($data, function (selector, depObject) {
|
737 |
-
|
738 |
-
switch (depObject.type) {
|
739 |
-
case 'empty':
|
740 |
-
typeEmptyDependency($el, depObject, selector, true);
|
741 |
-
break;
|
742 |
-
|
743 |
-
case 'notempty':
|
744 |
-
case 'not-empty':
|
745 |
-
case 'notEmpty':
|
746 |
-
case '!empty':
|
747 |
-
typeNotEmptyDependency($el, depObject, selector, true);
|
748 |
-
break;
|
749 |
-
|
750 |
-
case 'equal':
|
751 |
-
case '==':
|
752 |
-
case '=':
|
753 |
-
typeEqualDependency($el, depObject, selector, true);
|
754 |
-
break;
|
755 |
-
|
756 |
-
case '!equal':
|
757 |
-
case 'notequal':
|
758 |
-
case '!=':
|
759 |
-
case 'not-equal':
|
760 |
-
case 'notEqual':
|
761 |
-
typeNotEqualDependency($el, depObject, selector, true);
|
762 |
-
break;
|
763 |
-
|
764 |
-
case 'regexp':
|
765 |
-
case 'expression':
|
766 |
-
case 'reg':
|
767 |
-
case 'exp':
|
768 |
-
typeRegExpDependency($el, depObject, selector, true);
|
769 |
-
break;
|
770 |
-
|
771 |
-
case 'compare':
|
772 |
-
case 'comp':
|
773 |
-
typeCompareDependency($el, depObject, selector, true);
|
774 |
-
break;
|
775 |
-
|
776 |
-
case 'length':
|
777 |
-
case 'lng':
|
778 |
-
typeLengthDependency($el, depObject, selector, true);
|
779 |
-
break;
|
780 |
-
|
781 |
-
case 'range':
|
782 |
-
typeRangeDependency($el, depObject, selector, true);
|
783 |
-
break;
|
784 |
-
|
785 |
-
}
|
786 |
-
});
|
787 |
-
};
|
788 |
-
|
789 |
-
(function ($data) {
|
790 |
-
$.each($data, function ($el, depObject) {
|
791 |
-
useTypes($($el), depObject);
|
792 |
-
});
|
793 |
-
})(settings.rules);
|
794 |
-
|
795 |
-
return this.each(function () {
|
796 |
-
// var $data = $(this).data('depends');
|
797 |
-
var $data = $(this).data(settings.attribute.replace('data-', '').trim());
|
798 |
-
|
799 |
-
if ($data) {
|
800 |
-
|
801 |
-
$(this).addClass('has-dependent-data');
|
802 |
-
|
803 |
-
$.each($data, function (el, obj) {
|
804 |
-
useTypes($(this), obj);
|
805 |
-
}.bind(this));
|
806 |
-
}
|
807 |
-
});
|
808 |
-
};
|
809 |
-
})(jQuery);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/form-field-dependency.min.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(f){f.fn.FormFieldDependency=function(e){function c(e,t,a){if(null==e&&(e=[]),1==(a=void 0===a?!1:a))return e.sort().join(",").toLowerCase()==t.sort().join(",").toLowerCase();for(var s=0;s<e.length;s++)if(0<=t.indexOf(e[s]))return 1}function o(e,t){return 0<=f.inArray(e,t)&&f.isArray(t)}function u(e){if("null"==typeof e||void 0===e)return 1;if("string"==typeof e)return""==e.trim();if("object"==(void 0===e?"undefined":_typeof(e))){if(f.isArray(e)){var t=f.map(e,function(e,t){return""==e.trim()?null:e});return f.isEmptyObject(t)}return f.isEmptyObject(e)}}function p(t,a,s,e){if(void 0===e&&(e=!1),void 0===f(s).prop("tagName"))return!1;var n=f(s).prop("tagName").toLowerCase()+":"+f(s).prop("type").toLowerCase(),r=f(s).val().trim();switch(n){case"input:text":case"input:password":case"input:number":case"input:date":case"input:email":case"input:url":case"input:tel":case"textarea:textarea":var i=void 0===a.modifier?"":a.modifier;new RegExp(a.pattern,i).test(r)?f(t).show():f(t).hide()}e&&f(document.body).on("input",f(s),function(e){p(t,a,s,!1)})}function i(t,a,s,e){if(void 0===e&&(e=!1),void 0===f(s).prop("tagName"))return!1;var n=f(s).prop("tagName").toLowerCase()+":"+f(s).prop("type").toLowerCase(),r=f(s).val();switch(n){case"input:text":case"input:password":case"input:number":case"input:date":case"input:email":case"input:url":case"input:tel":case"textarea:textarea":case"select:select-one":""==r.trim()?f(t).show():f(t).hide();break;case"input:checkbox":f(s).is(":checked")&&""!=r.trim()?f(t).hide():f(t).show();break;case"select:select-multiple":u(r)?f(t).show():f(t).hide()}e&&f(document.body).on("input change",f(s),function(e){i(t,a,s,!1)})}function l(t,a,s,e){if(void 0===e&&(e=!1),void 0===f(s).prop("tagName"))return!1;var n=f(s).prop("tagName").toLowerCase()+":"+f(s).prop("type").toLowerCase(),r=f(s).val();switch(n){case"input:text":case"input:password":case"input:number":case"input:date":case"input:email":case"input:url":case"input:tel":case"textarea:textarea":case"select:select-one":""!=r.trim()?f(t).show():f(t).hide();break;case"input:checkbox":f(s).is(":checked")&&""!=r.trim()?f(t).show():f(t).hide();break;case"select:select-multiple":u(r)?f(t).hide():f(t).show()}e&&f(document.body).on("input change",f(s),function(e){l(t,a,s,!1)})}function h(t,a,s,e){if(void 0===e&&(e=!1),void 0===f(s).prop("tagName"))return!1;var n=f(s).prop("tagName").toLowerCase()+":"+f(s).prop("type").toLowerCase(),r=f(s).val(),i=void 0!==a.like;switch(a.empty=void 0!==a.empty&&a.empty,a.strict=void 0!==a.strict&&a.strict,i&&("input:checkbox"==(i=f(a.like).prop("tagName").toLowerCase()+":"+f(a.like).prop("type").toLowerCase())||"input:radio"==i?a.value=f(a.like+":checked").map(function(){return this.value}).get():(a.value=f(a.like).val(),showOnEmptyValue||(a.value=""==f(a.like).val().trim()?null:f(a.like).val()))),n){case"input:text":case"input:password":case"input:number":case"input:date":case"input:email":case"input:url":case"input:tel":case"textarea:textarea":case"select:select-one":r.trim()==a.value||o(r,a.value)||""==r.trim()&&a.empty?f(t).show():f(t).hide();break;case"input:checkbox":case"input:radio":(r=f(s+":checked").map(function(){return this.value}).get())==a.value||o(r,a.value)||c(r,a.value,a.strict)||u(r)&&a.empty?f(t).show():f(t).hide();break;case"select:select-multiple":c(r,a.value,a.strict)||null==r&&a.empty?f(t).show():f(t).hide()}e&&f(document.body).on("input change",f(s),function(e){h(t,a,s,!1)})}function d(t,a,s,e){if(void 0===e&&(e=!1),void 0===f(s).prop("tagName"))return!1;var n=f(s).prop("tagName").toLowerCase()+":"+f(s).prop("type").toLowerCase(),r=f(s).val(),i=void 0!==a.like;switch(a.strict=void 0!==a.strict&&a.strict,a.empty=void 0===a.empty||a.empty,i&&("input:checkbox"==(i=f(a.like).prop("tagName").toLowerCase()+":"+f(a.like).prop("type").toLowerCase())||"input:radio"==i?a.value=f(a.like+":checked").map(function(){return this.value}).get():(a.value=f(a.like).val(),showOnEmptyValue||(a.value=""==f(a.like).val().trim()?null:f(a.like).val()))),n){case"input:text":case"input:password":case"input:number":case"input:date":case"input:email":case"input:url":case"input:tel":case"textarea:textarea":case"select:select-one":r!=a.value&&!o(r,a.value)&&(""!=r.trim()||a.empty)?f(t).show():f(t).hide();break;case"input:checkbox":case"input:radio":r=f(s+":checked").map(function(){return this.value}).get(),void 0===a.strict&&(a.strict=!1),r==a.value||o(r,a.value)||c(r,a.value,a.strict)||u(r)&&!a.empty?f(t).hide():f(t).show();break;case"select:select-multiple":!c(r,a.value,a.strict)&&(null!=r||a.empty)?f(t).show():f(t).hide()}e&&f(document.body).on("input change",f(s),function(e){d(t,a,s,!1)})}function r(t,a,s,e){if(void 0===e&&(e=!1),void 0===f(s).prop("tagName"))return!1;f(s).prop("tagName").toLowerCase(),f(s).prop("type").toLowerCase();var n=parseInt(f(s).val());switch(a.value=parseInt(a.value),a.sign){case"<":case"lt":case"lessthen":case"less-then":case"LessThen":n<a.value?f(t).show():f(t).hide();break;case"<=":case"lteq":case"lessthenequal":case"less-then-equal":case"LessThenEqual":case"eqlt":n<=a.value?f(t).show():f(t).hide();break;case">=":case"gteq":case"greaterthenequal":case"greater-then-equal":case"GreaterThenEqual":case"eqgt":n>=a.value?f(t).show():f(t).hide();break;case">":case"gt":case"greaterthen":case"greater-then":case"GreaterThen":n>a.value?f(t).show():f(t).hide()}e&&f(document.body).on("input change",f(s),function(e){r(t,a,s,!1)})}function v(t,a,s,e){if(void 0===e&&(e=!1),void 0===f(s).prop("tagName"))return!1;f(s).prop("tagName").toLowerCase(),f(s).prop("type").toLowerCase();var n,r,i=parseInt(f(s).val());f.isArray(a.value)&&(n=parseInt(a.value[0]),r=parseInt(a.value[1])),void 0===a.value&&(n=parseInt(a.min),r=parseInt(a.max)),n<i&&i<r?f(t).show():f(t).hide(),e&&f(document.body).on("input change",f(s),function(e){v(t,a,s,!1)})}function m(t,a,s,e){if(void 0===e&&(e=!1),void 0===f(s).prop("tagName"))return!1;f(s).prop("tagName").toLowerCase(),f(s).prop("type").toLowerCase();var n=f(s).val().length;switch(a.value=parseInt(a.value),a.sign){case"<":case"lt":case"lessthen":case"less-then":case"LessThen":n<a.value?f(t).show():f(t).hide();break;case"<=":case"lteq":case"lessthenequal":case"less-then-equal":case"LessThenEqual":case"eqlt":n<=a.value?f(t).show():f(t).hide();break;case">=":case"gteq":case"greaterthenequal":case"greater-then-equal":case"GreaterThenEqual":case"eqgt":n>=a.value?f(t).show():f(t).hide();break;case">":case"gt":case"greaterthen":case"greater-then":case"GreaterThen":n>a.value?f(t).show():f(t).hide()}e&&f(document.body).on("input change",f(s),function(e){m(t,a,s,!1)})}function a(a,e){f.each(e,function(e,t){switch(t.type){case"empty":i(a,t,e,!0);break;case"notempty":case"not-empty":case"notEmpty":case"!empty":l(a,t,e,!0);break;case"equal":case"==":case"=":h(a,t,e,!0);break;case"!equal":case"notequal":case"!=":case"not-equal":case"notEqual":d(a,t,e,!0);break;case"regexp":case"expression":case"reg":case"exp":p(a,t,e,!0);break;case"compare":case"comp":r(a,t,e,!0);break;case"length":case"lng":m(a,t,e,!0);break;case"range":v(a,t,e,!0)}})}var t=f.extend({attribute:"wvsdepends",rules:{}},e);return e=t.rules,f.each(e,function(e,t){a(f(e),t)}),this.each(function(){var e=f(this).data(t.attribute.replace("data-","").trim());e&&(f(this).addClass("has-dependent-data"),f.each(e,function(e,t){a(f(this),t)}.bind(this)))})}}(jQuery);
|
|
assets/js/frontend.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
/*!
|
2 |
-
* Variation Swatches for WooCommerce
|
3 |
*
|
4 |
* Author: Emran Ahmed ( emran.bd.08@gmail.com )
|
5 |
-
* Date:
|
6 |
* Released under the GPLv3 license.
|
7 |
*/
|
8 |
/******/ (function(modules) { // webpackBootstrap
|
@@ -43,14 +43,34 @@
|
|
43 |
/******/ // define getter function for harmony exports
|
44 |
/******/ __webpack_require__.d = function(exports, name, getter) {
|
45 |
/******/ if(!__webpack_require__.o(exports, name)) {
|
46 |
-
/******/ Object.defineProperty(exports, name, {
|
47 |
-
/******/ configurable: false,
|
48 |
-
/******/ enumerable: true,
|
49 |
-
/******/ get: getter
|
50 |
-
/******/ });
|
51 |
/******/ }
|
52 |
/******/ };
|
53 |
/******/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
55 |
/******/ __webpack_require__.n = function(module) {
|
56 |
/******/ var getter = module && module.__esModule ?
|
@@ -64,138 +84,51 @@
|
|
64 |
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
65 |
/******/
|
66 |
/******/ // __webpack_public_path__
|
67 |
-
/******/ __webpack_require__.p = "";
|
|
|
68 |
/******/
|
69 |
/******/ // Load entry module and return exports
|
70 |
-
/******/ return __webpack_require__(__webpack_require__.s =
|
71 |
/******/ })
|
72 |
/************************************************************************/
|
73 |
/******/ ({
|
74 |
|
75 |
-
/***/
|
76 |
-
/***/ (function(module,
|
77 |
-
|
78 |
-
jQuery(function ($) {
|
79 |
-
|
80 |
-
Promise.resolve().then(function () {
|
81 |
-
return __webpack_require__(11);
|
82 |
-
}).then(function () {
|
83 |
-
|
84 |
-
// Init on Ajax Popup :)
|
85 |
-
$(document).on('wc_variation_form.wvs', '.variations_form:not(.wvs-loaded)', function (event) {
|
86 |
-
$(this).WooVariationSwatches();
|
87 |
-
});
|
88 |
-
|
89 |
-
// Try to cover all ajax data complete
|
90 |
-
$(document).ajaxComplete(function (event, request, settings) {
|
91 |
-
_.delay(function () {
|
92 |
-
$('.variations_form:not(.wvs-loaded)').each(function () {
|
93 |
-
$(this).wc_variation_form();
|
94 |
-
});
|
95 |
-
}, 100);
|
96 |
-
});
|
97 |
-
|
98 |
-
// Support for Jetpack's Infinite Scroll,
|
99 |
-
$(document.body).on('post-load.wvs', function () {
|
100 |
-
$('.variations_form:not(.wvs-loaded)').each(function () {
|
101 |
-
$(this).wc_variation_form();
|
102 |
-
});
|
103 |
-
});
|
104 |
-
|
105 |
-
// Composite product load
|
106 |
-
// JS API: https://docs.woocommerce.com/document/composite-products/composite-products-js-api-reference/
|
107 |
-
$(document.body).on('wc-composite-initializing', '.composite_data', function (event, composite) {
|
108 |
-
composite.actions.add_action('component_options_state_changed', function (self) {
|
109 |
-
$(self.$component_content).find('.variations_form').removeClass('wvs-loaded wvs-pro-loaded');
|
110 |
-
});
|
111 |
-
|
112 |
-
/* composite.actions.add_action('active_scenarios_updated', (self) => {
|
113 |
-
console.log('active_scenarios_updated')
|
114 |
-
$(self.$component_content).find('.variations_form').removeClass('wvs-loaded wvs-pro-loaded')
|
115 |
-
})*/
|
116 |
-
});
|
117 |
-
|
118 |
-
// Support for Yith Infinite Scroll
|
119 |
-
$(document).on('yith_infs_added_elem.wvs', function () {
|
120 |
-
$('.variations_form:not(.wvs-loaded)').each(function () {
|
121 |
-
$(this).wc_variation_form();
|
122 |
-
});
|
123 |
-
});
|
124 |
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
$(this).wc_variation_form();
|
129 |
-
});
|
130 |
-
});
|
131 |
|
132 |
-
|
133 |
-
$(document).on('wood-images-loaded.wvs', function () {
|
134 |
-
$('.variations_form:not(.wvs-loaded)').each(function () {
|
135 |
-
$(this).wc_variation_form();
|
136 |
-
});
|
137 |
-
});
|
138 |
|
139 |
-
|
140 |
-
$(document).on('berocket_ajax_products_loaded.wvs berocket_ajax_products_infinite_loaded.wvs', function () {
|
141 |
-
$('.variations_form:not(.wvs-loaded)').each(function () {
|
142 |
-
$(this).wc_variation_form();
|
143 |
-
});
|
144 |
-
});
|
145 |
|
146 |
-
|
147 |
-
$('.shop-container .products, .infinite-scroll-wrap').on('append.infiniteScroll', function (event, response, path) {
|
148 |
-
$('.variations_form:not(.wvs-loaded)').each(function () {
|
149 |
-
$(this).wc_variation_form();
|
150 |
-
});
|
151 |
-
});
|
152 |
|
153 |
-
|
154 |
-
$(document).on('facetwp-loaded.wvs', function () {
|
155 |
-
$('.variations_form:not(.wvs-loaded)').each(function () {
|
156 |
-
$(this).wc_variation_form();
|
157 |
-
});
|
158 |
-
});
|
159 |
|
160 |
-
|
161 |
-
$(document).on('nm_infload_after.wvs nm_ajax_shop_update_content.wvs', function () {
|
162 |
-
$('.variations_form:not(.wvs-loaded)').each(function () {
|
163 |
-
$(this).wc_variation_form();
|
164 |
-
});
|
165 |
-
});
|
166 |
|
167 |
-
|
168 |
-
$('body').on('aln_reloaded.wvs', function () {
|
169 |
-
_.delay(function () {
|
170 |
-
$('.variations_form:not(.wvs-loaded)').each(function () {
|
171 |
-
$(this).wc_variation_form();
|
172 |
-
});
|
173 |
-
}, 100);
|
174 |
-
});
|
175 |
-
});
|
176 |
-
}); // end of jquery main wrapper
|
177 |
|
178 |
-
|
179 |
|
180 |
-
|
181 |
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
182 |
|
183 |
-
"
|
184 |
-
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
185 |
-
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
186 |
|
187 |
-
function
|
188 |
|
189 |
// ================================================================
|
190 |
// WooCommerce Variation Swatches
|
|
|
191 |
/*global _, wc_add_to_cart_variation_params, woo_variation_swatches_options */
|
192 |
// ================================================================
|
193 |
-
|
194 |
var WooVariationSwatches = function ($) {
|
195 |
-
|
196 |
var Default = {};
|
197 |
|
198 |
-
var WooVariationSwatches = function () {
|
199 |
function WooVariationSwatches(element, config) {
|
200 |
_classCallCheck(this, WooVariationSwatches);
|
201 |
|
@@ -203,484 +136,434 @@ var WooVariationSwatches = function ($) {
|
|
203 |
this._element = element;
|
204 |
this.$element = $(element);
|
205 |
this._config = $.extend({}, Default, config);
|
206 |
-
this._generated = {};
|
207 |
-
this._out_of_stock = {};
|
208 |
-
this._disabled = {};
|
209 |
this.product_variations = this.$element.data('product_variations') || [];
|
210 |
this.is_ajax_variation = this.product_variations.length < 1;
|
211 |
this.product_id = this.$element.data('product_id');
|
212 |
this.reset_variations = this.$element.find('.reset_variations');
|
213 |
-
|
214 |
-
this.
|
215 |
-
this.
|
216 |
|
217 |
-
this.$element.addClass('wvs-loaded');
|
218 |
-
|
219 |
-
// Call
|
220 |
this.init();
|
221 |
-
this.update();
|
222 |
-
|
223 |
-
// Trigger
|
224 |
-
$(document).trigger('woo_variation_swatches', [this.$element]);
|
225 |
}
|
226 |
|
227 |
_createClass(WooVariationSwatches, [{
|
228 |
-
key:
|
|
|
|
|
|
|
|
|
|
|
|
|
229 |
value: function init() {
|
230 |
-
|
231 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
232 |
var _this = this;
|
233 |
|
234 |
-
this._generated = this.product_variations.reduce(function (obj, variation) {
|
235 |
-
|
236 |
-
Object.keys(variation.attributes).map(function (attribute_name) {
|
237 |
-
if (!obj[attribute_name]) {
|
238 |
-
obj[attribute_name] = [];
|
239 |
-
}
|
240 |
-
|
241 |
-
if (variation.attributes[attribute_name]) {
|
242 |
-
obj[attribute_name].push(variation.attributes[attribute_name]);
|
243 |
-
}
|
244 |
-
});
|
245 |
-
|
246 |
-
return obj;
|
247 |
-
}, {});
|
248 |
-
|
249 |
-
this._out_of_stock = this.product_variations.reduce(function (obj, variation) {
|
250 |
-
|
251 |
-
Object.keys(variation.attributes).map(function (attribute_name) {
|
252 |
-
if (!obj[attribute_name]) {
|
253 |
-
obj[attribute_name] = [];
|
254 |
-
}
|
255 |
-
|
256 |
-
if (variation.attributes[attribute_name] && !variation.is_in_stock) {
|
257 |
-
obj[attribute_name].push(variation.attributes[attribute_name]);
|
258 |
-
}
|
259 |
-
});
|
260 |
-
|
261 |
-
return obj;
|
262 |
-
}, {});
|
263 |
-
|
264 |
// Append Selected Item Template
|
265 |
if (woo_variation_swatches_options.show_variation_label) {
|
266 |
this.$element.find('.variations .label').each(function (index, el) {
|
267 |
-
$(el).append(
|
268 |
});
|
269 |
}
|
270 |
-
|
|
|
|
|
|
|
271 |
this.$element.find('ul.variable-items-wrapper').each(function (i, el) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
272 |
|
273 |
-
|
274 |
-
|
275 |
-
var select = $(this).siblings('select.woo-variation-raw-select');
|
276 |
var selected = '';
|
|
|
|
|
277 |
var options = select.find('option');
|
278 |
var disabled = select.find('option:disabled');
|
279 |
var out_of_stock = select.find('option.enabled.out-of-stock');
|
280 |
var current = select.find('option:selected');
|
281 |
var eq = select.find('option').eq(1);
|
282 |
-
|
283 |
-
var li = $(this).find('li:not(.woo-variation-swatches-variable-item-more)');
|
284 |
-
var reselect_clear = $(this).hasClass('reselect-clear');
|
285 |
-
|
286 |
-
var mouse_event_name = 'click.wvs'; // 'touchstart click';
|
287 |
-
|
288 |
-
var attribute = $(this).data('attribute_name');
|
289 |
-
// let attribute_values = ((_this.is_ajax_variation) ? [] : _this._generated[attribute])
|
290 |
-
// let out_of_stocks = ((_this.is_ajax_variation) ? [] : _this._out_of_stock[attribute])
|
291 |
var selects = [];
|
292 |
var disabled_selects = [];
|
293 |
-
var
|
294 |
-
var $selected_variation_item = $(this).parent().prev().find('.woo-selected-variation-item-name');
|
295 |
-
|
296 |
-
// For Avada FIX
|
297 |
-
if (options.length < 1) {
|
298 |
-
select = $(this).parent().find('select.woo-variation-raw-select');
|
299 |
-
options = select.find('option');
|
300 |
-
disabled = select.find('option:disabled');
|
301 |
-
out_of_stock = select.find('option.enabled.out-of-stock');
|
302 |
-
current = select.find('option:selected');
|
303 |
-
eq = select.find('option').eq(1);
|
304 |
-
}
|
305 |
|
306 |
options.each(function () {
|
307 |
if ($(this).val() !== '') {
|
308 |
selects.push($(this).val());
|
309 |
selected = current.length === 0 ? eq.val() : current.val();
|
310 |
}
|
311 |
-
});
|
312 |
|
313 |
disabled.each(function () {
|
314 |
if ($(this).val() !== '') {
|
315 |
disabled_selects.push($(this).val());
|
316 |
}
|
317 |
-
});
|
318 |
|
319 |
-
// Out Of Stocks
|
320 |
out_of_stock.each(function () {
|
321 |
if ($(this).val() !== '') {
|
322 |
-
|
323 |
}
|
324 |
});
|
325 |
|
326 |
var in_stocks = _.difference(selects, disabled_selects);
|
327 |
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
343 |
|
344 |
-
|
345 |
-
$(this).find('input.wvs-radio-variable-item:radio').prop('disabled', true).prop('checked', false);
|
346 |
}
|
347 |
-
|
348 |
// Default Selected
|
349 |
// We can't use es6 includes for IE11
|
350 |
// in_stocks.includes(attribute_value)
|
351 |
// _.contains(in_stocks, attribute_value)
|
352 |
// _.includes(in_stocks, attribute_value)
|
353 |
-
|
354 |
if (_.includes(in_stocks, attribute_value)) {
|
355 |
-
|
356 |
-
$(
|
357 |
-
$(
|
358 |
-
$(
|
359 |
-
|
360 |
-
$(this).find('input.wvs-radio-variable-item:radio').prop('disabled', false);
|
361 |
|
362 |
if (attribute_value === selected) {
|
363 |
-
|
364 |
-
$(
|
365 |
-
$(
|
366 |
|
367 |
if (woo_variation_swatches_options.show_variation_label) {
|
368 |
-
$selected_variation_item.text(woo_variation_swatches_options.variation_label_separator
|
369 |
}
|
370 |
|
371 |
-
|
372 |
-
$(this).find('input.wvs-radio-variable-item:radio').prop('checked', true);
|
373 |
-
}
|
374 |
}
|
375 |
-
}
|
376 |
|
377 |
-
// Out of Stock
|
378 |
|
379 |
-
if (
|
380 |
-
$(
|
|
|
381 |
}
|
382 |
-
}
|
383 |
-
|
384 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
385 |
|
386 |
-
if (
|
387 |
// Non Selected Item Should Select
|
388 |
-
$(
|
389 |
-
|
390 |
-
|
391 |
var value = $(this).data('value');
|
392 |
select.val(value).trigger('change');
|
393 |
-
select.trigger('click');
|
394 |
|
395 |
-
select.trigger('
|
|
|
396 |
|
397 |
-
if (_this.is_mobile) {
|
398 |
-
select.trigger('touchstart');
|
399 |
-
}
|
400 |
-
|
401 |
-
$(this).trigger('focus'); // Mobile tooltip
|
402 |
-
$(this).trigger('wvs-selected-item', [value, select, _this.$element]); // Custom Event for li
|
403 |
-
});
|
404 |
|
405 |
-
|
406 |
-
|
407 |
-
e.preventDefault();
|
408 |
-
e.stopPropagation();
|
409 |
|
|
|
|
|
|
|
410 |
var value = $(this).val();
|
411 |
-
|
412 |
select.val('').trigger('change');
|
413 |
-
select.trigger('click');
|
414 |
-
|
415 |
-
select.trigger('focusin');
|
416 |
|
417 |
-
if (
|
418 |
-
|
419 |
-
}
|
420 |
|
421 |
-
$(this).trigger('focus'); // Mobile tooltip
|
422 |
-
|
423 |
-
$(this).trigger('wvs-unselected-item', [value, select, _this.$element]); // Custom Event for li
|
424 |
-
});
|
425 |
-
|
426 |
-
// RADIO
|
427 |
|
|
|
|
|
428 |
// On Click trigger change event on Radio button
|
429 |
-
$(this).on(mouse_event_name, 'input.wvs-radio-variable-item:radio', function (e) {
|
430 |
-
|
431 |
-
e.stopPropagation();
|
432 |
|
433 |
-
|
|
|
|
|
|
|
|
|
434 |
});
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
e.preventDefault();
|
439 |
-
e.stopPropagation();
|
440 |
|
441 |
if (params && params.radioChange) {
|
442 |
-
|
443 |
var value = $(this).val();
|
444 |
var is_selected = $(this).parent('li.radio-variable-item').hasClass('selected');
|
445 |
|
446 |
if (is_selected) {
|
447 |
select.val('').trigger('change');
|
448 |
-
$(this).parent('li.radio-variable-item').trigger('wvs-unselected-item', [value, select,
|
449 |
} else {
|
450 |
select.val(value).trigger('change');
|
451 |
-
$(this).parent('li.radio-variable-item').trigger('wvs-selected-item', [value, select,
|
452 |
}
|
453 |
|
454 |
-
select.trigger('click');
|
455 |
-
|
456 |
-
if (
|
457 |
-
select.trigger('touchstart');
|
458 |
}
|
459 |
}
|
460 |
});
|
461 |
} else {
|
462 |
-
|
463 |
-
$(this).on(mouse_event_name, 'li:not(.radio-variable-item):not(.woo-variation-swatches-variable-item-more)', function (event) {
|
464 |
-
|
465 |
event.preventDefault();
|
466 |
event.stopPropagation();
|
467 |
-
|
468 |
var value = $(this).data('value');
|
469 |
select.val(value).trigger('change');
|
470 |
-
select.trigger('click');
|
471 |
-
select.trigger('focusin');
|
472 |
-
if (_this.is_mobile) {
|
473 |
-
select.trigger('touchstart');
|
474 |
-
}
|
475 |
|
476 |
-
|
|
|
477 |
|
478 |
-
$(this).trigger('wvs-selected-item', [value, select, _this._element]); // Custom Event for li
|
479 |
-
});
|
480 |
|
481 |
-
|
482 |
-
|
|
|
|
|
483 |
event.preventDefault();
|
484 |
event.stopPropagation();
|
485 |
-
|
486 |
var value = $(this).val();
|
487 |
-
|
488 |
select.val(value).trigger('change');
|
489 |
-
select.trigger('click');
|
490 |
-
select.trigger('focusin');
|
491 |
|
492 |
-
if (
|
493 |
-
|
494 |
-
}
|
495 |
|
496 |
-
|
497 |
-
$(this).parent('li.radio-variable-item').removeClass('selected disabled').addClass('selected');
|
498 |
-
$(this).parent('li.radio-variable-item').trigger('wvs-selected-item', [value, select,
|
499 |
});
|
500 |
-
}
|
501 |
|
502 |
-
|
503 |
-
$(
|
504 |
if (event.keyCode && 32 === event.keyCode || event.key && ' ' === event.key || event.keyCode && 13 === event.keyCode || event.key && 'enter' === event.key.toLowerCase()) {
|
505 |
event.preventDefault();
|
506 |
-
$(this).trigger(
|
507 |
}
|
508 |
});
|
509 |
});
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
|
|
514 |
}
|
515 |
}, {
|
516 |
-
key:
|
517 |
value: function update() {
|
|
|
518 |
|
519 |
-
|
520 |
-
this.$element.off('woocommerce_variation_has_changed.wvs');
|
521 |
this.$element.on('woocommerce_variation_has_changed.wvs', function (event) {
|
522 |
-
|
523 |
-
// Don't use any propagation. It will disable composit product functionality
|
524 |
// event.stopPropagation();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
525 |
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
var
|
530 |
-
var options = select.find('option');
|
531 |
-
var disabled = select.find('option:disabled');
|
532 |
-
var out_of_stock = select.find('option.enabled.out-of-stock');
|
533 |
-
var current = select.find('option:selected');
|
534 |
-
var eq = select.find('option').eq(1);
|
535 |
-
var li = $(this).find('li:not(.woo-variation-swatches-variable-item-more)');
|
536 |
-
|
537 |
-
//let reselect_clear = $(this).hasClass('reselect-clear');
|
538 |
-
//let is_mobile = $('body').hasClass('woo-variation-swatches-on-mobile');
|
539 |
-
//let mouse_event_name = 'click.wvs'; // 'touchstart click';
|
540 |
-
|
541 |
-
var attribute = $(this).data('attribute_name');
|
542 |
-
// let attribute_values = ((_this.is_ajax_variation) ? [] : _this._generated[attribute])
|
543 |
-
// let out_of_stocks = ((_this.is_ajax_variation) ? [] : _this._out_of_stock[attribute])
|
544 |
-
|
545 |
-
var selects = [];
|
546 |
-
var disabled_selects = [];
|
547 |
-
var out_of_stock_selects = [];
|
548 |
-
var $selected_variation_item = $(this).parent().prev().find('.woo-selected-variation-item-name');
|
549 |
-
|
550 |
-
// For Avada FIX
|
551 |
-
if (options.length < 1) {
|
552 |
-
select = $(this).parent().find('select.woo-variation-raw-select');
|
553 |
-
options = select.find('option');
|
554 |
-
disabled = select.find('option:disabled');
|
555 |
-
out_of_stock = select.find('option.enabled.out-of-stock');
|
556 |
-
current = select.find('option:selected');
|
557 |
-
eq = select.find('option').eq(1);
|
558 |
-
}
|
559 |
-
|
560 |
-
options.each(function () {
|
561 |
-
if ($(this).val() !== '') {
|
562 |
-
selects.push($(this).val());
|
563 |
-
// selected = current ? current.val() : eq.val()
|
564 |
-
selected = current.length === 0 ? eq.val() : current.val();
|
565 |
-
}
|
566 |
-
});
|
567 |
-
|
568 |
-
disabled.each(function () {
|
569 |
-
if ($(this).val() !== '') {
|
570 |
-
disabled_selects.push($(this).val());
|
571 |
-
}
|
572 |
-
});
|
573 |
-
|
574 |
-
// Out Of Stocks
|
575 |
-
out_of_stock.each(function () {
|
576 |
-
if ($(this).val() !== '') {
|
577 |
-
out_of_stock_selects.push($(this).val());
|
578 |
-
}
|
579 |
-
});
|
580 |
-
|
581 |
-
var in_stocks = _.difference(selects, disabled_selects);
|
582 |
-
|
583 |
-
var available = _.difference(in_stocks, out_of_stock_selects);
|
584 |
-
|
585 |
-
if (_this.is_ajax_variation) {
|
586 |
-
|
587 |
-
li.each(function (index, el) {
|
588 |
|
589 |
-
|
590 |
-
var attribute_title = $(this).attr('data-title');
|
591 |
|
592 |
-
|
593 |
-
|
|
|
594 |
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
}
|
599 |
|
600 |
-
if (
|
601 |
-
|
602 |
-
$(this).attr('aria-checked', 'true');
|
603 |
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
|
608 |
-
|
609 |
-
$(this).find('input.wvs-radio-variable-item:radio').prop('disabled', false).prop('checked', true);
|
610 |
-
}
|
611 |
}
|
612 |
-
|
613 |
-
$(this).trigger('wvs-item-updated', [selected, attribute_value, _this]);
|
614 |
});
|
615 |
-
}
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
621 |
|
622 |
-
|
623 |
-
|
624 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
625 |
|
626 |
-
|
627 |
-
|
628 |
-
|
|
|
629 |
|
630 |
-
|
631 |
-
|
632 |
-
// if (selects.includes(value))
|
633 |
|
634 |
-
|
635 |
-
|
636 |
-
// _.contains(in_stocks, attribute_value)
|
637 |
-
// _.includes(in_stocks, attribute_value)
|
638 |
|
639 |
-
|
640 |
-
|
|
|
641 |
|
642 |
-
|
643 |
-
$(this).removeAttr('aria-hidden');
|
644 |
-
$(this).attr('tabindex', '0');
|
645 |
|
646 |
-
|
647 |
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
652 |
|
653 |
-
|
|
|
|
|
|
|
|
|
|
|
654 |
|
655 |
-
|
656 |
-
|
657 |
|
658 |
-
|
659 |
-
|
660 |
-
|
|
|
661 |
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
|
|
667 |
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
|
673 |
-
|
674 |
-
|
675 |
}
|
|
|
|
|
676 |
|
677 |
-
|
678 |
-
$(this).trigger('wvs-items-updated');
|
679 |
-
});
|
680 |
-
});
|
681 |
}
|
682 |
}], [{
|
683 |
-
key:
|
684 |
value: function _jQueryInterface(config) {
|
685 |
return this.each(function () {
|
686 |
new WooVariationSwatches(this, config);
|
@@ -690,15 +573,16 @@ var WooVariationSwatches = function ($) {
|
|
690 |
|
691 |
return WooVariationSwatches;
|
692 |
}();
|
693 |
-
|
694 |
/**
|
695 |
* ------------------------------------------------------------------------
|
696 |
* jQuery
|
697 |
* ------------------------------------------------------------------------
|
698 |
*/
|
699 |
|
|
|
700 |
$.fn['WooVariationSwatches'] = WooVariationSwatches._jQueryInterface;
|
701 |
$.fn['WooVariationSwatches'].Constructor = WooVariationSwatches;
|
|
|
702 |
$.fn['WooVariationSwatches'].noConflict = function () {
|
703 |
$.fn['WooVariationSwatches'] = $.fn['WooVariationSwatches'];
|
704 |
return WooVariationSwatches._jQueryInterface;
|
@@ -711,10 +595,114 @@ var WooVariationSwatches = function ($) {
|
|
711 |
|
712 |
/***/ }),
|
713 |
|
714 |
-
/***/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
715 |
/***/ (function(module, exports, __webpack_require__) {
|
716 |
|
717 |
-
module.exports = __webpack_require__(
|
718 |
|
719 |
|
720 |
/***/ })
|
1 |
/*!
|
2 |
+
* Variation Swatches for WooCommerce
|
3 |
*
|
4 |
* Author: Emran Ahmed ( emran.bd.08@gmail.com )
|
5 |
+
* Date: 6/13/2022, 4:04:45 PM
|
6 |
* Released under the GPLv3 license.
|
7 |
*/
|
8 |
/******/ (function(modules) { // webpackBootstrap
|
43 |
/******/ // define getter function for harmony exports
|
44 |
/******/ __webpack_require__.d = function(exports, name, getter) {
|
45 |
/******/ if(!__webpack_require__.o(exports, name)) {
|
46 |
+
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
|
|
|
|
|
|
|
|
47 |
/******/ }
|
48 |
/******/ };
|
49 |
/******/
|
50 |
+
/******/ // define __esModule on exports
|
51 |
+
/******/ __webpack_require__.r = function(exports) {
|
52 |
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
53 |
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
54 |
+
/******/ }
|
55 |
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
56 |
+
/******/ };
|
57 |
+
/******/
|
58 |
+
/******/ // create a fake namespace object
|
59 |
+
/******/ // mode & 1: value is a module id, require it
|
60 |
+
/******/ // mode & 2: merge all properties of value into the ns
|
61 |
+
/******/ // mode & 4: return value when already ns object
|
62 |
+
/******/ // mode & 8|1: behave like require
|
63 |
+
/******/ __webpack_require__.t = function(value, mode) {
|
64 |
+
/******/ if(mode & 1) value = __webpack_require__(value);
|
65 |
+
/******/ if(mode & 8) return value;
|
66 |
+
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
67 |
+
/******/ var ns = Object.create(null);
|
68 |
+
/******/ __webpack_require__.r(ns);
|
69 |
+
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
70 |
+
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
71 |
+
/******/ return ns;
|
72 |
+
/******/ };
|
73 |
+
/******/
|
74 |
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
75 |
/******/ __webpack_require__.n = function(module) {
|
76 |
/******/ var getter = module && module.__esModule ?
|
84 |
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
85 |
/******/
|
86 |
/******/ // __webpack_public_path__
|
87 |
+
/******/ __webpack_require__.p = "/";
|
88 |
+
/******/
|
89 |
/******/
|
90 |
/******/ // Load entry module and return exports
|
91 |
+
/******/ return __webpack_require__(__webpack_require__.s = 1);
|
92 |
/******/ })
|
93 |
/************************************************************************/
|
94 |
/******/ ({
|
95 |
|
96 |
+
/***/ "./src/js/WooVariationSwatches.js":
|
97 |
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
|
99 |
+
"use strict";
|
100 |
+
__webpack_require__.r(__webpack_exports__);
|
101 |
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
|
|
|
|
|
102 |
|
103 |
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
|
|
|
|
|
|
|
|
|
104 |
|
105 |
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
|
|
|
|
|
|
|
|
|
106 |
|
107 |
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
|
|
|
|
|
|
|
|
|
108 |
|
109 |
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
|
|
|
|
|
|
|
|
|
110 |
|
111 |
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
|
|
|
|
|
|
|
|
|
112 |
|
113 |
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
|
115 |
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
116 |
|
117 |
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
|
118 |
|
119 |
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
|
|
|
120 |
|
121 |
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
122 |
|
123 |
// ================================================================
|
124 |
// WooCommerce Variation Swatches
|
125 |
+
|
126 |
/*global _, wc_add_to_cart_variation_params, woo_variation_swatches_options */
|
127 |
// ================================================================
|
|
|
128 |
var WooVariationSwatches = function ($) {
|
|
|
129 |
var Default = {};
|
130 |
|
131 |
+
var WooVariationSwatches = /*#__PURE__*/function () {
|
132 |
function WooVariationSwatches(element, config) {
|
133 |
_classCallCheck(this, WooVariationSwatches);
|
134 |
|
136 |
this._element = element;
|
137 |
this.$element = $(element);
|
138 |
this._config = $.extend({}, Default, config);
|
|
|
|
|
|
|
139 |
this.product_variations = this.$element.data('product_variations') || [];
|
140 |
this.is_ajax_variation = this.product_variations.length < 1;
|
141 |
this.product_id = this.$element.data('product_id');
|
142 |
this.reset_variations = this.$element.find('.reset_variations');
|
143 |
+
this.attributeFields = this.$element.find('.variations select');
|
144 |
+
this.selected_item_template = "<span class=\"woo-selected-variation-item-name\" data-default=\"\"></span>";
|
145 |
+
this.$element.addClass('wvs-loaded'); // Call
|
146 |
|
|
|
|
|
|
|
147 |
this.init();
|
148 |
+
this.update(); // Trigger
|
149 |
+
// $(document).trigger('woo_variation_swatches', [this.$element])
|
|
|
|
|
150 |
}
|
151 |
|
152 |
_createClass(WooVariationSwatches, [{
|
153 |
+
key: "isAjaxVariation",
|
154 |
+
value: function isAjaxVariation() {
|
155 |
+
//this.product_variations = this.$element.data('product_variations') || []
|
156 |
+
return this.is_ajax_variation; // = this.product_variations.length < 1
|
157 |
+
}
|
158 |
+
}, {
|
159 |
+
key: "init",
|
160 |
value: function init() {
|
161 |
+
this.prepareLabel();
|
162 |
+
this.prepareItems();
|
163 |
+
this.setupItems();
|
164 |
+
this.setupEvents();
|
165 |
+
this.setUpStockInfo();
|
166 |
+
}
|
167 |
+
}, {
|
168 |
+
key: "prepareLabel",
|
169 |
+
value: function prepareLabel() {
|
170 |
var _this = this;
|
171 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
// Append Selected Item Template
|
173 |
if (woo_variation_swatches_options.show_variation_label) {
|
174 |
this.$element.find('.variations .label').each(function (index, el) {
|
175 |
+
$(el).append(_this.selected_item_template);
|
176 |
});
|
177 |
}
|
178 |
+
}
|
179 |
+
}, {
|
180 |
+
key: "prepareItems",
|
181 |
+
value: function prepareItems() {
|
182 |
this.$element.find('ul.variable-items-wrapper').each(function (i, el) {
|
183 |
+
$(el).parent().addClass('woo-variation-items-wrapper');
|
184 |
+
});
|
185 |
+
}
|
186 |
+
}, {
|
187 |
+
key: "setupItems",
|
188 |
+
value: function setupItems() {
|
189 |
+
var _this2 = this;
|
190 |
|
191 |
+
var self = this;
|
192 |
+
this.$element.find('ul.variable-items-wrapper').each(function (i, element) {
|
|
|
193 |
var selected = '';
|
194 |
+
var $selected_variation_item = $(element).parent().prev().find('.woo-selected-variation-item-name');
|
195 |
+
var select = $(element).parent().find('select.woo-variation-raw-select');
|
196 |
var options = select.find('option');
|
197 |
var disabled = select.find('option:disabled');
|
198 |
var out_of_stock = select.find('option.enabled.out-of-stock');
|
199 |
var current = select.find('option:selected');
|
200 |
var eq = select.find('option').eq(1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
var selects = [];
|
202 |
var disabled_selects = [];
|
203 |
+
var out_of_stocks = []; // All Options
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
|
205 |
options.each(function () {
|
206 |
if ($(this).val() !== '') {
|
207 |
selects.push($(this).val());
|
208 |
selected = current.length === 0 ? eq.val() : current.val();
|
209 |
}
|
210 |
+
}); // Disabled
|
211 |
|
212 |
disabled.each(function () {
|
213 |
if ($(this).val() !== '') {
|
214 |
disabled_selects.push($(this).val());
|
215 |
}
|
216 |
+
}); // Out Of Stocks
|
217 |
|
|
|
218 |
out_of_stock.each(function () {
|
219 |
if ($(this).val() !== '') {
|
220 |
+
out_of_stocks.push($(this).val());
|
221 |
}
|
222 |
});
|
223 |
|
224 |
var in_stocks = _.difference(selects, disabled_selects);
|
225 |
|
226 |
+
_this2.setupItem(element, selected, in_stocks, out_of_stocks, $selected_variation_item);
|
227 |
+
});
|
228 |
+
}
|
229 |
+
}, {
|
230 |
+
key: "setupItem",
|
231 |
+
value: function setupItem(element, selected, in_stocks, out_of_stocks, $selected_variation_item) {
|
232 |
+
var _this3 = this;
|
233 |
+
|
234 |
+
// Mark Selected
|
235 |
+
$(element).find('li.variable-item').each(function (index, el) {
|
236 |
+
var attribute_value = $(el).attr('data-value');
|
237 |
+
var attribute_title = $(el).attr('data-title'); // Resetting LI
|
238 |
+
|
239 |
+
$(el).removeClass('selected disabled no-stock').addClass('disabled');
|
240 |
+
$(el).attr('aria-checked', 'false');
|
241 |
+
$(el).attr('tabindex', '-1');
|
242 |
+
$(el).attr('data-wvstooltip-out-of-stock', '');
|
243 |
+
$(el).find('input.variable-item-radio-input:radio').prop('disabled', true).prop('checked', false); // To Prevent blink
|
244 |
+
|
245 |
+
if (selected.length < 1 && woo_variation_swatches_options.show_variation_label) {
|
246 |
+
$selected_variation_item.text('');
|
247 |
+
} // Ajax variation
|
248 |
+
|
249 |
+
|
250 |
+
if (_this3.isAjaxVariation()) {
|
251 |
+
$(el).find('input.variable-item-radio-input:radio').prop('disabled', false);
|
252 |
+
$(el).removeClass('selected disabled no-stock'); // Selected
|
253 |
+
|
254 |
+
if (attribute_value === selected) {
|
255 |
+
$(el).addClass('selected');
|
256 |
+
$(el).attr('aria-checked', 'true');
|
257 |
+
$(el).attr('tabindex', '0');
|
258 |
+
$(el).find('input.variable-item-radio-input:radio').prop('disabled', false).prop('checked', true);
|
259 |
+
|
260 |
+
if (woo_variation_swatches_options.show_variation_label) {
|
261 |
+
$selected_variation_item.text("".concat(woo_variation_swatches_options.variation_label_separator, " ").concat(attribute_title));
|
262 |
+
}
|
263 |
|
264 |
+
$(el).trigger('wvs-item-updated', [selected, attribute_value]);
|
|
|
265 |
}
|
266 |
+
} else {
|
267 |
// Default Selected
|
268 |
// We can't use es6 includes for IE11
|
269 |
// in_stocks.includes(attribute_value)
|
270 |
// _.contains(in_stocks, attribute_value)
|
271 |
// _.includes(in_stocks, attribute_value)
|
|
|
272 |
if (_.includes(in_stocks, attribute_value)) {
|
273 |
+
$(el).removeClass('selected disabled');
|
274 |
+
$(el).removeAttr('aria-hidden');
|
275 |
+
$(el).attr('tabindex', '0');
|
276 |
+
$(el).find('input.variable-item-radio-input:radio').prop('disabled', false); // Selected
|
|
|
|
|
277 |
|
278 |
if (attribute_value === selected) {
|
279 |
+
$(el).addClass('selected');
|
280 |
+
$(el).attr('aria-checked', 'true');
|
281 |
+
$(el).find('input.variable-item-radio-input:radio').prop('checked', true);
|
282 |
|
283 |
if (woo_variation_swatches_options.show_variation_label) {
|
284 |
+
$selected_variation_item.text("".concat(woo_variation_swatches_options.variation_label_separator, " ").concat(attribute_title));
|
285 |
}
|
286 |
|
287 |
+
$(el).trigger('wvs-item-updated', [selected, attribute_value]);
|
|
|
|
|
288 |
}
|
289 |
+
} // Out of Stock
|
290 |
|
|
|
291 |
|
292 |
+
if (_.includes(out_of_stocks, attribute_value) && woo_variation_swatches_options.clickable_out_of_stock) {
|
293 |
+
$(el).removeClass('disabled').addClass('no-stock');
|
294 |
+
$(el).attr('data-wvstooltip-out-of-stock', woo_variation_swatches_options.out_of_stock_tooltip_text);
|
295 |
}
|
296 |
+
}
|
297 |
+
});
|
298 |
+
}
|
299 |
+
}, {
|
300 |
+
key: "setupEvents",
|
301 |
+
value: function setupEvents() {
|
302 |
+
var self = this;
|
303 |
+
this.$element.find('ul.variable-items-wrapper').each(function (i, element) {
|
304 |
+
var select = $(element).parent().find('select.woo-variation-raw-select'); // Trigger Select event based on list
|
305 |
|
306 |
+
if (woo_variation_swatches_options.clear_on_reselect) {
|
307 |
// Non Selected Item Should Select
|
308 |
+
$(element).on('click.wvs', 'li.variable-item:not(.selected):not(.radio-variable-item)', function (event) {
|
309 |
+
event.preventDefault();
|
310 |
+
event.stopPropagation();
|
311 |
var value = $(this).data('value');
|
312 |
select.val(value).trigger('change');
|
313 |
+
select.trigger('click'); // select.trigger('focusin')
|
314 |
|
315 |
+
if (woo_variation_swatches_options.is_mobile) {// select.trigger('touchstart')
|
316 |
+
} // $(this).trigger('focus') // Mobile tooltip
|
317 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
318 |
|
319 |
+
$(this).trigger('wvs-selected-item', [value, select, self.$element]); // Custom Event for li
|
320 |
+
}); // Selected Item Should un Select
|
|
|
|
|
321 |
|
322 |
+
$(element).on('click.wvs', 'li.variable-item.selected:not(.radio-variable-item)', function (event) {
|
323 |
+
event.preventDefault();
|
324 |
+
event.stopPropagation();
|
325 |
var value = $(this).val();
|
|
|
326 |
select.val('').trigger('change');
|
327 |
+
select.trigger('click'); //select.trigger('focusin')
|
|
|
|
|
328 |
|
329 |
+
if (woo_variation_swatches_options.is_mobile) {// select.trigger('touchstart')
|
330 |
+
} // $(this).trigger('focus') // Mobile tooltip
|
|
|
331 |
|
|
|
|
|
|
|
|
|
|
|
|
|
332 |
|
333 |
+
$(this).trigger('wvs-unselected-item', [value, select, self.$element]); // Custom Event for li
|
334 |
+
}); // RADIO
|
335 |
// On Click trigger change event on Radio button
|
|
|
|
|
|
|
336 |
|
337 |
+
$(element).on('click.wvs', 'input.variable-item-radio-input:radio', function (event) {
|
338 |
+
event.stopPropagation();
|
339 |
+
$(this).trigger('change.wvs', {
|
340 |
+
radioChange: true
|
341 |
+
});
|
342 |
});
|
343 |
+
$(element).on('change.wvs', 'input.variable-item-radio-input:radio', function (event, params) {
|
344 |
+
event.preventDefault();
|
345 |
+
event.stopPropagation();
|
|
|
|
|
346 |
|
347 |
if (params && params.radioChange) {
|
|
|
348 |
var value = $(this).val();
|
349 |
var is_selected = $(this).parent('li.radio-variable-item').hasClass('selected');
|
350 |
|
351 |
if (is_selected) {
|
352 |
select.val('').trigger('change');
|
353 |
+
$(this).parent('li.radio-variable-item').trigger('wvs-unselected-item', [value, select, self.$element]); // Custom Event for li
|
354 |
} else {
|
355 |
select.val(value).trigger('change');
|
356 |
+
$(this).parent('li.radio-variable-item').trigger('wvs-selected-item', [value, select, self.$element]); // Custom Event for li
|
357 |
}
|
358 |
|
359 |
+
select.trigger('click'); //select.trigger('focusin')
|
360 |
+
|
361 |
+
if (woo_variation_swatches_options.is_mobile) {// select.trigger('touchstart')
|
|
|
362 |
}
|
363 |
}
|
364 |
});
|
365 |
} else {
|
366 |
+
$(element).on('click.wvs', 'li.variable-item:not(.radio-variable-item)', function (event) {
|
|
|
|
|
367 |
event.preventDefault();
|
368 |
event.stopPropagation();
|
|
|
369 |
var value = $(this).data('value');
|
370 |
select.val(value).trigger('change');
|
371 |
+
select.trigger('click'); // select.trigger('focusin')
|
|
|
|
|
|
|
|
|
372 |
|
373 |
+
if (woo_variation_swatches_options.is_mobile) {// select.trigger('touchstart')
|
374 |
+
} // $(this).trigger('focus') // Mobile tooltip
|
375 |
|
|
|
|
|
376 |
|
377 |
+
$(this).trigger('wvs-selected-item', [value, select, self._element]); // Custom Event for li
|
378 |
+
}); // Radio
|
379 |
+
|
380 |
+
$(element).on('change.wvs', 'input.variable-item-radio-input:radio', function (event) {
|
381 |
event.preventDefault();
|
382 |
event.stopPropagation();
|
|
|
383 |
var value = $(this).val();
|
|
|
384 |
select.val(value).trigger('change');
|
385 |
+
select.trigger('click'); // select.trigger('focusin')
|
|
|
386 |
|
387 |
+
if (woo_variation_swatches_options.is_mobile) {// select.trigger('touchstart')
|
388 |
+
} // Radio
|
|
|
389 |
|
390 |
+
|
391 |
+
$(this).parent('li.radio-variable-item').removeClass('selected disabled no-stock').addClass('selected');
|
392 |
+
$(this).parent('li.radio-variable-item').trigger('wvs-selected-item', [value, select, self.$element]); // Custom Event for li
|
393 |
});
|
394 |
+
} // Keyboard Access
|
395 |
|
396 |
+
|
397 |
+
$(element).on('keydown.wvs', 'li.variable-item:not(.disabled)', function (event) {
|
398 |
if (event.keyCode && 32 === event.keyCode || event.key && ' ' === event.key || event.keyCode && 13 === event.keyCode || event.key && 'enter' === event.key.toLowerCase()) {
|
399 |
event.preventDefault();
|
400 |
+
$(this).trigger('click');
|
401 |
}
|
402 |
});
|
403 |
});
|
404 |
+
this.$element.on('click.wvs', '.woo-variation-swatches-variable-item-more', function (event) {
|
405 |
+
event.preventDefault();
|
406 |
+
$(this).parent().removeClass('enabled-display-limit-mode enabled-catalog-display-limit-mode');
|
407 |
+
$(this).remove();
|
408 |
+
});
|
409 |
}
|
410 |
}, {
|
411 |
+
key: "update",
|
412 |
value: function update() {
|
413 |
+
var _this4 = this;
|
414 |
|
415 |
+
// this.$element.off('woocommerce_variation_has_changed.wvs')
|
|
|
416 |
this.$element.on('woocommerce_variation_has_changed.wvs', function (event) {
|
417 |
+
// Don't use any propagation. It will disable composite product functionality
|
|
|
418 |
// event.stopPropagation();
|
419 |
+
_this4.setupItems();
|
420 |
+
});
|
421 |
+
}
|
422 |
+
}, {
|
423 |
+
key: "setUpStockInfo",
|
424 |
+
value: function setUpStockInfo() {
|
425 |
+
var _this5 = this;
|
426 |
|
427 |
+
if (woo_variation_swatches_options.show_variation_stock) {
|
428 |
+
var max_stock_label = parseInt(woo_variation_swatches_options.stock_label_threshold, 10);
|
429 |
+
this.$element.on('wvs-selected-item.wc-variation-form', function () {
|
430 |
+
var attributes = _this5.getChosenAttributes();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
431 |
|
432 |
+
var variations = _this5.findStockVariations(_this5.product_variations, attributes);
|
|
|
433 |
|
434 |
+
if (attributes.count > 1 && attributes.count === attributes.chosenCount) {
|
435 |
+
_this5.resetStockInfo();
|
436 |
+
}
|
437 |
|
438 |
+
if (attributes.count > 1 && attributes.count === attributes.mayChosenCount) {
|
439 |
+
variations.forEach(function (data) {
|
440 |
+
var stockInfoSelector = "[data-attribute_name=\"".concat(data.attribute_name, "\"] > [data-value=\"").concat(data.attribute_value, "\"]");
|
|
|
441 |
|
442 |
+
if (data.variation.is_in_stock && data.variation.max_qty && data.variation.variation_stock_left && data.variation.max_qty <= max_stock_label) {
|
443 |
+
_this5.$element.find("".concat(stockInfoSelector, " .wvs-stock-left-info")).attr('data-wvs-stock-info', data.variation.variation_stock_left);
|
|
|
444 |
|
445 |
+
_this5.$element.find(stockInfoSelector).addClass('wvs-show-stock-left-info');
|
446 |
+
} else {
|
447 |
+
_this5.$element.find(stockInfoSelector).removeClass('wvs-show-stock-left-info');
|
448 |
|
449 |
+
_this5.$element.find("".concat(stockInfoSelector, " .wvs-stock-left-info")).attr('data-wvs-stock-info', '');
|
|
|
|
|
450 |
}
|
|
|
|
|
451 |
});
|
452 |
+
}
|
453 |
+
});
|
454 |
+
this.$element.on('hide_variation.wc-variation-form', function () {
|
455 |
+
_this5.resetStockInfo();
|
456 |
+
});
|
457 |
+
}
|
458 |
+
}
|
459 |
+
}, {
|
460 |
+
key: "resetStockInfo",
|
461 |
+
value: function resetStockInfo() {
|
462 |
+
this.$element.find('.variable-item').removeClass('wvs-show-stock-left-info');
|
463 |
+
this.$element.find('.wvs-stock-left-info').attr('data-wvs-stock-info', '');
|
464 |
+
}
|
465 |
+
}, {
|
466 |
+
key: "getChosenAttributes",
|
467 |
+
value: function getChosenAttributes() {
|
468 |
+
var data = {};
|
469 |
+
var count = 0;
|
470 |
+
var chosen = 0;
|
471 |
+
this.attributeFields.each(function () {
|
472 |
+
var attribute_name = $(this).data('attribute_name') || $(this).attr('name');
|
473 |
+
var value = $(this).val() || '';
|
474 |
+
|
475 |
+
if (value.length > 0) {
|
476 |
+
chosen++;
|
477 |
+
}
|
478 |
|
479 |
+
count++;
|
480 |
+
data[attribute_name] = value;
|
481 |
+
});
|
482 |
+
return {
|
483 |
+
'count': count,
|
484 |
+
'chosenCount': chosen,
|
485 |
+
'mayChosenCount': chosen + 1,
|
486 |
+
'data': data
|
487 |
+
};
|
488 |
+
}
|
489 |
+
}, {
|
490 |
+
key: "findStockVariations",
|
491 |
+
value: function findStockVariations(allVariations, selectedAttributes) {
|
492 |
+
var found = [];
|
493 |
|
494 |
+
for (var _i = 0, _Object$entries = Object.entries(selectedAttributes.data); _i < _Object$entries.length; _i++) {
|
495 |
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
496 |
+
attribute_name = _Object$entries$_i[0],
|
497 |
+
attribute_value = _Object$entries$_i[1];
|
498 |
|
499 |
+
if (attribute_value.length === 0) {
|
500 |
+
var values = this.$element.find("ul[data-attribute_name='".concat(attribute_name, "']")).data('attribute_values') || [];
|
|
|
501 |
|
502 |
+
var _iterator = _createForOfIteratorHelper(values),
|
503 |
+
_step;
|
|
|
|
|
504 |
|
505 |
+
try {
|
506 |
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
507 |
+
var value = _step.value;
|
508 |
|
509 |
+
var compare = _.extend(selectedAttributes.data, _defineProperty({}, attribute_name, value));
|
|
|
|
|
510 |
|
511 |
+
var matched_variation = this.findMatchingVariations(allVariations, compare);
|
512 |
|
513 |
+
if (matched_variation.length > 0) {
|
514 |
+
var variation = matched_variation.shift();
|
515 |
+
var data = {};
|
516 |
+
data['attribute_name'] = attribute_name;
|
517 |
+
data['attribute_value'] = value;
|
518 |
+
data['variation'] = variation;
|
519 |
+
found.push(data);
|
520 |
+
}
|
521 |
+
}
|
522 |
+
} catch (err) {
|
523 |
+
_iterator.e(err);
|
524 |
+
} finally {
|
525 |
+
_iterator.f();
|
526 |
+
}
|
527 |
+
}
|
528 |
+
}
|
529 |
|
530 |
+
return found;
|
531 |
+
}
|
532 |
+
}, {
|
533 |
+
key: "findMatchingVariations",
|
534 |
+
value: function findMatchingVariations(variations, attributes) {
|
535 |
+
var matching = [];
|
536 |
|
537 |
+
for (var i = 0; i < variations.length; i++) {
|
538 |
+
var variation = variations[i];
|
539 |
|
540 |
+
if (this.isMatch(variation.attributes, attributes)) {
|
541 |
+
matching.push(variation);
|
542 |
+
}
|
543 |
+
}
|
544 |
|
545 |
+
return matching;
|
546 |
+
}
|
547 |
+
}, {
|
548 |
+
key: "isMatch",
|
549 |
+
value: function isMatch(variation_attributes, attributes) {
|
550 |
+
var match = true;
|
551 |
|
552 |
+
for (var attr_name in variation_attributes) {
|
553 |
+
if (variation_attributes.hasOwnProperty(attr_name)) {
|
554 |
+
var val1 = variation_attributes[attr_name];
|
555 |
+
var val2 = attributes[attr_name];
|
556 |
|
557 |
+
if (val1 !== undefined && val2 !== undefined && val1.length !== 0 && val2.length !== 0 && val1 !== val2) {
|
558 |
+
match = false;
|
559 |
}
|
560 |
+
}
|
561 |
+
}
|
562 |
|
563 |
+
return match;
|
|
|
|
|
|
|
564 |
}
|
565 |
}], [{
|
566 |
+
key: "_jQueryInterface",
|
567 |
value: function _jQueryInterface(config) {
|
568 |
return this.each(function () {
|
569 |
new WooVariationSwatches(this, config);
|
573 |
|
574 |
return WooVariationSwatches;
|
575 |
}();
|
|
|
576 |
/**
|
577 |
* ------------------------------------------------------------------------
|
578 |
* jQuery
|
579 |
* ------------------------------------------------------------------------
|
580 |
*/
|
581 |
|
582 |
+
|
583 |
$.fn['WooVariationSwatches'] = WooVariationSwatches._jQueryInterface;
|
584 |
$.fn['WooVariationSwatches'].Constructor = WooVariationSwatches;
|
585 |
+
|
586 |
$.fn['WooVariationSwatches'].noConflict = function () {
|
587 |
$.fn['WooVariationSwatches'] = $.fn['WooVariationSwatches'];
|
588 |
return WooVariationSwatches._jQueryInterface;
|
595 |
|
596 |
/***/ }),
|
597 |
|
598 |
+
/***/ "./src/js/frontend.js":
|
599 |
+
/***/ (function(module, exports, __webpack_require__) {
|
600 |
+
|
601 |
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
602 |
+
|
603 |
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
604 |
+
|
605 |
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
606 |
+
|
607 |
+
jQuery(function ($) {
|
608 |
+
Promise.resolve().then(function () {
|
609 |
+
return _interopRequireWildcard(__webpack_require__("./src/js/WooVariationSwatches.js"));
|
610 |
+
}).then(function () {
|
611 |
+
// Init on Ajax Popup :)
|
612 |
+
$(document).on('wc_variation_form.wvs', '.variations_form:not(.wvs-loaded)', function (event) {
|
613 |
+
$(this).WooVariationSwatches();
|
614 |
+
}); // Any custom product with .woo_variation_swatches_variations_form class to support
|
615 |
+
|
616 |
+
$(document).on('wc_variation_form.wvs', '.woo_variation_swatches_variations_form:not(.wvs-loaded)', function (event) {
|
617 |
+
$(this).WooVariationSwatches();
|
618 |
+
}); // Yith Composite Product
|
619 |
+
|
620 |
+
$(document).on('wc_variation_form.wvs', '.ywcp_inner_selected_container:not(.wvs-loaded)', function (event) {
|
621 |
+
$(this).WooVariationSwatches();
|
622 |
+
}); // Try to cover all ajax data complete
|
623 |
+
|
624 |
+
$(document).ajaxComplete(function (event, request, settings) {
|
625 |
+
_.delay(function () {
|
626 |
+
$('.variations_form:not(.wvs-loaded)').each(function () {// $(this).wc_variation_form()
|
627 |
+
});
|
628 |
+
}, 100);
|
629 |
+
}); // Support for Jetpack's Infinite Scroll,
|
630 |
+
|
631 |
+
$(document.body).on('post-load.wvs', function () {
|
632 |
+
$('.variations_form:not(.wvs-loaded)').each(function () {
|
633 |
+
$(this).wc_variation_form();
|
634 |
+
});
|
635 |
+
}); // Composite product load
|
636 |
+
// JS API: https://docs.woocommerce.com/document/composite-products/composite-products-js-api-reference/
|
637 |
+
|
638 |
+
$(document.body).on('wc-composite-initializing', '.composite_data', function (event, composite) {
|
639 |
+
composite.actions.add_action('component_options_state_changed', function (self) {
|
640 |
+
$(self.$component_content).find('.variations_form').removeClass('wvs-loaded wvs-pro-loaded');
|
641 |
+
});
|
642 |
+
/* composite.actions.add_action('active_scenarios_updated', (self) => {
|
643 |
+
console.log('active_scenarios_updated')
|
644 |
+
$(self.$component_content).find('.variations_form').removeClass('wvs-loaded wvs-pro-loaded')
|
645 |
+
})*/
|
646 |
+
}); // Support for Yith Infinite Scroll
|
647 |
+
|
648 |
+
$(document).on('yith_infs_added_elem.wvs', function () {
|
649 |
+
$('.variations_form:not(.wvs-loaded)').each(function () {
|
650 |
+
$(this).wc_variation_form();
|
651 |
+
});
|
652 |
+
}); // Support for Yith Ajax Filter
|
653 |
+
|
654 |
+
$(document).on('yith-wcan-ajax-filtered.wvs', function () {
|
655 |
+
$('.variations_form:not(.wvs-loaded)').each(function () {
|
656 |
+
$(this).wc_variation_form();
|
657 |
+
});
|
658 |
+
}); // Support for Woodmart theme
|
659 |
+
|
660 |
+
$(document).on('wood-images-loaded.wvs', function () {
|
661 |
+
$('.variations_form:not(.wvs-loaded)').each(function () {
|
662 |
+
$(this).wc_variation_form();
|
663 |
+
});
|
664 |
+
}); // Support for berocket ajax filters
|
665 |
+
|
666 |
+
$(document).on('berocket_ajax_products_loaded.wvs berocket_ajax_products_infinite_loaded.wvs', function () {
|
667 |
+
$('.variations_form:not(.wvs-loaded)').each(function () {
|
668 |
+
$(this).wc_variation_form();
|
669 |
+
});
|
670 |
+
}); // Flatsome Infinite Scroll Support
|
671 |
+
|
672 |
+
$('.shop-container .products, .infinite-scroll-wrap').on('append.infiniteScroll', function (event, response, path) {
|
673 |
+
$('.variations_form:not(.wvs-loaded)').each(function () {
|
674 |
+
$(this).wc_variation_form();
|
675 |
+
});
|
676 |
+
}); // FacetWP Load More
|
677 |
+
|
678 |
+
$(document).on('facetwp-loaded.wvs', function () {
|
679 |
+
$('.variations_form:not(.wvs-loaded)').each(function () {
|
680 |
+
$(this).wc_variation_form();
|
681 |
+
});
|
682 |
+
}); // Savoy Load More
|
683 |
+
|
684 |
+
$(document).on('nm_infload_after.wvs nm_ajax_shop_update_content.wvs', function () {
|
685 |
+
$('.variations_form:not(.wvs-loaded)').each(function () {
|
686 |
+
$(this).wc_variation_form();
|
687 |
+
});
|
688 |
+
}); // WooCommerce Filter Nav
|
689 |
+
|
690 |
+
$('body').on('aln_reloaded.wvs', function () {
|
691 |
+
_.delay(function () {
|
692 |
+
$('.variations_form:not(.wvs-loaded)').each(function () {
|
693 |
+
$(this).wc_variation_form();
|
694 |
+
});
|
695 |
+
}, 100);
|
696 |
+
});
|
697 |
+
});
|
698 |
+
}); // end of jquery main wrapper
|
699 |
+
|
700 |
+
/***/ }),
|
701 |
+
|
702 |
+
/***/ 1:
|
703 |
/***/ (function(module, exports, __webpack_require__) {
|
704 |
|
705 |
+
module.exports = __webpack_require__("./src/js/frontend.js");
|
706 |
|
707 |
|
708 |
/***/ })
|
assets/js/frontend.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(t){var i={};function e(a){if(i[a])return i[a].exports;var o=i[a]={i:a,l:!1,exports:{}};return t[a].call(o.exports,o,o.exports,e),o.l=!0,o.exports}e.m=t,e.c=i,e.d=function(t,i,a){e.o(t,i)||Object.defineProperty(t,i,{configurable:!1,enumerable:!0,get:a})},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,i){return Object.prototype.hasOwnProperty.call(t,i)},e.p="",e(e.s=9)}({10:function(t,i,e){jQuery(function(t){Promise.resolve().then(function(){return e(11)}).then(function(){t(document).on("wc_variation_form.wvs",".variations_form:not(.wvs-loaded)",function(i){t(this).WooVariationSwatches()}),t(document).ajaxComplete(function(i,e,a){_.delay(function(){t(".variations_form:not(.wvs-loaded)").each(function(){t(this).wc_variation_form()})},100)}),t(document.body).on("post-load.wvs",function(){t(".variations_form:not(.wvs-loaded)").each(function(){t(this).wc_variation_form()})}),t(document.body).on("wc-composite-initializing",".composite_data",function(i,e){e.actions.add_action("component_options_state_changed",function(i){t(i.$component_content).find(".variations_form").removeClass("wvs-loaded wvs-pro-loaded")})}),t(document).on("yith_infs_added_elem.wvs",function(){t(".variations_form:not(.wvs-loaded)").each(function(){t(this).wc_variation_form()})}),t(document).on("yith-wcan-ajax-filtered.wvs",function(){t(".variations_form:not(.wvs-loaded)").each(function(){t(this).wc_variation_form()})}),t(document).on("wood-images-loaded.wvs",function(){t(".variations_form:not(.wvs-loaded)").each(function(){t(this).wc_variation_form()})}),t(document).on("berocket_ajax_products_loaded.wvs berocket_ajax_products_infinite_loaded.wvs",function(){t(".variations_form:not(.wvs-loaded)").each(function(){t(this).wc_variation_form()})}),t(".shop-container .products, .infinite-scroll-wrap").on("append.infiniteScroll",function(i,e,a){t(".variations_form:not(.wvs-loaded)").each(function(){t(this).wc_variation_form()})}),t(document).on("facetwp-loaded.wvs",function(){t(".variations_form:not(.wvs-loaded)").each(function(){t(this).wc_variation_form()})}),t(document).on("nm_infload_after.wvs nm_ajax_shop_update_content.wvs",function(){t(".variations_form:not(.wvs-loaded)").each(function(){t(this).wc_variation_form()})}),t("body").on("aln_reloaded.wvs",function(){_.delay(function(){t(".variations_form:not(.wvs-loaded)").each(function(){t(this).wc_variation_form()})},100)})})})},11:function(t,i,e){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var a=function(){function t(t,i){for(var e=0;e<i.length;e++){var a=i[e];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}return function(i,e,a){return e&&t(i.prototype,e),a&&t(i,a),i}}();var o=function(t){var i={},e=function(){function e(a,o){!function(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")}(this,e),this._element=a,this.$element=t(a),this._config=t.extend({},i,o),this._generated={},this._out_of_stock={},this._disabled={},this.product_variations=this.$element.data("product_variations")||[],this.is_ajax_variation=this.product_variations.length<1,this.product_id=this.$element.data("product_id"),this.reset_variations=this.$element.find(".reset_variations"),this.is_mobile=t("body").hasClass("woo-variation-swatches-on-mobile"),this.selected_item_template='<span class="woo-selected-variation-item-name" data-default=""></span>',this.$element.addClass("wvs-loaded"),this.init(),this.update(),t(document).trigger("woo_variation_swatches",[this.$element])}return a(e,[{key:"init",value:function(){var i=this,e=this;this._generated=this.product_variations.reduce(function(t,i){return Object.keys(i.attributes).map(function(e){t[e]||(t[e]=[]),i.attributes[e]&&t[e].push(i.attributes[e])}),t},{}),this._out_of_stock=this.product_variations.reduce(function(t,i){return Object.keys(i.attributes).map(function(e){t[e]||(t[e]=[]),i.attributes[e]&&!i.is_in_stock&&t[e].push(i.attributes[e])}),t},{}),woo_variation_swatches_options.show_variation_label&&this.$element.find(".variations .label").each(function(e,a){t(a).append(i.selected_item_template)}),this.$element.find("ul.variable-items-wrapper").each(function(i,a){t(this).parent().addClass("woo-variation-items-wrapper");var o=t(this).siblings("select.woo-variation-raw-select"),n="",s=o.find("option"),r=o.find("option:disabled"),c=o.find("option.enabled.out-of-stock"),d=o.find("option:selected"),l=o.find("option").eq(1),h=t(this).find("li:not(.woo-variation-swatches-variable-item-more)"),v=t(this).hasClass("reselect-clear"),u=(t(this).data("attribute_name"),[]),f=[],p=[],m=t(this).parent().prev().find(".woo-selected-variation-item-name");s.length<1&&(s=(o=t(this).parent().find("select.woo-variation-raw-select")).find("option"),r=o.find("option:disabled"),c=o.find("option.enabled.out-of-stock"),d=o.find("option:selected"),l=o.find("option").eq(1)),s.each(function(){""!==t(this).val()&&(u.push(t(this).val()),n=0===d.length?l.val():d.val())}),r.each(function(){""!==t(this).val()&&f.push(t(this).val())}),c.each(function(){""!==t(this).val()&&p.push(t(this).val())});var w=_.difference(u,f),g=_.difference(w,p);h.each(function(i,e){var a=t(this).attr("data-value"),o=t(this).attr("data-title");t(this).removeClass("selected disabled out-of-stock").addClass("disabled"),t(this).attr("aria-checked","false"),t(this).attr("tabindex","-1"),t(this).hasClass("radio-variable-item")&&t(this).find("input.wvs-radio-variable-item:radio").prop("disabled",!0).prop("checked",!1),_.includes(w,a)&&(t(this).removeClass("selected disabled"),t(this).removeAttr("aria-hidden"),t(this).attr("tabindex","0"),t(this).find("input.wvs-radio-variable-item:radio").prop("disabled",!1),a===n&&(t(this).addClass("selected"),t(this).attr("aria-checked","true"),woo_variation_swatches_options.show_variation_label&&m.text(woo_variation_swatches_options.variation_label_separator+" "+o),t(this).hasClass("radio-variable-item")&&t(this).find("input.wvs-radio-variable-item:radio").prop("checked",!0))),g.length>0&&_.includes(p,a)&&woo_variation_swatches_options.clickable_out_of_stock&&t(this).removeClass("disabled").addClass("out-of-stock")}),v?(t(this).on("click.wvs","li:not(.selected):not(.radio-variable-item):not(.woo-variation-swatches-variable-item-more)",function(i){i.preventDefault(),i.stopPropagation();var a=t(this).data("value");o.val(a).trigger("change"),o.trigger("click"),o.trigger("focusin"),e.is_mobile&&o.trigger("touchstart"),t(this).trigger("focus"),t(this).trigger("wvs-selected-item",[a,o,e.$element])}),t(this).on("click.wvs","li.selected:not(.radio-variable-item):not(.woo-variation-swatches-variable-item-more)",function(i){i.preventDefault(),i.stopPropagation();var a=t(this).val();o.val("").trigger("change"),o.trigger("click"),o.trigger("focusin"),e.is_mobile&&o.trigger("touchstart"),t(this).trigger("focus"),t(this).trigger("wvs-unselected-item",[a,o,e.$element])}),t(this).on("click.wvs","input.wvs-radio-variable-item:radio",function(i){i.stopPropagation(),t(this).trigger("change.wvs",{radioChange:!0})}),t(this).on("change.wvs","input.wvs-radio-variable-item:radio",function(i,a){if(i.preventDefault(),i.stopPropagation(),a&&a.radioChange){var n=t(this).val();t(this).parent("li.radio-variable-item").hasClass("selected")?(o.val("").trigger("change"),t(this).parent("li.radio-variable-item").trigger("wvs-unselected-item",[n,o,e.$element])):(o.val(n).trigger("change"),t(this).parent("li.radio-variable-item").trigger("wvs-selected-item",[n,o,e.$element])),o.trigger("click"),o.trigger("focusin"),e.is_mobile&&o.trigger("touchstart")}})):(t(this).on("click.wvs","li:not(.radio-variable-item):not(.woo-variation-swatches-variable-item-more)",function(i){i.preventDefault(),i.stopPropagation();var a=t(this).data("value");o.val(a).trigger("change"),o.trigger("click"),o.trigger("focusin"),e.is_mobile&&o.trigger("touchstart"),t(this).trigger("focus"),t(this).trigger("wvs-selected-item",[a,o,e._element])}),t(this).on("change.wvs","input.wvs-radio-variable-item:radio",function(i){i.preventDefault(),i.stopPropagation();var a=t(this).val();o.val(a).trigger("change"),o.trigger("click"),o.trigger("focusin"),e.is_mobile&&o.trigger("touchstart"),t(this).parent("li.radio-variable-item").removeClass("selected disabled").addClass("selected"),t(this).parent("li.radio-variable-item").trigger("wvs-selected-item",[a,o,e.$element])})),t(this).on("keydown.wvs","li:not(.disabled):not(.woo-variation-swatches-variable-item-more)",function(i){(i.keyCode&&32===i.keyCode||i.key&&" "===i.key||i.keyCode&&13===i.keyCode||i.key&&"enter"===i.key.toLowerCase())&&(i.preventDefault(),t(this).trigger("click.wvs"))})}),this.$element.trigger("woo_variation_swatches_init",[this,this.product_variations]),t(document).trigger("woo_variation_swatches_loaded",[this.$element,this.product_variations])}},{key:"update",value:function(){var i=this;this.$element.off("woocommerce_variation_has_changed.wvs"),this.$element.on("woocommerce_variation_has_changed.wvs",function(e){t(this).find("ul.variable-items-wrapper").each(function(e,a){var o=t(this).siblings("select.woo-variation-raw-select"),n="",s=o.find("option"),r=o.find("option:disabled"),c=o.find("option.enabled.out-of-stock"),d=o.find("option:selected"),l=o.find("option").eq(1),h=t(this).find("li:not(.woo-variation-swatches-variable-item-more)"),v=(t(this).data("attribute_name"),[]),u=[],f=[],p=t(this).parent().prev().find(".woo-selected-variation-item-name");s.length<1&&(s=(o=t(this).parent().find("select.woo-variation-raw-select")).find("option"),r=o.find("option:disabled"),c=o.find("option.enabled.out-of-stock"),d=o.find("option:selected"),l=o.find("option").eq(1)),s.each(function(){""!==t(this).val()&&(v.push(t(this).val()),n=0===d.length?l.val():d.val())}),r.each(function(){""!==t(this).val()&&u.push(t(this).val())}),c.each(function(){""!==t(this).val()&&f.push(t(this).val())});var m=_.difference(v,u),w=_.difference(m,f);i.is_ajax_variation?h.each(function(e,a){var o=t(this).attr("data-value"),s=t(this).attr("data-title");t(this).removeClass("selected disabled"),t(this).attr("aria-checked","false"),n.length<1&&woo_variation_swatches_options.show_variation_label&&p.text(""),o===n&&(t(this).addClass("selected"),t(this).attr("aria-checked","true"),woo_variation_swatches_options.show_variation_label&&p.text(woo_variation_swatches_options.variation_label_separator+" "+s),t(this).hasClass("radio-variable-item")&&t(this).find("input.wvs-radio-variable-item:radio").prop("disabled",!1).prop("checked",!0)),t(this).trigger("wvs-item-updated",[n,o,i])}):h.each(function(e,a){var o=t(this).attr("data-value"),s=t(this).attr("data-title");t(this).removeClass("selected disabled out-of-stock").addClass("disabled"),t(this).attr("aria-checked","false"),t(this).attr("tabindex","-1"),t(this).hasClass("radio-variable-item")&&t(this).find("input.wvs-radio-variable-item:radio").prop("disabled",!0).prop("checked",!1),_.includes(m,o)&&(t(this).removeClass("selected disabled"),t(this).removeAttr("aria-hidden"),t(this).attr("tabindex","0"),t(this).find("input.wvs-radio-variable-item:radio").prop("disabled",!1),n.length<1&&woo_variation_swatches_options.show_variation_label&&p.text(""),o===n&&(t(this).addClass("selected"),t(this).attr("aria-checked","true"),woo_variation_swatches_options.show_variation_label&&p.text(woo_variation_swatches_options.variation_label_separator+" "+s),t(this).hasClass("radio-variable-item")&&t(this).find("input.wvs-radio-variable-item:radio").prop("checked",!0))),w.length>0&&_.includes(f,o)&&woo_variation_swatches_options.clickable_out_of_stock&&t(this).removeClass("disabled").addClass("out-of-stock"),t(this).trigger("wvs-item-updated",[n,o,i])}),t(this).trigger("wvs-items-updated")})})}}],[{key:"_jQueryInterface",value:function(t){return this.each(function(){new e(this,t)})}}]),e}();return t.fn.WooVariationSwatches=e._jQueryInterface,t.fn.WooVariationSwatches.Constructor=e,t.fn.WooVariationSwatches.noConflict=function(){return t.fn.WooVariationSwatches=t.fn.WooVariationSwatches,e._jQueryInterface},e}(jQuery);i.default=o},9:function(t,i,e){t.exports=e(10)}});
|
1 |
+
!function(t){var e={};function n(i){if(e[i])return e[i].exports;var a=e[i]={i:i,l:!1,exports:{}};return t[i].call(a.exports,a,a.exports,n),a.l=!0,a.exports}n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var a in t)n.d(i,a,function(e){return t[e]}.bind(null,a));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/",n(n.s=3)}([,,,function(t,e,n){t.exports=n(4)},function(t,e,n){function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(t){if("function"!=typeof WeakMap)return null;var e=new WeakMap,n=new WeakMap;return(a=function(t){return t?n:e})(t)}jQuery((function(t){Promise.resolve().then((function(){return function(t,e){if(!e&&t&&t.__esModule)return t;if(null===t||"object"!==i(t)&&"function"!=typeof t)return{default:t};var n=a(e);if(n&&n.has(t))return n.get(t);var o={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if("default"!==s&&Object.prototype.hasOwnProperty.call(t,s)){var c=r?Object.getOwnPropertyDescriptor(t,s):null;c&&(c.get||c.set)?Object.defineProperty(o,s,c):o[s]=t[s]}return o.default=t,n&&n.set(t,o),o}(n(5))})).then((function(){t(document).on("wc_variation_form.wvs",".variations_form:not(.wvs-loaded)",(function(e){t(this).WooVariationSwatches()})),t(document).on("wc_variation_form.wvs",".woo_variation_swatches_variations_form:not(.wvs-loaded)",(function(e){t(this).WooVariationSwatches()})),t(document).on("wc_variation_form.wvs",".ywcp_inner_selected_container:not(.wvs-loaded)",(function(e){t(this).WooVariationSwatches()})),t(document).ajaxComplete((function(e,n,i){_.delay((function(){t(".variations_form:not(.wvs-loaded)").each((function(){}))}),100)})),t(document.body).on("post-load.wvs",(function(){t(".variations_form:not(.wvs-loaded)").each((function(){t(this).wc_variation_form()}))})),t(document.body).on("wc-composite-initializing",".composite_data",(function(e,n){n.actions.add_action("component_options_state_changed",(function(e){t(e.$component_content).find(".variations_form").removeClass("wvs-loaded wvs-pro-loaded")}))})),t(document).on("yith_infs_added_elem.wvs",(function(){t(".variations_form:not(.wvs-loaded)").each((function(){t(this).wc_variation_form()}))})),t(document).on("yith-wcan-ajax-filtered.wvs",(function(){t(".variations_form:not(.wvs-loaded)").each((function(){t(this).wc_variation_form()}))})),t(document).on("wood-images-loaded.wvs",(function(){t(".variations_form:not(.wvs-loaded)").each((function(){t(this).wc_variation_form()}))})),t(document).on("berocket_ajax_products_loaded.wvs berocket_ajax_products_infinite_loaded.wvs",(function(){t(".variations_form:not(.wvs-loaded)").each((function(){t(this).wc_variation_form()}))})),t(".shop-container .products, .infinite-scroll-wrap").on("append.infiniteScroll",(function(e,n,i){t(".variations_form:not(.wvs-loaded)").each((function(){t(this).wc_variation_form()}))})),t(document).on("facetwp-loaded.wvs",(function(){t(".variations_form:not(.wvs-loaded)").each((function(){t(this).wc_variation_form()}))})),t(document).on("nm_infload_after.wvs nm_ajax_shop_update_content.wvs",(function(){t(".variations_form:not(.wvs-loaded)").each((function(){t(this).wc_variation_form()}))})),t("body").on("aln_reloaded.wvs",(function(){_.delay((function(){t(".variations_form:not(.wvs-loaded)").each((function(){t(this).wc_variation_form()}))}),100)}))}))}))},function(t,e,n){"use strict";function i(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function a(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=r(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,a=function(){};return{s:a,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,c=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){c=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(c)throw o}}}}function o(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var i,a,o=[],r=!0,s=!1;try{for(n=n.call(t);!(r=(i=n.next()).done)&&(o.push(i.value),!e||o.length!==e);r=!0);}catch(t){s=!0,a=t}finally{try{r||null==n.return||n.return()}finally{if(s)throw a}}return o}(t,e)||r(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(t,e){if(t){if("string"==typeof t)return s(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(t,e):void 0}}function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}function c(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}n.r(e);var l=function(t){var e={},n=function(){function n(i,a){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),this._element=i,this.$element=t(i),this._config=t.extend({},e,a),this.product_variations=this.$element.data("product_variations")||[],this.is_ajax_variation=this.product_variations.length<1,this.product_id=this.$element.data("product_id"),this.reset_variations=this.$element.find(".reset_variations"),this.attributeFields=this.$element.find(".variations select"),this.selected_item_template='<span class="woo-selected-variation-item-name" data-default=""></span>',this.$element.addClass("wvs-loaded"),this.init(),this.update()}var r,s,l;return r=n,l=[{key:"_jQueryInterface",value:function(t){return this.each((function(){new n(this,t)}))}}],(s=[{key:"isAjaxVariation",value:function(){return this.is_ajax_variation}},{key:"init",value:function(){this.prepareLabel(),this.prepareItems(),this.setupItems(),this.setupEvents(),this.setUpStockInfo()}},{key:"prepareLabel",value:function(){var e=this;woo_variation_swatches_options.show_variation_label&&this.$element.find(".variations .label").each((function(n,i){t(i).append(e.selected_item_template)}))}},{key:"prepareItems",value:function(){this.$element.find("ul.variable-items-wrapper").each((function(e,n){t(n).parent().addClass("woo-variation-items-wrapper")}))}},{key:"setupItems",value:function(){var e=this;this.$element.find("ul.variable-items-wrapper").each((function(n,i){var a="",o=t(i).parent().prev().find(".woo-selected-variation-item-name"),r=t(i).parent().find("select.woo-variation-raw-select"),s=r.find("option"),c=r.find("option:disabled"),l=r.find("option.enabled.out-of-stock"),u=r.find("option:selected"),d=r.find("option").eq(1),f=[],v=[],h=[];s.each((function(){""!==t(this).val()&&(f.push(t(this).val()),a=0===u.length?d.val():u.val())})),c.each((function(){""!==t(this).val()&&v.push(t(this).val())})),l.each((function(){""!==t(this).val()&&h.push(t(this).val())}));var p=_.difference(f,v);e.setupItem(i,a,p,h,o)}))}},{key:"setupItem",value:function(e,n,i,a,o){var r=this;t(e).find("li.variable-item").each((function(e,s){var c=t(s).attr("data-value"),l=t(s).attr("data-title");t(s).removeClass("selected disabled no-stock").addClass("disabled"),t(s).attr("aria-checked","false"),t(s).attr("tabindex","-1"),t(s).attr("data-wvstooltip-out-of-stock",""),t(s).find("input.variable-item-radio-input:radio").prop("disabled",!0).prop("checked",!1),n.length<1&&woo_variation_swatches_options.show_variation_label&&o.text(""),r.isAjaxVariation()?(t(s).find("input.variable-item-radio-input:radio").prop("disabled",!1),t(s).removeClass("selected disabled no-stock"),c===n&&(t(s).addClass("selected"),t(s).attr("aria-checked","true"),t(s).attr("tabindex","0"),t(s).find("input.variable-item-radio-input:radio").prop("disabled",!1).prop("checked",!0),woo_variation_swatches_options.show_variation_label&&o.text("".concat(woo_variation_swatches_options.variation_label_separator," ").concat(l)),t(s).trigger("wvs-item-updated",[n,c]))):(_.includes(i,c)&&(t(s).removeClass("selected disabled"),t(s).removeAttr("aria-hidden"),t(s).attr("tabindex","0"),t(s).find("input.variable-item-radio-input:radio").prop("disabled",!1),c===n&&(t(s).addClass("selected"),t(s).attr("aria-checked","true"),t(s).find("input.variable-item-radio-input:radio").prop("checked",!0),woo_variation_swatches_options.show_variation_label&&o.text("".concat(woo_variation_swatches_options.variation_label_separator," ").concat(l)),t(s).trigger("wvs-item-updated",[n,c]))),_.includes(a,c)&&woo_variation_swatches_options.clickable_out_of_stock&&(t(s).removeClass("disabled").addClass("no-stock"),t(s).attr("data-wvstooltip-out-of-stock",woo_variation_swatches_options.out_of_stock_tooltip_text)))}))}},{key:"setupEvents",value:function(){var e=this;this.$element.find("ul.variable-items-wrapper").each((function(n,i){var a=t(i).parent().find("select.woo-variation-raw-select");woo_variation_swatches_options.clear_on_reselect?(t(i).on("click.wvs","li.variable-item:not(.selected):not(.radio-variable-item)",(function(n){n.preventDefault(),n.stopPropagation();var i=t(this).data("value");a.val(i).trigger("change"),a.trigger("click"),woo_variation_swatches_options.is_mobile,t(this).trigger("wvs-selected-item",[i,a,e.$element])})),t(i).on("click.wvs","li.variable-item.selected:not(.radio-variable-item)",(function(n){n.preventDefault(),n.stopPropagation();var i=t(this).val();a.val("").trigger("change"),a.trigger("click"),woo_variation_swatches_options.is_mobile,t(this).trigger("wvs-unselected-item",[i,a,e.$element])})),t(i).on("click.wvs","input.variable-item-radio-input:radio",(function(e){e.stopPropagation(),t(this).trigger("change.wvs",{radioChange:!0})})),t(i).on("change.wvs","input.variable-item-radio-input:radio",(function(n,i){if(n.preventDefault(),n.stopPropagation(),i&&i.radioChange){var o=t(this).val();t(this).parent("li.radio-variable-item").hasClass("selected")?(a.val("").trigger("change"),t(this).parent("li.radio-variable-item").trigger("wvs-unselected-item",[o,a,e.$element])):(a.val(o).trigger("change"),t(this).parent("li.radio-variable-item").trigger("wvs-selected-item",[o,a,e.$element])),a.trigger("click"),woo_variation_swatches_options.is_mobile}}))):(t(i).on("click.wvs","li.variable-item:not(.radio-variable-item)",(function(n){n.preventDefault(),n.stopPropagation();var i=t(this).data("value");a.val(i).trigger("change"),a.trigger("click"),woo_variation_swatches_options.is_mobile,t(this).trigger("wvs-selected-item",[i,a,e._element])})),t(i).on("change.wvs","input.variable-item-radio-input:radio",(function(n){n.preventDefault(),n.stopPropagation();var i=t(this).val();a.val(i).trigger("change"),a.trigger("click"),woo_variation_swatches_options.is_mobile,t(this).parent("li.radio-variable-item").removeClass("selected disabled no-stock").addClass("selected"),t(this).parent("li.radio-variable-item").trigger("wvs-selected-item",[i,a,e.$element])}))),t(i).on("keydown.wvs","li.variable-item:not(.disabled)",(function(e){(e.keyCode&&32===e.keyCode||e.key&&" "===e.key||e.keyCode&&13===e.keyCode||e.key&&"enter"===e.key.toLowerCase())&&(e.preventDefault(),t(this).trigger("click"))}))})),this.$element.on("click.wvs",".woo-variation-swatches-variable-item-more",(function(e){e.preventDefault(),t(this).parent().removeClass("enabled-display-limit-mode enabled-catalog-display-limit-mode"),t(this).remove()}))}},{key:"update",value:function(){var t=this;this.$element.on("woocommerce_variation_has_changed.wvs",(function(e){t.setupItems()}))}},{key:"setUpStockInfo",value:function(){var t=this;if(woo_variation_swatches_options.show_variation_stock){var e=parseInt(woo_variation_swatches_options.stock_label_threshold,10);this.$element.on("wvs-selected-item.wc-variation-form",(function(){var n=t.getChosenAttributes(),i=t.findStockVariations(t.product_variations,n);n.count>1&&n.count===n.chosenCount&&t.resetStockInfo(),n.count>1&&n.count===n.mayChosenCount&&i.forEach((function(n){var i='[data-attribute_name="'.concat(n.attribute_name,'"] > [data-value="').concat(n.attribute_value,'"]');n.variation.is_in_stock&&n.variation.max_qty&&n.variation.variation_stock_left&&n.variation.max_qty<=e?(t.$element.find("".concat(i," .wvs-stock-left-info")).attr("data-wvs-stock-info",n.variation.variation_stock_left),t.$element.find(i).addClass("wvs-show-stock-left-info")):(t.$element.find(i).removeClass("wvs-show-stock-left-info"),t.$element.find("".concat(i," .wvs-stock-left-info")).attr("data-wvs-stock-info",""))}))})),this.$element.on("hide_variation.wc-variation-form",(function(){t.resetStockInfo()}))}}},{key:"resetStockInfo",value:function(){this.$element.find(".variable-item").removeClass("wvs-show-stock-left-info"),this.$element.find(".wvs-stock-left-info").attr("data-wvs-stock-info","")}},{key:"getChosenAttributes",value:function(){var e={},n=0,i=0;return this.attributeFields.each((function(){var a=t(this).data("attribute_name")||t(this).attr("name"),o=t(this).val()||"";o.length>0&&i++,n++,e[a]=o})),{count:n,chosenCount:i,mayChosenCount:i+1,data:e}}},{key:"findStockVariations",value:function(t,e){for(var n=[],r=0,s=Object.entries(e.data);r<s.length;r++){var c=o(s[r],2),l=c[0];if(0===c[1].length){var u,d=a(this.$element.find("ul[data-attribute_name='".concat(l,"']")).data("attribute_values")||[]);try{for(d.s();!(u=d.n()).done;){var f=u.value,v=_.extend(e.data,i({},l,f)),h=this.findMatchingVariations(t,v);if(h.length>0){var p=h.shift(),m={};m.attribute_name=l,m.attribute_value=f,m.variation=p,n.push(m)}}}catch(t){d.e(t)}finally{d.f()}}}return n}},{key:"findMatchingVariations",value:function(t,e){for(var n=[],i=0;i<t.length;i++){var a=t[i];this.isMatch(a.attributes,e)&&n.push(a)}return n}},{key:"isMatch",value:function(t,e){var n=!0;for(var i in t)if(t.hasOwnProperty(i)){var a=t[i],o=e[i];void 0!==a&&void 0!==o&&0!==a.length&&0!==o.length&&a!==o&&(n=!1)}return n}}])&&c(r.prototype,s),l&&c(r,l),n}();return t.fn.WooVariationSwatches=n._jQueryInterface,t.fn.WooVariationSwatches.Constructor=n,t.fn.WooVariationSwatches.noConflict=function(){return t.fn.WooVariationSwatches=t.fn.WooVariationSwatches,n._jQueryInterface},n}(jQuery);e.default=l}]);
|
assets/js/gwp-admin.js
DELETED
@@ -1,184 +0,0 @@
|
|
1 |
-
/*!
|
2 |
-
* Variation Swatches for WooCommerce v1.1.19
|
3 |
-
*
|
4 |
-
* Author: Emran Ahmed ( emran.bd.08@gmail.com )
|
5 |
-
* Date: 07/09/2021
|
6 |
-
* Released under the GPLv3 license.
|
7 |
-
*/
|
8 |
-
/******/ (function(modules) { // webpackBootstrap
|
9 |
-
/******/ // The module cache
|
10 |
-
/******/ var installedModules = {};
|
11 |
-
/******/
|
12 |
-
/******/ // The require function
|
13 |
-
/******/ function __webpack_require__(moduleId) {
|
14 |
-
/******/
|
15 |
-
/******/ // Check if module is in cache
|
16 |
-
/******/ if(installedModules[moduleId]) {
|
17 |
-
/******/ return installedModules[moduleId].exports;
|
18 |
-
/******/ }
|
19 |
-
/******/ // Create a new module (and put it into the cache)
|
20 |
-
/******/ var module = installedModules[moduleId] = {
|
21 |
-
/******/ i: moduleId,
|
22 |
-
/******/ l: false,
|
23 |
-
/******/ exports: {}
|
24 |
-
/******/ };
|
25 |
-
/******/
|
26 |
-
/******/ // Execute the module function
|
27 |
-
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
28 |
-
/******/
|
29 |
-
/******/ // Flag the module as loaded
|
30 |
-
/******/ module.l = true;
|
31 |
-
/******/
|
32 |
-
/******/ // Return the exports of the module
|
33 |
-
/******/ return module.exports;
|
34 |
-
/******/ }
|
35 |
-
/******/
|
36 |
-
/******/
|
37 |
-
/******/ // expose the modules object (__webpack_modules__)
|
38 |
-
/******/ __webpack_require__.m = modules;
|
39 |
-
/******/
|
40 |
-
/******/ // expose the module cache
|
41 |
-
/******/ __webpack_require__.c = installedModules;
|
42 |
-
/******/
|
43 |
-
/******/ // define getter function for harmony exports
|
44 |
-
/******/ __webpack_require__.d = function(exports, name, getter) {
|
45 |
-
/******/ if(!__webpack_require__.o(exports, name)) {
|
46 |
-
/******/ Object.defineProperty(exports, name, {
|
47 |
-
/******/ configurable: false,
|
48 |
-
/******/ enumerable: true,
|
49 |
-
/******/ get: getter
|
50 |
-
/******/ });
|
51 |
-
/******/ }
|
52 |
-
/******/ };
|
53 |
-
/******/
|
54 |
-
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
55 |
-
/******/ __webpack_require__.n = function(module) {
|
56 |
-
/******/ var getter = module && module.__esModule ?
|
57 |
-
/******/ function getDefault() { return module['default']; } :
|
58 |
-
/******/ function getModuleExports() { return module; };
|
59 |
-
/******/ __webpack_require__.d(getter, 'a', getter);
|
60 |
-
/******/ return getter;
|
61 |
-
/******/ };
|
62 |
-
/******/
|
63 |
-
/******/ // Object.prototype.hasOwnProperty.call
|
64 |
-
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
65 |
-
/******/
|
66 |
-
/******/ // __webpack_public_path__
|
67 |
-
/******/ __webpack_require__.p = "";
|
68 |
-
/******/
|
69 |
-
/******/ // Load entry module and return exports
|
70 |
-
/******/ return __webpack_require__(__webpack_require__.s = 12);
|
71 |
-
/******/ })
|
72 |
-
/************************************************************************/
|
73 |
-
/******/ ({
|
74 |
-
|
75 |
-
/***/ 12:
|
76 |
-
/***/ (function(module, exports, __webpack_require__) {
|
77 |
-
|
78 |
-
module.exports = __webpack_require__(13);
|
79 |
-
|
80 |
-
|
81 |
-
/***/ }),
|
82 |
-
|
83 |
-
/***/ 13:
|
84 |
-
/***/ (function(module, exports, __webpack_require__) {
|
85 |
-
|
86 |
-
(function ($) {
|
87 |
-
|
88 |
-
Promise.resolve().then(function () {
|
89 |
-
return __webpack_require__(14);
|
90 |
-
}).then(function (_ref) {
|
91 |
-
var GWPAdminHelper = _ref.GWPAdminHelper;
|
92 |
-
|
93 |
-
|
94 |
-
$.fn.gwp_live_feed = function () {
|
95 |
-
GWPAdminHelper.LiveFeed();
|
96 |
-
};
|
97 |
-
|
98 |
-
$.fn.gwp_deactivate_popup = function ($slug) {
|
99 |
-
GWPAdminHelper.DeactivatePopup($slug);
|
100 |
-
};
|
101 |
-
});
|
102 |
-
})(jQuery);
|
103 |
-
|
104 |
-
/***/ }),
|
105 |
-
|
106 |
-
/***/ 14:
|
107 |
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
108 |
-
|
109 |
-
"use strict";
|
110 |
-
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
111 |
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GWPAdminHelper", function() { return GWPAdminHelper; });
|
112 |
-
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
113 |
-
|
114 |
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
115 |
-
|
116 |
-
/*global GWPAdmin*/
|
117 |
-
|
118 |
-
var GWPAdminHelper = function ($) {
|
119 |
-
var GWPAdminHelper = function () {
|
120 |
-
function GWPAdminHelper() {
|
121 |
-
_classCallCheck(this, GWPAdminHelper);
|
122 |
-
}
|
123 |
-
|
124 |
-
_createClass(GWPAdminHelper, null, [{
|
125 |
-
key: 'LiveFeed',
|
126 |
-
value: function LiveFeed() {
|
127 |
-
$('.gwp-live-feed-close').on('click', function (e) {
|
128 |
-
e.preventDefault();
|
129 |
-
var id = $(this).data('feed_id');
|
130 |
-
wp.ajax.send('gwp_live_feed_close', {
|
131 |
-
data: { id: id }
|
132 |
-
});
|
133 |
-
|
134 |
-
$(this).parent().fadeOut('fast', function () {
|
135 |
-
$(this).remove();
|
136 |
-
});
|
137 |
-
});
|
138 |
-
}
|
139 |
-
}, {
|
140 |
-
key: 'ResetPopupData',
|
141 |
-
value: function ResetPopupData(pluginslug) {
|
142 |
-
var id = '#gwp-plugin-deactivate-feedback-dialog-wrapper-' + pluginslug;
|
143 |
-
var $button = $('.feedback-dialog-form-button-send', id);
|
144 |
-
$button.prop('disabled', false).text($button.data('defaultvalue')).next().removeClass('visible');
|
145 |
-
}
|
146 |
-
}, {
|
147 |
-
key: 'DeactivatePopup',
|
148 |
-
value: function DeactivatePopup(pluginslug) {
|
149 |
-
|
150 |
-
var id = '#gwp-plugin-deactivate-feedback-dialog-wrapper-' + pluginslug;
|
151 |
-
|
152 |
-
$('.wp-list-table.plugins').find('[data-slug="' + pluginslug + '"].active').each(function () {
|
153 |
-
var _this = this;
|
154 |
-
|
155 |
-
var deactivate_link = $(this).find('.deactivate a').prop('href');
|
156 |
-
|
157 |
-
$(this).data('deactivate_link', deactivate_link);
|
158 |
-
|
159 |
-
$(this).find('.deactivate a').on('click', function (event) {
|
160 |
-
event.preventDefault();
|
161 |
-
|
162 |
-
$(_this).GWPBackboneModal({
|
163 |
-
template: 'gwp-deactive-feedback-dialog-' + pluginslug,
|
164 |
-
data: {
|
165 |
-
deactivate_link: deactivate_link,
|
166 |
-
plugin: pluginslug
|
167 |
-
}
|
168 |
-
});
|
169 |
-
});
|
170 |
-
});
|
171 |
-
}
|
172 |
-
}]);
|
173 |
-
|
174 |
-
return GWPAdminHelper;
|
175 |
-
}();
|
176 |
-
|
177 |
-
return GWPAdminHelper;
|
178 |
-
}(jQuery);
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
/***/ })
|
183 |
-
|
184 |
-
/******/ });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/gwp-admin.min.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
!function(e){var t={};function n(a){if(t[a])return t[a].exports;var i=t[a]={i:a,l:!1,exports:{}};return e[a].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,a){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:a})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=12)}({12:function(e,t,n){e.exports=n(13)},13:function(e,t,n){var a;a=jQuery,Promise.resolve().then(function(){return n(14)}).then(function(e){var t=e.GWPAdminHelper;a.fn.gwp_live_feed=function(){t.LiveFeed()},a.fn.gwp_deactivate_popup=function(e){t.DeactivatePopup(e)}})},14:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n.d(t,"GWPAdminHelper",function(){return r});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}();var i,r=(i=jQuery,function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return a(e,null,[{key:"LiveFeed",value:function(){i(".gwp-live-feed-close").on("click",function(e){e.preventDefault();var t=i(this).data("feed_id");wp.ajax.send("gwp_live_feed_close",{data:{id:t}}),i(this).parent().fadeOut("fast",function(){i(this).remove()})})}},{key:"ResetPopupData",value:function(e){var t=i(".feedback-dialog-form-button-send","#gwp-plugin-deactivate-feedback-dialog-wrapper-"+e);t.prop("disabled",!1).text(t.data("defaultvalue")).next().removeClass("visible")}},{key:"DeactivatePopup",value:function(e){i(".wp-list-table.plugins").find('[data-slug="'+e+'"].active').each(function(){var t=this,n=i(this).find(".deactivate a").prop("href");i(this).data("deactivate_link",n),i(this).find(".deactivate a").on("click",function(a){a.preventDefault(),i(t).GWPBackboneModal({template:"gwp-deactive-feedback-dialog-"+e,data:{deactivate_link:n,plugin:e}})})})}}]),e}())}});
|
|
assets/js/gwp-backbone-modal.js
DELETED
@@ -1,182 +0,0 @@
|
|
1 |
-
/*global jQuery, Backbone, _ */
|
2 |
-
(function ($, Backbone, _) {
|
3 |
-
'use strict';
|
4 |
-
|
5 |
-
/**
|
6 |
-
* GWP Backbone Modal plugin
|
7 |
-
*
|
8 |
-
* @param {object} options
|
9 |
-
*/
|
10 |
-
|
11 |
-
$.fn.GWPBackboneModal = function (options) {
|
12 |
-
return this.each(function () {
|
13 |
-
new $.GWPBackboneModal($(this), options);
|
14 |
-
});
|
15 |
-
};
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Initialize the Backbone Modal
|
19 |
-
*
|
20 |
-
* @param {object} element [description]
|
21 |
-
* @param {object} options [description]
|
22 |
-
*/
|
23 |
-
$.GWPBackboneModal = function (element, options) {
|
24 |
-
// Set settings
|
25 |
-
var settings = $.extend({}, $.GWPBackboneModal.defaultOptions, options);
|
26 |
-
|
27 |
-
if (settings.template) {
|
28 |
-
new $.GWPBackboneModal.View({
|
29 |
-
target: settings.template,
|
30 |
-
string: settings.data
|
31 |
-
});
|
32 |
-
}
|
33 |
-
};
|
34 |
-
|
35 |
-
/**
|
36 |
-
* Set default options
|
37 |
-
*
|
38 |
-
* @type {object}
|
39 |
-
*/
|
40 |
-
$.GWPBackboneModal.defaultOptions = {
|
41 |
-
template: '',
|
42 |
-
data: {}
|
43 |
-
};
|
44 |
-
|
45 |
-
/**
|
46 |
-
* Create the Backbone Modal
|
47 |
-
*
|
48 |
-
* @return {null}
|
49 |
-
*/
|
50 |
-
$.GWPBackboneModal.View = Backbone.View.extend({
|
51 |
-
tagName: 'div',
|
52 |
-
id: 'gwp-backbone-modal-dialog',
|
53 |
-
_target: undefined,
|
54 |
-
_string: undefined,
|
55 |
-
events: {
|
56 |
-
'click .modal-close': 'closeButton',
|
57 |
-
'click #btn-ok': 'addButton',
|
58 |
-
'click #send-ajax': 'sendAjax',
|
59 |
-
'touchstart #btn-ok': 'addButton',
|
60 |
-
'keydown': 'keyboardActions',
|
61 |
-
'change :radio': 'optionChange'
|
62 |
-
},
|
63 |
-
resizeContent: function resizeContent() {
|
64 |
-
var $content = $('.gwp-backbone-modal-content').find('article');
|
65 |
-
var max_h = $(window).height() * 0.75;
|
66 |
-
|
67 |
-
$content.css({
|
68 |
-
'max-height': max_h + 'px'
|
69 |
-
});
|
70 |
-
},
|
71 |
-
initialize: function initialize(data) {
|
72 |
-
var view = this;
|
73 |
-
this._target = data.target;
|
74 |
-
this._string = data.string;
|
75 |
-
_.bindAll(this, 'render');
|
76 |
-
this.render();
|
77 |
-
|
78 |
-
$(window).resize(function () {
|
79 |
-
view.resizeContent();
|
80 |
-
});
|
81 |
-
},
|
82 |
-
render: function render() {
|
83 |
-
var template = wp.template(this._target);
|
84 |
-
|
85 |
-
this.$el.append(template(this._string));
|
86 |
-
|
87 |
-
$(document.body).css({
|
88 |
-
'overflow': 'hidden'
|
89 |
-
}).append(this.$el);
|
90 |
-
|
91 |
-
this.resizeContent();
|
92 |
-
this.$('.gwp-backbone-modal-content').attr('tabindex', '0').focus();
|
93 |
-
|
94 |
-
// $( document.body ).trigger( 'init_tooltips' );
|
95 |
-
|
96 |
-
$(document.body).trigger('gwp_backbone_modal_loaded', this._target);
|
97 |
-
},
|
98 |
-
closeButton: function closeButton(e) {
|
99 |
-
e.preventDefault();
|
100 |
-
$(document.body).trigger('gwp_backbone_modal_before_remove', this._target);
|
101 |
-
this.undelegateEvents();
|
102 |
-
$(document).off('focusin');
|
103 |
-
$(document.body).css({
|
104 |
-
'overflow': 'auto'
|
105 |
-
});
|
106 |
-
this.remove();
|
107 |
-
$(document.body).trigger('gwp_backbone_modal_removed', this._target);
|
108 |
-
},
|
109 |
-
|
110 |
-
addButton: function addButton(e) {
|
111 |
-
$(document.body).trigger('gwp_backbone_modal_response', [this._target, this.getFormData()]);
|
112 |
-
this.closeButton(e);
|
113 |
-
},
|
114 |
-
|
115 |
-
sendAjax: function sendAjax(event) {
|
116 |
-
var _this = this;
|
117 |
-
|
118 |
-
event.preventDefault();
|
119 |
-
|
120 |
-
var form = this.getFormData();
|
121 |
-
var data = this._string;
|
122 |
-
|
123 |
-
if (typeof form['reason_type'] === 'undefined') {
|
124 |
-
this.closeButton(event);
|
125 |
-
return;
|
126 |
-
}
|
127 |
-
|
128 |
-
$(event.target).prop('disabled', true).text($(event.target).data('deactivating')).next().addClass('visible');
|
129 |
-
|
130 |
-
wp.ajax.send(form.action, {
|
131 |
-
data: form,
|
132 |
-
success: function success(response) {
|
133 |
-
window.location.replace(data.deactivate_link);
|
134 |
-
_this.closeButton(event);
|
135 |
-
},
|
136 |
-
error: function error() {
|
137 |
-
console.error('Deactivation Not logged.');
|
138 |
-
window.location.replace(data.deactivate_link);
|
139 |
-
_this.closeButton(event);
|
140 |
-
}
|
141 |
-
});
|
142 |
-
},
|
143 |
-
|
144 |
-
optionChange: function optionChange(event) {
|
145 |
-
|
146 |
-
$(event.target).closest('.feedback-dialog-form-body').find('.feedback-text').prop('disabled', true).hide();
|
147 |
-
|
148 |
-
$(event.target).nextAll('.feedback-text').prop('disabled', false).show().focus();
|
149 |
-
},
|
150 |
-
|
151 |
-
getFormData: function getFormData() {
|
152 |
-
var data = {};
|
153 |
-
|
154 |
-
$(document.body).trigger('gwp_backbone_modal_before_update', this._target);
|
155 |
-
|
156 |
-
$.each($('form', this.$el).serializeArray(), function (index, item) {
|
157 |
-
if (item.name.indexOf('[]') !== -1) {
|
158 |
-
item.name = item.name.replace('[]', '');
|
159 |
-
data[item.name] = $.makeArray(data[item.name]);
|
160 |
-
data[item.name].push(item.value);
|
161 |
-
} else {
|
162 |
-
data[item.name] = item.value;
|
163 |
-
}
|
164 |
-
});
|
165 |
-
|
166 |
-
return data;
|
167 |
-
},
|
168 |
-
keyboardActions: function keyboardActions(e) {
|
169 |
-
var button = e.keyCode || e.which;
|
170 |
-
|
171 |
-
// Enter key
|
172 |
-
if (13 === button && !(e.target.tagName && (e.target.tagName.toLowerCase() === 'input' || e.target.tagName.toLowerCase() === 'textarea'))) {
|
173 |
-
this.addButton(e);
|
174 |
-
}
|
175 |
-
|
176 |
-
// ESC key
|
177 |
-
if (27 === button) {
|
178 |
-
this.closeButton(e);
|
179 |
-
}
|
180 |
-
}
|
181 |
-
});
|
182 |
-
})(jQuery, Backbone, _);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/gwp-backbone-modal.min.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
!function(n,t,a){"use strict";n.fn.GWPBackboneModal=function(t){return this.each(function(){new n.GWPBackboneModal(n(this),t)})},n.GWPBackboneModal=function(t,e){e=n.extend({},n.GWPBackboneModal.defaultOptions,e);e.template&&new n.GWPBackboneModal.View({target:e.template,string:e.data})},n.GWPBackboneModal.defaultOptions={template:"",data:{}},n.GWPBackboneModal.View=t.View.extend({tagName:"div",id:"gwp-backbone-modal-dialog",_target:void 0,_string:void 0,events:{"click .modal-close":"closeButton","click #btn-ok":"addButton","click #send-ajax":"sendAjax","touchstart #btn-ok":"addButton",keydown:"keyboardActions","change :radio":"optionChange"},resizeContent:function(){var t=n(".gwp-backbone-modal-content").find("article"),e=.75*n(window).height();t.css({"max-height":e+"px"})},initialize:function(t){var e=this;this._target=t.target,this._string=t.string,a.bindAll(this,"render"),this.render(),n(window).resize(function(){e.resizeContent()})},render:function(){var t=wp.template(this._target);this.$el.append(t(this._string)),n(document.body).css({overflow:"hidden"}).append(this.$el),this.resizeContent(),this.$(".gwp-backbone-modal-content").attr("tabindex","0").focus(),n(document.body).trigger("gwp_backbone_modal_loaded",this._target)},closeButton:function(t){t.preventDefault(),n(document.body).trigger("gwp_backbone_modal_before_remove",this._target),this.undelegateEvents(),n(document).off("focusin"),n(document.body).css({overflow:"auto"}),this.remove(),n(document.body).trigger("gwp_backbone_modal_removed",this._target)},addButton:function(t){n(document.body).trigger("gwp_backbone_modal_response",[this._target,this.getFormData()]),this.closeButton(t)},sendAjax:function(e){var a=this;e.preventDefault();var t=this.getFormData(),o=this._string;void 0!==t.reason_type?(n(e.target).prop("disabled",!0).text(n(e.target).data("deactivating")).next().addClass("visible"),wp.ajax.send(t.action,{data:t,success:function(t){window.location.replace(o.deactivate_link),a.closeButton(e)},error:function(){window.location.replace(o.deactivate_link),a.closeButton(e)}})):this.closeButton(e)},optionChange:function(t){n(t.target).closest(".feedback-dialog-form-body").find(".feedback-text").prop("disabled",!0).hide(),n(t.target).nextAll(".feedback-text").prop("disabled",!1).show().focus()},getFormData:function(){var a={};return n(document.body).trigger("gwp_backbone_modal_before_update",this._target),n.each(n("form",this.$el).serializeArray(),function(t,e){-1!==e.name.indexOf("[]")?(e.name=e.name.replace("[]",""),a[e.name]=n.makeArray(a[e.name]),a[e.name].push(e.value)):a[e.name]=e.value}),a},keyboardActions:function(t){var e=t.keyCode||t.which;13!==e||t.target.tagName&&("input"===t.target.tagName.toLowerCase()||"textarea"===t.target.tagName.toLowerCase())||this.addButton(t),27===e&&this.closeButton(t)}})}(jQuery,Backbone,_);
|
|
assets/js/jquery.serializejson.js
ADDED
@@ -0,0 +1,338 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
SerializeJSON jQuery plugin.
|
3 |
+
https://github.com/marioizquierdo/jquery.serializeJSON
|
4 |
+
version 3.2.1 (Feb, 2021)
|
5 |
+
|
6 |
+
Copyright (c) 2012-2021 Mario Izquierdo
|
7 |
+
Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
|
8 |
+
and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
|
9 |
+
*/
|
10 |
+
(function (factory) {
|
11 |
+
/* global define, require, module */
|
12 |
+
if (typeof define === "function" && define.amd) { // AMD. Register as an anonymous module.
|
13 |
+
define(["jquery"], factory);
|
14 |
+
} else if (typeof exports === "object") { // Node/CommonJS
|
15 |
+
var jQuery = require("jquery");
|
16 |
+
module.exports = factory(jQuery);
|
17 |
+
} else { // Browser globals (zepto supported)
|
18 |
+
factory(window.jQuery || window.Zepto || window.$); // Zepto supported on browsers as well
|
19 |
+
}
|
20 |
+
|
21 |
+
}(function ($) {
|
22 |
+
"use strict";
|
23 |
+
|
24 |
+
var rCRLF = /\r?\n/g;
|
25 |
+
var rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i;
|
26 |
+
var rsubmittable = /^(?:input|select|textarea|keygen)/i;
|
27 |
+
var rcheckableType = /^(?:checkbox|radio)$/i;
|
28 |
+
|
29 |
+
$.fn.serializeJSON = function (options) {
|
30 |
+
var f = $.serializeJSON;
|
31 |
+
var $form = this; // NOTE: the set of matched elements is most likely a form, but it could also be a group of inputs
|
32 |
+
var opts = f.setupOpts(options); // validate options and apply defaults
|
33 |
+
var typeFunctions = $.extend({}, opts.defaultTypes, opts.customTypes);
|
34 |
+
|
35 |
+
// Make a list with {name, value, el} for each input element
|
36 |
+
var serializedArray = f.serializeArray($form, opts);
|
37 |
+
|
38 |
+
// Convert the serializedArray into a serializedObject with nested keys
|
39 |
+
var serializedObject = {};
|
40 |
+
$.each(serializedArray, function (_i, obj) {
|
41 |
+
|
42 |
+
var nameSansType = obj.name;
|
43 |
+
var type = $(obj.el).attr("data-value-type");
|
44 |
+
|
45 |
+
if (!type && !opts.disableColonTypes) { // try getting the type from the input name
|
46 |
+
var p = f.splitType(obj.name); // "foo:string" => ["foo", "string"]
|
47 |
+
nameSansType = p[0];
|
48 |
+
type = p[1];
|
49 |
+
}
|
50 |
+
if (type === "skip") {
|
51 |
+
return; // ignore fields with type skip
|
52 |
+
}
|
53 |
+
if (!type) {
|
54 |
+
type = opts.defaultType; // "string" by default
|
55 |
+
}
|
56 |
+
|
57 |
+
var typedValue = f.applyTypeFunc(obj.name, obj.value, type, obj.el, typeFunctions); // Parse type as string, number, etc.
|
58 |
+
|
59 |
+
if (!typedValue && f.shouldSkipFalsy(obj.name, nameSansType, type, obj.el, opts)) {
|
60 |
+
return; // ignore falsy inputs if specified in the options
|
61 |
+
}
|
62 |
+
|
63 |
+
var keys = f.splitInputNameIntoKeysArray(nameSansType);
|
64 |
+
f.deepSet(serializedObject, keys, typedValue, opts);
|
65 |
+
});
|
66 |
+
return serializedObject;
|
67 |
+
};
|
68 |
+
|
69 |
+
// Use $.serializeJSON as namespace for the auxiliar functions
|
70 |
+
// and to define defaults
|
71 |
+
$.serializeJSON = {
|
72 |
+
defaultOptions: {}, // reassign to override option defaults for all serializeJSON calls
|
73 |
+
|
74 |
+
defaultBaseOptions: { // do not modify, use defaultOptions instead
|
75 |
+
checkboxUncheckedValue: undefined, // to include that value for unchecked checkboxes (instead of ignoring them)
|
76 |
+
useIntKeysAsArrayIndex: false, // name="foo[2]" value="v" => {foo: [null, null, "v"]}, instead of {foo: ["2": "v"]}
|
77 |
+
|
78 |
+
skipFalsyValuesForTypes: [], // skip serialization of falsy values for listed value types
|
79 |
+
skipFalsyValuesForFields: [], // skip serialization of falsy values for listed field names
|
80 |
+
|
81 |
+
disableColonTypes: false, // do not interpret ":type" suffix as a type
|
82 |
+
customTypes: {}, // extends defaultTypes
|
83 |
+
defaultTypes: {
|
84 |
+
"string": function(str) { return String(str); },
|
85 |
+
"number": function(str) { return Number(str); },
|
86 |
+
"boolean": function(str) { var falses = ["false", "null", "undefined", "", "0"]; return falses.indexOf(str) === -1; },
|
87 |
+
"null": function(str) { var falses = ["false", "null", "undefined", "", "0"]; return falses.indexOf(str) === -1 ? str : null; },
|
88 |
+
"array": function(str) { return JSON.parse(str); },
|
89 |
+
"object": function(str) { return JSON.parse(str); },
|
90 |
+
"skip": null // skip is a special type used to ignore fields
|
91 |
+
},
|
92 |
+
defaultType: "string",
|
93 |
+
},
|
94 |
+
|
95 |
+
// Validate and set defaults
|
96 |
+
setupOpts: function(options) {
|
97 |
+
if (options == null) options = {};
|
98 |
+
var f = $.serializeJSON;
|
99 |
+
|
100 |
+
// Validate
|
101 |
+
var validOpts = [
|
102 |
+
"checkboxUncheckedValue",
|
103 |
+
"useIntKeysAsArrayIndex",
|
104 |
+
|
105 |
+
"skipFalsyValuesForTypes",
|
106 |
+
"skipFalsyValuesForFields",
|
107 |
+
|
108 |
+
"disableColonTypes",
|
109 |
+
"customTypes",
|
110 |
+
"defaultTypes",
|
111 |
+
"defaultType"
|
112 |
+
];
|
113 |
+
for (var opt in options) {
|
114 |
+
if (validOpts.indexOf(opt) === -1) {
|
115 |
+
throw new Error("serializeJSON ERROR: invalid option '" + opt + "'. Please use one of " + validOpts.join(", "));
|
116 |
+
}
|
117 |
+
}
|
118 |
+
|
119 |
+
// Helper to get options or defaults
|
120 |
+
return $.extend({}, f.defaultBaseOptions, f.defaultOptions, options);
|
121 |
+
},
|
122 |
+
|
123 |
+
// Just like jQuery's serializeArray method, returns an array of objects with name and value.
|
124 |
+
// but also includes the dom element (el) and is handles unchecked checkboxes if the option or data attribute are provided.
|
125 |
+
serializeArray: function($form, opts) {
|
126 |
+
if (opts == null) { opts = {}; }
|
127 |
+
var f = $.serializeJSON;
|
128 |
+
|
129 |
+
return $form.map(function() {
|
130 |
+
var elements = $.prop(this, "elements"); // handle propHook "elements" to filter or add form elements
|
131 |
+
return elements ? $.makeArray(elements) : this;
|
132 |
+
|
133 |
+
}).filter(function() {
|
134 |
+
var $el = $(this);
|
135 |
+
var type = this.type;
|
136 |
+
|
137 |
+
// Filter with the standard W3C rules for successful controls: http://www.w3.org/TR/html401/interact/forms.html#h-17.13.2
|
138 |
+
return this.name && // must contain a name attribute
|
139 |
+
!$el.is(":disabled") && // must not be disable (use .is(":disabled") so that fieldset[disabled] works)
|
140 |
+
rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type) && // only serialize submittable fields (and not buttons)
|
141 |
+
(this.checked || !rcheckableType.test(type) || f.getCheckboxUncheckedValue($el, opts) != null); // skip unchecked checkboxes (unless using opts)
|
142 |
+
|
143 |
+
}).map(function(_i, el) {
|
144 |
+
var $el = $(this);
|
145 |
+
var val = $el.val();
|
146 |
+
var type = this.type; // "input", "select", "textarea", "checkbox", etc.
|
147 |
+
|
148 |
+
if (val == null) {
|
149 |
+
return null;
|
150 |
+
}
|
151 |
+
|
152 |
+
if (rcheckableType.test(type) && !this.checked) {
|
153 |
+
val = f.getCheckboxUncheckedValue($el, opts);
|
154 |
+
}
|
155 |
+
|
156 |
+
if (isArray(val)) {
|
157 |
+
return $.map(val, function(val) {
|
158 |
+
return { name: el.name, value: val.replace(rCRLF, "\r\n"), el: el };
|
159 |
+
} );
|
160 |
+
}
|
161 |
+
|
162 |
+
return { name: el.name, value: val.replace(rCRLF, "\r\n"), el: el };
|
163 |
+
|
164 |
+
}).get();
|
165 |
+
},
|
166 |
+
|
167 |
+
getCheckboxUncheckedValue: function($el, opts) {
|
168 |
+
var val = $el.attr("data-unchecked-value");
|
169 |
+
if (val == null) {
|
170 |
+
val = opts.checkboxUncheckedValue;
|
171 |
+
}
|
172 |
+
return val;
|
173 |
+
},
|
174 |
+
|
175 |
+
// Parse value with type function
|
176 |
+
applyTypeFunc: function(name, strVal, type, el, typeFunctions) {
|
177 |
+
var typeFunc = typeFunctions[type];
|
178 |
+
if (!typeFunc) { // quick feedback to user if there is a typo or missconfiguration
|
179 |
+
throw new Error("serializeJSON ERROR: Invalid type " + type + " found in input name '" + name + "', please use one of " + objectKeys(typeFunctions).join(", "));
|
180 |
+
}
|
181 |
+
return typeFunc(strVal, el);
|
182 |
+
},
|
183 |
+
|
184 |
+
// Splits a field name into the name and the type. Examples:
|
185 |
+
// "foo" => ["foo", ""]
|
186 |
+
// "foo:boolean" => ["foo", "boolean"]
|
187 |
+
// "foo[bar]:null" => ["foo[bar]", "null"]
|
188 |
+
splitType : function(name) {
|
189 |
+
var parts = name.split(":");
|
190 |
+
if (parts.length > 1) {
|
191 |
+
var t = parts.pop();
|
192 |
+
return [parts.join(":"), t];
|
193 |
+
} else {
|
194 |
+
return [name, ""];
|
195 |
+
}
|
196 |
+
},
|
197 |
+
|
198 |
+
// Check if this input should be skipped when it has a falsy value,
|
199 |
+
// depending on the options to skip values by name or type, and the data-skip-falsy attribute.
|
200 |
+
shouldSkipFalsy: function(name, nameSansType, type, el, opts) {
|
201 |
+
var skipFromDataAttr = $(el).attr("data-skip-falsy");
|
202 |
+
if (skipFromDataAttr != null) {
|
203 |
+
return skipFromDataAttr !== "false"; // any value is true, except the string "false"
|
204 |
+
}
|
205 |
+
|
206 |
+
var optForFields = opts.skipFalsyValuesForFields;
|
207 |
+
if (optForFields && (optForFields.indexOf(nameSansType) !== -1 || optForFields.indexOf(name) !== -1)) {
|
208 |
+
return true;
|
209 |
+
}
|
210 |
+
|
211 |
+
var optForTypes = opts.skipFalsyValuesForTypes;
|
212 |
+
if (optForTypes && optForTypes.indexOf(type) !== -1) {
|
213 |
+
return true;
|
214 |
+
}
|
215 |
+
|
216 |
+
return false;
|
217 |
+
},
|
218 |
+
|
219 |
+
// Split the input name in programatically readable keys.
|
220 |
+
// Examples:
|
221 |
+
// "foo" => ["foo"]
|
222 |
+
// "[foo]" => ["foo"]
|
223 |
+
// "foo[inn][bar]" => ["foo", "inn", "bar"]
|
224 |
+
// "foo[inn[bar]]" => ["foo", "inn", "bar"]
|
225 |
+
// "foo[inn][arr][0]" => ["foo", "inn", "arr", "0"]
|
226 |
+
// "arr[][val]" => ["arr", "", "val"]
|
227 |
+
splitInputNameIntoKeysArray: function(nameWithNoType) {
|
228 |
+
var keys = nameWithNoType.split("["); // split string into array
|
229 |
+
keys = $.map(keys, function (key) { return key.replace(/\]/g, ""); }); // remove closing brackets
|
230 |
+
if (keys[0] === "") { keys.shift(); } // ensure no opening bracket ("[foo][inn]" should be same as "foo[inn]")
|
231 |
+
return keys;
|
232 |
+
},
|
233 |
+
|
234 |
+
// Set a value in an object or array, using multiple keys to set in a nested object or array.
|
235 |
+
// This is the main function of the script, that allows serializeJSON to use nested keys.
|
236 |
+
// Examples:
|
237 |
+
//
|
238 |
+
// deepSet(obj, ["foo"], v) // obj["foo"] = v
|
239 |
+
// deepSet(obj, ["foo", "inn"], v) // obj["foo"]["inn"] = v // Create the inner obj["foo"] object, if needed
|
240 |
+
// deepSet(obj, ["foo", "inn", "123"], v) // obj["foo"]["arr"]["123"] = v //
|
241 |
+
//
|
242 |
+
// deepSet(obj, ["0"], v) // obj["0"] = v
|
243 |
+
// deepSet(arr, ["0"], v, {useIntKeysAsArrayIndex: true}) // arr[0] = v
|
244 |
+
// deepSet(arr, [""], v) // arr.push(v)
|
245 |
+
// deepSet(obj, ["arr", ""], v) // obj["arr"].push(v)
|
246 |
+
//
|
247 |
+
// arr = [];
|
248 |
+
// deepSet(arr, ["", v] // arr => [v]
|
249 |
+
// deepSet(arr, ["", "foo"], v) // arr => [v, {foo: v}]
|
250 |
+
// deepSet(arr, ["", "bar"], v) // arr => [v, {foo: v, bar: v}]
|
251 |
+
// deepSet(arr, ["", "bar"], v) // arr => [v, {foo: v, bar: v}, {bar: v}]
|
252 |
+
//
|
253 |
+
deepSet: function (o, keys, value, opts) {
|
254 |
+
if (opts == null) { opts = {}; }
|
255 |
+
var f = $.serializeJSON;
|
256 |
+
if (isUndefined(o)) { throw new Error("ArgumentError: param 'o' expected to be an object or array, found undefined"); }
|
257 |
+
if (!keys || keys.length === 0) { throw new Error("ArgumentError: param 'keys' expected to be an array with least one element"); }
|
258 |
+
|
259 |
+
var key = keys[0];
|
260 |
+
|
261 |
+
// Only one key, then it's not a deepSet, just assign the value in the object or add it to the array.
|
262 |
+
if (keys.length === 1) {
|
263 |
+
if (key === "") { // push values into an array (o must be an array)
|
264 |
+
o.push(value);
|
265 |
+
} else {
|
266 |
+
o[key] = value; // keys can be object keys (strings) or array indexes (numbers)
|
267 |
+
}
|
268 |
+
return;
|
269 |
+
}
|
270 |
+
|
271 |
+
var nextKey = keys[1]; // nested key
|
272 |
+
var tailKeys = keys.slice(1); // list of all other nested keys (nextKey is first)
|
273 |
+
|
274 |
+
if (key === "") { // push nested objects into an array (o must be an array)
|
275 |
+
var lastIdx = o.length - 1;
|
276 |
+
var lastVal = o[lastIdx];
|
277 |
+
|
278 |
+
// if the last value is an object or array, and the new key is not set yet
|
279 |
+
if (isObject(lastVal) && isUndefined(f.deepGet(lastVal, tailKeys))) {
|
280 |
+
key = lastIdx; // then set the new value as a new attribute of the same object
|
281 |
+
} else {
|
282 |
+
key = lastIdx + 1; // otherwise, add a new element in the array
|
283 |
+
}
|
284 |
+
}
|
285 |
+
|
286 |
+
if (nextKey === "") { // "" is used to push values into the nested array "array[]"
|
287 |
+
if (isUndefined(o[key]) || !isArray(o[key])) {
|
288 |
+
o[key] = []; // define (or override) as array to push values
|
289 |
+
}
|
290 |
+
} else {
|
291 |
+
if (opts.useIntKeysAsArrayIndex && isValidArrayIndex(nextKey)) { // if 1, 2, 3 ... then use an array, where nextKey is the index
|
292 |
+
if (isUndefined(o[key]) || !isArray(o[key])) {
|
293 |
+
o[key] = []; // define (or override) as array, to insert values using int keys as array indexes
|
294 |
+
}
|
295 |
+
} else { // nextKey is going to be the nested object's attribute
|
296 |
+
if (isUndefined(o[key]) || !isObject(o[key])) {
|
297 |
+
o[key] = {}; // define (or override) as object, to set nested properties
|
298 |
+
}
|
299 |
+
}
|
300 |
+
}
|
301 |
+
|
302 |
+
// Recursively set the inner object
|
303 |
+
f.deepSet(o[key], tailKeys, value, opts);
|
304 |
+
},
|
305 |
+
|
306 |
+
deepGet: function (o, keys) {
|
307 |
+
var f = $.serializeJSON;
|
308 |
+
if (isUndefined(o) || isUndefined(keys) || keys.length === 0 || (!isObject(o) && !isArray(o))) {
|
309 |
+
return o;
|
310 |
+
}
|
311 |
+
var key = keys[0];
|
312 |
+
if (key === "") { // "" means next array index (used by deepSet)
|
313 |
+
return undefined;
|
314 |
+
}
|
315 |
+
if (keys.length === 1) {
|
316 |
+
return o[key];
|
317 |
+
}
|
318 |
+
var tailKeys = keys.slice(1);
|
319 |
+
return f.deepGet(o[key], tailKeys);
|
320 |
+
}
|
321 |
+
};
|
322 |
+
|
323 |
+
// polyfill Object.keys to get option keys in IE<9
|
324 |
+
var objectKeys = function(obj) {
|
325 |
+
if (Object.keys) {
|
326 |
+
return Object.keys(obj);
|
327 |
+
} else {
|
328 |
+
var key, keys = [];
|
329 |
+
for (key in obj) { keys.push(key); }
|
330 |
+
return keys;
|
331 |
+
}
|
332 |
+
};
|
333 |
+
|
334 |
+
var isObject = function(obj) { return obj === Object(obj); }; // true for Objects and Arrays
|
335 |
+
var isUndefined = function(obj) { return obj === void 0; }; // safe check for undefined values
|
336 |
+
var isValidArrayIndex = function(val) { return /^[0-9]+$/.test(String(val)); }; // 1,2,3,4 ... are valid array indexes
|
337 |
+
var isArray = Array.isArray || function(obj) { return Object.prototype.toString.call(obj) === "[object Array]"; };
|
338 |
+
}));
|
assets/js/jquery.serializejson.min.js
ADDED
@@ -0,0 +1,338 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
SerializeJSON jQuery plugin.
|
3 |
+
https://github.com/marioizquierdo/jquery.serializeJSON
|
4 |
+
version 3.2.1 (Feb, 2021)
|
5 |
+
|
6 |
+
Copyright (c) 2012-2021 Mario Izquierdo
|
7 |
+
Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
|
8 |
+
and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
|
9 |
+
*/
|
10 |
+
(function (factory) {
|
11 |
+
/* global define, require, module */
|
12 |
+
if (typeof define === "function" && define.amd) { // AMD. Register as an anonymous module.
|
13 |
+
define(["jquery"], factory);
|
14 |
+
} else if (typeof exports === "object") { // Node/CommonJS
|
15 |
+
var jQuery = require("jquery");
|
16 |
+
module.exports = factory(jQuery);
|
17 |
+
} else { // Browser globals (zepto supported)
|
18 |
+
factory(window.jQuery || window.Zepto || window.$); // Zepto supported on browsers as well
|
19 |
+
}
|
20 |
+
|
21 |
+
}(function ($) {
|
22 |
+
"use strict";
|
23 |
+
|
24 |
+
var rCRLF = /\r?\n/g;
|
25 |
+
var rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i;
|
26 |
+
var rsubmittable = /^(?:input|select|textarea|keygen)/i;
|
27 |
+
var rcheckableType = /^(?:checkbox|radio)$/i;
|
28 |
+
|
29 |
+
$.fn.serializeJSON = function (options) {
|
30 |
+
var f = $.serializeJSON;
|
31 |
+
var $form = this; // NOTE: the set of matched elements is most likely a form, but it could also be a group of inputs
|
32 |
+
var opts = f.setupOpts(options); // validate options and apply defaults
|
33 |
+
var typeFunctions = $.extend({}, opts.defaultTypes, opts.customTypes);
|
34 |
+
|
35 |
+
// Make a list with {name, value, el} for each input element
|
36 |
+
var serializedArray = f.serializeArray($form, opts);
|
37 |
+
|
38 |
+
// Convert the serializedArray into a serializedObject with nested keys
|
39 |
+
var serializedObject = {};
|
40 |
+
$.each(serializedArray, function (_i, obj) {
|
41 |
+
|
42 |
+
var nameSansType = obj.name;
|
43 |
+
var type = $(obj.el).attr("data-value-type");
|
44 |
+
|
45 |
+
if (!type && !opts.disableColonTypes) { // try getting the type from the input name
|
46 |
+
var p = f.splitType(obj.name); // "foo:string" => ["foo", "string"]
|
47 |
+
nameSansType = p[0];
|
48 |
+
type = p[1];
|
49 |
+
}
|
50 |
+
if (type === "skip") {
|
51 |
+
return; // ignore fields with type skip
|
52 |
+
}
|
53 |
+
if (!type) {
|
54 |
+
type = opts.defaultType; // "string" by default
|
55 |
+
}
|
56 |
+
|
57 |
+
var typedValue = f.applyTypeFunc(obj.name, obj.value, type, obj.el, typeFunctions); // Parse type as string, number, etc.
|
58 |
+
|
59 |
+
if (!typedValue && f.shouldSkipFalsy(obj.name, nameSansType, type, obj.el, opts)) {
|
60 |
+
return; // ignore falsy inputs if specified in the options
|
61 |
+
}
|
62 |
+
|
63 |
+
var keys = f.splitInputNameIntoKeysArray(nameSansType);
|
64 |
+
f.deepSet(serializedObject, keys, typedValue, opts);
|
65 |
+
});
|
66 |
+
return serializedObject;
|
67 |
+
};
|
68 |
+
|
69 |
+
// Use $.serializeJSON as namespace for the auxiliar functions
|
70 |
+
// and to define defaults
|
71 |
+
$.serializeJSON = {
|
72 |
+
defaultOptions: {}, // reassign to override option defaults for all serializeJSON calls
|
73 |
+
|
74 |
+
defaultBaseOptions: { // do not modify, use defaultOptions instead
|
75 |
+
checkboxUncheckedValue: undefined, // to include that value for unchecked checkboxes (instead of ignoring them)
|
76 |
+
useIntKeysAsArrayIndex: false, // name="foo[2]" value="v" => {foo: [null, null, "v"]}, instead of {foo: ["2": "v"]}
|
77 |
+
|
78 |
+
skipFalsyValuesForTypes: [], // skip serialization of falsy values for listed value types
|
79 |
+
skipFalsyValuesForFields: [], // skip serialization of falsy values for listed field names
|
80 |
+
|
81 |
+
disableColonTypes: false, // do not interpret ":type" suffix as a type
|
82 |
+
customTypes: {}, // extends defaultTypes
|
83 |
+
defaultTypes: {
|
84 |
+
"string": function(str) { return String(str); },
|
85 |
+
"number": function(str) { return Number(str); },
|
86 |
+
"boolean": function(str) { var falses = ["false", "null", "undefined", "", "0"]; return falses.indexOf(str) === -1; },
|
87 |
+
"null": function(str) { var falses = ["false", "null", "undefined", "", "0"]; return falses.indexOf(str) === -1 ? str : null; },
|
88 |
+
"array": function(str) { return JSON.parse(str); },
|
89 |
+
"object": function(str) { return JSON.parse(str); },
|
90 |
+
"skip": null // skip is a special type used to ignore fields
|
91 |
+
},
|
92 |
+
defaultType: "string",
|
93 |
+
},
|
94 |
+
|
95 |
+
// Validate and set defaults
|
96 |
+
setupOpts: function(options) {
|
97 |
+
if (options == null) options = {};
|
98 |
+
var f = $.serializeJSON;
|
99 |
+
|
100 |
+
// Validate
|
101 |
+
var validOpts = [
|
102 |
+
"checkboxUncheckedValue",
|
103 |
+
"useIntKeysAsArrayIndex",
|
104 |
+
|
105 |
+
"skipFalsyValuesForTypes",
|
106 |
+
"skipFalsyValuesForFields",
|
107 |
+
|
108 |
+
"disableColonTypes",
|
109 |
+
"customTypes",
|
110 |
+
"defaultTypes",
|
111 |
+
"defaultType"
|
112 |
+
];
|
113 |
+
for (var opt in options) {
|
114 |
+
if (validOpts.indexOf(opt) === -1) {
|
115 |
+
throw new Error("serializeJSON ERROR: invalid option '" + opt + "'. Please use one of " + validOpts.join(", "));
|
116 |
+
}
|
117 |
+
}
|
118 |
+
|
119 |
+
// Helper to get options or defaults
|
120 |
+
return $.extend({}, f.defaultBaseOptions, f.defaultOptions, options);
|
121 |
+
},
|
122 |
+
|
123 |
+
// Just like jQuery's serializeArray method, returns an array of objects with name and value.
|
124 |
+
// but also includes the dom element (el) and is handles unchecked checkboxes if the option or data attribute are provided.
|
125 |
+
serializeArray: function($form, opts) {
|
126 |
+
if (opts == null) { opts = {}; }
|
127 |
+
var f = $.serializeJSON;
|
128 |
+
|
129 |
+
return $form.map(function() {
|
130 |
+
var elements = $.prop(this, "elements"); // handle propHook "elements" to filter or add form elements
|
131 |
+
return elements ? $.makeArray(elements) : this;
|
132 |
+
|
133 |
+
}).filter(function() {
|
134 |
+
var $el = $(this);
|
135 |
+
var type = this.type;
|
136 |
+
|
137 |
+
// Filter with the standard W3C rules for successful controls: http://www.w3.org/TR/html401/interact/forms.html#h-17.13.2
|
138 |
+
return this.name && // must contain a name attribute
|
139 |
+
!$el.is(":disabled") && // must not be disable (use .is(":disabled") so that fieldset[disabled] works)
|
140 |
+
rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type) && // only serialize submittable fields (and not buttons)
|
141 |
+
(this.checked || !rcheckableType.test(type) || f.getCheckboxUncheckedValue($el, opts) != null); // skip unchecked checkboxes (unless using opts)
|
142 |
+
|
143 |
+
}).map(function(_i, el) {
|
144 |
+
var $el = $(this);
|
145 |
+
var val = $el.val();
|
146 |
+
var type = this.type; // "input", "select", "textarea", "checkbox", etc.
|
147 |
+
|
148 |
+
if (val == null) {
|
149 |
+
return null;
|
150 |
+
}
|
151 |
+
|
152 |
+
if (rcheckableType.test(type) && !this.checked) {
|
153 |
+
val = f.getCheckboxUncheckedValue($el, opts);
|
154 |
+
}
|
155 |
+
|
156 |
+
if (isArray(val)) {
|
157 |
+
return $.map(val, function(val) {
|
158 |
+
return { name: el.name, value: val.replace(rCRLF, "\r\n"), el: el };
|
159 |
+
} );
|
160 |
+
}
|
161 |
+
|
162 |
+
return { name: el.name, value: val.replace(rCRLF, "\r\n"), el: el };
|
163 |
+
|
164 |
+
}).get();
|
165 |
+
},
|
166 |
+
|
167 |
+
getCheckboxUncheckedValue: function($el, opts) {
|
168 |
+
var val = $el.attr("data-unchecked-value");
|
169 |
+
if (val == null) {
|
170 |
+
val = opts.checkboxUncheckedValue;
|
171 |
+
}
|
172 |
+
return val;
|
173 |
+
},
|
174 |
+
|
175 |
+
// Parse value with type function
|
176 |
+
applyTypeFunc: function(name, strVal, type, el, typeFunctions) {
|
177 |
+
var typeFunc = typeFunctions[type];
|
178 |
+
if (!typeFunc) { // quick feedback to user if there is a typo or missconfiguration
|
179 |
+
throw new Error("serializeJSON ERROR: Invalid type " + type + " found in input name '" + name + "', please use one of " + objectKeys(typeFunctions).join(", "));
|
180 |
+
}
|
181 |
+
return typeFunc(strVal, el);
|
182 |
+
},
|
183 |
+
|
184 |
+
// Splits a field name into the name and the type. Examples:
|
185 |
+
// "foo" => ["foo", ""]
|
186 |
+
// "foo:boolean" => ["foo", "boolean"]
|
187 |
+
// "foo[bar]:null" => ["foo[bar]", "null"]
|
188 |
+
splitType : function(name) {
|
189 |
+
var parts = name.split(":");
|
190 |
+
if (parts.length > 1) {
|
191 |
+
var t = parts.pop();
|
192 |
+
return [parts.join(":"), t];
|
193 |
+
} else {
|
194 |
+
return [name, ""];
|
195 |
+
}
|
196 |
+
},
|
197 |
+
|
198 |
+
// Check if this input should be skipped when it has a falsy value,
|
199 |
+
// depending on the options to skip values by name or type, and the data-skip-falsy attribute.
|
200 |
+
shouldSkipFalsy: function(name, nameSansType, type, el, opts) {
|
201 |
+
var skipFromDataAttr = $(el).attr("data-skip-falsy");
|
202 |
+
if (skipFromDataAttr != null) {
|
203 |
+
return skipFromDataAttr !== "false"; // any value is true, except the string "false"
|
204 |
+
}
|
205 |
+
|
206 |
+
var optForFields = opts.skipFalsyValuesForFields;
|
207 |
+
if (optForFields && (optForFields.indexOf(nameSansType) !== -1 || optForFields.indexOf(name) !== -1)) {
|
208 |
+
return true;
|
209 |
+
}
|
210 |
+
|
211 |
+
var optForTypes = opts.skipFalsyValuesForTypes;
|
212 |
+
if (optForTypes && optForTypes.indexOf(type) !== -1) {
|
213 |
+
return true;
|
214 |
+
}
|
215 |
+
|
216 |
+
return false;
|
217 |
+
},
|
218 |
+
|
219 |
+
// Split the input name in programatically readable keys.
|
220 |
+
// Examples:
|
221 |
+
// "foo" => ["foo"]
|
222 |
+
// "[foo]" => ["foo"]
|
223 |
+
// "foo[inn][bar]" => ["foo", "inn", "bar"]
|
224 |
+
// "foo[inn[bar]]" => ["foo", "inn", "bar"]
|
225 |
+
// "foo[inn][arr][0]" => ["foo", "inn", "arr", "0"]
|
226 |
+
// "arr[][val]" => ["arr", "", "val"]
|
227 |
+
splitInputNameIntoKeysArray: function(nameWithNoType) {
|
228 |
+
var keys = nameWithNoType.split("["); // split string into array
|
229 |
+
keys = $.map(keys, function (key) { return key.replace(/\]/g, ""); }); // remove closing brackets
|
230 |
+
if (keys[0] === "") { keys.shift(); } // ensure no opening bracket ("[foo][inn]" should be same as "foo[inn]")
|
231 |
+
return keys;
|
232 |
+
},
|
233 |
+
|
234 |
+
// Set a value in an object or array, using multiple keys to set in a nested object or array.
|
235 |
+
// This is the main function of the script, that allows serializeJSON to use nested keys.
|
236 |
+
// Examples:
|
237 |
+
//
|
238 |
+
// deepSet(obj, ["foo"], v) // obj["foo"] = v
|
239 |
+
// deepSet(obj, ["foo", "inn"], v) // obj["foo"]["inn"] = v // Create the inner obj["foo"] object, if needed
|
240 |
+
// deepSet(obj, ["foo", "inn", "123"], v) // obj["foo"]["arr"]["123"] = v //
|
241 |
+
//
|
242 |
+
// deepSet(obj, ["0"], v) // obj["0"] = v
|
243 |
+
// deepSet(arr, ["0"], v, {useIntKeysAsArrayIndex: true}) // arr[0] = v
|
244 |
+
// deepSet(arr, [""], v) // arr.push(v)
|
245 |
+
// deepSet(obj, ["arr", ""], v) // obj["arr"].push(v)
|
246 |
+
//
|
247 |
+
// arr = [];
|
248 |
+
// deepSet(arr, ["", v] // arr => [v]
|
249 |
+
// deepSet(arr, ["", "foo"], v) // arr => [v, {foo: v}]
|
250 |
+
// deepSet(arr, ["", "bar"], v) // arr => [v, {foo: v, bar: v}]
|
251 |
+
// deepSet(arr, ["", "bar"], v) // arr => [v, {foo: v, bar: v}, {bar: v}]
|
252 |
+
//
|
253 |
+
deepSet: function (o, keys, value, opts) {
|
254 |
+
if (opts == null) { opts = {}; }
|
255 |
+
var f = $.serializeJSON;
|
256 |
+
if (isUndefined(o)) { throw new Error("ArgumentError: param 'o' expected to be an object or array, found undefined"); }
|
257 |
+
if (!keys || keys.length === 0) { throw new Error("ArgumentError: param 'keys' expected to be an array with least one element"); }
|
258 |
+
|
259 |
+
var key = keys[0];
|
260 |
+
|
261 |
+
// Only one key, then it's not a deepSet, just assign the value in the object or add it to the array.
|
262 |
+
if (keys.length === 1) {
|
263 |
+
if (key === "") { // push values into an array (o must be an array)
|
264 |
+
o.push(value);
|
265 |
+
} else {
|
266 |
+
o[key] = value; // keys can be object keys (strings) or array indexes (numbers)
|
267 |
+
}
|
268 |
+
return;
|
269 |
+
}
|
270 |
+
|
271 |
+
var nextKey = keys[1]; // nested key
|
272 |
+
var tailKeys = keys.slice(1); // list of all other nested keys (nextKey is first)
|
273 |
+
|
274 |
+
if (key === "") { // push nested objects into an array (o must be an array)
|
275 |
+
var lastIdx = o.length - 1;
|
276 |
+
var lastVal = o[lastIdx];
|
277 |
+
|
278 |
+
// if the last value is an object or array, and the new key is not set yet
|
279 |
+
if (isObject(lastVal) && isUndefined(f.deepGet(lastVal, tailKeys))) {
|
280 |
+
key = lastIdx; // then set the new value as a new attribute of the same object
|
281 |
+
} else {
|
282 |
+
key = lastIdx + 1; // otherwise, add a new element in the array
|
283 |
+
}
|
284 |
+
}
|
285 |
+
|
286 |
+
if (nextKey === "") { // "" is used to push values into the nested array "array[]"
|
287 |
+
if (isUndefined(o[key]) || !isArray(o[key])) {
|
288 |
+
o[key] = []; // define (or override) as array to push values
|
289 |
+
}
|
290 |
+
} else {
|
291 |
+
if (opts.useIntKeysAsArrayIndex && isValidArrayIndex(nextKey)) { // if 1, 2, 3 ... then use an array, where nextKey is the index
|
292 |
+
if (isUndefined(o[key]) || !isArray(o[key])) {
|
293 |
+
o[key] = []; // define (or override) as array, to insert values using int keys as array indexes
|
294 |
+
}
|
295 |
+
} else { // nextKey is going to be the nested object's attribute
|
296 |
+
if (isUndefined(o[key]) || !isObject(o[key])) {
|
297 |
+
o[key] = {}; // define (or override) as object, to set nested properties
|
298 |
+
}
|
299 |
+
}
|
300 |
+
}
|
301 |
+
|
302 |
+
// Recursively set the inner object
|
303 |
+
f.deepSet(o[key], tailKeys, value, opts);
|
304 |
+
},
|
305 |
+
|
306 |
+
deepGet: function (o, keys) {
|
307 |
+
var f = $.serializeJSON;
|
308 |
+
if (isUndefined(o) || isUndefined(keys) || keys.length === 0 || (!isObject(o) && !isArray(o))) {
|
309 |
+
return o;
|
310 |
+
}
|
311 |
+
var key = keys[0];
|
312 |
+
if (key === "") { // "" means next array index (used by deepSet)
|
313 |
+
return undefined;
|
314 |
+
}
|
315 |
+
if (keys.length === 1) {
|
316 |
+
return o[key];
|
317 |
+
}
|
318 |
+
var tailKeys = keys.slice(1);
|
319 |
+
return f.deepGet(o[key], tailKeys);
|
320 |
+
}
|
321 |
+
};
|
322 |
+
|
323 |
+
// polyfill Object.keys to get option keys in IE<9
|
324 |
+
var objectKeys = function(obj) {
|
325 |
+
if (Object.keys) {
|
326 |
+
return Object.keys(obj);
|
327 |
+
} else {
|
328 |
+
var key, keys = [];
|
329 |
+
for (key in obj) { keys.push(key); }
|
330 |
+
return keys;
|
331 |
+
}
|
332 |
+
};
|
333 |
+
|
334 |
+
var isObject = function(obj) { return obj === Object(obj); }; // true for Objects and Arrays
|
335 |
+
var isUndefined = function(obj) { return obj === void 0; }; // safe check for undefined values
|
336 |
+
var isValidArrayIndex = function(val) { return /^[0-9]+$/.test(String(val)); }; // 1,2,3,4 ... are valid array indexes
|
337 |
+
var isArray = Array.isArray || function(obj) { return Object.prototype.toString.call(obj) === "[object Array]"; };
|
338 |
+
}));
|
assets/js/wp-color-picker-alpha.js
CHANGED
@@ -1,4 +1,102 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
* wp-color-picker-alpha
|
3 |
*
|
4 |
* Overwrite Automattic Iris for enabled Alpha Channel in wpColorPicker
|
@@ -8,626 +106,655 @@
|
|
8 |
* https://github.com/kallookoo/wp-color-picker-alpha
|
9 |
* Licensed under the GPLv2 license or later.
|
10 |
*/
|
11 |
-
|
12 |
(function ($, undef) {
|
|
|
|
|
|
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
};
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
var version = parseInt(window.wpColorPickerAlpha.version, 10);
|
21 |
-
if (!isNaN(version) && version >= wpColorPickerAlpha.version) {
|
22 |
-
return;
|
23 |
-
}
|
24 |
}
|
|
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
}
|
30 |
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
|
|
|
|
|
|
38 |
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
}
|
|
|
45 |
return color;
|
46 |
-
|
47 |
|
48 |
-
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
-
|
52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
|
54 |
/**
|
55 |
-
* Iris
|
|
|
|
|
|
|
|
|
|
|
56 |
*/
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
*
|
74 |
-
* @param {Object|*} The color instance if not defined return the cuurent color.
|
75 |
-
*
|
76 |
-
* @return {string} The element's color.
|
77 |
-
*/
|
78 |
-
_getColor: function _getColor(color) {
|
79 |
-
if (color === undef) {
|
80 |
-
color = this._color;
|
81 |
}
|
|
|
|
|
|
|
|
|
|
|
82 |
|
83 |
-
|
84 |
-
color = color.to_s(this.alphaOptions.alphaColorType);
|
85 |
-
if (!this.alphaOptions.alphaColorWithSpace) {
|
86 |
-
color = color.replace(/\s+/g, '');
|
87 |
-
}
|
88 |
-
return color;
|
89 |
-
}
|
90 |
-
return color.toString();
|
91 |
-
},
|
92 |
-
/**
|
93 |
-
* Create widget
|
94 |
-
*
|
95 |
-
* @since 3.0.0
|
96 |
-
* @access private
|
97 |
-
*
|
98 |
-
* @return {void}
|
99 |
-
*/
|
100 |
-
_create: function _create() {
|
101 |
-
try {
|
102 |
-
// Try to get the wpColorPicker alpha options.
|
103 |
-
this.alphaOptions = this.element.wpColorPicker('instance').alphaOptions;
|
104 |
-
} catch (e) {}
|
105 |
-
|
106 |
-
// We make sure there are all options
|
107 |
-
$.extend({}, this.alphaOptions, {
|
108 |
-
alphaEnabled: false,
|
109 |
-
alphaCustomWidth: 130,
|
110 |
-
alphaReset: false,
|
111 |
-
alphaColorType: 'hex',
|
112 |
-
alphaColorWithSpace: false
|
113 |
-
});
|
114 |
-
|
115 |
-
this._super();
|
116 |
-
},
|
117 |
-
/**
|
118 |
-
* Binds event listeners to the Iris.
|
119 |
-
*
|
120 |
-
* @since 3.0.0
|
121 |
-
* @access private
|
122 |
-
*
|
123 |
-
* @return {void}
|
124 |
-
*/
|
125 |
-
_addInputListeners: function _addInputListeners(input) {
|
126 |
-
var self = this,
|
127 |
-
debounceTimeout = 100,
|
128 |
-
callback = function callback(event) {
|
129 |
-
var val = input.val(),
|
130 |
-
color = new Color(val),
|
131 |
-
val = val.replace(/^(#|(rgb|hsl)a?)/, ''),
|
132 |
-
type = self.alphaOptions.alphaColorType;
|
133 |
-
|
134 |
-
input.removeClass('iris-error');
|
135 |
-
|
136 |
-
if (!color.error) {
|
137 |
-
// let's not do this on keyup for hex shortcodes
|
138 |
-
if ('hex' !== type || !(event.type === 'keyup' && val.match(/^[0-9a-fA-F]{3}$/))) {
|
139 |
-
// Compare color ( #AARRGGBB )
|
140 |
-
if (color.toIEOctoHex() !== self._color.toIEOctoHex()) {
|
141 |
-
self._setOption('color', self._getColor(color));
|
142 |
-
}
|
143 |
-
}
|
144 |
-
} else if (val !== '') {
|
145 |
-
input.addClass('iris-error');
|
146 |
-
}
|
147 |
-
};
|
148 |
-
|
149 |
-
input.on('change', callback).on('keyup', self._debounce(callback, debounceTimeout));
|
150 |
-
|
151 |
-
// If we initialized hidden, show on first focus. The rest is up to you.
|
152 |
-
if (self.options.hide) {
|
153 |
-
input.one('focus', function () {
|
154 |
-
self.show();
|
155 |
-
});
|
156 |
-
}
|
157 |
-
},
|
158 |
-
/**
|
159 |
-
* Init Controls
|
160 |
-
*
|
161 |
-
* @since 3.0.0
|
162 |
-
* @access private
|
163 |
-
*
|
164 |
-
* @return {void}
|
165 |
-
*/
|
166 |
-
_initControls: function _initControls() {
|
167 |
-
this._super();
|
168 |
-
|
169 |
-
if (this.alphaOptions.alphaEnabled) {
|
170 |
-
// Create Alpha controls
|
171 |
-
var self = this,
|
172 |
-
stripAlpha = self.controls.strip.clone(false, false),
|
173 |
-
stripAlphaSlider = stripAlpha.find('.iris-slider-offset'),
|
174 |
-
controls = {
|
175 |
-
stripAlpha: stripAlpha,
|
176 |
-
stripAlphaSlider: stripAlphaSlider
|
177 |
-
};
|
178 |
-
|
179 |
-
stripAlpha.addClass('iris-strip-alpha');
|
180 |
-
stripAlphaSlider.addClass('iris-slider-offset-alpha');
|
181 |
-
stripAlpha.appendTo(self.picker.find('.iris-picker-inner'));
|
182 |
-
|
183 |
-
// Push new controls
|
184 |
-
$.each(controls, function (k, v) {
|
185 |
-
self.controls[k] = v;
|
186 |
-
});
|
187 |
-
|
188 |
-
// Create slider
|
189 |
-
self.controls.stripAlphaSlider.slider({
|
190 |
-
orientation: 'vertical',
|
191 |
-
min: 0,
|
192 |
-
max: 100,
|
193 |
-
step: 1,
|
194 |
-
value: parseInt(self._color._alpha * 100),
|
195 |
-
slide: function slide(event, ui) {
|
196 |
-
self.active = 'strip';
|
197 |
-
// Update alpha value
|
198 |
-
self._color._alpha = parseFloat(ui.value / 100);
|
199 |
-
self._change.apply(self, arguments);
|
200 |
-
}
|
201 |
-
});
|
202 |
-
}
|
203 |
-
},
|
204 |
-
/**
|
205 |
-
* Create the controls sizes
|
206 |
-
*
|
207 |
-
* @since 3.0.0
|
208 |
-
* @access private
|
209 |
-
*
|
210 |
-
* @param {bool} reset Set to True for recreate the controls sizes.
|
211 |
-
*
|
212 |
-
* @return {void}
|
213 |
-
*/
|
214 |
-
_dimensions: function _dimensions(reset) {
|
215 |
-
this._super(reset);
|
216 |
-
|
217 |
-
if (this.alphaOptions.alphaEnabled) {
|
218 |
-
var self = this,
|
219 |
-
opts = self.options,
|
220 |
-
controls = self.controls,
|
221 |
-
square = controls.square,
|
222 |
-
strip = self.picker.find('.iris-strip'),
|
223 |
-
innerWidth,
|
224 |
-
squareWidth,
|
225 |
-
stripWidth,
|
226 |
-
stripMargin,
|
227 |
-
totalWidth;
|
228 |
-
|
229 |
-
/**
|
230 |
-
* I use Math.round() to avoid possible size errors,
|
231 |
-
* this function returns the value of a number rounded
|
232 |
-
* to the nearest integer.
|
233 |
-
*
|
234 |
-
* The width to append all widgets,
|
235 |
-
* if border is enabled, 22 is subtracted.
|
236 |
-
* 20 for css left and right property
|
237 |
-
* 2 for css border
|
238 |
-
*/
|
239 |
-
innerWidth = Math.round(self.picker.outerWidth(true) - (opts.border ? 22 : 0));
|
240 |
-
// The width of the draggable, aka square.
|
241 |
-
squareWidth = Math.round(square.outerWidth());
|
242 |
-
// The width for the sliders
|
243 |
-
stripWidth = Math.round((innerWidth - squareWidth) / 2);
|
244 |
-
// The margin for the sliders
|
245 |
-
stripMargin = Math.round(stripWidth / 2);
|
246 |
-
// The total width of the elements.
|
247 |
-
totalWidth = Math.round(squareWidth + stripWidth * 2 + stripMargin * 2);
|
248 |
-
|
249 |
-
// Check and change if necessary.
|
250 |
-
while (totalWidth > innerWidth) {
|
251 |
-
stripWidth = Math.round(stripWidth - 2);
|
252 |
-
stripMargin = Math.round(stripMargin - 1);
|
253 |
-
totalWidth = Math.round(squareWidth + stripWidth * 2 + stripMargin * 2);
|
254 |
-
}
|
255 |
-
|
256 |
-
square.css('margin', '0');
|
257 |
-
strip.width(stripWidth).css('margin-left', stripMargin + 'px');
|
258 |
-
}
|
259 |
-
},
|
260 |
-
/**
|
261 |
-
* Callback to update the controls and the current color.
|
262 |
-
*
|
263 |
-
* @since 3.0.0
|
264 |
-
* @access private
|
265 |
-
*
|
266 |
-
* @return {void}
|
267 |
-
*/
|
268 |
-
_change: function _change() {
|
269 |
-
var self = this,
|
270 |
-
active = self.active;
|
271 |
-
|
272 |
-
self._super();
|
273 |
-
|
274 |
-
if (self.alphaOptions.alphaEnabled) {
|
275 |
-
var controls = self.controls,
|
276 |
-
alpha = parseInt(self._color._alpha * 100),
|
277 |
-
color = self._color.toRgb(),
|
278 |
-
gradient = ['rgb(' + color.r + ',' + color.g + ',' + color.b + ') 0%', 'rgba(' + color.r + ',' + color.g + ',' + color.b + ', 0) 100%'],
|
279 |
-
target = self.picker.closest('.wp-picker-container').find('.wp-color-result');
|
280 |
-
|
281 |
-
self.options.color = self._getColor();
|
282 |
-
// Generate background slider alpha, only for CSS3.
|
283 |
-
controls.stripAlpha.css({ 'background': 'linear-gradient(to bottom, ' + gradient.join(', ') + '), url(' + backgroundImage + ')' });
|
284 |
-
// Update alpha value
|
285 |
-
if (active) {
|
286 |
-
controls.stripAlphaSlider.slider('value', alpha);
|
287 |
-
}
|
288 |
-
|
289 |
-
if (!self._color.error) {
|
290 |
-
self.element.removeClass('iris-error').val(self.options.color);
|
291 |
-
}
|
292 |
-
|
293 |
-
self.picker.find('.iris-palette-container').on('click.palette', '.iris-palette', function () {
|
294 |
-
var color = $(this).data('color');
|
295 |
-
if (self.alphaOptions.alphaReset) {
|
296 |
-
self._color._alpha = 1;
|
297 |
-
color = self._getColor();
|
298 |
-
}
|
299 |
-
self._setOption('color', color);
|
300 |
-
});
|
301 |
-
}
|
302 |
-
},
|
303 |
-
/**
|
304 |
-
* Paint dimensions.
|
305 |
-
*
|
306 |
-
* @since 3.0.0
|
307 |
-
* @access private
|
308 |
-
*
|
309 |
-
* @param {string} origin Origin (position).
|
310 |
-
* @param {string} control Type of the control,
|
311 |
-
*
|
312 |
-
* @return {void}
|
313 |
-
*/
|
314 |
-
_paintDimension: function _paintDimension(origin, control) {
|
315 |
-
var self = this,
|
316 |
-
color = false;
|
317 |
-
|
318 |
-
// Fix for slider hue opacity.
|
319 |
-
if (self.alphaOptions.alphaEnabled && 'strip' === control) {
|
320 |
-
color = self._color;
|
321 |
-
self._color = new Color(color.toString());
|
322 |
-
self.hue = self._color.h();
|
323 |
-
}
|
324 |
|
325 |
-
|
|
|
|
|
|
|
|
|
|
|
326 |
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
359 |
/**
|
360 |
-
*
|
361 |
-
*
|
362 |
-
*
|
363 |
-
*
|
364 |
-
*
|
365 |
-
*
|
366 |
-
*
|
|
|
367 |
*/
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
376 |
}
|
377 |
-
|
|
|
|
|
|
|
|
|
378 |
|
379 |
/**
|
380 |
-
*
|
|
|
|
|
|
|
|
|
|
|
381 |
*/
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
*
|
386 |
-
* @since 3.0.0
|
387 |
-
*
|
388 |
-
* @type {Object}
|
389 |
-
*/
|
390 |
-
alphaOptions: {
|
391 |
-
alphaEnabled: false
|
392 |
-
},
|
393 |
-
/**
|
394 |
-
* Get the alpha options.
|
395 |
-
*
|
396 |
-
* @since 3.0.0
|
397 |
-
* @access private
|
398 |
-
*
|
399 |
-
* @return {object} The current alpha options.
|
400 |
-
*/
|
401 |
-
_getAlphaOptions: function _getAlphaOptions() {
|
402 |
-
var el = this.element,
|
403 |
-
type = el.data('type') || this.options.type,
|
404 |
-
color = el.data('defaultColor') || el.val(),
|
405 |
-
options = {
|
406 |
-
alphaEnabled: el.data('alphaEnabled') || false,
|
407 |
-
alphaCustomWidth: 130,
|
408 |
-
alphaReset: false,
|
409 |
-
alphaColorType: 'rgb',
|
410 |
-
alphaColorWithSpace: false
|
411 |
-
};
|
412 |
-
|
413 |
-
if (options.alphaEnabled) {
|
414 |
-
options.alphaEnabled = el.is('input') && 'full' === type;
|
415 |
-
}
|
416 |
|
417 |
-
|
418 |
-
return options;
|
419 |
-
}
|
420 |
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
462 |
}
|
463 |
|
464 |
-
|
465 |
-
|
|
|
|
|
|
|
|
|
466 |
|
467 |
-
|
468 |
-
|
469 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
470 |
/**
|
471 |
-
*
|
|
|
|
|
|
|
472 |
*
|
473 |
* @since 3.0.0
|
474 |
-
* @access private
|
475 |
*
|
476 |
-
* @
|
|
|
|
|
|
|
477 |
*/
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
482 |
|
483 |
-
|
484 |
-
el = self.element,
|
485 |
-
isDeprecated = self.toggler.is('a');
|
486 |
|
487 |
-
|
488 |
-
|
489 |
-
el.width(parseInt(this.alphaOptions.defaultWidth + this.alphaOptions.alphaCustomWidth, 10));
|
490 |
-
}
|
491 |
|
492 |
-
|
493 |
-
'position': 'relative',
|
494 |
-
'background-image': 'url(' + backgroundImage + ')'
|
495 |
-
});
|
496 |
|
497 |
-
if (isDeprecated) {
|
498 |
-
self.toggler.html('<span class="color-alpha" />');
|
499 |
-
} else {
|
500 |
-
self.toggler.append('<span class="color-alpha" />');
|
501 |
-
}
|
502 |
|
503 |
-
|
504 |
-
'width': '30px',
|
505 |
-
'height': '100%',
|
506 |
-
'position': 'absolute',
|
507 |
-
'top': 0,
|
508 |
-
'background-color': el.val()
|
509 |
-
});
|
510 |
-
|
511 |
-
// Define the correct position for ltr or rtl direction.
|
512 |
-
if ('ltr' === self.colorAlpha.css('direction')) {
|
513 |
-
self.colorAlpha.css({
|
514 |
-
'border-bottom-left-radius': '2px',
|
515 |
-
'border-top-left-radius': '2px',
|
516 |
-
'left': 0
|
517 |
-
});
|
518 |
-
} else {
|
519 |
-
self.colorAlpha.css({
|
520 |
-
'border-bottom-right-radius': '2px',
|
521 |
-
'border-top-right-radius': '2px',
|
522 |
-
'right': 0
|
523 |
-
});
|
524 |
-
}
|
525 |
|
526 |
-
|
527 |
-
/**
|
528 |
-
* @summary Handles the onChange event if one has been defined in the options.
|
529 |
-
*
|
530 |
-
* Handles the onChange event if one has been defined in the options and additionally
|
531 |
-
* sets the background color for the toggler element.
|
532 |
-
*
|
533 |
-
* @since 3.0.0
|
534 |
-
*
|
535 |
-
* @param {Event} event The event that's being called.
|
536 |
-
* @param {HTMLElement} ui The HTMLElement containing the color picker.
|
537 |
-
*
|
538 |
-
* @returns {void}
|
539 |
-
*/
|
540 |
-
change: function change(event, ui) {
|
541 |
-
self.colorAlpha.css({ 'background-color': ui.color.to_s(self.alphaOptions.alphaColorType) });
|
542 |
-
|
543 |
-
// fire change callback if we have one
|
544 |
-
if ($.isFunction(self.options.change)) {
|
545 |
-
self.options.change.call(this, event, ui);
|
546 |
-
}
|
547 |
-
}
|
548 |
-
});
|
549 |
-
|
550 |
-
/**
|
551 |
-
* Prevent any clicks inside this widget from leaking to the top and closing it.
|
552 |
-
*
|
553 |
-
* @since 3.0.0
|
554 |
-
*
|
555 |
-
* @param {Event} event The event that's being called.
|
556 |
-
*
|
557 |
-
* @return {void}
|
558 |
-
*/
|
559 |
-
self.wrap.on('click.wpcolorpicker', function (event) {
|
560 |
-
event.stopPropagation();
|
561 |
-
});
|
562 |
-
|
563 |
-
/**
|
564 |
-
* Open or close the color picker depending on the class.
|
565 |
-
*
|
566 |
-
* @since 3.0.0
|
567 |
-
*/
|
568 |
-
self.toggler.click(function () {
|
569 |
-
if (self.toggler.hasClass('wp-picker-open')) {
|
570 |
-
self.close();
|
571 |
-
} else {
|
572 |
-
self.open();
|
573 |
-
}
|
574 |
-
});
|
575 |
-
|
576 |
-
/**
|
577 |
-
* Checks if value is empty when changing the color in the color picker.
|
578 |
-
* If so, the background color is cleared.
|
579 |
-
*
|
580 |
-
* @since 3.0.0
|
581 |
-
*
|
582 |
-
* @param {Event} event The event that's being called.
|
583 |
-
*
|
584 |
-
* @return {void}
|
585 |
-
*/
|
586 |
-
el.change(function (event) {
|
587 |
-
var val = $(this).val();
|
588 |
-
|
589 |
-
if (el.hasClass('iris-error') || val === '' || val.match(/^(#|(rgb|hsl)a?)$/)) {
|
590 |
-
if (isDeprecated) {
|
591 |
-
self.toggler.removeAttr('style');
|
592 |
-
}
|
593 |
-
|
594 |
-
self.colorAlpha.css('background-color', '');
|
595 |
-
|
596 |
-
// fire clear callback if we have one
|
597 |
-
if ($.isFunction(self.options.clear)) {
|
598 |
-
self.options.clear.call(this, event);
|
599 |
-
}
|
600 |
-
}
|
601 |
-
});
|
602 |
-
|
603 |
-
/**
|
604 |
-
* Enables the user to either clear the color in the color picker or revert back to the default color.
|
605 |
-
*
|
606 |
-
* @since 3.0.0
|
607 |
-
*
|
608 |
-
* @param {Event} event The event that's being called.
|
609 |
-
*
|
610 |
-
* @return {void}
|
611 |
-
*/
|
612 |
-
self.button.click(function (event) {
|
613 |
-
if ($(this).hasClass('wp-picker-default')) {
|
614 |
-
el.val(self.options.defaultColor).change();
|
615 |
-
} else if ($(this).hasClass('wp-picker-clear')) {
|
616 |
-
el.val('');
|
617 |
-
if (isDeprecated) {
|
618 |
-
self.toggler.removeAttr('style');
|
619 |
-
}
|
620 |
-
|
621 |
-
self.colorAlpha.css('background-color', '');
|
622 |
-
|
623 |
-
// fire clear callback if we have one
|
624 |
-
if ($.isFunction(self.options.clear)) {
|
625 |
-
self.options.clear.call(this, event);
|
626 |
-
}
|
627 |
-
|
628 |
-
el.trigger('change');
|
629 |
-
}
|
630 |
-
});
|
631 |
-
}
|
632 |
-
});
|
633 |
-
})(jQuery);
|
1 |
+
/*!
|
2 |
+
* Variation Swatches for WooCommerce
|
3 |
+
*
|
4 |
+
* Author: Emran Ahmed ( emran.bd.08@gmail.com )
|
5 |
+
* Date: 6/13/2022, 4:04:45 PM
|
6 |
+
* Released under the GPLv3 license.
|
7 |
+
*/
|
8 |
+
/******/ (function(modules) { // webpackBootstrap
|
9 |
+
/******/ // The module cache
|
10 |
+
/******/ var installedModules = {};
|
11 |
+
/******/
|
12 |
+
/******/ // The require function
|
13 |
+
/******/ function __webpack_require__(moduleId) {
|
14 |
+
/******/
|
15 |
+
/******/ // Check if module is in cache
|
16 |
+
/******/ if(installedModules[moduleId]) {
|
17 |
+
/******/ return installedModules[moduleId].exports;
|
18 |
+
/******/ }
|
19 |
+
/******/ // Create a new module (and put it into the cache)
|
20 |
+
/******/ var module = installedModules[moduleId] = {
|
21 |
+
/******/ i: moduleId,
|
22 |
+
/******/ l: false,
|
23 |
+
/******/ exports: {}
|
24 |
+
/******/ };
|
25 |
+
/******/
|
26 |
+
/******/ // Execute the module function
|
27 |
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
28 |
+
/******/
|
29 |
+
/******/ // Flag the module as loaded
|
30 |
+
/******/ module.l = true;
|
31 |
+
/******/
|
32 |
+
/******/ // Return the exports of the module
|
33 |
+
/******/ return module.exports;
|
34 |
+
/******/ }
|
35 |
+
/******/
|
36 |
+
/******/
|
37 |
+
/******/ // expose the modules object (__webpack_modules__)
|
38 |
+
/******/ __webpack_require__.m = modules;
|
39 |
+
/******/
|
40 |
+
/******/ // expose the module cache
|
41 |
+
/******/ __webpack_require__.c = installedModules;
|
42 |
+
/******/
|
43 |
+
/******/ // define getter function for harmony exports
|
44 |
+
/******/ __webpack_require__.d = function(exports, name, getter) {
|
45 |
+
/******/ if(!__webpack_require__.o(exports, name)) {
|
46 |
+
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
47 |
+
/******/ }
|
48 |
+
/******/ };
|
49 |
+
/******/
|
50 |
+
/******/ // define __esModule on exports
|
51 |
+
/******/ __webpack_require__.r = function(exports) {
|
52 |
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
53 |
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
54 |
+
/******/ }
|
55 |
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
56 |
+
/******/ };
|
57 |
+
/******/
|
58 |
+
/******/ // create a fake namespace object
|
59 |
+
/******/ // mode & 1: value is a module id, require it
|
60 |
+
/******/ // mode & 2: merge all properties of value into the ns
|
61 |
+
/******/ // mode & 4: return value when already ns object
|
62 |
+
/******/ // mode & 8|1: behave like require
|
63 |
+
/******/ __webpack_require__.t = function(value, mode) {
|
64 |
+
/******/ if(mode & 1) value = __webpack_require__(value);
|
65 |
+
/******/ if(mode & 8) return value;
|
66 |
+
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
67 |
+
/******/ var ns = Object.create(null);
|
68 |
+
/******/ __webpack_require__.r(ns);
|
69 |
+
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
70 |
+
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
71 |
+
/******/ return ns;
|
72 |
+
/******/ };
|
73 |
+
/******/
|
74 |
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
75 |
+
/******/ __webpack_require__.n = function(module) {
|
76 |
+
/******/ var getter = module && module.__esModule ?
|
77 |
+
/******/ function getDefault() { return module['default']; } :
|
78 |
+
/******/ function getModuleExports() { return module; };
|
79 |
+
/******/ __webpack_require__.d(getter, 'a', getter);
|
80 |
+
/******/ return getter;
|
81 |
+
/******/ };
|
82 |
+
/******/
|
83 |
+
/******/ // Object.prototype.hasOwnProperty.call
|
84 |
+
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
85 |
+
/******/
|
86 |
+
/******/ // __webpack_public_path__
|
87 |
+
/******/ __webpack_require__.p = "/";
|
88 |
+
/******/
|
89 |
+
/******/
|
90 |
+
/******/ // Load entry module and return exports
|
91 |
+
/******/ return __webpack_require__(__webpack_require__.s = 2);
|
92 |
+
/******/ })
|
93 |
+
/************************************************************************/
|
94 |
+
/******/ ({
|
95 |
+
|
96 |
+
/***/ "./src/js/wp-color-picker-alpha.js":
|
97 |
+
/***/ (function(module, exports) {
|
98 |
+
|
99 |
+
/*
|
100 |
* wp-color-picker-alpha
|
101 |
*
|
102 |
* Overwrite Automattic Iris for enabled Alpha Channel in wpColorPicker
|
106 |
* https://github.com/kallookoo/wp-color-picker-alpha
|
107 |
* Licensed under the GPLv2 license or later.
|
108 |
*/
|
|
|
109 |
(function ($, undef) {
|
110 |
+
var wpColorPickerAlpha = {
|
111 |
+
'version': 300
|
112 |
+
}; // Always try to use the last version of this script.
|
113 |
|
114 |
+
if ('wpColorPickerAlpha' in window && 'version' in window.wpColorPickerAlpha) {
|
115 |
+
var version = parseInt(window.wpColorPickerAlpha.version, 10);
|
|
|
116 |
|
117 |
+
if (!isNaN(version) && version >= wpColorPickerAlpha.version) {
|
118 |
+
return;
|
|
|
|
|
|
|
|
|
119 |
}
|
120 |
+
} // Prevent multiple initiations
|
121 |
|
122 |
+
|
123 |
+
if (Color.fn.hasOwnProperty('to_s')) {
|
124 |
+
return;
|
125 |
+
} // Create new method to replace the `Color.toString()` inside the scripts.
|
126 |
+
|
127 |
+
|
128 |
+
Color.fn.to_s = function (type) {
|
129 |
+
type = type || 'hex'; // Change hex to rgba to return the correct color.
|
130 |
+
|
131 |
+
if ('hex' === type && this._alpha < 1) {
|
132 |
+
type = 'rgba';
|
133 |
}
|
134 |
|
135 |
+
var color = '';
|
136 |
+
|
137 |
+
if ('hex' === type) {
|
138 |
+
color = this.toString();
|
139 |
+
} else if (!this.error) {
|
140 |
+
color = this.toCSS(type).replace(/\(\s+/, '(').replace(/\s+\)/, ')');
|
141 |
+
}
|
142 |
+
|
143 |
+
return color;
|
144 |
+
}; // Register the global variable.
|
145 |
|
146 |
+
|
147 |
+
window.wpColorPickerAlpha = wpColorPickerAlpha; // Background image encoded
|
148 |
+
|
149 |
+
var backgroundImage = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAAHnlligAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHJJREFUeNpi+P///4EDBxiAGMgCCCAGFB5AADGCRBgYDh48CCRZIJS9vT2QBAggFBkmBiSAogxFBiCAoHogAKIKAlBUYTELAiAmEtABEECk20G6BOmuIl0CIMBQ/IEMkO0myiSSraaaBhZcbkUOs0HuBwDplz5uFJ3Z4gAAAABJRU5ErkJggg==';
|
150 |
+
/**
|
151 |
+
* Iris
|
152 |
+
*/
|
153 |
+
|
154 |
+
$.widget('a8c.iris', $.a8c.iris, {
|
155 |
+
/**
|
156 |
+
* Alpha options
|
157 |
+
*
|
158 |
+
* @since 3.0.0
|
159 |
+
*
|
160 |
+
* @type {Object}
|
161 |
+
*/
|
162 |
+
alphaOptions: {
|
163 |
+
alphaEnabled: false
|
164 |
+
},
|
165 |
+
|
166 |
+
/**
|
167 |
+
* Get the current color or the new color.
|
168 |
+
*
|
169 |
+
* @since 3.0.0
|
170 |
+
* @access private
|
171 |
+
*
|
172 |
+
* @param {Object|*} The color instance if not defined return the cuurent color.
|
173 |
+
*
|
174 |
+
* @return {string} The element's color.
|
175 |
+
*/
|
176 |
+
_getColor: function _getColor(color) {
|
177 |
+
if (color === undef) {
|
178 |
+
color = this._color;
|
179 |
+
}
|
180 |
+
|
181 |
+
if (this.alphaOptions.alphaEnabled) {
|
182 |
+
color = color.to_s(this.alphaOptions.alphaColorType);
|
183 |
+
|
184 |
+
if (!this.alphaOptions.alphaColorWithSpace) {
|
185 |
+
color = color.replace(/\s+/g, '');
|
186 |
}
|
187 |
+
|
188 |
return color;
|
189 |
+
}
|
190 |
|
191 |
+
return color.toString();
|
192 |
+
},
|
193 |
+
|
194 |
+
/**
|
195 |
+
* Create widget
|
196 |
+
*
|
197 |
+
* @since 3.0.0
|
198 |
+
* @access private
|
199 |
+
*
|
200 |
+
* @return {void}
|
201 |
+
*/
|
202 |
+
_create: function _create() {
|
203 |
+
try {
|
204 |
+
// Try to get the wpColorPicker alpha options.
|
205 |
+
this.alphaOptions = this.element.wpColorPicker('instance').alphaOptions;
|
206 |
+
} catch (e) {} // We make sure there are all options
|
207 |
|
208 |
+
|
209 |
+
$.extend({}, this.alphaOptions, {
|
210 |
+
alphaEnabled: false,
|
211 |
+
alphaCustomWidth: 130,
|
212 |
+
alphaReset: false,
|
213 |
+
alphaColorType: 'hex',
|
214 |
+
alphaColorWithSpace: false
|
215 |
+
});
|
216 |
+
|
217 |
+
this._super();
|
218 |
+
},
|
219 |
|
220 |
/**
|
221 |
+
* Binds event listeners to the Iris.
|
222 |
+
*
|
223 |
+
* @since 3.0.0
|
224 |
+
* @access private
|
225 |
+
*
|
226 |
+
* @return {void}
|
227 |
*/
|
228 |
+
_addInputListeners: function _addInputListeners(input) {
|
229 |
+
var self = this,
|
230 |
+
debounceTimeout = 100,
|
231 |
+
callback = function callback(event) {
|
232 |
+
var val = input.val(),
|
233 |
+
color = new Color(val),
|
234 |
+
val = val.replace(/^(#|(rgb|hsl)a?)/, ''),
|
235 |
+
type = self.alphaOptions.alphaColorType;
|
236 |
+
input.removeClass('iris-error');
|
237 |
+
|
238 |
+
if (!color.error) {
|
239 |
+
// let's not do this on keyup for hex shortcodes
|
240 |
+
if ('hex' !== type || !(event.type === 'keyup' && val.match(/^[0-9a-fA-F]{3}$/))) {
|
241 |
+
// Compare color ( #AARRGGBB )
|
242 |
+
if (color.toIEOctoHex() !== self._color.toIEOctoHex()) {
|
243 |
+
self._setOption('color', self._getColor(color));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
}
|
245 |
+
}
|
246 |
+
} else if (val !== '') {
|
247 |
+
input.addClass('iris-error');
|
248 |
+
}
|
249 |
+
};
|
250 |
|
251 |
+
input.on('change', callback).on('keyup', self._debounce(callback, debounceTimeout)); // If we initialized hidden, show on first focus. The rest is up to you.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
252 |
|
253 |
+
if (self.options.hide) {
|
254 |
+
input.one('focus', function () {
|
255 |
+
self.show();
|
256 |
+
});
|
257 |
+
}
|
258 |
+
},
|
259 |
|
260 |
+
/**
|
261 |
+
* Init Controls
|
262 |
+
*
|
263 |
+
* @since 3.0.0
|
264 |
+
* @access private
|
265 |
+
*
|
266 |
+
* @return {void}
|
267 |
+
*/
|
268 |
+
_initControls: function _initControls() {
|
269 |
+
this._super();
|
270 |
+
|
271 |
+
if (this.alphaOptions.alphaEnabled) {
|
272 |
+
// Create Alpha controls
|
273 |
+
var self = this,
|
274 |
+
stripAlpha = self.controls.strip.clone(false, false),
|
275 |
+
stripAlphaSlider = stripAlpha.find('.iris-slider-offset'),
|
276 |
+
controls = {
|
277 |
+
stripAlpha: stripAlpha,
|
278 |
+
stripAlphaSlider: stripAlphaSlider
|
279 |
+
};
|
280 |
+
stripAlpha.addClass('iris-strip-alpha');
|
281 |
+
stripAlphaSlider.addClass('iris-slider-offset-alpha');
|
282 |
+
stripAlpha.appendTo(self.picker.find('.iris-picker-inner')); // Push new controls
|
283 |
+
|
284 |
+
$.each(controls, function (k, v) {
|
285 |
+
self.controls[k] = v;
|
286 |
+
}); // Create slider
|
287 |
+
|
288 |
+
self.controls.stripAlphaSlider.slider({
|
289 |
+
orientation: 'vertical',
|
290 |
+
min: 0,
|
291 |
+
max: 100,
|
292 |
+
step: 1,
|
293 |
+
value: parseInt(self._color._alpha * 100),
|
294 |
+
slide: function slide(event, ui) {
|
295 |
+
self.active = 'strip'; // Update alpha value
|
296 |
+
|
297 |
+
self._color._alpha = parseFloat(ui.value / 100);
|
298 |
+
|
299 |
+
self._change.apply(self, arguments);
|
300 |
+
}
|
301 |
+
});
|
302 |
+
}
|
303 |
+
},
|
304 |
+
|
305 |
+
/**
|
306 |
+
* Create the controls sizes
|
307 |
+
*
|
308 |
+
* @since 3.0.0
|
309 |
+
* @access private
|
310 |
+
*
|
311 |
+
* @param {bool} reset Set to True for recreate the controls sizes.
|
312 |
+
*
|
313 |
+
* @return {void}
|
314 |
+
*/
|
315 |
+
_dimensions: function _dimensions(reset) {
|
316 |
+
this._super(reset);
|
317 |
+
|
318 |
+
if (this.alphaOptions.alphaEnabled) {
|
319 |
+
var self = this,
|
320 |
+
opts = self.options,
|
321 |
+
controls = self.controls,
|
322 |
+
square = controls.square,
|
323 |
+
strip = self.picker.find('.iris-strip'),
|
324 |
+
innerWidth,
|
325 |
+
squareWidth,
|
326 |
+
stripWidth,
|
327 |
+
stripMargin,
|
328 |
+
totalWidth;
|
329 |
/**
|
330 |
+
* I use Math.round() to avoid possible size errors,
|
331 |
+
* this function returns the value of a number rounded
|
332 |
+
* to the nearest integer.
|
333 |
+
*
|
334 |
+
* The width to append all widgets,
|
335 |
+
* if border is enabled, 22 is subtracted.
|
336 |
+
* 20 for css left and right property
|
337 |
+
* 2 for css border
|
338 |
*/
|
339 |
+
|
340 |
+
innerWidth = Math.round(self.picker.outerWidth(true) - (opts.border ? 22 : 0)); // The width of the draggable, aka square.
|
341 |
+
|
342 |
+
squareWidth = Math.round(square.outerWidth()); // The width for the sliders
|
343 |
+
|
344 |
+
stripWidth = Math.round((innerWidth - squareWidth) / 2); // The margin for the sliders
|
345 |
+
|
346 |
+
stripMargin = Math.round(stripWidth / 2); // The total width of the elements.
|
347 |
+
|
348 |
+
totalWidth = Math.round(squareWidth + stripWidth * 2 + stripMargin * 2); // Check and change if necessary.
|
349 |
+
|
350 |
+
while (totalWidth > innerWidth) {
|
351 |
+
stripWidth = Math.round(stripWidth - 2);
|
352 |
+
stripMargin = Math.round(stripMargin - 1);
|
353 |
+
totalWidth = Math.round(squareWidth + stripWidth * 2 + stripMargin * 2);
|
354 |
}
|
355 |
+
|
356 |
+
square.css('margin', '0');
|
357 |
+
strip.width(stripWidth).css('margin-left', stripMargin + 'px');
|
358 |
+
}
|
359 |
+
},
|
360 |
|
361 |
/**
|
362 |
+
* Callback to update the controls and the current color.
|
363 |
+
*
|
364 |
+
* @since 3.0.0
|
365 |
+
* @access private
|
366 |
+
*
|
367 |
+
* @return {void}
|
368 |
*/
|
369 |
+
_change: function _change() {
|
370 |
+
var self = this,
|
371 |
+
active = self.active;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
372 |
|
373 |
+
self._super();
|
|
|
|
|
374 |
|
375 |
+
if (self.alphaOptions.alphaEnabled) {
|
376 |
+
var controls = self.controls,
|
377 |
+
alpha = parseInt(self._color._alpha * 100),
|
378 |
+
color = self._color.toRgb(),
|
379 |
+
gradient = ['rgb(' + color.r + ',' + color.g + ',' + color.b + ') 0%', 'rgba(' + color.r + ',' + color.g + ',' + color.b + ', 0) 100%'],
|
380 |
+
target = self.picker.closest('.wp-picker-container').find('.wp-color-result');
|
381 |
+
|
382 |
+
self.options.color = self._getColor(); // Generate background slider alpha, only for CSS3.
|
383 |
+
|
384 |
+
controls.stripAlpha.css({
|
385 |
+
'background': 'linear-gradient(to bottom, ' + gradient.join(', ') + '), url(' + backgroundImage + ')'
|
386 |
+
}); // Update alpha value
|
387 |
+
|
388 |
+
if (active) {
|
389 |
+
controls.stripAlphaSlider.slider('value', alpha);
|
390 |
+
}
|
391 |
+
|
392 |
+
if (!self._color.error) {
|
393 |
+
self.element.removeClass('iris-error').val(self.options.color);
|
394 |
+
}
|
395 |
+
|
396 |
+
self.picker.find('.iris-palette-container').on('click.palette', '.iris-palette', function () {
|
397 |
+
var color = $(this).data('color');
|
398 |
+
|
399 |
+
if (self.alphaOptions.alphaReset) {
|
400 |
+
self._color._alpha = 1;
|
401 |
+
color = self._getColor();
|
402 |
+
}
|
403 |
+
|
404 |
+
self._setOption('color', color);
|
405 |
+
});
|
406 |
+
}
|
407 |
+
},
|
408 |
+
|
409 |
+
/**
|
410 |
+
* Paint dimensions.
|
411 |
+
*
|
412 |
+
* @since 3.0.0
|
413 |
+
* @access private
|
414 |
+
*
|
415 |
+
* @param {string} origin Origin (position).
|
416 |
+
* @param {string} control Type of the control,
|
417 |
+
*
|
418 |
+
* @return {void}
|
419 |
+
*/
|
420 |
+
_paintDimension: function _paintDimension(origin, control) {
|
421 |
+
var self = this,
|
422 |
+
color = false; // Fix for slider hue opacity.
|
423 |
+
|
424 |
+
if (self.alphaOptions.alphaEnabled && 'strip' === control) {
|
425 |
+
color = self._color;
|
426 |
+
self._color = new Color(color.toString());
|
427 |
+
self.hue = self._color.h();
|
428 |
+
}
|
429 |
+
|
430 |
+
self._super(origin, control); // Restore the color after paint.
|
431 |
+
|
432 |
+
|
433 |
+
if (color) {
|
434 |
+
self._color = color;
|
435 |
+
}
|
436 |
+
},
|
437 |
+
|
438 |
+
/**
|
439 |
+
* To update the options, see original source to view the available options.
|
440 |
+
*
|
441 |
+
* @since 3.0.0
|
442 |
+
*
|
443 |
+
* @param {string} key The Option name.
|
444 |
+
* @param {mixed} value The Option value to update.
|
445 |
+
*
|
446 |
+
* @return {void}
|
447 |
+
*/
|
448 |
+
_setOption: function _setOption(key, value) {
|
449 |
+
var self = this;
|
450 |
+
|
451 |
+
if ('color' === key && self.alphaOptions.alphaEnabled) {
|
452 |
+
// cast to string in case we have a number
|
453 |
+
value = '' + value;
|
454 |
+
newColor = new Color(value).setHSpace(self.options.mode); // Check if error && Check the color to prevent callbacks with the same color.
|
455 |
+
|
456 |
+
if (!newColor.error && self._getColor(newColor) !== self._getColor()) {
|
457 |
+
self._color = newColor;
|
458 |
+
self.options.color = self._getColor();
|
459 |
+
self.active = 'external';
|
460 |
+
|
461 |
+
self._change();
|
462 |
+
}
|
463 |
+
} else {
|
464 |
+
return self._super(key, value);
|
465 |
+
}
|
466 |
+
},
|
467 |
+
|
468 |
+
/**
|
469 |
+
* Returns the iris object if no new color is provided. If a new color is provided, it sets the new color.
|
470 |
+
*
|
471 |
+
* @param newColor {string|*} The new color to use. Can be undefined.
|
472 |
+
*
|
473 |
+
* @since 3.0.0
|
474 |
+
*
|
475 |
+
* @return {string} The element's color.
|
476 |
+
*/
|
477 |
+
color: function color(newColor) {
|
478 |
+
if (newColor === true) {
|
479 |
+
return this._color.clone();
|
480 |
+
}
|
481 |
+
|
482 |
+
if (newColor === undef) {
|
483 |
+
return this._getColor();
|
484 |
+
}
|
485 |
+
|
486 |
+
this.option('color', newColor);
|
487 |
+
}
|
488 |
+
});
|
489 |
+
/**
|
490 |
+
* wpColorPicker
|
491 |
+
*/
|
492 |
+
|
493 |
+
$.widget('wp.wpColorPicker', $.wp.wpColorPicker, {
|
494 |
+
/**
|
495 |
+
* Alpha options
|
496 |
+
*
|
497 |
+
* @since 3.0.0
|
498 |
+
*
|
499 |
+
* @type {Object}
|
500 |
+
*/
|
501 |
+
alphaOptions: {
|
502 |
+
alphaEnabled: false
|
503 |
+
},
|
504 |
+
|
505 |
+
/**
|
506 |
+
* Get the alpha options.
|
507 |
+
*
|
508 |
+
* @since 3.0.0
|
509 |
+
* @access private
|
510 |
+
*
|
511 |
+
* @return {object} The current alpha options.
|
512 |
+
*/
|
513 |
+
_getAlphaOptions: function _getAlphaOptions() {
|
514 |
+
var el = this.element,
|
515 |
+
type = el.data('type') || this.options.type,
|
516 |
+
color = el.data('defaultColor') || el.val(),
|
517 |
+
options = {
|
518 |
+
alphaEnabled: el.data('alphaEnabled') || false,
|
519 |
+
alphaCustomWidth: 130,
|
520 |
+
alphaReset: false,
|
521 |
+
alphaColorType: 'rgb',
|
522 |
+
alphaColorWithSpace: false
|
523 |
+
};
|
524 |
+
|
525 |
+
if (options.alphaEnabled) {
|
526 |
+
options.alphaEnabled = el.is('input') && 'full' === type;
|
527 |
+
}
|
528 |
+
|
529 |
+
if (!options.alphaEnabled) {
|
530 |
+
return options;
|
531 |
+
}
|
532 |
+
|
533 |
+
options.alphaColorWithSpace = color && color.match(/\s/);
|
534 |
+
$.each(options, function (name, defaultValue) {
|
535 |
+
var value = el.data(name) || defaultValue;
|
536 |
+
|
537 |
+
switch (name) {
|
538 |
+
case 'alphaCustomWidth':
|
539 |
+
value = value ? parseInt(value, 10) : 0;
|
540 |
+
value = isNaN(value) ? defaultValue : value;
|
541 |
+
break;
|
542 |
+
|
543 |
+
case 'alphaColorType':
|
544 |
+
if (!value.match(/^(hex|(rgb|hsl)a?)$/)) {
|
545 |
+
if (color && color.match(/^#/)) {
|
546 |
+
value = 'hex';
|
547 |
+
} else if (color && color.match(/^hsla?/)) {
|
548 |
+
value = 'hsl';
|
549 |
+
} else {
|
550 |
+
value = defaultValue;
|
551 |
+
}
|
552 |
}
|
553 |
|
554 |
+
break;
|
555 |
+
|
556 |
+
default:
|
557 |
+
value = !!value;
|
558 |
+
break;
|
559 |
+
}
|
560 |
|
561 |
+
options[name] = value;
|
562 |
+
});
|
563 |
+
return options;
|
564 |
+
},
|
565 |
+
|
566 |
+
/**
|
567 |
+
* Create widget
|
568 |
+
*
|
569 |
+
* @since 3.0.0
|
570 |
+
* @access private
|
571 |
+
*
|
572 |
+
* @return {void}
|
573 |
+
*/
|
574 |
+
_create: function _create() {
|
575 |
+
// Return early if Iris support is missing.
|
576 |
+
if (!$.support.iris) {
|
577 |
+
return;
|
578 |
+
} // Set the alpha options for the current instance.
|
579 |
+
|
580 |
+
|
581 |
+
this.alphaOptions = this._getAlphaOptions(); // Create widget.
|
582 |
+
|
583 |
+
this._super();
|
584 |
+
},
|
585 |
+
|
586 |
+
/**
|
587 |
+
* Binds event listeners to the color picker and create options, etc...
|
588 |
+
*
|
589 |
+
* @since 3.0.0
|
590 |
+
* @access private
|
591 |
+
*
|
592 |
+
* @return {void}
|
593 |
+
*/
|
594 |
+
_addListeners: function _addListeners() {
|
595 |
+
if (!this.alphaOptions.alphaEnabled) {
|
596 |
+
return this._super();
|
597 |
+
}
|
598 |
+
|
599 |
+
var self = this,
|
600 |
+
el = self.element,
|
601 |
+
isDeprecated = self.toggler.is('a');
|
602 |
+
this.alphaOptions.defaultWidth = el.width();
|
603 |
+
|
604 |
+
if (this.alphaOptions.alphaCustomWidth) {
|
605 |
+
el.width(parseInt(this.alphaOptions.defaultWidth + this.alphaOptions.alphaCustomWidth, 10));
|
606 |
+
}
|
607 |
+
|
608 |
+
self.toggler.css({
|
609 |
+
'position': 'relative',
|
610 |
+
'background-image': 'url(' + backgroundImage + ')'
|
611 |
+
});
|
612 |
+
|
613 |
+
if (isDeprecated) {
|
614 |
+
self.toggler.html('<span class="color-alpha" />');
|
615 |
+
} else {
|
616 |
+
self.toggler.append('<span class="color-alpha" />');
|
617 |
+
}
|
618 |
+
|
619 |
+
self.colorAlpha = self.toggler.find('span.color-alpha').css({
|
620 |
+
'width': '30px',
|
621 |
+
'height': '100%',
|
622 |
+
'position': 'absolute',
|
623 |
+
'top': 0,
|
624 |
+
'background-color': el.val()
|
625 |
+
}); // Define the correct position for ltr or rtl direction.
|
626 |
+
|
627 |
+
if ('ltr' === self.colorAlpha.css('direction')) {
|
628 |
+
self.colorAlpha.css({
|
629 |
+
'border-bottom-left-radius': '2px',
|
630 |
+
'border-top-left-radius': '2px',
|
631 |
+
'left': 0
|
632 |
+
});
|
633 |
+
} else {
|
634 |
+
self.colorAlpha.css({
|
635 |
+
'border-bottom-right-radius': '2px',
|
636 |
+
'border-top-right-radius': '2px',
|
637 |
+
'right': 0
|
638 |
+
});
|
639 |
+
}
|
640 |
+
|
641 |
+
el.iris({
|
642 |
/**
|
643 |
+
* @summary Handles the onChange event if one has been defined in the options.
|
644 |
+
*
|
645 |
+
* Handles the onChange event if one has been defined in the options and additionally
|
646 |
+
* sets the background color for the toggler element.
|
647 |
*
|
648 |
* @since 3.0.0
|
|
|
649 |
*
|
650 |
+
* @param {Event} event The event that's being called.
|
651 |
+
* @param {HTMLElement} ui The HTMLElement containing the color picker.
|
652 |
+
*
|
653 |
+
* @returns {void}
|
654 |
*/
|
655 |
+
change: function change(event, ui) {
|
656 |
+
self.colorAlpha.css({
|
657 |
+
'background-color': ui.color.to_s(self.alphaOptions.alphaColorType)
|
658 |
+
}); // fire change callback if we have one
|
659 |
+
|
660 |
+
if ($.isFunction(self.options.change)) {
|
661 |
+
self.options.change.call(this, event, ui);
|
662 |
+
}
|
663 |
+
}
|
664 |
+
});
|
665 |
+
/**
|
666 |
+
* Prevent any clicks inside this widget from leaking to the top and closing it.
|
667 |
+
*
|
668 |
+
* @since 3.0.0
|
669 |
+
*
|
670 |
+
* @param {Event} event The event that's being called.
|
671 |
+
*
|
672 |
+
* @return {void}
|
673 |
+
*/
|
674 |
+
|
675 |
+
self.wrap.on('click.wpcolorpicker', function (event) {
|
676 |
+
event.stopPropagation();
|
677 |
+
});
|
678 |
+
/**
|
679 |
+
* Open or close the color picker depending on the class.
|
680 |
+
*
|
681 |
+
* @since 3.0.0
|
682 |
+
*/
|
683 |
+
|
684 |
+
self.toggler.click(function () {
|
685 |
+
if (self.toggler.hasClass('wp-picker-open')) {
|
686 |
+
self.close();
|
687 |
+
} else {
|
688 |
+
self.open();
|
689 |
+
}
|
690 |
+
});
|
691 |
+
/**
|
692 |
+
* Checks if value is empty when changing the color in the color picker.
|
693 |
+
* If so, the background color is cleared.
|
694 |
+
*
|
695 |
+
* @since 3.0.0
|
696 |
+
*
|
697 |
+
* @param {Event} event The event that's being called.
|
698 |
+
*
|
699 |
+
* @return {void}
|
700 |
+
*/
|
701 |
+
|
702 |
+
el.change(function (event) {
|
703 |
+
var val = $(this).val();
|
704 |
+
|
705 |
+
if (el.hasClass('iris-error') || val === '' || val.match(/^(#|(rgb|hsl)a?)$/)) {
|
706 |
+
if (isDeprecated) {
|
707 |
+
self.toggler.removeAttr('style');
|
708 |
+
}
|
709 |
+
|
710 |
+
self.colorAlpha.css('background-color', ''); // fire clear callback if we have one
|
711 |
+
|
712 |
+
if ($.isFunction(self.options.clear)) {
|
713 |
+
self.options.clear.call(this, event);
|
714 |
+
}
|
715 |
+
}
|
716 |
+
});
|
717 |
+
/**
|
718 |
+
* Enables the user to either clear the color in the color picker or revert back to the default color.
|
719 |
+
*
|
720 |
+
* @since 3.0.0
|
721 |
+
*
|
722 |
+
* @param {Event} event The event that's being called.
|
723 |
+
*
|
724 |
+
* @return {void}
|
725 |
+
*/
|
726 |
+
|
727 |
+
self.button.click(function (event) {
|
728 |
+
if ($(this).hasClass('wp-picker-default')) {
|
729 |
+
el.val(self.options.defaultColor).change();
|
730 |
+
} else if ($(this).hasClass('wp-picker-clear')) {
|
731 |
+
el.val('');
|
732 |
+
|
733 |
+
if (isDeprecated) {
|
734 |
+
self.toggler.removeAttr('style');
|
735 |
+
}
|
736 |
+
|
737 |
+
self.colorAlpha.css('background-color', ''); // fire clear callback if we have one
|
738 |
+
|
739 |
+
if ($.isFunction(self.options.clear)) {
|
740 |
+
self.options.clear.call(this, event);
|
741 |
+
}
|
742 |
+
|
743 |
+
el.trigger('change');
|
744 |
+
}
|
745 |
+
});
|
746 |
+
}
|
747 |
+
});
|
748 |
+
})(jQuery);
|
749 |
|
750 |
+
/***/ }),
|
|
|
|
|
751 |
|
752 |
+
/***/ 2:
|
753 |
+
/***/ (function(module, exports, __webpack_require__) {
|
|
|
|
|
754 |
|
755 |
+
module.exports = __webpack_require__("./src/js/wp-color-picker-alpha.js");
|
|
|
|
|
|
|
756 |
|
|
|
|
|
|
|
|
|
|
|
757 |
|
758 |
+
/***/ })
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
759 |
|
760 |
+
/******/ });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/wp-color-picker-alpha.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(
|
1 |
+
!function(o){var t={};function a(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return o[r].call(i.exports,i,i.exports,a),i.l=!0,i.exports}a.m=o,a.c=t,a.d=function(o,t,r){a.o(o,t)||Object.defineProperty(o,t,{enumerable:!0,get:r})},a.r=function(o){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(o,"__esModule",{value:!0})},a.t=function(o,t){if(1&t&&(o=a(o)),8&t)return o;if(4&t&&"object"==typeof o&&o&&o.__esModule)return o;var r=Object.create(null);if(a.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:o}),2&t&&"string"!=typeof o)for(var i in o)a.d(r,i,function(t){return o[t]}.bind(null,i));return r},a.n=function(o){var t=o&&o.__esModule?function(){return o.default}:function(){return o};return a.d(t,"a",t),t},a.o=function(o,t){return Object.prototype.hasOwnProperty.call(o,t)},a.p="/",a(a.s=6)}({6:function(o,t,a){o.exports=a(7)},7:function(o,t){!function(o,t){var a={version:300};if("wpColorPickerAlpha"in window&&"version"in window.wpColorPickerAlpha){var r=parseInt(window.wpColorPickerAlpha.version,10);if(!isNaN(r)&&r>=a.version)return}if(!Color.fn.hasOwnProperty("to_s")){Color.fn.to_s=function(o){"hex"===(o=o||"hex")&&this._alpha<1&&(o="rgba");var t="";return"hex"===o?t=this.toString():this.error||(t=this.toCSS(o).replace(/\(\s+/,"(").replace(/\s+\)/,")")),t},window.wpColorPickerAlpha=a;var i="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAAHnlligAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHJJREFUeNpi+P///4EDBxiAGMgCCCAGFB5AADGCRBgYDh48CCRZIJS9vT2QBAggFBkmBiSAogxFBiCAoHogAKIKAlBUYTELAiAmEtABEECk20G6BOmuIl0CIMBQ/IEMkO0myiSSraaaBhZcbkUOs0HuBwDplz5uFJ3Z4gAAAABJRU5ErkJggg==";o.widget("a8c.iris",o.a8c.iris,{alphaOptions:{alphaEnabled:!1},_getColor:function(o){return void 0===o&&(o=this._color),this.alphaOptions.alphaEnabled?(o=o.to_s(this.alphaOptions.alphaColorType),this.alphaOptions.alphaColorWithSpace||(o=o.replace(/\s+/g,"")),o):o.toString()},_create:function(){try{this.alphaOptions=this.element.wpColorPicker("instance").alphaOptions}catch(o){}o.extend({},this.alphaOptions,{alphaEnabled:!1,alphaCustomWidth:130,alphaReset:!1,alphaColorType:"hex",alphaColorWithSpace:!1}),this._super()},_addInputListeners:function(o){var t=this,a=function(a){var r=o.val(),i=new Color(r),e=(r=r.replace(/^(#|(rgb|hsl)a?)/,""),t.alphaOptions.alphaColorType);o.removeClass("iris-error"),i.error?""!==r&&o.addClass("iris-error"):"hex"===e&&"keyup"===a.type&&r.match(/^[0-9a-fA-F]{3}$/)||i.toIEOctoHex()!==t._color.toIEOctoHex()&&t._setOption("color",t._getColor(i))};o.on("change",a).on("keyup",t._debounce(a,100)),t.options.hide&&o.one("focus",(function(){t.show()}))},_initControls:function(){if(this._super(),this.alphaOptions.alphaEnabled){var t=this,a=t.controls.strip.clone(!1,!1),r=a.find(".iris-slider-offset"),i={stripAlpha:a,stripAlphaSlider:r};a.addClass("iris-strip-alpha"),r.addClass("iris-slider-offset-alpha"),a.appendTo(t.picker.find(".iris-picker-inner")),o.each(i,(function(o,a){t.controls[o]=a})),t.controls.stripAlphaSlider.slider({orientation:"vertical",min:0,max:100,step:1,value:parseInt(100*t._color._alpha),slide:function(o,a){t.active="strip",t._color._alpha=parseFloat(a.value/100),t._change.apply(t,arguments)}})}},_dimensions:function(o){if(this._super(o),this.alphaOptions.alphaEnabled){var t,a,r,i,e,l=this.options,n=this.controls.square,s=this.picker.find(".iris-strip");for(t=Math.round(this.picker.outerWidth(!0)-(l.border?22:0)),a=Math.round(n.outerWidth()),r=Math.round((t-a)/2),i=Math.round(r/2),e=Math.round(a+2*r+2*i);e>t;)r=Math.round(r-2),i=Math.round(i-1),e=Math.round(a+2*r+2*i);n.css("margin","0"),s.width(r).css("margin-left",i+"px")}},_change:function(){var t=this,a=t.active;if(t._super(),t.alphaOptions.alphaEnabled){var r=t.controls,e=parseInt(100*t._color._alpha),l=t._color.toRgb(),n=["rgb("+l.r+","+l.g+","+l.b+") 0%","rgba("+l.r+","+l.g+","+l.b+", 0) 100%"];t.picker.closest(".wp-picker-container").find(".wp-color-result");t.options.color=t._getColor(),r.stripAlpha.css({background:"linear-gradient(to bottom, "+n.join(", ")+"), url("+i+")"}),a&&r.stripAlphaSlider.slider("value",e),t._color.error||t.element.removeClass("iris-error").val(t.options.color),t.picker.find(".iris-palette-container").on("click.palette",".iris-palette",(function(){var a=o(this).data("color");t.alphaOptions.alphaReset&&(t._color._alpha=1,a=t._getColor()),t._setOption("color",a)}))}},_paintDimension:function(o,t){var a=!1;this.alphaOptions.alphaEnabled&&"strip"===t&&(a=this._color,this._color=new Color(a.toString()),this.hue=this._color.h()),this._super(o,t),a&&(this._color=a)},_setOption:function(o,t){if("color"!==o||!this.alphaOptions.alphaEnabled)return this._super(o,t);t=""+t,newColor=new Color(t).setHSpace(this.options.mode),newColor.error||this._getColor(newColor)===this._getColor()||(this._color=newColor,this.options.color=this._getColor(),this.active="external",this._change())},color:function(o){return!0===o?this._color.clone():void 0===o?this._getColor():void this.option("color",o)}}),o.widget("wp.wpColorPicker",o.wp.wpColorPicker,{alphaOptions:{alphaEnabled:!1},_getAlphaOptions:function(){var t=this.element,a=t.data("type")||this.options.type,r=t.data("defaultColor")||t.val(),i={alphaEnabled:t.data("alphaEnabled")||!1,alphaCustomWidth:130,alphaReset:!1,alphaColorType:"rgb",alphaColorWithSpace:!1};return i.alphaEnabled&&(i.alphaEnabled=t.is("input")&&"full"===a),i.alphaEnabled?(i.alphaColorWithSpace=r&&r.match(/\s/),o.each(i,(function(o,a){var e=t.data(o)||a;switch(o){case"alphaCustomWidth":e=e?parseInt(e,10):0,e=isNaN(e)?a:e;break;case"alphaColorType":e.match(/^(hex|(rgb|hsl)a?)$/)||(e=r&&r.match(/^#/)?"hex":r&&r.match(/^hsla?/)?"hsl":a);break;default:e=!!e}i[o]=e})),i):i},_create:function(){o.support.iris&&(this.alphaOptions=this._getAlphaOptions(),this._super())},_addListeners:function(){if(!this.alphaOptions.alphaEnabled)return this._super();var t=this,a=t.element,r=t.toggler.is("a");this.alphaOptions.defaultWidth=a.width(),this.alphaOptions.alphaCustomWidth&&a.width(parseInt(this.alphaOptions.defaultWidth+this.alphaOptions.alphaCustomWidth,10)),t.toggler.css({position:"relative","background-image":"url("+i+")"}),r?t.toggler.html('<span class="color-alpha" />'):t.toggler.append('<span class="color-alpha" />'),t.colorAlpha=t.toggler.find("span.color-alpha").css({width:"30px",height:"100%",position:"absolute",top:0,"background-color":a.val()}),"ltr"===t.colorAlpha.css("direction")?t.colorAlpha.css({"border-bottom-left-radius":"2px","border-top-left-radius":"2px",left:0}):t.colorAlpha.css({"border-bottom-right-radius":"2px","border-top-right-radius":"2px",right:0}),a.iris({change:function(a,r){t.colorAlpha.css({"background-color":r.color.to_s(t.alphaOptions.alphaColorType)}),o.isFunction(t.options.change)&&t.options.change.call(this,a,r)}}),t.wrap.on("click.wpcolorpicker",(function(o){o.stopPropagation()})),t.toggler.click((function(){t.toggler.hasClass("wp-picker-open")?t.close():t.open()})),a.change((function(i){var e=o(this).val();(a.hasClass("iris-error")||""===e||e.match(/^(#|(rgb|hsl)a?)$/))&&(r&&t.toggler.removeAttr("style"),t.colorAlpha.css("background-color",""),o.isFunction(t.options.clear)&&t.options.clear.call(this,i))})),t.button.click((function(i){o(this).hasClass("wp-picker-default")?a.val(t.options.defaultColor).change():o(this).hasClass("wp-picker-clear")&&(a.val(""),r&&t.toggler.removeAttr("style"),t.colorAlpha.css("background-color",""),o.isFunction(t.options.clear)&&t.options.clear.call(this,i),a.trigger("change"))}))}})}}(jQuery)}});
|
includes/class-woo-variation-swatches-backend.php
ADDED
@@ -0,0 +1,289 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
defined( 'ABSPATH' ) || exit;
|
3 |
+
|
4 |
+
if ( ! class_exists( 'Woo_Variation_Swatches_Backend' ) ) {
|
5 |
+
class Woo_Variation_Swatches_Backend {
|
6 |
+
|
7 |
+
protected static $_instance = null;
|
8 |
+
|
9 |
+
protected $admin_menu;
|
10 |
+
|
11 |
+
protected function __construct() {
|
12 |
+
$this->includes();
|
13 |
+
$this->hooks();
|
14 |
+
$this->init();
|
15 |
+
do_action( 'woo_variation_swatches_backend_loaded', $this );
|
16 |
+
}
|
17 |
+
|
18 |
+
public static function instance() {
|
19 |
+
if ( is_null( self::$_instance ) ) {
|
20 |
+
self::$_instance = new self();
|
21 |
+
}
|
22 |
+
|
23 |
+
return self::$_instance;
|
24 |
+
}
|
25 |
+
|
26 |
+
protected function includes() {
|
27 |
+
require_once dirname( __FILE__ ) . '/class-woo-variation-swatches-term-meta.php';
|
28 |
+
require_once dirname( __FILE__ ) . '/class-woo-variation-swatches-export-import.php';
|
29 |
+
|
30 |
+
require_once dirname( __FILE__ ) . '/getwooplugins/class-getwooplugins-plugin-deactivate-feedback.php';
|
31 |
+
require_once dirname( __FILE__ ) . '/getwooplugins/class-getwooplugins-admin-menus.php';
|
32 |
+
|
33 |
+
require_once dirname( __FILE__ ) . '/class-woo-variation-swatches-deactivate-feedback.php';
|
34 |
+
|
35 |
+
}
|
36 |
+
|
37 |
+
protected function hooks() {
|
38 |
+
|
39 |
+
add_filter( 'getwooplugins_get_settings_pages', array( $this, 'init_settings' ) );
|
40 |
+
add_filter( 'product_attributes_type_selector', array( $this, 'attribute_types' ) );
|
41 |
+
|
42 |
+
add_action( 'admin_init', array( $this, 'add_attribute_meta' ) );
|
43 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) );
|
44 |
+
add_action( 'woocommerce_product_option_terms', array( $this, 'product_option_terms' ), 10, 3 );
|
45 |
+
|
46 |
+
add_filter( 'plugin_action_links_' . plugin_basename( WOO_VARIATION_SWATCHES_PLUGIN_FILE ), array( $this, 'plugin_action_links' ) );
|
47 |
+
add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 );
|
48 |
+
}
|
49 |
+
|
50 |
+
protected function init() {
|
51 |
+
//$this->admin_menu = GetWooPlugins_Admin_Menus::instance();
|
52 |
+
$this->get_admin_menu();
|
53 |
+
$this->get_deactivate_feedback();
|
54 |
+
$this->get_export_import();
|
55 |
+
}
|
56 |
+
|
57 |
+
// Start
|
58 |
+
public function get_admin_menu() {
|
59 |
+
return GetWooPlugins_Admin_Menus::instance();
|
60 |
+
}
|
61 |
+
|
62 |
+
public function get_deactivate_feedback() {
|
63 |
+
return Woo_Variation_Swatches_Deactivate_Feedback::instance();
|
64 |
+
}
|
65 |
+
|
66 |
+
public function get_export_import() {
|
67 |
+
return Woo_Variation_Swatches_Export_Import::instance();
|
68 |
+
}
|
69 |
+
|
70 |
+
public function plugin_row_meta( $links, $file ) {
|
71 |
+
if ( plugin_basename( WOO_VARIATION_SWATCHES_PLUGIN_FILE ) !== $file ) {
|
72 |
+
return $links;
|
73 |
+
}
|
74 |
+
|
75 |
+
$row_meta = apply_filters( 'woo_variation_swatches_row_meta', array(
|
76 |
+
'docs' => '<a target="_blank" href="' . esc_url( 'https://getwooplugins.com/documentation/woocommerce-variation-swatches/' ) . '" aria-label="' . esc_attr__( 'View documentation', 'woo-variation-swatches' ) . '">' . esc_html__( 'Documentation', 'woo-variation-swatches' ) . '</a>',
|
77 |
+
'videos' => '<a target="_blank" href="' . esc_url( 'https://www.youtube.com/channel/UC6F21JXiLUPO7sm-AYlA3Ig/videos' ) . '" aria-label="' . esc_attr__( 'Video Tutorials', 'woo-variation-swatches' ) . '">' . esc_html__( 'Video Tutorials', 'woo-variation-swatches' ) . '</a>',
|
78 |
+
'support' => '<a target="_blank" href="' . esc_url( 'https://getwooplugins.com/tickets/' ) . '" aria-label="' . esc_attr__( 'Help & Support', 'woo-variation-swatches' ) . '">' . esc_html__( 'Help & Support', 'woo-variation-swatches' ) . '</a>',
|
79 |
+
) );
|
80 |
+
|
81 |
+
return array_merge( $links, $row_meta );
|
82 |
+
}
|
83 |
+
|
84 |
+
public function plugin_action_links( $links ) {
|
85 |
+
$action_links = array(
|
86 |
+
'settings' => '<a href="' . esc_url( $this->get_admin_menu()->get_settings_link( 'woo_variation_swatches' ) ) . '" aria-label="' . esc_attr__( 'View Swatches settings', 'woo-variation-swatches' ) . '">' . esc_html__( 'Settings', 'woo-variation-swatches' ) . '</a>',
|
87 |
+
);
|
88 |
+
|
89 |
+
|
90 |
+
$pro_links = array(
|
91 |
+
'gwp-go-pro-action-link' => '<a target="_blank" href="' . esc_url( $this->get_pro_link() ) . '" aria-label="' . esc_attr__( 'Go Pro', 'woo-variation-swatches' ) . '">' . esc_html__( 'Go Pro', 'woo-variation-swatches' ) . '</a>',
|
92 |
+
);
|
93 |
+
|
94 |
+
if ( woo_variation_swatches()->is_pro() ) {
|
95 |
+
$pro_links = array();
|
96 |
+
}
|
97 |
+
|
98 |
+
return array_merge( $action_links, $links, $pro_links );
|
99 |
+
|
100 |
+
|
101 |
+
}
|
102 |
+
|
103 |
+
public function product_option_terms( $attribute_taxonomy, $i, $attribute ) {
|
104 |
+
|
105 |
+
if ( 'select' !== $attribute_taxonomy->attribute_type && in_array( $attribute_taxonomy->attribute_type, array_keys( $this->attribute_types() ) ) ) {
|
106 |
+
|
107 |
+
$name = sprintf( 'attribute_values[%s][]', esc_attr( $i ) );
|
108 |
+
?>
|
109 |
+
<select multiple="multiple" data-placeholder="<?php esc_attr_e( 'Select terms', 'woocommerce' ); ?>" class="multiselect attribute_values wc-enhanced-select" name="<?php echo esc_attr( $name ) ?>">
|
110 |
+
<?php
|
111 |
+
$args = array(
|
112 |
+
'orderby' => ! empty( $attribute_taxonomy->attribute_orderby ) ? $attribute_taxonomy->attribute_orderby : 'name',
|
113 |
+
'hide_empty' => 0,
|
114 |
+
);
|
115 |
+
$all_terms = get_terms( $attribute->get_taxonomy(), apply_filters( 'woocommerce_product_attribute_terms', $args ) );
|
116 |
+
if ( $all_terms ) {
|
117 |
+
foreach ( $all_terms as $term ) {
|
118 |
+
$options = $attribute->get_options();
|
119 |
+
$options = ! empty( $options ) ? $options : array();
|
120 |
+
echo '<option value="' . esc_attr( $term->term_id ) . '"' . wc_selected( $term->term_id, $options ) . '>' . esc_html( apply_filters( 'woocommerce_product_attribute_term_name', $term->name, $term ) ) . '</option>';
|
121 |
+
}
|
122 |
+
}
|
123 |
+
?>
|
124 |
+
</select>
|
125 |
+
<button class="button plus select_all_attributes"><?php esc_html_e( 'Select all', 'woocommerce' ); ?></button>
|
126 |
+
<button class="button minus select_no_attributes"><?php esc_html_e( 'Select none', 'woocommerce' ); ?></button>
|
127 |
+
<button class="button fr plus add_new_attribute"><?php esc_html_e( 'Add new', 'woocommerce' ); ?></button>
|
128 |
+
|
129 |
+
<?php
|
130 |
+
}
|
131 |
+
|
132 |
+
}
|
133 |
+
|
134 |
+
public function admin_scripts() {
|
135 |
+
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
136 |
+
$screen = get_current_screen();
|
137 |
+
$screen_id = $screen ? $screen->id : '';
|
138 |
+
|
139 |
+
wp_enqueue_style( 'wp-color-picker' );
|
140 |
+
wp_enqueue_style( 'woo-variation-swatches-admin', woo_variation_swatches()->assets_url( "/css/admin{$suffix}.css" ), array(), woo_variation_swatches()->assets_version( "/css/admin{$suffix}.css" ) );
|
141 |
+
|
142 |
+
|
143 |
+
if ( in_array( $screen_id, array( 'product' ) ) ) {
|
144 |
+
wp_deregister_script( 'serializejson' );
|
145 |
+
wp_register_script( 'serializejson', woo_variation_swatches()->assets_url( "/js/jquery.serializejson{$suffix}.js" ), array( 'jquery' ), '3.2.1' );
|
146 |
+
}
|
147 |
+
|
148 |
+
|
149 |
+
wp_enqueue_script( 'wp-color-picker-alpha', woo_variation_swatches()->assets_url( "/js/wp-color-picker-alpha{$suffix}.js" ), array( 'jquery', 'wp-color-picker' ), woo_variation_swatches()->assets_version( "/js/wp-color-picker-alpha{$suffix}.js" ), true );
|
150 |
+
|
151 |
+
wp_enqueue_script( 'gwp-form-field-dependency', untrailingslashit( plugin_dir_url( __FILE__ ) ) . '/getwooplugins/js/getwooplugins-form-field-dependency.js', array( 'jquery' ), filemtime( untrailingslashit( plugin_dir_path( __FILE__ ) ) . '/getwooplugins/js/getwooplugins-form-field-dependency.js' ), true );
|
152 |
+
|
153 |
+
wp_enqueue_script( 'woo-variation-swatches-admin', woo_variation_swatches()->assets_url( "/js/admin{$suffix}.js" ), array( 'jquery', 'wp-color-picker-alpha', 'wc-enhanced-select', 'serializejson' ), woo_variation_swatches()->assets_version( "/js/admin{$suffix}.js" ), true );
|
154 |
+
|
155 |
+
|
156 |
+
wp_localize_script( 'woo-variation-swatches-admin', 'woo_variation_swatches_admin', array(
|
157 |
+
'media_title' => esc_html__( 'Choose an Image', 'woo-variation-swatches' ),
|
158 |
+
'dialog_title' => esc_html__( 'Add Attribute', 'woo-variation-swatches' ),
|
159 |
+
'dialog_save' => esc_html__( 'Add', 'woo-variation-swatches' ),
|
160 |
+
'dialog_cancel' => esc_html__( 'Cancel', 'woo-variation-swatches' ),
|
161 |
+
'button_title' => esc_html__( 'Use Image', 'woo-variation-swatches' ),
|
162 |
+
'add_media' => esc_html__( 'Add Media', 'woo-variation-swatches' ),
|
163 |
+
'ajaxurl' => esc_url( admin_url( 'admin-ajax.php', 'relative' ) ),
|
164 |
+
'wc_ajax_url' => WC_AJAX::get_endpoint( '%%endpoint%%' ),
|
165 |
+
'nonce' => wp_create_nonce( 'woo_variation_swatches_admin' ),
|
166 |
+
'reset_notice' => esc_html__( 'Are you sure you want to reset it to default setting?', 'woo-variation-swatches-pro' ),
|
167 |
+
'nav_warning' => esc_html__( 'Please save changed first.', 'woo-variation-swatches-pro' ),
|
168 |
+
) );
|
169 |
+
}
|
170 |
+
|
171 |
+
public function attribute_types() {
|
172 |
+
|
173 |
+
return array(
|
174 |
+
'select' => esc_html__( 'Select', 'woocommerce' ),
|
175 |
+
'color' => esc_html__( 'Color', 'woo-variation-swatches' ),
|
176 |
+
'image' => esc_html__( 'Image', 'woo-variation-swatches' ),
|
177 |
+
'button' => esc_html__( 'Button', 'woo-variation-swatches' ),
|
178 |
+
'radio' => esc_html__( 'Radio', 'woo-variation-swatches' ),
|
179 |
+
);
|
180 |
+
}
|
181 |
+
|
182 |
+
public function extended_attribute_types() {
|
183 |
+
$attribute_types = $this->attribute_types();
|
184 |
+
|
185 |
+
// $attribute_types[ 'custom' ] = esc_html__( 'Custom', 'woo-variation-swatches-pro' );
|
186 |
+
$attribute_types[ 'mixed' ] = esc_html__( 'Mixed', 'woo-variation-swatches' );
|
187 |
+
|
188 |
+
return $attribute_types;
|
189 |
+
}
|
190 |
+
|
191 |
+
public function filtered_attribute_types() {
|
192 |
+
|
193 |
+
$attribute_types = $this->attribute_types();
|
194 |
+
unset( $attribute_types[ 'select' ], $attribute_types[ 'radio' ] );
|
195 |
+
|
196 |
+
return $attribute_types;
|
197 |
+
}
|
198 |
+
|
199 |
+
|
200 |
+
public function load_settings() {
|
201 |
+
include_once dirname( __FILE__ ) . '/class-woo-variation-swatches-settings.php';
|
202 |
+
|
203 |
+
return new Woo_Variation_Swatches_Settings();
|
204 |
+
}
|
205 |
+
|
206 |
+
public function init_settings( $settings ) {
|
207 |
+
|
208 |
+
$settings[] = $this->load_settings();
|
209 |
+
|
210 |
+
return $settings;
|
211 |
+
}
|
212 |
+
|
213 |
+
public function add_attribute_meta() {
|
214 |
+
|
215 |
+
$fields = $this->attribute_meta_fields();
|
216 |
+
$attribute_taxonomies = wc_get_attribute_taxonomies();
|
217 |
+
|
218 |
+
if ( $attribute_taxonomies ) {
|
219 |
+
foreach ( $attribute_taxonomies as $taxonomy ) {
|
220 |
+
$attribute_name = wc_attribute_taxonomy_name( $taxonomy->attribute_name );
|
221 |
+
$attribute_type = $taxonomy->attribute_type;
|
222 |
+
if ( in_array( $attribute_type, array_keys( $fields ) ) ) {
|
223 |
+
new Woo_Variation_Swatches_Term_Meta( $attribute_name, 'product', $fields[ $attribute_type ] );
|
224 |
+
}
|
225 |
+
}
|
226 |
+
}
|
227 |
+
}
|
228 |
+
|
229 |
+
public function attribute_meta_fields() {
|
230 |
+
|
231 |
+
$fields = array();
|
232 |
+
|
233 |
+
$fields[ 'color' ] = array(
|
234 |
+
array(
|
235 |
+
'label' => esc_html__( 'Color', 'woo-variation-swatches' ), // <label>
|
236 |
+
'desc' => esc_html__( 'Choose a color', 'woo-variation-swatches' ), // description
|
237 |
+
'id' => 'product_attribute_color', // name of field
|
238 |
+
'type' => 'color'
|
239 |
+
)
|
240 |
+
);
|
241 |
+
|
242 |
+
$fields[ 'image' ] = array(
|
243 |
+
array(
|
244 |
+
'label' => esc_html__( 'Image', 'woo-variation-swatches' ), // <label>
|
245 |
+
'desc' => esc_html__( 'Choose an Image', 'woo-variation-swatches' ), // description
|
246 |
+
'id' => 'product_attribute_image', // name of field
|
247 |
+
'type' => 'image'
|
248 |
+
)
|
249 |
+
);
|
250 |
+
|
251 |
+
return $fields;
|
252 |
+
|
253 |
+
}
|
254 |
+
|
255 |
+
public function get_attribute_taxonomy( $attribute_name ) {
|
256 |
+
|
257 |
+
$taxonomy_attributes = wc_get_attribute_taxonomies();
|
258 |
+
|
259 |
+
$attribute_name = str_ireplace( 'pa_', '', wc_sanitize_taxonomy_name( $attribute_name ) );
|
260 |
+
|
261 |
+
foreach ( $taxonomy_attributes as $attribute ) {
|
262 |
+
|
263 |
+
// Skip taxonomy attributes that didn't match the query.
|
264 |
+
if ( false === stripos( $attribute->attribute_name, $attribute_name ) ) {
|
265 |
+
continue;
|
266 |
+
}
|
267 |
+
|
268 |
+
return $attribute;
|
269 |
+
}
|
270 |
+
|
271 |
+
return false;
|
272 |
+
}
|
273 |
+
|
274 |
+
public function get_pro_link() {
|
275 |
+
|
276 |
+
$affiliate_id = apply_filters( 'gwp_affiliate_id', 0 );
|
277 |
+
|
278 |
+
$link_args = array();
|
279 |
+
|
280 |
+
if ( ! empty( $affiliate_id ) ) {
|
281 |
+
$link_args[ 'ref' ] = esc_html( $affiliate_id );
|
282 |
+
}
|
283 |
+
|
284 |
+
$link_args = apply_filters( 'woo_variation_swatches_get_pro_link_args', $link_args );
|
285 |
+
|
286 |
+
return add_query_arg( $link_args, 'https://getwooplugins.com/plugins/woocommerce-variation-swatches/' );
|
287 |
+
}
|
288 |
+
}
|
289 |
+
}
|
includes/class-woo-variation-swatches-compatibility.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
defined( 'ABSPATH' ) || exit;
|
4 |
+
|
5 |
+
if ( ! class_exists( 'Woo_Variation_Swatches_Compatibility' ) ) {
|
6 |
+
class Woo_Variation_Swatches_Compatibility {
|
7 |
+
|
8 |
+
protected static $_instance = null;
|
9 |
+
|
10 |
+
protected function __construct() {
|
11 |
+
$this->includes();
|
12 |
+
$this->hooks();
|
13 |
+
$this->init();
|
14 |
+
do_action( 'woo_variation_swatches_manage_compatibility_loaded', $this );
|
15 |
+
}
|
16 |
+
|
17 |
+
public static function instance() {
|
18 |
+
if ( is_null( self::$_instance ) ) {
|
19 |
+
self::$_instance = new self();
|
20 |
+
}
|
21 |
+
|
22 |
+
return self::$_instance;
|
23 |
+
}
|
24 |
+
|
25 |
+
protected function includes() {
|
26 |
+
}
|
27 |
+
|
28 |
+
protected function hooks() {
|
29 |
+
add_filter( 'wp_kses_allowed_html', array( $this, 'elementor_pro_compatibility' ) );
|
30 |
+
}
|
31 |
+
|
32 |
+
protected function init() {
|
33 |
+
|
34 |
+
}
|
35 |
+
|
36 |
+
// Start
|
37 |
+
|
38 |
+
public function elementor_pro_compatibility( $tags ) {
|
39 |
+
if ( class_exists( 'ElementorPro\\Plugin' ) ) {
|
40 |
+
$tags[ 'select' ] = array(
|
41 |
+
'class' => array(),
|
42 |
+
'id' => array(),
|
43 |
+
'name' => array(),
|
44 |
+
'type' => array(),
|
45 |
+
'style' => array(),
|
46 |
+
'data-attribute_name' => array(),
|
47 |
+
'data-show_option_none' => array(),
|
48 |
+
);
|
49 |
+
|
50 |
+
$tags[ 'option' ] = array(
|
51 |
+
'selected' => array(),
|
52 |
+
'value' => array(),
|
53 |
+
);
|
54 |
+
}
|
55 |
+
|
56 |
+
return $tags;
|
57 |
+
}
|
58 |
+
}
|
59 |
+
}
|
60 |
+
|
includes/class-woo-variation-swatches-deactivate-feedback.php
ADDED
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
defined( 'ABSPATH' ) || exit;
|
4 |
+
|
5 |
+
if ( ! class_exists( 'Woo_Variation_Swatches_Deactivate_Feedback' ) ):
|
6 |
+
|
7 |
+
class Woo_Variation_Swatches_Deactivate_Feedback extends GetWooPlugins_Plugin_Deactivate_Feedback {
|
8 |
+
|
9 |
+
protected static $_instance = null;
|
10 |
+
|
11 |
+
public function __construct() {
|
12 |
+
|
13 |
+
parent::__construct();
|
14 |
+
add_filter( 'wp_ajax_gwp_deactivate_feedback_by_woo-variation-swatches', array( $this, 'send' ) );
|
15 |
+
|
16 |
+
do_action( 'woo_variation_swatches_deactivate_feedback_loaded', $this );
|
17 |
+
}
|
18 |
+
|
19 |
+
public static function instance() {
|
20 |
+
if ( is_null( self::$_instance ) ) {
|
21 |
+
self::$_instance = new self();
|
22 |
+
}
|
23 |
+
|
24 |
+
return self::$_instance;
|
25 |
+
}
|
26 |
+
|
27 |
+
protected function includes() {
|
28 |
+
}
|
29 |
+
|
30 |
+
public function slug() {
|
31 |
+
return woo_variation_swatches()->basename();
|
32 |
+
}
|
33 |
+
|
34 |
+
public function version() {
|
35 |
+
return woo_variation_swatches()->version();
|
36 |
+
}
|
37 |
+
|
38 |
+
public function options() {
|
39 |
+
return woo_variation_swatches()->get_options();
|
40 |
+
}
|
41 |
+
|
42 |
+
public function reasons() {
|
43 |
+
|
44 |
+
$current_user = wp_get_current_user();
|
45 |
+
|
46 |
+
return array(
|
47 |
+
'temporary_deactivation' => array(
|
48 |
+
'title' => esc_html__( 'It\'s a temporary deactivation.', 'woo-variation-swatches' ),
|
49 |
+
'input_placeholder' => '',
|
50 |
+
),
|
51 |
+
|
52 |
+
'dont_know_about' => array(
|
53 |
+
'title' => esc_html__( 'I couldn\'t understand how to make it work.', 'woo-variation-swatches' ),
|
54 |
+
'input_placeholder' => '',
|
55 |
+
'alert' => __( 'It converts single variation image to multiple variation image gallery. <br><a target="_blank" href="https://demo.getwooplugins.com/woocommerce-variation-swatches/">Please check live demo</a>.', 'woo-variation-swatches' ),
|
56 |
+
),
|
57 |
+
|
58 |
+
'no_longer_needed' => array(
|
59 |
+
'title' => esc_html__( 'I no longer need the plugin', 'woo-variation-swatches' ),
|
60 |
+
'input_placeholder' => '',
|
61 |
+
),
|
62 |
+
|
63 |
+
'found_a_better_plugin' => array(
|
64 |
+
'title' => esc_html__( 'I found a better plugin', 'woo-variation-swatches' ),
|
65 |
+
'input_placeholder' => esc_html__( 'Please share which plugin', 'woo-variation-swatches' ),
|
66 |
+
),
|
67 |
+
|
68 |
+
'broke_site_layout' => array(
|
69 |
+
'title' => __( 'The plugin <strong>broke my layout</strong> or some functionality.', 'woo-variation-swatches' ),
|
70 |
+
'input_placeholder' => '',
|
71 |
+
'alert' => __( '<a target="_blank" href="https://getwooplugins.com/tickets/">Please open a support ticket</a>, we will fix it immediately.', 'woo-variation-swatches' ),
|
72 |
+
),
|
73 |
+
|
74 |
+
'plugin_setup_help' => array(
|
75 |
+
'title' => __( 'I need someone to <strong>setup this plugin.</strong>', 'woo-variation-swatches' ),
|
76 |
+
'input_placeholder' => esc_html__( 'Your email address.', 'woo-variation-swatches' ),
|
77 |
+
'input_value' => sanitize_email( $current_user->user_email ),
|
78 |
+
'alert' => __( 'Please provide your email address to contact with you <br>and help you to set up and configure this plugin.', 'woo-variation-swatches' ),
|
79 |
+
),
|
80 |
+
|
81 |
+
'plugin_config_too_complicated' => array(
|
82 |
+
'title' => __( 'The plugin is <strong>too complicated to configure.</strong>', 'woo-variation-swatches' ),
|
83 |
+
'input_placeholder' => '',
|
84 |
+
'alert' => __( '<a target="_blank" href="https://getwooplugins.com/documentation/woocommerce-variation-swatches/">Have you checked our documentation?</a>.', 'woo-variation-swatches' ),
|
85 |
+
),
|
86 |
+
|
87 |
+
'need_specific_feature' => array(
|
88 |
+
'title' => esc_html__( 'I need specific feature that you don\'t support.', 'woo-variation-swatches' ),
|
89 |
+
'input_placeholder' => esc_html__( 'Please share with us.', 'woo-variation-swatches' ),
|
90 |
+
//'alert' => __( '<a target="_blank" href="https://getwooplugins.com/tickets/">Please open a ticket</a>, we will try to fix it immediately.', 'woo-variation-swatches' ),
|
91 |
+
),
|
92 |
+
|
93 |
+
'other' => array(
|
94 |
+
'title' => esc_html__( 'Other', 'woo-variation-swatches' ),
|
95 |
+
'input_placeholder' => esc_html__( 'Please share the reason', 'woo-variation-swatches' ),
|
96 |
+
)
|
97 |
+
);
|
98 |
+
}
|
99 |
+
|
100 |
+
}
|
101 |
+
endif;
|
includes/class-woo-variation-swatches-export-import.php
CHANGED
@@ -1,243 +1,257 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
+
|
3 |
+
defined( 'ABSPATH' ) or die( 'Keep Quit' );
|
4 |
+
|
5 |
+
if ( ! class_exists( 'Woo_Variation_Swatches_Export_Import' ) ):
|
6 |
+
|
7 |
+
class Woo_Variation_Swatches_Export_Import {
|
8 |
+
|
9 |
+
private $export_type = 'product';
|
10 |
+
private $column_id = 'attributes_type';
|
11 |
+
protected static $_instance = null;
|
12 |
+
|
13 |
+
protected function __construct() {
|
14 |
+
$this->export_hooks();
|
15 |
+
$this->import_hooks();
|
16 |
+
do_action( 'woo_variation_swatches_export_import_loaded', $this );
|
17 |
+
}
|
18 |
+
|
19 |
+
public static function instance() {
|
20 |
+
if ( is_null( self::$_instance ) ) {
|
21 |
+
self::$_instance = new self();
|
22 |
+
}
|
23 |
+
|
24 |
+
return self::$_instance;
|
25 |
+
}
|
26 |
+
|
27 |
+
public function export_hooks() {
|
28 |
+
// EXPORT
|
29 |
+
// "woocommerce_{$this->export_type}_export_column_names"
|
30 |
+
//add_filter( 'woocommerce_product_export_column_names', 'add_woo_variation_gallery_export_column' );
|
31 |
+
|
32 |
+
add_filter( "woocommerce_product_export_{$this->export_type}_default_columns", array( $this, 'export_column_name' ) );
|
33 |
+
add_filter( "woocommerce_product_export_{$this->export_type}_column_{$this->column_id}", array( $this, 'export_column_data' ), 10, 3 );
|
34 |
+
|
35 |
+
// add_filter( 'woocommerce_product_export_row_data', array( $this, 'prepare_attributes_for_export' ), 10, 3 );
|
36 |
+
|
37 |
+
}
|
38 |
+
|
39 |
+
public function import_hooks() {
|
40 |
+
// IMPORT
|
41 |
+
add_filter( 'woocommerce_csv_product_import_mapping_options', array( $this, 'import_column_name' ) );
|
42 |
+
add_filter( 'woocommerce_csv_product_import_mapping_default_columns', array( $this, 'default_import_column_name' ) );
|
43 |
+
add_action( 'woocommerce_product_import_inserted_product_object', array( $this, 'process_wc_import' ), 10, 2 );
|
44 |
+
|
45 |
+
}
|
46 |
+
|
47 |
+
// Export Function
|
48 |
+
public function prepare_attributes_for_export( $row, $product ) {
|
49 |
+
return $row;
|
50 |
+
}
|
51 |
+
|
52 |
+
public function export_column_name( $columns ) {
|
53 |
+
|
54 |
+
// column slug => column name
|
55 |
+
$columns[ $this->column_id ] = 'Swatches Attributes';
|
56 |
+
|
57 |
+
return $columns;
|
58 |
+
}
|
59 |
+
|
60 |
+
public function export_column_data( $value, $product, $column_id ) {
|
61 |
+
|
62 |
+
$attributes = $product->get_attributes();
|
63 |
+
|
64 |
+
$types = array();
|
65 |
+
|
66 |
+
if ( count( $attributes ) ) {
|
67 |
+
foreach ( $attributes as $attribute_name => $attribute ) {
|
68 |
+
|
69 |
+
if ( is_a( $attribute, 'WC_Product_Attribute' ) ) {
|
70 |
+
|
71 |
+
if ( $attribute->is_taxonomy() ) {
|
72 |
+
$attr = wc_get_attribute( $attribute->get_id() );
|
73 |
+
$name = wc_attribute_label( $attribute->get_name(), $product );
|
74 |
+
$terms = $attribute->get_terms();
|
75 |
+
|
76 |
+
if ( ! in_array( $name, $types ) && $attr->type !== 'select' ) {
|
77 |
+
$types[ $name ] = array();
|
78 |
+
$types[ $name ][ 'name' ] = $name;
|
79 |
+
$types[ $name ][ 'type' ] = $attr->type;
|
80 |
+
$types[ $name ][ 'terms' ] = array();
|
81 |
+
|
82 |
+
foreach ( $terms as $term ) {
|
83 |
+
$types[ $name ][ 'terms' ][ $term->name ] = array();
|
84 |
+
$types[ $name ][ 'terms' ][ $term->name ][ 'name' ] = $term->name;
|
85 |
+
$types[ $name ][ 'terms' ][ $term->name ][ 'color' ] = sanitize_hex_color( get_term_meta( $term->term_id, 'product_attribute_color', true ) );
|
86 |
+
|
87 |
+
$term_image_id = get_term_meta( $term->term_id, 'product_attribute_image', true );
|
88 |
+
|
89 |
+
$types[ $name ][ 'terms' ][ $term->name ][ 'image' ] = $term_image_id ? wp_get_attachment_image_url( $term_image_id, 'full' ) : '';
|
90 |
+
|
91 |
+
|
92 |
+
$types[ $name ][ 'terms' ][ $term->name ][ 'show_tooltip' ] = get_term_meta( $term->term_id, 'show_tooltip', true );
|
93 |
+
$types[ $name ][ 'terms' ][ $term->name ][ 'tooltip_text' ] = get_term_meta( $term->term_id, 'tooltip_text', true );
|
94 |
+
|
95 |
+
$tooltip_image_id = get_term_meta( $term->term_id, 'tooltip_image_id', true );
|
96 |
+
|
97 |
+
$types[ $name ][ 'terms' ][ $term->name ][ 'tooltip_image' ] = $tooltip_image_id ? wp_get_attachment_image_url( $tooltip_image_id, 'full' ) : '';
|
98 |
+
$types[ $name ][ 'terms' ][ $term->name ][ 'image_size' ] = get_term_meta( $term->term_id, 'product_attribute_image', true );
|
99 |
+
|
100 |
+
}
|
101 |
+
}
|
102 |
+
}
|
103 |
+
}
|
104 |
+
}
|
105 |
+
}
|
106 |
+
|
107 |
+
return $types ? wp_json_encode( $types ) : '';
|
108 |
+
}
|
109 |
+
|
110 |
+
// Import Function
|
111 |
+
public function import_column_name( $columns ) {
|
112 |
+
// column slug => column name
|
113 |
+
$columns[ $this->column_id ] = 'Swatches Attributes';
|
114 |
+
|
115 |
+
return $columns;
|
116 |
+
}
|
117 |
+
|
118 |
+
public function default_import_column_name( $columns ) {
|
119 |
+
// potential column name => column slug
|
120 |
+
$columns[ esc_html__( 'Swatches Attributes', 'woo-variation-gallery' ) ] = $this->column_id;
|
121 |
+
|
122 |
+
return $columns;
|
123 |
+
}
|
124 |
+
|
125 |
+
public function process_wc_import( $product, $data ) {
|
126 |
+
|
127 |
+
$product_id = $product->get_id();
|
128 |
+
|
129 |
+
if ( isset( $data[ $this->column_id ] ) && ! empty( $data[ $this->column_id ] ) ) {
|
130 |
+
|
131 |
+
$raw_data = (array) json_decode( $data[ $this->column_id ], true );
|
132 |
+
|
133 |
+
$done_taxonomy = array();
|
134 |
+
$done_terms = array();
|
135 |
+
|
136 |
+
foreach ( $raw_data as $attr_name => $attr ) {
|
137 |
+
$id = wc_attribute_taxonomy_id_by_name( $attr_name );
|
138 |
+
$taxonomy = wc_attribute_taxonomy_name( $attr_name );
|
139 |
+
|
140 |
+
|
141 |
+
if ( in_array( $id, $done_taxonomy ) ) {
|
142 |
+
continue;
|
143 |
+
}
|
144 |
+
|
145 |
+
if ( $id ) {
|
146 |
+
array_push( $done_taxonomy, $id );
|
147 |
+
|
148 |
+
wc_update_attribute( $id, array( 'type' => $attr[ 'type' ] ) );
|
149 |
+
|
150 |
+
foreach ( $attr[ 'terms' ] as $term_name => $term_data ) {
|
151 |
+
|
152 |
+
$term = get_term_by( 'name', $term_name, $taxonomy );
|
153 |
+
|
154 |
+
if ( in_array( $id, $done_terms ) ) {
|
155 |
+
continue;
|
156 |
+
}
|
157 |
+
|
158 |
+
if ( $term ) {
|
159 |
+
array_push( $done_terms, $term->term_id );
|
160 |
+
|
161 |
+
$color = ! empty( $term_data[ 'color' ] ) ? sanitize_hex_color( $term_data[ 'color' ] ) : '';
|
162 |
+
update_term_meta( $term->term_id, 'product_attribute_color', $color );
|
163 |
+
|
164 |
+
$image_id = ! empty( $term_data[ 'image' ] ) ? $this->get_attachment_id_from_url( $term_data[ 'image' ], 0 ) : '';
|
165 |
+
update_term_meta( $term->term_id, 'product_attribute_image', $image_id );
|
166 |
+
}
|
167 |
+
}
|
168 |
+
}
|
169 |
+
}
|
170 |
+
}
|
171 |
+
}
|
172 |
+
|
173 |
+
public function get_attachment_id_from_url( $url, $product_id ) {
|
174 |
+
if ( empty( $url ) ) {
|
175 |
+
return 0;
|
176 |
+
}
|
177 |
+
|
178 |
+
$id = 0;
|
179 |
+
$upload_dir = wp_upload_dir( null, false );
|
180 |
+
$base_url = $upload_dir[ 'baseurl' ] . '/';
|
181 |
+
|
182 |
+
// Check first if attachment is inside the WordPress uploads directory, or we're given a filename only.
|
183 |
+
if ( false !== strpos( $url, $base_url ) || false === strpos( $url, '://' ) ) {
|
184 |
+
// Search for yyyy/mm/slug.extension or slug.extension - remove the base URL.
|
185 |
+
$file = str_replace( $base_url, '', $url );
|
186 |
+
$args = array(
|
187 |
+
'post_type' => 'attachment',
|
188 |
+
'post_status' => 'any',
|
189 |
+
'fields' => 'ids',
|
190 |
+
'meta_query' => array( // @codingStandardsIgnoreLine.
|
191 |
+
'relation' => 'OR',
|
192 |
+
array(
|
193 |
+
'key' => '_wp_attached_file',
|
194 |
+
'value' => '^' . $file,
|
195 |
+
'compare' => 'REGEXP',
|
196 |
+
),
|
197 |
+
array(
|
198 |
+
'key' => '_wp_attached_file',
|
199 |
+
'value' => '/' . $file,
|
200 |
+
'compare' => 'LIKE',
|
201 |
+
),
|
202 |
+
array(
|
203 |
+
'key' => '_wc_attachment_source',
|
204 |
+
'value' => '/' . $file,
|
205 |
+
'compare' => 'LIKE',
|
206 |
+
),
|
207 |
+
),
|
208 |
+
);
|
209 |
+
} else {
|
210 |
+
// This is an external URL, so compare to source.
|
211 |
+
$args = array(
|
212 |
+
'post_type' => 'attachment',
|
213 |
+
'post_status' => 'any',
|
214 |
+
'fields' => 'ids',
|
215 |
+
'meta_query' => array( // @codingStandardsIgnoreLine.
|
216 |
+
array(
|
217 |
+
'value' => $url,
|
218 |
+
'key' => '_wc_attachment_source',
|
219 |
+
),
|
220 |
+
),
|
221 |
+
);
|
222 |
+
}
|
223 |
+
|
224 |
+
$ids = get_posts( $args ); // @codingStandardsIgnoreLine.
|
225 |
+
|
226 |
+
if ( $ids ) {
|
227 |
+
$id = current( $ids );
|
228 |
+
}
|
229 |
+
|
230 |
+
// Upload if attachment does not exists.
|
231 |
+
if ( ! $id && stristr( $url, '://' ) ) {
|
232 |
+
$upload = wc_rest_upload_image_from_url( $url );
|
233 |
+
|
234 |
+
if ( is_wp_error( $upload ) ) {
|
235 |
+
throw new Exception( $upload->get_error_message(), 400 );
|
236 |
+
}
|
237 |
+
|
238 |
+
$id = wc_rest_set_uploaded_image_as_attachment( $upload, $product_id );
|
239 |
+
|
240 |
+
if ( ! wp_attachment_is_image( $id ) ) {
|
241 |
+
/* translators: %s: image URL */
|
242 |
+
throw new Exception( sprintf( __( 'Not able to attach "%s".', 'woocommerce' ), $url ), 400 );
|
243 |
+
}
|
244 |
+
|
245 |
+
// Save attachment source for future reference.
|
246 |
+
update_post_meta( $id, '_wc_attachment_source', $url );
|
247 |
+
}
|
248 |
+
|
249 |
+
if ( ! $id ) {
|
250 |
+
/* translators: %s: image URL */
|
251 |
+
throw new Exception( sprintf( __( 'Unable to use image "%s".', 'woocommerce' ), $url ), 400 );
|
252 |
+
}
|
253 |
+
|
254 |
+
return $id;
|
255 |
+
}
|
256 |
+
}
|
257 |
+
endif;
|
includes/class-woo-variation-swatches-frontend.php
ADDED
@@ -0,0 +1,290 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
defined( 'ABSPATH' ) || exit;
|
3 |
+
|
4 |
+
if ( ! class_exists( 'Woo_Variation_Swatches_Frontend' ) ) {
|
5 |
+
class Woo_Variation_Swatches_Frontend {
|
6 |
+
|
7 |
+
protected static $_instance = null;
|
8 |
+
|
9 |
+
protected function __construct() {
|
10 |
+
|
11 |
+
$this->includes();
|
12 |
+
$this->hooks();
|
13 |
+
$this->init();
|
14 |
+
do_action( 'woo_variation_swatches_frontend_loaded', $this );
|
15 |
+
}
|
16 |
+
|
17 |
+
public static function instance() {
|
18 |
+
if ( is_null( self::$_instance ) ) {
|
19 |
+
self::$_instance = new self();
|
20 |
+
}
|
21 |
+
|
22 |
+
return self::$_instance;
|
23 |
+
}
|
24 |
+
|
25 |
+
protected function includes() {
|
26 |
+
require_once dirname( __FILE__ ) . '/class-woo-variation-swatches-compatibility.php';
|
27 |
+
require_once dirname( __FILE__ ) . '/class-woo-variation-swatches-cache.php';
|
28 |
+
require_once dirname( __FILE__ ) . '/class-woo-variation-swatches-product-page.php';
|
29 |
+
}
|
30 |
+
|
31 |
+
protected function hooks() {
|
32 |
+
add_filter( 'body_class', array( $this, 'body_class' ) );
|
33 |
+
}
|
34 |
+
|
35 |
+
protected function init() {
|
36 |
+
$this->get_product_page();
|
37 |
+
$this->get_compatibility();
|
38 |
+
}
|
39 |
+
|
40 |
+
// Start
|
41 |
+
|
42 |
+
public function get_product_page() {
|
43 |
+
return Woo_Variation_Swatches_Product_Page::instance();
|
44 |
+
}
|
45 |
+
|
46 |
+
public function get_compatibility() {
|
47 |
+
return Woo_Variation_Swatches_Compatibility::instance();
|
48 |
+
}
|
49 |
+
|
50 |
+
public function get_attribute_taxonomy_by_name( $attribute_name ) {
|
51 |
+
|
52 |
+
$transient_name = sprintf( 'wvs_attribute_taxonomy_%s', $attribute_name );
|
53 |
+
|
54 |
+
$cache = new Woo_Variation_Swatches_Cache( $transient_name, 'wvs_attribute_taxonomy' );
|
55 |
+
|
56 |
+
if ( isset( $_GET[ 'wvs_clear_transient' ] ) ) {
|
57 |
+
$cache->delete_transient();
|
58 |
+
}
|
59 |
+
|
60 |
+
if ( ! taxonomy_exists( $attribute_name ) ) {
|
61 |
+
return false;
|
62 |
+
}
|
63 |
+
|
64 |
+
if ( 'pa_' === substr( $attribute_name, 0, 3 ) ) {
|
65 |
+
$attribute_name = str_replace( 'pa_', '', wc_sanitize_taxonomy_name( $attribute_name ) );
|
66 |
+
} else {
|
67 |
+
return false;
|
68 |
+
}
|
69 |
+
|
70 |
+
if ( false === ( $attribute_taxonomy = $cache->get_transient() ) ) {
|
71 |
+
|
72 |
+
global $wpdb;
|
73 |
+
|
74 |
+
$attribute_taxonomy = $wpdb->get_row( "SELECT * FROM " . $wpdb->prefix . "woocommerce_attribute_taxonomies WHERE attribute_name='{$attribute_name}'" );
|
75 |
+
|
76 |
+
$cache->set_transient( $attribute_taxonomy );
|
77 |
+
}
|
78 |
+
|
79 |
+
return apply_filters( 'woo_variation_swatches_get_wc_attribute_taxonomy', $attribute_taxonomy, $attribute_name );
|
80 |
+
}
|
81 |
+
|
82 |
+
public function body_class( $classes ) {
|
83 |
+
|
84 |
+
$behavior = sprintf( 'wvs-behavior-%s', sanitize_text_field( woo_variation_swatches()->get_option( 'attribute_behavior', 'blur' ) ) );
|
85 |
+
|
86 |
+
$classes[] = 'woo-variation-swatches';
|
87 |
+
$classes[] = $behavior;
|
88 |
+
$classes[] = sprintf( 'wvs-theme-%s', strtolower( basename( get_stylesheet_directory() ) ) );
|
89 |
+
$classes[] = ( wp_is_mobile() ? 'wvs-mobile' : '' );
|
90 |
+
|
91 |
+
if ( wc_string_to_bool( woo_variation_swatches()->get_option( 'show_variation_label', 'yes' ) ) ) {
|
92 |
+
$classes[] = 'wvs-show-label';
|
93 |
+
}
|
94 |
+
if ( wc_string_to_bool( woo_variation_swatches()->get_option( 'enable_tooltip', 'yes' ) ) ) {
|
95 |
+
$classes[] = 'wvs-tooltip';
|
96 |
+
}
|
97 |
+
|
98 |
+
return array_filter( $classes );
|
99 |
+
}
|
100 |
+
|
101 |
+
public function get_dual_color_gradient_angle() {
|
102 |
+
return apply_filters( 'woo_variation_swatches_dual_color_gradient_angle', '-45deg' );
|
103 |
+
}
|
104 |
+
|
105 |
+
|
106 |
+
public function is_color_attribute( $attribute ) {
|
107 |
+
if ( ! is_object( $attribute ) ) {
|
108 |
+
return false;
|
109 |
+
}
|
110 |
+
|
111 |
+
return $attribute->attribute_type == 'color';
|
112 |
+
}
|
113 |
+
|
114 |
+
public function is_image_attribute( $attribute ) {
|
115 |
+
if ( ! is_object( $attribute ) ) {
|
116 |
+
return false;
|
117 |
+
}
|
118 |
+
|
119 |
+
return $attribute->attribute_type == 'image';
|
120 |
+
}
|
121 |
+
|
122 |
+
public function is_button_attribute( $attribute ) {
|
123 |
+
if ( ! is_object( $attribute ) ) {
|
124 |
+
return false;
|
125 |
+
}
|
126 |
+
|
127 |
+
return $attribute->attribute_type == 'button';
|
128 |
+
}
|
129 |
+
|
130 |
+
public function is_radio_attribute( $attribute ) {
|
131 |
+
if ( ! is_object( $attribute ) ) {
|
132 |
+
return false;
|
133 |
+
}
|
134 |
+
|
135 |
+
return $attribute->attribute_type == 'radio';
|
136 |
+
}
|
137 |
+
|
138 |
+
public function get_product_attribute_color( $term, $data = array() ) {
|
139 |
+
|
140 |
+
$term_id = 0;
|
141 |
+
if ( is_numeric( $term ) ) {
|
142 |
+
$term_id = $term;
|
143 |
+
}
|
144 |
+
|
145 |
+
if ( is_object( $term ) ) {
|
146 |
+
$term_id = $term->term_id;
|
147 |
+
}
|
148 |
+
|
149 |
+
return get_term_meta( $term_id, 'product_attribute_color', true );
|
150 |
+
}
|
151 |
+
|
152 |
+
public function get_product_attribute_image( $term, $data = array() ) {
|
153 |
+
|
154 |
+
$term_id = 0;
|
155 |
+
if ( is_numeric( $term ) ) {
|
156 |
+
$term_id = $term;
|
157 |
+
}
|
158 |
+
|
159 |
+
if ( is_object( $term ) ) {
|
160 |
+
$term_id = $term->term_id;
|
161 |
+
}
|
162 |
+
|
163 |
+
return get_term_meta( $term_id, 'product_attribute_image', true );
|
164 |
+
}
|
165 |
+
|
166 |
+
|
167 |
+
public function get_product_children( $product ) {
|
168 |
+
|
169 |
+
$variation_ids = $product->get_children();
|
170 |
+
$available_variations = array();
|
171 |
+
|
172 |
+
if ( is_callable( '_prime_post_caches' ) ) {
|
173 |
+
_prime_post_caches( $variation_ids );
|
174 |
+
}
|
175 |
+
|
176 |
+
foreach ( $variation_ids as $variation_id ) {
|
177 |
+
|
178 |
+
$variation = wc_get_product( $variation_id );
|
179 |
+
|
180 |
+
if ( ! $variation || ! $variation->exists() ) {
|
181 |
+
continue;
|
182 |
+
}
|
183 |
+
|
184 |
+
// Filter 'woocommerce_hide_invisible_variations' to optionally hide invisible variations (disabled variations and variations with empty price).
|
185 |
+
if ( apply_filters( 'woocommerce_hide_invisible_variations', true, $product->get_id(), $variation ) && ! $variation->variation_is_visible() ) {
|
186 |
+
continue;
|
187 |
+
}
|
188 |
+
|
189 |
+
$available_variations[] = $product->get_id();
|
190 |
+
}
|
191 |
+
|
192 |
+
return array_values( $available_variations );
|
193 |
+
|
194 |
+
}
|
195 |
+
|
196 |
+
public function get_product_variations( $product ) {
|
197 |
+
|
198 |
+
|
199 |
+
$variation_ids = $product->get_children();
|
200 |
+
$available_variations = array();
|
201 |
+
|
202 |
+
if ( is_callable( '_prime_post_caches' ) ) {
|
203 |
+
_prime_post_caches( $variation_ids );
|
204 |
+
}
|
205 |
+
|
206 |
+
foreach ( $variation_ids as $variation_id ) {
|
207 |
+
|
208 |
+
$variation = wc_get_product( $variation_id );
|
209 |
+
|
210 |
+
// Hide out of stock variations if 'Hide out of stock items from the catalog' is checked.
|
211 |
+
/*if ( ! $variation || ! $variation->exists() || ( 'yes' === get_option( 'woocommerce_hide_out_of_stock_items' ) && ! $variation->is_in_stock() ) ) {
|
212 |
+
continue;
|
213 |
+
}*/
|
214 |
+
if ( ! $variation || ! $variation->exists() ) {
|
215 |
+
continue;
|
216 |
+
}
|
217 |
+
|
218 |
+
// Filter 'woocommerce_hide_invisible_variations' to optionally hide invisible variations (disabled variations and variations with empty price).
|
219 |
+
if ( apply_filters( 'woocommerce_hide_invisible_variations', true, $product->get_id(), $variation ) && ! $variation->variation_is_visible() ) {
|
220 |
+
continue;
|
221 |
+
}
|
222 |
+
|
223 |
+
$available_variations[] = $variation;
|
224 |
+
|
225 |
+
}
|
226 |
+
|
227 |
+
return array_values( $available_variations );
|
228 |
+
}
|
229 |
+
|
230 |
+
public function get_product_attachment_props( $attachment_id = null, $product = false ) {
|
231 |
+
|
232 |
+
$props = array(
|
233 |
+
//'title' => '',
|
234 |
+
//'caption' => '',
|
235 |
+
//'url' => '',
|
236 |
+
'alt' => '',
|
237 |
+
'src' => '',
|
238 |
+
'srcset' => false,
|
239 |
+
|
240 |
+
);
|
241 |
+
$attachment = get_post( $attachment_id );
|
242 |
+
|
243 |
+
if ( $attachment && 'attachment' === $attachment->post_type ) {
|
244 |
+
// $props['alt'] = wp_strip_all_tags( $attachment->post_title );
|
245 |
+
|
246 |
+
$props[ 'alt' ] = wp_strip_all_tags( get_the_title( $product->get_id() ) );
|
247 |
+
|
248 |
+
//$props['url'] = wp_get_attachment_url( $attachment_id );
|
249 |
+
|
250 |
+
// Thumbnail version.
|
251 |
+
$image_size = apply_filters( 'woocommerce_thumbnail_size', 'woocommerce_thumbnail' );
|
252 |
+
$src = wp_get_attachment_image_src( $attachment_id, $image_size );
|
253 |
+
$props[ 'src' ] = $src[ 0 ];
|
254 |
+
$props[ 'srcset' ] = false;
|
255 |
+
}
|
256 |
+
|
257 |
+
return $props;
|
258 |
+
}
|
259 |
+
|
260 |
+
public function get_variation_data() {
|
261 |
+
ob_start();
|
262 |
+
// phpcs:disable WordPress.Security.NonceVerification.Missing
|
263 |
+
if ( empty( $_POST[ 'product_id' ] ) ) {
|
264 |
+
wp_die();
|
265 |
+
}
|
266 |
+
|
267 |
+
$variation = wc_get_product( absint( $_POST[ 'product_id' ] ) );
|
268 |
+
|
269 |
+
if ( ! $variation ) {
|
270 |
+
wp_die();
|
271 |
+
}
|
272 |
+
|
273 |
+
|
274 |
+
$variation_data = array(
|
275 |
+
'id' => $variation->get_id(),
|
276 |
+
'is_purchasable' => $variation->is_purchasable(),
|
277 |
+
'is_active' => $variation->variation_is_active(),
|
278 |
+
'in_stock' => $variation->is_in_stock(),
|
279 |
+
'max_qty' => 0 < $variation->get_max_purchase_quantity() ? $variation->get_max_purchase_quantity() : '',
|
280 |
+
'min_qty' => $variation->get_min_purchase_quantity(),
|
281 |
+
'price_html' => $variation->get_price_html(),
|
282 |
+
'availability_html' => wc_get_stock_html( $variation ),
|
283 |
+
'image' => $this->get_product_attachment_props( $variation->get_image_id(), $variation ),
|
284 |
+
);
|
285 |
+
|
286 |
+
wp_send_json( $variation_data );
|
287 |
+
// phpcs:enable
|
288 |
+
}
|
289 |
+
}
|
290 |
+
}
|
includes/class-woo-variation-swatches-manage-cache.php
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
defined( 'ABSPATH' ) || exit;
|
4 |
+
|
5 |
+
if ( ! class_exists( 'Woo_Variation_Swatches_Manage_Cache' ) ) {
|
6 |
+
class Woo_Variation_Swatches_Manage_Cache {
|
7 |
+
|
8 |
+
protected static $_instance = null;
|
9 |
+
|
10 |
+
protected function __construct() {
|
11 |
+
$this->includes();
|
12 |
+
$this->hooks();
|
13 |
+
$this->init();
|
14 |
+
do_action( 'woo_variation_swatches_manage_cache_loaded', $this );
|
15 |
+
}
|
16 |
+
|
17 |
+
public static function instance() {
|
18 |
+
if ( is_null( self::$_instance ) ) {
|
19 |
+
self::$_instance = new self();
|
20 |
+
}
|
21 |
+
|
22 |
+
return self::$_instance;
|
23 |
+
}
|
24 |
+
|
25 |
+
protected function includes() {
|
26 |
+
}
|
27 |
+
|
28 |
+
protected function hooks() {
|
29 |
+
|
30 |
+
// Attributes
|
31 |
+
add_action( 'woocommerce_attribute_added', array( $this, 'clear_transient' ) );
|
32 |
+
add_action( 'woocommerce_attribute_updated', array( $this, 'clear_transient' ) );
|
33 |
+
add_action( 'woocommerce_attribute_deleted', array( $this, 'clear_transient' ) );
|
34 |
+
// Products
|
35 |
+
add_action( 'woocommerce_save_product_variation', array( $this, 'clear_transient' ) );
|
36 |
+
add_action( 'woocommerce_update_product_variation', array( $this, 'clear_transient' ) );
|
37 |
+
add_action( 'woocommerce_delete_product_variation', array( $this, 'clear_transient' ) );
|
38 |
+
add_action( 'woocommerce_trash_product_variation', array( $this, 'clear_transient' ) );
|
39 |
+
|
40 |
+
// WooCommerce -> Status -> Tools -> Clear transients
|
41 |
+
add_action( 'woocommerce_delete_product_transients', array( $this, 'clear_transient' ) );
|
42 |
+
add_action( 'getwooplugins_update_options', array( $this, 'clear_transient' ) );
|
43 |
+
add_action( 'getwooplugins_delete_options', array( $this, 'clear_transient' ) );
|
44 |
+
}
|
45 |
+
|
46 |
+
protected function init() {
|
47 |
+
}
|
48 |
+
|
49 |
+
// start
|
50 |
+
|
51 |
+
public function clear_transient() {
|
52 |
+
|
53 |
+
// Increments the transient version to invalidate cache.
|
54 |
+
if ( method_exists( 'WC_Cache_Helper', 'get_transient_version' ) ) {
|
55 |
+
WC_Cache_Helper::get_transient_version( 'wvs_template', true );
|
56 |
+
WC_Cache_Helper::get_transient_version( 'wvs_attribute_taxonomy', true );
|
57 |
+
WC_Cache_Helper::get_transient_version( 'wvs_archive_template', true );
|
58 |
+
WC_Cache_Helper::get_transient_version( 'wvs_variation_attribute_options_html', true );
|
59 |
+
}
|
60 |
+
|
61 |
+
if ( method_exists( 'WC_Cache_Helper', 'invalidate_cache_group' ) ) {
|
62 |
+
WC_Cache_Helper::invalidate_cache_group( 'wvs_template' );
|
63 |
+
WC_Cache_Helper::invalidate_cache_group( 'wvs_attribute_taxonomy' );
|
64 |
+
WC_Cache_Helper::invalidate_cache_group( 'wvs_archive_template' );
|
65 |
+
WC_Cache_Helper::invalidate_cache_group( 'wvs_variation_attribute_options_html' );
|
66 |
+
}
|
67 |
+
}
|
68 |
+
}
|
69 |
+
}
|
70 |
+
|
includes/class-woo-variation-swatches-product-page.php
ADDED
@@ -0,0 +1,731 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
defined( 'ABSPATH' ) || exit;
|
3 |
+
|
4 |
+
if ( ! class_exists( 'Woo_Variation_Swatches_Product_Page' ) ) {
|
5 |
+
class Woo_Variation_Swatches_Product_Page {
|
6 |
+
|
7 |
+
protected static $_instance = null;
|
8 |
+
|
9 |
+
protected function __construct() {
|
10 |
+
|
11 |
+
$this->includes();
|
12 |
+
$this->hooks();
|
13 |
+
$this->init();
|
14 |
+
|
15 |
+
do_action( 'woo_variation_swatches_product_page_loaded', $this );
|
16 |
+
}
|
17 |
+
|
18 |
+
public static function instance() {
|
19 |
+
if ( is_null( self::$_instance ) ) {
|
20 |
+
self::$_instance = new self();
|
21 |
+
}
|
22 |
+
|
23 |
+
return self::$_instance;
|
24 |
+
}
|
25 |
+
|
26 |
+
protected function includes() {
|
27 |
+
|
28 |
+
}
|
29 |
+
|
30 |
+
protected function hooks() {
|
31 |
+
|
32 |
+
add_filter( 'woocommerce_dropdown_variation_attribute_options_html', array( $this, 'dropdown' ), 20, 2 );
|
33 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
34 |
+
add_action( 'wc_ajax_woo_get_all_variations', array( $this, 'get_all_variations' ) );
|
35 |
+
add_filter( 'woocommerce_get_script_data', array( $this, 'add_to_cart_variation_params' ), 10, 2 );
|
36 |
+
add_filter( 'woocommerce_ajax_variation_threshold', array( $this, 'ajax_variation_threshold' ) );
|
37 |
+
add_filter( 'woocommerce_variable_children_args', array( $this, 'variable_children_args' ), 10, 3 );
|
38 |
+
add_filter( 'woocommerce_variation_is_active', array( $this, 'disable_out_of_stock_item' ), 10, 2 );
|
39 |
+
add_filter( 'woocommerce_available_variation', array( $this, 'add_variation_data' ), 10, 3 );
|
40 |
+
// add_action( 'woocommerce_after_variations_form', array( $this, 'enqueue_script' ) );
|
41 |
+
}
|
42 |
+
|
43 |
+
protected function init() {
|
44 |
+
|
45 |
+
}
|
46 |
+
|
47 |
+
// Start
|
48 |
+
|
49 |
+
public function add_variation_data( $variation_data, $product, $variation ) {
|
50 |
+
|
51 |
+
if ( woo_variation_swatches()->is_pro() && wc_string_to_bool( woo_variation_swatches()->get_option( 'enable_linkable_variation_url', 'no' ) ) ) {
|
52 |
+
$variation_data[ 'variation_permalink' ] = $variation->get_permalink();
|
53 |
+
}
|
54 |
+
|
55 |
+
if ( woo_variation_swatches()->is_pro() && wc_string_to_bool( woo_variation_swatches()->get_option( 'default_to_image', 'yes' ) ) ) {
|
56 |
+
$variation_data[ 'variation_image_id' ] = $variation->get_image_id( 'edit' );
|
57 |
+
}
|
58 |
+
|
59 |
+
if ( woo_variation_swatches()->is_pro() && wc_string_to_bool( woo_variation_swatches()->get_option( 'show_variation_stock_info', 'no' ) ) ) {
|
60 |
+
$variation_data[ 'variation_stock_left' ] = $variation->managing_stock() ? sprintf( esc_html__( '%s left', 'woo-variation-swatches-pro' ), $variation->get_stock_quantity() ) : '';
|
61 |
+
}
|
62 |
+
|
63 |
+
return $variation_data;
|
64 |
+
}
|
65 |
+
|
66 |
+
public function disable_out_of_stock_item( $default, $variation ) {
|
67 |
+
if ( ! $variation->is_in_stock() && wc_string_to_bool( woo_variation_swatches()->get_option( 'hide_out_of_stock_variation', 'yes' ) ) ) {
|
68 |
+
return false;
|
69 |
+
}
|
70 |
+
|
71 |
+
return $default;
|
72 |
+
}
|
73 |
+
|
74 |
+
public function variable_children_args( $all_args, $product, $visible_only ) {
|
75 |
+
|
76 |
+
if ( ! $visible_only ) {
|
77 |
+
// Don't load disabled variation
|
78 |
+
$all_args[ 'post_status' ] = 'publish';
|
79 |
+
}
|
80 |
+
|
81 |
+
return $all_args;
|
82 |
+
}
|
83 |
+
|
84 |
+
public function ajax_variation_threshold( $limit ) {
|
85 |
+
return $limit;
|
86 |
+
}
|
87 |
+
|
88 |
+
public function get_variation_threshold_max( $product ) {
|
89 |
+
return absint( apply_filters( 'woo_variation_swatches_global_ajax_variation_threshold_max', 100, $product ) );
|
90 |
+
}
|
91 |
+
|
92 |
+
public function add_to_cart_variation_params( $params, $handle ) {
|
93 |
+
|
94 |
+
if ( 'wc-add-to-cart-variation' === $handle ) {
|
95 |
+
|
96 |
+
if ( is_product() ) {
|
97 |
+
$product = wc_get_product();
|
98 |
+
|
99 |
+
$params[ 'woo_variation_swatches_ajax_variation_threshold_min' ] = apply_filters( 'woocommerce_ajax_variation_threshold', 30, $product );
|
100 |
+
$params[ 'woo_variation_swatches_ajax_variation_threshold_max' ] = $this->get_variation_threshold_max( $product );
|
101 |
+
$params[ 'woo_variation_swatches_total_children' ] = count( $product->get_children() );
|
102 |
+
}
|
103 |
+
}
|
104 |
+
|
105 |
+
return $params;
|
106 |
+
}
|
107 |
+
|
108 |
+
// ajax return
|
109 |
+
public function get_all_variations() {
|
110 |
+
ob_start();
|
111 |
+
|
112 |
+
// phpcs:disable WordPress.Security.NonceVerification.Missing
|
113 |
+
if ( empty( $_POST[ 'product_id' ] ) ) {
|
114 |
+
wp_die();
|
115 |
+
}
|
116 |
+
|
117 |
+
$product = wc_get_product( absint( $_POST[ 'product_id' ] ) );
|
118 |
+
|
119 |
+
if ( ! $product ) {
|
120 |
+
wp_die();
|
121 |
+
}
|
122 |
+
|
123 |
+
$available_variations = $product->get_available_variations();
|
124 |
+
wp_send_json( $available_variations );
|
125 |
+
// phpcs:enable
|
126 |
+
}
|
127 |
+
|
128 |
+
public function enqueue_scripts() {
|
129 |
+
|
130 |
+
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
131 |
+
|
132 |
+
if ( wc_string_to_bool( woo_variation_swatches()->get_option( 'enable_stylesheet', 'yes' ) ) ) {
|
133 |
+
wp_enqueue_style( 'woo-variation-swatches', woo_variation_swatches()->assets_url( "/css/frontend{$suffix}.css" ), array(), woo_variation_swatches()->assets_version( "/css/frontend{$suffix}.css" ) );
|
134 |
+
}
|
135 |
+
|
136 |
+
$this->add_inline_style();
|
137 |
+
|
138 |
+
wp_register_script( 'woo-variation-swatches', woo_variation_swatches()->assets_url( "/js/frontend{$suffix}.js" ), array( 'jquery', 'wp-util' ), woo_variation_swatches()->assets_version( "/js/frontend{$suffix}.js" ), true );
|
139 |
+
|
140 |
+
wp_localize_script( 'woo-variation-swatches', 'woo_variation_swatches_options', $this->js_options() );
|
141 |
+
|
142 |
+
// @TODO: we need to load swatches script based on 'wc-add-to-cart-variation' script
|
143 |
+
wp_enqueue_script( 'woo-variation-swatches' );
|
144 |
+
}
|
145 |
+
|
146 |
+
public function implode_css_property_value( $raw_properties ) {
|
147 |
+
$properties = array();
|
148 |
+
foreach ( $raw_properties as $name => $value ) {
|
149 |
+
$properties[] = esc_attr( $name ) . ':' . esc_attr( $value );
|
150 |
+
}
|
151 |
+
|
152 |
+
return implode( ";\n", $properties );
|
153 |
+
}
|
154 |
+
|
155 |
+
public function inline_style_declaration() {
|
156 |
+
|
157 |
+
$width = absint( woo_variation_swatches()->get_option( 'width', 30 ) );
|
158 |
+
$height = absint( woo_variation_swatches()->get_option( 'height', 30 ) );
|
159 |
+
$font_size = absint( woo_variation_swatches()->get_option( 'single_font_size', 16 ) );
|
160 |
+
|
161 |
+
$declaration = array(
|
162 |
+
'--wvs-single-product-item-width' => sprintf( '%spx', $width ),
|
163 |
+
'--wvs-single-product-item-height' => sprintf( '%spx', $height ),
|
164 |
+
'--wvs-single-product-item-font-size' => sprintf( '%spx', $font_size ),
|
165 |
+
);
|
166 |
+
|
167 |
+
return apply_filters( 'woo_variation_swatches_inline_style_declaration', $declaration );
|
168 |
+
}
|
169 |
+
|
170 |
+
public function add_inline_style() {
|
171 |
+
|
172 |
+
if ( apply_filters( 'disable_woo_variation_swatches_inline_style', false ) ) {
|
173 |
+
return;
|
174 |
+
}
|
175 |
+
|
176 |
+
$style = $this->implode_css_property_value( $this->inline_style_declaration() );
|
177 |
+
|
178 |
+
$style = sprintf( ":root {%s}", $style );
|
179 |
+
|
180 |
+
$enable_catalog_mode = wc_string_to_bool( woo_variation_swatches()->get_option( 'enable_catalog_mode', 'no' ) );
|
181 |
+
$catalog_mode_display_limit = absint( woo_variation_swatches()->get_option( 'catalog_mode_display_limit', 0 ) );
|
182 |
+
$display_limit = absint( woo_variation_swatches()->get_option( 'display_limit', 0 ) );
|
183 |
+
|
184 |
+
$style = apply_filters( 'woo_variation_swatches_inline_style', $style );
|
185 |
+
|
186 |
+
if ( woo_variation_swatches()->is_pro() && $enable_catalog_mode && $catalog_mode_display_limit > 0 ) {
|
187 |
+
$style .= sprintf( ".enabled-catalog-display-limit-mode > li.variable-item:nth-child(n+%d) {display:none !important;}", absint( $catalog_mode_display_limit ) + 1 );
|
188 |
+
}
|
189 |
+
|
190 |
+
if ( woo_variation_swatches()->is_pro() && $display_limit > 0 ) {
|
191 |
+
$style .= sprintf( ".enabled-display-limit-mode > li.variable-item:nth-child(n+%d) {display:none !important;}", absint( $display_limit ) + 1 );
|
192 |
+
}
|
193 |
+
|
194 |
+
wp_add_inline_style( 'woo-variation-swatches', $style );
|
195 |
+
}
|
196 |
+
|
197 |
+
public function js_options() {
|
198 |
+
|
199 |
+
return apply_filters( 'woo_variation_swatches_js_options', array(
|
200 |
+
'show_variation_label' => wc_string_to_bool( woo_variation_swatches()->get_option( 'show_variation_label', 'yes' ) ),
|
201 |
+
'clear_on_reselect' => wc_string_to_bool( woo_variation_swatches()->get_option( 'clear_on_reselect', 'no' ) ),
|
202 |
+
'variation_label_separator' => sanitize_text_field( woo_variation_swatches()->get_option( 'variation_label_separator', ':' ) ),
|
203 |
+
'is_mobile' => wp_is_mobile(),
|
204 |
+
'show_variation_stock' => woo_variation_swatches()->is_pro() && wc_string_to_bool( woo_variation_swatches()->get_option( 'show_variation_stock_info', 'no' ) ),
|
205 |
+
'stock_label_threshold' => absint( woo_variation_swatches()->get_option( 'stock_label_display_threshold', '5' ) ),
|
206 |
+
) );
|
207 |
+
}
|
208 |
+
|
209 |
+
public function is_archive( $data ) {
|
210 |
+
// $args = isset( $data[ 'args' ] ) ? $data[ 'args' ] : $data;
|
211 |
+
|
212 |
+
return isset( $data[ 'is_archive' ] ) && wc_string_to_bool( $data[ 'is_archive' ] );
|
213 |
+
}
|
214 |
+
|
215 |
+
public function wrapper_class( $args, $attribute, $product, $attribute_type ) {
|
216 |
+
|
217 |
+
$classes = array();
|
218 |
+
|
219 |
+
$shape = sprintf( 'wvs-style-%s', woo_variation_swatches()->get_option( 'shape_style', 'squared' ) );
|
220 |
+
$classes[] = 'variable-items-wrapper';
|
221 |
+
$classes[] = sprintf( '%s-variable-items-wrapper', $attribute_type );
|
222 |
+
$classes[] = sanitize_text_field( $shape );
|
223 |
+
|
224 |
+
return $classes;
|
225 |
+
}
|
226 |
+
|
227 |
+
public function wrapper_html_attribute( $args, $attribute, $product, $attribute_type, $options ) {
|
228 |
+
|
229 |
+
$raw_html_attributes = array();
|
230 |
+
$css_classes = $this->wrapper_class( $args, $attribute, $product, $attribute_type );
|
231 |
+
|
232 |
+
$raw_html_attributes[ 'role' ] = 'radiogroup';
|
233 |
+
$raw_html_attributes[ 'aria-label' ] = wc_attribute_label( $attribute, $product );
|
234 |
+
$raw_html_attributes[ 'class' ] = implode( ' ', array_unique( array_values( $css_classes ) ) );
|
235 |
+
$raw_html_attributes[ 'data-attribute_name' ] = wc_variation_attribute_name( $attribute );
|
236 |
+
$raw_html_attributes[ 'data-attribute_values' ] = wc_esc_json( wp_json_encode( array_values( $options ) ) );
|
237 |
+
|
238 |
+
return $raw_html_attributes;
|
239 |
+
}
|
240 |
+
|
241 |
+
public function wrapper_start( $args, $attribute, $product, $attribute_type, $options ) {
|
242 |
+
|
243 |
+
$html_attributes = $this->wrapper_html_attribute( $args, $attribute, $product, $attribute_type, $options );
|
244 |
+
|
245 |
+
// return sprintf( '<ul role="radiogroup" aria-label="%1$s" class="%2$s" data-attribute_name="%3$s" data-attribute_values="%4$s">', esc_attr( wc_attribute_label( $attribute, $product ) ), implode( ' ', array_unique( array_values( $classes ) ) ), esc_attr( wc_variation_attribute_name( $attribute ) ), wc_esc_json( wp_json_encode( array_values( $options ) ) ) );
|
246 |
+
return sprintf( '<ul %s>', wc_implode_html_attributes( $html_attributes ) );
|
247 |
+
}
|
248 |
+
|
249 |
+
public function wrapper_end() {
|
250 |
+
return '</ul>';
|
251 |
+
}
|
252 |
+
|
253 |
+
public function item_start( $data, $attribute_type, $variation_data = array() ) {
|
254 |
+
|
255 |
+
|
256 |
+
$args = $data[ 'args' ];
|
257 |
+
$term_or_option = $data[ 'item' ];
|
258 |
+
|
259 |
+
$options = $args[ 'options' ];
|
260 |
+
$product = $args[ 'product' ];
|
261 |
+
$attribute = $args[ 'attribute' ];
|
262 |
+
$is_selected = $data[ 'is_selected' ];
|
263 |
+
$option_name = $data[ 'option_name' ];
|
264 |
+
$option_slug = $data[ 'option_slug' ];
|
265 |
+
$slug = $data[ 'slug' ];
|
266 |
+
|
267 |
+
|
268 |
+
$is_term = wc_string_to_bool( $data[ 'is_term' ] );
|
269 |
+
|
270 |
+
$css_class = implode( ' ', array_unique( array_values( apply_filters( 'woo_variation_swatches_variable_item_css_class', $this->get_item_css_classes( $data ), $data ) ) ) );
|
271 |
+
|
272 |
+
$html_attributes = array(
|
273 |
+
'aria-checked' => ( $is_selected ? 'true' : 'false' ),
|
274 |
+
'tabindex' => ( wp_is_mobile() ? '2' : '0' ),
|
275 |
+
);
|
276 |
+
|
277 |
+
$html_attributes = wp_parse_args( $this->get_item_tooltip_attribute( $data ), $html_attributes );
|
278 |
+
|
279 |
+
$html_attributes = apply_filters( 'woo_variation_swatches_variable_item_custom_attributes', $html_attributes, $attribute_type, $data );
|
280 |
+
|
281 |
+
return sprintf( '<li %1$s class="variable-item %2$s-variable-item %2$s-variable-item-%3$s %4$s" title="%5$s" data-title="%5$s" data-value="%6$s" role="radio" tabindex="0"><div class="variable-item-contents">', wc_implode_html_attributes( $html_attributes ), esc_attr( $attribute_type ), esc_attr( $option_slug ), esc_attr( $css_class ), esc_html( $option_name ), esc_attr( $slug ) );
|
282 |
+
}
|
283 |
+
|
284 |
+
public function get_item_css_classes( $data ) {
|
285 |
+
|
286 |
+
$css_classes = array();
|
287 |
+
|
288 |
+
$is_selected = wc_string_to_bool( $data[ 'is_selected' ] );
|
289 |
+
|
290 |
+
if ( $is_selected ) {
|
291 |
+
$css_classes[] = 'selected';
|
292 |
+
}
|
293 |
+
|
294 |
+
return $css_classes;
|
295 |
+
}
|
296 |
+
|
297 |
+
public function get_item_tooltip_attribute( $data ) {
|
298 |
+
|
299 |
+
$html_attributes = array();
|
300 |
+
|
301 |
+
$option_name = $data[ 'option_name' ];
|
302 |
+
|
303 |
+
$enable_tooltip = wc_string_to_bool( woo_variation_swatches()->get_option( 'enable_tooltip', 'yes' ) );
|
304 |
+
|
305 |
+
if ( $enable_tooltip ) {
|
306 |
+
$tooltip = trim( apply_filters( 'woo_variation_swatches_global_variable_item_tooltip_text', $option_name, $data ) );
|
307 |
+
|
308 |
+
$html_attributes[ 'data-wvstooltip' ] = esc_attr( $tooltip );
|
309 |
+
}
|
310 |
+
|
311 |
+
return $html_attributes;
|
312 |
+
}
|
313 |
+
|
314 |
+
public function item_end() {
|
315 |
+
$html = '';
|
316 |
+
if ( woo_variation_swatches()->is_pro() && wc_string_to_bool( woo_variation_swatches()->get_option( 'show_variation_stock_info', 'no' ) ) ) {
|
317 |
+
$html .= '<div class="wvs-stock-left-info" data-wvs-stock-info=""></div>';
|
318 |
+
}
|
319 |
+
$html .= '</div></li>';
|
320 |
+
|
321 |
+
return $html;
|
322 |
+
}
|
323 |
+
|
324 |
+
public function get_available_variation_image( $variation, $product ) {
|
325 |
+
if ( is_numeric( $variation ) ) {
|
326 |
+
$variation = wc_get_product( $variation );
|
327 |
+
}
|
328 |
+
if ( ! $variation instanceof WC_Product_Variation ) {
|
329 |
+
return false;
|
330 |
+
}
|
331 |
+
|
332 |
+
// $placeholder_image_id = get_option( 'woocommerce_placeholder_image', 0 );
|
333 |
+
// $variation_image_id = $variation->get_image_id() ? $variation->get_image_id() : $placeholder_image_id;
|
334 |
+
|
335 |
+
$available_variation = array(
|
336 |
+
'attributes' => $variation->get_variation_attributes(),
|
337 |
+
'image_id' => $variation->get_image_id(),
|
338 |
+
'is_in_stock' => $variation->is_in_stock(),
|
339 |
+
'is_purchasable' => $variation->is_purchasable(),
|
340 |
+
'variation_id' => $variation->get_id(),
|
341 |
+
'variation_image_id' => $variation->get_image_id( 'edit' ),
|
342 |
+
'product_id' => $product->get_id(),
|
343 |
+
'availability_html' => wc_get_stock_html( $variation ),
|
344 |
+
'price_html' => '<span class="price">' . $variation->get_price_html() . '</span>',
|
345 |
+
'variation_is_active' => $variation->variation_is_active(),
|
346 |
+
'variation_is_visible' => $variation->variation_is_visible(),
|
347 |
+
);
|
348 |
+
|
349 |
+
return apply_filters( 'woo_variation_swatches_get_available_variation_image', $available_variation, $variation, $product );
|
350 |
+
}
|
351 |
+
|
352 |
+
public function get_available_variation_images( $product ) {
|
353 |
+
|
354 |
+
$variation_ids = $product->get_children();
|
355 |
+
$available_variations = array();
|
356 |
+
|
357 |
+
if ( is_callable( '_prime_post_caches' ) ) {
|
358 |
+
_prime_post_caches( $variation_ids );
|
359 |
+
}
|
360 |
+
|
361 |
+
foreach ( $variation_ids as $variation_id ) {
|
362 |
+
|
363 |
+
$variation = wc_get_product( $variation_id );
|
364 |
+
|
365 |
+
// Hide out of stock variations if 'Hide out of stock items from the catalog' is checked.
|
366 |
+
if ( ! $variation || ! $variation->exists() || ( 'yes' === get_option( 'woocommerce_hide_out_of_stock_items' ) && ! $variation->is_in_stock() ) ) {
|
367 |
+
continue;
|
368 |
+
}
|
369 |
+
|
370 |
+
// Filter 'woocommerce_hide_invisible_variations' to optionally hide invisible variations (disabled variations and variations with empty price).
|
371 |
+
if ( apply_filters( 'woocommerce_hide_invisible_variations', true, $product->get_id(), $variation ) && ! $variation->variation_is_visible() ) {
|
372 |
+
continue;
|
373 |
+
}
|
374 |
+
|
375 |
+
if ( ! $variation->get_image_id( 'edit' ) > 0 ) {
|
376 |
+
// continue;
|
377 |
+
}
|
378 |
+
|
379 |
+
$available_variations[] = $this->get_available_variation_image( $variation, $product );
|
380 |
+
}
|
381 |
+
|
382 |
+
return array_values( array_filter( $available_variations ) );
|
383 |
+
}
|
384 |
+
|
385 |
+
public function get_variation_by_attribute_name_value( $available_variations, $attribute_name, $attribute_value ) {
|
386 |
+
return array_reduce( $available_variations, function ( $item, $variation ) use ( $attribute_name, $attribute_value ) {
|
387 |
+
|
388 |
+
if ( $variation[ 'attributes' ][ $attribute_name ] === $attribute_value ) {
|
389 |
+
$item = $variation;
|
390 |
+
}
|
391 |
+
|
392 |
+
return $item;
|
393 |
+
}, array() );
|
394 |
+
}
|
395 |
+
|
396 |
+
public function get_variation_data_by_attribute_name( $available_variations, $attribute_name ) {
|
397 |
+
|
398 |
+
$assigned = array();
|
399 |
+
$attribute_name = wc_variation_attribute_name( $attribute_name );
|
400 |
+
|
401 |
+
foreach ( $available_variations as $variation ) {
|
402 |
+
$attrs = $variation[ 'attributes' ];
|
403 |
+
$value = $attrs[ $attribute_name ];
|
404 |
+
|
405 |
+
if ( ! isset( $assigned[ $attribute_name ][ $value ] ) && ! empty( $value ) ) {
|
406 |
+
$assigned[ $attribute_name ][ $value ] = array(
|
407 |
+
'image_id' => $variation[ 'variation_image_id' ],
|
408 |
+
'variation_id' => $variation[ 'variation_id' ],
|
409 |
+
'type' => empty( $variation[ 'variation_image_id' ] ) ? 'button' : 'image',
|
410 |
+
);
|
411 |
+
}
|
412 |
+
}
|
413 |
+
|
414 |
+
return $assigned;
|
415 |
+
}
|
416 |
+
|
417 |
+
public function color_attribute( $data, $attribute_type, $variation_data = array() ) {
|
418 |
+
// Color
|
419 |
+
if ( 'color' === $attribute_type ) {
|
420 |
+
|
421 |
+
$term = $data[ 'item' ];
|
422 |
+
|
423 |
+
// Global Color
|
424 |
+
$color = sanitize_hex_color( woo_variation_swatches()->get_frontend()->get_product_attribute_color( $term, $data ) );
|
425 |
+
|
426 |
+
return sprintf( '<span class="variable-item-span variable-item-span-color" style="background-color:%s;"></span>', esc_attr( $color ) );
|
427 |
+
}
|
428 |
+
}
|
429 |
+
|
430 |
+
public function image_attribute( $data, $attribute_type, $variation_data = array() ) {
|
431 |
+
|
432 |
+
if ( 'image' === $attribute_type ) {
|
433 |
+
|
434 |
+
$term = $data[ 'item' ];
|
435 |
+
$option_name = $data[ 'option_name' ];
|
436 |
+
|
437 |
+
// Global
|
438 |
+
$attachment_id = apply_filters( 'woo_variation_swatches_global_product_attribute_image_id', absint( woo_variation_swatches()->get_frontend()->get_product_attribute_image( $term, $data ) ), $data );
|
439 |
+
$image_size = apply_filters( 'woo_variation_swatches_global_product_attribute_image_size', sanitize_text_field( woo_variation_swatches()->get_option( 'attribute_image_size', 'variation_swatches_image_size' ) ), $data );
|
440 |
+
$image = wp_get_attachment_image_src( $attachment_id, $image_size );
|
441 |
+
|
442 |
+
return sprintf( '<img class="variable-item-image" aria-hidden="true" alt="%s" src="%s" width="%d" height="%d" />', esc_attr( $option_name ), esc_url( $image[ 0 ] ), esc_attr( $image[ 1 ] ), esc_attr( $image[ 2 ] ) );
|
443 |
+
|
444 |
+
}
|
445 |
+
}
|
446 |
+
|
447 |
+
public function button_attribute( $data, $attribute_type, $variation_data = array() ) {
|
448 |
+
|
449 |
+
if ( 'button' === $attribute_type ) {
|
450 |
+
$option_name = $data[ 'option_name' ];
|
451 |
+
|
452 |
+
return sprintf( '<span class="variable-item-span variable-item-span-button">%s</span>', esc_html( $option_name ) );
|
453 |
+
}
|
454 |
+
}
|
455 |
+
|
456 |
+
public function radio_attribute( $data, $attribute_type, $variation_data = array() ) {
|
457 |
+
|
458 |
+
if ( 'radio' === $attribute_type ) {
|
459 |
+
|
460 |
+
|
461 |
+
$attribute_name = $data[ 'attribute_name' ];
|
462 |
+
$product = $data[ 'product' ];
|
463 |
+
$attributes = $product->get_variation_attributes();
|
464 |
+
$slug = $data[ 'slug' ];
|
465 |
+
$is_selected = wc_string_to_bool( $data[ 'is_selected' ] );
|
466 |
+
$option_name = $data[ 'option_name' ];
|
467 |
+
|
468 |
+
/*
|
469 |
+
* $get_variations = count( $product->get_children() ) <= apply_filters( 'woocommerce_ajax_variation_threshold', 30, $product );
|
470 |
+
* $available_variations = $get_variations ? $product->get_available_variations() : false;
|
471 |
+
*/
|
472 |
+
|
473 |
+
|
474 |
+
$name = sprintf( 'wvs_radio_%s', $attribute_name );
|
475 |
+
$attribute_value = $slug;
|
476 |
+
|
477 |
+
$label = esc_html( $option_name );
|
478 |
+
$label_template = apply_filters( 'woo_variation_swatches_global_item_radio_label_template', '%image% - %variation% - %price% %stock%', $data );
|
479 |
+
|
480 |
+
if ( count( array_keys( $attributes ) ) === 1 ) {
|
481 |
+
|
482 |
+
// $available_variations = $product->get_available_variations();
|
483 |
+
$available_variations = $this->get_available_variation_images( $product );
|
484 |
+
|
485 |
+
$variation = $this->get_variation_by_attribute_name_value( $available_variations, $attribute_name, $attribute_value );
|
486 |
+
|
487 |
+
$image_id = $variation[ 'variation_image_id' ];
|
488 |
+
|
489 |
+
$image_size = apply_filters( 'woo_variation_swatches_global_product_attribute_image_size', sanitize_text_field( woo_variation_swatches()->get_option( 'attribute_image_size', 'variation_swatches_image_size' ) ), $data );
|
490 |
+
|
491 |
+
// $image_size = sanitize_text_field( woo_variation_swatches()->get_option( 'attribute_image_size', 'variation_swatches_image_size' ) );
|
492 |
+
|
493 |
+
$variation_image = $this->get_variation_img_src( $image_id, $image_size );
|
494 |
+
|
495 |
+
$image = sprintf( '<img src="%1$s" title="%2$s" alt="%2$s" width="%3$s" height="%4$s" />', esc_url( $variation_image[ 'src' ] ), $label, absint( $variation_image[ 'width' ] ), absint( $variation_image[ 'height' ] ) );
|
496 |
+
$stock = wp_kses_post( $variation[ 'availability_html' ] );
|
497 |
+
$price = wp_kses_post( $variation[ 'price_html' ] );
|
498 |
+
$label = str_ireplace( array( '%image%', '%variation%', '%price%', '%stock%' ), array( $image, '<span class="variable-item-radio-value">' . $option_name . '</span>', $price, $stock ), $label_template );
|
499 |
+
}
|
500 |
+
|
501 |
+
return sprintf( '<label class="variable-item-radio-input-wrapper"><input name="%1$s" class="variable-item-radio-input" %2$s type="radio" value="%3$s" data-value="%3$s" /><span class="variable-item-radio-value-wrapper">%4$s</span></label>', $name, checked( $is_selected, true, false ), esc_attr( $slug ), $label );
|
502 |
+
}
|
503 |
+
}
|
504 |
+
|
505 |
+
public function get_variation_gallery_img_src( $variation ) {
|
506 |
+
|
507 |
+
if ( isset( $variation[ 'image' ][ 'gallery_thumbnail_src' ] ) ) {
|
508 |
+
return array(
|
509 |
+
'src' => $variation[ 'image' ][ 'gallery_thumbnail_src' ],
|
510 |
+
'width' => $variation[ 'image' ][ 'gallery_thumbnail_src_w' ],
|
511 |
+
'height' => $variation[ 'image' ][ 'gallery_thumbnail_src_h' ],
|
512 |
+
);
|
513 |
+
} else {
|
514 |
+
$gallery_thumbnail = wc_get_image_size( 'gallery_thumbnail' );
|
515 |
+
$gallery_thumbnail_size = apply_filters( 'woocommerce_gallery_thumbnail_size', array( $gallery_thumbnail[ 'width' ], $gallery_thumbnail[ 'height' ] ) );
|
516 |
+
$placeholder_img_src = wc_placeholder_img_src( $gallery_thumbnail_size );
|
517 |
+
|
518 |
+
return array(
|
519 |
+
'src' => $placeholder_img_src,
|
520 |
+
'width' => '100',
|
521 |
+
'height' => '100',
|
522 |
+
);
|
523 |
+
}
|
524 |
+
}
|
525 |
+
|
526 |
+
public function get_variation_img_src( $image_id, $image_size ) {
|
527 |
+
$image = array(
|
528 |
+
'src' => woo_variation_swatches()->images_url( '/placeholder.png' ),
|
529 |
+
'width' => 50,
|
530 |
+
'height' => 50,
|
531 |
+
'resized' => 0,
|
532 |
+
);
|
533 |
+
|
534 |
+
$image_data = wp_get_attachment_image_src( absint( $image_id ), $image_size );
|
535 |
+
|
536 |
+
if ( $image_data ) {
|
537 |
+
$image = array(
|
538 |
+
'src' => $image_data[ 0 ],
|
539 |
+
'width' => $image_data[ 1 ],
|
540 |
+
'height' => $image_data[ 2 ],
|
541 |
+
'resized' => $image_data[ 3 ],
|
542 |
+
);
|
543 |
+
}
|
544 |
+
|
545 |
+
return $image;
|
546 |
+
|
547 |
+
}
|
548 |
+
|
549 |
+
public function get_variation_image_id( $variation ) {
|
550 |
+
|
551 |
+
$placeholder_image = get_option( 'woocommerce_placeholder_image', 0 );
|
552 |
+
|
553 |
+
return empty( $variation[ 'image_id' ] ) ? $placeholder_image : $variation[ 'image_id' ];
|
554 |
+
}
|
555 |
+
|
556 |
+
public function get_swatch_data( $args, $term_or_option ) {
|
557 |
+
|
558 |
+
$options = $args[ 'options' ];
|
559 |
+
$product = $args[ 'product' ];
|
560 |
+
$attribute = $args[ 'attribute' ];
|
561 |
+
|
562 |
+
$is_term = is_object( $term_or_option );
|
563 |
+
|
564 |
+
if ( $is_term ) {
|
565 |
+
|
566 |
+
$term = $term_or_option;
|
567 |
+
$slug = $term->slug;
|
568 |
+
$is_selected = ( sanitize_title( $args[ 'selected' ] ) === $term->slug );
|
569 |
+
$option_name = apply_filters( 'woocommerce_variation_option_name', $term->name, $term, $attribute, $product );
|
570 |
+
|
571 |
+
} else {
|
572 |
+
$option = $slug = $term_or_option;
|
573 |
+
$is_selected = ( sanitize_title( $args[ 'selected' ] ) === $args[ 'selected' ] ) ? ( $args[ 'selected' ] === sanitize_title( $option ) ) : ( $args[ 'selected' ] === $option );
|
574 |
+
$option_name = apply_filters( 'woocommerce_variation_option_name', $option, null, $attribute, $product );
|
575 |
+
}
|
576 |
+
|
577 |
+
return array(
|
578 |
+
'is_archive' => isset( $args[ 'is_archive' ] ) ? $args[ 'is_archive' ] : false,
|
579 |
+
'is_selected' => $is_selected,
|
580 |
+
'is_term' => $is_term,
|
581 |
+
'term_id' => $is_term ? $term->term_id : woo_variation_swatches()->sanitize_name( $option ),
|
582 |
+
'slug' => $slug,
|
583 |
+
'option_slug' => woo_variation_swatches()->sanitize_name( $slug ),
|
584 |
+
'item' => $term_or_option,
|
585 |
+
'options' => $options,
|
586 |
+
'option_name' => $option_name,
|
587 |
+
'attribute' => $attribute,
|
588 |
+
'attribute_key' => sanitize_title( $attribute ),
|
589 |
+
'attribute_name' => wc_variation_attribute_name( $attribute ),
|
590 |
+
'attribute_label' => wc_attribute_label( $attribute, $product ),
|
591 |
+
'args' => $args,
|
592 |
+
'product' => $product,
|
593 |
+
);
|
594 |
+
}
|
595 |
+
|
596 |
+
public function dropdown( $html, $args ) {
|
597 |
+
|
598 |
+
$args = wp_parse_args( apply_filters( 'woocommerce_dropdown_variation_attribute_options_args', $args ), array(
|
599 |
+
'options' => false,
|
600 |
+
'attribute' => false,
|
601 |
+
'product' => false,
|
602 |
+
'selected' => false,
|
603 |
+
'name' => '',
|
604 |
+
'id' => '',
|
605 |
+
'class' => '',
|
606 |
+
'show_option_none' => esc_html__( 'Choose an option', 'woocommerce' ),
|
607 |
+
'is_archive' => false
|
608 |
+
) );
|
609 |
+
|
610 |
+
if ( apply_filters( 'default_woo_variation_swatches_single_product_dropdown_html', false, $args, $html, $this ) ) {
|
611 |
+
return $html;
|
612 |
+
}
|
613 |
+
|
614 |
+
// Get selected value.
|
615 |
+
if ( empty( $args[ 'selected' ] ) && $args[ 'attribute' ] && $args[ 'product' ] instanceof WC_Product ) {
|
616 |
+
$selected_key = wc_variation_attribute_name( $args[ 'attribute' ] );
|
617 |
+
// phpcs:disable WordPress.Security.NonceVerification.Recommended
|
618 |
+
//$args[ 'selected' ] = isset( $_REQUEST[ $selected_key ] ) ? wc_clean( wp_unslash( $_REQUEST[ $selected_key ] ) ) : $args[ 'product' ]->get_variation_default_attribute( $args[ 'attribute' ] );
|
619 |
+
// $args[ 'selected' ] = isset( $_REQUEST[ $selected_key ] ) ? wc_clean( rawurldecode( wp_unslash( $_REQUEST[ $selected_key ] ) ) ) : $args[ 'product' ]->get_variation_default_attribute( $args[ 'attribute' ] );
|
620 |
+
$args[ 'selected' ] = isset( $_REQUEST[ $selected_key ] ) ? woo_variation_swatches()->sanitize_name( $_REQUEST[ $selected_key ] ) : $args[ 'product' ]->get_variation_default_attribute( $args[ 'attribute' ] );
|
621 |
+
// phpcs:enable WordPress.Security.NonceVerification.Recommended
|
622 |
+
}
|
623 |
+
|
624 |
+
$options = $args[ 'options' ];
|
625 |
+
$product = $args[ 'product' ];
|
626 |
+
$attribute = $args[ 'attribute' ];
|
627 |
+
$name = $args[ 'name' ] ? $args[ 'name' ] : wc_variation_attribute_name( $attribute );
|
628 |
+
$id = $args[ 'id' ] ? $args[ 'id' ] : sanitize_title( $attribute );
|
629 |
+
$class = $args[ 'class' ];
|
630 |
+
$show_option_none = (bool) $args[ 'show_option_none' ];
|
631 |
+
// $show_option_none = true;
|
632 |
+
$show_option_none_text = $args[ 'show_option_none' ] ? $args[ 'show_option_none' ] : esc_html__( 'Choose an option', 'woocommerce' ); // We'll do our best to hide the placeholder, but we'll need to show something when resetting options.
|
633 |
+
|
634 |
+
if ( empty( $options ) && ! empty( $product ) && ! empty( $attribute ) ) {
|
635 |
+
$attributes = $product->get_variation_attributes();
|
636 |
+
$options = $attributes[ $attribute ];
|
637 |
+
}
|
638 |
+
|
639 |
+
|
640 |
+
// Default Convert to button
|
641 |
+
$global_convert_to_button = wc_string_to_bool( woo_variation_swatches()->get_option( 'default_to_button', 'yes' ) );
|
642 |
+
$get_attribute = woo_variation_swatches()->get_frontend()->get_attribute_taxonomy_by_name( $attribute );
|
643 |
+
$attribute_types = array_keys( woo_variation_swatches()->get_backend()->attribute_types() );
|
644 |
+
$attribute_type = ( $get_attribute ) ? $get_attribute->attribute_type : 'select';
|
645 |
+
$swatches_data = array();
|
646 |
+
|
647 |
+
if ( ! in_array( $attribute_type, $attribute_types ) ) {
|
648 |
+
return $html;
|
649 |
+
}
|
650 |
+
|
651 |
+
$select_inline_style = '';
|
652 |
+
|
653 |
+
if ( $global_convert_to_button && $attribute_type === 'select' ) {
|
654 |
+
$attribute_type = 'button';
|
655 |
+
}
|
656 |
+
|
657 |
+
if ( $attribute_type !== 'select' ) {
|
658 |
+
$select_inline_style = 'style="display:none"';
|
659 |
+
$class .= ' woo-variation-raw-select';
|
660 |
+
}
|
661 |
+
|
662 |
+
$html = '<select ' . $select_inline_style . ' id="' . esc_attr( $id ) . '" class="' . esc_attr( $class ) . '" name="' . esc_attr( $name ) . '" data-attribute_name="' . esc_attr( wc_variation_attribute_name( $attribute ) ) . '" data-show_option_none="' . ( $show_option_none ? 'yes' : 'no' ) . '">';
|
663 |
+
$html .= '<option value="">' . esc_html( $show_option_none_text ) . '</option>';
|
664 |
+
|
665 |
+
|
666 |
+
if ( ! empty( $options ) ) {
|
667 |
+
if ( $product && taxonomy_exists( $attribute ) ) {
|
668 |
+
// Get terms if this is a taxonomy - ordered. We need the names too.
|
669 |
+
$terms = wc_get_product_terms( $product->get_id(), $attribute, array(
|
670 |
+
'fields' => 'all',
|
671 |
+
) );
|
672 |
+
|
673 |
+
foreach ( $terms as $term ) {
|
674 |
+
if ( in_array( $term->slug, $options, true ) ) {
|
675 |
+
|
676 |
+
$swatches_data[] = $this->get_swatch_data( $args, $term );
|
677 |
+
|
678 |
+
$html .= '<option value="' . esc_attr( $term->slug ) . '" ' . selected( sanitize_title( $args[ 'selected' ] ), $term->slug, false ) . '>' . esc_html( apply_filters( 'woocommerce_variation_option_name', $term->name, $term, $attribute, $product ) ) . '</option>';
|
679 |
+
}
|
680 |
+
}
|
681 |
+
} else {
|
682 |
+
foreach ( $options as $option ) {
|
683 |
+
// This handles < 2.4.0 bw compatibility where text attributes were not sanitized.
|
684 |
+
$selected = sanitize_title( $args[ 'selected' ] ) === $args[ 'selected' ] ? selected( $args[ 'selected' ], sanitize_title( $option ), false ) : selected( $args[ 'selected' ], $option, false );
|
685 |
+
|
686 |
+
$swatches_data[] = $this->get_swatch_data( $args, $option );
|
687 |
+
|
688 |
+
$html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( apply_filters( 'woocommerce_variation_option_name', $option, null, $attribute, $product ) ) . '</option>';
|
689 |
+
}
|
690 |
+
}
|
691 |
+
}
|
692 |
+
|
693 |
+
$html .= '</select>';
|
694 |
+
|
695 |
+
if ( $attribute_type === 'select' ) {
|
696 |
+
return $html;
|
697 |
+
}
|
698 |
+
|
699 |
+
// Start Swatches
|
700 |
+
|
701 |
+
$item = '';
|
702 |
+
$wrapper = '';
|
703 |
+
$wrapper_end = '';
|
704 |
+
|
705 |
+
if ( ! empty( $options ) && ! empty( $swatches_data ) && $product ) {
|
706 |
+
|
707 |
+
$wrapper = $this->wrapper_start( $args, $attribute, $product, $attribute_type, $options );
|
708 |
+
|
709 |
+
foreach ( $swatches_data as $data ) {
|
710 |
+
|
711 |
+
$item .= $this->item_start( $data, $attribute_type );
|
712 |
+
|
713 |
+
$item .= $this->color_attribute( $data, $attribute_type );
|
714 |
+
$item .= $this->image_attribute( $data, $attribute_type );
|
715 |
+
$item .= $this->button_attribute( $data, $attribute_type );
|
716 |
+
$item .= $this->radio_attribute( $data, $attribute_type );
|
717 |
+
|
718 |
+
$item .= $this->item_end();
|
719 |
+
}
|
720 |
+
|
721 |
+
$wrapper_end = $this->wrapper_end();
|
722 |
+
|
723 |
+
}
|
724 |
+
|
725 |
+
// End Swatches
|
726 |
+
$html .= $wrapper . $item . $wrapper_end;
|
727 |
+
|
728 |
+
return $html;
|
729 |
+
}
|
730 |
+
}
|
731 |
+
}
|
includes/class-woo-variation-swatches-settings.php
ADDED
@@ -0,0 +1,762 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
defined( 'ABSPATH' ) || exit;
|
4 |
+
|
5 |
+
if ( ! class_exists( 'Woo_Variation_Swatches_Settings' ) ):
|
6 |
+
|
7 |
+
class Woo_Variation_Swatches_Settings extends GetWooPlugins_Settings_Page {
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Constructor.
|
11 |
+
*/
|
12 |
+
public function __construct() {
|
13 |
+
|
14 |
+
$this->notices();
|
15 |
+
$this->hooks();
|
16 |
+
parent::__construct();
|
17 |
+
do_action( 'woo_variation_swatches_settings_loaded', $this );
|
18 |
+
}
|
19 |
+
|
20 |
+
public function get_id() {
|
21 |
+
return 'woo_variation_swatches';
|
22 |
+
}
|
23 |
+
|
24 |
+
public function get_label() {
|
25 |
+
return esc_html__( 'Variation Swatches', 'woo-variation-swatches' );
|
26 |
+
}
|
27 |
+
|
28 |
+
public function get_menu_name() {
|
29 |
+
return esc_html__( 'Swatches Settings', 'woo-variation-swatches' );
|
30 |
+
}
|
31 |
+
|
32 |
+
public function get_title() {
|
33 |
+
return esc_html__( 'Variation Swatches for WooCommerce Settings', 'woo-variation-swatches' );
|
34 |
+
}
|
35 |
+
|
36 |
+
protected function hooks() {
|
37 |
+
add_action( 'admin_footer', array( $this, 'modal_templates' ) );
|
38 |
+
add_action( 'getwooplugins_sidebar', array( $this, 'sidebar' ) );
|
39 |
+
add_filter( 'show_getwooplugins_save_button', array( $this, 'save_button' ), 10, 3 );
|
40 |
+
add_filter( 'show_getwooplugins_sidebar', array( $this, 'save_button' ), 10, 3 );
|
41 |
+
}
|
42 |
+
|
43 |
+
public function save_button( $default, $current_tab, $current_section ) {
|
44 |
+
if ( $current_tab === $this->get_id() && in_array( $current_section, array( 'tutorial', 'plugins', 'group' ) ) ) {
|
45 |
+
return false;
|
46 |
+
}
|
47 |
+
|
48 |
+
return $default;
|
49 |
+
}
|
50 |
+
|
51 |
+
public function sidebar( $current_tab ) {
|
52 |
+
if ( $current_tab === $this->get_id() ) {
|
53 |
+
include_once dirname( __FILE__ ) . '/html-settings-sidebar.php';
|
54 |
+
}
|
55 |
+
}
|
56 |
+
|
57 |
+
public function modal_templates() {
|
58 |
+
$this->template_shape_style();
|
59 |
+
$this->template_default_to_button();
|
60 |
+
$this->template_default_to_image();
|
61 |
+
$this->template_clear_on_reselect();
|
62 |
+
$this->template_hide_out_of_stock_variation();
|
63 |
+
$this->template_clickable_out_of_stock_variation();
|
64 |
+
$this->template_show_variation_stock_info();
|
65 |
+
$this->template_display_limit();
|
66 |
+
$this->template_archive_show_availability();
|
67 |
+
$this->template_archive_swatches_position();
|
68 |
+
$this->template_show_swatches_on_filter_widget();
|
69 |
+
$this->template_enable_catalog_mode();
|
70 |
+
$this->template_enable_single_variation_preview();
|
71 |
+
$this->template_enable_large_size();
|
72 |
+
$this->template_archive_align();
|
73 |
+
$this->template_attribute_behavior();
|
74 |
+
$this->template_enable_linkable_variation_url();
|
75 |
+
$this->template_license();
|
76 |
+
$this->template_show_on_archive();
|
77 |
+
$this->template_archive_default_selected();
|
78 |
+
}
|
79 |
+
|
80 |
+
public function modal_support_links() {
|
81 |
+
$links = array(
|
82 |
+
'button_url' => 'https://getwooplugins.com/documentation/woocommerce-variation-swatches/',
|
83 |
+
'button_text' => esc_html__( 'See Documentation', 'woo-variation-swatches' ),
|
84 |
+
'link_url' => 'https://getwooplugins.com/tickets/',
|
85 |
+
'link_text' => esc_html__( 'Help & Support', 'woo-variation-swatches' )
|
86 |
+
);
|
87 |
+
|
88 |
+
return $links;
|
89 |
+
}
|
90 |
+
|
91 |
+
public function modal_buy_links() {
|
92 |
+
|
93 |
+
if ( woo_variation_swatches()->is_pro() ) {
|
94 |
+
return $this->modal_support_links();
|
95 |
+
}
|
96 |
+
|
97 |
+
$links = array(
|
98 |
+
'button_url' => 'https://getwooplugins.com/plugins/woocommerce-variation-swatches/',
|
99 |
+
'button_text' => esc_html__( 'Buy Now', 'woo-variation-swatches' ),
|
100 |
+
'link_url' => 'https://getwooplugins.com/documentation/woocommerce-variation-swatches/',
|
101 |
+
'link_text' => esc_html__( 'See Documentation', 'woo-variation-swatches' )
|
102 |
+
);
|
103 |
+
|
104 |
+
return $links;
|
105 |
+
}
|
106 |
+
|
107 |
+
public function template_shape_style() {
|
108 |
+
|
109 |
+
$body = sprintf( '<video preload="auto" autoplay loop muted playsinline src="%s"></video>', esc_url( woo_variation_swatches()->org_assets_url( '/preview-01.webm' ) ) );
|
110 |
+
$this->modal_dialog( 'shape_style', esc_html__( 'Swatches Shape Style', 'woo-variation-swatches' ), $body, $this->modal_support_links() );
|
111 |
+
}
|
112 |
+
|
113 |
+
public function template_default_to_button() {
|
114 |
+
|
115 |
+
$body = sprintf( '<video preload="auto" autoplay loop muted playsinline src="%s"></video>', esc_url( woo_variation_swatches()->org_assets_url( '/preview-02.webm' ) ) );
|
116 |
+
$this->modal_dialog( 'default_to_button', esc_html__( 'Swatches Default To Button', 'woo-variation-swatches' ), $body, $this->modal_support_links() );
|
117 |
+
}
|
118 |
+
|
119 |
+
public function template_default_to_image() {
|
120 |
+
|
121 |
+
$body = sprintf( '<video preload="auto" autoplay loop muted playsinline src="%s"></video>', esc_url( woo_variation_swatches()->org_assets_url( '/preview-03.webm' ) ) );
|
122 |
+
$this->modal_dialog( 'default_to_image', esc_html__( 'Swatches Default To Image', 'woo-variation-swatches' ), $body, $this->modal_buy_links() );
|
123 |
+
}
|
124 |
+
|
125 |
+
public function template_clear_on_reselect() {
|
126 |
+
|
127 |
+
$body = sprintf( '<video preload="auto" autoplay loop muted playsinline src="%s"></video>', esc_url( woo_variation_swatches()->org_assets_url( '/preview-04.webm' ) ) );
|
128 |
+
$this->modal_dialog( 'clear_on_reselect', esc_html__( 'Swatches Clear on Reselect', 'woo-variation-swatches' ), $body, $this->modal_support_links() );
|
129 |
+
}
|
130 |
+
|
131 |
+
public function template_hide_out_of_stock_variation() {
|
132 |
+
|
133 |
+
$body = sprintf( '<video preload="auto" autoplay loop muted playsinline src="%s"></video>', esc_url( woo_variation_swatches()->org_assets_url( '/preview-05.webm' ) ) );
|
134 |
+
$this->modal_dialog( 'hide_out_of_stock_variation', esc_html__( 'Swatches Hide Out Of Stock', 'woo-variation-swatches' ), $body, $this->modal_buy_links() );
|
135 |
+
}
|
136 |
+
|
137 |
+
public function template_clickable_out_of_stock_variation() {
|
138 |
+
|
139 |
+
$body = sprintf( '<video preload="auto" autoplay loop muted playsinline src="%s"></video>', esc_url( woo_variation_swatches()->org_assets_url( '/preview-06.webm' ) ) );
|
140 |
+
$this->modal_dialog( 'clickable_out_of_stock_variation', esc_html__( 'Swatches Clickable Out Of Stock', 'woo-variation-swatches' ), $body, $this->modal_buy_links() );
|
141 |
+
}
|
142 |
+
|
143 |
+
public function template_show_variation_stock_info() {
|
144 |
+
|
145 |
+
$body = sprintf( '<video preload="auto" autoplay loop muted playsinline src="%s"></video>', esc_url( woo_variation_swatches()->org_assets_url( '/preview-07.webm' ) ) );
|
146 |
+
$this->modal_dialog( 'show_variation_stock_info', esc_html__( 'Swatches Show variation stock info', 'woo-variation-swatches' ), $body, $this->modal_buy_links() );
|
147 |
+
}
|
148 |
+
|
149 |
+
public function template_display_limit() {
|
150 |
+
|
151 |
+
$body = sprintf( '<video preload="auto" autoplay loop muted playsinline src="%s"></video>', esc_url( woo_variation_swatches()->org_assets_url( '/preview-08.webm' ) ) );
|
152 |
+
$this->modal_dialog( 'display_limit', esc_html__( 'Swatches Attribute Display Limit', 'woo-variation-swatches' ), $body, $this->modal_buy_links() );
|
153 |
+
}
|
154 |
+
|
155 |
+
public function template_archive_show_availability() {
|
156 |
+
|
157 |
+
$body = sprintf( '<video preload="auto" autoplay loop muted playsinline src="%s"></video>', esc_url( woo_variation_swatches()->org_assets_url( '/preview-09.webm' ) ) );
|
158 |
+
$this->modal_dialog( 'archive_show_availability', esc_html__( 'Swatches Show Product Availability', 'woo-variation-swatches' ), $body, $this->modal_support_links() );
|
159 |
+
}
|
160 |
+
|
161 |
+
public function template_archive_swatches_position() {
|
162 |
+
|
163 |
+
$body = sprintf( '<video preload="auto" autoplay loop muted playsinline src="%s"></video>', esc_url( woo_variation_swatches()->org_assets_url( '/preview-10.webm' ) ) );
|
164 |
+
$this->modal_dialog( 'archive_swatches_position', esc_html__( 'Swatches Display Position', 'woo-variation-swatches' ), $body, $this->modal_buy_links() );
|
165 |
+
}
|
166 |
+
|
167 |
+
public function template_show_swatches_on_filter_widget() {
|
168 |
+
|
169 |
+
$body = sprintf( '<video preload="auto" autoplay loop muted playsinline src="%s"></video>', esc_url( woo_variation_swatches()->org_assets_url( '/preview-11.webm' ) ) );
|
170 |
+
$this->modal_dialog( 'show_swatches_on_filter_widget', esc_html__( 'Swatches Display On Widget', 'woo-variation-swatches' ), $body, $this->modal_buy_links() );
|
171 |
+
}
|
172 |
+
|
173 |
+
public function template_enable_catalog_mode() {
|
174 |
+
|
175 |
+
$body = sprintf( '<video preload="auto" autoplay loop muted playsinline src="%s"></video>', esc_url( woo_variation_swatches()->org_assets_url( '/preview-12.webm' ) ) );
|
176 |
+
$this->modal_dialog( 'enable_catalog_mode', esc_html__( 'Swatches Show as catalog mode', 'woo-variation-swatches' ), $body, $this->modal_buy_links() );
|
177 |
+
}
|
178 |
+
|
179 |
+
public function template_enable_single_variation_preview() {
|
180 |
+
|
181 |
+
$body = sprintf( '<video preload="auto" autoplay loop muted playsinline src="%s"></video>', esc_url( woo_variation_swatches()->org_assets_url( '/preview-13.webm' ) ) );
|
182 |
+
$this->modal_dialog( 'enable_single_variation_preview', esc_html__( 'Swatches Show variation preview', 'woo-variation-swatches' ), $body, $this->modal_buy_links() );
|
183 |
+
}
|
184 |
+
|
185 |
+
public function template_enable_large_size() {
|
186 |
+
|
187 |
+
$body = sprintf( '<video preload="auto" autoplay loop muted playsinline src="%s"></video>', esc_url( woo_variation_swatches()->org_assets_url( '/preview-14.webm' ) ) );
|
188 |
+
$this->modal_dialog( 'enable_large_size', esc_html__( 'Swatches Show variation preview', 'woo-variation-swatches' ), $body, $this->modal_buy_links() );
|
189 |
+
}
|
190 |
+
|
191 |
+
public function template_archive_align() {
|
192 |
+
|
193 |
+
$body = sprintf( '<video preload="auto" autoplay loop muted playsinline src="%s"></video>', esc_url( woo_variation_swatches()->org_assets_url( '/preview-15.webm' ) ) );
|
194 |
+
$this->modal_dialog( 'archive_align', esc_html__( 'Swatches Show variation preview', 'woo-variation-swatches' ), $body, $this->modal_buy_links() );
|
195 |
+
}
|
196 |
+
|
197 |
+
public function template_attribute_behavior() {
|
198 |
+
|
199 |
+
$body = sprintf( '<video preload="auto" autoplay loop muted playsinline src="%s"></video>', esc_url( woo_variation_swatches()->org_assets_url( '/preview-16.webm' ) ) );
|
200 |
+
$this->modal_dialog( 'attribute_behavior', esc_html__( 'Swatches Disabled Attribute style', 'woo-variation-swatches' ), $body, $this->modal_support_links() );
|
201 |
+
}
|
202 |
+
|
203 |
+
public function template_enable_linkable_variation_url() {
|
204 |
+
|
205 |
+
$body = sprintf( '<video preload="auto" autoplay loop muted playsinline src="%s"></video>', esc_url( woo_variation_swatches()->org_assets_url( '/preview-17.webm' ) ) );
|
206 |
+
$this->modal_dialog( 'enable_linkable_variation_url', esc_html__( 'Swatches Generate Sharable URL', 'woo-variation-swatches' ), $body, $this->modal_buy_links() );
|
207 |
+
}
|
208 |
+
|
209 |
+
public function template_license() {
|
210 |
+
|
211 |
+
$links = array(
|
212 |
+
'button_url' => 'https://getwooplugins.com/my-account/downloads/',
|
213 |
+
'button_text' => esc_html__( 'Get license', 'woo-variation-swatches' ),
|
214 |
+
'link_url' => 'https://getwooplugins.com/tickets/',
|
215 |
+
'link_text' => esc_html__( 'Help & Support', 'woo-variation-swatches' )
|
216 |
+
);
|
217 |
+
|
218 |
+
$body = sprintf( '<video preload="auto" autoplay loop muted playsinline src="%s"></video>', esc_url( woo_variation_swatches()->org_assets_url( '/preview-18.webm' ) ) );
|
219 |
+
$this->modal_dialog( 'license', esc_html__( 'Swatches License', 'woo-variation-swatches' ), $body, $links );
|
220 |
+
}
|
221 |
+
|
222 |
+
public function template_show_on_archive() {
|
223 |
+
|
224 |
+
$body = sprintf( '<video preload="auto" autoplay loop muted playsinline src="%s"></video>', esc_url( woo_variation_swatches()->org_assets_url( '/preview-19.webm' ) ) );
|
225 |
+
$this->modal_dialog( 'show_on_archive', esc_html__( 'Swatches On Archive Page', 'woo-variation-swatches' ), $body, $this->modal_buy_links() );
|
226 |
+
}
|
227 |
+
|
228 |
+
public function template_archive_default_selected() {
|
229 |
+
|
230 |
+
$body = sprintf( '<video preload="auto" autoplay loop muted playsinline src="%s"></video>', esc_url( woo_variation_swatches()->org_assets_url( '/preview-20.webm' ) ) );
|
231 |
+
$this->modal_dialog( 'archive_default_selected', esc_html__( 'Swatches Archive Default Selected', 'woo-variation-swatches' ), $body, $this->modal_buy_links() );
|
232 |
+
}
|
233 |
+
|
234 |
+
|
235 |
+
|
236 |
+
protected function notices() {
|
237 |
+
// phpcs:disable WordPress.Security.NonceVerification.Recommended
|
238 |
+
if ( $this->is_current_tab() && isset( $_GET[ 'reset' ] ) ) { // WPCS: input var okay, CSRF ok.
|
239 |
+
GetWooPlugins_Admin_Settings::add_message( __( 'Swatches Settings Reset.', 'woo-variation-swatches' ) );
|
240 |
+
}
|
241 |
+
// phpcs:enable
|
242 |
+
}
|
243 |
+
|
244 |
+
public function output( $current_tab ) {
|
245 |
+
global $current_section;
|
246 |
+
|
247 |
+
if ( $current_tab === $this->get_id() && 'tutorial' === $current_section ) {
|
248 |
+
$this->tutorial_section( $current_section );
|
249 |
+
} elseif ( $current_tab === $this->get_id() && 'group' === $current_section ) {
|
250 |
+
$this->group_section( $current_section );
|
251 |
+
} else {
|
252 |
+
parent::output( $current_tab );
|
253 |
+
}
|
254 |
+
}
|
255 |
+
|
256 |
+
public static function get_all_image_sizes() {
|
257 |
+
|
258 |
+
$image_subsizes = wp_get_registered_image_subsizes();
|
259 |
+
|
260 |
+
return apply_filters( 'woo_variation_swatches_get_all_image_sizes', array_reduce( array_keys( $image_subsizes ), function ( $carry, $item ) use ( $image_subsizes ) {
|
261 |
+
|
262 |
+
$title = ucwords( str_ireplace( array( '-', '_' ), ' ', $item ) );
|
263 |
+
$width = $image_subsizes[ $item ][ 'width' ];
|
264 |
+
$height = $image_subsizes[ $item ][ 'height' ];
|
265 |
+
|
266 |
+
$carry[ $item ] = sprintf( '%s (%d × %d)', $title, $width, $height );
|
267 |
+
|
268 |
+
return $carry;
|
269 |
+
}, array() ) );
|
270 |
+
}
|
271 |
+
|
272 |
+
public function plugins_tab( $label ) {
|
273 |
+
return sprintf( '<span class="getwooplugins-recommended-plugins-tab dashicons dashicons-admin-plugins"></span> <span>%s</span>', $label );
|
274 |
+
}
|
275 |
+
|
276 |
+
protected function get_own_sections() {
|
277 |
+
$sections = array(
|
278 |
+
'' => esc_html__( 'General', 'woo-variation-swatches' ),
|
279 |
+
'advanced' => esc_html__( 'Advanced', 'woo-variation-swatches' ),
|
280 |
+
'style' => esc_html__( 'Styling', 'woo-variation-swatches' ),
|
281 |
+
'single' => esc_html__( 'Product Page', 'woo-variation-swatches' ),
|
282 |
+
'archive' => esc_html__( 'Archive / Shop', 'woo-variation-swatches' ),
|
283 |
+
'special' => esc_html__( 'Special Attributes', 'woo-variation-swatches' ),
|
284 |
+
'group' => esc_html__( 'Group', 'woo-variation-swatches' ),
|
285 |
+
'license' => array(
|
286 |
+
'name' => esc_html__( 'License', 'woo-variation-swatches' ),
|
287 |
+
'url' => false
|
288 |
+
),
|
289 |
+
'tutorial' => esc_html__( 'Tutorial', 'woo-variation-swatches' ),
|
290 |
+
);
|
291 |
+
|
292 |
+
if ( current_user_can( 'install_plugins' ) ) {
|
293 |
+
$sections[ 'plugins' ] = array(
|
294 |
+
'name' => $this->plugins_tab( esc_html__( 'Useful Free Plugins', 'woo-variation-swatches' ) ),
|
295 |
+
'url' => self_admin_url( 'plugin-install.php?s=getwooplugins&tab=search&type=author' ),
|
296 |
+
);
|
297 |
+
}
|
298 |
+
|
299 |
+
return $sections;
|
300 |
+
}
|
301 |
+
|
302 |
+
public function tutorial_section( $current_section ) {
|
303 |
+
ob_start();
|
304 |
+
$settings = $this->get_settings( $current_section );
|
305 |
+
include_once dirname( __FILE__ ) . '/html-settings-tutorial.php';
|
306 |
+
echo ob_get_clean();
|
307 |
+
}
|
308 |
+
|
309 |
+
public function group_section( $current_section ) {
|
310 |
+
ob_start();
|
311 |
+
$settings = $this->get_settings( $current_section );
|
312 |
+
include_once dirname( __FILE__ ) . '/html-settings-group.php';
|
313 |
+
echo ob_get_clean();
|
314 |
+
}
|
315 |
+
|
316 |
+
protected function get_settings_for_default_section() {
|
317 |
+
|
318 |
+
$settings = array(
|
319 |
+
|
320 |
+
array(
|
321 |
+
'id' => 'general_options',
|
322 |
+
'type' => 'title',
|
323 |
+
'title' => esc_html__( 'General options', 'woo-variation-swatches' ),
|
324 |
+
'desc' => '',
|
325 |
+
),
|
326 |
+
|
327 |
+
array(
|
328 |
+
'id' => 'enable_stylesheet',
|
329 |
+
'type' => 'checkbox',
|
330 |
+
'title' => esc_html__( 'Enable Stylesheet', 'woo-variation-swatches' ),
|
331 |
+
'desc' => esc_html__( 'Enable default stylesheet', 'woo-variation-swatches' ),
|
332 |
+
'default' => 'yes'
|
333 |
+
),
|
334 |
+
|
335 |
+
array(
|
336 |
+
'id' => 'enable_tooltip',
|
337 |
+
'type' => 'checkbox',
|
338 |
+
'title' => esc_html__( 'Enable Tooltip', 'woo-variation-swatches' ),
|
339 |
+
'desc' => esc_html__( 'Enable tooltip on each product attribute.', 'woo-variation-swatches' ),
|
340 |
+
'default' => 'yes',
|
341 |
+
'require' => $this->normalize_required_attribute( array( 'enable_stylesheet' => array( 'type' => '!empty' ) ) ),
|
342 |
+
),
|
343 |
+
|
344 |
+
array(
|
345 |
+
'id' => 'shape_style',
|
346 |
+
'title' => esc_html__( 'Shape Style', 'woo-variation-swatches' ),
|
347 |
+
'type' => 'radio',
|
348 |
+
'desc' => esc_html__( 'This controls which shape style used by default.', 'woo-variation-swatches' ),
|
349 |
+
'desc_tip' => true,
|
350 |
+
'default' => 'squared',
|
351 |
+
/*'is_pro' => true,
|
352 |
+
'is_new' => true,*/
|
353 |
+
|
354 |
+
'options' => array(
|
355 |
+
'rounded' => esc_html__( 'Rounded Shape', 'woo-variation-swatches' ),
|
356 |
+
'squared' => esc_html__( 'Squared Shape', 'woo-variation-swatches' ),
|
357 |
+
),
|
358 |
+
'help_preview' => true,
|
359 |
+
),
|
360 |
+
|
361 |
+
array(
|
362 |
+
'id' => 'default_to_button',
|
363 |
+
'title' => esc_html__( 'Dropdowns to Button', 'woo-variation-swatches' ),
|
364 |
+
'desc' => esc_html__( 'Convert default dropdowns to button.', 'woo-variation-swatches' ),
|
365 |
+
'default' => 'yes',
|
366 |
+
'type' => 'checkbox',
|
367 |
+
'help_preview' => true,
|
368 |
+
),
|
369 |
+
|
370 |
+
array(
|
371 |
+
'id' => 'default_to_image',
|
372 |
+
'type' => 'checkbox',
|
373 |
+
'title' => esc_html__( 'Dropdowns to Image', 'woo-variation-swatches' ),
|
374 |
+
'desc' => esc_html__( 'Convert default dropdowns to image type if variation has an image.', 'woo-variation-swatches' ),
|
375 |
+
'default' => 'yes',
|
376 |
+
'is_pro' => true,
|
377 |
+
),
|
378 |
+
|
379 |
+
array(
|
380 |
+
'type' => 'sectionend',
|
381 |
+
'id' => 'general_options',
|
382 |
+
),
|
383 |
+
|
384 |
+
);
|
385 |
+
|
386 |
+
return $settings;
|
387 |
+
}
|
388 |
+
|
389 |
+
protected function get_settings_for_advanced_section() {
|
390 |
+
$settings = array(
|
391 |
+
|
392 |
+
array(
|
393 |
+
'id' => 'advanced_options',
|
394 |
+
'type' => 'title',
|
395 |
+
'title' => esc_html__( 'Advanced options', 'woo-variation-swatches' ),
|
396 |
+
'desc' => '',
|
397 |
+
),
|
398 |
+
|
399 |
+
array(
|
400 |
+
'id' => 'clear_on_reselect',
|
401 |
+
'type' => 'checkbox',
|
402 |
+
'title' => esc_html__( 'Clear on Reselect', 'woo-variation-swatches' ),
|
403 |
+
'desc' => esc_html__( 'Clear selected attribute on select again', 'woo-variation-swatches' ),
|
404 |
+
'default' => 'no',
|
405 |
+
'help_preview' => true,
|
406 |
+
),
|
407 |
+
|
408 |
+
array(
|
409 |
+
'id' => 'hide_out_of_stock_variation',
|
410 |
+
'type' => 'checkbox',
|
411 |
+
'title' => esc_html__( 'Disable Out of Stock', 'woo-variation-swatches' ),
|
412 |
+
'desc' => esc_html__( 'Disable Out Of Stock item', 'woo-variation-swatches' ),
|
413 |
+
'default' => 'yes',
|
414 |
+
'is_pro' => true,
|
415 |
+
),
|
416 |
+
|
417 |
+
array(
|
418 |
+
'id' => 'clickable_out_of_stock_variation',
|
419 |
+
'type' => 'checkbox',
|
420 |
+
'title' => esc_html__( 'Clickable Out Of Stock', 'woo-variation-swatches' ),
|
421 |
+
'desc' => esc_html__( 'Clickable Out Of Stock item', 'woo-variation-swatches' ),
|
422 |
+
'default' => 'no',
|
423 |
+
//'require' => $this->normalize_required_attribute( array( 'hide_out_of_stock_variation' => array( 'type' => 'empty' ) ) ),
|
424 |
+
'is_pro' => true,
|
425 |
+
),
|
426 |
+
|
427 |
+
array(
|
428 |
+
'id' => 'attribute_behavior',
|
429 |
+
'type' => 'radio',
|
430 |
+
'title' => esc_html__( 'Disabled Attribute style', 'woo-variation-swatches' ),
|
431 |
+
'desc' => esc_html__( 'Disabled / Out Of Stock attribute will be hide / blur / crossed.', 'woo-variation-swatches' ),
|
432 |
+
'desc_tip' => true,
|
433 |
+
'options' => array(
|
434 |
+
'blur' => esc_html__( 'Blur with cross', 'woo-variation-swatches' ),
|
435 |
+
'blur-no-cross' => esc_html__( 'Blur without cross', 'woo-variation-swatches' ),
|
436 |
+
'hide' => esc_html__( 'Hide', 'woo-variation-swatches' ),
|
437 |
+
),
|
438 |
+
'default' => 'blur',
|
439 |
+
'help_preview' => true,
|
440 |
+
),
|
441 |
+
|
442 |
+
array(
|
443 |
+
'id' => 'attribute_image_size',
|
444 |
+
'type' => 'select',
|
445 |
+
'title' => esc_html__( 'Attribute image size', 'woo-variation-swatches' ),
|
446 |
+
'desc' => has_filter( 'woo_variation_swatches_global_product_attribute_image_size' ) ? __( '<span style="color: red">Attribute image size can be changed by <code>woo_variation_swatches_global_product_attribute_image_size</code> filter hook. So this option will not apply any effect.</span>', 'woo-variation-swatches' ) : __( sprintf( 'Choose attribute image size. <a target="_blank" href="%s">Media Settings</a> or use <strong>Regenerate Thumbnails</strong> plugin', esc_url( admin_url( 'options-media.php' ) ) ), 'woo-variation-swatches' ),
|
447 |
+
'options' => self::get_all_image_sizes(),
|
448 |
+
'default' => 'variation_swatches_image_size'
|
449 |
+
),
|
450 |
+
|
451 |
+
array(
|
452 |
+
'type' => 'sectionend',
|
453 |
+
'id' => 'advanced_options',
|
454 |
+
),
|
455 |
+
);
|
456 |
+
|
457 |
+
return $settings;
|
458 |
+
}
|
459 |
+
|
460 |
+
protected function get_settings_for_style_section() {
|
461 |
+
|
462 |
+
$settings = array(
|
463 |
+
|
464 |
+
// Start single page swatches style
|
465 |
+
array(
|
466 |
+
'id' => 'single_style_options',
|
467 |
+
'type' => 'title',
|
468 |
+
'title' => esc_html__( 'Product Page Swatches Size', 'woo-variation-swatches' ),
|
469 |
+
'desc' => esc_html__( 'Change swatches style on product page', 'woo-variation-swatches' ),
|
470 |
+
),
|
471 |
+
|
472 |
+
array(
|
473 |
+
'id' => 'width',
|
474 |
+
'type' => 'number',
|
475 |
+
'title' => esc_html__( 'Width', 'woo-variation-swatches' ),
|
476 |
+
'desc' => esc_html__( 'Single product variation item width. Default is: 30', 'woo-variation-swatches' ),
|
477 |
+
'css' => 'width: 50px;',
|
478 |
+
'default' => '30',
|
479 |
+
'suffix' => 'px',
|
480 |
+
'custom_attributes' => array(
|
481 |
+
'min' => 10,
|
482 |
+
'max' => 200,
|
483 |
+
'step' => 5,
|
484 |
+
),
|
485 |
+
),
|
486 |
+
|
487 |
+
array(
|
488 |
+
'id' => 'height',
|
489 |
+
'type' => 'number',
|
490 |
+
'title' => esc_html__( 'Height', 'woo-variation-swatches' ),
|
491 |
+
'desc' => esc_html__( 'Single product variation item height. Default is: 30', 'woo-variation-swatches' ),
|
492 |
+
'css' => 'width: 50px;',
|
493 |
+
'default' => 30,
|
494 |
+
'suffix' => 'px',
|
495 |
+
'custom_attributes' => array(
|
496 |
+
'min' => 10,
|
497 |
+
'max' => 200,
|
498 |
+
'step' => 5,
|
499 |
+
),
|
500 |
+
),
|
501 |
+
|
502 |
+
array(
|
503 |
+
'id' => 'single_font_size',
|
504 |
+
'type' => 'number',
|
505 |
+
'title' => esc_html__( 'Font Size', 'woo-variation-swatches' ),
|
506 |
+
'desc' => esc_html__( 'Single product variation item font size. Default is: 16', 'woo-variation-swatches' ),
|
507 |
+
'css' => 'width: 50px;',
|
508 |
+
'default' => 16,
|
509 |
+
'suffix' => 'px',
|
510 |
+
'custom_attributes' => array(
|
511 |
+
'min' => 8,
|
512 |
+
'max' => 48,
|
513 |
+
'step' => 2,
|
514 |
+
),
|
515 |
+
),
|
516 |
+
|
517 |
+
array(
|
518 |
+
'type' => 'sectionend',
|
519 |
+
'id' => 'single_style_options',
|
520 |
+
),
|
521 |
+
|
522 |
+
);
|
523 |
+
|
524 |
+
return $settings;
|
525 |
+
}
|
526 |
+
|
527 |
+
protected function get_settings_for_single_section() {
|
528 |
+
$settings = array(
|
529 |
+
array(
|
530 |
+
'id' => 'single_page_options',
|
531 |
+
'type' => 'title',
|
532 |
+
'title' => esc_html__( 'Single Product Page', 'woo-variation-swatches' ),
|
533 |
+
'desc' => esc_html__( 'Settings for single product page', 'woo-variation-swatches' ),
|
534 |
+
),
|
535 |
+
|
536 |
+
array(
|
537 |
+
'id' => 'show_variation_label',
|
538 |
+
'type' => 'checkbox',
|
539 |
+
'title' => esc_html__( 'Show selected attribute', 'woo-variation-swatches' ),
|
540 |
+
'desc' => esc_html__( 'Show selected attribute variation name beside the title', 'woo-variation-swatches' ),
|
541 |
+
'default' => 'yes',
|
542 |
+
// 'is_new' => true,
|
543 |
+
),
|
544 |
+
|
545 |
+
array(
|
546 |
+
'id' => 'variation_label_separator',
|
547 |
+
'type' => 'text',
|
548 |
+
'title' => esc_html__( 'Variation label separator', 'woo-variation-swatches' ),
|
549 |
+
'desc' => sprintf( __( 'Variation label separator. Default: %s.', 'woo-variation-swatches' ), '<code>:</code>' ),
|
550 |
+
'desc_tip' => true,
|
551 |
+
'default' => ':',
|
552 |
+
'css' => 'width: 30px;',
|
553 |
+
'require' => $this->normalize_required_attribute( array( 'show_variation_label' => array( 'type' => '==', 'value' => '1' ) ) ),
|
554 |
+
// 'is_new' => true,
|
555 |
+
),
|
556 |
+
|
557 |
+
array(
|
558 |
+
'id' => 'enable_linkable_variation_url',
|
559 |
+
'type' => 'checkbox',
|
560 |
+
'title' => esc_html__( 'Generate variation url', 'woo-variation-swatches' ),
|
561 |
+
'desc' => esc_html__( 'Generate sharable url based on selected variation attributes.', 'woo-variation-swatches' ),
|
562 |
+
'default' => 'no',
|
563 |
+
'is_pro' => true,
|
564 |
+
),
|
565 |
+
|
566 |
+
array(
|
567 |
+
'id' => 'show_variation_stock_info',
|
568 |
+
'type' => 'checkbox',
|
569 |
+
'title' => esc_html__( 'Variation stock info', 'woo-variation-swatches' ),
|
570 |
+
'desc' => esc_html__( 'Show variation product stock info', 'woo-variation-swatches' ),
|
571 |
+
'default' => 'no',
|
572 |
+
'is_pro' => true,
|
573 |
+
),
|
574 |
+
|
575 |
+
array(
|
576 |
+
'id' => 'display_limit',
|
577 |
+
'type' => 'number',
|
578 |
+
// 'size' => 'tiny',
|
579 |
+
'title' => esc_html__( 'Attribute display limit', 'woo-variation-swatches' ),
|
580 |
+
'desc' => esc_html__( 'Single Product page attribute display limit. Default is 0. Means no limit.', 'woo-variation-swatches' ),
|
581 |
+
'desc_tip' => true,
|
582 |
+
'custom_attributes' => array( 'min' => 0 ),
|
583 |
+
'css' => 'width: 80px;',
|
584 |
+
'default' => '0',
|
585 |
+
'is_pro' => true,
|
586 |
+
),
|
587 |
+
|
588 |
+
array(
|
589 |
+
'type' => 'sectionend',
|
590 |
+
'id' => 'single_page_options',
|
591 |
+
),
|
592 |
+
);
|
593 |
+
|
594 |
+
return $settings;
|
595 |
+
}
|
596 |
+
|
597 |
+
protected function get_settings_for_archive_section() {
|
598 |
+
$settings = array(
|
599 |
+
|
600 |
+
array(
|
601 |
+
'id' => 'archive_options',
|
602 |
+
'type' => 'title',
|
603 |
+
'title' => esc_html__( 'Visual Section', 'woo-variation-swatches' ),
|
604 |
+
'desc' => esc_html__( 'Advanced change some visual styles on shop / archive page', 'woo-variation-swatches' ),
|
605 |
+
),
|
606 |
+
|
607 |
+
array(
|
608 |
+
'id' => 'show_on_archive',
|
609 |
+
'type' => 'checkbox',
|
610 |
+
'title' => esc_html__( 'Enable Swatches', 'woo-variation-swatches' ),
|
611 |
+
'desc' => esc_html__( 'Show swatches on archive / shop page.', 'woo-variation-swatches' ),
|
612 |
+
'default' => 'yes',
|
613 |
+
'is_pro' => true,
|
614 |
+
),
|
615 |
+
|
616 |
+
array(
|
617 |
+
'id' => 'archive_show_availability',
|
618 |
+
'type' => 'checkbox',
|
619 |
+
'title' => esc_html__( 'Show Product Availability', 'woo-variation-swatches' ),
|
620 |
+
'desc' => esc_html__( 'Show Product availability stock info', 'woo-variation-swatches' ),
|
621 |
+
'default' => 'no',
|
622 |
+
'is_pro' => true,
|
623 |
+
),
|
624 |
+
|
625 |
+
array(
|
626 |
+
'id' => 'archive_default_selected',
|
627 |
+
'type' => 'checkbox',
|
628 |
+
//'is_pro' => true,
|
629 |
+
//'is_new' => true,
|
630 |
+
//'help_preview' => true,
|
631 |
+
'title' => esc_html__( 'Show default selected', 'woo-variation-swatches-pro' ),
|
632 |
+
'desc' => esc_html__( 'Show default selected attribute swatches on archive / shop page.', 'woo-variation-swatches-pro' ),
|
633 |
+
'default' => 'yes',
|
634 |
+
'is_pro' => true
|
635 |
+
),
|
636 |
+
|
637 |
+
|
638 |
+
array(
|
639 |
+
'id' => 'archive_swatches_position',
|
640 |
+
'type' => 'radio',
|
641 |
+
'title' => esc_html__( 'Display position', 'woo-variation-swatches' ),
|
642 |
+
'desc' => sprintf( __( 'Show archive swatches position. <span style="color: red">Note:</span> Some theme remove default woocommerce hooks that why it\'s may not work as expected. For theme compatibility <a target="_blank" href="%s">please open a ticket</a>.', 'woo-variation-swatches' ), 'https://getwooplugins.com/tickets/' ),
|
643 |
+
//'desc_tip' => true,
|
644 |
+
'default' => 'after',
|
645 |
+
'options' => array(
|
646 |
+
'before' => esc_html__( 'Before add to cart button', 'woo-variation-swatches' ),
|
647 |
+
'after' => esc_html__( 'After add to cart button', 'woo-variation-swatches' )
|
648 |
+
),
|
649 |
+
'is_pro' => true,
|
650 |
+
),
|
651 |
+
|
652 |
+
array(
|
653 |
+
'id' => 'archive_align',
|
654 |
+
'type' => 'select',
|
655 |
+
'size' => 'tiny',
|
656 |
+
'title' => esc_html__( 'Swatches align', 'woo-variation-swatches' ),
|
657 |
+
'desc' => esc_html__( 'Swatches align on archive page', 'woo-variation-swatches' ),
|
658 |
+
'desc_tip' => true,
|
659 |
+
'css' => 'width: 100px;',
|
660 |
+
'default' => 'flex-start',
|
661 |
+
'options' => array(
|
662 |
+
'flex-start' => esc_html__( 'Left', 'woo-variation-swatches' ),
|
663 |
+
'center' => esc_html__( 'Center', 'woo-variation-swatches' ),
|
664 |
+
'flex-end' => esc_html__( 'Right', 'woo-variation-swatches' )
|
665 |
+
),
|
666 |
+
'is_pro' => true,
|
667 |
+
),
|
668 |
+
|
669 |
+
array(
|
670 |
+
'id' => 'show_swatches_on_filter_widget',
|
671 |
+
'type' => 'checkbox',
|
672 |
+
'title' => esc_html__( 'Show on filter widget', 'woo-variation-swatches' ),
|
673 |
+
'desc' => esc_html__( 'Show variation swatches on filter widget.', 'woo-variation-swatches' ),
|
674 |
+
'default' => 'yes',
|
675 |
+
'is_pro' => true,
|
676 |
+
),
|
677 |
+
|
678 |
+
array(
|
679 |
+
'type' => 'sectionend',
|
680 |
+
'id' => 'archive_options',
|
681 |
+
),
|
682 |
+
|
683 |
+
|
684 |
+
);
|
685 |
+
|
686 |
+
return $settings;
|
687 |
+
}
|
688 |
+
|
689 |
+
protected function get_settings_for_special_section() {
|
690 |
+
$settings = array(
|
691 |
+
|
692 |
+
// Catalog mode
|
693 |
+
array(
|
694 |
+
'id' => 'catalog_mode_options',
|
695 |
+
'type' => 'title',
|
696 |
+
'title' => esc_html__( 'Catalog mode', 'woo-variation-swatches' ),
|
697 |
+
'desc' => esc_html__( 'Show single attribute as catalog mode on shop / archive pages. Catalog mode only change image based on selected variation.', 'woo-variation-swatches' ),
|
698 |
+
),
|
699 |
+
|
700 |
+
array(
|
701 |
+
'id' => 'enable_catalog_mode',
|
702 |
+
'type' => 'checkbox',
|
703 |
+
'title' => esc_html__( 'Show Single Attribute', 'woo-variation-swatches' ),
|
704 |
+
'desc' => esc_html__( 'Show Single Attribute taxonomies on archive page', 'woo-variation-swatches' ),
|
705 |
+
'default' => 'no',
|
706 |
+
'is_pro' => true,
|
707 |
+
),
|
708 |
+
|
709 |
+
array(
|
710 |
+
'type' => 'sectionend',
|
711 |
+
'id' => 'catalog_mode_options',
|
712 |
+
),
|
713 |
+
|
714 |
+
array(
|
715 |
+
'id' => 'single_variation_image_preview_options',
|
716 |
+
'type' => 'title',
|
717 |
+
'title' => esc_html__( 'Single Variation Image Preview', 'woo-variation-swatches' ),
|
718 |
+
'desc' => esc_html__( 'Switch variation image when single attribute selected on product page.', 'woo-variation-swatches' ),
|
719 |
+
),
|
720 |
+
|
721 |
+
array(
|
722 |
+
'id' => 'enable_single_variation_preview',
|
723 |
+
'type' => 'checkbox',
|
724 |
+
'title' => esc_html__( 'Variation Image Preview', 'woo-variation-swatches' ),
|
725 |
+
'desc' => esc_html__( 'Show single attribute variation image based on first attribute select on product page.', 'woo-variation-swatches' ),
|
726 |
+
'default' => 'no',
|
727 |
+
'is_pro' => true,
|
728 |
+
),
|
729 |
+
|
730 |
+
array(
|
731 |
+
'type' => 'sectionend',
|
732 |
+
'id' => 'single_variation_image_preview_options',
|
733 |
+
),
|
734 |
+
|
735 |
+
// Attribute large size
|
736 |
+
array(
|
737 |
+
'id' => 'attr_large_size_options',
|
738 |
+
'type' => 'title',
|
739 |
+
'title' => esc_html__( 'Large Size Attribute Section', 'woo-variation-swatches' ),
|
740 |
+
'desc' => esc_html__( 'Make a attribute taxonomies size large on single product', 'woo-variation-swatches' ),
|
741 |
+
),
|
742 |
+
|
743 |
+
array(
|
744 |
+
'id' => 'enable_large_size',
|
745 |
+
'type' => 'checkbox',
|
746 |
+
'title' => esc_html__( 'Show First Attribute In Large Size', 'woo-variation-swatches' ),
|
747 |
+
'desc' => esc_html__( 'Show Attribute taxonomies in large size', 'woo-variation-swatches' ),
|
748 |
+
'default' => 'no',
|
749 |
+
'is_pro' => true,
|
750 |
+
),
|
751 |
+
|
752 |
+
array(
|
753 |
+
'type' => 'sectionend',
|
754 |
+
'id' => 'attr_large_size_options',
|
755 |
+
),
|
756 |
+
);
|
757 |
+
|
758 |
+
return $settings;
|
759 |
+
}
|
760 |
+
|
761 |
+
}
|
762 |
+
endif;
|
includes/class-woo-variation-swatches-term-meta.php
ADDED
@@ -0,0 +1,415 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
defined( 'ABSPATH' ) or die( 'Keep Silent' );
|
4 |
+
|
5 |
+
if ( ! class_exists( 'Woo_Variation_Swatches_Term_Meta' ) ):
|
6 |
+
class Woo_Variation_Swatches_Term_Meta {
|
7 |
+
|
8 |
+
private $taxonomy;
|
9 |
+
private $post_type;
|
10 |
+
private $fields = array();
|
11 |
+
|
12 |
+
public function __construct( $taxonomy, $post_type, $fields = array() ) {
|
13 |
+
|
14 |
+
$this->taxonomy = $taxonomy;
|
15 |
+
$this->post_type = $post_type;
|
16 |
+
$this->fields = $fields;
|
17 |
+
|
18 |
+
// Category/term ordering
|
19 |
+
// add_action( 'create_term', array( $this, 'create_term' ), 5, 3 );
|
20 |
+
|
21 |
+
add_action( 'delete_term', array( $this, 'delete_term' ), 5, 4 );
|
22 |
+
|
23 |
+
// Add form
|
24 |
+
add_action( "{$this->taxonomy}_add_form_fields", array( $this, 'add' ) );
|
25 |
+
add_action( "{$this->taxonomy}_edit_form_fields", array( $this, 'edit' ), 10 );
|
26 |
+
add_action( "created_term", array( $this, 'save' ), 10, 3 );
|
27 |
+
add_action( "edit_term", array( $this, 'save' ), 10, 3 );
|
28 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
29 |
+
|
30 |
+
// Add columns
|
31 |
+
add_filter( "manage_edit-{$this->taxonomy}_columns", array( $this, 'taxonomy_columns' ) );
|
32 |
+
add_filter( "manage_{$this->taxonomy}_custom_column", array( $this, 'taxonomy_column_preview' ), 10, 3 );
|
33 |
+
add_filter( "manage_{$this->taxonomy}_custom_column", array( $this, 'taxonomy_column_group' ), 10, 3 );
|
34 |
+
|
35 |
+
do_action( 'woo_variation_swatches_term_meta_loaded', $this );
|
36 |
+
}
|
37 |
+
|
38 |
+
public function preview( $attribute_type, $term_id, $fields ) {
|
39 |
+
|
40 |
+
$meta_key = $fields[ 0 ][ 'id' ]; // take first key for preview
|
41 |
+
|
42 |
+
$this->color_preview( $attribute_type, $term_id, $meta_key );
|
43 |
+
$this->image_preview( $attribute_type, $term_id, $meta_key );
|
44 |
+
|
45 |
+
}
|
46 |
+
|
47 |
+
public function color_preview( $attribute_type, $term_id, $key ) {
|
48 |
+
if ( 'color' === $attribute_type ) {
|
49 |
+
$primary_color = sanitize_hex_color( get_term_meta( $term_id, $key, true ) );
|
50 |
+
|
51 |
+
$is_dual_color = wc_string_to_bool( get_term_meta( $term_id, 'is_dual_color', true ) );
|
52 |
+
$secondary_color = sanitize_hex_color( get_term_meta( $term_id, 'secondary_color', true ) );
|
53 |
+
|
54 |
+
if ( $is_dual_color && woo_variation_swatches()->is_pro() ) {
|
55 |
+
$angle = woo_variation_swatches()->get_frontend()->get_dual_color_gradient_angle();
|
56 |
+
printf( '<div class="wvs-preview wvs-color-preview wvs-dual-color-preview" style="background: linear-gradient(%3$s, %1$s 0%%, %1$s 50%%, %2$s 50%%, %2$s 100%%);"></div>', esc_attr( $secondary_color ), esc_attr( $primary_color ), esc_attr( $angle ) );
|
57 |
+
} else {
|
58 |
+
printf( '<div class="wvs-preview wvs-color-preview" style="background-color:%s;"></div>', esc_attr( $primary_color ) );
|
59 |
+
}
|
60 |
+
}
|
61 |
+
}
|
62 |
+
|
63 |
+
public function group_name( $attribute_type, $term_id ) {
|
64 |
+
|
65 |
+
if ( ! woo_variation_swatches()->is_pro() ) {
|
66 |
+
return '';
|
67 |
+
}
|
68 |
+
|
69 |
+
$group = sanitize_text_field( get_term_meta( $term_id, 'group_name', true ) );
|
70 |
+
if ( $group ) {
|
71 |
+
return sanitize_text_field( woo_variation_swatches()->get_backend()->get_group()->get( $group ) );
|
72 |
+
}
|
73 |
+
|
74 |
+
return '';
|
75 |
+
}
|
76 |
+
|
77 |
+
|
78 |
+
public function image_preview( $attribute_type, $term_id, $key ) {
|
79 |
+
if ( 'image' == $attribute_type ) {
|
80 |
+
$attachment_id = absint( get_term_meta( $term_id, $key, true ) );
|
81 |
+
$image = wp_get_attachment_image_src( $attachment_id, 'thumbnail' );
|
82 |
+
|
83 |
+
if ( is_array( $image ) ) {
|
84 |
+
printf( '<img src="%s" alt="" width="%d" height="%d" class="wvs-preview wvs-image-preview" />', esc_url( $image[ 0 ] ), $image[ 1 ], $image[ 2 ] );
|
85 |
+
}
|
86 |
+
}
|
87 |
+
}
|
88 |
+
|
89 |
+
public function taxonomy_columns( $columns ) {
|
90 |
+
$new_columns = array();
|
91 |
+
|
92 |
+
if ( isset( $columns[ 'cb' ] ) ) {
|
93 |
+
$new_columns[ 'cb' ] = $columns[ 'cb' ];
|
94 |
+
}
|
95 |
+
|
96 |
+
$new_columns[ 'wvs-meta-preview' ] = '';
|
97 |
+
|
98 |
+
if ( isset( $columns[ 'cb' ] ) ) {
|
99 |
+
unset( $columns[ 'cb' ] );
|
100 |
+
}
|
101 |
+
|
102 |
+
if ( woo_variation_swatches()->is_pro() ) {
|
103 |
+
$columns[ 'wvs-meta-group' ] = esc_html__( 'Group', 'woo-variation-swatches' );
|
104 |
+
}
|
105 |
+
|
106 |
+
return array_merge( $new_columns, $columns );
|
107 |
+
}
|
108 |
+
|
109 |
+
public function taxonomy_column_preview( $columns, $column, $term_id ) {
|
110 |
+
|
111 |
+
if ( 'wvs-meta-preview' !== $column ) {
|
112 |
+
return $columns;
|
113 |
+
}
|
114 |
+
|
115 |
+
$attribute = woo_variation_swatches()->get_backend()->get_attribute_taxonomy( $this->taxonomy );
|
116 |
+
|
117 |
+
$attribute_type = $attribute->attribute_type;
|
118 |
+
|
119 |
+
$this->preview( $attribute_type, $term_id, $this->fields );
|
120 |
+
|
121 |
+
return $columns;
|
122 |
+
}
|
123 |
+
|
124 |
+
public function taxonomy_column_group( $columns, $column, $term_id ) {
|
125 |
+
|
126 |
+
if ( 'wvs-meta-group' !== $column ) {
|
127 |
+
return $columns;
|
128 |
+
}
|
129 |
+
|
130 |
+
$attribute = woo_variation_swatches()->get_backend()->get_attribute_taxonomy( $this->taxonomy );
|
131 |
+
|
132 |
+
$attribute_type = $attribute->attribute_type;
|
133 |
+
|
134 |
+
echo $this->group_name( $attribute_type, $term_id );
|
135 |
+
|
136 |
+
return $columns;
|
137 |
+
}
|
138 |
+
|
139 |
+
|
140 |
+
public function delete_term( $term_id, $tt_id, $taxonomy, $deleted_term ) {
|
141 |
+
global $wpdb;
|
142 |
+
|
143 |
+
$term_id = absint( $term_id );
|
144 |
+
if ( $term_id and $taxonomy == $this->taxonomy ) {
|
145 |
+
$wpdb->delete( $wpdb->termmeta, array( 'term_id' => $term_id ), array( '%d' ) );
|
146 |
+
}
|
147 |
+
}
|
148 |
+
|
149 |
+
public function enqueue_scripts() {
|
150 |
+
wp_enqueue_media();
|
151 |
+
wp_enqueue_style( 'wp-color-picker' );
|
152 |
+
wp_enqueue_script( 'wp-color-picker' );
|
153 |
+
}
|
154 |
+
|
155 |
+
public function save( $term_id, $tt_id = '', $taxonomy = '' ) {
|
156 |
+
|
157 |
+
if ( $taxonomy == $this->taxonomy ) {
|
158 |
+
foreach ( $this->fields as $field ) {
|
159 |
+
foreach ( $_POST as $post_key => $post_value ) {
|
160 |
+
if ( $field[ 'id' ] == $post_key ) {
|
161 |
+
switch ( $field[ 'type' ] ) {
|
162 |
+
case 'text':
|
163 |
+
case 'color':
|
164 |
+
$post_value = esc_html( $post_value );
|
165 |
+
break;
|
166 |
+
case 'url':
|
167 |
+
$post_value = esc_url( $post_value );
|
168 |
+
break;
|
169 |
+
case 'image':
|
170 |
+
$post_value = absint( $post_value );
|
171 |
+
break;
|
172 |
+
case 'textarea':
|
173 |
+
$post_value = esc_textarea( $post_value );
|
174 |
+
break;
|
175 |
+
case 'editor':
|
176 |
+
$post_value = wp_kses_post( $post_value );
|
177 |
+
break;
|
178 |
+
case 'select':
|
179 |
+
case 'select2':
|
180 |
+
$post_value = sanitize_key( $post_value );
|
181 |
+
break;
|
182 |
+
case 'checkbox':
|
183 |
+
$post_value = sanitize_key( $post_value );
|
184 |
+
break;
|
185 |
+
default:
|
186 |
+
do_action( 'woo_variation_swatches_save_term_meta', $term_id, $field, $post_value, $taxonomy );
|
187 |
+
break;
|
188 |
+
}
|
189 |
+
update_term_meta( $term_id, $field[ 'id' ], $post_value );
|
190 |
+
}
|
191 |
+
}
|
192 |
+
}
|
193 |
+
do_action( 'woo_variation_swatches_after_term_meta_saved', $term_id, $taxonomy );
|
194 |
+
}
|
195 |
+
}
|
196 |
+
|
197 |
+
public function add() {
|
198 |
+
$this->generate_fields();
|
199 |
+
}
|
200 |
+
|
201 |
+
private function generate_fields( $term = false ) {
|
202 |
+
|
203 |
+
$screen = get_current_screen();
|
204 |
+
|
205 |
+
if ( ( $screen->post_type == $this->post_type ) and ( $screen->taxonomy == $this->taxonomy ) ) {
|
206 |
+
self::generate_form_fields( $this->fields, $term );
|
207 |
+
}
|
208 |
+
}
|
209 |
+
|
210 |
+
public static function generate_form_fields( $fields, $term ) {
|
211 |
+
|
212 |
+
$fields = apply_filters( 'woo_variation_swatches_term_meta_fields', $fields, $term );
|
213 |
+
|
214 |
+
if ( empty( $fields ) ) {
|
215 |
+
return;
|
216 |
+
}
|
217 |
+
|
218 |
+
foreach ( $fields as $field ) {
|
219 |
+
|
220 |
+
$field = apply_filters( 'woo_variation_swatches_term_meta_field', $field, $term );
|
221 |
+
|
222 |
+
$field[ 'id' ] = esc_html( $field[ 'id' ] );
|
223 |
+
|
224 |
+
if ( ! $term ) {
|
225 |
+
$field[ 'value' ] = isset( $field[ 'default' ] ) ? $field[ 'default' ] : '';
|
226 |
+
} else {
|
227 |
+
$field[ 'value' ] = get_term_meta( $term->term_id, $field[ 'id' ], true );
|
228 |
+
}
|
229 |
+
|
230 |
+
|
231 |
+
$field[ 'size' ] = isset( $field[ 'size' ] ) ? $field[ 'size' ] : '40';
|
232 |
+
$field[ 'required' ] = ( isset( $field[ 'required' ] ) and $field[ 'required' ] == true ) ? ' aria-required="true"' : '';
|
233 |
+
$field[ 'placeholder' ] = ( isset( $field[ 'placeholder' ] ) ) ? ' placeholder="' . $field[ 'placeholder' ] . '" data-placeholder="' . $field[ 'placeholder' ] . '"' : '';
|
234 |
+
$field[ 'desc' ] = ( isset( $field[ 'desc' ] ) ) ? $field[ 'desc' ] : '';
|
235 |
+
|
236 |
+
$field[ 'dependency' ] = ( isset( $field[ 'dependency' ] ) ) ? $field[ 'dependency' ] : array();
|
237 |
+
|
238 |
+
self::field_start( $field, $term );
|
239 |
+
switch ( $field[ 'type' ] ) {
|
240 |
+
case 'text':
|
241 |
+
case 'url':
|
242 |
+
ob_start();
|
243 |
+
?>
|
244 |
+
<input name="<?php echo $field[ 'id' ] ?>" id="<?php echo $field[ 'id' ] ?>"
|
245 |
+
type="<?php echo $field[ 'type' ] ?>"
|
246 |
+
value="<?php echo $field[ 'value' ] ?>"
|
247 |
+
size="<?php echo $field[ 'size' ] ?>" <?php echo $field[ 'required' ] . $field[ 'placeholder' ] ?>>
|
248 |
+
<?php
|
249 |
+
echo ob_get_clean();
|
250 |
+
break;
|
251 |
+
case 'color':
|
252 |
+
ob_start();
|
253 |
+
?>
|
254 |
+
<input name="<?php echo $field[ 'id' ] ?>" id="<?php echo $field[ 'id' ] ?>" type="text"
|
255 |
+
class="wvs-color-picker" value="<?php echo $field[ 'value' ] ?>"
|
256 |
+
data-default-color="<?php echo $field[ 'value' ] ?>"
|
257 |
+
size="<?php echo $field[ 'size' ] ?>" <?php echo $field[ 'required' ] . $field[ 'placeholder' ] ?>>
|
258 |
+
<?php
|
259 |
+
echo ob_get_clean();
|
260 |
+
break;
|
261 |
+
case 'textarea':
|
262 |
+
ob_start();
|
263 |
+
?>
|
264 |
+
<textarea name="<?php echo $field[ 'id' ] ?>" id="<?php echo $field[ 'id' ] ?>" rows="5"
|
265 |
+
cols="<?php echo $field[ 'size' ] ?>" <?php echo $field[ 'required' ] . $field[ 'placeholder' ] ?>><?php echo $field[ 'value' ] ?></textarea>
|
266 |
+
<?php
|
267 |
+
echo ob_get_clean();
|
268 |
+
break;
|
269 |
+
case 'editor':
|
270 |
+
$field[ 'settings' ] = isset( $field[ 'settings' ] )
|
271 |
+
? $field[ 'settings' ]
|
272 |
+
: array(
|
273 |
+
'textarea_rows' => 8,
|
274 |
+
'quicktags' => false,
|
275 |
+
'media_buttons' => false
|
276 |
+
);
|
277 |
+
ob_start();
|
278 |
+
wp_editor( $field[ 'value' ], $field[ 'id' ], $field[ 'settings' ] );
|
279 |
+
echo ob_get_clean();
|
280 |
+
break;
|
281 |
+
case 'select':
|
282 |
+
case 'select2':
|
283 |
+
|
284 |
+
$field[ 'options' ] = isset( $field[ 'options' ] ) ? $field[ 'options' ] : array();
|
285 |
+
$field[ 'multiple' ] = isset( $field[ 'multiple' ] ) ? ' multiple="multiple"' : '';
|
286 |
+
$css_class = ( $field[ 'type' ] == 'select2' ) ? 'wc-enhanced-select' : '';
|
287 |
+
|
288 |
+
ob_start();
|
289 |
+
?>
|
290 |
+
<select name="<?php echo $field[ 'id' ] ?>" id="<?php echo $field[ 'id' ] ?>"
|
291 |
+
class="<?php echo $css_class ?>" <?php echo $field[ 'multiple' ] ?>>
|
292 |
+
<?php
|
293 |
+
foreach ( $field[ 'options' ] as $key => $option ) {
|
294 |
+
echo '<option' . selected( $field[ 'value' ], $key, false ) . ' value="' . $key . '">' . $option . '</option>';
|
295 |
+
}
|
296 |
+
?>
|
297 |
+
</select>
|
298 |
+
<?php
|
299 |
+
echo ob_get_clean();
|
300 |
+
break;
|
301 |
+
case 'image':
|
302 |
+
ob_start();
|
303 |
+
?>
|
304 |
+
<div class="meta-image-field-wrapper">
|
305 |
+
<div class="image-preview">
|
306 |
+
<img data-placeholder="<?php echo esc_url( self::placeholder_img_src() ); ?>"
|
307 |
+
src="<?php echo esc_url( self::get_img_src( $field[ 'value' ] ) ); ?>"
|
308 |
+
width="60px" height="60px"/>
|
309 |
+
</div>
|
310 |
+
<div class="button-wrapper">
|
311 |
+
<input type="hidden" id="<?php echo $field[ 'id' ] ?>"
|
312 |
+
name="<?php echo $field[ 'id' ] ?>"
|
313 |
+
value="<?php echo esc_attr( $field[ 'value' ] ) ?>"/>
|
314 |
+
<button type="button"
|
315 |
+
class="wvs_upload_image_button button button-primary button-small"><?php esc_html_e( 'Upload / Add image', 'woo-variation-swatches' ); ?></button>
|
316 |
+
<button type="button"
|
317 |
+
style="<?php echo( empty( $field[ 'value' ] ) ? 'display:none' : '' ) ?>"
|
318 |
+
class="wvs_remove_image_button button button-danger button-small"><?php esc_html_e( 'Remove image', 'woo-variation-swatches' ); ?></button>
|
319 |
+
</div>
|
320 |
+
</div>
|
321 |
+
<?php
|
322 |
+
echo ob_get_clean();
|
323 |
+
break;
|
324 |
+
case 'checkbox':
|
325 |
+
|
326 |
+
ob_start();
|
327 |
+
?>
|
328 |
+
<label for="<?php echo esc_attr( $field[ 'id' ] ) ?>">
|
329 |
+
|
330 |
+
<input name="<?php echo $field[ 'id' ] ?>" id="<?php echo $field[ 'id' ] ?>"
|
331 |
+
<?php checked( $field[ 'value' ], 'yes' ) ?>
|
332 |
+
type="<?php echo $field[ 'type' ] ?>"
|
333 |
+
value="yes" <?php echo $field[ 'required' ] . $field[ 'placeholder' ] ?>>
|
334 |
+
|
335 |
+
<?php echo $field[ 'label' ] ?></label>
|
336 |
+
<?php
|
337 |
+
echo ob_get_clean();
|
338 |
+
break;
|
339 |
+
default:
|
340 |
+
do_action( 'woo_variation_swatches_term_meta_field', $field, $term );
|
341 |
+
break;
|
342 |
+
|
343 |
+
}
|
344 |
+
self::field_end( $field, $term );
|
345 |
+
|
346 |
+
}
|
347 |
+
}
|
348 |
+
|
349 |
+
private static function field_start( $field, $term ) {
|
350 |
+
// Example:
|
351 |
+
// http://emranahmed.github.io/Form-Field-Dependency/
|
352 |
+
/*'dependency' => array(
|
353 |
+
array( '#show_tooltip' => array( 'type' => 'equal', 'value' => 'yes' ) )
|
354 |
+
)*/
|
355 |
+
|
356 |
+
$depends = empty( $field[ 'dependency' ] ) ? '' : "data-dependency='" . wc_esc_json( wp_json_encode( $field[ 'dependency' ] ) ) . "'";
|
357 |
+
|
358 |
+
ob_start();
|
359 |
+
if ( ! $term ) {
|
360 |
+
?>
|
361 |
+
<div <?php echo $depends ?> class="form-field <?php echo esc_attr( $field[ 'id' ] ) ?> <?php echo empty( $field[ 'required' ] ) ? '' : 'form-required' ?>">
|
362 |
+
<?php if ( $field[ 'type' ] !== 'checkbox' ) { ?>
|
363 |
+
<label for="<?php echo esc_attr( $field[ 'id' ] ) ?>"><?php echo $field[ 'label' ] ?></label>
|
364 |
+
<?php
|
365 |
+
}
|
366 |
+
} else {
|
367 |
+
?>
|
368 |
+
<tr <?php echo $depends ?> class="form-field <?php echo esc_attr( $field[ 'id' ] ) ?> <?php echo empty( $field[ 'required' ] ) ? '' : 'form-required' ?>">
|
369 |
+
<th scope="row">
|
370 |
+
<label for="<?php echo esc_attr( $field[ 'id' ] ) ?>"><?php echo $field[ 'label' ] ?></label>
|
371 |
+
</th>
|
372 |
+
<td>
|
373 |
+
<?php
|
374 |
+
}
|
375 |
+
echo ob_get_clean();
|
376 |
+
}
|
377 |
+
|
378 |
+
private static function get_img_src( $thumbnail_id = false ) {
|
379 |
+
if ( ! empty( $thumbnail_id ) ) {
|
380 |
+
$image = wp_get_attachment_thumb_url( $thumbnail_id );
|
381 |
+
} else {
|
382 |
+
$image = self::placeholder_img_src();
|
383 |
+
}
|
384 |
+
|
385 |
+
return $image;
|
386 |
+
}
|
387 |
+
|
388 |
+
public static function placeholder_img_src() {
|
389 |
+
return woo_variation_swatches()->images_url( '/placeholder.png' );
|
390 |
+
}
|
391 |
+
|
392 |
+
private static function field_end( $field, $term ) {
|
393 |
+
|
394 |
+
ob_start();
|
395 |
+
if ( ! $term ) {
|
396 |
+
?>
|
397 |
+
<p><?php echo $field[ 'desc' ] ?></p>
|
398 |
+
</div>
|
399 |
+
<?php
|
400 |
+
} else {
|
401 |
+
?>
|
402 |
+
<p class="description"><?php echo $field[ 'desc' ] ?></p></td>
|
403 |
+
</tr>
|
404 |
+
<?php
|
405 |
+
}
|
406 |
+
echo ob_get_clean();
|
407 |
+
}
|
408 |
+
|
409 |
+
public function edit( $term ) {
|
410 |
+
|
411 |
+
|
412 |
+
$this->generate_fields( $term );
|
413 |
+
}
|
414 |
+
}
|
415 |
+
endif;
|
includes/class-woo-variation-swatches.php
ADDED
@@ -0,0 +1,206 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
defined( 'ABSPATH' ) || exit;
|
4 |
+
|
5 |
+
if ( ! class_exists( 'Woo_Variation_Swatches' ) ) {
|
6 |
+
|
7 |
+
class Woo_Variation_Swatches {
|
8 |
+
|
9 |
+
protected static $_instance = null;
|
10 |
+
|
11 |
+
public function __construct() {
|
12 |
+
$this->includes();
|
13 |
+
$this->hooks();
|
14 |
+
$this->init();
|
15 |
+
do_action( 'woo_variation_swatches_loaded', $this );
|
16 |
+
}
|
17 |
+
|
18 |
+
public function version() {
|
19 |
+
return esc_attr( WOO_VARIATION_SWATCHES_PLUGIN_VERSION );
|
20 |
+
}
|
21 |
+
|
22 |
+
protected function define( $name, $value ) {
|
23 |
+
if ( ! defined( $name ) ) {
|
24 |
+
define( $name, $value );
|
25 |
+
}
|
26 |
+
}
|
27 |
+
|
28 |
+
public static function instance() {
|
29 |
+
if ( is_null( self::$_instance ) ) {
|
30 |
+
self::$_instance = new self();
|
31 |
+
}
|
32 |
+
|
33 |
+
return self::$_instance;
|
34 |
+
}
|
35 |
+
|
36 |
+
public function includes() {
|
37 |
+
require_once dirname( __FILE__ ) . '/class-woo-variation-swatches-manage-cache.php';
|
38 |
+
require_once dirname( __FILE__ ) . '/class-woo-variation-swatches-frontend.php';
|
39 |
+
require_once dirname( __FILE__ ) . '/class-woo-variation-swatches-backend.php';
|
40 |
+
require_once dirname( __FILE__ ) . '/functions.php';
|
41 |
+
}
|
42 |
+
|
43 |
+
public function hooks() {
|
44 |
+
// Register with hook
|
45 |
+
add_action( 'init', array( $this, 'language' ), 1 );
|
46 |
+
add_action( 'init', array( $this, 'add_image_sizes' ) );
|
47 |
+
add_shortcode( 'wvs_show_archive_variation', array( $this, 'show_archive_page_swatches' ) );
|
48 |
+
}
|
49 |
+
|
50 |
+
public function init() {
|
51 |
+
$this->get_frontend();
|
52 |
+
$this->get_backend();
|
53 |
+
$this->get_cache();
|
54 |
+
}
|
55 |
+
|
56 |
+
public function get_frontend() {
|
57 |
+
return Woo_Variation_Swatches_Frontend::instance();
|
58 |
+
}
|
59 |
+
|
60 |
+
public function get_backend() {
|
61 |
+
return Woo_Variation_Swatches_Backend::instance();
|
62 |
+
}
|
63 |
+
|
64 |
+
public function show_archive_page_swatches() {
|
65 |
+
return false;
|
66 |
+
}
|
67 |
+
|
68 |
+
public function add_image_sizes() {
|
69 |
+
add_image_size( 'variation_swatches_image_size', 50, 50, 1 );
|
70 |
+
add_image_size( 'variation_swatches_tooltip_size', 100, 100, 1 );
|
71 |
+
}
|
72 |
+
|
73 |
+
public function get_option( $option, $default = null ) {
|
74 |
+
$options = GetWooPlugins_Admin_Settings::get_option( 'woo_variation_swatches' );
|
75 |
+
|
76 |
+
if ( current_theme_supports( 'woo_variation_swatches' ) ) {
|
77 |
+
$theme_support = get_theme_support( 'woo_variation_swatches' );
|
78 |
+
$default = isset( $theme_support[ 0 ][ $option ] ) ? $theme_support[ 0 ][ $option ] : $default;
|
79 |
+
}
|
80 |
+
|
81 |
+
return isset( $options[ $option ] ) ? $options[ $option ] : $default;
|
82 |
+
}
|
83 |
+
|
84 |
+
public function get_options() {
|
85 |
+
$options = GetWooPlugins_Admin_Settings::get_option( 'woo_variation_swatches' );
|
86 |
+
|
87 |
+
return $options;
|
88 |
+
}
|
89 |
+
|
90 |
+
public function get_cache() {
|
91 |
+
Woo_Variation_Swatches_Manage_Cache::instance();
|
92 |
+
}
|
93 |
+
|
94 |
+
public function language() {
|
95 |
+
load_plugin_textdomain( 'woo-variation-swatches', false, plugin_basename( dirname( WOO_VARIATION_SWATCHES_PLUGIN_FILE ) ) . '/languages' );
|
96 |
+
}
|
97 |
+
|
98 |
+
public function basename() {
|
99 |
+
return basename( dirname( WOO_VARIATION_SWATCHES_PLUGIN_FILE ) );
|
100 |
+
}
|
101 |
+
|
102 |
+
public function plugin_basename() {
|
103 |
+
return plugin_basename( WOO_VARIATION_SWATCHES_PLUGIN_FILE );
|
104 |
+
}
|
105 |
+
|
106 |
+
public function plugin_dirname() {
|
107 |
+
return dirname( plugin_basename( WOO_VARIATION_SWATCHES_PLUGIN_FILE ) );
|
108 |
+
}
|
109 |
+
|
110 |
+
public function plugin_path() {
|
111 |
+
return untrailingslashit( plugin_dir_path( WOO_VARIATION_SWATCHES_PLUGIN_FILE ) );
|
112 |
+
}
|
113 |
+
|
114 |
+
public function plugin_url() {
|
115 |
+
return untrailingslashit( plugins_url( '/', WOO_VARIATION_SWATCHES_PLUGIN_FILE ) );
|
116 |
+
}
|
117 |
+
|
118 |
+
public function images_url( $file = '' ) {
|
119 |
+
return untrailingslashit( plugin_dir_url( WOO_VARIATION_SWATCHES_PLUGIN_FILE ) . 'images' ) . $file;
|
120 |
+
}
|
121 |
+
|
122 |
+
public function org_assets_url( $file = '' ) {
|
123 |
+
return 'https://ps.w.org/woo-variation-swatches/assets' . $file . '?ver=' . $this->version();
|
124 |
+
}
|
125 |
+
|
126 |
+
public function assets_url( $file = '' ) {
|
127 |
+
return untrailingslashit( plugin_dir_url( WOO_VARIATION_SWATCHES_PLUGIN_FILE ) . 'assets' ) . $file;
|
128 |
+
}
|
129 |
+
|
130 |
+
public function assets_path( $file = '' ) {
|
131 |
+
return $this->plugin_path() . '/assets' . $file;
|
132 |
+
}
|
133 |
+
|
134 |
+
public function assets_version( $file ) {
|
135 |
+
return filemtime( $this->assets_path( $file ) );
|
136 |
+
}
|
137 |
+
|
138 |
+
public function include_path( $file = '' ) {
|
139 |
+
return untrailingslashit( plugin_dir_path( WOO_VARIATION_SWATCHES_PLUGIN_FILE ) . 'includes' ) . $file;
|
140 |
+
}
|
141 |
+
|
142 |
+
public function template_override_dir() {
|
143 |
+
return apply_filters( 'woo_variation_swatches_override_dir', 'woo-variation-swatches' );
|
144 |
+
}
|
145 |
+
|
146 |
+
public function template_path() {
|
147 |
+
return apply_filters( 'woo_variation_swatches_template_path', untrailingslashit( $this->plugin_path() ) . '/templates' );
|
148 |
+
}
|
149 |
+
|
150 |
+
public function template_url() {
|
151 |
+
return apply_filters( 'woo_variation_swatches_template_url', untrailingslashit( $this->plugin_url() ) . '/templates' );
|
152 |
+
}
|
153 |
+
|
154 |
+
public function sanitize_name( $value ) {
|
155 |
+
return wc_clean( rawurldecode( sanitize_title( wp_unslash( $value ) ) ) );
|
156 |
+
}
|
157 |
+
|
158 |
+
public function locate_template( $template_name, $third_party_path = false ) {
|
159 |
+
|
160 |
+
$template_name = ltrim( $template_name, '/' );
|
161 |
+
$template_path = $this->template_override_dir();
|
162 |
+
$default_path = $this->template_path();
|
163 |
+
|
164 |
+
if ( $third_party_path && is_string( $third_party_path ) ) {
|
165 |
+
$default_path = untrailingslashit( $third_party_path );
|
166 |
+
}
|
167 |
+
|
168 |
+
// Look within passed path within the theme - this is priority.
|
169 |
+
$template = locate_template( array(
|
170 |
+
trailingslashit( $template_path ) . trim( $template_name ),
|
171 |
+
'wvs-template-' . trim( $template_name )
|
172 |
+
) );
|
173 |
+
|
174 |
+
// Get default template/
|
175 |
+
if ( empty( $template ) ) {
|
176 |
+
$template = trailingslashit( $default_path ) . trim( $template_name );
|
177 |
+
}
|
178 |
+
|
179 |
+
// Return what we found.
|
180 |
+
return apply_filters( 'woo_variation_swatches_locate_template', $template, $template_name, $template_path );
|
181 |
+
}
|
182 |
+
|
183 |
+
public function get_template( $template_name, $template_args = array(), $third_party_path = false ) {
|
184 |
+
|
185 |
+
$template_name = ltrim( $template_name, '/' );
|
186 |
+
|
187 |
+
$located = apply_filters( 'woo_variation_swatches_get_template', $this->locate_template( $template_name, $third_party_path ) );
|
188 |
+
|
189 |
+
do_action( 'woo_variation_swatches_before_get_template', $template_name, $template_args );
|
190 |
+
|
191 |
+
extract( $template_args );
|
192 |
+
|
193 |
+
if ( file_exists( $located ) ) {
|
194 |
+
include $located;
|
195 |
+
} else {
|
196 |
+
trigger_error( sprintf( esc_html__( '"Variation Swatches for WooCommerce" Plugin try to load "%s" but template "%s" was not found.', 'woo-variation-swatches' ), $located, $template_name ), E_USER_WARNING );
|
197 |
+
}
|
198 |
+
|
199 |
+
do_action( 'woo_variation_swatches_after_get_template', $template_name, $template_args );
|
200 |
+
}
|
201 |
+
|
202 |
+
public function is_pro() {
|
203 |
+
return false;
|
204 |
+
}
|
205 |
+
}
|
206 |
+
}
|
includes/class-wvs-customize-alpha-color-control.php
DELETED
@@ -1,42 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
defined( 'ABSPATH' ) or die( 'Keep Silent' );
|
3 |
-
|
4 |
-
/* $wp_customize->add_control( new WVS_Customize_Alpha_Color_Control( $wp_customize, 'id', array(
|
5 |
-
'label' => esc_html__( 'Label', 'textdomain' ),
|
6 |
-
'description' => esc_html__( 'Description', 'textdomain' ),
|
7 |
-
'section' => 'section'
|
8 |
-
) ) );*/
|
9 |
-
|
10 |
-
if ( ! class_exists( 'WVS_Customize_Alpha_Color_Control' ) ):
|
11 |
-
class WVS_Customize_Alpha_Color_Control extends WP_Customize_Control {
|
12 |
-
|
13 |
-
public $type = 'wvs-alpha-color';
|
14 |
-
|
15 |
-
public function __construct( $manager, $id, $args = array() ) {
|
16 |
-
parent::__construct( $manager, $id, $args );
|
17 |
-
}
|
18 |
-
|
19 |
-
public function enqueue() {
|
20 |
-
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
21 |
-
wp_enqueue_script( 'wvs-customize-alpha-color-control', woo_variation_swatches()->assets_uri( "/js/wvs-customize-alpha-color-control{$suffix}.js" ), array( 'wp-color-picker-alpha' ), '', TRUE );
|
22 |
-
}
|
23 |
-
|
24 |
-
protected function render_content() {
|
25 |
-
?>
|
26 |
-
<?php if ( ! empty( $this->label ) ) : ?>
|
27 |
-
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
|
28 |
-
<?php endif; ?>
|
29 |
-
|
30 |
-
<?php if ( ! empty( $this->description ) ) : ?>
|
31 |
-
<span class="description customize-control-description"><?php echo wp_kses_post( $this->description ); ?></span>
|
32 |
-
<?php endif; ?>
|
33 |
-
|
34 |
-
<div class="customize-control-content">
|
35 |
-
<label>
|
36 |
-
<input <?php $this->link(); ?> class="color-picker-hex wvs-color-picker" data-alpha="true" type="text" value="<?php echo $this->value() ?>" data-default-color="<?php echo $this->value() ?>"/>
|
37 |
-
</label>
|
38 |
-
</div>
|
39 |
-
<?php
|
40 |
-
}
|
41 |
-
}
|
42 |
-
endif;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/class-wvs-customize-heading.php
DELETED
@@ -1,63 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
defined( 'ABSPATH' ) or die( 'Keep Silent' );
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Example:
|
7 |
-
* new WVS_Customize_Heading( $wp_customize, 'section', esc_html__( 'Heading Options', 'text-domain' ) );
|
8 |
-
*/
|
9 |
-
|
10 |
-
if ( ! class_exists( 'WVS_Customize_Heading_Control' ) ):
|
11 |
-
|
12 |
-
class WVS_Customize_Heading_Control extends WP_Customize_Control {
|
13 |
-
|
14 |
-
public $type = 'wvs-heading';
|
15 |
-
|
16 |
-
public function __construct( $manager, $id, $args = array() ) {
|
17 |
-
parent::__construct( $manager, $id, $args );
|
18 |
-
}
|
19 |
-
|
20 |
-
public function enqueue() {
|
21 |
-
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
22 |
-
wp_enqueue_style( 'wvs-customize-heading-control', woo_variation_swatches()->assets_uri( "/css/wvs-customize-heading-control$suffix.css" ) );
|
23 |
-
}
|
24 |
-
|
25 |
-
protected function render_content() {
|
26 |
-
?>
|
27 |
-
<?php if ( ! empty( $this->label ) ) : ?>
|
28 |
-
<h4 class="wvs-customize-heading-control-title"><?php echo esc_html( $this->label ); ?></h4>
|
29 |
-
<?php endif;
|
30 |
-
}
|
31 |
-
}
|
32 |
-
endif;
|
33 |
-
|
34 |
-
if ( ! class_exists( 'WVS_Customize_Heading' ) ):
|
35 |
-
|
36 |
-
class WVS_Customize_Heading {
|
37 |
-
|
38 |
-
public function __construct( $wp_customize, $section, $title, $priority = NULL ) {
|
39 |
-
|
40 |
-
static $customize_heading_control_id = 1;
|
41 |
-
$this->add_settings( $wp_customize, $customize_heading_control_id );
|
42 |
-
$this->add_controls( $wp_customize, $title, $section, $priority, $customize_heading_control_id );
|
43 |
-
$customize_heading_control_id ++;
|
44 |
-
}
|
45 |
-
|
46 |
-
private function add_settings( $wp_customize, $id ) {
|
47 |
-
|
48 |
-
$wp_customize->add_setting( sprintf( 'wvs-customize-heading-control-%d', $id ), array(
|
49 |
-
'sanitize_callback' => 'sanitize_key'
|
50 |
-
) );
|
51 |
-
}
|
52 |
-
|
53 |
-
private function add_controls( $wp_customize, $title, $section, $priority, $id ) {
|
54 |
-
|
55 |
-
$wp_customize->add_control( new WVS_Customize_Heading_Control( $wp_customize, sprintf( 'wvs-customize-heading-control-%d', $id ), array(
|
56 |
-
'label' => $title,
|
57 |
-
'section' => $section,
|
58 |
-
'priority' => $priority,
|
59 |
-
) ) );
|
60 |
-
}
|
61 |
-
}
|
62 |
-
|
63 |
-
endif;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/class-wvs-customizer.php
DELETED
@@ -1,144 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
defined( 'ABSPATH' ) or die( 'Keep Quit' );
|
4 |
-
|
5 |
-
if ( ! class_exists( 'WVS_Customizer' ) ):
|
6 |
-
class WVS_Customizer {
|
7 |
-
private $_settings_name;
|
8 |
-
private $_fields;
|
9 |
-
private $_plugin_class;
|
10 |
-
private $_theme_feature_name;
|
11 |
-
|
12 |
-
public function __construct( $theme_feature_name, $plugin_class, $settings_name, $fields ) {
|
13 |
-
$this->_settings_name = $settings_name;
|
14 |
-
$this->_fields = $fields;
|
15 |
-
$this->_plugin_class = $plugin_class;
|
16 |
-
$this->_theme_feature_name = $theme_feature_name;
|
17 |
-
|
18 |
-
add_action( 'customize_register', array( $this, 'includes' ) );
|
19 |
-
add_action( 'customize_register', array( $this, 'add_panel' ) );
|
20 |
-
add_action( 'customize_register', array( $this, 'add_section' ) );
|
21 |
-
// add_action( 'customize_controls_print_styles', array( $this, 'add_styles' ) );
|
22 |
-
// add_action( 'customize_controls_print_scripts', array( $this, 'add_scripts' ), 30 );
|
23 |
-
}
|
24 |
-
|
25 |
-
public function includes() {
|
26 |
-
require_once $this->_plugin_class->include_path( 'class-wvs-customize-heading.php' );
|
27 |
-
require_once $this->_plugin_class->include_path( 'class-wvs-customize-alpha-color-control.php' );
|
28 |
-
}
|
29 |
-
|
30 |
-
public function add_panel( $wp_customize ) {
|
31 |
-
$wp_customize->add_panel( $this->_settings_name, array(
|
32 |
-
'priority' => 100,
|
33 |
-
'capability' => 'manage_woocommerce',
|
34 |
-
'title' => esc_html__( 'WooCommerce Variation Swatches', 'woo-variation-swatches' ),
|
35 |
-
) );
|
36 |
-
}
|
37 |
-
|
38 |
-
public function add_section( $wp_customize ) {
|
39 |
-
|
40 |
-
// Theme Support
|
41 |
-
$theme_support = FALSE;
|
42 |
-
if ( current_theme_supports( $this->_theme_feature_name ) ) {
|
43 |
-
$theme_support = get_theme_support( $this->_theme_feature_name );
|
44 |
-
}
|
45 |
-
|
46 |
-
foreach ( $this->_fields as $panel ) {
|
47 |
-
$section_id = sprintf( '%s_%s', $this->_settings_name, $panel[ 'id' ] );
|
48 |
-
|
49 |
-
$wp_customize->add_section( $section_id, array(
|
50 |
-
'title' => $panel[ 'title' ],
|
51 |
-
'panel' => $this->_settings_name,
|
52 |
-
) );
|
53 |
-
|
54 |
-
|
55 |
-
foreach ( $panel[ 'sections' ] as $section ) {
|
56 |
-
|
57 |
-
if ( isset( $section[ 'pro' ] ) ) {
|
58 |
-
continue;
|
59 |
-
}
|
60 |
-
|
61 |
-
if ( ! isset( $section[ 'customize_hidden' ] ) || ! $section[ 'customize_hidden' ] ) {
|
62 |
-
new WVS_Customize_Heading( $wp_customize, $section_id, $section[ 'title' ] );
|
63 |
-
}
|
64 |
-
|
65 |
-
|
66 |
-
foreach ( $section[ 'fields' ] as $field ) {
|
67 |
-
|
68 |
-
if ( isset( $field[ 'pro' ] ) ) {
|
69 |
-
continue;
|
70 |
-
}
|
71 |
-
|
72 |
-
$setting_id = sprintf( '%s[%s]', $this->_settings_name, $field[ 'id' ] );
|
73 |
-
|
74 |
-
$default_value = $field[ 'default' ];
|
75 |
-
|
76 |
-
// Theme Support
|
77 |
-
if ( $theme_support ) {
|
78 |
-
$default_value = isset( $theme_support[ 0 ][ $field[ 'id' ] ] ) ? $theme_support[ 0 ][ $field[ 'id' ] ] : $field[ 'default' ];
|
79 |
-
}
|
80 |
-
|
81 |
-
// Add Settings
|
82 |
-
$setting_options = array(
|
83 |
-
'default' => $default_value,
|
84 |
-
'type' => 'option',
|
85 |
-
'capability' => 'manage_woocommerce',
|
86 |
-
'sanitize_callback' => 'sanitize_key', //
|
87 |
-
);
|
88 |
-
|
89 |
-
switch ( $field[ 'type' ] ) {
|
90 |
-
case 'checkbox':
|
91 |
-
$setting_options[ 'sanitize_callback' ] = array( $this, 'sanitize_checkbox' );
|
92 |
-
break;
|
93 |
-
}
|
94 |
-
|
95 |
-
if ( isset( $field[ 'customize_sanitize_callback' ] ) && is_callable( $field[ 'customize_sanitize_callback' ] ) ) {
|
96 |
-
$setting_options[ 'sanitize_callback' ] = $field[ 'customize_sanitize_callback' ];
|
97 |
-
}
|
98 |
-
|
99 |
-
$wp_customize->add_setting( $setting_id, $setting_options );
|
100 |
-
|
101 |
-
// Add Control
|
102 |
-
$control_options = array(
|
103 |
-
'label' => $field[ 'title' ],
|
104 |
-
'description' => $field[ 'desc' ],
|
105 |
-
'section' => $section_id,
|
106 |
-
'type' => $field[ 'type' ]
|
107 |
-
);
|
108 |
-
|
109 |
-
switch ( $field[ 'type' ] ) {
|
110 |
-
case 'radio':
|
111 |
-
case 'select':
|
112 |
-
$control_options[ 'choices' ] = $field[ 'options' ];
|
113 |
-
break;
|
114 |
-
}
|
115 |
-
|
116 |
-
// active_callback
|
117 |
-
if ( isset( $field[ 'customize_hidden' ] ) && $field[ 'customize_hidden' ] ) {
|
118 |
-
$control_options[ 'active_callback' ] = '__return_false';
|
119 |
-
}
|
120 |
-
|
121 |
-
if ( isset( $section[ 'customize_hidden' ] ) && $section[ 'customize_hidden' ] ) {
|
122 |
-
$control_options[ 'active_callback' ] = '__return_false';
|
123 |
-
}
|
124 |
-
|
125 |
-
|
126 |
-
if ( isset( $field[ 'customize_control_class' ] ) && class_exists( $field[ 'customize_control_class' ] ) ) {
|
127 |
-
$class = $field[ 'customize_control_class' ];
|
128 |
-
unset( $control_options[ 'type' ] );
|
129 |
-
$wp_customize->add_control( new $class( $wp_customize, $setting_id, $control_options ) );
|
130 |
-
} else {
|
131 |
-
$wp_customize->add_control( $setting_id, $control_options );
|
132 |
-
}
|
133 |
-
}
|
134 |
-
}
|
135 |
-
}
|
136 |
-
}
|
137 |
-
|
138 |
-
public function sanitize_checkbox( $value ) {
|
139 |
-
$filter = filter_var( $value, FILTER_VALIDATE_BOOLEAN );
|
140 |
-
|
141 |
-
return is_null( $filter ) ? 0 : $filter;
|
142 |
-
}
|
143 |
-
}
|
144 |
-
endif;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/class-wvs-settings-api.php
DELETED
@@ -1,795 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
defined( 'ABSPATH' ) or die( 'Keep Quit' );
|
4 |
-
|
5 |
-
// 1. add settings: priority 1
|
6 |
-
// 2. initial class: priority 2
|
7 |
-
// 3. store defaults: priority 3
|
8 |
-
// 4. get defaults / do whatever you want to do
|
9 |
-
|
10 |
-
if ( ! class_exists( 'WVS_Settings_API' ) ):
|
11 |
-
|
12 |
-
class WVS_Settings_API {
|
13 |
-
|
14 |
-
private $setting_name = 'woo_variation_swatches';
|
15 |
-
private $setting_reset_name = 'reset';
|
16 |
-
private $show_pro_name = 'pro';
|
17 |
-
private $transient_setting_name = '_temp_woo_variation_swatches_options';
|
18 |
-
private $cache_key = 'woo_variation_swatches_options';
|
19 |
-
private $theme_feature_name = 'woo-variation-swatches';
|
20 |
-
private $slug;
|
21 |
-
private $plugin_class;
|
22 |
-
private $defaults = array();
|
23 |
-
private $reserved_key = '';
|
24 |
-
private $reserved_fields = array();
|
25 |
-
|
26 |
-
private $fields = array();
|
27 |
-
|
28 |
-
public function __construct() {
|
29 |
-
|
30 |
-
$this->plugin_class = woo_variation_swatches();
|
31 |
-
|
32 |
-
$this->settings_name = apply_filters( 'wvs_settings_name', $this->setting_name );
|
33 |
-
$this->setting_reset_name = apply_filters( 'wvs_reset_settings_name', $this->setting_reset_name );
|
34 |
-
|
35 |
-
$this->slug = sprintf( '%s-settings', sanitize_key( $this->plugin_class->dirname() ) );
|
36 |
-
// license_key
|
37 |
-
$this->fields = apply_filters( 'wvs_settings', $this->fields );
|
38 |
-
$this->reserved_key = sprintf( '%s_reserved', $this->settings_name );
|
39 |
-
$this->reserved_fields = apply_filters( 'wvs_reserved_fields', array() );
|
40 |
-
|
41 |
-
add_action( 'admin_menu', array( $this, 'add_menu' ) );
|
42 |
-
|
43 |
-
add_action( 'init', array( $this, 'set_defaults' ), 8 );
|
44 |
-
|
45 |
-
add_action( 'admin_init', array( $this, 'settings_init' ), 90 );
|
46 |
-
|
47 |
-
// add_filter( 'pre_update_option', array( $this, 'before_update' ), 10, 3 );
|
48 |
-
// add_action( 'updated_option', array( $this, 'before_update' ), 10, 3 );
|
49 |
-
|
50 |
-
add_filter( "pre_update_option_{$this->settings_name}", array( $this, 'before_update' ), 10, 3 );
|
51 |
-
add_action( "update_option_{$this->settings_name}", array( $this, 'after_update' ), 10, 3 );
|
52 |
-
|
53 |
-
|
54 |
-
add_filter( 'plugin_action_links_' . $this->plugin_class->basename(), array(
|
55 |
-
$this,
|
56 |
-
'plugin_action_links'
|
57 |
-
) );
|
58 |
-
|
59 |
-
if ( apply_filters( 'show_wvs_settings_link_on_admin_bar', false ) ):
|
60 |
-
add_action( 'wp_before_admin_bar_render', array( $this, 'add_admin_bar' ), 999 );
|
61 |
-
endif;
|
62 |
-
|
63 |
-
add_action( 'admin_footer', array( $this, 'admin_inline_js' ) );
|
64 |
-
|
65 |
-
if ( apply_filters( 'show_wvs_settings_on_customizer', false ) ):
|
66 |
-
new WVS_Customizer( $this->theme_feature_name, $this->plugin_class, $this->settings_name, $this->fields );
|
67 |
-
endif;
|
68 |
-
|
69 |
-
do_action( 'wvs_setting_api_init', $this );
|
70 |
-
}
|
71 |
-
|
72 |
-
public function get_reserved( $key = false ) {
|
73 |
-
|
74 |
-
$data = (array) get_option( $this->reserved_key );
|
75 |
-
if ( $key ) {
|
76 |
-
return isset( $data[ $key ] ) ? $data[ $key ] : null;
|
77 |
-
} else {
|
78 |
-
return $data;
|
79 |
-
}
|
80 |
-
}
|
81 |
-
|
82 |
-
public function save_reserved( $value ) {
|
83 |
-
$reserved_data = array();
|
84 |
-
foreach ( (array) $this->reserved_fields as $fieldKey ) {
|
85 |
-
if ( ! empty( $value[ $fieldKey ] ) ) {
|
86 |
-
$reserved_data[ $fieldKey ] = $value[ $fieldKey ];
|
87 |
-
}
|
88 |
-
}
|
89 |
-
|
90 |
-
if ( ! empty( $reserved_data ) ) {
|
91 |
-
update_option( $this->reserved_key, $reserved_data );
|
92 |
-
} else {
|
93 |
-
delete_option( $this->reserved_key );
|
94 |
-
}
|
95 |
-
}
|
96 |
-
|
97 |
-
public function before_update( $value, $old_value, $option ) {
|
98 |
-
//if ( $this->settings_name === $option ) {
|
99 |
-
// Here We will do magic :D
|
100 |
-
// delete_transient( $this->transient_setting_name );
|
101 |
-
|
102 |
-
//}
|
103 |
-
|
104 |
-
$this->save_reserved( $value );
|
105 |
-
do_action( sprintf( 'before_update_%s_settings', $this->settings_name ), $this );
|
106 |
-
|
107 |
-
|
108 |
-
return $value;
|
109 |
-
}
|
110 |
-
|
111 |
-
public function after_update( $old_value, $value, $option ) {
|
112 |
-
//if ( $this->settings_name === $option ) {
|
113 |
-
// Here We will do magic :D
|
114 |
-
// delete_transient( $this->transient_setting_name );
|
115 |
-
|
116 |
-
//}
|
117 |
-
|
118 |
-
return $value;
|
119 |
-
}
|
120 |
-
|
121 |
-
public function admin_inline_js() {
|
122 |
-
?>
|
123 |
-
<script type="text/javascript">
|
124 |
-
jQuery(function ($) {
|
125 |
-
$('#<?php echo $this->slug ?>-wrap').on('click', '.nav-tab', function (event) {
|
126 |
-
event.preventDefault()
|
127 |
-
var target = $(this).data('target')
|
128 |
-
$(this).addClass('nav-tab-active').siblings().removeClass('nav-tab-active')
|
129 |
-
$('#' + target).show().siblings().hide()
|
130 |
-
$('#_last_active_tab').val(target)
|
131 |
-
})
|
132 |
-
})
|
133 |
-
</script>
|
134 |
-
<?php
|
135 |
-
}
|
136 |
-
|
137 |
-
public function add_menu() {
|
138 |
-
|
139 |
-
if ( empty( $this->fields ) ) {
|
140 |
-
return '';
|
141 |
-
}
|
142 |
-
|
143 |
-
$page_title = esc_html__( 'Variation Swatches for WooCommerce Settings', 'woo-variation-swatches' );
|
144 |
-
$menu_title = esc_html__( 'Swatches', 'woo-variation-swatches' );
|
145 |
-
add_menu_page( $page_title, $menu_title, 'edit_theme_options', $this->slug, array(
|
146 |
-
$this,
|
147 |
-
'settings_form'
|
148 |
-
), 'dashicons-admin-generic', 31 );
|
149 |
-
}
|
150 |
-
|
151 |
-
public function add_admin_bar() {
|
152 |
-
|
153 |
-
if ( empty( $this->fields ) ) {
|
154 |
-
return '';
|
155 |
-
}
|
156 |
-
|
157 |
-
global $wp_admin_bar;
|
158 |
-
|
159 |
-
$url = admin_url( sprintf( 'admin.php?page=%s', $this->slug ) );
|
160 |
-
$menu_title = esc_html__( 'Swatches Settings', 'woo-variation-swatches' );
|
161 |
-
|
162 |
-
$args = array(
|
163 |
-
'id' => $this->settings_name,
|
164 |
-
'title' => $menu_title,
|
165 |
-
'href' => $url,
|
166 |
-
'meta' => array(
|
167 |
-
'class' => sprintf( '%s-admin-toolbar', $this->slug )
|
168 |
-
)
|
169 |
-
);
|
170 |
-
$wp_admin_bar->add_menu( $args );
|
171 |
-
|
172 |
-
if ( ! is_admin() && class_exists( 'WooCommerce' ) && ( is_singular( 'product' ) || is_shop() ) ) {
|
173 |
-
$wp_admin_bar->add_menu( array(
|
174 |
-
'id' => 'wvs-clear-transient',
|
175 |
-
'title' => esc_html__( 'Clear transient', 'woo-variation-swatches' ),
|
176 |
-
'href' => esc_url( remove_query_arg( array(
|
177 |
-
'variation_id',
|
178 |
-
'remove_item',
|
179 |
-
'add-to-cart',
|
180 |
-
'added-to-cart'
|
181 |
-
), add_query_arg( 'wvs_clear_transient', '' ) ) ),
|
182 |
-
'parent' => $this->settings_name,
|
183 |
-
'meta' => array(
|
184 |
-
'class' => sprintf( '%s-admin-toolbar-cache', $this->slug )
|
185 |
-
)
|
186 |
-
) );
|
187 |
-
}
|
188 |
-
|
189 |
-
do_action( 'wvs_admin_bar_menu', $wp_admin_bar, $this->settings_name );
|
190 |
-
}
|
191 |
-
|
192 |
-
public function plugin_action_links( $links ) {
|
193 |
-
|
194 |
-
if ( empty( $this->fields ) ) {
|
195 |
-
return $links;
|
196 |
-
}
|
197 |
-
|
198 |
-
$url = admin_url( sprintf( 'admin.php?page=%s', $this->slug ) );
|
199 |
-
$plugin_links = array( sprintf( '<a href="%s">%s</a>', esc_url( $url ), esc_html__( 'Settings', 'woo-variation-swatches' ) ) );
|
200 |
-
|
201 |
-
return array_merge( $plugin_links, $links );
|
202 |
-
}
|
203 |
-
|
204 |
-
private function set_default( $key, $type, $value ) {
|
205 |
-
$this->defaults[ $key ] = array( 'id' => $key, 'type' => $type, 'value' => $value );
|
206 |
-
}
|
207 |
-
|
208 |
-
private function get_default( $key ) {
|
209 |
-
return isset( $this->defaults[ $key ] ) ? $this->defaults[ $key ] : null;
|
210 |
-
}
|
211 |
-
|
212 |
-
public function get_defaults() {
|
213 |
-
return $this->defaults;
|
214 |
-
}
|
215 |
-
|
216 |
-
public function set_defaults() {
|
217 |
-
foreach ( $this->fields as $tab_key => $tab ) {
|
218 |
-
$tab = apply_filters( 'wvs_settings_tab', $tab );
|
219 |
-
|
220 |
-
foreach ( $tab['sections'] as $section_key => $section ) {
|
221 |
-
|
222 |
-
$section = apply_filters( 'wvs_settings_section', $section, $tab );
|
223 |
-
|
224 |
-
$section['id'] = ! isset( $section['id'] ) ? $tab['id'] . '-section' : $section['id'];
|
225 |
-
|
226 |
-
$section['fields'] = apply_filters( 'wvs_settings_fields', $section['fields'], $section, $tab );
|
227 |
-
|
228 |
-
foreach ( $section['fields'] as $field ) {
|
229 |
-
if ( isset( $field['pro'] ) ) {
|
230 |
-
continue;
|
231 |
-
}
|
232 |
-
$field['default'] = isset( $field['default'] ) ? $field['default'] : null;
|
233 |
-
$this->set_default( $field['id'], $field['type'], $field['default'] );
|
234 |
-
}
|
235 |
-
}
|
236 |
-
}
|
237 |
-
}
|
238 |
-
|
239 |
-
public function delete_settings() {
|
240 |
-
|
241 |
-
do_action( sprintf( 'delete_%s_settings', $this->settings_name ), $this );
|
242 |
-
|
243 |
-
|
244 |
-
// license_key should not updated
|
245 |
-
|
246 |
-
return delete_option( $this->settings_name );
|
247 |
-
}
|
248 |
-
|
249 |
-
public function get_option( $option ) {
|
250 |
-
$default = $this->get_default( $option );
|
251 |
-
// $all_defaults = wp_list_pluck( $this->get_defaults(), 'value' );
|
252 |
-
|
253 |
-
$options = get_option( $this->settings_name );
|
254 |
-
|
255 |
-
$is_new = ( ! is_array( $options ) && is_bool( $options ) );
|
256 |
-
|
257 |
-
// Theme Support
|
258 |
-
if ( current_theme_supports( $this->theme_feature_name ) ) {
|
259 |
-
$theme_support = get_theme_support( $this->theme_feature_name );
|
260 |
-
$default['value'] = isset( $theme_support[0][ $option ] ) ? $theme_support[0][ $option ] : $default['value'];
|
261 |
-
}
|
262 |
-
|
263 |
-
$default_value = isset( $default['value'] ) ? $default['value'] : null;
|
264 |
-
|
265 |
-
if ( ! is_null( $this->get_reserved( $option ) ) ) {
|
266 |
-
$default_value = $this->get_reserved( $option );
|
267 |
-
}
|
268 |
-
|
269 |
-
if ( $is_new ) {
|
270 |
-
// return ( $default[ 'type' ] === 'checkbox' ) ? ( ! ! $default[ 'value' ] ) : $default[ 'value' ];
|
271 |
-
return $default_value;
|
272 |
-
} else {
|
273 |
-
// return ( $default[ 'type' ] === 'checkbox' ) ? ( isset( $options[ $option ] ) ? TRUE : FALSE ) : ( isset( $options[ $option ] ) ? $options[ $option ] : $default[ 'value' ] );
|
274 |
-
return isset( $options[ $option ] ) ? $options[ $option ] : $default_value;
|
275 |
-
}
|
276 |
-
}
|
277 |
-
|
278 |
-
public function get_options() {
|
279 |
-
return get_option( $this->settings_name );
|
280 |
-
}
|
281 |
-
|
282 |
-
public function update_option( $key, $value ) {
|
283 |
-
$options = get_option( $this->settings_name );
|
284 |
-
$options[ $key ] = $value;
|
285 |
-
update_option( $this->settings_name, $options );
|
286 |
-
}
|
287 |
-
|
288 |
-
public function sanitize_callback( $options ) {
|
289 |
-
|
290 |
-
foreach ( $this->get_defaults() as $opt ) {
|
291 |
-
if ( $opt['type'] === 'checkbox' && ! isset( $options[ $opt['id'] ] ) ) {
|
292 |
-
$options[ $opt['id'] ] = 0;
|
293 |
-
}
|
294 |
-
}
|
295 |
-
|
296 |
-
return $options;
|
297 |
-
}
|
298 |
-
|
299 |
-
public function is_reset_all() {
|
300 |
-
return isset( $_GET['page'] ) && ( $_GET['page'] == $this->slug ) && isset( $_GET[ $this->setting_reset_name ] );
|
301 |
-
}
|
302 |
-
|
303 |
-
public function is_show_pro() {
|
304 |
-
return isset( $_GET['page'] ) && ( $_GET['page'] == $this->slug ) && isset( $_GET[ $this->show_pro_name ] );
|
305 |
-
}
|
306 |
-
|
307 |
-
public function settings_init() {
|
308 |
-
|
309 |
-
if ( $this->is_reset_all() ) {
|
310 |
-
$this->delete_settings();
|
311 |
-
wp_redirect( $this->settings_url() );
|
312 |
-
}
|
313 |
-
|
314 |
-
register_setting( $this->settings_name, $this->settings_name, array( $this, 'sanitize_callback' ) );
|
315 |
-
|
316 |
-
foreach ( $this->fields as $tab_key => $tab ) {
|
317 |
-
|
318 |
-
$tab = apply_filters( 'wvs_settings_tab', $tab );
|
319 |
-
|
320 |
-
// print_r( $tab); die;
|
321 |
-
|
322 |
-
foreach ( $tab['sections'] as $section_key => $section ) {
|
323 |
-
|
324 |
-
$section = apply_filters( 'wvs_settings_section', $section, $tab );
|
325 |
-
|
326 |
-
//print_r( $section); die;
|
327 |
-
|
328 |
-
$section['id'] = ! isset( $section['id'] ) ? $tab['id'] . '-section-' . $section_key : $section['id'];
|
329 |
-
|
330 |
-
// Adding Settings section id
|
331 |
-
$this->fields[ $tab_key ]['sections'][ $section_key ]['id'] = $section['id'];
|
332 |
-
|
333 |
-
add_settings_section( $tab['id'] . $section['id'], $section['title'], function () use ( $section ) {
|
334 |
-
if ( isset( $section['desc'] ) && ! empty( $section['desc'] ) ) {
|
335 |
-
echo '<div class="inside">' . $section['desc'] . '</div>';
|
336 |
-
}
|
337 |
-
}, $tab['id'] . $section['id'] );
|
338 |
-
|
339 |
-
$section['fields'] = apply_filters( 'wvs_settings_fields', $section['fields'], $section, $tab );
|
340 |
-
|
341 |
-
foreach ( $section['fields'] as $field ) {
|
342 |
-
|
343 |
-
if ( isset( $field['pro'] ) ) {
|
344 |
-
$field['id'] = uniqid( 'pro' );
|
345 |
-
$field['type'] = '';
|
346 |
-
$field['title'] = '';
|
347 |
-
}
|
348 |
-
|
349 |
-
//$field[ 'label_for' ] = $this->settings_name . '[' . $field[ 'id' ] . ']';
|
350 |
-
$field['label_for'] = $field['id'] . '-field';
|
351 |
-
$field['default'] = isset( $field['default'] ) ? $field['default'] : null;
|
352 |
-
|
353 |
-
// $this->set_default( $field[ 'id' ], $field[ 'default' ] );
|
354 |
-
|
355 |
-
if ( $field['type'] == 'checkbox' || $field['type'] == 'radio' ) {
|
356 |
-
unset( $field['label_for'] );
|
357 |
-
}
|
358 |
-
|
359 |
-
add_settings_field( $this->settings_name . '[' . $field['id'] . ']', $field['title'], array(
|
360 |
-
$this,
|
361 |
-
'field_callback'
|
362 |
-
), $tab['id'] . $section['id'], $tab['id'] . $section['id'], $field );
|
363 |
-
|
364 |
-
}
|
365 |
-
}
|
366 |
-
}
|
367 |
-
}
|
368 |
-
|
369 |
-
public function make_implode_html_attributes( $attributes, $except = array( 'type', 'id', 'name', 'value' ) ) {
|
370 |
-
$attrs = array();
|
371 |
-
foreach ( $attributes as $name => $value ) {
|
372 |
-
if ( in_array( $name, $except, true ) ) {
|
373 |
-
continue;
|
374 |
-
}
|
375 |
-
$attrs[] = esc_attr( $name ) . '="' . esc_attr( $value ) . '"';
|
376 |
-
}
|
377 |
-
|
378 |
-
return implode( ' ', array_unique( $attrs ) );
|
379 |
-
}
|
380 |
-
|
381 |
-
public function field_callback( $field ) {
|
382 |
-
|
383 |
-
switch ( $field['type'] ) {
|
384 |
-
case 'radio':
|
385 |
-
$this->radio_field_callback( $field );
|
386 |
-
break;
|
387 |
-
|
388 |
-
case 'checkbox':
|
389 |
-
$this->checkbox_field_callback( $field );
|
390 |
-
break;
|
391 |
-
|
392 |
-
case 'select':
|
393 |
-
$this->select_field_callback( $field );
|
394 |
-
break;
|
395 |
-
|
396 |
-
case 'number':
|
397 |
-
$this->number_field_callback( $field );
|
398 |
-
break;
|
399 |
-
|
400 |
-
case 'color':
|
401 |
-
$this->color_field_callback( $field );
|
402 |
-
break;
|
403 |
-
|
404 |
-
case 'post_select':
|
405 |
-
$this->post_select_field_callback( $field );
|
406 |
-
break;
|
407 |
-
|
408 |
-
case 'pro':
|
409 |
-
$this->pro_field_callback( $field );
|
410 |
-
break;
|
411 |
-
|
412 |
-
default:
|
413 |
-
$this->text_field_callback( $field );
|
414 |
-
break;
|
415 |
-
}
|
416 |
-
|
417 |
-
do_action( 'wvs_settings_field_callback', $field );
|
418 |
-
}
|
419 |
-
|
420 |
-
public function checkbox_field_callback( $args ) {
|
421 |
-
|
422 |
-
$value = wc_string_to_bool( $this->get_option( $args['id'] ) );
|
423 |
-
// $size = isset( $args[ 'size' ] ) && ! is_null( $args[ 'size' ] ) ? $args[ 'size' ] : 'regular';
|
424 |
-
|
425 |
-
$attrs = isset( $args['attrs'] ) ? $this->make_implode_html_attributes( $args['attrs'] ) : '';
|
426 |
-
|
427 |
-
$html = sprintf( '<fieldset><label><input %1$s type="checkbox" id="%2$s-field" name="%4$s[%2$s]" value="%3$s" %5$s/> %6$s</label> %7$s</fieldset>', $attrs, $args['id'], true, $this->settings_name, checked( $value, true, false ), esc_attr( $args['desc'] ), $this->get_field_description( $args ) );
|
428 |
-
|
429 |
-
echo $html;
|
430 |
-
}
|
431 |
-
|
432 |
-
public function radio_field_callback( $args ) {
|
433 |
-
// $size = isset( $args[ 'size' ] ) && ! is_null( $args[ 'size' ] ) ? $args[ 'size' ] : 'regular';
|
434 |
-
$options = apply_filters( "wvs_settings_{$args[ 'id' ]}_radio_options", $args['options'] );
|
435 |
-
$value = esc_attr( $this->get_option( $args['id'] ) );
|
436 |
-
|
437 |
-
$attrs = isset( $args['attrs'] ) ? $this->make_implode_html_attributes( $args['attrs'] ) : '';
|
438 |
-
|
439 |
-
|
440 |
-
$html = '<fieldset>';
|
441 |
-
$html .= implode( '<br />', array_map( function ( $key, $option ) use ( $attrs, $args, $value ) {
|
442 |
-
return sprintf( '<label><input %1$s type="radio" name="%4$s[%2$s]" value="%3$s" %5$s/> %6$s</label>', $attrs, $args['id'], $key, $this->settings_name, checked( $value, $key, false ), $option );
|
443 |
-
}, array_keys( $options ), $options ) );
|
444 |
-
$html .= $this->get_field_description( $args );
|
445 |
-
$html .= '</fieldset>';
|
446 |
-
|
447 |
-
echo $html;
|
448 |
-
}
|
449 |
-
|
450 |
-
public function select_field_callback( $args ) {
|
451 |
-
$options = apply_filters( "wvs_settings_{$args[ 'id' ]}_select_options", $args['options'] );
|
452 |
-
$value = esc_attr( $this->get_option( $args['id'] ) );
|
453 |
-
$options = array_map( function ( $key, $option ) use ( $value ) {
|
454 |
-
return "<option value='{$key}'" . selected( $key, $value, false ) . ">{$option}</option>";
|
455 |
-
}, array_keys( $options ), $options );
|
456 |
-
$size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular';
|
457 |
-
|
458 |
-
$attrs = isset( $args['attrs'] ) ? $this->make_implode_html_attributes( $args['attrs'] ) : '';
|
459 |
-
|
460 |
-
$html = sprintf( '<select %5$s class="%1$s-text" id="%2$s-field" name="%4$s[%2$s]">%3$s</select>', $size, $args['id'], implode( '', $options ), $this->settings_name, $attrs );
|
461 |
-
$html .= $this->get_field_description( $args );
|
462 |
-
|
463 |
-
echo $html;
|
464 |
-
}
|
465 |
-
|
466 |
-
public function get_field_description( $args ) {
|
467 |
-
|
468 |
-
$desc = '';
|
469 |
-
$desc .= $this->show_pro_label_tag_content();
|
470 |
-
|
471 |
-
if ( ! empty( $args['desc'] ) ) {
|
472 |
-
$desc .= sprintf( '<p class="description">%s</p>', $args['desc'] );
|
473 |
-
} else {
|
474 |
-
$desc .= '';
|
475 |
-
}
|
476 |
-
|
477 |
-
return ( ( $args['type'] === 'checkbox' ) ) ? $this->show_pro_label_tag_content() : $desc;
|
478 |
-
}
|
479 |
-
|
480 |
-
public function post_select_field_callback( $args ) {
|
481 |
-
|
482 |
-
$options = apply_filters( "wvs_settings_{$args[ 'id' ]}_post_select_options", $args['options'] );
|
483 |
-
|
484 |
-
$value = esc_attr( $this->get_option( $args['id'] ) );
|
485 |
-
|
486 |
-
$options = array_map( function ( $option ) use ( $value ) {
|
487 |
-
return "<option value='{$option->ID}'" . selected( $option->ID, $value, false ) . ">$option->post_title</option>";
|
488 |
-
}, $options );
|
489 |
-
|
490 |
-
$size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular';
|
491 |
-
$html = sprintf( '<select class="%1$s-text" id="%2$s-field" name="%4$s[%2$s]">%3$s</select>', $size, $args['id'], implode( '', $options ), $this->settings_name );
|
492 |
-
$html .= $this->get_field_description( $args );
|
493 |
-
echo $html;
|
494 |
-
}
|
495 |
-
|
496 |
-
public function text_field_callback( $args ) {
|
497 |
-
$value = esc_attr( $this->get_option( $args['id'] ) );
|
498 |
-
$size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'regular';
|
499 |
-
|
500 |
-
$attrs = isset( $args['attrs'] ) ? $this->make_implode_html_attributes( $args['attrs'] ) : '';
|
501 |
-
|
502 |
-
$html = sprintf( '<input %5$s type="text" class="%1$s-text" id="%2$s-field" name="%4$s[%2$s]" value="%3$s"/>', $size, $args['id'], $value, $this->settings_name, $attrs );
|
503 |
-
$html .= $this->get_field_description( $args );
|
504 |
-
|
505 |
-
echo $html;
|
506 |
-
}
|
507 |
-
|
508 |
-
public function pro_field_callback( $args ) {
|
509 |
-
|
510 |
-
$is_html = isset( $args['html'] );
|
511 |
-
|
512 |
-
if ( $is_html ) {
|
513 |
-
$html = $args['html'];
|
514 |
-
} else {
|
515 |
-
$image = esc_url( $args['screen_shot'] );
|
516 |
-
$link = esc_url( $args['product_link'] );
|
517 |
-
|
518 |
-
|
519 |
-
$width = isset( $args['width'] ) ? $args['width'] : '70%';
|
520 |
-
|
521 |
-
$html = sprintf( '<a target="_blank" href="%s"><img style="width: %s" src="%s" /></a>', $link, $width, $image );
|
522 |
-
$html .= $this->get_field_description( $args );
|
523 |
-
}
|
524 |
-
|
525 |
-
|
526 |
-
echo $html;
|
527 |
-
}
|
528 |
-
|
529 |
-
public function color_field_callback( $args ) {
|
530 |
-
$value = esc_attr( $this->get_option( $args['id'] ) );
|
531 |
-
// $size = isset( $args[ 'size' ] ) && ! is_null( $args[ 'size' ] ) ? $args[ 'size' ] : 'regular';
|
532 |
-
$alpha = isset( $args['alpha'] ) && $args['alpha'] === true ? ' data-alpha="true"' : '';
|
533 |
-
$html = sprintf( '<input type="text" %1$s class="wvs-color-picker" id="%2$s-field" name="%4$s[%2$s]" value="%3$s" data-default-color="%3$s" />', $alpha, $args['id'], $value, $this->settings_name );
|
534 |
-
$html .= $this->get_field_description( $args );
|
535 |
-
|
536 |
-
echo $html;
|
537 |
-
}
|
538 |
-
|
539 |
-
public function number_field_callback( $args ) {
|
540 |
-
$value = esc_attr( $this->get_option( $args['id'] ) );
|
541 |
-
$size = isset( $args['size'] ) && ! is_null( $args['size'] ) ? $args['size'] : 'small';
|
542 |
-
|
543 |
-
$min = isset( $args['min'] ) && ! is_null( $args['min'] ) ? 'min="' . $args['min'] . '"' : '';
|
544 |
-
$max = isset( $args['max'] ) && ! is_null( $args['max'] ) ? 'max="' . $args['max'] . '"' : '';
|
545 |
-
$step = isset( $args['step'] ) && ! is_null( $args['step'] ) ? 'step="' . $args['step'] . '"' : '';
|
546 |
-
$suffix = isset( $args['suffix'] ) && ! is_null( $args['suffix'] ) ? ' <span>' . $args['suffix'] . '</span>' : '';
|
547 |
-
|
548 |
-
$attrs = isset( $args['attrs'] ) ? $this->make_implode_html_attributes( $args['attrs'] ) : '';
|
549 |
-
|
550 |
-
|
551 |
-
$html = sprintf( '<input %9$s type="number" class="%1$s-text" id="%2$s-field" name="%4$s[%2$s]" value="%3$s" %5$s %6$s %7$s /> %8$s', $size, $args['id'], $value, $this->settings_name, $min, $max, $step, $suffix, $attrs );
|
552 |
-
$html .= $this->get_field_description( $args );
|
553 |
-
|
554 |
-
echo $html;
|
555 |
-
}
|
556 |
-
|
557 |
-
public function settings_form() {
|
558 |
-
if ( ! current_user_can( 'manage_options' ) ) {
|
559 |
-
wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
|
560 |
-
}
|
561 |
-
?>
|
562 |
-
<div id="<?php echo $this->slug ?>-wrap" class="wrap settings-wrap">
|
563 |
-
|
564 |
-
<h1><?php echo get_admin_page_title() ?></h1>
|
565 |
-
|
566 |
-
<form method="post" action="<?php echo esc_url( admin_url( 'options.php' ) ) ?>" enctype="multipart/form-data">
|
567 |
-
<?php
|
568 |
-
settings_errors();
|
569 |
-
settings_fields( $this->settings_name );
|
570 |
-
?>
|
571 |
-
|
572 |
-
<?php $this->options_tabs(); ?>
|
573 |
-
|
574 |
-
<div id="settings-tabs">
|
575 |
-
<?php foreach ( $this->fields as $tab ):
|
576 |
-
|
577 |
-
if ( ! isset( $tab['active'] ) ) {
|
578 |
-
$tab['active'] = false;
|
579 |
-
}
|
580 |
-
$is_active = ( $this->get_last_active_tab() == $tab['id'] );
|
581 |
-
?>
|
582 |
-
|
583 |
-
<div id="<?php echo $tab['id'] ?>"
|
584 |
-
class="settings-tab wvs-setting-tab"
|
585 |
-
style="<?php echo ! $is_active ? 'display: none' : '' ?>">
|
586 |
-
<?php foreach ( $tab['sections'] as $section ):
|
587 |
-
$this->do_settings_sections( $tab['id'] . $section['id'] );
|
588 |
-
endforeach; ?>
|
589 |
-
</div>
|
590 |
-
|
591 |
-
<?php endforeach; ?>
|
592 |
-
</div>
|
593 |
-
<?php
|
594 |
-
$this->last_tab_input();
|
595 |
-
// submit_button();
|
596 |
-
?>
|
597 |
-
<p class="submit wvs-button-wrapper">
|
598 |
-
<input type="submit" id="submit" class="button button-primary" value="<?php esc_html_e( 'Save Changes', 'woo-variation-swatches' ) ?>">
|
599 |
-
<a onclick="return confirm('<?php esc_attr_e( 'Are you sure to reset current settings?', 'woo-variation-swatches' ) ?>')" class="reset" href="<?php echo $this->reset_url() ?>"><?php esc_html_e( 'Reset all', 'woo-variation-swatches' ) ?></a>
|
600 |
-
</p>
|
601 |
-
|
602 |
-
</form>
|
603 |
-
</div>
|
604 |
-
<?php
|
605 |
-
}
|
606 |
-
|
607 |
-
public function reset_url() {
|
608 |
-
return add_query_arg( array( 'page' => $this->slug, 'reset' => '' ), admin_url( 'admin.php' ) );
|
609 |
-
}
|
610 |
-
|
611 |
-
public function settings_url() {
|
612 |
-
return add_query_arg( array( 'page' => $this->slug ), admin_url( 'admin.php' ) );
|
613 |
-
}
|
614 |
-
|
615 |
-
private function last_tab_input() {
|
616 |
-
printf( '<input type="hidden" id="_last_active_tab" name="%s[_last_active_tab]" value="%s">', $this->settings_name, $this->get_last_active_tab() );
|
617 |
-
}
|
618 |
-
|
619 |
-
public function options_tabs() {
|
620 |
-
?>
|
621 |
-
<h2 class="nav-tab-wrapper wp-clearfix">
|
622 |
-
<?php foreach ( $this->fields as $tabs ): ?>
|
623 |
-
<a data-target="<?php echo $tabs['id'] ?>" <?php echo $this->get_options_tab_pro_attr( $tabs ) ?> class="wvs-setting-nav-tab nav-tab <?php echo $this->get_options_tab_css_classes( $tabs ) ?> " href="#<?php echo $tabs['id'] ?>"><?php echo $tabs['title'] ?></a>
|
624 |
-
<?php endforeach; ?>
|
625 |
-
</h2>
|
626 |
-
<?php
|
627 |
-
}
|
628 |
-
|
629 |
-
private function get_options_tab_pro_attr( $tabs ) {
|
630 |
-
// $attrs[] = ( isset( $tabs[ 'is_pro' ] ) && $tabs[ 'is_pro' ] ) ? sprintf( 'data-pro-text="%s"', apply_filters( 'wvs_settings_tab_pro_text', 'Pro' ) ) : false;
|
631 |
-
$attrs[] = ( isset( $tabs['is_new'] ) && $tabs['is_new'] ) ? sprintf( 'data-new-text="%s"', apply_filters( 'wvs_settings_tab_new_text', 'New' ) ) : false;
|
632 |
-
|
633 |
-
return implode( ' ', $attrs );
|
634 |
-
}
|
635 |
-
|
636 |
-
private function get_options_tab_css_classes( $tabs ) {
|
637 |
-
$classes = array();
|
638 |
-
|
639 |
-
$classes[] = ( $this->get_last_active_tab() == $tabs['id'] ) ? 'nav-tab-active' : '';
|
640 |
-
|
641 |
-
// $classes[] = ( $this->get_options_tab_pro_attr( $tabs ) ) ? 'pro-tab' : '';
|
642 |
-
|
643 |
-
return implode( ' ', array_unique( apply_filters( 'get_options_tab_css_classes', $classes ) ) );
|
644 |
-
}
|
645 |
-
|
646 |
-
private function get_last_active_tab() {
|
647 |
-
|
648 |
-
|
649 |
-
$last_option_tab = trim( $this->get_option( '_last_active_tab' ) );
|
650 |
-
$last_tab = $last_option_tab;
|
651 |
-
|
652 |
-
if ( isset( $_GET['tab'] ) && ! empty( $_GET['tab'] ) ) {
|
653 |
-
$last_tab = trim( $_GET['tab'] );
|
654 |
-
}
|
655 |
-
|
656 |
-
if ( $last_option_tab ) {
|
657 |
-
$last_tab = $last_option_tab;
|
658 |
-
}
|
659 |
-
|
660 |
-
$default_tab = '';
|
661 |
-
foreach ( $this->fields as $tabs ) {
|
662 |
-
if ( isset( $tabs['active'] ) && $tabs['active'] ) {
|
663 |
-
$default_tab = $tabs['id'];
|
664 |
-
break;
|
665 |
-
}
|
666 |
-
}
|
667 |
-
|
668 |
-
return ! empty( $last_tab ) ? esc_html( $last_tab ) : esc_html( $default_tab );
|
669 |
-
|
670 |
-
}
|
671 |
-
|
672 |
-
private function do_settings_sections( $page ) {
|
673 |
-
global $wp_settings_sections, $wp_settings_fields;
|
674 |
-
|
675 |
-
if ( ! isset( $wp_settings_sections[ $page ] ) ) {
|
676 |
-
return;
|
677 |
-
}
|
678 |
-
|
679 |
-
foreach ( (array) $wp_settings_sections[ $page ] as $section ) {
|
680 |
-
if ( $section['title'] ) {
|
681 |
-
echo "<h2>{$section['title']}</h2>\n";
|
682 |
-
}
|
683 |
-
|
684 |
-
if ( $section['callback'] ) {
|
685 |
-
call_user_func( $section['callback'], $section );
|
686 |
-
}
|
687 |
-
|
688 |
-
if ( ! isset( $wp_settings_fields ) || ! isset( $wp_settings_fields[ $page ] ) || ! isset( $wp_settings_fields[ $page ][ $section['id'] ] ) ) {
|
689 |
-
continue;
|
690 |
-
}
|
691 |
-
|
692 |
-
echo '<table class="form-table">';
|
693 |
-
$this->do_settings_fields( $page, $section['id'] );
|
694 |
-
echo '</table>';
|
695 |
-
}
|
696 |
-
}
|
697 |
-
|
698 |
-
public function array2html_attr( $attributes, $do_not_add = array() ) {
|
699 |
-
|
700 |
-
$attributes = wp_parse_args( $attributes, array() );
|
701 |
-
|
702 |
-
if ( ! empty( $do_not_add ) and is_array( $do_not_add ) ) {
|
703 |
-
foreach ( $do_not_add as $att_name ) {
|
704 |
-
unset( $attributes[ $att_name ] );
|
705 |
-
}
|
706 |
-
}
|
707 |
-
|
708 |
-
|
709 |
-
$attributes_array = array();
|
710 |
-
|
711 |
-
foreach ( $attributes as $key => $value ) {
|
712 |
-
|
713 |
-
if ( is_bool( $attributes[ $key ] ) and $attributes[ $key ] === true ) {
|
714 |
-
return $attributes[ $key ] ? $key : '';
|
715 |
-
} elseif ( is_bool( $attributes[ $key ] ) and $attributes[ $key ] === false ) {
|
716 |
-
$attributes_array[] = '';
|
717 |
-
} else {
|
718 |
-
$attributes_array[] = $key . '="' . $value . '"';
|
719 |
-
}
|
720 |
-
}
|
721 |
-
|
722 |
-
return implode( ' ', $attributes_array );
|
723 |
-
}
|
724 |
-
|
725 |
-
private function build_dependency( $require_array ) {
|
726 |
-
$b_array = array();
|
727 |
-
foreach ( $require_array as $k => $v ) {
|
728 |
-
$b_array[ '#' . $k . '-field' ] = $v;
|
729 |
-
}
|
730 |
-
|
731 |
-
return 'data-wvsdepends="[' . esc_attr( wp_json_encode( $b_array ) ) . ']"';
|
732 |
-
}
|
733 |
-
|
734 |
-
private function do_settings_fields( $page, $section ) {
|
735 |
-
global $wp_settings_fields;
|
736 |
-
|
737 |
-
if ( ! isset( $wp_settings_fields[ $page ][ $section ] ) ) {
|
738 |
-
return;
|
739 |
-
}
|
740 |
-
|
741 |
-
foreach ( (array) $wp_settings_fields[ $page ][ $section ] as $field ) {
|
742 |
-
/*$class = '';
|
743 |
-
|
744 |
-
if ( ! empty( $field[ 'args' ][ 'class' ] ) ) {
|
745 |
-
$class = ' class="' . esc_attr( $field[ 'args' ][ 'class' ] ) . '"';
|
746 |
-
}*/
|
747 |
-
|
748 |
-
$custom_attributes = $this->array2html_attr( isset( $field['args']['attributes'] ) ? $field['args']['attributes'] : array() );
|
749 |
-
|
750 |
-
$wrapper_id = ! empty( $field['args']['id'] ) ? esc_attr( $field['args']['id'] ) . '-wrapper' : '';
|
751 |
-
$dependency = ! empty( $field['args']['require'] ) ? $this->build_dependency( $field['args']['require'] ) : '';
|
752 |
-
|
753 |
-
$is_new = ( isset( $field['args']['is_new'] ) && $field['args']['is_new'] );
|
754 |
-
$new_html = $is_new ? '<span class="wvs-new-feature-tick">' . esc_html__( 'NEW', 'woo-variation-swatches' ) . '</span>' : '';
|
755 |
-
|
756 |
-
printf( '<tr id="%s" %s %s>', $wrapper_id, $custom_attributes, $dependency );
|
757 |
-
|
758 |
-
if ( isset( $field['args']['pro'] ) ) {
|
759 |
-
echo '<td colspan="2" style="padding: 0; margin: 0">';
|
760 |
-
$this->pro_field_callback( $field['args'] );
|
761 |
-
echo '</td>';
|
762 |
-
} else {
|
763 |
-
echo '<th scope="row" class="wvs-settings-label">';
|
764 |
-
if ( ! empty( $field['args']['label_for'] ) ) {
|
765 |
-
echo '<label for="' . esc_attr( $field['args']['label_for'] ) . '">' . $field['title'] . $new_html . '</label>';
|
766 |
-
} else {
|
767 |
-
echo $field['title'] . $new_html;
|
768 |
-
}
|
769 |
-
|
770 |
-
echo $this->show_pro_label_tag();
|
771 |
-
echo '</th>';
|
772 |
-
|
773 |
-
|
774 |
-
echo '<td class="wvs-settings-field-content">';
|
775 |
-
call_user_func( $field['callback'], $field['args'] );
|
776 |
-
echo '</td>';
|
777 |
-
}
|
778 |
-
|
779 |
-
echo '</tr>';
|
780 |
-
}
|
781 |
-
}
|
782 |
-
|
783 |
-
public function show_pro_label_tag() {
|
784 |
-
if ( $this->is_show_pro() ) {
|
785 |
-
return '<div class="wvs-show-pro-label"><span>PRO FEATURE</span></div>';
|
786 |
-
}
|
787 |
-
}
|
788 |
-
|
789 |
-
public function show_pro_label_tag_content() {
|
790 |
-
if ( $this->is_show_pro() ) {
|
791 |
-
return '<span class="wvs-show-pro-contents">Upgrade to premium >></span>';
|
792 |
-
}
|
793 |
-
}
|
794 |
-
}
|
795 |
-
endif;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/class-wvs-term-meta.php
DELETED
@@ -1,326 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
defined( 'ABSPATH' ) or die( 'Keep Silent' );
|
4 |
-
|
5 |
-
if ( ! class_exists( 'WVS_Term_Meta' ) ):
|
6 |
-
class WVS_Term_Meta {
|
7 |
-
|
8 |
-
private $taxonomy;
|
9 |
-
private $post_type;
|
10 |
-
private $fields = array();
|
11 |
-
|
12 |
-
public function __construct( $taxonomy, $post_type, $fields = array() ) {
|
13 |
-
|
14 |
-
$this->taxonomy = $taxonomy;
|
15 |
-
$this->post_type = $post_type;
|
16 |
-
$this->fields = $fields;
|
17 |
-
|
18 |
-
// Category/term ordering
|
19 |
-
// add_action( 'create_term', array( $this, 'create_term' ), 5, 3 );
|
20 |
-
|
21 |
-
add_action( 'delete_term', array( $this, 'delete_term' ), 5, 4 );
|
22 |
-
|
23 |
-
// Add form
|
24 |
-
add_action( "{$this->taxonomy}_add_form_fields", array( $this, 'add' ) );
|
25 |
-
add_action( "{$this->taxonomy}_edit_form_fields", array( $this, 'edit' ), 10 );
|
26 |
-
add_action( "created_term", array( $this, 'save' ), 10, 3 );
|
27 |
-
add_action( "edit_term", array( $this, 'save' ), 10, 3 );
|
28 |
-
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
29 |
-
|
30 |
-
// Add columns
|
31 |
-
add_filter( "manage_edit-{$this->taxonomy}_columns", array( $this, 'taxonomy_columns' ) );
|
32 |
-
add_filter( "manage_{$this->taxonomy}_custom_column", array( $this, 'taxonomy_column' ), 10, 3 );
|
33 |
-
|
34 |
-
}
|
35 |
-
|
36 |
-
public function taxonomy_columns( $columns ) {
|
37 |
-
$new_columns = array();
|
38 |
-
|
39 |
-
if ( isset( $columns['cb'] ) ) {
|
40 |
-
$new_columns['cb'] = $columns['cb'];
|
41 |
-
}
|
42 |
-
|
43 |
-
$new_columns['wvs-meta-preview'] = '';
|
44 |
-
|
45 |
-
if ( isset( $columns['cb'] ) ) {
|
46 |
-
unset( $columns['cb'] );
|
47 |
-
}
|
48 |
-
|
49 |
-
return array_merge( $new_columns, $columns );
|
50 |
-
}
|
51 |
-
|
52 |
-
public function taxonomy_column( $columns, $column, $term_id ) {
|
53 |
-
|
54 |
-
$attribute = wvs_get_wc_attribute_taxonomy( $this->taxonomy );
|
55 |
-
$fields = wvs_taxonomy_meta_fields( $attribute->attribute_type );
|
56 |
-
$available_types = wvs_available_attributes_types( $attribute->attribute_type );
|
57 |
-
|
58 |
-
do_action( 'wvs_global_attribute_column', $column, $term_id, $this->taxonomy, $attribute, $fields, $available_types );
|
59 |
-
|
60 |
-
if ( isset( $available_types['preview'] ) && is_callable( $available_types['preview'] ) ) {
|
61 |
-
call_user_func( $available_types['preview'], $term_id, $attribute, $fields );
|
62 |
-
}
|
63 |
-
}
|
64 |
-
|
65 |
-
public function delete_term( $term_id, $tt_id, $taxonomy, $deleted_term ) {
|
66 |
-
global $wpdb;
|
67 |
-
|
68 |
-
$term_id = absint( $term_id );
|
69 |
-
if ( $term_id and $taxonomy == $this->taxonomy ) {
|
70 |
-
$wpdb->delete( $wpdb->termmeta, array( 'term_id' => $term_id ), array( '%d' ) );
|
71 |
-
}
|
72 |
-
}
|
73 |
-
|
74 |
-
public function enqueue_scripts() {
|
75 |
-
wp_enqueue_media();
|
76 |
-
wp_enqueue_style( 'wp-color-picker' );
|
77 |
-
wp_enqueue_script( 'wp-color-picker' );
|
78 |
-
}
|
79 |
-
|
80 |
-
public function save( $term_id, $tt_id = '', $taxonomy = '' ) {
|
81 |
-
|
82 |
-
if ( $taxonomy == $this->taxonomy ) {
|
83 |
-
foreach ( $this->fields as $field ) {
|
84 |
-
foreach ( $_POST as $post_key => $post_value ) {
|
85 |
-
if ( $field['id'] == $post_key ) {
|
86 |
-
switch ( $field['type'] ) {
|
87 |
-
case 'text':
|
88 |
-
case 'color':
|
89 |
-
$post_value = esc_html( $post_value );
|
90 |
-
break;
|
91 |
-
case 'url':
|
92 |
-
$post_value = esc_url( $post_value );
|
93 |
-
break;
|
94 |
-
case 'image':
|
95 |
-
$post_value = absint( $post_value );
|
96 |
-
break;
|
97 |
-
case 'textarea':
|
98 |
-
$post_value = esc_textarea( $post_value );
|
99 |
-
break;
|
100 |
-
case 'editor':
|
101 |
-
$post_value = wp_kses_post( $post_value );
|
102 |
-
break;
|
103 |
-
case 'select':
|
104 |
-
case 'select2':
|
105 |
-
$post_value = sanitize_key( $post_value );
|
106 |
-
break;
|
107 |
-
case 'checkbox':
|
108 |
-
$post_value = sanitize_key( $post_value );
|
109 |
-
break;
|
110 |
-
default:
|
111 |
-
do_action( 'wvs_save_term_meta', $term_id, $field, $post_value, $taxonomy );
|
112 |
-
break;
|
113 |
-
}
|
114 |
-
update_term_meta( $term_id, $field['id'], $post_value );
|
115 |
-
}
|
116 |
-
}
|
117 |
-
}
|
118 |
-
do_action( 'wvs_after_term_meta_saved', $term_id, $taxonomy );
|
119 |
-
}
|
120 |
-
}
|
121 |
-
|
122 |
-
public function add() {
|
123 |
-
$this->generate_fields();
|
124 |
-
}
|
125 |
-
|
126 |
-
private function generate_fields( $term = false ) {
|
127 |
-
|
128 |
-
$screen = get_current_screen();
|
129 |
-
|
130 |
-
if ( ( $screen->post_type == $this->post_type ) and ( $screen->taxonomy == $this->taxonomy ) ) {
|
131 |
-
self::generate_form_fields( $this->fields, $term );
|
132 |
-
}
|
133 |
-
}
|
134 |
-
|
135 |
-
public static function generate_form_fields( $fields, $term ) {
|
136 |
-
|
137 |
-
$fields = apply_filters( 'wvs_term_meta_fields', $fields, $term );
|
138 |
-
|
139 |
-
if ( empty( $fields ) ) {
|
140 |
-
return;
|
141 |
-
}
|
142 |
-
|
143 |
-
foreach ( $fields as $field ) {
|
144 |
-
|
145 |
-
$field = apply_filters( 'wvs_term_meta_field', $field, $term );
|
146 |
-
|
147 |
-
$field['id'] = esc_html( $field['id'] );
|
148 |
-
|
149 |
-
if ( ! $term ) {
|
150 |
-
$field['value'] = isset( $field['default'] ) ? $field['default'] : '';
|
151 |
-
} else {
|
152 |
-
$field['value'] = get_term_meta( $term->term_id, $field['id'], true );
|
153 |
-
}
|
154 |
-
|
155 |
-
|
156 |
-
$field['size'] = isset( $field['size'] ) ? $field['size'] : '40';
|
157 |
-
$field['required'] = ( isset( $field['required'] ) and $field['required'] == true ) ? ' aria-required="true"' : '';
|
158 |
-
$field['placeholder'] = ( isset( $field['placeholder'] ) ) ? ' placeholder="' . $field['placeholder'] . '" data-placeholder="' . $field['placeholder'] . '"' : '';
|
159 |
-
$field['desc'] = ( isset( $field['desc'] ) ) ? $field['desc'] : '';
|
160 |
-
|
161 |
-
$field['dependency'] = ( isset( $field['dependency'] ) ) ? $field['dependency'] : array();
|
162 |
-
|
163 |
-
self::field_start( $field, $term );
|
164 |
-
switch ( $field['type'] ) {
|
165 |
-
case 'text':
|
166 |
-
case 'url':
|
167 |
-
ob_start();
|
168 |
-
?>
|
169 |
-
<input name="<?php echo $field['id'] ?>" id="<?php echo $field['id'] ?>"
|
170 |
-
type="<?php echo $field['type'] ?>"
|
171 |
-
value="<?php echo $field['value'] ?>"
|
172 |
-
size="<?php echo $field['size'] ?>" <?php echo $field['required'] . $field['placeholder'] ?>>
|
173 |
-
<?php
|
174 |
-
echo ob_get_clean();
|
175 |
-
break;
|
176 |
-
case 'color':
|
177 |
-
ob_start();
|
178 |
-
?>
|
179 |
-
<input name="<?php echo $field['id'] ?>" id="<?php echo $field['id'] ?>" type="text" class="wvs-color-picker" value="<?php echo $field['value'] ?>" data-default-color="<?php echo $field['value'] ?>" size="<?php echo $field['size'] ?>" <?php echo $field['required'] . $field['placeholder'] ?>>
|
180 |
-
<?php
|
181 |
-
echo ob_get_clean();
|
182 |
-
break;
|
183 |
-
case 'textarea':
|
184 |
-
ob_start();
|
185 |
-
?>
|
186 |
-
<textarea name="<?php echo $field['id'] ?>" id="<?php echo $field['id'] ?>" rows="5" cols="<?php echo $field['size'] ?>" <?php echo $field['required'] . $field['placeholder'] ?>><?php echo $field['value'] ?></textarea>
|
187 |
-
<?php
|
188 |
-
echo ob_get_clean();
|
189 |
-
break;
|
190 |
-
case 'editor':
|
191 |
-
$field['settings'] = isset( $field['settings'] )
|
192 |
-
? $field['settings']
|
193 |
-
: array(
|
194 |
-
'textarea_rows' => 8,
|
195 |
-
'quicktags' => false,
|
196 |
-
'media_buttons' => false
|
197 |
-
);
|
198 |
-
ob_start();
|
199 |
-
wp_editor( $field['value'], $field['id'], $field['settings'] );
|
200 |
-
echo ob_get_clean();
|
201 |
-
break;
|
202 |
-
case 'select':
|
203 |
-
case 'select2':
|
204 |
-
|
205 |
-
$field['options'] = isset( $field['options'] ) ? $field['options'] : array();
|
206 |
-
$field['multiple'] = isset( $field['multiple'] ) ? ' multiple="multiple"' : '';
|
207 |
-
$css_class = ( $field['type'] == 'select2' ) ? 'wvs-selectwoo' : '';
|
208 |
-
|
209 |
-
ob_start();
|
210 |
-
?>
|
211 |
-
<select name="<?php echo $field['id'] ?>" id="<?php echo $field['id'] ?>" class="<?php echo $css_class ?>" <?php echo $field['multiple'] ?>>
|
212 |
-
<?php
|
213 |
-
foreach ( $field['options'] as $key => $option ) {
|
214 |
-
echo '<option' . selected( $field['value'], $key, false ) . ' value="' . $key . '">' . $option . '</option>';
|
215 |
-
}
|
216 |
-
?>
|
217 |
-
</select>
|
218 |
-
<?php
|
219 |
-
echo ob_get_clean();
|
220 |
-
break;
|
221 |
-
case 'image':
|
222 |
-
ob_start();
|
223 |
-
?>
|
224 |
-
<div class="meta-image-field-wrapper">
|
225 |
-
<div class="image-preview">
|
226 |
-
<img data-placeholder="<?php echo esc_url( self::placeholder_img_src() ); ?>" src="<?php echo esc_url( self::get_img_src( $field['value'] ) ); ?>" width="60px" height="60px" />
|
227 |
-
</div>
|
228 |
-
<div class="button-wrapper">
|
229 |
-
<input type="hidden" id="<?php echo $field['id'] ?>" name="<?php echo $field['id'] ?>" value="<?php echo esc_attr( $field['value'] ) ?>" />
|
230 |
-
<button type="button" class="wvs_upload_image_button button button-primary button-small"><?php esc_html_e( 'Upload / Add image', 'woo-variation-swatches' ); ?></button>
|
231 |
-
<button type="button" style="<?php echo( empty( $field['value'] ) ? 'display:none' : '' ) ?>" class="wvs_remove_image_button button button-danger button-small"><?php esc_html_e( 'Remove image', 'woo-variation-swatches' ); ?></button>
|
232 |
-
</div>
|
233 |
-
</div>
|
234 |
-
<?php
|
235 |
-
echo ob_get_clean();
|
236 |
-
break;
|
237 |
-
case 'checkbox':
|
238 |
-
|
239 |
-
ob_start();
|
240 |
-
?>
|
241 |
-
<label for="<?php echo esc_attr( $field['id'] ) ?>">
|
242 |
-
|
243 |
-
<input name="<?php echo $field['id'] ?>" id="<?php echo $field['id'] ?>"
|
244 |
-
<?php checked( $field['value'], 'yes' ) ?>
|
245 |
-
type="<?php echo $field['type'] ?>"
|
246 |
-
value="yes" <?php echo $field['required'] . $field['placeholder'] ?>>
|
247 |
-
|
248 |
-
<?php echo $field['label'] ?></label>
|
249 |
-
<?php
|
250 |
-
echo ob_get_clean();
|
251 |
-
break;
|
252 |
-
default:
|
253 |
-
do_action( 'wvs_term_meta_field', $field, $term );
|
254 |
-
break;
|
255 |
-
|
256 |
-
}
|
257 |
-
self::field_end( $field, $term );
|
258 |
-
|
259 |
-
}
|
260 |
-
}
|
261 |
-
|
262 |
-
private static function field_start( $field, $term ) {
|
263 |
-
// Example:
|
264 |
-
// http://emranahmed.github.io/Form-Field-Dependency/
|
265 |
-
/*'dependency' => array(
|
266 |
-
array( '#show_tooltip' => array( 'type' => 'equal', 'value' => 'yes' ) )
|
267 |
-
)*/
|
268 |
-
|
269 |
-
$depends = empty( $field['dependency'] ) ? '' : "data-wvsdepends='" . wp_json_encode( $field['dependency'] ) . "'";
|
270 |
-
|
271 |
-
ob_start();
|
272 |
-
if ( ! $term ) {
|
273 |
-
?>
|
274 |
-
<div <?php echo $depends ?> class="form-field <?php echo esc_attr( $field['id'] ) ?> <?php echo empty( $field['required'] ) ? '' : 'form-required' ?>">
|
275 |
-
<?php if ( $field['type'] !== 'checkbox' ) { ?>
|
276 |
-
<label for="<?php echo esc_attr( $field['id'] ) ?>"><?php echo $field['label'] ?></label>
|
277 |
-
<?php
|
278 |
-
}
|
279 |
-
} else {
|
280 |
-
?>
|
281 |
-
<tr <?php echo $depends ?> class="form-field <?php echo esc_attr( $field['id'] ) ?> <?php echo empty( $field['required'] ) ? '' : 'form-required' ?>">
|
282 |
-
<th scope="row">
|
283 |
-
<label for="<?php echo esc_attr( $field['id'] ) ?>"><?php echo $field['label'] ?></label>
|
284 |
-
</th>
|
285 |
-
<td>
|
286 |
-
<?php
|
287 |
-
}
|
288 |
-
echo ob_get_clean();
|
289 |
-
}
|
290 |
-
|
291 |
-
private static function get_img_src( $thumbnail_id = false ) {
|
292 |
-
if ( ! empty( $thumbnail_id ) ) {
|
293 |
-
$image = wp_get_attachment_thumb_url( $thumbnail_id );
|
294 |
-
} else {
|
295 |
-
$image = self::placeholder_img_src();
|
296 |
-
}
|
297 |
-
|
298 |
-
return $image;
|
299 |
-
}
|
300 |
-
|
301 |
-
private static function placeholder_img_src() {
|
302 |
-
return woo_variation_swatches()->images_uri( 'placeholder.png' );
|
303 |
-
}
|
304 |
-
|
305 |
-
private static function field_end( $field, $term ) {
|
306 |
-
|
307 |
-
ob_start();
|
308 |
-
if ( ! $term ) {
|
309 |
-
?>
|
310 |
-
<p><?php echo $field['desc'] ?></p>
|
311 |
-
</div>
|
312 |
-
<?php
|
313 |
-
} else {
|
314 |
-
?>
|
315 |
-
<p class="description"><?php echo $field['desc'] ?></p></td>
|
316 |
-
</tr>
|
317 |
-
<?php
|
318 |
-
}
|
319 |
-
echo ob_get_clean();
|
320 |
-
}
|
321 |
-
|
322 |
-
public function edit( $term ) {
|
323 |
-
$this->generate_fields( $term );
|
324 |
-
}
|
325 |
-
}
|
326 |
-
endif;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/functions.php
CHANGED
@@ -1,2023 +1,14 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
defined( 'ABSPATH' ) or die( 'Keep Quit' );
|
4 |
-
|
5 |
-
//-------------------------------------------------------------------------------
|
6 |
-
// Detecting IE 11 Browser
|
7 |
-
//-------------------------------------------------------------------------------
|
8 |
-
|
9 |
-
if ( ! function_exists( 'wvs_is_ie11' ) ):
|
10 |
-
function wvs_is_ie11() {
|
11 |
-
global $is_IE;
|
12 |
-
|
13 |
-
if ( ! isset( $_SERVER['HTTP_USER_AGENT'] ) ) {
|
14 |
-
return false;
|
15 |
-
}
|
16 |
-
|
17 |
-
$ua = $_SERVER['HTTP_USER_AGENT'];
|
18 |
-
$is11 = preg_match( "/Trident\/7.0;(.*)rv:11.0/", $ua, $match ) !== false;
|
19 |
-
|
20 |
-
return $is_IE && $is11;
|
21 |
-
//return TRUE;
|
22 |
-
}
|
23 |
-
endif;
|
24 |
-
|
25 |
-
/**
|
26 |
-
* Returns the translated object ID (post_type or term) or original if missing
|
27 |
-
*
|
28 |
-
* @param $object_id integer|string|array The ID/s of the objects to check and return
|
29 |
-
* @param $type the object type: post, page, {custom post type name}, nav_menu, nav_menu_item, category, tag etc.
|
30 |
-
*
|
31 |
-
* @return string or array of object ids
|
32 |
-
*/
|
33 |
-
|
34 |
-
// https://wpml.org/wpml-hook/wpml_object_id/
|
35 |
-
if ( ! function_exists( 'wvs_wpml_object_id' ) ) {
|
36 |
-
function wvs_wpml_object_id( $object_id, $type = 'post', $language = null ) {
|
37 |
-
$current_language = apply_filters( 'wpml_current_language', $language );
|
38 |
-
|
39 |
-
return apply_filters( 'wpml_object_id', $object_id, $type, true, $current_language );
|
40 |
-
}
|
41 |
-
}
|
42 |
-
|
43 |
-
//-------------------------------------------------------------------------------
|
44 |
-
// Get All Image Sizes if wp_get_registered_image_subsizes function not available
|
45 |
-
//-------------------------------------------------------------------------------
|
46 |
-
/**
|
47 |
-
* Returns a normalized list of all currently registered image sub-sizes.
|
48 |
-
*
|
49 |
-
* @return array Associative array of the registered image sub-sizes.
|
50 |
-
* @since WP 5.3.0
|
51 |
-
*
|
52 |
-
*/
|
53 |
-
if ( ! function_exists( 'wp_get_registered_image_subsizes' ) ):
|
54 |
-
function wp_get_registered_image_subsizes() {
|
55 |
-
$additional_sizes = wp_get_additional_image_sizes();
|
56 |
-
$all_sizes = array();
|
57 |
-
|
58 |
-
foreach ( get_intermediate_image_sizes() as $size_name ) {
|
59 |
-
$size_data = array(
|
60 |
-
'width' => 0,
|
61 |
-
'height' => 0,
|
62 |
-
'crop' => false,
|
63 |
-
);
|
64 |
-
|
65 |
-
if ( isset( $additional_sizes[ $size_name ]['width'] ) ) {
|
66 |
-
// For sizes added by plugins and themes.
|
67 |
-
$size_data['width'] = intval( $additional_sizes[ $size_name ]['width'] );
|
68 |
-
} else {
|
69 |
-
// For default sizes set in options.
|
70 |
-
$size_data['width'] = intval( get_option( "{$size_name}_size_w" ) );
|
71 |
-
}
|
72 |
-
|
73 |
-
if ( isset( $additional_sizes[ $size_name ]['height'] ) ) {
|
74 |
-
$size_data['height'] = intval( $additional_sizes[ $size_name ]['height'] );
|
75 |
-
} else {
|
76 |
-
$size_data['height'] = intval( get_option( "{$size_name}_size_h" ) );
|
77 |
-
}
|
78 |
-
|
79 |
-
if ( empty( $size_data['width'] ) && empty( $size_data['height'] ) ) {
|
80 |
-
// This size isn't set.
|
81 |
-
continue;
|
82 |
-
}
|
83 |
-
|
84 |
-
if ( isset( $additional_sizes[ $size_name ]['crop'] ) ) {
|
85 |
-
$size_data['crop'] = $additional_sizes[ $size_name ]['crop'];
|
86 |
-
} else {
|
87 |
-
$size_data['crop'] = get_option( "{$size_name}_crop" );
|
88 |
-
}
|
89 |
-
|
90 |
-
if ( ! is_array( $size_data['crop'] ) || empty( $size_data['crop'] ) ) {
|
91 |
-
$size_data['crop'] = wc_string_to_bool( $size_data['crop'] );
|
92 |
-
}
|
93 |
-
|
94 |
-
$all_sizes[ $size_name ] = $size_data;
|
95 |
-
}
|
96 |
-
|
97 |
-
return $all_sizes;
|
98 |
-
}
|
99 |
-
endif;
|
100 |
-
|
101 |
-
|
102 |
-
if ( ! function_exists( 'wvs_get_all_image_sizes' ) ):
|
103 |
-
function wvs_get_all_image_sizes() {
|
104 |
-
|
105 |
-
$image_subsizes = wp_get_registered_image_subsizes();
|
106 |
-
|
107 |
-
return apply_filters(
|
108 |
-
'wvs_get_all_image_sizes', array_reduce(
|
109 |
-
array_keys( $image_subsizes ), function ( $carry, $item ) use ( $image_subsizes ) {
|
110 |
-
|
111 |
-
$title = ucwords( str_ireplace( array( '-', '_' ), ' ', $item ) );
|
112 |
-
$width = $image_subsizes[ $item ]['width'];
|
113 |
-
$height = $image_subsizes[ $item ]['height'];
|
114 |
-
|
115 |
-
$carry[ $item ] = sprintf( '%s (%d × %d)', $title, $width, $height );
|
116 |
-
|
117 |
-
return $carry;
|
118 |
-
}, array()
|
119 |
-
)
|
120 |
-
);
|
121 |
-
}
|
122 |
-
endif;
|
123 |
-
|
124 |
-
|
125 |
-
//-------------------------------------------------------------------------------
|
126 |
-
// Available Product Attribute Types
|
127 |
-
//-------------------------------------------------------------------------------
|
128 |
-
|
129 |
-
if ( ! function_exists( 'wvs_available_attributes_types' ) ):
|
130 |
-
function wvs_available_attributes_types( $type = false ) {
|
131 |
-
$types = array();
|
132 |
-
|
133 |
-
$types['color'] = array(
|
134 |
-
'title' => esc_html__( 'Color', 'woo-variation-swatches' ),
|
135 |
-
'output' => 'wvs_color_variation_attribute_options',
|
136 |
-
'preview' => 'wvs_color_variation_attribute_preview'
|
137 |
-
);
|
138 |
-
|
139 |
-
$types['image'] = array(
|
140 |
-
'title' => esc_html__( 'Image', 'woo-variation-swatches' ),
|
141 |
-
'output' => 'wvs_image_variation_attribute_options',
|
142 |
-
'preview' => 'wvs_image_variation_attribute_preview'
|
143 |
-
);
|
144 |
-
|
145 |
-
$types['button'] = array(
|
146 |
-
'title' => esc_html__( 'Button', 'woo-variation-swatches' ),
|
147 |
-
'output' => 'wvs_button_variation_attribute_options',
|
148 |
-
'preview' => 'wvs_button_variation_attribute_preview'
|
149 |
-
);
|
150 |
-
|
151 |
-
$types = apply_filters( 'wvs_available_attributes_types', $types );
|
152 |
-
|
153 |
-
if ( $type ) {
|
154 |
-
return isset( $types[ $type ] ) ? $types[ $type ] : array();
|
155 |
-
}
|
156 |
-
|
157 |
-
return $types;
|
158 |
-
}
|
159 |
-
endif;
|
160 |
-
|
161 |
-
//-------------------------------------------------------------------------------
|
162 |
-
// Color Variation Preview
|
163 |
-
//-------------------------------------------------------------------------------
|
164 |
-
|
165 |
-
if ( ! function_exists( 'wvs_color_variation_attribute_preview' ) ):
|
166 |
-
function wvs_color_variation_attribute_preview( $term_id, $attribute, $fields ) {
|
167 |
-
|
168 |
-
$key = $fields[0]['id'];
|
169 |
-
$value = sanitize_hex_color( get_term_meta( $term_id, $key, true ) );
|
170 |
-
|
171 |
-
printf( '<div class="wvs-preview wvs-color-preview" style="background-color:%s;"></div>', esc_attr( $value ) );
|
172 |
-
}
|
173 |
-
endif;
|
174 |
-
|
175 |
-
//-------------------------------------------------------------------------------
|
176 |
-
// Image Variation Preview
|
177 |
-
//-------------------------------------------------------------------------------
|
178 |
-
|
179 |
-
if ( ! function_exists( 'wvs_image_variation_attribute_preview' ) ):
|
180 |
-
function wvs_image_variation_attribute_preview( $term_id, $attribute, $fields ) {
|
181 |
-
|
182 |
-
$key = $fields[0]['id'];
|
183 |
-
$attachment_id = absint( get_term_meta( $term_id, $key, true ) );
|
184 |
-
$image = wp_get_attachment_image_src( $attachment_id, 'thumbnail' );
|
185 |
-
if ( is_array( $image ) ) {
|
186 |
-
printf( '<img src="%s" alt="" width="%d" height="%d" class="wvs-preview wvs-image-preview" />', esc_url( $image[0] ), $image[1], $image[2] );
|
187 |
-
}
|
188 |
-
}
|
189 |
-
endif;
|
190 |
-
|
191 |
-
//-------------------------------------------------------------------------------
|
192 |
-
// Add attribute types on WooCommerce taxonomy
|
193 |
-
//-------------------------------------------------------------------------------
|
194 |
-
|
195 |
-
if ( ! function_exists( 'wvs_product_attributes_types' ) ):
|
196 |
-
function wvs_product_attributes_types( $selector ) {
|
197 |
-
|
198 |
-
foreach ( wvs_available_attributes_types() as $key => $options ) {
|
199 |
-
$selector[ $key ] = $options['title'];
|
200 |
-
}
|
201 |
-
|
202 |
-
return $selector;
|
203 |
-
}
|
204 |
-
endif;
|
205 |
-
|
206 |
-
//-------------------------------------------------------------------------------
|
207 |
-
// Tutorials Tab Contents
|
208 |
-
//-------------------------------------------------------------------------------
|
209 |
-
if ( ! function_exists( 'wvs_tutorial_tab_contents' ) ):
|
210 |
-
function wvs_tutorial_tab_contents() {
|
211 |
-
ob_start();
|
212 |
-
include_once woo_variation_swatches()->include_path( 'tutorials.php' );
|
213 |
-
|
214 |
-
return ob_get_clean();
|
215 |
-
}
|
216 |
-
endif;
|
217 |
-
|
218 |
-
//-------------------------------------------------------------------------------
|
219 |
-
// Enable Ajax Variation
|
220 |
-
//-------------------------------------------------------------------------------
|
221 |
-
|
222 |
-
if ( ! function_exists( 'wvs_ajax_variation_threshold' ) ):
|
223 |
-
function wvs_ajax_variation_threshold() {
|
224 |
-
return absint( woo_variation_swatches()->get_option( 'threshold' ) );
|
225 |
-
}
|
226 |
-
endif;
|
227 |
-
|
228 |
-
|
229 |
-
/*function wvs_get_available_product_variations() {
|
230 |
-
|
231 |
-
if ( is_ajax() && isset( $_POST['product_id'] ) ) {
|
232 |
-
$product_id = absint( $_POST['product_id'] );
|
233 |
-
$product = wc_get_product( $product_id );
|
234 |
-
|
235 |
-
if ( $product && $product->is_visible() && $product->is_type( 'variable' ) ) {
|
236 |
-
$available_variations = apply_filters( 'wvs_get_available_product_variations', $product->get_available_variations(), $product );
|
237 |
-
} else {
|
238 |
-
$available_variations = array();
|
239 |
-
}
|
240 |
-
|
241 |
-
wp_send_json_success( wp_json_encode( $available_variations ) );
|
242 |
-
} else {
|
243 |
-
wp_send_json_error();
|
244 |
-
}
|
245 |
-
}*/
|
246 |
-
|
247 |
-
|
248 |
-
// Tutorials TAB
|
249 |
-
|
250 |
-
add_action(
|
251 |
-
'after_wvs_settings', function ( $swatches ) {
|
252 |
-
$swatches->add_setting(
|
253 |
-
'tutorial', esc_html__( 'Tutorials', 'woo-variation-swatches' ), array(
|
254 |
-
array(
|
255 |
-
'pro' => true,
|
256 |
-
'title' => esc_html__( 'How to tutorials', 'woo-variation-swatches' ),
|
257 |
-
'desc' => esc_html__( 'How to setup and use this plugin', 'woo-variation-swatches' ),
|
258 |
-
'fields' => apply_filters(
|
259 |
-
'wvs_pro_large_catalog_setting_fields', array(
|
260 |
-
array(
|
261 |
-
'pro' => true,
|
262 |
-
'html' => wvs_tutorial_tab_contents(),
|
263 |
-
),
|
264 |
-
)
|
265 |
-
)
|
266 |
-
)
|
267 |
-
), apply_filters( 'wvs_tutorial_setting_default_active', false )
|
268 |
-
);
|
269 |
-
}, 50
|
270 |
-
);
|
271 |
-
|
272 |
-
//-------------------------------------------------------------------------------
|
273 |
-
// Add settings
|
274 |
-
// Add Theme Support:
|
275 |
-
// add_theme_support( 'woo-variation-swatches', array( 'tooltip' => FALSE, 'stylesheet' => FALSE, 'style'=>'rounded' ) );
|
276 |
-
//-------------------------------------------------------------------------------
|
277 |
-
|
278 |
-
if ( ! function_exists( 'wvs_settings' ) ):
|
279 |
-
function wvs_settings() {
|
280 |
-
|
281 |
-
do_action( 'before_wvs_settings', woo_variation_swatches() );
|
282 |
-
|
283 |
-
woo_variation_swatches()->add_setting(
|
284 |
-
'simple', esc_html__( 'Simple', 'woo-variation-swatches' ), apply_filters(
|
285 |
-
'wvs_simple_settings_section', array(
|
286 |
-
array(
|
287 |
-
'title' => esc_html__( 'Visual Section', 'woo-variation-swatches' ),
|
288 |
-
'desc' => esc_html__( 'Simple change some visual styles', 'woo-variation-swatches' ),
|
289 |
-
'fields' => apply_filters(
|
290 |
-
'wvs_simple_setting_fields', array(
|
291 |
-
array(
|
292 |
-
'id' => 'tooltip',
|
293 |
-
'type' => 'checkbox',
|
294 |
-
'title' => esc_html__( 'Enable Tooltip', 'woo-variation-swatches' ),
|
295 |
-
'desc' => esc_html__( 'Enable tooltip on each product attribute.', 'woo-variation-swatches' ),
|
296 |
-
'default' => true
|
297 |
-
),
|
298 |
-
array(
|
299 |
-
'id' => 'stylesheet',
|
300 |
-
'type' => 'checkbox',
|
301 |
-
'title' => esc_html__( 'Enable Stylesheet', 'woo-variation-swatches' ),
|
302 |
-
'desc' => esc_html__( 'Enable default stylesheet', 'woo-variation-swatches' ),
|
303 |
-
'default' => true
|
304 |
-
),
|
305 |
-
array(
|
306 |
-
'id' => 'style',
|
307 |
-
'type' => 'radio',
|
308 |
-
'title' => esc_html__( 'Shape style', 'woo-variation-swatches' ),
|
309 |
-
'desc' => esc_html__( 'Attribute Shape Style', 'woo-variation-swatches' ),
|
310 |
-
'options' => array(
|
311 |
-
'rounded' => esc_html__( 'Rounded Shape', 'woo-variation-swatches' ),
|
312 |
-
'squared' => esc_html__( 'Squared Shape', 'woo-variation-swatches' )
|
313 |
-
),
|
314 |
-
'default' => 'squared'
|
315 |
-
),
|
316 |
-
array(
|
317 |
-
'id' => 'default_to_button',
|
318 |
-
'type' => 'checkbox',
|
319 |
-
'title' => esc_html__( 'Auto Dropdowns to Button', 'woo-variation-swatches' ),
|
320 |
-
'desc' => esc_html__( 'Convert default dropdowns to button type', 'woo-variation-swatches' ),
|
321 |
-
'default' => true
|
322 |
-
),
|
323 |
-
)
|
324 |
-
)
|
325 |
-
)
|
326 |
-
)
|
327 |
-
), apply_filters( 'wvs_simple_setting_default_active', true )
|
328 |
-
);
|
329 |
-
|
330 |
-
woo_variation_swatches()->add_setting(
|
331 |
-
'advanced', esc_html__( 'Advanced', 'woo-variation-swatches' ), apply_filters(
|
332 |
-
'wvs_advanced_settings_section', array(
|
333 |
-
array(
|
334 |
-
'title' => esc_html__( 'Visual Section', 'woo-variation-swatches' ),
|
335 |
-
'desc' => esc_html__( 'Advanced change some visual styles', 'woo-variation-swatches' ),
|
336 |
-
'fields' => apply_filters(
|
337 |
-
'wvs_advanced_setting_fields', array(
|
338 |
-
array(
|
339 |
-
'id' => 'clear_on_reselect',
|
340 |
-
'type' => 'checkbox',
|
341 |
-
'title' => esc_html__( 'Clear on Reselect', 'woo-variation-swatches' ),
|
342 |
-
'desc' => esc_html__( 'Clear selected attribute on select again', 'woo-variation-swatches' ),
|
343 |
-
'default' => false
|
344 |
-
),
|
345 |
-
array(
|
346 |
-
'id' => 'threshold',
|
347 |
-
'type' => 'number',
|
348 |
-
'title' => esc_html__( 'Ajax variation threshold', 'woo-variation-swatches' ),
|
349 |
-
'desc' => __( 'Control the number of enable ajax variation threshold, If you set <code>1</code> all product variation will be load via ajax. Default value is <code>30</code>, <br><span style="color: red">Note: Disable ajax threshold doesn\'t follow attribute behaviour. It\'s recommended to keep this number between 30 - 40.</span>', 'woo-variation-swatches' ),
|
350 |
-
'default' => 30,
|
351 |
-
'min' => 1,
|
352 |
-
'max' => 80,
|
353 |
-
'require' => array( 'disable_threshold' => array( 'type' => 'empty' ) )
|
354 |
-
),
|
355 |
-
|
356 |
-
array(
|
357 |
-
'id' => 'show_variation_label',
|
358 |
-
'type' => 'checkbox',
|
359 |
-
'title' => esc_html__( 'Show selected attribute', 'woo-variation-swatches' ),
|
360 |
-
'desc' => esc_html__( 'Show selected attribute variation name beside the title', 'woo-variation-swatches' ),
|
361 |
-
'default' => true,
|
362 |
-
'is_new' => true
|
363 |
-
),
|
364 |
-
|
365 |
-
array(
|
366 |
-
'id' => 'variation_label_separator',
|
367 |
-
'type' => 'text',
|
368 |
-
'title' => esc_html__( 'Variation label separator', 'woo-variation-swatches' ),
|
369 |
-
'desc' => sprintf( __( 'Variation label separator. Default: %s.', 'woo-variation-swatches' ), '<code>:</code>' ),
|
370 |
-
'default' => ':',
|
371 |
-
'is_new' => true,
|
372 |
-
'require' => array( 'show_variation_label' => array( 'type' => '==', 'value' => '1' ) )
|
373 |
-
),
|
374 |
-
|
375 |
-
array(
|
376 |
-
'id' => 'attribute_behavior',
|
377 |
-
'type' => 'radio',
|
378 |
-
'title' => esc_html__( 'Attribute behavior', 'woo-variation-swatches' ),
|
379 |
-
'desc' => sprintf( __( 'Disabled attribute will be hide / blur. %sNote: Disable ajax threshold doesn\'t apply this feature.%s', 'woo-variation-swatches' ), '<br><span style="color: red">', '</span>' ),
|
380 |
-
'options' => array(
|
381 |
-
'blur' => esc_html__( 'Blur with cross', 'woo-variation-swatches' ),
|
382 |
-
'blur-no-cross' => esc_html__( 'Blur without cross', 'woo-variation-swatches' ),
|
383 |
-
'hide' => esc_html__( 'Hide', 'woo-variation-swatches' ),
|
384 |
-
),
|
385 |
-
'default' => 'blur'
|
386 |
-
),
|
387 |
-
|
388 |
-
array(
|
389 |
-
'id' => 'attribute_image_size',
|
390 |
-
'type' => 'select',
|
391 |
-
'title' => esc_html__( 'Attribute image size', 'woo-variation-swatches' ),
|
392 |
-
'desc' => has_filter( 'wvs_product_attribute_image_size' ) ? __( '<span style="color: red">Attribute image size changed by <code>wvs_product_attribute_image_size</code> hook. So this option will not apply any effect.</span>', 'woo-variation-swatches' ) : __( sprintf( 'Choose attribute image size. <a target="_blank" href="%s">Media Settings</a>', esc_url( admin_url( 'options-media.php' ) ) ), 'woo-variation-swatches' ),
|
393 |
-
'options' => wvs_get_all_image_sizes(),
|
394 |
-
'default' => 'thumbnail'
|
395 |
-
),
|
396 |
-
array(
|
397 |
-
'id' => 'width',
|
398 |
-
'type' => 'number',
|
399 |
-
'title' => esc_html__( 'Width', 'woo-variation-swatches' ),
|
400 |
-
'desc' => esc_html__( 'Variation item width', 'woo-variation-swatches' ),
|
401 |
-
'default' => 30,
|
402 |
-
'min' => 10,
|
403 |
-
'max' => 200,
|
404 |
-
'suffix' => 'px'
|
405 |
-
),
|
406 |
-
array(
|
407 |
-
'id' => 'height',
|
408 |
-
'type' => 'number',
|
409 |
-
'title' => esc_html__( 'Height', 'woo-variation-swatches' ),
|
410 |
-
'desc' => esc_html__( 'Variation item height', 'woo-variation-swatches' ),
|
411 |
-
'default' => 30,
|
412 |
-
'min' => 10,
|
413 |
-
'max' => 200,
|
414 |
-
'suffix' => 'px'
|
415 |
-
),
|
416 |
-
array(
|
417 |
-
'id' => 'single_font_size',
|
418 |
-
'type' => 'number',
|
419 |
-
'title' => esc_html__( 'Font Size', 'woo-variation-swatches' ),
|
420 |
-
'desc' => esc_html__( 'Single product variation item font size', 'woo-variation-swatches' ),
|
421 |
-
'default' => 16,
|
422 |
-
'min' => 8,
|
423 |
-
'max' => 24,
|
424 |
-
'suffix' => 'px'
|
425 |
-
)
|
426 |
-
)
|
427 |
-
)
|
428 |
-
)
|
429 |
-
)
|
430 |
-
), apply_filters( 'wvs_advanced_setting_default_active', false )
|
431 |
-
);
|
432 |
-
|
433 |
-
woo_variation_swatches()->add_setting(
|
434 |
-
'performance', esc_html__( 'Performance', 'woo-variation-swatches' ), apply_filters(
|
435 |
-
'wvs_performance_settings_section', array(
|
436 |
-
array(
|
437 |
-
'title' => esc_html__( 'Performance Section', 'woo-variation-swatches' ),
|
438 |
-
'desc' => esc_html__( 'Change for Performance', 'woo-variation-swatches' ),
|
439 |
-
'fields' => apply_filters(
|
440 |
-
'wvs_performance_setting_fields', array(
|
441 |
-
array(
|
442 |
-
'id' => 'defer_load_js',
|
443 |
-
'type' => 'checkbox',
|
444 |
-
'title' => esc_html__( 'Defer Load JS', 'woo-variation-swatches' ),
|
445 |
-
'desc' => esc_html__( 'Defer Load JS for PageSpeed Score. If you use any caching plugin or your server have HTTP2 support you do not have to use it', 'woo-variation-swatches' ),
|
446 |
-
'default' => false
|
447 |
-
),
|
448 |
-
array(
|
449 |
-
'id' => 'use_transient',
|
450 |
-
'type' => 'checkbox',
|
451 |
-
'title' => esc_html__( 'Use Transient Cache', 'woo-variation-swatches' ),
|
452 |
-
'desc' => esc_html__( 'Use Transient Cache for PageSpeed Score. If you use any caching plugin you do not have to use it', 'woo-variation-swatches' ),
|
453 |
-
'default' => false
|
454 |
-
)
|
455 |
-
)
|
456 |
-
)
|
457 |
-
)
|
458 |
-
)
|
459 |
-
), apply_filters( 'wvs_advanced_setting_default_active', false )
|
460 |
-
);
|
461 |
-
|
462 |
-
if ( ! woo_variation_swatches()->is_pro_active() ) {
|
463 |
-
woo_variation_swatches()->add_setting(
|
464 |
-
'style', esc_html__( 'Style', 'woo-variation-swatches' ), array(
|
465 |
-
array(
|
466 |
-
'pro' => true,
|
467 |
-
'title' => esc_html__( 'Visual Styling', 'woo-variation-swatches' ),
|
468 |
-
'desc' => esc_html__( 'Change some visual styles', 'woo-variation-swatches' ),
|
469 |
-
'fields' => apply_filters(
|
470 |
-
'wvs_pro_style_setting_fields', array(
|
471 |
-
array(
|
472 |
-
'pro' => true,
|
473 |
-
'width' => 'auto',
|
474 |
-
'screen_shot' => woo_variation_swatches()->wp_images_uri( 'red-style-preview.png' ),
|
475 |
-
'product_link' => woo_variation_swatches()->get_pro_link( 'style-tab' ),
|
476 |
-
),
|
477 |
-
)
|
478 |
-
)
|
479 |
-
)
|
480 |
-
), apply_filters( 'wvs_pro_style_setting_default_active', false ), true
|
481 |
-
);
|
482 |
-
}
|
483 |
-
|
484 |
-
if ( ! woo_variation_swatches()->is_pro_active() ) {
|
485 |
-
woo_variation_swatches()->add_setting(
|
486 |
-
'archive', esc_html__( 'Archive / Shop', 'woo-variation-swatches' ), array(
|
487 |
-
array(
|
488 |
-
'pro' => true,
|
489 |
-
'title' => esc_html__( 'Visual Section', 'woo-variation-swatches' ),
|
490 |
-
'desc' => esc_html__( 'Advanced change some visual styles on shop / archive page', 'woo-variation-swatches' ),
|
491 |
-
'fields' => apply_filters(
|
492 |
-
'wvs_pro_archive_setting_fields', array(
|
493 |
-
array(
|
494 |
-
'pro' => true,
|
495 |
-
'width' => 'auto',
|
496 |
-
'screen_shot' => woo_variation_swatches()->wp_images_uri( 'red-archive-preview.png' ),
|
497 |
-
'product_link' => woo_variation_swatches()->get_pro_link( 'archive-tab' ),
|
498 |
-
),
|
499 |
-
)
|
500 |
-
)
|
501 |
-
)
|
502 |
-
), apply_filters( 'wvs_pro_archive_setting_default_active', false ), true
|
503 |
-
);
|
504 |
-
}
|
505 |
-
|
506 |
-
if ( ! woo_variation_swatches()->is_pro_active() ) {
|
507 |
-
woo_variation_swatches()->add_setting(
|
508 |
-
'special', esc_html__( 'Special Attribute', 'woo-variation-swatches' ), array(
|
509 |
-
array(
|
510 |
-
'pro' => true,
|
511 |
-
'title' => esc_html__( 'Catalog mode', 'woo-variation-swatches' ),
|
512 |
-
'desc' => esc_html__( 'Show single attribute as catalog mode on shop / archive pages', 'woo-variation-swatches' ),
|
513 |
-
'fields' => apply_filters(
|
514 |
-
'wvs_pro_large_catalog_setting_fields', array(
|
515 |
-
array(
|
516 |
-
'pro' => true,
|
517 |
-
'width' => 'auto',
|
518 |
-
'screen_shot' => woo_variation_swatches()->wp_images_uri( 'red-special-preview.png' ),
|
519 |
-
'product_link' => woo_variation_swatches()->get_pro_link( 'special-tab' ),
|
520 |
-
),
|
521 |
-
)
|
522 |
-
)
|
523 |
-
)
|
524 |
-
), apply_filters( 'wvs_pro_special_setting_default_active', false ), true
|
525 |
-
);
|
526 |
-
}
|
527 |
-
|
528 |
-
do_action( 'after_wvs_settings', woo_variation_swatches() );
|
529 |
-
}
|
530 |
-
endif;
|
531 |
-
|
532 |
-
//-------------------------------------------------------------------------------
|
533 |
-
// WooCommerce taxonomy Meta Field Settings
|
534 |
-
//-------------------------------------------------------------------------------
|
535 |
-
|
536 |
-
if ( ! function_exists( 'wvs_taxonomy_meta_fields' ) ):
|
537 |
-
function wvs_taxonomy_meta_fields( $field_id = false ) {
|
538 |
-
|
539 |
-
$fields = array();
|
540 |
-
|
541 |
-
$fields['color'] = array(
|
542 |
-
array(
|
543 |
-
'label' => esc_html__( 'Color', 'woo-variation-swatches' ), // <label>
|
544 |
-
'desc' => esc_html__( 'Choose a color', 'woo-variation-swatches' ), // description
|
545 |
-
'id' => 'product_attribute_color', // name of field
|
546 |
-
'type' => 'color'
|
547 |
-
)
|
548 |
-
);
|
549 |
-
|
550 |
-
$fields['image'] = array(
|
551 |
-
array(
|
552 |
-
'label' => esc_html__( 'Image', 'woo-variation-swatches' ), // <label>
|
553 |
-
'desc' => esc_html__( 'Choose an Image', 'woo-variation-swatches' ), // description
|
554 |
-
'id' => 'product_attribute_image', // name of field
|
555 |
-
'type' => 'image'
|
556 |
-
)
|
557 |
-
);
|
558 |
-
|
559 |
-
$fields = apply_filters( 'wvs_product_taxonomy_meta_fields', $fields );
|
560 |
-
|
561 |
-
if ( $field_id ) {
|
562 |
-
return isset( $fields[ $field_id ] ) ? $fields[ $field_id ] : array();
|
563 |
-
}
|
564 |
-
|
565 |
-
return $fields;
|
566 |
-
|
567 |
-
}
|
568 |
-
endif;
|
569 |
-
|
570 |
-
//-------------------------------------------------------------------------------
|
571 |
-
// Is Color Attribute
|
572 |
-
//-------------------------------------------------------------------------------
|
573 |
-
|
574 |
-
if ( ! function_exists( 'wvs_is_color_attribute' ) ):
|
575 |
-
function wvs_is_color_attribute( $attribute ) {
|
576 |
-
if ( ! is_object( $attribute ) ) {
|
577 |
-
return false;
|
578 |
-
}
|
579 |
-
|
580 |
-
return $attribute->attribute_type == 'color';
|
581 |
-
}
|
582 |
-
endif;
|
583 |
-
|
584 |
-
//-------------------------------------------------------------------------------
|
585 |
-
// Is Image Attribute
|
586 |
-
//-------------------------------------------------------------------------------
|
587 |
-
|
588 |
-
if ( ! function_exists( 'wvs_is_image_attribute' ) ):
|
589 |
-
function wvs_is_image_attribute( $attribute ) {
|
590 |
-
if ( ! is_object( $attribute ) ) {
|
591 |
-
return false;
|
592 |
-
}
|
593 |
-
|
594 |
-
return $attribute->attribute_type == 'image';
|
595 |
-
}
|
596 |
-
endif;
|
597 |
-
|
598 |
-
//-------------------------------------------------------------------------------
|
599 |
-
// Is Button Attribute
|
600 |
-
//-------------------------------------------------------------------------------
|
601 |
-
|
602 |
-
if ( ! function_exists( 'wvs_is_button_attribute' ) ):
|
603 |
-
function wvs_is_button_attribute( $attribute ) {
|
604 |
-
if ( ! is_object( $attribute ) ) {
|
605 |
-
return false;
|
606 |
-
}
|
607 |
-
|
608 |
-
return $attribute->attribute_type == 'button';
|
609 |
-
}
|
610 |
-
endif;
|
611 |
-
|
612 |
-
//-------------------------------------------------------------------------------
|
613 |
-
// Is Radio Attribute
|
614 |
-
//-------------------------------------------------------------------------------
|
615 |
-
|
616 |
-
if ( ! function_exists( 'wvs_is_radio_attribute' ) ):
|
617 |
-
function wvs_is_radio_attribute( $attribute ) {
|
618 |
-
if ( ! is_object( $attribute ) ) {
|
619 |
-
return false;
|
620 |
-
}
|
621 |
-
|
622 |
-
return $attribute->attribute_type == 'radio';
|
623 |
-
}
|
624 |
-
endif;
|
625 |
-
|
626 |
-
//-------------------------------------------------------------------------------
|
627 |
-
// Is Select Attribute
|
628 |
-
//-------------------------------------------------------------------------------
|
629 |
-
|
630 |
-
if ( ! function_exists( 'wvs_is_select_attribute' ) ):
|
631 |
-
function wvs_is_select_attribute( $attribute ) {
|
632 |
-
if ( ! is_object( $attribute ) ) {
|
633 |
-
return false;
|
634 |
-
}
|
635 |
-
|
636 |
-
return $attribute->attribute_type == 'select';
|
637 |
-
}
|
638 |
-
endif;
|
639 |
-
|
640 |
-
//-------------------------------------------------------------------------------
|
641 |
-
// Get Color Attribute Value
|
642 |
-
//-------------------------------------------------------------------------------
|
643 |
-
|
644 |
-
if ( ! function_exists( 'wvs_get_product_attribute_color' ) ):
|
645 |
-
function wvs_get_product_attribute_color( $term ) {
|
646 |
-
if ( ! is_object( $term ) ) {
|
647 |
-
return false;
|
648 |
-
}
|
649 |
-
|
650 |
-
return get_term_meta( $term->term_id, 'product_attribute_color', true );
|
651 |
-
}
|
652 |
-
endif;
|
653 |
-
|
654 |
-
if ( ! function_exists( 'wvs_get_product_attribute_dual_color' ) ):
|
655 |
-
function wvs_get_product_attribute_dual_color( $term ) {
|
656 |
-
if ( ! is_object( $term ) ) {
|
657 |
-
return false;
|
658 |
-
}
|
659 |
-
|
660 |
-
$is_dual_color = wc_string_to_bool( get_term_meta( $term->term_id, 'is_dual_color', true ) );
|
661 |
-
$primary_color = sanitize_hex_color( get_term_meta( $term->term_id, 'product_attribute_color', true ) );
|
662 |
-
$secondary_color = sanitize_hex_color( get_term_meta( $term->term_id, 'secondary_color', true ) );
|
663 |
-
|
664 |
-
if ( $is_dual_color ) {
|
665 |
-
return array(
|
666 |
-
'primary_color' => $primary_color,
|
667 |
-
'secondary_color' => $secondary_color
|
668 |
-
);
|
669 |
-
}
|
670 |
-
|
671 |
-
return $primary_color;
|
672 |
-
}
|
673 |
-
endif;
|
674 |
-
|
675 |
-
//-------------------------------------------------------------------------------
|
676 |
-
// Get Image Attribute Value
|
677 |
-
//-------------------------------------------------------------------------------
|
678 |
-
|
679 |
-
if ( ! function_exists( 'wvs_get_product_attribute_image' ) ):
|
680 |
-
function wvs_get_product_attribute_image( $term ) {
|
681 |
-
if ( ! is_object( $term ) ) {
|
682 |
-
return false;
|
683 |
-
}
|
684 |
-
|
685 |
-
return get_term_meta( $term->term_id, 'product_attribute_image', true );
|
686 |
-
}
|
687 |
-
endif;
|
688 |
-
|
689 |
-
//-------------------------------------------------------------------------------
|
690 |
-
// Add WooCommerce taxonomy Meta
|
691 |
-
//-------------------------------------------------------------------------------
|
692 |
-
|
693 |
-
if ( ! function_exists( 'wvs_add_product_taxonomy_meta' ) ) {
|
694 |
-
function wvs_add_product_taxonomy_meta() {
|
695 |
-
|
696 |
-
$fields = wvs_taxonomy_meta_fields();
|
697 |
-
$meta_added_for = apply_filters( 'wvs_product_taxonomy_meta_for', array_keys( $fields ) );
|
698 |
-
|
699 |
-
if ( function_exists( 'wc_get_attribute_taxonomies' ) ):
|
700 |
-
|
701 |
-
$attribute_taxonomies = wc_get_attribute_taxonomies();
|
702 |
-
if ( $attribute_taxonomies ) :
|
703 |
-
foreach ( $attribute_taxonomies as $tax ) :
|
704 |
-
$product_attr = wc_attribute_taxonomy_name( $tax->attribute_name );
|
705 |
-
$product_attr_type = $tax->attribute_type;
|
706 |
-
if ( in_array( $product_attr_type, $meta_added_for ) ) :
|
707 |
-
woo_variation_swatches()->add_term_meta( $product_attr, 'product', $fields[ $product_attr_type ] );
|
708 |
-
|
709 |
-
do_action( 'wvs_wc_attribute_taxonomy_meta_added', $product_attr, $product_attr_type );
|
710 |
-
endif; // in_array( $product_attr_type, array( 'color', 'image' ) )
|
711 |
-
endforeach; // $attribute_taxonomies
|
712 |
-
endif; // $attribute_taxonomies
|
713 |
-
endif; // function_exists( 'wc_get_attribute_taxonomies' )
|
714 |
-
}
|
715 |
-
}
|
716 |
-
|
717 |
-
//-------------------------------------------------------------------------------
|
718 |
-
// Extra Product Option Terms
|
719 |
-
//-------------------------------------------------------------------------------
|
720 |
-
|
721 |
-
if ( ! function_exists( 'wvs_product_option_terms_old' ) ) :
|
722 |
-
function wvs_product_option_terms_old( $attribute_taxonomy, $i ) {
|
723 |
-
// $attribute_taxonomy, $i
|
724 |
-
// $tax, $i
|
725 |
-
global $post, $thepostid, $product_object;
|
726 |
-
if ( in_array( $attribute_taxonomy->attribute_type, array_keys( wvs_available_attributes_types() ) ) ) {
|
727 |
-
|
728 |
-
$taxonomy = wc_attribute_taxonomy_name( $attribute_taxonomy->attribute_name );
|
729 |
-
|
730 |
-
$product_id = $thepostid;
|
731 |
-
|
732 |
-
if ( is_null( $thepostid ) && isset( $_POST['post_id'] ) ) {
|
733 |
-
$product_id = absint( $_POST['post_id'] );
|
734 |
-
}
|
735 |
-
|
736 |
-
$args = array(
|
737 |
-
'orderby' => 'name',
|
738 |
-
'hide_empty' => 0,
|
739 |
-
);
|
740 |
-
|
741 |
-
?>
|
742 |
-
<select multiple="multiple" data-placeholder="<?php esc_attr_e( 'Select terms', 'woo-variation-swatches' ); ?>" class="multiselect attribute_values wc-enhanced-select" name="attribute_values[<?php echo esc_attr( $i ); ?>][]">
|
743 |
-
<?php
|
744 |
-
$all_terms = get_terms( $taxonomy, apply_filters( 'woocommerce_product_attribute_terms', $args ) );
|
745 |
-
if ( $all_terms ) :
|
746 |
-
foreach ( $all_terms as $term ) :
|
747 |
-
echo '<option value="' . esc_attr( $term->term_id ) . '" ' . selected( has_term( absint( $term->term_id ), $taxonomy, $product_id ), true, false ) . '>' . esc_attr( apply_filters( 'woocommerce_product_attribute_term_name', $term->name, $term ) ) . '</option>';
|
748 |
-
endforeach;
|
749 |
-
endif;
|
750 |
-
?>
|
751 |
-
</select>
|
752 |
-
<button class="button plus select_all_attributes"><?php esc_html_e( 'Select all', 'woo-variation-swatches' ); ?></button>
|
753 |
-
<button class="button minus select_no_attributes"><?php esc_html_e( 'Select none', 'woo-variation-swatches' ); ?></button>
|
754 |
-
|
755 |
-
<?php
|
756 |
-
$fields = wvs_taxonomy_meta_fields( $attribute_taxonomy->attribute_type );
|
757 |
-
|
758 |
-
if ( ! empty( $fields ) ): ?>
|
759 |
-
<button disabled="disabled" class="button fr plus wvs_add_new_attribute" data-dialog_title="<?php printf( esc_html__( 'Add new %s', 'woo-variation-swatches' ), esc_attr( $attribute_taxonomy->attribute_label ) ) ?>"><?php esc_html_e( 'Add new', 'woo-variation-swatches' ); ?></button>
|
760 |
-
<?php else: ?>
|
761 |
-
<button class="button fr plus add_new_attribute"><?php esc_html_e( 'Add new', 'woo-variation-swatches' ); ?></button>
|
762 |
-
<?php endif; ?>
|
763 |
-
<?php
|
764 |
-
}
|
765 |
-
}
|
766 |
-
endif;
|
767 |
-
|
768 |
-
//-------------------------------------------------------------------------------
|
769 |
-
// Dokan Support - OLD WC Style
|
770 |
-
//-------------------------------------------------------------------------------
|
771 |
-
if ( ! function_exists( 'dokan_support_wvs_product_option_terms' ) ) :
|
772 |
-
function dokan_support_wvs_product_option_terms( $attribute_taxonomy, $i ) {
|
773 |
-
// $attribute_taxonomy, $i
|
774 |
-
// $tax, $i
|
775 |
-
global $post, $thepostid, $product_object;
|
776 |
-
if ( in_array( $attribute_taxonomy->attribute_type, array_keys( wvs_available_attributes_types() ) ) ) {
|
777 |
-
|
778 |
-
$taxonomy = wc_attribute_taxonomy_name( $attribute_taxonomy->attribute_name );
|
779 |
-
|
780 |
-
$product_id = $thepostid;
|
781 |
-
|
782 |
-
if ( is_null( $thepostid ) && isset( $_POST['post_id'] ) ) {
|
783 |
-
$product_id = absint( $_POST['post_id'] );
|
784 |
-
}
|
785 |
-
|
786 |
-
$args = array(
|
787 |
-
'orderby' => 'name',
|
788 |
-
'hide_empty' => 0,
|
789 |
-
);
|
790 |
-
|
791 |
-
?>
|
792 |
-
<select multiple="multiple" style="width:100%" data-placeholder="<?php esc_attr_e( 'Select terms', 'woo-variation-swatches' ); ?>" class="dokan_attribute_values dokan-select2" name="attribute_values[<?php echo esc_attr( $i ); ?>][]">
|
793 |
-
<?php
|
794 |
-
$all_terms = get_terms( $taxonomy, apply_filters( 'dokan_product_attribute_terms', $args ) );
|
795 |
-
if ( $all_terms ) :
|
796 |
-
foreach ( $all_terms as $term ) :
|
797 |
-
echo '<option value="' . esc_attr( $term->slug ) . '" ' . selected( has_term( absint( $term->term_id ), $taxonomy, $product_id ), true, false ) . '>' . esc_attr( apply_filters( 'woocommerce_product_attribute_term_name', $term->name, $term ) ) . '</option>';
|
798 |
-
endforeach;
|
799 |
-
endif;
|
800 |
-
?>
|
801 |
-
</select>
|
802 |
-
|
803 |
-
<div class="dokan-pre-defined-attribute-btn-group">
|
804 |
-
<button class="dokan-btn dokan-btn-default plus dokan-select-all-attributes"><?php esc_html_e( 'Select all', 'woo-variation-swatches' ); ?></button>
|
805 |
-
<button class="dokan-btn dokan-btn-default minus dokan-select-no-attributes"><?php esc_html_e( 'Select none', 'woo-variation-swatches' ); ?></button>
|
806 |
-
</div>
|
807 |
-
<?php
|
808 |
-
}
|
809 |
-
}
|
810 |
-
endif;
|
811 |
-
|
812 |
-
//-------------------------------------------------------------------------------
|
813 |
-
// Extra Product Option Terms for WC 3.6+
|
814 |
-
//-------------------------------------------------------------------------------
|
815 |
-
|
816 |
-
if ( ! function_exists( 'wvs_product_option_terms' ) ) :
|
817 |
-
function wvs_product_option_terms( $attribute_taxonomy, $i, $attribute ) {
|
818 |
-
if ( in_array( $attribute_taxonomy->attribute_type, array_keys( wvs_available_attributes_types() ) ) ) {
|
819 |
-
|
820 |
-
?>
|
821 |
-
<select multiple="multiple" data-placeholder="<?php esc_attr_e( 'Select terms', 'woo-variation-swatches' ); ?>" class="multiselect attribute_values wc-enhanced-select" name="attribute_values[<?php echo esc_attr( $i ); ?>][]">
|
822 |
-
<?php
|
823 |
-
$args = array(
|
824 |
-
'orderby' => 'name',
|
825 |
-
'hide_empty' => 0,
|
826 |
-
);
|
827 |
-
$all_terms = get_terms( $attribute->get_taxonomy(), apply_filters( 'woocommerce_product_attribute_terms', $args ) );
|
828 |
-
if ( $all_terms ) {
|
829 |
-
foreach ( $all_terms as $term ) {
|
830 |
-
$options = $attribute->get_options();
|
831 |
-
$options = ! empty( $options ) ? $options : array();
|
832 |
-
echo '<option value="' . esc_attr( $term->term_id ) . '"' . wc_selected( $term->term_id, $options ) . '>' . esc_attr( apply_filters( 'woocommerce_product_attribute_term_name', $term->name, $term ) ) . '</option>';
|
833 |
-
}
|
834 |
-
}
|
835 |
-
?>
|
836 |
-
</select>
|
837 |
-
<button class="button plus select_all_attributes"><?php esc_html_e( 'Select all', 'woo-variation-swatches' ); ?></button>
|
838 |
-
<button class="button minus select_no_attributes"><?php esc_html_e( 'Select none', 'woo-variation-swatches' ); ?></button>
|
839 |
-
|
840 |
-
<?php
|
841 |
-
$fields = wvs_taxonomy_meta_fields( $attribute_taxonomy->attribute_type );
|
842 |
-
|
843 |
-
if ( ! empty( $fields ) ): ?>
|
844 |
-
<button disabled="disabled" class="button fr plus wvs_add_new_attribute" data-dialog_title="<?php printf( esc_html__( 'Add new %s', 'woo-variation-swatches' ), esc_attr( $attribute_taxonomy->attribute_label ) ) ?>"><?php esc_html_e( 'Add new', 'woo-variation-swatches' ); ?></button>
|
845 |
-
<?php else: ?>
|
846 |
-
<button class="button fr plus add_new_attribute"><?php esc_html_e( 'Add new', 'woo-variation-swatches' ); ?></button>
|
847 |
-
<?php endif; ?>
|
848 |
-
<?php
|
849 |
-
}
|
850 |
-
}
|
851 |
-
endif;
|
852 |
-
|
853 |
-
//-------------------------------------------------------------------------------
|
854 |
-
// Get a Attribute taxonomy values
|
855 |
-
//-------------------------------------------------------------------------------
|
856 |
-
|
857 |
-
// @TODO: See wc_attribute_taxonomy_id_by_name function and wc_get_attribute or wc_get_attribute_taxonomies
|
858 |
-
|
859 |
-
if ( ! function_exists( 'wvs_get_wc_attribute_taxonomy' ) ):
|
860 |
-
function wvs_get_wc_attribute_taxonomy( $attribute_name ) {
|
861 |
-
|
862 |
-
$transient_name = sprintf( 'wvs_attribute_taxonomy_%s', $attribute_name );
|
863 |
-
|
864 |
-
$cache = new Woo_Variation_Swatches_Cache( $transient_name, 'wvs_attribute_taxonomy' );
|
865 |
-
|
866 |
-
if ( isset( $_GET['wvs_clear_transient'] ) ) {
|
867 |
-
$cache->delete_transient();
|
868 |
-
}
|
869 |
-
|
870 |
-
if ( false === ( $attribute_taxonomy = $cache->get_transient() ) ) {
|
871 |
-
|
872 |
-
global $wpdb;
|
873 |
-
|
874 |
-
$attribute_name = str_replace( 'pa_', '', wc_sanitize_taxonomy_name( $attribute_name ) );
|
875 |
-
|
876 |
-
$attribute_taxonomy = $wpdb->get_row( "SELECT * FROM " . $wpdb->prefix . "woocommerce_attribute_taxonomies WHERE attribute_name='{$attribute_name}'" );
|
877 |
-
|
878 |
-
$cache->set_transient( $attribute_taxonomy );
|
879 |
-
}
|
880 |
-
|
881 |
-
return apply_filters( 'wvs_get_wc_attribute_taxonomy', $attribute_taxonomy, $attribute_name );
|
882 |
-
}
|
883 |
-
endif;
|
884 |
-
|
885 |
-
//-------------------------------------------------------------------------------
|
886 |
-
// Check has attribute type like color or image etc.
|
887 |
-
//-------------------------------------------------------------------------------
|
888 |
-
if ( ! function_exists( 'wvs_wc_product_has_attribute_type' ) ):
|
889 |
-
function wvs_wc_product_has_attribute_type( $type, $attribute_name ) {
|
890 |
-
|
891 |
-
$attributes = wc_get_attribute_taxonomies();
|
892 |
-
$attribute_name_clean = str_replace( 'pa_', '', wc_sanitize_taxonomy_name( $attribute_name ) );
|
893 |
-
|
894 |
-
// Created Attribute
|
895 |
-
if ( 'pa_' === substr( $attribute_name, 0, 3 ) ) {
|
896 |
-
|
897 |
-
$attribute = array_values(
|
898 |
-
array_filter(
|
899 |
-
$attributes, function ( $attribute ) use ( $type, $attribute_name_clean ) {
|
900 |
-
return $attribute_name_clean === $attribute->attribute_name;
|
901 |
-
}
|
902 |
-
)
|
903 |
-
);
|
904 |
-
|
905 |
-
if ( ! empty( $attribute ) ) {
|
906 |
-
$attribute = apply_filters( 'wvs_get_wc_attribute_taxonomy', $attribute[0], $attribute_name );
|
907 |
-
} else {
|
908 |
-
$attribute = wvs_get_wc_attribute_taxonomy( $attribute_name );
|
909 |
-
}
|
910 |
-
|
911 |
-
return apply_filters( 'wvs_wc_product_has_attribute_type', ( isset( $attribute->attribute_type ) && ( $attribute->attribute_type == $type ) ), $type, $attribute_name, $attribute );
|
912 |
-
} else {
|
913 |
-
return apply_filters( 'wvs_wc_product_has_attribute_type', false, $type, $attribute_name, null );
|
914 |
-
}
|
915 |
-
}
|
916 |
-
endif;
|
917 |
-
|
918 |
-
//-------------------------------------------------------------------------------
|
919 |
-
// Variation attribute options wrapper
|
920 |
-
//-------------------------------------------------------------------------------
|
921 |
-
if ( ! function_exists( 'wvs_variable_items_wrapper' ) ):
|
922 |
-
function wvs_variable_items_wrapper( $contents, $type, $args, $saved_attribute = array() ) {
|
923 |
-
|
924 |
-
$attribute = $args['attribute'];
|
925 |
-
$options = $args['options'];
|
926 |
-
|
927 |
-
$css_classes = apply_filters( 'wvs_variable_items_wrapper_class', array( "{$type}-variable-wrapper" ), $type, $args, $saved_attribute );
|
928 |
-
|
929 |
-
$clear_on_reselect = woo_variation_swatches()->get_option( 'clear_on_reselect' ) ? 'reselect-clear' : '';
|
930 |
-
|
931 |
-
array_push( $css_classes, $clear_on_reselect );
|
932 |
-
|
933 |
-
// <div aria-live="polite" aria-atomic="true" class="screen-reader-text">%1$s: <span data-default=""></span></div>
|
934 |
-
$data = sprintf( '<ul role="radiogroup" aria-label="%1$s" class="variable-items-wrapper %2$s" data-attribute_name="%3$s" data-attribute_values="%4$s">%5$s</ul>', esc_attr( wc_attribute_label( $attribute ) ), trim( implode( ' ', array_unique( $css_classes ) ) ), esc_attr( wc_variation_attribute_name( $attribute ) ), wc_esc_json( wp_json_encode( array_values( $options ) ) ), $contents );
|
935 |
-
|
936 |
-
return apply_filters( 'wvs_variable_items_wrapper', $data, $contents, $type, $args, $saved_attribute );
|
937 |
-
}
|
938 |
-
endif;
|
939 |
-
|
940 |
-
//-------------------------------------------------------------------------------
|
941 |
-
// Variation variable item
|
942 |
-
//-------------------------------------------------------------------------------
|
943 |
-
if ( ! function_exists( 'wvs_variable_item' ) ):
|
944 |
-
function wvs_variable_item( $type, $options, $args, $saved_attribute = array() ) {
|
945 |
-
|
946 |
-
$product = $args['product'];
|
947 |
-
$attribute = $args['attribute'];
|
948 |
-
$data = '';
|
949 |
-
|
950 |
-
if ( ! empty( $options ) ) {
|
951 |
-
if ( $product && taxonomy_exists( $attribute ) ) {
|
952 |
-
$terms = wc_get_product_terms( $product->get_id(), $attribute, array( 'fields' => 'all' ) );
|
953 |
-
$name = uniqid( wc_variation_attribute_name( $attribute ) );
|
954 |
-
foreach ( $terms as $term ) {
|
955 |
-
if ( in_array( $term->slug, $options, true ) ) {
|
956 |
-
|
957 |
-
// aria-checked="false"
|
958 |
-
$option = esc_html( apply_filters( 'woocommerce_variation_option_name', $term->name, $term, $attribute, $product ) );
|
959 |
-
|
960 |
-
$is_selected = ( sanitize_title( $args['selected'] ) == $term->slug );
|
961 |
-
$selected_class = $is_selected ? 'selected' : '';
|
962 |
-
$tooltip = trim( apply_filters( 'wvs_variable_item_tooltip', $option, $term, $args ) );
|
963 |
-
|
964 |
-
$tooltip_html_attr = ! empty( $tooltip ) ? sprintf( ' data-wvstooltip="%s"', esc_attr( $tooltip ) ) : '';
|
965 |
-
$screen_reader_html_attr = $is_selected ? ' aria-checked="true"' : ' aria-checked="false"';
|
966 |
-
|
967 |
-
if ( wp_is_mobile() ) {
|
968 |
-
$tooltip_html_attr .= ! empty( $tooltip ) ? ' tabindex="2"' : '';
|
969 |
-
}
|
970 |
-
|
971 |
-
$data .= sprintf( '<li %1$s class="variable-item %2$s-variable-item %2$s-variable-item-%3$s %4$s" title="%5$s" data-title="%5$s" data-value="%3$s" role="radio" tabindex="0"><div class="variable-item-contents">', $screen_reader_html_attr . $tooltip_html_attr, esc_attr( $type ), esc_attr( $term->slug ), esc_attr( $selected_class ), $option );
|
972 |
-
|
973 |
-
switch ( $type ):
|
974 |
-
case 'color':
|
975 |
-
|
976 |
-
$color = sanitize_hex_color( wvs_get_product_attribute_color( $term ) );
|
977 |
-
$data .= sprintf( '<span class="variable-item-span variable-item-span-%s" style="background-color:%s;"></span>', esc_attr( $type ), esc_attr( $color ) );
|
978 |
-
break;
|
979 |
-
|
980 |
-
case 'image':
|
981 |
-
|
982 |
-
$attachment_id = apply_filters( 'wvs_product_global_attribute_image_id', absint( wvs_get_product_attribute_image( $term ) ), $term, $args );
|
983 |
-
$image_size = woo_variation_swatches()->get_option( 'attribute_image_size' );
|
984 |
-
$image = wp_get_attachment_image_src( $attachment_id, apply_filters( 'wvs_product_attribute_image_size', $image_size, $attribute, $product ) );
|
985 |
-
|
986 |
-
$data .= sprintf( '<img class="variable-item-image" aria-hidden="true" alt="%s" src="%s" width="%d" height="%d" />', esc_attr( $option ), esc_url( $image[0] ), esc_attr( $image[1] ), esc_attr( $image[2] ) );
|
987 |
-
|
988 |
-
break;
|
989 |
-
|
990 |
-
|
991 |
-
case 'button':
|
992 |
-
$data .= sprintf( '<span class="variable-item-span variable-item-span-%s">%s</span>', esc_attr( $type ), $option );
|
993 |
-
break;
|
994 |
-
|
995 |
-
case 'radio':
|
996 |
-
$id = uniqid( $term->slug );
|
997 |
-
$data .= sprintf( '<input name="%1$s" id="%2$s" class="wvs-radio-variable-item" %3$s type="radio" value="%4$s" data-title="%5$s" data-value="%4$s" /><label for="%2$s">%5$s</label>', $name, $id, checked( sanitize_title( $args['selected'] ), $term->slug, false ), esc_attr( $term->slug ), $option );
|
998 |
-
break;
|
999 |
-
|
1000 |
-
default:
|
1001 |
-
$data .= apply_filters( 'wvs_variable_default_item_content', '', $term, $args, $saved_attribute );
|
1002 |
-
break;
|
1003 |
-
endswitch;
|
1004 |
-
$data .= '</div></li>';
|
1005 |
-
}
|
1006 |
-
}
|
1007 |
-
}
|
1008 |
-
}
|
1009 |
-
|
1010 |
-
return apply_filters( 'wvs_variable_item', $data, $type, $options, $args, $saved_attribute );
|
1011 |
-
}
|
1012 |
-
endif;
|
1013 |
-
|
1014 |
-
if ( ! function_exists( 'wvs_default_variable_item' ) ):
|
1015 |
-
function wvs_default_variable_item( $type, $options, $args, $saved_attribute = array() ) {
|
1016 |
-
|
1017 |
-
$product = $args['product'];
|
1018 |
-
$attribute = $args['attribute'];
|
1019 |
-
$assigned = $args['assigned'];
|
1020 |
-
|
1021 |
-
/*$product_variations = new WC_Product_Variable( $product->get_id() );
|
1022 |
-
$product_variations = $product_variations->get_available_variations();
|
1023 |
-
print_r($product_variations); die;*/
|
1024 |
-
|
1025 |
-
$is_archive = ( isset( $args['is_archive'] ) && $args['is_archive'] );
|
1026 |
-
$show_archive_tooltip = wc_string_to_bool( woo_variation_swatches()->get_option( 'show_tooltip_on_archive' ) );
|
1027 |
-
|
1028 |
-
$data = '';
|
1029 |
-
|
1030 |
-
if ( isset( $args['fallback_type'] ) && $args['fallback_type'] === 'select' ) {
|
1031 |
-
// return '';
|
1032 |
-
}
|
1033 |
-
|
1034 |
-
if ( ! empty( $options ) ) {
|
1035 |
-
if ( $product && taxonomy_exists( $attribute ) ) {
|
1036 |
-
$terms = wc_get_product_terms( $product->get_id(), $attribute, array( 'fields' => 'all' ) );
|
1037 |
-
$name = uniqid( wc_variation_attribute_name( $attribute ) );
|
1038 |
-
foreach ( $terms as $term ) {
|
1039 |
-
if ( in_array( $term->slug, $options, true ) ) {
|
1040 |
-
|
1041 |
-
$option = esc_html( apply_filters( 'woocommerce_variation_option_name', $term->name, $term, $attribute, $product ) );
|
1042 |
-
|
1043 |
-
$is_selected = ( sanitize_title( $args['selected'] ) == $term->slug );
|
1044 |
-
|
1045 |
-
$selected_class = $is_selected ? 'selected' : '';
|
1046 |
-
$tooltip = trim( apply_filters( 'wvs_variable_item_tooltip', $option, $term, $args ) );
|
1047 |
-
|
1048 |
-
if ( $is_archive && ! $show_archive_tooltip ) {
|
1049 |
-
$tooltip = false;
|
1050 |
-
}
|
1051 |
-
|
1052 |
-
$tooltip_html_attr = ! empty( $tooltip ) ? sprintf( ' data-wvstooltip="%s"', esc_attr( $tooltip ) ) : '';
|
1053 |
-
$screen_reader_html_attr = $is_selected ? ' aria-checked="true"' : ' aria-checked="false"';
|
1054 |
-
|
1055 |
-
|
1056 |
-
if ( wp_is_mobile() ) {
|
1057 |
-
$tooltip_html_attr .= ! empty( $tooltip ) ? ' tabindex="2"' : '';
|
1058 |
-
}
|
1059 |
-
|
1060 |
-
$type = isset( $assigned[ $term->slug ] ) ? $assigned[ $term->slug ]['type'] : $type;
|
1061 |
-
|
1062 |
-
if ( ! isset( $assigned[ $term->slug ] ) || empty( $assigned[ $term->slug ]['image_id'] ) ) {
|
1063 |
-
$type = 'button';
|
1064 |
-
}
|
1065 |
-
|
1066 |
-
$data .= sprintf( '<li %1$s class="variable-item %2$s-variable-item %2$s-variable-item-%3$s %4$s" title="%5$s" data-title="%5$s" data-value="%3$s" role="radio" tabindex="0"><div class="variable-item-contents">', $screen_reader_html_attr . $tooltip_html_attr, esc_attr( $type ), esc_attr( $term->slug ), esc_attr( $selected_class ), $option );
|
1067 |
-
|
1068 |
-
switch ( $type ):
|
1069 |
-
|
1070 |
-
case 'image':
|
1071 |
-
$attachment_id = $assigned[ $term->slug ]['image_id'];
|
1072 |
-
$image_size = sanitize_text_field( woo_variation_swatches()->get_option( 'attribute_image_size' ) );
|
1073 |
-
$image = wp_get_attachment_image_src( $attachment_id, apply_filters( 'wvs_product_attribute_image_size', $image_size, $attribute, $product ) );
|
1074 |
-
|
1075 |
-
$data .= sprintf( '<img class="variable-item-image" aria-hidden="true" alt="%s" src="%s" width="%d" height="%d" />', esc_attr( $option ), esc_url( $image[0] ), esc_attr( $image[1] ), esc_attr( $image[2] ) );
|
1076 |
-
// $data .= $image_html;
|
1077 |
-
break;
|
1078 |
-
|
1079 |
-
|
1080 |
-
case 'button':
|
1081 |
-
$data .= sprintf( '<span class="variable-item-span variable-item-span-%s">%s</span>', esc_attr( $type ), $option );
|
1082 |
-
break;
|
1083 |
-
|
1084 |
-
default:
|
1085 |
-
$data
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|