<commit_before>/**
 * @fileoverview
 * @TODO file description
 *
 * @author <NAME>
 * @date 26-06-2012 10:37
 */

(function ($) {

  /**
   * Configuration of the streams to publish upon connection established
   * @type {Object}
   */
  ADLT.CONNECTION_CONFIGURATION = {


    /**
     * Flags defining that both streams should be automatically published upon
     * connection.
     */
    autopublishVideo:false,
    autopublishAudio:false,
    scopeId:'Tutorial7'
  };

  ADLT.APPLICATION_ID = 1;

  ADLT.APP_SHARED_SECRET = 'CloudeoTestAccountSecret';


  /**
   * Document ready callback - starts the AddLive platform initialization.
   */
  ADLT.onDomReady = function () {
    log.debug('DOM loaded');
    ADLT.initAddLiveLogging();
//  Additional options for quick initialization - do not initialize the devices
//  and do not update the plug-in
    ADLT.initializeAddLiveQuick(ADLT.onPlatformReady,
        {initDevices:false,
          skipUpdate:true,
          applicationId: ADLT.APPLICATION_ID
        });
  };

  ADLT.onPlatformReady = function () {
    log.debug("AddLive Platform ready.");
    var ADLListener = new ADL.AddLiveServiceListener();
    ADLListener.onUserEvent = function (e) {
      if (e.isConnected) {
        $('<option id="user' + e.userId + 'Opt" value="' + e.userId + '">User ' +
            e.userId + '</option>').appendTo($('#targetSelect'));
        ADLT.appendMessage(e.userId, 'User with id ' + e.userId + ' just joined '
            + 'the chat');
      } else {
        $('#user' + e.userId + 'Opt').remove();
        ADLT.appendMessage(e.userId, 'User with id ' + e.userId + ' just left ' +
            'the chat');
      }
    };

    /**
     *
     * @param {ADL.MessageEvent} e
     */
    ADLListener.onMessage = function (e) {
      log.debug("Got new message from " + e.srcUserId);
      var msg = JSON.parse(e.data);
      ADLT.appendMessage(e.srcUserId, msg.text, msg.direct);
    };
    ADL.getService().addServiceListener(ADL.createResponder(ADLT.onListenerAdded),
        ADLListener);
  };

  ADLT.onListenerAdded = function () {
    var connDescr = $.extend({}, ADLT.CONNECTION_CONFIGURATION);
    ADLT._ownUserId = ADLT.genRandomUserId();
    connDescr.authDetails = ADLT.genAuthDetails(connDescr.scopeId,
        ADLT._ownUserId);

    ADL.getService().connect(ADL.createResponder(ADLT.onConnected), connDescr);
  };

  ADLT.onConnected = function (connection) {
    $('#sendbtn').removeClass('disabled').click(ADLT.sendMsg);
    var welcomeMessage = "You've just joined the text chat. You're personal id: "
        + ADLT._ownUserId;
    ADLT.appendMessage(ADLT._ownUserId, welcomeMessage);
    $('#sendBtn').removeClass('disabled').click(ADLT.sendMsg);
    /**
     *
     * @type {ADL.MediaConnection}
     * @private
     */
    ADLT._chatConnection = connection;
  };

  ADLT.sendMsg = function () {
    var $msgInput = $('#msgInput');
    var msgContent = $msgInput.val();<commit_msg>Fixed typo in the selector id - sendbtn -> sendBtn<commit_after>/**
 * @fileoverview
 * @TODO file description
 *
 * @author <NAME>
 * @date 26-06-2012 10:37
 */

(function ($) {

  /**
   * Configuration of the streams to publish upon connection established
   * @type {Object}
   */
  ADLT.CONNECTION_CONFIGURATION = {


    /**
     * Flags defining that both streams should be automatically published upon
     * connection.
     */
    autopublishVideo:false,
    autopublishAudio:false,
    scopeId:'Tutorial7'
  };

  ADLT.APPLICATION_ID = 1;

  ADLT.APP_SHARED_SECRET = 'CloudeoTestAccountSecret';


  /**
   * Document ready callback - starts the AddLive platform initialization.
   */
  ADLT.onDomReady = function () {
    log.debug('DOM loaded');
    ADLT.initAddLiveLogging();
//  Additional options for quick initialization - do not initialize the devices
//  and do not update the plug-in
    ADLT.initializeAddLiveQuick(ADLT.onPlatformReady,
        {initDevices:false,
          skipUpdate:true,
          applicationId: ADLT.APPLICATION_ID
        });
  };

  ADLT.onPlatformReady = function () {
    log.debug("AddLive Platform ready.");
    var ADLListener = new ADL.AddLiveServiceListener();
    ADLListener.onUserEvent = function (e) {
      if (e.isConnected) {
        $('<option id="user' + e.userId + 'Opt" value="' + e.userId + '">User ' +
            e.userId + '</option>').appendTo($('#targetSelect'));
        ADLT.appendMessage(e.userId, 'User with id ' + e.userId + ' just joined '
            + 'the chat');
      } else {
        $('#user' + e.userId + 'Opt').remove();
        ADLT.appendMessage(e.userId, 'User with id ' + e.userId + ' just left ' +
            'the chat');
      }
    };

    /**
     *
     * @param {ADL.MessageEvent} e
     */
    ADLListener.onMessage = function (e) {
      log.debug("Got new message from " + e.srcUserId);
      var msg = JSON.parse(e.data);
      ADLT.appendMessage(e.srcUserId, msg.text, msg.direct);
    };
    ADL.getService().addServiceListener(ADL.createResponder(ADLT.onListenerAdded),
        ADLListener);
  };

  ADLT.onListenerAdded = function () {
    var connDescr = $.extend({}, ADLT.CONNECTION_CONFIGURATION);
    ADLT._ownUserId = ADLT.genRandomUserId();
    connDescr.authDetails = ADLT.genAuthDetails(connDescr.scopeId,
        ADLT._ownUserId);

    ADL.getService().connect(ADL.createResponder(ADLT.onConnected), connDescr);
  };

  ADLT.onConnected = function (connection) {
    $('#sendBtn').removeClass('disabled').click(ADLT.sendMsg);
    var welcomeMessage = "You've just joined the text chat. You're personal id: "
        + ADLT._ownUserId;
    ADLT.appendMessage(ADLT._ownUserId, welcomeMessage);
    $('#sendBtn').removeClass('disabled').click(ADLT.sendMsg);
    /**
     *
     * @type {ADL.MediaConnection}
     * @private
     */
    ADLT._chatConnection = connection;
  };

  ADLT.sendMsg = function () {
    var $msgInput = $('#msgInput');
    var msgContent = $msgInput.val();
{'fraction_non_alphanumeric': 0.14155866015822252, 'fraction_numerical': 0.0047130112775627, 'mean_word_length': 2.853437094682231, 'pattern_counts': {'":': 0, '<': 9, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7223509', 'n_tokens_mistral': 1917, 'n_tokens_neox': 1898, 'n_words': 374}