function checkIfActive(
    targetControl,
    targetHeaderControl,
    containerTypeControl,
    addButtonControl
  ) {
    $(targetControl).each(function(el) {
      if ($(this).prop('checked')) {
        if (!$(targetHeaderControl).hasClass('semi-checked')) {
          $(targetHeaderControl).addClass('semi-checked')
          $(targetHeaderControl).prop('checked', false)
          if (containerTypeControl.hasClass('source')) {
            $(addButtonControl).addClass('active')
          }
          if (containerTypeControl.hasClass('target')) {
            $(inverseButton).addClass('active')
          }
        }
        return false
      } else {
        $(targetHeaderControl).removeClass('semi-checked')
        if (containerTypeControl.hasClass('source')) {
          $(addButtonControl).removeClass('active')
        }
        if (containerTypeControl.hasClass('target')) {
          $(inverseButton).removeClass('active')
        }
      }
    })
  }
function checkIfActive(
    targetControl,
    targetHeaderControl,
    containerTypeControl,
    addButtonControl
  ) {
    $(targetControl).each(function(el) {
      if ($(this).prop('checked')) {
        if (!$(targetHeaderControl).hasClass('semi-checked')) {
          $(targetHeaderControl).addClass('semi-checked')
          $(targetHeaderControl).prop('checked', false)
          if (containerTypeControl.hasClass('source')) {
            $(addButtonControl).addClass('active')
          }
          if (containerTypeControl.hasClass('target')) {
            $(inverseButton).addClass('active')
          }
        }
        return false
      } else {
        $(targetHeaderControl).removeClass('semi-checked')
        if (containerTypeControl.hasClass('source')) {
          $(addButtonControl).removeClass('active')
        }
        if (containerTypeControl.hasClass('target')) {
          $(inverseButton).removeClass('active')
        }
      }
    })
  }
function checkIfActive ( targetControl , targetHeaderControl , containerTypeControl , addButtonControl ) { $ ( targetControl ) . each ( function ( el ) { if ( $ ( this ) . prop ( 'checked' ) ) { if ( ! $ ( targetHeaderControl ) . hasClass ( 'semi-checked' ) ) { $ ( targetHeaderControl ) . addClass ( 'semi-checked' ) $ ( targetHeaderControl ) . prop ( 'checked' , false ) if ( containerTypeControl . hasClass ( 'source' ) ) { $ ( addButtonControl ) . addClass ( 'active' ) } if ( containerTypeControl . hasClass ( 'target' ) ) { $ ( inverseButton ) . addClass ( 'active' ) } } return false } else { $ ( targetHeaderControl ) . removeClass ( 'semi-checked' ) if ( containerTypeControl . hasClass ( 'source' ) ) { $ ( addButtonControl ) . removeClass ( 'active' ) } if ( containerTypeControl . hasClass ( 'target' ) ) { $ ( inverseButton ) . removeClass ( 'active' ) } } } ) }
control active check & header check
control active check & header check