Файл: CloudBox-main/CloudBox/admin_assets/js/jquery.toolbar.min.js
Строк: 162
<?php
/*! toolbar.js 2013-04-05 */
"function" != typeof Object.create && (Object.create = function (t) {
function o() {
}
return o.prototype = t, new o
}), function (t, o) {
var e = {init: function (o, e) {
var i = this;
i.elem = e, i.$elem = t(e), i.options = t.extend({}, t.fn.toolbar.options, o), i.toolbar = t('<div class="tool-container gradient" />').addClass("tool-" + i.options.position).addClass("tool-rounded").append('<div class="tool-items" />').append('<div class="arrow" />').appendTo("body").css("opacity", 0).hide(), i.toolbar_arrow = i.toolbar.find(".arrow"), i.initializeToolbar()
}, initializeToolbar: function () {
var t = this;
t.populateContent(), t.setTrigger(), t.toolbarWidth = t.toolbar.width()
}, setTrigger: function () {
var e = this;
e.$elem.on("click", function (t) {
t.preventDefault(), e.$elem.hasClass("pressed") ? e.hide() : e.show()
}), e.options.hideOnClick && t("html").on("click.toolbar", function (t) {
t.target != e.elem && 0 === e.$elem.has(t.target).length && 0 === e.toolbar.has(t.target).length && e.toolbar.is(":visible") && e.hide()
}), t(o).resize(function (t) {
t.stopPropagation(), e.toolbar.is(":visible") && (e.toolbarCss = e.getCoordinates(e.options.position, 20), e.collisionDetection(), e.toolbar.css(e.toolbarCss), e.toolbar_arrow.css(e.arrowCss))
})
}, populateContent: function () {
var o = this, e = o.toolbar.find(".tool-items"), i = t(o.options.content).clone(!0).find("a").addClass("tool-item gradient");
e.html(i), e.find(".tool-item").on("click", function (t) {
t.preventDefault(), o.$elem.trigger("toolbarItemClick", this)
})
}, calculatePosition: function () {
var t = this;
t.arrowCss = {}, t.toolbarCss = t.getCoordinates(t.options.position, 0), t.toolbarCss.position = "absolute", t.toolbarCss.zIndex = t.options.zIndex, t.collisionDetection(), t.toolbar.css(t.toolbarCss), t.toolbar_arrow.css(t.arrowCss)
}, getCoordinates: function (t, o) {
var e = this;
switch (e.coordinates = e.$elem.offset(), e.options.adjustment && e.options.adjustment[e.options.position] && (o = e.options.adjustment[e.options.position]), e.options.position) {
case"top":
return{left: e.coordinates.left - e.toolbar.width() / 2 + e.$elem.outerWidth() / 2, top: e.coordinates.top - e.$elem.height() - o, right: "auto"};
case"left":
return{left: e.coordinates.left - e.toolbar.width() / 2 - e.$elem.width() / 2 - o, top: e.coordinates.top - e.toolbar.height() / 2 + e.$elem.outerHeight() / 2, right: "auto"};
case"right":
return{left: e.coordinates.left + e.toolbar.width() / 2 + e.$elem.width() / 3 + o, top: e.coordinates.top - e.toolbar.height() / 2 + e.$elem.outerHeight() / 2, right: "auto"};
case"bottom":
return{left: e.coordinates.left - e.toolbar.width() / 2 + e.$elem.outerWidth() / 2, top: e.coordinates.top + e.$elem.height() + o, right: "auto"}
}
}, collisionDetection: function () {
var e = this, i = 20;
("top" == e.options.position || "bottom" == e.options.position) && (e.arrowCss = {left: "50%", right: "50%"}, i > e.toolbarCss.left ? (e.toolbarCss.left = i, e.arrowCss.left = e.$elem.offset().left + e.$elem.width() / 2 - i) : i > t(o).width() - (e.toolbarCss.left + e.toolbarWidth) && (e.toolbarCss.right = i, e.toolbarCss.left = "auto", e.arrowCss.left = "auto", e.arrowCss.right = t(o).width() - e.$elem.offset().left - e.$elem.width() / 2 - i - 5))
}, show: function () {
var t = this, o = {opacity: 1};
switch (t.$elem.addClass("pressed"), t.calculatePosition(), t.options.position) {
case"top":
o.top = "-=20";
break;
case"left":
o.left = "-=20";
break;
case"right":
o.left = "+=20";
break;
case"bottom":
o.top = "+=20"
}
t.toolbar.show().animate(o, 200), t.$elem.trigger("toolbarShown")
}, hide: function () {
var t = this, o = {opacity: 0};
switch (t.$elem.removeClass("pressed"), t.options.position) {
case"top":
o.top = "+=20";
break;
case"left":
o.left = "+=20";
break;
case"right":
o.left = "-=20";
break;
case"bottom":
o.top = "-=20"
}
t.toolbar.animate(o, 200, function () {
t.toolbar.hide()
}), t.$elem.trigger("toolbarHidden")
}, getToolbarElement: function () {
return this.toolbar.find(".tool-items")
}};
t.fn.toolbar = function (o) {
if (t.isPlainObject(o))return this.each(function () {
var i = Object.create(e);
i.init(o, this), t(this).data("toolbarObj", i)
});
if ("string" == typeof o && 0 !== o.indexOf("_")) {
var i = t(this).data("toolbarObj"), s = i[o];
return s.apply(i, t.makeArray(arguments).slice(1))
}
}, t.fn.toolbar.options = {content: "#myContent", position: "top", hideOnClick: !1, zIndex: 120}
}(jQuery, window, document);
?>