Advertisement
Guest User

Epic Chat Menu w/event loader

a guest
Dec 26th, 2018
766
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 98.36 KB | None | 0 0
  1.  
  2. //for educational purposes only
  3. //Asmodeus 2018 v4
  4.  
  5. //MENU
  6. //-> Init Socket Event Handlers
  7. //-> -> PARROT [on/off]
  8. //-> -> AUTO POKE [on/off]
  9. //-> Zalgo Generator Options (# KEY TO TRIGGER ZALGO)
  10. //-> Display Content Length (Your text input box)
  11.  
  12.  
  13. //Use Injector or obfuscate the code and paste in console.
  14.  
  15. var idleTime = 0;
  16. var doubleNotif = false;
  17. var autoPoke = false;
  18.  
  19. //UI INJECT
  20. document.getElementById("chatTextWrapper").innerHTML +=
  21. "<center><div style='display:none; background:white;' id='infoPanel'></div></center>" +
  22. "<div style='position: absolute; top:5px; right: 21px; border-radius: 5px; padding: 4px;' id='hiddenmenu'><a href='#' onclick='openCloseMenu()' class='btn btn-danger' style='width:100%;'>ASMODEUS MENU</a></div>" +
  23. "<form id='asmomenu' style='display:none; position: absolute; top:5px; right: 21px; background: grey; border-radius: 5px; padding: 4px;' id='asmodeus_form' action=''>" +
  24. "<font style='border-radius:5px; background:red;padding:2px 2px 2px 2px;'>ASMODEUS PANEL</font><br>" +
  25. "<a href='#' id='initialiser' onclick='initSocket()' class='btn btn-primary' style='width:100%;'>Init Socket</a>" +
  26. "<div class='dropdown'>" +
  27. "<button style='width:100%' class='btn btn-primary dropdown-toggle' data-toggle='dropdown' aria-expanded='false' type='button'>Zalgo Editor/Help</button>" +
  28. "<div style='padding:10px 10px 10px 10px; background:lightgrey;' class='dropdown-menu' role='menu'>" +
  29. "<p class='dropdown-item' role='presentation'>" +
  30. "<fieldset style='margin:3px 3px 3px 3px; background:white; border-radius:5px;'><center>" +
  31. "<h4>INK TEXT</h4>" +
  32. "<input id='asmodeus_opt_up' type='checkbox'> INK UP</input><br>" +
  33. "<input id='asmodeus_opt_mid' type='checkbox' checked=''> INK MIDDLE</input><br>" +
  34. "<input id='asmodeus_opt_down' type='checkbox'> INK DOWN</input></center>" +
  35. "</fieldset>" +
  36. "<fieldset style='margin:3px 3px 3px 3px; background:white; border-radius:5px;'><center>" +
  37. "<h4>INK WEIGHT</h4>" +
  38. "<input id='asmodeus_opt_mini' type='radio' name='optval' checked=''> LIGHT INK</input><br>" +
  39. "<input id='asmodeus_opt_normal' type='radio' name='optval'> HEAVY INK</input><br>" +
  40. "<input id='asmodeus_opt_maxi' type='radio' name='optval'> MAX INK</input></center>" +
  41. "</fieldset></p>" +
  42. "<center>Press # to Zalgo your Text</center>" +
  43. "</div>" +
  44. "</div>" +
  45. "<a href='#' onclick='showHideLength()' class='btn btn-warning' style='width:100%;'>Display Content Length</a>" +
  46. "<a href='#' onclick='openCloseMenu()' class='btn btn-danger' style='width:100%;'>Close Menu</a>" +
  47. "<div id='menu'></div>"
  48.  
  49. "</form>";
  50.  
  51. //MENU BOOL OPEN-CLOSE
  52. var menudisplay = ["block", "none"];
  53. function openCloseMenu() {
  54. document.getElementById('asmomenu').style.display = menudisplay[0];
  55. document.getElementById('hiddenmenu').style.display = menudisplay[1];
  56. swapTemp = menudisplay[0];
  57. swapTemp2 = menudisplay[1];
  58. menudisplay[0] = swapTemp2;
  59. menudisplay[1] = swapTemp;
  60. }
  61. var lengthdisplay = ["block", "none"];
  62. function showHideLength() {
  63. document.getElementById('infoPanel').style.display = lengthdisplay[0];
  64. swapTemp_length = lengthdisplay[0];
  65. swapTemp2_length = lengthdisplay[1];
  66. lengthdisplay[0] = swapTemp2_length;
  67. lengthdisplay[1] = swapTemp_length;
  68. }
  69.  
  70. //VARIABLE TIMER INTERVAL
  71. setInterval(function () { //JUST USE A TIMER, COULD USE A HANDLER
  72. try {
  73. //DYNAMIC ADDED BUTTONS
  74. document.getElementById('parrot').innerHTML = "PARROT [" + doubleNotif + "]";
  75. document.getElementById('poke').innerHTML = "AUTO POKE [" + autoPoke + "]";
  76.  
  77. //Emoji :E REPLACE
  78. if (document.getElementsByClassName('emojionearea-editor')[0].innerHTML.indexOf(":E") > -1) {
  79. document.getElementsByClassName('emojionearea-editor')[0].innerHTML = document.getElementsByClassName('emojionearea-editor')[0].innerHTML.replace(":E", ":sunglasses:");
  80. }
  81.  
  82. //CONTENT LENGTH DISPLAY
  83. document.getElementById('infoPanel').innerHTML = "Content Length: " + document.getElementsByClassName('emojionearea-editor')[0].innerHTML.length;
  84.  
  85. //ZALGO----------------------------------------------------------
  86. if (document.getElementsByClassName('emojionearea-editor')[0].innerHTML.indexOf("#") > -1) {
  87. asmodeus_textarea('asmodeus_txt');
  88. }
  89. //End ZALGO-------------------------------------------------------
  90. } catch (ex) {
  91. console.log("ERROR: " + ex);
  92. }
  93. }, 100);
  94.  
  95. //var pressed = false;
  96. //document.querySelector('#message').addEventListener('keypress',function(e) {
  97. // var key = e.which || e.keyCode;
  98. // if(key === 13) {
  99. // pressed = true;
  100. // console.log("Pressed");
  101. // }
  102. //});
  103.  
  104.  
  105. //ZALGO---------------------------------------------------------------
  106. function asmodeus_textarea(id) {
  107. var p = document.getElementById(id);
  108. var el = document.getElementsByClassName('emojionearea-editor')[0].innerHTML.replace("#", "").replace("<br>", "");
  109. var txt = el;
  110. var newtxt = '';
  111. for (var i = 0; i < txt.length; i++) {
  112. if (is_asmodeus_char(txt.substr(i, 1)))
  113. continue;
  114. var num_up;
  115. var num_mid;
  116. var num_down;
  117. //add the normal character
  118. newtxt += txt.substr(i, 1);
  119. //options
  120. if (document.getElementById('asmodeus_opt_mini').checked) {
  121. num_up = rand(8);
  122. num_mid = rand(2);
  123. num_down = rand(8);
  124. }
  125. else if (document.getElementById('asmodeus_opt_normal').checked) {
  126. num_up = rand(16) / 2 + 1;
  127. num_mid = rand(6) / 2;
  128. num_down = rand(16) / 2 + 1;
  129. }
  130. else //maxi
  131. {
  132. num_up = rand(64) / 4 + 3;
  133. num_mid = rand(16) / 4 + 1;
  134. num_down = rand(64) / 4 + 3;
  135. }
  136. if (document.getElementById('asmodeus_opt_up').checked)
  137. for (var j = 0; j < num_up; j++)
  138. newtxt += rand_asmodeus(asmodeus_up);
  139. if (document.getElementById('asmodeus_opt_mid').checked)
  140. for (var j = 0; j < num_mid; j++)
  141. newtxt += rand_asmodeus(asmodeus_mid);
  142. if (document.getElementById('asmodeus_opt_down').checked)
  143. for (var j = 0; j < num_down; j++)
  144. newtxt += rand_asmodeus(asmodeus_down);
  145. }
  146. document.getElementsByClassName('emojionearea-editor')[0].innerHTML = newtxt;
  147. //done
  148. }
  149. var asmodeus_up = [
  150. '\u030d', /* ̍ */ '\u030e', /* ̎ */ '\u0304', /* ̄ */ '\u0305', /* ̅ */
  151. '\u033f', /* ̿ */ '\u0311', /* ̑ */ '\u0306', /* ̆ */ '\u0310', /* ̐ */
  152. '\u0352', /* ͒ */ '\u0357', /* ͗ */ '\u0351', /* ͑ */ '\u0307', /* ̇ */
  153. '\u0308', /* ̈ */ '\u030a', /* ̊ */ '\u0342', /* ͂ */ '\u0343', /* ̓ */
  154. '\u0344', /* ̈́ */ '\u034a', /* ͊ */ '\u034b', /* ͋ */ '\u034c', /* ͌ */
  155. '\u0303', /* ̃ */ '\u0302', /* ̂ */ '\u030c', /* ̌ */ '\u0350', /* ͐ */
  156. '\u0300', /* ̀ */ '\u0301', /* ́ */ '\u030b', /* ̋ */ '\u030f', /* ̏ */
  157. '\u0312', /* ̒ */ '\u0313', /* ̓ */ '\u0314', /* ̔ */ '\u033d', /* ̽ */
  158. '\u0309', /* ̉ */ '\u0363', /* ͣ */ '\u0364', /* ͤ */ '\u0365', /* ͥ */
  159. '\u0366', /* ͦ */ '\u0367', /* ͧ */ '\u0368', /* ͨ */ '\u0369', /* ͩ */
  160. '\u036a', /* ͪ */ '\u036b', /* ͫ */ '\u036c', /* ͬ */ '\u036d', /* ͭ */
  161. '\u036e', /* ͮ */ '\u036f', /* ͯ */ '\u033e', /* ̾ */ '\u035b', /* ͛ */
  162. '\u0346', /* ͆ */ '\u031a' /* ̚ */
  163. ];
  164. var asmodeus_down = [
  165. '\u0316', /* ̖ */ '\u0317', /* ̗ */ '\u0318', /* ̘ */ '\u0319', /* ̙ */
  166. '\u031c', /* ̜ */ '\u031d', /* ̝ */ '\u031e', /* ̞ */ '\u031f', /* ̟ */
  167. '\u0320', /* ̠ */ '\u0324', /* ̤ */ '\u0325', /* ̥ */ '\u0326', /* ̦ */
  168. '\u0329', /* ̩ */ '\u032a', /* ̪ */ '\u032b', /* ̫ */ '\u032c', /* ̬ */
  169. '\u032d', /* ̭ */ '\u032e', /* ̮ */ '\u032f', /* ̯ */ '\u0330', /* ̰ */
  170. '\u0331', /* ̱ */ '\u0332', /* ̲ */ '\u0333', /* ̳ */ '\u0339', /* ̹ */
  171. '\u033a', /* ̺ */ '\u033b', /* ̻ */ '\u033c', /* ̼ */ '\u0345', /* ͅ */
  172. '\u0347', /* ͇ */ '\u0348', /* ͈ */ '\u0349', /* ͉ */ '\u034d', /* ͍ */
  173. '\u034e', /* ͎ */ '\u0353', /* ͓ */ '\u0354', /* ͔ */ '\u0355', /* ͕ */
  174. '\u0356', /* ͖ */ '\u0359', /* ͙ */ '\u035a', /* ͚ */ '\u0323' /* ̣ */
  175. ];
  176. var asmodeus_mid = [
  177. '\u0315', /* ̕ */ '\u031b', /* ̛ */ '\u0340', /* ̀ */ '\u0341', /* ́ */
  178. '\u0358', /* ͘ */ '\u0321', /* ̡ */ '\u0322', /* ̢ */ '\u0327', /* ̧ */
  179. '\u0328', /* ̨ */ '\u0334', /* ̴ */ '\u0335', /* ̵ */ '\u0336', /* ̶ */
  180. '\u034f', /* ͏ */ '\u035c', /* ͜ */ '\u035d', /* ͝ */ '\u035e', /* ͞ */
  181. '\u035f', /* ͟ */ '\u0360', /* ͠ */ '\u0362', /* ͢ */ '\u0338', /* ̸ */
  182. '\u0337', /* ̷ */ '\u0361', /* ͡ */ '\u0489' /* ҉_ */
  183. ];
  184. function rand(max) {
  185. return Math.floor(Math.random() * max);
  186. }
  187. function rand_asmodeus(array) {
  188. var ind = Math.floor(Math.random() * array.length);
  189. return array[ind];
  190. }
  191. function toggle(id) {
  192. if (document.getElementById(id).style.display == "none")
  193. document.getElementById(id).style.display = "block";
  194. else
  195. document.getElementById(id).style.display = "none";
  196. }
  197. function is_asmodeus_char(c) {
  198. var i;
  199. for (i = 0; i < asmodeus_up.length; i++)
  200. if (c == asmodeus_up[i])
  201. return true;
  202. for (i = 0; i < asmodeus_down.length; i++)
  203. if (c == asmodeus_down[i])
  204. return true;
  205. for (i = 0; i < asmodeus_mid.length; i++)
  206. if (c == asmodeus_mid[i])
  207. return true;
  208. return false;
  209. }
  210. //End ZALGO------------------------------------------------------------
  211.  
  212. $(function () {
  213. // $("body").on("shown.bs.tab", '#ctabs a[data-toggle="tab"]', function(a) {
  214. // "all" == $(a.target).data("dest") && void 0 !== roomUserLists[$(a.target).data("roomid")] && $('a[data-target="#users"]').parent("li").hasClass("active") && usersListTitleChange(roomUserLists[$(a.target).data("roomid")].items.length, $(".chat-tabs .avatar-list-item.active a").find("strong").text());
  215. // $('#ctabs a[data-toggle="tab"]').removeClass("active");
  216. // $(a.target).addClass("active");
  217. // $(a.target).children(".num-container").hide();
  218. // $(a.target).children(".num-container").children(".num-circle").html("0");
  219. // scrollToBottom($(".chat-area > .tab-pane.active .chat-text"));
  220. // $(".emojionearea-editor").focus()
  221. // });
  222. // $("body").on("click", ".chat-tabs-closer", function(a) {
  223. // a.stopPropagation();
  224. // $tab = $(this).parent("a");
  225. // "all" == $tab.data("dest") ? leaveRoom($tab.data("roomid"), function() {
  226. // delete roomUserLists[$tab.data("roomid")];
  227. // closeChatTab($tab.data("roomid"), !0)
  228. // }) : closeChatTab($tab.data("dest"), !1)
  229. // })
  230. });
  231.  
  232. function newChatTab(a, b, c, f, e) {
  233. // f = "all" == c ? "<strong>" + f + "</strong>" : f;
  234. // $(".chat-tabs").append('<li class="avatar-list-item"><a data-target="' + a + '" data-roomid="' + b + '" data-dest="' + c + '" class="ct-tab btn btn-xs btn-primary-outline" data-toggle="tab"><span class="chat-tabs-title">' + f + '</span><span class="chat-tabs-closer">&times;</span></a></li>');
  235. // $(".chat-area").append('<div id="ct_' + e + '" class="tab-pane"><div class="chat-text" style="font-size:' + $("#optTextSize").val() + 'px;" data-id="' + e + '"></div></div>')
  236. }
  237.  
  238. function closeChatTab(a, b) {
  239. // b ? ($('#ctabs a[data-target="#ct_' + a + ", #ul_" + a + '"]').parent("li").remove(), $("#ul_" + a).remove()) : $('#ctabs a[data-target="#ct_' + a + '"]').parent("li").remove();
  240. // $("#ct_" + a).remove();
  241. // 0 === $(".chat-tabs li").length ? ($("#userLists, #chatArea").css("visibility", "hidden"), $("#roomsList_modal").modal("show")) : (0 !== $(".chat-tabs li.active").length && 0 !== $("#users .tab-pane.active").length || $(".chat-tabs li").children('a[data-dest="all"]').first().click(), 1 == $(".chat-tabs li").children('a[data-dest="all"]').length && $(".chat-tabs li").children('a[data-dest="all"]').children(".chat-tabs-closer").css("visibility", "hidden"), 0 === $(".chat-tabs li").children('a[data-dest="all"]').length && ($(".chat-tabs").html(""), $(".chat-area").html(""), $("#userLists, #chatArea").css("visibility", "hidden"), $("#roomsList_modal").modal("show")))
  242. }
  243.  
  244. function onNewMessageReceivedInActiveTab() {
  245. // isActive || (count++, document.title = "(" + parseInt(count, 10) + ") Chat | EpikChat")
  246. }
  247. $(function () {
  248. // $("body").on("blur", ".tab-pane > .form-group > input.search:text", function(a) {
  249. // $(this).val("");
  250. // $(this).parents(".tab-pane").is("#ul_viewers") ? viewersList.search() : $(this).parents(".tab-pane").is("#ul_blocked") ? blockedList.search() : roomUserLists[$(this).parents(".tab-pane").data("roomid")].search()
  251. // });
  252. // $("body").on("click", "a.tcLink", function(a) {
  253. // a.preventDefault();
  254. // openLink($(this).attr("href"))
  255. // });
  256. // $("#youTube-content").resizable({
  257. // handles: "sw",
  258. // aspectRatio: !0,
  259. // alsoResize: "#ytplayer",
  260. // maxHeight: 360,
  261. // maxWidth: 640,
  262. // minHeight: 72,
  263. // minWidth: 128,
  264. // start: function(a, b) {
  265. // $("#ytplayer").css("pointer-events", "none")
  266. // },
  267. // stop: function(a, b) {
  268. // $("#ytplayer").css("pointer-events", "auto")
  269. // }
  270. // })
  271. });
  272.  
  273. function youtubePlayer(a, b) {
  274. // switch (a) {
  275. // case "open":
  276. // $("#ytplayer").show();
  277. // $("#ytplayer").attr("src", "https://www.youtube.com/embed/" + b + "?disablekb=1&rel=0&theme=light&playsinline=1");
  278. // $(".avatar-list-item.yticon").hide();
  279. // $(".avatar-list-item.ytminmax").removeClass("max");
  280. // $(".ytresize").removeClass("max");
  281. // $("#youTube-content").fadeIn();
  282. // break;
  283. // case "close":
  284. // $("#youTube-content").hide();
  285. // $("#ytplayer").attr("src", "about:blank");
  286. // break;
  287. // case "minmax":
  288. // $("#ytplayer").toggle(), $(".ytresize").toggleClass("max"), $(".avatar-list-item.ytminmax").toggleClass("max"), $("#ytcontrols .avatar-list-item.yticon").fadeToggle(150, "linear")
  289. // }
  290. }
  291. $(function () {
  292. // $("body").on("click", "#ytcontrols .avatar-list-item", function() {
  293. // youtubePlayer($(this).data("action"), null)
  294. // });
  295. // $('[data-toggle="popoverColor"]').popover({
  296. // template: '<div class="popover colorselectpopover" role="tooltip"><div class="arrow"></div><div class="popover-content p-x-0"></div></div>',
  297. // title: "",
  298. // html: !0,
  299. // trigger: "manual",
  300. // placement: "top",
  301. // container: ".message-input",
  302. // content: '<span class="simplecolorpicker inline"><span class="color" style="background-color: #212121;" data-color="#212121"></span><span class="color" style="background-color: #3d3c3a;" data-color="#3d3c3a"></span><span class="color" style="background-color: #656565;" data-color="#656565"></span><span class="color" style="background-color: #6f4341;" data-color="#6f4341"></span><span class="color" style="background-color: #990703;" data-color="#990703"></span><span class="color" style="background-color: #ca226b;" data-color="#ca226b"></span><span class="color" style="background-color: #f778a1;" data-color="#f778a1"></span><span class="color" style="background-color: #f32f2f;" data-color="#f32f2f"></span><span class="color" style="background-color: #c35817;" data-color="#c35817"></span><span class="color" style="background-color: #ffad46;" data-color="#ffad46"></span><span class="color" style="background-color: #f1c85e;" data-color="#f1c85e"></span><span class="color" style="background-color: #006666;" data-color="#006666"></span><span class="color" style="background-color: #596247;" data-color="#596247"></span><span class="color" style="background-color: #3a6636;" data-color="#3a6636"></span><span class="color" style="background-color: #47b617;" data-color="#47b617"></span><span class="color" style="background-color: #5cd87e;" data-color="#5cd87e"></span><span class="color" style="background-color: #11c4cd;" data-color="#11c4cd"></span><span class="color" style="background-color: #6db4e9;" data-color="#6db4e9"></span><span class="color" style="background-color: #2a61e3;" data-color="#2a61e3"></span><span class="color" style="background-color: #2d1ae1;" data-color="#2d1ae1"></span><span class="color" style="background-color: #645be5;" data-color="#645be5"></span><span class="color" style="background-color: #ff0099;" data-color="#ff0099"></span><span class="color" style="background-color: #cc00cc;" data-color="#cc00cc"></span><span class="color" style="background-color: #9334d8;" data-color="#9334d8"></span></span>'
  303. // });
  304. // $('[data-toggle="popoverColor"]').on("click", function(a) {
  305. // $('[data-toggle="popoverColor"]').data("bs.popover").tip().hasClass("in") ? ($('[data-toggle="popoverColor"]').popover("hide"), $(document).off("click.app.popover")) : ($('[data-toggle="popoverColor"]').popover("show"), $(".simplecolorpicker span.color").removeAttr("data-selected"), $('.simplecolorpicker span.color[data-color="' + $("#optTextColor").data("color") + '"]').attr("data-selected", !0), setTimeout(function() {
  306. // $(document).one("click.app.popover", function() {
  307. // $('[data-toggle="popoverColor"]').popover("hide")
  308. // })
  309. // }, 1))
  310. // });
  311. // $("body").on("click", ".simplecolorpicker span.color", function(a) {
  312. // $("#optTextColor").attr("data-color", $(this).data("color"));
  313. // $("#optTextColor").data("color", $(this).data("color"));
  314. // $("#optTextColor").css("background-color", $(this).data("color"));
  315. // $(".emojionearea-editor").focus();
  316. // saveChatSettings()
  317. // });
  318. // $("body").on("click", 'a[data-target="#user_action_modal"]', function(a) {
  319. // userActions($("#user_action_modal"), $(this), !0)
  320. // })
  321. });
  322.  
  323. function openLink(a) {
  324. // a.match(/^http([s]?):\/\/.*/) || (a = "http://" + a);
  325. // a = a.replace("&amp;", "&");
  326. // var b = $("<a>", {
  327. // href: a
  328. // })[0],
  329. // c = !1;
  330. // $.each("epikchat.com youtube.com youtu.be ytimg.com facebook.com fb.com fbcdn.net instagram.com cdninstagram.com twitter.com twimg.com pinterest.com pinimg.com imgur.com reddit.com ebay.com amazon.com google.com wikipedia.org".split(" "), function(a, e) {
  331. // if (b.hostname.lastIndexOf(e) == b.hostname.length - e.length && -1 != b.hostname.lastIndexOf(e)) return c = !0, !1
  332. // });
  333. // if (c)
  334. // if (regExp = /.*(?:youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=)([^#&\?]*).*/, match = a.match(regExp), res = a.split("/"), match && 11 == match[1].length) youtubePlayer("open", match[1]);
  335. // else if (res[4] && ("doodles" == res[4].toLowerCase() || "photos" == res[4].toLowerCase()) && res[5]) viewMedia(a);
  336. // else if (-1 == a.indexOf("epikchat.com/chat")) window.open(a, "_blank");
  337. // else return !1;
  338. // else $("#link-checker-content").html(""), $(".indicator").show(), $("#linkCheckerModal").modal("show"), $("#linkCheckerModal").find(".modal-header .modal-title").html("Checking link..."), $.ajax({
  339. // type: "POST",
  340. // url: "/sites/all/modules/avc/avc_ui/linkCheck",
  341. // data: {
  342. // url: a
  343. // },
  344. // dataType: "json",
  345. // success: function(b) {
  346. // if (0 === b.status) return !1;
  347. // 1 == b.status ? ($("#linkCheckerModal").find(".modal-header .modal-title").html("Be careful!<br>This link leads you off EpikChat!"), b.url ? $("#link-checker-content").html('<div style="width: 260px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;"><b>This link redirects to:</b> ' + b.url + "</div><a href=\"javascript:alert('" + b.redirects + '\')" style="text-decoration:none;">(show all)</a><br>') : $("#link-checker-content").html('<div style="width: 260px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">' +
  348. // a + "</div>"), $("#link-checker-content").append('<br><p>If you trust this link, choose Open Link. If you do not trust the link, choose Cancel.</p><br><button type="button" class="btn btn-primary pull-right" onclick="window.open(\'' + a + "', '_blank');$('#linkCheckerModal').modal('hide');\">Open Link</button><button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\">Cancel</button>")) : 2 == b.status && ($("#linkCheckerModal").find(".modal-header .modal-title").html("Link Blocked"), $("#link-checker-content").html('<b>This link has been identified as potentially dangerous and has been blocked.</b><br><br><div style="width: 260px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" onselectstart="return false;">' +
  349. // a + '</div><br><button type="button" class="btn btn-default" data-dismiss="modal">Close</button>'))
  350. // }
  351. // }), $(".indicator").hide()
  352. }
  353.  
  354. function gotDevices(a) {
  355. // var b = broadcastSelectors.map(function(a) {
  356. // return a.value
  357. // });
  358. // broadcastSelectors.forEach(function(a) {
  359. // for (; a.firstChild;) a.removeChild(a.firstChild)
  360. // });
  361. // for (var c = 0; c !== a.length; ++c) {
  362. // var f = a[c],
  363. // e = document.createElement("option");
  364. // e.value = f.deviceId;
  365. // "audioinput" === f.kind && (e.text = f.label || "microphone " + (audioInputSelect.length + 1), audioInputSelect.appendChild(e));
  366. // "videoinput" === f.kind && (e.text = f.label || "camera " + (videoInputSelect.length + 1), videoInputSelect.appendChild(e))
  367. // }
  368. // broadcastSelectors.forEach(function(a, c) {
  369. // Array.prototype.slice.call(a.childNodes).some(function(a) {
  370. // return a.value === b[c]
  371. // }) && (a.value = b[c])
  372. // })
  373. }
  374.  
  375. function gotStream(a) {
  376. // window.stream = a;
  377. // document.getElementById("videoPreview").srcObject = a;
  378. // meters[socket.id] = kurentoUtils.WebRtcPeer.hark(a);
  379. // meters[socket.id].on("volume_change", function(a) {
  380. // $("#volPreviewBar").height(a + 100 + "%")
  381. // });
  382. // return navigator.mediaDevices.enumerateDevices()
  383. }
  384.  
  385. function complete() {
  386. // $("#broadcastReqPerm").hide();
  387. // $("#broadcastReqFail").hide();
  388. // $("#broadcastSettingsForm").show()
  389. }
  390.  
  391. function handleError(a) {
  392. // var b = "";
  393. // console.log("navigator.getUserMedia error: " + a);
  394. // if ("NotAllowedError" == a.name || "PermissionDeniedError" == a.name) b = "<div><h5>Camera access denied</h5>You need to allow the use of your camera and microphone in order to broadcast.</div><br><br>";
  395. // if ("OverconstrainedError" == a.name || "DevicesNotFoundError" == a.name) b = '<div class="error" style="margin: 0px 15px 15px 15px;font-size: 13px;padding: 4px;">ERROR: One of your currently selected audio/video devices could not be found!<br>Please select another device.</div>';
  396. // "PermissionDismissedError" == a.name && (b = '<div><h5>Select "Allow" to broadcast</h5>Click "Try again" to allow the use of your camera and microphone in order to broadcast.</div><br><button type="button" name="op" value="Try again" class="btn btn-primary form-submit" onClick="start()">Try again</button><br><br>');
  397. // $("#broadcastReqFail").html(b);
  398. // $("#broadcastReqPerm").hide();
  399. // $("#broadcastReqFail").show()
  400. }
  401. $(function () {
  402. // $("body").on("click", "#startBroadcasting", function() {
  403. // navigator.getUserMedia ? ($("#startBroadcasting").addClass("disabled"), $("#broadcastSettings").modal("show")) : notifyUser("Broadcasting is not supported with this browser.")
  404. // });
  405. // $("#broadcastSettings").on("show.bs.modal", function() {
  406. // startPreview()
  407. // });
  408. // $("#broadcastSettings").on("hide.bs.modal", function() {
  409. // window.stream && window.stream.getTracks().forEach(function(a) {
  410. // a.stop()
  411. // });
  412. // $("#startBroadcasting").removeClass("disabled")
  413. // });
  414. // $("body").on("click", ".stopBroadcasting", function(a) {
  415. // stopBroadcasting(!1)
  416. // });
  417. // $("body").on("click", ".pauseVideo", function(a) {
  418. // webRtcPeerPresenter && ($(this).toggleClass("active"), webRtcPeerPresenter.videoEnabled = webRtcPeerPresenter.videoEnabled ? !1 : !0)
  419. // });
  420. // $("body").on("click", ".muteMic", function(a) {
  421. // webRtcPeerPresenter && ($(this).toggleClass("active"), webRtcPeerPresenter.audioEnabled = webRtcPeerPresenter.audioEnabled ? !1 : !0)
  422. // })
  423. });
  424.  
  425. function presenterResponse(a) {
  426. // "accepted" != a.response ? (console.warn("Not accepted for the following reason: " + (a.message ? a.message : "Unknown error")), webRtcPeerPresenter.dispose()) : webRtcPeerPresenter.processAnswer(a.sdpAnswer)
  427. }
  428. $(function () {
  429. // $("body").on("click", ".stopViewing", function(a) {
  430. // stopViewing($(this).data("sid"))
  431. // });
  432. // $("body").on("click", ".ecp-mute > svg", function(a) {
  433. // a = $(this).next(".vol-control");
  434. // var b = 100 * $('video[data-sid="' + $(this).parents(".bcst-player").data("sid") + '"]').prop("volume");
  435. // $('video[data-sid="' + $(this).parents(".bcst-player").data("sid") + '"]').prop("muted") && 0 !== b ? ($('video[data-sid="' + $(this).parents(".bcst-player").data("sid") + '"]').prop("muted", !1), a.val(b), a.css("background", "linear-gradient(to left, #505050 0%, #505050 0%, #505050 " +
  436. // (100 - b) + "%, #f9f9f9 " + (100 - b) + "%, #f9f9f9 100%)"), $(this).html('<path d="M8,21 L12,21 L17,26 L17,10 L12,15 L8,15 L8,21 Z M19,14 L19,22 C20.48,21.32 21.5,19.77 21.5,18 C21.5,16.26 20.48,14.74 19,14 ZM19,11.29 C21.89,12.15 24,14.83 24,18 C24,21.17 21.89,23.85 19,24.71 L19,26.77 C23.01,25.86 26,22.28 26,18 C26,13.72 23.01,10.14 19,9.23 L19,11.29 Z" fill="#fff"></path>')) : ($('video[data-sid="' + $(this).parents(".bcst-player").data("sid") + '"]').prop("muted", !0), a.val(0), a.css("background", "linear-gradient(to left, #505050 0%, #505050 0%, #505050 100%, #f9f9f9 100%, #f9f9f9 100%)"), $(this).html('<path d="m 21.48,17.98 c 0,-1.77 -1.02,-3.29 -2.5,-4.03 v 2.21 l 2.45,2.45 c .03,-0.2 .05,-0.41 .05,-0.63 z m 2.5,0 c 0,.94 -0.2,1.82 -0.54,2.64 l 1.51,1.51 c .66,-1.24 1.03,-2.65 1.03,-4.15 0,-4.28 -2.99,-7.86 -7,-8.76 v 2.05 c 2.89,.86 5,3.54 5,6.71 z M 9.25,8.98 l -1.27,1.26 4.72,4.73 H 7.98 v 6 H 11.98 l 5,5 v -6.73 l 4.25,4.25 c -0.67,.52 -1.42,.93 -2.25,1.18 v 2.06 c 1.38,-0.31 2.63,-0.95 3.69,-1.81 l 2.04,2.05 1.27,-1.27 -9,-9 -7.72,-7.72 z m 7.72,.99 -2.09,2.08 2.09,2.09 V 9.98 z" fill="#fff"></path>'))
  437. // });
  438. // $("body").on("input", ".vol-control", function(a) {
  439. // $('video[data-sid="' + $(this).parents(".bcst-player").data("sid") + '"]').prop("volume", $(this).val() / 100);
  440. // $(this).css("background", "linear-gradient(to left, #505050 0%, #505050 0%, #505050 " + (100 - $(this).val()) + "%, #f9f9f9 " + (100 - $(this).val()) + "%, #f9f9f9 100%)");
  441. // "0" == $(this).val() ? $(this).siblings("svg").html('<path d="m 21.48,17.98 c 0,-1.77 -1.02,-3.29 -2.5,-4.03 v 2.21 l 2.45,2.45 c .03,-0.2 .05,-0.41 .05,-0.63 z m 2.5,0 c 0,.94 -0.2,1.82 -0.54,2.64 l 1.51,1.51 c .66,-1.24 1.03,-2.65 1.03,-4.15 0,-4.28 -2.99,-7.86 -7,-8.76 v 2.05 c 2.89,.86 5,3.54 5,6.71 z M 9.25,8.98 l -1.27,1.26 4.72,4.73 H 7.98 v 6 H 11.98 l 5,5 v -6.73 l 4.25,4.25 c -0.67,.52 -1.42,.93 -2.25,1.18 v 2.06 c 1.38,-0.31 2.63,-0.95 3.69,-1.81 l 2.04,2.05 1.27,-1.27 -9,-9 -7.72,-7.72 z m 7.72,.99 -2.09,2.08 2.09,2.09 V 9.98 z" fill="#fff"></path>') : ($('video[data-sid="' + $(this).parents(".bcst-player").data("sid") + '"]').prop("muted", !1), $(this).siblings("svg").html('<path d="M8,21 L12,21 L17,26 L17,10 L12,15 L8,15 L8,21 Z M19,14 L19,22 C20.48,21.32 21.5,19.77 21.5,18 C21.5,16.26 20.48,14.74 19,14 ZM19,11.29 C21.89,12.15 24,14.83 24,18 C24,21.17 21.89,23.85 19,24.71 L19,26.77 C23.01,25.86 26,22.28 26,18 C26,13.72 23.01,10.14 19,9.23 L19,11.29 Z" fill="#fff"></path>'))
  442. // });
  443. // $("body").on("click", ".ecp-resize", function(a) {
  444. // $(this).parents(".bcst-player").hasClass("stack-lg") ? ($(this).parents(".bcst-player").removeClass("stack-lg").find(".stack").removeClass("stack-lg"), $(this).find(".icon").removeClass("icon-resize-100").addClass("icon-resize-full-screen")) : ($(this).parents(".bcst-player").addClass("stack-lg").find(".stack").addClass("stack-lg"), $(this).find(".icon").removeClass("icon-resize-full-screen").addClass("icon-resize-100"));
  445. // scrollToBottom($(".chat-area > .tab-pane.active .chat-text"))
  446. // });
  447. // $("body").on("click", ".ecp-fullscreen", function(a) {
  448. // target = $('video[data-sid="' +
  449. // $(this).parents(".bcst-player").find("video").data("sid") + '"]')[0];
  450. // screenfull.enabled && (screenfull.request(target), screenfull.onchange(function() {
  451. // screenfull.isFullscreen || scrollToBottom($(".chat-area > .tab-pane.active .chat-text"))
  452. // }))
  453. // })
  454. });
  455.  
  456. function viewerResponse(a) {
  457. // if ("accepted" != a.response) {
  458. // var b = a.data.data ? a.data.data : "Unknown error";
  459. // console.warn(b);
  460. // notifyUser("Could not establish a connection with the broadcaster: " + b);
  461. // removePlayer(a.data.sid)
  462. // } else webRtcPeerViewer[a.sid].processAnswer(a.sdpAnswer, function(b) {
  463. // if (b) return console.log(b);
  464. // document.querySelector('video[data-sid="' + a.sid + '"]').addEventListener("loadeddata", function() {
  465. // $('.bcst-player[data-sid="' + a.sid + '"] .stack.spinner').hide();
  466. // a.simulated && ($('.bcst-player[data-sid="' +
  467. // a.sid + '"]').find(".ecp-overlay").prepend('<div class="simIco pull-right" style="padding:3px 5px;" title="This person may be using a simulated webcam" data-toggle="tooltip" data-container="#broadcastSlots"><span class="icon icon-warning"></span></div>'), $('[data-toggle="tooltip"]').tooltip())
  468. // }, !1)
  469. // })
  470. }
  471.  
  472. function removePlayer(a) {
  473. // webRtcPeerViewer[a] && webRtcPeerViewer[a] && (webRtcPeerViewer[a].dispose(), delete webRtcPeerViewer[a]);
  474. // $('.bcst-player[data-sid="' + a + '"]').remove()
  475. }
  476. $(function () {
  477. $("#reportUser").submit(function (a) {
  478. // a.preventDefault();
  479. // 0 === $(this).find("select").val() ? $(this).find("select").addClass("error") : ($(this).find("select").removeClass("error"), reportUser($(this).find("#report_roomid").val(), $(this).find("#report_sid").val(), $(this).find("select").val(), $(this).find("textarea").val()), $("#reportUser_modal").modal("hide"), $(this).find("select").val(0), $(this).find("textarea").val(""))
  480. });
  481. $("body").on("click", "#suggest_ban", function (a) {
  482. // a.preventDefault();
  483. // $("#suggestBan_modal").data("sid", $(this).attr("href"));
  484. // $("#suggestBan_modal .modal-body").html("Ban " + $(this).data("name") + " from The Lobby?<br><br><strong>WARNING:</strong><br><small>You are about to initiate a room wide vote to ban user " + $(this).data("name") + ". If over 50% of voters choose YES this user will be banned. If over 50% of voters choose NO you will be banned.</small><br>");
  485. // $("#suggestBan_modal").modal("show");
  486. // $("#reportUser_modal").modal("hide")
  487. });
  488. $("body").on("click", "#processBan", function (a) {
  489. // requestVote($(".userList div.active").data("roomid"), $("#suggestBan_modal").data("sid"))
  490. })
  491. });
  492. $(function () {
  493. // $("#alert_modal").on("hide.bs.modal", function() {
  494. // "hidden" !== $("#userLists, #chatArea").css("visibility") || $("#roomsList_modal").is(":visible") || $("#roomsList_modal").modal("show")
  495. // });
  496. // $("#roomsList_modal").on("show.bs.modal", function() {
  497. // roomsListRefresh();
  498. // roomsListRefreshTimer = setInterval(function() {
  499. // roomsListRefresh()
  500. // }, 5E3)
  501. // });
  502. // $("#roomsList_modal").on("hide.bs.modal", function() {
  503. // clearInterval(roomsListRefreshTimer)
  504. // });
  505. // $("#chatSettings_modal").on("hidden.bs.modal", function() {
  506. // saveChatSettings();
  507. // $(this).find(".modal-content").hide();
  508. // $(this).find(".modal-content.main").show()
  509. // });
  510. // $("#showEmpty").change(function() {
  511. // $(this).is(":checked") ? $(".roomspicker > a[data-users=0]").show() : $(".roomspicker > a[data-users=0]").hide()
  512. // });
  513. // $("body").on("click", ".roomspicker > a.list-group-item, .roomInvite, .roomInfo", function(a) {
  514. // a.preventDefault();
  515. // $("#roomsList_modal").modal("hide");
  516. // $('#ctabs a[data-roomid="' + $(this).data("roomid") + '"][data-dest="all"]').length ? notifyUser("This room is already open, please close/exit the room before attempting to rejoin.") : $(this).data("passworded") ? ($("#passwordJoin").data("roomid", $(this).data("roomid")), $("#password_modal").modal("show")) : joinRoom($(this).data("roomid"), "")
  517. // });
  518. // $("body").on("click", ".viewInvite", function(a) {
  519. // a.preventDefault();
  520. // sendViewRequest($(this).data("sid"), $(this).data("cam"))
  521. // });
  522. // $("#password_modal").on("shown.bs.modal", function() {
  523. // $(this).find("[autofocus]:first").focus()
  524. // });
  525. // $("#password_modal").on("hidden.bs.modal", function(a) {
  526. // $("#rmpwd").val("")
  527. // });
  528. // $("#passwordJoin").submit(function(a) {
  529. // a.preventDefault();
  530. // $("#password_modal").modal("hide");
  531. // joinRoom($(this).data("roomid"), $("#rmpwd").val())
  532. // });
  533. // $("#inviteToRoom").submit(function(a) {
  534. // a.preventDefault();
  535. // $("#inviteroom_modal").modal("hide");
  536. // inviteUser("room", $("#inviteroom_modal").find("#inviteroom_roomId").val(), $("#inviteroom_modal").find("#inviteroom_sid").val(), $("#inviteroom_modal").find("#inviteroom_name").val(), $("#inviteroom_modal").find("select").val())
  537. // })
  538. });
  539.  
  540. function notifyUser(a, b, c) {
  541. // a = '<div class="alert alert-dark alert-dismissable" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>' + a + "</div>";
  542. // b ? $(a).appendTo(".growl") : (c = c ? c : 1E4, $(a).appendTo(".growl").delay(c).fadeOut("fast", function() {
  543. // $(this).remove()
  544. // }))
  545. }
  546.  
  547. function notificationSound(a) {
  548. // if ($("#optSounds" + a).is(":checked")) {
  549. // switch (a) {
  550. // case "Msg":
  551. // file = "message-html5.mp3";
  552. // break;
  553. // case "Poke":
  554. // file = "poke-html5.mp3";
  555. // break;
  556. // case "ViewReq":
  557. // file = "viewRequest-html5.mp3"
  558. // }
  559. // audio = new Audio("/sites/all/modules/avc/avc_ui/sounds/" + file);
  560. // audio.play()
  561. // }
  562. }
  563.  
  564. function inList(a, b, c) {
  565. // if (!a) return !1;
  566. // a = a.get(b, c);
  567. // return a.length ? a[0].values() : !1
  568. }
  569.  
  570. function isBlocked(a, b) {
  571. // if (void 0 === a || null === a) return console.log("no siteId blocking just in case"), !0;
  572. // if (void 0 === b || null === b) return console.log("no clientId blocking just in case"), !0;
  573. // if (a) {
  574. // if (inList(blockedList, "siteId", a)) return !0
  575. // } else if (inList(blockedList, "clientId", b)) return !0;
  576. // return !1
  577. }
  578. $(function () {
  579. // $('<ul class="chat-nav nav navbar-nav" style="position: absolute;left: 190px;font-size: 17px;display: none;margin:0;"><li class="pull-left" title="Settings"><a data-target="#chatSettings_modal" data-toggle="modal" style="padding: 14px 0px 14px 15px; cursor:pointer;"><span class="icon icon-cog"></span></a></li><li class="pull-left" title="Chat Rooms"><a data-target="#roomsList_modal" style="padding: 14px 0px 14px 15px; font-size:18px; cursor:pointer;" data-toggle="modal"><span class="icon icon-chat"></span></a></li></ul>').insertAfter(".navbar-header > a");
  580. // $("body").on("shown.bs.tab", '#userListingType a[data-toggle="tab"]', function(a) {
  581. // $("#user_action_slider").hide();
  582. // "#users" == $(a.target).data("target") ? usersListTitleChange(roomUserLists[$(".userList div.active").data("roomid")].items.length, $(".userList div.active").data("roomname")) : "#viewers" == $(a.target).data("target") ? usersListTitleChange($(viewersList.listContainer).find(".emptyList").hasClass("hidden") ? viewersList.items.length : 0, "Viewers") : "#blocked" == $(a.target).data("target") && usersListTitleChange(0, "Blocked")
  583. // });
  584. // $("body").on("click", "[data-ulitem]", function(a) {
  585. // a.preventDefault();
  586. // userActions($("#user_action_slider"), $(a.currentTarget), !1)
  587. // });
  588. // $("#user_action_slider .close").on("click", function() {
  589. // $("#user_action_slider").hide()
  590. // })
  591. });
  592.  
  593. function findUser(a) {
  594. // for (var b in roomUserLists)
  595. // if (roomUserLists.hasOwnProperty(b)) {
  596. // var c = roomUserLists[b].get("sid", a);
  597. // if (c.length) return {
  598. // item: c[0].values(),
  599. // roomId: b
  600. // }
  601. // } return !1
  602. }
  603.  
  604. function userActions(a, b, c) {
  605. // a.find(".roomKick, .roomBan, .viewProfile, .inviteView, .inviteRoom").hide();
  606. // var f = b.data("clientid"),
  607. // e = b.data("siteid"),
  608. // d = inList(roomUserLists[$(".userList div.active").data("roomid")], "sid", socket.id),
  609. // g = {};
  610. // b = b.data("sid");
  611. // var h = inList(roomUserLists[$(".userList div.active").data("roomid")], "sid", b);
  612. // if (isBlocked(e, f)) a.data("clientid", f), a.data("siteid", e), a.find(".panel-profile-img").attr("src", "/sites/default/files/global/images/default_profile.png"), a.find(".overlayBtns2 li").data("ulmenu", "").addClass("disableUlitemMenu"), a.find(".blockUnblock a").data("ulmenu", "unblock").text("Unblock this person");
  613. // else {
  614. // if (b == socket.id || !1 === d) return;
  615. // if (!1 === h) {
  616. // g = findUser(b);
  617. // if (!1 === g) return;
  618. // h = g.item
  619. // } else g.roomId = $(".userList div.active").data("roomid");
  620. // a.find(".panel-profile-img").attr("src", h.profileImg);
  621. // a.find(".panel-badge").attr("src", h.userLevelIcon);
  622. // a.find(".bio").html("");
  623. // h.cam.startsWith("99_") ? a.find(".view").data("ulmenu", "").addClass("disableUlitemMenu") : a.find(".view").data("ulmenu", "view").removeClass("disableUlitemMenu");
  624. // a.find(".message").data("ulmenu", "message").removeClass("disableUlitemMenu");
  625. // a.find(".poke").data("ulmenu", "poke").removeClass("disableUlitemMenu");
  626. // a.find(".report").data("ulmenu", "report").removeClass("disableUlitemMenu");
  627. // "verified" == d.badge && (d.cam.startsWith("0_") || d.cam.startsWith("1_")) && a.find(".inviteView").data("ulmenu", "inviteview").show();
  628. // for (var k in roomUserLists)
  629. // if (roomUserLists.hasOwnProperty(k) && (f = roomUserLists[k].get("siteId", d.siteId), f.length && "" !== f[0].values().modIcon)) {
  630. // a.find(".inviteRoom").data("ulmenu", "inviteroom").show();
  631. // break
  632. // } $('a[data-target="#users"]').parents("li").hasClass("active") && "" === h.modIcon && "" !== d.modIcon && a.find(".roomKick, .roomBan").show();
  633. // a.find(".blockUnblock a").data("ulmenu", "block").text("Block this person");
  634. // a.data("sid", b);
  635. // a.data("roomid", g.roomId)
  636. // }
  637. // a.find(".name").html(h.name);
  638. // "guest" != h.badge && a.find(".viewProfile").show();
  639. // "guest" == d.badge && (a.find(".blockUnblock").hide(), a.find(".poke").data("ulmenu", "").addClass("disableUlitemMenu"));
  640. // c ? a.modal("show") : a.show()
  641. }
  642.  
  643. function userListAdd(a, b, c) {
  644. // $(b.listContainer).find(".emptyList").addClass("hidden");
  645. // var f = "",
  646. // e = "",
  647. // d = "",
  648. // g = "";
  649. // if ("blocked" == a) f = '<strong title="' + c.name + '">' + c.name + "</strong>", e = void 0 == c.uid ? c.siteId : c.uid, b.add({
  650. // siteId: e,
  651. // name: e ? '<a href="/' + c.name + '" target="_blank">' + f + "</a>" : f,
  652. // clientId: c.clientId
  653. // });
  654. // else {
  655. // isBlocked(c.siteId, c.clientId) && (e = '<span class="icon icon-block"></span>');
  656. // 0 !== c.idle && (f = '<svg viewBox="0 0 1000 1000" height="10" width="10" style="margin-top: 8px;margin-left: -9px; position:absolute;"><circle cx="500" cy="500" r="480" fill="#ffffff"></circle><path d="M500,10C229.8,10,10,229.8,10,500c0,270.2,219.8,490,490,490c270.2,0,490-219.8,490-490C990,229.8,770.2,10,500,10L500,10zM500,906.3C276,906.3,93.7,724,93.7,500C93.7,276,276,93.7,500,93.7C724,93.7,906.3,276,906.3,500C906.3,724,724,906.3,500,906.3L500,906.3z M325.3,500c-19.4,0-35.1,15.6-35.1,35s15.7,35,35.1,35h210c19.4,0,35-15.6,35-35V255.1c0-19.4-15.6-35.1-35-35.1c-19.4,0-35,15.7-35,35.1V500L325.3,500L325.3,500z" fill="#5e92c4"></path></svg>');
  657. // !0 === c.isMod && (d = '<span class="icon icon-star"></span>');
  658. // switch (c.cam) {
  659. // case 99:
  660. // g = '<span class="icon icon-video-camera off"></span>';
  661. // break;
  662. // case 0:
  663. // g = '<span class="icon icon-video-camera"></span>';
  664. // break;
  665. // case 1:
  666. // g = '<span class="icon icon-video-camera"></span><span class="icon icon-lock"></span>'
  667. // }
  668. // b.add({
  669. // sid: c.sid,
  670. // siteId: c.siteId,
  671. // clientId: c.clientId,
  672. // name: c.name,
  673. // gender: c.gender,
  674. // badge: c.badge,
  675. // countryCode: c.countryCode,
  676. // cam: c.cam + "_" + c.name,
  677. // idle: c.idle,
  678. // camIcon: g,
  679. // modIcon: d,
  680. // idleIcon: f,
  681. // blockedIcon: e,
  682. // genderIcon: "/sites/all/modules/avc/avc_ui/images/genders/" +
  683. // c.gender + ".png",
  684. // countryCodeIcon: "/sites/all/modules/avc/avc_ui/images/flags/" + c.countryCode + ".svg",
  685. // userLevelIcon: "/sites/default/files/badges/" + c.badge + ".png",
  686. // profileImg: c.profileImg,
  687. // self: socket.id == c.sid ? !0 : !1
  688. // })
  689. // }
  690. // "users" == a && $('a[data-target="#users"]').parent("li").hasClass("active") ? usersListTitleChange(roomUserLists[$(".userList div.active").data("roomid")].items.length, $(".userList div.active").data("roomname")) : $('a[data-target="#' + a + '"]').parent("li").hasClass("active") && usersListTitleChange(b.items.length, a.charAt(0).toUpperCase() + a.slice(1))
  691. }
  692.  
  693. function userListRemove(a, b, c) {
  694. // "blocked" == a ? c.siteId ? b.remove("siteId", c.siteId) : b.remove("clientId", c.clientId) : b.remove("sid", c.sid);
  695. // 0 === b.items.length && $(b.listContainer).find(".emptyList").removeClass("hidden");
  696. // "users" == a && $('a[data-target="#users"]').parent("li").hasClass("active") ? usersListTitleChange(roomUserLists[$(".userList div.active").data("roomid")].items.length, $(".userList div.active").data("roomname")) : $('a[data-target="#' + a + '"]').parent("li").hasClass("active") && usersListTitleChange(b.items.length, a.charAt(0).toUpperCase() + a.slice(1))
  697. }
  698.  
  699. function populateUserList(a, b, c) {
  700. // void 0 !== roomUserLists[b] && roomUserLists[b].clear();
  701. // var f = 0;
  702. // roomUserLists[b] = new List("ul_" + b, newListOptions);
  703. // roomUserLists[b].on("searchComplete", function(a) {
  704. // a.matchingItems.length || $(a.list).html('<div class="p-a text-muted text-center">No results found.</div>')
  705. // });
  706. // Object.keys(a).forEach(function(c) {
  707. // f++;
  708. // userListAdd("users", roomUserLists[b], a[c])
  709. // });
  710. // $('a[data-target="#users"]').parents("li").hasClass("active") && usersListTitleChange(f, c)
  711. }
  712.  
  713. function usersListTitleChange(a, b) {
  714. // null === b ? $("#ul-title").html($("#ul-title").text().replace(/\((.+?)\)/g, "(" + a + ")")) : $("#ul-title").html("(" + a + ") " + b)
  715. }
  716. var blockListOpts = {
  717. valueNames: ["name", {
  718. name: "siteId",
  719. attr: "data-siteid"
  720. }, {
  721. name: "clientId",
  722. attr: "data-clientid"
  723. }],
  724. item: '<div style="padding-bottom: 5px;"><div class="media-body" style="padding-top: 5px;"><span class="name" style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 150px; display: inline-block;"></span><a class="btn btn-default-outline btn-xs btn-pill pull-right siteId clientId removeBlock">Remove</a></div></div>'
  725. },
  726. newListOptions = {
  727. valueNames: ["name", "gender", "idleIcon", "blockedIcon", "idle", "countryCode", "cam", "camIcon", "modIcon", "profileImg", {
  728. data: ["sid", "siteId", "self", "clientId"]
  729. }, {
  730. name: "link",
  731. attr: "href"
  732. }, {
  733. name: "genderIcon",
  734. attr: "src"
  735. }, {
  736. name: "countryCodeIcon",
  737. attr: "src"
  738. }, {
  739. name: "userLevelIcon",
  740. attr: "src"
  741. }],
  742. item: '<a data-target="#user_options" class="list-group-item cur-pointer" data-ulitem=""><ul class="avatar-list m-a-0"><li class="avatar-list-item" style="width: auto;"><img class="userLevelIcon img-circle" style="width:14px; height:14px; margin-top:-3px;"></li><li class="avatar-list-item" style="width: auto;"><img class="genderIcon" style="width:14px; height:14px; margin-top:-3px;"><span class="idleIcon"></span><span class="blockedIcon"></span></li><li class="avatar-list-item" style="width: auto;"><div class="countryCodeIcon-wrapper"><img class="countryCodeIcon" src=""></div></li><li class="avatar-list-item camIcon" style="width: auto;"><span class="icon icon-video-camera off"></span></li><li class="avatar-list-item name"></li><li class="avatar-list-item modIcon pull-right"></li></ul></a>',
  743. searchColumns: ["name"]
  744. };
  745. $(function () {
  746. // $("body").on("click", "a.list-group-item", function(a) {
  747. // $(this).blur();
  748. // $(this).data("section") && (a.preventDefault(), $(".modal-content.main").hide(), $(".modal-content." + $(this).data("section")).show())
  749. // });
  750. // $("body").on("click", ".section-close", function(a) {
  751. // $(this).parents(".modal-content").hide();
  752. // $(".modal-content.main").show()
  753. // });
  754. // $("body").on("click", ".removeBlock", function(a) {
  755. // $(this).data("siteid") ? blockList("unblock", {
  756. // siteId: $(this).data("siteid"),
  757. // clientId: null
  758. // }) : blockList("unblock", {
  759. // siteId: 0,
  760. // clientId: $(this).data("clientid")
  761. // })
  762. // });
  763. // $("body").on("click", "[data-ulmenu]", function(a) {
  764. // a.preventDefault();
  765. // if ("" !== $(this).data("ulmenu")) {
  766. // $("#user_action_slider").is(":visible") && $("#user_action_slider").hide();
  767. // a = $(this).data("ulmenu").toLowerCase();
  768. // var b = $(this).closest("[id^='user_action_']").data("sid"),
  769. // c = $(this).closest("[id^='user_action_']").data("clientid"),
  770. // f = $(this).closest("[id^='user_action_']").data("siteid"),
  771. // e = $(this).closest("[id^='user_action_']").data("roomid"),
  772. // d = inList(roomUserLists[e], "sid", b);
  773. // b = inList(roomUserLists[e], "sid", socket.id);
  774. // if (!1 === d && "unblock" != a) notifyUser("User action (" + a + ") has failed, this person may have left the chat by now.");
  775. // else switch (a) {
  776. // case "profile":
  777. // 0 === d.siteId ? notifyUser("This user is not signed in to Epikchat.com") : window.open("/" + d.name);
  778. // break;
  779. // case "view":
  780. // sendViewRequest(d.sid, d.cam);
  781. // break;
  782. // case "poke":
  783. // pokeUser(e, d.sid, d.name);
  784. // break;
  785. // case "message":
  786. // "member" == b.badge || "guest" == b.badge ? notifyUser("You must be a verified member to initiate private messages. <a href='/verify' target='_blank'>Get verified</a>") : $('a[data-target="#ct_' + d.sid + '"]').length ? $('a[data-target="#ct_' + d.sid + '"]').click() : (newChatTab("#ct_" + d.sid, e, d.sid, d.name, d.sid), addToChatArea(d.sid, '<div style="background-color:#f0f8ff; margin: 0;"><strong>Private chat with: ' + d.name + "</strong></div>"), $('a[data-target="#ct_' + d.sid + '"]').tab("show"), $('a.btn[data-dest="all"]').children(".chat-tabs-closer").css("visibility", "visible"), $(".emojionearea-editor").focus());
  787. // break;
  788. // case "inviteview":
  789. // inviteUser("view", e, d.sid, d.name, "");
  790. // break;
  791. // case "inviteroom":
  792. // $("#inviteroom_modal").find("select").html("");
  793. // $("#inviteroom_modal").find("#inviteroom_roomId").val(e);
  794. // $("#inviteroom_modal").find("#inviteroom_sid").val(d.sid);
  795. // $("#inviteroom_modal").find("#inviteroom_name").val(d.name);
  796. // for (var g in roomUserLists) roomUserLists.hasOwnProperty(g) && (a = roomUserLists[g].get("siteId", b.siteId), a.length && "" !== a[0].values().modIcon && $("#inviteroom_modal").find("select").append($("<option>", {
  797. // value: g,
  798. // text: $('#ctabs a[data-target="#ct_' + g + ", #ul_" + g + '"]').find("strong").text()
  799. // })));
  800. // $("#inviteroom_modal").modal("show");
  801. // break;
  802. // case "kick":
  803. // kickUserFromRoom(e, d.sid);
  804. // break;
  805. // case "ban":
  806. // banUserFromRoom(e, d.sid);
  807. // break;
  808. // case "report":
  809. // $("#reportUser_modal .modal-title").html("Report " + d.name);
  810. // $("#report_sid").val(d.sid);
  811. // $("#report_roomid").val(e);
  812. // $("#reportUser_modal .sug_ban_link").html('<small>You can also <a href="' + d.sid + '" data-name="' + d.name + '" id="suggest_ban">suggest a ban</a> of this user.</small>');
  813. // $("#reportUser_modal").modal("show");
  814. // break;
  815. // case "block":
  816. // blockList("block", {
  817. // sid: d.sid,
  818. // siteId: d.siteId,
  819. // clientId: d.clientId,
  820. // name: d.name + (d.siteId ? "" : " (guest)")
  821. // });
  822. // break;
  823. // case "unblock":
  824. // blockList("unblock", {
  825. // siteId: f,
  826. // clientId: c
  827. // })
  828. // }
  829. // }
  830. // })
  831. });
  832. $(function () {
  833.  
  834. // idleInterval = setInterval(timerIncrement, 6E4);
  835. // $(window).bind("mousemove keydown", function() {
  836. // idleTime >= considerIdle && idleNow(!1);
  837. // idleTime = 0
  838. // })
  839. });
  840.  
  841. function timerIncrement() {
  842. // idleTime++;
  843. // idleTime == considerIdle && idleNow(!0)
  844. }
  845.  
  846. function idleNow(a) {
  847. // socket.emit("idle", {
  848. // isIdle: a
  849. // }, function(a) {
  850. // a.sent || console.log("Idle transmission error.")
  851. // })
  852. }
  853. $(function () {
  854. // $("body").on("input", "#optTextSize", function(a) {
  855. // $(".chat-text").css("font-size", $(this).val() + "px")
  856. // });
  857. // $("body").on("hidden.bs.modal", ".modal", function() {
  858. // $("a").blur()
  859. // });
  860. // $("div.checkbox input").change(function() {
  861. // $(this).blur()
  862. // });
  863. // $("#optEnableSidebar").change(function() {
  864. // $("#sidebar").toggleClass("hidden");
  865. // $("#optEnableSidebar").is(":checked") && socket.connected && getSidebarData()
  866. // });
  867. // $("#optStackBrdcsts").change(function() {
  868. // $("#broadcastSlots").toggleClass("stackBrdcsts")
  869. // });
  870. // $("#optDarkTheme").change(function() {
  871. // $("body").toggleClass("dark-theme")
  872. // });
  873. // $(".logo.navbar-btn").removeAttr("href").removeAttr("title")
  874. });
  875. $(window).focus(function () {
  876. // count = 0;
  877. // isActive = !0;
  878. // window.setTimeout(function() {
  879. // $(document).attr("title", "Chat | EpikChat")
  880. // }, 150)
  881. });
  882. $(window).blur(function () {
  883. // count = 0;
  884. // isActive = !1
  885. });
  886. window.onbeforeunload = function (a) {
  887. // if (leave_chat_warning && 0 < localTotal) return a.returnValue = "You have unread messages in open chat rooms or PMs."
  888. };
  889.  
  890. function linkify(a) {
  891. // a = a.replace(/(\b(https?):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim, '<a href="$1" class="tcLink">$1</a>');
  892. // return a = a.replace(/(^|[^\/])(www\.[^.\s:]+\.[^.\s:]+(\b|$))/gim, '$1<a href="http://$2" class="tcLink">$2</a>')
  893. };;
  894. var logItemCount, logItemClicks = readCookie("cl_clicks"),
  895. isActive = !0,
  896. leave_chat_warning = !0,
  897. count = 0;
  898.  
  899. function saveChatSettings() {
  900. // localStorage.setItem("chat_settings", JSON.stringify({
  901. // enableSidebar: $("#optEnableSidebar").is(":checked"),
  902. // stackBrdcsts: $("#optStackBrdcsts").is(":checked"),
  903. // enablePM: $("#optEnablePM").is(":checked"),
  904. // textSize: $("#optTextSize").val(),
  905. // soundsMsg: $("#optSoundsMsg").is(":checked"),
  906. // soundsPoke: $("#optSoundsPoke").is(":checked"),
  907. // soundsViewReq: $("#optSoundsViewReq").is(":checked"),
  908. // showJlMsgs: $("#optShowJlMsgs").is(":checked"),
  909. // textColor: $("#optTextColor").data("color"),
  910. // darkTheme: $("#optDarkTheme").is(":checked")
  911. // }))
  912. }
  913. $(function () {
  914. // var b = localStorage.getItem("chat_settings");
  915. // b && (b = JSON.parse(b), $("#optEnableSidebar").prop("checked", b.enableSidebar), $("#optStackBrdcsts").prop("checked", b.stackBrdcsts), $("#optEnablePM").prop("checked", b.enablePM), $("#optTextSize").val(b.textSize), $("#optSoundsMsg").prop("checked", b.soundsMsg), $("#optSoundsPoke").prop("checked", b.soundsPoke), $("#optSoundsViewReq").prop("checked", b.soundsViewReq), $("#optShowJlMsgs").prop("checked", b.showJlMsgs), $("#optDarkTheme").prop("checked", b.darkTheme), b.enableSidebar || $("#sidebar").addClass("hidden"), b.stackBrdcsts && $("#broadcastSlots").addClass("stackBrdcsts"), b.textColor && $("#optTextColor").data("color", b.textColor), b.darkTheme && $("body").toggleClass("dark-theme"));
  916. // $("#optTextColor").css("background-color", $("#optTextColor").data("color"));
  917. // $('a[data-toggle="tab"]').on("shown.bs.tab", function(a) {
  918. // a = $(a.target).attr("href");
  919. // "#home-media-photos" == a ? $("#media-section-header-text").text("photos") : "#home-media-doodles" == a && $("#media-section-header-text").text("doodles")
  920. // });
  921. // $("#createDoodleModal").draggable({
  922. // handle: ".modal-header",
  923. // containment: "body"
  924. // });
  925. // $("#wPaint").wPaint({
  926. // path: "/sites/all/modules/avc/avc_ui/js/wPaint/",
  927. // bg: "#ffffff",
  928. // menuOffsetLeft: -3,
  929. // menuOffsetTop: 240,
  930. // saveImg: saveImg,
  931. // menuHandle: !1,
  932. // mode: "pencil",
  933. // lineWidth: "3",
  934. // fillStyle: "#2187D8",
  935. // strokeStyle: "#15C223",
  936. // onShapeMove: function(a) {
  937. // $(".uploadDoodle").addClass("btn-success");
  938. // $(".uploadDoodle").prop("disabled", !1)
  939. // }
  940. // });
  941. // $("body").on("click", ".minimize", function() {
  942. // $(this).parent().siblings(".modal-body").hide();
  943. // $(this).parent().parent().parent().parent().css("height", "42px");
  944. // $(this).addClass("maximize");
  945. // $(this).removeClass("minimize");
  946. // $(this).blur()
  947. // });
  948. // $("body").on("click", ".maximize", function() {
  949. // $(this).parent().siblings(".modal-body").show();
  950. // $(this).parent().parent().parent().parent().css("height", $(this).parent().parent().parent().css("height"));
  951. // $(this).addClass("minimize");
  952. // $(this).removeClass("maximize");
  953. // $(this).blur()
  954. // });
  955. // $("body").on("click", ".sbMediaItem", function() {
  956. // viewMedia($(this).data("url"))
  957. // });
  958. // $("body").on("click", ".sbTrendingItem", function() {
  959. // roomInfo($(this).data("roomid"))
  960. // });
  961. // $("body").on("click", "#uploadDoodle", function() {
  962. // $("#uploadDoodle").prop("disabled", !0);
  963. // $.ajax({
  964. // type: "POST",
  965. // url: "/user_media/doodle/post",
  966. // data: {
  967. // title: $("#doodleTitle").val(),
  968. // doodle: $("#wPaint").wPaint("image")
  969. // },
  970. // dataType: "json",
  971. // success: function(a) {
  972. // !0 === a.status ? ($("#doodleSuccess").show(), $("#wPaint").wPaint("clear"), $("#doodleTitle").val("")) : (alertPopup("Error", a.message, "Ok", !1, !1, ""), $("#uploadDoodle").prop("disabled", !1))
  973. // }
  974. // })
  975. // })
  976. });
  977.  
  978. function roomInfo(b) {
  979. // if (!b) return !1;
  980. // socket.emit("getRoomInfo", {
  981. // roomId: b
  982. // }, function(a) {
  983. // if (a.status) {
  984. // var c = "" === a.room.coverImg ? "no_coverImg.jpg" : a.room.coverImg,
  985. // d = "" === a.room.icon ? "no_icon.png" : a.room.icon;
  986. // $("#roomInfoModal").find(".panel-heading").css("background-image", "url(/sites/default/files/chat/room_coverImg_uploads/" + c + ")");
  987. // $("#roomInfoModal").find(".panel-profile-img").attr("src", "/sites/default/files/chat/room_icon_uploads/" + d);
  988. // $("#roomInfoModal").find(".panel-title").html(a.room.name);
  989. // $("#roomInfoModal").find("p").html(a.room.description);
  990. // $("#roomInfoModal").find("button.roomInfo").data("roomid", b).data("passworded", a.room.passworded);
  991. // $("#roomInfoModal").find(".usersCount").html(a.room.users);
  992. // $("#roomInfoModal").find(".modal-title").html(a.room.name);
  993. // $("#roomInfoModal").modal("show")
  994. // } else notifyUser("Error: " + a.message)
  995. // })
  996. }
  997.  
  998. function createDoodle() {
  999. // if ($("#createDoodleModal").hasClass("in")) return !1;
  1000. // if (socket.userData.siteId) $("#doodleSuccess").hide(), $("#createDoodleModal").modal("show");
  1001. // else return alertPopup("Error", 'You must be logged in to create new doodles.<br><a href="/user/login" target="_blank">Log in</a> or <a href="/user/register" target="_blank">Create an account</a>', "Ok", !0, !1, ""), !1
  1002. }
  1003.  
  1004. function uploadPhoto() {
  1005. // if ($("#uploadPhotoModal").hasClass("in")) return !1;
  1006. // if (socket.userData.siteId) $("#upload-photo-content").html(""), $(".indicator").show(), $("#uploadPhotoModal").modal("show"), $("#upload-photo-content").load("https://www.epikchat.com/developer/photos/new/js", function(b, a, c) {
  1007. // "success" == a ? ($(".indicator").hide(), $("#upload-photo-content").show()) : "error" == a && ($(".indicator").hide(), msg = "403" == c.status ? 'You must be logged in to upload photos.<br><a href="/user/login" target="_blank">Log in</a> or <a href="/user/register" target="_blank">Create an account</a>' : "An unexpected error has occured: " + c.statusText + "(" + c.status + ")", $("#upload-photo-content").html('<div class="modal-header" style="padding: 0px 0px 6px 0px;border: none;"><div class="media-body text-center"><br><strong>' + msg + "</strong></div></div>"));
  1008. // $("#upload-photo-content").show()
  1009. // });
  1010. // else return alertPopup("Error", 'You must be logged in to upload photos.<br><a href="/user/login" target="_blank">Log in</a> or <a href="/user/register" target="_blank">Create an account</a>', "Ok", !0, !1, ""), !1
  1011. }
  1012.  
  1013. function saveImg(b) {
  1014. // var a = new Date,
  1015. // c = a.getDate(),
  1016. // d = a.getMonth() + 1;
  1017. // a = a.getFullYear();
  1018. // c = d + "_" + c + "_" + a;
  1019. // d = document.createElement("a");
  1020. // d.href = b;
  1021. // d.download = "My_EpikChat_Doodle_" + c + ".jpg";
  1022. // document.body.appendChild(d);
  1023. // d.click();
  1024. // this._displayStatus("Image saved.")
  1025. };;
  1026.  
  1027.  
  1028. function initSocket() {
  1029. document.getElementById('initialiser').style.display = "none";
  1030. document.getElementById('menu').innerHTML = "<div style='background:white; border-radius:5px; padding:0px 5px 5px 5px;'>" +
  1031. "<center><h3>SOCKET FUNCTIONS</h3></center>" +
  1032. "<a href='#' id='parrot' onclick='(doubleNotif = !doubleNotif)' class='btn btn-success' style='width:100%;'>PARROT [false]</a>" +
  1033. "<a href='#' id='poke' onclick='(autoPoke = !autoPoke)' class='btn btn-success' style='width:100%;'>AUTO POKE [false]</a>" +
  1034. "</div>";
  1035. socket.on("poke", function (a) {
  1036. if (autoPoke === true) {
  1037. pokeUser(a.roomId, a.senderSiteId, a.senderName);
  1038. !1 === isBlocked(a.senderSiteId, a.senderClientId) && (addToChatArea(a.roomId, '<div class="notification"><span style="flex: 1; -ms-flex: 1;"><div class="pull-left bubble poke">😎 You poked back</div></span><span class="time-box pull-right text-right disable-select"><small>' + "" + "</small></span></div>"), notificationSound("Poke"))
  1039. }
  1040. });
  1041. socket.on("connect", function () {
  1042. // $("#loading-overlay").is(":visible") ? (console.log("Connected"), $(".loadingInfo").html("")) : (console.log("Reconnected"), $("#alert_modal").modal("hide"), notifyUser("You have reconnected to the chat."))
  1043. });
  1044. socket.on("connect_error", function (a) {
  1045. // console.log("Connect failed (" + a + ")");
  1046. // $("#loading-overlay").is(":visible") && $(".loadingInfo").html('<p>The connection is taking longer than usual.</p><p>See the <a href="https://status.epikchat.com" target="_blank">status page</a> for information on any known issues.</p>')
  1047. });
  1048. socket.on("reconnect_attempt", function (a) {
  1049. // console.log("Connecting..");
  1050. // $("#alert_modal .modal-body").html("The connection to the chat was interrupted. Attempting to reconnect...<br><br>Connection attempt: " + a)
  1051. });
  1052. socket.on("connectionAccepted", function (a) {
  1053. // console.log("Log on successful (" + socket.id + ")");
  1054. // socket.userData = a.userData;
  1055. // idleTime = 0;
  1056. // viewersList ? (viewersList.clear(), $("#ul_viewers .emptyList").removeClass("hidden")) : (viewersList = new List("ul_viewers", newListOptions), viewersList.on("searchComplete", function(a) {
  1057. // !a.matchingItems.length && 0 < viewersList.size() && $(a.list).html('<div class="p-a text-muted text-center">No results found.</div>')
  1058. // }));
  1059. // if (blockedList)
  1060. // for (a = 0; a < blockedList.items.length; a++) 0 !== blockedList.items[a]._values.siteId && blockedList.remove("siteId", blockedList.items[a]._values.siteId);
  1061. // else blockedList = new List("ul_blocked", blockListOpts), blockedList.on("searchComplete", function(a) {
  1062. // !a.matchingItems.length && 0 < blockedList.size() && $(a.list).html('<div class="p-a text-muted text-center">No results found.</div>')
  1063. // });
  1064. // blockList("list", null);
  1065. // $("#username").text(socket.userData.name);
  1066. // $("#profileImg").attr("src", socket.userData.profileImg);
  1067. // $("#badge").attr("src", "/sites/default/files/badges/" + socket.userData.badge + ".png");
  1068. // $(".chat-nav").show();
  1069. // var b = $(".chat-tabs li").length ? $('.chat-tabs a[data-dest="all"]').map(function() {
  1070. // return $(this).data("roomid")
  1071. // }).get() : Drupal.settings.avc_ui.autoJoin.toString().split(",");
  1072. // for (a = 0; a < b.length; a++) joinRoom(b[a], "");
  1073. // $("#loading-overlay").is(":visible") && (getSidebarData(), setInterval(function() {
  1074. // $("#optEnableSidebar").is(":checked") && socket.connected && getSidebarData()
  1075. // }, 1E4), $("#loading-overlay").fadeOut(), $("#optEnablePM").is(":checked") || setTimeout(function() {
  1076. // notifyUser('<span class="icon icon-info-with-circle pull-left" style="font-size: 16px;margin-right: 7px;height: 20px;"></span> You have private message receiving turned off, people will not be able to send you private messages. You can change this in your <a data-target="#chatSettings_modal" data-toggle="modal" href="">settings</a>.', !1, 2E4)
  1077. // }, 2E3))
  1078. });
  1079. socket.on("systemAnnouncement", function (a) {
  1080. // alertPopup("System Announcement", a.message, "Ok", !1, !1, "")
  1081. });
  1082.  
  1083. socket.on("invite", function (a) {
  1084. // if (!1 === isBlocked(a.senderSiteId, a.senderClientId)) switch (a.type) {
  1085. // case "view":
  1086. // addToChatArea(a.roomId, '<div class="notification"><span style="flex: 1; -ms-flex: 1;"><div class="pull-left bubble invite">' + a.senderName + ' has invited you to <a class="viewInvite cur-pointer" data-sid="' + a.sid + '" data-cam="' + a.cam + '">view their broadcast</a></div></span><span class="time-box pull-right text-right disable-select"><small>' + convertTimestamp(Date.now()) + "</small></span></div>");
  1087. // break;
  1088. // case "room":
  1089. // addToChatArea(a.roomId, '<div class="notification"><span style="flex: 1; -ms-flex: 1;"><div class="pull-left bubble invite">' + a.senderName + ' has invited you to <a class="roomInvite cur-pointer" data-roomid="' + a.invitedRoomId + '" data-passworded="' + a.passworded + '">join room ' + a.invitedRoomName + '</a></div></span><span class="time-box pull-right text-right disable-select"><small>' + convertTimestamp(Date.now()) + "</small></span></div>")
  1090. // }
  1091. });
  1092. socket.on("viewRequest", function (a) {
  1093. // !1 === isBlocked(a.siteId, a.clientId) ? $("#privateBroadcast").is(":checked") ? (notifyUser(a.msg + '<span class="viewOptions pull-right"><a href="#" class="btn btn-sm" onClick="javascript:sendViewResponse(\'' + a.viewer + "', true);$(this).parent('span').html('<small>Permission Granted<small>');return false;\">Accept</a> <a href=\"#\" class=\"btn btn-sm\" onClick=\"javascript:sendViewResponse('" + a.viewer + "', false);$(this).parent('span').html('<small>Permission Denied<small>');return false;\">Deny</a></span><div class=\"spacer\" style=\"clear: both;\"></div></small>"), notificationSound("ViewReq")) : sendViewResponse(a.viewer, !0) : sendViewResponse(a.viewer, !1)
  1094. });
  1095. socket.on("viewResponse", function (a) {
  1096. // a.canView ? startViewing(a.sid, a.name) : notifyUser(a.msg)
  1097. });
  1098. socket.on("viewer", function (a) {
  1099. // "start" == a.action ? (userListAdd("viewers", viewersList, a.user), viewersList.sort("cam", {
  1100. // order: "asc"
  1101. // })) : "stop" == a.action && userListRemove("viewers", viewersList, a.user);
  1102. // $("#viewersCount").text(viewersList.items.length)
  1103. });
  1104. socket.on("vote2ban", function (a) {
  1105. // notifyUser("<strong>Community Vote</strong><br>Would you like to ban: " +
  1106. // a.nominated.name + "<br><small>Started by: " + a.nominator.name + '<span class="voteOptions pull-right"><a href="#" class="btn btn-sm" onClick="javascript:voteForBan(1, \'yes\')">Yes</a> <a href="#" class="btn btn-sm" onClick="javascript:voteForBan(1, \'no\')">No</a></span></small>')
  1107. });
  1108. socket.on("userKicked", function (a) {
  1109. // a.user.sid == socket.id ? (closeChatTab(a.roomId, !0), notifyUser("You were kicked from room: " + a.roomName, !0)) : addToChatArea(a.roomId, '<div class="notification kick"><span style="flex: 1; -ms-flex: 1;">' +
  1110. // a.user.name + " was kicked out of the room by " + a.kickedBy + '</span><span class="time-box pull-right text-right disable-select"><small>' + convertTimestamp(Date.now()) + "</small></span></div>")
  1111. });
  1112. socket.on("userBanned", function (a) {
  1113. // if (a.user.sid == socket.id) {
  1114. // closeChatTab(a.roomId, !0);
  1115. // var b = "";
  1116. // "Community Vote" == a.bannedBy && (b = " (10 minutes)");
  1117. // notifyUser("You were banned from room: " + a.roomName + b, !0)
  1118. // } else addToChatArea(a.roomId, '<div class="notification kick"><span style="flex: 1; -ms-flex: 1;">' + a.user.name +
  1119. // " was banned by " + a.bannedBy + '</span><span class="time-box pull-right text-right disable-select"><small>' + convertTimestamp(Date.now()) + "</small></span></div>")
  1120. });
  1121. socket.on("textMessage", function (a) {
  1122. if (doubleNotif === true) {
  1123. sendChatMsg(processEmoji(linkify(a.msg)));
  1124. }
  1125. // if (!1 === isBlocked(a.senderSiteId, a.senderClientId)) {
  1126. // if ("all" == a.dest) addToChatArea(a.roomId, '<div><span style="color:' + a.format.color + ';"><a data-target="#user_action_modal" data-sid="' + a.sid + '" data-siteid="' + a.senderSiteId + '" data-clientid="' + a.senderClientId + '" style="cursor:pointer;text-decoration:none; outline:none; color:' +
  1127. // a.format.color + ';"><strong>' + a.senderName + ":</strong> </a><span>" + processEmoji(linkify(a.msg)) + '</span></span><span class="time-box pull-right text-right"><small>' + convertTimestamp(a.time) + "</small></span></div>"), a = $('.chat-tabs a[data-target="#ct_' + a.roomId + ", #ul_" + a.roomId + '"]');
  1128. // else {
  1129. // if (!$('a[data-target="#ct_' + a.dest + '"]').length) {
  1130. // if (!$("#optEnablePM").is(":checked")) return !1;
  1131. // newChatTab("#ct_" + a.dest, a.roomId, a.dest, a.senderName, a.dest);
  1132. // addToChatArea(a.dest, '<div style="background-color:#f0f8ff; margin: 0;"><strong>Private chat with: ' +
  1133. // a.senderName + "</strong></div>")
  1134. // }
  1135. // addToChatArea(a.dest, '<div><span style="color:' + a.format.color + ';"><a data-target="#user_action_modal" data-sid="' + a.sid + '" data-siteid="' + a.senderSiteId + '" data-clientid="' + a.senderClientId + '" style="cursor:pointer;text-decoration:none; outline:none; color:' + a.format.color + ';"><strong>' + a.senderName + ":</strong> </a><span>" + processEmoji(linkify(a.msg)) + '</span></span><span class="time-box pull-right text-right"><small>' + convertTimestamp(a.time) + "</small></span></div>");
  1136. // a = $('.chat-tabs a[data-target="#ct_' + a.dest + '"]')
  1137. // }
  1138. // a.hasClass("active") ? (notificationSound("Msg"), onNewMessageReceivedInActiveTab()) : a.children(".num-container").length ? (missed = parseInt(a.children(".num-container").children(".num-circle").html()) + 1, 9 < missed && (missed = "9+"), a.children(".num-container").children(".num-circle").html(missed), a.children(".num-container").show()) : a.append('<span class="num-container"><span class="num-circle visible">1</span></span>')
  1139. // }
  1140. });
  1141. socket.on("userJoin", function (a) {
  1142. //sendChatMsg(a.user.name + " just entered the flippin chatroom :sunglasses:");
  1143. // userListAdd("users", roomUserLists[a.roomId], a.user);
  1144. // roomUserLists[a.roomId].sort("cam", {
  1145. // order: "asc"
  1146. // });
  1147. // $("#optShowJlMsgs").is(":checked") && addToChatArea(a.roomId, '<div class="notification"><span style="flex: 1; -ms-flex: 1;"><div class="pull-left bubble">' + a.user.name + ' has entered the room</div></span><span class="time-box pull-right text-right disable-select"><small>' + convertTimestamp(Date.now()) + "</small></span></div>")
  1148. });
  1149. socket.on("userLeave", function (a) {
  1150. // sendChatMsg(a.user + " Left the chat...");
  1151. // userListRemove("users", roomUserLists[a.roomId], a.user);
  1152. // $("#optShowJlMsgs").is(":checked") && addToChatArea(a.roomId, '<div class="notification"><span style="flex: 1; -ms-flex: 1;"><div class="pull-left bubble">' + a.user.name + ' has left the room</div></span><span class="time-box pull-right text-right disable-select"><small>' + convertTimestamp(Date.now()) + "</small></span></div>")
  1153. });
  1154. socket.on("liveStream", function (a) {
  1155. // addToChatArea(a.roomId, '<div class="notification"><span style="flex: 1; -ms-flex: 1;"><a href="/' + a.user.name + '/live" target="_blank"><div class="pull-left bubble ls">' + a.user.name +
  1156. // ' is live now! Click to watch the broadcast!</div></a></span><span class="time-box pull-right text-right disable-select"><small>' + convertTimestamp(Date.now()) + "</small></span></div>")
  1157. });
  1158. socket.on("userUpdate", function (a) {
  1159. // var b = roomUserLists[a.roomId].get("sid", a.user.sid);
  1160. // idleIcon = 0 !== a.user.idle ? '<svg viewBox="0 0 1000 1000" height="10" width="10" style="margin-top: 8px;margin-left: -9px; position:absolute;"><circle cx="500" cy="500" r="480" fill="#ffffff"></circle><path d="M500,10C229.8,10,10,229.8,10,500c0,270.2,219.8,490,490,490c270.2,0,490-219.8,490-490C990,229.8,770.2,10,500,10L500,10zM500,906.3C276,906.3,93.7,724,93.7,500C93.7,276,276,93.7,500,93.7C724,93.7,906.3,276,906.3,500C906.3,724,724,906.3,500,906.3L500,906.3z M325.3,500c-19.4,0-35.1,15.6-35.1,35s15.7,35,35.1,35h210c19.4,0,35-15.6,35-35V255.1c0-19.4-15.6-35.1-35-35.1c-19.4,0-35,15.7-35,35.1V500L325.3,500L325.3,500z" fill="#5e92c4"></path></svg>' : "";
  1161. // switch (a.user.cam) {
  1162. // case 99:
  1163. // camIcon = '<span class="icon icon-video-camera off"></span>';
  1164. // break;
  1165. // case 0:
  1166. // camIcon = '<span class="icon icon-video-camera"></span>';
  1167. // break;
  1168. // case 1:
  1169. // camIcon = '<span class="icon icon-video-camera"></span><span class="icon icon-lock"></span>'
  1170. // }
  1171. // b[0].values({
  1172. // idle: a.user.idle,
  1173. // idleIcon: idleIcon,
  1174. // cam: a.user.cam + "_" + b[0].values().name,
  1175. // camIcon: camIcon
  1176. // });
  1177. // roomUserLists[a.roomId].sort("cam", {
  1178. // order: "asc"
  1179. // });
  1180. // b = viewersList.get("sid", a.user.sid);
  1181. // b.length && (b[0].values({
  1182. // idle: a.user.idle,
  1183. // idleIcon: idleIcon,
  1184. // cam: a.user.cam + "_" + b[0].values().name,
  1185. // camIcon: camIcon
  1186. // }), viewersList.sort("cam", {
  1187. // order: "asc"
  1188. // }))
  1189. });
  1190. socket.on("editAdmins", function (a) {
  1191. // var b = roomUserLists[a.roomId].get("siteId", a.siteId);
  1192. // "add" == a.action ? (addToChatArea(a.roomId, '<div class="notification"><span style="flex: 1; -ms-flex: 1;"><div class="pull-left bubble">' + a.name + " has been promoted to " + a.type + " by " + a.actionBy + '</div></span><span class="time-box pull-right text-right disable-select"><small>' + convertTimestamp(Date.now()) + "</small></span></div>"), b.length && b[0].values({
  1193. // modIcon: '<span class="icon icon-star"></span>'
  1194. // })) : "remove" == a.action && (addToChatArea(a.roomId, '<div class="notification"><span style="flex: 1; -ms-flex: 1;"><div class="pull-left bubble">' + a.name + "'s " + a.type + " privileges have been revoked by " + a.actionBy + '</div></span><span class="time-box pull-right text-right disable-select"><small>' + convertTimestamp(Date.now()) + "</small></span></div>"), b.length && b[0].values({
  1195. // modIcon: ""
  1196. // }))
  1197. });
  1198. socket.on("sendReport", function (a) {
  1199. // if (null !== webRtcPeerPresenter) {
  1200. // var b = document.getElementById("broadcast"),
  1201. // c = document.createElement("canvas");
  1202. // c.width = b.videoWidth;
  1203. // c.height = b.videoHeight;
  1204. // c.getContext("2d").drawImage(b, 0, 0);
  1205. // $.ajax({
  1206. // url: "/sites/all/modules/avc/avc_ui/reportImgUpload.php",
  1207. // method: "POST",
  1208. // data: {
  1209. // img: c.toDataURL("img/png"),
  1210. // reportId: a.reportId
  1211. // },
  1212. // success: function(a) {}
  1213. // })
  1214. // }
  1215. })
  1216.  
  1217. console.log("Client Ready");
  1218. }
  1219.  
  1220. function joinRoom(a, b) {
  1221. // console.log("Joining rid:" + a);
  1222. // socket.emit("joinRoom", {
  1223. // roomId: a,
  1224. // password: b
  1225. // }, function(c) {
  1226. // !0 === c.joined ? (console.log("Joined rid:" + c.room.roomId), $("#userLists, #chatArea").css("visibility", "visible"), $('#ctabs a[data-roomid="' + c.room.roomId + '"][data-dest="all"]').length ? addToChatArea(a, '<div><small class="text-muted"><i>You have reconnected to the room.</i></small></div>') : (newChatTab("#ct_" + c.room.roomId + ", #ul_" + c.room.roomId, c.room.roomId, "all", c.room.name, c.room.roomId), $('a.btn[data-dest="all"]').children(".chat-tabs-closer").css("visibility", "visible"), c.room.msgHistory.length && Object.keys(c.room.msgHistory).forEach(function(a) {
  1227. // historyText = c.room.msgHistory[a];
  1228. // addToChatArea(c.room.roomId, '<div class="text-muted"><span><strong>' + historyText.senderName + ":</strong> <span>" + processEmoji(historyText.msg) + '</span></span><span class="time-box pull-right text-right disable-select"><small>' + convertTimestamp(historyText.time) + "</small></span></div>")
  1229. // }), addToChatArea(c.room.roomId, '<div style="background-color:#f0f8ff; margin: 0;"><strong>You have entered room: ' +
  1230. // c.room.name + "</strong></div>" + (c.room.welcomeMsg ? '<div style="background-color:#f0f8ff; margin: 0;">' + processEmoji(linkify(c.room.welcomeMsg)) + "</div>" : "")), $("#users > .tab-content").append('<div id="ul_' + c.room.roomId + '" data-roomid="' + c.room.roomId + '" data-roomName="' + c.room.name + '" class="tab-pane btn-group" style="width:100%; height:calc(100% - 30px);"><div class="list" style=" height: 100%; overflow-y: auto; "></div><div class="form-group has-feedback"><input type="text" class="search form-control input-sm" placeholder="Search" /></div></div>')), $('a[data-target="#ct_' + c.room.roomId + ", #ul_" + c.room.roomId + '"]').tab("show"), populateUserList(c.room.users, c.room.roomId, c.room.name), roomUserLists[c.room.roomId].sort("cam", {
  1231. // order: "asc"
  1232. // }), scrollToBottom($('.chat-text[data-id="' + c.room.roomId + '"]')), $(roomUserLists[a].listContainer).children(".list").removeClass("offline")) : (notifyUser(c.msg), console.log("Could not join rid:" + a + " (" + c.msg + ")"), $('#ctabs a[data-roomid="' + a + '"][data-dest="all"]').length && ($(roomUserLists[a].listContainer).children(".list").addClass("offline"), addToChatArea(a, '<div><small class="text-muted"><i>You have reconnected to the chat server but were unable to automatically rejoin this room.</i></small></div>')))
  1233. // })
  1234. }
  1235.  
  1236. function leaveRoom(a, b) {
  1237. // socket.emit("leaveRoom", {
  1238. // roomId: a
  1239. // }, function(a) {
  1240. // !1 === a.left && console.warn(a.msg);
  1241. // b()
  1242. // })
  1243. }
  1244.  
  1245. function sendChatMsg(a) {
  1246. // $tab = $(".chat-tabs .avatar-list-item.active a");
  1247. // $("#message").val("");
  1248. // $(".emojionearea-editor").length && $(".emojionearea-editor").html("");
  1249. // socket.emit("distributeTextMessage", {
  1250. // roomId: $tab.data("roomid"),
  1251. // dest: $tab.data("dest"),
  1252. // msg: a,
  1253. // format: {
  1254. // color: $("#optTextColor").data("color")
  1255. // }
  1256. // }, function(a) {
  1257. // a.sent || ("all" == $tab.data("dest") ? addToChatArea($(".chat-tabs .avatar-list-item.active a").data("roomid"), '<div><small class="text-muted"><i>' + linkify(a.msg) + "</i></small></div>") : addToChatArea($(".chat-tabs .avatar-list-item.active a").data("dest"), '<div><small class="text-muted"><i>' + linkify(a.msg) + "</i></small></div>"))
  1258. // })
  1259. }
  1260.  
  1261. function kickUserFromRoom(a, b) {
  1262. // socket.emit("kickUserFromRoom", {
  1263. // roomId: a,
  1264. // sid: b
  1265. // }, function(a) {
  1266. // a.kicked || notifyUser("Server response error: " + a.msg)
  1267. // })
  1268. }
  1269.  
  1270. function banUserFromRoom(a, b) {
  1271. // socket.emit("banUserFromRoom", {
  1272. // roomId: a,
  1273. // sid: b
  1274. // }, function(a) {
  1275. // a.banned || notifyUser("Server response error: " + a.msg)
  1276. // })
  1277. }
  1278.  
  1279. function pokeUser(a, b, c) {
  1280. // socket.emit("poke", {
  1281. // sid: b,
  1282. // roomId: a
  1283. // }, function(b) {
  1284. // b.success ? (addToChatArea(a, '<div class="notification"><span style="flex: 1; -ms-flex: 1;"><div class="pull-left bubble poke">You have poked ' + c + '</div></span><span class="time-box pull-right text-right disable-select"><small>' + convertTimestamp(Date.now()) + "</small></span></div>"), notificationSound("Poke")) : notifyUser(b.message)
  1285. // })
  1286. }
  1287.  
  1288. function inviteUser(a, b, c, d, e) {
  1289. // socket.emit("invite", {
  1290. // type: a,
  1291. // roomId: b,
  1292. // destination: c,
  1293. // roomInvited: e
  1294. // }, function(b) {
  1295. // b.sent ? notifyUser("You sent a " + a + " invite to " + d) : notifyUser(b.msg)
  1296. // })
  1297. }
  1298.  
  1299. function blockList(a, b) {
  1300. // function c(a, b, c) {
  1301. // for (d in roomUserLists) roomUserLists.hasOwnProperty(d) && (e = roomUserLists[d].get(a, b), e.length && Object.keys(e).forEach(function(a) {
  1302. // e[a].values({
  1303. // blockedIcon: c
  1304. // })
  1305. // }))
  1306. // }
  1307. // var d, e;
  1308. // socket.emit("blockList", {
  1309. // action: a,
  1310. // user: b
  1311. // }, function(e) {
  1312. // if (e.status) switch (a) {
  1313. // case "list":
  1314. // 0 < e.list.length && e.list.map(function(a) {
  1315. // userListAdd("blocked", blockedList, a)
  1316. // });
  1317. // break;
  1318. // case "block":
  1319. // userListAdd("blocked", blockedList, b);
  1320. // b.siteId ? c("siteId", b.siteId, '<span class="icon icon-block"></span>') : c("clientId", b.clientId, '<span class="icon icon-block"></span>');
  1321. // break;
  1322. // case "unblock":
  1323. // userListRemove("blocked", blockedList, b), b.siteId ? c("siteId", b.siteId, "") : c("clientId", b.clientId, "")
  1324. // } else "list" == a ? $("#ul_blocked .emptyList").text("You must be logged in to access your block list") : notifyUser(e.msg)
  1325. // })
  1326. }
  1327.  
  1328. function requestVote(a, b) {
  1329. // socket.emit("requestVote", {
  1330. // roomId: a,
  1331. // nominated: b
  1332. // }, function(a) {
  1333. // a.sent ? notifyUser("<strong>Community Vote</strong><br>A vote to ban user: " + a.nominatedName + " has been started.") : notifyUser("An error occurred: " + a.msg)
  1334. // })
  1335. }
  1336.  
  1337. function voteForBan(a, b) {
  1338. // socket.emit("addVote", {
  1339. // roomId: a,
  1340. // vote: b
  1341. // }, function(a) {
  1342. // $(".voteOptions").html("Voted")
  1343. // })
  1344. }
  1345.  
  1346. function reportUser(a, b, c, d) {
  1347. // socket.emit("reportUser", {
  1348. // roomId: a,
  1349. // reported: b,
  1350. // category: c,
  1351. // details: d
  1352. // }, function(a) {
  1353. // a.sent ? notifyUser("Your report has been sent.") : notifyUser(a.message)
  1354. // })
  1355. }
  1356.  
  1357. function roomsListRefresh() {
  1358. // socket.emit("getRoomsList", function(a) {
  1359. // var b = "",
  1360. // c;
  1361. // a.sort(function(a, b) {
  1362. // return b.users - a.users
  1363. // });
  1364. // for (var d = 0; d < a.length; d++) {
  1365. // room = a[d];
  1366. // var e = c = "";
  1367. // var f = room.icon ? room.icon : "no_icon.png";
  1368. // room.closed ? (e = "span", c = '<li title="Room closed" data-toggle="tooltip" data-container=".media-list" style="font-size: 16px;color: #d83434; margin: -1px 7px;"><span class="icon icon-circle-with-cross"></span></li>') : (e = "a", 0 === room.user_level_restrictions[1] && (c = '<li title="No guest access" data-toggle="tooltip" data-container=".media-list" style="font-size: 15px;color: #FF9800; margin: -1px 7px;"><span class="icon icon-warning"></span></li>'), room.passworded && (c += '<li title="Password protected" data-toggle="tooltip" style="margin: -1px 7px;font-size:15px;" data-container=".media-list" ><span class="icon icon-lock"></span></li>'), c += '<li style="margin: 0px 7px;"><span class="icon icon-users"></span> ' + room.users + "</li>");
  1369. // b += "<" + e + ' class="list-group-item cur-pointer" data-roomid="' + room.roomId + '" data-users="' + room.users + '" data-passworded="' + room.passworded + '"><div class="media"><span class="media-left"><img class="img-circle media-object" src="/sites/default/files/chat/room_icon_uploads/' +
  1370. // f + '" style="width:42px;height:42px;"></span><div class="media-body" style="font-size:14px;"><div class="media-body"><div class="media-body-first">' + room.name + '</div><ul style="color: #676767;" class="nav nav-pills pull-right">' + c + '</ul></div><div class="media-body-secondary">' + room.description + "</div></div></div></" + e + ">"
  1371. // }
  1372. // $(".roomspicker").html(b);
  1373. // $('[data-toggle="tooltip"]').tooltip();
  1374. // $("#showEmpty").is(":checked") ? $(".roomspicker > a[data-users=0]").show() : $(".roomspicker > a[data-users=0]").hide();
  1375. // $("#roomsList_modal").find("h4.modal-title").text("Rooms (" + a.length + ")")
  1376. // })
  1377. }
  1378.  
  1379. function getSidebarData() {
  1380. // socket.emit("getSidebarData", function(a) {
  1381. // var b = [];
  1382. // a.roomList.sort(function(a, b) {
  1383. // return b.users - a.users
  1384. // });
  1385. // $.each(a.roomList, function(a, c) {
  1386. // c.systemRoom || (icon = c.icon ? c.icon : "no_icon.png", b.push('<a class="list-item sbTrendingItem cur-pointer" data-roomid="' + c.roomId + '"><div class="media"><span class="media-left" style="padding-right: 7px;"><img class="img-circle media-object" style="height:32px; width:32px;" src="/sites/default/files/chat/room_icon_uploads/' + icon + '"></span><div class="media-body" style="vertical-align: middle;"><div style="margin-top: -2px;max-width: 130px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">' +
  1387. // c.name + '</div><div class="text-muted" style="margin-top: -3px;font-size: 11px;"><span style="font-size: 11px;" class="icon icon-users"></span><span style="margin-top: -6px;"> ' + c.users + "</span></div></div></div></a>"))
  1388. // });
  1389. // $("#home-trending").html(b.slice(0, 5));
  1390. // var c = [];
  1391. // $.each(a.popularList, function(a, b) {
  1392. // 0 === a ? c.push('<div style="display: block; padding: 4px 10px; color: #555; text-decoration: none;font-weight: 500;"><div class="media"><div class="media-body" style="vertical-align: middle;"><svg width="16" height="16" viewBox="2 -8 28 28" class="pull-left"><path d="M5 19h14v3h-14v-3zm18-11c-.729 0-1.295.79-.832 1.521-1.229 1.474-3.371 2.971-4.355 2.438-1.201-.65-.277-3.302.451-4.982.958.15 1.736-.591 1.736-1.477 0-.829-.672-1.5-1.5-1.5s-1.5.671-1.5 1.5c0 .452.204.853.52 1.127-.645 1.643-2.325 3.807-3.41 3.591-1.347-.268-1.69-3.448-1.685-5.287.62-.183 1.075-.751 1.075-1.431 0-.829-.672-1.5-1.5-1.5s-1.5.671-1.5 1.5c0 .68.455 1.248 1.075 1.432.006 1.839-.338 5.019-1.685 5.287-1.084.216-2.765-1.949-3.41-3.592.316-.274.52-.675.52-1.127 0-.829-.672-1.5-1.5-1.5s-1.5.671-1.5 1.5c0 .886.778 1.627 1.736 1.476.729 1.681 1.652 4.333.451 4.982-.984.533-3.127-.964-4.355-2.438.463-.73-.103-1.52-.832-1.52-.553 0-1 .448-1 1 0 .704.726 1.221 1.413.905 1.134 1.264 3.335 4.242 3.587 7.095h14c.252-2.853 2.453-5.831 3.587-7.095.687.316 1.413-.201 1.413-.905 0-.552-.447-1-1-1z" fill="#de1616" transform="rotate(-15)"></path></svg><span class="popListUn">' +
  1393. // b.name + '</span><span class="pull-right" style=" border-radius: 4px; width: 30px;text-align: center;"><b>' + b.viewers + "</b></span></div></div></div>") : c.push('<div style="display: block; padding: 4px 10px; color: #555; text-decoration: none;font-weight: 500;"><div class="media"><div class="media-body" style="vertical-align: middle;"><span class="popListUn">' + b.name + '</span><span class="pull-right" style=" border-radius: 4px; width: 30px;text-align: center;"><b>' + b.viewers + "</b></span></div></div></div>")
  1394. // });
  1395. // $("#home-popular").html(c);
  1396. // var d = [];
  1397. // socket.userData.siteId ? a.onlineFriends ? $.each(a.onlineFriends, function(a, b) {
  1398. // "online" == b.status && (onlineStatus = '<span class="status-online"></span>');
  1399. // "broadcasting" == b.status && (onlineStatus = '<span class="icon icon-video-camera pull-right" style="color: #1BBD1B;margin-top: -1px;">');
  1400. // d.push('<a href="/' + b.username + '" target="_blank" class="list-item"><div class="media"><span class="media-left" style="padding-right: 7px;"><img class="img-circle media-object" style="height:32px; width:32px;" src="' +
  1401. // b.img + '"></span><div class="media-body" style="vertical-align: middle;">' + b.username + '<span class="pull-right">' + onlineStatus + "</span></div></div></a>")
  1402. // }) : d.push('<div class="p-a text-center"><br><span class="icon icon-emoji-sad" style="font-size: 41px;color: #b5b5b5;"></span><br><small>No one seems to be online at the moment</small></div>') : d.push('<br><center><a href="/user/login" target="_blank" class="m-a-md"><small>Login to see who\'s online</small></a></center>');
  1403. // $("#friendsList").html(d);
  1404. // $.each(a.media, function(a, b) {
  1405. // var c = [],
  1406. // e = [];
  1407. // $.each(b, function(b, d) {
  1408. // e.push('<a class="sbMediaItem cur-pointer" data-url="/' + d.name.toLowerCase() + "/" + a + "/" + d.mid + '"><img src="/sites/default/files/media/' + d.uri + '" width="41" height="41" style="margin: 2px; border-radius: 5px; background: white; border: 1px solid rgba(0, 0, 0, .1);"></a>');
  1409. // c.push('<a class="sbMediaItem cur-pointer" data-url="/' + d.name.toLowerCase() + "/" + a + "/" + d.mid + '"><img src="/sites/default/files/media/' + d.uri + '" width="51" height="51" style="margin: 5px; border-radius: 7px; background: white; border: 1px solid rgba(0, 0, 0, .1);"></a>')
  1410. // });
  1411. // $("#" + a + "List").html(e);
  1412. // $("#home-media-" + a).html(c.slice(0, 3))
  1413. // })
  1414. // })
  1415. }
  1416.  
  1417. function startBroadcasting(a, b) {
  1418. // if (a) return console.log(a);
  1419. // var c = {
  1420. // id: "presenter",
  1421. // streamInfo: {
  1422. // sdpOffer: b,
  1423. // privateBroadcast: $("#privateBroadcast").is(":checked"),
  1424. // srcName: $("select#videoSource option:selected").text(),
  1425. // watermark: $("#watermark").is(":checked")
  1426. // }
  1427. // };
  1428. // $("#privateBroadcast").is(":checked") || $("#watermark").is(":checked") ? ($("#bcstIconWrap").removeClass("hidden"), $("#watermark").is(":checked") ? $("#wmSymbol").removeClass("hidden") : $("#wmSymbol").addClass("hidden"), $("#privateBroadcast").is(":checked") ? $("#lockSymbol").removeClass("hidden") : $("#lockSymbol").addClass("hidden")) : $("#bcstIconWrap").addClass("hidden");
  1429. // socket.emit("userMedia", c, function(a) {
  1430. // a ? console.log(a) : console.log("ERROR")
  1431. // })
  1432. }
  1433.  
  1434. function stopBroadcasting(a) {
  1435. // webRtcPeerPresenter && (a || socket.emit("userMedia", {
  1436. // id: "stopBroadcast",
  1437. // sid: socket.id
  1438. // }, function(a) {
  1439. // a ? console.log(a) : console.log("ERROR")
  1440. // }), meters[socket.id] && meters[socket.id].stop(), webRtcPeerPresenter.dispose(), webRtcPeerPresenter = null);
  1441. // video = document.getElementById("broadcast");
  1442. // video.src = "";
  1443. // window.stream && window.stream.getTracks().forEach(function(a) {
  1444. // a.stop()
  1445. // });
  1446. // try {
  1447. // viewersList.clear()
  1448. // } catch (b) {}
  1449. // $("#viewersCount").text(viewersList.items.length);
  1450. // $('a[data-target="#viewers"]').parent("li").hasClass("active") && usersListTitleChange(viewersList.items.length, "Viewers");
  1451. // $("#ul_viewers .emptyList").removeClass("hidden");
  1452. // $("#broadcastWrapper").hide();
  1453. // $("#thePanel").removeClass("broadcasting");
  1454. // $(".muteMic").removeClass("active");
  1455. // $(".pauseVideo").addClass("active");
  1456. // $("#startBroadcasting").show()
  1457. }
  1458.  
  1459. function startViewing(a, b) {
  1460. // function c(b, c) {
  1461. // if (b) return console.log(b);
  1462. // socket.emit("userMedia", {
  1463. // id: "viewer",
  1464. // streamInfo: {
  1465. // sdpOffer: c,
  1466. // sid: a
  1467. // }
  1468. // }, function(a) {
  1469. // a ? console.log(a) : console.log("ERROR")
  1470. // })
  1471. // }
  1472. // $("#broadcastSlots").append('<div class="bcst-player" data-sid="' + a + '"><div class="stack ecp-overlay"><div class="stopViewing avatar-list-item img-circle cur-pointer" data-sid="' + a + '"><div class="x">\u00d7</div></div><ul class="vidControls avatar-list" style="width: 100%;position: absolute;bottom: 0;"><li class="ecp-mute avatar-list-item pull-left cur-pointer"><svg height="29" version="1.1" viewBox="0 0 32 32" width="29"><path class="ytp-svg-fill ytp-svg-volume-animation-speaker" clip-path="url(#ytp-svg-volume-animation-mask)" d="M8,21 L12,21 L17,26 L17,10 L12,15 L8,15 L8,21 Z M19,14 L19,22 C20.48,21.32 21.5,19.77 21.5,18 C21.5,16.26 20.48,14.74 19,14 ZM19,11.29 C21.89,12.15 24,14.83 24,18 C24,21.17 21.89,23.85 19,24.71 L19,26.77 C23.01,25.86 26,22.28 26,18 C26,13.72 23.01,10.14 19,9.23 L19,11.29 Z" fill="#fff" id="ytp-svg-11"></path></svg><input class="vol-control" type="range" min="0" max="100" step="1" value="100"></li><li class="ecp-fullscreen avatar-list-item pull-right m-a-0 cur-pointer"><svg height="30" version="1.1" viewBox="5 0 32 32" width="30"><g class="ytp-fullscreen-button-corner-0"><use class="ytp-svg-shadow" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#ytp-svg-18"></use><path class="ytp-svg-fill" d="m 10,16 2,0 0,-4 4,0 0,-2 L 10,10 l 0,6 0,0 z" id="ytp-svg-18" fill="#fff"></path></g><g class="ytp-fullscreen-button-corner-1"><use class="ytp-svg-shadow" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#ytp-svg-19"></use><path class="ytp-svg-fill" d="m 20,10 0,2 4,0 0,4 2,0 L 26,10 l -6,0 0,0 z" id="ytp-svg-19" fill="#fff"></path></g><g class="ytp-fullscreen-button-corner-2"><use class="ytp-svg-shadow" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#ytp-svg-20"></use><path class="ytp-svg-fill" d="m 24,24 -4,0 0,2 L 26,26 l 0,-6 -2,0 0,4 0,0 z" id="ytp-svg-20" fill="#fff"></path></g><g class="ytp-fullscreen-button-corner-3"><use class="ytp-svg-shadow" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#ytp-svg-21"></use><path class="ytp-svg-fill" d="M 12,20 10,20 10,26 l 6,0 0,-2 -4,0 0,-4 0,0 z" id="ytp-svg-21" fill="#fff"></path></g></svg></li><li class="ecp-resize avatar-list-item pull-right cur-pointer" style="color: #fff;font-size: 16px;margin-top: 4px;"><span class="icon icon-resize-full-screen"></span></li></ul></div><div class="stack spinner"><div class="ispinner ispinner--white ispinner--animating ispinner--medium"><div class="ispinner__blade"></div><div class="ispinner__blade"></div><div class="ispinner__blade"></div><div class="ispinner__blade"></div><div class="ispinner__blade"></div><div class="ispinner__blade"></div><div class="ispinner__blade"></div><div class="ispinner__blade"></div><div class="ispinner__blade"></div><div class="ispinner__blade"></div><div class="ispinner__blade"></div><div class="ispinner__blade"></div></div></div><div class="username">' +
  1473. // b + '</div><div class="stack"><video autoplay playsinline data-sid="' + a + '" style="width: 100%;height: 100%;background-color: #000;"></video></div></div>');
  1474. // scrollToBottom($(".chat-area > .tab-pane.active .chat-text"));
  1475. // var d = {
  1476. // remoteVideo: document.querySelector('video[data-sid="' + a + '"]'),
  1477. // onicecandidate: function(b) {
  1478. // socket.emit("userMedia", {
  1479. // id: "onIceCandidate",
  1480. // candidate: b,
  1481. // sid: a
  1482. // })
  1483. // }
  1484. // };
  1485. // webRtcPeerViewer[a] = kurentoUtils.WebRtcPeer.WebRtcPeerRecvonly(d, function(b) {
  1486. // if (b) return console.log(b);
  1487. // this.generateOffer(c);
  1488. // "safari" == adapter.browserDetails.browser && ($('.bcst-player[data-sid="' + a + '"]').find(".ecp-mute > svg").click(), $('.bcst-player[data-sid="' + a + '"]').find(".vol-control").addClass("hidden"), $('.bcst-player[data-sid="' + a + '"]').find(".ecp-fullscreen").addClass("hidden"))
  1489. // })
  1490. }
  1491.  
  1492. function stopViewing(a) {
  1493. // socket.emit("userMedia", {
  1494. // id: "stopViewer",
  1495. // broadcaster: a
  1496. // }, function(a) {
  1497. // a ? console.log(a) : console.log("ERROR")
  1498. // });
  1499. // removePlayer(a)
  1500. }
  1501.  
  1502. function sendViewRequest(a, b) {
  1503. // if (!navigator.getUserMedia) return notifyUser("Broadcast viewing is not supported with this browser."), !1;
  1504. // $('.bcst-player[data-sid="' + a + '"]').length ? notifyUser("You are already viewing this user") : socket.emit("viewRequest", {
  1505. // sid: a
  1506. // }, function(a) {
  1507. // a.sent ? String(b).startsWith(1) && notifyUser("Your request to view was sent to " + a.sentTo + ", please wait for a response.") : notifyUser(a.message)
  1508. // })
  1509. }
  1510.  
  1511. function sendViewResponse(a, b) {
  1512. // socket.emit("viewResponse", {
  1513. // viewer: a,
  1514. // canView: b
  1515. // }, function(a) {})
  1516. };;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement