Skip to content
Extraits de code Groupes Projets
view.js 4,51 ko
Newer Older
  • Learn to ignore specific revisions
  • Raphael's avatar
    Raphael a validé
    /*   Copyright (c) 2010, Diaspora Inc.  This file is
    
    Raphael's avatar
    Raphael a validé
    *   licensed under the Affero General Public License version 3 or later.  See
    
    Raphael's avatar
    Raphael a validé
    *   the COPYRIGHT file.
    */
    
      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);
    
    
    danielvincent's avatar
    danielvincent a validé
        /* 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"
      },
    
        selectors: [
          ".add_aspect_button",
          ".manage_aspect_contacts_button",
          ".invite_user_button",
          ".add_photo_button",
          ".remove_person_button",
    
          ".share_with_button",
          ".aspect_detail_button",
          ".aspect_selector_edit"
    
          $("#debug_more").toggle("fast");
        },
        selector: "#debug_info"
      },
    
    
      flashes: {
        animate: function() {
    
          var $this = $(View.flashes.selector);
          $this.animate({
            top: 0
          }).delay(2000).animate({
            top: -100
    
        },
        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
    
            $this.css("left", "1000px");
          });
        },
        selector: ".getting_started_box"
      },
    
      newRequest: {
        submit: function() {
    
          $(this).hide().parent().find(".stream_element").removeClass("hidden");
    
          $(this).addClass("active");
        },
        selector: "#q"
      },
    
        addAspect: {
          bind: function() {
    
            $(".add_aspect_button", "#aspect_nav").tipsy({
              gravity:"w"
            });
          }
        },
    
        avatars: {
    
            $(".contact_pictures img.avatar, #manage_aspect_zones img.avatar").tipsy({
    
        public_badge: {
    
            $(".public_badge img").tipsy({
              live: true
            });
          }
        },
    
    
            if(element !== "bindAll") {
    
      reshareButton: {
        removeFocus: function(evt) {
          var $target = $(evt.target);
          if(!$target.closest(".reshare_pane").length) {
            $(".reshare_button.active").removeClass("active").siblings(".reshare_box").css("display", "none");
          }
        }
      },
    
    
        removeFocus: function(evt) {
    
          var $target = $(evt.target);
          if(!$target.closest("#user_menu").length) {
            $(View.userMenu.selector).removeClass("active");
          }
        },
        selector: "#user_menu"
      },
    
      webFingerForm: {
    
          $(evt.currentTarget).siblings("#loader").show();
          $("#request_result li:first").hide();
        },
        selector: ".webfinger_form"
      }
    
    $(function() {
      /* Make sure this refers to View, not the document */