Version Description
- May 13 2016 =
- Reverted Wordfence fix from 2.4.7 - it raised other issues.
Download this release
Release Info
Developer | gpriday |
Plugin | Page Builder by SiteOrigin |
Version | 2.4.8 |
Comparing to | |
See all releases |
Code changes from version 2.4.6 to 2.4.8
- changelog.txt +0 -173
- css/admin.css +81 -32
- css/live-editor-preview.css +744 -0
- inc/admin-actions.php +13 -2
- inc/default-styles.php +19 -15
- inc/sidebars-emulator.php +2 -2
- inc/styles.php +4 -2
- js/siteorigin-panels-24.js +439 -220
- js/siteorigin-panels-24.min.js +3 -3
- js/siteorigin-parallax.js +142 -0
- js/siteorigin-parallax.min.js +1 -0
- readme.txt +191 -68
- siteorigin-panels.php +43 -9
- tpl/admin-home-page.php +15 -3
- tpl/js-templates.php +2 -2
- tpl/live-editor-preview.php +38 -0
- tpl/metabox-panels.php +9 -1
- widgets/basic.php +1 -1
changelog.txt
DELETED
@@ -1,173 +0,0 @@
|
|
1 |
-
== Changelog ==
|
2 |
-
|
3 |
-
= 2.4.6 - April 13 2016 =
|
4 |
-
* Fixed Javascript errors with layout builder widget.
|
5 |
-
|
6 |
-
= 2.4.5 - April 13 2016 =
|
7 |
-
* Only trigger contextual menu for topmost dialog.
|
8 |
-
* Improved design of Live Editor preview.
|
9 |
-
* Added Live Editor link in the admin menu bar.
|
10 |
-
|
11 |
-
= 2.4.4 - April 6 2016 =
|
12 |
-
* Fixed ordering of new rows, widgets and cells in builder interface.
|
13 |
-
* Fixed Layout Builder widget sanitization error. Was causing fatal error on older versions of PHP.
|
14 |
-
|
15 |
-
= 2.4.3 - April 6 2016 =
|
16 |
-
* Fixed measurement style fields.
|
17 |
-
* Properly process raw widgets in Live Editor.
|
18 |
-
* Remove empty widgets from raw widget processing.
|
19 |
-
|
20 |
-
= 2.4.2 - April 4 2016 =
|
21 |
-
* Improved error handling and reporting.
|
22 |
-
* Don't add widget class for TwentySixteen theme.
|
23 |
-
|
24 |
-
= 2.4.1 - April 2 2016 =
|
25 |
-
* Fixed: Copying content from standard editor to Page Builder
|
26 |
-
* Fixed: Plugin conflict with Jetpack Widget Visibility and other plugins.
|
27 |
-
|
28 |
-
= 2.4 - April 1 2016 =
|
29 |
-
* Created new Live Editor.
|
30 |
-
* Changes to Page Builder admin HTML structure for Live Editor.
|
31 |
-
* New layout for prebuilt dialog.
|
32 |
-
* Now possible to append, prepend and replace layouts in prebuilt dialog.
|
33 |
-
* Fixed contextual menu in Layout Builder widget.
|
34 |
-
* Added row/widget actions to contextual menu.
|
35 |
-
* Clarified functionality of "Switch to Editor" button by renaming to "Revert to Editor".
|
36 |
-
* refreshPanelsData function is called more consistently.
|
37 |
-
* Various background performance enhancements.
|
38 |
-
* Full JS code refactoring.
|
39 |
-
* Fixed cell bottom margins with reverse collapse order.
|
40 |
-
* Improved window scroll locking for dialogs.
|
41 |
-
* Added `in_widget_form` action when rendering widget forms
|
42 |
-
* Custom home page now saves revisions.
|
43 |
-
|
44 |
-
= 2.3.2 - March 11 2016 =
|
45 |
-
* Fixed compatibility with WordPress 4.5
|
46 |
-
|
47 |
-
= 2.3.1 - February 10 2016 =
|
48 |
-
* Fixed fatal error on RTL sites.
|
49 |
-
* Made setting to enable tablet layout. Disabled by default.
|
50 |
-
|
51 |
-
= 2.3 - February 10 2016 =
|
52 |
-
* Delete preview panels data if there are no widgets.
|
53 |
-
* Added a collapse order field.
|
54 |
-
* Added custom row ID field.
|
55 |
-
* Fixed copy content setting.
|
56 |
-
* Added tablet responsive level.
|
57 |
-
* Fixed admin templates.
|
58 |
-
* Fix to ensure live editor works with HTTPs admin requests.
|
59 |
-
* Fix for Yoast SEO compatibility.
|
60 |
-
* Removed use of filter_input for HHVM issues.
|
61 |
-
* Added panelsStretchRows event after frontend row stretch event.
|
62 |
-
* Minor performance enhancements.
|
63 |
-
* Merged all separate JS files into a single Browserify compiled file.
|
64 |
-
* Added version numbers to some JS files to ensure cache busting.
|
65 |
-
|
66 |
-
= 2.2.2 - December 09 2015 =
|
67 |
-
* Fix tab name for WordPress 4.4. Was displaying undefined.
|
68 |
-
* Fix to ensure siteorigin-panels class is added to Page Builder pages.
|
69 |
-
|
70 |
-
= 2.2.1 - October 22 2015 =
|
71 |
-
* Various fixes to widget class names.
|
72 |
-
* Added option to remove default `widget` class from Page Builder widgets.
|
73 |
-
* Added action to saving home page.
|
74 |
-
* Added support for defaults in widget and row styles.
|
75 |
-
* Improve check for the homepage in sidebars simulator.
|
76 |
-
* Changed parallax library to improve theme compatibility.
|
77 |
-
* List privately published posts and pages under the prebuilt layout dialog Clone options.
|
78 |
-
|
79 |
-
= 2.2 - September 7 2015 =
|
80 |
-
* Added prebuilt layout directory.
|
81 |
-
* Added contextual menu for quick actions.
|
82 |
-
* Added parallax background images.
|
83 |
-
* Properly handle missing widgets when saving forms.
|
84 |
-
* Don't revert to default page template when using custom home page interface.
|
85 |
-
* Various minor bug fixes and improvements.
|
86 |
-
|
87 |
-
= 2.1.5 - August 19 2015 =
|
88 |
-
* Fixed handling of checkboxes and array fields.
|
89 |
-
* Properly position Page Builder tab in WordPress 4.3.
|
90 |
-
|
91 |
-
= 2.1.4 =
|
92 |
-
* Fixed handling of raw forms.
|
93 |
-
|
94 |
-
= 2.1.3 =
|
95 |
-
* Removed use of filter_input for compatibility with HHVM
|
96 |
-
* Fixed checkbox handling in forms.
|
97 |
-
* Removed unnecessary sprintf calls to lower chance of translations causing issues.
|
98 |
-
* More generic handling of builder instances to allow them to be used in different places.
|
99 |
-
* Use implicit check for whether editor is undefined or null.
|
100 |
-
* Added optional $widget_id parameter to siteorigin_panels_render_form.
|
101 |
-
* Improved checking for home page in sidebars emulator.
|
102 |
-
* Added a builder "type" to allow more targetted instances.
|
103 |
-
|
104 |
-
= 2.1.2 =
|
105 |
-
* Removed rendered content cache introduced in 2.1.1
|
106 |
-
|
107 |
-
= 2.1.1 =
|
108 |
-
* Added translations for 16 additional languages
|
109 |
-
* Modified strings to improve translatability.
|
110 |
-
* Row and Widget style measurement fields now allow multiple values.
|
111 |
-
* New rows now added below row of currently selected cell.
|
112 |
-
* Orphaned widgets in edited rows are now moved into remaining cell.
|
113 |
-
* Made panels javascript object globally accessible.
|
114 |
-
* panels_info array now passed into widget rendering function.
|
115 |
-
* Removed unnecessary action triggers from customizer that was breaking some themes.
|
116 |
-
* Disabling Page Builder on a page now properly creates history entry.
|
117 |
-
* Small fixes to sidebars emulator.
|
118 |
-
* Fixed import/export on custom home page interface.
|
119 |
-
* Removed call to filter_input from global space.
|
120 |
-
* Fixed bundled widgets conflict with Yoast SEO.
|
121 |
-
* Prevented double rendering issue with Yoast SEO.
|
122 |
-
|
123 |
-
= 2.1 =
|
124 |
-
* Improved Page Builder settings page.
|
125 |
-
* Added sidebar emulation, which makes a Page Builder page appear to be a sidebar. Improves compatibility with other widgets.
|
126 |
-
* Removed jPlayer. Self hosted widget (legacy) now uses MediaElement.
|
127 |
-
* Small usability improvements.
|
128 |
-
* Added legacy widget migration for gallery widget.
|
129 |
-
* Layout file based import/export feature.
|
130 |
-
* Added widget title setting to change widget title HTML.
|
131 |
-
* Added setting to control full width container.
|
132 |
-
* Fixed: Handling of namespaced widgets.
|
133 |
-
* Fixed: Layout Builder widget now works in the Customizer.
|
134 |
-
* Fixed: Custom home page interface now properly uses page_on_front.
|
135 |
-
* Fixed: Page URL for home page in custom home page.
|
136 |
-
* Fixed: Custom home page encoding.
|
137 |
-
|
138 |
-
= 2.0.7 =
|
139 |
-
* Fixed issue that prevented prebuilt layouts from showing up.
|
140 |
-
|
141 |
-
= 2.0.6 =
|
142 |
-
* Added nonce to all admin requests.
|
143 |
-
* Fixed live editor for missing widgets.
|
144 |
-
* Fixed handling of multi-line row/widget custom CSS.
|
145 |
-
* Fixed issue with encoding of panels_data.
|
146 |
-
|
147 |
-
= 2.0.5 =
|
148 |
-
* Added proper escaping in widget form.
|
149 |
-
|
150 |
-
= 2.0.4 =
|
151 |
-
* Changed how data is json encoded to prevent malformed Page Builder data.
|
152 |
-
* Fixed import/export.
|
153 |
-
* Added layout widget notification (doesn't work in customizer).
|
154 |
-
* Fixed translation domains.
|
155 |
-
* Additional hooks and filters.
|
156 |
-
|
157 |
-
= 2.0.3 =
|
158 |
-
* Fixed issue with double calling sidebar_admin_setup that was breaking some widgets.
|
159 |
-
* Fixed fetching content from TinyMCE in text mode.
|
160 |
-
|
161 |
-
= 2.0.2 =
|
162 |
-
* Fixed fatal error in validation for PHP < 5.5
|
163 |
-
|
164 |
-
= 2.0.1 =
|
165 |
-
* Fixed issue with preview causing content loss in standard editor.
|
166 |
-
* Fixed issue with Black Studio TinyMCE
|
167 |
-
* Changed templating tags in js-templates.php to prevent fatal errors with some server configurations.
|
168 |
-
|
169 |
-
= 2.0 =
|
170 |
-
* Complete rewrite of Page Builder Javascript using Backbone.
|
171 |
-
* Complete UI redesign.
|
172 |
-
* Grid Engine rewrite for more efficient CSS.
|
173 |
-
* Various performance enhancements and bug fixes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
css/admin.css
CHANGED
@@ -271,6 +271,9 @@
|
|
271 |
-moz-box-shadow: 0 1px 2px rgba(0,0,0,0.075);
|
272 |
box-shadow: 0 1px 2px rgba(0,0,0,0.075);
|
273 |
}
|
|
|
|
|
|
|
274 |
.siteorigin-panels-builder .so-rows-container .so-row-container .so-cells .cell .widgets-container .so-widget:hover {
|
275 |
border: 1px solid #93a7ad;
|
276 |
background: #fff;
|
@@ -278,22 +281,6 @@
|
|
278 |
-moz-box-shadow: 0 2px 2px rgba(0,0,0,0.075);
|
279 |
box-shadow: 0 2px 2px rgba(0,0,0,0.075);
|
280 |
}
|
281 |
-
.siteorigin-panels-builder .so-rows-container .so-row-container .so-cells .cell .widgets-container .so-widget.so-hovered {
|
282 |
-
background: #3a7096;
|
283 |
-
border: 1px solid #39618c;
|
284 |
-
-webkit-box-shadow: 0 2px 2px rgba(0,0,0,0.1);
|
285 |
-
-moz-box-shadow: 0 2px 2px rgba(0,0,0,0.1);
|
286 |
-
box-shadow: 0 2px 2px rgba(0,0,0,0.1);
|
287 |
-
}
|
288 |
-
.siteorigin-panels-builder .so-rows-container .so-row-container .so-cells .cell .widgets-container .so-widget.so-hovered h4,
|
289 |
-
.siteorigin-panels-builder .so-rows-container .so-row-container .so-cells .cell .widgets-container .so-widget.so-hovered span,
|
290 |
-
.siteorigin-panels-builder .so-rows-container .so-row-container .so-cells .cell .widgets-container .so-widget.so-hovered small {
|
291 |
-
color: #fff;
|
292 |
-
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
|
293 |
-
}
|
294 |
-
.siteorigin-panels-builder .so-rows-container .so-row-container .so-cells .cell .widgets-container .so-widget.so-hovered small {
|
295 |
-
color: #eee;
|
296 |
-
}
|
297 |
.siteorigin-panels-builder .so-rows-container .so-row-container .so-cells .cell .widgets-container .so-widget .so-widget-wrapper {
|
298 |
padding: 7px 9px;
|
299 |
overflow: hidden;
|
@@ -318,6 +305,9 @@
|
|
318 |
margin-right: 5px;
|
319 |
font-style: italic;
|
320 |
}
|
|
|
|
|
|
|
321 |
.siteorigin-panels-builder .so-rows-container .so-row-container .so-cells .cell .widgets-container .so-widget .title .actions {
|
322 |
font-size: 12px;
|
323 |
position: absolute;
|
@@ -361,6 +351,36 @@
|
|
361 |
.siteorigin-panels-builder .so-rows-container .so-row-container .so-cells .cell .widgets-container .so-widget .form {
|
362 |
display: none;
|
363 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
364 |
.siteorigin-panels-builder .so-rows-container .so-row-container .so-cells .cell .widgets-container .so-widget-sortable-highlight {
|
365 |
border: 1px solid;
|
366 |
-ms-box-sizing: border-box;
|
@@ -492,6 +512,9 @@
|
|
492 |
-moz-box-shadow: 0 1px 2px rgba(0,0,0,0.075);
|
493 |
box-shadow: 0 1px 2px rgba(0,0,0,0.075);
|
494 |
}
|
|
|
|
|
|
|
495 |
.so-widget.ui-sortable-helper.widget-being-dragged:hover {
|
496 |
border: 1px solid #93a7ad;
|
497 |
background: #fff;
|
@@ -499,22 +522,6 @@
|
|
499 |
-moz-box-shadow: 0 2px 2px rgba(0,0,0,0.075);
|
500 |
box-shadow: 0 2px 2px rgba(0,0,0,0.075);
|
501 |
}
|
502 |
-
.so-widget.ui-sortable-helper.widget-being-dragged.so-hovered {
|
503 |
-
background: #3a7096;
|
504 |
-
border: 1px solid #39618c;
|
505 |
-
-webkit-box-shadow: 0 2px 2px rgba(0,0,0,0.1);
|
506 |
-
-moz-box-shadow: 0 2px 2px rgba(0,0,0,0.1);
|
507 |
-
box-shadow: 0 2px 2px rgba(0,0,0,0.1);
|
508 |
-
}
|
509 |
-
.so-widget.ui-sortable-helper.widget-being-dragged.so-hovered h4,
|
510 |
-
.so-widget.ui-sortable-helper.widget-being-dragged.so-hovered span,
|
511 |
-
.so-widget.ui-sortable-helper.widget-being-dragged.so-hovered small {
|
512 |
-
color: #fff;
|
513 |
-
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
|
514 |
-
}
|
515 |
-
.so-widget.ui-sortable-helper.widget-being-dragged.so-hovered small {
|
516 |
-
color: #eee;
|
517 |
-
}
|
518 |
.so-widget.ui-sortable-helper.widget-being-dragged .so-widget-wrapper {
|
519 |
padding: 7px 9px;
|
520 |
overflow: hidden;
|
@@ -539,6 +546,9 @@
|
|
539 |
margin-right: 5px;
|
540 |
font-style: italic;
|
541 |
}
|
|
|
|
|
|
|
542 |
.so-widget.ui-sortable-helper.widget-being-dragged .title .actions {
|
543 |
font-size: 12px;
|
544 |
position: absolute;
|
@@ -582,6 +592,36 @@
|
|
582 |
.so-widget.ui-sortable-helper.widget-being-dragged .form {
|
583 |
display: none;
|
584 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
585 |
/* Handles displaying a builder in the WordPress widget interface */
|
586 |
.widgets-holder-wrap .widget-inside .siteorigin-panels-builder .so-builder-container {
|
587 |
padding-top: 0;
|
@@ -1526,6 +1566,15 @@
|
|
1526 |
.so-panels-dialog .so-visual-styles .style-field-image .remove-image .remove-image {
|
1527 |
color: #333;
|
1528 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1529 |
.so-panels-dialog .so-visual-styles .so-field-code {
|
1530 |
font-size: 12px;
|
1531 |
font-family: "Courier 10 Pitch", Courier, monospace;
|
271 |
-moz-box-shadow: 0 1px 2px rgba(0,0,0,0.075);
|
272 |
box-shadow: 0 1px 2px rgba(0,0,0,0.075);
|
273 |
}
|
274 |
+
.siteorigin-panels-builder .so-rows-container .so-row-container .so-cells .cell .widgets-container .so-widget.so-widget-no-move {
|
275 |
+
cursor: auto;
|
276 |
+
}
|
277 |
.siteorigin-panels-builder .so-rows-container .so-row-container .so-cells .cell .widgets-container .so-widget:hover {
|
278 |
border: 1px solid #93a7ad;
|
279 |
background: #fff;
|
281 |
-moz-box-shadow: 0 2px 2px rgba(0,0,0,0.075);
|
282 |
box-shadow: 0 2px 2px rgba(0,0,0,0.075);
|
283 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
284 |
.siteorigin-panels-builder .so-rows-container .so-row-container .so-cells .cell .widgets-container .so-widget .so-widget-wrapper {
|
285 |
padding: 7px 9px;
|
286 |
overflow: hidden;
|
305 |
margin-right: 5px;
|
306 |
font-style: italic;
|
307 |
}
|
308 |
+
.siteorigin-panels-builder .so-rows-container .so-row-container .so-cells .cell .widgets-container .so-widget.so-widget-no-edit h4 {
|
309 |
+
cursor: auto;
|
310 |
+
}
|
311 |
.siteorigin-panels-builder .so-rows-container .so-row-container .so-cells .cell .widgets-container .so-widget .title .actions {
|
312 |
font-size: 12px;
|
313 |
position: absolute;
|
351 |
.siteorigin-panels-builder .so-rows-container .so-row-container .so-cells .cell .widgets-container .so-widget .form {
|
352 |
display: none;
|
353 |
}
|
354 |
+
.siteorigin-panels-builder .so-rows-container .so-row-container .so-cells .cell .widgets-container .so-widget.so-widget-read-only,
|
355 |
+
.siteorigin-panels-builder .so-rows-container .so-row-container .so-cells .cell .widgets-container .so-widget.so-widget-read-only:hover {
|
356 |
+
background: #f5f5f5;
|
357 |
+
border: 1px solid #a6bac1;
|
358 |
+
-webkit-box-shadow: none;
|
359 |
+
-moz-box-shadow: none;
|
360 |
+
box-shadow: none;
|
361 |
+
}
|
362 |
+
.siteorigin-panels-builder .so-rows-container .so-row-container .so-cells .cell .widgets-container .so-widget.so-widget-read-only h4,
|
363 |
+
.siteorigin-panels-builder .so-rows-container .so-row-container .so-cells .cell .widgets-container .so-widget.so-widget-read-only:hover h4,
|
364 |
+
.siteorigin-panels-builder .so-rows-container .so-row-container .so-cells .cell .widgets-container .so-widget.so-widget-read-only small,
|
365 |
+
.siteorigin-panels-builder .so-rows-container .so-row-container .so-cells .cell .widgets-container .so-widget.so-widget-read-only:hover small {
|
366 |
+
opacity: 0.5;
|
367 |
+
}
|
368 |
+
.siteorigin-panels-builder .so-rows-container .so-row-container .so-cells .cell .widgets-container .so-widget.so-hovered {
|
369 |
+
background: #3a7096;
|
370 |
+
border: 1px solid #39618c;
|
371 |
+
-webkit-box-shadow: 0 2px 2px rgba(0,0,0,0.1);
|
372 |
+
-moz-box-shadow: 0 2px 2px rgba(0,0,0,0.1);
|
373 |
+
box-shadow: 0 2px 2px rgba(0,0,0,0.1);
|
374 |
+
}
|
375 |
+
.siteorigin-panels-builder .so-rows-container .so-row-container .so-cells .cell .widgets-container .so-widget.so-hovered h4,
|
376 |
+
.siteorigin-panels-builder .so-rows-container .so-row-container .so-cells .cell .widgets-container .so-widget.so-hovered span,
|
377 |
+
.siteorigin-panels-builder .so-rows-container .so-row-container .so-cells .cell .widgets-container .so-widget.so-hovered small {
|
378 |
+
color: #fff;
|
379 |
+
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
|
380 |
+
}
|
381 |
+
.siteorigin-panels-builder .so-rows-container .so-row-container .so-cells .cell .widgets-container .so-widget.so-hovered small {
|
382 |
+
color: #eee;
|
383 |
+
}
|
384 |
.siteorigin-panels-builder .so-rows-container .so-row-container .so-cells .cell .widgets-container .so-widget-sortable-highlight {
|
385 |
border: 1px solid;
|
386 |
-ms-box-sizing: border-box;
|
512 |
-moz-box-shadow: 0 1px 2px rgba(0,0,0,0.075);
|
513 |
box-shadow: 0 1px 2px rgba(0,0,0,0.075);
|
514 |
}
|
515 |
+
.so-widget.ui-sortable-helper.widget-being-dragged.so-widget-no-move {
|
516 |
+
cursor: auto;
|
517 |
+
}
|
518 |
.so-widget.ui-sortable-helper.widget-being-dragged:hover {
|
519 |
border: 1px solid #93a7ad;
|
520 |
background: #fff;
|
522 |
-moz-box-shadow: 0 2px 2px rgba(0,0,0,0.075);
|
523 |
box-shadow: 0 2px 2px rgba(0,0,0,0.075);
|
524 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
525 |
.so-widget.ui-sortable-helper.widget-being-dragged .so-widget-wrapper {
|
526 |
padding: 7px 9px;
|
527 |
overflow: hidden;
|
546 |
margin-right: 5px;
|
547 |
font-style: italic;
|
548 |
}
|
549 |
+
.so-widget.ui-sortable-helper.widget-being-dragged.so-widget-no-edit h4 {
|
550 |
+
cursor: auto;
|
551 |
+
}
|
552 |
.so-widget.ui-sortable-helper.widget-being-dragged .title .actions {
|
553 |
font-size: 12px;
|
554 |
position: absolute;
|
592 |
.so-widget.ui-sortable-helper.widget-being-dragged .form {
|
593 |
display: none;
|
594 |
}
|
595 |
+
.so-widget.ui-sortable-helper.widget-being-dragged.so-widget-read-only,
|
596 |
+
.so-widget.ui-sortable-helper.widget-being-dragged.so-widget-read-only:hover {
|
597 |
+
background: #f5f5f5;
|
598 |
+
border: 1px solid #a6bac1;
|
599 |
+
-webkit-box-shadow: none;
|
600 |
+
-moz-box-shadow: none;
|
601 |
+
box-shadow: none;
|
602 |
+
}
|
603 |
+
.so-widget.ui-sortable-helper.widget-being-dragged.so-widget-read-only h4,
|
604 |
+
.so-widget.ui-sortable-helper.widget-being-dragged.so-widget-read-only:hover h4,
|
605 |
+
.so-widget.ui-sortable-helper.widget-being-dragged.so-widget-read-only small,
|
606 |
+
.so-widget.ui-sortable-helper.widget-being-dragged.so-widget-read-only:hover small {
|
607 |
+
opacity: 0.5;
|
608 |
+
}
|
609 |
+
.so-widget.ui-sortable-helper.widget-being-dragged.so-hovered {
|
610 |
+
background: #3a7096;
|
611 |
+
border: 1px solid #39618c;
|
612 |
+
-webkit-box-shadow: 0 2px 2px rgba(0,0,0,0.1);
|
613 |
+
-moz-box-shadow: 0 2px 2px rgba(0,0,0,0.1);
|
614 |
+
box-shadow: 0 2px 2px rgba(0,0,0,0.1);
|
615 |
+
}
|
616 |
+
.so-widget.ui-sortable-helper.widget-being-dragged.so-hovered h4,
|
617 |
+
.so-widget.ui-sortable-helper.widget-being-dragged.so-hovered span,
|
618 |
+
.so-widget.ui-sortable-helper.widget-being-dragged.so-hovered small {
|
619 |
+
color: #fff;
|
620 |
+
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
|
621 |
+
}
|
622 |
+
.so-widget.ui-sortable-helper.widget-being-dragged.so-hovered small {
|
623 |
+
color: #eee;
|
624 |
+
}
|
625 |
/* Handles displaying a builder in the WordPress widget interface */
|
626 |
.widgets-holder-wrap .widget-inside .siteorigin-panels-builder .so-builder-container {
|
627 |
padding-top: 0;
|
1566 |
.so-panels-dialog .so-visual-styles .style-field-image .remove-image .remove-image {
|
1567 |
color: #333;
|
1568 |
}
|
1569 |
+
.so-panels-dialog .so-visual-styles .style-field-checkbox label {
|
1570 |
+
-webkit-user-select: none;
|
1571 |
+
/* Chrome all / Safari all */
|
1572 |
+
-moz-user-select: none;
|
1573 |
+
/* Firefox all */
|
1574 |
+
-ms-user-select: none;
|
1575 |
+
/* IE 10+ */
|
1576 |
+
user-select: none;
|
1577 |
+
}
|
1578 |
.so-panels-dialog .so-visual-styles .so-field-code {
|
1579 |
font-size: 12px;
|
1580 |
font-family: "Courier 10 Pitch", Courier, monospace;
|
css/live-editor-preview.css
ADDED
@@ -0,0 +1,744 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
Theme Name: layout-viewer
|
3 |
+
|
4 |
+
This theme, like WordPress, is licensed under the GPL.
|
5 |
+
Use it to make something cool, have fun, and share what you've learned with others.
|
6 |
+
|
7 |
+
layout-viewer is based on Underscores http://underscores.me/, (C) 2012-2015 Automattic, Inc.
|
8 |
+
Underscores is distributed under the terms of the GNU GPL v2 or later.
|
9 |
+
|
10 |
+
Normalizing styles have been helped along thanks to the fine work of
|
11 |
+
Nicolas Gallagher and Jonathan Neal http://necolas.github.com/normalize.css/
|
12 |
+
*/
|
13 |
+
/*--------------------------------------------------------------
|
14 |
+
>>> TABLE OF CONTENTS:
|
15 |
+
----------------------------------------------------------------
|
16 |
+
# Normalize
|
17 |
+
# Typography
|
18 |
+
# Elements
|
19 |
+
# Forms
|
20 |
+
# Navigation
|
21 |
+
## Links
|
22 |
+
## Menus
|
23 |
+
# Accessibility
|
24 |
+
# Alignments
|
25 |
+
# Clearings
|
26 |
+
# Widgets
|
27 |
+
# Content
|
28 |
+
## Posts and pages
|
29 |
+
## Asides
|
30 |
+
## Comments
|
31 |
+
# Infinite scroll
|
32 |
+
# Media
|
33 |
+
## Captions
|
34 |
+
## Galleries
|
35 |
+
--------------------------------------------------------------*/
|
36 |
+
/*--------------------------------------------------------------
|
37 |
+
# Normalize
|
38 |
+
--------------------------------------------------------------*/
|
39 |
+
html {
|
40 |
+
font-family: sans-serif;
|
41 |
+
-webkit-text-size-adjust: 100%;
|
42 |
+
-ms-text-size-adjust: 100%;
|
43 |
+
}
|
44 |
+
body {
|
45 |
+
margin: 0;
|
46 |
+
}
|
47 |
+
article,
|
48 |
+
aside,
|
49 |
+
details,
|
50 |
+
figcaption,
|
51 |
+
figure,
|
52 |
+
footer,
|
53 |
+
header,
|
54 |
+
main,
|
55 |
+
menu,
|
56 |
+
nav,
|
57 |
+
section,
|
58 |
+
summary {
|
59 |
+
display: block;
|
60 |
+
}
|
61 |
+
audio,
|
62 |
+
canvas,
|
63 |
+
progress,
|
64 |
+
video {
|
65 |
+
display: inline-block;
|
66 |
+
vertical-align: baseline;
|
67 |
+
}
|
68 |
+
audio:not([controls]) {
|
69 |
+
display: none;
|
70 |
+
height: 0;
|
71 |
+
}
|
72 |
+
[hidden],
|
73 |
+
template {
|
74 |
+
display: none;
|
75 |
+
}
|
76 |
+
a {
|
77 |
+
background-color: transparent;
|
78 |
+
}
|
79 |
+
a:active,
|
80 |
+
a:hover {
|
81 |
+
outline: 0;
|
82 |
+
}
|
83 |
+
abbr[title] {
|
84 |
+
border-bottom: 1px dotted;
|
85 |
+
}
|
86 |
+
b,
|
87 |
+
strong {
|
88 |
+
font-weight: bold;
|
89 |
+
}
|
90 |
+
dfn {
|
91 |
+
font-style: italic;
|
92 |
+
}
|
93 |
+
h1 {
|
94 |
+
font-size: 2em;
|
95 |
+
margin: 0.67em 0;
|
96 |
+
}
|
97 |
+
mark {
|
98 |
+
background: #ff0;
|
99 |
+
color: #000;
|
100 |
+
}
|
101 |
+
small {
|
102 |
+
font-size: 80%;
|
103 |
+
}
|
104 |
+
sub,
|
105 |
+
sup {
|
106 |
+
font-size: 75%;
|
107 |
+
line-height: 0;
|
108 |
+
position: relative;
|
109 |
+
vertical-align: baseline;
|
110 |
+
}
|
111 |
+
sup {
|
112 |
+
top: -0.5em;
|
113 |
+
}
|
114 |
+
sub {
|
115 |
+
bottom: -0.25em;
|
116 |
+
}
|
117 |
+
img {
|
118 |
+
border: 0;
|
119 |
+
}
|
120 |
+
svg:not(:root) {
|
121 |
+
overflow: hidden;
|
122 |
+
}
|
123 |
+
figure {
|
124 |
+
margin: 1em 40px;
|
125 |
+
}
|
126 |
+
hr {
|
127 |
+
box-sizing: content-box;
|
128 |
+
height: 0;
|
129 |
+
}
|
130 |
+
pre {
|
131 |
+
overflow: auto;
|
132 |
+
}
|
133 |
+
code,
|
134 |
+
kbd,
|
135 |
+
pre,
|
136 |
+
samp {
|
137 |
+
font-family: monospace, monospace;
|
138 |
+
font-size: 1em;
|
139 |
+
}
|
140 |
+
button,
|
141 |
+
input,
|
142 |
+
optgroup,
|
143 |
+
select,
|
144 |
+
textarea {
|
145 |
+
color: inherit;
|
146 |
+
font: inherit;
|
147 |
+
margin: 0;
|
148 |
+
}
|
149 |
+
button {
|
150 |
+
overflow: visible;
|
151 |
+
}
|
152 |
+
button,
|
153 |
+
select {
|
154 |
+
text-transform: none;
|
155 |
+
}
|
156 |
+
button,
|
157 |
+
html input[type="button"],
|
158 |
+
input[type="reset"],
|
159 |
+
input[type="submit"] {
|
160 |
+
-webkit-appearance: button;
|
161 |
+
cursor: pointer;
|
162 |
+
}
|
163 |
+
button[disabled],
|
164 |
+
html input[disabled] {
|
165 |
+
cursor: default;
|
166 |
+
}
|
167 |
+
button::-moz-focus-inner,
|
168 |
+
input::-moz-focus-inner {
|
169 |
+
border: 0;
|
170 |
+
padding: 0;
|
171 |
+
}
|
172 |
+
input {
|
173 |
+
line-height: normal;
|
174 |
+
}
|
175 |
+
input[type="checkbox"],
|
176 |
+
input[type="radio"] {
|
177 |
+
box-sizing: border-box;
|
178 |
+
padding: 0;
|
179 |
+
}
|
180 |
+
input[type="number"]::-webkit-inner-spin-button,
|
181 |
+
input[type="number"]::-webkit-outer-spin-button {
|
182 |
+
height: auto;
|
183 |
+
}
|
184 |
+
input[type="search"] {
|
185 |
+
-webkit-appearance: textfield;
|
186 |
+
box-sizing: content-box;
|
187 |
+
}
|
188 |
+
input[type="search"]::-webkit-search-cancel-button,
|
189 |
+
input[type="search"]::-webkit-search-decoration {
|
190 |
+
-webkit-appearance: none;
|
191 |
+
}
|
192 |
+
fieldset {
|
193 |
+
border: 1px solid #c0c0c0;
|
194 |
+
margin: 0 2px;
|
195 |
+
padding: 0.35em 0.625em 0.75em;
|
196 |
+
}
|
197 |
+
legend {
|
198 |
+
border: 0;
|
199 |
+
padding: 0;
|
200 |
+
}
|
201 |
+
textarea {
|
202 |
+
overflow: auto;
|
203 |
+
}
|
204 |
+
optgroup {
|
205 |
+
font-weight: bold;
|
206 |
+
}
|
207 |
+
table {
|
208 |
+
border-collapse: collapse;
|
209 |
+
border-spacing: 0;
|
210 |
+
}
|
211 |
+
td,
|
212 |
+
th {
|
213 |
+
padding: 0;
|
214 |
+
}
|
215 |
+
/*--------------------------------------------------------------
|
216 |
+
# Typography
|
217 |
+
--------------------------------------------------------------*/
|
218 |
+
body,
|
219 |
+
button,
|
220 |
+
input,
|
221 |
+
select,
|
222 |
+
textarea {
|
223 |
+
color: #404040;
|
224 |
+
font-size: 14px;
|
225 |
+
line-height: 1.5;
|
226 |
+
}
|
227 |
+
h1,
|
228 |
+
h2,
|
229 |
+
h3,
|
230 |
+
h4,
|
231 |
+
h5,
|
232 |
+
h6 {
|
233 |
+
clear: both;
|
234 |
+
}
|
235 |
+
p {
|
236 |
+
margin-bottom: 1.5em;
|
237 |
+
}
|
238 |
+
dfn,
|
239 |
+
cite,
|
240 |
+
em,
|
241 |
+
i {
|
242 |
+
font-style: italic;
|
243 |
+
}
|
244 |
+
blockquote {
|
245 |
+
margin: 0 1.5em;
|
246 |
+
}
|
247 |
+
address {
|
248 |
+
margin: 0 0 1.5em;
|
249 |
+
}
|
250 |
+
pre {
|
251 |
+
background: #eee;
|
252 |
+
font-family: "Courier 10 Pitch", Courier, monospace;
|
253 |
+
font-size: 15px;
|
254 |
+
font-size: 0.9375rem;
|
255 |
+
line-height: 1.6;
|
256 |
+
margin-bottom: 1.6em;
|
257 |
+
max-width: 100%;
|
258 |
+
overflow: auto;
|
259 |
+
padding: 1.6em;
|
260 |
+
}
|
261 |
+
code,
|
262 |
+
kbd,
|
263 |
+
tt,
|
264 |
+
var {
|
265 |
+
font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace;
|
266 |
+
font-size: 15px;
|
267 |
+
font-size: 0.9375rem;
|
268 |
+
}
|
269 |
+
abbr,
|
270 |
+
acronym {
|
271 |
+
border-bottom: 1px dotted #666;
|
272 |
+
cursor: help;
|
273 |
+
}
|
274 |
+
mark,
|
275 |
+
ins {
|
276 |
+
background: #fff9c0;
|
277 |
+
text-decoration: none;
|
278 |
+
}
|
279 |
+
big {
|
280 |
+
font-size: 125%;
|
281 |
+
}
|
282 |
+
/*--------------------------------------------------------------
|
283 |
+
# Elements
|
284 |
+
--------------------------------------------------------------*/
|
285 |
+
html {
|
286 |
+
box-sizing: border-box;
|
287 |
+
}
|
288 |
+
*,
|
289 |
+
*:before,
|
290 |
+
*:after {
|
291 |
+
/* Inherit box-sizing to make it easier to change the property for components that leverage other behavior; see http://css-tricks.com/inheriting-box-sizing-probably-slightly-better-best-practice/ */
|
292 |
+
box-sizing: inherit;
|
293 |
+
}
|
294 |
+
body {
|
295 |
+
background: #fff;
|
296 |
+
/* Fallback for when there is no custom background color defined. */
|
297 |
+
}
|
298 |
+
blockquote:before,
|
299 |
+
blockquote:after,
|
300 |
+
q:before,
|
301 |
+
q:after {
|
302 |
+
content: "";
|
303 |
+
}
|
304 |
+
blockquote,
|
305 |
+
q {
|
306 |
+
quotes: "" "";
|
307 |
+
}
|
308 |
+
hr {
|
309 |
+
background-color: #ccc;
|
310 |
+
border: 0;
|
311 |
+
height: 1px;
|
312 |
+
margin-bottom: 1.5em;
|
313 |
+
}
|
314 |
+
ul,
|
315 |
+
ol {
|
316 |
+
margin: 0 0 1.5em 3em;
|
317 |
+
}
|
318 |
+
ul {
|
319 |
+
list-style: disc;
|
320 |
+
}
|
321 |
+
ol {
|
322 |
+
list-style: decimal;
|
323 |
+
}
|
324 |
+
li > ul,
|
325 |
+
li > ol {
|
326 |
+
margin-bottom: 0;
|
327 |
+
margin-left: 1.5em;
|
328 |
+
}
|
329 |
+
dt {
|
330 |
+
font-weight: bold;
|
331 |
+
}
|
332 |
+
dd {
|
333 |
+
margin: 0 1.5em 1.5em;
|
334 |
+
}
|
335 |
+
img {
|
336 |
+
height: auto;
|
337 |
+
/* Make sure images are scaled correctly. */
|
338 |
+
max-width: 100%;
|
339 |
+
/* Adhere to container width. */
|
340 |
+
}
|
341 |
+
table {
|
342 |
+
margin: 0 0 1.5em;
|
343 |
+
width: 100%;
|
344 |
+
}
|
345 |
+
/*--------------------------------------------------------------
|
346 |
+
# Forms
|
347 |
+
--------------------------------------------------------------*/
|
348 |
+
button,
|
349 |
+
input[type="button"],
|
350 |
+
input[type="reset"],
|
351 |
+
input[type="submit"] {
|
352 |
+
border: 1px solid;
|
353 |
+
border-color: #ccc #ccc #bbb;
|
354 |
+
border-radius: 3px;
|
355 |
+
background: #e6e6e6;
|
356 |
+
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), inset 0 15px 17px rgba(255, 255, 255, 0.5), inset 0 -5px 12px rgba(0, 0, 0, 0.05);
|
357 |
+
color: rgba(0, 0, 0, 0.8);
|
358 |
+
font-size: 12px;
|
359 |
+
font-size: 0.75rem;
|
360 |
+
line-height: 1;
|
361 |
+
padding: .6em 1em .4em;
|
362 |
+
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
|
363 |
+
}
|
364 |
+
button:hover,
|
365 |
+
input[type="button"]:hover,
|
366 |
+
input[type="reset"]:hover,
|
367 |
+
input[type="submit"]:hover {
|
368 |
+
border-color: #ccc #bbb #aaa;
|
369 |
+
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), inset 0 15px 17px rgba(255, 255, 255, 0.8), inset 0 -5px 12px rgba(0, 0, 0, 0.02);
|
370 |
+
}
|
371 |
+
button:focus,
|
372 |
+
input[type="button"]:focus,
|
373 |
+
input[type="reset"]:focus,
|
374 |
+
input[type="submit"]:focus,
|
375 |
+
button:active,
|
376 |
+
input[type="button"]:active,
|
377 |
+
input[type="reset"]:active,
|
378 |
+
input[type="submit"]:active {
|
379 |
+
border-color: #aaa #bbb #bbb;
|
380 |
+
box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.5), inset 0 2px 5px rgba(0, 0, 0, 0.15);
|
381 |
+
}
|
382 |
+
input[type="text"],
|
383 |
+
input[type="email"],
|
384 |
+
input[type="url"],
|
385 |
+
input[type="password"],
|
386 |
+
input[type="search"],
|
387 |
+
textarea {
|
388 |
+
color: #666;
|
389 |
+
border: 1px solid #ccc;
|
390 |
+
border-radius: 3px;
|
391 |
+
}
|
392 |
+
input[type="text"]:focus,
|
393 |
+
input[type="email"]:focus,
|
394 |
+
input[type="url"]:focus,
|
395 |
+
input[type="password"]:focus,
|
396 |
+
input[type="search"]:focus,
|
397 |
+
textarea:focus {
|
398 |
+
color: #111;
|
399 |
+
}
|
400 |
+
input[type="text"],
|
401 |
+
input[type="email"],
|
402 |
+
input[type="url"],
|
403 |
+
input[type="password"],
|
404 |
+
input[type="search"] {
|
405 |
+
padding: 3px;
|
406 |
+
}
|
407 |
+
textarea {
|
408 |
+
padding-left: 3px;
|
409 |
+
width: 100%;
|
410 |
+
}
|
411 |
+
/*--------------------------------------------------------------
|
412 |
+
# Navigation
|
413 |
+
--------------------------------------------------------------*/
|
414 |
+
/*--------------------------------------------------------------
|
415 |
+
## Links
|
416 |
+
--------------------------------------------------------------*/
|
417 |
+
a {
|
418 |
+
color: royalblue;
|
419 |
+
}
|
420 |
+
a:visited {
|
421 |
+
color: purple;
|
422 |
+
}
|
423 |
+
a:hover,
|
424 |
+
a:focus,
|
425 |
+
a:active {
|
426 |
+
color: midnightblue;
|
427 |
+
}
|
428 |
+
a:focus {
|
429 |
+
outline: thin dotted;
|
430 |
+
}
|
431 |
+
a:hover,
|
432 |
+
a:active {
|
433 |
+
outline: 0;
|
434 |
+
}
|
435 |
+
/*--------------------------------------------------------------
|
436 |
+
## Menus
|
437 |
+
--------------------------------------------------------------*/
|
438 |
+
.main-navigation {
|
439 |
+
clear: both;
|
440 |
+
display: block;
|
441 |
+
float: left;
|
442 |
+
width: 100%;
|
443 |
+
}
|
444 |
+
.main-navigation ul {
|
445 |
+
display: none;
|
446 |
+
list-style: none;
|
447 |
+
margin: 0;
|
448 |
+
padding-left: 0;
|
449 |
+
}
|
450 |
+
.main-navigation li {
|
451 |
+
float: left;
|
452 |
+
position: relative;
|
453 |
+
}
|
454 |
+
.main-navigation a {
|
455 |
+
display: block;
|
456 |
+
text-decoration: none;
|
457 |
+
}
|
458 |
+
.main-navigation ul ul {
|
459 |
+
box-shadow: 0 3px 3px rgba(0, 0, 0, 0.2);
|
460 |
+
float: left;
|
461 |
+
position: absolute;
|
462 |
+
top: 1.5em;
|
463 |
+
left: -999em;
|
464 |
+
z-index: 99999;
|
465 |
+
}
|
466 |
+
.main-navigation ul ul ul {
|
467 |
+
left: -999em;
|
468 |
+
top: 0;
|
469 |
+
}
|
470 |
+
.main-navigation ul ul a {
|
471 |
+
width: 200px;
|
472 |
+
}
|
473 |
+
.main-navigation ul li:hover > ul,
|
474 |
+
.main-navigation ul li.focus > ul {
|
475 |
+
left: auto;
|
476 |
+
}
|
477 |
+
.main-navigation ul ul li:hover > ul,
|
478 |
+
.main-navigation ul ul li.focus > ul {
|
479 |
+
left: 100%;
|
480 |
+
}
|
481 |
+
/* Small menu. */
|
482 |
+
.menu-toggle,
|
483 |
+
.main-navigation.toggled ul {
|
484 |
+
display: block;
|
485 |
+
}
|
486 |
+
@media screen and (min-width: 37.5em) {
|
487 |
+
.menu-toggle {
|
488 |
+
display: none;
|
489 |
+
}
|
490 |
+
.main-navigation ul {
|
491 |
+
display: block;
|
492 |
+
}
|
493 |
+
}
|
494 |
+
.site-main .comment-navigation,
|
495 |
+
.site-main .posts-navigation,
|
496 |
+
.site-main .post-navigation {
|
497 |
+
margin: 0 0 1.5em;
|
498 |
+
overflow: hidden;
|
499 |
+
}
|
500 |
+
.comment-navigation .nav-previous,
|
501 |
+
.posts-navigation .nav-previous,
|
502 |
+
.post-navigation .nav-previous {
|
503 |
+
float: left;
|
504 |
+
width: 50%;
|
505 |
+
}
|
506 |
+
.comment-navigation .nav-next,
|
507 |
+
.posts-navigation .nav-next,
|
508 |
+
.post-navigation .nav-next {
|
509 |
+
float: right;
|
510 |
+
text-align: right;
|
511 |
+
width: 50%;
|
512 |
+
}
|
513 |
+
/*--------------------------------------------------------------
|
514 |
+
# Accessibility
|
515 |
+
--------------------------------------------------------------*/
|
516 |
+
/* Text meant only for screen readers. */
|
517 |
+
.screen-reader-text {
|
518 |
+
clip: rect(1px, 1px, 1px, 1px);
|
519 |
+
position: absolute !important;
|
520 |
+
height: 1px;
|
521 |
+
width: 1px;
|
522 |
+
overflow: hidden;
|
523 |
+
}
|
524 |
+
.screen-reader-text:focus {
|
525 |
+
background-color: #f1f1f1;
|
526 |
+
border-radius: 3px;
|
527 |
+
box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
|
528 |
+
clip: auto !important;
|
529 |
+
color: #21759b;
|
530 |
+
display: block;
|
531 |
+
font-size: 14px;
|
532 |
+
font-size: 0.875rem;
|
533 |
+
font-weight: bold;
|
534 |
+
height: auto;
|
535 |
+
left: 5px;
|
536 |
+
line-height: normal;
|
537 |
+
padding: 15px 23px 14px;
|
538 |
+
text-decoration: none;
|
539 |
+
top: 5px;
|
540 |
+
width: auto;
|
541 |
+
z-index: 100000;
|
542 |
+
/* Above WP toolbar. */
|
543 |
+
}
|
544 |
+
/*--------------------------------------------------------------
|
545 |
+
# Alignments
|
546 |
+
--------------------------------------------------------------*/
|
547 |
+
.alignleft {
|
548 |
+
display: inline;
|
549 |
+
float: left;
|
550 |
+
margin-right: 1.5em;
|
551 |
+
}
|
552 |
+
.alignright {
|
553 |
+
display: inline;
|
554 |
+
float: right;
|
555 |
+
margin-left: 1.5em;
|
556 |
+
}
|
557 |
+
.aligncenter {
|
558 |
+
clear: both;
|
559 |
+
display: block;
|
560 |
+
margin-left: auto;
|
561 |
+
margin-right: auto;
|
562 |
+
}
|
563 |
+
/*--------------------------------------------------------------
|
564 |
+
# Clearings
|
565 |
+
--------------------------------------------------------------*/
|
566 |
+
.clear:before,
|
567 |
+
.clear:after,
|
568 |
+
.entry-content:before,
|
569 |
+
.entry-content:after,
|
570 |
+
.comment-content:before,
|
571 |
+
.comment-content:after,
|
572 |
+
.site-header:before,
|
573 |
+
.site-header:after,
|
574 |
+
.site-content:before,
|
575 |
+
.site-content:after,
|
576 |
+
.site-footer:before,
|
577 |
+
.site-footer:after {
|
578 |
+
content: "";
|
579 |
+
display: table;
|
580 |
+
}
|
581 |
+
.clear:after,
|
582 |
+
.entry-content:after,
|
583 |
+
.comment-content:after,
|
584 |
+
.site-header:after,
|
585 |
+
.site-content:after,
|
586 |
+
.site-footer:after {
|
587 |
+
clear: both;
|
588 |
+
}
|
589 |
+
/*--------------------------------------------------------------
|
590 |
+
# Widgets
|
591 |
+
--------------------------------------------------------------*/
|
592 |
+
.widget {
|
593 |
+
margin: 0 0 1.5em;
|
594 |
+
}
|
595 |
+
/* Make sure select elements fit in widgets. */
|
596 |
+
.widget select {
|
597 |
+
max-width: 100%;
|
598 |
+
}
|
599 |
+
/* Search widget. */
|
600 |
+
.widget_search .search-submit {
|
601 |
+
display: none;
|
602 |
+
}
|
603 |
+
/*--------------------------------------------------------------
|
604 |
+
# Content
|
605 |
+
--------------------------------------------------------------*/
|
606 |
+
/*--------------------------------------------------------------
|
607 |
+
## Posts and pages
|
608 |
+
--------------------------------------------------------------*/
|
609 |
+
.sticky {
|
610 |
+
display: block;
|
611 |
+
}
|
612 |
+
.hentry {
|
613 |
+
margin: 0 0 1.5em;
|
614 |
+
}
|
615 |
+
.byline,
|
616 |
+
.updated:not(.published) {
|
617 |
+
display: none;
|
618 |
+
}
|
619 |
+
.single .byline,
|
620 |
+
.group-blog .byline {
|
621 |
+
display: inline;
|
622 |
+
}
|
623 |
+
.page-content,
|
624 |
+
.entry-content,
|
625 |
+
.entry-summary {
|
626 |
+
margin: 1.5em 0 0;
|
627 |
+
}
|
628 |
+
.page-links {
|
629 |
+
clear: both;
|
630 |
+
margin: 0 0 1.5em;
|
631 |
+
}
|
632 |
+
/*--------------------------------------------------------------
|
633 |
+
## Asides
|
634 |
+
--------------------------------------------------------------*/
|
635 |
+
.blog .format-aside .entry-title,
|
636 |
+
.archive .format-aside .entry-title {
|
637 |
+
display: none;
|
638 |
+
}
|
639 |
+
/*--------------------------------------------------------------
|
640 |
+
## Comments
|
641 |
+
--------------------------------------------------------------*/
|
642 |
+
.comment-content a {
|
643 |
+
word-wrap: break-word;
|
644 |
+
}
|
645 |
+
.bypostauthor {
|
646 |
+
display: block;
|
647 |
+
}
|
648 |
+
/*--------------------------------------------------------------
|
649 |
+
# Infinite scroll
|
650 |
+
--------------------------------------------------------------*/
|
651 |
+
/* Globally hidden elements when Infinite Scroll is supported and in use. */
|
652 |
+
.infinite-scroll .posts-navigation,
|
653 |
+
.infinite-scroll.neverending .site-footer {
|
654 |
+
/* Theme Footer (when set to scrolling) */
|
655 |
+
display: none;
|
656 |
+
}
|
657 |
+
/* When Infinite Scroll has reached its end we need to re-display elements that were hidden (via .neverending) before. */
|
658 |
+
.infinity-end.neverending .site-footer {
|
659 |
+
display: block;
|
660 |
+
}
|
661 |
+
/*--------------------------------------------------------------
|
662 |
+
# Media
|
663 |
+
--------------------------------------------------------------*/
|
664 |
+
.page-content .wp-smiley,
|
665 |
+
.entry-content .wp-smiley,
|
666 |
+
.comment-content .wp-smiley {
|
667 |
+
border: none;
|
668 |
+
margin-bottom: 0;
|
669 |
+
margin-top: 0;
|
670 |
+
padding: 0;
|
671 |
+
}
|
672 |
+
/* Make sure embeds and iframes fit their containers. */
|
673 |
+
embed,
|
674 |
+
iframe,
|
675 |
+
object {
|
676 |
+
max-width: 100%;
|
677 |
+
}
|
678 |
+
/*--------------------------------------------------------------
|
679 |
+
## Captions
|
680 |
+
--------------------------------------------------------------*/
|
681 |
+
.wp-caption {
|
682 |
+
margin-bottom: 1.5em;
|
683 |
+
max-width: 100%;
|
684 |
+
}
|
685 |
+
.wp-caption img[class*="wp-image-"] {
|
686 |
+
display: block;
|
687 |
+
margin: 0 auto;
|
688 |
+
}
|
689 |
+
.wp-caption-text {
|
690 |
+
text-align: center;
|
691 |
+
}
|
692 |
+
.wp-caption .wp-caption-text {
|
693 |
+
margin: 0.8075em 0;
|
694 |
+
}
|
695 |
+
/*--------------------------------------------------------------
|
696 |
+
## Galleries
|
697 |
+
--------------------------------------------------------------*/
|
698 |
+
.gallery {
|
699 |
+
margin-bottom: 1.5em;
|
700 |
+
}
|
701 |
+
.gallery-item {
|
702 |
+
display: inline-block;
|
703 |
+
text-align: center;
|
704 |
+
vertical-align: top;
|
705 |
+
width: 100%;
|
706 |
+
}
|
707 |
+
.gallery-columns-2 .gallery-item {
|
708 |
+
max-width: 50%;
|
709 |
+
}
|
710 |
+
.gallery-columns-3 .gallery-item {
|
711 |
+
max-width: 33.33%;
|
712 |
+
}
|
713 |
+
.gallery-columns-4 .gallery-item {
|
714 |
+
max-width: 25%;
|
715 |
+
}
|
716 |
+
.gallery-columns-5 .gallery-item {
|
717 |
+
max-width: 20%;
|
718 |
+
}
|
719 |
+
.gallery-columns-6 .gallery-item {
|
720 |
+
max-width: 16.66%;
|
721 |
+
}
|
722 |
+
.gallery-columns-7 .gallery-item {
|
723 |
+
max-width: 14.28%;
|
724 |
+
}
|
725 |
+
.gallery-columns-8 .gallery-item {
|
726 |
+
max-width: 12.5%;
|
727 |
+
}
|
728 |
+
.gallery-columns-9 .gallery-item {
|
729 |
+
max-width: 11.11%;
|
730 |
+
}
|
731 |
+
.gallery-caption {
|
732 |
+
display: block;
|
733 |
+
}
|
734 |
+
/*--------------------------------------------------------------
|
735 |
+
## Custom
|
736 |
+
--------------------------------------------------------------*/
|
737 |
+
#content {
|
738 |
+
-moz-box-sizing: border-box;
|
739 |
+
-webkit-box-sizing: border-box;
|
740 |
+
box-sizing: border-box;
|
741 |
+
max-width: 1280px;
|
742 |
+
margin: 0 auto;
|
743 |
+
padding: 20px 40px;
|
744 |
+
}
|
inc/admin-actions.php
CHANGED
@@ -35,8 +35,7 @@ function siteorigin_panels_ajax_widget_form(){
|
|
35 |
$request = array_map('stripslashes_deep', $_REQUEST);
|
36 |
|
37 |
$widget = $request['widget'];
|
38 |
-
|
39 |
-
$instance = !empty($request['instance']) ? json_decode( $request['instance'] , true ) : array();
|
40 |
|
41 |
$form = siteorigin_panels_render_form( $widget, $instance, $_REQUEST['raw'] == 'true' );
|
42 |
$form = apply_filters('siteorigin_panels_ajax_widget_form', $form, $widget, $instance);
|
@@ -254,3 +253,15 @@ function siteorigin_panels_ajax_directory_enable(){
|
|
254 |
wp_die();
|
255 |
}
|
256 |
add_action('wp_ajax_so_panels_directory_enable', 'siteorigin_panels_ajax_directory_enable');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
$request = array_map('stripslashes_deep', $_REQUEST);
|
36 |
|
37 |
$widget = $request['widget'];
|
38 |
+
$instance = !empty($request['instance']) ? json_decode( $request['instance'], true ) : array();
|
|
|
39 |
|
40 |
$form = siteorigin_panels_render_form( $widget, $instance, $_REQUEST['raw'] == 'true' );
|
41 |
$form = apply_filters('siteorigin_panels_ajax_widget_form', $form, $widget, $instance);
|
253 |
wp_die();
|
254 |
}
|
255 |
add_action('wp_ajax_so_panels_directory_enable', 'siteorigin_panels_ajax_directory_enable');
|
256 |
+
|
257 |
+
/**
|
258 |
+
* Preview in the live editor when there is no public view of the item
|
259 |
+
*/
|
260 |
+
function siteorigin_panels_live_editor_preview(){
|
261 |
+
if( empty( $_REQUEST['_panelsnonce'] ) || !wp_verify_nonce($_REQUEST['_panelsnonce'], 'live-editor-preview') ) wp_die();
|
262 |
+
|
263 |
+
include plugin_dir_path( __FILE__ ) . '../tpl/live-editor-preview.php';
|
264 |
+
|
265 |
+
exit();
|
266 |
+
}
|
267 |
+
add_action('wp_ajax_so_panels_live_editor_preview', 'siteorigin_panels_live_editor_preview');
|
inc/default-styles.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
*/
|
6 |
function siteorigin_panels_default_styles_register_scripts(){
|
7 |
wp_register_script( 'siteorigin-panels-front-styles', plugin_dir_url(SITEORIGIN_PANELS_BASE_FILE) . 'js/styling' . SITEORIGIN_PANELS_VERSION_SUFFIX . SITEORIGIN_PANELS_JS_SUFFIX . '.js', array('jquery'), SITEORIGIN_PANELS_VERSION );
|
8 |
-
wp_register_script( 'siteorigin-
|
9 |
wp_localize_script( 'siteorigin-panels-front-styles', 'panelsStyles', array(
|
10 |
'fullContainer' => apply_filters( 'siteorigin_panels_full_width_container', siteorigin_panels_setting('full-width-container') )
|
11 |
) );
|
@@ -78,7 +78,7 @@ class SiteOrigin_Panels_Default_Styling {
|
|
78 |
'name' => __('Bottom Margin', 'siteorigin-panels'),
|
79 |
'type' => 'measurement',
|
80 |
'group' => 'layout',
|
81 |
-
'description' => __('Space below the row.', 'siteorigin-panels'),
|
82 |
'priority' => 5,
|
83 |
);
|
84 |
|
@@ -86,7 +86,7 @@ class SiteOrigin_Panels_Default_Styling {
|
|
86 |
'name' => __('Gutter', 'siteorigin-panels'),
|
87 |
'type' => 'measurement',
|
88 |
'group' => 'layout',
|
89 |
-
'description' => __('Amount of space between columns.', 'siteorigin-panels'),
|
90 |
'priority' => 6,
|
91 |
);
|
92 |
|
@@ -293,12 +293,14 @@ class SiteOrigin_Panels_Default_Styling {
|
|
293 |
if( !empty($url) ) {
|
294 |
|
295 |
if( $args['background_display'] == 'parallax' || $args['background_display'] == 'parallax-original' ) {
|
296 |
-
wp_enqueue_script('siteorigin-
|
297 |
-
$
|
298 |
-
|
299 |
-
|
300 |
-
$
|
301 |
-
|
|
|
|
|
302 |
}
|
303 |
else {
|
304 |
$attributes['style'] .= 'background-image: url(' . $url[0] . ');';
|
@@ -367,12 +369,14 @@ class SiteOrigin_Panels_Default_Styling {
|
|
367 |
if( !empty($url) ) {
|
368 |
|
369 |
if( $args['background_display'] == 'parallax' || $args['background_display'] == 'parallax-original' ) {
|
370 |
-
wp_enqueue_script('siteorigin-
|
371 |
-
$
|
372 |
-
|
373 |
-
|
374 |
-
$
|
375 |
-
|
|
|
|
|
376 |
}
|
377 |
else {
|
378 |
$attributes['style'] .= 'background-image: url(' . $url[0] . ');';
|
5 |
*/
|
6 |
function siteorigin_panels_default_styles_register_scripts(){
|
7 |
wp_register_script( 'siteorigin-panels-front-styles', plugin_dir_url(SITEORIGIN_PANELS_BASE_FILE) . 'js/styling' . SITEORIGIN_PANELS_VERSION_SUFFIX . SITEORIGIN_PANELS_JS_SUFFIX . '.js', array('jquery'), SITEORIGIN_PANELS_VERSION );
|
8 |
+
wp_register_script( 'siteorigin-parallax', plugin_dir_url(SITEORIGIN_PANELS_BASE_FILE) . 'js/siteorigin-parallax' . SITEORIGIN_PANELS_JS_SUFFIX . '.js', array('jquery'), SITEORIGIN_PANELS_VERSION );
|
9 |
wp_localize_script( 'siteorigin-panels-front-styles', 'panelsStyles', array(
|
10 |
'fullContainer' => apply_filters( 'siteorigin_panels_full_width_container', siteorigin_panels_setting('full-width-container') )
|
11 |
) );
|
78 |
'name' => __('Bottom Margin', 'siteorigin-panels'),
|
79 |
'type' => 'measurement',
|
80 |
'group' => 'layout',
|
81 |
+
'description' => sprintf( __('Space below the row. Default is %spx.', 'siteorigin-panels'), siteorigin_panels_setting( 'margin-bottom' ) ),
|
82 |
'priority' => 5,
|
83 |
);
|
84 |
|
86 |
'name' => __('Gutter', 'siteorigin-panels'),
|
87 |
'type' => 'measurement',
|
88 |
'group' => 'layout',
|
89 |
+
'description' => sprintf( __('Amount of space between columns. Default is %spx.', 'siteorigin-panels'), siteorigin_panels_setting( 'margin-sides' ) ),
|
90 |
'priority' => 6,
|
91 |
);
|
92 |
|
293 |
if( !empty($url) ) {
|
294 |
|
295 |
if( $args['background_display'] == 'parallax' || $args['background_display'] == 'parallax-original' ) {
|
296 |
+
wp_enqueue_script('siteorigin-parallax');
|
297 |
+
$parallax_args = array(
|
298 |
+
'backgroundUrl' => $url[0],
|
299 |
+
'backgroundSize' => array( $url[1], $url[2] ),
|
300 |
+
'backgroundSizing' => $args['background_display'] == 'parallax-original' ? 'original' : 'scaled',
|
301 |
+
);
|
302 |
+
$attributes['data-siteorigin-parallax'] = json_encode( $parallax_args );
|
303 |
+
$attributes['style'] .= 'background-image: url(' . $url[0] . '); background-position: center center; background-repeat: no-repeat;';
|
304 |
}
|
305 |
else {
|
306 |
$attributes['style'] .= 'background-image: url(' . $url[0] . ');';
|
369 |
if( !empty($url) ) {
|
370 |
|
371 |
if( $args['background_display'] == 'parallax' || $args['background_display'] == 'parallax-original' ) {
|
372 |
+
wp_enqueue_script('siteorigin-parallax');
|
373 |
+
$parallax_args = array(
|
374 |
+
'backgroundUrl' => $url[0],
|
375 |
+
'backgroundSize' => array( $url[1], $url[2] ),
|
376 |
+
'backgroundSizing' => $args['background_display'] == 'parallax-original' ? 'original' : 'scaled',
|
377 |
+
);
|
378 |
+
$attributes['data-siteorigin-parallax'] = json_encode( $parallax_args );
|
379 |
+
$attributes['style'] .= 'background-image: url(' . $url[0] . '); background-position: center center; background-repeat: no-repeat;';
|
380 |
}
|
381 |
else {
|
382 |
$attributes['style'] .= 'background-image: url(' . $url[0] . ');';
|
inc/sidebars-emulator.php
CHANGED
@@ -6,7 +6,7 @@ class SiteOrigin_Panels_Sidebars_Emulator {
|
|
6 |
|
7 |
function __construct() {
|
8 |
$this->all_posts_widgets = array();
|
9 |
-
add_action( '
|
10 |
add_filter( 'sidebars_widgets', array( $this, 'add_widgets_to_sidebars' ) );
|
11 |
}
|
12 |
|
@@ -125,4 +125,4 @@ class SiteOrigin_Panels_Sidebars_Emulator {
|
|
125 |
}
|
126 |
}
|
127 |
|
128 |
-
SiteOrigin_Panels_Sidebars_Emulator::single();
|
6 |
|
7 |
function __construct() {
|
8 |
$this->all_posts_widgets = array();
|
9 |
+
add_action( 'init', array( $this, 'register_widgets' ), 15 );
|
10 |
add_filter( 'sidebars_widgets', array( $this, 'add_widgets_to_sidebars' ) );
|
11 |
}
|
12 |
|
125 |
}
|
126 |
}
|
127 |
|
128 |
+
SiteOrigin_Panels_Sidebars_Emulator::single();
|
inc/styles.php
CHANGED
@@ -1,17 +1,17 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
|
4 |
/**
|
5 |
* Admin action for handling fetching the style fields
|
6 |
*/
|
7 |
function siteorigin_panels_ajax_action_style_form(){
|
8 |
$type = $_REQUEST['type'];
|
9 |
if( !in_array($type, array('row', 'widget') ) ) exit();
|
|
|
10 |
|
11 |
$current = isset( $_REQUEST['style'] ) ? $_REQUEST['style'] : array();
|
12 |
$post_id = empty( $_REQUEST['postId'] ) ? 0 : $_REQUEST['postId'];
|
13 |
|
14 |
-
$args = !empty( $_POST['args'] ) ? json_decode( $_POST['args'], true) : array();
|
15 |
|
16 |
switch($type) {
|
17 |
case 'row':
|
@@ -35,6 +35,8 @@ add_action('wp_ajax_so_panels_style_form', 'siteorigin_panels_ajax_action_style_
|
|
35 |
* @param array $current
|
36 |
* @param int $post_id
|
37 |
* @param array $args Arguments passed by the builder
|
|
|
|
|
38 |
*/
|
39 |
function siteorigin_panels_render_styles_fields( $section, $before = '', $after = '', $current = array(), $post_id = 0, $args = array() ){
|
40 |
$fields = apply_filters('siteorigin_panels_' . $section . '_style_fields', array(), $post_id, $args );
|
1 |
<?php
|
2 |
|
|
|
3 |
/**
|
4 |
* Admin action for handling fetching the style fields
|
5 |
*/
|
6 |
function siteorigin_panels_ajax_action_style_form(){
|
7 |
$type = $_REQUEST['type'];
|
8 |
if( !in_array($type, array('row', 'widget') ) ) exit();
|
9 |
+
if( empty( $_GET['_panelsnonce'] ) || !wp_verify_nonce( $_GET['_panelsnonce'], 'panels_action' ) ) exit();
|
10 |
|
11 |
$current = isset( $_REQUEST['style'] ) ? $_REQUEST['style'] : array();
|
12 |
$post_id = empty( $_REQUEST['postId'] ) ? 0 : $_REQUEST['postId'];
|
13 |
|
14 |
+
$args = !empty( $_POST['args'] ) ? json_decode( stripslashes( $_POST['args'] ), true) : array();
|
15 |
|
16 |
switch($type) {
|
17 |
case 'row':
|
35 |
* @param array $current
|
36 |
* @param int $post_id
|
37 |
* @param array $args Arguments passed by the builder
|
38 |
+
*
|
39 |
+
* @return bool
|
40 |
*/
|
41 |
function siteorigin_panels_render_styles_fields( $section, $before = '', $after = '', $current = array(), $post_id = 0, $args = array() ){
|
42 |
$fields = apply_filters('siteorigin_panels_' . $section . '_style_fields', array(), $post_id, $args );
|
js/siteorigin-panels-24.js
CHANGED
@@ -584,7 +584,7 @@ module.exports = panels.view.dialog.extend( {
|
|
584 |
|
585 |
// Handle exporting the file
|
586 |
c.find( '.so-export' ).submit( function ( e ) {
|
587 |
-
var $$ =
|
588 |
$$.find( 'input[name="panels_export_data"]' ).val( JSON.stringify( thisView.builder.model.getPanelsData() ) );
|
589 |
} );
|
590 |
|
@@ -904,10 +904,17 @@ module.exports = panels.view.dialog.extend( {
|
|
904 |
this.styles = new panels.view.styles();
|
905 |
this.styles.model = this.model;
|
906 |
this.styles.render( 'row', $( '#post_ID' ).val(), {
|
907 |
-
builderType: this.builder.builderType,
|
908 |
dialog: this
|
909 |
} );
|
910 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
911 |
var $rightSidebar = this.$( '.so-sidebar.so-right-sidebar' );
|
912 |
this.styles.attach( $rightSidebar );
|
913 |
|
@@ -1330,7 +1337,7 @@ module.exports = panels.view.dialog.extend( {
|
|
1330 |
}, args );
|
1331 |
|
1332 |
// Set the cells
|
1333 |
-
if( ! _.
|
1334 |
this.model.setCells( this.row.cells );
|
1335 |
}
|
1336 |
|
@@ -1480,11 +1487,18 @@ module.exports = panels.view.dialog.extend( {
|
|
1480 |
this.$( '.so-title .widget-name' ).html( panelsOptions.loc.missing_widget.title );
|
1481 |
}
|
1482 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1483 |
// Now we need to attach the style window
|
1484 |
this.styles = new panels.view.styles();
|
1485 |
this.styles.model = this.model;
|
1486 |
this.styles.render( 'widget', $( '#post_ID' ).val(), {
|
1487 |
-
builderType: this.builder.builderType,
|
1488 |
dialog: this
|
1489 |
} );
|
1490 |
|
@@ -1518,13 +1532,15 @@ module.exports = panels.view.dialog.extend( {
|
|
1518 |
if ( currentIndex === 0 ) {
|
1519 |
return false;
|
1520 |
} else {
|
1521 |
-
|
1522 |
-
|
1523 |
-
|
1524 |
-
|
1525 |
-
|
1526 |
-
|
1527 |
}
|
|
|
|
|
1528 |
},
|
1529 |
|
1530 |
/**
|
@@ -1536,18 +1552,21 @@ module.exports = panels.view.dialog.extend( {
|
|
1536 |
if ( widgets.length <= 1 ) {
|
1537 |
return false;
|
1538 |
}
|
1539 |
-
|
|
|
1540 |
|
1541 |
if ( currentIndex === widgets.length - 1 ) {
|
1542 |
return false;
|
1543 |
} else {
|
1544 |
-
|
1545 |
-
|
1546 |
-
|
1547 |
-
|
1548 |
-
|
1549 |
-
|
1550 |
}
|
|
|
|
|
1551 |
},
|
1552 |
|
1553 |
/**
|
@@ -1916,12 +1935,15 @@ module.exports = panels.view.dialog.extend( {
|
|
1916 |
|
1917 |
var panels = window.panels, $ = jQuery;
|
1918 |
|
1919 |
-
module.exports = function () {
|
1920 |
|
1921 |
return this.each( function () {
|
1922 |
var $$ = jQuery( this );
|
1923 |
var widgetId = $$.closest( 'form' ).find( '.widget-id' ).val();
|
1924 |
|
|
|
|
|
|
|
1925 |
// Exit if this isn't a real widget
|
1926 |
if ( ! _.isUndefined( widgetId ) && widgetId.indexOf( '__i__' ) > - 1 ) {
|
1927 |
return;
|
@@ -1932,7 +1954,8 @@ module.exports = function () {
|
|
1932 |
|
1933 |
// Now for the view to display the builder
|
1934 |
var builderView = new panels.view.builder( {
|
1935 |
-
model: builderModel
|
|
|
1936 |
} );
|
1937 |
|
1938 |
// Save panels data when we close the dialog, if we're in a dialog
|
@@ -1962,12 +1985,12 @@ module.exports = function () {
|
|
1962 |
.render()
|
1963 |
.attach( {
|
1964 |
container: $$,
|
1965 |
-
dialog: isWidget,
|
1966 |
type: $$.data( 'type' )
|
1967 |
} )
|
1968 |
.setDataField( $$.find( 'input.panels-data' ) );
|
1969 |
|
1970 |
-
if ( isWidget ) {
|
1971 |
// Set up the dialog opening
|
1972 |
builderView.setDialogParents( panelsOptions.loc.layout_widget, builderView.dialog );
|
1973 |
$$.find( '.siteorigin-panels-display-builder' ).click( function ( e ) {
|
@@ -1988,11 +2011,11 @@ module.exports = function () {
|
|
1988 |
/**
|
1989 |
* Everything we need for SiteOrigin Page Builder.
|
1990 |
*
|
1991 |
-
* @copyright Greg Priday 2013 -
|
1992 |
* @license GPL 3.0 http://www.gnu.org/licenses/gpl.html
|
1993 |
*/
|
1994 |
|
1995 |
-
/* global Backbone, _, jQuery, tinyMCE, panelsOptions, plupload, confirm, console */
|
1996 |
|
1997 |
/**
|
1998 |
* Convert template into something compatible with Underscore.js templates
|
@@ -2059,29 +2082,44 @@ jQuery.fn.soPanelsSetupBuilderWidget = require( './jquery/setup-builder-widget'
|
|
2059 |
// Set up Page Builder if we're on the main interface
|
2060 |
jQuery( function ( $ ) {
|
2061 |
|
2062 |
-
var container,
|
|
|
|
|
|
|
2063 |
|
2064 |
if ( $( '#siteorigin-panels-metabox' ).length && $( 'form#post' ).length ) {
|
2065 |
// This is usually the case when we're in the post edit interface
|
2066 |
container = $( '#siteorigin-panels-metabox' );
|
2067 |
field = $( '#siteorigin-panels-metabox .siteorigin-panels-data-field' );
|
2068 |
form = $( 'form#post' );
|
2069 |
-
|
2070 |
-
|
2071 |
-
|
2072 |
-
|
2073 |
-
|
|
|
|
|
|
|
|
|
|
|
2074 |
}
|
2075 |
else if ( $( '.siteorigin-panels-builder-form' ).length ) {
|
2076 |
// We're dealing with another interface like the custom home page interface
|
2077 |
var $$ = $( '.siteorigin-panels-builder-form' );
|
|
|
2078 |
container = $$.find( '.siteorigin-panels-builder-container' );
|
2079 |
field = $$.find( 'input[name="panels_data"]' );
|
2080 |
form = $$;
|
2081 |
-
|
2082 |
-
|
2083 |
-
|
2084 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
2085 |
}
|
2086 |
|
2087 |
if ( ! _.isUndefined( container ) ) {
|
@@ -2091,15 +2129,6 @@ jQuery( function ( $ ) {
|
|
2091 |
// Create the main builder model
|
2092 |
var builderModel = new panels.model.builder();
|
2093 |
|
2094 |
-
// Create the builder config
|
2095 |
-
var builderConfig = {
|
2096 |
-
editorType: editorType,
|
2097 |
-
postId: postId,
|
2098 |
-
editorId: editorId,
|
2099 |
-
builderType: builderType,
|
2100 |
-
loadLiveEditor: loadLiveEditor
|
2101 |
-
};
|
2102 |
-
|
2103 |
// Now for the view to display the builder
|
2104 |
var builderView = new panels.view.builder( {
|
2105 |
model: builderModel,
|
@@ -2110,16 +2139,13 @@ jQuery( function ( $ ) {
|
|
2110 |
builderView
|
2111 |
.render()
|
2112 |
.attach( {
|
2113 |
-
container: container
|
2114 |
-
type: builderType
|
2115 |
} )
|
2116 |
.setDataField( field )
|
2117 |
-
.attachToEditor()
|
2118 |
-
.addLiveEditor( postId )
|
2119 |
-
.addHistoryBrowser();
|
2120 |
|
2121 |
// When the form is submitted, update the panels data
|
2122 |
-
form.submit( function (
|
2123 |
// Refresh the data
|
2124 |
builderModel.refreshPanelsData();
|
2125 |
} );
|
@@ -2265,8 +2291,18 @@ module.exports = Backbone.Model.extend( {
|
|
2265 |
newWidget.set( 'style', panels_info.style );
|
2266 |
}
|
2267 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2268 |
newWidget.cell = cell;
|
2269 |
-
cell.widgets.add( newWidget, {noAnimate: true} );
|
2270 |
} );
|
2271 |
|
2272 |
this.trigger( 'load_panels_data' );
|
@@ -2333,6 +2369,8 @@ module.exports = Backbone.Model.extend( {
|
|
2333 |
*/
|
2334 |
getPanelsData: function () {
|
2335 |
|
|
|
|
|
2336 |
var data = {
|
2337 |
'widgets': [],
|
2338 |
'grids': [],
|
@@ -2346,15 +2384,23 @@ module.exports = Backbone.Model.extend( {
|
|
2346 |
|
2347 |
cell.widgets.each( function ( widget, wi ) {
|
2348 |
// Add the data for the widget, including the panels_info field.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2349 |
var values = _.extend( _.clone( widget.get( 'values' ) ), {
|
2350 |
-
panels_info:
|
2351 |
-
class: widget.get( 'class' ),
|
2352 |
-
raw: widget.get( 'raw' ),
|
2353 |
-
grid: ri,
|
2354 |
-
cell: ci,
|
2355 |
-
id: widgetId ++,
|
2356 |
-
style: widget.get( 'style' )
|
2357 |
-
}
|
2358 |
} );
|
2359 |
data.widgets.push( values );
|
2360 |
} );
|
@@ -2412,6 +2458,19 @@ module.exports = Backbone.Model.extend( {
|
|
2412 |
return position === this.layoutPosition.BEFORE ||
|
2413 |
position === this.layoutPosition.AFTER ||
|
2414 |
position === this.layoutPosition.REPLACE;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2415 |
}
|
2416 |
|
2417 |
} );
|
@@ -2637,7 +2696,10 @@ module.exports = Backbone.Model.extend( {
|
|
2637 |
raw: false,
|
2638 |
|
2639 |
// Visual style fields
|
2640 |
-
|
|
|
|
|
|
|
2641 |
},
|
2642 |
|
2643 |
indexes: null,
|
@@ -3135,9 +3197,7 @@ var panels = window.panels, $ = jQuery;
|
|
3135 |
module.exports = Backbone.View.extend( {
|
3136 |
|
3137 |
// Config options
|
3138 |
-
|
3139 |
-
postId: null,
|
3140 |
-
editorId: null,
|
3141 |
|
3142 |
template: _.template( $( '#siteorigin-panels-builder' ).html().panelsProcessTemplate() ),
|
3143 |
dialogs: {},
|
@@ -3149,9 +3209,6 @@ module.exports = Backbone.View.extend( {
|
|
3149 |
liveEditor: undefined,
|
3150 |
menu: false,
|
3151 |
|
3152 |
-
/* The builderType is sent with all requests to the server */
|
3153 |
-
builderType: '',
|
3154 |
-
|
3155 |
events: {
|
3156 |
'click .so-tool-button.so-widget-add': 'displayAddWidgetDialog',
|
3157 |
'click .so-tool-button.so-row-add': 'displayAddRowDialog',
|
@@ -3169,18 +3226,32 @@ module.exports = Backbone.View.extend( {
|
|
3169 |
initialize: function ( options ) {
|
3170 |
var builder = this;
|
3171 |
|
3172 |
-
|
3173 |
-
|
3174 |
-
|
3175 |
-
|
3176 |
-
|
3177 |
-
|
3178 |
-
|
3179 |
-
|
3180 |
-
|
3181 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3182 |
}
|
3183 |
-
}
|
3184 |
|
3185 |
// Now lets create all the dialog boxes that the main builder interface uses
|
3186 |
this.dialogs = {
|
@@ -3248,7 +3319,6 @@ module.exports = Backbone.View.extend( {
|
|
3248 |
attach: function ( options ) {
|
3249 |
|
3250 |
options = _.extend( {
|
3251 |
-
type: '',
|
3252 |
container: false,
|
3253 |
dialog: false
|
3254 |
}, options );
|
@@ -3265,11 +3335,29 @@ module.exports = Backbone.View.extend( {
|
|
3265 |
this.trigger( 'attached_to_container', options.container );
|
3266 |
}
|
3267 |
|
3268 |
-
// Store the builder type
|
3269 |
-
this.builderType = options.type;
|
3270 |
-
|
3271 |
this.trigger( 'builder_attached' );
|
3272 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3273 |
return this;
|
3274 |
},
|
3275 |
|
@@ -3279,7 +3367,7 @@ module.exports = Backbone.View.extend( {
|
|
3279 |
* @returns {panels.view.builder}
|
3280 |
*/
|
3281 |
attachToEditor: function () {
|
3282 |
-
if ( this.editorType !== 'tinymce' ) {
|
3283 |
return this;
|
3284 |
}
|
3285 |
|
@@ -3322,24 +3410,26 @@ module.exports = Backbone.View.extend( {
|
|
3322 |
);
|
3323 |
|
3324 |
// Switch back to the standard editor
|
3325 |
-
|
3326 |
-
|
|
|
3327 |
|
3328 |
-
|
3329 |
-
|
3330 |
-
|
3331 |
|
3332 |
-
|
3333 |
-
|
3334 |
-
|
3335 |
|
3336 |
-
|
3337 |
-
|
3338 |
-
|
3339 |
|
3340 |
-
|
3341 |
-
|
3342 |
-
|
|
|
3343 |
|
3344 |
// Move the panels box into a tab of the content editor
|
3345 |
metabox.insertAfter( '#wp-content-wrap' ).hide().addClass( 'attached-to-editor' );
|
@@ -3417,8 +3507,11 @@ module.exports = Backbone.View.extend( {
|
|
3417 |
* Initialize the row sortables
|
3418 |
*/
|
3419 |
initSortable: function () {
|
|
|
|
|
|
|
|
|
3420 |
// Create the sortable for the rows
|
3421 |
-
var $el = this.$el;
|
3422 |
var builderView = this;
|
3423 |
|
3424 |
this.rowsSortable = this.$( '.so-rows-container' ).sortable( {
|
@@ -3435,6 +3528,8 @@ module.exports = Backbone.View.extend( {
|
|
3435 |
builderView.sortCollections();
|
3436 |
}
|
3437 |
} );
|
|
|
|
|
3438 |
},
|
3439 |
|
3440 |
/**
|
@@ -3641,14 +3736,20 @@ module.exports = Backbone.View.extend( {
|
|
3641 |
},
|
3642 |
|
3643 |
/**
|
3644 |
-
* Add a live editor
|
3645 |
*
|
3646 |
* @returns {panels.view.builder}
|
3647 |
*/
|
3648 |
-
addLiveEditor: function (
|
|
|
|
|
|
|
|
|
3649 |
// Create the live editor and set the builder to this.
|
3650 |
-
this.liveEditor = new panels.view.liveEditor( {
|
3651 |
-
|
|
|
|
|
3652 |
|
3653 |
// Display the live editor button in the toolbar
|
3654 |
if ( this.liveEditor.hasPreviewUrl() ) {
|
@@ -3677,6 +3778,10 @@ module.exports = Backbone.View.extend( {
|
|
3677 |
* @return {panels.view.builder}
|
3678 |
*/
|
3679 |
addHistoryBrowser: function () {
|
|
|
|
|
|
|
|
|
3680 |
this.dialogs.history = new panels.dialog.history();
|
3681 |
this.dialogs.history.builder = this;
|
3682 |
this.dialogs.history.entries.builder = this.model;
|
@@ -3704,6 +3809,19 @@ module.exports = Backbone.View.extend( {
|
|
3704 |
}
|
3705 |
},
|
3706 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3707 |
/**
|
3708 |
* Handle a change of the content
|
3709 |
*/
|
@@ -3720,7 +3838,7 @@ module.exports = Backbone.View.extend( {
|
|
3720 |
{
|
3721 |
action: 'so_panels_builder_content',
|
3722 |
panels_data: JSON.stringify( panelsData ),
|
3723 |
-
post_id: this.postId
|
3724 |
},
|
3725 |
function ( content ) {
|
3726 |
|
@@ -3752,8 +3870,8 @@ module.exports = Backbone.View.extend( {
|
|
3752 |
*/
|
3753 |
updateEditorContent: function ( content ) {
|
3754 |
// Switch back to the standard editor
|
3755 |
-
if ( this.editorType !== 'tinymce' || _.isUndefined( tinyMCE ) || _.isNull( tinyMCE.get( "content" ) ) ) {
|
3756 |
-
var $editor = $( this.editorId );
|
3757 |
$editor.val( content ).trigger( 'change' ).trigger( 'keyup' );
|
3758 |
} else {
|
3759 |
var contentEd = tinyMCE.get( "content" );
|
@@ -3809,7 +3927,10 @@ module.exports = Backbone.View.extend( {
|
|
3809 |
}
|
3810 |
|
3811 |
if (
|
3812 |
-
(
|
|
|
|
|
|
|
3813 |
editorContent !== ''
|
3814 |
) {
|
3815 |
// Confirm that the user wants to copy their content to Page Builder.
|
@@ -4035,6 +4156,10 @@ module.exports = Backbone.View.extend( {
|
|
4035 |
* Initialize the widget sortable
|
4036 |
*/
|
4037 |
initSortable: function () {
|
|
|
|
|
|
|
|
|
4038 |
var cellView = this;
|
4039 |
|
4040 |
// Go up the view hierarchy until we find the ID attribute
|
@@ -4084,19 +4209,27 @@ module.exports = Backbone.View.extend( {
|
|
4084 |
return helper;
|
4085 |
}
|
4086 |
} );
|
|
|
|
|
4087 |
},
|
4088 |
|
4089 |
/**
|
4090 |
* Refresh the widget sortable when a new widget is added
|
4091 |
*/
|
4092 |
refreshSortable: function () {
|
4093 |
-
this.widgetSortable
|
|
|
|
|
4094 |
},
|
4095 |
|
4096 |
/**
|
4097 |
* This will make the cell resizble
|
4098 |
*/
|
4099 |
initResizable: function () {
|
|
|
|
|
|
|
|
|
4100 |
// var neighbor = this.$el.previous().data('view');
|
4101 |
var handle = this.$( '.resize-handle' ).css( 'position', 'absolute' );
|
4102 |
var container = this.row.$el;
|
@@ -4191,6 +4324,7 @@ module.exports = Backbone.View.extend( {
|
|
4191 |
}
|
4192 |
} );
|
4193 |
|
|
|
4194 |
},
|
4195 |
|
4196 |
/**
|
@@ -4795,10 +4929,10 @@ var panels = window.panels, $ = jQuery;
|
|
4795 |
module.exports = Backbone.View.extend( {
|
4796 |
template: _.template( $( '#siteorigin-panels-live-editor' ).html().panelsProcessTemplate() ),
|
4797 |
|
4798 |
-
postId: false,
|
4799 |
previewScrollTop: 0,
|
4800 |
loadTimes: [],
|
4801 |
previewFrameId: 1,
|
|
|
4802 |
previewIframe: null,
|
4803 |
|
4804 |
events: {
|
@@ -4808,7 +4942,18 @@ module.exports = Backbone.View.extend( {
|
|
4808 |
},
|
4809 |
|
4810 |
initialize: function ( options ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4811 |
this.builder = options.builder;
|
|
|
|
|
4812 |
this.builder.model.on( 'refresh_panels_data', this.handleRefreshData, this );
|
4813 |
this.builder.model.on( 'load_panels_data', this.handleLoadData, this );
|
4814 |
},
|
@@ -4860,10 +5005,6 @@ module.exports = Backbone.View.extend( {
|
|
4860 |
this.$el.appendTo( 'body' );
|
4861 |
},
|
4862 |
|
4863 |
-
setPostId: function ( postId ) {
|
4864 |
-
this.postId = postId;
|
4865 |
-
},
|
4866 |
-
|
4867 |
/**
|
4868 |
* Display the live editor
|
4869 |
*/
|
@@ -4955,7 +5096,7 @@ module.exports = Backbone.View.extend( {
|
|
4955 |
body.find( '.panel-grid .panel-grid-cell .so-panel' )
|
4956 |
.filter( function () {
|
4957 |
// Filter to only include non nested
|
4958 |
-
return $( this ).parents( '.
|
4959 |
} )
|
4960 |
.not( over )
|
4961 |
.addClass( 'so-panels-faded' );
|
@@ -5026,8 +5167,10 @@ module.exports = Backbone.View.extend( {
|
|
5026 |
|
5027 |
|
5028 |
this.postToIframe(
|
5029 |
-
{
|
5030 |
-
|
|
|
|
|
5031 |
this.$('.so-preview')
|
5032 |
);
|
5033 |
|
@@ -5120,7 +5263,7 @@ module.exports = Backbone.View.extend( {
|
|
5120 |
$iframeContents.find( '.panel-grid .panel-grid-cell .so-panel' )
|
5121 |
.filter( function () {
|
5122 |
// Filter to only include non nested
|
5123 |
-
return $( this ).parents( '.
|
5124 |
} )
|
5125 |
.each( function ( i, el ) {
|
5126 |
var $$ = $( el );
|
@@ -5240,6 +5383,33 @@ module.exports = Backbone.View.extend( {
|
|
5240 |
cellView.$el.appendTo( thisView.$( '.so-cells' ) );
|
5241 |
} );
|
5242 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5243 |
// Resize the rows when ever the widget sortable moves
|
5244 |
this.builder.on( 'widget_sortable_move', this.resize, this );
|
5245 |
this.builder.on( 'builder_resize', this.resize, this );
|
@@ -5362,6 +5532,8 @@ module.exports = Backbone.View.extend( {
|
|
5362 |
}
|
5363 |
|
5364 |
this.dialog.openDialog();
|
|
|
|
|
5365 |
},
|
5366 |
|
5367 |
/**
|
@@ -5369,6 +5541,7 @@ module.exports = Backbone.View.extend( {
|
|
5369 |
*/
|
5370 |
deleteHandler: function () {
|
5371 |
this.model.destroy();
|
|
|
5372 |
},
|
5373 |
|
5374 |
/**
|
@@ -5417,68 +5590,73 @@ module.exports = Backbone.View.extend( {
|
|
5417 |
} );
|
5418 |
}
|
5419 |
|
5420 |
-
|
5421 |
-
|
5422 |
-
|
5423 |
-
|
5424 |
-
|
5425 |
-
|
5426 |
-
|
5427 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5428 |
|
5429 |
-
|
5430 |
-
|
5431 |
-
|
5432 |
-
|
5433 |
-
}
|
5434 |
|
5435 |
-
|
5436 |
-
|
5437 |
-
collection: thisView.collection
|
5438 |
-
} );
|
5439 |
|
5440 |
-
|
5441 |
-
|
|
|
5442 |
|
5443 |
-
|
5444 |
-
|
5445 |
-
|
|
|
5446 |
|
5447 |
-
|
5448 |
-
}
|
5449 |
-
);
|
5450 |
|
5451 |
-
|
5452 |
-
{
|
5453 |
-
|
5454 |
-
|
5455 |
-
}
|
5456 |
-
|
5457 |
-
|
5458 |
-
|
5459 |
-
|
5460 |
-
|
5461 |
-
|
5462 |
-
|
5463 |
-
|
5464 |
-
|
5465 |
-
|
5466 |
},
|
5467 |
-
|
5468 |
-
|
5469 |
-
|
5470 |
-
|
5471 |
-
|
5472 |
-
|
5473 |
-
|
5474 |
-
|
5475 |
-
|
5476 |
-
|
5477 |
-
|
5478 |
-
|
|
|
5479 |
}
|
5480 |
-
|
5481 |
-
|
5482 |
}
|
5483 |
|
5484 |
} );
|
@@ -5699,7 +5877,7 @@ module.exports = Backbone.View.extend( {
|
|
5699 |
|
5700 |
events: {
|
5701 |
'click .widget-edit': 'editHandler',
|
5702 |
-
'click .title h4': '
|
5703 |
'click .actions .widget-duplicate': 'duplicateHandler',
|
5704 |
'click .actions .widget-delete': 'deleteHandler'
|
5705 |
},
|
@@ -5730,6 +5908,30 @@ module.exports = Backbone.View.extend( {
|
|
5730 |
|
5731 |
this.$el.data( 'view', this );
|
5732 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5733 |
if ( _.size( this.model.get( 'values' ) ) === 0 || options.loadForm ) {
|
5734 |
// If this widget doesn't have a value, create a form and save it
|
5735 |
var dialog = this.getEditDialog();
|
@@ -5777,6 +5979,15 @@ module.exports = Backbone.View.extend( {
|
|
5777 |
editHandler: function () {
|
5778 |
// Create a new dialog for editing this
|
5779 |
this.getEditDialog().openDialog();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5780 |
},
|
5781 |
|
5782 |
/**
|
@@ -5797,6 +6008,7 @@ module.exports = Backbone.View.extend( {
|
|
5797 |
} );
|
5798 |
|
5799 |
this.cell.row.builder.model.refreshPanelsData();
|
|
|
5800 |
},
|
5801 |
|
5802 |
/**
|
@@ -5806,6 +6018,7 @@ module.exports = Backbone.View.extend( {
|
|
5806 |
*/
|
5807 |
deleteHandler: function () {
|
5808 |
this.model.trigger( 'visual_destroy' );
|
|
|
5809 |
},
|
5810 |
|
5811 |
onModelChange: function () {
|
@@ -5834,6 +6047,8 @@ module.exports = Backbone.View.extend( {
|
|
5834 |
thisView.cell.row.builder.model.refreshPanelsData();
|
5835 |
thisView.remove();
|
5836 |
} );
|
|
|
|
|
5837 |
},
|
5838 |
|
5839 |
/**
|
@@ -5845,64 +6060,68 @@ module.exports = Backbone.View.extend( {
|
|
5845 |
buildContextualMenu: function ( e, menu ) {
|
5846 |
var thisView = this;
|
5847 |
|
5848 |
-
|
5849 |
-
|
5850 |
-
|
5851 |
-
|
5852 |
-
|
5853 |
-
|
5854 |
-
|
5855 |
-
|
5856 |
-
|
|
|
5857 |
|
5858 |
-
|
5859 |
-
|
5860 |
-
|
5861 |
-
|
5862 |
|
5863 |
-
|
5864 |
-
|
5865 |
-
|
5866 |
-
|
5867 |
-
|
5868 |
|
5869 |
-
|
5870 |
-
|
5871 |
-
|
|
|
5872 |
|
5873 |
-
|
5874 |
-
|
5875 |
-
|
5876 |
-
|
5877 |
-
|
5878 |
-
{
|
5879 |
-
|
5880 |
-
|
5881 |
-
|
5882 |
-
|
5883 |
-
|
5884 |
-
|
5885 |
-
|
5886 |
-
|
5887 |
-
|
|
|
5888 |
},
|
5889 |
-
|
5890 |
-
|
5891 |
-
|
5892 |
-
|
5893 |
-
|
5894 |
-
|
5895 |
-
|
5896 |
-
|
5897 |
-
|
5898 |
-
|
5899 |
-
|
5900 |
-
|
5901 |
-
|
5902 |
|
5903 |
-
|
5904 |
-
|
5905 |
-
|
|
|
5906 |
|
5907 |
// Lets also add the contextual menu for the entire row
|
5908 |
this.cell.row.buildContextualMenu( e, menu );
|
584 |
|
585 |
// Handle exporting the file
|
586 |
c.find( '.so-export' ).submit( function ( e ) {
|
587 |
+
var $$ = $( this );
|
588 |
$$.find( 'input[name="panels_export_data"]' ).val( JSON.stringify( thisView.builder.model.getPanelsData() ) );
|
589 |
} );
|
590 |
|
904 |
this.styles = new panels.view.styles();
|
905 |
this.styles.model = this.model;
|
906 |
this.styles.render( 'row', $( '#post_ID' ).val(), {
|
907 |
+
builderType: this.builder.config.builderType,
|
908 |
dialog: this
|
909 |
} );
|
910 |
|
911 |
+
if( ! this.builder.supports( 'addRow' ) ) {
|
912 |
+
this.$( '.so-buttons .so-duplicate' ).remove();
|
913 |
+
}
|
914 |
+
if( ! this.builder.supports( 'deleteRow' ) ) {
|
915 |
+
this.$( '.so-buttons .so-delete' ).remove();
|
916 |
+
}
|
917 |
+
|
918 |
var $rightSidebar = this.$( '.so-sidebar.so-right-sidebar' );
|
919 |
this.styles.attach( $rightSidebar );
|
920 |
|
1337 |
}, args );
|
1338 |
|
1339 |
// Set the cells
|
1340 |
+
if( ! _.isEmpty( this.model ) ) {
|
1341 |
this.model.setCells( this.row.cells );
|
1342 |
}
|
1343 |
|
1487 |
this.$( '.so-title .widget-name' ).html( panelsOptions.loc.missing_widget.title );
|
1488 |
}
|
1489 |
|
1490 |
+
if( ! this.builder.supports( 'addWidget' ) ) {
|
1491 |
+
this.$( '.so-buttons .so-duplicate' ).remove();
|
1492 |
+
}
|
1493 |
+
if( ! this.builder.supports( 'deleteWidget' ) ) {
|
1494 |
+
this.$( '.so-buttons .so-delete' ).remove();
|
1495 |
+
}
|
1496 |
+
|
1497 |
// Now we need to attach the style window
|
1498 |
this.styles = new panels.view.styles();
|
1499 |
this.styles.model = this.model;
|
1500 |
this.styles.render( 'widget', $( '#post_ID' ).val(), {
|
1501 |
+
builderType: this.builder.config.builderType,
|
1502 |
dialog: this
|
1503 |
} );
|
1504 |
|
1532 |
if ( currentIndex === 0 ) {
|
1533 |
return false;
|
1534 |
} else {
|
1535 |
+
do {
|
1536 |
+
widgetView = widgets.eq( --currentIndex ).data( 'view' );
|
1537 |
+
if ( ! _.isUndefined( widgetView ) && ! widgetView.model.get( 'read_only' ) ) {
|
1538 |
+
return widgetView.getEditDialog();
|
1539 |
+
}
|
1540 |
+
} while( ! _.isUndefined( widgetView ) && currentIndex > 0 );
|
1541 |
}
|
1542 |
+
|
1543 |
+
return false;
|
1544 |
},
|
1545 |
|
1546 |
/**
|
1552 |
if ( widgets.length <= 1 ) {
|
1553 |
return false;
|
1554 |
}
|
1555 |
+
|
1556 |
+
var currentIndex = widgets.index( this.widgetView.$el ), widgetView;
|
1557 |
|
1558 |
if ( currentIndex === widgets.length - 1 ) {
|
1559 |
return false;
|
1560 |
} else {
|
1561 |
+
do {
|
1562 |
+
widgetView = widgets.eq( ++currentIndex ).data( 'view' );
|
1563 |
+
if ( ! _.isUndefined( widgetView ) && ! widgetView.model.get( 'read_only' ) ) {
|
1564 |
+
return widgetView.getEditDialog();
|
1565 |
+
}
|
1566 |
+
} while( ! _.isUndefined( widgetView ) );
|
1567 |
}
|
1568 |
+
|
1569 |
+
return false;
|
1570 |
},
|
1571 |
|
1572 |
/**
|
1935 |
|
1936 |
var panels = window.panels, $ = jQuery;
|
1937 |
|
1938 |
+
module.exports = function ( config ) {
|
1939 |
|
1940 |
return this.each( function () {
|
1941 |
var $$ = jQuery( this );
|
1942 |
var widgetId = $$.closest( 'form' ).find( '.widget-id' ).val();
|
1943 |
|
1944 |
+
// Create a config for this specific widget
|
1945 |
+
var thisConfig = $.extend(true, {}, config);
|
1946 |
+
|
1947 |
// Exit if this isn't a real widget
|
1948 |
if ( ! _.isUndefined( widgetId ) && widgetId.indexOf( '__i__' ) > - 1 ) {
|
1949 |
return;
|
1954 |
|
1955 |
// Now for the view to display the builder
|
1956 |
var builderView = new panels.view.builder( {
|
1957 |
+
model: builderModel,
|
1958 |
+
config: thisConfig
|
1959 |
} );
|
1960 |
|
1961 |
// Save panels data when we close the dialog, if we're in a dialog
|
1985 |
.render()
|
1986 |
.attach( {
|
1987 |
container: $$,
|
1988 |
+
dialog: isWidget || $$.data('mode') === 'dialog',
|
1989 |
type: $$.data( 'type' )
|
1990 |
} )
|
1991 |
.setDataField( $$.find( 'input.panels-data' ) );
|
1992 |
|
1993 |
+
if ( isWidget || $$.data('mode') === 'dialog' ) {
|
1994 |
// Set up the dialog opening
|
1995 |
builderView.setDialogParents( panelsOptions.loc.layout_widget, builderView.dialog );
|
1996 |
$$.find( '.siteorigin-panels-display-builder' ).click( function ( e ) {
|
2011 |
/**
|
2012 |
* Everything we need for SiteOrigin Page Builder.
|
2013 |
*
|
2014 |
+
* @copyright Greg Priday 2013 - 2016 - <https://siteorigin.com/>
|
2015 |
* @license GPL 3.0 http://www.gnu.org/licenses/gpl.html
|
2016 |
*/
|
2017 |
|
2018 |
+
/* global Backbone, _, jQuery, tinyMCE, panelsOptions, plupload, confirm, console, require */
|
2019 |
|
2020 |
/**
|
2021 |
* Convert template into something compatible with Underscore.js templates
|
2082 |
// Set up Page Builder if we're on the main interface
|
2083 |
jQuery( function ( $ ) {
|
2084 |
|
2085 |
+
var container,
|
2086 |
+
field,
|
2087 |
+
form,
|
2088 |
+
builderConfig;
|
2089 |
|
2090 |
if ( $( '#siteorigin-panels-metabox' ).length && $( 'form#post' ).length ) {
|
2091 |
// This is usually the case when we're in the post edit interface
|
2092 |
container = $( '#siteorigin-panels-metabox' );
|
2093 |
field = $( '#siteorigin-panels-metabox .siteorigin-panels-data-field' );
|
2094 |
form = $( 'form#post' );
|
2095 |
+
|
2096 |
+
builderConfig = {
|
2097 |
+
editorType: 'tinymce',
|
2098 |
+
postId: $( '#post_ID' ).val(),
|
2099 |
+
editorId: '#content',
|
2100 |
+
builderType: $( '#siteorigin-panels-metabox' ).data( 'builder-type' ),
|
2101 |
+
builderSupports: $( '#siteorigin-panels-metabox' ).data( 'builder-supports' ),
|
2102 |
+
loadLiveEditor: $( '#siteorigin-panels-metabox' ).data('live-editor') == 1,
|
2103 |
+
liveEditorPreview: container.data('preview-url')
|
2104 |
+
};
|
2105 |
}
|
2106 |
else if ( $( '.siteorigin-panels-builder-form' ).length ) {
|
2107 |
// We're dealing with another interface like the custom home page interface
|
2108 |
var $$ = $( '.siteorigin-panels-builder-form' );
|
2109 |
+
|
2110 |
container = $$.find( '.siteorigin-panels-builder-container' );
|
2111 |
field = $$.find( 'input[name="panels_data"]' );
|
2112 |
form = $$;
|
2113 |
+
|
2114 |
+
builderConfig = {
|
2115 |
+
editorType: 'standalone',
|
2116 |
+
postId: $$.data( 'post-id' ),
|
2117 |
+
editorId: '#post_content',
|
2118 |
+
builderType: $$.data( 'type' ),
|
2119 |
+
builderSupports: $$.data( 'builder-supports' ),
|
2120 |
+
loadLiveEditor: false,
|
2121 |
+
liveEditorPreview: $$.data( 'preview-url' )
|
2122 |
+
};
|
2123 |
}
|
2124 |
|
2125 |
if ( ! _.isUndefined( container ) ) {
|
2129 |
// Create the main builder model
|
2130 |
var builderModel = new panels.model.builder();
|
2131 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2132 |
// Now for the view to display the builder
|
2133 |
var builderView = new panels.view.builder( {
|
2134 |
model: builderModel,
|
2139 |
builderView
|
2140 |
.render()
|
2141 |
.attach( {
|
2142 |
+
container: container
|
|
|
2143 |
} )
|
2144 |
.setDataField( field )
|
2145 |
+
.attachToEditor();
|
|
|
|
|
2146 |
|
2147 |
// When the form is submitted, update the panels data
|
2148 |
+
form.submit( function () {
|
2149 |
// Refresh the data
|
2150 |
builderModel.refreshPanelsData();
|
2151 |
} );
|
2291 |
newWidget.set( 'style', panels_info.style );
|
2292 |
}
|
2293 |
|
2294 |
+
if ( ! _.isUndefined( panels_info.read_only ) ) {
|
2295 |
+
newWidget.set( 'read_only', panels_info.read_only );
|
2296 |
+
}
|
2297 |
+
if ( ! _.isUndefined( panels_info.widget_id ) ) {
|
2298 |
+
newWidget.set( 'widget_id', panels_info.widget_id );
|
2299 |
+
}
|
2300 |
+
else {
|
2301 |
+
newWidget.set( 'widget_id', builderModel.generateUUID() );
|
2302 |
+
}
|
2303 |
+
|
2304 |
newWidget.cell = cell;
|
2305 |
+
cell.widgets.add( newWidget, { noAnimate: true } );
|
2306 |
} );
|
2307 |
|
2308 |
this.trigger( 'load_panels_data' );
|
2369 |
*/
|
2370 |
getPanelsData: function () {
|
2371 |
|
2372 |
+
var builder = this;
|
2373 |
+
|
2374 |
var data = {
|
2375 |
'widgets': [],
|
2376 |
'grids': [],
|
2384 |
|
2385 |
cell.widgets.each( function ( widget, wi ) {
|
2386 |
// Add the data for the widget, including the panels_info field.
|
2387 |
+
var panels_info = {
|
2388 |
+
class: widget.get( 'class' ),
|
2389 |
+
raw: widget.get( 'raw' ),
|
2390 |
+
grid: ri,
|
2391 |
+
cell: ci,
|
2392 |
+
// Strictly this should be an index
|
2393 |
+
id: widgetId ++,
|
2394 |
+
widget_id: widget.get( 'widget_id' ),
|
2395 |
+
style: widget.get( 'style' )
|
2396 |
+
};
|
2397 |
+
|
2398 |
+
if( _.isEmpty( panels_info.widget_id ) ) {
|
2399 |
+
panels_info.widget_id = builder.generateUUID();
|
2400 |
+
}
|
2401 |
+
|
2402 |
var values = _.extend( _.clone( widget.get( 'values' ) ), {
|
2403 |
+
panels_info: panels_info
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2404 |
} );
|
2405 |
data.widgets.push( values );
|
2406 |
} );
|
2458 |
return position === this.layoutPosition.BEFORE ||
|
2459 |
position === this.layoutPosition.AFTER ||
|
2460 |
position === this.layoutPosition.REPLACE;
|
2461 |
+
},
|
2462 |
+
|
2463 |
+
generateUUID: function(){
|
2464 |
+
var d = new Date().getTime();
|
2465 |
+
if( window.performance && typeof window.performance.now === "function" ){
|
2466 |
+
d += performance.now(); //use high-precision timer if available
|
2467 |
+
}
|
2468 |
+
var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace( /[xy]/g, function(c) {
|
2469 |
+
var r = (d + Math.random()*16)%16 | 0;
|
2470 |
+
d = Math.floor(d/16);
|
2471 |
+
return ( c == 'x' ? r : (r&0x3|0x8) ).toString(16);
|
2472 |
+
} );
|
2473 |
+
return uuid;
|
2474 |
}
|
2475 |
|
2476 |
} );
|
2696 |
raw: false,
|
2697 |
|
2698 |
// Visual style fields
|
2699 |
+
style: {},
|
2700 |
+
|
2701 |
+
read_only: false,
|
2702 |
+
widget_id: '',
|
2703 |
},
|
2704 |
|
2705 |
indexes: null,
|
3197 |
module.exports = Backbone.View.extend( {
|
3198 |
|
3199 |
// Config options
|
3200 |
+
config: {},
|
|
|
|
|
3201 |
|
3202 |
template: _.template( $( '#siteorigin-panels-builder' ).html().panelsProcessTemplate() ),
|
3203 |
dialogs: {},
|
3209 |
liveEditor: undefined,
|
3210 |
menu: false,
|
3211 |
|
|
|
|
|
|
|
3212 |
events: {
|
3213 |
'click .so-tool-button.so-widget-add': 'displayAddWidgetDialog',
|
3214 |
'click .so-tool-button.so-row-add': 'displayAddRowDialog',
|
3226 |
initialize: function ( options ) {
|
3227 |
var builder = this;
|
3228 |
|
3229 |
+
this.config = _.extend( {
|
3230 |
+
loadLiveEditor: false,
|
3231 |
+
builderSupports : {}
|
3232 |
+
}, options.config);
|
3233 |
+
|
3234 |
+
this.config.builderSupports = _.extend( {
|
3235 |
+
addRow: true,
|
3236 |
+
editRow: true,
|
3237 |
+
deleteRow: true,
|
3238 |
+
moveRow: true,
|
3239 |
+
addWidget: true,
|
3240 |
+
editWidget: true,
|
3241 |
+
deleteWidget: true,
|
3242 |
+
moveWidget: true,
|
3243 |
+
prebuilt: true,
|
3244 |
+
history: true,
|
3245 |
+
liveEditor: true,
|
3246 |
+
revertToEditor: true
|
3247 |
+
}, this.config.builderSupports );
|
3248 |
+
|
3249 |
+
// Automatically load the live editor as soon as it's ready
|
3250 |
+
if( options.config.loadLiveEditor ) {
|
3251 |
+
this.on( 'builder_live_editor_added', function(){
|
3252 |
+
this.displayLiveEditor();
|
3253 |
+
} );
|
3254 |
}
|
|
|
3255 |
|
3256 |
// Now lets create all the dialog boxes that the main builder interface uses
|
3257 |
this.dialogs = {
|
3319 |
attach: function ( options ) {
|
3320 |
|
3321 |
options = _.extend( {
|
|
|
3322 |
container: false,
|
3323 |
dialog: false
|
3324 |
}, options );
|
3335 |
this.trigger( 'attached_to_container', options.container );
|
3336 |
}
|
3337 |
|
|
|
|
|
|
|
3338 |
this.trigger( 'builder_attached' );
|
3339 |
|
3340 |
+
// Add support for components we have
|
3341 |
+
|
3342 |
+
if( this.supports( 'liveEditor' ) ) {
|
3343 |
+
this.addLiveEditor();
|
3344 |
+
}
|
3345 |
+
if( this.supports( 'history' ) ) {
|
3346 |
+
this.addHistoryBrowser();
|
3347 |
+
}
|
3348 |
+
|
3349 |
+
// Hide toolbar buttons we don't support
|
3350 |
+
var toolbar = this.$('.so-builder-toolbar');
|
3351 |
+
if( ! this.supports( 'addWidget' ) ) {
|
3352 |
+
toolbar.find('.so-widget-add' ).hide();
|
3353 |
+
}
|
3354 |
+
if( ! this.supports( 'addRow' ) ) {
|
3355 |
+
toolbar.find('.so-row-add' ).hide();
|
3356 |
+
}
|
3357 |
+
if( ! this.supports( 'prebuilt' ) ) {
|
3358 |
+
toolbar.find('.so-prebuilt-add' ).hide();
|
3359 |
+
}
|
3360 |
+
|
3361 |
return this;
|
3362 |
},
|
3363 |
|
3367 |
* @returns {panels.view.builder}
|
3368 |
*/
|
3369 |
attachToEditor: function () {
|
3370 |
+
if ( this.config.editorType !== 'tinymce' ) {
|
3371 |
return this;
|
3372 |
}
|
3373 |
|
3410 |
);
|
3411 |
|
3412 |
// Switch back to the standard editor
|
3413 |
+
if( this.supports( 'revertToEditor' ) ) {
|
3414 |
+
metabox.find( '.so-switch-to-standard' ).click( function ( e ) {
|
3415 |
+
e.preventDefault();
|
3416 |
|
3417 |
+
if ( ! confirm( panelsOptions.loc.confirm_stop_builder ) ) {
|
3418 |
+
return;
|
3419 |
+
}
|
3420 |
|
3421 |
+
// User is switching to the standard visual editor
|
3422 |
+
thisView.addHistoryEntry( 'back_to_editor' );
|
3423 |
+
thisView.model.loadPanelsData( false );
|
3424 |
|
3425 |
+
// Switch back to the standard editor
|
3426 |
+
$( '#wp-content-wrap, #post-status-info' ).show();
|
3427 |
+
metabox.hide();
|
3428 |
|
3429 |
+
// Resize to trigger reflow of WordPress editor stuff
|
3430 |
+
$( window ).resize();
|
3431 |
+
} ).show();
|
3432 |
+
}
|
3433 |
|
3434 |
// Move the panels box into a tab of the content editor
|
3435 |
metabox.insertAfter( '#wp-content-wrap' ).hide().addClass( 'attached-to-editor' );
|
3507 |
* Initialize the row sortables
|
3508 |
*/
|
3509 |
initSortable: function () {
|
3510 |
+
if( ! this.supports( 'moveRow' ) ) {
|
3511 |
+
return this;
|
3512 |
+
}
|
3513 |
+
|
3514 |
// Create the sortable for the rows
|
|
|
3515 |
var builderView = this;
|
3516 |
|
3517 |
this.rowsSortable = this.$( '.so-rows-container' ).sortable( {
|
3528 |
builderView.sortCollections();
|
3529 |
}
|
3530 |
} );
|
3531 |
+
|
3532 |
+
return this;
|
3533 |
},
|
3534 |
|
3535 |
/**
|
3736 |
},
|
3737 |
|
3738 |
/**
|
3739 |
+
* Add a live editor to the builder
|
3740 |
*
|
3741 |
* @returns {panels.view.builder}
|
3742 |
*/
|
3743 |
+
addLiveEditor: function ( ) {
|
3744 |
+
if( _.isEmpty( this.config.liveEditorPreview ) ) {
|
3745 |
+
return this;
|
3746 |
+
}
|
3747 |
+
|
3748 |
// Create the live editor and set the builder to this.
|
3749 |
+
this.liveEditor = new panels.view.liveEditor( {
|
3750 |
+
builder: this,
|
3751 |
+
previewUrl: this.config.liveEditorPreview
|
3752 |
+
} );
|
3753 |
|
3754 |
// Display the live editor button in the toolbar
|
3755 |
if ( this.liveEditor.hasPreviewUrl() ) {
|
3778 |
* @return {panels.view.builder}
|
3779 |
*/
|
3780 |
addHistoryBrowser: function () {
|
3781 |
+
if( _.isEmpty( this.config.liveEditorPreview ) ) {
|
3782 |
+
return this;
|
3783 |
+
}
|
3784 |
+
|
3785 |
this.dialogs.history = new panels.dialog.history();
|
3786 |
this.dialogs.history.builder = this;
|
3787 |
this.dialogs.history.entries.builder = this.model;
|
3809 |
}
|
3810 |
},
|
3811 |
|
3812 |
+
supports: function( thing ){
|
3813 |
+
|
3814 |
+
if( thing === 'rowAction' ) {
|
3815 |
+
// Check if this supports any row action
|
3816 |
+
return this.supports( 'addRow' ) || this.supports( 'editRow' ) || this.supports( 'deleteRow' );
|
3817 |
+
} else if ( thing === 'widgetAction' ) {
|
3818 |
+
// Check if this supports any widget action
|
3819 |
+
return this.supports( 'addWidget' ) || this.supports( 'editWidget' ) || this.supports( 'deleteWidget' );
|
3820 |
+
}
|
3821 |
+
|
3822 |
+
return _.isUndefined( this.config.builderSupports[ thing ] ) ? false : this.config.builderSupports[ thing ];
|
3823 |
+
},
|
3824 |
+
|
3825 |
/**
|
3826 |
* Handle a change of the content
|
3827 |
*/
|
3838 |
{
|
3839 |
action: 'so_panels_builder_content',
|
3840 |
panels_data: JSON.stringify( panelsData ),
|
3841 |
+
post_id: this.config.postId
|
3842 |
},
|
3843 |
function ( content ) {
|
3844 |
|
3870 |
*/
|
3871 |
updateEditorContent: function ( content ) {
|
3872 |
// Switch back to the standard editor
|
3873 |
+
if ( this.config.editorType !== 'tinymce' || _.isUndefined( tinyMCE ) || _.isNull( tinyMCE.get( "content" ) ) ) {
|
3874 |
+
var $editor = $( this.config.editorId );
|
3875 |
$editor.val( content ).trigger( 'change' ).trigger( 'keyup' );
|
3876 |
} else {
|
3877 |
var contentEd = tinyMCE.get( "content" );
|
3927 |
}
|
3928 |
|
3929 |
if (
|
3930 |
+
(
|
3931 |
+
_.isEmpty( this.model.get( 'data' ) ) ||
|
3932 |
+
( _.isEmpty( this.model.get( 'data' ).widgets ) && _.isEmpty( this.model.get( 'data' ).grids ) )
|
3933 |
+
) &&
|
3934 |
editorContent !== ''
|
3935 |
) {
|
3936 |
// Confirm that the user wants to copy their content to Page Builder.
|
4156 |
* Initialize the widget sortable
|
4157 |
*/
|
4158 |
initSortable: function () {
|
4159 |
+
if( ! this.row.builder.supports( 'moveWidget' ) ) {
|
4160 |
+
return this;
|
4161 |
+
}
|
4162 |
+
|
4163 |
var cellView = this;
|
4164 |
|
4165 |
// Go up the view hierarchy until we find the ID attribute
|
4209 |
return helper;
|
4210 |
}
|
4211 |
} );
|
4212 |
+
|
4213 |
+
return this;
|
4214 |
},
|
4215 |
|
4216 |
/**
|
4217 |
* Refresh the widget sortable when a new widget is added
|
4218 |
*/
|
4219 |
refreshSortable: function () {
|
4220 |
+
if ( ! _.isNull( this.widgetSortable ) ) {
|
4221 |
+
this.widgetSortable.sortable( 'refresh' );
|
4222 |
+
}
|
4223 |
},
|
4224 |
|
4225 |
/**
|
4226 |
* This will make the cell resizble
|
4227 |
*/
|
4228 |
initResizable: function () {
|
4229 |
+
if( ! this.row.builder.supports( 'editRow' ) ) {
|
4230 |
+
return this;
|
4231 |
+
}
|
4232 |
+
|
4233 |
// var neighbor = this.$el.previous().data('view');
|
4234 |
var handle = this.$( '.resize-handle' ).css( 'position', 'absolute' );
|
4235 |
var container = this.row.$el;
|
4324 |
}
|
4325 |
} );
|
4326 |
|
4327 |
+
return this;
|
4328 |
},
|
4329 |
|
4330 |
/**
|
4929 |
module.exports = Backbone.View.extend( {
|
4930 |
template: _.template( $( '#siteorigin-panels-live-editor' ).html().panelsProcessTemplate() ),
|
4931 |
|
|
|
4932 |
previewScrollTop: 0,
|
4933 |
loadTimes: [],
|
4934 |
previewFrameId: 1,
|
4935 |
+
previewUrl: null,
|
4936 |
previewIframe: null,
|
4937 |
|
4938 |
events: {
|
4942 |
},
|
4943 |
|
4944 |
initialize: function ( options ) {
|
4945 |
+
options = _.extend( {
|
4946 |
+
builder: false,
|
4947 |
+
previewUrl: false,
|
4948 |
+
}, options );
|
4949 |
+
|
4950 |
+
if( _.isEmpty( options.previewUrl ) ) {
|
4951 |
+
options.previewUrl = panelsOptions.ajaxurl + "&action=so_panels_live_editor_preview";
|
4952 |
+
}
|
4953 |
+
|
4954 |
this.builder = options.builder;
|
4955 |
+
this.previewUrl = options.previewUrl;
|
4956 |
+
|
4957 |
this.builder.model.on( 'refresh_panels_data', this.handleRefreshData, this );
|
4958 |
this.builder.model.on( 'load_panels_data', this.handleLoadData, this );
|
4959 |
},
|
5005 |
this.$el.appendTo( 'body' );
|
5006 |
},
|
5007 |
|
|
|
|
|
|
|
|
|
5008 |
/**
|
5009 |
* Display the live editor
|
5010 |
*/
|
5096 |
body.find( '.panel-grid .panel-grid-cell .so-panel' )
|
5097 |
.filter( function () {
|
5098 |
// Filter to only include non nested
|
5099 |
+
return $( this ).parents( '.so-panel' ).length === 0;
|
5100 |
} )
|
5101 |
.not( over )
|
5102 |
.addClass( 'so-panels-faded' );
|
5167 |
|
5168 |
|
5169 |
this.postToIframe(
|
5170 |
+
{
|
5171 |
+
live_editor_panels_data: JSON.stringify( data )
|
5172 |
+
},
|
5173 |
+
this.previewUrl,
|
5174 |
this.$('.so-preview')
|
5175 |
);
|
5176 |
|
5263 |
$iframeContents.find( '.panel-grid .panel-grid-cell .so-panel' )
|
5264 |
.filter( function () {
|
5265 |
// Filter to only include non nested
|
5266 |
+
return $( this ).parents( '.so-panel' ).length === 0;
|
5267 |
} )
|
5268 |
.each( function ( i, el ) {
|
5269 |
var $$ = $( el );
|
5383 |
cellView.$el.appendTo( thisView.$( '.so-cells' ) );
|
5384 |
} );
|
5385 |
|
5386 |
+
// Remove any unsupported actions
|
5387 |
+
if( ! this.builder.supports( 'rowAction' ) ) {
|
5388 |
+
this.$('.so-row-toolbar .so-dropdown-wrapper' ).remove();
|
5389 |
+
this.$el.addClass('so-row-no-actions');
|
5390 |
+
}
|
5391 |
+
else {
|
5392 |
+
if( ! this.builder.supports( 'editWidget' ) ) {
|
5393 |
+
this.$('.so-row-toolbar .so-row-settings' ).parent().remove();
|
5394 |
+
this.$el.addClass('so-row-no-edit');
|
5395 |
+
}
|
5396 |
+
if( ! this.builder.supports( 'addWidget' ) ) {
|
5397 |
+
this.$('.so-row-toolbar .so-row-duplicate' ).parent().remove();
|
5398 |
+
this.$el.addClass('so-row-no-duplicate');
|
5399 |
+
}
|
5400 |
+
if( ! this.builder.supports( 'deleteWidget' ) ) {
|
5401 |
+
this.$('.so-row-toolbar .so-row-delete' ).parent().remove();
|
5402 |
+
this.$el.addClass('so-row-no-delete');
|
5403 |
+
}
|
5404 |
+
}
|
5405 |
+
if( ! this.builder.supports( 'moveRow' ) ) {
|
5406 |
+
this.$('.so-row-toolbar .so-row-move' ).remove();
|
5407 |
+
this.$el.addClass('so-row-no-move');
|
5408 |
+
}
|
5409 |
+
if( !$.trim( this.$('.so-row-toolbar').html() ).length ) {
|
5410 |
+
this.$('.so-row-toolbar' ).remove();
|
5411 |
+
}
|
5412 |
+
|
5413 |
// Resize the rows when ever the widget sortable moves
|
5414 |
this.builder.on( 'widget_sortable_move', this.resize, this );
|
5415 |
this.builder.on( 'builder_resize', this.resize, this );
|
5532 |
}
|
5533 |
|
5534 |
this.dialog.openDialog();
|
5535 |
+
|
5536 |
+
return this;
|
5537 |
},
|
5538 |
|
5539 |
/**
|
5541 |
*/
|
5542 |
deleteHandler: function () {
|
5543 |
this.model.destroy();
|
5544 |
+
return this;
|
5545 |
},
|
5546 |
|
5547 |
/**
|
5590 |
} );
|
5591 |
}
|
5592 |
|
5593 |
+
if( this.builder.supports( 'addRow' ) ) {
|
5594 |
+
menu.addSection(
|
5595 |
+
{
|
5596 |
+
sectionTitle: panelsOptions.loc.contextual.add_row,
|
5597 |
+
search: false
|
5598 |
+
},
|
5599 |
+
options,
|
5600 |
+
function ( c ) {
|
5601 |
+
thisView.builder.addHistoryEntry( 'row_added' );
|
5602 |
+
|
5603 |
+
var columns = Number( c ) + 1;
|
5604 |
+
var weights = [];
|
5605 |
+
for ( var i = 0; i < columns; i ++ ) {
|
5606 |
+
weights.push( 100 / columns );
|
5607 |
+
}
|
5608 |
|
5609 |
+
// Create the actual row
|
5610 |
+
var newRow = new panels.model.row( {
|
5611 |
+
collection: thisView.collection
|
5612 |
+
} );
|
|
|
5613 |
|
5614 |
+
newRow.setCells( weights );
|
5615 |
+
newRow.builder = thisView.builder;
|
|
|
|
|
5616 |
|
5617 |
+
thisView.builder.model.rows.add( newRow, {
|
5618 |
+
at: thisView.builder.model.rows.indexOf( thisView.model ) + 1
|
5619 |
+
} );
|
5620 |
|
5621 |
+
thisView.builder.model.refreshPanelsData();
|
5622 |
+
}
|
5623 |
+
);
|
5624 |
+
}
|
5625 |
|
5626 |
+
actions = {};
|
|
|
|
|
5627 |
|
5628 |
+
if( this.builder.supports( 'editRow' ) ) {
|
5629 |
+
actions.edit = { title: panelsOptions.loc.contextual.row_edit };
|
5630 |
+
}
|
5631 |
+
if( this.builder.supports( 'addRow' ) ) {
|
5632 |
+
actions.duplicate = { title: panelsOptions.loc.contextual.row_duplicate };
|
5633 |
+
}
|
5634 |
+
if( this.builder.supports( 'deleteRow' ) ) {
|
5635 |
+
actions.delete = { title: panelsOptions.loc.contextual.row_delete, confirm: true };
|
5636 |
+
}
|
5637 |
+
|
5638 |
+
if( ! _.isEmpty( actions ) ) {
|
5639 |
+
menu.addSection(
|
5640 |
+
{
|
5641 |
+
sectionTitle: panelsOptions.loc.contextual.row_actions,
|
5642 |
+
search: false,
|
5643 |
},
|
5644 |
+
actions,
|
5645 |
+
function ( c ) {
|
5646 |
+
switch ( c ) {
|
5647 |
+
case 'edit':
|
5648 |
+
thisView.editSettingsHandler();
|
5649 |
+
break;
|
5650 |
+
case 'duplicate':
|
5651 |
+
thisView.duplicateHandler();
|
5652 |
+
break;
|
5653 |
+
case 'delete':
|
5654 |
+
thisView.visualDestroyModel();
|
5655 |
+
break;
|
5656 |
+
}
|
5657 |
}
|
5658 |
+
);
|
5659 |
+
}
|
5660 |
}
|
5661 |
|
5662 |
} );
|
5877 |
|
5878 |
events: {
|
5879 |
'click .widget-edit': 'editHandler',
|
5880 |
+
'click .title h4': 'titleClickHandler',
|
5881 |
'click .actions .widget-duplicate': 'duplicateHandler',
|
5882 |
'click .actions .widget-delete': 'deleteHandler'
|
5883 |
},
|
5908 |
|
5909 |
this.$el.data( 'view', this );
|
5910 |
|
5911 |
+
// Remove any unsupported actions
|
5912 |
+
if( ! this.cell.row.builder.supports( 'editWidget' ) || this.model.get( 'read_only' ) ) {
|
5913 |
+
this.$( '.actions .widget-edit' ).remove();
|
5914 |
+
this.$el.addClass('so-widget-no-edit');
|
5915 |
+
}
|
5916 |
+
if( ! this.cell.row.builder.supports( 'addWidget' ) ) {
|
5917 |
+
this.$( '.actions .widget-duplicate' ).remove();
|
5918 |
+
this.$el.addClass('so-widget-no-duplicate');
|
5919 |
+
}
|
5920 |
+
if( ! this.cell.row.builder.supports( 'deleteWidget' ) ) {
|
5921 |
+
this.$( '.actions .widget-delete' ).remove();
|
5922 |
+
this.$el.addClass('so-widget-no-delete');
|
5923 |
+
}
|
5924 |
+
if( ! this.cell.row.builder.supports( 'moveWidget' ) ) {
|
5925 |
+
this.$el.addClass('so-widget-no-move');
|
5926 |
+
}
|
5927 |
+
if( !$.trim( this.$('.actions').html() ).length ) {
|
5928 |
+
this.$( '.actions' ).remove();
|
5929 |
+
}
|
5930 |
+
|
5931 |
+
if( this.model.get( 'read_only' ) ) {
|
5932 |
+
this.$el.addClass('so-widget-read-only');
|
5933 |
+
}
|
5934 |
+
|
5935 |
if ( _.size( this.model.get( 'values' ) ) === 0 || options.loadForm ) {
|
5936 |
// If this widget doesn't have a value, create a form and save it
|
5937 |
var dialog = this.getEditDialog();
|
5979 |
editHandler: function () {
|
5980 |
// Create a new dialog for editing this
|
5981 |
this.getEditDialog().openDialog();
|
5982 |
+
return this;
|
5983 |
+
},
|
5984 |
+
|
5985 |
+
titleClickHandler: function(){
|
5986 |
+
if( ! this.cell.row.builder.supports( 'editWidget' ) || this.model.get( 'read_only' ) ) {
|
5987 |
+
return this;
|
5988 |
+
}
|
5989 |
+
this.editHandler();
|
5990 |
+
return this;
|
5991 |
},
|
5992 |
|
5993 |
/**
|
6008 |
} );
|
6009 |
|
6010 |
this.cell.row.builder.model.refreshPanelsData();
|
6011 |
+
return this;
|
6012 |
},
|
6013 |
|
6014 |
/**
|
6018 |
*/
|
6019 |
deleteHandler: function () {
|
6020 |
this.model.trigger( 'visual_destroy' );
|
6021 |
+
return this;
|
6022 |
},
|
6023 |
|
6024 |
onModelChange: function () {
|
6047 |
thisView.cell.row.builder.model.refreshPanelsData();
|
6048 |
thisView.remove();
|
6049 |
} );
|
6050 |
+
|
6051 |
+
return this;
|
6052 |
},
|
6053 |
|
6054 |
/**
|
6060 |
buildContextualMenu: function ( e, menu ) {
|
6061 |
var thisView = this;
|
6062 |
|
6063 |
+
if( this.cell.row.builder.supports( 'addWidget' ) ) {
|
6064 |
+
menu.addSection(
|
6065 |
+
{
|
6066 |
+
sectionTitle: panelsOptions.loc.contextual.add_widget_below,
|
6067 |
+
searchPlaceholder: panelsOptions.loc.contextual.search_widgets,
|
6068 |
+
defaultDisplay: panelsOptions.contextual.default_widgets
|
6069 |
+
},
|
6070 |
+
panelsOptions.widgets,
|
6071 |
+
function ( c ) {
|
6072 |
+
thisView.cell.row.builder.addHistoryEntry( 'widget_added' );
|
6073 |
|
6074 |
+
var widget = new panels.model.widget( {
|
6075 |
+
class: c
|
6076 |
+
} );
|
6077 |
+
widget.cell = thisView.cell.model;
|
6078 |
|
6079 |
+
// Insert the new widget below
|
6080 |
+
thisView.cell.model.widgets.add( widget, {
|
6081 |
+
// Add this after the existing model
|
6082 |
+
at: thisView.model.collection.indexOf( thisView.model ) + 1
|
6083 |
+
} );
|
6084 |
|
6085 |
+
thisView.cell.row.builder.model.refreshPanelsData();
|
6086 |
+
}
|
6087 |
+
);
|
6088 |
+
}
|
6089 |
|
6090 |
+
var actions = {};
|
6091 |
+
if( this.cell.row.builder.supports( 'editWidget' ) && ! this.model.get( 'read_only' ) ) {
|
6092 |
+
actions.edit = { title: panelsOptions.loc.contextual.widget_edit };
|
6093 |
+
}
|
6094 |
+
if( this.cell.row.builder.supports( 'addWidget' ) ) {
|
6095 |
+
actions.duplicate = { title: panelsOptions.loc.contextual.widget_duplicate };
|
6096 |
+
}
|
6097 |
+
if( this.cell.row.builder.supports( 'deleteWidget' ) ) {
|
6098 |
+
actions.delete = { title: panelsOptions.loc.contextual.widget_delete, confirm: true };
|
6099 |
+
}
|
6100 |
+
|
6101 |
+
if( ! _.isEmpty( actions ) ) {
|
6102 |
+
menu.addSection(
|
6103 |
+
{
|
6104 |
+
sectionTitle: panelsOptions.loc.contextual.widget_actions,
|
6105 |
+
search: false,
|
6106 |
},
|
6107 |
+
actions,
|
6108 |
+
function ( c ) {
|
6109 |
+
switch ( c ) {
|
6110 |
+
case 'edit':
|
6111 |
+
thisView.editHandler();
|
6112 |
+
break;
|
6113 |
+
case 'duplicate':
|
6114 |
+
thisView.duplicateHandler();
|
6115 |
+
break;
|
6116 |
+
case 'delete':
|
6117 |
+
thisView.visualDestroyModel();
|
6118 |
+
break;
|
6119 |
+
}
|
6120 |
|
6121 |
+
thisView.cell.row.builder.model.refreshPanelsData();
|
6122 |
+
}
|
6123 |
+
);
|
6124 |
+
}
|
6125 |
|
6126 |
// Lets also add the contextual menu for the entire row
|
6127 |
this.cell.row.buildContextualMenu( e, menu );
|
js/siteorigin-panels-24.min.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
!function e(t,i,s){function l(n,a){if(!i[n]){if(!t[n]){var r="function"==typeof require&&require;if(!a&&r)return r(n,!0);if(o)return o(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 l(i?i:e)},c,c.exports,e,t,i,s)}return i[n].exports}for(var o="function"==typeof require&&require,n=0;n<s.length;n++)l(s[n]);return l}({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,l=jQuery;t.exports=s.view.dialog.extend({dialogClass:"so-panels-dialog-add-builder",render:function(){this.renderDialog(this.parseDialogContent(l("#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,l=jQuery;t.exports=s.view.dialog.extend({historyEntryTemplate:_.template(l("#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(l("#siteorigin-panels-dialog-history").html(),{})),this.$("iframe.siteorigin-panels-history-iframe").load(function(){var t=l(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)||l(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")});l(s).data("historyEntry",i).prependTo(t)}),l(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,l=jQuery;t.exports=s.view.dialog.extend({directoryTemplate:_.template(l("#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(l("#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=l(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(l("#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,l){var o=JSON.parse(l.response);_.isUndefined(o.widgets)?alert(panelsOptions.plupload.error_message):(t.uploadedLayout=o,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(){l(this).addClass("file-dragover")}).on("dragleave",function(){l(this).removeClass("file-dragover")}),e.find(".so-export").submit(function(e){var i=jQuery(this);i.find('input[name="panels_export_data"]').val(JSON.stringify(t.builder.model.getPanelsData()))})},displayLayoutDirectory:function(e,t,i){var s=this,o=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 l.get(panelsOptions.ajaxurl,{action:"so_panels_layouts_query",search:e,page:t,type:i},function(n){if(s.currentTab===i){o.removeClass("so-panels-loading").html(s.directoryTemplate(n));var a=o.find(".so-previous"),r=o.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)}),o.find(".so-screenshot").each(function(){var e=l(this),t=e.find(".so-screenshot-wrapper");if(t.css("height",t.width()/4*3+"px").addClass("so-loading"),""!==e.data("src"))var i=l("<img/>").attr("src",e.data("src")).load(function(){t.removeClass("so-loading").css("height","auto"),i.appendTo(t).hide().fadeIn("fast")});else l("<img/>").attr("src",panelsOptions.prebuiltDefaultScreenshot).appendTo(t).hide().fadeIn("fast")}),o.find(".so-directory-browse").html(n.title)}},"json"):(o.removeClass("so-panels-loading").html(l("#siteorigin-panels-directory-enable").html()),void o.find(".so-panels-enable-directory").click(function(i){i.preventDefault(),l.get(panelsOptions.ajaxurl,{action:"so_panels_directory_enable"},function(){}),panelsOptions.directory_enabled=!0,o.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 l.Deferred;return l.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(l(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,l=jQuery;t.exports=s.view.dialog.extend({cellPreviewTemplate:_.template(l("#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(l("#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",l("#post_ID").val(),{builderType:this.builder.builderType,dialog:this});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(){l(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,o){var n=l(this.cellPreviewTemplate({weight:s}));t.append(n);var a,r=n.prev();r.length&&(a=l('<div class="resize-handle"></div>'),a.appendTo(n).dblclick(function(){var t=e.row.cells[o]+e.row.cells[o-1];e.row.cells[o]=e.row.cells[o-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(),l(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[o]-(s.position.left+6)/t.width(),a=e.row.cells[o-1]+(s.position.left+6)/t.width();s.helper.offset().left-t.offset().left-6;l(this).data("newCellClone").css("width",t.width()*n).find(".preview-cell-weight").html(Math.round(1e3*n)/10),l(this).data("prevCellClone").css("width",t.width()*a).find(".preview-cell-weight").html(Math.round(1e3*a)/10)},stop:function(i,s){l(this).data("newCellClone").remove(),l(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[o]-d>.02&&e.row.cells[o-1]+d>.02&&(e.row.cells[o]-=d,e.row.cells[o-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();l('<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&&l(this).removeClass("no-user-interacted"),13===e.keyCode&&(e.preventDefault(),l(this).blur())}).keydown(function(e){if(9===e.keyCode){e.preventDefault();var i=t.find(".preview-cell-weight-input"),s=i.index(l(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(l(i).val()))&&l(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=[],o=0,n=0;if(t.find(".preview-cell-weight-input").each(function(t,a){var r=parseFloat(l(a).val());r=isNaN(r)?1/e.row.cells.length:Math.round(10*r)/1e3;var d=!l(a).hasClass("no-user-interacted");i.push(r),s.push(d),d?o+=r:n+=r}),o>0&&n>0&&1-o>0)for(var a=0;a<i.length;a++)s[a]||(i[a]=i[a]/n*(1-o));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){l(i).animate({width:Math.round(1e3*e.row.cells[t])/10+"%"},250),l(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(){l(this).select()})}),l(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){l(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,o=0;o<e.cells;o++)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){l(t).animate({width:Math.round(1e3*a.row.cells[e])/10+"%"},250),l(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),_.isUndefined(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,l=jQuery;t.exports=s.view.dialog.extend({builder:null,sidebarWidgetTemplate:_.template(l("#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(l("#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.styles=new s.view.styles,this.styles.model=this.model,this.styles.render("widget",l("#post_ID").val(),{builderType:this.builder.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;var i=e.eq(t-1).data("view");return _.isUndefined(i)?!1:i.getEditDialog()},getNextDialog:function(){var e=this.builder.$(".so-cells .cell .so-widget");if(e.length<=1)return!1;var t=e.index(this.widgetView.$el);if(t===e.length-1)return!1;var i=e.eq(t+1).data("view");return _.isUndefined(i)?!1:i.getEditDialog()},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")};l.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,l=jQuery;t.exports=s.view.dialog.extend({builder:null,widgetTemplate:_.template(l("#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(l("#siteorigin-panels-dialog-widgets").html(),{})),_.each(panelsOptions.widgets,function(e){var t=l(this.widgetTemplate({title:e.title,description:e.description}));_.isUndefined(e.icon)&&(e.icon="dashicons dashicons-admin-generic"),l('<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){l(this.dialogTabTemplate({title:t.title})).data({message:t.message,filter:t.filter}).appendTo(e)},this),this.initTabs();var t=this;l(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=l(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=l(this),s=i.data("class"),o=_.isUndefined(panelsOptions.widgets[s])?null:panelsOptions.widgets[s];t=_.isEmpty(e.groups)?!0:null===o||_.isEmpty(_.intersection(e.groups,panelsOptions.widgets[s].groups))?!1:!0,t&&(_.isUndefined(e.search)||""===e.search||-1===o.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=l(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&&l(t).css("clear","both")}),this.$(".widget-type-wrapper").css("height","auto").filter(":visible").each(function(e,s){var o=l(s);null!==i&&i.position().top!==o.position().top&&(t[t.length]=[]),i=o,t[t.length-1].push(o)}),_.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,l=jQuery;t.exports=function(){return this.each(function(){var e=jQuery(this),t=e.closest("form").find(".widget-id").val();if(_.isUndefined(t)||!(t.indexOf("__i__")>-1)){var i=new s.model.builder,o=new s.view.builder({model:i}),n=e.closest(".so-panels-dialog-wrapper").data("view");_.isUndefined(n)||(n.on("close_dialog",function(){i.refreshPanelsData()}),n.on("open_dialog_complete",function(){o.trigger("builder_resize")}),n.model.on("destroy",function(){i.emptyRows().destroy()}),o.setDialogParents(panelsOptions.loc.layout_widget,n));var a=Boolean(e.closest(".widget-content").length);o.render().attach({container:e,dialog:a,type:e.data("type")}).setDataField(e.find("input.panels-data")),a?(o.setDialogParents(panelsOptions.loc.layout_widget,o.dialog),e.find(".siteorigin-panels-display-builder").click(function(e){e.preventDefault(),o.dialog.openDialog()})):e.find(".siteorigin-panels-display-builder").parent().remove(),l(document).trigger("panels_setup",o)}})}},{}],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,l,o,n,a,r;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"),l="tinymce",o="#content",n=e("#post_ID").val(),a="editor_attached",r=1==e("#siteorigin-panels-metabox").data("live-editor");else if(e(".siteorigin-panels-builder-form").length){var d=e(".siteorigin-panels-builder-form");t=d.find(".siteorigin-panels-builder-container"),i=d.find('input[name="panels_data"]'),s=d,o="#post_content",n=e("#panels-home-page").data("post-id"),a=d.data("type"),r=!1}if(!_.isUndefined(t)){var c=window.siteoriginPanels,h=new c.model.builder,u={editorType:l,postId:n,editorId:o,builderType:a,loadLiveEditor:r},p=new c.view.builder({model:h,config:u});p.render().attach({container:t,type:a}).setDataField(i).attachToEditor().addLiveEditor(n).addHistoryBrowser(),s.submit(function(e){h.refreshPanelsData()}),t.removeClass("so-panels-loading"),e(document).trigger("panels_setup",p,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,
|
2 |
-
"./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,l=0;l<e.grid_cells.length;l++)s=parseInt(e.grid_cells[l].grid),_.isUndefined(i[s])&&(i[s]=[]),i[s].push(parseFloat(e.grid_cells[l].weight));var o=this;if(_.each(i,function(t,i){var s=o.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=o.rows.at(parseInt(t.grid)),s=i.cells.at(parseInt(t.cell)),l=new panels.model.widget({"class":t["class"],values:e});_.isUndefined(t.style)||l.set("style",t.style),l.cell=s,s.widgets.add(l,{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,l={grids:[],grid_cells:[],widgets:[]};l.grids=e.grids.concat(t.grids),_.isUndefined(e.grid_cells)||(l.grid_cells=e.grid_cells.slice()),_.isUndefined(e.widgets)||(l.widgets=e.widgets.slice());var o;for(o=0;o<t.grid_cells.length;o++){var n=t.grid_cells[o];n.grid=parseInt(n.grid)+i,l.grid_cells.push(n)}if(!_.isUndefined(t.widgets))for(o=0;o<t.widgets.length;o++){var a=t.widgets[o];a.panels_info.grid=parseInt(a.panels_info.grid)+i,a.panels_info.id=parseInt(a.panels_info.id)+s,l.widgets.push(a)}return l},getPanelsData:function(){var e={widgets:[],grids:[],grid_cells:[]},t=0;return this.rows.each(function(i,s){i.cells.each(function(i,l){i.widgets.each(function(i,o){var n=_.extend(_.clone(i.get("values")),{panels_info:{"class":i.get("class"),raw:i.get("raw"),grid:s,cell:l,id:t++,style:i.get("style")}});e.widgets.push(n)}),e.grid_cells.push({grid:s,weight:i.get("weight")})}),e.grids.push({cells:i.cells.length,style:i.get("style")})}),e},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}})},{}],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 l=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(l,{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,styles:{}},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"))),l=function(e){return _.each(e,function(t,i){_.isString(i)&&"_"===i[0]?delete e[i]:_.isObject(e[i])&&l(e[i])}),e};return s=l(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 l in i)if(!_.isUndefined(t[i[l]])&&_.isString(t[i[l]])&&""!==t[i[l]]&&"on"!==t[i[l]]&&"_"!==i[l][0]&&!jQuery.isNumeric(t[i[l]])){var o=t[i[l]];o=o.replace(/<\/?[^>]+(>|$)/g,"");var n=o.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 l=this;e=_.extend({display:5,defaultDisplay:!1,search:!0,sectionTitle:"",searchPlaceholder:"",titleKey:"title"},e);var o=s(this.sectionTemplate({settings:e,items:t}));this.$el.append(o),o.find(".so-item:not(.so-confirm)").click(function(){var e=s(this);i(e.data("key")),l.closeMenu()}),o.find(".so-item.so-confirm").click(function(){var e=s(this);return e.hasClass("so-confirming")?(i(e.data("key")),void l.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))}),o.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"),l=i.data("settings");if(38===e.which||40===e.which){var o=i.find("ul li:visible"),n=o.filter(".so-active").eq(0);if(n.length){o.removeClass("so-active");var a=o.index(n);38===e.which?n=0>a-1?o.last():o.eq(a-1):40===e.which&&(n=a+1>=o.length?o.first():o.eq(a+1))}else 38===e.which?n=o.last():40===e.which&&(n=o.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(l.defaultDisplay){i.find(".so-item").hide();for(var r=0;r<l.defaultDisplay.length;r++)i.find('.so-item[data-key="'+l.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("+(l.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,l=jQuery;t.exports=Backbone.View.extend({editorType:null,postId:null,editorId:null,template:_.template(l("#siteorigin-panels-builder").html().panelsProcessTemplate()),dialogs:{},rowsSortable:null,dataField:!1,currentData:"",attachedToEditor:!1,liveEditor:void 0,menu:!1,builderType:"",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 _.isUndefined(e.config)||(this.editorType=e.config.editorType,this.editorId=e.config.editorId,this.builderType=e.config.builderType,this.postId=e.config.postId,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),l(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){return e=_.extend({type:"",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.builderType=e.type,this.trigger("builder_attached"),this},attachToEditor:function(){if("tinymce"!==this.editorType)return this;this.attachedToEditor=!0;var e=this.metabox,t=this;l("#wp-content-wrap .wp-editor-tabs").find(".wp-switch-editor").click(function(e){e.preventDefault(),l("#wp-content-editor-container, #post-status-info").show(),l("#wp-content-wrap").removeClass("panels-active"),l("#content-resize-handle").show(),t.trigger("hide_builder")}).end().append(l('<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);l("#wp-content-wrap, #post-status-info").hide(),e.show().find("> .inside").show(),l(window).resize(),l(document).scroll(),t.trigger("display_builder")})),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),l("#wp-content-wrap, #post-status-info").show(),e.hide(),l(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)||l("#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=l(window).scrollTop()-t.$el.offset().top;"fixed"===l("#wpadminbar").css("position")&&(i+=l("#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:l("#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),l(document).scroll(s),s(),this.trigger("builder_attached_to_editor"),this},initSortable:function(){var e=(this.$el,this);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()}})},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"));l(this.dataField).val()!==e&&(l(this.dataField).val(e),l(this.dataField).trigger("change"),this.trigger("content_change"))},onAddRow:function(e,t,i){i=_.extend({noAnimate:!1},i);var l=new s.view.row({model:e});l.builder=this,l.render(),_.isUndefined(i.at)||t.length<=1?l.$el.appendTo(this.$(".so-rows-container")):l.$el.insertAfter(this.$(".so-rows-container .so-row-container").eq(i.at-1)),i.noAnimate===!1&&l.visualCreate(),this.refreshSortable(),l.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=l(this);t.data("view").model.indexes={builder:e,cell:t.index()}}),this.$(".so-cells .cell").each(function(e){var t=l(this);t.data("view").model.indexes={builder:e,row:t.index()}}),this.$(".so-row-container").each(function(e){var t=l(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(e){return this.liveEditor=new s.view.liveEditor({builder:this}),this.liveEditor.setPostId(e),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(){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),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)},handleContentChange:function(){if(panelsOptions.copy_content&&this.attachedToEditor&&this.$el.is(":visible")){var e=this.model.getPanelsData();_.isEmpty(e.widgets)||l.post(panelsOptions.ajaxurl,{action:"so_panels_builder_content",panels_data:JSON.stringify(e),post_id:this.postId},function(e){var t=l("<div />").html(e);t.find("div").each(function(){var e=l(this).contents();l(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.editorType||_.isUndefined(tinyMCE)||_.isNull(tinyMCE.get("content"))){var t=l(this.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(l("#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():l("textarea#content").val(),(_.isEmpty(this.model.get("data"))||_.isEmpty(this.model.get("data").widgets))&&""!==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,l){l[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=l(".siteorigin-panels-builder:visible").sort(function(e,t){return l(e).zIndex()>l(t).zIndex()?1:-1}).last(),o=l(".so-panels-dialog-wrapper:visible").sort(function(e,t){return l(e).zIndex()>l(t).zIndex()?1:-1}).last(),n=i.$el.closest(".so-panels-dialog-wrapper");if(i.$el.is(s)&&(0===o.length||o.is(n))){var a=l([]).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(l(this),e)}),r=a.last().data("view");void 0!==r&&void 0!==r.buildContextualMenu&&r.buildContextualMenu(e,t)}},lockPageScroll:function(){if("hidden"!==l("body").css("overflow")){var e=[self.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,self.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop];l("body").data({"scroll-position":e}).css("overflow","hidden"),_.isUndefined(e)||window.scrollTo(e[0],e[1])}},unlockPageScroll:function(){if("hidden"===l("body").css("overflow")&&!l(".so-panels-dialog-wrapper").is(":visible")&&!l(".so-panels-live-editor").is(":visible")){l("body").css("overflow","visible");var e=l("body").data("scroll-position");_.isUndefined(e)||window.scrollTo(e[0],e[1])}}})},{}],20:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=Backbone.View.extend({template:_.template(l("#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(){var e=this,t=e.row.builder.$el.attr("id");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=l(i.item).data("view"),o=l(i.item).closest(".cell").data("view");s.model.moveToCell(o.model),s.cell=o,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}})},refreshSortable:function(){this.widgetSortable.sortable("refresh")},initResizable:function(){var e,t=this.$(".resize-handle").css("position","absolute"),i=this.row.$el,s=this;t.draggable({axis:"x",containment:i,start:function(t,i){if(e=s.$el.prev().data("view"),!_.isUndefined(e)){var o=s.$el.clone().appendTo(i.helper).css({position:"absolute",top:"0",width:s.$el.outerWidth(),left:5,height:s.$el.outerHeight()});o.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(),l(this).data({newCellClone:o,prevCellClone:n})}},drag:function(i,o){var n=s.row.$el.width()+10,a=s.model.get("weight")-(o.position.left+t.outerWidth()/2)/n,r=e.model.get("weight")+(o.position.left+t.outerWidth()/2)/n;l(this).data("newCellClone").css("width",n*a).find(".preview-cell-weight").html(Math.round(1e3*a)/10),l(this).data("prevCellClone").css("width",n*r).find(".preview-cell-weight").html(Math.round(1e3*r)/10)},stop:function(i,o){l(this).data("newCellClone").remove(),l(this).data("prevCellClone").remove();var n=s.row.$el.width()+10,a=s.model.get("weight")-(o.position.left+t.outerWidth()/2)/n,r=e.model.get("weight")+(o.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()),o.helper.css("left",-t.outerWidth()/2),s.row.builder.model.refreshPanelsData()}})},onAddWidget:function(e,t,i){i=_.extend({noAnimate:!1},i);var l=new s.view.widget({model:e});l.cell=this,_.isUndefined(e.isDuplicate)&&(e.isDuplicate=!1),l.render({loadForm:e.isDuplicate}),_.isUndefined(i.at)||t.length<=1?l.$el.appendTo(this.$(".widgets-container")):l.$el.insertAfter(this.$(".widgets-container .so-widget").eq(i.at-1)),i.noAnimate===!1&&l.visualCreate(),this.refreshSortable(),this.row.resize()},handleCellClick:function(e){this.$el.closest(".so-rows-container").find(".so-cells .cell").removeClass("cell-selected");l(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)),l={title:i.find(".title").html(),buttons:i.find(".buttons").html(),content:i.find(".content").html()};return i.has(".left-sidebar")&&(l.left_sidebar=i.find(".left-sidebar").html()),i.has(".right-sidebar")&&(l.right_sidebar=i.find(".right-sidebar").html()),l},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 l=i.attr("href");if(!_.isUndefined(l)&&"#"===l.charAt(0)){var o=l.split("#")[1];t.$(".so-content .so-content-tabs .tab-"+o).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")}.bind(this)),s("html").click(function(e){this.$(".so-dropdown-links-wrapper").not(".hidden").each(function(t,i){var l=s(i),o=s(e.target);0!==o.length&&(o.is(".so-needs-confirm")&&!o.is(".so-confirmed")||o.is(".so-dropdown-button"))||l.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),l={};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 o=l,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){
|
3 |
-
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]?o.push(n):o[t[h]]=n:(_.isUndefined(o[t[h]])&&(""===t[h+1]?o[t[h]]=[]:o[t[h]]={}),o=o[t[h]])}catch(u){console.log("Field ["+e.attr("name")+"] could not be processed and was skipped - "+u.message)}}),l},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()),postId:!1,previewScrollTop:0,loadTimes:[],previewFrameId:1,previewIframe:null,events:{"click .live-editor-close":"close","click .live-editor-collapse":"collapse","click .live-editor-mode":"mobileToggle"},initialize:function(e){this.builder=e.builder,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")},setPostId:function(e){this.postId=e},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(".widget_siteorigin-panels-builder").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.$el.data("preview-url"),this.$(".so-preview")),this.previewIframe.data("load-start",(new Date).getTime())},postToIframe:function(e,t,i){_.isNull(this.previewIframe)||this.previewIframe.remove();var l="siteorigin-panels-live-preview-"+this.previewFrameId;this.previewIframe=s('<iframe src="javascript:false;" />').attr({id:l,name:l}).appendTo(i),this.setupPreviewFrame(this.previewIframe);var o=s('<form id="soPostToPreviewFrame" method="post" />').attr({id:l,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(o)}),o.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(".widget_siteorigin-panels-builder").length}).each(function(e,i){var l=s(i),o=t.$(".so-live-editor-builder .so-widget-wrapper").eq(l.data("index"));o.data("live-editor-preview-widget",l),l.css({cursor:"pointer"}).mouseenter(function(){o.parent().addClass("so-hovered"),t.highlightElement(l)}).mouseleave(function(){o.parent().removeClass("so-hovered"),t.resetHighlights()}).click(function(e){e.preventDefault(),o.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,l=jQuery;t.exports=Backbone.View.extend({template:_.template(l("#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.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,l(this).height()),l(this).css("width",100*l(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=l(e.target);if(t.hasClass("dashicons")&&(t=l.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(){null===this.dialog&&(this.dialog=new s.dialog.row,this.dialog.setBuilder(this.builder).setRowModel(this.model)),this.dialog.openDialog()},deleteHandler:function(){this.model.destroy()},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=l(this).data("view");_.isUndefined(t)||t.model.cid===e.cid&&t.remove()})},buildContextualMenu:function(e,t){for(var i=this,l=[],o=1;5>o;o++)l.push({title:o+" "+panelsOptions.loc.contextual.column});t.addSection({sectionTitle:panelsOptions.loc.contextual.add_row,search:!1},l,function(e){i.builder.addHistoryEntry("row_added");for(var t=Number(e)+1,l=[],o=0;t>o;o++)l.push(100/t);var n=new s.model.row({collection:i.collection});n.setCells(l),n.builder=i.builder,i.builder.model.rows.add(n,{at:i.builder.model.rows.indexOf(i.model)+1}),i.builder.model.refreshPanelsData()}),t.addSection({sectionTitle:panelsOptions.loc.contextual.row_actions,search:!1},{edit:{title:panelsOptions.loc.contextual.row_edit},duplicate:{title:panelsOptions.loc.contextual.row_duplicate},"delete":{title:panelsOptions.loc.contextual.row_delete,confirm:!0}},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 l=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){l.$el.html(e),l.setupFields(),l.stylesLoaded=!0,l.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(l){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"),l=e.find('input[type="hidden"]');if(""!==l.val()){var o=/(?:([0-9\.,]+)(.*))+/,n=l.val().split(" "),a=[];for(var r in n){var d=o.exec(n[r]);_.isNull(d)||_.isUndefined(d[1])||_.isUndefined(d[2])||(a.push(d[1]),i.val(d[2]))}t.val(a.join(" "))}var c=function(){var e=t.val().split(" ").filter(function(e){return""!==e}).map(function(e){return e+i.val()}).join(" ");l.val(e)};t.keyup(c).change(c),i.change(c)})}})},{}],25:[function(e,t,i){var s=window.panels,l=jQuery;t.exports=Backbone.View.extend({template:_.template(l("#siteorigin-panels-builder-widget").html().panelsProcessTemplate()),cell:null,dialog:null,events:{"click .widget-edit":"editHandler","click .title h4":"editHandler","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),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(){this.getEditDialog().openDialog()},duplicateHandler:function(){this.cell.row.builder.addHistoryEntry("widget_duplicated");var e=this.model.clone(this.model.cell);this.cell.model.widgets.add(e,{at:this.model.collection.indexOf(this.model)+1}),this.cell.row.builder.model.refreshPanelsData()},deleteHandler:function(){this.model.trigger("visual_destroy")},onModelChange:function(){this.$(".description").html(this.model.getTitle())},onModelDestroy:function(){this.remove()},visualDestroyModel:function(){this.cell.row.builder.addHistoryEntry("widget_deleted");var e=this;this.$el.fadeOut("fast",function(){e.cell.row.resize(),e.model.destroy(),e.cell.row.builder.model.refreshPanelsData(),e.remove()})},buildContextualMenu:function(e,t){var i=this;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()}),t.addSection({sectionTitle:panelsOptions.loc.contextual.widget_actions,search:!1},{edit:{title:panelsOptions.loc.contextual.widget_edit},duplicate:{title:panelsOptions.loc.contextual.widget_duplicate},"delete":{title:panelsOptions.loc.contextual.widget_delete,confirm:!0}},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,r){if(!i[n]){if(!t[n]){var a="function"==typeof require&&require;if(!r&&a)return a(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 r=l.find(".so-previous"),a=l.find(".so-next");1>=t?r.addClass("button-disabled"):r.click(function(i){i.preventDefault(),s.displayLayoutDirectory(e,t-1,s.currentTab)}),t===n.max_num_pages||0===n.max_num_pages?a.addClass("button-disabled"):a.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 r,a=n.prev();a.length&&(r=o('<div class="resize-handle"></div>'),r.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()}),r.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=a.clone().appendTo(t.helper).css({position:"absolute",top:"0",width:a.outerWidth(),right:6,height:a.outerHeight()});s.find(".resize-handle").remove(),o(this).data({newCellClone:i,prevCellClone:s}),n.find("> .preview-cell-in").css("visibility","hidden"),a.find("> .preview-cell-in").css("visibility","hidden")},drag:function(i,s){var n=e.row.cells[l]-(s.position.left+6)/t.width(),r=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()*r).find(".preview-cell-weight").html(Math.round(1e3*r)/10)},stop:function(i,s){o(this).data("newCellClone").remove(),o(this).data("prevCellClone").remove(),n.find(".preview-cell-in").css("visibility","visible"),a.find(".preview-cell-in").css("visibility","visible");var r=s.position.left+6,d=r/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,r){var a=parseFloat(o(r).val());a=isNaN(a)?1/e.row.cells.length:Math.round(10*a)/1e3;var d=!o(r).hasClass("no-user-interacted");i.push(a),s.push(d),d?l+=a:n+=a}),l>0&&n>0&&1-l>0)for(var r=0;r<i.length;r++)s[r]||(i[r]=i[r]/n*(1-l));var a=_.reduce(i,function(e,t){return e+t});i=i.map(function(e){return e/a}),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 r=this;this.$(".preview-cell").each(function(e,t){o(t).animate({width:Math.round(1e3*r.row.cells[e])/10+"%"},250),o(t).find(".preview-cell-weight").html(Math.round(1e3*r.row.cells[e])/10)}),this.$(".preview-cell").css("overflow","visible"),setTimeout(function(){r.regenerateRowPreview()},260)}}catch(a){console.log("Error setting cells - "+a.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,r=new s.view.builder({model:n,config:l}),a=t.closest(".so-panels-dialog-wrapper").data("view");_.isUndefined(a)||(a.on("close_dialog",function(){n.refreshPanelsData()}),a.on("open_dialog_complete",function(){r.trigger("builder_resize")}),a.model.on("destroy",function(){n.emptyRows().destroy()}),r.setDialogParents(panelsOptions.loc.layout_widget,a));var d=Boolean(t.closest(".widget-content").length);r.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")?(r.setDialogParents(panelsOptions.loc.layout_widget,r.dialog),t.find(".siteorigin-panels-display-builder").click(function(e){e.preventDefault(),r.dialog.openDialog()})):t.find(".siteorigin-panels-display-builder").parent().remove(),o(document).trigger("panels_setup",r)}})}},{}],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,r=new n.model.builder,a=new n.view.builder({model:r,config:o});a.render().attach({container:t}).setDataField(i).attachToEditor(),s.submit(function(){r.refreshPanelsData()}),t.removeClass("so-panels-loading"),e(document).trigger("panels_setup",a,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 r=t.widgets[l];r.panels_info.grid=parseInt(r.panels_info.grid)+i,r.panels_info.id=parseInt(r.panels_info.id)+s,o.widgets.push(r)}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 r={"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(r.widget_id)&&(r.widget_id=e.generateUUID());var a=_.extend(_.clone(s.get("values")),{panels_info:r});t.widgets.push(a)}),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 r=l.index(n);38===e.which?n=0>r-1?l.last():l.eq(r-1):40===e.which&&(n=r+1>=l.length?l.first():l.eq(r+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 a=0;a<o.defaultDisplay.length;a++)i.find('.so-item[data-key="'+o.defaultDisplay[a]+'"]').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 r=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)}),a=r.last().data("view");void 0!==a&&void 0!==a.buildContextualMenu&&a.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,r=s.model.get("weight")-(l.position.left+t.outerWidth()/2)/n,a=e.model.get("weight")+(l.position.left+t.outerWidth()/2)/n;o(this).data("newCellClone").css("width",n*r).find(".preview-cell-weight").html(Math.round(1e3*r)/10),o(this).data("prevCellClone").css("width",n*a).find(".preview-cell-weight").html(Math.round(1e3*a)/10)},stop:function(i,l){o(this).data("newCellClone").remove(),o(this).data("prevCellClone").remove();var n=s.row.$el.width()+10,r=s.model.get("weight")-(l.position.left+t.outerWidth()/2)/n,a=e.model.get("weight")+(l.position.left+t.outerWidth()/2)/n;r>.02&&a>.02&&(s.row.builder.addHistoryEntry("cell_resized"),s.model.set("weight",r),e.model.set("weight",a),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,r=_.isString(e.attr("type"))?e.attr("type").toLowerCase():!1;if("checkbox"===r)n=e.is(":checked")?""!==e.val()?e.val():!0:null;else if("radio"===r){if(!e.is(":checked"))return;n=e.val()}else if("TEXTAREA"===e.prop("tagName")&&e.hasClass("wp-editor-area")){var a=null;_.isUndefined(tinyMCE)||(a=tinyMCE.get(e.attr("id"))),n=null!==a&&_.isFunction(a.getContent)&&!a.isHidden()?a.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"]');if(""!==o.val()){var l=/(?:([0-9\.,]+)(.*))+/,n=o.val().split(" "),r=[];for(var a in n){var d=l.exec(n[a]);_.isNull(d)||_.isUndefined(d[1])||_.isUndefined(d[2])||(r.push(d[1]),i.val(d[2]))}t.val(r.join(" "))}var c=function(){var e=t.val().split(" ").filter(function(e){return""!==e}).map(function(e){return e+i.val()}).join(" ");o.val(e)};t.keyup(c).change(c),i.change(c)})}})},{}],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
ADDED
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* @copyright Greg Priday - <https://siteorigin.com/>
|
3 |
+
* @license GPL 3.0 http://www.gnu.org/licenses/gpl.html
|
4 |
+
*/
|
5 |
+
|
6 |
+
( function( $ ){
|
7 |
+
|
8 |
+
$.fn.siteOriginParallax = function( options ){
|
9 |
+
|
10 |
+
var $$ = $(this);
|
11 |
+
|
12 |
+
if( options === 'refreshParallax' ) {
|
13 |
+
return $$.trigger( 'refreshParallax' );
|
14 |
+
}
|
15 |
+
|
16 |
+
options = $.extend( {
|
17 |
+
// We need to know the background image URL to use
|
18 |
+
backgroundUrl: null,
|
19 |
+
// And the exact size of that image
|
20 |
+
backgroundSize: null,
|
21 |
+
// We can work out the aspect ratio from the size
|
22 |
+
backgroundAspectRatio: null,
|
23 |
+
// How we want to handle sizing of the background image
|
24 |
+
backgroundSizing: 'scaled',
|
25 |
+
// Should we limit the amount of motion in the background image
|
26 |
+
// The number of pixels the background image can move for every pixel of scrolling
|
27 |
+
limitMotion: 'auto',
|
28 |
+
}, options );
|
29 |
+
|
30 |
+
if( options.backgroundAspectRatio === null ) {
|
31 |
+
options.backgroundAspectRatio = options.backgroundSize[0] / options.backgroundSize[1];
|
32 |
+
}
|
33 |
+
|
34 |
+
var setupParallax = function( ){
|
35 |
+
try {
|
36 |
+
var wrapperSize = [
|
37 |
+
$$.outerWidth(),
|
38 |
+
$$.outerHeight()
|
39 |
+
];
|
40 |
+
var bounding = $$[0].getBoundingClientRect();
|
41 |
+
|
42 |
+
if( $$.data('siteorigin-parallax-init') === undefined ) {
|
43 |
+
// Do the initial setup
|
44 |
+
$$.css( {
|
45 |
+
'background-image' : 'url(' + options.backgroundUrl + ')'
|
46 |
+
} );
|
47 |
+
}
|
48 |
+
|
49 |
+
var limitMotion;
|
50 |
+
if( options.limitMotion === 'auto' ) {
|
51 |
+
var windowHeight = $(window ).outerHeight();
|
52 |
+
if( windowHeight < 720 ) {
|
53 |
+
limitMotion = 0.55;
|
54 |
+
} else if( windowHeight > 1300 ) {
|
55 |
+
limitMotion = 0.45;
|
56 |
+
} else {
|
57 |
+
limitMotion = (-0.00017 * ( windowHeight - 720 ) ) + 0.55;
|
58 |
+
}
|
59 |
+
} else {
|
60 |
+
limitMotion = options.limitMotion;
|
61 |
+
}
|
62 |
+
|
63 |
+
// What percent is this through a screen cycle
|
64 |
+
// 0 is when the bottom of the wrapper is at the top of the screen
|
65 |
+
// 1 is when the top of the wrapper is at the bottom of the screen
|
66 |
+
var position = ( bounding.bottom + ( bounding.top - $(window ).outerHeight() ) ) / ( $(window ).outerHeight() + bounding.height );
|
67 |
+
var percent = ( position - 1 ) / - 2;
|
68 |
+
var topPosition = 0;
|
69 |
+
var limitScale = 1;
|
70 |
+
|
71 |
+
// Do the setup for every time something changes
|
72 |
+
if( options.backgroundSizing === 'scaled' ) {
|
73 |
+
$$.css( 'background-size', 'cover' );
|
74 |
+
|
75 |
+
// The amount of X scaling
|
76 |
+
var scaleX = wrapperSize[0] / options.backgroundSize[0];
|
77 |
+
|
78 |
+
// The amount of Y scaling
|
79 |
+
var scaleY = wrapperSize[1] / options.backgroundSize[1];
|
80 |
+
|
81 |
+
if( scaleY < scaleX ) {
|
82 |
+
// Work out the top position
|
83 |
+
if( bounding.top > - wrapperSize[1] && bounding.bottom - $(window ).outerHeight() < wrapperSize[1] ) {
|
84 |
+
// This is the scaled background height
|
85 |
+
var backgroundHeight = options.backgroundSize[1] * scaleX;
|
86 |
+
|
87 |
+
// Check if we need to limit the amount of motion in the background image
|
88 |
+
if( limitMotion && backgroundHeight > $( window ).outerHeight() * limitMotion ) {
|
89 |
+
// Work out how much to scale percent position based on how much motion we want.
|
90 |
+
limitScale = ( $( window ).outerHeight() * limitMotion ) / ( backgroundHeight );
|
91 |
+
// Percent is scaled so that the midpoint is still 0.5
|
92 |
+
percent = (percent * limitScale) + ( ( 1 - limitScale ) / 2 );
|
93 |
+
}
|
94 |
+
|
95 |
+
topPosition = - ( backgroundHeight - wrapperSize[1] ) * percent;
|
96 |
+
}
|
97 |
+
|
98 |
+
$$.css( 'background-position', '0px ' + topPosition + 'px' );
|
99 |
+
|
100 |
+
} else {
|
101 |
+
// There is no space for a vertical parallax
|
102 |
+
$$.css( 'background-position', '50% 50%' );
|
103 |
+
}
|
104 |
+
} else if( options.backgroundSizing === 'original' ) {
|
105 |
+
// See scaled version or explanation of this code.
|
106 |
+
if( limitMotion && options.backgroundSize[1] > $( window ).outerHeight() * limitMotion ) {
|
107 |
+
limitScale = ( $( window ).outerHeight() * limitMotion ) / ( options.backgroundSize[1] );
|
108 |
+
percent = (percent * limitScale) + ( ( 1 - limitScale ) / 2 );
|
109 |
+
}
|
110 |
+
|
111 |
+
// In this case, the background height is always the background size
|
112 |
+
topPosition = - ( options.backgroundSize[1] - wrapperSize[1] ) * percent;
|
113 |
+
|
114 |
+
// This is a version with no scaling
|
115 |
+
$$.css( 'background-size', 'auto' );
|
116 |
+
$$.css( 'background-position', '50% ' + topPosition + 'px' );
|
117 |
+
}
|
118 |
+
}
|
119 |
+
catch( err ) {
|
120 |
+
$$.css( {
|
121 |
+
'background-size': options.backgroundSizing === 'scaled' ? 'cover' : 'auto',
|
122 |
+
'background-position': '50% 50%'
|
123 |
+
} );
|
124 |
+
}
|
125 |
+
};
|
126 |
+
setupParallax();
|
127 |
+
|
128 |
+
// All the events where we'll need to change the parallax
|
129 |
+
$( window ).on( 'scroll', setupParallax );
|
130 |
+
$( window ).on( 'resize', setupParallax );
|
131 |
+
$( window ).on( 'panelsStretchRows', setupParallax );
|
132 |
+
$$.on( 'refreshParallax', setupParallax );
|
133 |
+
};
|
134 |
+
|
135 |
+
}( jQuery ) );
|
136 |
+
|
137 |
+
|
138 |
+
jQuery( function( $ ){
|
139 |
+
$('[data-siteorigin-parallax]' ).each( function(){
|
140 |
+
$( this ).siteOriginParallax( $( this ).data('siteorigin-parallax') );
|
141 |
+
} );
|
142 |
+
} );
|
js/siteorigin-parallax.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!function(i){i.fn.siteOriginParallax=function(o){var n=i(this);if("refreshParallax"===o)return n.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 a=function(){try{var a=[n.outerWidth(),n.outerHeight()],r=n[0].getBoundingClientRect();void 0===n.data("siteorigin-parallax-init")&&n.css({"background-image":"url("+o.backgroundUrl+")"});var t;if("auto"===o.limitMotion){var e=i(window).outerHeight();t=720>e?.55:e>1300?.45:-17e-5*(e-720)+.55}else t=o.limitMotion;var u=(r.bottom+(r.top-i(window).outerHeight()))/(i(window).outerHeight()+r.height),c=(u-1)/-2,g=0,d=1;if("scaled"===o.backgroundSizing){n.css("background-size","cover");var s=a[0]/o.backgroundSize[0],l=a[1]/o.backgroundSize[1];if(s>l){if(r.top>-a[1]&&r.bottom-i(window).outerHeight()<a[1]){var b=o.backgroundSize[1]*s;t&&b>i(window).outerHeight()*t&&(d=i(window).outerHeight()*t/b,c=c*d+(1-d)/2),g=-(b-a[1])*c}n.css("background-position","0px "+g+"px")}else n.css("background-position","50% 50%")}else"original"===o.backgroundSizing&&(t&&o.backgroundSize[1]>i(window).outerHeight()*t&&(d=i(window).outerHeight()*t/o.backgroundSize[1],c=c*d+(1-d)/2),g=-(o.backgroundSize[1]-a[1])*c,n.css("background-size","auto"),n.css("background-position","50% "+g+"px"))}catch(k){n.css({"background-size":"scaled"===o.backgroundSizing?"cover":"auto","background-position":"50% 50%"})}};a(),i(window).on("scroll",a),i(window).on("resize",a),i(window).on("panelsStretchRows",a),n.on("refreshParallax",a)}}(jQuery),jQuery(function(i){i("[data-siteorigin-parallax]").each(function(){i(this).siteOriginParallax(i(this).data("siteorigin-parallax"))})});
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
=== Page Builder by SiteOrigin ===
|
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.5
|
5 |
-
Stable tag: 2.4.
|
6 |
-
Build time: 2016-
|
7 |
License: GPLv3
|
8 |
License URI: http://www.gnu.org/licenses/gpl.html
|
9 |
Donate link: http://siteorigin.com/page-builder/#donate
|
@@ -92,73 +92,196 @@ Page Builder is actively developed and updated, so generally I'd recommend that
|
|
92 |
|
93 |
= Will plugin X work with Page Builder? =
|
94 |
|
95 |
-
We've tried to ensure that Page Builder is compatible with most plugin widgets. It's best to just download Page Builder and test for yourself.
|
96 |
-
|
97 |
-
== Changelog ==
|
98 |
-
|
99 |
-
= 2.4.
|
100 |
-
*
|
101 |
-
|
102 |
-
= 2.4.
|
103 |
-
*
|
104 |
-
*
|
105 |
-
*
|
106 |
-
|
107 |
-
|
108 |
-
*
|
109 |
-
*
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
*
|
115 |
-
|
116 |
-
= 2.4.
|
117 |
-
*
|
118 |
-
*
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
* Fixed
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
*
|
127 |
-
*
|
128 |
-
*
|
129 |
-
|
130 |
-
|
131 |
-
*
|
132 |
-
*
|
133 |
-
|
134 |
-
|
135 |
-
* Fixed
|
136 |
-
*
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
*
|
142 |
-
|
143 |
-
|
144 |
-
*
|
145 |
-
*
|
146 |
-
|
147 |
-
|
148 |
-
*
|
149 |
-
*
|
150 |
-
*
|
151 |
-
*
|
152 |
-
*
|
153 |
-
|
154 |
-
|
155 |
-
*
|
156 |
-
|
157 |
-
|
158 |
-
*
|
159 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
* Added version numbers to some JS files to ensure cache busting.
|
161 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
== Upgrade Notice ==
|
163 |
|
164 |
Page Builder 2.0 is a major update. Please ensure that you backup your database before updating from a 1.x version. Updating from 1.x to 2.0 is a smooth transition, but it's always better to have a backup.
|
1 |
=== Page Builder by SiteOrigin ===
|
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.5.2
|
5 |
+
Stable tag: 2.4.8
|
6 |
+
Build time: 2016-05-13T17:50:14+02:00
|
7 |
License: GPLv3
|
8 |
License URI: http://www.gnu.org/licenses/gpl.html
|
9 |
Donate link: http://siteorigin.com/page-builder/#donate
|
92 |
|
93 |
= Will plugin X work with Page Builder? =
|
94 |
|
95 |
+
We've tried to ensure that Page Builder is compatible with most plugin widgets. It's best to just download Page Builder and test for yourself.
|
96 |
+
|
97 |
+
== Changelog ==
|
98 |
+
|
99 |
+
= 2.4.8 - May 13 2016 =
|
100 |
+
* Reverted Wordfence fix from 2.4.7 - it raised other issues.
|
101 |
+
|
102 |
+
= 2.4.7 - May 13 2016 =
|
103 |
+
* Replaced parallax with custom implementation.
|
104 |
+
* Added more filters and actions.
|
105 |
+
* Allow other plugins to enable/disable certain builder functionality.
|
106 |
+
* Added unique IDs (UUID) to all widgets.
|
107 |
+
* Added fallback previewer for Live Editor.
|
108 |
+
* Prevent double filtering of $panels_data.
|
109 |
+
* Developer support for read-only widgets.
|
110 |
+
* Fixed issue that resulted in Wordfence blocking some Page Builder requests.
|
111 |
+
* Small interface improvements.
|
112 |
+
|
113 |
+
= 2.4.6 - April 13 2016 =
|
114 |
+
* Fixed Javascript errors with layout builder widget.
|
115 |
+
|
116 |
+
= 2.4.5 - April 13 2016 =
|
117 |
+
* Only trigger contextual menu for topmost dialog.
|
118 |
+
* Improved design of Live Editor preview.
|
119 |
+
* Added Live Editor link in the admin menu bar.
|
120 |
+
|
121 |
+
= 2.4.4 - April 6 2016 =
|
122 |
+
* Fixed ordering of new rows, widgets and cells in builder interface.
|
123 |
+
* Fixed Layout Builder widget sanitization error. Was causing fatal error on older versions of PHP.
|
124 |
+
|
125 |
+
= 2.4.3 - April 6 2016 =
|
126 |
+
* Fixed measurement style fields.
|
127 |
+
* Properly process raw widgets in Live Editor.
|
128 |
+
* Remove empty widgets from raw widget processing.
|
129 |
+
|
130 |
+
= 2.4.2 - April 4 2016 =
|
131 |
+
* Improved error handling and reporting.
|
132 |
+
* Don't add widget class for TwentySixteen theme.
|
133 |
+
|
134 |
+
= 2.4.1 - April 2 2016 =
|
135 |
+
* Fixed: Copying content from standard editor to Page Builder
|
136 |
+
* Fixed: Plugin conflict with Jetpack Widget Visibility and other plugins.
|
137 |
+
|
138 |
+
= 2.4 - April 1 2016 =
|
139 |
+
* Created new Live Editor.
|
140 |
+
* Changes to Page Builder admin HTML structure for Live Editor.
|
141 |
+
* New layout for prebuilt dialog.
|
142 |
+
* Now possible to append, prepend and replace layouts in prebuilt dialog.
|
143 |
+
* Fixed contextual menu in Layout Builder widget.
|
144 |
+
* Added row/widget actions to contextual menu.
|
145 |
+
* Clarified functionality of "Switch to Editor" button by renaming to "Revert to Editor".
|
146 |
+
* refreshPanelsData function is called more consistently.
|
147 |
+
* Various background performance enhancements.
|
148 |
+
* Full JS code refactoring.
|
149 |
+
* Fixed cell bottom margins with reverse collapse order.
|
150 |
+
* Improved window scroll locking for dialogs.
|
151 |
+
* Added `in_widget_form` action when rendering widget forms
|
152 |
+
* Custom home page now saves revisions.
|
153 |
+
|
154 |
+
= 2.3.2 - March 11 2016 =
|
155 |
+
* Fixed compatibility with WordPress 4.5
|
156 |
+
|
157 |
+
= 2.3.1 - February 10 2016 =
|
158 |
+
* Fixed fatal error on RTL sites.
|
159 |
+
* Made setting to enable tablet layout. Disabled by default.
|
160 |
+
|
161 |
+
= 2.3 - February 10 2016 =
|
162 |
+
* Delete preview panels data if there are no widgets.
|
163 |
+
* Added a collapse order field.
|
164 |
+
* Added custom row ID field.
|
165 |
+
* Fixed copy content setting.
|
166 |
+
* Added tablet responsive level.
|
167 |
+
* Fixed admin templates.
|
168 |
+
* Fix to ensure live editor works with HTTPs admin requests.
|
169 |
+
* Fix for Yoast SEO compatibility.
|
170 |
+
* Removed use of filter_input for HHVM issues.
|
171 |
+
* Added panelsStretchRows event after frontend row stretch event.
|
172 |
+
* Minor performance enhancements.
|
173 |
+
* Merged all separate JS files into a single Browserify compiled file.
|
174 |
* Added version numbers to some JS files to ensure cache busting.
|
175 |
|
176 |
+
= 2.2.2 - December 09 2015 =
|
177 |
+
* Fix tab name for WordPress 4.4. Was displaying undefined.
|
178 |
+
* Fix to ensure siteorigin-panels class is added to Page Builder pages.
|
179 |
+
|
180 |
+
= 2.2.1 - October 22 2015 =
|
181 |
+
* Various fixes to widget class names.
|
182 |
+
* Added option to remove default `widget` class from Page Builder widgets.
|
183 |
+
* Added action to saving home page.
|
184 |
+
* Added support for defaults in widget and row styles.
|
185 |
+
* Improve check for the homepage in sidebars simulator.
|
186 |
+
* Changed parallax library to improve theme compatibility.
|
187 |
+
* List privately published posts and pages under the prebuilt layout dialog Clone options.
|
188 |
+
|
189 |
+
= 2.2 - September 7 2015 =
|
190 |
+
* Added prebuilt layout directory.
|
191 |
+
* Added contextual menu for quick actions.
|
192 |
+
* Added parallax background images.
|
193 |
+
* Properly handle missing widgets when saving forms.
|
194 |
+
* Don't revert to default page template when using custom home page interface.
|
195 |
+
* Various minor bug fixes and improvements.
|
196 |
+
|
197 |
+
= 2.1.5 - August 19 2015 =
|
198 |
+
* Fixed handling of checkboxes and array fields.
|
199 |
+
* Properly position Page Builder tab in WordPress 4.3.
|
200 |
+
|
201 |
+
= 2.1.4 =
|
202 |
+
* Fixed handling of raw forms.
|
203 |
+
|
204 |
+
= 2.1.3 =
|
205 |
+
* Removed use of filter_input for compatibility with HHVM
|
206 |
+
* Fixed checkbox handling in forms.
|
207 |
+
* Removed unnecessary sprintf calls to lower chance of translations causing issues.
|
208 |
+
* More generic handling of builder instances to allow them to be used in different places.
|
209 |
+
* Use implicit check for whether editor is undefined or null.
|
210 |
+
* Added optional $widget_id parameter to siteorigin_panels_render_form.
|
211 |
+
* Improved checking for home page in sidebars emulator.
|
212 |
+
* Added a builder "type" to allow more targetted instances.
|
213 |
+
|
214 |
+
= 2.1.2 =
|
215 |
+
* Removed rendered content cache introduced in 2.1.1
|
216 |
+
|
217 |
+
= 2.1.1 =
|
218 |
+
* Added translations for 16 additional languages
|
219 |
+
* Modified strings to improve translatability.
|
220 |
+
* Row and Widget style measurement fields now allow multiple values.
|
221 |
+
* New rows now added below row of currently selected cell.
|
222 |
+
* Orphaned widgets in edited rows are now moved into remaining cell.
|
223 |
+
* Made panels javascript object globally accessible.
|
224 |
+
* panels_info array now passed into widget rendering function.
|
225 |
+
* Removed unnecessary action triggers from customizer that was breaking some themes.
|
226 |
+
* Disabling Page Builder on a page now properly creates history entry.
|
227 |
+
* Small fixes to sidebars emulator.
|
228 |
+
* Fixed import/export on custom home page interface.
|
229 |
+
* Removed call to filter_input from global space.
|
230 |
+
* Fixed bundled widgets conflict with Yoast SEO.
|
231 |
+
* Prevented double rendering issue with Yoast SEO.
|
232 |
+
|
233 |
+
= 2.1 =
|
234 |
+
* Improved Page Builder settings page.
|
235 |
+
* Added sidebar emulation, which makes a Page Builder page appear to be a sidebar. Improves compatibility with other widgets.
|
236 |
+
* Removed jPlayer. Self hosted widget (legacy) now uses MediaElement.
|
237 |
+
* Small usability improvements.
|
238 |
+
* Added legacy widget migration for gallery widget.
|
239 |
+
* Layout file based import/export feature.
|
240 |
+
* Added widget title setting to change widget title HTML.
|
241 |
+
* Added setting to control full width container.
|
242 |
+
* Fixed: Handling of namespaced widgets.
|
243 |
+
* Fixed: Layout Builder widget now works in the Customizer.
|
244 |
+
* Fixed: Custom home page interface now properly uses page_on_front.
|
245 |
+
* Fixed: Page URL for home page in custom home page.
|
246 |
+
* Fixed: Custom home page encoding.
|
247 |
+
|
248 |
+
= 2.0.7 =
|
249 |
+
* Fixed issue that prevented prebuilt layouts from showing up.
|
250 |
+
|
251 |
+
= 2.0.6 =
|
252 |
+
* Added nonce to all admin requests.
|
253 |
+
* Fixed live editor for missing widgets.
|
254 |
+
* Fixed handling of multi-line row/widget custom CSS.
|
255 |
+
* Fixed issue with encoding of panels_data.
|
256 |
+
|
257 |
+
= 2.0.5 =
|
258 |
+
* Added proper escaping in widget form.
|
259 |
+
|
260 |
+
= 2.0.4 =
|
261 |
+
* Changed how data is json encoded to prevent malformed Page Builder data.
|
262 |
+
* Fixed import/export.
|
263 |
+
* Added layout widget notification (doesn't work in customizer).
|
264 |
+
* Fixed translation domains.
|
265 |
+
* Additional hooks and filters.
|
266 |
+
|
267 |
+
= 2.0.3 =
|
268 |
+
* Fixed issue with double calling sidebar_admin_setup that was breaking some widgets.
|
269 |
+
* Fixed fetching content from TinyMCE in text mode.
|
270 |
+
|
271 |
+
= 2.0.2 =
|
272 |
+
* Fixed fatal error in validation for PHP < 5.5
|
273 |
+
|
274 |
+
= 2.0.1 =
|
275 |
+
* Fixed issue with preview causing content loss in standard editor.
|
276 |
+
* Fixed issue with Black Studio TinyMCE
|
277 |
+
* Changed templating tags in js-templates.php to prevent fatal errors with some server configurations.
|
278 |
+
|
279 |
+
= 2.0 =
|
280 |
+
* Complete rewrite of Page Builder Javascript using Backbone.
|
281 |
+
* Complete UI redesign.
|
282 |
+
* Grid Engine rewrite for more efficient CSS.
|
283 |
+
* Various performance enhancements and bug fixes.
|
284 |
+
|
285 |
== Upgrade Notice ==
|
286 |
|
287 |
Page Builder 2.0 is a major update. Please ensure that you backup your database before updating from a 1.x version. Updating from 1.x to 2.0 is a smooth transition, but it's always better to have a backup.
|
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.
|
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.
|
15 |
if ( ! defined('SITEORIGIN_PANELS_JS_SUFFIX' ) ) {
|
16 |
define('SITEORIGIN_PANELS_JS_SUFFIX', '.min');
|
17 |
}
|
@@ -155,10 +155,13 @@ function siteorigin_panels_save_home_page(){
|
|
155 |
wp_update_post( array( 'ID' => $page_id, 'post_content' => $post_content ) );
|
156 |
}
|
157 |
|
|
|
|
|
158 |
// Save the updated page data
|
159 |
$panels_data = json_decode( wp_unslash( $_POST['panels_data'] ), true);
|
160 |
$panels_data['widgets'] = siteorigin_panels_process_raw_widgets($panels_data['widgets']);
|
161 |
$panels_data = siteorigin_panels_styles_sanitize_all( $panels_data );
|
|
|
162 |
|
163 |
update_post_meta( $page_id, 'panels_data', $panels_data );
|
164 |
|
@@ -560,12 +563,13 @@ function siteorigin_panels_save_post( $post_id, $post ) {
|
|
560 |
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;
|
561 |
if ( empty( $_POST['_sopanels_nonce'] ) || !wp_verify_nonce( $_POST['_sopanels_nonce'], 'save' ) ) return;
|
562 |
if ( !current_user_can( 'edit_post', $post_id ) ) return;
|
563 |
-
if ( !isset($_POST['panels_data']) ) return;
|
564 |
|
565 |
if ( !wp_is_post_revision($post_id) ) {
|
566 |
$panels_data = json_decode( wp_unslash( $_POST['panels_data'] ), true);
|
567 |
$panels_data['widgets'] = siteorigin_panels_process_raw_widgets($panels_data['widgets']);
|
568 |
$panels_data = siteorigin_panels_styles_sanitize_all( $panels_data );
|
|
|
569 |
|
570 |
if( !empty( $panels_data['widgets'] ) || !empty($panels_data['grids']) ) {
|
571 |
update_post_meta( $post_id, 'panels_data', $panels_data );
|
@@ -580,6 +584,7 @@ function siteorigin_panels_save_post( $post_id, $post ) {
|
|
580 |
$panels_data = json_decode( wp_unslash( $_POST['panels_data'] ), true);
|
581 |
$panels_data['widgets'] = siteorigin_panels_process_raw_widgets($panels_data['widgets']);
|
582 |
$panels_data = siteorigin_panels_styles_sanitize_all( $panels_data );
|
|
|
583 |
|
584 |
// Because of issue #20299, we are going to save the preview into a different variable so we don't overwrite the actual data.
|
585 |
// https://core.trac.wordpress.org/ticket/20299
|
@@ -721,7 +726,10 @@ function siteorigin_panels_get_current_admin_panels_data( ){
|
|
721 |
*/
|
722 |
function siteorigin_panels_generate_css($post_id, $panels_data = false){
|
723 |
// Exit if we don't have panels data
|
724 |
-
if( empty($panels_data) )
|
|
|
|
|
|
|
725 |
if ( empty( $panels_data ) || empty( $panels_data['grids'] ) ) return;
|
726 |
|
727 |
// Get some of the default settings
|
@@ -731,8 +739,6 @@ function siteorigin_panels_generate_css($post_id, $panels_data = false){
|
|
731 |
$panels_margin_bottom = $settings['margin-bottom'];
|
732 |
$panels_margin_bottom_last_row = $settings['margin-bottom-last-row'];
|
733 |
|
734 |
-
$panels_data = apply_filters( 'siteorigin_panels_data', $panels_data, $post_id );
|
735 |
-
|
736 |
$css = new SiteOrigin_Panels_Css_Builder();
|
737 |
|
738 |
$ci = 0;
|
@@ -772,6 +778,12 @@ function siteorigin_panels_generate_css($post_id, $panels_data = false){
|
|
772 |
'float' => $collapse_order == 'left-top' ? 'left' : 'right'
|
773 |
) );
|
774 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
775 |
|
776 |
if ( $settings['responsive'] ) {
|
777 |
|
@@ -820,9 +832,6 @@ function siteorigin_panels_generate_css($post_id, $panels_data = false){
|
|
820 |
|
821 |
// Let other plugins customize various aspects of the rows (grids)
|
822 |
foreach ( $panels_data['grids'] as $gi => $grid ) {
|
823 |
-
// Rows with only one cell don't need gutters
|
824 |
-
if($grid['cells'] <= 1) continue;
|
825 |
-
|
826 |
$grid_id = !empty( $grid['style']['id'] ) ? (string) sanitize_html_class( $grid['style']['id'] ) : intval( $gi );
|
827 |
|
828 |
// Let other themes and plugins change the gutter.
|
@@ -1110,6 +1119,8 @@ function siteorigin_panels_render( $post_id = false, $enqueue_css = true, $panel
|
|
1110 |
|
1111 |
echo '</div>';
|
1112 |
|
|
|
|
|
1113 |
$html = ob_get_clean();
|
1114 |
|
1115 |
// Reset the current post
|
@@ -1467,6 +1478,29 @@ function siteorigin_panels_live_edit_link_style(){
|
|
1467 |
}
|
1468 |
add_action( 'wp_enqueue_scripts', 'siteorigin_panels_live_edit_link_style' );
|
1469 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1470 |
/**
|
1471 |
* Process panels data to make sure everything is properly formatted
|
1472 |
*
|
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.8
|
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.8');
|
15 |
if ( ! defined('SITEORIGIN_PANELS_JS_SUFFIX' ) ) {
|
16 |
define('SITEORIGIN_PANELS_JS_SUFFIX', '.min');
|
17 |
}
|
155 |
wp_update_post( array( 'ID' => $page_id, 'post_content' => $post_content ) );
|
156 |
}
|
157 |
|
158 |
+
$page = get_post( $page_id );
|
159 |
+
|
160 |
// Save the updated page data
|
161 |
$panels_data = json_decode( wp_unslash( $_POST['panels_data'] ), true);
|
162 |
$panels_data['widgets'] = siteorigin_panels_process_raw_widgets($panels_data['widgets']);
|
163 |
$panels_data = siteorigin_panels_styles_sanitize_all( $panels_data );
|
164 |
+
$panels_data = apply_filters( 'siteorigin_panels_data_pre_save', $panels_data, $page, $page_id );
|
165 |
|
166 |
update_post_meta( $page_id, 'panels_data', $panels_data );
|
167 |
|
563 |
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;
|
564 |
if ( empty( $_POST['_sopanels_nonce'] ) || !wp_verify_nonce( $_POST['_sopanels_nonce'], 'save' ) ) return;
|
565 |
if ( !current_user_can( 'edit_post', $post_id ) ) return;
|
566 |
+
if ( !isset( $_POST['panels_data'] ) ) return;
|
567 |
|
568 |
if ( !wp_is_post_revision($post_id) ) {
|
569 |
$panels_data = json_decode( wp_unslash( $_POST['panels_data'] ), true);
|
570 |
$panels_data['widgets'] = siteorigin_panels_process_raw_widgets($panels_data['widgets']);
|
571 |
$panels_data = siteorigin_panels_styles_sanitize_all( $panels_data );
|
572 |
+
$panels_data = apply_filters( 'siteorigin_panels_data_pre_save', $panels_data, $post, $post_id );
|
573 |
|
574 |
if( !empty( $panels_data['widgets'] ) || !empty($panels_data['grids']) ) {
|
575 |
update_post_meta( $post_id, 'panels_data', $panels_data );
|
584 |
$panels_data = json_decode( wp_unslash( $_POST['panels_data'] ), true);
|
585 |
$panels_data['widgets'] = siteorigin_panels_process_raw_widgets($panels_data['widgets']);
|
586 |
$panels_data = siteorigin_panels_styles_sanitize_all( $panels_data );
|
587 |
+
$panels_data = apply_filters( 'siteorigin_panels_data_pre_save', $panels_data, $post, $post_id );
|
588 |
|
589 |
// Because of issue #20299, we are going to save the preview into a different variable so we don't overwrite the actual data.
|
590 |
// https://core.trac.wordpress.org/ticket/20299
|
726 |
*/
|
727 |
function siteorigin_panels_generate_css($post_id, $panels_data = false){
|
728 |
// Exit if we don't have panels data
|
729 |
+
if( empty($panels_data) ) {
|
730 |
+
$panels_data = get_post_meta( $post_id, 'panels_data', true );
|
731 |
+
$panels_data = apply_filters( 'siteorigin_panels_data', $panels_data, $post_id );
|
732 |
+
}
|
733 |
if ( empty( $panels_data ) || empty( $panels_data['grids'] ) ) return;
|
734 |
|
735 |
// Get some of the default settings
|
739 |
$panels_margin_bottom = $settings['margin-bottom'];
|
740 |
$panels_margin_bottom_last_row = $settings['margin-bottom-last-row'];
|
741 |
|
|
|
|
|
742 |
$css = new SiteOrigin_Panels_Css_Builder();
|
743 |
|
744 |
$ci = 0;
|
778 |
'float' => $collapse_order == 'left-top' ? 'left' : 'right'
|
779 |
) );
|
780 |
}
|
781 |
+
else {
|
782 |
+
$css->add_cell_css($post_id, $grid_id, false, '', array(
|
783 |
+
// Float right for RTL
|
784 |
+
'float' => 'none'
|
785 |
+
) );
|
786 |
+
}
|
787 |
|
788 |
if ( $settings['responsive'] ) {
|
789 |
|
832 |
|
833 |
// Let other plugins customize various aspects of the rows (grids)
|
834 |
foreach ( $panels_data['grids'] as $gi => $grid ) {
|
|
|
|
|
|
|
835 |
$grid_id = !empty( $grid['style']['id'] ) ? (string) sanitize_html_class( $grid['style']['id'] ) : intval( $gi );
|
836 |
|
837 |
// Let other themes and plugins change the gutter.
|
1119 |
|
1120 |
echo '</div>';
|
1121 |
|
1122 |
+
do_action( 'siteorigin_panels_after_render', $panels_data, $post_id );
|
1123 |
+
|
1124 |
$html = ob_get_clean();
|
1125 |
|
1126 |
// Reset the current post
|
1478 |
}
|
1479 |
add_action( 'wp_enqueue_scripts', 'siteorigin_panels_live_edit_link_style' );
|
1480 |
|
1481 |
+
function siteorigin_panels_live_editor_preview_url(){
|
1482 |
+
global $post, $wp_post_types;
|
1483 |
+
|
1484 |
+
if(
|
1485 |
+
empty( $post ) ||
|
1486 |
+
empty( $wp_post_types ) ||
|
1487 |
+
empty( $wp_post_types[ $post->post_type ] ) ||
|
1488 |
+
!$wp_post_types[ $post->post_type ]->public
|
1489 |
+
) {
|
1490 |
+
$preview_url = add_query_arg(
|
1491 |
+
'siteorigin_panels_live_editor',
|
1492 |
+
'true',
|
1493 |
+
admin_url( 'admin-ajax.php?action=so_panels_live_editor_preview' )
|
1494 |
+
);
|
1495 |
+
$preview_url = wp_nonce_url( $preview_url, 'live-editor-preview', '_panelsnonce' );
|
1496 |
+
}
|
1497 |
+
else {
|
1498 |
+
$preview_url = add_query_arg( 'siteorigin_panels_live_editor', 'true', set_url_scheme( get_permalink() ) );
|
1499 |
+
}
|
1500 |
+
|
1501 |
+
return $preview_url;
|
1502 |
+
}
|
1503 |
+
|
1504 |
/**
|
1505 |
* Process panels data to make sure everything is properly formatted
|
1506 |
*
|
tpl/admin-home-page.php
CHANGED
@@ -1,7 +1,19 @@
|
|
1 |
-
<?php
|
|
|
|
|
|
|
2 |
|
3 |
-
<div class="wrap" id="panels-home-page"
|
4 |
-
<form
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
<div id="icon-index" class="icon32"><br></div>
|
6 |
<h2>
|
7 |
<label class="switch">
|
1 |
+
<?php
|
2 |
+
$settings = siteorigin_panels_setting();
|
3 |
+
$builder_supports = apply_filters( 'siteorigin_panels_builder_supports', array(), $post, $panels_data );
|
4 |
+
?>
|
5 |
|
6 |
+
<div class="wrap" id="panels-home-page">
|
7 |
+
<form
|
8 |
+
action="<?php echo add_query_arg('page', 'so_panels_home_page') ?>"
|
9 |
+
class="hide-if-no-js siteorigin-panels-builder-form"
|
10 |
+
method="post"
|
11 |
+
id="panels-home-page-form"
|
12 |
+
data-type="custom_home_page"
|
13 |
+
data-post-id="<?php echo get_the_ID() ?>"
|
14 |
+
data-preview-url="<?php echo add_query_arg( 'siteorigin_panels_live_editor', 'true', set_url_scheme( get_permalink() ) ) ?>"
|
15 |
+
data-builder-supports="<?php echo esc_attr( json_encode( $builder_supports ) ) ?>"
|
16 |
+
>
|
17 |
<div id="icon-index" class="icon32"><br></div>
|
18 |
<h2>
|
19 |
<label class="switch">
|
tpl/js-templates.php
CHANGED
@@ -484,7 +484,7 @@ $layouts = apply_filters( 'siteorigin_panels_prebuilt_layouts', array() );
|
|
484 |
</div>
|
485 |
|
486 |
<div class="content">
|
487 |
-
<form method="post" action="<?php echo
|
488 |
<input type="hidden" name="live_editor_panels_data" value="">
|
489 |
</form>
|
490 |
<iframe class="siteorigin-panels-history-iframe" name="siteorigin-panels-history-iframe-{{%= cid %}}" src=""></iframe>
|
@@ -505,7 +505,7 @@ $layouts = apply_filters( 'siteorigin_panels_prebuilt_layouts', array() );
|
|
505 |
</script>
|
506 |
|
507 |
<script type="text/template" id="siteorigin-panels-live-editor">
|
508 |
-
<div class="so-panels-live-editor"
|
509 |
|
510 |
<div class="live-editor-collapse">
|
511 |
<div class="collapse-icon"></div>
|
484 |
</div>
|
485 |
|
486 |
<div class="content">
|
487 |
+
<form method="post" action="<?php echo siteorigin_panels_live_editor_preview_url() ?>" target="siteorigin-panels-history-iframe-{{%= cid %}}" class="history-form">
|
488 |
<input type="hidden" name="live_editor_panels_data" value="">
|
489 |
</form>
|
490 |
<iframe class="siteorigin-panels-history-iframe" name="siteorigin-panels-history-iframe-{{%= cid %}}" src=""></iframe>
|
505 |
</script>
|
506 |
|
507 |
<script type="text/template" id="siteorigin-panels-live-editor">
|
508 |
+
<div class="so-panels-live-editor">
|
509 |
|
510 |
<div class="live-editor-collapse">
|
511 |
<div class="collapse-icon"></div>
|
tpl/live-editor-preview.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
3 |
+
exit; // Exit if accessed directly.
|
4 |
+
}
|
5 |
+
wp_enqueue_style( 'siteorigin-preview-style', plugin_dir_url( __FILE__ ) . '../css/live-editor-preview.css', array(), SITEORIGIN_PANELS_VERSION );
|
6 |
+
?>
|
7 |
+
<!DOCTYPE html>
|
8 |
+
<html <?php language_attributes(); ?>>
|
9 |
+
<head>
|
10 |
+
<meta charset="<?php bloginfo( 'charset' ); ?>">
|
11 |
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
12 |
+
<link rel="profile" href="http://gmpg.org/xfn/11">
|
13 |
+
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
|
14 |
+
<?php wp_head(); ?>
|
15 |
+
</head>
|
16 |
+
|
17 |
+
<body <?php body_class(); ?>>
|
18 |
+
<div id="content" class="site-content">
|
19 |
+
<div class="entry-content">
|
20 |
+
<?php
|
21 |
+
if( !empty( $_POST['live_editor_panels_data'] ) ) {
|
22 |
+
$data = json_decode( wp_unslash( $_POST['live_editor_panels_data'] ), true );
|
23 |
+
if(
|
24 |
+
!empty( $data['widgets'] ) && (
|
25 |
+
!class_exists( 'SiteOrigin_Widget_Field_Class_Loader' ) ||
|
26 |
+
method_exists( 'SiteOrigin_Widget_Field_Class_Loader', 'extend' )
|
27 |
+
)
|
28 |
+
) {
|
29 |
+
$data['widgets'] = siteorigin_panels_process_raw_widgets( $data['widgets'] );
|
30 |
+
}
|
31 |
+
echo siteorigin_panels_render( 'l' . md5( serialize( $data ) ), true, $data);
|
32 |
+
}
|
33 |
+
?>
|
34 |
+
</div><!-- .entry-content -->
|
35 |
+
</div>
|
36 |
+
<?php wp_footer(); ?>
|
37 |
+
</body>
|
38 |
+
</html>
|
tpl/metabox-panels.php
CHANGED
@@ -1,8 +1,16 @@
|
|
1 |
<?php
|
|
|
2 |
$builder_id = uniqid();
|
|
|
|
|
3 |
?>
|
4 |
|
5 |
-
<div id="siteorigin-panels-metabox"
|
|
|
|
|
|
|
|
|
|
|
6 |
<?php do_action('siteorigin_panels_before_interface') ?>
|
7 |
<?php wp_nonce_field('save', '_sopanels_nonce') ?>
|
8 |
|
1 |
<?php
|
2 |
+
global $post;
|
3 |
$builder_id = uniqid();
|
4 |
+
$builder_type = apply_filters( 'siteorigin_panels_post_builder_type', 'editor_attached', $post, $panels_data );
|
5 |
+
$builder_supports = apply_filters( 'siteorigin_panels_builder_supports', array(), $post, $panels_data );
|
6 |
?>
|
7 |
|
8 |
+
<div id="siteorigin-panels-metabox"
|
9 |
+
data-builder-type="<?php echo esc_attr( $builder_type ) ?>"
|
10 |
+
data-preview-url="<?php echo siteorigin_panels_live_editor_preview_url() ?>"
|
11 |
+
data-builder-supports="<?php echo esc_attr( json_encode( $builder_supports ) ) ?>"
|
12 |
+
<?php if( !empty( $_GET['so_live_editor'] ) ) echo 'data-live-editor="1"' ?>
|
13 |
+
>
|
14 |
<?php do_action('siteorigin_panels_before_interface') ?>
|
15 |
<?php wp_nonce_field('save', '_sopanels_nonce') ?>
|
16 |
|
widgets/basic.php
CHANGED
@@ -78,7 +78,7 @@ class SiteOrigin_Panels_Widgets_Layout extends WP_Widget {
|
|
78 |
<input type="hidden" value="<?php echo esc_attr( $instance['builder_id'] ) ?>" name="<?php echo $this->get_field_name('builder_id') ?>" />
|
79 |
</div>
|
80 |
<script type="text/javascript">
|
81 |
-
if(typeof jQuery.fn.soPanelsSetupBuilderWidget != 'undefined' && !jQuery('body').hasClass('wp-customizer')) {
|
82 |
jQuery( "#siteorigin-page-builder-widget-<?php echo esc_attr( $instance['builder_id'] ) ?>").soPanelsSetupBuilderWidget();
|
83 |
}
|
84 |
</script>
|
78 |
<input type="hidden" value="<?php echo esc_attr( $instance['builder_id'] ) ?>" name="<?php echo $this->get_field_name('builder_id') ?>" />
|
79 |
</div>
|
80 |
<script type="text/javascript">
|
81 |
+
if( typeof jQuery.fn.soPanelsSetupBuilderWidget != 'undefined' && !jQuery('body').hasClass('wp-customizer') ) {
|
82 |
jQuery( "#siteorigin-page-builder-widget-<?php echo esc_attr( $instance['builder_id'] ) ?>").soPanelsSetupBuilderWidget();
|
83 |
}
|
84 |
</script>
|