<commit_before>if (Meteor.isClient) {

  /**
   * Get url parameter, e.g., http://localhost:3000/?id=3 -> id = 3
   *
   * @name The parameter name.
   */
  var getParameterByName = function(name) {
    name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
    var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
        results = regex.exec(location.search);
    return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
  };

  /**
   * Connects to Huddle Engine using
   *
   * 1) host and port url parameter if set
   * 2) host and port from session if set
   * 3) shows a connection dialog
   */
  var connect = function() {
    var host = getParameterByName("host");
    var port = parseInt(getParameterByName("port"));

    if (!host || !port) {
      host = Session.get("host");
      port = Session.get("port");
    }

    if (host && port) {
      createCanvas(host, port);
    }
    else {
      $('#connection-dialog').modal({
        backdrop: false,
        keyboard: false,
        show: true
      });
    }
  };

  // make canvas accessible outside of the createCanvas function
  var canvas;
  var createCanvas = function(host, port) {
    canvas = HuddleCanvas.create(host, port, {
      containerId: "huddle-canvas-container",
      backgroundImage: "/images/where-is-waldo1.jpg",
      panningEnabled: false,
      showDebugBox: false
    });
  };

  /**
   * Do connect after main application rendered.
   */
  Template.main.rendered = function() {
    // do connect to Huddle Engine, otherwise show connection dialog
    connect();
  }

  /**
   * Render the connection dialog.<commit_msg>Enabled panning & zooming<commit_after>if (Meteor.isClient) {

  /**
   * Get url parameter, e.g., http://localhost:3000/?id=3 -> id = 3
   *
   * @name The parameter name.
   */
  var getParameterByName = function(name) {
    name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
    var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
        results = regex.exec(location.search);
    return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
  };

  /**
   * Connects to Huddle Engine using
   *
   * 1) host and port url parameter if set
   * 2) host and port from session if set
   * 3) shows a connection dialog
   */
  var connect = function() {
    var host = getParameterByName("host");
    var port = parseInt(getParameterByName("port"));

    if (!host || !port) {
      host = Session.get("host");
      port = Session.get("port");
    }

    if (host && port) {
      createCanvas(host, port);
    }
    else {
      $('#connection-dialog').modal({
        backdrop: false,
        keyboard: false,
        show: true
      });
    }
  };

  // make canvas accessible outside of the createCanvas function
  var canvas;
  var createCanvas = function(host, port) {
    canvas = HuddleCanvas.create(host, port, {
      containerId: "huddle-canvas-container",
      backgroundImage: "/images/where-is-waldo1.jpg",
      panningEnabled: true, //false,
      showDebugBox: false
    });
  };

  /**
   * Do connect after main application rendered.
   */
  Template.main.rendered = function() {
    // do connect to Huddle Engine, otherwise show connection dialog
    connect();
  }

  /**
   * Render the connection dialog.
{'fraction_non_alphanumeric': 0.16333938294010888, 'fraction_numerical': 0.006654567453115548, 'mean_word_length': 2.4994708994708996, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2521268', 'n_tokens_mistral': 1042, 'n_tokens_neox': 1013, 'n_words': 266}