<commit_before>/*   Copyright (c) 2010, Diaspora Inc.  This file is
*   licensed under the Affero General Public License version 3 or later.  See
*   the COPYRIGHT file.
*/
var View = {
  initialize: function() {
    /* Buttons */
    $("input[type='submit']").addClass("button");

    /* Tooltips */
    this.tooltips.bindAll();

    /* Animate flashes */
    this.flashes.animate();

    /* In field labels */
    $("label").inFieldLabels();

    /* Showing debug messages  */
    $(this.debug.selector)
      .click(this.debug.click);

    /* "Toggling" the search input */
    $(this.search.selector)
      .blur(this.search.blur)
      .focus(this.search.focus);

    /* Getting started animation */
    $(this.gettingStarted.selector)
      .live("click", this.gettingStarted.click);

    /* User menu */
    $(this.userMenu.selector)
      .click(this.userMenu.click);

    /* Sending a request message */
    $(this.newRequest.selector)
      .live("submit", this.newRequest.submit);

    /* Autoexpand textareas */
    $('textarea')
      .autoResize({
        'animate': false,
        'extraSpace': 0
      });

    /* Webfinger form ajaxy loading */
    $(this.webFingerForm.selector)
      .submit(this.webFingerForm.submit);

    $(document.body)
      .click(this.userMenu.removeFocus)
      .click(this.reshareButton.removeFocus);

    /* facebox */
    $.facebox.settings.closeImage = '/images/facebox/closelabel.png'
    $.facebox.settings.loadingImage = '/images/facebox/loading.gif'
    $('a[rel*=facebox]').facebox();
  },

  addAspectButton: {
    click: function() {
      $("#aspect_name").focus();
    },
    selector: ".add_aspect_button"
  },

  debug: {
    click: function() {
      $("#debug_more").toggle("fast");
    },
    selector: "#debug_info"
  },

  flashes: {
    animate: function() {
      var $this = $(View.flashes.selector);
      $this.animate({
        top: 0
      }).delay(2000).animate({
        top: -100
      }, $this.remove)
    },
    render: function(result) {
      $("<div/>")
        .attr("id", (result.success) ? "flash_notice" : "flash_error")
        .prependTo(document.body)
        .html(result.notice);
      View.flashes.animate();
    },
    selector: "#flash_notice, #flash_error, #flash_alert"

  },

  gettingStarted: {
    click: function() {
      var $this = $(this);
      $this.animate({
        left: parseInt($this.css("left"), 30) === 0 ? -$this.outerWidth() : 0
      }, function() {
        $this.css("left", "1000px");
      });
    },
    selector: ".getting_started_box"
  },

  newRequest: {
    submit: function() {
      $(this).hide().parent().find(".stream_element").removeClass("hidden");
    },
    selector: ".new_request"
  },

  search: {
    blur: function() {
      $(this).removeClass("active");
    },
    focus: function() {
      $(this).addClass("active");
    },
    selector: "#q"
  },

  tooltips: {
    addAspect: {
      bind: function() {
        $(".add_aspect_button", "#aspect_nav").tipsy({
          gravity:"w"<commit_msg>fix 789<commit_after>/*   Copyright (c) 2010, Diaspora Inc.  This file is
*   licensed under the Affero General Public License version 3 or later.  See
*   the COPYRIGHT file.
*/
var View = {
  initialize: function() {
    /* Buttons */
    $("input[type='submit']").addClass("button");

    /* Tooltips */
    this.tooltips.bindAll();

    /* Animate flashes */
    this.flashes.animate();

    /* In field labels */
    $("label").inFieldLabels();

    /* Showing debug messages  */
    $(this.debug.selector)
      .click(this.debug.click);

    /* "Toggling" the search input */
    $(this.search.selector)
      .blur(this.search.blur)
      .focus(this.search.focus)
    /* Submit the form when the user hits enter */
      .keypress(this.search.keyPress);

    /* Getting started animation */
    $(this.gettingStarted.selector)
      .live("click", this.gettingStarted.click);

    /* User menu */
    $(this.userMenu.selector)
      .click(this.userMenu.click);

    /* Sending a request message */
    $(this.newRequest.selector)
      .live("submit", this.newRequest.submit);

    /* Autoexpand textareas */
    $('textarea')
      .autoResize({
        'animate': false,
        'extraSpace': 0
      });

    /* Webfinger form ajaxy loading */
    $(this.webFingerForm.selector)
      .submit(this.webFingerForm.submit);

    $(document.body)
      .click(this.userMenu.removeFocus)
      .click(this.reshareButton.removeFocus);

    /* facebox */
    $.facebox.settings.closeImage = '/images/facebox/closelabel.png'
    $.facebox.settings.loadingImage = '/images/facebox/loading.gif'
    $('a[rel*=facebox]').facebox();
  },

  addAspectButton: {
    click: function() {
      $("#aspect_name").focus();
    },
    selector: ".add_aspect_button"
  },

  debug: {
    click: function() {
      $("#debug_more").toggle("fast");
    },
    selector: "#debug_info"
  },

  flashes: {
    animate: function() {
      var $this = $(View.flashes.selector);
      $this.animate({
        top: 0
      }).delay(2000).animate({
        top: -100
      }, $this.remove)
    },
    render: function(result) {
      $("<div/>")
        .attr("id", (result.success) ? "flash_notice" : "flash_error")
        .prependTo(document.body)
        .html(result.notice);
      View.flashes.animate();
    },
    selector: "#flash_notice, #flash_error, #flash_alert"

  },

  gettingStarted: {
    click: function() {
      var $this = $(this);
      $this.animate({
        left: parseInt($this.css("left"), 30) === 0 ? -$this.outerWidth() : 0
      }, function() {
        $this.css("left", "1000px");
      });
    },
    selector: ".getting_started_box"
  },

  newRequest: {
    submit: function() {
      $(this).hide().parent().find(".stream_element").removeClass("hidden");
    },
    selector: ".new_request"
  },

  search: {
    blur: function() {
      $(this).removeClass("active");
    },
    focus: function() {
      $(this).addClass("active");
    },
    keyPress: function(evt) {
      if(evt.keyCode === 13) {
        $(this).parent().submit();
      }
    },
    selector: "#q"
  },

  tooltips: {
    addAspect: {
      bind: function() {
        $(".add_aspect_button", "#aspect_nav").tipsy({
          gravity:"w"
{'fraction_non_alphanumeric': 0.18125199616735868, 'fraction_numerical': 0.007824976045991696, 'mean_word_length': 2.4168030551009276, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6116012', 'n_tokens_mistral': 2108, 'n_tokens_neox': 2001, 'n_words': 354}