<commit_before>// $Revision$

Ensembl.Panel.Configurator = Ensembl.Panel.ModalContent.extend({
  constructor: function (id, params) {
    this.base(id, params);
    
    Ensembl.EventManager.register('updateConfiguration', this, this.updateConfiguration);
    Ensembl.EventManager.register('showConfiguration',   this, this.show);
    Ensembl.EventManager.register('changeConfiguration', this, this.externalChange);
    Ensembl.EventManager.register('changeTrackOrder',    this, this.externalOrder);
    Ensembl.EventManager.register('changeFavourite',     this, this.changeFavourite);
    Ensembl.EventManager.register('syncViewConfig',      this, this.syncViewConfig);
    Ensembl.EventManager.register('modalHide',           this, this.saveAsHide);
    Ensembl.EventManager.register('updateSavedConfig',   this, this.updateSavedConfig);
    Ensembl.EventManager.register('activateConfig',      this, this.activateConfig);
  },
  
  init: function () {
    var panel = this;
    var track, type, group, i, j;
    
    function setFavourite(trackName, li) {
      if (!panel.favourites[type]) {
        panel.favourites[type] = {};
      }
      
      panel.favourites[type][trackName] = [ i, li ];
    }
    
    this.base();
    
    if (this.params.hash) {
      this.elLk.links.removeClass('active').has('.' + this.params.hash).addClass('active');
      delete this.params.hash;
    }
    
    this.elLk.form              = $('form.configuration', this.el);
    this.elLk.headers           = $('h1', this.el);
    this.elLk.search            = $('.configuration_search_text', this.el);
    this.elLk.searchResults     = $('a.search_results', this.elLk.links);
    this.elLk.configDivs        = $('div.config', this.elLk.form);
    this.elLk.configs           = $('ul.config_menu > li', this.elLk.configDivs);
    this.elLk.tracks            = this.elLk.configs.filter('.track');
    this.elLk.help              = $('.menu_help',  this.elLk.configDivs);
    this.elLk.menus             = $('.popup_menu', this.elLk.configDivs);
    this.elLk.favouritesMsg     = this.elLk.configDivs.filter('.favourite_tracks');
    this.elLk.noSearchResults   = this.elLk.configDivs.filter('.no_search');
    this.elLk.trackOrder        = this.elLk.configDivs.filter('.track_order');
    this.elLk.trackOrderList    = $('ul.config_menu', this.elLk.trackOrder);
    this.elLk.viewConfigs       = this.elLk.configDivs.filter('.view_config');
    this.elLk.viewConfigInputs  = $(':input:not([name=select_all])', this.elLk.viewConfigs);
    this.elLk.imageConfigExtras = $('.image_config_notes, .configuration_search', this.el);
    this.elLk.saveAs            = $('.config_save_as', this.el).insertAfter(this.el); // IE 6 and 7 are stupid and can't deal with z-index correctly
    this.elLk.saveAsClose       = $('.close', this.elLk.saveAs);
    this.elLk.saveAsInputs      = $('.name, .desc, .default, .existing', this.elLk.saveAs);
    this.elLk.saveAsRequired    = this.elLk.saveAsInputs.filter('.name, .existing');
    this.elLk.existingConfigs   = this.elLk.saveAsInputs.filter('.existing');
    this.elLk.saveAsSubmit      = $('.fbutton', this.elLk.saveAs);
    this.elLk.saveAsBg          = this.el.siblings('#config_save_as_bg');
    this.elLk.modalClose        = this.el.siblings('.modal_title').children('.modal_close');
    this.elLk.subPanelTracks    = $();
    
    this.component          = $('input.component', this.elLk.form).val();
    this.sortable           = !!this.elLk.trackOrder.length;
    this.trackReorder       = false;
    this.lastQuery          = false;
    this.populated          = {};
    this.favourites         = {};
    this.externalFavourites = {};
    this.imageConfig        = {};
    this.viewConfig         = {};
    this.subPanels          = [];
    
    // Move user data to below the multi entries (active tracks, favourites, search)
    this.elLk.links.has('.user_data').insertAfter(this.elLk.links.has('[rel=multi]').last());
    this.elLk.configDivs.filter('.user_data').insertBefore(this.elLk.configDivs.first());
    
    for (type in this.params.tracks) {<commit_msg>don't move user data if it's already first<commit_after>// $Revision$

Ensembl.Panel.Configurator = Ensembl.Panel.ModalContent.extend({
  constructor: function (id, params) {
    this.base(id, params);
    
    Ensembl.EventManager.register('updateConfiguration', this, this.updateConfiguration);
    Ensembl.EventManager.register('showConfiguration',   this, this.show);
    Ensembl.EventManager.register('changeConfiguration', this, this.externalChange);
    Ensembl.EventManager.register('changeTrackOrder',    this, this.externalOrder);
    Ensembl.EventManager.register('changeFavourite',     this, this.changeFavourite);
    Ensembl.EventManager.register('syncViewConfig',      this, this.syncViewConfig);
    Ensembl.EventManager.register('modalHide',           this, this.saveAsHide);
    Ensembl.EventManager.register('updateSavedConfig',   this, this.updateSavedConfig);
    Ensembl.EventManager.register('activateConfig',      this, this.activateConfig);
  },
  
  init: function () {
    var panel = this;
    var track, type, group, i, j;
    
    function setFavourite(trackName, li) {
      if (!panel.favourites[type]) {
        panel.favourites[type] = {};
      }
      
      panel.favourites[type][trackName] = [ i, li ];
    }
    
    this.base();
    
    if (this.params.hash) {
      this.elLk.links.removeClass('active').has('.' + this.params.hash).addClass('active');
      delete this.params.hash;
    }
    
    this.elLk.form              = $('form.configuration', this.el);
    this.elLk.headers           = $('h1', this.el);
    this.elLk.search            = $('.configuration_search_text', this.el);
    this.elLk.searchResults     = $('a.search_results', this.elLk.links);
    this.elLk.configDivs        = $('div.config', this.elLk.form);
    this.elLk.configs           = $('ul.config_menu > li', this.elLk.configDivs);
    this.elLk.tracks            = this.elLk.configs.filter('.track');
    this.elLk.help              = $('.menu_help',  this.elLk.configDivs);
    this.elLk.menus             = $('.popup_menu', this.elLk.configDivs);
    this.elLk.favouritesMsg     = this.elLk.configDivs.filter('.favourite_tracks');
    this.elLk.noSearchResults   = this.elLk.configDivs.filter('.no_search');
    this.elLk.trackOrder        = this.elLk.configDivs.filter('.track_order');
    this.elLk.trackOrderList    = $('ul.config_menu', this.elLk.trackOrder);
    this.elLk.viewConfigs       = this.elLk.configDivs.filter('.view_config');
    this.elLk.viewConfigInputs  = $(':input:not([name=select_all])', this.elLk.viewConfigs);
    this.elLk.imageConfigExtras = $('.image_config_notes, .configuration_search', this.el);
    this.elLk.saveAs            = $('.config_save_as', this.el).insertAfter(this.el); // IE 6 and 7 are stupid and can't deal with z-index correctly
    this.elLk.saveAsClose       = $('.close', this.elLk.saveAs);
    this.elLk.saveAsInputs      = $('.name, .desc, .default, .existing', this.elLk.saveAs);
    this.elLk.saveAsRequired    = this.elLk.saveAsInputs.filter('.name, .existing');
    this.elLk.existingConfigs   = this.elLk.saveAsInputs.filter('.existing');
    this.elLk.saveAsSubmit      = $('.fbutton', this.elLk.saveAs);
    this.elLk.saveAsBg          = this.el.siblings('#config_save_as_bg');
    this.elLk.modalClose        = this.el.siblings('.modal_title').children('.modal_close');
    this.elLk.subPanelTracks    = $();
    
    this.component          = $('input.component', this.elLk.form).val();
    this.sortable           = !!this.elLk.trackOrder.length;
    this.trackReorder       = false;
    this.lastQuery          = false;
    this.populated          = {};
    this.favourites         = {};
    this.externalFavourites = {};
    this.imageConfig        = {};
    this.viewConfig         = {};
    this.subPanels          = [];
    
    // Move user data to below the multi entries (active tracks, favourites, search)
    if (this.elLk.configDivs.first().not('.user_data').length) {
      this.elLk.links.has('.user_data').insertAfter(this.elLk.links.has('[rel=multi]').last());
      this.elLk.configDivs.filter('.user_data').insertBefore(this.elLk.configDivs.first());
    }
    
    for (type in this.params.tracks) {
{'fraction_non_alphanumeric': 0.15571600481347775, 'fraction_numerical': 0.0007220216606498195, 'mean_word_length': 2.883644859813084, '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': '1349200', 'n_tokens_mistral': 2796, 'n_tokens_neox': 2735, 'n_words': 367}