<commit_before>/**
 * @fileoverview Provides a factory to create a popup in the page.
 * The factory returns a ngeo.Popup object.
 *
 * Example:
 *
 * var popup = ngeoCreatePopup();
 * popup.setTitle("A title");
 * popup.setContent("Some content");
 * popup.show();
 *
 */

goog.provide('ngeo.CreatePopup');
goog.provide('ngeo.Popup');

goog.require('ngeo');
goog.require('ngeo.popupDirective');


/**
 * @typedef {function():!ngeo.Popup}
 */
ngeo.CreatePopup;



/**
 * @constructor
 * @param {angular.$compile} $compile The compile provider.
 * @param {angular.Scope} $rootScope The rootScope provider.
 */
ngeo.Popup = function($compile, $rootScope) {

  /**
   * The scope the element is compiled with.
   * @type {angular.Scope}
   * @private
   */
  this.scope_ = $rootScope.$new();

  /**
   * The element.
   * @type {angular.JQLite}
   * @private
   */
  this.element_;

  // Create the popup element with its content and add it to the HTML page
  this.element_ = angular.element('<div ngeo-popup></div>');

  angular.element(document.body).append(this.element_);
  $compile(this.element_)(this.scope_);
};


/**
 * Display the popup
 */
ngeo.Popup.prototype.show = function() {
  this.scope_['open'] = true;
};


/**
 * Destroy the popup
 */
ngeo.Popup.prototype.destroy = function() {
  this.scope_.$destroy();
  this.element_.remove();
};


/**
 * Set the popup's title
 * @param {string} title The title
 */
ngeo.Popup.prototype.setTitle = function(title) {<commit_msg>Always initialize instance variables<commit_after>/**
 * @fileoverview Provides a factory to create a popup in the page.
 * The factory returns a ngeo.Popup object.
 *
 * Example:
 *
 * var popup = ngeoCreatePopup();
 * popup.setTitle("A title");
 * popup.setContent("Some content");
 * popup.show();
 *
 */

goog.provide('ngeo.CreatePopup');
goog.provide('ngeo.Popup');

goog.require('ngeo');
goog.require('ngeo.popupDirective');


/**
 * @typedef {function():!ngeo.Popup}
 */
ngeo.CreatePopup;



/**
 * @constructor
 * @param {angular.$compile} $compile The compile provider.
 * @param {angular.Scope} $rootScope The rootScope provider.
 */
ngeo.Popup = function($compile, $rootScope) {

  /**
   * The scope the element is compiled with.
   * @type {angular.Scope}
   * @private
   */
  this.scope_ = $rootScope.$new();

  /**
   * The element.
   * @type {angular.JQLite}
   * @private
   */
  this.element_ = angular.element('<div ngeo-popup></div>');

  // Add the element and its content to the document
  angular.element(document.body).append(this.element_);
  $compile(this.element_)(this.scope_);
};


/**
 * Display the popup
 */
ngeo.Popup.prototype.show = function() {
  this.scope_['open'] = true;
};


/**
 * Destroy the popup
 */
ngeo.Popup.prototype.destroy = function() {
  this.scope_.$destroy();
  this.element_.remove();
};


/**
 * Set the popup's title
 * @param {string} title The title
 */
ngeo.Popup.prototype.setTitle = function(title) {
{'fraction_non_alphanumeric': 0.17237869019341703, 'fraction_numerical': 0.0, 'mean_word_length': 3.6206896551724137, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '7519308', 'n_tokens_mistral': 1004, 'n_tokens_neox': 966, 'n_words': 221}