components/blockly-src/blocks/text.js
function(isAt) {
    // Destroy old 'AT' and 'ORDINAL' inputs.
    this.removeInput('AT');
    this.removeInput('ORDINAL', true);
    // Create either a value 'AT' input or a dummy input.
    if (isAt) {
      this.appendValueInput('AT').setCheck('Number');
      if (Blockly.Msg.ORDINAL_NUMBER_SUFFIX) {
        this.appendDummyInput('ORDINAL')
            .appendField(Blockly.Msg.ORDINAL_NUMBER_SUFFIX);
      }
    } else {
      this.appendDummyInput('AT');
    }
    if (Blockly.Msg.TEXT_CHARAT_TAIL) {
      this.removeInput('TAIL', true);
      this.appendDummyInput('TAIL')
          .appendField(Blockly.Msg.TEXT_CHARAT_TAIL);
    }
    var menu = new Blockly.FieldDropdown(this.WHERE_OPTIONS, function(value) {
      var newAt = (value == 'FROM_START') || (value == 'FROM_END');
      // The 'isAt' variable is available due to this function being a closure.
      if (newAt != isAt) {
        var block = this.sourceBlock_;
        block.updateAt_(newAt);
        // This menu has been destroyed and replaced.  Update the replacement.
        block.setFieldValue(value, 'WHERE');
        return null;
      }
      return undefined;
    });
    this.getInput('AT').appendField(menu, 'WHERE');
  }
function(isAt) {
    // Destroy old 'AT' and 'ORDINAL' inputs.
    this.removeInput('AT');
    this.removeInput('ORDINAL', true);
    // Create either a value 'AT' input or a dummy input.
    if (isAt) {
      this.appendValueInput('AT').setCheck('Number');
      if (Blockly.Msg.ORDINAL_NUMBER_SUFFIX) {
        this.appendDummyInput('ORDINAL')
            .appendField(Blockly.Msg.ORDINAL_NUMBER_SUFFIX);
      }
    } else {
      this.appendDummyInput('AT');
    }
    if (Blockly.Msg.TEXT_CHARAT_TAIL) {
      this.removeInput('TAIL', true);
      this.appendDummyInput('TAIL')
          .appendField(Blockly.Msg.TEXT_CHARAT_TAIL);
    }
    var menu = new Blockly.FieldDropdown(this.WHERE_OPTIONS, function(value) {
      var newAt = (value == 'FROM_START') || (value == 'FROM_END');
      // The 'isAt' variable is available due to this function being a closure.
      if (newAt != isAt) {
        var block = this.sourceBlock_;
        block.updateAt_(newAt);
        // This menu has been destroyed and replaced.  Update the replacement.
        block.setFieldValue(value, 'WHERE');
        return null;
      }
      return undefined;
    });
    this.getInput('AT').appendField(menu, 'WHERE');
  }
function ( isAt ) { // Destroy old 'AT' and 'ORDINAL' inputs. this . removeInput ( 'AT' ) ; this . removeInput ( 'ORDINAL' , true ) ; // Create either a value 'AT' input or a dummy input. if ( isAt ) { this . appendValueInput ( 'AT' ) . setCheck ( 'Number' ) ; if ( Blockly . Msg . ORDINAL_NUMBER_SUFFIX ) { this . appendDummyInput ( 'ORDINAL' ) . appendField ( Blockly . Msg . ORDINAL_NUMBER_SUFFIX ) ; } } else { this . appendDummyInput ( 'AT' ) ; } if ( Blockly . Msg . TEXT_CHARAT_TAIL ) { this . removeInput ( 'TAIL' , true ) ; this . appendDummyInput ( 'TAIL' ) . appendField ( Blockly . Msg . TEXT_CHARAT_TAIL ) ; } var menu = new Blockly . FieldDropdown ( this . WHERE_OPTIONS , function ( value ) { var newAt = ( value == 'FROM_START' ) || ( value == 'FROM_END' ) ; // The 'isAt' variable is available due to this function being a closure. if ( newAt != isAt ) { var block = this . sourceBlock_ ; block . updateAt_ ( newAt ) ; // This menu has been destroyed and replaced.  Update the replacement. block . setFieldValue ( value , 'WHERE' ) ; return null ; } return undefined ; } ) ; this . getInput ( 'AT' ) . appendField ( menu , 'WHERE' ) ; }
Create or delete an input for the numeric index.
@param {boolean} isAt True if the input should exist.
@private
@this Blockly.Block
Create or delete an input for the numeric index .