<commit_before>/*global Offline, $ */
define([
    "dojo/_base/declare",
    "dojo/_base/lang",
    "dojo/on",
    "dojo/dom",
    "dojo/dom-construct",
    "edit/offlineFeaturesManager",
    "esri/dijit/editing/Editor",
    "dojo/i18n!application/nls/resources"
], function (
  declare,
  lang,
  on,
  dom, domConstruct,
  OfflineFeaturesManager,
  Editor,
  i18n
) {
  return declare(null, {
    // create class
    constructor: function (options) {
      // save defaults
      this.defaults = options;
      // create offline manager
      this.offlineFeaturesManager = new OfflineFeaturesManager();
      // once layer is loaded
      if (this.defaults.layer.loaded) {
        this.initEditor();
      } else {
        on.once(this.defaults.layer, 'load', lang.hitch(this, this.initEditor));
      }
      Offline.check();
      Offline.on('up', lang.hitch(this, function () {
        this.goOnline();

      }));
      Offline.on('down', lang.hitch(this, function () {
        this.goOffline();
      }));
    },

    // update online status
    updateConnectivityIndicator: function () {
      var html;
      var status = this.offlineFeaturesManager.getOnlineStatus();
      switch (status) {
      case this.offlineFeaturesManager.OFFLINE:
        html = '<span class="text-danger"><span class="glyphicon glyphicon-exclamation-sign"></span> ' + i18n.onlineStatus.offline + '</span>';
        break;
      case this.offlineFeaturesManager.RECONNECTING:
        html = '<span class="text-warning"><span class="glyphicon glyphicon-exclamation-sign"></span> ' + i18n.onlineStatus.reconnecting + '</span>';
        break;
      }
      var submitButton = $('#submit_container');
      if (submitButton) {
        submitButton.popover('destroy');
        if (html) {
          var options = {
            html: true,
            animation: true,
            placement: 'top',
            trigger: 'manual',
            title: i18n.onlineStatus.title,
            content: html
          };
          submitButton.popover(options);
          submitButton.popover('show');
          if (status !== this.offlineFeaturesManager.OFFLINE) {
            setTimeout(function () {
              submitButton.popover('hide');
            }, 5000);
          }
        }
      }
    },

    // now online
    goOnline: function () {
      // go online and then update status
      this.offlineFeaturesManager.goOnline(lang.hitch(this, function () {<commit_msg>no message<commit_after>/*global Offline, $ */
define([
    "dojo/_base/declare",
    "dojo/_base/lang",
    "dojo/on",
    "dojo/dom",
    "dojo/dom-construct",
    "edit/offlineFeaturesManager",
    "esri/dijit/editing/Editor",
    "dojo/i18n!application/nls/resources"
], function (
  declare,
  lang,
  on,
  dom, domConstruct,
  OfflineFeaturesManager,
  Editor,
  i18n
) {
  return declare(null, {
    // create class
    constructor: function (options) {
      // save defaults
      this.defaults = options;
      // create offline manager
      this.offlineFeaturesManager = new OfflineFeaturesManager();
      // once layer is loaded
      if (this.defaults.layer.loaded) {
        this.initEditor();
      } else {
        on.once(this.defaults.layer, 'load', lang.hitch(this, this.initEditor));
      }
      Offline.check();
      Offline.on('up', lang.hitch(this, function () {
        this.goOnline();

      }));
      Offline.on('down', lang.hitch(this, function () {
        this.goOffline();
      }));
    },

    // update online status
    updateConnectivityIndicator: function () {
      var html;
      var status = this.offlineFeaturesManager.getOnlineStatus();
      switch (status) {
      case this.offlineFeaturesManager.OFFLINE:
        html = '<span class="text-danger"><span class="glyphicon glyphicon-exclamation-sign"></span> ' + i18n.onlineStatus.offline + '</span>';
        break;
      case this.offlineFeaturesManager.RECONNECTING:
        html = '<span class="text-warning"><span class="glyphicon glyphicon-exclamation-sign"></span> ' + i18n.onlineStatus.reconnecting + '</span>';
        break;
      }
      var submitButton = $('#submit_container');
      if (submitButton) {
        submitButton.popover('destroy');
        if (html) {
          var options = {
            html: true,
            animation: true,
            trigger: 'manual',
            title: i18n.onlineStatus.title,
            content: html
          };
          submitButton.popover(options);
          submitButton.popover('show');
          if (status !== this.offlineFeaturesManager.OFFLINE) {
            setTimeout(function () {
              submitButton.popover('hide');
            }, 5000);
          }
        }
      }
    },

    // now online
    goOnline: function () {
      // go online and then update status
      this.offlineFeaturesManager.goOnline(lang.hitch(this, function () {
{'fraction_non_alphanumeric': 0.13667145495587935, 'fraction_numerical': 0.005745947055202134, 'mean_word_length': 2.2493333333333334, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, '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': '7420329', 'n_tokens_mistral': 1459, 'n_tokens_neox': 1416, 'n_words': 263}