1(function(e) { 2 function t(e, t) { 3 this.bearer = e; 4 this.options = t; 5 this.hideEvent; 6 this.mouseOverMode = this.options.trigger == "hover" || this.options.trigger == "mouseover" || this.options.trigger == "onmouseover" 7 } 8 t.prototype = { 9 show: function() { 10 var e = this; 11 if (this.options.modal) { 12 this.modalLayer.css("display", "block") 13 } 14 this.tooltip.css("display", "block"); 15 if (e.mouseOverMode) { 16 this.tooltip.mouseover(function() { 17 clearTimeout(e.hideEvent) 18 }); 19 this.tooltip.mouseout(function() { 20 clearTimeout(e.hideEvent); 21 e.hide() 22 }) 23 } 24 }, 25 hide: function() { 26 var e = this; 27 this.hideEvent = setTimeout(function() { 28 e.tooltip.hide() 29 }, 100); 30 if (e.options.modal) { 31 e.modalLayer.hide() 32 } 33 this.options.onClose() 34 }, 35 toggle: function() { 36 if (this.tooltip.is(":visible")) { 37 this.hide() 38 } else { 39 this.show() 40 } 41 }, 42 addAnimation: function() { 43 switch (this.options.animation) { 44 case "none": 45 break; 46 case "fadeIn": 47 this.tooltip.addClass("animated"); 48 this.tooltip.addClass("fadeIn"); 49 break; 50 case "flipIn": 51 this.tooltip.addClass("animated"); 52 this.tooltip.addClass("flipIn"); 53 break 54 } 55 }, 56 setContent: function() { 57 e(this.bearer).css("cursor", "pointer"); 58 if (this.options.content) { 59 this.content = this.options.content 60 } else if (this.bearer.attr("data-tooltip")) { 61 this.content = this.bearer.attr("data-tooltip") 62 } else { 63 return 64 } 65 if (this.content.charAt(0) == "#") { 66 if (this.options.delete_content) { 67 var t = e(this.content).html(); 68 e(this.content).html(""); 69 this.content = t; 70 delete t 71 } else { 72 e(this.content).hide(); 73 this.content = e(this.content).html() 74 } 75 this.contentType = "html" 76 } else { 77 this.contentType = "text" 78 } 79 tooltipId = ""; 80 if (this.bearer.attr("id") != "") { 81 tooltipId = "id='darktooltip-" + this.bearer.attr("id") + "'" 82 } 83 this.modalLayer = e("<ins class='darktooltip-modal-layer'></ins>"); 84 this.tooltip = e("<ins " + tooltipId + " class = 'dark-tooltip " + this.options.theme + " " + this.options.size + " " + this.options.gravity + "'><div>" + this.content + "</div><div class = 'tip'></div></ins>"); 85 this.tip = this.tooltip.find(".tip"); 86 e("body").append(this.modalLayer); 87 e("body").append(this.tooltip); 88 if (this.contentType == "html") { 89 this.tooltip.css("max-width", "none") 90 } 91 this.tooltip.css("opacity", this.options.opacity); 92 this.addAnimation(); 93 if (this.options.confirm) { 94 this.addConfirm() 95 } 96 }, 97 setPositions: function() { 98 var e = this.bearer.offset().left; 99 var t = this.bearer.offset().top; 100 switch (this.options.gravity) { 101 case "south":
102 e += this.bearer.outerWidth() / 2 - this.tooltip.outerWidth() / 2; 103 t += -this.tooltip.outerHeight() - this.tip.outerHeight() / 2; 104 break; 105 case "west": 106 e += this.bearer.outerWidth() + this.tip.outerWidth() / 2; 107 t += this.bearer.outerHeight() / 2 - this.tooltip.outerHeight() / 2; 108 break; 109 case "north": 110 e += this.bearer.outerWidth() / 2 - this.tooltip.outerWidth() / 2; 111 t += this.bearer.outerHeight() + this.tip.outerHeight() / 2; 112 break; 113 case "east": 114 e += -this.tooltip.outerWidth() - this.tip.outerWidth() / 2; 115 t += this.bearer.outerHeight() / 2 - this.tooltip.outerHeight() / 2; 116 break 117 } 118 if (this.options.autoLeft) { 119 this.tooltip.css("left", e) 120 } 121 if (this.options.autoTop) { 122 this.tooltip.css("top", t) 123 } 124 }, 125 setEvents: function() { 126 var t = this; 127 var n = t.options.hoverDelay; 128 var r; 129 this.tooltip.click(function(e) { 130 e.stopPropagation() 131 }); 132 this.bearer.click(function(e) { 133 e.preventDefault(); 134 t.setPositions(); 135 t.toggle(); 136 e.stopPropagation() 137 }); 138 e("html").click(function() { 139 t.hide() 140 }) 141 }, 142 activate: function() { 143 this.setContent(); 144 if (this.content) { 145 this.setEvents() 146 } 147 }, 148 addConfirm: function() { 149 this.tooltip.append("<ul class = 'confirm'><li class = 'darktooltip-yes'>" + this.options.yes + "</li><li class = 'darktooltip-no'>" + this.options.no + "</li></ul>"); 150 this.setConfirmEvents() 151 }, 152 setConfirmEvents: function() { 153 var e = this; 154 this.tooltip.find("li.darktooltip-yes").click(function(t) { 155 e.onYes(); 156 t.stopPropagation() 157 }); 158 this.tooltip.find("li.darktooltip-no").click(function(t) { 159 e.onNo(); 160 t.stopPropagation() 161 }) 162 }, 163 finalMessage: function() { 164 if (this.options.finalMessage) { 165 var e = this; 166 e.tooltip.find("div:first").html(this.options.finalMessage); 167 e.tooltip.find("ul").remove(); 168 e.setPositions(); 169 setTimeout(function() { 170 e.hide(); 171 e.setContent() 172 }, e.options.finalMessageDuration) 173 } else { 174 this.hide() 175 } 176 }, 177 onYes: function() { 178 this.options.onYes(this.bearer); 179 this.finalMessage() 180 }, 181 onNo: function() { 182 this.options.onNo(this.bearer); 183 this.hide() 184 } 185 }; 186 e.fn.darkTooltip = function(n) { 187 return this.each(function() { 188 n = e.extend({}, e.fn.darkTooltip.defaults, n); 189 var r = new t(e(this), n); 190 r.activate() 191 }) 192 }; 193 e.fn.darkTooltip.defaults = { 194 animation: "none", 195 confirm: false, 196 content: "", 197 finalMessage: "", 198 finalMessageDuration: 1e3, 199 gravity: "south", 200 hoverDelay: 0, 201 modal: false, 202 no: "No", 203 onNo: function() {}, 204 onYes: function() {}, 205 opacity: .9, 206 size: "medium", 207 theme: "dark", 208 trigger: "hover", 209 yes: "Yes", 210 autoTop: true, 211 autoLeft: true, 212 onClose: function() {} 213 } 214})(jQuery)
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.