From 99d7ae36e594a165adf0301df2791233cbb00108 Mon Sep 17 00:00:00 2001 From: Denis Shakhov Date: Fri, 12 Apr 2013 12:57:39 +0700 Subject: [PATCH] Fix tooltips --- templates/framework/js/ui/popup.js | 8 +++++++- templates/framework/js/ui/tooltip.js | 11 ++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/templates/framework/js/ui/popup.js b/templates/framework/js/ui/popup.js index 0f9f05e9..c13f8c4b 100644 --- a/templates/framework/js/ui/popup.js +++ b/templates/framework/js/ui/popup.js @@ -97,7 +97,9 @@ var ls = ls || {}; * @type {Object} */ hooks : { - onInitTarget: false + onInitTarget: false, + onEnter: false, + onLeave: false }, /** @@ -168,6 +170,8 @@ var ls = ls || {}; this.state = 'in'; + if (this.hooks.onEnter) $.proxy(this.hooks.onEnter, this)(); + if ( ! this.options.delay || this.open) { this.show(); } else { @@ -184,6 +188,8 @@ var ls = ls || {}; leave: function () { this.state = 'out'; + if (this.hooks.onLeave) $.proxy(this.hooks.onLeave, this)(); + if ( ! this.options.delay || ! this.timeout ) { this.hide(); } else { diff --git a/templates/framework/js/ui/tooltip.js b/templates/framework/js/ui/tooltip.js index 5731ec42..8f26a939 100644 --- a/templates/framework/js/ui/tooltip.js +++ b/templates/framework/js/ui/tooltip.js @@ -27,7 +27,16 @@ var ls = ls || {}; this.setContent(this.options.content); } - } + }, + + onEnter: function () { + var title = this.$toggle.attr('title'); + if (title) { + this.options.content = title; + this.$toggle.removeAttr('title'); + } + //this.$toggle; + }, } });