summaryrefslogtreecommitdiff
blob: a27c2def607a7d80ff5c7114b326b776030c4b00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
(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);