Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (typeof(jqac) === 'undefined') {
- jqac = jQuery;
- }
- if (c_push_engine == "1") {
- jqac("<div/>").attr("pub-key", c_push_publish).attr("sub-key", c_push_subscribe).attr("ssl", "off").attr("origin", "www.arrowpushengine.com").attr("id", "pubnub").appendTo(jqac('body'));
- }
- if (!jqac.placeholder) {
- new function($) {
- $.fn.placeholder = function(settings) {
- settings = settings || {};
- var key = settings.dataKey || "placeholderValue";
- var attr = settings.attr || "placeholder";
- var className = settings.className || "placeholder";
- var values = settings.values || [];
- var block = settings.blockSubmit || false;
- var blank = settings.blankSubmit || false;
- var submit = settings.onSubmit || false;
- var value = settings.value || "";
- var position = settings.cursor_position || 0;
- return this.filter(":input").each(function(index) {
- $.data(this, key, values[index] || $(this).attr(attr));
- }).each(function() {
- if ($.trim($(this).val()) === "") $(this).addClass(className).val($.data(this, key));
- }).focus(function() {
- if ($.trim($(this).val()) === $.data(this, key)) $(this).removeClass(className).val(value);
- if ($.fn.setCursorPosition) {
- $(this).setCursorPosition(position);
- }
- }).blur(function() {
- if ($.trim($(this).val()) === value) $(this).addClass(className).val($.data(this, key));
- }).each(function(index, elem) {
- if (block) new function(e) {
- $(e.form).submit(function() {
- return $.trim($(e).val()) != $.data(e, key)
- });
- }(elem);
- else if (blank) new function(e) {
- $(e.form).submit(function() {
- if ($.trim($(e).val()) == $.data(e, key)) $(e).removeClass(className).val("");
- return true;
- });
- }(elem);
- else if (submit) new function(e) {
- $(e.form).submit(submit);
- }(elem);
- });
- };
- }(jqac);
- }
- if (!jqac.highlight) {
- jqac.fn.highlight = function(b) {
- function a(e, j) {
- var l = 0;
- if (e.nodeType == 3) {
- var k = e.data.toUpperCase().indexOf(j);
- if (k >= 0) {
- var h = document.createElement("span");
- h.className = "highlight";
- var f = e.splitText(k);
- var c = f.splitText(j.length);
- var d = f.cloneNode(true);
- h.appendChild(d);
- f.parentNode.replaceChild(h, f);
- l = 1
- }
- } else {
- if (e.nodeType == 1 && e.childNodes && !/(script|style)/i.test(e.tagName)) {
- for (var g = 0; g < e.childNodes.length; ++g) {
- g += a(e.childNodes[g], j)
- }
- }
- }
- return l
- }
- return this.each(function() {
- a(this, b.toUpperCase())
- })
- };
- jqac.fn.removeHighlight = function() {
- return this.find("span.highlight").each(function() {
- this.parentNode.firstChild.nodeName;
- with(this.parentNode) {
- replaceChild(this.firstChild, this);
- normalize()
- }
- }).end()
- };
- }
- if (!jqac.scrollTo) {
- (function($) {
- var h = $.scrollTo = function(a, b, c) {
- $(window).scrollTo(a, b, c)
- };
- h.defaults = {
- axis: 'xy',
- duration: parseFloat($.fn.jqac) >= 1.3 ? 0 : 1
- };
- h.window = function(a) {
- return $(window)._scrollable()
- };
- $.fn._scrollable = function() {
- return this.map(function() {
- var a = this,
- isWin = !a.nodeName || $.inArray(a.nodeName.toLowerCase(), ['iframe', '#document', 'html', 'body']) != -1;
- if (!isWin) return a;
- var b = (a.contentWindow || a).document || a.ownerDocument || a;
- return $.browser.safari || b.compatMode == 'BackCompat' ? b.body : b.documentElement
- })
- };
- $.fn.scrollTo = function(e, f, g) {
- if (typeof f == 'object') {
- g = f;
- f = 0
- }
- if (typeof g == 'function') g = {
- onAfter: g
- };
- if (e == 'max') e = 9e9;
- g = $.extend({}, h.defaults, g);
- f = f || g.speed || g.duration;
- g.queue = g.queue && g.axis.length > 1;
- if (g.queue) f /= 2;
- g.offset = both(g.offset);
- g.over = both(g.over);
- return this._scrollable().each(function() {
- var d = this,
- $elem = $(d),
- targ = e,
- toff, attr = {},
- win = $elem.is('html,body');
- switch (typeof targ) {
- case 'number':
- case 'string':
- if (/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(targ)) {
- targ = both(targ);
- break
- }
- targ = $(targ, this);
- case 'object':
- if (targ.is || targ.style) toff = (targ = $(targ)).offset()
- }
- $.each(g.axis.split(''), function(i, a) {
- var b = a == 'x' ? 'Left' : 'Top',
- pos = b.toLowerCase(),
- key = 'scroll' + b,
- old = d[key],
- max = h.max(d, a);
- if (toff) {
- attr[key] = toff[pos] + (win ? 0 : old - $elem.offset()[pos]);
- if (g.margin) {
- attr[key] -= parseInt(targ.css('margin' + b)) || 0;
- attr[key] -= parseInt(targ.css('border' + b + 'Width')) || 0
- }
- attr[key] += g.offset[pos] || 0;
- if (g.over[pos]) attr[key] += targ[a == 'x' ? 'width' : 'height']() * g.over[pos]
- } else {
- var c = targ[pos];
- attr[key] = c.slice && c.slice(-1) == '%' ? parseFloat(c) / 100 * max : c
- }
- if (/^\d+$/.test(attr[key])) attr[key] = attr[key] <= 0 ? 0 : Math.min(attr[key], max);
- if (!i && g.queue) {
- if (old != attr[key]) animate(g.onAfterFirst);
- delete attr[key]
- }
- });
- animate(g.onAfter);
- function animate(a) {
- $elem.animate(attr, f, g.easing, a && function() {
- a.call(this, e, g)
- })
- }
- }).end()
- };
- h.max = function(a, b) {
- var c = b == 'x' ? 'Width' : 'Height',
- scroll = 'scroll' + c;
- if (!$(a).is('html,body')) return a[scroll] - $(a)[c.toLowerCase()]();
- var d = 'client' + c,
- html = a.ownerDocument.documentElement,
- body = a.ownerDocument.body;
- return Math.max(html[scroll], body[scroll]) - Math.min(html[d], body[d])
- };
- function both(a) {
- return typeof a == 'object' ? a : {
- top: a,
- left: a
- }
- }
- })(jqac);
- }
- if (!jqac.idleTimer) {
- (function($) {
- $.idleTimer = function f(newTimeout) {
- var idle = false,
- enabled = true,
- timeout = 30000,
- events = 'mousemove keydown DOMMouseScroll mousewheel mousedown',
- toggleIdleState = function() {
- idle = !idle;
- f.olddate = +new Date;
- $(document).trigger($.data(document, 'idleTimer', idle ? "idle" : "active") + '.idleTimer');
- },
- stop = function() {
- enabled = false;
- clearTimeout($.idleTimer.tId);
- },
- handleUserEvent = function() {
- clearTimeout($.idleTimer.tId);
- if (enabled) {
- if (idle) {
- toggleIdleState();
- }
- $.idleTimer.tId = setTimeout(toggleIdleState, timeout);
- }
- };
- f.olddate = f.olddate || +new Date;
- if (typeof newTimeout == "number") {
- timeout = newTimeout;
- } else if (newTimeout === 'destroy') {
- stop();
- return this;
- } else if (newTimeout === 'getElapsedTime') {
- return (+new Date) - f.olddate;
- }
- $(document).bind($.trim((events + ' ').split(' ').join('.idleTimer ')), handleUserEvent);
- $.idleTimer.tId = setTimeout(toggleIdleState, timeout);
- $.data(document, 'idleTimer', "active");
- };
- })(jqac);
- }
- if (!jqac.popupWindow) {
- (function($) {
- $.fn.popupWindow = function(instanceSettings) {
- return this.each(function() {
- $(this).click(function() {
- $.fn.popupWindow.defaultSettings = {
- centerBrowser: 0,
- centerScreen: 0,
- height: 500,
- left: 0,
- location: 0,
- menubar: 0,
- resizable: 0,
- scrollbars: 0,
- status: 0,
- width: 500,
- windowName: null,
- windowURL: null,
- top: 0,
- toolbar: 0
- };
- settings = $.extend({}, $.fn.popupWindow.defaultSettings, instanceSettings || {});
- var windowFeatures = 'height=' + settings.height + ',width=' + settings.width + ',toolbar=' + settings.toolbar + ',scrollbars=' + settings.scrollbars + ',status=' + settings.status + ',resizable=' + settings.resizable + ',location=' + settings.location + ',menuBar=' + settings.menubar;
- settings.windowName = this.name || settings.windowName;
- settings.windowURL = this.href || settings.windowURL;
- var centeredY, centeredX;
- if (settings.centerBrowser) {
- if ($.browser.msie) {
- centeredY = (window.screenTop - 120) + ((((document.documentElement.clientHeight + 120) / 2) - (settings.height / 2)));
- centeredX = window.screenLeft + ((((document.body.offsetWidth + 20) / 2) - (settings.width / 2)));
- } else {
- centeredY = window.screenY + (((window.outerHeight / 2) - (settings.height / 2)));
- centeredX = window.screenX + (((window.outerWidth / 2) - (settings.width / 2)));
- }
- window.open(settings.windowURL, settings.windowName, windowFeatures + ',left=' + centeredX + ',top=' + centeredY).focus();
- } else if (settings.centerScreen) {
- centeredY = (screen.height - settings.height) / 2;
- centeredX = (screen.width - settings.width) / 2;
- window.open(settings.windowURL, settings.windowName, windowFeatures + ',left=' + centeredX + ',top=' + centeredY).focus();
- } else {
- window.open(settings.windowURL, settings.windowName, windowFeatures + ',left=' + settings.left + ',top=' + settings.top).focus();
- }
- return false;
- });
- });
- };
- })(jqac);
- };
- var swfobject = function() {
- var aq = "undefined",
- aD = "object",
- ab = "Shockwave Flash",
- X = "ShockwaveFlash.ShockwaveFlash",
- aE = "application/x-shockwave-flash",
- ac = "SWFObjectExprInst",
- ax = "onreadystatechange",
- af = window,
- aL = document,
- aB = navigator,
- aa = false,
- Z = [aN],
- aG = [],
- ag = [],
- al = [],
- aJ, ad, ap, at, ak = false,
- aU = false,
- aH, an, aI = true,
- ah = function() {
- var a = typeof aL.getElementById != aq && typeof aL.getElementsByTagName != aq && typeof aL.createElement != aq,
- e = aB.userAgent.toLowerCase(),
- c = aB.platform.toLowerCase(),
- h = c ? /win/.test(c) : /win/.test(e),
- j = c ? /mac/.test(c) : /mac/.test(e),
- g = /webkit/.test(e) ? parseFloat(e.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false,
- d = !+"\v1",
- f = [0, 0, 0],
- k = null;
- if (typeof aB.plugins != aq && typeof aB.plugins[ab] == aD) {
- k = aB.plugins[ab].description;
- if (k && !(typeof aB.mimeTypes != aq && aB.mimeTypes[aE] && !aB.mimeTypes[aE].enabledPlugin)) {
- aa = true;
- d = false;
- k = k.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
- f[0] = parseInt(k.replace(/^(.*)\..*$/, "$1"), 10);
- f[1] = parseInt(k.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
- f[2] = /[a-zA-Z]/.test(k) ? parseInt(k.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
- }
- } else {
- if (typeof af.ActiveXObject != aq) {
- try {
- var i = new ActiveXObject(X);
- if (i) {
- k = i.GetVariable("$version");
- if (k) {
- d = true;
- k = k.split(" ")[1].split(",");
- f = [parseInt(k[0], 10), parseInt(k[1], 10), parseInt(k[2], 10)];
- }
- }
- } catch (b) {}
- }
- }
- return {
- w3: a,
- pv: f,
- wk: g,
- ie: d,
- win: h,
- mac: j
- };
- }(),
- aK = function() {
- if (!ah.w3) {
- return;
- }
- if ((typeof aL.readyState != aq && aL.readyState == "complete") || (typeof aL.readyState == aq && (aL.getElementsByTagName("body")[0] || aL.body))) {
- aP();
- }
- if (!ak) {
- if (typeof aL.addEventListener != aq) {
- aL.addEventListener("DOMContentLoaded", aP, false);
- }
- if (ah.ie && ah.win) {
- aL.attachEvent(ax, function() {
- if (aL.readyState == "complete") {
- aL.detachEvent(ax, arguments.callee);
- aP();
- }
- });
- if (af == top) {
- (function() {
- if (ak) {
- return;
- }
- try {
- aL.documentElement.doScroll("left");
- } catch (a) {
- setTimeout(arguments.callee, 0);
- return;
- }
- aP();
- })();
- }
- }
- if (ah.wk) {
- (function() {
- if (ak) {
- return;
- }
- if (!/loaded|complete/.test(aL.readyState)) {
- setTimeout(arguments.callee, 0);
- return;
- }
- aP();
- })();
- }
- aC(aP);
- }
- }();
- function aP() {
- if (ak) {
- return;
- }
- try {
- var b = aL.getElementsByTagName("body")[0].appendChild(ar("span"));
- b.parentNode.removeChild(b);
- } catch (a) {
- return;
- }
- ak = true;
- var d = Z.length;
- for (var c = 0; c < d; c++) {
- Z[c]();
- }
- }
- function aj(a) {
- if (ak) {
- a();
- } else {
- Z[Z.length] = a;
- }
- }
- function aC(a) {
- if (typeof af.addEventListener != aq) {
- af.addEventListener("load", a, false);
- } else {
- if (typeof aL.addEventListener != aq) {
- aL.addEventListener("load", a, false);
- } else {
- if (typeof af.attachEvent != aq) {
- aM(af, "onload", a);
- } else {
- if (typeof af.onload == "function") {
- var b = af.onload;
- af.onload = function() {
- b();
- a();
- };
- } else {
- af.onload = a;
- }
- }
- }
- }
- }
- function aN() {
- if (aa) {
- Y();
- } else {
- am();
- }
- }
- function Y() {
- var d = aL.getElementsByTagName("body")[0];
- var b = ar(aD);
- b.setAttribute("type", aE);
- var a = d.appendChild(b);
- if (a) {
- var c = 0;
- (function() {
- if (typeof a.GetVariable != aq) {
- var e = a.GetVariable("$version");
- if (e) {
- e = e.split(" ")[1].split(",");
- ah.pv = [parseInt(e[0], 10), parseInt(e[1], 10), parseInt(e[2], 10)];
- }
- } else {
- if (c < 10) {
- c++;
- setTimeout(arguments.callee, 10);
- return;
- }
- }
- d.removeChild(b);
- a = null;
- am();
- })();
- } else {
- am();
- }
- }
- function am() {
- var g = aG.length;
- if (g > 0) {
- for (var h = 0; h < g; h++) {
- var c = aG[h].id;
- var l = aG[h].callbackFn;
- var a = {
- success: false,
- id: c
- };
- if (ah.pv[0] > 0) {
- var i = aS(c);
- if (i) {
- if (ao(aG[h].swfVersion) && !(ah.wk && ah.wk < 312)) {
- ay(c, true);
- if (l) {
- a.success = true;
- a.ref = av(c);
- l(a);
- }
- } else {
- if (aG[h].expressInstall && au()) {
- var e = {};
- e.data = aG[h].expressInstall;
- e.width = i.getAttribute("width") || "0";
- e.height = i.getAttribute("height") || "0";
- if (i.getAttribute("class")) {
- e.styleclass = i.getAttribute("class");
- }
- if (i.getAttribute("align")) {
- e.align = i.getAttribute("align");
- }
- var f = {};
- var d = i.getElementsByTagName("param");
- var k = d.length;
- for (var j = 0; j < k; j++) {
- if (d[j].getAttribute("name").toLowerCase() != "movie") {
- f[d[j].getAttribute("name")] = d[j].getAttribute("value");
- }
- }
- ae(e, f, c, l);
- } else {
- aF(i);
- if (l) {
- l(a);
- }
- }
- }
- }
- } else {
- ay(c, true);
- if (l) {
- var b = av(c);
- if (b && typeof b.SetVariable != aq) {
- a.success = true;
- a.ref = b;
- }
- l(a);
- }
- }
- }
- }
- }
- function av(b) {
- var d = null;
- var c = aS(b);
- if (c && c.nodeName == "OBJECT") {
- if (typeof c.SetVariable != aq) {
- d = c;
- } else {
- var a = c.getElementsByTagName(aD)[0];
- if (a) {
- d = a;
- }
- }
- }
- return d;
- }
- function au() {
- return !aU && ao("6.0.65") && (ah.win || ah.mac) && !(ah.wk && ah.wk < 312);
- }
- function ae(f, d, h, e) {
- aU = true;
- ap = e || null;
- at = {
- success: false,
- id: h
- };
- var a = aS(h);
- if (a) {
- if (a.nodeName == "OBJECT") {
- aJ = aO(a);
- ad = null;
- } else {
- aJ = a;
- ad = h;
- }
- f.id = ac;
- if (typeof f.width == aq || (!/%$/.test(f.width) && parseInt(f.width, 10) < 310)) {
- f.width = "310";
- }
- if (typeof f.height == aq || (!/%$/.test(f.height) && parseInt(f.height, 10) < 137)) {
- f.height = "137";
- }
- aL.title = aL.title.slice(0, 47) + " - Flash Player Installation";
- var b = ah.ie && ah.win ? "ActiveX" : "PlugIn",
- c = "MMredirectURL=" + af.location.toString().replace(/&/g, "%26") + "&MMplayerType=" + b + "&MMdoctitle=" + aL.title;
- if (typeof d.flashvars != aq) {
- d.flashvars += "&" + c;
- } else {
- d.flashvars = c;
- }
- if (ah.ie && ah.win && a.readyState != 4) {
- var g = ar("div");
- h += "SWFObjectNew";
- g.setAttribute("id", h);
- a.parentNode.insertBefore(g, a);
- a.style.display = "none";
- (function() {
- if (a.readyState == 4) {
- a.parentNode.removeChild(a);
- } else {
- setTimeout(arguments.callee, 10);
- }
- })();
- }
- aA(f, d, h);
- }
- }
- function aF(a) {
- if (ah.ie && ah.win && a.readyState != 4) {
- var b = ar("div");
- a.parentNode.insertBefore(b, a);
- b.parentNode.replaceChild(aO(a), b);
- a.style.display = "none";
- (function() {
- if (a.readyState == 4) {
- a.parentNode.removeChild(a);
- } else {
- setTimeout(arguments.callee, 10);
- }
- })();
- } else {
- a.parentNode.replaceChild(aO(a), a);
- }
- }
- function aO(b) {
- var d = ar("div");
- if (ah.win && ah.ie) {
- d.innerHTML = b.innerHTML;
- } else {
- var e = b.getElementsByTagName(aD)[0];
- if (e) {
- var a = e.childNodes;
- if (a) {
- var f = a.length;
- for (var c = 0; c < f; c++) {
- if (!(a[c].nodeType == 1 && a[c].nodeName == "PARAM") && !(a[c].nodeType == 8)) {
- d.appendChild(a[c].cloneNode(true));
- }
- }
- }
- }
- }
- return d;
- }
- function aA(e, g, c) {
- var d, a = aS(c);
- if (ah.wk && ah.wk < 312) {
- return d;
- }
- if (a) {
- if (typeof e.id == aq) {
- e.id = c;
- }
- if (ah.ie && ah.win) {
- var f = "";
- for (var i in e) {
- if (e[i] != Object.prototype[i]) {
- if (i.toLowerCase() == "data") {
- g.movie = e[i];
- } else {
- if (i.toLowerCase() == "styleclass") {
- f += ' class="' + e[i] + '"';
- } else {
- if (i.toLowerCase() != "classid") {
- f += " " + i + '="' + e[i] + '"';
- }
- }
- }
- }
- }
- var h = "";
- for (var j in g) {
- if (g[j] != Object.prototype[j]) {
- h += '<param name="' + j + '" value="' + g[j] + '" />';
- }
- }
- a.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + f + ">" + h + "</object>";
- ag[ag.length] = e.id;
- d = aS(e.id);
- } else {
- var b = ar(aD);
- b.setAttribute("type", aE);
- for (var k in e) {
- if (e[k] != Object.prototype[k]) {
- if (k.toLowerCase() == "styleclass") {
- b.setAttribute("class", e[k]);
- } else {
- if (k.toLowerCase() != "classid") {
- b.setAttribute(k, e[k]);
- }
- }
- }
- }
- for (var l in g) {
- if (g[l] != Object.prototype[l] && l.toLowerCase() != "movie") {
- aQ(b, l, g[l]);
- }
- }
- a.parentNode.replaceChild(b, a);
- d = b;
- }
- }
- return d;
- }
- function aQ(b, d, c) {
- var a = ar("param");
- a.setAttribute("name", d);
- a.setAttribute("value", c);
- b.appendChild(a);
- }
- function aw(a) {
- var b = aS(a);
- if (b && b.nodeName == "OBJECT") {
- if (ah.ie && ah.win) {
- b.style.display = "none";
- (function() {
- if (b.readyState == 4) {
- aT(a);
- } else {
- setTimeout(arguments.callee, 10);
- }
- })();
- } else {
- b.parentNode.removeChild(b);
- }
- }
- }
- function aT(a) {
- var b = aS(a);
- if (b) {
- for (var c in b) {
- if (typeof b[c] == "function") {
- b[c] = null;
- }
- }
- b.parentNode.removeChild(b);
- }
- }
- function aS(a) {
- var c = null;
- try {
- c = aL.getElementById(a);
- } catch (b) {}
- return c;
- }
- function ar(a) {
- return aL.createElement(a);
- }
- function aM(a, c, b) {
- a.attachEvent(c, b);
- al[al.length] = [a, c, b];
- }
- function ao(a) {
- var b = ah.pv,
- c = a.split(".");
- c[0] = parseInt(c[0], 10);
- c[1] = parseInt(c[1], 10) || 0;
- c[2] = parseInt(c[2], 10) || 0;
- return (b[0] > c[0] || (b[0] == c[0] && b[1] > c[1]) || (b[0] == c[0] && b[1] == c[1] && b[2] >= c[2])) ? true : false;
- }
- function az(b, f, a, c) {
- if (ah.ie && ah.mac) {
- return;
- }
- var e = aL.getElementsByTagName("head")[0];
- if (!e) {
- return;
- }
- var g = (a && typeof a == "string") ? a : "screen";
- if (c) {
- aH = null;
- an = null;
- }
- if (!aH || an != g) {
- var d = ar("style");
- d.setAttribute("type", "text/css");
- d.setAttribute("media", g);
- aH = e.appendChild(d);
- if (ah.ie && ah.win && typeof aL.styleSheets != aq && aL.styleSheets.length > 0) {
- aH = aL.styleSheets[aL.styleSheets.length - 1];
- }
- an = g;
- }
- if (ah.ie && ah.win) {
- if (aH && typeof aH.addRule == aD) {
- aH.addRule(b, f);
- }
- } else {
- if (aH && typeof aL.createTextNode != aq) {
- aH.appendChild(aL.createTextNode(b + " {" + f + "}"));
- }
- }
- }
- function ay(a, c) {
- if (!aI) {
- return;
- }
- var b = c ? "visible" : "hidden";
- if (ak && aS(a)) {
- aS(a).style.visibility = b;
- } else {
- az("#" + a, "visibility:" + b);
- }
- }
- function ai(b) {
- var a = /[\\\"<>\.;]/;
- var c = a.exec(b) != null;
- return c && typeof encodeURIComponent != aq ? encodeURIComponent(b) : b;
- }
- var aR = function() {
- if (ah.ie && ah.win) {
- window.attachEvent("onunload", function() {
- var a = al.length;
- for (var b = 0; b < a; b++) {
- al[b][0].detachEvent(al[b][1], al[b][2]);
- }
- var d = ag.length;
- for (var c = 0; c < d; c++) {
- aw(ag[c]);
- }
- for (var e in ah) {
- ah[e] = null;
- }
- ah = null;
- for (var f in swfobject) {
- swfobject[f] = null;
- }
- swfobject = null;
- });
- }
- }();
- return {
- registerObject: function(a, e, c, b) {
- if (ah.w3 && a && e) {
- var d = {};
- d.id = a;
- d.swfVersion = e;
- d.expressInstall = c;
- d.callbackFn = b;
- aG[aG.length] = d;
- ay(a, false);
- } else {
- if (b) {
- b({
- success: false,
- id: a
- });
- }
- }
- },
- getObjectById: function(a) {
- if (ah.w3) {
- return av(a);
- }
- },
- embedSWF: function(k, e, h, f, c, a, b, i, g, j) {
- var d = {
- success: false,
- id: e
- };
- if (ah.w3 && !(ah.wk && ah.wk < 312) && k && e && h && f && c) {
- ay(e, false);
- aj(function() {
- h += "";
- f += "";
- var q = {};
- if (g && typeof g === aD) {
- for (var o in g) {
- q[o] = g[o];
- }
- }
- q.data = k;
- q.width = h;
- q.height = f;
- var n = {};
- if (i && typeof i === aD) {
- for (var p in i) {
- n[p] = i[p];
- }
- }
- if (b && typeof b === aD) {
- for (var l in b) {
- if (typeof n.flashvars != aq) {
- n.flashvars += "&" + l + "=" + b[l];
- } else {
- n.flashvars = l + "=" + b[l];
- }
- }
- }
- if (ao(c)) {
- var m = aA(q, n, e);
- if (q.id == e) {
- ay(e, true);
- }
- d.success = true;
- d.ref = m;
- } else {
- if (a && au()) {
- q.data = a;
- ae(q, n, e, j);
- return;
- } else {
- ay(e, true);
- }
- }
- if (j) {
- j(d);
- }
- });
- } else {
- if (j) {
- j(d);
- }
- }
- },
- switchOffAutoHideShow: function() {
- aI = false;
- },
- ua: ah,
- getFlashPlayerVersion: function() {
- return {
- major: ah.pv[0],
- minor: ah.pv[1],
- release: ah.pv[2]
- };
- },
- hasFlashPlayerVersion: ao,
- createSWF: function(a, b, c) {
- if (ah.w3) {
- return aA(a, b, c);
- } else {
- return undefined;
- }
- },
- showExpressInstall: function(b, a, d, c) {
- if (ah.w3 && au()) {
- ae(b, a, d, c);
- }
- },
- removeSWF: function(a) {
- if (ah.w3) {
- aw(a);
- }
- },
- createCSS: function(b, a, c, d) {
- if (ah.w3) {
- az(b, a, c, d);
- }
- },
- addDomLoadEvent: aj,
- addLoadEvent: aC,
- getQueryParamValue: function(b) {
- var a = aL.location.search || aL.location.hash;
- if (a) {
- if (/\?/.test(a)) {
- a = a.split("?")[1];
- }
- if (b == null) {
- return ai(a);
- }
- var c = a.split("&");
- for (var d = 0; d < c.length; d++) {
- if (c[d].substring(0, c[d].indexOf("=")) == b) {
- return ai(c[d].substring((c[d].indexOf("=") + 1)));
- }
- }
- }
- return "";
- },
- expressInstallCallback: function() {
- if (aU) {
- var a = aS(ac);
- if (a && aJ) {
- a.parentNode.replaceChild(aJ, a);
- if (ad) {
- ay(ad, true);
- if (ah.ie && ah.win) {
- aJ.style.display = "block";
- }
- }
- if (ap) {
- ap(at);
- }
- }
- aU = false;
- }
- }
- };
- }();
- var SWFUpload;
- if (SWFUpload == undefined) {
- SWFUpload = function(b) {
- this.initSWFUpload(b);
- };
- }
- SWFUpload.prototype.initSWFUpload = function(c) {
- try {
- this.customSettings = {};
- this.settings = c;
- this.eventQueue = [];
- this.movieName = "SWFUpload_" + SWFUpload.movieCount++;
- this.movieElement = null;
- SWFUpload.instances[this.movieName] = this;
- this.initSettings();
- this.loadFlash();
- this.displayDebugInfo();
- } catch (d) {
- delete SWFUpload.instances[this.movieName];
- throw d;
- }
- };
- SWFUpload.instances = {};
- SWFUpload.movieCount = 0;
- SWFUpload.version = "2.2.0 2009-03-25";
- SWFUpload.QUEUE_ERROR = {
- QUEUE_LIMIT_EXCEEDED: -100,
- FILE_EXCEEDS_SIZE_LIMIT: -110,
- ZERO_BYTE_FILE: -120,
- INVALID_FILETYPE: -130
- };
- SWFUpload.UPLOAD_ERROR = {
- HTTP_ERROR: -200,
- MISSING_UPLOAD_URL: -210,
- IO_ERROR: -220,
- SECURITY_ERROR: -230,
- UPLOAD_LIMIT_EXCEEDED: -240,
- UPLOAD_FAILED: -250,
- SPECIFIED_FILE_ID_NOT_FOUND: -260,
- FILE_VALIDATION_FAILED: -270,
- FILE_CANCELLED: -280,
- UPLOAD_STOPPED: -290
- };
- SWFUpload.FILE_STATUS = {
- QUEUED: -1,
- IN_PROGRESS: -2,
- ERROR: -3,
- COMPLETE: -4,
- CANCELLED: -5
- };
- SWFUpload.BUTTON_ACTION = {
- SELECT_FILE: -100,
- SELECT_FILES: -110,
- START_UPLOAD: -120
- };
- SWFUpload.CURSOR = {
- ARROW: -1,
- HAND: -2
- };
- SWFUpload.WINDOW_MODE = {
- WINDOW: "window",
- TRANSPARENT: "transparent",
- OPAQUE: "opaque"
- };
- SWFUpload.completeURL = function(e) {
- if (typeof(e) !== "string" || e.match(/^https?:\/\//i) || e.match(/^\//)) {
- return e;
- }
- var f = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ":" + window.location.port : "");
- var d = window.location.pathname.lastIndexOf("/");
- if (d <= 0) {
- path = "/";
- } else {
- path = window.location.pathname.substr(0, d) + "/";
- }
- return path + e;
- };
- SWFUpload.prototype.initSettings = function() {
- this.ensureDefault = function(c, d) {
- this.settings[c] = (this.settings[c] == undefined) ? d : this.settings[c];
- };
- this.ensureDefault("upload_url", "");
- this.ensureDefault("preserve_relative_urls", false);
- this.ensureDefault("file_post_name", "Filedata");
- this.ensureDefault("post_params", {});
- this.ensureDefault("use_query_string", false);
- this.ensureDefault("requeue_on_error", false);
- this.ensureDefault("http_success", []);
- this.ensureDefault("assume_success_timeout", 0);
- this.ensureDefault("file_types", "*.*");
- this.ensureDefault("file_types_description", "All Files");
- this.ensureDefault("file_size_limit", 0);
- this.ensureDefault("file_upload_limit", 0);
- this.ensureDefault("file_queue_limit", 0);
- this.ensureDefault("flash_url", "swfupload.swf");
- this.ensureDefault("prevent_swf_caching", true);
- this.ensureDefault("button_image_url", "");
- this.ensureDefault("button_width", 1);
- this.ensureDefault("button_height", 1);
- this.ensureDefault("button_text", "");
- this.ensureDefault("button_text_style", "color: #000000; font-size: 16pt;");
- this.ensureDefault("button_text_top_padding", 0);
- this.ensureDefault("button_text_left_padding", 0);
- this.ensureDefault("button_action", SWFUpload.BUTTON_ACTION.SELECT_FILES);
- this.ensureDefault("button_disabled", false);
- this.ensureDefault("button_placeholder_id", "");
- this.ensureDefault("button_placeholder", null);
- this.ensureDefault("button_cursor", SWFUpload.CURSOR.ARROW);
- this.ensureDefault("button_window_mode", SWFUpload.WINDOW_MODE.WINDOW);
- this.ensureDefault("debug", false);
- this.settings.debug_enabled = this.settings.debug;
- this.settings.return_upload_start_handler = this.returnUploadStart;
- this.ensureDefault("swfupload_loaded_handler", null);
- this.ensureDefault("file_dialog_start_handler", null);
- this.ensureDefault("file_queued_handler", null);
- this.ensureDefault("file_queue_error_handler", null);
- this.ensureDefault("file_dialog_complete_handler", null);
- this.ensureDefault("upload_start_handler", null);
- this.ensureDefault("upload_progress_handler", null);
- this.ensureDefault("upload_error_handler", null);
- this.ensureDefault("upload_success_handler", null);
- this.ensureDefault("upload_complete_handler", null);
- this.ensureDefault("debug_handler", this.debugMessage);
- this.ensureDefault("custom_settings", {});
- this.customSettings = this.settings.custom_settings;
- if (!!this.settings.prevent_swf_caching) {
- this.settings.flash_url = this.settings.flash_url + (this.settings.flash_url.indexOf("?") < 0 ? "?" : "&") + "preventswfcaching=" + new Date().getTime();
- }
- if (!this.settings.preserve_relative_urls) {
- this.settings.upload_url = SWFUpload.completeURL(this.settings.upload_url);
- this.settings.button_image_url = SWFUpload.completeURL(this.settings.button_image_url);
- }
- delete this.ensureDefault;
- };
- SWFUpload.prototype.loadFlash = function() {
- var d, c;
- if (document.getElementById(this.movieName) !== null) {
- throw "ID " + this.movieName + " is already in use. The Flash Object could not be added";
- }
- d = document.getElementById(this.settings.button_placeholder_id) || this.settings.button_placeholder;
- if (d == undefined) {
- throw "Could not find the placeholder element: " + this.settings.button_placeholder_id;
- }
- c = document.createElement("div");
- c.innerHTML = this.getFlashHTML();
- d.parentNode.replaceChild(c.firstChild, d);
- if (window[this.movieName] == undefined) {
- window[this.movieName] = this.getMovieElement();
- }
- };
- SWFUpload.prototype.getFlashHTML = function() {
- return ['<object id="', this.movieName, '" type="application/x-shockwave-flash" data="', this.settings.flash_url, '" width="', this.settings.button_width, '" height="', this.settings.button_height, '" class="swfupload">', '<param name="wmode" value="', this.settings.button_window_mode, '" />', '<param name="movie" value="', this.settings.flash_url, '" />', '<param name="quality" value="high" />', '<param name="menu" value="false" />', '<param name="allowScriptAccess" value="always" />', '<param name="flashvars" value="' + this.getFlashVars() + '" />', "</object>"].join("");
- };
- SWFUpload.prototype.getFlashVars = function() {
- var c = this.buildParamString();
- var d = this.settings.http_success.join(",");
- return ["movieName=", encodeURIComponent(this.movieName), "&uploadURL=", encodeURIComponent(this.settings.upload_url), "&useQueryString=", encodeURIComponent(this.settings.use_query_string), "&requeueOnError=", encodeURIComponent(this.settings.requeue_on_error), "&httpSuccess=", encodeURIComponent(d), "&assumeSuccessTimeout=", encodeURIComponent(this.settings.assume_success_timeout), "&params=", encodeURIComponent(c), "&filePostName=", encodeURIComponent(this.settings.file_post_name), "&fileTypes=", encodeURIComponent(this.settings.file_types), "&fileTypesDescription=", encodeURIComponent(this.settings.file_types_description), "&fileSizeLimit=", encodeURIComponent(this.settings.file_size_limit), "&fileUploadLimit=", encodeURIComponent(this.settings.file_upload_limit), "&fileQueueLimit=", encodeURIComponent(this.settings.file_queue_limit), "&debugEnabled=", encodeURIComponent(this.settings.debug_enabled), "&buttonImageURL=", encodeURIComponent(this.settings.button_image_url), "&buttonWidth=", encodeURIComponent(this.settings.button_width), "&buttonHeight=", encodeURIComponent(this.settings.button_height), "&buttonText=", encodeURIComponent(this.settings.button_text), "&buttonTextTopPadding=", encodeURIComponent(this.settings.button_text_top_padding), "&buttonTextLeftPadding=", encodeURIComponent(this.settings.button_text_left_padding), "&buttonTextStyle=", encodeURIComponent(this.settings.button_text_style), "&buttonAction=", encodeURIComponent(this.settings.button_action), "&buttonDisabled=", encodeURIComponent(this.settings.button_disabled), "&buttonCursor=", encodeURIComponent(this.settings.button_cursor)].join("");
- };
- SWFUpload.prototype.getMovieElement = function() {
- if (this.movieElement == undefined) {
- this.movieElement = document.getElementById(this.movieName);
- }
- if (this.movieElement === null) {
- throw "Could not find Flash element";
- }
- return this.movieElement;
- };
- SWFUpload.prototype.buildParamString = function() {
- var f = this.settings.post_params;
- var d = [];
- if (typeof(f) === "object") {
- for (var e in f) {
- if (f.hasOwnProperty(e)) {
- d.push(encodeURIComponent(e.toString()) + "=" + encodeURIComponent(f[e].toString()));
- }
- }
- }
- return d.join("&");
- };
- SWFUpload.prototype.destroy = function() {
- try {
- this.cancelUpload(null, false);
- var g = null;
- g = this.getMovieElement();
- if (g && typeof(g.CallFunction) === "unknown") {
- for (var j in g) {
- try {
- if (typeof(g[j]) === "function") {
- g[j] = null;
- }
- } catch (h) {}
- }
- try {
- g.parentNode.removeChild(g);
- } catch (f) {}
- }
- window[this.movieName] = null;
- SWFUpload.instances[this.movieName] = null;
- delete SWFUpload.instances[this.movieName];
- this.movieElement = null;
- this.settings = null;
- this.customSettings = null;
- this.eventQueue = null;
- this.movieName = null;
- return true;
- } catch (i) {
- return false;
- }
- };
- SWFUpload.prototype.displayDebugInfo = function() {
- this.debug(["---SWFUpload Instance Info---\n", "Version: ", SWFUpload.version, "\n", "Movie Name: ", this.movieName, "\n", "Settings:\n", "\t", "upload_url: ", this.settings.upload_url, "\n", "\t", "flash_url: ", this.settings.flash_url, "\n", "\t", "use_query_string: ", this.settings.use_query_string.toString(), "\n", "\t", "requeue_on_error: ", this.settings.requeue_on_error.toString(), "\n", "\t", "http_success: ", this.settings.http_success.join(", "), "\n", "\t", "assume_success_timeout: ", this.settings.assume_success_timeout, "\n", "\t", "file_post_name: ", this.settings.file_post_name, "\n", "\t", "post_params: ", this.settings.post_params.toString(), "\n", "\t", "file_types: ", this.settings.file_types, "\n", "\t", "file_types_description: ", this.settings.file_types_description, "\n", "\t", "file_size_limit: ", this.settings.file_size_limit, "\n", "\t", "file_upload_limit: ", this.settings.file_upload_limit, "\n", "\t", "file_queue_limit: ", this.settings.file_queue_limit, "\n", "\t", "debug: ", this.settings.debug.toString(), "\n", "\t", "prevent_swf_caching: ", this.settings.prevent_swf_caching.toString(), "\n", "\t", "button_placeholder_id: ", this.settings.button_placeholder_id.toString(), "\n", "\t", "button_placeholder: ", (this.settings.button_placeholder ? "Set" : "Not Set"), "\n", "\t", "button_image_url: ", this.settings.button_image_url.toString(), "\n", "\t", "button_width: ", this.settings.button_width.toString(), "\n", "\t", "button_height: ", this.settings.button_height.toString(), "\n", "\t", "button_text: ", this.settings.button_text.toString(), "\n", "\t", "button_text_style: ", this.settings.button_text_style.toString(), "\n", "\t", "button_text_top_padding: ", this.settings.button_text_top_padding.toString(), "\n", "\t", "button_text_left_padding: ", this.settings.button_text_left_padding.toString(), "\n", "\t", "button_action: ", this.settings.button_action.toString(), "\n", "\t", "button_disabled: ", this.settings.button_disabled.toString(), "\n", "\t", "custom_settings: ", this.settings.custom_settings.toString(), "\n", "Event Handlers:\n", "\t", "swfupload_loaded_handler assigned: ", (typeof this.settings.swfupload_loaded_handler === "function").toString(), "\n", "\t", "file_dialog_start_handler assigned: ", (typeof this.settings.file_dialog_start_handler === "function").toString(), "\n", "\t", "file_queued_handler assigned: ", (typeof this.settings.file_queued_handler === "function").toString(), "\n", "\t", "file_queue_error_handler assigned: ", (typeof this.settings.file_queue_error_handler === "function").toString(), "\n", "\t", "upload_start_handler assigned: ", (typeof this.settings.upload_start_handler === "function").toString(), "\n", "\t", "upload_progress_handler assigned: ", (typeof this.settings.upload_progress_handler === "function").toString(), "\n", "\t", "upload_error_handler assigned: ", (typeof this.settings.upload_error_handler === "function").toString(), "\n", "\t", "upload_success_handler assigned: ", (typeof this.settings.upload_success_handler === "function").toString(), "\n", "\t", "upload_complete_handler assigned: ", (typeof this.settings.upload_complete_handler === "function").toString(), "\n", "\t", "debug_handler assigned: ", (typeof this.settings.debug_handler === "function").toString(), "\n"].join(""));
- };
- SWFUpload.prototype.addSetting = function(d, f, e) {
- if (f == undefined) {
- return (this.settings[d] = e);
- } else {
- return (this.settings[d] = f);
- }
- };
- SWFUpload.prototype.getSetting = function(b) {
- if (this.settings[b] != undefined) {
- return this.settings[b];
- }
- return "";
- };
- SWFUpload.prototype.callFlash = function(functionName, argumentArray) {
- argumentArray = argumentArray || [];
- var movieElement = this.getMovieElement();
- var returnValue, returnString;
- try {
- returnString = movieElement.CallFunction('<invoke name="' + functionName + '" returntype="javascript">' + __flash__argumentsToXML(argumentArray, 0) + "</invoke>");
- returnValue = eval(returnString);
- } catch (ex) {
- throw "Call to " + functionName + " failed";
- }
- if (returnValue != undefined && typeof returnValue.post === "object") {
- returnValue = this.unescapeFilePostParams(returnValue);
- }
- return returnValue;
- };
- SWFUpload.prototype.selectFile = function() {
- this.callFlash("SelectFile");
- };
- SWFUpload.prototype.selectFiles = function() {
- this.callFlash("SelectFiles");
- };
- SWFUpload.prototype.startUpload = function(b) {
- this.callFlash("StartUpload", [b]);
- };
- SWFUpload.prototype.cancelUpload = function(d, c) {
- if (c !== false) {
- c = true;
- }
- this.callFlash("CancelUpload", [d, c]);
- };
- SWFUpload.prototype.stopUpload = function() {
- this.callFlash("StopUpload");
- };
- SWFUpload.prototype.getStats = function() {
- return this.callFlash("GetStats");
- };
- SWFUpload.prototype.setStats = function(b) {
- this.callFlash("SetStats", [b]);
- };
- SWFUpload.prototype.getFile = function(b) {
- if (typeof(b) === "number") {
- return this.callFlash("GetFileByIndex", [b]);
- } else {
- return this.callFlash("GetFile", [b]);
- }
- };
- SWFUpload.prototype.addFileParam = function(e, d, f) {
- return this.callFlash("AddFileParam", [e, d, f]);
- };
- SWFUpload.prototype.removeFileParam = function(d, c) {
- this.callFlash("RemoveFileParam", [d, c]);
- };
- SWFUpload.prototype.setUploadURL = function(b) {
- this.settings.upload_url = b.toString();
- this.callFlash("SetUploadURL", [b]);
- };
- SWFUpload.prototype.setPostParams = function(b) {
- this.settings.post_params = b;
- this.callFlash("SetPostParams", [b]);
- };
- SWFUpload.prototype.addPostParam = function(d, c) {
- this.settings.post_params[d] = c;
- this.callFlash("SetPostParams", [this.settings.post_params]);
- };
- SWFUpload.prototype.removePostParam = function(b) {
- delete this.settings.post_params[b];
- this.callFlash("SetPostParams", [this.settings.post_params]);
- };
- SWFUpload.prototype.setFileTypes = function(d, c) {
- this.settings.file_types = d;
- this.settings.file_types_description = c;
- this.callFlash("SetFileTypes", [d, c]);
- };
- SWFUpload.prototype.setFileSizeLimit = function(b) {
- this.settings.file_size_limit = b;
- this.callFlash("SetFileSizeLimit", [b]);
- };
- SWFUpload.prototype.setFileUploadLimit = function(b) {
- this.settings.file_upload_limit = b;
- this.callFlash("SetFileUploadLimit", [b]);
- };
- SWFUpload.prototype.setFileQueueLimit = function(b) {
- this.settings.file_queue_limit = b;
- this.callFlash("SetFileQueueLimit", [b]);
- };
- SWFUpload.prototype.setFilePostName = function(b) {
- this.settings.file_post_name = b;
- this.callFlash("SetFilePostName", [b]);
- };
- SWFUpload.prototype.setUseQueryString = function(b) {
- this.settings.use_query_string = b;
- this.callFlash("SetUseQueryString", [b]);
- };
- SWFUpload.prototype.setRequeueOnError = function(b) {
- this.settings.requeue_on_error = b;
- this.callFlash("SetRequeueOnError", [b]);
- };
- SWFUpload.prototype.setHTTPSuccess = function(b) {
- if (typeof b === "string") {
- b = b.replace(" ", "").split(",");
- }
- this.settings.http_success = b;
- this.callFlash("SetHTTPSuccess", [b]);
- };
- SWFUpload.prototype.setAssumeSuccessTimeout = function(b) {
- this.settings.assume_success_timeout = b;
- this.callFlash("SetAssumeSuccessTimeout", [b]);
- };
- SWFUpload.prototype.setDebugEnabled = function(b) {
- this.settings.debug_enabled = b;
- this.callFlash("SetDebugEnabled", [b]);
- };
- SWFUpload.prototype.setButtonImageURL = function(b) {
- if (b == undefined) {
- b = "";
- }
- this.settings.button_image_url = b;
- this.callFlash("SetButtonImageURL", [b]);
- };
- SWFUpload.prototype.setButtonDimensions = function(f, e) {
- this.settings.button_width = f;
- this.settings.button_height = e;
- var d = this.getMovieElement();
- if (d != undefined) {
- d.style.width = f + "px";
- d.style.height = e + "px";
- }
- this.callFlash("SetButtonDimensions", [f, e]);
- };
- SWFUpload.prototype.setButtonText = function(b) {
- this.settings.button_text = b;
- this.callFlash("SetButtonText", [b]);
- };
- SWFUpload.prototype.setButtonTextPadding = function(c, d) {
- this.settings.button_text_top_padding = d;
- this.settings.button_text_left_padding = c;
- this.callFlash("SetButtonTextPadding", [c, d]);
- };
- SWFUpload.prototype.setButtonTextStyle = function(b) {
- this.settings.button_text_style = b;
- this.callFlash("SetButtonTextStyle", [b]);
- };
- SWFUpload.prototype.setButtonDisabled = function(b) {
- this.settings.button_disabled = b;
- this.callFlash("SetButtonDisabled", [b]);
- };
- SWFUpload.prototype.setButtonAction = function(b) {
- this.settings.button_action = b;
- this.callFlash("SetButtonAction", [b]);
- };
- SWFUpload.prototype.setButtonCursor = function(b) {
- this.settings.button_cursor = b;
- this.callFlash("SetButtonCursor", [b]);
- };
- SWFUpload.prototype.queueEvent = function(d, f) {
- if (f == undefined) {
- f = [];
- } else {
- if (!(f instanceof Array)) {
- f = [f];
- }
- }
- var e = this;
- if (typeof this.settings[d] === "function") {
- this.eventQueue.push(function() {
- this.settings[d].apply(this, f);
- });
- setTimeout(function() {
- e.executeNextEvent();
- }, 0);
- } else {
- if (this.settings[d] !== null) {
- throw "Event handler " + d + " is unknown or is not a function";
- }
- }
- };
- SWFUpload.prototype.executeNextEvent = function() {
- var b = this.eventQueue ? this.eventQueue.shift() : null;
- if (typeof(b) === "function") {
- b.apply(this);
- }
- };
- SWFUpload.prototype.unescapeFilePostParams = function(l) {
- var j = /[$]([0-9a-f]{4})/i;
- var i = {};
- var k;
- if (l != undefined) {
- for (var h in l.post) {
- if (l.post.hasOwnProperty(h)) {
- k = h;
- var g;
- while ((g = j.exec(k)) !== null) {
- k = k.replace(g[0], String.fromCharCode(parseInt("0x" + g[1], 16)));
- }
- i[k] = l.post[h];
- }
- }
- l.post = i;
- }
- return l;
- };
- SWFUpload.prototype.testExternalInterface = function() {
- try {
- return this.callFlash("TestExternalInterface");
- } catch (b) {
- return false;
- }
- };
- SWFUpload.prototype.flashReady = function() {
- var b = this.getMovieElement();
- if (!b) {
- this.debug("Flash called back ready but the flash movie can't be found.");
- return;
- }
- this.cleanUp(b);
- this.queueEvent("swfupload_loaded_handler");
- };
- SWFUpload.prototype.cleanUp = function(f) {
- try {
- if (this.movieElement && typeof(f.CallFunction) === "unknown") {
- this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)");
- for (var h in f) {
- try {
- if (typeof(f[h]) === "function") {
- f[h] = null;
- }
- } catch (e) {}
- }
- }
- } catch (g) {}
- window.__flash__removeCallback = function(c, b) {
- try {
- if (c) {
- c[b] = null;
- }
- } catch (a) {}
- };
- };
- SWFUpload.prototype.fileDialogStart = function() {
- this.queueEvent("file_dialog_start_handler");
- };
- SWFUpload.prototype.fileQueued = function(b) {
- b = this.unescapeFilePostParams(b);
- this.queueEvent("file_queued_handler", b);
- };
- SWFUpload.prototype.fileQueueError = function(e, f, d) {
- e = this.unescapeFilePostParams(e);
- this.queueEvent("file_queue_error_handler", [e, f, d]);
- };
- SWFUpload.prototype.fileDialogComplete = function(d, f, e) {
- this.queueEvent("file_dialog_complete_handler", [d, f, e]);
- };
- SWFUpload.prototype.uploadStart = function(b) {
- b = this.unescapeFilePostParams(b);
- this.queueEvent("return_upload_start_handler", b);
- };
- SWFUpload.prototype.returnUploadStart = function(d) {
- var c;
- if (typeof this.settings.upload_start_handler === "function") {
- d = this.unescapeFilePostParams(d);
- c = this.settings.upload_start_handler.call(this, d);
- } else {
- if (this.settings.upload_start_handler != undefined) {
- throw "upload_start_handler must be a function";
- }
- }
- if (c === undefined) {
- c = true;
- }
- c = !!c;
- this.callFlash("ReturnUploadStart", [c]);
- };
- SWFUpload.prototype.uploadProgress = function(e, f, d) {
- e = this.unescapeFilePostParams(e);
- this.queueEvent("upload_progress_handler", [e, f, d]);
- };
- SWFUpload.prototype.uploadError = function(e, f, d) {
- e = this.unescapeFilePostParams(e);
- this.queueEvent("upload_error_handler", [e, f, d]);
- };
- SWFUpload.prototype.uploadSuccess = function(d, e, f) {
- d = this.unescapeFilePostParams(d);
- this.queueEvent("upload_success_handler", [d, e, f]);
- };
- SWFUpload.prototype.uploadComplete = function(b) {
- b = this.unescapeFilePostParams(b);
- this.queueEvent("upload_complete_handler", b);
- };
- SWFUpload.prototype.debug = function(b) {
- this.queueEvent("debug_handler", b);
- };
- SWFUpload.prototype.debugMessage = function(h) {
- if (this.settings.debug) {
- var f, g = [];
- if (typeof h === "object" && typeof h.name === "string" && typeof h.message === "string") {
- for (var e in h) {
- if (h.hasOwnProperty(e)) {
- g.push(e + ": " + h[e]);
- }
- }
- f = g.join("\n") || "";
- g = f.split("\n");
- f = "EXCEPTION: " + g.join("\nEXCEPTION: ");
- SWFUpload.Console.writeLine(f);
- } else {
- SWFUpload.Console.writeLine(h);
- }
- }
- };
- SWFUpload.Console = {};
- SWFUpload.Console.writeLine = function(g) {
- var e, f;
- try {
- e = document.getElementById("SWFUpload_Console");
- if (!e) {
- f = document.createElement("form");
- document.getElementsByTagName("body")[0].appendChild(f);
- e = document.createElement("textarea");
- e.id = "SWFUpload_Console";
- e.style.fontFamily = "monospace";
- e.setAttribute("wrap", "off");
- e.wrap = "off";
- e.style.overflow = "auto";
- e.style.width = "700px";
- e.style.height = "350px";
- e.style.margin = "5px";
- f.appendChild(e);
- }
- e.value += g + "\n";
- e.scrollTop = e.scrollHeight - e.clientHeight;
- } catch (h) {
- alert("Exception: " + h.name + " Message: " + h.message);
- }
- };
- (function(c) {
- var b = {
- init: function(d, e) {
- return this.each(function() {
- var n = c(this);
- var m = n.clone();
- var j = c.extend({
- id: n.attr("id"),
- swf: "uploadify.swf",
- uploader: "uploadify.php",
- auto: true,
- buttonClass: "",
- buttonCursor: "hand",
- buttonImage: null,
- buttonText: "SELECT FILES",
- checkExisting: false,
- debug: false,
- fileObjName: "Filedata",
- fileSizeLimit: 0,
- fileTypeDesc: "All Files",
- fileTypeExts: "*.*",
- height: 30,
- method: "post",
- multi: true,
- formData: {},
- preventCaching: true,
- progressData: "percentage",
- queueID: false,
- queueSizeLimit: 999,
- removeCompleted: true,
- removeTimeout: 3,
- requeueErrors: false,
- successTimeout: 30,
- uploadLimit: 0,
- width: 120,
- overrideEvents: []
- }, d);
- var g = {
- assume_success_timeout: j.successTimeout,
- button_placeholder_id: j.id,
- button_width: j.width,
- button_height: j.height,
- button_text: null,
- button_text_style: null,
- button_text_top_padding: 0,
- button_text_left_padding: 0,
- button_action: (j.multi ? SWFUpload.BUTTON_ACTION.SELECT_FILES : SWFUpload.BUTTON_ACTION.SELECT_FILE),
- button_disabled: false,
- button_cursor: (j.buttonCursor == "arrow" ? SWFUpload.CURSOR.ARROW : SWFUpload.CURSOR.HAND),
- button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
- debug: j.debug,
- requeue_on_error: j.requeueErrors,
- file_post_name: j.fileObjName,
- file_size_limit: j.fileSizeLimit,
- file_types: j.fileTypeExts,
- file_types_description: j.fileTypeDesc,
- file_queue_limit: j.queueSizeLimit,
- file_upload_limit: j.uploadLimit,
- flash_url: j.swf,
- prevent_swf_caching: j.preventCaching,
- post_params: j.formData,
- upload_url: j.uploader,
- use_query_string: (j.method == "get"),
- file_dialog_complete_handler: a.onDialogClose,
- file_dialog_start_handler: a.onDialogOpen,
- file_queued_handler: a.onSelect,
- file_queue_error_handler: a.onSelectError,
- swfupload_loaded_handler: j.onSWFReady,
- upload_complete_handler: a.onUploadComplete,
- upload_error_handler: a.onUploadError,
- upload_progress_handler: a.onUploadProgress,
- upload_start_handler: a.onUploadStart,
- upload_success_handler: a.onUploadSuccess
- };
- if (e) {
- g = c.extend(g, e);
- }
- g = c.extend(g, j);
- var o = swfobject.getFlashPlayerVersion();
- var h = (o.major >= 9);
- if (h) {
- window["uploadify_" + j.id] = new SWFUpload(g);
- var i = window["uploadify_" + j.id];
- n.data("uploadify", i);
- var l = c("<div />", {
- id: j.id,
- "class": "uploadify",
- css: {
- height: j.height + "px",
- width: j.width + "px"
- }
- });
- c("#" + i.movieName).wrap(l);
- l = c("#" + j.id);
- l.data("uploadify", i);
- var f = c("<div />", {
- id: j.id + "-button",
- "class": "uploadify-button " + j.buttonClass
- });
- if (j.buttonImage) {
- f.css({
- "background-image": "url('" + j.buttonImage + "')",
- "text-indent": "-9999px"
- });
- }
- f.html('<span class="uploadify-button-text">' + j.buttonText + "</span>").css({
- height: j.height + "px",
- "line-height": j.height + "px",
- width: j.width + "px"
- });
- l.append(f);
- c("#" + i.movieName).css({
- position: "relative",
- "z-index": 1
- });
- if (!j.queueID) {
- var k = c("<div />", {
- id: j.id + "-queue",
- "class": "uploadify-queue"
- });
- l.after(k);
- i.settings.queueID = j.id + "-queue";
- i.settings.defaultQueue = true;
- }
- i.queueData = {
- files: {},
- filesSelected: 0,
- filesQueued: 0,
- filesReplaced: 0,
- filesCancelled: 0,
- filesErrored: 0,
- uploadsSuccessful: 0,
- uploadsErrored: 0,
- averageSpeed: 0,
- queueLength: 0,
- queueSize: 0,
- uploadSize: 0,
- queueBytesUploaded: 0,
- uploadQueue: [],
- errorMsg: "Some files were not added to the queue:"
- };
- i.original = m;
- i.wrapper = l;
- i.button = f;
- i.queue = k;
- if (j.onInit) {
- j.onInit.call(n, i);
- }
- } else {
- if (j.onFallback) {
- j.onFallback.call(n);
- }
- }
- });
- },
- cancel: function(d, f) {
- var e = arguments;
- this.each(function() {
- var l = c(this),
- i = l.data("uploadify"),
- j = i.settings,
- h = -1;
- if (e[0]) {
- if (e[0] == "*") {
- var g = i.queueData.queueLength;
- c("#" + j.queueID).find(".uploadify-queue-item").each(function() {
- h++;
- if (e[1] === true) {
- i.cancelUpload(c(this).attr("id"), false);
- } else {
- i.cancelUpload(c(this).attr("id"));
- }
- c(this).find(".data").removeClass("data").html(" - Cancelled");
- c(this).find(".uploadify-progress-bar").remove();
- c(this).delay(1000 + 100 * h).fadeOut(500, function() {
- c(this).remove();
- });
- });
- i.queueData.queueSize = 0;
- i.queueData.queueLength = 0;
- if (j.onClearQueue) {
- j.onClearQueue.call(l, g);
- }
- } else {
- for (var m = 0; m < e.length; m++) {
- i.cancelUpload(e[m]);
- c("#" + e[m]).find(".data").removeClass("data").html(" - Cancelled");
- c("#" + e[m]).find(".uploadify-progress-bar").remove();
- c("#" + e[m]).delay(1000 + 100 * m).fadeOut(500, function() {
- c(this).remove();
- });
- }
- }
- } else {
- var k = c("#" + j.queueID).find(".uploadify-queue-item").get(0);
- $item = c(k);
- i.cancelUpload($item.attr("id"));
- $item.find(".data").removeClass("data").html(" - Cancelled");
- $item.find(".uploadify-progress-bar").remove();
- $item.delay(1000).fadeOut(500, function() {
- c(this).remove();
- });
- }
- });
- },
- destroy: function() {
- this.each(function() {
- var f = c(this),
- d = f.data("uploadify"),
- e = d.settings;
- d.destroy();
- if (e.defaultQueue) {
- c("#" + e.queueID).remove();
- }
- c("#" + e.id).replaceWith(d.original);
- if (e.onDestroy) {
- e.onDestroy.call(this);
- }
- delete d;
- });
- },
- disable: function(d) {
- this.each(function() {
- var g = c(this),
- e = g.data("uploadify"),
- f = e.settings;
- if (d) {
- e.button.addClass("disabled");
- if (f.onDisable) {
- f.onDisable.call(this);
- }
- } else {
- e.button.removeClass("disabled");
- if (f.onEnable) {
- f.onEnable.call(this);
- }
- }
- e.setButtonDisabled(d);
- });
- },
- settings: function(e, g, h) {
- var d = arguments;
- var f = g;
- this.each(function() {
- var k = c(this),
- i = k.data("uploadify"),
- j = i.settings;
- if (typeof(d[0]) == "object") {
- for (var l in g) {
- setData(l, g[l]);
- }
- }
- if (d.length === 1) {
- f = j[e];
- } else {
- switch (e) {
- case "uploader":
- i.setUploadURL(g);
- break;
- case "formData":
- if (!h) {
- g = c.extend(j.formData, g);
- }
- i.setPostParams(j.formData);
- break;
- case "method":
- if (g == "get") {
- i.setUseQueryString(true);
- } else {
- i.setUseQueryString(false);
- }
- break;
- case "fileObjName":
- i.setFilePostName(g);
- break;
- case "fileTypeExts":
- i.setFileTypes(g, j.fileTypeDesc);
- break;
- case "fileTypeDesc":
- i.setFileTypes(j.fileTypeExts, g);
- break;
- case "fileSizeLimit":
- i.setFileSizeLimit(g);
- break;
- case "uploadLimit":
- i.setFileUploadLimit(g);
- break;
- case "queueSizeLimit":
- i.setFileQueueLimit(g);
- break;
- case "buttonImage":
- i.button.css("background-image", settingValue);
- break;
- case "buttonCursor":
- if (g == "arrow") {
- i.setButtonCursor(SWFUpload.CURSOR.ARROW);
- } else {
- i.setButtonCursor(SWFUpload.CURSOR.HAND);
- }
- break;
- case "buttonText":
- c("#" + j.id + "-button").find(".uploadify-button-text").html(g);
- break;
- case "width":
- i.setButtonDimensions(g, j.height);
- break;
- case "height":
- i.setButtonDimensions(j.width, g);
- break;
- case "multi":
- if (g) {
- i.setButtonAction(SWFUpload.BUTTON_ACTION.SELECT_FILES);
- } else {
- i.setButtonAction(SWFUpload.BUTTON_ACTION.SELECT_FILE);
- }
- break;
- }
- j[e] = g;
- }
- });
- if (d.length === 1) {
- return f;
- }
- },
- stop: function() {
- this.each(function() {
- var e = c(this),
- d = e.data("uploadify");
- d.queueData.averageSpeed = 0;
- d.queueData.uploadSize = 0;
- d.queueData.bytesUploaded = 0;
- d.queueData.uploadQueue = [];
- d.stopUpload();
- });
- },
- upload: function() {
- var d = arguments;
- this.each(function() {
- var f = c(this),
- e = f.data("uploadify");
- e.queueData.averageSpeed = 0;
- e.queueData.uploadSize = 0;
- e.queueData.bytesUploaded = 0;
- e.queueData.uploadQueue = [];
- if (d[0]) {
- if (d[0] == "*") {
- e.queueData.uploadSize = e.queueData.queueSize;
- e.queueData.uploadQueue.push("*");
- e.startUpload();
- } else {
- for (var g = 0; g < d.length; g++) {
- e.queueData.uploadSize += e.queueData.files[d[g]].size;
- e.queueData.uploadQueue.push(d[g]);
- }
- e.startUpload(e.queueData.uploadQueue.shift());
- }
- } else {
- e.startUpload();
- }
- });
- }
- };
- var a = {
- onDialogOpen: function() {
- var d = this.settings;
- this.queueData.errorMsg = "Some files were not added to the queue:";
- this.queueData.filesReplaced = 0;
- this.queueData.filesCancelled = 0;
- if (d.onDialogOpen) {
- d.onDialogOpen.call(this);
- }
- },
- onDialogClose: function(d, f, g) {
- var e = this.settings;
- this.queueData.filesErrored = d - f;
- this.queueData.filesSelected = d;
- this.queueData.filesQueued = f - this.queueData.filesCancelled;
- this.queueData.queueLength = g;
- if (c.inArray("onDialogClose", e.overrideEvents) < 0) {
- if (this.queueData.filesErrored > 0) {
- alert(this.queueData.errorMsg);
- }
- }
- if (e.onDialogClose) {
- e.onDialogClose.call(this, this.queueData);
- }
- if (e.auto) {
- c("#" + e.id).uploadify("upload", "*");
- }
- },
- onSelect: function(g) {
- var h = this.settings;
- var e = {};
- for (var f in this.queueData.files) {
- e = this.queueData.files[f];
- if (e.uploaded != true && e.name == g.name) {
- var d = confirm('The file named "' + g.name + '" is already in the queue.\nDo you want to replace the existing item in the queue?');
- if (!d) {
- this.cancelUpload(g.id);
- this.queueData.filesCancelled++;
- return false;
- } else {
- c("#" + e.id).remove();
- this.cancelUpload(e.id);
- this.queueData.filesReplaced++;
- }
- }
- }
- var i = Math.round(g.size / 1024);
- var l = "KB";
- if (i > 1000) {
- i = Math.round(i / 1000);
- l = "MB";
- }
- var k = i.toString().split(".");
- i = k[0];
- if (k.length > 1) {
- i += "." + k[1].substr(0, 2);
- }
- i += l;
- var j = g.name;
- if (j.length > 25) {
- j = j.substr(0, 25) + "...";
- }
- if (c.inArray("onSelect", h.overrideEvents) < 0) {
- c("#" + h.queueID).append('<div id="' + g.id + '" class="uploadify-queue-item"> <div class="cancel"> <a href="javascript:$(\'#' + h.id + "').uploadify('cancel', '" + g.id + '\')">X</a> </div> <span class="fileName">' + j + " (" + i + ')</span><span class="data"></span> <div class="uploadify-progress"> <div class="uploadify-progress-bar"><!--Progress Bar--></div> </div> </div>');
- }
- this.queueData.queueSize += g.size;
- this.queueData.files[g.id] = g;
- if (h.onSelect) {
- h.onSelect.apply(this, arguments);
- }
- },
- onSelectError: function(d, g, f) {
- var e = this.settings;
- if (c.inArray("onSelectError", e.overrideEvents) < 0) {
- switch (g) {
- case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED:
- if (e.queueSizeLimit > f) {
- this.queueData.errorMsg += "\nThe number of files selected exceeds the remaining upload limit (" + f + ").";
- } else {
- this.queueData.errorMsg += "\nThe number of files selected exceeds the queue size limit (" + e.queueSizeLimit + ").";
- }
- break;
- case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:
- this.queueData.errorMsg += '\nThe file "' + d.name + '" exceeds the size limit (' + e.fileSizeLimit + ").";
- break;
- case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:
- this.queueData.errorMsg += '\nThe file "' + d.name + '" is empty.';
- break;
- case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:
- this.queueData.errorMsg += '\nThe file "' + d.name + '" is not an accepted file type (' + e.fileTypeDesc + ").";
- break;
- }
- }
- if (g != SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED) {
- delete this.queueData.files[d.id];
- }
- if (e.onSelectError) {
- e.onSelectError.apply(this, arguments);
- }
- },
- onQueueComplete: function() {
- if (this.settings.onQueueComplete) {
- this.settings.onQueueComplete.call(this, this.settings.queueData);
- }
- },
- onUploadComplete: function(f) {
- var g = this.settings,
- d = this;
- var e = this.getStats();
- this.queueData.queueLength = e.files_queued;
- if (this.queueData.uploadQueue[0] == "*") {
- if (this.queueData.queueLength > 0) {
- this.startUpload();
- } else {
- this.queueData.uploadQueue = [];
- if (g.onQueueComplete) {
- g.onQueueComplete.call(this, this.queueData);
- }
- }
- } else {
- if (this.queueData.uploadQueue.length > 0) {
- this.startUpload(this.queueData.uploadQueue.shift());
- } else {
- this.queueData.uploadQueue = [];
- if (g.onQueueComplete) {
- g.onQueueComplete.call(this, this.queueData);
- }
- }
- }
- if (c.inArray("onUploadComplete", g.overrideEvents) < 0) {
- if (g.removeCompleted) {
- switch (f.filestatus) {
- case SWFUpload.FILE_STATUS.COMPLETE:
- setTimeout(function() {
- if (c("#" + f.id)) {
- d.queueData.queueSize -= f.size;
- d.queueData.queueLength -= 1;
- delete d.queueData.files[f.id];
- c("#" + f.id).fadeOut(500, function() {
- c(this).remove();
- });
- }
- }, g.removeTimeout * 1000);
- break;
- case SWFUpload.FILE_STATUS.ERROR:
- if (!g.requeueErrors) {
- setTimeout(function() {
- if (c("#" + f.id)) {
- d.queueData.queueSize -= f.size;
- d.queueData.queueLength -= 1;
- delete d.queueData.files[f.id];
- c("#" + f.id).fadeOut(500, function() {
- c(this).remove();
- });
- }
- }, g.removeTimeout * 1000);
- }
- break;
- }
- } else {
- f.uploaded = true;
- }
- }
- if (g.onUploadComplete) {
- g.onUploadComplete.call(this, f);
- }
- },
- onUploadError: function(e, i, h) {
- var f = this.settings;
- var g = "Error";
- switch (i) {
- case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:
- g = "HTTP Error (" + h + ")";
- break;
- case SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL:
- g = "Missing Upload URL";
- break;
- case SWFUpload.UPLOAD_ERROR.IO_ERROR:
- g = "IO Error";
- break;
- case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:
- g = "Security Error";
- break;
- case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:
- alert("The upload limit has been reached (" + h + ").");
- g = "Exceeds Upload Limit";
- break;
- case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:
- g = "Failed";
- break;
- case SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND:
- break;
- case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:
- g = "Validation Error";
- break;
- case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:
- g = "Cancelled";
- this.queueData.queueSize -= e.size;
- this.queueData.queueLength -= 1;
- if (e.status == SWFUpload.FILE_STATUS.IN_PROGRESS || c.inArray(e.id, this.queueData.uploadQueue) >= 0) {
- this.queueData.uploadSize -= e.size;
- }
- if (f.onCancel) {
- f.onCancel.call(this, e);
- }
- delete this.queueData.files[e.id];
- break;
- case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:
- g = "Stopped";
- break;
- }
- if (c.inArray("onUploadError", f.overrideEvents) < 0) {
- if (i != SWFUpload.UPLOAD_ERROR.FILE_CANCELLED && i != SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED) {
- c("#" + e.id).addClass("uploadify-error");
- }
- c("#" + e.id).find(".uploadify-progress-bar").css("width", "1px");
- if (i != SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND && e.status != SWFUpload.FILE_STATUS.COMPLETE) {
- c("#" + e.id).find(".data").html(" - " + g);
- }
- }
- var d = this.getStats();
- this.queueData.uploadsErrored = d.upload_errors;
- if (f.onUploadError) {
- f.onUploadError.call(this, e, i, h, g);
- }
- },
- onUploadProgress: function(g, m, j) {
- var h = this.settings;
- var e = new Date();
- var n = e.getTime();
- var k = n - this.timer;
- if (k > 500) {
- this.timer = n;
- }
- var i = m - this.bytesLoaded;
- this.bytesLoaded = m;
- var d = this.queueData.queueBytesUploaded + m;
- var p = Math.round(m / j * 100);
- var o = "KB/s";
- var l = 0;
- var f = (i / 1024) / (k / 1000);
- f = Math.floor(f * 10) / 10;
- if (this.queueData.averageSpeed > 0) {
- this.queueData.averageSpeed = Math.floor((this.queueData.averageSpeed + f) / 2);
- } else {
- this.queueData.averageSpeed = Math.floor(f);
- }
- if (f > 1000) {
- l = (f * 0.001);
- this.queueData.averageSpeed = Math.floor(l);
- o = "MB/s";
- }
- if (c.inArray("onUploadProgress", h.overrideEvents) < 0) {
- if (h.progressData == "percentage") {
- c("#" + g.id).find(".data").html(" - " + p + "%");
- } else {
- if (h.progressData == "speed" && k > 500) {
- c("#" + g.id).find(".data").html(" - " + this.queueData.averageSpeed + o);
- }
- }
- c("#" + g.id).find(".uploadify-progress-bar").css("width", p + "%");
- }
- if (h.onUploadProgress) {
- h.onUploadProgress.call(this, g, m, j, d, this.queueData.uploadSize);
- }
- },
- onUploadStart: function(d) {
- var e = this.settings;
- var f = new Date();
- this.timer = f.getTime();
- this.bytesLoaded = 0;
- if (this.queueData.uploadQueue.length == 0) {
- this.queueData.uploadSize = d.size;
- }
- if (e.checkExisting) {
- c.ajax({
- type: "POST",
- async: false,
- url: e.checkExisting,
- data: {
- filename: d.name
- },
- success: function(h) {
- if (h == 1) {
- var g = confirm('A file with the name "' + d.name + '" already exists on the server.\nWould you like to replace the existing file?');
- if (!g) {
- this.cancelUpload(d.id);
- c("#" + d.id).remove();
- if (this.queueData.uploadQueue.length > 0 && this.queueData.queueLength > 0) {
- if (this.queueData.uploadQueue[0] == "*") {
- this.startUpload();
- } else {
- this.startUpload(this.queueData.uploadQueue.shift());
- }
- }
- }
- }
- }
- });
- }
- if (e.onUploadStart) {
- e.onUploadStart.call(this, d);
- }
- },
- onUploadSuccess: function(f, h, d) {
- var g = this.settings;
- var e = this.getStats();
- this.queueData.uploadsSuccessful = e.successful_uploads;
- this.queueData.queueBytesUploaded += f.size;
- if (c.inArray("onUploadSuccess", g.overrideEvents) < 0) {
- c("#" + f.id).find(".data").html(" - Complete");
- }
- if (g.onUploadSuccess) {
- g.onUploadSuccess.call(this, f, h, d);
- }
- }
- };
- c.fn.uploadify = function(d) {
- if (b[d]) {
- return b[d].apply(this, Array.prototype.slice.call(arguments, 1));
- } else {
- if (typeof d === "object" || !d) {
- return b.init.apply(this, arguments);
- } else {
- c.error("The method " + d + " does not exist in $.uploadify");
- }
- }
- };
- })(jqac);
- (function(factory) {
- if (typeof define === 'function' && define.amd) {
- define(['jqac'], factory);
- } else {
- factory(jqac);
- }
- }(function($) {
- var pluses = /\+/g;
- function encode(s) {
- return config.raw ? s : encodeURIComponent(s);
- }
- function decode(s) {
- return config.raw ? s : decodeURIComponent(s);
- }
- function stringifyCookieValue(value) {
- return encode(config.json ? JSON.stringify(value) : String(value));
- }
- function parseCookieValue(s) {
- if (s.indexOf('"') === 0) {
- s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
- }
- try {
- s = decodeURIComponent(s.replace(pluses, ' '));
- return config.json ? JSON.parse(s) : s;
- } catch (e) {}
- }
- function read(s, converter) {
- var value = config.raw ? s : parseCookieValue(s);
- return $.isFunction(converter) ? converter(value) : value;
- }
- var config = $.cookie = function(key, value, options) {
- if (value !== undefined && !$.isFunction(value)) {
- options = $.extend({}, config.defaults, options);
- if (typeof options.expires === 'number') {
- var days = options.expires,
- t = options.expires = new Date();
- t.setDate(t.getDate() + days);
- }
- return (document.cookie = [encode(key), '=', stringifyCookieValue(value), options.expires ? '; expires=' + options.expires.toUTCString() : '', options.path ? '; path=' + options.path : '', options.domain ? '; domain=' + options.domain : '', options.secure ? '; secure' : ''].join(''));
- }
- var result = key ? undefined : {};
- var cookies = document.cookie ? document.cookie.split('; ') : [];
- for (var i = 0, l = cookies.length; i < l; i++) {
- var parts = cookies[i].split('=');
- var name = decode(parts.shift());
- var cookie = parts.join('=');
- if (key && key === name) {
- result = read(cookie, value);
- break;
- }
- if (!key && (cookie = read(cookie)) !== undefined) {
- result[name] = cookie;
- }
- }
- return result;
- };
- config.defaults = {};
- $.removeCookie = function(key, options) {
- if ($.cookie(key) === undefined) {
- return false;
- }
- $.cookie(key, '', $.extend({}, options, {
- expires: -1
- }));
- return !$.cookie(key);
- };
- }));
- if (c_facebook_app_id != '' && c_disable_arrowchat != 1 && c_chat_maintenance != 1 && u_hash_id != '') {
- if (jqac.cookie('ac_facebook') == 1)
- var ac_fb_logged_in = true;
- else
- var ac_fb_logged_in = false;
- jqac('body').append('<div id="fb-root"></div>');
- (function() {
- var e = document.createElement('script');
- e.type = 'text/javascript';
- e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
- e.async = true;
- document.getElementsByTagName('head')[0].appendChild(e);
- }());
- window.fbAsyncInit = function() {
- FB.init({
- appId: c_facebook_app_id,
- cookie: true,
- status: true,
- xfbml: true
- });
- FB.getLoginStatus(function(response) {
- if (response.authResponse) {
- if (ac_fb_logged_in) {
- jqac.arrowchat.facebook(response);
- } else {
- ac_fb_logged_in = false;
- }
- }
- });
- };
- function arrowchatdoLogin() {
- if (ac_fb_logged_in) {
- jqac.arrowchat.facebookLogout();
- ac_fb_logged_in = false;
- } else {
- FB.login(function(response) {
- if (response.authResponse) {
- FB.api('/me/permissions', function(response2) {
- if (response2.data[0].xmpp_login == 1) {
- jqac.arrowchat.facebook(response);
- ac_fb_logged_in = true;
- }
- });
- } else {}
- }, {
- scope: 'xmpp_login,offline_access'
- });
- }
- }
- }
- if (c_push_engine == "1") {
- (function() {
- function r() {
- return function() {}
- }
- window.JSON && window.JSON.stringify || function() {
- function w(c) {
- k.lastIndex = 0;
- return k.test(c) ? '"' + c.replace(k, function(c) {
- var e = g[c];
- return "string" === typeof e ? e : "\\u" + ("0000" + c.charCodeAt(0).toString(16)).slice(-4)
- }) + '"' : '"' + c + '"'
- }
- function t(c, g) {
- var e, h, o, n, k = i,
- l, f = g[c];
- f && "object" === typeof f && "function" === typeof f.toJSON && (f = f.toJSON(c));
- "function" === typeof m && (f = m.call(g, c, f));
- switch (typeof f) {
- case "string":
- return w(f);
- case "number":
- return isFinite(f) ? "" + f : "null";
- case "boolean":
- case "null":
- return "" +
- f;
- case "object":
- if (!f) return "null";
- i += p;
- l = [];
- if ("[object Array]" === Object.prototype.toString.apply(f)) {
- n = f.length;
- for (e = 0; e < n; e += 1) l[e] = t(e, f) || "null";
- o = 0 === l.length ? "[]" : i ? "[\n" + i + l.join(",\n" + i) + "\n" + k + "]" : "[" + l.join(",") + "]";
- i = k;
- return o
- }
- if (m && "object" === typeof m) {
- n = m.length;
- for (e = 0; e < n; e += 1) h = m[e], "string" === typeof h && (o = t(h, f)) && l.push(w(h) + (i ? ": " : ":") + o)
- } else
- for (h in f) Object.hasOwnProperty.call(f, h) && (o = t(h, f)) && l.push(w(h) + (i ? ": " : ":") + o);
- o = 0 === l.length ? "{}" : i ? "{\n" + i + l.join(",\n" + i) + "\n" +
- k + "}" : "{" + l.join(",") + "}";
- i = k;
- return o
- }
- }
- window.JSON || (window.JSON = {});
- "function" !== typeof String.prototype.toJSON && (String.prototype.toJSON = Number.prototype.toJSON = Boolean.prototype.toJSON = function() {
- return this.valueOf()
- });
- var k = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
- i, p, g = {
- "\u0008": "\\b",
- "\t": "\\t",
- "\n": "\\n",
- "\u000c": "\\f",
- "\r": "\\r",
- '"': '\\"',
- "\\": "\\\\"
- },
- m;
- "function" !== typeof JSON.stringify && (JSON.stringify = function(c, g, e) {
- var h;
- p = i = "";
- if ("number" === typeof e)
- for (h = 0; h < e; h += 1) p += " ";
- else "string" === typeof e && (p = e);
- if ((m = g) && "function" !== typeof g && ("object" !== typeof g || "number" !== typeof g.length)) throw Error("JSON.stringify");
- return t("", {
- "": c
- })
- });
- "function" !== typeof JSON.parse && (JSON.parse = function(c) {
- return eval("(" + c + ")")
- })
- }();
- window.PUBNUB || function() {
- function w(a) {
- var b = {},
- d = a.publish_key || "",
- s = a.subscribe_key || "",
- j = a.ssl ? "s" : "",
- z = "http" + j + "://" + (a.origin || "www.arrowpushengine.com"),
- q = {
- history: function(a, b) {
- var b = a.callback || b,
- d = a.limit || 100,
- c = a.channel,
- e = f();
- if (!c) return g("Missing Channel");
- if (!b) return g("Missing Callback");
- u({
- c: e,
- url: [z, "history", s, A(c), e, d],
- b: function(a) {
- b(a)
- },
- a: function(a) {
- g(a)
- }
- })
- },
- time: function(a) {
- var b = f();
- u({
- c: b,
- url: [z, "time", b],
- b: function(b) {
- a(b[0])
- },
- a: function() {
- a(0)
- }
- })
- },
- uuid: function(a) {
- var b = f();
- u({
- c: b,
- url: ["http" + j + "://pubnub-prod.appspot.com/uuid?callback=" + b],
- b: function(b) {
- a(b[0])
- },
- a: function() {
- a(0)
- }
- })
- },
- publish: function(a, b) {
- var b = b || a.callback || r(),
- c = a.message,
- e = a.channel,
- j = f();
- if (!c) return g("Missing Message");
- if (!e) return g("Missing Channel");
- if (!d) return g("Missing Publish Key");
- c = JSON.stringify(c);
- c = [z, "publish", d, s, 0, A(e), j, A(c)];
- if (1800 < c.join().length) return g("Message Too Big");
- u({
- c: j,
- b: function(a) {
- b(a)
- },
- a: function() {
- b([0, "Disconnected"])
- },
- url: c
- })
- },
- unsubscribe: function(a) {
- a = a.channel;
- a in b && (b[a].d = 0, b[a].e && b[a].e(0))
- },
- subscribe: function(a, d) {
- function e() {
- var a = f();
- b[j].d && (b[j].e = u({
- c: a,
- url: [t, "subscribe", s, A(j), a, i],
- a: function() {
- m || (m = 1, o());
- setTimeout(e, x);
- q.time(function(a) {
- a || k()
- })
- },
- b: function(a) {
- b[j].d && (p || (p = 1, l()), m && (m = 0, n()), h = B.set(s + j, i = h && B.get(s + j) || a[1]), c(a[0], function(b) {
- d(b, a)
- }), setTimeout(e, 10))
- }
- }))
- }
- var j = a.channel,
- d = d || a.callback,
- h = a.restore,
- i = 0,
- k = a.error || r(),
- l = a.connect || r(),
- n = a.reconnect || r(),
- o = a.disconnect || r(),
- m = 0,
- p = 0,
- t = M(z);
- if (!C) return I.push([a, d, q]);
- if (!j) return g("Missing Channel");
- if (!d) return g("Missing Callback");
- if (!s) return g("Missing Subscribe Key");
- j in b || (b[j] = {});
- if (b[j].d) return g("Already Connected");
- b[j].d = 1;
- e()
- },
- xdr: u,
- ready: D,
- db: B,
- each: c,
- map: G,
- css: H,
- $: p,
- create: l,
- bind: h,
- supplant: e,
- head: o,
- search: m,
- attr: n,
- now: k,
- unique: t,
- events: y,
- updater: i,
- init: w
- };
- return q
- }
- function t() {
- return "x" + ++N + "" + +new Date
- }
- function k() {
- return +new Date
- }
- function i(a, b) {
- function d() {
- c + b > k() ? (clearTimeout(s), s = setTimeout(d, b)) : (c = k(), a())
- }
- var s, c = 0;
- return d
- }
- function p(a) {
- return document.getElementById(a)
- }
- function g(a) {
- console.log(a)
- }
- function m(a, b) {
- var d = [];
- c(a.split(/\s+/), function(a) {
- c((b || document).getElementsByTagName(a), function(a) {
- d.push(a)
- })
- });
- return d
- }
- function c(a, b) {
- if (a && b)
- if ("undefined" != typeof a[0])
- for (var d = 0, s = a.length; d < s;) b.call(a[d], a[d], d++);
- else
- for (d in a) a.hasOwnProperty && a.hasOwnProperty(d) && b.call(a[d], d, a[d])
- }
- function G(a, b) {
- var d = [];
- c(a || [], function(a, c) {
- d.push(b(a, c))
- });
- return d
- }
- function e(a, b) {
- return a.replace(O, function(a, c) {
- return b[c] || a
- })
- }
- function h(a, b, d) {
- c(a.split(","), function(a) {
- function c(a) {
- a || (a = window.event);
- d(a) || (a.cancelBubble = !0, a.returnValue = !1, a.preventDefault && a.preventDefault(), a.stopPropagation && a.stopPropagation())
- }
- b.addEventListener ? b.addEventListener(a, c, !1) : b.attachEvent ? b.attachEvent("on" + a, c) : b["on" + a] = c
- })
- }
- function o() {
- return m("head")[0]
- }
- function n(a, b, d) {
- if (d) a.setAttribute(b, d);
- else return a && a.getAttribute && a.getAttribute(b)
- }
- function H(a, b) {
- for (var d in b)
- if (b.hasOwnProperty(d)) try {
- a.style[d] = b[d] + (0 < "|width|height|top|left|".indexOf(d) && "number" == typeof b[d] ? "px" : "")
- } catch (c) {}
- }
- function l(a) {
- return document.createElement(a)
- }
- function f() {
- return E || q() ? 0 : t()
- }
- function A(a) {
- return G(encodeURIComponent(a).split(""), function(a) {
- return 0 > "-_.!~*'()".indexOf(a) ? a : "%" + a.charCodeAt(0).toString(16).toUpperCase()
- }).join("")
- }
- function u(a) {
- function b(a, b) {
- f || (f = 1, a || i(b), d.onerror = null, clearTimeout(g), setTimeout(function() {
- a && h();
- var b = p(e),
- d = b && b.parentNode;
- d && d.removeChild(b)
- }, x))
- }
- if (E || q()) return P(a);
- var d = l("script"),
- c = a.c,
- e = t(),
- f = 0,
- g = setTimeout(function() {
- b(1)
- }, F),
- h = a.a || r(),
- i = a.b || r();
- window[c] = function(a) {
- b(0, a)
- };
- d[J] = J;
- d.onerror = function() {
- b(1)
- };
- d.src = a.url.join(K);
- n(d, "id", e);
- o().appendChild(d);
- return b
- }
- function P(a) {
- function b(a) {
- e || (e = 1, clearTimeout(g), c && (c.onerror = c.onload = null, c.abort && c.abort(), c = null), a && h())
- }
- function d() {
- if (!f) {
- f = 1;
- clearTimeout(g);
- try {
- response = JSON.parse(c.responseText)
- } catch (a) {
- return b(1)
- }
- i(response)
- }
- }
- var c, e = 0,
- f = 0,
- g = setTimeout(function() {
- b(1)
- }, F),
- h = a.a || r(),
- i = a.b || r();
- try {
- c = q() || window.XDomainRequest && new XDomainRequest || new XMLHttpRequest, c.onerror = c.onabort = function() {
- b(1)
- }, c.onload = c.onloadend = d, c.timeout = F, c.open("GET", a.url.join(K), !0), c.send()
- } catch (k) {
- return b(0), E = 0, u(a)
- }
- return b
- }
- function D() {
- PUBNUB.time(k);
- PUBNUB.time(function() {
- setTimeout(function() {
- C || (C = 1, c(I, function(a) {
- a[2].subscribe(a[0], a[1])
- }))
- }, x)
- })
- }
- function q() {
- if (!L.get) return 0;
- var a = {
- id: q.id++,
- send: r(),
- abort: function() {
- a.id = {}
- },
- open: function(b, c) {
- q[a.id] = a;
- L.get(a.id, c)
- }
- };
- return a
- }
- window.console || (window.console = window.console || {});
- console.log || (console.log = (window.opera || {}).postError || r());
- var B = function() {
- var a = window.localStorage;
- return {
- get: function(b) {
- try {
- return a ? a.getItem(b) : -1 == document.cookie.indexOf(b) ? null : ((document.cookie || "").match(RegExp(b + "=([^;]+)")) || [])[1] || null
- } catch (c) {}
- },
- set: function(b, c) {
- try {
- if (a) return a.setItem(b, c) && 0;
- document.cookie = b + "=" + c + "; expires=Thu, 1 Aug 2030 20:00:00 UTC; path=/"
- } catch (e) {}
- }
- }
- }(),
- N = 1,
- O = /{([\w\-]+)}/g,
- J = "async",
- K = "/",
- F = 14E4,
- x = 1E3,
- E = -1 == navigator.userAgent.indexOf("MSIE 6"),
- M = function() {
- var a = Math.floor(9 * Math.random()) + 1;
- return function(b) {
- return 0 < b.indexOf("pubsub") && b.replace("pubsub", "ps" + (10 > ++a ? a : a = 1)) || b
- }
- }(),
- y = {
- list: {},
- unbind: function(a) {
- y.list[a] = []
- },
- bind: function(a, b) {
- (y.list[a] = y.list[a] || []).push(b)
- },
- fire: function(a, b) {
- c(y.list[a] || [], function(a) {
- a(b)
- })
- }
- },
- v = p("pubnub") || {},
- C = 0,
- I = [];
- PUBNUB = w({
- publish_key: n(v, "pub-key"),
- subscribe_key: n(v, "sub-key"),
- ssl: "on" == n(v, "ssl"),
- origin: n(v, "origin")
- });
- H(v, {
- position: "absolute",
- top: -x
- });
- if ("opera" in window || n(v, "flash")) v.innerHTML = "<object id=pubnubs data=https://dh15atwfs066y.cloudfront.net/pubnub.swf><param name=movie value=https://dh15atwfs066y.cloudfront.net/pubnub.swf><param name=allowscriptaccess value=always></object>";
- var L = p("pubnubs") || {};
- h("load", window, function() {
- setTimeout(D, 0)
- });
- PUBNUB.rdx = function(a, b) {
- if (!b) return q[a].onerror();
- q[a].responseText = unescape(b);
- q[a].onload()
- };
- q.id = x;
- window.jqac && (window.jqac.PUBNUB = PUBNUB);
- "undefined" !== typeof module && (module.f = PUBNUB) && D()
- }();
- })();
- }
- var ArrowChat = {};
- ArrowChat.Templates = {
- bar_hide_tab: function() {
- return '<div id="arrowchat_hide_bar_button" class="arrowchat_bar_right arrowchat_bar_button"><div class="arrowchat_inner_button"> <i class="arrowchat_icons arrowchat_hide_icon" /> </div></div>';
- },
- bar_show_tab: function() {
- return '<div id="arrowchat_show_bar_button" class="arrowchat_bar_right arrowchat_bar_button"><div class="arrowchat_inner_button"> <i class="arrowchat_icons arrowchat_show_icon" /> </div></div>';
- },
- applications_bookmarks_tab: function(c_ac_path, apps, b) {
- return '<div class="arrowchat_inner_button"> <img class="arrowchat_tray_icon" src="' + c_ac_path + "applications/" + apps[b][2] + "/images/" + apps[b][3] + '" /><div class="arrowchat_app_button_name">' + apps[b][11] + '</div> </div>';
- },
- applications_bookmarks_window: function(c_ac_path, apps, b) {
- return '<div class="arrowchat_traytitle"> <div class="arrowchat_tab_name">' + apps[b][1] + '</div> <div class="arrowchat_more_button"> <a href="javascript:void(0)" class="arrowchat_more_anchor" id="arrowchat_apps_more_' + apps[b][0] + '"></a> <div id="arrowchat_apps_more_popout_' + apps[b][0] + '" class="arrowchat_more_popout"> <ul class="arrowchat_inner_menu"> <li class="arrowchat_menu_item"> <a id="arrowchat_app_keep_open_' + apps[b][0] + '" class="arrowchat_menu_anchor arrowchat_app_keep_open"> <input type="checkbox" checked="" /> <span>' + lang[104] + '</span> </a> </li> <!--<li class="arrowchat_menu_item"> <a id="arrowchat_app_load_' + apps[b][0] + '" class="arrowchat_menu_anchor arrowchat_app_load"> <input type="checkbox" checked="" /> <span>' + lang[105] + '</span> </a> </li>--> </ul> </div> </div> </div> <div class="arrowchat_traycontent"> <div class="arrowchat_traycontenttext"> <div id="arrowchat_applications_button_' + apps[b][0] + '_content" style="width: ' + apps[b][4] + 'px;"> <div class="arrowchat_loader"></div> </div> </div> </div>';
- },
- applications_bookmarks_list: function(c_ac_path, apps, b) {
- return '<li id="arrowchatapplist_' + apps[b][0] + '" style="line-height: 16px; overflow: hidden hidden; padding: 1px 0px; zoom: 1;"> <div> <a id="arrowchat_app_link_' + apps[b][0] + '" class="arrowchat_app_link" href="javascript:void(0);"> <div style="float: left; height: 16px; overflow: hidden hidden; padding: 2px 5px; width: 16px;"> <img style="height: 16px; width: 16px; border: 0px;" src="' + c_ac_path + "applications/" + apps[b][2] + "/images/" + apps[b][3] + '" /> </div> <div style="padding-top: 2px;">' + apps[b][1] + '</div> </a> </div> </li>';
- },
- applications_tab: function() {
- return '<div class="arrowchat_inner_button"> <img class="arrowchat_tray_icon" src="' + c_ac_path + 'themes/' + u_theme + '/images/icons/tray_arrowchat.png" /> <div class="arrowchat_tray_name">' + lang[16] + '</div> </div>';
- },
- applications_window: function() {
- return '<div class="arrowchat_traytitle"> <div class="arrowchat_tab_name">' + lang[16] + '</div> </div> <div class="arrowchat_apps_subtitle">' + lang[65] + '</div> <div class="arrowchat_traycontent"> <div style="height: auto; overflow: hidden hidden; position: relative;"> <div style="padding: 5px;"> <div id="arrowchat_bookmarks"></div> </div> </div> </div>';
- },
- notifications_tab: function() {
- return '<div class="arrowchat_inner_button"> <i class="arrowchat_icons arrowchat_notifications_icon" /> </div>';
- },
- notifications_window: function() {
- return '<div class="arrowchat_userstabtitle"> <div class="arrowchat_tab_name">' + lang[0] + '</div> <div class="arrowchat_see_all_button"> <a href="javascript:void(0);" class="arrowchat_see_all_link arrowchat_more_anchor"></a> </div> </div> <div class="arrowchat_tabcontent arrowchat_optionstyle"> <div id="arrowchat_notifications_content"> <div id="arrowchat_no_new_notifications">' + lang[9] + '</div> </div> </div>';
- },
- chat_tab: function(shortname) {
- return '<div class="arrowchat_bar_right arrowchat_bar_button arrowchat_user_tab"><div class="arrowchat_inner_button"> <div style="float:left" class="arrowchat_username_message">' + shortname + '</div> </div></div>';
- },
- chat_window: function(c, longname, i, l, b) {
- return '<div class="arrowchat_tabpopup"><div class="arrowchat_tabtitle"> <div class="arrowchat_tab_name">' + c + longname + i + '</div> <div class="arrowchat_closebox"></div> <div class="arrowchat_more_button"> <a href="javascript:void(0)" class="arrowchat_more_anchor" id="arrowchat_more_' + b + '"></a> <div id="arrowchat_more_popout_' + b + '" class="arrowchat_more_popout"> <div id="arrowchat_video_chat_' + b + '" class="arrowchat_video_chat"> ' + lang[60] + ' </div> <div id="arrowchat_file_transfer_' + b + '" class="arrowchat_video_chat"> ' + lang[66] + ' </div> <div id="arrowchat_clear_' + b + '" class="arrowchat_video_chat"> ' + lang[24] + ' </div> <hr class="arrowchat_options_divider" style="margin-top:5px" /> <div id="arrowchat_block_' + b + '" class="arrowchat_video_chat"> ' + lang[84] + ' </div> </div> </div> <div class="arrowchat_chat_popout"></div> </div> <div class="arrowchat_tabcontent"> <div id="arrowchat_file_upload_div_' + b + '" class="arrowchat_file_upload" style="display: none;"> <div class="arrowchat_file_upload_wrapper"> <div style="float: right;"> <div class="arrowchat_ui_button"> <input id="arrowchat_file_upload_' + b + '" name="file_upload" type="file" /> <div class="arrowchat_upload_text">' + lang[86] + '</div> </div> </div> <div class="arrowchat_upload_info_text" style="text-align: left; float: left; position: relative; width:150px"> ' + lang[87] + '<a href="javascript:void(0);" id="arrowchat_file_cancel_' + b + '">' + lang[67] + '</a> </div> <div style="clear: both;"></div> </div> </div> <div class="arrowchat_smiley_box"></div> <div id="arrowchat_chatbox_message_flyout_' + b + '" class="arrowchat_message_box"> <div class="arrowchat_message_box_wrapper"> <div> <span class="arrowchat_message_text">' + lang[68] + '</span> </div> </div> </div> <div class="arrowchat_tabcontenttext" id="arrowchat_tabcontenttext_' + b + '"></div> <div class="arrowchat_tabcontentinput"><textarea class="arrowchat_textarea"></textarea><div class="arrowchat_smiley_button"></div></div> </div></div>';
- },
- buddylist_tab: function() {
- return '<div class="arrowchat_inner_button"> <div id="arrowchat_userstab_icon"></div> <div id="arrowchat_userstab_text" style="float:left"><b>' + lang[4] + '</b> (<b>0</b>)</div> </div>';
- },
- buddylist_window: function(d, _ts, acp) {
- return '<div class="arrowchat_userstabtitle"> <div class="arrowchat_tab_name">' + lang[4] + '</div> <div class="arrowchat_more_button"> <a href="javascript:void(0);" class="arrowchat_panel_item arrowchat_more_anchor"></a> <div id="arrowchat_options_flyout" class=""> <ul class="arrowchat_inner_menu"> <li class="arrowchat_menu_item"> <a id="arrowchat_setting_sound" class="arrowchat_menu_anchor"> <span>' + lang[6] + '</span> <input type="checkbox" checked="" /> </a> </li> <li class="arrowchat_menu_item"> <a id="arrowchat_setting_window_open" class="arrowchat_menu_anchor"> <span>' + lang[17] + '</span> <input type="checkbox" checked="" /> </a> </li> <li class="arrowchat_menu_item"> <a id="arrowchat_setting_names_only" class="arrowchat_menu_anchor"> <span>' + lang[18] + '</span> <input type="checkbox" checked="" /> </a> </li> <li class="arrowchat_menu_item"> <a id="arrowchat_setting_block_list" class="arrowchat_menu_anchor" style="background:none"> <span>' + lang[95] + '</span> <input type="checkbox" checked="" /> </a> </li> <li class="arrowchat_menu_separator"></li> <li class="arrowchat_menu_item"> <a id="arrowchat_gooffline" class="arrowchat_menu_anchor"> <span>' + lang[5] + '</span> </a> </li> </ul> <div class="arrowchat_block_menu"> <div class="arrowchat_block_menu_text">' + lang[96] + '</div> <div style="float:left"> <select></select> </div> <div class="arrowchat_ui_button" id="arrowchat_unblock_button" style="float:right"> <div style="width:45px;height:18px;position:relative;top:2px;left:-1px;">' + lang[97] + '</div> </div> </div> </div> </div> <div class="arrowchat_theme_button"> <a href="javascript:void(0);" class="arrowchat_theme_link arrowchat_more_anchor"></a> <div id="arrowchat_theme_flyout" class=""> <div class="arrowchat_theme_menu"> <div class="arrowchat_theme_menu_text">' + lang[108] + '</div> <div style="float:left"> <select class="arrowchat_themeswitcher">' + _ts + '</select> </div> <div class="arrowchat_ui_button" id="arrowchat_theme_button" style="float:right"> <div style="width:45px;height:18px;position:relative;top:2px;left:-1px;">' + lang[109] + '</div> </div> </div> </div> </div> </div> <div class="arrowchat_powered_by">' + acp + '</div> <div class="arrowchat_facebook_connect"></div> <div class="arrowchat_tabcontent arrowchat_tabstyle"> <div id="arrowchat_buddylist_message_flyout" class="arrowchat_message_box"> <div class="arrowchat_message_box_wrapper"> <div> <span class="arrowchat_message_text"></span> </div> </div> </div> <div class="arrowchat_enter_name_wrapper"> <input placeholder="' + lang[119] + '" type="text" id="arrowchat_guest_name_input" maxlength="25" /> </div> <div id="arrowchat_userscontent"> <div id="arrowchat_userslist_available"></div> <div id="arrowchat_userslist_busy"></div> <div id="arrowchat_userslist_away"></div> <div id="arrowchat_userslist_invisible"></div> <div id="arrowchat_userslist_offline"></div> </div> <div id="arrowchat_search_friends"> <input type="text" class="arrowchat_search_friends_text" placeholder="' + lang[12] + '" /> </div> </div>';
- },
- maintenance_tab: function(c_login_url) {
- if (c_login_url == "") c_login_url = "#";
- return '<div id="arrowchat_maintenance" class="arrowchat_bar_right arrowchat_bar_button"><a href="' + c_login_url + '"><div class="arrowchat_inner_button"> <i class="arrowchat_icons arrowchat_maintenance_icon" /> </div></a></div>';
- },
- announcements_display: function(h) {
- return '<div id="arrowchat_announcement"> <div class="arrowchat_announcement_content"> ' + h.data + ' <div class="arrowchat_announce_close_div"> <span class="arrowchat_announce_close"><a href="javascript:void(0);">' + lang[28] + '</a></span> </div> </div> <div class="arrowchat_announcement_tip_pos"></div> </div>';
- },
- chatrooms_tab: function() {
- return '<div id="arrowchat_chatrooms_button" class="arrowchat_bar_right arrowchat_bar_button"><div class="arrowchat_inner_button"> <div id="arrowchat_chatrooms_icon"></div> <div id="arrowchat_chatrooms_text" style="float:left">' + lang[19] + '</div> </div></div>';
- },
- chatrooms_window: function() {
- return '<div id="arrowchat_chatrooms_popup" class="arrowchat_tabpopup"><div class="arrowchat_chatrooms_title"> <div class="arrowchat_tab_name">' + lang[19] + '</div> <div class="arrowchat_more_button" id="arrowchat_chatroom_options"> <a href="javascript:void(0);" class="arrowchat_more_anchor arrowchat_chatroom_item2"></a> <div id="arrowchat_chatroom_options_flyout"> <ul class="arrowchat_inner_menu"> <li class="arrowchat_menu_item"> <a id="arrowchat_chatroom_window" class="arrowchat_menu_anchor"> <span>' + lang[36] + '</span> <input type="checkbox" checked="" /> </a> </li> <li class="arrowchat_menu_item"> <a id="arrowchat_chatroom_stay" class="arrowchat_menu_anchor"> <span>' + lang[47] + '</span> <input type="checkbox" checked="" /> </a> </li> <li class="arrowchat_menu_item"> <a id="arrowchat_chatroom_sound" class="arrowchat_menu_anchor"> <span>' + lang[101] + '</span> <input type="checkbox" checked="" /> </a> </li> <li class="arrowchat_menu_separator"></li> <li class="arrowchat_menu_item"> <a id="arrowchat_chatroom_block" class="arrowchat_menu_anchor"> <span>' + lang[38] + '</span> <input type="checkbox" checked="" /> </a> </li> </div> </div> <div class="arrowchat_chatroom_create" id="arrowchat_chatroom_create"> <a href="javascript:void(0);" class="arrowchat_more_anchor arrowchat_chatroom_item"></a> </div> <div class="arrowchat_chatroom_leave" id="arrowchat_chatroom_leave"> <a href="javascript:void(0);" class="arrowchat_more_anchor arrowchat_chatroom_item3"></a> </div> <div class="arrowchat_chatroom_popout"></div> </div> <div class="arrowchat_clearfix"></div> <div class="arrowchat_chatroom_content"> <div id="arrowchat_chatroom_create_flyout" class="arrowchat_create_box"> <div class="arrowchat_create_box_wrapper"> <div style="float: right; position:relative; top:3px"> <div class="arrowchat_ui_button" id="arrowchat_create_button"> <div style="width:42px;height:18px;position:relative;top:2px;left:-1px;">' + lang[31] + '</div> </div> </div> <div style="text-align: left; float: left; position: relative; width:170px"> <span>' + lang[91] + '</span> </div> <div style="float:left;position:relative;width:125px;"> <input placeholder="' + lang[98] + '" type="text" id="arrowchat_chatroom_create_input" maxlength="50" /> </div> <div style="float:left;position:relative;width:110px;"> <input placeholder="' + lang[99] + '" type="text" id="arrowchat_chatroom_create_password_input" maxlength="50" /> </div> <div style="clear: both;"></div> </div> </div> <div id="arrowchat_chatroom_password_flyout" class="arrowchat_password_box"> <div class="arrowchat_password_box_wrapper"> <div style="float: right;position:relative; top:3px"> <div class="arrowchat_ui_button" id="arrowchat_password_button"> <div style="width:42px;height:18px;position:relative;top:2px;left:-1px;">' + lang[100] + '</div> </div> </div> <div style="text-align: left; float: left; position: relative; width:170px"> <span>' + lang[50] + '</span> </div> <div style="float:left;position:relative;width:125px;"> <input type="text" id="arrowchat_chatroom_password_input" maxlength="50" /> <input type="hidden" id="arrowchat_chatroom_password_id" value="" /> </div> <div style="clear: both;"></div> </div> </div> <div id="arrowchat_chatroom_message_flyout" class="arrowchat_message_box"> <div class="arrowchat_message_box_wrapper"> <div> <span class="arrowchat_message_text">' + lang[49] + '</span> </div> </div> </div> <div class="arrowchat_smiley_box"></div> <div class="arrowchat_chatroom_full_content"> </div> </div></div>';
- },
- chatrooms_room: function() {
- return '<div id="arrowchat_chatroom_chat"> </div> <div id="arrowchat_chatroom_room_list"> </div> <div class="arrowchat_clearfix"></div> <div id="arrowchat_chatroom_message"> <div class="arrowchat_chatroom_message_area"> <textarea class="arrowchat_chatroom_message_input"></textarea> <div class="arrowchat_smiley_button"></div> </div> </div>';
- }
- };
- ArrowChat.IdleTime = 3;
- (function(a) {
- a.arrowchat = function() {
- var $body = a("body");
- var $base;
- var $maintenance;
- var $show_bar_button;
- var $popout_chat_button;
- var $optionsbutton;
- var $optionsbutton_popup;
- var $chatrooms_button;
- var $buddy_list_tab;
- var $userstab_popup;
- var $tooltip = null;
- var $tooltip_content;
- var $chatroom_chat;
- var $chatroom_room_list;
- var $chatrooms_popup;
- var $chatroom_create;
- var $chatroom_create_flyout;
- var $application_buttons = {};
- var $application_button_popups = {};
- var $applications_button;
- var $applications_button_popup;
- var $applications_button_popups;
- var $users = [];
- var $user_popups = [];
- var $chatbox_right;
- var $chatboxes;
- var $chatboxes_wide;
- var $chatbox_left;
- function addHover($elements, classes) {
- $elements.each(function(i, element) {
- a(element).hover(function() {
- a(this).addClass(classes);
- }, function() {
- a(this).removeClass(classes);
- });
- });
- }
- function showLoading($element) {
- a(".arrowchat_hide_loading", $element).hide();
- a(".arrowchat_show_loading", $element).show();
- }
- function hideLoading($element) {
- a(".arrowchat_hide_loading", $element).show();
- a(".arrowchat_show_loading", $element).hide();
- }
- function closePopup($popup, $button, hidden) {
- if ($popup !== undefined) {
- if (hidden == 1) {
- $popup.addClass("arrowchat_tabopen_hidden");
- } else {
- $popup.removeClass("arrowchat_tabopen");
- }
- }
- if ($button !== undefined) {
- $button.removeClass("arrowchat_tabclick arrowchat_userstabclick arrowchat_trayclick arrowchat_usertabclick");
- }
- }
- function hideTooltip() {
- if ($tooltip) {
- $tooltip.hide();
- }
- }
- function showTooltip($target, text, is_left, custom_left, custom_top, is_sideways) {
- if ($tooltip === null) {
- $tooltip = a("<div id=\"arrowchat_tooltip\"><div class=\"arrowchat_tooltip_content\"></div></div>").appendTo($body);
- $tooltip_content = a(".arrowchat_tooltip_content", $tooltip);
- }
- $tooltip_content.html(text);
- var target_offset = $target.offset();
- var target_width = $target.width();
- var target_height = $target.height();
- var tooltip_width = $tooltip.width();
- if (!custom_left) {
- custom_left = 0;
- }
- if (!custom_top) {
- custom_top = 0;
- }
- if (is_left) {
- $tooltip.css({
- top: target_offset.top - a(window).scrollTop() - target_height - 1 - custom_top,
- left: target_offset.left + target_width - 16 - custom_left,
- display: "block"
- }).addClass("arrowchat_tooltip_left");
- } else if (is_sideways) {
- $tooltip.css({
- top: target_offset.top - a(window).scrollTop() - target_height - 1 - custom_top,
- left: target_offset.left + target_width - tooltip_width + 18 - custom_left,
- display: "block",
- 'background-position': tooltip_width - 128 + "px -60px"
- }).removeClass("arrowchat_tooltip_left");
- } else {
- $tooltip.css({
- top: target_offset.top - a(window).scrollTop() - target_height - 1 - custom_top,
- left: target_offset.left + target_width - tooltip_width + 18 - custom_left,
- display: "block",
- 'background-position': tooltip_width - 23 + "px -118px"
- }).removeClass("arrowchat_tooltip_left");
- }
- if (W) {
- $tooltip.css("position", "absolute");
- $tooltip.css("top", parseInt(a(window).height()) - parseInt($tooltip.css("bottom")) - parseInt($tooltip.height()) + a(window).scrollTop() + "px");
- }
- }
- var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gi;
- function replaceURLWithHTMLLinks(text) {
- return text.replace(exp, "<a href='$1' target='_blank'>$1</a>");
- }
- RegExp.escape = function(text) {
- return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
- };
- function smileyreplace(mess) {
- if (c_disable_smilies != 1) {
- for (i = 0; i < Smiley.length; i++) {
- var smiley_test = Smiley[i][1].replace(/</g, "<").replace(/>/g, ">");
- var check_emoticon = mess.lastIndexOf(smiley_test);
- if (check_emoticon != -1) {
- mess = mess.replace(new RegExp(RegExp.escape(smiley_test), "g"), "<img class=\"arrowchat_smiley\" src=\"" + c_ac_path + "themes/" + u_theme + "/images/smilies/" + Smiley[i][0] + ".gif\" alt=\"\" />");
- }
- }
- }
- return mess;
- }
- function chatroomKeydown(key, $element) {
- if (key.keyCode == 13 && key.shiftKey == 0) {
- if (msgcount == 0) {
- setTimeout(function() {
- msgcount = 0;
- }, 15000);
- }
- msgcount++;
- if (msgcount > 4 && chatroom_admin != 1 && chatroom_mod != 1) {
- displayMessage("arrowchat_chatroom_message_flyout", lang[51], "error");
- } else {
- var i = $element.val();
- i = i.replace(/^\s+|\s+$/g, "");
- $element.val("");
- $element.css("height", "18px");
- $element.css("overflow-y", "hidden");
- $element.focus();
- i != "" && a.ajax({
- url: c_ac_path + "includes/json/send/send_message_chatroom.php",
- type: "post",
- cache: false,
- dataType: "json",
- data: {
- userid: u_id,
- username: u_name,
- chatroomid: Ccr,
- message: i
- },
- beforeSend: function() {
- a(".arrowchat_chatroom_message_input").addClass("arrowchat_message_sending");
- },
- error: function() {
- a(".arrowchat_chatroom_message_input").removeClass("arrowchat_message_sending");
- displayMessage("arrowchat_chatroom_message_flyout", lang[135], "error");
- },
- success: function(e) {
- a(".arrowchat_chatroom_message_input").removeClass("arrowchat_message_sending");
- if (e) {
- addMessageToChatroom(e, u_name, i);
- $chatroom_chat.scrollTop($chatroom_chat[0].scrollHeight);
- }
- }
- });
- return false;
- }
- }
- }
- function userchatKeydown(key, $element, typing, jabber) {
- if (jabber != 1) {
- clearTimeout(pa);
- pa = setTimeout(function() {
- a.post(c_ac_path + "includes/json/send/send_typing.php", {
- userid: u_id,
- typing: typing,
- untype: 1
- }, function() {});
- fa = -1;
- }, 5000);
- if (fa != typing) {
- a.post(c_ac_path + "includes/json/send/send_typing.php", {
- userid: u_id,
- typing: typing
- }, function() {});
- fa = typing;
- }
- }
- if (key.keyCode == 13 && key.shiftKey == 0) {
- var i = $element.val();
- i = i.replace(/^\s+|\s+$/g, "");
- $element.val("").css({
- height: "18px",
- 'overflow-y': "hidden"
- }).focus();
- if (jabber == 1 && i != "") {
- sendJabberMessage(typing, i);
- } else {
- i != "" && a.ajax({
- url: c_ac_path + "includes/json/send/send_message.php",
- type: "post",
- cache: false,
- dataType: "json",
- data: {
- userid: u_id,
- to: typing,
- message: i
- },
- beforeSend: function() {
- a(".arrowchat_textarea").addClass("arrowchat_message_sending");
- },
- error: function() {
- a(".arrowchat_textarea").removeClass("arrowchat_message_sending");
- displayMessage("arrowchat_chatbox_message_flyout_" + typing, lang[135], "error");
- },
- success: function(e) {
- a(".arrowchat_textarea").removeClass("arrowchat_message_sending");
- if (e) {
- if (e == "-1") {
- displayMessage("arrowchat_chatbox_message_flyout_" + typing, lang[102], "error");
- } else {
- addMessageToChatbox(typing, i, "1", "1", e, 1, Math.floor((new Date).getTime() / 1000));
- }
- }
- K = 1;
- }
- });
- }
- return false;
- }
- }
- function resizeChatfield($element) {
- var height = $element[0].clientHeight;
- if (height < 94) {
- height = Math.max($element[0].scrollHeight, height);
- height = Math.min(94, height);
- if (height > $element[0].clientHeight) {
- $element.css("height", height + 4 + "px");
- }
- } else {
- $element.css("overflow-y", "auto");
- }
- }
- function chatroomKeyup(b, $element) {
- resizeChatfield($element);
- $chatroom_chat.scrollTop($chatroom_chat[0].scrollHeight);
- }
- function userchatKeyup(key, $element, d) {
- resizeChatfield($element);
- a(".arrowchat_tabcontenttext", $user_popups[d]).scrollTop(a(".arrowchat_tabcontenttext", $user_popups[d])[0].scrollHeight);
- }
- function clearUserStatus() {
- a("#arrowchat_userstab_icon").removeClass("arrowchat_user_available2 arrowchat_user_busy2 arrowchat_user_invisible2 arrowchat_user_away2");
- }
- function setUserStatus(status) {
- a("#arrowchat_userstab_icon").removeClass("arrowchat_user_available2 arrowchat_user_busy2 arrowchat_user_invisible2");
- a.post(c_ac_path + "includes/json/send/send_status.php", {
- userid: u_id,
- status: status
- }, function() {});
- }
- function showUserOffline() {
- w = 1;
- clearUserStatus();
- a("#arrowchat_userstab_icon").addClass("arrowchat_user_invisible2");
- setUserStatus("offline");
- closePopup($userstab_popup, $buddy_list_tab);
- closePopup($optionsbutton_popup, $optionsbutton);
- a("#arrowchat_userstab_text").html(lang[7]);
- }
- function buildMaintenance() {
- $maintenance = a(ArrowChat.Templates.maintenance_tab(c_login_url)).appendTo($base);
- $maintenance.mouseover(function() {
- if (c_guests_login_msg == "1" && u_id == "") {
- showTooltip($maintenance, lang[58]);
- } else {
- showTooltip($maintenance, lang[27]);
- }
- a(this).addClass("arrowchat_tabmouseover");
- });
- $maintenance.mouseout(function() {
- a(this).removeClass("arrowchat_tabmouseover");
- hideTooltip();
- });
- }
- function buildHideBarButton() {
- $hide_bar_button = a(ArrowChat.Templates.bar_hide_tab()).appendTo($base);
- $hide_bar_button.mouseover(function() {
- showTooltip($hide_bar_button, lang[14]);
- a(this).addClass("arrowchat_tabmouseover");
- });
- $hide_bar_button.mouseout(function() {
- a(this).removeClass("arrowchat_tabmouseover");
- hideTooltip();
- });
- $hide_bar_button.click(function() {
- a.post(c_ac_path + "includes/json/send/send_settings.php", {
- hide: "1"
- });
- showUserOffline();
- closePopup($chatrooms_popup, $chatrooms_button);
- closePopup($applications_button_popup, $applications_button);
- if (m != "") {
- closePopup($application_button_popups[m], $application_buttons[m]);
- m = "";
- }
- if (j != "") {
- closePopup($user_popups[j], $users[j]);
- a(".arrowchat_closebox_bottom", $users[j]).removeClass("arrowchat_closebox_bottom_click");
- j = "";
- }
- clearTimeout(Z);
- a.idleTimer("destroy");
- pushCancelAll();
- cancelJSONP();
- $base.hide();
- $show_bar_button.show();
- });
- }
- function buildShowBarButton() {
- $show_bar_button = a(ArrowChat.Templates.bar_show_tab()).appendTo($body);
- $show_bar_button.mouseover(function() {
- showTooltip($show_bar_button, lang[15]);
- a(this).addClass("arrowchat_tabmouseover");
- });
- $show_bar_button.mouseout(function() {
- a(this).removeClass("arrowchat_tabmouseover");
- hideTooltip();
- });
- $show_bar_button.click(function() {
- showBar();
- });
- }
- function showBar() {
- a.post(c_ac_path + "includes/json/send/send_settings.php", {
- hide: "-1"
- });
- setUserStatus("available");
- a("#arrowchat_userstab_icon").addClass("arrowchat_user_available2");
- w = 0;
- loadBuddyList();
- pushSubscribe();
- receiveCore();
- a.idleTimer(60000 * ArrowChat.IdleTime);
- $show_bar_button.hide();
- $base.show();
- }
- function startCreateChatRoom() {
- var i = a("#arrowchat_chatroom_create_input").val();
- var passinput = a("#arrowchat_chatroom_create_password_input").val();
- a("#arrowchat_chatroom_create_input").val("");
- a("#arrowchat_chatroom_create_password_input").val("");
- i = i.replace(/^\s+|\s+$/g, "");
- i != "" && a.post(c_ac_path + "includes/json/send/send_chatroom_create.php", {
- userid: u_id,
- name: i,
- password: passinput
- }, function(e) {
- if (e) {
- $chatroom_create_flyout.hide("slide", {
- direction: "up"
- }, 250);
- a("#arrowchat_chatroom_options_flyout").removeClass("arrowchat_chatroom_options_flyout_display");
- if (e == "-1") {
- displayMessage("arrowchat_chatroom_message_flyout", lang[39], "error");
- } else if (e == "-2") {
- displayMessage("arrowchat_chatroom_message_flyout", lang[40], "error");
- } else {
- chatroomreceived = 0;
- loadChatroomList();
- }
- }
- });
- }
- function buildChatroomsButton() {
- $chatrooms_button = a(ArrowChat.Templates.chatrooms_tab()).appendTo($base);
- $chatrooms_popup = a(ArrowChat.Templates.chatrooms_window()).css("display", "none").appendTo($body);
- $chatroom_create = a("#arrowchat_chatroom_create");
- $chatroom_create_flyout = a("#arrowchat_chatroom_create_flyout");
- $chatrooms_button.css("width", c_width_chatroom + "px");
- a("#arrowchat_chatroom_create_input").placeholder();
- a("#arrowchat_chatroom_create_password_input").placeholder();
- if (c_width_chatroom <= 25) {
- a("#arrowchat_chatrooms_text", $chatrooms_button).hide();
- }
- if (u_chatroom_block_chats == 1) {
- a("#arrowchat_chatroom_block :input").attr("checked", true);
- } else {
- a("#arrowchat_chatroom_block").addClass("arrowchat_menu_unchecked");
- a("#arrowchat_chatroom_block :input").attr("checked", false);
- }
- if (u_chatroom_sound == 1) {
- a("#arrowchat_chatroom_sound :input").attr("checked", true);
- } else {
- a("#arrowchat_chatroom_sound").addClass("arrowchat_menu_unchecked");
- a("#arrowchat_chatroom_sound :input").attr("checked", false);
- }
- if (u_chatroom_stay != "-1") {
- a("#arrowchat_chatroom_stay :input").attr("checked", true);
- } else {
- a("#arrowchat_chatroom_stay").addClass("arrowchat_menu_unchecked");
- a("#arrowchat_chatroom_stay :input").attr("checked", false);
- }
- if (u_chatroom_open != "-1") {
- a("#arrowchat_chatroom_window :input").attr("checked", true);
- } else {
- a("#arrowchat_chatroom_window").addClass("arrowchat_menu_unchecked");
- a("#arrowchat_chatroom_window :input").attr("checked", false);
- }
- if (c_user_chatrooms == "0") {
- $chatroom_create.hide();
- }
- $chatrooms_button.click(function() {
- count = 0;
- if (c_width_chatroom <= 25) {
- hideTooltip();
- }
- if (a(".arrowchat_tabalert", $chatrooms_button).length > 0) {
- a(".arrowchat_tabalert", $chatrooms_button).remove();
- $chatrooms_button.removeClass("arrowchat_tab_new_message");
- }
- loadChatroomList();
- closePopup($userstab_popup, $buddy_list_tab);
- closePopup($optionsbutton_popup, $optionsbutton);
- $chatrooms_popup.css("left", $chatrooms_button.offset().left - $chatrooms_popup.outerWidth() + $chatrooms_button.outerWidth()).css("bottom", "25px");
- a(this).toggleClass("arrowchat_tabclick").toggleClass("arrowchat_userstabclick");
- $chatrooms_popup.toggleClass("arrowchat_tabopen");
- if ($chatroom_chat !== undefined) {
- $chatroom_chat.scrollTop(50000);
- }
- a(".arrowchat_chatroom_message_input").focus();
- });
- $chatrooms_button.mouseover(function() {
- if (c_width_chatroom <= 25) {
- if ($chatrooms_button.hasClass("arrowchat_tabclick")) {} else {
- showTooltip($chatrooms_button, lang[19]);
- }
- }
- a(this).addClass("arrowchat_tabmouseover");
- });
- $chatrooms_button.mouseout(function() {
- a(this).removeClass("arrowchat_tabmouseover");
- hideTooltip();
- });
- a("#arrowchat_chatroom_password_input").keydown(function(h) {
- if (h.keyCode == 13) {
- c = a("#arrowchat_chatroom_password_id").val();
- a("#arrowchat_chatroom_password_flyout").hide();
- input_value = a("#arrowchat_chatroom_password_input").val();
- a("#arrowchat_chatroom_password_input").val("");
- input_value = input_value.replace(/^\s+|\s+$/g, "");
- a(".arrowchat_chatroom_full_content").html("<div class=\"arrowchat_nofriends\">" + lang[34] + "</div>");
- $chatroom_create.hide();
- Ccr = c;
- loadChatroom(c, crt[c], input_value);
- }
- });
- a("#arrowchat_password_button").click(function() {
- c = a("#arrowchat_chatroom_password_id").val();
- a("#arrowchat_chatroom_password_flyout").hide();
- input_value = a("#arrowchat_chatroom_password_input").val();
- a("#arrowchat_chatroom_password_input").val("");
- input_value = input_value.replace(/^\s+|\s+$/g, "");
- a(".arrowchat_chatroom_full_content").html("<div class=\"arrowchat_nofriends\">" + lang[34] + "</div>");
- $chatroom_create.hide();
- Ccr = c;
- loadChatroom(c, crt[c], input_value);
- });
- a("#arrowchat_chatroom_stay").click(function() {
- a(this).toggleClass("arrowchat_menu_unchecked");
- if (a("#arrowchat_chatroom_stay :input").is(":checked")) {
- a("#arrowchat_chatroom_stay :input").attr("checked", false);
- _chatroomstay = -1;
- } else {
- a("#arrowchat_chatroom_stay :input").attr("checked", true);
- u_chatroom_stay = Ccr;
- _chatroomstay = Ccr;
- }
- if (a("#arrowchat_chatroom_window :input").is(":checked")) {
- a("#arrowchat_chatroom_window").toggleClass("arrowchat_menu_unchecked");
- a("#arrowchat_chatroom_window :input").attr("checked", false);
- }
- a.post(c_ac_path + "includes/json/send/send_settings.php", {
- chatroom_stay: _chatroomstay
- }, function() {});
- });
- a("#arrowchat_chatroom_window").click(function() {
- a(this).toggleClass("arrowchat_menu_unchecked");
- if (a("#arrowchat_chatroom_window :input").is(":checked")) {
- a("#arrowchat_chatroom_window :input").attr("checked", false);
- _chatroomwindow = -1;
- } else {
- a("#arrowchat_chatroom_window :input").attr("checked", true);
- u_chatroom_open = Ccr;
- _chatroomwindow = Ccr;
- }
- if (a("#arrowchat_chatroom_stay :input").is(":checked")) {
- a("#arrowchat_chatroom_stay").toggleClass("arrowchat_menu_unchecked");
- a("#arrowchat_chatroom_stay :input").attr("checked", false);
- }
- a.post(c_ac_path + "includes/json/send/send_settings.php", {
- chatroom_window: _chatroomwindow
- }, function() {});
- });
- a("#arrowchat_chatroom_block").click(function() {
- a(this).toggleClass("arrowchat_menu_unchecked");
- if (a("#arrowchat_chatroom_block :input").is(":checked")) {
- a("#arrowchat_chatroom_block :input").attr("checked", false);
- _chatroomblock = -1;
- } else {
- a("#arrowchat_chatroom_block :input").attr("checked", true);
- _chatroomblock = 1;
- }
- a.post(c_ac_path + "includes/json/send/send_settings.php", {
- chatroom_block_chats: _chatroomblock
- }, function() {});
- });
- a("#arrowchat_chatroom_sound").click(function() {
- a(this).toggleClass("arrowchat_menu_unchecked");
- if (a("#arrowchat_chatroom_sound :input").is(":checked")) {
- a("#arrowchat_chatroom_sound :input").attr("checked", false);
- _chatroomsound = -1;
- u_chatroom_sound = 0;
- } else {
- a("#arrowchat_chatroom_sound :input").attr("checked", true);
- _chatroomsound = 1;
- u_chatroom_sound = 1;
- }
- a.post(c_ac_path + "includes/json/send/send_settings.php", {
- chatroom_sound: _chatroomsound
- }, function() {});
- });
- a(".arrowchat_chatrooms_title", $chatrooms_popup).click(function() {
- $chatrooms_button.click();
- }).children().not(".arrowchat_tab_name").click(function() {
- return false;
- });
- a(".arrowchat_chatrooms_title", $chatrooms_popup).mouseenter(function() {
- a(this).addClass("arrowchat_chatboxtabtitlemouseover3");
- });
- a(".arrowchat_chatrooms_title", $chatrooms_popup).mouseleave(function() {
- a(this).removeClass("arrowchat_chatboxtabtitlemouseover3");
- });
- a("#arrowchat_chatroom_create_input").keydown(function(h) {
- if (h.keyCode == 13) {
- startCreateChatRoom();
- }
- });
- a("#arrowchat_create_button").click(function() {
- startCreateChatRoom();
- });
- a("#arrowchat_chatroom_leave").click(function() {
- if (a(".arrowchat_smiley_box", $chatrooms_popup).is(":visible")) {
- a(".arrowchat_smiley_box", $chatrooms_popup).hide("slide", {
- direction: "up"
- }, 250, function() {});
- }
- clearTimeout(Crref2);
- a(".arrowchat_chatrooms_title .arrowchat_tab_name").html(lang[19]);
- a(".arrowchat_chatroom_full_content").html("<div class=\"arrowchat_nofriends\">" + lang[34] + "</div>");
- a("#arrowchat_chatroom_leave").hide();
- a(".arrowchat_chatroom_popout").hide();
- if (c_user_chatrooms == "1") {
- $chatroom_create.show();
- }
- chatroomreceived = 0;
- loadChatroomList();
- var retain_ccr = Ccr;
- Ccr = 0;
- if (c_push_engine != 1) {
- cancelJSONP();
- receiveCore();
- } else {
- changePushChannel("chatroom" + retain_ccr, 0);
- }
- });
- a(".arrowchat_chatroom_leave").mouseenter(function() {
- showTooltip(a(this), lang[92], 0, 10, 5);
- a(this).addClass("arrowchat_chatroom_leave_hover");
- a("#arrowchat_chatrooms_popup .arrowchat_chatrooms_title").removeClass("arrowchat_chatboxtabtitlemouseover3");
- });
- a(".arrowchat_chatroom_leave").mouseleave(function() {
- a(this).removeClass("arrowchat_chatroom_leave_hover");
- a("#arrowchat_chatrooms_popup .arrowchat_chatrooms_title").addClass("arrowchat_chatboxtabtitlemouseover3");
- hideTooltip();
- });
- function i() {
- a("#arrowchat_chatroom_options_flyout").removeClass("arrowchat_chatroom_options_flyout_display");
- }
- function kal() {
- if ($chatroom_create_flyout.is(":visible")) {
- $chatroom_create_flyout.hide("slide", {
- direction: "up"
- }, 250);
- }
- }
- a(".arrowchat_chatroom_item").click(function() {
- i();
- if (a(".arrowchat_chatroom_item2").hasClass("arrowchat_more_button_selected")) {
- a(".arrowchat_chatroom_item2").toggleClass("arrowchat_more_button_selected");
- }
- if (!$chatroom_create_flyout.is(":visible")) {
- $chatroom_create_flyout.show("slide", {
- direction: "up"
- }, 250);
- } else {
- $chatroom_create_flyout.hide("slide", {
- direction: "up"
- }, 250);
- }
- if (a("#arrowchat_chatroom_password_flyout").is(":visible")) {
- a(".arrowchat_chatroom_list").removeClass("arrowchat_chatroom_clicked");
- a("#arrowchat_chatroom_password_flyout").hide("slide", {
- direction: "up"
- }, 250);
- }
- });
- a(".arrowchat_chatroom_item").mouseenter(function() {
- showTooltip(a(this), lang[93], 0, 10, 5);
- a(this).parent().addClass("arrowchat_chatroom_create_hover");
- a("#arrowchat_chatrooms_popup .arrowchat_chatrooms_title").removeClass("arrowchat_chatboxtabtitlemouseover3");
- });
- a(".arrowchat_chatroom_item").mouseleave(function() {
- hideTooltip();
- a(this).parent().removeClass("arrowchat_chatroom_create_hover");
- a("#arrowchat_chatrooms_popup .arrowchat_chatrooms_title").addClass("arrowchat_chatboxtabtitlemouseover3");
- });
- a(".arrowchat_chatroom_item2").click(function() {
- hideTooltip();
- kal();
- a("#arrowchat_chatroom_options_flyout").toggleClass("arrowchat_chatroom_options_flyout_display");
- a(this).addClass("arrowchat_more_button_hover");
- a(this).toggleClass("arrowchat_more_button_selected");
- });
- a(".arrowchat_chatroom_item2").mouseenter(function() {
- showTooltip(a(this), lang[23], 0, 10, 5);
- a(this).parent().addClass("arrowchat_more_button_hover");
- a("#arrowchat_chatrooms_popup .arrowchat_chatrooms_title").removeClass("arrowchat_chatboxtabtitlemouseover3");
- });
- a(".arrowchat_chatroom_item2").mouseleave(function() {
- hideTooltip();
- a(this).parent().removeClass("arrowchat_more_button_hover");
- a("#arrowchat_chatrooms_popup .arrowchat_chatrooms_title").addClass("arrowchat_chatboxtabtitlemouseover3");
- });
- }
- function buildPopoutChatButton() {
- $popout_chat_button = a("<div/>").attr("id", "arrowchat_popoutchatbutton").addClass("arrowchat_bar_right").addClass("arrowchat_bar_button").html("<div class=\"arrowchat_inner_button\"><i class=\"arrowchat_icons arrowchat_popin_icon\" /></div>").appendTo($base);
- $popout_chat_button.mouseover(function() {
- showTooltip($popout_chat_button, lang[11]);
- a(this).addClass("arrowchat_tabmouseover");
- });
- $popout_chat_button.mouseout(function() {
- a(this).removeClass("arrowchat_tabmouseover");
- hideTooltip();
- });
- $popout_chat_button.click(function() {
- a(this).hide();
- $buddy_list_tab.show();
- $chatboxes.show();
- $chatbox_right.show();
- $chatbox_left.show();
- if (j != "") {
- $user_popups[j].show();
- }
- a.post(c_ac_path + "includes/json/send/send_settings.php", {
- popoutchat: "99"
- }, function() {});
- loadBuddyList();
- receiveCore();
- pushSubscribe();
- a.idleTimer(60000 * ArrowChat.IdleTime);
- });
- }
- function buildApplicationButtons() {
- var pold = apps.slice();
- function mysortfn(a, b) {
- if (a[13] < b[13]) {
- return -1;
- }
- if (a[13] > b[13]) {
- return 1;
- }
- return 0;
- }
- apps.sort(mysortfn);
- for (b in apps) {
- if (typeof apps[b][0] != "undefined") {
- if (apps[b][10] == "" || apps[b][10] == 0) {
- apps[b][10] = 16;
- }
- $application_buttons[apps[b][0]] = a("<div/>").attr("id", "arrowchat_applications_button_" + apps[b][0]).addClass("arrowchat_appname_" + apps[b][2]).addClass("arrowchat_bar_left").addClass("arrowchat_apps_button").css("width", apps[b][10] + "px").html(ArrowChat.Templates.applications_bookmarks_tab(c_ac_path, apps, b)).appendTo($base);
- if ((apps[b][12] == "1" || apps[b][9] != "1" && u_id == "" || u_id != "" && apps[b][9] != "1" && u_is_guest == "1") && c_no_apps_menu != 1) {
- $application_buttons[apps[b][0]].hide();
- }
- if (apps[b][6] == "") {
- $application_button_popups[apps[b][0]] = a("<div/>").attr("id", "arrowchat_applications_button_" + apps[b][0] + "_popup").addClass("arrowchat_apppopup").css("display", "none").html(ArrowChat.Templates.applications_bookmarks_window(c_ac_path, apps, b)).appendTo($body);
- }
- }
- }
- apps = pold.slice();
- a(".arrowchat_app_keep_open").addClass("arrowchat_menu_unchecked");
- a(".arrowchat_app_keep_open :input").attr("checked", false);
- if (u_apps_open != "" && u_apps_open != "0") {
- a("#arrowchat_app_keep_open_" + u_apps_open + " :input").attr("checked", true);
- a("#arrowchat_app_keep_open_" + u_apps_open).removeClass("arrowchat_menu_unchecked");
- }
- a(".arrowchat_apps_button").mouseover(function() {
- var c = a(this).attr("id").substr(30);
- if ($application_buttons[c].hasClass("arrowchat_trayclick")) {} else {
- if (apps[c][10] <= 16 || apps[c][10] == "") {
- showTooltip($application_buttons[c], apps[c][1], true);
- }
- }
- a(this).addClass("arrowchat_tabmouseover");
- });
- a(".arrowchat_apps_button").mouseout(function() {
- a(this).removeClass("arrowchat_tabmouseover");
- hideTooltip();
- });
- a(".arrowchat_traytitle").click(function() {
- var e = a(this).parent().attr("id");
- e = e.substring(30, e.length - 6);
- if ($application_buttons[e]) {
- $application_buttons[e].click();
- }
- }).children().not(".arrowchat_tab_name").click(function() {
- return false;
- });
- a(".arrowchat_traytitle").each(function(i, element) {
- a(element).mouseenter(function() {
- a(this).addClass("arrowchat_chatboxtabtitlemouseover");
- });
- a(element).mouseleave(function() {
- a(this).removeClass("arrowchat_chatboxtabtitlemouseover");
- });
- });
- a(".arrowchat_traytitle .arrowchat_more_button").each(function(i, element) {
- a(element).mouseenter(function() {
- showTooltip(a(this), lang[23], 0, 10, 5);
- a(this).addClass("arrowchat_more_button_hover");
- a(".arrowchat_traytitle").removeClass("arrowchat_chatboxtabtitlemouseover");
- });
- a(element).mouseleave(function() {
- hideTooltip();
- a(this).removeClass("arrowchat_more_button_hover");
- a(".arrowchat_traytitle").addClass("arrowchat_chatboxtabtitlemouseover");
- });
- });
- a(".arrowchat_traytitle .arrowchat_more_anchor").click(function() {
- hideTooltip();
- var c = a(this).attr("id").substr(20);
- a("#arrowchat_apps_more_popout_" + c).toggle();
- a(this).addClass("arrowchat_more_button_hover");
- a(this).toggleClass("arrowchat_more_button_selected");
- });
- addHover(a(".arrowchat_menu_item"), "arrowchat_more_hover");
- a(".arrowchat_app_keep_open").click(function() {
- var c = a(this).attr("id").substr(24);
- a(".arrowchat_app_keep_open").addClass("arrowchat_menu_unchecked");
- if (a("#arrowchat_app_keep_open_" + c + " :input").is(":checked")) {
- a("#arrowchat_app_keep_open_" + c + " :input").attr("checked", false);
- var keep_open_id = -1;
- u_apps_open = "";
- } else {
- a(".arrowchat_app_keep_open :input").attr("checked", false);
- a("#arrowchat_app_keep_open_" + c + " :input").attr("checked", true);
- var keep_open_id = c;
- u_apps_open = c;
- a(this).removeClass("arrowchat_menu_unchecked");
- }
- a.post(c_ac_path + "includes/json/send/send_settings.php", {
- app_keep: keep_open_id
- }, function() {});
- });
- a(".arrowchat_apps_button").click(function() {
- var c = a(this).attr("id").substr(30);
- closePopup($applications_button_popup, $applications_button);
- a(this).children(".arrowchat_tabalert").remove();
- if (apps[c][6] == "") {
- if (m != c && m !== "") {
- if (apps[m][7] == 1) {
- closePopup($application_button_popups[m], $application_buttons[m], 1);
- } else {
- closePopup($application_button_popups[m], $application_buttons[m]);
- }
- m = "";
- }
- if (m == "") {
- $application_button_popups[c].css("left", $application_buttons[c].offset().left).css("bottom", "25px").css("width", apps[c][4]);
- $application_button_popups[c].removeClass("arrowchat_tabopen_hidden");
- $application_button_popups[c].addClass("arrowchat_tabopen");
- $application_buttons[c].addClass("arrowchat_trayclick");
- if (apps[c][7] != "1" || apps[c][14] != "1") {
- a.get(c_ac_path + "applications/" + apps[c][2] + "/index.php", function(d) {
- a("#arrowchat_applications_button_" + apps[c][0] + "_content").html(d);
- });
- }
- apps[c][14] = 1;
- m = c;
- } else {
- if (apps[m][7] == 1) {
- closePopup($application_button_popups[m], $application_buttons[m], 1);
- } else {
- closePopup($application_button_popups[m], $application_buttons[m]);
- }
- var test = a("#arrowchatapplist_" + m).parent().attr("id");
- if (test == "arrowchat_other_applications") {
- $application_buttons[m].hide();
- }
- m = "";
- }
- } else {
- window.open(apps[c][6], "self");
- }
- });
- }
- function buildApplicationsButton() {
- $applications_button = a("<div/>").attr("id", "arrowchat_applications_button").addClass("arrowchat_bar_left").addClass("arrowchat_bar_button").html(ArrowChat.Templates.applications_tab()).appendTo($base);
- $applications_button_popup = a("<div/>").attr("id", "arrowchat_applications_button_popup").addClass("arrowchat_tabpopup").css("display", "none").html(ArrowChat.Templates.applications_window()).appendTo($body);
- $applications_button.css("width", c_width_apps + "px");
- if (c_width_apps <= 25) {
- a(".arrowchat_tray_name", $applications_button).hide();
- }
- var pold = apps.slice();
- function mysortfn(a, b) {
- if (a[13] < b[13]) {
- return -1;
- }
- if (a[13] > b[13]) {
- return 1;
- }
- return 0;
- }
- apps.sort(mysortfn);
- _appslist = "<div style=\"border-bottom: 1px solid #e9e9e9; color: #808080; margin: 3px 2px 4px;\">" + lang[20] + "</div><ul id=\"arrowchat_applications\" class=\"arrowchat_connectedSortable\" style=\"list-style-type: none; margin: 0px; padding: 0px;min-height:20px;\">";
- for (b in apps) {
- if (typeof apps[b][0] != "undefined") {
- if (apps[b][12] != "1") {
- if (apps[b][9] == "1" && u_id == "" || u_id != "" && u_is_guest == "1" && apps[b][9] == "1" || u_id != "" && u_is_guest != "1") {
- _appslist += ArrowChat.Templates.applications_bookmarks_list(c_ac_path, apps, b);
- }
- }
- }
- }
- _appslist += "</ul><div style=\"border-bottom: 1px solid #e9e9e9; color: #808080; margin: 8px 2px 4px;\">" + lang[64] + "</div><ul id=\"arrowchat_other_applications\" class=\"arrowchat_connectedSortable\" style=\"list-style-type: none; margin: 0px; padding: 0px;min-height:20px;\">";
- for (b in apps) {
- if (typeof apps[b][0] != "undefined") {
- if (apps[b][12] == "1") {
- if (apps[b][9] == "1" && u_id == "" || u_id != "" && u_is_guest == "1" && apps[b][9] == "1" || u_id != "" && u_is_guest != "1") {
- _appslist += ArrowChat.Templates.applications_bookmarks_list(c_ac_path, apps, b);
- }
- }
- }
- }
- _appslist += "</ul>";
- apps = pold.slice();
- a("#arrowchat_bookmarks").append("<div>" + _appslist + "</div>");
- if (u_id != "") {
- a("#arrowchat_applications, #arrowchat_other_applications").sortable({
- delay: 50,
- connectWith: ".arrowchat_connectedSortable",
- scroll: false,
- axis: "y",
- containment: ".arrowchat_traycontent",
- update: function() {
- var result = a("#arrowchat_other_applications").sortable("toArray");
- var result2 = a(this).sortable("serialize") + "&" + a(this).attr("id") + "=1";
- a.post(c_ac_path + "includes/json/send/send_settings.php", result2, function() {});
- for (var b = 0; b < result.length; b++) {
- var c = result[b].substr(17);
- $application_buttons[c].hide();
- apps[c][12] = "1";
- }
- var result2 = a("#arrowchat_applications").sortable("toArray");
- for (var b = 0; b < result2.length; b++) {
- var d = result2[b].substr(17);
- $application_buttons[d].show();
- apps[d][12] = "";
- }
- }
- });
- } else {
- a(".arrowchat_apps_subtitle").hide();
- }
- a(".arrowchat_app_link:not(.ui-sortable-helper)").on("click", function() {
- var c = a(this).attr("id").substr(19);
- if (apps[c][6] == "") {
- $application_buttons[c].show();
- closePopup($applications_button_popup, $applications_button);
- }
- $application_buttons[c].click();
- });
- a(".arrowchat_traytitle", $applications_button_popup).mouseenter(function() {
- a(this).addClass("arrowchat_chatboxtabtitlemouseover");
- });
- a(".arrowchat_traytitle", $applications_button_popup).mouseleave(function() {
- a(this).removeClass("arrowchat_chatboxtabtitlemouseover");
- });
- $applications_button.mouseover(function() {
- if (c_width_apps <= 25) {
- if ($applications_button.hasClass("arrowchat_tabclick")) {} else {
- showTooltip($applications_button, lang[16], true);
- }
- }
- a(this).addClass("arrowchat_tabmouseover");
- });
- $applications_button.mouseout(function() {
- a(this).removeClass("arrowchat_tabmouseover");
- if (c_width_apps <= 25) {
- hideTooltip();
- }
- });
- a(".arrowchat_traytitle", $applications_button_popup).click(function() {
- $applications_button.click();
- });
- $applications_button.click(function() {
- if (c_width_apps <= 25) {
- hideTooltip();
- }
- if (m != "") {
- $application_buttons[m].click();
- m = "";
- }
- $applications_button_popup.css("left", $applications_button.offset().left).css("bottom", "25px");
- a(this).toggleClass("arrowchat_tabclick");
- $applications_button_popup.toggleClass("arrowchat_tabopen");
- });
- }
- function buildOptionsButton() {
- $optionsbutton = a("<div/>").attr("id", "arrowchat_optionsbutton").addClass("arrowchat_bar_right").addClass("arrowchat_bar_button").html(ArrowChat.Templates.notifications_tab()).appendTo($base);
- $optionsbutton_popup = a("<div/>").attr("id", "arrowchat_optionsbutton_popup").addClass("arrowchat_tabpopup").css("display", "none").html(ArrowChat.Templates.notifications_window()).appendTo($body);
- $optionsbutton.mouseover(function() {
- $optionsbutton_popup.hasClass("arrowchat_tabopen") || ($ == 0 ? showTooltip($optionsbutton, lang[0]) : showTooltip($optionsbutton, lang[0]));
- a(this).addClass("arrowchat_tabmouseover");
- });
- $optionsbutton.mouseout(function() {
- a(this).removeClass("arrowchat_tabmouseover");
- hideTooltip();
- });
- a(".arrowchat_see_all_link").mouseenter(function() {
- showTooltip(a(this), lang[21], 0, 10, 5);
- a(this).parent().addClass("arrowchat_see_all_button_hover");
- a("#arrowchat_userstab_popup .arrowchat_userstabtitle").removeClass("arrowchat_chatboxtabtitlemouseover2");
- });
- a(".arrowchat_see_all_link").mouseleave(function() {
- hideTooltip();
- a(this).parent().removeClass("arrowchat_see_all_button_hover");
- a("#arrowchat_userstab_popup .arrowchat_userstabtitle").addClass("arrowchat_chatboxtabtitlemouseover2");
- });
- a(".arrowchat_see_all_link").click(function() {
- a("#arrowchat_notifications_content").html(lang[25]);
- var i = 0;
- a.ajax({
- url: c_ac_path + "includes/json/receive/receive_notifications.php",
- type: "get",
- cache: false,
- dataType: "json",
- success: function(b) {
- if (b && b != null) {
- a("#arrowchat_notifications_content").html("");
- a.each(b, function(e, l) {
- a.each(l, function(f, h) {
- a("<div/>").attr("id", "arrowchat_alert_" + h.alert_id).attr("class", "arrowchat_notification_message_div").html(h.markup).appendTo(a("#arrowchat_notifications_content"));
- i++;
- });
- });
- if (i == 0) {
- a("#arrowchat_notifications_content").html(lang[9]);
- }
- if (a(window).height() - $optionsbutton_popup.height() < 80) {
- a("#arrowchat_notifications_content").css("height", a(window).height() - 135);
- } else {
- a("#arrowchat_notifications_content").css("height", "auto");
- }
- }
- }
- });
- });
- $optionsbutton.click(function() {
- if (a("#arrowchat_notification_alert").length > 0) {
- a("#arrowchat_notification_alert").remove();
- $optionsbutton.removeClass("arrowchat_tab_new_message");
- }
- closePopup($chatrooms_popup, $chatrooms_button);
- if (Q > 0) {
- a("#arrowchat_optionsbutton .arrowchat_tabalertnf").remove();
- a.post(c_ac_path + "includes/json/send/send_notifications.php", {
- userid: u_id
- }, function() {});
- Q = 0;
- }
- if ($ == 0) {
- if (w == 1) {
- w = 0;
- a("#arrowchat_userstab_text").html(lang[4] + " (<b>" + (R + jabberOnlineNumber) + "</b>)");
- receiveCore();
- a(".available", $optionsbutton_popup).click();
- }
- hideTooltip();
- $optionsbutton_popup.css("left", $optionsbutton.offset().left - $optionsbutton_popup.outerWidth() + $optionsbutton.outerWidth()).css("bottom", "25px");
- a(this).toggleClass("arrowchat_tabclick");
- $optionsbutton_popup.toggleClass("arrowchat_tabopen");
- $optionsbutton.toggleClass("arrowchat_optionsimages_click");
- closePopup($userstab_popup, $buddy_list_tab);
- } else if (lang[16] != "") {
- location.href = lang[16];
- }
- if (a(window).height() - $optionsbutton_popup.height() < 80) {
- a("#arrowchat_notifications_content").css("height", a(window).height() - 135);
- } else {
- a("#arrowchat_notifications_content").css("height", "auto");
- }
- });
- a(".arrowchat_userstabtitle", $optionsbutton_popup).click(function() {
- $optionsbutton.click();
- }).children().not(".arrowchat_tab_name").click(function() {
- return false;
- });
- a(".arrowchat_userstabtitle", $optionsbutton_popup).mouseenter(function() {
- a(this).addClass("arrowchat_chatboxtabtitlemouseover2");
- });
- a(".arrowchat_userstabtitle", $optionsbutton_popup).mouseleave(function() {
- a(this).removeClass("arrowchat_chatboxtabtitlemouseover2");
- });
- }
- function displayMessage(id, message, type) {
- clearTimeout(message_timeout);
- if (a("#" + id).is(":visible")) {
- a("#" + id).hide("slide", {
- direction: "up"
- }, 250, function() {
- a("#" + id + " .arrowchat_message_text").html(message);
- type == "error" && a(".arrowchat_message_box").css("background-color", "#ffe2e2").css("border-bottom", "1px solid #ffbebe");
- type == "notice" && a(".arrowchat_message_box").css("background-color", "#fffae2").css("border-bottom", "1px solid #ffecbe");
- a("#" + id).show("slide", {
- direction: "up"
- }, 250);
- });
- } else {
- type == "error" && a(".arrowchat_message_box").css("background-color", "#ffe2e2").css("border-bottom", "1px solid #ffbebe");
- type == "notice" && a(".arrowchat_message_box").css("background-color", "#fffae2").css("border-bottom", "1px solid #ffecbe");
- a("#" + id + " .arrowchat_message_text").html(message);
- a("#" + id).show("slide", {
- direction: "up"
- }, 250);
- }
- message_timeout = setTimeout(function() {
- a("#" + id).hide("slide", {
- direction: "up"
- }, 250);
- }, 5000);
- }
- function loadChatroom(b, c, pass) {
- var global_mod = 0,
- global_admin = 0,
- admin_markup = "";
- chatroom_mod = 0;
- chatroom_admin = 0;
- chatroomreceived = 1;
- a.ajax({
- url: c_ac_path + "includes/json/receive/receive_chatroom_room.php",
- data: {
- chatroomid: b,
- chatroom_window: u_chatroom_open,
- chatroom_stay: u_chatroom_stay,
- chatroom_pw: pass
- },
- type: "post",
- cache: false,
- dataType: "json",
- success: function(o) {
- if (o) {
- clearTimeout(Crref2);
- var no_error = true;
- o && a.each(o, function(i, e) {
- if (i == "error") {
- a.each(e, function(l, f) {
- no_error = false;
- Ccr = 0;
- chatroomreceived = 0;
- loadChatroomList();
- displayMessage("arrowchat_chatroom_message_flyout", f.m, "error");
- });
- }
- });
- if (no_error) {
- setTimeout(function() {
- receiveChatroom(b);
- }, 30000);
- if (c_push_engine != 1) {
- cancelJSONP();
- receiveCore();
- } else {
- changePushChannel("chatroom" + b, 1);
- }
- if (typeof crt2[b] != "undefined") {
- a(".arrowchat_chatrooms_title .arrowchat_tab_name").html(lang[19] + " (" + crt2[b] + ")");
- }
- a("#arrowchat_chatroom_leave").show();
- a(".arrowchat_chatroom_full_content").html(ArrowChat.Templates.chatrooms_room());
- $chatroom_chat = a("#arrowchat_chatroom_chat");
- $chatroom_room_list = a("#arrowchat_chatroom_room_list");
- if (c_popout_on == 1) {
- a(".arrowchat_chatroom_popout", $chatrooms_popup).show();
- }
- a(".arrowchat_chatroom_popout", $chatrooms_popup).mouseenter(function() {
- showTooltip(a(this), lang[117], 0, 10, 5);
- a(this).addClass("arrowchat_chatroom_popout_hover");
- a(".arrowchat_chatrooms_title", $chatrooms_popup).removeClass("arrowchat_chatboxtabtitlemouseover3");
- });
- a(".arrowchat_chatroom_popout", $chatrooms_popup).mouseleave(function() {
- a(this).removeClass("arrowchat_chatroom_popout_hover");
- a(".arrowchat_chatrooms_title", $chatrooms_popup).addClass("arrowchat_chatboxtabtitlemouseover3");
- hideTooltip();
- });
- a(".arrowchat_chatroom_popout", $chatrooms_popup).unbind("click");
- a(".arrowchat_chatroom_popout", $chatrooms_popup).click(function() {
- window.open(c_ac_path + "public/chatroom/?id=" + b, "chatroom", "menubar=0,resizable=0,width=900,height=650,top=25,left=25,scrollbars=0,status=0");
- });
- a(".arrowchat_chatroom_message_input", $chatrooms_popup).keydown(function(h) {
- return chatroomKeydown(h, a(this));
- });
- a(".arrowchat_chatroom_message_input", $chatrooms_popup).keyup(function(h) {
- return chatroomKeyup(h, a(this));
- });
- var smiley_exist = [];
- a(".arrowchat_smiley_box", $chatrooms_popup).html("");
- for (var i = 0; i < Smiley.length; i++) {
- if (a.inArray(Smiley[i][0], smiley_exist) > -1) {} else {
- a(".arrowchat_smiley_box", $chatrooms_popup).append("<div class=\"arrowchat_smiley_wrapper\" data-id=\"" + i + "\"><img class=\"arrowchat_smiley\" src=\"" + c_ac_path + "themes/" + u_theme + "/images/smilies/" + Smiley[i][0] + ".gif\" alt=\"\" /></div>");
- smiley_exist.push(Smiley[i][0]);
- }
- }
- a(".arrowchat_smiley_button", $chatrooms_popup).mouseenter(function() {
- a(this).addClass("arrowchat_smiley_button_hover");
- });
- a(".arrowchat_smiley_button", $chatrooms_popup).mouseleave(function() {
- a(this).removeClass("arrowchat_smiley_button_hover");
- });
- a(".arrowchat_smiley_wrapper", $chatrooms_popup).click(function() {
- var smiley_code = a(this).attr("data-id");
- var existing_text = a(".arrowchat_chatroom_message_input", $chatrooms_popup).val();
- a(".arrowchat_chatroom_message_input", $chatrooms_popup).focus().val("").val(existing_text + Smiley[smiley_code][1]);
- a(".arrowchat_smiley_box", $chatrooms_popup).hide("slide", {
- direction: "up"
- }, 250, function() {});
- });
- a(".arrowchat_smiley_button", $chatrooms_popup).click(function() {
- if (a(".arrowchat_smiley_box", $chatrooms_popup).is(":visible")) {
- a(".arrowchat_smiley_box", $chatrooms_popup).hide("slide", {
- direction: "up"
- }, 250, function() {});
- } else {
- a(".arrowchat_smiley_box", $chatrooms_popup).show("slide", {
- direction: "up"
- }, 250, function() {});
- }
- });
- if (c_disable_smilies == 1) {
- a(".arrowchat_smiley_button").hide();
- a(".arrowchat_chatroom_message_input").css("width", "99%");
- }
- o && a.each(o, function(i, e) {
- if (i == "user_title") {
- a.each(e, function(l, f) {
- if (f.admin == 1) {
- global_admin = 1;
- chatroom_admin = 1;
- }
- if (f.mod == 1) {
- global_mod = 1;
- chatroom_mod = 1;
- }
- });
- }
- if (i == "chat_name") {
- a.each(e, function(l, f) {
- if (typeof crt2[b] == "undefined") {
- crt2[b] = f.n;
- a(".arrowchat_chatrooms_title .arrowchat_tab_name").html(lang[19] + " (" + crt2[b] + ")");
- }
- });
- }
- if (i == "chat_users") {
- var longname;
- a.each(e, function(l, f) {
- if ((global_admin == 1 || global_mod == 1) && f.t == 1) {
- admin_markup = "<div class=\"arrowchat_chatroom_options_padding\"><div id=\"arrowchat_chatroom_make_mod_" + f.id + "\" class=\"arrowchat_chatroom_flyout_text\">" + lang[52] + "</div></div><div class=\"arrowchat_chatroom_options_padding\"><div id=\"arrowchat_chatroom_ban_user_" + f.id + "\" class=\"arrowchat_chatroom_flyout_text\">" + lang[53] + "</div></div>";
- }
- if (global_admin == 1 && f.t == 2) {
- admin_markup = "<div class=\"arrowchat_chatroom_options_padding\"><div id=\"arrowchat_chatroom_remove_mod_" + f.id + "\" class=\"arrowchat_chatroom_flyout_text\">" + lang[54] + "</div></div>";
- }
- longname = renderHTMLString(f.n);
- f.n = renderHTMLString(f.n).length > 16 ? renderHTMLString(f.n).substr(0, 16) + "..." : f.n;
- a("<div/>").attr("id", "arrowchat_chatroom_user_" + f.id).mouseover(function() {
- a(this).addClass("arrowchat_chatroom_list_hover");
- }).mouseout(function() {
- a(this).removeClass("arrowchat_chatroom_list_hover");
- }).addClass("arrowchat_chatroom_room_list").addClass("arrowchat_chatroom_admin_" + f.t).html("<img class=\"arrowchat_chatroom_avatar\" src=\"" + f.a + "\"/><span class=\"arrowchat_chatroom_room_name\">" + f.n + "</span><span class=\"arrowchat_userscontentdot arrowchat_" + f.status + "\"></span>").appendTo($chatroom_room_list);
- a("<div/>").attr("id", "arrowchat_chatroom_users_flyout_" + f.id).addClass("arrowchat_chatroom_users_flyout").html("<div class=\"arrowchat_chatroom_title_padding\"><div id=\"arrowchat_chatroom_title_" + f.id + "\" class=\"arrowchat_chatroom_flyout_text\">" + longname + "<br/>" + lang[43] + "</div></div><hr class=\"arrowchat_options_divider\"/><div class=\"arrowchat_chatroom_options_padding\"><div id=\"arrowchat_chatroom_visit_profile_" + f.id + "\" class=\"arrowchat_chatroom_flyout_text\">" + lang[42] + "</div></div><div class=\"arrowchat_chatroom_options_padding\"><div id=\"arrowchat_chatroom_private_message_" + f.id + "\" class=\"arrowchat_chatroom_flyout_text\">" + lang[41] + "</div></div><div class=\"arrowchat_chatroom_options_padding\"><div id=\"arrowchat_chatroom_block_user_" + f.id + "\" class=\"arrowchat_chatroom_flyout_text\">" + lang[84] + "</div></div>" + admin_markup).appendTo(a("#arrowchat_chatroom_user_" + f.id));
- if (f.t == 2) {
- a("#arrowchat_chatroom_title_" + f.id).html(longname + "<br/>" + lang[44]);
- } else if (f.t == 3) {
- a("#arrowchat_chatroom_title_" + f.id).html(longname + "<br/>" + lang[45]);
- }
- addHover(a(".arrowchat_chatroom_options_padding"), "arrowchat_options_padding_hover");
- chatroomUserOptions(f, global_admin);
- });
- a(".arrowchat_chatroom_admin_3").css("background-color", "#" + c_admin_bg);
- a(".arrowchat_chatroom_admin_3").css("color", "#" + c_admin_txt);
- }
- if (i == "chat_history") {
- d = "";
- a.each(e, function(l, f) {
- if (typeof blockList[f.userid] == "undefined") {
- var title = "";
- if (f.mod == 1) {
- title = lang[137];
- }
- if (f.admin == 1) {
- title = lang[136];
- }
- l = "";
- fromname = f.n;
- if (f.n == u_name) {
- l = " arrowchat_self";
- }
- var sent_time = new Date(f.t * 1000);
- if (f.global == 1) {
- d += "<div class=\"arrowchat_chatroom_box_message\" id=\"arrowchat_chatroom_message_" + f.id + "\"><div class=\"arrowchat_chatroom_message_content" + l + " arrowchat_global_chatroom_message\">" + formatTimestamp(sent_time) + f.m + "</div></div>";
- } else {
- d += "<div class=\"arrowchat_chatroom_box_message\" id=\"arrowchat_chatroom_message_" + f.id + "\"><img class=\"arrowchat_chatroom_message_avatar\" src=\"" + f.a + "\" alt=\"\" /><div class=\"arrowchat_chatroom_message_name\">" + fromname + title + ":</div><div class=\"arrowchat_chatroom_message_content" + l + "\">" + formatTimestamp(sent_time) + f.m + "</div></div>";
- }
- }
- });
- $chatroom_chat.html("<div>" + d + "</div>");
- showChatroomTime();
- $chatroom_chat.scrollTop(50000);
- }
- });
- if (c_disable_avatars == 1 || a("#arrowchat_setting_names_only :input").is(":checked")) {
- a(".arrowchat_chatroom_avatar").addClass("arrowchat_hide_avatars");
- a(".arrowchat_chatroom_message_avatar").addClass("arrowchat_hide_avatars");
- }
- a(".arrowchat_chatroom_message_input").focus();
- } else {
- if (c_user_chatrooms == "1") {
- $chatroom_create.show();
- }
- }
- }
- }
- });
- }
- function receiveUser(b, c, d, e, l, f, h) {
- if (!(b == null || b == "")) {
- if ((uc_name[b] == null || uc_name[b] == "") && b.toString().search("facebook") == "-1") {
- if (aa[b] != 1) {
- aa[b] = 1;
- a.ajax({
- url: c_ac_path + "includes/json/receive/receive_user.php",
- data: {
- userid: b
- },
- type: "post",
- cache: false,
- dataType: "json",
- success: function(o) {
- if (o) {
- c = uc_name[b] = o.n;
- d = uc_status[b] = o.s;
- e = uc_avatar[b] = o.a;
- l = uc_link[b] = o.l;
- if (G[b] != null) {
- a(".arrowchat_closebox_bottom_status", $user[b]).removeClass("arrowchat_available arrowchat_busy arrowchat_offline").addClass("arrowchat_" + d);
- $users[b].removeClass("arrowchat_tab_offline").addClass("arrowchat_tab_" + c);
- $user_popups[b].length > 0 && a(".arrowchat_tabsubtitle .arrowchat_message", $user_popups[b]).html(i);
- }
- aa[b] = 0;
- if (c != null) {
- toggleUserChatTab(b, c, d, e, l, f);
- if (c_mobile_device) {
- mobileSupport();
- }
- } else {
- a.post(c_ac_path + "includes/json/send/send_settings.php", {
- unfocus_chat: b
- }, function() {});
- }
- }
- }
- });
- } else {
- setTimeout(function() {
- receiveUser(b, uc_name[b], uc_status[b], uc_avatar[b], uc_link[b], f, h);
- }, 500);
- }
- } else {
- if (b.toString().search("facebook") == "-1") {
- toggleUserChatTab(b, uc_name[b], uc_status[b], uc_avatar[b], uc_link[b], f);
- } else {
- toggleUserChatTab(b, uc_name[b], uc_status[b], uc_avatar[b], uc_link[b], f, 1);
- }
- }
- }
- }
- function toggleUserChatTab(b, c, d, e, l, f, jabber) {
- if (G[b] != null) {
- if (!$users[b].hasClass("arrowchat_tabclick") && f != 1) {
- if (j != "") {
- closePopup($user_popups[j], $users[j]);
- j = "";
- }
- if ($users[b].offset().left < $chatboxes.offset().left + $chatboxes.width() && $users[b].offset().left - $chatboxes.offset().left >= 0) {
- $users[b].click();
- } else {
- a(".arrowchat_tabalert").css("display", "none");
- e = 800;
- if (get("initialize") == 1) {
- e = 0;
- }
- $chatboxes.scrollTo($users[b], e, function() {
- $users[b].click();
- updateRightLastClasses();
- positionTabAlerts();
- });
- }
- }
- updateRightLastClasses();
- } else {
- $chatboxes_wide.width($chatboxes_wide.width() + 148);
- adjustBarSize();
- shortname = renderHTMLString(c).length > 12 ? renderHTMLString(c).substr(0, 12) + "..." : c;
- longname = renderHTMLString(c).length > 17 ? renderHTMLString(c).substr(0, 17) + "..." : c;
- $users[b] = a(ArrowChat.Templates.chat_tab(shortname)).attr("data-id", b).appendTo($chatboxes_wide);
- $users[b].append("<div class=\"arrowchat_closebox_bottom_status arrowchat_" + d + "\"></div>");
- $users[b].addClass("arrowchat_tab_" + d);
- jabber == 1 && $users[b].addClass("arrowchat_jabber_user_tab");
- $users[b].append("<div class=\"arrowchat_closebox_bottom\"></div>");
- a(".arrowchat_closebox_bottom", $users[b]).mouseenter(function() {
- a(this).addClass("arrowchat_closebox_bottomhover");
- });
- a(".arrowchat_closebox_bottom", $users[b]).mouseleave(function() {
- a(this).removeClass("arrowchat_closebox_bottomhover");
- });
- a(".arrowchat_closebox_bottom", $users[b]).click(function() {
- a.post(c_ac_path + "includes/json/send/send_settings.php", {
- close_chat: b,
- tab_alert: 1
- }, function() {});
- $user_popups[b].remove();
- $users[b].remove();
- if (j == b) {
- j = "";
- }
- $chatboxes_wide.width($chatboxes_wide.width() - 148);
- $chatboxes.scrollTo("-=148px");
- adjustBarSize();
- y[b] = null;
- G[b] = null;
- ca[b] = 0;
- });
- i = c = "";
- if (l != "") {
- c = "<a href=\"" + l + "\">";
- i = "</a>";
- }
- l = "";
- if (e != "") {
- l = "<div class=\"arrowchat_avatarbox\">" + c + "<img src=\"" + e + "\" class=\"arrowchat_avatar\" />" + i + "</div>";
- }
- $user_popups[b] = a(ArrowChat.Templates.chat_window(c, longname, i, l, b)).css("display", "none").appendTo($body);
- if (c_video_chat != 1) {
- a("#arrowchat_video_chat_" + b).hide();
- }
- if (c_file_transfer != 1) {
- a("#arrowchat_file_transfer_" + b).hide();
- }
- if (c_popout_on != 1) {
- a(".arrowchat_chat_popout").hide();
- }
- addHover(a(".arrowchat_video_chat"), "arrowchat_more_hover");
- a("#arrowchat_file_cancel_" + b).click(function() {
- a("#arrowchat_file_upload_div_" + b).hide("slide", {
- direction: "up"
- }, 250);
- });
- a("#arrowchat_file_transfer_" + b).click(function() {
- var ts67 = Math.round((new Date).getTime());
- var path = c_ac_path.replace("../", "/");
- a("#arrowchat_file_upload_" + b).uploadify({
- swf: path + "includes/js/uploadify/uploadify.swf",
- uploader: path + "includes/classes/class_uploads.php",
- hideButton: true,
- buttonText: " ",
- wmode: "transparent",
- formData: {
- unixtime: ts67,
- user: u_id
- },
- height: 17,
- width: 42,
- auto: true,
- fileTypeExts: "*.jpg;*.gif;*.png;*.zip;*.rar;*.jpeg;*.txt;*.doc;*.mp3;*.wmv;*.avi;*.mp4;*.docx;*.wav",
- fileTypeDesc: "Supported File Types (.JPG, .JPEG, .GIF, .PNG, .WMV, .AVI, .MP4, .ZIP, .RAR, .MP3, .WAV, .TXT, .DOC, .DOCX)",
- onSelect: function() {
- a(".arrowchat_upload_info_text").hide();
- a(".arrowchat_upload_text").hide();
- a(".arrowchat_ui_button").css("background", "none");
- a(".arrowchat_ui_button").css("border", "none");
- },
- onCancel: function() {
- a("#arrowchat_file_upload_div_" + b).hide("slide", {
- direction: "up"
- }, 250);
- a(".arrowchat_upload_info_text").show();
- a(".arrowchat_upload_text").show();
- a(".arrowchat_ui_button").css("background", "#5B74A8");
- a(".arrowchat_ui_button").css("border", "1px solid #999");
- },
- onUploadComplete: function() {
- a.post(c_ac_path + "includes/json/send/send_message.php", {
- userid: u_id,
- to: b,
- message: "file{" + ts67 + "}"
- }, function(e) {
- if (e == "-1") {
- displayMessage("arrowchat_chatbox_message_flyout_" + b, lang[102], "error");
- } else {
- displayMessage("arrowchat_chatbox_message_flyout_" + b, lang[68], "notice");
- }
- a(".arrowchat_tabcontenttext", $user_popups[b]).scrollTop(a(".arrowchat_tabcontenttext", $user_popups[b])[0].scrollHeight);
- });
- a("#arrowchat_file_upload_div_" + b).hide();
- a(".arrowchat_upload_info_text").show();
- a(".arrowchat_upload_text").show();
- a(".arrowchat_ui_button").css("background", "#5B74A8");
- a(".arrowchat_ui_button").css("border", "1px solid #999");
- }
- });
- a("#arrowchat_more_popout_" + b).toggle();
- a("#arrowchat_more_" + b).toggleClass("arrowchat_more_button_selected");
- a("#arrowchat_file_upload_div_" + b).show("slide", {
- direction: "up"
- }, 250);
- });
- a("#arrowchat_video_chat_" + b).click(function() {
- a("#arrowchat_more_popout_" + b).toggle();
- a("#arrowchat_more_" + b).toggleClass("arrowchat_more_button_selected");
- var RN = Math.floor(Math.random() * 9999999999);
- while (String(RN).length < 10) {
- RN = "0" + RN;
- }
- jqac.arrowchat.videoWith(RN);
- a.post(c_ac_path + "includes/json/send/send_message.php", {
- userid: u_id,
- to: b,
- message: "video{" + RN + "}"
- }, function(e) {
- if (e == "-1") {
- displayMessage("arrowchat_chatbox_message_flyout_" + b, lang[102], "error");
- } else {
- displayMessage("arrowchat_chatbox_message_flyout_" + b, lang[63], "notice");
- }
- a(".arrowchat_tabcontenttext", $user_popups[b]).scrollTop(a(".arrowchat_tabcontenttext", $user_popups[b])[0].scrollHeight);
- });
- });
- var smiley_exist = [];
- for (var i = 0; i < Smiley.length; i++) {
- if (a.inArray(Smiley[i][0], smiley_exist) > -1) {} else {
- a(".arrowchat_smiley_box", $user_popups[b]).append("<div class=\"arrowchat_smiley_wrapper\" data-id=\"" + i + "\"><img class=\"arrowchat_smiley\" src=\"" + c_ac_path + "themes/" + u_theme + "/images/smilies/" + Smiley[i][0] + ".gif\" alt=\"\" /></div>");
- smiley_exist.push(Smiley[i][0]);
- }
- }
- a(".arrowchat_smiley_button", $user_popups[b]).mouseenter(function() {
- a(this).addClass("arrowchat_smiley_button_hover");
- });
- a(".arrowchat_smiley_button", $user_popups[b]).mouseleave(function() {
- a(this).removeClass("arrowchat_smiley_button_hover");
- });
- a(".arrowchat_smiley_wrapper", $user_popups[b]).click(function() {
- var smiley_code = a(this).attr("data-id");
- var existing_text = a(".arrowchat_textarea", $user_popups[b]).val();
- a(".arrowchat_textarea", $user_popups[b]).focus().val("").val(existing_text + Smiley[smiley_code][1]);
- a(".arrowchat_smiley_box", $user_popups[b]).hide("slide", {
- direction: "up"
- }, 250, function() {});
- });
- a(".arrowchat_smiley_button", $user_popups[b]).click(function() {
- if (a(".arrowchat_smiley_box", $user_popups[b]).is(":visible")) {
- a(".arrowchat_smiley_box", $user_popups[b]).hide("slide", {
- direction: "up"
- }, 250, function() {});
- } else {
- a(".arrowchat_smiley_box", $user_popups[b]).show("slide", {
- direction: "up"
- }, 250, function() {});
- }
- });
- if (c_disable_smilies == 1) {
- a(".arrowchat_smiley_button").hide();
- a(".arrowchat_textarea").css("width", "99%");
- }
- a(".arrowchat_tabtitle .arrowchat_more_button", $user_popups[b]).mouseenter(function() {
- showTooltip(a(this), lang[23], 0, 10, 5);
- a(this).addClass("arrowchat_more_button_hover");
- a(".arrowchat_tabtitle", $user_popups[b]).removeClass("arrowchat_chatboxtabtitlemouseover");
- });
- a(".arrowchat_tabtitle .arrowchat_more_button", $user_popups[b]).mouseleave(function() {
- hideTooltip();
- a(this).removeClass("arrowchat_more_button_hover");
- a(".arrowchat_tabtitle", $user_popups[b]).addClass("arrowchat_chatboxtabtitlemouseover");
- });
- a("#arrowchat_more_" + b).click(function() {
- hideTooltip();
- a("#arrowchat_more_popout_" + b).toggle();
- a(this).addClass("arrowchat_more_button_hover");
- a(this).toggleClass("arrowchat_more_button_selected");
- });
- a("#arrowchat_block_" + b).click(function() {
- a("#arrowchat_more_popout_" + b).toggle();
- a("#arrowchat_more_" + b).toggleClass("arrowchat_more_button_selected");
- a(".arrowchat_tabtitle .arrowchat_closebox", $user_popups[b]).click();
- a.post(c_ac_path + "includes/json/send/send_settings.php", {
- block_chat: b
- }, function() {
- if (typeof blockList[b] == "undefined") {
- blockList[b] = b;
- }
- loadBuddyList();
- });
- });
- a("#arrowchat_clear_" + b).click(function() {
- a("#arrowchat_more_popout_" + b).toggle();
- a("#arrowchat_more_" + b).toggleClass("arrowchat_more_button_selected");
- a("#arrowchat_tabcontenttext_" + b).html("");
- a.post(c_ac_path + "includes/json/send/send_settings.php", {
- clear_chat: b
- }, function() {});
- });
- a(".arrowchat_textarea", $user_popups[b]).keydown(function(h) {
- return userchatKeydown(h, a(this), b, jabber);
- });
- a(".arrowchat_textarea", $user_popups[b]).keyup(function(h) {
- return userchatKeyup(h, a(this), b);
- });
- a(".arrowchat_tabtitle .arrowchat_closebox", $user_popups[b]).mouseenter(function() {
- showTooltip(a(this), lang[89], 0, 10, 5);
- a(this).addClass("arrowchat_chatboxmouseoverclose");
- a(".arrowchat_tabtitle", $user_popups[b]).removeClass("arrowchat_chatboxtabtitlemouseover");
- });
- a(".arrowchat_tabtitle .arrowchat_closebox", $user_popups[b]).mouseleave(function() {
- a(this).removeClass("arrowchat_chatboxmouseoverclose");
- a(".arrowchat_tabtitle", $user_popups[b]).addClass("arrowchat_chatboxtabtitlemouseover");
- hideTooltip();
- });
- a(".arrowchat_tabtitle .arrowchat_closebox", $user_popups[b]).click(function() {
- hideTooltip();
- a.post(c_ac_path + "includes/json/send/send_settings.php", {
- close_chat: b,
- tab_alert: 1
- }, function() {});
- $user_popups[b].remove();
- $users[b].remove();
- if (j == b) {
- j = "";
- }
- $chatboxes_wide.width($chatboxes_wide.width() - 148);
- $chatboxes.scrollTo("-=148px");
- adjustBarSize();
- G[b] = null;
- y[b] = null;
- ca[b] = 0;
- });
- a(".arrowchat_tabtitle .arrowchat_chat_popout", $user_popups[b]).mouseenter(function() {
- showTooltip(a(this), lang[88], 0, 10, 5);
- a(this).addClass("arrowchat_chat_popout_hover");
- a(".arrowchat_tabtitle", $user_popups[b]).removeClass("arrowchat_chatboxtabtitlemouseover");
- });
- a(".arrowchat_tabtitle .arrowchat_chat_popout", $user_popups[b]).mouseleave(function() {
- a(this).removeClass("arrowchat_chat_popout_hover");
- a(".arrowchat_tabtitle", $user_popups[b]).addClass("arrowchat_chatboxtabtitlemouseover");
- hideTooltip();
- });
- a(".arrowchat_tabtitle .arrowchat_chat_popout", $user_popups[b]).click(function() {
- startPopoutChat();
- });
- a(".arrowchat_tabtitle .arrowchat_chat_popout", $user_popups[b]).popupWindow({
- windowURL: c_ac_path + "public/popout/",
- height: 650,
- width: 900,
- top: 25,
- left: 25
- });
- a(".arrowchat_tabtitle", $user_popups[b]).not(".arrowchat_chat_popout").click(function() {
- $users[b].click();
- }).children().not(".arrowchat_tab_name").click(function() {
- return false;
- });
- a(".arrowchat_tabtitle", $user_popups[b]).mouseenter(function() {
- a(this).addClass("arrowchat_chatboxtabtitlemouseover");
- });
- a(".arrowchat_tabtitle", $user_popups[b]).mouseleave(function() {
- a(this).removeClass("arrowchat_chatboxtabtitlemouseover");
- });
- $users[b].mouseenter(function() {
- a(this).addClass("arrowchat_tabmouseover");
- a("div", $users[b]).addClass("arrowchat_tabmouseovertext");
- });
- $users[b].mouseleave(function() {
- a(this).removeClass("arrowchat_tabmouseover");
- a("div", $users[b]).removeClass("arrowchat_tabmouseovertext");
- });
- $users[b].click(function() {
- var tba = 0;
- if (a(".arrowchat_tabalert", $users[b]).length > 0) {
- tba = 1;
- a(".arrowchat_tabalert", $users[b]).remove();
- $users[b].removeClass("arrowchat_tab_new_message");
- G[b] = 0;
- y[b] = 0;
- }
- if (a(this).hasClass("arrowchat_tabclick")) {
- closePopup($user_popups[b], a(this));
- a(".arrowchat_closebox_bottom", $users[b]).removeClass("arrowchat_closebox_bottom_click");
- j = "";
- a.post(c_ac_path + "includes/json/send/send_settings.php", {
- unfocus_chat: b,
- tab_alert: 1
- }, function() {});
- } else {
- if (j != "") {
- closePopup($user_popups[j], $users[j]);
- a(".arrowchat_closebox_bottom", $users[j]).removeClass("arrowchat_closebox_bottom_click");
- j = "";
- }
- if (!($users[b].offset().left < $chatboxes.offset().left + $chatboxes.width() && $users[b].offset().left - $chatboxes.offset().left >= 0)) {
- $chatboxes.scrollTo($users[b]);
- updateRightLastClasses();
- }
- if (ca[b] != 1) {
- if (jabber == 1) {
- getJabberHistory(b);
- } else {
- receiveHistory(b);
- }
- ca[b] = 1;
- }
- a.post(c_ac_path + "includes/json/send/send_settings.php", {
- focus_chat: b,
- tab_alert: tba
- }, function() {});
- $user_popups[b].css("left", $users[b].offset().left - $user_popups[b].outerWidth() + $users[b].outerWidth()).css("bottom", "25px");
- a(this).addClass("arrowchat_tabclick").addClass("arrowchat_usertabclick");
- $user_popups[b].addClass("arrowchat_tabopen");
- a(".arrowchat_closebox_bottom", $users[b]).addClass("arrowchat_closebox_bottom_click");
- j = b;
- if (W) {
- $user_popups[j].css("position", "absolute").css("top", parseInt(a(window).height()) - parseInt($user_popups[j].css("bottom")) - parseInt($user_popups[j].height()) + a(window).scrollTop() + "px");
- }
- }
- a(".arrowchat_tabcontenttext", $user_popups[b]).scrollTop(a(".arrowchat_tabcontenttext", $user_popups[b])[0].scrollHeight);
- getStatus("updatingsession") != 1 && a(".arrowchat_textarea", $user_popups[b]).focus();
- });
- f != 1 && $users[b].click();
- y[b] = 0;
- G[b] = 0;
- if (c_disable_avatars == 1) {
- a(".arrowchat_avatarbox").hide();
- a("#arrowchat_setting_names_only").parent("li").hide();
- }
- if (jabber == 1) {
- a(".arrowchat_more_button", $user_popups[b]).hide();
- a(".arrowchat_chat_popout", $user_popups[b]).hide();
- }
- }
- }
- function formatTimestamp(b) {
- var c = "am",
- d = b.getHours(),
- i = b.getMinutes(),
- e = b.getDate();
- b = b.getMonth();
- var g = d;
- if (d > 11) {
- c = "pm";
- }
- if (d > 12) {
- d -= 12;
- }
- if (d == 0) {
- d = 12;
- }
- if (d < 10) {
- d = d;
- }
- if (i < 10) {
- i = "0" + i;
- }
- var l = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
- f = "th";
- if (e == 1 || e == 21 || e == 31) {
- f = "st";
- } else if (e == 2 || e == 22) {
- f = "nd";
- } else if (e == 3 || e == 23) {
- f = "rd";
- }
- if (c_us_time != 1) {
- return e != Na ? "<span class=\"arrowchat_ts\">" + g + ":" + i + " " + e + f + " " + l[b] + "</span>" : "<span class=\"arrowchat_ts\">" + g + ":" + i + "</span>";
- } else {
- return e != Na ? "<span class=\"arrowchat_ts\">" + d + ":" + i + c + " " + e + f + " " + l[b] + "</span>" : "<span class=\"arrowchat_ts\">" + d + ":" + i + c + "</span>";
- }
- }
- function receiveHistory(b, times) {
- if (times) {} else {
- times = 1;
- }
- if (times > 1) {
- a("<div class=\"arrowchat_message_history_loading\" style=\"text-align:center;padding:5px 0;\"><img src=\"" + c_ac_path + "themes/" + u_theme + "/images/img-loading.gif\" alt=\"Loading\" /></div>").prependTo(a("#arrowchat_tabcontenttext_" + b));
- }
- a.ajax({
- cache: false,
- url: c_ac_path + "includes/json/receive/receive_history.php",
- data: {
- chatbox: b,
- history: times
- },
- type: "post",
- dataType: "json",
- success: function(c) {
- a(".arrowchat_message_history_loading").remove();
- history_ids[b] = 0;
- numMessages = 0;
- if (c) {
- if (times == 1) {
- a(".arrowchat_tabcontenttext", $user_popups[b]).html("");
- }
- last_sent[b] = null;
- var d = "",
- i = uc_name[b],
- init = false;
- a.each(c, function(e, l) {
- e == "messages" && a.each(l, function(f, h) {
- numMessages++;
- f = "";
- if (h.self == 1) {
- fromname = u_name;
- fromid = u_id;
- f = " arrowchat_self";
- _aa5 = _aa4 = "";
- avatar = u_avatar;
- tooltip = lang[90];
- } else {
- fromname = i;
- fromid = b;
- _aa4 = "<a href=\"" + uc_link[b] + "\">";
- _aa5 = "</a>";
- avatar = uc_avatar[h.from];
- tooltip = fromname;
- }
- var full_name = fromid;
- var o = new Date(h.sent * 1000);
- if (c_show_full_name != "1") {
- if (fromname.indexOf(" ") != -1) {
- fromname = fromname.slice(0, fromname.indexOf(" "));
- }
- }
- if (h.sent - last_sent[h.from] > 60 || last_sent[h.from] == null || last_name[h.from] != full_name) {
- if (init == true) {
- d += "</div>";
- }
- d += "<div class=\"arrowchat_chatboxmessage arrowchat_clearfix\" id=\"arrowchat_message_" + h.id + "\"><div class=\"arrowchat_chatboxmessagefrom" + f + "\"><div class=\"arrowchat_disable_avatars_name\">" + fromname + "</div><img alt=\"" + tooltip + "\" class=\"arrowchat_chatbox_avatar\" src=\"" + avatar + "\" /></div><div class=\"arrowchat_chatboxmessage_wrapper\"><div class=\"arrowchat_chatboxmessagecontent" + f + "\">" + formatTimestamp(o) + h.message + "</div></div>";
- last_sent[h.from] = h.sent;
- last_name[h.from] = full_name;
- init = true;
- last_id[h.from] = h.id;
- } else {
- d += "<div id=\"arrowchat_message_" + h.id + "\" class=\"arrowchat_chatboxmessagecontent" + f + "\">" + h.message + "</div>";
- }
- });
- });
- var current_top_element = a("#arrowchat_tabcontenttext_" + b).children().children().first();
- if (times > 1) {
- a(d).prependTo(a("#arrowchat_tabcontenttext_" + b).children("div"));
- } else {
- a("#arrowchat_tabcontenttext_" + b).html("<div>" + d + "</div>");
- }
- showTimeAndTooltip();
- if (c_disable_avatars == 1 || a("#arrowchat_setting_names_only :input").is(":checked")) {
- setAvatarVisibility(1);
- }
- var previous_height = 0;
- current_top_element.prevAll().each(function() {
- previous_height += a(this).outerHeight();
- });
- if (times == 1) {
- a("#arrowchat_tabcontenttext_" + b).scrollTop(50000);
- } else {
- a("#arrowchat_tabcontenttext_" + b).scrollTop(previous_height);
- }
- a("#arrowchat_tabcontenttext_" + b).scroll(function() {
- if (a("#arrowchat_tabcontenttext_" + b).scrollTop() < 50 && history_ids[b] != 1) {
- history_ids[b] = 1;
- if (numMessages == 20) {
- times++;
- receiveHistory(b, times);
- }
- }
- });
- }
- }
- });
- }
- function showTimeAndTooltip() {
- a(".arrowchat_chatbox_avatar").mouseenter(function() {
- showTooltip(a(this), a(this).attr("alt"), false, 55, -38, 1);
- });
- a(".arrowchat_chatbox_avatar").mouseleave(function() {
- hideTooltip();
- });
- a(".arrowchat_chatboxmessage").mouseenter(function() {
- a(this).children().children(".arrowchat_chatboxmessagecontent").children(".arrowchat_ts").show();
- });
- a(".arrowchat_chatboxmessage").mouseleave(function() {
- a(this).children().children(".arrowchat_chatboxmessagecontent").children(".arrowchat_ts").hide();
- });
- }
- function showChatroomTime() {
- a(".arrowchat_chatroom_box_message").mouseenter(function() {
- a(this).children(".arrowchat_chatroom_message_content").children(".arrowchat_ts").show();
- });
- a(".arrowchat_chatroom_box_message").mouseleave(function() {
- a(this).children(".arrowchat_chatroom_message_content").children(".arrowchat_ts").hide();
- });
- }
- function notifyNewMessage(b, c, d) {
- if (uc_name[b] == null || uc_name[b] == "") {
- setTimeout(function() {
- notifyNewMessage(b, c, d);
- }, 500);
- } else {
- receiveUser(b, uc_name[b], uc_status[b], uc_avatar[b], uc_link[b], 1);
- if (d == 1) {
- if (a(".arrowchat_tabalert", $users[b]).length > 0) {
- c = parseInt(a(".arrowchat_tabalert", $users[b]).html()) + parseInt(c);
- }
- }
- if (c == 0) {
- $users[b].removeClass("arrowchat_tab_new_message");
- a(".arrowchat_tabalert", $users[b]).remove();
- } else {
- if (a(".arrowchat_tabalert", $users[b]).length > 0) {
- a(".arrowchat_tabalert", $users[b]).html(c);
- if (bounce3 == 1) {
- bounce3 = 0;
- a(".arrowchat_tabalert", $users[b]).stop(true, true).effect("bounce", {
- times: 3,
- distance: 5
- }, 200, function() {
- bounce3 = 1;
- });
- }
- } else {
- a("<div/>").css("top", "-11px").css("left", "112px").addClass("arrowchat_tabalert").html(c).appendTo($users[b]);
- }
- $users[b].removeClass("arrowchat_tab_new_message").addClass("arrowchat_tab_new_message");
- }
- y[b] = c;
- positionTabAlerts();
- }
- }
- function setAvatarVisibility(b) {
- if (b == 1) {
- a(".arrowchat_userlist_avatar").addClass("arrowchat_hide_avatars");
- a(".arrowchat_chatroom_avatar").addClass("arrowchat_hide_avatars");
- a(".arrowchat_chatroom_message_avatar").addClass("arrowchat_hide_avatars");
- a(".arrowchat_chatbox_avatar").hide();
- a(".arrowchat_disable_avatars_name").show();
- a(".arrowchat_chatboxmessage_wrapper").addClass("arrowchat_chatboxmessage_wrapper2");
- a(".arrowchat_chatboxmessagecontent").addClass("arrowchat_chatboxmessagecontent2");
- } else {
- a(".arrowchat_userlist_avatar").removeClass("arrowchat_hide_avatars");
- a(".arrowchat_chatroom_avatar").removeClass("arrowchat_hide_avatars");
- a(".arrowchat_chatroom_message_avatar").removeClass("arrowchat_hide_avatars");
- a(".arrowchat_chatbox_avatar").show();
- a(".arrowchat_disable_avatars_name").hide();
- a(".arrowchat_chatboxmessage_wrapper").removeClass("arrowchat_chatboxmessage_wrapper2");
- a(".arrowchat_chatboxmessagecontent").removeClass("arrowchat_chatboxmessagecontent2");
- }
- }
- function buildBuddyListTab() {
- var d = "";
- $buddy_list_tab = a("<div/>").attr("id", "arrowchat_buddy_list_tab").addClass("arrowchat_bar_button").addClass("arrowchat_bar_right").html(ArrowChat.Templates.buddylist_tab()).appendTo($base);
- $userstab_popup = a("<div/>").attr("id", "arrowchat_userstab_popup").addClass("arrowchat_tabpopup").css("display", "none").html(ArrowChat.Templates.buddylist_window(d, _ts, acp)).appendTo($body);
- a(".arrowchat_facebook_connect").append("<img style=\"position:relative;left:2px;top:1px\" src=\"" + c_ac_path + "themes/" + u_theme + "/images/img-facebook-icon.gif\" alt=\"Connect to Facebook\" /><span style=\"position:relative;top:-2px;left:5px;\"><a href=\"javascript:void(0);\">" + lang[140] + "</a></span>").mouseover(function() {
- a(this).addClass("arrowchat_facebook_connect_hover");
- }).mouseout(function() {
- a(this).removeClass("arrowchat_facebook_connect_hover");
- });
- a(".arrowchat_facebook_connect").click(function() {
- arrowchatdoLogin();
- return false;
- });
- if (c_disable_avatars == 1) {
- a("#arrowchat_name_box").hide();
- a("#arrowchat_setting_names_only").parent("li").hide();
- }
- $buddy_list_tab.css("width", c_width_blist + "px");
- if (c_width_blist <= 25) {
- a("#arrowchat_userstab_text").hide();
- }
- if (c_theme_change != 1) {
- a(".arrowchat_theme_button").hide();
- }
- a(".arrowchat_powered_by").css("display", "none");
- a(".arrowchat_search_friends_text").placeholder();
- if (u_sounds == 1) {
- a("#arrowchat_setting_sound :input").attr("checked", true);
- } else {
- a("#arrowchat_setting_sound").addClass("arrowchat_menu_unchecked");
- a("#arrowchat_setting_sound :input").attr("checked", false);
- }
- if (u_blist_open == 1) {
- a("#arrowchat_setting_window_open :input").attr("checked", true);
- } else {
- a("#arrowchat_setting_window_open").addClass("arrowchat_menu_unchecked");
- a("#arrowchat_setting_window_open :input").attr("checked", false);
- }
- if (u_no_avatars == 1) {
- a("#arrowchat_setting_names_only :input").attr("checked", true);
- } else {
- a("#arrowchat_setting_names_only").addClass("arrowchat_menu_unchecked");
- a("#arrowchat_setting_names_only :input").attr("checked", false);
- }
- u_is_guest == 1 && c_guest_name_change == 1 && u_guest_name == "" && a(".arrowchat_enter_name_wrapper").show();
- a("#arrowchat_guest_name_input").placeholder();
- a("#arrowchat_guest_name_input").keydown(function(h) {
- if (h.keyCode == 13) {
- a.post(c_ac_path + "includes/json/send/send_settings.php", {
- chat_name: a(this).val()
- }, function(data) {
- if (data != "1") {
- displayMessage("arrowchat_buddylist_message_flyout", data, "error");
- } else {
- a(".arrowchat_enter_name_wrapper").slideUp("fast");
- u_name = a(this).val();
- }
- });
- }
- });
- a(".arrowchat_search_friends_text").keyup(function() {
- a(".arrowchat_search_not_found").remove();
- var i = 1,
- e = true,
- l = "",
- f = a(this).val();
- if (f == "") {
- a(".arrowchat_userlist").each(function() {
- l = a(this).attr("id").substr(19);
- a("#arrowchat_userlist_" + l).removeClass("arrowchat_userlist_hover2").show();
- a("#arrowchat_userlist_" + l + " > span.arrowchat_userscontentname:icontains('" + f + "')").removeHighlight();
- });
- e = false;
- } else {
- a(".arrowchat_userlist").each(function() {
- l = a(this).attr("id").substr(19);
- if (a("#arrowchat_userlist_" + l + " > span.arrowchat_userscontentname:icontains('" + f + "')").length > 0) {
- a("#arrowchat_userlist_" + l).removeClass("arrowchat_userlist_hover2").show();
- i == 1 && a("#arrowchat_userlist_" + l).addClass("arrowchat_userlist_hover2");
- a("#arrowchat_userlist_" + l + " > span.arrowchat_userscontentname:icontains('" + f + "')").removeHighlight();
- a("#arrowchat_userlist_" + l + " > span.arrowchat_userscontentname:icontains('" + f + "')").highlight(f);
- e = false;
- i++;
- } else {
- a("#arrowchat_userlist_" + l).hide();
- }
- });
- }
- e && a("<div/>").attr("class", "arrowchat_search_not_found arrowchat_nofriends").html(lang[26]).prependTo("#arrowchat_userscontent");
- });
- a(document).bind("idle.idleTimer", function() {
- if (w != 1) {
- clearUserStatus();
- a("#arrowchat_userstab_icon").addClass("arrowchat_user_away2");
- setUserStatus("away");
- isAway = 1;
- }
- });
- a(document).bind("active.idleTimer", function() {
- if (w != 1) {
- clearUserStatus();
- setUserStatus("available");
- a("#arrowchat_userstab_icon").addClass("arrowchat_user_available2");
- isAway = 0;
- }
- });
- a.idleTimer(60000 * ArrowChat.IdleTime);
- a("#arrowchat_theme_button").click(function() {
- a("#arrowchat_theme_flyout").toggleClass("arrowchat_theme_flyout_display");
- a(".arrowchat_theme_link").addClass("arrowchat_theme_button_hover");
- a(".arrowchat_theme_link").toggleClass("arrowchat_more_button_selected");
- var theme_switch = a(".arrowchat_themeswitcher").val();
- a.post(c_ac_path + "includes/json/send/send_settings.php", {
- theme: theme_switch
- }, function(theme) {
- a("#arrowchat_css").attr({
- href: c_ac_path + "external.php?type=css&t=" + theme_switch
- });
- window.location.reload();
- });
- });
- a("#arrowchat_setting_sound").click(function() {
- a(this).toggleClass("arrowchat_menu_unchecked");
- if (a("#arrowchat_setting_sound :input").is(":checked")) {
- a("#arrowchat_setting_sound :input").attr("checked", false);
- _soundcheck = -1;
- u_sounds = 0;
- } else {
- a("#arrowchat_setting_sound :input").attr("checked", true);
- _soundcheck = 1;
- u_sounds = 1;
- }
- a.post(c_ac_path + "includes/json/send/send_settings.php", {
- sound: _soundcheck
- }, function() {});
- });
- a("#arrowchat_setting_window_open").click(function() {
- a(this).toggleClass("arrowchat_menu_unchecked");
- if (a("#arrowchat_setting_window_open :input").is(":checked")) {
- a("#arrowchat_setting_window_open :input").attr("checked", false);
- _windowcheck = -1;
- } else {
- a("#arrowchat_setting_window_open :input").attr("checked", true);
- _windowcheck = 1;
- }
- a.post(c_ac_path + "includes/json/send/send_settings.php", {
- window: _windowcheck
- }, function() {});
- });
- a("#arrowchat_setting_names_only").click(function() {
- a(this).toggleClass("arrowchat_menu_unchecked");
- if (a("#arrowchat_setting_names_only :input").is(":checked")) {
- a("#arrowchat_setting_names_only :input").attr("checked", false);
- setAvatarVisibility(0);
- _namecheck = -1;
- } else {
- a("#arrowchat_setting_names_only :input").attr("checked", true);
- setAvatarVisibility(1);
- _namecheck = 1;
- }
- a.post(c_ac_path + "includes/json/send/send_settings.php", {
- name: _namecheck
- }, function() {});
- });
- a("#arrowchat_setting_block_list").click(function() {
- a(this).parent().parent(".arrowchat_inner_menu").hide();
- a(".arrowchat_block_menu").show();
- a.ajax({
- url: c_ac_path + "includes/json/receive/receive_block_list.php",
- type: "get",
- cache: false,
- dataType: "json",
- success: function(b) {
- if (b && b != null) {
- a(".arrowchat_block_menu select").html("");
- a("<option/>").attr("value", "0").html(lang[118]).appendTo(a(".arrowchat_block_menu select"));
- a.each(b, function(e, l) {
- a.each(l, function(f, h) {
- a("<option/>").attr("value", h.id).html(h.username).appendTo(a(".arrowchat_block_menu select"));
- });
- });
- }
- }
- });
- });
- a("#arrowchat_unblock_button").click(function() {
- a(".arrowchat_panel_item").click();
- var unblock_chat_user = a(".arrowchat_block_menu select").val();
- if (unblock_chat_user != "0") {
- a.post(c_ac_path + "includes/json/send/send_settings.php", {
- unblock_chat: unblock_chat_user
- }, function() {
- if (typeof blockList[unblock_chat_user] != "undefined") {
- blockList.splice(unblock_chat_user, 1);
- }
- loadBuddyList();
- });
- }
- });
- a(".arrowchat_theme_link").mouseenter(function() {
- showTooltip(a(this), lang[94], 0, 10, 5);
- a(this).parent().addClass("arrowchat_theme_button_hover");
- a("#arrowchat_userstab_popup .arrowchat_userstabtitle").removeClass("arrowchat_chatboxtabtitlemouseover2");
- });
- a(".arrowchat_theme_link").mouseleave(function() {
- hideTooltip();
- a(this).parent().removeClass("arrowchat_theme_button_hover");
- a("#arrowchat_userstab_popup .arrowchat_userstabtitle").addClass("arrowchat_chatboxtabtitlemouseover2");
- });
- a(".arrowchat_theme_link").click(function() {
- hideTooltip();
- a("#arrowchat_userscontent").height() < 150 ? a("#arrowchat_theme_flyout").addClass("flyout_reversed") : a("#arrowchat_theme_flyout").removeClass("flyout_reversed");
- a("#arrowchat_theme_flyout").toggleClass("arrowchat_theme_flyout_display");
- a(this).addClass("arrowchat_theme_button_hover");
- a(this).toggleClass("arrowchat_more_button_selected");
- if (a(".arrowchat_panel_item").hasClass("arrowchat_more_button_selected")) {
- a(".arrowchat_panel_item").toggleClass("arrowchat_more_button_selected");
- a("#arrowchat_options_flyout").toggleClass("arrowchat_options_flyout_display");
- }
- });
- a(".arrowchat_panel_item").mouseenter(function() {
- showTooltip(a(this), lang[23], 0, 10, 5);
- a(this).parent().addClass("arrowchat_more_button_hover");
- a("#arrowchat_userstab_popup .arrowchat_userstabtitle").removeClass("arrowchat_chatboxtabtitlemouseover2");
- });
- a(".arrowchat_panel_item").mouseleave(function() {
- hideTooltip();
- a(this).parent().removeClass("arrowchat_more_button_hover");
- a("#arrowchat_userstab_popup .arrowchat_userstabtitle").addClass("arrowchat_chatboxtabtitlemouseover2");
- });
- a(".arrowchat_panel_item").click(function() {
- hideTooltip();
- a("#arrowchat_userscontent").height() < 150 ? a("#arrowchat_options_flyout").addClass("flyout_reversed") : a("#arrowchat_options_flyout").removeClass("flyout_reversed");
- a("#arrowchat_options_flyout").toggleClass("arrowchat_options_flyout_display");
- a(this).addClass("arrowchat_more_button_hover");
- a(this).toggleClass("arrowchat_more_button_selected");
- if (a(".arrowchat_theme_link").hasClass("arrowchat_more_button_selected")) {
- a(".arrowchat_theme_link").toggleClass("arrowchat_more_button_selected");
- a("#arrowchat_theme_flyout").toggleClass("arrowchat_theme_flyout_display");
- }
- a(".arrowchat_inner_menu").show();
- a(".arrowchat_block_menu").hide();
- });
- addHover(a(".arrowchat_menu_item"), "arrowchat_more_hover");
- a("#arrowchat_gooffline").click(function() {
- a(".arrowchat_panel_item").click();
- a(".arrowchat_userstabtitle").toggleClass("arrowchat_userstabtitle_button_click");
- pushCancelAll();
- cancelJSONP();
- a.idleTimer("destroy");
- clearTimeout(Z);
- if (j != "") {
- closePopup($user_popups[j], $users[j]);
- a(".arrowchat_closebox_bottom", $users[j]).removeClass("arrowchat_closebox_bottom_click");
- j = "";
- }
- a("#arrowchat_panel_options").removeClass("arrowchat_panel_hover");
- showUserOffline();
- a("#arrowchat_userstab_icon").addClass("arrowchat_user_invisible2");
- $chatboxes.hide();
- });
- a("#arrowchat_userstab_popup .arrowchat_userstabtitle").click(function() {
- $buddy_list_tab.click();
- }).children().not(".arrowchat_tab_name").click(function() {
- return false;
- });
- a("#arrowchat_userstab_popup .arrowchat_userstabtitle").mouseenter(function() {
- a(this).addClass("arrowchat_chatboxtabtitlemouseover2");
- });
- a("#arrowchat_userstab_popup .arrowchat_userstabtitle").mouseleave(function() {
- a(this).removeClass("arrowchat_chatboxtabtitlemouseover2");
- });
- $buddy_list_tab.mouseover(function() {
- if (c_width_blist <= 25) {
- if ($buddy_list_tab.hasClass("arrowchat_tabclick")) {} else {
- showTooltip($buddy_list_tab, lang[4]);
- }
- }
- a(this).addClass("arrowchat_tabmouseover");
- });
- $buddy_list_tab.mouseout(function() {
- a(this).removeClass("arrowchat_tabmouseover");
- hideTooltip();
- });
- $buddy_list_tab.click(function() {
- if (c_width_blist <= 25) {
- hideTooltip();
- }
- closePopup($chatrooms_popup, $chatrooms_button);
- if (w == 1 || bli == 1) {
- clearTimeout(Z);
- if (u_blist_open != 1) {
- loadBuddyList();
- }
- bli = 0;
- }
- if (w == 1) {
- w = 0;
- a("#arrowchat_userstab_text").html("<b>" + lang[4] + "</b> (<b>" + (R + jabberOnlineNumber) + "</b>)");
- receiveCore();
- pushSubscribe();
- a.idleTimer(60000 * ArrowChat.IdleTime);
- setUserStatus("available");
- a("#arrowchat_userstab_icon").addClass("arrowchat_user_available2");
- $chatboxes.show();
- }
- closePopup($optionsbutton_popup, $optionsbutton);
- $userstab_popup.css("left", $buddy_list_tab.offset().left - $userstab_popup.outerWidth() + $buddy_list_tab.outerWidth()).css("bottom", "25px");
- a(this).toggleClass("arrowchat_tabclick").toggleClass("arrowchat_userstabclick");
- $userstab_popup.toggleClass("arrowchat_tabopen");
- adjustBuddyListSize();
- });
- }
- function startPopoutChat() {
- pushCancelAll();
- cancelJSONP();
- a.idleTimer("destroy");
- clearTimeout(Z);
- $buddy_list_tab.hide();
- $popout_chat_button.show();
- $chatboxes.hide();
- $chatbox_right.hide();
- $chatbox_left.hide();
- closePopup($userstab_popup, $buddy_list_tab);
- closePopup($optionsbutton_popup, $optionsbutton);
- closePopup($chatrooms_popup, $chatrooms_button);
- if (j != "") {
- closePopup($user_popups[j], $users[j]);
- a(".arrowchat_closebox_bottom", $users[j]).removeClass("arrowchat_closebox_bottom_click");
- j = "";
- }
- a.post(c_ac_path + "includes/json/send/send_settings.php", {
- popoutchat: "1"
- }, function() {});
- }
- function adjustBuddyListSize() {
- var searchHeight = 0,
- nameHeight = 0,
- poweredHeight = 0;
- if (a("#arrowchat_search_friends").is(":visible")) {
- searchHeight = a("#arrowchat_search_friends").outerHeight();
- }
- if (a(".arrowchat_enter_name_wrapper").is(":visible")) {
- nameHeight = a(".arrowchat_enter_name_wrapper").outerHeight();
- }
- if (a(".arrowchat_powered_by").is(":visible")) {
- poweredHeight = a(".arrowchat_powered_by").outerHeight();
- }
- if (a(".arrowchat_facebook_connect").is(":visible")) {
- poweredHeight = poweredHeight + a(".arrowchat_facebook_connect").outerHeight();
- }
- if (a(window).outerHeight() - $userstab_popup.outerHeight() <= 70 && a("#arrowchat_userscontent").outerHeight() <= a("#arrowchat_userslist_available").outerHeight() + a("#arrowchat_userslist_away").outerHeight() + a("#arrowchat_facebook_friends").outerHeight(true) + a("#arrowchat_facebook_friends_list").outerHeight(true) + a("#arrowchat_site_users").outerHeight(true)) {
- a("#arrowchat_userscontent").css("height", a(window).outerHeight() - (94 + searchHeight + nameHeight + poweredHeight) + "px");
- } else {
- a("#arrowchat_userscontent").css("height", "auto");
- }
- }
- function adjustBarSize() {
- if (c_chat_maintenance != 1 && u_id != "") {
- if ($optionsbutton_popup !== undefined) {
- var d = 0;
- a(".arrowchat_notification_message_div").each(function() {
- d += parseInt(a(this).outerHeight()) + 5;
- });
- if (a(window).height() - $optionsbutton_popup.height() < 80 && a("#arrowchat_notifications_content").height() <= d) {
- a("#arrowchat_notifications_content").css("height", a(window).height() - 110 + "px");
- } else {
- a("#arrowchat_notifications_content").css("height", "auto");
- }
- }
- adjustBuddyListSize();
- }
- var b = a(window).width(),
- c = 0;
- $chatbox_right.hasClass("arrowchat_chatbox_lr") || (c = 19);
- for (d = 0; d < barLinks.length; d++) {
- c += a("#arrowchat_trayicon_" + d).outerWidth();
- }
- if ($optionsbutton !== undefined) {
- c += $optionsbutton.outerWidth();
- }
- if ($chatrooms_button !== undefined) {
- c += $chatrooms_button.outerWidth();
- }
- if (a("#arrowchat_hide_bar_button") !== undefined) {
- c += a("#arrowchat_hide_bar_button").outerWidth();
- }
- var i = 0;
- for (bha in apps) {
- if (apps[bha][12] != "1" && typeof $application_buttons[apps[bha][0]] != "undefined") {
- c += $application_buttons[apps[bha][0]].outerWidth();
- }
- }
- if ($applications_button !== undefined) {
- c += $applications_button.outerWidth();
- }
- if (c_no_apps_menu == 1) {
- c += 130;
- }
- if (barLinks.length > 0 && i > 0) {
- c += 30;
- }
- positionBar(c);
- if (c_chat_maintenance != 1 && u_id != "") {
- if ($chatboxes_wide.width() <= $base.width() - 250 - c) {
- $chatboxes.css("width", $chatboxes_wide.width());
- $chatboxes.scrollTo("0px", 0);
- } else {
- b = $chatboxes.width();
- var chatboxes_width_value = Math.floor(($base.width() - 250 - c) / 148) * 148;
- if (chatboxes_width_value < 148) {
- chatboxes_width_value = 148;
- }
- $chatboxes.css("width", chatboxes_width_value + "px");
- c = $chatboxes.width();
- b != c && $chatboxes.scrollTo("-=148px", 0);
- }
- c_notifications != 0 && $optionsbutton_popup.css("left", $optionsbutton.offset().left - $optionsbutton_popup.outerWidth() + $optionsbutton.outerWidth()).css("bottom", "25px");
- c_chatrooms != 0 && $chatrooms_popup.css("left", $chatrooms_button.offset().left - $chatrooms_popup.outerWidth() + $chatrooms_button.outerWidth()).css("bottom", "25px");
- if (typeof $applications_button_popup != "undefined") {
- c_applications_on != 0 && $applications_button_popup.css("left", $applications_button.offset().left).css("bottom", "25px");
- }
- $userstab_popup.css("left", $buddy_list_tab.offset().left - $userstab_popup.outerWidth() + $buddy_list_tab.outerWidth()).css("bottom", "25px");
- if (m != "") {
- $application_button_popups[m].css("left", $application_buttons[m].offset().left).css("bottom", "25px");
- }
- if (j != "") {
- if ($users[j].offset().left < $chatboxes.offset().left + $chatboxes.width() && $users[j].offset().left - $chatboxes.offset().left >= 0) {
- $user_popups[j].css("left", $users[j].offset().left - $user_popups[j].outerWidth() + $users[j].outerWidth()).css("bottom", "25px");
- } else {
- closePopup($user_popups[j], $users[j]);
- c = $users[j].offset().left - $chatboxes_wide.offset().left - (Math.floor($chatboxes.width() / 148) - 1) * 148;
- $chatboxes.scrollTo(c, 0, function() {
- if (typeof $users[j] != "undefined") {
- $users[j].click();
- }
- });
- }
- }
- positionTabAlerts();
- updateRightLastClasses();
- W && positionArrowchat();
- }
- if (c_mobile_device == 1) {
- mobileSupport();
- }
- }
- function positionBar(apps_tray_width) {
- var window_width = a(window).width();
- if (c_bar_fixed == 1) {
- $base.css("width", c_bar_fixed_width);
- if (c_bar_fixed_alignment == "left") {
- $base.css("left", c_bar_padding);
- }
- if (c_bar_fixed_alignment == "center") {
- var left_value = (window_width - c_bar_fixed_width) / 2;
- $base.css("left", left_value);
- }
- if (c_bar_fixed_alignment == "right") {
- var left_value = window_width - c_bar_fixed_width;
- $base.css("left", left_value - c_bar_padding);
- }
- } else {
- var check_width = parseInt(450) + parseInt(apps_tray_width) + parseInt(c_bar_padding * 2);
- if (window_width < check_width) {
- window_width = check_width;
- }
- $base.css("left", c_bar_padding + "px");
- $base.css("width", window_width - c_bar_padding * 2);
- }
- }
- function positionTabAlerts() {
- var $left = a(".arrowchat_tabalertlr", $chatbox_left);
- var $right = a(".arrowchat_tabalertlr", $chatbox_right);
- $left.html("0").css("display", "none");
- $right.html("0").css("display", "none");
- a(".arrowchat_tabalert").each(function() {
- if (a(this).parent().attr("id") != "arrowchat_chatrooms_button" && !a(this).parent().hasClass("arrowchat_apps_button")) {
- if (a(this).parent().offset().left < $chatboxes.offset().left + $chatboxes.width() && a(this).parent().offset().left - $chatboxes.offset().left >= 0) {
- a(this).css("display", "block");
- } else {
- a(this).css("display", "none");
- if (a(this).parent().offset().left - $chatboxes.offset().left >= 0) {
- var b = $chatbox_right.offset().left + $chatbox_right.width() - 30;
- $right.html(parseInt(a(".arrowchat_tabalertlr", $chatbox_right).html()) + parseInt(a(this).html())).css({
- display: "block",
- left: b
- });
- } else {
- b = $chatbox_left.offset().left + $chatbox_left.width() - 22;
- $left.html(parseInt(a(".arrowchat_tabalertlr", $chatbox_left).html()) + parseInt(a(this).html())).css({
- display: "block",
- left: b
- });
- }
- }
- }
- });
- }
- function updateRightLastClasses() {
- var b = 0,
- right_last = false,
- lr = false;
- if ($chatbox_right.hasClass("arrowchat_chatbox_right_last")) {
- right_last = true;
- }
- if ($chatbox_right.hasClass("arrowchat_chatbox_lr")) {
- lr = true;
- }
- if ($chatboxes.scrollLeft() == 0) {
- a(".arrowchat_tabtext", $chatbox_left).html("0");
- $chatbox_left.addClass("arrowchat_chatbox_left_last");
- a(".arrowchat_previous_tab").addClass("arrowchat_previous_tab_last");
- b++;
- } else {
- var i = Math.floor($chatboxes.scrollLeft() / 148);
- a(".arrowchat_tabtext", $chatbox_left).html(i);
- $chatbox_left.removeClass("arrowchat_chatbox_left_last");
- a(".arrowchat_previous_tab").removeClass("arrowchat_previous_tab_last");
- }
- if ($chatboxes.scrollLeft() + $chatboxes.width() == $chatboxes_wide.width()) {
- a(".arrowchat_tabtext", $chatbox_right).html("0");
- $chatbox_right.addClass("arrowchat_chatbox_right_last");
- a(".arrowchat_next_tab").addClass("arrowchat_next_tab_last");
- b++;
- } else {
- i = Math.floor(($chatboxes_wide.width() - ($chatboxes.scrollLeft() + $chatboxes.width())) / 148);
- a(".arrowchat_tabtext", $chatbox_right).html(i);
- $chatbox_right.removeClass("arrowchat_chatbox_right_last");
- a(".arrowchat_next_tab").removeClass("arrowchat_next_tab_last");
- }
- if (b == 2) {
- $chatbox_right.addClass("arrowchat_chatbox_lr");
- $chatbox_left.addClass("arrowchat_chatbox_lr");
- } else {
- $chatbox_right.removeClass("arrowchat_chatbox_lr");
- $chatbox_left.removeClass("arrowchat_chatbox_lr");
- }
- if (!$chatbox_right.hasClass("arrowchat_chatbox_right_last") && right_last || $chatbox_right.hasClass("arrowchat_chatbox_right_last") && !right_last || !$chatbox_right.hasClass("arrowchat_chatbox_lr") && lr || $chatbox_right.hasClass("arrowchat_chatbox_lr") && !lr) {
- adjustBarSize();
- }
- }
- function scrollChatboxes(b) {
- if (j != "") {
- closePopup($user_popups[j], $users[j]);
- }
- a(".arrowchat_tabalert").css("display", "none");
- var c = 100;
- if (get("initialize") == 1) {
- c = 0;
- }
- $chatboxes.scrollTo(b, c, function() {
- if (j != "") {
- if ($users[j].offset().left < $chatboxes.offset().left + $chatboxes.width() && $users[j].offset().left - $chatboxes.offset().left >= 0) {
- $users[j].click();
- } else {
- j = "";
- }
- }
- positionTabAlerts();
- updateRightLastClasses();
- });
- }
- function set(b, c) {
- V[b] = c;
- }
- function get(b) {
- return V[b] ? V[b] : "";
- }
- function getStatus(b) {
- return xa[b] ? xa[b] : "";
- }
- function receiveUserFromUserlist(b) {
- if (a(b).attr("id")) {
- var c = a(b).attr("id").substr(19);
- } else {
- var c = "";
- }
- if (c == "") {
- c = a(b).parent().attr("id").substr(19);
- }
- receiveUser(c, uc_name[c], uc_status[c], uc_avatar[c], uc_link[c]);
- }
- function chatroomListClicked(b) {
- if ($chatroom_create_flyout.is(":visible")) {
- $chatroom_create_flyout.hide("slide", {
- direction: "up"
- }, 250);
- }
- c = "";
- if (a(b).attr("id")) {
- c = a(b).attr("id").substr(19);
- }
- if (c == "") {
- c = a(b).parent().attr("id").substr(19);
- }
- if (crt[c] == 2) {
- a("#arrowchat_chatroom_password_id").val(c);
- if (a("#arrowchat_chatroom_" + c).hasClass("arrowchat_chatroom_clicked")) {
- a("#arrowchat_chatroom_password_flyout").hide("slide", {
- direction: "up"
- }, 250);
- a(".arrowchat_chatroom_list").removeClass("arrowchat_chatroom_clicked");
- } else {
- a(".arrowchat_chatroom_list").removeClass("arrowchat_chatroom_clicked");
- a("#arrowchat_chatroom_" + c).addClass("arrowchat_chatroom_clicked");
- if (!a("#arrowchat_chatroom_password_flyout").is(":visible")) {
- a("#arrowchat_chatroom_password_flyout").show("slide", {
- direction: "up"
- }, 250, function() {
- a("#arrowchat_chatroom_password_input").focus();
- });
- } else {
- a("#arrowchat_chatroom_password_flyout").hide("slide", {
- direction: "up"
- }, 250);
- a("#arrowchat_chatroom_password_flyout").show("slide", {
- direction: "up"
- }, 250, function() {
- a("#arrowchat_chatroom_password_input").focus();
- });
- }
- }
- } else {
- a(".arrowchat_chatroom_full_content").html("<div class=\"arrowchat_nofriends\">" + lang[34] + "</div>");
- if (a("#arrowchat_chatroom_password_flyout").is(":visible")) {
- a("#arrowchat_chatroom_password_flyout").hide("slide", {
- direction: "up"
- }, 250);
- }
- $chatroom_create.hide();
- Ccr = c;
- loadChatroom(c, crt[c]);
- }
- }
- function addMessageToChatroom(b, c, d) {
- var title = "";
- if (chatroom_mod == 1) {
- title = lang[137];
- }
- if (chatroom_admin == 1) {
- title = lang[136];
- }
- d = d.replace(/</g, "<").replace(/>/g, ">").replace(/\n/g, "<br>").replace(/\"/g, """);
- d = replaceURLWithHTMLLinks(d);
- d = smileyreplace(d);
- if (a("#arrowchat_chatroom_message_" + b).length > 0) {
- a("#arrowchat_chatroom_message_" + b + " .arrowchat_chatroom_message_content").html(formatTimestamp(new Date(Math.floor((new Date).getTime() / 1000) * 1000)) + d);
- } else {
- $chatroom_chat.append("<div class=\"arrowchat_chatroom_box_message\" id=\"arrowchat_chatroom_message_" + b + "\"><img class=\"arrowchat_chatroom_message_avatar\" src=\"" + u_avatar + "\" alt=\"\" /><div class=\"arrowchat_chatroom_message_name\">" + c + title + ":</div><div class=\"arrowchat_chatroom_message_content arrowchat_self\">" + formatTimestamp(new Date(Math.floor((new Date).getTime() / 1000) * 1000)) + d + "</div></div>");
- $chatroom_chat.scrollTop(50000);
- }
- showChatroomTime();
- }
- function addMessageToChatbox(b, c, d, i, e, l, f) {
- aa[b] != 1 && receiveUser(b, uc_name[b], uc_status[b], uc_avatar[b], uc_link[b], 1, 1);
- if (uc_name[b] == null || uc_name[b] == "") {
- setTimeout(function() {
- addMessageToChatbox(b, c, d, i, e, l, f);
- }, 500);
- } else {
- var h = "",
- init = false;
- if (parseInt(d) == 1) {
- fromname = u_name;
- fromid = u_id;
- h = " arrowchat_self";
- avatar = u_avatar;
- tooltip = lang[90];
- } else {
- fromname = uc_name[b];
- fromid = b;
- avatar = uc_avatar[b];
- tooltip = fromname;
- }
- var full_name = fromid;
- if (parseInt(l) == 1) {
- c = c.replace(/</g, "<").replace(/>/g, ">").replace(/\n/g, "<br>").replace(/\"/g, """);
- }
- c = replaceURLWithHTMLLinks(c);
- c = smileyreplace(c);
- d != 1 && u_sounds == 1 && !a(".arrowchat_textarea", $user_popups[b]).is(":focus") && playNewMessageSound();
- separator = ": ";
- if (a("#arrowchat_message_" + e).length > 0) {
- a("#arrowchat_message_" + e + " .arrowchat_chatboxmessagecontent").html(c);
- } else {
- if (c_show_full_name != "1") {
- if (fromname.indexOf(" ") != -1) {
- fromname = fromname.slice(0, fromname.indexOf(" "));
- }
- }
- if (uc_status[b] == "offline" && d != 1) {
- displayMessage("arrowchat_chatbox_message_flyout_" + b, lang[13], "error");
- }
- if (f - last_sent[b] > 60 || last_sent[b] == null || last_name[b] != full_name || last_name[b] == null || last_name[b] == "") {
- a(".arrowchat_tabcontenttext", $user_popups[b]).append("<div class=\"arrowchat_chatboxmessage arrowchat_clearfix\" id=\"arrowchat_message_" + e + "\"><div class=\"arrowchat_chatboxmessagefrom" + h + "\"><div class=\"arrowchat_disable_avatars_name\">" + fromname + "</div><img alt=\"" + tooltip + "\" class=\"arrowchat_chatbox_avatar\" src=\"" + avatar + "\" /></div><div class=\"arrowchat_chatboxmessage_wrapper\"><div class=\"arrowchat_chatboxmessagecontent" + h + "\">" + formatTimestamp(new Date(f * 1000)) + c + "</div></div></div>");
- last_sent[b] = f;
- last_name[b] = full_name;
- last_id[b] = e;
- } else {
- if (last_id[b] !== "undefined") {
- a("#arrowchat_message_" + last_id[b]).append("<div id=\"arrowchat_message_" + e + "\" class=\"arrowchat_chatboxmessagecontent" + h + "\">" + c + "</div>");
- } else {
- a(".arrowchat_tabcontenttext", $user_popups[b]).append("<div id=\"arrowchat_message_" + e + "\" class=\"arrowchat_chatboxmessagecontent" + h + "\">" + c + "</div>");
- }
- }
- if (c_disable_avatars == 1 || a("#arrowchat_setting_names_only :input").is(":checked")) {
- setAvatarVisibility(1);
- }
- a("#arrowchat_tabcontenttext_" + b).scrollTop(50000);
- showTimeAndTooltip();
- }
- j != b && d != 1 && i != 1 && notifyNewMessage(b, 1, 1);
- d != 1 && showDesktopNotification(b, c, e);
- }
- }
- function activateUser(b) {
- if (uc_name[b] == null || uc_name[b] == "") {
- setTimeout(function() {
- activateUser(b);
- }, 500);
- } else {
- j != b && $users[b].click();
- }
- }
- function addMessageToContent(b, c) {
- if (uc_name[b] == null || uc_name[b] == "") {
- setTimeout(function() {
- addMessageToContent(b, c);
- }, 500);
- } else {
- a("#arrowchat_tabcontenttext_" + b).append("<div>" + c + "</div>");
- a("#arrowchat_tabcontenttext_" + b).scrollTop(50000);
- G[b] = 1;
- }
- }
- function loadChatroomList() {
- if (chatroomreceived == 0) {
- a("#arrowchat_chatroom_leave").hide();
- a(".arrowchat_chatroom_popout").hide();
- a.ajax({
- url: c_ac_path + "includes/json/receive/receive_chatroom_list.php",
- cache: false,
- data: {
- chatroom_window: u_chatroom_open,
- chatroom_stay: u_chatroom_stay
- },
- type: "post",
- dataType: "json",
- success: function(b) {
- buildChatroomList(b);
- }
- });
- }
- }
- function buildChatroomList(b) {
- Ccr = 0;
- a(".arrowchat_chatroom_full_content").html("");
- var c = {};
- b && a.each(b, function(i, e) {
- if (i == "chatrooms") {
- a.each(e, function(l, f) {
- a("<div/>").attr("id", "arrowchat_chatroom_" + f.id).mouseover(function() {
- a(this).addClass("arrowchat_chatroom_list_hover");
- }).mouseout(function() {
- a(this).removeClass("arrowchat_chatroom_list_hover");
- }).addClass("arrowchat_chatroom_list").html("<span class=\"arrowchat_chatroom_name\">" + f.n + "</span><span class=\"arrowchat_chatroom_status arrowchat_chatroom_" + f.t + "\"></span><span class=\"arrowchat_chatroom_count\">" + f.c + lang[35] + "</span>").appendTo(a(".arrowchat_chatroom_full_content"));
- crt[f.id] = f.t;
- crt2[f.id] = f.n;
- });
- }
- });
- chatroomreceived = 1;
- a(".arrowchat_chatroom_list").click(function(l) {
- chatroomListClicked(l.target);
- });
- }
- function receiveChatroom(c) {
- var global_mod = 0,
- global_admin = 0,
- admin_markup = "";
- chatroom_mod = 0;
- chatroom_admin = 0;
- if (Ccr == c) {
- a.ajax({
- url: c_ac_path + "includes/json/receive/receive_chatroom.php",
- cache: false,
- type: "post",
- data: {
- chatroomid: c
- },
- dataType: "json",
- success: function(b) {
- if (b) {
- var no_error = true;
- b && a.each(b, function(i, e) {
- if (i == "error") {
- a.each(e, function(l, f) {
- no_error = false;
- Ccr = 0;
- chatroomreceived = 0;
- loadChatroomList();
- displayMessage("arrowchat_chatroom_message_flyout", f.m, "error");
- });
- }
- });
- if (no_error) {
- b && a.each(b, function(i, e) {
- if (i == "user_title") {
- a.each(e, function(l, f) {
- if (f.admin == 1) {
- global_admin = 1;
- chatroom_admin = 1;
- }
- if (f.mod == 1) {
- global_mod = 1;
- chatroom_mod = 1;
- }
- });
- }
- if (i == "chat_users") {
- var longname;
- $chatroom_room_list.html("");
- a.each(e, function(l, f) {
- if ((global_admin == 1 || global_mod == 1) && f.t == 1) {
- admin_markup = "<div class=\"arrowchat_chatroom_options_padding\"><div id=\"arrowchat_chatroom_make_mod_" + f.id + "\" class=\"arrowchat_chatroom_flyout_text\">" + lang[52] + "</div></div><div class=\"arrowchat_chatroom_options_padding\"><div id=\"arrowchat_chatroom_ban_user_" + f.id + "\" class=\"arrowchat_chatroom_flyout_text\">" + lang[53] + "</div></div>";
- }
- longname = renderHTMLString(f.n);
- f.n = renderHTMLString(f.n).length > 16 ? renderHTMLString(f.n).substr(0, 16) + "..." : f.n;
- a("<div/>").attr("id", "arrowchat_chatroom_user_" + f.id).mouseover(function() {
- a(this).addClass("arrowchat_chatroom_list_hover");
- }).mouseout(function() {
- a(this).removeClass("arrowchat_chatroom_list_hover");
- }).addClass("arrowchat_chatroom_room_list").addClass("arrowchat_chatroom_admin_" + f.t).html("<img class=\"arrowchat_chatroom_avatar\" src=\"" + f.a + "\"/><span class=\"arrowchat_chatroom_room_name\">" + f.n + "</span><span class=\"arrowchat_userscontentdot arrowchat_" + f.status + "\"></span>").appendTo($chatroom_room_list);
- a("<div/>").attr("id", "arrowchat_chatroom_users_flyout_" + f.id).addClass("arrowchat_chatroom_users_flyout").html("<div class=\"arrowchat_chatroom_title_padding\"><div id=\"arrowchat_chatroom_title_" + f.id + "\" class=\"arrowchat_chatroom_flyout_text\">" + longname + "<br/>" + lang[43] + "</div></div><hr class=\"arrowchat_options_divider\"/><div class=\"arrowchat_chatroom_options_padding\"><div id=\"arrowchat_chatroom_visit_profile_" + f.id + "\" class=\"arrowchat_chatroom_flyout_text\">" + lang[42] + "</div></div><div class=\"arrowchat_chatroom_options_padding\"><div id=\"arrowchat_chatroom_private_message_" + f.id + "\" class=\"arrowchat_chatroom_flyout_text\">" + lang[41] + "</div></div><div class=\"arrowchat_chatroom_options_padding\"><div id=\"arrowchat_chatroom_block_user_" + f.id + "\" class=\"arrowchat_chatroom_flyout_text\">" + lang[84] + "</div></div>" + admin_markup).appendTo(a("#arrowchat_chatroom_user_" + f.id));
- if (f.t == 2) {
- a("#arrowchat_chatroom_title_" + f.id).html(longname + "<br/>" + lang[44]);
- } else if (f.t == 3) {
- a("#arrowchat_chatroom_title_" + f.id).html(longname + "<br/>" + lang[45]);
- }
- addHover(a(".arrowchat_chatroom_options_padding"), "arrowchat_options_padding_hover");
- chatroomUserOptions(f, global_admin);
- uc_avatar[f.id] = f.a;
- });
- a(".arrowchat_chatroom_admin_3").css("background-color", "#" + c_admin_bg);
- a(".arrowchat_chatroom_admin_3").css("color", "#" + c_admin_txt);
- }
- });
- if (c_disable_avatars == 1 || a("#arrowchat_setting_names_only :input").is(":checked")) {
- a(".arrowchat_chatroom_avatar").addClass("arrowchat_hide_avatars");
- a(".arrowchat_chatroom_message_avatar").addClass("arrowchat_hide_avatars");
- }
- }
- }
- }
- });
- clearTimeout(Crref2);
- Crref2 = setTimeout(function() {
- receiveChatroom(c);
- }, 60000);
- }
- }
- function chatroomUserOptions(data, is_admin) {
- a("#arrowchat_chatroom_make_mod_" + data.id).click(function() {
- a.post(c_ac_path + "includes/json/send/send_settings.php", {
- chatroom_mod: data.id,
- chatroom_id: Ccr
- }, function() {});
- });
- a("#arrowchat_chatroom_remove_mod_" + data.id).click(function() {
- a.post(c_ac_path + "includes/json/send/send_settings.php", {
- chatroom_remove_mod: data.id,
- chatroom_id: Ccr
- }, function() {});
- });
- a("#arrowchat_chatroom_block_user_" + data.id).click(function() {
- a.post(c_ac_path + "includes/json/send/send_settings.php", {
- block_chat: data.id
- }, function(json_data) {
- if (json_data != "-1") {
- if (typeof blockList[data.id] == "undefined") {
- blockList[data.id] = data.id;
- }
- loadBuddyList();
- displayMessage("arrowchat_chatroom_message_flyout", lang[103], "error");
- }
- });
- });
- a("#arrowchat_chatroom_ban_user_" + data.id).click(function() {
- var ban_length = prompt(lang[57]);
- if (ban_length != null && ban_length != "" && !isNaN(ban_length)) {
- a.post(c_ac_path + "includes/json/send/send_settings.php", {
- chatroom_ban: data.id,
- chatroom_id: Ccr,
- chatroom_ban_length: ban_length
- }, function() {});
- }
- });
- a("#arrowchat_chatroom_visit_profile_" + data.id).click(function() {
- window.location = data.l;
- });
- a("#arrowchat_chatroom_private_message_" + data.id).click(function() {
- if (data.b != 1 || is_admin == 1) {
- if (u_id != data.id) {
- jqac.arrowchat.chatWith(data.id);
- }
- } else {
- displayMessage("arrowchat_chatroom_message_flyout", lang[46], "error");
- }
- });
- a("#arrowchat_chatroom_user_" + data.id).click(function() {
- if (crou != data.id) {
- a("#arrowchat_chatroom_user_" + crou).removeClass("arrowchat_chatroom_clicked");
- a("#arrowchat_chatroom_users_flyout_" + crou).removeClass("arrowchat_chatroom_create_flyout_display");
- }
- crou = data.id;
- a(this).toggleClass("arrowchat_chatroom_clicked");
- a("#arrowchat_chatroom_users_flyout_" + data.id).toggleClass("arrowchat_chatroom_create_flyout_display");
- });
- }
- function loadBuddyList() {
- clearTimeout(Z);
- a.ajax({
- url: c_ac_path + "includes/json/receive/receive_buddylist.php",
- cache: false,
- type: "get",
- dataType: "json",
- success: function(b) {
- buildBuddyList(b);
- if (c_disable_avatars == 1) {
- a(".arrowchat_userlist_avatar").addClass("arrowchat_hide_avatars");
- }
- adjustBuddyListSize();
- adjustBarSize();
- }
- });
- if (typeof c_list_heart_beat != "undefined") {
- var BLHT = c_list_heart_beat * 1000;
- } else {
- var BLHT = 60000;
- }
- Z = setTimeout(function() {
- loadBuddyList();
- }, BLHT);
- }
- function buildBuddyList(b) {
- V.timestamp = ma;
- var c = {},
- d = "";
- c.available = "";
- c.busy = "";
- c.offline = "";
- c.invisible = "";
- c.away = "";
- onlineNumber = buddylistreceived = 0;
- b && a.each(b, function(i, e) {
- if (i == "buddylist") {
- buddylistreceived = 1;
- totalFriendsNumber = onlineNumber = 0;
- a.each(e, function(l, f) {
- longname = renderHTMLString(f.n).length > 16 ? renderHTMLString(f.n).substr(0, 16) + "..." : f.n;
- if (G[f.id] != null) {
- a(".arrowchat_closebox_bottom_status", $users[f.id]).removeClass("arrowchat_available").removeClass("arrowchat_busy").removeClass("arrowchat_offline").removeClass("arrowchat_away").addClass("arrowchat_" + f.s);
- $users[f.id].removeClass("arrowchat_tab_offline").removeClass("arrowchat_away").addClass("arrowchat_tab_" + f.s);
- $user_popups[f.id].length > 0 && a(".arrowchat_tabsubtitle .arrowchat_message", $user_popups[f.id]).html(f.m);
- }
- if (f.s == "available" || f.s == "away" || f.s == "busy") {
- onlineNumber++;
- }
- totalFriendsNumber++;
- if (a("#arrowchat_setting_names_only :input").is(":checked")) {
- d = "arrowchat_hide_avatars";
- }
- c[f.s] += "<div id=\"arrowchat_userlist_" + f.id + "\" class=\"arrowchat_userlist arrowchat_buddylist_admin_" + f.admin + "\" onmouseover=\"jqac(this).addClass('arrowchat_userlist_hover');\" onmouseout=\"jqac(this).removeClass('arrowchat_userlist_hover');\"><img class=\"arrowchat_userlist_avatar " + d + "\" src=\"" + f.a + "\" /><span class=\"arrowchat_userscontentname\">" + longname + "</span><span class=\"arrowchat_userscontentdot arrowchat_" + f.s + "\"></span></div>";
- uc_status[f.id] = f.s;
- uc_name[f.id] = f.n;
- uc_avatar[f.id] = f.a;
- uc_link[f.id] = f.l;
- });
- }
- if (buddylistreceived == 1 && bli == 0) {
- for (buddystatus in c) {
- if (c.hasOwnProperty(buddystatus)) {
- if (c[buddystatus] == "") {
- a("#arrowchat_userslist_" + buddystatus).html("");
- } else {
- a("#arrowchat_userslist_" + buddystatus).html("<div>" + c[buddystatus] + "</div>");
- }
- }
- }
- a(".arrowchat_userlist").click(function(l) {
- if (!a(this).hasClass("arrowchat_jabber_user")) {
- receiveUserFromUserlist(l.target);
- }
- });
- a("#arrowchat_userstab_text").html("<b>" + lang[4] + "</b> (<b>" + (onlineNumber + jabberOnlineNumber) + "</b>)");
- R = onlineNumber;
- totalFriendsNumber == 0 && a("#arrowchat_userslist_available").html("<div class=\"arrowchat_nofriends\">" + lang[8] + "</div>");
- R == 0 && a("#arrowchat_userslist_available").html("<div class=\"arrowchat_nofriends\">" + lang[8] + "</div>");
- R >= c_search_min ? a("#arrowchat_search_friends").show() : a("#arrowchat_search_friends").hide();
- buddylistreceived = 0;
- } else {
- a("#arrowchat_userstab_text").html("<b>" + lang[4] + "</b> (<b>" + (onlineNumber + jabberOnlineNumber) + "</b>)");
- }
- a(".arrowchat_buddylist_admin_1").css("background-color", "#" + c_admin_bg);
- a(".arrowchat_buddylist_admin_1").css("color", "#" + c_admin_txt);
- });
- }
- function cancelJSONP() {
- if (typeof CHA != "undefined") {
- clearTimeout(CHA);
- }
- if (typeof xOptions != "undefined") {
- xOptions.abort();
- }
- }
- function receiveCore() {
- cancelJSONP();
- var url = c_ac_path + "includes/json/receive/receive_core.php?hash=" + u_hash_id + "&init=" + acsi + "&room=" + Ccr;
- xOptions = a.ajax({
- url: url,
- dataType: "jsonp",
- success: function(b) {
- V.timestamp = ma;
- var c = "",
- d = {};
- d.available = "";
- d.busy = "";
- d.offline = "";
- d.away = "";
- onlineNumber = buddylistreceived = 0;
- if (b && b != null) {
- var i = 0;
- a.each(b, function(e, l) {
- if (e == "typing") {
- a.each(l, function(f, h) {
- if (h.is_typing == "1") {
- receiveTyping(h.typing_id);
- } else {
- receiveNotTyping(h.typing_id);
- }
- });
- }
- if (e == "announcements") {
- a.each(l, function(f, h) {
- receiveAnnouncement(h);
- });
- }
- if (e == "chatroom") {
- var d1 = 0,
- d2 = "";
- a.each(l, function(f, h) {
- if (typeof blockList[h.userid] == "undefined") {
- addChatroomMessage(h.id, h.n, h.m, h.userid, h.t, h.global, h.mod, h.admin);
- }
- d2 = h;
- d1++;
- });
- if (typeof d2 != "undefined") {
- if (typeof blockList[d2.userid] == "undefined") {
- showChatroomTime();
- chatroomAlerts(d1);
- if (d2.userid != u_id) {
- u_chatroom_sound == 1 && !a(".arrowchat_chatroom_message_input").is(":focus") && playNewMessageSound();
- }
- }
- }
- }
- if (e == "notifications") {
- var markup2 = "";
- a.each(l, function(f, h) {
- addNotification(h.alert_id, h.markup);
- markup2 = h.markup;
- });
- notificationAlerts(markup2);
- }
- if (e == "messages") {
- var play_sound = 0;
- a.each(l, function(f, h) {
- receiveMessage(h.id, h.from, h.message, h.sent, h.self, h.old);
- if (!a(".arrowchat_textarea", $user_popups[h.from]).is(":focus")) {
- play_sound = 1;
- }
- });
- K = 1;
- D = E;
- j != "" && i > 0 && addMessageToContent(j, c);
- showTimeAndTooltip();
- d != 1 && u_sounds == 1 && play_sound == 1 && acsi != 1 && playNewMessageSound();
- }
- });
- }
- set("initialize", "0");
- set("currenttime", "0");
- if ($ != 1 && w != 1) {
- K++;
- if (K > 4) {
- D *= 2;
- K = 1;
- }
- if (D > 12000) {
- D = 12000;
- }
- }
- acsi++;
- }
- });
- if (isAway == 1) {
- var CHT = c_heart_beat * 1000 * 3;
- } else {
- var CHT = c_heart_beat * 1000;
- }
- if (c_push_engine != 1) {
- CHA = setTimeout(function() {
- receiveCore();
- }, CHT);
- }
- }
- function addChatroomMessage(id, name, message, userid, sent, global, mod, admin) {
- if (userid == u_id) {
- uc_avatar[u_id] = u_avatar;
- }
- message = stripslashes(message);
- message = replaceURLWithHTMLLinks(message);
- var sent_time = new Date(sent * 1000);
- if (typeof uc_avatar[userid] == "undefined") {
- a.ajax({
- url: c_ac_path + "includes/json/receive/receive_user.php",
- data: {
- userid: userid
- },
- type: "post",
- cache: false,
- dataType: "json",
- success: function(data) {
- if (data) {
- uc_avatar[userid] = data.a;
- chatroomDiv(id, uc_avatar[userid], name, sent_time, message, global, mod, admin);
- }
- }
- });
- } else {
- chatroomDiv(id, uc_avatar[userid], name, sent_time, message, global, mod, admin);
- }
- count++;
- }
- function chatroomDiv(id, image, name, time, message, global, mod, admin) {
- var container = $chatroom_chat[0].scrollHeight - $chatroom_chat.scrollTop() - 10;
- var container2 = $chatroom_chat.outerHeight();
- var title = "";
- if (mod == 1) {
- title = lang[137];
- }
- if (admin == 1) {
- title = lang[136];
- }
- if (a("#arrowchat_chatroom_message_" + id).length > 0) {} else {
- if (global == 1) {
- a("<div/>").attr("id", "arrowchat_chatroom_message_" + id).addClass("arrowchat_chatroom_box_message").html("<div class=\"arrowchat_chatroom_message_content arrowchat_global_chatroom_message\">" + formatTimestamp(time) + message + "</div>").appendTo($chatroom_chat);
- } else {
- a("<div/>").attr("id", "arrowchat_chatroom_message_" + id).addClass("arrowchat_chatroom_box_message").html("<img class=\"arrowchat_chatroom_message_avatar\" src=\"" + image + "\" alt=\"\" /><div class=\"arrowchat_chatroom_message_name\">" + name + title + ":</div><div class=\"arrowchat_chatroom_message_content\">" + formatTimestamp(time) + message + "</div>").appendTo($chatroom_chat);
- }
- }
- if (c_disable_avatars == 1 || a("#arrowchat_setting_names_only :input").is(":checked")) {
- a(".arrowchat_chatroom_message_avatar").addClass("arrowchat_hide_avatars");
- }
- if (container <= container2) {
- $chatroom_chat.scrollTop(50000);
- } else {
- displayMessage("arrowchat_chatroom_message_flyout", lang[134], "notice");
- }
- showChatroomTime();
- }
- function chatroomAlerts(count) {
- if (a("#arrowchat_chatrooms_button .arrowchat_tabalert").length > 0 && count > 0) {
- var count2 = parseInt(a("#arrowchat_chatrooms_button .arrowchat_tabalert").html()) + count;
- a("#arrowchat_chatrooms_button .arrowchat_tabalert").html(count2);
- if (bounce2 == 1) {
- bounce2 = 0;
- a("#arrowchat_chatrooms_button .arrowchat_tabalert").stop(true, true).effect("bounce", {
- times: 3,
- distance: 5
- }, 200, function() {
- bounce2 = 1;
- });
- }
- } else if (!$chatrooms_button.hasClass("arrowchat_tabclick")) {
- $chatrooms_button.addClass("arrowchat_tab_new_message");
- a("<div/>").css("top", "-11px").css("left", c_width_chatroom - 10 + "px").addClass("arrowchat_tabalert").html(count).appendTo($chatrooms_button);
- }
- }
- function receiveAnnouncement(h) {
- if (h.read == 0 && h.data != "") {
- a("#arrowchat_announcement").remove();
- $body.append(ArrowChat.Templates.announcements_display(h));
- a("#arrowchat_announcement .arrowchat_announce_close").click(function() {
- a("#arrowchat_announcement").remove();
- a.post(c_ac_path + "includes/json/send/send_settings.php", {
- announce: 1
- }, function() {});
- });
- } else {
- a("#arrowchat_announcement").remove();
- }
- }
- function addNotification(alert_id, markup) {
- a("<div/>").attr("id", "arrowchat_alert_" + alert_id).attr("class", "arrowchat_notification_message_div").html(markup).appendTo(a("#arrowchat_notifications_content"));
- Q++;
- }
- function notificationAlerts(markup) {
- a("#arrowchat_optionsbutton .arrowchat_tabalertnf").remove();
- if (!$optionsbutton.hasClass("arrowchat_tabclick")) {
- if (a("#arrowchat_notification_alert").length > 0) {
- a("#arrowchat_notification_alert").remove();
- }
- $body.append("<div id=\"arrowchat_notification_alert\"><div class=\"arrowchat_notification_alert_content\">" + markup + "</div></div>");
- a("#arrowchat_notification_alert .arrowchat_notifications_divider").hide();
- setTimeout(function() {
- a("#arrowchat_notification_alert").fadeOut("slow", function() {
- a("#arrowchat_notification_alert").remove();
- });
- }, 7000);
- $optionsbutton.addClass("arrowchat_tab_new_message");
- a("<div/>").css("top", "-10px").css("left", "8px").addClass("arrowchat_tabalertnf").html(Q).prependTo($optionsbutton);
- }
- if (Q > 0) {
- a("#arrowchat_no_new_notifications").css("display", "none");
- }
- }
- function stripslashes(str) {
- str = str.replace(/\\'/g, "'");
- str = str.replace(/\\"/g, "\"");
- str = str.replace(/\\0/g, "\x00");
- str = str.replace(/\\\\/g, "\\");
- return str;
- }
- function receiveMessage(id, from, message, sent, self, old) {
- ma = id;
- clearTimeout(dtit3);
- DTitChange(uc_name[from]);
- if (j == from && uc_name[from] != "" && uc_name[from] != null) {
- var container = a("#arrowchat_tabcontenttext_" + from)[0].scrollHeight - a("#arrowchat_tabcontenttext_" + from).scrollTop() - 10;
- var container2 = a("#arrowchat_tabcontenttext_" + from).outerHeight();
- var o = uc_name[from];
- if (uc_status[from] == "offline") {
- loadBuddyList();
- }
- f = "";
- if (self == 1) {
- fromname = u_name;
- fromid = u_id;
- f = " arrowchat_self";
- avatar = u_avatar;
- tooltip = lang[90];
- } else {
- DTitChange(uc_name[from]);
- fromname = o;
- fromid = from;
- avatar = uc_avatar[from];
- tooltip = fromname;
- }
- var full_name = fromid;
- message = stripslashes(message);
- message = replaceURLWithHTMLLinks(message);
- if (a("#arrowchat_message_" + id).length > 0) {
- a("#arrowchat_message_" + id + " .arrowchat_chatboxmessagecontent").html(message);
- } else {
- if (c_show_full_name != 1) {
- if (fromname.indexOf(" ") != -1) {
- fromname = fromname.slice(0, fromname.indexOf(" "));
- }
- }
- if (sent - last_sent[from] > 60 || last_sent[from] == null || last_name[from] != full_name) {
- a(".arrowchat_tabcontenttext", $user_popups[from]).append("<div class=\"arrowchat_chatboxmessage arrowchat_clearfix\" id=\"arrowchat_message_" + id + "\" style=\"display:none\"><div class=\"arrowchat_chatboxmessagefrom" + f + "\"><div class=\"arrowchat_disable_avatars_name\">" + fromname + "</div><img alt=\"" + tooltip + "\" class=\"arrowchat_chatbox_avatar\" src=\"" + avatar + "\" /></div><div class=\"arrowchat_chatboxmessage_wrapper\"><div class=\"arrowchat_chatboxmessagecontent" + f + "\">" + formatTimestamp(new Date(sent * 1000)) + message + "</div></div></div>");
- if (c_chat_animations == 1 && old != 1) {
- a("#arrowchat_message_" + id).show("slide", {
- direction: "left"
- });
- } else {
- a("#arrowchat_message_" + id).show();
- }
- last_sent[from] = sent;
- last_name[from] = full_name;
- last_id[from] = id;
- } else {
- if (last_id[from] !== "undefined") {
- a("#arrowchat_message_" + last_id[from]).append("<div id=\"arrowchat_message_" + id + "\" class=\"arrowchat_chatboxmessagecontent" + f + "\">" + message + "</div>");
- } else {
- a(".arrowchat_tabcontenttext", $user_popups[from]).append("<div id=\"arrowchat_message_" + id + "\" class=\"arrowchat_chatboxmessagecontent" + f + "\">" + message + "</div>");
- }
- }
- if (c_disable_avatars == 1 || a("#arrowchat_setting_names_only :input").is(":checked")) {
- setAvatarVisibility(1);
- }
- }
- if (container <= container2 || !$users[from].hasClass("arrowchat_tabclick")) {
- a("#arrowchat_tabcontenttext_" + from).scrollTop(50000);
- } else {
- displayMessage("arrowchat_chatbox_message_flyout_" + from, lang[134], "notice");
- }
- self != 1 && old != 1 && showDesktopNotification(from, message, id);
- } else {
- message = stripslashes(message);
- addMessageToChatbox(from, message, self, old, id, 0, sent);
- j == "" && 0 && activateUser(from);
- }
- }
- function receiveTyping(id) {
- if (typeof $users[id] != "undefined") {
- a(".arrowchat_closebox_bottom_status", $users[id]).addClass("arrowchat_typing");
- }
- }
- function receiveNotTyping(id) {
- if (typeof $users[id] != "undefined") {
- a(".arrowchat_closebox_bottom_status", $users[id]).removeClass("arrowchat_typing");
- }
- }
- function pushCancelAll() {
- if (c_push_engine == 1) {
- push.unsubscribe({
- channel: "u" + u_id
- });
- push.unsubscribe({
- channel: "arrowchat"
- });
- if (Ccr > 0) {
- push.unsubscribe({
- channel: "chatroom" + Ccr
- });
- }
- }
- }
- function pushSubscribe() {
- if (c_push_engine == 1) {
- push.subscribe({
- channel: "u" + u_id,
- callback: function(data) {
- pushReceive(data);
- }
- });
- push.subscribe({
- channel: "arrowchat",
- callback: function(data) {
- pushReceive(data);
- }
- });
- }
- }
- function pushReceive(data) {
- if ("announcement" in data) {
- receiveAnnouncement(data.announcement);
- }
- if ("notification" in data) {
- var markup2;
- addNotification(data.notification.alert_id, data.notification.markup);
- notificationAlerts(markup2);
- }
- if ("chatroommessage" in data) {
- if (typeof blockList[data.chatroommessage.userid] == "undefined") {
- addChatroomMessage(data.chatroommessage.id, data.chatroommessage.name, data.chatroommessage.message, data.chatroommessage.userid, data.chatroommessage.sent, data.chatroommessage.global, data.chatroommessage.mod, data.chatroommessage.admin);
- chatroomAlerts(1);
- if (data.chatroommessage.userid != u_id) {
- u_chatroom_sound == 1 && !a(".arrowchat_chatroom_message_input").is(":focus") && playNewMessageSound();
- }
- }
- }
- if ("typing" in data) {
- receiveTyping(data.typing.id);
- }
- if ("nottyping" in data) {
- receiveNotTyping(data.nottyping.id);
- }
- if ("messages" in data) {
- receiveMessage(data.messages.id, data.messages.from, data.messages.message, data.messages.sent, data.messages.self, data.messages.old);
- data.messages.self != 1 && u_sounds == 1 && !a(".arrowchat_textarea", $user_popups[data.messages.from]).is(":focus") && playNewMessageSound();
- showTimeAndTooltip();
- K = 1;
- D = E;
- }
- if ("chatroomban" in data) {
- Ccr = 0;
- chatroomreceived = 0;
- loadChatroomList();
- displayMessage("arrowchat_chatroom_message_flyout", data.error2, "error");
- }
- }
- function DTitChange(name) {
- name = renderHTMLString(name);
- if (dtit2 != 2) {
- document.title = lang[30] + " " + name + "!";
- dtit2 = 2;
- } else {
- document.title = dtit;
- dtit2 = 1;
- }
- if (window_focus == false) {
- dtit3 = setTimeout(function() {
- DTitChange(name);
- }, 1000);
- } else {
- document.title = dtit;
- clearTimeout(dtit3);
- }
- }
- function changePushChannel(name, connect) {
- if (connect == 1) {
- push.subscribe({
- channel: name,
- callback: function(data) {
- pushReceive(data);
- }
- });
- } else {
- push.unsubscribe({
- channel: name
- });
- }
- }
- function buildTrayButtons() {
- for (var b = "", c = "", arcb = "", d = 0; d < barLinks.length; d++) {
- var i = barLinks[d];
- if (i[6] == "" || i[6] == 0) {
- i[6] = 16;
- }
- if (d == barLinks.length - 1) {
- arcb = " arrowchat_right_border";
- }
- b += "<div id=\"arrowchat_trayicon_" + d + "\" class=\"arrowchat_tray_button arrowchat_bar_left" + arcb + "\" style=\"width:" + i[6] + "px;\"><div class=\"arrowchat_inner_button\"><img class=\"arrowchat_tray_icon\" src=" + c_ac_path + "themes/" + u_theme + "/images/icons/" + i[0] + "><div class=\"arrowchat_tray_name\">" + i[7] + "</div></div></div>";
- if (i[3] == "_popup") {
- c += "<div id=\"arrowchat_trayicon_" + d + "_popup\" class=\"arrowchat_traypopup\" style=\"display:none\"><div class=\"arrowchat_traytitle\"><div class=\"arrowchat_name\">" + i[1] + "</div><div class=\"arrowchat_minimizebox\"></div><br clear=\"all\"/></div><div class=\"arrowchat_traycontent\"><div class=\"arrowchat_traycontenttext\"><iframe allowtransparency=\"true\" frameborder=0 width=\"" + i[4] + "\" height=\"" + i[5] + "\" id=\"arrowchat_trayicon_" + d + "_iframe\" ></iframe></div></div></div>";
- }
- }
- $base.append("<div>" + b + "</div>");
- $body.append("<div>" + c + "</div>");
- a(".arrowchat_tray_button").mouseover(function() {
- var e = a(this).attr("id").substr(19);
- if (barLinks[e][6] <= 16 || barLinks[e][6] == "") {
- showTooltip(a("#arrowchat_trayicon_" + e), barLinks[e][1], 1);
- }
- a(this).addClass("arrowchat_tabmouseover");
- });
- a(".arrowchat_tray_button").mouseout(function() {
- a(this).removeClass("arrowchat_tabmouseover");
- hideTooltip();
- });
- a(".arrowchat_traytitle").mouseenter(function() {
- var e = a(this).parent().attr("id");
- e = e.substring(19, e.length - 6);
- a(this).addClass("arrowchat_chatboxtabtitlemouseover");
- });
- a(".arrowchat_traytitle").mouseleave(function() {
- var e = a(this).parent().attr("id");
- e = e.substring(19, e.length - 6);
- a(this).removeClass("arrowchat_chatboxtabtitlemouseover");
- });
- a(".arrowchat_traytitle").click(function() {
- var e = a(this).parent().attr("id");
- e = e.substring(19, e.length - 6);
- a("#arrowchat_trayicon_" + e).click();
- });
- a(".arrowchat_tray_button").click(function() {
- var e = a(this).attr("id").substr(19);
- if (j != "") {
- closePopup($user_popups[j], $users[j]);
- a(".arrowchat_closebox_bottom", $users[j]).removeClass("arrowchat_closebox_bottom_click");
- j = "";
- }
- closePopup($userstab_popup, $buddy_list_tab);
- closePopup($optionsbutton_popup, $optionsbutton);
- var l = "_self";
- if (barLinks[e][3]) {
- l = barLinks[e][3];
- }
- if (l == "_popup") {
- if (m != e) {
- closePopup(a("#arrowchat_trayicon_" + m + "_popup"), a("#arrowchat_trayicon_" + m));
- m = "";
- }
- if (m == "") {
- a("#arrowchat_trayicon_" + e + "_popup").css("left", a("#arrowchat_trayicon_" + e).offset().left).css("bottom", "25px").css("width", barLinks[e][4]);
- a("#arrowchat_trayicon_" + e + "_popup").addClass("arrowchat_tabopen");
- a("#arrowchat_trayicon_" + e).addClass("arrowchat_trayclick");
- if (a("#arrowchat_trayicon_" + e + "_iframe").attr("src") === undefined || a("#arrowchat_trayicon_" + e + "_iframe").attr("src") == "") {
- a("#arrowchat_trayicon_" + e + "_iframe").attr("src", barLinks[e][2]);
- }
- m = e;
- } else {
- closePopup(a("#arrowchat_trayicon_" + m + "_popup"), a("#arrowchat_trayicon_" + m));
- m = "";
- }
- } else {
- var bar_link_url = barLinks[e][2].replace("{USER_ID}", u_id);
- bar_link_url = bar_link_url.replace("{USER_NAME}", u_name);
- window.open(bar_link_url, l);
- }
- });
- }
- function buildChatboxes() {
- $chatbox_left.click(function() {
- if ($chatboxes.scrollLeft() == 0) {} else {
- scrollChatboxes("-=148px");
- }
- });
- $chatbox_right.click(function() {
- if ($chatboxes.scrollLeft() + $chatboxes.width() == $chatboxes_wide.width()) {} else {
- scrollChatboxes("+=148px");
- }
- });
- }
- function mobileSupport() {
- if (c_mobile_device == 1) {
- $base.css("bottom", "0px");
- var position = $base.position();
- a(".arrowchat_tabpopup").css("bottom", a(document).height() - position.top - 9 + "px !important");
- a(".arrowchat_apppopup").css("bottom", a(document).height() - position.top - 9 + "px !important");
- }
- }
- function notificationPermission() {
- if (window.webkitNotifications && window.webkitNotifications.checkPermission) {
- window.webkitNotifications.requestPermission();
- } else if (window.Notification && window.Notification.requestPermission) {
- window.Notification.requestPermission();
- } else {
- return;
- }
- }
- function showDesktopNotification(id, message, message_id) {
- var s_message = message.replace(/<(?:.|\n)*?>/gm, "").replace(/&/g, "&").replace(/>/g, ">").replace(/</g, "<").replace(/"/g, "\"");
- if (s_message != "") {
- if (window.Notification && !window_focus && c_desktop_notify == 1) {
- var time = (new Date).getTime();
- var notification = new window.Notification(lang[144] + renderHTMLString(uc_name[id]), {
- icon: uc_avatar[id],
- body: s_message,
- tag: message_id
- });
- notification.ondisplay = function(event) {
- setTimeout(function() {
- event.currentTarget.cancel();
- }, 5000);
- };
- }
- }
- }
- function runarrowchat() {
- $base = a("<div/>").attr("id", "arrowchat_base").appendTo($body);
- if (c_chat_maintenance != 0 || c_guests_login_msg != 0 && u_id == "") {
- buildMaintenance();
- } else {
- if (c_hide_bar_on != 0) {
- buildShowBarButton();
- buildHideBarButton();
- }
- buildPopoutChatButton();
- c_notifications != 0 && buildOptionsButton();
- c_chatrooms != 0 && buildChatroomsButton();
- buildBuddyListTab();
- }
- if (c_links_right != 1) {
- buildTrayButtons();
- }
- if (c_applications_on != 0) {
- if (u_id == "" && c_guests_apps == "1" || u_id != "" && u_is_guest != 1 || u_id != "" && u_is_guest == 1 && c_guests_apps == 1) {
- if (c_no_apps_menu != 1) {
- buildApplicationsButton();
- }
- buildApplicationButtons();
- }
- }
- if (c_links_right == 1) {
- buildTrayButtons();
- }
- $body.append("<div id=\"arrowchat_sound_player_holder\"></div>");
- $chatbox_right = a("<div/>").attr("id", "arrowchat_chatbox_right").appendTo($base);
- a("<span/>").addClass("arrowchat_next_tab").appendTo($chatbox_right);
- a("<div/>").addClass("arrowchat_tabtext").appendTo($chatbox_right);
- a("<span/>").css("top", "-5px").css("display", "none").addClass("arrowchat_tabalertlr").appendTo($chatbox_right);
- $chatboxes = a("<div/>").attr("id", "arrowchat_chatboxes").appendTo($base);
- $chatboxes_wide = a("<div/>").attr("id", "arrowchat_chatboxes_wide").appendTo($chatboxes);
- $chatbox_left = a("<div/>").attr("id", "arrowchat_chatbox_left").appendTo($base);
- a("<span/>").addClass("arrowchat_previous_tab").appendTo($chatbox_left);
- a("<div/>").addClass("arrowchat_tabtext").appendTo($chatbox_left);
- a("<span/>").css("top", "-5px").css("display", "none").addClass("arrowchat_tabalertlr").appendTo($chatbox_left);
- buildChatboxes();
- updateRightLastClasses();
- $chatboxes_wide.css("width", "0px");
- addHover(a("#arrowchat_chatbox_left, #arrowchat_chatbox_right"), "arrowchat_chatbox_lr_mouseover");
- a(window).bind("resize", adjustBarSize);
- set("buddylist", "1");
- set("initialize", "1");
- set("currenttime", ab);
- c_facebook_app_id != "" && a(".arrowchat_facebook_connect").show();
- a(window).focus(function() {
- window_focus = true;
- }).blur(function() {
- window_focus = false;
- });
- if (c_desktop_notify == 1) {
- a("#arrowchat_base").click(notificationPermission);
- }
- if (typeof document.body.style.maxHeight === "undefined") {
- W = true;
- $base.css("position", "absolute");
- $tooltip.css("position", "absolute");
- $userstab_popup.css("position", "absolute");
- $optionsbutton_popup.css("position", "absolute");
- a(window).bind("scroll", function() {
- positionArrowchat();
- });
- }
- if (c_push_engine == 1) {
- push = PUBNUB.init({
- publish_key: c_push_publish,
- subscribe_key: c_push_subscribe
- });
- }
- if (c_chat_maintenance != 1) {
- for (var d = 0; d < unfocus_chat.length; d++) {
- if (unfocus_chat[d].toString().search("facebook") == "-1") {
- receiveUser(unfocus_chat[d], uc_name[unfocus_chat[d]], uc_status[unfocus_chat[d]], uc_avatar[unfocus_chat[d]], uc_link[unfocus_chat[d]], "1");
- }
- }
- }
- if (u_hide_bar == 1 || u_status == "offline") {
- if (u_status == "offline" && u_hide_bar != 1) {
- a("#arrowchat_userstab_text").html("Chat (Offline)");
- $chatboxes.hide();
- $chatbox_right.hide();
- $chatbox_left.hide();
- } else {
- $base.hide();
- $show_bar_button.css("display", "block");
- }
- w = 1;
- a.idleTimer("destroy");
- } else if (c_chat_maintenance != 1 && u_id != "" && u_popout_time != "1") {
- if (u_chat_open.toString().search("facebook") == "-1") {
- u_chat_open != 0 && receiveUser(u_chat_open, uc_name[u_chat_open], uc_status[u_chat_open], uc_avatar[u_chat_open], uc_link[u_chat_open]);
- }
- if (c_push_engine == 1) {
- pushSubscribe();
- }
- receiveCore();
- a("#arrowchat_userslist_available").html("<div class=\"arrowchat_nofriends\">" + lang[25] + "</div>");
- a(".arrowchat_chatroom_full_content").html("<div class=\"arrowchat_nofriends\">" + lang[34] + "</div>");
- loadBuddyList();
- u_blist_open == 1 && $buddy_list_tab.click();
- if (u_chatroom_open != -1) {
- u_chatroom_open == 0 && $chatrooms_button.click();
- if (u_chatroom_open != 0) {
- Ccr = u_chatroom_open;
- chatroomreceived = 1;
- if (typeof $chatroom_create != "undefined") {
- $chatroom_create.hide();
- }
- closePopup($userstab_popup, $buddy_list_tab);
- closePopup($optionsbutton_popup, $optionsbutton);
- $chatrooms_popup.css("left", $chatrooms_button.offset().left - $chatrooms_popup.outerWidth() + $chatrooms_button.outerWidth()).css("bottom", "25px");
- $chatrooms_button.toggleClass("arrowchat_tabclick").toggleClass("arrowchat_userstabclick");
- $chatrooms_popup.toggleClass("arrowchat_tabopen");
- loadChatroom(u_chatroom_open, crt[u_chatroom_open]);
- }
- }
- if (u_chatroom_stay > 0) {
- Ccr = u_chatroom_stay;
- chatroomreceived = 1;
- if (typeof $chatroom_create != "undefined") {
- $chatroom_create.hide();
- }
- loadChatroom(u_chatroom_stay, crt[u_chatroom_stay]);
- }
- if (u_chatroom_stay == -1 && u_chatroom_open == -1 && c_chatroom_auto_join != 0) {
- Ccr = c_chatroom_auto_join;
- chatroomreceived = 1;
- if (typeof $chatroom_create != "undefined") {
- $chatroom_create.hide();
- }
- loadChatroom(c_chatroom_auto_join, crt[c_chatroom_auto_join]);
- }
- if (u_apps_open != "" && u_apps_open != "0") {
- a("#arrowchat_app_link_" + u_apps_open).click();
- }
- } else if (u_popout_time == "1") {
- a.idleTimer("destroy");
- $buddy_list_tab.hide();
- $popout_chat_button.show();
- $chatboxes.hide();
- $chatbox_right.hide();
- $chatbox_left.hide();
- }
- clearUserStatus();
- adjustBarSize();
- if (c_mobile_device == 1) {
- a(window).bind("scroll", mobileSupport);
- mobileSupport();
- }
- a("#arrowchat_userstab_icon").addClass("arrowchat_user_" + u_status + "2");
- }
- function positionArrowchat() {
- $base.css("top", a(window).scrollTop() + a(window).height() - 25);
- $userstab_popup.css("top", parseInt(a(window).height()) - parseInt($userstab_popup.css("bottom")) - parseInt($userstab_popup.height()) + a(window).scrollTop() + "px");
- $optionsbutton_popup.css("top", parseInt(a(window).height()) - parseInt($optionsbutton_popup.css("bottom")) - parseInt($optionsbutton_popup.height()) + a(window).scrollTop() + "px");
- $tooltip.length > 0 && $tooltip.css("top", parseInt(a(window).height()) - parseInt($tooltip.css("bottom")) - parseInt($tooltip.height()) + a(window).scrollTop() + "px");
- if (j != "") {
- $user_popups[j].css("position", "absolute");
- $user_popups[j].css("top", parseInt(a(window).height()) - parseInt($user_popups[j].css("bottom")) - parseInt($user_popups[j].height()) + a(window).scrollTop() + "px");
- }
- }
- function playNewMessageSound() {
- swfobject.embedSWF(c_ac_path + "themes/" + u_theme + "/sounds/new%5Fmessage.player.swf?soundswf=" + c_ac_path + "themes/" + u_theme + "/sounds/new%5Fmessage.swf&autoplay=1&loops=0", "arrowchat_sound_player_holder", "1", "1", "9.0.0");
- }
- function getJabberUser(id, openChat, message) {
- var numericid = jabberDecodeID(id).split("@")[0].split("-")[1];
- a.ajax({
- url: "http://graph.facebook.com/" + numericid,
- dataType: "json",
- type: "GET",
- async: false,
- success: function(output) {
- uc_name[id] = output.name;
- if (typeof output.status == "undefined") {
- uc_status[id] = "offline";
- } else {
- uc_status[id] = output.status;
- }
- uc_avatar[id] = "http://graph.facebook.com/" + numericid + "/picture";
- uc_link[id] = output.link;
- if (openChat == 1) {
- openJabberChat(id);
- } else {
- openJabberMinimizeChat(id, message);
- }
- }
- });
- }
- function openJabberChat(id) {
- toggleUserChatTab(id, uc_name[id], uc_status[id], uc_avatar[id], uc_link[id], 0, 1);
- j = id;
- }
- function openJabberMinimizeChat(id, message) {
- toggleUserChatTab(id, uc_name[id], uc_status[id], uc_avatar[id], uc_link[id], 1, 1);
- if (message != 0) {
- receiveMessage("f" + message.time, message.from, message.msg, message.time / 1000, 0, 0);
- }
- adjustBarSize();
- }
- function getJabberList(data) {
- if (data != "") {
- session_var = data[0].msg;
- }
- a.ajax({
- url: "//arrowjabber.com/",
- data: {
- action: "getOnlineBuddies",
- sid: session_var
- },
- dataType: "jsonp",
- type: "GET",
- beforeSend: function() {
- jabberInitialize != 1 && a("#arrowchat_facebook_friends_list").html("<div class=\"arrowchat_nofriends\">" + lang[25] + "</div>");
- },
- error: function() {
- jqac.arrowchat.facebookLogout();
- },
- success: function(data) {
- if (data[0] && data[0].error == "1") {
- getJabberID(facebookResponse);
- } else {
- var md5updated = 0;
- jabberOnlineNumber = 0;
- var d = "";
- var buddylisttemp = "";
- var jabber_focus = 0;
- a("#arrowchat_facebook_friends_list").html("");
- a.each(data, function(id, user) {
- if (user.id) {
- var numericid = user.id.split("@")[0].split("-")[1];
- user.id = jabberEncodeID(user.id);
- var longname = user.n.length > 16 ? user.n.substr(0, 16) + "..." : user.n;
- jabberOnlineNumber++;
- if (a("#arrowchat_setting_names_only :input").is(":checked")) {
- d = "arrowchat_hide_avatars";
- }
- if (user.s == "available") {
- buddylisttemp += "<div id=\"arrowchat_userlist_" + user.id + "\" class=\"arrowchat_userlist arrowchat_buddylist_admin_0 arrowchat_jabber_user\" onmouseover=\"jqac(this).addClass('arrowchat_userlist_hover');\" onmouseout=\"jqac(this).removeClass('arrowchat_userlist_hover');\"><img class=\"arrowchat_userlist_avatar " + d + "\" src=\"" + user.a + "\" /><span class=\"arrowchat_userscontentname\">" + longname + "</span><span class=\"arrowchat_userscontentdot arrowchat_" + user.s + "\"></span></div>";
- }
- uc_name[user.id] = user.n;
- uc_status[user.id] = user.s;
- uc_avatar[user.id] = user.a;
- uc_link[user.id] = "http://www.facebook.com/" + numericid;
- if (G[user.id] != null) {
- a(".arrowchat_closebox_bottom_status", $users[user.id]).removeClass("arrowchat_available").removeClass("arrowchat_busy").removeClass("arrowchat_offline").removeClass("arrowchat_away").addClass("arrowchat_" + user.s);
- $users[user.id].removeClass("arrowchat_tab_offline").removeClass("arrowchat_away").addClass("arrowchat_tab_" + user.s);
- }
- if (u_chat_open == user.id) {
- jabber_focus = user.id;
- }
- }
- if (user.md5) {
- jabber_hash = user.md5;
- md5updated = 1;
- }
- });
- jabberOnlineNumber == 0 && a("#arrowchat_facebook_friends_list").html("<div class=\"arrowchat_nofriends\">" + lang[8] + "</div>");
- a("#arrowchat_facebook_friends_list").append("<div>" + buddylisttemp + "</div>");
- if (u_hide_bar != 1 && u_status != "offline") {
- a("#arrowchat_userstab_text").html("<b>" + lang[4] + "</b> (<b>" + (onlineNumber + jabberOnlineNumber) + "</b>)");
- }
- a(".arrowchat_jabber_user").click(function(l) {
- if (a(l.target).attr("id")) {
- var c = a(l.target).attr("id").substr(19);
- } else {
- var c = "";
- }
- if (c == "") {
- c = a(l.target).parent().attr("id").substr(19);
- }
- toggleUserChatTab(c, uc_name[c], uc_status[c], uc_avatar[c], uc_link[c], 0, 1);
- });
- if (jabberInitialize2 != 1) {
- if (jabberOnlineNumber == 1 || jabberOnlineNumber == 0) {
- jabberInitialize2 = 1;
- getJabberList("");
- return;
- }
- }
- if (jabberInitialize != 1) {
- for (var d = 0; d < unfocus_chat.length; d++) {
- if (unfocus_chat[d].toString().search("facebook") != "-1") {
- if (uc_name[unfocus_chat[d]] != "" && typeof uc_name[unfocus_chat[d]] != "undefined" && uc_link[unfocus_chat[d]].toString().search("facebook") != "-1") {
- toggleUserChatTab(unfocus_chat[d], uc_name[unfocus_chat[d]], uc_status[unfocus_chat[d]], uc_avatar[unfocus_chat[d]], uc_link[unfocus_chat[d]], 1, 1);
- } else {
- getJabberUser(unfocus_chat[d], 0, 0);
- }
- }
- }
- if (jabber_focus != 0) {
- a("#arrowchat_userlist_" + jabber_focus).click();
- j = jabber_focus;
- } else if (u_chat_open.toString().search("facebook") != "-1") {
- getJabberUser(u_chat_open, 1, 0);
- }
- }
- clearTimeout(jabberListTimer);
- jabberListTimer = setTimeout(function() {
- getJabberList("");
- }, c_list_heart_beat * 1000);
- adjustBuddyListSize();
- getJabberMessages();
- jabberInitialize = 1;
- }
- }
- });
- }
- function getJabberMessages() {
- clearTimeout(jabberMsgTimer);
- a.ajax({
- url: "//arrowjabber.com/",
- data: {
- action: "getRecentMessages",
- sid: session_var
- },
- dataType: "jsonp",
- type: "GET",
- success: function(data) {
- if (data[0] && data[0].error == "1") {
- getJabberID(facebookResponse);
- } else {
- a.each(data, function(id, message) {
- message.from = jabberEncodeID(message.from);
- if (typeof uc_name[message.from] == "undefined") {
- getJabberUser(message.from, 0, message);
- } else {
- receiveMessage("f" + message.time, message.from, message.msg, message.time / 1000, 0, 0);
- }
- u_sounds == 1 && !a(".arrowchat_textarea", $user_popups[message.from]).is(":focus") && playNewMessageSound();
- showTimeAndTooltip();
- K = 1;
- D = E;
- });
- jabberMsgTimer = setTimeout(function() {
- getJabberMessages();
- }, c_heart_beat * 1000);
- }
- }
- });
- }
- function getJabberID(response) {
- var currenttime = new Date;
- currenttime = parseInt(currenttime.getTime() / 1000);
- if (errorCount == 0) {
- setTimeout(function() {
- errorCount = 0;
- }, 10000);
- }
- errorCount++;
- if (errorCount < 4) {
- a.ajax({
- url: "//arrowjabber.com/",
- data: {
- action: "login",
- access_key: response.authResponse.accessToken,
- fb_app_id: c_facebook_app_id,
- user: response.authResponse.userID
- },
- dataType: "jsonp",
- type: "GET",
- beforeSend: function() {
- jabberInitialize != 1 && a("#arrowchat_facebook_friends_list").html("<div class=\"arrowchat_nofriends\">" + lang[25] + "</div>");
- },
- error: function() {
- jqac.arrowchat.facebookLogout();
- },
- success: function(data) {
- a.cookie("ac_facebook_id", data[0].msg, {
- expires: 365,
- path: "/"
- });
- getJabberList(data);
- }
- });
- } else {
- jqac.arrowchat.facebookLogout();
- }
- }
- function getJabberHistory(id) {
- a.ajax({
- url: "//arrowjabber.com/",
- data: {
- action: "getAllMessages",
- user: jabberDecodeID(id),
- sid: session_var
- },
- dataType: "jsonp",
- type: "GET",
- success: function(data) {
- if (data[0] && data[0].error == "1") {
- getJabberID(facebookResponse);
- } else {
- a("#arrowchat_tabcontenttext_" + id).html("");
- last_sent[id] = null;
- a.each(data, function(id, message) {
- message.from = jabberEncodeID(message.from);
- if (message.type == "received") {
- receiveMessage("f" + message.time, message.from, message.msg, message.time / 1000, 0, 1);
- } else {
- addMessageToChatbox(message.from, message.msg, "1", "1", "f" + message.time, 1, message.time / 1000);
- }
- showTimeAndTooltip();
- });
- }
- }
- });
- }
- function jabberEncodeID(id) {
- id = id.toLowerCase();
- id = id.replace("-", "M");
- id = id.replace("@", "A");
- id = id.replace(/\./g, "D");
- return id;
- }
- function jabberDecodeID(id) {
- id = id.replace("M", "-");
- id = id.replace("A", "@");
- id = id.replace(/D/g, ".");
- return id;
- }
- function sendJabberMessage(id, message) {
- new_id = jabberDecodeID(id);
- a(".arrowchat_textarea").addClass("arrowchat_message_sending");
- a.getJSON("//arrowjabber.com/", {
- action: "sendMessage",
- to: new_id,
- msg: message,
- sid: session_var
- }, function(data) {
- a(".arrowchat_textarea").removeClass("arrowchat_message_sending");
- if (data[0] && data[0].error == "1") {
- displayMessage("arrowchat_chatbox_message_flyout_" + typing, lang[135], "error");
- } else {
- addMessageToChatbox(id, message, "1", "1", "f" + Math.floor((new Date).getTime()), 1, Math.floor((new Date).getTime() / 1000));
- }
- });
- }
- function renderHTMLString(string) {
- var new_render = string;
- if (typeof string != "undefined") {
- var render = a("<div/>").attr("id", "arrowchat_render").html(string).appendTo("body");
- new_render = a("#arrowchat_render").html();
- render.remove();
- }
- return new_render;
- }
- var bounce2 = 1,
- bounce3 = 1,
- chatroom_mod = 0,
- chatroom_admin = 0,
- count = 0,
- V = {},
- dtit = document.title,
- dtit2 = 1,
- dtit3 = 1,
- window_focus = true,
- xa = {},
- j = "",
- crou = "",
- $ = 0,
- w = 0,
- bli = 1,
- isAway = 0,
- chatroomreceived = 0,
- msgcount = 0,
- W = false,
- Y, Z, E = 3000,
- Crref2, Ccr = -1,
- message_timeout, D = E,
- K = 1,
- ma = 0,
- R = 0,
- m = "",
- Ka = 0,
- crt = {},
- crt2 = {},
- y = {},
- G = {},
- aa = {},
- ca = {},
- last_id = {},
- last_sent = {},
- last_name = {},
- history_ids = {},
- Aa = new Date,
- Na = Aa.getDate(),
- ab = Math.floor(Aa.getTime() / 1000),
- acsi = 1,
- Q = 0,
- fa = -1,
- acp = "Powered By <a href='http://www.arrowchat.com/' target='_blank'>ArrowChat</a>",
- pa = 0,
- B, push, jabberListTimer, facebookResponse, jabber_hash = "",
- session_var = "",
- jabberInitialize = 0,
- jabberInitialize2 = 0,
- jabberMsgTimer, onlineNumber = 0,
- jabberOnlineNumber = 0,
- errorCount = 0,
- N;
- var _ts = "",
- _ts2;
- for (d = 0; d < Themes.length; d++) {
- if (Themes[d][2] == u_theme) {
- _ts2 = "selected";
- } else {
- _ts2 = "";
- }
- _ts = _ts + "<option value=\"" + Themes[d][0] + "\" " + _ts2 + ">" + Themes[d][1] + "</option>";
- }
- a.ajaxSetup({
- scriptCharset: "utf-8",
- cache: false
- });
- a.expr[':'].icontains = function(b, c, d) {
- return (b.textContent || b.innerText || jqac(b).text() || "").toLowerCase().indexOf(d[3].toLowerCase()) >= 0;
- };
- arguments.callee.videoWith = function(b) {
- var win = window.open(c_ac_path + "public/video/?rid=" + b, "audiovideochat", "status=no,toolbar=no,menubar=no,directories=no,resizable=no,location=no,scrollbars=no,width=650,height=720");
- win.focus();
- };
- arguments.callee.runarrowchat = runarrowchat;
- arguments.callee.chatroom = function(b) {
- if (u_hide_bar == 1) {
- showBar();
- }
- $chatrooms_button.click();
- setTimeout(function() {
- Ccr = b;
- loadChatroom(b, "1");
- }, 400);
- };
- arguments.callee.chatWith = function(b) {
- if (u_hide_bar == 1) {
- showBar();
- }
- receiveUser(b, uc_name[b], uc_status[b], uc_avatar[b], uc_link[b]);
- };
- arguments.callee.openCloseApp = function(name) {
- a(".arrowchat_appname_" + name).click();
- };
- arguments.callee.changeAppImage = function(name, image) {
- a(".arrowchat_appname_" + name + " img").attr("src", c_ac_path + image);
- };
- arguments.callee.addAppAlert = function(name, number) {
- if (a(".arrowchat_appname_" + name + " .arrowchat_tabalert").length > 0 && number > 0) {
- a(".arrowchat_appname_" + name + " .arrowchat_tabalert").html(number);
- a(".arrowchat_appname_" + name + " .arrowchat_tabalert").effect("bounce", {
- times: 3,
- distance: 5
- }, 200);
- } else if (!a(".arrowchat_appname_" + name).hasClass("arrowchat_trayclick")) {
- a("<div/>").css("top", "-11px").css("left", "6px").addClass("arrowchat_tabalert").html(number).appendTo(".arrowchat_appname_" + name);
- }
- };
- arguments.callee.getUser = function(b, c) {
- a.ajax({
- url: c_ac_path + "includes/json/receive/receive_user.php",
- data: {
- userid: b
- },
- type: "post",
- cache: false,
- dataType: "json",
- success: function(o) {
- if (o) {
- window[c](o);
- } else {
- window[c](0);
- }
- }
- });
- };
- arguments.callee.sendMessage = function(b, c) {
- c != "" && a.post(c_ac_path + "includes/json/send/send_message.php", {
- to: b,
- message: c
- }, function(d) {
- if (d) {
- if (d == "-1") {
- displayMessage("arrowchat_chatbox_message_flyout_" + b, lang[102], "error");
- } else {
- addMessageToChatbox(b, c, 1, 1, d, 1, 1);
- }
- a(".arrowchat_tabcontenttext", $user_popups[b]).scrollTop(a(".arrowchat_tabcontenttext", $user_popups[b])[0].scrollHeight);
- }
- K = 1;
- });
- };
- arguments.callee.getBaseUrl = function() {
- return k;
- };
- arguments.callee.facebook = function(response) {
- facebookResponse = response;
- a(".arrowchat_facebook_connect a").html(lang[141]);
- a.cookie("ac_facebook", "1", {
- expires: 365,
- path: "/"
- });
- a("#arrowchat_userscontent").append("<div id=\"arrowchat_facebook_friends\" class=\"arrowchat_group_container\"><span class=\"arrowchat_group_text\">" + lang[143] + "</span><div class=\"arrowchat_group_line_container\"><span class=\"arrowchat_group_line\"></span></div></div><div id=\"arrowchat_facebook_friends_list\"></div>");
- a("#arrowchat_userscontent").prepend("<div id=\"arrowchat_site_users\" class=\"arrowchat_group_container\"><span class=\"arrowchat_group_text\">" + lang[142] + "</span><div class=\"arrowchat_group_line_container\"><span class=\"arrowchat_group_line\"></span></div></div>");
- adjustBuddyListSize();
- var fb_id_cookie = a.cookie("ac_facebook_id");
- if (typeof fb_id_cookie != "undefined" && fb_id_cookie != "") {
- session_var = fb_id_cookie;
- getJabberList("");
- } else if (session_var != "") {
- getJabberList("");
- } else {
- getJabberID(response);
- }
- };
- arguments.callee.facebookLogout = function() {
- clearTimeout(jabberListTimer);
- clearTimeout(jabberMsgTimer);
- a(".arrowchat_facebook_connect a").html(lang[140]);
- a.removeCookie("ac_facebook", {
- path: "/"
- });
- a(".arrowchat_group_container").remove();
- a("#arrowchat_facebook_friends_list").remove();
- adjustBuddyListSize();
- jabberOnlineNumber = 0;
- a("#arrowchat_userstab_text").html("<b>" + lang[4] + "</b> (<b>" + (onlineNumber + jabberOnlineNumber) + "</b>)");
- a(".arrowchat_jabber_user_tab .arrowchat_closebox_bottom").click();
- };
- };
- })(jqac);
- jqac(document).ready(function() {
- if (u_logged_in != 1 && c_disable_arrowchat != 1) {
- jqac.arrowchat();
- jqac.arrowchat.runarrowchat();
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement