B2G/gecko/browser/components/tabview/groupitems.js
// Makes the affordance for undo a close group action
Makes the affordance for undo a close group action
Makes the affordance for undo a close group action
function GroupItem__createUndoButton() {
    let self = this;
    this.$undoContainer = iQ("<div/>")
      .addClass("undo")
      .attr("type", "button")
      .attr("data-group-id", this.id)
      .appendTo("body");
    iQ("<span/>")
      .text(tabviewString("groupItem.undoCloseGroup"))
      .appendTo(this.$undoContainer);
    let undoClose = iQ("<span/>")
      .addClass("close")
      .attr("title", tabviewString("groupItem.discardClosedGroup"))
      .appendTo(this.$undoContainer);
    this.$undoContainer.css({
      left: this.bounds.left + this.bounds.width/2 - iQ(self.$undoContainer).width()/2,
      top:  this.bounds.top + this.bounds.height/2 - iQ(self.$undoContainer).height()/2,
      "transform": "scale(.1)",
      opacity: 0
    });
    this.hidden = true;
    setTimeout(function() {
      self.$undoContainer.animate({
        "transform": "scale(1)",
        "opacity": 1
      }, {
        easing: "tabviewBounce",
        duration: 170,
        complete: function() {
          self._sendToSubscribers("groupHidden");
        }
      });
    }, 50);
    this.$undoContainer.click(function(e) {
      if (e.target == undoClose[0])
        return;
      self.$undoContainer.fadeOut(function() { self._unhide(); });
    });
    undoClose.click(function() {
      self.$undoContainer.fadeOut(function() { self.closeHidden(); });
    });
    this.setupFadeAwayUndoButtonTimer();
    this.$undoContainer.mouseover(function() { 
      self._cancelFadeAwayUndoButtonTimer();
    });
    this.$undoContainer.mouseout(function() {
      self.setupFadeAwayUndoButtonTimer();
    });
    GroupItems.updateGroupCloseButtons();
  }
function GroupItem__createUndoButton ( ) { let self = this ; this . $undoContainer = iQ ( "<div/>" ) . addClass ( "undo" ) . attr ( "type" , "button" ) . attr ( "data-group-id" , this . id ) . appendTo ( "body" ) ; iQ ( "<span/>" ) . text ( tabviewString ( "groupItem.undoCloseGroup" ) ) . appendTo ( this . $undoContainer ) ; let undoClose = iQ ( "<span/>" ) . addClass ( "close" ) . attr ( "title" , tabviewString ( "groupItem.discardClosedGroup" ) ) . appendTo ( this . $undoContainer ) ; this . $undoContainer . css ( { left : this . bounds . left + this . bounds . width / 2 - iQ ( self . $undoContainer ) . width ( ) / 2 , top : this . bounds . top + this . bounds . height / 2 - iQ ( self . $undoContainer ) . height ( ) / 2 , "transform" : "scale(.1)" , opacity : 0 } ) ; this . hidden = true ; setTimeout ( function ( ) { self . $undoContainer . animate ( { "transform" : "scale(1)" , "opacity" : 1 } , { easing : "tabviewBounce" , duration : 170 , complete : function ( ) { self . _sendToSubscribers ( "groupHidden" ) ; } } ) ; } , 50 ) ; this . $undoContainer . click ( function ( e ) { if ( e . target == undoClose [ 0 ] ) return ; self . $undoContainer . fadeOut ( function ( ) { self . _unhide ( ) ; } ) ; } ) ; undoClose . click ( function ( ) { self . $undoContainer . fadeOut ( function ( ) { self . closeHidden ( ) ; } ) ; } ) ; this . setupFadeAwayUndoButtonTimer ( ) ; this . $undoContainer . mouseover ( function ( ) { self . _cancelFadeAwayUndoButtonTimer ( ) ; } ) ; this . $undoContainer . mouseout ( function ( ) { self . setupFadeAwayUndoButtonTimer ( ) ; } ) ; GroupItems . updateGroupCloseButtons ( ) ; }
Makes the affordance for undo a close group action
Makes the affordance for undo a close group action
// hide group item and show undo container. // add click handlers // don't do anything if the close button is clicked. // Cancel the fadeaway if you move the mouse over the undo // button, and restart the countdown once you move out of it.