<commit_before>(function (win, $) {
  'use strict';

  $.namespace('win.booktype.editor.settings');

  win.booktype.editor.settings = (function () {

    var SettingsRouter = Backbone.Router.extend({
      routes: {
        'settings': 'settings',
        'settings/:module': 'loadSetting'
      },

      settings: function () {
        var activePanel = win.booktype.editor.getActivePanel();

        activePanel.hide(function () {
          win.booktype.editor.data.activePanel = win.booktype.editor.data.panels['settings'];
          win.booktype.editor.data.activePanel.show();
        });
      },

      loadSetting: function (module) {
        if (win.booktype.editor.settings.uiLoaded === undefined) {
          this.settings();
        }

        // TODO: check if module is valid

        // check if base content has been loaded

        // load corresponding module
        var params = {
          'setting': module,
          'bookid': win.booktype.currentBookID
        };

        win.booktype.ui.notify('Loading section');

        $.get(win.booktype.bookSettingsURL + '?' + $.param(params),
          function (html) {
            $('#setting_content').html(html);
            $('#setting_content').trigger(module + '-loaded');
          }).error(function () {
          var notAvailable = win.booktype.ui.getTemplate('templateModuleNotAvailable');
          $('#setting_content').html(notAvailable);
        }).complete(function () {
          win.booktype.ui.notify();
        });
      }
    });

    var router = new SettingsRouter();

    var _show = function () {
      $('#button-settings').addClass('active');

      var header = win.booktype.ui.getTemplate('templateSettingsHeader');
      $('DIV.contentHeader').html(header);

      var t = win.booktype.ui.getTemplate('templateSettingsContent');
      $('#content').html(t).addClass('settings');

      win.booktype.editor.settings.uiLoaded = true;
    };

    var _hide = function (callback) {
      $('#button-settings').removeClass('active');

      // Destroy tooltip
      $('DIV.contentHeader [rel=tooltip]').tooltip('destroy');

      // Clear content
      $('#content').empty();
      $('DIV.contentHeader').empty();

      if (!_.isUndefined(callback)) {
        callback();
      }
    };

    var _init = function () {
      $('#button-settings').on('click', function () {
        Backbone.history.navigate('settings', true);
      });<commit_msg>BK-1576 UI is broken on publish screen<commit_after>(function (win, $) {
  'use strict';

  $.namespace('win.booktype.editor.settings');

  win.booktype.editor.settings = (function () {

    var SettingsRouter = Backbone.Router.extend({
      routes: {
        'settings': 'settings',
        'settings/:module': 'loadSetting'
      },

      settings: function () {
        var activePanel = win.booktype.editor.getActivePanel();

        activePanel.hide(function () {
          win.booktype.editor.data.activePanel = win.booktype.editor.data.panels['settings'];
          win.booktype.editor.data.activePanel.show();
        });
      },

      loadSetting: function (module) {
        if (win.booktype.editor.settings.uiLoaded === undefined) {
          this.settings();
        }

        // TODO: check if module is valid

        // check if base content has been loaded

        // load corresponding module
        var params = {
          'setting': module,
          'bookid': win.booktype.currentBookID
        };

        win.booktype.ui.notify('Loading section');

        $.get(win.booktype.bookSettingsURL + '?' + $.param(params),
          function (html) {
            $('#setting_content').html(html);
            $('#setting_content').trigger(module + '-loaded');
          }).error(function () {
          var notAvailable = win.booktype.ui.getTemplate('templateModuleNotAvailable');
          $('#setting_content').html(notAvailable);
        }).complete(function () {
          win.booktype.ui.notify();
        });
      }
    });

    var router = new SettingsRouter();

    var _show = function () {
      $('#button-settings').addClass('active');

      var header = win.booktype.ui.getTemplate('templateSettingsHeader');
      $('DIV.contentHeader').html(header);

      var t = win.booktype.ui.getTemplate('templateSettingsContent');
      $('#content').html(t).addClass('settings');

      win.booktype.editor.settings.uiLoaded = true;
    };

    var _hide = function (callback) {
      $('#button-settings').removeClass('active');

      // Destroy tooltip
      $('DIV.contentHeader [rel=tooltip]').tooltip('destroy');

      // Clear content
      $('#content').empty();
      $('#content').removeClass('settings');
      $('DIV.contentHeader').empty();

      if (!_.isUndefined(callback)) {
        callback();
      }
    };

    var _init = function () {
      $('#button-settings').on('click', function () {
        Backbone.history.navigate('settings', true);
      });
{'fraction_non_alphanumeric': 0.1647130153597413, 'fraction_numerical': 0.0008084074373484236, 'mean_word_length': 2.4037138927097663, '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': '1369433', 'n_tokens_mistral': 1368, 'n_tokens_neox': 1340, 'n_words': 227}