File "tooltip.js"

Full Path: /home/vantageo/public_html/cache/.wp-cli/wp-content/plugins/woo-bulk-editor/assets/js/tooltip.js
File size: 5.94 KB
MIME-type: text/plain
Charset: utf-8

"use strict";

!function(){jQuery.Zebra_Tooltips = function(t, r){var m, y, T, b, l = {animation_speed:250, animation_offset:20, close_on_click:!0, content:!(this.version = "2.1.0"), hide_delay:100, keep_visible:!0, max_width:250, opacity:".95", position:"center", prerender:!1, show_delay:100, vertical_alignment:"above", vertical_offset:0, onBeforeHide:null, onHide:null, onBeforeShow:null, onShow:null}, n = function(e){var t, o, i, a, r, l, n, _, s, p, d, h, c, u, f = e.data("Zebra_Tooltip"), w = jQuery(window); return f.tooltip || (t = jQuery("<div>", {class:"Zebra_Tooltip", css:{opacity:0, display:"block"}}), o = jQuery("<div>", {class:"Zebra_Tooltip_Message", css:{maxWidth:f.max_width}}).html(f.content).appendTo(t), i = jQuery("<div>", {class:"Zebra_Tooltip_Arrow"}).appendTo(t), a = jQuery("<div>").addClass("Zebra_Tooltip_Arrow_Border").appendTo(i), jQuery("<div>").appendTo(i), f.keep_visible && (t.on("mouseleave" + (f.close_on_click?" click":""), function(){g(e)}), t.on("mouseenter", function(){v(e)})), t.appendTo("body"), f.sticky && o.addClass("Zebra_Tooltip_Has_Close"), r = t.outerWidth(), l = t.outerHeight(), n = a.outerWidth(), _ = a.outerHeight(), s = o.outerWidth(), p = o.outerHeight(), f = {tooltip:t, tooltip_width:r, tooltip_height:l + _ / 2, message:o, arrow_container:i, arrow_width:n, arrow_height:_, arrow:a}, t.css({width:f.tooltip_width, height:f.tooltip_height}), f.tooltip_width = f.tooltip_width + (o.outerWidth() - s), f.tooltip_height = f.tooltip_height + (o.outerHeight() - p), t.css({width:f.tooltip_width, height:f.tooltip_height, display:"none"}), f = jQuery.extend(e.data("Zebra_Tooltip"), f), e.data("Zebra_Tooltip", f)), f.sticky && !f.close && (jQuery("<a>", {class:"Zebra_Tooltip_Close", href:"javascript:void(0)"}).html("&times;").on("click", function(t){t.preventDefault(); var o = e.data("Zebra_Tooltip"); o.sticky = !1, e.data("Zebra_Tooltip", o), g(e)}).appendTo(f.message), f.close = !0, f = jQuery.extend(e.data("Zebra_Tooltip"), f), e.data("Zebra_Tooltip", f)), m = w.width(), y = w.height(), d = e.offset(), jQuery.extend(f, {element_left:d.left, element_top:d.top, element_width:e.outerWidth(), element_height:e.outerHeight()}), b = w.scrollTop(), T = w.scrollLeft(), h = "left" === f.position?f.element_left - f.tooltip_width + f.arrow_width:"right" === f.position?f.element_left + f.element_width - f.arrow_width:f.element_left + (f.element_width - f.tooltip_width) / 2, c = f.element_top - f.tooltip_height, u = "left" === f.position?f.tooltip_width - f.arrow_width - f.arrow_width / 2:"right" === f.position?f.arrow_width / 2:(f.tooltip_width - f.arrow_width) / 2, h + f.tooltip_width > m + T && (u -= m + T - (h + f.tooltip_width) - 6, h = m + T - f.tooltip_width - 6, u + f.arrow_width > f.tooltip_width - 6 && (u = f.tooltip_width - 6 - f.arrow_width), h + u + f.arrow_width / 2 < f.element_left && (u = - 1e4)), h < T && (u -= T - h, h = T + 2, u < 0 && (u = f.arrow_width / 2), h + u + f.arrow_width / 2 > f.element_left + f.element_width && (u = - 1e4)), f.message.css("margin-top", ""), f.arrow_container.removeClass("Zebra_Tooltip_Arrow_Top").addClass("Zebra_Tooltip_Arrow_Bottom"), c < b || "below" === f.vertical_alignment && f.element_top + f.element_height + f.vertical_offset + f.tooltip_height + f.animation_offset < y + b?(c = f.element_top + f.element_height - f.vertical_offset, f.animation_offset = Math.abs(f.animation_offset), f.message.css("margin-top", f.arrow_height / 2), f.arrow_container.removeClass("Zebra_Tooltip_Arrow_Bottom").addClass("Zebra_Tooltip_Arrow_Top")):(f.animation_offset = - Math.abs(f.animation_offset), c += f.vertical_offset), f.arrow_container.css("left", u), f.tooltip.css({left:h, top:c}), jQuery.extend(f, {tooltip_left:h, tooltip_top:c, arrow_left:u}), f = jQuery.extend(e.data("Zebra_Tooltip"), f), e.data("Zebra_Tooltip", f), f}, v = function(t){var o = t.data("Zebra_Tooltip"); clearTimeout(o.show_timeout), o.muted || (clearTimeout(o.hide_timeout), o.show_timeout = setTimeout(function(){(o = n(t)).onBeforeShow && "function" == typeof o.onBeforeShow && !1 === o.onBeforeShow(t, o.tooltip) || ("block" !== o.tooltip.css("display") && o.tooltip.css({top:o.tooltip_top + o.animation_offset}), o.tooltip.css("display", "block"), o.tooltip.stop(), o.tooltip.animate({top:o.tooltip_top, opacity:o.opacity}, o.animation_speed, function(){o.onShow && "function" == typeof o.onShow && o.onShow(t, o.tooltip)}))}, o.show_delay))}, g = function(t){var o = t.data("Zebra_Tooltip"); clearTimeout(o.hide_timeout), o.sticky || (clearTimeout(o.show_timeout), o.hide_timeout = setTimeout(function(){if (o.tooltip){if (o.onBeforeHide && "function" == typeof o.onBeforeHide && !1 === o.onBeforeHide(t, o.tooltip))return; o.close = !1, o.destroy && (o.muted = !0), t.data("Zebra_Tooltip", o), jQuery("a.Zebra_Tooltip_Close", o.tooltip).remove(), o.tooltip.stop(), o.tooltip.animate({opacity:0, top:o.tooltip_top + o.animation_offset}, o.animation_speed, function(){jQuery(this).css("display", "none"), o.onHide && "function" == typeof o.onHide && o.onHide(t, o.tooltip)})}}, o.hide_delay))}; this.hide = function(t, e){t.each(function(){var t = jQuery(this), o = t.data("Zebra_Tooltip"); o && (o.sticky = !1, e && (o.destroy = !0), t.data("Zebra_Tooltip", o), g(t))})}, this.show = function(t, e){t.each(function(){var t = jQuery(this), o = t.data("Zebra_Tooltip"); o && (o.sticky = !0, o.muted = !1, e && (o.destroy = !0), t.data("Zebra_Tooltip", o), v(t))})}, t.each(function(){var t, o = jQuery(this), e = o.attr("title"), i = o.data(), a = {}; for (t in i)0 === t.indexOf("ztt_") && (t = t.replace(/^ztt\_/, ""), void 0 !== l[t] && (a[t] = i["ztt_" + t])); a = jQuery.extend(l, r, a), e && (a.content = o.attr("title")), void 0 !== a.content && "" !== a.content.trim() && (o.on({mouseenter:function(){e && jQuery(this).attr("title", ""), v(o)}, mouseleave:function(){g(o), e && jQuery(this).attr("title", e)}}), o.data("Zebra_Tooltip", jQuery.extend({tooltip:null, show_timeout:null, hide_timeout:null, sticky:!1, destroy:!1, muted:!1}, a)), a.prerender && n(o))})}}($);