<commit_before>var App = function(baseUrl) {
  this.baseUrl = baseUrl;
  this.lectures = new LectureList(baseUrl);
  this.lecture = new Lecture(baseUrl);
  this.cart = new Cart(baseUrl);
  this.printJob = new PrintJob(baseUrl, this.cart);
  this.user = new User(baseUrl);
  this.preselection = new CartList(baseUrl);
  this.rangeSelect = new RangeSelect(this.cart, this.lecture);
  this.previewPrefix = $.cookie('previewPrefix') || '/home/mi/info_Dokumente/';
  this.isPreviewConfigured = $.cookie('previewPrefix') !== undefined;
  this.visible = 'documents';
  this.cartID = '';

  ko.track(this);
}

App.prototype.lecturesVisible = function () {
  return this.visible === 'lectures';
}

App.prototype.documentsVisible = function() {
  return this.visible === 'documents' ||
         this.visible === 'cart';
}

App.prototype.cartVisible = function() {
  return this.visible === 'documents' ||
         this.visible === 'cart';
}

App.prototype.loginVisible = function() {
  return !this.user.isAuthenticated && this.visible === 'login';
}

App.prototype.printVisible = function() {
  return this.user.isAuthenticated && this.visible === 'print';
}

App.prototype.show = function(name) {
  this.visible = name;
  // special casing for in-page navigation to cart
  // Sadly this can't be done by setting the <a>'s href in the html
  if (name === 'cart') {
    document.location.href = '#cart';
  }
}

App.prototype.openLecture = function(lecture) {
  this.lecture.load(lecture.name);
  this.visible = 'documents';
}

// causes actual login and handles application state change
App.prototype.login = function() {
  var self = this;
  this.user.login(function() {
    self.show('documents');
    self.print.loadCarts();
  });
}

// causes actual logout and moves away to selection view
App.prototype.logout = function() {
  var self = this;
  this.user.logout(function() {
    self.show('documents');
  });
}

App.prototype.openCart = function(cart) {
  this.cart.dropAll();
  for (var i = 0; i < cart.length; i++) {
    this.cart.push(cart[i]);
  }
  if (this.print.selected !== this.cart) {
    this.print.select(this.cart);
  }
}

App.prototype.configurePreview = function() {
  $.cookie('previewPrefix', this.previewPrefix, {expires: 10000});
  this.isPreviewConfigured = true;
}

$(document).ready(function() {
  // global config
  depositPrice = 500;
  pricePerPage = 3;

  if (window.location.hostname === 'www.fsmi.uni-karlsruhe.de') {
    url = window.location.origin + '/odie';
  } else {
    // $.ajaxSetup is stupid, let's write our own one
    _ajax = $.ajax;
    $.ajax = function(settings) {<commit_msg>Fix modal dialog backdrop not being removed<commit_after>var App = function(baseUrl) {
  this.baseUrl = baseUrl;
  this.lectures = new LectureList(baseUrl);
  this.lecture = new Lecture(baseUrl);
  this.cart = new Cart(baseUrl);
  this.printJob = new PrintJob(baseUrl, this.cart);
  this.user = new User(baseUrl);
  this.preselection = new CartList(baseUrl);
  this.rangeSelect = new RangeSelect(this.cart, this.lecture);
  this.previewPrefix = $.cookie('previewPrefix') || '/home/mi/info_Dokumente/';
  this.isPreviewConfigured = $.cookie('previewPrefix') !== undefined;
  this.visible = 'documents';
  this.cartID = '';

  ko.track(this);
}

App.prototype.lecturesVisible = function () {
  return this.visible === 'lectures';
}

App.prototype.documentsVisible = function() {
  return this.visible === 'documents' ||
         this.visible === 'cart';
}

App.prototype.cartVisible = function() {
  return this.visible === 'documents' ||
         this.visible === 'cart';
}

App.prototype.loginVisible = function() {
  return !this.user.isAuthenticated && this.visible === 'login';
}

App.prototype.printVisible = function() {
  return this.user.isAuthenticated && this.visible === 'print';
}

App.prototype.show = function(name) {
  this.visible = name;
  // special casing for in-page navigation to cart
  // Sadly this can't be done by setting the <a>'s href in the html
  if (name === 'cart') {
    document.location.href = '#cart';
  }
}

App.prototype.openLecture = function(lecture) {
  this.lecture.load(lecture.name);
  this.visible = 'documents';
}

// causes actual login and handles application state change
App.prototype.login = function() {
  var self = this;
  this.user.login(function() {
    self.show('documents');
    self.print.loadCarts();
  });
}

// causes actual logout and moves away to selection view
App.prototype.logout = function() {
  var self = this;
  this.user.logout(function() {
    self.show('documents');
  });
}

App.prototype.openCart = function(cart) {
  this.cart.dropAll();
  for (var i = 0; i < cart.length; i++) {
    this.cart.push(cart[i]);
  }
  if (this.print.selected !== this.cart) {
    this.print.select(this.cart);
  }
}

App.prototype.configurePreview = function() {
  $.cookie('previewPrefix', this.previewPrefix, {expires: 10000});
  this.isPreviewConfigured = true;
}

$(document).ready(function() {
  // global config
  depositPrice = 500;
  pricePerPage = 3;
  infuser.defaults.useLoadingTemplate = false;

  if (window.location.hostname === 'www.fsmi.uni-karlsruhe.de') {
    url = window.location.origin + '/odie';
  } else {
    // $.ajaxSetup is stupid, let's write our own one
    _ajax = $.ajax;
    $.ajax = function(settings) {
{'fraction_non_alphanumeric': 0.15972876247880957, 'fraction_numerical': 0.0037671877943115466, 'mean_word_length': 3.749552772808587, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '1480964', 'n_tokens_mistral': 1761, 'n_tokens_neox': 1709, 'n_words': 376}