<commit_before>/*global $, window, goinstant, console, jQuery */
'use strict';

function connect(options) {
  var connectUrl = 'https://goinstant.net/goinstant-services/docs';
  var connection = new goinstant.Connection(connectUrl, options);

  connection.connect(function(err, connection) {
    if (err) {
      console.error('could not connect:', err);
      return;
    }

    var roomName = getOrSetRoomCookie("form");
    var currentRoom = connection.room(roomName);

    var Form = goinstant.widgets.Form;

    currentRoom.join(function(err) {
      if (err) {
        console.error('Error joining room:', err);
        return;
      }

      currentRoom.user(function(err, user, userKey) {
        userKey.key('displayName').set('Guest ' + options.guestId, function(err) {
          if (err) {
            console.log("Error setting userId", err);
            return;
          }
        });
        var color = options.guestId == "1" ? "#f00" : "#0f0";
        userKey.key('avatarColor').set(color, function(err) {
          if (err) {
            return console.error(err);
          }
          // The user now appears red in the user-list, etc.
        });
      });

      var formKey = currentRoom.key('example-form-key');

      var form = new Form({
        key: formKey,
        el: document.getElementById('form-id'),
        room: currentRoom
      });

      form.initialize(function(err) {
        if (err) {
          return console.error('Could not initialize widget:', err);<commit_msg>replacing deprecated methods<commit_after>/*global $, window, goinstant, console, jQuery */
'use strict';

function connect(options) {
  var connectUrl = 'https://goinstant.net/goinstant-services/docs';
  var connection = new goinstant.Connection(connectUrl, options);

  connection.connect(function(err, connection) {
    if (err) {
      console.error('could not connect:', err);
      return;
    }

    var roomName = getOrSetRoomCookie("form");
    var currentRoom = connection.room(roomName);

    var Form = goinstant.widgets.Form;

    currentRoom.join(function(err) {
      if (err) {
        console.error('Error joining room:', err);
        return;
      }

      var color = options.guestId == "1" ? "#f00" : "#0f0";
      var userKey = currentRoom.self();
      userKey.key('displayName').set('Guest ' + options.guestId, function(err) {
        if (err) {
          return console.error("Error setting userId", err);
        }
      });
      userKey.key('avatarColor').set(color, function(err) {
        if (err) {
          return console.error("error setting avatarColor", err);
        }
        // The user now appears red in the user-list, etc.
      });

      var formKey = currentRoom.key('example-form-key');

      var form = new Form({
        key: formKey,
        el: document.getElementById('form-id'),
        room: currentRoom
      });

      form.initialize(function(err) {
        if (err) {
          return console.error('Could not initialize widget:', err);
{'fraction_non_alphanumeric': 0.13952713952713952, 'fraction_numerical': 0.00333000333000333, 'mean_word_length': 2.4568469505178365, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '6790229', 'n_tokens_mistral': 896, 'n_tokens_neox': 862, 'n_words': 202}