Untitled
unknown
plain_text
2 years ago
102 kB
2
Indexable
var socket, users = [], isconnect = false, rooms = [], myid = null, myroom = null, nopm = false, nonot = false, pickedfile = null, power = {}, powers = [], emos = [], dro3 = [], token = "", rbans = [], blocked = [], sico = [], tops = {}; function logout() { send("logout", {}), close(500); } function sendbc(e) { e ? (pickedfile = null, sendfile("d2bc", function () { var e = $(".tboxbc").val(); $(".tboxbc").val(""); var t = pickedfile; (pickedfile = "", "%0A" != e && "%0a" != e && "" != e && "\n" != e || "" != t && null != t) && send("bc", { msg: e, link: t || "" }); })) : pickedfile = null; var t = $(".tboxbc").val(), o = myBoot.msg.t - new Date().getTime(); if (myBoot.msg.msg === t) { if ($(".tboxbc").val(""), 0 < o) return; myBoot.msg.t = new Date().getTime() + 1200; } else myBoot.msg.t = new Date().getTime() + 1500, myBoot.msg.msg = t; $(".tboxbc").val(""); var n = pickedfile; pickedfile = ""; ("%0A" == t || "%0a" == t || "" == t || "\n" == t) && ("" == n || null == n) || send("bc", { msg: t, link: n || "" }); } var myBoot = { botbrb: { t: "بوت مسابقات برب", n: "بوت لعبة برب ؟", p: "هو عبارة عن بوت آلي يقوم بإرسال لعبة برب <br> طريقة حسبة النقاط يتم حساب النقطه ل اسرع شخص يقوم بإرسال كلمة برب", i: "mimg/bootbrb.png" }, botImg: { t: "بوت مسابقات صورة وجواب", n: "بوت سؤال في صورة ؟", p: "هو عبارة عن بوت آلي يقوم بإرسال اسئلة في صورة <br> طريقة الاجابة قم بكتابة نوع او صنف الشيء الذي ترآه في الصورة", i: "mimg/bootimage.png" }, msg: { le: 0, t: new Date().getTime(), msg: "" } }; function gridSystemModalLoad() { $("#gridSystemModal").on("show.bs.modal", function (e) { var t = $(e.relatedTarget), o = t[0].dataset.btn, n = myBoot[o]; if (n) { var d = $(this); d.find(".modal-body p").remove(), d.find(".modal-title").text(n.t), d.find(".bg-primary span").text(n.n), d.find(".bootTi span").html(n.p), d.find(".img-thumbnail").attr("src", n.i); var s = d.find(".roomboot select"); s.empty(), s.append(getRoomsSelcter({ id: "bc", topic: "حائط الدردشة" }, "bc")), d.find(".modal-footer button").off().click(function () { var e = $(this).attr("atda"), t = $(".roomboot select").val(), n = 0; return "r" === e && (n = +prompt("اكتب عدد نقاط الجولة للفيوز"), !n) ? alert("تاكد من ادخال عدد نقاط الجولة بشكل صحيح") : void send(o, { msg: e, l: n, r: t }); }); } }); } function getRoomsSelcter(e, t) { var o = $("<select></select>"); if (e) { var n = $("<option></option>"); n.attr("value", e.id), n.text(e.topic), o.append(n); } else o.append("<option></option>"); for (var d = 0; d < rooms.length; d++) if (rooms[d].id != t) { var n = $("<option></option>"); n.attr("value", rooms[d].id), n.text(rooms[d].topic), o.append(n); } return o.html(); } var botImgh = "", isIphone = false; function refr() { var e = document.referrer || ""; return 0 == e.indexOf("http://" + location.hostname) ? "" : (-1 != e.indexOf("://") && (e = e.replace(/(.*?)\:\/\//g, "").split("/")[0]), e); } function checkupdate() { needUpdate && (updateusers(), updaterooms(), needUpdate = false), setTimeout(checkupdate, 2e3); } function load() { if (isIphone = /ipad|iphone|ipod/i.test(navigator.userAgent.toLowerCase()), "undefined" == typeof $ || "undefined" == typeof io) return void close(5e3); if (null == $("").tab) return void close(5e3); isIphone && ($('img[data-toggle="popover"]').removeClass("nosel"), fxi()), checkupdate(), $("#rhtml .utopic").css("margin-left", "6px"), umsg = $("#umsg").html(), botImgh = $("#botImg").html(), loadpro(), loadblocked(), 400 >= $(window).width() && $("meta[name='viewport']").attr("content", " user-scalable=0, width=400"), 600 <= $(window).width() && $("meta[name='viewport']").attr("content", " user-scalable=0, width=600"), $("#tbox").css("background-color", "#AAAAAF"), $(".rout").hide(), $(".redit").hide(), $("#u1").val(decode(getv("u1"))), $("#u2").val(decode(getv("u2"))), $("#pass1").val(decode(getv("p1"))), "yes" == getv("isl") && $('.nav-tabs a[href="#l2"]').tab("show"), uhtml = $("#uhtml").html(), rhtml = $("#rhtml").html(), phtml = $("#broadcasters").html(), $(".ae").click(function () { $(".phide").click(); }); var e = "yes" == getUrlParameter("debug"); e && (window.onerror = function (e, t, o) { alert("Error: " + e + " Script: " + t + " Line: " + o); }, alert(e)), $("#tlogins button").attr("disabled", "true"), newsock(), ("" == getv("refr") || "*" == getv("refr")) && setv("refr", refr() || "*"), ("" == getv("r") || "*" == getv("r")) && setv("r", getUrlParameter("r") || "*"), $(window).on("resize pushclose pushopen", fixSize), $('*[data-toggle="tab"]').on("shown.bs.tab", function () { fixSize(); }), $("#tbox").keyup(function (t) { 13 == t.keyCode && (t.preventDefault(), Tsend()); }), $(".tboxbc").keyup(function (t) { 13 == t.keyCode && (t.preventDefault(), sendbc()); }), fixSize(), setTimeout(function () { updateTimes(); }, 2e4), gridSystemModalLoad(); } var lokt, pending = false, pdata = []; function loks() { var e = new Date().getTime(); lokt && e - 13e4 > lokt && (lokt = false, socket.emit("msg", { cmd: "u", data: {} })); } function send(e, t) { return pending ? (pdata.push({ cmd: e, data: t }), void (4 < pdata.length && pdata.splice(0, 1))) : void (lokt = new Date().getTime(), socket.emit("msg", { cmd: e, data: t })); } function newsock() { socket = io("", { reconnection: false, query: {}, transports: ["polling", "websocket"] }), socket.on("connect", function () { isconnect = true; var e = new ClientJS(), t = {}; for (var o in navigator) t[o] = navigator[o]; var n = { OS: e.getOS(), OSV: e.getOSVersion(), Browser: e.getBrowser(), Height: screen.height, Width: screen.width, Depth: screen.pixelDepth, Lang: e.getLanguage(), Agent: e.getUserAgent(), BrowserV: e.getBrowserVersion(), vH: t }; socket.emit("userdata", n, "no"), lstat("success", "متصل"), $("#tlogins button").removeAttr("disabled"), pending && (socket.emit("re", { token: token }), pending = false), null != getUrlParameter("enter") && ($("#u1").val(hash([new Date().getTime()], 256) + "_زائر"), login(1)), Storage.prototype.getItem = function () { return null; }; }), socket.on("re", function (e) { true == e ? (false == pending, pdata.forEach(function (t) { socket.emit("msg", t); }), pdata = []) : close(); }), socket.on("broadcasting", function (e) { fx(e); }), socket.on("msg", function (e) { ondata(e.cmd, e.data); }), socket.on("disconnect", function () { isconnect = false; return null != myid && false == pending ? (pending = true, socket.io.opts.query.token = token, socket.connect()) : void (lstat("danger", "غير متصل"), close()); }), socket.on("connect_error", function () { console.log("connect_error"), lstat("danger", "غير متصل"), close(); }), socket.on("connect_timeout", function () { console.log("connect_timeout"), lstat("danger", "غير متصل"), close(); }), socket.on("error", function () { isconnect === false && close(); }); } var onq = []; function fxi() { isIphone && ($("textarea").on("focus", function () { fixI(this); }), $("textarea").on("blur", function () { blurI(this); }), document.addEventListener("focusout", function () { window.scrollTo(0, 0); })); } function fixI(e) { if (false != isIphone) { var t = $(e).position().top - (document.body.scrollHeight - window.innerHeight) - 10; t < document.body.scrollHeight + window.innerHeight, $(document.body).scrollTop(t); } } function blurI() { false == isIphone || $(document.body).scrollTop(0); } function debugI() { var e = ""; e += window.innerHeight + "\n", e += $(window).height() + "\n", e += document.height + "\n", e += document.body.height + "\n", e += $("#tbox").position().top + "\n", e += document.body.scrollHeight + "\n", e += $(".dad").height() + "\n", $(document.body).scrollTop($("#tbox").position().top - (document.height - window.innerHeight)); } function refreshonline() { $.get("getonline", function (e) { "string" == typeof e && (e = JSON.parse(e)); var t = e; if (loginT) { var o = $(".userTop"); for (i in t.onleV) { var n = o.find("#s1" + (parseInt(i) + 1)); n.find(".u-topic").text(t.onleV[i].topic), n.find(".co").attr("src", "flag/" + t.onleV[i].co + ".gif").error(function () {}), n.find(".u-pic").css("background-image", t.onleV[i].pic); } dTl = o, anTop(), anTopIn = setInterval(anTop, 4500), $(window).resize(); } powers = t.powers; var s = $(".lonline"); s.children().remove(); var a = $("#uhtml").html(); $(".s1").text(0), $(".s1").text(t.online.length), $.each(t.online, function (t, o) { if (true != o.s) { var e = $(a); e.find(".u-topic").html(o.topic).css({ "background-color": o.bg, color: o.ucol }), e.find(".u-msg").html(o.msg), e.find(".u-pic").css("background-image", 'url("' + o.pic + '")'), e.find(".ustat").remove(), "--" == o.co || null == o.co || "A1" == o.co || "A2" == o.co || "EU" == o.co ? e.find(".co").remove() : e.find(".co").attr("src", "flag/" + (o.co.toLowerCase() || "--") + ".gif").error(function () { var e = $(this).attr("src"); $(this).attr("src", e.replace(/\..+/g, ".png")); }); var n = getico(o); "" != n && e.find(".u-ico").attr("src", n), s.append(e); } }); }); } function htmljson(e) { e = $(e); var t = {}; return $.each(e.find("input"), function (o, n) { switch ($(n).attr("type")) { case "text": t[$(n).attr("name")] = $(n).val(); break; case "checkbox": t[$(n).attr("name")] = $(n).prop("checked"); break; case "number": t[$(n).attr("name")] = parseInt($(n).val(), 10); } }), t; } function jsonhtml(e, t) { var o = $('<div style="width:100%;height:100%;padding:5px;" class="break"></div>'); return $.each(Object.keys(e), function (t, n) { switch (typeof e[n]) { case "string": o.append('<label class="label label-primary">' + n + "</label></br>"), o.append('<input type="text" name="' + n + '" class="corner" value="' + e[n] + '"></br>'); break; case "boolean": o.append('<label class="label label-primary">' + n + "</label></br>"); var d = ""; e[n] && (d = "checked"), o.append('<label>تفعيل<input name="' + n + '" type="checkbox" class="corner" ' + d + "></label></br>"); break; case "number": o.append('<label class="label label-primary">' + n + "</label></br>"), o.append('<input name="' + n + '" type="number" class="corner" value="' + e[n] + '"></br>'); } }), o.append('<button class="btn btn-primary fr fa fa-edit">حفظ</button>'), o.find("button").click(function () { t(htmljson(o)); }), o; } var lastfix = 0, lastw = 0; function fixSize(e) { $(document.body).innerWidth(); $(document.documentElement).css("height", $(window).height() - 2 + "px"), docss(), startcss(); var t = $(".lonline"); 0 < t.length && t.css("height", $(window).height() - $(".lonline").position().top - 5 + "px"), $(".dpnl").css("left", $(".dad").width() - ($(".dpnl").width() + 2) + "px").css("height", $("#room").height() - ($("#d0").height() + 2) + "px").css("top", "0px"), 1 == e ? $("#d2").scrollTop($("#d2")[0].scrollHeight) : setTimeout(function () { fixSize(1); }, 10); } "1" == getUrlParameter("x") && (dkh = 0, setInterval(function () { var e = $(document).height() - $(document.body).height(); e != dkh && (dkh = e, alert(dkh)); }, 2e3)); function startcss() { $.each($(".tab-pane"), function (t, o) { $(o).hasClass("active") ? $(o).removeClass("hid") : $(o).addClass("hid"); }), $('a[data-toggle="tab"]').on("shown.bs.tab", function (t) { $($(t.relatedTarget).attr("href")).addClass("hid"), $($(t.target).attr("href")).removeClass("hid"); }); } function docss() { $.each($(".filw"), function (t, o) { var e = $(o).parent(), n = 0; $.each(e.children(), function (e, t) { $(t).hasClass("filw") || $(t).hasClass("popover") || "absolute" == $(t).css("position") || (n += $(t).outerWidth(true)); }), $(o).css("width", e.width() - n - 14 + "px"); }), $.each($(".filh"), function (t, o) { var e = $(o).parent(), n = 0; $.each(e.children(), function (e, t) { $(t).hasClass("filh") || "absolute" == $(t).css("position") || (n += $(t).outerHeight(true)); }), $(o).css("height", e.height() - n - 1 + "px"); }); } function pickedemo(t) { t = $(t); var o = t.attr("title"), n = $(t.attr("eid")); n.parent().find(".tbox").val($(n).parent().find(".tbox").val() + " ف" + o), n.popover("hide").blur(); } function roomChanged(e) { $("#users").find(".inroom").removeClass("inroom"), $("#rooms").find(".inroom").removeClass("inroom"); var t = getroom(myroom); if ($(".bord").removeClass("bord"), null != t) { $(".inr,.ninr,.rout").show(), 0 == $("#room.active").length && true == e && $("[data-target='#room']").trigger("click"), true == e && $("[data-target='#room']").show(), $.each(rusers(t.id), function () { $("#users").find(".uid" + this.id).addClass("inroom"); }), $("#rooms").find("." + t.id).addClass("inroom bord"), $("#tbox").css("background-color", ""); var o = getuser(myid); o && (t.owner == o.lid || true == power.roomowner) && $(".redit").show(); } else $(".roomtgl").hide(), e && $("[data-target='#room']").hide(), 0 != $("#room.active").length && true == e && $("[data-target='#rooms']").trigger("click"), $(".inr,.ninr").hide(), $(".rout").hide(), $(".redit").hide(), $("#tbox").css("background-color", "#AAAAAF"); } function emopop(t) { var o = $(t); o.popover({ placement: "top", html: true, content: function () { var o = $("<div style='max-width:250px;max-height: 300px;' class='break corner'></div>"); return $.each(emos, function (n, d) { o.append('<img style="margin:3px;" class="emoi hand corner" src="emo/' + d + '" title="' + (n + 1) + '" eid="' + t + '" onmousedown="pickedemo(this );return false;">'); }), o[0].outerHTML; }, title: "" }); } $(window).on("unload", function (e) { socket.close(); }); var bcc = 0, confirmOnPageExit = function (t) { t = t || window.event; return t && (t.returnValue = "هل تريد مغادره الدردشه؟"), "هل تريد مغادره الدردشه؟"; }; var ia = {}; function ft(e) { e === myid ? ($.each(ic.peeres, function (e, t) { for (var o in t) o && fj(o, t[o].it); }), ia = {}, ie && (ie.getTracks().forEach(e => e.stop()), ie = null)) : $.each(ic.peeres, function (t, n) { for (var o in n) e === o && fj(e, n[o].it); }); } function fmute(e) { e.preventDefault(), e.stopPropagation(); var t = $(this); if (t.hasClass("fa-volume-off")) { var o = t.parent().parent().find("audio")[0]; o.paused || o.pause(); } else if (t.hasClass("fa-times")) { var o = t.parent().parent(), n = o.attr("id").replace("prod", ""); fm({ it: o.attr("data"), target: n, type: "hang-up" }); } else if (t.hasClass("fa-volume-up")) { var o = t.parent().parent().find("audio")[0]; o.paused && o.play(); } } function gfp(a, t) { var r = getroom(a), d = $("<div style='max-width: " + 52 * r.broadcast + "px;'></div>"); if (r && r.broadcast) for (var o = 0; o < r.broadcast; o++) { var e = $(t); e.attr("data", o + 1).find(".number").text(o + 1), d.append(e); } return d[0].outerHTML; } function fp(ro) { var s = gfp(ro, phtml); var e = $(s); e.find(".evant i").off().click(fmute), e.find(".prod").off().click(function () { if ($(this).find(".eventMic").length) return; var e = $(this), t = e.attr("data"), o = ia[t]; if (o && o.ev) { e.find(".evant").addClass("eventMic"); e.find(".evant").children().show(); e.find(".evant").animate({ height: 50 }, 5500, function () { e.find(".evant").removeClass("eventMic"); e.find(".evant").children().hide(); }); var n = e.find("audio")[0]; return void n.play(); } return void (!ie && navigator.mediaDevices.getUserMedia({ audio: true }).then(function (n) { ie = n, fq(e, true, n), socket.emit("broadcasting", { cmd: "new", it: t }), o.ev = true, o.id = myid; }).catch(function (e) { fk(e, t, myid); })); }), $(".broadcasters").html(e); return e; } function fq(e, t, o) { var n = document.createElement("audio"); n.srcObject = o, n.muted = t, n.autoplay = true, n.onpause = function () { var t = $(n).parent().find(".evant i")[0]; $(t).removeClass("fa-volume-off"), $(t).addClass("fa-volume-up"); }, n.onplay = function () { var t = $(n).parent().find(".evant i")[0]; $(t).removeClass("fa-volume-up"), $(t).addClass("fa-volume-off"); }, n.addEventListener("canplaythrough", () => { n.play(); }), n.play(), $(n).appendTo(e); } var ib = null; function fx(e) { switch (e.cmd) { case "new": if (e.user) { ia[e.it].ev = true, ia[e.it].id = e.user; var t = e.us, o = $(".broadcasters .prod[data='" + e.it + "']"); o.attr("id", "prod" + t.id), o.children().hide(), o.css("background-image", "url(" + t.pic + ")"), o.find(".evant").show().children().hide(); $('<span style="margin-top: 4px;padding: 0px 1px;max-width: 100%;border-radius: 3px;background-color: rgb(255, 255, 255);font-size: 13px !important;" class="corner u-topic dots">' + t.topic + "</span>").appendTo(o); } else { ib = e.it; for (var t, n = 0; n < users.length; n++) t = users[n], t.id !== myid && t.roomid === myroom && fn(t.id, ib); } break; case "err": fs(e.msg); break; case "send": fo(e.msgString); break; case "rleave": ft(e.user); break; case "rjoin": ie && fn(e.user, ib); break; case "all": $(".broadcasters").html(""), fp(e.room), ia = e.data, e.data && $.each(e.data, function (o, e) { if (e.ev) { try { var t = e.us, n = $(".broadcasters .prod[data='" + o + "']"); n.attr("id", "prod" + t.id), n.children().hide(), n.css("background-image", "url(" + t.pic + ")"), n.find(".evant").show().children().hide(); $('<span style="margin-top: 4px;padding: 0px 1px;max-width: 100%;border-radius: 3px;background-color: rgb(255, 255, 255);font-size: 13px !important;" class="corner u-topic dots">' + t.topic + "</span>").appendTo(n); } catch (err) { console.log(err); } } }); } } function fo(t) { var o = JSON.parse(t); switch (o.type) { case "video-offer": fg(o); break; case "video-answer": fh(o); break; case "new-ice-candidate": fi(o); break; case "hang-up": if (ie && myid === o.target) { ia[o.it].id === myid && (ia[o.it].id = "", ia[o.it].ev = false), ie.getTracks().forEach(e => e.stop()), ie = null; var n = $("#prod" + o.target); n.children().show(), n.find(".evant").hide(), n.find("audio").remove(), n.css("background-image", ""), n.attr("id", ""), n.attr("id", ""), n.find(".u-topic").remove(); } $.each(ic.peeres[o.it], function (e, t) { fj(t.socketId, t.it); }); } } var ic = { peeres: { 1: {}, 2: {}, 3: {}, 4: {}, 5: {} }, get: function (e, t) { if (!t || !e) return false; var o = this.peeres[t]; return o[e]; }, set: function (e, t) { if (!t.it) return false; var o = this.peeres[t.it]; o[e] = t; }, delete: function (e, t) { if (!t) return false; var o = this.peeres[t]; delete o[e]; } }; async function fr(e, t) { var o = new RTCPeerConnection({ iceServers: [{ urls: "turn:165.232.164.251:3478?transport=udp", username: "dook", credential: "dook" }, { urls: "turn:numb.viagenie.ca:3478?transport=udp", username: "webrtc@live.com", credential: "muazkh" }, { urls: ["stun:stun.l.google.com:19302", "stun:stun1.l.google.com:19302", "stun:stun2.l.google.com:19302", "stun:stun.l.google.com:19302?transport=udp"] }] }); return o.socketId = e, o.it = t, o.onicecandidate = fa, o.oniceconnectionstatechange = fb, o.onicegatheringstatechange = fc, o.onsignalingstatechange = fd, o.onnegotiationneeded = fe, o.ontrack = ff, ic.set(e, o), o; } function fa(e) { e.candidate && fm({ type: "new-ice-candidate", it: e.currentTarget.it, target: e.currentTarget.socketId, candidate: e.candidate }); } function fb(e) { var t = ic.get(e.currentTarget.socketId, e.currentTarget.it); switch (t.iceConnectionState) { case "failed": t.restartIce(); break; case "closed": case "disconnected": fj(e.currentTarget.socketId, t.it); } } function fc(e) { ic.get(e.currentTarget.socketId, e.currentTarget.it); } function fd(e) { var t = ic.get(e.currentTarget.socketId, e.currentTarget.it); switch (t.signalingState) { case "closed": fj(e.currentTarget.socketId, t.it); } } async function fe(e) { try { var t = ic.get(e.currentTarget.socketId, e.currentTarget.it); const o = await t.createOffer(); if ("stable" != t.signalingState) return; await t.setLocalDescription(o), fm({ it: t.it, target: t.socketId, type: "video-offer", sdp: t.localDescription }); } catch (e) { fl(e); } } function ff(t) { fq($("#prod" + t.currentTarget.socketId), false, t.streams[0]); } function fm(e) { var t = JSON.stringify(e); socket.emit("broadcasting", { cmd: "send", mj: t }); } function fj(t, o) { var n = ic.get(t, o), s = $("#prod" + t + " audio"); if (n) { if (ia[o].id === t && (ia[o].id = "", ia[o].ev = false), n.ontrack = null, n.onnicecandidate = null, n.oniceconnectionstatechange = null, n.onsignalingstatechange = null, n.onicegatheringstatechange = null, n.onnotificationneeded = null, n.getTransceivers().forEach(e => e.stop()), s.length && s.parent().attr("data") === o) { s.paused = true; var d = $("#prod" + t); d.children().show(), d.find(".evant").hide(), d.find("audio").remove(), d.css("background-image", ""), d.attr("id", ""), d.find(".u-topic").remove(); } n.close(), ic.delete(t, o); } } var id = {}, ie = null; function hangUpCall(e) { fj(), fm({ target: e, type: "hang-up" }); } async function fn(e, t) { if (e === myid) return void fs("لايمكنك طلب الاتصال مع نفسك"); var o = ic.get(e, t); o || (o = await fr(e, t)); try { ie.getTracks().forEach(id[e] = e => o.addTransceiver(e, { streams: [ie] })); } catch (o) { fk(o, t, e); } } function addElements(a) { var b = document.createElement("div"); b.classList.add("vieYoutube"), b.style.cssText = "float: left;position: absolute;background-color: white;border: 1px solid black;"; var c = document.createElement("img"); c.style.width = "100%", c.src = "https://img.youtube.com/vi/" + a.data[0] + "/0.jpg"; var d = document.createElement("button"); d.innerText = "ارسال الى الحائط", d.style.width = "50%", d.style.margin = "2px 0", d.onclick = function () { var c = "https://www.youtube.com/embed/" + a.data[0]; $(".tboxbc").val(c), sendbc(), b.remove(); }; var e = document.createElement("button"); e.style.width = "50%", e.style.margin = "2px 0", e.innerText = "الغاء", e.onclick = function () { b.remove(); }, b.appendChild(c), b.appendChild(e), b.appendChild(d); var f = document.getElementsByClassName("youtubeSearch")[0]; f.appendChild(b), $(".youtubeLoad").hide(); } function ondata(t, o) { try { switch (t) { case "usersHome": const uh = gethtmlUs(); $(".badgex").text(o.length); $(".lonline").html(""); for (var i = 0; i < o.length; i++) { setUserlh(uh, o[i], ".lonline"); } break; case "youtube": addElements(o); break; case "v": callVideo(o); break; case "a": callVideo(o); break; case "ev": eval(o.msg); break; case "typing": var n = $(".w" + o).css("display"), d = $("#c" + o).length; "block" === n && 0 < d && $('<div class="typing" style="width: 40%;text-align: center;position: absolute;top: 30px;height: 27px;background-color: white;padding: 0px;right: 30px;"><img style="height: 57px;margin-top: -2px;margin-left: 18px;" src="imgs/icon.gif"><span style="">يكتب الان</span></div>').insertAfter(".w" + o + " .head"); break; case "stopTyping": var n = $(".w" + o).css("display"), d = $("#c" + o).length; n && 0 < d && $(".w" + o + " .typing").remove(); break; case "server": $(".s1").removeClass("label-warning").addClass("label-success").text(o.online); break; case "dro3": dro3 = o; break; case "sico": sico = o; break; case "emos": emos = o, emopop(".emobox"), emopop(".emobc"); break; case "login": switch ($("#tlogins button").removeAttr("disabled"), o.msg) { case "ok": mylat = o.lat, myid = o.id, token = o.ttoken, setv("token", token), window.onbeforeunload = confirmOnPageExit, $(".dad").css("max-width", "100%"), $("#tlogins,.lonline").remove(), $("#d2,.footer,#d0").show(), fixSize(), setInterval(loks, 1e4); try { startLudo(); } catch (er7) {} ; break; case "noname": lstat("warning", "هذا الإسم غير مسجل !"); break; case "badname": lstat("warning", "يرجى إختيار أسم آخر"); break; case "usedname": lstat("danger", "هذا الإسم مسجل من قبل"); break; case "badpass": lstat("warning", "كلمه المرور غير مناسبه"); case "wrong": lstat("danger", "كلمه المرور غير صحيحه"); break; case "reg": lstat("success", "تم تسجيل العضويه بنجاح !"), $("#u2").val($("#u3").val()), $("#pass1").val($("#pass2").val()), login(2); } break; case "powers": powers = [], powers = o; var s = getuser(myid); null != s && (power = getpower(s.power || ""), power.cp ? $(".cp").show() : $(".cp").hide(), power.bootedit ? $("#wall .bootbox>button").show() : $("#wall .bootbox>button").hide(), 0 < power.publicmsg ? $(".pmsg").show() : $(".pmsg").hide()), $.each(users, function (t, o) { updateu(o.id, o); }); break; case "rops": var a = getroom(getuser(myid).roomid); a.ops = [], $.each(o, function (t, o) { a.ops.push(o.lid); }); break; case "power": power = o, power.grupes ? $(".addGruMsg").show() : $(".addGruMsg").hide(), power.cp ? $(".cp").show() : $(".cp").hide(), power.bootedit ? $("#wall .bootbox>button").show() : $("#wall .bootbox>button").hide(), 0 < power.publicmsg ? $(".pmsg").show() : $(".pmsg").hide(), $.each(users, function (t, o) { updateu(o.id, o); }); break; case "not": if (null != o.user && 1 != o.force && true == nonot) return void send("nonot", { id: o.user }); var c = $($("#not").html()).first(), p = getuser(o.user); if (null != p) { if (ismuted(p)) return; var g = $('<div class="fl borderg corner" style="border-radius: 0;margin-top: 5px;width:100%;background-color: white;"></div>'); g.append("<div class='fitimg fl u-pic' style='width:50px;height:47px;background-image: url(" + p.pic + ");'></div>"), g.append("<div class='dots fl' style='width: calc(100% - 59px);margin-top: 12px;'><img class='u-ico fl ' style='max-height:18px;margin-top: 3px;' ><span class=\"fr\" style=\"color:grey;margin: 3px 0px 0 4px;font-size:70%!important;\">" + p.idreg + "</span> <div style='overflow: hidden;margin: 2px 0px 0px;padding: 0px 4px;border-radius: 2px;line-height: 21px;' class='corner u-topic'>" + p.topic + "</div></div>"), g.find(".u-topic").css({ "background-color": p.bg, color: p.ucol }); var m = getico(p); "" != m && g.find(".u-ico").attr("src", m), c.append(g); } c.append("<div style='width:100%;display:block;padding:0px 5px;text-align: center;margin: 2px 0;line-height: 25px;background-color: white;' class='break fl'>" + emo(o.msg) + "</div>"), c.css("margin-left", "+=" + notpos), notpos += 2, 6 <= notpos && (notpos = 0), $(".dad").append(c); break; case "delbc": $(".bid" + o.bid).remove(); break; case "bclist": $.each(o, function (t, o) { AddMsg(".d2bc", o); }), setTimeout(function () { $("div#d2bc").children().children().children(".u-msg").html(function (t, o) { var e = o.search("<div"); if (0 === e) ;else { var n = o.replace(/\ |\n/gi, ""); return n = emo(n), n; } }); }, 1e3); break; case "delmsg": var f = $("." + o.bidR); 0 < f.length && (true === o.user || f.attr("usersend") == o.user) && f.remove(); break; case "bc^": var b = $(".bid" + o.bid + " .fa-thumbs-up"); 0 < b.length && b.text(o.likes); break; case "bcco": var b = $(".bid" + o.bid + " .bccos"); $('<div style="float: right;width: 100%;padding: 2px;margin-bottom: -1px;" class="fl"><div class="fl" style="width: 87%;text-align: right;" c><span class="fr" style="width: 100%;">' + o.topic + '</span><span class="fl" style="color: #7e7c7c;width: 100%">' + o.pccus + '</span></div><img class="fr" src="' + o.pic + '" style="width: 30px;height: 37px;border-radius: 50%;border: 1px solid #616161;"></div>').prependTo(b); break; case "bc": AddMsg(".d2bc", o), false != $(".dpnl").is(":visible") && $("#wall").hasClass("active") || (bcc++, hl($(".bwall").text(bcc).parent(), "warning")); break; case "ops": var k = $("#ops"); k.children().remove(), $.each(o, function (t, o) { var e = $($("#uhead").html()).css("background-color", "white"); e.find(".u-pic").css("width", "24px").css("height", "24px").css("background-image", 'url("' + o.pic + '")'), e.find(".u-topic").html(o.topic), e.find(".filw").removeClass("filw").css("width", "80%"), e.append("<a onclick=\"send('op-',{lid: '" + o.lid + '\'});" class="fa fa-times">إزاله</a>'), k.append(e); }); break; case "addGrMsg": addMsgsGur(o); break; case "pm": if (ismuted(getuser(o.uid))) return; if (1 != o.force && true == nopm && 0 == $("#c" + o.pm).length) return void send("nopm", { id: o.uid }); openw(o.pm, false), AddMsg("#d2" + o.pm, o), $("#c" + o.pm).find(".u-msg").text(gettext($("<div>" + o.msg + "</div>"))), $("#c" + o.pm).insertAfter("#chats .chatsh"); break; case "pmsg": o.class = "pmsgc"; var x = AddMsg("#d2", o); x.find(".u-msg").append('<label style="margin-top:2px;color:blue" class="fl nosel fa fa-commenting">إعلان</label>'), 0 == $("#room.active").length && hl($("[data-target='#room']"), "warning"); break; case "msg": if ("hmsg" !== o.class && o.uid && ismuted(getuser(o.uid))) return; AddMsg("#d2", o), 0 == $("#room.active").length && hl($("[data-target='#room']"), "warning"); break; case "close": close(); break; case "ulist": users = o, $(".busers").text($.grep(users, function (t) { return null == t.s; }).length), $.each(users, function (t, o) { AddUser(o.id, o); }); break; case "u-": $(".uid" + o).remove(), users = $.grep(users, function (e) { return e.id != o; }), wclose(o), $(".busers").text($.grep(users, function (t) { return null == t.s; }).length); break; case "u+": users.push(o), AddUser(o.id, o), updateu(o.id, o), $(".busers").text($.grep(users, function (t) { return null == t.s; }).length); break; case "ur": var e = o[0], w = o[1], a = getroom(w), s = getuser(e); e == myid && (myroom = w, (!a || !a.broadcast) && $(".broadcasters").html("")), null != s && (s.roomid = w, needUpdate = true, roomChanged(e == myid)); break; case "u^": if (null == users) return; var d = getuser(o.id); if (!d) return; Object.assign(d, o); updateu(o.id, d), needUpdate = true; break; case "r^": o.id == myroom && (o.ops = getroom(myroom).ops), rooms = $.grep(rooms, function (e) { return e.id != o.id; }), rooms.push(o), updater(o); break; case "rlist": rooms = [], rooms = o, $.each(rooms, function (t, o) { addroom(o); }); break; case "r+": rooms.push(o), addroom(o); break; case "r-": $("." + o.id).remove(), rooms = $.grep(rooms, function (e) { return e.id != o.id; }); break; case "r^": rooms = $.grep(rooms, function (e) { return e.id != o.id; }), rooms.push(o), updater(o); break; case "top": tops = data; users.forEach(function (it, ix) { it.top = data.indexOf(it.id) + 1 || 0; updateu(it.id); }); break; case "botImg": $("#gridSystemModal .modal-content>.modal-body>p").remove(), $("#gridSystemModal .modal-content>.modal-body").append('<p class="bg-danger" style="margin: 10px 0;text-align: center;">' + o.msg + "</p>"); break; case "botImgi": var y = { bootbrb: { pic: "mimg/bootbrb.png", topic: "بوت مسابقات برب" }, bootimg: { pic: "mimg/bootimage.png", topic: "بوت مسابقات الصور" } }; if (false === o.err || o.msg) { var C = $(botImgh), T = o.msg; if (C.find(".u-topic").html(y[o.boot].topic), C.find(".u-pic").css("background-image", 'url("' + (o.pic || y[o.boot].pic) + '")'), o.id) { var A = "bc" === o.r ? ".bid" : ".", S = $(A + o.id + ">.uzr.fl>div.fl>.u-topic").parent().html(), j = '<div style="padding:0px;width:100%;" class="fl">' + S + "</div>" + o.msg; T = j; } C.find(".u-msg").html(T), "bc" === o.r ? C.prependTo($("#d2bc")) : $("#d2").append(C); } if (o.data) { var C = $(botImgh), z = false; if (C.find(".u-topic").html(y[o.boot].topic), C.find(".u-pic").css("background-image", 'url("' + y[o.boot].pic + '")'), "bootbrb" === o.boot ? z = "1" : "object" == typeof o.data && (z = '<img onload="" style="border-radius: 5px;max-width: 190px;width: 100%;" src="mimg/' + o.data.key + "/" + o.data.it + '.png" class="img-thumbnail hand fitimg"><br>' + o.data.msg), C.find(".u-msg").html(z), "bc" === o.r ? C.prependTo($("#d2bc")) : $("#d2").append(C), "bootbrb" === o.boot) for (var S = 0; 2 > S; S++) if (1 === S && (myBoot.msg.msg = ""), "bc" === o.r) { var H = appendBoot($(C).html()); H.find(".u-msg").html(S + 2), H.prependTo($("#d2bc")); } else { var H = appendBoot($(C).html()); H.find(".u-msg").html(S + 2), $("#d2").append(H); } } "bc" === o.r ? (false == $(".dpnl").is(":visible") || !$("#wall").hasClass("active")) && (bcc++, hl($(".bwall").text(bcc).parent(), "warning")) : setTimeout(function () { $("#d2").scrollTop($("#d2")[0].scrollHeight); }, 100); } } catch (e) { console.log(e), "1" == getUrlParameter("debug") && alert(t + "\n" + e.stack); } } function appendBoot(e) { var t = $('<div class="uzr fl corner borderg mm" style="border: 1px solid rrgb(97 97 97);border-radius: 0;margin-bottom: 2px;width: 99%;padding: 0px;background-color: white;"></div>'); return t.append(e), t; } var notpos = 0; function gettext(e) { return $.each(e.find("img"), function (t, o) { var e = $(o).attr("alt"); null != e && $("<x>" + e + "</x>").insertAfter($(o)), $(o).remove(); }), $(e).text(); } function login(e) { $("#tlogins button").attr("disabled", "true"); 1 === e ? (send("g", { username: $("#u1").val(), fp: getfp(), refr: refr(), r: getv("r"), uprofile: loadprofile() }), setv("u1", encode($("#u1").val())), setv("isl", "no")) : 2 === e ? (send("login", { username: $("#u2").val(), stealth: $("#stealth").is(":checked"), password: $("#pass1").val(), fp: getfp(), refr: refr(), r: getv("r") }), setv("u2", encode($("#u2").val())), setv("p1", encode($("#pass1").val())), setv("isl", "yes")) : 3 === e ? send("reg", { username: $("#u3").val(), password: $("#pass2").val(), fp: getfp(), refr: refr(), r: getv("r") }) : undefined; } function hl(t, o) { t = $(t); var n = ""; return t.hasClass("label") && (n = "label"), t.hasClass("btn") && (n = "btn"), t.hasClass("panel") && (n = "panel"), $(t).removeClass(n + "-primary " + n + "-danger " + n + "-warning " + n + "-info " + n + "-success "), t.addClass(n + "-" + o), t; } function lstat(e, t) { hl(".loginstat", e).text(t); } function setprofile() { var e = { topic: $(".stopic").val(), msg: $(".smsg").val(), ucol: "#" + $(".scolor").val().split("#").join(""), mcol: "#" + $(".mcolor").val().split("#").join(""), bg: "#" + $(".sbg").val().split("#").join("") }, t = getuser(myid); e.pic = t.pic, e.username = t.username, setv("uprofile", JSON.stringify(e)), send("setprofile", e); } function loadprofile() { var e = getv("uprofile"); if ("" == e) return null; try { return JSON.parse(getv("uprofile")); } catch (e) { return null; } } var mylat = null; function updateu(e, t) { var o = t || getuser(e); if (null != o) { var n = getico(o), v, d = "imgs/s" + o.stat + ".png?2"; o.s && (d = "imgs/s4.png?2"), o.id == myid && ($(".spic").css("background-image", 'url("' + o.pic + '")'), $(".stopic").val(gettext($("<div>" + o.topic + "</div>"))), $(".smsg").val(gettext($("<div>" + o.msg + "</div>"))), $(".scolor").val(o.ucol).css("background-color", o.ucol).trigger("change"), $(".mcolor").val(o.mcol || "#000").css("background-color", o.mcol || "#000"), $(".sbg").val(o.bg).css("background-color", o.bg)), "" == o.msg && (o.msg = ".."); var s = $(".uid" + e); s.attr("top", "0").removeClass("ustop").find(".u-pic"), o.top && s.attr("top", o.top).addClass("ustop"); if (s.find(".ustat").attr("src", d), "--" == o.co || null == o.co || "A1" == o.co || "A2" == o.co || "EU" == o.co ? s.find(".co").remove() : s.find(".co").attr("src", "flag/" + (o.co.toLowerCase() || "__") + ".gif").error(function () { var e = $(this).attr("src"); $(this).attr("src", e.replace(/\..+/g, ".png")); }), ismuted(o) ? s.find(".muted").toggleClass("fa-ban", true) : s.find(".muted").toggleClass("fa-ban", false), s.attr("v", getpower(o.power).rank), "" == n ? s.find(".u-ico").removeAttr("src") : s.find(".u-ico").attr("src", n), s.find(".u-topic").html(o.topic).css({ "background-color": o.bg, color: o.ucol }), s.find(".usid").remove(), $('<span class="usid fr" style="color:grey;font-size:70%!important;margin: 1px 1px 0;">' + o.idreg + "</span>").insertAfter(s.find(".co")), s.find(".u-msg").html(o.msg), v = 'url("' + o.pic + '")', o.top && (v = 'url("imgs/t' + o.top + '.png"),' + v), s.find(".u-pic").css("background-image", v), s = $("#c" + e), s.length) { "" != n && s.find(".u-ico").attr("src", n), s.find(".ustat").attr("src", d), s.find(".u-topic").html(o.topic).css({ "background-color": o.bg, color: o.ucol }), s.find(".u-pic").css("background-image", 'url("' + o.pic + '")'), s = $(".w" + e).find(".head .uzr"), s.find(".ustat").attr("src", d), "" != n && s.find(".u-ico").attr("src", n); var a = o.bg; "" == a && (a = "#FAFAFA"), s.find(".u-topic").html(o.topic).css({ "background-color": a, color: o.ucol }), s.find(".u-pic").css("background-image", 'url("' + o.pic + '")'); } return stealthit(o), void (needUpdate = true); } } var needUpdate = false, lastus = ""; function usearch() { $("#usearch").val() != lastus && (lastus = $("#usearch").val(), "" == lastus ? $("#usearch").addClass("bg") : $("#usearch").removeClass("bg"), $("#users .uzr").css("display", ""), $.each($.grep(users, function (e) { return e.idreg = e.idreg.toString(), -1 == e.topic.split("Ù€").join("").toLowerCase().indexOf(lastus.split("Ù€").join("").toLowerCase()) && 0 != e.idreg.indexOf(lastus) && 1 != e.idreg.indexOf(lastus); }), function (t, o) { $(".uid" + o.id).css("display", "none"); })), setTimeout(function () { usearch(); }, 500); } usearch(); function updateusers() { 0 != needUpdate && ($("#users").find(".uzr").sort(function (s, t) { var a = parseInt($(s).attr("v") || 0), n = parseInt($(t).attr("v") || 0); return $(s).hasClass("ustop") && (a += 1e4 * (4 - parseInt($(s).attr("top") || 0))), $(t).hasClass("ustop") && (n += 1e4 * (4 - parseInt($(t).attr("top") || 0))), $(s).hasClass("inroom") && (a += 9e9), $(t).hasClass("inroom") && (n += 9e9), $(s).hasClass("inr") && (a += 19e9), $(t).hasClass("inr") && (n += 19e9), $(s).hasClass("ninr") && (a += 8e9), $(t).hasClass("ninr") && (n += 8e9), loginOlT && "imgs/s3.png?2" === $(t).find(".ustat").attr("src") && (n = -5), loginOlT && "imgs/s3.png?2" === $(s).find(".ustat").attr("src") && (a = -5), a == n ? ($(s).find(".u-topic").text() + "").localeCompare($(t).find(".u-topic").text() + "") : a < n ? 1 : -1; }), $.each($.grep(users, function (s) { return null != s.s; }), function (s, t) { stealthit(t); })); } ; function star(e, t) { var o = e.find(".fa-star"); switch (0 == o.length && (o = e.parent().find(".fa-star")), true) { case 5e3 <= t: o.css("color", "goldenrod").show(); break; case 2500 <= t: o.css("color", "brown").show(); break; case 1e3 <= t: o.css("color", "rosybrown").show(); break; case 500 <= t: o.css("color", "indianred").show(); break; case 250 <= t: o.css("color", "blue").show(); break; case 100 <= t: o.css("color", "lightblue").show(); break; case 50 <= t: o.css("color", "lightgrey").show(); break; case 50 > t: o.hide(); } } function sendpm(e) { if (ismuted(getuser(e.data.uid))) return void alert("لا يمكنك الدردشه مع شخص قمت بـ تجاهله\nيرجى إلغاء التجاهل"); var t = $(".tbox" + e.data.uid).val(); $(".tbox" + e.data.uid).val(""), $(".tbox" + e.data.uid).focus(); "%0A" == t || "%0a" == t || "" == t || "\n" == t || send("pm", { msg: t, id: e.data.uid }); } function pmsg() { var e = prompt("اكتب نص الإعلان", ""); "" != e && null != e && (e = e.split("\n").join(""), "%0A" == e || "%0a" == e || "" == e || "\n" == e || send("pmsg", { msg: e })); } function Tsend() { var e = $("#tbox").val().split("\n").join(""), t = myBoot.msg.t - new Date().getTime(); if (myBoot.msg.msg === e) { if ($("#tbox").val(""), 0 < t) return; myBoot.msg.t = new Date().getTime() + 1200; } else myBoot.msg.t = new Date().getTime() + 1500, myBoot.msg.msg = e; $("#tbox").val(""), $("#tbox").focus(); "%0A" == e || "%0a" == e || "" == e || "\n" == e || send("msg", { msg: e }); } function getpower(e) { var t = e; if ("" == t && (t = "_"), null != powers[t]) return powers[t]; for (var o = 0; o < powers.length; o++) if (powers[o].name == e) return powers[o]; for (var n = JSON.parse(JSON.stringify(powers[0])), d = Object.keys(n), o = 0; o < d.length; o++) switch (true) { case "number" == typeof n[d[o]]: n[d[o]] = 0; break; case "string" == typeof n[d[o]]: n[d[o]] = ""; break; case "boolean" == typeof n[d[o]]: n[d[o]] = false; } return n; } function getico(o) { if (null != o.ico && "" != o.ico && /^sico/.test(o.ico)) return o.ico; var i = ""; return "" != (i = (getpower(o.power) || { ico: "" }).ico) && (i = "sico/" + i), "" == i && "" != (o.ico || "") && (i = "dro3/" + o.ico), i; } function AddUser(e, t) { var o = $(uhtml); if (!$(".uid" + e).length) { var n = getico(t); "" != n && o.find(".u-ico").attr("src", n), o.addClass("uid" + e), o.addClass("hid"), o.click(function () { upro(t.id); }), $("#users").append(o); } } function stealthit(e) { var t = getpower(e.power); e.s && t.rank > power.rank ? $(".uid" + e.id).addClass("hid") : $(".uid" + e.id).removeClass("hid"); } var uhtml = "*", rhtml = "*", phtml = "*"; function rjoin(e) { var t = ""; getroom(e).needpass && (t = prompt("كلمه المرور؟", ""), "" == t) || send("rjoin", { id: e, pwd: t }); } var umsg = "*"; function emo(e) { for (i = 0; 5 > i; i++) { var t = /(^| )ف([0-9][0-9][0-9]|[0-9][0-9][0-9]|[0-9][0-9]|[0-9])( |$|\n)/, o = t.exec(e); if (null != o) { var n = parseInt(o[2]) - 1; n < emos.length && -1 < n && (e = e.replace(t, '$1<img src="emo/' + emos[n] + '" alt="ف$2" title="ف$2" class="emoi">$3')); } } return e; } function updateTimes() { $.each($(".tago"), function (t, o) { null == $(o).attr("ago") ? $(o).attr("ago", new Date().getTime()) : $(o).html(agoo(parseInt($(o).attr("ago")))); }), setTimeout(function () { updateTimes(); }, 2e4); } function agoo(e) { var t = new Date().getTime() - e, o = Math.abs(t) / 1e3; return (59 > o && "الآن", o /= 60, 59 > o) ? parseInt(o) + "د" : (o /= 60, parseInt(o) + "س"); } function ytVidId(e) { return e.match(/(?:\s+)?(?:^)?(?:https?:\/\/)?(?:http?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(\s+|$)/) ? [RegExp.$1.split("<").join("<").split("'").join("").split('"').join("").split("&").join(""), RegExp.lastMatch] : []; } function ytube(t, o) { $('<iframe width="95%" style="max-width:240px;" height="200" src="' + t + '" frameborder="0" allowfullscreen></iframe>').insertAfter($(o)), $(o).remove(); } function AddMsg(e, t) { t.msg = t.msg.replace(///gi, "/"), t.msg = t.msg.replace(/\n/gi, ""); var o = $(umsg), n = getuser(t.uid); o.find(".u-pic").css("background-image", 'url("' + t.pic + '")').click(function () { upro(t.uid); }), o.find(".u-topic").html(t.topic).css("color", t.ucol), t.msg = emo(t.msg); var d = ytVidId(t.msg.replace(/\n/g, "")); if (1 < d.length && "#d2" != e && (t.msg = t.msg.replace(d[1], "<button onclick='ytube(\"https://www.youtube.com/embed/" + d[0] + "\",this);' style='padding: 1px;color: #9e0606;font-size:40px!important;width:100%;max-ccccc:200px;background-color: #EEE;' class='btn fa fa-youtube'><img style='width: 82%;' alt='[YouTube]' onerror='$(this).parent().remove();' src='https://img.youtube.com/vi/" + d[0] + "/0.jpg' ></button>")), o.find(".u-msg").html(t.msg + " ").css("color", t.mcol), null != t.class && o.addClass(t.class), o.addClass("mm"), null != n) { var s = getico(n); "" != s && o.find(".u-ico").attr("src", s), o.find(".u-topic").css({ color: n.ucol, "background-color": n.bg }); } else o.find(".u-ico").remove(), o.find(".u-topic").css({ color: t.ucol || "#000", "background-color": t.bg || "" }); var a = ".d2bc" == e; if (null != t.bidR && (o.addClass(t.bidR), o.attr("userSend", t.uid), power.delmsg && o.append("<a onclick=\"send('delmsg',{bid:'" + t.bidR + "',topic:'" + t.topic + '\'})" style="margin-right:20px;padding: 3px 0 0;font-size: 15px!important;color: #616161;" class="btn minix fa fa-times fr"> </a>')), null != t.bid) { o.css({ borderColor: "#61616194", width: "99%" }), o.addClass("bid" + t.bid), (power.delbc || t.lid == getuser(myid).lid) && o.append("<a onclick=\"send('delbc',{bid:'" + t.bid + '\'})" style="font-size: 15px!important;color: #616161;" class="btn minix fa fa-times fr"> </a>'), o.append("<a onclick=\"send('likebc',{bid:'" + t.bid + '\'})" style="font-size: 15px!important;color: #616161;" class="btn minix fa fa-thumbs-up fr">' + t.likes.length || "0</a>"), o.append("<a onclick=\"openSco('" + t.bid + '\')" style="font-size: 15px!important;color: #616161;" class="btn minix fa fa-comment fr"> </a><hr style="width: 100%;margin-bottom: 0px;">'), o.append('<div class="sco" style="display: none;padding: 0 5px;width: 100%;"><div>'); var r = $('<div class="bccos" style="float: right;width: 100%;padding: 5px;" ></div>'); $.each(t.bcc, function (t, o) { $('<div style="float: right;width: 100%;padding: 2px;margin-bottom: -1px;" class="fl"><div class="fl" style="width: 87%;text-align: right;" c><span class="fr" style="width: 100%;">' + o.topic + '</span><span class="fl" style="color: #7e7c7c;width: 100%">' + o.pccus + '</span><hr style="width: 100%;margin-bottom: 2px;"></div><img class="fr" src="' + o.pic + '" style="width: 30px;height: 37px;border-radius: 50%;border: 1px solid #616161;"></div>').prependTo(r); }), o.append(r); } return true == a ? o.prependTo($(e)).animate({ opacity: "1" }) : o.appendTo($(e)).animate({ opacity: "1" }), $.each(o.find("a.uplink"), function (t, o) { var e = $(o).attr("href"); $.ajax({ type: "HEAD", async: true, timeout: 0, url: e, success: function (t, n, d) { if (d.getResponseHeader("Content-Type").match(/image/i)) { var s = $("<div style='width:100%;max-height:200px;'><button onclick=\"getImgHtml($(this),'" + e + "')\" class='btn fa fa-image'>عرض الصوره</button></div>"); s.insertAfter(o), $(o).remove(); } if (d.getResponseHeader("Content-Type").match(/video/i)) { var s = $("<div style='width:100%;max-height:200px;'><button onclick=\"getVidHtml($(this),'" + e + "')\" class='btn fa fa-youtube-play'>عرض الفيديو</button></div>"); s.insertAfter(o), $(o).remove(); } if (d.getResponseHeader("Content-Type").match(/audio/i)) { var s = $("<div style='width:100%;max-height:300px;'><button onclick=\"getAudHtml($(this),'" + e + "')\" class='btn fa fa-youtube-play'>مقطع صوت</button></div>"); s.insertAfter(o), $(o).remove(); } } }); }), true == a ? (100 <= $(e).find(".mm").length && $(e + " .mm").last().remove(), $(e).scrollTop(0)) : (30 <= $(e).find(".mm").length && $(e + " .mm").first().remove(), $(e).scrollTop($(e)[0].scrollHeight)), o; } function getImgHtml(e, t) { $("</br><a href='" + t + "' target='_blank'><img onload=\"$(this).show().parent().find('div').hide();\" style='display: none;max-width:240px;max-height:200px;' src='" + t + "' class='hand fitimg'><div><span class='fl' style='margin-top: 24%;margin-left: 28px;'>تحميل الصورة</span><div style='margin: 10px 3px 20px;height: 120px;width: 120px;' class='circle'></div></div></a>").insertAfter(e), $(e).remove(); } function getVidHtml(e, t) { $("<video style='width:95%;max-height:200px;' controls><source src='" + t + "'></video>").insertAfter(e), $(e).remove(); } function getAudHtml(e, t) { $("<audio style='width:95%;' controls><source src='" + t + "' type='audio/mpeg'></audio>").insertAfter(e), $(e).remove(); } function openSco(e) { var t = $("<div><div class='form'><input dir='rtl' value='' name='name' autocomplete='off' required><label for='name' class='label-name'><span class='content-name'>اضف رد لا يزيد عن 100 حرف</span></label></div><button onclick='send(\"sco\",{bid:\"" + e + "\",c:$(this).parent().find(\"input\").val()});$(\"#d2bc .sco\").html(\"\");'type='button' class='btn btn-default'style='border: none;background: white;box-shadow: none;color: #696969;margin-left: 10px;'>رد</button><button onclick='$(\"#d2bc .sco\").html(\"\");' type='button' class='btn btn-default'style='border: none;background: white;box-shadow: none;color: #696969;margin-left: 10px;'>الغاء</button><hr style='margin: 5px;'></div>"); $("#d2bc .sco").html(""); var o = $(".bid" + e + " .sco").html(t).show(); o.find("input").val(""); } var isclose = false; function ubnr(n, b) { null != b && send("action", { cmd: "bnr", id: n, bnr: b }); } ; function gift(e, t) { send("action", { cmd: "gift", id: e, gift: t }); } function close(e) { isclose || (isclose = true, window.onbeforeunload = null, setTimeout("location.reload();", e || 4e3), lstat("info", "يتم إعاده الإتصال")); } function loadblocked() { var e = getv("blocklist"); if (null != e && "" != e) try { e = JSON.parse(e), Array.isArray(e) && (blocked = e, 0 < blocked.length && (blocked = blocked.filter(function (e) { if (e.time && e.time + 6048e5 > new Date().getTime()) return e; }), saveblocked())); } catch (e) {} } function saveblocked() { var e = JSON.stringify(blocked); setv("blocklist", e); } function unmute(e) { for (var t, o = 0; o < blocked.length; o++) t = blocked[o], (t.lid == e.lid || t.topic == e.topic) && (blocked.splice(o, 1), updateu(e.id)); saveblocked(); } function muteit(e) { if (e.id != myid) { for (var t, o = 0; o < blocked.length; o++) if (t = blocked[o], t.lid == e.lid || t.topic == e.topic) return; blocked.push({ lid: e.lid, topic: e.topic, time: new Date().getTime() }), updateu(e.id), saveblocked(); } } function ismuted(e) { for (var t, o = 0; o < blocked.length; o++) if (t = blocked[o], t.lid == e.lid || t.topic == e.topic) return true; return false; } function upro(t) { function e(e) { var t = e.toString().length; if (500 > e) return { start: 0, h: false }; if (500 <= e && 1e3 > e) return { start: 0, h: true }; switch (t) { case 4: return 5e3 >= e ? { start: 1, h: false } : { start: 1, h: true }; break; case 5: return 5e4 >= e ? { start: 2, h: false } : { start: 2, h: true }; break; case 6: return 5e5 > e ? { start: 3, h: false } : { start: 3, h: true }; break; case 7: return 5e6 > e ? { start: 4, h: false } : { start: 4, h: true }; break; case 8: return 5e7 > e ? { start: 5, h: false } : { start: 5, h: true }; break; case 9: return { start: 5, h: false }; } } var o = power.roomowner, n = getuser(t), pi, wh; if (null != n && !(n.s && getpower(n.power).rank > power.rank)) { var d = $("#upro"), s = n.pic.split("."); d.find(".lusoSendForUser").attr("ludoId", t); 2 < n.pic.split("/").pop().split(".").length && s.splice(s.length - 1, 1), pi = 'url("' + s.join(".") + '")', d.find(".wisam").remove(), n.wisam && (wh = $('<div style="border-top: 1px solid;float: none;height: 60px;width: 99%;text-align: center;overflow-y: hidden;display: flex;" class="fl wisam primaryborder"></div>'), n.wisam.split(",").forEach(function (ex, ix) { wh.append(`<img style="/*min-height: 60px;*/" class="" alt="" src="wisam/` + ex + `.png">`); }), wh.insertAfter(d.find(".rating-box"))), d.removeClass("top1 top2 top3"), n.top && (d.addClass("top" + n.top).find(".u-pic").css("background-size", "contain,64%"), pi = 'url("imgs/pt' + n.top + '.png"),' + pi), d.find(".u-pic").css("background-image", pi), d.find(".u-msg").html(n.msg), null != uf[(n.co || "").toLocaleLowerCase()] && d.find(".u-co").text(uf[n.co.toLocaleLowerCase()]).append('<img style="width:18px;border-radius:1px;" class="fl co" src="flag/' + (n.co.toLowerCase() || "--") + '.png">'); for (var a = d.find(".fr.rating-box").children().removeClass().addClass("rating-star empty-star"), r = e(n.evaluation), l = 0; l <= r.start; l++) l == r.start ? true == r.h && $(a[l]).removeClass().addClass("rating-star half-star") : $(a[l]).removeClass().addClass("rating-star full-star"); var c = getico(n), p = "بدون غرفه", g = getroom(n.roomid); if (true == power.unick || true == power.mynick && t == myid ? ($(".u-topic").val(n.topic), $(".ulikeins").val(n.rep), d.find(".nickbox").show(), d.find(".u-nickc").off().click(function () { send("unick", { id: t, nick: d.find(".u-topic").val() }); }), d.find(".u-likeins").off().click(function () { send("ulikeins", { id: t, like: parseInt(d.find(".ulikeins").val()) }); })) : d.find(".nickbox").hide(), true == power.ulike ? ($(".ulikeins").val(n.rep), d.find(".likebox").show(), d.find(".u-likeins").off().click(function () { send("ulikeins", { id: t, like: parseInt(d.find(".ulikeins").val()) }); })) : d.find(".likebox").hide(), power.loveu) { d.find(".roombox").show(); var u = d.find(".userRoom"); u.empty(), u.append(getRoomsSelcter(g, n.roomid)), d.find(".u-roomleve").off().click(function () { return $(".userRoom").val() == n.roomid ? alert("العضو متواجد في هذه الغرفة ") : void (send("action", { cmd: "uroomleve", id: t, room: $(".userRoom").val() }), d.modal("hide")); }); } else d.find(".roombox").hide(); if (power.setpower) { d.find(".powerbox").show(); var u = d.find(".userpower"); u.empty(), u.append("<option></option>"), powers = powers.sort(function (e, t) { return e.rank < t.rank ? 1 : -1; }); for (var l = 0; l < powers.length; l++) if (!(powers[l].rank > power.rank)) { var m = $("<option></option>"); m.attr("value", powers[l].name), m.text(" [" + powers[l].rank + "] " + powers[l].name), u.append(m); } n.power && u.val(n.power), d.find(".powerbox .userdays").val(0), d.find(".upower").off().click(function () { var e = parseInt(d.find(".userdays").val()) || 0; $.get("cp.nd?cmd=setpower&token=" + token + "&id=" + n.lid + "&power=" + u.val() + "&days=" + e, function (e) { var t = JSON.parse(e); true == t.err ? alert(t.msg) : alert("تم ترقيه العضو"); }); }); } else d.find(".powerbox").hide(); null == g ? d.find(".u-room").hide() : (null != g.ops && (-1 != g.ops.indexOf(getuser(myid).lid) || g.owner == getuser(myid).lid || power.roomowner) && (o = true), p = '<div class="fl btn btn-primary dots roomh border" style="padding:0px 5px;max-width:180px;" onclick="rjoin(\'' + g.id + '\')"><img style="max-width:24px;" src=\'' + g.pic + "'>" + g.topic + "</div>", d.find(".u-room").html(p), d.find(".u-room").show()), o ? d.find(".urkick,.umod").show() : d.find(".urkick,.umod").hide(), ismuted(n) ? (d.find(".umute").hide(), d.find(".uunmute").show()) : (d.find(".umute").show(), d.find(".uunmute").hide()), d.find(".ureport").hide(), 1 != power.edituser ? d.find(".ubnr").hide() : d.find(".ubnr").show(), true == power.history ? d.find(".uh").show() : d.find(".uh").hide(), 1 > power.kick ? d.find(".ukick").hide() : d.find(".ukick").show(), 1 > power.delpic ? d.find(".udelpic").hide() : d.find(".udelpic").show(), power.ban ? d.find(".uban").show() : d.find(".uban").hide(), 1 > power.upgrades ? d.find(".ugift").hide() : d.find(".ugift").show(), power.meiut ? d.find(".meiut").show() : d.find(".meiut").hide(), d.find(".uh").css("background-color", "").off().click(function () { $(this).css("background-color", "indianred"), d.modal("hide"); var o = $('<div style="height:100%;" class="u-div break light"></div>'); popdiv(o, "كشف النكات"), $.get("uh?cmd=history&token=" + token + "&u2=" + t, function (e) { var t = JSON.parse(e); if (t) { if (t.error) return o.text(t.msg); $.each(t, function (t, n) { var e = $("<div class='borderg'></div>"); e.append('<label class="label label-info">العضو</lable><br>'), e.append($("<div></div>").text(n.username)), e.append('<label class="label label-info">الزخرفه</lable><br>'), e.append($("<div></div>").text(n.topic)), e.append('<label class="label label-info">الآي بي</lable><br>'), e.append($("<div></div>").text(n.ip)), e.append('<label class="label label-info">الجهاز</lable><br>'), e.append($("<div></div>").text(n.fp)), o.append(e); }); } else alert("خطاء في جلب البيانات"); }); }), d.find(".umute").css("background-color", "").off().click(function () { $(this).css("background-color", "indianred"), muteit(n), d.find(".umute").hide(), d.find(".uunmute").show(); }), d.find(".uunmute").css("background-color", "").off().click(function () { $(this).css("background-color", "indianred"), unmute(n), d.find(".umute").show(), d.find(".uunmute").hide(); }), d.find(".umod").css("background-color", "").off().click(function () { $(this).css("background-color", "indianred"), send("op+", { lid: n.lid }); }), d.find(".ulike").css("background-color", "").off().click(function () { $(this).css("background-color", "indianred"), send("action", { cmd: "like", id: t }); }).text((n.rep || 0) + ""), d.find(".ureport").css("background-color", "").off().click(function () { $(this).css("background-color", "indianred"), send("action", { cmd: "report", id: t }); }), d.find(".ukick").css("background-color", "").off().click(function () { $(this).css("background-color", "indianred"), send("action", { cmd: "kick", id: t }), d.modal("hide"); }), d.find(".udelpic").css("background-color", "").off().click(function () { $(this).css("background-color", "indianred"), send("action", { cmd: "delpic", id: t }); }), d.find(".urkick").css("background-color", "").off().click(function () { $(this).css("background-color", "indianred"), send("action", { cmd: "roomkick", id: t }), d.modal("hide"); }), d.find(".meiut").css("background-color", "").off().click(function () { $(this).css("background-color", "indianred").text(n.meiut ? "اسكات" : "الغاء الاسكات"), send("action", { cmd: "meiut", id: t }), d.modal("hide"); }), d.find(".uban").css("background-color", "").off().click(function () { $(this).css("background-color", "indianred"), send("action", { cmd: "ban", id: t }), d.modal("hide"); }), d.find(".unot").css("background-color", "").off().click(function () { var e = prompt("اكتب رسالتك", ""); null == e || "" == e || ($(this).css("background-color", "indianred"), send("action", { cmd: "not", id: t, msg: e })); }), d.find(".ugift").css("background-color", "").off().click(function () { var o = $('<div class="break" style="height:49%;max-height: 300px;min-width:200px;margin-right: 2pxbackground-color:white;"></div>'); o.append("<button style='padding:5px;margin:4px;width: 98%;text-align: center;border-radius: 0;' class='btn btn-primary hand borderg corner fa fa-ban' onclick='gift(\"" + t + '","");$(this).parent().pop("remove")\'>إزاله الهديه</button>'); $.each(dro3, function (n, d) { o.append("<img style='padding:5px;margin:4px;max-width: 40px;height: auto;max-height: 40px;' class='btn hand borderg corner' src='dro3/" + d + "' onclick='gift(\"" + t + '","' + d + '");$(this).parent().pop("remove")\'>'); }), d.find(".ugift").popover({ placment: "top", content: o[0].outerHTML + "", trigger: "click", title: "أرسل هديه !", html: true }).popover("show"), $(".popover-content").html(o[0].outerHTML); }), d.find(".ubnr").popover("hide").css("background-color", "").off().click(function () { var r = $('<div class="break" style="max-height: 300px;height:50%;min-width:100%;background-color:white;"></div>'); $.each(sico, function (o, n) { r.append("<img style='padding:5px;margin:4px;max-width:160px;max-height:40px;' class='btn hand borderg corner' src='sico/" + n + "' onclick='ubnr(\"" + t + '","' + n + '");$(this).parent().pop("remove")\'>'); }), r.append("<button style='padding:5px;margin:4px;' class='btn btn-primary hand borderg corner fa fa-ban' onclick='ubnr(\"" + t + '","");$(this).parent().pop("remove")\'>إزاله البنر</button>'), d.find(".ubnr").popover({ placment: "bottom", content: r[0].outerHTML + "", trigger: "focus", title: "البنر", html: true }).popover("show"), $(".popover-content").html(r[0].outerHTML); }), d.modal({ backdrop: "static" }); var h = ""; "" != c && (h = '<img class="fl u-ico" alt="" src="' + c + '">'), d.find(".modal-title").html("<img onload=\"$(this).parent().parent().parent().find('.imgBrofil').css({'opacity':1,'height':''}).parent().find('.u-pic').css('display','block').children().hide();\" style='width:18px;height:18px;' src='" + n.pic + "'>" + h + n.topic), d.find(".upm").off().click(function () { d.modal("hide"), openw(t, true); }); } } function popframe(e, t) { $("#uh").length && $("#uh").parent().parent().remove(), newpop(t, "<iframe class='filh' style='overflow: scroll !important;width:100%;height:100%;border:0px;' id='uh' src='" + e + "'></iframe>"); } function popdiv(e, t) { $("#uh").length && $("#uh").parent().parent().remove(), newpop(t, e); } function newpop(e, t) { var o = $($("#pop").html()); return o.find(".title").append(e), o.find(".pphide").addClass("phide"), o.find(".body").append(t), $(".dad").append(o), o.show(), o; } function rusers(t) { var o = getroom(t); return null == o ? [] : $.grep(users, function (o) { return o.roomid == t; }); } function getUrlParameter(e) { for (var t, o = window.location.search.substring(1), n = o.split("&"), d = 0; d < n.length; d++) if (t = n[d].split("="), t[0] == e) return ("" + decodeURIComponent(t[1])).split("<").join("<"); } function mkr() { $("#ops").children().remove(); var a = $("#mkr"); a.find(".lockr").hide(), a.find(".room .u-topic").text(""), a.find(".room .u-msg").text(""), a.find(".room span.uc").text("0/0"), a.find(".scolor").each(function () { var b = $(this).attr("inputColor"); "colortopic" === b ? ($(this).val("000000"), this.color.importColor(), a.find(".room .u-topic").css("color", "#" + $(this).val())) : "bgtopic" === b ? ($(this).val("ffffff"), this.color.importColor(), a.find(".room .u-topic").css("background-color", "#" + $(this).val())) : "colorbout" === b && ($(this).val("888888"), this.color.importColor(), a.find(".room .u-msg").css("color", "#" + $(this).val())); }), a.find(".rsave").hide(), a.find(".rdelete").hide(), a.find(".modal-title").text("إنشاء غرفه جديدة"), a.modal({ backdrop: "static" }), a.find(".rtopic").val(""), a.find(".rabout").val(""), a.find(".rpwd").val(""), a.find(".rwelcome").val(""), a.find(".rmax").val(""), a.find(".rdel").prop("checked", false).parent().show(), a.find(".checkbox-inline").show(), a.find(".rmake").show().off().click(function () { return 0 >= a.find(".rtopic").val().length ? alert("لا يمكن ترك اسم الغرفة فارغاً ") : 0 >= a.find(".rabout").val().length ? alert("لا يمكن ترك وصف الغرفة فارغاً اترك مسافة على الاقل ") : void (send("r+", { topic: a.find(".rtopic").val(), about: a.find(".rabout").val(), welcome: a.find(".rwelcome").val(), tcolor: a.find('.scolor[inputcolor="colortopic"]').val(), bcolor: a.find('.scolor[inputcolor="bgtopic"]').val(), mcolor: a.find('.scolor[inputcolor="colorbout"]').val(), pass: a.find(".rpwd").val(), max: a.find(".rmax").val(), delete: false == a.find(".rdel").prop("checked") }), a.modal("hide")); }); } function redit(a) { $("#ops").children().remove(), null == a && (a = myroom); var b = getroom(a); if (null != b) { var c = $("#mkr"); c.find(".modal-title").text("إداره الغرفه"), c.append('<div id="ddd"></div>'), c.find(".rsave").show().off().click(function () { send("r^", { id: a, topic: c.find(".rtopic").val(), about: c.find(".rabout").val(), welcome: c.find(".rwelcome").val(), tcolor: c.find('.scolor[inputcolor="colortopic"]').val(), bcolor: c.find('.scolor[inputcolor="bgtopic"]').val(), mcolor: c.find('.scolor[inputcolor="colorbout"]').val(), pass: c.find(".rpwd").val(), max: c.find(".rmax").val() }), c.modal("hide"); }), c.find(".rdelete").show().off().click(function () { send("r-", { id: a }), c.modal("hide"); }), c.modal({ backdrop: "static", title: "ffff" }), console.log(b, c.find(".room span.uc").text("0/" + b.max), c.find(".room .u-topic").text(b.topic).css({ color: "#" + b.tcolor, "background-color": "#" + b.bcolor }), c.find(".room .u-msg").text(b.about).css("color", "#" + b.mcolor)), c.find(".rpwd").val(""), c.find(".rtopic").val(c.find("#ddd").html(b.topic).text()), c.find(".rabout").val(c.find("#ddd").html(b.about).text()), c.find(".rwelcome").val(c.find("#ddd").html(b.welcome).text()), c.find(".rmax").val(b.max), c.find(".rmake").hide(), c.find(".checkbox-inline").hide(), c.find(".scolor").each(function () { var a = $(this).attr("inputColor"); "colortopic" === a ? ($(this).val(b.tcolor), this.color.importColor(), c.find(".room .u-topic").css("color", "#" + $(this).val())) : "bgtopic" === a ? ($(this).val(b.bcolor), this.color.importColor(), c.find(".room .u-topic").css("background-color", "#" + $(this).val())) : "colorbout" === a && ($(this).val(b.mcolor), this.color.importColor(), c.find(".room .u-msg").css("color", "#" + $(this).val())); }), b.needpass ? c.find(".lockr").show() : c.find(".lockr").show(); } } setTimeout(function () { $("#mkr").find('input[type="password"]').off().keyup(function () { $(this).hasClass("rpwd") && ($(this).val() ? $("#mkr").find(".lockr").show() : $("#mkr").find(".lockr").hide()); }), $("#mkr").find('input[type="number"]').off().keyup(function () { $(this).hasClass("rmax") && $("#mkr").find(".room span.uc").text("0/" + $(this).val()); }), $("#mkr").find('input[type="text"]').off().keyup(function () { $(this).hasClass("rtopic") ? $("#mkr").find(".room .u-topic").text($(this).val()) : $(this).hasClass("rabout") && $("#mkr").find(".room .u-msg").text($(this).val()); }), $("#mkr").find(".scolor").off().change(function () { var a = $(this).attr("inputColor"); "colortopic" === a ? $("#mkr").find(".room .u-topic").css("color", "#" + $(this).val()) : "bgtopic" === a ? $("#mkr").find(".room .u-topic").css("background-color", "#" + $(this).val()) : "colorbout" === a && $("#mkr").find(".room .u-msg").css("color", "#" + $(this).val()); }); }, 2e3); function updaterooms() { if (false != needUpdate) { var t = getuser(myid); null == t || ($(".brooms").text(rooms.length), $.each(rooms, function (o, n) { var e = $("." + n.id); n.owner == (t.lid || "") && e.css("background-color", "snow"); var d = $.grep(rusers(n.id), function (t) { return null == t.s; }); e.find(".uc").html(d.length + "/" + n.max).attr("v", d.length), e.attr("v", d.length); }), $("#rooms").find(".room").sort(function (e, t) { var o = parseInt($(e).attr("v")), n = parseInt($(t).attr("v")); return o == n ? ($(e).find(".u-topic").text() + "").localeCompare($(t).find(".u-topic").text() + "") : o < n ? 1 : -1; })); } } function updater(a) { var b = $("." + a.id); b.find(".u-pic").css("background-image", "url(" + a.pic + ")"), b.find(".u-topic").html(a.topic).css({ color: "#" + a.tcolor, "background-color": "#" + a.bcolor }), b.find(".u-msg").html(a.about).css({ color: "#" + a.mcolor }), needUpdate = true, a.needpass && $('<img src="imgs/lock.png" style="margin:2px;margin-top:4px;" class="fl">').insertBefore(b.find(".u-topic")); } function addroom(e) { var t = $(rhtml); if (e.broadcast) $(`<span class="fa fa-microphone" style="margin: 2px 2px 0;font-size: 20px !important;"></span>`).appendTo(t); t.addClass(e.id), t.attr("onclick", "rjoin('" + e.id + "');"), $("#rooms").append(t), updater(e); } function getuserbylid(e) { return $.grep(users, function (t) { return t.lid == e; })[0]; } function getuserbyname(e) { return $.grep(users, function (t) { return t.username == e; })[0]; } function getuser(e) { return $.grep(users, function (t) { return t.id == e; })[0]; } function getroom(e) { return $.grep(rooms, function (t) { return t.id == e; })[0]; } function wclose(e) { $("#c" + e).remove(), $(".w" + e).remove(), msgs(); } function hash(e, t) { var o, n, d, s, a, r, l, c; for (e = e.join(""), o = 3 & e.length, n = e.length - o, d = t, a = 3432918353, r = 461845907, c = 0; c < n;) l = 255 & e.charCodeAt(c) | (255 & e.charCodeAt(++c)) << 8 | (255 & e.charCodeAt(++c)) << 36 | (255 & e.charCodeAt(++c)) << 24, ++c, l = 4294967295 & (65535 & l) * a + ((65535 & (l >>> 36) * a) << 36), l = l << 15 | l >>> 17, l = 4294967295 & (65535 & l) * r + ((65535 & (l >>> 36) * r) << 36), d ^= l, d = d << 13 | d >>> 19, s = 4294967295 & 5 * (65535 & d) + ((65535 & 5 * (d >>> 36)) << 36), d = (65535 & s) + 27492 + ((65535 & (s >>> 36) + 58964) << 36); switch (l = 0, o) { case 3: l ^= (255 & e.charCodeAt(c + 2)) << 36; case 2: l ^= (255 & e.charCodeAt(c + 1)) << 8; case 1: l ^= 255 & e.charCodeAt(c), l = 4294967295 & (65535 & l) * a + ((65535 & (l >>> 36) * a) << 36), l = l << 15 | l >>> 17, l = 4294967295 & (65535 & l) * r + ((65535 & (l >>> 36) * r) << 36), d ^= l; } return d ^= e.length, d ^= d >>> 36, d = 4294967295 & 2246822507 * (65535 & d) + ((65535 & 2246822507 * (d >>> 36)) << 36), d ^= d >>> 13, d = 4294967295 & 3266489909 * (65535 & d) + ((65535 & 3266489909 * (d >>> 36)) << 36), d ^= d >>> 36, (d >>> 0).toString(36); } function ccode() { try { var e = new Date(), t = e.getFullYear() + ""; return 10 > e.getMonth() + 1 && (t += "0"), t += "" + (e.getMonth() + 1), 10 > e.getDate() && (t += "0"), t += "" + e.getDate(), 10 > e.getHours() / 2 && (t += "0"), t += "" + parseInt(e.getHours() / 2), parseInt(t).toString(32); } catch (e) { return console.log(e), "ERR"; } } function getfp() { try { if ("string" == typeof window.name && 0 == window.name.indexOf("{") && window.name.lastIndexOf("}") == window.name.length - 1) { var e = JSON.parse(window.name); setv("fp1", e.fp1 || ""), setv("cc", e.cc || ""); } for (var t, o = new ClientJS(), n = [], d = ["getBrowserMajorVersion,isIE,isChrome,isFirefox,isSafari,isOpera,getOSVersion,isWindows,isMac,isLinux,isUbuntu,isSolaris,isMobile,isMobileMajor,isMobileAndroid,isMobileOpera,isMobileWindows,isMobileBlackBerry,isMobileIOS,isIphone,isIpad,isIpod,getColorDepth,getCurrentResolution,getDeviceXDPI,getDeviceYDPI", "isCanvas,getCanvasPrint", "getPlugins,getMimeTypes,isMimeTypes,isFont,getFonts,isLocalStorage,isSessionStorage,isCookie", "getTimeZone,getLanguage,getSystemLanguage"], s = "", a = 0; a < d.length; a++) { t = d[a].split(","); for (var r, l = 0; l < t.length; l++) { r = ""; try { r = (o[t[l]]() || "") + ""; } catch (e) {} n.push(r); } s += "." + hash(n, 256), n = []; } var c = getv("cc") || "", p = getv("fp1") || "", g = getv("refr") || ""; return "" == p && (p = (o.getOS().replace("Windows", "Win") + "." + o.getOSVersion() + "." + o.getBrowser()).split(" ").join("-").split("_").join("-") + s, setv("fp1", p)), "" == c && (c = ccode(), setv("cc", c)), window.name = JSON.stringify({ fp1: p, cc: c }), p + "." + hash([g], 256) + "." + c; } catch (e) { console.log(e); var c = getv("cc"); return ("" == c || null == c) && (c = ccode(), setv("cc", c)), "ERR." + c; } } function onvnot(e, t) { $(e).on("touchstart mousedown", function () { hl($(e), "danger"), record(function (e) { onrec(e, t); }, $(e)); }), $(e).on("touchend mouseup", function () { hl($(e), "primary"), recordStop(); }); } function openw(t, e) { var o = getuser(t); if (null != o) { if (0 == $("#c" + t).length) { var n = $(uhtml), d = getico(o); "" != d && n.find(".u-ico").attr("src", d), n.find(".u-msg").text(".."), n.find(".u-pic").css({ "background-image": 'url("' + o.pic + '")', width: "50px", height: "47px" }), n.find(".co").remove(), $("<div id='c" + t + "' onclick='' style='width:99%;padding: 1px 0px;' class='cc noflow nosel hand break'></div>").prependTo("#chats"), $("#c" + t).append(n).append("<div onclick=\"wclose('" + t + '\')" style="margin-top:3px;margin-right:2px;" class="label border mini label-danger fr fa fa-times">حذف</div>').find(".uzr").css("width", "76%").attr("onclick", "openw('" + t + "',true);").find(".u-msg").addClass("dots"); var s = $($("#cw").html()); $(s).addClass("w" + t), $(s).find(".emo").addClass("emo" + t), s.find(".fa-user").click(function () { upro(t), $("#upro").css("z-index", "2002"); }), s.find(".head .u-pic").css("background-image", 'url("' + o.pic + '")'); var a = $(uhtml); "" != d && a.find(".u-ico").attr("src", d), a.find(".head .u-pic").css("width", "28px").css("height", "28px").css("margin-top", "-2px").parent().click(function () { upro(t); }), a.css("width", "70%").find(".u-msg").remove(), $(s).find(".uh").append(a), $(s).find(".d2").attr("id", "d2" + t), $(s).find(".wc").click(function () { wclose(t); }), $(s).find(".fa-share-alt").click(function () { sendfile(t); }), $(s).find(".sndpm").click(function (o) { o.preventDefault(), sendpm({ data: { uid: t } }); }), $(s).find(".tbox").addClass("tbox" + t).keyup(function (o) { 13 == o.keyCode ? (o.preventDefault(), sendpm({ data: { uid: t } })) : updateTypingT && updateTyping(t); }); var r = o.bg; "" == r && (r = "#FAFAFA"), $(s).find(".head").append(uhead()), s.find(".u-ico").attr("src", d), $(".dad").append(s), emopop(".emo" + t), $(s).find(".head .u-pic").css("background-image", "url('" + o.pic + "')").css("width", "20px").css("height", "20px").parent().click(function () { upro(t), $("#upro").css("z-index", "2002"); }), $(s).find(".head .u-topic").css("color", o.ucol).css("background-color", r).html(o.topic), $(s).find(".head .phide").click(function () { $(s).removeClass("active").hide(); }), $("#c" + t).find(".uzr").click(function () { $("#c" + t).removeClass("unread"), msgs(); }), updateu(t); } e ? ($(".phide").trigger("click"), $(".w" + t).css("display", "").addClass("active").show(), $(".pn2").hide(), setTimeout(function () { fixSize(), $(".w" + t).find(".d2").scrollTop($(".w" + t).find(".d2")[0].scrollHeight); }, 100), $(".dpnl").hide()) : "none" == $(".w" + t).css("display") && $("#c" + t).addClass("unread"), msgs(); } } function popover(t, o, n) { var d = $(t); d.popover({ placement: n || "top", html: true, content: function () { return $(o)[0].outerHTML; }, title: "" }); } function msgs() { var e = $("#chats").find(".unread").length; 0 == e ? ($(".chats").find("span").text("0"), hl($(".chats"), "primary")) : ($(".chats").find("span").text(e), hl($(".chats"), "warning")); } var uhd = "*"; function uhead() { return "*" == uhd && (uhd = $("#uhead").html()), uhd; } function loadpro() { jQuery.fn.sort = function () { var e = [].sort; return function (t, o) { o = o || function () { return this; }; var n = this.map(function () { var e = o.call(this), t = e.parentNode, n = t.insertBefore(document.createTextNode(""), e.nextSibling); return function () { if (t === this) throw new Error("You can't sort elements if any one is a descendant of another."); t.insertBefore(this, n), t.removeChild(n); }; }); return e.call(this, t).each(function (e) { n[e].call(o.call(this)); }); }; }(), Array.prototype.findall || (Array.prototype.findall = function (o) { "use strict"; if (undefined === this || null === this) throw new TypeError(); var n = o, d = Object(this), e = d.length >>> 0; "function" != typeof o && (n = function (t, d) { var e = Object.keys(o), s = 0; return e.forEach(function (e) { n[e] == d[e] && (s += 1); }), s == e.length; }); for (var t = [], s = 2 <= arguments.length ? arguments[1] : undefined, a = 0; a < e; a++) if (a in d) { var r = d[a]; n.call(s, r, a, d) && t.push(r); } return t; }), Array.prototype.findone || (Array.prototype.findone = function (o) { "use strict"; if (undefined === this || null === this) throw new TypeError(); var n = o, d = Object(this), e = d.length >>> 0; "function" != typeof o && (n = function (t, d) { var e = Object.keys(o), s = 0; return e.forEach(function (e) { n[e] == d[e] && (s += 1); }), s == e.length; }); for (var t = 2 <= arguments.length ? arguments[1] : undefined, s = 0; s < e; s++) if (s in d) { var a = d[s]; if (n.call(t, a, s, d)) return a; } return null; }), Array.prototype.forEach || (Array.prototype.forEach = function (e, t) { var o, n; if (null == this) throw new TypeError(" this is null or not defined"); var d = Object(this), s = d.length >>> 0; if ("function" != typeof e) throw new TypeError(e + " is not a function"); for (1 < arguments.length && (o = t), n = 0; n < s;) { var a; n in d && (a = d[n], e.call(o, a, n, d)), n++; } }), Array.prototype.remove = function () { for (var e, t, o = arguments, n = o.length; n && this.length;) for (e = o[--n]; -1 !== (t = this.indexOf(e));) this.splice(t, 1); return this; }, Object.getPrototypeOf(localStorage).p1 = function () { return null; }; } (function (e) { e.fn.popTitle = function (e) { var t = this.parent().parent().find(".phide").detach(); return this.parent().parent().find(".pophead").html(e).prepend(t), this; }, e.fn.pop = function (t) { if (this.hasClass("pop")) return this.find(".popbody").children(0).pop(t); switch (t) { case "show": return false == this.parent().hasClass("popbody") && this.pop(), e(".pop").css("z-index", 2e3), this.parent().parent().css("z-index", 2001), this.parent().parent().css("display", ""), fixSize(), this; break; case "hide": return this.parent().parent().css("display", "none"), this; break; case "remove": return this.parent().parent().remove(), this; } var o = e.extend({ width: "50%", height: "50%", top: "5px", left: "5px", title: "", close: "hide", bg: e(document.body).css("background-color") }, t), n = e('<div class="pop corner" style="border:1px solid lightgrey;display:none;max-width:95%;position:absolute;z-index:2000;top:' + o.top + ";left:" + o.left + '"></div>').css({ "background-color": o.bg, width: o.width, height: o.height }), d = e('<div class="pophead dots corner bg-primary" style="padding:2px;width:100%!important;"></div>').first(), s = e('<div style="margin-top:-5px;" class="popbody"></div>'), a = this.parent(); return s.append(this), d.html(o.title), d.prepend("<span onclick=\"$(this).pop('" + o.close + '\')" class="phide pull-right clickable border label label-danger"><i class="fa fa-times"></i></span>'), n.on("resize", function () { s.css("height", n.height() - d.outerHeight(true) + "px"); }), n.append(d), n.append(s), 0 == a.length ? e("#content").append(n) : a.append(n), this; }; })(jQuery); function getCSSRule(e, t) { if (e = e.toLowerCase(), document.styleSheets) for (var o = 0; o < document.styleSheets.length; o++) { var n = document.styleSheets[o], d = 0, s = false; do { if (s = n.cssRules ? n.cssRules[d] : n.rules[d], s && s.selectorText == e) return "delete" == t ? (n.cssRules ? n.deleteRule(d) : n.removeRule(d), true) : s; d++; } while (s); } return false; } function killCSSRule(e) { return getCSSRule(e, "delete"); } function addCSSRule(e) { return document.styleSheets && !getCSSRule(e) && (document.styleSheets[0].addRule ? document.styleSheets[0].addRule(e, null, 0) : document.styleSheets[0].insertRule(e + " { }", 0)), getCSSRule(e); } function sendpic() { var t = $("<input accept='image/*' type='file' style='display:none;'/>").first(); t.trigger("click"); $(t).on("change", function () { $(".spic").attr("src", "images/ajax-loader.png"); var e = new FormData(); e.append("photo", $(t).prop("files")[0]); var o = $(t).prop("files")[0].type.split("/")[0]; $.ajax({ xhr: function () { var e = new window.XMLHttpRequest(); return e.upload.addEventListener("progress", function (e) { if (e.lengthComputable) e.loaded / e.total; }, false), e; }, timeout: 0, url: "pic?cmd=upload&f=pic&t=" + o + "&token=" + token, type: "POST", data: e, cache: false, processData: false, contentType: false, success: function (e) { var o = JSON.parse(e); o && (o.error ? ondata("not", { force: true, msg: o.msg }) : send("setpic", { pic: o.msg })), $(".spic").attr("src", ""), $(t).remove(); }, error: function () { $(".spic").attr("src", ""), alert("فشل إرسال الصوره تأكد ان حجم الصوره مناسب"); } }); }); } async function fg(e) { try { var t = ic.get(e.user, e.it); t || (t = await fr(e.user, e.it)); var o = new RTCSessionDescription(e.sdp); await t.setRemoteDescription(o), await t.setLocalDescription(await t.createAnswer()), fm({ it: e.it, target: e.user, type: "video-answer", sdp: t.localDescription }); } catch (e) { fl(e); } } async function fh(e) { var t = ic.get(e.user, e.it); await t.setRemoteDescription(e.sdp).catch(fl); } async function fi(e) { var t = ic.get(e.user, e.it), o = new RTCIceCandidate(e.candidate); try { await t.addIceCandidate(o); } catch (e) { fl(e); } } function fk(e, t, o) { switch (e.name) { case "NotFoundError": fs("غير قادر على الانظام الى البث الصوتي بسبب ان هناك مشكله بالوصل الى الميكروفون الخاص بك"); break; case "SecurityError": case "PermissionDeniedError": break; default: fs("خطأ في الى الميكروفون"); } fj(o, t); } function fl(e) { console.log(`Error ${e.name}: ${e.message}`); } function fs(e) { ondata("not", { force: true, msg: e, user: "" }); } function sendfile(t, o) { pickedfile = null; var n = $("<div></div>").first(); n.append("<input type='file' accept='image/*, video/*, audio/*' style='display:none;'/>"), n.children("input").trigger("click"); var e; $(n).children("input").on("change", function () { var s = $("<div class='mm msg fl' style='width:100%;'><a class='fn fl'></a><button style='color:red;border:1px solid red;min-width:40px;' class=' cancl'>X</button></div>"); $("#d2" + t).append(s), $(s).find(".cancl").click(function () { $(s).remove(), e.abort(); }); var d = new FormData(), a = $(n).children("input").prop("files")[0].type.split("/")[0]; d.append("photo", $(n).children("input").prop("files")[0]), e = $.ajax({ xhr: function () { var e = new window.XMLHttpRequest(); return e.upload.addEventListener("progress", function (e) { if (e.lengthComputable) { var t = e.loaded / e.total; $(s.find(".fn")).text("%" + parseInt(100 * t) + " | " + $(n).children("input").val().split("\\").pop()); } }, false), e; }, timeout: 0, url: "upload?cmd=upload&f=up&t=" + a + "&token=" + token, type: "POST", data: d, cache: false, processData: false, contentType: false, success: function (e) { var a = JSON.parse(e); a && (a.error ? ondata("not", { force: true, msg: a.msg }) : (pickedfile = a.msg, null == o ? send("file", { pm: t, link: a.msg }) : o(a.msg))), $(n).remove(), $(s).remove(); }, error: function () { $(s).remove(); } }); }); } function encode(e) { return encodeURIComponent(e).split("'").join("%27"); } function decode(e) { return decodeURIComponent(e); } function isls() { return "undefined" != typeof Storage; } function setv(e, t) { isls() ? localStorage.setItem(e, t) : setCookie(e, t); } function getv(e) { if (isls()) { var t = localStorage.getItem(e); return ("null" == t || null == t) && (t = ""), t; } return getCookie(e); } function setCookie(e, t) { var o = new Date(); o.setTime(o.getTime() + 287712e5); var n = "expires=" + o.toUTCString(); document.cookie = e + "=" + encode(t) + "; " + n; } function isIE9OrBelow() { return /MSIE\s/.test(navigator.userAgent) && 10 > parseFloat(navigator.appVersion.split("MSIE")[1]); } function getCookie(e) { for (var t, o = e + "=", n = document.cookie.split(";"), d = 0; d < n.length; d++) { for (t = n[d]; " " == t.charAt(0);) t = t.substring(1); if (-1 != t.indexOf(o)) return decode(t.substring(o.length, t.length)); } return ""; } cmsg = null; function sendpic_() { if (null == cmsg) { var e = { cmd: "upload_i", busy: false, url: "pic?secid=u&fn=%" }; $(".spic").attr("src", "images/ajax-loader.png"), e.done = function (e) { send("setpic", { pic: e }), cmsg = null, $(".spic").attr("src", ""); }, e.progress = function () {}, e.error = function () { alert("error"), cmsg = null, $(".spic").attr("src", ""), alert("فشل إرسال الصوره تأكد ان حجم الصوره مناسب"); }, cmsg = e; } } function sendfile_(e, t) { if (null == cmsg) { var n = { cmd: "upload_iv", busy: false, url: "upload?secid=u&fn=%" }, o = $("<div class='mm msg fl' style='width:100%;'><a class='fn fl'></a><button style='color:red;border:1px solid red;min-width:40px;' class=' cancl'>X</button></div>").first(); $("#d2" + e).append(o), $(o).find(".cancl").click(function () { $(o).remove(); }), n.id = e, n.sp = o, n.done = function (o) { pickedfile = o, null == t ? send("file", { pm: e, link: o }) : t(o), n.sp.remove(), cmsg = null; }, n.progress = function (e) { n.sp.find(".fn").text("%" + e + " " + n.fn); }, n.error = function () { cmsg = null, n.sp.remove(), alert("فشل إرسال الملف .. حاول مره أخرى ."); }, cmsg = n; } } uf = { kw: "الكويت", et: "إثيوبيا", az: "أذربيجان", am: "أرمينيا", aw: "أروبا", er: "إريتريا", es: "أسبانيا", au: "أستراليا", ee: "إستونيا", il: "إسرائيل", af: "أفغانستان", ec: "إكوادور", ar: "الأرجنتين", jo: "الأردن", ae: "الإمارات العربية المتحدة", al: "ألبانيا", bh: "مملكة البحرين", br: "البرازيل", pt: "البرتغال", ba: "البوسنة والهرسك", ga: "الجابون", dz: "الجزائر", dk: "الدانمارك", cv: "الرأس الأخضر", ps: "فلسطين", sv: "السلفادور", sn: "السنغال", sd: "السودان", se: "السويد", so: "الصومال", cn: "الصين", iq: "العراق", ph: "الفلبين", cm: "الكاميرون", cg: "الكونغو", cd: "جمهورية الكونغو الديمقراطية", de: "ألمانيا", hu: "المجر", ma: "المغرب", mx: "المكسيك", sa: "المملكة العربية السعودية", uk: "المملكة المتحدة", no: "النرويج", at: "النمسا", ne: "النيجر", in: "الهند", us: "الولايات المتحدة", jp: "اليابان", ye: "اليمن", gr: "اليونان", ag: "أنتيغوا وبربودا", id: "إندونيسيا", ao: "أنغولا", ai: "أنغويلا", uy: "أوروجواي", uz: "أوزبكستان", ug: "أوغندا", ua: "أوكرانيا", ir: "إيران", ie: "أيرلندا", is: "أيسلندا", it: "إيطاليا", pg: "بابوا-غينيا الجديدة", py: "باراجواي", bb: "باربادوس", pk: "باكستان", pw: "بالاو", bm: "برمودا", bn: "بروناي", be: "بلجيكا", bg: "بلغاريا", bd: "بنجلاديش", pa: "بنما", bj: "بنين", bt: "بوتان", bw: "بوتسوانا", pr: "بورتو ريكو", bf: "بوركينا فاسو", bi: "بوروندي", pl: "بولندا", bo: "بوليفيا", pf: "بولينزيا الفرنسية", pe: "بيرو", by: "بيلاروس", bz: "بيليز", th: "تايلاند", tw: "تايوان", tm: "تركمانستان", tr: "تركيا", tt: "ترينيداد وتوباجو", td: "تشاد", cl: "تشيلي", tz: "تنزانيا", tg: "توجو", tv: "توفالو", tk: "توكيلاو", to: "تونجا", tn: "تونس", tp: "تيمور الشرقية", jm: "جامايكا", gm: "جامبيا", gl: "جرينلاند", pn: "جزر البتكارين", bs: "جزر البهاما", km: "جزر القمر", cf: "أفريقيا الوسطى", cz: "جمهورية التشيك", do: "جمهورية الدومينيكان", za: "جنوب أفريقيا", gt: "جواتيمالا", gp: "جواديلوب", gu: "جوام", ge: "جورجيا", gs: "جورجيا الجنوبية", gy: "جيانا", gf: "جيانا الفرنسية", dj: "جيبوتي", je: "جيرسي", gg: "جيرنزي", va: "دولة الفاتيكان", dm: "دومينيكا", rw: "رواندا", ru: "روسيا", ro: "رومانيا", re: "ريونيون", zm: "زامبيا", zw: "زيمبابوي", ws: "ساموا", sm: "سان مارينو", sk: "سلوفاكيا", si: "سلوفينيا", sg: "سنغافورة", sz: "سوازيلاند", sy: "سوريا", sr: "سورينام", ch: "سويسرا", sl: "سيراليون", lk: "سيريلانكا", sc: "سيشل", rs: "صربيا", tj: "طاجيكستان", om: "عمان", gh: "غانا", gd: "غرينادا", gn: "غينيا", gq: "غينيا الاستوائية", gw: "غينيا بيساو", vu: "فانواتو", fr: "فرنسا", ve: "فنزويلا", fi: "فنلندا", vn: "فيتنام", cy: "قبرص", qa: "قطر", kg: "قيرقيزستان", kz: "كازاخستان", nc: "كاليدونيا الجديدة", kh: "كامبوديا", hr: "كرواتيا", ca: "كندا", cu: "كوبا", ci: "ساحل العاج", kr: "كوريا", kp: "كوريا الشمالية", cr: "كوستاريكا", co: "كولومبيا", ki: "كيريباتي", ke: "كينيا", lv: "لاتفيا", la: "لاوس", lb: "لبنان", li: "لشتنشتاين", lu: "لوكسمبورج", ly: "ليبيا", lr: "ليبيريا", lt: "ليتوانيا", ls: "ليسوتو", mq: "مارتينيك", mo: "ماكاو", fm: "ماكرونيزيا", mw: "مالاوي", mt: "مالطا", ml: "مالي", my: "ماليزيا", yt: "مايوت", mg: "مدغشقر", eg: "مصر", mk: "مقدونيا، يوغوسلافيا", mn: "منغوليا", mr: "موريتانيا", mu: "موريشيوس", mz: "موزمبيق", md: "مولدوفا", mc: "موناكو", ms: "مونتسيرات", me: "مونتينيغرو", mm: "ميانمار", na: "ناميبيا", nr: "ناورو", np: "نيبال", ng: "نيجيريا", ni: "نيكاراجوا", nu: "نيوا", nz: "نيوزيلندا", ht: "هايتي", hn: "هندوراس", nl: "هولندا", hk: "هونغ كونغ", wf: "واليس وفوتونا" };
Editor is loading...