admin.js 623 B

12345678910111213141516171819202122
  1. (function($) {
  2. // For when adding widget via customizer
  3. $( document ).on( 'widget-added', function() {
  4. toggle_items();
  5. });
  6. $(function(){
  7. $( document ).on( 'change', '.googleplus-badge-choose-type', toggle_items )
  8. .on( 'widget-updated', toggle_items );
  9. toggle_items();
  10. });
  11. function toggle_items() {
  12. $( '.widget-inside .googleplus-badge-choose-type' ).each( function(){
  13. var $widget_form = $( this ).parents( 'form' );
  14. $widget_form.find( '[class^="googleplus-badge-only-"]' ).parent().hide();
  15. $widget_form.find( '.googleplus-badge-only-' + $( this ).val() ).parent().show();
  16. });
  17. }
  18. })(jQuery);