This repository has been archived on 2023-08-16. You can view files and clone it, but cannot push or open issues or pull requests.
Omphaloskepsis/plugins/jetpack/modules/widgets/google-plus/js/admin.js

23 lines
623 B
JavaScript
Raw Permalink Normal View History

2018-03-21 18:19:20 +00:00
(function($) {
// For when adding widget via customizer
$( document ).on( 'widget-added', function() {
toggle_items();
});
$(function(){
$( document ).on( 'change', '.googleplus-badge-choose-type', toggle_items )
.on( 'widget-updated', toggle_items );
toggle_items();
});
function toggle_items() {
$( '.widget-inside .googleplus-badge-choose-type' ).each( function(){
var $widget_form = $( this ).parents( 'form' );
$widget_form.find( '[class^="googleplus-badge-only-"]' ).parent().hide();
$widget_form.find( '.googleplus-badge-only-' + $( this ).val() ).parent().show();
});
}
})(jQuery);