<commit_before>(function (window, $, undefined) {
  'use strict';
  if (window.openrovtheme!=='new-ui') return;
  var plugins = namespace('plugins');
  plugins.NewUI = function NewUI(cockpit) {

    var jsFileLocation = urlOfJsFile('new-ui.js');
    this.cockpit = cockpit;
    this.name = 'new-ui';   // for the settings
    this.viewName = 'New UI'; // for the UI
  };

  plugins.NewUI.prototype.listen = function listen(){
//    $('#t')[0]['cockpitEventEmitter'] = this.cockpit;
    if (window.cockpit_int.i18n === undefined){
      setTimeout(this.listen.bind(this),250);
      return;
    }

    window.cockpit_int.i18n.loadNamespace('new-ui', function() {  });
    var key_s = window.cockpit_int.i18n.options.keyseparator;
    var ns_s =  window.cockpit_int.i18n.options.nsseparator;
    var prefix = 'new-ui';
    $('#t')[0]['__']=function(str){
      window.cockpit_int.i18n.options.ns.defaultNs = prefix
      return window.cockpit_int.__(str);
    };

  }

  plugins.NewUI.prototype.inputDefaults = function inputDefaults(){
    var self = this;
    return [{
      name: 'newUi.showTelemetry',
      description: 'Show the telemetry window.',
      defaults: { keyboard: 'alt+t' },
      down: function () {
        var telemetryWindow = window.open('new-ui/telemetry', '__telemetry', 'menubar=no, status=no, titlebar=no, toolbar=no, width=300, height=400, location=no');
        telemetryWindow.cockpit = window.cockpit;
      }
    },
    {
      name: 'newUi.showSerialMonitor',
      description: 'Show the serial port window.',
      defaults: { keyboard: 'alt+s' },
      down: function () {
        var serialWindow = window.open('new-ui/serial-monitor', '__serial-monitor', 'menubar=no, status=no, titlebar=no, toolbar=no, width=300, height=400, location=no');
        serialWindow.cockpit = window.cockpit;
      }
    }
    ];
  };
  window.Cockpit.plugins.push(plugins.NewUI);
}(window, jQuery));
<commit_msg>Added additional fix for cockpit_int in new-ui listne function<commit_after>(function (window, $, undefined) {
  'use strict';
  if (window.openrovtheme!=='new-ui') return;
  var plugins = namespace('plugins');
  plugins.NewUI = function NewUI(cockpit) {

    var jsFileLocation = urlOfJsFile('new-ui.js');
    this.cockpit = cockpit;
    this.name = 'new-ui';   // for the settings
    this.viewName = 'New UI'; // for the UI
  };

  plugins.NewUI.prototype.listen = function listen(){
    // Fixes timing issues with existence of cockpit_int at time of initial call
    // TODO: Can we code startup in a way where this doesnt happen? Where else might this be happening?
    if (window.cockpit_int === undefined)
    {
      setTimeout(this.listen.bind(this),250);
      return;
    }
    else if( window.cockpit_int.i18n === undefined )
    {
        setTimeout(this.listen.bind(this),250);
        return;
    }

    window.cockpit_int.i18n.loadNamespace('new-ui', function() {  });
    var key_s = window.cockpit_int.i18n.options.keyseparator;
    var ns_s =  window.cockpit_int.i18n.options.nsseparator;
    var prefix = 'new-ui';
    $('#t')[0]['__']=function(str){
      window.cockpit_int.i18n.options.ns.defaultNs = prefix
      return window.cockpit_int.__(str);
    };

  }

  plugins.NewUI.prototype.inputDefaults = function inputDefaults(){
    var self = this;
    return [{
      name: 'newUi.showTelemetry',
      description: 'Show the telemetry window.',
      defaults: { keyboard: 'alt+t' },
      down: function () {
        var telemetryWindow = window.open('new-ui/telemetry', '__telemetry', 'menubar=no, status=no, titlebar=no, toolbar=no, width=300, height=400, location=no');
        telemetryWindow.cockpit = window.cockpit;
      }
    },
    {
      name: 'newUi.showSerialMonitor',
      description: 'Show the serial port window.',
      defaults: { keyboard: 'alt+s' },
      down: function () {
        var serialWindow = window.open('new-ui/serial-monitor', '__serial-monitor', 'menubar=no, status=no, titlebar=no, toolbar=no, width=300, height=400, location=no');
        serialWindow.cockpit = window.cockpit;
      }
    }
    ];
  };
  window.Cockpit.plugins.push(plugins.NewUI);
}(window, jQuery));

{'fraction_non_alphanumeric': 0.15015591268889422, 'fraction_numerical': 0.013432477812425042, 'mean_word_length': 3.212121212121212, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '807981', 'n_tokens_mistral': 1396, 'n_tokens_neox': 1341, 'n_words': 276}