mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-01 14:45:29 +00:00
+ The first time you run TabCandy, it lays all of the tabs out in a grid (just like it used to; reinstating this feature)
+ Minor refactor for new tab button to make it more DRY
This commit is contained in:
parent
f6eac0953a
commit
c09847b1f5
@ -655,6 +655,22 @@ window.Group.prototype = $.extend(new Item(), new Subscribable(), {
|
||||
});
|
||||
},
|
||||
|
||||
// ----------
|
||||
setNewTabButtonBounds: function(box, immediately) {
|
||||
var css = {
|
||||
left: box.left,
|
||||
top: box.top,
|
||||
width: box.width,
|
||||
height: box.height
|
||||
};
|
||||
|
||||
this.$ntb.stop(true, true);
|
||||
if(!immediately)
|
||||
this.$ntb.animate(css, 320, "tabcandyBounce");
|
||||
else
|
||||
this.$ntb.css(css);
|
||||
},
|
||||
|
||||
// ----------
|
||||
shouldStack: function(count) {
|
||||
if(count <= 1)
|
||||
@ -722,19 +738,7 @@ window.Group.prototype = $.extend(new Item(), new Subscribable(), {
|
||||
var box = rects[rects.length - 1];
|
||||
box.left -= this.bounds.left;
|
||||
box.top -= this.bounds.top;
|
||||
var css = {
|
||||
left: box.left,
|
||||
top: box.top,
|
||||
width: box.width,
|
||||
height: box.height
|
||||
};
|
||||
|
||||
this.$ntb.stop(true, true);
|
||||
if(animate)
|
||||
this.$ntb.animate(css, 320, "tabcandyBounce");
|
||||
else {
|
||||
this.$ntb.css(css);
|
||||
}
|
||||
this.setNewTabButtonBounds(box, !animate);
|
||||
}
|
||||
|
||||
this._isStacked = false;
|
||||
@ -805,19 +809,7 @@ window.Group.prototype = $.extend(new Item(), new Subscribable(), {
|
||||
box.left += box.width + newTabsPad;
|
||||
box.left -= this.bounds.left;
|
||||
box.top -= this.bounds.top;
|
||||
var css = {
|
||||
left: box.left,
|
||||
top: box.top,
|
||||
width: box.width,
|
||||
height: box.height
|
||||
};
|
||||
|
||||
this.$ntb.stop(true, true);
|
||||
if(animate)
|
||||
this.$ntb.animate(css);
|
||||
else {
|
||||
this.$ntb.css(css);
|
||||
}
|
||||
this.setNewTabButtonBounds(box, !animate);
|
||||
}
|
||||
|
||||
self._isStacked = true;
|
||||
|
@ -565,15 +565,30 @@ UIClass.prototype = {
|
||||
|
||||
// ___ Storage
|
||||
var currentWindow = Utils.getCurrentWindow();
|
||||
|
||||
var data = Storage.readUIData(currentWindow);
|
||||
this.storageSanity(data);
|
||||
|
||||
var groupsData = Storage.readGroupsData(currentWindow);
|
||||
var firstTime = !groupsData || $.isEmptyObject(groupsData);
|
||||
var groupData = Storage.readGroupData(currentWindow);
|
||||
Groups.reconstitute(groupsData, groupData);
|
||||
|
||||
TabItems.init();
|
||||
TabItems.reconstitute();
|
||||
|
||||
if(firstTime) {
|
||||
var items = TabItems.getItems();
|
||||
$.each(items, function(index, item) {
|
||||
if(item.parent)
|
||||
item.parent.remove(item);
|
||||
});
|
||||
|
||||
var box = Items.getPageBounds();
|
||||
box.inset(10, 10);
|
||||
var options = {padding: 10};
|
||||
Items.arrange(items, box, options);
|
||||
} else
|
||||
TabItems.reconstitute();
|
||||
|
||||
// ___ resizing
|
||||
if(data.pageBounds) {
|
||||
|
Loading…
Reference in New Issue
Block a user