File tree Expand file tree Collapse file tree 2 files changed +30
-2
lines changed
classes/Visualizer/Module Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -110,8 +110,10 @@ public function renderChart( $atts ) {
110
110
}
111
111
112
112
$ id = 'visualizer- ' . $ atts ['id ' ];
113
+ $ defaultClass = "visualizer-front " ;
113
114
$ class = apply_filters ( Visualizer_Plugin::FILTER_CHART_WRAPPER_CLASS , $ atts ['class ' ], $ atts ['id ' ] );
114
- $ class = !empty ( $ class ) ? ' class=" ' . $ class . '" ' : '' ;
115
+ $ class = $ defaultClass . " " . $ class ;
116
+ $ class = !empty ( $ class ) ? ' class=" ' . trim ($ class ) . '" ' : '' ;
115
117
116
118
$ type = get_post_meta ( $ chart ->ID , Visualizer_Plugin::CF_CHART_TYPE , true );
117
119
Original file line number Diff line number Diff line change 210
210
clearTimeout ( resizeTimeout ) ;
211
211
resizeTimeout = setTimeout ( v . render , 100 ) ;
212
212
} ) ;
213
- } ) ;
213
+
214
+ resizeHiddenContainers ( ) ;
215
+ } ) ;
216
+
217
+ function resizeHiddenContainers ( ) {
218
+ $ ( ".visualizer-front" ) . parents ( ) . each ( function ( ) {
219
+ if ( ! $ ( this ) . is ( ":visible" ) ) {
220
+ $ ( this ) . addClass ( "visualizer-hidden-container" ) ;
221
+ }
222
+ } ) ;
223
+
224
+ var mutateObserver = new MutationObserver ( function ( records ) {
225
+ records . forEach ( function ( record ) {
226
+ if ( record . attributeName == "style" ) {
227
+ var element = $ ( record . target ) ;
228
+ var displayStyle = window . getComputedStyle ( element [ 0 ] ) . getPropertyValue ( "display" ) ;
229
+ if ( element . hasClass ( "visualizer-hidden-container-resized" ) || displayStyle == "none" ) return ;
230
+ element . addClass ( "visualizer-hidden-container-resized" ) . find ( ".visualizer-front" ) . resize ( ) ;
231
+ }
232
+ } ) ;
233
+ } ) ;
234
+
235
+ $ ( '.visualizer-hidden-container' ) . each ( function ( ) {
236
+ mutateObserver . observe ( $ ( this ) [ 0 ] , { attributes : true } ) ;
237
+ } ) ;
238
+ }
239
+
214
240
} ) ( jQuery , visualizer ) ;
You can’t perform that action at this time.
0 commit comments