SiteOrigin Widgets Bundle - Version 1.12.0

Version Description

  • 11 July 2018 =
  • Contact: Add dedicated textarea height.
  • Social Media Buttons: Adds WhatsApp social network.
  • Features: Allow icon size to use a different unit of measurement.
  • Repeater field: Update editor id in media buttons when duplicating item with TinyMCE editor.
  • Posts field: taxonomy description.
  • Price Table: Disable equalized row heights on mobile.
  • Beaver Builder: Force icon fonts.
  • Slider widgets: Added autoplay option for background videos.
  • Maps: Renamed Google maps script to more sensible sow.google-map.js
  • Editor: Prevent errors when visual editing is disabled for a user.
  • Optimized images.
  • Accordion/tabs: Trigger 'setup_widgets' to ensure any widgets in panels are initialized correctly.
  • Contact: Use 'From' email address if there is no email field in the form.
  • Hero: Filter out the align field in the button sub-widget form.
  • Testimonials: Switch mobile and tablet resolution width field descriptions.
  • Posts field: Allow clearing dates.
  • Font field: Use correct value for 'Helvetica Neue' and added 'Arial' option.
  • TA: Additional setting to allow clearing the default background colors.
  • Contact: Allow a value of '0' for required fields and subject values.
Download this release

Release Info

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

Code changes from version 1.11.8 to 1.12.0

Files changed (94) hide show
  1. admin/images/icon-back.png +0 -0
  2. admin/images/icon-front.png +0 -0
  3. admin/images/icon-gear.png +0 -0
  4. base/base.php +4 -1
  5. base/css/img/arrow-down.png +0 -0
  6. base/css/img/arrow-right.png +0 -0
  7. base/css/img/bundle-icon.png +0 -0
  8. base/css/img/close-white.png +0 -0
  9. base/css/img/close.png +0 -0
  10. base/css/img/loading.gif +0 -0
  11. base/css/img/order-asc.png +0 -0
  12. base/css/img/order-desc.png +0 -0
  13. base/css/img/ordering-icons.png +0 -0
  14. base/css/img/thumbnail-placeholder.png +0 -0
  15. base/css/img/wpspin_light-2x.gif +0 -0
  16. base/css/img/wpspin_light.gif +0 -0
  17. base/inc/fields/js/date-range-field.js +31 -21
  18. base/inc/fields/js/date-range-field.min.js +1 -1
  19. base/inc/fields/js/tinymce-field.js +4 -2
  20. base/inc/fields/js/tinymce-field.min.js +1 -1
  21. base/inc/fields/posts.class.php +189 -188
  22. base/inc/fields/tinymce.class.php +65 -57
  23. base/inc/fields/widget.class.php +71 -60
  24. base/inc/video.php +96 -0
  25. base/inc/widgets/base-slider.class.php +12 -4
  26. base/js/admin.js +9 -0
  27. base/js/admin.min.js +1 -1
  28. base/siteorigin-widget.class.php +14 -9
  29. compat/beaver-builder/styles.css +6 -6
  30. js/slider/jquery.slider.js +266 -267
  31. js/slider/jquery.slider.min.js +1 -1
  32. js/{sow.google.map.js → sow.google-map.js} +5 -12
  33. js/sow.google-map.min.js +1 -0
  34. js/sow.google.map.min.js +0 -1
  35. js/sow.jquery.fittext.js +71 -68
  36. js/sow.jquery.fittext.min.js +1 -1
  37. lang/so-widgets-bundle.pot +758 -755
  38. readme.txt +23 -2
  39. so-widgets-bundle.php +3 -3
  40. widgets/accordion/assets/banner.svg +1 -18
  41. widgets/accordion/js/accordion.js +6 -0
  42. widgets/accordion/js/accordion.min.js +1 -1
  43. widgets/button/assets/banner.svg +1 -30
  44. widgets/contact/assets/banner.svg +1 -43
  45. widgets/contact/contact.php +15 -5
  46. widgets/contact/styles/default.less +9 -1
  47. widgets/cta/assets/banner.svg +1 -33
  48. widgets/cta/css/style.css +1 -1
  49. widgets/cta/cta.php +22 -0
  50. widgets/cta/styles/default.less +8 -4
  51. widgets/editor/assets/banner.svg +1 -38
  52. widgets/features/assets/banner.svg +1 -56
  53. widgets/features/images/containers/explode.svg +1 -8
  54. widgets/features/images/containers/frame.svg +1 -7
  55. widgets/features/images/containers/hex.svg +1 -7
  56. widgets/features/images/containers/octagon.svg +1 -8
  57. widgets/features/images/containers/round.svg +1 -7
  58. widgets/features/images/containers/rounded-hex.svg +1 -10
  59. widgets/features/images/containers/rounded-square.svg +1 -7
  60. widgets/features/images/containers/rounded-sticker.svg +1 -12
  61. widgets/features/images/containers/square.svg +1 -7
  62. widgets/features/images/containers/sticker.svg +1 -9
  63. widgets/features/tpl/default.php +1 -1
  64. widgets/google-map/assets/banner.svg +1 -44
  65. widgets/headline/assets/banner.svg +1 -38
  66. widgets/hero/assets/banner.svg +1 -16
  67. widgets/hero/hero.php +9 -1
  68. widgets/icon/assets/banner.svg +1 -21
  69. widgets/image-grid/assets/banner.svg +1 -31
  70. widgets/image/assets/banner.svg +1 -36
  71. widgets/layout-slider/assets/banner.svg +1 -18
  72. widgets/layout-slider/layout-slider.php +314 -314
  73. widgets/layout-slider/styles/default.less +59 -59
  74. widgets/post-carousel/assets/banner.svg +1 -44
  75. widgets/post-carousel/css/images/carousel-loader.gif +0 -0
  76. widgets/price-table/assets/banner.svg +1 -36
  77. widgets/price-table/js/pricetable.js +46 -46
  78. widgets/price-table/styles/atom.less +238 -233
  79. widgets/simple-masonry/assets/banner.svg +1 -20
  80. widgets/simple-masonry/js/simple-masonry.js +86 -80
  81. widgets/simple-masonry/js/simple-masonry.min.js +1 -1
  82. widgets/slider/assets/banner.svg +1 -40
  83. widgets/social-media-buttons/assets/banner.svg +1 -39
  84. widgets/social-media-buttons/data/networks.php +283 -277
  85. widgets/tabs/assets/banner.svg +1 -17
  86. widgets/tabs/js/tabs.js +6 -0
  87. widgets/tabs/js/tabs.min.js +1 -1
  88. widgets/taxonomy/assets/banner.svg +1 -17
  89. widgets/testimonial/assets/banner.svg +1 -41
  90. widgets/testimonial/testimonial.php +2 -2
  91. widgets/video/assets/banner.svg +1 -36
  92. widgets/video/css/controls-skin.png +0 -0
  93. widgets/video/tpl/default.php +55 -53
  94. widgets/video/video.php +280 -346
admin/images/icon-back.png CHANGED
Binary file
admin/images/icon-front.png CHANGED
Binary file
admin/images/icon-gear.png CHANGED
Binary file
base/base.php CHANGED
@@ -11,6 +11,7 @@ include plugin_dir_path(__FILE__).'inc/array-utils.php';
11
include plugin_dir_path(__FILE__).'inc/attachments.php';
12
include plugin_dir_path(__FILE__).'inc/actions.php';
13
include plugin_dir_path(__FILE__).'inc/shortcode.php';
14
15
/**
16
* @param $css
@@ -93,7 +94,8 @@ function siteorigin_widget_get_icon($icon_value, $icon_styles = false) {
93
function siteorigin_widget_get_font($font_value) {
94
95
$web_safe = array(
96
- 'Helvetica Neue' => 'Arial, Helvetica, Geneva, sans-serif',
97
'Lucida Grande' => 'Lucida, Verdana, sans-serif',
98
'Georgia' => '"Times New Roman", Times, serif',
99
'Courier New' => 'Courier, mono',
@@ -201,6 +203,7 @@ function siteorigin_widgets_is_google_webfont( $font_value ) {
201
function siteorigin_widgets_font_families( ){
202
// Add the default fonts
203
$font_families = array(
204
'Helvetica Neue' => 'Helvetica Neue',
205
'Lucida Grande' => 'Lucida Grande',
206
'Georgia' => 'Georgia',
11
include plugin_dir_path(__FILE__).'inc/attachments.php';
12
include plugin_dir_path(__FILE__).'inc/actions.php';
13
include plugin_dir_path(__FILE__).'inc/shortcode.php';
14
+ include plugin_dir_path(__FILE__).'inc/video.php';
15
16
/**
17
* @param $css
94
function siteorigin_widget_get_font($font_value) {
95
96
$web_safe = array(
97
+ 'Arial' => 'Arial, "Helvetica Neue", Helvetica, sans-serif',
98
+ 'Helvetica Neue' => '"Helvetica Neue", Helvetica, Arial, sans-serif',
99
'Lucida Grande' => 'Lucida, Verdana, sans-serif',
100
'Georgia' => '"Times New Roman", Times, serif',
101
'Courier New' => 'Courier, mono',
203
function siteorigin_widgets_font_families( ){
204
// Add the default fonts
205
$font_families = array(
206
+ 'Arial' => 'Arial',
207
'Helvetica Neue' => 'Helvetica Neue',
208
'Lucida Grande' => 'Lucida Grande',
209
'Georgia' => 'Georgia',
base/css/img/arrow-down.png CHANGED
Binary file
base/css/img/arrow-right.png CHANGED
Binary file
base/css/img/bundle-icon.png CHANGED
Binary file
base/css/img/close-white.png CHANGED
Binary file
base/css/img/close.png CHANGED
Binary file
base/css/img/loading.gif CHANGED
Binary file
base/css/img/order-asc.png CHANGED
Binary file
base/css/img/order-desc.png CHANGED
Binary file
base/css/img/ordering-icons.png CHANGED
Binary file
base/css/img/thumbnail-placeholder.png CHANGED
Binary file
base/css/img/wpspin_light-2x.gif CHANGED
Binary file
base/css/img/wpspin_light.gif CHANGED
Binary file
base/inc/fields/js/date-range-field.js CHANGED
@@ -12,36 +12,46 @@
12
if ( $dateRangeField.find( '[class*="sowb-specific-date"]' ).length > 0 ) {
13
var createPikadayInput = function ( inputName, initVal ) {
14
var $field = $dateRangeField.find( '.' + inputName + '-picker' );
15
- var picker = new Pikaday( {
16
- field: $field[ 0 ],
17
- blurFieldOnSelect: false,
18
- toString: function( date, format ) {
19
var day = date.getDate();
20
day = day < 10 ? '0' + day.toString() : day.toString();
21
var month = date.getMonth() + 1;
22
month = month < 10 ? '0' + month.toString() : month.toString();
23
var year = date.getFullYear();
24
return year + '-' + month + '-' + day;
25
- },
26
- parse: function( dateString, format ) {
27
-
28
- var parts = dateString.split( '-' );
29
- var day = parseInt( parts[2] );
30
- var month = parseInt( parts[1] ) - 1;
31
- var year = parseInt( parts[0] );
32
- return new Date(year, month, day);
33
- },
34
- onSelect: function ( date ) {
35
- var curVal = valField.val() === '' ? {} : JSON.parse( valField.val() );
36
- curVal[ inputName ] = this.toString( date, this.format );
37
- $field.val( curVal[ inputName ] );
38
- valField.val( JSON.stringify( curVal ) );
39
- valField.trigger( 'change', { silent: true } );
40
- },
41
} );
42
43
- // We trigger the change event on the hidden value field, so prevent 'change' from individual date inputs.
44
$field.change( function ( event ) {
45
event.preventDefault();
46
return false;
47
} );
12
if ( $dateRangeField.find( '[class*="sowb-specific-date"]' ).length > 0 ) {
13
var createPikadayInput = function ( inputName, initVal ) {
14
var $field = $dateRangeField.find( '.' + inputName + '-picker' );
15
+ var dateToString = function ( date, format ) {
16
+ var dateString = '';
17
+ if ( ! isNaN( date.valueOf() ) ) {
18
var day = date.getDate();
19
day = day < 10 ? '0' + day.toString() : day.toString();
20
var month = date.getMonth() + 1;
21
month = month < 10 ? '0' + month.toString() : month.toString();
22
var year = date.getFullYear();
23
return year + '-' + month + '-' + day;
24
+ }
25
+
26
+ return dateString;
27
+ };
28
+ var parse = function ( dateString, format ) {
29
+ var parts = dateString.split( '-' );
30
+ var day = parseInt( parts[ 2 ] );
31
+ var month = parseInt( parts[ 1 ] ) - 1;
32
+ var year = parseInt( parts[ 0 ] );
33
+ return new Date( year, month, day );
34
+ };
35
+ var updateValField = function ( date ) {
36
+ var curVal = valField.val() === '' ? {} : JSON.parse( valField.val() );
37
+ curVal[ inputName ] = dateToString( date );
38
+ $field.val( curVal[ inputName ] );
39
+ valField.val( JSON.stringify( curVal ) );
40
+ valField.trigger( 'change', { silent: true } );
41
+ };
42
+ var picker = new Pikaday( {
43
+ field: $field[ 0 ],
44
+ blurFieldOnSelect: false,
45
+ toString: dateToString,
46
+ parse: parse,
47
+ onSelect: updateValField,
48
} );
49
50
$field.change( function ( event ) {
51
+ var dateVal = parse( $field.val() );
52
+ updateValField( dateVal );
53
+
54
+ // We trigger the change event on the hidden value field, so prevent 'change' from individual date inputs.
55
event.preventDefault();
56
return false;
57
} );
base/inc/fields/js/date-range-field.min.js CHANGED
@@ -1 +1 @@
1
- !function(t){t(document).on("sowsetupformfield",".siteorigin-widget-field-type-date-range",function(e){var i=t(this),n=i.find('input[type="hidden"][class="siteorigin-widget-input"]');if(!i.data("initialized")){if(i.find('[class*="sowb-specific-date"]').length>0){var a=function(t,e){var a=i.find("."+t+"-picker"),r=new Pikaday({field:a[0],blurFieldOnSelect:!1,toString:function(t,e){var i=t.getDate();i=i<10?"0"+i.toString():i.toString();var n=t.getMonth()+1;return n=n<10?"0"+n.toString():n.toString(),t.getFullYear()+"-"+n+"-"+i},parse:function(t,e){var i=t.split("-"),n=parseInt(i[2]),a=parseInt(i[1])-1,r=parseInt(i[0]);return new Date(r,a,n)},onSelect:function(e){var i=""===n.val()?{}:JSON.parse(n.val());i[t]=this.toString(e,this.format),a.val(i[t]),n.val(JSON.stringify(i)),n.trigger("change",{silent:!0})}});return a.change(function(t){return t.preventDefault(),!1}),e&&a.val(e),r}.bind(this),r=""===n.val()?{after:"",before:""}:JSON.parse(n.val()),s=a("after",r.after),l=a("before",r.before);n.change(function(t,e){if(!e||!e.silent){var i=""===n.val()?{after:"",before:""}:JSON.parse(n.val());s.setDate(i.after),l.setDate(i.before)}})}else i.find(".sowb-relative-date").length>0&&i.find(".sowb-relative-date").each(function(){var e=t(this).data("name");t(this).change(function(){var i=""===n.val()?{}:JSON.parse(n.val());i.hasOwnProperty(e)||(i[e]={}),i[e].value=t(this).find("> input").val(),i[e].unit=t(this).find("> select").val(),n.val(JSON.stringify(i)),n.trigger("change",{silent:!0})}.bind(this)),n.change(function(i,a){if(!a||!a.silent){var r=""===n.val()?{from:{},to:{}}:JSON.parse(n.val());r.hasOwnProperty(e)&&(t(this).find("> input").val(r[e].value),t(this).find("> select").val(r[e].unit))}}.bind(this))});i.data("initialized",!0)}})}(jQuery);
1
+ !function(e){e(document).on("sowsetupformfield",".siteorigin-widget-field-type-date-range",function(t){var i=e(this),a=i.find('input[type="hidden"][class="siteorigin-widget-input"]');if(!i.data("initialized")){if(i.find('[class*="sowb-specific-date"]').length>0){var n=function(e,t){var n=i.find("."+e+"-picker"),r=function(e,t){if(!isNaN(e.valueOf())){var i=e.getDate();i=i<10?"0"+i.toString():i.toString();var a=e.getMonth()+1;a=a<10?"0"+a.toString():a.toString();return e.getFullYear()+"-"+a+"-"+i}return""},l=function(e,t){var i=e.split("-"),a=parseInt(i[2]),n=parseInt(i[1])-1,r=parseInt(i[0]);return new Date(r,n,a)},s=function(t){var i=""===a.val()?{}:JSON.parse(a.val());i[e]=r(t),n.val(i[e]),a.val(JSON.stringify(i)),a.trigger("change",{silent:!0})},f=new Pikaday({field:n[0],blurFieldOnSelect:!1,toString:r,parse:l,onSelect:s});return n.change(function(e){var t=l(n.val());return s(t),e.preventDefault(),!1}),t&&n.val(t),f}.bind(this),r=""===a.val()?{after:"",before:""}:JSON.parse(a.val()),l=n("after",r.after),s=n("before",r.before);a.change(function(e,t){if(!t||!t.silent){var i=""===a.val()?{after:"",before:""}:JSON.parse(a.val());l.setDate(i.after),s.setDate(i.before)}})}else i.find(".sowb-relative-date").length>0&&i.find(".sowb-relative-date").each(function(){var t=e(this).data("name");e(this).change(function(){var i=""===a.val()?{}:JSON.parse(a.val());i.hasOwnProperty(t)||(i[t]={}),i[t].value=e(this).find("> input").val(),i[t].unit=e(this).find("> select").val(),a.val(JSON.stringify(i)),a.trigger("change",{silent:!0})}.bind(this)),a.change(function(i,n){if(!n||!n.silent){var r=""===a.val()?{from:{},to:{}}:JSON.parse(a.val());r.hasOwnProperty(t)&&(e(this).find("> input").val(r[t].value),e(this).find("> select").val(r[t].unit))}}.bind(this))});i.data("initialized",!0)}})}(jQuery);
base/inc/fields/js/tinymce-field.js CHANGED
@@ -33,8 +33,10 @@
33
} );
34
}
35
};
36
-
37
- settings.tinymce = $.extend( {}, settings.tinymce, { selector: '#' + id, setup: setupEditor } );
38
$( document ).on( 'wp-before-tinymce-init', function ( event, init ) {
39
if ( init.selector === settings.tinymce.selector ) {
40
var mediaButtons = $container.data( 'mediaButtons' );
33
} );
34
}
35
};
36
+
37
+ if ( settings.tinymce ) {
38
+ settings.tinymce = $.extend( {}, settings.tinymce, { selector: '#' + id, setup: setupEditor } );
39
+ }
40
$( document ).on( 'wp-before-tinymce-init', function ( event, init ) {
41
if ( init.selector === settings.tinymce.selector ) {
42
var mediaButtons = $container.data( 'mediaButtons' );
base/inc/fields/js/tinymce-field.min.js CHANGED
@@ -1 +1 @@
1
- !function(i){var e=function(e){if(!e.data("initialized")){var t,n=e.find(".siteorigin-widget-tinymce-container"),o=n.data("editorSettings");if(o.wpautopToggleField){var r=n.closest(".siteorigin-widget-form");t=r.find(o.wpautopToggleField),o.tinymce.wpautop=t.is(":checked")}var d=n.find("textarea"),s=d.attr("id"),a=function(i){i.on("change",function(){window.tinymce.get(s).save(),d.trigger("change")}),t&&(t.off("change"),t.on("change",function(){wp.editor.remove(s),o.tinymce.wpautop=t.is(":checked"),wp.editor.initialize(s,o)}))};if(o.tinymce=i.extend({},o.tinymce,{selector:"#"+s,setup:a}),i(document).on("wp-before-tinymce-init",function(i,t){if(t.selector===o.tinymce.selector){var r=n.data("mediaButtons");e.find(".wp-editor-tabs").before(r.html)}}),i(document).on("tinymce-editor-setup",function(){e.find(".wp-editor-wrap").hasClass(o.selectedEditor+"-active")||setTimeout(function(){window.switchEditors.go(s)},10)}),wp.editor.remove(s),d.is(":visible"))wp.editor.initialize(s,o);else var c=setInterval(function(){d.is(":visible")&&(wp.editor.initialize(s,o),clearInterval(c))},500);e.on("click",function(t){var n=i(t.target),r=n.hasClass("switch-tmce")?"tmce":"html";if("tmce"===r){var a=window.tinymce.get(s);if(n.hasClass("wp-switch-editor")&&null!==a){var c=d.val();-1!==c.search("<")&&-1===c.search(">")&&(c=c.replace(/</g,""),d.val(c)),a.setContent(window.switchEditors.wpautop(c))}}o.selectedEditor=r,e.find(".siteorigin-widget-tinymce-selected-editor").val(r)}),e.data("initialized",!0)}};i(document).on("sowsetupformfield",".siteorigin-widget-field-type-tinymce",function(){var t=i(this),n=t.closest(".siteorigin-widget-field-repeater-item-form");n.length>0?n.is(":visible")?e(t):n.on("slideToggleOpenComplete",function(){n.is(":visible")&&(e(t),n.off("slideToggleOpenComplete"))}):e(t)}),i(document).on("sortstop",function(t,n){var o;o=n.item.is(".siteorigin-widget-field-repeater-item")?n.item.find("> .siteorigin-widget-field-repeater-item-form"):n.item.find(".siteorigin-widget-form"),o.find(".siteorigin-widget-field-type-tinymce").each(function(){i(this).data("initialized",null),e(i(this))})})}(jQuery);
1
+ !function(i){var e=function(e){if(!e.data("initialized")){var t,n=e.find(".siteorigin-widget-tinymce-container"),o=n.data("editorSettings");if(o.wpautopToggleField){var r=n.closest(".siteorigin-widget-form");t=r.find(o.wpautopToggleField),o.tinymce.wpautop=t.is(":checked")}var d=n.find("textarea"),s=d.attr("id"),a=function(i){i.on("change",function(){window.tinymce.get(s).save(),d.trigger("change")}),t&&(t.off("change"),t.on("change",function(){wp.editor.remove(s),o.tinymce.wpautop=t.is(":checked"),wp.editor.initialize(s,o)}))};if(o.tinymce&&(o.tinymce=i.extend({},o.tinymce,{selector:"#"+s,setup:a})),i(document).on("wp-before-tinymce-init",function(i,t){if(t.selector===o.tinymce.selector){var r=n.data("mediaButtons");e.find(".wp-editor-tabs").before(r.html)}}),i(document).on("tinymce-editor-setup",function(){e.find(".wp-editor-wrap").hasClass(o.selectedEditor+"-active")||setTimeout(function(){window.switchEditors.go(s)},10)}),wp.editor.remove(s),d.is(":visible"))wp.editor.initialize(s,o);else var c=setInterval(function(){d.is(":visible")&&(wp.editor.initialize(s,o),clearInterval(c))},500);e.on("click",function(t){var n=i(t.target),r=n.hasClass("switch-tmce")?"tmce":"html";if("tmce"===r){var a=window.tinymce.get(s);if(n.hasClass("wp-switch-editor")&&null!==a){var c=d.val();-1!==c.search("<")&&-1===c.search(">")&&(c=c.replace(/</g,""),d.val(c)),a.setContent(window.switchEditors.wpautop(c))}}o.selectedEditor=r,e.find(".siteorigin-widget-tinymce-selected-editor").val(r)}),e.data("initialized",!0)}};i(document).on("sowsetupformfield",".siteorigin-widget-field-type-tinymce",function(){var t=i(this),n=t.closest(".siteorigin-widget-field-repeater-item-form");n.length>0?n.is(":visible")?e(t):n.on("slideToggleOpenComplete",function(){n.is(":visible")&&(e(t),n.off("slideToggleOpenComplete"))}):e(t)}),i(document).on("sortstop",function(t,n){var o;o=n.item.is(".siteorigin-widget-field-repeater-item")?n.item.find("> .siteorigin-widget-field-repeater-item-form"):n.item.find(".siteorigin-widget-form"),o.find(".siteorigin-widget-field-type-tinymce").each(function(){i(this).data("initialized",null),e(i(this))})})}(jQuery);
base/inc/fields/posts.class.php CHANGED
@@ -1,188 +1,189 @@
1
- <?php
2
-
3
- /**
4
- * Class SiteOrigin_Widget_Field_Posts
5
- */
6
- class SiteOrigin_Widget_Field_Posts extends SiteOrigin_Widget_Field_Container_Base {
7
-
8
- public function __construct( $base_name, $element_id, $element_name, $field_options, SiteOrigin_Widget $for_widget, $parent_container = array() ) {
9
- parent::__construct( $base_name, $element_id, $element_name, $field_options, $for_widget, $parent_container );
10
-
11
- $types = get_post_types( array( 'public' => true ), 'objects' );
12
- $type_options = array( '_all' => __( 'All', 'so-widgets-bundle' ) );
13
-
14
- foreach ( $types as $id => $type ) {
15
- $type_options[ $id ] = $type->labels->name;
16
- }
17
-
18
- $this->fields = array(
19
-
20
- 'post_type' => array(
21
- 'type' => 'select',
22
- 'label' => __( 'Post type', 'so-widgets-bundle' ),
23
- 'multiple' => true,
24
- 'options' => $type_options,
25
- 'default' => 'post'
26
- ),
27
-
28
- 'post__in' => array(
29
- 'type' => 'autocomplete',
30
- 'label' => __( 'Post in', 'so-widgets-bundle' ),
31
- 'source' => 'posts',
32
- ),
33
-
34
- 'tax_query' => array(
35
- 'type' => 'autocomplete',
36
- 'label' => __( 'Taxonomies', 'so-widgets-bundle' ),
37
- 'source' => 'terms',
38
- ),
39
-
40
- 'date_type' => array(
41
- 'type' => 'radio',
42
- 'label' => __( 'Date selection type', 'so-widgets-bundle' ),
43
- 'options' => array(
44
- 'specific' => __( 'Specific', 'so-widgets-bundle' ),
45
- 'relative' => __( 'Relative', 'so-widgets-bundle' ),
46
- ),
47
- 'description' => __( 'Select a range between specific dates or relative to the current date.', 'so-widgets-bundle' ),
48
- 'default' => 'specific',
49
- 'state_emitter' => array(
50
- 'callback' => 'select',
51
- 'args' => array( 'date_type' )
52
- ),
53
- ),
54
-
55
- 'date_query' => array(
56
- 'type' => 'date-range',
57
- 'label' => __( 'Dates', 'so-widgets-bundle' ),
58
- 'date_type' => 'specific',
59
- 'state_handler' => array(
60
- 'date_type[specific]' => array('show'),
61
- '_else[date_type]' => array('hide'),
62
- ),
63
- ),
64
-
65
- 'date_query_relative' => array(
66
- 'type' => 'date-range',
67
- 'label' => __( 'Dates', 'so-widgets-bundle' ),
68
- 'date_type' => 'relative',
69
- 'state_handler' => array(
70
- 'date_type[relative]' => array('show'),
71
- '_else[date_type]' => array('hide'),
72
- ),
73
- ),
74
-
75
- 'orderby' => array(
76
- 'type' => 'select',
77
- 'label' => __( 'Order by', 'so-widgets-bundle' ),
78
- 'options' => array(
79
- 'none' => __( 'No order', 'so-widgets-bundle' ),
80
- 'ID' => __( 'Post ID', 'so-widgets-bundle' ),
81
- 'author' => __( 'Author', 'so-widgets-bundle' ),
82
- 'title' => __( 'Title', 'so-widgets-bundle' ),
83
- 'date' => __( 'Published date', 'so-widgets-bundle' ),
84
- 'modified' => __( 'Modified date', 'so-widgets-bundle' ),
85
- 'parent' => __( 'By parent', 'so-widgets-bundle' ),
86
- 'rand' => __( 'Random order', 'so-widgets-bundle' ),
87
- 'comment_count' => __( 'Comment count', 'so-widgets-bundle' ),
88
- 'menu_order' => __( 'Menu order', 'so-widgets-bundle' ),
89
- 'meta_value' => __( 'By meta value', 'so-widgets-bundle' ),
90
- 'meta_value_num' => __( 'By numeric meta value', 'so-widgets-bundle' ),
91
- 'post__in' => __( 'By include order', 'so-widgets-bundle' ),
92
- ),
93
- 'default' => 'date',
94
- ),
95
-
96
- 'order' => array(
97
- 'type' => 'radio',
98
- 'label' => __( 'Order direction', 'so-widgets-bundle' ),
99
- 'options' => array(
100
- 'ASC' => __( 'Ascending', 'so-widgets-bundle' ),
101
- 'DESC' => __( 'Descending', 'so-widgets-bundle' ),
102
- ),
103
- 'default' => 'DESC',
104
- ),
105
-
106
- 'posts_per_page' => array(
107
- 'type' => 'number',
108
- 'label' => __( 'Posts per page', 'so-widgets-bundle' ),
109
- ),
110
-
111
- 'sticky' => array(
112
- 'type' => 'select',
113
- 'label' => __( 'Sticky posts', 'so-widgets-bundle' ),
114
- 'options' => array(
115
- '' => __( 'Default', 'so-widgets-bundle' ),
116
- 'ignore' => __( 'Ignore sticky', 'so-widgets-bundle' ),
117
- 'exclude' => __( 'Exclude sticky', 'so-widgets-bundle' ),
118
- 'only' => __( 'Only sticky', 'so-widgets-bundle' ),
119
- ),
120
- ),
121
-
122
- 'additional' => array(
123
- 'type' => 'text',
124
- 'label' => __( 'Additional', 'so-widgets-bundle' ),
125
- 'description' => __( 'Additional query arguments. See <a href="http://codex.wordpress.org/Function_Reference/query_posts" target="_blank" rel="noopener noreferrer">query_posts</a>.', 'so-widgets-bundle' ),
126
- ),
127
- );
128
- }
129
-
130
- protected function render_field_label( $value, $instance ) {
131
- ?><div class="posts-container-label-wrapper<?php if ( $this->state == 'open' ) {
132
- echo ' siteorigin-widget-section-visible';
133
- } ?>"><?php
134
- parent::render_field_label( $value, $instance );
135
- ?><span class="sow-current-count"><?php echo esc_html( siteorigin_widget_post_selector_count_posts( $value ) )?></span>
136
- </div><?php
137
- }
138
-
139
- protected function render_field( $value, $instance ) {
140
- $value = wp_parse_args( $value );
141
-
142
- if( !empty( $value['post_type'] ) ) {
143
- $value['post_type'] = strpos( $value['post_type'], ',' ) !== false ? explode( ',', $value['post_type'] ) : $value['post_type'];
144
- }
145
-
146
- if ( $this->collapsible ) {
147
- ?><div class="siteorigin-widget-section <?php if ( $this->state == 'closed' ) {
148
- echo 'siteorigin-widget-section-hide';
149
- } ?>"><?php
150
- }
151
-
152
- $this->create_and_render_sub_fields( $value, array( 'name' => $this->base_name, 'type' => 'composite' ) );
153
-
154
- if ( $this->collapsible ) {
155
- ?></div><?php
156
- }
157
- }
158
-
159
- public function enqueue_scripts() {
160
- wp_enqueue_script(
161
- 'so-posts-selector-field',
162
- plugin_dir_url( __FILE__ ) . 'js/posts-field' . SOW_BUNDLE_JS_SUFFIX . '.js',
163
- array( 'jquery' ),
164
- SOW_BUNDLE_VERSION,
165
- true
166
- );
167
- }
168
-
169
- protected function sanitize_field_input( $value, $instance ) {
170
- // Special handling for the 'additional' args field.
171
- if ( ! empty( $value['additional'] ) ) {
172
- $value['additional'] = urlencode( $value['additional'] );
173
- }
174
- $value = parent::sanitize_field_input( $value, $instance );
175
- $result = '';
176
- foreach ( $value as $key => $item ) {
177
- if ( ! empty( $item ) ) {
178
- if ( is_array( $item ) ) {
179
- $item = implode( ',', $item );
180
- }
181
- $result .= ( empty( $result ) ? '' : '&' ) . $key . '=' . $item;
182
- }
183
- }
184
-
185
- return $result;
186
- }
187
-
188
- }
1
+ <?php
2
+
3
+ /**
4
+ * Class SiteOrigin_Widget_Field_Posts
5
+ */
6
+ class SiteOrigin_Widget_Field_Posts extends SiteOrigin_Widget_Field_Container_Base {
7
+
8
+ public function __construct( $base_name, $element_id, $element_name, $field_options, SiteOrigin_Widget $for_widget, $parent_container = array() ) {
9
+ parent::__construct( $base_name, $element_id, $element_name, $field_options, $for_widget, $parent_container );
10
+
11
+ $types = get_post_types( array( 'public' => true ), 'objects' );
12
+ $type_options = array( '_all' => __( 'All', 'so-widgets-bundle' ) );
13
+
14
+ foreach ( $types as $id => $type ) {
15
+ $type_options[ $id ] = $type->labels->name;
16
+ }
17
+
18
+ $this->fields = array(
19
+
20
+ 'post_type' => array(
21
+ 'type' => 'select',
22
+ 'label' => __( 'Post type', 'so-widgets-bundle' ),
23
+ 'multiple' => true,
24
+ 'options' => $type_options,
25
+ 'default' => 'post'
26
+ ),
27
+
28
+ 'post__in' => array(
29
+ 'type' => 'autocomplete',
30
+ 'label' => __( 'Post in', 'so-widgets-bundle' ),
31
+ 'source' => 'posts',
32
+ ),
33
+
34
+ 'tax_query' => array(
35
+ 'type' => 'autocomplete',
36
+ 'label' => __( 'Taxonomies', 'so-widgets-bundle' ),
37
+ 'source' => 'terms',
38
+ 'description' => __( 'Taxonomies are groups such as categories, tags, posts and products.', 'so-widgets-bundle' ),
39
+ ),
40
+
41
+ 'date_type' => array(
42
+ 'type' => 'radio',
43
+ 'label' => __( 'Date selection type', 'so-widgets-bundle' ),
44
+ 'options' => array(
45
+ 'specific' => __( 'Specific', 'so-widgets-bundle' ),
46
+ 'relative' => __( 'Relative', 'so-widgets-bundle' ),
47
+ ),
48
+ 'description' => __( 'Select a range between specific dates or relative to the current date.', 'so-widgets-bundle' ),
49
+ 'default' => 'specific',
50
+ 'state_emitter' => array(
51
+ 'callback' => 'select',
52
+ 'args' => array( 'date_type' )
53
+ ),
54
+ ),
55
+
56
+ 'date_query' => array(
57
+ 'type' => 'date-range',
58
+ 'label' => __( 'Dates', 'so-widgets-bundle' ),
59
+ 'date_type' => 'specific',
60
+ 'state_handler' => array(
61
+ 'date_type[specific]' => array('show'),
62
+ '_else[date_type]' => array('hide'),
63
+ ),
64
+ ),
65
+
66
+ 'date_query_relative' => array(
67
+ 'type' => 'date-range',
68
+ 'label' => __( 'Dates', 'so-widgets-bundle' ),
69
+ 'date_type' => 'relative',
70
+ 'state_handler' => array(
71
+ 'date_type[relative]' => array('show'),
72
+ '_else[date_type]' => array('hide'),
73
+ ),
74
+ ),
75
+
76
+ 'orderby' => array(
77
+ 'type' => 'select',
78
+ 'label' => __( 'Order by', 'so-widgets-bundle' ),
79
+ 'options' => array(
80
+ 'none' => __( 'No order', 'so-widgets-bundle' ),
81
+ 'ID' => __( 'Post ID', 'so-widgets-bundle' ),
82
+ 'author' => __( 'Author', 'so-widgets-bundle' ),
83
+ 'title' => __( 'Title', 'so-widgets-bundle' ),
84
+ 'date' => __( 'Published date', 'so-widgets-bundle' ),
85
+ 'modified' => __( 'Modified date', 'so-widgets-bundle' ),
86
+ 'parent' => __( 'By parent', 'so-widgets-bundle' ),
87
+ 'rand' => __( 'Random order', 'so-widgets-bundle' ),
88
+ 'comment_count' => __( 'Comment count', 'so-widgets-bundle' ),
89
+ 'menu_order' => __( 'Menu order', 'so-widgets-bundle' ),
90
+ 'meta_value' => __( 'By meta value', 'so-widgets-bundle' ),
91
+ 'meta_value_num' => __( 'By numeric meta value', 'so-widgets-bundle' ),
92
+ 'post__in' => __( 'By include order', 'so-widgets-bundle' ),
93
+ ),
94
+ 'default' => 'date',
95
+ ),
96
+
97
+ 'order' => array(
98
+ 'type' => 'radio',
99
+ 'label' => __( 'Order direction', 'so-widgets-bundle' ),
100
+ 'options' => array(
101
+ 'ASC' => __( 'Ascending', 'so-widgets-bundle' ),
102
+ 'DESC' => __( 'Descending', 'so-widgets-bundle' ),
103
+ ),
104
+ 'default' => 'DESC',
105
+ ),
106
+
107
+ 'posts_per_page' => array(
108
+ 'type' => 'number',
109
+ 'label' => __( 'Posts per page', 'so-widgets-bundle' ),
110
+ ),
111
+
112
+ 'sticky' => array(
113
+ 'type' => 'select',
114
+ 'label' => __( 'Sticky posts', 'so-widgets-bundle' ),
115
+ 'options' => array(
116
+ '' => __( 'Default', 'so-widgets-bundle' ),
117
+ 'ignore' => __( 'Ignore sticky', 'so-widgets-bundle' ),
118
+ 'exclude' => __( 'Exclude sticky', 'so-widgets-bundle' ),
119
+ 'only' => __( 'Only sticky', 'so-widgets-bundle' ),
120
+ ),
121
+ ),
122
+
123
+ 'additional' => array(
124
+ 'type' => 'text',
125
+ 'label' => __( 'Additional', 'so-widgets-bundle' ),
126
+ 'description' => __( 'Additional query arguments. See <a href="http://codex.wordpress.org/Function_Reference/query_posts" target="_blank" rel="noopener noreferrer">query_posts</a>.', 'so-widgets-bundle' ),
127
+ ),
128
+ );
129
+ }
130
+
131
+ protected function render_field_label( $value, $instance ) {
132
+ ?><div class="posts-container-label-wrapper<?php if ( $this->state == 'open' ) {
133
+ echo ' siteorigin-widget-section-visible';
134
+ } ?>"><?php
135
+ parent::render_field_label( $value, $instance );
136
+ ?><span class="sow-current-count"><?php echo esc_html( siteorigin_widget_post_selector_count_posts( $value ) )?></span>
137
+ </div><?php
138
+ }
139
+
140
+ protected function render_field( $value, $instance ) {
141
+ $value = wp_parse_args( $value );
142
+
143
+ if( !empty( $value['post_type'] ) ) {
144
+ $value['post_type'] = strpos( $value['post_type'], ',' ) !== false ? explode( ',', $value['post_type'] ) : $value['post_type'];
145
+ }
146
+
147
+ if ( $this->collapsible ) {
148
+ ?><div class="siteorigin-widget-section <?php if ( $this->state == 'closed' ) {
149
+ echo 'siteorigin-widget-section-hide';
150
+ } ?>"><?php
151
+ }
152
+
153
+ $this->create_and_render_sub_fields( $value, array( 'name' => $this->base_name, 'type' => 'composite' ) );
154
+
155
+ if ( $this->collapsible ) {
156
+ ?></div><?php
157
+ }
158
+ }
159
+
160
+ public function enqueue_scripts() {
161
+ wp_enqueue_script(
162
+ 'so-posts-selector-field',
163
+ plugin_dir_url( __FILE__ ) . 'js/posts-field' . SOW_BUNDLE_JS_SUFFIX . '.js',
164
+ array( 'jquery' ),
165
+ SOW_BUNDLE_VERSION,
166
+ true
167
+ );
168
+ }
169
+
170
+ protected function sanitize_field_input( $value, $instance ) {
171
+ // Special handling for the 'additional' args field.
172
+ if ( ! empty( $value['additional'] ) ) {
173
+ $value['additional'] = urlencode( $value['additional'] );
174
+ }
175
+ $value = parent::sanitize_field_input( $value, $instance );
176
+ $result = '';
177
+ foreach ( $value as $key => $item ) {
178
+ if ( ! empty( $item ) ) {
179
+ if ( is_array( $item ) ) {
180
+ $item = implode( ',', $item );
181
+ }
182
+ $result .= ( empty( $result ) ? '' : '&' ) . $key . '=' . $item;
183
+ }
184
+ }
185
+
186
+ return $result;
187
+ }
188
+
189
+ }
base/inc/fields/tinymce.class.php CHANGED
@@ -329,42 +329,72 @@ class SiteOrigin_Widget_Field_TinyMCE extends SiteOrigin_Widget_Field_Text_Input
329
return;
330
}
331
332
- $selected_editor = in_array( $this->selected_editor, array( 'tinymce', 'tmce' ) ) ? 'tmce' : 'html';
333
334
- $tmce_settings = array(
335
- 'toolbar1' => apply_filters( 'mce_buttons', $this->mce_buttons, $this->element_id ),
336
- 'toolbar2' => apply_filters( 'mce_buttons_2', $this->mce_buttons_2, $this->element_id ),
337
- 'toolbar3' => apply_filters( 'mce_buttons_3',$this->mce_buttons_3, $this->element_id ),
338
- 'toolbar4' => apply_filters( 'mce_buttons_4',$this->mce_buttons_4, $this->element_id ),
339
- 'plugins' => array_unique( apply_filters( 'tiny_mce_plugins', $this->mce_plugins ) ),
340
- );
341
-
342
- foreach ( $tmce_settings as $name => $setting ) {
343
- $tmce_settings[ $name ] = is_array( $setting ) ? implode( ',', $setting ) : '';
344
- }
345
-
346
- $tmce_settings['external_plugins'] = array_unique( apply_filters( 'mce_external_plugins', $this->mce_external_plugins ) );
347
-
348
- $suffix = SCRIPT_DEBUG ? '' : '.min';
349
- $version = 'ver=' . get_bloginfo( 'version' );
350
- // Default stylesheets
351
- $mce_css = includes_url( "css/dashicons$suffix.css?$version" ) . ',' .
352
- includes_url( "js/tinymce/skins/wordpress/wp-content.css?$version" );
353
354
- $editor_styles = get_editor_stylesheets();
355
356
- if ( ! empty( $editor_styles ) ) {
357
- // Force urlencoding of commas.
358
- foreach ( $editor_styles as $key => $url ) {
359
- if ( strpos( $url, ',' ) !== false ) {
360
- $editor_styles[ $key ] = str_replace( ',', '%2C', $url );
361
}
362
}
363
364
- $mce_css .= ',' . implode( ',', $editor_styles );
365
}
366
- $mce_css = trim( apply_filters( 'mce_css', $mce_css ), ' ,' );
367
- $tmce_settings['content_css'] = $mce_css;
368
369
$qt_settings = apply_filters(
370
'quicktags_settings',
@@ -375,43 +405,21 @@ class SiteOrigin_Widget_Field_TinyMCE extends SiteOrigin_Widget_Field_Text_Input
375
$qt_settings['buttons'] = ! empty( $qt_settings['buttons'] ) ? $qt_settings['buttons'] : array();
376
$qt_settings['buttons'] = is_array( $qt_settings['buttons'] ) ? implode( ',', $qt_settings['buttons'] ) : '';
377
378
- $settings = array(
379
- 'selectedEditor' => $selected_editor,
380
- 'tinymce' => array(
381
- 'wp_skip_init' => strpos( $this->element_id, '__i__' ) != false ||
382
- strpos( $this->element_id, '_id_' ) != false,
383
- 'wpautop' => ! empty( $this->wpautop ),
384
- ),
385
- 'quicktags' => array(
386
- 'buttons' => $qt_settings['buttons'],
387
- ),
388
);
389
390
- $tmce_settings = apply_filters( 'tiny_mce_before_init', $tmce_settings, $this->element_id );
391
-
392
- foreach ( $tmce_settings as $name => $setting ) {
393
- unset( $jdec );
394
- if ( ! empty( $tmce_settings[ $name ] ) ) {
395
- // Attempt to decode setting as JSON. For back compat with filters used by WP editor.
396
- if ( is_string( $setting ) ) {
397
- $jdec = json_decode( $setting, true );
398
- }
399
- $settings['tinymce'][ $name ] = empty( $jdec ) ? $setting : $jdec;
400
- }
401
- }
402
-
403
$value = apply_filters( 'the_editor_content', $value, $this->selected_editor );
404
405
if ( false !== stripos( $value, 'textarea' ) ) {
406
$value = preg_replace( '%</textarea%i', '&lt;/textarea', $value );
407
}
408
409
-
410
- $media_buttons = $this->render_media_buttons( $this->element_id );
411
-
412
?><div class="siteorigin-widget-tinymce-container"
413
- data-editor-settings="<?php echo esc_attr( json_encode( $settings ) ) ?>"
414
- data-media-buttons="<?php echo esc_attr( json_encode( array( 'html' => $media_buttons ) ) ) ?>">
415
<textarea id="<?php echo esc_attr( $this->element_id ) ?>"
416
name="<?php echo esc_attr( $this->element_name ) ?>"
417
<?php if ( isset( $this->editor_height ) ) : ?>
329
return;
330
}
331
332
+ $user_can_richedit = user_can_richedit();
333
334
+ $selected_editor = $user_can_richedit && in_array( $this->selected_editor, array( 'tinymce', 'tmce' ) ) ? 'tmce' : 'html';
335
336
+ $settings = array(
337
+ 'selectedEditor' => $selected_editor,
338
+ );
339
340
+ if ( $user_can_richedit ) {
341
+
342
+ $tmce_settings = array(
343
+ 'toolbar1' => apply_filters( 'mce_buttons', $this->mce_buttons, $this->element_id ),
344
+ 'toolbar2' => apply_filters( 'mce_buttons_2', $this->mce_buttons_2, $this->element_id ),
345
+ 'toolbar3' => apply_filters( 'mce_buttons_3',$this->mce_buttons_3, $this->element_id ),
346
+ 'toolbar4' => apply_filters( 'mce_buttons_4',$this->mce_buttons_4, $this->element_id ),
347
+ 'plugins' => array_unique( apply_filters( 'tiny_mce_plugins', $this->mce_plugins ) ),
348
+ );
349
+
350
+ foreach ( $tmce_settings as $name => $setting ) {
351
+ $tmce_settings[ $name ] = is_array( $setting ) ? implode( ',', $setting ) : '';
352
+ }
353
+
354
+ $tmce_settings['external_plugins'] = array_unique( apply_filters( 'mce_external_plugins', $this->mce_external_plugins ) );
355
+
356
+ $suffix = SCRIPT_DEBUG ? '' : '.min';
357
+ $version = 'ver=' . get_bloginfo( 'version' );
358
+ // Default stylesheets
359
+ $mce_css = includes_url( "css/dashicons$suffix.css?$version" ) . ',' .
360
+ includes_url( "js/tinymce/skins/wordpress/wp-content.css?$version" );
361
+
362
+ $editor_styles = get_editor_stylesheets();
363
+
364
+ if ( ! empty( $editor_styles ) ) {
365
+ // Force urlencoding of commas.
366
+ foreach ( $editor_styles as $key => $url ) {
367
+ if ( strpos( $url, ',' ) !== false ) {
368
+ $editor_styles[ $key ] = str_replace( ',', '%2C', $url );
369
+ }
370
+ }
371
+
372
+ $mce_css .= ',' . implode( ',', $editor_styles );
373
+ }
374
+ $mce_css = trim( apply_filters( 'mce_css', $mce_css ), ' ,' );
375
+ $tmce_settings['content_css'] = $mce_css;
376
+
377
+ $settings['tinymce'] = array(
378
+ 'wp_skip_init' => strpos( $this->element_id, '__i__' ) != false ||
379
+ strpos( $this->element_id, '_id_' ) != false,
380
+ 'wpautop' => ! empty( $this->wpautop ),
381
+ );
382
+
383
+ $tmce_settings = apply_filters( 'tiny_mce_before_init', $tmce_settings, $this->element_id );
384
+
385
+ foreach ( $tmce_settings as $name => $setting ) {
386
+ unset( $jdec );
387
+ if ( ! empty( $tmce_settings[ $name ] ) ) {
388
+ // Attempt to decode setting as JSON. For back compat with filters used by WP editor.
389
+ if ( is_string( $setting ) ) {
390
+ $jdec = json_decode( $setting, true );
391
+ }
392
+ $settings['tinymce'][ $name ] = empty( $jdec ) ? $setting : $jdec;
393
}
394
}
395
396
+ $media_buttons = $this->render_media_buttons( $this->element_id );
397
}
398
399
$qt_settings = apply_filters(
400
'quicktags_settings',
405
$qt_settings['buttons'] = ! empty( $qt_settings['buttons'] ) ? $qt_settings['buttons'] : array();
406
$qt_settings['buttons'] = is_array( $qt_settings['buttons'] ) ? implode( ',', $qt_settings['buttons'] ) : '';
407
408
+ $settings['quicktags'] = array(
409
+ 'buttons' => $qt_settings['buttons'],
410
);
411
412
$value = apply_filters( 'the_editor_content', $value, $this->selected_editor );
413
414
if ( false !== stripos( $value, 'textarea' ) ) {
415
$value = preg_replace( '%</textarea%i', '&lt;/textarea', $value );
416
}
417
418
?><div class="siteorigin-widget-tinymce-container"
419
+ <?php if ( ! empty( $media_buttons ) ) : ?>
420
+ data-media-buttons="<?php echo esc_attr( json_encode( array( 'html' => $media_buttons ) ) ) ?>"
421
+ <?php endif; ?>
422
+ data-editor-settings="<?php echo esc_attr( json_encode( $settings ) ) ?>">
423
<textarea id="<?php echo esc_attr( $this->element_id ) ?>"
424
name="<?php echo esc_attr( $this->element_name ) ?>"
425
<?php if ( isset( $this->editor_height ) ) : ?>
base/inc/fields/widget.class.php CHANGED
@@ -1,60 +1,71 @@
1
- <?php
2
-
3
- /**
4
- * Class SiteOrigin_Widget_Field_Widget
5
- */
6
- class SiteOrigin_Widget_Field_Widget extends SiteOrigin_Widget_Field_Container_Base {
7
- /**
8
- * The class name of the widget to be included.
9
- *
10
- * @access protected
11
- * @var string
12
- */
13
- protected $class;
14
-
15
- public function __construct( $base_name, $element_id, $element_name, $field_options, SiteOrigin_Widget $for_widget, $parent_container = array() ) {
16
- parent::__construct( $base_name, $element_id, $element_name, $field_options, $for_widget, $parent_container );
17
-
18
- if( isset( $this->class ) ) {
19
- if( class_exists( $this->class ) ) {
20
- /* @var $sub_widget SiteOrigin_Widget */
21
- $sub_widget = new $this->class;
22
- if( is_a( $sub_widget, 'SiteOrigin_Widget' ) ) {
23
- $this->fields = $sub_widget->form_options( $this->for_widget );
24
- }
25
- }
26
- }
27
- }
28
-
29
- protected function render_field( $value, $instance ) {
30
-
31
- echo '<div class="siteorigin-widget-widget">';
32
- if ( $this->collapsible ) {
33
- ?><div class="siteorigin-widget-section <?php if( $this->state == 'closed' ) echo 'siteorigin-widget-section-hide'; ?>"><?php
34
- }
35
-
36
- if( ! class_exists( $this->class ) ) {
37
- printf( __( '%s does not exist', 'so-widgets-bundle' ), $this->class );
38
- if ( $this->collapsible ) {
39
- echo '</div>';
40
- }
41
- return;
42
- }
43
-
44
- /* @var $sub_widget SiteOrigin_Widget */
45
- $sub_widget = new $this->class;
46
- if( ! is_a( $sub_widget, 'SiteOrigin_Widget' ) ) {
47
- printf( __( '%s is not a SiteOrigin Widget', 'so-widgets-bundle' ), $this->class );
48
- if ( $this->collapsible ) {
49
- echo '</div>';
50
- }
51
- return;
52
- }
53
- $this->create_and_render_sub_fields( $value, array( 'name' => $this->base_name, 'type' => 'widget' ) );
54
- if ( $this->collapsible ) {
55
- ?></div><?php
56
- }
57
- echo '</div>';
58
- }
59
-
60
- }
1
+ <?php
2
+
3
+ /**
4
+ * Class SiteOrigin_Widget_Field_Widget
5
+ */
6
+ class SiteOrigin_Widget_Field_Widget extends SiteOrigin_Widget_Field_Container_Base {
7
+ /**
8
+ * The class name of the widget to be included.
9
+ *
10
+ * @access protected
11
+ * @var string
12
+ */
13
+ protected $class;
14
+ /**
15
+ * A filter for the widget's form fields. In some cases we may want to filter some fields out of a sub-widget form.
16
+ *
17
+ * @access protected
18
+ * @var callable
19
+ */
20
+ protected $form_filter;
21
+
22
+ public function __construct( $base_name, $element_id, $element_name, $field_options, SiteOrigin_Widget $for_widget, $parent_container = array() ) {
23
+ parent::__construct( $base_name, $element_id, $element_name, $field_options, $for_widget, $parent_container );
24
+
25
+ if( isset( $this->class ) ) {
26
+ if( class_exists( $this->class ) ) {
27
+ /* @var $sub_widget SiteOrigin_Widget */
28
+ $sub_widget = new $this->class;
29
+ if( is_a( $sub_widget, 'SiteOrigin_Widget' ) ) {
30
+ if ( ! empty( $this->form_filter ) && is_callable( $this->form_filter ) ) {
31
+ $this->fields = call_user_func( $this->form_filter, $sub_widget->form_options( $this->for_widget ) );
32
+ } else {
33
+ $this->fields = $sub_widget->form_options( $this->for_widget );
34
+ }
35
+ }
36
+ }
37
+ }
38
+ }
39
+
40
+ protected function render_field( $value, $instance ) {
41
+
42
+ echo '<div class="siteorigin-widget-widget">';
43
+ if ( $this->collapsible ) {
44
+ ?><div class="siteorigin-widget-section <?php if( $this->state == 'closed' ) echo 'siteorigin-widget-section-hide'; ?>"><?php
45
+ }
46
+
47
+ if( ! class_exists( $this->class ) ) {
48
+ printf( __( '%s does not exist', 'so-widgets-bundle' ), $this->class );
49
+ if ( $this->collapsible ) {
50
+ echo '</div>';
51
+ }
52
+ return;
53
+ }
54
+
55
+ /* @var $sub_widget SiteOrigin_Widget */
56
+ $sub_widget = new $this->class;
57
+ if( ! is_a( $sub_widget, 'SiteOrigin_Widget' ) ) {
58
+ printf( __( '%s is not a SiteOrigin Widget', 'so-widgets-bundle' ), $this->class );
59
+ if ( $this->collapsible ) {
60
+ echo '</div>';
61
+ }
62
+ return;
63
+ }
64
+ $this->create_and_render_sub_fields( $value, array( 'name' => $this->base_name, 'type' => 'widget' ) );
65
+ if ( $this->collapsible ) {
66
+ ?></div><?php
67
+ }
68
+ echo '</div>';
69
+ }
70
+
71
+ }
base/inc/video.php ADDED
@@ -0,0 +1,96 @@
1
+ <?php
2
+
3
+ /**
4
+ * This class handles video related functionality.
5
+ *
6
+ * Class SiteOrigin_Video
7
+ */
8
+
9
+ class SiteOrigin_Video {
10
+
11
+ /**
12
+ * Check whether it's possible to oEmbed by testing if a provider URL can be obtained.
13
+ *
14
+ * @param string $url The URL of the video to be embedded.
15
+ *
16
+ * @return bool Whether it's possible to embed this video.
17
+ */
18
+ function can_oembed( $url ) {
19
+ $wp_oembed = new WP_oEmbed();
20
+ $provider = $wp_oembed->get_provider( $url, array( 'discover' => false ) );
21
+
22
+ return ! empty( $provider );
23
+ }
24
+
25
+ /**
26
+ * Gets a video source embed
27
+ *
28
+ * @param string $src The URL of the video.
29
+ * @param bool $autoplay Whether to start playing the video automatically once loaded. ( YouTube only )
30
+ * @param bool $related_videos Whether to show related videos after the video has finished playing. ( YouTube only )
31
+ *
32
+ * @return false|mixed|null|string|string[]
33
+ */
34
+ function get_video_oembed( $src, $autoplay = false, $related_videos = true ) {
35
+ if ( empty( $src ) ) {
36
+ return '';
37
+ }
38
+
39
+ global $content_width;
40
+
41
+ $video_width = ! empty( $content_width ) ? $content_width : 640;
42
+
43
+ $hash = md5( serialize( array(
44
+ 'src' => $src,
45
+ 'width' => $video_width,
46
+ 'autoplay' => $autoplay,
47
+ ) ) );
48
+
49
+ $html = get_transient( 'sow-vid-embed[' . $hash . ']' );
50
+ if ( empty( $html ) ) {
51
+ $html = wp_oembed_get( $src, array( 'width' => $video_width ) );
52
+
53
+ if ( $autoplay ) {
54
+ $html = preg_replace_callback( '/src=["\'](http[^"\']*)["\']/', array(
55
+ $this,
56
+ 'autoplay_callback'
57
+ ), $html );
58
+ }
59
+
60
+ if ( empty( $related_videos ) ) {
61
+ $html = preg_replace_callback( '/src=["\'](http[^"\']*)["\']/', array(
62
+ $this,
63
+ 'remove_related_videos'
64
+ ), $html );
65
+ }
66
+
67
+ if ( ! empty( $html ) ) {
68
+ set_transient( 'sow-vid-embed[' . $hash . ']', $html, 30 * 86400 );
69
+ }
70
+ }
71
+
72
+ return $html;
73
+ }
74
+
75
+ /**
76
+ * The preg_replace callback that adds autoplay.
77
+ *
78
+ * @param $match
79
+ *
80
+ * @return mixed
81
+ */
82
+ function autoplay_callback( $match ) {
83
+ return str_replace( $match[1], add_query_arg( 'autoplay', 1, $match[1] ), $match[0] );
84
+ }
85
+
86
+ /**
87
+ * The preg_replace callback that adds the rel param for YouTube videos.
88
+ *
89
+ * @param $match
90
+ *
91
+ * @return mixed
92
+ */
93
+ function remove_related_videos( $match ) {
94
+ return str_replace( $match[1], add_query_arg( 'rel', 0, $match[1] ), $match[0] );
95
+ }
96
+ }
base/inc/widgets/base-slider.class.php CHANGED
@@ -115,6 +115,13 @@ abstract class SiteOrigin_Widget_Base_Slider extends SiteOrigin_Widget {
115
'optional' => 'true',
116
'description' => __('An external URL of the video. Overrides video file.', 'so-widgets-bundle')
117
),
118
119
'format' => array(
120
'type' => 'select',
@@ -307,6 +314,7 @@ abstract class SiteOrigin_Widget_Base_Slider extends SiteOrigin_Widget {
307
if( empty( $videos ) ) return;
308
$video_element = '<video class="' . esc_attr( implode( ',', $classes ) ) . '" autoplay loop muted playsinline>';
309
310
foreach( $videos as $video ) {
311
if( empty( $video['file'] ) && empty ( $video['url'] ) ) continue;
312
// If video is an external file, try and display it using oEmbed
@@ -315,13 +323,13 @@ abstract class SiteOrigin_Widget_Base_Slider extends SiteOrigin_Widget {
315
if ( ! empty( $video['height'] ) ) {
316
$args['height'] = $video['height'];
317
}
318
- $embedded_video = wp_oembed_get( $video['url'], $args );
319
320
// Check if we can oEmbed the video or not
321
- if( !$embedded_video ) {
322
$video_file = sow_esc_url( $video['url'] );
323
- }else{
324
- echo $embedded_video;
325
continue;
326
}
327
}
115
'optional' => 'true',
116
'description' => __('An external URL of the video. Overrides video file.', 'so-widgets-bundle')
117
),
118
+
119
+ 'autoplay' => array(
120
+ 'type' => 'checkbox',
121
+ 'label' => __( 'Autoplay', 'so-widgets-bundle' ),
122
+ 'default' => false,
123
+ 'description' => __( 'Currently only for YouTube videos.', 'so-widgets-bundle' ),
124
+ ),
125
126
'format' => array(
127
'type' => 'select',
314
if( empty( $videos ) ) return;
315
$video_element = '<video class="' . esc_attr( implode( ',', $classes ) ) . '" autoplay loop muted playsinline>';
316
317
+ $so_video = new SiteOrigin_Video();
318
foreach( $videos as $video ) {
319
if( empty( $video['file'] ) && empty ( $video['url'] ) ) continue;
320
// If video is an external file, try and display it using oEmbed
323
if ( ! empty( $video['height'] ) ) {
324
$args['height'] = $video['height'];
325
}
326
+ $can_oembed = $so_video->can_oembed( $video['url'] );
327
328
// Check if we can oEmbed the video or not
329
+ if( ! $can_oembed ) {
330
$video_file = sow_esc_url( $video['url'] );
331
+ } else {
332
+ echo $so_video->get_video_oembed( $video['url'], ! empty( $video['autoplay'] ) );
333
continue;
334
}
335
}
base/js/admin.js CHANGED
@@ -826,6 +826,15 @@ var sowbForms = window.sowbForms || {};
826
}
827
828
$inputElement.attr('id', newId);
829
$copyItem.find('label[for=' + id + ']').attr('for', newId);
830
$copyItem.find('[id*=' + id + ']').each(function () {
831
var oldIdAttr = $(this).attr('id');
826
}
827
828
$inputElement.attr('id', newId);
829
+ if ( $inputElement.is( '.wp-editor-area' ) ) {
830
+ var tmceContainer = $inputElement.closest( '.siteorigin-widget-tinymce-container' );
831
+ var mediaButtons = tmceContainer.data( 'media-buttons' );
832
+ if ( mediaButtons && mediaButtons.html ) {
833
+ var idRegExp = new RegExp( id, 'g');
834
+ mediaButtons.html = mediaButtons.html.replace( idRegExp, newId );
835
+ tmceContainer.data( 'media-buttons', mediaButtons );
836
+ }
837
+ }
838
$copyItem.find('label[for=' + id + ']').attr('for', newId);
839
$copyItem.find('[id*=' + id + ']').each(function () {
840
var oldIdAttr = $(this).attr('id');
base/js/admin.min.js CHANGED
@@ -1 +1 @@
1
- var sowbForms=window.sowbForms||{};!function(e){e.fn.sowSetupForm=function(){return e(this).each(function(i,t){var r,n=e(t),a=!0,s=e("body"),o=n.find("input[name]");if(o.length&&-1!==o.attr("name").indexOf("__i__"))return this;if(n.is(".siteorigin-widget-form-main")){if(!0===n.data("sow-form-setup"))return!0;if(s.hasClass("widgets-php")&&!n.is(":visible")&&0===n.closest(".panel-dialog").length)return!0;n.on("sowstatechange",function(i,t,r){n.find("[data-state-handler]").each(function(){var i=e(this),n=e.extend({},i.data("state-handler"),a?i.data("state-handler-initial"):{});if(0===Object.keys(n).length)return!0;var s,o,d,l,g,f,c={},p=sowbForms.getContainerFieldId(i,"repeater",".siteorigin-widget-field-repeater-item");if(!1!==p){var u={};for(var m in n)u[m.replace("{$repeater}",p)]=n[m];n=u}var w=sowbForms.getContainerFieldId(i,"widget",".siteorigin-widget-widget");if(!1!==w){var v={};for(var h in n){var b=h.match(/_else\[(.*)\]|(.*)\[(.*)\]/),y="";y=b&&b.length&&void 0===b[1]?b[2]+"_"+w+"["+b[3]+"]":"_else["+b[1]+"_"+w+"]",v[y]=n[h]}n=v}for(var F in n)if(g=!1,null!==(s=F.match(/^([a-zA-Z0-9_-]+)(\[([a-zA-Z0-9_\-,]+)\])?(\[\])?#x2F;))){if(o={group:"default",name:"",multi:!1},void 0!==s[2]?(o.group=s[1],o.name=s[3]):o.name=s[0],o.multi=void 0!==s[4],"_else"===o.group)o.group=o.name,o.name="",g=o.group===t&&void 0===c[o.group];else{f=o.name.split(",").map(function(e){return e.trim()});for(var k=0;k<f.length&&!(g=o.group===t&&f[k]===r);k++);}if(g){d=n[F],o.multi||(d=[d]);for(var k=0;k<d.length;k++)l=void 0!==d[k][1]&&Boolean(d[k][1])?i.find(d[k][1]):i,l[d[k][0]].apply(l,void 0!==d[k][2]?d[k][2]:[]);c[o.group]=!0}}})}),n.sowSetupPreview(),r=n;var d=n.find(".siteorigin-widget-teaser");d.find(".dashicons-dismiss").click(function(){var i=e(this);e.get(i.data("dismiss-url")),d.slideUp("normal",function(){d.remove()})});var l=n.find("> .siteorigin-widgets-form-id").val(),g=n.find("> .siteorigin-widgets-form-timestamp"),f=parseInt(g.val()||0),c=JSON.parse(sessionStorage.getItem(l));if(c)if(c._sow_form_timestamp>f){var p=e('<div class="siteorigin-widget-form-notification"><span>'+soWidgets.backup.newerVersion+'</span><a class="button button-small so-backup-restore">'+soWidgets.backup.restore+'</a><a class="button button-small so-backup-dismiss">'+soWidgets.backup.dismiss+"</a><div><small>"+soWidgets.backup.replaceWarning+"</small></div></div>");n.prepend(p),p.find(".so-backup-restore").click(function(){sowbForms.setWidgetFormValues(r,c),p.slideUp("fast",function(){p.remove()})}),p.find(".so-backup-dismiss").click(function(){p.slideUp("fast",function(){sessionStorage.removeItem(l),p.remove()})})}else sessionStorage.removeItem(l);n.change(function(){g.val((new Date).getTime());var e=sowbForms.getWidgetFormValues(n);sessionStorage.setItem(l,JSON.stringify(e))})}else r=n.closest(".siteorigin-widget-form-main");r.find("> .siteorigin-widgets-form-id").val();var u=n.find("> .siteorigin-widget-field");u.find("> .siteorigin-widget-section").sowSetupForm();var m=u.find("> .siteorigin-widget-widget");m.find("> .siteorigin-widget-section").sowSetupForm(),m.filter(":not(:has(> .siteorigin-widget-section))").sowSetupForm(),u.find(".siteorigin-widget-input").each(function(i,t){null===e(t).data("original-name")&&e(t).data("original-name",e(t).attr("name"))}),u.find("> .siteorigin-widget-field-repeater").sowSetupRepeater(),n.find(".siteorigin-widget-field-repeater-item").sowSetupRepeaterItems(),u.find("> .siteorigin-widget-input-color").each(function(){var i=e(this),t={change:function(i,t){setTimeout(function(){e(i.target).trigger("change")},100)}};i.data("defaultColor")&&(t.defaultColor=i.data("defaultColor")),i.wpColorPicker(t)});var w=function(){e(this).toggleClass("siteorigin-widget-section-visible"),e(this).parent().find("> .siteorigin-widget-section, > .siteorigin-widget-widget > .siteorigin-widget-section").slideToggle("fast",function(){if(e(window).resize(),e(this).find("> .siteorigin-widget-field-container-state").val(e(this).is(":visible")?"open":"closed"),e(this).is(":visible")){e(this).find("> .siteorigin-widget-field").trigger("sowsetupformfield")}})};u.filter(".siteorigin-widget-field-type-widget, .siteorigin-widget-field-type-section").find("> label").click(w),u.filter(".siteorigin-widget-field-type-posts").find(".posts-container-label-wrapper").click(w),u.filter(".siteorigin-widget-field-type-slider").each(function(){var i=e(this),t=i.find('input[type="number"]'),r=i.find(".siteorigin-widget-value-slider");r.slider({max:parseFloat(t.attr("max")),min:parseFloat(t.attr("min")),step:parseFloat(t.attr("step")),value:parseFloat(t.val()),slide:function(e,i){t.val(parseFloat(i.value)),t.trigger("change")},change:function(e,t){i.find(".siteorigin-widget-slider-value").html(t.value)}}),t.change(function(e,i){i&&i.silent||r.slider("value",parseFloat(t.val()))})}),u.filter(".siteorigin-widget-field-type-link").each(function(){var i=e(this),t=null,r=function(){null!==t&&t.abort();var r=i.find(".content-text-search"),n=r.val(),a=r.data("postTypes"),s=i.find("ul.posts").empty().addClass("loading");e.get(soWidgets.ajaxurl,{action:"so_widgets_search_posts",query:n,postTypes:a},function(i){for(var t=0;t<i.length;t++)""===i[t].label&&(i[t].label="&nbsp;"),s.append(e("<li>").addClass("post").html(i[t].label+"<span>("+i[t].type+")</span>").data(i[t]));s.removeClass("loading")})};i.find(".select-content-button, .button-close").click(function(t){t.preventDefault(),e(this).blur();var n=i.find(".existing-content-selector");n.toggle(),n.is(":visible")&&0===n.find("ul.posts li").length&&r()}),i.on("click",".posts li",function(t){t.preventDefault();var r=e(this);i.find("input.siteorigin-widget-input").val("post: "+r.data("value")),i.find(".existing-content-selector").toggle()});var n=null;i.find(".content-text-search").keyup(function(){null!==n&&clearTimeout(n),n=setTimeout(function(){r()},500)})}),void 0!==jQuery.fn.soPanelsSetupBuilderWidget&&u.filter(".siteorigin-widget-field-type-builder").each(function(){e(this).find("> .siteorigin-page-builder-field").each(function(){var i=e(this);i.soPanelsSetupBuilderWidget({builderType:i.data("type")})})});var v=function(){var i=e(this),t=i.closest("[data-state-emitter]").data("state-emitter");if(void 0!==t){var n={default:""};void 0===t.length&&(t=[t]);for(var a=0;a<t.length;a++)n=function(t,r){if(void 0===sowEmitters[t.callback]||"_"===t.callback.substr(0,1))return r;var n=sowbForms.getContainerFieldId(i,"repeater",".siteorigin-widget-field-repeater-item");!1!==n&&(t.args=t.args.map(function(e){return e.replace("{$repeater}",n)}));var a=sowbForms.getContainerFieldId(i,"widget",".siteorigin-widget-widget");!1===a||t.hasOwnProperty("widgetFieldId")||(t.widgetFieldId=a,t.args=t.args.map(function(e){return e+"_"+a}));var s=i.is('[type="checkbox"]')?i.is(":checked"):i.val();return e.extend(r,sowEmitters[t.callback](s,t.args))}(t[a],n);var s=r.data("states");void 0===s&&(s={default:""});for(var o in n)void 0!==s[o]&&n[o]===s[o]||(s[o]=n[o],r.trigger("sowstatechange",[o,n[o]]));r.data("states",s)}};u.filter("[data-state-emitter]").each(function(){var i=e(this).find(".siteorigin-widget-input");i.on("keyup change",v),i.each(function(){var i=e(this);i.is(":radio")?i.is(":checked")&&v.call(i[0]):v.call(i[0])})}),n.trigger("sowsetupform",u).data("sow-form-setup",!0),u.trigger("sowsetupformfield"),n.find(".siteorigin-widget-field-repeater-item").trigger("updateFieldPositions"),(s.hasClass("wp-customizer")||s.hasClass("widgets-php"))&&n.closest(".ui-sortable").on("sortstop",function(e,i){i.item.find(".siteorigin-widget-form").find("> .siteorigin-widget-field").trigger("sowsetupformfield")}),a=!1})},e.fn.sowSetupPreview=function(){var i=e(this);i.siblings(".siteorigin-widget-preview").find("> a").click(function(t){t.preventDefault();var r=sowbForms.getWidgetFormValues(i),n=e(e("#so-widgets-bundle-tpl-preview-dialog").html().trim()).appendTo("body");n.find('input[name="data"]').val(JSON.stringify(r)),n.find('input[name="class"]').val(i.data("class")),n.find("iframe").on("load",function(){e(this).css("visibility","visible")}),n.find("form").submit(),n.find(".close").click(function(){n.remove()})})},e.fn.sowSetupRepeater=function(){return e(this).each(function(i,t){var r=e(t),n=r.find(".siteorigin-widget-field-repeater-items"),a=r.data("repeater-name");n.bind("updateFieldPositions",function(){var i=e(this),t=i.find("> .siteorigin-widget-field-repeater-item");t.each(function(i,t){e(t).find(".siteorigin-widget-input").each(function(t,r){var n=e(r).data("repeater-positions");void 0===n&&(n={}),n[a]=i,e(r).data("repeater-positions",n)})}),i.find(".siteorigin-widget-input").each(function(i,t){var r=e(t),n=r.data("repeater-positions");if(void 0!==n){var a=r.attr("data-original-name");if(a||(r.attr("data-original-name",r.attr("name")),a=r.attr("name")),!a)return;if(n)for(var s in n)a=a.replace("#"+s+"#",n[s]);r.attr("name",a)}}),i.data("initialSetup")||(i.find(".siteorigin-widget-input").each(function(i,t){var r=e(t);r.prop("checked",r.prop("defaultChecked"))}),i.data("initialSetup",!0));var n=r.data("scroll-count")?parseInt(r.data("scroll-count")):0;if(n>0&&t.length>n){var s=t.first().outerHeight();i.css("max-height",s*n).css("overflow","auto")}else i.css("max-height","").css("overflow","")}),n.sortable({handle:".siteorigin-widget-field-repeater-item-top",items:"> .siteorigin-widget-field-repeater-item",update:function(){n.find('input[type="radio"].siteorigin-widget-input').attr("name",""),n.trigger("updateFieldPositions"),r.trigger("change")},sortstop:function(i,t){if(t.item.is(".siteorigin-widget-field-repeater-item"))t.item.find("> .siteorigin-widget-field-repeater-item-form").each(function(){e(this).find("> .siteorigin-widget-field").trigger("sowsetupformfield")});else{t.item.find(".siteorigin-widget-form").find("> .siteorigin-widget-field").trigger("sowsetupformfield")}r.trigger("change")}}),n.trigger("updateFieldPositions"),r.find("> .siteorigin-widget-field-repeater-add").disableSelection().click(function(i){i.preventDefault(),r.closest(".siteorigin-widget-field-repeater").sowAddRepeaterItem().find("> .siteorigin-widget-field-repeater-items").slideDown("fast",function(){e(window).resize()})}),r.find("> .siteorigin-widget-field-repeater-top > .siteorigin-widget-field-repeater-expand").click(function(i){i.preventDefault(),r.closest(".siteorigin-widget-field-repeater").find("> .siteorigin-widget-field-repeateritems-").slideToggle("fast",function(){e(window).resize()})})})},e.fn.sowAddRepeaterItem=function(){return e(this).each(function(i,t){var r=e(t),n=r.find("> .siteorigin-widget-field-repeater-items").children().length+1,a=e("<div>"+r.find("> .siteorigin-widget-field-repeater-item-html").html()+"</div>");a.find(".siteorigin-widget-input[data-name]").each(function(){var i=e(this);0===i.closest(".siteorigin-widget-field-repeater-item-html").length&&i.attr("name",e(this).data("name"))});var s=a.html().replace(/_id_/g,n),o=void 0!==r.attr("readonly"),d=e('<div class="siteorigin-widget-field-repeater-item ui-draggable" />').append(e('<div class="siteorigin-widget-field-repeater-item-top" />').append(e('<div class="siteorigin-widget-field-expand" />')).append(o?"":e('<div class="siteorigin-widget-field-copy" />')).append(o?"":e('<div class="siteorigin-widget-field-remove" />')).append(e("<h4 />").html(r.data("item-name")))).append(e('<div class="siteorigin-widget-field-repeater-item-form" />').html(s));r.find("> .siteorigin-widget-field-repeater-items").append(d).sortable("refresh").trigger("updateFieldPositions"),d.sowSetupRepeaterItems(),d.hide().slideDown("fast",function(){e(window).resize()}),r.trigger("change")})},e.fn.sowRemoveRepeaterItem=function(){return e(this).each(function(i,t){var r=e(this).closest(".siteorigin-widget-field-repeater-items");e(this).remove(),r.sortable("refresh").trigger("updateFieldPositions"),e(t).trigger("change")})},e.fn.sowSetupRepeaterItems=function(){return e(this).each(function(i,t){var r=e(t);if(void 0===r.data("sowrepeater-actions-setup")){var n=r.closest(".siteorigin-widget-field-repeater"),a=r.find("> .siteorigin-widget-field-repeater-item-top"),s=n.data("item-label");if(s&&s.selector){var o=function(){var e=s.hasOwnProperty("valueMethod")&&s.valueMethod?s.valueMethod:"val",i=r.find(s.selector)[e]();i&&(i.length>80&&(i=i.substr(0,79)+"..."),a.find("h4").text(i))};o();var d=s.hasOwnProperty("updateEvent")&&s.updateEvent?s.updateEvent:"change";r.bind(d,o)}a.click(function(i){"siteorigin-widget-field-remove"!==i.target.className&&"siteorigin-widget-field-copy"!==i.target.className&&(i.preventDefault(),e(this).closest(".siteorigin-widget-field-repeater-item").find(".siteorigin-widget-field-repeater-item-form").eq(0).slideToggle("fast",function(){if(e(window).resize(),e(this).is(":visible")){e(this).trigger("slideToggleOpenComplete");e(this).find("> .siteorigin-widget-field").trigger("sowsetupformfield")}else e(this).trigger("slideToggleCloseComplete")}))}),a.find(".siteorigin-widget-field-remove").click(function(i,t){i.preventDefault();var n=e(this).closest(".siteorigin-widget-field-repeater-items"),a=e(this).closest(".siteorigin-widget-field-repeater-item"),s=function(){a.remove(),n.sortable("refresh").trigger("updateFieldPositions"),e(window).resize()};t&&t.silent?s():confirm(soWidgets.sure)&&a.slideUp("fast",s),r.trigger("change")}),a.find(".siteorigin-widget-field-copy").click(function(i){i.preventDefault();var t=e(this).closest(".siteorigin-widget-form-main"),n=e(this).closest(".siteorigin-widget-field-repeater-item"),a=n.clone(),s=n.closest(".siteorigin-widget-field-repeater-items"),o=s.children().length,d={};a.find("*[name]").each(function(){var i=e(this),s=i.attr("id"),l=i.attr("name");if(i.is("textarea")&&i.parent().is(".wp-editor-container")&&"undefined"!=typeof tinymce){i.parent().empty().append(i),i.css("display","");var g=tinymce.get(s);g&&i.val(g.getContent())}else if(i.is(".wp-color-picker")){var f=i.closest(".wp-picker-container"),c=i.closest(".siteorigin-widget-field");f.remove(),c.append(i.remove())}else{var p=s?n.find("#"+s):n.find('[name="'+l+'"]');p.length&&null!=p.val()&&i.val(p.val())}if(s){var u,m,w;if(i.is('[type="radio"]')){m=s.replace(/-\d+-\d+#x2F;,"");var v=s.replace(/-\d+#x2F;,"");if(!d[m]){var h={};d[m]=t.find(".siteorigin-widget-input[id^="+m+"]").not("[id*=_id_]").filter(function(i,t){var r=e(t).attr("name");return!h[r]&&(h[r]=!0,!0)}).length+1}var b=m+"-"+d[m];w=b+s.match(/-\d+#x2F;)[0],a.find("label[for="+v+"]").attr("for",b)}else u=new RegExp("-\\d+quot;),m=s.replace(u,""),d[m]||(d[m]=t.find(".siteorigin-widget-input[id^="+m+"]").not("[id*=_id_]").length+1),w=m+"-"+d[m]++;i.attr("id",w),a.find("label[for="+s+"]").attr("for",w),a.find("[id*="+s+"]").each(function(){var i=e(this).attr("id"),t=i.replace(s,w);e(this).attr("id",t)}),"undefined"!=typeof tinymce&&tinymce.get(w)&&tinymce.get(w).remove()}var y=n.parents(".siteorigin-widget-field-repeater").length,F=e("body");(F.hasClass("wp-customizer")||F.hasClass("widgets-php"))&&0===r.closest(".panel-dialog").length&&(y+=1);var k=l.replace(new RegExp("((?:.*?\\[\\d+\\]){"+(y-1).toString()+"})?(.*?\\[)\\d+(\\])"),"$1$2"+o.toString()+"$3");i.attr("name",k),i.data("original-name",k)}),s.append(a).sortable("refresh").trigger("updateFieldPositions"),a.sowSetupRepeaterItems(),a.hide().slideDown("fast",function(){e(window).resize()}),r.trigger("change")}),r.find("> .siteorigin-widget-field-repeater-item-form").sowSetupForm(),r.data("sowrepeater-actions-setup",!0)}})},sowbForms.getContainerFieldId=function(e,i,t){var r=i+"FieldId";this.hasOwnProperty(r)||(this[r]=1);var n=e.closest(t);if(n.length){var a=n.data("field-id");return void 0===a&&(a=this[r]++),n.data("field-id",a),a}return!1},sowbForms.getWidgetFieldVariable=function(e,i,t){var r=window.sow_field_javascript_variables[e];i=i.replace(/\[#.*?#\]/g,"");for(var n=/[a-zA-Z0-9\-]+(?:\[c?[0-9]+\])?\[(.*)\]/.exec(i)[1],a=n.split("]["),s=a.length?r:null;a.length;)s=s[a.shift()];return s[t]},sowbForms.fetchWidgetVariable=function(i,t,r){window.sowVars=window.sowVars||{},void 0===window.sowVars[t]?e.post(soWidgets.ajaxurl,{action:"sow_get_javascript_variables",widget:t,key:i},function(e){window.sowVars[t]=e,r(window.sowVars[t][i])}):r(window.sowVars[t][i])},sowbForms.getWidgetFormValues=function(i){if(_.isUndefined(i))return null;var t={};return i.find("*[name]").each(function(){var i=e(this);try{var r=/[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec(i.attr("name"));if(_.isEmpty(r))return!0;r=r[1];var n=r.split("][");n=n.map(function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e});var a=t,s=null,o=_.isString(i.attr("type"))?i.attr("type").toLowerCase():null;if("checkbox"===o)s=!!i.is(":checked")&&(""===i.val()||i.val());else if("radio"===o){if(!i.is(":checked"))return;s=i.val()}else if("SELECT"===i.prop("tagName")){var d=i.find("option:selected");1===d.length?s=i.find("option:selected").val():d.length>1&&(s=_.map(i.find("option:selected"),function(i,t){return e(i).val()}))}else s=i.val();for(var l=0;l<n.length;l++)l===n.length-1?""===n[l]?a.push(s):a[n[l]]=s:(_.isUndefined(a[n[l]])&&(_.isNumber(n[l+1])||""===n[l+1]?a[n[l]]=[]:a[n[l]]={}),a=a[n[l]])}catch(e){console.error("Field ["+i.attr("name")+"] could not be processed and was skipped - "+e.message)}}),t},sowbForms.setWidgetFormValues=function(i,t,r){r=r||!1;var n=0,a=function(i,t){10!=++n&&i.find("> .siteorigin-widget-field-type-repeater").each(function(){var i=e(this).find("> .siteorigin-widget-field-repeater"),n=i.data("repeaterName"),s=t.hasOwnProperty(n)?t[n]:null;if(s&&Array.isArray(s)){var o=i.find("> .siteorigin-widget-field-repeater-items > .siteorigin-widget-field-repeater-item"),d=s.length,l=o.length;if(d>l)for(var g=0;g<d-l;g++)i.find("> .siteorigin-widget-field-repeater-add").click();else if(!r&&d<l)for(var f=d;f<l;f++){var c=e(o.eq(f));c.find("> .siteorigin-widget-field-repeater-item-top").find(".siteorigin-widget-field-remove").trigger("click",{silent:!0})}o=i.find("> .siteorigin-widget-field-repeater-items > .siteorigin-widget-field-repeater-item");for(var p=0;p<o.length;p++)o.eq(p).find("> .siteorigin-widget-field-repeater-item-form"),a(o.eq(p).find("> .siteorigin-widget-field-repeater-item-form"),s[p])}})};a(i,t),i.find("*[name]").each(function(){var i=e(this),n=/[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec(i.attr("name"));if(void 0===n||null===n)return!0;n=n[1];var a=n.split("][");a=a.map(function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e});for(var s,o=t,d=0;d<a.length;d++){if(!o.hasOwnProperty(a[d])){if(r)return!0;break}d===a.length-1?s=o[a[d]]:o=o[a[d]]}if("checkbox"===i.attr("type"))i.prop("checked",s);else if("radio"===i.attr("type"))i.prop("checked",s===i.val());else if("TEXTAREA"===i.prop("tagName")&&i.hasClass("wp-editor-area")){var l=null;"undefined"!=typeof tinyMCE&&(l=tinyMCE.get(i.attr("id"))),null===l||"function"!=typeof l.getContent||l.isHidden()?i.val(s):l.setContent(s)}else i.val(s);i.trigger("change")})},e(".widgets-holder-wrap").on("click",".widget:has(.siteorigin-widget-form-main) .widget-top",function(){var i=e(this).closest(".widget").find(".siteorigin-widget-form-main");setTimeout(function(){i.sowSetupForm()},200)}),e("body").hasClass("wp-customizer")&&e(document).on("widget-added",function(e,i){i.find(".siteorigin-widget-form").sowSetupForm()}),e(document).on("open_dialog",function(i,t){if(t.$el.find(".so-panels-dialog").is(".so-panels-dialog-edit-widget")){e(i.target).find(".siteorigin-widget-form-main").find("> .siteorigin-widget-field").trigger("sowsetupformfield")}}),e(function(){e(document).trigger("sowadminloaded")})}(jQuery);var sowEmitters={_match:function(e,i){void 0===i&&(i=".*");var t=new RegExp("^([a-zA-Z0-9_-]+)(\\[([a-zA-Z0-9_-]+)\\])? *: *("+i+") *quot;),r=t.exec(e);if(null===r)return!1;var n="",a="default";return void 0!==r[3]?(a=r[1],n=r[3]):n=r[1],{match:r[4].trim(),group:a,state:n}},_checker:function(e,i,t,r){var n={};void 0===i.length&&(i=[i]);for(var a,s=0;s<i.length;s++)!1!==(a=sowEmitters._match(i[s],t))&&("_true"===a.match||r(e,i,a.match))&&(n[a.group]=a.state);return n},select:function(e,i){void 0===i.length&&(i=[i]);for(var t={},r=0;r<i.length;r++)""===i[r]&&(i[r]="default"),t[i[r]]=e;return t},conditional:function(val,args){return sowEmitters._checker(val,args,"[^;{}]*",function(val,args,match){return eval(match)})},in:function(e,i){return sowEmitters._checker(e,i,"[^;{}]*",function(e,i,t){return-1!==t.split(",").map(function(e){return e.trim()}).indexOf(e)})}};window.sowbForms=sowbForms;
1
+ var sowbForms=window.sowbForms||{};!function(e){e.fn.sowSetupForm=function(){return e(this).each(function(i,t){var r,n=e(t),a=!0,s=e("body"),o=n.find("input[name]");if(o.length&&-1!==o.attr("name").indexOf("__i__"))return this;if(n.is(".siteorigin-widget-form-main")){if(!0===n.data("sow-form-setup"))return!0;if(s.hasClass("widgets-php")&&!n.is(":visible")&&0===n.closest(".panel-dialog").length)return!0;n.on("sowstatechange",function(i,t,r){n.find("[data-state-handler]").each(function(){var i=e(this),n=e.extend({},i.data("state-handler"),a?i.data("state-handler-initial"):{});if(0===Object.keys(n).length)return!0;var s,o,d,l,g,f,c={},p=sowbForms.getContainerFieldId(i,"repeater",".siteorigin-widget-field-repeater-item");if(!1!==p){var u={};for(var m in n)u[m.replace("{$repeater}",p)]=n[m];n=u}var w=sowbForms.getContainerFieldId(i,"widget",".siteorigin-widget-widget");if(!1!==w){var v={};for(var h in n){var b=h.match(/_else\[(.*)\]|(.*)\[(.*)\]/),y="";y=b&&b.length&&void 0===b[1]?b[2]+"_"+w+"["+b[3]+"]":"_else["+b[1]+"_"+w+"]",v[y]=n[h]}n=v}for(var F in n)if(g=!1,null!==(s=F.match(/^([a-zA-Z0-9_-]+)(\[([a-zA-Z0-9_\-,]+)\])?(\[\])?#x2F;))){if(o={group:"default",name:"",multi:!1},void 0!==s[2]?(o.group=s[1],o.name=s[3]):o.name=s[0],o.multi=void 0!==s[4],"_else"===o.group)o.group=o.name,o.name="",g=o.group===t&&void 0===c[o.group];else{f=o.name.split(",").map(function(e){return e.trim()});for(var k=0;k<f.length&&!(g=o.group===t&&f[k]===r);k++);}if(g){d=n[F],o.multi||(d=[d]);for(var k=0;k<d.length;k++)l=void 0!==d[k][1]&&Boolean(d[k][1])?i.find(d[k][1]):i,l[d[k][0]].apply(l,void 0!==d[k][2]?d[k][2]:[]);c[o.group]=!0}}})}),n.sowSetupPreview(),r=n;var d=n.find(".siteorigin-widget-teaser");d.find(".dashicons-dismiss").click(function(){var i=e(this);e.get(i.data("dismiss-url")),d.slideUp("normal",function(){d.remove()})});var l=n.find("> .siteorigin-widgets-form-id").val(),g=n.find("> .siteorigin-widgets-form-timestamp"),f=parseInt(g.val()||0),c=JSON.parse(sessionStorage.getItem(l));if(c)if(c._sow_form_timestamp>f){var p=e('<div class="siteorigin-widget-form-notification"><span>'+soWidgets.backup.newerVersion+'</span><a class="button button-small so-backup-restore">'+soWidgets.backup.restore+'</a><a class="button button-small so-backup-dismiss">'+soWidgets.backup.dismiss+"</a><div><small>"+soWidgets.backup.replaceWarning+"</small></div></div>");n.prepend(p),p.find(".so-backup-restore").click(function(){sowbForms.setWidgetFormValues(r,c),p.slideUp("fast",function(){p.remove()})}),p.find(".so-backup-dismiss").click(function(){p.slideUp("fast",function(){sessionStorage.removeItem(l),p.remove()})})}else sessionStorage.removeItem(l);n.change(function(){g.val((new Date).getTime());var e=sowbForms.getWidgetFormValues(n);sessionStorage.setItem(l,JSON.stringify(e))})}else r=n.closest(".siteorigin-widget-form-main");r.find("> .siteorigin-widgets-form-id").val();var u=n.find("> .siteorigin-widget-field");u.find("> .siteorigin-widget-section").sowSetupForm();var m=u.find("> .siteorigin-widget-widget");m.find("> .siteorigin-widget-section").sowSetupForm(),m.filter(":not(:has(> .siteorigin-widget-section))").sowSetupForm(),u.find(".siteorigin-widget-input").each(function(i,t){null===e(t).data("original-name")&&e(t).data("original-name",e(t).attr("name"))}),u.find("> .siteorigin-widget-field-repeater").sowSetupRepeater(),n.find(".siteorigin-widget-field-repeater-item").sowSetupRepeaterItems(),u.find("> .siteorigin-widget-input-color").each(function(){var i=e(this),t={change:function(i,t){setTimeout(function(){e(i.target).trigger("change")},100)}};i.data("defaultColor")&&(t.defaultColor=i.data("defaultColor")),i.wpColorPicker(t)});var w=function(){e(this).toggleClass("siteorigin-widget-section-visible"),e(this).parent().find("> .siteorigin-widget-section, > .siteorigin-widget-widget > .siteorigin-widget-section").slideToggle("fast",function(){if(e(window).resize(),e(this).find("> .siteorigin-widget-field-container-state").val(e(this).is(":visible")?"open":"closed"),e(this).is(":visible")){e(this).find("> .siteorigin-widget-field").trigger("sowsetupformfield")}})};u.filter(".siteorigin-widget-field-type-widget, .siteorigin-widget-field-type-section").find("> label").click(w),u.filter(".siteorigin-widget-field-type-posts").find(".posts-container-label-wrapper").click(w),u.filter(".siteorigin-widget-field-type-slider").each(function(){var i=e(this),t=i.find('input[type="number"]'),r=i.find(".siteorigin-widget-value-slider");r.slider({max:parseFloat(t.attr("max")),min:parseFloat(t.attr("min")),step:parseFloat(t.attr("step")),value:parseFloat(t.val()),slide:function(e,i){t.val(parseFloat(i.value)),t.trigger("change")},change:function(e,t){i.find(".siteorigin-widget-slider-value").html(t.value)}}),t.change(function(e,i){i&&i.silent||r.slider("value",parseFloat(t.val()))})}),u.filter(".siteorigin-widget-field-type-link").each(function(){var i=e(this),t=null,r=function(){null!==t&&t.abort();var r=i.find(".content-text-search"),n=r.val(),a=r.data("postTypes"),s=i.find("ul.posts").empty().addClass("loading");e.get(soWidgets.ajaxurl,{action:"so_widgets_search_posts",query:n,postTypes:a},function(i){for(var t=0;t<i.length;t++)""===i[t].label&&(i[t].label="&nbsp;"),s.append(e("<li>").addClass("post").html(i[t].label+"<span>("+i[t].type+")</span>").data(i[t]));s.removeClass("loading")})};i.find(".select-content-button, .button-close").click(function(t){t.preventDefault(),e(this).blur();var n=i.find(".existing-content-selector");n.toggle(),n.is(":visible")&&0===n.find("ul.posts li").length&&r()}),i.on("click",".posts li",function(t){t.preventDefault();var r=e(this);i.find("input.siteorigin-widget-input").val("post: "+r.data("value")),i.find(".existing-content-selector").toggle()});var n=null;i.find(".content-text-search").keyup(function(){null!==n&&clearTimeout(n),n=setTimeout(function(){r()},500)})}),void 0!==jQuery.fn.soPanelsSetupBuilderWidget&&u.filter(".siteorigin-widget-field-type-builder").each(function(){e(this).find("> .siteorigin-page-builder-field").each(function(){var i=e(this);i.soPanelsSetupBuilderWidget({builderType:i.data("type")})})});var v=function(){var i=e(this),t=i.closest("[data-state-emitter]").data("state-emitter");if(void 0!==t){var n={default:""};void 0===t.length&&(t=[t]);for(var a=0;a<t.length;a++)n=function(t,r){if(void 0===sowEmitters[t.callback]||"_"===t.callback.substr(0,1))return r;var n=sowbForms.getContainerFieldId(i,"repeater",".siteorigin-widget-field-repeater-item");!1!==n&&(t.args=t.args.map(function(e){return e.replace("{$repeater}",n)}));var a=sowbForms.getContainerFieldId(i,"widget",".siteorigin-widget-widget");!1===a||t.hasOwnProperty("widgetFieldId")||(t.widgetFieldId=a,t.args=t.args.map(function(e){return e+"_"+a}));var s=i.is('[type="checkbox"]')?i.is(":checked"):i.val();return e.extend(r,sowEmitters[t.callback](s,t.args))}(t[a],n);var s=r.data("states");void 0===s&&(s={default:""});for(var o in n)void 0!==s[o]&&n[o]===s[o]||(s[o]=n[o],r.trigger("sowstatechange",[o,n[o]]));r.data("states",s)}};u.filter("[data-state-emitter]").each(function(){var i=e(this).find(".siteorigin-widget-input");i.on("keyup change",v),i.each(function(){var i=e(this);i.is(":radio")?i.is(":checked")&&v.call(i[0]):v.call(i[0])})}),n.trigger("sowsetupform",u).data("sow-form-setup",!0),u.trigger("sowsetupformfield"),n.find(".siteorigin-widget-field-repeater-item").trigger("updateFieldPositions"),(s.hasClass("wp-customizer")||s.hasClass("widgets-php"))&&n.closest(".ui-sortable").on("sortstop",function(e,i){i.item.find(".siteorigin-widget-form").find("> .siteorigin-widget-field").trigger("sowsetupformfield")}),a=!1})},e.fn.sowSetupPreview=function(){var i=e(this);i.siblings(".siteorigin-widget-preview").find("> a").click(function(t){t.preventDefault();var r=sowbForms.getWidgetFormValues(i),n=e(e("#so-widgets-bundle-tpl-preview-dialog").html().trim()).appendTo("body");n.find('input[name="data"]').val(JSON.stringify(r)),n.find('input[name="class"]').val(i.data("class")),n.find("iframe").on("load",function(){e(this).css("visibility","visible")}),n.find("form").submit(),n.find(".close").click(function(){n.remove()})})},e.fn.sowSetupRepeater=function(){return e(this).each(function(i,t){var r=e(t),n=r.find(".siteorigin-widget-field-repeater-items"),a=r.data("repeater-name");n.bind("updateFieldPositions",function(){var i=e(this),t=i.find("> .siteorigin-widget-field-repeater-item");t.each(function(i,t){e(t).find(".siteorigin-widget-input").each(function(t,r){var n=e(r).data("repeater-positions");void 0===n&&(n={}),n[a]=i,e(r).data("repeater-positions",n)})}),i.find(".siteorigin-widget-input").each(function(i,t){var r=e(t),n=r.data("repeater-positions");if(void 0!==n){var a=r.attr("data-original-name");if(a||(r.attr("data-original-name",r.attr("name")),a=r.attr("name")),!a)return;if(n)for(var s in n)a=a.replace("#"+s+"#",n[s]);r.attr("name",a)}}),i.data("initialSetup")||(i.find(".siteorigin-widget-input").each(function(i,t){var r=e(t);r.prop("checked",r.prop("defaultChecked"))}),i.data("initialSetup",!0));var n=r.data("scroll-count")?parseInt(r.data("scroll-count")):0;if(n>0&&t.length>n){var s=t.first().outerHeight();i.css("max-height",s*n).css("overflow","auto")}else i.css("max-height","").css("overflow","")}),n.sortable({handle:".siteorigin-widget-field-repeater-item-top",items:"> .siteorigin-widget-field-repeater-item",update:function(){n.find('input[type="radio"].siteorigin-widget-input').attr("name",""),n.trigger("updateFieldPositions"),r.trigger("change")},sortstop:function(i,t){if(t.item.is(".siteorigin-widget-field-repeater-item"))t.item.find("> .siteorigin-widget-field-repeater-item-form").each(function(){e(this).find("> .siteorigin-widget-field").trigger("sowsetupformfield")});else{t.item.find(".siteorigin-widget-form").find("> .siteorigin-widget-field").trigger("sowsetupformfield")}r.trigger("change")}}),n.trigger("updateFieldPositions"),r.find("> .siteorigin-widget-field-repeater-add").disableSelection().click(function(i){i.preventDefault(),r.closest(".siteorigin-widget-field-repeater").sowAddRepeaterItem().find("> .siteorigin-widget-field-repeater-items").slideDown("fast",function(){e(window).resize()})}),r.find("> .siteorigin-widget-field-repeater-top > .siteorigin-widget-field-repeater-expand").click(function(i){i.preventDefault(),r.closest(".siteorigin-widget-field-repeater").find("> .siteorigin-widget-field-repeateritems-").slideToggle("fast",function(){e(window).resize()})})})},e.fn.sowAddRepeaterItem=function(){return e(this).each(function(i,t){var r=e(t),n=r.find("> .siteorigin-widget-field-repeater-items").children().length+1,a=e("<div>"+r.find("> .siteorigin-widget-field-repeater-item-html").html()+"</div>");a.find(".siteorigin-widget-input[data-name]").each(function(){var i=e(this);0===i.closest(".siteorigin-widget-field-repeater-item-html").length&&i.attr("name",e(this).data("name"))});var s=a.html().replace(/_id_/g,n),o=void 0!==r.attr("readonly"),d=e('<div class="siteorigin-widget-field-repeater-item ui-draggable" />').append(e('<div class="siteorigin-widget-field-repeater-item-top" />').append(e('<div class="siteorigin-widget-field-expand" />')).append(o?"":e('<div class="siteorigin-widget-field-copy" />')).append(o?"":e('<div class="siteorigin-widget-field-remove" />')).append(e("<h4 />").html(r.data("item-name")))).append(e('<div class="siteorigin-widget-field-repeater-item-form" />').html(s));r.find("> .siteorigin-widget-field-repeater-items").append(d).sortable("refresh").trigger("updateFieldPositions"),d.sowSetupRepeaterItems(),d.hide().slideDown("fast",function(){e(window).resize()}),r.trigger("change")})},e.fn.sowRemoveRepeaterItem=function(){return e(this).each(function(i,t){var r=e(this).closest(".siteorigin-widget-field-repeater-items");e(this).remove(),r.sortable("refresh").trigger("updateFieldPositions"),e(t).trigger("change")})},e.fn.sowSetupRepeaterItems=function(){return e(this).each(function(i,t){var r=e(t);if(void 0===r.data("sowrepeater-actions-setup")){var n=r.closest(".siteorigin-widget-field-repeater"),a=r.find("> .siteorigin-widget-field-repeater-item-top"),s=n.data("item-label");if(s&&s.selector){var o=function(){var e=s.hasOwnProperty("valueMethod")&&s.valueMethod?s.valueMethod:"val",i=r.find(s.selector)[e]();i&&(i.length>80&&(i=i.substr(0,79)+"..."),a.find("h4").text(i))};o();var d=s.hasOwnProperty("updateEvent")&&s.updateEvent?s.updateEvent:"change";r.bind(d,o)}a.click(function(i){"siteorigin-widget-field-remove"!==i.target.className&&"siteorigin-widget-field-copy"!==i.target.className&&(i.preventDefault(),e(this).closest(".siteorigin-widget-field-repeater-item").find(".siteorigin-widget-field-repeater-item-form").eq(0).slideToggle("fast",function(){if(e(window).resize(),e(this).is(":visible")){e(this).trigger("slideToggleOpenComplete");e(this).find("> .siteorigin-widget-field").trigger("sowsetupformfield")}else e(this).trigger("slideToggleCloseComplete")}))}),a.find(".siteorigin-widget-field-remove").click(function(i,t){i.preventDefault();var n=e(this).closest(".siteorigin-widget-field-repeater-items"),a=e(this).closest(".siteorigin-widget-field-repeater-item"),s=function(){a.remove(),n.sortable("refresh").trigger("updateFieldPositions"),e(window).resize()};t&&t.silent?s():confirm(soWidgets.sure)&&a.slideUp("fast",s),r.trigger("change")}),a.find(".siteorigin-widget-field-copy").click(function(i){i.preventDefault();var t=e(this).closest(".siteorigin-widget-form-main"),n=e(this).closest(".siteorigin-widget-field-repeater-item"),a=n.clone(),s=n.closest(".siteorigin-widget-field-repeater-items"),o=s.children().length,d={};a.find("*[name]").each(function(){var i=e(this),s=i.attr("id"),l=i.attr("name");if(i.is("textarea")&&i.parent().is(".wp-editor-container")&&"undefined"!=typeof tinymce){i.parent().empty().append(i),i.css("display","");var g=tinymce.get(s);g&&i.val(g.getContent())}else if(i.is(".wp-color-picker")){var f=i.closest(".wp-picker-container"),c=i.closest(".siteorigin-widget-field");f.remove(),c.append(i.remove())}else{var p=s?n.find("#"+s):n.find('[name="'+l+'"]');p.length&&null!=p.val()&&i.val(p.val())}if(s){var u,m,w;if(i.is('[type="radio"]')){m=s.replace(/-\d+-\d+#x2F;,"");var v=s.replace(/-\d+#x2F;,"");if(!d[m]){var h={};d[m]=t.find(".siteorigin-widget-input[id^="+m+"]").not("[id*=_id_]").filter(function(i,t){var r=e(t).attr("name");return!h[r]&&(h[r]=!0,!0)}).length+1}var b=m+"-"+d[m];w=b+s.match(/-\d+#x2F;)[0],a.find("label[for="+v+"]").attr("for",b)}else u=new RegExp("-\\d+quot;),m=s.replace(u,""),d[m]||(d[m]=t.find(".siteorigin-widget-input[id^="+m+"]").not("[id*=_id_]").length+1),w=m+"-"+d[m]++;if(i.attr("id",w),i.is(".wp-editor-area")){var y=i.closest(".siteorigin-widget-tinymce-container"),F=y.data("media-buttons");if(F&&F.html){var u=new RegExp(s,"g");F.html=F.html.replace(u,w),y.data("media-buttons",F)}}a.find("label[for="+s+"]").attr("for",w),a.find("[id*="+s+"]").each(function(){var i=e(this).attr("id"),t=i.replace(s,w);e(this).attr("id",t)}),"undefined"!=typeof tinymce&&tinymce.get(w)&&tinymce.get(w).remove()}var k=n.parents(".siteorigin-widget-field-repeater").length,_=e("body");(_.hasClass("wp-customizer")||_.hasClass("widgets-php"))&&0===r.closest(".panel-dialog").length&&(k+=1);var C=l.replace(new RegExp("((?:.*?\\[\\d+\\]){"+(k-1).toString()+"})?(.*?\\[)\\d+(\\])"),"$1$2"+o.toString()+"$3");i.attr("name",C),i.data("original-name",C)}),s.append(a).sortable("refresh").trigger("updateFieldPositions"),a.sowSetupRepeaterItems(),a.hide().slideDown("fast",function(){e(window).resize()}),r.trigger("change")}),r.find("> .siteorigin-widget-field-repeater-item-form").sowSetupForm(),r.data("sowrepeater-actions-setup",!0)}})},sowbForms.getContainerFieldId=function(e,i,t){var r=i+"FieldId";this.hasOwnProperty(r)||(this[r]=1);var n=e.closest(t);if(n.length){var a=n.data("field-id");return void 0===a&&(a=this[r]++),n.data("field-id",a),a}return!1},sowbForms.getWidgetFieldVariable=function(e,i,t){var r=window.sow_field_javascript_variables[e];i=i.replace(/\[#.*?#\]/g,"");for(var n=/[a-zA-Z0-9\-]+(?:\[c?[0-9]+\])?\[(.*)\]/.exec(i)[1],a=n.split("]["),s=a.length?r:null;a.length;)s=s[a.shift()];return s[t]},sowbForms.fetchWidgetVariable=function(i,t,r){window.sowVars=window.sowVars||{},void 0===window.sowVars[t]?e.post(soWidgets.ajaxurl,{action:"sow_get_javascript_variables",widget:t,key:i},function(e){window.sowVars[t]=e,r(window.sowVars[t][i])}):r(window.sowVars[t][i])},sowbForms.getWidgetFormValues=function(i){if(_.isUndefined(i))return null;var t={};return i.find("*[name]").each(function(){var i=e(this);try{var r=/[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec(i.attr("name"));if(_.isEmpty(r))return!0;r=r[1];var n=r.split("][");n=n.map(function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e});var a=t,s=null,o=_.isString(i.attr("type"))?i.attr("type").toLowerCase():null;if("checkbox"===o)s=!!i.is(":checked")&&(""===i.val()||i.val());else if("radio"===o){if(!i.is(":checked"))return;s=i.val()}else if("SELECT"===i.prop("tagName")){var d=i.find("option:selected");1===d.length?s=i.find("option:selected").val():d.length>1&&(s=_.map(i.find("option:selected"),function(i,t){return e(i).val()}))}else s=i.val();for(var l=0;l<n.length;l++)l===n.length-1?""===n[l]?a.push(s):a[n[l]]=s:(_.isUndefined(a[n[l]])&&(_.isNumber(n[l+1])||""===n[l+1]?a[n[l]]=[]:a[n[l]]={}),a=a[n[l]])}catch(e){console.error("Field ["+i.attr("name")+"] could not be processed and was skipped - "+e.message)}}),t},sowbForms.setWidgetFormValues=function(i,t,r){r=r||!1;var n=0,a=function(i,t){10!=++n&&i.find("> .siteorigin-widget-field-type-repeater").each(function(){var i=e(this).find("> .siteorigin-widget-field-repeater"),n=i.data("repeaterName"),s=t.hasOwnProperty(n)?t[n]:null;if(s&&Array.isArray(s)){var o=i.find("> .siteorigin-widget-field-repeater-items > .siteorigin-widget-field-repeater-item"),d=s.length,l=o.length;if(d>l)for(var g=0;g<d-l;g++)i.find("> .siteorigin-widget-field-repeater-add").click();else if(!r&&d<l)for(var f=d;f<l;f++){var c=e(o.eq(f));c.find("> .siteorigin-widget-field-repeater-item-top").find(".siteorigin-widget-field-remove").trigger("click",{silent:!0})}o=i.find("> .siteorigin-widget-field-repeater-items > .siteorigin-widget-field-repeater-item");for(var p=0;p<o.length;p++)o.eq(p).find("> .siteorigin-widget-field-repeater-item-form"),a(o.eq(p).find("> .siteorigin-widget-field-repeater-item-form"),s[p])}})};a(i,t),i.find("*[name]").each(function(){var i=e(this),n=/[a-zA-Z0-9\-]+\[[a-zA-Z0-9]+\]\[(.*)\]/.exec(i.attr("name"));if(void 0===n||null===n)return!0;n=n[1];var a=n.split("][");a=a.map(function(e){return!isNaN(parseFloat(e))&&isFinite(e)?parseInt(e):e});for(var s,o=t,d=0;d<a.length;d++){if(!o.hasOwnProperty(a[d])){if(r)return!0;break}d===a.length-1?s=o[a[d]]:o=o[a[d]]}if("checkbox"===i.attr("type"))i.prop("checked",s);else if("radio"===i.attr("type"))i.prop("checked",s===i.val());else if("TEXTAREA"===i.prop("tagName")&&i.hasClass("wp-editor-area")){var l=null;"undefined"!=typeof tinyMCE&&(l=tinyMCE.get(i.attr("id"))),null===l||"function"!=typeof l.getContent||l.isHidden()?i.val(s):l.setContent(s)}else i.val(s);i.trigger("change")})},e(".widgets-holder-wrap").on("click",".widget:has(.siteorigin-widget-form-main) .widget-top",function(){var i=e(this).closest(".widget").find(".siteorigin-widget-form-main");setTimeout(function(){i.sowSetupForm()},200)}),e("body").hasClass("wp-customizer")&&e(document).on("widget-added",function(e,i){i.find(".siteorigin-widget-form").sowSetupForm()}),e(document).on("open_dialog",function(i,t){if(t.$el.find(".so-panels-dialog").is(".so-panels-dialog-edit-widget")){e(i.target).find(".siteorigin-widget-form-main").find("> .siteorigin-widget-field").trigger("sowsetupformfield")}}),e(function(){e(document).trigger("sowadminloaded")})}(jQuery);var sowEmitters={_match:function(e,i){void 0===i&&(i=".*");var t=new RegExp("^([a-zA-Z0-9_-]+)(\\[([a-zA-Z0-9_-]+)\\])? *: *("+i+") *quot;),r=t.exec(e);if(null===r)return!1;var n="",a="default";return void 0!==r[3]?(a=r[1],n=r[3]):n=r[1],{match:r[4].trim(),group:a,state:n}},_checker:function(e,i,t,r){var n={};void 0===i.length&&(i=[i]);for(var a,s=0;s<i.length;s++)!1!==(a=sowEmitters._match(i[s],t))&&("_true"===a.match||r(e,i,a.match))&&(n[a.group]=a.state);return n},select:function(e,i){void 0===i.length&&(i=[i]);for(var t={},r=0;r<i.length;r++)""===i[r]&&(i[r]="default"),t[i[r]]=e;return t},conditional:function(val,args){return sowEmitters._checker(val,args,"[^;{}]*",function(val,args,match){return eval(match)})},in:function(e,i){return sowEmitters._checker(e,i,"[^;{}]*",function(e,i,t){return-1!==t.split(",").map(function(e){return e.trim()}).indexOf(e)})}};window.sowbForms=sowbForms;
base/siteorigin-widget.class.php CHANGED
@@ -441,7 +441,7 @@ abstract class SiteOrigin_Widget extends WP_Widget {
441
442
// Filter the instance specifically for the form
443
$instance = apply_filters('siteorigin_widgets_form_instance_' . $this->id_base, $instance, $this);
444
-
445
// `more_entropy` adds a period to the id.
446
$id = str_replace( '.', '', uniqid( rand(), true ) );
447
$form_id = 'siteorigin_widget_form_' . md5( $id );
@@ -1093,14 +1093,19 @@ abstract class SiteOrigin_Widget extends WP_Widget {
1093
* @return string
1094
*/
1095
function get_style_hash( $instance ) {
1096
- if( method_exists( $this, 'get_style_hash_variables' ) ) {
1097
- $vars = apply_filters( 'siteorigin_widgets_hash_variables_' . $this->id_base, $this->get_style_hash_variables( $instance ), $instance, $this );
1098
- } else {
1099
- $vars = apply_filters( 'siteorigin_widgets_less_variables_' . $this->id_base, $this->get_less_variables( $instance ), $instance, $this );
1100
}
1101
- $version = property_exists( $this, 'version' ) ? $this->version : '';
1102
1103
- return substr( md5( json_encode( $vars ) . $version ), 0, 12 );
1104
}
1105
1106
/**
@@ -1227,7 +1232,7 @@ abstract class SiteOrigin_Widget extends WP_Widget {
1227
$instance,
1228
$this
1229
);
1230
-
1231
foreach ( $f_scripts as $f_script ) {
1232
if ( ! wp_script_is( $f_script[0] ) ) {
1233
wp_enqueue_script(
@@ -1264,7 +1269,7 @@ abstract class SiteOrigin_Widget extends WP_Widget {
1264
$instance,
1265
$this
1266
);
1267
-
1268
foreach ( $f_styles as $f_style ) {
1269
if ( ! wp_style_is( $f_style[0] ) ) {
1270
wp_enqueue_style(
441
442
// Filter the instance specifically for the form
443
$instance = apply_filters('siteorigin_widgets_form_instance_' . $this->id_base, $instance, $this);
444
+
445
// `more_entropy` adds a period to the id.
446
$id = str_replace( '.', '', uniqid( rand(), true ) );
447
$form_id = 'siteorigin_widget_form_' . md5( $id );
1093
* @return string
1094
*/
1095
function get_style_hash( $instance ) {
1096
+ $style_hash = apply_filters('siteorigin_widgets_widget_style_hash', '', $this);
1097
+ if( empty( $style_hash ) ) {
1098
+ if( method_exists( $this, 'get_style_hash_variables' ) ) {
1099
+ $vars = apply_filters( 'siteorigin_widgets_hash_variables_' . $this->id_base, $this->get_style_hash_variables( $instance ), $instance, $this );
1100
+ } else {
1101
+ $vars = apply_filters( 'siteorigin_widgets_less_variables_' . $this->id_base, $this->get_less_variables( $instance ), $instance, $this );
1102
+ }
1103
+ $version = property_exists( $this, 'version' ) ? $this->version : '';
1104
+
1105
+ $style_hash = substr( md5( json_encode( $vars ) . $version ), 0, 12 );
1106
}
1107
1108
+ return $style_hash;
1109
}
1110
1111
/**
1232
$instance,
1233
$this
1234
);
1235
+
1236
foreach ( $f_scripts as $f_script ) {
1237
if ( ! wp_script_is( $f_script[0] ) ) {
1238
wp_enqueue_script(
1269
$instance,
1270
$this
1271
);
1272
+
1273
foreach ( $f_styles as $f_style ) {
1274
if ( ! wp_style_is( $f_style[0] ) ) {
1275
wp_enqueue_style(
compat/beaver-builder/styles.css CHANGED
@@ -90,27 +90,27 @@
90
}
91
.fl-lightbox .siteorigin-widget-form .sow-icon-elegantline,
92
.siteorigin-widgets-query-builder.media-modal .sow-icon-elegantline {
93
- font-family: 'sow-elegantline';
94
}
95
.fl-lightbox .siteorigin-widget-form .sow-icon-fontawesome,
96
.siteorigin-widgets-query-builder.media-modal .sow-icon-fontawesome {
97
- font-family: 'sow-fontawesome';
98
}
99
.fl-lightbox .siteorigin-widget-form .sow-icon-genericons,
100
.siteorigin-widgets-query-builder.media-modal .sow-icon-genericons {
101
- font-family: 'sow-genericons';
102
}
103
.fl-lightbox .siteorigin-widget-form .sow-icon-icomoon,
104
.siteorigin-widgets-query-builder.media-modal .sow-icon-icomoon {
105
- font-family: 'sow-icomoon';
106
}
107
.fl-lightbox .siteorigin-widget-form .sow-icon-ionicons,
108
.siteorigin-widgets-query-builder.media-modal .sow-icon-ionicons {
109
- font-family: 'sow-ionicons';
110
}
111
.fl-lightbox .siteorigin-widget-form .sow-icon-typicons,
112
.siteorigin-widgets-query-builder.media-modal .sow-icon-typicons {
113
- font-family: 'sow-typicons';
114
}
115
.fl-lightbox .siteorigin-widget-form .button,
116
.siteorigin-widgets-query-builder.media-modal .button,
90
}
91
.fl-lightbox .siteorigin-widget-form .sow-icon-elegantline,
92
.siteorigin-widgets-query-builder.media-modal .sow-icon-elegantline {
93
+ font-family: 'sow-elegantline' !important;
94
}
95
.fl-lightbox .siteorigin-widget-form .sow-icon-fontawesome,
96
.siteorigin-widgets-query-builder.media-modal .sow-icon-fontawesome {
97
+ font-family: 'sow-fontawesome' !important;
98
}
99
.fl-lightbox .siteorigin-widget-form .sow-icon-genericons,
100
.siteorigin-widgets-query-builder.media-modal .sow-icon-genericons {
101
+ font-family: 'sow-genericons' !important;
102
}
103
.fl-lightbox .siteorigin-widget-form .sow-icon-icomoon,
104
.siteorigin-widgets-query-builder.media-modal .sow-icon-icomoon {
105
+ font-family: 'sow-icomoon' !important;
106
}
107
.fl-lightbox .siteorigin-widget-form .sow-icon-ionicons,
108
.siteorigin-widgets-query-builder.media-modal .sow-icon-ionicons {
109
+ font-family: 'sow-ionicons' !important;
110
}
111
.fl-lightbox .siteorigin-widget-form .sow-icon-typicons,
112
.siteorigin-widgets-query-builder.media-modal .sow-icon-typicons {
113
+ font-family: 'sow-typicons' !important;
114
}
115
.fl-lightbox .siteorigin-widget-form .button,
116
.siteorigin-widgets-query-builder.media-modal .button,
js/slider/jquery.slider.js CHANGED
@@ -1,267 +1,266 @@
1
- /* globals jQuery, sowb */
2
-
3
- var sowb = window.sowb || {};
4
-
5
- sowb.SiteOriginSlider = function($) {
6
- return {
7
- playSlideVideo: function(el) {
8
- $(el).find('video').each(function(){
9
- if(typeof this.play !== 'undefined') {
10
- this.play();
11
- }
12
- });
13
- },
14
-
15
- pauseSlideVideo: function(el) {
16
- $(el).find('video').each(function(){
17
- if(typeof this.pause !== 'undefined') {
18
- this.pause();
19
- }
20
- });
21
- },
22
-
23
- setupActiveSlide: function(slider, newActive, speed){
24
- // Start by setting up the active sentinel
25
- var
26
- sentinel = $(slider).find('.cycle-sentinel'),
27
- active = $(newActive),
28
- video = active.find('video.sow-background-element');
29
-
30
- if( speed == undefined ) {
31
- sentinel.css( 'height', active.outerHeight() );
32
- }
33
- else {
34
- sentinel.animate( {height: active.outerHeight()}, speed );
35
- }
36
-
37
- if( video.length ) {
38
-
39
- // Resize the video so it fits in the current slide
40
- var
41
- slideRatio = active.outerWidth() / active.outerHeight(),
42
- videoRatio = video.outerWidth() / video.outerHeight();
43
-
44
- if( slideRatio > videoRatio ) {
45
- video.css( {
46
- 'width' : '100%',
47
- 'height' : 'auto'
48
- } );
49
- }
50
- else {
51
- video.css( {
52
- 'width' : 'auto',
53
- 'height' : '100%'
54
- } );
55
- }
56
-
57
- video.css( {
58
- 'margin-left' : -Math.ceil(video.width()/2),
59
- 'margin-top' : -Math.ceil(video.height()/2)
60
- } );
61
- }
62
- },
63
- };
64
- };
65
-
66
-
67
- jQuery( function($){
68
- sowb.setupSliders = sowb.setupSlider = function() {
69
- var siteoriginSlider = new sowb.SiteOriginSlider($);
70
-
71
- $('.sow-slider-images').each(function(){
72
- var $ = $(this);
73
- var $p = $.siblings('.sow-slider-pagination');
74
- var $base = $.closest('.sow-slider-base');
75
- var $n = $base.find('.sow-slide-nav');
76
- var $slides = $.find('.sow-slider-image');
77
- var settings = $.data('settings');
78
-
79
- $slides.each(function( index, el) {
80
- var $slide = $(el);
81
- var urlData = $slide.data('url');
82
-
83
- if( urlData !== undefined && urlData.hasOwnProperty( 'url' ) ) {
84
- $slide.click(function(event) {
85
-
86
- event.preventDefault();
87
- var sliderWindow = window.open(
88
- urlData.url,
89
- urlData.hasOwnProperty( 'new_window' ) && urlData.new_window ? '_blank' : '_self'
90
- );
91
- sliderWindow.opener = null;
92
- } );
93
- $slide.find( 'a' ).click( function ( event ) {
94
- event.stopPropagation();
95
- } );
96
- }
97
- });
98
-
99
- var setupSlider = function() {
100
-
101
- // If we're inside a fittext wrapper, wait for it to complete, before setting up the slider.
102
- var fitTextWrapper = $.closest('.so-widget-fittext-wrapper');
103
- if ( fitTextWrapper.length > 0 && ! fitTextWrapper.data('fitTextDone') ) {
104
- fitTextWrapper.on('fitTextDone', function () {
105
- setupSlider();
106
- });
107
- return;
108
- }
109
-
110
- // Show everything for this slider
111
- $base.show();
112
-
113
- // Setup each of the slider frames
114
- $.find('.sow-slider-image').each( function(){
115
- var $i = $(this);
116
-
117
- $(window)
118
- .on('resize panelsStretchRows', function(){
119
- $i.css( 'height', $i.find('.sow-slider-image-wrapper').outerHeight() );
120
- })
121
- .resize();
122
- } );
123
-
124
- // Set up the Cycle with videos
125
- $
126
- .on({
127
- 'cycle-after' : function(event, optionHash, outgoingSlideEl, incomingSlideEl, forwardFlag){
128
- var $ = $(this);
129
- siteoriginSlider.playSlideVideo(incomingSlideEl);
130
- siteoriginSlider.setupActiveSlide( $, incomingSlideEl );
131
- $( incomingSlideEl ).trigger('sowSlideCycleAfter');
132
- },
133
-
134
- 'cycle-before' : function(event, optionHash, outgoingSlideEl, incomingSlideEl, forwardFlag) {
135
- var $ = $(this);
136
- $p.find('> li').removeClass('sow-active').eq(optionHash.slideNum-1).addClass('sow-active');
137
- siteoriginSlider.pauseSlideVideo(outgoingSlideEl);
138
- siteoriginSlider.setupActiveSlide($, incomingSlideEl, optionHash.speed);
139
- $( incomingSlideEl ).trigger('sowSlideCycleBefore');
140
- },
141
-
142
- 'cycle-initialized' : function(event, optionHash){
143
- siteoriginSlider.playSlideVideo( $(this).find('.cycle-slide-active') );
144
- siteoriginSlider.setupActiveSlide( $, optionHash.slides[0] );
145
-
146
- $p.find('>li').removeClass('sow-active').eq(0).addClass('sow-active');
147
- $( this ).find('.cycle-slide-active').trigger( 'sowSlideInitial' );
148
-
149
- if(optionHash.slideCount <= 1) {
150
- // Special case when there is only one slide
151
- $p.hide();
152
- $n.hide();
153
- }
154
-
155
- $(window).resize();
156
-
157
- setTimeout(function() {
158
- siteoriginSlider.setupActiveSlide( $, optionHash.slides[0] );
159
- // Ensure we keep auto-height functionality, but we don't want the duplicated content.
160
- $.find('.cycle-sentinel').empty();
161
- }, 200);
162
- }
163
- })
164
- .cycle( {
165
- 'slides' : '> .sow-slider-image',
166
- 'speed' : settings.speed,
167
- 'timeout' : settings.timeout,
168
- 'swipe' : settings.swipe,
169
- 'swipe-fx' : 'scrollHorz'
170
- } ) ;
171
-
172
- $ .find('video.sow-background-element').on('loadeddata', function(){
173
- siteoriginSlider.setupActiveSlide( $, $.find( '.cycle-slide-active' ) );
174
- } );
175
-
176
- // Set up showing and hiding navs
177
- $p.add($n).hide();
178
- if( !$base.hasClass('sow-slider-is-mobile') && $slides.length > 1 ) {
179
-
180
- var toHide = false;
181
- $base
182
- .mouseenter(function(){
183
- $p.add($n).clearQueue().fadeIn(150);
184
- toHide = false;
185
- })
186
- .mouseleave(function(){
187
- toHide = true;
188
- setTimeout(function(){
189
- if( toHide ) {
190
- $p.add($n).clearQueue().fadeOut(150);
191
- }
192
- toHide = false;
193
- }, 750);
194
- });
195
- }
196
-
197
- // Resize the sentinel when ever the window is resized
198
- $( window ).resize( function(){
199
- siteoriginSlider.setupActiveSlide( $, $.find( '.cycle-slide-active' ) );
200
- } );
201
-
202
- // Setup clicks on the pagination
203
- $p.find( '> li > a' ).click( function(e){
204
- e.preventDefault();
205
- $.cycle( 'goto', $(this).data('goto') );
206
- } );
207
-
208
- // Clicking on the next and previous navigation buttons
209
- $n.find( '> a' ).click( function(e){
210
- e.preventDefault();
211
- $.cycle( $(this).data('action') );
212
- } );
213
-
214
- $base.keydown(
215
- function(event) {
216
- if(event.which === 37) {
217
- //left
218
- $.cycle('prev');
219
- }
220
- else if (event.which === 39) {
221
- //right
222
- $.cycle('next');
223
- }
224
- }
225
- );
226
- };
227
-
228
- var images = $.find('img');
229
- var imagesLoaded = 0;
230
- var sliderLoaded = false;
231
-
232
- // Preload all the images, when they're loaded, then display the slider
233
- images.each( function(){
234
- var $i = $(this);
235
- if( this.complete ) {
236
- imagesLoaded++;
237
- }
238
- else {
239
- $(this).one('load', function(){
240
- imagesLoaded++;
241
-
242
- if(imagesLoaded === images.length && !sliderLoaded) {
243
- setupSlider();
244
- sliderLoaded = true;
245
- }
246
- })
247
- // Reset src attribute to force 'load' event for cached images in IE9 and IE10.
248
- .attr('src', $(this).attr('src'));
249
- }
250
-
251
- if(imagesLoaded === images.length && !sliderLoaded) {
252
- setupSlider();
253
- sliderLoaded = true;
254
- }
255
- } );
256
-
257
- if(images.length === 0) {
258
- setupSlider();
259
- }
260
- });
261
- };
262
- sowb.setupSliders();
263
-
264
- $( sowb ).on( 'setup_widgets', sowb.setupSliders );
265
- } );
266
-
267
- window.sowb = sowb;
1
+ /* globals jQuery, sowb */
2
+
3
+ var sowb = window.sowb || {};
4
+
5
+ sowb.SiteOriginSlider = function($) {
6
+ return {
7
+ playSlideVideo: function(el) {
8
+ $(el).find('video').each(function(){
9
+ if(typeof this.play !== 'undefined') {
10
+ this.play();
11
+ }
12
+ });
13
+ },
14
+
15
+ pauseSlideVideo: function(el) {
16
+ $(el).find('video').each(function(){
17
+ if(typeof this.pause !== 'undefined') {
18
+ this.pause();
19
+ }
20
+ });
21
+ },
22
+
23
+ setupActiveSlide: function(slider, newActive, speed){
24
+ // Start by setting up the active sentinel
25
+ var
26
+ sentinel = $(slider).find('.cycle-sentinel'),
27
+ active = $(newActive),
28
+ video = active.find('video.sow-background-element');
29
+
30
+ if( speed == undefined ) {
31
+ sentinel.css( 'height', active.outerHeight() );
32
+ }
33
+ else {
34
+ sentinel.animate( {height: active.outerHeight()}, speed );
35
+ }
36
+
37
+ if( video.length ) {
38
+
39
+ // Resize the video so it fits in the current slide
40
+ var
41
+ slideRatio = active.outerWidth() / active.outerHeight(),
42
+ videoRatio = video.outerWidth() / video.outerHeight();
43
+
44
+ if( slideRatio > videoRatio ) {
45
+ video.css( {
46
+ 'width' : '100%',
47
+ 'height' : 'auto'
48
+ } );
49
+ }
50
+ else {
51
+ video.css( {
52
+ 'width' : 'auto',
53
+ 'height' : '100%'
54
+ } );
55
+ }
56
+
57
+ video.css( {
58
+ 'margin-left' : -Math.ceil(video.width()/2),
59
+ 'margin-top' : -Math.ceil(video.height()/2)
60
+ } );
61
+ }
62
+ },
63
+ };
64
+ };
65
+
66
+
67
+ jQuery( function($){
68
+ sowb.setupSliders = sowb.setupSlider = function() {
69
+ var siteoriginSlider = new sowb.SiteOriginSlider($);
70
+
71
+ $('.sow-slider-images').each(function(){
72
+ var $ = $(this);
73
+ var $p = $.siblings('.sow-slider-pagination');
74
+ var $base = $.closest('.sow-slider-base');
75
+ var $n = $base.find('.sow-slide-nav');
76
+ var $slides = $.find('.sow-slider-image');
77
+ var settings = $.data('settings');
78
+
79
+ $slides.each(function( index, el) {
80
+ var $slide = $(el);
81
+ var urlData = $slide.data('url');
82
+
83
+ if( urlData !== undefined && urlData.hasOwnProperty( 'url' ) ) {
84
+ $slide.click(function(event) {
85
+
86
+ event.preventDefault();
87
+ var sliderWindow = window.open(
88
+ urlData.url,
89
+ urlData.hasOwnProperty( 'new_window' ) && urlData.new_window ? '_blank' : '_self'
90
+ );
91
+ sliderWindow.opener = null;
92
+ } );
93
+ $slide.find( 'a' ).click( function ( event ) {
94
+ event.stopPropagation();
95
+ } );
96
+ }
97
+ });
98
+
99
+ var setupSlider = function() {
100
+
101
+ // If we're inside a fittext wrapper, wait for it to complete, before setting up the slider.
102
+ var fitTextWrapper = $.closest('.so-widget-fittext-wrapper');
103
+ if ( fitTextWrapper.length > 0 && ! fitTextWrapper.data('fitTextDone') ) {
104
+ fitTextWrapper.on('fitTextDone', function () {
105
+ setupSlider();
106
+ });
107
+ return;
108
+ }
109
+
110
+ // Show everything for this slider
111
+ $base.show();
112
+
113
+ var resizeFrames = function () {
114
+ $.find( '.sow-slider-image' ).each( function () {
115
+ var $i = $( this );
116
+ $i.css( 'height', $i.find( '.sow-slider-image-wrapper' ).outerHeight() );
117
+ } );
118
+ };
119
+ // Setup each of the slider frames
120
+ $(window).on('resize panelsStretchRows', resizeFrames ).resize();
121
+
122
+ // Set up the Cycle with videos
123
+ $
124
+ .on({
125
+ 'cycle-after' : function(event, optionHash, outgoingSlideEl, incomingSlideEl, forwardFlag){
126
+ var $ = $(this);
127
+ siteoriginSlider.playSlideVideo(incomingSlideEl);
128
+ siteoriginSlider.setupActiveSlide( $, incomingSlideEl );
129
+ $( incomingSlideEl ).trigger('sowSlideCycleAfter');
130
+ },
131
+
132
+ 'cycle-before' : function(event, optionHash, outgoingSlideEl, incomingSlideEl, forwardFlag) {
133
+ var $ = $(this);
134
+ $p.find('> li').removeClass('sow-active').eq(optionHash.slideNum-1).addClass('sow-active');
135
+ siteoriginSlider.pauseSlideVideo(outgoingSlideEl);
136
+ siteoriginSlider.setupActiveSlide($, incomingSlideEl, optionHash.speed);
137
+ $( incomingSlideEl ).trigger('sowSlideCycleBefore');
138
+ },
139
+
140
+ 'cycle-initialized' : function(event, optionHash){
141
+ siteoriginSlider.playSlideVideo( $(this).find('.cycle-slide-active') );
142
+ siteoriginSlider.setupActiveSlide( $, optionHash.slides[0] );
143
+
144
+ $p.find('>li').removeClass('sow-active').eq(0).addClass('sow-active');
145
+ $( this ).find('.cycle-slide-active').trigger( 'sowSlideInitial' );
146
+
147
+ if(optionHash.slideCount <= 1) {
148
+ // Special case when there is only one slide
149
+ $p.hide();
150
+ $n.hide();
151
+ }
152
+
153
+ $(window).resize();
154
+
155
+ setTimeout(function() {
156
+ resizeFrames();
157
+ siteoriginSlider.setupActiveSlide( $, optionHash.slides[0] );
158
+ // Ensure we keep auto-height functionality, but we don't want the duplicated content.
159
+ $.find('.cycle-sentinel').empty();
160
+ }, 200);
161
+ }
162
+ })
163
+ .cycle( {
164
+ 'slides' : '> .sow-slider-image',
165
+ 'speed' : settings.speed,
166
+ 'timeout' : settings.timeout,
167
+ 'swipe' : settings.swipe,
168
+ 'swipe-fx' : 'scrollHorz'
169
+ } ) ;
170
+
171
+ $ .find('video.sow-background-element').on('loadeddata', function(){
172
+ siteoriginSlider.setupActiveSlide( $, $.find( '.cycle-slide-active' ) );
173
+ } );
174
+
175
+ // Set up showing and hiding navs
176
+ $p.add($n).hide();
177
+ if( !$base.hasClass('sow-slider-is-mobile') && $slides.length > 1 ) {
178
+
179
+ var toHide = false;
180
+ $base
181
+ .mouseenter(function(){
182
+ $p.add($n).clearQueue().fadeIn(150);
183
+ toHide = false;
184
+ })
185
+ .mouseleave(function(){
186
+ toHide = true;
187
+ setTimeout(function(){
188
+ if( toHide ) {
189
+ $p.add($n).clearQueue().fadeOut(150);
190
+ }
191
+ toHide = false;
192
+ }, 750);
193
+ });
194
+ }
195
+
196
+ // Resize the sentinel when ever the window is resized
197
+ $( window ).resize( function(){
198
+ siteoriginSlider.setupActiveSlide( $, $.find( '.cycle-slide-active' ) );
199
+ } );
200
+
201
+ // Setup clicks on the pagination
202
+ $p.find( '> li > a' ).click( function(e){
203
+ e.preventDefault();
204
+ $.cycle( 'goto', $(this).data('goto') );
205
+ } );
206
+
207
+ // Clicking on the next and previous navigation buttons
208
+ $n.find( '> a' ).click( function(e){
209
+ e.preventDefault();
210
+ $.cycle( $(this).data('action') );
211
+ } );
212
+
213
+ $base.keydown(
214
+ function(event) {
215
+ if(event.which === 37) {
216
+ //left
217
+ $.cycle('prev');
218
+ }
219
+ else if (event.which === 39) {
220
+ //right
221
+ $.cycle('next');
222
+ }
223
+ }
224
+ );
225
+ };
226
+
227
+ var images = $.find('img');
228
+ var imagesLoaded = 0;
229
+ var sliderLoaded = false;
230
+
231
+ // Preload all the images, when they're loaded, then display the slider
232
+ images.each( function(){
233
+ var $i = $(this);
234
+ if( this.complete ) {
235
+ imagesLoaded++;
236
+ }
237
+ else {
238
+ $(this).one('load', function(){
239
+ imagesLoaded++;
240
+
241
+ if(imagesLoaded === images.length && !sliderLoaded) {
242
+ setupSlider();
243
+ sliderLoaded = true;
244
+ }
245
+ })
246
+ // Reset src attribute to force 'load' event for cached images in IE9 and IE10.
247
+ .attr('src', $(this).attr('src'));
248
+ }
249
+
250
+ if(imagesLoaded === images.length && !sliderLoaded) {
251
+ setupSlider();
252
+ sliderLoaded = true;
253
+ }
254
+ } );
255
+
256
+ if(images.length === 0) {
257
+ setupSlider();
258
+ }
259
+ });
260
+ };
261
+ sowb.setupSliders();
262
+
263
+ $( sowb ).on( 'setup_widgets', sowb.setupSliders );
264
+ } );
265
+
266
+ window.sowb = sowb;
js/slider/jquery.slider.min.js CHANGED
@@ -1 +1 @@
1
- var sowb=window.sowb||{};sowb.SiteOriginSlider=function(e){return{playSlideVideo:function(i){e(i).find("video").each(function(){void 0!==this.play&&this.play()})},pauseSlideVideo:function(i){e(i).find("video").each(function(){void 0!==this.pause&&this.pause()})},setupActiveSlide:function(i,t,s){var n=e(i).find(".cycle-sentinel"),o=e(t),d=o.find("video.sow-background-element");if(void 0==s?n.css("height",o.outerHeight()):n.animate({height:o.outerHeight()},s),d.length){o.outerWidth()/o.outerHeight()>d.outerWidth()/d.outerHeight()?d.css({width:"100%",height:"auto"}):d.css({width:"auto",height:"100%"}),d.css({"margin-left":-Math.ceil(d.width()/2),"margin-top":-Math.ceil(d.height()/2)})}}}},jQuery(function(e){sowb.setupSliders=sowb.setupSlider=function(){var i=new sowb.SiteOriginSlider(e);e(".sow-slider-images").each(function(){var t=e(this),s=t.siblings(".sow-slider-pagination"),n=t.closest(".sow-slider-base"),o=n.find(".sow-slide-nav"),d=t.find(".sow-slider-image"),c=t.data("settings");d.each(function(i,t){var s=e(t),n=s.data("url");void 0!==n&&n.hasOwnProperty("url")&&(s.click(function(e){e.preventDefault(),window.open(n.url,n.hasOwnProperty("new_window")&&n.new_window?"_blank":"_self").opener=null}),s.find("a").click(function(e){e.stopPropagation()}))});var l=function(){var a=t.closest(".so-widget-fittext-wrapper");if(a.length>0&&!a.data("fitTextDone"))return void a.on("fitTextDone",function(){l()});if(n.show(),t.find(".sow-slider-image").each(function(){var i=e(this);e(window).on("resize panelsStretchRows",function(){i.css("height",i.find(".sow-slider-image-wrapper").outerHeight())}).resize()}),t.on({"cycle-after":function(t,s,n,o,d){var c=e(this);i.playSlideVideo(o),i.setupActiveSlide(c,o),e(o).trigger("sowSlideCycleAfter")},"cycle-before":function(t,n,o,d,c){var l=e(this);s.find("> li").removeClass("sow-active").eq(n.slideNum-1).addClass("sow-active"),i.pauseSlideVideo(o),i.setupActiveSlide(l,d,n.speed),e(d).trigger("sowSlideCycleBefore")},"cycle-initialized":function(n,d){i.playSlideVideo(e(this).find(".cycle-slide-active")),i.setupActiveSlide(t,d.slides[0]),s.find(">li").removeClass("sow-active").eq(0).addClass("sow-active"),e(this).find(".cycle-slide-active").trigger("sowSlideInitial"),d.slideCount<=1&&(s.hide(),o.hide()),e(window).resize(),setTimeout(function(){i.setupActiveSlide(t,d.slides[0]),t.find(".cycle-sentinel").empty()},200)}}).cycle({slides:"> .sow-slider-image",speed:c.speed,timeout:c.timeout,swipe:c.swipe,"swipe-fx":"scrollHorz"}),t.find("video.sow-background-element").on("loadeddata",function(){i.setupActiveSlide(t,t.find(".cycle-slide-active"))}),s.add(o).hide(),!n.hasClass("sow-slider-is-mobile")&&d.length>1){var r=!1;n.mouseenter(function(){s.add(o).clearQueue().fadeIn(150),r=!1}).mouseleave(function(){r=!0,setTimeout(function(){r&&s.add(o).clearQueue().fadeOut(150),r=!1},750)})}e(window).resize(function(){i.setupActiveSlide(t,t.find(".cycle-slide-active"))}),s.find("> li > a").click(function(i){i.preventDefault(),t.cycle("goto",e(this).data("goto"))}),o.find("> a").click(function(i){i.preventDefault(),t.cycle(e(this).data("action"))}),n.keydown(function(e){37===e.which?t.cycle("prev"):39===e.which&&t.cycle("next")})},a=t.find("img"),r=0,u=!1;a.each(function(){e(this);this.complete?r++:e(this).one("load",function(){++r!==a.length||u||(l(),u=!0)}).attr("src",e(this).attr("src")),r!==a.length||u||(l(),u=!0)}),0===a.length&&l()})},sowb.setupSliders(),e(sowb).on("setup_widgets",sowb.setupSliders)}),window.sowb=sowb;
1
+ var sowb=window.sowb||{};sowb.SiteOriginSlider=function(e){return{playSlideVideo:function(i){e(i).find("video").each(function(){void 0!==this.play&&this.play()})},pauseSlideVideo:function(i){e(i).find("video").each(function(){void 0!==this.pause&&this.pause()})},setupActiveSlide:function(i,t,s){var n=e(i).find(".cycle-sentinel"),o=e(t),d=o.find("video.sow-background-element");if(void 0==s?n.css("height",o.outerHeight()):n.animate({height:o.outerHeight()},s),d.length){o.outerWidth()/o.outerHeight()>d.outerWidth()/d.outerHeight()?d.css({width:"100%",height:"auto"}):d.css({width:"auto",height:"100%"}),d.css({"margin-left":-Math.ceil(d.width()/2),"margin-top":-Math.ceil(d.height()/2)})}}}},jQuery(function(e){sowb.setupSliders=sowb.setupSlider=function(){var i=new sowb.SiteOriginSlider(e);e(".sow-slider-images").each(function(){var t=e(this),s=t.siblings(".sow-slider-pagination"),n=t.closest(".sow-slider-base"),o=n.find(".sow-slide-nav"),d=t.find(".sow-slider-image"),c=t.data("settings");d.each(function(i,t){var s=e(t),n=s.data("url");void 0!==n&&n.hasOwnProperty("url")&&(s.click(function(e){e.preventDefault(),window.open(n.url,n.hasOwnProperty("new_window")&&n.new_window?"_blank":"_self").opener=null}),s.find("a").click(function(e){e.stopPropagation()}))});var l=function(){var a=t.closest(".so-widget-fittext-wrapper");if(a.length>0&&!a.data("fitTextDone"))return void a.on("fitTextDone",function(){l()});n.show();var r=function(){t.find(".sow-slider-image").each(function(){var i=e(this);i.css("height",i.find(".sow-slider-image-wrapper").outerHeight())})};if(e(window).on("resize panelsStretchRows",r).resize(),t.on({"cycle-after":function(t,s,n,o,d){var c=e(this);i.playSlideVideo(o),i.setupActiveSlide(c,o),e(o).trigger("sowSlideCycleAfter")},"cycle-before":function(t,n,o,d,c){var l=e(this);s.find("> li").removeClass("sow-active").eq(n.slideNum-1).addClass("sow-active"),i.pauseSlideVideo(o),i.setupActiveSlide(l,d,n.speed),e(d).trigger("sowSlideCycleBefore")},"cycle-initialized":function(n,d){i.playSlideVideo(e(this).find(".cycle-slide-active")),i.setupActiveSlide(t,d.slides[0]),s.find(">li").removeClass("sow-active").eq(0).addClass("sow-active"),e(this).find(".cycle-slide-active").trigger("sowSlideInitial"),d.slideCount<=1&&(s.hide(),o.hide()),e(window).resize(),setTimeout(function(){r(),i.setupActiveSlide(t,d.slides[0]),t.find(".cycle-sentinel").empty()},200)}}).cycle({slides:"> .sow-slider-image",speed:c.speed,timeout:c.timeout,swipe:c.swipe,"swipe-fx":"scrollHorz"}),t.find("video.sow-background-element").on("loadeddata",function(){i.setupActiveSlide(t,t.find(".cycle-slide-active"))}),s.add(o).hide(),!n.hasClass("sow-slider-is-mobile")&&d.length>1){var u=!1;n.mouseenter(function(){s.add(o).clearQueue().fadeIn(150),u=!1}).mouseleave(function(){u=!0,setTimeout(function(){u&&s.add(o).clearQueue().fadeOut(150),u=!1},750)})}e(window).resize(function(){i.setupActiveSlide(t,t.find(".cycle-slide-active"))}),s.find("> li > a").click(function(i){i.preventDefault(),t.cycle("goto",e(this).data("goto"))}),o.find("> a").click(function(i){i.preventDefault(),t.cycle(e(this).data("action"))}),n.keydown(function(e){37===e.which?t.cycle("prev"):39===e.which&&t.cycle("next")})},a=t.find("img"),r=0,u=!1;a.each(function(){e(this);this.complete?r++:e(this).one("load",function(){++r!==a.length||u||(l(),u=!0)}).attr("src",e(this).attr("src")),r!==a.length||u||(l(),u=!0)}),0===a.length&&l()})},sowb.setupSliders(),e(sowb).on("setup_widgets",sowb.setupSliders)}),window.sowb=sowb;
js/{sow.google.map.js → sow.google-map.js} RENAMED
@@ -75,17 +75,6 @@ sowb.SiteOriginGoogleMap = function($) {
75
this.showMarkers(options.markerPositions, map, options);
76
this.showDirections(options.directions, map, options);
77
78
- // If the Google Maps element is hidden it won't display properly. This is an attempt to make it display by
79
- // calling resize when a custom 'show' event is fired. The 'show' event is something we fire in a few widgets
80
- // like Accordion and Tabs and in future any widgets which might show and hide content using `display:none;`.
81
- if ( $( element ).is( ':hidden' ) ) {
82
- var $visParent = $( element ).closest( ':visible' );
83
- $visParent.find( '> :hidden' ).on( 'show', function () {
84
- google.maps.event.trigger(map, 'resize');
85
- map.setCenter(location);
86
- } );
87
- }
88
-
89
},
90
91
linkAutocompleteField: function (autocomplete, autocompleteElement, map, options) {
@@ -337,7 +326,7 @@ sowb.SiteOriginGoogleMap = function($) {
337
this.getLocation( address ).done(
338
function ( location ) {
339
this.showMap( $.get( 0 ), location, options );
340
- $.data( 'initialized' );
341
}.bind( this )
342
).fail( function () {
343
$.append( '<div><p><strong>' + soWidgetsGoogleMap.geocode.noResults + '</strong></p></div>' );
@@ -416,6 +405,9 @@ jQuery(function ($) {
416
var apiKey;
417
$('.sow-google-map-canvas').each(function(index, element) {
418
var $this = $(element);
419
var mapOptions = $this.data( 'options' );
420
if ( mapOptions) {
421
if( typeof mapOptions.libraries !== 'undefined' && mapOptions.libraries !== null ) {
@@ -425,6 +417,7 @@ jQuery(function ($) {
425
apiKey = mapOptions.apiKey;
426
}
427
}
428
});
429
430
var mapsApiLoaded = typeof window.google !== 'undefined' && typeof window.google.maps !== 'undefined';
75
this.showMarkers(options.markerPositions, map, options);
76
this.showDirections(options.directions, map, options);
77
78
},
79
80
linkAutocompleteField: function (autocomplete, autocompleteElement, map, options) {
326
this.getLocation( address ).done(
327
function ( location ) {
328
this.showMap( $.get( 0 ), location, options );
329
+ $.data( 'initialized', true );
330
}.bind( this )
331
).fail( function () {
332
$.append( '<div><p><strong>' + soWidgetsGoogleMap.geocode.noResults + '</strong></p></div>' );
405
var apiKey;
406
$('.sow-google-map-canvas').each(function(index, element) {
407
var $this = $(element);
408
+ if ( ! $this.is( ':visible' ) || $this.data( 'apiInitialized' ) ) {
409
+ return $this;
410
+ }
411
var mapOptions = $this.data( 'options' );
412
if ( mapOptions) {
413
if( typeof mapOptions.libraries !== 'undefined' && mapOptions.libraries !== null ) {
417
apiKey = mapOptions.apiKey;
418
}
419
}
420
+ $this.data( 'apiInitialized', true );
421
});
422
423
var mapsApiLoaded = typeof window.google !== 'undefined' && typeof window.google.maps !== 'undefined';
js/sow.google-map.min.js ADDED
@@ -0,0 +1 @@
1
+ function soGoogleMapInitialize(){new sowb.SiteOriginGoogleMap(jQuery).initMaps()}var sowb=window.sowb||{};sowb.SiteOriginGoogleMap=function(e){return{DEFAULT_LOCATIONS:["Addo Elephant National Park, R335, Addo","Cape Town, Western Cape, South Africa","San Francisco Bay Area, CA, United States","New York, NY, United States"],showMap:function(e,o,t){var i=Number(t.zoom);i||(i=14);var a={zoom:i,scrollwheel:t.scrollZoom,draggable:t.draggable,disableDefaultUI:t.disableUi,zoomControl:t.zoomControl,panControl:t.panControl,center:o,mapTypeControlOptions:{mapTypeIds:[google.maps.MapTypeId.ROADMAP,google.maps.MapTypeId.SATELLITE,"user_map_style"]}},n=new google.maps.Map(e,a),s={name:t.mapName},r=t.mapStyles;if(r){var l=new google.maps.StyledMapType(r,s);n.mapTypes.set("user_map_style",l),n.setMapTypeId("user_map_style")}if(t.markerAtCenter&&(this.centerMarker=new google.maps.Marker({position:o,map:n,draggable:t.markersDraggable,icon:t.markerIcon,title:""})),t.keepCentered){var d;google.maps.event.addDomListener(n,"idle",function(){d=n.getCenter()}),google.maps.event.addDomListener(window,"resize",function(){n.setCenter(d)})}this.linkAutocompleteField(t.autocomplete,t.autocompleteElement,n,t),this.showMarkers(t.markerPositions,n,t),this.showDirections(t.directions,n,t)},linkAutocompleteField:function(o,t,i,a){if(o&&t){var n=function(e){this.inputAddress!==e&&(this.inputAddress=e,this.getLocation(this.inputAddress).done(function(e){i.setZoom(15),i.setCenter(e),this.centerMarker&&(this.centerMarker.setPosition(e),this.centerMarker.setTitle(this.inputAddress))}.bind(this)))}.bind(this),s=e(t);o.addListener("place_changed",function(){var e=o.getPlace();i.setZoom(15),e.geometry&&(i.setCenter(e.geometry.location),this.centerMarker&&this.centerMarker.setPosition(e.geometry.location))}.bind(this)),google.maps.event.addDomListener(t,"keypress",function(e){"13"===(e.keyCode||e.which)&&e.preventDefault()}),s.focusin(function(){if(!this.resultsObserver){var o=document.querySelector(".pac-container");this.resultsObserver=new MutationObserver(function(){var o=e(e(".pac-item").get(0)),t=o.find(".pac-item-query").text(),i=o.find("span").not("[class]").text(),a=t+(i?", "+i:"");a&&n(a)});var t={attributes:!0,childList:!0,characterData:!0};this.resultsObserver.observe(o,t)}}.bind(this));var r=function(e){this.getGeocoder().geocode({location:e},function(o,t){if(t===google.maps.GeocoderStatus.OK&&o.length>0){var i=o[0].formatted_address;s.val(i),this.centerMarker&&(this.centerMarker.setPosition(e),this.centerMarker.setTitle(i))}}.bind(this))}.bind(this);i.addListener("click",function(e){r(e.latLng)}),this.centerMarker.addListener("dragend",function(e){r(e.latLng)})}},showMarkers:function(e,o,t){if(e&&e.length){this.infoWindows=[];for(var i=[],a=0;a<e.length;a++){var n=parseInt(a/10);i.length===n&&(i[n]=[]),i[n][a%10]=e[a]}var s=function(e,i){var a=0;e.forEach(function(n){this.getLocation(n.place).done(function(r){var l=t.markerIcon;n.custom_marker_icon&&(l=n.custom_marker_icon);var d=new google.maps.Marker({position:r,map:o,draggable:t.markersDraggable,icon:l,title:""});if(n.hasOwnProperty("info")&&n.info){var c={content:n.info};n.hasOwnProperty("info_max_width")&&n.info_max_width&&(c.maxWidth=n.info_max_width);var p=t.markerInfoDisplay;c.disableAutoPan="always"===p;var g=new google.maps.InfoWindow(c);this.infoWindows.push(g);var h=p;"always"===p&&(h="click",g.open(o,d)),d.addListener(h,function(){g.open(o,d),"always"===p||t.markerInfoMultiple||this.infoWindows.forEach(function(e){e!==g&&e.close()})}.bind(this)),"mouseover"===p&&d.addListener("mouseout",function(){setTimeout(function(){g.close()},100)})}++a===e.length&&i.length&&s(i.shift(),i)}.bind(this))}.bind(this))}.bind(this);s(i.shift(),i)}},showDirections:function(e,o){if(e){e.waypoints&&e.waypoints.length&&e.waypoints.map(function(e){e.stopover=Boolean(e.stopover)});var t=new google.maps.DirectionsRenderer;t.setMap(o);(new google.maps.DirectionsService).route({origin:e.origin,destination:e.destination,travelMode:e.travelMode.toUpperCase(),avoidHighways:e.avoidHighways,avoidTolls:e.avoidTolls,waypoints:e.waypoints,optimizeWaypoints:e.optimizeWaypoints},function(o,i){i===google.maps.DirectionsStatus.OK&&(t.setOptions({preserveViewport:e.preserveViewport}),t.setDirections(o))})}},initMaps:function(){var o=e(".sow-google-map-autocomplete"),t=new e.Deferred;0===o.length?t.resolve():o.each(function(o,i){if(void 0===google.maps.places)return void t.reject('Sorry, we couldn\'t load the "places" library due to another plugin, so the autocomplete feature is not available.');var a=new google.maps.places.Autocomplete(i,{types:["address"]}),n=e(i).siblings(".sow-google-map-canvas");if(n.length>0){var s=n.data("options");s.autocomplete=a,s.autocompleteElement=i,this.getLocation(s.address).done(function(e){this.showMap(n.get(0),e,s),n.data("initialized",!0),t.resolve()}.bind(this)).fail(function(){n.append("<div><p><strong>"+soWidgetsGoogleMap.geocode.noResults+"</strong></p></div>"),t.reject()})}}.bind(this)),t.always(function(){e(".sow-google-map-canvas").each(function(o,t){var i=e(t);if(i.data("initialized"))return!0;var a=i.data("options"),n=a.address;if(!n){var s=a.markerPositions;s&&s.length&&(n=s[0].place)}this.getLocation(n).done(function(e){this.showMap(i.get(0),e,a),i.data("initialized",!0)}.bind(this)).fail(function(){i.append("<div><p><strong>"+soWidgetsGoogleMap.geocode.noResults+"</strong></p></div>")})}.bind(this))}.bind(this)).fail(function(e){console.log(e)})},getGeocoder:function(){return this._geocoder||(this._geocoder=new google.maps.Geocoder),this._geocoder},getLocation:function(o){var t,i=new e.Deferred,a={address:o};if(o&&o.indexOf(",")>-1){var n=o.split(",");n&&2===n.length&&(t=new google.maps.LatLng(n[0],n[1]),isNaN(t.lat())||isNaN(t.lng())||(a={location:{lat:t.lat(),lng:t.lng()}}))}if(a.hasOwnProperty("location"))i.resolve(a.location);else if(a.hasOwnProperty("address")){if(!a.address){var s=parseInt(Math.random()*this.DEFAULT_LOCATIONS.length);a.address=this.DEFAULT_LOCATIONS[s]}var r=function(e,o){o===google.maps.GeocoderStatus.OK?i.resolve(e[0].geometry.location):o===google.maps.GeocoderStatus.OVER_QUERY_LIMIT?setTimeout(function(){this.getGeocoder().geocode.call(this,a,r)}.bind(this),100):o===google.maps.GeocoderStatus.ZERO_RESULTS&&i.reject(o)}.bind(this);this.getGeocoder().geocode(a,r)}return i}}},jQuery(function(e){sowb.setupGoogleMaps=function(){var o,t=[];if(e(".sow-google-map-canvas").each(function(i,a){var n=e(a);if(!n.is(":visible")||n.data("apiInitialized"))return n;var s=n.data("options");s&&(void 0!==s.libraries&&null!==s.libraries&&(t=t.concat(s.libraries)),!o&&s.apiKey&&(o=s.apiKey)),n.data("apiInitialized",!0)}),void 0!==window.google&&void 0!==window.google.maps)soGoogleMapInitialize();else{var i="https://maps.googleapis.com/maps/api/js?callback=soGoogleMapInitialize";if(t&&t.length&&(i+="&libraries="+t.join(",")),o&&(i+="&key="+o),window.console&&window.console.error){var a=window.console.error;sowb.onLoadMapsApiError=function(o){var t=o.match(/^Google Maps API (error|warning): ([^\s]*)\s([^\s]*)(?:\s(.*))?/);t&&t.length&&t[0]&&e(".sow-google-map-canvas").each(function(o,t){var i=e(t);if(i.data("fallbackImage")){var a=i.data("fallbackImage");a.hasOwnProperty("img")&&i.append(a.img)}}),a.apply(window.console,arguments)},window.console.error=sowb.onLoadMapsApiError}e("body").append('<script async type="text/javascript" src="'+i+'">')}},sowb.setupGoogleMaps(),e(sowb).on("setup_widgets",sowb.setupGoogleMaps)}),window.sowb=sowb;
js/sow.google.map.min.js DELETED
@@ -1 +0,0 @@
1
- function soGoogleMapInitialize(){new sowb.SiteOriginGoogleMap(jQuery).initMaps()}var sowb=window.sowb||{};sowb.SiteOriginGoogleMap=function(e){return{DEFAULT_LOCATIONS:["Addo Elephant National Park, R335, Addo","Cape Town, Western Cape, South Africa","San Francisco Bay Area, CA, United States","New York, NY, United States"],showMap:function(o,t,i){var n=Number(i.zoom);n||(n=14);var a={zoom:n,scrollwheel:i.scrollZoom,draggable:i.draggable,disableDefaultUI:i.disableUi,zoomControl:i.zoomControl,panControl:i.panControl,center:t,mapTypeControlOptions:{mapTypeIds:[google.maps.MapTypeId.ROADMAP,google.maps.MapTypeId.SATELLITE,"user_map_style"]}},s=new google.maps.Map(o,a),r={name:i.mapName},l=i.mapStyles;if(l){var d=new google.maps.StyledMapType(l,r);s.mapTypes.set("user_map_style",d),s.setMapTypeId("user_map_style")}if(i.markerAtCenter&&(this.centerMarker=new google.maps.Marker({position:t,map:s,draggable:i.markersDraggable,icon:i.markerIcon,title:""})),i.keepCentered){var c;google.maps.event.addDomListener(s,"idle",function(){c=s.getCenter()}),google.maps.event.addDomListener(window,"resize",function(){s.setCenter(c)})}if(this.linkAutocompleteField(i.autocomplete,i.autocompleteElement,s,i),this.showMarkers(i.markerPositions,s,i),this.showDirections(i.directions,s,i),e(o).is(":hidden")){e(o).closest(":visible").find("> :hidden").on("show",function(){google.maps.event.trigger(s,"resize"),s.setCenter(t)})}},linkAutocompleteField:function(o,t,i,n){if(o&&t){var a=function(e){this.inputAddress!==e&&(this.inputAddress=e,this.getLocation(this.inputAddress).done(function(e){i.setZoom(15),i.setCenter(e),this.centerMarker&&(this.centerMarker.setPosition(e),this.centerMarker.setTitle(this.inputAddress))}.bind(this)))}.bind(this),s=e(t);o.addListener("place_changed",function(){var e=o.getPlace();i.setZoom(15),e.geometry&&(i.setCenter(e.geometry.location),this.centerMarker&&this.centerMarker.setPosition(e.geometry.location))}.bind(this)),google.maps.event.addDomListener(t,"keypress",function(e){"13"===(e.keyCode||e.which)&&e.preventDefault()}),s.focusin(function(){if(!this.resultsObserver){var o=document.querySelector(".pac-container");this.resultsObserver=new MutationObserver(function(){var o=e(e(".pac-item").get(0)),t=o.find(".pac-item-query").text(),i=o.find("span").not("[class]").text(),n=t+(i?", "+i:"");n&&a(n)});var t={attributes:!0,childList:!0,characterData:!0};this.resultsObserver.observe(o,t)}}.bind(this));var r=function(e){this.getGeocoder().geocode({location:e},function(o,t){if(t===google.maps.GeocoderStatus.OK&&o.length>0){var i=o[0].formatted_address;s.val(i),this.centerMarker&&(this.centerMarker.setPosition(e),this.centerMarker.setTitle(i))}}.bind(this))}.bind(this);i.addListener("click",function(e){r(e.latLng)}),this.centerMarker.addListener("dragend",function(e){r(e.latLng)})}},showMarkers:function(e,o,t){if(e&&e.length){this.infoWindows=[];for(var i=[],n=0;n<e.length;n++){var a=parseInt(n/10);i.length===a&&(i[a]=[]),i[a][n%10]=e[n]}var s=function(e,i){var n=0;e.forEach(function(a){this.getLocation(a.place).done(function(r){var l=t.markerIcon;a.custom_marker_icon&&(l=a.custom_marker_icon);var d=new google.maps.Marker({position:r,map:o,draggable:t.markersDraggable,icon:l,title:""});if(a.hasOwnProperty("info")&&a.info){var c={content:a.info};a.hasOwnProperty("info_max_width")&&a.info_max_width&&(c.maxWidth=a.info_max_width);var p=t.markerInfoDisplay;c.disableAutoPan="always"===p;var g=new google.maps.InfoWindow(c);this.infoWindows.push(g);var h=p;"always"===p&&(h="click",g.open(o,d)),d.addListener(h,function(){g.open(o,d),"always"===p||t.markerInfoMultiple||this.infoWindows.forEach(function(e){e!==g&&e.close()})}.bind(this)),"mouseover"===p&&d.addListener("mouseout",function(){setTimeout(function(){g.close()},100)})}++n===e.length&&i.length&&s(i.shift(),i)}.bind(this))}.bind(this))}.bind(this);s(i.shift(),i)}},showDirections:function(e,o){if(e){e.waypoints&&e.waypoints.length&&e.waypoints.map(function(e){e.stopover=Boolean(e.stopover)});var t=new google.maps.DirectionsRenderer;t.setMap(o);(new google.maps.DirectionsService).route({origin:e.origin,destination:e.destination,travelMode:e.travelMode.toUpperCase(),avoidHighways:e.avoidHighways,avoidTolls:e.avoidTolls,waypoints:e.waypoints,optimizeWaypoints:e.optimizeWaypoints},function(o,i){i===google.maps.DirectionsStatus.OK&&(t.setOptions({preserveViewport:e.preserveViewport}),t.setDirections(o))})}},initMaps:function(){var o=e(".sow-google-map-autocomplete"),t=new e.Deferred;0===o.length?t.resolve():o.each(function(o,i){if(void 0===google.maps.places)return void t.reject('Sorry, we couldn\'t load the "places" library due to another plugin, so the autocomplete feature is not available.');var n=new google.maps.places.Autocomplete(i,{types:["address"]}),a=e(i).siblings(".sow-google-map-canvas");if(a.length>0){var s=a.data("options");s.autocomplete=n,s.autocompleteElement=i,this.getLocation(s.address).done(function(e){this.showMap(a.get(0),e,s),a.data("initialized",!0),t.resolve()}.bind(this)).fail(function(){a.append("<div><p><strong>"+soWidgetsGoogleMap.geocode.noResults+"</strong></p></div>"),t.reject()})}}.bind(this)),t.always(function(){e(".sow-google-map-canvas").each(function(o,t){var i=e(t);if(i.data("initialized"))return!0;var n=i.data("options"),a=n.address;if(!a){var s=n.markerPositions;s&&s.length&&(a=s[0].place)}this.getLocation(a).done(function(e){this.showMap(i.get(0),e,n),i.data("initialized")}.bind(this)).fail(function(){i.append("<div><p><strong>"+soWidgetsGoogleMap.geocode.noResults+"</strong></p></div>")})}.bind(this))}.bind(this)).fail(function(e){console.log(e)})},getGeocoder:function(){return this._geocoder||(this._geocoder=new google.maps.Geocoder),this._geocoder},getLocation:function(o){var t,i=new e.Deferred,n={address:o};if(o&&o.indexOf(",")>-1){var a=o.split(",");a&&2===a.length&&(t=new google.maps.LatLng(a[0],a[1]),isNaN(t.lat())||isNaN(t.lng())||(n={location:{lat:t.lat(),lng:t.lng()}}))}if(n.hasOwnProperty("location"))i.resolve(n.location);else if(n.hasOwnProperty("address")){if(!n.address){var s=parseInt(Math.random()*this.DEFAULT_LOCATIONS.length);n.address=this.DEFAULT_LOCATIONS[s]}var r=function(e,o){o===google.maps.GeocoderStatus.OK?i.resolve(e[0].geometry.location):o===google.maps.GeocoderStatus.OVER_QUERY_LIMIT?setTimeout(function(){this.getGeocoder().geocode.call(this,n,r)}.bind(this),100):o===google.maps.GeocoderStatus.ZERO_RESULTS&&i.reject(o)}.bind(this);this.getGeocoder().geocode(n,r)}return i}}},jQuery(function(e){sowb.setupGoogleMaps=function(){var o,t=[];if(e(".sow-google-map-canvas").each(function(i,n){var a=e(n),s=a.data("options");s&&(void 0!==s.libraries&&null!==s.libraries&&(t=t.concat(s.libraries)),!o&&s.apiKey&&(o=s.apiKey))}),void 0!==window.google&&void 0!==window.google.maps)soGoogleMapInitialize();else{var i="https://maps.googleapis.com/maps/api/js?callback=soGoogleMapInitialize";if(t&&t.length&&(i+="&libraries="+t.join(",")),o&&(i+="&key="+o),window.console&&window.console.error){var n=window.console.error;sowb.onLoadMapsApiError=function(o){var t=o.match(/^Google Maps API (error|warning): ([^\s]*)\s([^\s]*)(?:\s(.*))?/);t&&t.length&&t[0]&&e(".sow-google-map-canvas").each(function(o,t){var i=e(t);if(i.data("fallbackImage")){var n=i.data("fallbackImage");n.hasOwnProperty("img")&&i.append(n.img)}}),n.apply(window.console,arguments)},window.console.error=sowb.onLoadMapsApiError}e("body").append('<script async type="text/javascript" src="'+i+'">')}},sowb.setupGoogleMaps(),e(sowb).on("setup_widgets",sowb.setupGoogleMaps)}),window.sowb=sowb;
js/sow.jquery.fittext.js CHANGED
@@ -1,68 +1,71 @@
1
- /*global jQuery, sowb */
2
- /*!
3
- * FitText.js 1.2
4
- *
5
- * Copyright 2011, Dave Rupert http://daverupert.com
6
- * Released under the WTFPL license
7
- * http://sam.zoy.org/wtfpl/
8
- *
9
- * Date: Thu May 05 14:23:00 2011 -0600
10
- */
11
- var sowb = window.sowb || {};
12
-
13
- (function ($) {
14
-
15
- $.fn.fitText = function (kompressor, options) {
16
-
17
- // Setup options
18
- var compressor = kompressor || 1,
19
- settings = $.extend({
20
- 'minFontSize': Number.NEGATIVE_INFINITY,
21
- 'maxFontSize': Number.POSITIVE_INFINITY
22
- }, options);
23
-
24
- return this.each(function () {
25
-
26
- // Store the object
27
- var $this = $(this);
28
-
29
- // Resizer() resizes items based on the object width divided by the compressor * 10
30
- var resizer = function () {
31
- $this.css('font-size', Math.max(Math.min($this.width() / (compressor * 10), parseFloat(settings.maxFontSize)), parseFloat(settings.minFontSize)));
32
- };
33
-
34
- // Call once to set.
35
- resizer();
36
-
37
- // Call on resize. Opera debounces their resize by default.
38
- $(window).on('resize.fittext orientationchange.fittext', resizer);
39
-
40
- });
41
- };
42
- })(jQuery);
43
-
44
- jQuery( function( $ ){
45
-
46
- // Apply FitText to all Widgets Bundle FitText wrappers
47
- sowb.runFitText = function () {
48
- $( '.so-widget-fittext-wrapper' ).each( function() {
49
- var fitTextWrapper = $( this );
50
-
51
- var compressor = fitTextWrapper.data( 'fitTextCompressor' ) || 0.85;
52
- fitTextWrapper.find( 'h1,h2,h3,h4,h5,h6' ).each( function () {
53
- var $ = $( this );
54
- $.fitText( compressor, {
55
- maxFontSize: $.css( 'font-size' )
56
- } );
57
- } );
58
- fitTextWrapper.data( 'fitTextDone', true );
59
- fitTextWrapper.trigger( 'fitTextDone' );
60
- });
61
- };
62
-
63
- $( sowb ).on( 'setup_widgets', sowb.runFitText );
64
-
65
- sowb.runFitText();
66
- } );
67
-
68
- window.sowb = sowb;
1
+ /*global jQuery, sowb */
2
+ /*!
3
+ * FitText.js 1.2
4
+ *
5
+ * Copyright 2011, Dave Rupert http://daverupert.com
6
+ * Released under the WTFPL license
7
+ * http://sam.zoy.org/wtfpl/
8
+ *
9
+ * Date: Thu May 05 14:23:00 2011 -0600
10
+ */
11
+ var sowb = window.sowb || {};
12
+
13
+ (function ($) {
14
+
15
+ $.fn.fitText = function (kompressor, options) {
16
+
17
+ // Setup options
18
+ var compressor = kompressor || 1,
19
+ settings = $.extend({
20
+ 'minFontSize': Number.NEGATIVE_INFINITY,
21
+ 'maxFontSize': Number.POSITIVE_INFINITY
22
+ }, options);
23
+
24
+ return this.each(function () {
25
+
26
+ // Store the object
27
+ var $this = $(this);
28
+
29
+ // Resizer() resizes items based on the object width divided by the compressor * 10
30
+ var resizer = function () {
31
+ $this.css('font-size', Math.max(Math.min($this.width() / (compressor * 10), parseFloat(settings.maxFontSize)), parseFloat(settings.minFontSize)));
32
+ };
33
+
34
+ // Call once to set.
35
+ resizer();
36
+
37
+ // Call on resize. Opera debounces their resize by default.
38
+ $(window).on('resize.fittext orientationchange.fittext', resizer);
39
+
40
+ });
41
+ };
42
+ })(jQuery);
43
+
44
+ jQuery( function( $ ){
45
+
46
+ // Apply FitText to all Widgets Bundle FitText wrappers
47
+ sowb.runFitText = function () {
48
+ $( '.so-widget-fittext-wrapper' ).each( function() {
49
+ var fitTextWrapper = $( this );
50
+ if ( ! fitTextWrapper.is( ':visible' ) || fitTextWrapper.data( 'fitTextDone' ) ) {
51
+ return fitTextWrapper;
52
+ }
53
+ $( window ).off( 'resize.fittext orientationchange.fittext' );
54
+ var compressor = fitTextWrapper.data( 'fitTextCompressor' ) || 0.85;
55
+ fitTextWrapper.find( 'h1,h2,h3,h4,h5,h6' ).each( function () {
56
+ var $ = $( this );
57
+ $.fitText( compressor, {
58
+ maxFontSize: $.css( 'font-size' )
59
+ } );
60
+ } );
61
+ fitTextWrapper.data( 'fitTextDone', true );
62
+ fitTextWrapper.trigger( 'fitTextDone' );
63
+ });
64
+ };
65
+
66
+ $( sowb ).on( 'setup_widgets', sowb.runFitText );
67
+
68
+ sowb.runFitText();
69
+ } );
70
+
71
+ window.sowb = sowb;
js/sow.jquery.fittext.min.js CHANGED
@@ -1 +1 @@
1
- var sowb=window.sowb||{};!function(t){t.fn.fitText=function(i,n){var e=i||1,o=t.extend({minFontSize:Number.NEGATIVE_INFINITY,maxFontSize:Number.POSITIVE_INFINITY},n);return this.each(function(){var i=t(this),n=function(){i.css("font-size",Math.max(Math.min(i.width()/(10*e),parseFloat(o.maxFontSize)),parseFloat(o.minFontSize)))};n(),t(window).on("resize.fittext orientationchange.fittext",n)})}}(jQuery),jQuery(function(t){sowb.runFitText=function(){t(".so-widget-fittext-wrapper").each(function(){var i=t(this),n=i.data("fitTextCompressor")||.85;i.find("h1,h2,h3,h4,h5,h6").each(function(){var i=t(this);i.fitText(n,{maxFontSize:i.css("font-size")})}),i.data("fitTextDone",!0),i.trigger("fitTextDone")})},t(sowb).on("setup_widgets",sowb.runFitText),sowb.runFitText()}),window.sowb=sowb;
1
+ var sowb=window.sowb||{};!function(t){t.fn.fitText=function(i,e){var n=i||1,o=t.extend({minFontSize:Number.NEGATIVE_INFINITY,maxFontSize:Number.POSITIVE_INFINITY},e);return this.each(function(){var i=t(this),e=function(){i.css("font-size",Math.max(Math.min(i.width()/(10*n),parseFloat(o.maxFontSize)),parseFloat(o.minFontSize)))};e(),t(window).on("resize.fittext orientationchange.fittext",e)})}}(jQuery),jQuery(function(t){sowb.runFitText=function(){t(".so-widget-fittext-wrapper").each(function(){var i=t(this);if(!i.is(":visible")||i.data("fitTextDone"))return i;t(window).off("resize.fittext orientationchange.fittext");var e=i.data("fitTextCompressor")||.85;i.find("h1,h2,h3,h4,h5,h6").each(function(){var i=t(this);i.fitText(e,{maxFontSize:i.css("font-size")})}),i.data("fitTextDone",!0),i.trigger("fitTextDone")})},t(sowb).on("setup_widgets",sowb.runFitText),sowb.runFitText()}),window.sowb=sowb;
lang/so-widgets-bundle.pot CHANGED
@@ -3,2950 +3,2953 @@
3
msgid ""
4
msgstr ""
5
"Project-Id-Version: so-widgets-bundle\n"
6
- "Report-Msgid-Bugs-To: http://www.siteorigin.com\n"
7
"MIME-Version: 1.0\n"
8
"Content-Type: text/plain; charset=UTF-8\n"
9
"Content-Transfer-Encoding: 8bit\n"
10
- "PO-Revision-Date: 2018-MO-DA HO:MI+ZONE\n"
11
- "Last-Translator: SiteOrigin <support@siteorigin.com>\n"
12
"Language-Team: SiteOrigin <support@siteorigin.com>\n"
13
"X-Poedit-Basepath: ..\n"
14
- "X-Poedit-SourceCharset: UTF-8\n"
15
- "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
16
"X-Poedit-SearchPath-0: .\n"
17
"X-Poedit-SearchPathExcluded-0: *.js\n"
18
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
19
20
- #: tmp/admin/tpl/admin.php:17, tmp/so-widgets-bundle.php:399
21
msgid "SiteOrigin Widgets Bundle"
22
msgstr ""
23
24
- #: tmp/admin/tpl/admin.php:23
25
msgid "Filter Widgets"
26
msgstr ""
27
28
- #: tmp/admin/tpl/admin.php:33, tmp/base/inc/fields/posts.class.php:12, tmp/widgets/google-map/google-map.php:673
29
msgid "All"
30
msgstr ""
31
32
- #: tmp/admin/tpl/admin.php:35
33
msgid "Enabled"
34
msgstr ""
35
36
- #: tmp/admin/tpl/admin.php:37
37
msgid "Disabled"
38
msgstr ""
39
40
- #: tmp/admin/tpl/admin.php:95
41
msgid "Active"
42
msgstr ""
43
44
- #: tmp/admin/tpl/admin.php:139
45
msgid "Activate"
46
msgstr ""
47
48
- #: tmp/admin/tpl/admin.php:141
49
msgid "Deactivate"
50
msgstr ""
51
52
- #: tmp/admin/tpl/admin.php:179, tmp/widgets/contact/contact.php:115, tmp/widgets/google-map/google-map.php:125, tmp/widgets/testimonial/testimonial.php:197
53
msgid "Settings"
54
msgstr ""
55
56
- #: tmp/admin/tpl/admin.php:207
57
msgid "Developers - create your own widgets for the Widgets Bundle."
58
msgstr ""
59
60
- #: tmp/admin/tpl/admin.php:209
61
msgid "Read More"
62
msgstr ""
63
64
- #: tmp/admin/tpl/admin.php:223
65
msgid "Widget Settings"
66
msgstr ""
67
68
- #: tmp/admin/tpl/admin.php:245
69
msgid "Save"
70
msgstr ""
71
72
- #: tmp/base/inc/actions.php:19, tmp/base/inc/actions.php:149, tmp/base/inc/actions.php:237, tmp/base/inc/actions.php:309, tmp/base/inc/actions.php:335, tmp/base/inc/actions.php:343, tmp/base/inc/actions.php:525, tmp/base/inc/actions.php:531, tmp/so-widgets-bundle.php:739, tmp/so-widgets-bundle.php:787, tmp/so-widgets-bundle.php:813, tmp/so-widgets-bundle.php:873, tmp/so-widgets-bundle.php:895, tmp/so-widgets-bundle.php:1027, tmp/so-widgets-bundle.php:1049
73
msgid "Invalid request."
74
msgstr ""
75
76
- #: tmp/base/inc/actions.php:23, tmp/base/inc/actions.php:39, tmp/so-widgets-bundle.php:753, tmp/so-widgets-bundle.php:1039
77
msgid "Invalid post."
78
msgstr ""
79
80
- #: tmp/base/inc/actions.php:99, tmp/base/siteorigin-widget.class.php:1273
81
msgid "Widget Preview"
82
msgstr ""
83
84
- #: tmp/base/inc/actions.php:421
85
msgid "Nonce error"
86
msgstr ""
87
88
- #: tmp/base/inc/actions.php:441
89
msgid "Signature error"
90
msgstr ""
91
92
- #: tmp/base/inc/actions.php:493
93
msgid "Attachment error"
94
msgstr ""
95
96
- #: tmp/base/inc/fields/autocomplete.class.php:46
97
msgid "Search"
98
msgstr ""
99
100
- #: tmp/base/inc/fields/autocomplete.class.php:51, tmp/base/inc/fields/link.class.php:30
101
msgid "Close"
102
msgstr ""
103
104
- #: tmp/base/inc/fields/base.class.php:328
105
msgid "Optional"
106
msgstr ""
107
108
- #: tmp/base/inc/fields/base.class.php:331
109
msgid "Required"
110
msgstr ""
111
112
- #: tmp/base/inc/fields/builder.class.php:36
113
msgid "This field requires: "
114
msgstr ""
115
116
- #: tmp/base/inc/fields/builder.class.php:37, tmp/widgets/layout-slider/layout-slider.php:197
117
msgid "SiteOrigin Page Builder"
118
msgstr ""
119
120
- #: tmp/base/inc/fields/date-range.class.php:61
121
msgctxt "From this date"
122
msgid "From"
123
msgstr ""
124
125
- #: tmp/base/inc/fields/date-range.class.php:67, tmp/base/inc/fields/date-range.class.php:95
126
msgid "to"
127
msgstr ""
128
129
- #: tmp/base/inc/fields/date-range.class.php:89
130
msgid "From"
131
msgstr ""
132
133
- #: tmp/base/inc/fields/date-range.class.php:127
134
msgid "ago"
135
msgstr ""
136
137
- #: tmp/base/inc/fields/date-range.class.php:137
138
msgid "days"
139
msgstr ""
140
141
- #: tmp/base/inc/fields/date-range.class.php:139
142
msgid "weeks"
143
msgstr ""
144
145
- #: tmp/base/inc/fields/date-range.class.php:141
146
msgid "months"
147
msgstr ""
148
149
- #: tmp/base/inc/fields/date-range.class.php:143
150
msgid "years"
151
msgstr ""
152
153
- #: tmp/base/inc/fields/error.class.php:20
154
msgid "$this->message"
155
msgstr ""
156
157
- #: tmp/base/inc/fields/factory.class.php:22
158
msgid "This field does not have a type. Please specify a type for it to be rendered correctly."
159
msgstr ""
160
161
- #: tmp/base/inc/fields/font.class.php:33
162
msgid "Use theme font"
163
msgstr ""
164
165
- #: tmp/base/inc/fields/icon.class.php:26
166
msgid "Choose Icon"
167
msgstr ""
168
169
- #: tmp/base/inc/fields/icon.class.php:29, tmp/base/inc/fields/media.class.php:111
170
msgid "Remove"
171
msgstr ""
172
173
- #: tmp/base/inc/fields/image-size.class.php:14
174
msgid "Full"
175
msgstr ""
176
177
- #: tmp/base/inc/fields/image-size.class.php:15
178
msgid "Thumbnail (Theme-defined)"
179
msgstr ""
180
181
- #: tmp/base/inc/fields/link.class.php:20
182
msgid "Select Content"
183
msgstr ""
184
185
- #: tmp/base/inc/fields/link.class.php:25
186
msgid "Search Content"
187
msgstr ""
188
189
- #: tmp/base/inc/fields/media.class.php:60
190
msgid "Choose Media"
191
msgstr ""
192
193
- #: tmp/base/inc/fields/media.class.php:61
194
msgid "Set Media"
195
msgstr ""
196
197
- #: tmp/base/inc/fields/media.class.php:62
198
msgid "Image Search"
199
msgstr ""
200
201
- #: tmp/base/inc/fields/media.class.php:69
202
msgid "You need to <a href=\"%s\">upgrade</a> to WordPress 3.5 to use media fields"
203
msgstr ""
204
205
- #: tmp/base/inc/fields/media.class.php:123
206
msgid "External URL"
207
msgstr ""
208
209
- #: tmp/base/inc/fields/media.class.php:168
210
msgid "Would you like to import this image into your media library?"
211
msgstr ""
212
213
- #: tmp/base/inc/fields/media.class.php:172, tmp/base/inc/fields/media.class.php:180
214
msgid "Search For Images"
215
msgstr ""
216
217
- #: tmp/base/inc/fields/media.class.php:187
218
msgid "Related Searches: "
219
msgstr ""
220
221
- #: tmp/base/inc/fields/media.class.php:194
222
msgid "Powered by %s"
223
msgstr ""
224
225
- #: tmp/base/inc/fields/media.class.php:205
226
msgid "Loading Images"
227
msgstr ""
228
229
- #: tmp/base/inc/fields/media.class.php:206
230
msgid "Downloading Image - Please Wait"
231
msgstr ""
232
233
- #: tmp/base/inc/fields/media.class.php:209
234
msgid "Load More"
235
msgstr ""
236
237
- #: tmp/base/inc/fields/media.class.php:228
238
msgid "Sponsored"
239
msgstr ""
240
241
- #: tmp/base/inc/fields/multi-measurement.class.php:12
242
- msgid "Padding left"
243
- msgstr ""
244
-
245
- #: tmp/base/inc/fields/multi-measurement.class.php:15
246
- msgid "Padding right"
247
- msgstr ""
248
-
249
- #: tmp/base/inc/fields/multi-measurement.class.php:16
250
- msgid "Padding bottom"
251
- msgstr ""
252
-
253
- #: tmp/base/inc/fields/multi-measurement.class.php:17
254
- msgid "Padding top"
255
- msgstr ""
256
-
257
- #: tmp/base/inc/fields/posts.class.php:22
258
msgid "Post type"
259
msgstr ""
260
261
- #: tmp/base/inc/fields/posts.class.php:30
262
msgid "Post in"
263
msgstr ""
264
265
- #: tmp/base/inc/fields/posts.class.php:36, tmp/widgets/taxonomy/taxonomy.php:37
266
msgid "Taxonomies"
267
msgstr ""
268
269
- #: tmp/base/inc/fields/posts.class.php:42
270
msgid "Date selection type"
271
msgstr ""
272
273
- #: tmp/base/inc/fields/posts.class.php:44
274
msgid "Specific"
275
msgstr ""
276
277
- #: tmp/base/inc/fields/posts.class.php:45
278
msgid "Relative"
279
msgstr ""
280
281
- #: tmp/base/inc/fields/posts.class.php:47
282
msgid "Select a range between specific dates or relative to the current date."
283
msgstr ""
284
285
- #: tmp/base/inc/fields/posts.class.php:57, tmp/base/inc/fields/posts.class.php:67
286
msgid "Dates"
287
msgstr ""
288
289
- #: tmp/base/inc/fields/posts.class.php:77
290
msgid "Order by"
291
msgstr ""
292
293
- #: tmp/base/inc/fields/posts.class.php:79
294
msgid "No order"
295
msgstr ""
296
297
- #: tmp/base/inc/fields/posts.class.php:80
298
msgid "Post ID"
299
msgstr ""
300
301
- #: tmp/base/inc/fields/posts.class.php:81
302
msgid "Author"
303
msgstr ""
304
305
- #: tmp/base/inc/fields/posts.class.php:82, tmp/widgets/accordion/accordion.php:46, tmp/widgets/accordion/accordion.php:59, tmp/widgets/contact/contact.php:93, tmp/widgets/cta/cta.php:125, tmp/widgets/editor/editor.php:63, tmp/widgets/features/features.php:263, tmp/widgets/post-carousel/post-carousel.php:97, tmp/widgets/price-table/price-table.php:41, tmp/widgets/price-table/price-table.php:60, tmp/widgets/simple-masonry/simple-masonry.php:43, tmp/widgets/simple-masonry/simple-masonry.php:74, tmp/widgets/social-media-buttons/social-media-buttons.php:105, tmp/widgets/tabs/tabs.php:46, tmp/widgets/tabs/tabs.php:59, tmp/widgets/taxonomy/taxonomy.php:33, tmp/widgets/testimonial/testimonial.php:79, tmp/widgets/video/video.php:32
306
msgid "Title"
307
msgstr ""
308
309
- #: tmp/base/inc/fields/posts.class.php:83
310
msgid "Published date"
311
msgstr ""
312
313
- #: tmp/base/inc/fields/posts.class.php:84
314
msgid "Modified date"
315
msgstr ""
316
317
- #: tmp/base/inc/fields/posts.class.php:85
318
msgid "By parent"
319
msgstr ""
320
321
- #: tmp/base/inc/fields/posts.class.php:86
322
msgid "Random order"
323
msgstr ""
324
325
- #: tmp/base/inc/fields/posts.class.php:87
326
msgid "Comment count"
327
msgstr ""
328
329
- #: tmp/base/inc/fields/posts.class.php:88
330
msgid "Menu order"
331
msgstr ""
332
333
- #: tmp/base/inc/fields/posts.class.php:89
334
msgid "By meta value"
335
msgstr ""
336
337
- #: tmp/base/inc/fields/posts.class.php:90
338
msgid "By numeric meta value"
339
msgstr ""
340
341
- #: tmp/base/inc/fields/posts.class.php:91
342
msgid "By include order"
343
msgstr ""
344
345
- #: tmp/base/inc/fields/posts.class.php:98
346
msgid "Order direction"
347
msgstr ""
348
349
- #: tmp/base/inc/fields/posts.class.php:100
350
msgid "Ascending"
351
msgstr ""
352
353
- #: tmp/base/inc/fields/posts.class.php:101
354
msgid "Descending"
355
msgstr ""
356
357
- #: tmp/base/inc/fields/posts.class.php:108
358
msgid "Posts per page"
359
msgstr ""
360
361
- #: tmp/base/inc/fields/posts.class.php:113
362
msgid "Sticky posts"
363
msgstr ""
364
365
- #: tmp/base/inc/fields/posts.class.php:115, tmp/compat/beaver-builder/beaver-builder.php:129, tmp/widgets/google-map/google-map.php:537, tmp/widgets/image/image.php:91, tmp/widgets/image/image.php:115
366
msgid "Default"
367
msgstr ""
368
369
- #: tmp/base/inc/fields/posts.class.php:116
370
msgid "Ignore sticky"
371
msgstr ""
372
373
- #: tmp/base/inc/fields/posts.class.php:117
374
msgid "Exclude sticky"
375
msgstr ""
376
377
- #: tmp/base/inc/fields/posts.class.php:118
378
msgid "Only sticky"
379
msgstr ""
380
381
- #: tmp/base/inc/fields/posts.class.php:124
382
msgid "Additional"
383
msgstr ""
384
385
- #: tmp/base/inc/fields/posts.class.php:125
386
msgid "Additional query arguments. See <a href=\"http://codex.wordpress.org/Function_Reference/query_posts\" target=\"_blank\" rel=\"noopener noreferrer\">query_posts</a>."
387
msgstr ""
388
389
- #: tmp/base/inc/fields/presets.class.php:18
390
msgid "Warning! This will override some or all of the current form values."
391
msgstr ""
392
393
- #: tmp/base/inc/fields/presets.class.php:48
394
msgid "Undo"
395
msgstr ""
396
397
- #: tmp/base/inc/fields/repeater.class.php:54
398
msgid "Item"
399
msgstr ""
400
401
- #: tmp/base/inc/fields/repeater.class.php:93
402
msgid "Add"
403
msgstr ""
404
405
- #: tmp/base/inc/fields/widget.class.php:37
406
msgid "%s does not exist"
407
msgstr ""
408
409