1/*! tether-tooltip 1.1.0 */ 2 3(function(root, factory) { 4 if (typeof define === 'function' && define.amd) { 5 define(["tether-drop","tether"], factory); 6 } else if (typeof exports === 'object') { 7 module.exports = factory(require('tether-drop'), require('tether')); 8 } else { 9 root.Tooltip = factory(root.Drop, root.Tether); 10 } 11 }(this, function(Drop, Tether) { 12 13 /* global Tether Drop */ 14 15 'use strict'; 16 17 var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); 18 19 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } 20 21 var extend = Tether.Utils.extend; 22 23 var _Drop = Drop.createContext({ 24 classPrefix: 'tooltip' 25 }); 26 27 var defaults = { 28 position: 'top center', 29 openOn: 'hover', 30 classes: 'tooltip-theme-arrows', 31 constrainToWindow: true, 32 constrainToScrollParent: false 33 }; 34 35 var tooltipCount = 0; 36 37 var Tooltip = (function () { 38 function Tooltip(options) { 39 _classCallCheck(this, Tooltip); 40 41 this.options = options; 42 43 if (!this.options.target) { 44 throw new Error('Tooltip Error: You must provide a target for Tooltip to attach to'); 45 } 46 47 var position = this.options.target.getAttribute('data-tooltip-position'); 48 if (position) { 49 if (typeof this.options.position === 'undefined') { 50 this.options.position = position; 51 } 52 } 53 54 var content = this.options.target.getAttribute('data-tooltip'); 55 56 if (content) { 57 if (typeof this.options.content === 'undefined') { 58 var contentEl = document.createElement('div'); 59 contentEl.innerHTML = content; 60 61 // Add ARIA attributes (see #50) 62 contentEl.setAttribute('role', 'tooltip'); 63 contentEl.id = 'drop-tooltip-' + tooltipCount; 64 this.options.target.setAttribute('aria-describedby', contentEl.id); 65 this.options.target.setAttribute('aria-label', 'Stampa'); //Stampa pagina 66 tooltipCount += 1; 67 68 this.options.content = contentEl; 69 } 70 } 71 72 if (!this.options.content) { 73 throw new Error('Tooltip Error: You must provide content for Tooltip to display'); 74 } 75 76 this.options = extend({}, defaults, this.options); 77 78 this.drop = new _Drop(this.options); 79 80 // WCAG-A 1.3.1 Info and Relationships 81 // TODO: verificare se sia il metodo migliore 82 this.drop.open(); 83 this.drop.close(); 84 } 85 86 _createClass(Tooltip, [{ 87 key: 'close', 88 value: function close() { 89 this.drop.close(); 90 } 91 }, { 92 key: 'open', 93 value: function open() { 94 this.drop.open(); 95 } 96 }, { 97 key: 'toggle', 98 value: function toggle() { 99 this.drop.toggle(); 100 } 101 }, { 102 key: 'remove', 103 value: function remove() { 104 this.drop.remove(); 105 } 106 }, { 107 key: 'destroy', 108 value: function destroy() { 109 this.drop.destroy(); 110 } 111 }, { 112 key: 'position', 113 value: function position() { 114 this.drop.position(); 115 } 116 }]); 117 118 return Tooltip; 119 })(); 120 121 var initialized = []; 122 123 Tooltip.init = function () { 124 var tooltipElements = document.querySelectorAll('[data-tooltip]'); 125 var len = tooltipElements.length; 126 for (var i = 0; i < len; ++i) { 127 var el = tooltipElements[i]; 128 if (initialized.indexOf(el) === -1) { 129 new Tooltip({ 130 target: el 131 }); 132 initialized.push(el); 133 } 134 } 135 }; 136 137 document.addEventListener('DOMContentLoaded', function () { 138 if (Tooltip.autoinit !== false) { 139 Tooltip.init(); 140 } 141 }); 142 return Tooltip; 143 144 })); 145
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.