mirror of
https://github.com/arnaucube/commonroutesApp.git
synced 2026-02-07 11:36:42 +01:00
geolocation added on offerCar and travel page
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
/*!
|
||||
* Angular Material Design
|
||||
* https://github.com/angular/material
|
||||
* @license MIT
|
||||
* v1.1.1
|
||||
*/
|
||||
md-tooltip.md-THEME_NAME-theme {
|
||||
color: '{{background-700-contrast}}'; }
|
||||
md-tooltip.md-THEME_NAME-theme .md-content {
|
||||
background-color: '{{background-700}}'; }
|
||||
6
www/lib/angular-material/modules/closure/tooltip/tooltip-default-theme.min.css
vendored
Normal file
6
www/lib/angular-material/modules/closure/tooltip/tooltip-default-theme.min.css
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
/*!
|
||||
* Angular Material Design
|
||||
* https://github.com/angular/material
|
||||
* @license MIT
|
||||
* v1.1.0-master-2b98560
|
||||
*/md-tooltip.md-THEME_NAME-theme{color:'{{background-700-contrast}}'}md-tooltip.md-THEME_NAME-theme .md-content{background-color:'{{background-700}}'}
|
||||
67
www/lib/angular-material/modules/closure/tooltip/tooltip.css
Normal file
67
www/lib/angular-material/modules/closure/tooltip/tooltip.css
Normal file
@@ -0,0 +1,67 @@
|
||||
/*!
|
||||
* Angular Material Design
|
||||
* https://github.com/angular/material
|
||||
* @license MIT
|
||||
* v1.1.1
|
||||
*/
|
||||
md-tooltip {
|
||||
position: absolute;
|
||||
z-index: 100;
|
||||
overflow: hidden;
|
||||
pointer-events: none;
|
||||
border-radius: 4px;
|
||||
font-weight: 500;
|
||||
font-size: 14px; }
|
||||
@media (min-width: 960px) {
|
||||
md-tooltip {
|
||||
font-size: 10px; } }
|
||||
md-tooltip .md-content {
|
||||
position: relative;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
-webkit-transform-origin: center top;
|
||||
transform-origin: center top;
|
||||
-webkit-transform: scale(0);
|
||||
transform: scale(0);
|
||||
opacity: 0;
|
||||
height: 32px;
|
||||
line-height: 32px;
|
||||
padding-left: 16px;
|
||||
padding-right: 16px; }
|
||||
@media (min-width: 960px) {
|
||||
md-tooltip .md-content {
|
||||
height: 22px;
|
||||
line-height: 22px;
|
||||
padding-left: 8px;
|
||||
padding-right: 8px; } }
|
||||
md-tooltip .md-content.md-show-add {
|
||||
-webkit-transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
|
||||
transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
|
||||
-webkit-transition-duration: .2s;
|
||||
transition-duration: .2s;
|
||||
-webkit-transform: scale(0);
|
||||
transform: scale(0);
|
||||
opacity: 0; }
|
||||
md-tooltip .md-content.md-show, md-tooltip .md-content.md-show-add-active {
|
||||
-webkit-transform: scale(1);
|
||||
transform: scale(1);
|
||||
opacity: 0.9;
|
||||
-webkit-transform-origin: center top;
|
||||
transform-origin: center top; }
|
||||
md-tooltip .md-content.md-show-remove {
|
||||
-webkit-transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
|
||||
transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
|
||||
-webkit-transition-duration: .2s;
|
||||
transition-duration: .2s; }
|
||||
md-tooltip .md-content.md-show-remove.md-show-remove-active {
|
||||
-webkit-transform: scale(0);
|
||||
transform: scale(0);
|
||||
opacity: 0; }
|
||||
md-tooltip.md-hide {
|
||||
-webkit-transition: all 0.3s cubic-bezier(0.55, 0, 0.55, 0.2);
|
||||
transition: all 0.3s cubic-bezier(0.55, 0, 0.55, 0.2); }
|
||||
md-tooltip.md-show {
|
||||
-webkit-transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
|
||||
transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
|
||||
pointer-events: auto; }
|
||||
399
www/lib/angular-material/modules/closure/tooltip/tooltip.js
vendored
Normal file
399
www/lib/angular-material/modules/closure/tooltip/tooltip.js
vendored
Normal file
@@ -0,0 +1,399 @@
|
||||
/*!
|
||||
* Angular Material Design
|
||||
* https://github.com/angular/material
|
||||
* @license MIT
|
||||
* v1.1.1
|
||||
*/
|
||||
goog.provide('ngmaterial.components.tooltip');
|
||||
goog.require('ngmaterial.core');
|
||||
/**
|
||||
* @ngdoc module
|
||||
* @name material.components.tooltip
|
||||
*/
|
||||
MdTooltipDirective.$inject = ["$timeout", "$window", "$$rAF", "$document", "$mdUtil", "$mdTheming", "$rootElement", "$animate", "$q", "$interpolate"];
|
||||
angular
|
||||
.module('material.components.tooltip', [ 'material.core' ])
|
||||
.directive('mdTooltip', MdTooltipDirective);
|
||||
|
||||
/**
|
||||
* @ngdoc directive
|
||||
* @name mdTooltip
|
||||
* @module material.components.tooltip
|
||||
* @description
|
||||
* Tooltips are used to describe elements that are interactive and primarily graphical (not textual).
|
||||
*
|
||||
* Place a `<md-tooltip>` as a child of the element it describes.
|
||||
*
|
||||
* A tooltip will activate when the user focuses, hovers over, or touches the parent.
|
||||
*
|
||||
* @usage
|
||||
* <hljs lang="html">
|
||||
* <md-button class="md-fab md-accent" aria-label="Play">
|
||||
* <md-tooltip>
|
||||
* Play Music
|
||||
* </md-tooltip>
|
||||
* <md-icon icon="img/icons/ic_play_arrow_24px.svg"></md-icon>
|
||||
* </md-button>
|
||||
* </hljs>
|
||||
*
|
||||
* @param {expression=} md-visible Boolean bound to whether the tooltip is currently visible.
|
||||
* @param {number=} md-delay How many milliseconds to wait to show the tooltip after the user focuses, hovers, or touches the
|
||||
* parent. Defaults to 0ms on non-touch devices and 75ms on touch.
|
||||
* @param {boolean=} md-autohide If present or provided with a boolean value, the tooltip will hide on mouse leave, regardless of focus
|
||||
* @param {string=} md-direction Which direction would you like the tooltip to go? Supports left, right, top, and bottom. Defaults to bottom.
|
||||
*/
|
||||
function MdTooltipDirective($timeout, $window, $$rAF, $document, $mdUtil, $mdTheming, $rootElement,
|
||||
$animate, $q, $interpolate) {
|
||||
|
||||
var ENTER_EVENTS = 'focus touchstart mouseenter';
|
||||
var LEAVE_EVENTS = 'blur touchcancel mouseleave';
|
||||
var SHOW_CLASS = 'md-show';
|
||||
var TOOLTIP_SHOW_DELAY = 0;
|
||||
var TOOLTIP_WINDOW_EDGE_SPACE = 8;
|
||||
|
||||
return {
|
||||
restrict: 'E',
|
||||
transclude: true,
|
||||
priority: 210, // Before ngAria
|
||||
template: '<div class="md-content _md" ng-transclude></div>',
|
||||
scope: {
|
||||
delay: '=?mdDelay',
|
||||
visible: '=?mdVisible',
|
||||
autohide: '=?mdAutohide',
|
||||
direction: '@?mdDirection' // only expect raw or interpolated string value; not expression
|
||||
},
|
||||
compile: function(tElement, tAttr) {
|
||||
if (!tAttr.mdDirection) {
|
||||
tAttr.$set('mdDirection', 'bottom');
|
||||
}
|
||||
|
||||
return postLink;
|
||||
}
|
||||
};
|
||||
|
||||
function postLink(scope, element, attr) {
|
||||
|
||||
$mdTheming(element);
|
||||
|
||||
var parent = $mdUtil.getParentWithPointerEvents(element),
|
||||
content = angular.element(element[0].getElementsByClassName('md-content')[0]),
|
||||
tooltipParent = angular.element(document.body),
|
||||
showTimeout = null,
|
||||
debouncedOnResize = $$rAF.throttle(function () { updatePosition(); });
|
||||
|
||||
if ($animate.pin) $animate.pin(element, parent);
|
||||
|
||||
// Initialize element
|
||||
|
||||
setDefaults();
|
||||
manipulateElement();
|
||||
bindEvents();
|
||||
|
||||
// Default origin transform point is 'center top'
|
||||
// positionTooltip() is always relative to center top
|
||||
updateContentOrigin();
|
||||
|
||||
configureWatchers();
|
||||
addAriaLabel();
|
||||
|
||||
|
||||
function setDefaults () {
|
||||
scope.delay = scope.delay || TOOLTIP_SHOW_DELAY;
|
||||
}
|
||||
|
||||
function updateContentOrigin() {
|
||||
var origin = 'center top';
|
||||
switch (scope.direction) {
|
||||
case 'left' : origin = 'right center'; break;
|
||||
case 'right' : origin = 'left center'; break;
|
||||
case 'top' : origin = 'center bottom'; break;
|
||||
case 'bottom': origin = 'center top'; break;
|
||||
}
|
||||
content.css('transform-origin', origin);
|
||||
}
|
||||
|
||||
function onVisibleChanged (isVisible) {
|
||||
if (isVisible) showTooltip();
|
||||
else hideTooltip();
|
||||
}
|
||||
|
||||
function configureWatchers () {
|
||||
if (element[0] && 'MutationObserver' in $window) {
|
||||
var attributeObserver = new MutationObserver(function(mutations) {
|
||||
mutations
|
||||
.forEach(function (mutation) {
|
||||
if (mutation.attributeName === 'md-visible') {
|
||||
if (!scope.visibleWatcher)
|
||||
scope.visibleWatcher = scope.$watch('visible', onVisibleChanged );
|
||||
}
|
||||
if (mutation.attributeName === 'md-direction') {
|
||||
updatePosition(scope.direction);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
attributeObserver.observe(element[0], { attributes: true });
|
||||
|
||||
// build watcher only if mdVisible is being used
|
||||
if (attr.hasOwnProperty('mdVisible')) {
|
||||
scope.visibleWatcher = scope.$watch('visible', onVisibleChanged );
|
||||
}
|
||||
} else { // MutationObserver not supported
|
||||
scope.visibleWatcher = scope.$watch('visible', onVisibleChanged );
|
||||
scope.$watch('direction', updatePosition );
|
||||
}
|
||||
|
||||
var onElementDestroy = function() {
|
||||
scope.$destroy();
|
||||
};
|
||||
|
||||
// Clean up if the element or parent was removed via jqLite's .remove.
|
||||
// A couple of notes:
|
||||
// - In these cases the scope might not have been destroyed, which is why we
|
||||
// destroy it manually. An example of this can be having `md-visible="false"` and
|
||||
// adding tooltips while they're invisible. If `md-visible` becomes true, at some
|
||||
// point, you'd usually get a lot of inputs.
|
||||
// - We use `.one`, not `.on`, because this only needs to fire once. If we were
|
||||
// using `.on`, it would get thrown into an infinite loop.
|
||||
// - This kicks off the scope's `$destroy` event which finishes the cleanup.
|
||||
element.one('$destroy', onElementDestroy);
|
||||
parent.one('$destroy', onElementDestroy);
|
||||
scope.$on('$destroy', function() {
|
||||
setVisible(false);
|
||||
element.remove();
|
||||
attributeObserver && attributeObserver.disconnect();
|
||||
});
|
||||
|
||||
// Updates the aria-label when the element text changes. This watch
|
||||
// doesn't need to be set up if the element doesn't have any data
|
||||
// bindings.
|
||||
if (element.text().indexOf($interpolate.startSymbol()) > -1) {
|
||||
scope.$watch(function() {
|
||||
return element.text().trim();
|
||||
}, addAriaLabel);
|
||||
}
|
||||
}
|
||||
|
||||
function addAriaLabel (override) {
|
||||
if ((override || !parent.attr('aria-label')) && !parent.text().trim()) {
|
||||
var rawText = override || element.text().trim();
|
||||
var interpolatedText = $interpolate(rawText)(parent.scope());
|
||||
parent.attr('aria-label', interpolatedText);
|
||||
}
|
||||
}
|
||||
|
||||
function manipulateElement () {
|
||||
element.detach();
|
||||
element.attr('role', 'tooltip');
|
||||
}
|
||||
|
||||
function bindEvents () {
|
||||
var mouseActive = false;
|
||||
|
||||
// add an mutationObserver when there is support for it
|
||||
// and the need for it in the form of viable host(parent[0])
|
||||
if (parent[0] && 'MutationObserver' in $window) {
|
||||
// use an mutationObserver to tackle #2602
|
||||
var attributeObserver = new MutationObserver(function(mutations) {
|
||||
if (mutations.some(function (mutation) {
|
||||
return (mutation.attributeName === 'disabled' && parent[0].disabled);
|
||||
})) {
|
||||
$mdUtil.nextTick(function() {
|
||||
setVisible(false);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
attributeObserver.observe(parent[0], { attributes: true});
|
||||
}
|
||||
|
||||
// Store whether the element was focused when the window loses focus.
|
||||
var windowBlurHandler = function() {
|
||||
elementFocusedOnWindowBlur = document.activeElement === parent[0];
|
||||
};
|
||||
var elementFocusedOnWindowBlur = false;
|
||||
|
||||
function windowScrollHandler() {
|
||||
setVisible(false);
|
||||
}
|
||||
|
||||
angular.element($window)
|
||||
.on('blur', windowBlurHandler)
|
||||
.on('resize', debouncedOnResize);
|
||||
|
||||
document.addEventListener('scroll', windowScrollHandler, true);
|
||||
scope.$on('$destroy', function() {
|
||||
angular.element($window)
|
||||
.off('blur', windowBlurHandler)
|
||||
.off('resize', debouncedOnResize);
|
||||
|
||||
parent
|
||||
.off(ENTER_EVENTS, enterHandler)
|
||||
.off(LEAVE_EVENTS, leaveHandler)
|
||||
.off('mousedown', mousedownHandler);
|
||||
|
||||
// Trigger the handler in case any the tooltip was still visible.
|
||||
leaveHandler();
|
||||
document.removeEventListener('scroll', windowScrollHandler, true);
|
||||
attributeObserver && attributeObserver.disconnect();
|
||||
});
|
||||
|
||||
var enterHandler = function(e) {
|
||||
// Prevent the tooltip from showing when the window is receiving focus.
|
||||
if (e.type === 'focus' && elementFocusedOnWindowBlur) {
|
||||
elementFocusedOnWindowBlur = false;
|
||||
} else if (!scope.visible) {
|
||||
parent.on(LEAVE_EVENTS, leaveHandler);
|
||||
setVisible(true);
|
||||
|
||||
// If the user is on a touch device, we should bind the tap away after
|
||||
// the `touched` in order to prevent the tooltip being removed immediately.
|
||||
if (e.type === 'touchstart') {
|
||||
parent.one('touchend', function() {
|
||||
$mdUtil.nextTick(function() {
|
||||
$document.one('touchend', leaveHandler);
|
||||
}, false);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
var leaveHandler = function () {
|
||||
var autohide = scope.hasOwnProperty('autohide') ? scope.autohide : attr.hasOwnProperty('mdAutohide');
|
||||
|
||||
if (autohide || mouseActive || $document[0].activeElement !== parent[0]) {
|
||||
// When a show timeout is currently in progress, then we have to cancel it.
|
||||
// Otherwise the tooltip will remain showing without focus or hover.
|
||||
if (showTimeout) {
|
||||
$timeout.cancel(showTimeout);
|
||||
setVisible.queued = false;
|
||||
showTimeout = null;
|
||||
}
|
||||
|
||||
parent.off(LEAVE_EVENTS, leaveHandler);
|
||||
parent.triggerHandler('blur');
|
||||
setVisible(false);
|
||||
}
|
||||
mouseActive = false;
|
||||
};
|
||||
var mousedownHandler = function() {
|
||||
mouseActive = true;
|
||||
};
|
||||
|
||||
// to avoid `synthetic clicks` we listen to mousedown instead of `click`
|
||||
parent.on('mousedown', mousedownHandler);
|
||||
parent.on(ENTER_EVENTS, enterHandler);
|
||||
}
|
||||
|
||||
function setVisible (value) {
|
||||
// break if passed value is already in queue or there is no queue and passed value is current in the scope
|
||||
if (setVisible.queued && setVisible.value === !!value || !setVisible.queued && scope.visible === !!value) return;
|
||||
setVisible.value = !!value;
|
||||
|
||||
if (!setVisible.queued) {
|
||||
if (value) {
|
||||
setVisible.queued = true;
|
||||
showTimeout = $timeout(function() {
|
||||
scope.visible = setVisible.value;
|
||||
setVisible.queued = false;
|
||||
showTimeout = null;
|
||||
|
||||
if (!scope.visibleWatcher) {
|
||||
onVisibleChanged(scope.visible);
|
||||
}
|
||||
}, scope.delay);
|
||||
} else {
|
||||
$mdUtil.nextTick(function() {
|
||||
scope.visible = false;
|
||||
if (!scope.visibleWatcher)
|
||||
onVisibleChanged(false);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function showTooltip() {
|
||||
// Do not show the tooltip if the text is empty.
|
||||
if (!element[0].textContent.trim()) return;
|
||||
|
||||
// Insert the element and position at top left, so we can get the position
|
||||
// and check if we should display it
|
||||
element.css({top: 0, left: 0});
|
||||
tooltipParent.append(element);
|
||||
|
||||
// Check if we should display it or not.
|
||||
// This handles hide-* and show-* along with any user defined css
|
||||
if ( $mdUtil.hasComputedStyle(element, 'display', 'none')) {
|
||||
scope.visible = false;
|
||||
element.detach();
|
||||
return;
|
||||
}
|
||||
|
||||
updatePosition();
|
||||
|
||||
$animate.addClass(content, SHOW_CLASS).then(function() {
|
||||
element.addClass(SHOW_CLASS);
|
||||
});
|
||||
}
|
||||
|
||||
function hideTooltip() {
|
||||
$animate.removeClass(content, SHOW_CLASS).then(function(){
|
||||
element.removeClass(SHOW_CLASS);
|
||||
if (!scope.visible) element.detach();
|
||||
});
|
||||
}
|
||||
|
||||
function updatePosition() {
|
||||
if ( !scope.visible ) return;
|
||||
|
||||
updateContentOrigin();
|
||||
positionTooltip();
|
||||
}
|
||||
|
||||
function positionTooltip() {
|
||||
var tipRect = $mdUtil.offsetRect(element, tooltipParent);
|
||||
var parentRect = $mdUtil.offsetRect(parent, tooltipParent);
|
||||
var newPosition = getPosition(scope.direction);
|
||||
var offsetParent = element.prop('offsetParent');
|
||||
|
||||
// If the user provided a direction, just nudge the tooltip onto the screen
|
||||
// Otherwise, recalculate based on 'top' since default is 'bottom'
|
||||
if (scope.direction) {
|
||||
newPosition = fitInParent(newPosition);
|
||||
} else if (offsetParent && newPosition.top > offsetParent.scrollHeight - tipRect.height - TOOLTIP_WINDOW_EDGE_SPACE) {
|
||||
newPosition = fitInParent(getPosition('top'));
|
||||
}
|
||||
|
||||
element.css({
|
||||
left: newPosition.left + 'px',
|
||||
top: newPosition.top + 'px'
|
||||
});
|
||||
|
||||
function fitInParent (pos) {
|
||||
var newPosition = { left: pos.left, top: pos.top };
|
||||
newPosition.left = Math.min( newPosition.left, tooltipParent.prop('scrollWidth') - tipRect.width - TOOLTIP_WINDOW_EDGE_SPACE );
|
||||
newPosition.left = Math.max( newPosition.left, TOOLTIP_WINDOW_EDGE_SPACE );
|
||||
newPosition.top = Math.min( newPosition.top, tooltipParent.prop('scrollHeight') - tipRect.height - TOOLTIP_WINDOW_EDGE_SPACE );
|
||||
newPosition.top = Math.max( newPosition.top, TOOLTIP_WINDOW_EDGE_SPACE );
|
||||
return newPosition;
|
||||
}
|
||||
|
||||
function getPosition (dir) {
|
||||
return dir === 'left'
|
||||
? { left: parentRect.left - tipRect.width - TOOLTIP_WINDOW_EDGE_SPACE,
|
||||
top: parentRect.top + parentRect.height / 2 - tipRect.height / 2 }
|
||||
: dir === 'right'
|
||||
? { left: parentRect.left + parentRect.width + TOOLTIP_WINDOW_EDGE_SPACE,
|
||||
top: parentRect.top + parentRect.height / 2 - tipRect.height / 2 }
|
||||
: dir === 'top'
|
||||
? { left: parentRect.left + parentRect.width / 2 - tipRect.width / 2,
|
||||
top: parentRect.top - tipRect.height - TOOLTIP_WINDOW_EDGE_SPACE }
|
||||
: { left: parentRect.left + parentRect.width / 2 - tipRect.width / 2,
|
||||
top: parentRect.top + parentRect.height + TOOLTIP_WINDOW_EDGE_SPACE };
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ngmaterial.components.tooltip = angular.module("material.components.tooltip");
|
||||
6
www/lib/angular-material/modules/closure/tooltip/tooltip.min.css
vendored
Normal file
6
www/lib/angular-material/modules/closure/tooltip/tooltip.min.css
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
/*!
|
||||
* Angular Material Design
|
||||
* https://github.com/angular/material
|
||||
* @license MIT
|
||||
* v1.1.0-master-2b98560
|
||||
*/md-tooltip{position:absolute;z-index:100;overflow:hidden;pointer-events:none;border-radius:4px;font-weight:500;font-size:14px}@media (min-width:960px){md-tooltip{font-size:10px}}md-tooltip .md-content{position:relative;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;-webkit-transform-origin:center top;transform-origin:center top;-webkit-transform:scale(0);transform:scale(0);opacity:0;height:32px;line-height:32px;padding-left:16px;padding-right:16px}@media (min-width:960px){md-tooltip .md-content{height:22px;line-height:22px;padding-left:8px;padding-right:8px}}md-tooltip .md-content.md-show-add{-webkit-transition:all .4s cubic-bezier(.25,.8,.25,1);transition:all .4s cubic-bezier(.25,.8,.25,1);-webkit-transition-duration:.2s;transition-duration:.2s;-webkit-transform:scale(0);transform:scale(0);opacity:0}md-tooltip .md-content.md-show,md-tooltip .md-content.md-show-add-active{-webkit-transform:scale(1);transform:scale(1);opacity:.9;-webkit-transform-origin:center top;transform-origin:center top}md-tooltip .md-content.md-show-remove{-webkit-transition:all .4s cubic-bezier(.25,.8,.25,1);transition:all .4s cubic-bezier(.25,.8,.25,1);-webkit-transition-duration:.2s;transition-duration:.2s}md-tooltip .md-content.md-show-remove.md-show-remove-active{-webkit-transform:scale(0);transform:scale(0);opacity:0}md-tooltip.md-hide{-webkit-transition:all .3s cubic-bezier(.55,0,.55,.2);transition:all .3s cubic-bezier(.55,0,.55,.2)}md-tooltip.md-show{-webkit-transition:all .4s cubic-bezier(.25,.8,.25,1);transition:all .4s cubic-bezier(.25,.8,.25,1);pointer-events:auto}
|
||||
7
www/lib/angular-material/modules/closure/tooltip/tooltip.min.js
vendored
Normal file
7
www/lib/angular-material/modules/closure/tooltip/tooltip.min.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/*!
|
||||
* Angular Material Design
|
||||
* https://github.com/angular/material
|
||||
* @license MIT
|
||||
* v1.1.0-master-2b98560
|
||||
*/
|
||||
function MdTooltipDirective(t,e,i,o,n,r,a,c,l,u){function s(a,l,s){function v(){a.delay=a.delay||h}function b(){var t="center top";switch(a.direction){case"left":t="right center";break;case"right":t="left center";break;case"top":t="center bottom";break;case"bottom":t="center top"}C.css("transform-origin",t)}function g(t){t?E():q()}function $(){if(l[0]&&"MutationObserver"in e){var t=new MutationObserver(function(t){t.forEach(function(t){"md-visible"===t.attributeName&&(a.visibleWatcher||(a.visibleWatcher=a.$watch("visible",g))),"md-direction"===t.attributeName&&O(a.direction)})});t.observe(l[0],{attributes:!0}),s.hasOwnProperty("mdVisible")&&(a.visibleWatcher=a.$watch("visible",g))}else a.visibleWatcher=a.$watch("visible",g),a.$watch("direction",O);var i=function(){a.$destroy()};l.one("$destroy",i),W.one("$destroy",i),a.$on("$destroy",function(){M(!1),l.remove(),t&&t.disconnect()}),l.text().indexOf(u.startSymbol())>-1&&a.$watch(function(){return l.text().trim()},w)}function w(t){if((t||!W.attr("aria-label"))&&!W.text().trim()){var e=t||l.text().trim(),i=u(e)(W.scope());W.attr("aria-label",i)}}function y(){l.detach(),l.attr("role","tooltip")}function x(){function i(){M(!1)}var r=!1;if(W[0]&&"MutationObserver"in e){var c=new MutationObserver(function(t){t.some(function(t){return"disabled"===t.attributeName&&W[0].disabled})&&n.nextTick(function(){M(!1)})});c.observe(W[0],{attributes:!0})}var l=function(){u=document.activeElement===W[0]},u=!1;angular.element(e).on("blur",l).on("resize",P),document.addEventListener("scroll",i,!0),a.$on("$destroy",function(){angular.element(e).off("blur",l).off("resize",P),W.off(d,m).off(f,h).off("mousedown",p),h(),document.removeEventListener("scroll",i,!0),c&&c.disconnect()});var m=function(t){"focus"===t.type&&u?u=!1:a.visible||(W.on(f,h),M(!0),"touchstart"===t.type&&W.one("touchend",function(){n.nextTick(function(){o.one("touchend",h)},!1)}))},h=function(){var e=a.hasOwnProperty("autohide")?a.autohide:s.hasOwnProperty("mdAutohide");(e||r||o[0].activeElement!==W[0])&&(k&&(t.cancel(k),M.queued=!1,k=null),W.off(f,h),W.triggerHandler("blur"),M(!1)),r=!1},p=function(){r=!0};W.on("mousedown",p),W.on(d,m)}function M(e){M.queued&&M.value===!!e||!M.queued&&a.visible===!!e||(M.value=!!e,M.queued||(e?(M.queued=!0,k=t(function(){a.visible=M.value,M.queued=!1,k=null,a.visibleWatcher||g(a.visible)},a.delay)):n.nextTick(function(){a.visible=!1,a.visibleWatcher||g(!1)})))}function E(){if(l[0].textContent.trim()){if(l.css({top:0,left:0}),D.append(l),n.hasComputedStyle(l,"display","none"))return a.visible=!1,void l.detach();O(),c.addClass(C,m).then(function(){l.addClass(m)})}}function q(){c.removeClass(C,m).then(function(){l.removeClass(m),a.visible||l.detach()})}function O(){a.visible&&(b(),T())}function T(){function t(t){var e={left:t.left,top:t.top};return e.left=Math.min(e.left,D.prop("scrollWidth")-i.width-p),e.left=Math.max(e.left,p),e.top=Math.min(e.top,D.prop("scrollHeight")-i.height-p),e.top=Math.max(e.top,p),e}function e(t){return"left"===t?{left:o.left-i.width-p,top:o.top+o.height/2-i.height/2}:"right"===t?{left:o.left+o.width+p,top:o.top+o.height/2-i.height/2}:"top"===t?{left:o.left+o.width/2-i.width/2,top:o.top-i.height-p}:{left:o.left+o.width/2-i.width/2,top:o.top+o.height+p}}var i=n.offsetRect(l,D),o=n.offsetRect(W,D),r=e(a.direction),c=l.prop("offsetParent");a.direction?r=t(r):c&&r.top>c.scrollHeight-i.height-p&&(r=t(e("top"))),l.css({left:r.left+"px",top:r.top+"px"})}r(l);var W=n.getParentWithPointerEvents(l),C=angular.element(l[0].getElementsByClassName("md-content")[0]),D=angular.element(document.body),k=null,P=i.throttle(function(){O()});c.pin&&c.pin(l,W),v(),y(),x(),b(),$(),w()}var d="focus touchstart mouseenter",f="blur touchcancel mouseleave",m="md-show",h=0,p=8;return{restrict:"E",transclude:!0,priority:210,template:'<div class="md-content _md" ng-transclude></div>',scope:{delay:"=?mdDelay",visible:"=?mdVisible",autohide:"=?mdAutohide",direction:"@?mdDirection"},compile:function(t,e){return e.mdDirection||e.$set("mdDirection","bottom"),s}}}goog.provide("ngmaterial.components.tooltip"),goog.require("ngmaterial.core"),MdTooltipDirective.$inject=["$timeout","$window","$$rAF","$document","$mdUtil","$mdTheming","$rootElement","$animate","$q","$interpolate"],angular.module("material.components.tooltip",["material.core"]).directive("mdTooltip",MdTooltipDirective),ngmaterial.components.tooltip=angular.module("material.components.tooltip");
|
||||
Reference in New Issue
Block a user