angularjs-tooltips
Advanced tools
Comparing version 1.0.4 to 1.0.5
{ | ||
"name": "angular-tooltips", | ||
"description": "Tooltip Directive For AngularJS", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"homepage": "https://github.com/intellipharm/angular-tooltips", | ||
@@ -6,0 +6,0 @@ "repository": { |
@@ -10,2 +10,3 @@ (function() { | ||
fixedPosition: '=', | ||
titleClass: '@', | ||
}, | ||
@@ -19,3 +20,3 @@ link: function ($scope, element, attrs) { | ||
// create the tooltip | ||
$scope.tooltipElement = angular.element('<div>').addClass('angular-tooltip'); | ||
$scope.tooltipElement = angular.element('<div>').addClass('angular-tooltip').addClass($scope.titleClass); | ||
@@ -22,0 +23,0 @@ // append to the body |
@@ -1,1 +0,1 @@ | ||
!function(){"use strict";var t=function(t,o){return{restrict:"A",scope:{title:"@",fixedPosition:"="},link:function(e,i,n){e.createTooltip=function(t){if(n.title||n.tooltip){e.getDirection();e.tooltipElement=angular.element("<div>").addClass("angular-tooltip"),angular.element(document).find("body").append(e.tooltipElement),e.updateTooltip(n.title||n.tooltip),e.tooltipElement.addClass("angular-tooltip-fade-in")}},e.updateTooltip=function(n){e.tooltipElement.html(n),o(e.tooltipElement.contents())(e);var l=e.calculatePosition(e.tooltipElement,e.getDirection());e.tooltipElement.addClass("angular-tooltip-"+l.direction).css(l),t(function(){i.removeAttr("ng-attr-title"),i.removeAttr("title")})},e.$watch("title",function(t){e.tooltipElement&&e.updateTooltip(t)}),e.removeTooltip=function(){angular.element(document.querySelectorAll(".angular-tooltip")).remove()},e.getDirection=function(){return i.attr("tooltip-direction")||i.attr("title-direction")||"top"},e.calculatePosition=function(t,o){var n=t[0].getBoundingClientRect(),l=i[0].getBoundingClientRect(),r=window.scrollX||document.documentElement.scrollLeft,p=window.scrollY||document.documentElement.scrollTop,a={},c=null;return e.stringStartsWith(o,"left")?a.left=l.left-n.width-6+r:e.stringStartsWith(o,"right")?a.left=l.left+l.width+6+r:e.stringContains(o,"left")?a.left=l.left-n.width+12+r:e.stringContains(o,"right")?a.left=l.left+l.width-12+r:a.left=l.left+l.width/2-n.width/2+r,e.stringStartsWith(o,"top")?a.top=l.top-n.height-6+p:e.stringStartsWith(o,"bottom")?a.top=l.top+l.height+6+p:e.stringContains(o,"top")?a.top=l.top-n.height+12+p:e.stringContains(o,"bottom")?a.top=l.top+l.height-12+p:a.top=l.top+l.height/2-n.height/2+p,e.fixedPosition&&(a.left<r?c=o.replace("left","right"):a.left+n.width>window.innerWidth+r&&(c=o.replace("right","left")),a.top<p?c=o.replace("top","bottom"):a.top+n.height>window.innerHeight+p&&(c=o.replace("bottom","top")),c)?e.calculatePosition(t,c):(a.left+="px",a.top+="px",a.direction=o,a)},e.stringStartsWith=function(t,o){return t.substr(0,o.length)===o},e.stringContains=function(t,o){return-1!==t.indexOf(o)},n.title||n.tooltip?(i.on("mouseover",e.createTooltip),i.on("mouseout",e.removeTooltip)):(i.off("mouseover",e.createTooltip),i.off("mouseout",e.removeTooltip)),i.on("destroy",e.removeTooltip),e.$on("$destroy",e.removeTooltip)}}};t.$inject=["$timeout","$compile"],angular.module("tooltips",[]).directive("title",t).directive("tooltip",t)}(); | ||
!function(){"use strict";var t=function(t,o){return{restrict:"A",scope:{title:"@",fixedPosition:"=",titleClass:"@"},link:function(e,i,n){e.createTooltip=function(t){if(n.title||n.tooltip){e.getDirection();e.tooltipElement=angular.element("<div>").addClass("angular-tooltip").addClass(e.titleClass),angular.element(document).find("body").append(e.tooltipElement),e.updateTooltip(n.title||n.tooltip),e.tooltipElement.addClass("angular-tooltip-fade-in")}},e.updateTooltip=function(n){e.tooltipElement.html(n),o(e.tooltipElement.contents())(e);var l=e.calculatePosition(e.tooltipElement,e.getDirection());e.tooltipElement.addClass("angular-tooltip-"+l.direction).css(l),t(function(){i.removeAttr("ng-attr-title"),i.removeAttr("title")})},e.$watch("title",function(t){e.tooltipElement&&e.updateTooltip(t)}),e.removeTooltip=function(){angular.element(document.querySelectorAll(".angular-tooltip")).remove()},e.getDirection=function(){return i.attr("tooltip-direction")||i.attr("title-direction")||"top"},e.calculatePosition=function(t,o){var n=t[0].getBoundingClientRect(),l=i[0].getBoundingClientRect(),r=window.scrollX||document.documentElement.scrollLeft,a=window.scrollY||document.documentElement.scrollTop,p={},s=null;return e.stringStartsWith(o,"left")?p.left=l.left-n.width-6+r:e.stringStartsWith(o,"right")?p.left=l.left+l.width+6+r:e.stringContains(o,"left")?p.left=l.left-n.width+12+r:e.stringContains(o,"right")?p.left=l.left+l.width-12+r:p.left=l.left+l.width/2-n.width/2+r,e.stringStartsWith(o,"top")?p.top=l.top-n.height-6+a:e.stringStartsWith(o,"bottom")?p.top=l.top+l.height+6+a:e.stringContains(o,"top")?p.top=l.top-n.height+12+a:e.stringContains(o,"bottom")?p.top=l.top+l.height-12+a:p.top=l.top+l.height/2-n.height/2+a,e.fixedPosition&&(p.left<r?s=o.replace("left","right"):p.left+n.width>window.innerWidth+r&&(s=o.replace("right","left")),p.top<a?s=o.replace("top","bottom"):p.top+n.height>window.innerHeight+a&&(s=o.replace("bottom","top")),s)?e.calculatePosition(t,s):(p.left+="px",p.top+="px",p.direction=o,p)},e.stringStartsWith=function(t,o){return t.substr(0,o.length)===o},e.stringContains=function(t,o){return-1!==t.indexOf(o)},n.title||n.tooltip?(i.on("mouseover",e.createTooltip),i.on("mouseout",e.removeTooltip)):(i.off("mouseover",e.createTooltip),i.off("mouseout",e.removeTooltip)),i.on("destroy",e.removeTooltip),e.$on("$destroy",e.removeTooltip)}}};t.$inject=["$timeout","$compile"],angular.module("tooltips",[]).directive("title",t).directive("tooltip",t)}(); |
{ | ||
"name": "angularjs-tooltips", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"license": "MIT", | ||
@@ -18,11 +18,11 @@ "main": "dist/angular-tooltips.js", | ||
"gulp": "^3.0.0", | ||
"gulp-autoprefixer": "^4.0.0", | ||
"gulp-changed": "^3.0.0", | ||
"gulp-autoprefixer": "^4.1.0", | ||
"gulp-changed": "^3.2.0", | ||
"gulp-cssmin": "^0.2.0", | ||
"gulp-jscs": "^4.0.0", | ||
"gulp-jshint": "^2.0.0", | ||
"gulp-plumber": "^1.0.1", | ||
"gulp-jscs": "^4.1.0", | ||
"gulp-jshint": "^2.1.0", | ||
"gulp-plumber": "^1.2.0", | ||
"gulp-rename": "^1.2.2", | ||
"gulp-sass": "^3.0.0", | ||
"gulp-scss-lint": "^0.5.0", | ||
"gulp-scss-lint": "^0.6.0", | ||
"gulp-uglify": "^3.0.0", | ||
@@ -32,7 +32,7 @@ "gulp-util": "^3.0.6", | ||
"jshint-stylish": "^2.1.0", | ||
"node-notifier": "^5.0.0", | ||
"node-notifier": "^5.2.1", | ||
"require-dir": "^0.3.0", | ||
"run-sequence": "^2.0.0", | ||
"run-sequence": "^2.2.1", | ||
"vinyl-paths": "^2.0.0" | ||
} | ||
} |
@@ -0,0 +0,0 @@ # angular-tooltips |
@@ -10,2 +10,3 @@ (function() { | ||
fixedPosition: '=', | ||
titleClass: '@', | ||
}, | ||
@@ -19,3 +20,3 @@ link: function ($scope, element, attrs) { | ||
// create the tooltip | ||
$scope.tooltipElement = angular.element('<div>').addClass('angular-tooltip'); | ||
$scope.tooltipElement = angular.element('<div>').addClass('angular-tooltip').addClass($scope.titleClass); | ||
@@ -22,0 +23,0 @@ // append to the body |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
63628
604
29