Version Description
- 17 July 2018 =
- Contact: Allow non-string values in required field validation.
- Initialize CTA, Price Table and Video JS widgets correctly when in accordion/tabs widgets.
Download this release
Release Info
Developer | gpriday |
Plugin | SiteOrigin Widgets Bundle |
Version | 1.12.1 |
Comparing to | |
See all releases |
Code changes from version 1.12.0 to 1.12.1
- base/inc/fields/builder.class.php +60 -60
- lang/so-widgets-bundle.pot +9 -9
- readme.txt +6 -2
- so-widgets-bundle.php +2 -2
- widgets/contact/contact.php +2 -1
- widgets/cta/js/cta.js +21 -12
- widgets/cta/js/cta.min.js +1 -1
- widgets/google-map/js/static-map.js +30 -30
- widgets/image-grid/js/image-grid.js +53 -53
- widgets/post-carousel/js/carousel.js +163 -163
- widgets/price-table/js/pricetable.js +63 -43
- widgets/price-table/js/pricetable.min.js +1 -1
- widgets/simple-masonry/js/simple-masonry.js +49 -49
- widgets/social-media-buttons/js/social-media-buttons-admin.js +39 -39
- widgets/tabs/js/tabs.js +1 -1
- widgets/video/js/so-video-widget.js +23 -15
- widgets/video/js/so-video-widget.min.js +1 -1
base/inc/fields/builder.class.php
CHANGED
@@ -1,60 +1,60 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* A full instance of SiteOrigin Page Builder as a field.
|
5 |
-
*
|
6 |
-
* Class SiteOrigin_Widget_Field_Builder
|
7 |
-
*/
|
8 |
-
class SiteOrigin_Widget_Field_Builder extends SiteOrigin_Widget_Field_Base {
|
9 |
-
|
10 |
-
protected function render_field( $value, $instance ){
|
11 |
-
if( defined('SITEORIGIN_PANELS_VERSION') ) {
|
12 |
-
// Normal rendering code
|
13 |
-
?>
|
14 |
-
<div
|
15 |
-
class="siteorigin-page-builder-field"
|
16 |
-
data-mode="dialog"
|
17 |
-
data-type="<?php echo isset( $this->field_options['builder_type'] ) ? esc_attr( $this->field_options['builder_type'] ) : 'sow-builder-field' ?>"
|
18 |
-
>
|
19 |
-
<p>
|
20 |
-
<button class="button-secondary siteorigin-panels-display-builder" ><?php _e('Open Builder', 'siteorigin-panels') ?></button>
|
21 |
-
</p>
|
22 |
-
<input
|
23 |
-
type="hidden"
|
24 |
-
class="siteorigin-widget-input panels-data"
|
25 |
-
value="<?php echo esc_attr( json_encode( $value ) ) ?>"
|
26 |
-
name="<?php echo esc_attr( $this->element_name ) ?>"
|
27 |
-
id="<?php echo esc_attr( $this->element_id ) ?>"
|
28 |
-
/>
|
29 |
-
</div>
|
30 |
-
<?php
|
31 |
-
}
|
32 |
-
else {
|
33 |
-
// Let the user know that they need Page Builder installed
|
34 |
-
?>
|
35 |
-
<p>
|
36 |
-
<?php _e( 'This field requires: ', 'so-widgets-bundle' ) ?>
|
37 |
-
<a href="https://siteorigin.com/page-builder/" target="_blank" rel="noopener noreferrer"><?php _e( 'SiteOrigin Page Builder', 'so-widgets-bundle' ) ?></a>
|
38 |
-
</p>
|
39 |
-
<?php
|
40 |
-
}
|
41 |
-
}
|
42 |
-
|
43 |
-
/**
|
44 |
-
* Process the panels_data
|
45 |
-
*
|
46 |
-
* @param mixed $value
|
47 |
-
* @param array $instance
|
48 |
-
*
|
49 |
-
* @return array|mixed|object
|
50 |
-
*/
|
51 |
-
protected function sanitize_field_input( $value, $instance ){
|
52 |
-
$panels_data = json_decode( $value, true );
|
53 |
-
if( function_exists('siteorigin_panels_process_raw_widgets') && !empty( $panels_data['widgets'] ) && is_array( $panels_data['widgets'] ) ) {
|
54 |
-
$panels_data['widgets'] = siteorigin_panels_process_raw_widgets( $panels_data['widgets'] );
|
55 |
-
}
|
56 |
-
|
57 |
-
return $panels_data;
|
58 |
-
}
|
59 |
-
|
60 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* A full instance of SiteOrigin Page Builder as a field.
|
5 |
+
*
|
6 |
+
* Class SiteOrigin_Widget_Field_Builder
|
7 |
+
*/
|
8 |
+
class SiteOrigin_Widget_Field_Builder extends SiteOrigin_Widget_Field_Base {
|
9 |
+
|
10 |
+
protected function render_field( $value, $instance ){
|
11 |
+
if( defined('SITEORIGIN_PANELS_VERSION') ) {
|
12 |
+
// Normal rendering code
|
13 |
+
?>
|
14 |
+
<div
|
15 |
+
class="siteorigin-page-builder-field"
|
16 |
+
data-mode="dialog"
|
17 |
+
data-type="<?php echo isset( $this->field_options['builder_type'] ) ? esc_attr( $this->field_options['builder_type'] ) : 'sow-builder-field' ?>"
|
18 |
+
>
|
19 |
+
<p>
|
20 |
+
<button class="button-secondary siteorigin-panels-display-builder" ><?php _e('Open Builder', 'siteorigin-panels') ?></button>
|
21 |
+
</p>
|
22 |
+
<input
|
23 |
+
type="hidden"
|
24 |
+
class="siteorigin-widget-input panels-data"
|
25 |
+
value="<?php echo esc_attr( json_encode( $value ) ) ?>"
|
26 |
+
name="<?php echo esc_attr( $this->element_name ) ?>"
|
27 |
+
id="<?php echo esc_attr( $this->element_id ) ?>"
|
28 |
+
/>
|
29 |
+
</div>
|
30 |
+
<?php
|
31 |
+
}
|
32 |
+
else {
|
33 |
+
// Let the user know that they need Page Builder installed
|
34 |
+
?>
|
35 |
+
<p>
|
36 |
+
<?php _e( 'This field requires: ', 'so-widgets-bundle' ) ?>
|
37 |
+
<a href="https://siteorigin.com/page-builder/" target="_blank" rel="noopener noreferrer"><?php _e( 'SiteOrigin Page Builder', 'so-widgets-bundle' ) ?></a>
|
38 |
+
</p>
|
39 |
+
<?php
|
40 |
+
}
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Process the panels_data
|
45 |
+
*
|
46 |
+
* @param mixed $value
|
47 |
+
* @param array $instance
|
48 |
+
*
|
49 |
+
* @return array|mixed|object
|
50 |
+
*/
|
51 |
+
protected function sanitize_field_input( $value, $instance ){
|
52 |
+
$panels_data = json_decode( $value, true );
|
53 |
+
if( function_exists('siteorigin_panels_process_raw_widgets') && !empty( $panels_data['widgets'] ) && is_array( $panels_data['widgets'] ) ) {
|
54 |
+
$panels_data['widgets'] = siteorigin_panels_process_raw_widgets( $panels_data['widgets'] );
|
55 |
+
}
|
56 |
+
|
57 |
+
return $panels_data;
|
58 |
+
}
|
59 |
+
|
60 |
+
}
|
lang/so-widgets-bundle.pot
CHANGED
@@ -1085,7 +1085,7 @@ msgstr ""
|
|
1085 |
msgid "Required Field"
|
1086 |
msgstr ""
|
1087 |
|
1088 |
-
#: widgets/contact/contact.php:180, widgets/contact/contact.php:
|
1089 |
msgid "Required field"
|
1090 |
msgstr ""
|
1091 |
|
@@ -1401,35 +1401,35 @@ msgstr ""
|
|
1401 |
msgid "Please write something"
|
1402 |
msgstr ""
|
1403 |
|
1404 |
-
#: widgets/contact/contact.php:
|
1405 |
msgid "Invalid email address."
|
1406 |
msgstr ""
|
1407 |
|
1408 |
-
#: widgets/contact/contact.php:
|
1409 |
msgid "Error sending email, please try again later."
|
1410 |
msgstr ""
|
1411 |
|
1412 |
-
#: widgets/contact/contact.php:
|
1413 |
msgid "A valid email is required"
|
1414 |
msgstr ""
|
1415 |
|
1416 |
-
#: widgets/contact/contact.php:
|
1417 |
msgid "The email address is invalid"
|
1418 |
msgstr ""
|
1419 |
|
1420 |
-
#: widgets/contact/contact.php:
|
1421 |
msgid "Missing subject"
|
1422 |
msgstr ""
|
1423 |
|
1424 |
-
#: widgets/contact/contact.php:
|
1425 |
msgid "Error validating your Captcha response."
|
1426 |
msgstr ""
|
1427 |
|
1428 |
-
#: widgets/contact/contact.php:
|
1429 |
msgid "Unfortunately our system identified your message as spam."
|
1430 |
msgstr ""
|
1431 |
|
1432 |
-
#: widgets/contact/contact.php:
|
1433 |
msgctxt "The name of who sent this email"
|
1434 |
msgid "From"
|
1435 |
msgstr ""
|
1085 |
msgid "Required Field"
|
1086 |
msgstr ""
|
1087 |
|
1088 |
+
#: widgets/contact/contact.php:180, widgets/contact/contact.php:1010
|
1089 |
msgid "Required field"
|
1090 |
msgstr ""
|
1091 |
|
1401 |
msgid "Please write something"
|
1402 |
msgstr ""
|
1403 |
|
1404 |
+
#: widgets/contact/contact.php:1022
|
1405 |
msgid "Invalid email address."
|
1406 |
msgstr ""
|
1407 |
|
1408 |
+
#: widgets/contact/contact.php:1101
|
1409 |
msgid "Error sending email, please try again later."
|
1410 |
msgstr ""
|
1411 |
|
1412 |
+
#: widgets/contact/contact.php:1127
|
1413 |
msgid "A valid email is required"
|
1414 |
msgstr ""
|
1415 |
|
1416 |
+
#: widgets/contact/contact.php:1129
|
1417 |
msgid "The email address is invalid"
|
1418 |
msgstr ""
|
1419 |
|
1420 |
+
#: widgets/contact/contact.php:1133
|
1421 |
msgid "Missing subject"
|
1422 |
msgstr ""
|
1423 |
|
1424 |
+
#: widgets/contact/contact.php:1167
|
1425 |
msgid "Error validating your Captcha response."
|
1426 |
msgstr ""
|
1427 |
|
1428 |
+
#: widgets/contact/contact.php:1199
|
1429 |
msgid "Unfortunately our system identified your message as spam."
|
1430 |
msgstr ""
|
1431 |
|
1432 |
+
#: widgets/contact/contact.php:1207
|
1433 |
msgctxt "The name of who sent this email"
|
1434 |
msgid "From"
|
1435 |
msgstr ""
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Tags: bundle, widget, button, slider, image, carousel, price table, google maps, tinymce, social links
|
3 |
Requires at least: 4.2
|
4 |
Tested up to: 4.9.1
|
5 |
-
Stable tag: 1.12.
|
6 |
-
Build time: 2018-07-
|
7 |
License: GPLv3 or later
|
8 |
Contributors: gpriday, braam-genis
|
9 |
Donate link: https://siteorigin.com/downloads/contribution/
|
@@ -65,6 +65,10 @@ The SiteOrigin Widgets Bundle is the perfect platform to build widgets for your
|
|
65 |
|
66 |
== Changelog ==
|
67 |
|
|
|
|
|
|
|
|
|
68 |
= 1.12.0 - 11 July 2018 =
|
69 |
* Contact: Add dedicated textarea height.
|
70 |
* Social Media Buttons: Adds WhatsApp social network.
|
2 |
Tags: bundle, widget, button, slider, image, carousel, price table, google maps, tinymce, social links
|
3 |
Requires at least: 4.2
|
4 |
Tested up to: 4.9.1
|
5 |
+
Stable tag: 1.12.1
|
6 |
+
Build time: 2018-07-17T11:59:12+02:00
|
7 |
License: GPLv3 or later
|
8 |
Contributors: gpriday, braam-genis
|
9 |
Donate link: https://siteorigin.com/downloads/contribution/
|
65 |
|
66 |
== Changelog ==
|
67 |
|
68 |
+
= 1.12.1 - 17 July 2018 =
|
69 |
+
* Contact: Allow non-string values in required field validation.
|
70 |
+
* Initialize CTA, Price Table and Video JS widgets correctly when in accordion/tabs widgets.
|
71 |
+
|
72 |
= 1.12.0 - 11 July 2018 =
|
73 |
* Contact: Add dedicated textarea height.
|
74 |
* Social Media Buttons: Adds WhatsApp social network.
|
so-widgets-bundle.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
Plugin Name: SiteOrigin Widgets Bundle
|
4 |
Description: A collection of all widgets, neatly bundled into a single plugin. It's also a framework to code your own widgets on top of.
|
5 |
-
Version: 1.12.
|
6 |
Text Domain: so-widgets-bundle
|
7 |
Domain Path: /lang
|
8 |
Author: SiteOrigin
|
@@ -12,7 +12,7 @@ License: GPL3
|
|
12 |
License URI: https://www.gnu.org/licenses/gpl-3.0.txt
|
13 |
*/
|
14 |
|
15 |
-
define('SOW_BUNDLE_VERSION', '1.12.
|
16 |
define('SOW_BUNDLE_BASE_FILE', __FILE__);
|
17 |
|
18 |
// Allow JS suffix to be pre-set
|
2 |
/*
|
3 |
Plugin Name: SiteOrigin Widgets Bundle
|
4 |
Description: A collection of all widgets, neatly bundled into a single plugin. It's also a framework to code your own widgets on top of.
|
5 |
+
Version: 1.12.1
|
6 |
Text Domain: so-widgets-bundle
|
7 |
Domain Path: /lang
|
8 |
Author: SiteOrigin
|
12 |
License URI: https://www.gnu.org/licenses/gpl-3.0.txt
|
13 |
*/
|
14 |
|
15 |
+
define('SOW_BUNDLE_VERSION', '1.12.1');
|
16 |
define('SOW_BUNDLE_BASE_FILE', __FILE__);
|
17 |
|
18 |
// Allow JS suffix to be pre-set
|
widgets/contact/contact.php
CHANGED
@@ -1000,7 +1000,8 @@ class SiteOrigin_Widgets_ContactForm_Widget extends SiteOrigin_Widget {
|
|
1000 |
$field_name = $this->name_from_label( ! empty( $field['label'] ) ? $field['label'] : $i, $field_ids ) . '-' . $instance['_sow_form_id'];
|
1001 |
$value = isset( $post_vars[ $field_name ] ) ? $post_vars[ $field_name ] : '';
|
1002 |
|
1003 |
-
|
|
|
1004 |
if ( $field['required']['required'] ) {
|
1005 |
// Add in the default subject
|
1006 |
if ( $field['type'] == 'subject' && ! empty( $instance['settings']['default_subject'] ) ) {
|
1000 |
$field_name = $this->name_from_label( ! empty( $field['label'] ) ? $field['label'] : $i, $field_ids ) . '-' . $instance['_sow_form_id'];
|
1001 |
$value = isset( $post_vars[ $field_name ] ) ? $post_vars[ $field_name ] : '';
|
1002 |
|
1003 |
+
// Can't just use `strlen` here as $value could be an array. E.g. for checkboxes field.
|
1004 |
+
if ( empty( $value ) && $value !== '0' ) {
|
1005 |
if ( $field['required']['required'] ) {
|
1006 |
// Add in the default subject
|
1007 |
if ( $field['type'] == 'subject' && ! empty( $instance['settings']['default_subject'] ) ) {
|
widgets/cta/js/cta.js
CHANGED
@@ -1,12 +1,21 @@
|
|
1 |
-
jQuery
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* globals jQuery, sowb */
|
2 |
+
|
3 |
+
var sowb = window.sowb || {};
|
4 |
+
|
5 |
+
jQuery( function ( $ ) {
|
6 |
+
var setupCta = function () {
|
7 |
+
$( '.sow-cta-base' ).each( function () {
|
8 |
+
var $$ = $( this );
|
9 |
+
var
|
10 |
+
$b = $$.find( '.so-widget-sow-button' ),
|
11 |
+
$t = $$.find( '.sow-cta-text' );
|
12 |
+
|
13 |
+
if ( $t.outerHeight() > $b.outerHeight() ) {
|
14 |
+
$b.css( 'margin-top', ( $t.outerHeight() - $b.outerHeight() ) / 2 );
|
15 |
+
}
|
16 |
+
} );
|
17 |
+
};
|
18 |
+
setupCta();
|
19 |
+
|
20 |
+
$( sowb ).on( 'setup_widgets', setupCta );
|
21 |
+
} );
|
widgets/cta/js/cta.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(function(t){t(".sow-cta-base").each(function(){var
|
1 |
+
var sowb=window.sowb||{};jQuery(function(t){var o=function(){t(".sow-cta-base").each(function(){var o=t(this),e=o.find(".so-widget-sow-button"),i=o.find(".sow-cta-text");i.outerHeight()>e.outerHeight()&&e.css("margin-top",(i.outerHeight()-e.outerHeight())/2)})};o(),t(sowb).on("setup_widgets",o)});
|
widgets/google-map/js/static-map.js
CHANGED
@@ -1,30 +1,30 @@
|
|
1 |
-
/* globals jQuery, sowb */
|
2 |
-
|
3 |
-
var sowb = window.sowb || {};
|
4 |
-
|
5 |
-
jQuery( function ( $ ) {
|
6 |
-
var setupStaticMapErrorHandler = function() {
|
7 |
-
|
8 |
-
$( '.sowb-google-map-static' ).each( function () {
|
9 |
-
var $this = $( this );
|
10 |
-
var showFallbackImage = function() {
|
11 |
-
if ( $this.data( 'fallbackImage' ) ) {
|
12 |
-
var imgData = $this.data( 'fallbackImage' );
|
13 |
-
if ( imgData.hasOwnProperty( 'img' ) ) {
|
14 |
-
$this.parent().append( imgData.img );
|
15 |
-
$this.remove();
|
16 |
-
}
|
17 |
-
}
|
18 |
-
};
|
19 |
-
if ( this.sowbLoadError ) {
|
20 |
-
showFallbackImage();
|
21 |
-
} else if ( !
|
22 |
-
$this.error( showFallbackImage );
|
23 |
-
}
|
24 |
-
} );
|
25 |
-
|
26 |
-
};
|
27 |
-
setupStaticMapErrorHandler();
|
28 |
-
} );
|
29 |
-
|
30 |
-
window.sowb = sowb;
|
1 |
+
/* globals jQuery, sowb */
|
2 |
+
|
3 |
+
var sowb = window.sowb || {};
|
4 |
+
|
5 |
+
jQuery( function ( $ ) {
|
6 |
+
var setupStaticMapErrorHandler = function () {
|
7 |
+
|
8 |
+
$( '.sowb-google-map-static' ).each( function () {
|
9 |
+
var $this = $( this );
|
10 |
+
var showFallbackImage = function () {
|
11 |
+
if ( $this.data( 'fallbackImage' ) ) {
|
12 |
+
var imgData = $this.data( 'fallbackImage' );
|
13 |
+
if ( imgData.hasOwnProperty( 'img' ) ) {
|
14 |
+
$this.parent().append( imgData.img );
|
15 |
+
$this.remove();
|
16 |
+
}
|
17 |
+
}
|
18 |
+
};
|
19 |
+
if ( this.sowbLoadError ) {
|
20 |
+
showFallbackImage();
|
21 |
+
} else if ( !this.complete ) {
|
22 |
+
$this.error( showFallbackImage );
|
23 |
+
}
|
24 |
+
} );
|
25 |
+
|
26 |
+
};
|
27 |
+
setupStaticMapErrorHandler();
|
28 |
+
} );
|
29 |
+
|
30 |
+
window.sowb = sowb;
|
widgets/image-grid/js/image-grid.js
CHANGED
@@ -1,53 +1,53 @@
|
|
1 |
-
/* globals jQuery, sowb */
|
2 |
-
var sowb = window.sowb || {};
|
3 |
-
|
4 |
-
jQuery( function($) {
|
5 |
-
sowb.setupImageGrids = function() {
|
6 |
-
$('.sow-image-grid-wrapper').each( function(){
|
7 |
-
var $$ = $(this);
|
8 |
-
$$.imagesLoaded( function () {
|
9 |
-
var maxWidth = $$.data( 'max-width' ),
|
10 |
-
maxHeight = $$.data( 'max-height' );
|
11 |
-
|
12 |
-
if ( maxWidth !== undefined || maxHeight !== undefined ) {
|
13 |
-
$$.find( 'img' ).each( function () {
|
14 |
-
var $img = $( this ).css( 'display', 'block' ),
|
15 |
-
ratio = $img.width() / $img.height();
|
16 |
-
|
17 |
-
var width = [];
|
18 |
-
|
19 |
-
// Lets set the widths of the image
|
20 |
-
if ( maxWidth !== undefined && $img.width() > maxWidth ) {
|
21 |
-
width.push( maxWidth );
|
22 |
-
}
|
23 |
-
|
24 |
-
if ( maxHeight !== undefined && $img.height() > maxHeight ) {
|
25 |
-
width.push( Math.round( maxHeight * ratio ) );
|
26 |
-
}
|
27 |
-
|
28 |
-
if ( width.length ) {
|
29 |
-
width = Math.min.apply( Math, width );
|
30 |
-
$img.css( 'max-width', width );
|
31 |
-
}
|
32 |
-
|
33 |
-
} );
|
34 |
-
}
|
35 |
-
else {
|
36 |
-
$$.find( 'img' ).css( 'display', 'block' );
|
37 |
-
}
|
38 |
-
|
39 |
-
var alignImages = function () {
|
40 |
-
};
|
41 |
-
alignImages();
|
42 |
-
|
43 |
-
$( window ).resize( alignImages );
|
44 |
-
} );
|
45 |
-
} );
|
46 |
-
};
|
47 |
-
sowb.setupImageGrids();
|
48 |
-
|
49 |
-
$( sowb ).on( 'setup_widgets', sowb.setupImageGrids );
|
50 |
-
|
51 |
-
} );
|
52 |
-
|
53 |
-
window.sowb = sowb;
|
1 |
+
/* globals jQuery, sowb */
|
2 |
+
var sowb = window.sowb || {};
|
3 |
+
|
4 |
+
jQuery( function ( $ ) {
|
5 |
+
sowb.setupImageGrids = function () {
|
6 |
+
$( '.sow-image-grid-wrapper' ).each( function () {
|
7 |
+
var $$ = $( this );
|
8 |
+
$$.imagesLoaded( function () {
|
9 |
+
var maxWidth = $$.data( 'max-width' ),
|
10 |
+
maxHeight = $$.data( 'max-height' );
|
11 |
+
|
12 |
+
if ( maxWidth !== undefined || maxHeight !== undefined ) {
|
13 |
+
$$.find( 'img' ).each( function () {
|
14 |
+
var $img = $( this ).css( 'display', 'block' ),
|
15 |
+
ratio = $img.width() / $img.height();
|
16 |
+
|
17 |
+
var width = [];
|
18 |
+
|
19 |
+
// Lets set the widths of the image
|
20 |
+
if ( maxWidth !== undefined && $img.width() > maxWidth ) {
|
21 |
+
width.push( maxWidth );
|
22 |
+
}
|
23 |
+
|
24 |
+
if ( maxHeight !== undefined && $img.height() > maxHeight ) {
|
25 |
+
width.push( Math.round( maxHeight * ratio ) );
|
26 |
+
}
|
27 |
+
|
28 |
+
if ( width.length ) {
|
29 |
+
width = Math.min.apply( Math, width );
|
30 |
+
$img.css( 'max-width', width );
|
31 |
+
}
|
32 |
+
|
33 |
+
} );
|
34 |
+
}
|
35 |
+
else {
|
36 |
+
$$.find( 'img' ).css( 'display', 'block' );
|
37 |
+
}
|
38 |
+
|
39 |
+
var alignImages = function () {
|
40 |
+
};
|
41 |
+
alignImages();
|
42 |
+
|
43 |
+
$( window ).resize( alignImages );
|
44 |
+
} );
|
45 |
+
} );
|
46 |
+
};
|
47 |
+
sowb.setupImageGrids();
|
48 |
+
|
49 |
+
$( sowb ).on( 'setup_widgets', sowb.setupImageGrids );
|
50 |
+
|
51 |
+
} );
|
52 |
+
|
53 |
+
window.sowb = sowb;
|
widgets/post-carousel/js/carousel.js
CHANGED
@@ -1,163 +1,163 @@
|
|
1 |
-
jQuery( function ( $ ) {
|
2 |
-
// The carousel widget
|
3 |
-
$( '.sow-carousel-wrapper' ).each( function () {
|
4 |
-
|
5 |
-
var $$ = $( this ),
|
6 |
-
$postsContainer = $$.closest( '.sow-carousel-container' ),
|
7 |
-
$container = $$.closest( '.sow-carousel-container' ).parent(),
|
8 |
-
$itemsContainer = $$.find( '.sow-carousel-items' ),
|
9 |
-
$items = $$.find( '.sow-carousel-item' ),
|
10 |
-
$firstItem = $items.eq( 0 );
|
11 |
-
|
12 |
-
var position = 0,
|
13 |
-
page = 1,
|
14 |
-
fetching = false,
|
15 |
-
numItems = $items.length,
|
16 |
-
totalPosts = $$.data( 'found-posts' ),
|
17 |
-
complete = numItems === totalPosts,
|
18 |
-
itemWidth = ( $firstItem.width() + parseInt( $firstItem.css( 'margin-right' ) ) ),
|
19 |
-
isRTL = $postsContainer.hasClass( 'js-rtl' ),
|
20 |
-
updateProp = isRTL ? 'margin-right' : 'margin-left';
|
21 |
-
|
22 |
-
var updatePosition = function () {
|
23 |
-
if ( position < 0 ) position = 0;
|
24 |
-
if ( position >= $$.find( '.sow-carousel-item' ).length - 1 ) {
|
25 |
-
position = $$.find( '.sow-carousel-item' ).length - 1;
|
26 |
-
// Fetch the next batch
|
27 |
-
if ( !fetching && !complete ) {
|
28 |
-
fetching = true;
|
29 |
-
page++;
|
30 |
-
$itemsContainer.append( '<li class="sow-carousel-item sow-carousel-loading"></li>' );
|
31 |
-
var instanceHash = $container.find( 'input[name="instance_hash"]' ).val();
|
32 |
-
|
33 |
-
$.get(
|
34 |
-
$$.data( 'ajax-url' ),
|
35 |
-
{
|
36 |
-
query: $$.data( 'query' ),
|
37 |
-
action: 'sow_carousel_load',
|
38 |
-
paged: page,
|
39 |
-
instance_hash: instanceHash,
|
40 |
-
},
|
41 |
-
function ( data, status ) {
|
42 |
-
var $items = $( data.html );
|
43 |
-
$items.appendTo( $itemsContainer ).hide().fadeIn();
|
44 |
-
$$.find( '.sow-carousel-loading' ).remove();
|
45 |
-
numItems = $$.find( '.sow-carousel-item' ).length;
|
46 |
-
complete = numItems === totalPosts;
|
47 |
-
fetching = false;
|
48 |
-
}
|
49 |
-
)
|
50 |
-
}
|
51 |
-
}
|
52 |
-
$itemsContainer.css( 'transition-duration', "0.45s" );
|
53 |
-
$itemsContainer.css( updateProp, -( itemWidth * position) + 'px' );
|
54 |
-
};
|
55 |
-
|
56 |
-
$container.on( 'click', 'a.sow-carousel-previous',
|
57 |
-
function ( e ) {
|
58 |
-
e.preventDefault();
|
59 |
-
position -= isRTL ? -1 : 1;
|
60 |
-
updatePosition();
|
61 |
-
}
|
62 |
-
);
|
63 |
-
|
64 |
-
$container.on( 'click', 'a.sow-carousel-next',
|
65 |
-
function ( e ) {
|
66 |
-
e.preventDefault();
|
67 |
-
position += isRTL ? -1 : 1;
|
68 |
-
updatePosition();
|
69 |
-
}
|
70 |
-
);
|
71 |
-
|
72 |
-
// Verify "swipe" method exists prior to invoking it.
|
73 |
-
if ( 'function' === typeof $$.swipe ) {
|
74 |
-
var validSwipe = false;
|
75 |
-
var prevDistance = 0;
|
76 |
-
var startPosition = 0;
|
77 |
-
var velocity = 0;
|
78 |
-
var prevTime = 0;
|
79 |
-
var posInterval;
|
80 |
-
var negativeDirection = isRTL ? 'right' : 'left';
|
81 |
-
|
82 |
-
var setNewPosition = function ( newPosition ) {
|
83 |
-
if ( newPosition < 50 && newPosition > -( itemWidth * numItems ) ) {
|
84 |
-
$itemsContainer.css( 'transition-duration', "0s" );
|
85 |
-
$itemsContainer.css( updateProp, newPosition + 'px' );
|
86 |
-
return true;
|
87 |
-
}
|
88 |
-
return false;
|
89 |
-
};
|
90 |
-
|
91 |
-
var setFinalPosition = function () {
|
92 |
-
var finalPosition = parseInt( $itemsContainer.css( updateProp ) );
|
93 |
-
position = Math.abs( Math.round( finalPosition / itemWidth ) );
|
94 |
-
updatePosition();
|
95 |
-
};
|
96 |
-
|
97 |
-
$$.on( 'click', '.sow-carousel-item a',
|
98 |
-
function ( event ) {
|
99 |
-
if ( validSwipe ) {
|
100 |
-
event.preventDefault();
|
101 |
-
validSwipe = false;
|
102 |
-
}
|
103 |
-
}
|
104 |
-
);
|
105 |
-
|
106 |
-
$$.swipe( {
|
107 |
-
excludedElements: "",
|
108 |
-
triggerOnTouchEnd: true,
|
109 |
-
threshold: 75,
|
110 |
-
swipeStatus: function ( event, phase, direction, distance, duration, fingerCount, fingerData ) {
|
111 |
-
if ( direction === 'up' || direction === 'down' ) {
|
112 |
-
return false;
|
113 |
-
}
|
114 |
-
|
115 |
-
if ( phase === "start" ) {
|
116 |
-
startPosition = -( itemWidth * position);
|
117 |
-
prevTime = new Date().getTime();
|
118 |
-
clearInterval( posInterval );
|
119 |
-
}
|
120 |
-
else if ( phase === "move" ) {
|
121 |
-
if ( direction === negativeDirection ) distance *= -1;
|
122 |
-
setNewPosition( startPosition + distance );
|
123 |
-
var newTime = new Date().getTime();
|
124 |
-
var timeDelta = (newTime - prevTime) / 1000;
|
125 |
-
velocity = (distance - prevDistance) / timeDelta;
|
126 |
-
prevTime = newTime;
|
127 |
-
prevDistance = distance;
|
128 |
-
}
|
129 |
-
else if ( phase === "end" ) {
|
130 |
-
validSwipe = true;
|
131 |
-
if ( direction === negativeDirection ) distance *= -1;
|
132 |
-
if ( Math.abs( velocity ) > 400 ) {
|
133 |
-
velocity *= 0.1;
|
134 |
-
var startTime = new Date().getTime();
|
135 |
-
var cumulativeDistance = 0;
|
136 |
-
posInterval = setInterval( function () {
|
137 |
-
var time = (new Date().getTime() - startTime) / 1000;
|
138 |
-
cumulativeDistance += velocity * time;
|
139 |
-
var newPos = startPosition + distance + cumulativeDistance;
|
140 |
-
var decel = 30;
|
141 |
-
var end = (Math.abs( velocity ) - decel) < 0;
|
142 |
-
if ( direction === negativeDirection ) {
|
143 |
-
velocity += decel;
|
144 |
-
} else {
|
145 |
-
velocity -= decel;
|
146 |
-
}
|
147 |
-
if ( end || !setNewPosition( newPos ) ) {
|
148 |
-
clearInterval( posInterval );
|
149 |
-
setFinalPosition();
|
150 |
-
}
|
151 |
-
}, 20 );
|
152 |
-
} else {
|
153 |
-
setFinalPosition();
|
154 |
-
}
|
155 |
-
}
|
156 |
-
else if ( phase === "cancel" ) {
|
157 |
-
updatePosition();
|
158 |
-
}
|
159 |
-
}
|
160 |
-
} );
|
161 |
-
}
|
162 |
-
} );
|
163 |
-
} );
|
1 |
+
jQuery( function ( $ ) {
|
2 |
+
// The carousel widget
|
3 |
+
$( '.sow-carousel-wrapper' ).each( function () {
|
4 |
+
|
5 |
+
var $$ = $( this ),
|
6 |
+
$postsContainer = $$.closest( '.sow-carousel-container' ),
|
7 |
+
$container = $$.closest( '.sow-carousel-container' ).parent(),
|
8 |
+
$itemsContainer = $$.find( '.sow-carousel-items' ),
|
9 |
+
$items = $$.find( '.sow-carousel-item' ),
|
10 |
+
$firstItem = $items.eq( 0 );
|
11 |
+
|
12 |
+
var position = 0,
|
13 |
+
page = 1,
|
14 |
+
fetching = false,
|
15 |
+
numItems = $items.length,
|
16 |
+
totalPosts = $$.data( 'found-posts' ),
|
17 |
+
complete = numItems === totalPosts,
|
18 |
+
itemWidth = ( $firstItem.width() + parseInt( $firstItem.css( 'margin-right' ) ) ),
|
19 |
+
isRTL = $postsContainer.hasClass( 'js-rtl' ),
|
20 |
+
updateProp = isRTL ? 'margin-right' : 'margin-left';
|
21 |
+
|
22 |
+
var updatePosition = function () {
|
23 |
+
if ( position < 0 ) position = 0;
|
24 |
+
if ( position >= $$.find( '.sow-carousel-item' ).length - 1 ) {
|
25 |
+
position = $$.find( '.sow-carousel-item' ).length - 1;
|
26 |
+
// Fetch the next batch
|
27 |
+
if ( !fetching && !complete ) {
|
28 |
+
fetching = true;
|
29 |
+
page++;
|
30 |
+
$itemsContainer.append( '<li class="sow-carousel-item sow-carousel-loading"></li>' );
|
31 |
+
var instanceHash = $container.find( 'input[name="instance_hash"]' ).val();
|
32 |
+
|
33 |
+
$.get(
|
34 |
+
$$.data( 'ajax-url' ),
|
35 |
+
{
|
36 |
+
query: $$.data( 'query' ),
|
37 |
+
action: 'sow_carousel_load',
|
38 |
+
paged: page,
|
39 |
+
instance_hash: instanceHash,
|
40 |
+
},
|
41 |
+
function ( data, status ) {
|
42 |
+
var $items = $( data.html );
|
43 |
+
$items.appendTo( $itemsContainer ).hide().fadeIn();
|
44 |
+
$$.find( '.sow-carousel-loading' ).remove();
|
45 |
+
numItems = $$.find( '.sow-carousel-item' ).length;
|
46 |
+
complete = numItems === totalPosts;
|
47 |
+
fetching = false;
|
48 |
+
}
|
49 |
+
)
|
50 |
+
}
|
51 |
+
}
|
52 |
+
$itemsContainer.css( 'transition-duration', "0.45s" );
|
53 |
+
$itemsContainer.css( updateProp, -( itemWidth * position ) + 'px' );
|
54 |
+
};
|
55 |
+
|
56 |
+
$container.on( 'click', 'a.sow-carousel-previous',
|
57 |
+
function ( e ) {
|
58 |
+
e.preventDefault();
|
59 |
+
position -= isRTL ? -1 : 1;
|
60 |
+
updatePosition();
|
61 |
+
}
|
62 |
+
);
|
63 |
+
|
64 |
+
$container.on( 'click', 'a.sow-carousel-next',
|
65 |
+
function ( e ) {
|
66 |
+
e.preventDefault();
|
67 |
+
position += isRTL ? -1 : 1;
|
68 |
+
updatePosition();
|
69 |
+
}
|
70 |
+
);
|
71 |
+
|
72 |
+
// Verify "swipe" method exists prior to invoking it.
|
73 |
+
if ( 'function' === typeof $$.swipe ) {
|
74 |
+
var validSwipe = false;
|
75 |
+
var prevDistance = 0;
|
76 |
+
var startPosition = 0;
|
77 |
+
var velocity = 0;
|
78 |
+
var prevTime = 0;
|
79 |
+
var posInterval;
|
80 |
+
var negativeDirection = isRTL ? 'right' : 'left';
|
81 |
+
|
82 |
+
var setNewPosition = function ( newPosition ) {
|
83 |
+
if ( newPosition < 50 && newPosition > -( itemWidth * numItems ) ) {
|
84 |
+
$itemsContainer.css( 'transition-duration', "0s" );
|
85 |
+
$itemsContainer.css( updateProp, newPosition + 'px' );
|
86 |
+
return true;
|
87 |
+
}
|
88 |
+
return false;
|
89 |
+
};
|
90 |
+
|
91 |
+
var setFinalPosition = function () {
|
92 |
+
var finalPosition = parseInt( $itemsContainer.css( updateProp ) );
|
93 |
+
position = Math.abs( Math.round( finalPosition / itemWidth ) );
|
94 |
+
updatePosition();
|
95 |
+
};
|
96 |
+
|
97 |
+
$$.on( 'click', '.sow-carousel-item a',
|
98 |
+
function ( event ) {
|
99 |
+
if ( validSwipe ) {
|
100 |
+
event.preventDefault();
|
101 |
+
validSwipe = false;
|
102 |
+
}
|
103 |
+
}
|
104 |
+
);
|
105 |
+
|
106 |
+
$$.swipe( {
|
107 |
+
excludedElements: "",
|
108 |
+
triggerOnTouchEnd: true,
|
109 |
+
threshold: 75,
|
110 |
+
swipeStatus: function ( event, phase, direction, distance, duration, fingerCount, fingerData ) {
|
111 |
+
if ( direction === 'up' || direction === 'down' ) {
|
112 |
+
return false;
|
113 |
+
}
|
114 |
+
|
115 |
+
if ( phase === "start" ) {
|
116 |
+
startPosition = -( itemWidth * position );
|
117 |
+
prevTime = new Date().getTime();
|
118 |
+
clearInterval( posInterval );
|
119 |
+
}
|
120 |
+
else if ( phase === "move" ) {
|
121 |
+
if ( direction === negativeDirection ) distance *= -1;
|
122 |
+
setNewPosition( startPosition + distance );
|
123 |
+
var newTime = new Date().getTime();
|
124 |
+
var timeDelta = ( newTime - prevTime ) / 1000;
|
125 |
+
velocity = ( distance - prevDistance ) / timeDelta;
|
126 |
+
prevTime = newTime;
|
127 |
+
prevDistance = distance;
|
128 |
+
}
|
129 |
+
else if ( phase === "end" ) {
|
130 |
+
validSwipe = true;
|
131 |
+
if ( direction === negativeDirection ) distance *= -1;
|
132 |
+
if ( Math.abs( velocity ) > 400 ) {
|
133 |
+
velocity *= 0.1;
|
134 |
+
var startTime = new Date().getTime();
|
135 |
+
var cumulativeDistance = 0;
|
136 |
+
posInterval = setInterval( function () {
|
137 |
+
var time = ( new Date().getTime() - startTime ) / 1000;
|
138 |
+
cumulativeDistance += velocity * time;
|
139 |
+
var newPos = startPosition + distance + cumulativeDistance;
|
140 |
+
var decel = 30;
|
141 |
+
var end = ( Math.abs( velocity ) - decel ) < 0;
|
142 |
+
if ( direction === negativeDirection ) {
|
143 |
+
velocity += decel;
|
144 |
+
} else {
|
145 |
+
velocity -= decel;
|
146 |
+
}
|
147 |
+
if ( end || !setNewPosition( newPos ) ) {
|
148 |
+
clearInterval( posInterval );
|
149 |
+
setFinalPosition();
|
150 |
+
}
|
151 |
+
}, 20 );
|
152 |
+
} else {
|
153 |
+
setFinalPosition();
|
154 |
+
}
|
155 |
+
}
|
156 |
+
else if ( phase === "cancel" ) {
|
157 |
+
updatePosition();
|
158 |
+
}
|
159 |
+
}
|
160 |
+
} );
|
161 |
+
}
|
162 |
+
} );
|
163 |
+
} );
|
widgets/price-table/js/pricetable.js
CHANGED
@@ -1,46 +1,66 @@
|
|
1 |
-
jQuery
|
2 |
-
$('.so-widget-sow-price-table .sow-equalize-row-heights').each(function () {
|
3 |
-
var $pt = $(this);
|
4 |
-
var equalizeHeights = function ( selector ) {
|
5 |
-
var maxHeight = 0;
|
6 |
-
var $elements = $pt.find(selector);
|
7 |
-
$elements.each(function () {
|
8 |
-
maxHeight = Math.max(maxHeight, $(this).height());
|
9 |
-
});
|
10 |
-
$elements.height(maxHeight);
|
11 |
-
};
|
12 |
|
13 |
-
|
14 |
-
$pt.find('.ow-pt-features').each(function () {
|
15 |
-
maxFeatures = Math.max(maxFeatures, $(this).find('.ow-pt-feature').length);
|
16 |
-
});
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
} );
|
1 |
+
/* globals jQuery, sowb */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
+
var sowb = window.sowb || {};
|
|
|
|
|
|
|
4 |
|
5 |
+
jQuery( function ( $ ) {
|
6 |
+
var setupPriceTable = function () {
|
7 |
+
$( '.so-widget-sow-price-table' ).each( function () {
|
8 |
+
var $priceTable = $( this );
|
9 |
+
|
10 |
+
if ( ! $priceTable.is( ':visible' ) || $priceTable.data( 'initialized' ) ) {
|
11 |
+
return $priceTable;
|
12 |
+
}
|
13 |
+
|
14 |
+
$priceTable.find( '.sow-equalize-row-heights' ).each( function () {
|
15 |
+
var $pt = $( this );
|
16 |
+
var equalizeHeights = function ( selector ) {
|
17 |
+
var maxHeight = 0;
|
18 |
+
var $elements = $pt.find( selector );
|
19 |
+
$elements.each( function () {
|
20 |
+
maxHeight = Math.max( maxHeight, $( this ).height() );
|
21 |
+
} );
|
22 |
+
$elements.height( maxHeight );
|
23 |
+
};
|
24 |
+
|
25 |
+
var maxFeatures = 0;
|
26 |
+
$pt.find( '.ow-pt-features' ).each( function () {
|
27 |
+
maxFeatures = Math.max( maxFeatures, $( this ).find( '.ow-pt-feature' ).length );
|
28 |
+
} );
|
29 |
+
|
30 |
+
for ( var i = 0; i < maxFeatures; i++ ) {
|
31 |
+
equalizeHeights( '.ow-pt-feature-index-' + i );
|
32 |
+
}
|
33 |
+
|
34 |
+
var selectors = [ '.ow-pt-title', '.ow-pt-details', '.ow-pt-image', '.ow-pt-features', '.ow-pt-button' ];
|
35 |
+
selectors.forEach( equalizeHeights );
|
36 |
+
} );
|
37 |
+
|
38 |
+
$( '.ow-pt-icon[data-icon]' ).each( function () {
|
39 |
+
var $$ = $( this );
|
40 |
+
var icon = $$.data( 'icon' );
|
41 |
+
|
42 |
+
if ( $( '#so-pt-icon-' + icon ).length ) {
|
43 |
+
var svg = $( '#so-pt-icon-' + icon + ' svg' ).clone().css( {
|
44 |
+
'max-width': 24,
|
45 |
+
'max-height': 24
|
46 |
+
} );
|
47 |
+
|
48 |
+
if ( $$.data( 'icon-color' ) !== '' ) {
|
49 |
+
svg.find( 'path' ).css( 'fill', $$.data( 'icon-color' ) );
|
50 |
+
}
|
51 |
+
else {
|
52 |
+
svg.find( 'path' ).css( 'fill', '#333333' );
|
53 |
+
}
|
54 |
+
|
55 |
+
$$.append( svg );
|
56 |
+
}
|
57 |
+
} );
|
58 |
+
|
59 |
+
$priceTable.data( 'initialized', true );
|
60 |
+
} );
|
61 |
+
};
|
62 |
+
|
63 |
+
setupPriceTable();
|
64 |
+
|
65 |
+
$( sowb ).on( 'setup_widgets', setupPriceTable );
|
66 |
} );
|
widgets/price-table/js/pricetable.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(function(t){t(".so-widget-sow-price-table .sow-equalize-row-heights").each(function(){var i=t(this),
|
1 |
+
var sowb=window.sowb||{};jQuery(function(t){var i=function(){t(".so-widget-sow-price-table").each(function(){var i=t(this);if(!i.is(":visible")||i.data("initialized"))return i;i.find(".sow-equalize-row-heights").each(function(){var i=t(this),a=function(a){var o=0,n=i.find(a);n.each(function(){o=Math.max(o,t(this).height())}),n.height(o)},o=0;i.find(".ow-pt-features").each(function(){o=Math.max(o,t(this).find(".ow-pt-feature").length)});for(var n=0;n<o;n++)a(".ow-pt-feature-index-"+n);[".ow-pt-title",".ow-pt-details",".ow-pt-image",".ow-pt-features",".ow-pt-button"].forEach(a)}),t(".ow-pt-icon[data-icon]").each(function(){var i=t(this),a=i.data("icon");if(t("#so-pt-icon-"+a).length){var o=t("#so-pt-icon-"+a+" svg").clone().css({"max-width":24,"max-height":24});""!==i.data("icon-color")?o.find("path").css("fill",i.data("icon-color")):o.find("path").css("fill","#333333"),i.append(o)}}),i.data("initialized",!0)})};i(),t(sowb).on("setup_widgets",i)});
|
widgets/simple-masonry/js/simple-masonry.js
CHANGED
@@ -2,75 +2,75 @@
|
|
2 |
|
3 |
var sowb = window.sowb || {};
|
4 |
|
5 |
-
jQuery( function($){
|
6 |
-
sowb.setupSimpleMasonries = function() {
|
7 |
-
var $grid = $('.sow-masonry-grid');
|
8 |
|
9 |
if ( !$grid.is( ':visible' ) || $grid.data( 'initialized' ) ) {
|
10 |
return $grid;
|
11 |
}
|
12 |
-
|
13 |
-
var resizeMasonry = function(){
|
14 |
-
$grid.each(function(){
|
15 |
-
var $gridEl = $(this);
|
16 |
-
var layouts = $gridEl.data('layouts');
|
17 |
-
var tabletQuery = window.matchMedia('(max-width: ' + layouts.tablet.breakPoint + 'px)');
|
18 |
-
var mobileQuery = window.matchMedia('(max-width: ' + layouts.mobile.breakPoint + 'px)');
|
19 |
var layout = layouts.desktop;
|
20 |
-
if(mobileQuery.matches) {
|
21 |
layout = layouts.mobile;
|
22 |
-
} else if (tabletQuery.matches) {
|
23 |
layout = layouts.tablet;
|
24 |
}
|
25 |
var numColumns = layout.numColumns;
|
26 |
-
$gridEl.css('width', 'auto');
|
27 |
var horizontalGutterSpace = layout.gutter * ( numColumns - 1 );
|
28 |
var columnWidth = Math.floor( ( $gridEl.width() - ( horizontalGutterSpace ) ) / numColumns );
|
29 |
$gridEl.width( ( columnWidth * numColumns ) + horizontalGutterSpace );
|
30 |
-
|
31 |
-
$gridEl.imagesLoaded( function() {
|
32 |
-
$gridEl.find('> .sow-masonry-grid-item').each(function(){
|
33 |
-
var $$ = $(this);
|
34 |
-
var colSpan = $$.data('colSpan');
|
35 |
-
colSpan = Math.max(Math.min(colSpan, layout.numColumns), 1);
|
36 |
-
$$.width( ( columnWidth * colSpan ) + (layout.gutter * (colSpan-1)));
|
37 |
-
var rowSpan = $$.data('rowSpan');
|
38 |
-
rowSpan = Math.max(Math.min(rowSpan, layout.numColumns), 1);
|
39 |
//Use rowHeight if non-zero else fall back to matching columnWidth.
|
40 |
var rowHeight = layout.rowHeight || columnWidth;
|
41 |
-
$$.css('height', (rowHeight * rowSpan) + (layout.gutter * (rowSpan-1)));
|
42 |
-
|
43 |
-
var $img = $$.find('> img,> a > img');
|
44 |
-
var imgAR = $img.attr('height') > 0 ? $img.attr('width')
|
45 |
-
var itemAR = $$.height() > 0 ? $$.width()
|
46 |
-
imgAR = parseFloat(imgAR.toFixed(3));
|
47 |
-
itemAR = parseFloat(itemAR.toFixed(3));
|
48 |
-
if(imgAR > itemAR) {
|
49 |
-
$img.css('width', 'auto');
|
50 |
-
$img.css('height', '100%');
|
51 |
-
$img.css('margin-top', '');
|
52 |
-
var marginLeft = ($img.width() - $$.width()) * -0.5;
|
53 |
-
$img.css('margin-left', marginLeft+'px');
|
54 |
}
|
55 |
else {
|
56 |
-
$img.css('height', 'auto');
|
57 |
-
$img.css('width', '100%');
|
58 |
-
$img.css('margin-left', '');
|
59 |
-
var marginTop = ($img.height() - $$.height()) * -0.5;
|
60 |
-
$img.css('margin-top', marginTop+'px');
|
61 |
}
|
62 |
-
});
|
63 |
-
$gridEl.packery({
|
64 |
itemSelector: '.sow-masonry-grid-item',
|
65 |
columnWidth: columnWidth,
|
66 |
gutter: layout.gutter
|
67 |
-
});
|
68 |
-
});
|
69 |
-
});
|
70 |
};
|
71 |
-
|
72 |
-
$(window).on('resize panelsStretchRows', resizeMasonry);
|
73 |
-
|
74 |
// Ensure that the masonry has resized correctly on load.
|
75 |
setTimeout( function () {
|
76 |
resizeMasonry();
|
@@ -79,7 +79,7 @@ jQuery( function($){
|
|
79 |
$grid.data( 'initialized', true );
|
80 |
};
|
81 |
sowb.setupSimpleMasonries();
|
82 |
-
|
83 |
$( sowb ).on( 'setup_widgets', sowb.setupSimpleMasonries );
|
84 |
} );
|
85 |
|
2 |
|
3 |
var sowb = window.sowb || {};
|
4 |
|
5 |
+
jQuery( function ( $ ) {
|
6 |
+
sowb.setupSimpleMasonries = function () {
|
7 |
+
var $grid = $( '.sow-masonry-grid' );
|
8 |
|
9 |
if ( !$grid.is( ':visible' ) || $grid.data( 'initialized' ) ) {
|
10 |
return $grid;
|
11 |
}
|
12 |
+
|
13 |
+
var resizeMasonry = function () {
|
14 |
+
$grid.each( function () {
|
15 |
+
var $gridEl = $( this );
|
16 |
+
var layouts = $gridEl.data( 'layouts' );
|
17 |
+
var tabletQuery = window.matchMedia( '(max-width: ' + layouts.tablet.breakPoint + 'px)' );
|
18 |
+
var mobileQuery = window.matchMedia( '(max-width: ' + layouts.mobile.breakPoint + 'px)' );
|
19 |
var layout = layouts.desktop;
|
20 |
+
if ( mobileQuery.matches ) {
|
21 |
layout = layouts.mobile;
|
22 |
+
} else if ( tabletQuery.matches ) {
|
23 |
layout = layouts.tablet;
|
24 |
}
|
25 |
var numColumns = layout.numColumns;
|
26 |
+
$gridEl.css( 'width', 'auto' );
|
27 |
var horizontalGutterSpace = layout.gutter * ( numColumns - 1 );
|
28 |
var columnWidth = Math.floor( ( $gridEl.width() - ( horizontalGutterSpace ) ) / numColumns );
|
29 |
$gridEl.width( ( columnWidth * numColumns ) + horizontalGutterSpace );
|
30 |
+
|
31 |
+
$gridEl.imagesLoaded( function () {
|
32 |
+
$gridEl.find( '> .sow-masonry-grid-item' ).each( function () {
|
33 |
+
var $$ = $( this );
|
34 |
+
var colSpan = $$.data( 'colSpan' );
|
35 |
+
colSpan = Math.max( Math.min( colSpan, layout.numColumns ), 1 );
|
36 |
+
$$.width( ( columnWidth * colSpan ) + ( layout.gutter * ( colSpan - 1 ) ) );
|
37 |
+
var rowSpan = $$.data( 'rowSpan' );
|
38 |
+
rowSpan = Math.max( Math.min( rowSpan, layout.numColumns ), 1 );
|
39 |
//Use rowHeight if non-zero else fall back to matching columnWidth.
|
40 |
var rowHeight = layout.rowHeight || columnWidth;
|
41 |
+
$$.css( 'height', ( rowHeight * rowSpan ) + ( layout.gutter * ( rowSpan - 1 ) ) );
|
42 |
+
|
43 |
+
var $img = $$.find( '> img,> a > img' );
|
44 |
+
var imgAR = $img.attr( 'height' ) > 0 ? $img.attr( 'width' ) / $img.attr( 'height' ) : 1;
|
45 |
+
var itemAR = $$.height() > 0 ? $$.width() / $$.height() : 1;
|
46 |
+
imgAR = parseFloat( imgAR.toFixed( 3 ) );
|
47 |
+
itemAR = parseFloat( itemAR.toFixed( 3 ) );
|
48 |
+
if ( imgAR > itemAR ) {
|
49 |
+
$img.css( 'width', 'auto' );
|
50 |
+
$img.css( 'height', '100%' );
|
51 |
+
$img.css( 'margin-top', '' );
|
52 |
+
var marginLeft = ( $img.width() - $$.width() ) * -0.5;
|
53 |
+
$img.css( 'margin-left', marginLeft + 'px' );
|
54 |
}
|
55 |
else {
|
56 |
+
$img.css( 'height', 'auto' );
|
57 |
+
$img.css( 'width', '100%' );
|
58 |
+
$img.css( 'margin-left', '' );
|
59 |
+
var marginTop = ( $img.height() - $$.height() ) * -0.5;
|
60 |
+
$img.css( 'margin-top', marginTop + 'px' );
|
61 |
}
|
62 |
+
} );
|
63 |
+
$gridEl.packery( {
|
64 |
itemSelector: '.sow-masonry-grid-item',
|
65 |
columnWidth: columnWidth,
|
66 |
gutter: layout.gutter
|
67 |
+
} );
|
68 |
+
} );
|
69 |
+
} );
|
70 |
};
|
71 |
+
|
72 |
+
$( window ).on( 'resize panelsStretchRows', resizeMasonry );
|
73 |
+
|
74 |
// Ensure that the masonry has resized correctly on load.
|
75 |
setTimeout( function () {
|
76 |
resizeMasonry();
|
79 |
$grid.data( 'initialized', true );
|
80 |
};
|
81 |
sowb.setupSimpleMasonries();
|
82 |
+
|
83 |
$( sowb ).on( 'setup_widgets', sowb.setupSimpleMasonries );
|
84 |
} );
|
85 |
|
widgets/social-media-buttons/js/social-media-buttons-admin.js
CHANGED
@@ -1,39 +1,39 @@
|
|
1 |
-
(function($){
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
if( selectedNetwork ) {
|
12 |
-
var $closestForm = $selectNetworkInput.closest('.siteorigin-widget-field-repeater-item-form');
|
13 |
-
|
14 |
-
var $urlInput = $closestForm.find('[id*="networks-url"]');
|
15 |
-
$urlInput.val(selectedNetwork.base_url);
|
16 |
-
|
17 |
-
var $iconColorPicker = $closestForm.find('[id*="networks-icon_color"]');
|
18 |
-
$iconColorPicker.wpColorPicker('color', selectedNetwork.icon_color);
|
19 |
-
|
20 |
-
var $buttonColorPicker = $closestForm.find('[id*="networks-button_color"]');
|
21 |
-
$buttonColorPicker.wpColorPicker('color', selectedNetwork.button_color);
|
22 |
-
}
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
})(jQuery);
|
1 |
+
( function ( $ ) {
|
2 |
+
|
3 |
+
// After the form is setup, add some custom stuff.
|
4 |
+
$( document ).on( 'sowsetupform', '.siteorigin-widget-form[data-class="SiteOrigin_Widget_SocialMediaButtons_Widget"]', function () {
|
5 |
+
var $socialMediaForm = $( this );
|
6 |
+
|
7 |
+
var setNetworkDefaults = function ( $selectNetworkInput ) {
|
8 |
+
window.sowbForms.fetchWidgetVariable( 'networks', 'SiteOrigin_Widget_SocialMediaButtons_Widget',
|
9 |
+
function ( networks ) {
|
10 |
+
var selectedNetwork = networks[ $selectNetworkInput.find( ':selected' ).val() ];
|
11 |
+
if ( selectedNetwork ) {
|
12 |
+
var $closestForm = $selectNetworkInput.closest( '.siteorigin-widget-field-repeater-item-form' );
|
13 |
+
|
14 |
+
var $urlInput = $closestForm.find( '[id*="networks-url"]' );
|
15 |
+
$urlInput.val( selectedNetwork.base_url );
|
16 |
+
|
17 |
+
var $iconColorPicker = $closestForm.find( '[id*="networks-icon_color"]' );
|
18 |
+
$iconColorPicker.wpColorPicker( 'color', selectedNetwork.icon_color );
|
19 |
+
|
20 |
+
var $buttonColorPicker = $closestForm.find( '[id*="networks-button_color"]' );
|
21 |
+
$buttonColorPicker.wpColorPicker( 'color', selectedNetwork.button_color );
|
22 |
+
}
|
23 |
+
}
|
24 |
+
);
|
25 |
+
};
|
26 |
+
|
27 |
+
if ( typeof $socialMediaForm.data( 'initialised' ) === 'undefined' ) {
|
28 |
+
$socialMediaForm.on( 'change', '[id*="networks-name"]',
|
29 |
+
function ( event ) {
|
30 |
+
setNetworkDefaults( $( event.target ) );
|
31 |
+
}
|
32 |
+
);
|
33 |
+
|
34 |
+
$socialMediaForm.data( 'initialised', true );
|
35 |
+
}
|
36 |
+
|
37 |
+
} );
|
38 |
+
|
39 |
+
} )( jQuery );
|
widgets/tabs/js/tabs.js
CHANGED
@@ -4,7 +4,7 @@ var sowb = window.sowb || {};
|
|
4 |
|
5 |
jQuery( function ( $ ) {
|
6 |
|
7 |
-
sowb.setupTabs = function() {
|
8 |
$( '.sow-tabs' ).each( function ( index, element ) {
|
9 |
var $this = $( element );
|
10 |
var $widget = $this.closest( '.so-widget-sow-tabs' );
|
4 |
|
5 |
jQuery( function ( $ ) {
|
6 |
|
7 |
+
sowb.setupTabs = function () {
|
8 |
$( '.sow-tabs' ).each( function ( index, element ) {
|
9 |
var $this = $( element );
|
10 |
var $widget = $this.closest( '.so-widget-sow-tabs' );
|
widgets/video/js/so-video-widget.js
CHANGED
@@ -1,15 +1,23 @@
|
|
1 |
-
/* globals jQuery , sowb */
|
2 |
-
|
3 |
-
var sowb = window.sowb || {};
|
4 |
-
|
5 |
-
jQuery( function ( $ ) {
|
6 |
-
sowb.setupVideoPlayers = function() {
|
7 |
-
var $ = jQuery;
|
8 |
-
$('video.sow-video-widget')
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* globals jQuery , sowb */
|
2 |
+
|
3 |
+
var sowb = window.sowb || {};
|
4 |
+
|
5 |
+
jQuery( function ( $ ) {
|
6 |
+
sowb.setupVideoPlayers = function () {
|
7 |
+
var $ = jQuery;
|
8 |
+
var $video = $( 'video.sow-video-widget' );
|
9 |
+
|
10 |
+
if ( !$video.is( ':visible' ) || $video.data( 'initialized' ) ) {
|
11 |
+
return $video;
|
12 |
+
}
|
13 |
+
|
14 |
+
$video.mediaelementplayer();
|
15 |
+
|
16 |
+
$video.data( 'initialized', true );
|
17 |
+
};
|
18 |
+
sowb.setupVideoPlayers();
|
19 |
+
|
20 |
+
$( sowb ).on( 'setup_widgets', sowb.setupVideoPlayers );
|
21 |
+
} );
|
22 |
+
|
23 |
+
window.sowb = sowb;
|
widgets/video/js/so-video-widget.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var sowb=window.sowb||{};jQuery(function(e){sowb.setupVideoPlayers=function(){jQuery("video.sow-video-widget").mediaelementplayer()},sowb.setupVideoPlayers(),e(sowb).on("setup_widgets",sowb.setupVideoPlayers)}),window.sowb=sowb;
|
1 |
+
var sowb=window.sowb||{};jQuery(function(e){sowb.setupVideoPlayers=function(){var e=jQuery,i=e("video.sow-video-widget");if(!i.is(":visible")||i.data("initialized"))return i;i.mediaelementplayer(),i.data("initialized",!0)},sowb.setupVideoPlayers(),e(sowb).on("setup_widgets",sowb.setupVideoPlayers)}),window.sowb=sowb;
|