Файл: магазин/e-proger/js/send.js
Строк: 564
<?php
(function($) {
$.fn.tipTip = function(options) {
var defaults = {
activation: "hover",
keepAlive: false,
maxWidth: "350px",
edgeOffset: 8,
defaultPosition: "bottom",
delay: 100,
fadeIn: 200,
fadeOut: 200,
attribute: "title",
content: false,
enter: function() {},
exit: function() {}
};
var opts = $.extend(defaults, options);
if ($("#tiptip_holder").length <= 0) {
var tiptip_holder = $('<div id="tiptip_holder" style="max-width:' + opts.maxWidth + ';"></div>');
var tiptip_content = $('<div id="tiptip_content"></div>');
var tiptip_arrow = $('<div id="tiptip_arrow"></div>');
$("body").append(tiptip_holder.html(tiptip_content).prepend(tiptip_arrow.html('<div id="tiptip_arrow_inner"></div>')))
} else {
var tiptip_holder = $("#tiptip_holder");
var tiptip_content = $("#tiptip_content");
var tiptip_arrow = $("#tiptip_arrow")
}
return this.each(function() {
var org_elem = $(this);
if (opts.content) {
var org_title = opts.content
} else {
var org_title = org_elem.attr(opts.attribute)
}
if (org_title != "") {
if (!opts.content) {
org_elem.removeAttr(opts.attribute)
}
var timeout = false;
if (opts.activation == "hover") {
org_elem.hover(function() {
active_tiptip()
}, function() {
if (!opts.keepAlive) {
deactive_tiptip()
}
});
if (opts.keepAlive) {
tiptip_holder.hover(function() {}, function() {
deactive_tiptip()
})
}
} else if (opts.activation == "focus") {
org_elem.focus(function() {
active_tiptip()
}).blur(function() {
deactive_tiptip()
})
} else if (opts.activation == "click") {
org_elem.click(function() {
active_tiptip();
return false
}).hover(function() {}, function() {
if (!opts.keepAlive) {
deactive_tiptip()
}
});
if (opts.keepAlive) {
tiptip_holder.hover(function() {}, function() {
deactive_tiptip()
})
}
}
function active_tiptip() {
opts.enter.call(this);
tiptip_content.html(org_title);
tiptip_holder.hide().removeAttr("class").css("margin", "0");
tiptip_arrow.removeAttr("style");
var top = parseInt(org_elem.offset()['top']);
var left = parseInt(org_elem.offset()['left']);
var org_width = parseInt(org_elem.outerWidth());
var org_height = parseInt(org_elem.outerHeight());
var tip_w = tiptip_holder.outerWidth();
var tip_h = tiptip_holder.outerHeight();
var w_compare = Math.round((org_width - tip_w) / 2);
var h_compare = Math.round((org_height - tip_h) / 2);
var marg_left = Math.round(left + w_compare);
var marg_top = Math.round(top + org_height + opts.edgeOffset);
var t_class = "";
var arrow_top = "";
var arrow_left = Math.round(tip_w - 12) / 2;
if (opts.defaultPosition == "bottom") {
t_class = "_bottom"
} else if (opts.defaultPosition == "top") {
t_class = "_top"
} else if (opts.defaultPosition == "left") {
t_class = "_left"
} else if (opts.defaultPosition == "right") {
t_class = "_right"
}
var right_compare = (w_compare + left) < parseInt($(window).scrollLeft());
var left_compare = (tip_w + left) > parseInt($(window).width());
if ((right_compare && w_compare < 0) || (t_class == "_right" && !left_compare) || (t_class == "_left" && left < (tip_w + opts.edgeOffset + 5))) {
t_class = "_right";
arrow_top = Math.round(tip_h - 13) / 2;
arrow_left = -12;
marg_left = Math.round(left + org_width + opts.edgeOffset);
marg_top = Math.round(top + h_compare)
} else if ((left_compare && w_compare < 0) || (t_class == "_left" && !right_compare)) {
t_class = "_left";
arrow_top = Math.round(tip_h - 13) / 2;
arrow_left = Math.round(tip_w);
marg_left = Math.round(left - (tip_w + opts.edgeOffset + 5));
marg_top = Math.round(top + h_compare)
}
var top_compare = (top + org_height + opts.edgeOffset + tip_h + 8) > parseInt($(window).height() + $(window).scrollTop());
var bottom_compare = ((top + org_height) - (opts.edgeOffset + tip_h + 8)) < 0;
if (top_compare || (t_class == "_bottom" && top_compare) || (t_class == "_top" && !bottom_compare)) {
if (t_class == "_top" || t_class == "_bottom") {
t_class = "_top"
} else {
t_class = t_class + "_top"
}
arrow_top = tip_h;
marg_top = Math.round(top - (tip_h + 5 + opts.edgeOffset))
} else if (bottom_compare | (t_class == "_top" && bottom_compare) || (t_class == "_bottom" && !top_compare)) {
if (t_class == "_top" || t_class == "_bottom") {
t_class = "_bottom"
} else {
t_class = t_class + "_bottom"
}
arrow_top = -12;
marg_top = Math.round(top + org_height + opts.edgeOffset)
}
if (t_class == "_right_top" || t_class == "_left_top") {
marg_top = marg_top + 5
} else if (t_class == "_right_bottom" || t_class == "_left_bottom") {
marg_top = marg_top - 5
}
if (t_class == "_left_top" || t_class == "_left_bottom") {
marg_left = marg_left + 5
}
tiptip_arrow.css({
"margin-left": arrow_left + "px",
"margin-top": arrow_top + "px"
});
tiptip_holder.css({
"margin-left": marg_left + "px",
"margin-top": marg_top + "px"
}).attr("class", "tip" + t_class);
if (timeout) {
clearTimeout(timeout)
}
timeout = setTimeout(function() {
tiptip_holder.stop(true, true).fadeIn(opts.fadeIn)
}, opts.delay)
}
function deactive_tiptip() {
opts.exit.call(this);
if (timeout) {
clearTimeout(timeout)
}
tiptip_holder.fadeOut(opts.fadeOut)
}
}
})
}
})(jQuery);
$(document).click(function(a) {
$(a.target).closest(".wrap_transfer, .maddm").length || ($(".wrap_transfer").remove(), $(a.target).closest(".walls_gift, .wrap_walls_gift").length || ($(".wrap_walls_gift").html("").css({
top: 0
}), a.stopPropagation()))
});
var reloadpage = {
leftprofiles: function() {
$(".leftprofiles").load("modules/profiles/leftprofiles.php");
$("#tiptip_holder").css({
display: "none"
})
},
loadklink: function() {
$(".klink").load("modules/klink/klink.php");
$("#tiptip_holder").css({
display: "none"
})
},
loadban2x3: function() {
$(".ban2x3").load("modules/banner200x300/rotator.php");
$("#tiptip_holder").css({
display: "none"
})
},
loadtoppanel: function() {
$(".topmenu").load("modules/topmenu.php");
$("#tiptip_holder").css({
display: "none"
})
},
rightprofiles: function(a) {
$(".right_menu").load("modules/rightmenu.php", "type=" + a);
$("#tiptip_holder").css({
display: "none"
})
}
};
function delHistory(a, b) {
$.post("ajax.php?func=delhistory", {
id: a,
type: b
}, function(b) {
1 == b && ($(".js_titleRemove").remove(), $("#del_" + a).parent("div").remove())
});
return !1
}
function showDialog(a, b) {
settings.setClose(a);
$("body").Qbox({
title: "u041du043eu0432u043eu0435 u0441u043eu043eu0431u0449u0435u043du0438u0435",
width: 410,
minHeight: 45,
fadespeed: 300,
url: "",
param: "",
data: '<div style="padding: 5px; margin:10px; text-align:center"><textarea class="val" id="msgtext" style="width:365px; height:100px; overflow: auto;"></textarea></div><div id="bot_panel"><div class="preloader"></div><a href="#" id="msgSend" onclick="Send(' + a + ", '" + b + ''); return false;" class="btn_box">u041eu0442u043fu0440u0430u0432u0438u0442u044c</a></div>'
})
}
function Send(a, b) {
var c = $("#msgSend").attr("onclick");
$("#msgSend").attr("onclick", "");
$(".preloader").css({
display: "block"
});
$.post("ajax.php?func=newmsg", {
id: a,
text: $("#msgtext").val(),
type: b
}, function(a) {
1 == a ? box_close() : (2 == a ? $("#msgtext").focus() : $(".body").Qnotify({
text: a,
sound: "error"
}), $(".preloader").css({
display: "none"
}), $("#msgSend").attr("onclick", c))
});
return !1
}
function Send_d(a, b, c) {
$(".preload_msg").css({
display: "block"
});
$("#sendMsg").css({
display: "none"
});
$.post("ajax.php?func=newmsg", {
id: a,
text: b,
type: c
}, function(b) {
1 == b ? ($("#msgtext").val(""), Page.Go("mread=" + a, "no")) : 2 == b ? ($(".preload_msg").css({
display: "none"
}), $("#sendMsg").css({
display: "inline-block"
}), $("#msgtext").val("").focus()) : ($(".body").Qnotify({
text: b,
sound: "error"
}), $(".preload_msg").css({
display: "none"
}), $("#sendMsg").css({
display: "inline-block"
}))
});
return !1
}
function Del_in(a) {
$.post("ajax.php?func=delmsgin", {
id: a
}, function(b) {
1 == b && ($("#del_" + a).parents(".wrap_in_mess").remove(), $("#js_title_" + a).remove())
})
}
function Del_out(a) {
$.post("ajax.php?func=delmsgout", {
id: a
}, function(b) {
1 == b && ($("#del_" + a).parents(".wrap_in_mess").remove(), $("#js_title_" + a).remove())
})
}
function Del_in_all(a) {
$.post("ajax.php?func=delmsginall", {
id: a
}, function(a) {
1 == a && (location.assign("msg=inbox"), reloadpage.leftprofiles())
})
}
function Del_out_all(a) {
$.post("ajax.php?func=delmsgoutall", {
id: a
}, function(a) {
1 == a && location.assign("msg=outbox")
})
}
settings = {
setOpen: function(a) {
$(".setMenu").hide();
$("#setMenu_" + a).fadeIn(300)
},
setClose: function(a) {
$("#setMenu_" + a).fadeOut(300)
},
typerefOpen: function() {
$(".typeref").fadeIn(300)
},
typerefClose: function(a) {
$(".typeref").fadeOut(300)
},
privacyOpen: function(a) {
$(".pMenu").hide();
$("#p_" + a).fadeIn(300)
},
privacyClose: function(a) {
$("#p_" + a).fadeOut(300)
},
msg: function(a) {
$.post("ajax.php?func=messageaccess", {
type: a
}, function(a) {
1 == a && Page.Go("privacy")
});
return !1
},
ShowBirthday: function(a) {
$.post("ajax.php?func=showbirthday", {
type: a
}, function(a) {
1 == a && Page.Go("privacy")
});
return !1
},
Infoemail: function(a) {
$.post("ajax.php?func=infoemail", {
type: a
}, function(a) {
1 == a && Page.Go("privacy")
});
return !1
},
Messvk: function(a) {
$.post("ajax.php?func=messvk", {
type: a
}, function(a) {
1 == a && Page.Go("privacy")
});
return !1
},
WallsMessage: function(a) {
$.post("ajax.php?func=wallsmessageaccess", {
type: a
}, function(a) {
1 == a && Page.Go("privacy")
});
return !1
}
},
catalog = {
Show: function() {
$("body").Qbox({
title: "u0420u0435u043au043bu0430u043cu0430 u0432 u043au0430u0442u0430u043bu043eu0433u0435",
width: 500,
height: 280,
fadespeed: 300,
url: "/modules/catalog/add.php",
param: "",
data: ""
});
return !1
},
Send: function() {
$(".preloader").css({
display: "block"
});
var a = $("#category_id").val();
$.post("ajax.php?func=addcatalog", {
title: $("#catalog_title").val(),
id: $("#category_id").val(),
url: $("#url").val(),
text: $("#text").val()
}, function(b) {
1 == b ? ($(".body").Qnotify({
text: "u0420u0435u043au043bu0430u043cu0430 u0443u0441u043fu0435u0448u043du043e u0434u043eu0431u0430u0432u043bu0435u043du0430 u0432 u043au0430u0442u0430u043bu043eu0433!",
sound: "error"
}), box_close(), Page.Go("/catalog=" + a)) : 2 == b ? ($(".preloader").css({
display: "none"
}), $("#catalog_title").focus()) : 3 == b ? ($(".preloader").css({
display: "none"
}), $("#catalog_title").focus()) : 4 == b ? ($(".preloader").css({
display: "none"
}), $("#url").focus()) : 5 == b && ($(".preloader").css({
display: "none"
}), $("#text").focus())
});
return !1
}
},
tasks = {
ShowComment: function(a) {
$("body").Qbox({
title: "u041au043eu043cu043cu0435u043du0442u0430u0440u0438u0438 u043a u0437u0430u0434u0430u043du0438u044e u2116" + a,
width: 500,
height: 280,
fadespeed: 300,
url: "/modules/tasks/comments.php",
param: "id=" + a,
data: ""
});
return !1
}
};
function addCookie(a, b, c, d) {
setCookie(a, b, c);
d;
return !1
}
function setCookie(a, b, c, d, e, f) {
document.cookie = a + "=" + escape(b) + (c ? "; expires=" + c : "") + (d ? "; path=" + d : "") + (e ? "; domain=" + e : "") + (f ? "; secure" : "")
}
function windowHeight() {
return "CSS1Compat" == document.compatMode ? document.documentElement.clientHeight : document.body.clientHeight
};
function qbb(a, b, c) {
textarea = document.getElementById(c);
if (document.selection && document.selection.createRange) textarea.focus(), sel = document.selection.createRange(), sel.text = a + sel.text + b;
else if (textarea.selectionStart || "0" == textarea.selectionStart) {
c = textarea.selectionStart;
var d = textarea.selectionEnd;
textarea.value = textarea.value.substring(0, c) + a + textarea.value.substring(c, d) + b + textarea.value.substring(d, textarea.value.length);
textarea.selectionStart = textarea.selectionEnd = d + a.length + b.length
} else textarea.value += a + b;
textarea.focus()
};
var divId, nftitle = {
Show: function(e, c, d, m, g, n, p) {
var k = document.getElementById(e).getBoundingClientRect(),
h, f = 0.1,
l, b = document.getElementById("nftitle");
if (null != b) {
if (divId == e) return;
b.parentNode.removeChild(b)
}
divId = e;
b = document.createElement("div");
b.className = "wrap-nftitle";
b.id = "nftitle";
b.innerHTML = '<div id="nftitle-out"><div id="nftitle-in"></div></div><div id="nftitle-title">' + c + '</div><div id="nftitle-body">' + d + "</div>";
document.body.appendChild(b);
var a = document.getElementById("nftitle");
c = document.getElementById("nftitle-out");
d = document.getElementById("nftitle-in");
b = document.getElementById("nftitle-title");
document.getElementById("nftitle-body");
b.style.color = "#335783";
b.style.fontWeight = "bold";
b.style.padding = "7px 10px";
b.style.background = "#f2f2f2";
b.style.borderBottom = "1px solid #dae1e8";
a.style.display = "inline-block;";
h = parseInt(k.top - a.offsetHeight - 6 - g);
g = parseInt(k.left - 20 - n);
a.style.border = "1px solid #ADBAC7";
a.style.position = "absolute";
a.style.top = h + "px";
a.style.left = g + "px";
a.style.zIndex = 50;
a.style.background = "#ffffff";
a.style.opacity = 0;
a.style.fontSize = "10px";
a.style.fontFamily = "Tahoma";
a.style.width = m;
a.style.boxShadow = "0 0 2px rgba(0,0,0,0.2)";
c.style.position = "absolute";
c.style.bottom = "-6px";
c.style.borderLeft = "6px solid transparent";
c.style.borderRight = "6px solid transparent";
c.style.borderTop = "6px solid #ADBAC7";
c.style.zIndex = 52;
c.style.left = document.getElementById(e).offsetWidth / 2 + 14 + "px";
d.style.position = "absolute";
d.style.top = "-6px";
d.style.borderLeft = "5px solid transparent";
d.style.borderRight = "5px solid transparent";
d.style.borderTop = "5px solid #ffffff";
d.style.zIndex = 51;
d.style.left = "-5px";
1 > f && (l = setInterval(function() {
f += 0.1;
1 <= f ? clearInterval(l) : (a.style.opacity = f, a.style.top = h + 10 * f + "px")
}, 25));
p ? document.onclick = function(a) {
for (var b = 0; b < document.getElementById("nftitle-body").childNodes.length; b++)
if (a.target == document.getElementById("nftitle-body").childNodes[b] || "nftitle-title" == a.target.id || "nftitle-body" == a.target.id) return;
null != document.getElementById("nftitle") && document.getElementById("nftitle").parentNode.removeChild(document.getElementById("nftitle"))
} : null != document.getElementById(e) && (document.getElementById(e).onmouseout = function() {
document.getElementById("nftitle").parentNode.removeChild(document.getElementById("nftitle"))
})
}
};
(function(c) {
"function" === typeof define && define.amd ? define(["jquery"], c) : "object" === typeof exports ? module.exports = c : c(jQuery)
})(function(c) {
function m(b) {
var a = b || window.event,
g = [].slice.call(arguments, 1),
d = 0,
e = 0,
h = 0,
f = 0,
f = 0;
b = c.event.fix(a);
b.type = "mousewheel";
a.wheelDelta && (d = a.wheelDelta);
a.detail && (d = -1 * a.detail);
a.deltaY && (d = h = -1 * a.deltaY);
a.deltaX && (e = a.deltaX, d = -1 * e);
void 0 !== a.wheelDeltaY && (h = a.wheelDeltaY);
void 0 !== a.wheelDeltaX && (e = -1 * a.wheelDeltaX);
f = Math.abs(d);
if (!l || f < l) l = f;
f = Math.max(Math.abs(h), Math.abs(e));
if (!k || f < k) k = f;
a = 0 < d ? "floor" : "ceil";
d = Math[a](d / l);
e = Math[a](e / k);
h = Math[a](h / k);
g.unshift(b, d, e, h);
return (c.event.dispatch || c.event.handle).apply(this, g)
}
var n = ["wheel", "mousewheel", "DOMMouseScroll", "MozMousePixelScroll"],
g = "onwheel" in document || 9 <= document.documentMode ? ["wheel"] : ["mousewheel", "DomMouseScroll", "MozMousePixelScroll"],
l, k;
if (c.event.fixHooks)
for (var p = n.length; p;) c.event.fixHooks[n[--p]] = c.event.mouseHooks;
c.event.special.mousewheel = {
setup: function() {
if (this.addEventListener)
for (var b = g.length; b;) this.addEventListener(g[--b], m, !1);
else this.onmousewheel = m
},
teardown: function() {
if (this.removeEventListener)
for (var b = g.length; b;) this.removeEventListener(g[--b], m, !1);
else this.onmousewheel = null
}
};
c.fn.extend({
mousewheel: function(b) {
return b ? this.bind("mousewheel", b) : this.trigger("mousewheel")
},
unmousewheel: function(b) {
return this.unbind("mousewheel", b)
}
})
});
titlehtml = {
title: function(a, b, c, d) {
d || (d = -5);
$("body").append('<div id="js_title_' + a + '" class="js_titleRemove"><div id="easyTooltip">' + b + '</div><div class="tooltip"></div></div>');
xOffset = $("#" + c + a).offset().left + d;
yOffset = $("#" + c + a).offset().top - 32;
$("#js_title_" + a).css("position", "absolute").css("top", yOffset + "px").css("left", xOffset + "px").css("display", "none").fadeIn("fast");
$("#" + c + a).mouseout(function() {
$(".js_titleRemove").remove()
})
},
title_close: function(a) {
$("#js_title_" + a).remove()
}
}
?>