mirror of https://github.com/keeweb/keeweb.git
hide tips on lock
This commit is contained in:
parent
2de1515205
commit
35bd1ab3be
|
@ -5,6 +5,7 @@ var Backbone = require('backbone'),
|
|||
|
||||
_.extend(Backbone.View.prototype, {
|
||||
hide: function() {
|
||||
Tip.hideTips(this.$el);
|
||||
return this.toggle(false);
|
||||
},
|
||||
|
||||
|
@ -20,6 +21,9 @@ _.extend(Backbone.View.prototype, {
|
|||
this.$el.toggleClass('hide', !visible);
|
||||
this._hidden = !visible;
|
||||
this.trigger(visible ? 'show' : 'hide');
|
||||
if (!visible) {
|
||||
Tip.hideTips(this.$el);
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
|
@ -42,6 +46,7 @@ _.extend(Backbone.View.prototype, {
|
|||
},
|
||||
|
||||
renderTemplate: function(model, replace) {
|
||||
Tip.hideTips(this.$el);
|
||||
if (replace && replace.plain) {
|
||||
this.$el.html(this.template(model));
|
||||
} else {
|
||||
|
@ -81,6 +86,7 @@ _.extend(Backbone.View.prototype, {
|
|||
try { this.scroll.dispose(); }
|
||||
catch (e) { }
|
||||
}
|
||||
Tip.hideTips(this.$el);
|
||||
this._parentRemove(arguments);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -21,6 +21,7 @@ Tip.prototype.init = function() {
|
|||
return;
|
||||
}
|
||||
this.el.removeAttr('title');
|
||||
this.el.attr('data-title', this.title);
|
||||
this.el.mouseenter(this.mouseenter.bind(this)).mouseleave(this.mouseleave.bind(this));
|
||||
this.el.click(this.mouseleave.bind(this));
|
||||
};
|
||||
|
@ -140,6 +141,18 @@ Tip.createTips = function(container) {
|
|||
container.find('[title]').each(function(ix, el) {
|
||||
var tip = new Tip($(el));
|
||||
tip.init();
|
||||
el._tip = tip;
|
||||
});
|
||||
};
|
||||
|
||||
Tip.hideTips = function(container) {
|
||||
if (!Tip.enabled) {
|
||||
return;
|
||||
}
|
||||
container.find('[data-title]').each(function(ix, el) {
|
||||
if (el._tip) {
|
||||
el._tip.hide();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue