mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-01 14:45:29 +00:00
Cleaned up the interaction around naming a group.
+ Animation on changing the default name + Appropriate color changes + Only show the input box on hover
This commit is contained in:
parent
87d1a2df16
commit
22cf8d5cfb
@ -94,29 +94,36 @@ window.Group = function(listOfEls, options) {
|
|||||||
var titleUnfocus = function() {
|
var titleUnfocus = function() {
|
||||||
if(!self.getTitle()) {
|
if(!self.getTitle()) {
|
||||||
self.$title
|
self.$title
|
||||||
.css({
|
.addClass("defaultName")
|
||||||
fontStyle: 'italic',
|
.val(self.defaultName);
|
||||||
backgroundImage: 'url(img/edit.png)',
|
} else {
|
||||||
paddingLeft: 15
|
self.$title.css({"background":"none"})
|
||||||
})
|
.animate({"paddingLeft":1, "easing":"linear"}, 340);
|
||||||
.val('group name');
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var handleKeyPress = function(e){
|
||||||
|
if( e.which == 13 ) { // return
|
||||||
|
self.$title.blur()
|
||||||
|
.addClass("transparentBorder")
|
||||||
|
.one("mouseout", function(){
|
||||||
|
self.$title.removeClass("transparentBorder");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.$title = $('.name', this.$titlebar)
|
this.$title = $('.name', this.$titlebar)
|
||||||
.css({backgroundRepeat: 'no-repeat'})
|
.css({backgroundRepeat: 'no-repeat'})
|
||||||
.blur(titleUnfocus)
|
.blur(titleUnfocus)
|
||||||
.focus(function() {
|
.focus(function() {
|
||||||
|
self.$title.select();
|
||||||
if(!self.getTitle()) {
|
if(!self.getTitle()) {
|
||||||
self.$title
|
self.$title
|
||||||
.css({
|
.removeClass("defaultName")
|
||||||
fontStyle: 'normal',
|
|
||||||
backgroundImage: '',
|
|
||||||
paddingLeft: 0
|
|
||||||
})
|
|
||||||
.val('');
|
.val('');
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
.keydown(handleKeyPress);
|
||||||
|
|
||||||
titleUnfocus();
|
titleUnfocus();
|
||||||
|
|
||||||
@ -160,11 +167,14 @@ window.Group = function(listOfEls, options) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// ----------
|
// ----------
|
||||||
window.Group.prototype = $.extend(new Item(), new Subscribable(), {
|
window.Group.prototype = $.extend(new Item(), new Subscribable(), {
|
||||||
|
// ----------
|
||||||
|
defaultName: "name this group...",
|
||||||
|
|
||||||
// ----------
|
// ----------
|
||||||
getTitle: function() {
|
getTitle: function() {
|
||||||
var value = (this.$title ? this.$title.val() : '');
|
var value = (this.$title ? this.$title.val() : '');
|
||||||
return (value == 'group name' ? '' : value);
|
return (value == this.defaultName ? '' : value);
|
||||||
},
|
},
|
||||||
|
|
||||||
// ----------
|
// ----------
|
||||||
|
BIN
browser/themes/pinstripe/browser/tabcandy/edit-light.png
Normal file
BIN
browser/themes/pinstripe/browser/tabcandy/edit-light.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 46 KiB |
Binary file not shown.
Before Width: | Height: | Size: 357 B After Width: | Height: | Size: 46 KiB |
@ -161,10 +161,34 @@ body {
|
|||||||
|
|
||||||
input.name{
|
input.name{
|
||||||
background: transparent;
|
background: transparent;
|
||||||
border: 1px solid #ddd;
|
border: 1px solid transparent;
|
||||||
color: #999;
|
color: #999;
|
||||||
margin: 3px 0px 0px 3px;
|
margin: 3px 0px 0px 3px;
|
||||||
padding: 1px;
|
padding: 1px;
|
||||||
|
background-image: url(../img/edit-light.png);
|
||||||
|
padding-left: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
input.name:hover{
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
}
|
||||||
|
|
||||||
|
input.name:focus{
|
||||||
|
color: #555;
|
||||||
|
}
|
||||||
|
|
||||||
|
input.defaultName{
|
||||||
|
font-style: italic !important;
|
||||||
|
background-image-opacity: .1;
|
||||||
|
color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
input.defaultName:hover{
|
||||||
|
color: #CCC;
|
||||||
|
}
|
||||||
|
|
||||||
|
.transparentBorder{
|
||||||
|
border: 1px solid transparent !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Resizable
|
/* Resizable
|
||||||
|
Loading…
Reference in New Issue
Block a user