Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@atlassian/tipsy

Package Overview
Dependencies
Maintainers
29
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@atlassian/tipsy - npm Package Compare versions

Comparing version 1.3.2 to 1.3.3

5

package.json
{
"name": "@atlassian/tipsy",
"version": "1.3.2",
"version": "1.3.3",
"description": "Atlassian fork of tipsy",

@@ -18,5 +18,2 @@ "browser": "src/javascripts/jquery.tipsy.js",

},
"publishConfig": {
"registry": "https://registry.npmjs.com/"
},
"keywords": [

@@ -23,0 +20,0 @@ "tipsy"

218

src/javascripts/jquery.tipsy.js

@@ -45,126 +45,128 @@ // tipsy, facebook style tooltips for jquery

var title = this.getTitle();
if (title && this.enabled) {
var $tip = this.tip();
if (!title || !this.enabled) {
return;
}
var $tip = this.tip();
$tip.find(".tipsy-inner")[this.options.html ? "html" : "text"](
title
);
$tip[0].className = "tipsy"; // reset classname in case of dynamic gravity
$tip.remove()
.css({
top: 0,
left: 0,
visibility: "hidden",
display: "block"
})
.appendTo(document.body);
$tip.find(".tipsy-inner")[this.options.html ? "html" : "text"](
title
);
$tip[0].className = "tipsy"; // reset classname in case of dynamic gravity
$tip.remove()
.css({
top: 0,
left: 0,
visibility: "hidden",
display: "block"
})
.appendTo(document.body);
var that = this;
function tipOver() {
that.hoverTooltip = true;
var that = this;
function tipOver() {
that.hoverTooltip = true;
}
function tipOut() {
if (that.hoverState == "in") return; // If field is still focused.
that.hoverTooltip = false;
if (that.options.trigger != "manual") {
var eventOut =
that.options.trigger == "hover"
? "mouseleave.tipsy"
: "blur.tipsy";
that.$element.trigger(eventOut);
}
function tipOut() {
if (that.hoverState == "in") return; // If field is still focused.
that.hoverTooltip = false;
if (that.options.trigger != "manual") {
var eventOut =
that.options.trigger == "hover"
? "mouseleave.tipsy"
: "blur.tipsy";
that.$element.trigger(eventOut);
}
}
}
if (this.options.hoverable) {
$tip.hover(tipOver, tipOut);
}
if (this.options.hoverable) {
$tip.hover(tipOver, tipOut);
}
if (this.options.className) {
$tip.addClass(
maybeCall(this.options.className, this.$element[0])
);
}
if (this.options.className) {
$tip.addClass(
maybeCall(this.options.className, this.$element[0])
);
}
var pos = $.extend({}, this.$element.offset(), {
width: this.$element[0].getBoundingClientRect().width,
height: this.$element[0].getBoundingClientRect().height
});
var pos = $.extend({}, this.$element.offset(), {
width: this.$element[0].getBoundingClientRect().width,
height: this.$element[0].getBoundingClientRect().height
});
var tipCss = {};
var actualWidth = $tip[0].offsetWidth,
actualHeight = $tip[0].offsetHeight;
var gravity = maybeCall(this.options.gravity, this.$element[0]);
var tipCss = {};
var actualWidth = $tip[0].offsetWidth,
actualHeight = $tip[0].offsetHeight;
var gravity = maybeCall(this.options.gravity, this.$element[0]);
if (gravity.length === 2) {
if (gravity.charAt(1) === "w") {
tipCss.left = pos.left + pos.width / 2 - 15;
} else {
tipCss.left =
pos.left + pos.width / 2 - actualWidth + 15;
}
if (gravity.length === 2) {
if (gravity.charAt(1) === "w") {
tipCss.left = pos.left + pos.width / 2 - 15;
} else {
tipCss.left =
pos.left + pos.width / 2 - actualWidth + 15;
}
}
switch (gravity.charAt(0)) {
case "n":
// left could already be set if gravity is 'nw' or 'ne'
if (typeof tipCss.left === "undefined") {
tipCss.left =
pos.left + pos.width / 2 - actualWidth / 2;
}
tipCss.top = pos.top + pos.height + this.options.offset;
break;
case "s":
// left could already be set if gravity is 'sw' or 'se'
if (typeof tipCss.left === "undefined") {
tipCss.left =
pos.left + pos.width / 2 - actualWidth / 2;
// We need to apply the left positioning and then recalculate the tooltip height
// If the tooltip is positioned close to the right edge of the window, it could cause
// the tooltip text to overflow and change height.
$tip.css(tipCss);
actualHeight = $tip[0].offsetHeight;
}
tipCss.top =
pos.top - actualHeight - this.options.offset;
break;
case "e":
switch (gravity.charAt(0)) {
case "n":
// left could already be set if gravity is 'nw' or 'ne'
if (typeof tipCss.left === "undefined") {
tipCss.left =
pos.left - actualWidth - this.options.offset;
tipCss.top =
pos.top + pos.height / 2 - actualHeight / 2;
break;
case "w":
pos.left + pos.width / 2 - actualWidth / 2;
}
tipCss.top = pos.top + pos.height + this.options.offset;
break;
case "s":
// left could already be set if gravity is 'sw' or 'se'
if (typeof tipCss.left === "undefined") {
tipCss.left =
pos.left + pos.width + this.options.offset;
tipCss.top =
pos.top + pos.height / 2 - actualHeight / 2;
break;
}
pos.left + pos.width / 2 - actualWidth / 2;
$tip.css(tipCss).addClass("tipsy-" + gravity);
$tip.find(".tipsy-arrow")[0].className =
"tipsy-arrow tipsy-arrow-" + gravity.charAt(0);
// We need to apply the left positioning and then recalculate the tooltip height
// If the tooltip is positioned close to the right edge of the window, it could cause
// the tooltip text to overflow and change height.
$tip.css(tipCss);
actualHeight = $tip[0].offsetHeight;
}
tipCss.top =
pos.top - actualHeight - this.options.offset;
break;
case "e":
tipCss.left =
pos.left - actualWidth - this.options.offset;
tipCss.top =
pos.top + pos.height / 2 - actualHeight / 2;
break;
case "w":
tipCss.left =
pos.left + pos.width + this.options.offset;
tipCss.top =
pos.top + pos.height / 2 - actualHeight / 2;
break;
}
if (this.options.fade) {
$tip.stop()
.css({
opacity: 0,
display: "block",
visibility: "visible"
})
.animate({ opacity: this.options.opacity });
} else {
$tip.css({
visibility: "visible",
opacity: this.options.opacity
});
}
$tip.css(tipCss).addClass("tipsy-" + gravity);
$tip.find(".tipsy-arrow")[0].className =
"tipsy-arrow tipsy-arrow-" + gravity.charAt(0);
if (this.options.aria) {
var $tipID = tipsyID();
$tip.attr("id", $tipID);
this.$element.attr("aria-describedby", $tipID);
}
if (this.options.fade) {
$tip.stop()
.css({
opacity: 0,
display: "block",
visibility: "visible"
})
.animate({ opacity: this.options.opacity });
} else {
$tip.css({
visibility: "visible",
opacity: this.options.opacity
});
}
if (this.options.aria) {
var $tipID = tipsyID();
$tip.attr("id", $tipID);
this.$element.attr("aria-describedby", $tipID);
}
},

@@ -171,0 +173,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc