PluginProbe
Automatic YouTube Gallery – Embed Auto-Updating YouTube Video Galleries, Feeds, Playlists & Channels / 2.3.8
Automatic YouTube Gallery – Embed Auto-Updating YouTube Video Galleries, Feeds, Playlists & Channels v2.3.8
2.9.1 2.9.0 trunk 1.0.0 1.1.0 1.2.0 1.3.0 1.4.0 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 2.0.0 2.1.0 2.2.0 2.3.2 2.3.3 2.3.5 2.3.6 2.3.8 2.3.9 2.4.3 All 37 releases
← All changes | admin/assets/js/admin.js +28 -42 2.1.0 → 2.3.8 View file →
@@ -133,8 +133,11 @@
133 133 *
134 134 * @since 1.0.0
135 135 */
136 136 $(function() {
137 + // Common: Initialize the color picker
138 + $( '.ayg-color-picker' ).wpColorPicker();
139 +
137 140 // Dashboard: Save API Key
138 141 $( '#ayg-button-save-api-key' ).on( 'click', function( e ) {
139 142 e.preventDefault();
140 143
@@ -287,11 +290,21 @@
287 290
288 291 $elem.addClass( 'ayg-editor-field-theme-' + theme );
289 292 });
290 293
291 - // Settings: Initialize the color picker
292 - $( '.ayg-color-picker', '#ayg-settings' ).wpColorPicker();
294 + // Editor: Show/Hide fields based on the selected pagination type
295 + $( document ).on( 'change', '.ayg-editor-field-pagination_type', function( e ) {
296 + var pagination_type = $( this ).val();
297 + var $elem = $( this ).closest( '.ayg-editor' );
293 298
299 + $elem.removeClass(function( index, classes ) {
300 + var matches = classes.match( /\ayg-editor-field-pagination_type-\S+/ig );
301 + return ( matches ) ? matches.join(' ') : '';
302 + });
303 +
304 + $elem.addClass( 'ayg-editor-field-pagination_type-' + pagination_type );
305 + });
306 +
294 307 // Settings: Show/Hide fields based on the selected theme
295 308 $( 'tr.theme', '#ayg-settings' ).find( 'select' ).on( 'change', function() {
296 309 var theme = $( this ).val();
297 310 var $elem = $( '#ayg-settings' );
@@ -303,8 +316,21 @@
303 316
304 317 $elem.addClass( 'ayg-settings-theme-' + theme );
305 318 });
306 319
320 + // Settings: Show/Hide fields based on the selected pagination type
321 + $( 'tr.pagination_type', '#ayg-settings' ).find( 'select' ).on( 'change', function() {
322 + var pagination_type = $( this ).val();
323 + var $elem = $( '#ayg-settings' );
324 +
325 + $elem.removeClass(function( index, classes ) {
326 + var matches = classes.match( /\ayg-settings-pagination_type-\S+/ig );
327 + return ( matches ) ? matches.join(' ') : '';
328 + });
329 +
330 + $elem.addClass( 'ayg-settings-pagination_type-' + pagination_type );
331 + });
332 +
307 333 // Settings: Browse button
308 334 $( '.ayg-settings-browse' ).on( 'click', function( e ) {
309 335 e.preventDefault();
310 336 ayg_render_media_uploader( $( this ) );
@@ -333,47 +359,7 @@
333 359 ayg_widget_color_picker( $( this ) );
334 360 });
335 361
336 362 $( document ).on( 'widget-added widget-updated', on_ayg_widget_update );
337 -
338 - // Gutenberg: Toggle fields or panels based on the selected source type
339 - if ( 'undefined' !== typeof wp && 'undefined' !== typeof wp['hooks'] ) {
340 - wp.hooks.addFilter( 'ayg_block_toggle_controls', 'automatic-youtube-gallery/block', function( value, control, attributes ) {
341 - switch ( control ) {
342 - case 'channel':
343 - if ( 'livestream' == attributes.type ) {
344 - value = true;
345 - }
346 - break;
347 - case 'cache':
348 - case 'player_title':
349 - case 'player_description':
350 - case 'loop':
351 - if ( 'livestream' == attributes.type ) {
352 - value = false;
353 - }
354 - break;
355 - case 'autoadvance':
356 - if ( 'video' == attributes.type || 'livestream' == attributes.type ) {
357 - value = false;
358 - }
359 - break;
360 - }
361 -
362 - return value;
363 - });
364 -
365 - wp.hooks.addFilter( 'ayg_block_toggle_panels', 'automatic-youtube-gallery/block', function( value, panel, attributes ) {
366 - switch ( panel ) {
367 - case 'gallery':
368 - if ( 'livestream' == attributes.type ) {
369 - value = false;
370 - }
371 - break;
372 - }
373 -
374 - return value;
375 - });
376 - }
377 363 });
378 364
379 365 })( jQuery );