Page Builder by SiteOrigin - Version 2.4.17

Version Description

  • 14 October 2016 =
  • Removed old Stellar JS library.
  • Added parallax setup after small timeout.
  • Added way to add affiliate ID.
  • Added tips signup link.
Download this release

Release Info

Developer gpriday
Plugin Icon 128x128 Page Builder by SiteOrigin
Version 2.4.17
Comparing to
See all releases

Code changes from version 2.4.16 to 2.4.17

css/admin.css CHANGED
@@ -482,6 +482,10 @@
482
  color: #777;
483
  font-size: 0.8em;
484
  }
 
 
 
 
485
  .siteorigin-panels-builder.so-display-narrow .so-builder-toolbar {
486
  padding: 10px;
487
  }
482
  color: #777;
483
  font-size: 0.8em;
484
  }
485
+ .siteorigin-panels-builder .so-panels-welcome-message .so-tip-wrapper {
486
+ margin-top: 15px;
487
+ font-size: 0.95em;
488
+ }
489
  .siteorigin-panels-builder.so-display-narrow .so-builder-toolbar {
490
  padding: 10px;
491
  }
js/jquery.stellar.js DELETED
@@ -1,651 +0,0 @@
1
- ;(function($, window, document, undefined) {
2
-
3
- var pluginName = 'stellar',
4
- defaults = {
5
- scrollProperty: 'scroll',
6
- positionProperty: 'position',
7
- horizontalScrolling: true,
8
- verticalScrolling: true,
9
- horizontalOffset: 0,
10
- verticalOffset: 0,
11
- responsive: false,
12
- parallaxBackgrounds: true,
13
- parallaxElements: true,
14
- hideDistantElements: true,
15
- hideElement: function($elem) { $elem.hide(); },
16
- showElement: function($elem) { $elem.show(); }
17
- },
18
-
19
- scrollProperty = {
20
- scroll: {
21
- getLeft: function($elem) { return $elem.scrollLeft(); },
22
- setLeft: function($elem, val) { $elem.scrollLeft(val); },
23
-
24
- getTop: function($elem) { return $elem.scrollTop(); },
25
- setTop: function($elem, val) { $elem.scrollTop(val); }
26
- },
27
- position: {
28
- getLeft: function($elem) { return parseInt($elem.css('left'), 10) * -1; },
29
- getTop: function($elem) { return parseInt($elem.css('top'), 10) * -1; }
30
- },
31
- margin: {
32
- getLeft: function($elem) { return parseInt($elem.css('margin-left'), 10) * -1; },
33
- getTop: function($elem) { return parseInt($elem.css('margin-top'), 10) * -1; }
34
- },
35
- transform: {
36
- getLeft: function($elem) {
37
- var computedTransform = getComputedStyle($elem[0])[prefixedTransform];
38
- return (computedTransform !== 'none' ? parseInt(computedTransform.match(/(-?[0-9]+)/g)[4], 10) * -1 : 0);
39
- },
40
- getTop: function($elem) {
41
- var computedTransform = getComputedStyle($elem[0])[prefixedTransform];
42
- return (computedTransform !== 'none' ? parseInt(computedTransform.match(/(-?[0-9]+)/g)[5], 10) * -1 : 0);
43
- }
44
- }
45
- },
46
-
47
- positionProperty = {
48
- position: {
49
- setLeft: function($elem, left) { $elem.css('left', left); },
50
- setTop: function($elem, top) { $elem.css('top', top); }
51
- },
52
- transform: {
53
- setPosition: function($elem, left, startingLeft, top, startingTop) {
54
- $elem[0].style[prefixedTransform] = 'translate3d(' + (left - startingLeft) + 'px, ' + (top - startingTop) + 'px, 0)';
55
- }
56
- }
57
- },
58
-
59
- // Returns a function which adds a vendor prefix to any CSS property name
60
- vendorPrefix = (function() {
61
- var prefixes = /^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,
62
- style = $('script')[0].style,
63
- prefix = '',
64
- prop;
65
-
66
- for (prop in style) {
67
- if (prefixes.test(prop)) {
68
- prefix = prop.match(prefixes)[0];
69
- break;
70
- }
71
- }
72
-
73
- if ('WebkitOpacity' in style) { prefix = 'Webkit'; }
74
- if ('KhtmlOpacity' in style) { prefix = 'Khtml'; }
75
-
76
- return function(property) {
77
- return prefix + (prefix.length > 0 ? property.charAt(0).toUpperCase() + property.slice(1) : property);
78
- };
79
- }()),
80
-
81
- prefixedTransform = vendorPrefix('transform'),
82
-
83
- supportsBackgroundPositionXY = $('<div />', { style: 'background:#fff' }).css('background-position-x') !== undefined,
84
-
85
- setBackgroundPosition = (supportsBackgroundPositionXY ?
86
- function($elem, x, y) {
87
- $elem.css({
88
- 'background-position-x': x,
89
- 'background-position-y': y
90
- });
91
- } :
92
- function($elem, x, y) {
93
- $elem.css('background-position', x + ' ' + y);
94
- }
95
- ),
96
-
97
- getBackgroundPosition = (supportsBackgroundPositionXY ?
98
- function($elem) {
99
- return [
100
- $elem.css('background-position-x'),
101
- $elem.css('background-position-y')
102
- ];
103
- } :
104
- function($elem) {
105
- return $elem.css('background-position').split(' ');
106
- }
107
- ),
108
-
109
- requestAnimFrame = (
110
- window.requestAnimationFrame ||
111
- window.webkitRequestAnimationFrame ||
112
- window.mozRequestAnimationFrame ||
113
- window.oRequestAnimationFrame ||
114
- window.msRequestAnimationFrame ||
115
- function(callback) {
116
- setTimeout(callback, 1000 / 60);
117
- }
118
- );
119
-
120
- function Plugin(element, options) {
121
- this.element = element;
122
- this.options = $.extend({}, defaults, options);
123
-
124
- this._defaults = defaults;
125
- this._name = pluginName;
126
-
127
- this.init();
128
- }
129
-
130
- Plugin.prototype = {
131
- init: function() {
132
- this.options.name = pluginName + '_' + Math.floor(Math.random() * 1e9);
133
-
134
- this._defineElements();
135
- this._defineGetters();
136
- this._defineSetters();
137
- this._handleWindowLoadAndResize();
138
- this._detectViewport();
139
-
140
- this.refresh({ firstLoad: true });
141
-
142
- if (this.options.scrollProperty === 'scroll') {
143
- this._handleScrollEvent();
144
- } else {
145
- this._startAnimationLoop();
146
- }
147
- },
148
- _defineElements: function() {
149
- if (this.element === document.body) this.element = window;
150
- this.$scrollElement = $(this.element);
151
- this.$element = (this.element === window ? $('body') : this.$scrollElement);
152
- this.$viewportElement = (this.options.viewportElement !== undefined ? $(this.options.viewportElement) : (this.$scrollElement[0] === window || this.options.scrollProperty === 'scroll' ? this.$scrollElement : this.$scrollElement.parent()) );
153
- },
154
- _defineGetters: function() {
155
- var self = this,
156
- scrollPropertyAdapter = scrollProperty[self.options.scrollProperty];
157
-
158
- this._getScrollLeft = function() {
159
- return scrollPropertyAdapter.getLeft(self.$scrollElement);
160
- };
161
-
162
- this._getScrollTop = function() {
163
- return scrollPropertyAdapter.getTop(self.$scrollElement);
164
- };
165
- },
166
- _defineSetters: function() {
167
- var self = this,
168
- scrollPropertyAdapter = scrollProperty[self.options.scrollProperty],
169
- positionPropertyAdapter = positionProperty[self.options.positionProperty],
170
- setScrollLeft = scrollPropertyAdapter.setLeft,
171
- setScrollTop = scrollPropertyAdapter.setTop;
172
-
173
- this._setScrollLeft = (typeof setScrollLeft === 'function' ? function(val) {
174
- setScrollLeft(self.$scrollElement, val);
175
- } : $.noop);
176
-
177
- this._setScrollTop = (typeof setScrollTop === 'function' ? function(val) {
178
- setScrollTop(self.$scrollElement, val);
179
- } : $.noop);
180
-
181
- this._setPosition = positionPropertyAdapter.setPosition ||
182
- function($elem, left, startingLeft, top, startingTop) {
183
- if (self.options.horizontalScrolling) {
184
- positionPropertyAdapter.setLeft($elem, left, startingLeft);
185
- }
186
-
187
- if (self.options.verticalScrolling) {
188
- positionPropertyAdapter.setTop($elem, top, startingTop);
189
- }
190
- };
191
- },
192
- _handleWindowLoadAndResize: function() {
193
- var self = this,
194
- $window = $(window);
195
-
196
- if (self.options.responsive) {
197
- $window.bind('load.' + this.name, function() {
198
- self.refresh();
199
- });
200
- }
201
-
202
- $window.bind('resize.' + this.name, function() {
203
- self._detectViewport();
204
-
205
- if (self.options.responsive) {
206
- self.refresh();
207
- }
208
- });
209
- },
210
- refresh: function(options) {
211
- var self = this,
212
- oldLeft = self._getScrollLeft(),
213
- oldTop = self._getScrollTop();
214
-
215
- if (!options || !options.firstLoad) {
216
- this._reset();
217
- }
218
-
219
- this._setScrollLeft(0);
220
- this._setScrollTop(0);
221
-
222
- this._setOffsets();
223
- this._findParticles();
224
- this._findBackgrounds();
225
-
226
- // Fix for WebKit background rendering bug
227
- if (options && options.firstLoad && /WebKit/.test(navigator.userAgent)) {
228
- $(window).load(function() {
229
- var oldLeft = self._getScrollLeft(),
230
- oldTop = self._getScrollTop();
231
-
232
- self._setScrollLeft(oldLeft + 1);
233
- self._setScrollTop(oldTop + 1);
234
-
235
- self._setScrollLeft(oldLeft);
236
- self._setScrollTop(oldTop);
237
- });
238
- }
239
-
240
- this._setScrollLeft(oldLeft);
241
- this._setScrollTop(oldTop);
242
- },
243
- _detectViewport: function() {
244
- var viewportOffsets = this.$viewportElement.offset(),
245
- hasOffsets = viewportOffsets !== null && viewportOffsets !== undefined;
246
-
247
- this.viewportWidth = this.$viewportElement.width();
248
- this.viewportHeight = this.$viewportElement.height();
249
-
250
- this.viewportOffsetTop = (hasOffsets ? viewportOffsets.top : 0);
251
- this.viewportOffsetLeft = (hasOffsets ? viewportOffsets.left : 0);
252
- },
253
- _findParticles: function() {
254
- var self = this,
255
- scrollLeft = this._getScrollLeft(),
256
- scrollTop = this._getScrollTop();
257
-
258
- if (this.particles !== undefined) {
259
- for (var i = this.particles.length - 1; i >= 0; i--) {
260
- this.particles[i].$element.data('stellar-elementIsActive', undefined);
261
- }
262
- }
263
-
264
- this.particles = [];
265
-
266
- if (!this.options.parallaxElements) return;
267
-
268
- this.$element.find('[data-stellar-ratio]').each(function(i) {
269
- var $this = $(this),
270
- horizontalOffset,
271
- verticalOffset,
272
- positionLeft,
273
- positionTop,
274
- marginLeft,
275
- marginTop,
276
- $offsetParent,
277
- offsetLeft,
278
- offsetTop,
279
- parentOffsetLeft = 0,
280
- parentOffsetTop = 0,
281
- tempParentOffsetLeft = 0,
282
- tempParentOffsetTop = 0;
283
-
284
- // Ensure this element isn't already part of another scrolling element
285
- if (!$this.data('stellar-elementIsActive')) {
286
- $this.data('stellar-elementIsActive', this);
287
- } else if ($this.data('stellar-elementIsActive') !== this) {
288
- return;
289
- }
290
-
291
- self.options.showElement($this);
292
-
293
- // Save/restore the original top and left CSS values in case we refresh the particles or destroy the instance
294
- if (!$this.data('stellar-startingLeft')) {
295
- $this.data('stellar-startingLeft', $this.css('left'));
296
- $this.data('stellar-startingTop', $this.css('top'));
297
- } else {
298
- $this.css('left', $this.data('stellar-startingLeft'));
299
- $this.css('top', $this.data('stellar-startingTop'));
300
- }
301
-
302
- positionLeft = $this.position().left;
303
- positionTop = $this.position().top;
304
-
305
- // Catch-all for margin top/left properties (these evaluate to 'auto' in IE7 and IE8)
306
- marginLeft = ($this.css('margin-left') === 'auto') ? 0 : parseInt($this.css('margin-left'), 10);
307
- marginTop = ($this.css('margin-top') === 'auto') ? 0 : parseInt($this.css('margin-top'), 10);
308
-
309
- offsetLeft = $this.offset().left - marginLeft;
310
- offsetTop = $this.offset().top - marginTop;
311
-
312
- // Calculate the offset parent
313
- $this.parents().each(function() {
314
- var $this = $(this);
315
-
316
- if ($this.data('stellar-offset-parent') === true) {
317
- parentOffsetLeft = tempParentOffsetLeft;
318
- parentOffsetTop = tempParentOffsetTop;
319
- $offsetParent = $this;
320
-
321
- return false;
322
- } else {
323
- tempParentOffsetLeft += $this.position().left;
324
- tempParentOffsetTop += $this.position().top;
325
- }
326
- });
327
-
328
- // Detect the offsets
329
- horizontalOffset = ($this.data('stellar-horizontal-offset') !== undefined ? $this.data('stellar-horizontal-offset') : ($offsetParent !== undefined && $offsetParent.data('stellar-horizontal-offset') !== undefined ? $offsetParent.data('stellar-horizontal-offset') : self.horizontalOffset));
330
- verticalOffset = ($this.data('stellar-vertical-offset') !== undefined ? $this.data('stellar-vertical-offset') : ($offsetParent !== undefined && $offsetParent.data('stellar-vertical-offset') !== undefined ? $offsetParent.data('stellar-vertical-offset') : self.verticalOffset));
331
-
332
- // Add our object to the particles collection
333
- self.particles.push({
334
- $element: $this,
335
- $offsetParent: $offsetParent,
336
- isFixed: $this.css('position') === 'fixed',
337
- horizontalOffset: horizontalOffset,
338
- verticalOffset: verticalOffset,
339
- startingPositionLeft: positionLeft,
340
- startingPositionTop: positionTop,
341
- startingOffsetLeft: offsetLeft,
342
- startingOffsetTop: offsetTop,
343
- parentOffsetLeft: parentOffsetLeft,
344
- parentOffsetTop: parentOffsetTop,
345
- stellarRatio: ($this.data('stellar-ratio') !== undefined ? $this.data('stellar-ratio') : 1),
346
- width: $this.outerWidth(true),
347
- height: $this.outerHeight(true),
348
- isHidden: false
349
- });
350
- });
351
- },
352
- _findBackgrounds: function() {
353
- var self = this,
354
- scrollLeft = this._getScrollLeft(),
355
- scrollTop = this._getScrollTop(),
356
- $backgroundElements;
357
-
358
- this.backgrounds = [];
359
-
360
- if (!this.options.parallaxBackgrounds) return;
361
-
362
- $backgroundElements = this.$element.find('[data-stellar-background-ratio]');
363
-
364
- if (this.$element.data('stellar-background-ratio')) {
365
- $backgroundElements = $backgroundElements.add(this.$element);
366
- }
367
-
368
- $backgroundElements.each(function() {
369
- var $this = $(this),
370
- backgroundPosition = getBackgroundPosition($this),
371
- horizontalOffset,
372
- verticalOffset,
373
- positionLeft,
374
- positionTop,
375
- marginLeft,
376
- marginTop,
377
- offsetLeft,
378
- offsetTop,
379
- $offsetParent,
380
- parentOffsetLeft = 0,
381
- parentOffsetTop = 0,
382
- tempParentOffsetLeft = 0,
383
- tempParentOffsetTop = 0;
384
-
385
- // Ensure this element isn't already part of another scrolling element
386
- if (!$this.data('stellar-backgroundIsActive')) {
387
- $this.data('stellar-backgroundIsActive', this);
388
- } else if ($this.data('stellar-backgroundIsActive') !== this) {
389
- return;
390
- }
391
-
392
- // Save/restore the original top and left CSS values in case we destroy the instance
393
- if (!$this.data('stellar-backgroundStartingLeft')) {
394
- $this.data('stellar-backgroundStartingLeft', backgroundPosition[0]);
395
- $this.data('stellar-backgroundStartingTop', backgroundPosition[1]);
396
- } else {
397
- setBackgroundPosition($this, $this.data('stellar-backgroundStartingLeft'), $this.data('stellar-backgroundStartingTop'));
398
- }
399
-
400
- // Catch-all for margin top/left properties (these evaluate to 'auto' in IE7 and IE8)
401
- marginLeft = ($this.css('margin-left') === 'auto') ? 0 : parseInt($this.css('margin-left'), 10);
402
- marginTop = ($this.css('margin-top') === 'auto') ? 0 : parseInt($this.css('margin-top'), 10);
403
-
404
- offsetLeft = $this.offset().left - marginLeft - scrollLeft;
405
- offsetTop = $this.offset().top - marginTop - scrollTop;
406
-
407
- // Calculate the offset parent
408
- $this.parents().each(function() {
409
- var $this = $(this);
410
-
411
- if ($this.data('stellar-offset-parent') === true) {
412
- parentOffsetLeft = tempParentOffsetLeft;
413
- parentOffsetTop = tempParentOffsetTop;
414
- $offsetParent = $this;
415
-
416
- return false;
417
- } else {
418
- tempParentOffsetLeft += $this.position().left;
419
- tempParentOffsetTop += $this.position().top;
420
- }
421
- });
422
-
423
- // Detect the offsets
424
- horizontalOffset = ($this.data('stellar-horizontal-offset') !== undefined ? $this.data('stellar-horizontal-offset') : ($offsetParent !== undefined && $offsetParent.data('stellar-horizontal-offset') !== undefined ? $offsetParent.data('stellar-horizontal-offset') : self.horizontalOffset));
425
- verticalOffset = ($this.data('stellar-vertical-offset') !== undefined ? $this.data('stellar-vertical-offset') : ($offsetParent !== undefined && $offsetParent.data('stellar-vertical-offset') !== undefined ? $offsetParent.data('stellar-vertical-offset') : self.verticalOffset));
426
-
427
- self.backgrounds.push({
428
- $element: $this,
429
- $offsetParent: $offsetParent,
430
- isFixed: $this.css('background-attachment') === 'fixed',
431
- horizontalOffset: horizontalOffset,
432
- verticalOffset: verticalOffset,
433
- startingValueLeft: backgroundPosition[0],
434
- startingValueTop: backgroundPosition[1],
435
- startingBackgroundPositionLeft: (isNaN(parseInt(backgroundPosition[0], 10)) ? 0 : parseInt(backgroundPosition[0], 10)),
436
- startingBackgroundPositionTop: (isNaN(parseInt(backgroundPosition[1], 10)) ? 0 : parseInt(backgroundPosition[1], 10)),
437
- startingPositionLeft: $this.position().left,
438
- startingPositionTop: $this.position().top,
439
- startingOffsetLeft: offsetLeft,
440
- startingOffsetTop: offsetTop,
441
- parentOffsetLeft: parentOffsetLeft,
442
- parentOffsetTop: parentOffsetTop,
443
- stellarRatio: ($this.data('stellar-background-ratio') === undefined ? 1 : $this.data('stellar-background-ratio'))
444
- });
445
- });
446
- },
447
- _reset: function() {
448
- var particle,
449
- startingPositionLeft,
450
- startingPositionTop,
451
- background,
452
- i;
453
-
454
- for (i = this.particles.length - 1; i >= 0; i--) {
455
- particle = this.particles[i];
456
- startingPositionLeft = particle.$element.data('stellar-startingLeft');
457
- startingPositionTop = particle.$element.data('stellar-startingTop');
458
-
459
- this._setPosition(particle.$element, startingPositionLeft, startingPositionLeft, startingPositionTop, startingPositionTop);
460
-
461
- this.options.showElement(particle.$element);
462
-
463
- particle.$element.data('stellar-startingLeft', null).data('stellar-elementIsActive', null).data('stellar-backgroundIsActive', null);
464
- }
465
-
466
- for (i = this.backgrounds.length - 1; i >= 0; i--) {
467
- background = this.backgrounds[i];
468
-
469
- background.$element.data('stellar-backgroundStartingLeft', null).data('stellar-backgroundStartingTop', null);
470
-
471
- setBackgroundPosition(background.$element, background.startingValueLeft, background.startingValueTop);
472
- }
473
- },
474
- destroy: function() {
475
- this._reset();
476
-
477
- this.$scrollElement.unbind('resize.' + this.name).unbind('scroll.' + this.name);
478
- this._animationLoop = $.noop;
479
-
480
- $(window).unbind('load.' + this.name).unbind('resize.' + this.name);
481
- },
482
- _setOffsets: function() {
483
- var self = this,
484
- $window = $(window);
485
-
486
- $window.unbind('resize.horizontal-' + this.name).unbind('resize.vertical-' + this.name);
487
-
488
- if (typeof this.options.horizontalOffset === 'function') {
489
- this.horizontalOffset = this.options.horizontalOffset();
490
- $window.bind('resize.horizontal-' + this.name, function() {
491
- self.horizontalOffset = self.options.horizontalOffset();
492
- });
493
- } else {
494
- this.horizontalOffset = this.options.horizontalOffset;
495
- }
496
-
497
- if (typeof this.options.verticalOffset === 'function') {
498
- this.verticalOffset = this.options.verticalOffset();
499
- $window.bind('resize.vertical-' + this.name, function() {
500
- self.verticalOffset = self.options.verticalOffset();
501
- });
502
- } else {
503
- this.verticalOffset = this.options.verticalOffset;
504
- }
505
- },
506
- _repositionElements: function() {
507
- var scrollLeft = this._getScrollLeft(),
508
- scrollTop = this._getScrollTop(),
509
- horizontalOffset,
510
- verticalOffset,
511
- particle,
512
- fixedRatioOffset,
513
- background,
514
- bgLeft,
515
- bgTop,
516
- isVisibleVertical = true,
517
- isVisibleHorizontal = true,
518
- newPositionLeft,
519
- newPositionTop,
520
- newOffsetLeft,
521
- newOffsetTop,
522
- i;
523
-
524
- // First check that the scroll position or container size has changed
525
- if (this.currentScrollLeft === scrollLeft && this.currentScrollTop === scrollTop && this.currentWidth === this.viewportWidth && this.currentHeight === this.viewportHeight) {
526
- return;
527
- } else {
528
- this.currentScrollLeft = scrollLeft;
529
- this.currentScrollTop = scrollTop;
530
- this.currentWidth = this.viewportWidth;
531
- this.currentHeight = this.viewportHeight;
532
- }
533
-
534
- // Reposition elements
535
- for (i = this.particles.length - 1; i >= 0; i--) {
536
- particle = this.particles[i];
537
-
538
- fixedRatioOffset = (particle.isFixed ? 1 : 0);
539
-
540
- // Calculate position, then calculate what the particle's new offset will be (for visibility check)
541
- if (this.options.horizontalScrolling) {
542
- newPositionLeft = (scrollLeft + particle.horizontalOffset + this.viewportOffsetLeft + particle.startingPositionLeft - particle.startingOffsetLeft + particle.parentOffsetLeft) * -(particle.stellarRatio + fixedRatioOffset - 1) + particle.startingPositionLeft;
543
- newOffsetLeft = newPositionLeft - particle.startingPositionLeft + particle.startingOffsetLeft;
544
- } else {
545
- newPositionLeft = particle.startingPositionLeft;
546
- newOffsetLeft = particle.startingOffsetLeft;
547
- }
548
-
549
- if (this.options.verticalScrolling) {
550
- newPositionTop = (scrollTop + particle.verticalOffset + this.viewportOffsetTop + particle.startingPositionTop - particle.startingOffsetTop + particle.parentOffsetTop) * -(particle.stellarRatio + fixedRatioOffset - 1) + particle.startingPositionTop;
551
- newOffsetTop = newPositionTop - particle.startingPositionTop + particle.startingOffsetTop;
552
- } else {
553
- newPositionTop = particle.startingPositionTop;
554
- newOffsetTop = particle.startingOffsetTop;
555
- }
556
-
557
- // Check visibility
558
- if (this.options.hideDistantElements) {
559
- isVisibleHorizontal = !this.options.horizontalScrolling || newOffsetLeft + particle.width > (particle.isFixed ? 0 : scrollLeft) && newOffsetLeft < (particle.isFixed ? 0 : scrollLeft) + this.viewportWidth + this.viewportOffsetLeft;
560
- isVisibleVertical = !this.options.verticalScrolling || newOffsetTop + particle.height > (particle.isFixed ? 0 : scrollTop) && newOffsetTop < (particle.isFixed ? 0 : scrollTop) + this.viewportHeight + this.viewportOffsetTop;
561
- }
562
-
563
- if (isVisibleHorizontal && isVisibleVertical) {
564
- if (particle.isHidden) {
565
- this.options.showElement(particle.$element);
566
- particle.isHidden = false;
567
- }
568
-
569
- this._setPosition(particle.$element, newPositionLeft, particle.startingPositionLeft, newPositionTop, particle.startingPositionTop);
570
- } else {
571
- if (!particle.isHidden) {
572
- this.options.hideElement(particle.$element);
573
- particle.isHidden = true;
574
- }
575
- }
576
- }
577
-
578
- // Reposition backgrounds
579
- for (i = this.backgrounds.length - 1; i >= 0; i--) {
580
- background = this.backgrounds[i];
581
-
582
- fixedRatioOffset = (background.isFixed ? 0 : 1);
583
- bgLeft = (this.options.horizontalScrolling ? (scrollLeft + background.horizontalOffset - this.viewportOffsetLeft - background.startingOffsetLeft + background.parentOffsetLeft - background.startingBackgroundPositionLeft) * (fixedRatioOffset - background.stellarRatio) + 'px' : background.startingValueLeft);
584
- bgTop = (this.options.verticalScrolling ? (scrollTop + background.verticalOffset - this.viewportOffsetTop - background.startingOffsetTop + background.parentOffsetTop - background.startingBackgroundPositionTop) * (fixedRatioOffset - background.stellarRatio) + 'px' : background.startingValueTop);
585
-
586
- setBackgroundPosition(background.$element, bgLeft, bgTop);
587
- }
588
- },
589
- _handleScrollEvent: function() {
590
- var self = this,
591
- ticking = false;
592
-
593
- var update = function() {
594
- self._repositionElements();
595
- ticking = false;
596
- };
597
-
598
- var requestTick = function() {
599
- if (!ticking) {
600
- requestAnimFrame(update);
601
- ticking = true;
602
- }
603
- };
604
-
605
- this.$scrollElement.bind('scroll.' + this.name, requestTick);
606
- requestTick();
607
- },
608
- _startAnimationLoop: function() {
609
- var self = this;
610
-
611
- this._animationLoop = function() {
612
- requestAnimFrame(self._animationLoop);
613
- self._repositionElements();
614
- };
615
- this._animationLoop();
616
- }
617
- };
618
-
619
- $.fn[pluginName] = function (options) {
620
- var args = arguments;
621
- if (options === undefined || typeof options === 'object') {
622
- return this.each(function () {
623
- if (!$.data(this, 'plugin_' + pluginName)) {
624
- $.data(this, 'plugin_' + pluginName, new Plugin(this, options));
625
- }
626
- });
627
- } else if (typeof options === 'string' && options[0] !== '_' && options !== 'init') {
628
- return this.each(function () {
629
- var instance = $.data(this, 'plugin_' + pluginName);
630
- if (instance instanceof Plugin && typeof instance[options] === 'function') {
631
- instance[options].apply(instance, Array.prototype.slice.call(args, 1));
632
- }
633
- if (options === 'destroy') {
634
- $.data(this, 'plugin_' + pluginName, null);
635
- }
636
- });
637
- }
638
- };
639
-
640
- $[pluginName] = function(options) {
641
- var $window = $(window);
642
- return $window.stellar.apply($window, Array.prototype.slice.call(arguments, 0));
643
- };
644
-
645
- // Expose the scroll and position property function hashes so they can be extended
646
- $[pluginName].scrollProperty = scrollProperty;
647
- $[pluginName].positionProperty = positionProperty;
648
-
649
- // Expose the plugin class so it can be modified
650
- window.Stellar = Plugin;
651
- }(jQuery, this, document));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
js/jquery.stellar.min.js DELETED
@@ -1 +0,0 @@
1
- !function(t,e,i,s){function o(e,i){this.element=e,this.options=t.extend({},r,i),this._defaults=r,this._name=n,this.init()}var n="stellar",r={scrollProperty:"scroll",positionProperty:"position",horizontalScrolling:!0,verticalScrolling:!0,horizontalOffset:0,verticalOffset:0,responsive:!1,parallaxBackgrounds:!0,parallaxElements:!0,hideDistantElements:!0,hideElement:function(t){t.hide()},showElement:function(t){t.show()}},a={scroll:{getLeft:function(t){return t.scrollLeft()},setLeft:function(t,e){t.scrollLeft(e)},getTop:function(t){return t.scrollTop()},setTop:function(t,e){t.scrollTop(e)}},position:{getLeft:function(t){return-1*parseInt(t.css("left"),10)},getTop:function(t){return-1*parseInt(t.css("top"),10)}},margin:{getLeft:function(t){return-1*parseInt(t.css("margin-left"),10)},getTop:function(t){return-1*parseInt(t.css("margin-top"),10)}},transform:{getLeft:function(t){var e=getComputedStyle(t[0])[c];return"none"!==e?-1*parseInt(e.match(/(-?[0-9]+)/g)[4],10):0},getTop:function(t){var e=getComputedStyle(t[0])[c];return"none"!==e?-1*parseInt(e.match(/(-?[0-9]+)/g)[5],10):0}}},l={position:{setLeft:function(t,e){t.css("left",e)},setTop:function(t,e){t.css("top",e)}},transform:{setPosition:function(t,e,i,s,o){t[0].style[c]="translate3d("+(e-i)+"px, "+(s-o)+"px, 0)"}}},f=function(){var e,i=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,s=t("script")[0].style,o="";for(e in s)if(i.test(e)){o=e.match(i)[0];break}return"WebkitOpacity"in s&&(o="Webkit"),"KhtmlOpacity"in s&&(o="Khtml"),function(t){return o+(o.length>0?t.charAt(0).toUpperCase()+t.slice(1):t)}}(),c=f("transform"),h=t("<div />",{style:"background:#fff"}).css("background-position-x")!==s,p=h?function(t,e,i){t.css({"background-position-x":e,"background-position-y":i})}:function(t,e,i){t.css("background-position",e+" "+i)},d=h?function(t){return[t.css("background-position-x"),t.css("background-position-y")]}:function(t){return t.css("background-position").split(" ")},u=e.requestAnimationFrame||e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame||e.msRequestAnimationFrame||function(t){setTimeout(t,1e3/60)};o.prototype={init:function(){this.options.name=n+"_"+Math.floor(1e9*Math.random()),this._defineElements(),this._defineGetters(),this._defineSetters(),this._handleWindowLoadAndResize(),this._detectViewport(),this.refresh({firstLoad:!0}),"scroll"===this.options.scrollProperty?this._handleScrollEvent():this._startAnimationLoop()},_defineElements:function(){this.element===i.body&&(this.element=e),this.$scrollElement=t(this.element),this.$element=this.element===e?t("body"):this.$scrollElement,this.$viewportElement=this.options.viewportElement!==s?t(this.options.viewportElement):this.$scrollElement[0]===e||"scroll"===this.options.scrollProperty?this.$scrollElement:this.$scrollElement.parent()},_defineGetters:function(){var t=this,e=a[t.options.scrollProperty];this._getScrollLeft=function(){return e.getLeft(t.$scrollElement)},this._getScrollTop=function(){return e.getTop(t.$scrollElement)}},_defineSetters:function(){var e=this,i=a[e.options.scrollProperty],s=l[e.options.positionProperty],o=i.setLeft,n=i.setTop;this._setScrollLeft="function"==typeof o?function(t){o(e.$scrollElement,t)}:t.noop,this._setScrollTop="function"==typeof n?function(t){n(e.$scrollElement,t)}:t.noop,this._setPosition=s.setPosition||function(t,i,o,n,r){e.options.horizontalScrolling&&s.setLeft(t,i,o),e.options.verticalScrolling&&s.setTop(t,n,r)}},_handleWindowLoadAndResize:function(){var i=this,s=t(e);i.options.responsive&&s.bind("load."+this.name,function(){i.refresh()}),s.bind("resize."+this.name,function(){i._detectViewport(),i.options.responsive&&i.refresh()})},refresh:function(i){var s=this,o=s._getScrollLeft(),n=s._getScrollTop();i&&i.firstLoad||this._reset(),this._setScrollLeft(0),this._setScrollTop(0),this._setOffsets(),this._findParticles(),this._findBackgrounds(),i&&i.firstLoad&&/WebKit/.test(navigator.userAgent)&&t(e).load(function(){var t=s._getScrollLeft(),e=s._getScrollTop();s._setScrollLeft(t+1),s._setScrollTop(e+1),s._setScrollLeft(t),s._setScrollTop(e)}),this._setScrollLeft(o),this._setScrollTop(n)},_detectViewport:function(){var t=this.$viewportElement.offset(),e=null!==t&&t!==s;this.viewportWidth=this.$viewportElement.width(),this.viewportHeight=this.$viewportElement.height(),this.viewportOffsetTop=e?t.top:0,this.viewportOffsetLeft=e?t.left:0},_findParticles:function(){var e=this;this._getScrollLeft(),this._getScrollTop();if(this.particles!==s)for(var i=this.particles.length-1;i>=0;i--)this.particles[i].$element.data("stellar-elementIsActive",s);this.particles=[],this.options.parallaxElements&&this.$element.find("[data-stellar-ratio]").each(function(i){var o,n,r,a,l,f,c,h,p,d=t(this),u=0,g=0,m=0,v=0;if(d.data("stellar-elementIsActive")){if(d.data("stellar-elementIsActive")!==this)return}else d.data("stellar-elementIsActive",this);e.options.showElement(d),d.data("stellar-startingLeft")?(d.css("left",d.data("stellar-startingLeft")),d.css("top",d.data("stellar-startingTop"))):(d.data("stellar-startingLeft",d.css("left")),d.data("stellar-startingTop",d.css("top"))),r=d.position().left,a=d.position().top,l="auto"===d.css("margin-left")?0:parseInt(d.css("margin-left"),10),f="auto"===d.css("margin-top")?0:parseInt(d.css("margin-top"),10),h=d.offset().left-l,p=d.offset().top-f,d.parents().each(function(){var e=t(this);return e.data("stellar-offset-parent")===!0?(u=m,g=v,c=e,!1):(m+=e.position().left,void(v+=e.position().top))}),o=d.data("stellar-horizontal-offset")!==s?d.data("stellar-horizontal-offset"):c!==s&&c.data("stellar-horizontal-offset")!==s?c.data("stellar-horizontal-offset"):e.horizontalOffset,n=d.data("stellar-vertical-offset")!==s?d.data("stellar-vertical-offset"):c!==s&&c.data("stellar-vertical-offset")!==s?c.data("stellar-vertical-offset"):e.verticalOffset,e.particles.push({$element:d,$offsetParent:c,isFixed:"fixed"===d.css("position"),horizontalOffset:o,verticalOffset:n,startingPositionLeft:r,startingPositionTop:a,startingOffsetLeft:h,startingOffsetTop:p,parentOffsetLeft:u,parentOffsetTop:g,stellarRatio:d.data("stellar-ratio")!==s?d.data("stellar-ratio"):1,width:d.outerWidth(!0),height:d.outerHeight(!0),isHidden:!1})})},_findBackgrounds:function(){var e,i=this,o=this._getScrollLeft(),n=this._getScrollTop();this.backgrounds=[],this.options.parallaxBackgrounds&&(e=this.$element.find("[data-stellar-background-ratio]"),this.$element.data("stellar-background-ratio")&&(e=e.add(this.$element)),e.each(function(){var e,r,a,l,f,c,h,u=t(this),g=d(u),m=0,v=0,L=0,_=0;if(u.data("stellar-backgroundIsActive")){if(u.data("stellar-backgroundIsActive")!==this)return}else u.data("stellar-backgroundIsActive",this);u.data("stellar-backgroundStartingLeft")?p(u,u.data("stellar-backgroundStartingLeft"),u.data("stellar-backgroundStartingTop")):(u.data("stellar-backgroundStartingLeft",g[0]),u.data("stellar-backgroundStartingTop",g[1])),a="auto"===u.css("margin-left")?0:parseInt(u.css("margin-left"),10),l="auto"===u.css("margin-top")?0:parseInt(u.css("margin-top"),10),f=u.offset().left-a-o,c=u.offset().top-l-n,u.parents().each(function(){var e=t(this);return e.data("stellar-offset-parent")===!0?(m=L,v=_,h=e,!1):(L+=e.position().left,void(_+=e.position().top))}),e=u.data("stellar-horizontal-offset")!==s?u.data("stellar-horizontal-offset"):h!==s&&h.data("stellar-horizontal-offset")!==s?h.data("stellar-horizontal-offset"):i.horizontalOffset,r=u.data("stellar-vertical-offset")!==s?u.data("stellar-vertical-offset"):h!==s&&h.data("stellar-vertical-offset")!==s?h.data("stellar-vertical-offset"):i.verticalOffset,i.backgrounds.push({$element:u,$offsetParent:h,isFixed:"fixed"===u.css("background-attachment"),horizontalOffset:e,verticalOffset:r,startingValueLeft:g[0],startingValueTop:g[1],startingBackgroundPositionLeft:isNaN(parseInt(g[0],10))?0:parseInt(g[0],10),startingBackgroundPositionTop:isNaN(parseInt(g[1],10))?0:parseInt(g[1],10),startingPositionLeft:u.position().left,startingPositionTop:u.position().top,startingOffsetLeft:f,startingOffsetTop:c,parentOffsetLeft:m,parentOffsetTop:v,stellarRatio:u.data("stellar-background-ratio")===s?1:u.data("stellar-background-ratio")})}))},_reset:function(){var t,e,i,s,o;for(o=this.particles.length-1;o>=0;o--)t=this.particles[o],e=t.$element.data("stellar-startingLeft"),i=t.$element.data("stellar-startingTop"),this._setPosition(t.$element,e,e,i,i),this.options.showElement(t.$element),t.$element.data("stellar-startingLeft",null).data("stellar-elementIsActive",null).data("stellar-backgroundIsActive",null);for(o=this.backgrounds.length-1;o>=0;o--)s=this.backgrounds[o],s.$element.data("stellar-backgroundStartingLeft",null).data("stellar-backgroundStartingTop",null),p(s.$element,s.startingValueLeft,s.startingValueTop)},destroy:function(){this._reset(),this.$scrollElement.unbind("resize."+this.name).unbind("scroll."+this.name),this._animationLoop=t.noop,t(e).unbind("load."+this.name).unbind("resize."+this.name)},_setOffsets:function(){var i=this,s=t(e);s.unbind("resize.horizontal-"+this.name).unbind("resize.vertical-"+this.name),"function"==typeof this.options.horizontalOffset?(this.horizontalOffset=this.options.horizontalOffset(),s.bind("resize.horizontal-"+this.name,function(){i.horizontalOffset=i.options.horizontalOffset()})):this.horizontalOffset=this.options.horizontalOffset,"function"==typeof this.options.verticalOffset?(this.verticalOffset=this.options.verticalOffset(),s.bind("resize.vertical-"+this.name,function(){i.verticalOffset=i.options.verticalOffset()})):this.verticalOffset=this.options.verticalOffset},_repositionElements:function(){var t,e,i,s,o,n,r,a,l,f,c=this._getScrollLeft(),h=this._getScrollTop(),d=!0,u=!0;if(this.currentScrollLeft!==c||this.currentScrollTop!==h||this.currentWidth!==this.viewportWidth||this.currentHeight!==this.viewportHeight){for(this.currentScrollLeft=c,this.currentScrollTop=h,this.currentWidth=this.viewportWidth,this.currentHeight=this.viewportHeight,f=this.particles.length-1;f>=0;f--)t=this.particles[f],e=t.isFixed?1:0,this.options.horizontalScrolling?(n=(c+t.horizontalOffset+this.viewportOffsetLeft+t.startingPositionLeft-t.startingOffsetLeft+t.parentOffsetLeft)*-(t.stellarRatio+e-1)+t.startingPositionLeft,a=n-t.startingPositionLeft+t.startingOffsetLeft):(n=t.startingPositionLeft,a=t.startingOffsetLeft),this.options.verticalScrolling?(r=(h+t.verticalOffset+this.viewportOffsetTop+t.startingPositionTop-t.startingOffsetTop+t.parentOffsetTop)*-(t.stellarRatio+e-1)+t.startingPositionTop,l=r-t.startingPositionTop+t.startingOffsetTop):(r=t.startingPositionTop,l=t.startingOffsetTop),this.options.hideDistantElements&&(u=!this.options.horizontalScrolling||a+t.width>(t.isFixed?0:c)&&a<(t.isFixed?0:c)+this.viewportWidth+this.viewportOffsetLeft,d=!this.options.verticalScrolling||l+t.height>(t.isFixed?0:h)&&l<(t.isFixed?0:h)+this.viewportHeight+this.viewportOffsetTop),u&&d?(t.isHidden&&(this.options.showElement(t.$element),t.isHidden=!1),this._setPosition(t.$element,n,t.startingPositionLeft,r,t.startingPositionTop)):t.isHidden||(this.options.hideElement(t.$element),t.isHidden=!0);for(f=this.backgrounds.length-1;f>=0;f--)i=this.backgrounds[f],e=i.isFixed?0:1,s=this.options.horizontalScrolling?(c+i.horizontalOffset-this.viewportOffsetLeft-i.startingOffsetLeft+i.parentOffsetLeft-i.startingBackgroundPositionLeft)*(e-i.stellarRatio)+"px":i.startingValueLeft,o=this.options.verticalScrolling?(h+i.verticalOffset-this.viewportOffsetTop-i.startingOffsetTop+i.parentOffsetTop-i.startingBackgroundPositionTop)*(e-i.stellarRatio)+"px":i.startingValueTop,p(i.$element,s,o)}},_handleScrollEvent:function(){var t=this,e=!1,i=function(){t._repositionElements(),e=!1},s=function(){e||(u(i),e=!0)};this.$scrollElement.bind("scroll."+this.name,s),s()},_startAnimationLoop:function(){var t=this;this._animationLoop=function(){u(t._animationLoop),t._repositionElements()},this._animationLoop()}},t.fn[n]=function(e){var i=arguments;return e===s||"object"==typeof e?this.each(function(){t.data(this,"plugin_"+n)||t.data(this,"plugin_"+n,new o(this,e))}):"string"==typeof e&&"_"!==e[0]&&"init"!==e?this.each(function(){var s=t.data(this,"plugin_"+n);s instanceof o&&"function"==typeof s[e]&&s[e].apply(s,Array.prototype.slice.call(i,1)),"destroy"===e&&t.data(this,"plugin_"+n,null)}):void 0},t[n]=function(i){var s=t(e);return s.stellar.apply(s,Array.prototype.slice.call(arguments,0))},t[n].scrollProperty=a,t[n].positionProperty=l,e.Stellar=o}(jQuery,this,document);
 
js/siteorigin-panels-24.js CHANGED
@@ -3307,6 +3307,19 @@ module.exports = Backbone.View.extend( {
3307
 
3308
  this.trigger( 'builder_rendered' );
3309
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3310
  return this;
3311
  },
3312
 
3307
 
3308
  this.trigger( 'builder_rendered' );
3309
 
3310
+ this.$( '.so-tip-wrapper a' ).click( function( e ){
3311
+ e.preventDefault();
3312
+ var $$ = $(this).blur();
3313
+ var newwindow = window.open(
3314
+ $$.attr('href'),
3315
+ 'signup-window',
3316
+ 'height=450,width=650,toolbar=false'
3317
+ );
3318
+ if ( window.focus ) {
3319
+ newwindow.focus();
3320
+ }
3321
+ } );
3322
+
3323
  return this;
3324
  },
3325
 
js/siteorigin-panels-24.min.js CHANGED
@@ -1,3 +1,3 @@
1
  !function e(t,i,s){function o(n,a){if(!i[n]){if(!t[n]){var r="function"==typeof require&&require;if(!a&&r)return r(n,!0);if(l)return l(n,!0);var d=new Error("Cannot find module '"+n+"'");throw d.code="MODULE_NOT_FOUND",d}var c=i[n]={exports:{}};t[n][0].call(c.exports,function(e){var i=t[n][1][e];return o(i?i:e)},c,c.exports,e,t,i,s)}return i[n].exports}for(var l="function"==typeof require&&require,n=0;n<s.length;n++)o(s[n]);return o}({1:[function(e,t,i){var s=window.panels;t.exports=Backbone.Collection.extend({model:s.model.cell,initialize:function(){},totalWeight:function(){var e=0;return this.each(function(t){e+=t.get("weight")}),e},visualSortComparator:function(e){return _.isNull(e.indexes)?null:e.indexes.builder},visualSort:function(){var e=this.comparator;this.comparator=this.visualSortComparator,this.sort(),this.comparator=e}})},{}],2:[function(e,t,i){var s=window.panels;t.exports=Backbone.Collection.extend({model:s.model.historyEntry,builder:null,maxSize:12,initialize:function(){this.on("add",this.onAddEntry,this)},addEntry:function(e,t){_.isEmpty(t)&&(t=this.builder.getPanelsData());var i=new s.model.historyEntry({text:e,data:JSON.stringify(t),time:parseInt((new Date).getTime()/1e3),collection:this});this.add(i)},onAddEntry:function(e){if(this.models.length>1){var t=this.at(this.models.length-2);(e.get("text")===t.get("text")&&e.get("time")-t.get("time")<15||e.get("data")===t.get("data"))&&(this.remove(e),t.set("count",t.get("count")+1))}for(;this.models.length>this.maxSize;)this.shift()}})},{}],3:[function(e,t,i){var s=window.panels;t.exports=Backbone.Collection.extend({model:s.model.row,empty:function(){for(var e;;){if(e=this.collection.first(),!e)break;e.destroy()}},visualSortComparator:function(e){return _.isNull(e.indexes)?null:e.indexes.builder},visualSort:function(){var e=this.comparator;this.comparator=this.visualSortComparator,this.sort(),this.comparator=e}})},{}],4:[function(e,t,i){var s=window.panels;t.exports=Backbone.Collection.extend({model:s.model.widget,initialize:function(){},visualSortComparator:function(e){return _.isNull(e.indexes)?null:e.indexes.builder},visualSort:function(){var e=this.comparator;this.comparator=this.visualSortComparator,this.sort(),this.comparator=e}})},{}],5:[function(e,t,i){var s=window.panels,o=jQuery;t.exports=s.view.dialog.extend({dialogClass:"so-panels-dialog-add-builder",render:function(){this.renderDialog(this.parseDialogContent(o("#siteorigin-panels-dialog-builder").html(),{})),this.$(".so-content .siteorigin-panels-builder").append(this.builder.$el)},initializeDialog:function(){var e=this;this.once("open_dialog_complete",function(){e.builder.initSortable()}),this.on("open_dialog_complete",function(){e.builder.trigger("builder_resize")})}})},{}],6:[function(e,t,i){var s=window.panels,o=jQuery;t.exports=s.view.dialog.extend({historyEntryTemplate:_.template(o("#siteorigin-panels-dialog-history-entry").html().panelsProcessTemplate()),entries:{},currentEntry:null,revertEntry:null,selectedEntry:null,previewScrollTop:null,dialogClass:"so-panels-dialog-history",events:{"click .so-close":"closeDialog","click .so-restore":"restoreSelectedEntry"},initializeDialog:function(){this.entries=new s.collection.historyEntries,this.on("open_dialog",this.setCurrentEntry,this),this.on("open_dialog",this.renderHistoryEntries,this)},render:function(){var e=this;this.renderDialog(this.parseDialogContent(o("#siteorigin-panels-dialog-history").html(),{})),this.$("iframe.siteorigin-panels-history-iframe").load(function(){var t=o(this);t.show(),t.contents().scrollTop(e.previewScrollTop)})},setRevertEntry:function(e){this.revertEntry=new s.model.historyEntry({data:JSON.stringify(e.getPanelsData()),time:parseInt((new Date).getTime()/1e3)})},setCurrentEntry:function(){this.currentEntry=new s.model.historyEntry({data:JSON.stringify(this.builder.model.getPanelsData()),time:parseInt((new Date).getTime()/1e3)}),this.selectedEntry=this.currentEntry,this.previewEntry(this.currentEntry),this.$(".so-buttons .so-restore").addClass("disabled")},renderHistoryEntries:function(){var e=this,t=this.$(".history-entries").empty();this.currentEntry.get("data")===this.revertEntry.get("data")&&_.isEmpty(this.entries.models)||o(this.historyEntryTemplate({title:panelsOptions.loc.history.revert,count:1})).data("historyEntry",this.revertEntry).prependTo(t),this.entries.each(function(i){var s=e.historyEntryTemplate({title:panelsOptions.loc.history[i.get("text")],count:i.get("count")});o(s).data("historyEntry",i).prependTo(t)}),o(this.historyEntryTemplate({title:panelsOptions.loc.history.current,count:1})).data("historyEntry",this.currentEntry).addClass("so-selected").prependTo(t),t.find(".history-entry").click(function(){var i=jQuery(this);t.find(".history-entry").not(i).removeClass("so-selected"),i.addClass("so-selected");var s=i.data("historyEntry");e.selectedEntry=s,e.selectedEntry.cid!==e.currentEntry.cid?e.$(".so-buttons .so-restore").removeClass("disabled"):e.$(".so-buttons .so-restore").addClass("disabled"),e.previewEntry(s)}),this.updateEntryTimes()},previewEntry:function(e){var t=this.$("iframe.siteorigin-panels-history-iframe");t.hide(),this.previewScrollTop=t.contents().scrollTop(),this.$('form.history-form input[name="live_editor_panels_data"]').val(e.get("data")),this.$("form.history-form").submit()},restoreSelectedEntry:function(){return this.$(".so-buttons .so-restore").hasClass("disabled")?!1:this.currentEntry.get("data")===this.selectedEntry.get("data")?(this.closeDialog(),!1):("restore"!==this.selectedEntry.get("text")&&this.builder.addHistoryEntry("restore",this.builder.model.getPanelsData()),this.builder.model.loadPanelsData(JSON.parse(this.selectedEntry.get("data"))),this.closeDialog(),!1)},updateEntryTimes:function(){var e=this;this.$(".history-entries .history-entry").each(function(){var t=jQuery(this),i=t.find(".timesince"),s=t.data("historyEntry");i.html(e.timeSince(s.get("time")))})},timeSince:function(e){var t,i=parseInt((new Date).getTime()/1e3)-e,s=[];return i>3600&&(t=Math.floor(i/3600),1===t?s.push(panelsOptions.loc.time.hour.replace("%d",t)):s.push(panelsOptions.loc.time.hours.replace("%d",t)),i-=3600*t),i>60&&(t=Math.floor(i/60),1===t?s.push(panelsOptions.loc.time.minute.replace("%d",t)):s.push(panelsOptions.loc.time.minutes.replace("%d",t)),i-=60*t),i>0&&(1===i?s.push(panelsOptions.loc.time.second.replace("%d",i)):s.push(panelsOptions.loc.time.seconds.replace("%d",i))),_.isEmpty(s)?panelsOptions.loc.time.now:panelsOptions.loc.time.ago.replace("%s",s.slice(0,2).join(", "))}})},{}],7:[function(e,t,i){var s=window.panels,o=jQuery;t.exports=s.view.dialog.extend({directoryTemplate:_.template(o("#siteorigin-panels-directory-items").html().panelsProcessTemplate()),builder:null,dialogClass:"so-panels-dialog-prebuilt-layouts",layoutCache:{},currentTab:!1,directoryPage:1,events:{"click .so-close":"closeDialog","click .so-sidebar-tabs li a":"tabClickHandler","click .so-content .layout":"layoutClickHandler","keyup .so-sidebar-search":"searchHandler","click .so-screenshot, .so-title":"directoryItemClickHandler"},initializeDialog:function(){var e=this;this.on("open_dialog",function(){e.$(".so-sidebar-tabs li a").first().click(),e.$(".so-status").removeClass("so-panels-loading")}),this.on("button_click",this.toolbarButtonClick,this)},render:function(){this.renderDialog(this.parseDialogContent(o("#siteorigin-panels-dialog-prebuilt").html(),{})),this.initToolbar()},tabClickHandler:function(e){e.preventDefault(),this.selectedLayoutItem=null,this.uploadedLayout=null,this.updateButtonState(!1),this.$(".so-sidebar-tabs li").removeClass("tab-active");var t=o(e.target),i=t.attr("href").split("#")[1];t.parent().addClass("tab-active");var s=this;this.$(".so-content").empty(),s.currentTab=i,"import"==i?this.displayImportExport():this.displayLayoutDirectory("",1,i),s.$(".so-sidebar-search").val("")},displayImportExport:function(){var e=this.$(".so-content").empty().removeClass("so-panels-loading");e.html(o("#siteorigin-panels-dialog-prebuilt-importexport").html());var t=this,i=t.$(".import-upload-ui").hide(),s=new plupload.Uploader({runtimes:"html5,silverlight,flash,html4",browse_button:i.find(".file-browse-button").get(0),container:i.get(0),drop_element:i.find(".drag-upload-area").get(0),file_data_name:"panels_import_data",multiple_queues:!1,max_file_size:panelsOptions.plupload.max_file_size,url:panelsOptions.plupload.url,flash_swf_url:panelsOptions.plupload.flash_swf_url,silverlight_xap_url:panelsOptions.plupload.silverlight_xap_url,filters:[{title:panelsOptions.plupload.filter_title,extensions:"json"}],multipart_params:{action:"so_panels_import_layout"},init:{PostInit:function(e){e.features.dragdrop&&i.addClass("has-drag-drop"),i.show().find(".progress-precent").css("width","0%")},FilesAdded:function(e){i.find(".file-browse-button").blur(),i.find(".drag-upload-area").removeClass("file-dragover"),i.find(".progress-bar").fadeIn("fast"),t.$(".js-so-selected-file").text(panelsOptions.loc.prebuilt_loading),e.start()},UploadProgress:function(e,t){i.find(".progress-precent").css("width",t.percent+"%")},FileUploaded:function(e,s,o){var l=JSON.parse(o.response);_.isUndefined(l.widgets)?alert(panelsOptions.plupload.error_message):(t.uploadedLayout=l,i.find(".progress-bar").hide(),t.$(".js-so-selected-file").text(panelsOptions.loc.ready_to_insert.replace("%s",s.name)),t.updateButtonState(!0))},Error:function(){alert(panelsOptions.plupload.error_message)}}});s.init(),i.find(".drag-upload-area").on("dragover",function(){o(this).addClass("file-dragover")}).on("dragleave",function(){o(this).removeClass("file-dragover")}),e.find(".so-export").submit(function(e){var i=o(this);i.find('input[name="panels_export_data"]').val(JSON.stringify(t.builder.model.getPanelsData()))})},displayLayoutDirectory:function(e,t,i){var s=this,l=this.$(".so-content").empty().addClass("so-panels-loading");return void 0===e&&(e=""),void 0===t&&(t=1),void 0===i&&(i="directory"),"directory"!==i||panelsOptions.directory_enabled?void o.get(panelsOptions.ajaxurl,{action:"so_panels_layouts_query",search:e,page:t,type:i},function(n){if(s.currentTab===i){l.removeClass("so-panels-loading").html(s.directoryTemplate(n));var a=l.find(".so-previous"),r=l.find(".so-next");1>=t?a.addClass("button-disabled"):a.click(function(i){i.preventDefault(),s.displayLayoutDirectory(e,t-1,s.currentTab)}),t===n.max_num_pages||0===n.max_num_pages?r.addClass("button-disabled"):r.click(function(i){i.preventDefault(),s.displayLayoutDirectory(e,t+1,s.currentTab)}),l.find(".so-screenshot").each(function(){var e=o(this),t=e.find(".so-screenshot-wrapper");if(t.css("height",t.width()/4*3+"px").addClass("so-loading"),""!==e.data("src"))var i=o("<img/>").attr("src",e.data("src")).load(function(){t.removeClass("so-loading").css("height","auto"),i.appendTo(t).hide().fadeIn("fast")});else o("<img/>").attr("src",panelsOptions.prebuiltDefaultScreenshot).appendTo(t).hide().fadeIn("fast")}),l.find(".so-directory-browse").html(n.title)}},"json"):(l.removeClass("so-panels-loading").html(o("#siteorigin-panels-directory-enable").html()),void l.find(".so-panels-enable-directory").click(function(i){i.preventDefault(),o.get(panelsOptions.ajaxurl,{action:"so_panels_directory_enable"},function(){}),panelsOptions.directory_enabled=!0,l.addClass("so-panels-loading"),s.displayLayoutDirectory(e,t)}))},directoryItemClickHandler:function(e){var t=this.$(e.target).closest(".so-directory-item");this.$(".so-directory-items").find(".selected").removeClass("selected"),t.addClass("selected"),this.selectedLayoutItem={lid:t.data("layout-id"),type:t.data("layout-type")},this.updateButtonState(!0)},toolbarButtonClick:function(e){if(!this.canAddLayout())return!1;var t=e.data("value");if(_.isUndefined(t))return!1;if(this.updateButtonState(!1),e.hasClass("so-needs-confirm")&&!e.hasClass("so-confirmed")){if(this.updateButtonState(!0),e.hasClass("so-confirming"))return;e.addClass("so-confirming");var i=e.html();return e.html('<span class="dashicons dashicons-yes"></span>'+e.data("confirm")),setTimeout(function(){e.removeClass("so-confirmed").html(i)},2500),setTimeout(function(){e.removeClass("so-confirming"),e.addClass("so-confirmed")},200),!1}this.addingLayout=!0,"import"===this.currentTab?this.addLayoutToBuilder(this.uploadedLayout,t):this.loadSelectedLayout().then(function(e){this.addLayoutToBuilder(e,t)}.bind(this))},canAddLayout:function(){return(this.selectedLayoutItem||this.uploadedLayout)&&!this.addingLayout},loadSelectedLayout:function(){this.setStatusMessage(panelsOptions.loc.prebuilt_loading,!0);var e=_.extend(this.selectedLayoutItem,{action:"so_panels_get_layout"}),t=new o.Deferred;return o.get(panelsOptions.ajaxurl,e,function(e){void 0!==e.error?(alert(e.error),t.reject(e)):(this.setStatusMessage("",!1),t.resolve(e))}.bind(this)),t.promise()},searchHandler:function(e){13===e.keyCode&&this.displayLayoutDirectory(o(e.currentTarget).val(),1,this.currentTab)},updateButtonState:function(e){e=e&&(this.selectedLayoutItem||this.uploadedLayout);var t=this.$(".so-import-layout");t.prop("disabled",!e),e?t.removeClass("disabled"):t.addClass("disabled")},addLayoutToBuilder:function(e,t){this.builder.addHistoryEntry("prebuilt_loaded"),this.builder.model.loadPanelsData(e,t),this.addingLayout=!1,this.closeDialog()}})},{}],8:[function(e,t,i){var s=window.panels,o=jQuery;t.exports=s.view.dialog.extend({cellPreviewTemplate:_.template(o("#siteorigin-panels-dialog-row-cell-preview").html().panelsProcessTemplate()),events:{"click .so-close":"closeDialog","click .so-toolbar .so-save":"saveHandler","click .so-toolbar .so-insert":"insertHandler","click .so-toolbar .so-delete":"deleteHandler","click .so-toolbar .so-duplicate":"duplicateHandler","change .row-set-form > *":"setCellsFromForm","click .row-set-form button.set-row":"setCellsFromForm"},dialogClass:"so-panels-dialog-row-edit",styleType:"row",dialogType:"edit",row:{cells:[],style:{}},initializeDialog:function(){this.on("open_dialog",function(){_.isUndefined(this.model)||_.isEmpty(this.model.cells)?this.setRowModel(null):this.setRowModel(this.model),this.regenerateRowPreview()},this),this.row={cells:[.5,.5],style:{}},this.dialogFormsLoaded=0;var e=this;this.on("form_loaded styles_loaded",function(){this.dialogFormsLoaded++,2===this.dialogFormsLoaded&&e.updateModel({refreshArgs:{silent:!0}})})},setRowDialogType:function(e){this.dialogType=e},render:function(e){if(this.renderDialog(this.parseDialogContent(o("#siteorigin-panels-dialog-row").html(),{dialogType:this.dialogType})),"edit"===this.dialogType){this.styles=new s.view.styles,this.styles.model=this.model,this.styles.render("row",o("#post_ID").val(),{builderType:this.builder.config.builderType,dialog:this}),this.builder.supports("addRow")||this.$(".so-buttons .so-duplicate").remove(),this.builder.supports("deleteRow")||this.$(".so-buttons .so-delete").remove();var t=this.$(".so-sidebar.so-right-sidebar");this.styles.attach(t),this.styles.on("styles_loaded",function(e){e?t.removeClass("so-panels-loading"):(t.closest(".so-panels-dialog").removeClass("so-panels-dialog-has-right-sidebar"),t.remove())},this),t.addClass("so-panels-loading")}_.isUndefined(this.model)||this.$("input.so-row-field").val(this.model.cells.length);return this.$("input.so-row-field").keyup(function(){o(this).trigger("change")}),this},setRowModel:function(e){return this.model=e,_.isEmpty(this.model)?this:(this.row={cells:this.model.cells.map(function(e){return e.get("weight")}),style:{}},this.$("input.so-row-field").val(this.model.cells.length),this)},regenerateRowPreview:function(){var e=this,t=this.$(".row-preview");t.empty();var i;_.each(this.row.cells,function(s,l){var n=o(this.cellPreviewTemplate({weight:s}));t.append(n);var a,r=n.prev();r.length&&(a=o('<div class="resize-handle"></div>'),a.appendTo(n).dblclick(function(){var t=e.row.cells[l]+e.row.cells[l-1];e.row.cells[l]=e.row.cells[l-1]=t/2,e.scaleRowWidths()}),a.draggable({axis:"x",containment:t,start:function(e,t){var i=n.clone().appendTo(t.helper).css({position:"absolute",top:"0",width:n.outerWidth(),left:6,height:n.outerHeight()});i.find(".resize-handle").remove();var s=r.clone().appendTo(t.helper).css({position:"absolute",top:"0",width:r.outerWidth(),right:6,height:r.outerHeight()});s.find(".resize-handle").remove(),o(this).data({newCellClone:i,prevCellClone:s}),n.find("> .preview-cell-in").css("visibility","hidden"),r.find("> .preview-cell-in").css("visibility","hidden")},drag:function(i,s){var n=e.row.cells[l]-(s.position.left+6)/t.width(),a=e.row.cells[l-1]+(s.position.left+6)/t.width();s.helper.offset().left-t.offset().left-6;o(this).data("newCellClone").css("width",t.width()*n).find(".preview-cell-weight").html(Math.round(1e3*n)/10),o(this).data("prevCellClone").css("width",t.width()*a).find(".preview-cell-weight").html(Math.round(1e3*a)/10)},stop:function(i,s){o(this).data("newCellClone").remove(),o(this).data("prevCellClone").remove(),n.find(".preview-cell-in").css("visibility","visible"),r.find(".preview-cell-in").css("visibility","visible");var a=s.position.left+6,d=a/t.width();e.row.cells[l]-d>.02&&e.row.cells[l-1]+d>.02&&(e.row.cells[l]-=d,e.row.cells[l-1]+=d),e.scaleRowWidths(),s.helper.css("left",-6)}})),n.find(".preview-cell-weight").click(function(s){e.$(".resize-handle").css("pointer-event","none").draggable("disable"),t.find(".preview-cell-weight").each(function(){var s=jQuery(this).hide();o('<input type="text" class="preview-cell-weight-input no-user-interacted" />').val(parseFloat(s.html())).insertAfter(s).focus(function(){clearTimeout(i)}).keyup(function(e){9!==e.keyCode&&o(this).removeClass("no-user-interacted"),13===e.keyCode&&(e.preventDefault(),o(this).blur())}).keydown(function(e){if(9===e.keyCode){e.preventDefault();var i=t.find(".preview-cell-weight-input"),s=i.index(o(this));s===i.length-1?i.eq(0).focus().select():i.eq(s+1).focus().select()}}).blur(function(){t.find(".preview-cell-weight-input").each(function(t,i){isNaN(parseFloat(o(i).val()))&&o(i).val(Math.floor(1e3*e.row.cells[t])/10)}),i=setTimeout(function(){if(0===t.find(".preview-cell-weight-input").legnth)return!1;var i=[],s=[],l=0,n=0;if(t.find(".preview-cell-weight-input").each(function(t,a){var r=parseFloat(o(a).val());r=isNaN(r)?1/e.row.cells.length:Math.round(10*r)/1e3;var d=!o(a).hasClass("no-user-interacted");i.push(r),s.push(d),d?l+=r:n+=r}),l>0&&n>0&&1-l>0)for(var a=0;a<i.length;a++)s[a]||(i[a]=i[a]/n*(1-l));var r=_.reduce(i,function(e,t){return e+t});i=i.map(function(e){return e/r}),Math.min.apply(Math,i)>.01&&(e.row.cells=i),t.find(".preview-cell").each(function(t,i){o(i).animate({width:Math.round(1e3*e.row.cells[t])/10+"%"},250),o(i).find(".preview-cell-weight-input").val(Math.round(1e3*e.row.cells[t])/10)}),t.find(".preview-cell").css("overflow","visible"),setTimeout(function(){e.regenerateRowPreview()},260)},100)}).click(function(){o(this).select()})}),o(this).siblings(".preview-cell-weight-input").select()})},this),this.trigger("form_loaded",this)},scaleRowWidths:function(){var e=this;this.$(".row-preview .preview-cell").each(function(t,i){o(i).css("width",100*e.row.cells[t]+"%").find(".preview-cell-weight").html(Math.round(1e3*e.row.cells[t])/10)})},setCellsFromForm:function(){try{var e={cells:parseInt(this.$('.row-set-form input[name="cells"]').val()),ratio:parseFloat(this.$('.row-set-form select[name="ratio"]').val()),direction:this.$('.row-set-form select[name="ratio_direction"]').val()};_.isNaN(e.cells)&&(e.cells=1),isNaN(e.ratio)&&(e.ratio=1),e.cells<1?(e.cells=1,this.$('.row-set-form input[name="cells"]').val(e.cells)):e.cells>10&&(e.cells=10,this.$('.row-set-form input[name="cells"]').val(e.cells)),this.$('.row-set-form input[name="ratio"]').val(e.ratio);for(var t=[],i=this.row.cells.length!==e.cells,s=1,l=0;l<e.cells;l++)t.push(s),s*=e.ratio;var n=_.reduce(t,function(e,t){return e+t});if(t=_.map(t,function(e){return e/n}),t=_.filter(t,function(e){return e>.01}),"left"===e.direction&&(t=t.reverse()),this.row.cells=t,i)this.regenerateRowPreview();else{var a=this;this.$(".preview-cell").each(function(e,t){o(t).animate({width:Math.round(1e3*a.row.cells[e])/10+"%"},250),o(t).find(".preview-cell-weight").html(Math.round(1e3*a.row.cells[e])/10)}),this.$(".preview-cell").css("overflow","visible"),setTimeout(function(){a.regenerateRowPreview()},260)}}catch(r){console.log("Error setting cells - "+r.message)}this.$(".row-set-form .so-button-row-set").removeClass("button-primary")},tabClickHandler:function(e){"#row-layout"===e.attr("href")?this.$(".so-panels-dialog").addClass("so-panels-dialog-has-right-sidebar"):this.$(".so-panels-dialog").removeClass("so-panels-dialog-has-right-sidebar")},updateModel:function(e){if(e=_.extend({refresh:!0,refreshArgs:null},e),_.isEmpty(this.model)||this.model.setCells(this.row.cells),!_.isUndefined(this.styles)&&this.styles.stylesLoaded){var t={};try{t=this.getFormValues(".so-sidebar .so-visual-styles").style}catch(i){console.log("Error retrieving styles - "+i.message)}this.model.set("style",t)}e.refresh&&this.builder.model.refreshPanelsData(e.refreshArgs)},insertHandler:function(){this.builder.addHistoryEntry("row_added"),this.model=new s.model.row,this.updateModel();var e=this.builder.getActiveCell({createCell:!1,defaultPosition:"last"}),t={};return null!==e&&(t.at=this.builder.model.rows.indexOf(e.row)+1),this.model.collection=this.builder.model.rows,this.builder.model.rows.add(this.model,t),this.closeDialog(),this.builder.model.refreshPanelsData(),!1},saveHandler:function(){return this.builder.addHistoryEntry("row_edited"),this.updateModel(),this.closeDialog(),this.builder.model.refreshPanelsData(),!1},deleteHandler:function(){return this.model.trigger("visual_destroy"),this.closeDialog({silent:!0}),!1},duplicateHandler:function(){this.builder.addHistoryEntry("row_duplicated");var e=this.model.clone(this.builder.model);return this.builder.model.rows.add(e,{at:this.builder.model.rows.indexOf(this.model)+1}),this.closeDialog({silent:!0}),!1}})},{}],9:[function(e,t,i){var s=window.panels,o=jQuery;t.exports=s.view.dialog.extend({builder:null,sidebarWidgetTemplate:_.template(o("#siteorigin-panels-dialog-widget-sidebar-widget").html().panelsProcessTemplate()),dialogClass:"so-panels-dialog-edit-widget",widgetView:!1,savingWidget:!1,events:{"click .so-close":"saveHandler","click .so-nav.so-previous":"navToPrevious","click .so-nav.so-next":"navToNext","click .so-toolbar .so-delete":"deleteHandler","click .so-toolbar .so-duplicate":"duplicateHandler"},initializeDialog:function(){var e=this;this.model.on("change:values",this.handleChangeValues,this),this.model.on("destroy",this.remove,this),this.dialogFormsLoaded=0,this.on("form_loaded styles_loaded",function(){this.dialogFormsLoaded++,2===this.dialogFormsLoaded&&e.updateModel({refreshArgs:{silent:!0}})})},render:function(){this.renderDialog(this.parseDialogContent(o("#siteorigin-panels-dialog-widget").html(),{})),this.loadForm(),_.isUndefined(panelsOptions.widgets[this.model.get("class")])?this.$(".so-title .widget-name").html(panelsOptions.loc.missing_widget.title):this.$(".so-title .widget-name").html(panelsOptions.widgets[this.model.get("class")].title),this.builder.supports("addWidget")||this.$(".so-buttons .so-duplicate").remove(),this.builder.supports("deleteWidget")||this.$(".so-buttons .so-delete").remove(),this.styles=new s.view.styles,this.styles.model=this.model,this.styles.render("widget",o("#post_ID").val(),{builderType:this.builder.config.builderType,dialog:this});var e=this.$(".so-sidebar.so-right-sidebar");this.styles.attach(e),this.styles.on("styles_loaded",function(t){t?e.removeClass("so-panels-loading"):(e.closest(".so-panels-dialog").removeClass("so-panels-dialog-has-right-sidebar"),e.remove())},this),e.addClass("so-panels-loading")},getPrevDialog:function(){var e=this.builder.$(".so-cells .cell .so-widget");if(e.length<=1)return!1;var t=e.index(this.widgetView.$el);if(0===t)return!1;do if(widgetView=e.eq(--t).data("view"),!_.isUndefined(widgetView)&&!widgetView.model.get("read_only"))return widgetView.getEditDialog();while(!_.isUndefined(widgetView)&&t>0);return!1},getNextDialog:function(){var e=this.builder.$(".so-cells .cell .so-widget");if(e.length<=1)return!1;var t,i=e.index(this.widgetView.$el);if(i===e.length-1)return!1;do if(t=e.eq(++i).data("view"),!_.isUndefined(t)&&!t.model.get("read_only"))return t.getEditDialog();while(!_.isUndefined(t));return!1},loadForm:function(){if(this.$("> *").length){var e=this;this.$(".so-content").addClass("so-panels-loading");var t={action:"so_panels_widget_form",widget:this.model.get("class"),instance:JSON.stringify(this.model.get("values")),raw:this.model.get("raw")};o.post(panelsOptions.ajaxurl,t,function(t){var i=t.replace(/{\$id}/g,e.model.cid);e.$(".so-content").removeClass("so-panels-loading").html(i),e.trigger("form_loaded",e),e.$(".panel-dialog").trigger("panelsopen"),e.on("close_dialog",e.updateModel,e)},"html")}},updateModel:function(e){if(e=_.extend({refresh:!0,refreshArgs:null},e),this.savingWidget=!0,!this.model.get("missing")){var t=this.getFormValues();_.isUndefined(t.widgets)?t={}:(t=t.widgets,t=t[Object.keys(t)[0]]),this.model.setValues(t),this.model.set("raw",!0)}if(this.styles.stylesLoaded){var i={};try{i=this.getFormValues(".so-sidebar .so-visual-styles").style}catch(s){}this.model.set("style",i)}this.savingWidget=!1,e.refresh&&this.builder.model.refreshPanelsData(e.refreshArgs)},handleChangeValues:function(){this.savingWidget||this.loadForm()},saveHandler:function(){this.builder.addHistoryEntry("widget_edited"),this.closeDialog()},deleteHandler:function(){return this.model.trigger("visual_destroy"),this.closeDialog({silent:!0}),this.builder.model.refreshPanelsData(),!1},duplicateHandler:function(){return this.model.trigger("user_duplicate"),this.closeDialog({silent:!0}),this.builder.model.refreshPanelsData(),!1}})},{}],10:[function(e,t,i){var s=window.panels,o=jQuery;t.exports=s.view.dialog.extend({builder:null,widgetTemplate:_.template(o("#siteorigin-panels-dialog-widgets-widget").html().panelsProcessTemplate()),filter:{},dialogClass:"so-panels-dialog-add-widget",events:{"click .so-close":"closeDialog","click .widget-type":"widgetClickHandler","keyup .so-sidebar-search":"searchHandler"},initializeDialog:function(){this.on("open_dialog",function(){this.filter.search="",this.filterWidgets(this.filter)},this),this.on("open_dialog_complete",function(){this.$(".so-sidebar-search").val("").focus(),this.balanceWidgetHeights()}),this.on("tab_click",this.tabClickHandler,this)},render:function(){this.renderDialog(this.parseDialogContent(o("#siteorigin-panels-dialog-widgets").html(),{})),_.each(panelsOptions.widgets,function(e){var t=o(this.widgetTemplate({title:e.title,description:e.description}));_.isUndefined(e.icon)&&(e.icon="dashicons dashicons-admin-generic"),o('<span class="widget-icon" />').addClass(e.icon).prependTo(t.find(".widget-type-wrapper")),t.data("class",e["class"]).appendTo(this.$(".widget-type-list"))},this);var e=this.$(".so-sidebar-tabs");_.each(panelsOptions.widget_dialog_tabs,function(t){o(this.dialogTabTemplate({title:t.title})).data({message:t.message,filter:t.filter}).appendTo(e)},this),this.initTabs();var t=this;o(window).resize(function(){t.balanceWidgetHeights()})},tabClickHandler:function(e){this.filter=e.parent().data("filter"),this.filter.search=this.$(".so-sidebar-search").val();var t=e.parent().data("message");return _.isEmpty(t)&&(t=""),this.$(".so-toolbar .so-status").html(t),this.filterWidgets(this.filter),!1},searchHandler:function(e){this.filter.search=o(e.target).val(),this.filterWidgets(this.filter)},filterWidgets:function(e){_.isUndefined(e)&&(e={}),_.isUndefined(e.groups)&&(e.groups=""),this.$(".widget-type-list .widget-type").each(function(){var t,i=o(this),s=i.data("class"),l=_.isUndefined(panelsOptions.widgets[s])?null:panelsOptions.widgets[s];t=_.isEmpty(e.groups)?!0:null===l||_.isEmpty(_.intersection(e.groups,panelsOptions.widgets[s].groups))?!1:!0,t&&(_.isUndefined(e.search)||""===e.search||-1===l.title.toLowerCase().indexOf(e.search.toLowerCase())&&(t=!1)),t?i.show():i.hide()}),this.balanceWidgetHeights()},widgetClickHandler:function(e){this.builder.addHistoryEntry("widget_added");var t=o(e.currentTarget),i=new s.model.widget({"class":t.data("class")});i.cell=this.builder.getActiveCell(),i.cell.widgets.add(i),this.closeDialog(),this.builder.model.refreshPanelsData()},balanceWidgetHeights:function(e){var t=[[]],i=null,s=Math.round(this.$(".widget-type").parent().width()/this.$(".widget-type").width());this.$(".widget-type").css("clear","none").filter(":visible").each(function(e,t){e%s===0&&0!==e&&o(t).css("clear","both")}),this.$(".widget-type-wrapper").css("height","auto").filter(":visible").each(function(e,s){var l=o(s);null!==i&&i.position().top!==l.position().top&&(t[t.length]=[]),i=l,t[t.length-1].push(l)}),_.each(t,function(e,t){var i=_.max(e.map(function(e){return e.height()}));_.each(e,function(e){e.height(i)})})}})},{}],11:[function(e,t,i){var s=window.panels,o=jQuery;t.exports=function(e){return this.each(function(){var t=jQuery(this),i=t.closest("form").find(".widget-id").val(),l=o.extend(!0,{},e);if(_.isUndefined(i)||!(i.indexOf("__i__")>-1)){var n=new s.model.builder,a=new s.view.builder({model:n,config:l}),r=t.closest(".so-panels-dialog-wrapper").data("view");_.isUndefined(r)||(r.on("close_dialog",function(){n.refreshPanelsData()}),r.on("open_dialog_complete",function(){a.trigger("builder_resize")}),r.model.on("destroy",function(){n.emptyRows().destroy()}),a.setDialogParents(panelsOptions.loc.layout_widget,r));var d=Boolean(t.closest(".widget-content").length);a.render().attach({container:t,dialog:d||"dialog"===t.data("mode"),type:t.data("type")}).setDataField(t.find("input.panels-data")),d||"dialog"===t.data("mode")?(a.setDialogParents(panelsOptions.loc.layout_widget,a.dialog),t.find(".siteorigin-panels-display-builder").click(function(e){e.preventDefault(),a.dialog.openDialog()})):t.find(".siteorigin-panels-display-builder").parent().remove(),o(document).trigger("panels_setup",a)}})}},{}],12:[function(e,t,i){String.prototype.panelsProcessTemplate=function(){var e=this;return e=e.replace(/{{%/g,"<%"),e=e.replace(/%}}/g,"%>"),e=e.trim()};var s={};window.panels=s,window.siteoriginPanels=s,s.model={},s.model.widget=e("./model/widget"),s.model.cell=e("./model/cell"),s.model.row=e("./model/row"),s.model.builder=e("./model/builder"),s.model.historyEntry=e("./model/history-entry"),s.collection={},s.collection.widgets=e("./collection/widgets"),s.collection.cells=e("./collection/cells"),s.collection.rows=e("./collection/rows"),s.collection.historyEntries=e("./collection/history-entries"),s.view={},s.view.widget=e("./view/widget"),s.view.cell=e("./view/cell"),s.view.row=e("./view/row"),s.view.builder=e("./view/builder"),s.view.dialog=e("./view/dialog"),s.view.styles=e("./view/styles"),s.view.liveEditor=e("./view/live-editor"),s.dialog={},s.dialog.builder=e("./dialog/builder"),s.dialog.widgets=e("./dialog/widgets"),s.dialog.widget=e("./dialog/widget"),s.dialog.prebuilt=e("./dialog/prebuilt"),s.dialog.row=e("./dialog/row"),s.dialog.history=e("./dialog/history"),s.utils={},s.utils.menu=e("./utils/menu"),jQuery.fn.soPanelsSetupBuilderWidget=e("./jquery/setup-builder-widget"),jQuery(function(e){var t,i,s,o;if(e("#siteorigin-panels-metabox").length&&e("form#post").length)t=e("#siteorigin-panels-metabox"),i=e("#siteorigin-panels-metabox .siteorigin-panels-data-field"),s=e("form#post"),o={editorType:"tinymce",postId:e("#post_ID").val(),editorId:"#content",builderType:e("#siteorigin-panels-metabox").data("builder-type"),builderSupports:e("#siteorigin-panels-metabox").data("builder-supports"),loadLiveEditor:1==e("#siteorigin-panels-metabox").data("live-editor"),liveEditorPreview:t.data("preview-url")};else if(e(".siteorigin-panels-builder-form").length){var l=e(".siteorigin-panels-builder-form");t=l.find(".siteorigin-panels-builder-container"),i=l.find('input[name="panels_data"]'),s=l,o={editorType:"standalone",postId:l.data("post-id"),editorId:"#post_content",builderType:l.data("type"),
2
- builderSupports:l.data("builder-supports"),loadLiveEditor:!1,liveEditorPreview:l.data("preview-url")}}if(!_.isUndefined(t)){var n=window.siteoriginPanels,a=new n.model.builder,r=new n.view.builder({model:a,config:o});r.render().attach({container:t}).setDataField(i).attachToEditor(),s.submit(function(){a.refreshPanelsData()}),t.removeClass("so-panels-loading"),e(document).trigger("panels_setup",r,window.panels)}e(document).on("widget-added",function(t,i){e(i).find(".siteorigin-page-builder-widget").soPanelsSetupBuilderWidget()}),e("body").hasClass("wp-customizer")||e(function(){e(".siteorigin-page-builder-widget").soPanelsSetupBuilderWidget()})})},{"./collection/cells":1,"./collection/history-entries":2,"./collection/rows":3,"./collection/widgets":4,"./dialog/builder":5,"./dialog/history":6,"./dialog/prebuilt":7,"./dialog/row":8,"./dialog/widget":9,"./dialog/widgets":10,"./jquery/setup-builder-widget":11,"./model/builder":13,"./model/cell":14,"./model/history-entry":15,"./model/row":16,"./model/widget":17,"./utils/menu":18,"./view/builder":19,"./view/cell":20,"./view/dialog":21,"./view/live-editor":22,"./view/row":23,"./view/styles":24,"./view/widget":25}],13:[function(e,t,i){t.exports=Backbone.Model.extend({layoutPosition:{BEFORE:"before",AFTER:"after",REPLACE:"replace"},rows:{},defaults:{data:{widgets:[],grids:[],grid_cells:[]}},initialize:function(){this.rows=new panels.collection.rows},addRow:function(e,t){t=_.extend({noAnimate:!1},t);var i=new panels.model.row({collection:this.rows});return i.setCells(e),i.builder=this,this.rows.add(i,t),i},loadPanelsData:function(e,t){try{t===this.layoutPosition.BEFORE?e=this.concatPanelsData(e,this.getPanelsData()):t===this.layoutPosition.AFTER&&(e=this.concatPanelsData(this.getPanelsData(),e)),this.emptyRows(),this.set("data",JSON.parse(JSON.stringify(e)),{silent:!0});var i=[];if(_.isUndefined(e.grid_cells))return void this.trigger("load_panels_data");for(var s,o=0;o<e.grid_cells.length;o++)s=parseInt(e.grid_cells[o].grid),_.isUndefined(i[s])&&(i[s]=[]),i[s].push(parseFloat(e.grid_cells[o].weight));var l=this;if(_.each(i,function(t,i){var s=l.addRow(t,{noAnimate:!0});_.isUndefined(e.grids[i].style)||s.set("style",e.grids[i].style)}),_.isUndefined(e.widgets))return;_.each(e.widgets,function(e){var t=null;_.isUndefined(e.panels_info)?(t=e.info,delete e.info):(t=e.panels_info,delete e.panels_info);var i=l.rows.at(parseInt(t.grid)),s=i.cells.at(parseInt(t.cell)),o=new panels.model.widget({"class":t["class"],values:e});_.isUndefined(t.style)||o.set("style",t.style),_.isUndefined(t.read_only)||o.set("read_only",t.read_only),_.isUndefined(t.widget_id)?o.set("widget_id",l.generateUUID()):o.set("widget_id",t.widget_id),o.cell=s,s.widgets.add(o,{noAnimate:!0})}),this.trigger("load_panels_data")}catch(n){console.log("Error loading data: "+n.message)}},concatPanelsData:function(e,t){if(_.isUndefined(t)||_.isUndefined(t.grids)||_.isEmpty(t.grids)||_.isUndefined(t.grid_cells)||_.isEmpty(t.grid_cells))return e;if(_.isUndefined(e)||_.isUndefined(e.grids)||_.isEmpty(e.grids))return t;var i=e.grids.length,s=_.isUndefined(e.widgets)?0:e.widgets.length,o={grids:[],grid_cells:[],widgets:[]};o.grids=e.grids.concat(t.grids),_.isUndefined(e.grid_cells)||(o.grid_cells=e.grid_cells.slice()),_.isUndefined(e.widgets)||(o.widgets=e.widgets.slice());var l;for(l=0;l<t.grid_cells.length;l++){var n=t.grid_cells[l];n.grid=parseInt(n.grid)+i,o.grid_cells.push(n)}if(!_.isUndefined(t.widgets))for(l=0;l<t.widgets.length;l++){var a=t.widgets[l];a.panels_info.grid=parseInt(a.panels_info.grid)+i,a.panels_info.id=parseInt(a.panels_info.id)+s,o.widgets.push(a)}return o},getPanelsData:function(){var e=this,t={widgets:[],grids:[],grid_cells:[]},i=0;return this.rows.each(function(s,o){s.cells.each(function(s,l){s.widgets.each(function(s,n){var a={"class":s.get("class"),raw:s.get("raw"),grid:o,cell:l,id:i++,widget_id:s.get("widget_id"),style:s.get("style")};_.isEmpty(a.widget_id)&&(a.widget_id=e.generateUUID());var r=_.extend(_.clone(s.get("values")),{panels_info:a});t.widgets.push(r)}),t.grid_cells.push({grid:o,weight:s.get("weight")})}),t.grids.push({cells:s.cells.length,style:s.get("style")})}),t},refreshPanelsData:function(e){e=_.extend({silent:!1},e);var t=this.get("data"),i=this.getPanelsData();this.set("data",i,{silent:!0}),e.silent||JSON.stringify(i)===JSON.stringify(t)||(this.trigger("change"),this.trigger("change:data"),this.trigger("refresh_panels_data",i,e))},emptyRows:function(){return _.invoke(this.rows.toArray(),"destroy"),this.rows.reset(),this},isValidLayoutPosition:function(e){return e===this.layoutPosition.BEFORE||e===this.layoutPosition.AFTER||e===this.layoutPosition.REPLACE},generateUUID:function(){var e=(new Date).getTime();window.performance&&"function"==typeof window.performance.now&&(e+=performance.now());var t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var i=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"==t?i:3&i|8).toString(16)});return t}})},{}],14:[function(e,t,i){t.exports=Backbone.Model.extend({widgets:{},row:null,defaults:{weight:0},indexes:null,initialize:function(){this.widgets=new panels.collection.widgets,this.on("destroy",this.onDestroy,this)},onDestroy:function(){_.invoke(this.widgets.toArray(),"destroy"),this.widgets.reset()},clone:function(e,t){_.isUndefined(e)&&(e=this.row),t=_.extend({cloneWidgets:!0},t);var i=new this.constructor(this.attributes);return i.set("collection",e.cells,{silent:!0}),i.row=e,t.cloneWidgets&&this.widgets.each(function(e){i.widgets.add(e.clone(i,t),{silent:!0})}),i}})},{}],15:[function(e,t,i){t.exports=Backbone.Model.extend({defaults:{text:"",data:"",time:null,count:1}})},{}],16:[function(e,t,i){t.exports=Backbone.Model.extend({cells:{},builder:null,defaults:{style:{}},indexes:null,initialize:function(){this.cells=new panels.collection.cells,this.on("destroy",this.onDestroy,this)},setCells:function(e){var t=this;if(_.isEmpty(this.cells))_.each(e,function(e){var i=new panels.model.cell({weight:e,collection:t.cells});i.row=t,t.cells.add(i)});else{if(e.length>this.cells.length)for(var i=this.cells.length;i<e.length;i++){var s=new panels.model.cell({weight:e[e.length+i],collection:t.cells});s.row=this,t.cells.add(s)}else if(e.length<this.cells.length){var o=this.cells.at(e.length-1);_.each(this.cells.slice(e.length,this.cells.length),function(e){for(var t=e.widgets.models.slice(0),i=0;i<t.length;i++)t[i].moveToCell(o,{silent:!1});e.destroy()})}this.cells.each(function(t,i){t.set("weight",e[i])})}this.reweightCells()},reweightCells:function(){var e=0;this.cells.each(function(t){e+=t.get("weight")}),this.cells.each(function(t){t.set("weight",t.get("weight")/e)}),this.trigger("reweight_cells")},onDestroy:function(){_.invoke(this.cells.toArray(),"destroy"),this.cells.reset()},clone:function(e,t){_.isUndefined(e)&&(e=this.builder),t=_.extend({cloneCells:!0},t);var i=new this.constructor(this.attributes);return i.set("collection",e.rows,{silent:!0}),i.builder=e,t.cloneCells&&this.cells.each(function(e){i.cells.add(e.clone(i,t),{silent:!0})}),i}})},{}],17:[function(e,t,i){t.exports=Backbone.Model.extend({cell:null,defaults:{"class":null,missing:!1,values:{},raw:!1,style:{},read_only:!1,widget_id:""},indexes:null,initialize:function(){var e=this.get("class");(_.isUndefined(panelsOptions.widgets[e])||!panelsOptions.widgets[e].installed)&&this.set("missing",!0)},getWidgetField:function(e){return _.isUndefined(panelsOptions.widgets[this.get("class")])?"title"===e||"description"===e?panelsOptions.loc.missing_widget[e]:"":panelsOptions.widgets[this.get("class")][e]},moveToCell:function(e,t){return t=_.extend({silent:!0},t),this.cell.cid===e.cid?!1:(this.cell=e,this.collection.remove(this,t),e.widgets.add(this,t),!0)},triggerEdit:function(){this.trigger("user_edit",this)},triggerDuplicate:function(){this.trigger("user_duplicate",this)},setValues:function(e){var t=!1;JSON.stringify(e)!==JSON.stringify(this.get("values"))&&(t=!0),this.set("values",e,{silent:!0}),t&&(this.trigger("change",this),this.trigger("change:values"))},clone:function(e,t){_.isUndefined(e)&&(e=this.cell);var i=new this.constructor(this.attributes),s=JSON.parse(JSON.stringify(this.get("values"))),o=function(e){return _.each(e,function(t,i){_.isString(i)&&"_"===i[0]?delete e[i]:_.isObject(e[i])&&o(e[i])}),e};return s=o(s),"SiteOrigin_Panels_Widgets_Layout"===this.get("class")&&(s.builder_id=Math.random().toString(36).substr(2)),i.set("values",s,{silent:!0}),i.set("collection",e.widgets,{silent:!0}),i.cell=e,i.isDuplicate=!0,i},getTitle:function(){var e=panelsOptions.widgets[this.get("class")];if(_.isUndefined(e))return this.get("class").replace(/_/g," ");if(!_.isUndefined(e.panels_title)&&e.panels_title===!1)return panelsOptions.widgets[this.get("class")].description;var t=this.get("values"),i=["title","text"];for(var s in t)t.hasOwnProperty(s)&&i.push(s);i=_.uniq(i);for(var o in i)if(!_.isUndefined(t[i[o]])&&_.isString(t[i[o]])&&""!==t[i[o]]&&"on"!==t[i[o]]&&"_"!==i[o][0]&&!jQuery.isNumeric(t[i[o]])){var l=t[i[o]];l=l.replace(/<\/?[^>]+(>|$)/g,"");var n=l.split(" ");return n=n.slice(0,20),n.join(" ")}return this.getWidgetField("description")}})},{}],18:[function(e,t,i){var s=(window.panels,jQuery);t.exports=Backbone.View.extend({wrapperTemplate:_.template(s("#siteorigin-panels-context-menu").html().panelsProcessTemplate()),sectionTemplate:_.template(s("#siteorigin-panels-context-menu-section").html().panelsProcessTemplate()),contexts:[],active:!1,events:{"keyup .so-search-wrapper input":"searchKeyUp"},initialize:function(){this.listenContextMenu(),this.render(),this.attach()},listenContextMenu:function(){var e=this;s(window).on("contextmenu",function(t){return e.active&&!e.isOverEl(e.$el,t)?(e.closeMenu(),e.active=!1,t.preventDefault(),!1):e.active?!0:(e.active=!1,e.trigger("activate_context",t,e),void(e.active&&(t.preventDefault(),e.openMenu({left:t.pageX,top:t.pageY}))))})},render:function(){this.setElement(this.wrapperTemplate())},attach:function(){this.$el.appendTo("body")},openMenu:function(e){this.trigger("open_menu"),s(window).on("keyup",{menu:this},this.keyboardListen),s(window).on("click",{menu:this},this.clickOutsideListen),this.$el.css("max-height",s(window).height()-20),e.left+this.$el.outerWidth()+10>=s(window).width()&&(e.left=s(window).width()-this.$el.outerWidth()-10),e.left<=0&&(e.left=10),e.top+this.$el.outerHeight()-s(window).scrollTop()+10>=s(window).height()&&(e.top=s(window).height()+s(window).scrollTop()-this.$el.outerHeight()-10),e.left<=0&&(e.left=10),this.$el.css({left:e.left+1,top:e.top+1}).show(),this.$(".so-search-wrapper input").focus()},closeMenu:function(){this.trigger("close_menu"),s(window).off("keyup",this.keyboardListen),s(window).off("click",this.clickOutsideListen),this.active=!1,this.$el.empty().hide()},keyboardListen:function(e){var t=e.data.menu;switch(e.which){case 27:t.closeMenu()}},clickOutsideListen:function(e){var t=e.data.menu;3!==e.which&&t.$el.is(":visible")&&!t.isOverEl(t.$el,e)&&t.closeMenu()},addSection:function(e,t,i){var o=this;e=_.extend({display:5,defaultDisplay:!1,search:!0,sectionTitle:"",searchPlaceholder:"",titleKey:"title"},e);var l=s(this.sectionTemplate({settings:e,items:t}));this.$el.append(l),l.find(".so-item:not(.so-confirm)").click(function(){var e=s(this);i(e.data("key")),o.closeMenu()}),l.find(".so-item.so-confirm").click(function(){var e=s(this);return e.hasClass("so-confirming")?(i(e.data("key")),void o.closeMenu()):(e.data("original-text",e.html()).addClass("so-confirming").html('<span class="dashicons dashicons-yes"></span> '+panelsOptions.loc.dropdown_confirm),void setTimeout(function(){e.removeClass("so-confirming"),e.html(e.data("original-text"))},2500))}),l.data("settings",e).find(".so-search-wrapper input").trigger("keyup"),this.active=!0},searchKeyUp:function(e){var t=s(e.currentTarget),i=t.closest(".so-section"),o=i.data("settings");if(38===e.which||40===e.which){var l=i.find("ul li:visible"),n=l.filter(".so-active").eq(0);if(n.length){l.removeClass("so-active");var a=l.index(n);38===e.which?n=0>a-1?l.last():l.eq(a-1):40===e.which&&(n=a+1>=l.length?l.first():l.eq(a+1))}else 38===e.which?n=l.last():40===e.which&&(n=l.first());return n.addClass("so-active"),!1}if(13===e.which)return 1===i.find("ul li:visible").length?(i.find("ul li:visible").trigger("click"),!1):(i.find("ul li.so-active:visible").trigger("click"),!1);if(""===t.val())if(o.defaultDisplay){i.find(".so-item").hide();for(var r=0;r<o.defaultDisplay.length;r++)i.find('.so-item[data-key="'+o.defaultDisplay[r]+'"]').show()}else i.find(".so-item").show();else i.find(".so-item").hide().each(function(){var e=s(this);-1!==e.html().toLowerCase().indexOf(t.val().toLowerCase())&&e.show()});i.find(".so-item:visible:gt("+(o.display-1)+")").hide(),0===i.find(".so-item:visible").length&&""!==t.val()?i.find(".so-no-results").show():i.find(".so-no-results").hide()},isOverEl:function(e,t){var i=[[e.offset().left,e.offset().top],[e.offset().left+e.outerWidth(),e.offset().top+e.outerHeight()]];return t.pageX>=i[0][0]&&t.pageX<=i[1][0]&&t.pageY>=i[0][1]&&t.pageY<=i[1][1]}})},{}],19:[function(e,t,i){var s=window.panels,o=jQuery;t.exports=Backbone.View.extend({config:{},template:_.template(o("#siteorigin-panels-builder").html().panelsProcessTemplate()),dialogs:{},rowsSortable:null,dataField:!1,currentData:"",attachedToEditor:!1,liveEditor:void 0,menu:!1,events:{"click .so-tool-button.so-widget-add":"displayAddWidgetDialog","click .so-tool-button.so-row-add":"displayAddRowDialog","click .so-tool-button.so-prebuilt-add":"displayAddPrebuiltDialog","click .so-tool-button.so-history":"displayHistoryDialog","click .so-tool-button.so-live-editor":"displayLiveEditor"},rows:null,initialize:function(e){var t=this;return this.config=_.extend({loadLiveEditor:!1,builderSupports:{}},e.config),this.config.builderSupports=_.extend({addRow:!0,editRow:!0,deleteRow:!0,moveRow:!0,addWidget:!0,editWidget:!0,deleteWidget:!0,moveWidget:!0,prebuilt:!0,history:!0,liveEditor:!0,revertToEditor:!0},this.config.builderSupports),e.config.loadLiveEditor&&this.on("builder_live_editor_added",function(){this.displayLiveEditor()}),this.dialogs={widgets:new s.dialog.widgets,row:new s.dialog.row,prebuilt:new s.dialog.prebuilt},_.each(this.dialogs,function(e,i,s){s[i].setBuilder(t)}),this.dialogs.row.setRowDialogType("create"),this.model.rows.on("add",this.onAddRow,this),o(window).resize(function(e){e.target===window&&t.trigger("builder_resize")}),this.model.on("change:data load_panels_data",this.storeModelData,this),this.on("content_change",this.handleContentChange,this),this.on("display_builder",this.handleDisplayBuilder,this),this.on("builder_rendered builder_resize",this.handleBuilderSizing,this),this.model.on("change:data load_panels_data",this.toggleWelcomeDisplay,this),this.menu=new s.utils.menu({}),this.menu.on("activate_context",this.activateContextMenu,this),this},render:function(){return this.setElement(this.template()),this.$el.attr("id","siteorigin-panels-builder-"+this.cid).addClass("so-builder-container"),this.trigger("builder_rendered"),this},attach:function(e){e=_.extend({container:!1,dialog:!1},e),e.dialog?(this.dialog=new s.dialog.builder,this.dialog.builder=this):(this.$el.appendTo(e.container),this.metabox=e.container.closest(".postbox"),this.initSortable(),this.trigger("attached_to_container",e.container)),this.trigger("builder_attached"),this.supports("liveEditor")&&this.addLiveEditor(),this.supports("history")&&this.addHistoryBrowser();var t=this.$(".so-builder-toolbar");return this.supports("addWidget")||t.find(".so-widget-add").hide(),this.supports("addRow")||t.find(".so-row-add").hide(),this.supports("prebuilt")||t.find(".so-prebuilt-add").hide(),this},attachToEditor:function(){if("tinymce"!==this.config.editorType)return this;this.attachedToEditor=!0;var e=this.metabox,t=this;o("#wp-content-wrap .wp-editor-tabs").find(".wp-switch-editor").click(function(e){e.preventDefault(),o("#wp-content-editor-container, #post-status-info").show(),o("#wp-content-wrap").removeClass("panels-active"),o("#content-resize-handle").show(),t.trigger("hide_builder")}).end().append(o('<a id="content-panels" class="hide-if-no-js wp-switch-editor switch-panels">'+e.find(".hndle span").html()+"</a>").click(function(i){i.preventDefault();jQuery(this);o("#wp-content-wrap, #post-status-info").hide(),e.show().find("> .inside").show(),o(window).resize(),o(document).scroll(),t.trigger("display_builder")})),this.supports("revertToEditor")&&e.find(".so-switch-to-standard").click(function(i){i.preventDefault(),confirm(panelsOptions.loc.confirm_stop_builder)&&(t.addHistoryEntry("back_to_editor"),t.model.loadPanelsData(!1),o("#wp-content-wrap, #post-status-info").show(),e.hide(),o(window).resize())}).show(),e.insertAfter("#wp-content-wrap").hide().addClass("attached-to-editor");var i=this.model.get("data");_.isEmpty(i.widgets)&&_.isEmpty(i.grids)||o("#content-panels.switch-panels").click();var s=function(){var e=t.$(".so-builder-toolbar");if(t.$el.hasClass("so-display-narrow"))return e.css({top:0,left:0,width:"100%",position:"absolute"}),void t.$el.css("padding-top",e.outerHeight());var i=o(window).scrollTop()-t.$el.offset().top;"fixed"===o("#wpadminbar").css("position")&&(i+=o("#wpadminbar").outerHeight());var s={top:0,bottom:t.$el.outerHeight()-e.outerHeight()+20};i>s.top&&i<s.bottom?"fixed"!==e.css("position")&&e.css({top:o("#wpadminbar").outerHeight(),left:t.$el.offset().left,width:t.$el.outerWidth(),position:"fixed"}):e.css({top:Math.min(Math.max(i,0),t.$el.outerHeight()-e.outerHeight()+20),left:0,width:"100%",position:"absolute"}),t.$el.css("padding-top",e.outerHeight())};return this.on("builder_resize",s,this),o(document).scroll(s),s(),this.trigger("builder_attached_to_editor"),this},initSortable:function(){if(!this.supports("moveRow"))return this;var e=this;return this.rowsSortable=this.$(".so-rows-container").sortable({appendTo:"#wpwrap",items:".so-row-container",handle:".so-row-move",axis:"y",tolerance:"pointer",scroll:!1,stop:function(t){e.addHistoryEntry("row_moved"),e.sortCollections()}}),this},refreshSortable:function(){_.isNull(this.rowsSortable)||this.rowsSortable.sortable("refresh")},setDataField:function(e,t){if(t=_.extend({load:!0},t),this.dataField=e,this.dataField.data("builder",this),t.load&&""!==e.val()){var i=this.dataField.val();try{i=JSON.parse(i)}catch(s){i={}}this.model.loadPanelsData(i),this.currentData=i,this.toggleWelcomeDisplay(),this.sortCollections()}return this},storeModelData:function(){var e=JSON.stringify(this.model.get("data"));o(this.dataField).val()!==e&&(o(this.dataField).val(e),o(this.dataField).trigger("change"),this.trigger("content_change"))},onAddRow:function(e,t,i){i=_.extend({noAnimate:!1},i);var o=new s.view.row({model:e});o.builder=this,o.render(),_.isUndefined(i.at)||t.length<=1?o.$el.appendTo(this.$(".so-rows-container")):o.$el.insertAfter(this.$(".so-rows-container .so-row-container").eq(i.at-1)),i.noAnimate===!1&&o.visualCreate(),this.refreshSortable(),o.resize()},displayAddWidgetDialog:function(){this.dialogs.widgets.openDialog()},displayAddRowDialog:function(){this.dialogs.row.openDialog(),this.dialogs.row.setRowModel()},displayAddPrebuiltDialog:function(){this.dialogs.prebuilt.openDialog()},displayHistoryDialog:function(){this.dialogs.history.openDialog()},getActiveCell:function(e){if(e=_.extend({createCell:!0,defaultPosition:"first"},e),0===this.$(".so-cells .cell").length){if(!e.createCell)return null;this.model.addRow([1],{noAnimate:!0})}var t=this.$(".so-cells .cell.cell-selected");return 0===t.length&&(t="last"===e.defaultPosition?this.$(".so-cells .cell").first():this.$(".so-cells .cell").last()),t.data("view").model},sortCollections:function(){this.$(".so-widget").each(function(e){var t=o(this);t.data("view").model.indexes={builder:e,cell:t.index()}}),this.$(".so-cells .cell").each(function(e){var t=o(this);t.data("view").model.indexes={builder:e,row:t.index()}}),this.$(".so-row-container").each(function(e){var t=o(this);t.data("view").model.indexes={builder:e}}),this.model.rows.visualSort(),this.model.rows.each(function(e){e.cells.each(function(e){e.widgets.visualSort()})}),this.model.refreshPanelsData()},addLiveEditor:function(){return _.isEmpty(this.config.liveEditorPreview)?this:(this.liveEditor=new s.view.liveEditor({builder:this,previewUrl:this.config.liveEditorPreview}),this.liveEditor.hasPreviewUrl()&&this.$(".so-builder-toolbar .so-live-editor").show(),this.trigger("builder_live_editor_added"),this)},displayLiveEditor:function(){_.isUndefined(this.liveEditor)||this.liveEditor.open()},addHistoryBrowser:function(){return _.isEmpty(this.config.liveEditorPreview)?this:(this.dialogs.history=new s.dialog.history,this.dialogs.history.builder=this,this.dialogs.history.entries.builder=this.model,this.dialogs.history.setRevertEntry(this.model),void this.$(".so-builder-toolbar .so-history").show())},addHistoryEntry:function(e,t){_.isUndefined(t)&&(t=null),_.isUndefined(this.dialogs.history)||this.dialogs.history.entries.addEntry(e,t)},supports:function(e){return"rowAction"===e?this.supports("addRow")||this.supports("editRow")||this.supports("deleteRow"):"widgetAction"===e?this.supports("addWidget")||this.supports("editWidget")||this.supports("deleteWidget"):_.isUndefined(this.config.builderSupports[e])?!1:this.config.builderSupports[e]},handleContentChange:function(){if(panelsOptions.copy_content&&this.attachedToEditor&&this.$el.is(":visible")){var e=this.model.getPanelsData();_.isEmpty(e.widgets)||o.post(panelsOptions.ajaxurl,{action:"so_panels_builder_content",panels_data:JSON.stringify(e),post_id:this.config.postId},function(e){var t=o("<div />").html(e);t.find("div").each(function(){var e=o(this).contents();o(this).replaceWith(e)}),e=t.html().replace(/[\r\n]+/g,"\n").replace(/\n\s+/g,"\n").trim(),""!==e&&this.updateEditorContent(e)}.bind(this))}},updateEditorContent:function(e){if("tinymce"!==this.config.editorType||_.isUndefined(tinyMCE)||_.isNull(tinyMCE.get("content"))){var t=o(this.config.editorId);t.val(e).trigger("change").trigger("keyup")}else{var i=tinyMCE.get("content");i.setContent(e),i.fire("change"),i.fire("keyup")}this.triggerYoastSeoChange()},triggerYoastSeoChange:function(){if(o("#yoast_wpseo_focuskw_text_input").length){var e,t=document.getElementById("yoast_wpseo_focuskw_text_input");document.createEvent?(e=document.createEvent("HTMLEvents"),e.initEvent("keyup",!0,!0)):(e=document.createEventObject(),e.eventType="keyup"),e.eventName="keyup",document.createEvent?t.dispatchEvent(e):t.fireEvent("on"+e.eventType,e)}},handleDisplayBuilder:function(){var e,t="";if(_.isUndefined(tinyMCE)||(e=tinyMCE.get("content")),t=e&&_.isFunction(e.getContent)?e.getContent():o("textarea#content").val(),(_.isEmpty(this.model.get("data"))||_.isEmpty(this.model.get("data").widgets)&&_.isEmpty(this.model.get("data").grids))&&""!==t){if(!confirm(panelsOptions.loc.confirm_use_builder))return;var i="";if(_.isUndefined(panelsOptions.widgets.SiteOrigin_Widget_Editor_Widget)?_.isUndefined(panelsOptions.widgets.WP_Widget_Text)||(i="WP_Widget_Text"):i="SiteOrigin_Widget_Editor_Widget",""===i)return;this.model.loadPanelsData({grid_cells:[{grid:0,weight:1}],grids:[{cells:1}],widgets:[{filter:"1",text:t,title:"",type:"visual",panels_info:{"class":i,raw:!1,grid:0,cell:0}}]}),this.model.trigger("change"),this.model.trigger("change:data")}},handleBuilderSizing:function(){var e=this.$el.width();return e?void(480>e?this.$el.addClass("so-display-narrow"):this.$el.removeClass("so-display-narrow")):this},setDialogParents:function(e,t){_.each(this.dialogs,function(i,s,o){o[s].setParent(e,t)}),this.on("add_dialog",function(i){i.setParent(e,t)},this)},toggleWelcomeDisplay:function(){this.model.rows.isEmpty()?this.$(".so-panels-welcome-message").show():this.$(".so-panels-welcome-message").hide()},activateContextMenu:function(e,t){var i=this,s=o(".siteorigin-panels-builder:visible").sort(function(e,t){return o(e).zIndex()>o(t).zIndex()?1:-1}).last(),l=o(".so-panels-dialog-wrapper:visible").sort(function(e,t){return o(e).zIndex()>o(t).zIndex()?1:-1}).last(),n=i.$el.closest(".so-panels-dialog-wrapper");if(i.$el.is(s)&&(0===l.length||l.is(n))){var a=o([]).add(i.$(".so-rows-container > .so-row-container")).add(i.$(".so-cells > .cell")).add(i.$(".cell-wrapper > .so-widget")).filter(function(i){return t.isOverEl(o(this),e)}),r=a.last().data("view");void 0!==r&&void 0!==r.buildContextualMenu&&r.buildContextualMenu(e,t)}},lockPageScroll:function(){if("hidden"!==o("body").css("overflow")){var e=[self.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,self.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop];o("body").data({"scroll-position":e}).css("overflow","hidden"),_.isUndefined(e)||window.scrollTo(e[0],e[1])}},unlockPageScroll:function(){if("hidden"===o("body").css("overflow")&&!o(".so-panels-dialog-wrapper").is(":visible")&&!o(".so-panels-live-editor").is(":visible")){o("body").css("overflow","visible");var e=o("body").data("scroll-position");_.isUndefined(e)||window.scrollTo(e[0],e[1])}}})},{}],20:[function(e,t,i){var s=window.panels,o=jQuery;t.exports=Backbone.View.extend({template:_.template(o("#siteorigin-panels-builder-cell").html().panelsProcessTemplate()),events:{"click .cell-wrapper":"handleCellClick"},row:null,widgetSortable:null,initialize:function(){this.model.widgets.on("add",this.onAddWidget,this)},render:function(){var e={weight:this.model.get("weight"),totalWeight:this.row.model.cells.totalWeight()};this.setElement(this.template(e)),this.$el.data("view",this);var t=this;return this.model.widgets.each(function(e){var i=new s.view.widget({model:e});i.cell=t,i.render(),i.$el.appendTo(t.$(".widgets-container"))}),this.initSortable(),this.initResizable(),this},initSortable:function(){if(!this.row.builder.supports("moveWidget"))return this;var e=this,t=e.row.builder.$el.attr("id");return this.widgetSortable=this.$(".widgets-container").sortable({placeholder:"so-widget-sortable-highlight",connectWith:"#"+t+" .so-cells .cell .widgets-container",tolerance:"pointer",scroll:!1,over:function(t,i){e.row.builder.trigger("widget_sortable_move")},stop:function(t,i){e.row.builder.addHistoryEntry("widget_moved");var s=o(i.item).data("view"),l=o(i.item).closest(".cell").data("view");s.model.moveToCell(l.model),s.cell=l,e.row.builder.sortCollections()},helper:function(e,t){var i=t.clone().css({width:t.outerWidth(),"z-index":1e4,position:"fixed"}).addClass("widget-being-dragged").appendTo("body");return t.outerWidth()>720&&i.animate({"margin-left":e.pageX-t.offset().left-240,width:480},"fast"),i}}),this},refreshSortable:function(){_.isNull(this.widgetSortable)||this.widgetSortable.sortable("refresh")},initResizable:function(){if(!this.row.builder.supports("editRow"))return this;var e,t=this.$(".resize-handle").css("position","absolute"),i=this.row.$el,s=this;return t.draggable({axis:"x",containment:i,start:function(t,i){if(e=s.$el.prev().data("view"),!_.isUndefined(e)){var l=s.$el.clone().appendTo(i.helper).css({position:"absolute",top:"0",width:s.$el.outerWidth(),left:5,height:s.$el.outerHeight()});l.find(".resize-handle").remove();var n=e.$el.clone().appendTo(i.helper).css({position:"absolute",top:"0",width:e.$el.outerWidth(),right:5,height:e.$el.outerHeight()});n.find(".resize-handle").remove(),o(this).data({newCellClone:l,prevCellClone:n})}},drag:function(i,l){var n=s.row.$el.width()+10,a=s.model.get("weight")-(l.position.left+t.outerWidth()/2)/n,r=e.model.get("weight")+(l.position.left+t.outerWidth()/2)/n;o(this).data("newCellClone").css("width",n*a).find(".preview-cell-weight").html(Math.round(1e3*a)/10),o(this).data("prevCellClone").css("width",n*r).find(".preview-cell-weight").html(Math.round(1e3*r)/10)},stop:function(i,l){o(this).data("newCellClone").remove(),o(this).data("prevCellClone").remove();var n=s.row.$el.width()+10,a=s.model.get("weight")-(l.position.left+t.outerWidth()/2)/n,r=e.model.get("weight")+(l.position.left+t.outerWidth()/2)/n;a>.02&&r>.02&&(s.row.builder.addHistoryEntry("cell_resized"),s.model.set("weight",a),e.model.set("weight",r),s.row.resize()),l.helper.css("left",-t.outerWidth()/2),s.row.builder.model.refreshPanelsData()}}),this},onAddWidget:function(e,t,i){i=_.extend({noAnimate:!1},i);var o=new s.view.widget({model:e});o.cell=this,_.isUndefined(e.isDuplicate)&&(e.isDuplicate=!1),o.render({loadForm:e.isDuplicate}),_.isUndefined(i.at)||t.length<=1?o.$el.appendTo(this.$(".widgets-container")):o.$el.insertAfter(this.$(".widgets-container .so-widget").eq(i.at-1)),i.noAnimate===!1&&o.visualCreate(),this.refreshSortable(),this.row.resize()},handleCellClick:function(e){this.$el.closest(".so-rows-container").find(".so-cells .cell").removeClass("cell-selected");o(e.target).parent().addClass("cell-selected")},buildContextualMenu:function(e,t){var i=this;t.addSection({sectionTitle:panelsOptions.loc.contextual.add_widget_cell,searchPlaceholder:panelsOptions.loc.contextual.search_widgets,defaultDisplay:panelsOptions.contextual.default_widgets},panelsOptions.widgets,function(e){i.row.builder.addHistoryEntry("widget_added");var t=new s.model.widget({"class":e});t.cell=i.model,t.cell.widgets.add(t),i.row.builder.model.refreshPanelsData()}),this.row.buildContextualMenu(e,t)}})},{}],21:[function(e,t,i){var s=(window.panels,jQuery);t.exports=Backbone.View.extend({dialogTemplate:_.template(s("#siteorigin-panels-dialog").html().panelsProcessTemplate()),dialogTabTemplate:_.template(s("#siteorigin-panels-dialog-tab").html().panelsProcessTemplate()),tabbed:!1,rendered:!1,builder:!1,className:"so-panels-dialog-wrapper",dialogClass:"",parentDialog:!1,dialogOpen:!1,events:{"click .so-close":"closeDialog","click .so-nav.so-previous":"navToPrevious","click .so-nav.so-next":"navToNext"},initialize:function(){this.once("open_dialog",this.render),this.once("open_dialog",this.attach),this.once("open_dialog",this.setDialogClass),this.trigger("initialize_dialog",this),_.isUndefined(this.initializeDialog)||this.initializeDialog()},getNextDialog:function(){return null},getPrevDialog:function(){return null},setDialogClass:function(){""!==this.dialogClass&&this.$(".so-panels-dialog").addClass(this.dialogClass)},setBuilder:function(e){return this.builder=e,e.trigger("add_dialog",this,this.builder),this},attach:function(){return this.$el.appendTo("body"),this},parseDialogContent:function(e,t){t=_.extend({cid:this.cid},t);var i=s(_.template(e.panelsProcessTemplate())(t)),o={title:i.find(".title").html(),buttons:i.find(".buttons").html(),content:i.find(".content").html()};return i.has(".left-sidebar")&&(o.left_sidebar=i.find(".left-sidebar").html()),i.has(".right-sidebar")&&(o.right_sidebar=i.find(".right-sidebar").html()),o},renderDialog:function(e){if(this.$el.html(this.dialogTemplate(e)).hide(),this.$el.data("view",this),this.$el.addClass("so-panels-dialog-wrapper"),this.parentDialog!==!1){var t=this,i=s('<h3 class="so-parent-link"></h3>').html(this.parentDialog.text+'<div class="so-separator"></div>');i.click(function(e){e.preventDefault(),t.closeDialog(),t.parentDialog.openDialog()}),this.$(".so-title-bar").prepend(i)}return this},initTabs:function(){var e=this.$(".so-sidebar-tabs li a");if(0===e.length)return this;var t=this;return e.click(function(e){e.preventDefault();var i=s(this);t.$(".so-sidebar-tabs li").removeClass("tab-active"),t.$(".so-content .so-content-tabs > *").hide(),i.parent().addClass("tab-active");var o=i.attr("href");if(!_.isUndefined(o)&&"#"===o.charAt(0)){var l=o.split("#")[1];t.$(".so-content .so-content-tabs .tab-"+l).show()}t.trigger("tab_click",i)}),this.$(".so-sidebar-tabs li a").first().click(),this},initToolbar:function(){var e=this.$(".so-toolbar .so-buttons .so-toolbar-button");e.click(function(e){e.preventDefault(),this.trigger("button_click",s(e.currentTarget))}.bind(this));var t=this.$(".so-toolbar .so-buttons .so-dropdown-button");t.click(function(e){e.preventDefault();var t=s(e.currentTarget),i=t.siblings(".so-dropdown-links-wrapper");i.is(".hidden")?i.removeClass("hidden"):i.addClass("hidden");
3
- }.bind(this)),s("html").click(function(e){this.$(".so-dropdown-links-wrapper").not(".hidden").each(function(t,i){var o=s(i),l=s(e.target);0!==l.length&&(l.is(".so-needs-confirm")&&!l.is(".so-confirmed")||l.is(".so-dropdown-button"))||o.addClass("hidden")})}.bind(this))},setupDialog:function(){this.openDialog(),this.closeDialog()},refreshDialogNav:function(){this.$(".so-title-bar .so-nav").show().removeClass("so-disabled");var e=this.getNextDialog(),t=this.$(".so-title-bar .so-next"),i=this.getPrevDialog(),s=this.$(".so-title-bar .so-previous");null===e?t.hide():e===!1&&t.addClass("so-disabled"),null===i?s.hide():i===!1&&s.addClass("so-disabled")},openDialog:function(e){e=_.extend({silent:!1},e),e.silent||this.trigger("open_dialog"),this.dialogOpen=!0,this.refreshDialogNav(),this.builder.lockPageScroll(),s(window).on("keyup",this.keyboardListen),this.$el.show(),e.silent||(this.trigger("open_dialog_complete"),this.builder.trigger("open_dialog",this))},closeDialog:function(e){e=_.extend({silent:!1},e),e.silent||this.trigger("close_dialog"),this.dialogOpen=!1,this.$el.hide(),this.builder.unlockPageScroll(),s(window).off("keyup",this.keyboardListen),e.silent||(this.trigger("close_dialog_complete"),this.builder.trigger("close_dialog",this))},keyboardListen:function(e){27===e.which&&s(".so-panels-dialog-wrapper .so-close").trigger("click")},navToPrevious:function(){this.closeDialog();var e=this.getPrevDialog();null!==e&&e!==!1&&e.openDialog()},navToNext:function(){this.closeDialog();var e=this.getNextDialog();null!==e&&e!==!1&&e.openDialog()},getFormValues:function(e){_.isUndefined(e)&&(e=".so-content");var t,i=this.$(e),o={};return i.find("[name]").each(function(){var e=s(this);try{var i=/([A-Za-z_]+)\[(.*)\]/.exec(e.attr("name"));if(_.isEmpty(i))return!0;_.isUndefined(i[2])?t=e.attr("name"):(t=i[2].split("]["),t.unshift(i[1])),t=t.map(function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e});var l=o,n=null,a=_.isString(e.attr("type"))?e.attr("type").toLowerCase():!1;if("checkbox"===a)n=e.is(":checked")?""!==e.val()?e.val():!0:null;else if("radio"===a){if(!e.is(":checked"))return;n=e.val()}else if("TEXTAREA"===e.prop("tagName")&&e.hasClass("wp-editor-area")){var r=null;_.isUndefined(tinyMCE)||(r=tinyMCE.get(e.attr("id"))),n=null!==r&&_.isFunction(r.getContent)&&!r.isHidden()?r.getContent():e.val()}else if("SELECT"===e.prop("tagName")){var d=e.find("option:selected");1===d.length?n=e.find("option:selected").val():d.length>1&&(n=_.map(e.find("option:selected"),function(e,t){return s(e).val()}))}else n=e.val();if(!_.isUndefined(e.data("panels-filter")))switch(e.data("panels-filter")){case"json_parse":try{n=JSON.parse(n)}catch(c){n=""}}if(null!==n)for(var h=0;h<t.length;h++)h===t.length-1?""===t[h]?l.push(n):l[t[h]]=n:(_.isUndefined(l[t[h]])&&(""===t[h+1]?l[t[h]]=[]:l[t[h]]={}),l=l[t[h]])}catch(u){console.log("Field ["+e.attr("name")+"] could not be processed and was skipped - "+u.message)}}),o},setStatusMessage:function(e,t){this.$(".so-toolbar .so-status").html(e),!_.isUndefined(t)&&t&&this.$(".so-toolbar .so-status").addClass("so-panels-loading")},setParent:function(e,t){this.parentDialog={text:e,dialog:t}}})},{}],22:[function(e,t,i){var s=(window.panels,jQuery);t.exports=Backbone.View.extend({template:_.template(s("#siteorigin-panels-live-editor").html().panelsProcessTemplate()),previewScrollTop:0,loadTimes:[],previewFrameId:1,previewUrl:null,previewIframe:null,events:{"click .live-editor-close":"close","click .live-editor-collapse":"collapse","click .live-editor-mode":"mobileToggle"},initialize:function(e){e=_.extend({builder:!1,previewUrl:!1},e),_.isEmpty(e.previewUrl)&&(e.previewUrl=panelsOptions.ajaxurl+"&action=so_panels_live_editor_preview"),this.builder=e.builder,this.previewUrl=e.previewUrl,this.builder.model.on("refresh_panels_data",this.handleRefreshData,this),this.builder.model.on("load_panels_data",this.handleLoadData,this)},render:function(){this.setElement(this.template()),this.$el.hide();var e=this,t=!1;return s(document).mousedown(function(){t=!0}).mouseup(function(){t=!1}),e.$el.on("mouseenter",".so-widget-wrapper",function(){var i=(s(this),s(this).data("live-editor-preview-widget"));t||void 0===i||!i.length||e.$(".so-preview-overlay").is(":visible")||(e.highlightElement(i),e.scrollToElement(i))}),e.$el.on("mouseleave",".so-widget-wrapper",function(){e.resetHighlights()}),e.builder.on("open_dialog",function(){e.resetHighlights()}),this},attach:function(){this.$el.appendTo("body")},open:function(){if(""===this.$el.html()&&this.render(),0===this.$el.closest("body").length&&this.attach(),this.builder.lockPageScroll(),this.$el.is(":visible"))return this;if(this.$el.show(),this.refreshPreview(this.builder.model.getPanelsData()),this.originalContainer=this.builder.$el.parent(),this.builder.$el.appendTo(this.$(".so-live-editor-builder")),this.builder.$(".so-tool-button.so-live-editor").hide(),this.builder.trigger("builder_resize"),"auto-draft"===s("#original_post_status").val()&&!this.autoSaved){var e=this;wp.autosave&&(""===s('#title[name="post_title"]').val()&&s('#title[name="post_title"]').val(panelsOptions.loc.draft).trigger("keydown"),s(document).one("heartbeat-tick.autosave",function(){e.autoSaved=!0,e.refreshPreview(e.builder.model.getPanelsData())}),wp.autosave.server.triggerSave())}},close:function(){return this.$el.is(":visible")?(this.$el.hide(),this.builder.unlockPageScroll(),this.builder.$el.appendTo(this.originalContainer),this.builder.$(".so-tool-button.so-live-editor").show(),void this.builder.trigger("builder_resize")):this},collapse:function(){this.$el.toggleClass("so-collapsed");var e=this.$(".live-editor-collapse span");e.html(e.data(this.$el.hasClass("so-collapsed")?"expand":"collapse"))},highlightElement:function(e){_.isUndefined(this.resetHighlightTimeout)||clearTimeout(this.resetHighlightTimeout);var t=this.previewIframe.contents().find("body");t.find(".panel-grid .panel-grid-cell .so-panel").filter(function(){return 0===s(this).parents(".so-panel").length}).not(e).addClass("so-panels-faded"),e.removeClass("so-panels-faded").addClass("so-panels-highlighted")},resetHighlights:function(){var e=this.previewIframe.contents().find("body");this.resetHighlightTimeout=setTimeout(function(){e.find(".panel-grid .panel-grid-cell .so-panel").removeClass("so-panels-faded so-panels-highlighted")},100)},scrollToElement:function(e){var t=this.$(".so-preview iframe")[0].contentWindow;t.liveEditorScrollTo(e)},handleRefreshData:function(e,t){return this.$el.is(":visible")?void this.refreshPreview(e):this},handleLoadData:function(){return this.$el.is(":visible")?void this.refreshPreview(this.builder.model.getPanelsData()):this},refreshPreview:function(e){var t=this.loadTimes.length?_.reduce(this.loadTimes,function(e,t){return e+t},0)/this.loadTimes.length:1e3;_.isNull(this.previewIframe)||this.$(".so-preview-overlay").is(":visible")||(this.previewScrollTop=this.previewIframe.contents().scrollTop()),this.$(".so-preview-overlay").show(),this.$(".so-preview-overlay .so-loading-bar").clearQueue().css("width","0%").animate({width:"100%"},parseInt(t)+100),this.postToIframe({live_editor_panels_data:JSON.stringify(e)},this.previewUrl,this.$(".so-preview")),this.previewIframe.data("load-start",(new Date).getTime())},postToIframe:function(e,t,i){_.isNull(this.previewIframe)||this.previewIframe.remove();var o="siteorigin-panels-live-preview-"+this.previewFrameId;this.previewIframe=s('<iframe src="javascript:false;" />').attr({id:o,name:o}).appendTo(i),this.setupPreviewFrame(this.previewIframe);var l=s('<form id="soPostToPreviewFrame" method="post" />').attr({id:o,target:this.previewIframe.attr("id"),action:t}).appendTo("body");return s.each(e,function(e,t){s('<input type="hidden" />').attr({name:e,value:t}).appendTo(l)}),l.submit().remove(),this.previewFrameId++,this.previewIframe},setupPreviewFrame:function(e){var t=this;e.data("iframeready",!1).on("iframeready",function(){var e=s(this),i=e.contents();e.data("iframeready")||(e.data("iframeready",!0),void 0!==e.data("load-start")&&(t.loadTimes.unshift((new Date).getTime()-e.data("load-start")),_.isEmpty(t.loadTimes)||(t.loadTimes=t.loadTimes.slice(0,4))),setTimeout(function(){i.scrollTop(t.previewScrollTop),t.$(".so-preview-overlay").hide()},100),i.find(".panel-grid .panel-grid-cell .so-panel").filter(function(){return 0===s(this).parents(".so-panel").length}).each(function(e,i){var o=s(i),l=t.$(".so-live-editor-builder .so-widget-wrapper").eq(o.data("index"));l.data("live-editor-preview-widget",o),o.css({cursor:"pointer"}).mouseenter(function(){l.parent().addClass("so-hovered"),t.highlightElement(o)}).mouseleave(function(){l.parent().removeClass("so-hovered"),t.resetHighlights()}).click(function(e){e.preventDefault(),l.find(".title h4").click()})}),i.find("a").css({"pointer-events":"none"}).click(function(e){e.preventDefault()}))}).on("load",function(){var e=s(this);e.data("iframeready")||e.trigger("iframeready")})},hasPreviewUrl:function(){return""!==this.$("form.live-editor-form").attr("action")},mobileToggle:function(e){var t=s(e.currentTarget);this.$(".live-editor-mode").not(t).removeClass("so-active"),t.addClass("so-active"),this.$el.removeClass("live-editor-desktop-mode live-editor-tablet-mode live-editor-mobile-mode").addClass("live-editor-"+t.data("mode")+"-mode")}})},{}],23:[function(e,t,i){var s=window.panels,o=jQuery;t.exports=Backbone.View.extend({template:_.template(o("#siteorigin-panels-builder-row").html().panelsProcessTemplate()),events:{"click .so-row-settings":"editSettingsHandler","click .so-row-duplicate":"duplicateHandler","click .so-row-delete":"confirmedDeleteHandler"},builder:null,dialog:null,initialize:function(){this.model.cells.on("add",this.handleCellAdd,this),this.model.cells.on("remove",this.handleCellRemove,this),this.model.on("reweight_cells",this.resize,this),this.model.on("destroy",this.onModelDestroy,this),this.model.on("visual_destroy",this.visualDestroyModel,this);var e=this;this.model.cells.each(function(t){e.listenTo(t.widgets,"add",e.resize)}),this.model.cells.on("add",function(t){e.listenTo(t.widgets,"add",e.resize)},this)},render:function(){this.setElement(this.template()),this.$el.data("view",this);var e=this;return this.model.cells.each(function(t){var i=new s.view.cell({model:t});i.row=e,i.render(),i.$el.appendTo(e.$(".so-cells"))}),this.builder.supports("rowAction")?(this.builder.supports("editWidget")||(this.$(".so-row-toolbar .so-row-settings").parent().remove(),this.$el.addClass("so-row-no-edit")),this.builder.supports("addWidget")||(this.$(".so-row-toolbar .so-row-duplicate").parent().remove(),this.$el.addClass("so-row-no-duplicate")),this.builder.supports("deleteWidget")||(this.$(".so-row-toolbar .so-row-delete").parent().remove(),this.$el.addClass("so-row-no-delete"))):(this.$(".so-row-toolbar .so-dropdown-wrapper").remove(),this.$el.addClass("so-row-no-actions")),this.builder.supports("moveRow")||(this.$(".so-row-toolbar .so-row-move").remove(),this.$el.addClass("so-row-no-move")),o.trim(this.$(".so-row-toolbar").html()).length||this.$(".so-row-toolbar").remove(),this.builder.on("widget_sortable_move",this.resize,this),this.builder.on("builder_resize",this.resize,this),this.resize(),this},visualCreate:function(){this.$el.hide().fadeIn("fast")},resize:function(e){if(this.$el.is(":visible")){this.$(".so-cells .cell-wrapper").css("min-height",0);var t=0;this.$(".so-cells .cell").each(function(){t=Math.max(t,o(this).height()),o(this).css("width",100*o(this).data("view").model.get("weight")+"%")}),this.$(".so-cells .cell-wrapper").css("min-height",Math.max(t,64))}},onModelDestroy:function(){this.remove()},visualDestroyModel:function(){this.builder.addHistoryEntry("row_deleted");var e=this;this.$el.fadeOut("normal",function(){e.model.destroy(),e.builder.model.refreshPanelsData()})},duplicateHandler:function(){this.builder.addHistoryEntry("row_duplicated");var e=this.model.clone(this.builder.model);this.builder.model.rows.add(e,{at:this.builder.model.rows.indexOf(this.model)+1}),this.builder.model.refreshPanelsData()},confirmedDeleteHandler:function(e){var t=o(e.target);if(t.hasClass("dashicons")&&(t=o.parent()),t.hasClass("so-confirmed"))this.visualDestroyModel();else{var i=t.html();t.addClass("so-confirmed").html('<span class="dashicons dashicons-yes"></span>'+panelsOptions.loc.dropdown_confirm),setTimeout(function(){t.removeClass("so-confirmed").html(i)},2500)}},editSettingsHandler:function(){return null===this.dialog&&(this.dialog=new s.dialog.row,this.dialog.setBuilder(this.builder).setRowModel(this.model)),this.dialog.openDialog(),this},deleteHandler:function(){return this.model.destroy(),this},handleCellAdd:function(e){var t=new s.view.cell({model:e});t.row=this,t.render(),t.$el.appendTo(this.$(".so-cells"))},handleCellRemove:function(e){this.$(".so-cells > .cell").each(function(){var t=o(this).data("view");_.isUndefined(t)||t.model.cid===e.cid&&t.remove()})},buildContextualMenu:function(e,t){for(var i=this,o=[],l=1;5>l;l++)o.push({title:l+" "+panelsOptions.loc.contextual.column});this.builder.supports("addRow")&&t.addSection({sectionTitle:panelsOptions.loc.contextual.add_row,search:!1},o,function(e){i.builder.addHistoryEntry("row_added");for(var t=Number(e)+1,o=[],l=0;t>l;l++)o.push(100/t);var n=new s.model.row({collection:i.collection});n.setCells(o),n.builder=i.builder,i.builder.model.rows.add(n,{at:i.builder.model.rows.indexOf(i.model)+1}),i.builder.model.refreshPanelsData()}),actions={},this.builder.supports("editRow")&&(actions.edit={title:panelsOptions.loc.contextual.row_edit}),this.builder.supports("addRow")&&(actions.duplicate={title:panelsOptions.loc.contextual.row_duplicate}),this.builder.supports("deleteRow")&&(actions["delete"]={title:panelsOptions.loc.contextual.row_delete,confirm:!0}),_.isEmpty(actions)||t.addSection({sectionTitle:panelsOptions.loc.contextual.row_actions,search:!1},actions,function(e){switch(e){case"edit":i.editSettingsHandler();break;case"duplicate":i.duplicateHandler();break;case"delete":i.visualDestroyModel()}})}})},{}],24:[function(e,t,i){var s=(window.panels,jQuery);t.exports=Backbone.View.extend({stylesLoaded:!1,initialize:function(){},render:function(e,t,i){if(!_.isUndefined(e)){i=_.extend({builderType:"",dialog:null},i),this.$el.addClass("so-visual-styles");var o=this;return s.post(panelsOptions.ajaxurl,{action:"so_panels_style_form",type:e,style:this.model.get("style"),args:JSON.stringify({builderType:i.builderType}),postId:t},function(e){o.$el.html(e),o.setupFields(),o.stylesLoaded=!0,o.trigger("styles_loaded",!_.isEmpty(e)),_.isNull(i.dialog)||i.dialog.trigger("styles_loaded",!_.isEmpty(e))}),this}},attach:function(e){e.append(this.$el)},detach:function(){this.$el.detach()},setupFields:function(){this.$(".style-section-wrapper").each(function(){var e=s(this);e.find(".style-section-head").click(function(t){t.preventDefault(),e.find(".style-section-fields").slideToggle("fast")})}),_.isUndefined(s.fn.wpColorPicker)||(_.isObject(panelsOptions.wpColorPickerOptions.palettes)&&!s.isArray(panelsOptions.wpColorPickerOptions.palettes)&&(panelsOptions.wpColorPickerOptions.palettes=s.map(panelsOptions.wpColorPickerOptions.palettes,function(e){return e})),this.$(".so-wp-color-field").wpColorPicker(panelsOptions.wpColorPickerOptions)),this.$(".style-field-image").each(function(){var e=null,t=s(this);t.find(".so-image-selector").click(function(i){i.preventDefault(),null===e&&(e=wp.media({title:"choose",library:{type:"image"},button:{text:"Done",close:!0}}),e.on("select",function(){var i=e.state().get("selection").first().attributes,s=i.url;if(!_.isUndefined(i.sizes))try{s=i.sizes.thumbnail.url}catch(o){s=i.sizes.full.url}t.find(".current-image").css("background-image","url("+s+")"),t.find("input").val(i.id)})),e.open()}),t.find(".remove-image").click(function(e){e.preventDefault(),t.find(".current-image").css("background-image","none"),t.find("input").val("")})}),this.$(".style-field-measurement").each(function(){var e=s(this),t=e.find('input[type="text"]'),i=e.find("select"),o=e.find('input[type="hidden"]');t.focus(function(){s(this).select()});var l=function(e){if(""!==e){var l=/(?:([0-9\.,]+)(.*))+/,n=o.val().split(" "),a=[];for(var r in n){var d=l.exec(n[r]);_.isNull(d)||_.isUndefined(d[1])||_.isUndefined(d[2])||(a.push(d[1]),i.val(d[2]))}1===t.length?t.val(a.join(" ")):(1===a.length?a=[a[0],a[0],a[0],a[0]]:2===a.length?a=[a[0],a[1],a[0],a[1]]:3===a.length&&(a=[a[0],a[1],a[2],a[1]]),t.each(function(e,t){s(t).val(a[e])}))}};l(o.val());var n=function(e){if(1===t.length){var l=t.val().split(" ").filter(function(e){return""!==e}).map(function(e){return e+i.val()}).join(" ");o.val(l)}else{var n=s(e.target),a=[],r=[],d=[];t.each(function(e,t){var i=""!==s(t).val()?parseFloat(s(t).val()):null;a.push(i),null===i?r.push(e):d.push(e)}),3===r.length&&d[0]===t.index(n)&&(t.val(n.val()),a=[n.val(),n.val(),n.val(),n.val()]),JSON.stringify(a)===JSON.stringify([null,null,null,null])?o.val(""):o.val(a.map(function(e){return(null===e?0:e)+i.val()}).join(" "))}};t.change(n),i.change(n)})}})},{}],25:[function(e,t,i){var s=window.panels,o=jQuery;t.exports=Backbone.View.extend({template:_.template(o("#siteorigin-panels-builder-widget").html().panelsProcessTemplate()),cell:null,dialog:null,events:{"click .widget-edit":"editHandler","click .title h4":"titleClickHandler","click .actions .widget-duplicate":"duplicateHandler","click .actions .widget-delete":"deleteHandler"},initialize:function(){this.model.on("user_edit",this.editHandler,this),this.model.on("user_duplicate",this.duplicateHandler,this),this.model.on("destroy",this.onModelDestroy,this),this.model.on("visual_destroy",this.visualDestroyModel,this),this.model.on("change:values",this.onModelChange,this)},render:function(e){if(e=_.extend({loadForm:!1},e),this.setElement(this.template({title:this.model.getWidgetField("title"),description:this.model.getTitle()})),this.$el.data("view",this),(!this.cell.row.builder.supports("editWidget")||this.model.get("read_only"))&&(this.$(".actions .widget-edit").remove(),this.$el.addClass("so-widget-no-edit")),this.cell.row.builder.supports("addWidget")||(this.$(".actions .widget-duplicate").remove(),this.$el.addClass("so-widget-no-duplicate")),this.cell.row.builder.supports("deleteWidget")||(this.$(".actions .widget-delete").remove(),this.$el.addClass("so-widget-no-delete")),this.cell.row.builder.supports("moveWidget")||this.$el.addClass("so-widget-no-move"),o.trim(this.$(".actions").html()).length||this.$(".actions").remove(),this.model.get("read_only")&&this.$el.addClass("so-widget-read-only"),0===_.size(this.model.get("values"))||e.loadForm){var t=this.getEditDialog();t.once("form_loaded",t.saveWidget,t),t.setupDialog()}return this},visualCreate:function(){this.$el.hide().fadeIn("fast")},getEditDialog:function(){return null===this.dialog&&(this.dialog=new s.dialog.widget({model:this.model}),this.dialog.setBuilder(this.cell.row.builder),this.dialog.widgetView=this),this.dialog},editHandler:function(){return this.getEditDialog().openDialog(),this},titleClickHandler:function(){return!this.cell.row.builder.supports("editWidget")||this.model.get("read_only")?this:(this.editHandler(),this)},duplicateHandler:function(){this.cell.row.builder.addHistoryEntry("widget_duplicated");var e=this.model.clone(this.model.cell);return this.cell.model.widgets.add(e,{at:this.model.collection.indexOf(this.model)+1}),this.cell.row.builder.model.refreshPanelsData(),this},deleteHandler:function(){return this.model.trigger("visual_destroy"),this},onModelChange:function(){this.$(".description").html(this.model.getTitle())},onModelDestroy:function(){this.remove()},visualDestroyModel:function(){this.cell.row.builder.addHistoryEntry("widget_deleted");var e=this;return this.$el.fadeOut("fast",function(){e.cell.row.resize(),e.model.destroy(),e.cell.row.builder.model.refreshPanelsData(),e.remove()}),this},buildContextualMenu:function(e,t){var i=this;this.cell.row.builder.supports("addWidget")&&t.addSection({sectionTitle:panelsOptions.loc.contextual.add_widget_below,searchPlaceholder:panelsOptions.loc.contextual.search_widgets,defaultDisplay:panelsOptions.contextual.default_widgets},panelsOptions.widgets,function(e){i.cell.row.builder.addHistoryEntry("widget_added");var t=new s.model.widget({"class":e});t.cell=i.cell.model,i.cell.model.widgets.add(t,{at:i.model.collection.indexOf(i.model)+1}),i.cell.row.builder.model.refreshPanelsData()});var o={};this.cell.row.builder.supports("editWidget")&&!this.model.get("read_only")&&(o.edit={title:panelsOptions.loc.contextual.widget_edit}),this.cell.row.builder.supports("addWidget")&&(o.duplicate={title:panelsOptions.loc.contextual.widget_duplicate}),this.cell.row.builder.supports("deleteWidget")&&(o["delete"]={title:panelsOptions.loc.contextual.widget_delete,confirm:!0}),_.isEmpty(o)||t.addSection({sectionTitle:panelsOptions.loc.contextual.widget_actions,search:!1},o,function(e){switch(e){case"edit":i.editHandler();break;case"duplicate":i.duplicateHandler();break;case"delete":i.visualDestroyModel()}i.cell.row.builder.model.refreshPanelsData()}),this.cell.row.buildContextualMenu(e,t)}})},{}]},{},[12]);
1
  !function e(t,i,s){function o(n,a){if(!i[n]){if(!t[n]){var r="function"==typeof require&&require;if(!a&&r)return r(n,!0);if(l)return l(n,!0);var d=new Error("Cannot find module '"+n+"'");throw d.code="MODULE_NOT_FOUND",d}var c=i[n]={exports:{}};t[n][0].call(c.exports,function(e){var i=t[n][1][e];return o(i?i:e)},c,c.exports,e,t,i,s)}return i[n].exports}for(var l="function"==typeof require&&require,n=0;n<s.length;n++)o(s[n]);return o}({1:[function(e,t,i){var s=window.panels;t.exports=Backbone.Collection.extend({model:s.model.cell,initialize:function(){},totalWeight:function(){var e=0;return this.each(function(t){e+=t.get("weight")}),e},visualSortComparator:function(e){return _.isNull(e.indexes)?null:e.indexes.builder},visualSort:function(){var e=this.comparator;this.comparator=this.visualSortComparator,this.sort(),this.comparator=e}})},{}],2:[function(e,t,i){var s=window.panels;t.exports=Backbone.Collection.extend({model:s.model.historyEntry,builder:null,maxSize:12,initialize:function(){this.on("add",this.onAddEntry,this)},addEntry:function(e,t){_.isEmpty(t)&&(t=this.builder.getPanelsData());var i=new s.model.historyEntry({text:e,data:JSON.stringify(t),time:parseInt((new Date).getTime()/1e3),collection:this});this.add(i)},onAddEntry:function(e){if(this.models.length>1){var t=this.at(this.models.length-2);(e.get("text")===t.get("text")&&e.get("time")-t.get("time")<15||e.get("data")===t.get("data"))&&(this.remove(e),t.set("count",t.get("count")+1))}for(;this.models.length>this.maxSize;)this.shift()}})},{}],3:[function(e,t,i){var s=window.panels;t.exports=Backbone.Collection.extend({model:s.model.row,empty:function(){for(var e;;){if(e=this.collection.first(),!e)break;e.destroy()}},visualSortComparator:function(e){return _.isNull(e.indexes)?null:e.indexes.builder},visualSort:function(){var e=this.comparator;this.comparator=this.visualSortComparator,this.sort(),this.comparator=e}})},{}],4:[function(e,t,i){var s=window.panels;t.exports=Backbone.Collection.extend({model:s.model.widget,initialize:function(){},visualSortComparator:function(e){return _.isNull(e.indexes)?null:e.indexes.builder},visualSort:function(){var e=this.comparator;this.comparator=this.visualSortComparator,this.sort(),this.comparator=e}})},{}],5:[function(e,t,i){var s=window.panels,o=jQuery;t.exports=s.view.dialog.extend({dialogClass:"so-panels-dialog-add-builder",render:function(){this.renderDialog(this.parseDialogContent(o("#siteorigin-panels-dialog-builder").html(),{})),this.$(".so-content .siteorigin-panels-builder").append(this.builder.$el)},initializeDialog:function(){var e=this;this.once("open_dialog_complete",function(){e.builder.initSortable()}),this.on("open_dialog_complete",function(){e.builder.trigger("builder_resize")})}})},{}],6:[function(e,t,i){var s=window.panels,o=jQuery;t.exports=s.view.dialog.extend({historyEntryTemplate:_.template(o("#siteorigin-panels-dialog-history-entry").html().panelsProcessTemplate()),entries:{},currentEntry:null,revertEntry:null,selectedEntry:null,previewScrollTop:null,dialogClass:"so-panels-dialog-history",events:{"click .so-close":"closeDialog","click .so-restore":"restoreSelectedEntry"},initializeDialog:function(){this.entries=new s.collection.historyEntries,this.on("open_dialog",this.setCurrentEntry,this),this.on("open_dialog",this.renderHistoryEntries,this)},render:function(){var e=this;this.renderDialog(this.parseDialogContent(o("#siteorigin-panels-dialog-history").html(),{})),this.$("iframe.siteorigin-panels-history-iframe").load(function(){var t=o(this);t.show(),t.contents().scrollTop(e.previewScrollTop)})},setRevertEntry:function(e){this.revertEntry=new s.model.historyEntry({data:JSON.stringify(e.getPanelsData()),time:parseInt((new Date).getTime()/1e3)})},setCurrentEntry:function(){this.currentEntry=new s.model.historyEntry({data:JSON.stringify(this.builder.model.getPanelsData()),time:parseInt((new Date).getTime()/1e3)}),this.selectedEntry=this.currentEntry,this.previewEntry(this.currentEntry),this.$(".so-buttons .so-restore").addClass("disabled")},renderHistoryEntries:function(){var e=this,t=this.$(".history-entries").empty();this.currentEntry.get("data")===this.revertEntry.get("data")&&_.isEmpty(this.entries.models)||o(this.historyEntryTemplate({title:panelsOptions.loc.history.revert,count:1})).data("historyEntry",this.revertEntry).prependTo(t),this.entries.each(function(i){var s=e.historyEntryTemplate({title:panelsOptions.loc.history[i.get("text")],count:i.get("count")});o(s).data("historyEntry",i).prependTo(t)}),o(this.historyEntryTemplate({title:panelsOptions.loc.history.current,count:1})).data("historyEntry",this.currentEntry).addClass("so-selected").prependTo(t),t.find(".history-entry").click(function(){var i=jQuery(this);t.find(".history-entry").not(i).removeClass("so-selected"),i.addClass("so-selected");var s=i.data("historyEntry");e.selectedEntry=s,e.selectedEntry.cid!==e.currentEntry.cid?e.$(".so-buttons .so-restore").removeClass("disabled"):e.$(".so-buttons .so-restore").addClass("disabled"),e.previewEntry(s)}),this.updateEntryTimes()},previewEntry:function(e){var t=this.$("iframe.siteorigin-panels-history-iframe");t.hide(),this.previewScrollTop=t.contents().scrollTop(),this.$('form.history-form input[name="live_editor_panels_data"]').val(e.get("data")),this.$("form.history-form").submit()},restoreSelectedEntry:function(){return this.$(".so-buttons .so-restore").hasClass("disabled")?!1:this.currentEntry.get("data")===this.selectedEntry.get("data")?(this.closeDialog(),!1):("restore"!==this.selectedEntry.get("text")&&this.builder.addHistoryEntry("restore",this.builder.model.getPanelsData()),this.builder.model.loadPanelsData(JSON.parse(this.selectedEntry.get("data"))),this.closeDialog(),!1)},updateEntryTimes:function(){var e=this;this.$(".history-entries .history-entry").each(function(){var t=jQuery(this),i=t.find(".timesince"),s=t.data("historyEntry");i.html(e.timeSince(s.get("time")))})},timeSince:function(e){var t,i=parseInt((new Date).getTime()/1e3)-e,s=[];return i>3600&&(t=Math.floor(i/3600),1===t?s.push(panelsOptions.loc.time.hour.replace("%d",t)):s.push(panelsOptions.loc.time.hours.replace("%d",t)),i-=3600*t),i>60&&(t=Math.floor(i/60),1===t?s.push(panelsOptions.loc.time.minute.replace("%d",t)):s.push(panelsOptions.loc.time.minutes.replace("%d",t)),i-=60*t),i>0&&(1===i?s.push(panelsOptions.loc.time.second.replace("%d",i)):s.push(panelsOptions.loc.time.seconds.replace("%d",i))),_.isEmpty(s)?panelsOptions.loc.time.now:panelsOptions.loc.time.ago.replace("%s",s.slice(0,2).join(", "))}})},{}],7:[function(e,t,i){var s=window.panels,o=jQuery;t.exports=s.view.dialog.extend({directoryTemplate:_.template(o("#siteorigin-panels-directory-items").html().panelsProcessTemplate()),builder:null,dialogClass:"so-panels-dialog-prebuilt-layouts",layoutCache:{},currentTab:!1,directoryPage:1,events:{"click .so-close":"closeDialog","click .so-sidebar-tabs li a":"tabClickHandler","click .so-content .layout":"layoutClickHandler","keyup .so-sidebar-search":"searchHandler","click .so-screenshot, .so-title":"directoryItemClickHandler"},initializeDialog:function(){var e=this;this.on("open_dialog",function(){e.$(".so-sidebar-tabs li a").first().click(),e.$(".so-status").removeClass("so-panels-loading")}),this.on("button_click",this.toolbarButtonClick,this)},render:function(){this.renderDialog(this.parseDialogContent(o("#siteorigin-panels-dialog-prebuilt").html(),{})),this.initToolbar()},tabClickHandler:function(e){e.preventDefault(),this.selectedLayoutItem=null,this.uploadedLayout=null,this.updateButtonState(!1),this.$(".so-sidebar-tabs li").removeClass("tab-active");var t=o(e.target),i=t.attr("href").split("#")[1];t.parent().addClass("tab-active");var s=this;this.$(".so-content").empty(),s.currentTab=i,"import"==i?this.displayImportExport():this.displayLayoutDirectory("",1,i),s.$(".so-sidebar-search").val("")},displayImportExport:function(){var e=this.$(".so-content").empty().removeClass("so-panels-loading");e.html(o("#siteorigin-panels-dialog-prebuilt-importexport").html());var t=this,i=t.$(".import-upload-ui").hide(),s=new plupload.Uploader({runtimes:"html5,silverlight,flash,html4",browse_button:i.find(".file-browse-button").get(0),container:i.get(0),drop_element:i.find(".drag-upload-area").get(0),file_data_name:"panels_import_data",multiple_queues:!1,max_file_size:panelsOptions.plupload.max_file_size,url:panelsOptions.plupload.url,flash_swf_url:panelsOptions.plupload.flash_swf_url,silverlight_xap_url:panelsOptions.plupload.silverlight_xap_url,filters:[{title:panelsOptions.plupload.filter_title,extensions:"json"}],multipart_params:{action:"so_panels_import_layout"},init:{PostInit:function(e){e.features.dragdrop&&i.addClass("has-drag-drop"),i.show().find(".progress-precent").css("width","0%")},FilesAdded:function(e){i.find(".file-browse-button").blur(),i.find(".drag-upload-area").removeClass("file-dragover"),i.find(".progress-bar").fadeIn("fast"),t.$(".js-so-selected-file").text(panelsOptions.loc.prebuilt_loading),e.start()},UploadProgress:function(e,t){i.find(".progress-precent").css("width",t.percent+"%")},FileUploaded:function(e,s,o){var l=JSON.parse(o.response);_.isUndefined(l.widgets)?alert(panelsOptions.plupload.error_message):(t.uploadedLayout=l,i.find(".progress-bar").hide(),t.$(".js-so-selected-file").text(panelsOptions.loc.ready_to_insert.replace("%s",s.name)),t.updateButtonState(!0))},Error:function(){alert(panelsOptions.plupload.error_message)}}});s.init(),i.find(".drag-upload-area").on("dragover",function(){o(this).addClass("file-dragover")}).on("dragleave",function(){o(this).removeClass("file-dragover")}),e.find(".so-export").submit(function(e){var i=o(this);i.find('input[name="panels_export_data"]').val(JSON.stringify(t.builder.model.getPanelsData()))})},displayLayoutDirectory:function(e,t,i){var s=this,l=this.$(".so-content").empty().addClass("so-panels-loading");return void 0===e&&(e=""),void 0===t&&(t=1),void 0===i&&(i="directory"),"directory"!==i||panelsOptions.directory_enabled?void o.get(panelsOptions.ajaxurl,{action:"so_panels_layouts_query",search:e,page:t,type:i},function(n){if(s.currentTab===i){l.removeClass("so-panels-loading").html(s.directoryTemplate(n));var a=l.find(".so-previous"),r=l.find(".so-next");1>=t?a.addClass("button-disabled"):a.click(function(i){i.preventDefault(),s.displayLayoutDirectory(e,t-1,s.currentTab)}),t===n.max_num_pages||0===n.max_num_pages?r.addClass("button-disabled"):r.click(function(i){i.preventDefault(),s.displayLayoutDirectory(e,t+1,s.currentTab)}),l.find(".so-screenshot").each(function(){var e=o(this),t=e.find(".so-screenshot-wrapper");if(t.css("height",t.width()/4*3+"px").addClass("so-loading"),""!==e.data("src"))var i=o("<img/>").attr("src",e.data("src")).load(function(){t.removeClass("so-loading").css("height","auto"),i.appendTo(t).hide().fadeIn("fast")});else o("<img/>").attr("src",panelsOptions.prebuiltDefaultScreenshot).appendTo(t).hide().fadeIn("fast")}),l.find(".so-directory-browse").html(n.title)}},"json"):(l.removeClass("so-panels-loading").html(o("#siteorigin-panels-directory-enable").html()),void l.find(".so-panels-enable-directory").click(function(i){i.preventDefault(),o.get(panelsOptions.ajaxurl,{action:"so_panels_directory_enable"},function(){}),panelsOptions.directory_enabled=!0,l.addClass("so-panels-loading"),s.displayLayoutDirectory(e,t)}))},directoryItemClickHandler:function(e){var t=this.$(e.target).closest(".so-directory-item");this.$(".so-directory-items").find(".selected").removeClass("selected"),t.addClass("selected"),this.selectedLayoutItem={lid:t.data("layout-id"),type:t.data("layout-type")},this.updateButtonState(!0)},toolbarButtonClick:function(e){if(!this.canAddLayout())return!1;var t=e.data("value");if(_.isUndefined(t))return!1;if(this.updateButtonState(!1),e.hasClass("so-needs-confirm")&&!e.hasClass("so-confirmed")){if(this.updateButtonState(!0),e.hasClass("so-confirming"))return;e.addClass("so-confirming");var i=e.html();return e.html('<span class="dashicons dashicons-yes"></span>'+e.data("confirm")),setTimeout(function(){e.removeClass("so-confirmed").html(i)},2500),setTimeout(function(){e.removeClass("so-confirming"),e.addClass("so-confirmed")},200),!1}this.addingLayout=!0,"import"===this.currentTab?this.addLayoutToBuilder(this.uploadedLayout,t):this.loadSelectedLayout().then(function(e){this.addLayoutToBuilder(e,t)}.bind(this))},canAddLayout:function(){return(this.selectedLayoutItem||this.uploadedLayout)&&!this.addingLayout},loadSelectedLayout:function(){this.setStatusMessage(panelsOptions.loc.prebuilt_loading,!0);var e=_.extend(this.selectedLayoutItem,{action:"so_panels_get_layout"}),t=new o.Deferred;return o.get(panelsOptions.ajaxurl,e,function(e){void 0!==e.error?(alert(e.error),t.reject(e)):(this.setStatusMessage("",!1),t.resolve(e))}.bind(this)),t.promise()},searchHandler:function(e){13===e.keyCode&&this.displayLayoutDirectory(o(e.currentTarget).val(),1,this.currentTab)},updateButtonState:function(e){e=e&&(this.selectedLayoutItem||this.uploadedLayout);var t=this.$(".so-import-layout");t.prop("disabled",!e),e?t.removeClass("disabled"):t.addClass("disabled")},addLayoutToBuilder:function(e,t){this.builder.addHistoryEntry("prebuilt_loaded"),this.builder.model.loadPanelsData(e,t),this.addingLayout=!1,this.closeDialog()}})},{}],8:[function(e,t,i){var s=window.panels,o=jQuery;t.exports=s.view.dialog.extend({cellPreviewTemplate:_.template(o("#siteorigin-panels-dialog-row-cell-preview").html().panelsProcessTemplate()),events:{"click .so-close":"closeDialog","click .so-toolbar .so-save":"saveHandler","click .so-toolbar .so-insert":"insertHandler","click .so-toolbar .so-delete":"deleteHandler","click .so-toolbar .so-duplicate":"duplicateHandler","change .row-set-form > *":"setCellsFromForm","click .row-set-form button.set-row":"setCellsFromForm"},dialogClass:"so-panels-dialog-row-edit",styleType:"row",dialogType:"edit",row:{cells:[],style:{}},initializeDialog:function(){this.on("open_dialog",function(){_.isUndefined(this.model)||_.isEmpty(this.model.cells)?this.setRowModel(null):this.setRowModel(this.model),this.regenerateRowPreview()},this),this.row={cells:[.5,.5],style:{}},this.dialogFormsLoaded=0;var e=this;this.on("form_loaded styles_loaded",function(){this.dialogFormsLoaded++,2===this.dialogFormsLoaded&&e.updateModel({refreshArgs:{silent:!0}})})},setRowDialogType:function(e){this.dialogType=e},render:function(e){if(this.renderDialog(this.parseDialogContent(o("#siteorigin-panels-dialog-row").html(),{dialogType:this.dialogType})),"edit"===this.dialogType){this.styles=new s.view.styles,this.styles.model=this.model,this.styles.render("row",o("#post_ID").val(),{builderType:this.builder.config.builderType,dialog:this}),this.builder.supports("addRow")||this.$(".so-buttons .so-duplicate").remove(),this.builder.supports("deleteRow")||this.$(".so-buttons .so-delete").remove();var t=this.$(".so-sidebar.so-right-sidebar");this.styles.attach(t),this.styles.on("styles_loaded",function(e){e?t.removeClass("so-panels-loading"):(t.closest(".so-panels-dialog").removeClass("so-panels-dialog-has-right-sidebar"),t.remove())},this),t.addClass("so-panels-loading")}_.isUndefined(this.model)||this.$("input.so-row-field").val(this.model.cells.length);return this.$("input.so-row-field").keyup(function(){o(this).trigger("change")}),this},setRowModel:function(e){return this.model=e,_.isEmpty(this.model)?this:(this.row={cells:this.model.cells.map(function(e){return e.get("weight")}),style:{}},this.$("input.so-row-field").val(this.model.cells.length),this)},regenerateRowPreview:function(){var e=this,t=this.$(".row-preview");t.empty();var i;_.each(this.row.cells,function(s,l){var n=o(this.cellPreviewTemplate({weight:s}));t.append(n);var a,r=n.prev();r.length&&(a=o('<div class="resize-handle"></div>'),a.appendTo(n).dblclick(function(){var t=e.row.cells[l]+e.row.cells[l-1];e.row.cells[l]=e.row.cells[l-1]=t/2,e.scaleRowWidths()}),a.draggable({axis:"x",containment:t,start:function(e,t){var i=n.clone().appendTo(t.helper).css({position:"absolute",top:"0",width:n.outerWidth(),left:6,height:n.outerHeight()});i.find(".resize-handle").remove();var s=r.clone().appendTo(t.helper).css({position:"absolute",top:"0",width:r.outerWidth(),right:6,height:r.outerHeight()});s.find(".resize-handle").remove(),o(this).data({newCellClone:i,prevCellClone:s}),n.find("> .preview-cell-in").css("visibility","hidden"),r.find("> .preview-cell-in").css("visibility","hidden")},drag:function(i,s){var n=e.row.cells[l]-(s.position.left+6)/t.width(),a=e.row.cells[l-1]+(s.position.left+6)/t.width();s.helper.offset().left-t.offset().left-6;o(this).data("newCellClone").css("width",t.width()*n).find(".preview-cell-weight").html(Math.round(1e3*n)/10),o(this).data("prevCellClone").css("width",t.width()*a).find(".preview-cell-weight").html(Math.round(1e3*a)/10)},stop:function(i,s){o(this).data("newCellClone").remove(),o(this).data("prevCellClone").remove(),n.find(".preview-cell-in").css("visibility","visible"),r.find(".preview-cell-in").css("visibility","visible");var a=s.position.left+6,d=a/t.width();e.row.cells[l]-d>.02&&e.row.cells[l-1]+d>.02&&(e.row.cells[l]-=d,e.row.cells[l-1]+=d),e.scaleRowWidths(),s.helper.css("left",-6)}})),n.find(".preview-cell-weight").click(function(s){e.$(".resize-handle").css("pointer-event","none").draggable("disable"),t.find(".preview-cell-weight").each(function(){var s=jQuery(this).hide();o('<input type="text" class="preview-cell-weight-input no-user-interacted" />').val(parseFloat(s.html())).insertAfter(s).focus(function(){clearTimeout(i)}).keyup(function(e){9!==e.keyCode&&o(this).removeClass("no-user-interacted"),13===e.keyCode&&(e.preventDefault(),o(this).blur())}).keydown(function(e){if(9===e.keyCode){e.preventDefault();var i=t.find(".preview-cell-weight-input"),s=i.index(o(this));s===i.length-1?i.eq(0).focus().select():i.eq(s+1).focus().select()}}).blur(function(){t.find(".preview-cell-weight-input").each(function(t,i){isNaN(parseFloat(o(i).val()))&&o(i).val(Math.floor(1e3*e.row.cells[t])/10)}),i=setTimeout(function(){if(0===t.find(".preview-cell-weight-input").legnth)return!1;var i=[],s=[],l=0,n=0;if(t.find(".preview-cell-weight-input").each(function(t,a){var r=parseFloat(o(a).val());r=isNaN(r)?1/e.row.cells.length:Math.round(10*r)/1e3;var d=!o(a).hasClass("no-user-interacted");i.push(r),s.push(d),d?l+=r:n+=r}),l>0&&n>0&&1-l>0)for(var a=0;a<i.length;a++)s[a]||(i[a]=i[a]/n*(1-l));var r=_.reduce(i,function(e,t){return e+t});i=i.map(function(e){return e/r}),Math.min.apply(Math,i)>.01&&(e.row.cells=i),t.find(".preview-cell").each(function(t,i){o(i).animate({width:Math.round(1e3*e.row.cells[t])/10+"%"},250),o(i).find(".preview-cell-weight-input").val(Math.round(1e3*e.row.cells[t])/10)}),t.find(".preview-cell").css("overflow","visible"),setTimeout(function(){e.regenerateRowPreview()},260)},100)}).click(function(){o(this).select()})}),o(this).siblings(".preview-cell-weight-input").select()})},this),this.trigger("form_loaded",this)},scaleRowWidths:function(){var e=this;this.$(".row-preview .preview-cell").each(function(t,i){o(i).css("width",100*e.row.cells[t]+"%").find(".preview-cell-weight").html(Math.round(1e3*e.row.cells[t])/10)})},setCellsFromForm:function(){try{var e={cells:parseInt(this.$('.row-set-form input[name="cells"]').val()),ratio:parseFloat(this.$('.row-set-form select[name="ratio"]').val()),direction:this.$('.row-set-form select[name="ratio_direction"]').val()};_.isNaN(e.cells)&&(e.cells=1),isNaN(e.ratio)&&(e.ratio=1),e.cells<1?(e.cells=1,this.$('.row-set-form input[name="cells"]').val(e.cells)):e.cells>10&&(e.cells=10,this.$('.row-set-form input[name="cells"]').val(e.cells)),this.$('.row-set-form input[name="ratio"]').val(e.ratio);for(var t=[],i=this.row.cells.length!==e.cells,s=1,l=0;l<e.cells;l++)t.push(s),s*=e.ratio;var n=_.reduce(t,function(e,t){return e+t});if(t=_.map(t,function(e){return e/n}),t=_.filter(t,function(e){return e>.01}),"left"===e.direction&&(t=t.reverse()),this.row.cells=t,i)this.regenerateRowPreview();else{var a=this;this.$(".preview-cell").each(function(e,t){o(t).animate({width:Math.round(1e3*a.row.cells[e])/10+"%"},250),o(t).find(".preview-cell-weight").html(Math.round(1e3*a.row.cells[e])/10)}),this.$(".preview-cell").css("overflow","visible"),setTimeout(function(){a.regenerateRowPreview()},260)}}catch(r){console.log("Error setting cells - "+r.message)}this.$(".row-set-form .so-button-row-set").removeClass("button-primary")},tabClickHandler:function(e){"#row-layout"===e.attr("href")?this.$(".so-panels-dialog").addClass("so-panels-dialog-has-right-sidebar"):this.$(".so-panels-dialog").removeClass("so-panels-dialog-has-right-sidebar")},updateModel:function(e){if(e=_.extend({refresh:!0,refreshArgs:null},e),_.isEmpty(this.model)||this.model.setCells(this.row.cells),!_.isUndefined(this.styles)&&this.styles.stylesLoaded){var t={};try{t=this.getFormValues(".so-sidebar .so-visual-styles").style}catch(i){console.log("Error retrieving styles - "+i.message)}this.model.set("style",t)}e.refresh&&this.builder.model.refreshPanelsData(e.refreshArgs)},insertHandler:function(){this.builder.addHistoryEntry("row_added"),this.model=new s.model.row,this.updateModel();var e=this.builder.getActiveCell({createCell:!1,defaultPosition:"last"}),t={};return null!==e&&(t.at=this.builder.model.rows.indexOf(e.row)+1),this.model.collection=this.builder.model.rows,this.builder.model.rows.add(this.model,t),this.closeDialog(),this.builder.model.refreshPanelsData(),!1},saveHandler:function(){return this.builder.addHistoryEntry("row_edited"),this.updateModel(),this.closeDialog(),this.builder.model.refreshPanelsData(),!1},deleteHandler:function(){return this.model.trigger("visual_destroy"),this.closeDialog({silent:!0}),!1},duplicateHandler:function(){this.builder.addHistoryEntry("row_duplicated");var e=this.model.clone(this.builder.model);return this.builder.model.rows.add(e,{at:this.builder.model.rows.indexOf(this.model)+1}),this.closeDialog({silent:!0}),!1}})},{}],9:[function(e,t,i){var s=window.panels,o=jQuery;t.exports=s.view.dialog.extend({builder:null,sidebarWidgetTemplate:_.template(o("#siteorigin-panels-dialog-widget-sidebar-widget").html().panelsProcessTemplate()),dialogClass:"so-panels-dialog-edit-widget",widgetView:!1,savingWidget:!1,events:{"click .so-close":"saveHandler","click .so-nav.so-previous":"navToPrevious","click .so-nav.so-next":"navToNext","click .so-toolbar .so-delete":"deleteHandler","click .so-toolbar .so-duplicate":"duplicateHandler"},initializeDialog:function(){var e=this;this.model.on("change:values",this.handleChangeValues,this),this.model.on("destroy",this.remove,this),this.dialogFormsLoaded=0,this.on("form_loaded styles_loaded",function(){this.dialogFormsLoaded++,2===this.dialogFormsLoaded&&e.updateModel({refreshArgs:{silent:!0}})})},render:function(){this.renderDialog(this.parseDialogContent(o("#siteorigin-panels-dialog-widget").html(),{})),this.loadForm(),_.isUndefined(panelsOptions.widgets[this.model.get("class")])?this.$(".so-title .widget-name").html(panelsOptions.loc.missing_widget.title):this.$(".so-title .widget-name").html(panelsOptions.widgets[this.model.get("class")].title),this.builder.supports("addWidget")||this.$(".so-buttons .so-duplicate").remove(),this.builder.supports("deleteWidget")||this.$(".so-buttons .so-delete").remove(),this.styles=new s.view.styles,this.styles.model=this.model,this.styles.render("widget",o("#post_ID").val(),{builderType:this.builder.config.builderType,dialog:this});var e=this.$(".so-sidebar.so-right-sidebar");this.styles.attach(e),this.styles.on("styles_loaded",function(t){t?e.removeClass("so-panels-loading"):(e.closest(".so-panels-dialog").removeClass("so-panels-dialog-has-right-sidebar"),e.remove())},this),e.addClass("so-panels-loading")},getPrevDialog:function(){var e=this.builder.$(".so-cells .cell .so-widget");if(e.length<=1)return!1;var t=e.index(this.widgetView.$el);if(0===t)return!1;do if(widgetView=e.eq(--t).data("view"),!_.isUndefined(widgetView)&&!widgetView.model.get("read_only"))return widgetView.getEditDialog();while(!_.isUndefined(widgetView)&&t>0);return!1},getNextDialog:function(){var e=this.builder.$(".so-cells .cell .so-widget");if(e.length<=1)return!1;var t,i=e.index(this.widgetView.$el);if(i===e.length-1)return!1;do if(t=e.eq(++i).data("view"),!_.isUndefined(t)&&!t.model.get("read_only"))return t.getEditDialog();while(!_.isUndefined(t));return!1},loadForm:function(){if(this.$("> *").length){var e=this;this.$(".so-content").addClass("so-panels-loading");var t={action:"so_panels_widget_form",widget:this.model.get("class"),instance:JSON.stringify(this.model.get("values")),raw:this.model.get("raw")};o.post(panelsOptions.ajaxurl,t,function(t){var i=t.replace(/{\$id}/g,e.model.cid);e.$(".so-content").removeClass("so-panels-loading").html(i),e.trigger("form_loaded",e),e.$(".panel-dialog").trigger("panelsopen"),e.on("close_dialog",e.updateModel,e)},"html")}},updateModel:function(e){if(e=_.extend({refresh:!0,refreshArgs:null},e),this.savingWidget=!0,!this.model.get("missing")){var t=this.getFormValues();_.isUndefined(t.widgets)?t={}:(t=t.widgets,t=t[Object.keys(t)[0]]),this.model.setValues(t),this.model.set("raw",!0)}if(this.styles.stylesLoaded){var i={};try{i=this.getFormValues(".so-sidebar .so-visual-styles").style}catch(s){}this.model.set("style",i)}this.savingWidget=!1,e.refresh&&this.builder.model.refreshPanelsData(e.refreshArgs)},handleChangeValues:function(){this.savingWidget||this.loadForm()},saveHandler:function(){this.builder.addHistoryEntry("widget_edited"),this.closeDialog()},deleteHandler:function(){return this.model.trigger("visual_destroy"),this.closeDialog({silent:!0}),this.builder.model.refreshPanelsData(),!1},duplicateHandler:function(){return this.model.trigger("user_duplicate"),this.closeDialog({silent:!0}),this.builder.model.refreshPanelsData(),!1}})},{}],10:[function(e,t,i){var s=window.panels,o=jQuery;t.exports=s.view.dialog.extend({builder:null,widgetTemplate:_.template(o("#siteorigin-panels-dialog-widgets-widget").html().panelsProcessTemplate()),filter:{},dialogClass:"so-panels-dialog-add-widget",events:{"click .so-close":"closeDialog","click .widget-type":"widgetClickHandler","keyup .so-sidebar-search":"searchHandler"},initializeDialog:function(){this.on("open_dialog",function(){this.filter.search="",this.filterWidgets(this.filter)},this),this.on("open_dialog_complete",function(){this.$(".so-sidebar-search").val("").focus(),this.balanceWidgetHeights()}),this.on("tab_click",this.tabClickHandler,this)},render:function(){this.renderDialog(this.parseDialogContent(o("#siteorigin-panels-dialog-widgets").html(),{})),_.each(panelsOptions.widgets,function(e){var t=o(this.widgetTemplate({title:e.title,description:e.description}));_.isUndefined(e.icon)&&(e.icon="dashicons dashicons-admin-generic"),o('<span class="widget-icon" />').addClass(e.icon).prependTo(t.find(".widget-type-wrapper")),t.data("class",e["class"]).appendTo(this.$(".widget-type-list"))},this);var e=this.$(".so-sidebar-tabs");_.each(panelsOptions.widget_dialog_tabs,function(t){o(this.dialogTabTemplate({title:t.title})).data({message:t.message,filter:t.filter}).appendTo(e)},this),this.initTabs();var t=this;o(window).resize(function(){t.balanceWidgetHeights()})},tabClickHandler:function(e){this.filter=e.parent().data("filter"),this.filter.search=this.$(".so-sidebar-search").val();var t=e.parent().data("message");return _.isEmpty(t)&&(t=""),this.$(".so-toolbar .so-status").html(t),this.filterWidgets(this.filter),!1},searchHandler:function(e){this.filter.search=o(e.target).val(),this.filterWidgets(this.filter)},filterWidgets:function(e){_.isUndefined(e)&&(e={}),_.isUndefined(e.groups)&&(e.groups=""),this.$(".widget-type-list .widget-type").each(function(){var t,i=o(this),s=i.data("class"),l=_.isUndefined(panelsOptions.widgets[s])?null:panelsOptions.widgets[s];t=_.isEmpty(e.groups)?!0:null===l||_.isEmpty(_.intersection(e.groups,panelsOptions.widgets[s].groups))?!1:!0,t&&(_.isUndefined(e.search)||""===e.search||-1===l.title.toLowerCase().indexOf(e.search.toLowerCase())&&(t=!1)),t?i.show():i.hide()}),this.balanceWidgetHeights()},widgetClickHandler:function(e){this.builder.addHistoryEntry("widget_added");var t=o(e.currentTarget),i=new s.model.widget({"class":t.data("class")});i.cell=this.builder.getActiveCell(),i.cell.widgets.add(i),this.closeDialog(),this.builder.model.refreshPanelsData()},balanceWidgetHeights:function(e){var t=[[]],i=null,s=Math.round(this.$(".widget-type").parent().width()/this.$(".widget-type").width());this.$(".widget-type").css("clear","none").filter(":visible").each(function(e,t){e%s===0&&0!==e&&o(t).css("clear","both")}),this.$(".widget-type-wrapper").css("height","auto").filter(":visible").each(function(e,s){var l=o(s);null!==i&&i.position().top!==l.position().top&&(t[t.length]=[]),i=l,t[t.length-1].push(l)}),_.each(t,function(e,t){var i=_.max(e.map(function(e){return e.height()}));_.each(e,function(e){e.height(i)})})}})},{}],11:[function(e,t,i){var s=window.panels,o=jQuery;t.exports=function(e){return this.each(function(){var t=jQuery(this),i=t.closest("form").find(".widget-id").val(),l=o.extend(!0,{},e);if(_.isUndefined(i)||!(i.indexOf("__i__")>-1)){var n=new s.model.builder,a=new s.view.builder({model:n,config:l}),r=t.closest(".so-panels-dialog-wrapper").data("view");_.isUndefined(r)||(r.on("close_dialog",function(){n.refreshPanelsData()}),r.on("open_dialog_complete",function(){a.trigger("builder_resize")}),r.model.on("destroy",function(){n.emptyRows().destroy()}),a.setDialogParents(panelsOptions.loc.layout_widget,r));var d=Boolean(t.closest(".widget-content").length);a.render().attach({container:t,dialog:d||"dialog"===t.data("mode"),type:t.data("type")}).setDataField(t.find("input.panels-data")),d||"dialog"===t.data("mode")?(a.setDialogParents(panelsOptions.loc.layout_widget,a.dialog),t.find(".siteorigin-panels-display-builder").click(function(e){e.preventDefault(),a.dialog.openDialog()})):t.find(".siteorigin-panels-display-builder").parent().remove(),o(document).trigger("panels_setup",a)}})}},{}],12:[function(e,t,i){String.prototype.panelsProcessTemplate=function(){var e=this;return e=e.replace(/{{%/g,"<%"),e=e.replace(/%}}/g,"%>"),e=e.trim()};var s={};window.panels=s,window.siteoriginPanels=s,s.model={},s.model.widget=e("./model/widget"),s.model.cell=e("./model/cell"),s.model.row=e("./model/row"),s.model.builder=e("./model/builder"),s.model.historyEntry=e("./model/history-entry"),s.collection={},s.collection.widgets=e("./collection/widgets"),s.collection.cells=e("./collection/cells"),s.collection.rows=e("./collection/rows"),s.collection.historyEntries=e("./collection/history-entries"),s.view={},s.view.widget=e("./view/widget"),s.view.cell=e("./view/cell"),s.view.row=e("./view/row"),s.view.builder=e("./view/builder"),s.view.dialog=e("./view/dialog"),s.view.styles=e("./view/styles"),s.view.liveEditor=e("./view/live-editor"),s.dialog={},s.dialog.builder=e("./dialog/builder"),s.dialog.widgets=e("./dialog/widgets"),s.dialog.widget=e("./dialog/widget"),s.dialog.prebuilt=e("./dialog/prebuilt"),s.dialog.row=e("./dialog/row"),s.dialog.history=e("./dialog/history"),s.utils={},s.utils.menu=e("./utils/menu"),jQuery.fn.soPanelsSetupBuilderWidget=e("./jquery/setup-builder-widget"),jQuery(function(e){var t,i,s,o;if(e("#siteorigin-panels-metabox").length&&e("form#post").length)t=e("#siteorigin-panels-metabox"),i=e("#siteorigin-panels-metabox .siteorigin-panels-data-field"),s=e("form#post"),o={editorType:"tinymce",postId:e("#post_ID").val(),editorId:"#content",builderType:e("#siteorigin-panels-metabox").data("builder-type"),builderSupports:e("#siteorigin-panels-metabox").data("builder-supports"),loadLiveEditor:1==e("#siteorigin-panels-metabox").data("live-editor"),liveEditorPreview:t.data("preview-url")};else if(e(".siteorigin-panels-builder-form").length){var l=e(".siteorigin-panels-builder-form");t=l.find(".siteorigin-panels-builder-container"),i=l.find('input[name="panels_data"]'),s=l,o={editorType:"standalone",postId:l.data("post-id"),editorId:"#post_content",builderType:l.data("type"),
2
+ builderSupports:l.data("builder-supports"),loadLiveEditor:!1,liveEditorPreview:l.data("preview-url")}}if(!_.isUndefined(t)){var n=window.siteoriginPanels,a=new n.model.builder,r=new n.view.builder({model:a,config:o});r.render().attach({container:t}).setDataField(i).attachToEditor(),s.submit(function(){a.refreshPanelsData()}),t.removeClass("so-panels-loading"),e(document).trigger("panels_setup",r,window.panels)}e(document).on("widget-added",function(t,i){e(i).find(".siteorigin-page-builder-widget").soPanelsSetupBuilderWidget()}),e("body").hasClass("wp-customizer")||e(function(){e(".siteorigin-page-builder-widget").soPanelsSetupBuilderWidget()})})},{"./collection/cells":1,"./collection/history-entries":2,"./collection/rows":3,"./collection/widgets":4,"./dialog/builder":5,"./dialog/history":6,"./dialog/prebuilt":7,"./dialog/row":8,"./dialog/widget":9,"./dialog/widgets":10,"./jquery/setup-builder-widget":11,"./model/builder":13,"./model/cell":14,"./model/history-entry":15,"./model/row":16,"./model/widget":17,"./utils/menu":18,"./view/builder":19,"./view/cell":20,"./view/dialog":21,"./view/live-editor":22,"./view/row":23,"./view/styles":24,"./view/widget":25}],13:[function(e,t,i){t.exports=Backbone.Model.extend({layoutPosition:{BEFORE:"before",AFTER:"after",REPLACE:"replace"},rows:{},defaults:{data:{widgets:[],grids:[],grid_cells:[]}},initialize:function(){this.rows=new panels.collection.rows},addRow:function(e,t){t=_.extend({noAnimate:!1},t);var i=new panels.model.row({collection:this.rows});return i.setCells(e),i.builder=this,this.rows.add(i,t),i},loadPanelsData:function(e,t){try{t===this.layoutPosition.BEFORE?e=this.concatPanelsData(e,this.getPanelsData()):t===this.layoutPosition.AFTER&&(e=this.concatPanelsData(this.getPanelsData(),e)),this.emptyRows(),this.set("data",JSON.parse(JSON.stringify(e)),{silent:!0});var i=[];if(_.isUndefined(e.grid_cells))return void this.trigger("load_panels_data");for(var s,o=0;o<e.grid_cells.length;o++)s=parseInt(e.grid_cells[o].grid),_.isUndefined(i[s])&&(i[s]=[]),i[s].push(parseFloat(e.grid_cells[o].weight));var l=this;if(_.each(i,function(t,i){var s=l.addRow(t,{noAnimate:!0});_.isUndefined(e.grids[i].style)||s.set("style",e.grids[i].style)}),_.isUndefined(e.widgets))return;_.each(e.widgets,function(e){var t=null;_.isUndefined(e.panels_info)?(t=e.info,delete e.info):(t=e.panels_info,delete e.panels_info);var i=l.rows.at(parseInt(t.grid)),s=i.cells.at(parseInt(t.cell)),o=new panels.model.widget({"class":t["class"],values:e});_.isUndefined(t.style)||o.set("style",t.style),_.isUndefined(t.read_only)||o.set("read_only",t.read_only),_.isUndefined(t.widget_id)?o.set("widget_id",l.generateUUID()):o.set("widget_id",t.widget_id),o.cell=s,s.widgets.add(o,{noAnimate:!0})}),this.trigger("load_panels_data")}catch(n){console.log("Error loading data: "+n.message)}},concatPanelsData:function(e,t){if(_.isUndefined(t)||_.isUndefined(t.grids)||_.isEmpty(t.grids)||_.isUndefined(t.grid_cells)||_.isEmpty(t.grid_cells))return e;if(_.isUndefined(e)||_.isUndefined(e.grids)||_.isEmpty(e.grids))return t;var i=e.grids.length,s=_.isUndefined(e.widgets)?0:e.widgets.length,o={grids:[],grid_cells:[],widgets:[]};o.grids=e.grids.concat(t.grids),_.isUndefined(e.grid_cells)||(o.grid_cells=e.grid_cells.slice()),_.isUndefined(e.widgets)||(o.widgets=e.widgets.slice());var l;for(l=0;l<t.grid_cells.length;l++){var n=t.grid_cells[l];n.grid=parseInt(n.grid)+i,o.grid_cells.push(n)}if(!_.isUndefined(t.widgets))for(l=0;l<t.widgets.length;l++){var a=t.widgets[l];a.panels_info.grid=parseInt(a.panels_info.grid)+i,a.panels_info.id=parseInt(a.panels_info.id)+s,o.widgets.push(a)}return o},getPanelsData:function(){var e=this,t={widgets:[],grids:[],grid_cells:[]},i=0;return this.rows.each(function(s,o){s.cells.each(function(s,l){s.widgets.each(function(s,n){var a={"class":s.get("class"),raw:s.get("raw"),grid:o,cell:l,id:i++,widget_id:s.get("widget_id"),style:s.get("style")};_.isEmpty(a.widget_id)&&(a.widget_id=e.generateUUID());var r=_.extend(_.clone(s.get("values")),{panels_info:a});t.widgets.push(r)}),t.grid_cells.push({grid:o,weight:s.get("weight")})}),t.grids.push({cells:s.cells.length,style:s.get("style")})}),t},refreshPanelsData:function(e){e=_.extend({silent:!1},e);var t=this.get("data"),i=this.getPanelsData();this.set("data",i,{silent:!0}),e.silent||JSON.stringify(i)===JSON.stringify(t)||(this.trigger("change"),this.trigger("change:data"),this.trigger("refresh_panels_data",i,e))},emptyRows:function(){return _.invoke(this.rows.toArray(),"destroy"),this.rows.reset(),this},isValidLayoutPosition:function(e){return e===this.layoutPosition.BEFORE||e===this.layoutPosition.AFTER||e===this.layoutPosition.REPLACE},generateUUID:function(){var e=(new Date).getTime();window.performance&&"function"==typeof window.performance.now&&(e+=performance.now());var t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var i=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"==t?i:3&i|8).toString(16)});return t}})},{}],14:[function(e,t,i){t.exports=Backbone.Model.extend({widgets:{},row:null,defaults:{weight:0},indexes:null,initialize:function(){this.widgets=new panels.collection.widgets,this.on("destroy",this.onDestroy,this)},onDestroy:function(){_.invoke(this.widgets.toArray(),"destroy"),this.widgets.reset()},clone:function(e,t){_.isUndefined(e)&&(e=this.row),t=_.extend({cloneWidgets:!0},t);var i=new this.constructor(this.attributes);return i.set("collection",e.cells,{silent:!0}),i.row=e,t.cloneWidgets&&this.widgets.each(function(e){i.widgets.add(e.clone(i,t),{silent:!0})}),i}})},{}],15:[function(e,t,i){t.exports=Backbone.Model.extend({defaults:{text:"",data:"",time:null,count:1}})},{}],16:[function(e,t,i){t.exports=Backbone.Model.extend({cells:{},builder:null,defaults:{style:{}},indexes:null,initialize:function(){this.cells=new panels.collection.cells,this.on("destroy",this.onDestroy,this)},setCells:function(e){var t=this;if(_.isEmpty(this.cells))_.each(e,function(e){var i=new panels.model.cell({weight:e,collection:t.cells});i.row=t,t.cells.add(i)});else{if(e.length>this.cells.length)for(var i=this.cells.length;i<e.length;i++){var s=new panels.model.cell({weight:e[e.length+i],collection:t.cells});s.row=this,t.cells.add(s)}else if(e.length<this.cells.length){var o=this.cells.at(e.length-1);_.each(this.cells.slice(e.length,this.cells.length),function(e){for(var t=e.widgets.models.slice(0),i=0;i<t.length;i++)t[i].moveToCell(o,{silent:!1});e.destroy()})}this.cells.each(function(t,i){t.set("weight",e[i])})}this.reweightCells()},reweightCells:function(){var e=0;this.cells.each(function(t){e+=t.get("weight")}),this.cells.each(function(t){t.set("weight",t.get("weight")/e)}),this.trigger("reweight_cells")},onDestroy:function(){_.invoke(this.cells.toArray(),"destroy"),this.cells.reset()},clone:function(e,t){_.isUndefined(e)&&(e=this.builder),t=_.extend({cloneCells:!0},t);var i=new this.constructor(this.attributes);return i.set("collection",e.rows,{silent:!0}),i.builder=e,t.cloneCells&&this.cells.each(function(e){i.cells.add(e.clone(i,t),{silent:!0})}),i}})},{}],17:[function(e,t,i){t.exports=Backbone.Model.extend({cell:null,defaults:{"class":null,missing:!1,values:{},raw:!1,style:{},read_only:!1,widget_id:""},indexes:null,initialize:function(){var e=this.get("class");(_.isUndefined(panelsOptions.widgets[e])||!panelsOptions.widgets[e].installed)&&this.set("missing",!0)},getWidgetField:function(e){return _.isUndefined(panelsOptions.widgets[this.get("class")])?"title"===e||"description"===e?panelsOptions.loc.missing_widget[e]:"":panelsOptions.widgets[this.get("class")][e]},moveToCell:function(e,t){return t=_.extend({silent:!0},t),this.cell.cid===e.cid?!1:(this.cell=e,this.collection.remove(this,t),e.widgets.add(this,t),!0)},triggerEdit:function(){this.trigger("user_edit",this)},triggerDuplicate:function(){this.trigger("user_duplicate",this)},setValues:function(e){var t=!1;JSON.stringify(e)!==JSON.stringify(this.get("values"))&&(t=!0),this.set("values",e,{silent:!0}),t&&(this.trigger("change",this),this.trigger("change:values"))},clone:function(e,t){_.isUndefined(e)&&(e=this.cell);var i=new this.constructor(this.attributes),s=JSON.parse(JSON.stringify(this.get("values"))),o=function(e){return _.each(e,function(t,i){_.isString(i)&&"_"===i[0]?delete e[i]:_.isObject(e[i])&&o(e[i])}),e};return s=o(s),"SiteOrigin_Panels_Widgets_Layout"===this.get("class")&&(s.builder_id=Math.random().toString(36).substr(2)),i.set("values",s,{silent:!0}),i.set("collection",e.widgets,{silent:!0}),i.cell=e,i.isDuplicate=!0,i},getTitle:function(){var e=panelsOptions.widgets[this.get("class")];if(_.isUndefined(e))return this.get("class").replace(/_/g," ");if(!_.isUndefined(e.panels_title)&&e.panels_title===!1)return panelsOptions.widgets[this.get("class")].description;var t=this.get("values"),i=["title","text"];for(var s in t)t.hasOwnProperty(s)&&i.push(s);i=_.uniq(i);for(var o in i)if(!_.isUndefined(t[i[o]])&&_.isString(t[i[o]])&&""!==t[i[o]]&&"on"!==t[i[o]]&&"_"!==i[o][0]&&!jQuery.isNumeric(t[i[o]])){var l=t[i[o]];l=l.replace(/<\/?[^>]+(>|$)/g,"");var n=l.split(" ");return n=n.slice(0,20),n.join(" ")}return this.getWidgetField("description")}})},{}],18:[function(e,t,i){var s=(window.panels,jQuery);t.exports=Backbone.View.extend({wrapperTemplate:_.template(s("#siteorigin-panels-context-menu").html().panelsProcessTemplate()),sectionTemplate:_.template(s("#siteorigin-panels-context-menu-section").html().panelsProcessTemplate()),contexts:[],active:!1,events:{"keyup .so-search-wrapper input":"searchKeyUp"},initialize:function(){this.listenContextMenu(),this.render(),this.attach()},listenContextMenu:function(){var e=this;s(window).on("contextmenu",function(t){return e.active&&!e.isOverEl(e.$el,t)?(e.closeMenu(),e.active=!1,t.preventDefault(),!1):e.active?!0:(e.active=!1,e.trigger("activate_context",t,e),void(e.active&&(t.preventDefault(),e.openMenu({left:t.pageX,top:t.pageY}))))})},render:function(){this.setElement(this.wrapperTemplate())},attach:function(){this.$el.appendTo("body")},openMenu:function(e){this.trigger("open_menu"),s(window).on("keyup",{menu:this},this.keyboardListen),s(window).on("click",{menu:this},this.clickOutsideListen),this.$el.css("max-height",s(window).height()-20),e.left+this.$el.outerWidth()+10>=s(window).width()&&(e.left=s(window).width()-this.$el.outerWidth()-10),e.left<=0&&(e.left=10),e.top+this.$el.outerHeight()-s(window).scrollTop()+10>=s(window).height()&&(e.top=s(window).height()+s(window).scrollTop()-this.$el.outerHeight()-10),e.left<=0&&(e.left=10),this.$el.css({left:e.left+1,top:e.top+1}).show(),this.$(".so-search-wrapper input").focus()},closeMenu:function(){this.trigger("close_menu"),s(window).off("keyup",this.keyboardListen),s(window).off("click",this.clickOutsideListen),this.active=!1,this.$el.empty().hide()},keyboardListen:function(e){var t=e.data.menu;switch(e.which){case 27:t.closeMenu()}},clickOutsideListen:function(e){var t=e.data.menu;3!==e.which&&t.$el.is(":visible")&&!t.isOverEl(t.$el,e)&&t.closeMenu()},addSection:function(e,t,i){var o=this;e=_.extend({display:5,defaultDisplay:!1,search:!0,sectionTitle:"",searchPlaceholder:"",titleKey:"title"},e);var l=s(this.sectionTemplate({settings:e,items:t}));this.$el.append(l),l.find(".so-item:not(.so-confirm)").click(function(){var e=s(this);i(e.data("key")),o.closeMenu()}),l.find(".so-item.so-confirm").click(function(){var e=s(this);return e.hasClass("so-confirming")?(i(e.data("key")),void o.closeMenu()):(e.data("original-text",e.html()).addClass("so-confirming").html('<span class="dashicons dashicons-yes"></span> '+panelsOptions.loc.dropdown_confirm),void setTimeout(function(){e.removeClass("so-confirming"),e.html(e.data("original-text"))},2500))}),l.data("settings",e).find(".so-search-wrapper input").trigger("keyup"),this.active=!0},searchKeyUp:function(e){var t=s(e.currentTarget),i=t.closest(".so-section"),o=i.data("settings");if(38===e.which||40===e.which){var l=i.find("ul li:visible"),n=l.filter(".so-active").eq(0);if(n.length){l.removeClass("so-active");var a=l.index(n);38===e.which?n=0>a-1?l.last():l.eq(a-1):40===e.which&&(n=a+1>=l.length?l.first():l.eq(a+1))}else 38===e.which?n=l.last():40===e.which&&(n=l.first());return n.addClass("so-active"),!1}if(13===e.which)return 1===i.find("ul li:visible").length?(i.find("ul li:visible").trigger("click"),!1):(i.find("ul li.so-active:visible").trigger("click"),!1);if(""===t.val())if(o.defaultDisplay){i.find(".so-item").hide();for(var r=0;r<o.defaultDisplay.length;r++)i.find('.so-item[data-key="'+o.defaultDisplay[r]+'"]').show()}else i.find(".so-item").show();else i.find(".so-item").hide().each(function(){var e=s(this);-1!==e.html().toLowerCase().indexOf(t.val().toLowerCase())&&e.show()});i.find(".so-item:visible:gt("+(o.display-1)+")").hide(),0===i.find(".so-item:visible").length&&""!==t.val()?i.find(".so-no-results").show():i.find(".so-no-results").hide()},isOverEl:function(e,t){var i=[[e.offset().left,e.offset().top],[e.offset().left+e.outerWidth(),e.offset().top+e.outerHeight()]];return t.pageX>=i[0][0]&&t.pageX<=i[1][0]&&t.pageY>=i[0][1]&&t.pageY<=i[1][1]}})},{}],19:[function(e,t,i){var s=window.panels,o=jQuery;t.exports=Backbone.View.extend({config:{},template:_.template(o("#siteorigin-panels-builder").html().panelsProcessTemplate()),dialogs:{},rowsSortable:null,dataField:!1,currentData:"",attachedToEditor:!1,liveEditor:void 0,menu:!1,events:{"click .so-tool-button.so-widget-add":"displayAddWidgetDialog","click .so-tool-button.so-row-add":"displayAddRowDialog","click .so-tool-button.so-prebuilt-add":"displayAddPrebuiltDialog","click .so-tool-button.so-history":"displayHistoryDialog","click .so-tool-button.so-live-editor":"displayLiveEditor"},rows:null,initialize:function(e){var t=this;return this.config=_.extend({loadLiveEditor:!1,builderSupports:{}},e.config),this.config.builderSupports=_.extend({addRow:!0,editRow:!0,deleteRow:!0,moveRow:!0,addWidget:!0,editWidget:!0,deleteWidget:!0,moveWidget:!0,prebuilt:!0,history:!0,liveEditor:!0,revertToEditor:!0},this.config.builderSupports),e.config.loadLiveEditor&&this.on("builder_live_editor_added",function(){this.displayLiveEditor()}),this.dialogs={widgets:new s.dialog.widgets,row:new s.dialog.row,prebuilt:new s.dialog.prebuilt},_.each(this.dialogs,function(e,i,s){s[i].setBuilder(t)}),this.dialogs.row.setRowDialogType("create"),this.model.rows.on("add",this.onAddRow,this),o(window).resize(function(e){e.target===window&&t.trigger("builder_resize")}),this.model.on("change:data load_panels_data",this.storeModelData,this),this.on("content_change",this.handleContentChange,this),this.on("display_builder",this.handleDisplayBuilder,this),this.on("builder_rendered builder_resize",this.handleBuilderSizing,this),this.model.on("change:data load_panels_data",this.toggleWelcomeDisplay,this),this.menu=new s.utils.menu({}),this.menu.on("activate_context",this.activateContextMenu,this),this},render:function(){return this.setElement(this.template()),this.$el.attr("id","siteorigin-panels-builder-"+this.cid).addClass("so-builder-container"),this.trigger("builder_rendered"),this.$(".so-tip-wrapper a").click(function(e){e.preventDefault();var t=o(this).blur(),i=window.open(t.attr("href"),"signup-window","height=450,width=650,toolbar=false");window.focus&&i.focus()}),this},attach:function(e){e=_.extend({container:!1,dialog:!1},e),e.dialog?(this.dialog=new s.dialog.builder,this.dialog.builder=this):(this.$el.appendTo(e.container),this.metabox=e.container.closest(".postbox"),this.initSortable(),this.trigger("attached_to_container",e.container)),this.trigger("builder_attached"),this.supports("liveEditor")&&this.addLiveEditor(),this.supports("history")&&this.addHistoryBrowser();var t=this.$(".so-builder-toolbar");return this.supports("addWidget")||t.find(".so-widget-add").hide(),this.supports("addRow")||t.find(".so-row-add").hide(),this.supports("prebuilt")||t.find(".so-prebuilt-add").hide(),this},attachToEditor:function(){if("tinymce"!==this.config.editorType)return this;this.attachedToEditor=!0;var e=this.metabox,t=this;o("#wp-content-wrap .wp-editor-tabs").find(".wp-switch-editor").click(function(e){e.preventDefault(),o("#wp-content-editor-container, #post-status-info").show(),o("#wp-content-wrap").removeClass("panels-active"),o("#content-resize-handle").show(),t.trigger("hide_builder")}).end().append(o('<a id="content-panels" class="hide-if-no-js wp-switch-editor switch-panels">'+e.find(".hndle span").html()+"</a>").click(function(i){i.preventDefault();jQuery(this);o("#wp-content-wrap, #post-status-info").hide(),e.show().find("> .inside").show(),o(window).resize(),o(document).scroll(),t.trigger("display_builder")})),this.supports("revertToEditor")&&e.find(".so-switch-to-standard").click(function(i){i.preventDefault(),confirm(panelsOptions.loc.confirm_stop_builder)&&(t.addHistoryEntry("back_to_editor"),t.model.loadPanelsData(!1),o("#wp-content-wrap, #post-status-info").show(),e.hide(),o(window).resize())}).show(),e.insertAfter("#wp-content-wrap").hide().addClass("attached-to-editor");var i=this.model.get("data");_.isEmpty(i.widgets)&&_.isEmpty(i.grids)||o("#content-panels.switch-panels").click();var s=function(){var e=t.$(".so-builder-toolbar");if(t.$el.hasClass("so-display-narrow"))return e.css({top:0,left:0,width:"100%",position:"absolute"}),void t.$el.css("padding-top",e.outerHeight());var i=o(window).scrollTop()-t.$el.offset().top;"fixed"===o("#wpadminbar").css("position")&&(i+=o("#wpadminbar").outerHeight());var s={top:0,bottom:t.$el.outerHeight()-e.outerHeight()+20};i>s.top&&i<s.bottom?"fixed"!==e.css("position")&&e.css({top:o("#wpadminbar").outerHeight(),left:t.$el.offset().left,width:t.$el.outerWidth(),position:"fixed"}):e.css({top:Math.min(Math.max(i,0),t.$el.outerHeight()-e.outerHeight()+20),left:0,width:"100%",position:"absolute"}),t.$el.css("padding-top",e.outerHeight())};return this.on("builder_resize",s,this),o(document).scroll(s),s(),this.trigger("builder_attached_to_editor"),this},initSortable:function(){if(!this.supports("moveRow"))return this;var e=this;return this.rowsSortable=this.$(".so-rows-container").sortable({appendTo:"#wpwrap",items:".so-row-container",handle:".so-row-move",axis:"y",tolerance:"pointer",scroll:!1,stop:function(t){e.addHistoryEntry("row_moved"),e.sortCollections()}}),this},refreshSortable:function(){_.isNull(this.rowsSortable)||this.rowsSortable.sortable("refresh")},setDataField:function(e,t){if(t=_.extend({load:!0},t),this.dataField=e,this.dataField.data("builder",this),t.load&&""!==e.val()){var i=this.dataField.val();try{i=JSON.parse(i)}catch(s){i={}}this.model.loadPanelsData(i),this.currentData=i,this.toggleWelcomeDisplay(),this.sortCollections()}return this},storeModelData:function(){var e=JSON.stringify(this.model.get("data"));o(this.dataField).val()!==e&&(o(this.dataField).val(e),o(this.dataField).trigger("change"),this.trigger("content_change"))},onAddRow:function(e,t,i){i=_.extend({noAnimate:!1},i);var o=new s.view.row({model:e});o.builder=this,o.render(),_.isUndefined(i.at)||t.length<=1?o.$el.appendTo(this.$(".so-rows-container")):o.$el.insertAfter(this.$(".so-rows-container .so-row-container").eq(i.at-1)),i.noAnimate===!1&&o.visualCreate(),this.refreshSortable(),o.resize()},displayAddWidgetDialog:function(){this.dialogs.widgets.openDialog()},displayAddRowDialog:function(){this.dialogs.row.openDialog(),this.dialogs.row.setRowModel()},displayAddPrebuiltDialog:function(){this.dialogs.prebuilt.openDialog()},displayHistoryDialog:function(){this.dialogs.history.openDialog()},getActiveCell:function(e){if(e=_.extend({createCell:!0,defaultPosition:"first"},e),0===this.$(".so-cells .cell").length){if(!e.createCell)return null;this.model.addRow([1],{noAnimate:!0})}var t=this.$(".so-cells .cell.cell-selected");return 0===t.length&&(t="last"===e.defaultPosition?this.$(".so-cells .cell").first():this.$(".so-cells .cell").last()),t.data("view").model},sortCollections:function(){this.$(".so-widget").each(function(e){var t=o(this);t.data("view").model.indexes={builder:e,cell:t.index()}}),this.$(".so-cells .cell").each(function(e){var t=o(this);t.data("view").model.indexes={builder:e,row:t.index()}}),this.$(".so-row-container").each(function(e){var t=o(this);t.data("view").model.indexes={builder:e}}),this.model.rows.visualSort(),this.model.rows.each(function(e){e.cells.each(function(e){e.widgets.visualSort()})}),this.model.refreshPanelsData()},addLiveEditor:function(){return _.isEmpty(this.config.liveEditorPreview)?this:(this.liveEditor=new s.view.liveEditor({builder:this,previewUrl:this.config.liveEditorPreview}),this.liveEditor.hasPreviewUrl()&&this.$(".so-builder-toolbar .so-live-editor").show(),this.trigger("builder_live_editor_added"),this)},displayLiveEditor:function(){_.isUndefined(this.liveEditor)||this.liveEditor.open()},addHistoryBrowser:function(){return _.isEmpty(this.config.liveEditorPreview)?this:(this.dialogs.history=new s.dialog.history,this.dialogs.history.builder=this,this.dialogs.history.entries.builder=this.model,this.dialogs.history.setRevertEntry(this.model),void this.$(".so-builder-toolbar .so-history").show())},addHistoryEntry:function(e,t){_.isUndefined(t)&&(t=null),_.isUndefined(this.dialogs.history)||this.dialogs.history.entries.addEntry(e,t)},supports:function(e){return"rowAction"===e?this.supports("addRow")||this.supports("editRow")||this.supports("deleteRow"):"widgetAction"===e?this.supports("addWidget")||this.supports("editWidget")||this.supports("deleteWidget"):_.isUndefined(this.config.builderSupports[e])?!1:this.config.builderSupports[e]},handleContentChange:function(){if(panelsOptions.copy_content&&this.attachedToEditor&&this.$el.is(":visible")){var e=this.model.getPanelsData();_.isEmpty(e.widgets)||o.post(panelsOptions.ajaxurl,{action:"so_panels_builder_content",panels_data:JSON.stringify(e),post_id:this.config.postId},function(e){var t=o("<div />").html(e);t.find("div").each(function(){var e=o(this).contents();o(this).replaceWith(e)}),e=t.html().replace(/[\r\n]+/g,"\n").replace(/\n\s+/g,"\n").trim(),""!==e&&this.updateEditorContent(e)}.bind(this))}},updateEditorContent:function(e){if("tinymce"!==this.config.editorType||_.isUndefined(tinyMCE)||_.isNull(tinyMCE.get("content"))){var t=o(this.config.editorId);t.val(e).trigger("change").trigger("keyup")}else{var i=tinyMCE.get("content");i.setContent(e),i.fire("change"),i.fire("keyup")}this.triggerYoastSeoChange()},triggerYoastSeoChange:function(){if(o("#yoast_wpseo_focuskw_text_input").length){var e,t=document.getElementById("yoast_wpseo_focuskw_text_input");document.createEvent?(e=document.createEvent("HTMLEvents"),e.initEvent("keyup",!0,!0)):(e=document.createEventObject(),e.eventType="keyup"),e.eventName="keyup",document.createEvent?t.dispatchEvent(e):t.fireEvent("on"+e.eventType,e)}},handleDisplayBuilder:function(){var e,t="";if(_.isUndefined(tinyMCE)||(e=tinyMCE.get("content")),t=e&&_.isFunction(e.getContent)?e.getContent():o("textarea#content").val(),(_.isEmpty(this.model.get("data"))||_.isEmpty(this.model.get("data").widgets)&&_.isEmpty(this.model.get("data").grids))&&""!==t){if(!confirm(panelsOptions.loc.confirm_use_builder))return;var i="";if(_.isUndefined(panelsOptions.widgets.SiteOrigin_Widget_Editor_Widget)?_.isUndefined(panelsOptions.widgets.WP_Widget_Text)||(i="WP_Widget_Text"):i="SiteOrigin_Widget_Editor_Widget",""===i)return;this.model.loadPanelsData({grid_cells:[{grid:0,weight:1}],grids:[{cells:1}],widgets:[{filter:"1",text:t,title:"",type:"visual",panels_info:{"class":i,raw:!1,grid:0,cell:0}}]}),this.model.trigger("change"),this.model.trigger("change:data")}},handleBuilderSizing:function(){var e=this.$el.width();return e?void(480>e?this.$el.addClass("so-display-narrow"):this.$el.removeClass("so-display-narrow")):this},setDialogParents:function(e,t){_.each(this.dialogs,function(i,s,o){o[s].setParent(e,t)}),this.on("add_dialog",function(i){i.setParent(e,t)},this)},toggleWelcomeDisplay:function(){this.model.rows.isEmpty()?this.$(".so-panels-welcome-message").show():this.$(".so-panels-welcome-message").hide()},activateContextMenu:function(e,t){var i=this,s=o(".siteorigin-panels-builder:visible").sort(function(e,t){return o(e).zIndex()>o(t).zIndex()?1:-1}).last(),l=o(".so-panels-dialog-wrapper:visible").sort(function(e,t){return o(e).zIndex()>o(t).zIndex()?1:-1}).last(),n=i.$el.closest(".so-panels-dialog-wrapper");if(i.$el.is(s)&&(0===l.length||l.is(n))){var a=o([]).add(i.$(".so-rows-container > .so-row-container")).add(i.$(".so-cells > .cell")).add(i.$(".cell-wrapper > .so-widget")).filter(function(i){return t.isOverEl(o(this),e)}),r=a.last().data("view");void 0!==r&&void 0!==r.buildContextualMenu&&r.buildContextualMenu(e,t)}},lockPageScroll:function(){if("hidden"!==o("body").css("overflow")){var e=[self.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,self.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop];o("body").data({"scroll-position":e}).css("overflow","hidden"),_.isUndefined(e)||window.scrollTo(e[0],e[1])}},unlockPageScroll:function(){if("hidden"===o("body").css("overflow")&&!o(".so-panels-dialog-wrapper").is(":visible")&&!o(".so-panels-live-editor").is(":visible")){o("body").css("overflow","visible");var e=o("body").data("scroll-position");_.isUndefined(e)||window.scrollTo(e[0],e[1])}}})},{}],20:[function(e,t,i){var s=window.panels,o=jQuery;t.exports=Backbone.View.extend({template:_.template(o("#siteorigin-panels-builder-cell").html().panelsProcessTemplate()),events:{"click .cell-wrapper":"handleCellClick"},row:null,widgetSortable:null,initialize:function(){this.model.widgets.on("add",this.onAddWidget,this)},render:function(){var e={weight:this.model.get("weight"),totalWeight:this.row.model.cells.totalWeight()};this.setElement(this.template(e)),this.$el.data("view",this);var t=this;return this.model.widgets.each(function(e){var i=new s.view.widget({model:e});i.cell=t,i.render(),i.$el.appendTo(t.$(".widgets-container"))}),this.initSortable(),this.initResizable(),this},initSortable:function(){if(!this.row.builder.supports("moveWidget"))return this;var e=this,t=e.row.builder.$el.attr("id");return this.widgetSortable=this.$(".widgets-container").sortable({placeholder:"so-widget-sortable-highlight",connectWith:"#"+t+" .so-cells .cell .widgets-container",tolerance:"pointer",scroll:!1,over:function(t,i){e.row.builder.trigger("widget_sortable_move")},stop:function(t,i){e.row.builder.addHistoryEntry("widget_moved");var s=o(i.item).data("view"),l=o(i.item).closest(".cell").data("view");s.model.moveToCell(l.model),s.cell=l,e.row.builder.sortCollections()},helper:function(e,t){var i=t.clone().css({width:t.outerWidth(),"z-index":1e4,position:"fixed"}).addClass("widget-being-dragged").appendTo("body");return t.outerWidth()>720&&i.animate({"margin-left":e.pageX-t.offset().left-240,width:480},"fast"),i}}),this},refreshSortable:function(){_.isNull(this.widgetSortable)||this.widgetSortable.sortable("refresh")},initResizable:function(){if(!this.row.builder.supports("editRow"))return this;var e,t=this.$(".resize-handle").css("position","absolute"),i=this.row.$el,s=this;return t.draggable({axis:"x",containment:i,start:function(t,i){if(e=s.$el.prev().data("view"),!_.isUndefined(e)){var l=s.$el.clone().appendTo(i.helper).css({position:"absolute",top:"0",width:s.$el.outerWidth(),left:5,height:s.$el.outerHeight()});l.find(".resize-handle").remove();var n=e.$el.clone().appendTo(i.helper).css({position:"absolute",top:"0",width:e.$el.outerWidth(),right:5,height:e.$el.outerHeight()});n.find(".resize-handle").remove(),o(this).data({newCellClone:l,prevCellClone:n})}},drag:function(i,l){var n=s.row.$el.width()+10,a=s.model.get("weight")-(l.position.left+t.outerWidth()/2)/n,r=e.model.get("weight")+(l.position.left+t.outerWidth()/2)/n;o(this).data("newCellClone").css("width",n*a).find(".preview-cell-weight").html(Math.round(1e3*a)/10),o(this).data("prevCellClone").css("width",n*r).find(".preview-cell-weight").html(Math.round(1e3*r)/10)},stop:function(i,l){o(this).data("newCellClone").remove(),o(this).data("prevCellClone").remove();var n=s.row.$el.width()+10,a=s.model.get("weight")-(l.position.left+t.outerWidth()/2)/n,r=e.model.get("weight")+(l.position.left+t.outerWidth()/2)/n;a>.02&&r>.02&&(s.row.builder.addHistoryEntry("cell_resized"),s.model.set("weight",a),e.model.set("weight",r),s.row.resize()),l.helper.css("left",-t.outerWidth()/2),s.row.builder.model.refreshPanelsData()}}),this},onAddWidget:function(e,t,i){i=_.extend({noAnimate:!1},i);var o=new s.view.widget({model:e});o.cell=this,_.isUndefined(e.isDuplicate)&&(e.isDuplicate=!1),o.render({loadForm:e.isDuplicate}),_.isUndefined(i.at)||t.length<=1?o.$el.appendTo(this.$(".widgets-container")):o.$el.insertAfter(this.$(".widgets-container .so-widget").eq(i.at-1)),i.noAnimate===!1&&o.visualCreate(),this.refreshSortable(),this.row.resize()},handleCellClick:function(e){this.$el.closest(".so-rows-container").find(".so-cells .cell").removeClass("cell-selected");o(e.target).parent().addClass("cell-selected")},buildContextualMenu:function(e,t){var i=this;t.addSection({sectionTitle:panelsOptions.loc.contextual.add_widget_cell,searchPlaceholder:panelsOptions.loc.contextual.search_widgets,defaultDisplay:panelsOptions.contextual.default_widgets},panelsOptions.widgets,function(e){i.row.builder.addHistoryEntry("widget_added");var t=new s.model.widget({"class":e});t.cell=i.model,t.cell.widgets.add(t),i.row.builder.model.refreshPanelsData()}),this.row.buildContextualMenu(e,t)}})},{}],21:[function(e,t,i){var s=(window.panels,jQuery);t.exports=Backbone.View.extend({dialogTemplate:_.template(s("#siteorigin-panels-dialog").html().panelsProcessTemplate()),dialogTabTemplate:_.template(s("#siteorigin-panels-dialog-tab").html().panelsProcessTemplate()),tabbed:!1,rendered:!1,builder:!1,className:"so-panels-dialog-wrapper",dialogClass:"",parentDialog:!1,dialogOpen:!1,events:{"click .so-close":"closeDialog","click .so-nav.so-previous":"navToPrevious","click .so-nav.so-next":"navToNext"},initialize:function(){this.once("open_dialog",this.render),this.once("open_dialog",this.attach),this.once("open_dialog",this.setDialogClass),this.trigger("initialize_dialog",this),_.isUndefined(this.initializeDialog)||this.initializeDialog()},getNextDialog:function(){return null},getPrevDialog:function(){return null},setDialogClass:function(){""!==this.dialogClass&&this.$(".so-panels-dialog").addClass(this.dialogClass)},setBuilder:function(e){return this.builder=e,e.trigger("add_dialog",this,this.builder),this},attach:function(){return this.$el.appendTo("body"),this},parseDialogContent:function(e,t){t=_.extend({cid:this.cid},t);var i=s(_.template(e.panelsProcessTemplate())(t)),o={title:i.find(".title").html(),buttons:i.find(".buttons").html(),content:i.find(".content").html()};return i.has(".left-sidebar")&&(o.left_sidebar=i.find(".left-sidebar").html()),i.has(".right-sidebar")&&(o.right_sidebar=i.find(".right-sidebar").html()),o},renderDialog:function(e){if(this.$el.html(this.dialogTemplate(e)).hide(),this.$el.data("view",this),this.$el.addClass("so-panels-dialog-wrapper"),this.parentDialog!==!1){var t=this,i=s('<h3 class="so-parent-link"></h3>').html(this.parentDialog.text+'<div class="so-separator"></div>');i.click(function(e){e.preventDefault(),t.closeDialog(),t.parentDialog.openDialog()}),this.$(".so-title-bar").prepend(i)}return this},initTabs:function(){var e=this.$(".so-sidebar-tabs li a");if(0===e.length)return this;var t=this;return e.click(function(e){e.preventDefault();var i=s(this);t.$(".so-sidebar-tabs li").removeClass("tab-active"),t.$(".so-content .so-content-tabs > *").hide(),i.parent().addClass("tab-active");var o=i.attr("href");if(!_.isUndefined(o)&&"#"===o.charAt(0)){var l=o.split("#")[1];t.$(".so-content .so-content-tabs .tab-"+l).show()}t.trigger("tab_click",i)}),this.$(".so-sidebar-tabs li a").first().click(),this},initToolbar:function(){var e=this.$(".so-toolbar .so-buttons .so-toolbar-button");e.click(function(e){e.preventDefault(),this.trigger("button_click",s(e.currentTarget))}.bind(this));var t=this.$(".so-toolbar .so-buttons .so-dropdown-button");
3
+ t.click(function(e){e.preventDefault();var t=s(e.currentTarget),i=t.siblings(".so-dropdown-links-wrapper");i.is(".hidden")?i.removeClass("hidden"):i.addClass("hidden")}.bind(this)),s("html").click(function(e){this.$(".so-dropdown-links-wrapper").not(".hidden").each(function(t,i){var o=s(i),l=s(e.target);0!==l.length&&(l.is(".so-needs-confirm")&&!l.is(".so-confirmed")||l.is(".so-dropdown-button"))||o.addClass("hidden")})}.bind(this))},setupDialog:function(){this.openDialog(),this.closeDialog()},refreshDialogNav:function(){this.$(".so-title-bar .so-nav").show().removeClass("so-disabled");var e=this.getNextDialog(),t=this.$(".so-title-bar .so-next"),i=this.getPrevDialog(),s=this.$(".so-title-bar .so-previous");null===e?t.hide():e===!1&&t.addClass("so-disabled"),null===i?s.hide():i===!1&&s.addClass("so-disabled")},openDialog:function(e){e=_.extend({silent:!1},e),e.silent||this.trigger("open_dialog"),this.dialogOpen=!0,this.refreshDialogNav(),this.builder.lockPageScroll(),s(window).on("keyup",this.keyboardListen),this.$el.show(),e.silent||(this.trigger("open_dialog_complete"),this.builder.trigger("open_dialog",this))},closeDialog:function(e){e=_.extend({silent:!1},e),e.silent||this.trigger("close_dialog"),this.dialogOpen=!1,this.$el.hide(),this.builder.unlockPageScroll(),s(window).off("keyup",this.keyboardListen),e.silent||(this.trigger("close_dialog_complete"),this.builder.trigger("close_dialog",this))},keyboardListen:function(e){27===e.which&&s(".so-panels-dialog-wrapper .so-close").trigger("click")},navToPrevious:function(){this.closeDialog();var e=this.getPrevDialog();null!==e&&e!==!1&&e.openDialog()},navToNext:function(){this.closeDialog();var e=this.getNextDialog();null!==e&&e!==!1&&e.openDialog()},getFormValues:function(e){_.isUndefined(e)&&(e=".so-content");var t,i=this.$(e),o={};return i.find("[name]").each(function(){var e=s(this);try{var i=/([A-Za-z_]+)\[(.*)\]/.exec(e.attr("name"));if(_.isEmpty(i))return!0;_.isUndefined(i[2])?t=e.attr("name"):(t=i[2].split("]["),t.unshift(i[1])),t=t.map(function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e});var l=o,n=null,a=_.isString(e.attr("type"))?e.attr("type").toLowerCase():!1;if("checkbox"===a)n=e.is(":checked")?""!==e.val()?e.val():!0:null;else if("radio"===a){if(!e.is(":checked"))return;n=e.val()}else if("TEXTAREA"===e.prop("tagName")&&e.hasClass("wp-editor-area")){var r=null;_.isUndefined(tinyMCE)||(r=tinyMCE.get(e.attr("id"))),n=null!==r&&_.isFunction(r.getContent)&&!r.isHidden()?r.getContent():e.val()}else if("SELECT"===e.prop("tagName")){var d=e.find("option:selected");1===d.length?n=e.find("option:selected").val():d.length>1&&(n=_.map(e.find("option:selected"),function(e,t){return s(e).val()}))}else n=e.val();if(!_.isUndefined(e.data("panels-filter")))switch(e.data("panels-filter")){case"json_parse":try{n=JSON.parse(n)}catch(c){n=""}}if(null!==n)for(var h=0;h<t.length;h++)h===t.length-1?""===t[h]?l.push(n):l[t[h]]=n:(_.isUndefined(l[t[h]])&&(""===t[h+1]?l[t[h]]=[]:l[t[h]]={}),l=l[t[h]])}catch(u){console.log("Field ["+e.attr("name")+"] could not be processed and was skipped - "+u.message)}}),o},setStatusMessage:function(e,t){this.$(".so-toolbar .so-status").html(e),!_.isUndefined(t)&&t&&this.$(".so-toolbar .so-status").addClass("so-panels-loading")},setParent:function(e,t){this.parentDialog={text:e,dialog:t}}})},{}],22:[function(e,t,i){var s=(window.panels,jQuery);t.exports=Backbone.View.extend({template:_.template(s("#siteorigin-panels-live-editor").html().panelsProcessTemplate()),previewScrollTop:0,loadTimes:[],previewFrameId:1,previewUrl:null,previewIframe:null,events:{"click .live-editor-close":"close","click .live-editor-collapse":"collapse","click .live-editor-mode":"mobileToggle"},initialize:function(e){e=_.extend({builder:!1,previewUrl:!1},e),_.isEmpty(e.previewUrl)&&(e.previewUrl=panelsOptions.ajaxurl+"&action=so_panels_live_editor_preview"),this.builder=e.builder,this.previewUrl=e.previewUrl,this.builder.model.on("refresh_panels_data",this.handleRefreshData,this),this.builder.model.on("load_panels_data",this.handleLoadData,this)},render:function(){this.setElement(this.template()),this.$el.hide();var e=this,t=!1;return s(document).mousedown(function(){t=!0}).mouseup(function(){t=!1}),e.$el.on("mouseenter",".so-widget-wrapper",function(){var i=(s(this),s(this).data("live-editor-preview-widget"));t||void 0===i||!i.length||e.$(".so-preview-overlay").is(":visible")||(e.highlightElement(i),e.scrollToElement(i))}),e.$el.on("mouseleave",".so-widget-wrapper",function(){e.resetHighlights()}),e.builder.on("open_dialog",function(){e.resetHighlights()}),this},attach:function(){this.$el.appendTo("body")},open:function(){if(""===this.$el.html()&&this.render(),0===this.$el.closest("body").length&&this.attach(),this.builder.lockPageScroll(),this.$el.is(":visible"))return this;if(this.$el.show(),this.refreshPreview(this.builder.model.getPanelsData()),this.originalContainer=this.builder.$el.parent(),this.builder.$el.appendTo(this.$(".so-live-editor-builder")),this.builder.$(".so-tool-button.so-live-editor").hide(),this.builder.trigger("builder_resize"),"auto-draft"===s("#original_post_status").val()&&!this.autoSaved){var e=this;wp.autosave&&(""===s('#title[name="post_title"]').val()&&s('#title[name="post_title"]').val(panelsOptions.loc.draft).trigger("keydown"),s(document).one("heartbeat-tick.autosave",function(){e.autoSaved=!0,e.refreshPreview(e.builder.model.getPanelsData())}),wp.autosave.server.triggerSave())}},close:function(){return this.$el.is(":visible")?(this.$el.hide(),this.builder.unlockPageScroll(),this.builder.$el.appendTo(this.originalContainer),this.builder.$(".so-tool-button.so-live-editor").show(),void this.builder.trigger("builder_resize")):this},collapse:function(){this.$el.toggleClass("so-collapsed");var e=this.$(".live-editor-collapse span");e.html(e.data(this.$el.hasClass("so-collapsed")?"expand":"collapse"))},highlightElement:function(e){_.isUndefined(this.resetHighlightTimeout)||clearTimeout(this.resetHighlightTimeout);var t=this.previewIframe.contents().find("body");t.find(".panel-grid .panel-grid-cell .so-panel").filter(function(){return 0===s(this).parents(".so-panel").length}).not(e).addClass("so-panels-faded"),e.removeClass("so-panels-faded").addClass("so-panels-highlighted")},resetHighlights:function(){var e=this.previewIframe.contents().find("body");this.resetHighlightTimeout=setTimeout(function(){e.find(".panel-grid .panel-grid-cell .so-panel").removeClass("so-panels-faded so-panels-highlighted")},100)},scrollToElement:function(e){var t=this.$(".so-preview iframe")[0].contentWindow;t.liveEditorScrollTo(e)},handleRefreshData:function(e,t){return this.$el.is(":visible")?void this.refreshPreview(e):this},handleLoadData:function(){return this.$el.is(":visible")?void this.refreshPreview(this.builder.model.getPanelsData()):this},refreshPreview:function(e){var t=this.loadTimes.length?_.reduce(this.loadTimes,function(e,t){return e+t},0)/this.loadTimes.length:1e3;_.isNull(this.previewIframe)||this.$(".so-preview-overlay").is(":visible")||(this.previewScrollTop=this.previewIframe.contents().scrollTop()),this.$(".so-preview-overlay").show(),this.$(".so-preview-overlay .so-loading-bar").clearQueue().css("width","0%").animate({width:"100%"},parseInt(t)+100),this.postToIframe({live_editor_panels_data:JSON.stringify(e)},this.previewUrl,this.$(".so-preview")),this.previewIframe.data("load-start",(new Date).getTime())},postToIframe:function(e,t,i){_.isNull(this.previewIframe)||this.previewIframe.remove();var o="siteorigin-panels-live-preview-"+this.previewFrameId;this.previewIframe=s('<iframe src="javascript:false;" />').attr({id:o,name:o}).appendTo(i),this.setupPreviewFrame(this.previewIframe);var l=s('<form id="soPostToPreviewFrame" method="post" />').attr({id:o,target:this.previewIframe.attr("id"),action:t}).appendTo("body");return s.each(e,function(e,t){s('<input type="hidden" />').attr({name:e,value:t}).appendTo(l)}),l.submit().remove(),this.previewFrameId++,this.previewIframe},setupPreviewFrame:function(e){var t=this;e.data("iframeready",!1).on("iframeready",function(){var e=s(this),i=e.contents();e.data("iframeready")||(e.data("iframeready",!0),void 0!==e.data("load-start")&&(t.loadTimes.unshift((new Date).getTime()-e.data("load-start")),_.isEmpty(t.loadTimes)||(t.loadTimes=t.loadTimes.slice(0,4))),setTimeout(function(){i.scrollTop(t.previewScrollTop),t.$(".so-preview-overlay").hide()},100),i.find(".panel-grid .panel-grid-cell .so-panel").filter(function(){return 0===s(this).parents(".so-panel").length}).each(function(e,i){var o=s(i),l=t.$(".so-live-editor-builder .so-widget-wrapper").eq(o.data("index"));l.data("live-editor-preview-widget",o),o.css({cursor:"pointer"}).mouseenter(function(){l.parent().addClass("so-hovered"),t.highlightElement(o)}).mouseleave(function(){l.parent().removeClass("so-hovered"),t.resetHighlights()}).click(function(e){e.preventDefault(),l.find(".title h4").click()})}),i.find("a").css({"pointer-events":"none"}).click(function(e){e.preventDefault()}))}).on("load",function(){var e=s(this);e.data("iframeready")||e.trigger("iframeready")})},hasPreviewUrl:function(){return""!==this.$("form.live-editor-form").attr("action")},mobileToggle:function(e){var t=s(e.currentTarget);this.$(".live-editor-mode").not(t).removeClass("so-active"),t.addClass("so-active"),this.$el.removeClass("live-editor-desktop-mode live-editor-tablet-mode live-editor-mobile-mode").addClass("live-editor-"+t.data("mode")+"-mode")}})},{}],23:[function(e,t,i){var s=window.panels,o=jQuery;t.exports=Backbone.View.extend({template:_.template(o("#siteorigin-panels-builder-row").html().panelsProcessTemplate()),events:{"click .so-row-settings":"editSettingsHandler","click .so-row-duplicate":"duplicateHandler","click .so-row-delete":"confirmedDeleteHandler"},builder:null,dialog:null,initialize:function(){this.model.cells.on("add",this.handleCellAdd,this),this.model.cells.on("remove",this.handleCellRemove,this),this.model.on("reweight_cells",this.resize,this),this.model.on("destroy",this.onModelDestroy,this),this.model.on("visual_destroy",this.visualDestroyModel,this);var e=this;this.model.cells.each(function(t){e.listenTo(t.widgets,"add",e.resize)}),this.model.cells.on("add",function(t){e.listenTo(t.widgets,"add",e.resize)},this)},render:function(){this.setElement(this.template()),this.$el.data("view",this);var e=this;return this.model.cells.each(function(t){var i=new s.view.cell({model:t});i.row=e,i.render(),i.$el.appendTo(e.$(".so-cells"))}),this.builder.supports("rowAction")?(this.builder.supports("editWidget")||(this.$(".so-row-toolbar .so-row-settings").parent().remove(),this.$el.addClass("so-row-no-edit")),this.builder.supports("addWidget")||(this.$(".so-row-toolbar .so-row-duplicate").parent().remove(),this.$el.addClass("so-row-no-duplicate")),this.builder.supports("deleteWidget")||(this.$(".so-row-toolbar .so-row-delete").parent().remove(),this.$el.addClass("so-row-no-delete"))):(this.$(".so-row-toolbar .so-dropdown-wrapper").remove(),this.$el.addClass("so-row-no-actions")),this.builder.supports("moveRow")||(this.$(".so-row-toolbar .so-row-move").remove(),this.$el.addClass("so-row-no-move")),o.trim(this.$(".so-row-toolbar").html()).length||this.$(".so-row-toolbar").remove(),this.builder.on("widget_sortable_move",this.resize,this),this.builder.on("builder_resize",this.resize,this),this.resize(),this},visualCreate:function(){this.$el.hide().fadeIn("fast")},resize:function(e){if(this.$el.is(":visible")){this.$(".so-cells .cell-wrapper").css("min-height",0);var t=0;this.$(".so-cells .cell").each(function(){t=Math.max(t,o(this).height()),o(this).css("width",100*o(this).data("view").model.get("weight")+"%")}),this.$(".so-cells .cell-wrapper").css("min-height",Math.max(t,64))}},onModelDestroy:function(){this.remove()},visualDestroyModel:function(){this.builder.addHistoryEntry("row_deleted");var e=this;this.$el.fadeOut("normal",function(){e.model.destroy(),e.builder.model.refreshPanelsData()})},duplicateHandler:function(){this.builder.addHistoryEntry("row_duplicated");var e=this.model.clone(this.builder.model);this.builder.model.rows.add(e,{at:this.builder.model.rows.indexOf(this.model)+1}),this.builder.model.refreshPanelsData()},confirmedDeleteHandler:function(e){var t=o(e.target);if(t.hasClass("dashicons")&&(t=o.parent()),t.hasClass("so-confirmed"))this.visualDestroyModel();else{var i=t.html();t.addClass("so-confirmed").html('<span class="dashicons dashicons-yes"></span>'+panelsOptions.loc.dropdown_confirm),setTimeout(function(){t.removeClass("so-confirmed").html(i)},2500)}},editSettingsHandler:function(){return null===this.dialog&&(this.dialog=new s.dialog.row,this.dialog.setBuilder(this.builder).setRowModel(this.model)),this.dialog.openDialog(),this},deleteHandler:function(){return this.model.destroy(),this},handleCellAdd:function(e){var t=new s.view.cell({model:e});t.row=this,t.render(),t.$el.appendTo(this.$(".so-cells"))},handleCellRemove:function(e){this.$(".so-cells > .cell").each(function(){var t=o(this).data("view");_.isUndefined(t)||t.model.cid===e.cid&&t.remove()})},buildContextualMenu:function(e,t){for(var i=this,o=[],l=1;5>l;l++)o.push({title:l+" "+panelsOptions.loc.contextual.column});this.builder.supports("addRow")&&t.addSection({sectionTitle:panelsOptions.loc.contextual.add_row,search:!1},o,function(e){i.builder.addHistoryEntry("row_added");for(var t=Number(e)+1,o=[],l=0;t>l;l++)o.push(100/t);var n=new s.model.row({collection:i.collection});n.setCells(o),n.builder=i.builder,i.builder.model.rows.add(n,{at:i.builder.model.rows.indexOf(i.model)+1}),i.builder.model.refreshPanelsData()}),actions={},this.builder.supports("editRow")&&(actions.edit={title:panelsOptions.loc.contextual.row_edit}),this.builder.supports("addRow")&&(actions.duplicate={title:panelsOptions.loc.contextual.row_duplicate}),this.builder.supports("deleteRow")&&(actions["delete"]={title:panelsOptions.loc.contextual.row_delete,confirm:!0}),_.isEmpty(actions)||t.addSection({sectionTitle:panelsOptions.loc.contextual.row_actions,search:!1},actions,function(e){switch(e){case"edit":i.editSettingsHandler();break;case"duplicate":i.duplicateHandler();break;case"delete":i.visualDestroyModel()}})}})},{}],24:[function(e,t,i){var s=(window.panels,jQuery);t.exports=Backbone.View.extend({stylesLoaded:!1,initialize:function(){},render:function(e,t,i){if(!_.isUndefined(e)){i=_.extend({builderType:"",dialog:null},i),this.$el.addClass("so-visual-styles");var o=this;return s.post(panelsOptions.ajaxurl,{action:"so_panels_style_form",type:e,style:this.model.get("style"),args:JSON.stringify({builderType:i.builderType}),postId:t},function(e){o.$el.html(e),o.setupFields(),o.stylesLoaded=!0,o.trigger("styles_loaded",!_.isEmpty(e)),_.isNull(i.dialog)||i.dialog.trigger("styles_loaded",!_.isEmpty(e))}),this}},attach:function(e){e.append(this.$el)},detach:function(){this.$el.detach()},setupFields:function(){this.$(".style-section-wrapper").each(function(){var e=s(this);e.find(".style-section-head").click(function(t){t.preventDefault(),e.find(".style-section-fields").slideToggle("fast")})}),_.isUndefined(s.fn.wpColorPicker)||(_.isObject(panelsOptions.wpColorPickerOptions.palettes)&&!s.isArray(panelsOptions.wpColorPickerOptions.palettes)&&(panelsOptions.wpColorPickerOptions.palettes=s.map(panelsOptions.wpColorPickerOptions.palettes,function(e){return e})),this.$(".so-wp-color-field").wpColorPicker(panelsOptions.wpColorPickerOptions)),this.$(".style-field-image").each(function(){var e=null,t=s(this);t.find(".so-image-selector").click(function(i){i.preventDefault(),null===e&&(e=wp.media({title:"choose",library:{type:"image"},button:{text:"Done",close:!0}}),e.on("select",function(){var i=e.state().get("selection").first().attributes,s=i.url;if(!_.isUndefined(i.sizes))try{s=i.sizes.thumbnail.url}catch(o){s=i.sizes.full.url}t.find(".current-image").css("background-image","url("+s+")"),t.find("input").val(i.id)})),e.open()}),t.find(".remove-image").click(function(e){e.preventDefault(),t.find(".current-image").css("background-image","none"),t.find("input").val("")})}),this.$(".style-field-measurement").each(function(){var e=s(this),t=e.find('input[type="text"]'),i=e.find("select"),o=e.find('input[type="hidden"]');t.focus(function(){s(this).select()});var l=function(e){if(""!==e){var l=/(?:([0-9\.,]+)(.*))+/,n=o.val().split(" "),a=[];for(var r in n){var d=l.exec(n[r]);_.isNull(d)||_.isUndefined(d[1])||_.isUndefined(d[2])||(a.push(d[1]),i.val(d[2]))}1===t.length?t.val(a.join(" ")):(1===a.length?a=[a[0],a[0],a[0],a[0]]:2===a.length?a=[a[0],a[1],a[0],a[1]]:3===a.length&&(a=[a[0],a[1],a[2],a[1]]),t.each(function(e,t){s(t).val(a[e])}))}};l(o.val());var n=function(e){if(1===t.length){var l=t.val().split(" ").filter(function(e){return""!==e}).map(function(e){return e+i.val()}).join(" ");o.val(l)}else{var n=s(e.target),a=[],r=[],d=[];t.each(function(e,t){var i=""!==s(t).val()?parseFloat(s(t).val()):null;a.push(i),null===i?r.push(e):d.push(e)}),3===r.length&&d[0]===t.index(n)&&(t.val(n.val()),a=[n.val(),n.val(),n.val(),n.val()]),JSON.stringify(a)===JSON.stringify([null,null,null,null])?o.val(""):o.val(a.map(function(e){return(null===e?0:e)+i.val()}).join(" "))}};t.change(n),i.change(n)})}})},{}],25:[function(e,t,i){var s=window.panels,o=jQuery;t.exports=Backbone.View.extend({template:_.template(o("#siteorigin-panels-builder-widget").html().panelsProcessTemplate()),cell:null,dialog:null,events:{"click .widget-edit":"editHandler","click .title h4":"titleClickHandler","click .actions .widget-duplicate":"duplicateHandler","click .actions .widget-delete":"deleteHandler"},initialize:function(){this.model.on("user_edit",this.editHandler,this),this.model.on("user_duplicate",this.duplicateHandler,this),this.model.on("destroy",this.onModelDestroy,this),this.model.on("visual_destroy",this.visualDestroyModel,this),this.model.on("change:values",this.onModelChange,this)},render:function(e){if(e=_.extend({loadForm:!1},e),this.setElement(this.template({title:this.model.getWidgetField("title"),description:this.model.getTitle()})),this.$el.data("view",this),(!this.cell.row.builder.supports("editWidget")||this.model.get("read_only"))&&(this.$(".actions .widget-edit").remove(),this.$el.addClass("so-widget-no-edit")),this.cell.row.builder.supports("addWidget")||(this.$(".actions .widget-duplicate").remove(),this.$el.addClass("so-widget-no-duplicate")),this.cell.row.builder.supports("deleteWidget")||(this.$(".actions .widget-delete").remove(),this.$el.addClass("so-widget-no-delete")),this.cell.row.builder.supports("moveWidget")||this.$el.addClass("so-widget-no-move"),o.trim(this.$(".actions").html()).length||this.$(".actions").remove(),this.model.get("read_only")&&this.$el.addClass("so-widget-read-only"),0===_.size(this.model.get("values"))||e.loadForm){var t=this.getEditDialog();t.once("form_loaded",t.saveWidget,t),t.setupDialog()}return this},visualCreate:function(){this.$el.hide().fadeIn("fast")},getEditDialog:function(){return null===this.dialog&&(this.dialog=new s.dialog.widget({model:this.model}),this.dialog.setBuilder(this.cell.row.builder),this.dialog.widgetView=this),this.dialog},editHandler:function(){return this.getEditDialog().openDialog(),this},titleClickHandler:function(){return!this.cell.row.builder.supports("editWidget")||this.model.get("read_only")?this:(this.editHandler(),this)},duplicateHandler:function(){this.cell.row.builder.addHistoryEntry("widget_duplicated");var e=this.model.clone(this.model.cell);return this.cell.model.widgets.add(e,{at:this.model.collection.indexOf(this.model)+1}),this.cell.row.builder.model.refreshPanelsData(),this},deleteHandler:function(){return this.model.trigger("visual_destroy"),this},onModelChange:function(){this.$(".description").html(this.model.getTitle())},onModelDestroy:function(){this.remove()},visualDestroyModel:function(){this.cell.row.builder.addHistoryEntry("widget_deleted");var e=this;return this.$el.fadeOut("fast",function(){e.cell.row.resize(),e.model.destroy(),e.cell.row.builder.model.refreshPanelsData(),e.remove()}),this},buildContextualMenu:function(e,t){var i=this;this.cell.row.builder.supports("addWidget")&&t.addSection({sectionTitle:panelsOptions.loc.contextual.add_widget_below,searchPlaceholder:panelsOptions.loc.contextual.search_widgets,defaultDisplay:panelsOptions.contextual.default_widgets},panelsOptions.widgets,function(e){i.cell.row.builder.addHistoryEntry("widget_added");var t=new s.model.widget({"class":e});t.cell=i.cell.model,i.cell.model.widgets.add(t,{at:i.model.collection.indexOf(i.model)+1}),i.cell.row.builder.model.refreshPanelsData()});var o={};this.cell.row.builder.supports("editWidget")&&!this.model.get("read_only")&&(o.edit={title:panelsOptions.loc.contextual.widget_edit}),this.cell.row.builder.supports("addWidget")&&(o.duplicate={title:panelsOptions.loc.contextual.widget_duplicate}),this.cell.row.builder.supports("deleteWidget")&&(o["delete"]={title:panelsOptions.loc.contextual.widget_delete,confirm:!0}),_.isEmpty(o)||t.addSection({sectionTitle:panelsOptions.loc.contextual.widget_actions,search:!1},o,function(e){switch(e){case"edit":i.editHandler();break;case"duplicate":i.duplicateHandler();break;case"delete":i.visualDestroyModel()}i.cell.row.builder.model.refreshPanelsData()}),this.cell.row.buildContextualMenu(e,t)}})},{}]},{},[12]);
js/siteorigin-parallax.js CHANGED
@@ -137,6 +137,10 @@
137
  $( window ).on( 'resize', setupParallax );
138
  $( window ).on( 'panelsStretchRows', setupParallax );
139
  $$.on( 'refreshParallax', setupParallax );
 
 
 
 
140
  };
141
 
142
  }( jQuery ) );
137
  $( window ).on( 'resize', setupParallax );
138
  $( window ).on( 'panelsStretchRows', setupParallax );
139
  $$.on( 'refreshParallax', setupParallax );
140
+ // Ensure that the parallax has run on inital load.
141
+ setTimeout( function () {
142
+ setupParallax();
143
+ }, 100 );
144
  };
145
 
146
  }( jQuery ) );
js/siteorigin-parallax.min.js CHANGED
@@ -1 +1 @@
1
- !function(i){i.fn.siteOriginParallax=function(a){var o=i(this);if("refreshParallax"===a)return o.trigger("refreshParallax");a=i.extend({backgroundUrl:null,backgroundSize:null,backgroundAspectRatio:null,backgroundSizing:"scaled",limitMotion:"auto"},a),null===a.backgroundAspectRatio&&(a.backgroundAspectRatio=a.backgroundSize[0]/a.backgroundSize[1]);var n=function(){try{var n=[o.outerWidth(),o.outerHeight()],r=o[0].getBoundingClientRect(),t=i(window).outerHeight();void 0===o.data("siteorigin-parallax-init")&&o.css({"background-image":"url("+a.backgroundUrl+")"});var e;e="auto"===a.limitMotion?720>t?.55:t>1300?.45:-17e-5*(t-720)+.55:parseFloat(a.limitMotion);var c=(r.bottom+(r.top-t))/(t+r.height),s=(c-1)/-2,l=0,u=1,g=a.backgroundSize;if("scaled"===a.backgroundSizing){var d=n[1]/(e?e:1),b=n[0]/g[0];if(d>g[1]*b&&(b=d/g[1],e=!1),o.css("background-size",g[0]*b+"px "+g[1]*b+"px"),r.top>-n[1]&&r.bottom-t<n[1]){var k=g[1]*b;e&&k>t*e&&(u=t*e/k,s=s*u+(1-u)/2),l=-(k-n[1])*s}o.css("background-position","50% "+l+"px")}else"original"===a.backgroundSizing&&(e&&g[1]>t*e&&(u=t*e/g[1],s=s*u+(1-u)/2),l=-(g[1]-n[1])*s,o.css("background-size","auto"),o.css("background-position","50% "+l+"px"))}catch(p){console.log(p.message),o.css({"background-size":"scaled"===a.backgroundSizing?"cover":"auto","background-position":"50% 50%"})}};n(),i(window).on("scroll",n),i(window).on("resize",n),i(window).on("panelsStretchRows",n),o.on("refreshParallax",n)}}(jQuery),jQuery(function(i){i("[data-siteorigin-parallax]").each(function(){i(this).siteOriginParallax(i(this).data("siteorigin-parallax"))})});
1
+ !function(i){i.fn.siteOriginParallax=function(o){var a=i(this);if("refreshParallax"===o)return a.trigger("refreshParallax");o=i.extend({backgroundUrl:null,backgroundSize:null,backgroundAspectRatio:null,backgroundSizing:"scaled",limitMotion:"auto"},o),null===o.backgroundAspectRatio&&(o.backgroundAspectRatio=o.backgroundSize[0]/o.backgroundSize[1]);var n=function(){try{var n=[a.outerWidth(),a.outerHeight()],r=a[0].getBoundingClientRect(),t=i(window).outerHeight();void 0===a.data("siteorigin-parallax-init")&&a.css({"background-image":"url("+o.backgroundUrl+")"});var e;e="auto"===o.limitMotion?720>t?.55:t>1300?.45:-17e-5*(t-720)+.55:parseFloat(o.limitMotion);var c=(r.bottom+(r.top-t))/(t+r.height),s=(c-1)/-2,u=0,l=1,g=o.backgroundSize;if("scaled"===o.backgroundSizing){var d=n[1]/(e?e:1),b=n[0]/g[0];if(d>g[1]*b&&(b=d/g[1],e=!1),a.css("background-size",g[0]*b+"px "+g[1]*b+"px"),r.top>-n[1]&&r.bottom-t<n[1]){var k=g[1]*b;e&&k>t*e&&(l=t*e/k,s=s*l+(1-l)/2),u=-(k-n[1])*s}a.css("background-position","50% "+u+"px")}else"original"===o.backgroundSizing&&(e&&g[1]>t*e&&(l=t*e/g[1],s=s*l+(1-l)/2),u=-(g[1]-n[1])*s,a.css("background-size","auto"),a.css("background-position","50% "+u+"px"))}catch(p){console.log(p.message),a.css({"background-size":"scaled"===o.backgroundSizing?"cover":"auto","background-position":"50% 50%"})}};n(),i(window).on("scroll",n),i(window).on("resize",n),i(window).on("panelsStretchRows",n),a.on("refreshParallax",n),setTimeout(function(){n()},100)}}(jQuery),jQuery(function(i){i("[data-siteorigin-parallax]").each(function(){i(this).siteOriginParallax(i(this).data("siteorigin-parallax"))})});
js/styling-24.js CHANGED
@@ -51,14 +51,4 @@ jQuery( function ( $ ) {
51
  $( window ).resize( stretchFullWidthRows );
52
  stretchFullWidthRows();
53
 
54
- if ( typeof $.stellar !== 'undefined' ) {
55
- // Setup parallax after a small timeout to allow full width to take effect
56
- setTimeout( function () {
57
- $.stellar( {
58
- horizontalScrolling: false,
59
- responsive: true
60
- } );
61
- }, 100 );
62
- }
63
-
64
  } );
51
  $( window ).resize( stretchFullWidthRows );
52
  stretchFullWidthRows();
53
 
 
 
 
 
 
 
 
 
 
 
54
  } );
js/styling-24.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function(t){var e=t(panelsStyles.fullContainer);0===e.length&&(e=t("body"));var r=function(){t(".siteorigin-panels-stretch.panel-row-style").each(function(){var r=t(this);r.css({"margin-left":0,"margin-right":0,"padding-left":0,"padding-right":0});var i=r.offset().left-e.offset().left,n=e.outerWidth()-i-r.parent().outerWidth();r.css({"margin-left":-i,"margin-right":-n,"padding-left":"full"===r.data("stretch-type")?i:0,"padding-right":"full"===r.data("stretch-type")?n:0});var l=r.find("> .panel-grid-cell");"full-stretched"===r.data("stretch-type")&&1===l.length&&l.css({"padding-left":0,"padding-right":0}),r.css({"border-left":0,"border-right":0})}),t(".siteorigin-panels-stretch.panel-row-style").length&&t(window).trigger("panelsStretchRows")};t(window).resize(r),r(),"undefined"!=typeof t.stellar&&setTimeout(function(){t.stellar({horizontalScrolling:!1,responsive:!0})},100)});
1
+ jQuery(function(t){var e=t(panelsStyles.fullContainer);0===e.length&&(e=t("body"));var r=function(){t(".siteorigin-panels-stretch.panel-row-style").each(function(){var r=t(this);r.css({"margin-left":0,"margin-right":0,"padding-left":0,"padding-right":0});var i=r.offset().left-e.offset().left,n=e.outerWidth()-i-r.parent().outerWidth();r.css({"margin-left":-i,"margin-right":-n,"padding-left":"full"===r.data("stretch-type")?i:0,"padding-right":"full"===r.data("stretch-type")?n:0});var a=r.find("> .panel-grid-cell");"full-stretched"===r.data("stretch-type")&&1===a.length&&a.css({"padding-left":0,"padding-right":0}),r.css({"border-left":0,"border-right":0})}),t(".siteorigin-panels-stretch.panel-row-style").length&&t(window).trigger("panelsStretchRows")};t(window).resize(r),r()});
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Tags: page builder, responsive, widget, widgets, builder, page, admin, gallery, content, cms, pages, post, css, layout, grid
3
  Requires at least: 4.0
4
  Tested up to: 4.6
5
- Stable tag: 2.4.16
6
- Build time: 2016-09-27T10:01:13+02:00
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl.html
9
  Donate link: http://siteorigin.com/page-builder/#donate
@@ -96,6 +96,12 @@ We've tried to ensure that Page Builder is compatible with most plugin widgets.
96
 
97
  == Changelog ==
98
 
 
 
 
 
 
 
99
  = 2.4.16 - 27 September 2016 =
100
  * Added disableable upgrade notice.
101
 
2
  Tags: page builder, responsive, widget, widgets, builder, page, admin, gallery, content, cms, pages, post, css, layout, grid
3
  Requires at least: 4.0
4
  Tested up to: 4.6
5
+ Stable tag: 2.4.17
6
+ Build time: 2016-10-17T10:13:15+02:00
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl.html
9
  Donate link: http://siteorigin.com/page-builder/#donate
96
 
97
  == Changelog ==
98
 
99
+ = 2.4.17 - 14 October 2016 =
100
+ * Removed old Stellar JS library.
101
+ * Added parallax setup after small timeout.
102
+ * Added way to add affiliate ID.
103
+ * Added tips signup link.
104
+
105
  = 2.4.16 - 27 September 2016 =
106
  * Added disableable upgrade notice.
107
 
siteorigin-panels.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Page Builder by SiteOrigin
4
  Plugin URI: https://siteorigin.com/page-builder/
5
  Description: A drag and drop, responsive page builder that simplifies building your website.
6
- Version: 2.4.16
7
  Author: SiteOrigin
8
  Author URI: https://siteorigin.com
9
  License: GPL3
@@ -11,7 +11,7 @@ License URI: http://www.gnu.org/licenses/gpl.html
11
  Donate link: http://siteorigin.com/page-builder/#donate
12
  */
13
 
14
- define('SITEORIGIN_PANELS_VERSION', '2.4.16');
15
  if ( ! defined('SITEORIGIN_PANELS_JS_SUFFIX' ) ) {
16
  define('SITEORIGIN_PANELS_JS_SUFFIX', '.min');
17
  }
@@ -1610,12 +1610,23 @@ function siteorigin_panels_process_panels_data( $panels_data ){
1610
  }
1611
  add_filter( 'siteorigin_panels_data', 'siteorigin_panels_process_panels_data', 5 );
1612
 
1613
- function siteorigin_premium_display_teaser(){
1614
  return
1615
  siteorigin_panels_setting( 'display-teaser' ) &&
1616
  apply_filters( 'siteorigin_premium_upgrade_teaser', true ) &&
1617
  ! defined( 'SITEORIGIN_PREMIUM_VERSION' );
1618
  }
1619
 
 
 
 
 
 
 
 
 
 
 
 
1620
  // Include the live editor file if we're in live editor mode.
1621
  if( !empty($_GET['siteorigin_panels_live_editor']) ) require_once plugin_dir_path(__FILE__) . 'inc/live-editor.php';
3
  Plugin Name: Page Builder by SiteOrigin
4
  Plugin URI: https://siteorigin.com/page-builder/
5
  Description: A drag and drop, responsive page builder that simplifies building your website.
6
+ Version: 2.4.17
7
  Author: SiteOrigin
8
  Author URI: https://siteorigin.com
9
  License: GPL3
11
  Donate link: http://siteorigin.com/page-builder/#donate
12
  */
13
 
14
+ define('SITEORIGIN_PANELS_VERSION', '2.4.17');
15
  if ( ! defined('SITEORIGIN_PANELS_JS_SUFFIX' ) ) {
16
  define('SITEORIGIN_PANELS_JS_SUFFIX', '.min');
17
  }
1610
  }
1611
  add_filter( 'siteorigin_panels_data', 'siteorigin_panels_process_panels_data', 5 );
1612
 
1613
+ function siteorigin_panels_display_premium_teaser(){
1614
  return
1615
  siteorigin_panels_setting( 'display-teaser' ) &&
1616
  apply_filters( 'siteorigin_premium_upgrade_teaser', true ) &&
1617
  ! defined( 'SITEORIGIN_PREMIUM_VERSION' );
1618
  }
1619
 
1620
+ function siteorigin_panels_premium_url() {
1621
+ $ref = apply_filters( 'siteorigin_premium_affiliate_id', '' );
1622
+ $url = 'https://siteorigin.com/downloads/premium/?featured_plugin=siteorigin-panels';
1623
+
1624
+ if( $ref ) {
1625
+ $url = add_query_arg( 'ref', urlencode( $ref ), $url );
1626
+ }
1627
+
1628
+ return $url;
1629
+ }
1630
+
1631
  // Include the live editor file if we're in live editor mode.
1632
  if( !empty($_GET['siteorigin_panels_live_editor']) ) require_once plugin_dir_path(__FILE__) . 'inc/live-editor.php';
tpl/js-templates.php CHANGED
@@ -38,10 +38,10 @@ $layouts = apply_filters( 'siteorigin_panels_prebuilt_layouts', array() );
38
 
39
  <?php endif; ?>
40
 
41
- <?php if( siteorigin_premium_display_teaser() ) : ?>
42
- <a class="so-tool-button so-siteorigin-premium" title="<?php esc_attr_e( 'SiteOrigin Premium', 'siteorigin-panels' ) ?>" href="https://siteorigin.com/downloads/premium/?featured_plugin=siteorigin-panels" target="_blank">
43
  <span class="so-panels-icon so-panels-icon-plus"></span>
44
- <span class="so-button-text"><?php esc_html_e('Upgrade', 'siteorigin-panels') ?></span>
45
  </a>
46
  <?php endif; ?>
47
 
@@ -74,6 +74,20 @@ $layouts = apply_filters( 'siteorigin_panels_prebuilt_layouts', array() );
74
  );
75
  ?>
76
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  </div>
78
 
79
  </div>
38
 
39
  <?php endif; ?>
40
 
41
+ <?php if( siteorigin_panels_display_premium_teaser() ) : ?>
42
+ <a class="so-tool-button so-siteorigin-premium" title="<?php esc_attr_e( 'SiteOrigin Premium', 'siteorigin-panels' ) ?>" href="<?php echo esc_url( siteorigin_panels_premium_url() ) ?>" target="_blank">
43
  <span class="so-panels-icon so-panels-icon-plus"></span>
44
+ <span class="so-button-text"><?php esc_html_e('Addons', 'siteorigin-panels') ?></span>
45
  </a>
46
  <?php endif; ?>
47
 
74
  );
75
  ?>
76
  </div>
77
+ <div class="so-tip-wrapper">
78
+ <strong><?php _e( 'Pro Tip', 'siteorigin-panels' ) ?>: </strong>
79
+ <?php
80
+ $user = wp_get_current_user();
81
+ $user->user_email;
82
+ $signup_email = add_query_arg( array(
83
+ 'email' => $user->user_email,
84
+ 'name' => $user->first_name,
85
+ ), 'https://siteorigin.com/wp-admin/admin-ajax.php?action=course_signup_form&course=300cd058f8' );
86
+ ?>
87
+ <a href="<?php echo esc_url( $signup_email ) ?>">
88
+ <?php _e( '12 tips every Page Builder user should know.', 'siteorigin-panels' ) ?>
89
+ </a>
90
+ </div>
91
  </div>
92
 
93
  </div>