nagatorofag

JS

Apr 15th, 2024 (edited)
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.50 KB | None | 0 0
  1. function utf8_encode(str_data) {
  2. str_data = str_data.replace(/\r\n/g, "\n");
  3. var utftext = "";
  4. for (var n = 0; n < str_data.length; n++) {
  5. var c = str_data.charCodeAt(n);
  6. if (c < 128) {
  7. utftext += String.fromCharCode(c)
  8. } else if ((c > 127) && (c < 2048)) {
  9. utftext += String.fromCharCode((c >> 6) | 192);
  10. utftext += String.fromCharCode((c & 63) | 128)
  11. } else {
  12. utftext += String.fromCharCode((c >> 12) | 224);
  13. utftext += String.fromCharCode(((c >> 6) & 63) | 128);
  14. utftext += String.fromCharCode((c & 63) | 128)
  15. }
  16. }
  17. return utftext
  18. }
  19.  
  20. function md5(str) {
  21. var RotateLeft = function(lValue, iShiftBits) {
  22. return (lValue << iShiftBits) | (lValue >>> (32 - iShiftBits))
  23. };
  24. var AddUnsigned = function(lX, lY) {
  25. var lX4, lY4, lX8, lY8, lResult;
  26. lX8 = (lX & 0x80000000);
  27. lY8 = (lY & 0x80000000);
  28. lX4 = (lX & 0x40000000);
  29. lY4 = (lY & 0x40000000);
  30. lResult = (lX & 0x3FFFFFFF) + (lY & 0x3FFFFFFF);
  31. if (lX4 & lY4) {
  32. return (lResult ^ 0x80000000 ^ lX8 ^ lY8)
  33. }
  34. if (lX4 | lY4) {
  35. if (lResult & 0x40000000) {
  36. return (lResult ^ 0xC0000000 ^ lX8 ^ lY8)
  37. } else {
  38. return (lResult ^ 0x40000000 ^ lX8 ^ lY8)
  39. }
  40. } else {
  41. return (lResult ^ lX8 ^ lY8)
  42. }
  43. };
  44. var F = function(x, y, z) {
  45. return (x & y) | ((~x) & z)
  46. };
  47. var G = function(x, y, z) {
  48. return (x & z) | (y & (~z))
  49. };
  50. var H = function(x, y, z) {
  51. return (x ^ y ^ z)
  52. };
  53. var I = function(x, y, z) {
  54. return (y ^ (x | (~z)))
  55. };
  56. var FF = function(a, b, c, d, x, s, ac) {
  57. a = AddUnsigned(a, AddUnsigned(AddUnsigned(F(b, c, d), x), ac));
  58. return AddUnsigned(RotateLeft(a, s), b)
  59. };
  60. var GG = function(a, b, c, d, x, s, ac) {
  61. a = AddUnsigned(a, AddUnsigned(AddUnsigned(G(b, c, d), x), ac));
  62. return AddUnsigned(RotateLeft(a, s), b)
  63. };
  64. var HH = function(a, b, c, d, x, s, ac) {
  65. a = AddUnsigned(a, AddUnsigned(AddUnsigned(H(b, c, d), x), ac));
  66. return AddUnsigned(RotateLeft(a, s), b)
  67. };
  68. var II = function(a, b, c, d, x, s, ac) {
  69. a = AddUnsigned(a, AddUnsigned(AddUnsigned(I(b, c, d), x), ac));
  70. return AddUnsigned(RotateLeft(a, s), b)
  71. };
  72. var ConvertToWordArray = function(str) {
  73. var lWordCount;
  74. var lMessageLength = str.length;
  75. var lNumberOfWords_temp1 = lMessageLength + 8;
  76. var lNumberOfWords_temp2 = (lNumberOfWords_temp1 - (lNumberOfWords_temp1 % 64)) / 64;
  77. var lNumberOfWords = (lNumberOfWords_temp2 + 1) * 16;
  78. var lWordArray = Array(lNumberOfWords - 1);
  79. var lBytePosition = 0;
  80. var lByteCount = 0;
  81. while (lByteCount < lMessageLength) {
  82. lWordCount = (lByteCount - (lByteCount % 4)) / 4;
  83. lBytePosition = (lByteCount % 4) * 8;
  84. lWordArray[lWordCount] = (lWordArray[lWordCount] | (str.charCodeAt(lByteCount) << lBytePosition));
  85. lByteCount++
  86. }
  87. lWordCount = (lByteCount - (lByteCount % 4)) / 4;
  88. lBytePosition = (lByteCount % 4) * 8;
  89. lWordArray[lWordCount] = lWordArray[lWordCount] | (0x80 << lBytePosition);
  90. lWordArray[lNumberOfWords - 2] = lMessageLength << 3;
  91. lWordArray[lNumberOfWords - 1] = lMessageLength >>> 29;
  92. return lWordArray
  93. };
  94. var WordToHex = function(lValue) {
  95. var WordToHexValue = "",
  96. WordToHexValue_temp = "",
  97. lByte, lCount;
  98. for (lCount = 0; lCount <= 3; lCount++) {
  99. lByte = (lValue >>> (lCount * 8)) & 255;
  100. WordToHexValue_temp = "0" + lByte.toString(16);
  101. WordToHexValue = WordToHexValue + WordToHexValue_temp.substr(WordToHexValue_temp.length - 2, 2)
  102. }
  103. return WordToHexValue
  104. };
  105. var x = Array();
  106. var k, AA, BB, CC, DD, a, b, c, d;
  107. var S11 = 7,
  108. S12 = 12,
  109. S13 = 17,
  110. S14 = 22;
  111. var S21 = 5,
  112. S22 = 9,
  113. S23 = 14,
  114. S24 = 20;
  115. var S31 = 4,
  116. S32 = 11,
  117. S33 = 16,
  118. S34 = 23;
  119. var S41 = 6,
  120. S42 = 10,
  121. S43 = 15,
  122. S44 = 21;
  123. str = this.utf8_encode(str);
  124. x = ConvertToWordArray(str);
  125. a = 0x67452301;
  126. b = 0xEFCDAB89;
  127. c = 0x98BADCFE;
  128. d = 0x10325476;
  129. for (k = 0; k < x.length; k += 16) {
  130. AA = a;
  131. BB = b;
  132. CC = c;
  133. DD = d;
  134. a = FF(a, b, c, d, x[k + 0], S11, 0xD76AA478);
  135. d = FF(d, a, b, c, x[k + 1], S12, 0xE8C7B756);
  136. c = FF(c, d, a, b, x[k + 2], S13, 0x242070DB);
  137. b = FF(b, c, d, a, x[k + 3], S14, 0xC1BDCEEE);
  138. a = FF(a, b, c, d, x[k + 4], S11, 0xF57C0FAF);
  139. d = FF(d, a, b, c, x[k + 5], S12, 0x4787C62A);
  140. c = FF(c, d, a, b, x[k + 6], S13, 0xA8304613);
  141. b = FF(b, c, d, a, x[k + 7], S14, 0xFD469501);
  142. a = FF(a, b, c, d, x[k + 8], S11, 0x698098D8);
  143. d = FF(d, a, b, c, x[k + 9], S12, 0x8B44F7AF);
  144. c = FF(c, d, a, b, x[k + 10], S13, 0xFFFF5BB1);
  145. b = FF(b, c, d, a, x[k + 11], S14, 0x895CD7BE);
  146. a = FF(a, b, c, d, x[k + 12], S11, 0x6B901122);
  147. d = FF(d, a, b, c, x[k + 13], S12, 0xFD987193);
  148. c = FF(c, d, a, b, x[k + 14], S13, 0xA679438E);
  149. b = FF(b, c, d, a, x[k + 15], S14, 0x49B40821);
  150. a = GG(a, b, c, d, x[k + 1], S21, 0xF61E2562);
  151. d = GG(d, a, b, c, x[k + 6], S22, 0xC040B340);
  152. c = GG(c, d, a, b, x[k + 11], S23, 0x265E5A51);
  153. b = GG(b, c, d, a, x[k + 0], S24, 0xE9B6C7AA);
  154. a = GG(a, b, c, d, x[k + 5], S21, 0xD62F105D);
  155. d = GG(d, a, b, c, x[k + 10], S22, 0x2441453);
  156. c = GG(c, d, a, b, x[k + 15], S23, 0xD8A1E681);
  157. b = GG(b, c, d, a, x[k + 4], S24, 0xE7D3FBC8);
  158. a = GG(a, b, c, d, x[k + 9], S21, 0x21E1CDE6);
  159. d = GG(d, a, b, c, x[k + 14], S22, 0xC33707D6);
  160. c = GG(c, d, a, b, x[k + 3], S23, 0xF4D50D87);
  161. b = GG(b, c, d, a, x[k + 8], S24, 0x455A14ED);
  162. a = GG(a, b, c, d, x[k + 13], S21, 0xA9E3E905);
  163. d = GG(d, a, b, c, x[k + 2], S22, 0xFCEFA3F8);
  164. c = GG(c, d, a, b, x[k + 7], S23, 0x676F02D9);
  165. b = GG(b, c, d, a, x[k + 12], S24, 0x8D2A4C8A);
  166. a = HH(a, b, c, d, x[k + 5], S31, 0xFFFA3942);
  167. d = HH(d, a, b, c, x[k + 8], S32, 0x8771F681);
  168. c = HH(c, d, a, b, x[k + 11], S33, 0x6D9D6122);
  169. b = HH(b, c, d, a, x[k + 14], S34, 0xFDE5380C);
  170. a = HH(a, b, c, d, x[k + 1], S31, 0xA4BEEA44);
  171. d = HH(d, a, b, c, x[k + 4], S32, 0x4BDECFA9);
  172. c = HH(c, d, a, b, x[k + 7], S33, 0xF6BB4B60);
  173. b = HH(b, c, d, a, x[k + 10], S34, 0xBEBFBC70);
  174. a = HH(a, b, c, d, x[k + 13], S31, 0x289B7EC6);
  175. d = HH(d, a, b, c, x[k + 0], S32, 0xEAA127FA);
  176. c = HH(c, d, a, b, x[k + 3], S33, 0xD4EF3085);
  177. b = HH(b, c, d, a, x[k + 6], S34, 0x4881D05);
  178. a = HH(a, b, c, d, x[k + 9], S31, 0xD9D4D039);
  179. d = HH(d, a, b, c, x[k + 12], S32, 0xE6DB99E5);
  180. c = HH(c, d, a, b, x[k + 15], S33, 0x1FA27CF8);
  181. b = HH(b, c, d, a, x[k + 2], S34, 0xC4AC5665);
  182. a = II(a, b, c, d, x[k + 0], S41, 0xF4292244);
  183. d = II(d, a, b, c, x[k + 7], S42, 0x432AFF97);
  184. c = II(c, d, a, b, x[k + 14], S43, 0xAB9423A7);
  185. b = II(b, c, d, a, x[k + 5], S44, 0xFC93A039);
  186. a = II(a, b, c, d, x[k + 12], S41, 0x655B59C3);
  187. d = II(d, a, b, c, x[k + 3], S42, 0x8F0CCC92);
  188. c = II(c, d, a, b, x[k + 10], S43, 0xFFEFF47D);
  189. b = II(b, c, d, a, x[k + 1], S44, 0x85845DD1);
  190. a = II(a, b, c, d, x[k + 8], S41, 0x6FA87E4F);
  191. d = II(d, a, b, c, x[k + 15], S42, 0xFE2CE6E0);
  192. c = II(c, d, a, b, x[k + 6], S43, 0xA3014314);
  193. b = II(b, c, d, a, x[k + 13], S44, 0x4E0811A1);
  194. a = II(a, b, c, d, x[k + 4], S41, 0xF7537E82);
  195. d = II(d, a, b, c, x[k + 11], S42, 0xBD3AF235);
  196. c = II(c, d, a, b, x[k + 2], S43, 0x2AD7D2BB);
  197. b = II(b, c, d, a, x[k + 9], S44, 0xEB86D391);
  198. a = AddUnsigned(a, AA);
  199. b = AddUnsigned(b, BB);
  200. c = AddUnsigned(c, CC);
  201. d = AddUnsigned(d, DD)
  202. }
  203. var temp = WordToHex(a) + WordToHex(b) + WordToHex(c) + WordToHex(d);
  204. return temp.toLowerCase()
  205. }(function() {
  206. window.formatChatMessage = function(data, last) {
  207. if (!data.meta || data.msgclass) {
  208. data.meta = {
  209. addClass: data.msgclass,
  210. addClassToNameAndTimestamp: data.msgclass
  211. }
  212. }
  213. var skip = data.username === last.name;
  214. if (data.meta.addClass === "server-whisper")
  215. skip = !0;
  216. if (data.msg.match(/^\s*<strong>\w+\s*:\s*<\/strong>\s*/))
  217. skip = !1;
  218. if (data.meta.forceShowName)
  219. skip = !1;
  220. data.msg = stripImages(data.msg);
  221. data.msg = execEmotes(data.msg);
  222. last.name = data.username;
  223. var div = $("<div/>");
  224. if (data.meta.addClass === "drink") {
  225. div.addClass("drink");
  226. data.meta.addClass = ""
  227. }
  228. if (USEROPTS.show_timestamps) {
  229. var time = $("<span/>").addClass("timestamp").appendTo(div);
  230. var timestamp = new Date(data.time).toTimeString().split(" ")[0];
  231. time.text("[" + timestamp + "] ");
  232. if (data.meta.addClass && data.meta.addClassToNameAndTimestamp) {
  233. time.addClass(data.meta.addClass)
  234. }
  235. }
  236. var name = $("<span/>");
  237. var safeUsername = data.username.replace(/[^\w-]/g, '\\$');
  238. if (!skip) {
  239. name.appendTo(div)
  240. }
  241. $("<strong/>").addClass("username username-" + safeUsername).text(data.username + ": ").appendTo(name);
  242. if (data.meta.modflair) {
  243. name.addClass(getNameColor(data.meta.modflair))
  244. }
  245. if (data.meta.addClass && data.meta.addClassToNameAndTimestamp) {
  246. name.addClass(data.meta.addClass)
  247. }
  248. if (data.meta.superadminflair) {
  249. name.addClass("label").addClass(data.meta.superadminflair.labelclass);
  250. $("<span/>").addClass(data.meta.superadminflair.icon).addClass("glyphicon").css("margin-right", "3px").prependTo(name)
  251. }
  252. var message = $("<span/>").appendTo(div);
  253. message[0].innerHTML = data.msg;
  254. if (data.meta.action) {
  255. name.remove();
  256. message[0].innerHTML = data.username + " " + data.msg
  257. }
  258. if (data.meta.addClass) {
  259. message.addClass(data.meta.addClass)
  260. }
  261. if (data.meta.shadow) {
  262. div.addClass("chat-shadow")
  263. }
  264. return div
  265. }
  266. window.nickcolors = {};
  267. document.body.appendChild(document.createElement('style'));
  268. window.nickcolorssheet = document.styleSheets[document.styleSheets.length - 1];
  269. Callbacks.chatMsg = function(data) {
  270. if (window.nickcolors[data.username] == undefined) {
  271. var rule, m;
  272. var safeUsername = data.username.replace(/[^\w-]/g, '\\$');
  273. m = md5(data.username);
  274. window.nickcolors[data.username] = '#' + m[0] + m[2] + m[4] + m[6] + m[8] + m[10];
  275. rule = '.username-' + safeUsername + ' {color:' + window.nickcolors[data.username] + ';}'
  276. window.nickcolorssheet.insertRule(rule, window.nickcolorssheet.cssRules.length)
  277. }
  278. addChatMessage(data)
  279. }
  280. })();
  281.  
  282. function markup(start, end) {
  283. element = $('#chatline').get(0);
  284. if (document.selection) {
  285. element.focus();
  286. sel = document.selection.createRange();
  287. sel.text = start + sel.text + end
  288. } else if (element.selectionStart || element.selectionStart == '0') {
  289. element.focus();
  290. var startPos = element.selectionStart;
  291. var endPos = element.selectionEnd;
  292. element.value = element.value.substring(0, startPos) + start + element.value.substring(startPos, endPos) + end + element.value.substring(endPos, element.value.length)
  293. } else {
  294. element.value += start + end
  295. }
  296. }(function() {
  297. $('#leftcontrols').append('<div id="text-controls" class="btn-group pull-right" style="display:none;"><button class="btn btn-sm btn-default" id="textctrl-bold" title="Жирный текст˜" onclick="javascript:markup(\'**\', \'**\')">B</button><button class="btn btn-sm btn-default" id="textctrl-code" title="Код" onclick="javascript:markup(\'`\', \'`\')">&lt;&gt;</button><button class="btn btn-sm btn-default" style="font-style: italic;" id="textctrl-italic" title="Курсив" onclick="javascript:markup(\'//\', \'//\')">I</button><button class="btn btn-sm btn-default" id="textctrl-strike" title="Зачеркнутый" onclick="javascript:markup(\'~~\', \'~~\')">S</button><button class="btn btn-sm btn-default" id="textctrl-spoiler" title="Спойлер" onclick="javascript:markup(\'[sp]\', \'[/sp]\')">[]</button></div>');
  298. $('#chatline').focus(function() {
  299. $('#text-controls').fadeIn('slow')
  300. }).blur(function() {
  301. if (window.textcontrolsfocustimeout) return;
  302. window.textcontrolsfocustimeout = setTimeout(function() {
  303. if (!$('#chatline').is(':focus')) {
  304. $('#text-controls').fadeOut('slow')
  305. }
  306. window.textcontrolsfocustimeout = !1
  307. }, 3000)
  308. })
  309. })();
  310.  
  311. function handleVideoResize() {
  312. if ($("#ytapiplayer").length === 0) return;
  313. var intv, ticks = 0;
  314. var resize = function() {
  315. if (++ticks > 10) clearInterval(intv);
  316. if ($("#ytapiplayer").parent().outerHeight() <= 0) return;
  317. clearInterval(intv);
  318. var responsiveFrame = $("#ytapiplayer").parent();
  319. var height = responsiveFrame.outerHeight() - $("#chatline").outerHeight() - 2;
  320. $("#messagebuffer").height(height + 3);
  321. $("#userlist").height(height - 3);
  322. $("#ytapiplayer").attr("height", VHEIGHT = responsiveFrame.outerHeight());
  323. $("#ytapiplayer").attr("width", VWIDTH = responsiveFrame.outerWidth())
  324. };
  325. if ($("#ytapiplayer").height() > 0) resize();
  326. else intv = setInterval(resize, 500)
  327. }
  328. $('body').on('click', '.chat-picture', function(event) {
  329. event.preventDefault()
  330. var _source = $(this).attr('src')
  331. $('#js_image_container').find('.cmds-content').html('<img class="chat-picture-modal" src="' + _source + '">')
  332. $('#js_image_container').modal('show')
  333. })
  334. $('body').on('click', '#js_image_container', function(event) {
  335. event.preventDefault()
  336. $('#js_image_container').modal('hide')
  337. })
  338. var imgurUpload = function() {
  339. if ($("#uploadbtn").length == 0)
  340. $("#leftcontrols").append('<button id="uploadbtn" class="btn btn-sm btn-default" title="Загрузить изображение" data-toggle="modal" data-target="#imgupload"><span class="glyphicon glyphicon-uploadbtn"></span></button>');
  341. $("body").append('<div class="modal fade" id="imgupload" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"><div class="modal-dialog"><div class="modal-content"><div class="modal-header"><button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button><h4 class="modal-title" id="myModalLabel">Загрузка изображения с компьютера<a href="http://imgur.com" target="_blank"><div class="imgur-logo"></div></a></h4></div><div class="modal-body"><div class="upload"><input type="file" id="image_selector" /></div><img src="" id="image_preview" /></div></div></div></div>');
  342. $("body").append('<div class="modal fade" id="js_image_container" style="text-align: center;" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"><div class="modal-dialog"><div class="modal-content"><div class="modal-header"><button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">Г—</span><span class="sr-only">Close</span></button><h4 class="modal-title" id="myModalLabel">Картинка</h4></div><div class="modal-body"><div class="cmds-content"></div></div></div></div></div>');
  343. var clearFields = function() {
  344. $("#image_selector").val('');
  345. $("#image_preview").attr('src', '');
  346. $("#imgupload").css({
  347. 'cursor': 'auto'
  348. })
  349. };
  350. $("#image_selector").on("change", function() {
  351. var reader = new FileReader();
  352. reader.onload = function(e) {
  353. var data = e.target.result.substr(e.target.result.indexOf(",") + 1, e.target.result.length);
  354. $("#image_preview").attr("src", e.target.result);
  355. $.ajax({
  356. url: 'https://api.imgur.com/3/image',
  357. headers: {
  358. 'Authorization': 'Client-ID 711a7fc76bd63f3'
  359. },
  360. type: 'POST',
  361. data: {
  362. 'image': data,
  363. 'type': 'base64'
  364. },
  365. beforeSend: function() {
  366. $("#imgupload").css({
  367. 'cursor': 'wait'
  368. })
  369. },
  370. success: function(response) {
  371. $("#imgupload").modal('hide');
  372. clearFields();
  373. $("#chatline").val($("#chatline").val() + response.data.link.substring(0));
  374. window.setTimeout(function() {
  375. $('#chatline').focus()
  376. }, 400)
  377. },
  378. error: function() {
  379. alert("Ошибка.");
  380. clearFields()
  381. }
  382. })
  383. };
  384. reader.readAsDataURL(this.files[0])
  385. })
  386. }
  387. if ($("#uploadbtn").length == 0)
  388. imgurUpload();
  389.  
  390. function openImageWindow(src) {
  391. var image = new Image();
  392. image.src = src;
  393. var width = image.width;
  394. var height = image.height;
  395. window.open(src, "Image", "width=" + width + ",height=" + height)
  396. }
  397. $("#newpollbtn").html('<span class="glyphicon glyphicon-poll"></span>').prop('title', 'Создать опрос')
  398. $("#togglemotd").unbind('click');
  399. $("#togglemotd").click(function() {
  400. var hidden = $("#motd").css("display") === "none";
  401. $("#motd").toggle();
  402. if (hidden) {
  403. $("#togglemotd").find(".glyphicon-plus").removeClass("glyphicon-plus").addClass("glyphicon-minus");
  404. document.querySelector("#motdwrap").removeAttribute("style")
  405. } else {
  406. $("#togglemotd").find(".glyphicon-minus").removeClass("glyphicon-minus").addClass("glyphicon-plus");
  407. $("#motdwrap").css("padding", "0px").css("margin-bottom", "0px").css("background", "none").css("border", "none")
  408. }
  409. });
  410. if (!ddg_444dgdgds4____) {
  411. var ddg_444dgdgds4____ = !0;
  412. Callbacks.changeMedia = (function(oldChangeMedia) {
  413. return function(data) {
  414. oldChangeMedia(data);
  415. $("#currenttitle").html(`<b>${data.title}</b> | ${$(".queue_active").attr("title")}`)
  416. }
  417. })(window.Callbacks.changeMedia);
  418. const hideVideoButton = document.createElement("button");
  419. hideVideoButton.classList.value = "btn btn-sm btn-default";
  420. hideVideoButton.innerHTML = "Закрыть плеер";
  421. const video = document.querySelectorAll('.embed-responsive-item')[0];
  422.  
  423. function toggleVideo() {
  424. if (!video.hided) {
  425. document.querySelectorAll('.embed-responsive-item')[0].remove();
  426. video.hided = !0;
  427. hideVideoButton.innerHTML = "Раскрыть плеер"
  428. } else {
  429. $('.embed-responsive').append(video);
  430. PLAYER.mediaType = "";
  431. PLAYER.mediaId = "";
  432. socket.emit("playerReady");
  433. video.hided = !1;
  434. hideVideoButton.innerHTML = "Закрыть плеер"
  435. }
  436. }
  437. hideVideoButton.onclick = toggleVideo;
  438. $("#videocontrols").append(hideVideoButton);
  439. $('#emotelistbtn').remove();
  440. $('#leftcontrols').append(' <button id="emotesbtn" class="btn btn-sm btn-default">Смайлики</button>');
  441. $('#playlistrow').prepend('<div id="smiles-panel"></div>');
  442. $('#smiles-panel').hide();
  443. for (var smiles = CHANNEL.emotes, n = 0, smilesLen = smiles.length; smilesLen > n; n++) {
  444. $(`<div class="emote">
  445. <img src="${smiles[n].image}" class="channel-emote" title="${smiles[n].name}" onclick="insertText('${' ' + smiles[n].name + ' '}')">
  446. </div>`).appendTo('#smiles-panel');
  447. }
  448. var insertText = function(str, bool) {
  449. let formated_str = bool ? str + $("#chatline").val() : $("#chatline").val() + str;
  450. $("#chatline").val(formated_str).focus()
  451. }
  452. document.querySelector('#emotesbtn').onclick = function() {
  453. $('#smiles-panel').slideToggle(200);
  454. $(this).toggleClass('active')
  455. }
  456. }
  457. $(document).on("click", ".username", e => {
  458. insertText(e.target.innerHTML, !0)
  459. })
  460.  
  461. window.formatChatMessage = (function(oldFormatChatMessage) {
  462. return function(data, last) {
  463. const div = oldFormatChatMessage(data, last);
  464. const user = window.findUserlistItem(data.username);
  465. if (div[0].lastChild.lastChild.dataset) {
  466. if (div[0].lastChild.lastChild.dataset.vocaroo) {
  467. div[0].lastChild.lastChild.innerHTML = '<iframe width="300" height="60"' + 'src="https://vocaroo.com/embed/' + div[0].lastChild.lastChild.dataset.vocaroo + '" frameborder="0"></iframe>'
  468. }
  469. }
  470. return div
  471. }
  472. })(window.formatChatMessage)
Add Comment
Please, Sign In to add comment