aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.tooltip.js
diff options
context:
space:
mode:
authorjzaefferer <joern.zaefferer@gmail.com>2010-04-01 09:33:25 +0200
committerjzaefferer <joern.zaefferer@gmail.com>2010-04-01 09:33:25 +0200
commit00fdd8bcd9f9e771da46552e7b6fe11c867c9eb9 (patch)
tree27ef61ea33806b1d559fe45e0fa8a55a0a908700 /ui/jquery.ui.tooltip.js
parentdf31e22b9572ef105fc83e130041b1165023a4ac (diff)
downloadjquery-ui-00fdd8bcd9f9e771da46552e7b6fe11c867c9eb9.tar.gz
jquery-ui-00fdd8bcd9f9e771da46552e7b6fe11c867c9eb9.zip
Revert accidental "Merge branch 'tooltip' of github.com:jquery/jquery-ui"
This reverts commit df31e22b9572ef105fc83e130041b1165023a4ac, reversing changes made to ab8d15521785e764a6bf47beee0cfd18929607d3. Need to revert this revert later on when actually merging the tooltip branch into master.
Diffstat (limited to 'ui/jquery.ui.tooltip.js')
-rw-r--r--ui/jquery.ui.tooltip.js145
1 files changed, 0 insertions, 145 deletions
diff --git a/ui/jquery.ui.tooltip.js b/ui/jquery.ui.tooltip.js
deleted file mode 100644
index 166bff407..000000000
--- a/ui/jquery.ui.tooltip.js
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * jQuery UI Tooltip @VERSION
- *
- * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- *
- * http://docs.jquery.com/UI/Tooltip
- *
- * Depends:
- * jquery.ui.core.js
- * jquery.ui.widget.js
- * jquery.ui.position.js
- */
-(function($) {
-
-// role=application on body required for screenreaders to correctly interpret aria attributes
-if( !$(document.body).is('[role]') ){
- $(document.body).attr('role','application');
-}
-
-var increments = 0;
-
-$.widget("ui.tooltip", {
- options: {
- tooltipClass: "ui-widget-content",
- content: function() {
- return $(this).attr("title");
- },
- position: {
- my: "left center",
- at: "right center",
- offset: "15 0"
- }
- },
- _init: function() {
- var self = this;
- this.tooltip = $("<div></div>")
- .attr("id", "ui-tooltip-" + increments++)
- .attr("role", "tooltip")
- .attr("aria-hidden", "true")
- .addClass("ui-tooltip ui-widget ui-corner-all")
- .addClass(this.options.tooltipClass)
- .appendTo(document.body)
- .hide();
- this.tooltipContent = $("<div></div>")
- .addClass("ui-tooltip-content")
- .appendTo(this.tooltip);
- this.opacity = this.tooltip.css("opacity");
- this.element
- .bind("focus.tooltip mouseenter.tooltip", function(event) {
- self.open();
- })
- .bind("blur.tooltip mouseleave.tooltip", function(event) {
- self.close();
- });
- },
-
- enable: function() {
- this.options.disabled = false;
- },
-
- disable: function() {
- this.options.disabled = true;
- },
-
- destroy: function() {
- this.tooltip.remove();
- $.Widget.prototype.destroy.apply(this, arguments);
- },
-
- widget: function() {
- return this.tooltip;
- },
-
- open: function() {
- var target = this.element;
- // already visible? possible when both focus and mouseover events occur
- if (this.current && this.current[0] == target[0])
- return;
- var self = this;
- this.current = target;
- this.currentTitle = target.attr("title");
- var content = this.options.content.call(target[0], function(response) {
- // ignore async responses that come in after the tooltip is already hidden
- if (self.current == target)
- self._show(target, response);
- });
- if (content) {
- self._show(target, content);
- }
- },
-
- _show: function(target, content) {
- if (!content)
- return;
-
- target.attr("title", "");
-
- if (this.options.disabled)
- return;
-
- this.tooltipContent.html(content);
- this.tooltip.css({
- top: 0,
- left: 0
- }).position($.extend(this.options.position, {
- of: target
- }));
-
- this.tooltip.attr("aria-hidden", "false");
- target.attr("aria-describedby", this.tooltip.attr("id"));
-
- if (this.tooltip.is(":animated"))
- this.tooltip.stop().show().fadeTo("normal", this.opacity);
- else
- this.tooltip.is(':visible') ? this.tooltip.fadeTo("normal", this.opacity) : this.tooltip.fadeIn();
-
- this._trigger( "open" );
- },
-
- close: function() {
- if (!this.current)
- return;
-
- var current = this.current.attr("title", this.currentTitle);
- this.current = null;
-
- if (this.options.disabled)
- return;
-
- current.removeAttr("aria-describedby");
- this.tooltip.attr("aria-hidden", "true");
-
- if (this.tooltip.is(':animated'))
- this.tooltip.stop().fadeTo("normal", 0);
- else
- this.tooltip.stop().fadeOut();
-
- this._trigger( "close" );
- }
-
-});
-
-})(jQuery); \ No newline at end of file