SiteOrigin Widgets Bundle - Version 1.5

Version Description

  • October 5 2015 =
  • Fixed: Conflict between WPML and repeaters.
  • Added Simple Masonry Layout widget.
  • Added Contact Form widget.
  • Added Image Grid widget.
  • Added Testimonial widget.
  • Changed layout of widgets activation page.
  • Added Trianglify to generate placeholder widget icons.
  • Added mechanism to use state emitters in repeaters.
  • Section expanded/collapsed states now stored across form loads.
  • Display once off admin notice when new widgets are available.
  • Fixed translation domain.
  • Editor Widget: Allow more HTML in Editor widget for trusted users.
  • Hero Image Widget: Added top padding setting.
  • Hero Image Widget: Can now set background click URL.
  • Hero Image Widget: Improved handling of buttons shortcode.
  • Slider Widget : Fixed open in new window setting.
  • Headline Widget: Added word-break CSS.
  • Headline Widget: Added option to set type of heading tags used.
Download this release

Release Info

Developer gpriday
Plugin Icon 128x128 SiteOrigin Widgets Bundle
Version 1.5
Comparing to
See all releases

Code changes from version 1.4.4 to 1.5

Files changed (82) hide show
  1. admin/admin.css +70 -176
  2. admin/admin.js +73 -21
  3. admin/admin.min.js +1 -1
  4. admin/tpl/admin.php +34 -17
  5. admin/trianglify.js +3445 -0
  6. admin/trianglify.min.js +2 -0
  7. base/inc.php +2 -4
  8. base/inc/fields/base.class.php +5 -5
  9. base/inc/fields/checkbox.class.php +1 -1
  10. base/inc/fields/container-base.class.php +23 -5
  11. base/inc/fields/error.class.php +26 -0
  12. base/inc/fields/factory.class.php +11 -1
  13. base/inc/fields/media.class.php +3 -3
  14. base/inc/fields/number.class.php +1 -1
  15. base/inc/fields/repeater.class.php +6 -2
  16. base/inc/fields/section.class.php +11 -3
  17. base/inc/fields/widget.class.php +3 -3
  18. base/inc/meta-box-manager.php +2 -2
  19. base/inc/post-selector.php +29 -29
  20. base/inc/widget-manager.class.php +17 -8
  21. base/inc/widgets/base-slider.class.php +27 -20
  22. base/js/admin.js +215 -166
  23. base/js/admin.min.js +1 -1
  24. base/siteorigin-widget.class.php +14 -6
  25. icons/icons.php +5 -5
  26. js/slider/jquery.slider.js +10 -1
  27. js/slider/jquery.slider.min.js +1 -1
  28. readme.txt +21 -1
  29. so-widgets-bundle.php +112 -18
  30. widgets/so-button-widget/assets/banner.svg +30 -31
  31. widgets/so-button-widget/so-button-widget.php +50 -50
  32. widgets/so-contact-widget/assets/banner.svg +43 -0
  33. widgets/so-contact-widget/so-contact-widget.php +757 -0
  34. widgets/so-contact-widget/styles/default.less +126 -0
  35. widgets/so-contact-widget/tpl/default.php +44 -0
  36. widgets/so-cta-widget/assets/banner.svg +33 -31
  37. widgets/so-cta-widget/so-cta-widget.php +19 -19
  38. widgets/so-editor-widget/assets/banner.svg +8 -8
  39. widgets/so-editor-widget/so-editor-widget.php +15 -8
  40. widgets/so-features-widget/assets/banner.svg +56 -57
  41. widgets/so-features-widget/so-features-widget.php +26 -26
  42. widgets/so-google-map-widget/assets/banner.svg +44 -43
  43. widgets/so-google-map-widget/so-google-map-widget.php +99 -99
  44. widgets/so-headline-widget/assets/banner.svg +38 -38
  45. widgets/so-headline-widget/so-headline-widget.php +73 -39
  46. widgets/so-headline-widget/styles/sow-headline.less +6 -2
  47. widgets/so-headline-widget/tpl/headline.php +2 -2
  48. widgets/so-hero-widget/assets/banner.svg +40 -44
  49. widgets/so-hero-widget/so-hero-widget.php +52 -32
  50. widgets/so-hero-widget/styles/default.less +2 -1
  51. widgets/so-image-grid-widget/css/image-grid.css +11 -0
  52. widgets/so-image-grid-widget/js/image-grid.js +45 -0
  53. widgets/so-image-grid-widget/js/image-grid.min.js +1 -0
  54. widgets/so-image-grid-widget/so-image-grid-widget.php +136 -0
  55. widgets/so-image-grid-widget/styles/default.less +11 -0
  56. widgets/so-image-grid-widget/tpl/default.php +16 -0
  57. widgets/so-image-widget/assets/banner.svg +36 -36
  58. widgets/so-image-widget/so-image-widget.php +20 -20
  59. widgets/so-post-carousel-widget/assets/banner.svg +44 -44
  60. widgets/so-post-carousel-widget/so-post-carousel-widget.php +10 -10
  61. widgets/so-price-table-widget/assets/banner.svg +36 -42
  62. widgets/so-price-table-widget/so-price-table-widget.php +31 -32
  63. widgets/so-simple-masonry-widget/js/packery.pkgd.js +4089 -0
  64. widgets/so-simple-masonry-widget/js/packery.pkgd.min.js +3 -0
  65. widgets/so-simple-masonry-widget/js/simple-masonry.js +65 -0
  66. widgets/so-simple-masonry-widget/js/simple-masonry.min.js +1 -0
  67. widgets/so-simple-masonry-widget/so-simple-masonry-widget.php +219 -0
  68. widgets/so-simple-masonry-widget/styles/simple-masonry.less +9 -0
  69. widgets/so-simple-masonry-widget/tpl/simple-masonry.php +27 -0
  70. widgets/so-slider-widget/assets/banner.svg +40 -44
  71. widgets/so-slider-widget/so-slider-widget.php +20 -20
  72. widgets/so-social-media-buttons-widget/assets/banner.svg +39 -39
  73. widgets/so-social-media-buttons-widget/data/networks.php +43 -43
  74. widgets/so-social-media-buttons-widget/so-social-media-buttons-widget.php +44 -44
  75. widgets/so-testimonial-widget/assets/banner.svg +41 -0
  76. widgets/so-testimonial-widget/css/style.css +56 -0
  77. widgets/so-testimonial-widget/so-testimonial-widget.php +332 -0
  78. widgets/so-testimonial-widget/styles/default.less +125 -0
  79. widgets/so-testimonial-widget/svg/svgdefs.svg +20 -0
  80. widgets/so-testimonial-widget/tpl/default.php +39 -0
  81. widgets/so-video-widget/assets/banner.svg +36 -34
  82. widgets/so-video-widget/so-video-widget.php +20 -21
admin/admin.css CHANGED
@@ -145,226 +145,120 @@
145
  -webkit-box-sizing: border-box;
146
  box-sizing: border-box;
147
  padding: 0 12px 24px 12px;
148
- width: 20%;
149
  }
150
  @media screen and (max-width: 1800px) {
151
  #sow-widgets-page #widgets-list .so-widget-wrap {
152
- width: 25%;
153
  }
154
  }
155
  @media screen and (max-width: 1280px) {
156
  #sow-widgets-page #widgets-list .so-widget-wrap {
157
- width: 33.33%;
158
  }
159
  }
160
- @media screen and (max-width: 800px) {
161
  #sow-widgets-page #widgets-list .so-widget-wrap {
162
- width: 50%;
163
  }
164
  }
165
  #sow-widgets-page #widgets-list .so-widget {
 
166
  float: left;
167
  -webkit-box-shadow: 0 1px 2px rgba(0,0,0,0.05);
168
  -moz-box-shadow: 0 1px 2px rgba(0,0,0,0.05);
169
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
170
  padding: 0;
171
  width: 100%;
172
- background: #F2F2F2;
173
- border: 1px solid #D9D9D9;
174
  position: relative;
175
  overflow: hidden;
176
- /* The Switch - © 2013 Thibaut Courouble - MIT License */
177
  }
178
- #sow-widgets-page #widgets-list .so-widget .so-widgets-active-banner {
179
- position: absolute;
180
- background: #555555;
181
- background: rgba(0, 0, 0, 0.75);
182
- padding: 12px;
183
- text-align: center;
184
- top: 0px;
185
- left: 0px;
186
- width: 100%;
187
- font-weight: bold;
188
- font-size: 13px;
189
- line-height: 1em;
190
- color: #FFFFFF;
191
  }
192
- #sow-widgets-page #widgets-list .so-widget img {
193
- display: block;
194
- width: 100%;
195
- height: auto;
196
- background: #FFFFFF;
197
- border-bottom: 1px solid #D9D9D9;
198
  }
199
  #sow-widgets-page #widgets-list .so-widget .so-widget-text {
200
- padding: 20px;
 
201
  }
202
- #sow-widgets-page #widgets-list .so-widget .so-widget-text h4 {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
203
  margin-top: 0;
204
- color: #777777;
205
- font-weight: bold;
206
- font-size: 1.2em;
207
  }
208
- #sow-widgets-page #widgets-list .so-widget .so-widget-text p.so-widget-description {
209
- margin-bottom: 0;
210
  line-height: 1.35em;
211
  color: #777777;
212
- min-height: 2.7em;
213
- }
214
- #sow-widgets-page #widgets-list .so-widget img,
215
- #sow-widgets-page #widgets-list .so-widget,
216
- #sow-widgets-page #widgets-list .so-widget .so-widget-text,
217
- #sow-widgets-page #widgets-list .so-widget .so-widget-text h4,
218
- #sow-widgets-page #widgets-list .so-widget .so-widget-text p {
219
- -webkit-transition: all 0.5s ease;
220
- -moz-transition: all 0.5s ease;
221
- -o-transition: all 0.5s ease;
222
- transition: all 0.5s ease;
223
- min-height: 1em;
224
- }
225
- #sow-widgets-page #widgets-list .so-widget .switch {
226
- float: right;
227
- position: relative;
228
- display: inline-block;
229
- vertical-align: top;
230
- width: 56px;
231
- height: 20px;
232
- padding: 3px;
233
- background-color: #ffffff;
234
- border-radius: 18px;
235
- box-shadow: inset 0 -1px #ffffff, inset 0 1px 1px rgba(0, 0, 0, 0.05);
236
- cursor: pointer;
237
- margin-left: 16px;
238
- background-image: -webkit-linear-gradient(top, #eeeeee, #ffffff 25px);
239
- background-image: -moz-linear-gradient(top, #eeeeee, #ffffff 25px);
240
- background-image: -o-linear-gradient(top, #eeeeee, #ffffff 25px);
241
- background-image: linear-gradient(to bottom, #eeeeee, #ffffff 25px);
242
  }
243
- #sow-widgets-page #widgets-list .so-widget .switch .dashicons-yes {
244
- position: absolute;
245
- top: 2px;
246
- left: -20px;
247
- color: #009200;
248
- display: none;
249
  }
250
- #sow-widgets-page #widgets-list .so-widget .switch .switch-input {
251
- position: absolute;
252
- top: 0;
253
- left: 0;
254
- opacity: 0;
255
  }
256
- #sow-widgets-page #widgets-list .so-widget .switch .switch-label {
257
- position: relative;
258
- display: block;
259
- height: inherit;
260
- font-size: 10px;
261
- text-transform: uppercase;
262
- background: #eceeef;
263
- border-radius: inherit;
264
- box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12), inset 0 0 2px rgba(0, 0, 0, 0.15);
265
- -webkit-transition: 0.15s ease-out;
266
- -moz-transition: 0.15s ease-out;
267
- -o-transition: 0.15s ease-out;
268
- transition: 0.15s ease-out;
269
- -webkit-transition-property: opacity background;
270
- -moz-transition-property: opacity background;
271
- -o-transition-property: opacity background;
272
- transition-property: opacity background;
273
- }
274
- #sow-widgets-page #widgets-list .so-widget .switch .switch-label:before,
275
- #sow-widgets-page #widgets-list .so-widget .switch .switch-label:after {
276
- position: absolute;
277
- top: 50%;
278
- margin-top: -0.5em;
279
- line-height: 1;
280
- -webkit-transition: inherit;
281
- -moz-transition: inherit;
282
- -o-transition: inherit;
283
- transition: inherit;
284
- }
285
- #sow-widgets-page #widgets-list .so-widget .switch .switch-label:before {
286
- content: attr(data-off);
287
- right: 11px;
288
- color: #aaa;
289
- text-shadow: 0 1px rgba(255, 255, 255, 0.5);
290
- }
291
- #sow-widgets-page #widgets-list .so-widget .switch .switch-label:after {
292
- content: attr(data-on);
293
- left: 11px;
294
- color: #ffffff;
295
- text-shadow: 0 1px rgba(0, 0, 0, 0.2);
296
- opacity: 0;
297
  }
298
- #sow-widgets-page #widgets-list .so-widget .switch .switch-input:checked ~ .switch-label {
299
- background: #47a8d8;
300
- box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15), inset 0 0 3px rgba(0, 0, 0, 0.2);
301
  }
302
- #sow-widgets-page #widgets-list .so-widget .switch .switch-input:checked ~ .switch-label:before {
303
- opacity: 0;
304
  }
305
- #sow-widgets-page #widgets-list .so-widget .switch .switch-input:checked ~ .switch-label:after {
306
- opacity: 1;
307
  }
308
- #sow-widgets-page #widgets-list .so-widget .switch .switch-handle {
309
- position: absolute;
310
- top: 4px;
311
- left: 4px;
312
- width: 18px;
313
- height: 18px;
314
- background: #ffffff;
315
- border-radius: 10px;
316
- box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.2);
317
- background-image: -webkit-linear-gradient(top, #ffffff 40%, #f0f0f0);
318
- background-image: -moz-linear-gradient(top, #ffffff 40%, #f0f0f0);
319
- background-image: -o-linear-gradient(top, #ffffff 40%, #f0f0f0);
320
- background-image: linear-gradient(to bottom, #ffffff 40%, #f0f0f0);
321
- -webkit-transition: left 0.15s ease-out;
322
- -moz-transition: left 0.15s ease-out;
323
- -o-transition: left 0.15s ease-out;
324
- transition: left 0.15s ease-out;
325
- }
326
- #sow-widgets-page #widgets-list .so-widget .switch .switch-handle:before {
327
- content: '';
328
- position: absolute;
329
- top: 50%;
330
- left: 50%;
331
- margin: -6px 0 0 -6px;
332
- width: 12px;
333
- height: 12px;
334
- background: #f9f9f9;
335
- border-radius: 6px;
336
- box-shadow: inset 0 1px rgba(0, 0, 0, 0.02);
337
- background-image: -webkit-linear-gradient(top, #eeeeee, #ffffff);
338
- background-image: -moz-linear-gradient(top, #eeeeee, #ffffff);
339
- background-image: -o-linear-gradient(top, #eeeeee, #ffffff);
340
- background-image: linear-gradient(to bottom, #eeeeee, #ffffff);
341
- }
342
- #sow-widgets-page #widgets-list .so-widget .switch .switch-input:checked ~ .switch-handle {
343
- left: 40px;
344
- box-shadow: -1px 1px 5px rgba(0, 0, 0, 0.2);
345
- }
346
- #sow-widgets-page #widgets-list .so-widget .switch .switch-green > .switch-input:checked ~ .switch-label {
347
- background: #4fb845;
348
- }
349
- #sow-widgets-page #widgets-list .so-widget.so-widget-is-active {
350
- background: #F9F9F9;
351
- border: 1px solid #C9C9C9;
352
- }
353
- #sow-widgets-page #widgets-list .so-widget.so-widget-is-active img {
354
- border-bottom: 1px solid #D9D9D9;
355
- }
356
- #sow-widgets-page #widgets-list .so-widget.so-widget-is-active .so-widget-text h4 {
357
- color: #333333;
358
- }
359
- #sow-widgets-page #widgets-list .so-widget.so-widget-is-active .so-widget-text p {
360
- color: #333333;
361
  }
 
 
 
 
 
 
 
362
  #sow-widgets-page #widgets-list .so-widget.so-widget-is-inactive img {
363
  filter: url(filters.svg#grayscale);
364
  filter: gray;
365
  -webkit-filter: grayscale(1);
366
  opacity: 0.7;
367
  }
 
 
 
 
 
 
 
368
  #sow-widgets-page .developers-link {
369
  padding: 0 30px;
370
  text-align: right;
145
  -webkit-box-sizing: border-box;
146
  box-sizing: border-box;
147
  padding: 0 12px 24px 12px;
148
+ width: 25%;
149
  }
150
  @media screen and (max-width: 1800px) {
151
  #sow-widgets-page #widgets-list .so-widget-wrap {
152
+ width: 33.333%;
153
  }
154
  }
155
  @media screen and (max-width: 1280px) {
156
  #sow-widgets-page #widgets-list .so-widget-wrap {
157
+ width: 50%;
158
  }
159
  }
160
+ @media screen and (max-width: 960px) {
161
  #sow-widgets-page #widgets-list .so-widget-wrap {
162
+ width: 100%;
163
  }
164
  }
165
  #sow-widgets-page #widgets-list .so-widget {
166
+ border: 1px solid #D9D9D9;
167
  float: left;
168
  -webkit-box-shadow: 0 1px 2px rgba(0,0,0,0.05);
169
  -moz-box-shadow: 0 1px 2px rgba(0,0,0,0.05);
170
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
171
  padding: 0;
172
  width: 100%;
173
+ background: #fefefe;
 
174
  position: relative;
175
  overflow: hidden;
 
176
  }
177
+ #sow-widgets-page #widgets-list .so-widget .so-widget-banner {
178
+ width: 128px;
179
+ height: 128px;
180
+ float: left;
181
+ margin: 20px;
182
+ overflow: hidden;
 
 
 
 
 
 
 
183
  }
184
+ #sow-widgets-page #widgets-list .so-widget .so-widget-banner img,
185
+ #sow-widgets-page #widgets-list .so-widget .so-widget-banner svg {
186
+ height: 128px;
187
+ width: auto;
 
 
188
  }
189
  #sow-widgets-page #widgets-list .so-widget .so-widget-text {
190
+ padding: 20px 20px 20px 0;
191
+ margin-left: 178px;
192
  }
193
+ #sow-widgets-page #widgets-list .so-widget .so-widget-text .so-widget-active-indicator {
194
+ float: right;
195
+ margin: 0 0 10px 10px;
196
+ background: #00a0d2;
197
+ padding: 4px 10px;
198
+ color: #fff;
199
+ border-radius: 3px;
200
+ -webkit-transition: all 0.35s ease;
201
+ -moz-transition: all 0.35s ease;
202
+ -o-transition: all 0.35s ease;
203
+ transition: all 0.35s ease;
204
+ }
205
+ #sow-widgets-page #widgets-list .so-widget .so-widget-text h3 {
206
+ color: #0073aa;
207
+ font-size: 1.4em;
208
+ font-weight: 500;
209
  margin-top: 0;
 
 
 
210
  }
211
+ #sow-widgets-page #widgets-list .so-widget .so-widget-text .so-widget-description {
212
+ margin: 0;
213
  line-height: 1.35em;
214
  color: #777777;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
215
  }
216
+ #sow-widgets-page #widgets-list .so-widget .so-widget-text .so-widget-byline {
217
+ font-size: 0.9em;
218
+ margin-top: 10px;
219
+ color: #999;
220
+ font-style: italic;
 
221
  }
222
+ #sow-widgets-page #widgets-list .so-widget .so-widget-text .so-widget-byline a {
223
+ color: #666;
224
+ text-decoration: none;
 
 
225
  }
226
+ #sow-widgets-page #widgets-list .so-widget .so-widget-text .so-widget-byline a:hover {
227
+ color: #555;
228
+ text-decoration: underline;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
229
  }
230
+ #sow-widgets-page #widgets-list .so-widget .so-widget-toggle-active {
231
+ margin-top: 15px;
 
232
  }
233
+ #sow-widgets-page #widgets-list .so-widget .so-widget-toggle-active button:focus {
234
+ outline: none;
235
  }
236
+ #sow-widgets-page #widgets-list .so-widget.so-widget-is-active .so-widget-toggle-active .so-widget-activate {
237
+ display: none;
238
  }
239
+ #sow-widgets-page #widgets-list .so-widget.so-widget-is-inactive .so-widget-toggle-active .so-widget-deactivate {
240
+ display: none;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
241
  }
242
+ #sow-widgets-page #widgets-list .so-widget.so-widget-is-inactive .so-widget-active-indicator {
243
+ opacity: 0;
244
+ }
245
+ #sow-widgets-page #widgets-list .so-widget.so-widget-is-inactive h3 {
246
+ color: #666;
247
+ }
248
+ #sow-widgets-page #widgets-list .so-widget.so-widget-is-inactive svg,
249
  #sow-widgets-page #widgets-list .so-widget.so-widget-is-inactive img {
250
  filter: url(filters.svg#grayscale);
251
  filter: gray;
252
  -webkit-filter: grayscale(1);
253
  opacity: 0.7;
254
  }
255
+ #sow-widgets-page #widgets-list.so-animated img,
256
+ #sow-widgets-page #widgets-list.so-animated svg {
257
+ -webkit-transition: all 0.45s ease;
258
+ -moz-transition: all 0.45s ease;
259
+ -o-transition: all 0.45s ease;
260
+ transition: all 0.45s ease;
261
+ }
262
  #sow-widgets-page .developers-link {
263
  padding: 0 30px;
264
  text-align: right;
admin/admin.js CHANGED
@@ -1,46 +1,95 @@
1
- /* globals jQuery */
2
 
3
  jQuery(function($){
4
 
5
- $('.so-widget .switch .switch-input').change(function(e){
6
- var $$ = $(this);
7
- var s = $$.is(':checked');
8
- var $sw = $$.closest('.switch');
9
 
10
  if(s) {
11
- $$.closest('.so-widget').addClass('so-widget-is-active').removeClass('so-widget-is-inactive');
12
  }
13
  else {
14
- $$.closest('.so-widget').removeClass('so-widget-is-active').addClass('so-widget-is-inactive');
15
  }
16
 
17
  // Lets send an ajax request.
18
  $.post(
19
- $$.data('url'),
20
- { 'active' : s },
 
 
 
21
  function(data){
22
- $sw.find('.dashicons-yes').clearQueue().fadeIn('fast').delay(750).fadeOut('fast');
23
  }
24
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  });
26
 
27
  $(window).resize(function() {
28
- var $descriptions = $('div.so-widget-text');
29
  var largestHeight = 0;
 
30
  $descriptions.each(function () {
31
- var headerHeight = $(this).find('h4').height();
32
- var bodyHeight = $(this).find('p.so-widget-description').height();
33
- var headerMarginBottom = parseFloat($(this).find('h4').css('margin-bottom'));
34
- var bodyMarginTop = parseFloat($(this).find('p.so-widget-description').css('margin-top'));
35
- var innerMargin = Math.max(headerMarginBottom, bodyMarginTop);
36
- var divHeight = headerHeight + bodyHeight + innerMargin;
37
- largestHeight = Math.max(largestHeight, divHeight);
38
  });
 
39
  $descriptions.each(function () {
40
- var minHeight = parseInt($(this).css('min-height'));
41
- var divHeight = Math.max(largestHeight, minHeight);
42
- $(this).height(divHeight);
43
  });
 
44
  }).resize();
45
 
46
  // Handle the tabs
@@ -72,4 +121,7 @@ jQuery(function($){
72
 
73
  $(window).resize();
74
  });
 
 
 
75
  });
1
+ /* globals jQuery, soWidgetsAdmin */
2
 
3
  jQuery(function($){
4
 
5
+ $('.so-widget-toggle-active button').click( function(){
6
+ var $$ = $(this),
7
+ s = $$.data('status'),
8
+ $w = $$.closest('.so-widget');
9
 
10
  if(s) {
11
+ $w.addClass('so-widget-is-active').removeClass('so-widget-is-inactive');
12
  }
13
  else {
14
+ $w.removeClass('so-widget-is-active').addClass('so-widget-is-inactive');
15
  }
16
 
17
  // Lets send an ajax request.
18
  $.post(
19
+ soWidgetsAdmin.toggleUrl,
20
+ {
21
+ 'widget' : $w.data('id'),
22
+ 'active' : s
23
+ },
24
  function(data){
25
+ // $sw.find('.dashicons-yes').clearQueue().fadeIn('fast').delay(750).fadeOut('fast');
26
  }
27
  );
28
+
29
+ } );
30
+
31
+ // Fill in the missing header images
32
+ $('.so-widget-banner').each( function(){
33
+ var $$ = $(this),
34
+ $img = $$.find('img');
35
+
36
+ if( !$img.length ) {
37
+ // Create an SVG image as a placeholder icon
38
+ var pattern = Trianglify({
39
+ width: 128,
40
+ height: 128,
41
+ variance : 1,
42
+ cell_size: 32,
43
+ seed: $$.data('seed')
44
+ });
45
+
46
+ $$.append( pattern.svg() );
47
+ }
48
+ else {
49
+ if( $img.width() > 128 ) {
50
+ // Deal with wide banner images
51
+ $img.css('margin-left', -($img.width()-128)/2 );
52
+ }
53
+ }
54
+ } );
55
+
56
+ // Lets implement the search
57
+ var widgetSearch = function(){
58
+ var q = $(this).val().toLowerCase();
59
+
60
+ if( q === '' ) {
61
+ $('.so-widget-wrap').show();
62
+ }
63
+ else {
64
+ $('.so-widget').each( function(){
65
+ var $$ = $(this);
66
+
67
+ if( $$.find('h3').html().toLowerCase().indexOf(q) > -1 ) {
68
+ $$.parent().show();
69
+ }
70
+ else {
71
+ $$.parent().hide();
72
+ }
73
+ } );
74
+ }
75
+ };
76
+ $('#sow-widget-search input').on( {
77
+ keyup: widgetSearch,
78
+ search: widgetSearch
79
  });
80
 
81
  $(window).resize(function() {
82
+ var $descriptions = $('.so-widget-text').css('height', 'auto');
83
  var largestHeight = 0;
84
+
85
  $descriptions.each(function () {
86
+ largestHeight = Math.max(largestHeight, $(this).height() );
 
 
 
 
 
 
87
  });
88
+
89
  $descriptions.each(function () {
90
+ $(this).css('height', largestHeight);
 
 
91
  });
92
+
93
  }).resize();
94
 
95
  // Handle the tabs
121
 
122
  $(window).resize();
123
  });
124
+
125
+ // Finally enable css3 animations on the widgets list
126
+ $('#widgets-list').addClass('so-animated');
127
  });
admin/admin.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(i){i(".so-widget .switch .switch-input").change(function(s){var e=i(this),t=e.is(":checked"),a=e.closest(".switch");t?e.closest(".so-widget").addClass("so-widget-is-active").removeClass("so-widget-is-inactive"):e.closest(".so-widget").removeClass("so-widget-is-active").addClass("so-widget-is-inactive"),i.post(e.data("url"),{active:t},function(i){a.find(".dashicons-yes").clearQueue().fadeIn("fast").delay(750).fadeOut("fast")})}),i(window).resize(function(){var s=i("div.so-widget-text"),e=0;s.each(function(){var s=i(this).find("h4").height(),t=i(this).find("p.so-widget-description").height(),a=parseFloat(i(this).find("h4").css("margin-bottom")),o=parseFloat(i(this).find("p.so-widget-description").css("margin-top")),c=Math.max(a,o),d=s+t+c;e=Math.max(e,d)}),s.each(function(){var s=parseInt(i(this).css("min-height")),t=Math.max(e,s);i(this).height(t)})}).resize(),i("#sow-widgets-page .page-nav a").click(function(s){s.preventDefault();var e=i(this),t=e.attr("href"),a=e.closest("li");switch(i("#sow-widgets-page .page-nav li").not(a).removeClass("active"),a.addClass("active"),t){case"#all":i(".so-widget-wrap").show();break;case"#enabled":i(".so-widget-wrap").hide(),i(".so-widget-wrap .so-widget-is-active").each(function(){i(this).closest(".so-widget-wrap").show()}),i(".so-widget-wrap .so-widget-is-inactive").each(function(){i(this).closest(".so-widget-wrap").hide()});break;case"#disabled":i(".so-widget-wrap .so-widget-is-active").each(function(){i(this).closest(".so-widget-wrap").hide()}),i(".so-widget-wrap .so-widget-is-inactive").each(function(){i(this).closest(".so-widget-wrap").show()})}i(window).resize()})});
1
+ jQuery(function(e){e(".so-widget-toggle-active button").click(function(){var i=e(this),s=i.data("status"),t=i.closest(".so-widget");s?t.addClass("so-widget-is-active").removeClass("so-widget-is-inactive"):t.removeClass("so-widget-is-active").addClass("so-widget-is-inactive"),e.post(soWidgetsAdmin.toggleUrl,{widget:t.data("id"),active:s},function(e){})}),e(".so-widget-banner").each(function(){var i=e(this),s=i.find("img");if(s.length)s.width()>128&&s.css("margin-left",-(s.width()-128)/2);else{var t=Trianglify({width:128,height:128,variance:1,cell_size:32,seed:i.data("seed")});i.append(t.svg())}});var i=function(){var i=e(this).val().toLowerCase();""===i?e(".so-widget-wrap").show():e(".so-widget").each(function(){var s=e(this);s.find("h3").html().toLowerCase().indexOf(i)>-1?s.parent().show():s.parent().hide()})};e("#sow-widget-search input").on({keyup:i,search:i}),e(window).resize(function(){var i=e(".so-widget-text").css("height","auto"),s=0;i.each(function(){s=Math.max(s,e(this).height())}),i.each(function(){e(this).css("height",s)})}).resize(),e("#sow-widgets-page .page-nav a").click(function(i){i.preventDefault();var s=e(this),t=s.attr("href"),a=s.closest("li");switch(e("#sow-widgets-page .page-nav li").not(a).removeClass("active"),a.addClass("active"),t){case"#all":e(".so-widget-wrap").show();break;case"#enabled":e(".so-widget-wrap").hide(),e(".so-widget-wrap .so-widget-is-active").each(function(){e(this).closest(".so-widget-wrap").show()}),e(".so-widget-wrap .so-widget-is-inactive").each(function(){e(this).closest(".so-widget-wrap").hide()});break;case"#disabled":e(".so-widget-wrap .so-widget-is-active").each(function(){e(this).closest(".so-widget-wrap").hide()}),e(".so-widget-wrap .so-widget-is-inactive").each(function(){e(this).closest(".so-widget-wrap").show()})}e(window).resize()}),e("#widgets-list").addClass("so-animated")});
admin/tpl/admin.php CHANGED
@@ -8,11 +8,9 @@
8
  </span>
9
  <h1><?php _e('SiteOrigin Widgets Bundle', 'siteorigin-widgets') ?></h1>
10
 
11
- <!--
12
  <div id="sow-widget-search">
13
- <input type="search" placeholder="<?php esc_attr_e('Search Widgets', 'siteorigin-widgets') ?>" />
14
  </div>
15
- -->
16
  </div>
17
 
18
  <ul class="page-nav">
@@ -26,7 +24,7 @@
26
 
27
  <?php foreach( $widgets as $id => $widget ): ?>
28
  <div class="so-widget-wrap">
29
- <div class="so-widget so-widget-is-<?php echo $widget['Active'] ? 'active' : 'inactive' ?>">
30
 
31
  <?php
32
  $banner = '';
@@ -35,21 +33,40 @@
35
  }
36
  $banner = apply_filters('siteorigin_widgets_widget_banner', $banner, $widget);
37
  ?>
38
-
39
- <img src="<?php echo sow_esc_url( !empty($banner) ? $banner : plugin_dir_url(__FILE__) . '../../banners/default.png' ) ?>" />
 
 
 
40
 
41
  <div class="so-widget-text">
42
- <label class="switch">
43
- <span class="dashicons dashicons-yes"></span>
44
- <input class="switch-input" type="checkbox" <?php checked( $widget['Active'] ) ?> data-url="<?php echo wp_nonce_url( admin_url('admin-ajax.php?action=so_widgets_bundle_manage&widget='.$widget['ID']), 'manage_so_widget' ) ?>">
45
- <span class="switch-label" data-on="<?php _e('On', 'siteorigin-widgets') ?>" data-off="<?php _e('Off', 'siteorigin-widgets') ?>"></span>
46
- <span class="switch-handle"></span>
47
- </label>
48
-
49
- <h4><?php echo esc_html($widget['Name']); ?></h4>
50
- <p class="so-widget-description">
51
- <?php echo $widget['Description'] ?>
52
- </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  </div>
54
 
55
  </div>
8
  </span>
9
  <h1><?php _e('SiteOrigin Widgets Bundle', 'siteorigin-widgets') ?></h1>
10
 
 
11
  <div id="sow-widget-search">
12
+ <input type="search" placeholder="<?php esc_attr_e('Filter Widgets', 'siteorigin-widgets') ?>" />
13
  </div>
 
14
  </div>
15
 
16
  <ul class="page-nav">
24
 
25
  <?php foreach( $widgets as $id => $widget ): ?>
26
  <div class="so-widget-wrap">
27
+ <div class="so-widget so-widget-is-<?php echo $widget['Active'] ? 'active' : 'inactive' ?>" data-id="<?php echo esc_attr( $widget['ID'] ) ?>">
28
 
29
  <?php
30
  $banner = '';
33
  }
34
  $banner = apply_filters('siteorigin_widgets_widget_banner', $banner, $widget);
35
  ?>
36
+ <div class="so-widget-banner" data-seed="<?php echo esc_attr( substr( md5($widget['ID']), 0, 6 ) ) ?>">
37
+ <?php if( !empty($banner) ) : ?>
38
+ <img src="<?php echo esc_url($banner) ?>" />
39
+ <?php endif; ?>
40
+ </div>
41
 
42
  <div class="so-widget-text">
43
+
44
+ <div class="so-widget-active-indicator"><?php _e('Active', 'siteorigin-widgets') ?></div>
45
+
46
+ <h3><?php echo esc_html( $widget['Name'] ); ?></h3>
47
+
48
+ <div class="so-widget-description">
49
+ <?php echo esc_html( $widget['Description'] ) ?>
50
+ </div>
51
+
52
+ <?php if( !empty( $widget['Author'] ) ) : ?>
53
+ <div class="so-widget-byline">
54
+ By
55
+ <strong>
56
+ <?php
57
+ if( !empty($widget['AuthorURI']) ) echo '<a href="' . esc_url( $widget['AuthorURI'] ) . '" target="_blank">';
58
+ echo esc_html( $widget['Author'] );
59
+ if( !empty($widget['AuthorURI']) ) echo '</a>';
60
+ ?>
61
+ </strong>
62
+ </div>
63
+ <?php endif; ?>
64
+
65
+ <div class="so-widget-toggle-active">
66
+ <button class="button-secondary so-widget-activate" data-status="1"><?php esc_html_e( 'Activate', 'siteorigin-widgets' ) ?></button>
67
+ <button class="button-secondary so-widget-deactivate" data-status="0"><?php esc_html_e( 'Deactivate', 'siteorigin-widgets' ) ?></button>
68
+ </div>
69
+
70
  </div>
71
 
72
  </div>
admin/trianglify.js ADDED
@@ -0,0 +1,3445 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Trianglify = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;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 require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({"./lib/trianglify.js":[function(require,module,exports){
2
+ /*
3
+ * Trianglify.js
4
+ * by @qrohlf
5
+ *
6
+ * Licensed under the GPLv3
7
+ */
8
+
9
+ var delaunay = require('delaunay-fast');
10
+ var seedrandom = require('seedrandom');
11
+ var chroma = require('chroma-js'); //PROBLEM: chroma.js is nearly 32k in size
12
+ var colorbrewer = require('./colorbrewer'); //We could use the chroma.js colorbrewer, but it's got some ugly stuff so we use our own subset.
13
+
14
+ var Pattern = require('./pattern');
15
+
16
+ var defaults = {
17
+ width: 600, // Width of pattern
18
+ height: 400, // Height of pattern
19
+ cell_size: 75, // Size of the cells used to generate a randomized grid
20
+ variance: 0.75, // how much to randomize the grid
21
+ seed: null, // Seed for the RNG
22
+ x_colors: 'random', // X color stops
23
+ y_colors: 'match_x', // Y color stops
24
+ palette: colorbrewer, // Palette to use for 'random' color option
25
+ color_space: 'lab', // Color space used for gradient construction & interpolation
26
+ color_function: null, // Color function f(x, y) that returns a color specification that is consumable by chroma-js
27
+ stroke_width: 1.51 // Width of stroke. Defaults to 1.51 to fix an issue with canvas antialiasing.
28
+ };
29
+
30
+ /*********************************************************
31
+ *
32
+ * Main function that is exported to the global namespace
33
+ *
34
+ **********************************************************/
35
+
36
+ function Trianglify(opts) {
37
+ // apply defaults
38
+ opts = _merge_opts(defaults, opts);
39
+
40
+ // setup seedable RNG
41
+ rand = seedrandom(opts.seed);
42
+
43
+ // randomize colors if requested
44
+ if (opts.x_colors === 'random') opts.x_colors = _random_from_palette();
45
+ if (opts.y_colors === 'random') opts.y_colors = _random_from_palette();
46
+ if (opts.y_colors === 'match_x') opts.y_colors = opts.x_colors;
47
+
48
+ // some sanity-checking
49
+ if (!(opts.width > 0 && opts.height > 0)) {
50
+ throw new Error("Width and height must be numbers greater than 0");
51
+ }
52
+
53
+ if (opts.cell_size < 2) {
54
+ throw new Error("Cell size must be greater than 2.");
55
+ }
56
+
57
+ // Setup the color gradient function
58
+ var gradient;
59
+
60
+ if (opts.color_function) {
61
+ gradient = function(x, y) {
62
+ return chroma(opts.color_function(x, y));
63
+ };
64
+ } else {
65
+ var x_color = chroma.scale(opts.x_colors).mode(opts.color_space);
66
+ var y_color = chroma.scale(opts.y_colors).mode(opts.color_space);
67
+ gradient = function(x, y) {
68
+ return chroma.interpolate(x_color(x), y_color(y), 0.5, opts.color_space);
69
+ };
70
+ }
71
+
72
+ // Figure out key dimensions
73
+
74
+ // it's a pain to prefix width and height with opts all the time, so let's
75
+ // give them proper variables to refer to
76
+ var width = opts.width;
77
+ var height = opts.height;
78
+
79
+ // How many cells we're going to have on each axis (pad by 2 cells on each edge)
80
+ var cells_x = Math.floor((width + 4 * opts.cell_size) / opts.cell_size);
81
+ var cells_y = Math.floor((height + 4 * opts.cell_size) / opts.cell_size);
82
+
83
+ // figure out the bleed widths to center the grid
84
+ var bleed_x = ((cells_x * opts.cell_size) - width)/2;
85
+ var bleed_y = ((cells_y * opts.cell_size) - height)/2;
86
+
87
+ // how much can out points wiggle (+/-) given the cell padding?
88
+ var variance = opts.cell_size * opts.variance / 2;
89
+
90
+ // Set up normalizers
91
+ var norm_x = function(x) {
92
+ return _map(x, [-bleed_x, width+bleed_x], [0, 1]);
93
+ };
94
+
95
+ var norm_y = function(y) {
96
+ return _map(y, [-bleed_y, height+bleed_y], [0, 1]);
97
+ };
98
+
99
+ // generate a point mesh
100
+ var points = _generate_points(width, height);
101
+
102
+ // delaunay.triangulate gives us indices into the original coordinate array
103
+ var geom_indices = delaunay.triangulate(points);
104
+
105
+ // iterate over the indices in groups of three to flatten them into polygons, with color lookup
106
+ var triangles = [];
107
+ var lookup_point = function(i) { return points[i];};
108
+ for (var i=0; i < geom_indices.length; i += 3) {
109
+ var vertices = [geom_indices[i], geom_indices[i+1], geom_indices[i+2]].map(lookup_point);
110
+ var centroid = _centroid(vertices);
111
+ var color = gradient(norm_x(centroid.x), norm_y(centroid.y)).hex();
112
+ triangles.push([color, vertices]);
113
+ }
114
+ return Pattern(triangles, opts);
115
+
116
+
117
+ /*********************************************************
118
+ *
119
+ * Private functions
120
+ *
121
+ **********************************************************/
122
+
123
+ function _map(num, in_range, out_range ) {
124
+ return ( num - in_range[0] ) * ( out_range[1] - out_range[0] ) / ( in_range[1] - in_range[0] ) + out_range[0];
125
+ }
126
+
127
+ // generate points on a randomized grid
128
+ function _generate_points(width, height) {
129
+
130
+ var points = [];
131
+ for (var i = - bleed_x; i < width + bleed_x; i += opts.cell_size) {
132
+ for (var j = - bleed_y; j < height + bleed_y; j += opts.cell_size) {
133
+ var x = i + opts.cell_size/2 + _map(rand(), [0, 1], [-variance, variance]);
134
+ var y = j + opts.cell_size/2 + _map(rand(), [0, 1], [-variance, variance]);
135
+ points.push([x, y].map(Math.floor));
136
+ }
137
+ }
138
+
139
+ return points;
140
+ }
141
+
142
+ //triangles only!
143
+ function _centroid(d) {
144
+ return {
145
+ x: (d[0][0] + d[1][0] + d[2][0])/3,
146
+ y: (d[0][1] + d[1][1] + d[2][1])/3
147
+ };
148
+ }
149
+
150
+ // select a random palette from colorbrewer
151
+ function _random_from_palette() {
152
+ if (opts.palette instanceof Array) {
153
+ return opts.palette[Math.floor(rand()*opts.palette.length)];
154
+ }
155
+
156
+ var keys = Object.keys(opts.palette);
157
+ return opts.palette[keys[Math.floor(rand()*keys.length)]];
158
+ }
159
+
160
+ // shallow extend (sort of) for option defaults
161
+ function _merge_opts(defaults, options) {
162
+ var out = {};
163
+
164
+ // shallow-copy defaults so we don't mutate the input objects (bad)
165
+ for (var key in defaults) {
166
+ out[key] = defaults[key];
167
+ }
168
+
169
+ for (key in options) {
170
+ if (defaults.hasOwnProperty(key)) {
171
+ out[key] = options[key]; // override defaults with options
172
+ } else {
173
+ throw new Error(key+" is not a configuration option for Trianglify. Check your spelling?");
174
+ }
175
+ }
176
+ return out;
177
+ }
178
+
179
+ } //end of Trianglify function closure
180
+
181
+ // exports
182
+ Trianglify.colorbrewer = colorbrewer;
183
+ Trianglify.defaults = defaults;
184
+ module.exports = Trianglify;
185
+ },{"./colorbrewer":"/Users/gpriday/Downloads/trianglify-master 2/lib/colorbrewer.js","./pattern":"/Users/gpriday/Downloads/trianglify-master 2/lib/pattern.js","chroma-js":"/Users/gpriday/Downloads/trianglify-master 2/node_modules/chroma-js/chroma.js","delaunay-fast":"/Users/gpriday/Downloads/trianglify-master 2/node_modules/delaunay-fast/delaunay.js","seedrandom":"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/index.js"}],"/Users/gpriday/Downloads/trianglify-master 2/lib/colorbrewer.js":[function(require,module,exports){
186
+ /*
187
+ * colorbrewer.js
188
+ *
189
+ * Colorbrewer colors, by Cindy Brewer
190
+ */
191
+
192
+ module.exports = {
193
+ YlGn: ["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],
194
+ YlGnBu: ["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],
195
+ GnBu: ["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],
196
+ BuGn: ["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],
197
+ PuBuGn: ["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],
198
+ PuBu: ["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],
199
+ BuPu: ["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],
200
+ RdPu: ["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],
201
+ PuRd: ["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],
202
+ OrRd: ["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],
203
+ YlOrRd: ["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],
204
+ YlOrBr: ["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],
205
+ Purples: ["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],
206
+ Blues: ["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],
207
+ Greens: ["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],
208
+ Oranges: ["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],
209
+ Reds: ["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],
210
+ Greys: ["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],
211
+ PuOr: ["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],
212
+ BrBG: ["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],
213
+ PRGn: ["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],
214
+ PiYG: ["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],
215
+ RdBu: ["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],
216
+ RdGy: ["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],
217
+ RdYlBu: ["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],
218
+ Spectral: ["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],
219
+ RdYlGn: ["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]
220
+ };
221
+ },{}],"/Users/gpriday/Downloads/trianglify-master 2/lib/pattern.js":[function(require,module,exports){
222
+ (function (process){
223
+ /*
224
+ * Pattern.js
225
+ * Contains rendering implementations for trianglify-generated geometry
226
+ */
227
+
228
+ // conditionally load jsdom if we don't have a browser environment available.
229
+ var doc = (typeof document !== "undefined") ? document : require('jsdom').jsdom('<html/>');
230
+
231
+ function Pattern(polys, opts) {
232
+
233
+ // SVG rendering method
234
+ function render_svg() {
235
+ var svg = doc.createElementNS("http://www.w3.org/2000/svg", 'svg');
236
+ svg.setAttribute('width', opts.width);
237
+ svg.setAttribute('height', opts.height);
238
+
239
+ polys.forEach(function(poly) {
240
+ var path = doc.createElementNS("http://www.w3.org/2000/svg", 'path');
241
+ path.setAttribute("d", "M" + poly[1].join("L") + "Z");
242
+ path.setAttribute("fill", poly[0]);
243
+ path.setAttribute("stroke", poly[0]);
244
+ path.setAttribute("stroke-width", opts.stroke_width);
245
+ svg.appendChild(path);
246
+ });
247
+
248
+ return svg;
249
+ }
250
+
251
+ // Canvas rendering method
252
+ function render_canvas(canvas) {
253
+ // check for canvas support
254
+ if (typeof process !== "undefined") {
255
+ try {
256
+ require('canvas');
257
+ } catch (e) {
258
+ throw Error('The optional node-canvas dependency is needed for Trianglify to render using canvas in node.');
259
+ }
260
+ }
261
+
262
+ if (!canvas) {
263
+ canvas = doc.createElement('canvas');
264
+ }
265
+
266
+ canvas.setAttribute('width', opts.width);
267
+ canvas.setAttribute('height', opts.height);
268
+ ctx = canvas.getContext("2d");
269
+ ctx.canvas.width = opts.width;
270
+ ctx.canvas.height = opts.height;
271
+
272
+ polys.forEach(function(poly) {
273
+ ctx.fillStyle = ctx.strokeStyle = poly[0];
274
+ ctx.lineWidth = opts.stroke_width;
275
+ ctx.beginPath();
276
+ ctx.moveTo.apply(ctx, poly[1][0]);
277
+ ctx.lineTo.apply(ctx, poly[1][1]);
278
+ ctx.lineTo.apply(ctx, poly[1][2]);
279
+ ctx.fill();
280
+ ctx.stroke();
281
+ });
282
+
283
+ return canvas;
284
+ }
285
+
286
+ // PNG rendering method
287
+ // currently returns a data url as a string since toBlob support really isn't there yet...
288
+ function render_png() {
289
+ return render_canvas().toDataURL("image/png");
290
+ }
291
+
292
+ // Return an object with all the relevant functions/properties attached to it
293
+ return {
294
+ polys: polys,
295
+ opts: opts,
296
+ svg: render_svg,
297
+ canvas: render_canvas,
298
+ png: render_png
299
+ };
300
+ }
301
+
302
+ module.exports = Pattern;
303
+ }).call(this,require('_process'))
304
+ },{"_process":"/Users/gpriday/Downloads/trianglify-master 2/node_modules/browserify/node_modules/process/browser.js","canvas":"/Users/gpriday/Downloads/trianglify-master 2/node_modules/browserify/node_modules/browser-resolve/empty.js","jsdom":"/Users/gpriday/Downloads/trianglify-master 2/node_modules/browserify/node_modules/browser-resolve/empty.js"}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/browserify/node_modules/browser-resolve/empty.js":[function(require,module,exports){
305
+
306
+ },{}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/browserify/node_modules/process/browser.js":[function(require,module,exports){
307
+ // shim for using process in browser
308
+
309
+ var process = module.exports = {};
310
+ var queue = [];
311
+ var draining = false;
312
+
313
+ function drainQueue() {
314
+ if (draining) {
315
+ return;
316
+ }
317
+ draining = true;
318
+ var currentQueue;
319
+ var len = queue.length;
320
+ while(len) {
321
+ currentQueue = queue;
322
+ queue = [];
323
+ var i = -1;
324
+ while (++i < len) {
325
+ currentQueue[i]();
326
+ }
327
+ len = queue.length;
328
+ }
329
+ draining = false;
330
+ }
331
+ process.nextTick = function (fun) {
332
+ queue.push(fun);
333
+ if (!draining) {
334
+ setTimeout(drainQueue, 0);
335
+ }
336
+ };
337
+
338
+ process.title = 'browser';
339
+ process.browser = true;
340
+ process.env = {};
341
+ process.argv = [];
342
+ process.version = ''; // empty string to avoid regexp issues
343
+ process.versions = {};
344
+
345
+ function noop() {}
346
+
347
+ process.on = noop;
348
+ process.addListener = noop;
349
+ process.once = noop;
350
+ process.off = noop;
351
+ process.removeListener = noop;
352
+ process.removeAllListeners = noop;
353
+ process.emit = noop;
354
+
355
+ process.binding = function (name) {
356
+ throw new Error('process.binding is not supported');
357
+ };
358
+
359
+ // TODO(shtylman)
360
+ process.cwd = function () { return '/' };
361
+ process.chdir = function (dir) {
362
+ throw new Error('process.chdir is not supported');
363
+ };
364
+ process.umask = function() { return 0; };
365
+
366
+ },{}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/chroma-js/chroma.js":[function(require,module,exports){
367
+ // Generated by CoffeeScript 1.6.2
368
+ /** echo * @license echo * while read i do echo * done echo
369
+ */
370
+
371
+
372
+ (function() {
373
+ var Color, K, PITHIRD, TWOPI, X, Y, Z, bezier, brewer, chroma, clip_rgb, colors, cos, css2rgb, hex2rgb, hsi2rgb, hsl2rgb, hsv2rgb, lab2lch, lab2rgb, lab_xyz, lch2lab, lch2rgb, limit, luminance, luminance_x, rgb2hex, rgb2hsi, rgb2hsl, rgb2hsv, rgb2lab, rgb2lch, rgb_xyz, root, type, unpack, xyz_lab, xyz_rgb, _ref;
374
+
375
+ chroma = function(x, y, z, m) {
376
+ return new Color(x, y, z, m);
377
+ };
378
+
379
+ if ((typeof module !== "undefined" && module !== null) && (module.exports != null)) {
380
+ module.exports = chroma;
381
+ }
382
+
383
+ if (typeof define === 'function' && define.amd) {
384
+ define([], function() {
385
+ return chroma;
386
+ });
387
+ } else {
388
+ root = typeof exports !== "undefined" && exports !== null ? exports : this;
389
+ root.chroma = chroma;
390
+ }
391
+
392
+ chroma.color = function(x, y, z, m) {
393
+ return new Color(x, y, z, m);
394
+ };
395
+
396
+ chroma.hsl = function(h, s, l, a) {
397
+ return new Color(h, s, l, a, 'hsl');
398
+ };
399
+
400
+ chroma.hsv = function(h, s, v, a) {
401
+ return new Color(h, s, v, a, 'hsv');
402
+ };
403
+
404
+ chroma.rgb = function(r, g, b, a) {
405
+ return new Color(r, g, b, a, 'rgb');
406
+ };
407
+
408
+ chroma.hex = function(x) {
409
+ return new Color(x);
410
+ };
411
+
412
+ chroma.css = function(x) {
413
+ return new Color(x);
414
+ };
415
+
416
+ chroma.lab = function(l, a, b) {
417
+ return new Color(l, a, b, 'lab');
418
+ };
419
+
420
+ chroma.lch = function(l, c, h) {
421
+ return new Color(l, c, h, 'lch');
422
+ };
423
+
424
+ chroma.hsi = function(h, s, i) {
425
+ return new Color(h, s, i, 'hsi');
426
+ };
427
+
428
+ chroma.gl = function(r, g, b, a) {
429
+ return new Color(r * 255, g * 255, b * 255, a, 'gl');
430
+ };
431
+
432
+ chroma.interpolate = function(a, b, f, m) {
433
+ if ((a == null) || (b == null)) {
434
+ return '#000';
435
+ }
436
+ if (type(a) === 'string') {
437
+ a = new Color(a);
438
+ }
439
+ if (type(b) === 'string') {
440
+ b = new Color(b);
441
+ }
442
+ return a.interpolate(f, b, m);
443
+ };
444
+
445
+ chroma.mix = chroma.interpolate;
446
+
447
+ chroma.contrast = function(a, b) {
448
+ var l1, l2;
449
+
450
+ if (type(a) === 'string') {
451
+ a = new Color(a);
452
+ }
453
+ if (type(b) === 'string') {
454
+ b = new Color(b);
455
+ }
456
+ l1 = a.luminance();
457
+ l2 = b.luminance();
458
+ if (l1 > l2) {
459
+ return (l1 + 0.05) / (l2 + 0.05);
460
+ } else {
461
+ return (l2 + 0.05) / (l1 + 0.05);
462
+ }
463
+ };
464
+
465
+ chroma.luminance = function(color) {
466
+ return chroma(color).luminance();
467
+ };
468
+
469
+ chroma._Color = Color;
470
+
471
+ /**
472
+ chroma.js
473
+
474
+ Copyright (c) 2011-2013, Gregor Aisch
475
+ All rights reserved.
476
+
477
+ Redistribution and use in source and binary forms, with or without
478
+ modification, are permitted provided that the following conditions are met:
479
+
480
+ * Redistributions of source code must retain the above copyright notice, this
481
+ list of conditions and the following disclaimer.
482
+
483
+ * Redistributions in binary form must reproduce the above copyright notice,
484
+ this list of conditions and the following disclaimer in the documentation
485
+ and/or other materials provided with the distribution.
486
+
487
+ * The name Gregor Aisch may not be used to endorse or promote products
488
+ derived from this software without specific prior written permission.
489
+
490
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
491
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
492
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
493
+ DISCLAIMED. IN NO EVENT SHALL GREGOR AISCH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
494
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
495
+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
496
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
497
+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
498
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
499
+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
500
+
501
+ @source: https://github.com/gka/chroma.js
502
+ */
503
+
504
+
505
+ Color = (function() {
506
+ function Color() {
507
+ var a, arg, args, m, me, me_rgb, x, y, z, _i, _len, _ref, _ref1, _ref2, _ref3, _ref4;
508
+
509
+ me = this;
510
+ args = [];
511
+ for (_i = 0, _len = arguments.length; _i < _len; _i++) {
512
+ arg = arguments[_i];
513
+ if (arg != null) {
514
+ args.push(arg);
515
+ }
516
+ }
517
+ if (args.length === 0) {
518
+ _ref = [255, 0, 255, 1, 'rgb'], x = _ref[0], y = _ref[1], z = _ref[2], a = _ref[3], m = _ref[4];
519
+ } else if (type(args[0]) === "array") {
520
+ if (args[0].length === 3) {
521
+ _ref1 = args[0], x = _ref1[0], y = _ref1[1], z = _ref1[2];
522
+ a = 1;
523
+ } else if (args[0].length === 4) {
524
+ _ref2 = args[0], x = _ref2[0], y = _ref2[1], z = _ref2[2], a = _ref2[3];
525
+ } else {
526
+ throw 'unknown input argument';
527
+ }
528
+ m = (_ref3 = args[1]) != null ? _ref3 : 'rgb';
529
+ } else if (type(args[0]) === "string") {
530
+ x = args[0];
531
+ m = 'hex';
532
+ } else if (type(args[0]) === "object") {
533
+ _ref4 = args[0]._rgb, x = _ref4[0], y = _ref4[1], z = _ref4[2], a = _ref4[3];
534
+ m = 'rgb';
535
+ } else if (args.length >= 3) {
536
+ x = args[0];
537
+ y = args[1];
538
+ z = args[2];
539
+ }
540
+ if (args.length === 3) {
541
+ m = 'rgb';
542
+ a = 1;
543
+ } else if (args.length === 4) {
544
+ if (type(args[3]) === "string") {
545
+ m = args[3];
546
+ a = 1;
547
+ } else if (type(args[3]) === "number") {
548
+ m = 'rgb';
549
+ a = args[3];
550
+ }
551
+ } else if (args.length === 5) {
552
+ a = args[3];
553
+ m = args[4];
554
+ }
555
+ if (a == null) {
556
+ a = 1;
557
+ }
558
+ if (m === 'rgb') {
559
+ me._rgb = [x, y, z, a];
560
+ } else if (m === 'gl') {
561
+ me._rgb = [x * 255, y * 255, z * 255, a];
562
+ } else if (m === 'hsl') {
563
+ me._rgb = hsl2rgb(x, y, z);
564
+ me._rgb[3] = a;
565
+ } else if (m === 'hsv') {
566
+ me._rgb = hsv2rgb(x, y, z);
567
+ me._rgb[3] = a;
568
+ } else if (m === 'hex') {
569
+ me._rgb = hex2rgb(x);
570
+ } else if (m === 'lab') {
571
+ me._rgb = lab2rgb(x, y, z);
572
+ me._rgb[3] = a;
573
+ } else if (m === 'lch') {
574
+ me._rgb = lch2rgb(x, y, z);
575
+ me._rgb[3] = a;
576
+ } else if (m === 'hsi') {
577
+ me._rgb = hsi2rgb(x, y, z);
578
+ me._rgb[3] = a;
579
+ }
580
+ me_rgb = clip_rgb(me._rgb);
581
+ }
582
+
583
+ Color.prototype.rgb = function() {
584
+ return this._rgb.slice(0, 3);
585
+ };
586
+
587
+ Color.prototype.rgba = function() {
588
+ return this._rgb;
589
+ };
590
+
591
+ Color.prototype.hex = function() {
592
+ return rgb2hex(this._rgb);
593
+ };
594
+
595
+ Color.prototype.toString = function() {
596
+ return this.name();
597
+ };
598
+
599
+ Color.prototype.hsl = function() {
600
+ return rgb2hsl(this._rgb);
601
+ };
602
+
603
+ Color.prototype.hsv = function() {
604
+ return rgb2hsv(this._rgb);
605
+ };
606
+
607
+ Color.prototype.lab = function() {
608
+ return rgb2lab(this._rgb);
609
+ };
610
+
611
+ Color.prototype.lch = function() {
612
+ return rgb2lch(this._rgb);
613
+ };
614
+
615
+ Color.prototype.hsi = function() {
616
+ return rgb2hsi(this._rgb);
617
+ };
618
+
619
+ Color.prototype.gl = function() {
620
+ return [this._rgb[0] / 255, this._rgb[1] / 255, this._rgb[2] / 255, this._rgb[3]];
621
+ };
622
+
623
+ Color.prototype.luminance = function(lum, mode) {
624
+ var cur_lum, eps, max_iter, test;
625
+
626
+ if (mode == null) {
627
+ mode = 'rgb';
628
+ }
629
+ if (!arguments.length) {
630
+ return luminance(this._rgb);
631
+ }
632
+ if (lum === 0) {
633
+ this._rgb = [0, 0, 0, this._rgb[3]];
634
+ }
635
+ if (lum === 1) {
636
+ this._rgb = [255, 255, 255, this._rgb[3]];
637
+ }
638
+ cur_lum = luminance(this._rgb);
639
+ eps = 1e-7;
640
+ max_iter = 20;
641
+ test = function(l, h) {
642
+ var lm, m;
643
+
644
+ m = l.interpolate(0.5, h, mode);
645
+ lm = m.luminance();
646
+ if (Math.abs(lum - lm) < eps || !max_iter--) {
647
+ return m;
648
+ }
649
+ if (lm > lum) {
650
+ return test(l, m);
651
+ }
652
+ return test(m, h);
653
+ };
654
+ this._rgb = (cur_lum > lum ? test(new Color('black'), this) : test(this, new Color('white'))).rgba();
655
+ return this;
656
+ };
657
+
658
+ Color.prototype.name = function() {
659
+ var h, k;
660
+
661
+ h = this.hex();
662
+ for (k in chroma.colors) {
663
+ if (h === chroma.colors[k]) {
664
+ return k;
665
+ }
666
+ }
667
+ return h;
668
+ };
669
+
670
+ Color.prototype.alpha = function(alpha) {
671
+ if (arguments.length) {
672
+ this._rgb[3] = alpha;
673
+ return this;
674
+ }
675
+ return this._rgb[3];
676
+ };
677
+
678
+ Color.prototype.css = function(mode) {
679
+ var hsl, me, rgb, rnd;
680
+
681
+ if (mode == null) {
682
+ mode = 'rgb';
683
+ }
684
+ me = this;
685
+ rgb = me._rgb;
686
+ if (mode.length === 3 && rgb[3] < 1) {
687
+ mode += 'a';
688
+ }
689
+ if (mode === 'rgb') {
690
+ return mode + '(' + rgb.slice(0, 3).map(Math.round).join(',') + ')';
691
+ } else if (mode === 'rgba') {
692
+ return mode + '(' + rgb.slice(0, 3).map(Math.round).join(',') + ',' + rgb[3] + ')';
693
+ } else if (mode === 'hsl' || mode === 'hsla') {
694
+ hsl = me.hsl();
695
+ rnd = function(a) {
696
+ return Math.round(a * 100) / 100;
697
+ };
698
+ hsl[0] = rnd(hsl[0]);
699
+ hsl[1] = rnd(hsl[1] * 100) + '%';
700
+ hsl[2] = rnd(hsl[2] * 100) + '%';
701
+ if (mode.length === 4) {
702
+ hsl[3] = rgb[3];
703
+ }
704
+ return mode + '(' + hsl.join(',') + ')';
705
+ }
706
+ };
707
+
708
+ Color.prototype.interpolate = function(f, col, m) {
709
+ /*
710
+ interpolates between colors
711
+ f = 0 --> me
712
+ f = 1 --> col
713
+ */
714
+
715
+ var dh, hue, hue0, hue1, lbv, lbv0, lbv1, me, res, sat, sat0, sat1, xyz0, xyz1;
716
+
717
+ me = this;
718
+ if (m == null) {
719
+ m = 'rgb';
720
+ }
721
+ if (type(col) === "string") {
722
+ col = new Color(col);
723
+ }
724
+ if (m === 'hsl' || m === 'hsv' || m === 'lch' || m === 'hsi') {
725
+ if (m === 'hsl') {
726
+ xyz0 = me.hsl();
727
+ xyz1 = col.hsl();
728
+ } else if (m === 'hsv') {
729
+ xyz0 = me.hsv();
730
+ xyz1 = col.hsv();
731
+ } else if (m === 'hsi') {
732
+ xyz0 = me.hsi();
733
+ xyz1 = col.hsi();
734
+ } else if (m === 'lch') {
735
+ xyz0 = me.lch();
736
+ xyz1 = col.lch();
737
+ }
738
+ if (m.substr(0, 1) === 'h') {
739
+ hue0 = xyz0[0], sat0 = xyz0[1], lbv0 = xyz0[2];
740
+ hue1 = xyz1[0], sat1 = xyz1[1], lbv1 = xyz1[2];
741
+ } else {
742
+ lbv0 = xyz0[0], sat0 = xyz0[1], hue0 = xyz0[2];
743
+ lbv1 = xyz1[0], sat1 = xyz1[1], hue1 = xyz1[2];
744
+ }
745
+ if (!isNaN(hue0) && !isNaN(hue1)) {
746
+ if (hue1 > hue0 && hue1 - hue0 > 180) {
747
+ dh = hue1 - (hue0 + 360);
748
+ } else if (hue1 < hue0 && hue0 - hue1 > 180) {
749
+ dh = hue1 + 360 - hue0;
750
+ } else {
751
+ dh = hue1 - hue0;
752
+ }
753
+ hue = hue0 + f * dh;
754
+ } else if (!isNaN(hue0)) {
755
+ hue = hue0;
756
+ if ((lbv1 === 1 || lbv1 === 0) && m !== 'hsv') {
757
+ sat = sat0;
758
+ }
759
+ } else if (!isNaN(hue1)) {
760
+ hue = hue1;
761
+ if ((lbv0 === 1 || lbv0 === 0) && m !== 'hsv') {
762
+ sat = sat1;
763
+ }
764
+ } else {
765
+ hue = Number.NaN;
766
+ }
767
+ if (sat == null) {
768
+ sat = sat0 + f * (sat1 - sat0);
769
+ }
770
+ lbv = lbv0 + f * (lbv1 - lbv0);
771
+ if (m.substr(0, 1) === 'h') {
772
+ res = new Color(hue, sat, lbv, m);
773
+ } else {
774
+ res = new Color(lbv, sat, hue, m);
775
+ }
776
+ } else if (m === 'rgb') {
777
+ xyz0 = me._rgb;
778
+ xyz1 = col._rgb;
779
+ res = new Color(xyz0[0] + f * (xyz1[0] - xyz0[0]), xyz0[1] + f * (xyz1[1] - xyz0[1]), xyz0[2] + f * (xyz1[2] - xyz0[2]), m);
780
+ } else if (m === 'lab') {
781
+ xyz0 = me.lab();
782
+ xyz1 = col.lab();
783
+ res = new Color(xyz0[0] + f * (xyz1[0] - xyz0[0]), xyz0[1] + f * (xyz1[1] - xyz0[1]), xyz0[2] + f * (xyz1[2] - xyz0[2]), m);
784
+ } else {
785
+ throw "color mode " + m + " is not supported";
786
+ }
787
+ res.alpha(me.alpha() + f * (col.alpha() - me.alpha()));
788
+ return res;
789
+ };
790
+
791
+ Color.prototype.premultiply = function() {
792
+ var a, rgb;
793
+
794
+ rgb = this.rgb();
795
+ a = this.alpha();
796
+ return chroma(rgb[0] * a, rgb[1] * a, rgb[2] * a, a);
797
+ };
798
+
799
+ Color.prototype.darken = function(amount) {
800
+ var lch, me;
801
+
802
+ if (amount == null) {
803
+ amount = 20;
804
+ }
805
+ me = this;
806
+ lch = me.lch();
807
+ lch[0] -= amount;
808
+ return chroma.lch(lch).alpha(me.alpha());
809
+ };
810
+
811
+ Color.prototype.darker = function(amount) {
812
+ return this.darken(amount);
813
+ };
814
+
815
+ Color.prototype.brighten = function(amount) {
816
+ if (amount == null) {
817
+ amount = 20;
818
+ }
819
+ return this.darken(-amount);
820
+ };
821
+
822
+ Color.prototype.brighter = function(amount) {
823
+ return this.brighten(amount);
824
+ };
825
+
826
+ Color.prototype.saturate = function(amount) {
827
+ var lch, me;
828
+
829
+ if (amount == null) {
830
+ amount = 20;
831
+ }
832
+ me = this;
833
+ lch = me.lch();
834
+ lch[1] += amount;
835
+ return chroma.lch(lch).alpha(me.alpha());
836
+ };
837
+
838
+ Color.prototype.desaturate = function(amount) {
839
+ if (amount == null) {
840
+ amount = 20;
841
+ }
842
+ return this.saturate(-amount);
843
+ };
844
+
845
+ return Color;
846
+
847
+ })();
848
+
849
+ clip_rgb = function(rgb) {
850
+ var i;
851
+
852
+ for (i in rgb) {
853
+ if (i < 3) {
854
+ if (rgb[i] < 0) {
855
+ rgb[i] = 0;
856
+ }
857
+ if (rgb[i] > 255) {
858
+ rgb[i] = 255;
859
+ }
860
+ } else if (i === 3) {
861
+ if (rgb[i] < 0) {
862
+ rgb[i] = 0;
863
+ }
864
+ if (rgb[i] > 1) {
865
+ rgb[i] = 1;
866
+ }
867
+ }
868
+ }
869
+ return rgb;
870
+ };
871
+
872
+ css2rgb = function(css) {
873
+ var hsl, i, m, rgb, _i, _j, _k, _l;
874
+
875
+ css = css.toLowerCase();
876
+ if ((chroma.colors != null) && chroma.colors[css]) {
877
+ return hex2rgb(chroma.colors[css]);
878
+ }
879
+ if (m = css.match(/rgb\(\s*(\-?\d+),\s*(\-?\d+)\s*,\s*(\-?\d+)\s*\)/)) {
880
+ rgb = m.slice(1, 4);
881
+ for (i = _i = 0; _i <= 2; i = ++_i) {
882
+ rgb[i] = +rgb[i];
883
+ }
884
+ rgb[3] = 1;
885
+ } else if (m = css.match(/rgba\(\s*(\-?\d+),\s*(\-?\d+)\s*,\s*(\-?\d+)\s*,\s*([01]|[01]?\.\d+)\)/)) {
886
+ rgb = m.slice(1, 5);
887
+ for (i = _j = 0; _j <= 3; i = ++_j) {
888
+ rgb[i] = +rgb[i];
889
+ }
890
+ } else if (m = css.match(/rgb\(\s*(\-?\d+(?:\.\d+)?)%,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*\)/)) {
891
+ rgb = m.slice(1, 4);
892
+ for (i = _k = 0; _k <= 2; i = ++_k) {
893
+ rgb[i] = Math.round(rgb[i] * 2.55);
894
+ }
895
+ rgb[3] = 1;
896
+ } else if (m = css.match(/rgba\(\s*(\-?\d+(?:\.\d+)?)%,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)/)) {
897
+ rgb = m.slice(1, 5);
898
+ for (i = _l = 0; _l <= 2; i = ++_l) {
899
+ rgb[i] = Math.round(rgb[i] * 2.55);
900
+ }
901
+ rgb[3] = +rgb[3];
902
+ } else if (m = css.match(/hsl\(\s*(\-?\d+(?:\.\d+)?),\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*\)/)) {
903
+ hsl = m.slice(1, 4);
904
+ hsl[1] *= 0.01;
905
+ hsl[2] *= 0.01;
906
+ rgb = hsl2rgb(hsl);
907
+ rgb[3] = 1;
908
+ } else if (m = css.match(/hsla\(\s*(\-?\d+(?:\.\d+)?),\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)/)) {
909
+ hsl = m.slice(1, 4);
910
+ hsl[1] *= 0.01;
911
+ hsl[2] *= 0.01;
912
+ rgb = hsl2rgb(hsl);
913
+ rgb[3] = +m[4];
914
+ }
915
+ return rgb;
916
+ };
917
+
918
+ hex2rgb = function(hex) {
919
+ var a, b, g, r, rgb, u;
920
+
921
+ if (hex.match(/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/)) {
922
+ if (hex.length === 4 || hex.length === 7) {
923
+ hex = hex.substr(1);
924
+ }
925
+ if (hex.length === 3) {
926
+ hex = hex.split("");
927
+ hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
928
+ }
929
+ u = parseInt(hex, 16);
930
+ r = u >> 16;
931
+ g = u >> 8 & 0xFF;
932
+ b = u & 0xFF;
933
+ return [r, g, b, 1];
934
+ }
935
+ if (hex.match(/^#?([A-Fa-f0-9]{8})$/)) {
936
+ if (hex.length === 9) {
937
+ hex = hex.substr(1);
938
+ }
939
+ u = parseInt(hex, 16);
940
+ r = u >> 24 & 0xFF;
941
+ g = u >> 16 & 0xFF;
942
+ b = u >> 8 & 0xFF;
943
+ a = u & 0xFF;
944
+ return [r, g, b, a];
945
+ }
946
+ if (rgb = css2rgb(hex)) {
947
+ return rgb;
948
+ }
949
+ throw "unknown color: " + hex;
950
+ };
951
+
952
+ hsi2rgb = function(h, s, i) {
953
+ /*
954
+ borrowed from here:
955
+ http://hummer.stanford.edu/museinfo/doc/examples/humdrum/keyscape2/hsi2rgb.cpp
956
+ */
957
+
958
+ var b, g, r, _ref;
959
+
960
+ _ref = unpack(arguments), h = _ref[0], s = _ref[1], i = _ref[2];
961
+ h /= 360;
962
+ if (h < 1 / 3) {
963
+ b = (1 - s) / 3;
964
+ r = (1 + s * cos(TWOPI * h) / cos(PITHIRD - TWOPI * h)) / 3;
965
+ g = 1 - (b + r);
966
+ } else if (h < 2 / 3) {
967
+ h -= 1 / 3;
968
+ r = (1 - s) / 3;
969
+ g = (1 + s * cos(TWOPI * h) / cos(PITHIRD - TWOPI * h)) / 3;
970
+ b = 1 - (r + g);
971
+ } else {
972
+ h -= 2 / 3;
973
+ g = (1 - s) / 3;
974
+ b = (1 + s * cos(TWOPI * h) / cos(PITHIRD - TWOPI * h)) / 3;
975
+ r = 1 - (g + b);
976
+ }
977
+ r = limit(i * r * 3);
978
+ g = limit(i * g * 3);
979
+ b = limit(i * b * 3);
980
+ return [r * 255, g * 255, b * 255];
981
+ };
982
+
983
+ hsl2rgb = function() {
984
+ var b, c, g, h, i, l, r, s, t1, t2, t3, _i, _ref, _ref1;
985
+
986
+ _ref = unpack(arguments), h = _ref[0], s = _ref[1], l = _ref[2];
987
+ if (s === 0) {
988
+ r = g = b = l * 255;
989
+ } else {
990
+ t3 = [0, 0, 0];
991
+ c = [0, 0, 0];
992
+ t2 = l < 0.5 ? l * (1 + s) : l + s - l * s;
993
+ t1 = 2 * l - t2;
994
+ h /= 360;
995
+ t3[0] = h + 1 / 3;
996
+ t3[1] = h;
997
+ t3[2] = h - 1 / 3;
998
+ for (i = _i = 0; _i <= 2; i = ++_i) {
999
+ if (t3[i] < 0) {
1000
+ t3[i] += 1;
1001
+ }
1002
+ if (t3[i] > 1) {
1003
+ t3[i] -= 1;
1004
+ }
1005
+ if (6 * t3[i] < 1) {
1006
+ c[i] = t1 + (t2 - t1) * 6 * t3[i];
1007
+ } else if (2 * t3[i] < 1) {
1008
+ c[i] = t2;
1009
+ } else if (3 * t3[i] < 2) {
1010
+ c[i] = t1 + (t2 - t1) * ((2 / 3) - t3[i]) * 6;
1011
+ } else {
1012
+ c[i] = t1;
1013
+ }
1014
+ }
1015
+ _ref1 = [Math.round(c[0] * 255), Math.round(c[1] * 255), Math.round(c[2] * 255)], r = _ref1[0], g = _ref1[1], b = _ref1[2];
1016
+ }
1017
+ return [r, g, b];
1018
+ };
1019
+
1020
+ hsv2rgb = function() {
1021
+ var b, f, g, h, i, p, q, r, s, t, v, _ref, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6;
1022
+
1023
+ _ref = unpack(arguments), h = _ref[0], s = _ref[1], v = _ref[2];
1024
+ v *= 255;
1025
+ if (s === 0) {
1026
+ r = g = b = v;
1027
+ } else {
1028
+ if (h === 360) {
1029
+ h = 0;
1030
+ }
1031
+ if (h > 360) {
1032
+ h -= 360;
1033
+ }
1034
+ if (h < 0) {
1035
+ h += 360;
1036
+ }
1037
+ h /= 60;
1038
+ i = Math.floor(h);
1039
+ f = h - i;
1040
+ p = v * (1 - s);
1041
+ q = v * (1 - s * f);
1042
+ t = v * (1 - s * (1 - f));
1043
+ switch (i) {
1044
+ case 0:
1045
+ _ref1 = [v, t, p], r = _ref1[0], g = _ref1[1], b = _ref1[2];
1046
+ break;
1047
+ case 1:
1048
+ _ref2 = [q, v, p], r = _ref2[0], g = _ref2[1], b = _ref2[2];
1049
+ break;
1050
+ case 2:
1051
+ _ref3 = [p, v, t], r = _ref3[0], g = _ref3[1], b = _ref3[2];
1052
+ break;
1053
+ case 3:
1054
+ _ref4 = [p, q, v], r = _ref4[0], g = _ref4[1], b = _ref4[2];
1055
+ break;
1056
+ case 4:
1057
+ _ref5 = [t, p, v], r = _ref5[0], g = _ref5[1], b = _ref5[2];
1058
+ break;
1059
+ case 5:
1060
+ _ref6 = [v, p, q], r = _ref6[0], g = _ref6[1], b = _ref6[2];
1061
+ }
1062
+ }
1063
+ r = Math.round(r);
1064
+ g = Math.round(g);
1065
+ b = Math.round(b);
1066
+ return [r, g, b];
1067
+ };
1068
+
1069
+ K = 18;
1070
+
1071
+ X = 0.950470;
1072
+
1073
+ Y = 1;
1074
+
1075
+ Z = 1.088830;
1076
+
1077
+ lab2lch = function() {
1078
+ var a, b, c, h, l, _ref;
1079
+
1080
+ _ref = unpack(arguments), l = _ref[0], a = _ref[1], b = _ref[2];
1081
+ c = Math.sqrt(a * a + b * b);
1082
+ h = Math.atan2(b, a) / Math.PI * 180;
1083
+ return [l, c, h];
1084
+ };
1085
+
1086
+ lab2rgb = function(l, a, b) {
1087
+ /*
1088
+ adapted to match d3 implementation
1089
+ */
1090
+
1091
+ var g, r, x, y, z, _ref, _ref1;
1092
+
1093
+ if (l !== void 0 && l.length === 3) {
1094
+ _ref = l, l = _ref[0], a = _ref[1], b = _ref[2];
1095
+ }
1096
+ if (l !== void 0 && l.length === 3) {
1097
+ _ref1 = l, l = _ref1[0], a = _ref1[1], b = _ref1[2];
1098
+ }
1099
+ y = (l + 16) / 116;
1100
+ x = y + a / 500;
1101
+ z = y - b / 200;
1102
+ x = lab_xyz(x) * X;
1103
+ y = lab_xyz(y) * Y;
1104
+ z = lab_xyz(z) * Z;
1105
+ r = xyz_rgb(3.2404542 * x - 1.5371385 * y - 0.4985314 * z);
1106
+ g = xyz_rgb(-0.9692660 * x + 1.8760108 * y + 0.0415560 * z);
1107
+ b = xyz_rgb(0.0556434 * x - 0.2040259 * y + 1.0572252 * z);
1108
+ return [limit(r, 0, 255), limit(g, 0, 255), limit(b, 0, 255), 1];
1109
+ };
1110
+
1111
+ lab_xyz = function(x) {
1112
+ if (x > 0.206893034) {
1113
+ return x * x * x;
1114
+ } else {
1115
+ return (x - 4 / 29) / 7.787037;
1116
+ }
1117
+ };
1118
+
1119
+ xyz_rgb = function(r) {
1120
+ return Math.round(255 * (r <= 0.00304 ? 12.92 * r : 1.055 * Math.pow(r, 1 / 2.4) - 0.055));
1121
+ };
1122
+
1123
+ lch2lab = function() {
1124
+ /*
1125
+ Convert from a qualitative parameter h and a quantitative parameter l to a 24-bit pixel. These formulas were invented by David Dalrymple to obtain maximum contrast without going out of gamut if the parameters are in the range 0-1.
1126
+ A saturation multiplier was added by Gregor Aisch
1127
+ */
1128
+
1129
+ var c, h, l, _ref;
1130
+
1131
+ _ref = unpack(arguments), l = _ref[0], c = _ref[1], h = _ref[2];
1132
+ h = h * Math.PI / 180;
1133
+ return [l, Math.cos(h) * c, Math.sin(h) * c];
1134
+ };
1135
+
1136
+ lch2rgb = function(l, c, h) {
1137
+ var L, a, b, g, r, _ref, _ref1;
1138
+
1139
+ _ref = lch2lab(l, c, h), L = _ref[0], a = _ref[1], b = _ref[2];
1140
+ _ref1 = lab2rgb(L, a, b), r = _ref1[0], g = _ref1[1], b = _ref1[2];
1141
+ return [limit(r, 0, 255), limit(g, 0, 255), limit(b, 0, 255)];
1142
+ };
1143
+
1144
+ luminance = function(r, g, b) {
1145
+ var _ref;
1146
+
1147
+ _ref = unpack(arguments), r = _ref[0], g = _ref[1], b = _ref[2];
1148
+ r = luminance_x(r);
1149
+ g = luminance_x(g);
1150
+ b = luminance_x(b);
1151
+ return 0.2126 * r + 0.7152 * g + 0.0722 * b;
1152
+ };
1153
+
1154
+ luminance_x = function(x) {
1155
+ x /= 255;
1156
+ if (x <= 0.03928) {
1157
+ return x / 12.92;
1158
+ } else {
1159
+ return Math.pow((x + 0.055) / 1.055, 2.4);
1160
+ }
1161
+ };
1162
+
1163
+ rgb2hex = function() {
1164
+ var b, g, r, str, u, _ref;
1165
+
1166
+ _ref = unpack(arguments), r = _ref[0], g = _ref[1], b = _ref[2];
1167
+ u = r << 16 | g << 8 | b;
1168
+ str = "000000" + u.toString(16);
1169
+ return "#" + str.substr(str.length - 6);
1170
+ };
1171
+
1172
+ rgb2hsi = function() {
1173
+ /*
1174
+ borrowed from here:
1175
+ http://hummer.stanford.edu/museinfo/doc/examples/humdrum/keyscape2/rgb2hsi.cpp
1176
+ */
1177
+
1178
+ var TWOPI, b, g, h, i, min, r, s, _ref;
1179
+
1180
+ _ref = unpack(arguments), r = _ref[0], g = _ref[1], b = _ref[2];
1181
+ TWOPI = Math.PI * 2;
1182
+ r /= 255;
1183
+ g /= 255;
1184
+ b /= 255;
1185
+ min = Math.min(r, g, b);
1186
+ i = (r + g + b) / 3;
1187
+ s = 1 - min / i;
1188
+ if (s === 0) {
1189
+ h = 0;
1190
+ } else {
1191
+ h = ((r - g) + (r - b)) / 2;
1192
+ h /= Math.sqrt((r - g) * (r - g) + (r - b) * (g - b));
1193
+ h = Math.acos(h);
1194
+ if (b > g) {
1195
+ h = TWOPI - h;
1196
+ }
1197
+ h /= TWOPI;
1198
+ }
1199
+ return [h * 360, s, i];
1200
+ };
1201
+
1202
+ rgb2hsl = function(r, g, b) {
1203
+ var h, l, max, min, s, _ref;
1204
+
1205
+ if (r !== void 0 && r.length >= 3) {
1206
+ _ref = r, r = _ref[0], g = _ref[1], b = _ref[2];
1207
+ }
1208
+ r /= 255;
1209
+ g /= 255;
1210
+ b /= 255;
1211
+ min = Math.min(r, g, b);
1212
+ max = Math.max(r, g, b);
1213
+ l = (max + min) / 2;
1214
+ if (max === min) {
1215
+ s = 0;
1216
+ h = Number.NaN;
1217
+ } else {
1218
+ s = l < 0.5 ? (max - min) / (max + min) : (max - min) / (2 - max - min);
1219
+ }
1220
+ if (r === max) {
1221
+ h = (g - b) / (max - min);
1222
+ } else if (g === max) {
1223
+ h = 2 + (b - r) / (max - min);
1224
+ } else if (b === max) {
1225
+ h = 4 + (r - g) / (max - min);
1226
+ }
1227
+ h *= 60;
1228
+ if (h < 0) {
1229
+ h += 360;
1230
+ }
1231
+ return [h, s, l];
1232
+ };
1233
+
1234
+ rgb2hsv = function() {
1235
+ var b, delta, g, h, max, min, r, s, v, _ref;
1236
+
1237
+ _ref = unpack(arguments), r = _ref[0], g = _ref[1], b = _ref[2];
1238
+ min = Math.min(r, g, b);
1239
+ max = Math.max(r, g, b);
1240
+ delta = max - min;
1241
+ v = max / 255.0;
1242
+ if (max === 0) {
1243
+ h = Number.NaN;
1244
+ s = 0;
1245
+ } else {
1246
+ s = delta / max;
1247
+ if (r === max) {
1248
+ h = (g - b) / delta;
1249
+ }
1250
+ if (g === max) {
1251
+ h = 2 + (b - r) / delta;
1252
+ }
1253
+ if (b === max) {
1254
+ h = 4 + (r - g) / delta;
1255
+ }
1256
+ h *= 60;
1257
+ if (h < 0) {
1258
+ h += 360;
1259
+ }
1260
+ }
1261
+ return [h, s, v];
1262
+ };
1263
+
1264
+ rgb2lab = function() {
1265
+ var b, g, r, x, y, z, _ref;
1266
+
1267
+ _ref = unpack(arguments), r = _ref[0], g = _ref[1], b = _ref[2];
1268
+ r = rgb_xyz(r);
1269
+ g = rgb_xyz(g);
1270
+ b = rgb_xyz(b);
1271
+ x = xyz_lab((0.4124564 * r + 0.3575761 * g + 0.1804375 * b) / X);
1272
+ y = xyz_lab((0.2126729 * r + 0.7151522 * g + 0.0721750 * b) / Y);
1273
+ z = xyz_lab((0.0193339 * r + 0.1191920 * g + 0.9503041 * b) / Z);
1274
+ return [116 * y - 16, 500 * (x - y), 200 * (y - z)];
1275
+ };
1276
+
1277
+ rgb_xyz = function(r) {
1278
+ if ((r /= 255) <= 0.04045) {
1279
+ return r / 12.92;
1280
+ } else {
1281
+ return Math.pow((r + 0.055) / 1.055, 2.4);
1282
+ }
1283
+ };
1284
+
1285
+ xyz_lab = function(x) {
1286
+ if (x > 0.008856) {
1287
+ return Math.pow(x, 1 / 3);
1288
+ } else {
1289
+ return 7.787037 * x + 4 / 29;
1290
+ }
1291
+ };
1292
+
1293
+ rgb2lch = function() {
1294
+ var a, b, g, l, r, _ref, _ref1;
1295
+
1296
+ _ref = unpack(arguments), r = _ref[0], g = _ref[1], b = _ref[2];
1297
+ _ref1 = rgb2lab(r, g, b), l = _ref1[0], a = _ref1[1], b = _ref1[2];
1298
+ return lab2lch(l, a, b);
1299
+ };
1300
+
1301
+ /*
1302
+ chroma.js
1303
+
1304
+ Copyright (c) 2011-2013, Gregor Aisch
1305
+ All rights reserved.
1306
+
1307
+ Redistribution and use in source and binary forms, with or without
1308
+ modification, are permitted provided that the following conditions are met:
1309
+
1310
+ * Redistributions of source code must retain the above copyright notice, this
1311
+ list of conditions and the following disclaimer.
1312
+
1313
+ * Redistributions in binary form must reproduce the above copyright notice,
1314
+ this list of conditions and the following disclaimer in the documentation
1315
+ and/or other materials provided with the distribution.
1316
+
1317
+ * The name Gregor Aisch may not be used to endorse or promote products
1318
+ derived from this software without specific prior written permission.
1319
+
1320
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
1321
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1322
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
1323
+ DISCLAIMED. IN NO EVENT SHALL GREGOR AISCH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
1324
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
1325
+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1326
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
1327
+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
1328
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
1329
+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1330
+
1331
+ @source: https://github.com/gka/chroma.js
1332
+ */
1333
+
1334
+
1335
+ chroma.scale = function(colors, positions) {
1336
+ var classifyValue, f, getClass, getColor, resetCache, setColors, setDomain, tmap, _colorCache, _colors, _correctLightness, _domain, _fixed, _max, _min, _mode, _nacol, _numClasses, _out, _pos, _spread;
1337
+
1338
+ _mode = 'rgb';
1339
+ _nacol = chroma('#ccc');
1340
+ _spread = 0;
1341
+ _fixed = false;
1342
+ _domain = [0, 1];
1343
+ _colors = [];
1344
+ _out = false;
1345
+ _pos = [];
1346
+ _min = 0;
1347
+ _max = 1;
1348
+ _correctLightness = false;
1349
+ _numClasses = 0;
1350
+ _colorCache = {};
1351
+ setColors = function(colors, positions) {
1352
+ var c, col, _i, _j, _ref, _ref1, _ref2;
1353
+
1354
+ if (colors == null) {
1355
+ colors = ['#ddd', '#222'];
1356
+ }
1357
+ if ((colors != null) && type(colors) === 'string' && (((_ref = chroma.brewer) != null ? _ref[colors] : void 0) != null)) {
1358
+ colors = chroma.brewer[colors];
1359
+ }
1360
+ if (type(colors) === 'array') {
1361
+ colors = colors.slice(0);
1362
+ for (c = _i = 0, _ref1 = colors.length - 1; 0 <= _ref1 ? _i <= _ref1 : _i >= _ref1; c = 0 <= _ref1 ? ++_i : --_i) {
1363
+ col = colors[c];
1364
+ if (type(col) === "string") {
1365
+ colors[c] = chroma(col);
1366
+ }
1367
+ }
1368
+ if (positions != null) {
1369
+ _pos = positions;
1370
+ } else {
1371
+ _pos = [];
1372
+ for (c = _j = 0, _ref2 = colors.length - 1; 0 <= _ref2 ? _j <= _ref2 : _j >= _ref2; c = 0 <= _ref2 ? ++_j : --_j) {
1373
+ _pos.push(c / (colors.length - 1));
1374
+ }
1375
+ }
1376
+ }
1377
+ resetCache();
1378
+ return _colors = colors;
1379
+ };
1380
+ setDomain = function(domain) {
1381
+ if (domain == null) {
1382
+ domain = [];
1383
+ }
1384
+ /*
1385
+ # use this if you want to display a limited number of data classes
1386
+ # possible methods are "equalinterval", "quantiles", "custom"
1387
+ */
1388
+
1389
+ _domain = domain;
1390
+ _min = domain[0];
1391
+ _max = domain[domain.length - 1];
1392
+ resetCache();
1393
+ if (domain.length === 2) {
1394
+ return _numClasses = 0;
1395
+ } else {
1396
+ return _numClasses = domain.length - 1;
1397
+ }
1398
+ };
1399
+ getClass = function(value) {
1400
+ var i, n;
1401
+
1402
+ if (_domain != null) {
1403
+ n = _domain.length - 1;
1404
+ i = 0;
1405
+ while (i < n && value >= _domain[i]) {
1406
+ i++;
1407
+ }
1408
+ return i - 1;
1409
+ }
1410
+ return 0;
1411
+ };
1412
+ tmap = function(t) {
1413
+ return t;
1414
+ };
1415
+ classifyValue = function(value) {
1416
+ var i, maxc, minc, n, val;
1417
+
1418
+ val = value;
1419
+ if (_domain.length > 2) {
1420
+ n = _domain.length - 1;
1421
+ i = getClass(value);
1422
+ minc = _domain[0] + (_domain[1] - _domain[0]) * (0 + _spread * 0.5);
1423
+ maxc = _domain[n - 1] + (_domain[n] - _domain[n - 1]) * (1 - _spread * 0.5);
1424
+ val = _min + ((_domain[i] + (_domain[i + 1] - _domain[i]) * 0.5 - minc) / (maxc - minc)) * (_max - _min);
1425
+ }
1426
+ return val;
1427
+ };
1428
+ getColor = function(val, bypassMap) {
1429
+ var c, col, f0, i, k, p, t, _i, _ref;
1430
+
1431
+ if (bypassMap == null) {
1432
+ bypassMap = false;
1433
+ }
1434
+ if (isNaN(val)) {
1435
+ return _nacol;
1436
+ }
1437
+ if (!bypassMap) {
1438
+ if (_domain.length > 2) {
1439
+ c = getClass(val);
1440
+ t = c / (_numClasses - 1);
1441
+ } else {
1442
+ t = f0 = _min !== _max ? (val - _min) / (_max - _min) : 0;
1443
+ t = f0 = (val - _min) / (_max - _min);
1444
+ t = Math.min(1, Math.max(0, t));
1445
+ }
1446
+ } else {
1447
+ t = val;
1448
+ }
1449
+ if (!bypassMap) {
1450
+ t = tmap(t);
1451
+ }
1452
+ k = Math.floor(t * 10000);
1453
+ if (_colorCache[k]) {
1454
+ col = _colorCache[k];
1455
+ } else {
1456
+ if (type(_colors) === 'array') {
1457
+ for (i = _i = 0, _ref = _pos.length - 1; 0 <= _ref ? _i <= _ref : _i >= _ref; i = 0 <= _ref ? ++_i : --_i) {
1458
+ p = _pos[i];
1459
+ if (t <= p) {
1460
+ col = _colors[i];
1461
+ break;
1462
+ }
1463
+ if (t >= p && i === _pos.length - 1) {
1464
+ col = _colors[i];
1465
+ break;
1466
+ }
1467
+ if (t > p && t < _pos[i + 1]) {
1468
+ t = (t - p) / (_pos[i + 1] - p);
1469
+ col = chroma.interpolate(_colors[i], _colors[i + 1], t, _mode);
1470
+ break;
1471
+ }
1472
+ }
1473
+ } else if (type(_colors) === 'function') {
1474
+ col = _colors(t);
1475
+ }
1476
+ _colorCache[k] = col;
1477
+ }
1478
+ return col;
1479
+ };
1480
+ resetCache = function() {
1481
+ return _colorCache = {};
1482
+ };
1483
+ setColors(colors, positions);
1484
+ f = function(v) {
1485
+ var c;
1486
+
1487
+ c = getColor(v);
1488
+ if (_out && c[_out]) {
1489
+ return c[_out]();
1490
+ } else {
1491
+ return c;
1492
+ }
1493
+ };
1494
+ f.domain = function(domain, classes, mode, key) {
1495
+ var d;
1496
+
1497
+ if (mode == null) {
1498
+ mode = 'e';
1499
+ }
1500
+ if (!arguments.length) {
1501
+ return _domain;
1502
+ }
1503
+ if (classes != null) {
1504
+ d = chroma.analyze(domain, key);
1505
+ if (classes === 0) {
1506
+ domain = [d.min, d.max];
1507
+ } else {
1508
+ domain = chroma.limits(d, mode, classes);
1509
+ }
1510
+ }
1511
+ setDomain(domain);
1512
+ return f;
1513
+ };
1514
+ f.mode = function(_m) {
1515
+ if (!arguments.length) {
1516
+ return _mode;
1517
+ }
1518
+ _mode = _m;
1519
+ resetCache();
1520
+ return f;
1521
+ };
1522
+ f.range = function(colors, _pos) {
1523
+ setColors(colors, _pos);
1524
+ return f;
1525
+ };
1526
+ f.out = function(_o) {
1527
+ _out = _o;
1528
+ return f;
1529
+ };
1530
+ f.spread = function(val) {
1531
+ if (!arguments.length) {
1532
+ return _spread;
1533
+ }
1534
+ _spread = val;
1535
+ return f;
1536
+ };
1537
+ f.correctLightness = function(v) {
1538
+ if (!arguments.length) {
1539
+ return _correctLightness;
1540
+ }
1541
+ _correctLightness = v;
1542
+ resetCache();
1543
+ if (_correctLightness) {
1544
+ tmap = function(t) {
1545
+ var L0, L1, L_actual, L_diff, L_ideal, max_iter, pol, t0, t1;
1546
+
1547
+ L0 = getColor(0, true).lab()[0];
1548
+ L1 = getColor(1, true).lab()[0];
1549
+ pol = L0 > L1;
1550
+ L_actual = getColor(t, true).lab()[0];
1551
+ L_ideal = L0 + (L1 - L0) * t;
1552
+ L_diff = L_actual - L_ideal;
1553
+ t0 = 0;
1554
+ t1 = 1;
1555
+ max_iter = 20;
1556
+ while (Math.abs(L_diff) > 1e-2 && max_iter-- > 0) {
1557
+ (function() {
1558
+ if (pol) {
1559
+ L_diff *= -1;
1560
+ }
1561
+ if (L_diff < 0) {
1562
+ t0 = t;
1563
+ t += (t1 - t) * 0.5;
1564
+ } else {
1565
+ t1 = t;
1566
+ t += (t0 - t) * 0.5;
1567
+ }
1568
+ L_actual = getColor(t, true).lab()[0];
1569
+ return L_diff = L_actual - L_ideal;
1570
+ })();
1571
+ }
1572
+ return t;
1573
+ };
1574
+ } else {
1575
+ tmap = function(t) {
1576
+ return t;
1577
+ };
1578
+ }
1579
+ return f;
1580
+ };
1581
+ f.colors = function(out) {
1582
+ var i, samples, _i, _j, _len, _ref;
1583
+
1584
+ if (out == null) {
1585
+ out = 'hex';
1586
+ }
1587
+ colors = [];
1588
+ samples = [];
1589
+ if (_domain.length > 2) {
1590
+ for (i = _i = 1, _ref = _domain.length; 1 <= _ref ? _i < _ref : _i > _ref; i = 1 <= _ref ? ++_i : --_i) {
1591
+ samples.push((_domain[i - 1] + _domain[i]) * 0.5);
1592
+ }
1593
+ } else {
1594
+ samples = _domain;
1595
+ }
1596
+ for (_j = 0, _len = samples.length; _j < _len; _j++) {
1597
+ i = samples[_j];
1598
+ colors.push(f(i)[out]());
1599
+ }
1600
+ return colors;
1601
+ };
1602
+ return f;
1603
+ };
1604
+
1605
+ if ((_ref = chroma.scales) == null) {
1606
+ chroma.scales = {};
1607
+ }
1608
+
1609
+ chroma.scales.cool = function() {
1610
+ return chroma.scale([chroma.hsl(180, 1, .9), chroma.hsl(250, .7, .4)]);
1611
+ };
1612
+
1613
+ chroma.scales.hot = function() {
1614
+ return chroma.scale(['#000', '#f00', '#ff0', '#fff'], [0, .25, .75, 1]).mode('rgb');
1615
+ };
1616
+
1617
+ /*
1618
+ chroma.js
1619
+
1620
+ Copyright (c) 2011-2013, Gregor Aisch
1621
+ All rights reserved.
1622
+
1623
+ Redistribution and use in source and binary forms, with or without
1624
+ modification, are permitted provided that the following conditions are met:
1625
+
1626
+ * Redistributions of source code must retain the above copyright notice, this
1627
+ list of conditions and the following disclaimer.
1628
+
1629
+ * Redistributions in binary form must reproduce the above copyright notice,
1630
+ this list of conditions and the following disclaimer in the documentation
1631
+ and/or other materials provided with the distribution.
1632
+
1633
+ * The name Gregor Aisch may not be used to endorse or promote products
1634
+ derived from this software without specific prior written permission.
1635
+
1636
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
1637
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1638
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
1639
+ DISCLAIMED. IN NO EVENT SHALL GREGOR AISCH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
1640
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
1641
+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
1642
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
1643
+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
1644
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
1645
+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1646
+
1647
+ @source: https://github.com/gka/chroma.js
1648
+ */
1649
+
1650
+
1651
+ chroma.analyze = function(data, key, filter) {
1652
+ var add, k, r, val, visit, _i, _len;
1653
+
1654
+ r = {
1655
+ min: Number.MAX_VALUE,
1656
+ max: Number.MAX_VALUE * -1,
1657
+ sum: 0,
1658
+ values: [],
1659
+ count: 0
1660
+ };
1661
+ if (filter == null) {
1662
+ filter = function() {
1663
+ return true;
1664
+ };
1665
+ }
1666
+ add = function(val) {
1667
+ if ((val != null) && !isNaN(val)) {
1668
+ r.values.push(val);
1669
+ r.sum += val;
1670
+ if (val < r.min) {
1671
+ r.min = val;
1672
+ }
1673
+ if (val > r.max) {
1674
+ r.max = val;
1675
+ }
1676
+ r.count += 1;
1677
+ }
1678
+ };
1679
+ visit = function(val, k) {
1680
+ if (filter(val, k)) {
1681
+ if ((key != null) && type(key) === 'function') {
1682
+ return add(key(val));
1683
+ } else if ((key != null) && type(key) === 'string' || type(key) === 'number') {
1684
+ return add(val[key]);
1685
+ } else {
1686
+ return add(val);
1687
+ }
1688
+ }
1689
+ };
1690
+ if (type(data) === 'array') {
1691
+ for (_i = 0, _len = data.length; _i < _len; _i++) {
1692
+ val = data[_i];
1693
+ visit(val);
1694
+ }
1695
+ } else {
1696
+ for (k in data) {
1697
+ val = data[k];
1698
+ visit(val, k);
1699
+ }
1700
+ }
1701
+ r.domain = [r.min, r.max];
1702
+ r.limits = function(mode, num) {
1703
+ return chroma.limits(r, mode, num);
1704
+ };
1705
+ return r;
1706
+ };
1707
+
1708
+ chroma.limits = function(data, mode, num) {
1709
+ var assignments, best, centroids, cluster, clusterSizes, dist, i, j, kClusters, limits, max, max_log, min, min_log, mindist, n, nb_iters, newCentroids, p, pb, pr, repeat, sum, tmpKMeansBreaks, value, values, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _ref1, _ref10, _ref11, _ref12, _ref13, _ref14, _ref15, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9, _s, _t, _u, _v, _w;
1710
+
1711
+ if (mode == null) {
1712
+ mode = 'equal';
1713
+ }
1714
+ if (num == null) {
1715
+ num = 7;
1716
+ }
1717
+ if (type(data) === 'array') {
1718
+ data = chroma.analyze(data);
1719
+ }
1720
+ min = data.min;
1721
+ max = data.max;
1722
+ sum = data.sum;
1723
+ values = data.values.sort(function(a, b) {
1724
+ return a - b;
1725
+ });
1726
+ limits = [];
1727
+ if (mode.substr(0, 1) === 'c') {
1728
+ limits.push(min);
1729
+ limits.push(max);
1730
+ }
1731
+ if (mode.substr(0, 1) === 'e') {
1732
+ limits.push(min);
1733
+ for (i = _i = 1, _ref1 = num - 1; 1 <= _ref1 ? _i <= _ref1 : _i >= _ref1; i = 1 <= _ref1 ? ++_i : --_i) {
1734
+ limits.push(min + (i / num) * (max - min));
1735
+ }
1736
+ limits.push(max);
1737
+ } else if (mode.substr(0, 1) === 'l') {
1738
+ if (min <= 0) {
1739
+ throw 'Logarithmic scales are only possible for values > 0';
1740
+ }
1741
+ min_log = Math.LOG10E * Math.log(min);
1742
+ max_log = Math.LOG10E * Math.log(max);
1743
+ limits.push(min);
1744
+ for (i = _j = 1, _ref2 = num - 1; 1 <= _ref2 ? _j <= _ref2 : _j >= _ref2; i = 1 <= _ref2 ? ++_j : --_j) {
1745
+ limits.push(Math.pow(10, min_log + (i / num) * (max_log - min_log)));
1746
+ }
1747
+ limits.push(max);
1748
+ } else if (mode.substr(0, 1) === 'q') {
1749
+ limits.push(min);
1750
+ for (i = _k = 1, _ref3 = num - 1; 1 <= _ref3 ? _k <= _ref3 : _k >= _ref3; i = 1 <= _ref3 ? ++_k : --_k) {
1751
+ p = values.length * i / num;
1752
+ pb = Math.floor(p);
1753
+ if (pb === p) {
1754
+ limits.push(values[pb]);
1755
+ } else {
1756
+ pr = p - pb;
1757
+ limits.push(values[pb] * pr + values[pb + 1] * (1 - pr));
1758
+ }
1759
+ }
1760
+ limits.push(max);
1761
+ } else if (mode.substr(0, 1) === 'k') {
1762
+ /*
1763
+ implementation based on
1764
+ http://code.google.com/p/figue/source/browse/trunk/figue.js#336
1765
+ simplified for 1-d input values
1766
+ */
1767
+
1768
+ n = values.length;
1769
+ assignments = new Array(n);
1770
+ clusterSizes = new Array(num);
1771
+ repeat = true;
1772
+ nb_iters = 0;
1773
+ centroids = null;
1774
+ centroids = [];
1775
+ centroids.push(min);
1776
+ for (i = _l = 1, _ref4 = num - 1; 1 <= _ref4 ? _l <= _ref4 : _l >= _ref4; i = 1 <= _ref4 ? ++_l : --_l) {
1777
+ centroids.push(min + (i / num) * (max - min));
1778
+ }
1779
+ centroids.push(max);
1780
+ while (repeat) {
1781
+ for (j = _m = 0, _ref5 = num - 1; 0 <= _ref5 ? _m <= _ref5 : _m >= _ref5; j = 0 <= _ref5 ? ++_m : --_m) {
1782
+ clusterSizes[j] = 0;
1783
+ }
1784
+ for (i = _n = 0, _ref6 = n - 1; 0 <= _ref6 ? _n <= _ref6 : _n >= _ref6; i = 0 <= _ref6 ? ++_n : --_n) {
1785
+ value = values[i];
1786
+ mindist = Number.MAX_VALUE;
1787
+ for (j = _o = 0, _ref7 = num - 1; 0 <= _ref7 ? _o <= _ref7 : _o >= _ref7; j = 0 <= _ref7 ? ++_o : --_o) {
1788
+ dist = Math.abs(centroids[j] - value);
1789
+ if (dist < mindist) {
1790
+ mindist = dist;
1791
+ best = j;
1792
+ }
1793
+ }
1794
+ clusterSizes[best]++;
1795
+ assignments[i] = best;
1796
+ }
1797
+ newCentroids = new Array(num);
1798
+ for (j = _p = 0, _ref8 = num - 1; 0 <= _ref8 ? _p <= _ref8 : _p >= _ref8; j = 0 <= _ref8 ? ++_p : --_p) {
1799
+ newCentroids[j] = null;
1800
+ }
1801
+ for (i = _q = 0, _ref9 = n - 1; 0 <= _ref9 ? _q <= _ref9 : _q >= _ref9; i = 0 <= _ref9 ? ++_q : --_q) {
1802
+ cluster = assignments[i];
1803
+ if (newCentroids[cluster] === null) {
1804
+ newCentroids[cluster] = values[i];
1805
+ } else {
1806
+ newCentroids[cluster] += values[i];
1807
+ }
1808
+ }
1809
+ for (j = _r = 0, _ref10 = num - 1; 0 <= _ref10 ? _r <= _ref10 : _r >= _ref10; j = 0 <= _ref10 ? ++_r : --_r) {
1810
+ newCentroids[j] *= 1 / clusterSizes[j];
1811
+ }
1812
+ repeat = false;
1813
+ for (j = _s = 0, _ref11 = num - 1; 0 <= _ref11 ? _s <= _ref11 : _s >= _ref11; j = 0 <= _ref11 ? ++_s : --_s) {
1814
+ if (newCentroids[j] !== centroids[i]) {
1815
+ repeat = true;
1816
+ break;
1817
+ }
1818
+ }
1819
+ centroids = newCentroids;
1820
+ nb_iters++;
1821
+ if (nb_iters > 200) {
1822
+ repeat = false;
1823
+ }
1824
+ }
1825
+ kClusters = {};
1826
+ for (j = _t = 0, _ref12 = num - 1; 0 <= _ref12 ? _t <= _ref12 : _t >= _ref12; j = 0 <= _ref12 ? ++_t : --_t) {
1827
+ kClusters[j] = [];
1828
+ }
1829
+ for (i = _u = 0, _ref13 = n - 1; 0 <= _ref13 ? _u <= _ref13 : _u >= _ref13; i = 0 <= _ref13 ? ++_u : --_u) {
1830
+ cluster = assignments[i];
1831
+ kClusters[cluster].push(values[i]);
1832
+ }
1833
+ tmpKMeansBreaks = [];
1834
+ for (j = _v = 0, _ref14 = num - 1; 0 <= _ref14 ? _v <= _ref14 : _v >= _ref14; j = 0 <= _ref14 ? ++_v : --_v) {
1835
+ tmpKMeansBreaks.push(kClusters[j][0]);
1836
+ tmpKMeansBreaks.push(kClusters[j][kClusters[j].length - 1]);
1837
+ }
1838
+ tmpKMeansBreaks = tmpKMeansBreaks.sort(function(a, b) {
1839
+ return a - b;
1840
+ });
1841
+ limits.push(tmpKMeansBreaks[0]);
1842
+ for (i = _w = 1, _ref15 = tmpKMeansBreaks.length - 1; _w <= _ref15; i = _w += 2) {
1843
+ if (!isNaN(tmpKMeansBreaks[i])) {
1844
+ limits.push(tmpKMeansBreaks[i]);
1845
+ }
1846
+ }
1847
+ }
1848
+ return limits;
1849
+ };
1850
+
1851
+ /**
1852
+ ColorBrewer colors for chroma.js
1853
+
1854
+ Copyright (c) 2002 Cynthia Brewer, Mark Harrower, and The
1855
+ Pennsylvania State University.
1856
+
1857
+ Licensed under the Apache License, Version 2.0 (the "License");
1858
+ you may not use this file except in compliance with the License.
1859
+ You may obtain a copy of the License at
1860
+ http://www.apache.org/licenses/LICENSE-2.0
1861
+
1862
+ Unless required by applicable law or agreed to in writing, software distributed
1863
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
1864
+ CONDITIONS OF ANY KIND, either express or implied. See the License for the
1865
+ specific language governing permissions and limitations under the License.
1866
+
1867
+ @preserve
1868
+ */
1869
+
1870
+
1871
+ chroma.brewer = brewer = {
1872
+ OrRd: ['#fff7ec', '#fee8c8', '#fdd49e', '#fdbb84', '#fc8d59', '#ef6548', '#d7301f', '#b30000', '#7f0000'],
1873
+ PuBu: ['#fff7fb', '#ece7f2', '#d0d1e6', '#a6bddb', '#74a9cf', '#3690c0', '#0570b0', '#045a8d', '#023858'],
1874
+ BuPu: ['#f7fcfd', '#e0ecf4', '#bfd3e6', '#9ebcda', '#8c96c6', '#8c6bb1', '#88419d', '#810f7c', '#4d004b'],
1875
+ Oranges: ['#fff5eb', '#fee6ce', '#fdd0a2', '#fdae6b', '#fd8d3c', '#f16913', '#d94801', '#a63603', '#7f2704'],
1876
+ BuGn: ['#f7fcfd', '#e5f5f9', '#ccece6', '#99d8c9', '#66c2a4', '#41ae76', '#238b45', '#006d2c', '#00441b'],
1877
+ YlOrBr: ['#ffffe5', '#fff7bc', '#fee391', '#fec44f', '#fe9929', '#ec7014', '#cc4c02', '#993404', '#662506'],
1878
+ YlGn: ['#ffffe5', '#f7fcb9', '#d9f0a3', '#addd8e', '#78c679', '#41ab5d', '#238443', '#006837', '#004529'],
1879
+ Reds: ['#fff5f0', '#fee0d2', '#fcbba1', '#fc9272', '#fb6a4a', '#ef3b2c', '#cb181d', '#a50f15', '#67000d'],
1880
+ RdPu: ['#fff7f3', '#fde0dd', '#fcc5c0', '#fa9fb5', '#f768a1', '#dd3497', '#ae017e', '#7a0177', '#49006a'],
1881
+ Greens: ['#f7fcf5', '#e5f5e0', '#c7e9c0', '#a1d99b', '#74c476', '#41ab5d', '#238b45', '#006d2c', '#00441b'],
1882
+ YlGnBu: ['#ffffd9', '#edf8b1', '#c7e9b4', '#7fcdbb', '#41b6c4', '#1d91c0', '#225ea8', '#253494', '#081d58'],
1883
+ Purples: ['#fcfbfd', '#efedf5', '#dadaeb', '#bcbddc', '#9e9ac8', '#807dba', '#6a51a3', '#54278f', '#3f007d'],
1884
+ GnBu: ['#f7fcf0', '#e0f3db', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#0868ac', '#084081'],
1885
+ Greys: ['#ffffff', '#f0f0f0', '#d9d9d9', '#bdbdbd', '#969696', '#737373', '#525252', '#252525', '#000000'],
1886
+ YlOrRd: ['#ffffcc', '#ffeda0', '#fed976', '#feb24c', '#fd8d3c', '#fc4e2a', '#e31a1c', '#bd0026', '#800026'],
1887
+ PuRd: ['#f7f4f9', '#e7e1ef', '#d4b9da', '#c994c7', '#df65b0', '#e7298a', '#ce1256', '#980043', '#67001f'],
1888
+ Blues: ['#f7fbff', '#deebf7', '#c6dbef', '#9ecae1', '#6baed6', '#4292c6', '#2171b5', '#08519c', '#08306b'],
1889
+ PuBuGn: ['#fff7fb', '#ece2f0', '#d0d1e6', '#a6bddb', '#67a9cf', '#3690c0', '#02818a', '#016c59', '#014636'],
1890
+ Spectral: ['#9e0142', '#d53e4f', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#e6f598', '#abdda4', '#66c2a5', '#3288bd', '#5e4fa2'],
1891
+ RdYlGn: ['#a50026', '#d73027', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#d9ef8b', '#a6d96a', '#66bd63', '#1a9850', '#006837'],
1892
+ RdBu: ['#67001f', '#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#f7f7f7', '#d1e5f0', '#92c5de', '#4393c3', '#2166ac', '#053061'],
1893
+ PiYG: ['#8e0152', '#c51b7d', '#de77ae', '#f1b6da', '#fde0ef', '#f7f7f7', '#e6f5d0', '#b8e186', '#7fbc41', '#4d9221', '#276419'],
1894
+ PRGn: ['#40004b', '#762a83', '#9970ab', '#c2a5cf', '#e7d4e8', '#f7f7f7', '#d9f0d3', '#a6dba0', '#5aae61', '#1b7837', '#00441b'],
1895
+ RdYlBu: ['#a50026', '#d73027', '#f46d43', '#fdae61', '#fee090', '#ffffbf', '#e0f3f8', '#abd9e9', '#74add1', '#4575b4', '#313695'],
1896
+ BrBG: ['#543005', '#8c510a', '#bf812d', '#dfc27d', '#f6e8c3', '#f5f5f5', '#c7eae5', '#80cdc1', '#35978f', '#01665e', '#003c30'],
1897
+ RdGy: ['#67001f', '#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#ffffff', '#e0e0e0', '#bababa', '#878787', '#4d4d4d', '#1a1a1a'],
1898
+ PuOr: ['#7f3b08', '#b35806', '#e08214', '#fdb863', '#fee0b6', '#f7f7f7', '#d8daeb', '#b2abd2', '#8073ac', '#542788', '#2d004b'],
1899
+ Set2: ['#66c2a5', '#fc8d62', '#8da0cb', '#e78ac3', '#a6d854', '#ffd92f', '#e5c494', '#b3b3b3'],
1900
+ Accent: ['#7fc97f', '#beaed4', '#fdc086', '#ffff99', '#386cb0', '#f0027f', '#bf5b17', '#666666'],
1901
+ Set1: ['#e41a1c', '#377eb8', '#4daf4a', '#984ea3', '#ff7f00', '#ffff33', '#a65628', '#f781bf', '#999999'],
1902
+ Set3: ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462', '#b3de69', '#fccde5', '#d9d9d9', '#bc80bd', '#ccebc5', '#ffed6f'],
1903
+ Dark2: ['#1b9e77', '#d95f02', '#7570b3', '#e7298a', '#66a61e', '#e6ab02', '#a6761d', '#666666'],
1904
+ Paired: ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c', '#fdbf6f', '#ff7f00', '#cab2d6', '#6a3d9a', '#ffff99', '#b15928'],
1905
+ Pastel2: ['#b3e2cd', '#fdcdac', '#cbd5e8', '#f4cae4', '#e6f5c9', '#fff2ae', '#f1e2cc', '#cccccc'],
1906
+ Pastel1: ['#fbb4ae', '#b3cde3', '#ccebc5', '#decbe4', '#fed9a6', '#ffffcc', '#e5d8bd', '#fddaec', '#f2f2f2']
1907
+ };
1908
+
1909
+ /**
1910
+ X11 color names
1911
+
1912
+ http://www.w3.org/TR/css3-color/#svg-color
1913
+ */
1914
+
1915
+
1916
+ chroma.colors = colors = {
1917
+ indigo: "#4b0082",
1918
+ gold: "#ffd700",
1919
+ hotpink: "#ff69b4",
1920
+ firebrick: "#b22222",
1921
+ indianred: "#cd5c5c",
1922
+ yellow: "#ffff00",
1923
+ mistyrose: "#ffe4e1",
1924
+ darkolivegreen: "#556b2f",
1925
+ olive: "#808000",
1926
+ darkseagreen: "#8fbc8f",
1927
+ pink: "#ffc0cb",
1928
+ tomato: "#ff6347",
1929
+ lightcoral: "#f08080",
1930
+ orangered: "#ff4500",
1931
+ navajowhite: "#ffdead",
1932
+ lime: "#00ff00",
1933
+ palegreen: "#98fb98",
1934
+ darkslategrey: "#2f4f4f",
1935
+ greenyellow: "#adff2f",
1936
+ burlywood: "#deb887",
1937
+ seashell: "#fff5ee",
1938
+ mediumspringgreen: "#00fa9a",
1939
+ fuchsia: "#ff00ff",
1940
+ papayawhip: "#ffefd5",
1941
+ blanchedalmond: "#ffebcd",
1942
+ chartreuse: "#7fff00",
1943
+ dimgray: "#696969",
1944
+ black: "#000000",
1945
+ peachpuff: "#ffdab9",
1946
+ springgreen: "#00ff7f",
1947
+ aquamarine: "#7fffd4",
1948
+ white: "#ffffff",
1949
+ orange: "#ffa500",
1950
+ lightsalmon: "#ffa07a",
1951
+ darkslategray: "#2f4f4f",
1952
+ brown: "#a52a2a",
1953
+ ivory: "#fffff0",
1954
+ dodgerblue: "#1e90ff",
1955
+ peru: "#cd853f",
1956
+ lawngreen: "#7cfc00",
1957
+ chocolate: "#d2691e",
1958
+ crimson: "#dc143c",
1959
+ forestgreen: "#228b22",
1960
+ darkgrey: "#a9a9a9",
1961
+ lightseagreen: "#20b2aa",
1962
+ cyan: "#00ffff",
1963
+ mintcream: "#f5fffa",
1964
+ silver: "#c0c0c0",
1965
+ antiquewhite: "#faebd7",
1966
+ mediumorchid: "#ba55d3",
1967
+ skyblue: "#87ceeb",
1968
+ gray: "#808080",
1969
+ darkturquoise: "#00ced1",
1970
+ goldenrod: "#daa520",
1971
+ darkgreen: "#006400",
1972
+ floralwhite: "#fffaf0",
1973
+ darkviolet: "#9400d3",
1974
+ darkgray: "#a9a9a9",
1975
+ moccasin: "#ffe4b5",
1976
+ saddlebrown: "#8b4513",
1977
+ grey: "#808080",
1978
+ darkslateblue: "#483d8b",
1979
+ lightskyblue: "#87cefa",
1980
+ lightpink: "#ffb6c1",
1981
+ mediumvioletred: "#c71585",
1982
+ slategrey: "#708090",
1983
+ red: "#ff0000",
1984
+ deeppink: "#ff1493",
1985
+ limegreen: "#32cd32",
1986
+ darkmagenta: "#8b008b",
1987
+ palegoldenrod: "#eee8aa",
1988
+ plum: "#dda0dd",
1989
+ turquoise: "#40e0d0",
1990
+ lightgrey: "#d3d3d3",
1991
+ lightgoldenrodyellow: "#fafad2",
1992
+ darkgoldenrod: "#b8860b",
1993
+ lavender: "#e6e6fa",
1994
+ maroon: "#800000",
1995
+ yellowgreen: "#9acd32",
1996
+ sandybrown: "#f4a460",
1997
+ thistle: "#d8bfd8",
1998
+ violet: "#ee82ee",
1999
+ navy: "#000080",
2000
+ magenta: "#ff00ff",
2001
+ dimgrey: "#696969",
2002
+ tan: "#d2b48c",
2003
+ rosybrown: "#bc8f8f",
2004
+ olivedrab: "#6b8e23",
2005
+ blue: "#0000ff",
2006
+ lightblue: "#add8e6",
2007
+ ghostwhite: "#f8f8ff",
2008
+ honeydew: "#f0fff0",
2009
+ cornflowerblue: "#6495ed",
2010
+ slateblue: "#6a5acd",
2011
+ linen: "#faf0e6",
2012
+ darkblue: "#00008b",
2013
+ powderblue: "#b0e0e6",
2014
+ seagreen: "#2e8b57",
2015
+ darkkhaki: "#bdb76b",
2016
+ snow: "#fffafa",
2017
+ sienna: "#a0522d",
2018
+ mediumblue: "#0000cd",
2019
+ royalblue: "#4169e1",
2020
+ lightcyan: "#e0ffff",
2021
+ green: "#008000",
2022
+ mediumpurple: "#9370db",
2023
+ midnightblue: "#191970",
2024
+ cornsilk: "#fff8dc",
2025
+ paleturquoise: "#afeeee",
2026
+ bisque: "#ffe4c4",
2027
+ slategray: "#708090",
2028
+ darkcyan: "#008b8b",
2029
+ khaki: "#f0e68c",
2030
+ wheat: "#f5deb3",
2031
+ teal: "#008080",
2032
+ darkorchid: "#9932cc",
2033
+ deepskyblue: "#00bfff",
2034
+ salmon: "#fa8072",
2035
+ darkred: "#8b0000",
2036
+ steelblue: "#4682b4",
2037
+ palevioletred: "#db7093",
2038
+ lightslategray: "#778899",
2039
+ aliceblue: "#f0f8ff",
2040
+ lightslategrey: "#778899",
2041
+ lightgreen: "#90ee90",
2042
+ orchid: "#da70d6",
2043
+ gainsboro: "#dcdcdc",
2044
+ mediumseagreen: "#3cb371",
2045
+ lightgray: "#d3d3d3",
2046
+ mediumturquoise: "#48d1cc",
2047
+ lemonchiffon: "#fffacd",
2048
+ cadetblue: "#5f9ea0",
2049
+ lightyellow: "#ffffe0",
2050
+ lavenderblush: "#fff0f5",
2051
+ coral: "#ff7f50",
2052
+ purple: "#800080",
2053
+ aqua: "#00ffff",
2054
+ whitesmoke: "#f5f5f5",
2055
+ mediumslateblue: "#7b68ee",
2056
+ darkorange: "#ff8c00",
2057
+ mediumaquamarine: "#66cdaa",
2058
+ darksalmon: "#e9967a",
2059
+ beige: "#f5f5dc",
2060
+ blueviolet: "#8a2be2",
2061
+ azure: "#f0ffff",
2062
+ lightsteelblue: "#b0c4de",
2063
+ oldlace: "#fdf5e6"
2064
+ };
2065
+
2066
+ /*
2067
+ chroma.js
2068
+
2069
+ Copyright (c) 2011-2013, Gregor Aisch
2070
+ All rights reserved.
2071
+
2072
+ Redistribution and use in source and binary forms, with or without
2073
+ modification, are permitted provided that the following conditions are met:
2074
+
2075
+ * Redistributions of source code must retain the above copyright notice, this
2076
+ list of conditions and the following disclaimer.
2077
+
2078
+ * Redistributions in binary form must reproduce the above copyright notice,
2079
+ this list of conditions and the following disclaimer in the documentation
2080
+ and/or other materials provided with the distribution.
2081
+
2082
+ * The name Gregor Aisch may not be used to endorse or promote products
2083
+ derived from this software without specific prior written permission.
2084
+
2085
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
2086
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2087
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
2088
+ DISCLAIMED. IN NO EVENT SHALL GREGOR AISCH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
2089
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
2090
+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2091
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
2092
+ OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
2093
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
2094
+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2095
+
2096
+ @source: https://github.com/gka/chroma.js
2097
+ */
2098
+
2099
+
2100
+ type = (function() {
2101
+ /*
2102
+ for browser-safe type checking+
2103
+ ported from jQuery's $.type
2104
+ */
2105
+
2106
+ var classToType, name, _i, _len, _ref1;
2107
+
2108
+ classToType = {};
2109
+ _ref1 = "Boolean Number String Function Array Date RegExp Undefined Null".split(" ");
2110
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
2111
+ name = _ref1[_i];
2112
+ classToType["[object " + name + "]"] = name.toLowerCase();
2113
+ }
2114
+ return function(obj) {
2115
+ var strType;
2116
+
2117
+ strType = Object.prototype.toString.call(obj);
2118
+ return classToType[strType] || "object";
2119
+ };
2120
+ })();
2121
+
2122
+ limit = function(x, min, max) {
2123
+ if (min == null) {
2124
+ min = 0;
2125
+ }
2126
+ if (max == null) {
2127
+ max = 1;
2128
+ }
2129
+ if (x < min) {
2130
+ x = min;
2131
+ }
2132
+ if (x > max) {
2133
+ x = max;
2134
+ }
2135
+ return x;
2136
+ };
2137
+
2138
+ unpack = function(args) {
2139
+ if (args.length >= 3) {
2140
+ return args;
2141
+ } else {
2142
+ return args[0];
2143
+ }
2144
+ };
2145
+
2146
+ TWOPI = Math.PI * 2;
2147
+
2148
+ PITHIRD = Math.PI / 3;
2149
+
2150
+ cos = Math.cos;
2151
+
2152
+ /*
2153
+ interpolates between a set of colors uzing a bezier spline
2154
+ */
2155
+
2156
+
2157
+ bezier = function(colors) {
2158
+ var I, I0, I1, c, lab0, lab1, lab2, lab3, _ref1, _ref2, _ref3;
2159
+
2160
+ colors = (function() {
2161
+ var _i, _len, _results;
2162
+
2163
+ _results = [];
2164
+ for (_i = 0, _len = colors.length; _i < _len; _i++) {
2165
+ c = colors[_i];
2166
+ _results.push(chroma(c));
2167
+ }
2168
+ return _results;
2169
+ })();
2170
+ if (colors.length === 2) {
2171
+ _ref1 = (function() {
2172
+ var _i, _len, _results;
2173
+
2174
+ _results = [];
2175
+ for (_i = 0, _len = colors.length; _i < _len; _i++) {
2176
+ c = colors[_i];
2177
+ _results.push(c.lab());
2178
+ }
2179
+ return _results;
2180
+ })(), lab0 = _ref1[0], lab1 = _ref1[1];
2181
+ I = function(t) {
2182
+ var i, lab;
2183
+
2184
+ lab = (function() {
2185
+ var _i, _results;
2186
+
2187
+ _results = [];
2188
+ for (i = _i = 0; _i <= 2; i = ++_i) {
2189
+ _results.push(lab0[i] + t * (lab1[i] - lab0[i]));
2190
+ }
2191
+ return _results;
2192
+ })();
2193
+ return chroma.lab.apply(chroma, lab);
2194
+ };
2195
+ } else if (colors.length === 3) {
2196
+ _ref2 = (function() {
2197
+ var _i, _len, _results;
2198
+
2199
+ _results = [];
2200
+ for (_i = 0, _len = colors.length; _i < _len; _i++) {
2201
+ c = colors[_i];
2202
+ _results.push(c.lab());
2203
+ }
2204
+ return _results;
2205
+ })(), lab0 = _ref2[0], lab1 = _ref2[1], lab2 = _ref2[2];
2206
+ I = function(t) {
2207
+ var i, lab;
2208
+
2209
+ lab = (function() {
2210
+ var _i, _results;
2211
+
2212
+ _results = [];
2213
+ for (i = _i = 0; _i <= 2; i = ++_i) {
2214
+ _results.push((1 - t) * (1 - t) * lab0[i] + 2 * (1 - t) * t * lab1[i] + t * t * lab2[i]);
2215
+ }
2216
+ return _results;
2217
+ })();
2218
+ return chroma.lab.apply(chroma, lab);
2219
+ };
2220
+ } else if (colors.length === 4) {
2221
+ _ref3 = (function() {
2222
+ var _i, _len, _results;
2223
+
2224
+ _results = [];
2225
+ for (_i = 0, _len = colors.length; _i < _len; _i++) {
2226
+ c = colors[_i];
2227
+ _results.push(c.lab());
2228
+ }
2229
+ return _results;
2230
+ })(), lab0 = _ref3[0], lab1 = _ref3[1], lab2 = _ref3[2], lab3 = _ref3[3];
2231
+ I = function(t) {
2232
+ var i, lab;
2233
+
2234
+ lab = (function() {
2235
+ var _i, _results;
2236
+
2237
+ _results = [];
2238
+ for (i = _i = 0; _i <= 2; i = ++_i) {
2239
+ _results.push((1 - t) * (1 - t) * (1 - t) * lab0[i] + 3 * (1 - t) * (1 - t) * t * lab1[i] + 3 * (1 - t) * t * t * lab2[i] + t * t * t * lab3[i]);
2240
+ }
2241
+ return _results;
2242
+ })();
2243
+ return chroma.lab.apply(chroma, lab);
2244
+ };
2245
+ } else if (colors.length === 5) {
2246
+ I0 = bezier(colors.slice(0, 3));
2247
+ I1 = bezier(colors.slice(2, 5));
2248
+ I = function(t) {
2249
+ if (t < 0.5) {
2250
+ return I0(t * 2);
2251
+ } else {
2252
+ return I1((t - 0.5) * 2);
2253
+ }
2254
+ };
2255
+ }
2256
+ return I;
2257
+ };
2258
+
2259
+ chroma.interpolate.bezier = bezier;
2260
+
2261
+ }).call(this);
2262
+
2263
+ },{}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/delaunay-fast/delaunay.js":[function(require,module,exports){
2264
+ var Delaunay;
2265
+
2266
+ (function() {
2267
+ "use strict";
2268
+
2269
+ var EPSILON = 1.0 / 1048576.0;
2270
+
2271
+ function supertriangle(vertices) {
2272
+ var xmin = Number.POSITIVE_INFINITY,
2273
+ ymin = Number.POSITIVE_INFINITY,
2274
+ xmax = Number.NEGATIVE_INFINITY,
2275
+ ymax = Number.NEGATIVE_INFINITY,
2276
+ i, dx, dy, dmax, xmid, ymid;
2277
+
2278
+ for(i = vertices.length; i--; ) {
2279
+ if(vertices[i][0] < xmin) xmin = vertices[i][0];
2280
+ if(vertices[i][0] > xmax) xmax = vertices[i][0];
2281
+ if(vertices[i][1] < ymin) ymin = vertices[i][1];
2282
+ if(vertices[i][1] > ymax) ymax = vertices[i][1];
2283
+ }
2284
+
2285
+ dx = xmax - xmin;
2286
+ dy = ymax - ymin;
2287
+ dmax = Math.max(dx, dy);
2288
+ xmid = xmin + dx * 0.5;
2289
+ ymid = ymin + dy * 0.5;
2290
+
2291
+ return [
2292
+ [xmid - 20 * dmax, ymid - dmax],
2293
+ [xmid , ymid + 20 * dmax],
2294
+ [xmid + 20 * dmax, ymid - dmax]
2295
+ ];
2296
+ }
2297
+
2298
+ function circumcircle(vertices, i, j, k) {
2299
+ var x1 = vertices[i][0],
2300
+ y1 = vertices[i][1],
2301
+ x2 = vertices[j][0],
2302
+ y2 = vertices[j][1],
2303
+ x3 = vertices[k][0],
2304
+ y3 = vertices[k][1],
2305
+ fabsy1y2 = Math.abs(y1 - y2),
2306
+ fabsy2y3 = Math.abs(y2 - y3),
2307
+ xc, yc, m1, m2, mx1, mx2, my1, my2, dx, dy;
2308
+
2309
+ /* Check for coincident points */
2310
+ if(fabsy1y2 < EPSILON && fabsy2y3 < EPSILON)
2311
+ throw new Error("Eek! Coincident points!");
2312
+
2313
+ if(fabsy1y2 < EPSILON) {
2314
+ m2 = -((x3 - x2) / (y3 - y2));
2315
+ mx2 = (x2 + x3) / 2.0;
2316
+ my2 = (y2 + y3) / 2.0;
2317
+ xc = (x2 + x1) / 2.0;
2318
+ yc = m2 * (xc - mx2) + my2;
2319
+ }
2320
+
2321
+ else if(fabsy2y3 < EPSILON) {
2322
+ m1 = -((x2 - x1) / (y2 - y1));
2323
+ mx1 = (x1 + x2) / 2.0;
2324
+ my1 = (y1 + y2) / 2.0;
2325
+ xc = (x3 + x2) / 2.0;
2326
+ yc = m1 * (xc - mx1) + my1;
2327
+ }
2328
+
2329
+ else {
2330
+ m1 = -((x2 - x1) / (y2 - y1));
2331
+ m2 = -((x3 - x2) / (y3 - y2));
2332
+ mx1 = (x1 + x2) / 2.0;
2333
+ mx2 = (x2 + x3) / 2.0;
2334
+ my1 = (y1 + y2) / 2.0;
2335
+ my2 = (y2 + y3) / 2.0;
2336
+ xc = (m1 * mx1 - m2 * mx2 + my2 - my1) / (m1 - m2);
2337
+ yc = (fabsy1y2 > fabsy2y3) ?
2338
+ m1 * (xc - mx1) + my1 :
2339
+ m2 * (xc - mx2) + my2;
2340
+ }
2341
+
2342
+ dx = x2 - xc;
2343
+ dy = y2 - yc;
2344
+ return {i: i, j: j, k: k, x: xc, y: yc, r: dx * dx + dy * dy};
2345
+ }
2346
+
2347
+ function dedup(edges) {
2348
+ var i, j, a, b, m, n;
2349
+
2350
+ for(j = edges.length; j; ) {
2351
+ b = edges[--j];
2352
+ a = edges[--j];
2353
+
2354
+ for(i = j; i; ) {
2355
+ n = edges[--i];
2356
+ m = edges[--i];
2357
+
2358
+ if((a === m && b === n) || (a === n && b === m)) {
2359
+ edges.splice(j, 2);
2360
+ edges.splice(i, 2);
2361
+ break;
2362
+ }
2363
+ }
2364
+ }
2365
+ }
2366
+
2367
+ Delaunay = {
2368
+ triangulate: function(vertices, key) {
2369
+ var n = vertices.length,
2370
+ i, j, indices, st, open, closed, edges, dx, dy, a, b, c;
2371
+
2372
+ /* Bail if there aren't enough vertices to form any triangles. */
2373
+ if(n < 3)
2374
+ return [];
2375
+
2376
+ /* Slice out the actual vertices from the passed objects. (Duplicate the
2377
+ * array even if we don't, though, since we need to make a supertriangle
2378
+ * later on!) */
2379
+ vertices = vertices.slice(0);
2380
+
2381
+ if(key)
2382
+ for(i = n; i--; )
2383
+ vertices[i] = vertices[i][key];
2384
+
2385
+ /* Make an array of indices into the vertex array, sorted by the
2386
+ * vertices' x-position. */
2387
+ indices = new Array(n);
2388
+
2389
+ for(i = n; i--; )
2390
+ indices[i] = i;
2391
+
2392
+ indices.sort(function(i, j) {
2393
+ return vertices[j][0] - vertices[i][0];
2394
+ });
2395
+
2396
+ /* Next, find the vertices of the supertriangle (which contains all other
2397
+ * triangles), and append them onto the end of a (copy of) the vertex
2398
+ * array. */
2399
+ st = supertriangle(vertices);
2400
+ vertices.push(st[0], st[1], st[2]);
2401
+
2402
+ /* Initialize the open list (containing the supertriangle and nothing
2403
+ * else) and the closed list (which is empty since we havn't processed
2404
+ * any triangles yet). */
2405
+ open = [circumcircle(vertices, n + 0, n + 1, n + 2)];
2406
+ closed = [];
2407
+ edges = [];
2408
+
2409
+ /* Incrementally add each vertex to the mesh. */
2410
+ for(i = indices.length; i--; edges.length = 0) {
2411
+ c = indices[i];
2412
+
2413
+ /* For each open triangle, check to see if the current point is
2414
+ * inside it's circumcircle. If it is, remove the triangle and add
2415
+ * it's edges to an edge list. */
2416
+ for(j = open.length; j--; ) {
2417
+ /* If this point is to the right of this triangle's circumcircle,
2418
+ * then this triangle should never get checked again. Remove it
2419
+ * from the open list, add it to the closed list, and skip. */
2420
+ dx = vertices[c][0] - open[j].x;
2421
+ if(dx > 0.0 && dx * dx > open[j].r) {
2422
+ closed.push(open[j]);
2423
+ open.splice(j, 1);
2424
+ continue;
2425
+ }
2426
+
2427
+ /* If we're outside the circumcircle, skip this triangle. */
2428
+ dy = vertices[c][1] - open[j].y;
2429
+ if(dx * dx + dy * dy - open[j].r > EPSILON)
2430
+ continue;
2431
+
2432
+ /* Remove the triangle and add it's edges to the edge list. */
2433
+ edges.push(
2434
+ open[j].i, open[j].j,
2435
+ open[j].j, open[j].k,
2436
+ open[j].k, open[j].i
2437
+ );
2438
+ open.splice(j, 1);
2439
+ }
2440
+
2441
+ /* Remove any doubled edges. */
2442
+ dedup(edges);
2443
+
2444
+ /* Add a new triangle for each edge. */
2445
+ for(j = edges.length; j; ) {
2446
+ b = edges[--j];
2447
+ a = edges[--j];
2448
+ open.push(circumcircle(vertices, a, b, c));
2449
+ }
2450
+ }
2451
+
2452
+ /* Copy any remaining open triangles to the closed list, and then
2453
+ * remove any triangles that share a vertex with the supertriangle,
2454
+ * building a list of triplets that represent triangles. */
2455
+ for(i = open.length; i--; )
2456
+ closed.push(open[i]);
2457
+ open.length = 0;
2458
+
2459
+ for(i = closed.length; i--; )
2460
+ if(closed[i].i < n && closed[i].j < n && closed[i].k < n)
2461
+ open.push(closed[i].i, closed[i].j, closed[i].k);
2462
+
2463
+ /* Yay, we're done! */
2464
+ return open;
2465
+ },
2466
+ contains: function(tri, p) {
2467
+ /* Bounding box test first, for quick rejections. */
2468
+ if((p[0] < tri[0][0] && p[0] < tri[1][0] && p[0] < tri[2][0]) ||
2469
+ (p[0] > tri[0][0] && p[0] > tri[1][0] && p[0] > tri[2][0]) ||
2470
+ (p[1] < tri[0][1] && p[1] < tri[1][1] && p[1] < tri[2][1]) ||
2471
+ (p[1] > tri[0][1] && p[1] > tri[1][1] && p[1] > tri[2][1]))
2472
+ return null;
2473
+
2474
+ var a = tri[1][0] - tri[0][0],
2475
+ b = tri[2][0] - tri[0][0],
2476
+ c = tri[1][1] - tri[0][1],
2477
+ d = tri[2][1] - tri[0][1],
2478
+ i = a * d - b * c;
2479
+
2480
+ /* Degenerate tri. */
2481
+ if(i === 0.0)
2482
+ return null;
2483
+
2484
+ var u = (d * (p[0] - tri[0][0]) - b * (p[1] - tri[0][1])) / i,
2485
+ v = (a * (p[1] - tri[0][1]) - c * (p[0] - tri[0][0])) / i;
2486
+
2487
+ /* If we're outside the tri, fail. */
2488
+ if(u < 0.0 || v < 0.0 || (u + v) > 1.0)
2489
+ return null;
2490
+
2491
+ return [u, v];
2492
+ }
2493
+ };
2494
+
2495
+ if(typeof module !== "undefined")
2496
+ module.exports = Delaunay;
2497
+ })();
2498
+
2499
+ },{}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/index.js":[function(require,module,exports){
2500
+ // A library of seedable RNGs implemented in Javascript.
2501
+ //
2502
+ // Usage:
2503
+ //
2504
+ // var seedrandom = require('seedrandom');
2505
+ // var random = seedrandom(1); // or any seed.
2506
+ // var x = random(); // 0 <= x < 1. Every bit is random.
2507
+ // var x = random.quick(); // 0 <= x < 1. 32 bits of randomness.
2508
+
2509
+ // alea, a 53-bit multiply-with-carry generator by Johannes Baagøe.
2510
+ // Period: ~2^116
2511
+ // Reported to pass all BigCrush tests.
2512
+ var alea = require('./lib/alea');
2513
+
2514
+ // xor128, a pure xor-shift generator by George Marsaglia.
2515
+ // Period: 2^128-1.
2516
+ // Reported to fail: MatrixRank and LinearComp.
2517
+ var xor128 = require('./lib/xor128');
2518
+
2519
+ // xorwow, George Marsaglia's 160-bit xor-shift combined plus weyl.
2520
+ // Period: 2^192-2^32
2521
+ // Reported to fail: CollisionOver, SimpPoker, and LinearComp.
2522
+ var xorwow = require('./lib/xorwow');
2523
+
2524
+ // xorshift7, by François Panneton and Pierre L'ecuyer, takes
2525
+ // a different approach: it adds robustness by allowing more shifts
2526
+ // than Marsaglia's original three. It is a 7-shift generator
2527
+ // with 256 bits, that passes BigCrush with no systmatic failures.
2528
+ // Period 2^256-1.
2529
+ // No systematic BigCrush failures reported.
2530
+ var xorshift7 = require('./lib/xorshift7');
2531
+
2532
+ // xor4096, by Richard Brent, is a 4096-bit xor-shift with a
2533
+ // very long period that also adds a Weyl generator. It also passes
2534
+ // BigCrush with no systematic failures. Its long period may
2535
+ // be useful if you have many generators and need to avoid
2536
+ // collisions.
2537
+ // Period: 2^4128-2^32.
2538
+ // No systematic BigCrush failures reported.
2539
+ var xor4096 = require('./lib/xor4096');
2540
+
2541
+ // Tyche-i, by Samuel Neves and Filipe Araujo, is a bit-shifting random
2542
+ // number generator derived from ChaCha, a modern stream cipher.
2543
+ // https://eden.dei.uc.pt/~sneves/pubs/2011-snfa2.pdf
2544
+ // Period: ~2^127
2545
+ // No systematic BigCrush failures reported.
2546
+ var tychei = require('./lib/tychei');
2547
+
2548
+ // The original ARC4-based prng included in this library.
2549
+ // Period: ~2^1600
2550
+ var sr = require('./seedrandom');
2551
+
2552
+ sr.alea = alea;
2553
+ sr.xor128 = xor128;
2554
+ sr.xorwow = xorwow;
2555
+ sr.xorshift7 = xorshift7;
2556
+ sr.xor4096 = xor4096;
2557
+ sr.tychei = tychei;
2558
+
2559
+ module.exports = sr;
2560
+
2561
+ },{"./lib/alea":"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/alea.js","./lib/tychei":"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/tychei.js","./lib/xor128":"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/xor128.js","./lib/xor4096":"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/xor4096.js","./lib/xorshift7":"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/xorshift7.js","./lib/xorwow":"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/xorwow.js","./seedrandom":"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/seedrandom.js"}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/alea.js":[function(require,module,exports){
2562
+ // A port of an algorithm by Johannes Baagøe <baagoe@baagoe.com>, 2010
2563
+ // http://baagoe.com/en/RandomMusings/javascript/
2564
+ // https://github.com/nquinlan/better-random-numbers-for-javascript-mirror
2565
+ // Original work is under MIT license -
2566
+
2567
+ // Copyright (C) 2010 by Johannes Baagøe <baagoe@baagoe.org>
2568
+ //
2569
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
2570
+ // of this software and associated documentation files (the "Software"), to deal
2571
+ // in the Software without restriction, including without limitation the rights
2572
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2573
+ // copies of the Software, and to permit persons to whom the Software is
2574
+ // furnished to do so, subject to the following conditions:
2575
+ //
2576
+ // The above copyright notice and this permission notice shall be included in
2577
+ // all copies or substantial portions of the Software.
2578
+ //
2579
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2580
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2581
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2582
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2583
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2584
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2585
+ // THE SOFTWARE.
2586
+
2587
+
2588
+
2589
+ (function(global, module, define) {
2590
+
2591
+ function Alea(seed) {
2592
+ var me = this, mash = Mash();
2593
+
2594
+ me.next = function() {
2595
+ var t = 2091639 * me.s0 + me.c * 2.3283064365386963e-10; // 2^-32
2596
+ me.s0 = me.s1;
2597
+ me.s1 = me.s2;
2598
+ return me.s2 = t - (me.c = t | 0);
2599
+ };
2600
+
2601
+ // Apply the seeding algorithm from Baagoe.
2602
+ me.c = 1;
2603
+ me.s0 = mash(' ');
2604
+ me.s1 = mash(' ');
2605
+ me.s2 = mash(' ');
2606
+ me.s0 -= mash(seed);
2607
+ if (me.s0 < 0) { me.s0 += 1; }
2608
+ me.s1 -= mash(seed);
2609
+ if (me.s1 < 0) { me.s1 += 1; }
2610
+ me.s2 -= mash(seed);
2611
+ if (me.s2 < 0) { me.s2 += 1; }
2612
+ mash = null;
2613
+ }
2614
+
2615
+ function copy(f, t) {
2616
+ t.c = f.c;
2617
+ t.s0 = f.s0;
2618
+ t.s1 = f.s1;
2619
+ t.s2 = f.s2;
2620
+ return t;
2621
+ }
2622
+
2623
+ function impl(seed, opts) {
2624
+ var xg = new Alea(seed),
2625
+ state = opts && opts.state,
2626
+ prng = xg.next;
2627
+ prng.int32 = function() { return (xg.next() * 0x100000000) | 0; }
2628
+ prng.double = function() {
2629
+ return prng() + (prng() * 0x200000 | 0) * 1.1102230246251565e-16; // 2^-53
2630
+ };
2631
+ prng.quick = prng;
2632
+ if (state) {
2633
+ if (typeof(state) == 'object') copy(state, xg);
2634
+ prng.state = function() { return copy(xg, {}); }
2635
+ }
2636
+ return prng;
2637
+ }
2638
+
2639
+ function Mash() {
2640
+ var n = 0xefc8249d;
2641
+
2642
+ var mash = function(data) {
2643
+ data = data.toString();
2644
+ for (var i = 0; i < data.length; i++) {
2645
+ n += data.charCodeAt(i);
2646
+ var h = 0.02519603282416938 * n;
2647
+ n = h >>> 0;
2648
+ h -= n;
2649
+ h *= n;
2650
+ n = h >>> 0;
2651
+ h -= n;
2652
+ n += h * 0x100000000; // 2^32
2653
+ }
2654
+ return (n >>> 0) * 2.3283064365386963e-10; // 2^-32
2655
+ };
2656
+
2657
+ return mash;
2658
+ }
2659
+
2660
+
2661
+ if (module && module.exports) {
2662
+ module.exports = impl;
2663
+ } else if (define && define.amd) {
2664
+ define(function() { return impl; });
2665
+ } else {
2666
+ this.alea = impl;
2667
+ }
2668
+
2669
+ })(
2670
+ this,
2671
+ (typeof module) == 'object' && module, // present in node.js
2672
+ (typeof define) == 'function' && define // present with an AMD loader
2673
+ );
2674
+
2675
+
2676
+
2677
+ },{}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/tychei.js":[function(require,module,exports){
2678
+ // A Javascript implementaion of the "Tyche-i" prng algorithm by
2679
+ // Samuel Neves and Filipe Araujo.
2680
+ // See https://eden.dei.uc.pt/~sneves/pubs/2011-snfa2.pdf
2681
+
2682
+ (function(global, module, define) {
2683
+
2684
+ function XorGen(seed) {
2685
+ var me = this, strseed = '';
2686
+
2687
+ // Set up generator function.
2688
+ me.next = function() {
2689
+ var b = me.b, c = me.c, d = me.d, a = me.a;
2690
+ b = (b << 25) ^ (b >>> 7) ^ c;
2691
+ c = (c - d) | 0;
2692
+ d = (d << 24) ^ (d >>> 8) ^ a;
2693
+ a = (a - b) | 0;
2694
+ me.b = b = (b << 20) ^ (b >>> 12) ^ c;
2695
+ me.c = c = (c - d) | 0;
2696
+ me.d = (d << 16) ^ (c >>> 16) ^ a;
2697
+ return me.a = (a - b) | 0;
2698
+ };
2699
+
2700
+ /* The following is non-inverted tyche, which has better internal
2701
+ * bit diffusion, but which is about 25% slower than tyche-i in JS.
2702
+ me.next = function() {
2703
+ var a = me.a, b = me.b, c = me.c, d = me.d;
2704
+ a = (me.a + me.b | 0) >>> 0;
2705
+ d = me.d ^ a; d = d << 16 ^ d >>> 16;
2706
+ c = me.c + d | 0;
2707
+ b = me.b ^ c; b = b << 12 ^ d >>> 20;
2708
+ me.a = a = a + b | 0;
2709
+ d = d ^ a; me.d = d = d << 8 ^ d >>> 24;
2710
+ me.c = c = c + d | 0;
2711
+ b = b ^ c;
2712
+ return me.b = (b << 7 ^ b >>> 25);
2713
+ }
2714
+ */
2715
+
2716
+ me.a = 0;
2717
+ me.b = 0;
2718
+ me.c = 2654435769 | 0;
2719
+ me.d = 1367130551;
2720
+
2721
+ if (seed === Math.floor(seed)) {
2722
+ // Integer seed.
2723
+ me.a = (seed / 0x100000000) | 0;
2724
+ me.b = seed | 0;
2725
+ } else {
2726
+ // String seed.
2727
+ strseed += seed;
2728
+ }
2729
+
2730
+ // Mix in string seed, then discard an initial batch of 64 values.
2731
+ for (var k = 0; k < strseed.length + 20; k++) {
2732
+ me.b ^= strseed.charCodeAt(k) | 0;
2733
+ me.next();
2734
+ }
2735
+ }
2736
+
2737
+ function copy(f, t) {
2738
+ t.a = f.a;
2739
+ t.b = f.b;
2740
+ t.c = f.c;
2741
+ t.d = f.d;
2742
+ return t;
2743
+ };
2744
+
2745
+ function impl(seed, opts) {
2746
+ var xg = new XorGen(seed),
2747
+ state = opts && opts.state,
2748
+ prng = function() { return (xg.next() >>> 0) / 0x100000000; };
2749
+ prng.double = function() {
2750
+ do {
2751
+ var top = xg.next() >>> 11,
2752
+ bot = (xg.next() >>> 0) / 0x100000000,
2753
+ result = (top + bot) / (1 << 21);
2754
+ } while (result === 0);
2755
+ return result;
2756
+ };
2757
+ prng.int32 = xg.next;
2758
+ prng.quick = prng;
2759
+ if (state) {
2760
+ if (typeof(state) == 'object') copy(state, xg);
2761
+ prng.state = function() { return copy(xg, {}); }
2762
+ }
2763
+ return prng;
2764
+ }
2765
+
2766
+ if (module && module.exports) {
2767
+ module.exports = impl;
2768
+ } else if (define && define.amd) {
2769
+ define(function() { return impl; });
2770
+ } else {
2771
+ this.tychei = impl;
2772
+ }
2773
+
2774
+ })(
2775
+ this,
2776
+ (typeof module) == 'object' && module, // present in node.js
2777
+ (typeof define) == 'function' && define // present with an AMD loader
2778
+ );
2779
+
2780
+
2781
+
2782
+ },{}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/xor128.js":[function(require,module,exports){
2783
+ // A Javascript implementaion of the "xor128" prng algorithm by
2784
+ // George Marsaglia. See http://www.jstatsoft.org/v08/i14/paper
2785
+
2786
+ (function(global, module, define) {
2787
+
2788
+ function XorGen(seed) {
2789
+ var me = this, strseed = '';
2790
+
2791
+ me.x = 0;
2792
+ me.y = 0;
2793
+ me.z = 0;
2794
+ me.w = 0;
2795
+
2796
+ // Set up generator function.
2797
+ me.next = function() {
2798
+ var t = me.x ^ (me.x << 11);
2799
+ me.x = me.y;
2800
+ me.y = me.z;
2801
+ me.z = me.w;
2802
+ return me.w ^= (me.w >>> 19) ^ t ^ (t >>> 8);
2803
+ };
2804
+
2805
+ if (seed === (seed | 0)) {
2806
+ // Integer seed.
2807
+ me.x = seed;
2808
+ } else {
2809
+ // String seed.
2810
+ strseed += seed;
2811
+ }
2812
+
2813
+ // Mix in string seed, then discard an initial batch of 64 values.
2814
+ for (var k = 0; k < strseed.length + 64; k++) {
2815
+ me.x ^= strseed.charCodeAt(k) | 0;
2816
+ me.next();
2817
+ }
2818
+ }
2819
+
2820
+ function copy(f, t) {
2821
+ t.x = f.x;
2822
+ t.y = f.y;
2823
+ t.z = f.z;
2824
+ t.w = f.w;
2825
+ return t;
2826
+ }
2827
+
2828
+ function impl(seed, opts) {
2829
+ var xg = new XorGen(seed),
2830
+ state = opts && opts.state,
2831
+ prng = function() { return (xg.next() >>> 0) / 0x100000000; };
2832
+ prng.double = function() {
2833
+ do {
2834
+ var top = xg.next() >>> 11,
2835
+ bot = (xg.next() >>> 0) / 0x100000000,
2836
+ result = (top + bot) / (1 << 21);
2837
+ } while (result === 0);
2838
+ return result;
2839
+ };
2840
+ prng.int32 = xg.next;
2841
+ prng.quick = prng;
2842
+ if (state) {
2843
+ if (typeof(state) == 'object') copy(state, xg);
2844
+ prng.state = function() { return copy(xg, {}); }
2845
+ }
2846
+ return prng;
2847
+ }
2848
+
2849
+ if (module && module.exports) {
2850
+ module.exports = impl;
2851
+ } else if (define && define.amd) {
2852
+ define(function() { return impl; });
2853
+ } else {
2854
+ this.xor128 = impl;
2855
+ }
2856
+
2857
+ })(
2858
+ this,
2859
+ (typeof module) == 'object' && module, // present in node.js
2860
+ (typeof define) == 'function' && define // present with an AMD loader
2861
+ );
2862
+
2863
+
2864
+
2865
+ },{}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/xor4096.js":[function(require,module,exports){
2866
+ // A Javascript implementaion of Richard Brent's Xorgens xor4096 algorithm.
2867
+ //
2868
+ // This fast non-cryptographic random number generator is designed for
2869
+ // use in Monte-Carlo algorithms. It combines a long-period xorshift
2870
+ // generator with a Weyl generator, and it passes all common batteries
2871
+ // of stasticial tests for randomness while consuming only a few nanoseconds
2872
+ // for each prng generated. For background on the generator, see Brent's
2873
+ // paper: "Some long-period random number generators using shifts and xors."
2874
+ // http://arxiv.org/pdf/1104.3115.pdf
2875
+ //
2876
+ // Usage:
2877
+ //
2878
+ // var xor4096 = require('xor4096');
2879
+ // random = xor4096(1); // Seed with int32 or string.
2880
+ // assert.equal(random(), 0.1520436450538547); // (0, 1) range, 53 bits.
2881
+ // assert.equal(random.int32(), 1806534897); // signed int32, 32 bits.
2882
+ //
2883
+ // For nonzero numeric keys, this impelementation provides a sequence
2884
+ // identical to that by Brent's xorgens 3 implementaion in C. This
2885
+ // implementation also provides for initalizing the generator with
2886
+ // string seeds, or for saving and restoring the state of the generator.
2887
+ //
2888
+ // On Chrome, this prng benchmarks about 2.1 times slower than
2889
+ // Javascript's built-in Math.random().
2890
+
2891
+ (function(global, module, define) {
2892
+
2893
+ function XorGen(seed) {
2894
+ var me = this;
2895
+
2896
+ // Set up generator function.
2897
+ me.next = function() {
2898
+ var w = me.w,
2899
+ X = me.X, i = me.i, t, v;
2900
+ // Update Weyl generator.
2901
+ me.w = w = (w + 0x61c88647) | 0;
2902
+ // Update xor generator.
2903
+ v = X[(i + 34) & 127];
2904
+ t = X[i = ((i + 1) & 127)];
2905
+ v ^= v << 13;
2906
+ t ^= t << 17;
2907
+ v ^= v >>> 15;
2908
+ t ^= t >>> 12;
2909
+ // Update Xor generator array state.
2910
+ v = X[i] = v ^ t;
2911
+ me.i = i;
2912
+ // Result is the combination.
2913
+ return (v + (w ^ (w >>> 16))) | 0;
2914
+ };
2915
+
2916
+ function init(me, seed) {
2917
+ var t, v, i, j, w, X = [], limit = 128;
2918
+ if (seed === (seed | 0)) {
2919
+ // Numeric seeds initialize v, which is used to generates X.
2920
+ v = seed;
2921
+ seed = null;
2922
+ } else {
2923
+ // String seeds are mixed into v and X one character at a time.
2924
+ seed = seed + '\0';
2925
+ v = 0;
2926
+ limit = Math.max(limit, seed.length);
2927
+ }
2928
+ // Initialize circular array and weyl value.
2929
+ for (i = 0, j = -32; j < limit; ++j) {
2930
+ // Put the unicode characters into the array, and shuffle them.
2931
+ if (seed) v ^= seed.charCodeAt((j + 32) % seed.length);
2932
+ // After 32 shuffles, take v as the starting w value.
2933
+ if (j === 0) w = v;
2934
+ v ^= v << 10;
2935
+ v ^= v >>> 15;
2936
+ v ^= v << 4;
2937
+ v ^= v >>> 13;
2938
+ if (j >= 0) {
2939
+ w = (w + 0x61c88647) | 0; // Weyl.
2940
+ t = (X[j & 127] ^= (v + w)); // Combine xor and weyl to init array.
2941
+ i = (0 == t) ? i + 1 : 0; // Count zeroes.
2942
+ }
2943
+ }
2944
+ // We have detected all zeroes; make the key nonzero.
2945
+ if (i >= 128) {
2946
+ X[(seed && seed.length || 0) & 127] = -1;
2947
+ }
2948
+ // Run the generator 512 times to further mix the state before using it.
2949
+ // Factoring this as a function slows the main generator, so it is just
2950
+ // unrolled here. The weyl generator is not advanced while warming up.
2951
+ i = 127;
2952
+ for (j = 4 * 128; j > 0; --j) {
2953
+ v = X[(i + 34) & 127];
2954
+ t = X[i = ((i + 1) & 127)];
2955
+ v ^= v << 13;
2956
+ t ^= t << 17;
2957
+ v ^= v >>> 15;
2958
+ t ^= t >>> 12;
2959
+ X[i] = v ^ t;
2960
+ }
2961
+ // Storing state as object members is faster than using closure variables.
2962
+ me.w = w;
2963
+ me.X = X;
2964
+ me.i = i;
2965
+ }
2966
+
2967
+ init(me, seed);
2968
+ }
2969
+
2970
+ function copy(f, t) {
2971
+ t.i = f.i;
2972
+ t.w = f.w;
2973
+ t.X = f.X.slice();
2974
+ return t;
2975
+ };
2976
+
2977
+ function impl(seed, opts) {
2978
+ if (seed == null) seed = +(new Date);
2979
+ var xg = new XorGen(seed),
2980
+ state = opts && opts.state,
2981
+ prng = function() { return (xg.next() >>> 0) / 0x100000000; };
2982
+ prng.double = function() {
2983
+ do {
2984
+ var top = xg.next() >>> 11,
2985
+ bot = (xg.next() >>> 0) / 0x100000000,
2986
+ result = (top + bot) / (1 << 21);
2987
+ } while (result === 0);
2988
+ return result;
2989
+ };
2990
+ prng.int32 = xg.next;
2991
+ prng.quick = prng;
2992
+ if (state) {
2993
+ if (state.X) copy(state, xg);
2994
+ prng.state = function() { return copy(xg, {}); }
2995
+ }
2996
+ return prng;
2997
+ }
2998
+
2999
+ if (module && module.exports) {
3000
+ module.exports = impl;
3001
+ } else if (define && define.amd) {
3002
+ define(function() { return impl; });
3003
+ } else {
3004
+ this.xor4096 = impl;
3005
+ }
3006
+
3007
+ })(
3008
+ this, // window object or global
3009
+ (typeof module) == 'object' && module, // present in node.js
3010
+ (typeof define) == 'function' && define // present with an AMD loader
3011
+ );
3012
+
3013
+ },{}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/xorshift7.js":[function(require,module,exports){
3014
+ // A Javascript implementaion of the "xorshift7" algorithm by
3015
+ // François Panneton and Pierre L'ecuyer:
3016
+ // "On the Xorgshift Random Number Generators"
3017
+ // http://saluc.engr.uconn.edu/refs/crypto/rng/panneton05onthexorshift.pdf
3018
+
3019
+ (function(global, module, define) {
3020
+
3021
+ function XorGen(seed) {
3022
+ var me = this;
3023
+
3024
+ // Set up generator function.
3025
+ me.next = function() {
3026
+ // Update xor generator.
3027
+ var X = me.x, i = me.i, t, v, w;
3028
+ t = X[i]; t ^= (t >>> 7); v = t ^ (t << 24);
3029
+ t = X[(i + 1) & 7]; v ^= t ^ (t >>> 10);
3030
+ t = X[(i + 3) & 7]; v ^= t ^ (t >>> 3);
3031
+ t = X[(i + 4) & 7]; v ^= t ^ (t << 7);
3032
+ t = X[(i + 7) & 7]; t = t ^ (t << 13); v ^= t ^ (t << 9);
3033
+ X[i] = v;
3034
+ me.i = (i + 1) & 7;
3035
+ return v;
3036
+ };
3037
+
3038
+ function init(me, seed) {
3039
+ var j, w, X = [];
3040
+
3041
+ if (seed === (seed | 0)) {
3042
+ // Seed state array using a 32-bit integer.
3043
+ w = X[0] = seed;
3044
+ } else {
3045
+ // Seed state using a string.
3046
+ seed = '' + seed;
3047
+ for (j = 0; j < seed.length; ++j) {
3048
+ X[j & 7] = (X[j & 7] << 15) ^
3049
+ (seed.charCodeAt(j) + X[(j + 1) & 7] << 13);
3050
+ }
3051
+ }
3052
+ // Enforce an array length of 8, not all zeroes.
3053
+ while (X.length < 8) X.push(0);
3054
+ for (j = 0; j < 8 && X[j] === 0; ++j);
3055
+ if (j == 8) w = X[7] = -1; else w = X[j];
3056
+
3057
+ me.x = X;
3058
+ me.i = 0;
3059
+
3060
+ // Discard an initial 256 values.
3061
+ for (j = 256; j > 0; --j) {
3062
+ me.next();
3063
+ }
3064
+ }
3065
+
3066
+ init(me, seed);
3067
+ }
3068
+
3069
+ function copy(f, t) {
3070
+ t.x = f.x.slice();
3071
+ t.i = f.i;
3072
+ return t;
3073
+ }
3074
+
3075
+ function impl(seed, opts) {
3076
+ if (seed == null) seed = +(new Date);
3077
+ var xg = new XorGen(seed),
3078
+ state = opts && opts.state,
3079
+ prng = function() { return (xg.next() >>> 0) / 0x100000000; };
3080
+ prng.double = function() {
3081
+ do {
3082
+ var top = xg.next() >>> 11,
3083
+ bot = (xg.next() >>> 0) / 0x100000000,
3084
+ result = (top + bot) / (1 << 21);
3085
+ } while (result === 0);
3086
+ return result;
3087
+ };
3088
+ prng.int32 = xg.next;
3089
+ prng.quick = prng;
3090
+ if (state) {
3091
+ if (state.x) copy(state, xg);
3092
+ prng.state = function() { return copy(xg, {}); }
3093
+ }
3094
+ return prng;
3095
+ }
3096
+
3097
+ if (module && module.exports) {
3098
+ module.exports = impl;
3099
+ } else if (define && define.amd) {
3100
+ define(function() { return impl; });
3101
+ } else {
3102
+ this.xorshift7 = impl;
3103
+ }
3104
+
3105
+ })(
3106
+ this,
3107
+ (typeof module) == 'object' && module, // present in node.js
3108
+ (typeof define) == 'function' && define // present with an AMD loader
3109
+ );
3110
+
3111
+
3112
+ },{}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/xorwow.js":[function(require,module,exports){
3113
+ // A Javascript implementaion of the "xorwow" prng algorithm by
3114
+ // George Marsaglia. See http://www.jstatsoft.org/v08/i14/paper
3115
+
3116
+ (function(global, module, define) {
3117
+
3118
+ function XorGen(seed) {
3119
+ var me = this, strseed = '';
3120
+
3121
+ // Set up generator function.
3122
+ me.next = function() {
3123
+ var t = (me.x ^ (me.x >>> 2));
3124
+ me.x = me.y; me.y = me.z; me.z = me.w; me.w = me.v;
3125
+ return (me.d = (me.d + 362437 | 0)) +
3126
+ (me.v = (me.v ^ (me.v << 4)) ^ (t ^ (t << 1))) | 0;
3127
+ };
3128
+
3129
+ me.x = 0;
3130
+ me.y = 0;
3131
+ me.z = 0;
3132
+ me.w = 0;
3133
+ me.v = 0;
3134
+
3135
+ if (seed === (seed | 0)) {
3136
+ // Integer seed.
3137
+ me.x = seed;
3138
+ } else {
3139
+ // String seed.
3140
+ strseed += seed;
3141
+ }
3142
+
3143
+ // Mix in string seed, then discard an initial batch of 64 values.
3144
+ for (var k = 0; k < strseed.length + 64; k++) {
3145
+ me.x ^= strseed.charCodeAt(k) | 0;
3146
+ if (k == strseed.length) {
3147
+ me.d = me.x << 10 ^ me.x >>> 4;
3148
+ }
3149
+ me.next();
3150
+ }
3151
+ }
3152
+
3153
+ function copy(f, t) {
3154
+ t.x = f.x;
3155
+ t.y = f.y;
3156
+ t.z = f.z;
3157
+ t.w = f.w;
3158
+ t.v = f.v;
3159
+ t.d = f.d;
3160
+ return t;
3161
+ }
3162
+
3163
+ function impl(seed, opts) {
3164
+ var xg = new XorGen(seed),
3165
+ state = opts && opts.state,
3166
+ prng = function() { return (xg.next() >>> 0) / 0x100000000; };
3167
+ prng.double = function() {
3168
+ do {
3169
+ var top = xg.next() >>> 11,
3170
+ bot = (xg.next() >>> 0) / 0x100000000,
3171
+ result = (top + bot) / (1 << 21);
3172
+ } while (result === 0);
3173
+ return result;
3174
+ };
3175
+ prng.int32 = xg.next;
3176
+ prng.quick = prng;
3177
+ if (state) {
3178
+ if (typeof(state) == 'object') copy(state, xg);
3179
+ prng.state = function() { return copy(xg, {}); }
3180
+ }
3181
+ return prng;
3182
+ }
3183
+
3184
+ if (module && module.exports) {
3185
+ module.exports = impl;
3186
+ } else if (define && define.amd) {
3187
+ define(function() { return impl; });
3188
+ } else {
3189
+ this.xorwow = impl;
3190
+ }
3191
+
3192
+ })(
3193
+ this,
3194
+ (typeof module) == 'object' && module, // present in node.js
3195
+ (typeof define) == 'function' && define // present with an AMD loader
3196
+ );
3197
+
3198
+
3199
+
3200
+ },{}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/seedrandom.js":[function(require,module,exports){
3201
+ /*
3202
+ Copyright 2014 David Bau.
3203
+
3204
+ Permission is hereby granted, free of charge, to any person obtaining
3205
+ a copy of this software and associated documentation files (the
3206
+ "Software"), to deal in the Software without restriction, including
3207
+ without limitation the rights to use, copy, modify, merge, publish,
3208
+ distribute, sublicense, and/or sell copies of the Software, and to
3209
+ permit persons to whom the Software is furnished to do so, subject to
3210
+ the following conditions:
3211
+
3212
+ The above copyright notice and this permission notice shall be
3213
+ included in all copies or substantial portions of the Software.
3214
+
3215
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
3216
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
3217
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
3218
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
3219
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
3220
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
3221
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3222
+
3223
+ */
3224
+
3225
+ (function (pool, math) {
3226
+ //
3227
+ // The following constants are related to IEEE 754 limits.
3228
+ //
3229
+ var global = this,
3230
+ width = 256, // each RC4 output is 0 <= x < 256
3231
+ chunks = 6, // at least six RC4 outputs for each double
3232
+ digits = 52, // there are 52 significant digits in a double
3233
+ rngname = 'random', // rngname: name for Math.random and Math.seedrandom
3234
+ startdenom = math.pow(width, chunks),
3235
+ significance = math.pow(2, digits),
3236
+ overflow = significance * 2,
3237
+ mask = width - 1,
3238
+ nodecrypto; // node.js crypto module, initialized at the bottom.
3239
+
3240
+ //
3241
+ // seedrandom()
3242
+ // This is the seedrandom function described above.
3243
+ //
3244
+ function seedrandom(seed, options, callback) {
3245
+ var key = [];
3246
+ options = (options == true) ? { entropy: true } : (options || {});
3247
+
3248
+ // Flatten the seed string or build one from local entropy if needed.
3249
+ var shortseed = mixkey(flatten(
3250
+ options.entropy ? [seed, tostring(pool)] :
3251
+ (seed == null) ? autoseed() : seed, 3), key);
3252
+
3253
+ // Use the seed to initialize an ARC4 generator.
3254
+ var arc4 = new ARC4(key);
3255
+
3256
+ // This function returns a random double in [0, 1) that contains
3257
+ // randomness in every bit of the mantissa of the IEEE 754 value.
3258
+ var prng = function() {
3259
+ var n = arc4.g(chunks), // Start with a numerator n < 2 ^ 48
3260
+ d = startdenom, // and denominator d = 2 ^ 48.
3261
+ x = 0; // and no 'extra last byte'.
3262
+ while (n < significance) { // Fill up all significant digits by
3263
+ n = (n + x) * width; // shifting numerator and
3264
+ d *= width; // denominator and generating a
3265
+ x = arc4.g(1); // new least-significant-byte.
3266
+ }
3267
+ while (n >= overflow) { // To avoid rounding up, before adding
3268
+ n /= 2; // last byte, shift everything
3269
+ d /= 2; // right using integer math until
3270
+ x >>>= 1; // we have exactly the desired bits.
3271
+ }
3272
+ return (n + x) / d; // Form the number within [0, 1).
3273
+ };
3274
+
3275
+ prng.int32 = function() { return arc4.g(4) | 0; }
3276
+ prng.quick = function() { return arc4.g(4) / 0x100000000; }
3277
+ prng.double = prng;
3278
+
3279
+ // Mix the randomness into accumulated entropy.
3280
+ mixkey(tostring(arc4.S), pool);
3281
+
3282
+ // Calling convention: what to return as a function of prng, seed, is_math.
3283
+ return (options.pass || callback ||
3284
+ function(prng, seed, is_math_call, state) {
3285
+ if (state) {
3286
+ // Load the arc4 state from the given state if it has an S array.
3287
+ if (state.S) { copy(state, arc4); }
3288
+ // Only provide the .state method if requested via options.state.
3289
+ prng.state = function() { return copy(arc4, {}); }
3290
+ }
3291
+
3292
+ // If called as a method of Math (Math.seedrandom()), mutate
3293
+ // Math.random because that is how seedrandom.js has worked since v1.0.
3294
+ if (is_math_call) { math[rngname] = prng; return seed; }
3295
+
3296
+ // Otherwise, it is a newer calling convention, so return the
3297
+ // prng directly.
3298
+ else return prng;
3299
+ })(
3300
+ prng,
3301
+ shortseed,
3302
+ 'global' in options ? options.global : (this == math),
3303
+ options.state);
3304
+ }
3305
+ math['seed' + rngname] = seedrandom;
3306
+
3307
+ //
3308
+ // ARC4
3309
+ //
3310
+ // An ARC4 implementation. The constructor takes a key in the form of
3311
+ // an array of at most (width) integers that should be 0 <= x < (width).
3312
+ //
3313
+ // The g(count) method returns a pseudorandom integer that concatenates
3314
+ // the next (count) outputs from ARC4. Its return value is a number x
3315
+ // that is in the range 0 <= x < (width ^ count).
3316
+ //
3317
+ function ARC4(key) {
3318
+ var t, keylen = key.length,
3319
+ me = this, i = 0, j = me.i = me.j = 0, s = me.S = [];
3320
+
3321
+ // The empty key [] is treated as [0].
3322
+ if (!keylen) { key = [keylen++]; }
3323
+
3324
+ // Set up S using the standard key scheduling algorithm.
3325
+ while (i < width) {
3326
+ s[i] = i++;
3327
+ }
3328
+ for (i = 0; i < width; i++) {
3329
+ s[i] = s[j = mask & (j + key[i % keylen] + (t = s[i]))];
3330
+ s[j] = t;
3331
+ }
3332
+
3333
+ // The "g" method returns the next (count) outputs as one number.
3334
+ (me.g = function(count) {
3335
+ // Using instance members instead of closure state nearly doubles speed.
3336
+ var t, r = 0,
3337
+ i = me.i, j = me.j, s = me.S;
3338
+ while (count--) {
3339
+ t = s[i = mask & (i + 1)];
3340
+ r = r * width + s[mask & ((s[i] = s[j = mask & (j + t)]) + (s[j] = t))];
3341
+ }
3342
+ me.i = i; me.j = j;
3343
+ return r;
3344
+ // For robust unpredictability, the function call below automatically
3345
+ // discards an initial batch of values. This is called RC4-drop[256].
3346
+ // See http://google.com/search?q=rsa+fluhrer+response&btnI
3347
+ })(width);
3348
+ }
3349
+
3350
+ //
3351
+ // copy()
3352
+ // Copies internal state of ARC4 to or from a plain object.
3353
+ //
3354
+ function copy(f, t) {
3355
+ t.i = f.i;
3356
+ t.j = f.j;
3357
+ t.S = f.S.slice();
3358
+ return t;
3359
+ };
3360
+
3361
+ //
3362
+ // flatten()
3363
+ // Converts an object tree to nested arrays of strings.
3364
+ //
3365
+ function flatten(obj, depth) {
3366
+ var result = [], typ = (typeof obj), prop;
3367
+ if (depth && typ == 'object') {
3368
+ for (prop in obj) {
3369
+ try { result.push(flatten(obj[prop], depth - 1)); } catch (e) {}
3370
+ }
3371
+ }
3372
+ return (result.length ? result : typ == 'string' ? obj : obj + '\0');
3373
+ }
3374
+
3375
+ //
3376
+ // mixkey()
3377
+ // Mixes a string seed into a key that is an array of integers, and
3378
+ // returns a shortened string seed that is equivalent to the result key.
3379
+ //
3380
+ function mixkey(seed, key) {
3381
+ var stringseed = seed + '', smear, j = 0;
3382
+ while (j < stringseed.length) {
3383
+ key[mask & j] =
3384
+ mask & ((smear ^= key[mask & j] * 19) + stringseed.charCodeAt(j++));
3385
+ }
3386
+ return tostring(key);
3387
+ }
3388
+
3389
+ //
3390
+ // autoseed()
3391
+ // Returns an object for autoseeding, using window.crypto and Node crypto
3392
+ // module if available.
3393
+ //
3394
+ function autoseed() {
3395
+ try {
3396
+ if (nodecrypto) { return tostring(nodecrypto.randomBytes(width)); }
3397
+ var out = new Uint8Array(width);
3398
+ (global.crypto || global.msCrypto).getRandomValues(out);
3399
+ return tostring(out);
3400
+ } catch (e) {
3401
+ var browser = global.navigator,
3402
+ plugins = browser && browser.plugins;
3403
+ return [+new Date, global, plugins, global.screen, tostring(pool)];
3404
+ }
3405
+ }
3406
+
3407
+ //
3408
+ // tostring()
3409
+ // Converts an array of charcodes to a string
3410
+ //
3411
+ function tostring(a) {
3412
+ return String.fromCharCode.apply(0, a);
3413
+ }
3414
+
3415
+ //
3416
+ // When seedrandom.js is loaded, we immediately mix a few bits
3417
+ // from the built-in RNG into the entropy pool. Because we do
3418
+ // not want to interfere with deterministic PRNG state later,
3419
+ // seedrandom will not call math.random on its own again after
3420
+ // initialization.
3421
+ //
3422
+ mixkey(math.random(), pool);
3423
+
3424
+ //
3425
+ // Nodejs and AMD support: export the implementation as a module using
3426
+ // either convention.
3427
+ //
3428
+ if ((typeof module) == 'object' && module.exports) {
3429
+ module.exports = seedrandom;
3430
+ // When in node.js, try using crypto package for autoseeding.
3431
+ try {
3432
+ nodecrypto = require('crypto');
3433
+ } catch (ex) {}
3434
+ } else if ((typeof define) == 'function' && define.amd) {
3435
+ define(function() { return seedrandom; });
3436
+ }
3437
+
3438
+ // End anonymous scope, and pass initial values.
3439
+ })(
3440
+ [], // pool: entropy pool starts empty
3441
+ Math // math: package containing random, pow, and seedrandom
3442
+ );
3443
+
3444
+ },{"crypto":false}]},{},["./lib/trianglify.js"])("./lib/trianglify.js")
3445
+ });
admin/trianglify.min.js ADDED
@@ -0,0 +1,2 @@
 
 
1
+ !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r;r="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,r.Trianglify=e()}}(function(){var e;return function r(e,n,t){function f(o,i){if(!n[o]){if(!e[o]){var s="function"==typeof require&&require;if(!i&&s)return s(o,!0);if(a)return a(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var u=n[o]={exports:{}};e[o][0].call(u.exports,function(r){var n=e[o][1][r];return f(n?n:r)},u,u.exports,r,e,n,t)}return n[o].exports}for(var a="function"==typeof require&&require,o=0;o<t.length;o++)f(t[o]);return f}({"./lib/trianglify.js":[function(e,r,n){function t(e){function r(e,r,n){return(e-r[0])*(n[1]-n[0])/(r[1]-r[0])+n[0]}function n(n,t){for(var f=[],a=-y;n+y>a;a+=e.cell_size)for(var o=-w;t+w>o;o+=e.cell_size){var i=a+e.cell_size/2+r(rand(),[0,1],[-v,v]),s=o+e.cell_size/2+r(rand(),[0,1],[-v,v]);f.push([i,s].map(Math.floor))}return f}function t(e){return{x:(e[0][0]+e[1][0]+e[2][0])/3,y:(e[0][1]+e[1][1]+e[2][1])/3}}function i(){if(e.palette instanceof Array)return e.palette[Math.floor(rand()*e.palette.length)];var r=Object.keys(e.palette);return e.palette[r[Math.floor(rand()*r.length)]]}function u(e,r){var n={};for(var t in e)n[t]=e[t];for(t in r){if(!e.hasOwnProperty(t))throw new Error(t+" is not a configuration option for Trianglify. Check your spelling?");n[t]=r[t]}return n}if(e=u(c,e),rand=a(e.seed),"random"===e.x_colors&&(e.x_colors=i()),"random"===e.y_colors&&(e.y_colors=i()),"match_x"===e.y_colors&&(e.y_colors=e.x_colors),!(e.width>0&&e.height>0))throw new Error("Width and height must be numbers greater than 0");if(e.cell_size<2)throw new Error("Cell size must be greater than 2.");var d;if(e.color_function)d=function(r,n){return o(e.color_function(r,n))};else{var l=o.scale(e.x_colors).mode(e.color_space),b=o.scale(e.y_colors).mode(e.color_space);d=function(r,n){return o.interpolate(l(r),b(n),.5,e.color_space)}}for(var h=e.width,g=e.height,p=Math.floor((h+4*e.cell_size)/e.cell_size),m=Math.floor((g+4*e.cell_size)/e.cell_size),y=(p*e.cell_size-h)/2,w=(m*e.cell_size-g)/2,v=e.cell_size*e.variance/2,x=function(e){return r(e,[-y,h+y],[0,1])},_=function(e){return r(e,[-w,g+w],[0,1])},k=n(h,g),j=f.triangulate(k),M=[],N=function(e){return k[e]},D=0;D<j.length;D+=3){var U=[j[D],j[D+1],j[D+2]].map(N),A=t(U),P=d(x(A.x),_(A.y)).hex();M.push([P,U])}return s(M,e)}var f=e("delaunay-fast"),a=e("seedrandom"),o=e("chroma-js"),i=e("./colorbrewer"),s=e("./pattern"),c={width:600,height:400,cell_size:75,variance:.75,seed:null,x_colors:"random",y_colors:"match_x",palette:i,color_space:"lab",color_function:null,stroke_width:1.51};t.colorbrewer=i,t.defaults=c,r.exports=t},{"./colorbrewer":"/Users/gpriday/Downloads/trianglify-master 2/lib/colorbrewer.js","./pattern":"/Users/gpriday/Downloads/trianglify-master 2/lib/pattern.js","chroma-js":"/Users/gpriday/Downloads/trianglify-master 2/node_modules/chroma-js/chroma.js","delaunay-fast":"/Users/gpriday/Downloads/trianglify-master 2/node_modules/delaunay-fast/delaunay.js",seedrandom:"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/index.js"}],"/Users/gpriday/Downloads/trianglify-master 2/lib/colorbrewer.js":[function(e,r,n){r.exports={YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]}},{}],"/Users/gpriday/Downloads/trianglify-master 2/lib/pattern.js":[function(e,r,n){(function(n){function t(r,t){function a(){var e=f.createElementNS("http://www.w3.org/2000/svg","svg");return e.setAttribute("width",t.width),e.setAttribute("height",t.height),r.forEach(function(r){var n=f.createElementNS("http://www.w3.org/2000/svg","path");n.setAttribute("d","M"+r[1].join("L")+"Z"),n.setAttribute("fill",r[0]),n.setAttribute("stroke",r[0]),n.setAttribute("stroke-width",t.stroke_width),e.appendChild(n)}),e}function o(a){if("undefined"!=typeof n)try{e("canvas")}catch(o){throw Error("The optional node-canvas dependency is needed for Trianglify to render using canvas in node.")}return a||(a=f.createElement("canvas")),a.setAttribute("width",t.width),a.setAttribute("height",t.height),ctx=a.getContext("2d"),ctx.canvas.width=t.width,ctx.canvas.height=t.height,r.forEach(function(e){ctx.fillStyle=ctx.strokeStyle=e[0],ctx.lineWidth=t.stroke_width,ctx.beginPath(),ctx.moveTo.apply(ctx,e[1][0]),ctx.lineTo.apply(ctx,e[1][1]),ctx.lineTo.apply(ctx,e[1][2]),ctx.fill(),ctx.stroke()}),a}function i(){return o().toDataURL("image/png")}return{polys:r,opts:t,svg:a,canvas:o,png:i}}var f="undefined"!=typeof document?document:e("jsdom").jsdom("<html/>");r.exports=t}).call(this,e("_process"))},{_process:"/Users/gpriday/Downloads/trianglify-master 2/node_modules/browserify/node_modules/process/browser.js",canvas:"/Users/gpriday/Downloads/trianglify-master 2/node_modules/browserify/node_modules/browser-resolve/empty.js",jsdom:"/Users/gpriday/Downloads/trianglify-master 2/node_modules/browserify/node_modules/browser-resolve/empty.js"}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/browserify/node_modules/browser-resolve/empty.js":[function(e,r,n){},{}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/browserify/node_modules/process/browser.js":[function(e,r,n){function t(){if(!i){i=!0;for(var e,r=o.length;r;){e=o,o=[];for(var n=-1;++n<r;)e[n]();r=o.length}i=!1}}function f(){}var a=r.exports={},o=[],i=!1;a.nextTick=function(e){o.push(e),i||setTimeout(t,0)},a.title="browser",a.browser=!0,a.env={},a.argv=[],a.version="",a.versions={},a.on=f,a.addListener=f,a.once=f,a.off=f,a.removeListener=f,a.removeAllListeners=f,a.emit=f,a.binding=function(e){throw new Error("process.binding is not supported")},a.cwd=function(){return"/"},a.chdir=function(e){throw new Error("process.chdir is not supported")},a.umask=function(){return 0}},{}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/chroma-js/chroma.js":[function(r,n,t){(function(){var r,f,a,o,i,s,c,u,d,l,b,h,g,p,m,y,w,v,x,_,k,j,M,N,D,U,A,P,z,G,E,B,I,q,R,S,O,C,T;l=function(e,n,t,f){return new r(e,n,t,f)},"undefined"!=typeof n&&null!==n&&null!=n.exports&&(n.exports=l),"function"==typeof e&&e.amd?e([],function(){return l}):(q="undefined"!=typeof t&&null!==t?t:this,q.chroma=l),l.color=function(e,n,t,f){return new r(e,n,t,f)},l.hsl=function(e,n,t,f){return new r(e,n,t,f,"hsl")},l.hsv=function(e,n,t,f){return new r(e,n,t,f,"hsv")},l.rgb=function(e,n,t,f){return new r(e,n,t,f,"rgb")},l.hex=function(e){return new r(e)},l.css=function(e){return new r(e)},l.lab=function(e,n,t){return new r(e,n,t,"lab")},l.lch=function(e,n,t){return new r(e,n,t,"lch")},l.hsi=function(e,n,t){return new r(e,n,t,"hsi")},l.gl=function(e,n,t,f){return new r(255*e,255*n,255*t,f,"gl")},l.interpolate=function(e,n,t,f){return null==e||null==n?"#000":("string"===R(e)&&(e=new r(e)),"string"===R(n)&&(n=new r(n)),e.interpolate(t,n,f))},l.mix=l.interpolate,l.contrast=function(e,n){var t,f;return"string"===R(e)&&(e=new r(e)),"string"===R(n)&&(n=new r(n)),t=e.luminance(),f=n.luminance(),t>f?(t+.05)/(f+.05):(f+.05)/(t+.05)},l.luminance=function(e){return l(e).luminance()},l._Color=r,r=function(){function e(){var e,r,n,t,f,a,o,i,s,c,u,d,l,h,g,p;for(f=this,n=[],c=0,u=arguments.length;u>c;c++)r=arguments[c],null!=r&&n.push(r);if(0===n.length)d=[255,0,255,1,"rgb"],o=d[0],i=d[1],s=d[2],e=d[3],t=d[4];else if("array"===R(n[0])){if(3===n[0].length)l=n[0],o=l[0],i=l[1],s=l[2],e=1;else{if(4!==n[0].length)throw"unknown input argument";h=n[0],o=h[0],i=h[1],s=h[2],e=h[3]}t=null!=(g=n[1])?g:"rgb"}else"string"===R(n[0])?(o=n[0],t="hex"):"object"===R(n[0])?(p=n[0]._rgb,o=p[0],i=p[1],s=p[2],e=p[3],t="rgb"):n.length>=3&&(o=n[0],i=n[1],s=n[2]);3===n.length?(t="rgb",e=1):4===n.length?"string"===R(n[3])?(t=n[3],e=1):"number"===R(n[3])&&(t="rgb",e=n[3]):5===n.length&&(e=n[3],t=n[4]),null==e&&(e=1),"rgb"===t?f._rgb=[o,i,s,e]:"gl"===t?f._rgb=[255*o,255*i,255*s,e]:"hsl"===t?(f._rgb=w(o,i,s),f._rgb[3]=e):"hsv"===t?(f._rgb=v(o,i,s),f._rgb[3]=e):"hex"===t?f._rgb=m(o):"lab"===t?(f._rgb=_(o,i,s),f._rgb[3]=e):"lch"===t?(f._rgb=M(o,i,s),f._rgb[3]=e):"hsi"===t&&(f._rgb=y(o,i,s),f._rgb[3]=e),a=b(f._rgb)}return e.prototype.rgb=function(){return this._rgb.slice(0,3)},e.prototype.rgba=function(){return this._rgb},e.prototype.hex=function(){return A(this._rgb)},e.prototype.toString=function(){return this.name()},e.prototype.hsl=function(){return z(this._rgb)},e.prototype.hsv=function(){return G(this._rgb)},e.prototype.lab=function(){return E(this._rgb)},e.prototype.lch=function(){return B(this._rgb)},e.prototype.hsi=function(){return P(this._rgb)},e.prototype.gl=function(){return[this._rgb[0]/255,this._rgb[1]/255,this._rgb[2]/255,this._rgb[3]]},e.prototype.luminance=function(r,n){var t,f,a,o;return null==n&&(n="rgb"),arguments.length?(0===r&&(this._rgb=[0,0,0,this._rgb[3]]),1===r&&(this._rgb=[255,255,255,this._rgb[3]]),t=D(this._rgb),f=1e-7,a=20,o=function(e,t){var i,s;return s=e.interpolate(.5,t,n),i=s.luminance(),Math.abs(r-i)<f||!a--?s:i>r?o(e,s):o(s,t)},this._rgb=(t>r?o(new e("black"),this):o(this,new e("white"))).rgba(),this):D(this._rgb)},e.prototype.name=function(){var e,r;e=this.hex();for(r in l.colors)if(e===l.colors[r])return r;return e},e.prototype.alpha=function(e){return arguments.length?(this._rgb[3]=e,this):this._rgb[3]},e.prototype.css=function(e){var r,n,t,f;return null==e&&(e="rgb"),n=this,t=n._rgb,3===e.length&&t[3]<1&&(e+="a"),"rgb"===e?e+"("+t.slice(0,3).map(Math.round).join(",")+")":"rgba"===e?e+"("+t.slice(0,3).map(Math.round).join(",")+","+t[3]+")":"hsl"===e||"hsla"===e?(r=n.hsl(),f=function(e){return Math.round(100*e)/100},r[0]=f(r[0]),r[1]=f(100*r[1])+"%",r[2]=f(100*r[2])+"%",4===e.length&&(r[3]=t[3]),e+"("+r.join(",")+")"):void 0},e.prototype.interpolate=function(r,n,t){var f,a,o,i,s,c,u,d,l,b,h,g,p,m;if(d=this,null==t&&(t="rgb"),"string"===R(n)&&(n=new e(n)),"hsl"===t||"hsv"===t||"lch"===t||"hsi"===t)"hsl"===t?(p=d.hsl(),m=n.hsl()):"hsv"===t?(p=d.hsv(),m=n.hsv()):"hsi"===t?(p=d.hsi(),m=n.hsi()):"lch"===t&&(p=d.lch(),m=n.lch()),"h"===t.substr(0,1)?(o=p[0],h=p[1],c=p[2],i=m[0],g=m[1],u=m[2]):(c=p[0],h=p[1],o=p[2],u=m[0],g=m[1],i=m[2]),isNaN(o)||isNaN(i)?isNaN(o)?isNaN(i)?a=Number.NaN:(a=i,1!==c&&0!==c||"hsv"===t||(b=g)):(a=o,1!==u&&0!==u||"hsv"===t||(b=h)):(f=i>o&&i-o>180?i-(o+360):o>i&&o-i>180?i+360-o:i-o,a=o+r*f),null==b&&(b=h+r*(g-h)),s=c+r*(u-c),l="h"===t.substr(0,1)?new e(a,b,s,t):new e(s,b,a,t);else if("rgb"===t)p=d._rgb,m=n._rgb,l=new e(p[0]+r*(m[0]-p[0]),p[1]+r*(m[1]-p[1]),p[2]+r*(m[2]-p[2]),t);else{if("lab"!==t)throw"color mode "+t+" is not supported";p=d.lab(),m=n.lab(),l=new e(p[0]+r*(m[0]-p[0]),p[1]+r*(m[1]-p[1]),p[2]+r*(m[2]-p[2]),t)}return l.alpha(d.alpha()+r*(n.alpha()-d.alpha())),l},e.prototype.premultiply=function(){var e,r;return r=this.rgb(),e=this.alpha(),l(r[0]*e,r[1]*e,r[2]*e,e)},e.prototype.darken=function(e){var r,n;return null==e&&(e=20),n=this,r=n.lch(),r[0]-=e,l.lch(r).alpha(n.alpha())},e.prototype.darker=function(e){return this.darken(e)},e.prototype.brighten=function(e){return null==e&&(e=20),this.darken(-e)},e.prototype.brighter=function(e){return this.brighten(e)},e.prototype.saturate=function(e){var r,n;return null==e&&(e=20),n=this,r=n.lch(),r[1]+=e,l.lch(r).alpha(n.alpha())},e.prototype.desaturate=function(e){return null==e&&(e=20),this.saturate(-e)},e}(),b=function(e){var r;for(r in e)3>r?(e[r]<0&&(e[r]=0),e[r]>255&&(e[r]=255)):3===r&&(e[r]<0&&(e[r]=0),e[r]>1&&(e[r]=1));return e},p=function(e){var r,n,t,f,a,o,i,s;if(e=e.toLowerCase(),null!=l.colors&&l.colors[e])return m(l.colors[e]);if(t=e.match(/rgb\(\s*(\-?\d+),\s*(\-?\d+)\s*,\s*(\-?\d+)\s*\)/)){for(f=t.slice(1,4),n=a=0;2>=a;n=++a)f[n]=+f[n];f[3]=1}else if(t=e.match(/rgba\(\s*(\-?\d+),\s*(\-?\d+)\s*,\s*(\-?\d+)\s*,\s*([01]|[01]?\.\d+)\)/))for(f=t.slice(1,5),n=o=0;3>=o;n=++o)f[n]=+f[n];else if(t=e.match(/rgb\(\s*(\-?\d+(?:\.\d+)?)%,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*\)/)){for(f=t.slice(1,4),n=i=0;2>=i;n=++i)f[n]=Math.round(2.55*f[n]);f[3]=1}else if(t=e.match(/rgba\(\s*(\-?\d+(?:\.\d+)?)%,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)/)){for(f=t.slice(1,5),n=s=0;2>=s;n=++s)f[n]=Math.round(2.55*f[n]);f[3]=+f[3]}else(t=e.match(/hsl\(\s*(\-?\d+(?:\.\d+)?),\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*\)/))?(r=t.slice(1,4),r[1]*=.01,r[2]*=.01,f=w(r),f[3]=1):(t=e.match(/hsla\(\s*(\-?\d+(?:\.\d+)?),\s*(\-?\d+(?:\.\d+)?)%\s*,\s*(\-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)/))&&(r=t.slice(1,4),r[1]*=.01,r[2]*=.01,f=w(r),f[3]=+t[4]);return f},m=function(e){var r,n,t,f,a,o;if(e.match(/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/))return(4===e.length||7===e.length)&&(e=e.substr(1)),3===e.length&&(e=e.split(""),e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),o=parseInt(e,16),f=o>>16,t=o>>8&255,n=255&o,[f,t,n,1];if(e.match(/^#?([A-Fa-f0-9]{8})$/))return 9===e.length&&(e=e.substr(1)),o=parseInt(e,16),f=o>>24&255,t=o>>16&255,n=o>>8&255,r=255&o,[f,t,n,r];if(a=p(e))return a;throw"unknown color: "+e},y=function(e,r,n){var t,f,i,s;return s=S(arguments),e=s[0],r=s[1],n=s[2],e/=360,1/3>e?(t=(1-r)/3,i=(1+r*g(o*e)/g(a-o*e))/3,f=1-(t+i)):2/3>e?(e-=1/3,i=(1-r)/3,f=(1+r*g(o*e)/g(a-o*e))/3,t=1-(i+f)):(e-=2/3,f=(1-r)/3,t=(1+r*g(o*e)/g(a-o*e))/3,i=1-(f+t)),i=N(n*i*3),f=N(n*f*3),t=N(n*t*3),[255*i,255*f,255*t]},w=function(){var e,r,n,t,f,a,o,i,s,c,u,d,l,b;if(l=S(arguments),t=l[0],i=l[1],a=l[2],0===i)o=n=e=255*a;else{for(u=[0,0,0],r=[0,0,0],c=.5>a?a*(1+i):a+i-a*i,s=2*a-c,t/=360,u[0]=t+1/3,u[1]=t,u[2]=t-1/3,f=d=0;2>=d;f=++d)u[f]<0&&(u[f]+=1),u[f]>1&&(u[f]-=1),r[f]=6*u[f]<1?s+6*(c-s)*u[f]:2*u[f]<1?c:3*u[f]<2?s+(c-s)*(2/3-u[f])*6:s;b=[Math.round(255*r[0]),Math.round(255*r[1]),Math.round(255*r[2])],o=b[0],n=b[1],e=b[2]}return[o,n,e]},v=function(){var e,r,n,t,f,a,o,i,s,c,u,d,l,b,h,g,p,m;if(d=S(arguments),t=d[0],s=d[1],u=d[2],u*=255,0===s)i=n=e=u;else switch(360===t&&(t=0),t>360&&(t-=360),0>t&&(t+=360),t/=60,f=Math.floor(t),r=t-f,a=u*(1-s),o=u*(1-s*r),c=u*(1-s*(1-r)),f){case 0:l=[u,c,a],i=l[0],n=l[1],e=l[2];break;case 1:b=[o,u,a],i=b[0],n=b[1],e=b[2];break;case 2:h=[a,u,c],i=h[0],n=h[1],e=h[2];break;case 3:g=[a,o,u],i=g[0],n=g[1],e=g[2];break;case 4:p=[c,a,u],i=p[0],n=p[1],e=p[2];break;case 5:m=[u,a,o],i=m[0],n=m[1],e=m[2]}return i=Math.round(i),n=Math.round(n),e=Math.round(e),[i,n,e]},f=18,i=.95047,s=1,c=1.08883,x=function(){var e,r,n,t,f,a;return a=S(arguments),f=a[0],e=a[1],r=a[2],n=Math.sqrt(e*e+r*r),t=Math.atan2(r,e)/Math.PI*180,[f,n,t]},_=function(e,r,n){var t,f,a,o,u,d,l;return void 0!==e&&3===e.length&&(d=e,e=d[0],r=d[1],n=d[2]),void 0!==e&&3===e.length&&(l=e,e=l[0],r=l[1],n=l[2]),o=(e+16)/116,a=o+r/500,u=o-n/200,a=k(a)*i,o=k(o)*s,u=k(u)*c,f=C(3.2404542*a-1.5371385*o-.4985314*u),t=C(-.969266*a+1.8760108*o+.041556*u),n=C(.0556434*a-.2040259*o+1.0572252*u),[N(f,0,255),N(t,0,255),N(n,0,255),1]},k=function(e){return e>.206893034?e*e*e:(e-4/29)/7.787037},C=function(e){return Math.round(255*(.00304>=e?12.92*e:1.055*Math.pow(e,1/2.4)-.055))},j=function(){var e,r,n,t;return t=S(arguments),n=t[0],e=t[1],r=t[2],r=r*Math.PI/180,[n,Math.cos(r)*e,Math.sin(r)*e]},M=function(e,r,n){var t,f,a,o,i,s,c;return s=j(e,r,n),t=s[0],f=s[1],a=s[2],c=_(t,f,a),i=c[0],o=c[1],a=c[2],[N(i,0,255),N(o,0,255),N(a,0,255)]},D=function(e,r,n){var t;return t=S(arguments),e=t[0],r=t[1],n=t[2],e=U(e),r=U(r),n=U(n),.2126*e+.7152*r+.0722*n},U=function(e){return e/=255,.03928>=e?e/12.92:Math.pow((e+.055)/1.055,2.4)},A=function(){var e,r,n,t,f,a;return a=S(arguments),n=a[0],r=a[1],e=a[2],f=n<<16|r<<8|e,t="000000"+f.toString(16),"#"+t.substr(t.length-6)},P=function(){var e,r,n,t,f,a,o,i,s;return s=S(arguments),o=s[0],n=s[1],r=s[2],e=2*Math.PI,o/=255,n/=255,r/=255,a=Math.min(o,n,r),f=(o+n+r)/3,i=1-a/f,0===i?t=0:(t=(o-n+(o-r))/2,t/=Math.sqrt((o-n)*(o-n)+(o-r)*(n-r)),t=Math.acos(t),r>n&&(t=e-t),t/=e),[360*t,i,f]},z=function(e,r,n){var t,f,a,o,i,s;return void 0!==e&&e.length>=3&&(s=e,e=s[0],r=s[1],n=s[2]),e/=255,r/=255,n/=255,o=Math.min(e,r,n),a=Math.max(e,r,n),f=(a+o)/2,a===o?(i=0,t=Number.NaN):i=.5>f?(a-o)/(a+o):(a-o)/(2-a-o),e===a?t=(r-n)/(a-o):r===a?t=2+(n-e)/(a-o):n===a&&(t=4+(e-r)/(a-o)),t*=60,0>t&&(t+=360),[t,i,f]},G=function(){var e,r,n,t,f,a,o,i,s,c;return c=S(arguments),o=c[0],n=c[1],e=c[2],a=Math.min(o,n,e),f=Math.max(o,n,e),r=f-a,s=f/255,0===f?(t=Number.NaN,i=0):(i=r/f,o===f&&(t=(n-e)/r),n===f&&(t=2+(e-o)/r),e===f&&(t=4+(o-n)/r),t*=60,0>t&&(t+=360)),[t,i,s]},E=function(){var e,r,n,t,f,a,o;return o=S(arguments),n=o[0],r=o[1],e=o[2],n=I(n),r=I(r),e=I(e),t=O((.4124564*n+.3575761*r+.1804375*e)/i),f=O((.2126729*n+.7151522*r+.072175*e)/s),a=O((.0193339*n+.119192*r+.9503041*e)/c),[116*f-16,500*(t-f),200*(f-a)]},I=function(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)},O=function(e){return e>.008856?Math.pow(e,1/3):7.787037*e+4/29},B=function(){var e,r,n,t,f,a,o;return a=S(arguments),f=a[0],n=a[1],r=a[2],o=E(f,n,r),t=o[0],e=o[1],r=o[2],x(t,e,r)},l.scale=function(e,r){var n,t,f,a,o,i,s,c,u,d,b,h,g,p,m,y,w,v,x,_,k;return y="rgb",w=l("#ccc"),k=0,g=!1,h=[0,1],d=[],x=!1,_=[],m=0,p=1,b=!1,v=0,u={},i=function(e,r){var n,t,f,a,i,s,c;if(null==e&&(e=["#ddd","#222"]),null!=e&&"string"===R(e)&&null!=(null!=(i=l.brewer)?i[e]:void 0)&&(e=l.brewer[e]),"array"===R(e)){for(e=e.slice(0),n=f=0,s=e.length-1;s>=0?s>=f:f>=s;n=s>=0?++f:--f)t=e[n],"string"===R(t)&&(e[n]=l(t));if(null!=r)_=r;else for(_=[],n=a=0,c=e.length-1;c>=0?c>=a:a>=c;n=c>=0?++a:--a)_.push(n/(e.length-1))}return o(),d=e},s=function(e){return null==e&&(e=[]),h=e,m=e[0],p=e[e.length-1],o(),v=2===e.length?0:e.length-1},f=function(e){var r,n;if(null!=h){for(n=h.length-1,r=0;n>r&&e>=h[r];)r++;return r-1}return 0},c=function(e){return e},n=function(e){var r,n,t,a,o;return o=e,h.length>2&&(a=h.length-1,r=f(e),t=h[0]+(h[1]-h[0])*(0+.5*k),n=h[a-1]+(h[a]-h[a-1])*(1-.5*k),o=m+(h[r]+.5*(h[r+1]-h[r])-t)/(n-t)*(p-m)),o},a=function(e,r){var n,t,a,o,i,s,b,g,x;if(null==r&&(r=!1),isNaN(e))return w;if(r?b=e:h.length>2?(n=f(e),b=n/(v-1)):(b=a=m!==p?(e-m)/(p-m):0,b=a=(e-m)/(p-m),b=Math.min(1,Math.max(0,b))),r||(b=c(b)),i=Math.floor(1e4*b),u[i])t=u[i];else{if("array"===R(d))for(o=g=0,x=_.length-1;x>=0?x>=g:g>=x;o=x>=0?++g:--g){if(s=_[o],s>=b){t=d[o];break}if(b>=s&&o===_.length-1){t=d[o];break}if(b>s&&b<_[o+1]){b=(b-s)/(_[o+1]-s),t=l.interpolate(d[o],d[o+1],b,y);break}}else"function"===R(d)&&(t=d(b));u[i]=t}return t},o=function(){return u={}},i(e,r),t=function(e){var r;return r=a(e),x&&r[x]?r[x]():r},t.domain=function(e,r,n,f){var a;return null==n&&(n="e"),arguments.length?(null!=r&&(a=l.analyze(e,f),e=0===r?[a.min,a.max]:l.limits(a,n,r)),s(e),t):h},t.mode=function(e){return arguments.length?(y=e,o(),t):y},t.range=function(e,r){return i(e,r),t},t.out=function(e){return x=e,t},t.spread=function(e){return arguments.length?(k=e,t):k},t.correctLightness=function(e){return arguments.length?(b=e,o(),c=b?function(e){var r,n,t,f,o,i,s,c,u;for(r=a(0,!0).lab()[0],n=a(1,!0).lab()[0],s=r>n,t=a(e,!0).lab()[0],o=r+(n-r)*e,f=t-o,c=0,u=1,i=20;Math.abs(f)>.01&&i-->0;)!function(){return s&&(f*=-1),0>f?(c=e,e+=.5*(u-e)):(u=e,e+=.5*(c-e)),t=a(e,!0).lab()[0],f=t-o}();return e}:function(e){return e},t):b},t.colors=function(r){var n,f,a,o,i,s;if(null==r&&(r="hex"),e=[],f=[],h.length>2)for(n=a=1,s=h.length;s>=1?s>a:a>s;n=s>=1?++a:--a)f.push(.5*(h[n-1]+h[n]));else f=h;for(o=0,i=f.length;i>o;o++)n=f[o],e.push(t(n)[r]());return e},t},null==(T=l.scales)&&(l.scales={}),l.scales.cool=function(){return l.scale([l.hsl(180,1,.9),l.hsl(250,.7,.4)])},l.scales.hot=function(){return l.scale(["#000","#f00","#ff0","#fff"],[0,.25,.75,1]).mode("rgb")},l.analyze=function(e,r,n){var t,f,a,o,i,s,c;if(a={min:Number.MAX_VALUE,max:-1*Number.MAX_VALUE,sum:0,values:[],count:0},null==n&&(n=function(){return!0}),t=function(e){null==e||isNaN(e)||(a.values.push(e),a.sum+=e,e<a.min&&(a.min=e),e>a.max&&(a.max=e),a.count+=1)},i=function(e,f){return n(e,f)?t(null!=r&&"function"===R(r)?r(e):null!=r&&"string"===R(r)||"number"===R(r)?e[r]:e):void 0},"array"===R(e))for(s=0,c=e.length;c>s;s++)o=e[s],i(o);else for(f in e)o=e[f],i(o,f);return a.domain=[a.min,a.max],a.limits=function(e,r){return l.limits(a,e,r)},a},l.limits=function(e,r,n){var t,f,a,o,i,s,c,u,d,b,h,g,p,m,y,w,v,x,_,k,j,M,N,D,U,A,P,z,G,E,B,I,q,S,O,C,T,Y,L,F,V,X,W,$,Z,H,J,K,Q,ee,re,ne,te,fe,ae,oe;if(null==r&&(r="equal"),null==n&&(n=7),"array"===R(e)&&(e=l.analyze(e)),p=e.min,h=e.max,N=e.sum,A=e.values.sort(function(e,r){return e-r}),b=[],"c"===r.substr(0,1)&&(b.push(p),b.push(h)),"e"===r.substr(0,1)){for(b.push(p),c=P=1,T=n-1;T>=1?T>=P:P>=T;c=T>=1?++P:--P)b.push(p+c/n*(h-p));b.push(h)}else if("l"===r.substr(0,1)){if(0>=p)throw"Logarithmic scales are only possible for values > 0";for(m=Math.LOG10E*Math.log(p),g=Math.LOG10E*Math.log(h),b.push(p),c=z=1,$=n-1;$>=1?$>=z:z>=$;c=$>=1?++z:--z)b.push(Math.pow(10,m+c/n*(g-m)));b.push(h)}else if("q"===r.substr(0,1)){for(b.push(p),c=G=1,Z=n-1;Z>=1?Z>=G:G>=Z;c=Z>=1?++G:--G)_=A.length*c/n,k=Math.floor(_),k===_?b.push(A[k]):(j=_-k,b.push(A[k]*j+A[k+1]*(1-j)));b.push(h)}else if("k"===r.substr(0,1)){for(w=A.length,t=new Array(w),i=new Array(n),M=!0,v=0,a=null,a=[],a.push(p),c=E=1,H=n-1;H>=1?H>=E:E>=H;c=H>=1?++E:--E)a.push(p+c/n*(h-p));for(a.push(h);M;){for(u=B=0,J=n-1;J>=0?J>=B:B>=J;u=J>=0?++B:--B)i[u]=0;for(c=I=0,K=w-1;K>=0?K>=I:I>=K;c=K>=0?++I:--I){for(U=A[c],y=Number.MAX_VALUE,u=q=0,Q=n-1;Q>=0?Q>=q:q>=Q;u=Q>=0?++q:--q)s=Math.abs(a[u]-U),y>s&&(y=s,f=u);i[f]++,t[c]=f}for(x=new Array(n),u=S=0,ee=n-1;ee>=0?ee>=S:S>=ee;u=ee>=0?++S:--S)x[u]=null;for(c=O=0,re=w-1;re>=0?re>=O:O>=re;c=re>=0?++O:--O)o=t[c],null===x[o]?x[o]=A[c]:x[o]+=A[c];for(u=C=0,Y=n-1;Y>=0?Y>=C:C>=Y;u=Y>=0?++C:--C)x[u]*=1/i[u];for(M=!1,u=ne=0,L=n-1;L>=0?L>=ne:ne>=L;u=L>=0?++ne:--ne)if(x[u]!==a[c]){M=!0;break}a=x,v++,v>200&&(M=!1)}for(d={},u=te=0,F=n-1;F>=0?F>=te:te>=F;u=F>=0?++te:--te)d[u]=[];for(c=fe=0,V=w-1;V>=0?V>=fe:fe>=V;c=V>=0?++fe:--fe)o=t[c],d[o].push(A[c]);for(D=[],u=ae=0,X=n-1;X>=0?X>=ae:ae>=X;u=X>=0?++ae:--ae)D.push(d[u][0]),D.push(d[u][d[u].length-1]);for(D=D.sort(function(e,r){return e-r}),b.push(D[0]),c=oe=1,W=D.length-1;W>=oe;c=oe+=2)isNaN(D[c])||b.push(D[c])}return b},l.brewer=d={OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],Set2:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],Accent:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],Set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],Set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],Dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],Paired:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],Pastel2:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],Pastel1:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},l.colors=h={indigo:"#4b0082",gold:"#ffd700",hotpink:"#ff69b4",firebrick:"#b22222",indianred:"#cd5c5c",yellow:"#ffff00",mistyrose:"#ffe4e1",darkolivegreen:"#556b2f",olive:"#808000",darkseagreen:"#8fbc8f",pink:"#ffc0cb",tomato:"#ff6347",lightcoral:"#f08080",orangered:"#ff4500",navajowhite:"#ffdead",lime:"#00ff00",palegreen:"#98fb98",darkslategrey:"#2f4f4f",greenyellow:"#adff2f",burlywood:"#deb887",seashell:"#fff5ee",mediumspringgreen:"#00fa9a",fuchsia:"#ff00ff",papayawhip:"#ffefd5",blanchedalmond:"#ffebcd",chartreuse:"#7fff00",dimgray:"#696969",black:"#000000",peachpuff:"#ffdab9",springgreen:"#00ff7f",aquamarine:"#7fffd4",white:"#ffffff",orange:"#ffa500",lightsalmon:"#ffa07a",darkslategray:"#2f4f4f",brown:"#a52a2a",ivory:"#fffff0",dodgerblue:"#1e90ff",peru:"#cd853f",lawngreen:"#7cfc00",chocolate:"#d2691e",crimson:"#dc143c",forestgreen:"#228b22",darkgrey:"#a9a9a9",lightseagreen:"#20b2aa",cyan:"#00ffff",mintcream:"#f5fffa",silver:"#c0c0c0",antiquewhite:"#faebd7",mediumorchid:"#ba55d3",skyblue:"#87ceeb",gray:"#808080",darkturquoise:"#00ced1",goldenrod:"#daa520",darkgreen:"#006400",floralwhite:"#fffaf0",darkviolet:"#9400d3",darkgray:"#a9a9a9",moccasin:"#ffe4b5",saddlebrown:"#8b4513",grey:"#808080",darkslateblue:"#483d8b",lightskyblue:"#87cefa",lightpink:"#ffb6c1",mediumvioletred:"#c71585",slategrey:"#708090",red:"#ff0000",deeppink:"#ff1493",limegreen:"#32cd32",darkmagenta:"#8b008b",palegoldenrod:"#eee8aa",plum:"#dda0dd",turquoise:"#40e0d0",lightgrey:"#d3d3d3",lightgoldenrodyellow:"#fafad2",darkgoldenrod:"#b8860b",lavender:"#e6e6fa",maroon:"#800000",yellowgreen:"#9acd32",sandybrown:"#f4a460",thistle:"#d8bfd8",violet:"#ee82ee",navy:"#000080",magenta:"#ff00ff",dimgrey:"#696969",tan:"#d2b48c",rosybrown:"#bc8f8f",olivedrab:"#6b8e23",blue:"#0000ff",lightblue:"#add8e6",ghostwhite:"#f8f8ff",honeydew:"#f0fff0",cornflowerblue:"#6495ed",slateblue:"#6a5acd",linen:"#faf0e6",darkblue:"#00008b",powderblue:"#b0e0e6",seagreen:"#2e8b57",darkkhaki:"#bdb76b",snow:"#fffafa",sienna:"#a0522d",mediumblue:"#0000cd",royalblue:"#4169e1",lightcyan:"#e0ffff",green:"#008000",mediumpurple:"#9370db",midnightblue:"#191970",cornsilk:"#fff8dc",paleturquoise:"#afeeee",bisque:"#ffe4c4",slategray:"#708090",darkcyan:"#008b8b",khaki:"#f0e68c",wheat:"#f5deb3",teal:"#008080",darkorchid:"#9932cc",deepskyblue:"#00bfff",salmon:"#fa8072",darkred:"#8b0000",steelblue:"#4682b4",palevioletred:"#db7093",lightslategray:"#778899",aliceblue:"#f0f8ff",lightslategrey:"#778899",lightgreen:"#90ee90",orchid:"#da70d6",gainsboro:"#dcdcdc",mediumseagreen:"#3cb371",lightgray:"#d3d3d3",mediumturquoise:"#48d1cc",lemonchiffon:"#fffacd",cadetblue:"#5f9ea0",lightyellow:"#ffffe0",lavenderblush:"#fff0f5",coral:"#ff7f50",purple:"#800080",aqua:"#00ffff",whitesmoke:"#f5f5f5",mediumslateblue:"#7b68ee",darkorange:"#ff8c00",mediumaquamarine:"#66cdaa",darksalmon:"#e9967a",beige:"#f5f5dc",blueviolet:"#8a2be2",azure:"#f0ffff",lightsteelblue:"#b0c4de",oldlace:"#fdf5e6"},R=function(){var e,r,n,t,f;for(e={},f="Boolean Number String Function Array Date RegExp Undefined Null".split(" "),n=0,t=f.length;t>n;n++)r=f[n],e["[object "+r+"]"]=r.toLowerCase();return function(r){var n;return n=Object.prototype.toString.call(r),e[n]||"object"}}(),N=function(e,r,n){return null==r&&(r=0),null==n&&(n=1),r>e&&(e=r),e>n&&(e=n),e},S=function(e){return e.length>=3?e:e[0]},o=2*Math.PI,a=Math.PI/3,g=Math.cos,u=function(e){var r,n,t,f,a,o,i,s,c,d,b;return e=function(){var r,n,t;for(t=[],r=0,n=e.length;n>r;r++)f=e[r],t.push(l(f));return t}(),2===e.length?(c=function(){var r,n,t;for(t=[],r=0,n=e.length;n>r;r++)f=e[r],
2
+ t.push(f.lab());return t}(),a=c[0],o=c[1],r=function(e){var r,n;return n=function(){var n,t;for(t=[],r=n=0;2>=n;r=++n)t.push(a[r]+e*(o[r]-a[r]));return t}(),l.lab.apply(l,n)}):3===e.length?(d=function(){var r,n,t;for(t=[],r=0,n=e.length;n>r;r++)f=e[r],t.push(f.lab());return t}(),a=d[0],o=d[1],i=d[2],r=function(e){var r,n;return n=function(){var n,t;for(t=[],r=n=0;2>=n;r=++n)t.push((1-e)*(1-e)*a[r]+2*(1-e)*e*o[r]+e*e*i[r]);return t}(),l.lab.apply(l,n)}):4===e.length?(b=function(){var r,n,t;for(t=[],r=0,n=e.length;n>r;r++)f=e[r],t.push(f.lab());return t}(),a=b[0],o=b[1],i=b[2],s=b[3],r=function(e){var r,n;return n=function(){var n,t;for(t=[],r=n=0;2>=n;r=++n)t.push((1-e)*(1-e)*(1-e)*a[r]+3*(1-e)*(1-e)*e*o[r]+3*(1-e)*e*e*i[r]+e*e*e*s[r]);return t}(),l.lab.apply(l,n)}):5===e.length&&(n=u(e.slice(0,3)),t=u(e.slice(2,5)),r=function(e){return.5>e?n(2*e):t(2*(e-.5))}),r},l.interpolate.bezier=u}).call(this)},{}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/delaunay-fast/delaunay.js":[function(e,r,n){var t;!function(){"use strict";function e(e){var r,n,t,f,a,o,i=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,u=Number.NEGATIVE_INFINITY;for(r=e.length;r--;)e[r][0]<i&&(i=e[r][0]),e[r][0]>c&&(c=e[r][0]),e[r][1]<s&&(s=e[r][1]),e[r][1]>u&&(u=e[r][1]);return n=c-i,t=u-s,f=Math.max(n,t),a=i+.5*n,o=s+.5*t,[[a-20*f,o-f],[a,o+20*f],[a+20*f,o-f]]}function n(e,r,n,t){var f,o,i,s,c,u,d,l,b,h,g=e[r][0],p=e[r][1],m=e[n][0],y=e[n][1],w=e[t][0],v=e[t][1],x=Math.abs(p-y),_=Math.abs(y-v);if(a>x&&a>_)throw new Error("Eek! Coincident points!");return a>x?(s=-((w-m)/(v-y)),u=(m+w)/2,l=(y+v)/2,f=(m+g)/2,o=s*(f-u)+l):a>_?(i=-((m-g)/(y-p)),c=(g+m)/2,d=(p+y)/2,f=(w+m)/2,o=i*(f-c)+d):(i=-((m-g)/(y-p)),s=-((w-m)/(v-y)),c=(g+m)/2,u=(m+w)/2,d=(p+y)/2,l=(y+v)/2,f=(i*c-s*u+l-d)/(i-s),o=x>_?i*(f-c)+d:s*(f-u)+l),b=m-f,h=y-o,{i:r,j:n,k:t,x:f,y:o,r:b*b+h*h}}function f(e){var r,n,t,f,a,o;for(n=e.length;n;)for(f=e[--n],t=e[--n],r=n;r;)if(o=e[--r],a=e[--r],t===a&&f===o||t===o&&f===a){e.splice(n,2),e.splice(r,2);break}}var a=1/1048576;t={triangulate:function(r,t){var o,i,s,c,u,d,l,b,h,g,p,m,y=r.length;if(3>y)return[];if(r=r.slice(0),t)for(o=y;o--;)r[o]=r[o][t];for(s=new Array(y),o=y;o--;)s[o]=o;for(s.sort(function(e,n){return r[n][0]-r[e][0]}),c=e(r),r.push(c[0],c[1],c[2]),u=[n(r,y+0,y+1,y+2)],d=[],l=[],o=s.length;o--;l.length=0){for(m=s[o],i=u.length;i--;)b=r[m][0]-u[i].x,b>0&&b*b>u[i].r?(d.push(u[i]),u.splice(i,1)):(h=r[m][1]-u[i].y,b*b+h*h-u[i].r>a||(l.push(u[i].i,u[i].j,u[i].j,u[i].k,u[i].k,u[i].i),u.splice(i,1)));for(f(l),i=l.length;i;)p=l[--i],g=l[--i],u.push(n(r,g,p,m))}for(o=u.length;o--;)d.push(u[o]);for(u.length=0,o=d.length;o--;)d[o].i<y&&d[o].j<y&&d[o].k<y&&u.push(d[o].i,d[o].j,d[o].k);return u},contains:function(e,r){if(r[0]<e[0][0]&&r[0]<e[1][0]&&r[0]<e[2][0]||r[0]>e[0][0]&&r[0]>e[1][0]&&r[0]>e[2][0]||r[1]<e[0][1]&&r[1]<e[1][1]&&r[1]<e[2][1]||r[1]>e[0][1]&&r[1]>e[1][1]&&r[1]>e[2][1])return null;var n=e[1][0]-e[0][0],t=e[2][0]-e[0][0],f=e[1][1]-e[0][1],a=e[2][1]-e[0][1],o=n*a-t*f;if(0===o)return null;var i=(a*(r[0]-e[0][0])-t*(r[1]-e[0][1]))/o,s=(n*(r[1]-e[0][1])-f*(r[0]-e[0][0]))/o;return 0>i||0>s||i+s>1?null:[i,s]}},"undefined"!=typeof r&&(r.exports=t)}()},{}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/index.js":[function(e,r,n){var t=e("./lib/alea"),f=e("./lib/xor128"),a=e("./lib/xorwow"),o=e("./lib/xorshift7"),i=e("./lib/xor4096"),s=e("./lib/tychei"),c=e("./seedrandom");c.alea=t,c.xor128=f,c.xorwow=a,c.xorshift7=o,c.xor4096=i,c.tychei=s,r.exports=c},{"./lib/alea":"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/alea.js","./lib/tychei":"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/tychei.js","./lib/xor128":"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/xor128.js","./lib/xor4096":"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/xor4096.js","./lib/xorshift7":"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/xorshift7.js","./lib/xorwow":"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/xorwow.js","./seedrandom":"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/seedrandom.js"}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/alea.js":[function(r,n,t){!function(e,r,n){function t(e){var r=this,n=o();r.next=function(){var e=2091639*r.s0+2.3283064365386963e-10*r.c;return r.s0=r.s1,r.s1=r.s2,r.s2=e-(r.c=0|e)},r.c=1,r.s0=n(" "),r.s1=n(" "),r.s2=n(" "),r.s0-=n(e),r.s0<0&&(r.s0+=1),r.s1-=n(e),r.s1<0&&(r.s1+=1),r.s2-=n(e),r.s2<0&&(r.s2+=1),n=null}function f(e,r){return r.c=e.c,r.s0=e.s0,r.s1=e.s1,r.s2=e.s2,r}function a(e,r){var n=new t(e),a=r&&r.state,o=n.next;return o.int32=function(){return 4294967296*n.next()|0},o["double"]=function(){return o()+1.1102230246251565e-16*(2097152*o()|0)},o.quick=o,a&&("object"==typeof a&&f(a,n),o.state=function(){return f(n,{})}),o}function o(){var e=4022871197,r=function(r){r=r.toString();for(var n=0;n<r.length;n++){e+=r.charCodeAt(n);var t=.02519603282416938*e;e=t>>>0,t-=e,t*=e,e=t>>>0,t-=e,e+=4294967296*t}return 2.3283064365386963e-10*(e>>>0)};return r}r&&r.exports?r.exports=a:n&&n.amd?n(function(){return a}):this.alea=a}(this,"object"==typeof n&&n,"function"==typeof e&&e)},{}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/tychei.js":[function(r,n,t){!function(e,r,n){function t(e){var r=this,n="";r.next=function(){var e=r.b,n=r.c,t=r.d,f=r.a;return e=e<<25^e>>>7^n,n=n-t|0,t=t<<24^t>>>8^f,f=f-e|0,r.b=e=e<<20^e>>>12^n,r.c=n=n-t|0,r.d=t<<16^n>>>16^f,r.a=f-e|0},r.a=0,r.b=0,r.c=-1640531527,r.d=1367130551,e===Math.floor(e)?(r.a=e/4294967296|0,r.b=0|e):n+=e;for(var t=0;t<n.length+20;t++)r.b^=0|n.charCodeAt(t),r.next()}function f(e,r){return r.a=e.a,r.b=e.b,r.c=e.c,r.d=e.d,r}function a(e,r){var n=new t(e),a=r&&r.state,o=function(){return(n.next()>>>0)/4294967296};return o["double"]=function(){do var e=n.next()>>>11,r=(n.next()>>>0)/4294967296,t=(e+r)/(1<<21);while(0===t);return t},o.int32=n.next,o.quick=o,a&&("object"==typeof a&&f(a,n),o.state=function(){return f(n,{})}),o}r&&r.exports?r.exports=a:n&&n.amd?n(function(){return a}):this.tychei=a}(this,"object"==typeof n&&n,"function"==typeof e&&e)},{}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/xor128.js":[function(r,n,t){!function(e,r,n){function t(e){var r=this,n="";r.x=0,r.y=0,r.z=0,r.w=0,r.next=function(){var e=r.x^r.x<<11;return r.x=r.y,r.y=r.z,r.z=r.w,r.w^=r.w>>>19^e^e>>>8},e===(0|e)?r.x=e:n+=e;for(var t=0;t<n.length+64;t++)r.x^=0|n.charCodeAt(t),r.next()}function f(e,r){return r.x=e.x,r.y=e.y,r.z=e.z,r.w=e.w,r}function a(e,r){var n=new t(e),a=r&&r.state,o=function(){return(n.next()>>>0)/4294967296};return o["double"]=function(){do var e=n.next()>>>11,r=(n.next()>>>0)/4294967296,t=(e+r)/(1<<21);while(0===t);return t},o.int32=n.next,o.quick=o,a&&("object"==typeof a&&f(a,n),o.state=function(){return f(n,{})}),o}r&&r.exports?r.exports=a:n&&n.amd?n(function(){return a}):this.xor128=a}(this,"object"==typeof n&&n,"function"==typeof e&&e)},{}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/xor4096.js":[function(r,n,t){!function(e,r,n){function t(e){function r(e,r){var n,t,f,a,o,i=[],s=128;for(r===(0|r)?(t=r,r=null):(r+="\x00",t=0,s=Math.max(s,r.length)),f=0,a=-32;s>a;++a)r&&(t^=r.charCodeAt((a+32)%r.length)),0===a&&(o=t),t^=t<<10,t^=t>>>15,t^=t<<4,t^=t>>>13,a>=0&&(o=o+1640531527|0,n=i[127&a]^=t+o,f=0==n?f+1:0);for(f>=128&&(i[127&(r&&r.length||0)]=-1),f=127,a=512;a>0;--a)t=i[f+34&127],n=i[f=f+1&127],t^=t<<13,n^=n<<17,t^=t>>>15,n^=n>>>12,i[f]=t^n;e.w=o,e.X=i,e.i=f}var n=this;n.next=function(){var e,r,t=n.w,f=n.X,a=n.i;return n.w=t=t+1640531527|0,r=f[a+34&127],e=f[a=a+1&127],r^=r<<13,e^=e<<17,r^=r>>>15,e^=e>>>12,r=f[a]=r^e,n.i=a,r+(t^t>>>16)|0},r(n,e)}function f(e,r){return r.i=e.i,r.w=e.w,r.X=e.X.slice(),r}function a(e,r){null==e&&(e=+new Date);var n=new t(e),a=r&&r.state,o=function(){return(n.next()>>>0)/4294967296};return o["double"]=function(){do var e=n.next()>>>11,r=(n.next()>>>0)/4294967296,t=(e+r)/(1<<21);while(0===t);return t},o.int32=n.next,o.quick=o,a&&(a.X&&f(a,n),o.state=function(){return f(n,{})}),o}r&&r.exports?r.exports=a:n&&n.amd?n(function(){return a}):this.xor4096=a}(this,"object"==typeof n&&n,"function"==typeof e&&e)},{}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/xorshift7.js":[function(r,n,t){!function(e,r,n){function t(e){function r(e,r){var n,t,f=[];if(r===(0|r))t=f[0]=r;else for(r=""+r,n=0;n<r.length;++n)f[7&n]=f[7&n]<<15^r.charCodeAt(n)+f[n+1&7]<<13;for(;f.length<8;)f.push(0);for(n=0;8>n&&0===f[n];++n);for(t=8==n?f[7]=-1:f[n],e.x=f,e.i=0,n=256;n>0;--n)e.next()}var n=this;n.next=function(){var e,r,t=n.x,f=n.i;return e=t[f],e^=e>>>7,r=e^e<<24,e=t[f+1&7],r^=e^e>>>10,e=t[f+3&7],r^=e^e>>>3,e=t[f+4&7],r^=e^e<<7,e=t[f+7&7],e^=e<<13,r^=e^e<<9,t[f]=r,n.i=f+1&7,r},r(n,e)}function f(e,r){return r.x=e.x.slice(),r.i=e.i,r}function a(e,r){null==e&&(e=+new Date);var n=new t(e),a=r&&r.state,o=function(){return(n.next()>>>0)/4294967296};return o["double"]=function(){do var e=n.next()>>>11,r=(n.next()>>>0)/4294967296,t=(e+r)/(1<<21);while(0===t);return t},o.int32=n.next,o.quick=o,a&&(a.x&&f(a,n),o.state=function(){return f(n,{})}),o}r&&r.exports?r.exports=a:n&&n.amd?n(function(){return a}):this.xorshift7=a}(this,"object"==typeof n&&n,"function"==typeof e&&e)},{}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/lib/xorwow.js":[function(r,n,t){!function(e,r,n){function t(e){var r=this,n="";r.next=function(){var e=r.x^r.x>>>2;return r.x=r.y,r.y=r.z,r.z=r.w,r.w=r.v,(r.d=r.d+362437|0)+(r.v=r.v^r.v<<4^(e^e<<1))|0},r.x=0,r.y=0,r.z=0,r.w=0,r.v=0,e===(0|e)?r.x=e:n+=e;for(var t=0;t<n.length+64;t++)r.x^=0|n.charCodeAt(t),t==n.length&&(r.d=r.x<<10^r.x>>>4),r.next()}function f(e,r){return r.x=e.x,r.y=e.y,r.z=e.z,r.w=e.w,r.v=e.v,r.d=e.d,r}function a(e,r){var n=new t(e),a=r&&r.state,o=function(){return(n.next()>>>0)/4294967296};return o["double"]=function(){do var e=n.next()>>>11,r=(n.next()>>>0)/4294967296,t=(e+r)/(1<<21);while(0===t);return t},o.int32=n.next,o.quick=o,a&&("object"==typeof a&&f(a,n),o.state=function(){return f(n,{})}),o}r&&r.exports?r.exports=a:n&&n.amd?n(function(){return a}):this.xorwow=a}(this,"object"==typeof n&&n,"function"==typeof e&&e)},{}],"/Users/gpriday/Downloads/trianglify-master 2/node_modules/seedrandom/seedrandom.js":[function(r,n,t){!function(t,f){function a(e,r,n){var a=[];r=1==r?{entropy:!0}:r||{};var l=c(s(r.entropy?[e,d(t)]:null==e?u():e,3),a),b=new o(a),p=function(){for(var e=b.g(g),r=y,n=0;w>e;)e=(e+n)*h,r*=h,n=b.g(1);for(;e>=v;)e/=2,r/=2,n>>>=1;return(e+n)/r};return p.int32=function(){return 0|b.g(4)},p.quick=function(){return b.g(4)/4294967296},p["double"]=p,c(d(b.S),t),(r.pass||n||function(e,r,n,t){return t&&(t.S&&i(t,b),e.state=function(){return i(b,{})}),n?(f[m]=e,r):e})(p,l,"global"in r?r.global:this==f,r.state)}function o(e){var r,n=e.length,t=this,f=0,a=t.i=t.j=0,o=t.S=[];for(n||(e=[n++]);h>f;)o[f]=f++;for(f=0;h>f;f++)o[f]=o[a=x&a+e[f%n]+(r=o[f])],o[a]=r;(t.g=function(e){for(var r,n=0,f=t.i,a=t.j,o=t.S;e--;)r=o[f=x&f+1],n=n*h+o[x&(o[f]=o[a=x&a+r])+(o[a]=r)];return t.i=f,t.j=a,n})(h)}function i(e,r){return r.i=e.i,r.j=e.j,r.S=e.S.slice(),r}function s(e,r){var n,t=[],f=typeof e;if(r&&"object"==f)for(n in e)try{t.push(s(e[n],r-1))}catch(a){}return t.length?t:"string"==f?e:e+"\x00"}function c(e,r){for(var n,t=e+"",f=0;f<t.length;)r[x&f]=x&(n^=19*r[x&f])+t.charCodeAt(f++);return d(r)}function u(){try{if(l)return d(l.randomBytes(h));var e=new Uint8Array(h);return(b.crypto||b.msCrypto).getRandomValues(e),d(e)}catch(r){var n=b.navigator,f=n&&n.plugins;return[+new Date,b,f,b.screen,d(t)]}}function d(e){return String.fromCharCode.apply(0,e)}var l,b=this,h=256,g=6,p=52,m="random",y=f.pow(h,g),w=f.pow(2,p),v=2*w,x=h-1;if(f["seed"+m]=a,c(f.random(),t),"object"==typeof n&&n.exports){n.exports=a;try{l=r("crypto")}catch(_){}}else"function"==typeof e&&e.amd&&e(function(){return a})}([],Math)},{crypto:!1}]},{},["./lib/trianglify.js"])("./lib/trianglify.js")});
base/inc.php CHANGED
@@ -167,7 +167,7 @@ function siteorigin_widget_preview_widget_action(){
167
  add_action('wp_ajax_so_widgets_preview', 'siteorigin_widget_preview_widget_action');
168
 
169
  /**
170
- *
171
  */
172
  function siteorigin_widget_search_posts_action(){
173
  if ( empty( $_REQUEST['_widgets_nonce'] ) || !wp_verify_nonce( $_REQUEST['_widgets_nonce'], 'widgets_action' ) ) return;
@@ -201,8 +201,6 @@ function siteorigin_widget_search_posts_action(){
201
  ", ARRAY_A );
202
 
203
  echo json_encode( $results );
204
-
205
-
206
  wp_die();
207
  }
208
  add_action('wp_ajax_so_widgets_search_posts', 'siteorigin_widget_search_posts_action');
@@ -216,7 +214,7 @@ add_action('wp_ajax_so_widgets_search_posts', 'siteorigin_widget_search_posts_ac
216
  */
217
  function siteorigin_widget_add_bundle_groups($widgets){
218
  foreach( $widgets as $class => &$widget ) {
219
- if( preg_match('/SiteOrigin_Widget_(.*)_Widget/', $class, $matches) ) {
220
  $widget['icon'] = 'so-widget-icon so-widget-icon-'.strtolower($matches[1]);
221
  $widget['groups'] = array('so-widgets-bundle');
222
  }
167
  add_action('wp_ajax_so_widgets_preview', 'siteorigin_widget_preview_widget_action');
168
 
169
  /**
170
+ * Action to handle searching
171
  */
172
  function siteorigin_widget_search_posts_action(){
173
  if ( empty( $_REQUEST['_widgets_nonce'] ) || !wp_verify_nonce( $_REQUEST['_widgets_nonce'], 'widgets_action' ) ) return;
201
  ", ARRAY_A );
202
 
203
  echo json_encode( $results );
 
 
204
  wp_die();
205
  }
206
  add_action('wp_ajax_so_widgets_search_posts', 'siteorigin_widget_search_posts_action');
214
  */
215
  function siteorigin_widget_add_bundle_groups($widgets){
216
  foreach( $widgets as $class => &$widget ) {
217
+ if( preg_match('/SiteOrigin_Widget_(.*)_Widget/i', $class, $matches) ) {
218
  $widget['icon'] = 'so-widget-icon so-widget-icon-'.strtolower($matches[1]);
219
  $widget['groups'] = array('so-widgets-bundle');
220
  }
base/inc/fields/base.class.php CHANGED
@@ -204,7 +204,7 @@ abstract class SiteOrigin_Widget_Field_Base {
204
  *
205
  * @return array The array of label CSS classes.
206
  */
207
- protected function get_label_classes() {
208
  return array( 'siteorigin-widget-field-label' );
209
  }
210
 
@@ -272,19 +272,19 @@ abstract class SiteOrigin_Widget_Field_Base {
272
  * @param $instance array The current widget instance.
273
  */
274
  protected function render_before_field( $value, $instance ) {
275
- $this->render_field_label();
276
  }
277
 
278
  /**
279
  * Default label rendering implementation. Subclasses should override if necessary to render labels differently.
280
  */
281
- protected function render_field_label() {
282
  ?>
283
- <label for="<?php echo esc_attr( $this->element_id ) ?>" <?php $this->render_CSS_classes( $this->get_label_classes() ) ?>>
284
  <?php
285
  echo esc_html( $this->label );
286
  if( !empty( $this->optional ) ) {
287
- echo '<span class="field-optional">(' . __('Optional', 'siteorigin-panels') . ')</span>';
288
  }
289
  ?>
290
  </label>
204
  *
205
  * @return array The array of label CSS classes.
206
  */
207
+ protected function get_label_classes( $value, $instance ) {
208
  return array( 'siteorigin-widget-field-label' );
209
  }
210
 
272
  * @param $instance array The current widget instance.
273
  */
274
  protected function render_before_field( $value, $instance ) {
275
+ $this->render_field_label( $value, $instance );
276
  }
277
 
278
  /**
279
  * Default label rendering implementation. Subclasses should override if necessary to render labels differently.
280
  */
281
+ protected function render_field_label( $value, $instance ) {
282
  ?>
283
+ <label for="<?php echo esc_attr( $this->element_id ) ?>" <?php $this->render_CSS_classes( $this->get_label_classes( $value, $instance ) ) ?>>
284
  <?php
285
  echo esc_html( $this->label );
286
  if( !empty( $this->optional ) ) {
287
+ echo '<span class="field-optional">(' . __('Optional', 'so-widgets-bundle') . ')</span>';
288
  }
289
  ?>
290
  </label>
base/inc/fields/checkbox.class.php CHANGED
@@ -15,7 +15,7 @@ class SiteOrigin_Widget_Field_Checkbox extends SiteOrigin_Widget_Field_Base {
15
  <?php
16
  }
17
 
18
- protected function render_field_label() {
19
  // Empty override. This field renders it's own label in the render_field() function.
20
  }
21
 
15
  <?php
16
  }
17
 
18
+ protected function render_field_label( $value, $instance ) {
19
  // Empty override. This field renders it's own label in the render_field() function.
20
  }
21
 
base/inc/fields/container-base.class.php CHANGED
@@ -41,6 +41,13 @@ abstract class SiteOrigin_Widget_Field_Container_Base extends SiteOrigin_Widget_
41
  * @var bool
42
  */
43
  protected $hide;
 
 
 
 
 
 
 
44
  /**
45
  * Whether or not this container's fields are rendered within a collapsible container.
46
  *
@@ -56,15 +63,26 @@ abstract class SiteOrigin_Widget_Field_Container_Base extends SiteOrigin_Widget_
56
  $this->parent_container = $parent_container;
57
  }
58
 
59
- protected function get_label_classes() {
60
- $label_classes = parent::get_label_classes();
61
- if( empty( $this->hide ) ) $label_classes[] = 'siteorigin-widget-section-visible';
 
 
 
 
 
 
 
 
 
 
 
62
  return $label_classes;
63
  }
64
 
65
- protected function render_field_label() {
66
  if ($this->collapsible ) {
67
- parent::render_field_label();
68
  }
69
  }
70
 
41
  * @var bool
42
  */
43
  protected $hide;
44
+ /**
45
+ * The current visibility state of this container.
46
+ *
47
+ * @access protected
48
+ * @var string
49
+ */
50
+ protected $state;
51
  /**
52
  * Whether or not this container's fields are rendered within a collapsible container.
53
  *
63
  $this->parent_container = $parent_container;
64
  }
65
 
66
+ protected function render_before_field( $value, $instance ) {
67
+ if( ! empty( $value[ 'so_field_container_state' ] ) ) {
68
+ $this->state = $value[ 'so_field_container_state' ];
69
+ }
70
+ else {
71
+ $this->state = $this->hide ? 'closed' : 'open';
72
+ }
73
+
74
+ parent::render_before_field( $value, $instance );
75
+ }
76
+
77
+ protected function get_label_classes( $value, $instance ) {
78
+ $label_classes = parent::get_label_classes( $value, $instance );
79
+ if( $this->state == 'open' ) $label_classes[] = 'siteorigin-widget-section-visible';
80
  return $label_classes;
81
  }
82
 
83
+ protected function render_field_label( $value, $instance ) {
84
  if ($this->collapsible ) {
85
+ parent::render_field_label( $value, $instance );
86
  }
87
  }
88
 
base/inc/fields/error.class.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ *
5
+ * This class is used when a field class can't be found to display an error message to the user.
6
+ *
7
+ * Class SiteOrigin_Widget_Field_Error
8
+ */
9
+ class SiteOrigin_Widget_Field_Error extends SiteOrigin_Widget_Field_Base {
10
+
11
+ /**
12
+ * An error message to display.
13
+ *
14
+ * @access protected
15
+ * @var string
16
+ */
17
+ protected $message;
18
+
19
+ protected function render_field( $value, $instance ) {
20
+ printf( __($this->message, 'so-widgets-bundle') );
21
+ }
22
+
23
+ protected function sanitize_field_input( $value ) {
24
+ return $value;
25
+ }
26
+ }
base/inc/fields/factory.class.php CHANGED
@@ -19,10 +19,20 @@ class SiteOrigin_Widget_Field_Factory {
19
  $element_name = $for_widget->so_get_field_name( $field_name, $for_repeater );
20
  if ( empty( $field_options['type'] ) ) {
21
  $field_options['type'] = 'text';
22
- $field_options['label'] = __( 'This field does not have a type. Please specify a type for it to be rendered correctly.', 'siteorigin-widgets' );
23
  }
24
  $field_class = $this->get_field_class_name( $field_options['type'] );
25
 
 
 
 
 
 
 
 
 
 
 
26
  if( $this->is_container_type( $field_options['type'] ) ) {
27
  return new $field_class( $field_name, $element_id, $element_name, $field_options, $for_widget, $for_repeater );
28
  }
19
  $element_name = $for_widget->so_get_field_name( $field_name, $for_repeater );
20
  if ( empty( $field_options['type'] ) ) {
21
  $field_options['type'] = 'text';
22
+ $field_options['label'] = __( 'This field does not have a type. Please specify a type for it to be rendered correctly.', 'so-widgets-bundle' );
23
  }
24
  $field_class = $this->get_field_class_name( $field_options['type'] );
25
 
26
+ // If we still don't have a class use the 'SiteOrigin_Widget_Field_Error' class to indicate this to the user.
27
+ if( ! class_exists( $field_class ) ) {
28
+ return new SiteOrigin_Widget_Field_Error('', '', '',
29
+ array(
30
+ 'type' => 'error',
31
+ 'message' => 'The class \'' . $field_class . '\' could not be found. Please make sure you specified the correct field type and that the class exists.'
32
+ )
33
+ );
34
+ }
35
+
36
  if( $this->is_container_type( $field_options['type'] ) ) {
37
  return new $field_class( $field_name, $element_id, $element_name, $field_options, $for_widget, $for_repeater );
38
  }
base/inc/fields/media.class.php CHANGED
@@ -60,15 +60,15 @@ class SiteOrigin_Widget_Field_Media extends SiteOrigin_Widget_Field_Base {
60
 
61
  protected function get_default_options() {
62
  return array(
63
- 'choose' => __( 'Choose Media', 'siteorigin-widgets' ),
64
- 'update' => __( 'Set Media', 'siteorigin-widgets' ),
65
  'library' => 'image'
66
  );
67
  }
68
 
69
  protected function render_field( $value, $instance ) {
70
  if( version_compare( get_bloginfo('version'), '3.5', '<' ) ){
71
- printf( __('You need to <a href="%s">upgrade</a> to WordPress 3.5 to use media fields', 'siteorigin-widgets'), admin_url('update-core.php') );
72
  return;
73
  }
74
 
60
 
61
  protected function get_default_options() {
62
  return array(
63
+ 'choose' => __( 'Choose Media', 'so-widgets-bundle' ),
64
+ 'update' => __( 'Set Media', 'so-widgets-bundle' ),
65
  'library' => 'image'
66
  );
67
  }
68
 
69
  protected function render_field( $value, $instance ) {
70
  if( version_compare( get_bloginfo('version'), '3.5', '<' ) ){
71
+ printf( __('You need to <a href="%s">upgrade</a> to WordPress 3.5 to use media fields', 'so-widgets-bundle'), admin_url('update-core.php') );
72
  return;
73
  }
74
 
base/inc/fields/number.class.php CHANGED
@@ -12,6 +12,6 @@ class SiteOrigin_Widget_Field_Number extends SiteOrigin_Widget_Field_Text_Input_
12
  }
13
 
14
  protected function sanitize_field_input( $value ) {
15
- return (float) $value;
16
  }
17
  }
12
  }
13
 
14
  protected function sanitize_field_input( $value ) {
15
+ return ( $value === '' ) ? false : (float) $value;
16
  }
17
  }
base/inc/fields/repeater.class.php CHANGED
@@ -44,10 +44,14 @@ class SiteOrigin_Widget_Field_Repeater extends SiteOrigin_Widget_Field_Container
44
  $item_label = isset( $this->item_label ) ? $this->item_label : null;
45
  if ( ! empty( $item_label ) ) {
46
  // convert underscore naming convention to camelCase for javascript and encode as json string
 
 
 
 
47
  $item_label = siteorigin_widgets_underscores_to_camel_case( $item_label );
48
  $item_label = json_encode( $item_label );
49
  }
50
- if( empty( $this->item_name ) ) $this->item_name = __( 'Item', 'siteorigin-widgets' );
51
  ?>
52
  <div class="siteorigin-widget-field-repeater"
53
  data-item-name="<?php echo esc_attr( $this->item_name ) ?>"
@@ -101,7 +105,7 @@ class SiteOrigin_Widget_Field_Repeater extends SiteOrigin_Widget_Field_Container
101
  <?php
102
  }
103
 
104
- protected function render_field_label() {
105
  // Empty override. This field renders it's own label in the render_field() function.
106
  }
107
 
44
  $item_label = isset( $this->item_label ) ? $this->item_label : null;
45
  if ( ! empty( $item_label ) ) {
46
  // convert underscore naming convention to camelCase for javascript and encode as json string
47
+ $item_label = wp_parse_args( $item_label, array(
48
+ 'update_event' => 'change',
49
+ 'value_method' => 'val'
50
+ ) );
51
  $item_label = siteorigin_widgets_underscores_to_camel_case( $item_label );
52
  $item_label = json_encode( $item_label );
53
  }
54
+ if( empty( $this->item_name ) ) $this->item_name = __( 'Item', 'so-widgets-bundle' );
55
  ?>
56
  <div class="siteorigin-widget-field-repeater"
57
  data-item-name="<?php echo esc_attr( $this->item_name ) ?>"
105
  <?php
106
  }
107
 
108
+ protected function render_field_label( $value, $instance ) {
109
  // Empty override. This field renders it's own label in the render_field() function.
110
  }
111
 
base/inc/fields/section.class.php CHANGED
@@ -6,10 +6,18 @@
6
  class SiteOrigin_Widget_Field_Section extends SiteOrigin_Widget_Field_Container_Base {
7
 
8
  protected function render_field( $value, $instance ) {
9
- ?><div class="siteorigin-widget-section <?php if( !empty( $this->hide ) ) echo 'siteorigin-widget-section-hide'; ?>"><?php
10
- if ( !isset( $this->fields ) || empty($this->fields ) ) return;
 
 
 
 
11
  $this->create_and_render_sub_fields( $value, array( 'name' => $this->base_name, 'type' => 'section' ) );
12
- ?></div><?php
 
 
 
 
13
  }
14
 
15
  }
6
  class SiteOrigin_Widget_Field_Section extends SiteOrigin_Widget_Field_Container_Base {
7
 
8
  protected function render_field( $value, $instance ) {
9
+ ?>
10
+ <div class="siteorigin-widget-section <?php if( $this->state == 'closed' ) echo 'siteorigin-widget-section-hide'; ?>"><?php
11
+ if ( !isset( $this->fields ) || empty($this->fields ) ) {
12
+ echo '</div>';
13
+ return;
14
+ }
15
  $this->create_and_render_sub_fields( $value, array( 'name' => $this->base_name, 'type' => 'section' ) );
16
+ ?>
17
+ <input type="hidden"
18
+ name="<?php echo esc_attr( $this->element_name . '[so_field_container_state]' ) ?>" id="<?php echo esc_attr( $this->element_id . '-so_field_container_state' ) ?>"
19
+ class="siteorigin-widget-input siteorigin-widget-field-container-state" value="<?php echo esc_attr( $this->state ) ?>"/>
20
+ </div><?php
21
  }
22
 
23
  }
base/inc/fields/widget.class.php CHANGED
@@ -29,11 +29,11 @@ class SiteOrigin_Widget_Field_Widget extends SiteOrigin_Widget_Field_Container_B
29
  protected function render_field( $value, $instance ) {
30
  // Create the extra form entries
31
  if ( $this->collapsible ) {
32
- ?><div class="siteorigin-widget-section <?php if( !empty( $this->hide ) ) echo 'siteorigin-widget-section-hide'; ?>"><?php
33
  }
34
 
35
  if( ! class_exists( $this->class ) ) {
36
- printf( __( '%s does not exist', 'siteorigin-widgets' ), $this->class );
37
  if ( $this->collapsible ) {
38
  echo '</div>';
39
  }
@@ -43,7 +43,7 @@ class SiteOrigin_Widget_Field_Widget extends SiteOrigin_Widget_Field_Container_B
43
  /* @var $sub_widget SiteOrigin_Widget */
44
  $sub_widget = new $this->class;
45
  if( ! is_a( $sub_widget, 'SiteOrigin_Widget' ) ) {
46
- printf( __( '%s is not a SiteOrigin Widget', 'siteorigin-widgets' ), $this->class );
47
  if ( $this->collapsible ) {
48
  echo '</div>';
49
  }
29
  protected function render_field( $value, $instance ) {
30
  // Create the extra form entries
31
  if ( $this->collapsible ) {
32
+ ?><div class="siteorigin-widget-section <?php if( $this->state == 'closed' ) echo 'siteorigin-widget-section-hide'; ?>"><?php
33
  }
34
 
35
  if( ! class_exists( $this->class ) ) {
36
+ printf( __( '%s does not exist', 'so-widgets-bundle' ), $this->class );
37
  if ( $this->collapsible ) {
38
  echo '</div>';
39
  }
43
  /* @var $sub_widget SiteOrigin_Widget */
44
  $sub_widget = new $this->class;
45
  if( ! is_a( $sub_widget, 'SiteOrigin_Widget' ) ) {
46
+ printf( __( '%s is not a SiteOrigin Widget', 'so-widgets-bundle' ), $this->class );
47
  if ( $this->collapsible ) {
48
  echo '</div>';
49
  }
base/inc/meta-box-manager.php CHANGED
@@ -32,7 +32,7 @@ class SiteOrigin_Widget_Meta_Box_Manager extends SiteOrigin_Widget {
32
  public function __construct() {
33
  parent::__construct(
34
  'sow-meta-box-manager',
35
- __('SiteOrigin Meta Box Manager', 'siteorigin-widgets'),
36
  array(
37
  'has_preview' => false,
38
  'help' => 'https://siteorigin.com/docs/widgets-bundle/advanced-concepts/widget-post-meta-box-forms/'
@@ -74,7 +74,7 @@ class SiteOrigin_Widget_Meta_Box_Manager extends SiteOrigin_Widget {
74
  if ( !empty( $this->form_options ) ) {
75
  add_meta_box(
76
  'siteorigin-widgets-meta-box',
77
- __( 'Widgets Bundle Post Meta Data', 'siteorigin-widgets' ),
78
  array( $this, 'render_widgets_meta_box' ),
79
  $post_type,
80
  'advanced'
32
  public function __construct() {
33
  parent::__construct(
34
  'sow-meta-box-manager',
35
+ __('SiteOrigin Meta Box Manager', 'so-widgets-bundle'),
36
  array(
37
  'has_preview' => false,
38
  'help' => 'https://siteorigin.com/docs/widgets-bundle/advanced-concepts/widget-post-meta-box-forms/'
74
  if ( !empty( $this->form_options ) ) {
75
  add_meta_box(
76
  'siteorigin-widgets-meta-box',
77
+ __( 'Widgets Bundle Post Meta Data', 'so-widgets-bundle' ),
78
  array( $this, 'render_widgets_meta_box' ),
79
  $post_type,
80
  'advanced'
base/inc/post-selector.php CHANGED
@@ -10,13 +10,13 @@ function siteorigin_widget_post_selector_enqueue_admin_scripts() {
10
  'ajaxurl' => wp_nonce_url( admin_url('admin-ajax.php'), 'widgets_action', '_widgets_nonce' ),
11
  'modal' => file_get_contents( plugin_dir_path(SOW_BUNDLE_BASE_FILE).'base/tpl/posts-selector/modal.html' ),
12
  'postSummary' => file_get_contents( plugin_dir_path(SOW_BUNDLE_BASE_FILE).'base/tpl/posts-selector/post.html' ),
13
- 'foundPosts' => '<div class="sow-post-count-message">' . sprintf( __('This query returns <a href="#" class="preview-query-posts">%s posts</a>.', 'siteorigin-widgets'), '<%= foundPosts %>') . '</div>',
14
  'fields' => siteorigin_widget_post_selector_form_fields(),
15
  'selector' => file_get_contents( plugin_dir_path(SOW_BUNDLE_BASE_FILE).'base/tpl/posts-selector/selector.html' ),
16
  ) );
17
 
18
  wp_localize_script( 'siteorigin-widget-admin-posts-selector', 'sowPostsSelectorVars', array(
19
- 'modalTitle' => __('Select posts', 'siteorigin-widgets'),
20
  ) );
21
  }
22
  }
@@ -98,9 +98,9 @@ function siteorigin_widget_post_selector_form_fields(){
98
 
99
  // The post type field
100
  $return['post_type'] = '';
101
- $return['post_type'] .= '<label><span>' . __('Post type', 'siteorigin-widgets') . '</span>';
102
  $return['post_type'] .= '<select name="post_type">';
103
- $return['post_type'] .= '<option value="_all">' . __('All', 'siteorigin-widgets') . '</option>';
104
  foreach( get_post_types( array( 'public' => true ), 'objects' ) as $id => $type ) {
105
  if(!empty($type->labels->name)) {
106
  $post_types[$id] = $type->labels->name;
@@ -111,36 +111,36 @@ function siteorigin_widget_post_selector_form_fields(){
111
 
112
  // The field for specifying individual posts
113
  $return['post__in'] = '';
114
- $return['post__in'] .= '<label><span>' . __('Post in', 'siteorigin-widgets') . '</span>';
115
  $return['post__in'] .= '<input type="text" name="post__in" class="" />';
116
- $return['post__in'] .= ' <a href="#" class="sow-select-posts button button-secondary">' . __('Select posts', 'siteorigin-widget') . '</a>';
117
  $return['post__in'] .= '</label>';
118
 
119
  // The taxonomy field
120
  $return['tax_query'] = '';
121
- $return['tax_query'] .= '<label><span>' . __('Taxonomies', 'siteorigin-widgets') . '</span>';
122
  $return['tax_query'] .= '<input type="text" name="tax_query" class="" placeholder="search" />';
123
  $return['tax_query'] .= '</label>';
124
 
125
 
126
  // The order by field
127
  $return['orderby'] = '';
128
- $return['orderby'] .= '<label><span>' . __('Order by', 'siteorigin-widgets') . '</span>';
129
  $return['orderby'] .= '<select name="orderby">';
130
  $orderby = array(
131
- 'none' => __('No order', 'siteorigin-widgets'),
132
- 'ID' => __('Post ID', 'siteorigin-widgets'),
133
- 'author' => __('Author', 'siteorigin-widgets'),
134
- 'title' => __('Title', 'siteorigin-widgets'),
135
- 'date' => __('Published date', 'siteorigin-widgets'),
136
- 'modified' => __('Modified date', 'siteorigin-widgets'),
137
- 'parent' => __('By parent', 'siteorigin-widgets'),
138
- 'rand' => __('Random order', 'siteorigin-widgets'),
139
- 'comment_count' => __('Comment count', 'siteorigin-widgets'),
140
- 'menu_order' => __('Menu order', 'siteorigin-widgets'),
141
- 'meta_value' => __('By meta value', 'siteorigin-widgets'),
142
- 'meta_value_num' => __('By numeric meta value', 'siteorigin-widgets'),
143
- 'post__in' => __('By include order', 'siteorigin-widgets'),
144
  );
145
  foreach($orderby as $id => $v) {
146
  $return['orderby'] .= '<option value="' . $id . '">' . $v . '</option>';
@@ -151,19 +151,19 @@ function siteorigin_widget_post_selector_form_fields(){
151
  $return['orderby'] .= '</label>';
152
 
153
  $return['posts_per_page'] = '';
154
- $return['posts_per_page'] .= '<label><span>' . __('Posts per page', 'siteorigin-widgets') . '</span>';
155
  $return['posts_per_page'] .= '<input type="number" name="posts_per_page" class="" />';
156
  $return['posts_per_page'] .= '</label>';
157
 
158
 
159
  $return['sticky'] = '';
160
- $return['sticky'] .= '<label><span>' . __('Sticky posts', 'siteorigin-widgets') . '</span>';
161
  $return['sticky'] .= '<select name="sticky">';
162
  $sticky = array(
163
- '' => __('Default', 'siteorigin-widgets'),
164
- 'ignore' => __('Ignore sticky', 'siteorigin-widgets'),
165
- 'exclude' => __('Exclude sticky', 'siteorigin-widgets'),
166
- 'only' => __('Include sticky', 'siteorigin-widgets'),
167
  );
168
  foreach($sticky as $id => $v) {
169
  $return['sticky'] .= '<option value="' . $id . '">' . $v . '</option>';
@@ -171,9 +171,9 @@ function siteorigin_widget_post_selector_form_fields(){
171
  $return['sticky'] .= '</select></label>';
172
 
173
  $return['additional'] = '';
174
- $return['additional'] .= '<label><span>' . __('Additional', 'siteorigin-widgets') . '</span>';
175
  $return['additional'] .= '<input type="text" name="additional" class="" />';
176
- $return['additional'] .= '<small>' . __('Additional query arguments. See <a href="http://codex.wordpress.org/Function_Reference/query_posts" target="_blank">query_posts</a>.', 'siteorigin-widgets') . '</small>';
177
  $return['additional'] .= '</label>';
178
 
179
  return $return;
10
  'ajaxurl' => wp_nonce_url( admin_url('admin-ajax.php'), 'widgets_action', '_widgets_nonce' ),
11
  'modal' => file_get_contents( plugin_dir_path(SOW_BUNDLE_BASE_FILE).'base/tpl/posts-selector/modal.html' ),
12
  'postSummary' => file_get_contents( plugin_dir_path(SOW_BUNDLE_BASE_FILE).'base/tpl/posts-selector/post.html' ),
13
+ 'foundPosts' => '<div class="sow-post-count-message">' . sprintf( __('This query returns <a href="#" class="preview-query-posts">%s posts</a>.', 'so-widgets-bundle'), '<%= foundPosts %>') . '</div>',
14
  'fields' => siteorigin_widget_post_selector_form_fields(),
15
  'selector' => file_get_contents( plugin_dir_path(SOW_BUNDLE_BASE_FILE).'base/tpl/posts-selector/selector.html' ),
16
  ) );
17
 
18
  wp_localize_script( 'siteorigin-widget-admin-posts-selector', 'sowPostsSelectorVars', array(
19
+ 'modalTitle' => __('Select posts', 'so-widgets-bundle'),
20
  ) );
21
  }
22
  }
98
 
99
  // The post type field
100
  $return['post_type'] = '';
101
+ $return['post_type'] .= '<label><span>' . __('Post type', 'so-widgets-bundle') . '</span>';
102
  $return['post_type'] .= '<select name="post_type">';
103
+ $return['post_type'] .= '<option value="_all">' . __('All', 'so-widgets-bundle') . '</option>';
104
  foreach( get_post_types( array( 'public' => true ), 'objects' ) as $id => $type ) {
105
  if(!empty($type->labels->name)) {
106
  $post_types[$id] = $type->labels->name;
111
 
112
  // The field for specifying individual posts
113
  $return['post__in'] = '';
114
+ $return['post__in'] .= '<label><span>' . __('Post in', 'so-widgets-bundle') . '</span>';
115
  $return['post__in'] .= '<input type="text" name="post__in" class="" />';
116
+ $return['post__in'] .= ' <a href="#" class="sow-select-posts button button-secondary">' . __('Select posts', 'so-widgets-bundle') . '</a>';
117
  $return['post__in'] .= '</label>';
118
 
119
  // The taxonomy field
120
  $return['tax_query'] = '';
121
+ $return['tax_query'] .= '<label><span>' . __('Taxonomies', 'so-widgets-bundle') . '</span>';
122
  $return['tax_query'] .= '<input type="text" name="tax_query" class="" placeholder="search" />';
123
  $return['tax_query'] .= '</label>';
124
 
125
 
126
  // The order by field
127
  $return['orderby'] = '';
128
+ $return['orderby'] .= '<label><span>' . __('Order by', 'so-widgets-bundle') . '</span>';
129
  $return['orderby'] .= '<select name="orderby">';
130
  $orderby = array(
131
+ 'none' => __('No order', 'so-widgets-bundle'),
132
+ 'ID' => __('Post ID', 'so-widgets-bundle'),
133
+ 'author' => __('Author', 'so-widgets-bundle'),
134
+ 'title' => __('Title', 'so-widgets-bundle'),
135
+ 'date' => __('Published date', 'so-widgets-bundle'),
136
+ 'modified' => __('Modified date', 'so-widgets-bundle'),
137
+ 'parent' => __('By parent', 'so-widgets-bundle'),
138
+ 'rand' => __('Random order', 'so-widgets-bundle'),
139
+ 'comment_count' => __('Comment count', 'so-widgets-bundle'),
140
+ 'menu_order' => __('Menu order', 'so-widgets-bundle'),
141
+ 'meta_value' => __('By meta value', 'so-widgets-bundle'),
142
+ 'meta_value_num' => __('By numeric meta value', 'so-widgets-bundle'),
143
+ 'post__in' => __('By include order', 'so-widgets-bundle'),
144
  );
145
  foreach($orderby as $id => $v) {
146
  $return['orderby'] .= '<option value="' . $id . '">' . $v . '</option>';
151
  $return['orderby'] .= '</label>';
152
 
153
  $return['posts_per_page'] = '';
154
+ $return['posts_per_page'] .= '<label><span>' . __('Posts per page', 'so-widgets-bundle') . '</span>';
155
  $return['posts_per_page'] .= '<input type="number" name="posts_per_page" class="" />';
156
  $return['posts_per_page'] .= '</label>';
157
 
158
 
159
  $return['sticky'] = '';
160
+ $return['sticky'] .= '<label><span>' . __('Sticky posts', 'so-widgets-bundle') . '</span>';
161
  $return['sticky'] .= '<select name="sticky">';
162
  $sticky = array(
163
+ '' => __('Default', 'so-widgets-bundle'),
164
+ 'ignore' => __('Ignore sticky', 'so-widgets-bundle'),
165
+ 'exclude' => __('Exclude sticky', 'so-widgets-bundle'),
166
+ 'only' => __('Include sticky', 'so-widgets-bundle'),
167
  );
168
  foreach($sticky as $id => $v) {
169
  $return['sticky'] .= '<option value="' . $id . '">' . $v . '</option>';
171
  $return['sticky'] .= '</select></label>';
172
 
173
  $return['additional'] = '';
174
+ $return['additional'] .= '<label><span>' . __('Additional', 'so-widgets-bundle') . '</span>';
175
  $return['additional'] .= '<input type="text" name="additional" class="" />';
176
+ $return['additional'] .= '<small>' . __('Additional query arguments. See <a href="http://codex.wordpress.org/Function_Reference/query_posts" target="_blank">query_posts</a>.', 'so-widgets-bundle') . '</small>';
177
  $return['additional'] .= '</label>';
178
 
179
  return $return;
base/inc/widget-manager.class.php CHANGED
@@ -13,6 +13,11 @@ class SiteOrigin_Widgets_Widget_Manager {
13
  add_action( 'widgets_init', array( $this, 'widgets_init' ) );
14
  }
15
 
 
 
 
 
 
16
  static function single() {
17
  static $single;
18
 
@@ -53,9 +58,19 @@ class SiteOrigin_Widgets_Widget_Manager {
53
  }
54
  }
55
 
 
 
 
 
 
 
 
56
  public function get_plugin_path( $id ) {
57
- // Handle raw widget IDs, assuming they're prefixed with sow-
58
- if( strpos($id, 'sow-') === 0 ) $id = substr($id, 4);
 
 
 
59
 
60
  return !empty($this->regisrered[$id]) ? $this->regisrered[$id]->path : false;
61
  }
@@ -68,16 +83,10 @@ class SiteOrigin_Widgets_Widget_Manager {
68
  * @todo examine this when using a widget in a theme folder.
69
  */
70
  function get_plugin_dir_path( $id ){
71
- // Handle raw widget IDs, assuming they're prefixed with sow-
72
- if( strpos($id, 'sow-') === 0 ) $id = substr($id, 4);
73
-
74
  return plugin_dir_path( $this->get_plugin_path( $id ) );
75
  }
76
 
77
  function get_plugin_dir_url( $id ){
78
- // Handle raw widget IDs, assuming they're prefixed with sow-
79
- if( strpos($id, 'sow-') === 0 ) $id = substr($id, 4);
80
-
81
  return plugin_dir_url( $this->get_plugin_path( $id ) );
82
  }
83
  }
13
  add_action( 'widgets_init', array( $this, 'widgets_init' ) );
14
  }
15
 
16
+ /**
17
+ * Get the single instance.
18
+ *
19
+ * @return SiteOrigin_Widgets_Widget_Manager
20
+ */
21
  static function single() {
22
  static $single;
23
 
58
  }
59
  }
60
 
61
+ /**
62
+ * Get the path of the widget
63
+ *
64
+ * @param $id
65
+ *
66
+ * @return bool
67
+ */
68
  public function get_plugin_path( $id ) {
69
+ if( empty($this->regisrered[$id]) ) {
70
+ // This call might be using the incorrect ID convention
71
+ if( substr($id, 0, 4) == 'sow-' ) $id = substr($id, 4);
72
+ else $id = 'sow-' . $id;
73
+ }
74
 
75
  return !empty($this->regisrered[$id]) ? $this->regisrered[$id]->path : false;
76
  }
83
  * @todo examine this when using a widget in a theme folder.
84
  */
85
  function get_plugin_dir_path( $id ){
 
 
 
86
  return plugin_dir_path( $this->get_plugin_path( $id ) );
87
  }
88
 
89
  function get_plugin_dir_url( $id ){
 
 
 
90
  return plugin_dir_url( $this->get_plugin_path( $id ) );
91
  }
92
  }
base/inc/widgets/base-slider.class.php CHANGED
@@ -51,43 +51,43 @@ abstract class SiteOrigin_Widget_Base_Slider extends SiteOrigin_Widget {
51
  return array(
52
  'speed' => array(
53
  'type' => 'number',
54
- 'label' => __('Animation speed', 'siteorigin-widgets'),
55
- 'description' => __('Animation speed in milliseconds.', 'siteorigin-widgets'),
56
  'default' => 800,
57
  ),
58
 
59
  'timeout' => array(
60
  'type' => 'number',
61
- 'label' => __('Timeout', 'siteorigin-widgets'),
62
- 'description' => __('How long each frame is displayed for in milliseconds.', 'siteorigin-widgets'),
63
  'default' => 8000,
64
  ),
65
 
66
  'nav_color_hex' => array(
67
  'type' => 'color',
68
- 'label' => __('Navigation color', 'siteorigin-widgets'),
69
  'default' => '#FFFFFF',
70
  ),
71
 
72
  'nav_style' => array(
73
  'type' => 'select',
74
- 'label' => __('Navigation style', 'siteorigin-widgets'),
75
  'default' => 'thin',
76
  'options' => array(
77
- 'ultra-thin' => __('Ultra thin', 'siteorigin-widgets'),
78
- 'thin' => __('Thin', 'siteorigin-widgets'),
79
- 'medium' => __('Medium', 'siteorigin-widgets'),
80
- 'thick' => __('Thick', 'siteorigin-widgets'),
81
- 'ultra-thin-rounded' => __('Rounded ultra thin', 'siteorigin-widgets'),
82
- 'thin-rounded' => __('Rounded thin', 'siteorigin-widgets'),
83
- 'medium-rounded' => __('Rounded medium', 'siteorigin-widgets'),
84
- 'thick-rounded' => __('Rounded thick', 'siteorigin-widgets'),
85
  )
86
  ),
87
 
88
  'nav_size' => array(
89
  'type' => 'number',
90
- 'label' => __('Navigation size', 'siteorigin-widgets'),
91
  'default' => '25',
92
  ),
93
  );
@@ -98,20 +98,20 @@ abstract class SiteOrigin_Widget_Base_Slider extends SiteOrigin_Widget {
98
  'file' => array(
99
  'type' => 'media',
100
  'library' => 'video',
101
- 'label' => __('Video file', 'siteorigin-widgets'),
102
  ),
103
 
104
  'url' => array(
105
  'type' => 'text',
106
  'sanitize' => 'url',
107
- 'label' => __('Video URL', 'siteorigin-widgets'),
108
  'optional' => 'true',
109
- 'description' => __('An external URL of the video. Overrides video file.', 'siteorigin-widgets')
110
  ),
111
 
112
  'format' => array(
113
  'type' => 'select',
114
- 'label' => __('Video format', 'siteorigin-widgets'),
115
  'options' => array(
116
  'video/mp4' => 'MP4',
117
  'video/webm' => 'WebM',
@@ -121,7 +121,7 @@ abstract class SiteOrigin_Widget_Base_Slider extends SiteOrigin_Widget {
121
 
122
  'height' => array(
123
  'type' => 'number',
124
- 'label' => __( 'Maximum height', 'siteorigin-widgets' )
125
  ),
126
 
127
  );
@@ -210,6 +210,8 @@ abstract class SiteOrigin_Widget_Base_Slider extends SiteOrigin_Widget {
210
  'color' => false,
211
  'image' => false,
212
  'opacity' => 1,
 
 
213
  'image-sizing' => 'cover', // options for image sizing are cover and contain
214
  'videos' => false,
215
  'videos-sizing' => 'background', // options for video sizing are background or full
@@ -222,9 +224,14 @@ abstract class SiteOrigin_Widget_Base_Slider extends SiteOrigin_Widget {
222
  if( !empty($background['image']) ) $background_style[] = 'background-image: url(' . esc_url($background['image']) . ')';
223
  }
224
 
 
 
 
 
225
  ?>
226
  <li
227
  class="sow-slider-image <?php if( !empty($background['image']) && !empty($background['image-sizing']) ) echo 'sow-slider-image-' . $background['image-sizing'] ?>"
 
228
  <?php if( !empty($background_style) ) echo 'style="' . implode(';', $background_style) . '"' ?>>
229
  <?php
230
  $this->render_frame_contents( $i, $frame );
51
  return array(
52
  'speed' => array(
53
  'type' => 'number',
54
+ 'label' => __('Animation speed', 'so-widgets-bundle'),
55
+ 'description' => __('Animation speed in milliseconds.', 'so-widgets-bundle'),
56
  'default' => 800,
57
  ),
58
 
59
  'timeout' => array(
60
  'type' => 'number',
61
+ 'label' => __('Timeout', 'so-widgets-bundle'),
62
+ 'description' => __('How long each frame is displayed for in milliseconds.', 'so-widgets-bundle'),
63
  'default' => 8000,
64
  ),
65
 
66
  'nav_color_hex' => array(
67
  'type' => 'color',
68
+ 'label' => __('Navigation color', 'so-widgets-bundle'),
69
  'default' => '#FFFFFF',
70
  ),
71
 
72
  'nav_style' => array(
73
  'type' => 'select',
74
+ 'label' => __('Navigation style', 'so-widgets-bundle'),
75
  'default' => 'thin',
76
  'options' => array(
77
+ 'ultra-thin' => __('Ultra thin', 'so-widgets-bundle'),
78
+ 'thin' => __('Thin', 'so-widgets-bundle'),
79
+ 'medium' => __('Medium', 'so-widgets-bundle'),
80
+ 'thick' => __('Thick', 'so-widgets-bundle'),
81
+ 'ultra-thin-rounded' => __('Rounded ultra thin', 'so-widgets-bundle'),
82
+ 'thin-rounded' => __('Rounded thin', 'so-widgets-bundle'),
83
+ 'medium-rounded' => __('Rounded medium', 'so-widgets-bundle'),
84
+ 'thick-rounded' => __('Rounded thick', 'so-widgets-bundle'),
85
  )
86
  ),
87
 
88
  'nav_size' => array(
89
  'type' => 'number',
90
+ 'label' => __('Navigation size', 'so-widgets-bundle'),
91
  'default' => '25',
92
  ),
93
  );
98
  'file' => array(
99
  'type' => 'media',
100
  'library' => 'video',
101
+ 'label' => __('Video file', 'so-widgets-bundle'),
102
  ),
103
 
104
  'url' => array(
105
  'type' => 'text',
106
  'sanitize' => 'url',
107
+ 'label' => __('Video URL', 'so-widgets-bundle'),
108
  'optional' => 'true',
109
+ 'description' => __('An external URL of the video. Overrides video file.', 'so-widgets-bundle')
110
  ),
111
 
112
  'format' => array(
113
  'type' => 'select',
114
+ 'label' => __('Video format', 'so-widgets-bundle'),
115
  'options' => array(
116
  'video/mp4' => 'MP4',
117
  'video/webm' => 'WebM',
121
 
122
  'height' => array(
123
  'type' => 'number',
124
+ 'label' => __( 'Maximum height', 'so-widgets-bundle' )
125
  ),
126
 
127
  );
210
  'color' => false,
211
  'image' => false,
212
  'opacity' => 1,
213
+ 'url' => false,
214
+ 'new_window' => false,
215
  'image-sizing' => 'cover', // options for image sizing are cover and contain
216
  'videos' => false,
217
  'videos-sizing' => 'background', // options for video sizing are background or full
224
  if( !empty($background['image']) ) $background_style[] = 'background-image: url(' . esc_url($background['image']) . ')';
225
  }
226
 
227
+ if( ! empty( $background['url'] ) ) {
228
+ $background_style[] = 'cursor: pointer;';
229
+ }
230
+
231
  ?>
232
  <li
233
  class="sow-slider-image <?php if( !empty($background['image']) && !empty($background['image-sizing']) ) echo 'sow-slider-image-' . $background['image-sizing'] ?>"
234
+ <?php if( !empty( $background['url'] ) ) echo 'data-url=\'' . json_encode(array( 'url' => sow_esc_url($background['url']), 'new_window' => !empty( $background['new_window'] ) ) ) . '\'' ; ?>
235
  <?php if( !empty($background_style) ) echo 'style="' . implode(';', $background_style) . '"' ?>>
236
  <?php
237
  $this->render_frame_contents( $i, $frame );
base/js/admin.js CHANGED
@@ -1,118 +1,15 @@
1
 
2
  /* globals wp, jQuery, soWidgets, confirm, tinymce */
3
 
4
- var sowEmitters = {
5
-
6
- /**
7
- * Find the group/state and an extra match part.
8
- *
9
- * @param arg
10
- * @param matchPart
11
- * @return {*}
12
- */
13
- '_match': function(arg, matchPart) {
14
- if( typeof matchPart === 'undefined' ) { matchPart = '.*'; }
15
-
16
- // Create the regular expression to match the group/state and extra match
17
- var exp = new RegExp( '^([a-zA-Z0-9_-]+)(\\[([a-zA-Z0-9_-]+)\\])? *: *(' + matchPart + ') *$' );
18
- var m = exp.exec( arg );
19
-
20
- if( m === null ) { return false; }
21
-
22
- var state = '';
23
- var group = 'default';
24
-
25
- if( m[3] !== undefined ) {
26
- group = m[1];
27
- state = m[3];
28
- }
29
- else {
30
- state = m[1];
31
- }
32
-
33
- return {
34
- 'match' : m[4].trim(),
35
- 'group' : group,
36
- 'state' : state
37
- };
38
- },
39
-
40
- '_checker' : function(val, args, matchPart, callback){
41
- var returnStates = {};
42
- if( typeof args.length === 'undefined' ) {
43
- args = [args];
44
- }
45
-
46
- var m;
47
- for( var i = 0; i < args.length; i++ ) {
48
- m = sowEmitters._match( args[i], matchPart );
49
- if ( m === false ) { continue; }
50
-
51
- if( m.match === '_true' || callback( val, args, m.match ) ) {
52
- returnStates[ m.group ] = m.state;
53
- }
54
- }
55
-
56
- return returnStates;
57
- },
58
-
59
- /**
60
- * A very simple state emitter that simply sets the given group the value
61
- *
62
- *
63
- * @param val
64
- * @param args
65
- * @returns {{}}
66
- */
67
- 'select': function(val, args) {
68
- if( typeof args.length === 'undefined' ) {
69
- args = [args];
70
- }
71
-
72
- var returnGroups = {};
73
- for( var i = 0; i < args.length; i++ ) {
74
- if( args[i] === '' ) {
75
- args[i] = 'default';
76
- }
77
- returnGroups[args[i]] = val;
78
- }
79
-
80
- return returnGroups;
81
- },
82
-
83
- /**
84
- * The conditional state emitter uses eval to check a given conditional argument.
85
- *
86
- * @param val
87
- * @param args
88
- * @return {{}}
89
- */
90
- 'conditional' : function(val, args){
91
- return sowEmitters._checker( val, args, '[^;{}]*', function( val, args, match ){
92
- return eval( match );
93
- } );
94
- },
95
-
96
- /**
97
- * The in state emitter checks if the value is in an array of functions
98
- *
99
- * @param val
100
- * @param args
101
- * @return {{}}
102
- */
103
- 'in' : function(val, args) {
104
- return sowEmitters._checker( val, args, '[^;{}]*', function( val, args, match ){
105
- return match.split(',').map( function(s) { return s.trim(); } ).indexOf( val ) !== -1;
106
- } );
107
- }
108
- };
109
-
110
  (function($){
111
 
112
  $.fn.sowSetupForm = function() {
113
 
114
  return $(this).each( function(i, el){
115
- var $el = $(el), $mainForm, formInitializing = true;
 
 
 
116
 
117
  // Skip this if the widget has any fields with an __i__
118
  var $inputs = $el.find('input[name]');
@@ -137,23 +34,33 @@ var sowEmitters = {
137
  // Find all wrappers that have state handlers on them
138
  $el.find('[data-state-handler]').each( function(){
139
  var $$ = $(this);
140
-
141
  // Create a copy of the current state handlers. Add in initial handlers if the form is initializing.
142
  var handler = $.extend( {}, $$.data( 'state-handler' ), formInitializing ? $$.data('state-handler-initial' ) : {} ) ;
143
- if( Object.keys( handler ).length === 0 ) { return true; }
 
 
144
 
145
  // We need to figure out what the incoming state is
146
- var handlerStateParts, handlerState, thisHandler, $$f, runHandler;
147
 
148
  // Indicates if the handler has run
149
  var handlerRun = {};
150
 
 
 
 
 
 
 
 
 
 
151
  // Go through all the handlers
152
  for( var state in handler ) {
153
  runHandler = false;
154
 
155
  // Parse the handler state parts
156
- handlerStateParts = state.match(/^([a-zA-Z0-9_-]+)(\[([a-zA-Z0-9_-]+)\])?(\[\])?$/);
157
  if( handlerStateParts === null ) {
158
  // Skip this if there's a problem with the state parts
159
  continue;
@@ -186,10 +93,13 @@ var sowEmitters = {
186
  }
187
  else {
188
  // Evaluate if we're in the current state
189
- runHandler = (handlerState.group === incomingGroup && handlerState.name === incomingState);
 
 
 
 
190
  }
191
 
192
-
193
  // Run the handler if previous checks have determined we should
194
  if( runHandler ) {
195
  thisHandler = handler[ state ];
@@ -229,6 +139,7 @@ var sowEmitters = {
229
  else {
230
  $mainForm = $el.closest('.siteorigin-widget-form-main');
231
  }
 
232
 
233
  // Find any field or sub widget fields.
234
  var $fields = $el.find('> .siteorigin-widget-field');
@@ -236,7 +147,7 @@ var sowEmitters = {
236
  // Process any sub sections
237
  $fields.find('> .siteorigin-widget-section').sowSetupForm();
238
 
239
- //Process any sub widgets whose fields aren't contained in a section
240
  $fields.filter('.siteorigin-widget-field-type-widget:not(:has(> .siteorigin-widget-section))').sowSetupForm();
241
 
242
  // Store the field names
@@ -253,14 +164,11 @@ var sowEmitters = {
253
  $el.find('.siteorigin-widget-field-repeater-item').sowSetupRepeaterItems();
254
 
255
  // Set up any color fields
256
- $fields.find('> .siteorigin-widget-input-color').wpColorPicker()
257
- .closest('.siteorigin-widget-field').find('a').click(function(){
258
- if(typeof $.fn.dialog !== 'undefined') {
259
- $(this).closest('.panel-dialog').dialog("option", "position", "center");
260
- }
261
- });
262
 
263
- // handle the media field. Check that this is working
264
  $fields.find('> .media-field-wrapper').each(function(){
265
  var $media = $(this);
266
  var $field = $media.closest('.siteorigin-widget-field');
@@ -359,17 +267,15 @@ var sowEmitters = {
359
 
360
  });
361
 
362
- // Handle toggling of the sub widget form
 
 
363
  $fields.filter('.siteorigin-widget-field-type-widget, .siteorigin-widget-field-type-section').find('> label').click(function(){
364
  var $$ = $(this);
365
  $(this).toggleClass( 'siteorigin-widget-section-visible' );
366
  $(this).siblings('.siteorigin-widget-section').slideToggle(function(){
367
- // Center the PB dialog
368
- if(typeof $.fn.dialog !== 'undefined') {
369
- $(this).closest('.panel-dialog').dialog( "option", "position", "center" );
370
- }
371
-
372
  $(window).resize();
 
373
  });
374
  });
375
 
@@ -489,7 +395,7 @@ var sowEmitters = {
489
  });
490
 
491
  ///////////////////////////////////////
492
- // Handle the slider sections
493
 
494
  $fields.filter('.siteorigin-widget-field-type-slider').each(function(){
495
  var $$ = $(this);
@@ -591,10 +497,18 @@ var sowEmitters = {
591
  if( typeof emitters !== 'undefined' ) {
592
  var handleStateEmitter = function(emitter, currentStates){
593
  if( typeof sowEmitters[ emitter.callback ] === 'undefined' || emitter.callback.substr(0,1) === '_' ) {
594
- // Skip if the function doesn't exist, or it starts with an underscore.
595
  return currentStates;
596
  }
597
 
 
 
 
 
 
 
 
 
598
  // Return an array that has the new states added to the array
599
  return $.extend( currentStates, sowEmitters[emitter.callback]( $$.val(), emitter.args ) );
600
  };
@@ -603,7 +517,10 @@ var sowEmitters = {
603
  var states = { 'default' : '' };
604
 
605
  // Go through the array of emitters
606
- if( typeof emitters.length === 'undefined' ) { emitters = [emitters]; }
 
 
 
607
  for( var i = 0; i < emitters.length; i++ ) {
608
  states = handleStateEmitter( emitters[i], states );
609
  }
@@ -631,7 +548,7 @@ var sowEmitters = {
631
  // Listen for any change events on an emitter field
632
  $(this).find('.siteorigin-widget-input').on('keyup change', stateEmitterChangeHandler);
633
 
634
- // Trigger changes on all necessary fields
635
  $(this).find('.siteorigin-widget-input').each(function(){
636
  var $$ = $(this);
637
  if( $$.is(':radio') ) {
@@ -672,6 +589,10 @@ var sowEmitters = {
672
  var $$ = $(this);
673
  var name = /[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec( $$.attr('name') );
674
 
 
 
 
 
675
  name = name[1];
676
  var parts = name.split('][');
677
 
@@ -803,11 +724,6 @@ var sowEmitters = {
803
  .find('> .siteorigin-widget-field-repeater-items').slideDown('fast', function(){
804
  $(window).resize();
805
  });
806
-
807
- // Center the PB dialog
808
- if(typeof $.fn.dialog !== 'undefined') {
809
- $(this).closest('.panel-dialog').dialog("option", "position", "center");
810
- }
811
  } );
812
 
813
  $el.find('> .siteorigin-widget-field-repeater-top > .siteorigin-widget-field-repeater-expend').click( function(e){
@@ -902,9 +818,6 @@ var sowEmitters = {
902
  }
903
  e.preventDefault();
904
  $(this).closest('.siteorigin-widget-field-repeater-item').find('.siteorigin-widget-field-repeater-item-form').eq(0).slideToggle('fast', function () {
905
- if (typeof $.fn.dialog !== 'undefined') {
906
- $(this).closest('.panel-dialog').dialog("option", "position", "center");
907
- }
908
  if($(this).is(':visible')) {
909
  $(this).trigger('slideToggleOpenComplete');
910
  }
@@ -1004,36 +917,66 @@ var sowEmitters = {
1004
  });
1005
  };
1006
 
1007
- window.sowGetWidgetFieldVariable = function ( widgetClass, elementName, key ) {
1008
- var widgetVars = window.sow_field_javascript_variables[widgetClass];
1009
- // Get rid of any index placeholders
1010
- elementName = elementName.replace( /\[#.*?#\]/g, '');
1011
- var variablePath = /[a-zA-Z0-9\-]+(?:\[c?[0-9]+\])?\[(.*)\]/.exec( elementName )[1];
1012
- var variablePathParts = variablePath.split('][');
1013
- var elementVars = variablePathParts.length ? widgetVars : null;
1014
- while(variablePathParts.length) {
1015
- elementVars = elementVars[variablePathParts.shift()];
1016
- }
1017
- return elementVars[key];
1018
- };
1019
-
1020
- window.sowFetchWidgetVariable = function (key, widget, callback) {
1021
- window.sowVars = window.sowVars || {};
1022
 
1023
- if (typeof window.sowVars[widget] === 'undefined') {
1024
- $.post(
1025
- soWidgets.ajaxurl,
1026
- { 'action': 'sow_get_javascript_variables', 'widget': widget, 'key': key },
1027
- function (result) {
1028
- window.sowVars[widget] = result;
1029
- callback(window.sowVars[widget][key]);
1030
  }
1031
- );
1032
- }
1033
- else {
1034
- callback(window.sowVars[widget][key]);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1035
  }
1036
  };
 
1037
 
1038
  // When we click on a widget top
1039
  $('.widgets-holder-wrap').on('click', '.widget:has(.siteorigin-widget-form-main) .widget-top', function(){
@@ -1057,4 +1000,110 @@ var sowEmitters = {
1057
 
1058
  $(document).trigger('sowadminloaded');
1059
 
1060
- })(jQuery);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
 
2
  /* globals wp, jQuery, soWidgets, confirm, tinymce */
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  (function($){
5
 
6
  $.fn.sowSetupForm = function() {
7
 
8
  return $(this).each( function(i, el){
9
+ var $el = $(el),
10
+ $mainForm,
11
+ formId,
12
+ formInitializing = true;
13
 
14
  // Skip this if the widget has any fields with an __i__
15
  var $inputs = $el.find('input[name]');
34
  // Find all wrappers that have state handlers on them
35
  $el.find('[data-state-handler]').each( function(){
36
  var $$ = $(this);
 
37
  // Create a copy of the current state handlers. Add in initial handlers if the form is initializing.
38
  var handler = $.extend( {}, $$.data( 'state-handler' ), formInitializing ? $$.data('state-handler-initial' ) : {} ) ;
39
+ if( Object.keys( handler ).length === 0 ) {
40
+ return true;
41
+ }
42
 
43
  // We need to figure out what the incoming state is
44
+ var handlerStateParts, handlerState, thisHandler, $$f, runHandler, handlerStateNames;
45
 
46
  // Indicates if the handler has run
47
  var handlerRun = {};
48
 
49
+ var repeaterIndex = window.sowForms.getRepeaterId($$);
50
+ if( repeaterIndex !== false ) {
51
+ var repeaterHandler = {};
52
+ for( var state in handler ) {
53
+ repeaterHandler[ state.replace('{$repeater}', repeaterIndex) ] = handler[ state ];
54
+ }
55
+ handler = repeaterHandler;
56
+ }
57
+
58
  // Go through all the handlers
59
  for( var state in handler ) {
60
  runHandler = false;
61
 
62
  // Parse the handler state parts
63
+ handlerStateParts = state.match(/^([a-zA-Z0-9_-]+)(\[([a-zA-Z0-9_\-,]+)\])?(\[\])?$/);
64
  if( handlerStateParts === null ) {
65
  // Skip this if there's a problem with the state parts
66
  continue;
93
  }
94
  else {
95
  // Evaluate if we're in the current state
96
+ handlerStateNames = handlerState.name.split(',').map( function(a){ return a.trim() } );
97
+ for( var i = 0; i < handlerStateNames.length; i++ ) {
98
+ runHandler = (handlerState.group === incomingGroup && handlerStateNames[i] === incomingState);
99
+ if( runHandler ) break;
100
+ }
101
  }
102
 
 
103
  // Run the handler if previous checks have determined we should
104
  if( runHandler ) {
105
  thisHandler = handler[ state ];
139
  else {
140
  $mainForm = $el.closest('.siteorigin-widget-form-main');
141
  }
142
+ formId = $mainForm.find('> .siteorigin-widgets-form-id').val();
143
 
144
  // Find any field or sub widget fields.
145
  var $fields = $el.find('> .siteorigin-widget-field');
147
  // Process any sub sections
148
  $fields.find('> .siteorigin-widget-section').sowSetupForm();
149
 
150
+ // Process any sub widgets whose fields aren't contained in a section
151
  $fields.filter('.siteorigin-widget-field-type-widget:not(:has(> .siteorigin-widget-section))').sowSetupForm();
152
 
153
  // Store the field names
164
  $el.find('.siteorigin-widget-field-repeater-item').sowSetupRepeaterItems();
165
 
166
  // Set up any color fields
167
+ $fields.find('> .siteorigin-widget-input-color').wpColorPicker();
168
+
169
+ ///////////////////////////////////////
170
+ // Handle the media upload field
 
 
171
 
 
172
  $fields.find('> .media-field-wrapper').each(function(){
173
  var $media = $(this);
174
  var $field = $media.closest('.siteorigin-widget-field');
267
 
268
  });
269
 
270
+ ///////////////////////////////////////
271
+ // Handle the sections
272
+
273
  $fields.filter('.siteorigin-widget-field-type-widget, .siteorigin-widget-field-type-section').find('> label').click(function(){
274
  var $$ = $(this);
275
  $(this).toggleClass( 'siteorigin-widget-section-visible' );
276
  $(this).siblings('.siteorigin-widget-section').slideToggle(function(){
 
 
 
 
 
277
  $(window).resize();
278
+ $(this).find('> .siteorigin-widget-field-container-state').val($(this).is(':visible') ? 'open' : 'closed');
279
  });
280
  });
281
 
395
  });
396
 
397
  ///////////////////////////////////////
398
+ // Handle the slider fields
399
 
400
  $fields.filter('.siteorigin-widget-field-type-slider').each(function(){
401
  var $$ = $(this);
497
  if( typeof emitters !== 'undefined' ) {
498
  var handleStateEmitter = function(emitter, currentStates){
499
  if( typeof sowEmitters[ emitter.callback ] === 'undefined' || emitter.callback.substr(0,1) === '_' ) {
500
+ // Skip if the function doesn't exist, or it starts with an underscore (internal functions).
501
  return currentStates;
502
  }
503
 
504
+ // Check if this is inside a repeater
505
+ var repeaterIndex = window.sowForms.getRepeaterId($$);
506
+ if( repeaterIndex !== false ) {
507
+ emitter.args = emitter.args.map( function( a ){
508
+ return a.replace('{$repeater}', repeaterIndex);
509
+ } );
510
+ }
511
+
512
  // Return an array that has the new states added to the array
513
  return $.extend( currentStates, sowEmitters[emitter.callback]( $$.val(), emitter.args ) );
514
  };
517
  var states = { 'default' : '' };
518
 
519
  // Go through the array of emitters
520
+ if( typeof emitters.length === 'undefined' ) {
521
+ emitters = [emitters];
522
+ }
523
+
524
  for( var i = 0; i < emitters.length; i++ ) {
525
  states = handleStateEmitter( emitters[i], states );
526
  }
548
  // Listen for any change events on an emitter field
549
  $(this).find('.siteorigin-widget-input').on('keyup change', stateEmitterChangeHandler);
550
 
551
+ // Trigger initial state emitter changes
552
  $(this).find('.siteorigin-widget-input').each(function(){
553
  var $$ = $(this);
554
  if( $$.is(':radio') ) {
589
  var $$ = $(this);
590
  var name = /[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec( $$.attr('name') );
591
 
592
+ if( name === undefined ) {
593
+ return true;
594
+ }
595
+
596
  name = name[1];
597
  var parts = name.split('][');
598
 
724
  .find('> .siteorigin-widget-field-repeater-items').slideDown('fast', function(){
725
  $(window).resize();
726
  });
 
 
 
 
 
727
  } );
728
 
729
  $el.find('> .siteorigin-widget-field-repeater-top > .siteorigin-widget-field-repeater-expend').click( function(e){
818
  }
819
  e.preventDefault();
820
  $(this).closest('.siteorigin-widget-field-repeater-item').find('.siteorigin-widget-field-repeater-item-form').eq(0).slideToggle('fast', function () {
 
 
 
821
  if($(this).is(':visible')) {
822
  $(this).trigger('slideToggleOpenComplete');
823
  }
917
  });
918
  };
919
 
920
+ // Widgets Bundle utility functions
921
+ var sowForms = {
922
+ /**
923
+ * Get the unique index of a repeater item.
924
+ *
925
+ * @param $el
926
+ * @return {*}
927
+ */
928
+ getRepeaterId: function( $el ) {
929
+ if( typeof this.id === 'undefined' ) {
930
+ this.id = 1;
931
+ }
 
 
 
932
 
933
+ var $r = $el.closest('.siteorigin-widget-field-repeater-item');
934
+ if( $r.length ) {
935
+ var itemId = $r.data('item-id');
936
+ if( itemId === undefined ) {
937
+ itemId = this.id++;
 
 
938
  }
939
+ $r.data('item-id', itemId);
940
+
941
+ return itemId;
942
+ }
943
+ else {
944
+ return false;
945
+ }
946
+ },
947
+
948
+ getWidgetFieldVariable: function ( widgetClass, elementName, key ) {
949
+ var widgetVars = window.sow_field_javascript_variables[widgetClass];
950
+ // Get rid of any index placeholders
951
+ elementName = elementName.replace( /\[#.*?#\]/g, '');
952
+ var variablePath = /[a-zA-Z0-9\-]+(?:\[c?[0-9]+\])?\[(.*)\]/.exec( elementName )[1];
953
+ var variablePathParts = variablePath.split('][');
954
+ var elementVars = variablePathParts.length ? widgetVars : null;
955
+ while(variablePathParts.length) {
956
+ elementVars = elementVars[variablePathParts.shift()];
957
+ }
958
+ return elementVars[key];
959
+ },
960
+
961
+ fetchWidgetVariable: function (key, widget, callback) {
962
+ window.sowVars = window.sowVars || {};
963
+
964
+ if (typeof window.sowVars[widget] === 'undefined') {
965
+ $.post(
966
+ soWidgets.ajaxurl,
967
+ { 'action': 'sow_get_javascript_variables', 'widget': widget, 'key': key },
968
+ function (result) {
969
+ window.sowVars[widget] = result;
970
+ callback(window.sowVars[widget][key]);
971
+ }
972
+ );
973
+ }
974
+ else {
975
+ callback(window.sowVars[widget][key]);
976
+ }
977
  }
978
  };
979
+ window.sowForms = sowForms;
980
 
981
  // When we click on a widget top
982
  $('.widgets-holder-wrap').on('click', '.widget:has(.siteorigin-widget-form-main) .widget-top', function(){
1000
 
1001
  $(document).trigger('sowadminloaded');
1002
 
1003
+ })(jQuery);
1004
+
1005
+ var sowEmitters = {
1006
+
1007
+ /**
1008
+ * Find the group/state and an extra match part.
1009
+ *
1010
+ * @param arg
1011
+ * @param matchPart
1012
+ * @return {*}
1013
+ */
1014
+ '_match': function(arg, matchPart) {
1015
+ if( typeof matchPart === 'undefined' ) { matchPart = '.*'; }
1016
+
1017
+ // Create the regular expression to match the group/state and extra match
1018
+ var exp = new RegExp( '^([a-zA-Z0-9_-]+)(\\[([a-zA-Z0-9_-]+)\\])? *: *(' + matchPart + ') *$' );
1019
+ var m = exp.exec( arg );
1020
+
1021
+ if( m === null ) { return false; }
1022
+
1023
+ var state = '';
1024
+ var group = 'default';
1025
+
1026
+ if( m[3] !== undefined ) {
1027
+ group = m[1];
1028
+ state = m[3];
1029
+ }
1030
+ else {
1031
+ state = m[1];
1032
+ }
1033
+
1034
+ return {
1035
+ 'match' : m[4].trim(),
1036
+ 'group' : group,
1037
+ 'state' : state
1038
+ };
1039
+ },
1040
+
1041
+ '_checker' : function(val, args, matchPart, callback){
1042
+ var returnStates = {};
1043
+ if( typeof args.length === 'undefined' ) {
1044
+ args = [args];
1045
+ }
1046
+
1047
+ var m;
1048
+ for( var i = 0; i < args.length; i++ ) {
1049
+ m = sowEmitters._match( args[i], matchPart );
1050
+ if ( m === false ) { continue; }
1051
+
1052
+ if( m.match === '_true' || callback( val, args, m.match ) ) {
1053
+ returnStates[ m.group ] = m.state;
1054
+ }
1055
+ }
1056
+
1057
+ return returnStates;
1058
+ },
1059
+
1060
+ /**
1061
+ * A very simple state emitter that simply sets the given group the value
1062
+ *
1063
+ *
1064
+ * @param val
1065
+ * @param args
1066
+ * @returns {{}}
1067
+ */
1068
+ 'select': function(val, args) {
1069
+ if( typeof args.length === 'undefined' ) {
1070
+ args = [args];
1071
+ }
1072
+
1073
+ var returnGroups = {};
1074
+ for( var i = 0; i < args.length; i++ ) {
1075
+ if( args[i] === '' ) {
1076
+ args[i] = 'default';
1077
+ }
1078
+ returnGroups[args[i]] = val;
1079
+ }
1080
+
1081
+ return returnGroups;
1082
+ },
1083
+
1084
+ /**
1085
+ * The conditional state emitter uses eval to check a given conditional argument.
1086
+ *
1087
+ * @param val
1088
+ * @param args
1089
+ * @return {{}}
1090
+ */
1091
+ 'conditional' : function(val, args){
1092
+ return sowEmitters._checker( val, args, '[^;{}]*', function( val, args, match ){
1093
+ return eval( match );
1094
+ } );
1095
+ },
1096
+
1097
+ /**
1098
+ * The in state emitter checks if the value is in an array of functions
1099
+ *
1100
+ * @param val
1101
+ * @param args
1102
+ * @return {{}}
1103
+ */
1104
+ 'in' : function(val, args) {
1105
+ return sowEmitters._checker( val, args, '[^;{}]*', function( val, args, match ){
1106
+ return match.split(',').map( function(s) { return s.trim(); } ).indexOf( val ) !== -1;
1107
+ } );
1108
+ }
1109
+ };
base/js/admin.min.js CHANGED
@@ -1 +1 @@
1
- var sowEmitters={_match:function(e,i){"undefined"==typeof i&&(i=".*");var t=new RegExp("^([a-zA-Z0-9_-]+)(\\[([a-zA-Z0-9_-]+)\\])? *: *("+i+") *$"),n=t.exec(e);if(null===n)return!1;var a="",r="default";return void 0!==n[3]?(r=n[1],a=n[3]):a=n[1],{match:n[4].trim(),group:r,state:a}},_checker:function(e,i,t,n){var a={};"undefined"==typeof i.length&&(i=[i]);for(var r,o=0;o<i.length;o++)r=sowEmitters._match(i[o],t),r!==!1&&("_true"===r.match||n(e,i,r.match))&&(a[r.group]=r.state);return a},select:function(e,i){"undefined"==typeof i.length&&(i=[i]);for(var t={},n=0;n<i.length;n++)""===i[n]&&(i[n]="default"),t[i[n]]=e;return t},conditional:function(val,args){return sowEmitters._checker(val,args,"[^;{}]*",function(val,args,match){return eval(match)})},"in":function(e,i){return sowEmitters._checker(e,i,"[^;{}]*",function(e,i,t){return-1!==t.split(",").map(function(e){return e.trim()}).indexOf(e)})}};!function(e){e.fn.sowSetupForm=function(){return e(this).each(function(i,t){var n,a=e(t),r=!0,o=a.find("input[name]");if(o.length&&-1!==o.attr("name").indexOf("__i__"))return this;if(a.is(".siteorigin-widget-form-main")){if(a.data("sow-form-setup")===!0)return!0;if(e("body").hasClass("widgets-php")&&!a.is(":visible")&&0===a.closest(".panel-dialog").length)return!0;a.on("sowstatechange",function(i,t,n){a.find("[data-state-handler]").each(function(){var i=e(this),a=e.extend({},i.data("state-handler"),r?i.data("state-handler-initial"):{});if(0===Object.keys(a).length)return!0;var o,s,d,l,f,c={};for(var g in a)if(f=!1,o=g.match(/^([a-zA-Z0-9_-]+)(\[([a-zA-Z0-9_-]+)\])?(\[\])?$/),null!==o&&(s={group:"default",name:"",multi:!1},void 0!==o[2]?(s.group=o[1],s.name=o[3]):s.name=o[0],s.multi=void 0!==o[4],"_else"===s.group?(s.group=s.name,s.name="",f=s.group===t&&"undefined"==typeof c[s.group]):f=s.group===t&&s.name===n,f)){d=a[g],s.multi||(d=[d]);for(var p=0;p<d.length;p++)l="undefined"!=typeof d[p][1]&&Boolean(d[p][1])?i.find(d[p][1]):i,l[d[p][0]].apply(l,"undefined"!=typeof d[p][2]?d[p][2]:[]);c[s.group]=!0}})}),a.sowSetupPreview(),n=a}else n=a.closest(".siteorigin-widget-form-main");var s=a.find("> .siteorigin-widget-field");s.find("> .siteorigin-widget-section").sowSetupForm(),s.filter(".siteorigin-widget-field-type-widget:not(:has(> .siteorigin-widget-section))").sowSetupForm(),s.find(".siteorigin-widget-input").each(function(i,t){null===e(t).data("original-name")&&e(t).data("original-name",e(t).attr("name"))}),s.find("> .siteorigin-widget-field-repeater").sowSetupRepeater(),a.find(".siteorigin-widget-field-repeater-item").sowSetupRepeaterItems(),s.find("> .siteorigin-widget-input-color").wpColorPicker().closest(".siteorigin-widget-field").find("a").click(function(){"undefined"!=typeof e.fn.dialog&&e(this).closest(".panel-dialog").dialog("option","position","center")}),s.find("> .media-field-wrapper").each(function(){var i=e(this),t=i.closest(".siteorigin-widget-field");i.find("a.media-upload-button").click(function(i){if("undefined"!=typeof wp.media){var n=e(this),a=e(this).closest(".siteorigin-widget-field"),r=e(this).data("frame");return r?(r.open(),!1):(r=wp.media({title:n.data("choose"),library:{type:n.data("library").split(",").map(function(e){return e.trim()})},button:{text:n.data("update"),close:!1}}),n.data("frame",r),r.on("select",function(){var e=r.state().get("selection").first().attributes;a.find(".current .title").html(e.title);var i=a.find("input[type=hidden]");i.val(e.id),i.trigger("change"),"undefined"!=typeof e.sizes?"undefined"!=typeof e.sizes.thumbnail?a.find(".current .thumbnail").attr("src",e.sizes.thumbnail.url).fadeIn():a.find(".current .thumbnail").attr("src",e.sizes.full.url).fadeIn():a.find(".current .thumbnail").attr("src",e.icon).fadeIn(),t.find(".media-remove-button").removeClass("remove-hide"),r.close()}),r.open(),!1)}}),i.find(".current").mouseenter(function(){var i=e(this).find(".title");""!==i.html()&&i.fadeIn("fast")}).mouseleave(function(){e(this).find(".title").clearQueue().fadeOut("fast")}),t.find("a.media-remove-button").click(function(i){i.preventDefault(),t.find(".current .title").html(""),t.find("input[type=hidden]").val(""),t.find(".current .thumbnail").fadeOut("fast"),e(this).addClass("remove-hide")})}),s.filter(".siteorigin-widget-field-type-widget, .siteorigin-widget-field-type-section").find("> label").click(function(){e(this);e(this).toggleClass("siteorigin-widget-section-visible"),e(this).siblings(".siteorigin-widget-section").slideToggle(function(){"undefined"!=typeof e.fn.dialog&&e(this).closest(".panel-dialog").dialog("option","position","center"),e(window).resize()})});var d={};s.filter(".siteorigin-widget-field-type-icon").each(function(){var i=e(this),t=i.find(".siteorigin-widget-icon-selector"),n=t.find(".siteorigin-widget-icon-icon"),a=i.find(".siteorigin-widget-icon-selector-current");a.click(function(){t.slideToggle()});var r=function(){var i=t.find("select.siteorigin-widget-icon-family").val(),r=t.find(".siteorigin-widget-icon-icons");if("undefined"!=typeof d[i]){r.empty(),0===e("#siteorigin-widget-font-"+i).length&&e("<link rel='stylesheet' type='text/css'>").attr("id","siteorigin-widget-font-"+i).attr("href",d[i].style_uri).appendTo("head");for(var o in d[i].icons){var s=e('<div data-sow-icon="'+d[i].icons[o]+'"/>').attr("data-value",i+"-"+o).addClass("sow-icon-"+i).addClass("siteorigin-widget-icon-icons-icon").click(function(){var o=e(this);o.hasClass("siteorigin-widget-active")?(o.removeClass("siteorigin-widget-active"),n.val(""),a.find("span").hide()):(r.find(".siteorigin-widget-icon-icons-icon").removeClass("siteorigin-widget-active"),o.addClass("siteorigin-widget-active"),n.val(o.data("value")),a.find("span").show().attr("data-sow-icon",o.attr("data-sow-icon")).attr("class","").addClass("sow-icon-"+i)),n.trigger("change"),t.slideUp()});r.append(s),n.val()===i+"-"+o&&(s.hasClass("siteorigin-widget-active")||s.click(),s.addClass("siteorigin-widget-active"))}r.prepend(r.find(".siteorigin-widget-active"))}},o=function(){var i=t.find("select.siteorigin-widget-icon-family").val();"undefined"!=typeof i&&""!==i&&("undefined"==typeof d[i]?e.getJSON(soWidgets.ajaxurl,{action:"siteorigin_widgets_get_icons",family:t.find("select.siteorigin-widget-icon-family").val()},function(e){d[i]=e,r()}):r())};o(),t.find("select.siteorigin-widget-icon-family").change(function(){t.find(".siteorigin-widget-icon-icons").empty(),o()})}),s.filter(".siteorigin-widget-field-type-slider").each(function(){var i=e(this),t=i.find('input[type="number"]'),n=i.find(".siteorigin-widget-value-slider");n.slider({max:parseInt(t.attr("max")),min:parseInt(t.attr("min")),value:parseInt(t.val()),slide:function(e,n){t.val(parseInt(n.value)),i.find(".siteorigin-widget-slider-value").html(n.value)}})}),s.filter(".siteorigin-widget-field-type-link").each(function(){var i=e(this),t=null,n=function(){null!==t&&t.abort();var n=i.find(".content-text-search").val(),a=i.find("ul.posts").empty().addClass("loading");e.get(soWidgets.ajaxurl,{action:"so_widgets_search_posts",query:n},function(i){for(var t=0;t<i.length;t++)""===i[t].post_title&&(i[t].post_title="&nbsp;"),a.append(e("<li>").addClass("post").html(i[t].post_title+"<span>("+i[t].post_type+")</span>").data(i[t]));a.removeClass("loading")})};i.find(".select-content-button, .button-close").click(function(t){t.preventDefault(),e(this).blur();var a=i.find(".existing-content-selector");a.toggle(),a.is(":visible")&&0===a.find("ul.posts li").length&&n()}),i.on("click",".posts li",function(t){t.preventDefault();var n=e(this);i.find("input.siteorigin-widget-input").val("post: "+n.data("ID")),i.find(".existing-content-selector").toggle()});var a=null;i.find(".content-text-search").keyup(function(){null!==a&&clearTimeout(a),a=setTimeout(function(){n()},500)})});var l=function(){var i=e(this),t=i.closest("[data-state-emitter]").data("state-emitter");if("undefined"!=typeof t){var a=function(t,n){return"undefined"==typeof sowEmitters[t.callback]||"_"===t.callback.substr(0,1)?n:e.extend(n,sowEmitters[t.callback](i.val(),t.args))},r={"default":""};"undefined"==typeof t.length&&(t=[t]);for(var o=0;o<t.length;o++)r=a(t[o],r);var s=n.data("states");"undefined"==typeof s&&(s={"default":""});for(var d in r)("undefined"==typeof s[d]||r[d]!==s[d])&&(s[d]=r[d],n.trigger("sowstatechange",[d,r[d]]));n.data("states",s)}};s.filter("[data-state-emitter]").each(function(){e(this).find(".siteorigin-widget-input").on("keyup change",l),e(this).find(".siteorigin-widget-input").each(function(){var i=e(this);i.is(":radio")?i.is(":checked")&&l.call(i[0]):l.call(i[0])})}),a.trigger("sowsetupform",s).data("sow-form-setup",!0),a.find(".siteorigin-widget-field-repeater-item").trigger("updateFieldPositions"),r=!1})},e.fn.sowSetupPreview=function(){var i=e(this),t=i.siblings(".siteorigin-widget-preview");t.find("> a").click(function(t){t.preventDefault();var n={};i.find("*[name]").each(function(){var i=e(this),t=/[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec(i.attr("name"));t=t[1];var a=t.split("][");a=a.map(function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e});for(var r=n,o=0;o<a.length;o++)o===a.length-1?"checkbox"===i.attr("type")?r[a[o]]=i.is(":checked")?""!==i.val()?i.val():!0:!1:"radio"===i.attr("type")?i.is(":checked")&&(r[a[o]]=""!==i.val()?i.val():!0):r[a[o]]=i.val():("undefined"==typeof r[a[o]]&&(r[a[o]]={}),r=r[a[o]])});var a=e(e("#so-widgets-bundle-tpl-preview-dialog").html().trim()).appendTo("body");a.find('input[name="data"]').val(JSON.stringify(n)),a.find('input[name="class"]').val(i.data("class")),a.find("iframe").on("load",function(){e(this).css("visibility","visible")}),a.find("form").submit(),a.find(".close").click(function(){a.remove()})})},e.fn.sowSetupRepeater=function(){return e(this).each(function(i,t){var n=e(t),a=n.find(".siteorigin-widget-field-repeater-items"),r=n.data("repeater-name");a.bind("updateFieldPositions",function(){var i=e(this),t=i.find("> .siteorigin-widget-field-repeater-item");t.each(function(i,t){e(t).find(".siteorigin-widget-input").each(function(t,n){var a=e(n).data("repeater-positions");"undefined"==typeof a&&(a={}),a[r]=i,e(n).data("repeater-positions",a)})}),i.find(".siteorigin-widget-input").each(function(i,t){var n=e(t).data("repeater-positions"),a=e(t);if("undefined"!=typeof n){var r=a.data("original-name");if("undefined"==typeof r&&(a.data("original-name",a.attr("name")),r=a.attr("name")),!r)return;for(var o in n)r=r.replace("#"+o+"#",n[o]);e(t).attr("name",r)}});var a=n.data("scroll-count")?parseInt(n.data("scroll-count")):0;if(a>0&&t.length>a){var o=t.first().outerHeight();i.css("max-height",o*a).css("overflow","auto")}else i.css("max-height","").css("overflow","")}),a.sortable({handle:".siteorigin-widget-field-repeater-item-top",items:"> .siteorigin-widget-field-repeater-item",update:function(){a.trigger("updateFieldPositions")}}),a.trigger("updateFieldPositions"),n.find("> .siteorigin-widget-field-repeater-add").disableSelection().click(function(i){i.preventDefault(),n.closest(".siteorigin-widget-field-repeater").sowAddRepeaterItem().find("> .siteorigin-widget-field-repeater-items").slideDown("fast",function(){e(window).resize()}),"undefined"!=typeof e.fn.dialog&&e(this).closest(".panel-dialog").dialog("option","position","center")}),n.find("> .siteorigin-widget-field-repeater-top > .siteorigin-widget-field-repeater-expend").click(function(e){e.preventDefault(),n.closest(".siteorigin-widget-field-repeater").find("> .siteorigin-widget-field-repeater-items").slideToggle("fast")})})},e.fn.sowAddRepeaterItem=function(){return e(this).each(function(i,t){var n=e(t),a=n.find("> .siteorigin-widget-field-repeater-items").children().length+1,r=e("<div>"+n.find("> .siteorigin-widget-field-repeater-item-html").html()+"</div>");r.find("[data-name]").each(function(){var i=e(this);0===i.closest(".siteorigin-widget-field-repeater-item-html").length&&i.attr("name",e(this).data("name"))});var o=r.html().replace(/_id_/g,a),s="undefined"!=typeof n.attr("readonly"),d=e('<div class="siteorigin-widget-field-repeater-item ui-draggable" />').append(e('<div class="siteorigin-widget-field-repeater-item-top" />').append(e('<div class="siteorigin-widget-field-expand" />')).append(s?"":e('<div class="siteorigin-widget-field-copy" />')).append(s?"":e('<div class="siteorigin-widget-field-remove" />')).append(e("<h4 />").html(n.data("item-name")))).append(e('<div class="siteorigin-widget-field-repeater-item-form" />').html(o));n.find("> .siteorigin-widget-field-repeater-items").append(d).sortable("refresh").trigger("updateFieldPositions"),d.sowSetupRepeaterItems(),d.hide().slideDown("fast",function(){e(window).resize()})})},e.fn.sowRemoveRepeaterItem=function(){return e(this).each(function(i,t){var n=e(this).closest(".siteorigin-widget-field-repeater-items");e(this).remove(),n.sortable("refresh").trigger("updateFieldPositions")})},e.fn.sowSetupRepeaterItems=function(){return e(this).each(function(i,t){var n=e(t);if("undefined"==typeof n.data("sowrepeater-actions-setup")){var a=n.closest(".siteorigin-widget-field-repeater"),r=n.find("> .siteorigin-widget-field-repeater-item-top"),o=a.data("item-label");if(o&&o.selector){var s=function(){var e=o.hasOwnProperty("valueMethod")&&o.valueMethod?o.valueMethod:"val",i=n.find(o.selector)[e]();i&&(i.length>80&&(i=i.substr(0,79)+"..."),r.find("h4").text(i))};s();var d=o.hasOwnProperty("updateEvent")&&o.updateEvent?o.updateEvent:"change";n.bind(d,s)}r.click(function(i){"siteorigin-widget-field-remove"!==i.target.className&&"siteorigin-widget-field-copy"!==i.target.className&&(i.preventDefault(),e(this).closest(".siteorigin-widget-field-repeater-item").find(".siteorigin-widget-field-repeater-item-form").eq(0).slideToggle("fast",function(){"undefined"!=typeof e.fn.dialog&&e(this).closest(".panel-dialog").dialog("option","position","center"),e(this).trigger(e(this).is(":visible")?"slideToggleOpenComplete":"slideToggleCloseComplete")}))}),r.find(".siteorigin-widget-field-remove").click(function(i){if(i.preventDefault(),confirm(soWidgets.sure)){var t=e(this).closest(".siteorigin-widget-field-repeater-items");e(this).closest(".siteorigin-widget-field-repeater-item").slideUp("fast",function(){e(this).remove(),t.sortable("refresh").trigger("updateFieldPositions"),e(window).resize()})}}),r.find(".siteorigin-widget-field-copy").click(function(i){i.preventDefault();var t=e(this).closest(".siteorigin-widget-form-main"),a=e(this).closest(".siteorigin-widget-field-repeater-item"),r=a.clone(),o=a.closest(".siteorigin-widget-field-repeater-items"),s=o.children().length,d={};r.find("*[name]").each(function(){var i=e(this),o=i.attr("id"),l=i.attr("name");if(i.is("textarea")&&i.parent().is(".wp-editor-container")&&"undefined"!=typeof tinymce){i.parent().empty().append(i),i.css("display","");var f=tinymce.get(o);f&&i.val(f.getContent())}else if(i.is(".wp-color-picker")){var c=i.closest(".wp-picker-container"),g=i.closest(".siteorigin-widget-field");c.remove(),g.append(i.remove())}else{var p=a.find('[name="'+l+'"]');p.length&&null!=p.val()&&i.val(p.val())}if(o){var u=o.replace(/-\d+$/,"");d[u]||(d[u]=t.find(".siteorigin-widget-input[id^="+u+"]").not("[id*=_id_]").length+1);var w=u+"-"+d[u]++;i.attr("id",w),r.find("label[for="+o+"]").attr("for",w),r.find("[id*="+o+"]").each(function(){var i=e(this).attr("id"),t=i.replace(o,w);e(this).attr("id",t)}),"undefined"!=typeof tinymce&&tinymce.get(w)&&tinymce.get(w).remove()}var m=a.parents(".siteorigin-widget-field-repeater").length,h=e("body");(h.hasClass("wp-customizer")||h.hasClass("widgets-php"))&&0==n.closest(".panel-dialog").length&&(m+=1);var v=l.replace(new RegExp("((?:.*?\\[\\d+\\]){"+(m-1).toString()+"})?(.*?\\[)\\d+(\\])"),"$1$2"+s.toString()+"$3");i.attr("name",v),i.data("original-name",v)}),o.append(r).sortable("refresh").trigger("updateFieldPositions"),r.sowSetupRepeaterItems(),r.hide().slideDown("fast",function(){e(window).resize()})}),n.find("> .siteorigin-widget-field-repeater-item-form").sowSetupForm(),n.data("sowrepeater-actions-setup",!0)}})},window.sowGetWidgetFieldVariable=function(e,i,t){var n=window.sow_field_javascript_variables[e];i=i.replace(/\[#.*?#\]/g,"");for(var a=/[a-zA-Z0-9\-]+(?:\[c?[0-9]+\])?\[(.*)\]/.exec(i)[1],r=a.split("]["),o=r.length?n:null;r.length;)o=o[r.shift()];return o[t]},window.sowFetchWidgetVariable=function(i,t,n){window.sowVars=window.sowVars||{},"undefined"==typeof window.sowVars[t]?e.post(soWidgets.ajaxurl,{action:"sow_get_javascript_variables",widget:t,key:i},function(e){window.sowVars[t]=e,n(window.sowVars[t][i])}):n(window.sowVars[t][i])},e(".widgets-holder-wrap").on("click",".widget:has(.siteorigin-widget-form-main) .widget-top",function(){var i=e(this).closest(".widget").find(".siteorigin-widget-form-main");setTimeout(function(){i.sowSetupForm()},200)}),e("body").hasClass("wp-customizer")&&e(document).on("widget-added",function(e,i){i.find(".siteorigin-widget-form").sowSetupForm()}),e(document).on("dialogopen",function(i){e(i.target).find(".siteorigin-widget-form-main").sowSetupForm()}),e(document).trigger("sowadminloaded")}(jQuery);
1
+ !function(e){e.fn.sowSetupForm=function(){return e(this).each(function(i,t){var n,a,r=e(t),s=!0,o=r.find("input[name]");if(o.length&&-1!==o.attr("name").indexOf("__i__"))return this;if(r.is(".siteorigin-widget-form-main")){if(r.data("sow-form-setup")===!0)return!0;if(e("body").hasClass("widgets-php")&&!r.is(":visible")&&0===r.closest(".panel-dialog").length)return!0;r.on("sowstatechange",function(i,t,n){r.find("[data-state-handler]").each(function(){var i=e(this),a=e.extend({},i.data("state-handler"),s?i.data("state-handler-initial"):{});if(0===Object.keys(a).length)return!0;var r,o,d,l,f,c,g={},u=window.sowForms.getRepeaterId(i);if(u!==!1){var p={};for(var m in a)p[m.replace("{$repeater}",u)]=a[m];a=p}for(var m in a)if(f=!1,r=m.match(/^([a-zA-Z0-9_-]+)(\[([a-zA-Z0-9_\-,]+)\])?(\[\])?$/),null!==r){if(o={group:"default",name:"",multi:!1},void 0!==r[2]?(o.group=r[1],o.name=r[3]):o.name=r[0],o.multi=void 0!==r[4],"_else"===o.group)o.group=o.name,o.name="",f=o.group===t&&"undefined"==typeof g[o.group];else{c=o.name.split(",").map(function(e){return e.trim()});for(var w=0;w<c.length&&!(f=o.group===t&&c[w]===n);w++);}if(f){d=a[m],o.multi||(d=[d]);for(var w=0;w<d.length;w++)l="undefined"!=typeof d[w][1]&&Boolean(d[w][1])?i.find(d[w][1]):i,l[d[w][0]].apply(l,"undefined"!=typeof d[w][2]?d[w][2]:[]);g[o.group]=!0}}})}),r.sowSetupPreview(),n=r}else n=r.closest(".siteorigin-widget-form-main");a=n.find("> .siteorigin-widgets-form-id").val();var d=r.find("> .siteorigin-widget-field");d.find("> .siteorigin-widget-section").sowSetupForm(),d.filter(".siteorigin-widget-field-type-widget:not(:has(> .siteorigin-widget-section))").sowSetupForm(),d.find(".siteorigin-widget-input").each(function(i,t){null===e(t).data("original-name")&&e(t).data("original-name",e(t).attr("name"))}),d.find("> .siteorigin-widget-field-repeater").sowSetupRepeater(),r.find(".siteorigin-widget-field-repeater-item").sowSetupRepeaterItems(),d.find("> .siteorigin-widget-input-color").wpColorPicker(),d.find("> .media-field-wrapper").each(function(){var i=e(this),t=i.closest(".siteorigin-widget-field");i.find("a.media-upload-button").click(function(i){if("undefined"!=typeof wp.media){var n=e(this),a=e(this).closest(".siteorigin-widget-field"),r=e(this).data("frame");return r?(r.open(),!1):(r=wp.media({title:n.data("choose"),library:{type:n.data("library").split(",").map(function(e){return e.trim()})},button:{text:n.data("update"),close:!1}}),n.data("frame",r),r.on("select",function(){var e=r.state().get("selection").first().attributes;a.find(".current .title").html(e.title);var i=a.find("input[type=hidden]");i.val(e.id),i.trigger("change"),"undefined"!=typeof e.sizes?"undefined"!=typeof e.sizes.thumbnail?a.find(".current .thumbnail").attr("src",e.sizes.thumbnail.url).fadeIn():a.find(".current .thumbnail").attr("src",e.sizes.full.url).fadeIn():a.find(".current .thumbnail").attr("src",e.icon).fadeIn(),t.find(".media-remove-button").removeClass("remove-hide"),r.close()}),r.open(),!1)}}),i.find(".current").mouseenter(function(){var i=e(this).find(".title");""!==i.html()&&i.fadeIn("fast")}).mouseleave(function(){e(this).find(".title").clearQueue().fadeOut("fast")}),t.find("a.media-remove-button").click(function(i){i.preventDefault(),t.find(".current .title").html(""),t.find("input[type=hidden]").val(""),t.find(".current .thumbnail").fadeOut("fast"),e(this).addClass("remove-hide")})}),d.filter(".siteorigin-widget-field-type-widget, .siteorigin-widget-field-type-section").find("> label").click(function(){e(this);e(this).toggleClass("siteorigin-widget-section-visible"),e(this).siblings(".siteorigin-widget-section").slideToggle(function(){e(window).resize(),e(this).find("> .siteorigin-widget-field-container-state").val(e(this).is(":visible")?"open":"closed")})});var l={};d.filter(".siteorigin-widget-field-type-icon").each(function(){var i=e(this),t=i.find(".siteorigin-widget-icon-selector"),n=t.find(".siteorigin-widget-icon-icon"),a=i.find(".siteorigin-widget-icon-selector-current");a.click(function(){t.slideToggle()});var r=function(){var i=t.find("select.siteorigin-widget-icon-family").val(),r=t.find(".siteorigin-widget-icon-icons");if("undefined"!=typeof l[i]){r.empty(),0===e("#siteorigin-widget-font-"+i).length&&e("<link rel='stylesheet' type='text/css'>").attr("id","siteorigin-widget-font-"+i).attr("href",l[i].style_uri).appendTo("head");for(var s in l[i].icons){var o=e('<div data-sow-icon="'+l[i].icons[s]+'"/>').attr("data-value",i+"-"+s).addClass("sow-icon-"+i).addClass("siteorigin-widget-icon-icons-icon").click(function(){var s=e(this);s.hasClass("siteorigin-widget-active")?(s.removeClass("siteorigin-widget-active"),n.val(""),a.find("span").hide()):(r.find(".siteorigin-widget-icon-icons-icon").removeClass("siteorigin-widget-active"),s.addClass("siteorigin-widget-active"),n.val(s.data("value")),a.find("span").show().attr("data-sow-icon",s.attr("data-sow-icon")).attr("class","").addClass("sow-icon-"+i)),n.trigger("change"),t.slideUp()});r.append(o),n.val()===i+"-"+s&&(o.hasClass("siteorigin-widget-active")||o.click(),o.addClass("siteorigin-widget-active"))}r.prepend(r.find(".siteorigin-widget-active"))}},s=function(){var i=t.find("select.siteorigin-widget-icon-family").val();"undefined"!=typeof i&&""!==i&&("undefined"==typeof l[i]?e.getJSON(soWidgets.ajaxurl,{action:"siteorigin_widgets_get_icons",family:t.find("select.siteorigin-widget-icon-family").val()},function(e){l[i]=e,r()}):r())};s(),t.find("select.siteorigin-widget-icon-family").change(function(){t.find(".siteorigin-widget-icon-icons").empty(),s()})}),d.filter(".siteorigin-widget-field-type-slider").each(function(){var i=e(this),t=i.find('input[type="number"]'),n=i.find(".siteorigin-widget-value-slider");n.slider({max:parseInt(t.attr("max")),min:parseInt(t.attr("min")),value:parseInt(t.val()),slide:function(e,n){t.val(parseInt(n.value)),i.find(".siteorigin-widget-slider-value").html(n.value)}})}),d.filter(".siteorigin-widget-field-type-link").each(function(){var i=e(this),t=null,n=function(){null!==t&&t.abort();var n=i.find(".content-text-search").val(),a=i.find("ul.posts").empty().addClass("loading");e.get(soWidgets.ajaxurl,{action:"so_widgets_search_posts",query:n},function(i){for(var t=0;t<i.length;t++)""===i[t].post_title&&(i[t].post_title="&nbsp;"),a.append(e("<li>").addClass("post").html(i[t].post_title+"<span>("+i[t].post_type+")</span>").data(i[t]));a.removeClass("loading")})};i.find(".select-content-button, .button-close").click(function(t){t.preventDefault(),e(this).blur();var a=i.find(".existing-content-selector");a.toggle(),a.is(":visible")&&0===a.find("ul.posts li").length&&n()}),i.on("click",".posts li",function(t){t.preventDefault();var n=e(this);i.find("input.siteorigin-widget-input").val("post: "+n.data("ID")),i.find(".existing-content-selector").toggle()});var a=null;i.find(".content-text-search").keyup(function(){null!==a&&clearTimeout(a),a=setTimeout(function(){n()},500)})});var f=function(){var i=e(this),t=i.closest("[data-state-emitter]").data("state-emitter");if("undefined"!=typeof t){var a=function(t,n){if("undefined"==typeof sowEmitters[t.callback]||"_"===t.callback.substr(0,1))return n;var a=window.sowForms.getRepeaterId(i);return a!==!1&&(t.args=t.args.map(function(e){return e.replace("{$repeater}",a)})),e.extend(n,sowEmitters[t.callback](i.val(),t.args))},r={"default":""};"undefined"==typeof t.length&&(t=[t]);for(var s=0;s<t.length;s++)r=a(t[s],r);var o=n.data("states");"undefined"==typeof o&&(o={"default":""});for(var d in r)("undefined"==typeof o[d]||r[d]!==o[d])&&(o[d]=r[d],n.trigger("sowstatechange",[d,r[d]]));n.data("states",o)}};d.filter("[data-state-emitter]").each(function(){e(this).find(".siteorigin-widget-input").on("keyup change",f),e(this).find(".siteorigin-widget-input").each(function(){var i=e(this);i.is(":radio")?i.is(":checked")&&f.call(i[0]):f.call(i[0])})}),r.trigger("sowsetupform",d).data("sow-form-setup",!0),r.find(".siteorigin-widget-field-repeater-item").trigger("updateFieldPositions"),s=!1})},e.fn.sowSetupPreview=function(){var i=e(this),t=i.siblings(".siteorigin-widget-preview");t.find("> a").click(function(t){t.preventDefault();var n={};i.find("*[name]").each(function(){var i=e(this),t=/[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec(i.attr("name"));if(void 0===t)return!0;t=t[1];var a=t.split("][");a=a.map(function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e});for(var r=n,s=0;s<a.length;s++)s===a.length-1?"checkbox"===i.attr("type")?r[a[s]]=i.is(":checked")?""!==i.val()?i.val():!0:!1:"radio"===i.attr("type")?i.is(":checked")&&(r[a[s]]=""!==i.val()?i.val():!0):r[a[s]]=i.val():("undefined"==typeof r[a[s]]&&(r[a[s]]={}),r=r[a[s]])});var a=e(e("#so-widgets-bundle-tpl-preview-dialog").html().trim()).appendTo("body");a.find('input[name="data"]').val(JSON.stringify(n)),a.find('input[name="class"]').val(i.data("class")),a.find("iframe").on("load",function(){e(this).css("visibility","visible")}),a.find("form").submit(),a.find(".close").click(function(){a.remove()})})},e.fn.sowSetupRepeater=function(){return e(this).each(function(i,t){var n=e(t),a=n.find(".siteorigin-widget-field-repeater-items"),r=n.data("repeater-name");a.bind("updateFieldPositions",function(){var i=e(this),t=i.find("> .siteorigin-widget-field-repeater-item");t.each(function(i,t){e(t).find(".siteorigin-widget-input").each(function(t,n){var a=e(n).data("repeater-positions");"undefined"==typeof a&&(a={}),a[r]=i,e(n).data("repeater-positions",a)})}),i.find(".siteorigin-widget-input").each(function(i,t){var n=e(t).data("repeater-positions"),a=e(t);if("undefined"!=typeof n){var r=a.data("original-name");if("undefined"==typeof r&&(a.data("original-name",a.attr("name")),r=a.attr("name")),!r)return;for(var s in n)r=r.replace("#"+s+"#",n[s]);e(t).attr("name",r)}});var a=n.data("scroll-count")?parseInt(n.data("scroll-count")):0;if(a>0&&t.length>a){var s=t.first().outerHeight();i.css("max-height",s*a).css("overflow","auto")}else i.css("max-height","").css("overflow","")}),a.sortable({handle:".siteorigin-widget-field-repeater-item-top",items:"> .siteorigin-widget-field-repeater-item",update:function(){a.trigger("updateFieldPositions")}}),a.trigger("updateFieldPositions"),n.find("> .siteorigin-widget-field-repeater-add").disableSelection().click(function(i){i.preventDefault(),n.closest(".siteorigin-widget-field-repeater").sowAddRepeaterItem().find("> .siteorigin-widget-field-repeater-items").slideDown("fast",function(){e(window).resize()})}),n.find("> .siteorigin-widget-field-repeater-top > .siteorigin-widget-field-repeater-expend").click(function(e){e.preventDefault(),n.closest(".siteorigin-widget-field-repeater").find("> .siteorigin-widget-field-repeater-items").slideToggle("fast")})})},e.fn.sowAddRepeaterItem=function(){return e(this).each(function(i,t){var n=e(t),a=n.find("> .siteorigin-widget-field-repeater-items").children().length+1,r=e("<div>"+n.find("> .siteorigin-widget-field-repeater-item-html").html()+"</div>");r.find("[data-name]").each(function(){var i=e(this);0===i.closest(".siteorigin-widget-field-repeater-item-html").length&&i.attr("name",e(this).data("name"))});var s=r.html().replace(/_id_/g,a),o="undefined"!=typeof n.attr("readonly"),d=e('<div class="siteorigin-widget-field-repeater-item ui-draggable" />').append(e('<div class="siteorigin-widget-field-repeater-item-top" />').append(e('<div class="siteorigin-widget-field-expand" />')).append(o?"":e('<div class="siteorigin-widget-field-copy" />')).append(o?"":e('<div class="siteorigin-widget-field-remove" />')).append(e("<h4 />").html(n.data("item-name")))).append(e('<div class="siteorigin-widget-field-repeater-item-form" />').html(s));n.find("> .siteorigin-widget-field-repeater-items").append(d).sortable("refresh").trigger("updateFieldPositions"),d.sowSetupRepeaterItems(),d.hide().slideDown("fast",function(){e(window).resize()})})},e.fn.sowRemoveRepeaterItem=function(){return e(this).each(function(i,t){var n=e(this).closest(".siteorigin-widget-field-repeater-items");e(this).remove(),n.sortable("refresh").trigger("updateFieldPositions")})},e.fn.sowSetupRepeaterItems=function(){return e(this).each(function(i,t){var n=e(t);if("undefined"==typeof n.data("sowrepeater-actions-setup")){var a=n.closest(".siteorigin-widget-field-repeater"),r=n.find("> .siteorigin-widget-field-repeater-item-top"),s=a.data("item-label");if(s&&s.selector){var o=function(){var e=s.hasOwnProperty("valueMethod")&&s.valueMethod?s.valueMethod:"val",i=n.find(s.selector)[e]();i&&(i.length>80&&(i=i.substr(0,79)+"..."),r.find("h4").text(i))};o();var d=s.hasOwnProperty("updateEvent")&&s.updateEvent?s.updateEvent:"change";n.bind(d,o)}r.click(function(i){"siteorigin-widget-field-remove"!==i.target.className&&"siteorigin-widget-field-copy"!==i.target.className&&(i.preventDefault(),e(this).closest(".siteorigin-widget-field-repeater-item").find(".siteorigin-widget-field-repeater-item-form").eq(0).slideToggle("fast",function(){e(this).trigger(e(this).is(":visible")?"slideToggleOpenComplete":"slideToggleCloseComplete")}))}),r.find(".siteorigin-widget-field-remove").click(function(i){if(i.preventDefault(),confirm(soWidgets.sure)){var t=e(this).closest(".siteorigin-widget-field-repeater-items");e(this).closest(".siteorigin-widget-field-repeater-item").slideUp("fast",function(){e(this).remove(),t.sortable("refresh").trigger("updateFieldPositions"),e(window).resize()})}}),r.find(".siteorigin-widget-field-copy").click(function(i){i.preventDefault();var t=e(this).closest(".siteorigin-widget-form-main"),a=e(this).closest(".siteorigin-widget-field-repeater-item"),r=a.clone(),s=a.closest(".siteorigin-widget-field-repeater-items"),o=s.children().length,d={};r.find("*[name]").each(function(){var i=e(this),s=i.attr("id"),l=i.attr("name");if(i.is("textarea")&&i.parent().is(".wp-editor-container")&&"undefined"!=typeof tinymce){i.parent().empty().append(i),i.css("display","");var f=tinymce.get(s);f&&i.val(f.getContent())}else if(i.is(".wp-color-picker")){var c=i.closest(".wp-picker-container"),g=i.closest(".siteorigin-widget-field");c.remove(),g.append(i.remove())}else{var u=a.find('[name="'+l+'"]');u.length&&null!=u.val()&&i.val(u.val())}if(s){var p=s.replace(/-\d+$/,"");d[p]||(d[p]=t.find(".siteorigin-widget-input[id^="+p+"]").not("[id*=_id_]").length+1);var m=p+"-"+d[p]++;i.attr("id",m),r.find("label[for="+s+"]").attr("for",m),r.find("[id*="+s+"]").each(function(){var i=e(this).attr("id"),t=i.replace(s,m);e(this).attr("id",t)}),"undefined"!=typeof tinymce&&tinymce.get(m)&&tinymce.get(m).remove()}var w=a.parents(".siteorigin-widget-field-repeater").length,v=e("body");(v.hasClass("wp-customizer")||v.hasClass("widgets-php"))&&0==n.closest(".panel-dialog").length&&(w+=1);var h=l.replace(new RegExp("((?:.*?\\[\\d+\\]){"+(w-1).toString()+"})?(.*?\\[)\\d+(\\])"),"$1$2"+o.toString()+"$3");i.attr("name",h),i.data("original-name",h)}),s.append(r).sortable("refresh").trigger("updateFieldPositions"),r.sowSetupRepeaterItems(),r.hide().slideDown("fast",function(){e(window).resize()})}),n.find("> .siteorigin-widget-field-repeater-item-form").sowSetupForm(),n.data("sowrepeater-actions-setup",!0)}})};var i={getRepeaterId:function(e){"undefined"==typeof this.id&&(this.id=1);var i=e.closest(".siteorigin-widget-field-repeater-item");if(i.length){var t=i.data("item-id");return void 0===t&&(t=this.id++),i.data("item-id",t),t}return!1},getWidgetFieldVariable:function(e,i,t){var n=window.sow_field_javascript_variables[e];i=i.replace(/\[#.*?#\]/g,"");for(var a=/[a-zA-Z0-9\-]+(?:\[c?[0-9]+\])?\[(.*)\]/.exec(i)[1],r=a.split("]["),s=r.length?n:null;r.length;)s=s[r.shift()];return s[t]},fetchWidgetVariable:function(i,t,n){window.sowVars=window.sowVars||{},"undefined"==typeof window.sowVars[t]?e.post(soWidgets.ajaxurl,{action:"sow_get_javascript_variables",widget:t,key:i},function(e){window.sowVars[t]=e,n(window.sowVars[t][i])}):n(window.sowVars[t][i])}};window.sowForms=i,e(".widgets-holder-wrap").on("click",".widget:has(.siteorigin-widget-form-main) .widget-top",function(){var i=e(this).closest(".widget").find(".siteorigin-widget-form-main");setTimeout(function(){i.sowSetupForm()},200)}),e("body").hasClass("wp-customizer")&&e(document).on("widget-added",function(e,i){i.find(".siteorigin-widget-form").sowSetupForm()}),e(document).on("dialogopen",function(i){e(i.target).find(".siteorigin-widget-form-main").sowSetupForm()}),e(document).trigger("sowadminloaded")}(jQuery);var sowEmitters={_match:function(e,i){"undefined"==typeof i&&(i=".*");var t=new RegExp("^([a-zA-Z0-9_-]+)(\\[([a-zA-Z0-9_-]+)\\])? *: *("+i+") *$"),n=t.exec(e);if(null===n)return!1;var a="",r="default";return void 0!==n[3]?(r=n[1],a=n[3]):a=n[1],{match:n[4].trim(),group:r,state:a}},_checker:function(e,i,t,n){var a={};"undefined"==typeof i.length&&(i=[i]);for(var r,s=0;s<i.length;s++)r=sowEmitters._match(i[s],t),r!==!1&&("_true"===r.match||n(e,i,r.match))&&(a[r.group]=r.state);return a},select:function(e,i){"undefined"==typeof i.length&&(i=[i]);for(var t={},n=0;n<i.length;n++)""===i[n]&&(i[n]="default"),t[i[n]]=e;return t},conditional:function(val,args){return sowEmitters._checker(val,args,"[^;{}]*",function(val,args,match){return eval(match)})},"in":function(e,i){return sowEmitters._checker(e,i,"[^;{}]*",function(e,i,t){return-1!==t.split(",").map(function(e){return e.trim()}).indexOf(e)})}};
base/siteorigin-widget.class.php CHANGED
@@ -124,7 +124,10 @@ abstract class SiteOrigin_Widget extends WP_Widget {
124
  // Storage hash allows templates to get access to
125
  $storage_hash = '';
126
  if( !empty($this->widget_options['instance_storage']) ) {
127
- $stored_instance = $this->filter_stored_instance($instance);
 
 
 
128
  $storage_hash = substr( md5( serialize($stored_instance) ), 0, 8 );
129
  if( !empty( $stored_instance ) && empty( $instance['is_preview'] ) ) {
130
  // Store this if we have a non empty instance and are not previewing
@@ -174,7 +177,7 @@ abstract class SiteOrigin_Widget extends WP_Widget {
174
  $upload_dir = wp_upload_dir();
175
  $this->clear_file_cache();
176
 
177
- if($style !== false) {
178
  $hash = $this->get_style_hash( $instance );
179
  $css_name = $this->id_base.'-'.$style.'-'.$hash;
180
 
@@ -299,6 +302,10 @@ abstract class SiteOrigin_Widget extends WP_Widget {
299
  $form_id = 'siteorigin_widget_form_'.md5( uniqid( rand(), true ) );
300
  $class_name = str_replace( '_', '-', strtolower(get_class($this)) );
301
 
 
 
 
 
302
  ?>
303
  <div class="siteorigin-widget-form siteorigin-widget-form-main siteorigin-widget-form-main-<?php echo esc_attr($class_name) ?>" id="<?php echo $form_id ?>" data-class="<?php echo get_class($this) ?>" style="display: none">
304
  <?php
@@ -317,6 +324,7 @@ abstract class SiteOrigin_Widget extends WP_Widget {
317
  $this->fields[$field_name] = $field;
318
  }
319
  ?>
 
320
  </div>
321
  <div class="siteorigin-widget-form-no-styles">
322
  <p><strong><?php _e('This widget has scripts and styles that need to be loaded before you can use it. Please save and reload your current page.', 'siteorigin-widgets') ?></strong></p>
@@ -368,7 +376,7 @@ abstract class SiteOrigin_Widget extends WP_Widget {
368
 
369
  wp_localize_script( 'siteorigin-widget-admin', 'soWidgets', array(
370
  'ajaxurl' => wp_nonce_url( admin_url('admin-ajax.php'), 'widgets_action', '_widgets_nonce' ),
371
- 'sure' => __('Are you sure?', 'siteorigin-widgets')
372
  ) );
373
 
374
  global $wp_customize;
@@ -821,7 +829,7 @@ abstract class SiteOrigin_Widget extends WP_Widget {
821
  *
822
  * @return mixed
823
  */
824
- function filter_stored_instance( $instance ){
825
  return $instance;
826
  }
827
 
@@ -899,7 +907,7 @@ abstract class SiteOrigin_Widget extends WP_Widget {
899
  $f_script[0],
900
  isset( $f_script[1] ) ? $f_script[1] : false,
901
  isset( $f_script[2] ) ? $f_script[2] : array(),
902
- isset( $f_script[3] ) ? $f_script[3] : false,
903
  isset( $f_script[4] ) ? $f_script[4] : false
904
  );
905
  }
@@ -929,7 +937,7 @@ abstract class SiteOrigin_Widget extends WP_Widget {
929
  $f_style[0],
930
  isset( $f_style[1] ) ? $f_style[1] : false,
931
  isset( $f_style[2] ) ? $f_style[2] : array(),
932
- isset( $f_style[3] ) ? $f_style[3] : false,
933
  isset( $f_style[4] ) ? $f_style[4] : "all"
934
  );
935
  }
124
  // Storage hash allows templates to get access to
125
  $storage_hash = '';
126
  if( !empty($this->widget_options['instance_storage']) ) {
127
+ $stored_instance = $this->modify_stored_instance($instance);
128
+ // We probably don't want panels_info
129
+ unset($stored_instance['panels_info']);
130
+
131
  $storage_hash = substr( md5( serialize($stored_instance) ), 0, 8 );
132
  if( !empty( $stored_instance ) && empty( $instance['is_preview'] ) ) {
133
  // Store this if we have a non empty instance and are not previewing
177
  $upload_dir = wp_upload_dir();
178
  $this->clear_file_cache();
179
 
180
+ if( !empty($style) ) {
181
  $hash = $this->get_style_hash( $instance );
182
  $css_name = $this->id_base.'-'.$style.'-'.$hash;
183
 
302
  $form_id = 'siteorigin_widget_form_'.md5( uniqid( rand(), true ) );
303
  $class_name = str_replace( '_', '-', strtolower(get_class($this)) );
304
 
305
+ if( empty( $instance['_sow_form_id'] ) ) {
306
+ $instance['_sow_form_id'] = uniqid();
307
+ }
308
+
309
  ?>
310
  <div class="siteorigin-widget-form siteorigin-widget-form-main siteorigin-widget-form-main-<?php echo esc_attr($class_name) ?>" id="<?php echo $form_id ?>" data-class="<?php echo get_class($this) ?>" style="display: none">
311
  <?php
324
  $this->fields[$field_name] = $field;
325
  }
326
  ?>
327
+ <input type="hidden" name="<?php echo $this->get_field_name('_sow_form_id') ?>" value="<?php echo esc_attr( $instance['_sow_form_id'] ) ?>" class="siteorigin-widgets-form-id" />
328
  </div>
329
  <div class="siteorigin-widget-form-no-styles">
330
  <p><strong><?php _e('This widget has scripts and styles that need to be loaded before you can use it. Please save and reload your current page.', 'siteorigin-widgets') ?></strong></p>
376
 
377
  wp_localize_script( 'siteorigin-widget-admin', 'soWidgets', array(
378
  'ajaxurl' => wp_nonce_url( admin_url('admin-ajax.php'), 'widgets_action', '_widgets_nonce' ),
379
+ 'sure' => __('Are you sure?', 'so-widgets-bundle')
380
  ) );
381
 
382
  global $wp_customize;
829
  *
830
  * @return mixed
831
  */
832
+ function modify_stored_instance( $instance ){
833
  return $instance;
834
  }
835
 
907
  $f_script[0],
908
  isset( $f_script[1] ) ? $f_script[1] : false,
909
  isset( $f_script[2] ) ? $f_script[2] : array(),
910
+ !empty( $f_script[3] ) ? $f_script[3] : SOW_BUNDLE_VERSION,
911
  isset( $f_script[4] ) ? $f_script[4] : false
912
  );
913
  }
937
  $f_style[0],
938
  isset( $f_style[1] ) ? $f_style[1] : false,
939
  isset( $f_style[2] ) ? $f_style[2] : array(),
940
+ !empty( $f_script[3] ) ? $f_script[3] : SOW_BUNDLE_VERSION,
941
  isset( $f_style[4] ) ? $f_style[4] : "all"
942
  );
943
  }
icons/icons.php CHANGED
@@ -1720,32 +1720,32 @@ add_filter('siteorigin_widgets_icons_typicons', 'siteorigin_widgets_icons_typico
1720
  function siteorigin_widgets_icon_families_filter( $families ){
1721
 
1722
  $families['fontawesome'] = array(
1723
- 'name' => __( 'Font Awesome', 'siteorigin-widgets' ),
1724
  // 'style_uri' => plugin_dir_url(__FILE__).'font-awesome-4.4.0/css/fontawesome.css',
1725
  'style_uri' => plugin_dir_url(__FILE__).'fontawesome/style.css',
1726
  'icons' => apply_filters('siteorigin_widgets_icons_fontawesome', array() ),
1727
  );
1728
 
1729
  $families['icomoon'] = array(
1730
- 'name' => __( 'Icomoon Free', 'siteorigin-widgets' ),
1731
  'style_uri' => plugin_dir_url(__FILE__).'icomoon/style.css',
1732
  'icons' => apply_filters('siteorigin_widgets_icons_icomoon', array() ),
1733
  );
1734
 
1735
  $families['genericons'] = array(
1736
- 'name' => __( 'Genericons', 'siteorigin-widgets' ),
1737
  'style_uri' => plugin_dir_url(__FILE__).'genericons/style.css',
1738
  'icons' => apply_filters('siteorigin_widgets_icons_genericons', array() ),
1739
  );
1740
 
1741
  $families['typicons'] = array(
1742
- 'name' => __( 'Typicons', 'siteorigin-widgets' ),
1743
  'style_uri' => plugin_dir_url(__FILE__).'typicons/style.css',
1744
  'icons' => apply_filters( 'siteorigin_widgets_icons_typicons', array() ),
1745
  );
1746
 
1747
  $families['elegantline'] = array(
1748
- 'name' => __( 'Elegant Themes Line Icons', 'siteorigin-widgets' ),
1749
  'style_uri' => plugin_dir_url(__FILE__).'elegantline/style.css',
1750
  'icons' => apply_filters( 'siteorigin_widgets_icons_elegantline', array() ),
1751
  );
1720
  function siteorigin_widgets_icon_families_filter( $families ){
1721
 
1722
  $families['fontawesome'] = array(
1723
+ 'name' => __( 'Font Awesome', 'so-widgets-bundle' ),
1724
  // 'style_uri' => plugin_dir_url(__FILE__).'font-awesome-4.4.0/css/fontawesome.css',
1725
  'style_uri' => plugin_dir_url(__FILE__).'fontawesome/style.css',
1726
  'icons' => apply_filters('siteorigin_widgets_icons_fontawesome', array() ),
1727
  );
1728
 
1729
  $families['icomoon'] = array(
1730
+ 'name' => __( 'Icomoon Free', 'so-widgets-bundle' ),
1731
  'style_uri' => plugin_dir_url(__FILE__).'icomoon/style.css',
1732
  'icons' => apply_filters('siteorigin_widgets_icons_icomoon', array() ),
1733
  );
1734
 
1735
  $families['genericons'] = array(
1736
+ 'name' => __( 'Genericons', 'so-widgets-bundle' ),
1737
  'style_uri' => plugin_dir_url(__FILE__).'genericons/style.css',
1738
  'icons' => apply_filters('siteorigin_widgets_icons_genericons', array() ),
1739
  );
1740
 
1741
  $families['typicons'] = array(
1742
+ 'name' => __( 'Typicons', 'so-widgets-bundle' ),
1743
  'style_uri' => plugin_dir_url(__FILE__).'typicons/style.css',
1744
  'icons' => apply_filters( 'siteorigin_widgets_icons_typicons', array() ),
1745
  );
1746
 
1747
  $families['elegantline'] = array(
1748
+ 'name' => __( 'Elegant Themes Line Icons', 'so-widgets-bundle' ),
1749
  'style_uri' => plugin_dir_url(__FILE__).'elegantline/style.css',
1750
  'icons' => apply_filters( 'siteorigin_widgets_icons_elegantline', array() ),
1751
  );
js/slider/jquery.slider.js CHANGED
@@ -73,6 +73,15 @@ jQuery( function($){
73
  var $slides = $$.find('.sow-slider-image');
74
  var settings = $$.data('settings');
75
 
 
 
 
 
 
 
 
 
 
76
 
77
  var setupSlider = function(){
78
  // Show everything for this slider
@@ -181,7 +190,7 @@ jQuery( function($){
181
  }
182
  }
183
  );
184
- }
185
 
186
  var images = $$.find('img');
187
  var imagesLoaded = 0;
73
  var $slides = $$.find('.sow-slider-image');
74
  var settings = $$.data('settings');
75
 
76
+ $slides.each(function( index, el) {
77
+ var $slide = $(el);
78
+ var urlData = $slide.data('url');
79
+ $slide.click(function(event) {
80
+ if( event.target == $slide || $(event.target).is('.sow-slider-image-wrapper')) {
81
+ window.open(urlData.url, urlData.new_window ? '_blank' : '_self');
82
+ }
83
+ })
84
+ });
85
 
86
  var setupSlider = function(){
87
  // Show everything for this slider
190
  }
191
  }
192
  );
193
+ };
194
 
195
  var images = $$.find('img');
196
  var imagesLoaded = 0;
js/slider/jquery.slider.min.js CHANGED
@@ -1 +1 @@
1
- var siteoriginSlider={};jQuery(function(e){var i=siteoriginSlider.playSlideVideo=function(i){e(i).find("video").each(function(){"undefined"!=typeof this.play&&this.play()})},t=siteoriginSlider.pauseSlideVideo=function(i){e(i).find("video").each(function(){"undefined"!=typeof this.pause&&this.pause()})},n=siteoriginSlider.setupActiveSlide=function(i,t,n){var s=e(i).find(".cycle-sentinel"),o=e(t),d=o.find("video.sow-background-element");if(void 0==n?s.css("height",o.outerHeight()):s.animate({height:o.outerHeight()},n),d.length){var a=o.outerWidth()/o.outerHeight(),c=d.outerWidth()/d.outerHeight();d.css(a>c?{width:"100%",height:"auto"}:{width:"auto",height:"100%"}),d.css({"margin-left":-Math.ceil(d.width()/2),"margin-top":-Math.ceil(d.height()/2)})}};e(".sow-slider-images").each(function(){var s=e(this),o=s.siblings(".sow-slider-pagination"),d=s.closest(".sow-slider-base"),a=d.find(".sow-slide-nav"),c=s.find(".sow-slider-image"),l=s.data("settings"),r=function(){if(d.show(),s.find(".sow-slider-image").each(function(){var i=e(this);e(window).resize(function(){i.css("height",i.find(".sow-slider-image-wrapper").outerHeight())}).resize()}),s.on({"cycle-after":function(t,s,o,d,a){var c=e(this);i(d),n(c,d)},"cycle-before":function(i,s,d,a,c){var l=e(this);o.find("> li").removeClass("sow-active").eq(s.slideNum-1).addClass("sow-active"),t(d),n(l,a,s.speed)},"cycle-initialized":function(t,d){i(e(this).find(".cycle-slide-active")),n(s,d.slides[0]),o.find(">li").removeClass("sow-active").eq(0).addClass("sow-active"),d.slideCount<=1&&(o.hide(),a.hide()),e(window).resize()}}).cycle({slides:"> .sow-slider-image",speed:l.speed,timeout:l.timeout,swipe:!0,"swipe-fx":"scrollHorz"}),s.find("video.sow-background-element").on("loadeddata",function(){n(s,s.find(".cycle-slide-active"))}),o.add(a).hide(),!d.hasClass("sow-slider-is-mobile")&&c.length>1){var r=!1;d.mouseenter(function(){o.add(a).clearQueue().fadeIn(150),r=!1}).mouseleave(function(){r=!0,setTimeout(function(){r&&o.add(a).clearQueue().fadeOut(150),r=!1},750)})}e(window).resize(function(){n(s,s.find(".cycle-slide-active"))}),o.find("> li > a").click(function(i){i.preventDefault(),s.cycle("goto",e(this).data("goto"))}),a.find("> a").click(function(i){i.preventDefault(),s.cycle(e(this).data("action"))}),d.keydown(function(e){37===e.which?s.cycle("prev"):39===e.which&&s.cycle("next")})},h=s.find("img"),u=0,f=!1;h.each(function(){e(this);this.complete?u++:e(this).one("load",function(){u++,u!==h.length||f||(r(),f=!0)}).attr("src",e(this).attr("src")),u!==h.length||f||(r(),f=!0)}),0===h.length&&r()})});
1
+ var siteoriginSlider={};jQuery(function(e){var i=siteoriginSlider.playSlideVideo=function(i){e(i).find("video").each(function(){"undefined"!=typeof this.play&&this.play()})},t=siteoriginSlider.pauseSlideVideo=function(i){e(i).find("video").each(function(){"undefined"!=typeof this.pause&&this.pause()})},n=siteoriginSlider.setupActiveSlide=function(i,t,n){var s=e(i).find(".cycle-sentinel"),o=e(t),a=o.find("video.sow-background-element");if(void 0==n?s.css("height",o.outerHeight()):s.animate({height:o.outerHeight()},n),a.length){var d=o.outerWidth()/o.outerHeight(),c=a.outerWidth()/a.outerHeight();a.css(d>c?{width:"100%",height:"auto"}:{width:"auto",height:"100%"}),a.css({"margin-left":-Math.ceil(a.width()/2),"margin-top":-Math.ceil(a.height()/2)})}};e(".sow-slider-images").each(function(){var s=e(this),o=s.siblings(".sow-slider-pagination"),a=s.closest(".sow-slider-base"),d=a.find(".sow-slide-nav"),c=s.find(".sow-slider-image"),l=s.data("settings");c.each(function(i,t){var n=e(t),s=n.data("url");n.click(function(i){(i.target==n||e(i.target).is(".sow-slider-image-wrapper"))&&window.open(s.url,s.new_window?"_blank":"_self")})});var r=function(){if(a.show(),s.find(".sow-slider-image").each(function(){var i=e(this);e(window).resize(function(){i.css("height",i.find(".sow-slider-image-wrapper").outerHeight())}).resize()}),s.on({"cycle-after":function(t,s,o,a,d){var c=e(this);i(a),n(c,a)},"cycle-before":function(i,s,a,d,c){var l=e(this);o.find("> li").removeClass("sow-active").eq(s.slideNum-1).addClass("sow-active"),t(a),n(l,d,s.speed)},"cycle-initialized":function(t,a){i(e(this).find(".cycle-slide-active")),n(s,a.slides[0]),o.find(">li").removeClass("sow-active").eq(0).addClass("sow-active"),a.slideCount<=1&&(o.hide(),d.hide()),e(window).resize()}}).cycle({slides:"> .sow-slider-image",speed:l.speed,timeout:l.timeout,swipe:!0,"swipe-fx":"scrollHorz"}),s.find("video.sow-background-element").on("loadeddata",function(){n(s,s.find(".cycle-slide-active"))}),o.add(d).hide(),!a.hasClass("sow-slider-is-mobile")&&c.length>1){var r=!1;a.mouseenter(function(){o.add(d).clearQueue().fadeIn(150),r=!1}).mouseleave(function(){r=!0,setTimeout(function(){r&&o.add(d).clearQueue().fadeOut(150),r=!1},750)})}e(window).resize(function(){n(s,s.find(".cycle-slide-active"))}),o.find("> li > a").click(function(i){i.preventDefault(),s.cycle("goto",e(this).data("goto"))}),d.find("> a").click(function(i){i.preventDefault(),s.cycle(e(this).data("action"))}),a.keydown(function(e){37===e.which?s.cycle("prev"):39===e.which&&s.cycle("next")})},h=s.find("img"),u=0,f=!1;h.each(function(){e(this);this.complete?u++:e(this).one("load",function(){u++,u!==h.length||f||(r(),f=!0)}).attr("src",e(this).attr("src")),u!==h.length||f||(r(),f=!0)}),0===h.length&&r()})});
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Tags: bundle, widget, button, slider, image, carousel, price table, google maps, tinymce, social links
3
  Requires at least: 3.9
4
  Tested up to: 4.3
5
- Stable tag: 1.4.3
6
  License: GPLv3 or later
7
  Contributors: gpriday, braam-genis
8
 
@@ -50,6 +50,26 @@ The SiteOrigin Widgets Bundle is the perfect platform to build widgets for your
50
 
51
  == Changelog ==
52
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  = 1.4.4 - September 6 2015 =
54
  * Fixed issue with slider image widths.
55
 
2
  Tags: bundle, widget, button, slider, image, carousel, price table, google maps, tinymce, social links
3
  Requires at least: 3.9
4
  Tested up to: 4.3
5
+ Stable tag: 1.4.4
6
  License: GPLv3 or later
7
  Contributors: gpriday, braam-genis
8
 
50
 
51
  == Changelog ==
52
 
53
+ = 1.5 - October 5 2015 =
54
+ * Fixed: Conflict between WPML and repeaters.
55
+ * Added Simple Masonry Layout widget.
56
+ * Added Contact Form widget.
57
+ * Added Image Grid widget.
58
+ * Added Testimonial widget.
59
+ * Changed layout of widgets activation page.
60
+ * Added Trianglify to generate placeholder widget icons.
61
+ * Added mechanism to use state emitters in repeaters.
62
+ * Section expanded/collapsed states now stored across form loads.
63
+ * Display once off admin notice when new widgets are available.
64
+ * Fixed translation domain.
65
+ * Editor Widget: Allow more HTML in Editor widget for trusted users.
66
+ * Hero Image Widget: Added top padding setting.
67
+ * Hero Image Widget: Can now set background click URL.
68
+ * Hero Image Widget: Improved handling of buttons shortcode.
69
+ * Slider Widget : Fixed open in new window setting.
70
+ * Headline Widget: Added word-break CSS.
71
+ * Headline Widget: Added option to set type of heading tags used.
72
+
73
  = 1.4.4 - September 6 2015 =
74
  * Fixed issue with slider image widths.
75
 
so-widgets-bundle.php CHANGED
@@ -2,7 +2,9 @@
2
  /*
3
  Plugin Name: SiteOrigin Widgets Bundle
4
  Description: A collection of all widgets, neatly bundled into a single plugin. It's also a framework to code your own widgets on top of.
5
- Version: 1.4.4
 
 
6
  Author: SiteOrigin
7
  Author URI: https://siteorigin.com
8
  Plugin URI: https://siteorigin.com/widgets-bundle/
@@ -10,7 +12,7 @@ License: GPL3
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.txt
11
  */
12
 
13
- define('SOW_BUNDLE_VERSION', '1.4.4');
14
  define('SOW_BUNDLE_JS_SUFFIX', '.min');
15
  define('SOW_BUNDLE_BASE_FILE', __FILE__);
16
 
@@ -44,6 +46,7 @@ class SiteOrigin_Widgets_Bundle {
44
 
45
  // Initialize the widgets, but do it fairly late
46
  add_action( 'plugins_loaded', array($this, 'set_plugin_textdomain'), 1 );
 
47
  add_action( 'after_setup_theme', array($this, 'load_widget_plugins'), 11 );
48
 
49
  // Add the action links.
@@ -51,6 +54,8 @@ class SiteOrigin_Widgets_Bundle {
51
 
52
  // Version check for cache clearing
53
  add_action( 'admin_init', array($this, 'plugin_version_check') );
 
 
54
 
55
  // These filters are used to activate any widgets that are missing.
56
  add_filter( 'siteorigin_panels_data', array($this, 'load_missing_widgets') );
@@ -81,7 +86,7 @@ class SiteOrigin_Widgets_Bundle {
81
  * @action plugins_loaded
82
  */
83
  function set_plugin_textdomain(){
84
- load_plugin_textdomain('siteorigin-widgets', false, dirname( plugin_basename( __FILE__ ) ). '/languages/');
85
  }
86
 
87
  /**
@@ -120,12 +125,64 @@ class SiteOrigin_Widgets_Bundle {
120
  }
121
 
122
  /**
123
- * Load all the widgets if their plugins are not already active.
124
- *
125
- * @action plugins_loaded
126
  */
127
- function load_widget_plugins(){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
128
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
  if( empty($this->widget_folders) ) {
130
  // We can use this filter to add more folders to use for widgets
131
  $this->widget_folders = apply_filters('siteorigin_widgets_widget_folders', array(
@@ -133,8 +190,19 @@ class SiteOrigin_Widgets_Bundle {
133
  ) );
134
  }
135
 
 
 
 
 
 
 
 
 
 
 
136
  // Load all the widget we currently have active and filter them
137
  $active_widgets = $this->get_active_widgets();
 
138
 
139
  foreach( $active_widgets as $widget_id => $active ) {
140
  if( empty($active) ) continue;
@@ -171,7 +239,12 @@ class SiteOrigin_Widgets_Bundle {
171
  function admin_enqueue_scripts($prefix) {
172
  if( $prefix != 'plugins_page_so-widgets-plugins' ) return;
173
  wp_enqueue_style( 'siteorigin-widgets-manage-admin', plugin_dir_url( __FILE__ ) . 'admin/admin.css', array(), SOW_BUNDLE_VERSION );
 
174
  wp_enqueue_script( 'siteorigin-widgets-manage-admin', plugin_dir_url( __FILE__ ) . 'admin/admin' . SOW_BUNDLE_JS_SUFFIX . '.js', array(), SOW_BUNDLE_VERSION );
 
 
 
 
175
  }
176
 
177
  /**
@@ -213,10 +286,10 @@ class SiteOrigin_Widgets_Bundle {
213
  function admin_ajax_manage_handler(){
214
  if( !wp_verify_nonce($_GET['_wpnonce'], 'manage_so_widget') ) exit();
215
  if( !current_user_can( apply_filters('siteorigin_widgets_admin_menu_capability', 'install_plugins') ) ) exit();
216
- if( empty($_GET['widget']) ) exit();
217
 
218
- if( isset($_POST['active']) && $_POST['active'] == 'true' ) $this->activate_widget($_GET['widget']);
219
- else $this->deactivate_widget( $_GET['widget'] );
220
 
221
  // Send a kind of dummy response.
222
  header('content-type: application/json');
@@ -231,8 +304,8 @@ class SiteOrigin_Widgets_Bundle {
231
  */
232
  function admin_menu_init(){
233
  add_plugins_page(
234
- __('SiteOrigin Widgets', 'siteorigin-widgets'),
235
- __('SiteOrigin Widgets', 'siteorigin-widgets'),
236
  apply_filters('siteorigin_widgets_admin_menu_capability', 'install_plugins'),
237
  'so-widgets-plugins',
238
  array($this, 'admin_page')
@@ -259,9 +332,9 @@ class SiteOrigin_Widgets_Bundle {
259
  <p>
260
  <?php
261
  printf(
262
- __('%s was %s', 'siteorigin-widgets'),
263
  $widgets[ $_GET['widget'].'/'.$_GET['widget'].'.php' ]['Name'],
264
- $_GET['widget_action'] == 'activate' ? __('Activated', 'siteorigin-widgets') : __('Deactivated', 'siteorigin-widgets')
265
  )
266
  ?>
267
  </p>
@@ -333,6 +406,25 @@ class SiteOrigin_Widgets_Bundle {
333
  return true;
334
  }
335
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
336
  /**
337
  * Deactivate a widget
338
  *
@@ -349,6 +441,7 @@ class SiteOrigin_Widgets_Bundle {
349
  */
350
  function get_widgets_list(){
351
  $active = $this->get_active_widgets();
 
352
 
353
  $default_headers = array(
354
  'Name' => 'Widget Name',
@@ -360,7 +453,7 @@ class SiteOrigin_Widgets_Bundle {
360
  );
361
 
362
  $widgets = array();
363
- foreach($this->widget_folders as $folder) {
364
 
365
  $files = glob( $folder.'*/*.php' );
366
  foreach($files as $file) {
@@ -419,8 +512,8 @@ class SiteOrigin_Widgets_Bundle {
419
  $class = $widget['panels_info']['class'];
420
  if( preg_match('/SiteOrigin_Widget_([A-Za-z]+)_Widget/', $class, $matches) ) {
421
  $name = $matches[1];
 
422
  $id = 'so'.strtolower( implode( '-', preg_split('/(?=[A-Z])/',$name) ) ).'-widget';
423
-
424
  $this->activate_widget($id, true);
425
  }
426
  }
@@ -442,6 +535,7 @@ class SiteOrigin_Widgets_Bundle {
442
 
443
  if( preg_match('/SiteOrigin_Widget_([A-Za-z]+)_Widget/', $class, $matches) ) {
444
  $name = $matches[1];
 
445
  $id = 'so'.strtolower( implode( '-', preg_split('/(?=[A-Z])/',$name) ) ).'-widget';
446
 
447
  $this->activate_widget($id, true);
@@ -456,8 +550,8 @@ class SiteOrigin_Widgets_Bundle {
456
  * Add action links.
457
  */
458
  function plugin_action_links($links){
459
- $links[] = '<a href="' . admin_url('plugins.php?page=so-widgets-plugins') . '">'.__('Manage Widgets', 'siteorigin-widgets').'</a>';
460
- $links[] = '<a href="http://siteorigin.com/thread/" target="_blank">'.__('Support', 'siteorigin-widgets').'</a>';
461
  return $links;
462
  }
463
 
2
  /*
3
  Plugin Name: SiteOrigin Widgets Bundle
4
  Description: A collection of all widgets, neatly bundled into a single plugin. It's also a framework to code your own widgets on top of.
5
+ Version: 1.5
6
+ Text Domain: so-widgets-bundle
7
+ Domain Path: /languages
8
  Author: SiteOrigin
9
  Author URI: https://siteorigin.com
10
  Plugin URI: https://siteorigin.com/widgets-bundle/
12
  License URI: https://www.gnu.org/licenses/gpl-3.0.txt
13
  */
14
 
15
+ define('SOW_BUNDLE_VERSION', '1.5');
16
  define('SOW_BUNDLE_JS_SUFFIX', '.min');
17
  define('SOW_BUNDLE_BASE_FILE', __FILE__);
18
 
46
 
47
  // Initialize the widgets, but do it fairly late
48
  add_action( 'plugins_loaded', array($this, 'set_plugin_textdomain'), 1 );
49
+ add_action( 'after_setup_theme', array($this, 'get_widget_folders'), 11 );
50
  add_action( 'after_setup_theme', array($this, 'load_widget_plugins'), 11 );
51
 
52
  // Add the action links.
54
 
55
  // Version check for cache clearing
56
  add_action( 'admin_init', array($this, 'plugin_version_check') );
57
+ add_action( 'siteorigin_widgets_version_update', array( $this, 'check_for_new_widgets' ) );
58
+ add_action( 'admin_notices', array( $this, 'display_admin_notices') );
59
 
60
  // These filters are used to activate any widgets that are missing.
61
  add_filter( 'siteorigin_panels_data', array($this, 'load_missing_widgets') );
86
  * @action plugins_loaded
87
  */
88
  function set_plugin_textdomain(){
89
+ load_plugin_textdomain('so-widgets-bundle', false, dirname( plugin_basename( __FILE__ ) ). '/languages/');
90
  }
91
 
92
  /**
125
  }
126
 
127
  /**
128
+ * Setup and return the widget folders
 
 
129
  */
130
+ function check_for_new_widgets() {
131
+ // get list of available widgets
132
+ $widgets = array_keys( $this->get_widgets_list() );
133
+ // get option for previously installed widgets
134
+ $old_widgets = get_option( 'siteorigin_widgets_old_widgets' );
135
+ // if this has never been set before, it's probably a new installation so we don't want to notify for all the widgets
136
+ if ( empty( $old_widgets ) ) {
137
+ update_option( 'siteorigin_widgets_old_widgets', implode( ',', $widgets ) );
138
+ return;
139
+ }
140
+ $old_widgets = explode( ',', $old_widgets );
141
+ $new_widgets = array_diff( $widgets, $old_widgets );
142
+ if ( ! empty( $new_widgets ) ) {
143
+ update_option( 'siteorigin_widgets_new_widgets', $new_widgets );
144
+ update_option( 'siteorigin_widgets_old_widgets', implode( ',', $widgets ) );
145
+ }
146
+ }
147
 
148
+ function display_admin_notices() {
149
+ $new_widgets = get_option( 'siteorigin_widgets_new_widgets' );
150
+ if ( empty( $new_widgets ) ) {
151
+ return;
152
+ }
153
+ ?>
154
+ <div class="updated">
155
+ <p><?php echo __( 'New widgets available in the ') . '<a href="' . admin_url('plugins.php?page=so-widgets-plugins') . '">' . __('SiteOrigin Widgets Bundle', 'so-widgets-bundle' ) . '</a>!'; ?></p>
156
+ <?php
157
+
158
+ $default_headers = array(
159
+ 'Name' => 'Widget Name',
160
+ 'Description' => 'Description',
161
+ 'Author' => 'Author',
162
+ 'AuthorURI' => 'Author URI',
163
+ 'WidgetURI' => 'Widget URI',
164
+ 'VideoURI' => 'Video URI',
165
+ );
166
+
167
+ foreach ( $new_widgets as $widget_file_path ) {
168
+ preg_match( '/.*[\/\\\\](.*).php/', $widget_file_path, $match );
169
+ $widget = get_file_data( $widget_file_path, $default_headers, 'siteorigin-widget' );
170
+ $name = empty( $widget['Name'] ) ? $match[1] : $widget['Name'];
171
+ $description = empty( $widget['Description'] ) ? __( 'A new widget!', 'so-widgets-bundle' ) : $widget['Description'];
172
+ ?>
173
+ <p><b><?php echo esc_html( $name . ' - ' . $description) ?></b></p>
174
+ <?php
175
+ }
176
+ ?>
177
+ </div>
178
+ <?php
179
+ update_option( 'siteorigin_widgets_new_widgets', array() );
180
+ }
181
+
182
+ /**
183
+ * Setup and return the widget folders
184
+ */
185
+ function get_widget_folders(){
186
  if( empty($this->widget_folders) ) {
187
  // We can use this filter to add more folders to use for widgets
188
  $this->widget_folders = apply_filters('siteorigin_widgets_widget_folders', array(
190
  ) );
191
  }
192
 
193
+ return $this->widget_folders;
194
+ }
195
+
196
+ /**
197
+ * Load all the widgets if their plugins are not already active.
198
+ *
199
+ * @action plugins_loaded
200
+ */
201
+ function load_widget_plugins(){
202
+
203
  // Load all the widget we currently have active and filter them
204
  $active_widgets = $this->get_active_widgets();
205
+ $widget_folders = $this->get_widget_folders();
206
 
207
  foreach( $active_widgets as $widget_id => $active ) {
208
  if( empty($active) ) continue;
239
  function admin_enqueue_scripts($prefix) {
240
  if( $prefix != 'plugins_page_so-widgets-plugins' ) return;
241
  wp_enqueue_style( 'siteorigin-widgets-manage-admin', plugin_dir_url( __FILE__ ) . 'admin/admin.css', array(), SOW_BUNDLE_VERSION );
242
+ wp_enqueue_script( 'siteorigin-widgets-trianglify', plugin_dir_url( __FILE__ ) . 'admin/trianglify' . SOW_BUNDLE_JS_SUFFIX . '.js', array(), SOW_BUNDLE_VERSION );
243
  wp_enqueue_script( 'siteorigin-widgets-manage-admin', plugin_dir_url( __FILE__ ) . 'admin/admin' . SOW_BUNDLE_JS_SUFFIX . '.js', array(), SOW_BUNDLE_VERSION );
244
+
245
+ wp_localize_script( 'siteorigin-widgets-manage-admin', 'soWidgetsAdmin', array(
246
+ 'toggleUrl' => wp_nonce_url( admin_url('admin-ajax.php?action=so_widgets_bundle_manage'), 'manage_so_widget' )
247
+ ) );
248
  }
249
 
250
  /**
286
  function admin_ajax_manage_handler(){
287
  if( !wp_verify_nonce($_GET['_wpnonce'], 'manage_so_widget') ) exit();
288
  if( !current_user_can( apply_filters('siteorigin_widgets_admin_menu_capability', 'install_plugins') ) ) exit();
289
+ if( empty($_POST['widget']) ) exit();
290
 
291
+ if( !empty($_POST['active']) ) $this->activate_widget($_POST['widget']);
292
+ else $this->deactivate_widget( $_POST['widget'] );
293
 
294
  // Send a kind of dummy response.
295
  header('content-type: application/json');
304
  */
305
  function admin_menu_init(){
306
  add_plugins_page(
307
+ __('SiteOrigin Widgets', 'so-widgets-bundle'),
308
+ __('SiteOrigin Widgets', 'so-widgets-bundle'),
309
  apply_filters('siteorigin_widgets_admin_menu_capability', 'install_plugins'),
310
  'so-widgets-plugins',
311
  array($this, 'admin_page')
332
  <p>
333
  <?php
334
  printf(
335
+ __('%s was %s', 'so-widgets-bundle'),
336
  $widgets[ $_GET['widget'].'/'.$_GET['widget'].'.php' ]['Name'],
337
+ $_GET['widget_action'] == 'activate' ? __('Activated', 'so-widgets-bundle') : __('Deactivated', 'so-widgets-bundle')
338
  )
339
  ?>
340
  </p>
406
  return true;
407
  }
408
 
409
+ /**
410
+ * Include a widget that might not have been registered.
411
+ *
412
+ * @param $widget_id
413
+ *
414
+ * @return bool
415
+ */
416
+ function include_widget( $widget_id ) {
417
+ $folders = $this->get_widget_folders();
418
+
419
+ foreach( $folders as $folder ) {
420
+ if( !file_exists($folder . $widget_id . '/' . $widget_id . '.php') ) continue;
421
+ include_once $folder . $widget_id . '/' . $widget_id . '.php';
422
+ return true;
423
+ }
424
+
425
+ return false;
426
+ }
427
+
428
  /**
429
  * Deactivate a widget
430
  *
441
  */
442
  function get_widgets_list(){
443
  $active = $this->get_active_widgets();
444
+ $folders = $this->get_widget_folders();
445
 
446
  $default_headers = array(
447
  'Name' => 'Widget Name',
453
  );
454
 
455
  $widgets = array();
456
+ foreach( $folders as $folder ) {
457
 
458
  $files = glob( $folder.'*/*.php' );
459
  foreach($files as $file) {
512
  $class = $widget['panels_info']['class'];
513
  if( preg_match('/SiteOrigin_Widget_([A-Za-z]+)_Widget/', $class, $matches) ) {
514
  $name = $matches[1];
515
+ // TODO change this when we transition to new widget names
516
  $id = 'so'.strtolower( implode( '-', preg_split('/(?=[A-Z])/',$name) ) ).'-widget';
 
517
  $this->activate_widget($id, true);
518
  }
519
  }
535
 
536
  if( preg_match('/SiteOrigin_Widget_([A-Za-z]+)_Widget/', $class, $matches) ) {
537
  $name = $matches[1];
538
+ // TODO change this when we transition to new widget names
539
  $id = 'so'.strtolower( implode( '-', preg_split('/(?=[A-Z])/',$name) ) ).'-widget';
540
 
541
  $this->activate_widget($id, true);
550
  * Add action links.
551
  */
552
  function plugin_action_links($links){
553
+ $links[] = '<a href="' . admin_url('plugins.php?page=so-widgets-plugins') . '">'.__('Manage Widgets', 'so-widgets-bundle').'</a>';
554
+ $links[] = '<a href="https://siteorigin.com/thread/" target="_blank">'.__('Support', 'so-widgets-bundle').'</a>';
555
  return $links;
556
  }
557
 
widgets/so-button-widget/assets/banner.svg CHANGED
@@ -1,31 +1,30 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
4
- <svg version="1.0" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
- width="480px" height="240px" viewBox="0 0 480 240" enable-background="new 0 0 480 240" xml:space="preserve">
6
- <rect id="Button" fill="#1880B6" width="480" height="240"/>
7
- <g>
8
- <polygon fill="#F2F0DA" points="274.34,149.357 255.002,157.416 263.418,177.055 259.002,179.262 250.451,159.312 232,167
9
- 232,110.547 "/>
10
- <path fill="#8ED9EF" d="M300,128c0,2.209-1.791,4-4,4h-34.676l-29.973-27.475c-0.584-0.533-1.432-0.682-2.156-0.355
11
- c-0.727,0.318-1.195,1.037-1.195,1.83v26h-44c-2.209,0-4-1.791-4-4V64c0-2.209,1.791-4,4-4h112c2.209,0,4,1.791,4,4V128z"/>
12
- <g>
13
- <path fill="#324249" d="M296.145,56H183.855c-4.34,0-7.855,3.516-7.855,7.855v64.289c0,4.34,3.516,7.855,7.855,7.855H228v34
14
- c0,0.668,0.334,1.293,0.891,1.664c0.334,0.223,0.721,0.336,1.109,0.336c0.26,0,0.521-0.051,0.77-0.154l17.566-7.318l7.826,18.26
15
- c0.217,0.508,0.633,0.902,1.15,1.092c0.223,0.08,0.455,0.121,0.688,0.121c0.307,0,0.613-0.07,0.895-0.211l8-4
16
- c0.947-0.475,1.361-1.604,0.943-2.576l-7.568-17.658l18.5-7.709c0.629-0.262,1.082-0.828,1.201-1.5
17
- c0.117-0.672-0.115-1.359-0.619-1.82L265.688,136h30.457c4.34,0,7.855-3.516,7.855-7.855V63.855C304,59.516,300.484,56,296.145,56
18
- z M274.34,149.357l-19.338,8.059l8.416,19.639l-4.416,2.207l-8.551-19.949L232,167v-56.453L274.34,149.357z M300,128
19
- c0,2.209-1.791,4-4,4h-34.676l-29.973-27.475c-0.584-0.533-1.432-0.682-2.156-0.355c-0.727,0.318-1.195,1.037-1.195,1.83v26h-44
20
- c-2.209,0-4-1.791-4-4V64c0-2.209,1.791-4,4-4h112c2.209,0,4,1.791,4,4V128z"/>
21
- <path fill="#324249" d="M230,72c-1.105,0-2,0.895-2,2v20c0,1.105,0.895,2,2,2s2-0.895,2-2V74C232,72.895,231.105,72,230,72z"/>
22
- <path fill="#324249" d="M218,104h-20c-1.105,0-2,0.895-2,2s0.895,2,2,2h20c1.105,0,2-0.895,2-2S219.105,104,218,104z"/>
23
- <path fill="#324249" d="M264,106c0-1.105-0.895-2-2-2h-20c-1.105,0-2,0.895-2,2s0.895,2,2,2h20C263.105,108,264,107.105,264,106z"
24
- />
25
- <path fill="#324249" d="M207.414,80.586c-0.781-0.781-2.047-0.781-2.828,0s-0.781,2.047,0,2.828l14.143,14.143
26
- c0.781,0.781,2.047,0.781,2.828,0s0.781-2.047,0-2.828L207.414,80.586z"/>
27
- <path fill="#324249" d="M255.412,83.414c0.781-0.781,0.781-2.047,0-2.828s-2.047-0.781-2.828,0l-14.143,14.143
28
- c-0.781,0.781-0.781,2.047,0,2.828s2.047,0.781,2.828,0L255.412,83.414z"/>
29
- </g>
30
- </g>
31
- </svg>
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="55 277 240 240" style="enable-background:new 55 277 240 240;" xml:space="preserve">
5
+ <style type="text/css">
6
+ .st0{fill:#1880B6;}
7
+ .st1{fill:#F2F0DA;}
8
+ .st2{fill:#8ED9EF;}
9
+ .st3{fill:#324249;}
10
+ </style>
11
+ <rect id="Button" x="55" y="277" class="st0" width="240" height="240"/>
12
+ <g>
13
+ <polygon class="st1" points="209.3,426.4 190,434.4 198.4,454.1 194,456.3 185.5,436.3 167,444 167,387.5 "/>
14
+ <path class="st2" d="M235,405c0,2.2-1.8,4-4,4h-34.7l-30-27.5c-0.6-0.5-1.4-0.7-2.2-0.4c-0.7,0.3-1.2,1-1.2,1.8v26h-44
15
+ c-2.2,0-4-1.8-4-4v-64c0-2.2,1.8-4,4-4h112c2.2,0,4,1.8,4,4V405z"/>
16
+ <g>
17
+ <path class="st3" d="M231.1,333H118.9c-4.3,0-7.9,3.5-7.9,7.9v64.3c0,4.3,3.5,7.9,7.9,7.9H163v34c0,0.7,0.3,1.3,0.9,1.7
18
+ c0.3,0.2,0.7,0.3,1.1,0.3c0.3,0,0.5-0.1,0.8-0.2l17.6-7.3l7.8,18.3c0.2,0.5,0.6,0.9,1.1,1.1c0.2,0.1,0.5,0.1,0.7,0.1
19
+ c0.3,0,0.6-0.1,0.9-0.2l8-4c0.9-0.5,1.4-1.6,0.9-2.6l-7.6-17.7l18.5-7.7c0.6-0.3,1.1-0.8,1.2-1.5c0.1-0.7-0.1-1.4-0.6-1.8
20
+ L200.7,413h30.5c4.3,0,7.9-3.5,7.9-7.9v-64.3C239,336.5,235.5,333,231.1,333z M209.3,426.4l-19.3,8.1l8.4,19.6l-4.4,2.2l-8.6-19.9
21
+ L167,444v-56.5L209.3,426.4z M235,405c0,2.2-1.8,4-4,4h-34.7l-30-27.5c-0.6-0.5-1.4-0.7-2.2-0.4c-0.7,0.3-1.2,1-1.2,1.8v26h-44
22
+ c-2.2,0-4-1.8-4-4v-64c0-2.2,1.8-4,4-4h112c2.2,0,4,1.8,4,4V405z"/>
23
+ <path class="st3" d="M165,349c-1.1,0-2,0.9-2,2v20c0,1.1,0.9,2,2,2s2-0.9,2-2v-20C167,349.9,166.1,349,165,349z"/>
24
+ <path class="st3" d="M153,381h-20c-1.1,0-2,0.9-2,2s0.9,2,2,2h20c1.1,0,2-0.9,2-2S154.1,381,153,381z"/>
25
+ <path class="st3" d="M199,383c0-1.1-0.9-2-2-2h-20c-1.1,0-2,0.9-2,2s0.9,2,2,2h20C198.1,385,199,384.1,199,383z"/>
26
+ <path class="st3" d="M142.4,357.6c-0.8-0.8-2-0.8-2.8,0s-0.8,2,0,2.8l14.1,14.1c0.8,0.8,2,0.8,2.8,0s0.8-2,0-2.8L142.4,357.6z"/>
27
+ <path class="st3" d="M190.4,360.4c0.8-0.8,0.8-2,0-2.8s-2-0.8-2.8,0l-14.1,14.1c-0.8,0.8-0.8,2,0,2.8s2,0.8,2.8,0L190.4,360.4z"/>
28
+ </g>
29
+ </g>
30
+ </svg>
 
widgets/so-button-widget/so-button-widget.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /*
3
- Widget Name: Button widget
4
  Description: A powerful yet simple button widget for your sidebars or Page Builder pages.
5
- Author: Greg Priday
6
- Author URI: http://siteorigin.com
7
  */
8
 
9
  class SiteOrigin_Widget_Button_Widget extends SiteOrigin_Widget {
@@ -11,9 +11,9 @@ class SiteOrigin_Widget_Button_Widget extends SiteOrigin_Widget {
11
 
12
  parent::__construct(
13
  'sow-button',
14
- __('SiteOrigin Button', 'siteorigin-widgets'),
15
  array(
16
- 'description' => __('A customizable button widget.', 'siteorigin-widgets'),
17
  'help' => 'https://siteorigin.com/widgets-bundle/button-widget-documentation/'
18
  ),
19
  array(
@@ -22,119 +22,119 @@ class SiteOrigin_Widget_Button_Widget extends SiteOrigin_Widget {
22
  array(
23
  'text' => array(
24
  'type' => 'text',
25
- 'label' => __('Button text', 'siteorigin-widgets'),
26
  ),
27
 
28
  'url' => array(
29
  'type' => 'link',
30
- 'label' => __('Destination URL', 'siteorigin-widgets'),
31
  ),
32
 
33
  'new_window' => array(
34
  'type' => 'checkbox',
35
  'default' => false,
36
- 'label' => __('Open in a new window', 'siteorigin-widgets'),
37
  ),
38
 
39
  'button_icon' => array(
40
  'type' => 'section',
41
- 'label' => __('Icon', 'siteorigin-widgets'),
42
  'fields' => array(
43
  'icon_selected' => array(
44
  'type' => 'icon',
45
- 'label' => __('Icon', 'siteorigin-widgets'),
46
  ),
47
 
48
  'icon_color' => array(
49
  'type' => 'color',
50
- 'label' => __('Icon color', 'siteorigin-widgets'),
51
  ),
52
 
53
  'icon' => array(
54
  'type' => 'media',
55
- 'label' => __('Image icon', 'siteorigin-widgets'),
56
- 'description' => __('Replaces the icon with your own image icon.'),
57
  ),
58
  ),
59
  ),
60
 
61
  'design' => array(
62
  'type' => 'section',
63
- 'label' => __('Design and layout', 'siteorigin-widgets'),
64
  'hide' => true,
65
  'fields' => array(
66
  'align' => array(
67
  'type' => 'select',
68
- 'label' => __('Align', 'siteorigin-widgets'),
69
  'default' => 'center',
70
  'options' => array(
71
- 'left' => __('Left', 'siteorigin-widgets'),
72
- 'right' => __('Right', 'siteorigin-widgets'),
73
- 'center' => __('Center', 'siteorigin-widgets'),
74
- 'justify' => __('Justify', 'siteorigin-widgets'),
75
  ),
76
  ),
77
 
78
  'theme' => array(
79
  'type' => 'select',
80
- 'label' => __('Button theme', 'siteorigin-widgets'),
81
  'default' => 'atom',
82
  'options' => array(
83
- 'atom' => __('Atom', 'siteorigin-widgets'),
84
- 'flat' => __('Flat', 'siteorigin-widgets'),
85
- 'wire' => __('Wire', 'siteorigin-widgets'),
86
  ),
87
  ),
88
 
89
 
90
  'button_color' => array(
91
  'type' => 'color',
92
- 'label' => __('Button color', 'siteorigin-widgets'),
93
  ),
94
 
95
  'text_color' => array(
96
  'type' => 'color',
97
- 'label' => __('Text color', 'siteorigin-widgets'),
98
  ),
99
 
100
  'hover' => array(
101
  'type' => 'checkbox',
102
  'default' => true,
103
- 'label' => __('Use hover effects', 'siteorigin-widgets'),
104
  ),
105
 
106
  'font_size' => array(
107
  'type' => 'select',
108
- 'label' => __('Font size', 'siteorigin-widgets'),
109
  'options' => array(
110
- '1' => __('Normal', 'siteorigin-widgets'),
111
- '1.15' => __('Medium', 'siteorigin-widgets'),
112
- '1.3' => __('Large', 'siteorigin-widgets'),
113
- '1.45' => __('Extra large', 'siteorigin-widgets'),
114
  ),
115
  ),
116
 
117
  'rounding' => array(
118
  'type' => 'select',
119
- 'label' => __('Rounding', 'siteorigin-widgets'),
120
  'default' => '0.25',
121
  'options' => array(
122
- '0' => __('None', 'siteorigin-widgets'),
123
- '0.25' => __('Slightly rounded', 'siteorigin-widgets'),
124
- '0.5' => __('Very rounded', 'siteorigin-widgets'),
125
- '1.5' => __('Completely rounded', 'siteorigin-widgets'),
126
  ),
127
  ),
128
 
129
  'padding' => array(
130
  'type' => 'select',
131
- 'label' => __('Padding', 'siteorigin-widgets'),
132
  'default' => '1',
133
  'options' => array(
134
- '0.5' => __('Low', 'siteorigin-widgets'),
135
- '1' => __('Medium', 'siteorigin-widgets'),
136
- '1.4' => __('High', 'siteorigin-widgets'),
137
- '1.8' => __('Very high', 'siteorigin-widgets'),
138
  ),
139
  ),
140
 
@@ -143,25 +143,25 @@ class SiteOrigin_Widget_Button_Widget extends SiteOrigin_Widget {
143
 
144
  'attributes' => array(
145
  'type' => 'section',
146
- 'label' => __('Other attributes and SEO', 'siteorigin-widgets'),
147
  'hide' => true,
148
  'fields' => array(
149
  'id' => array(
150
  'type' => 'text',
151
- 'label' => __('Button ID', 'siteorigin-widgets'),
152
- 'description' => __('An ID attribute allows you to target this button in Javascript.', 'siteorigin-widgets'),
153
  ),
154
 
155
  'title' => array(
156
  'type' => 'text',
157
- 'label' => __('Title attribute', 'siteorigin-widgets'),
158
- 'description' => __('Adds a title attribute to the button link.', 'siteorigin-widgets'),
159
  ),
160
 
161
  'onclick' => array(
162
  'type' => 'text',
163
- 'label' => __('Onclick', 'siteorigin-widgets'),
164
- 'description' => __('Run this Javascript when the button is clicked. Ideal for tracking.', 'siteorigin-widgets'),
165
  ),
166
  )
167
  ),
@@ -176,7 +176,7 @@ class SiteOrigin_Widget_Button_Widget extends SiteOrigin_Widget {
176
  array(
177
  array(
178
  'sow-button-base',
179
- siteorigin_widget_get_plugin_dir_url( 'button' ) . 'css/style.css',
180
  array(),
181
  SOW_BUNDLE_VERSION
182
  ),
@@ -267,4 +267,4 @@ class SiteOrigin_Widget_Button_Widget extends SiteOrigin_Widget {
267
  }
268
  }
269
 
270
- siteorigin_widget_register('button', __FILE__);
1
  <?php
2
  /*
3
+ Widget Name: Button
4
  Description: A powerful yet simple button widget for your sidebars or Page Builder pages.
5
+ Author: SiteOrigin
6
+ Author URI: https://siteorigin.com
7
  */
8
 
9
  class SiteOrigin_Widget_Button_Widget extends SiteOrigin_Widget {
11
 
12
  parent::__construct(
13
  'sow-button',
14
+ __('SiteOrigin Button', 'so-widgets-bundle'),
15
  array(
16
+ 'description' => __('A customizable button widget.', 'so-widgets-bundle'),
17
  'help' => 'https://siteorigin.com/widgets-bundle/button-widget-documentation/'
18
  ),
19
  array(
22
  array(
23
  'text' => array(
24
  'type' => 'text',
25
+ 'label' => __('Button text', 'so-widgets-bundle'),
26
  ),
27
 
28
  'url' => array(
29
  'type' => 'link',
30
+ 'label' => __('Destination URL', 'so-widgets-bundle'),
31
  ),
32
 
33
  'new_window' => array(
34
  'type' => 'checkbox',
35
  'default' => false,
36
+ 'label' => __('Open in a new window', 'so-widgets-bundle'),
37
  ),
38
 
39
  'button_icon' => array(
40
  'type' => 'section',
41
+ 'label' => __('Icon', 'so-widgets-bundle'),
42
  'fields' => array(
43
  'icon_selected' => array(
44
  'type' => 'icon',
45
+ 'label' => __('Icon', 'so-widgets-bundle'),
46
  ),
47
 
48
  'icon_color' => array(
49
  'type' => 'color',
50
+ 'label' => __('Icon color', 'so-widgets-bundle'),
51
  ),
52
 
53
  'icon' => array(
54
  'type' => 'media',
55
+ 'label' => __('Image icon', 'so-widgets-bundle'),
56
+ 'description' => __('Replaces the icon with your own image icon.', 'so-widgets-bundle'),
57
  ),
58
  ),
59
  ),
60
 
61
  'design' => array(
62
  'type' => 'section',
63
+ 'label' => __('Design and layout', 'so-widgets-bundle'),
64
  'hide' => true,
65
  'fields' => array(
66
  'align' => array(
67
  'type' => 'select',
68
+ 'label' => __('Align', 'so-widgets-bundle'),
69
  'default' => 'center',
70
  'options' => array(
71
+ 'left' => __('Left', 'so-widgets-bundle'),
72
+ 'right' => __('Right', 'so-widgets-bundle'),
73
+ 'center' => __('Center', 'so-widgets-bundle'),
74
+ 'justify' => __('Justify', 'so-widgets-bundle'),
75
  ),
76
  ),
77
 
78
  'theme' => array(
79
  'type' => 'select',
80
+ 'label' => __('Button theme', 'so-widgets-bundle'),
81
  'default' => 'atom',
82
  'options' => array(
83
+ 'atom' => __('Atom', 'so-widgets-bundle'),
84
+ 'flat' => __('Flat', 'so-widgets-bundle'),
85
+ 'wire' => __('Wire', 'so-widgets-bundle'),
86
  ),
87
  ),
88
 
89
 
90
  'button_color' => array(
91
  'type' => 'color',
92
+ 'label' => __('Button color', 'so-widgets-bundle'),
93
  ),
94
 
95
  'text_color' => array(
96
  'type' => 'color',
97
+ 'label' => __('Text color', 'so-widgets-bundle'),
98
  ),
99
 
100
  'hover' => array(
101
  'type' => 'checkbox',
102
  'default' => true,
103
+ 'label' => __('Use hover effects', 'so-widgets-bundle'),
104
  ),
105
 
106
  'font_size' => array(
107
  'type' => 'select',
108
+ 'label' => __('Font size', 'so-widgets-bundle'),
109
  'options' => array(
110
+ '1' => __('Normal', 'so-widgets-bundle'),
111
+ '1.15' => __('Medium', 'so-widgets-bundle'),
112
+ '1.3' => __('Large', 'so-widgets-bundle'),
113
+ '1.45' => __('Extra large', 'so-widgets-bundle'),
114
  ),
115
  ),
116
 
117
  'rounding' => array(
118
  'type' => 'select',
119
+ 'label' => __('Rounding', 'so-widgets-bundle'),
120
  'default' => '0.25',
121
  'options' => array(
122
+ '0' => __('None', 'so-widgets-bundle'),
123
+ '0.25' => __('Slightly rounded', 'so-widgets-bundle'),
124
+ '0.5' => __('Very rounded', 'so-widgets-bundle'),
125
+ '1.5' => __('Completely rounded', 'so-widgets-bundle'),
126
  ),
127
  ),
128
 
129
  'padding' => array(
130
  'type' => 'select',
131
+ 'label' => __('Padding', 'so-widgets-bundle'),
132
  'default' => '1',
133
  'options' => array(
134
+ '0.5' => __('Low', 'so-widgets-bundle'),
135
+ '1' => __('Medium', 'so-widgets-bundle'),
136
+ '1.4' => __('High', 'so-widgets-bundle'),
137
+ '1.8' => __('Very high', 'so-widgets-bundle'),
138
  ),
139
  ),
140
 
143
 
144
  'attributes' => array(
145
  'type' => 'section',
146
+ 'label' => __('Other attributes and SEO', 'so-widgets-bundle'),
147
  'hide' => true,
148
  'fields' => array(
149
  'id' => array(
150
  'type' => 'text',
151
+ 'label' => __('Button ID', 'so-widgets-bundle'),
152
+ 'description' => __('An ID attribute allows you to target this button in Javascript.', 'so-widgets-bundle'),
153
  ),
154
 
155
  'title' => array(
156
  'type' => 'text',
157
+ 'label' => __('Title attribute', 'so-widgets-bundle'),
158
+ 'description' => __('Adds a title attribute to the button link.', 'so-widgets-bundle'),
159
  ),
160
 
161
  'onclick' => array(
162
  'type' => 'text',
163
+ 'label' => __('Onclick', 'so-widgets-bundle'),
164
+ 'description' => __('Run this Javascript when the button is clicked. Ideal for tracking.', 'so-widgets-bundle'),
165
  ),
166
  )
167
  ),
176
  array(
177
  array(
178
  'sow-button-base',
179
+ plugin_dir_url(__FILE__) . 'css/style.css',
180
  array(),
181
  SOW_BUNDLE_VERSION
182
  ),
267
  }
268
  }
269
 
270
+ siteorigin_widget_register('sow-button', __FILE__, 'SiteOrigin_Widget_Button_Widget');
widgets/so-contact-widget/assets/banner.svg ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="55 277 240 240" style="enable-background:new 55 277 240 240;" xml:space="preserve">
5
+ <style type="text/css">
6
+ .st0{fill:#1880B6;}
7
+ .st1{fill:#F2F0DA;}
8
+ .st2{fill:#8ED9EF;}
9
+ .st3{fill:#324249;}
10
+ .st4{opacity:0.2;}
11
+ </style>
12
+ <rect id="Call_to_Action" x="55" y="277" class="st0" width="240" height="240"/>
13
+ <g>
14
+ <path class="st1" d="M139,337h72c2.2,0,4,1.8,4,4v46.2l-40,29.3l-40-29.3V341C135,338.8,136.8,337,139,337z"/>
15
+ <g>
16
+ <path class="st2" d="M233.2,373.3c-0.4-0.2-0.8-0.4-1.2-0.7c-0.1-0.1-5.6-3.1-13-7.2v18.8l14.6-10.7
17
+ C233.5,373.5,233.4,373.4,233.2,373.3z"/>
18
+ <path class="st2" d="M131,365.4c-7.4,4.1-12.9,7.1-13,7.2c-0.5,0.3-0.9,0.5-1.3,0.7c-0.1,0.1-0.2,0.1-0.3,0.1l14.6,10.7V365.4z"/>
19
+ <path class="st2" d="M176.2,420.6c-0.4,0.3-0.8,0.4-1.2,0.4s-0.8-0.1-1.2-0.4L115,377.5V453c0,2.1,1.8,4,4,4h112c2.1,0,4-1.7,4-4
20
+ v-75.5L176.2,420.6z"/>
21
+ <rect x="155" y="365" class="st2" width="40" height="8"/>
22
+ <polygon class="st2" points="190.7,405 195,401.9 195,397 155,397 155,401.9 159.3,405 "/>
23
+ </g>
24
+ <g>
25
+ <path class="st3" d="M151.6,417.6l-28,28c-0.8,0.8-0.8,2,0,2.8c0.4,0.4,0.9,0.6,1.4,0.6s1-0.2,1.4-0.6l28-28c0.8-0.8,0.8-2,0-2.8
26
+ S152.4,416.8,151.6,417.6z"/>
27
+ <path class="st3" d="M223.6,448.4c0.4,0.4,0.9,0.6,1.4,0.6s1-0.2,1.4-0.6c0.8-0.8,0.8-2,0-2.8L199,418.2c-0.8-0.8-2-0.8-2.8,0
28
+ s-0.8,2,0,2.8L223.6,448.4z"/>
29
+ <path class="st3" d="M235.1,369.8c-0.3-0.2-0.7-0.4-1.1-0.6c-0.6-0.4-6.9-3.9-15-8.4v-19.9c0-4.3-3.5-7.9-7.9-7.9h-72.3
30
+ c-4.3,0-7.9,3.5-7.9,7.9v19.9c-8.1,4.5-14.4,8.1-15,8.4c-0.4,0.3-0.9,0.5-1.2,0.7c-1.8,1-3.8,2-3.8,5V453c0,4.2,3.6,8,8,8h112
31
+ c4.1,0,8-3.7,8-8v-78.1C239,371.9,236.8,370.7,235.1,369.8z M219,365.4c7.4,4.1,12.8,7.2,13,7.2c0.4,0.2,0.8,0.5,1.2,0.7
32
+ c0.2,0.1,0.3,0.2,0.4,0.2L219,384.3V365.4z M135,341c0-2.2,1.8-4,4-4h72c2.2,0,4,1.8,4,4v46.2l-16,11.7V393h-48v5.9l-16-11.7V341z
33
+ M190.7,405h-31.4l-4.3-3.1V397h40v4.9L190.7,405z M185.3,409l-10.3,7.5l-10.3-7.5H185.3z M116.7,373.4c0.4-0.2,0.9-0.5,1.3-0.7
34
+ c0.1-0.1,5.6-3.1,13-7.2v18.8l-14.6-10.7C116.5,373.5,116.6,373.5,116.7,373.4z M235,453c0,2.3-1.9,4-4,4H119c-2.2,0-4-1.9-4-4
35
+ v-75.5l58.8,43.1c0.4,0.3,0.8,0.4,1.2,0.4s0.8-0.1,1.2-0.4l58.8-43.1V453z"/>
36
+ <path class="st3" d="M199,361h-48v16h48V361z M195,373h-40v-8h40V373z"/>
37
+ </g>
38
+ <g class="st4">
39
+ <path d="M153,357h20c1.1,0,2-0.9,2-2s-0.9-2-2-2h-20c-1.1,0-2,0.9-2,2S151.9,357,153,357z"/>
40
+ <path d="M173,385h-20c-1.1,0-2,0.9-2,2s0.9,2,2,2h20c1.1,0,2-0.9,2-2S174.1,385,173,385z"/>
41
+ </g>
42
+ </g>
43
+ </svg>
widgets/so-contact-widget/so-contact-widget.php ADDED
@@ -0,0 +1,757 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Widget Name: Contact Form
4
+ Description: A light weight contact form builder.
5
+ Author: SiteOrigin
6
+ Author URI: https://siteorigin.com
7
+ */
8
+
9
+ class SiteOrigin_Widgets_ContactForm_Widget extends SiteOrigin_Widget {
10
+
11
+ function __construct(){
12
+
13
+ parent::__construct(
14
+ 'sow-contact-form',
15
+ __('SiteOrigin Contact Form', 'so-widgets-bundle'),
16
+ array(
17
+ 'description' => __( 'Create a simple contact form for your users to get hold of you.', 'so-widgets-bundle' ),
18
+ ),
19
+ array(),
20
+ array(
21
+ 'title' => array(
22
+ 'type' => 'text',
23
+ 'label' => __('Title', 'so-widgets-bundle'),
24
+ 'default' => __('Contact Us', 'so-widgets-bundle'),
25
+ ),
26
+
27
+ 'display_title' => array(
28
+ 'type' => 'checkbox',
29
+ 'label' => __('Display title', 'so-widgets-bundle'),
30
+ ),
31
+
32
+ 'settings' => array(
33
+ 'type' => 'section',
34
+ 'label' => __('Settings', 'so-widgets-bundle'),
35
+ 'hide' => true,
36
+ 'fields' => array(
37
+ 'to' => array(
38
+ 'type' => 'text',
39
+ 'label' => __('To email address', 'so-widgets-bundle'),
40
+ 'description' => __('Where contact emails will be delivered to.', 'so-widgets-bundle'),
41
+ 'sanitize' => 'email',
42
+ ),
43
+ 'default_subject' => array(
44
+ 'type' => 'text',
45
+ 'label' => __('Default subject', 'so-widgets-bundle'),
46
+ 'description' => __("Subject to use when there isn't one available.", 'so-widgets-bundle'),
47
+ ),
48
+ 'subject_prefix' => array(
49
+ 'type' => 'text',
50
+ 'label' => __('Subject prefix', 'so-widgets-bundle'),
51
+ 'description' => __('Prefix added to all incoming email subjects.', 'so-widgets-bundle'),
52
+ ),
53
+ 'success_message' => array(
54
+ 'type' => 'tinymce',
55
+ 'label' => __('Success message', 'so-widgets-bundle'),
56
+ 'description' => __('Message to display after message successfully sent.', 'so-widgets-bundle'),
57
+ 'default' => __("Thanks for contacting us. We'll get back to you shortly.", 'so-widgets-bundle')
58
+ ),
59
+ 'submit_text' => array(
60
+ 'type' => 'text',
61
+ 'label' => __('Submit button text', 'so-widgets-bundle'),
62
+ 'default' => __("Contact Us", 'so-widgets-bundle')
63
+ )
64
+ )
65
+ ),
66
+
67
+ 'fields' => array(
68
+
69
+ 'type' => 'repeater',
70
+ 'label' => __('Fields', 'so-widgets-bundle'),
71
+ 'item_name' => __('Field', 'so-widgets-bundle'),
72
+ 'item_label' => array(
73
+ 'selector' => "[id*='label']",
74
+ ),
75
+ 'fields' => array(
76
+
77
+ 'type' => array(
78
+ 'type' => 'select',
79
+ 'label' => __( 'Field Type', 'so-widgets-bundle' ),
80
+ 'options' => array(
81
+ 'name' => __( 'Name', 'so-widgets-bundle' ),
82
+ 'email' => __( 'Email', 'so-widgets-bundle' ),
83
+ 'subject' => __( 'Subject', 'so-widgets-bundle' ),
84
+ 'text' => __( 'Text', 'so-widgets-bundle' ),
85
+ 'textarea' => __( 'Text Area', 'so-widgets-bundle' ),
86
+ 'select' => __( 'Dropdown Select', 'so-widgets-bundle' ),
87
+ 'checkboxes' => __( 'Checkboxes', 'so-widgets-bundle' ),
88
+ ),
89
+ 'state_emitter' => array(
90
+ 'callback' => 'select',
91
+ 'args' => array( 'field_type_{$repeater}' ),
92
+ )
93
+ ),
94
+
95
+ 'label' => array(
96
+ 'type' => 'text',
97
+ 'label' => __('Label', 'so-widgets-bundle'),
98
+ ),
99
+
100
+ 'required' => array(
101
+ 'type' => 'section',
102
+ 'label' => __('Required Field', 'so-widgets-bundle'),
103
+ 'fields' => array(
104
+ 'required' => array(
105
+ 'type' => 'checkbox',
106
+ 'label' => __('Required field', 'so-widgets-bundle'),
107
+ 'description' => __('Is this field required?', 'so-widgets-bundle'),
108
+ ),
109
+ 'missing_message' => array(
110
+ 'type' => 'text',
111
+ 'label' => __('Missing message', 'so-widgets-bundle'),
112
+ 'description' => __('Error message to display if this field is missing.', 'so-widgets-bundle'),
113
+ )
114
+ )
115
+ ),
116
+
117
+ // This are for select and checkboxes
118
+ 'options' => array(
119
+ 'type' => 'repeater',
120
+ 'label' => __( 'Options', 'so-widgets-bundle' ),
121
+ 'item_name' => __( 'Option', 'so-widgets-bundle' ),
122
+ 'item_label' => array( 'selector' => "[id*='value']" ),
123
+ 'fields' => array(
124
+ 'value' => array(
125
+ 'type' => 'text',
126
+ 'label' => __( 'Value', 'so-widgets-bundle' ),
127
+ ),
128
+ ),
129
+
130
+ // These are only required for a few states
131
+ 'state_handler' => array(
132
+ 'field_type_{$repeater}[select,checkboxes]' => array('show'),
133
+ '_else[field_type_{$repeater}]' => array( 'hide' ),
134
+ ),
135
+ ),
136
+ ),
137
+ ),
138
+
139
+ 'spam' => array(
140
+ 'type' => 'section',
141
+ 'label' => __( 'Spam Protection', 'so-widgets-bundle' ),
142
+ 'hide' => true,
143
+ 'fields' => array(
144
+
145
+
146
+ 'recaptcha' => array(
147
+ 'type' => 'section',
148
+ 'label' => __('Recaptcha', 'so-widgets-bundle'),
149
+ 'fields' => array(
150
+ 'use_captcha' => array(
151
+ 'type' => 'checkbox',
152
+ 'label' => __( 'Use Captcha', 'so-widgets-bundle' ),
153
+ 'default' => false,
154
+ ),
155
+ 'site_key' => array(
156
+ 'type' => 'text',
157
+ 'label' => __( 'ReCaptcha Site Key', 'so-widgets-bundle' ),
158
+ ),
159
+ 'secret_key' => array(
160
+ 'type' => 'text',
161
+ 'label' => __( 'ReCaptcha Secret Key', 'so-widgets-bundle' ),
162
+ ),
163
+ )
164
+ ),
165
+
166
+ 'akismet' => array(
167
+ 'type' => 'section',
168
+ 'label' => __('akismet', 'so-widgets-bundle'),
169
+ 'fields' => array(
170
+ 'use_akismet'=> array(
171
+ 'type' => 'checkbox',
172
+ 'label' => __( 'Use Akismet filtering', 'so-widgets-bundle' ),
173
+ 'default' => true,
174
+ ),
175
+ 'spam_action'=> array(
176
+ 'type' => 'select',
177
+ 'label' => __( 'Spam action', 'so-widgets-bundle' ),
178
+ 'options' => array(
179
+ 'error' => __('Show error message', 'so-widgets-bundle'),
180
+ 'tag' => __('Tag as spam in subject', 'so-widgets-bundle'),
181
+ ),
182
+ 'description' => __('How to handle submissions that are identified as spam.', 'so-widgets-bundle'),
183
+ 'default' => 'error',
184
+ ),
185
+ )
186
+ ),
187
+ )
188
+ ),
189
+
190
+ 'design' => array(
191
+ 'type' => 'section',
192
+ 'label' => __('Design', 'so-widgets-bundle'),
193
+ 'hide' => true,
194
+ 'fields' => array(
195
+
196
+ 'container' => array(
197
+ 'type' => 'section',
198
+ 'label' => __('Container', 'so-widgets-bundle'),
199
+ 'fields' => array(
200
+ 'background' => array(
201
+ 'type' => 'color',
202
+ 'label' => __('Background color', 'so-widgets-bundle'),
203
+ 'default' => '#f2f2f2',
204
+ ),
205
+ 'padding' => array(
206
+ 'type' => 'slider',
207
+ 'label' => __('Padding', 'so-widgets-bundle'),
208
+ 'default' => 10,
209
+ 'max' => 100,
210
+ 'min' => 0
211
+ ),
212
+ 'border_color' => array(
213
+ 'type' => 'color',
214
+ 'label' => __('Border color', 'so-widgets-bundle'),
215
+ 'default' => '#c0c0c0',
216
+ ),
217
+ 'border_width' => array(
218
+ 'type' => 'slider',
219
+ 'label' => __('Border width', 'so-widgets-bundle'),
220
+ 'default' => 1,
221
+ 'max' => 10,
222
+ 'min' => 0
223
+ ),
224
+ 'border_style' => array(
225
+ 'type' => 'select',
226
+ 'label' => __('Border style', 'so-widgets-bundle'),
227
+ 'default' => 'solid',
228
+ 'options' => array(
229
+ 'none' => __( 'None', 'so-widgets-bundle' ),
230
+ 'hidden' => __( 'Hidden', 'so-widgets-bundle' ),
231
+ 'dotted' => __( 'Dotted', 'so-widgets-bundle' ),
232
+ 'dashed' => __( 'Dashed', 'so-widgets-bundle' ),
233
+ 'solid' => __( 'Solid', 'so-widgets-bundle' ),
234
+ 'double' => __( 'Double', 'so-widgets-bundle' ),
235
+ 'groove' => __( 'Groove', 'so-widgets-bundle' ),
236
+ 'ridge' => __( 'Ridge', 'so-widgets-bundle' ),
237
+ 'inset' => __( 'Inset', 'so-widgets-bundle' ),
238
+ 'outset' => __( 'Outset', 'so-widgets-bundle' ),
239
+ )
240
+ ),
241
+ )
242
+ ),
243
+
244
+ 'errors' => array(
245
+ 'type' => 'section',
246
+ 'label' => __('Error messages', 'so-widgets-bundle'),
247
+ 'fields' => array(
248
+ 'background' => array(
249
+ 'type' => 'color',
250
+ 'label' => __('Error background color', 'so-widgets-bundle'),
251
+ 'default' => '#fce4e5',
252
+ ),
253
+ 'border_color' => array(
254
+ 'type' => 'color',
255
+ 'label' => __('Error background color', 'so-widgets-bundle'),
256
+ 'default' => '#ec666a',
257
+ ),
258
+ 'text_color' => array(
259
+ 'type' => 'color',
260
+ 'label' => __('Error text color', 'so-widgets-bundle'),
261
+ 'default' => '#ec666a',
262
+ ),
263
+ 'padding' => array(
264
+ 'type' => 'slider',
265
+ 'label' => __('Error padding', 'so-widgets-bundle'),
266
+ 'default' => 5,
267
+ ),
268
+ 'margin' => array(
269
+ 'type' => 'slider',
270
+ 'label' => __('Error margin', 'so-widgets-bundle'),
271
+ 'default' => 10,
272
+ ),
273
+ )
274
+ ),
275
+
276
+ 'submit' => array(
277
+ 'type' => 'section',
278
+ 'label' => __('Submit button', 'so-widgets-bundle'),
279
+ 'fields' => array(
280
+ 'styled' => array(
281
+ 'type' => 'checkbox',
282
+ 'label' => __('Style submit button', 'so-widgets-bundle'),
283
+ 'description' => __('Style the button or leave it with default theme styling.', 'so-widgets-bundle'),
284
+ 'default' => true,
285
+ ),
286
+
287
+ 'background_color' => array(
288
+ 'type' => 'color',
289
+ 'label' => __('Background color', 'so-widgets-bundle'),
290
+ 'default' => '#eeeeee',
291
+ ),
292
+ 'background_gradient' => array(
293
+ 'type' => 'slider',
294
+ 'label' => __('Gradient intensity', 'so-widgets-bundle'),
295
+ 'default' => 10,
296
+ ),
297
+ 'border_color' => array(
298
+ 'type' => 'color',
299
+ 'label' => __('Background color', 'so-widgets-bundle'),
300
+ 'default' => '#989a9c',
301
+ ),
302
+ 'border_style' => array(
303
+ 'type' => 'select',
304
+ 'label' => __('Border style', 'so-widgets-bundle'),
305
+ 'default' => 'solid',
306
+ 'options' => array(
307
+ 'none' => __('None', 'so-widgets-bundle'),
308
+ 'solid' => __('Solid', 'so-widgets-bundle'),
309
+ )
310
+ ),
311
+ 'border_radius' => array(
312
+ 'type' => 'slider',
313
+ 'label' => __('Border rounding', 'so-widgets-bundle'),
314
+ 'default' => 3,
315
+ 'max' => 50,
316
+ 'min' => 0
317
+ ),
318
+ 'text_color' => array(
319
+ 'type' => 'color',
320
+ 'label' => __('Text color', 'so-widgets-bundle'),
321
+ 'default' => '#5a5a5a',
322
+ ),
323
+ 'weight' => array(
324
+ 'type' => 'select',
325
+ 'label' => __('Font weight', 'so-widgets-bundle'),
326
+ 'default' => '500',
327
+ 'options' => array(
328
+ 'normal' => __('Normal', 'so-widgets-bundle'),
329
+ '500' => __('Semi-bold', 'so-widgets-bundle'),
330
+ 'bold' => __('Bold', 'so-widgets-bundle'),
331
+ )
332
+ ),
333
+ 'padding' => array(
334
+ 'type' => 'slider',
335
+ 'label' => __('Padding', 'so-widgets-bundle'),
336
+ 'default' => 10,
337
+ 'max' => 50,
338
+ 'min' => 0
339
+ ),
340
+ 'inset_highlight' => array(
341
+ 'type' => 'slider',
342
+ 'label' => __('Inset highlight', 'so-widgets-bundle'),
343
+ 'description' => __('The white highlight at the bottom of the button', 'so-widgets-bundle'),
344
+ 'default' => 50,
345
+ 'max' => 100,
346
+ 'min' => 0
347
+ ),
348
+ )
349
+ ),
350
+
351
+ )
352
+ )
353
+ )
354
+ );
355
+ }
356
+
357
+ /**
358
+ * Initialize the contact form widget
359
+ */
360
+ function initialize(){
361
+
362
+ }
363
+
364
+ function modify_instance( $instance ){
365
+ // Use this to set up an initial version of the
366
+ if( empty($instance['settings']['to']) ) {
367
+ $current_user = wp_get_current_user();
368
+ $instance['settings']['to'] = $current_user->user_email;
369
+ }
370
+ if( empty($instance['fields']) ) {
371
+ $instance['fields'] = array(
372
+ array(
373
+ 'type' => 'name',
374
+ 'label' => __('Your Name', 'so-widgets-bundle'),
375
+ 'required' => array(
376
+ 'required' => true,
377
+ 'missing_message' => __('Please enter your name', 'so-widgets-bundle'),
378
+ ),
379
+ ),
380
+ array(
381
+ 'type' => 'email',
382
+ 'label' => __('Your Email', 'so-widgets-bundle'),
383
+ 'required' => array(
384
+ 'required' => true,
385
+ 'missing_message' => __('Please enter a valid email address', 'so-widgets-bundle'),
386
+ ),
387
+ ),
388
+ array(
389
+ 'type' => 'subject',
390
+ 'label' => __('Subject', 'so-widgets-bundle'),
391
+ 'required' => array(
392
+ 'required' => true,
393
+ 'missing_message' => __('Please enter a subject', 'so-widgets-bundle'),
394
+ ),
395
+ ),
396
+ array(
397
+ 'type' => 'textarea',
398
+ 'label' => __('Message', 'so-widgets-bundle'),
399
+ 'required' => array(
400
+ 'required' => true,
401
+ 'missing_message' => __('Please write something', 'so-widgets-bundle'),
402
+ ),
403
+ ),
404
+ );
405
+ }
406
+
407
+ return $instance;
408
+ }
409
+
410
+ function get_template_variables( $instance, $args ) {
411
+ $vars = array();
412
+
413
+ unset($instance['title']);
414
+ unset($instance['display_title']);
415
+ unset($instance['design']);
416
+ unset($instance['panels_data']);
417
+
418
+ $vars['instance_hash'] = md5( serialize( $instance) );
419
+ return $vars;
420
+ }
421
+
422
+ function get_less_variables( $instance ){
423
+ $vars = array(
424
+ // All the container variables.
425
+ 'container_background' => $instance['design']['container']['background'],
426
+ 'container_padding' => $instance['design']['container']['padding'] . 'px',
427
+ 'container_border_color' => $instance['design']['container']['border_color'],
428
+ 'container_border_width' => $instance['design']['container']['border_width'] . 'px',
429
+ 'container_border_style' => $instance['design']['container']['border_style'],
430
+
431
+ // The error message styles
432
+ 'error_background' => $instance['design']['errors']['background'],
433
+ 'error_border' => $instance['design']['errors']['border_color'],
434
+ 'error_text' => $instance['design']['errors']['text_color'],
435
+ 'error_padding' => $instance['design']['errors']['padding'] . 'px',
436
+ 'error_margin' => $instance['design']['errors']['margin'] . 'px',
437
+
438
+ // The submit button
439
+ 'submit_background_color' => $instance['design']['submit']['background_color'],
440
+ 'submit_background_gradient' => $instance['design']['submit']['background_gradient'] . '%',
441
+ 'submit_border_color' => $instance['design']['submit']['border_color'],
442
+ 'submit_border_style' => $instance['design']['submit']['border_style'],
443
+ 'submit_border_radius' => $instance['design']['submit']['border_radius'] . 'px',
444
+ 'submit_text_color' => $instance['design']['submit']['text_color'],
445
+ 'submit_weight' => $instance['design']['submit']['weight'],
446
+ 'submit_padding' => $instance['design']['submit']['padding'] . 'px',
447
+ 'submit_inset_highlight' => $instance['design']['submit']['inset_highlight'] . '%',
448
+ );
449
+
450
+ return $vars;
451
+ }
452
+
453
+ static function name_from_label( $label, & $ids ){
454
+ $it = 0;
455
+
456
+ $label = str_replace( ' ', '-', strtolower( $label ) );
457
+ $label = sanitize_html_class( $label );
458
+ do {
459
+ $id = $label . ( $it > 0 ? '-' . $it : '' );
460
+ $it++;
461
+ } while( !empty($ids[$id]) );
462
+ $ids[$id] = true;
463
+
464
+ return $id;
465
+ }
466
+
467
+ /**
468
+ * Render the form fields
469
+ *
470
+ * @param $fields
471
+ * @param $errors
472
+ */
473
+ function render_form_fields( $fields, $errors = array() ){
474
+
475
+ $field_ids = array();
476
+
477
+ foreach( $fields as $i => $field ) {
478
+ if( empty( $field['type'] ) ) continue;
479
+
480
+ $field_name = $this->name_from_label( !empty($field['label']) ? $field['label'] : $i, $field_ids );
481
+ $field_id = 'sow-contact-form-field-' . $field_name;
482
+
483
+ $value = '';
484
+ if( !empty($_POST[$field_name]) ) {
485
+ $value = stripslashes_deep( $_POST[$field_name] );
486
+ }
487
+
488
+ ?><div class="sow-form-field sow-form-field-<?php echo sanitize_html_class( $field['type'] ) ?>"><?php
489
+ if( !empty($field['label']) ) {
490
+ ?><label for="<?php echo esc_attr( $field_id ) ?>"><strong><?php echo esc_html( $field['label'] ) ?></strong></label> <?php
491
+ }
492
+
493
+ if( !empty($errors[$field_name]) ) {
494
+ ?>
495
+ <div class="sow-error">
496
+ <?php echo wp_kses_post( $errors[$field_name] ) ?>
497
+ </div>
498
+ <?php
499
+ }
500
+
501
+ switch( $field['type'] ) {
502
+ case 'email':
503
+ case 'text':
504
+ echo '<input type="' . $field['type'] . '" name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" value="' . esc_attr($value) . '" class="sow-text-field" />';
505
+ break;
506
+
507
+ case 'select':
508
+ echo '<select name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '">';
509
+ if( !empty($field['options']) ) {
510
+ foreach( $field['options'] as $option ) {
511
+ echo '<option value="' . esc_attr( $option['value'] ) . '" ' . selected( $option['value'], $value, false ) . '>' . esc_html($option['value']) . '</option>';
512
+ }
513
+ }
514
+ echo '</select>';
515
+ break;
516
+
517
+ case 'checkboxes':
518
+ if( !empty($field['options']) ) {
519
+ if( empty($value) || !is_array( $value ) ) {
520
+ $value = array();
521
+ }
522
+
523
+ echo '<ul>';
524
+ foreach ( $field['options'] as $i => $option ) {
525
+ echo '<li>';
526
+ echo '<label>';
527
+ echo '<input type="checkbox" value="' . esc_attr($option['value']) . '" name="' . esc_attr( $field_name ) . '[]" id="' . esc_attr( $field_id ) . '-' . $i . '" ' . checked( in_array($option['value'], $value) , true, false) . ' /> ';
528
+ echo esc_html( $option['value'] );
529
+ echo '</li>';
530
+ }
531
+ echo '</ul>';
532
+ }
533
+ break;
534
+
535
+ case 'textarea':
536
+ echo '<textarea name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" rows="10">' . esc_textarea($value) . '</textarea>';
537
+ break;
538
+
539
+ case 'subject':
540
+ case 'name':
541
+ default:
542
+ echo '<input type="text" name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_id ) . '" value="' . esc_attr($value) . '" class="sow-text-field" />';
543
+ break;
544
+
545
+ }
546
+
547
+ ?></div><?php
548
+ }
549
+ }
550
+
551
+ /**
552
+ * Ajax action handler to send the form
553
+ */
554
+ function contact_form_action( $instance, $storage_hash ){
555
+ if( empty($_POST['instance_hash']) || $_POST['instance_hash'] != $storage_hash ) return false;
556
+ if( empty($instance['fields']) ) {
557
+ array(
558
+ 'status' => null,
559
+ );
560
+ }
561
+
562
+ $errors = array();
563
+ $email_fields = array();
564
+ $post_vars = stripslashes_deep( $_POST );
565
+
566
+ $field_ids = array();
567
+ foreach( $instance['fields'] as $i => $field ) {
568
+ if( empty( $field['type'] ) ) continue;
569
+ $field_name = $this->name_from_label( !empty($field['label']) ? $field['label'] : $i, $field_ids );
570
+ $value = !empty( $post_vars[$field_name] ) ? $post_vars[$field_name] : '';
571
+
572
+ if( $field['required']['required'] && empty($value) ) {
573
+ $errors[$field_name] = !empty($field['required']['missing_message']) ? $field['required']['missing_message'] : __('Required field', 'so-widgets-bundle');
574
+ continue;
575
+ }
576
+
577
+ switch( $field['type'] ) {
578
+ case 'email':
579
+ if( $value != sanitize_email($value) ) {
580
+ $errors[$field_name] = __('Invalid email address.', 'so-widgets-bundle');
581
+ }
582
+ break;
583
+ }
584
+
585
+ if( in_array( $field['type'], array( 'email', 'name', 'subject' ) ) ) {
586
+ $email_fields[$field['type']] = $value;
587
+ }
588
+ else {
589
+ if( empty($email_fields['message']) ) $email_fields['message'] = array();
590
+
591
+ switch( $field['type'] ) {
592
+ case 'checkboxes':
593
+ $email_fields['message'][] = array(
594
+ 'label' => $field['label'],
595
+ 'value' => implode(', ', $value),
596
+ );
597
+ break;
598
+
599
+ default:
600
+ $email_fields['message'][] = array(
601
+ 'label' => $field['label'],
602
+ 'value' => $value,
603
+ );
604
+ break;
605
+ }
606
+ }
607
+ }
608
+
609
+ // Add in the default subject and subject prefix
610
+ if( empty($email_fields['subject']) && !empty($instance['settings']['default_subject']) ) {
611
+ $email_fields['subject'] = $instance['settings']['default_subject'];
612
+ }
613
+ if( !empty($instance['settings']['subject_prefix']) ) {
614
+ $email_fields['subject'] = $instance['settings']['subject_prefix'] . ' ' . $email_fields['subject'];
615
+ }
616
+
617
+ // Now we do some email message validation
618
+ if( empty($errors) ) {
619
+ $email_errors = $this->validate_mail( $email_fields );
620
+ if( !empty($email_errors) ) {
621
+ $errors['_general'] = $email_errors;
622
+ }
623
+ }
624
+
625
+ // And if we get this far, do some spam filtering and Captcha checking
626
+ if( empty($errors) ) {
627
+ $spam_errors = $this->spam_check( $post_vars, $email_fields, $instance );
628
+ if( !empty($spam_errors) ) {
629
+ // Now we can decide how we want to handle this spam status
630
+ if( !empty($spam_errors['akismet']) && $instance['spam']['akismet']['spam_action'] == 'tag' ) {
631
+ unset($spam_errors['akismet']);
632
+ $email_fields['subject'] = '[spam] ' . $email_fields['subject'];
633
+ }
634
+ }
635
+
636
+ if( !empty($spam_errors) ) {
637
+ $errors['_general'] = $spam_errors;
638
+ }
639
+ }
640
+
641
+ if( empty($errors) ) {
642
+ // We can send the email
643
+ if( !$this->send_mail( $email_fields, $instance ) ) {
644
+ $errors['_general']['send'] = __('Error sending email, please try again later.', 'so-widgets-bundle');
645
+ }
646
+ }
647
+
648
+ return array(
649
+ 'status' => empty($errors) ? 'success' : 'fail',
650
+ 'errors' => $errors
651
+ );
652
+ }
653
+
654
+ /**
655
+ * Validate fields of an email message
656
+ */
657
+ function validate_mail( $email_fields ){
658
+ $errors = array();
659
+ if( empty($email_fields['email']) ) {
660
+ $errors['email'] = __('A valid email is required', 'so-widgets-bundle');
661
+ }
662
+ elseif( function_exists('filter_var') && !filter_var($email_fields['email'], FILTER_VALIDATE_EMAIL) ) {
663
+ $errors['email'] = __('The email address is invalid', 'so-widgets-bundle');
664
+ }
665
+
666
+ if( empty($email_fields['subject']) ) {
667
+ $errors['subject'] = __('Missing subject', 'so-widgets-bundle');
668
+ }
669
+
670
+ return $errors;
671
+ }
672
+
673
+ /**
674
+ * Check the email for spam
675
+ *
676
+ * @param $email_fields
677
+ * @param $instance
678
+ *
679
+ * @return array
680
+ */
681
+ function spam_check( $post_vars, $email_fields, $instance ){
682
+ $errors = array();
683
+
684
+ if( $instance['spam']['recaptcha']['use_captcha'] ) {
685
+ $result = wp_remote_post(
686
+ 'https://www.google.com/recaptcha/api/siteverify',
687
+ array(
688
+ 'body' => array(
689
+ 'secret' => $instance['spam']['recaptcha']['secret_key'],
690
+ 'response' => $post_vars['g-recaptcha-response'],
691
+ 'remoteip' => isset( $_SERVER['REMOTE_ADDR'] ) ? $_SERVER['REMOTE_ADDR'] : null,
692
+ )
693
+ )
694
+ );
695
+
696
+ if( !is_wp_error($result) && !empty($result['body']) ) {
697
+ $result = json_decode( $result['body'], true );
698
+ if( isset($result['success']) && !$result['success'] ) {
699
+ $errors['recaptcha'] = __('Error validating your Captcha response.', 'so-widgets-bundle');
700
+ }
701
+ }
702
+ }
703
+
704
+ if( $instance['spam']['akismet']['use_akismet'] && class_exists( 'Akismet' ) ) {
705
+ $comment = array();
706
+
707
+ $message_text = array();
708
+ foreach($email_fields['message'] as $m) {
709
+ $message_text[] = $m['value'];
710
+ }
711
+
712
+ $comment['comment_text'] = $email_fields['subject'] . "\n\n" . implode("\n\n", $message_text);
713
+ $comment['comment_author'] = !empty($email_fields['name']) ? $email_fields['name'] : '';
714
+ $comment['comment_author_email'] = $email_fields['email'];
715
+ $comment['comment_post_ID'] = get_the_ID();
716
+
717
+ $comment['comment_type'] = 'contact-form';
718
+
719
+ $comment['user_ip'] = isset( $_SERVER['REMOTE_ADDR'] ) ? $_SERVER['REMOTE_ADDR'] : null;
720
+ $comment['user_agent'] = isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : null;
721
+ $comment['referrer'] = isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : null;
722
+ $comment['blog'] = get_option('home');
723
+ $comment['blog_lang'] = get_locale();
724
+ $comment['blog_charset'] = get_option('blog_charset');
725
+
726
+ // Pretend to check with Akismet
727
+ $response = Akismet::http_post( Akismet::build_query( $comment ), 'comment-check' );
728
+ $is_spam = !empty($response[1]) && $response[1] == 'true';
729
+
730
+ if( $is_spam ) {
731
+ $errors['akismet'] = __('Unfortunately our system identified your message as spam.', 'so-widgets-bundle');
732
+ }
733
+ }
734
+
735
+ return $errors;
736
+ }
737
+
738
+ function send_mail( $email_fields, $instance ){
739
+ $body = '<strong>From:</strong> ' . $email_fields['name'] . ' <' . sanitize_email( $email_fields['email'] ) . ">\n\n";
740
+ foreach( $email_fields['message'] as $m ) {
741
+ $body .= '<strong>' . $m['label'] . ':</strong>';
742
+ $body .= "\n";
743
+ $body .= $m['value'];
744
+ $body .= "\n\n";
745
+ }
746
+ $body = wpautop( trim($body) );
747
+
748
+ $headers = array(
749
+ 'Content-Type: text/html; charset=UTF-8',
750
+ 'From: ' . $email_fields['name'] . ' <' . sanitize_email( $email_fields['email'] ) . '>'
751
+ );
752
+
753
+ return wp_mail( $instance['settings']['to'], $email_fields['subject'], $body, $headers );
754
+ }
755
+
756
+ }
757
+ siteorigin_widget_register( 'sow-contact-form', __FILE__, 'SiteOrigin_Widgets_ContactForm_Widget' );
widgets/so-contact-widget/styles/default.less ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @import "../../../base/less/mixins";
2
+
3
+ .sow-form-field {
4
+ display: block;
5
+ margin-bottom: 1em;
6
+ .clearfix();
7
+
8
+ label {
9
+ display: block;
10
+ margin-bottom: 5px;
11
+
12
+ strong {
13
+ font-weight: bold;
14
+ }
15
+ }
16
+
17
+ textarea,
18
+ input.sow-text-field, {
19
+ .box-sizing(border-box);
20
+ display: block;
21
+ width: 100%;
22
+ border-radius: 0;
23
+ }
24
+
25
+ &.sow-form-field-checkboxes {
26
+ ul {
27
+ list-style: none;
28
+ margin: 0;
29
+ padding: 0;
30
+
31
+ li {
32
+ margin: 0;
33
+ }
34
+
35
+ label {
36
+ margin-bottom: 0;
37
+ }
38
+
39
+ input {
40
+ float: left;
41
+ margin: 0.4em 0.5em 0 0;
42
+ }
43
+ }
44
+ }
45
+ }
46
+
47
+ .sow-contact-form {
48
+ // Container Background
49
+ @container_background: #f2f2f2;
50
+ @container_padding: 10px;
51
+
52
+ // Container border
53
+ @container_border_color: #c0c0c0;
54
+ @container_border_width: 1px;
55
+ @container_border_style: solid;
56
+
57
+ padding: @container_padding;
58
+ border: @container_border_color @container_border_style @container_border_width;
59
+ background-color: @container_background;
60
+
61
+ .sow-error {
62
+ @error_background: #fce4e5;
63
+ @error_border: #ec666a;
64
+ @error_text: #ec666a;
65
+ @error_padding: 5px;
66
+ @error_margin: 10px;
67
+
68
+ background: @error_background;
69
+ border: 1px solid @error_border;
70
+ color: @error_text;
71
+ border-radius: 2px;
72
+ padding: @error_padding;
73
+ font-size: 0.8em;
74
+ list-style: none;
75
+ margin: 0 0 @error_margin 0;
76
+
77
+ li {
78
+ margin: 0;
79
+ }
80
+ }
81
+
82
+ .sow-submit-wrapper {
83
+
84
+ .sow-submit {
85
+
86
+ }
87
+
88
+ }
89
+
90
+ .sow-submit-styled {
91
+
92
+ @submit_background_color: #eeeeee;
93
+ @submit_background_gradient: 10%;
94
+ @submit_border_color: #989a9c;
95
+ @submit_border_style: solid;
96
+ @submit_border_radius: 3px;
97
+ @submit_text_color: #5a5a5a;
98
+ @submit_weight: 500;
99
+ @submit_padding: 10px;
100
+
101
+ @submit_inset_highlight: 50%;
102
+
103
+ .sow-submit {
104
+ color: @submit_text;
105
+ .gradient(
106
+ lighten(@submit_background_color, @submit_background_gradient),
107
+ darken(@submit_background_color, @submit_background_gradient),
108
+ lighten(@submit_background_color, @submit_background_gradient)
109
+ );
110
+
111
+ border: 1px @submit_border_style @submit_border_color;
112
+ border-radius: @submit_border_radius;
113
+ font-weight: @submit_weight;
114
+ padding: @submit_padding @submit_padding * 2;
115
+ display: inline-block;
116
+
117
+ .sow-submit-box-shadow (@percent) when (@percent > 0%) {
118
+ box-shadow: inset 0 -1px 0 fade( #ffffff, @percent );
119
+ }
120
+
121
+ .sow-submit-box-shadow( @submit_inset_highlight );
122
+ }
123
+
124
+
125
+ }
126
+ }
widgets/so-contact-widget/tpl/default.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $result = $this->contact_form_action( $instance, $instance_hash );
3
+
4
+ // Display the title
5
+ if( $instance['display_title'] ) {
6
+ echo $args['before_title'] . $instance['title'] . $args['after_title'];
7
+ }
8
+
9
+ if( $result['status'] == 'success' ) {
10
+ // Display the success message
11
+ ?>
12
+ <div class="sow-contact-form-success" id="contact-form-<?php echo esc_attr( $instance_hash ) ?>">
13
+ <?php echo wp_kses_post( wpautop( $instance['settings']['success_message'] ) ) ?>
14
+ </div>
15
+ <?php
16
+ }
17
+ else {
18
+ if( $instance['spam']['recaptcha']['use_captcha'] ) {
19
+ wp_enqueue_script('google-recaptcha', 'https://www.google.com/recaptcha/api.js');
20
+ }
21
+ ?>
22
+ <form action="<?php echo add_query_arg( false, false ) ?>#contact-form-<?php echo esc_attr( substr( $instance_hash, 0, 4 ) ) ?>" method="POST" class="sow-contact-form" id="contact-form-<?php echo esc_attr( substr( $instance_hash, 0, 4 ) ) ?>">
23
+
24
+ <?php if( !empty($result['errors']['_general']) ) : ?>
25
+ <ul class="sow-error">
26
+ <?php foreach( $result['errors']['_general'] as $type => $message ) : ?>
27
+ <li><?php echo esc_html( $message ) ?></li>
28
+ <?php endforeach ?>
29
+ </ul>
30
+ <?php endif ?>
31
+
32
+ <?php $this->render_form_fields( $instance['fields'], $result['errors'] ) ?>
33
+ <input type="hidden" name="instance_hash" value="<?php echo esc_attr($instance_hash) ?>" />
34
+
35
+ <?php if( $instance['spam']['recaptcha']['use_captcha'] ) : ?>
36
+ <div class="g-recaptcha" data-sitekey="<?php echo esc_attr( $instance['spam']['recaptcha']['site_key'] ) ?>"></div>
37
+ <?php endif; ?>
38
+
39
+ <div class="sow-submit-wrapper <?php if( $instance['design']['submit']['styled'] ) echo 'sow-submit-styled' ?>">
40
+ <input type="submit" value="<?php echo esc_attr( $instance['settings']['submit_text'] ) ?>" class="sow-submit">
41
+ </div>
42
+ </form>
43
+ <?php
44
+ }
widgets/so-cta-widget/assets/banner.svg CHANGED
@@ -1,31 +1,33 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
4
- <svg version="1.0" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
- width="480px" height="240px" viewBox="0 0 480 240" enable-background="new 0 0 480 240" xml:space="preserve">
6
- <rect id="Call_to_Action" x="-0.001" fill="#1880B6" width="480" height="240"/>
7
- <g>
8
- <path fill="#324249" d="M271.999,96.203V60.467c0-2.266-1.375-4.375-4.321-4.375c-1.172,0-3.733,1.895-4.781,2.709
9
- c-1.406,1.088-17.796,15.707-25.53,21.199h-35.367c-0.258,0-26,0.297-26,26s25.742,26,26,26h10v48c0,2.209,1.789,4,4,4h12
10
- c2.211,0,4-1.791,4-4v-48h5.359l27.492,22.779c1.109,0.79,2.344,1.25,3.469,1.25c1.836,0,3.68-1.23,3.68-4v-36.233
11
- c4.562-0.928,8-4.969,8-9.797S276.562,97.131,271.999,96.203z M227.999,180h-12v-48h12V180z M235.999,128h-34
12
- c-0.898,0-22-0.25-22-22c0-21.672,21.109-21.996,22-22h34V128z M267.968,150.516c0,0.84-0.75,1.183-1.438,0.492l-26.531-22.037
13
- V83.033c4.117-2.918,24.491-20.076,26.179-21.537c0.868-0.748,1.821-0.529,1.821,0.846L267.968,150.516z M271.999,111.631v-11.262
14
- c2.328,0.829,4,3.028,4,5.631C275.999,108.604,274.327,110.803,271.999,111.631z"/>
15
- <path fill="#324249" d="M281.858,119.531c-0.414,0.359-2.297,1.969-1.234,3.406s2.429,0.74,3.484-0.082
16
- c4.391-3.418,7.891-9.752,7.891-16.855c0-7.009-2.812-12.625-7.43-16.455c-0.547-0.456-2.398-1.893-3.695-0.483
17
- c-1.25,1.359,0.648,3.111,0.812,3.26c3.75,3.303,6.312,7.926,6.312,13.678C287.999,111.65,285.562,116.312,281.858,119.531z"/>
18
- <path fill="#324249" d="M283.249,74.688c-0.469-0.192-2.195-1-2.945,0.812c-0.68,1.654,1.164,2.809,1.375,2.895
19
- c10.969,4.461,18.32,15.033,18.32,27.605c0,12.486-7.641,23.166-18.493,27.676c-0.241,0.099-1.952,0.949-1.202,2.949
20
- c0.633,1.676,2.336,0.949,2.867,0.725c12.234-5.146,20.828-17.242,20.828-31.35C303.999,91.779,295.647,79.76,283.249,74.688z"/>
21
- </g>
22
- <g>
23
- <path fill="#8ED9EF" d="M179.999,106c0,21.75,21.102,22,22,22h34V84h-34C201.108,84.004,179.999,84.328,179.999,106z"/>
24
- <path fill="#8ED9EF" d="M266.178,61.496c-1.688,1.461-22.062,18.619-26.179,21.537v45.938l26.531,22.037
25
- c0.688,0.691,1.438,0.348,1.438-0.492l0.031-88.174C267.999,60.967,267.046,60.748,266.178,61.496z"/>
26
- </g>
27
- <g>
28
- <rect x="215.999" y="132" fill="#F2F0DA" width="12" height="48"/>
29
- <path fill="#F2F0DA" d="M271.999,100.369v11.262c2.328-0.828,4-3.027,4-5.631C275.999,103.397,274.327,101.197,271.999,100.369z"/>
30
- </g>
31
- </svg>
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="55 277 240 240" style="enable-background:new 55 277 240 240;" xml:space="preserve">
5
+ <style type="text/css">
6
+ .st0{fill:#1880B6;}
7
+ .st1{fill:#324249;}
8
+ .st2{fill:#8ED9EF;}
9
+ .st3{fill:#F2F0DA;}
10
+ </style>
11
+ <rect id="Call_to_Action" x="55" y="277" class="st0" width="240" height="240"/>
12
+ <g>
13
+ <path class="st1" d="M207,373.2v-35.7c0-2.3-1.4-4.4-4.3-4.4c-1.2,0-3.7,1.9-4.8,2.7c-1.4,1.1-17.8,15.7-25.5,21.2H137
14
+ c-0.3,0-26,0.3-26,26s25.7,26,26,26h10v48c0,2.2,1.8,4,4,4h12c2.2,0,4-1.8,4-4v-48h5.4l27.5,22.8c1.1,0.8,2.3,1.2,3.5,1.2
15
+ c1.8,0,3.7-1.2,3.7-4v-36.2c4.6-0.9,8-5,8-9.8S211.6,374.1,207,373.2z M163,457h-12v-48h12V457z M171,405h-34c-0.9,0-22-0.2-22-22
16
+ c0-21.7,21.1-22,22-22h34V405z M203,427.5c0,0.8-0.8,1.2-1.4,0.5L175,406V360c4.1-2.9,24.5-20.1,26.2-21.5c0.9-0.7,1.8-0.5,1.8,0.8
17
+ L203,427.5z M207,388.6v-11.3c2.3,0.8,4,3,4,5.6C211,385.6,209.3,387.8,207,388.6z"/>
18
+ <path class="st1" d="M216.9,396.5c-0.4,0.4-2.3,2-1.2,3.4c1.1,1.4,2.4,0.7,3.5-0.1c4.4-3.4,7.9-9.8,7.9-16.9c0-7-2.8-12.6-7.4-16.5
19
+ c-0.5-0.5-2.4-1.9-3.7-0.5c-1.2,1.4,0.6,3.1,0.8,3.3c3.8,3.3,6.3,7.9,6.3,13.7C223,388.6,220.6,393.3,216.9,396.5z"/>
20
+ <path class="st1" d="M218.2,351.7c-0.5-0.2-2.2-1-2.9,0.8c-0.7,1.7,1.2,2.8,1.4,2.9c11,4.5,18.3,15,18.3,27.6
21
+ c0,12.5-7.6,23.2-18.5,27.7c-0.2,0.1-2,0.9-1.2,2.9c0.6,1.7,2.3,0.9,2.9,0.7c12.2-5.1,20.8-17.2,20.8-31.4
22
+ C239,368.8,230.6,356.8,218.2,351.7z"/>
23
+ </g>
24
+ <g>
25
+ <path class="st2" d="M115,383c0,21.8,21.1,22,22,22h34v-44h-34C136.1,361,115,361.3,115,383z"/>
26
+ <path class="st2" d="M201.2,338.5c-1.7,1.5-22.1,18.6-26.2,21.5V406l26.5,22c0.7,0.7,1.4,0.3,1.4-0.5l0-88.2
27
+ C203,338,202,337.7,201.2,338.5z"/>
28
+ </g>
29
+ <g>
30
+ <rect x="151" y="409" class="st3" width="12" height="48"/>
31
+ <path class="st3" d="M207,377.4v11.3c2.3-0.8,4-3,4-5.6C211,380.4,209.3,378.2,207,377.4z"/>
32
+ </g>
33
+ </svg>
widgets/so-cta-widget/so-cta-widget.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /*
3
- Widget Name: Call-to-action widget
4
  Description: A simple call-to-action widget. You can do what ever you want with a call-to-action widget.
5
- Author: Greg Priday
6
- Author URI: http://siteorigin.com
7
  */
8
 
9
  class SiteOrigin_Widget_Cta_widget extends SiteOrigin_Widget {
@@ -12,9 +12,9 @@ class SiteOrigin_Widget_Cta_widget extends SiteOrigin_Widget {
12
 
13
  parent::__construct(
14
  'sow-cta',
15
- __('SiteOrigin Call-to-action', 'siteorigin-widgets'),
16
  array(
17
- 'description' => __('A simple call-to-action widget with massive power.', 'siteorigin-widgets'),
18
  'help' => 'https://siteorigin.com/widgets-bundle/call-action-widget/'
19
  ),
20
  array(
@@ -24,33 +24,33 @@ class SiteOrigin_Widget_Cta_widget extends SiteOrigin_Widget {
24
 
25
  'title' => array(
26
  'type' => 'text',
27
- 'label' => __('Title', 'siteorigin-widgets'),
28
  ),
29
 
30
  'sub_title' => array(
31
  'type' => 'text',
32
- 'label' => __('Subtitle', 'siteorigin-widgets')
33
  ),
34
 
35
  'design' => array(
36
  'type' => 'section',
37
- 'label' => __('Design', 'siteorigin-widgets'),
38
  'fields' => array(
39
  'background_color' => array(
40
  'type' => 'color',
41
- 'label' => __('Background color', 'siteorigin-widgets'),
42
  ),
43
  'border_color' => array(
44
  'type' => 'color',
45
- 'label' => __('Border color', 'siteorigin-widgets'),
46
  ),
47
  'button_align' => array(
48
  'type' => 'select',
49
- 'label' => __( 'Button align', 'siteorigin-widgets' ),
50
  'default' => 'right',
51
  'options' => array(
52
- 'left' => __( 'Left', 'siteorigin-widgets'),
53
- 'right' => __( 'Right', 'siteorigin-widgets'),
54
  )
55
  )
56
  )
@@ -59,7 +59,7 @@ class SiteOrigin_Widget_Cta_widget extends SiteOrigin_Widget {
59
  'button' => array(
60
  'type' => 'widget',
61
  'class' => 'SiteOrigin_Widget_Button_Widget',
62
- 'label' => __('Button', 'siteorigin-widgets'),
63
  ),
64
 
65
  ),
@@ -71,15 +71,15 @@ class SiteOrigin_Widget_Cta_widget extends SiteOrigin_Widget {
71
  * Initialize the CTA widget
72
  */
73
  function initialize(){
 
74
  if( !class_exists('SiteOrigin_Widget_Button_Widget') ) {
75
- include plugin_dir_path( __FILE__ ) . '../so-button-widget/so-button-widget.php';
76
- siteorigin_widget_register( 'button', realpath( plugin_dir_path( __FILE__ ) . '../so-button-widget/so-button-widget.php' ) );
77
  }
78
  $this->register_frontend_styles(
79
  array(
80
  array(
81
  'sow-cta-main',
82
- siteorigin_widget_get_plugin_dir_url( 'cta' ) . 'css/style.css',
83
  array(),
84
  SOW_BUNDLE_VERSION
85
  )
@@ -89,7 +89,7 @@ class SiteOrigin_Widget_Cta_widget extends SiteOrigin_Widget {
89
  array(
90
  array(
91
  'sow-cta-main',
92
- siteorigin_widget_get_plugin_dir_url( 'cta' ) . 'js/cta' . SOW_BUNDLE_JS_SUFFIX . '.js',
93
  array( 'jquery' ),
94
  SOW_BUNDLE_VERSION
95
  )
@@ -122,4 +122,4 @@ class SiteOrigin_Widget_Cta_widget extends SiteOrigin_Widget {
122
 
123
  }
124
 
125
- siteorigin_widget_register('cta', __FILE__);
1
  <?php
2
  /*
3
+ Widget Name: Call-To-Action
4
  Description: A simple call-to-action widget. You can do what ever you want with a call-to-action widget.
5
+ Author: SiteOrigin
6
+ Author URI: https://siteorigin.com
7
  */
8
 
9
  class SiteOrigin_Widget_Cta_widget extends SiteOrigin_Widget {
12
 
13
  parent::__construct(
14
  'sow-cta',
15
+ __('SiteOrigin Call-to-action', 'so-widgets-bundle'),
16
  array(
17
+ 'description' => __('A simple call-to-action widget with massive power.', 'so-widgets-bundle'),
18
  'help' => 'https://siteorigin.com/widgets-bundle/call-action-widget/'
19
  ),
20
  array(
24
 
25
  'title' => array(
26
  'type' => 'text',
27
+ 'label' => __('Title', 'so-widgets-bundle'),
28
  ),
29
 
30
  'sub_title' => array(
31
  'type' => 'text',
32
+ 'label' => __('Subtitle', 'so-widgets-bundle')
33
  ),
34
 
35
  'design' => array(
36
  'type' => 'section',
37
+ 'label' => __('Design', 'so-widgets-bundle'),
38
  'fields' => array(
39
  'background_color' => array(
40
  'type' => 'color',
41
+ 'label' => __('Background color', 'so-widgets-bundle'),
42
  ),
43
  'border_color' => array(
44
  'type' => 'color',
45
+ 'label' => __('Border color', 'so-widgets-bundle'),
46
  ),
47
  'button_align' => array(
48
  'type' => 'select',
49
+ 'label' => __( 'Button align', 'so-widgets-bundle' ),
50
  'default' => 'right',
51
  'options' => array(
52
+ 'left' => __( 'Left', 'so-widgets-bundle'),
53
+ 'right' => __( 'Right', 'so-widgets-bundle'),
54
  )
55
  )
56
  )
59
  'button' => array(
60
  'type' => 'widget',
61
  'class' => 'SiteOrigin_Widget_Button_Widget',
62
+ 'label' => __('Button', 'so-widgets-bundle'),
63
  ),
64
 
65
  ),
71
  * Initialize the CTA widget
72
  */
73
  function initialize(){
74
+ // This widget requires the button widget
75
  if( !class_exists('SiteOrigin_Widget_Button_Widget') ) {
76
+ SiteOrigin_Widgets_Bundle::single()->include_widget( 'so-button-widget' );
 
77
  }
78
  $this->register_frontend_styles(
79
  array(
80
  array(
81
  'sow-cta-main',
82
+ plugin_dir_url(__FILE__) . 'css/style.css',
83
  array(),
84
  SOW_BUNDLE_VERSION
85
  )
89
  array(
90
  array(
91
  'sow-cta-main',
92
+ plugin_dir_url(__FILE__) . 'js/cta' . SOW_BUNDLE_JS_SUFFIX . '.js',
93
  array( 'jquery' ),
94
  SOW_BUNDLE_VERSION
95
  )
122
 
123
  }
124
 
125
+ siteorigin_widget_register('sow-cta', __FILE__, 'SiteOrigin_Widget_Cta_widget');
widgets/so-editor-widget/assets/banner.svg CHANGED
@@ -1,32 +1,32 @@
1
  <?xml version="1.0" encoding="utf-8"?>
2
- <!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
  <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
- viewBox="-65 277 480 240" style="enable-background:new -65 277 480 240;" xml:space="preserve">
5
  <style type="text/css">
6
  .st0{fill:#1880B6;}
7
  .st1{fill:#F2F0DA;}
8
  .st2{opacity:0.2;}
9
  .st3{fill:#324249;}
10
  </style>
11
- <rect id="Call_to_Action_2_" x="-65" y="277" class="st0" width="480" height="240"/>
12
  <g>
13
  <g>
14
  <path class="st1" d="M219,337h-88c-2.2,0-4,1.8-4,4v112c0,2.2,1.8,4,4,4h88c2.2,0,4-1.8,4-4v-84v-28C223,338.8,221.2,337,219,337z
15
  "/>
16
  </g>
17
  <g class="st2">
18
- <path d="M145,361h24c1.1,0,2-0.9,2-2s-0.9-2-2-2h-24c-1.1,0-2,0.9-2,2C143,360.1,143.9,361,145,361z"/>
19
  <path d="M145,413h32c1.1,0,2-0.9,2-2s-0.9-2-2-2h-32c-1.1,0-2,0.9-2,2S143.9,413,145,413z"/>
20
  <path d="M185,413h20c1.1,0,2-0.9,2-2s-0.9-2-2-2h-20c-1.1,0-2,0.9-2,2S183.9,413,185,413z"/>
21
- <path d="M145,377h32c1.1,0,2-0.9,2-2s-0.9-2-2-2h-32c-1.1,0-2,0.9-2,2C143,376.1,143.9,377,145,377z"/>
22
- <path d="M185,377h20c1.1,0,2-0.9,2-2s-0.9-2-2-2h-20c-1.1,0-2,0.9-2,2C183,376.1,183.9,377,185,377z"/>
23
  <path d="M205,433h-36c-1.1,0-2,0.9-2,2s0.9,2,2,2h36c1.1,0,2-0.9,2-2S206.1,433,205,433z"/>
24
  <path d="M161,433h-16c-1.1,0-2,0.9-2,2s0.9,2,2,2h16c1.1,0,2-0.9,2-2S162.1,433,161,433z"/>
25
  <path d="M145,425h8c1.1,0,2-0.9,2-2s-0.9-2-2-2h-8c-1.1,0-2,0.9-2,2S143.9,425,145,425z"/>
26
  <path d="M161,421c-1.1,0-2,0.9-2,2s0.9,2,2,2h12c1.1,0,2-0.9,2-2s-0.9-2-2-2H161z"/>
27
  <path d="M205,421h-24c-1.1,0-2,0.9-2,2s0.9,2,2,2h24c1.1,0,2-0.9,2-2S206.1,421,205,421z"/>
28
- <path d="M205,397h-36c-1.1,0-2,0.9-2,2c0,1.1,0.9,2,2,2h36c1.1,0,2-0.9,2-2C207,397.9,206.1,397,205,397z"/>
29
- <path d="M161,397h-16c-1.1,0-2,0.9-2,2c0,1.1,0.9,2,2,2h16c1.1,0,2-0.9,2-2C163,397.9,162.1,397,161,397z"/>
30
  <path d="M145,389h8c1.1,0,2-0.9,2-2s-0.9-2-2-2h-8c-1.1,0-2,0.9-2,2S143.9,389,145,389z"/>
31
  <path d="M161,385c-1.1,0-2,0.9-2,2s0.9,2,2,2h12c1.1,0,2-0.9,2-2s-0.9-2-2-2H161z"/>
32
  <path d="M205,385h-24c-1.1,0-2,0.9-2,2s0.9,2,2,2h24c1.1,0,2-0.9,2-2S206.1,385,205,385z"/>
1
  <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
  <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="55 277 240 240" style="enable-background:new 55 277 240 240;" xml:space="preserve">
5
  <style type="text/css">
6
  .st0{fill:#1880B6;}
7
  .st1{fill:#F2F0DA;}
8
  .st2{opacity:0.2;}
9
  .st3{fill:#324249;}
10
  </style>
11
+ <rect id="Call_to_Action_2_" x="55" y="277" class="st0" width="240" height="240"/>
12
  <g>
13
  <g>
14
  <path class="st1" d="M219,337h-88c-2.2,0-4,1.8-4,4v112c0,2.2,1.8,4,4,4h88c2.2,0,4-1.8,4-4v-84v-28C223,338.8,221.2,337,219,337z
15
  "/>
16
  </g>
17
  <g class="st2">
18
+ <path d="M145,361h24c1.1,0,2-0.9,2-2s-0.9-2-2-2h-24c-1.1,0-2,0.9-2,2S143.9,361,145,361z"/>
19
  <path d="M145,413h32c1.1,0,2-0.9,2-2s-0.9-2-2-2h-32c-1.1,0-2,0.9-2,2S143.9,413,145,413z"/>
20
  <path d="M185,413h20c1.1,0,2-0.9,2-2s-0.9-2-2-2h-20c-1.1,0-2,0.9-2,2S183.9,413,185,413z"/>
21
+ <path d="M145,377h32c1.1,0,2-0.9,2-2s-0.9-2-2-2h-32c-1.1,0-2,0.9-2,2S143.9,377,145,377z"/>
22
+ <path d="M185,377h20c1.1,0,2-0.9,2-2s-0.9-2-2-2h-20c-1.1,0-2,0.9-2,2S183.9,377,185,377z"/>
23
  <path d="M205,433h-36c-1.1,0-2,0.9-2,2s0.9,2,2,2h36c1.1,0,2-0.9,2-2S206.1,433,205,433z"/>
24
  <path d="M161,433h-16c-1.1,0-2,0.9-2,2s0.9,2,2,2h16c1.1,0,2-0.9,2-2S162.1,433,161,433z"/>
25
  <path d="M145,425h8c1.1,0,2-0.9,2-2s-0.9-2-2-2h-8c-1.1,0-2,0.9-2,2S143.9,425,145,425z"/>
26
  <path d="M161,421c-1.1,0-2,0.9-2,2s0.9,2,2,2h12c1.1,0,2-0.9,2-2s-0.9-2-2-2H161z"/>
27
  <path d="M205,421h-24c-1.1,0-2,0.9-2,2s0.9,2,2,2h24c1.1,0,2-0.9,2-2S206.1,421,205,421z"/>
28
+ <path d="M205,397h-36c-1.1,0-2,0.9-2,2s0.9,2,2,2h36c1.1,0,2-0.9,2-2S206.1,397,205,397z"/>
29
+ <path d="M161,397h-16c-1.1,0-2,0.9-2,2s0.9,2,2,2h16c1.1,0,2-0.9,2-2S162.1,397,161,397z"/>
30
  <path d="M145,389h8c1.1,0,2-0.9,2-2s-0.9-2-2-2h-8c-1.1,0-2,0.9-2,2S143.9,389,145,389z"/>
31
  <path d="M161,385c-1.1,0-2,0.9-2,2s0.9,2,2,2h12c1.1,0,2-0.9,2-2s-0.9-2-2-2H161z"/>
32
  <path d="M205,385h-24c-1.1,0-2,0.9-2,2s0.9,2,2,2h24c1.1,0,2-0.9,2-2S206.1,385,205,385z"/>
widgets/so-editor-widget/so-editor-widget.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
 
3
  /*
4
- Widget Name: Editor Widget
5
  Description: A widget which allows editing of content using the TinyMCE editor.
6
  Author: SiteOrigin
7
  Author URI: https://siteorigin.com
@@ -13,16 +13,16 @@ class SiteOrigin_Widget_Editor_Widget extends SiteOrigin_Widget {
13
 
14
  parent::__construct(
15
  'sow-editor',
16
- __('SiteOrigin Editor', 'siteorigin-widgets'),
17
  array(
18
- 'description' => __('A rich-text, text editor.', 'siteorigin-widgets'),
19
  'help' => 'https://siteorigin.com/widgets-bundle/editor-widget/'
20
  ),
21
  array(),
22
  array(
23
  'title' => array(
24
  'type' => 'text',
25
- 'label' => __('Title', 'siteorigin-widgets'),
26
  ),
27
  'text' => array(
28
  'type' => 'tinymce',
@@ -31,7 +31,7 @@ class SiteOrigin_Widget_Editor_Widget extends SiteOrigin_Widget {
31
  'autop' => array(
32
  'type' => 'checkbox',
33
  'default' => true,
34
- 'label' => __('Automatically add paragraphs', 'siteorigin-widgets'),
35
  ),
36
  ),
37
  plugin_dir_path(__FILE__)
@@ -54,7 +54,13 @@ class SiteOrigin_Widget_Editor_Widget extends SiteOrigin_Widget {
54
  );
55
 
56
  $instance['text'] = $this->unwpautop( $instance['text'] );
57
- $instance['text'] = wp_kses_post( $instance['text'] );
 
 
 
 
 
 
58
  $instance['text'] = apply_filters( 'widget_text', $instance['text'] );
59
 
60
  // Run some known stuff
@@ -77,8 +83,9 @@ class SiteOrigin_Widget_Editor_Widget extends SiteOrigin_Widget {
77
  }
78
 
79
  function get_style_name($instance) {
80
- return '';
 
81
  }
82
  }
83
 
84
- siteorigin_widget_register( 'editor', __FILE__ );
1
  <?php
2
 
3
  /*
4
+ Widget Name: Editor
5
  Description: A widget which allows editing of content using the TinyMCE editor.
6
  Author: SiteOrigin
7
  Author URI: https://siteorigin.com
13
 
14
  parent::__construct(
15
  'sow-editor',
16
+ __('SiteOrigin Editor', 'so-widgets-bundle'),
17
  array(
18
+ 'description' => __('A rich-text, text editor.', 'so-widgets-bundle'),
19
  'help' => 'https://siteorigin.com/widgets-bundle/editor-widget/'
20
  ),
21
  array(),
22
  array(
23
  'title' => array(
24
  'type' => 'text',
25
+ 'label' => __('Title', 'so-widgets-bundle'),
26
  ),
27
  'text' => array(
28
  'type' => 'tinymce',
31
  'autop' => array(
32
  'type' => 'checkbox',
33
  'default' => true,
34
+ 'label' => __('Automatically add paragraphs', 'so-widgets-bundle'),
35
  ),
36
  ),
37
  plugin_dir_path(__FILE__)
54
  );
55
 
56
  $instance['text'] = $this->unwpautop( $instance['text'] );
57
+
58
+ /* @var $field_factory SiteOrigin_Widget_Field_Factory */
59
+ $field_factory = SiteOrigin_Widget_Field_Factory::getInstance();
60
+ $form_options = $this->form_options();
61
+ $field = $field_factory->create_field( $this->id_base, $form_options['text'], $this );
62
+ $instance['text'] = $field->sanitize( $instance['text'] );
63
+
64
  $instance['text'] = apply_filters( 'widget_text', $instance['text'] );
65
 
66
  // Run some known stuff
83
  }
84
 
85
  function get_style_name($instance) {
86
+ // We're not using a style
87
+ return false;
88
  }
89
  }
90
 
91
+ siteorigin_widget_register( 'sow-editor', __FILE__, 'SiteOrigin_Widget_Editor_Widget' );
widgets/so-features-widget/assets/banner.svg CHANGED
@@ -1,57 +1,56 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
4
- <svg version="1.0" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
- width="480px" height="240px" viewBox="0 0 480 240" enable-background="new 0 0 480 240" xml:space="preserve">
6
- <rect id="Button_1_" fill="#1880B6" width="480" height="240"/>
7
- <g>
8
- <path fill="#324249" d="M296,56H184c-4.417,0-8,3.583-8,8v112c0,4.417,3.583,8,8,8h112c4.417,0,8-3.583,8-8V64
9
- C304,59.583,300.417,56,296,56z M248,96C248,87.165,255.165,80,264,80C272.835,80,280,87.165,280,96c0,8.836-7.164,16-15.999,16
10
- h-16V96z M180,64c0-2.209,1.791-4,4-4h48v24.109C228.354,79.214,222.572,76,216,76c-11.045,0-20,8.955-20,20
11
- c0,6.573,3.214,12.354,8.109,16H180V64z M232,96v16h-16C207.165,112,200,104.835,200,96C200,87.165,207.165,80,216,80
12
- C224.835,80,232,87.165,232,96z M232,180h-48c-2.209,0-4-1.791-4-4v-48h24.109c-4.895,3.646-8.109,9.428-8.109,16
13
- c0,11.044,8.955,20,20,20c6.573,0,12.354-3.214,16-8.109V180z M232,144c0,8.835-7.165,16-16,16c-8.835,0-15.999-7.165-15.999-16
14
- c0-8.836,7.164-16,15.999-16h16V144z M300,176c0,2.209-1.791,4-4,4h-48v-24.109c3.646,4.895,9.428,8.109,16,8.109
15
- c11.045,0,20-8.955,20-20c0-6.573-3.214-12.354-8.109-16H300V176z M248,144v-16h16c8.835,0,15.999,7.165,15.999,16
16
- c0,8.835-7.164,16-15.999,16C255.165,160,248,152.835,248,144z M300,124h-56v56h-8v-56h-56v-8h56V60h8v56h56V124z M300,112h-24.109
17
- c4.895-3.646,8.109-9.428,8.109-16c0-11.045-8.955-20-20-20c-6.573,0-12.354,3.214-16,8.109V60h48c2.209,0,4,1.791,4,4V112z"/>
18
- <path fill="#324249" d="M276,96C276,89.373,270.627,84,264,84c-6.627,0-12,5.373-12,11.999v12h12C270.627,108,276,102.627,276,96z
19
- M256,96c0-4.417,3.582-7.999,8-7.999C268.418,88,272,91.582,272,96c0,4.418-3.582,8-7.999,8h-8V96z"/>
20
- <path fill="#324249" d="M216,84C209.373,84,204,89.373,204,96c0,6.627,5.373,12,11.999,12h12V96C228,89.373,222.627,84,216,84z
21
- M224,104h-8c-4.417,0-7.999-3.582-7.999-8C208,91.582,211.582,88,216,88c4.418,0,8,3.582,8,7.999V104z"/>
22
- <path fill="#324249" d="M204,144C204,150.627,209.373,156,216,156c6.627,0,12-5.373,12-11.999v-12h-12
23
- C209.373,132,204,137.373,204,144z M224,144c0,4.417-3.582,7.999-8,7.999C211.582,152,208,148.418,208,144c0-4.418,3.582-8,7.999-8
24
- h8V144z"/>
25
- <path fill="#324249" d="M264,156C270.627,156,276,150.627,276,144c0-6.627-5.373-12-11.999-12h-12v12
26
- C252,150.627,257.373,156,264,156z M256,136h8c4.417,0,7.999,3.582,7.999,8c0,4.417-3.582,7.999-7.999,7.999
27
- c-4.418,0-8-3.582-8-7.999V136z"/>
28
- </g>
29
- <g>
30
- <path fill="#8ED9EF" d="M180,64v48h24.109c-4.895-3.646-8.109-9.428-8.109-16c0-11.045,8.955-20,20-20
31
- c6.573,0,12.354,3.214,16,8.109V60h-48C181.791,60,180,61.791,180,64z"/>
32
- <path fill="#8ED9EF" d="M216,164c-11.045,0-20-8.955-20-20c0-6.573,3.214-12.354,8.109-16H180v48c0,2.209,1.791,4,4,4h48v-24.109
33
- C228.354,160.786,222.572,164,216,164z"/>
34
- <path fill="#8ED9EF" d="M284,144c0,11.044-8.955,20-20,20c-6.573,0-12.354-3.214-16-8.109V180h48c2.209,0,4-1.791,4-4v-48h-24.109
35
- C280.786,131.646,284,137.428,284,144z"/>
36
- <path fill="#8ED9EF" d="M296,60h-48v24.109c3.646-4.895,9.428-8.109,16-8.109c11.045,0,20,8.955,20,20
37
- c0,6.573-3.214,12.354-8.109,16H300V64C300,61.791,298.209,60,296,60z"/>
38
- <path fill="#8ED9EF" d="M272,96C272,91.582,268.418,88,264,88c-4.418,0-8,3.582-8,7.999v8h8C268.418,104,272,100.418,272,96z"/>
39
- <path fill="#8ED9EF" d="M216,104h8v-8c0-4.417-3.582-7.999-8-7.999C211.582,88,208,91.582,208,96C208,100.418,211.582,104,216,104z
40
- "/>
41
- <path fill="#8ED9EF" d="M216,152c4.418,0,8-3.582,8-7.999v-8h-8c-4.417,0-7.999,3.582-7.999,8C208,148.418,211.582,152,216,152z"/>
42
- <path fill="#8ED9EF" d="M256,144c0,4.417,3.582,7.999,8,7.999c4.417,0,7.999-3.582,7.999-7.999c0-4.418-3.582-8-7.999-8h-8V144z"/>
43
- </g>
44
- <g>
45
- <path fill="#F2F0DA" d="M280,96C280,87.165,272.835,80,264,80c-8.836,0-16,7.164-16,15.999v16h16C272.835,112,280,104.835,280,96z
46
- M252,96C252,89.373,257.373,84,264,84C270.627,84,276,89.373,276,96c0,6.627-5.373,12-11.999,12h-12V96z"/>
47
- <path fill="#F2F0DA" d="M216,112h16V96C232,87.165,224.835,80,216,80C207.165,80,200,87.165,200,96
48
- C200,104.835,207.165,112,216,112z M216,84c6.627,0,12,5.373,12,11.999v12h-12C209.373,108,204,102.627,204,96
49
- C204,89.373,209.373,84,216,84z"/>
50
- <path fill="#F2F0DA" d="M200,144c0,8.835,7.164,16,15.999,16c8.836,0,16-7.165,16-16v-16h-16C207.165,128,200,135.165,200,144z
51
- M228,144c0,6.626-5.373,11.999-12,11.999C209.373,156,204,150.627,204,144c0-6.627,5.373-12,11.999-12h12V144z"/>
52
- <path fill="#F2F0DA" d="M264,128h-16v16c0,8.835,7.165,16,16,16c8.835,0,15.999-7.165,15.999-16C280,135.165,272.835,128,264,128z
53
- M264,156c-6.627,0-12-5.373-12-11.999v-12h12c6.626,0,11.999,5.373,11.999,12C276,150.627,270.627,156,264,156z"/>
54
- <polygon fill="#F2F0DA" points="244,116 244,60 236,60 236,116 180,116 180,124 236,124 236,180 244,180 244,124 300,124 300,116
55
- "/>
56
- </g>
57
- </svg>
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="55 277 240 240" style="enable-background:new 55 277 240 240;" xml:space="preserve">
5
+ <style type="text/css">
6
+ .st0{fill:#1880B6;}
7
+ .st1{fill:#324249;}
8
+ .st2{fill:#8ED9EF;}
9
+ .st3{fill:#F2F0DA;}
10
+ </style>
11
+ <rect id="Button_1_" x="55" y="277" class="st0" width="240" height="240"/>
12
+ <g>
13
+ <path class="st1" d="M231,333H119c-4.4,0-8,3.6-8,8v112c0,4.4,3.6,8,8,8h112c4.4,0,8-3.6,8-8V341C239,336.6,235.4,333,231,333z
14
+ M183,373c0-8.8,7.2-16,16-16c8.8,0,16,7.2,16,16c0,8.8-7.2,16-16,16h-16L183,373L183,373z M115,341c0-2.2,1.8-4,4-4h48v24.1
15
+ c-3.6-4.9-9.4-8.1-16-8.1c-11,0-20,9-20,20c0,6.6,3.2,12.4,8.1,16H115V341z M167,373v16h-16c-8.8,0-16-7.2-16-16s7.2-16,16-16
16
+ S167,364.2,167,373z M167,457h-48c-2.2,0-4-1.8-4-4v-48h24.1c-4.9,3.6-8.1,9.4-8.1,16c0,11,9,20,20,20c6.6,0,12.4-3.2,16-8.1V457z
17
+ M167,421c0,8.8-7.2,16-16,16s-16-7.2-16-16c0-8.8,7.2-16,16-16h16V421z M235,453c0,2.2-1.8,4-4,4h-48v-24.1
18
+ c3.6,4.9,9.4,8.1,16,8.1c11,0,20-9,20-20c0-6.6-3.2-12.4-8.1-16H235V453z M183,421v-16h16c8.8,0,16,7.2,16,16s-7.2,16-16,16
19
+ C190.2,437,183,429.8,183,421z M235,401h-56v56h-8v-56h-56v-8h56v-56h8v56h56V401z M235,389h-24.1c4.9-3.6,8.1-9.4,8.1-16
20
+ c0-11-9-20-20-20c-6.6,0-12.4,3.2-16,8.1V337h48c2.2,0,4,1.8,4,4V389z"/>
21
+ <path class="st1" d="M211,373c0-6.6-5.4-12-12-12s-12,5.4-12,12v12h12C205.6,385,211,379.6,211,373z M191,373c0-4.4,3.6-8,8-8
22
+ c4.4,0,8,3.6,8,8s-3.6,8-8,8h-8L191,373L191,373z"/>
23
+ <path class="st1" d="M151,361c-6.6,0-12,5.4-12,12s5.4,12,12,12h12v-12C163,366.4,157.6,361,151,361z M159,381h-8c-4.4,0-8-3.6-8-8
24
+ c0-4.4,3.6-8,8-8s8,3.6,8,8V381z"/>
25
+ <path class="st1" d="M139,421c0,6.6,5.4,12,12,12s12-5.4,12-12v-12h-12C144.4,409,139,414.4,139,421z M159,421c0,4.4-3.6,8-8,8
26
+ c-4.4,0-8-3.6-8-8s3.6-8,8-8h8L159,421L159,421z"/>
27
+ <path class="st1" d="M199,433c6.6,0,12-5.4,12-12s-5.4-12-12-12h-12v12C187,427.6,192.4,433,199,433z M191,413h8c4.4,0,8,3.6,8,8
28
+ c0,4.4-3.6,8-8,8c-4.4,0-8-3.6-8-8V413z"/>
29
+ </g>
30
+ <g>
31
+ <path class="st2" d="M115,341v48h24.1c-4.9-3.6-8.1-9.4-8.1-16c0-11,9-20,20-20c6.6,0,12.4,3.2,16,8.1V337h-48
32
+ C116.8,337,115,338.8,115,341z"/>
33
+ <path class="st2" d="M151,441c-11,0-20-9-20-20c0-6.6,3.2-12.4,8.1-16H115v48c0,2.2,1.8,4,4,4h48v-24.1
34
+ C163.4,437.8,157.6,441,151,441z"/>
35
+ <path class="st2" d="M219,421c0,11-9,20-20,20c-6.6,0-12.4-3.2-16-8.1V457h48c2.2,0,4-1.8,4-4v-48h-24.1
36
+ C215.8,408.6,219,414.4,219,421z"/>
37
+ <path class="st2" d="M231,337h-48v24.1c3.6-4.9,9.4-8.1,16-8.1c11,0,20,9,20,20c0,6.6-3.2,12.4-8.1,16H235v-48
38
+ C235,338.8,233.2,337,231,337z"/>
39
+ <path class="st2" d="M207,373c0-4.4-3.6-8-8-8s-8,3.6-8,8v8h8C203.4,381,207,377.4,207,373z"/>
40
+ <path class="st2" d="M151,381h8v-8c0-4.4-3.6-8-8-8c-4.4,0-8,3.6-8,8S146.6,381,151,381z"/>
41
+ <path class="st2" d="M151,429c4.4,0,8-3.6,8-8v-8h-8c-4.4,0-8,3.6-8,8C143,425.4,146.6,429,151,429z"/>
42
+ <path class="st2" d="M191,421c0,4.4,3.6,8,8,8c4.4,0,8-3.6,8-8c0-4.4-3.6-8-8-8h-8V421z"/>
43
+ </g>
44
+ <g>
45
+ <path class="st3" d="M215,373c0-8.8-7.2-16-16-16c-8.8,0-16,7.2-16,16v16h16C207.8,389,215,381.8,215,373z M187,373
46
+ c0-6.6,5.4-12,12-12s12,5.4,12,12s-5.4,12-12,12h-12L187,373L187,373z"/>
47
+ <path class="st3" d="M151,389h16v-16c0-8.8-7.2-16-16-16s-16,7.2-16,16S142.2,389,151,389z M151,361c6.6,0,12,5.4,12,12v12h-12
48
+ c-6.6,0-12-5.4-12-12S144.4,361,151,361z"/>
49
+ <path class="st3" d="M135,421c0,8.8,7.2,16,16,16c8.8,0,16-7.2,16-16v-16h-16C142.2,405,135,412.2,135,421z M163,421
50
+ c0,6.6-5.4,12-12,12c-6.6,0-12-5.4-12-12s5.4-12,12-12h12L163,421L163,421z"/>
51
+ <path class="st3" d="M199,405h-16v16c0,8.8,7.2,16,16,16c8.8,0,16-7.2,16-16C215,412.2,207.8,405,199,405z M199,433
52
+ c-6.6,0-12-5.4-12-12v-12h12c6.6,0,12,5.4,12,12C211,427.6,205.6,433,199,433z"/>
53
+ <polygon class="st3" points="179,393 179,337 171,337 171,393 115,393 115,401 171,401 171,457 179,457 179,401 235,401 235,393
54
+ "/>
55
+ </g>
56
+ </svg>
 
widgets/so-features-widget/so-features-widget.php CHANGED
@@ -1,26 +1,26 @@
1
  <?php
2
  /*
3
- Widget Name: Features widget
4
  Description: Displays a block of features with icons.
5
- Author: Greg Priday
6
- Author URI: http://siteorigin.com
7
  */
8
 
9
  class SiteOrigin_Widget_Features_Widget extends SiteOrigin_Widget {
10
  function __construct() {
11
  parent::__construct(
12
  'sow-features',
13
- __( 'SiteOrigin Features', 'siteorigin-widgets' ),
14
  array(
15
- 'description' => __( 'Displays a list of features.', 'siteorigin-widgets' ),
16
  'help' => 'https://siteorigin.com/widgets-bundle/features-widget-documentation/'
17
  ),
18
  array(),
19
  array(
20
  'features' => array(
21
  'type' => 'repeater',
22
- 'label' => __('Features', 'siteorigin-widgets'),
23
- 'item_name' => __('Feature', 'siteorigin-widgets'),
24
  'item_label' => array(
25
  'selector' => "[id*='features-title']",
26
  'update_event' => 'change',
@@ -32,7 +32,7 @@ class SiteOrigin_Widget_Features_Widget extends SiteOrigin_Widget {
32
 
33
  'container_color' => array(
34
  'type' => 'color',
35
- 'label' => __('Container color', 'siteorigin-widgets'),
36
  'default' => '#404040',
37
  ),
38
 
@@ -40,49 +40,49 @@ class SiteOrigin_Widget_Features_Widget extends SiteOrigin_Widget {
40
 
41
  'icon' => array(
42
  'type' => 'icon',
43
- 'label' => __('Icon', 'siteorigin-widgets'),
44
  ),
45
 
46
  'icon_color' => array(
47
  'type' => 'color',
48
- 'label' => __('Icon color', 'siteorigin-widgets'),
49
  'default' => '#FFFFFF',
50
  ),
51
 
52
  'icon_image' => array(
53
  'type' => 'media',
54
  'library' => 'image',
55
- 'label' => __('Icon image', 'siteorigin-widgets'),
56
- 'description' => __('Use your own icon image.', 'siteorigin-widgets'),
57
  ),
58
 
59
  // The text under the icon
60
 
61
  'title' => array(
62
  'type' => 'text',
63
- 'label' => __('Title text', 'siteorigin-widgets'),
64
  ),
65
 
66
  'text' => array(
67
  'type' => 'text',
68
- 'label' => __('Text', 'siteorigin-widgets')
69
  ),
70
 
71
  'more_text' => array(
72
  'type' => 'text',
73
- 'label' => __('More link text', 'siteorigin-widgets'),
74
  ),
75
 
76
  'more_url' => array(
77
  'type' => 'link',
78
- 'label' => __('More link URL', 'siteorigin-widgets'),
79
  ),
80
  ),
81
  ),
82
 
83
  'container_shape' => array(
84
  'type' => 'select',
85
- 'label' => __('Container shape', 'siteorigin-widgets'),
86
  'default' => 'round',
87
  'options' => array(
88
  ),
@@ -90,43 +90,43 @@ class SiteOrigin_Widget_Features_Widget extends SiteOrigin_Widget {
90
 
91
  'container_size' => array(
92
  'type' => 'number',
93
- 'label' => __('Container size', 'siteorigin-widgets'),
94
  'default' => 84,
95
  ),
96
 
97
  'icon_size' => array(
98
  'type' => 'number',
99
- 'label' => __('Icon size', 'siteorigin-widgets'),
100
  'default' => 24,
101
  ),
102
 
103
  'per_row' => array(
104
  'type' => 'number',
105
- 'label' => __('Features per row', 'siteorigin-widgets'),
106
  'default' => 3,
107
  ),
108
 
109
  'responsive' => array(
110
  'type' => 'checkbox',
111
- 'label' => __('Responsive layout', 'siteorigin-widgets'),
112
  'default' => true,
113
  ),
114
 
115
  'title_link' => array(
116
  'type' => 'checkbox',
117
- 'label' => __('Link feature title to more URL', 'siteorigin-widgets'),
118
  'default' => false,
119
  ),
120
 
121
  'icon_link' => array(
122
  'type' => 'checkbox',
123
- 'label' => __('Link icon to more URL', 'siteorigin-widgets'),
124
  'default' => false,
125
  ),
126
 
127
  'new_window' => array(
128
  'type' => 'checkbox',
129
- 'label' => __('Open more URL in a new window', 'siteorigin-widgets'),
130
  'default' => false,
131
  ),
132
 
@@ -140,7 +140,7 @@ class SiteOrigin_Widget_Features_Widget extends SiteOrigin_Widget {
140
  array(
141
  array(
142
  'siteorigin-widgets',
143
- siteorigin_widget_get_plugin_dir_url( 'features' ) . 'css/style.css',
144
  array(),
145
  SOW_BUNDLE_VERSION
146
  )
@@ -162,4 +162,4 @@ class SiteOrigin_Widget_Features_Widget extends SiteOrigin_Widget {
162
  }
163
  }
164
 
165
- siteorigin_widget_register('features', __FILE__);
1
  <?php
2
  /*
3
+ Widget Name: Features
4
  Description: Displays a block of features with icons.
5
+ Author: SiteOrigin
6
+ Author URI: https://siteorigin.com
7
  */
8
 
9
  class SiteOrigin_Widget_Features_Widget extends SiteOrigin_Widget {
10
  function __construct() {
11
  parent::__construct(
12
  'sow-features',
13
+ __( 'SiteOrigin Features', 'so-widgets-bundle' ),
14
  array(
15
+ 'description' => __( 'Displays a list of features.', 'so-widgets-bundle' ),
16
  'help' => 'https://siteorigin.com/widgets-bundle/features-widget-documentation/'
17
  ),
18
  array(),
19
  array(
20
  'features' => array(
21
  'type' => 'repeater',
22
+ 'label' => __('Features', 'so-widgets-bundle'),
23
+ 'item_name' => __('Feature', 'so-widgets-bundle'),
24
  'item_label' => array(
25
  'selector' => "[id*='features-title']",
26
  'update_event' => 'change',
32
 
33
  'container_color' => array(
34
  'type' => 'color',
35
+ 'label' => __('Container color', 'so-widgets-bundle'),
36
  'default' => '#404040',
37
  ),
38
 
40
 
41
  'icon' => array(
42
  'type' => 'icon',
43
+ 'label' => __('Icon', 'so-widgets-bundle'),
44
  ),
45
 
46
  'icon_color' => array(
47
  'type' => 'color',
48
+ 'label' => __('Icon color', 'so-widgets-bundle'),
49
  'default' => '#FFFFFF',
50
  ),
51
 
52
  'icon_image' => array(
53
  'type' => 'media',
54
  'library' => 'image',
55
+ 'label' => __('Icon image', 'so-widgets-bundle'),
56
+ 'description' => __('Use your own icon image.', 'so-widgets-bundle'),
57
  ),
58
 
59
  // The text under the icon
60
 
61
  'title' => array(
62
  'type' => 'text',
63
+ 'label' => __('Title text', 'so-widgets-bundle'),
64
  ),
65
 
66
  'text' => array(
67
  'type' => 'text',
68
+ 'label' => __('Text', 'so-widgets-bundle')
69
  ),
70
 
71
  'more_text' => array(
72
  'type' => 'text',
73
+ 'label' => __('More link text', 'so-widgets-bundle'),
74
  ),
75
 
76
  'more_url' => array(
77
  'type' => 'link',
78
+ 'label' => __('More link URL', 'so-widgets-bundle'),
79
  ),
80
  ),
81
  ),
82
 
83
  'container_shape' => array(
84
  'type' => 'select',
85
+ 'label' => __('Container shape', 'so-widgets-bundle'),
86
  'default' => 'round',
87
  'options' => array(
88
  ),
90
 
91
  'container_size' => array(
92
  'type' => 'number',
93
+ 'label' => __('Container size', 'so-widgets-bundle'),
94
  'default' => 84,
95
  ),
96
 
97
  'icon_size' => array(
98
  'type' => 'number',
99
+ 'label' => __('Icon size', 'so-widgets-bundle'),
100
  'default' => 24,
101
  ),
102
 
103
  'per_row' => array(
104
  'type' => 'number',
105
+ 'label' => __('Features per row', 'so-widgets-bundle'),
106
  'default' => 3,
107
  ),
108
 
109
  'responsive' => array(
110
  'type' => 'checkbox',
111
+ 'label' => __('Responsive layout', 'so-widgets-bundle'),
112
  'default' => true,
113
  ),
114
 
115
  'title_link' => array(
116
  'type' => 'checkbox',
117
+ 'label' => __('Link feature title to more URL', 'so-widgets-bundle'),
118
  'default' => false,
119
  ),
120
 
121
  'icon_link' => array(
122
  'type' => 'checkbox',
123
+ 'label' => __('Link icon to more URL', 'so-widgets-bundle'),
124
  'default' => false,
125
  ),
126
 
127
  'new_window' => array(
128
  'type' => 'checkbox',
129
+ 'label' => __('Open more URL in a new window', 'so-widgets-bundle'),
130
  'default' => false,
131
  ),
132
 
140
  array(
141
  array(
142
  'siteorigin-widgets',
143
+ plugin_dir_url(__FILE__) . 'css/style.css',
144
  array(),
145
  SOW_BUNDLE_VERSION
146
  )
162
  }
163
  }
164
 
165
+ siteorigin_widget_register('sow-features', __FILE__, 'SiteOrigin_Widget_Features_Widget');
widgets/so-google-map-widget/assets/banner.svg CHANGED
@@ -1,43 +1,44 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
4
- <svg version="1.0" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
- width="480px" height="240px" viewBox="0 0 480 240" enable-background="new 0 0 480 240" xml:space="preserve">
6
- <rect id="Call_to_Action_1_" fill="#1880B6" width="480" height="240"/>
7
- <g>
8
- <g>
9
- <path fill="#324249" d="M216,92c6.625,0,12-5.373,12-12s-5.375-12-12-12s-12,5.373-12,12S209.375,92,216,92z M216,72
10
- c4.418,0,8,3.582,8,8s-3.582,8-8,8s-8-3.582-8-8S211.582,72,216,72z"/>
11
- <path fill="#324249" d="M296,80h-56c0-13.254-10.742-24-24-24s-24,10.746-24,24h-8c-4.418,0-8,3.582-8,8v88c0,4.418,3.582,8,8,8
12
- h112c4.418,0,8-3.582,8-8V88C304,83.582,300.418,80,296,80z M216,60c11.047,0,20,8.953,20,20c0,3.113-0.594,6.5-2.055,8.869
13
- l-17.562,25.643l-18.34-25.674C196.594,86.469,196,83.113,196,80C196,68.953,204.953,60,216,60z M180,88c0-2.209,1.789-4,4-4
14
- h8.371c0-0.01-0.004-0.02-0.004-0.029c0.395,2.43,1.09,4.785,2.094,6.447c0.031,0.141,6.055,8.652,11.539,16.377l0.539,3.602
15
- L180,114.377V88z M184,180c-2.211,0-4-1.791-4-4v-41.576l29.48-4.422l7.5,49.998H184z M300,176c0,2.209-1.789,4-4,4h-58.98
16
- L234,160.062L300,160V176z M300,144h-68.625l-2.293-16.939L300,116.424V144z M300,112.377l-75.465,11.32L228.18,148H300v8
17
- l-66.602,0.059l-4.02-0.059l3.602,24h-11.957l-8.184-54.549L180,130.377v-11.955l30.961-4.643
18
- c2.254,3.166,3.828,5.383,3.828,5.383c0.375,0.525,0.98,0.838,1.625,0.838c0.008,0,0.016,0,0.023,0
19
- c0.648-0.006,1.258-0.332,1.629-0.869c0,0,2.094-3.062,4.883-7.15L300,100.424V112.377z M300,96.377l-73.859,11.08l-0.02-0.119
20
- c5.277-7.725,11.199-16.404,11.223-16.449c1.188-2.057,1.914-4.426,2.305-6.889H296c2.211,0,4,1.791,4,4V96.377z"/>
21
- </g>
22
- <g>
23
- <path fill="#8ED9EF" d="M206,106.795c-5.484-7.725-11.508-16.236-11.539-16.377c-1.004-1.662-1.699-4.018-2.094-6.447
24
- c0,0.01,0.004,0.02,0.004,0.029H184c-2.211,0-4,1.791-4,4v26.377l26.539-3.98L206,106.795z"/>
25
- <path fill="#8ED9EF" d="M180,134.424V176c0,2.209,1.789,4,4,4h32.98l-7.5-49.998L180,134.424z"/>
26
- <path fill="#8ED9EF" d="M237.02,180H296c2.211,0,4-1.791,4-4v-16l-66,0.062L237.02,180z"/>
27
- <polygon fill="#8ED9EF" points="231.375,144 300,144 300,116.424 229.082,127.061 "/>
28
- <path fill="#8ED9EF" d="M296,84h-56.352c-0.391,2.463-1.117,4.832-2.305,6.889c-0.023,0.045-5.945,8.725-11.223,16.449l0.02,0.119
29
- L300,96.377V88C300,85.791,298.211,84,296,84z"/>
30
- </g>
31
- <g>
32
- <path fill="#F2F0DA" d="M216,60c-11.047,0-20,8.953-20,20c0,3.113,0.594,6.469,2.043,8.838l18.34,25.674l17.562-25.643
33
- C235.406,86.5,236,83.113,236,80C236,68.953,227.047,60,216,60z M216,92c-6.625,0-12-5.373-12-12s5.375-12,12-12s12,5.373,12,12
34
- S222.625,92,216,92z"/>
35
- </g>
36
- <g>
37
- <path fill="#F2F0DA" d="M300,100.424l-77.051,11.557c-2.789,4.088-4.883,7.15-4.883,7.15c-0.371,0.537-0.98,0.863-1.629,0.869
38
- c-0.008,0-0.016,0-0.023,0c-0.645,0-1.25-0.312-1.625-0.838c0,0-1.574-2.217-3.828-5.383L180,118.422v11.955l32.84-4.926
39
- L221.023,180h11.957l-3.602-24l4.02,0.059L300,156v-8h-71.82l-3.645-24.303L300,112.377V100.424z"/>
40
- </g>
41
- <circle fill="#1880B6" cx="216" cy="80" r="8"/>
42
- </g>
43
- </svg>
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="55 277 240 240" style="enable-background:new 55 277 240 240;" xml:space="preserve">
5
+ <style type="text/css">
6
+ .st0{fill:#1880B6;}
7
+ .st1{fill:#324249;}
8
+ .st2{fill:#8ED9EF;}
9
+ .st3{fill:#F2F0DA;}
10
+ </style>
11
+ <rect id="Call_to_Action_1_" x="55" y="277" class="st0" width="240" height="240"/>
12
+ <g>
13
+ <g>
14
+ <path class="st1" d="M151,369c6.6,0,12-5.4,12-12s-5.4-12-12-12s-12,5.4-12,12S144.4,369,151,369z M151,349c4.4,0,8,3.6,8,8
15
+ s-3.6,8-8,8s-8-3.6-8-8S146.6,349,151,349z"/>
16
+ <path class="st1" d="M231,357h-56c0-13.3-10.7-24-24-24s-24,10.7-24,24h-8c-4.4,0-8,3.6-8,8v88c0,4.4,3.6,8,8,8h112
17
+ c4.4,0,8-3.6,8-8v-88C239,360.6,235.4,357,231,357z M151,337c11,0,20,9,20,20c0,3.1-0.6,6.5-2.1,8.9l-17.6,25.6L133,365.8
18
+ c-1.4-2.4-2-5.7-2-8.8C131,346,140,337,151,337z M115,365c0-2.2,1.8-4,4-4h8.4c0,0,0,0,0,0c0.4,2.4,1.1,4.8,2.1,6.4
19
+ c0,0.1,6.1,8.7,11.5,16.4l0.5,3.6l-26.5,4V365z M119,457c-2.2,0-4-1.8-4-4v-41.6l29.5-4.4l7.5,50H119z M235,453c0,2.2-1.8,4-4,4
20
+ h-59l-3-19.9l66-0.1V453z M235,421h-68.6l-2.3-16.9l70.9-10.6V421z M235,389.4l-75.5,11.3l3.6,24.3H235v8l-66.6,0.1l-4-0.1l3.6,24
21
+ h-12l-8.2-54.5l-32.8,4.9v-12l31-4.6c2.3,3.2,3.8,5.4,3.8,5.4c0.4,0.5,1,0.8,1.6,0.8c0,0,0,0,0,0c0.6,0,1.3-0.3,1.6-0.9
22
+ c0,0,2.1-3.1,4.9-7.1l77.1-11.6V389.4z M235,373.4l-73.9,11.1l0-0.1c5.3-7.7,11.2-16.4,11.2-16.4c1.2-2.1,1.9-4.4,2.3-6.9H231
23
+ c2.2,0,4,1.8,4,4V373.4z"/>
24
+ </g>
25
+ <g>
26
+ <path class="st2" d="M141,383.8c-5.5-7.7-11.5-16.2-11.5-16.4c-1-1.7-1.7-4-2.1-6.4c0,0,0,0,0,0H119c-2.2,0-4,1.8-4,4v26.4l26.5-4
27
+ L141,383.8z"/>
28
+ <path class="st2" d="M115,411.4V453c0,2.2,1.8,4,4,4h33l-7.5-50L115,411.4z"/>
29
+ <path class="st2" d="M172,457h59c2.2,0,4-1.8,4-4v-16l-66,0.1L172,457z"/>
30
+ <polygon class="st2" points="166.4,421 235,421 235,393.4 164.1,404.1 "/>
31
+ <path class="st2" d="M231,361h-56.4c-0.4,2.5-1.1,4.8-2.3,6.9c0,0-5.9,8.7-11.2,16.4l0,0.1l73.9-11.1V365
32
+ C235,362.8,233.2,361,231,361z"/>
33
+ </g>
34
+ <g>
35
+ <path class="st3" d="M151,337c-11,0-20,9-20,20c0,3.1,0.6,6.5,2,8.8l18.3,25.7l17.6-25.6c1.5-2.4,2.1-5.8,2.1-8.9
36
+ C171,346,162,337,151,337z M151,369c-6.6,0-12-5.4-12-12s5.4-12,12-12s12,5.4,12,12S157.6,369,151,369z"/>
37
+ </g>
38
+ <g>
39
+ <path class="st3" d="M235,377.4L157.9,389c-2.8,4.1-4.9,7.1-4.9,7.1c-0.4,0.5-1,0.9-1.6,0.9c0,0,0,0,0,0c-0.6,0-1.2-0.3-1.6-0.8
40
+ c0,0-1.6-2.2-3.8-5.4l-31,4.6v12l32.8-4.9L156,457h12l-3.6-24l4,0.1L235,433v-8h-71.8l-3.6-24.3l75.5-11.3V377.4z"/>
41
+ </g>
42
+ <circle class="st0" cx="151" cy="357" r="8"/>
43
+ </g>
44
+ </svg>
widgets/so-google-map-widget/so-google-map-widget.php CHANGED
@@ -1,10 +1,10 @@
1
  <?php
2
 
3
  /*
4
- Widget Name: Google Maps widget
5
  Description: A highly customisable Google Maps widget. Help your site find its place and give it some direction.
6
  Author: SiteOrigin
7
- Author URI: http://siteorigin.com
8
  */
9
 
10
  class SiteOrigin_Widget_GoogleMap_Widget extends SiteOrigin_Widget {
@@ -13,9 +13,9 @@ class SiteOrigin_Widget_GoogleMap_Widget extends SiteOrigin_Widget {
13
 
14
  parent::__construct(
15
  'sow-google-map',
16
- __( 'SiteOrigin Google Maps', 'siteorigin-widgets' ),
17
  array(
18
- 'description' => __( 'A Google Maps widget.', 'siteorigin-widgets' ),
19
  'help' => 'https://siteorigin.com/widgets-bundle/google-maps-widget/'
20
  ),
21
  array(),
@@ -23,26 +23,26 @@ class SiteOrigin_Widget_GoogleMap_Widget extends SiteOrigin_Widget {
23
  'map_center' => array(
24
  'type' => 'textarea',
25
  'rows' => 2,
26
- 'label' => __( 'Map center', 'siteorigin-widgets' ),
27
- 'description' => __( 'The name of a place, town, city, or even a country. Can be an exact address too.', 'siteorigin-widgets' )
28
  ),
29
  'settings' => array(
30
  'type' => 'section',
31
- 'label' => __( 'Settings', 'siteorigin-widgets' ),
32
  'hide' => false,
33
- 'description' => __( 'Set map display options.', 'siteorigin-widgets' ),
34
  'fields' => array(
35
  'map_type' => array(
36
  'type' => 'radio',
37
  'default' => 'interactive',
38
- 'label' => __( 'Map type', 'siteorigin-widgets' ),
39
  'state_emitter' => array(
40
  'callback' => 'select',
41
  'args' => array( 'map_type' )
42
  ),
43
  'options' => array(
44
- 'interactive' => __( 'Interactive', 'siteorigin-widgets' ),
45
- 'static' => __( 'Static image', 'siteorigin-widgets' ),
46
  )
47
  ),
48
  'width' => array(
@@ -53,17 +53,17 @@ class SiteOrigin_Widget_GoogleMap_Widget extends SiteOrigin_Widget {
53
  'map_type[static]' => array('show'),
54
  '_else[map_type]' => array('hide'),
55
  ),
56
- 'label' => __( 'Width', 'siteorigin-widgets' )
57
  ),
58
  'height' => array(
59
  'type' => 'text',
60
  'default' => 480,
61
- 'label' => __( 'Height', 'siteorigin-widgets' )
62
  ),
63
  'zoom' => array(
64
  'type' => 'slider',
65
- 'label' => __( 'Zoom level', 'siteorigin-widgets' ),
66
- 'description' => __( 'A value from 0 (the world) to 21 (street level).', 'siteorigin-widgets' ),
67
  'min' => 0,
68
  'max' => 21,
69
  'default' => 12,
@@ -77,8 +77,8 @@ class SiteOrigin_Widget_GoogleMap_Widget extends SiteOrigin_Widget {
77
  'map_type[interactive]' => array('show'),
78
  '_else[map_type]' => array('hide'),
79
  ),
80
- 'label' => __( 'Scroll to zoom', 'siteorigin-widgets' ),
81
- 'description' => __( 'Allow scrolling over the map to zoom in or out.', 'siteorigin-widgets' )
82
  ),
83
  'draggable' => array(
84
  'type' => 'checkbox',
@@ -87,8 +87,8 @@ class SiteOrigin_Widget_GoogleMap_Widget extends SiteOrigin_Widget {
87
  'map_type[interactive]' => array('show'),
88
  '_else[map_type]' => array('hide'),
89
  ),
90
- 'label' => __( 'Draggable', 'siteorigin-widgets' ),
91
- 'description' => __( 'Allow dragging the map to move it around.', 'siteorigin-widgets' )
92
  ),
93
  'disable_default_ui' => array(
94
  'type' => 'checkbox',
@@ -97,8 +97,8 @@ class SiteOrigin_Widget_GoogleMap_Widget extends SiteOrigin_Widget {
97
  'map_type[interactive]' => array('show'),
98
  '_else[map_type]' => array('hide'),
99
  ),
100
- 'label' => __( 'Disable default UI', 'siteorigin-widgets' ),
101
- 'description' => __( 'Hides the default Google Maps controls.', 'siteorigin-widgets' )
102
  ),
103
  'keep_centered' => array(
104
  'type' => 'checkbox',
@@ -107,27 +107,27 @@ class SiteOrigin_Widget_GoogleMap_Widget extends SiteOrigin_Widget {
107
  'map_type[interactive]' => array('show'),
108
  '_else[map_type]' => array('hide'),
109
  ),
110
- 'label' => __( 'Keep map centered', 'siteorigin-widgets' ),
111
- 'description' => __( 'Keeps the map centered when it\'s container is resized.', 'siteorigin-widgets' )
112
  )
113
  )
114
  ),
115
  'markers' => array(
116
  'type' => 'section',
117
- 'label' => __( 'Markers', 'siteorigin-widgets' ),
118
  'hide' => true,
119
- 'description' => __( 'Use markers to identify points of interest on the map.', 'siteorigin-widgets' ),
120
  'fields' => array(
121
  'marker_at_center' => array(
122
  'type' => 'checkbox',
123
  'default' => true,
124
- 'label' => __( 'Show marker at map center', 'siteorigin-widgets' )
125
  ),
126
  'marker_icon' => array(
127
  'type' => 'media',
128
  'default' => '',
129
- 'label' => __( 'Marker icon', 'siteorigin-widgets' ),
130
- 'description' => __( 'Replaces the default map marker with your own image.', 'siteorigin-widgets' )
131
  ),
132
  'markers_draggable' => array(
133
  'type' => 'checkbox',
@@ -136,13 +136,13 @@ class SiteOrigin_Widget_GoogleMap_Widget extends SiteOrigin_Widget {
136
  'map_type[interactive]' => array('show'),
137
  '_else[map_type]' => array('hide'),
138
  ),
139
- 'label' => __( 'Draggable markers', 'siteorigin-widgets' )
140
  ),
141
  'marker_positions' => array(
142
  'type' => 'repeater',
143
- 'label' => __( 'Marker positions', 'siteorigin-widgets' ),
144
- 'description' => __( 'Please be aware that adding more than 10 markers may cause a slight delay before they appear, due to Google Geocoding API rate limits.', 'siteorigin-widgets' ),
145
- 'item_name' => __( 'Marker', 'siteorigin-widgets' ),
146
  'item_label' => array(
147
  'selector' => "[id*='marker_positions-place']",
148
  'update_event' => 'change',
@@ -152,49 +152,49 @@ class SiteOrigin_Widget_GoogleMap_Widget extends SiteOrigin_Widget {
152
  'place' => array(
153
  'type' => 'textarea',
154
  'rows' => 2,
155
- 'label' => __( 'Place', 'siteorigin-widgets' )
156
  ),
157
  'info' => array(
158
  'type' => 'tinymce',
159
  'rows' => 10,
160
- 'label' => __( 'Info Window Content', 'siteorigin-widgets' )
161
  ),
162
  'info_max_width' => array(
163
  'type' => 'text',
164
- 'label' => __( 'Info Window max width', 'siteorigin-widgets' )
165
  ),
166
  )
167
  ),
168
  'info_display' => array(
169
  'type' => 'radio',
170
- 'label' => __( 'When should Info Windows be displayed?' ),
171
  'default' => 'click',
172
  'options' => array(
173
- 'click' => __( 'Click', 'siteorigin-widgets' ),
174
- 'mouseover' => __( 'Mouse over', 'siteorigin-widgets' ),
175
- 'always' => __( 'Always', 'siteorigin-widgets' ),
176
  )
177
  ),
178
  )
179
  ),
180
  'styles' => array(
181
  'type' => 'section',
182
- 'label' => __( 'Styles', 'siteorigin-widgets' ),
183
  'hide' => true,
184
- 'description' => __( 'Apply custom colors to map features, or hide them completely.', 'siteorigin-widgets' ),
185
  'fields' => array(
186
  'style_method' => array(
187
  'type' => 'radio',
188
  'default' => 'normal',
189
- 'label' => __( 'Map styles', 'siteorigin-widgets' ),
190
  'state_emitter' => array(
191
  'callback' => 'select',
192
  'args' => array( 'style_method' )
193
  ),
194
  'options' => array(
195
- 'normal' => __( 'Default', 'siteorigin-widgets' ),
196
- 'custom' => __( 'Custom', 'siteorigin-widgets' ),
197
- 'raw_json' => __( 'Predefined Styles', 'siteorigin-widgets' ),
198
  )
199
  ),
200
  'styled_map_name' => array(
@@ -203,7 +203,7 @@ class SiteOrigin_Widget_GoogleMap_Widget extends SiteOrigin_Widget {
203
  'style_method[default]' => array('hide'),
204
  '_else[style_method]' => array('show'),
205
  ),
206
- 'label' => __( 'Styled map name', 'siteorigin-widgets' )
207
  ),
208
  'raw_json_map_styles' => array(
209
  'type' => 'textarea',
@@ -213,8 +213,8 @@ class SiteOrigin_Widget_GoogleMap_Widget extends SiteOrigin_Widget {
213
  ),
214
  'rows' => 5,
215
  'hidden' => true,
216
- 'label' => __( 'Raw JSON styles', 'siteorigin-widgets' ),
217
- 'description' => __( 'Copy and paste predefined styles here from <a href="http://snazzymaps.com/" target="_blank">Snazzy Maps</a>.', 'siteorigin-widgets' )
218
  ),
219
  'custom_map_styles' => array(
220
  'type' => 'repeater',
@@ -222,8 +222,8 @@ class SiteOrigin_Widget_GoogleMap_Widget extends SiteOrigin_Widget {
222
  'style_method[custom]' => array('show'),
223
  '_else[style_method]' => array('hide'),
224
  ),
225
- 'label' => __( 'Custom map styles', 'siteorigin-widgets' ),
226
- 'item_name' => __( 'Style', 'siteorigin-widgets' ),
227
  'item_label' => array(
228
  'selector' => "[id*='custom_map_styles-map_feature'] :selected",
229
  'update_event' => 'change',
@@ -233,44 +233,44 @@ class SiteOrigin_Widget_GoogleMap_Widget extends SiteOrigin_Widget {
233
  'map_feature' => array(
234
  'type' => 'select',
235
  'label' => '',
236
- 'prompt' => __( 'Select map feature to style', 'siteorigin-widgets' ),
237
  'options' => array(
238
- 'water' => __( 'Water', 'siteorigin-widgets' ),
239
- 'road_highway' => __( 'Highways', 'siteorigin-widgets' ),
240
- 'road_arterial' => __( 'Arterial roads', 'siteorigin-widgets' ),
241
- 'road_local' => __( 'Local roads', 'siteorigin-widgets' ),
242
- 'transit_line' => __( 'Transit lines', 'siteorigin-widgets' ),
243
- 'transit_station' => __( 'Transit stations', 'siteorigin-widgets' ),
244
- 'landscape_man-made' => __( 'Man-made landscape', 'siteorigin-widgets' ),
245
- 'landscape_natural_landcover' => __( 'Natural landscape landcover', 'siteorigin-widgets' ),
246
- 'landscape_natural_terrain' => __( 'Natural landscape terrain', 'siteorigin-widgets' ),
247
- 'poi_attraction' => __( 'Point of interest - Attractions', 'siteorigin-widgets' ),
248
- 'poi_business' => __( 'Point of interest - Business', 'siteorigin-widgets' ),
249
- 'poi_government' => __( 'Point of interest - Government', 'siteorigin-widgets' ),
250
- 'poi_medical' => __( 'Point of interest - Medical', 'siteorigin-widgets' ),
251
- 'poi_park' => __( 'Point of interest - Parks', 'siteorigin-widgets' ),
252
- 'poi_place-of-worship' => __( 'Point of interest - Places of worship', 'siteorigin-widgets' ),
253
- 'poi_school' => __( 'Point of interest - Schools', 'siteorigin-widgets' ),
254
- 'poi_sports-complex' => __( 'Point of interest - Sports complexes', 'siteorigin-widgets' ),
255
  )
256
  ),
257
  'element_type' => array(
258
  'type' => 'select',
259
- 'label' => __( 'Select element type to style', 'siteorigin-widgets' ),
260
  'options' => array(
261
- 'geometry' => __( 'Geometry', 'siteorigin-widgets' ),
262
- 'labels' => __( 'Labels', 'siteorigin-widgets' ),
263
- 'all' => __( 'All', 'siteorigin-widgets' ),
264
  )
265
  ),
266
  'visibility' => array(
267
  'type' => 'checkbox',
268
  'default' => true,
269
- 'label' => __( 'Visible', 'siteorigin-widgets' )
270
  ),
271
  'color' => array(
272
  'type' => 'color',
273
- 'label' => __( 'Color', 'siteorigin-widgets' )
274
  )
275
  )
276
  )
@@ -278,45 +278,45 @@ class SiteOrigin_Widget_GoogleMap_Widget extends SiteOrigin_Widget {
278
  ),
279
  'directions' => array(
280
  'type' => 'section',
281
- 'label' => __( 'Directions', 'siteorigin-widgets' ),
282
  'state_handler' => array(
283
  'map_type[interactive]' => array('show'),
284
  '_else[map_type]' => array('hide'),
285
  ),
286
  'hide' => true,
287
- 'description' => __( 'Display a route on your map, with waypoints between your starting point and destination.', 'siteorigin-widgets' ),
288
  'fields' => array(
289
  'origin' => array(
290
  'type' => 'text',
291
- 'label' => __( 'Starting point', 'siteorigin-widgets' )
292
  ),
293
  'destination' => array(
294
  'type' => 'text',
295
- 'label' => __( 'Destination', 'siteorigin-widgets' )
296
  ),
297
  'travel_mode' => array(
298
  'type' => 'select',
299
- 'label' => __( 'Travel mode', 'siteorigin-widgets' ),
300
  'default' => 'driving',
301
  'options' => array(
302
- 'driving' => __( 'Driving', 'siteorigin-widgets' ),
303
- 'walking' => __( 'Walking', 'siteorigin-widgets' ),
304
- 'bicycling' => __( 'Bicycling', 'siteorigin-widgets' ),
305
- 'transit' => __( 'Transit', 'siteorigin-widgets' )
306
  )
307
  ),
308
  'avoid_highways' => array(
309
  'type' => 'checkbox',
310
- 'label' => __( 'Avoid highways', 'siteorigin-widgets' ),
311
  ),
312
  'avoid_tolls' => array(
313
  'type' => 'checkbox',
314
- 'label' => __( 'Avoid tolls', 'siteorigin-widgets' ),
315
  ),
316
  'waypoints' => array(
317
  'type' => 'repeater',
318
- 'label' => __( 'Waypoints', 'siteorigin-widgets' ),
319
- 'item_name' => __( 'Waypoint', 'siteorigin-widgets' ),
320
  'item_label' => array(
321
  'selector' => "[id*='waypoints-location']",
322
  'update_event' => 'change',
@@ -326,33 +326,33 @@ class SiteOrigin_Widget_GoogleMap_Widget extends SiteOrigin_Widget {
326
  'location' => array(
327
  'type' => 'textarea',
328
  'rows' => 2,
329
- 'label' => __( 'Location', 'siteorigin-widgets' )
330
  ),
331
  'stopover' => array(
332
  'type' => 'checkbox',
333
  'default' => true,
334
- 'label' => __( 'Stopover', 'siteorigin-widgets' ),
335
- 'description' => __( 'Whether or not this is a stop on the route or just a route preference.', 'siteorigin-widgets' )
336
  )
337
  )
338
  ),
339
  'optimize_waypoints' => array(
340
  'type' => 'checkbox',
341
- 'label' => __( 'Optimize waypoints', 'siteorigin-widgets' ),
342
  'default' => false,
343
- 'description' => __( 'Allow the Google Maps service to reorder waypoints for the shortest travelling distance.', 'siteorigin-widgets' )
344
  )
345
  )
346
  ),
347
  'api_key_section' => array(
348
  'type' => 'section',
349
- 'label' => __( 'API key', 'siteorigin-widgets' ),
350
  'hide' => true,
351
  'fields' => array(
352
  'api_key' => array(
353
  'type' => 'text',
354
- 'label' => __( 'API key', 'siteorigin-widgets' ),
355
- 'description' => __( 'Enter your API key if you have one. This enables you to monitor your Google Maps API usage in the Google APIs Console.', 'siteorigin-widgets' ),
356
  'optional' => true
357
  )
358
  )
@@ -366,7 +366,7 @@ class SiteOrigin_Widget_GoogleMap_Widget extends SiteOrigin_Widget {
366
  array(
367
  array(
368
  'sow-google-map',
369
- siteorigin_widget_get_plugin_dir_url( 'google-map' ) . 'js/js-map' . SOW_BUNDLE_JS_SUFFIX . '.js',
370
  array( 'jquery' ),
371
  SOW_BUNDLE_VERSION . mt_rand()
372
  )
@@ -376,7 +376,7 @@ class SiteOrigin_Widget_GoogleMap_Widget extends SiteOrigin_Widget {
376
  array(
377
  array(
378
  'sow-google-map',
379
- siteorigin_widget_get_plugin_dir_url( 'google-map' ) . 'css/style.css',
380
  array(),
381
  SOW_BUNDLE_VERSION
382
  )
@@ -479,7 +479,7 @@ class SiteOrigin_Widget_GoogleMap_Widget extends SiteOrigin_Widget {
479
  if ( empty( $style_config['raw_json_map_styles'] ) ) {
480
  return array();
481
  } else {
482
- $map_name = ! empty( $style_config['styled_map_name'] ) ? $style_config['styled_map_name'] : __( 'Custom Map', 'siteorigin-widgets' );
483
  $styles_string = $style_config['raw_json_map_styles'];
484
 
485
  return array( 'map_name' => $map_name, 'styles' => json_decode( $styles_string, true ) );
@@ -568,4 +568,4 @@ class SiteOrigin_Widget_GoogleMap_Widget extends SiteOrigin_Widget {
568
  }
569
  }
570
 
571
- siteorigin_widget_register( 'google-map', __FILE__ );
1
  <?php
2
 
3
  /*
4
+ Widget Name: Google Maps
5
  Description: A highly customisable Google Maps widget. Help your site find its place and give it some direction.
6
  Author: SiteOrigin
7
+ Author URI: https://siteorigin.com
8
  */
9
 
10
  class SiteOrigin_Widget_GoogleMap_Widget extends SiteOrigin_Widget {
13
 
14
  parent::__construct(
15
  'sow-google-map',
16
+ __( 'SiteOrigin Google Maps', 'so-widgets-bundle' ),
17
  array(
18
+ 'description' => __( 'A Google Maps widget.', 'so-widgets-bundle' ),
19
  'help' => 'https://siteorigin.com/widgets-bundle/google-maps-widget/'
20
  ),
21
  array(),
23
  'map_center' => array(
24
  'type' => 'textarea',
25
  'rows' => 2,
26
+ 'label' => __( 'Map center', 'so-widgets-bundle' ),
27
+ 'description' => __( 'The name of a place, town, city, or even a country. Can be an exact address too.', 'so-widgets-bundle' )
28
  ),
29
  'settings' => array(
30
  'type' => 'section',
31
+ 'label' => __( 'Settings', 'so-widgets-bundle' ),
32
  'hide' => false,
33
+ 'description' => __( 'Set map display options.', 'so-widgets-bundle' ),
34
  'fields' => array(
35
  'map_type' => array(
36
  'type' => 'radio',
37
  'default' => 'interactive',
38
+ 'label' => __( 'Map type', 'so-widgets-bundle' ),
39
  'state_emitter' => array(
40
  'callback' => 'select',
41
  'args' => array( 'map_type' )
42
  ),
43
  'options' => array(
44
+ 'interactive' => __( 'Interactive', 'so-widgets-bundle' ),
45
+ 'static' => __( 'Static image', 'so-widgets-bundle' ),
46
  )
47
  ),
48
  'width' => array(
53
  'map_type[static]' => array('show'),
54
  '_else[map_type]' => array('hide'),
55
  ),
56
+ 'label' => __( 'Width', 'so-widgets-bundle' )
57
  ),
58
  'height' => array(
59
  'type' => 'text',
60
  'default' => 480,
61
+ 'label' => __( 'Height', 'so-widgets-bundle' )
62
  ),
63
  'zoom' => array(
64
  'type' => 'slider',
65
+ 'label' => __( 'Zoom level', 'so-widgets-bundle' ),
66
+ 'description' => __( 'A value from 0 (the world) to 21 (street level).', 'so-widgets-bundle' ),
67
  'min' => 0,
68
  'max' => 21,
69
  'default' => 12,
77
  'map_type[interactive]' => array('show'),
78
  '_else[map_type]' => array('hide'),
79
  ),
80
+ 'label' => __( 'Scroll to zoom', 'so-widgets-bundle' ),
81
+ 'description' => __( 'Allow scrolling over the map to zoom in or out.', 'so-widgets-bundle' )
82
  ),
83
  'draggable' => array(
84
  'type' => 'checkbox',
87
  'map_type[interactive]' => array('show'),
88
  '_else[map_type]' => array('hide'),
89
  ),
90
+ 'label' => __( 'Draggable', 'so-widgets-bundle' ),
91
+ 'description' => __( 'Allow dragging the map to move it around.', 'so-widgets-bundle' )
92
  ),
93
  'disable_default_ui' => array(
94
  'type' => 'checkbox',
97
  'map_type[interactive]' => array('show'),
98
  '_else[map_type]' => array('hide'),
99
  ),
100
+ 'label' => __( 'Disable default UI', 'so-widgets-bundle' ),
101
+ 'description' => __( 'Hides the default Google Maps controls.', 'so-widgets-bundle' )
102
  ),
103
  'keep_centered' => array(
104
  'type' => 'checkbox',
107
  'map_type[interactive]' => array('show'),
108
  '_else[map_type]' => array('hide'),
109
  ),
110
+ 'label' => __( 'Keep map centered', 'so-widgets-bundle' ),
111
+ 'description' => __( 'Keeps the map centered when it\'s container is resized.', 'so-widgets-bundle' )
112
  )
113
  )
114
  ),
115
  'markers' => array(
116
  'type' => 'section',
117
+ 'label' => __( 'Markers', 'so-widgets-bundle' ),
118
  'hide' => true,
119
+ 'description' => __( 'Use markers to identify points of interest on the map.', 'so-widgets-bundle' ),
120
  'fields' => array(
121
  'marker_at_center' => array(
122
  'type' => 'checkbox',
123
  'default' => true,
124
+ 'label' => __( 'Show marker at map center', 'so-widgets-bundle' )
125
  ),
126
  'marker_icon' => array(
127
  'type' => 'media',
128
  'default' => '',
129
+ 'label' => __( 'Marker icon', 'so-widgets-bundle' ),
130
+ 'description' => __( 'Replaces the default map marker with your own image.', 'so-widgets-bundle' )
131
  ),
132
  'markers_draggable' => array(
133
  'type' => 'checkbox',
136
  'map_type[interactive]' => array('show'),
137
  '_else[map_type]' => array('hide'),
138
  ),
139
+ 'label' => __( 'Draggable markers', 'so-widgets-bundle' )
140
  ),
141
  'marker_positions' => array(
142
  'type' => 'repeater',
143
+ 'label' => __( 'Marker positions', 'so-widgets-bundle' ),
144
+ 'description' => __( 'Please be aware that adding more than 10 markers may cause a slight delay before they appear, due to Google Geocoding API rate limits.', 'so-widgets-bundle' ),
145
+ 'item_name' => __( 'Marker', 'so-widgets-bundle' ),
146
  'item_label' => array(
147
  'selector' => "[id*='marker_positions-place']",
148
  'update_event' => 'change',
152
  'place' => array(
153
  'type' => 'textarea',
154
  'rows' => 2,
155
+ 'label' => __( 'Place', 'so-widgets-bundle' )
156
  ),
157
  'info' => array(
158
  'type' => 'tinymce',
159
  'rows' => 10,
160
+ 'label' => __( 'Info Window Content', 'so-widgets-bundle' )
161
  ),
162
  'info_max_width' => array(
163
  'type' => 'text',
164
+ 'label' => __( 'Info Window max width', 'so-widgets-bundle' )
165
  ),
166
  )
167
  ),
168
  'info_display' => array(
169
  'type' => 'radio',
170
+ 'label' => __( 'When should Info Windows be displayed?', 'so-widgets-bundle' ),
171
  'default' => 'click',
172
  'options' => array(
173
+ 'click' => __( 'Click', 'so-widgets-bundle' ),
174
+ 'mouseover' => __( 'Mouse over', 'so-widgets-bundle' ),
175
+ 'always' => __( 'Always', 'so-widgets-bundle' ),
176
  )
177
  ),
178
  )
179
  ),
180
  'styles' => array(
181
  'type' => 'section',
182
+ 'label' => __( 'Styles', 'so-widgets-bundle' ),
183
  'hide' => true,
184
+ 'description' => __( 'Apply custom colors to map features, or hide them completely.', 'so-widgets-bundle' ),
185
  'fields' => array(
186
  'style_method' => array(
187
  'type' => 'radio',
188
  'default' => 'normal',
189
+ 'label' => __( 'Map styles', 'so-widgets-bundle' ),
190
  'state_emitter' => array(
191
  'callback' => 'select',
192
  'args' => array( 'style_method' )
193
  ),
194
  'options' => array(
195
+ 'normal' => __( 'Default', 'so-widgets-bundle' ),
196
+ 'custom' => __( 'Custom', 'so-widgets-bundle' ),
197
+ 'raw_json' => __( 'Predefined Styles', 'so-widgets-bundle' ),
198
  )
199
  ),
200
  'styled_map_name' => array(
203
  'style_method[default]' => array('hide'),
204
  '_else[style_method]' => array('show'),
205
  ),
206
+ 'label' => __( 'Styled map name', 'so-widgets-bundle' )
207
  ),
208
  'raw_json_map_styles' => array(
209
  'type' => 'textarea',
213
  ),
214
  'rows' => 5,
215
  'hidden' => true,
216
+ 'label' => __( 'Raw JSON styles', 'so-widgets-bundle' ),
217
+ 'description' => __( 'Copy and paste predefined styles here from <a href="http://snazzymaps.com/" target="_blank">Snazzy Maps</a>.', 'so-widgets-bundle' )
218
  ),
219
  'custom_map_styles' => array(
220
  'type' => 'repeater',
222
  'style_method[custom]' => array('show'),
223
  '_else[style_method]' => array('hide'),
224
  ),
225
+ 'label' => __( 'Custom map styles', 'so-widgets-bundle' ),
226
+ 'item_name' => __( 'Style', 'so-widgets-bundle' ),
227
  'item_label' => array(
228
  'selector' => "[id*='custom_map_styles-map_feature'] :selected",
229
  'update_event' => 'change',
233
  'map_feature' => array(
234
  'type' => 'select',
235
  'label' => '',
236
+ 'prompt' => __( 'Select map feature to style', 'so-widgets-bundle' ),
237
  'options' => array(
238
+ 'water' => __( 'Water', 'so-widgets-bundle' ),
239
+ 'road_highway' => __( 'Highways', 'so-widgets-bundle' ),
240
+ 'road_arterial' => __( 'Arterial roads', 'so-widgets-bundle' ),
241
+ 'road_local' => __( 'Local roads', 'so-widgets-bundle' ),
242
+ 'transit_line' => __( 'Transit lines', 'so-widgets-bundle' ),
243
+ 'transit_station' => __( 'Transit stations', 'so-widgets-bundle' ),
244
+ 'landscape_man-made' => __( 'Man-made landscape', 'so-widgets-bundle' ),
245
+ 'landscape_natural_landcover' => __( 'Natural landscape landcover', 'so-widgets-bundle' ),
246
+ 'landscape_natural_terrain' => __( 'Natural landscape terrain', 'so-widgets-bundle' ),
247
+ 'poi_attraction' => __( 'Point of interest - Attractions', 'so-widgets-bundle' ),
248
+ 'poi_business' => __( 'Point of interest - Business', 'so-widgets-bundle' ),
249
+ 'poi_government' => __( 'Point of interest - Government', 'so-widgets-bundle' ),
250
+ 'poi_medical' => __( 'Point of interest - Medical', 'so-widgets-bundle' ),
251
+ 'poi_park' => __( 'Point of interest - Parks', 'so-widgets-bundle' ),
252
+ 'poi_place-of-worship' => __( 'Point of interest - Places of worship', 'so-widgets-bundle' ),
253
+ 'poi_school' => __( 'Point of interest - Schools', 'so-widgets-bundle' ),
254
+ 'poi_sports-complex' => __( 'Point of interest - Sports complexes', 'so-widgets-bundle' ),
255
  )
256
  ),
257
  'element_type' => array(
258
  'type' => 'select',
259
+ 'label' => __( 'Select element type to style', 'so-widgets-bundle' ),
260
  'options' => array(
261
+ 'geometry' => __( 'Geometry', 'so-widgets-bundle' ),
262
+ 'labels' => __( 'Labels', 'so-widgets-bundle' ),
263
+ 'all' => __( 'All', 'so-widgets-bundle' ),
264
  )
265
  ),
266
  'visibility' => array(
267
  'type' => 'checkbox',
268
  'default' => true,
269
+ 'label' => __( 'Visible', 'so-widgets-bundle' )
270
  ),
271
  'color' => array(
272
  'type' => 'color',
273
+ 'label' => __( 'Color', 'so-widgets-bundle' )
274
  )
275
  )
276
  )
278
  ),
279
  'directions' => array(
280
  'type' => 'section',
281
+ 'label' => __( 'Directions', 'so-widgets-bundle' ),
282
  'state_handler' => array(
283
  'map_type[interactive]' => array('show'),
284
  '_else[map_type]' => array('hide'),
285
  ),
286
  'hide' => true,
287
+ 'description' => __( 'Display a route on your map, with waypoints between your starting point and destination.', 'so-widgets-bundle' ),
288
  'fields' => array(
289
  'origin' => array(
290
  'type' => 'text',
291
+ 'label' => __( 'Starting point', 'so-widgets-bundle' )
292
  ),
293
  'destination' => array(
294
  'type' => 'text',
295
+ 'label' => __( 'Destination', 'so-widgets-bundle' )
296
  ),
297
  'travel_mode' => array(
298
  'type' => 'select',
299
+ 'label' => __( 'Travel mode', 'so-widgets-bundle' ),
300
  'default' => 'driving',
301
  'options' => array(
302
+ 'driving' => __( 'Driving', 'so-widgets-bundle' ),
303
+ 'walking' => __( 'Walking', 'so-widgets-bundle' ),
304
+ 'bicycling' => __( 'Bicycling', 'so-widgets-bundle' ),
305
+ 'transit' => __( 'Transit', 'so-widgets-bundle' )
306
  )
307
  ),
308
  'avoid_highways' => array(
309
  'type' => 'checkbox',
310
+ 'label' => __( 'Avoid highways', 'so-widgets-bundle' ),
311
  ),
312
  'avoid_tolls' => array(
313
  'type' => 'checkbox',
314
+ 'label' => __( 'Avoid tolls', 'so-widgets-bundle' ),
315
  ),
316
  'waypoints' => array(
317
  'type' => 'repeater',
318
+ 'label' => __( 'Waypoints', 'so-widgets-bundle' ),
319
+ 'item_name' => __( 'Waypoint', 'so-widgets-bundle' ),
320
  'item_label' => array(
321
  'selector' => "[id*='waypoints-location']",
322
  'update_event' => 'change',
326
  'location' => array(
327
  'type' => 'textarea',
328
  'rows' => 2,
329
+ 'label' => __( 'Location', 'so-widgets-bundle' )
330
  ),
331
  'stopover' => array(
332
  'type' => 'checkbox',
333
  'default' => true,
334
+ 'label' => __( 'Stopover', 'so-widgets-bundle' ),
335
+ 'description' => __( 'Whether or not this is a stop on the route or just a route preference.', 'so-widgets-bundle' )
336
  )
337
  )
338
  ),
339
  'optimize_waypoints' => array(
340
  'type' => 'checkbox',
341
+ 'label' => __( 'Optimize waypoints', 'so-widgets-bundle' ),
342
  'default' => false,
343
+ 'description' => __( 'Allow the Google Maps service to reorder waypoints for the shortest travelling distance.', 'so-widgets-bundle' )
344
  )
345
  )
346
  ),
347
  'api_key_section' => array(
348
  'type' => 'section',
349
+ 'label' => __( 'API key', 'so-widgets-bundle' ),
350
  'hide' => true,
351
  'fields' => array(
352
  'api_key' => array(
353
  'type' => 'text',
354
+ 'label' => __( 'API key', 'so-widgets-bundle' ),
355
+ 'description' => __( 'Enter your API key if you have one. This enables you to monitor your Google Maps API usage in the Google APIs Console.', 'so-widgets-bundle' ),
356
  'optional' => true
357
  )
358
  )
366
  array(
367
  array(
368
  'sow-google-map',
369
+ plugin_dir_url(__FILE__) . 'js/js-map' . SOW_BUNDLE_JS_SUFFIX . '.js',
370
  array( 'jquery' ),
371
  SOW_BUNDLE_VERSION . mt_rand()
372
  )
376
  array(
377
  array(
378
  'sow-google-map',
379
+ plugin_dir_url(__FILE__) . 'css/style.css',
380
  array(),
381
  SOW_BUNDLE_VERSION
382
  )
479
  if ( empty( $style_config['raw_json_map_styles'] ) ) {
480
  return array();
481
  } else {
482
+ $map_name = ! empty( $style_config['styled_map_name'] ) ? $style_config['styled_map_name'] : __( 'Custom Map', 'so-widgets-bundle' );
483
  $styles_string = $style_config['raw_json_map_styles'];
484
 
485
  return array( 'map_name' => $map_name, 'styles' => json_decode( $styles_string, true ) );
568
  }
569
  }
570
 
571
+ siteorigin_widget_register( 'sow-google-map', __FILE__, 'SiteOrigin_Widget_GoogleMap_Widget' );
widgets/so-headline-widget/assets/banner.svg CHANGED
@@ -1,38 +1,38 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
4
- <svg version="1.0" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
- width="480px" height="240px" viewBox="0 0 480 240" enable-background="new 0 0 480 240" xml:space="preserve">
6
- <rect id="Headline_1_" fill="#1880B6" width="480" height="240"/>
7
- <g>
8
- <g>
9
- <path fill="#8ED9EF" d="M295.977,56H204c-1.938,0-4,2.375-4,4v91.999c0,4.419-3.583,8-8.001,8c-1.105,0-2-0.894-2-1.999
10
- s0.895-1.999,2-1.999c2.209,0,4.001-1.79,4.001-4.002v-52h-12c-2.125,0-4,2.251-4,4.001v55.999c0,9.751,6.375,16.001,12,16.001
11
- H288c5.875,0,12-6,12-12V60C300,57.875,298,56,295.977,56z M284,112c0,2.211-1.791,4-4,4h-60c-2.208,0-4-1.789-4-4V87.999
12
- c0-2.21,1.791-4,4-4h60c2.209,0,4,1.79,4,4V112z"/>
13
- </g>
14
- <g>
15
- <path fill="#324249" d="M280,83.999h-60c-2.208,0-4,1.79-4,4V112c0,2.211,1.791,4,4,4h60c2.209,0,4-1.789,4-4V87.999
16
- C284,85.789,282.209,83.999,280,83.999z M280,112h-60V87.999h60V112z"/>
17
- <path fill="#324249" d="M296,52h-92c-4.402,0-8,3.874-8,7.977v36.024h-12c-4.25,0-8,4.124-8,7.975v56.023
18
- C176,172,183.687,180,192,180H288c8.125,0,16-8,16-16V60C304,55.598,300.313,52,296,52z M300,164c0,6-6.125,12-12,12H192
19
- c-5.625,0-12-6.25-12-16.001V104c0-1.75,1.875-4.001,4-4.001h12v52c0,2.212-1.792,4.002-4.001,4.002c-1.105,0-2,0.894-2,1.999
20
- s0.895,1.999,2,1.999c4.418,0,8.001-3.581,8.001-8V60c0-1.625,2.062-4,4-4h91.977C298,56,300,57.875,300,60V164z"/>
21
- </g>
22
- <g opacity="0.2">
23
- <path d="M218,76h24c1.106,0,2-0.895,2-2c0-1.104-0.894-2-2-2h-24c-1.105,0-2,0.896-2,2C216,75.105,216.895,76,218,76z"/>
24
- <path d="M218,128h36c1.106,0,2.001-0.895,2.001-1.999c0-1.106-0.895-2.001-2.001-2.001h-36c-1.105,0-2,0.895-2,2.001
25
- C216,127.105,216.895,128,218,128z"/>
26
- <path d="M262,128h20c1.106,0,2-0.895,2-1.999c0-1.106-0.894-2.001-2-2.001h-20c-1.105,0-2,0.895-2,2.001
27
- C260,127.105,260.895,128,262,128z"/>
28
- <path d="M282,147.999h-36c-1.105,0-2,0.896-2,2.001s0.895,1.999,2,1.999h36c1.106,0,2-0.894,2-1.999S283.105,147.999,282,147.999z
29
- "/>
30
- <path d="M238,147.999h-20c-1.105,0-2,0.896-2,2.001s0.895,1.999,2,1.999h20c1.105,0,2-0.894,2-1.999S239.105,147.999,238,147.999z
31
- "/>
32
- <path d="M218,140h12c1.105,0,2-0.895,2-2c0-1.106-0.895-2-2-2h-12c-1.105,0-2,0.894-2,2C216,139.105,216.895,140,218,140z"/>
33
- <path d="M238,136c-1.106,0-2,0.894-2,2c0,1.105,0.894,2,2,2h12c1.106,0,2-0.895,2-2c0-1.106-0.894-2-2-2H238z"/>
34
- <path d="M282,136H258c-1.106,0-2,0.894-2,2c0,1.105,0.894,2,2,2H282c1.106,0,2-0.895,2-2C284,136.894,283.105,136,282,136z"/>
35
- </g>
36
- <rect x="220" y="87.999" fill="#F2F0DA" width="60" height="24.001"/>
37
- </g>
38
- </svg>
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="55 277 240 240" style="enable-background:new 55 277 240 240;" xml:space="preserve">
5
+ <style type="text/css">
6
+ .st0{fill:#1880B6;}
7
+ .st1{fill:#8ED9EF;}
8
+ .st2{fill:#324249;}
9
+ .st3{opacity:0.2;}
10
+ .st4{fill:#F2F0DA;}
11
+ </style>
12
+ <rect id="Headline_1_" x="55" y="277" class="st0" width="240" height="240"/>
13
+ <g>
14
+ <g>
15
+ <path class="st1" d="M231,333h-92c-1.9,0-4,2.4-4,4v92c0,4.4-3.6,8-8,8c-1.1,0-2-0.9-2-2s0.9-2,2-2c2.2,0,4-1.8,4-4v-52h-12
16
+ c-2.1,0-4,2.3-4,4v56c0,9.8,6.4,16,12,16h96c5.9,0,12-6,12-12V337C235,334.9,233,333,231,333z M219,389c0,2.2-1.8,4-4,4h-60
17
+ c-2.2,0-4-1.8-4-4v-24c0-2.2,1.8-4,4-4h60c2.2,0,4,1.8,4,4V389z"/>
18
+ </g>
19
+ <g>
20
+ <path class="st2" d="M215,361h-60c-2.2,0-4,1.8-4,4v24c0,2.2,1.8,4,4,4h60c2.2,0,4-1.8,4-4v-24C219,362.8,217.2,361,215,361z
21
+ M215,389h-60v-24h60V389z"/>
22
+ <path class="st2" d="M231,329h-92c-4.4,0-8,3.9-8,8v36h-12c-4.2,0-8,4.1-8,8v56c0,12,7.7,20,16,20h96c8.1,0,16-8,16-16V337
23
+ C239,332.6,235.3,329,231,329z M235,441c0,6-6.1,12-12,12h-96c-5.6,0-12-6.2-12-16v-56c0-1.8,1.9-4,4-4h12v52c0,2.2-1.8,4-4,4
24
+ c-1.1,0-2,0.9-2,2c0,1.1,0.9,2,2,2c4.4,0,8-3.6,8-8v-92c0-1.6,2.1-4,4-4h92c2,0,4,1.9,4,4V441z"/>
25
+ </g>
26
+ <g class="st3">
27
+ <path d="M153,353h24c1.1,0,2-0.9,2-2c0-1.1-0.9-2-2-2h-24c-1.1,0-2,0.9-2,2C151,352.1,151.9,353,153,353z"/>
28
+ <path d="M153,405h36c1.1,0,2-0.9,2-2c0-1.1-0.9-2-2-2h-36c-1.1,0-2,0.9-2,2C151,404.1,151.9,405,153,405z"/>
29
+ <path d="M197,405h20c1.1,0,2-0.9,2-2c0-1.1-0.9-2-2-2h-20c-1.1,0-2,0.9-2,2C195,404.1,195.9,405,197,405z"/>
30
+ <path d="M217,425h-36c-1.1,0-2,0.9-2,2s0.9,2,2,2h36c1.1,0,2-0.9,2-2S218.1,425,217,425z"/>
31
+ <path d="M173,425h-20c-1.1,0-2,0.9-2,2s0.9,2,2,2h20c1.1,0,2-0.9,2-2S174.1,425,173,425z"/>
32
+ <path d="M153,417h12c1.1,0,2-0.9,2-2c0-1.1-0.9-2-2-2h-12c-1.1,0-2,0.9-2,2C151,416.1,151.9,417,153,417z"/>
33
+ <path d="M173,413c-1.1,0-2,0.9-2,2c0,1.1,0.9,2,2,2h12c1.1,0,2-0.9,2-2c0-1.1-0.9-2-2-2H173z"/>
34
+ <path d="M217,413h-24c-1.1,0-2,0.9-2,2c0,1.1,0.9,2,2,2h24c1.1,0,2-0.9,2-2C219,413.9,218.1,413,217,413z"/>
35
+ </g>
36
+ <rect x="155" y="365" class="st4" width="60" height="24"/>
37
+ </g>
38
+ </svg>
widgets/so-headline-widget/so-headline-widget.php CHANGED
@@ -1,10 +1,10 @@
1
  <?php
2
 
3
  /*
4
- Widget Name: Headline widget
5
  Description: A headline to headline all headlines.
6
  Author: SiteOrigin
7
- Author URI: http://siteorigin.com
8
  */
9
 
10
  class SiteOrigin_Widget_Headline_Widget extends SiteOrigin_Widget {
@@ -13,110 +13,136 @@ class SiteOrigin_Widget_Headline_Widget extends SiteOrigin_Widget {
13
 
14
  parent::__construct(
15
  'sow-headline',
16
- __( 'SiteOrigin Headline', 'siteorigin-widgets' ),
17
  array(
18
- 'description' => __( 'A headline widget.', 'siteorigin-widgets' )
19
  ),
20
  array(),
21
  array(
22
  'headline' => array(
23
  'type' => 'section',
24
- 'label' => __( 'Headline', 'siteorigin-widgets' ),
25
  'hide' => false,
26
  'fields' => array(
27
  'text' => array(
28
  'type' => 'text',
29
- 'label' => __( 'Text', 'siteorigin-widgets' ),
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  ),
31
  'font' => array(
32
  'type' => 'font',
33
- 'label' => __( 'Font', 'siteorigin-widgets' ),
34
  'default' => 'default'
35
  ),
36
  'color' => array(
37
  'type' => 'color',
38
- 'label' => __('Color', 'siteorigin-widgets'),
39
  'default' => '#000000'
40
  ),
41
  'align' => array(
42
  'type' => 'select',
43
- 'label' => __( 'Align', 'siteorigin-widgets' ),
44
  'default' => 'center',
45
  'options' => array(
46
- 'center' => __( 'Center', 'siteorigin-widgets' ),
47
- 'left' => __( 'Left', 'siteorigin-widgets' ),
48
- 'right' => __( 'Right', 'siteorigin-widgets' ),
49
- 'justify' => __( 'Justify', 'siteorigin-widgets' )
50
  )
51
  )
52
  )
53
  ),
54
  'sub_headline' => array(
55
  'type' => 'section',
56
- 'label' => __( 'Sub headline', 'siteorigin-widgets' ),
57
  'hide' => true,
58
  'fields' => array(
59
  'text' => array(
60
  'type' => 'text',
61
- 'label' => __('Text', 'siteorigin-widgets')
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  ),
63
  'font' => array(
64
  'type' => 'font',
65
- 'label' => __( 'Font', 'siteorigin-widgets' ),
66
  'default' => 'default'
67
  ),
68
  'color' => array(
69
  'type' => 'color',
70
- 'label' => __('Color', 'siteorigin-widgets'),
71
  'default' => '#000000'
72
  ),
73
  'align' => array(
74
  'type' => 'select',
75
- 'label' => __( 'Align', 'siteorigin-widgets' ),
76
  'default' => 'center',
77
  'options' => array(
78
- 'center' => __( 'Center', 'siteorigin-widgets' ),
79
- 'left' => __( 'Left', 'siteorigin-widgets' ),
80
- 'right' => __( 'Right', 'siteorigin-widgets' ),
81
- 'justify' => __( 'Justify', 'siteorigin-widgets' )
82
  )
83
  )
84
  )
85
  ),
86
  'divider' => array(
87
  'type' => 'section',
88
- 'label' => __( 'Divider', 'siteorigin-widgets' ),
89
  'hide' => true,
90
  'fields' => array(
91
  'style' => array(
92
  'type' => 'select',
93
- 'label' => __( 'Style', 'siteorigin-widgets' ),
94
  'default' => 'solid',
95
  'options' => array(
96
- 'none' => __('None', 'siteorigin-widgets'),
97
- 'solid' => __('Solid', 'siteorigin-widgets'),
98
- 'dotted' => __('Dotted', 'siteorigin-widgets'),
99
- 'dashed' => __('Dashed', 'siteorigin-widgets'),
100
- 'double' => __('Double', 'siteorigin-widgets'),
101
- 'groove' => __('Groove', 'siteorigin-widgets'),
102
- 'ridge' => __('Ridge', 'siteorigin-widgets'),
103
- 'inset' => __('Inset', 'siteorigin-widgets'),
104
- 'outset' => __('Outset', 'siteorigin-widgets'),
105
  )
106
  ),
107
  'weight' => array(
108
  'type' => 'select',
109
- 'label' => __( 'Weight', 'siteorigin-widgets' ),
110
  'default' => 'thin',
111
  'options' => array(
112
- 'thin' => __( 'Thin', 'siteorigin-widgets' ),
113
- 'medium' => __( 'Medium', 'siteorigin-widgets' ),
114
- 'thick' => __( 'Thick', 'siteorigin-widgets' ),
115
  )
116
  ),
117
  'color' => array(
118
  'type' => 'color',
119
- 'label' => __('Color', 'siteorigin-widgets'),
120
  'default' => '#EEEEEE'
121
  )
122
  )
@@ -134,6 +160,9 @@ class SiteOrigin_Widget_Headline_Widget extends SiteOrigin_Widget {
134
 
135
  if ( ! empty( $instance['headline'] ) ) {
136
  $headline_styles = $instance['headline'];
 
 
 
137
  if ( ! empty( $headline_styles['align'] ) ) {
138
  $less_vars['headline_align'] = $headline_styles['align'];
139
  }
@@ -154,6 +183,9 @@ class SiteOrigin_Widget_Headline_Widget extends SiteOrigin_Widget {
154
  if ( ! empty( $sub_headline_styles['align'] ) ) {
155
  $less_vars['sub_headline_align'] = $sub_headline_styles['align'];
156
  }
 
 
 
157
  if ( ! empty( $sub_headline_styles['color'] ) ) {
158
  $less_vars['sub_headline_color'] = $sub_headline_styles['color'];
159
  }
@@ -237,10 +269,12 @@ class SiteOrigin_Widget_Headline_Widget extends SiteOrigin_Widget {
237
 
238
  return array(
239
  'headline' => $instance['headline']['text'],
 
240
  'sub_headline' => $instance['sub_headline']['text'],
 
241
  'has_divider' => ! empty( $instance['divider'] ) && $instance['divider']['style'] != 'none'
242
  );
243
  }
244
  }
245
 
246
- siteorigin_widget_register('headline', __FILE__);
1
  <?php
2
 
3
  /*
4
+ Widget Name: Headline
5
  Description: A headline to headline all headlines.
6
  Author: SiteOrigin
7
+ Author URI: https://siteorigin.com
8
  */
9
 
10
  class SiteOrigin_Widget_Headline_Widget extends SiteOrigin_Widget {
13
 
14
  parent::__construct(
15
  'sow-headline',
16
+ __( 'SiteOrigin Headline', 'so-widgets-bundle' ),
17
  array(
18
+ 'description' => __( 'A headline widget.', 'so-widgets-bundle' )
19
  ),
20
  array(),
21
  array(
22
  'headline' => array(
23
  'type' => 'section',
24
+ 'label' => __( 'Headline', 'so-widgets-bundle' ),
25
  'hide' => false,
26
  'fields' => array(
27
  'text' => array(
28
  'type' => 'text',
29
+ 'label' => __( 'Text', 'so-widgets-bundle' ),
30
+ ),
31
+ 'tag' => array(
32
+ 'type' => 'select',
33
+ 'label' => __( 'H Tag', 'so-widgets-bundle' ),
34
+ 'default' => 'h1',
35
+ 'options' => array(
36
+ 'h1' => __( 'H1', 'so-widgets-bundle' ),
37
+ 'h2' => __( 'H2', 'so-widgets-bundle' ),
38
+ 'h3' => __( 'H3', 'so-widgets-bundle' ),
39
+ 'h4' => __( 'H4', 'so-widgets-bundle' ),
40
+ 'h5' => __( 'H5', 'so-widgets-bundle' ),
41
+ 'h6' => __( 'H6', 'so-widgets-bundle' ),
42
+ )
43
  ),
44
  'font' => array(
45
  'type' => 'font',
46
+ 'label' => __( 'Font', 'so-widgets-bundle' ),
47
  'default' => 'default'
48
  ),
49
  'color' => array(
50
  'type' => 'color',
51
+ 'label' => __('Color', 'so-widgets-bundle'),
52
  'default' => '#000000'
53
  ),
54
  'align' => array(
55
  'type' => 'select',
56
+ 'label' => __( 'Align', 'so-widgets-bundle' ),
57
  'default' => 'center',
58
  'options' => array(
59
+ 'center' => __( 'Center', 'so-widgets-bundle' ),
60
+ 'left' => __( 'Left', 'so-widgets-bundle' ),
61
+ 'right' => __( 'Right', 'so-widgets-bundle' ),
62
+ 'justify' => __( 'Justify', 'so-widgets-bundle' )
63
  )
64
  )
65
  )
66
  ),
67
  'sub_headline' => array(
68
  'type' => 'section',
69
+ 'label' => __( 'Sub headline', 'so-widgets-bundle' ),
70
  'hide' => true,
71
  'fields' => array(
72
  'text' => array(
73
  'type' => 'text',
74
+ 'label' => __('Text', 'so-widgets-bundle')
75
+ ),
76
+ 'tag' => array(
77
+ 'type' => 'select',
78
+ 'label' => __( 'H Tag', 'so-widgets-bundle' ),
79
+ 'default' => 'h3',
80
+ 'options' => array(
81
+ 'h1' => __( 'H1', 'so-widgets-bundle' ),
82
+ 'h2' => __( 'H2', 'so-widgets-bundle' ),
83
+ 'h3' => __( 'H3', 'so-widgets-bundle' ),
84
+ 'h4' => __( 'H4', 'so-widgets-bundle' ),
85
+ 'h5' => __( 'H5', 'so-widgets-bundle' ),
86
+ 'h6' => __( 'H6', 'so-widgets-bundle' ),
87
+ )
88
  ),
89
  'font' => array(
90
  'type' => 'font',
91
+ 'label' => __( 'Font', 'so-widgets-bundle' ),
92
  'default' => 'default'
93
  ),
94
  'color' => array(
95
  'type' => 'color',
96
+ 'label' => __('Color', 'so-widgets-bundle'),
97
  'default' => '#000000'
98
  ),
99
  'align' => array(
100
  'type' => 'select',
101
+ 'label' => __( 'Align', 'so-widgets-bundle' ),
102
  'default' => 'center',
103
  'options' => array(
104
+ 'center' => __( 'Center', 'so-widgets-bundle' ),
105
+ 'left' => __( 'Left', 'so-widgets-bundle' ),
106
+ 'right' => __( 'Right', 'so-widgets-bundle' ),
107
+ 'justify' => __( 'Justify', 'so-widgets-bundle' )
108
  )
109
  )
110
  )
111
  ),
112
  'divider' => array(
113
  'type' => 'section',
114
+ 'label' => __( 'Divider', 'so-widgets-bundle' ),
115
  'hide' => true,
116
  'fields' => array(
117
  'style' => array(
118
  'type' => 'select',
119
+ 'label' => __( 'Style', 'so-widgets-bundle' ),
120
  'default' => 'solid',
121
  'options' => array(
122
+ 'none' => __('None', 'so-widgets-bundle'),
123
+ 'solid' => __('Solid', 'so-widgets-bundle'),
124
+ 'dotted' => __('Dotted', 'so-widgets-bundle'),
125
+ 'dashed' => __('Dashed', 'so-widgets-bundle'),
126
+ 'double' => __('Double', 'so-widgets-bundle'),
127
+ 'groove' => __('Groove', 'so-widgets-bundle'),
128
+ 'ridge' => __('Ridge', 'so-widgets-bundle'),
129
+ 'inset' => __('Inset', 'so-widgets-bundle'),
130
+ 'outset' => __('Outset', 'so-widgets-bundle'),
131
  )
132
  ),
133
  'weight' => array(
134
  'type' => 'select',
135
+ 'label' => __( 'Weight', 'so-widgets-bundle' ),
136
  'default' => 'thin',
137
  'options' => array(
138
+ 'thin' => __( 'Thin', 'so-widgets-bundle' ),
139
+ 'medium' => __( 'Medium', 'so-widgets-bundle' ),
140
+ 'thick' => __( 'Thick', 'so-widgets-bundle' ),
141
  )
142
  ),
143
  'color' => array(
144
  'type' => 'color',
145
+ 'label' => __('Color', 'so-widgets-bundle'),
146
  'default' => '#EEEEEE'
147
  )
148
  )
160
 
161
  if ( ! empty( $instance['headline'] ) ) {
162
  $headline_styles = $instance['headline'];
163
+ if ( ! empty( $headline_styles['tag'] ) ) {
164
+ $less_vars['headline_tag'] = $headline_styles['tag'];
165
+ }
166
  if ( ! empty( $headline_styles['align'] ) ) {
167
  $less_vars['headline_align'] = $headline_styles['align'];
168
  }
183
  if ( ! empty( $sub_headline_styles['align'] ) ) {
184
  $less_vars['sub_headline_align'] = $sub_headline_styles['align'];
185
  }
186
+ if ( ! empty( $sub_headline_styles['tag'] ) ) {
187
+ $less_vars['sub_headline_tag'] = $sub_headline_styles['tag'];
188
+ }
189
  if ( ! empty( $sub_headline_styles['color'] ) ) {
190
  $less_vars['sub_headline_color'] = $sub_headline_styles['color'];
191
  }
269
 
270
  return array(
271
  'headline' => $instance['headline']['text'],
272
+ 'headline_tag' => $instance['headline']['tag'],
273
  'sub_headline' => $instance['sub_headline']['text'],
274
+ 'sub_headline_tag' => $instance['sub_headline']['tag'],
275
  'has_divider' => ! empty( $instance['divider'] ) && $instance['divider']['style'] != 'none'
276
  );
277
  }
278
  }
279
 
280
+ siteorigin_widget_register('sow-headline', __FILE__, 'SiteOrigin_Widget_Headline_Widget');
widgets/so-headline-widget/styles/sow-headline.less CHANGED
@@ -2,11 +2,13 @@
2
 
3
  .widget-function('import_google_font');
4
 
 
5
  @headline_font: "Lucida Grande", sans-serif;
6
  @headline_font_weight: 400;
7
  @headline_align: left;
8
  @headline_color: #000000;
9
 
 
10
  @sub_headline_font: "Arial", sans-serif;
11
  @sub_headline_font_weight: 400;
12
  @sub_headline_align: left;
@@ -18,18 +20,20 @@
18
 
19
  #sow-headline-container.sow-headline {
20
 
21
- h1 {
22
  .font(@headline_font, @headline_font_weight);
23
  text-align: @headline_align;
24
  color: @headline_color;
25
  line-height: 1.3;
 
26
  }
27
 
28
- h3 {
29
  .font(@sub_headline_font, @sub_headline_font_weight);
30
  text-align: @sub_headline_align;
31
  color: @sub_headline_color;
32
  line-height: 1.3;
 
33
  }
34
 
35
  .decoration {
2
 
3
  .widget-function('import_google_font');
4
 
5
+ @headline_tag: h1;
6
  @headline_font: "Lucida Grande", sans-serif;
7
  @headline_font_weight: 400;
8
  @headline_align: left;
9
  @headline_color: #000000;
10
 
11
+ @sub_headline_tag: h3;
12
  @sub_headline_font: "Arial", sans-serif;
13
  @sub_headline_font_weight: 400;
14
  @sub_headline_align: left;
20
 
21
  #sow-headline-container.sow-headline {
22
 
23
+ @{headline_tag} {
24
  .font(@headline_font, @headline_font_weight);
25
  text-align: @headline_align;
26
  color: @headline_color;
27
  line-height: 1.3;
28
+ word-break: break-all;
29
  }
30
 
31
+ @{sub_headline_tag} {
32
  .font(@sub_headline_font, @sub_headline_font_weight);
33
  text-align: @sub_headline_align;
34
  color: @sub_headline_color;
35
  line-height: 1.3;
36
+ word-break: break-all;
37
  }
38
 
39
  .decoration {
widgets/so-headline-widget/tpl/headline.php CHANGED
@@ -1,7 +1,7 @@
1
  <div id="sow-headline-container" class="sow-headline">
2
 
3
  <?php if ( !empty( $headline ) ) : ?>
4
- <h1><?php echo $headline ?></h1>
5
  <?php endif; ?>
6
 
7
  <?php if ( $has_divider ) : ?>
@@ -11,7 +11,7 @@
11
  <?php endif; ?>
12
 
13
  <?php if ( !empty( $sub_headline ) ) : ?>
14
- <h3><?php echo $sub_headline ?></h3>
15
  <?php endif; ?>
16
 
17
  </div>
1
  <div id="sow-headline-container" class="sow-headline">
2
 
3
  <?php if ( !empty( $headline ) ) : ?>
4
+ <<?php echo $headline_tag ?>><?php echo $headline ?></<?php echo $headline_tag ?>>
5
  <?php endif; ?>
6
 
7
  <?php if ( $has_divider ) : ?>
11
  <?php endif; ?>
12
 
13
  <?php if ( !empty( $sub_headline ) ) : ?>
14
+ <<?php echo $sub_headline_tag ?>><?php echo $sub_headline ?></<?php echo $sub_headline_tag ?>>
15
  <?php endif; ?>
16
 
17
  </div>
widgets/so-hero-widget/assets/banner.svg CHANGED
@@ -1,44 +1,40 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
4
- <svg version="1.0" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
- width="480px" height="240px" viewBox="0 0 480 240" enable-background="new 0 0 480 240" xml:space="preserve">
6
- <rect id="Image_Slider_1_" y="0.001" fill="#1880B6" width="480" height="240"/>
7
- <g>
8
- <g>
9
- <path fill="#8ED9EF" d="M284,72.001h-88c-2.211,0-4,1.789-4,4v72.743l22.375-22.383c3.129-3.126,8.188-3.126,11.312,0
10
- l10.305,10.304l22.344-30.343c3.125-3.126,8.184-3.126,11.312,0L288,124.674V76.001C288,73.79,286.211,72.001,284,72.001z"/>
11
- <path fill="#8ED9EF" d="M180,84.002v72c0,2.21,1.788,4,4,4h4.001V80.001H184C181.788,80.001,180,81.79,180,84.002z"/>
12
- <path fill="#8ED9EF" d="M296,79.993h-4.001v80.001H296c2.211,0,4-1.79,4-4.001V83.994C300,81.783,298.211,79.993,296,79.993z"/>
13
- </g>
14
- <g>
15
- <path fill="#324249" d="M296,75.993h-4.001v0.008c0-4.421-3.577-7.999-7.999-7.999h-88c-4.422,0-7.999,3.578-7.999,7.999H184
16
- c-4.422,0-8,3.578-8,8.001v72c0,4.422,3.578,7.999,8,7.999h4.001c0,4.423,3.577,8.001,7.999,8.001h88
17
- c4.422,0,7.999-3.578,7.999-8.001v-0.007H296c4.422,0,8-3.579,8-8.001V83.994C304,79.571,300.422,75.993,296,75.993z
18
- M188.001,160.002H184c-2.212,0-4-1.79-4-4v-72c0-2.212,1.788-4.001,4-4.001h4.001V160.002z M288,164.001c0,2.212-1.789,4-4,4h-88
19
- c-2.211,0-4-1.788-4-4v-9.602l25.203-25.203c1.562-1.562,4.094-1.562,5.655,0c0,0,8.399,8.391,10.306,10.298
20
- c1.906,1.905,3.757,1.897,5.656,0c1.898-1.899,22.344-30.344,22.344-30.344c1.562-1.563,4.094-1.563,5.656,0L288,130.337V164.001z
21
- M288,124.674l-18.352-18.352c-3.129-3.126-8.188-3.126-11.312,0l-22.344,30.343l-10.305-10.304
22
- c-3.125-3.126-8.184-3.126-11.312,0L192,148.744V76.001c0-2.211,1.789-4,4-4h88c2.211,0,4,1.789,4,4V124.674z M300,155.993
23
- c0,2.211-1.789,4.001-4,4.001h-4.001V79.993H296c2.211,0,4,1.79,4,4.001V155.993z"/>
24
- <path fill="#324249" d="M234.008,96.001h-6.203c-0.259-1.272-0.766-2.461-1.461-3.507l4.391-4.391
25
- c0.785-0.782,0.785-2.047,0-2.829c-0.78-0.781-2.047-0.781-2.828,0l-4.391,4.391c-1.051-0.695-2.233-1.203-3.508-1.461v-6.202
26
- c0-1.109-0.895-2.001-2-2.001c-1.109,0-2.004,0.892-2.004,2.001v6.202c-1.273,0.258-2.456,0.766-3.508,1.461l-4.391-4.398
27
- c-0.781-0.773-2.043-0.773-2.832,0c-0.777,0.79-0.777,2.055,0.004,2.837l4.391,4.391c-0.695,1.046-1.203,2.227-1.461,3.507h-6.203
28
- c-1.105,0-1.996,0.892-2.004,2.001c0.008,1.109,0.902,2,2.004,2h6.203c0.258,1.272,0.766,2.461,1.461,3.508l-4.395,4.391
29
- c-0.777,0.781-0.777,2.046,0,2.836c0.789,0.78,2.051,0.772,2.832-0.009l4.391-4.39c1.052,0.695,2.23,1.202,3.508,1.461v6.203
30
- c0,1.109,0.895,2,2.004,2.007c1.109-0.007,2-0.897,2-2.007v-6.203c1.274-0.259,2.457-0.766,3.508-1.461l4.391,4.398
31
- c0.781,0.78,2.048,0.78,2.832,0c0.781-0.79,0.777-2.055-0.004-2.836l-4.391-4.391c0.695-1.047,1.202-2.227,1.461-3.508h6.203
32
- c1.105,0.008,2-0.891,2-2S235.113,96.001,234.008,96.001z M218.008,104.001c-3.312,0-6-2.68-6.004-5.991l0.004-0.008
33
- c0,0-0.004,0-0.004-0.009c0.004-3.312,2.691-5.992,6.004-5.992s6,2.688,6,6.001C224.008,101.313,221.32,104.001,218.008,104.001z"
34
- />
35
- </g>
36
- <g>
37
- <path fill="#F2F0DA" d="M266.82,109.15c-1.562-1.563-4.094-1.563-5.656,0c0,0-20.445,28.444-22.344,30.344
38
- c-1.899,1.897-3.75,1.905-5.656,0c-1.906-1.907-10.306-10.298-10.306-10.298c-1.562-1.562-4.093-1.562-5.655,0L192,154.399v9.602
39
- c0,2.212,1.789,4,4,4h88c2.211,0,4-1.788,4-4v-33.664L266.82,109.15z"/>
40
- <path fill="#F2F0DA" d="M218.001,104.001c3.315,0,5.999-2.688,5.999-5.999c0-3.313-2.684-6.001-5.999-6.001
41
- c-3.318,0-6.001,2.688-6.001,6.001C212,101.313,214.683,104.001,218.001,104.001z"/>
42
- </g>
43
- </g>
44
- </svg>
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="55 277 240 240" style="enable-background:new 55 277 240 240;" xml:space="preserve">
5
+ <style type="text/css">
6
+ .st0{fill:#1880B6;}
7
+ .st1{fill:#8ED9EF;}
8
+ .st2{fill:#324249;}
9
+ .st3{fill:#F2F0DA;}
10
+ </style>
11
+ <rect id="Image_Slider_1_" x="55" y="277" class="st0" width="240" height="240"/>
12
+ <g>
13
+ <g>
14
+ <path class="st1" d="M219,349h-88c-2.2,0-4,1.8-4,4v72.7l22.4-22.4c3.1-3.1,8.2-3.1,11.3,0l10.3,10.3l22.3-30.3
15
+ c3.1-3.1,8.2-3.1,11.3,0l18.4,18.4V353C223,350.8,221.2,349,219,349z"/>
16
+ <path class="st1" d="M115,361v72c0,2.2,1.8,4,4,4h4v-80h-4C116.8,357,115,358.8,115,361z"/>
17
+ <path class="st1" d="M231,357h-4v80h4c2.2,0,4-1.8,4-4v-72C235,358.8,233.2,357,231,357z"/>
18
+ </g>
19
+ <g>
20
+ <path class="st2" d="M231,353h-4v0c0-4.4-3.6-8-8-8h-88c-4.4,0-8,3.6-8,8h-4c-4.4,0-8,3.6-8,8v72c0,4.4,3.6,8,8,8h4
21
+ c0,4.4,3.6,8,8,8h88c4.4,0,8-3.6,8-8v0h4c4.4,0,8-3.6,8-8v-72C239,356.6,235.4,353,231,353z M123,437h-4c-2.2,0-4-1.8-4-4v-72
22
+ c0-2.2,1.8-4,4-4h4V437z M223,441c0,2.2-1.8,4-4,4h-88c-2.2,0-4-1.8-4-4v-9.6l25.2-25.2c1.6-1.6,4.1-1.6,5.7,0
23
+ c0,0,8.4,8.4,10.3,10.3c1.9,1.9,3.8,1.9,5.7,0c1.9-1.9,22.3-30.3,22.3-30.3c1.6-1.6,4.1-1.6,5.7,0l21.2,21.2V441z M223,401.7
24
+ l-18.4-18.4c-3.1-3.1-8.2-3.1-11.3,0L171,413.7l-10.3-10.3c-3.1-3.1-8.2-3.1-11.3,0L127,425.7V353c0-2.2,1.8-4,4-4h88
25
+ c2.2,0,4,1.8,4,4V401.7z M235,433c0,2.2-1.8,4-4,4h-4v-80h4c2.2,0,4,1.8,4,4V433z"/>
26
+ <path class="st2" d="M169,373h-6.2c-0.3-1.3-0.8-2.5-1.5-3.5l4.4-4.4c0.8-0.8,0.8-2,0-2.8c-0.8-0.8-2-0.8-2.8,0l-4.4,4.4
27
+ c-1.1-0.7-2.2-1.2-3.5-1.5V359c0-1.1-0.9-2-2-2c-1.1,0-2,0.9-2,2v6.2c-1.3,0.3-2.5,0.8-3.5,1.5l-4.4-4.4c-0.8-0.8-2-0.8-2.8,0
28
+ c-0.8,0.8-0.8,2.1,0,2.8l4.4,4.4c-0.7,1-1.2,2.2-1.5,3.5H137c-1.1,0-2,0.9-2,2c0,1.1,0.9,2,2,2h6.2c0.3,1.3,0.8,2.5,1.5,3.5
29
+ l-4.4,4.4c-0.8,0.8-0.8,2,0,2.8c0.8,0.8,2.1,0.8,2.8,0l4.4-4.4c1.1,0.7,2.2,1.2,3.5,1.5v6.2c0,1.1,0.9,2,2,2c1.1,0,2-0.9,2-2v-6.2
30
+ c1.3-0.3,2.5-0.8,3.5-1.5l4.4,4.4c0.8,0.8,2,0.8,2.8,0c0.8-0.8,0.8-2.1,0-2.8l-4.4-4.4c0.7-1,1.2-2.2,1.5-3.5h6.2c1.1,0,2-0.9,2-2
31
+ C171,373.9,170.1,373,169,373z M153,381c-3.3,0-6-2.7-6-6l0,0c0,0,0,0,0,0c0-3.3,2.7-6,6-6s6,2.7,6,6C159,378.3,156.3,381,153,381
32
+ z"/>
33
+ </g>
34
+ <g>
35
+ <path class="st3" d="M201.8,386.1c-1.6-1.6-4.1-1.6-5.7,0c0,0-20.4,28.4-22.3,30.3c-1.9,1.9-3.8,1.9-5.7,0
36
+ c-1.9-1.9-10.3-10.3-10.3-10.3c-1.6-1.6-4.1-1.6-5.7,0L127,431.4v9.6c0,2.2,1.8,4,4,4h88c2.2,0,4-1.8,4-4v-33.7L201.8,386.1z"/>
37
+ <path class="st3" d="M153,381c3.3,0,6-2.7,6-6c0-3.3-2.7-6-6-6c-3.3,0-6,2.7-6,6C147,378.3,149.7,381,153,381z"/>
38
+ </g>
39
+ </g>
40
+ </svg>
 
 
 
 
widgets/so-hero-widget/so-hero-widget.php CHANGED
@@ -2,8 +2,8 @@
2
  /*
3
  Widget Name: Hero Image
4
  Description: A big hero image with a few settings to make it your own.
5
- Author: Greg Priday
6
- Author URI: http://siteorigin.com
7
  */
8
 
9
  if( !class_exists( 'SiteOrigin_Widget_Base_Slider' ) ) include_once plugin_dir_path(SOW_BUNDLE_BASE_FILE) . '/base/inc/widgets/base-slider.class.php';
@@ -15,9 +15,9 @@ class SiteOrigin_Widget_Hero_Widget extends SiteOrigin_Widget_Base_Slider {
15
  function __construct() {
16
  parent::__construct(
17
  'sow-hero',
18
- __('SiteOrigin Hero', 'siteorigin-widgets'),
19
  array(
20
- 'description' => __('A big hero image with a few settings to make it your own.', 'siteorigin-widgets'),
21
  'help' => 'https://siteorigin.com/widgets-bundle/hero-image-widget/',
22
  'panels_title' => false,
23
  ),
@@ -25,8 +25,8 @@ class SiteOrigin_Widget_Hero_Widget extends SiteOrigin_Widget_Base_Slider {
25
  array(
26
  'frames' => array(
27
  'type' => 'repeater',
28
- 'label' => __('Hero frames', 'siteorigin-widgets'),
29
- 'item_name' => __('Frame', 'siteorigin-widgets'),
30
  'item_label' => array(
31
  'selector' => "[id*='frames-title']",
32
  'update_event' => 'change',
@@ -37,14 +37,14 @@ class SiteOrigin_Widget_Hero_Widget extends SiteOrigin_Widget_Base_Slider {
37
 
38
  'content' => array(
39
  'type' => 'tinymce',
40
- 'label' => __( 'Content', 'siteorigin-widgets' ),
41
  ),
42
 
43
  'buttons' => array(
44
  'type' => 'repeater',
45
- 'label' => __('Buttons', 'siteorigin-widgets'),
46
- 'item_name' => __('Button', 'siteorigin-widgets'),
47
- 'description' => __('Add [buttons] shortcode to the content to insert these buttons.', 'siteorigin-widgets'),
48
 
49
  'item_label' => array(
50
  'selector' => "[id*='buttons-button-text']",
@@ -55,7 +55,7 @@ class SiteOrigin_Widget_Hero_Widget extends SiteOrigin_Widget_Base_Slider {
55
  'button' => array(
56
  'type' => 'widget',
57
  'class' => 'SiteOrigin_Widget_Button_Widget',
58
- 'label' => __('Button', 'siteorigin-widgets'),
59
  'collapsible' => false,
60
  )
61
  )
@@ -63,17 +63,17 @@ class SiteOrigin_Widget_Hero_Widget extends SiteOrigin_Widget_Base_Slider {
63
 
64
  'background' => array(
65
  'type' => 'section',
66
- 'label' => __('Background', 'siteorigin-widget'),
67
  'fields' => array(
68
  'image' => array(
69
  'type' => 'media',
70
- 'label' => __( 'Background image', 'siteorigin-widgets' ),
71
  'library' => 'image',
72
  'fallback' => true,
73
  ),
74
 
75
  'opacity' => array(
76
- 'label' => __( 'Background image opacity', 'siteorigin-widgets' ),
77
  'type' => 'slider',
78
  'min' => 0,
79
  'max' => 100,
@@ -82,14 +82,24 @@ class SiteOrigin_Widget_Hero_Widget extends SiteOrigin_Widget_Base_Slider {
82
 
83
  'color' => array(
84
  'type' => 'color',
85
- 'label' => __( 'Background color', 'siteorigin-widgets' ),
86
  'default' => '#333333',
87
  ),
88
 
 
 
 
 
 
 
 
 
 
 
89
  'videos' => array(
90
  'type' => 'repeater',
91
- 'item_name' => __('Video', 'siteorigin-widgets'),
92
- 'label' => __('Background videos', 'siteorigin-widgets'),
93
  'item_label' => array(
94
  'selector' => "[id*='frames-background_videos-url']",
95
  'update_event' => 'change',
@@ -104,48 +114,55 @@ class SiteOrigin_Widget_Hero_Widget extends SiteOrigin_Widget_Base_Slider {
104
 
105
  'controls' => array(
106
  'type' => 'section',
107
- 'label' => __('Slider Controls', 'siteorigin-widget'),
108
  'fields' => $this->control_form_fields()
109
  ),
110
 
111
  'design' => array(
112
  'type' => 'section',
113
- 'label' => __('Design and Layout', 'siteorigin-widgets'),
114
  'fields' => array(
115
 
116
  'padding' => array(
117
  'type' => 'number',
118
- 'label' => __('Top and bottom padding', 'siteorigin-widgets'),
119
  'default' => 50,
120
  ),
121
 
 
 
 
 
 
 
 
122
  'padding_sides' => array(
123
  'type' => 'number',
124
- 'label' => __('Side padding', 'siteorigin-widgets'),
125
  'default' => 20,
126
  ),
127
 
128
  'width' => array(
129
  'type' => 'number',
130
- 'label' => __('Maximum container width', 'siteorigin-widgets'),
131
  'default' => 1280,
132
  ),
133
 
134
  'heading_font' => array(
135
  'type' => 'font',
136
- 'label' => __('Heading font', 'siteorigin-widgets'),
137
  'default' => '',
138
  ),
139
 
140
  'heading_size' => array(
141
  'type' => 'number',
142
- 'label' => __('Heading size', 'siteorigin-widgets'),
143
  'default' => 38,
144
  ),
145
 
146
  'heading_shadow' => array(
147
  'type' => 'slider',
148
- 'label' => __('Heading shadow intensity', 'siteorigin-widgets'),
149
  'max' => 100,
150
  'min' => 0,
151
  'default' => 50,
@@ -153,7 +170,7 @@ class SiteOrigin_Widget_Hero_Widget extends SiteOrigin_Widget_Base_Slider {
153
 
154
  'text_size' => array(
155
  'type' => 'number',
156
- 'label' => __('Text size', 'siteorigin-widgets'),
157
  'default' => 16,
158
  ),
159
 
@@ -164,10 +181,9 @@ class SiteOrigin_Widget_Hero_Widget extends SiteOrigin_Widget_Base_Slider {
164
  }
165
 
166
  function initialize(){
 
167
  if( !class_exists('SiteOrigin_Widget_Button_Widget') ) {
168
- // We need to include the button
169
- include plugin_dir_path( SOW_BUNDLE_BASE_FILE ) . 'widgets/so-button-widget/so-button-widget.php';
170
- siteorigin_widget_register( 'button', plugin_dir_path( SOW_BUNDLE_BASE_FILE ) . 'widgets/so-button-widget/so-button-widget.php' );
171
  }
172
 
173
  // Let the slider base class do its initialization
@@ -193,6 +209,8 @@ class SiteOrigin_Widget_Hero_Widget extends SiteOrigin_Widget_Base_Slider {
193
  'color' => !empty( $frame['background']['color'] ) ? $frame['background']['color'] : false,
194
  'image' => !empty( $background_image ) ? $background_image[0] : false,
195
  'image-sizing' => 'cover',
 
 
196
  'videos' => $frame['background']['videos'],
197
  'video-sizing' => 'background',
198
  'opacity' => intval($frame['background']['opacity'])/100,
@@ -231,7 +249,8 @@ class SiteOrigin_Widget_Hero_Widget extends SiteOrigin_Widget_Base_Slider {
231
  $button_code = ob_get_clean();
232
 
233
  // Add in the button code
234
- $content = preg_replace('/<p *([^>]*)> *\[ *buttons *\] *<\/p>/i', '<div class="sow-hero-buttons" $1>' . $button_code . '</div>', wp_kses_post( $content ) );
 
235
  return $content;
236
  }
237
 
@@ -251,8 +270,9 @@ class SiteOrigin_Widget_Hero_Widget extends SiteOrigin_Widget_Base_Slider {
251
 
252
  // Hero specific design
253
  $less['slide_padding'] = intval( $instance['design']['padding'] ) . 'px';
254
-
255
  $less['slide_padding_sides'] = intval( $instance['design']['padding_sides'] ) . 'px';
 
256
  $less['slide_width'] = intval( $instance['design']['width'] ) . 'px';
257
  $less['heading_size'] = intval( $instance['design']['heading_size'] ) . 'px';
258
  $less['text_size'] = intval( $instance['design']['text_size'] ) . 'px';
@@ -286,4 +306,4 @@ class SiteOrigin_Widget_Hero_Widget extends SiteOrigin_Widget_Base_Slider {
286
 
287
  }
288
 
289
- siteorigin_widget_register('hero', __FILE__);
2
  /*
3
  Widget Name: Hero Image
4
  Description: A big hero image with a few settings to make it your own.
5
+ Author: SiteOrigin
6
+ Author URI: https://siteorigin.com
7
  */
8
 
9
  if( !class_exists( 'SiteOrigin_Widget_Base_Slider' ) ) include_once plugin_dir_path(SOW_BUNDLE_BASE_FILE) . '/base/inc/widgets/base-slider.class.php';
15
  function __construct() {
16
  parent::__construct(
17
  'sow-hero',
18
+ __('SiteOrigin Hero', 'so-widgets-bundle'),
19
  array(
20
+ 'description' => __('A big hero image with a few settings to make it your own.', 'so-widgets-bundle'),
21
  'help' => 'https://siteorigin.com/widgets-bundle/hero-image-widget/',
22
  'panels_title' => false,
23
  ),
25
  array(
26
  'frames' => array(
27
  'type' => 'repeater',
28
+ 'label' => __('Hero frames', 'so-widgets-bundle'),
29
+ 'item_name' => __('Frame', 'so-widgets-bundle'),
30
  'item_label' => array(
31
  'selector' => "[id*='frames-title']",
32
  'update_event' => 'change',
37
 
38
  'content' => array(
39
  'type' => 'tinymce',
40
+ 'label' => __( 'Content', 'so-widgets-bundle' ),
41
  ),
42
 
43
  'buttons' => array(
44
  'type' => 'repeater',
45
+ 'label' => __('Buttons', 'so-widgets-bundle'),
46
+ 'item_name' => __('Button', 'so-widgets-bundle'),
47
+ 'description' => __('Add [buttons] shortcode to the content to insert these buttons.', 'so-widgets-bundle'),
48
 
49
  'item_label' => array(
50
  'selector' => "[id*='buttons-button-text']",
55
  'button' => array(
56
  'type' => 'widget',
57
  'class' => 'SiteOrigin_Widget_Button_Widget',
58
+ 'label' => __('Button', 'so-widgets-bundle'),
59
  'collapsible' => false,
60
  )
61
  )
63
 
64
  'background' => array(
65
  'type' => 'section',
66
+ 'label' => __('Background', 'so-widgets-bundle'),
67
  'fields' => array(
68
  'image' => array(
69
  'type' => 'media',
70
+ 'label' => __( 'Background image', 'so-widgets-bundle' ),
71
  'library' => 'image',
72
  'fallback' => true,
73
  ),
74
 
75
  'opacity' => array(
76
+ 'label' => __( 'Background image opacity', 'so-widgets-bundle' ),
77
  'type' => 'slider',
78
  'min' => 0,
79
  'max' => 100,
82
 
83
  'color' => array(
84
  'type' => 'color',
85
+ 'label' => __( 'Background color', 'so-widgets-bundle' ),
86
  'default' => '#333333',
87
  ),
88
 
89
+ 'url' => array(
90
+ 'type' => 'link',
91
+ 'label' => __( 'Destination URL', 'so-widgets-bundle' ),
92
+ ),
93
+
94
+ 'new_window' => array(
95
+ 'type' => 'checkbox',
96
+ 'label' => __( 'Open URL in a new window', 'so-widgets-bundle' ),
97
+ ),
98
+
99
  'videos' => array(
100
  'type' => 'repeater',
101
+ 'item_name' => __('Video', 'so-widgets-bundle'),
102
+ 'label' => __('Background videos', 'so-widgets-bundle'),
103
  'item_label' => array(
104
  'selector' => "[id*='frames-background_videos-url']",
105
  'update_event' => 'change',
114
 
115
  'controls' => array(
116
  'type' => 'section',
117
+ 'label' => __('Slider Controls', 'so-widgets-bundle'),
118
  'fields' => $this->control_form_fields()
119
  ),
120
 
121
  'design' => array(
122
  'type' => 'section',
123
+ 'label' => __('Design and Layout', 'so-widgets-bundle'),
124
  'fields' => array(
125
 
126
  'padding' => array(
127
  'type' => 'number',
128
+ 'label' => __('Top and bottom padding', 'so-widgets-bundle'),
129
  'default' => 50,
130
  ),
131
 
132
+ 'extra_top_padding' => array(
133
+ 'type' => 'number',
134
+ 'label' => __('Extra top padding', 'so-widgets-bundle'),
135
+ 'description' => __('Additional padding added to the top of the slider', 'so-widgets-bundle'),
136
+ 'default' => 0,
137
+ ),
138
+
139
  'padding_sides' => array(
140
  'type' => 'number',
141
+ 'label' => __('Side padding', 'so-widgets-bundle'),
142
  'default' => 20,
143
  ),
144
 
145
  'width' => array(
146
  'type' => 'number',
147
+ 'label' => __('Maximum container width', 'so-widgets-bundle'),
148
  'default' => 1280,
149
  ),
150
 
151
  'heading_font' => array(
152
  'type' => 'font',
153
+ 'label' => __('Heading font', 'so-widgets-bundle'),
154
  'default' => '',
155
  ),
156
 
157
  'heading_size' => array(
158
  'type' => 'number',
159
+ 'label' => __('Heading size', 'so-widgets-bundle'),
160
  'default' => 38,
161
  ),
162
 
163
  'heading_shadow' => array(
164
  'type' => 'slider',
165
+ 'label' => __('Heading shadow intensity', 'so-widgets-bundle'),
166
  'max' => 100,
167
  'min' => 0,
168
  'default' => 50,
170
 
171
  'text_size' => array(
172
  'type' => 'number',
173
+ 'label' => __('Text size', 'so-widgets-bundle'),
174
  'default' => 16,
175
  ),
176
 
181
  }
182
 
183
  function initialize(){
184
+ // This widget requires the button widget
185
  if( !class_exists('SiteOrigin_Widget_Button_Widget') ) {
186
+ SiteOrigin_Widgets_Bundle::single()->include_widget( 'so-button-widget' );
 
 
187
  }
188
 
189
  // Let the slider base class do its initialization
209
  'color' => !empty( $frame['background']['color'] ) ? $frame['background']['color'] : false,
210
  'image' => !empty( $background_image ) ? $background_image[0] : false,
211
  'image-sizing' => 'cover',
212
+ 'url' => !empty( $frame['background']['url'] ) ? $frame['background']['url'] : false,
213
+ 'new_window' => !empty( $frame['background']['new_window'] ),
214
  'videos' => $frame['background']['videos'],
215
  'video-sizing' => 'background',
216
  'opacity' => intval($frame['background']['opacity'])/100,
249
  $button_code = ob_get_clean();
250
 
251
  // Add in the button code
252
+ $san_content = wp_kses_post($content);
253
+ $content = preg_replace('/<(?:p|h\d|em|strong|li|blockquote) *([^>]*)> *\[ *buttons *\] *<\/(?:p|h\d|em|strong|li|blockquote)>/i', '<div class="sow-hero-buttons" $1>' . $button_code . '</div>', $san_content );
254
  return $content;
255
  }
256
 
270
 
271
  // Hero specific design
272
  $less['slide_padding'] = intval( $instance['design']['padding'] ) . 'px';
273
+ $less['slide_padding_extra_top'] = intval( $instance['design']['extra_top_padding'] ) . 'px';
274
  $less['slide_padding_sides'] = intval( $instance['design']['padding_sides'] ) . 'px';
275
+
276
  $less['slide_width'] = intval( $instance['design']['width'] ) . 'px';
277
  $less['heading_size'] = intval( $instance['design']['heading_size'] ) . 'px';
278
  $less['text_size'] = intval( $instance['design']['text_size'] ) . 'px';
306
 
307
  }
308
 
309
+ siteorigin_widget_register('sow-hero', __FILE__, 'SiteOrigin_Widget_Hero_Widget');
widgets/so-hero-widget/styles/default.less CHANGED
@@ -6,6 +6,7 @@
6
  @nav_size: 25;
7
 
8
  @slide_padding: 50px;
 
9
  @slide_padding_sides: 10px;
10
  @slide_width: 1280px;
11
  @heading_size: 38px;
@@ -18,7 +19,7 @@
18
  .sow-slider-base {
19
 
20
  .sow-slider-image-wrapper {
21
- padding: @slide_padding @slide_padding_sides;
22
 
23
  max-width: @slide_width;
24
 
6
  @nav_size: 25;
7
 
8
  @slide_padding: 50px;
9
+ @slide_padding_extra_top: 0px;
10
  @slide_padding_sides: 10px;
11
  @slide_width: 1280px;
12
  @heading_size: 38px;
19
  .sow-slider-base {
20
 
21
  .sow-slider-image-wrapper {
22
+ padding: @slide_padding+@slide_padding_extra_top @slide_padding_sides @slide_padding @slide_padding_sides;
23
 
24
  max-width: @slide_width;
25
 
widgets/so-image-grid-widget/css/image-grid.css ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ .sow-image-grid-wrapper {
2
+ text-align: center;
3
+ }
4
+ .sow-image-grid-wrapper .sow-image-grid-image {
5
+ display: inline-block;
6
+ }
7
+ .sow-image-grid-wrapper .sow-image-grid-image img {
8
+ display: none;
9
+ max-width: 100%;
10
+ height: auto;
11
+ }
widgets/so-image-grid-widget/js/image-grid.js ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery( function($){
2
+
3
+ $('.sow-image-grid-wrapper').each( function(){
4
+ var $$ = $(this);
5
+
6
+ var maxWidth = $$.data('max-width'),
7
+ maxHeight = $$.data('max-height');
8
+
9
+ if( maxWidth !== undefined || maxHeight !== undefined ) {
10
+ $$.find('img').each( function(){
11
+ var $img = $(this).css('display', 'block'),
12
+ ratio = $img.width() / $img.height();
13
+
14
+ var width = [];
15
+
16
+ // Lets set the widths of the image
17
+ if( maxWidth != undefined && $img.width() > maxWidth ) {
18
+ width.push( maxWidth );
19
+ }
20
+
21
+ if( maxHeight != undefined && $img.height() > maxHeight ) {
22
+ width.push( Math.round( maxHeight * ratio ) );
23
+ }
24
+
25
+ if( width.length ) {
26
+ width = Math.min.apply( Math, width );
27
+ $img.css('max-width', width);
28
+ }
29
+
30
+ } );
31
+ }
32
+ else {
33
+ $$.find('img').css('display', 'block');
34
+ }
35
+
36
+ var alignImages = function(){
37
+
38
+ };
39
+ alignImages();
40
+
41
+ $(window).resize(alignImages);
42
+
43
+ } );
44
+
45
+ } );
widgets/so-image-grid-widget/js/image-grid.min.js ADDED
@@ -0,0 +1 @@
 
1
+ jQuery(function(i){i(".sow-image-grid-wrapper").each(function(){var a=i(this),h=a.data("max-width"),t=a.data("max-height");void 0!==h||void 0!==t?a.find("img").each(function(){var a=i(this).css("display","block"),d=a.width()/a.height(),n=[];void 0!=h&&a.width()>h&&n.push(h),void 0!=t&&a.height()>t&&n.push(Math.round(t*d)),n.length&&(n=Math.min.apply(Math,n),a.css("max-width",n))}):a.find("img").css("display","block");var d=function(){};d(),i(window).resize(d)})});
widgets/so-image-grid-widget/so-image-grid-widget.php ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Widget Name: Image Grid
4
+ Description: Display a grid of images. Also useful for displaying client logos.
5
+ Author: SiteOrigin
6
+ Author URI: https://siteorigin.com
7
+ */
8
+
9
+ class SiteOrigin_Widgets_ImageGrid_Widget extends SiteOrigin_Widget {
10
+
11
+ function __construct(){
12
+
13
+ parent::__construct(
14
+ 'sow-image-grid',
15
+ __('SiteOrigin Image Grid', 'so-widgets-bundle'),
16
+ array(
17
+ 'description' => __('Display a grid of images.', 'so-widgets-bundle'),
18
+ ),
19
+ array(),
20
+ array(
21
+
22
+ 'images' => array(
23
+ 'type' => 'repeater',
24
+ 'label' => __('Images', 'so-widgets-bundle'),
25
+ 'item_name' => __( 'Image', 'so-widgets-bundle' ),
26
+ 'item_label' => array(
27
+ 'selector' => "[name*='title']",
28
+ 'update_event' => 'change',
29
+ 'value_method' => 'val'
30
+ ),
31
+ 'fields' => array(
32
+ 'image' => array(
33
+ 'type' => 'media',
34
+ 'label' => __('Image', 'so-widgets-bundle')
35
+ ),
36
+ 'title' => array(
37
+ 'type' => 'text',
38
+ 'label' => __('Image title', 'so-widgets-bundle')
39
+ ),
40
+ 'url' => array(
41
+ 'type' => 'text',
42
+ 'sanitize' => 'url',
43
+ 'label' => __('URL', 'so-widgets-bundle')
44
+ ),
45
+ )
46
+ ),
47
+
48
+ 'display' => array(
49
+ 'type' => 'section',
50
+ 'label' => __('Display', 'so-widgets-bundle'),
51
+ 'fields' => array(
52
+ 'attachment_size' => array(
53
+ 'label' => __('Image size', 'so-widgets-bundle'),
54
+ 'type' => 'select',
55
+ 'options' => array(),
56
+ 'default' => 'full',
57
+ ),
58
+
59
+ 'max_height' => array(
60
+ 'label' => __('Maximum image height', 'so-widgets-bundle'),
61
+ 'type' => 'number',
62
+ ),
63
+
64
+ 'max_width' => array(
65
+ 'label' => __('Maximum image width', 'so-widgets-bundle'),
66
+ 'type' => 'number',
67
+ ),
68
+
69
+ 'spacing' => array(
70
+ 'label' => __('Spacing', 'so-widgets-bundle'),
71
+ 'description' => __('Amount of spacing between images.', 'so-widgets-bundle'),
72
+ 'type' => 'number',
73
+ 'default' => 10,
74
+ ),
75
+ )
76
+ )
77
+
78
+ )
79
+ );
80
+ }
81
+
82
+ /**
83
+ * Initialize the image grid, mainly to add scripts and styles.
84
+ */
85
+ function initialize(){
86
+ $this->register_frontend_styles( array(
87
+ array(
88
+ 'sow-image-grid',
89
+ plugin_dir_url(__FILE__) . 'css/image-grid.css',
90
+ )
91
+ ) );
92
+
93
+ $this->register_frontend_scripts( array(
94
+ array(
95
+ 'sow-image-grid',
96
+ plugin_dir_url(__FILE__) . 'js/image-grid' . SOW_BUNDLE_JS_SUFFIX . '.js',
97
+ array( 'jquery' )
98
+ )
99
+ ) );
100
+ }
101
+
102
+ /**
103
+ * Modify the form widget
104
+ *
105
+ * @param $form
106
+ *
107
+ * @return mixed
108
+ */
109
+ function modify_form( $form ){
110
+ $intermediate = get_intermediate_image_sizes();
111
+ foreach( $intermediate as $id => $name ) {
112
+ $intermediate[$id] = ucwords(str_replace('-', ' ', $name));
113
+ }
114
+ $sizes = array_merge( array( 'full' => __('Full', 'so-widgets-bundle') ), $intermediate );
115
+ $form['display']['fields']['attachment_size']['options'] = $sizes;
116
+ return $form;
117
+ }
118
+
119
+ /**
120
+ * Get the less variables for the image grid
121
+ *
122
+ * @param $instance
123
+ *
124
+ * @return mixed
125
+ */
126
+ function get_less_variables( $instance ) {
127
+ $less = array();
128
+ if( !empty( $instance['display']['spacing'] ) ) {
129
+ $less['spacing'] = intval($instance['display']['spacing']) . 'px';
130
+ }
131
+
132
+ return $less;
133
+ }
134
+ }
135
+
136
+ siteorigin_widget_register( 'sow-image-grid', __FILE__, 'SiteOrigin_Widgets_ImageGrid_Widget' );
widgets/so-image-grid-widget/styles/default.less ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ @spacing: 20px;
2
+
3
+ .sow-image-grid-wrapper {
4
+ padding-top: @spacing;
5
+ margin: 0 -@spacing;
6
+
7
+ .sow-image-grid-image {
8
+ padding: 0 @spacing @spacing @spacing;
9
+ }
10
+
11
+ }
widgets/so-image-grid-widget/tpl/default.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if( !empty($instance['images']) ) : ?>
2
+ <div class="sow-image-grid-wrapper"
3
+ <?php if( !empty( $instance['display']['max_width'] ) ) echo 'data-max-width="' . intval( $instance['display']['max_width'] ) . '"' ?>
4
+ <?php if( !empty( $instance['display']['max_height'] ) ) echo 'data-max-height="' . intval( $instance['display']['max_height'] ) . '"' ?>
5
+ >
6
+ <?php
7
+ foreach( $instance['images'] as $image ) {
8
+ echo '<div class="sow-image-grid-image">';
9
+ echo wp_get_attachment_image( $image['image'], $image['display']['image_size'], false, array(
10
+ 'title' => $image['title']
11
+ ) );
12
+ echo '</div>';
13
+ }
14
+ ?>
15
+ </div>
16
+ <?php endif; ?>
widgets/so-image-widget/assets/banner.svg CHANGED
@@ -1,36 +1,36 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
4
- <svg version="1.0" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
- width="480px" height="240px" viewBox="0 0 480 240" enable-background="new 0 0 480 240" xml:space="preserve">
6
- <rect id="Button_2_" fill="#1880B6" width="480" height="240"/>
7
- <g>
8
- <path fill="#8ED9EF" d="M300,132.676l-22.352-22.355c-3.129-3.125-8.188-3.125-11.312,0l-34.344,34.344l-14.305-14.301
9
- c-3.125-3.129-8.184-3.129-11.312,0L180,156.742V76c0-2.211,1.789-4,4-4h112c2.211,0,4,1.789,4,4V132.676z"/>
10
- <g>
11
- <circle fill="#F2F0DA" cx="222" cy="97.992" r="6"/>
12
- <path fill="#F2F0DA" d="M296,168c2.211,0,4-1.789,4-4v-25.664l-25.18-25.184c-1.562-1.562-4.094-1.562-5.656,0l-41.742,41.754
13
- c-0.781,0.781-2.047,0.781-2.828,0c-0.783-0.781-0.783-2.047,0-2.828l4.578-4.578c-0.002-0.004-0.004-0.004-0.008-0.008
14
- c-1.906-1.902-14.305-14.297-14.305-14.297c-1.562-1.562-4.094-1.562-5.656,0L180,162.398V164c0,2.211,1.789,4,4,4H296z"/>
15
- </g>
16
- <g>
17
- <path fill="#324249" d="M296,68H184c-4.422,0-8,3.578-8,8v88c0,4.422,3.578,8,8,8h112c4.422,0,8-3.578,8-8V76
18
- C304,71.578,300.422,68,296,68z M300,164c0,2.211-1.789,4-4,4H184c-2.211,0-4-1.789-4-4v-1.602l29.203-29.203
19
- c1.562-1.562,4.094-1.562,5.656,0c0,0,12.398,12.395,14.305,14.297c0.004,0.004,0.006,0.004,0.008,0.008l-4.578,4.578
20
- c-0.783,0.781-0.783,2.047,0,2.828c0.781,0.781,2.047,0.781,2.828,0l41.742-41.754c1.562-1.562,4.094-1.562,5.656,0L300,138.336
21
- V164z M300,132.676l-22.352-22.355c-3.129-3.125-8.188-3.125-11.312,0l-34.344,34.344l-14.305-14.301
22
- c-3.125-3.129-8.184-3.129-11.312,0L180,156.742V76c0-2.211,1.789-4,4-4h112c2.211,0,4,1.789,4,4V132.676z"/>
23
- <path fill="#324249" d="M238.008,95.992h-6.203c-0.258-1.273-0.766-2.457-1.461-3.508l4.391-4.391
24
- c0.785-0.781,0.785-2.047,0-2.828c-0.781-0.781-2.047-0.781-2.828,0l-4.391,4.391c-1.051-0.695-2.234-1.203-3.508-1.461v-6.203
25
- c0-1.105-0.895-2-2-2c-1.109,0-2.004,0.895-2.004,2v6.203c-1.273,0.258-2.457,0.766-3.508,1.461l-4.391-4.395
26
- c-0.781-0.777-2.043-0.777-2.832,0c-0.777,0.789-0.777,2.051,0.004,2.832l4.391,4.391c-0.695,1.051-1.203,2.23-1.461,3.508h-6.203
27
- c-1.105,0-1.996,0.895-2.004,2c0.008,1.113,0.902,2.004,2.004,2.004h6.203c0.258,1.273,0.766,2.457,1.461,3.508l-4.395,4.391
28
- c-0.777,0.781-0.777,2.047,0,2.832c0.789,0.781,2.051,0.777,2.832-0.004l4.391-4.391c1.051,0.695,2.23,1.203,3.508,1.461v6.203
29
- c0,1.105,0.895,2,2.004,2.004c1.109-0.004,2-0.898,2-2.004v-6.203c1.273-0.258,2.457-0.766,3.508-1.461l4.391,4.395
30
- c0.781,0.781,2.047,0.781,2.832,0c0.781-0.785,0.777-2.051-0.004-2.832l-4.391-4.391c0.695-1.051,1.203-2.23,1.461-3.508h6.203
31
- c1.105,0.004,2-0.895,2-2.004C240.008,96.887,239.113,95.992,238.008,95.992z M222.008,103.996c-3.312,0-6-2.684-6.004-5.996
32
- c0,0,0.004-0.004,0.004-0.008c0,0-0.004,0-0.004-0.004c0.004-3.312,2.691-5.996,6.004-5.996s6,2.688,6,6
33
- C228.008,101.309,225.32,103.996,222.008,103.996z"/>
34
- </g>
35
- </g>
36
- </svg>
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="55 277 240 240" style="enable-background:new 55 277 240 240;" xml:space="preserve">
5
+ <style type="text/css">
6
+ .st0{fill:#1880B6;}
7
+ .st1{fill:#8ED9EF;}
8
+ .st2{fill:#F2F0DA;}
9
+ .st3{fill:#324249;}
10
+ </style>
11
+ <rect id="Button_2_" x="55" y="277" class="st0" width="240" height="240"/>
12
+ <g>
13
+ <path class="st1" d="M235,409.7l-22.4-22.4c-3.1-3.1-8.2-3.1-11.3,0L167,421.7l-14.3-14.3c-3.1-3.1-8.2-3.1-11.3,0L115,433.7V353
14
+ c0-2.2,1.8-4,4-4h112c2.2,0,4,1.8,4,4V409.7z"/>
15
+ <g>
16
+ <circle class="st2" cx="157" cy="375" r="6"/>
17
+ <path class="st2" d="M231,445c2.2,0,4-1.8,4-4v-25.7l-25.2-25.2c-1.6-1.6-4.1-1.6-5.7,0l-41.7,41.8c-0.8,0.8-2,0.8-2.8,0
18
+ c-0.8-0.8-0.8-2,0-2.8l4.6-4.6c0,0,0,0,0,0c-1.9-1.9-14.3-14.3-14.3-14.3c-1.6-1.6-4.1-1.6-5.7,0L115,439.4v1.6c0,2.2,1.8,4,4,4
19
+ H231z"/>
20
+ </g>
21
+ <g>
22
+ <path class="st3" d="M231,345H119c-4.4,0-8,3.6-8,8v88c0,4.4,3.6,8,8,8h112c4.4,0,8-3.6,8-8v-88C239,348.6,235.4,345,231,345z
23
+ M235,441c0,2.2-1.8,4-4,4H119c-2.2,0-4-1.8-4-4v-1.6l29.2-29.2c1.6-1.6,4.1-1.6,5.7,0c0,0,12.4,12.4,14.3,14.3c0,0,0,0,0,0
24
+ l-4.6,4.6c-0.8,0.8-0.8,2,0,2.8c0.8,0.8,2,0.8,2.8,0l41.7-41.8c1.6-1.6,4.1-1.6,5.7,0l25.2,25.2V441z M235,409.7l-22.4-22.4
25
+ c-3.1-3.1-8.2-3.1-11.3,0L167,421.7l-14.3-14.3c-3.1-3.1-8.2-3.1-11.3,0L115,433.7V353c0-2.2,1.8-4,4-4h112c2.2,0,4,1.8,4,4V409.7
26
+ z"/>
27
+ <path class="st3" d="M173,373h-6.2c-0.3-1.3-0.8-2.5-1.5-3.5l4.4-4.4c0.8-0.8,0.8-2,0-2.8c-0.8-0.8-2-0.8-2.8,0l-4.4,4.4
28
+ c-1.1-0.7-2.2-1.2-3.5-1.5V359c0-1.1-0.9-2-2-2c-1.1,0-2,0.9-2,2v6.2c-1.3,0.3-2.5,0.8-3.5,1.5l-4.4-4.4c-0.8-0.8-2-0.8-2.8,0
29
+ c-0.8,0.8-0.8,2.1,0,2.8l4.4,4.4c-0.7,1.1-1.2,2.2-1.5,3.5H141c-1.1,0-2,0.9-2,2c0,1.1,0.9,2,2,2h6.2c0.3,1.3,0.8,2.5,1.5,3.5
30
+ l-4.4,4.4c-0.8,0.8-0.8,2,0,2.8c0.8,0.8,2.1,0.8,2.8,0l4.4-4.4c1.1,0.7,2.2,1.2,3.5,1.5v6.2c0,1.1,0.9,2,2,2c1.1,0,2-0.9,2-2v-6.2
31
+ c1.3-0.3,2.5-0.8,3.5-1.5l4.4,4.4c0.8,0.8,2,0.8,2.8,0c0.8-0.8,0.8-2.1,0-2.8l-4.4-4.4c0.7-1.1,1.2-2.2,1.5-3.5h6.2
32
+ c1.1,0,2-0.9,2-2C175,373.9,174.1,373,173,373z M157,381c-3.3,0-6-2.7-6-6c0,0,0,0,0,0c0,0,0,0,0,0c0-3.3,2.7-6,6-6s6,2.7,6,6
33
+ C163,378.3,160.3,381,157,381z"/>
34
+ </g>
35
+ </g>
36
+ </svg>
widgets/so-image-widget/so-image-widget.php CHANGED
@@ -1,18 +1,18 @@
1
  <?php
2
  /*
3
- Widget Name: Image widget
4
  Description: A very simple image widget.
5
- Author: Greg Priday
6
- Author URI: http://siteorigin.com
7
  */
8
 
9
  class SiteOrigin_Widget_Image_Widget extends SiteOrigin_Widget {
10
  function __construct() {
11
  parent::__construct(
12
  'sow-image',
13
- __('SiteOrigin Image', 'siteorigin-widgets'),
14
  array(
15
- 'description' => __('A simple image widget with massive power.', 'siteorigin-widgets'),
16
  'help' => 'https://siteorigin.com/widgets-bundle/image-widget-documentation/'
17
  ),
18
  array(
@@ -21,53 +21,53 @@ class SiteOrigin_Widget_Image_Widget extends SiteOrigin_Widget {
21
  array(
22
  'image' => array(
23
  'type' => 'media',
24
- 'label' => __('Image file', 'siteorigin-widgets'),
25
  'library' => 'image',
26
  'fallback' => true,
27
  ),
28
 
29
  'size' => array(
30
  'type' => 'select',
31
- 'label' => __('Image size', 'siteorigin-widgets'),
32
  'options' => array(
33
- 'full' => __('Full', 'siteorigin-widgets'),
34
- 'large' => __('Large', 'siteorigin-widgets'),
35
- 'medium' => __('Medium', 'siteorigin-widgets'),
36
- 'thumb' => __('Thumbnail', 'siteorigin-widgets'),
37
  ),
38
  ),
39
 
40
  'title' => array(
41
  'type' => 'text',
42
- 'label' => __('Title text', 'siteorigin-widgets'),
43
  ),
44
 
45
  'alt' => array(
46
  'type' => 'text',
47
- 'label' => __('Alt text', 'siteorigin-widgets'),
48
  ),
49
 
50
  'url' => array(
51
  'type' => 'link',
52
- 'label' => __('Destination URL', 'siteorigin-widgets'),
53
  ),
54
  'new_window' => array(
55
  'type' => 'checkbox',
56
  'default' => false,
57
- 'label' => __('Open in new window', 'siteorigin-widgets'),
58
  ),
59
 
60
  'bound' => array(
61
  'type' => 'checkbox',
62
  'default' => true,
63
- 'label' => __('Bound', 'siteorigin-widgets'),
64
- 'description' => __("Make sure the image doesn't extend beyond its container.", 'siteorigin-widgets'),
65
  ),
66
  'full_width' => array(
67
  'type' => 'checkbox',
68
  'default' => false,
69
- 'label' => __('Full Width', 'siteorigin-widgets'),
70
- 'description' => __("Resize image to fit its container.", 'siteorigin-widgets'),
71
  ),
72
 
73
  ),
@@ -103,4 +103,4 @@ class SiteOrigin_Widget_Image_Widget extends SiteOrigin_Widget {
103
  }
104
  }
105
 
106
- siteorigin_widget_register('image', __FILE__);
1
  <?php
2
  /*
3
+ Widget Name: Image
4
  Description: A very simple image widget.
5
+ Author: SiteOrigin
6
+ Author URI: https://siteorigin.com
7
  */
8
 
9
  class SiteOrigin_Widget_Image_Widget extends SiteOrigin_Widget {
10
  function __construct() {
11
  parent::__construct(
12
  'sow-image',
13
+ __('SiteOrigin Image', 'so-widgets-bundle'),
14
  array(
15
+ 'description' => __('A simple image widget with massive power.', 'so-widgets-bundle'),
16
  'help' => 'https://siteorigin.com/widgets-bundle/image-widget-documentation/'
17
  ),
18
  array(
21
  array(
22
  'image' => array(
23
  'type' => 'media',
24
+ 'label' => __('Image file', 'so-widgets-bundle'),
25
  'library' => 'image',
26
  'fallback' => true,
27
  ),
28
 
29
  'size' => array(
30
  'type' => 'select',
31
+ 'label' => __('Image size', 'so-widgets-bundle'),
32
  'options' => array(
33
+ 'full' => __('Full', 'so-widgets-bundle'),
34
+ 'large' => __('Large', 'so-widgets-bundle'),
35
+ 'medium' => __('Medium', 'so-widgets-bundle'),
36
+ 'thumb' => __('Thumbnail', 'so-widgets-bundle'),
37
  ),
38
  ),
39
 
40
  'title' => array(
41
  'type' => 'text',
42
+ 'label' => __('Title text', 'so-widgets-bundle'),
43
  ),
44
 
45
  'alt' => array(
46
  'type' => 'text',
47
+ 'label' => __('Alt text', 'so-widgets-bundle'),
48
  ),
49
 
50
  'url' => array(
51
  'type' => 'link',
52
+ 'label' => __('Destination URL', 'so-widgets-bundle'),
53
  ),
54
  'new_window' => array(
55
  'type' => 'checkbox',
56
  'default' => false,
57
+ 'label' => __('Open in new window', 'so-widgets-bundle'),
58
  ),
59
 
60
  'bound' => array(
61
  'type' => 'checkbox',
62
  'default' => true,
63
+ 'label' => __('Bound', 'so-widgets-bundle'),
64
+ 'description' => __("Make sure the image doesn't extend beyond its container.", 'so-widgets-bundle'),
65
  ),
66
  'full_width' => array(
67
  'type' => 'checkbox',
68
  'default' => false,
69
+ 'label' => __('Full Width', 'so-widgets-bundle'),
70
+ 'description' => __("Resize image to fit its container.", 'so-widgets-bundle'),
71
  ),
72
 
73
  ),
103
  }
104
  }
105
 
106
+ siteorigin_widget_register('sow-image', __FILE__, 'SiteOrigin_Widget_Image_Widget');
widgets/so-post-carousel-widget/assets/banner.svg CHANGED
@@ -1,44 +1,44 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
4
- <svg version="1.0" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
- width="480px" height="240px" viewBox="0 0 480 240" enable-background="new 0 0 480 240" xml:space="preserve">
6
- <rect id="Call_to_Action_2_" fill="#1880B6" width="480" height="240"/>
7
- <g>
8
- <path fill="#324249" d="M296,63.992h-3.999V64c0-4.421-3.579-7.999-8.001-7.999h-88c-4.422,0-8.001,3.578-8.001,7.999H184
9
- c-4.421,0-8,3.579-8,8v96c0,4.422,3.579,8,8,8h3.999c0,4.422,3.579,8,8.001,8h88c4.422,0,8.001-3.578,8.001-8v-0.008H296
10
- c4.421,0,8-3.578,8-8v-96C304,67.57,300.421,63.992,296,63.992z M187.999,172H184c-2.212,0-4-1.789-4-4V72c0-2.21,1.788-4,4-4
11
- h3.999V172z M287.999,92v84c0,2.211-1.788,4-3.999,4h-88c-2.211,0-3.999-1.789-3.999-4V64c0-2.21,1.788-4,3.999-4h88
12
- c2.211,0,3.999,1.789,3.999,4V92z M300,167.992c0,2.211-1.788,4-4,4h-3.999v-104H296c2.212,0,4,1.788,4,4V167.992z"/>
13
- <g>
14
- <path fill="#F2F0DA" d="M284,60h-88c-2.211,0-3.999,1.789-3.999,4v112c0,2.211,1.788,4,3.999,4h88c2.211,0,3.999-1.789,3.999-4V92
15
- V64C287.999,61.789,286.211,60,284,60z"/>
16
- </g>
17
- <g>
18
- <path fill="#8ED9EF" d="M180,72v96c0,2.211,1.788,4,4,4h3.999V68H184C181.788,68,180,69.79,180,72z"/>
19
- <path fill="#8ED9EF" d="M296,67.993h-3.999v104H296c2.212,0,4-1.789,4-4v-96C300,69.781,298.212,67.993,296,67.993z"/>
20
- </g>
21
- <g opacity="0.2">
22
- <path d="M210,84h24c1.105,0,2-0.894,2-2c0-1.106-0.895-2-2-2h-24c-1.105,0-2.001,0.894-2.001,2C207.999,83.105,208.895,84,210,84z
23
- "/>
24
- <path d="M210,136h32.001c1.104,0,1.999-0.895,1.999-2s-0.896-2-1.999-2H210c-1.105,0-2.001,0.895-2.001,2S208.895,136,210,136z"/>
25
- <path d="M250,136h20c1.105,0,2.001-0.895,2.001-2s-0.896-2-2.001-2h-20c-1.105,0-2.001,0.895-2.001,2S248.895,136,250,136z"/>
26
- <path d="M210,100h32.001c1.104,0,1.999-0.895,1.999-2c0-1.105-0.896-2-1.999-2H210c-1.105,0-2.001,0.894-2.001,2
27
- C207.999,99.105,208.895,100,210,100z"/>
28
- <path d="M250,100h20c1.105,0,2.001-0.895,2.001-2c0-1.105-0.896-2-2.001-2h-20c-1.105,0-2.001,0.894-2.001,2
29
- C247.999,99.105,248.895,100,250,100z"/>
30
- <path d="M270,156h-36c-1.106,0-1.999,0.895-1.999,2s0.893,2,1.999,2h36c1.105,0,2.001-0.895,2.001-2S271.105,156,270,156z"/>
31
- <path d="M226,156h-16c-1.105,0-2.001,0.895-2.001,2s0.896,2,2.001,2h16c1.106,0,1.999-0.895,1.999-2S227.106,156,226,156z"/>
32
- <path d="M210,148h7.999c1.105,0,2.001-0.895,2.001-2s-0.896-2-2.001-2H210c-1.105,0-2.001,0.895-2.001,2S208.895,148,210,148z"/>
33
- <path d="M226,144c-1.105,0-2,0.895-2,2s0.895,2,2,2h11.999c1.105,0,2.001-0.895,2.001-2s-0.896-2-2.001-2H226z"/>
34
- <path d="M270,144h-24c-1.105,0-2,0.895-2,2s0.895,2,2,2h24c1.105,0,2.001-0.895,2.001-2S271.105,144,270,144z"/>
35
- <path d="M270,120h-36c-1.106,0-1.999,0.894-1.999,2c0,1.105,0.893,2,1.999,2h36c1.105,0,2.001-0.895,2.001-2
36
- C272.001,120.894,271.105,120,270,120z"/>
37
- <path d="M226,120h-16c-1.105,0-2.001,0.894-2.001,2c0,1.105,0.896,2,2.001,2h16c1.106,0,1.999-0.895,1.999-2
38
- C227.999,120.894,227.106,120,226,120z"/>
39
- <path d="M210,112h7.999c1.105,0,2.001-0.895,2.001-2s-0.896-2-2.001-2H210c-1.105,0-2.001,0.895-2.001,2S208.895,112,210,112z"/>
40
- <path d="M226,108c-1.105,0-2,0.895-2,2s0.895,2,2,2h11.999c1.105,0,2.001-0.895,2.001-2s-0.896-2-2.001-2H226z"/>
41
- <path d="M270,108h-24c-1.105,0-2,0.895-2,2s0.895,2,2,2h24c1.105,0,2.001-0.895,2.001-2S271.105,108,270,108z"/>
42
- </g>
43
- </g>
44
- </svg>
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="55 277 240 240" style="enable-background:new 55 277 240 240;" xml:space="preserve">
5
+ <style type="text/css">
6
+ .st0{fill:#1880B6;}
7
+ .st1{fill:#324249;}
8
+ .st2{fill:#F2F0DA;}
9
+ .st3{fill:#8ED9EF;}
10
+ .st4{opacity:0.2;}
11
+ </style>
12
+ <rect id="Call_to_Action_2_" x="55" y="277" class="st0" width="240" height="240"/>
13
+ <g>
14
+ <path class="st1" d="M231,341h-4v0c0-4.4-3.6-8-8-8h-88c-4.4,0-8,3.6-8,8h-4c-4.4,0-8,3.6-8,8v96c0,4.4,3.6,8,8,8h4
15
+ c0,4.4,3.6,8,8,8h88c4.4,0,8-3.6,8-8v0h4c4.4,0,8-3.6,8-8v-96C239,344.6,235.4,341,231,341z M123,449h-4c-2.2,0-4-1.8-4-4v-96
16
+ c0-2.2,1.8-4,4-4h4V449z M223,369v84c0,2.2-1.8,4-4,4h-88c-2.2,0-4-1.8-4-4V341c0-2.2,1.8-4,4-4h88c2.2,0,4,1.8,4,4V369z M235,445
17
+ c0,2.2-1.8,4-4,4h-4V345h4c2.2,0,4,1.8,4,4V445z"/>
18
+ <g>
19
+ <path class="st2" d="M219,337h-88c-2.2,0-4,1.8-4,4v112c0,2.2,1.8,4,4,4h88c2.2,0,4-1.8,4-4v-84v-28C223,338.8,221.2,337,219,337z
20
+ "/>
21
+ </g>
22
+ <g>
23
+ <path class="st3" d="M115,349v96c0,2.2,1.8,4,4,4h4V345h-4C116.8,345,115,346.8,115,349z"/>
24
+ <path class="st3" d="M231,345h-4v104h4c2.2,0,4-1.8,4-4v-96C235,346.8,233.2,345,231,345z"/>
25
+ </g>
26
+ <g class="st4">
27
+ <path d="M145,361h24c1.1,0,2-0.9,2-2s-0.9-2-2-2h-24c-1.1,0-2,0.9-2,2C143,360.1,143.9,361,145,361z"/>
28
+ <path d="M145,413h32c1.1,0,2-0.9,2-2s-0.9-2-2-2h-32c-1.1,0-2,0.9-2,2S143.9,413,145,413z"/>
29
+ <path d="M185,413h20c1.1,0,2-0.9,2-2s-0.9-2-2-2h-20c-1.1,0-2,0.9-2,2S183.9,413,185,413z"/>
30
+ <path d="M145,377h32c1.1,0,2-0.9,2-2s-0.9-2-2-2h-32c-1.1,0-2,0.9-2,2C143,376.1,143.9,377,145,377z"/>
31
+ <path d="M185,377h20c1.1,0,2-0.9,2-2s-0.9-2-2-2h-20c-1.1,0-2,0.9-2,2C183,376.1,183.9,377,185,377z"/>
32
+ <path d="M205,433h-36c-1.1,0-2,0.9-2,2s0.9,2,2,2h36c1.1,0,2-0.9,2-2S206.1,433,205,433z"/>
33
+ <path d="M161,433h-16c-1.1,0-2,0.9-2,2s0.9,2,2,2h16c1.1,0,2-0.9,2-2S162.1,433,161,433z"/>
34
+ <path d="M145,425h8c1.1,0,2-0.9,2-2s-0.9-2-2-2h-8c-1.1,0-2,0.9-2,2S143.9,425,145,425z"/>
35
+ <path d="M161,421c-1.1,0-2,0.9-2,2s0.9,2,2,2h12c1.1,0,2-0.9,2-2s-0.9-2-2-2H161z"/>
36
+ <path d="M205,421h-24c-1.1,0-2,0.9-2,2s0.9,2,2,2h24c1.1,0,2-0.9,2-2S206.1,421,205,421z"/>
37
+ <path d="M205,397h-36c-1.1,0-2,0.9-2,2c0,1.1,0.9,2,2,2h36c1.1,0,2-0.9,2-2C207,397.9,206.1,397,205,397z"/>
38
+ <path d="M161,397h-16c-1.1,0-2,0.9-2,2c0,1.1,0.9,2,2,2h16c1.1,0,2-0.9,2-2C163,397.9,162.1,397,161,397z"/>
39
+ <path d="M145,389h8c1.1,0,2-0.9,2-2s-0.9-2-2-2h-8c-1.1,0-2,0.9-2,2S143.9,389,145,389z"/>
40
+ <path d="M161,385c-1.1,0-2,0.9-2,2s0.9,2,2,2h12c1.1,0,2-0.9,2-2s-0.9-2-2-2H161z"/>
41
+ <path d="M205,385h-24c-1.1,0-2,0.9-2,2s0.9,2,2,2h24c1.1,0,2-0.9,2-2S206.1,385,205,385z"/>
42
+ </g>
43
+ </g>
44
+ </svg>
widgets/so-post-carousel-widget/so-post-carousel-widget.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /*
3
- Widget Name: Post carousel widget
4
  Description: Gives you a widget to display your posts as a carousel.
5
- Author: Greg Priday
6
- Author URI: http://siteorigin.com
7
  */
8
 
9
  /**
@@ -54,9 +54,9 @@ class SiteOrigin_Widget_PostCarousel_Widget extends SiteOrigin_Widget {
54
  function __construct() {
55
  parent::__construct(
56
  'sow-post-carousel',
57
- __('SiteOrigin Post Carousel', 'siteorigin-widgets'),
58
  array(
59
- 'description' => __('Display your posts as a carousel.', 'siteorigin-widgets'),
60
  'help' => 'https://siteorigin.com/widgets-bundle/post-carousel-widget/'
61
  ),
62
  array(
@@ -65,12 +65,12 @@ class SiteOrigin_Widget_PostCarousel_Widget extends SiteOrigin_Widget {
65
  array(
66
  'title' => array(
67
  'type' => 'text',
68
- 'label' => __('Title', 'siteorigin-widgets'),
69
  ),
70
 
71
  'posts' => array(
72
  'type' => 'posts',
73
- 'label' => __('Posts query', 'siteorigin-widgets'),
74
  ),
75
  ),
76
  plugin_dir_path(__FILE__).'../'
@@ -88,7 +88,7 @@ class SiteOrigin_Widget_PostCarousel_Widget extends SiteOrigin_Widget {
88
  ),
89
  array(
90
  'sow-carousel-basic',
91
- siteorigin_widget_get_plugin_dir_url( 'post-carousel' ) . 'js/carousel' . SOW_BUNDLE_JS_SUFFIX . '.js',
92
  array( 'jquery', 'touch-swipe' ),
93
  SOW_BUNDLE_VERSION,
94
  true
@@ -99,7 +99,7 @@ class SiteOrigin_Widget_PostCarousel_Widget extends SiteOrigin_Widget {
99
  array(
100
  array(
101
  'sow-carousel-basic',
102
- siteorigin_widget_get_plugin_dir_url( 'post-carousel' ) . 'css/style.css',
103
  array(),
104
  SOW_BUNDLE_VERSION
105
  )
@@ -116,4 +116,4 @@ class SiteOrigin_Widget_PostCarousel_Widget extends SiteOrigin_Widget {
116
  }
117
  }
118
 
119
- siteorigin_widget_register('post-carousel', __FILE__);
1
  <?php
2
  /*
3
+ Widget Name: Post Carousel
4
  Description: Gives you a widget to display your posts as a carousel.
5
+ Author: SiteOrigin
6
+ Author URI: https://siteorigin.com
7
  */
8
 
9
  /**
54
  function __construct() {
55
  parent::__construct(
56
  'sow-post-carousel',
57
+ __('SiteOrigin Post Carousel', 'so-widgets-bundle'),
58
  array(
59
+ 'description' => __('Display your posts as a carousel.', 'so-widgets-bundle'),
60
  'help' => 'https://siteorigin.com/widgets-bundle/post-carousel-widget/'
61
  ),
62
  array(
65
  array(
66
  'title' => array(
67
  'type' => 'text',
68
+ 'label' => __('Title', 'so-widgets-bundle'),
69
  ),
70
 
71
  'posts' => array(
72
  'type' => 'posts',
73
+ 'label' => __('Posts query', 'so-widgets-bundle'),
74
  ),
75
  ),
76
  plugin_dir_path(__FILE__).'../'
88
  ),
89
  array(
90
  'sow-carousel-basic',
91
+ plugin_dir_url(__FILE__) . 'js/carousel' . SOW_BUNDLE_JS_SUFFIX . '.js',
92
  array( 'jquery', 'touch-swipe' ),
93
  SOW_BUNDLE_VERSION,
94
  true
99
  array(
100
  array(
101
  'sow-carousel-basic',
102
+ plugin_dir_url(__FILE__) . 'css/style.css',
103
  array(),
104
  SOW_BUNDLE_VERSION
105
  )
116
  }
117
  }
118
 
119
+ siteorigin_widget_register('sow-post-carousel', __FILE__, 'SiteOrigin_Widget_PostCarousel_Widget');
widgets/so-price-table-widget/assets/banner.svg CHANGED
@@ -1,42 +1,36 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
4
- <svg version="1.0" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
- width="480px" height="240px" viewBox="0 0 480 240" enable-background="new 0 0 480 240" xml:space="preserve">
6
- <rect id="Price_Table_1_" y="0.001" fill="#1880B6" width="480" height="240"/>
7
- <g>
8
- <path fill="#8ED9EF" d="M280,60.001H200c-5.875,0-12,5.998-12,11.999v104c0,2.126,2.001,4.001,4.024,4.001H272
9
- c1.937,0,4-2.375,4-4.001V84.001c0-4.424,3.582-8.001,8-8.001c1.105,0,1.999,0.892,1.999,2.001C286,79.103,285.105,80,284,80
10
- c-2.209,0-4,1.79-4,4.001v19.998h8c2.125,0,4-2.248,4-3.999V76C292,66.25,285.625,60.001,280,60.001z M232,163.999
11
- c-15.465,0-28-12.538-28-27.999c0-15.469,12.535-27.999,28-27.999c15.465,0,28,12.53,28,27.999
12
- C260,151.461,247.465,163.999,232,163.999z"/>
13
- <path fill="#F2F0DA" d="M256,136c0-13.257-10.746-23.999-24-23.999c-13.253,0-24,10.742-24,23.999c0,13.251,10.747,24,24,24
14
- C245.254,160,256,149.251,256,136z"/>
15
- <g>
16
- <path fill="#324249" d="M280,56H200c-8.124,0-16,8-16,16v104c0,4.399,3.688,8,8,8h80c4.402,0,8-3.874,8-7.976v-68.023h8
17
- c4.25,0,8-4.126,8-7.977V76C296,64,288.312,56,280,56z M292,100c0,1.751-1.875,3.999-4,3.999h-8V84.001
18
- c0-2.211,1.791-4.001,4-4.001c1.105,0,1.999-0.897,1.999-1.999C286,76.892,285.105,76,284,76c-4.419,0-8,3.577-8,8.001V176
19
- c0,1.626-2.062,4.001-4,4.001h-79.977C190,180.001,188,178.126,188,176V72c0-6.001,6.125-11.999,12-11.999H280
20
- c5.625,0,12,6.249,12,15.999V100z"/>
21
- <path fill="#324249" d="M232,125.999c2.209,0,4,1.791,4,4.001c0,1.102,0.895,2,2,2c1.106,0,2-0.898,2-2
22
- c0-3.726-2.555-6.829-6-7.717v-0.282c0-1.109-0.895-2-2-2s-2,0.891-2,2v0.282C226.555,123.171,224,126.274,224,130
23
- c0,4.415,3.582,8.001,8,8.001c2.209,0,4,1.787,4,4c0,2.211-1.791,3.999-4,3.999c-2.208,0-4-1.788-4-3.999
24
- c0-1.11-0.895-2.001-2-2.001c-1.105,0-2,0.891-2,2.001c0,3.72,2.555,6.82,5.999,7.719v0.281c0,1.102,0.895,2,2,2s2-0.898,2-2
25
- v-0.281c3.445-0.898,6-3.999,6-7.719c0-4.423-3.582-8.002-8-8.002c-2.208,0-4-1.788-4-3.999
26
- C228,127.79,229.792,125.999,232,125.999z"/>
27
- <path fill="#324249" d="M232,108.001c-15.465,0-28,12.53-28,27.999c0,15.461,12.535,27.999,28,27.999
28
- c15.465,0,28-12.538,28-27.999C260,120.531,247.465,108.001,232,108.001z M232,160c-13.253,0-24-10.749-24-24
29
- c0-13.257,10.747-23.999,24-23.999c13.254,0,24,10.742,24,23.999C256,149.251,245.254,160,232,160z"/>
30
- </g>
31
- <g opacity="0.2">
32
- <path d="M206,88h32c1.106,0,2-0.897,2-2c0-1.108-0.894-1.999-2-1.999h-32c-1.105,0-2,0.891-2,1.999C204,87.103,204.895,88,206,88z
33
- "/>
34
- <path d="M246,88h8c1.105,0,2-0.897,2-2c0-1.108-0.895-1.999-2-1.999h-8c-1.106,0-2,0.891-2,1.999C244,87.103,244.894,88,246,88z"
35
- />
36
- <path d="M254,95.999h-32c-1.105,0-2,0.892-2,2.002c0,1.1,0.894,1.999,2,1.999h32c1.105,0,2-0.899,2-1.999
37
- C256,96.891,255.105,95.999,254,95.999z"/>
38
- <path d="M214,95.999h-8c-1.105,0-2,0.892-2,2.002c0,1.1,0.895,1.999,2,1.999h8c1.105,0,2-0.899,2-1.999
39
- C216,96.891,215.105,95.999,214,95.999z"/>
40
- </g>
41
- </g>
42
- </svg>
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="55 277 240 240" style="enable-background:new 55 277 240 240;" xml:space="preserve">
5
+ <style type="text/css">
6
+ .st0{fill:#1880B6;}
7
+ .st1{fill:#8ED9EF;}
8
+ .st2{fill:#F2F0DA;}
9
+ .st3{fill:#324249;}
10
+ .st4{opacity:0.2;}
11
+ </style>
12
+ <rect id="Price_Table_1_" x="55" y="277" class="st0" width="240" height="240"/>
13
+ <g>
14
+ <path class="st1" d="M215,337h-80c-5.9,0-12,6-12,12v104c0,2.1,2,4,4,4h80c1.9,0,4-2.4,4-4v-92c0-4.4,3.6-8,8-8c1.1,0,2,0.9,2,2
15
+ c0,1.1-0.9,2-2,2c-2.2,0-4,1.8-4,4v20h8c2.1,0,4-2.2,4-4v-24C227,343.2,220.6,337,215,337z M167,441c-15.5,0-28-12.5-28-28
16
+ c0-15.5,12.5-28,28-28s28,12.5,28,28C195,428.5,182.5,441,167,441z"/>
17
+ <path class="st2" d="M191,413c0-13.3-10.7-24-24-24c-13.3,0-24,10.7-24,24c0,13.3,10.7,24,24,24C180.3,437,191,426.3,191,413z"/>
18
+ <g>
19
+ <path class="st3" d="M215,333h-80c-8.1,0-16,8-16,16v104c0,4.4,3.7,8,8,8h80c4.4,0,8-3.9,8-8v-68h8c4.2,0,8-4.1,8-8v-24
20
+ C231,341,223.3,333,215,333z M227,377c0,1.8-1.9,4-4,4h-8v-20c0-2.2,1.8-4,4-4c1.1,0,2-0.9,2-2c0-1.1-0.9-2-2-2c-4.4,0-8,3.6-8,8
21
+ v92c0,1.6-2.1,4-4,4h-80c-2,0-4-1.9-4-4V349c0-6,6.1-12,12-12h80c5.6,0,12,6.2,12,16V377z"/>
22
+ <path class="st3" d="M167,403c2.2,0,4,1.8,4,4c0,1.1,0.9,2,2,2c1.1,0,2-0.9,2-2c0-3.7-2.6-6.8-6-7.7V399c0-1.1-0.9-2-2-2
23
+ s-2,0.9-2,2v0.3c-3.4,0.9-6,4-6,7.7c0,4.4,3.6,8,8,8c2.2,0,4,1.8,4,4c0,2.2-1.8,4-4,4c-2.2,0-4-1.8-4-4c0-1.1-0.9-2-2-2
24
+ s-2,0.9-2,2c0,3.7,2.6,6.8,6,7.7v0.3c0,1.1,0.9,2,2,2s2-0.9,2-2v-0.3c3.4-0.9,6-4,6-7.7c0-4.4-3.6-8-8-8c-2.2,0-4-1.8-4-4
25
+ C163,404.8,164.8,403,167,403z"/>
26
+ <path class="st3" d="M167,385c-15.5,0-28,12.5-28,28c0,15.5,12.5,28,28,28s28-12.5,28-28C195,397.5,182.5,385,167,385z M167,437
27
+ c-13.3,0-24-10.7-24-24c0-13.3,10.7-24,24-24c13.3,0,24,10.7,24,24C191,426.3,180.3,437,167,437z"/>
28
+ </g>
29
+ <g class="st4">
30
+ <path d="M141,365h32c1.1,0,2-0.9,2-2c0-1.1-0.9-2-2-2h-32c-1.1,0-2,0.9-2,2C139,364.1,139.9,365,141,365z"/>
31
+ <path d="M181,365h8c1.1,0,2-0.9,2-2c0-1.1-0.9-2-2-2h-8c-1.1,0-2,0.9-2,2C179,364.1,179.9,365,181,365z"/>
32
+ <path d="M189,373h-32c-1.1,0-2,0.9-2,2c0,1.1,0.9,2,2,2h32c1.1,0,2-0.9,2-2C191,373.9,190.1,373,189,373z"/>
33
+ <path d="M149,373h-8c-1.1,0-2,0.9-2,2c0,1.1,0.9,2,2,2h8c1.1,0,2-0.9,2-2C151,373.9,150.1,373,149,373z"/>
34
+ </g>
35
+ </g>
36
+ </svg>
 
 
 
 
 
 
widgets/so-price-table-widget/so-price-table-widget.php CHANGED
@@ -1,19 +1,18 @@
1
  <?php
2
  /*
3
- Widget Name: Price table widget
4
  Description: A powerful yet simple price table widget for your sidebars or Page Builder pages.
5
- Author: Greg Priday
6
- Author URI: http://siteorigin.com
7
- Widget URI: http://siteorigin.com/price-table-widget/
8
  */
9
 
10
  class SiteOrigin_Widget_PriceTable_Widget extends SiteOrigin_Widget {
11
  function __construct() {
12
  parent::__construct(
13
  'sow-price-table',
14
- __('SiteOrigin Price Table', 'siteorigin-widgets'),
15
  array(
16
- 'description' => __('A simple Price Table.', 'siteorigin-widgets'),
17
  'help' => 'https://siteorigin.com/widgets-bundle/price-table-widget/'
18
  ),
19
  array(
@@ -22,13 +21,13 @@ class SiteOrigin_Widget_PriceTable_Widget extends SiteOrigin_Widget {
22
  array(
23
  'title' => array(
24
  'type' => 'text',
25
- 'label' => __('Title', 'siteorigin-widgets'),
26
  ),
27
 
28
  'columns' => array(
29
  'type' => 'repeater',
30
- 'label' => __('Columns', 'siteorigin-widgets'),
31
- 'item_name' => __('Column', 'siteorigin-widgets'),
32
  'item_label' => array(
33
  'selector' => "[id*='columns-title']",
34
  'update_event' => 'change',
@@ -37,42 +36,42 @@ class SiteOrigin_Widget_PriceTable_Widget extends SiteOrigin_Widget {
37
  'fields' => array(
38
  'featured' => array(
39
  'type' => 'checkbox',
40
- 'label' => __('Featured', 'siteorigin-widgets'),
41
  ),
42
  'title' => array(
43
  'type' => 'text',
44
- 'label' => __('Title', 'siteorigin-widgets'),
45
  ),
46
  'subtitle' => array(
47
  'type' => 'text',
48
- 'label' => __('Subtitle', 'siteorigin-widgets'),
49
  ),
50
 
51
  'image' => array(
52
  'type' => 'media',
53
- 'label' => __('Image', 'siteorigin-widgets'),
54
  ),
55
 
56
  'price' => array(
57
  'type' => 'text',
58
- 'label' => __('Price', 'siteorigin-widgets'),
59
  ),
60
  'per' => array(
61
  'type' => 'text',
62
- 'label' => __('Per', 'siteorigin-widgets'),
63
  ),
64
  'button' => array(
65
  'type' => 'text',
66
- 'label' => __('Button text', 'siteorigin-widgets'),
67
  ),
68
  'url' => array(
69
  'type' => 'link',
70
- 'label' => __('Button URL', 'siteorigin-widgets'),
71
  ),
72
  'features' => array(
73
  'type' => 'repeater',
74
- 'label' => __('Features', 'siteorigin-widgets'),
75
- 'item_name' => __('Feature', 'siteorigin-widgets'),
76
  'item_label' => array(
77
  'selector' => "[id*='columns-features-text']",
78
  'update_event' => 'change',
@@ -81,19 +80,19 @@ class SiteOrigin_Widget_PriceTable_Widget extends SiteOrigin_Widget {
81
  'fields' => array(
82
  'text' => array(
83
  'type' => 'text',
84
- 'label' => __('Text', 'siteorigin-widgets'),
85
  ),
86
  'hover' => array(
87
  'type' => 'text',
88
- 'label' => __('Hover text', 'siteorigin-widgets'),
89
  ),
90
  'icon_new' => array(
91
  'type' => 'icon',
92
- 'label' => __('Icon', 'siteorigin-widgets'),
93
  ),
94
  'icon_color' => array(
95
  'type' => 'color',
96
- 'label' => __('Icon color', 'siteorigin-widgets'),
97
  ),
98
  ),
99
  ),
@@ -102,35 +101,35 @@ class SiteOrigin_Widget_PriceTable_Widget extends SiteOrigin_Widget {
102
 
103
  'theme' => array(
104
  'type' => 'select',
105
- 'label' => __('Price table theme', 'siteorigin-widgets'),
106
  'options' => array(
107
- 'atom' => __('Atom', 'siteorigin-widgets'),
108
  ),
109
  ),
110
 
111
  'header_color' => array(
112
  'type' => 'color',
113
- 'label' => __('Header color', 'siteorigin-widgets'),
114
  ),
115
 
116
  'featured_header_color' => array(
117
  'type' => 'color',
118
- 'label' => __('Featured header color', 'siteorigin-widgets'),
119
  ),
120
 
121
  'button_color' => array(
122
  'type' => 'color',
123
- 'label' => __('Button color', 'siteorigin-widgets'),
124
  ),
125
 
126
  'featured_button_color' => array(
127
  'type' => 'color',
128
- 'label' => __('Featured button color', 'siteorigin-widgets'),
129
  ),
130
 
131
  'button_new_window' => array(
132
  'type' => 'checkbox',
133
- 'label' => __('Open Button URL in a new window', 'siteorigin-widgets'),
134
  ),
135
  ),
136
  plugin_dir_path(__FILE__).'../'
@@ -142,7 +141,7 @@ class SiteOrigin_Widget_PriceTable_Widget extends SiteOrigin_Widget {
142
  array(
143
  array(
144
  'siteorigin-pricetable',
145
- siteorigin_widget_get_plugin_dir_url( 'price-table' ) . 'js/pricetable' . SOW_BUNDLE_JS_SUFFIX . '.js',
146
  array( 'jquery' )
147
  )
148
  )
@@ -236,4 +235,4 @@ class SiteOrigin_Widget_PriceTable_Widget extends SiteOrigin_Widget {
236
  }
237
  }
238
 
239
- siteorigin_widget_register('price-table', __FILE__);
1
  <?php
2
  /*
3
+ Widget Name: Price Table
4
  Description: A powerful yet simple price table widget for your sidebars or Page Builder pages.
5
+ Author: SiteOrigin
6
+ Author URI: https://siteorigin.com
 
7
  */
8
 
9
  class SiteOrigin_Widget_PriceTable_Widget extends SiteOrigin_Widget {
10
  function __construct() {
11
  parent::__construct(
12
  'sow-price-table',
13
+ __('SiteOrigin Price Table', 'so-widgets-bundle'),
14
  array(
15
+ 'description' => __('A simple Price Table.', 'so-widgets-bundle'),
16
  'help' => 'https://siteorigin.com/widgets-bundle/price-table-widget/'
17
  ),
18
  array(
21
  array(
22
  'title' => array(
23
  'type' => 'text',
24
+ 'label' => __('Title', 'so-widgets-bundle'),
25
  ),
26
 
27
  'columns' => array(
28
  'type' => 'repeater',
29
+ 'label' => __('Columns', 'so-widgets-bundle'),
30
+ 'item_name' => __('Column', 'so-widgets-bundle'),
31
  'item_label' => array(
32
  'selector' => "[id*='columns-title']",
33
  'update_event' => 'change',
36
  'fields' => array(
37
  'featured' => array(
38
  'type' => 'checkbox',
39
+ 'label' => __('Featured', 'so-widgets-bundle'),
40
  ),
41
  'title' => array(
42
  'type' => 'text',
43
+ 'label' => __('Title', 'so-widgets-bundle'),
44
  ),
45
  'subtitle' => array(
46
  'type' => 'text',
47
+ 'label' => __('Subtitle', 'so-widgets-bundle'),
48
  ),
49
 
50
  'image' => array(
51
  'type' => 'media',
52
+ 'label' => __('Image', 'so-widgets-bundle'),
53
  ),
54
 
55
  'price' => array(
56
  'type' => 'text',
57
+ 'label' => __('Price', 'so-widgets-bundle'),
58
  ),
59
  'per' => array(
60
  'type' => 'text',
61
+ 'label' => __('Per', 'so-widgets-bundle'),
62
  ),
63
  'button' => array(
64
  'type' => 'text',
65
+ 'label' => __('Button text', 'so-widgets-bundle'),
66
  ),
67
  'url' => array(
68
  'type' => 'link',
69
+ 'label' => __('Button URL', 'so-widgets-bundle'),
70
  ),
71
  'features' => array(
72
  'type' => 'repeater',
73
+ 'label' => __('Features', 'so-widgets-bundle'),
74
+ 'item_name' => __('Feature', 'so-widgets-bundle'),
75
  'item_label' => array(
76
  'selector' => "[id*='columns-features-text']",
77
  'update_event' => 'change',
80
  'fields' => array(
81
  'text' => array(
82
  'type' => 'text',
83
+ 'label' => __('Text', 'so-widgets-bundle'),
84
  ),
85
  'hover' => array(
86
  'type' => 'text',
87
+ 'label' => __('Hover text', 'so-widgets-bundle'),
88
  ),
89
  'icon_new' => array(
90
  'type' => 'icon',
91
+ 'label' => __('Icon', 'so-widgets-bundle'),
92
  ),
93
  'icon_color' => array(
94
  'type' => 'color',
95
+ 'label' => __('Icon color', 'so-widgets-bundle'),
96
  ),
97
  ),
98
  ),
101
 
102
  'theme' => array(
103
  'type' => 'select',
104
+ 'label' => __('Price table theme', 'so-widgets-bundle'),
105
  'options' => array(
106
+ 'atom' => __('Atom', 'so-widgets-bundle'),
107
  ),
108
  ),
109
 
110
  'header_color' => array(
111
  'type' => 'color',
112
+ 'label' => __('Header color', 'so-widgets-bundle'),
113
  ),
114
 
115
  'featured_header_color' => array(
116
  'type' => 'color',
117
+ 'label' => __('Featured header color', 'so-widgets-bundle'),
118
  ),
119
 
120
  'button_color' => array(
121
  'type' => 'color',
122
+ 'label' => __('Button color', 'so-widgets-bundle'),
123
  ),
124
 
125
  'featured_button_color' => array(
126
  'type' => 'color',
127
+ 'label' => __('Featured button color', 'so-widgets-bundle'),
128
  ),
129
 
130
  'button_new_window' => array(
131
  'type' => 'checkbox',
132
+ 'label' => __('Open Button URL in a new window', 'so-widgets-bundle'),
133
  ),
134
  ),
135
  plugin_dir_path(__FILE__).'../'
141
  array(
142
  array(
143
  'siteorigin-pricetable',
144
+ plugin_dir_url(__FILE__) . 'js/pricetable' . SOW_BUNDLE_JS_SUFFIX . '.js',
145
  array( 'jquery' )
146
  )
147
  )
235
  }
236
  }
237
 
238
+ siteorigin_widget_register('sow-price-table', __FILE__, 'SiteOrigin_Widget_PriceTable_Widget');
widgets/so-simple-masonry-widget/js/packery.pkgd.js ADDED
@@ -0,0 +1,4089 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * Packery PACKAGED v1.4.3
3
+ * bin-packing layout library
4
+ *
5
+ * Licensed GPLv3 for open source use
6
+ * or Flickity Commercial License for commercial use
7
+ *
8
+ * http://packery.metafizzy.co
9
+ * Copyright 2015 Metafizzy
10
+ */
11
+
12
+ /**
13
+ * Bridget makes jQuery widgets
14
+ * v1.1.0
15
+ * MIT license
16
+ */
17
+
18
+ ( function( window ) {
19
+
20
+
21
+
22
+ // -------------------------- utils -------------------------- //
23
+
24
+ var slice = Array.prototype.slice;
25
+
26
+ function noop() {}
27
+
28
+ // -------------------------- definition -------------------------- //
29
+
30
+ function defineBridget( $ ) {
31
+
32
+ // bail if no jQuery
33
+ if ( !$ ) {
34
+ return;
35
+ }
36
+
37
+ // -------------------------- addOptionMethod -------------------------- //
38
+
39
+ /**
40
+ * adds option method -> $().plugin('option', {...})
41
+ * @param {Function} PluginClass - constructor class
42
+ */
43
+ function addOptionMethod( PluginClass ) {
44
+ // don't overwrite original option method
45
+ if ( PluginClass.prototype.option ) {
46
+ return;
47
+ }
48
+
49
+ // option setter
50
+ PluginClass.prototype.option = function( opts ) {
51
+ // bail out if not an object
52
+ if ( !$.isPlainObject( opts ) ){
53
+ return;
54
+ }
55
+ this.options = $.extend( true, this.options, opts );
56
+ };
57
+ }
58
+
59
+ // -------------------------- plugin bridge -------------------------- //
60
+
61
+ // helper function for logging errors
62
+ // $.error breaks jQuery chaining
63
+ var logError = typeof console === 'undefined' ? noop :
64
+ function( message ) {
65
+ console.error( message );
66
+ };
67
+
68
+ /**
69
+ * jQuery plugin bridge, access methods like $elem.plugin('method')
70
+ * @param {String} namespace - plugin name
71
+ * @param {Function} PluginClass - constructor class
72
+ */
73
+ function bridge( namespace, PluginClass ) {
74
+ // add to jQuery fn namespace
75
+ $.fn[ namespace ] = function( options ) {
76
+ if ( typeof options === 'string' ) {
77
+ // call plugin method when first argument is a string
78
+ // get arguments for method
79
+ var args = slice.call( arguments, 1 );
80
+
81
+ for ( var i=0, len = this.length; i < len; i++ ) {
82
+ var elem = this[i];
83
+ var instance = $.data( elem, namespace );
84
+ if ( !instance ) {
85
+ logError( "cannot call methods on " + namespace + " prior to initialization; " +
86
+ "attempted to call '" + options + "'" );
87
+ continue;
88
+ }
89
+ if ( !$.isFunction( instance[options] ) || options.charAt(0) === '_' ) {
90
+ logError( "no such method '" + options + "' for " + namespace + " instance" );
91
+ continue;
92
+ }
93
+
94
+ // trigger method with arguments
95
+ var returnValue = instance[ options ].apply( instance, args );
96
+
97
+ // break look and return first value if provided
98
+ if ( returnValue !== undefined ) {
99
+ return returnValue;
100
+ }
101
+ }
102
+ // return this if no return value
103
+ return this;
104
+ } else {
105
+ return this.each( function() {
106
+ var instance = $.data( this, namespace );
107
+ if ( instance ) {
108
+ // apply options & init
109
+ instance.option( options );
110
+ instance._init();
111
+ } else {
112
+ // initialize new instance
113
+ instance = new PluginClass( this, options );
114
+ $.data( this, namespace, instance );
115
+ }
116
+ });
117
+ }
118
+ };
119
+
120
+ }
121
+
122
+ // -------------------------- bridget -------------------------- //
123
+
124
+ /**
125
+ * converts a Prototypical class into a proper jQuery plugin
126
+ * the class must have a ._init method
127
+ * @param {String} namespace - plugin name, used in $().pluginName
128
+ * @param {Function} PluginClass - constructor class
129
+ */
130
+ $.bridget = function( namespace, PluginClass ) {
131
+ addOptionMethod( PluginClass );
132
+ bridge( namespace, PluginClass );
133
+ };
134
+
135
+ return $.bridget;
136
+
137
+ }
138
+
139
+ // transport
140
+ if ( typeof define === 'function' && define.amd ) {
141
+ // AMD
142
+ define( 'jquery-bridget/jquery.bridget',[ 'jquery' ], defineBridget );
143
+ } else if ( typeof exports === 'object' ) {
144
+ defineBridget( require('jquery') );
145
+ } else {
146
+ // get jquery from browser global
147
+ defineBridget( window.jQuery );
148
+ }
149
+
150
+ })( window );
151
+
152
+ /*!
153
+ * classie v1.0.1
154
+ * class helper functions
155
+ * from bonzo https://github.com/ded/bonzo
156
+ * MIT license
157
+ *
158
+ * classie.has( elem, 'my-class' ) -> true/false
159
+ * classie.add( elem, 'my-new-class' )
160
+ * classie.remove( elem, 'my-unwanted-class' )
161
+ * classie.toggle( elem, 'my-class' )
162
+ */
163
+
164
+ /*jshint browser: true, strict: true, undef: true, unused: true */
165
+ /*global define: false, module: false */
166
+
167
+ ( function( window ) {
168
+
169
+
170
+
171
+ // class helper functions from bonzo https://github.com/ded/bonzo
172
+
173
+ function classReg( className ) {
174
+ return new RegExp("(^|\\s+)" + className + "(\\s+|$)");
175
+ }
176
+
177
+ // classList support for class management
178
+ // altho to be fair, the api sucks because it won't accept multiple classes at once
179
+ var hasClass, addClass, removeClass;
180
+
181
+ if ( 'classList' in document.documentElement ) {
182
+ hasClass = function( elem, c ) {
183
+ return elem.classList.contains( c );
184
+ };
185
+ addClass = function( elem, c ) {
186
+ elem.classList.add( c );
187
+ };
188
+ removeClass = function( elem, c ) {
189
+ elem.classList.remove( c );
190
+ };
191
+ }
192
+ else {
193
+ hasClass = function( elem, c ) {
194
+ return classReg( c ).test( elem.className );
195
+ };
196
+ addClass = function( elem, c ) {
197
+ if ( !hasClass( elem, c ) ) {
198
+ elem.className = elem.className + ' ' + c;
199
+ }
200
+ };
201
+ removeClass = function( elem, c ) {
202
+ elem.className = elem.className.replace( classReg( c ), ' ' );
203
+ };
204
+ }
205
+
206
+ function toggleClass( elem, c ) {
207
+ var fn = hasClass( elem, c ) ? removeClass : addClass;
208
+ fn( elem, c );
209
+ }
210
+
211
+ var classie = {
212
+ // full names
213
+ hasClass: hasClass,
214
+ addClass: addClass,
215
+ removeClass: removeClass,
216
+ toggleClass: toggleClass,
217
+ // short names
218
+ has: hasClass,
219
+ add: addClass,
220
+ remove: removeClass,
221
+ toggle: toggleClass
222
+ };
223
+
224
+ // transport
225
+ if ( typeof define === 'function' && define.amd ) {
226
+ // AMD
227
+ define( 'classie/classie',classie );
228
+ } else if ( typeof exports === 'object' ) {
229
+ // CommonJS
230
+ module.exports = classie;
231
+ } else {
232
+ // browser global
233
+ window.classie = classie;
234
+ }
235
+
236
+ })( window );
237
+
238
+ /*!
239
+ * getStyleProperty v1.0.4
240
+ * original by kangax
241
+ * http://perfectionkills.com/feature-testing-css-properties/
242
+ * MIT license
243
+ */
244
+
245
+ /*jshint browser: true, strict: true, undef: true */
246
+ /*global define: false, exports: false, module: false */
247
+
248
+ ( function( window ) {
249
+
250
+
251
+
252
+ var prefixes = 'Webkit Moz ms Ms O'.split(' ');
253
+ var docElemStyle = document.documentElement.style;
254
+
255
+ function getStyleProperty( propName ) {
256
+ if ( !propName ) {
257
+ return;
258
+ }
259
+
260
+ // test standard property first
261
+ if ( typeof docElemStyle[ propName ] === 'string' ) {
262
+ return propName;
263
+ }
264
+
265
+ // capitalize
266
+ propName = propName.charAt(0).toUpperCase() + propName.slice(1);
267
+
268
+ // test vendor specific properties
269
+ var prefixed;
270
+ for ( var i=0, len = prefixes.length; i < len; i++ ) {
271
+ prefixed = prefixes[i] + propName;
272
+ if ( typeof docElemStyle[ prefixed ] === 'string' ) {
273
+ return prefixed;
274
+ }
275
+ }
276
+ }
277
+
278
+ // transport
279
+ if ( typeof define === 'function' && define.amd ) {
280
+ // AMD
281
+ define( 'get-style-property/get-style-property',[],function() {
282
+ return getStyleProperty;
283
+ });
284
+ } else if ( typeof exports === 'object' ) {
285
+ // CommonJS for Component
286
+ module.exports = getStyleProperty;
287
+ } else {
288
+ // browser global
289
+ window.getStyleProperty = getStyleProperty;
290
+ }
291
+
292
+ })( window );
293
+
294
+ /*!
295
+ * getSize v1.2.2
296
+ * measure size of elements
297
+ * MIT license
298
+ */
299
+
300
+ /*jshint browser: true, strict: true, undef: true, unused: true */
301
+ /*global define: false, exports: false, require: false, module: false, console: false */
302
+
303
+ ( function( window, undefined ) {
304
+
305
+
306
+
307
+ // -------------------------- helpers -------------------------- //
308
+
309
+ // get a number from a string, not a percentage
310
+ function getStyleSize( value ) {
311
+ var num = parseFloat( value );
312
+ // not a percent like '100%', and a number
313
+ var isValid = value.indexOf('%') === -1 && !isNaN( num );
314
+ return isValid && num;
315
+ }
316
+
317
+ function noop() {}
318
+
319
+ var logError = typeof console === 'undefined' ? noop :
320
+ function( message ) {
321
+ console.error( message );
322
+ };
323
+
324
+ // -------------------------- measurements -------------------------- //
325
+
326
+ var measurements = [
327
+ 'paddingLeft',
328
+ 'paddingRight',
329
+ 'paddingTop',
330
+ 'paddingBottom',
331
+ 'marginLeft',
332
+ 'marginRight',
333
+ 'marginTop',
334
+ 'marginBottom',
335
+ 'borderLeftWidth',
336
+ 'borderRightWidth',
337
+ 'borderTopWidth',
338
+ 'borderBottomWidth'
339
+ ];
340
+
341
+ function getZeroSize() {
342
+ var size = {
343
+ width: 0,
344
+ height: 0,
345
+ innerWidth: 0,
346
+ innerHeight: 0,
347
+ outerWidth: 0,
348
+ outerHeight: 0
349
+ };
350
+ for ( var i=0, len = measurements.length; i < len; i++ ) {
351
+ var measurement = measurements[i];
352
+ size[ measurement ] = 0;
353
+ }
354
+ return size;
355
+ }
356
+
357
+
358
+
359
+ function defineGetSize( getStyleProperty ) {
360
+
361
+ // -------------------------- setup -------------------------- //
362
+
363
+ var isSetup = false;
364
+
365
+ var getStyle, boxSizingProp, isBoxSizeOuter;
366
+
367
+ /**
368
+ * setup vars and functions
369
+ * do it on initial getSize(), rather than on script load
370
+ * For Firefox bug https://bugzilla.mozilla.org/show_bug.cgi?id=548397
371
+ */
372
+ function setup() {
373
+ // setup once
374
+ if ( isSetup ) {
375
+ return;
376
+ }
377
+ isSetup = true;
378
+
379
+ var getComputedStyle = window.getComputedStyle;
380
+ getStyle = ( function() {
381
+ var getStyleFn = getComputedStyle ?
382
+ function( elem ) {
383
+ return getComputedStyle( elem, null );
384
+ } :
385
+ function( elem ) {
386
+ return elem.currentStyle;
387
+ };
388
+
389
+ return function getStyle( elem ) {
390
+ var style = getStyleFn( elem );
391
+ if ( !style ) {
392
+ logError( 'Style returned ' + style +
393
+ '. Are you running this code in a hidden iframe on Firefox? ' +
394
+ 'See http://bit.ly/getsizebug1' );
395
+ }
396
+ return style;
397
+ };
398
+ })();
399
+
400
+ // -------------------------- box sizing -------------------------- //
401
+
402
+ boxSizingProp = getStyleProperty('boxSizing');
403
+
404
+ /**
405
+ * WebKit measures the outer-width on style.width on border-box elems
406
+ * IE & Firefox measures the inner-width
407
+ */
408
+ if ( boxSizingProp ) {
409
+ var div = document.createElement('div');
410
+ div.style.width = '200px';
411
+ div.style.padding = '1px 2px 3px 4px';
412
+ div.style.borderStyle = 'solid';
413
+ div.style.borderWidth = '1px 2px 3px 4px';
414
+ div.style[ boxSizingProp ] = 'border-box';
415
+
416
+ var body = document.body || document.documentElement;
417
+ body.appendChild( div );
418
+ var style = getStyle( div );
419
+
420
+ isBoxSizeOuter = getStyleSize( style.width ) === 200;
421
+ body.removeChild( div );
422
+ }
423
+
424
+ }
425
+
426
+ // -------------------------- getSize -------------------------- //
427
+
428
+ function getSize( elem ) {
429
+ setup();
430
+
431
+ // use querySeletor if elem is string
432
+ if ( typeof elem === 'string' ) {
433
+ elem = document.querySelector( elem );
434
+ }
435
+
436
+ // do not proceed on non-objects
437
+ if ( !elem || typeof elem !== 'object' || !elem.nodeType ) {
438
+ return;
439
+ }
440
+
441
+ var style = getStyle( elem );
442
+
443
+ // if hidden, everything is 0
444
+ if ( style.display === 'none' ) {
445
+ return getZeroSize();
446
+ }
447
+
448
+ var size = {};
449
+ size.width = elem.offsetWidth;
450
+ size.height = elem.offsetHeight;
451
+
452
+ var isBorderBox = size.isBorderBox = !!( boxSizingProp &&
453
+ style[ boxSizingProp ] && style[ boxSizingProp ] === 'border-box' );
454
+
455
+ // get all measurements
456
+ for ( var i=0, len = measurements.length; i < len; i++ ) {
457
+ var measurement = measurements[i];
458
+ var value = style[ measurement ];
459
+ value = mungeNonPixel( elem, value );
460
+ var num = parseFloat( value );
461
+ // any 'auto', 'medium' value will be 0
462
+ size[ measurement ] = !isNaN( num ) ? num : 0;
463
+ }
464
+
465
+ var paddingWidth = size.paddingLeft + size.paddingRight;
466
+ var paddingHeight = size.paddingTop + size.paddingBottom;
467
+ var marginWidth = size.marginLeft + size.marginRight;
468
+ var marginHeight = size.marginTop + size.marginBottom;
469
+ var borderWidth = size.borderLeftWidth + size.borderRightWidth;
470
+ var borderHeight = size.borderTopWidth + size.borderBottomWidth;
471
+
472
+ var isBorderBoxSizeOuter = isBorderBox && isBoxSizeOuter;
473
+
474
+ // overwrite width and height if we can get it from style
475
+ var styleWidth = getStyleSize( style.width );
476
+ if ( styleWidth !== false ) {
477
+ size.width = styleWidth +
478
+ // add padding and border unless it's already including it
479
+ ( isBorderBoxSizeOuter ? 0 : paddingWidth + borderWidth );
480
+ }
481
+
482
+ var styleHeight = getStyleSize( style.height );
483
+ if ( styleHeight !== false ) {
484
+ size.height = styleHeight +
485
+ // add padding and border unless it's already including it
486
+ ( isBorderBoxSizeOuter ? 0 : paddingHeight + borderHeight );
487
+ }
488
+
489
+ size.innerWidth = size.width - ( paddingWidth + borderWidth );
490
+ size.innerHeight = size.height - ( paddingHeight + borderHeight );
491
+
492
+ size.outerWidth = size.width + marginWidth;
493
+ size.outerHeight = size.height + marginHeight;
494
+
495
+ return size;
496
+ }
497
+
498
+ // IE8 returns percent values, not pixels
499
+ // taken from jQuery's curCSS
500
+ function mungeNonPixel( elem, value ) {
501
+ // IE8 and has percent value
502
+ if ( window.getComputedStyle || value.indexOf('%') === -1 ) {
503
+ return value;
504
+ }
505
+ var style = elem.style;
506
+ // Remember the original values
507
+ var left = style.left;
508
+ var rs = elem.runtimeStyle;
509
+ var rsLeft = rs && rs.left;
510
+
511
+ // Put in the new values to get a computed value out
512
+ if ( rsLeft ) {
513
+ rs.left = elem.currentStyle.left;
514
+ }
515
+ style.left = value;
516
+ value = style.pixelLeft;
517
+
518
+ // Revert the changed values
519
+ style.left = left;
520
+ if ( rsLeft ) {
521
+ rs.left = rsLeft;
522
+ }
523
+
524
+ return value;
525
+ }
526
+
527
+ return getSize;
528
+
529
+ }
530
+
531
+ // transport
532
+ if ( typeof define === 'function' && define.amd ) {
533
+ // AMD for RequireJS
534
+ define( 'get-size/get-size',[ 'get-style-property/get-style-property' ], defineGetSize );
535
+ } else if ( typeof exports === 'object' ) {
536
+ // CommonJS for Component
537
+ module.exports = defineGetSize( require('desandro-get-style-property') );
538
+ } else {
539
+ // browser global
540
+ window.getSize = defineGetSize( window.getStyleProperty );
541
+ }
542
+
543
+ })( window );
544
+
545
+ /*!
546
+ * eventie v1.0.6
547
+ * event binding helper
548
+ * eventie.bind( elem, 'click', myFn )
549
+ * eventie.unbind( elem, 'click', myFn )
550
+ * MIT license
551
+ */
552
+
553
+ /*jshint browser: true, undef: true, unused: true */
554
+ /*global define: false, module: false */
555
+
556
+ ( function( window ) {
557
+
558
+
559
+
560
+ var docElem = document.documentElement;
561
+
562
+ var bind = function() {};
563
+
564
+ function getIEEvent( obj ) {
565
+ var event = window.event;
566
+ // add event.target
567
+ event.target = event.target || event.srcElement || obj;
568
+ return event;
569
+ }
570
+
571
+ if ( docElem.addEventListener ) {
572
+ bind = function( obj, type, fn ) {
573
+ obj.addEventListener( type, fn, false );
574
+ };
575
+ } else if ( docElem.attachEvent ) {
576
+ bind = function( obj, type, fn ) {
577
+ obj[ type + fn ] = fn.handleEvent ?
578
+ function() {
579
+ var event = getIEEvent( obj );
580
+ fn.handleEvent.call( fn, event );
581
+ } :
582
+ function() {
583
+ var event = getIEEvent( obj );
584
+ fn.call( obj, event );
585
+ };
586
+ obj.attachEvent( "on" + type, obj[ type + fn ] );
587
+ };
588
+ }
589
+
590
+ var unbind = function() {};
591
+
592
+ if ( docElem.removeEventListener ) {
593
+ unbind = function( obj, type, fn ) {
594
+ obj.removeEventListener( type, fn, false );
595
+ };
596
+ } else if ( docElem.detachEvent ) {
597
+ unbind = function( obj, type, fn ) {
598
+ obj.detachEvent( "on" + type, obj[ type + fn ] );
599
+ try {
600
+ delete obj[ type + fn ];
601
+ } catch ( err ) {
602
+ // can't delete window object properties
603
+ obj[ type + fn ] = undefined;
604
+ }
605
+ };
606
+ }
607
+
608
+ var eventie = {
609
+ bind: bind,
610
+ unbind: unbind
611
+ };
612
+
613
+ // ----- module definition ----- //
614
+
615
+ if ( typeof define === 'function' && define.amd ) {
616
+ // AMD
617
+ define( 'eventie/eventie',eventie );
618
+ } else if ( typeof exports === 'object' ) {
619
+ // CommonJS
620
+ module.exports = eventie;
621
+ } else {
622
+ // browser global
623
+ window.eventie = eventie;
624
+ }
625
+
626
+ })( window );
627
+
628
+ /*!
629
+ * EventEmitter v4.2.11 - git.io/ee
630
+ * Unlicense - http://unlicense.org/
631
+ * Oliver Caldwell - http://oli.me.uk/
632
+ * @preserve
633
+ */
634
+
635
+ ;(function () {
636
+
637
+
638
+ /**
639
+ * Class for managing events.
640
+ * Can be extended to provide event functionality in other classes.
641
+ *
642
+ * @class EventEmitter Manages event registering and emitting.
643
+ */
644
+ function EventEmitter() {}
645
+
646
+ // Shortcuts to improve speed and size
647
+ var proto = EventEmitter.prototype;
648
+ var exports = this;
649
+ var originalGlobalValue = exports.EventEmitter;
650
+
651
+ /**
652
+ * Finds the index of the listener for the event in its storage array.
653
+ *
654
+ * @param {Function[]} listeners Array of listeners to search through.
655
+ * @param {Function} listener Method to look for.
656
+ * @return {Number} Index of the specified listener, -1 if not found
657
+ * @api private
658
+ */
659
+ function indexOfListener(listeners, listener) {
660
+ var i = listeners.length;
661
+ while (i--) {
662
+ if (listeners[i].listener === listener) {
663
+ return i;
664
+ }
665
+ }
666
+
667
+ return -1;
668
+ }
669
+
670
+ /**
671
+ * Alias a method while keeping the context correct, to allow for overwriting of target method.
672
+ *
673
+ * @param {String} name The name of the target method.
674
+ * @return {Function} The aliased method
675
+ * @api private
676
+ */
677
+ function alias(name) {
678
+ return function aliasClosure() {
679
+ return this[name].apply(this, arguments);
680
+ };
681
+ }
682
+
683
+ /**
684
+ * Returns the listener array for the specified event.
685
+ * Will initialise the event object and listener arrays if required.
686
+ * Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them.
687
+ * Each property in the object response is an array of listener functions.
688
+ *
689
+ * @param {String|RegExp} evt Name of the event to return the listeners from.
690
+ * @return {Function[]|Object} All listener functions for the event.
691
+ */
692
+ proto.getListeners = function getListeners(evt) {
693
+ var events = this._getEvents();
694
+ var response;
695
+ var key;
696
+
697
+ // Return a concatenated array of all matching events if
698
+ // the selector is a regular expression.
699
+ if (evt instanceof RegExp) {
700
+ response = {};
701
+ for (key in events) {
702
+ if (events.hasOwnProperty(key) && evt.test(key)) {
703
+ response[key] = events[key];
704
+ }
705
+ }
706
+ }
707
+ else {
708
+ response = events[evt] || (events[evt] = []);
709
+ }
710
+
711
+ return response;
712
+ };
713
+
714
+ /**
715
+ * Takes a list of listener objects and flattens it into a list of listener functions.
716
+ *
717
+ * @param {Object[]} listeners Raw listener objects.
718
+ * @return {Function[]} Just the listener functions.
719
+ */
720
+ proto.flattenListeners = function flattenListeners(listeners) {
721
+ var flatListeners = [];
722
+ var i;
723
+
724
+ for (i = 0; i < listeners.length; i += 1) {
725
+ flatListeners.push(listeners[i].listener);
726
+ }
727
+
728
+ return flatListeners;
729
+ };
730
+
731
+ /**
732
+ * Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful.
733
+ *
734
+ * @param {String|RegExp} evt Name of the event to return the listeners from.
735
+ * @return {Object} All listener functions for an event in an object.
736
+ */
737
+ proto.getListenersAsObject = function getListenersAsObject(evt) {
738
+ var listeners = this.getListeners(evt);
739
+ var response;
740
+
741
+ if (listeners instanceof Array) {
742
+ response = {};
743
+ response[evt] = listeners;
744
+ }
745
+
746
+ return response || listeners;
747
+ };
748
+
749
+ /**
750
+ * Adds a listener function to the specified event.
751
+ * The listener will not be added if it is a duplicate.
752
+ * If the listener returns true then it will be removed after it is called.
753
+ * If you pass a regular expression as the event name then the listener will be added to all events that match it.
754
+ *
755
+ * @param {String|RegExp} evt Name of the event to attach the listener to.
756
+ * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.
757
+ * @return {Object} Current instance of EventEmitter for chaining.
758
+ */
759
+ proto.addListener = function addListener(evt, listener) {
760
+ var listeners = this.getListenersAsObject(evt);
761
+ var listenerIsWrapped = typeof listener === 'object';
762
+ var key;
763
+
764
+ for (key in listeners) {
765
+ if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) {
766
+ listeners[key].push(listenerIsWrapped ? listener : {
767
+ listener: listener,
768
+ once: false
769
+ });
770
+ }
771
+ }
772
+
773
+ return this;
774
+ };
775
+
776
+ /**
777
+ * Alias of addListener
778
+ */
779
+ proto.on = alias('addListener');
780
+
781
+ /**
782
+ * Semi-alias of addListener. It will add a listener that will be
783
+ * automatically removed after its first execution.
784
+ *
785
+ * @param {String|RegExp} evt Name of the event to attach the listener to.
786
+ * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.
787
+ * @return {Object} Current instance of EventEmitter for chaining.
788
+ */
789
+ proto.addOnceListener = function addOnceListener(evt, listener) {
790
+ return this.addListener(evt, {
791
+ listener: listener,
792
+ once: true
793
+ });
794
+ };
795
+
796
+ /**
797
+ * Alias of addOnceListener.
798
+ */
799
+ proto.once = alias('addOnceListener');
800
+
801
+ /**
802
+ * Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad.
803
+ * You need to tell it what event names should be matched by a regex.
804
+ *
805
+ * @param {String} evt Name of the event to create.
806
+ * @return {Object} Current instance of EventEmitter for chaining.
807
+ */
808
+ proto.defineEvent = function defineEvent(evt) {
809
+ this.getListeners(evt);
810
+ return this;
811
+ };
812
+
813
+ /**
814
+ * Uses defineEvent to define multiple events.
815
+ *
816
+ * @param {String[]} evts An array of event names to define.
817
+ * @return {Object} Current instance of EventEmitter for chaining.
818
+ */
819
+ proto.defineEvents = function defineEvents(evts) {
820
+ for (var i = 0; i < evts.length; i += 1) {
821
+ this.defineEvent(evts[i]);
822
+ }
823
+ return this;
824
+ };
825
+
826
+ /**
827
+ * Removes a listener function from the specified event.
828
+ * When passed a regular expression as the event name, it will remove the listener from all events that match it.
829
+ *
830
+ * @param {String|RegExp} evt Name of the event to remove the listener from.
831
+ * @param {Function} listener Method to remove from the event.
832
+ * @return {Object} Current instance of EventEmitter for chaining.
833
+ */
834
+ proto.removeListener = function removeListener(evt, listener) {
835
+ var listeners = this.getListenersAsObject(evt);
836
+ var index;
837
+ var key;
838
+
839
+ for (key in listeners) {
840
+ if (listeners.hasOwnProperty(key)) {
841
+ index = indexOfListener(listeners[key], listener);
842
+
843
+ if (index !== -1) {
844
+ listeners[key].splice(index, 1);
845
+ }
846
+ }
847
+ }
848
+
849
+ return this;
850
+ };
851
+
852
+ /**
853
+ * Alias of removeListener
854
+ */
855
+ proto.off = alias('removeListener');
856
+
857
+ /**
858
+ * Adds listeners in bulk using the manipulateListeners method.
859
+ * If you pass an object as the second argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added.
860
+ * You can also pass it a regular expression to add the array of listeners to all events that match it.
861
+ * Yeah, this function does quite a bit. That's probably a bad thing.
862
+ *
863
+ * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once.
864
+ * @param {Function[]} [listeners] An optional array of listener functions to add.
865
+ * @return {Object} Current instance of EventEmitter for chaining.
866
+ */
867
+ proto.addListeners = function addListeners(evt, listeners) {
868
+ // Pass through to manipulateListeners
869
+ return this.manipulateListeners(false, evt, listeners);
870
+ };
871
+
872
+ /**
873
+ * Removes listeners in bulk using the manipulateListeners method.
874
+ * If you pass an object as the second argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.
875
+ * You can also pass it an event name and an array of listeners to be removed.
876
+ * You can also pass it a regular expression to remove the listeners from all events that match it.
877
+ *
878
+ * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once.
879
+ * @param {Function[]} [listeners] An optional array of listener functions to remove.
880
+ * @return {Object} Current instance of EventEmitter for chaining.
881
+ */
882
+ proto.removeListeners = function removeListeners(evt, listeners) {
883
+ // Pass through to manipulateListeners
884
+ return this.manipulateListeners(true, evt, listeners);
885
+ };
886
+
887
+ /**
888
+ * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level.
889
+ * The first argument will determine if the listeners are removed (true) or added (false).
890
+ * If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.
891
+ * You can also pass it an event name and an array of listeners to be added/removed.
892
+ * You can also pass it a regular expression to manipulate the listeners of all events that match it.
893
+ *
894
+ * @param {Boolean} remove True if you want to remove listeners, false if you want to add.
895
+ * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once.
896
+ * @param {Function[]} [listeners] An optional array of listener functions to add/remove.
897
+ * @return {Object} Current instance of EventEmitter for chaining.
898
+ */
899
+ proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) {
900
+ var i;
901
+ var value;
902
+ var single = remove ? this.removeListener : this.addListener;
903
+ var multiple = remove ? this.removeListeners : this.addListeners;
904
+
905
+ // If evt is an object then pass each of its properties to this method
906
+ if (typeof evt === 'object' && !(evt instanceof RegExp)) {
907
+ for (i in evt) {
908
+ if (evt.hasOwnProperty(i) && (value = evt[i])) {
909
+ // Pass the single listener straight through to the singular method
910
+ if (typeof value === 'function') {
911
+ single.call(this, i, value);
912
+ }
913
+ else {
914
+ // Otherwise pass back to the multiple function
915
+ multiple.call(this, i, value);
916
+ }
917
+ }
918
+ }
919
+ }
920
+ else {
921
+ // So evt must be a string
922
+ // And listeners must be an array of listeners
923
+ // Loop over it and pass each one to the multiple method
924
+ i = listeners.length;
925
+ while (i--) {
926
+ single.call(this, evt, listeners[i]);
927
+ }
928
+ }
929
+
930
+ return this;
931
+ };
932
+
933
+ /**
934
+ * Removes all listeners from a specified event.
935
+ * If you do not specify an event then all listeners will be removed.
936
+ * That means every event will be emptied.
937
+ * You can also pass a regex to remove all events that match it.
938
+ *
939
+ * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed.
940
+ * @return {Object} Current instance of EventEmitter for chaining.
941
+ */
942
+ proto.removeEvent = function removeEvent(evt) {
943
+ var type = typeof evt;
944
+ var events = this._getEvents();
945
+ var key;
946
+
947
+ // Remove different things depending on the state of evt
948
+ if (type === 'string') {
949
+ // Remove all listeners for the specified event
950
+ delete events[evt];
951
+ }
952
+ else if (evt instanceof RegExp) {
953
+ // Remove all events matching the regex.
954
+ for (key in events) {
955
+ if (events.hasOwnProperty(key) && evt.test(key)) {
956
+ delete events[key];
957
+ }
958
+ }
959
+ }
960
+ else {
961
+ // Remove all listeners in all events
962
+ delete this._events;
963
+ }
964
+
965
+ return this;
966
+ };
967
+
968
+ /**
969
+ * Alias of removeEvent.
970
+ *
971
+ * Added to mirror the node API.
972
+ */
973
+ proto.removeAllListeners = alias('removeEvent');
974
+
975
+ /**
976
+ * Emits an event of your choice.
977
+ * When emitted, every listener attached to that event will be executed.
978
+ * If you pass the optional argument array then those arguments will be passed to every listener upon execution.
979
+ * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.
980
+ * So they will not arrive within the array on the other side, they will be separate.
981
+ * You can also pass a regular expression to emit to all events that match it.
982
+ *
983
+ * @param {String|RegExp} evt Name of the event to emit and execute listeners for.
984
+ * @param {Array} [args] Optional array of arguments to be passed to each listener.
985
+ * @return {Object} Current instance of EventEmitter for chaining.
986
+ */
987
+ proto.emitEvent = function emitEvent(evt, args) {
988
+ var listeners = this.getListenersAsObject(evt);
989
+ var listener;
990
+ var i;
991
+ var key;
992
+ var response;
993
+
994
+ for (key in listeners) {
995
+ if (listeners.hasOwnProperty(key)) {
996
+ i = listeners[key].length;
997
+
998
+ while (i--) {
999
+ // If the listener returns true then it shall be removed from the event
1000
+ // The function is executed either with a basic call or an apply if there is an args array
1001
+ listener = listeners[key][i];
1002
+
1003
+ if (listener.once === true) {
1004
+ this.removeListener(evt, listener.listener);
1005
+ }
1006
+
1007
+ response = listener.listener.apply(this, args || []);
1008
+
1009
+ if (response === this._getOnceReturnValue()) {
1010
+ this.removeListener(evt, listener.listener);
1011
+ }
1012
+ }
1013
+ }
1014
+ }
1015
+
1016
+ return this;
1017
+ };
1018
+
1019
+ /**
1020
+ * Alias of emitEvent
1021
+ */
1022
+ proto.trigger = alias('emitEvent');
1023
+
1024
+ /**
1025
+ * Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on.
1026
+ * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it.
1027
+ *
1028
+ * @param {String|RegExp} evt Name of the event to emit and execute listeners for.
1029
+ * @param {...*} Optional additional arguments to be passed to each listener.
1030
+ * @return {Object} Current instance of EventEmitter for chaining.
1031
+ */
1032
+ proto.emit = function emit(evt) {
1033
+ var args = Array.prototype.slice.call(arguments, 1);
1034
+ return this.emitEvent(evt, args);
1035
+ };
1036
+
1037
+ /**
1038
+ * Sets the current value to check against when executing listeners. If a
1039
+ * listeners return value matches the one set here then it will be removed
1040
+ * after execution. This value defaults to true.
1041
+ *
1042
+ * @param {*} value The new value to check for when executing listeners.
1043
+ * @return {Object} Current instance of EventEmitter for chaining.
1044
+ */
1045
+ proto.setOnceReturnValue = function setOnceReturnValue(value) {
1046
+ this._onceReturnValue = value;
1047
+ return this;
1048
+ };
1049
+
1050
+ /**
1051
+ * Fetches the current value to check against when executing listeners. If
1052
+ * the listeners return value matches this one then it should be removed
1053
+ * automatically. It will return true by default.
1054
+ *
1055
+ * @return {*|Boolean} The current value to check for or the default, true.
1056
+ * @api private
1057
+ */
1058
+ proto._getOnceReturnValue = function _getOnceReturnValue() {
1059
+ if (this.hasOwnProperty('_onceReturnValue')) {
1060
+ return this._onceReturnValue;
1061
+ }
1062
+ else {
1063
+ return true;
1064
+ }
1065
+ };
1066
+
1067
+ /**
1068
+ * Fetches the events object and creates one if required.
1069
+ *
1070
+ * @return {Object} The events storage object.
1071
+ * @api private
1072
+ */
1073
+ proto._getEvents = function _getEvents() {
1074
+ return this._events || (this._events = {});
1075
+ };
1076
+
1077
+ /**
1078
+ * Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version.
1079
+ *
1080
+ * @return {Function} Non conflicting EventEmitter class.
1081
+ */
1082
+ EventEmitter.noConflict = function noConflict() {
1083
+ exports.EventEmitter = originalGlobalValue;
1084
+ return EventEmitter;
1085
+ };
1086
+
1087
+ // Expose the class either via AMD, CommonJS or the global object
1088
+ if (typeof define === 'function' && define.amd) {
1089
+ define('eventEmitter/EventEmitter',[],function () {
1090
+ return EventEmitter;
1091
+ });
1092
+ }
1093
+ else if (typeof module === 'object' && module.exports){
1094
+ module.exports = EventEmitter;
1095
+ }
1096
+ else {
1097
+ exports.EventEmitter = EventEmitter;
1098
+ }
1099
+ }.call(this));
1100
+
1101
+ /*!
1102
+ * docReady v1.0.4
1103
+ * Cross browser DOMContentLoaded event emitter
1104
+ * MIT license
1105
+ */
1106
+
1107
+ /*jshint browser: true, strict: true, undef: true, unused: true*/
1108
+ /*global define: false, require: false, module: false */
1109
+
1110
+ ( function( window ) {
1111
+
1112
+
1113
+
1114
+ var document = window.document;
1115
+ // collection of functions to be triggered on ready
1116
+ var queue = [];
1117
+
1118
+ function docReady( fn ) {
1119
+ // throw out non-functions
1120
+ if ( typeof fn !== 'function' ) {
1121
+ return;
1122
+ }
1123
+
1124
+ if ( docReady.isReady ) {
1125
+ // ready now, hit it
1126
+ fn();
1127
+ } else {
1128
+ // queue function when ready
1129
+ queue.push( fn );
1130
+ }
1131
+ }
1132
+
1133
+ docReady.isReady = false;
1134
+
1135
+ // triggered on various doc ready events
1136
+ function onReady( event ) {
1137
+ // bail if already triggered or IE8 document is not ready just yet
1138
+ var isIE8NotReady = event.type === 'readystatechange' && document.readyState !== 'complete';
1139
+ if ( docReady.isReady || isIE8NotReady ) {
1140
+ return;
1141
+ }
1142
+
1143
+ trigger();
1144
+ }
1145
+
1146
+ function trigger() {
1147
+ docReady.isReady = true;
1148
+ // process queue
1149
+ for ( var i=0, len = queue.length; i < len; i++ ) {
1150
+ var fn = queue[i];
1151
+ fn();
1152
+ }
1153
+ }
1154
+
1155
+ function defineDocReady( eventie ) {
1156
+ // trigger ready if page is ready
1157
+ if ( document.readyState === 'complete' ) {
1158
+ trigger();
1159
+ } else {
1160
+ // listen for events
1161
+ eventie.bind( document, 'DOMContentLoaded', onReady );
1162
+ eventie.bind( document, 'readystatechange', onReady );
1163
+ eventie.bind( window, 'load', onReady );
1164
+ }
1165
+
1166
+ return docReady;
1167
+ }
1168
+
1169
+ // transport
1170
+ if ( typeof define === 'function' && define.amd ) {
1171
+ // AMD
1172
+ define( 'doc-ready/doc-ready',[ 'eventie/eventie' ], defineDocReady );
1173
+ } else if ( typeof exports === 'object' ) {
1174
+ module.exports = defineDocReady( require('eventie') );
1175
+ } else {
1176
+ // browser global
1177
+ window.docReady = defineDocReady( window.eventie );
1178
+ }
1179
+
1180
+ })( window );
1181
+
1182
+ /**
1183
+ * matchesSelector v1.0.3
1184
+ * matchesSelector( element, '.selector' )
1185
+ * MIT license
1186
+ */
1187
+
1188
+ /*jshint browser: true, strict: true, undef: true, unused: true */
1189
+ /*global define: false, module: false */
1190
+
1191
+ ( function( ElemProto ) {
1192
+
1193
+
1194
+
1195
+ var matchesMethod = ( function() {
1196
+ // check for the standard method name first
1197
+ if ( ElemProto.matches ) {
1198
+ return 'matches';
1199
+ }
1200
+ // check un-prefixed
1201
+ if ( ElemProto.matchesSelector ) {
1202
+ return 'matchesSelector';
1203
+ }
1204
+ // check vendor prefixes
1205
+ var prefixes = [ 'webkit', 'moz', 'ms', 'o' ];
1206
+
1207
+ for ( var i=0, len = prefixes.length; i < len; i++ ) {
1208
+ var prefix = prefixes[i];
1209
+ var method = prefix + 'MatchesSelector';
1210
+ if ( ElemProto[ method ] ) {
1211
+ return method;
1212
+ }
1213
+ }
1214
+ })();
1215
+
1216
+ // ----- match ----- //
1217
+
1218
+ function match( elem, selector ) {
1219
+ return elem[ matchesMethod ]( selector );
1220
+ }
1221
+
1222
+ // ----- appendToFragment ----- //
1223
+
1224
+ function checkParent( elem ) {
1225
+ // not needed if already has parent
1226
+ if ( elem.parentNode ) {
1227
+ return;
1228
+ }
1229
+ var fragment = document.createDocumentFragment();
1230
+ fragment.appendChild( elem );
1231
+ }
1232
+
1233
+ // ----- query ----- //
1234
+
1235
+ // fall back to using QSA
1236
+ // thx @jonathantneal https://gist.github.com/3062955
1237
+ function query( elem, selector ) {
1238
+ // append to fragment if no parent
1239
+ checkParent( elem );
1240
+
1241
+ // match elem with all selected elems of parent
1242
+ var elems = elem.parentNode.querySelectorAll( selector );
1243
+ for ( var i=0, len = elems.length; i < len; i++ ) {
1244
+ // return true if match
1245
+ if ( elems[i] === elem ) {
1246
+ return true;
1247
+ }
1248
+ }
1249
+ // otherwise return false
1250
+ return false;
1251
+ }
1252
+
1253
+ // ----- matchChild ----- //
1254
+
1255
+ function matchChild( elem, selector ) {
1256
+ checkParent( elem );
1257
+ return match( elem, selector );
1258
+ }
1259
+
1260
+ // ----- matchesSelector ----- //
1261
+
1262
+ var matchesSelector;
1263
+
1264
+ if ( matchesMethod ) {
1265
+ // IE9 supports matchesSelector, but doesn't work on orphaned elems
1266
+ // check for that
1267
+ var div = document.createElement('div');
1268
+ var supportsOrphans = match( div, 'div' );
1269
+ matchesSelector = supportsOrphans ? match : matchChild;
1270
+ } else {
1271
+ matchesSelector = query;
1272
+ }
1273
+
1274
+ // transport
1275
+ if ( typeof define === 'function' && define.amd ) {
1276
+ // AMD
1277
+ define( 'matches-selector/matches-selector',[],function() {
1278
+ return matchesSelector;
1279
+ });
1280
+ } else if ( typeof exports === 'object' ) {
1281
+ module.exports = matchesSelector;
1282
+ }
1283
+ else {
1284
+ // browser global
1285
+ window.matchesSelector = matchesSelector;
1286
+ }
1287
+
1288
+ })( Element.prototype );
1289
+
1290
+ /**
1291
+ * Fizzy UI utils v1.0.1
1292
+ * MIT license
1293
+ */
1294
+
1295
+ /*jshint browser: true, undef: true, unused: true, strict: true */
1296
+
1297
+ ( function( window, factory ) {
1298
+ /*global define: false, module: false, require: false */
1299
+
1300
+ // universal module definition
1301
+
1302
+ if ( typeof define == 'function' && define.amd ) {
1303
+ // AMD
1304
+ define( 'fizzy-ui-utils/utils',[
1305
+ 'doc-ready/doc-ready',
1306
+ 'matches-selector/matches-selector'
1307
+ ], function( docReady, matchesSelector ) {
1308
+ return factory( window, docReady, matchesSelector );
1309
+ });
1310
+ } else if ( typeof exports == 'object' ) {
1311
+ // CommonJS
1312
+ module.exports = factory(
1313
+ window,
1314
+ require('doc-ready'),
1315
+ require('desandro-matches-selector')
1316
+ );
1317
+ } else {
1318
+ // browser global
1319
+ window.fizzyUIUtils = factory(
1320
+ window,
1321
+ window.docReady,
1322
+ window.matchesSelector
1323
+ );
1324
+ }
1325
+
1326
+ }( window, function factory( window, docReady, matchesSelector ) {
1327
+
1328
+
1329
+
1330
+ var utils = {};
1331
+
1332
+ // ----- extend ----- //
1333
+
1334
+ // extends objects
1335
+ utils.extend = function( a, b ) {
1336
+ for ( var prop in b ) {
1337
+ a[ prop ] = b[ prop ];
1338
+ }
1339
+ return a;
1340
+ };
1341
+
1342
+ // ----- modulo ----- //
1343
+
1344
+ utils.modulo = function( num, div ) {
1345
+ return ( ( num % div ) + div ) % div;
1346
+ };
1347
+
1348
+ // ----- isArray ----- //
1349
+
1350
+ var objToString = Object.prototype.toString;
1351
+ utils.isArray = function( obj ) {
1352
+ return objToString.call( obj ) == '[object Array]';
1353
+ };
1354
+
1355
+ // ----- makeArray ----- //
1356
+
1357
+ // turn element or nodeList into an array
1358
+ utils.makeArray = function( obj ) {
1359
+ var ary = [];
1360
+ if ( utils.isArray( obj ) ) {
1361
+ // use object if already an array
1362
+ ary = obj;
1363
+ } else if ( obj && typeof obj.length == 'number' ) {
1364
+ // convert nodeList to array
1365
+ for ( var i=0, len = obj.length; i < len; i++ ) {
1366
+ ary.push( obj[i] );
1367
+ }
1368
+ } else {
1369
+ // array of single index
1370
+ ary.push( obj );
1371
+ }
1372
+ return ary;
1373
+ };
1374
+
1375
+ // ----- indexOf ----- //
1376
+
1377
+ // index of helper cause IE8
1378
+ utils.indexOf = Array.prototype.indexOf ? function( ary, obj ) {
1379
+ return ary.indexOf( obj );
1380
+ } : function( ary, obj ) {
1381
+ for ( var i=0, len = ary.length; i < len; i++ ) {
1382
+ if ( ary[i] === obj ) {
1383
+ return i;
1384
+ }
1385
+ }
1386
+ return -1;
1387
+ };
1388
+
1389
+ // ----- removeFrom ----- //
1390
+
1391
+ utils.removeFrom = function( ary, obj ) {
1392
+ var index = utils.indexOf( ary, obj );
1393
+ if ( index != -1 ) {
1394
+ ary.splice( index, 1 );
1395
+ }
1396
+ };
1397
+
1398
+ // ----- isElement ----- //
1399
+
1400
+ // http://stackoverflow.com/a/384380/182183
1401
+ utils.isElement = ( typeof HTMLElement == 'function' || typeof HTMLElement == 'object' ) ?
1402
+ function isElementDOM2( obj ) {
1403
+ return obj instanceof HTMLElement;
1404
+ } :
1405
+ function isElementQuirky( obj ) {
1406
+ return obj && typeof obj == 'object' &&
1407
+ obj.nodeType == 1 && typeof obj.nodeName == 'string';
1408
+ };
1409
+
1410
+ // ----- setText ----- //
1411
+
1412
+ utils.setText = ( function() {
1413
+ var setTextProperty;
1414
+ function setText( elem, text ) {
1415
+ // only check setTextProperty once
1416
+ setTextProperty = setTextProperty || ( document.documentElement.textContent !== undefined ? 'textContent' : 'innerText' );
1417
+ elem[ setTextProperty ] = text;
1418
+ }
1419
+ return setText;
1420
+ })();
1421
+
1422
+ // ----- getParent ----- //
1423
+
1424
+ utils.getParent = function( elem, selector ) {
1425
+ while ( elem != document.body ) {
1426
+ elem = elem.parentNode;
1427
+ if ( matchesSelector( elem, selector ) ) {
1428
+ return elem;
1429
+ }
1430
+ }
1431
+ };
1432
+
1433
+ // ----- getQueryElement ----- //
1434
+
1435
+ // use element as selector string
1436
+ utils.getQueryElement = function( elem ) {
1437
+ if ( typeof elem == 'string' ) {
1438
+ return document.querySelector( elem );
1439
+ }
1440
+ return elem;
1441
+ };
1442
+
1443
+ // ----- handleEvent ----- //
1444
+
1445
+ // enable .ontype to trigger from .addEventListener( elem, 'type' )
1446
+ utils.handleEvent = function( event ) {
1447
+ var method = 'on' + event.type;
1448
+ if ( this[ method ] ) {
1449
+ this[ method ]( event );
1450
+ }
1451
+ };
1452
+
1453
+ // ----- filterFindElements ----- //
1454
+
1455
+ utils.filterFindElements = function( elems, selector ) {
1456
+ // make array of elems
1457
+ elems = utils.makeArray( elems );
1458
+ var ffElems = [];
1459
+
1460
+ for ( var i=0, len = elems.length; i < len; i++ ) {
1461
+ var elem = elems[i];
1462
+ // check that elem is an actual element
1463
+ if ( !utils.isElement( elem ) ) {
1464
+ continue;
1465
+ }
1466
+ // filter & find items if we have a selector
1467
+ if ( selector ) {
1468
+ // filter siblings
1469
+ if ( matchesSelector( elem, selector ) ) {
1470
+ ffElems.push( elem );
1471
+ }
1472
+ // find children
1473
+ var childElems = elem.querySelectorAll( selector );
1474
+ // concat childElems to filterFound array
1475
+ for ( var j=0, jLen = childElems.length; j < jLen; j++ ) {
1476
+ ffElems.push( childElems[j] );
1477
+ }
1478
+ } else {
1479
+ ffElems.push( elem );
1480
+ }
1481
+ }
1482
+
1483
+ return ffElems;
1484
+ };
1485
+
1486
+ // ----- debounceMethod ----- //
1487
+
1488
+ utils.debounceMethod = function( _class, methodName, threshold ) {
1489
+ // original method
1490
+ var method = _class.prototype[ methodName ];
1491
+ var timeoutName = methodName + 'Timeout';
1492
+
1493
+ _class.prototype[ methodName ] = function() {
1494
+ var timeout = this[ timeoutName ];
1495
+ if ( timeout ) {
1496
+ clearTimeout( timeout );
1497
+ }
1498
+ var args = arguments;
1499
+
1500
+ var _this = this;
1501
+ this[ timeoutName ] = setTimeout( function() {
1502
+ method.apply( _this, args );
1503
+ delete _this[ timeoutName ];
1504
+ }, threshold || 100 );
1505
+ };
1506
+ };
1507
+
1508
+ // ----- htmlInit ----- //
1509
+
1510
+ // http://jamesroberts.name/blog/2010/02/22/string-functions-for-javascript-trim-to-camel-case-to-dashed-and-to-underscore/
1511
+ utils.toDashed = function( str ) {
1512
+ return str.replace( /(.)([A-Z])/g, function( match, $1, $2 ) {
1513
+ return $1 + '-' + $2;
1514
+ }).toLowerCase();
1515
+ };
1516
+
1517
+ var console = window.console;
1518
+ /**
1519
+ * allow user to initialize classes via .js-namespace class
1520
+ * htmlInit( Widget, 'widgetName' )
1521
+ * options are parsed from data-namespace-option attribute
1522
+ */
1523
+ utils.htmlInit = function( WidgetClass, namespace ) {
1524
+ docReady( function() {
1525
+ var dashedNamespace = utils.toDashed( namespace );
1526
+ var elems = document.querySelectorAll( '.js-' + dashedNamespace );
1527
+ var dataAttr = 'data-' + dashedNamespace + '-options';
1528
+
1529
+ for ( var i=0, len = elems.length; i < len; i++ ) {
1530
+ var elem = elems[i];
1531
+ var attr = elem.getAttribute( dataAttr );
1532
+ var options;
1533
+ try {
1534
+ options = attr && JSON.parse( attr );
1535
+ } catch ( error ) {
1536
+ // log error, do not initialize
1537
+ if ( console ) {
1538
+ console.error( 'Error parsing ' + dataAttr + ' on ' +
1539
+ elem.nodeName.toLowerCase() + ( elem.id ? '#' + elem.id : '' ) + ': ' +
1540
+ error );
1541
+ }
1542
+ continue;
1543
+ }
1544
+ // initialize
1545
+ var instance = new WidgetClass( elem, options );
1546
+ // make available via $().data('layoutname')
1547
+ var jQuery = window.jQuery;
1548
+ if ( jQuery ) {
1549
+ jQuery.data( elem, namespace, instance );
1550
+ }
1551
+ }
1552
+ });
1553
+ };
1554
+
1555
+ // ----- ----- //
1556
+
1557
+ return utils;
1558
+
1559
+ }));
1560
+
1561
+ /**
1562
+ * Outlayer Item
1563
+ */
1564
+
1565
+ ( function( window, factory ) {
1566
+
1567
+ // universal module definition
1568
+ if ( typeof define === 'function' && define.amd ) {
1569
+ // AMD
1570
+ define( 'outlayer/item',[
1571
+ 'eventEmitter/EventEmitter',
1572
+ 'get-size/get-size',
1573
+ 'get-style-property/get-style-property',
1574
+ 'fizzy-ui-utils/utils'
1575
+ ],
1576
+ function( EventEmitter, getSize, getStyleProperty, utils ) {
1577
+ return factory( window, EventEmitter, getSize, getStyleProperty, utils );
1578
+ }
1579
+ );
1580
+ } else if (typeof exports === 'object') {
1581
+ // CommonJS
1582
+ module.exports = factory(
1583
+ window,
1584
+ require('wolfy87-eventemitter'),
1585
+ require('get-size'),
1586
+ require('desandro-get-style-property'),
1587
+ require('fizzy-ui-utils')
1588
+ );
1589
+ } else {
1590
+ // browser global
1591
+ window.Outlayer = {};
1592
+ window.Outlayer.Item = factory(
1593
+ window,
1594
+ window.EventEmitter,
1595
+ window.getSize,
1596
+ window.getStyleProperty,
1597
+ window.fizzyUIUtils
1598
+ );
1599
+ }
1600
+
1601
+ }( window, function factory( window, EventEmitter, getSize, getStyleProperty, utils ) {
1602
+
1603
+
1604
+ // ----- helpers ----- //
1605
+
1606
+ var getComputedStyle = window.getComputedStyle;
1607
+ var getStyle = getComputedStyle ?
1608
+ function( elem ) {
1609
+ return getComputedStyle( elem, null );
1610
+ } :
1611
+ function( elem ) {
1612
+ return elem.currentStyle;
1613
+ };
1614
+
1615
+
1616
+ function isEmptyObj( obj ) {
1617
+ for ( var prop in obj ) {
1618
+ return false;
1619
+ }
1620
+ prop = null;
1621
+ return true;
1622
+ }
1623
+
1624
+ // -------------------------- CSS3 support -------------------------- //
1625
+
1626
+ var transitionProperty = getStyleProperty('transition');
1627
+ var transformProperty = getStyleProperty('transform');
1628
+ var supportsCSS3 = transitionProperty && transformProperty;
1629
+ var is3d = !!getStyleProperty('perspective');
1630
+
1631
+ var transitionEndEvent = {
1632
+ WebkitTransition: 'webkitTransitionEnd',
1633
+ MozTransition: 'transitionend',
1634
+ OTransition: 'otransitionend',
1635
+ transition: 'transitionend'
1636
+ }[ transitionProperty ];
1637
+
1638
+ // properties that could have vendor prefix
1639
+ var prefixableProperties = [
1640
+ 'transform',
1641
+ 'transition',
1642
+ 'transitionDuration',
1643
+ 'transitionProperty'
1644
+ ];
1645
+
1646
+ // cache all vendor properties
1647
+ var vendorProperties = ( function() {
1648
+ var cache = {};
1649
+ for ( var i=0, len = prefixableProperties.length; i < len; i++ ) {
1650
+ var prop = prefixableProperties[i];
1651
+ var supportedProp = getStyleProperty( prop );
1652
+ if ( supportedProp && supportedProp !== prop ) {
1653
+ cache[ prop ] = supportedProp;
1654
+ }
1655
+ }
1656
+ return cache;
1657
+ })();
1658
+
1659
+ // -------------------------- Item -------------------------- //
1660
+
1661
+ function Item( element, layout ) {
1662
+ if ( !element ) {
1663
+ return;
1664
+ }
1665
+
1666
+ this.element = element;
1667
+ // parent layout class, i.e. Masonry, Isotope, or Packery
1668
+ this.layout = layout;
1669
+ this.position = {
1670
+ x: 0,
1671
+ y: 0
1672
+ };
1673
+
1674
+ this._create();
1675
+ }
1676
+
1677
+ // inherit EventEmitter
1678
+ utils.extend( Item.prototype, EventEmitter.prototype );
1679
+
1680
+ Item.prototype._create = function() {
1681
+ // transition objects
1682
+ this._transn = {
1683
+ ingProperties: {},
1684
+ clean: {},
1685
+ onEnd: {}
1686
+ };
1687
+
1688
+ this.css({
1689
+ position: 'absolute'
1690
+ });
1691
+ };
1692
+
1693
+ // trigger specified handler for event type
1694
+ Item.prototype.handleEvent = function( event ) {
1695
+ var method = 'on' + event.type;
1696
+ if ( this[ method ] ) {
1697
+ this[ method ]( event );
1698
+ }
1699
+ };
1700
+
1701
+ Item.prototype.getSize = function() {
1702
+ this.size = getSize( this.element );
1703
+ };
1704
+
1705
+ /**
1706
+ * apply CSS styles to element
1707
+ * @param {Object} style
1708
+ */
1709
+ Item.prototype.css = function( style ) {
1710
+ var elemStyle = this.element.style;
1711
+
1712
+ for ( var prop in style ) {
1713
+ // use vendor property if available
1714
+ var supportedProp = vendorProperties[ prop ] || prop;
1715
+ elemStyle[ supportedProp ] = style[ prop ];
1716
+ }
1717
+ };
1718
+
1719
+ // measure position, and sets it
1720
+ Item.prototype.getPosition = function() {
1721
+ var style = getStyle( this.element );
1722
+ var layoutOptions = this.layout.options;
1723
+ var isOriginLeft = layoutOptions.isOriginLeft;
1724
+ var isOriginTop = layoutOptions.isOriginTop;
1725
+ var xValue = style[ isOriginLeft ? 'left' : 'right' ];
1726
+ var yValue = style[ isOriginTop ? 'top' : 'bottom' ];
1727
+ // convert percent to pixels
1728
+ var layoutSize = this.layout.size;
1729
+ var x = xValue.indexOf('%') != -1 ?
1730
+ ( parseFloat( xValue ) / 100 ) * layoutSize.width : parseInt( xValue, 10 );
1731
+ var y = yValue.indexOf('%') != -1 ?
1732
+ ( parseFloat( yValue ) / 100 ) * layoutSize.height : parseInt( yValue, 10 );
1733
+
1734
+ // clean up 'auto' or other non-integer values
1735
+ x = isNaN( x ) ? 0 : x;
1736
+ y = isNaN( y ) ? 0 : y;
1737
+ // remove padding from measurement
1738
+ x -= isOriginLeft ? layoutSize.paddingLeft : layoutSize.paddingRight;
1739
+ y -= isOriginTop ? layoutSize.paddingTop : layoutSize.paddingBottom;
1740
+
1741
+ this.position.x = x;
1742
+ this.position.y = y;
1743
+ };
1744
+
1745
+ // set settled position, apply padding
1746
+ Item.prototype.layoutPosition = function() {
1747
+ var layoutSize = this.layout.size;
1748
+ var layoutOptions = this.layout.options;
1749
+ var style = {};
1750
+
1751
+ // x
1752
+ var xPadding = layoutOptions.isOriginLeft ? 'paddingLeft' : 'paddingRight';
1753
+ var xProperty = layoutOptions.isOriginLeft ? 'left' : 'right';
1754
+ var xResetProperty = layoutOptions.isOriginLeft ? 'right' : 'left';
1755
+
1756
+ var x = this.position.x + layoutSize[ xPadding ];
1757
+ // set in percentage or pixels
1758
+ style[ xProperty ] = this.getXValue( x );
1759
+ // reset other property
1760
+ style[ xResetProperty ] = '';
1761
+
1762
+ // y
1763
+ var yPadding = layoutOptions.isOriginTop ? 'paddingTop' : 'paddingBottom';
1764
+ var yProperty = layoutOptions.isOriginTop ? 'top' : 'bottom';
1765
+ var yResetProperty = layoutOptions.isOriginTop ? 'bottom' : 'top';
1766
+
1767
+ var y = this.position.y + layoutSize[ yPadding ];
1768
+ // set in percentage or pixels
1769
+ style[ yProperty ] = this.getYValue( y );
1770
+ // reset other property
1771
+ style[ yResetProperty ] = '';
1772
+
1773
+ this.css( style );
1774
+ this.emitEvent( 'layout', [ this ] );
1775
+ };
1776
+
1777
+ Item.prototype.getXValue = function( x ) {
1778
+ var layoutOptions = this.layout.options;
1779
+ return layoutOptions.percentPosition && !layoutOptions.isHorizontal ?
1780
+ ( ( x / this.layout.size.width ) * 100 ) + '%' : x + 'px';
1781
+ };
1782
+
1783
+ Item.prototype.getYValue = function( y ) {
1784
+ var layoutOptions = this.layout.options;
1785
+ return layoutOptions.percentPosition && layoutOptions.isHorizontal ?
1786
+ ( ( y / this.layout.size.height ) * 100 ) + '%' : y + 'px';
1787
+ };
1788
+
1789
+
1790
+ Item.prototype._transitionTo = function( x, y ) {
1791
+ this.getPosition();
1792
+ // get current x & y from top/left
1793
+ var curX = this.position.x;
1794
+ var curY = this.position.y;
1795
+
1796
+ var compareX = parseInt( x, 10 );
1797
+ var compareY = parseInt( y, 10 );
1798
+ var didNotMove = compareX === this.position.x && compareY === this.position.y;
1799
+
1800
+ // save end position
1801
+ this.setPosition( x, y );
1802
+
1803
+ // if did not move and not transitioning, just go to layout
1804
+ if ( didNotMove && !this.isTransitioning ) {
1805
+ this.layoutPosition();
1806
+ return;
1807
+ }
1808
+
1809
+ var transX = x - curX;
1810
+ var transY = y - curY;
1811
+ var transitionStyle = {};
1812
+ transitionStyle.transform = this.getTranslate( transX, transY );
1813
+
1814
+ this.transition({
1815
+ to: transitionStyle,
1816
+ onTransitionEnd: {
1817
+ transform: this.layoutPosition
1818
+ },
1819
+ isCleaning: true
1820
+ });
1821
+ };
1822
+
1823
+ Item.prototype.getTranslate = function( x, y ) {
1824
+ // flip cooridinates if origin on right or bottom
1825
+ var layoutOptions = this.layout.options;
1826
+ x = layoutOptions.isOriginLeft ? x : -x;
1827
+ y = layoutOptions.isOriginTop ? y : -y;
1828
+
1829
+ if ( is3d ) {
1830
+ return 'translate3d(' + x + 'px, ' + y + 'px, 0)';
1831
+ }
1832
+
1833
+ return 'translate(' + x + 'px, ' + y + 'px)';
1834
+ };
1835
+
1836
+ // non transition + transform support
1837
+ Item.prototype.goTo = function( x, y ) {
1838
+ this.setPosition( x, y );
1839
+ this.layoutPosition();
1840
+ };
1841
+
1842
+ // use transition and transforms if supported
1843
+ Item.prototype.moveTo = supportsCSS3 ?
1844
+ Item.prototype._transitionTo : Item.prototype.goTo;
1845
+
1846
+ Item.prototype.setPosition = function( x, y ) {
1847
+ this.position.x = parseInt( x, 10 );
1848
+ this.position.y = parseInt( y, 10 );
1849
+ };
1850
+
1851
+ // ----- transition ----- //
1852
+
1853
+ /**
1854
+ * @param {Object} style - CSS
1855
+ * @param {Function} onTransitionEnd
1856
+ */
1857
+
1858
+ // non transition, just trigger callback
1859
+ Item.prototype._nonTransition = function( args ) {
1860
+ this.css( args.to );
1861
+ if ( args.isCleaning ) {
1862
+ this._removeStyles( args.to );
1863
+ }
1864
+ for ( var prop in args.onTransitionEnd ) {
1865
+ args.onTransitionEnd[ prop ].call( this );
1866
+ }
1867
+ };
1868
+
1869
+ /**
1870
+ * proper transition
1871
+ * @param {Object} args - arguments
1872
+ * @param {Object} to - style to transition to
1873
+ * @param {Object} from - style to start transition from
1874
+ * @param {Boolean} isCleaning - removes transition styles after transition
1875
+ * @param {Function} onTransitionEnd - callback
1876
+ */
1877
+ Item.prototype._transition = function( args ) {
1878
+ // redirect to nonTransition if no transition duration
1879
+ if ( !parseFloat( this.layout.options.transitionDuration ) ) {
1880
+ this._nonTransition( args );
1881
+ return;
1882
+ }
1883
+
1884
+ var _transition = this._transn;
1885
+ // keep track of onTransitionEnd callback by css property
1886
+ for ( var prop in args.onTransitionEnd ) {
1887
+ _transition.onEnd[ prop ] = args.onTransitionEnd[ prop ];
1888
+ }
1889
+ // keep track of properties that are transitioning
1890
+ for ( prop in args.to ) {
1891
+ _transition.ingProperties[ prop ] = true;
1892
+ // keep track of properties to clean up when transition is done
1893
+ if ( args.isCleaning ) {
1894
+ _transition.clean[ prop ] = true;
1895
+ }
1896
+ }
1897
+
1898
+ // set from styles
1899
+ if ( args.from ) {
1900
+ this.css( args.from );
1901
+ // force redraw. http://blog.alexmaccaw.com/css-transitions
1902
+ var h = this.element.offsetHeight;
1903
+ // hack for JSHint to hush about unused var
1904
+ h = null;
1905
+ }
1906
+ // enable transition
1907
+ this.enableTransition( args.to );
1908
+ // set styles that are transitioning
1909
+ this.css( args.to );
1910
+
1911
+ this.isTransitioning = true;
1912
+
1913
+ };
1914
+
1915
+ // dash before all cap letters, including first for
1916
+ // WebkitTransform => -webkit-transform
1917
+ function toDashedAll( str ) {
1918
+ return str.replace( /([A-Z])/g, function( $1 ) {
1919
+ return '-' + $1.toLowerCase();
1920
+ });
1921
+ }
1922
+
1923
+ var transitionProps = 'opacity,' +
1924
+ toDashedAll( vendorProperties.transform || 'transform' );
1925
+
1926
+ Item.prototype.enableTransition = function(/* style */) {
1927
+ // HACK changing transitionProperty during a transition
1928
+ // will cause transition to jump
1929
+ if ( this.isTransitioning ) {
1930
+ return;
1931
+ }
1932
+
1933
+ // make `transition: foo, bar, baz` from style object
1934
+ // HACK un-comment this when enableTransition can work
1935
+ // while a transition is happening
1936
+ // var transitionValues = [];
1937
+ // for ( var prop in style ) {
1938
+ // // dash-ify camelCased properties like WebkitTransition
1939
+ // prop = vendorProperties[ prop ] || prop;
1940
+ // transitionValues.push( toDashedAll( prop ) );
1941
+ // }
1942
+ // enable transition styles
1943
+ this.css({
1944
+ transitionProperty: transitionProps,
1945
+ transitionDuration: this.layout.options.transitionDuration
1946
+ });
1947
+ // listen for transition end event
1948
+ this.element.addEventListener( transitionEndEvent, this, false );
1949
+ };
1950
+
1951
+ Item.prototype.transition = Item.prototype[ transitionProperty ? '_transition' : '_nonTransition' ];
1952
+
1953
+ // ----- events ----- //
1954
+
1955
+ Item.prototype.onwebkitTransitionEnd = function( event ) {
1956
+ this.ontransitionend( event );
1957
+ };
1958
+
1959
+ Item.prototype.onotransitionend = function( event ) {
1960
+ this.ontransitionend( event );
1961
+ };
1962
+
1963
+ // properties that I munge to make my life easier
1964
+ var dashedVendorProperties = {
1965
+ '-webkit-transform': 'transform',
1966
+ '-moz-transform': 'transform',
1967
+ '-o-transform': 'transform'
1968
+ };
1969
+
1970
+ Item.prototype.ontransitionend = function( event ) {
1971
+ // disregard bubbled events from children
1972
+ if ( event.target !== this.element ) {
1973
+ return;
1974
+ }
1975
+ var _transition = this._transn;
1976
+ // get property name of transitioned property, convert to prefix-free
1977
+ var propertyName = dashedVendorProperties[ event.propertyName ] || event.propertyName;
1978
+
1979
+ // remove property that has completed transitioning
1980
+ delete _transition.ingProperties[ propertyName ];
1981
+ // check if any properties are still transitioning
1982
+ if ( isEmptyObj( _transition.ingProperties ) ) {
1983
+ // all properties have completed transitioning
1984
+ this.disableTransition();
1985
+ }
1986
+ // clean style
1987
+ if ( propertyName in _transition.clean ) {
1988
+ // clean up style
1989
+ this.element.style[ event.propertyName ] = '';
1990
+ delete _transition.clean[ propertyName ];
1991
+ }
1992
+ // trigger onTransitionEnd callback
1993
+ if ( propertyName in _transition.onEnd ) {
1994
+ var onTransitionEnd = _transition.onEnd[ propertyName ];
1995
+ onTransitionEnd.call( this );
1996
+ delete _transition.onEnd[ propertyName ];
1997
+ }
1998
+
1999
+ this.emitEvent( 'transitionEnd', [ this ] );
2000
+ };
2001
+
2002
+ Item.prototype.disableTransition = function() {
2003
+ this.removeTransitionStyles();
2004
+ this.element.removeEventListener( transitionEndEvent, this, false );
2005
+ this.isTransitioning = false;
2006
+ };
2007
+
2008
+ /**
2009
+ * removes style property from element
2010
+ * @param {Object} style
2011
+ **/
2012
+ Item.prototype._removeStyles = function( style ) {
2013
+ // clean up transition styles
2014
+ var cleanStyle = {};
2015
+ for ( var prop in style ) {
2016
+ cleanStyle[ prop ] = '';
2017
+ }
2018
+ this.css( cleanStyle );
2019
+ };
2020
+
2021
+ var cleanTransitionStyle = {
2022
+ transitionProperty: '',
2023
+ transitionDuration: ''
2024
+ };
2025
+
2026
+ Item.prototype.removeTransitionStyles = function() {
2027
+ // remove transition
2028
+ this.css( cleanTransitionStyle );
2029
+ };
2030
+
2031
+ // ----- show/hide/remove ----- //
2032
+
2033
+ // remove element from DOM
2034
+ Item.prototype.removeElem = function() {
2035
+ this.element.parentNode.removeChild( this.element );
2036
+ // remove display: none
2037
+ this.css({ display: '' });
2038
+ this.emitEvent( 'remove', [ this ] );
2039
+ };
2040
+
2041
+ Item.prototype.remove = function() {
2042
+ // just remove element if no transition support or no transition
2043
+ if ( !transitionProperty || !parseFloat( this.layout.options.transitionDuration ) ) {
2044
+ this.removeElem();
2045
+ return;
2046
+ }
2047
+
2048
+ // start transition
2049
+ var _this = this;
2050
+ this.once( 'transitionEnd', function() {
2051
+ _this.removeElem();
2052
+ });
2053
+ this.hide();
2054
+ };
2055
+
2056
+ Item.prototype.reveal = function() {
2057
+ delete this.isHidden;
2058
+ // remove display: none
2059
+ this.css({ display: '' });
2060
+
2061
+ var options = this.layout.options;
2062
+
2063
+ var onTransitionEnd = {};
2064
+ var transitionEndProperty = this.getHideRevealTransitionEndProperty('visibleStyle');
2065
+ onTransitionEnd[ transitionEndProperty ] = this.onRevealTransitionEnd;
2066
+
2067
+ this.transition({
2068
+ from: options.hiddenStyle,
2069
+ to: options.visibleStyle,
2070
+ isCleaning: true,
2071
+ onTransitionEnd: onTransitionEnd
2072
+ });
2073
+ };
2074
+
2075
+ Item.prototype.onRevealTransitionEnd = function() {
2076
+ // check if still visible
2077
+ // during transition, item may have been hidden
2078
+ if ( !this.isHidden ) {
2079
+ this.emitEvent('reveal');
2080
+ }
2081
+ };
2082
+
2083
+ /**
2084
+ * get style property use for hide/reveal transition end
2085
+ * @param {String} styleProperty - hiddenStyle/visibleStyle
2086
+ * @returns {String}
2087
+ */
2088
+ Item.prototype.getHideRevealTransitionEndProperty = function( styleProperty ) {
2089
+ var optionStyle = this.layout.options[ styleProperty ];
2090
+ // use opacity
2091
+ if ( optionStyle.opacity ) {
2092
+ return 'opacity';
2093
+ }
2094
+ // get first property
2095
+ for ( var prop in optionStyle ) {
2096
+ return prop;
2097
+ }
2098
+ };
2099
+
2100
+ Item.prototype.hide = function() {
2101
+ // set flag
2102
+ this.isHidden = true;
2103
+ // remove display: none
2104
+ this.css({ display: '' });
2105
+
2106
+ var options = this.layout.options;
2107
+
2108
+ var onTransitionEnd = {};
2109
+ var transitionEndProperty = this.getHideRevealTransitionEndProperty('hiddenStyle');
2110
+ onTransitionEnd[ transitionEndProperty ] = this.onHideTransitionEnd;
2111
+
2112
+ this.transition({
2113
+ from: options.visibleStyle,
2114
+ to: options.hiddenStyle,
2115
+ // keep hidden stuff hidden
2116
+ isCleaning: true,
2117
+ onTransitionEnd: onTransitionEnd
2118
+ });
2119
+ };
2120
+
2121
+ Item.prototype.onHideTransitionEnd = function() {
2122
+ // check if still hidden
2123
+ // during transition, item may have been un-hidden
2124
+ if ( this.isHidden ) {
2125
+ this.css({ display: 'none' });
2126
+ this.emitEvent('hide');
2127
+ }
2128
+ };
2129
+
2130
+ Item.prototype.destroy = function() {
2131
+ this.css({
2132
+ position: '',
2133
+ left: '',
2134
+ right: '',
2135
+ top: '',
2136
+ bottom: '',
2137
+ transition: '',
2138
+ transform: ''
2139
+ });
2140
+ };
2141
+
2142
+ return Item;
2143
+
2144
+ }));
2145
+
2146
+ /*!
2147
+ * Outlayer v1.4.2
2148
+ * the brains and guts of a layout library
2149
+ * MIT license
2150
+ */
2151
+
2152
+ ( function( window, factory ) {
2153
+
2154
+ // universal module definition
2155
+
2156
+ if ( typeof define == 'function' && define.amd ) {
2157
+ // AMD
2158
+ define( 'outlayer/outlayer',[
2159
+ 'eventie/eventie',
2160
+ 'eventEmitter/EventEmitter',
2161
+ 'get-size/get-size',
2162
+ 'fizzy-ui-utils/utils',
2163
+ './item'
2164
+ ],
2165
+ function( eventie, EventEmitter, getSize, utils, Item ) {
2166
+ return factory( window, eventie, EventEmitter, getSize, utils, Item);
2167
+ }
2168
+ );
2169
+ } else if ( typeof exports == 'object' ) {
2170
+ // CommonJS
2171
+ module.exports = factory(
2172
+ window,
2173
+ require('eventie'),
2174
+ require('wolfy87-eventemitter'),
2175
+ require('get-size'),
2176
+ require('fizzy-ui-utils'),
2177
+ require('./item')
2178
+ );
2179
+ } else {
2180
+ // browser global
2181
+ window.Outlayer = factory(
2182
+ window,
2183
+ window.eventie,
2184
+ window.EventEmitter,
2185
+ window.getSize,
2186
+ window.fizzyUIUtils,
2187
+ window.Outlayer.Item
2188
+ );
2189
+ }
2190
+
2191
+ }( window, function factory( window, eventie, EventEmitter, getSize, utils, Item ) {
2192
+
2193
+
2194
+ // ----- vars ----- //
2195
+
2196
+ var console = window.console;
2197
+ var jQuery = window.jQuery;
2198
+ var noop = function() {};
2199
+
2200
+ // -------------------------- Outlayer -------------------------- //
2201
+
2202
+ // globally unique identifiers
2203
+ var GUID = 0;
2204
+ // internal store of all Outlayer intances
2205
+ var instances = {};
2206
+
2207
+
2208
+ /**
2209
+ * @param {Element, String} element
2210
+ * @param {Object} options
2211
+ * @constructor
2212
+ */
2213
+ function Outlayer( element, options ) {
2214
+ var queryElement = utils.getQueryElement( element );
2215
+ if ( !queryElement ) {
2216
+ if ( console ) {
2217
+ console.error( 'Bad element for ' + this.constructor.namespace +
2218
+ ': ' + ( queryElement || element ) );
2219
+ }
2220
+ return;
2221
+ }
2222
+ this.element = queryElement;
2223
+ // add jQuery
2224
+ if ( jQuery ) {
2225
+ this.$element = jQuery( this.element );
2226
+ }
2227
+
2228
+ // options
2229
+ this.options = utils.extend( {}, this.constructor.defaults );
2230
+ this.option( options );
2231
+
2232
+ // add id for Outlayer.getFromElement
2233
+ var id = ++GUID;
2234
+ this.element.outlayerGUID = id; // expando
2235
+ instances[ id ] = this; // associate via id
2236
+
2237
+ // kick it off
2238
+ this._create();
2239
+
2240
+ if ( this.options.isInitLayout ) {
2241
+ this.layout();
2242
+ }
2243
+ }
2244
+
2245
+ // settings are for internal use only
2246
+ Outlayer.namespace = 'outlayer';
2247
+ Outlayer.Item = Item;
2248
+
2249
+ // default options
2250
+ Outlayer.defaults = {
2251
+ containerStyle: {
2252
+ position: 'relative'
2253
+ },
2254
+ isInitLayout: true,
2255
+ isOriginLeft: true,
2256
+ isOriginTop: true,
2257
+ isResizeBound: true,
2258
+ isResizingContainer: true,
2259
+ // item options
2260
+ transitionDuration: '0.4s',
2261
+ hiddenStyle: {
2262
+ opacity: 0,
2263
+ transform: 'scale(0.001)'
2264
+ },
2265
+ visibleStyle: {
2266
+ opacity: 1,
2267
+ transform: 'scale(1)'
2268
+ }
2269
+ };
2270
+
2271
+ // inherit EventEmitter
2272
+ utils.extend( Outlayer.prototype, EventEmitter.prototype );
2273
+
2274
+ /**
2275
+ * set options
2276
+ * @param {Object} opts
2277
+ */
2278
+ Outlayer.prototype.option = function( opts ) {
2279
+ utils.extend( this.options, opts );
2280
+ };
2281
+
2282
+ Outlayer.prototype._create = function() {
2283
+ // get items from children
2284
+ this.reloadItems();
2285
+ // elements that affect layout, but are not laid out
2286
+ this.stamps = [];
2287
+ this.stamp( this.options.stamp );
2288
+ // set container style
2289
+ utils.extend( this.element.style, this.options.containerStyle );
2290
+
2291
+ // bind resize method
2292
+ if ( this.options.isResizeBound ) {
2293
+ this.bindResize();
2294
+ }
2295
+ };
2296
+
2297
+ // goes through all children again and gets bricks in proper order
2298
+ Outlayer.prototype.reloadItems = function() {
2299
+ // collection of item elements
2300
+ this.items = this._itemize( this.element.children );
2301
+ };
2302
+
2303
+
2304
+ /**
2305
+ * turn elements into Outlayer.Items to be used in layout
2306
+ * @param {Array or NodeList or HTMLElement} elems
2307
+ * @returns {Array} items - collection of new Outlayer Items
2308
+ */
2309
+ Outlayer.prototype._itemize = function( elems ) {
2310
+
2311
+ var itemElems = this._filterFindItemElements( elems );
2312
+ var Item = this.constructor.Item;
2313
+
2314
+ // create new Outlayer Items for collection
2315
+ var items = [];
2316
+ for ( var i=0, len = itemElems.length; i < len; i++ ) {
2317
+ var elem = itemElems[i];
2318
+ var item = new Item( elem, this );
2319
+ items.push( item );
2320
+ }
2321
+
2322
+ return items;
2323
+ };
2324
+
2325
+ /**
2326
+ * get item elements to be used in layout
2327
+ * @param {Array or NodeList or HTMLElement} elems
2328
+ * @returns {Array} items - item elements
2329
+ */
2330
+ Outlayer.prototype._filterFindItemElements = function( elems ) {
2331
+ return utils.filterFindElements( elems, this.options.itemSelector );
2332
+ };
2333
+
2334
+ /**
2335
+ * getter method for getting item elements
2336
+ * @returns {Array} elems - collection of item elements
2337
+ */
2338
+ Outlayer.prototype.getItemElements = function() {
2339
+ var elems = [];
2340
+ for ( var i=0, len = this.items.length; i < len; i++ ) {
2341
+ elems.push( this.items[i].element );
2342
+ }
2343
+ return elems;
2344
+ };
2345
+
2346
+ // ----- init & layout ----- //
2347
+
2348
+ /**
2349
+ * lays out all items
2350
+ */
2351
+ Outlayer.prototype.layout = function() {
2352
+ this._resetLayout();
2353
+ this._manageStamps();
2354
+
2355
+ // don't animate first layout
2356
+ var isInstant = this.options.isLayoutInstant !== undefined ?
2357
+ this.options.isLayoutInstant : !this._isLayoutInited;
2358
+ this.layoutItems( this.items, isInstant );
2359
+
2360
+ // flag for initalized
2361
+ this._isLayoutInited = true;
2362
+ };
2363
+
2364
+ // _init is alias for layout
2365
+ Outlayer.prototype._init = Outlayer.prototype.layout;
2366
+
2367
+ /**
2368
+ * logic before any new layout
2369
+ */
2370
+ Outlayer.prototype._resetLayout = function() {
2371
+ this.getSize();
2372
+ };
2373
+
2374
+
2375
+ Outlayer.prototype.getSize = function() {
2376
+ this.size = getSize( this.element );
2377
+ };
2378
+
2379
+ /**
2380
+ * get measurement from option, for columnWidth, rowHeight, gutter
2381
+ * if option is String -> get element from selector string, & get size of element
2382
+ * if option is Element -> get size of element
2383
+ * else use option as a number
2384
+ *
2385
+ * @param {String} measurement
2386
+ * @param {String} size - width or height
2387
+ * @private
2388
+ */
2389
+ Outlayer.prototype._getMeasurement = function( measurement, size ) {
2390
+ var option = this.options[ measurement ];
2391
+ var elem;
2392
+ if ( !option ) {
2393
+ // default to 0
2394
+ this[ measurement ] = 0;
2395
+ } else {
2396
+ // use option as an element
2397
+ if ( typeof option === 'string' ) {
2398
+ elem = this.element.querySelector( option );
2399
+ } else if ( utils.isElement( option ) ) {
2400
+ elem = option;
2401
+ }
2402
+ // use size of element, if element
2403
+ this[ measurement ] = elem ? getSize( elem )[ size ] : option;
2404
+ }
2405
+ };
2406
+
2407
+ /**
2408
+ * layout a collection of item elements
2409
+ * @api public
2410
+ */
2411
+ Outlayer.prototype.layoutItems = function( items, isInstant ) {
2412
+ items = this._getItemsForLayout( items );
2413
+
2414
+ this._layoutItems( items, isInstant );
2415
+
2416
+ this._postLayout();
2417
+ };
2418
+
2419
+ /**
2420
+ * get the items to be laid out
2421
+ * you may want to skip over some items
2422
+ * @param {Array} items
2423
+ * @returns {Array} items
2424
+ */
2425
+ Outlayer.prototype._getItemsForLayout = function( items ) {
2426
+ var layoutItems = [];
2427
+ for ( var i=0, len = items.length; i < len; i++ ) {
2428
+ var item = items[i];
2429
+ if ( !item.isIgnored ) {
2430
+ layoutItems.push( item );
2431
+ }
2432
+ }
2433
+ return layoutItems;
2434
+ };
2435
+
2436
+ /**
2437
+ * layout items
2438
+ * @param {Array} items
2439
+ * @param {Boolean} isInstant
2440
+ */
2441
+ Outlayer.prototype._layoutItems = function( items, isInstant ) {
2442
+ this._emitCompleteOnItems( 'layout', items );
2443
+
2444
+ if ( !items || !items.length ) {
2445
+ // no items, emit event with empty array
2446
+ return;
2447
+ }
2448
+
2449
+ var queue = [];
2450
+
2451
+ for ( var i=0, len = items.length; i < len; i++ ) {
2452
+ var item = items[i];
2453
+ // get x/y object from method
2454
+ var position = this._getItemLayoutPosition( item );
2455
+ // enqueue
2456
+ position.item = item;
2457
+ position.isInstant = isInstant || item.isLayoutInstant;
2458
+ queue.push( position );
2459
+ }
2460
+
2461
+ this._processLayoutQueue( queue );
2462
+ };
2463
+
2464
+ /**
2465
+ * get item layout position
2466
+ * @param {Outlayer.Item} item
2467
+ * @returns {Object} x and y position
2468
+ */
2469
+ Outlayer.prototype._getItemLayoutPosition = function( /* item */ ) {
2470
+ return {
2471
+ x: 0,
2472
+ y: 0
2473
+ };
2474
+ };
2475
+
2476
+ /**
2477
+ * iterate over array and position each item
2478
+ * Reason being - separating this logic prevents 'layout invalidation'
2479
+ * thx @paul_irish
2480
+ * @param {Array} queue
2481
+ */
2482
+ Outlayer.prototype._processLayoutQueue = function( queue ) {
2483
+ for ( var i=0, len = queue.length; i < len; i++ ) {
2484
+ var obj = queue[i];
2485
+ this._positionItem( obj.item, obj.x, obj.y, obj.isInstant );
2486
+ }
2487
+ };
2488
+
2489
+ /**
2490
+ * Sets position of item in DOM
2491
+ * @param {Outlayer.Item} item
2492
+ * @param {Number} x - horizontal position
2493
+ * @param {Number} y - vertical position
2494
+ * @param {Boolean} isInstant - disables transitions
2495
+ */
2496
+ Outlayer.prototype._positionItem = function( item, x, y, isInstant ) {
2497
+ if ( isInstant ) {
2498
+ // if not transition, just set CSS
2499
+ item.goTo( x, y );
2500
+ } else {
2501
+ item.moveTo( x, y );
2502
+ }
2503
+ };
2504
+
2505
+ /**
2506
+ * Any logic you want to do after each layout,
2507
+ * i.e. size the container
2508
+ */
2509
+ Outlayer.prototype._postLayout = function() {
2510
+ this.resizeContainer();
2511
+ };
2512
+
2513
+ Outlayer.prototype.resizeContainer = function() {
2514
+ if ( !this.options.isResizingContainer ) {
2515
+ return;
2516
+ }
2517
+ var size = this._getContainerSize();
2518
+ if ( size ) {
2519
+ this._setContainerMeasure( size.width, true );
2520
+ this._setContainerMeasure( size.height, false );
2521
+ }
2522
+ };
2523
+
2524
+ /**
2525
+ * Sets width or height of container if returned
2526
+ * @returns {Object} size
2527
+ * @param {Number} width
2528
+ * @param {Number} height
2529
+ */
2530
+ Outlayer.prototype._getContainerSize = noop;
2531
+
2532
+ /**
2533
+ * @param {Number} measure - size of width or height
2534
+ * @param {Boolean} isWidth
2535
+ */
2536
+ Outlayer.prototype._setContainerMeasure = function( measure, isWidth ) {
2537
+ if ( measure === undefined ) {
2538
+ return;
2539
+ }
2540
+
2541
+ var elemSize = this.size;
2542
+ // add padding and border width if border box
2543
+ if ( elemSize.isBorderBox ) {
2544
+ measure += isWidth ? elemSize.paddingLeft + elemSize.paddingRight +
2545
+ elemSize.borderLeftWidth + elemSize.borderRightWidth :
2546
+ elemSize.paddingBottom + elemSize.paddingTop +
2547
+ elemSize.borderTopWidth + elemSize.borderBottomWidth;
2548
+ }
2549
+
2550
+ measure = Math.max( measure, 0 );
2551
+ this.element.style[ isWidth ? 'width' : 'height' ] = measure + 'px';
2552
+ };
2553
+
2554
+ /**
2555
+ * emit eventComplete on a collection of items events
2556
+ * @param {String} eventName
2557
+ * @param {Array} items - Outlayer.Items
2558
+ */
2559
+ Outlayer.prototype._emitCompleteOnItems = function( eventName, items ) {
2560
+ var _this = this;
2561
+ function onComplete() {
2562
+ _this.dispatchEvent( eventName + 'Complete', null, [ items ] );
2563
+ }
2564
+
2565
+ var count = items.length;
2566
+ if ( !items || !count ) {
2567
+ onComplete();
2568
+ return;
2569
+ }
2570
+
2571
+ var doneCount = 0;
2572
+ function tick() {
2573
+ doneCount++;
2574
+ if ( doneCount === count ) {
2575
+ onComplete();
2576
+ }
2577
+ }
2578
+
2579
+ // bind callback
2580
+ for ( var i=0, len = items.length; i < len; i++ ) {
2581
+ var item = items[i];
2582
+ item.once( eventName, tick );
2583
+ }
2584
+ };
2585
+
2586
+ /**
2587
+ * emits events via eventEmitter and jQuery events
2588
+ * @param {String} type - name of event
2589
+ * @param {Event} event - original event
2590
+ * @param {Array} args - extra arguments
2591
+ */
2592
+ Outlayer.prototype.dispatchEvent = function( type, event, args ) {
2593
+ // add original event to arguments
2594
+ var emitArgs = event ? [ event ].concat( args ) : args;
2595
+ this.emitEvent( type, emitArgs );
2596
+
2597
+ if ( jQuery ) {
2598
+ // set this.$element
2599
+ this.$element = this.$element || jQuery( this.element );
2600
+ if ( event ) {
2601
+ // create jQuery event
2602
+ var $event = jQuery.Event( event );
2603
+ $event.type = type;
2604
+ this.$element.trigger( $event, args );
2605
+ } else {
2606
+ // just trigger with type if no event available
2607
+ this.$element.trigger( type, args );
2608
+ }
2609
+ }
2610
+ };
2611
+
2612
+ // -------------------------- ignore & stamps -------------------------- //
2613
+
2614
+
2615
+ /**
2616
+ * keep item in collection, but do not lay it out
2617
+ * ignored items do not get skipped in layout
2618
+ * @param {Element} elem
2619
+ */
2620
+ Outlayer.prototype.ignore = function( elem ) {
2621
+ var item = this.getItem( elem );
2622
+ if ( item ) {
2623
+ item.isIgnored = true;
2624
+ }
2625
+ };
2626
+
2627
+ /**
2628
+ * return item to layout collection
2629
+ * @param {Element} elem
2630
+ */
2631
+ Outlayer.prototype.unignore = function( elem ) {
2632
+ var item = this.getItem( elem );
2633
+ if ( item ) {
2634
+ delete item.isIgnored;
2635
+ }
2636
+ };
2637
+
2638
+ /**
2639
+ * adds elements to stamps
2640
+ * @param {NodeList, Array, Element, or String} elems
2641
+ */
2642
+ Outlayer.prototype.stamp = function( elems ) {
2643
+ elems = this._find( elems );
2644
+ if ( !elems ) {
2645
+ return;
2646
+ }
2647
+
2648
+ this.stamps = this.stamps.concat( elems );
2649
+ // ignore
2650
+ for ( var i=0, len = elems.length; i < len; i++ ) {
2651
+ var elem = elems[i];
2652
+ this.ignore( elem );
2653
+ }
2654
+ };
2655
+
2656
+ /**
2657
+ * removes elements to stamps
2658
+ * @param {NodeList, Array, or Element} elems
2659
+ */
2660
+ Outlayer.prototype.unstamp = function( elems ) {
2661
+ elems = this._find( elems );
2662
+ if ( !elems ){
2663
+ return;
2664
+ }
2665
+
2666
+ for ( var i=0, len = elems.length; i < len; i++ ) {
2667
+ var elem = elems[i];
2668
+ // filter out removed stamp elements
2669
+ utils.removeFrom( this.stamps, elem );
2670
+ this.unignore( elem );
2671
+ }
2672
+
2673
+ };
2674
+
2675
+ /**
2676
+ * finds child elements
2677
+ * @param {NodeList, Array, Element, or String} elems
2678
+ * @returns {Array} elems
2679
+ */
2680
+ Outlayer.prototype._find = function( elems ) {
2681
+ if ( !elems ) {
2682
+ return;
2683
+ }
2684
+ // if string, use argument as selector string
2685
+ if ( typeof elems === 'string' ) {
2686
+ elems = this.element.querySelectorAll( elems );
2687
+ }
2688
+ elems = utils.makeArray( elems );
2689
+ return elems;
2690
+ };
2691
+
2692
+ Outlayer.prototype._manageStamps = function() {
2693
+ if ( !this.stamps || !this.stamps.length ) {
2694
+ return;
2695
+ }
2696
+
2697
+ this._getBoundingRect();
2698
+
2699
+ for ( var i=0, len = this.stamps.length; i < len; i++ ) {
2700
+ var stamp = this.stamps[i];
2701
+ this._manageStamp( stamp );
2702
+ }
2703
+ };
2704
+
2705
+ // update boundingLeft / Top
2706
+ Outlayer.prototype._getBoundingRect = function() {
2707
+ // get bounding rect for container element
2708
+ var boundingRect = this.element.getBoundingClientRect();
2709
+ var size = this.size;
2710
+ this._boundingRect = {
2711
+ left: boundingRect.left + size.paddingLeft + size.borderLeftWidth,
2712
+ top: boundingRect.top + size.paddingTop + size.borderTopWidth,
2713
+ right: boundingRect.right - ( size.paddingRight + size.borderRightWidth ),
2714
+ bottom: boundingRect.bottom - ( size.paddingBottom + size.borderBottomWidth )
2715
+ };
2716
+ };
2717
+
2718
+ /**
2719
+ * @param {Element} stamp
2720
+ **/
2721
+ Outlayer.prototype._manageStamp = noop;
2722
+
2723
+ /**
2724
+ * get x/y position of element relative to container element
2725
+ * @param {Element} elem
2726
+ * @returns {Object} offset - has left, top, right, bottom
2727
+ */
2728
+ Outlayer.prototype._getElementOffset = function( elem ) {
2729
+ var boundingRect = elem.getBoundingClientRect();
2730
+ var thisRect = this._boundingRect;
2731
+ var size = getSize( elem );
2732
+ var offset = {
2733
+ left: boundingRect.left - thisRect.left - size.marginLeft,
2734
+ top: boundingRect.top - thisRect.top - size.marginTop,
2735
+ right: thisRect.right - boundingRect.right - size.marginRight,
2736
+ bottom: thisRect.bottom - boundingRect.bottom - size.marginBottom
2737
+ };
2738
+ return offset;
2739
+ };
2740
+
2741
+ // -------------------------- resize -------------------------- //
2742
+
2743
+ // enable event handlers for listeners
2744
+ // i.e. resize -> onresize
2745
+ Outlayer.prototype.handleEvent = function( event ) {
2746
+ var method = 'on' + event.type;
2747
+ if ( this[ method ] ) {
2748
+ this[ method ]( event );
2749
+ }
2750
+ };
2751
+
2752
+ /**
2753
+ * Bind layout to window resizing
2754
+ */
2755
+ Outlayer.prototype.bindResize = function() {
2756
+ // bind just one listener
2757
+ if ( this.isResizeBound ) {
2758
+ return;
2759
+ }
2760
+ eventie.bind( window, 'resize', this );
2761
+ this.isResizeBound = true;
2762
+ };
2763
+
2764
+ /**
2765
+ * Unbind layout to window resizing
2766
+ */
2767
+ Outlayer.prototype.unbindResize = function() {
2768
+ if ( this.isResizeBound ) {
2769
+ eventie.unbind( window, 'resize', this );
2770
+ }
2771
+ this.isResizeBound = false;
2772
+ };
2773
+
2774
+ // original debounce by John Hann
2775
+ // http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/
2776
+
2777
+ // this fires every resize
2778
+ Outlayer.prototype.onresize = function() {
2779
+ if ( this.resizeTimeout ) {
2780
+ clearTimeout( this.resizeTimeout );
2781
+ }
2782
+
2783
+ var _this = this;
2784
+ function delayed() {
2785
+ _this.resize();
2786
+ delete _this.resizeTimeout;
2787
+ }
2788
+
2789
+ this.resizeTimeout = setTimeout( delayed, 100 );
2790
+ };
2791
+
2792
+ // debounced, layout on resize
2793
+ Outlayer.prototype.resize = function() {
2794
+ // don't trigger if size did not change
2795
+ // or if resize was unbound. See #9
2796
+ if ( !this.isResizeBound || !this.needsResizeLayout() ) {
2797
+ return;
2798
+ }
2799
+
2800
+ this.layout();
2801
+ };
2802
+
2803
+ /**
2804
+ * check if layout is needed post layout
2805
+ * @returns Boolean
2806
+ */
2807
+ Outlayer.prototype.needsResizeLayout = function() {
2808
+ var size = getSize( this.element );
2809
+ // check that this.size and size are there
2810
+ // IE8 triggers resize on body size change, so they might not be
2811
+ var hasSizes = this.size && size;
2812
+ return hasSizes && size.innerWidth !== this.size.innerWidth;
2813
+ };
2814
+
2815
+ // -------------------------- methods -------------------------- //
2816
+
2817
+ /**
2818
+ * add items to Outlayer instance
2819
+ * @param {Array or NodeList or Element} elems
2820
+ * @returns {Array} items - Outlayer.Items
2821
+ **/
2822
+ Outlayer.prototype.addItems = function( elems ) {
2823
+ var items = this._itemize( elems );
2824
+ // add items to collection
2825
+ if ( items.length ) {
2826
+ this.items = this.items.concat( items );
2827
+ }
2828
+ return items;
2829
+ };
2830
+
2831
+ /**
2832
+ * Layout newly-appended item elements
2833
+ * @param {Array or NodeList or Element} elems
2834
+ */
2835
+ Outlayer.prototype.appended = function( elems ) {
2836
+ var items = this.addItems( elems );
2837
+ if ( !items.length ) {
2838
+ return;
2839
+ }
2840
+ // layout and reveal just the new items
2841
+ this.layoutItems( items, true );
2842
+ this.reveal( items );
2843
+ };
2844
+
2845
+ /**
2846
+ * Layout prepended elements
2847
+ * @param {Array or NodeList or Element} elems
2848
+ */
2849
+ Outlayer.prototype.prepended = function( elems ) {
2850
+ var items = this._itemize( elems );
2851
+ if ( !items.length ) {
2852
+ return;
2853
+ }
2854
+ // add items to beginning of collection
2855
+ var previousItems = this.items.slice(0);
2856
+ this.items = items.concat( previousItems );
2857
+ // start new layout
2858
+ this._resetLayout();
2859
+ this._manageStamps();
2860
+ // layout new stuff without transition
2861
+ this.layoutItems( items, true );
2862
+ this.reveal( items );
2863
+ // layout previous items
2864
+ this.layoutItems( previousItems );
2865
+ };
2866
+
2867
+ /**
2868
+ * reveal a collection of items
2869
+ * @param {Array of Outlayer.Items} items
2870
+ */
2871
+ Outlayer.prototype.reveal = function( items ) {
2872
+ this._emitCompleteOnItems( 'reveal', items );
2873
+
2874
+ var len = items && items.length;
2875
+ for ( var i=0; len && i < len; i++ ) {
2876
+ var item = items[i];
2877
+ item.reveal();
2878
+ }
2879
+ };
2880
+
2881
+ /**
2882
+ * hide a collection of items
2883
+ * @param {Array of Outlayer.Items} items
2884
+ */
2885
+ Outlayer.prototype.hide = function( items ) {
2886
+ this._emitCompleteOnItems( 'hide', items );
2887
+
2888
+ var len = items && items.length;
2889
+ for ( var i=0; len && i < len; i++ ) {
2890
+ var item = items[i];
2891
+ item.hide();
2892
+ }
2893
+ };
2894
+
2895
+ /**
2896
+ * reveal item elements
2897
+ * @param {Array}, {Element}, {NodeList} items
2898
+ */
2899
+ Outlayer.prototype.revealItemElements = function( elems ) {
2900
+ var items = this.getItems( elems );
2901
+ this.reveal( items );
2902
+ };
2903
+
2904
+ /**
2905
+ * hide item elements
2906
+ * @param {Array}, {Element}, {NodeList} items
2907
+ */
2908
+ Outlayer.prototype.hideItemElements = function( elems ) {
2909
+ var items = this.getItems( elems );
2910
+ this.hide( items );
2911
+ };
2912
+
2913
+ /**
2914
+ * get Outlayer.Item, given an Element
2915
+ * @param {Element} elem
2916
+ * @param {Function} callback
2917
+ * @returns {Outlayer.Item} item
2918
+ */
2919
+ Outlayer.prototype.getItem = function( elem ) {
2920
+ // loop through items to get the one that matches
2921
+ for ( var i=0, len = this.items.length; i < len; i++ ) {
2922
+ var item = this.items[i];
2923
+ if ( item.element === elem ) {
2924
+ // return item
2925
+ return item;
2926
+ }
2927
+ }
2928
+ };
2929
+
2930
+ /**
2931
+ * get collection of Outlayer.Items, given Elements
2932
+ * @param {Array} elems
2933
+ * @returns {Array} items - Outlayer.Items
2934
+ */
2935
+ Outlayer.prototype.getItems = function( elems ) {
2936
+ elems = utils.makeArray( elems );
2937
+ var items = [];
2938
+ for ( var i=0, len = elems.length; i < len; i++ ) {
2939
+ var elem = elems[i];
2940
+ var item = this.getItem( elem );
2941
+ if ( item ) {
2942
+ items.push( item );
2943
+ }
2944
+ }
2945
+
2946
+ return items;
2947
+ };
2948
+
2949
+ /**
2950
+ * remove element(s) from instance and DOM
2951
+ * @param {Array or NodeList or Element} elems
2952
+ */
2953
+ Outlayer.prototype.remove = function( elems ) {
2954
+ var removeItems = this.getItems( elems );
2955
+
2956
+ this._emitCompleteOnItems( 'remove', removeItems );
2957
+
2958
+ // bail if no items to remove
2959
+ if ( !removeItems || !removeItems.length ) {
2960
+ return;
2961
+ }
2962
+
2963
+ for ( var i=0, len = removeItems.length; i < len; i++ ) {
2964
+ var item = removeItems[i];
2965
+ item.remove();
2966
+ // remove item from collection
2967
+ utils.removeFrom( this.items, item );
2968
+ }
2969
+ };
2970
+
2971
+ // ----- destroy ----- //
2972
+
2973
+ // remove and disable Outlayer instance
2974
+ Outlayer.prototype.destroy = function() {
2975
+ // clean up dynamic styles
2976
+ var style = this.element.style;
2977
+ style.height = '';
2978
+ style.position = '';
2979
+ style.width = '';
2980
+ // destroy items
2981
+ for ( var i=0, len = this.items.length; i < len; i++ ) {
2982
+ var item = this.items[i];
2983
+ item.destroy();
2984
+ }
2985
+
2986
+ this.unbindResize();
2987
+
2988
+ var id = this.element.outlayerGUID;
2989
+ delete instances[ id ]; // remove reference to instance by id
2990
+ delete this.element.outlayerGUID;
2991
+ // remove data for jQuery
2992
+ if ( jQuery ) {
2993
+ jQuery.removeData( this.element, this.constructor.namespace );
2994
+ }
2995
+
2996
+ };
2997
+
2998
+ // -------------------------- data -------------------------- //
2999
+
3000
+ /**
3001
+ * get Outlayer instance from element
3002
+ * @param {Element} elem
3003
+ * @returns {Outlayer}
3004
+ */
3005
+ Outlayer.data = function( elem ) {
3006
+ elem = utils.getQueryElement( elem );
3007
+ var id = elem && elem.outlayerGUID;
3008
+ return id && instances[ id ];
3009
+ };
3010
+
3011
+
3012
+ // -------------------------- create Outlayer class -------------------------- //
3013
+
3014
+ /**
3015
+ * create a layout class
3016
+ * @param {String} namespace
3017
+ */
3018
+ Outlayer.create = function( namespace, options ) {
3019
+ // sub-class Outlayer
3020
+ function Layout() {
3021
+ Outlayer.apply( this, arguments );
3022
+ }
3023
+ // inherit Outlayer prototype, use Object.create if there
3024
+ if ( Object.create ) {
3025
+ Layout.prototype = Object.create( Outlayer.prototype );
3026
+ } else {
3027
+ utils.extend( Layout.prototype, Outlayer.prototype );
3028
+ }
3029
+ // set contructor, used for namespace and Item
3030
+ Layout.prototype.constructor = Layout;
3031
+
3032
+ Layout.defaults = utils.extend( {}, Outlayer.defaults );
3033
+ // apply new options
3034
+ utils.extend( Layout.defaults, options );
3035
+ // keep prototype.settings for backwards compatibility (Packery v1.2.0)
3036
+ Layout.prototype.settings = {};
3037
+
3038
+ Layout.namespace = namespace;
3039
+
3040
+ Layout.data = Outlayer.data;
3041
+
3042
+ // sub-class Item
3043
+ Layout.Item = function LayoutItem() {
3044
+ Item.apply( this, arguments );
3045
+ };
3046
+
3047
+ Layout.Item.prototype = new Item();
3048
+
3049
+ // -------------------------- declarative -------------------------- //
3050
+
3051
+ utils.htmlInit( Layout, namespace );
3052
+
3053
+ // -------------------------- jQuery bridge -------------------------- //
3054
+
3055
+ // make into jQuery plugin
3056
+ if ( jQuery && jQuery.bridget ) {
3057
+ jQuery.bridget( namespace, Layout );
3058
+ }
3059
+
3060
+ return Layout;
3061
+ };
3062
+
3063
+ // ----- fin ----- //
3064
+
3065
+ // back in global
3066
+ Outlayer.Item = Item;
3067
+
3068
+ return Outlayer;
3069
+
3070
+ }));
3071
+
3072
+
3073
+ /**
3074
+ * Rect
3075
+ * low-level utility class for basic geometry
3076
+ */
3077
+
3078
+ ( function( window, factory ) {
3079
+
3080
+ // universal module definition
3081
+ if ( typeof define == 'function' && define.amd ) {
3082
+ // AMD
3083
+ define( 'packery/js/rect',factory );
3084
+ } else if ( typeof exports == 'object' ) {
3085
+ // CommonJS
3086
+ module.exports = factory();
3087
+ } else {
3088
+ // browser global
3089
+ window.Packery = window.Packery || {};
3090
+ window.Packery.Rect = factory();
3091
+ }
3092
+
3093
+ }( window, function factory() {
3094
+
3095
+
3096
+ // -------------------------- Packery -------------------------- //
3097
+
3098
+ // global namespace
3099
+ var Packery = window.Packery = function() {};
3100
+
3101
+ // -------------------------- Rect -------------------------- //
3102
+
3103
+ function Rect( props ) {
3104
+ // extend properties from defaults
3105
+ for ( var prop in Rect.defaults ) {
3106
+ this[ prop ] = Rect.defaults[ prop ];
3107
+ }
3108
+
3109
+ for ( prop in props ) {
3110
+ this[ prop ] = props[ prop ];
3111
+ }
3112
+
3113
+ }
3114
+
3115
+ // make available
3116
+ Packery.Rect = Rect;
3117
+
3118
+ Rect.defaults = {
3119
+ x: 0,
3120
+ y: 0,
3121
+ width: 0,
3122
+ height: 0
3123
+ };
3124
+
3125
+ /**
3126
+ * Determines whether or not this rectangle wholly encloses another rectangle or point.
3127
+ * @param {Rect} rect
3128
+ * @returns {Boolean}
3129
+ **/
3130
+ Rect.prototype.contains = function( rect ) {
3131
+ // points don't have width or height
3132
+ var otherWidth = rect.width || 0;
3133
+ var otherHeight = rect.height || 0;
3134
+ return this.x <= rect.x &&
3135
+ this.y <= rect.y &&
3136
+ this.x + this.width >= rect.x + otherWidth &&
3137
+ this.y + this.height >= rect.y + otherHeight;
3138
+ };
3139
+
3140
+ /**
3141
+ * Determines whether or not the rectangle intersects with another.
3142
+ * @param {Rect} rect
3143
+ * @returns {Boolean}
3144
+ **/
3145
+ Rect.prototype.overlaps = function( rect ) {
3146
+ var thisRight = this.x + this.width;
3147
+ var thisBottom = this.y + this.height;
3148
+ var rectRight = rect.x + rect.width;
3149
+ var rectBottom = rect.y + rect.height;
3150
+
3151
+ // http://stackoverflow.com/a/306332
3152
+ return this.x < rectRight &&
3153
+ thisRight > rect.x &&
3154
+ this.y < rectBottom &&
3155
+ thisBottom > rect.y;
3156
+ };
3157
+
3158
+ /**
3159
+ * @param {Rect} rect - the overlapping rect
3160
+ * @returns {Array} freeRects - rects representing the area around the rect
3161
+ **/
3162
+ Rect.prototype.getMaximalFreeRects = function( rect ) {
3163
+
3164
+ // if no intersection, return false
3165
+ if ( !this.overlaps( rect ) ) {
3166
+ return false;
3167
+ }
3168
+
3169
+ var freeRects = [];
3170
+ var freeRect;
3171
+
3172
+ var thisRight = this.x + this.width;
3173
+ var thisBottom = this.y + this.height;
3174
+ var rectRight = rect.x + rect.width;
3175
+ var rectBottom = rect.y + rect.height;
3176
+
3177
+ // top
3178
+ if ( this.y < rect.y ) {
3179
+ freeRect = new Rect({
3180
+ x: this.x,
3181
+ y: this.y,
3182
+ width: this.width,
3183
+ height: rect.y - this.y
3184
+ });
3185
+ freeRects.push( freeRect );
3186
+ }
3187
+
3188
+ // right
3189
+ if ( thisRight > rectRight ) {
3190
+ freeRect = new Rect({
3191
+ x: rectRight,
3192
+ y: this.y,
3193
+ width: thisRight - rectRight,
3194
+ height: this.height
3195
+ });
3196
+ freeRects.push( freeRect );
3197
+ }
3198
+
3199
+ // bottom
3200
+ if ( thisBottom > rectBottom ) {
3201
+ freeRect = new Rect({
3202
+ x: this.x,
3203
+ y: rectBottom,
3204
+ width: this.width,
3205
+ height: thisBottom - rectBottom
3206
+ });
3207
+ freeRects.push( freeRect );
3208
+ }
3209
+
3210
+ // left
3211
+ if ( this.x < rect.x ) {
3212
+ freeRect = new Rect({
3213
+ x: this.x,
3214
+ y: this.y,
3215
+ width: rect.x - this.x,
3216
+ height: this.height
3217
+ });
3218
+ freeRects.push( freeRect );
3219
+ }
3220
+
3221
+ return freeRects;
3222
+ };
3223
+
3224
+ Rect.prototype.canFit = function( rect ) {
3225
+ return this.width >= rect.width && this.height >= rect.height;
3226
+ };
3227
+
3228
+ return Rect;
3229
+
3230
+ }));
3231
+
3232
+ /**
3233
+ * Packer
3234
+ * bin-packing algorithm
3235
+ */
3236
+
3237
+ ( function( window, factory ) {
3238
+
3239
+ // universal module definition
3240
+ if ( typeof define == 'function' && define.amd ) {
3241
+ // AMD
3242
+ define( 'packery/js/packer',[ './rect' ], factory );
3243
+ } else if ( typeof exports == 'object' ) {
3244
+ // CommonJS
3245
+ module.exports = factory(
3246
+ require('./rect')
3247
+ );
3248
+ } else {
3249
+ // browser global
3250
+ var Packery = window.Packery = window.Packery || {};
3251
+ Packery.Packer = factory( Packery.Rect );
3252
+ }
3253
+
3254
+ }( window, function factory( Rect ) {
3255
+
3256
+
3257
+ // -------------------------- Packer -------------------------- //
3258
+
3259
+ /**
3260
+ * @param {Number} width
3261
+ * @param {Number} height
3262
+ * @param {String} sortDirection
3263
+ * topLeft for vertical, leftTop for horizontal
3264
+ */
3265
+ function Packer( width, height, sortDirection ) {
3266
+ this.width = width || 0;
3267
+ this.height = height || 0;
3268
+ this.sortDirection = sortDirection || 'downwardLeftToRight';
3269
+
3270
+ this.reset();
3271
+ }
3272
+
3273
+ Packer.prototype.reset = function() {
3274
+ this.spaces = [];
3275
+ this.newSpaces = [];
3276
+
3277
+ var initialSpace = new Rect({
3278
+ x: 0,
3279
+ y: 0,
3280
+ width: this.width,
3281
+ height: this.height
3282
+ });
3283
+
3284
+ this.spaces.push( initialSpace );
3285
+ // set sorter
3286
+ this.sorter = sorters[ this.sortDirection ] || sorters.downwardLeftToRight;
3287
+ };
3288
+
3289
+ // change x and y of rect to fit with in Packer's available spaces
3290
+ Packer.prototype.pack = function( rect ) {
3291
+ for ( var i=0, len = this.spaces.length; i < len; i++ ) {
3292
+ var space = this.spaces[i];
3293
+ if ( space.canFit( rect ) ) {
3294
+ this.placeInSpace( rect, space );
3295
+ break;
3296
+ }
3297
+ }
3298
+ };
3299
+
3300
+ Packer.prototype.placeInSpace = function( rect, space ) {
3301
+ // place rect in space
3302
+ rect.x = space.x;
3303
+ rect.y = space.y;
3304
+
3305
+ this.placed( rect );
3306
+ };
3307
+
3308
+ // update spaces with placed rect
3309
+ Packer.prototype.placed = function( rect ) {
3310
+ // update spaces
3311
+ var revisedSpaces = [];
3312
+ for ( var i=0, len = this.spaces.length; i < len; i++ ) {
3313
+ var space = this.spaces[i];
3314
+ var newSpaces = space.getMaximalFreeRects( rect );
3315
+ // add either the original space or the new spaces to the revised spaces
3316
+ if ( newSpaces ) {
3317
+ revisedSpaces.push.apply( revisedSpaces, newSpaces );
3318
+ } else {
3319
+ revisedSpaces.push( space );
3320
+ }
3321
+ }
3322
+
3323
+ this.spaces = revisedSpaces;
3324
+
3325
+ this.mergeSortSpaces();
3326
+ };
3327
+
3328
+ Packer.prototype.mergeSortSpaces = function() {
3329
+ // remove redundant spaces
3330
+ Packer.mergeRects( this.spaces );
3331
+ this.spaces.sort( this.sorter );
3332
+ };
3333
+
3334
+ // add a space back
3335
+ Packer.prototype.addSpace = function( rect ) {
3336
+ this.spaces.push( rect );
3337
+ this.mergeSortSpaces();
3338
+ };
3339
+
3340
+ // -------------------------- utility functions -------------------------- //
3341
+
3342
+ /**
3343
+ * Remove redundant rectangle from array of rectangles
3344
+ * @param {Array} rects: an array of Rects
3345
+ * @returns {Array} rects: an array of Rects
3346
+ **/
3347
+ Packer.mergeRects = function( rects ) {
3348
+ for ( var i=0, len = rects.length; i < len; i++ ) {
3349
+ var rect = rects[i];
3350
+ // skip over this rect if it was already removed
3351
+ if ( !rect ) {
3352
+ continue;
3353
+ }
3354
+ // clone rects we're testing, remove this rect
3355
+ var compareRects = rects.slice(0);
3356
+ // do not compare with self
3357
+ compareRects.splice( i, 1 );
3358
+ // compare this rect with others
3359
+ var removedCount = 0;
3360
+ for ( var j=0, jLen = compareRects.length; j < jLen; j++ ) {
3361
+ var compareRect = compareRects[j];
3362
+ // if this rect contains another,
3363
+ // remove that rect from test collection
3364
+ var indexAdjust = i > j ? 0 : 1;
3365
+ if ( rect.contains( compareRect ) ) {
3366
+ // console.log( 'current test rects:' + testRects.length, testRects );
3367
+ // console.log( i, j, indexAdjust, rect, compareRect );
3368
+ rects.splice( j + indexAdjust - removedCount, 1 );
3369
+ removedCount++;
3370
+ }
3371
+ }
3372
+ }
3373
+
3374
+ return rects;
3375
+ };
3376
+
3377
+
3378
+ // -------------------------- sorters -------------------------- //
3379
+
3380
+ // functions for sorting rects in order
3381
+ var sorters = {
3382
+ // top down, then left to right
3383
+ downwardLeftToRight: function( a, b ) {
3384
+ return a.y - b.y || a.x - b.x;
3385
+ },
3386
+ // left to right, then top down
3387
+ rightwardTopToBottom: function( a, b ) {
3388
+ return a.x - b.x || a.y - b.y;
3389
+ }
3390
+ };
3391
+
3392
+
3393
+ // -------------------------- -------------------------- //
3394
+
3395
+ return Packer;
3396
+
3397
+ }));
3398
+ /**
3399
+ * Packery Item Element
3400
+ **/
3401
+
3402
+ ( function( window, factory ) {
3403
+
3404
+ // universal module definition
3405
+
3406
+ if ( typeof define == 'function' && define.amd ) {
3407
+ // AMD
3408
+ define( 'packery/js/item',[
3409
+ 'get-style-property/get-style-property',
3410
+ 'outlayer/outlayer',
3411
+ './rect'
3412
+ ],
3413
+ factory );
3414
+ } else if ( typeof exports == 'object' ) {
3415
+ // CommonJS
3416
+ module.exports = factory(
3417
+ require('desandro-get-style-property'),
3418
+ require('outlayer'),
3419
+ require('./rect')
3420
+ );
3421
+ } else {
3422
+ // browser global
3423
+ window.Packery.Item = factory(
3424
+ window.getStyleProperty,
3425
+ window.Outlayer,
3426
+ window.Packery.Rect
3427
+ );
3428
+ }
3429
+
3430
+ }( window, function factory( getStyleProperty, Outlayer, Rect ) {
3431
+
3432
+
3433
+ // -------------------------- Item -------------------------- //
3434
+
3435
+ var transformProperty = getStyleProperty('transform');
3436
+
3437
+ // sub-class Item
3438
+ var Item = function PackeryItem() {
3439
+ Outlayer.Item.apply( this, arguments );
3440
+ };
3441
+
3442
+ Item.prototype = new Outlayer.Item();
3443
+
3444
+ var protoCreate = Item.prototype._create;
3445
+ Item.prototype._create = function() {
3446
+ // call default _create logic
3447
+ protoCreate.call( this );
3448
+ this.rect = new Rect();
3449
+ // rect used for placing, in drag or Packery.fit()
3450
+ this.placeRect = new Rect();
3451
+ };
3452
+
3453
+ // -------------------------- drag -------------------------- //
3454
+
3455
+ Item.prototype.dragStart = function() {
3456
+ this.getPosition();
3457
+ this.removeTransitionStyles();
3458
+ // remove transform property from transition
3459
+ if ( this.isTransitioning && transformProperty ) {
3460
+ this.element.style[ transformProperty ] = 'none';
3461
+ }
3462
+ this.getSize();
3463
+ // create place rect, used for position when dragged then dropped
3464
+ // or when positioning
3465
+ this.isPlacing = true;
3466
+ this.needsPositioning = false;
3467
+ this.positionPlaceRect( this.position.x, this.position.y );
3468
+ this.isTransitioning = false;
3469
+ this.didDrag = false;
3470
+ };
3471
+
3472
+ /**
3473
+ * handle item when it is dragged
3474
+ * @param {Number} x - horizontal position of dragged item
3475
+ * @param {Number} y - vertical position of dragged item
3476
+ */
3477
+ Item.prototype.dragMove = function( x, y ) {
3478
+ this.didDrag = true;
3479
+ var packerySize = this.layout.size;
3480
+ x -= packerySize.paddingLeft;
3481
+ y -= packerySize.paddingTop;
3482
+ this.positionPlaceRect( x, y );
3483
+ };
3484
+
3485
+ Item.prototype.dragStop = function() {
3486
+ this.getPosition();
3487
+ var isDiffX = this.position.x != this.placeRect.x;
3488
+ var isDiffY = this.position.y != this.placeRect.y;
3489
+ // set post-drag positioning flag
3490
+ this.needsPositioning = isDiffX || isDiffY;
3491
+ // reset flag
3492
+ this.didDrag = false;
3493
+ };
3494
+
3495
+ // -------------------------- placing -------------------------- //
3496
+
3497
+ /**
3498
+ * position a rect that will occupy space in the packer
3499
+ * @param {Number} x
3500
+ * @param {Number} y
3501
+ * @param {Boolean} isMaxYContained
3502
+ */
3503
+ Item.prototype.positionPlaceRect = function( x, y, isMaxYOpen ) {
3504
+ this.placeRect.x = this.getPlaceRectCoord( x, true );
3505
+ this.placeRect.y = this.getPlaceRectCoord( y, false, isMaxYOpen );
3506
+ };
3507
+
3508
+ /**
3509
+ * get x/y coordinate for place rect
3510
+ * @param {Number} coord - x or y
3511
+ * @param {Boolean} isX
3512
+ * @param {Boolean} isMaxOpen - does not limit value to outer bound
3513
+ * @returns {Number} coord - processed x or y
3514
+ */
3515
+ Item.prototype.getPlaceRectCoord = function( coord, isX, isMaxOpen ) {
3516
+ var measure = isX ? 'Width' : 'Height';
3517
+ var size = this.size[ 'outer' + measure ];
3518
+ var segment = this.layout[ isX ? 'columnWidth' : 'rowHeight' ];
3519
+ var parentSize = this.layout.size[ 'inner' + measure ];
3520
+
3521
+ // additional parentSize calculations for Y
3522
+ if ( !isX ) {
3523
+ parentSize = Math.max( parentSize, this.layout.maxY );
3524
+ // prevent gutter from bumping up height when non-vertical grid
3525
+ if ( !this.layout.rowHeight ) {
3526
+ parentSize -= this.layout.gutter;
3527
+ }
3528
+ }
3529
+
3530
+ var max;
3531
+
3532
+ if ( segment ) {
3533
+ segment += this.layout.gutter;
3534
+ // allow for last column to reach the edge
3535
+ parentSize += isX ? this.layout.gutter : 0;
3536
+ // snap to closest segment
3537
+ coord = Math.round( coord / segment );
3538
+ // contain to outer bound
3539
+ // contain non-growing bound, allow growing bound to grow
3540
+ var mathMethod;
3541
+ if ( this.layout.options.isHorizontal ) {
3542
+ mathMethod = !isX ? 'floor' : 'ceil';
3543
+ } else {
3544
+ mathMethod = isX ? 'floor' : 'ceil';
3545
+ }
3546
+ var maxSegments = Math[ mathMethod ]( parentSize / segment );
3547
+ maxSegments -= Math.ceil( size / segment );
3548
+ max = maxSegments;
3549
+ } else {
3550
+ max = parentSize - size;
3551
+ }
3552
+
3553
+ coord = isMaxOpen ? coord : Math.min( coord, max );
3554
+ coord *= segment || 1;
3555
+
3556
+ return Math.max( 0, coord );
3557
+ };
3558
+
3559
+ Item.prototype.copyPlaceRectPosition = function() {
3560
+ this.rect.x = this.placeRect.x;
3561
+ this.rect.y = this.placeRect.y;
3562
+ };
3563
+
3564
+ // ----- ----- //
3565
+
3566
+ // remove element from DOM
3567
+ Item.prototype.removeElem = function() {
3568
+ this.element.parentNode.removeChild( this.element );
3569
+ // add space back to packer
3570
+ this.layout.packer.addSpace( this.rect );
3571
+ this.emitEvent( 'remove', [ this ] );
3572
+ };
3573
+
3574
+ // ----- ----- //
3575
+
3576
+ return Item;
3577
+
3578
+ }));
3579
+
3580
+ /*!
3581
+ * Packery v1.4.3
3582
+ * bin-packing layout library
3583
+ *
3584
+ * Licensed GPLv3 for open source use
3585
+ * or Flickity Commercial License for commercial use
3586
+ *
3587
+ * http://packery.metafizzy.co
3588
+ * Copyright 2015 Metafizzy
3589
+ */
3590
+
3591
+ ( function( window, factory ) {
3592
+
3593
+ // universal module definition
3594
+ if ( typeof define == 'function' && define.amd ) {
3595
+ // AMD
3596
+ define( [
3597
+ 'classie/classie',
3598
+ 'get-size/get-size',
3599
+ 'outlayer/outlayer',
3600
+ 'packery/js/rect',
3601
+ 'packery/js/packer',
3602
+ 'packery/js/item'
3603
+ ],
3604
+ factory );
3605
+ } else if ( typeof exports == 'object' ) {
3606
+ // CommonJS
3607
+ module.exports = factory(
3608
+ require('desandro-classie'),
3609
+ require('get-size'),
3610
+ require('outlayer'),
3611
+ require('./rect'),
3612
+ require('./packer'),
3613
+ require('./item')
3614
+ );
3615
+ } else {
3616
+ // browser global
3617
+ window.Packery = factory(
3618
+ window.classie,
3619
+ window.getSize,
3620
+ window.Outlayer,
3621
+ window.Packery.Rect,
3622
+ window.Packery.Packer,
3623
+ window.Packery.Item
3624
+ );
3625
+ }
3626
+
3627
+ }( window, function factory( classie, getSize, Outlayer, Rect, Packer, Item ) {
3628
+
3629
+
3630
+ // ----- Rect ----- //
3631
+
3632
+ // allow for pixel rounding errors IE8-IE11 & Firefox; #227
3633
+ Rect.prototype.canFit = function( rect ) {
3634
+ return this.width >= rect.width - 1 && this.height >= rect.height - 1;
3635
+ };
3636
+
3637
+ // -------------------------- Packery -------------------------- //
3638
+
3639
+ // create an Outlayer layout class
3640
+ var Packery = Outlayer.create('packery');
3641
+ Packery.Item = Item;
3642
+
3643
+ Packery.prototype._create = function() {
3644
+ // call super
3645
+ Outlayer.prototype._create.call( this );
3646
+
3647
+ // initial properties
3648
+ this.packer = new Packer();
3649
+
3650
+ // Left over from v1.0
3651
+ this.stamp( this.options.stamped );
3652
+
3653
+ // create drag handlers
3654
+ var _this = this;
3655
+ this.handleDraggabilly = {
3656
+ dragStart: function() {
3657
+ _this.itemDragStart( this.element );
3658
+ },
3659
+ dragMove: function() {
3660
+ _this.itemDragMove( this.element, this.position.x, this.position.y );
3661
+ },
3662
+ dragEnd: function() {
3663
+ _this.itemDragEnd( this.element );
3664
+ }
3665
+ };
3666
+
3667
+ this.handleUIDraggable = {
3668
+ start: function handleUIDraggableStart( event, ui ) {
3669
+ // HTML5 may trigger dragstart, dismiss HTML5 dragging
3670
+ if ( !ui ) {
3671
+ return;
3672
+ }
3673
+ _this.itemDragStart( event.currentTarget );
3674
+ },
3675
+ drag: function handleUIDraggableDrag( event, ui ) {
3676
+ if ( !ui ) {
3677
+ return;
3678
+ }
3679
+ _this.itemDragMove( event.currentTarget, ui.position.left, ui.position.top );
3680
+ },
3681
+ stop: function handleUIDraggableStop( event, ui ) {
3682
+ if ( !ui ) {
3683
+ return;
3684
+ }
3685
+ _this.itemDragEnd( event.currentTarget );
3686
+ }
3687
+ };
3688
+
3689
+ };
3690
+
3691
+
3692
+ // ----- init & layout ----- //
3693
+
3694
+ /**
3695
+ * logic before any new layout
3696
+ */
3697
+ Packery.prototype._resetLayout = function() {
3698
+ this.getSize();
3699
+
3700
+ this._getMeasurements();
3701
+
3702
+ // reset packer
3703
+ var packer = this.packer;
3704
+ // packer settings, if horizontal or vertical
3705
+ if ( this.options.isHorizontal ) {
3706
+ packer.width = Number.POSITIVE_INFINITY;
3707
+ packer.height = this.size.innerHeight + this.gutter;
3708
+ packer.sortDirection = 'rightwardTopToBottom';
3709
+ } else {
3710
+ packer.width = this.size.innerWidth + this.gutter;
3711
+ packer.height = Number.POSITIVE_INFINITY;
3712
+ packer.sortDirection = 'downwardLeftToRight';
3713
+ }
3714
+
3715
+ packer.reset();
3716
+
3717
+ // layout
3718
+ this.maxY = 0;
3719
+ this.maxX = 0;
3720
+ };
3721
+
3722
+ /**
3723
+ * update columnWidth, rowHeight, & gutter
3724
+ * @private
3725
+ */
3726
+ Packery.prototype._getMeasurements = function() {
3727
+ this._getMeasurement( 'columnWidth', 'width' );
3728
+ this._getMeasurement( 'rowHeight', 'height' );
3729
+ this._getMeasurement( 'gutter', 'width' );
3730
+ };
3731
+
3732
+ Packery.prototype._getItemLayoutPosition = function( item ) {
3733
+ this._packItem( item );
3734
+ return item.rect;
3735
+ };
3736
+
3737
+
3738
+ /**
3739
+ * layout item in packer
3740
+ * @param {Packery.Item} item
3741
+ */
3742
+ Packery.prototype._packItem = function( item ) {
3743
+ this._setRectSize( item.element, item.rect );
3744
+ // pack the rect in the packer
3745
+ this.packer.pack( item.rect );
3746
+ this._setMaxXY( item.rect );
3747
+ };
3748
+
3749
+ /**
3750
+ * set max X and Y value, for size of container
3751
+ * @param {Packery.Rect} rect
3752
+ * @private
3753
+ */
3754
+ Packery.prototype._setMaxXY = function( rect ) {
3755
+ this.maxX = Math.max( rect.x + rect.width, this.maxX );
3756
+ this.maxY = Math.max( rect.y + rect.height, this.maxY );
3757
+ };
3758
+
3759
+ /**
3760
+ * set the width and height of a rect, applying columnWidth and rowHeight
3761
+ * @param {Element} elem
3762
+ * @param {Packery.Rect} rect
3763
+ */
3764
+ Packery.prototype._setRectSize = function( elem, rect ) {
3765
+ var size = getSize( elem );
3766
+ var w = size.outerWidth;
3767
+ var h = size.outerHeight;
3768
+ // size for columnWidth and rowHeight, if available
3769
+ // only check if size is non-zero, #177
3770
+ if ( w || h ) {
3771
+ w = this._applyGridGutter( w, this.columnWidth );
3772
+ h = this._applyGridGutter( h, this.rowHeight );
3773
+ }
3774
+ // rect must fit in packer
3775
+ rect.width = Math.min( w, this.packer.width );
3776
+ rect.height = Math.min( h, this.packer.height );
3777
+ };
3778
+
3779
+ /**
3780
+ * fits item to columnWidth/rowHeight and adds gutter
3781
+ * @param {Number} measurement - item width or height
3782
+ * @param {Number} gridSize - columnWidth or rowHeight
3783
+ * @returns measurement
3784
+ */
3785
+ Packery.prototype._applyGridGutter = function( measurement, gridSize ) {
3786
+ // just add gutter if no gridSize
3787
+ if ( !gridSize ) {
3788
+ return measurement + this.gutter;
3789
+ }
3790
+ gridSize += this.gutter;
3791
+ // fit item to columnWidth/rowHeight
3792
+ var remainder = measurement % gridSize;
3793
+ var mathMethod = remainder && remainder < 1 ? 'round' : 'ceil';
3794
+ measurement = Math[ mathMethod ]( measurement / gridSize ) * gridSize;
3795
+ return measurement;
3796
+ };
3797
+
3798
+ Packery.prototype._getContainerSize = function() {
3799
+ if ( this.options.isHorizontal ) {
3800
+ return {
3801
+ width: this.maxX - this.gutter
3802
+ };
3803
+ } else {
3804
+ return {
3805
+ height: this.maxY - this.gutter
3806
+ };
3807
+ }
3808
+ };
3809
+
3810
+
3811
+ // -------------------------- stamp -------------------------- //
3812
+
3813
+ /**
3814
+ * makes space for element
3815
+ * @param {Element} elem
3816
+ */
3817
+ Packery.prototype._manageStamp = function( elem ) {
3818
+
3819
+ var item = this.getItem( elem );
3820
+ var rect;
3821
+ if ( item && item.isPlacing ) {
3822
+ rect = item.placeRect;
3823
+ } else {
3824
+ var offset = this._getElementOffset( elem );
3825
+ rect = new Rect({
3826
+ x: this.options.isOriginLeft ? offset.left : offset.right,
3827
+ y: this.options.isOriginTop ? offset.top : offset.bottom
3828
+ });
3829
+ }
3830
+
3831
+ this._setRectSize( elem, rect );
3832
+ // save its space in the packer
3833
+ this.packer.placed( rect );
3834
+ this._setMaxXY( rect );
3835
+ };
3836
+
3837
+ // -------------------------- methods -------------------------- //
3838
+
3839
+ function verticalSorter( a, b ) {
3840
+ return a.position.y - b.position.y || a.position.x - b.position.x;
3841
+ }
3842
+
3843
+ function horizontalSorter( a, b ) {
3844
+ return a.position.x - b.position.x || a.position.y - b.position.y;
3845
+ }
3846
+
3847
+ Packery.prototype.sortItemsByPosition = function() {
3848
+ var sorter = this.options.isHorizontal ? horizontalSorter : verticalSorter;
3849
+ this.items.sort( sorter );
3850
+ };
3851
+
3852
+ /**
3853
+ * Fit item element in its current position
3854
+ * Packery will position elements around it
3855
+ * useful for expanding elements
3856
+ *
3857
+ * @param {Element} elem
3858
+ * @param {Number} x - horizontal destination position, optional
3859
+ * @param {Number} y - vertical destination position, optional
3860
+ */
3861
+ Packery.prototype.fit = function( elem, x, y ) {
3862
+ var item = this.getItem( elem );
3863
+ if ( !item ) {
3864
+ return;
3865
+ }
3866
+
3867
+ // prepare internal properties
3868
+ this._getMeasurements();
3869
+
3870
+ // stamp item to get it out of layout
3871
+ this.stamp( item.element );
3872
+ // required for positionPlaceRect
3873
+ item.getSize();
3874
+ // set placing flag
3875
+ item.isPlacing = true;
3876
+ // fall back to current position for fitting
3877
+ x = x === undefined ? item.rect.x: x;
3878
+ y = y === undefined ? item.rect.y: y;
3879
+
3880
+ // position it best at its destination
3881
+ item.positionPlaceRect( x, y, true );
3882
+
3883
+ this._bindFitEvents( item );
3884
+ item.moveTo( item.placeRect.x, item.placeRect.y );
3885
+ // layout everything else
3886
+ this.layout();
3887
+
3888
+ // return back to regularly scheduled programming
3889
+ this.unstamp( item.element );
3890
+ this.sortItemsByPosition();
3891
+ // un set placing flag, back to normal
3892
+ item.isPlacing = false;
3893
+ // copy place rect position
3894
+ item.copyPlaceRectPosition();
3895
+ };
3896
+
3897
+ /**
3898
+ * emit event when item is fit and other items are laid out
3899
+ * @param {Packery.Item} item
3900
+ * @private
3901
+ */
3902
+ Packery.prototype._bindFitEvents = function( item ) {
3903
+ var _this = this;
3904
+ var ticks = 0;
3905
+ function tick() {
3906
+ ticks++;
3907
+ if ( ticks != 2 ) {
3908
+ return;
3909
+ }
3910
+ _this.dispatchEvent( 'fitComplete', null, [ item ] );
3911
+ }
3912
+ // when item is laid out
3913
+ item.on( 'layout', function() {
3914
+ tick();
3915
+ return true;
3916
+ });
3917
+ // when all items are laid out
3918
+ this.on( 'layoutComplete', function() {
3919
+ tick();
3920
+ return true;
3921
+ });
3922
+ };
3923
+
3924
+ // -------------------------- resize -------------------------- //
3925
+
3926
+ // debounced, layout on resize
3927
+ Packery.prototype.resize = function() {
3928
+ // don't trigger if size did not change
3929
+ var size = getSize( this.element );
3930
+ // check that this.size and size are there
3931
+ // IE8 triggers resize on body size change, so they might not be
3932
+ var hasSizes = this.size && size;
3933
+ var innerSize = this.options.isHorizontal ? 'innerHeight' : 'innerWidth';
3934
+ if ( hasSizes && size[ innerSize ] == this.size[ innerSize ] ) {
3935
+ return;
3936
+ }
3937
+
3938
+ this.layout();
3939
+ };
3940
+
3941
+ // -------------------------- drag -------------------------- //
3942
+
3943
+ /**
3944
+ * handle an item drag start event
3945
+ * @param {Element} elem
3946
+ */
3947
+ Packery.prototype.itemDragStart = function( elem ) {
3948
+ this.stamp( elem );
3949
+ var item = this.getItem( elem );
3950
+ if ( item ) {
3951
+ item.dragStart();
3952
+ }
3953
+ };
3954
+
3955
+ /**
3956
+ * handle an item drag move event
3957
+ * @param {Element} elem
3958
+ * @param {Number} x - horizontal change in position
3959
+ * @param {Number} y - vertical change in position
3960
+ */
3961
+ Packery.prototype.itemDragMove = function( elem, x, y ) {
3962
+ var item = this.getItem( elem );
3963
+ if ( item ) {
3964
+ item.dragMove( x, y );
3965
+ }
3966
+
3967
+ // debounce
3968
+ var _this = this;
3969
+ // debounce triggering layout
3970
+ function delayed() {
3971
+ _this.layout();
3972
+ delete _this.dragTimeout;
3973
+ }
3974
+
3975
+ this.clearDragTimeout();
3976
+
3977
+ this.dragTimeout = setTimeout( delayed, 40 );
3978
+ };
3979
+
3980
+ Packery.prototype.clearDragTimeout = function() {
3981
+ if ( this.dragTimeout ) {
3982
+ clearTimeout( this.dragTimeout );
3983
+ }
3984
+ };
3985
+
3986
+ /**
3987
+ * handle an item drag end event
3988
+ * @param {Element} elem
3989
+ */
3990
+ Packery.prototype.itemDragEnd = function( elem ) {
3991
+ var item = this.getItem( elem );
3992
+ var itemDidDrag;
3993
+ if ( item ) {
3994
+ itemDidDrag = item.didDrag;
3995
+ item.dragStop();
3996
+ }
3997
+ // if elem didn't move, or if it doesn't need positioning
3998
+ // unignore and unstamp and call it a day
3999
+ if ( !item || ( !itemDidDrag && !item.needsPositioning ) ) {
4000
+ this.unstamp( elem );
4001
+ return;
4002
+ }
4003
+ // procced with dragged item
4004
+
4005
+ classie.add( item.element, 'is-positioning-post-drag' );
4006
+
4007
+ // save this var, as it could get reset in dragStart
4008
+ var onLayoutComplete = this._getDragEndLayoutComplete( elem, item );
4009
+
4010
+ if ( item.needsPositioning ) {
4011
+ item.on( 'layout', onLayoutComplete );
4012
+ item.moveTo( item.placeRect.x, item.placeRect.y );
4013
+ } else if ( item ) {
4014
+ // item didn't need placement
4015
+ item.copyPlaceRectPosition();
4016
+ }
4017
+
4018
+ this.clearDragTimeout();
4019
+ this.on( 'layoutComplete', onLayoutComplete );
4020
+ this.layout();
4021
+
4022
+ };
4023
+
4024
+ /**
4025
+ * get drag end callback
4026
+ * @param {Element} elem
4027
+ * @param {Packery.Item} item
4028
+ * @returns {Function} onLayoutComplete
4029
+ */
4030
+ Packery.prototype._getDragEndLayoutComplete = function( elem, item ) {
4031
+ var itemNeedsPositioning = item && item.needsPositioning;
4032
+ var completeCount = 0;
4033
+ var asyncCount = itemNeedsPositioning ? 2 : 1;
4034
+ var _this = this;
4035
+
4036
+ return function onLayoutComplete() {
4037
+ completeCount++;
4038
+ // don't proceed if not complete
4039
+ if ( completeCount != asyncCount ) {
4040
+ return true;
4041
+ }
4042
+ // reset item
4043
+ if ( item ) {
4044
+ classie.remove( item.element, 'is-positioning-post-drag' );
4045
+ item.isPlacing = false;
4046
+ item.copyPlaceRectPosition();
4047
+ }
4048
+
4049
+ _this.unstamp( elem );
4050
+ // only sort when item moved
4051
+ _this.sortItemsByPosition();
4052
+
4053
+ // emit item drag event now that everything is done
4054
+ if ( itemNeedsPositioning ) {
4055
+ _this.dispatchEvent( 'dragItemPositioned', null, [ item ] );
4056
+ }
4057
+ // listen once
4058
+ return true;
4059
+ };
4060
+ };
4061
+
4062
+ /**
4063
+ * binds Draggabilly events
4064
+ * @param {Draggabilly} draggie
4065
+ */
4066
+ Packery.prototype.bindDraggabillyEvents = function( draggie ) {
4067
+ draggie.on( 'dragStart', this.handleDraggabilly.dragStart );
4068
+ draggie.on( 'dragMove', this.handleDraggabilly.dragMove );
4069
+ draggie.on( 'dragEnd', this.handleDraggabilly.dragEnd );
4070
+ };
4071
+
4072
+ /**
4073
+ * binds jQuery UI Draggable events
4074
+ * @param {jQuery} $elems
4075
+ */
4076
+ Packery.prototype.bindUIDraggableEvents = function( $elems ) {
4077
+ $elems
4078
+ .on( 'dragstart', this.handleUIDraggable.start )
4079
+ .on( 'drag', this.handleUIDraggable.drag )
4080
+ .on( 'dragstop', this.handleUIDraggable.stop );
4081
+ };
4082
+
4083
+ Packery.Rect = Rect;
4084
+ Packery.Packer = Packer;
4085
+
4086
+ return Packery;
4087
+
4088
+ }));
4089
+
widgets/so-simple-masonry-widget/js/packery.pkgd.min.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ !function(t){function e(){}function i(t){function i(e){e.prototype.option||(e.prototype.option=function(e){t.isPlainObject(e)&&(this.options=t.extend(!0,this.options,e))})}function o(e,i){t.fn[e]=function(o){if("string"==typeof o){for(var s=n.call(arguments,1),a=0,h=this.length;h>a;a++){var p=this[a],u=t.data(p,e);if(u)if(t.isFunction(u[o])&&"_"!==o.charAt(0)){var c=u[o].apply(u,s);if(void 0!==c)return c}else r("no such method '"+o+"' for "+e+" instance");else r("cannot call methods on "+e+" prior to initialization; attempted to call '"+o+"'")}return this}return this.each(function(){var n=t.data(this,e);n?(n.option(o),n._init()):(n=new i(this,o),t.data(this,e,n))})}}if(t){var r="undefined"==typeof console?e:function(t){console.error(t)};return t.bridget=function(t,e){i(e),o(t,e)},t.bridget}}var n=Array.prototype.slice;"function"==typeof define&&define.amd?define("jquery-bridget/jquery.bridget",["jquery"],i):i("object"==typeof exports?require("jquery"):t.jQuery)}(window),function(t){function e(t){return new RegExp("(^|\\s+)"+t+"(\\s+|$)")}function i(t,e){var i=n(t,e)?r:o;i(t,e)}var n,o,r;"classList"in document.documentElement?(n=function(t,e){return t.classList.contains(e)},o=function(t,e){t.classList.add(e)},r=function(t,e){t.classList.remove(e)}):(n=function(t,i){return e(i).test(t.className)},o=function(t,e){n(t,e)||(t.className=t.className+" "+e)},r=function(t,i){t.className=t.className.replace(e(i)," ")});var s={hasClass:n,addClass:o,removeClass:r,toggleClass:i,has:n,add:o,remove:r,toggle:i};"function"==typeof define&&define.amd?define("classie/classie",s):"object"==typeof exports?module.exports=s:t.classie=s}(window),function(t){function e(t){if(t){if("string"==typeof n[t])return t;t=t.charAt(0).toUpperCase()+t.slice(1);for(var e,o=0,r=i.length;r>o;o++)if(e=i[o]+t,"string"==typeof n[e])return e}}var i="Webkit Moz ms Ms O".split(" "),n=document.documentElement.style;"function"==typeof define&&define.amd?define("get-style-property/get-style-property",[],function(){return e}):"object"==typeof exports?module.exports=e:t.getStyleProperty=e}(window),function(t,e){function i(t){var e=parseFloat(t),i=-1===t.indexOf("%")&&!isNaN(e);return i&&e}function n(){}function o(){for(var t={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},e=0,i=a.length;i>e;e++){var n=a[e];t[n]=0}return t}function r(e){function n(){if(!d){d=!0;var n=t.getComputedStyle;if(p=function(){var t=n?function(t){return n(t,null)}:function(t){return t.currentStyle};return function(e){var i=t(e);return i||s("Style returned "+i+". Are you running this code in a hidden iframe on Firefox? See http://bit.ly/getsizebug1"),i}}(),u=e("boxSizing")){var o=document.createElement("div");o.style.width="200px",o.style.padding="1px 2px 3px 4px",o.style.borderStyle="solid",o.style.borderWidth="1px 2px 3px 4px",o.style[u]="border-box";var r=document.body||document.documentElement;r.appendChild(o);var a=p(o);c=200===i(a.width),r.removeChild(o)}}}function r(t){if(n(),"string"==typeof t&&(t=document.querySelector(t)),t&&"object"==typeof t&&t.nodeType){var e=p(t);if("none"===e.display)return o();var r={};r.width=t.offsetWidth,r.height=t.offsetHeight;for(var s=r.isBorderBox=!(!u||!e[u]||"border-box"!==e[u]),d=0,l=a.length;l>d;d++){var f=a[d],y=e[f];y=h(t,y);var m=parseFloat(y);r[f]=isNaN(m)?0:m}var g=r.paddingLeft+r.paddingRight,v=r.paddingTop+r.paddingBottom,x=r.marginLeft+r.marginRight,E=r.marginTop+r.marginBottom,b=r.borderLeftWidth+r.borderRightWidth,w=r.borderTopWidth+r.borderBottomWidth,_=s&&c,T=i(e.width);T!==!1&&(r.width=T+(_?0:g+b));var z=i(e.height);return z!==!1&&(r.height=z+(_?0:v+w)),r.innerWidth=r.width-(g+b),r.innerHeight=r.height-(v+w),r.outerWidth=r.width+x,r.outerHeight=r.height+E,r}}function h(e,i){if(t.getComputedStyle||-1===i.indexOf("%"))return i;var n=e.style,o=n.left,r=e.runtimeStyle,s=r&&r.left;return s&&(r.left=e.currentStyle.left),n.left=i,i=n.pixelLeft,n.left=o,s&&(r.left=s),i}var p,u,c,d=!1;return r}var s="undefined"==typeof console?n:function(t){console.error(t)},a=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"];"function"==typeof define&&define.amd?define("get-size/get-size",["get-style-property/get-style-property"],r):"object"==typeof exports?module.exports=r(require("desandro-get-style-property")):t.getSize=r(t.getStyleProperty)}(window),function(t){function e(e){var i=t.event;return i.target=i.target||i.srcElement||e,i}var i=document.documentElement,n=function(){};i.addEventListener?n=function(t,e,i){t.addEventListener(e,i,!1)}:i.attachEvent&&(n=function(t,i,n){t[i+n]=n.handleEvent?function(){var i=e(t);n.handleEvent.call(n,i)}:function(){var i=e(t);n.call(t,i)},t.attachEvent("on"+i,t[i+n])});var o=function(){};i.removeEventListener?o=function(t,e,i){t.removeEventListener(e,i,!1)}:i.detachEvent&&(o=function(t,e,i){t.detachEvent("on"+e,t[e+i]);try{delete t[e+i]}catch(n){t[e+i]=void 0}});var r={bind:n,unbind:o};"function"==typeof define&&define.amd?define("eventie/eventie",r):"object"==typeof exports?module.exports=r:t.eventie=r}(window),function(){function t(){}function e(t,e){for(var i=t.length;i--;)if(t[i].listener===e)return i;return-1}function i(t){return function(){return this[t].apply(this,arguments)}}var n=t.prototype,o=this,r=o.EventEmitter;n.getListeners=function(t){var e,i,n=this._getEvents();if(t instanceof RegExp){e={};for(i in n)n.hasOwnProperty(i)&&t.test(i)&&(e[i]=n[i])}else e=n[t]||(n[t]=[]);return e},n.flattenListeners=function(t){var e,i=[];for(e=0;e<t.length;e+=1)i.push(t[e].listener);return i},n.getListenersAsObject=function(t){var e,i=this.getListeners(t);return i instanceof Array&&(e={},e[t]=i),e||i},n.addListener=function(t,i){var n,o=this.getListenersAsObject(t),r="object"==typeof i;for(n in o)o.hasOwnProperty(n)&&-1===e(o[n],i)&&o[n].push(r?i:{listener:i,once:!1});return this},n.on=i("addListener"),n.addOnceListener=function(t,e){return this.addListener(t,{listener:e,once:!0})},n.once=i("addOnceListener"),n.defineEvent=function(t){return this.getListeners(t),this},n.defineEvents=function(t){for(var e=0;e<t.length;e+=1)this.defineEvent(t[e]);return this},n.removeListener=function(t,i){var n,o,r=this.getListenersAsObject(t);for(o in r)r.hasOwnProperty(o)&&(n=e(r[o],i),-1!==n&&r[o].splice(n,1));return this},n.off=i("removeListener"),n.addListeners=function(t,e){return this.manipulateListeners(!1,t,e)},n.removeListeners=function(t,e){return this.manipulateListeners(!0,t,e)},n.manipulateListeners=function(t,e,i){var n,o,r=t?this.removeListener:this.addListener,s=t?this.removeListeners:this.addListeners;if("object"!=typeof e||e instanceof RegExp)for(n=i.length;n--;)r.call(this,e,i[n]);else for(n in e)e.hasOwnProperty(n)&&(o=e[n])&&("function"==typeof o?r.call(this,n,o):s.call(this,n,o));return this},n.removeEvent=function(t){var e,i=typeof t,n=this._getEvents();if("string"===i)delete n[t];else if(t instanceof RegExp)for(e in n)n.hasOwnProperty(e)&&t.test(e)&&delete n[e];else delete this._events;return this},n.removeAllListeners=i("removeEvent"),n.emitEvent=function(t,e){var i,n,o,r,s=this.getListenersAsObject(t);for(o in s)if(s.hasOwnProperty(o))for(n=s[o].length;n--;)i=s[o][n],i.once===!0&&this.removeListener(t,i.listener),r=i.listener.apply(this,e||[]),r===this._getOnceReturnValue()&&this.removeListener(t,i.listener);return this},n.trigger=i("emitEvent"),n.emit=function(t){var e=Array.prototype.slice.call(arguments,1);return this.emitEvent(t,e)},n.setOnceReturnValue=function(t){return this._onceReturnValue=t,this},n._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},n._getEvents=function(){return this._events||(this._events={})},t.noConflict=function(){return o.EventEmitter=r,t},"function"==typeof define&&define.amd?define("eventEmitter/EventEmitter",[],function(){return t}):"object"==typeof module&&module.exports?module.exports=t:o.EventEmitter=t}.call(this),function(t){function e(t){"function"==typeof t&&(e.isReady?t():s.push(t))}function i(t){var i="readystatechange"===t.type&&"complete"!==r.readyState;e.isReady||i||n()}function n(){e.isReady=!0;for(var t=0,i=s.length;i>t;t++){var n=s[t];n()}}function o(o){return"complete"===r.readyState?n():(o.bind(r,"DOMContentLoaded",i),o.bind(r,"readystatechange",i),o.bind(t,"load",i)),e}var r=t.document,s=[];e.isReady=!1,"function"==typeof define&&define.amd?define("doc-ready/doc-ready",["eventie/eventie"],o):"object"==typeof exports?module.exports=o(require("eventie")):t.docReady=o(t.eventie)}(window),function(t){function e(t,e){return t[s](e)}function i(t){if(!t.parentNode){var e=document.createDocumentFragment();e.appendChild(t)}}function n(t,e){i(t);for(var n=t.parentNode.querySelectorAll(e),o=0,r=n.length;r>o;o++)if(n[o]===t)return!0;return!1}function o(t,n){return i(t),e(t,n)}var r,s=function(){if(t.matches)return"matches";if(t.matchesSelector)return"matchesSelector";for(var e=["webkit","moz","ms","o"],i=0,n=e.length;n>i;i++){var o=e[i],r=o+"MatchesSelector";if(t[r])return r}}();if(s){var a=document.createElement("div"),h=e(a,"div");r=h?e:o}else r=n;"function"==typeof define&&define.amd?define("matches-selector/matches-selector",[],function(){return r}):"object"==typeof exports?module.exports=r:window.matchesSelector=r}(Element.prototype),function(t,e){"function"==typeof define&&define.amd?define("fizzy-ui-utils/utils",["doc-ready/doc-ready","matches-selector/matches-selector"],function(i,n){return e(t,i,n)}):"object"==typeof exports?module.exports=e(t,require("doc-ready"),require("desandro-matches-selector")):t.fizzyUIUtils=e(t,t.docReady,t.matchesSelector)}(window,function(t,e,i){var n={};n.extend=function(t,e){for(var i in e)t[i]=e[i];return t},n.modulo=function(t,e){return(t%e+e)%e};var o=Object.prototype.toString;n.isArray=function(t){return"[object Array]"==o.call(t)},n.makeArray=function(t){var e=[];if(n.isArray(t))e=t;else if(t&&"number"==typeof t.length)for(var i=0,o=t.length;o>i;i++)e.push(t[i]);else e.push(t);return e},n.indexOf=Array.prototype.indexOf?function(t,e){return t.indexOf(e)}:function(t,e){for(var i=0,n=t.length;n>i;i++)if(t[i]===e)return i;return-1},n.removeFrom=function(t,e){var i=n.indexOf(t,e);-1!=i&&t.splice(i,1)},n.isElement="function"==typeof HTMLElement||"object"==typeof HTMLElement?function(t){return t instanceof HTMLElement}:function(t){return t&&"object"==typeof t&&1==t.nodeType&&"string"==typeof t.nodeName},n.setText=function(){function t(t,i){e=e||(void 0!==document.documentElement.textContent?"textContent":"innerText"),t[e]=i}var e;return t}(),n.getParent=function(t,e){for(;t!=document.body;)if(t=t.parentNode,i(t,e))return t},n.getQueryElement=function(t){return"string"==typeof t?document.querySelector(t):t},n.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},n.filterFindElements=function(t,e){t=n.makeArray(t);for(var o=[],r=0,s=t.length;s>r;r++){var a=t[r];if(n.isElement(a))if(e){i(a,e)&&o.push(a);for(var h=a.querySelectorAll(e),p=0,u=h.length;u>p;p++)o.push(h[p])}else o.push(a)}return o},n.debounceMethod=function(t,e,i){var n=t.prototype[e],o=e+"Timeout";t.prototype[e]=function(){var t=this[o];t&&clearTimeout(t);var e=arguments,r=this;this[o]=setTimeout(function(){n.apply(r,e),delete r[o]},i||100)}},n.toDashed=function(t){return t.replace(/(.)([A-Z])/g,function(t,e,i){return e+"-"+i}).toLowerCase()};var r=t.console;return n.htmlInit=function(i,o){e(function(){for(var e=n.toDashed(o),s=document.querySelectorAll(".js-"+e),a="data-"+e+"-options",h=0,p=s.length;p>h;h++){var u,c=s[h],d=c.getAttribute(a);try{u=d&&JSON.parse(d)}catch(l){r&&r.error("Error parsing "+a+" on "+c.nodeName.toLowerCase()+(c.id?"#"+c.id:"")+": "+l);continue}var f=new i(c,u),y=t.jQuery;y&&y.data(c,o,f)}})},n}),function(t,e){"function"==typeof define&&define.amd?define("outlayer/item",["eventEmitter/EventEmitter","get-size/get-size","get-style-property/get-style-property","fizzy-ui-utils/utils"],function(i,n,o,r){return e(t,i,n,o,r)}):"object"==typeof exports?module.exports=e(t,require("wolfy87-eventemitter"),require("get-size"),require("desandro-get-style-property"),require("fizzy-ui-utils")):(t.Outlayer={},t.Outlayer.Item=e(t,t.EventEmitter,t.getSize,t.getStyleProperty,t.fizzyUIUtils))}(window,function(t,e,i,n,o){function r(t){for(var e in t)return!1;return e=null,!0}function s(t,e){t&&(this.element=t,this.layout=e,this.position={x:0,y:0},this._create())}function a(t){return t.replace(/([A-Z])/g,function(t){return"-"+t.toLowerCase()})}var h=t.getComputedStyle,p=h?function(t){return h(t,null)}:function(t){return t.currentStyle},u=n("transition"),c=n("transform"),d=u&&c,l=!!n("perspective"),f={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"otransitionend",transition:"transitionend"}[u],y=["transform","transition","transitionDuration","transitionProperty"],m=function(){for(var t={},e=0,i=y.length;i>e;e++){var o=y[e],r=n(o);r&&r!==o&&(t[o]=r)}return t}();o.extend(s.prototype,e.prototype),s.prototype._create=function(){this._transn={ingProperties:{},clean:{},onEnd:{}},this.css({position:"absolute"})},s.prototype.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},s.prototype.getSize=function(){this.size=i(this.element)},s.prototype.css=function(t){var e=this.element.style;for(var i in t){var n=m[i]||i;e[n]=t[i]}},s.prototype.getPosition=function(){var t=p(this.element),e=this.layout.options,i=e.isOriginLeft,n=e.isOriginTop,o=t[i?"left":"right"],r=t[n?"top":"bottom"],s=this.layout.size,a=-1!=o.indexOf("%")?parseFloat(o)/100*s.width:parseInt(o,10),h=-1!=r.indexOf("%")?parseFloat(r)/100*s.height:parseInt(r,10);a=isNaN(a)?0:a,h=isNaN(h)?0:h,a-=i?s.paddingLeft:s.paddingRight,h-=n?s.paddingTop:s.paddingBottom,this.position.x=a,this.position.y=h},s.prototype.layoutPosition=function(){var t=this.layout.size,e=this.layout.options,i={},n=e.isOriginLeft?"paddingLeft":"paddingRight",o=e.isOriginLeft?"left":"right",r=e.isOriginLeft?"right":"left",s=this.position.x+t[n];i[o]=this.getXValue(s),i[r]="";var a=e.isOriginTop?"paddingTop":"paddingBottom",h=e.isOriginTop?"top":"bottom",p=e.isOriginTop?"bottom":"top",u=this.position.y+t[a];i[h]=this.getYValue(u),i[p]="",this.css(i),this.emitEvent("layout",[this])},s.prototype.getXValue=function(t){var e=this.layout.options;return e.percentPosition&&!e.isHorizontal?t/this.layout.size.width*100+"%":t+"px"},s.prototype.getYValue=function(t){var e=this.layout.options;return e.percentPosition&&e.isHorizontal?t/this.layout.size.height*100+"%":t+"px"},s.prototype._transitionTo=function(t,e){this.getPosition();var i=this.position.x,n=this.position.y,o=parseInt(t,10),r=parseInt(e,10),s=o===this.position.x&&r===this.position.y;if(this.setPosition(t,e),s&&!this.isTransitioning)return void this.layoutPosition();var a=t-i,h=e-n,p={};p.transform=this.getTranslate(a,h),this.transition({to:p,onTransitionEnd:{transform:this.layoutPosition},isCleaning:!0})},s.prototype.getTranslate=function(t,e){var i=this.layout.options;return t=i.isOriginLeft?t:-t,e=i.isOriginTop?e:-e,l?"translate3d("+t+"px, "+e+"px, 0)":"translate("+t+"px, "+e+"px)"},s.prototype.goTo=function(t,e){this.setPosition(t,e),this.layoutPosition()},s.prototype.moveTo=d?s.prototype._transitionTo:s.prototype.goTo,s.prototype.setPosition=function(t,e){this.position.x=parseInt(t,10),this.position.y=parseInt(e,10)},s.prototype._nonTransition=function(t){this.css(t.to),t.isCleaning&&this._removeStyles(t.to);for(var e in t.onTransitionEnd)t.onTransitionEnd[e].call(this)},s.prototype._transition=function(t){if(!parseFloat(this.layout.options.transitionDuration))return void this._nonTransition(t);var e=this._transn;for(var i in t.onTransitionEnd)e.onEnd[i]=t.onTransitionEnd[i];for(i in t.to)e.ingProperties[i]=!0,t.isCleaning&&(e.clean[i]=!0);if(t.from){this.css(t.from);var n=this.element.offsetHeight;n=null}this.enableTransition(t.to),this.css(t.to),this.isTransitioning=!0};var g="opacity,"+a(m.transform||"transform");s.prototype.enableTransition=function(){this.isTransitioning||(this.css({transitionProperty:g,transitionDuration:this.layout.options.transitionDuration}),this.element.addEventListener(f,this,!1))},s.prototype.transition=s.prototype[u?"_transition":"_nonTransition"],s.prototype.onwebkitTransitionEnd=function(t){this.ontransitionend(t)},s.prototype.onotransitionend=function(t){this.ontransitionend(t)};var v={"-webkit-transform":"transform","-moz-transform":"transform","-o-transform":"transform"};s.prototype.ontransitionend=function(t){if(t.target===this.element){var e=this._transn,i=v[t.propertyName]||t.propertyName;if(delete e.ingProperties[i],r(e.ingProperties)&&this.disableTransition(),i in e.clean&&(this.element.style[t.propertyName]="",delete e.clean[i]),i in e.onEnd){var n=e.onEnd[i];n.call(this),delete e.onEnd[i]}this.emitEvent("transitionEnd",[this])}},s.prototype.disableTransition=function(){this.removeTransitionStyles(),this.element.removeEventListener(f,this,!1),this.isTransitioning=!1},s.prototype._removeStyles=function(t){var e={};for(var i in t)e[i]="";this.css(e)};var x={transitionProperty:"",transitionDuration:""};return s.prototype.removeTransitionStyles=function(){this.css(x)},s.prototype.removeElem=function(){this.element.parentNode.removeChild(this.element),this.css({display:""}),this.emitEvent("remove",[this])},s.prototype.remove=function(){if(!u||!parseFloat(this.layout.options.transitionDuration))return void this.removeElem();var t=this;this.once("transitionEnd",function(){t.removeElem()}),this.hide()},s.prototype.reveal=function(){delete this.isHidden,this.css({display:""});var t=this.layout.options,e={},i=this.getHideRevealTransitionEndProperty("visibleStyle");e[i]=this.onRevealTransitionEnd,this.transition({from:t.hiddenStyle,to:t.visibleStyle,isCleaning:!0,onTransitionEnd:e})},s.prototype.onRevealTransitionEnd=function(){this.isHidden||this.emitEvent("reveal")},s.prototype.getHideRevealTransitionEndProperty=function(t){var e=this.layout.options[t];if(e.opacity)return"opacity";for(var i in e)return i},s.prototype.hide=function(){this.isHidden=!0,this.css({display:""});var t=this.layout.options,e={},i=this.getHideRevealTransitionEndProperty("hiddenStyle");e[i]=this.onHideTransitionEnd,this.transition({from:t.visibleStyle,to:t.hiddenStyle,isCleaning:!0,onTransitionEnd:e})},s.prototype.onHideTransitionEnd=function(){this.isHidden&&(this.css({display:"none"}),this.emitEvent("hide"))},s.prototype.destroy=function(){this.css({position:"",left:"",right:"",top:"",bottom:"",transition:"",transform:""})},s}),function(t,e){"function"==typeof define&&define.amd?define("outlayer/outlayer",["eventie/eventie","eventEmitter/EventEmitter","get-size/get-size","fizzy-ui-utils/utils","./item"],function(i,n,o,r,s){return e(t,i,n,o,r,s)}):"object"==typeof exports?module.exports=e(t,require("eventie"),require("wolfy87-eventemitter"),require("get-size"),require("fizzy-ui-utils"),require("./item")):t.Outlayer=e(t,t.eventie,t.EventEmitter,t.getSize,t.fizzyUIUtils,t.Outlayer.Item)}(window,function(t,e,i,n,o,r){function s(t,e){var i=o.getQueryElement(t);if(!i)return void(a&&a.error("Bad element for "+this.constructor.namespace+": "+(i||t)));this.element=i,h&&(this.$element=h(this.element)),this.options=o.extend({},this.constructor.defaults),this.option(e);var n=++u;this.element.outlayerGUID=n,c[n]=this,this._create(),this.options.isInitLayout&&this.layout()}var a=t.console,h=t.jQuery,p=function(){},u=0,c={};return s.namespace="outlayer",s.Item=r,s.defaults={containerStyle:{position:"relative"},isInitLayout:!0,isOriginLeft:!0,isOriginTop:!0,isResizeBound:!0,isResizingContainer:!0,transitionDuration:"0.4s",hiddenStyle:{opacity:0,transform:"scale(0.001)"},visibleStyle:{opacity:1,transform:"scale(1)"}},o.extend(s.prototype,i.prototype),s.prototype.option=function(t){o.extend(this.options,t)},s.prototype._create=function(){this.reloadItems(),this.stamps=[],this.stamp(this.options.stamp),o.extend(this.element.style,this.options.containerStyle),this.options.isResizeBound&&this.bindResize()},s.prototype.reloadItems=function(){this.items=this._itemize(this.element.children)},s.prototype._itemize=function(t){for(var e=this._filterFindItemElements(t),i=this.constructor.Item,n=[],o=0,r=e.length;r>o;o++){var s=e[o],a=new i(s,this);n.push(a)}return n},s.prototype._filterFindItemElements=function(t){return o.filterFindElements(t,this.options.itemSelector)},s.prototype.getItemElements=function(){for(var t=[],e=0,i=this.items.length;i>e;e++)t.push(this.items[e].element);return t},s.prototype.layout=function(){this._resetLayout(),this._manageStamps();var t=void 0!==this.options.isLayoutInstant?this.options.isLayoutInstant:!this._isLayoutInited;this.layoutItems(this.items,t),this._isLayoutInited=!0},s.prototype._init=s.prototype.layout,s.prototype._resetLayout=function(){this.getSize()},s.prototype.getSize=function(){this.size=n(this.element)},s.prototype._getMeasurement=function(t,e){var i,r=this.options[t];r?("string"==typeof r?i=this.element.querySelector(r):o.isElement(r)&&(i=r),this[t]=i?n(i)[e]:r):this[t]=0},s.prototype.layoutItems=function(t,e){t=this._getItemsForLayout(t),this._layoutItems(t,e),this._postLayout()},s.prototype._getItemsForLayout=function(t){for(var e=[],i=0,n=t.length;n>i;i++){var o=t[i];o.isIgnored||e.push(o)}return e},s.prototype._layoutItems=function(t,e){if(this._emitCompleteOnItems("layout",t),t&&t.length){for(var i=[],n=0,o=t.length;o>n;n++){var r=t[n],s=this._getItemLayoutPosition(r);s.item=r,s.isInstant=e||r.isLayoutInstant,i.push(s)}this._processLayoutQueue(i)}},s.prototype._getItemLayoutPosition=function(){return{x:0,y:0}},s.prototype._processLayoutQueue=function(t){for(var e=0,i=t.length;i>e;e++){var n=t[e];this._positionItem(n.item,n.x,n.y,n.isInstant)}},s.prototype._positionItem=function(t,e,i,n){n?t.goTo(e,i):t.moveTo(e,i)},s.prototype._postLayout=function(){this.resizeContainer()},s.prototype.resizeContainer=function(){if(this.options.isResizingContainer){var t=this._getContainerSize();t&&(this._setContainerMeasure(t.width,!0),this._setContainerMeasure(t.height,!1))}},s.prototype._getContainerSize=p,s.prototype._setContainerMeasure=function(t,e){if(void 0!==t){var i=this.size;i.isBorderBox&&(t+=e?i.paddingLeft+i.paddingRight+i.borderLeftWidth+i.borderRightWidth:i.paddingBottom+i.paddingTop+i.borderTopWidth+i.borderBottomWidth),t=Math.max(t,0),this.element.style[e?"width":"height"]=t+"px"}},s.prototype._emitCompleteOnItems=function(t,e){function i(){o.dispatchEvent(t+"Complete",null,[e])}function n(){s++,s===r&&i()}var o=this,r=e.length;if(!e||!r)return void i();for(var s=0,a=0,h=e.length;h>a;a++){var p=e[a];p.once(t,n)}},s.prototype.dispatchEvent=function(t,e,i){var n=e?[e].concat(i):i;if(this.emitEvent(t,n),h)if(this.$element=this.$element||h(this.element),e){var o=h.Event(e);o.type=t,this.$element.trigger(o,i)}else this.$element.trigger(t,i)},s.prototype.ignore=function(t){var e=this.getItem(t);e&&(e.isIgnored=!0)},s.prototype.unignore=function(t){var e=this.getItem(t);e&&delete e.isIgnored},s.prototype.stamp=function(t){if(t=this._find(t)){this.stamps=this.stamps.concat(t);for(var e=0,i=t.length;i>e;e++){var n=t[e];this.ignore(n)}}},s.prototype.unstamp=function(t){if(t=this._find(t))for(var e=0,i=t.length;i>e;e++){var n=t[e];o.removeFrom(this.stamps,n),this.unignore(n)}},s.prototype._find=function(t){return t?("string"==typeof t&&(t=this.element.querySelectorAll(t)),t=o.makeArray(t)):void 0},s.prototype._manageStamps=function(){if(this.stamps&&this.stamps.length){this._getBoundingRect();for(var t=0,e=this.stamps.length;e>t;t++){var i=this.stamps[t];this._manageStamp(i)}}},s.prototype._getBoundingRect=function(){var t=this.element.getBoundingClientRect(),e=this.size;this._boundingRect={left:t.left+e.paddingLeft+e.borderLeftWidth,top:t.top+e.paddingTop+e.borderTopWidth,right:t.right-(e.paddingRight+e.borderRightWidth),bottom:t.bottom-(e.paddingBottom+e.borderBottomWidth)}},s.prototype._manageStamp=p,s.prototype._getElementOffset=function(t){var e=t.getBoundingClientRect(),i=this._boundingRect,o=n(t),r={left:e.left-i.left-o.marginLeft,top:e.top-i.top-o.marginTop,right:i.right-e.right-o.marginRight,bottom:i.bottom-e.bottom-o.marginBottom};return r},s.prototype.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},s.prototype.bindResize=function(){this.isResizeBound||(e.bind(t,"resize",this),this.isResizeBound=!0)},s.prototype.unbindResize=function(){this.isResizeBound&&e.unbind(t,"resize",this),this.isResizeBound=!1},s.prototype.onresize=function(){function t(){e.resize(),delete e.resizeTimeout}this.resizeTimeout&&clearTimeout(this.resizeTimeout);var e=this;this.resizeTimeout=setTimeout(t,100)},s.prototype.resize=function(){this.isResizeBound&&this.needsResizeLayout()&&this.layout()},s.prototype.needsResizeLayout=function(){var t=n(this.element),e=this.size&&t;return e&&t.innerWidth!==this.size.innerWidth},s.prototype.addItems=function(t){var e=this._itemize(t);return e.length&&(this.items=this.items.concat(e)),e},s.prototype.appended=function(t){var e=this.addItems(t);e.length&&(this.layoutItems(e,!0),this.reveal(e))},s.prototype.prepended=function(t){var e=this._itemize(t);if(e.length){var i=this.items.slice(0);this.items=e.concat(i),this._resetLayout(),this._manageStamps(),this.layoutItems(e,!0),this.reveal(e),this.layoutItems(i)}},s.prototype.reveal=function(t){this._emitCompleteOnItems("reveal",t);for(var e=t&&t.length,i=0;e&&e>i;i++){var n=t[i];n.reveal()}},s.prototype.hide=function(t){this._emitCompleteOnItems("hide",t);for(var e=t&&t.length,i=0;e&&e>i;i++){var n=t[i];n.hide()}},s.prototype.revealItemElements=function(t){var e=this.getItems(t);this.reveal(e)},s.prototype.hideItemElements=function(t){var e=this.getItems(t);this.hide(e)},s.prototype.getItem=function(t){for(var e=0,i=this.items.length;i>e;e++){var n=this.items[e];if(n.element===t)return n}},s.prototype.getItems=function(t){t=o.makeArray(t);for(var e=[],i=0,n=t.length;n>i;i++){var r=t[i],s=this.getItem(r);s&&e.push(s)}return e},s.prototype.remove=function(t){var e=this.getItems(t);if(this._emitCompleteOnItems("remove",e),e&&e.length)for(var i=0,n=e.length;n>i;i++){var r=e[i];r.remove(),o.removeFrom(this.items,r)}},s.prototype.destroy=function(){var t=this.element.style;t.height="",t.position="",t.width="";for(var e=0,i=this.items.length;i>e;e++){var n=this.items[e];n.destroy()}this.unbindResize();var o=this.element.outlayerGUID;delete c[o],delete this.element.outlayerGUID,h&&h.removeData(this.element,this.constructor.namespace)},s.data=function(t){t=o.getQueryElement(t);var e=t&&t.outlayerGUID;return e&&c[e]},s.create=function(t,e){function i(){s.apply(this,arguments)}return Object.create?i.prototype=Object.create(s.prototype):o.extend(i.prototype,s.prototype),i.prototype.constructor=i,i.defaults=o.extend({},s.defaults),o.extend(i.defaults,e),i.prototype.settings={},i.namespace=t,i.data=s.data,i.Item=function(){r.apply(this,arguments)},i.Item.prototype=new r,o.htmlInit(i,t),h&&h.bridget&&h.bridget(t,i),i},s.Item=r,s}),function(t,e){"function"==typeof define&&define.amd?define("packery/js/rect",e):"object"==typeof exports?module.exports=e():(t.Packery=t.Packery||{},t.Packery.Rect=e())}(window,function(){function t(e){for(var i in t.defaults)this[i]=t.defaults[i];for(i in e)this[i]=e[i]}var e=window.Packery=function(){};return e.Rect=t,t.defaults={x:0,y:0,width:0,height:0},t.prototype.contains=function(t){var e=t.width||0,i=t.height||0;return this.x<=t.x&&this.y<=t.y&&this.x+this.width>=t.x+e&&this.y+this.height>=t.y+i},t.prototype.overlaps=function(t){var e=this.x+this.width,i=this.y+this.height,n=t.x+t.width,o=t.y+t.height;return this.x<n&&e>t.x&&this.y<o&&i>t.y},t.prototype.getMaximalFreeRects=function(e){if(!this.overlaps(e))return!1;var i,n=[],o=this.x+this.width,r=this.y+this.height,s=e.x+e.width,a=e.y+e.height;return this.y<e.y&&(i=new t({x:this.x,y:this.y,width:this.width,height:e.y-this.y}),n.push(i)),o>s&&(i=new t({x:s,y:this.y,width:o-s,height:this.height}),n.push(i)),r>a&&(i=new t({x:this.x,y:a,width:this.width,height:r-a}),n.push(i)),this.x<e.x&&(i=new t({x:this.x,y:this.y,width:e.x-this.x,height:this.height}),n.push(i)),n},t.prototype.canFit=function(t){return this.width>=t.width&&this.height>=t.height},t}),function(t,e){if("function"==typeof define&&define.amd)define("packery/js/packer",["./rect"],e);else if("object"==typeof exports)module.exports=e(require("./rect"));else{var i=t.Packery=t.Packery||{};i.Packer=e(i.Rect)}}(window,function(t){function e(t,e,i){this.width=t||0,this.height=e||0,this.sortDirection=i||"downwardLeftToRight",this.reset()}e.prototype.reset=function(){this.spaces=[],this.newSpaces=[];var e=new t({x:0,y:0,width:this.width,height:this.height});this.spaces.push(e),this.sorter=i[this.sortDirection]||i.downwardLeftToRight},e.prototype.pack=function(t){for(var e=0,i=this.spaces.length;i>e;e++){var n=this.spaces[e];if(n.canFit(t)){this.placeInSpace(t,n);break}}},e.prototype.placeInSpace=function(t,e){t.x=e.x,t.y=e.y,this.placed(t)},e.prototype.placed=function(t){for(var e=[],i=0,n=this.spaces.length;n>i;i++){var o=this.spaces[i],r=o.getMaximalFreeRects(t);r?e.push.apply(e,r):e.push(o)}this.spaces=e,this.mergeSortSpaces()},e.prototype.mergeSortSpaces=function(){e.mergeRects(this.spaces),this.spaces.sort(this.sorter)},e.prototype.addSpace=function(t){this.spaces.push(t),this.mergeSortSpaces()},e.mergeRects=function(t){for(var e=0,i=t.length;i>e;e++){var n=t[e];if(n){var o=t.slice(0);o.splice(e,1);for(var r=0,s=0,a=o.length;a>s;s++){var h=o[s],p=e>s?0:1;n.contains(h)&&(t.splice(s+p-r,1),r++)}}}return t};var i={downwardLeftToRight:function(t,e){return t.y-e.y||t.x-e.x},rightwardTopToBottom:function(t,e){return t.x-e.x||t.y-e.y}};return e}),function(t,e){"function"==typeof define&&define.amd?define("packery/js/item",["get-style-property/get-style-property","outlayer/outlayer","./rect"],e):"object"==typeof exports?module.exports=e(require("desandro-get-style-property"),require("outlayer"),require("./rect")):t.Packery.Item=e(t.getStyleProperty,t.Outlayer,t.Packery.Rect)}(window,function(t,e,i){var n=t("transform"),o=function(){e.Item.apply(this,arguments)};o.prototype=new e.Item;var r=o.prototype._create;return o.prototype._create=function(){r.call(this),this.rect=new i,this.placeRect=new i},o.prototype.dragStart=function(){this.getPosition(),this.removeTransitionStyles(),this.isTransitioning&&n&&(this.element.style[n]="none"),this.getSize(),this.isPlacing=!0,this.needsPositioning=!1,this.positionPlaceRect(this.position.x,this.position.y),this.isTransitioning=!1,this.didDrag=!1},o.prototype.dragMove=function(t,e){this.didDrag=!0;var i=this.layout.size;t-=i.paddingLeft,e-=i.paddingTop,this.positionPlaceRect(t,e)},o.prototype.dragStop=function(){this.getPosition();var t=this.position.x!=this.placeRect.x,e=this.position.y!=this.placeRect.y;this.needsPositioning=t||e,this.didDrag=!1},o.prototype.positionPlaceRect=function(t,e,i){this.placeRect.x=this.getPlaceRectCoord(t,!0),this.placeRect.y=this.getPlaceRectCoord(e,!1,i)},o.prototype.getPlaceRectCoord=function(t,e,i){var n=e?"Width":"Height",o=this.size["outer"+n],r=this.layout[e?"columnWidth":"rowHeight"],s=this.layout.size["inner"+n];e||(s=Math.max(s,this.layout.maxY),this.layout.rowHeight||(s-=this.layout.gutter));var a;if(r){r+=this.layout.gutter,s+=e?this.layout.gutter:0,t=Math.round(t/r);var h;h=this.layout.options.isHorizontal?e?"ceil":"floor":e?"floor":"ceil";var p=Math[h](s/r);p-=Math.ceil(o/r),a=p}else a=s-o;return t=i?t:Math.min(t,a),t*=r||1,Math.max(0,t)},o.prototype.copyPlaceRectPosition=function(){this.rect.x=this.placeRect.x,this.rect.y=this.placeRect.y},o.prototype.removeElem=function(){this.element.parentNode.removeChild(this.element),this.layout.packer.addSpace(this.rect),this.emitEvent("remove",[this])},o}),function(t,e){"function"==typeof define&&define.amd?define(["classie/classie","get-size/get-size","outlayer/outlayer","packery/js/rect","packery/js/packer","packery/js/item"],e):"object"==typeof exports?module.exports=e(require("desandro-classie"),require("get-size"),require("outlayer"),require("./rect"),require("./packer"),require("./item")):t.Packery=e(t.classie,t.getSize,t.Outlayer,t.Packery.Rect,t.Packery.Packer,t.Packery.Item);
2
+
3
+ }(window,function(t,e,i,n,o,r){function s(t,e){return t.position.y-e.position.y||t.position.x-e.position.x}function a(t,e){return t.position.x-e.position.x||t.position.y-e.position.y}n.prototype.canFit=function(t){return this.width>=t.width-1&&this.height>=t.height-1};var h=i.create("packery");return h.Item=r,h.prototype._create=function(){i.prototype._create.call(this),this.packer=new o,this.stamp(this.options.stamped);var t=this;this.handleDraggabilly={dragStart:function(){t.itemDragStart(this.element)},dragMove:function(){t.itemDragMove(this.element,this.position.x,this.position.y)},dragEnd:function(){t.itemDragEnd(this.element)}},this.handleUIDraggable={start:function(e,i){i&&t.itemDragStart(e.currentTarget)},drag:function(e,i){i&&t.itemDragMove(e.currentTarget,i.position.left,i.position.top)},stop:function(e,i){i&&t.itemDragEnd(e.currentTarget)}}},h.prototype._resetLayout=function(){this.getSize(),this._getMeasurements();var t=this.packer;this.options.isHorizontal?(t.width=Number.POSITIVE_INFINITY,t.height=this.size.innerHeight+this.gutter,t.sortDirection="rightwardTopToBottom"):(t.width=this.size.innerWidth+this.gutter,t.height=Number.POSITIVE_INFINITY,t.sortDirection="downwardLeftToRight"),t.reset(),this.maxY=0,this.maxX=0},h.prototype._getMeasurements=function(){this._getMeasurement("columnWidth","width"),this._getMeasurement("rowHeight","height"),this._getMeasurement("gutter","width")},h.prototype._getItemLayoutPosition=function(t){return this._packItem(t),t.rect},h.prototype._packItem=function(t){this._setRectSize(t.element,t.rect),this.packer.pack(t.rect),this._setMaxXY(t.rect)},h.prototype._setMaxXY=function(t){this.maxX=Math.max(t.x+t.width,this.maxX),this.maxY=Math.max(t.y+t.height,this.maxY)},h.prototype._setRectSize=function(t,i){var n=e(t),o=n.outerWidth,r=n.outerHeight;(o||r)&&(o=this._applyGridGutter(o,this.columnWidth),r=this._applyGridGutter(r,this.rowHeight)),i.width=Math.min(o,this.packer.width),i.height=Math.min(r,this.packer.height)},h.prototype._applyGridGutter=function(t,e){if(!e)return t+this.gutter;e+=this.gutter;var i=t%e,n=i&&1>i?"round":"ceil";return t=Math[n](t/e)*e},h.prototype._getContainerSize=function(){return this.options.isHorizontal?{width:this.maxX-this.gutter}:{height:this.maxY-this.gutter}},h.prototype._manageStamp=function(t){var e,i=this.getItem(t);if(i&&i.isPlacing)e=i.placeRect;else{var o=this._getElementOffset(t);e=new n({x:this.options.isOriginLeft?o.left:o.right,y:this.options.isOriginTop?o.top:o.bottom})}this._setRectSize(t,e),this.packer.placed(e),this._setMaxXY(e)},h.prototype.sortItemsByPosition=function(){var t=this.options.isHorizontal?a:s;this.items.sort(t)},h.prototype.fit=function(t,e,i){var n=this.getItem(t);n&&(this._getMeasurements(),this.stamp(n.element),n.getSize(),n.isPlacing=!0,e=void 0===e?n.rect.x:e,i=void 0===i?n.rect.y:i,n.positionPlaceRect(e,i,!0),this._bindFitEvents(n),n.moveTo(n.placeRect.x,n.placeRect.y),this.layout(),this.unstamp(n.element),this.sortItemsByPosition(),n.isPlacing=!1,n.copyPlaceRectPosition())},h.prototype._bindFitEvents=function(t){function e(){n++,2==n&&i.dispatchEvent("fitComplete",null,[t])}var i=this,n=0;t.on("layout",function(){return e(),!0}),this.on("layoutComplete",function(){return e(),!0})},h.prototype.resize=function(){var t=e(this.element),i=this.size&&t,n=this.options.isHorizontal?"innerHeight":"innerWidth";i&&t[n]==this.size[n]||this.layout()},h.prototype.itemDragStart=function(t){this.stamp(t);var e=this.getItem(t);e&&e.dragStart()},h.prototype.itemDragMove=function(t,e,i){function n(){r.layout(),delete r.dragTimeout}var o=this.getItem(t);o&&o.dragMove(e,i);var r=this;this.clearDragTimeout(),this.dragTimeout=setTimeout(n,40)},h.prototype.clearDragTimeout=function(){this.dragTimeout&&clearTimeout(this.dragTimeout)},h.prototype.itemDragEnd=function(e){var i,n=this.getItem(e);if(n&&(i=n.didDrag,n.dragStop()),!n||!i&&!n.needsPositioning)return void this.unstamp(e);t.add(n.element,"is-positioning-post-drag");var o=this._getDragEndLayoutComplete(e,n);n.needsPositioning?(n.on("layout",o),n.moveTo(n.placeRect.x,n.placeRect.y)):n&&n.copyPlaceRectPosition(),this.clearDragTimeout(),this.on("layoutComplete",o),this.layout()},h.prototype._getDragEndLayoutComplete=function(e,i){var n=i&&i.needsPositioning,o=0,r=n?2:1,s=this;return function(){return o++,o!=r?!0:(i&&(t.remove(i.element,"is-positioning-post-drag"),i.isPlacing=!1,i.copyPlaceRectPosition()),s.unstamp(e),s.sortItemsByPosition(),n&&s.dispatchEvent("dragItemPositioned",null,[i]),!0)}},h.prototype.bindDraggabillyEvents=function(t){t.on("dragStart",this.handleDraggabilly.dragStart),t.on("dragMove",this.handleDraggabilly.dragMove),t.on("dragEnd",this.handleDraggabilly.dragEnd)},h.prototype.bindUIDraggableEvents=function(t){t.on("dragstart",this.handleUIDraggable.start).on("drag",this.handleUIDraggable.drag).on("dragstop",this.handleUIDraggable.stop)},h.Rect=n,h.Packer=o,h});
widgets/so-simple-masonry-widget/js/simple-masonry.js ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* globals jQuery */
2
+ jQuery(function ($) {
3
+ var $grid = $('.sow-masonry-grid');
4
+
5
+ var resizeMasonry = function(){
6
+ $grid.each(function(){
7
+ var $gridEl = $(this);
8
+ var layouts = $gridEl.data('layouts');
9
+ var tabletQuery = window.matchMedia('(max-width: ' + layouts.tablet.breakPoint + 'px)');
10
+ var mobileQuery = window.matchMedia('(max-width: ' + layouts.mobile.breakPoint + 'px)');
11
+ var layout = layouts.desktop;
12
+ if(mobileQuery.matches) {
13
+ layout = layouts.mobile;
14
+ } else if (tabletQuery.matches) {
15
+ layout = layouts.tablet;
16
+ }
17
+ var numColumns = layout.numColumns;
18
+ $gridEl.css('width', 'auto');
19
+ var horizontalGutterSpace = layout.gutter * ( numColumns - 1 );
20
+ var columnWidth = Math.floor( ( $gridEl.width() - ( horizontalGutterSpace ) ) / numColumns );
21
+ $gridEl.width( ( columnWidth * numColumns ) + horizontalGutterSpace );
22
+
23
+ $gridEl.find('> .sow-masonry-grid-item').each(function(){
24
+ var $$ = $(this);
25
+ var colSpan = $$.data('colSpan');
26
+ colSpan = Math.max(Math.min(colSpan, layout.numColumns), 1);
27
+ $$.width( ( columnWidth * colSpan ) + (layout.gutter * (colSpan-1)));
28
+ var rowSpan = $$.data('rowSpan');
29
+ rowSpan = Math.max(Math.min(rowSpan, layout.numColumns), 1);
30
+ //Use rowHeight if non-zero else fall back to matching columnWidth.
31
+ var rowHeight = layout.rowHeight || columnWidth;
32
+ $$.css('height', (rowHeight * rowSpan) + (layout.gutter * (rowSpan-1)));
33
+
34
+ var $img = $$.find('> img,> a > img');
35
+ var imgAR = $img.attr('height') > 0 ? $img.attr('width')/$img.attr('height') : 1;
36
+ var itemAR = $$.height() > 0 ? $$.width()/$$.height() : 1;
37
+ imgAR = parseFloat(imgAR.toFixed(3));
38
+ itemAR = parseFloat(itemAR.toFixed(3));
39
+ if(imgAR > itemAR) {
40
+ $img.css('width', 'auto');
41
+ $img.css('height', '100%');
42
+ $img.css('margin-top', '');
43
+ var marginLeft = ($img.width() - $$.width()) * -0.5;
44
+ $img.css('margin-left', marginLeft+'px');
45
+ }
46
+ else {
47
+ $img.css('height', 'auto');
48
+ $img.css('width', '100%');
49
+ $img.css('margin-left', '');
50
+ var marginTop = ($img.height() - $$.height()) * -0.5;
51
+ $img.css('margin-top', marginTop+'px');
52
+ }
53
+ });
54
+
55
+ $gridEl.packery({
56
+ itemSelector: '.sow-masonry-grid-item',
57
+ columnWidth: columnWidth,
58
+ gutter: layout.gutter
59
+ });
60
+ });
61
+ };
62
+
63
+ $(window).resize(resizeMasonry);
64
+ resizeMasonry();
65
+ });
widgets/so-simple-masonry-widget/js/simple-masonry.min.js ADDED
@@ -0,0 +1 @@
 
1
+ jQuery(function(t){var a=t(".sow-masonry-grid"),i=function(){a.each(function(){var a=t(this),i=a.data("layouts"),e=window.matchMedia("(max-width: "+i.tablet.breakPoint+"px)"),h=window.matchMedia("(max-width: "+i.mobile.breakPoint+"px)"),r=i.desktop;h.matches?r=i.mobile:e.matches&&(r=i.tablet);var s=r.numColumns;a.css("width","auto");var o=r.gutter*(s-1),n=Math.floor((a.width()-o)/s);a.width(n*s+o),a.find("> .sow-masonry-grid-item").each(function(){var a=t(this),i=a.data("colSpan");i=Math.max(Math.min(i,r.numColumns),1),a.width(n*i+r.gutter*(i-1));var e=a.data("rowSpan");e=Math.max(Math.min(e,r.numColumns),1);var h=r.rowHeight||n;a.css("height",h*e+r.gutter*(e-1));var s=a.find("> img,> a > img"),o=s.attr("height")>0?s.attr("width")/s.attr("height"):1,m=a.height()>0?a.width()/a.height():1;if(o=parseFloat(o.toFixed(3)),m=parseFloat(m.toFixed(3)),o>m){s.css("width","auto"),s.css("height","100%"),s.css("margin-top","");var d=(s.width()-a.width())*-.5;s.css("margin-left",d+"px")}else{s.css("height","auto"),s.css("width","100%"),s.css("margin-left","");var c=(s.height()-a.height())*-.5;s.css("margin-top",c+"px")}}),a.packery({itemSelector:".sow-masonry-grid-item",columnWidth:n,gutter:r.gutter})})};t(window).resize(i),i()});
widgets/so-simple-masonry-widget/so-simple-masonry-widget.php ADDED
@@ -0,0 +1,219 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Widget Name: Simple Masonry Layout
4
+ Description: A masonry layout for images or posts.
5
+ Author: SiteOrigin
6
+ Author URI: https://siteorigin.com
7
+ */
8
+
9
+ class SiteOrigin_Widget_Simple_Masonry_Widget extends SiteOrigin_Widget {
10
+ function __construct() {
11
+
12
+ parent::__construct(
13
+ 'sow-simple-masonry',
14
+ __('SiteOrigin Simple Masonry', 'so-widgets-bundle'),
15
+ array(
16
+ 'description' => __('A simple masonry layout widget.', 'so-widgets-bundle'),
17
+ // 'help' => 'https://siteorigin.com/widgets-bundle/simple-masonry-widget-documentation/'
18
+ ),
19
+ array(),
20
+ array(
21
+ 'widget_title' => array(
22
+ 'type' => 'text',
23
+ 'label' => __('Title', 'so-widgets-bundle'),
24
+ ),
25
+ 'items' => array(
26
+ 'type' => 'repeater',
27
+ 'label' => __( 'Images', 'so-widgets-bundle' ),
28
+ 'item_label' => array(
29
+ 'selector' => "[id*='title']"
30
+ ),
31
+ 'fields' => array(
32
+ 'image' => array(
33
+ 'type' => 'media',
34
+ 'label' => __( 'Image', 'so-widgets-bundle')
35
+ ),
36
+ 'column_span' => array(
37
+ 'type' => 'slider',
38
+ 'label' => __( 'Column span', 'so-widgets-bundle' ),
39
+ 'description' => __( 'Number of columns this item should span. (Limited to number of columns selected in Layout section below.)', 'so-widgets-bundle' ),
40
+ 'min' => 1,
41
+ 'max' => 10,
42
+ 'default' => 1
43
+ ),
44
+ 'row_span' => array(
45
+ 'type' => 'slider',
46
+ 'label' => __( 'Row span', 'so-widgets-bundle' ),
47
+ 'description' => __( 'Number of rows this item should span. (Limited to number of columns selected in Layout section below.)', 'so-widgets-bundle' ),
48
+ 'min' => 1,
49
+ 'max' => 10,
50
+ 'default' => 1
51
+ ),
52
+ 'title' => array(
53
+ 'type' => 'text',
54
+ 'label' => __('Title', 'so-widgets-bundle'),
55
+ ),
56
+ 'url' => array(
57
+ 'type' => 'link',
58
+ 'label' => __('Destination URL', 'so-widgets-bundle'),
59
+ ),
60
+ 'new_window' => array(
61
+ 'type' => 'checkbox',
62
+ 'default' => false,
63
+ 'label' => __('Open in a new window', 'so-widgets-bundle'),
64
+ ),
65
+ )
66
+ ),
67
+ 'desktop_layout' => array(
68
+ 'type' => 'section',
69
+ 'label' => __( 'Desktop Layout', 'so-widgets-bundle' ),
70
+ 'fields' => array(
71
+ 'columns' => array(
72
+ 'type' => 'slider',
73
+ 'label' => __( 'Number of columns', 'so-widgets-bundle' ),
74
+ 'min' => 1,
75
+ 'max' => 10,
76
+ 'default' => 4
77
+ ),
78
+ 'row_height' => array(
79
+ 'type' => 'number',
80
+ 'label' => __( 'Row height', 'so-widgets-bundle' ),
81
+ 'description' => __( 'Leave blank to match calculated column width.', 'so-widgets-bundle' ),
82
+ 'default' => 0
83
+ ),
84
+ 'gutter' => array(
85
+ 'type' => 'number',
86
+ 'label' => __( 'Gutter', 'so-widgets-bundle'),
87
+ 'description' => __( 'Space between masonry items.', 'so-widgets-bundle' ),
88
+ 'default' => 0
89
+ )
90
+ )
91
+ ),
92
+ 'tablet_layout' => array(
93
+ 'type' => 'section',
94
+ 'label' => __( 'Tablet Layout', 'so-widgets-bundle' ),
95
+ 'hide' => true,
96
+ 'fields' => array(
97
+ 'break_point' => array(
98
+ 'type' => 'number',
99
+ 'lanel' => __( 'Break point', 'so-widgets-bundle' ),
100
+ 'default' => 768
101
+ ),
102
+ 'columns' => array(
103
+ 'type' => 'slider',
104
+ 'label' => __( 'Number of columns', 'so-widgets-bundle' ),
105
+ 'min' => 1,
106
+ 'max' => 10,
107
+ 'default' => 2
108
+ ),
109
+ 'row_height' => array(
110
+ 'type' => 'number',
111
+ 'label' => __( 'Row height', 'so-widgets-bundle' ),
112
+ 'description' => __( 'Leave blank to match calculated column width.', 'so-widgets-bundle' ),
113
+ 'default' => 0
114
+ ),
115
+ 'gutter' => array(
116
+ 'type' => 'number',
117
+ 'label' => __( 'Gutter', 'so-widgets-bundle'),
118
+ 'description' => __( 'Space between masonry items.', 'so-widgets-bundle' ),
119
+ 'default' => 0
120
+ )
121
+ )
122
+ ),
123
+ 'mobile_layout' => array(
124
+ 'type' => 'section',
125
+ 'label' => __( 'Mobile Layout', 'so-widgets-bundle' ),
126
+ 'hide' => true,
127
+ 'fields' => array(
128
+ 'break_point' => array(
129
+ 'type' => 'number',
130
+ 'lanel' => __( 'Break point', 'so-widgets-bundle' ),
131
+ 'default' => 480
132
+ ),
133
+ 'columns' => array(
134
+ 'type' => 'slider',
135
+ 'label' => __( 'Number of columns', 'so-widgets-bundle' ),
136
+ 'min' => 1,
137
+ 'max' => 10,
138
+ 'default' => 1
139
+ ),
140
+ 'row_height' => array(
141
+ 'type' => 'number',
142
+ 'label' => __( 'Row height', 'so-widgets-bundle' ),
143
+ 'description' => __( 'Leave blank to match calculated column width.', 'so-widgets-bundle' ),
144
+ 'default' => 0
145
+ ),
146
+ 'gutter' => array(
147
+ 'type' => 'number',
148
+ 'label' => __( 'Gutter', 'so-widgets-bundle'),
149
+ 'description' => __( 'Space between masonry items.', 'so-widgets-bundle' ),
150
+ 'default' => 0
151
+ )
152
+ )
153
+ )
154
+ ),
155
+ plugin_dir_path(__FILE__)
156
+ );
157
+
158
+ }
159
+
160
+ function initialize() {
161
+ $this->register_frontend_scripts(
162
+ array(
163
+ array(
164
+ 'dessandro-packery',
165
+ siteorigin_widget_get_plugin_dir_url( 'sow-simple-masonry' ) . 'js/packery.pkgd' . SOW_BUNDLE_JS_SUFFIX . '.js',
166
+ array( 'jquery' ),
167
+ SOW_BUNDLE_VERSION
168
+ ),
169
+ array(
170
+ 'sow-simple-masonry',
171
+ siteorigin_widget_get_plugin_dir_url( 'sow-simple-masonry' ) . 'js/simple-masonry' . SOW_BUNDLE_JS_SUFFIX . '.js',
172
+ array( 'jquery', 'dessandro-packery' ),
173
+ SOW_BUNDLE_VERSION . '1'
174
+ ),
175
+ )
176
+ );
177
+ }
178
+
179
+ function get_template_name($instance) {
180
+ return 'simple-masonry';
181
+ }
182
+
183
+ function get_style_name($instance) {
184
+ return 'simple-masonry';
185
+ }
186
+
187
+ public function get_template_variables( $instance, $args ) {
188
+ return array(
189
+ 'items' => $instance['items'],
190
+ 'layouts' => array(
191
+ 'desktop' => siteorigin_widgets_underscores_to_camel_case(
192
+ array(
193
+ 'num_columns' => $instance['desktop_layout']['columns'],
194
+ 'row_height' => empty( $instance['desktop_layout']['row_height'] ) ? 0 : intval( $instance['desktop_layout']['row_height'] ),
195
+ 'gutter' => empty( $instance['desktop_layout']['gutter'] ) ? 0 : intval( $instance['desktop_layout']['gutter'] ),
196
+ )
197
+ ),
198
+ 'tablet' => siteorigin_widgets_underscores_to_camel_case(
199
+ array(
200
+ 'break_point' => $instance['tablet_layout']['break_point'],
201
+ 'num_columns' => $instance['tablet_layout']['columns'],
202
+ 'row_height' => empty( $instance['tablet_layout']['row_height'] ) ? 0 : intval( $instance['tablet_layout']['row_height'] ),
203
+ 'gutter' => empty( $instance['tablet_layout']['gutter'] ) ? 0 : intval( $instance['tablet_layout']['gutter'] ),
204
+ )
205
+ ),
206
+ 'mobile' => siteorigin_widgets_underscores_to_camel_case(
207
+ array(
208
+ 'break_point' => $instance['mobile_layout']['break_point'],
209
+ 'num_columns' => $instance['mobile_layout']['columns'],
210
+ 'row_height' => empty( $instance['mobile_layout']['row_height'] ) ? 0 : intval( $instance['mobile_layout']['row_height'] ),
211
+ 'gutter' => empty( $instance['mobile_layout']['gutter'] ) ? 0 : intval( $instance['mobile_layout']['gutter'] ),
212
+ )
213
+ ),
214
+ )
215
+ );
216
+ }
217
+ }
218
+
219
+ siteorigin_widget_register('sow-simple-masonry', __FILE__, 'SiteOrigin_Widget_Simple_Masonry_Widget');
widgets/so-simple-masonry-widget/styles/simple-masonry.less ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+
2
+ .sow-masonry-grid-item {
3
+ overflow: hidden;
4
+
5
+ img {
6
+ display: block;
7
+ max-width: inherit;
8
+ }
9
+ }
widgets/so-simple-masonry-widget/tpl/simple-masonry.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="sow-masonry-grid"
2
+ data-layouts="<?php echo esc_attr( json_encode( $layouts ) ) ?>">
3
+ <?php
4
+ foreach($items as $item) {
5
+ $src = wp_get_attachment_image_src( $item['image'], 'large' );
6
+ $src = empty( $src ) ? '' : $src[0];
7
+ $title = empty( $item['title'] ) ? '' : $item['title'];
8
+ $url = empty( $item['url'] ) ? '' : $item['url'];
9
+ $new_window = ! empty( $item['new_window'] );
10
+ ?>
11
+ <div class="sow-masonry-grid-item" data-col-span="<?php echo esc_attr( $item['column_span'] ) ?>"
12
+ data-row-span="<?php echo esc_attr( $item['row_span'] ) ?>">
13
+ <?php if( !empty( $url ) ) : ?>
14
+ <a href="<?php echo sow_esc_url( $url ) ?>" <?php if( $new_window ) { ?>target="_blank" <?php } ?>>
15
+ <?php endif; ?>
16
+
17
+ <?php echo wp_get_attachment_image( $item['image'], 'large', false, array( 'title' => esc_attr( $title ) ) ); ?>
18
+
19
+ <?php if( !empty( $url ) ) : ?>
20
+ </a>
21
+ <?php endif; ?>
22
+ </div>
23
+ <?php
24
+ }
25
+ ?>
26
+
27
+ </div>
widgets/so-slider-widget/assets/banner.svg CHANGED
@@ -1,44 +1,40 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
4
- <svg version="1.0" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
- width="480px" height="240px" viewBox="0 0 480 240" enable-background="new 0 0 480 240" xml:space="preserve">
6
- <rect id="Image_Slider_1_" y="0.001" fill="#1880B6" width="480" height="240"/>
7
- <g>
8
- <g>
9
- <path fill="#8ED9EF" d="M284,72.001h-88c-2.211,0-4,1.789-4,4v72.743l22.375-22.383c3.129-3.126,8.188-3.126,11.312,0
10
- l10.305,10.304l22.344-30.343c3.125-3.126,8.184-3.126,11.312,0L288,124.674V76.001C288,73.79,286.211,72.001,284,72.001z"/>
11
- <path fill="#8ED9EF" d="M180,84.002v72c0,2.21,1.788,4,4,4h4.001V80.001H184C181.788,80.001,180,81.79,180,84.002z"/>
12
- <path fill="#8ED9EF" d="M296,79.993h-4.001v80.001H296c2.211,0,4-1.79,4-4.001V83.994C300,81.783,298.211,79.993,296,79.993z"/>
13
- </g>
14
- <g>
15
- <path fill="#324249" d="M296,75.993h-4.001v0.008c0-4.421-3.577-7.999-7.999-7.999h-88c-4.422,0-7.999,3.578-7.999,7.999H184
16
- c-4.422,0-8,3.578-8,8.001v72c0,4.422,3.578,7.999,8,7.999h4.001c0,4.423,3.577,8.001,7.999,8.001h88
17
- c4.422,0,7.999-3.578,7.999-8.001v-0.007H296c4.422,0,8-3.579,8-8.001V83.994C304,79.571,300.422,75.993,296,75.993z
18
- M188.001,160.002H184c-2.212,0-4-1.79-4-4v-72c0-2.212,1.788-4.001,4-4.001h4.001V160.002z M288,164.001c0,2.212-1.789,4-4,4h-88
19
- c-2.211,0-4-1.788-4-4v-9.602l25.203-25.203c1.562-1.562,4.094-1.562,5.655,0c0,0,8.399,8.391,10.306,10.298
20
- c1.906,1.905,3.757,1.897,5.656,0c1.898-1.899,22.344-30.344,22.344-30.344c1.562-1.563,4.094-1.563,5.656,0L288,130.337V164.001z
21
- M288,124.674l-18.352-18.352c-3.129-3.126-8.188-3.126-11.312,0l-22.344,30.343l-10.305-10.304
22
- c-3.125-3.126-8.184-3.126-11.312,0L192,148.744V76.001c0-2.211,1.789-4,4-4h88c2.211,0,4,1.789,4,4V124.674z M300,155.993
23
- c0,2.211-1.789,4.001-4,4.001h-4.001V79.993H296c2.211,0,4,1.79,4,4.001V155.993z"/>
24
- <path fill="#324249" d="M234.008,96.001h-6.203c-0.259-1.272-0.766-2.461-1.461-3.507l4.391-4.391
25
- c0.785-0.782,0.785-2.047,0-2.829c-0.78-0.781-2.047-0.781-2.828,0l-4.391,4.391c-1.051-0.695-2.233-1.203-3.508-1.461v-6.202
26
- c0-1.109-0.895-2.001-2-2.001c-1.109,0-2.004,0.892-2.004,2.001v6.202c-1.273,0.258-2.456,0.766-3.508,1.461l-4.391-4.398
27
- c-0.781-0.773-2.043-0.773-2.832,0c-0.777,0.79-0.777,2.055,0.004,2.837l4.391,4.391c-0.695,1.046-1.203,2.227-1.461,3.507h-6.203
28
- c-1.105,0-1.996,0.892-2.004,2.001c0.008,1.109,0.902,2,2.004,2h6.203c0.258,1.272,0.766,2.461,1.461,3.508l-4.395,4.391
29
- c-0.777,0.781-0.777,2.046,0,2.836c0.789,0.78,2.051,0.772,2.832-0.009l4.391-4.39c1.052,0.695,2.23,1.202,3.508,1.461v6.203
30
- c0,1.109,0.895,2,2.004,2.007c1.109-0.007,2-0.897,2-2.007v-6.203c1.274-0.259,2.457-0.766,3.508-1.461l4.391,4.398
31
- c0.781,0.78,2.048,0.78,2.832,0c0.781-0.79,0.777-2.055-0.004-2.836l-4.391-4.391c0.695-1.047,1.202-2.227,1.461-3.508h6.203
32
- c1.105,0.008,2-0.891,2-2S235.113,96.001,234.008,96.001z M218.008,104.001c-3.312,0-6-2.68-6.004-5.991l0.004-0.008
33
- c0,0-0.004,0-0.004-0.009c0.004-3.312,2.691-5.992,6.004-5.992s6,2.688,6,6.001C224.008,101.313,221.32,104.001,218.008,104.001z"
34
- />
35
- </g>
36
- <g>
37
- <path fill="#F2F0DA" d="M266.82,109.15c-1.562-1.563-4.094-1.563-5.656,0c0,0-20.445,28.444-22.344,30.344
38
- c-1.899,1.897-3.75,1.905-5.656,0c-1.906-1.907-10.306-10.298-10.306-10.298c-1.562-1.562-4.093-1.562-5.655,0L192,154.399v9.602
39
- c0,2.212,1.789,4,4,4h88c2.211,0,4-1.788,4-4v-33.664L266.82,109.15z"/>
40
- <path fill="#F2F0DA" d="M218.001,104.001c3.315,0,5.999-2.688,5.999-5.999c0-3.313-2.684-6.001-5.999-6.001
41
- c-3.318,0-6.001,2.688-6.001,6.001C212,101.313,214.683,104.001,218.001,104.001z"/>
42
- </g>
43
- </g>
44
- </svg>
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="55 277 240 240" style="enable-background:new 55 277 240 240;" xml:space="preserve">
5
+ <style type="text/css">
6
+ .st0{fill:#1880B6;}
7
+ .st1{fill:#8ED9EF;}
8
+ .st2{fill:#324249;}
9
+ .st3{fill:#F2F0DA;}
10
+ </style>
11
+ <rect id="Image_Slider_1_" x="55" y="277" class="st0" width="240" height="240"/>
12
+ <g>
13
+ <g>
14
+ <path class="st1" d="M219,349h-88c-2.2,0-4,1.8-4,4v72.7l22.4-22.4c3.1-3.1,8.2-3.1,11.3,0l10.3,10.3l22.3-30.3
15
+ c3.1-3.1,8.2-3.1,11.3,0l18.4,18.4V353C223,350.8,221.2,349,219,349z"/>
16
+ <path class="st1" d="M115,361v72c0,2.2,1.8,4,4,4h4v-80h-4C116.8,357,115,358.8,115,361z"/>
17
+ <path class="st1" d="M231,357h-4v80h4c2.2,0,4-1.8,4-4v-72C235,358.8,233.2,357,231,357z"/>
18
+ </g>
19
+ <g>
20
+ <path class="st2" d="M231,353h-4v0c0-4.4-3.6-8-8-8h-88c-4.4,0-8,3.6-8,8h-4c-4.4,0-8,3.6-8,8v72c0,4.4,3.6,8,8,8h4
21
+ c0,4.4,3.6,8,8,8h88c4.4,0,8-3.6,8-8v0h4c4.4,0,8-3.6,8-8v-72C239,356.6,235.4,353,231,353z M123,437h-4c-2.2,0-4-1.8-4-4v-72
22
+ c0-2.2,1.8-4,4-4h4V437z M223,441c0,2.2-1.8,4-4,4h-88c-2.2,0-4-1.8-4-4v-9.6l25.2-25.2c1.6-1.6,4.1-1.6,5.7,0
23
+ c0,0,8.4,8.4,10.3,10.3c1.9,1.9,3.8,1.9,5.7,0c1.9-1.9,22.3-30.3,22.3-30.3c1.6-1.6,4.1-1.6,5.7,0l21.2,21.2V441z M223,401.7
24
+ l-18.4-18.4c-3.1-3.1-8.2-3.1-11.3,0L171,413.7l-10.3-10.3c-3.1-3.1-8.2-3.1-11.3,0L127,425.7V353c0-2.2,1.8-4,4-4h88
25
+ c2.2,0,4,1.8,4,4V401.7z M235,433c0,2.2-1.8,4-4,4h-4v-80h4c2.2,0,4,1.8,4,4V433z"/>
26
+ <path class="st2" d="M169,373h-6.2c-0.3-1.3-0.8-2.5-1.5-3.5l4.4-4.4c0.8-0.8,0.8-2,0-2.8c-0.8-0.8-2-0.8-2.8,0l-4.4,4.4
27
+ c-1.1-0.7-2.2-1.2-3.5-1.5V359c0-1.1-0.9-2-2-2c-1.1,0-2,0.9-2,2v6.2c-1.3,0.3-2.5,0.8-3.5,1.5l-4.4-4.4c-0.8-0.8-2-0.8-2.8,0
28
+ c-0.8,0.8-0.8,2.1,0,2.8l4.4,4.4c-0.7,1-1.2,2.2-1.5,3.5H137c-1.1,0-2,0.9-2,2c0,1.1,0.9,2,2,2h6.2c0.3,1.3,0.8,2.5,1.5,3.5
29
+ l-4.4,4.4c-0.8,0.8-0.8,2,0,2.8c0.8,0.8,2.1,0.8,2.8,0l4.4-4.4c1.1,0.7,2.2,1.2,3.5,1.5v6.2c0,1.1,0.9,2,2,2c1.1,0,2-0.9,2-2v-6.2
30
+ c1.3-0.3,2.5-0.8,3.5-1.5l4.4,4.4c0.8,0.8,2,0.8,2.8,0c0.8-0.8,0.8-2.1,0-2.8l-4.4-4.4c0.7-1,1.2-2.2,1.5-3.5h6.2c1.1,0,2-0.9,2-2
31
+ C171,373.9,170.1,373,169,373z M153,381c-3.3,0-6-2.7-6-6l0,0c0,0,0,0,0,0c0-3.3,2.7-6,6-6s6,2.7,6,6C159,378.3,156.3,381,153,381
32
+ z"/>
33
+ </g>
34
+ <g>
35
+ <path class="st3" d="M201.8,386.1c-1.6-1.6-4.1-1.6-5.7,0c0,0-20.4,28.4-22.3,30.3c-1.9,1.9-3.8,1.9-5.7,0
36
+ c-1.9-1.9-10.3-10.3-10.3-10.3c-1.6-1.6-4.1-1.6-5.7,0L127,431.4v9.6c0,2.2,1.8,4,4,4h88c2.2,0,4-1.8,4-4v-33.7L201.8,386.1z"/>
37
+ <path class="st3" d="M153,381c3.3,0,6-2.7,6-6c0-3.3-2.7-6-6-6c-3.3,0-6,2.7-6,6C147,378.3,149.7,381,153,381z"/>
38
+ </g>
39
+ </g>
40
+ </svg>
 
 
 
 
widgets/so-slider-widget/so-slider-widget.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
  /*
3
- Widget Name: Slider widget
4
  Description: A very simple slider widget.
5
- Author: Greg Priday
6
- Author URI: http://siteorigin.com
7
  */
8
 
9
  if( !class_exists( 'SiteOrigin_Widget_Base_Slider' ) ) include_once plugin_dir_path(SOW_BUNDLE_BASE_FILE) . '/base/inc/widgets/base-slider.class.php';
@@ -12,9 +12,9 @@ class SiteOrigin_Widget_Slider_Widget extends SiteOrigin_Widget_Base_Slider {
12
  function __construct() {
13
  parent::__construct(
14
  'sow-slider',
15
- __('SiteOrigin Slider', 'siteorigin-widgets'),
16
  array(
17
- 'description' => __('A responsive slider widget that supports images and video.', 'siteorigin-widgets'),
18
  'help' => 'https://siteorigin.com/widgets-bundle/slider-widget-documentation/',
19
  'panels_title' => false,
20
  ),
@@ -24,8 +24,8 @@ class SiteOrigin_Widget_Slider_Widget extends SiteOrigin_Widget_Base_Slider {
24
  array(
25
  'frames' => array(
26
  'type' => 'repeater',
27
- 'label' => __('Slider frames', 'siteorigin-widgets'),
28
- 'item_name' => __('Frame', 'siteorigin-widgets'),
29
  'item_label' => array(
30
  'selector' => "[id*='frames-url']",
31
  'update_event' => 'change',
@@ -34,8 +34,8 @@ class SiteOrigin_Widget_Slider_Widget extends SiteOrigin_Widget_Base_Slider {
34
  'fields' => array(
35
  'background_videos' => array(
36
  'type' => 'repeater',
37
- 'item_name' => __('Video', 'siteorigin-widgets'),
38
- 'label' => __('Background videos', 'siteorigin-widgets'),
39
  'item_label' => array(
40
  'selector' => "[id*='frames-background_videos-url']",
41
  'update_event' => 'change',
@@ -47,21 +47,21 @@ class SiteOrigin_Widget_Slider_Widget extends SiteOrigin_Widget_Base_Slider {
47
  'background_image' => array(
48
  'type' => 'media',
49
  'library' => 'image',
50
- 'label' => __('Background image', 'siteorigin-widgets'),
51
  'fallback' => true,
52
  ),
53
 
54
  'background_color' => array(
55
  'type' => 'color',
56
- 'label' => __('Background Color', 'siteorigin-widgets'),
57
  ),
58
 
59
  'background_image_type' => array(
60
  'type' => 'select',
61
- 'label' => __('Background image type', 'siteorigin-widgets'),
62
  'options' => array(
63
- 'cover' => __('Cover', 'siteorigin-widgets'),
64
- 'tile' => __('Tile', 'siteorigin-widgets'),
65
  ),
66
  'default' => 'cover',
67
  ),
@@ -69,25 +69,25 @@ class SiteOrigin_Widget_Slider_Widget extends SiteOrigin_Widget_Base_Slider {
69
  'foreground_image' => array(
70
  'type' => 'media',
71
  'library' => 'image',
72
- 'label' => __('Foreground image', 'siteorigin-widgets'),
73
  'fallback' => true,
74
  ),
75
 
76
  'url' => array(
77
  'type' => 'link',
78
- 'label' => __('Destination URL', 'siteorigin-widgets'),
79
  ),
80
 
81
  'new_window' => array(
82
  'type' => 'checkbox',
83
- 'label' => __('Open in new window', 'siteorigin-widgets'),
84
  'default' => false,
85
  ),
86
  ),
87
  ),
88
  'controls' => array(
89
  'type' => 'section',
90
- 'label' => __('Controls', 'siteorigin-widget'),
91
  'fields' => $this->control_form_fields()
92
  )
93
  ),
@@ -134,7 +134,7 @@ class SiteOrigin_Widget_Slider_Widget extends SiteOrigin_Widget_Base_Slider {
134
  <div class="sow-slider-image-container">
135
  <div class="sow-slider-image-wrapper" style="<?php if(!empty($foreground_src[1])) echo 'max-width: ' . intval($foreground_src[1]) . 'px' ?>">
136
  <?php
137
- if(!empty($frame['url'])) echo '<a href="' . sow_esc_url($frame['url']) . '">';
138
  echo siteorigin_widgets_get_attachment_image(
139
  $frame['foreground_image'],
140
  'full',
@@ -204,4 +204,4 @@ class SiteOrigin_Widget_Slider_Widget extends SiteOrigin_Widget_Base_Slider {
204
  }
205
  }
206
 
207
- siteorigin_widget_register('slider', __FILE__);
1
  <?php
2
  /*
3
+ Widget Name: Image Slider
4
  Description: A very simple slider widget.
5
+ Author: SiteOrigin
6
+ Author URI: https://siteorigin.com
7
  */
8
 
9
  if( !class_exists( 'SiteOrigin_Widget_Base_Slider' ) ) include_once plugin_dir_path(SOW_BUNDLE_BASE_FILE) . '/base/inc/widgets/base-slider.class.php';
12
  function __construct() {
13
  parent::__construct(
14
  'sow-slider',
15
+ __('SiteOrigin Slider', 'so-widgets-bundle'),
16
  array(
17
+ 'description' => __('A responsive slider widget that supports images and video.', 'so-widgets-bundle'),
18
  'help' => 'https://siteorigin.com/widgets-bundle/slider-widget-documentation/',
19
  'panels_title' => false,
20
  ),
24
  array(
25
  'frames' => array(
26
  'type' => 'repeater',
27
+ 'label' => __('Slider frames', 'so-widgets-bundle'),
28
+ 'item_name' => __('Frame', 'so-widgets-bundle'),
29
  'item_label' => array(
30
  'selector' => "[id*='frames-url']",
31
  'update_event' => 'change',
34
  'fields' => array(
35
  'background_videos' => array(
36
  'type' => 'repeater',
37
+ 'item_name' => __('Video', 'so-widgets-bundle'),
38
+ 'label' => __('Background videos', 'so-widgets-bundle'),
39
  'item_label' => array(
40
  'selector' => "[id*='frames-background_videos-url']",
41
  'update_event' => 'change',
47
  'background_image' => array(
48
  'type' => 'media',
49
  'library' => 'image',
50
+ 'label' => __('Background image', 'so-widgets-bundle'),
51
  'fallback' => true,
52
  ),
53
 
54
  'background_color' => array(
55
  'type' => 'color',
56
+ 'label' => __('Background Color', 'so-widgets-bundle'),
57
  ),
58
 
59
  'background_image_type' => array(
60
  'type' => 'select',
61
+ 'label' => __('Background image type', 'so-widgets-bundle'),
62
  'options' => array(
63
+ 'cover' => __('Cover', 'so-widgets-bundle'),
64
+ 'tile' => __('Tile', 'so-widgets-bundle'),
65
  ),
66
  'default' => 'cover',
67
  ),
69
  'foreground_image' => array(
70
  'type' => 'media',
71
  'library' => 'image',
72
+ 'label' => __('Foreground image', 'so-widgets-bundle'),
73
  'fallback' => true,
74
  ),
75
 
76
  'url' => array(
77
  'type' => 'link',
78
+ 'label' => __('Destination URL', 'so-widgets-bundle'),
79
  ),
80
 
81
  'new_window' => array(
82
  'type' => 'checkbox',
83
+ 'label' => __('Open in new window', 'so-widgets-bundle'),
84
  'default' => false,
85
  ),
86
  ),
87
  ),
88
  'controls' => array(
89
  'type' => 'section',
90
+ 'label' => __('Controls', 'so-widgets-bundle'),
91
  'fields' => $this->control_form_fields()
92
  )
93
  ),
134
  <div class="sow-slider-image-container">
135
  <div class="sow-slider-image-wrapper" style="<?php if(!empty($foreground_src[1])) echo 'max-width: ' . intval($foreground_src[1]) . 'px' ?>">
136
  <?php
137
+ if(!empty($frame['url'])) echo '<a href="' . sow_esc_url($frame['url']) . '" ' . ( !empty($frame['new_window']) ? 'target="_blank"' : '' ) . '>';
138
  echo siteorigin_widgets_get_attachment_image(
139
  $frame['foreground_image'],
140
  'full',
204
  }
205
  }
206
 
207
+ siteorigin_widget_register('sow-slider', __FILE__, 'SiteOrigin_Widget_Slider_Widget');
widgets/so-social-media-buttons-widget/assets/banner.svg CHANGED
@@ -1,39 +1,39 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
4
- <svg version="1.0" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
- width="480px" height="240px" viewBox="0 0 480 240" enable-background="new 0 0 480 240" xml:space="preserve">
6
- <rect id="Call_to_Action_2_" fill="#1880B6" width="480" height="240"/>
7
- <g>
8
- <g>
9
- <path fill="#8ED9EF" d="M288,104V72c0-2.211-1.789-4-4-4h-12v40h12C286.211,108,288,106.211,288,104z"/>
10
- <path fill="#8ED9EF" d="M188,116h4V76h-4c-2.211,0-4,1.789-4,4v32C184,114.211,185.789,116,188,116z"/>
11
- <path fill="#8ED9EF" d="M192,128h-8c-2.211,0-4,1.789-4,4v40c0,2.211,1.789,4,4,4h40c2.211,0,4-1.789,4-4v-36h-28
12
- C195.582,136,192,132.418,192,128z"/>
13
- <path fill="#8ED9EF" d="M296,124h-24v4c0,4.418-3.582,8-8,8h-20v40c0,2.211,1.789,4,4,4h48c2.211,0,4-1.789,4-4v-48
14
- C300,125.789,298.211,124,296,124z"/>
15
- </g>
16
- <path fill="#F2F0DA" d="M200,132h64c2.211,0,4-1.789,4-4V64c0-2.211-1.789-4-4-4h-64c-2.211,0-4,1.789-4,4v64
17
- C196,130.211,197.789,132,200,132z"/>
18
- <g>
19
- <path fill="#324249" d="M236,88c0-2.582,1.625-4,4-4h4v-8c0,0-4.48,0-8,0c-4.688,0-8,3.938-8,8v8h-8v8h8v16h8v-16h8l2-8h-10V88z"
20
- />
21
- <path fill="#324249" d="M285.949,140.445c-1.172,0.691-2.469,1.195-3.848,1.469c-1.105-1.18-2.68-1.914-4.426-1.914
22
- c-3.344,0-6.055,2.711-6.055,6.059c0,0.473,0.051,0.938,0.156,1.383c-5.035-0.254-9.5-2.668-12.488-6.332
23
- c-0.523,0.895-0.82,1.934-0.82,3.047c0,2.102,1.07,3.953,2.695,5.043c-0.996-0.035-1.93-0.305-2.746-0.758
24
- c0,0.023,0,0.051,0,0.074c0,2.938,2.09,5.387,4.859,5.941c-0.508,0.137-1.043,0.215-1.594,0.215c-0.391,0-0.77-0.039-1.141-0.109
25
- c0.77,2.406,3.008,4.156,5.66,4.207c-2.074,1.625-4.688,2.594-7.523,2.594c-0.492,0-0.973-0.027-1.449-0.086
26
- c2.684,1.719,5.867,2.723,9.289,2.723c11.145,0,17.238-9.23,17.238-17.238c0-0.262-0.008-0.523-0.016-0.785
27
- c1.184-0.855,2.207-1.922,3.023-3.137c-1.086,0.484-2.254,0.809-3.48,0.953C284.535,143.047,285.496,141.859,285.949,140.445z"/>
28
- <path fill="#324249" d="M296,120h-24v-8h12c4.418,0,8-3.582,8-8V72c0-4.418-3.582-8-8-8h-12c0-4.418-3.582-8-8-8h-64
29
- c-4.418,0-8,3.582-8,8v8h-4c-4.418,0-8,3.582-8,8v32c0,4.418,3.582,8,8,8h4v4h-8c-4.418,0-8,3.582-8,8v40c0,4.418,3.582,8,8,8h40
30
- c4.418,0,8-3.582,8-8v-36h8v40c0,4.418,3.582,8,8,8h48c4.418,0,8-3.582,8-8v-48C304,123.582,300.418,120,296,120z M272,68h12
31
- c2.211,0,4,1.789,4,4v32c0,2.211-1.789,4-4,4h-12V68z M188,116c-2.211,0-4-1.789-4-4V80c0-2.211,1.789-4,4-4h4v40H188z M228,172
32
- c0,2.211-1.789,4-4,4h-40c-2.211,0-4-1.789-4-4v-40c0-2.211,1.789-4,4-4h8c0,4.418,3.582,8,8,8h28V172z M200,132
33
- c-2.211,0-4-1.789-4-4V64c0-2.211,1.789-4,4-4h64c2.211,0,4,1.789,4,4v64c0,2.211-1.789,4-4,4H200z M300,176c0,2.211-1.789,4-4,4
34
- h-48c-2.211,0-4-1.789-4-4v-40h20c4.418,0,8-3.582,8-8v-4h24c2.211,0,4,1.789,4,4V176z"/>
35
- <polygon fill="#324249" points="200,140 200,148 192,148 192,156 200,156 200,164 208,164 208,156 216,156 216,148 208,148
36
- 208,140 "/>
37
- </g>
38
- </g>
39
- </svg>
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="55 277 240 240" style="enable-background:new 55 277 240 240;" xml:space="preserve">
5
+ <style type="text/css">
6
+ .st0{fill:#1880B6;}
7
+ .st1{fill:#8ED9EF;}
8
+ .st2{fill:#F2F0DA;}
9
+ .st3{fill:#324249;}
10
+ </style>
11
+ <rect id="Call_to_Action_2_" x="55" y="277" class="st0" width="240" height="240"/>
12
+ <g>
13
+ <g>
14
+ <path class="st1" d="M223,381v-32c0-2.2-1.8-4-4-4h-12v40h12C221.2,385,223,383.2,223,381z"/>
15
+ <path class="st1" d="M123,393h4v-40h-4c-2.2,0-4,1.8-4,4v32C119,391.2,120.8,393,123,393z"/>
16
+ <path class="st1" d="M127,405h-8c-2.2,0-4,1.8-4,4v40c0,2.2,1.8,4,4,4h40c2.2,0,4-1.8,4-4v-36h-28C130.6,413,127,409.4,127,405z"
17
+ />
18
+ <path class="st1" d="M231,401h-24v4c0,4.4-3.6,8-8,8h-20v40c0,2.2,1.8,4,4,4h48c2.2,0,4-1.8,4-4v-48C235,402.8,233.2,401,231,401z
19
+ "/>
20
+ </g>
21
+ <path class="st2" d="M135,409h64c2.2,0,4-1.8,4-4v-64c0-2.2-1.8-4-4-4h-64c-2.2,0-4,1.8-4,4v64C131,407.2,132.8,409,135,409z"/>
22
+ <g>
23
+ <path class="st3" d="M171,365c0-2.6,1.6-4,4-4h4v-8c0,0-4.5,0-8,0c-4.7,0-8,3.9-8,8v8h-8v8h8v16h8v-16h8l2-8h-10V365z"/>
24
+ <path class="st3" d="M220.9,417.4c-1.2,0.7-2.5,1.2-3.8,1.5c-1.1-1.2-2.7-1.9-4.4-1.9c-3.3,0-6.1,2.7-6.1,6.1
25
+ c0,0.5,0.1,0.9,0.2,1.4c-5-0.3-9.5-2.7-12.5-6.3c-0.5,0.9-0.8,1.9-0.8,3c0,2.1,1.1,4,2.7,5c-1,0-1.9-0.3-2.7-0.8c0,0,0,0.1,0,0.1
26
+ c0,2.9,2.1,5.4,4.9,5.9c-0.5,0.1-1,0.2-1.6,0.2c-0.4,0-0.8,0-1.1-0.1c0.8,2.4,3,4.2,5.7,4.2c-2.1,1.6-4.7,2.6-7.5,2.6
27
+ c-0.5,0-1,0-1.4-0.1c2.7,1.7,5.9,2.7,9.3,2.7c11.1,0,17.2-9.2,17.2-17.2c0-0.3,0-0.5,0-0.8c1.2-0.9,2.2-1.9,3-3.1
28
+ c-1.1,0.5-2.3,0.8-3.5,1C219.5,420,220.5,418.9,220.9,417.4z"/>
29
+ <path class="st3" d="M231,397h-24v-8h12c4.4,0,8-3.6,8-8v-32c0-4.4-3.6-8-8-8h-12c0-4.4-3.6-8-8-8h-64c-4.4,0-8,3.6-8,8v8h-4
30
+ c-4.4,0-8,3.6-8,8v32c0,4.4,3.6,8,8,8h4v4h-8c-4.4,0-8,3.6-8,8v40c0,4.4,3.6,8,8,8h40c4.4,0,8-3.6,8-8v-36h8v40c0,4.4,3.6,8,8,8
31
+ h48c4.4,0,8-3.6,8-8v-48C239,400.6,235.4,397,231,397z M207,345h12c2.2,0,4,1.8,4,4v32c0,2.2-1.8,4-4,4h-12V345z M123,393
32
+ c-2.2,0-4-1.8-4-4v-32c0-2.2,1.8-4,4-4h4v40H123z M163,449c0,2.2-1.8,4-4,4h-40c-2.2,0-4-1.8-4-4v-40c0-2.2,1.8-4,4-4h8
33
+ c0,4.4,3.6,8,8,8h28V449z M135,409c-2.2,0-4-1.8-4-4v-64c0-2.2,1.8-4,4-4h64c2.2,0,4,1.8,4,4v64c0,2.2-1.8,4-4,4H135z M235,453
34
+ c0,2.2-1.8,4-4,4h-48c-2.2,0-4-1.8-4-4v-40h20c4.4,0,8-3.6,8-8v-4h24c2.2,0,4,1.8,4,4V453z"/>
35
+ <polygon class="st3" points="135,417 135,425 127,425 127,433 135,433 135,441 143,441 143,433 151,433 151,425 143,425 143,417
36
+ "/>
37
+ </g>
38
+ </g>
39
+ </svg>
widgets/so-social-media-buttons-widget/data/networks.php CHANGED
@@ -2,259 +2,259 @@
2
 
3
  return array(
4
  'facebook' => array(
5
- 'label' => __( 'Facebook', 'siteorigin-widgets' ),
6
  'base_url' => 'https://www.facebook.com/',
7
  'icon_color' => '#FFFFFF',
8
  'button_color' => '#3A5795'
9
  ),
10
  'twitter' => array(
11
- 'label' => __( 'Twitter', 'siteorigin-widgets' ),
12
  'base_url' => 'https://twitter.com/',
13
  'icon_color' => '#FFFFFF',
14
  'button_color' => '#78BDF1'
15
  ),
16
  'google-plus' => array(
17
- 'label' => __( 'Google+', 'siteorigin-widgets' ),
18
  'base_url' => 'https://plus.google.com/',
19
  'icon_color' => '#FFFFFF',
20
  'button_color' => '#DD4B39'
21
  ),
22
  'rss' => array(
23
- 'label' => __( 'RSS', 'siteorigin-widgets' ),
24
  'base_url' => get_bloginfo('rss_url'),
25
  'icon_color' => '#FFFFFF',
26
  'button_color' => '#FAA21B'
27
  ),
28
  'envelope' => array(
29
- 'label' => __( 'Email', 'siteorigin-widgets' ),
30
  'base_url' => 'mailto:',
31
  'icon_color' => '#FFFFFF',
32
  'button_color' => '#99C4E6'
33
  ),
34
  'linkedin' => array(
35
- 'label' => __( 'LinkedIn', 'siteorigin-widgets' ),
36
  'base_url' => 'https://www.linkedin.com/',
37
  'icon_color' => '#FFFFFF',
38
  'button_color' => '#0177B4'
39
  ),
40
  'pinterest' => array(
41
- 'label' => __( 'Pinterest', 'siteorigin-widgets' ),
42
  'base_url' => 'https://www.pinterest.com/',
43
  'icon_color' => '#FFFFFF',
44
  'button_color' => '#DB7C83'
45
  ),
46
  'tumblr' => array(
47
- 'label' => __( 'Tumblr', 'siteorigin-widgets' ),
48
  'base_url' => 'https://www.tumblr.com/',
49
  'icon_color' => '#FFFFFF',
50
  'button_color' => '#36465D'
51
  ),
52
  'instagram' => array(
53
- 'label' => __( 'Instagram', 'siteorigin-widgets' ),
54
  'base_url' => 'https://instagram.com/',
55
  'icon_color' => '#FFFFFF',
56
  'button_color' => '#3D739C'
57
  ),
58
  'vk' => array(
59
- 'label' => __( 'VK', 'siteorigin-widgets' ),
60
  'base_url' => 'https://vk.com/',
61
  'icon_color' => '#FFFFFF',
62
  'button_color' => '#537599'
63
  ),
64
  'flickr' => array(
65
- 'label' => __( 'Flickr', 'siteorigin-widgets' ),
66
  'base_url' => 'https://www.flickr.com/',
67
  'icon_color' => '#FFFFFF',
68
  'button_color' => '#D40057'
69
  ),
70
  'vine' => array(
71
- 'label' => __( 'Vine', 'siteorigin-widgets' ),
72
  'base_url' => 'https://vine.co/',
73
  'icon_color' => '#FFFFFF',
74
  'button_color' => '#17B48A'
75
  ),
76
  'behance' => array(
77
- 'label' => __( 'Behance', 'siteorigin-widgets' ),
78
  'base_url' => 'https://www.behance.net/',
79
  'icon_color' => '#FFFFFF',
80
  'button_color' => '#333333'
81
  ),
82
  'bitbucket' => array(
83
- 'label' => __( 'Bitbucket', 'siteorigin-widgets' ),
84
  'base_url' => 'https://bitbucket.org/',
85
  'icon_color' => '#FFFFFF',
86
  'button_color' => '#205081'
87
  ),
88
  'codepen' => array(
89
- 'label' => __( 'Codepen', 'siteorigin-widgets' ),
90
  'base_url' => 'https://codepen.io/',
91
  'icon_color' => '#FFFFFF',
92
  'button_color' => '#2A2A2A'
93
  ),
94
  'delicious' => array(
95
- 'label' => __( 'Delicious', 'siteorigin-widgets' ),
96
  'base_url' => 'https://delicious.com/',
97
  'icon_color' => '#FFFFFF',
98
  'button_color' => '#58ACFD'
99
  ),
100
  'deviantart' => array(
101
- 'label' => __( 'deviantArt', 'siteorigin-widgets' ),
102
  'base_url' => 'http://www.deviantart.com/',
103
  'icon_color' => '#FFFFFF',
104
  'button_color' => '#B2C01C'
105
  ),
106
  'dribbble' => array(
107
- 'label' => __( 'Dribbble', 'siteorigin-widgets' ),
108
  'base_url' => 'https://dribbble.com/',
109
  'icon_color' => '#FFFFFF',
110
  'button_color' => '#F26798'
111
  ),
112
  'dropbox' => array(
113
- 'label' => __( 'Dropbox', 'siteorigin-widgets' ),
114
  'base_url' => 'https://www.dropbox.com/',
115
  'icon_color' => '#FFFFFF',
116
  'button_color' => '#1388E6'
117
  ),
118
  'foursquare' => array(
119
- 'label' => __( 'Foursquare', 'siteorigin-widgets' ),
120
  'base_url' => 'https://foursquare.com/',
121
  'icon_color' => '#FFFFFF',
122
  'button_color' => '#EB4E79'
123
  ),
124
  'github' => array(
125
- 'label' => __( 'Github', 'siteorigin-widgets' ),
126
  'base_url' => 'https://github.com/',
127
  'icon_color' => '#FFFFFF',
128
  'button_color' => '#202021'
129
  ),
130
  'gittip' => array(
131
- 'label' => __( 'Gratipay', 'siteorigin-widgets' ),
132
  'base_url' => 'https://gratipay.com/',
133
  'icon_color' => '#FFFFFF',
134
  'button_color' => '#653614'
135
  ),
136
  'hacker-news' => array(
137
- 'label' => __( 'Hacker News', 'siteorigin-widgets' ),
138
  'base_url' => 'https://news.ycombinator.com/',
139
  'icon_color' => '#FFFFFF',
140
  'button_color' => '#FF6600'
141
  ),
142
  'jsfiddle' => array(
143
- 'label' => __( 'JSFiddle', 'siteorigin-widgets' ),
144
  'base_url' => 'http://jsfiddle.net/',
145
  'icon_color' => '#FFFFFF',
146
  'button_color' => '#4679BD'
147
  ),
148
  'lastfm' => array(
149
- 'label' => __( 'Last.fm', 'siteorigin-widgets' ),
150
  'base_url' => 'https://www.last.fm/',
151
  'icon_color' => '#FFFFFF',
152
  'button_color' => '#C02C0C'
153
  ),
154
  'reddit' => array(
155
- 'label' => __( 'Reddit', 'siteorigin-widgets' ),
156
  'base_url' => 'https://www.reddit.com/',
157
  'icon_color' => '#FFFFFF',
158
  'button_color' => '#CEE3F8'
159
  ),
160
  'slack' => array(
161
- 'label' => __( 'Slack', 'siteorigin-widgets' ),
162
  'base_url' => 'https://www.slack.com/',
163
  'icon_color' => '#FFFFFF',
164
  'button_color' => '#4D394B'
165
  ),
166
  'slideshare' => array(
167
- 'label' => __( 'Slideshare', 'siteorigin-widgets' ),
168
  'base_url' => 'https://www.slideshare.net/',
169
  'icon_color' => '#FFFFFF',
170
  'button_color' => '#00A8AA'
171
  ),
172
  'soundcloud' => array(
173
- 'label' => __( 'Soundcloud', 'siteorigin-widgets' ),
174
  'base_url' => 'https://soundcloud.com/',
175
  'icon_color' => '#FFFFFF',
176
  'button_color' => '#FE4600'
177
  ),
178
  'spotify' => array(
179
- 'label' => __( 'Spotify', 'siteorigin-widgets' ),
180
  'base_url' => 'https://www.spotify.com/',
181
  'icon_color' => '#FFFFFF',
182
  'button_color' => '#7BB72F'
183
  ),
184
  'stack-exchange' => array(
185
- 'label' => __( 'Stack Exchange', 'siteorigin-widgets' ),
186
  'base_url' => 'http://stackexchange.com/',
187
  'icon_color' => '#FFFFFF',
188
  'button_color' => '#245598'
189
  ),
190
  'stack-overflow' => array(
191
- 'label' => __( 'Stack Overflow', 'siteorigin-widgets' ),
192
  'base_url' => 'http://stackoverflow.com/',
193
  'icon_color' => '#FFFFFF',
194
  'button_color' => '#F57920'
195
  ),
196
  'steam' => array(
197
- 'label' => __( 'Steam', 'siteorigin-widgets' ),
198
  'base_url' => 'http://steamcommunity.com/',
199
  'icon_color' => '#FFFFFF',
200
  'button_color' => '#171A21'
201
  ),
202
  'stumbleupon' => array(
203
- 'label' => __( 'StumbleUpon', 'siteorigin-widgets' ),
204
  'base_url' => 'https://www.stumbleupon.com/',
205
  'icon_color' => '#FFFFFF',
206
  'button_color' => '#EB4924'
207
  ),
208
  'trello' => array(
209
- 'label' => __( 'Trello', 'siteorigin-widgets' ),
210
  'base_url' => 'https://trello.com/',
211
  'icon_color' => '#FFFFFF',
212
  'button_color' => '#0E74AF'
213
  ),
214
  'tripadvisor' => array(
215
- 'label' => __( 'TripAdvisor', 'siteorigin-widgets' ),
216
  'base_url' => 'https://www.tripadvisor.com/',
217
  'icon_color' => '#FFFFFF',
218
  'button_color' => '#589442'
219
  ),
220
  'twitch' => array(
221
- 'label' => __( 'Twitch', 'siteorigin-widgets' ),
222
  'base_url' => 'https://www.twitch.tv/',
223
  'icon_color' => '#FFFFFF',
224
  'button_color' => '#6542A6'
225
  ),
226
  'vimeo-square' => array(
227
- 'label' => __( 'Vimeo', 'siteorigin-widgets' ),
228
  'base_url' => 'https://vimeo.com/',
229
  'icon_color' => '#FFFFFF',
230
  'button_color' => '#5BC8FF'
231
  ),
232
  'wordpress' => array(
233
- 'label' => __( 'Wordpress', 'siteorigin-widgets' ),
234
  'base_url' => 'https://wordpress.org/',
235
  'icon_color' => '#797979',
236
  'button_color' => '#222222'
237
  ),
238
  'xing' => array(
239
- 'label' => __( 'Xing', 'siteorigin-widgets' ),
240
  'base_url' => 'https://www.xing.com/',
241
  'icon_color' => '#FFFFFF',
242
  'button_color' => '#00605E'
243
  ),
244
  'yahoo' => array(
245
- 'label' => __( 'Yahoo', 'siteorigin-widgets' ),
246
  'base_url' => 'https://yahoo.com/',
247
  'icon_color' => '#FFFFFF',
248
  'button_color' => '#4101AF'
249
  ),
250
  'yelp' => array(
251
- 'label' => __( 'Yelp', 'siteorigin-widgets' ),
252
  'base_url' => 'https://www.yelp.com/',
253
  'icon_color' => '#FFFFFF',
254
  'button_color' => '#B4282E'
255
  ),
256
  'youtube' => array(
257
- 'label' => __( 'YouTube', 'siteorigin-widgets' ),
258
  'base_url' => 'https://www.youtube.com/',
259
  'icon_color' => '#FFFFFF',
260
  'button_color' => '#CF3427'
2
 
3
  return array(
4
  'facebook' => array(
5
+ 'label' => __( 'Facebook', 'so-widgets-bundle' ),
6
  'base_url' => 'https://www.facebook.com/',
7
  'icon_color' => '#FFFFFF',
8
  'button_color' => '#3A5795'
9
  ),
10
  'twitter' => array(
11
+ 'label' => __( 'Twitter', 'so-widgets-bundle' ),
12
  'base_url' => 'https://twitter.com/',
13
  'icon_color' => '#FFFFFF',
14
  'button_color' => '#78BDF1'
15
  ),
16
  'google-plus' => array(
17
+ 'label' => __( 'Google+', 'so-widgets-bundle' ),
18
  'base_url' => 'https://plus.google.com/',
19
  'icon_color' => '#FFFFFF',
20
  'button_color' => '#DD4B39'
21
  ),
22
  'rss' => array(
23
+ 'label' => __( 'RSS', 'so-widgets-bundle' ),
24
  'base_url' => get_bloginfo('rss_url'),
25
  'icon_color' => '#FFFFFF',
26
  'button_color' => '#FAA21B'
27
  ),
28
  'envelope' => array(
29
+ 'label' => __( 'Email', 'so-widgets-bundle' ),
30
  'base_url' => 'mailto:',
31
  'icon_color' => '#FFFFFF',
32
  'button_color' => '#99C4E6'
33
  ),
34
  'linkedin' => array(
35
+ 'label' => __( 'LinkedIn', 'so-widgets-bundle' ),
36
  'base_url' => 'https://www.linkedin.com/',
37
  'icon_color' => '#FFFFFF',
38
  'button_color' => '#0177B4'
39
  ),
40
  'pinterest' => array(
41
+ 'label' => __( 'Pinterest', 'so-widgets-bundle' ),
42
  'base_url' => 'https://www.pinterest.com/',
43
  'icon_color' => '#FFFFFF',
44
  'button_color' => '#DB7C83'
45
  ),
46
  'tumblr' => array(
47
+ 'label' => __( 'Tumblr', 'so-widgets-bundle' ),
48
  'base_url' => 'https://www.tumblr.com/',
49
  'icon_color' => '#FFFFFF',
50
  'button_color' => '#36465D'
51
  ),
52
  'instagram' => array(
53
+ 'label' => __( 'Instagram', 'so-widgets-bundle' ),
54
  'base_url' => 'https://instagram.com/',
55
  'icon_color' => '#FFFFFF',
56
  'button_color' => '#3D739C'
57
  ),
58
  'vk' => array(
59
+ 'label' => __( 'VK', 'so-widgets-bundle' ),
60
  'base_url' => 'https://vk.com/',
61
  'icon_color' => '#FFFFFF',
62
  'button_color' => '#537599'
63
  ),
64
  'flickr' => array(
65
+ 'label' => __( 'Flickr', 'so-widgets-bundle' ),
66
  'base_url' => 'https://www.flickr.com/',
67
  'icon_color' => '#FFFFFF',
68
  'button_color' => '#D40057'
69
  ),
70
  'vine' => array(
71
+ 'label' => __( 'Vine', 'so-widgets-bundle' ),
72
  'base_url' => 'https://vine.co/',
73
  'icon_color' => '#FFFFFF',
74
  'button_color' => '#17B48A'
75
  ),
76
  'behance' => array(
77
+ 'label' => __( 'Behance', 'so-widgets-bundle' ),
78
  'base_url' => 'https://www.behance.net/',
79
  'icon_color' => '#FFFFFF',
80
  'button_color' => '#333333'
81
  ),
82
  'bitbucket' => array(
83
+ 'label' => __( 'Bitbucket', 'so-widgets-bundle' ),
84
  'base_url' => 'https://bitbucket.org/',
85
  'icon_color' => '#FFFFFF',
86
  'button_color' => '#205081'
87
  ),
88
  'codepen' => array(
89
+ 'label' => __( 'Codepen', 'so-widgets-bundle' ),
90
  'base_url' => 'https://codepen.io/',
91
  'icon_color' => '#FFFFFF',
92
  'button_color' => '#2A2A2A'
93
  ),
94
  'delicious' => array(
95
+ 'label' => __( 'Delicious', 'so-widgets-bundle' ),
96
  'base_url' => 'https://delicious.com/',
97
  'icon_color' => '#FFFFFF',
98
  'button_color' => '#58ACFD'
99
  ),
100
  'deviantart' => array(
101
+ 'label' => __( 'deviantArt', 'so-widgets-bundle' ),
102
  'base_url' => 'http://www.deviantart.com/',
103
  'icon_color' => '#FFFFFF',
104
  'button_color' => '#B2C01C'
105
  ),
106
  'dribbble' => array(
107
+ 'label' => __( 'Dribbble', 'so-widgets-bundle' ),
108
  'base_url' => 'https://dribbble.com/',
109
  'icon_color' => '#FFFFFF',
110
  'button_color' => '#F26798'
111
  ),
112
  'dropbox' => array(
113
+ 'label' => __( 'Dropbox', 'so-widgets-bundle' ),
114
  'base_url' => 'https://www.dropbox.com/',
115
  'icon_color' => '#FFFFFF',
116
  'button_color' => '#1388E6'
117
  ),
118
  'foursquare' => array(
119
+ 'label' => __( 'Foursquare', 'so-widgets-bundle' ),
120
  'base_url' => 'https://foursquare.com/',
121
  'icon_color' => '#FFFFFF',
122
  'button_color' => '#EB4E79'
123
  ),
124
  'github' => array(
125
+ 'label' => __( 'Github', 'so-widgets-bundle' ),
126
  'base_url' => 'https://github.com/',
127
  'icon_color' => '#FFFFFF',
128
  'button_color' => '#202021'
129
  ),
130
  'gittip' => array(
131
+ 'label' => __( 'Gratipay', 'so-widgets-bundle' ),
132
  'base_url' => 'https://gratipay.com/',
133
  'icon_color' => '#FFFFFF',
134
  'button_color' => '#653614'
135
  ),
136
  'hacker-news' => array(
137
+ 'label' => __( 'Hacker News', 'so-widgets-bundle' ),
138
  'base_url' => 'https://news.ycombinator.com/',
139
  'icon_color' => '#FFFFFF',
140
  'button_color' => '#FF6600'
141
  ),
142
  'jsfiddle' => array(
143
+ 'label' => __( 'JSFiddle', 'so-widgets-bundle' ),
144
  'base_url' => 'http://jsfiddle.net/',
145
  'icon_color' => '#FFFFFF',
146
  'button_color' => '#4679BD'
147
  ),
148
  'lastfm' => array(
149
+ 'label' => __( 'Last.fm', 'so-widgets-bundle' ),
150
  'base_url' => 'https://www.last.fm/',
151
  'icon_color' => '#FFFFFF',
152
  'button_color' => '#C02C0C'
153
  ),
154
  'reddit' => array(
155
+ 'label' => __( 'Reddit', 'so-widgets-bundle' ),
156
  'base_url' => 'https://www.reddit.com/',
157
  'icon_color' => '#FFFFFF',
158
  'button_color' => '#CEE3F8'
159
  ),
160
  'slack' => array(
161
+ 'label' => __( 'Slack', 'so-widgets-bundle' ),
162
  'base_url' => 'https://www.slack.com/',
163
  'icon_color' => '#FFFFFF',
164
  'button_color' => '#4D394B'
165
  ),
166
  'slideshare' => array(
167
+ 'label' => __( 'Slideshare', 'so-widgets-bundle' ),
168
  'base_url' => 'https://www.slideshare.net/',
169
  'icon_color' => '#FFFFFF',
170
  'button_color' => '#00A8AA'
171
  ),
172
  'soundcloud' => array(
173
+ 'label' => __( 'Soundcloud', 'so-widgets-bundle' ),
174
  'base_url' => 'https://soundcloud.com/',
175
  'icon_color' => '#FFFFFF',
176
  'button_color' => '#FE4600'
177
  ),
178
  'spotify' => array(
179
+ 'label' => __( 'Spotify', 'so-widgets-bundle' ),
180
  'base_url' => 'https://www.spotify.com/',
181
  'icon_color' => '#FFFFFF',
182
  'button_color' => '#7BB72F'
183
  ),
184
  'stack-exchange' => array(
185
+ 'label' => __( 'Stack Exchange', 'so-widgets-bundle' ),
186
  'base_url' => 'http://stackexchange.com/',
187
  'icon_color' => '#FFFFFF',
188
  'button_color' => '#245598'
189
  ),
190
  'stack-overflow' => array(
191
+ 'label' => __( 'Stack Overflow', 'so-widgets-bundle' ),
192
  'base_url' => 'http://stackoverflow.com/',
193
  'icon_color' => '#FFFFFF',
194
  'button_color' => '#F57920'
195
  ),
196
  'steam' => array(
197
+ 'label' => __( 'Steam', 'so-widgets-bundle' ),
198
  'base_url' => 'http://steamcommunity.com/',
199
  'icon_color' => '#FFFFFF',
200
  'button_color' => '#171A21'
201
  ),
202
  'stumbleupon' => array(
203
+ 'label' => __( 'StumbleUpon', 'so-widgets-bundle' ),
204
  'base_url' => 'https://www.stumbleupon.com/',
205
  'icon_color' => '#FFFFFF',
206
  'button_color' => '#EB4924'
207
  ),
208
  'trello' => array(
209
+ 'label' => __( 'Trello', 'so-widgets-bundle' ),
210
  'base_url' => 'https://trello.com/',
211
  'icon_color' => '#FFFFFF',
212
  'button_color' => '#0E74AF'
213
  ),
214
  'tripadvisor' => array(
215
+ 'label' => __( 'TripAdvisor', 'so-widgets-bundle' ),
216
  'base_url' => 'https://www.tripadvisor.com/',
217
  'icon_color' => '#FFFFFF',
218
  'button_color' => '#589442'
219
  ),
220
  'twitch' => array(
221
+ 'label' => __( 'Twitch', 'so-widgets-bundle' ),
222
  'base_url' => 'https://www.twitch.tv/',
223
  'icon_color' => '#FFFFFF',
224
  'button_color' => '#6542A6'
225
  ),
226
  'vimeo-square' => array(
227
+ 'label' => __( 'Vimeo', 'so-widgets-bundle' ),
228
  'base_url' => 'https://vimeo.com/',
229
  'icon_color' => '#FFFFFF',
230
  'button_color' => '#5BC8FF'
231
  ),
232
  'wordpress' => array(
233
+ 'label' => __( 'Wordpress', 'so-widgets-bundle' ),
234
  'base_url' => 'https://wordpress.org/',
235
  'icon_color' => '#797979',
236
  'button_color' => '#222222'
237
  ),
238
  'xing' => array(
239
+ 'label' => __( 'Xing', 'so-widgets-bundle' ),
240
  'base_url' => 'https://www.xing.com/',
241
  'icon_color' => '#FFFFFF',
242
  'button_color' => '#00605E'
243
  ),
244
  'yahoo' => array(
245
+ 'label' => __( 'Yahoo', 'so-widgets-bundle' ),
246
  'base_url' => 'https://yahoo.com/',
247
  'icon_color' => '#FFFFFF',
248
  'button_color' => '#4101AF'
249
  ),
250
  'yelp' => array(
251
+ 'label' => __( 'Yelp', 'so-widgets-bundle' ),
252
  'base_url' => 'https://www.yelp.com/',
253
  'icon_color' => '#FFFFFF',
254
  'button_color' => '#B4282E'
255
  ),
256
  'youtube' => array(
257
+ 'label' => __( 'YouTube', 'so-widgets-bundle' ),
258
  'base_url' => 'https://www.youtube.com/',
259
  'icon_color' => '#FFFFFF',
260
  'button_color' => '#CF3427'
widgets/so-social-media-buttons-widget/so-social-media-buttons-widget.php CHANGED
@@ -1,10 +1,10 @@
1
  <?php
2
 
3
  /*
4
- Widget Name: Social media buttons widget
5
  Description: Customizable buttons which link to all your social media profiles.
6
  Author: SiteOrigin
7
- Author URI: http://siteorigin.com
8
  */
9
 
10
 
@@ -23,16 +23,16 @@ class SiteOrigin_Widget_SocialMediaButtons_Widget extends SiteOrigin_Widget {
23
 
24
  parent::__construct(
25
  'sow-social-media-buttons',
26
- __( 'SiteOrigin Social Media Buttons', 'siteorigin-widgets' ),
27
  array(
28
- 'description' => __( 'A social media buttons widget.', 'siteorigin-widgets' )
29
  ),
30
  array(),
31
  array(
32
  'networks' => array(
33
  'type' => 'repeater',
34
- 'label' => __( 'Networks', 'siteorigin-widgets' ),
35
- 'item_name' => __( 'Network', 'siteorigin-widgets' ),
36
  'item_label' => array(
37
  'selector' => "[id*='networks-name'] :selected",
38
  'update_event' => 'change',
@@ -42,100 +42,100 @@ class SiteOrigin_Widget_SocialMediaButtons_Widget extends SiteOrigin_Widget {
42
  'name' => array(
43
  'type' => 'select',
44
  'label' => '',
45
- 'prompt' => __( 'Select network', 'siteorigin-widgets' ),
46
  'options' => $network_names
47
  ),
48
  'url' => array(
49
  'type' => 'text',
50
- 'label' => __( 'URL', 'siteorigin-widgets' )
51
  ),
52
  'icon_color' => array(
53
  'type' => 'color',
54
- 'label' => __( 'Icon color', 'siteorigin-widgets' )
55
  ),
56
  'button_color' => array(
57
  'type' => 'color',
58
- 'label' => __( 'Background color', 'siteorigin-widgets' )
59
  )
60
  )
61
  ),
62
  'design' => array(
63
  'type' => 'section',
64
- 'label' => __( 'Design and layout', 'siteorigin-widgets' ),
65
  'hide' => true,
66
  'fields' => array(
67
  'new_window' => array(
68
  'type' => 'checkbox',
69
- 'label' => __( 'Open in a new window', 'siteorigin-widgets' ),
70
  'default' => true
71
  ),
72
  'theme' => array(
73
  'type' => 'select',
74
- 'label' => __( 'Button theme', 'siteorigin-widgets' ),
75
  'default' => 'atom',
76
  'options' => array(
77
- 'atom' => __( 'Atom', 'siteorigin-widgets' ),
78
- 'flat' => __( 'Flat', 'siteorigin-widgets' ),
79
- 'wire' => __( 'Wire', 'siteorigin-widgets' ),
80
  ),
81
  ),
82
  'hover' => array(
83
  'type' => 'checkbox',
84
- 'label' => __( 'Use hover effects' ),
85
  'default' => true
86
  ),
87
  'icon_size' => array(
88
  'type' => 'select',
89
- 'label' => __( 'Icon size', 'siteorigin-widgets' ),
90
  'options' => array(
91
- '1' => __( 'Normal', 'siteorigin-widgets' ),
92
- '1.33' => __( 'Medium', 'siteorigin-widgets' ),
93
- '1.66' => __( 'Large', 'siteorigin-widgets' ),
94
- '2' => __( 'Extra large', 'siteorigin-widgets' )
95
  )
96
  ),
97
  'rounding' => array(
98
  'type' => 'select',
99
- 'label' => __( 'Rounding', 'siteorigin-widgets' ),
100
  'default' => '0.25',
101
  'options' => array(
102
- '0' => __( 'None', 'siteorigin-widgets' ),
103
- '0.25' => __( 'Slightly rounded', 'siteorigin-widgets' ),
104
- '0.5' => __( 'Very rounded', 'siteorigin-widgets' ),
105
- '1.5' => __( 'Completely rounded', 'siteorigin-widgets' ),
106
  ),
107
  ),
108
  'padding' => array(
109
  'type' => 'select',
110
- 'label' => __( 'Padding', 'siteorigin-widgets' ),
111
  'default' => '1',
112
  'options' => array(
113
- '0.5' => __( 'Low', 'siteorigin-widgets' ),
114
- '1' => __( 'Medium', 'siteorigin-widgets' ),
115
- '1.4' => __( 'High', 'siteorigin-widgets' ),
116
- '1.8' => __( 'Very high', 'siteorigin-widgets' ),
117
  ),
118
  ),
119
  'align' => array(
120
  'type' => 'select',
121
- 'label' => __( 'Align', 'siteorigin-widgets' ),
122
  'default' => 'left',
123
  'options' => array(
124
- 'left' => __( 'Left', 'siteorigin-widgets' ),
125
- 'right' => __( 'Right', 'siteorigin-widgets' ),
126
- 'center' => __( 'Center', 'siteorigin-widgets' ),
127
- 'justify' => __( 'Justify', 'siteorigin-widgets' ),
128
  ),
129
  ),
130
  'margin' => array(
131
  'type' => 'select',
132
- 'label' => __( 'Margin', 'siteorigin-widgets' ),
133
  'default' => '0.1',
134
  'options' => array(
135
- '0.1' => __( 'Low', 'siteorigin-widgets' ),
136
- '0.2' => __( 'Medium', 'siteorigin-widgets' ),
137
- '0.3' => __( 'High', 'siteorigin-widgets' ),
138
- '0.4' => __( 'Very high', 'siteorigin-widgets' ),
139
  ),
140
  ),
141
  )
@@ -162,7 +162,7 @@ class SiteOrigin_Widget_SocialMediaButtons_Widget extends SiteOrigin_Widget {
162
  }
163
 
164
  function enqueue_admin_scripts() {
165
- wp_enqueue_script( 'sow-social-media-buttons', siteorigin_widget_get_plugin_dir_url( 'social-media-buttons' ) . 'js/social-media-buttons-admin.js', array( 'jquery' ), SOW_BUNDLE_VERSION );
166
  }
167
 
168
  function get_template_name( $instance ) {
@@ -252,4 +252,4 @@ class SiteOrigin_Widget_SocialMediaButtons_Widget extends SiteOrigin_Widget {
252
  }
253
  }
254
 
255
- siteorigin_widget_register( 'social-media-buttons', __FILE__ );
1
  <?php
2
 
3
  /*
4
+ Widget Name: Social Media Buttons
5
  Description: Customizable buttons which link to all your social media profiles.
6
  Author: SiteOrigin
7
+ Author URI: https://siteorigin.com
8
  */
9
 
10
 
23
 
24
  parent::__construct(
25
  'sow-social-media-buttons',
26
+ __( 'SiteOrigin Social Media Buttons', 'so-widgets-bundle' ),
27
  array(
28
+ 'description' => __( 'A social media buttons widget.', 'so-widgets-bundle' )
29
  ),
30
  array(),
31
  array(
32
  'networks' => array(
33
  'type' => 'repeater',
34
+ 'label' => __( 'Networks', 'so-widgets-bundle' ),
35
+ 'item_name' => __( 'Network', 'so-widgets-bundle' ),
36
  'item_label' => array(
37
  'selector' => "[id*='networks-name'] :selected",
38
  'update_event' => 'change',
42
  'name' => array(
43
  'type' => 'select',
44
  'label' => '',
45
+ 'prompt' => __( 'Select network', 'so-widgets-bundle' ),
46
  'options' => $network_names
47
  ),
48
  'url' => array(
49
  'type' => 'text',
50
+ 'label' => __( 'URL', 'so-widgets-bundle' )
51
  ),
52
  'icon_color' => array(
53
  'type' => 'color',
54
+ 'label' => __( 'Icon color', 'so-widgets-bundle' )
55
  ),
56
  'button_color' => array(
57
  'type' => 'color',
58
+ 'label' => __( 'Background color', 'so-widgets-bundle' )
59
  )
60
  )
61
  ),
62
  'design' => array(
63
  'type' => 'section',
64
+ 'label' => __( 'Design and layout', 'so-widgets-bundle' ),
65
  'hide' => true,
66
  'fields' => array(
67
  'new_window' => array(
68
  'type' => 'checkbox',
69
+ 'label' => __( 'Open in a new window', 'so-widgets-bundle' ),
70
  'default' => true
71
  ),
72
  'theme' => array(
73
  'type' => 'select',
74
+ 'label' => __( 'Button theme', 'so-widgets-bundle' ),
75
  'default' => 'atom',
76
  'options' => array(
77
+ 'atom' => __( 'Atom', 'so-widgets-bundle' ),
78
+ 'flat' => __( 'Flat', 'so-widgets-bundle' ),
79
+ 'wire' => __( 'Wire', 'so-widgets-bundle' ),
80
  ),
81
  ),
82
  'hover' => array(
83
  'type' => 'checkbox',
84
+ 'label' => __( 'Use hover effects', 'so-widgets-bundle' ),
85
  'default' => true
86
  ),
87
  'icon_size' => array(
88
  'type' => 'select',
89
+ 'label' => __( 'Icon size', 'so-widgets-bundle' ),
90
  'options' => array(
91
+ '1' => __( 'Normal', 'so-widgets-bundle' ),
92
+ '1.33' => __( 'Medium', 'so-widgets-bundle' ),
93
+ '1.66' => __( 'Large', 'so-widgets-bundle' ),
94
+ '2' => __( 'Extra large', 'so-widgets-bundle' )
95
  )
96
  ),
97
  'rounding' => array(
98
  'type' => 'select',
99
+ 'label' => __( 'Rounding', 'so-widgets-bundle' ),
100
  'default' => '0.25',
101
  'options' => array(
102
+ '0' => __( 'None', 'so-widgets-bundle' ),
103
+ '0.25' => __( 'Slightly rounded', 'so-widgets-bundle' ),
104
+ '0.5' => __( 'Very rounded', 'so-widgets-bundle' ),
105
+ '1.5' => __( 'Completely rounded', 'so-widgets-bundle' ),
106
  ),
107
  ),
108
  'padding' => array(
109
  'type' => 'select',
110
+ 'label' => __( 'Padding', 'so-widgets-bundle' ),
111
  'default' => '1',
112
  'options' => array(
113
+ '0.5' => __( 'Low', 'so-widgets-bundle' ),
114
+ '1' => __( 'Medium', 'so-widgets-bundle' ),
115
+ '1.4' => __( 'High', 'so-widgets-bundle' ),
116
+ '1.8' => __( 'Very high', 'so-widgets-bundle' ),
117
  ),
118
  ),
119
  'align' => array(
120
  'type' => 'select',
121
+ 'label' => __( 'Align', 'so-widgets-bundle' ),
122
  'default' => 'left',
123
  'options' => array(
124
+ 'left' => __( 'Left', 'so-widgets-bundle' ),
125
+ 'right' => __( 'Right', 'so-widgets-bundle' ),
126
+ 'center' => __( 'Center', 'so-widgets-bundle' ),
127
+ 'justify' => __( 'Justify', 'so-widgets-bundle' ),
128
  ),
129
  ),
130
  'margin' => array(
131
  'type' => 'select',
132
+ 'label' => __( 'Margin', 'so-widgets-bundle' ),
133
  'default' => '0.1',
134
  'options' => array(
135
+ '0.1' => __( 'Low', 'so-widgets-bundle' ),
136
+ '0.2' => __( 'Medium', 'so-widgets-bundle' ),
137
+ '0.3' => __( 'High', 'so-widgets-bundle' ),
138
+ '0.4' => __( 'Very high', 'so-widgets-bundle' ),
139
  ),
140
  ),
141
  )
162
  }
163
 
164
  function enqueue_admin_scripts() {
165
+ wp_enqueue_script( 'sow-social-media-buttons', plugin_dir_url(__FILE__) . 'js/social-media-buttons-admin.js', array( 'jquery' ), SOW_BUNDLE_VERSION );
166
  }
167
 
168
  function get_template_name( $instance ) {
252
  }
253
  }
254
 
255
+ siteorigin_widget_register( 'sow-social-media-buttons', __FILE__, 'SiteOrigin_Widget_SocialMediaButtons_Widget' );
widgets/so-testimonial-widget/assets/banner.svg ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="55 277 240 240" style="enable-background:new 55 277 240 240;" xml:space="preserve">
5
+ <style type="text/css">
6
+ .st0{fill:#1880B6;}
7
+ .st1{fill:#8ED9EF;}
8
+ .st2{fill:#324249;}
9
+ .st3{opacity:0.2;}
10
+ .st4{fill:#F2F0DA;}
11
+ </style>
12
+ <rect id="Testimonials_2_" x="55" y="277" class="st0" width="240" height="240"/>
13
+ <g>
14
+ <g>
15
+ <path class="st1" d="M211,389v-52c0-2.2-1.8-4-4-4h-88c-2.2,0-4,1.8-4,4v52c0,2.2,1.8,4,4,4c0,0,30.9,0,33,0s3.6,1.6,3.6,1.6
16
+ L179,418v-23c0-1.1,0.9-2,2-2h26C209.2,393,211,391.2,211,389z"/>
17
+ <path class="st1" d="M211,441c-15.7,0-19.6,7.4-20,8.4v3.6h40v-3.6C230.6,448.4,226.7,441,211,441z"/>
18
+ </g>
19
+ <g>
20
+ <g>
21
+ <path class="st2" d="M215,389v-52c0-4.4-3.6-8-8-8h-88c-4.4,0-8,3.6-8,8v52c0,4.4,3.6,8,8,8h33.2l27.4,27.4
22
+ c0.4,0.4,0.9,0.6,1.4,0.6c0.3,0,0.5,0,0.8-0.2c0.7-0.3,1.2-1,1.2-1.8v-26h24C211.4,397,215,393.4,215,389z M181,393
23
+ c-1.1,0-2,0.9-2,2v23l-23.4-23.4c0,0-1.5-1.6-3.6-1.6s-33,0-33,0c-2.2,0-4-1.8-4-4v-52c0-2.2,1.8-4,4-4h88c2.2,0,4,1.8,4,4v52
24
+ c0,2.2-1.8,4-4,4H181z"/>
25
+ <path class="st2" d="M219.2,437.8c2.3-2.2,3.8-5.3,3.8-8.8v-8c0-4.4-3.6-8-8-8h-8c-4.4,0-8,3.6-8,8v8c0,3.5,1.5,6.6,3.8,8.8
26
+ c-12.2,2.3-15.8,9.6-15.8,11.2v4c0,2.2,1.8,4,4,4h40c2.2,0,4-1.8,4-4v-4C235,447.3,231.3,440.1,219.2,437.8z M203,421
27
+ c0-2.2,1.8-4,4-4h8c2.2,0,4,1.8,4,4v8c0,4.4-3.6,8-8,8s-8-3.6-8-8V421z M231,453h-40v-3.6c0.4-1,4.3-8.4,20-8.4s19.6,7.4,20,8.4
28
+ V453z"/>
29
+ </g>
30
+ </g>
31
+ <g class="st3">
32
+ <path d="M133,353h24c1.1,0,2-0.9,2-2s-0.9-2-2-2h-24c-1.1,0-2,0.9-2,2S131.9,353,133,353z"/>
33
+ <path d="M169,353h8c1.1,0,2-0.9,2-2s-0.9-2-2-2h-8c-1.1,0-2,0.9-2,2S167.9,353,169,353z"/>
34
+ <path d="M151,363c0,1.1,0.9,2,2,2h40c1.1,0,2-0.9,2-2s-0.9-2-2-2h-40C151.9,361,151,361.9,151,363z"/>
35
+ <path d="M161,373h-28c-1.1,0-2,0.9-2,2s0.9,2,2,2h28c1.1,0,2-0.9,2-2S162.1,373,161,373z"/>
36
+ <path d="M193,373h-24c-1.1,0-2,0.9-2,2s0.9,2,2,2h24c1.1,0,2-0.9,2-2S194.1,373,193,373z"/>
37
+ <path d="M133,365h8c1.1,0,2-0.9,2-2s-0.9-2-2-2h-8c-1.1,0-2,0.9-2,2S131.9,365,133,365z"/>
38
+ </g>
39
+ <path class="st4" d="M203,421v8c0,4.4,3.6,8,8,8s8-3.6,8-8v-8c0-2.2-1.8-4-4-4h-8C204.8,417,203,418.8,203,421z"/>
40
+ </g>
41
+ </svg>
widgets/so-testimonial-widget/css/style.css ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .sow-testimonials {
2
+ margin: -10px;
3
+ zoom: 1;
4
+ }
5
+ .sow-testimonials:before {
6
+ content: '';
7
+ display: block;
8
+ }
9
+ .sow-testimonials:after {
10
+ content: '';
11
+ display: table;
12
+ clear: both;
13
+ }
14
+ .sow-testimonials * {
15
+ box-sizing: border-box;
16
+ }
17
+ .sow-testimonials .sow-testimonial-wrapper {
18
+ float: left;
19
+ padding: 10px;
20
+ }
21
+ .sow-testimonials .sow-testimonial-user {
22
+ position: relative;
23
+ }
24
+ .sow-testimonials .sow-testimonial-user .sow-round-image-frame {
25
+ background-size: cover;
26
+ display: inline-block;
27
+ }
28
+ .sow-testimonials .sow-testimonial-user .sow-image-wrapper {
29
+ display: block;
30
+ }
31
+ .sow-testimonials .sow-testimonial-user .sow-text strong {
32
+ display: block;
33
+ }
34
+ .sow-testimonials .sow-testimonial-user .sow-caret {
35
+ position: absolute;
36
+ height: 24px;
37
+ width: 14px;
38
+ top: 20px;
39
+ right: -3px;
40
+ fill: #f0f0f0;
41
+ }
42
+ .sow-testimonials .sow-testimonial-text > *:first-child {
43
+ margin-top: 0;
44
+ }
45
+ .sow-testimonials .sow-testimonial-text > *:last-child {
46
+ margin-bottom: 0;
47
+ }
48
+ .sow-testimonials .sow-user-left .sow-testimonial-user {
49
+ text-align: left;
50
+ }
51
+ .sow-testimonials .sow-user-right .sow-testimonial-user {
52
+ text-align: right;
53
+ }
54
+ .sow-testimonials .sow-user-middle .sow-testimonial-user {
55
+ text-align: center;
56
+ }
widgets/so-testimonial-widget/so-testimonial-widget.php ADDED
@@ -0,0 +1,332 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Widget Name: Testimonials
4
+ Description: Display some testimonials.
5
+ Author: SiteOrigin
6
+ Author URI: https://siteorigin.com
7
+ */
8
+
9
+ class SiteOrigin_Widgets_Testimonials_Widget extends SiteOrigin_Widget {
10
+
11
+ function __construct() {
12
+ parent::__construct(
13
+ 'sow-testimonials',
14
+ __('SiteOrigin Testimonials', 'so-widgets-bundle'),
15
+ array(
16
+ 'description' => __('Share your product/service testimonials in a variety of different ways.', 'so-widgets-bundle'),
17
+ 'help' => 'https://siteorigin.com/widgets-bundle/testimonial-widget-documentation/'
18
+ ),
19
+ array(
20
+
21
+ ),
22
+ array(
23
+ 'title' => array(
24
+ 'type' => 'text',
25
+ 'label' => __('Title', 'so-widgets-bundle'),
26
+ ),
27
+ 'testimonials' => array(
28
+ 'type' => 'repeater',
29
+ 'label' => __( 'Testimonials', 'so-widgets-bundle' ),
30
+ 'item_name' => __( 'Testimonial', 'so-widgets-bundle' ),
31
+ 'item_label' => array(
32
+ 'selector' => "[id*='testimonials-name']",
33
+ 'update_event' => 'change',
34
+ 'value_method' => 'val'
35
+ ),
36
+ 'fields' => array(
37
+ 'name' => array(
38
+ 'type' => 'text',
39
+ 'label' => __('Name', 'so-widgets-bundle'),
40
+ 'description' => __('The author of the testimonial', 'so-widgets-bundle'),
41
+ ),
42
+
43
+ 'location' => array(
44
+ 'type' => 'text',
45
+ 'label' => __('Location', 'so-widgets-bundle'),
46
+ 'description' => __('Their location or company name', 'so-widgets-bundle'),
47
+ ),
48
+
49
+ 'image' => array(
50
+ 'type' => 'media',
51
+ 'label' => __('Image', 'so-widgets-bundle'),
52
+ ),
53
+
54
+ 'text' => array(
55
+ 'type' => 'tinymce',
56
+ 'label' => __('Text', 'so-widgets-bundle'),
57
+ 'description' => __('What your customer had to say', 'so-widgets-bundle'),
58
+ ),
59
+
60
+ 'url' => array(
61
+ 'type' => 'text',
62
+ 'label' => __('URL', 'so-widgets-bundle'),
63
+ ),
64
+
65
+ 'new_window' => array(
66
+ 'type' => 'checkbox',
67
+ 'label' => __('Open In New Window', 'so-widgets-bundle'),
68
+ ),
69
+ )
70
+ ),
71
+
72
+ 'settings' => array(
73
+ 'type' => 'section',
74
+ 'label' => __('Settings', 'so-widgets-bundle'),
75
+ 'fields' => array(
76
+
77
+ 'per_line' => array(
78
+ 'type' => 'slider',
79
+ 'label' => __( 'Testimonials per row', 'so-widgets-bundle' ),
80
+ 'min' => 1,
81
+ 'max' => 5,
82
+ 'integer' => true,
83
+ 'default' => 3
84
+ ),
85
+
86
+ 'responsive' => array(
87
+ 'type' => 'section',
88
+ 'label' => __('Responsive', 'so-widgets-bundle'),
89
+ 'hide' => true,
90
+ 'fields' => array(
91
+ 'tablet' => array(
92
+ 'type' => 'section',
93
+ 'label' => __('Tablet', 'so-widgets-bundle'),
94
+ 'fields' => array(
95
+ 'per_line' => array(
96
+ 'type' => 'slider',
97
+ 'label' => __( 'Testimonials per row', 'so-widgets-bundle' ),
98
+ 'min' => 1,
99
+ 'max' => 5,
100
+ 'integer' => true,
101
+ 'default' => 2
102
+ ),
103
+ 'width' => array(
104
+ 'type' => 'text',
105
+ 'label' => __('Resolution', 'so-widgets-bundle'),
106
+ 'description' => __('The resolution to treat as a tablet resolution.', 'so-widgets-bundle'),
107
+ 'default' => 800,
108
+ 'sanitize' => 'intval',
109
+ )
110
+ )
111
+ ),
112
+ 'mobile' => array(
113
+ 'type' => 'section',
114
+ 'label' => __('Mobile Phone', 'so-widgets-bundle'),
115
+ 'fields' => array(
116
+ 'per_line' => array(
117
+ 'type' => 'slider',
118
+ 'label' => __( 'Testimonials per row', 'so-widgets-bundle' ),
119
+ 'min' => 1,
120
+ 'max' => 5,
121
+ 'integer' => true,
122
+ 'default' => 1
123
+ ),
124
+ 'width' => array(
125
+ 'type' => 'text',
126
+ 'label' => __('Resolution', 'so-widgets-bundle'),
127
+ 'description' => __('The resolution to treat as a tablet resolution.', 'so-widgets-bundle'),
128
+ 'default' => 480,
129
+ 'sanitize' => 'intval',
130
+ )
131
+ )
132
+ )
133
+
134
+ )
135
+ ),
136
+
137
+ 'new_window' => array(
138
+ 'type' => 'checkbox',
139
+ 'label' => __('Open links in new window', 'so-widgets-bundle'),
140
+ 'description' => __('Should testimonial URLs open in a new window.', 'so-widgets-bundle'),
141
+ ),
142
+ )
143
+ ),
144
+
145
+ 'design' => array(
146
+ 'type' => 'section',
147
+ 'label' => __('Design', 'so-widgets-bundle'),
148
+ 'fields' => array(
149
+
150
+ 'image' => array(
151
+ 'type' => 'section',
152
+ 'label' => __('Image', 'so-widgets-bundle'),
153
+ 'fields' => array(
154
+ 'image_shape' => array(
155
+ 'type' => 'select',
156
+ 'label' => __('Testimonial image shape', 'so-widgets-bundle'),
157
+ 'options' => array(
158
+ 'square' => __('Square', 'so-widgets-bundle'),
159
+ 'round' => __('Round', 'so-widgets-bundle'),
160
+ ),
161
+ 'default' => 'square',
162
+ ),
163
+
164
+ 'image_size' => array(
165
+ 'type' => 'slider',
166
+ 'label' => __('Image size', 'so-widgets-bundle'),
167
+ 'integer' => true,
168
+ 'default' => 50,
169
+ 'max' => 150,
170
+ 'min' => 20,
171
+ ),
172
+ ),
173
+ ),
174
+
175
+ 'colors' => array(
176
+ 'type' => 'section',
177
+ 'label' => __('Colors', 'so-widgets-bundle'),
178
+ 'fields' => array(
179
+ 'testimonial_background' => array(
180
+ 'type' => 'color',
181
+ 'label' => __('Widget Background', 'so-widgets-bundle'),
182
+ ),
183
+ 'text_background' => array(
184
+ 'type' => 'color',
185
+ 'label' => __('Text Background', 'so-widgets-bundle'),
186
+ 'default' => '#f0f0f0',
187
+ ),
188
+ 'text_color' => array(
189
+ 'type' => 'color',
190
+ 'label' => __('Text Color', 'so-widgets-bundle'),
191
+ 'default' => '#444444',
192
+ ),
193
+ ),
194
+ ),
195
+
196
+ 'padding' => array(
197
+ 'type' => 'slider',
198
+ 'label' => __('Padding', 'so-widgets-bundle'),
199
+ 'integer' => true,
200
+ 'default' => 10,
201
+ 'max' => 100,
202
+ 'min' => 0,
203
+ ),
204
+
205
+ 'border_radius' => array(
206
+ 'type' => 'slider',
207
+ 'label' => __('Padding', 'so-widgets-bundle'),
208
+ 'integer' => true,
209
+ 'default' => 4,
210
+ 'max' => 100,
211
+ 'min' => 0,
212
+ ),
213
+
214
+ 'user_position' => array(
215
+ 'type' => 'select',
216
+ 'label' => __('User position', 'so-widgets-bundle'),
217
+ 'options' => array(
218
+ 'left' => __('Left', 'so-widgets-bundle'),
219
+ 'right' => __('Right', 'so-widgets-bundle'),
220
+ 'middle' => __('Middle', 'so-widgets-bundle'),
221
+ ),
222
+ 'default' => 'left',
223
+ ),
224
+
225
+ 'layout' => array(
226
+ 'type' => 'select',
227
+ 'label' => __('Testimonial layout', 'so-widgets-bundle'),
228
+ 'options' => array(
229
+ 'side' => __('Side by side', 'so-widgets-bundle'),
230
+ 'text_above' => __('Text above user', 'so-widgets-bundle'),
231
+ 'text_below' => __('Text below user', 'so-widgets-bundle'),
232
+ ),
233
+ 'default' => 'side',
234
+ ),
235
+ ),
236
+ ),
237
+ )
238
+ );
239
+ }
240
+
241
+ function initialize(){
242
+ $this->register_frontend_styles( array(
243
+ array(
244
+ 'sow-testimonial',
245
+ plugin_dir_url(__FILE__) . 'css/style.css'
246
+ )
247
+ ) );
248
+ }
249
+
250
+ function caret_svg(){
251
+ static $done = false;
252
+ if( $done ) return;
253
+
254
+ ?>
255
+ <svg style="position: absolute; width: 0; height: 0;" width="0" height="0" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
256
+ <defs>
257
+ <symbol id="icon-caret-down" viewBox="0 0 585 1024">
258
+ <title>caret-down</title>
259
+ <path class="path1" d="M585.143 402.286q0 14.857-10.857 25.714l-256 256q-10.857 10.857-25.714 10.857t-25.714-10.857l-256-256q-10.857-10.857-10.857-25.714t10.857-25.714 25.714-10.857h512q14.857 0 25.714 10.857t10.857 25.714z"></path>
260
+ </symbol>
261
+ <symbol id="icon-caret-up" viewBox="0 0 585 1024">
262
+ <title>caret-up</title>
263
+ <path class="path1" d="M585.143 694.857q0 14.857-10.857 25.714t-25.714 10.857h-512q-14.857 0-25.714-10.857t-10.857-25.714 10.857-25.714l256-256q10.857-10.857 25.714-10.857t25.714 10.857l256 256q10.857 10.857 10.857 25.714z"></path>
264
+ </symbol>
265
+ <symbol id="icon-caret-left" viewBox="0 0 366 1024">
266
+ <title>caret-left</title>
267
+ <path class="path1" d="M365.714 256v512q0 14.857-10.857 25.714t-25.714 10.857-25.714-10.857l-256-256q-10.857-10.857-10.857-25.714t10.857-25.714l256-256q10.857-10.857 25.714-10.857t25.714 10.857 10.857 25.714z"></path>
268
+ </symbol>
269
+ <symbol id="icon-caret-right" viewBox="0 0 366 1024">
270
+ <title>caret-right</title>
271
+ <path class="path1" d="M329.143 512q0 14.857-10.857 25.714l-256 256q-10.857 10.857-25.714 10.857t-25.714-10.857-10.857-25.714v-512q0-14.857 10.857-25.714t25.714-10.857 25.714 10.857l256 256q10.857 10.857 10.857 25.714z"></path>
272
+ </symbol>
273
+ </defs>
274
+ </svg>
275
+ <?php
276
+ $done = true;
277
+ }
278
+
279
+ function get_less_variables( $instance ){
280
+ return array (
281
+ 'image_size' => intval($instance['design']['image']['image_size']) . 'px',
282
+ 'testimonial_size' => round(100/$instance['settings']['per_line'], 4) . '%',
283
+ 'testimonial_padding' => intval($instance['design']['padding']) . 'px',
284
+ 'testimonial_background' => $instance['design']['colors']['testimonial_background'],
285
+
286
+ // The text block
287
+ 'text_border_radius' => intval($instance['design']['border_radius']) . 'px',
288
+ 'text_background' => $instance['design']['colors']['text_background'],
289
+ 'text_color' => $instance['design']['colors']['text_color'],
290
+
291
+ // All the responsive sizes
292
+ 'tablet_testimonial_size' => round(100/$instance['settings']['responsive']['tablet']['per_line'], 4) . '%',
293
+ 'tablet_width' => intval($instance['settings']['responsive']['tablet']['width']) . 'px',
294
+ 'mobile_testimonial_size' => round(100/$instance['settings']['responsive']['mobile']['per_line'], 4) . '%',
295
+ 'mobile_width' => intval($instance['settings']['responsive']['mobile']['width']) . 'px',
296
+ );
297
+ }
298
+
299
+ function get_template_variables( $instance, $args ){
300
+ return array(
301
+ 'testimonials' => !empty($instance['testimonials']) ? $instance['testimonials'] : array(),
302
+ 'settings' => $instance['settings'],
303
+ 'design' => $instance['design'],
304
+ );
305
+ }
306
+
307
+ function testimonial_user_image( $testimonial, $design ){
308
+ if( !empty($testimonial['image']) && $design['image']['image_shape'] == 'square') {
309
+ return wp_get_attachment_image( $testimonial['image'], array( $design['image']['image_size'], $design['image']['image_size'] ), false, array(
310
+ 'class' => 'sow-image-shape-' . $design['image']['image_shape'],
311
+ ) );
312
+ }
313
+ else {
314
+ $src = wp_get_attachment_image_src( $testimonial['image'], array( $design['image']['image_size'], $design['image']['image_size'] ) );
315
+ return '<div class="sow-round-image-frame" style="background-image: url(' . esc_url( $src[0] ) . '); width:' . intval($design['image']['image_size']) . 'px; height:' . intval($design['image']['image_size']) . 'px"></div>';
316
+ }
317
+ }
318
+
319
+ function testimonial_pointer( $design ){
320
+
321
+ }
322
+
323
+ function testimonial_wrapper_class($design){
324
+ $classes = array();
325
+ $classes[] = 'sow-user-' . sanitize_html_class( $design['user_position'] );
326
+ $classes[] = 'sow-layout-' . sanitize_html_class( $design['layout'] );
327
+ return str_replace( '_', '-', implode( ' ', $classes ) );
328
+ }
329
+
330
+ }
331
+
332
+ siteorigin_widget_register( 'sow-testimonials', __FILE__, 'SiteOrigin_Widgets_Testimonials_Widget' );
widgets/so-testimonial-widget/styles/default.less ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @import "../../../base/less/mixins";
2
+
3
+ @image_size: 75px;
4
+ @testimonial_padding: 10px;
5
+
6
+ @testimonial_background: transparent;
7
+ @text_background: #f0f0f0;
8
+ @text_color: #666;
9
+ @text_border_radius: 4px;
10
+
11
+ // Testimonial sizes
12
+ @testimonial_size: 33.333%;
13
+ @tablet_testimonial_size: 50%;
14
+ @tablet_width: 800px;
15
+ @mobile_testimonial_size: 100%;
16
+ @mobile_width: 480px;
17
+
18
+ .sow-testimonials {
19
+
20
+ .sow-testimonial-wrapper {
21
+ width: @testimonial_size;
22
+
23
+ @media screen and (max-width: @tablet_width) {
24
+ width: @tablet_testimonial_size;
25
+ }
26
+
27
+ @media screen and (max-width: @mobile_width) {
28
+ width: @mobile_testimonial_size;
29
+ }
30
+ }
31
+
32
+ .sow-testimonial {
33
+ background: @testimonial_background;
34
+ }
35
+
36
+ .sow-testimonial-text {
37
+ background: @text_background;
38
+ color: @text_color;
39
+ padding: @testimonial_padding @testimonial_padding*1.5;
40
+ .border-radius(@text_border_radius);
41
+ }
42
+
43
+ .sow-round-image-frame {
44
+ border-radius: @image_size;
45
+ }
46
+
47
+ // All the specific layouts
48
+
49
+ .sow-testimonial-wrapper {
50
+ .clearfix();
51
+
52
+ &.sow-layout-side {
53
+
54
+ &.sow-user-left,
55
+ &.sow-user-middle {
56
+ .sow-testimonial-user {
57
+ width: 33%;
58
+ float: left;
59
+ padding: @testimonial_padding @testimonial_padding*2 @testimonial_padding @testimonial_padding;
60
+
61
+ img {
62
+ margin: 0 auto;
63
+ max-width: 100%;
64
+ height: auto;
65
+ }
66
+ }
67
+
68
+ .sow-testimonial-text {
69
+ margin-left: 33%;
70
+ }
71
+ }
72
+
73
+ &.sow-user-right {
74
+
75
+ .sow-testimonial-user {
76
+ width: 33%;
77
+ float: right;
78
+ padding: @testimonial_padding @testimonial_padding @testimonial_padding @testimonial_padding*2;
79
+
80
+ img {
81
+ width: @image_size;
82
+ margin: 0 auto;
83
+ max-width: 100%;
84
+ height: auto;
85
+ }
86
+ }
87
+
88
+ .sow-testimonial-text {
89
+ margin-right: 33%;
90
+ }
91
+
92
+ }
93
+
94
+ }
95
+
96
+ &.sow-layout-text-above,
97
+ &.sow-layout-text-below {
98
+
99
+ .sow-testimonial-user {
100
+ width: auto;
101
+ padding: @testimonial_padding;
102
+
103
+ img {
104
+ width: @image_size;
105
+ height: auto;
106
+ }
107
+ }
108
+
109
+ .sow-testimonial-text {
110
+
111
+ }
112
+
113
+ }
114
+
115
+ &.sow-layout-text-below {
116
+
117
+ .sow-testimonial-user {
118
+ padding:@testimonial_padding;
119
+ }
120
+
121
+ }
122
+
123
+ }
124
+
125
+ }
widgets/so-testimonial-widget/svg/svgdefs.svg ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <svg style="position: absolute; width: 0; height: 0;" width="0" height="0" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
2
+ <defs>
3
+ <symbol id="icon-caret-down" viewBox="0 0 585 1024">
4
+ <title>caret-down</title>
5
+ <path class="path1" d="M585.143 402.286q0 14.857-10.857 25.714l-256 256q-10.857 10.857-25.714 10.857t-25.714-10.857l-256-256q-10.857-10.857-10.857-25.714t10.857-25.714 25.714-10.857h512q14.857 0 25.714 10.857t10.857 25.714z"></path>
6
+ </symbol>
7
+ <symbol id="icon-caret-up" viewBox="0 0 585 1024">
8
+ <title>caret-up</title>
9
+ <path class="path1" d="M585.143 694.857q0 14.857-10.857 25.714t-25.714 10.857h-512q-14.857 0-25.714-10.857t-10.857-25.714 10.857-25.714l256-256q10.857-10.857 25.714-10.857t25.714 10.857l256 256q10.857 10.857 10.857 25.714z"></path>
10
+ </symbol>
11
+ <symbol id="icon-caret-left" viewBox="0 0 366 1024">
12
+ <title>caret-left</title>
13
+ <path class="path1" d="M365.714 256v512q0 14.857-10.857 25.714t-25.714 10.857-25.714-10.857l-256-256q-10.857-10.857-10.857-25.714t10.857-25.714l256-256q10.857-10.857 25.714-10.857t25.714 10.857 10.857 25.714z"></path>
14
+ </symbol>
15
+ <symbol id="icon-caret-right" viewBox="0 0 366 1024">
16
+ <title>caret-right</title>
17
+ <path class="path1" d="M329.143 512q0 14.857-10.857 25.714l-256 256q-10.857 10.857-25.714 10.857t-25.714-10.857-10.857-25.714v-512q0-14.857 10.857-25.714t25.714-10.857 25.714 10.857l256 256q10.857 10.857 10.857 25.714z"></path>
18
+ </symbol>
19
+ </defs>
20
+ </svg>
widgets/so-testimonial-widget/tpl/default.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @var $design
4
+ * @var $settings
5
+ * @var $testimonials
6
+ */
7
+ ?>
8
+ <?php $this->caret_svg() ?>
9
+ <div class="sow-testimonials">
10
+ <?php foreach( $testimonials as $testimonial ) : ?>
11
+ <div class="sow-testimonial-wrapper <?php echo $this->testimonial_wrapper_class($design) ?>">
12
+ <div class="sow-testimonial">
13
+ <?php if( strpos($design['layout'], '_above') !== false ) : ?>
14
+ <div class="sow-testimonial-text">
15
+ <?php echo wp_kses_post( $testimonial['text'] ) ?>
16
+ </div>
17
+ <?php endif; ?>
18
+
19
+ <div class="sow-testimonial-user">
20
+ <div class="sow-image-wrapper">
21
+ <?php echo $this->testimonial_user_image($testimonial, $design) ?>
22
+ </div>
23
+ <div class="sow-text">
24
+ <strong><?php echo esc_html( $testimonial['name'] ) ?></strong>
25
+ <a><?php echo esc_html( $testimonial['location'] ) ?></a>
26
+ </div>
27
+
28
+ <?php // $this->testimonial_pointer($design) ?>
29
+ </div>
30
+
31
+ <?php if( strpos($design['layout'], '_above') === false ) : ?>
32
+ <div class="sow-testimonial-text">
33
+ <?php echo wp_kses_post( $testimonial['text'] ) ?>
34
+ </div>
35
+ <?php endif; ?>
36
+ </div>
37
+ </div>
38
+ <?php endforeach; ?>
39
+ </div>
widgets/so-video-widget/assets/banner.svg CHANGED
@@ -1,34 +1,36 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
4
- <svg version="1.0" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
- width="480px" height="240px" viewBox="0 0 480 240" enable-background="new 0 0 480 240" xml:space="preserve">
6
- <rect id="Button_1_" fill="#1880B6" width="480" height="240"/>
7
- <g>
8
- <g>
9
- <path fill="#8ED9EF" d="M179.851,75.885v12.014h16.02V71.88h-12.015C181.642,71.88,179.851,73.672,179.851,75.885z"/>
10
- <rect x="179.851" y="91.904" fill="#8ED9EF" width="16.02" height="16.019"/>
11
- <rect x="179.851" y="111.928" fill="#8ED9EF" width="16.02" height="16.02"/>
12
- <rect x="179.851" y="131.952" fill="#8ED9EF" width="16.02" height="16.019"/>
13
- <path fill="#8ED9EF" d="M179.851,163.99c0,2.212,1.791,4.005,4.005,4.005h12.015v-16.019h-16.02V163.99z"/>
14
- <rect x="199.875" y="71.88" fill="#8ED9EF" width="80.096" height="96.115"/>
15
- <path fill="#8ED9EF" d="M283.976,167.995h12.015c2.214,0,4.005-1.792,4.005-4.005v-12.014h-16.02V167.995z"/>
16
- <rect x="283.976" y="131.952" fill="#8ED9EF" width="16.02" height="16.019"/>
17
- <rect x="283.976" y="111.928" fill="#8ED9EF" width="16.02" height="16.02"/>
18
- <rect x="283.976" y="91.904" fill="#8ED9EF" width="16.02" height="16.019"/>
19
- <path fill="#8ED9EF" d="M295.99,71.88h-12.015v16.019h16.02V75.885C299.995,73.672,298.204,71.88,295.99,71.88z"/>
20
- </g>
21
- <path fill="#324249" d="M229.911,139.961c0.304,0,0.614-0.07,0.896-0.211l28.033-17.81c0.677-0.34,1.106-1.244,1.106-2.002
22
- s-0.43-1.412-1.106-1.752l-28.033-18.061c-0.623-0.31-1.362-0.276-1.948,0.088c-0.591,0.365-0.951,1.009-0.951,1.703v36.043
23
- c0,0.694,0.36,1.338,0.951,1.703C229.181,139.862,229.542,139.961,229.911,139.961z M231.913,105.482l22.527,14.455l-22.527,14.518
24
- V105.482z"/>
25
- <polygon fill="#F2F0DA" points="231.913,105.482 231.913,134.455 254.44,119.938 "/>
26
- <path fill="#324249" d="M295.99,67.875H183.855c-4.424,0-8.01,3.336-8.01,7.759v88.356c0,4.423,3.586,8.01,8.01,8.01H295.99
27
- c4.424,0,8.01-3.586,8.01-8.01V75.634C304,71.211,300.414,67.875,295.99,67.875z M179.851,75.885c0-2.212,1.791-4.005,4.005-4.005
28
- h12.015v16.019h-16.02V75.885z M179.851,91.904h16.02v16.019h-16.02V91.904z M179.851,111.928h16.02v16.02h-16.02V111.928z
29
- M179.851,131.952h16.02v16.019h-16.02V131.952z M183.855,167.995c-2.214,0-4.005-1.792-4.005-4.005v-12.014h16.02v16.019H183.855z
30
- M199.875,167.995V71.88h80.096v96.115H199.875z M299.995,163.99c0,2.212-1.791,4.005-4.005,4.005h-12.015v-16.019h16.02V163.99z
31
- M299.995,147.971h-16.02v-16.019h16.02V147.971z M299.995,127.947h-16.02v-16.02h16.02V127.947z M299.995,107.923h-16.02V91.904
32
- h16.02V107.923z M299.995,87.899h-16.02V71.88h12.015c2.214,0,4.005,1.792,4.005,4.005V87.899z"/>
33
- </g>
34
- </svg>
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="55 277 240 240" style="enable-background:new 55 277 240 240;" xml:space="preserve">
5
+ <style type="text/css">
6
+ .st0{fill:#1880B6;}
7
+ .st1{fill:#8ED9EF;}
8
+ .st2{fill:#324249;}
9
+ .st3{fill:#F2F0DA;}
10
+ </style>
11
+ <rect id="Button_1_" x="55" y="277" class="st0" width="240" height="240"/>
12
+ <g>
13
+ <g>
14
+ <path class="st1" d="M114.9,352.9v12h16v-16h-12C116.6,348.9,114.9,350.7,114.9,352.9z"/>
15
+ <rect x="114.9" y="368.9" class="st1" width="16" height="16"/>
16
+ <rect x="114.9" y="388.9" class="st1" width="16" height="16"/>
17
+ <rect x="114.9" y="409" class="st1" width="16" height="16"/>
18
+ <path class="st1" d="M114.9,441c0,2.2,1.8,4,4,4h12v-16h-16V441z"/>
19
+ <rect x="134.9" y="348.9" class="st1" width="80.1" height="96.1"/>
20
+ <path class="st1" d="M219,445h12c2.2,0,4-1.8,4-4v-12h-16L219,445L219,445z"/>
21
+ <rect x="219" y="409" class="st1" width="16" height="16"/>
22
+ <rect x="219" y="388.9" class="st1" width="16" height="16"/>
23
+ <rect x="219" y="368.9" class="st1" width="16" height="16"/>
24
+ <path class="st1" d="M231,348.9h-12v16h16v-12C235,350.7,233.2,348.9,231,348.9z"/>
25
+ </g>
26
+ <path class="st2" d="M164.9,417c0.3,0,0.6-0.1,0.9-0.2l28-17.8c0.7-0.3,1.1-1.2,1.1-2s-0.4-1.4-1.1-1.8l-28-18.1
27
+ c-0.6-0.3-1.4-0.3-1.9,0.1c-0.6,0.4-1,1-1,1.7v36c0,0.7,0.4,1.3,1,1.7C164.2,416.9,164.5,417,164.9,417z M166.9,382.5l22.5,14.5
28
+ l-22.5,14.5V382.5z"/>
29
+ <polygon class="st3" points="166.9,382.5 166.9,411.5 189.4,396.9 "/>
30
+ <path class="st2" d="M231,344.9H118.9c-4.4,0-8,3.3-8,7.8V441c0,4.4,3.6,8,8,8H231c4.4,0,8-3.6,8-8v-88.4
31
+ C239,348.2,235.4,344.9,231,344.9z M114.9,352.9c0-2.2,1.8-4,4-4h12v16h-16V352.9z M114.9,368.9h16v16h-16V368.9z M114.9,388.9h16
32
+ v16h-16V388.9z M114.9,409h16v16h-16V409z M118.9,445c-2.2,0-4-1.8-4-4v-12h16v16H118.9L118.9,445z M134.9,445v-96.1H215V445H134.9
33
+ z M235,441c0,2.2-1.8,4-4,4h-12v-16h16L235,441L235,441z M235,425h-16v-16h16V425z M235,404.9h-16v-16h16V404.9z M235,384.9h-16
34
+ v-16h16V384.9z M235,364.9h-16v-16h12c2.2,0,4,1.8,4,4L235,364.9L235,364.9z"/>
35
+ </g>
36
+ </svg>
widgets/so-video-widget/so-video-widget.php CHANGED
@@ -1,10 +1,9 @@
1
  <?php
2
-
3
  /*
4
- Widget Name: Video widget
5
  Description: Play all your self or externally hosted videos in a customizable video player.
6
  Author: SiteOrigin
7
- Author URI: http://siteorigin.com
8
  */
9
 
10
 
@@ -14,24 +13,24 @@ class SiteOrigin_Widget_Video_Widget extends SiteOrigin_Widget {
14
 
15
  parent::__construct(
16
  'sow-video',
17
- __( 'SiteOrigin Video', 'siteorigin-widgets' ),
18
  array(
19
- 'description' => __( 'A video player widget.', 'siteorigin-widgets' ),
20
  'help' => 'http://siteorigin.com/widgets-bundle/video-widget-documentation/'
21
  ),
22
  array(),
23
  array(
24
  'title' => array(
25
  'type' => 'text',
26
- 'label' => __( 'Title', 'siteorigin-widgets' )
27
  ),
28
  'host_type' => array(
29
  'type' => 'radio',
30
- 'label' => __( 'Video location', 'siteorigin-widgets' ),
31
  'default' => 'self',
32
  'options' => array(
33
- 'self' => __( 'Self hosted', 'siteorigin-widgets' ),
34
- 'external' => __( 'Externally hosted', 'siteorigin-widgets' ),
35
  ),
36
 
37
  // This field should be a video type state emitter
@@ -43,13 +42,13 @@ class SiteOrigin_Widget_Video_Widget extends SiteOrigin_Widget {
43
 
44
  'video' => array(
45
  'type' => 'section',
46
- 'label' => __( 'Video File', 'siteorigin-widgets' ),
47
  'fields' => array(
48
  'self_video' => array(
49
  'type' => 'media',
50
  'fallback' => true,
51
- 'label' => __( 'Select video', 'siteorigin-widgets' ),
52
- 'description' => __( 'Select an uploaded video in mp4 format. Other formats, such as webm and ogv will work in some browsers. You can use an online service such as <a href="http://video.online-convert.com/convert-to-mp4" target="_blank">online-convert.com</a> to convert your videos to mp4.', 'siteorigin-widgets' ),
53
  'default' => '',
54
  'library' => 'video',
55
  'state_handler' => array(
@@ -59,7 +58,7 @@ class SiteOrigin_Widget_Video_Widget extends SiteOrigin_Widget {
59
  ),
60
  'self_poster' => array(
61
  'type' => 'media',
62
- 'label' => __( 'Select cover image', 'siteorigin-widgets' ),
63
  'default' => '',
64
  'library' => 'image',
65
  'state_handler' => array(
@@ -70,7 +69,7 @@ class SiteOrigin_Widget_Video_Widget extends SiteOrigin_Widget {
70
  'external_video' => array(
71
  'type' => 'text',
72
  'sanitize' => 'url',
73
- 'label' => __( 'Video URL', 'siteorigin-widgets' ),
74
  'state_handler' => array(
75
  'video_type[external]' => array('show'),
76
  'video_type[self]' => array('hide'),
@@ -81,18 +80,18 @@ class SiteOrigin_Widget_Video_Widget extends SiteOrigin_Widget {
81
 
82
  'playback' => array(
83
  'type' => 'section',
84
- 'label' => __('Video Playback', 'siteorigin-widgets'),
85
  'fields' => array(
86
  'autoplay' => array(
87
  'type' => 'checkbox',
88
  'default' => false,
89
- 'label' => __( 'Autoplay', 'siteorigin-widgets' )
90
  ),
91
  'oembed' => array(
92
  'type' => 'checkbox',
93
  'default' => true,
94
- 'label' => __( 'Use oEmbed', 'siteorigin-widgets' ),
95
- 'description' => __( 'Always use the embedded video rather than the MediaElement player.', 'siteorigin-widgets' ),
96
  'state_handler' => array(
97
  'video_type[external]' => array('show'),
98
  'video_type[self]' => array('hide'),
@@ -116,7 +115,7 @@ class SiteOrigin_Widget_Video_Widget extends SiteOrigin_Widget {
116
  if ( ! wp_style_is( 'sow-html-player-responsive' ) ) {
117
  wp_enqueue_style(
118
  'html-player-responsive',
119
- siteorigin_widget_get_plugin_dir_url( 'video' ) . 'css/html-player-responsive.css',
120
  array(),
121
  SOW_BUNDLE_VERSION
122
  );
@@ -127,7 +126,7 @@ class SiteOrigin_Widget_Video_Widget extends SiteOrigin_Widget {
127
  if ( ! wp_script_is( 'so-video-widget' ) ) {
128
  wp_enqueue_script(
129
  'so-video-widget',
130
- siteorigin_widget_get_plugin_dir_url( 'video' ) . 'js/so-video-widget' . SOW_BUNDLE_JS_SUFFIX . '.js',
131
  array( 'jquery', 'mediaelement' ),
132
  SOW_BUNDLE_VERSION
133
  );
@@ -258,4 +257,4 @@ class SiteOrigin_Widget_Video_Widget extends SiteOrigin_Widget {
258
  return $video_host == 'self' || ( ($video_host == 'youtube' || $video_host == 'vimeo') && $wp_version >= 4.2 );
259
  }
260
  }
261
- siteorigin_widget_register( 'video', __FILE__ );
1
  <?php
 
2
  /*
3
+ Widget Name: Video Player
4
  Description: Play all your self or externally hosted videos in a customizable video player.
5
  Author: SiteOrigin
6
+ Author URI: https://siteorigin.com
7
  */
8
 
9
 
13
 
14
  parent::__construct(
15
  'sow-video',
16
+ __( 'SiteOrigin Video Player', 'so-widgets-bundle' ),
17
  array(
18
+ 'description' => __( 'A video player widget.', 'so-widgets-bundle' ),
19
  'help' => 'http://siteorigin.com/widgets-bundle/video-widget-documentation/'
20
  ),
21
  array(),
22
  array(
23
  'title' => array(
24
  'type' => 'text',
25
+ 'label' => __( 'Title', 'so-widgets-bundle' )
26
  ),
27
  'host_type' => array(
28
  'type' => 'radio',
29
+ 'label' => __( 'Video location', 'so-widgets-bundle' ),
30
  'default' => 'self',
31
  'options' => array(
32
+ 'self' => __( 'Self hosted', 'so-widgets-bundle' ),
33
+ 'external' => __( 'Externally hosted', 'so-widgets-bundle' ),
34
  ),
35
 
36
  // This field should be a video type state emitter
42
 
43
  'video' => array(
44
  'type' => 'section',
45
+ 'label' => __( 'Video File', 'so-widgets-bundle' ),
46
  'fields' => array(
47
  'self_video' => array(
48
  'type' => 'media',
49
  'fallback' => true,
50
+ 'label' => __( 'Select video', 'so-widgets-bundle' ),
51
+ 'description' => __( 'Select an uploaded video in mp4 format. Other formats, such as webm and ogv will work in some browsers. You can use an online service such as <a href="http://video.online-convert.com/convert-to-mp4" target="_blank">online-convert.com</a> to convert your videos to mp4.', 'so-widgets-bundle' ),
52
  'default' => '',
53
  'library' => 'video',
54
  'state_handler' => array(
58
  ),
59
  'self_poster' => array(
60
  'type' => 'media',
61
+ 'label' => __( 'Select cover image', 'so-widgets-bundle' ),
62
  'default' => '',
63
  'library' => 'image',
64
  'state_handler' => array(
69
  'external_video' => array(
70
  'type' => 'text',
71
  'sanitize' => 'url',
72
+ 'label' => __( 'Video URL', 'so-widgets-bundle' ),
73
  'state_handler' => array(
74
  'video_type[external]' => array('show'),
75
  'video_type[self]' => array('hide'),
80
 
81
  'playback' => array(
82
  'type' => 'section',
83
+ 'label' => __('Video Playback', 'so-widgets-bundle'),
84
  'fields' => array(
85
  'autoplay' => array(
86
  'type' => 'checkbox',
87
  'default' => false,
88
+ 'label' => __( 'Autoplay', 'so-widgets-bundle' )
89
  ),
90
  'oembed' => array(
91
  'type' => 'checkbox',
92
  'default' => true,
93
+ 'label' => __( 'Use oEmbed', 'so-widgets-bundle' ),
94
+ 'description' => __( 'Always use the embedded video rather than the MediaElement player.', 'so-widgets-bundle' ),
95
  'state_handler' => array(
96
  'video_type[external]' => array('show'),
97
  'video_type[self]' => array('hide'),
115
  if ( ! wp_style_is( 'sow-html-player-responsive' ) ) {
116
  wp_enqueue_style(
117
  'html-player-responsive',
118
+ plugin_dir_url(__FILE__) . 'css/html-player-responsive.css',
119
  array(),
120
  SOW_BUNDLE_VERSION
121
  );
126
  if ( ! wp_script_is( 'so-video-widget' ) ) {
127
  wp_enqueue_script(
128
  'so-video-widget',
129
+ plugin_dir_url(__FILE__) . 'js/so-video-widget' . SOW_BUNDLE_JS_SUFFIX . '.js',
130
  array( 'jquery', 'mediaelement' ),
131
  SOW_BUNDLE_VERSION
132
  );
257
  return $video_host == 'self' || ( ($video_host == 'youtube' || $video_host == 'vimeo') && $wp_version >= 4.2 );
258
  }
259
  }
260
+ siteorigin_widget_register( 'video', __FILE__, 'SiteOrigin_Widget_Video_Widget' );