<commit_before>// Copyright 2002-2013, University of Colorado Boulder

/**
 * Shows the about dialog.
 *
 * @author <NAME>
 */
define( function( require ) {
  'use strict';

  // imports
  var VBox = require( 'SCENERY/nodes/VBox' );
  var Text = require( 'SCENERY/nodes/Text' );
  var inherit = require( 'PHET_CORE/inherit' );
  var MultiLineText = require( 'SCENERY_PHET/MultiLineText' );
  var ScreenView = require( 'JOIST/ScreenView' );
  var Panel = require( 'SUN/Panel' );
  var PhetFont = require( 'SCENERY_PHET/PhetFont' );
  var StringUtils = require( 'PHETCOMMON/util/StringUtils' );
  var VStrut = require( 'SUN/VStrut' );

  // strings
  var phetString = 'PhET Interactive Simulations'; // as in Java sims, do not internationalize
  var copyrightString = 'Copyright © 2004-2014 University of Colorado Boulder'; // as in Java sims, do not internationalize
  var softwareAgreementString = require( 'string!JOIST/softwareAgreement' );
  var softwareLicensingString = require( 'string!JOIST/softwareLicensing' );
  var phetDevelopmentTeamString = require( 'string!JOIST/credits.phetDevelopmentTeam' );
  var leadDesignString = require( 'string!JOIST/credits.leadDesign' );
  var softwareDevelopmentString = require( 'string!JOIST/credits.softwareDevelopment' );
  var designTeamString = require( 'string!JOIST/credits.designTeam' );
  var interviewsString = require( 'string!JOIST/credits.interviews' );
  var graphicArtsString = require( 'string!JOIST/credits.graphicArts' );
  var translationTitleString = require( 'string!JOIST/credits.translation' );
  var thanksTitleString = require( 'string!JOIST/credits.thanks' );

  // constants
  var SOFTWARE_AGREEMENT_URL = 'http://phet.colorado.edu/about/software-agreement_v7.htm';
  var SOFTWARE_LICENSING_URL = 'http://phet.colorado.edu/licensing';

  /**
   * @param {Sim} sim
   * @constructor
   */
  function AboutDialog( sim ) {
    var aboutDialog = this;

    //Use view, to help center and scale content
    //Renderer must be specified here because the AboutDialog is added directly to the scene (instead of to some other node that already has svg renderer)
    ScreenView.call( this, {renderer: 'svg'} );

    var createLink = function( text, url ) {
      var softwareAgreementLink = new Text( text, {
        font: new PhetFont( 14 ),
        fill: 'rgb(27,0,241)', // blue, like a hyperlink
        cursor: 'pointer'
      } );
      softwareAgreementLink.addInputListener( {
        up: function( evt ) {
          evt.handle(); // don't close the dialog
        },
        upImmediate: function( event ) {
          var aboutDialogWindow = window.open( url, '_blank' );
          aboutDialogWindow.focus();
        }
      } );
      return softwareAgreementLink;
    };

    var children = [
      new Text( phetString, { font: new PhetFont( 16 ) } ),
      new Text( copyrightString, { font: new PhetFont( 12 ) } ),
      new VStrut( 15 ),
      new Text( sim.name, { font: new PhetFont( 28 ) } ),
      new Text( 'version ' + sim.version, { font: new PhetFont( 20 ) } )
    ];

    if ( sim.credits ) {
      children.push( new VStrut( 15 ) );
      children.push( createCreditsNode( sim.credits ) );
    }

    children.push( new VStrut( 15 ) );
    children.push( createLink( softwareAgreementString, SOFTWARE_AGREEMENT_URL ) );
    children.push( createLink( softwareLicensingString, SOFTWARE_LICENSING_URL ) );

    var content = new VBox( { align: 'left', spacing: 5, children: children } );

    //Show a gray overlay that will help focus on the about dialog, and prevent clicks on the sim while the dialog is up
    this.addChild( new Panel( content, {centerX: this.layoutBounds.centerX, centerY: this.layoutBounds.centerY, xMargin: 20, yMargin: 20 } ) );

    function resize() {
      aboutDialog.layout( $( window ).width(), $( window ).height() );
    }

    //Fit to the window and render the initial scene
    $( window ).resize( resize );
    resize();
  }

  // Creates node that displays the credits.
  var createCreditsNode = function( credits ) {
    var children = [];
    var titleFont = new PhetFont( { size: 14, weight: 'bold' } );
    var font = new PhetFont( 12 );
    var multiLineTextOptions = { font: font, align: 'left' };
    children.push( new Text( phetDevelopmentTeamString, { font: titleFont } ) );

    if ( credits.leadDesign ) { children.push( new MultiLineText( StringUtils.format( leadDesignString, credits.leadDesign ), multiLineTextOptions ) ); }
    if ( credits.softwareDevelopment ) { children.push( new MultiLineText( StringUtils.format( softwareDevelopmentString, credits.softwareDevelopment ), multiLineTextOptions ) ); }
    if ( credits.designTeam ) { children.push( new MultiLineText( StringUtils.format( designTeamString, credits.designTeam ), multiLineTextOptions ) ); }
    if ( credits.interviews ) { children.push( new MultiLineText( StringUtils.format( interviewsString, credits.interviews ), multiLineTextOptions ) ); }
    if ( credits.graphicArts ) { children.push( new MultiLineText( StringUtils.format( graphicArtsString, credits.graphicArts ), multiLineTextOptions ) ); }
    if ( credits.translation ) {
      if ( children.length > 0 ) { children.push( new Text( ' ', font ) ); }
      children.push( new Text( translationTitleString, { font: titleFont } ) );
      children.push( new MultiLineText( credits.translation, multiLineTextOptions ) );
    }
    if ( credits.thanks ) {
      if ( children.length > 0 ) { children.push( new Text( ' ', font ) ); }
      children.push( new Text( thanksTitleString, { font: titleFont } ) );
      children.push( new MultiLineText( credits.thanks, multiLineTextOptions ) );
    }
    return new VBox( { align: 'left', spacing: 1, children: children } );
  };

  inherit( ScreenView, AboutDialog );

  return AboutDialog;
} );
<commit_msg>Renamed AboutDialog->PhetAboutDialog internally<commit_after>// Copyright 2002-2013, University of Colorado Boulder

/**
 * Shows the about dialog.
 *
 * @author <NAME>
 */
define( function( require ) {
  'use strict';

  // imports
  var VBox = require( 'SCENERY/nodes/VBox' );
  var Text = require( 'SCENERY/nodes/Text' );
  var inherit = require( 'PHET_CORE/inherit' );
  var MultiLineText = require( 'SCENERY_PHET/MultiLineText' );
  var ScreenView = require( 'JOIST/ScreenView' );
  var Panel = require( 'SUN/Panel' );
  var PhetFont = require( 'SCENERY_PHET/PhetFont' );
  var StringUtils = require( 'PHETCOMMON/util/StringUtils' );
  var VStrut = require( 'SUN/VStrut' );

  // strings
  var phetString = 'PhET Interactive Simulations'; // as in Java sims, do not internationalize
  var copyrightString = 'Copyright © 2004-2014 University of Colorado Boulder'; // as in Java sims, do not internationalize
  var softwareAgreementString = require( 'string!JOIST/softwareAgreement' );
  var softwareLicensingString = require( 'string!JOIST/softwareLicensing' );
  var phetDevelopmentTeamString = require( 'string!JOIST/credits.phetDevelopmentTeam' );
  var leadDesignString = require( 'string!JOIST/credits.leadDesign' );
  var softwareDevelopmentString = require( 'string!JOIST/credits.softwareDevelopment' );
  var designTeamString = require( 'string!JOIST/credits.designTeam' );
  var interviewsString = require( 'string!JOIST/credits.interviews' );
  var graphicArtsString = require( 'string!JOIST/credits.graphicArts' );
  var translationTitleString = require( 'string!JOIST/credits.translation' );
  var thanksTitleString = require( 'string!JOIST/credits.thanks' );

  // constants
  var SOFTWARE_AGREEMENT_URL = 'http://phet.colorado.edu/about/software-agreement_v7.htm';
  var SOFTWARE_LICENSING_URL = 'http://phet.colorado.edu/licensing';

  /**
   * @param {Sim} sim
   * @constructor
   */
  function PhetAboutDialog( sim ) {
    var aboutDialog = this;

    //Use view, to help center and scale content
    //Renderer must be specified here because the PhetAboutDialog is added directly to the scene (instead of to some other node that already has svg renderer)
    ScreenView.call( this, {renderer: 'svg'} );

    var createLink = function( text, url ) {
      var softwareAgreementLink = new Text( text, {
        font: new PhetFont( 14 ),
        fill: 'rgb(27,0,241)', // blue, like a hyperlink
        cursor: 'pointer'
      } );
      softwareAgreementLink.addInputListener( {
        up: function( evt ) {
          evt.handle(); // don't close the dialog
        },
        upImmediate: function( event ) {
          var aboutDialogWindow = window.open( url, '_blank' );
          aboutDialogWindow.focus();
        }
      } );
      return softwareAgreementLink;
    };

    var children = [
      new Text( phetString, { font: new PhetFont( 16 ) } ),
      new Text( copyrightString, { font: new PhetFont( 12 ) } ),
      new VStrut( 15 ),
      new Text( sim.name, { font: new PhetFont( 28 ) } ),
      new Text( 'version ' + sim.version, { font: new PhetFont( 20 ) } )
    ];

    if ( sim.credits ) {
      children.push( new VStrut( 15 ) );
      children.push( createCreditsNode( sim.credits ) );
    }

    children.push( new VStrut( 15 ) );
    children.push( createLink( softwareAgreementString, SOFTWARE_AGREEMENT_URL ) );
    children.push( createLink( softwareLicensingString, SOFTWARE_LICENSING_URL ) );

    var content = new VBox( { align: 'left', spacing: 5, children: children } );

    //Show a gray overlay that will help focus on the about dialog, and prevent clicks on the sim while the dialog is up
    this.addChild( new Panel( content, {centerX: this.layoutBounds.centerX, centerY: this.layoutBounds.centerY, xMargin: 20, yMargin: 20 } ) );

    function resize() {
      aboutDialog.layout( $( window ).width(), $( window ).height() );
    }

    //Fit to the window and render the initial scene
    $( window ).resize( resize );
    resize();
  }

  // Creates node that displays the credits.
  var createCreditsNode = function( credits ) {
    var children = [];
    var titleFont = new PhetFont( { size: 14, weight: 'bold' } );
    var font = new PhetFont( 12 );
    var multiLineTextOptions = { font: font, align: 'left' };
    children.push( new Text( phetDevelopmentTeamString, { font: titleFont } ) );

    if ( credits.leadDesign ) { children.push( new MultiLineText( StringUtils.format( leadDesignString, credits.leadDesign ), multiLineTextOptions ) ); }
    if ( credits.softwareDevelopment ) { children.push( new MultiLineText( StringUtils.format( softwareDevelopmentString, credits.softwareDevelopment ), multiLineTextOptions ) ); }
    if ( credits.designTeam ) { children.push( new MultiLineText( StringUtils.format( designTeamString, credits.designTeam ), multiLineTextOptions ) ); }
    if ( credits.interviews ) { children.push( new MultiLineText( StringUtils.format( interviewsString, credits.interviews ), multiLineTextOptions ) ); }
    if ( credits.graphicArts ) { children.push( new MultiLineText( StringUtils.format( graphicArtsString, credits.graphicArts ), multiLineTextOptions ) ); }
    if ( credits.translation ) {
      if ( children.length > 0 ) { children.push( new Text( ' ', font ) ); }
      children.push( new Text( translationTitleString, { font: titleFont } ) );
      children.push( new MultiLineText( credits.translation, multiLineTextOptions ) );
    }
    if ( credits.thanks ) {
      if ( children.length > 0 ) { children.push( new Text( ' ', font ) ); }
      children.push( new Text( thanksTitleString, { font: titleFont } ) );
      children.push( new MultiLineText( credits.thanks, multiLineTextOptions ) );
    }
    return new VBox( { align: 'left', spacing: 1, children: children } );
  };

  inherit( ScreenView, PhetAboutDialog );

  return PhetAboutDialog;
} );

{'fraction_non_alphanumeric': 0.12170489558370422, 'fraction_numerical': 0.008729887024991442, 'mean_word_length': 3.5290697674418605, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4187837', 'n_tokens_mistral': 3662, 'n_tokens_neox': 3429, 'n_words': 954}