Advertisement
Guest User

Untitled

a guest
May 17th, 2018
391
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 52.60 KB | None | 0 0
  1. 1. Open system/element/actions.php and replace all with this
  2.  
  3. <div data="" value="" class="elem_in aclist aclist_name gprivate rself">
  4. <span class="list_icon"><i class="fa fa-comments theme_color"></i></span><?php echo $lang['private_chat']; ?>
  5. </div>
  6. <div data="" class="elem_in aclist get_info rglobal">
  7. <span class="list_icon"><i class="fa fa-user-circle-o default_color"></i></span><?php echo $lang['info']; ?>
  8. </div>
  9.  
  10.  
  11. <!-- this is how you add menu now -->
  12.  
  13. <div data="" value="" onclick="specialCommand(this, 'bisou')" class="elem_in aclist aclist_name rcustom">
  14. <span class="list_icon"><i class="fa fa-heart heart"></i></span>Give kiss!
  15. </div>
  16. <div data="" value="" onclick="specialCommand(this, 'salue')" class="elem_in aclist aclist_name rcustom">
  17. <span class="list_icon"><i class="fa fa-beer beer_time heart"></i></span>Give beer!
  18. </div>
  19. <div data="" value="" onclick="specialCommand(this, 'ritnik')" class="elem_in aclist aclist_name rcustom">
  20. <span class="list_icon"><i class="fa fa-crosshairs glazba heart"></i></span>Give ass!
  21. </div>
  22. <div data="" value="" onclick="specialCommand(this, 'banan4e')" class="elem_in aclist aclist_name rcustom">
  23. <img src="https://chatclub.bg/emoticon/food/banana.png" width="17" height="17" /> give banana!
  24. </div>
  25.  
  26.  
  27. <!--
  28. <?php if(boomAllow(8)){ ?>
  29. <div data="" onclick="listAction(this, 'mute');" class="elem_in aclist list_action rhigh">
  30. <span class="list_icon"><i class="fa fa-microphone-slash warn"></i></span><?php echo $lang['mute']; ?>
  31. </div>
  32. <div data="" onclick="listAction(this, 'unmute');" class="elem_in aclist list_action rhigh">
  33. <span class="list_icon"><i class="fa fa-microphone success"></i></span><?php echo $lang['unmute']; ?>
  34. </div>
  35. <?php } ?>
  36. <?php if(boomAllow(10)){ ?>
  37. <div data="" onclick="listAction(this, 'ban');" class="elem_in aclist list_action rhigh">
  38. <span class="list_icon"><i class="fa fa-ban error"></i></span><?php echo $lang['ban']; ?>
  39. </div>
  40. <?php } ?>
  41. -->
  42.  
  43. Open js/functions.js and replace all with this:
  44.  
  45. // other used default values
  46. var width = $(window).width();
  47. var height = $(window).height();
  48. var docTitle = document.title;
  49. var actualTopic = '';
  50. var actSpeed = '';
  51. var curActive = 0;
  52. var firstPanel = 'userlist';
  53. var morePriv = 1;
  54. var moreMain = 1;
  55. var scroll = 1;
  56. var PageTitleNotification = {
  57. Vars:{
  58. Interval: null
  59. },
  60. On: function(notification, intervalSpeed){
  61. var _this = this;
  62. _this.Vars.Interval = setInterval(function(){
  63. document.title = (docTitle == document.title)
  64. ? notification
  65. : docTitle;
  66. }, (intervalSpeed) ? intervalSpeed : 1000);
  67. },
  68. Off: function(){
  69. clearInterval(this.Vars.Interval);
  70. document.title = docTitle;
  71. }
  72. }
  73. focused = true;
  74. window.onfocus = function() {
  75. focused = true;
  76. PageTitleNotification.Off();
  77. }
  78. window.onblur = function() {
  79. focused = false;
  80. }
  81. var fload = 0;
  82. var lastPost = 0;
  83. var cAction = 0;
  84. var privReload = 0;
  85. var lastPriv = 0;
  86. var curNotify = 0;
  87. var curReport = 0;
  88. var curFriends = 0;
  89. var notifyLoad = 0;
  90. var curNews = 0;
  91. var globNotify = 0;
  92. var curRm = 0;
  93.  
  94. /*
  95. textReplace = function(t){
  96. t = t.toString();
  97. t = t.replace(/%full%/g, 'this is funny');
  98. return t;
  99. }
  100. */
  101.  
  102. chat_reload = function(){
  103. var cPosted = Date.now();
  104. var postTime = Date.now() + speed;
  105. var checkType = $('#main_chat_type').attr('value');
  106. var priv = $('#get_private').attr('value');
  107. logsControl();
  108. $.ajax({
  109. url: "system/chat_log.php",
  110. type: "post",
  111. cache: false,
  112. dataType: 'json',
  113. data: {
  114. fload: fload,
  115. caction: cAction,
  116. taction: tAction,
  117. last: lastPost,
  118. snum: snum,
  119. preload: privReload,
  120. priv: priv,
  121. lastp: lastPriv,
  122. pcount: pCount,
  123. room: user_room,
  124. notify: globNotify,
  125. token: utk
  126. },
  127. success: function(response){
  128. if(response.check == 99){
  129. location.reload();
  130. return false;
  131. }
  132. else {
  133. var answerTime = Date.now();
  134. var mLogs = response.main_logs;
  135. var mLast = response.main_last;
  136. var sesCompare = response.ses_compare;
  137. var getDel = response.del;
  138. var checkRank = response.urank;
  139. var action = response.action;
  140. var cact = response.cact;
  141. var pLogs = response.priv_logs;
  142. var pLast = response.priv_last;
  143. var getPcount = response.pcount;
  144. var iconPrivate = response.icon_private;
  145. var curp = response.curp;
  146. var newTopic = response.topic;
  147. var newTaction = response.taction;
  148. var friendsCount = response.friends;
  149. var newsCount = response.news;
  150. var noticeCount = response.notify;
  151. var reportCount = response.report;
  152. var setroom = response.setroom;
  153. var useData = response.use;
  154. var newNotify = response.nnotif;
  155. var rm = response.rm;
  156. balStart = response.acval;
  157. speed = response.speed;
  158. uSound = response.user_sound;
  159. inOut = response.acd;
  160.  
  161. if( checkRank != user_rank || action != userAction ){
  162. location.reload();
  163. }
  164. else if(sesCompare != sesid){
  165. overWrite();
  166. }
  167. else if (mLogs == 99 || lastPost == mLast){
  168. scrollIt(fload);
  169. if(answerTime < postTime){
  170. fload = 1;
  171. }
  172. }
  173. else if( mLogs.indexOf("b_o_o_m") >= 1){
  174. $("#show_chat ul").html(mLogs);
  175. cAction = cact;
  176. lastPost = mLast;
  177. fload = 1;
  178. }
  179. else {
  180. if(answerTime < postTime){
  181. $("#show_chat ul").append(mLogs);
  182. if( mLogs.indexOf("my_notice") >= 1 && fload == 1 && uSound > 1){
  183. usernamePlay();
  184. }
  185. if(fload == 1 && uSound > 1){
  186. messagePlay();
  187. }
  188. if(focused == false){
  189. PageTitleNotification.Off();
  190. PageTitleNotification.On(system.newMessage);
  191. }
  192. cAction = cact;
  193. lastPost = mLast;
  194. scrollIt(fload);
  195. fload = 1;
  196. }
  197. }
  198. beautyLogs();
  199. for (var i = 0; i < getDel.length; i++){
  200. $("#log"+getDel[i]).remove();
  201. }
  202. if(answerTime < postTime && curp == $('#get_private').attr('value')){
  203. if(privReload == 1){
  204. if(pLogs == 99){
  205. $('#private_content ul').html('');
  206. }
  207. else{
  208. $('#private_content ul').html(pLogs);
  209. }
  210. scrollPriv(privReload);
  211. lastPriv = pLast;
  212. privReload = 0;
  213. morePriv = 1;
  214. }
  215. else {
  216. if(pLogs == 99 || lastPriv == pLast){
  217. scrollPriv(privReload);
  218. }
  219. else{
  220. if(curp == priv){
  221. $("#private_content ul").append(pLogs);
  222. }
  223. scrollPriv(privReload);
  224. }
  225. if(getPcount !== pCount && uSound > 0){
  226. privatePlay();
  227. pCount = getPcount;
  228. if(focused == false){
  229. PageTitleNotification.Off();
  230. PageTitleNotification.On(system.newMessage);
  231. }
  232. }
  233. else {
  234. pCount = getPcount;
  235. }
  236. lastPriv = pLast;
  237. }
  238. }
  239. if(answerTime < postTime && newTopic != '' && newTopic != actualTopic){
  240. $("#show_chat ul").append(newTopic);
  241. actualTopic = newTopic;
  242. scrollIt(fload);
  243. tAction = newTaction;
  244. }
  245. if(iconPrivate != 0){
  246. $("#notify_private").text(iconPrivate);
  247. $('#notify_private').show();
  248. }
  249. else {
  250. $('#notify_private').hide();
  251. }
  252. if(answerTime < postTime && useData == 1){
  253. if(newsCount > 0){
  254. $('#news_notify').text(newsCount).show();
  255. if(!$('#chat_left:visible').length){
  256. $('#bottom_news_notify').text(newsCount).show();
  257. }
  258. if(notifyLoad > 0){
  259. if(newsCount > curNews){
  260. newsPlay();
  261. }
  262. }
  263. }
  264. else {
  265. $('#news_notify').hide();
  266. $('#bottom_news_notify').hide();
  267. }
  268. if(reportCount > 0){
  269. $('#report_notify').text(reportCount).show();
  270. }
  271. else {
  272. $('#report_notify').hide();
  273. }
  274. if(friendsCount > 0){
  275. $("#notify_friends").text(friendsCount).show();
  276. }
  277. else {
  278. $("#notify_friends").hide();
  279. }
  280. if(noticeCount > 0){
  281. $("#notify_notify").text(noticeCount).show();
  282. }
  283. else {
  284. $("#notify_notify").hide();
  285. }
  286. if(notifyLoad > 0){
  287. if(noticeCount > curNotify || friendsCount > curFriends || reportCount > curReport){
  288. notifyPlay();
  289. }
  290. }
  291. grantRoom(setroom);
  292. curNotify = noticeCount;
  293. curFriends = friendsCount;
  294. curReport = reportCount;
  295. curNews = newsCount;
  296. globNotify = newNotify;
  297. notifyLoad = 1;
  298. }
  299. checkRm(rm);
  300. innactiveControl(cPosted);
  301. }
  302. },
  303. });
  304. }
  305. checkRm = function(rmval){
  306. if(rmval != curRm){
  307. if(rmval == 1){
  308. roomBlock();
  309. }
  310. else if(rmval == 2){
  311. fullBlock();
  312. }
  313. else {
  314. unblockAll();
  315. }
  316. curRm = rmval;
  317. }
  318. }
  319. logsControl = function(){
  320. if($('#show_chat').attr('value') == 1){
  321. var countLog = $('.ch_logs').length;
  322. var countLimit = 90;
  323. var countDiff = countLog - countLimit;
  324. if(countDiff > 0 && countDiff % 2 === 0){
  325. $('#chat_logs_container').find('.ch_logs:lt('+countDiff+')').remove();
  326. moreMain = 1;
  327. }
  328. }
  329. }
  330. manageOthers = function(){
  331. if($('.ch_logs').length > 40){
  332. var otherElem = $( "#show_chat ul li" ).first();
  333. if($(otherElem).hasClass("other_logs")){
  334. $(otherElem).remove();
  335. }
  336. }
  337. }
  338. innactiveControl = function(cPost){
  339. inactiveStart = 2;
  340. inMaxStaff = 2;
  341. inMaxUser = 3;
  342. inIncrement = 125;
  343. cLatency = (Date.now() - cPost);
  344. ac = parseInt(balStart);
  345. sp = parseInt(speed);
  346. nsp = sp + ((curActive - inactiveStart) * inIncrement);
  347. msp = sp * inMaxUser;
  348. if(boomAllow(8)){
  349. msp = sp * inMaxStaff;
  350. }
  351. if(nsp > msp){
  352. nsp = msp;
  353. }
  354. if(ac > 0 && curActive >= inactiveStart){
  355. clearInterval(chatLog);
  356. chatLog = setInterval(chat_reload, nsp);
  357. actSpeed = nsp;
  358. }
  359. else {
  360. clearInterval(chatLog);
  361. chatLog = setInterval(chat_reload, sp);
  362. actSpeed = sp;
  363. }
  364. $('#current_speed').text(actSpeed);
  365. $('#current_latency').text(cLatency);
  366. $('#logs_counter').text($('.ch_logs').length);
  367. }
  368. chatActivity = function(){
  369. curActive++;
  370. isInnactive();
  371. }
  372. resetChatActivity = function(){
  373. curActive = 0;
  374. }
  375. isInnactive = function(){
  376. if(curActive > inOut && !boomAllow(8) && inOut > 0){
  377. logOut();
  378. }
  379. }
  380. roomBlock = function(){
  381. $('#content, #submit_button, #chat_file').prop('disabled', true);
  382. if ($('#chat_file').length){
  383. $("#chat_file")[0].setAttribute("onchange", "doNothing()");
  384. }
  385. }
  386. fullBlock = function(){
  387. $('#content, #submit_button, #chat_file, #private_send, #private_file, #message_content').prop('disabled', true);
  388. if ($('#chat_file').length){
  389. $("#chat_file")[0].setAttribute("onchange", "doNothing()");
  390. }
  391. if ($('#private_file').length){
  392. $("#private_file")[0].setAttribute("onchange", "doNothing()");
  393. }
  394. $(".add_post_container, .add_comment, .do_comment").remove();
  395. }
  396. unblockAll = function(){
  397. $('#content, #submit_button, #chat_file, #private_send, #private_file, #message_content').prop('disabled', false);
  398. if ($('#chat_file').length){
  399. $("#chat_file")[0].setAttribute("onchange", "uploadChat()");
  400. }
  401. if ($('#private_file').length){
  402. $("#private_file")[0].setAttribute("onchange", "uploadPrivate()");
  403. }
  404. }
  405. doNothing = function(){
  406. event.preventDefault();
  407. }
  408. chatRightIt = function(data){
  409. $('#chat_right_data').html(data);
  410. }
  411. warningBox = function(content){
  412. var bbox = '<div class="pad_box centered_element"><i class="warn fa fa-exclamation-triangle big_icon bmargin10"></i><h3>'+content+'</h3></div>';
  413. showModal(bbox);
  414. }
  415. beautyLogs = function(){
  416. $(".ch_logs").removeClass("log2");
  417. $(".ch_logs:even").addClass("log2");
  418. }
  419. scrollIt = function(f){
  420. var t = $('#show_chat ul');
  421. if(f == 0 || $('#show_chat').attr('value') == 1){
  422. t.scrollTop(t.prop("scrollHeight"));
  423. }
  424. }
  425. resizeScroll = function(){
  426. var m = $('#show_chat ul');
  427. m.scrollTop(m.prop("scrollHeight"));
  428. }
  429. scrollPriv = function(z){
  430. var p = $('#private_content');
  431. if(z == 1 || $('#private_content').attr('value') == 1){
  432. p.scrollTop(p.prop("scrollHeight"));
  433. }
  434. }
  435. userReload = function(type){
  436. if($('#container_user:visible').length || type == 1 || firstPanel == 'userlist'){
  437. if(type == 1){
  438. panelIt(0);
  439. }
  440. if ($('.drop_list:visible').length){
  441. return false;
  442. }
  443. else {
  444. $.post('system/panel/user_list.php', {
  445. token: utk,
  446. }, function(response) {
  447. chatRightIt(response);
  448. firstPanel = '';
  449. });
  450. }
  451. }
  452. }
  453. checkSubItem = function(){
  454. if($('.sub_options').length){
  455. $('#ok_sub_item').removeClass('sub_hidden');
  456. }
  457. }
  458. getTextOptions = function(){
  459. $.post('system/box/chat_text.php', {
  460. token: utk,
  461. }, function(response) {
  462. showModal(response);
  463. closeLeft();
  464. });
  465. }
  466. getChatSub = function(){
  467. hideEmoticon();
  468. $('.base_main').addClass('main_hide');
  469. $('.sub_main').removeClass('main_hide');
  470. }
  471. closeChatSub = function(){
  472. $('.base_main').removeClass('main_hide');
  473. $('.sub_main').addClass('main_hide');
  474. }
  475. updateStatus = function(st, zone){
  476. $('#status_list').toggle();
  477. $.post('system/action_profile.php', {
  478. update_status: st,
  479. token: utk
  480. }, function(response) {
  481. if(response == 1){
  482. $('#current_status').html($(zone).html());
  483. }
  484. else if(response == 2){
  485. return false;
  486. }
  487. else {
  488. return false;
  489. }
  490. });
  491. }
  492. closeRight = function(){
  493. $("#chat_right").toggle();
  494. }
  495. overWrite = function(){
  496. $.post('login/logout.php', {
  497. overwrite: 1,
  498. token: utk,
  499. }, function(response) {
  500. location.reload();
  501. });
  502. }
  503. myFriends = function(type){
  504. if($('#container_friends:visible').length || type == 1){
  505. if(type == 1){
  506. panelIt(0);
  507. }
  508. $.post('system/panel/friend_list.php', {
  509. token: utk,
  510. }, function(response) {
  511. chatRightIt(response);
  512. });
  513. }
  514. }
  515. grantRoom = function(type){
  516. if(type == 1){
  517. $('.room_granted').removeClass('nogranted');
  518. }
  519. else {
  520. $('.room_granted').addClass('nogranted');
  521. }
  522. }
  523. backHome = function(){
  524. $.post('system/action_room.php', {
  525. leave_room: '1',
  526. token: utk,
  527. }, function(response) {
  528. location.reload();
  529. });
  530. }
  531. adjustHeight = function(){
  532. var winWidth = $(window).width();
  533. var winHeight = $(window).height();
  534. var headHeight = $('#chat_head').outerHeight();
  535. var menuFooter = $('#my_menu').outerHeight();
  536. var topChatHeight = $('#top_chat_container').outerHeight();
  537. var sideTop = $('#side_close').outerHeight();
  538. var panelBar = $('#right_panel_bar').outerHeight();
  539.  
  540. var ch = (winHeight - menuFooter - headHeight);
  541. var ch2 = (winHeight - menuFooter - headHeight);
  542. var ch3 = (winHeight - menuFooter);
  543. var cb = (ch - topChatHeight);
  544. $(".chatheight").css({
  545. "height": ch2,
  546. });
  547. $('#side_inside').css({ "height": winHeight - sideTop });
  548. if($('#player_box').length){
  549. $('#player_box').css({ "top": headHeight });
  550. }
  551. if(winWidth > leftHide){
  552. $("#chat_left").removeClass("cleft2").addClass("cleft").css("display", "table-cell");
  553. $("#warp_show_chat").css({"height": cb});
  554. $(".pheight").css('height', ch2);
  555. }
  556. else {
  557. $("#chat_left").removeClass("cleft").addClass("cleft2");
  558. $("#warp_show_chat").css({"height": cb});
  559. $(".pheight").css('height', ch3);
  560. }
  561. if(winWidth > rightHide){
  562. $("#chat_right").removeClass("cright2").addClass("cright").css("display", "table-cell");
  563. $(".prheight").css('height', ch2);
  564. $(".crheight").css('height', ch2 - panelBar);
  565. }
  566. else {
  567. $("#chat_right").removeClass("cright").addClass("cright2");
  568. $(".prheight").css('height', ch3);
  569. $(".crheight").css('height', ch3 - panelBar);
  570. }
  571. }
  572. hidePanel = function(){
  573. var wh = $(window).width();
  574. if(wh < leftHide2){
  575. $("#chat_left").hide();
  576. }
  577. if(wh < rightHide2){
  578. if(!$(".boom_keep:visible").length){
  579. $("#chat_right").hide();
  580. }
  581. }
  582. }
  583. forceHidePanel = function(){
  584. var wh = $(window).width();
  585. if(wh < leftHide2){
  586. $("#chat_left").hide();
  587. }
  588. if(wh < rightHide2){
  589. $("#chat_right").hide();
  590. }
  591. }
  592. $(function() {
  593. $( "#private_panel" ).draggable({
  594. handle: ".private_drag",
  595. containment: "document",
  596. });
  597. });
  598. openAvMenu = function(elem, uname, uid, urank){
  599. var zHeight = $(window).height();
  600. var offset = $(elem).offset();
  601. var emoWidth = $(elem).width();
  602. var emoHeight = $(elem).height();
  603. var avMenu = $('#av_menu ul').height();
  604. var avWidth = $('#av_menu ul').width();
  605. var footHeight = $('#my_menu').outerHeight();
  606. var inputHeight = $('#top_chat_container').outerHeight();
  607. var avTop = 0;
  608. var avLeft = 0;
  609.  
  610. $('.avitem').attr('data', uid);
  611. $('.avname').attr('data-name', uname);
  612. $('#av_menu .gprivate').attr('value', uname);
  613.  
  614. if(offset.top > zHeight - avMenu - footHeight - inputHeight){
  615. avTop = offset.top - avMenu + emoHeight;
  616. }
  617. else {
  618. avTop = offset.top;
  619. }
  620. if($('#av_menu').css('left') != '-5000px'){
  621. avLeft = '-5000px';
  622. }
  623. else {
  624. if(rtlMode == 1){
  625. avLeft = offset.left - (avWidth + 5);
  626. }
  627. else {
  628. avLeft = offset.left + emoWidth + 5;
  629. }
  630. }
  631. $('#av_menu').css({
  632. 'left': avLeft,
  633. 'top': avTop,
  634. 'height': avMenu,
  635. });
  636. }
  637. dropUser = function(item, uid, uname, urank, ubot, type){
  638. $('#action_menu .aclist').attr('data', uid);
  639. $('#action_menu .aclist_name').attr('value', uname);
  640. var userDrop = '';
  641. $("#action_menu .rglobal").each(function(){
  642. userDrop += $(this)[0].outerHTML;
  643. });
  644. if(uid != user_id){
  645. $("#action_menu .rself").each(function(){
  646. userDrop += $(this)[0].outerHTML;
  647. });
  648. }
  649. if(urank < user_rank && ubot == 0 && type == 1){
  650. $("#action_menu .rhigh").each(function(){
  651. userDrop += $(this)[0].outerHTML;
  652. });
  653. }
  654. if(uid != user_id && ubot == 0){
  655. $("#action_menu .rcustom").each(function(){
  656. userDrop += $(this)[0].outerHTML;
  657. });
  658. }
  659. if($(item).next('.drop_list').is(":visible")){
  660. $(item).next('.drop_list').html('').slideUp(100);
  661. }
  662. else {
  663. $( ".drop_list" ).each(function() {
  664. $(this).html('').hide();
  665. });
  666. $(item).next('.drop_list').html(userDrop).slideDown(100);
  667. }
  668. }
  669. dropControl = function(item){
  670. if($(item).next('.drop_list').is(":visible")){
  671. $(item).next('.drop_list').slideUp(50);
  672. }
  673. else {
  674. $( ".drop_list" ).each(function() {
  675. $(this).hide();
  676. });
  677. $(item).next('.drop_list').slideDown(50);
  678. }
  679. };
  680. resetAvMenu = function(){
  681. $('#av_menu').css({
  682. 'left': '-5000px',
  683. });
  684. }
  685. closeList = function(){
  686. $('.drop_list').slideUp(100);
  687. resetAvMenu();
  688. hidePanel();
  689. }
  690. function emoticon(target, data){
  691. var countEmo = $("#content").val();
  692. var count = ((countEmo.match(/:/g)||[]).length + 2);
  693. if(count < 42){
  694. if (document.selection) {
  695. sel.text = data;
  696. target.focus();
  697. sel = document.selection.createRange();
  698. }
  699. else if (target.selectionStart || target.selectionStart == '0') {
  700. var start = target.selectionStart;
  701. var end = target.selectionEnd;
  702. target.value = target.value.substring(0, start) + data + target.value.substring(end, target.value.length);
  703. }
  704. else {
  705. target.value += data;
  706. }
  707. setTimeout(function() { $(target).focus(); }, 0);
  708. }
  709. else {
  710. setTimeout(function() { $(target).focus(); }, 0);
  711. }
  712. }
  713. panelIt = function(size){
  714. if(size == 0){
  715. $('#chat_right').css('width', defRightWidth+'px');
  716. }
  717. else {
  718. $('#chat_right').css('width', size+'px');
  719. }
  720. chatRightIt(largeSpinner);
  721. if(!$('#chat_right:visible').length){
  722. $('#chat_right').toggle();
  723. }
  724. }
  725. openPrivate = function(who, whoName){
  726. if(who != user_id && who != 999999){
  727. $('#get_private').attr('value', who);
  728. if(!$('#private_box:visible').length){
  729. $('#private_box').toggle();
  730. }
  731. $('#private_name p').text(whoName);
  732. forceHidePanel();
  733. }
  734. else {
  735. return false;
  736. }
  737. }
  738. closeLeft = function(){
  739. if($(window).width() < leftHide2 && $('#chat_left:visible').length){
  740. $('#chat_left').toggle();
  741. }
  742. }
  743. getRoomList = function(){
  744. panelIt(280);
  745. roomList();
  746. }
  747. uploadIcon = function(target, type){
  748. var upIcon = $(target).attr('data');
  749. if(type == 2){
  750. $('#'+target).removeClass('fa-spinner fa-spin fa-fw').addClass(upIcon);
  751. }
  752. else {
  753. $('#'+target).removeClass(upIcon).addClass('fa-spinner fa-spin fa-fw');
  754. }
  755. }
  756. var waitUpload = 0;
  757. uploadChat = function(){
  758. var file_data = $("#chat_file").prop("files")[0];
  759. var filez = ($("#chat_file")[0].files[0].size / 1024 / 1024).toFixed(2);
  760. if( filez > fmw ){
  761. callSaved(system.fileBig, 3);
  762. }
  763. else if($("#chat_file").val() === ""){
  764. callSaved(system.noFile, 3);
  765. }
  766. else {
  767. if(waitUpload == 0){
  768. waitUpload = 1;
  769. uploadIcon('chat_file_icon', 1);
  770. var form_data = new FormData();
  771. form_data.append("file", file_data)
  772. form_data.append("token", utk)
  773. form_data.append("zone", 'chat')
  774. $.ajax({
  775. url: "system/file_chat.php",
  776. dataType: 'script',
  777. cache: false,
  778. contentType: false,
  779. processData: false,
  780. data: form_data,
  781. type: 'post',
  782. success: function(response){
  783. if(response == 1){
  784. callSaved(system.wrongFile, 3);
  785. }
  786. uploadIcon('chat_file_icon', 2);
  787. waitUpload = 0;
  788. }
  789. })
  790. }
  791. else {
  792. return false;
  793. }
  794. }
  795. }
  796. uploadPrivate = function(){
  797. var target = $('#get_private').attr('value');
  798. var file_data = $("#private_file").prop("files")[0];
  799. var filez = ($("#private_file")[0].files[0].size / 1024 / 1024).toFixed(2);
  800. if( filez > fmw ){
  801. callSaved(system.fileBig, 3);
  802. }
  803. else if($("#private_file").val() === ""){
  804. callSaved(system.noFile, 3);
  805. }
  806. else {
  807. if(waitUpload == 0){
  808. waitUpload = 1;
  809. uploadIcon('private_file_icon', 1);
  810. var form_data = new FormData();
  811. form_data.append("file", file_data)
  812. form_data.append("token", utk)
  813. form_data.append("target", target)
  814. form_data.append("zone", 'private')
  815. $.ajax({
  816. url: "system/file_private.php",
  817. dataType: 'script',
  818. cache: false,
  819. contentType: false,
  820. processData: false,
  821. data: form_data,
  822. type: 'post',
  823. success: function(response){
  824. if(response == 1){
  825. callSaved(system.wrongFile, 3);
  826. }
  827. if(response == 88){
  828. callSaved(system.cannotContact, 3);
  829. }
  830. uploadIcon('private_file_icon', 2);
  831. $("#private_file").val("");
  832. waitUpload = 0;
  833. }
  834. })
  835. }
  836. else {
  837. return false;
  838. }
  839. }
  840. }
  841. getRoomSetting = function(){
  842. $.post('system/box/room_setting.php', {
  843. token: utk,
  844. }, function(response) {
  845. showModal(response, 500);
  846. hideAll();
  847. });
  848. }
  849. saveRoom = function(){
  850. $.post('system/action_room.php', {
  851. save_room: '1',
  852. set_room_name: $('#set_room_name').val(),
  853. set_room_description: $('#set_room_description').val(),
  854. set_room_password: $('#set_room_password').val(),
  855. set_room_player: $('#set_room_player').val(),
  856. token: utk
  857.  
  858. }, function(response) {
  859. if(response == 1){
  860. callSaved(system.saved, 1);
  861. }
  862. if(response == 2){
  863. callSaved(system.roomExist, 3);
  864. }
  865. if(response == 3){
  866. location.reload();
  867. }
  868. if(response == 4){
  869. callSaved(system.roomName, 3);
  870. }
  871. });
  872. }
  873. saveColor = function(){
  874. var newColor = $('.color_choices').attr('data');
  875. var newBold = $('#boldit').attr('data');
  876. $.post('system/action_profile.php', {
  877. save_color: newColor,
  878. save_bold: newBold,
  879. token: utk,
  880. }, function(response) {
  881. });
  882.  
  883. }
  884. getWall = function(){
  885. closeLeft();
  886. panelIt(400);
  887. $.post('system/panel/friend_wall.php', {
  888. token: utk,
  889. }, function(response) {
  890. chatRightIt(response);
  891. });
  892. }
  893. getNews = function(){
  894. closeLeft();
  895. panelIt(400);
  896. $.post('system/panel/news.php', {
  897. token: utk,
  898. }, function(response) {
  899. chatRightIt(response);
  900. $('#news_notify, #bottom_news_notify').hide();
  901. });
  902.  
  903. }
  904. waitNews = 0;
  905. sendNews = function(){
  906. if(waitNews == 0){
  907. var myNews = $('#news_data').val();
  908. var news_file = $('#post_file_data').attr('data-key');
  909. if (/^\s+$/.test(myNews) && news_file == '' || myNews == '' && news_file == ''){
  910. return false;
  911. }
  912. if(myNews.length > 2000){
  913. return false;
  914. }
  915. else{
  916. waitNews = 1;
  917. $.post('system/action_news.php', {
  918. add_news: myNews,
  919. post_file: news_file,
  920. token: utk,
  921. }, function(response) {
  922. if(response == 0){
  923. waitNews = 0;
  924. return false;
  925. }
  926. else {
  927. $("#container_news").prepend(response);
  928. $('#container_news .empty_zone').remove();
  929. $('#news_data').val('').css('height', '34px');
  930. postIcon(2);
  931. waitNews = 0;
  932. }
  933. });
  934. }
  935. }
  936. else {
  937. return false;
  938. }
  939. }
  940. deleteNews = function(t, news){
  941. $.post('system/action_news.php', {
  942. remove_news: news,
  943. token: utk,
  944. }, function(response) {
  945. if(response == 1){
  946. $(t).parent().parent().remove();
  947. }
  948. else {
  949. return false;
  950. }
  951. });
  952. }
  953. friendRequest = function(){
  954. $('#notify_friends').hide();
  955. $.post('system/box/friend_request.php', {
  956. token: utk,
  957. }, function(response) {
  958. showModal(response);
  959. curFriends = 0;
  960. });
  961. }
  962. getNotification = function(){
  963. $('#notify_notify').hide();
  964. $.post('system/box/notification.php', {
  965. token: utk,
  966. }, function(response) {
  967. showModal(response, 400);
  968. curNotify = 0;
  969. });
  970. }
  971.  
  972. postIcon = function(type){
  973. if(type == 2){
  974. $('#post_file_data').html('').hide();
  975. }
  976. else {
  977. $('#post_file_data').html(regSpinner).show();
  978. }
  979. $('#post_file_data').attr('data-key', '');
  980. }
  981. removeFile = function(target){
  982. postIcon(2);
  983. $.post('system/action_files.php', {
  984. remove_uploaded_file: target,
  985. token: utk,
  986. }, function(response) {
  987. });
  988. }
  989. var wallUpload = 0;
  990. uploadWall = function(){
  991. var file_data = $("#wall_file").prop("files")[0];
  992. var filez = ($("#wall_file")[0].files[0].size / 1024 / 1024).toFixed(2);
  993. if( filez > fmw ){
  994. callSaved(system.fileBig, 3);
  995. }
  996. else if($("#wall_file").val() === ""){
  997. callSaved(system.noFile, 3);
  998. }
  999. else {
  1000. if(wallUpload == 0){
  1001. wallUpload = 1;
  1002. postIcon(1);
  1003. var form_data = new FormData();
  1004. form_data.append("file", file_data)
  1005. form_data.append("token", utk)
  1006. $.ajax({
  1007. url: "system/file_wall.php",
  1008. dataType: 'json',
  1009. cache: false,
  1010. contentType: false,
  1011. processData: false,
  1012. data: form_data,
  1013. type: 'post',
  1014. success: function(response){
  1015. var we = response.error;
  1016. if(we > 0){
  1017. if(we == 1){
  1018. callSaved(system.wrongFile, 3);
  1019. }
  1020. postIcon(2);
  1021. }
  1022. else {
  1023. $('#post_file_data').attr('data-key', response.key);
  1024. $('#post_file_data').html(response.file);
  1025. }
  1026. wallUpload = 0;
  1027. }
  1028. })
  1029. }
  1030. else {
  1031. return false;
  1032. }
  1033. }
  1034. }
  1035. var wp = 0;
  1036. postWall = function(){
  1037. if(wp == 0){
  1038. var mypost = $('#friend_post').val();
  1039. var post_file = $('#post_file_data').attr('data-key');
  1040. if (/^\s+$/.test(mypost) && post_file == '' || mypost == '' && post_file == ''){
  1041. return false;
  1042. }
  1043. if(mypost.length > 2000){
  1044. return false;
  1045. }
  1046. else{
  1047. wp = 1;
  1048. $.post('system/action_wall.php', {
  1049. post_to_wall: mypost,
  1050. post_file: post_file,
  1051. token: utk,
  1052. }, function(response) {
  1053. if(response == 2){
  1054. wp = 0;
  1055. return false;
  1056. }
  1057. else if(response == 0){
  1058. callSaved(system.error, 3);
  1059. }
  1060. else {
  1061. $('#container_wall').prepend(response);
  1062. $('#container_wall .empty_zone').remove();
  1063. $('#friend_post').val('').css('height', '34px');
  1064. postIcon(2);
  1065. wp = 0;
  1066. }
  1067. });
  1068. }
  1069. }
  1070. else {
  1071. return false;
  1072. }
  1073. }
  1074. var wr = 0;
  1075. postReply = function(event, id, secret, item) {
  1076. if(event.keyCode == 13 && event.shiftKey == 0){
  1077. var content = $(item).val();
  1078. var code = secret;
  1079. var replyTo = id;
  1080. var updateZone = $(item);
  1081. if (/^\s+$/.test(content) || content == ''){
  1082. return false;
  1083. }
  1084. if(content.length > 1000){
  1085. alert("text is too long");
  1086. }
  1087. else {
  1088. $(item).val('');
  1089. if(wr == 0){
  1090. wr = 1;
  1091. $.post('system/action_wall.php', {
  1092. content: content,
  1093. code: code,
  1094. reply_to_wall: replyTo,
  1095. token: utk,
  1096. }, function(response) {
  1097. if(response == 1){
  1098. wr = 0;
  1099. return false;
  1100. }
  1101. else {
  1102. $('.cmtbox'+replyTo).prepend(response);
  1103. wr = 0;
  1104. }
  1105. });
  1106. }
  1107. else {
  1108. return false;
  1109. }
  1110. }
  1111. }
  1112. else {
  1113. return false;
  1114. }
  1115. }
  1116. moreComment = function(t, secret, id){
  1117. var offset = parseInt($(t).attr("data-current"));
  1118. var max = parseInt($(t).attr('data-max'));
  1119. if(max > offset){
  1120. $.post('system/action_wall.php', {
  1121. load_reply: 1,
  1122. current: offset,
  1123. secret: secret,
  1124. id: id,
  1125. token: utk,
  1126. }, function(response) {
  1127. if(response != 0){
  1128. $('.cmtbox'+id).append(response);
  1129. }
  1130. $(t).attr('data-current', offset + 10);
  1131. });
  1132. var newOffset = offset + 10;
  1133. if(newOffset >= max){
  1134. $('.morebox'+id).html('');
  1135. }
  1136. }
  1137. else {
  1138. return false;
  1139. }
  1140. }
  1141. loadComment = function(id, secret){
  1142. if ($('.cmb'+id+':visible').length){
  1143. $('.cmtbox'+id).html('');
  1144. $('.cmb'+id+' input').val('');
  1145. $('.cmb'+id).hide();
  1146. $('.morebox'+id).html('');
  1147. }
  1148. else {
  1149. $.ajax({
  1150. url: "system/action_wall.php",
  1151. type: "post",
  1152. cache: false,
  1153. dataType: 'json',
  1154. data: {
  1155. load_comment: 1,
  1156. secret: secret,
  1157. id: id,
  1158. token: utk,
  1159. },
  1160. success: function(response){
  1161. var comments = response.reply;
  1162. var more = response.more;
  1163. $('.cmtbox'+id).html(comments);
  1164. $('.cmb'+id).show();
  1165.  
  1166. if(more != 0){
  1167. $('.morebox'+id).html(more);
  1168. }
  1169. },
  1170. });
  1171. }
  1172. }
  1173. showPost = function(i,s) {
  1174. var secret = s;
  1175. var post_id = i;
  1176. $.post('system/box/show_post.php', {
  1177. show_this_post: 1,
  1178. secret: secret,
  1179. post_id: post_id,
  1180. token: utk,
  1181. }, function(response) {
  1182. hideModal();
  1183. showModal(response, 540);
  1184. });
  1185. }
  1186. showPostReport = function(id, type, item) {
  1187. var post_id = id;
  1188. $.post('system/box/post_report.php', {
  1189. post: post_id,
  1190. show_post_report: type,
  1191. token: utk,
  1192. }, function(response) {
  1193. if(response == 1){
  1194. item.remove();
  1195. callSaved(system.alreadyErase, 3);
  1196. }
  1197. else {
  1198. showModal(response, 500);
  1199. }
  1200. });
  1201. }
  1202. doComment = function(t){
  1203. $('.cmb'+t).show();
  1204. $('.cmb'+t+' input').val('');
  1205. }
  1206. deleteWall = function(t){
  1207. $.post('system/action_wall.php', {
  1208. delete_wall_post: t,
  1209. token: utk,
  1210. }, function(response) {
  1211. if(response == 1){
  1212. return false;
  1213. }
  1214. else {
  1215. $('#'+response).remove();
  1216. }
  1217.  
  1218. });
  1219. }
  1220. likeIt = function(t, id){
  1221. var unCount = parseInt($(t).next('.unlike_count').children('.count').text());
  1222. var liCount = parseInt($(t).find('.count').text());
  1223. $.post('system/action_wall.php', {
  1224. like: id,
  1225. token: utk,
  1226. }, function(response) {
  1227. if(response == 1){
  1228. $(t).find('.count').text(liCount + 1);
  1229. $(t).addClass("liked");
  1230. }
  1231. else if(response == 2){
  1232. $(t).find('.count').text(liCount - 1);
  1233. $(t).removeClass("liked");
  1234. }
  1235. else if(response == 3){
  1236. $(t).next('.unlike_count').children('.count').text(unCount - 1);
  1237. $(t).next('.unlike_count').removeClass("unliked");
  1238. $(t).find('.count').text(liCount + 1);
  1239. $(t).addClass("liked");
  1240. }
  1241. else {
  1242. return false;
  1243. }
  1244. });
  1245. }
  1246. unlikeIt = function(t, id){
  1247. var unCount = parseInt($(t).find('.count').text());
  1248. var liCount = parseInt($(t).prev('.like_count').children('.count').text());
  1249. $.post('system/action_wall.php', {
  1250. unlike: id,
  1251. token: utk,
  1252. }, function(response) {
  1253. if(response == 4){
  1254. $(t).find('.count').text(unCount + 1);
  1255. $(t).addClass("unliked");
  1256. }
  1257. else if(response == 5){
  1258. $(t).find('.count').text(unCount - 1);
  1259. $(t).removeClass("unliked");
  1260. }
  1261. else if(response == 6){
  1262. $(t).prev('.like_count').children('.count').text(liCount - 1);
  1263. $(t).prev('.like_count').removeClass("liked");
  1264. $(t).find('.count').text(unCount + 1);
  1265. $(t).addClass("unliked");
  1266. }
  1267. else {
  1268. return false;
  1269. }
  1270. });
  1271. }
  1272. var wLoadMore = 0;
  1273. moreWall = function(d){
  1274. var actual = parseInt($(d).attr("data-current"));
  1275. var maxCount = parseInt($(d).attr("data-total"));
  1276. if(actual < maxCount && wLoadMore == 0){
  1277. wLoadMore = 1;
  1278. $.post('system/action_wall.php', {
  1279. load_more_wall: 1,
  1280. offset: actual,
  1281. load_more: 1,
  1282. token: utk,
  1283. }, function(response) {
  1284. $(d).attr("data-current", actual + 10);
  1285. $('#container_wall').append(response);
  1286. var newOf = actual + 10;
  1287. if(newOf >= maxCount){
  1288. $(d).remove();
  1289. }
  1290. wLoadMore = 0;
  1291. });
  1292. }
  1293. else {
  1294. wLoadMore = 0;
  1295. return false;
  1296. }
  1297. }
  1298. makeReport = function(rpost, type){
  1299. var rReason = $('#report_option').attr('data-r');
  1300. if(rReason == ''){
  1301. callSaved(system.selectSomething, 3);
  1302. }
  1303. else{
  1304. hideModal();
  1305. $.post('system/action_chat.php', {
  1306. report_post: 1,
  1307. type: type,
  1308. post: rpost,
  1309. reason: rReason,
  1310. token: utk,
  1311. }, function(response) {
  1312. if(response == 1){
  1313. callSaved(system.reported, 1);
  1314. }
  1315. else if(response == 2){
  1316. callSaved(system.alreadyReported, 3);
  1317. }
  1318. else if(response == 3){
  1319. callSaved(system.reportLimit, 3);
  1320. }
  1321. else {
  1322. callSaved(system.error, 3);
  1323. }
  1324. });
  1325. }
  1326. }
  1327. openReport = function(id, type){
  1328. $.post('system/box/report.php', {
  1329. type: type,
  1330. id: id,
  1331. token: utk,
  1332. }, function(response) {
  1333. if(response == 3){
  1334. callSaved(system.reportLimit, 3);
  1335. }
  1336. else {
  1337. showModal(response);
  1338. }
  1339. });
  1340. }
  1341. sReport = function(t, reason){
  1342. resetReport();
  1343. $('#report_option').attr('data-r', reason);
  1344. $(t).children('.rcheck').removeClass('fa-circle').addClass('fa-check-circle');
  1345. }
  1346. resetReport = function(){
  1347. $('.rcheck').removeClass('fa-check-circle').addClass('fa-circle');
  1348. $('#report').attr('data-r', '');
  1349. }
  1350. loadReport = function(){
  1351. $.post('system/box/show_report.php', {
  1352. token: utk,
  1353. }, function(response) {
  1354. showModal(response);
  1355. });
  1356. }
  1357. var targetRoom = '';
  1358. accessRoom = function(rt, rank){
  1359. var rp = $('#pass_input').val();
  1360. if(boomAllow(rank)){
  1361. $.post('system/action_room.php', {
  1362. pass: rp,
  1363. room: rt,
  1364. get_in_room: 1,
  1365. token: utk
  1366. }, function(response) {
  1367. if(response == 10){
  1368. hideModal();
  1369. resetRoom(rt);
  1370. }
  1371. else if(response == 5){
  1372. callSaved(system.wrongPass, 3);
  1373. $('#pass_input').val('');
  1374. }
  1375. else if(response == 1){
  1376. callSaved(system.error, 3);
  1377. }
  1378. else if(response == 2){
  1379. callSaved(system.accessRequirement, 3);
  1380. }
  1381. else if(response == 3){
  1382. callSaved(system.roomFull, 3);
  1383. }
  1384. else if(response == 4){
  1385. callSaved(system.error, 3);
  1386. }
  1387. else if(response == 99){
  1388. callSaved(system.roomBlock, 3);
  1389. }
  1390. else {
  1391. callSaved(system.error, 3);
  1392. }
  1393. });
  1394. }
  1395. else {
  1396. callSaved(system.accessRequirement, 3);
  1397. }
  1398. }
  1399. var waitJoin = 0;
  1400. switchRoom = function(room, pass, rank, name){
  1401. targetRoom = name;
  1402. if(room == user_room){
  1403. return false;
  1404. }
  1405. if(waitJoin == 0){
  1406. waitJoin = 1;
  1407. if(boomAllow(rank)){
  1408. if(pass == 1){
  1409. $.post('system/box/pass_room.php', {
  1410. room_rank: rank,
  1411. room_id: room,
  1412. token: utk
  1413. }, function(response) {
  1414. showModal(response);
  1415. waitJoin = 0;
  1416. });
  1417. }
  1418. else {
  1419. $.post('system/action_room.php', {
  1420. room: room,
  1421. get_in_room: 1,
  1422. token: utk
  1423. }, function(response) {
  1424. if(response == 10){
  1425. resetRoom(room);
  1426. }
  1427. else if(response == 99){
  1428. callSaved(system.roomBlock, 3);
  1429. waitJoin = 0;
  1430. }
  1431. else if(response == 3){
  1432. callSaved(system.roomFull, 3);
  1433. waitJoin = 0;
  1434. }
  1435. else {
  1436. waitJoin = 0;
  1437. return false;
  1438. }
  1439. });
  1440. }
  1441. }
  1442. else {
  1443. callSaved(system.accessRequirement, 3);
  1444. waitJoin = 0;
  1445. }
  1446. }
  1447. else {
  1448. return false;
  1449. }
  1450. }
  1451. resetRoom = function(troom){
  1452. user_room = troom;
  1453. $("#show_chat ul").html('');
  1454. fload = 0;
  1455. lastPost = 0;
  1456. waitJoin = 0;
  1457. if(targetRoom == ''){
  1458. targetRoom = docTitle;
  1459. }
  1460. document.title = targetRoom;
  1461. docTitle = targetRoom;
  1462. moreMain = 1;
  1463. hideModal();
  1464. if($(window).width() < rightHide2){
  1465. closeRight();
  1466. }
  1467. else {
  1468. userReload(1);
  1469. }
  1470. }
  1471. roomList = function(){
  1472. $.post('system/panel/room_list.php', {
  1473. token: utk,
  1474. }, function(response) {
  1475. chatRightIt(response);
  1476. });
  1477. }
  1478. waitRoom = 0;
  1479. addRoom = function(){
  1480. var rType = $("#set_room_type").val();
  1481. var rPass = $("#set_room_password").val();
  1482. var rName = $("#set_room_name").val();
  1483. var rDescription = $("#set_room_description").val();
  1484. var er = $("#error_room");
  1485. if (/^\s+$/.test(rName) || rName == ''){
  1486. callSaved(system.emptyField, 3);
  1487. }
  1488. else {
  1489. if(waitRoom == 0){
  1490. waitRoom = 1;
  1491. $.post('system/action_room.php', {
  1492. set_name: rName,
  1493. set_type: rType,
  1494. set_pass: rPass,
  1495. set_description: rDescription,
  1496. from_chat:1,
  1497. token: utk
  1498. }, function(response) {
  1499.  
  1500. if(response == 1){
  1501. callSaved(system.error, 3);
  1502. }
  1503. else if (response == 2){
  1504. callSaved(system.roomName, 3);
  1505. }
  1506. else if (response == 4){
  1507. callSaved(system.shortPass, 3);
  1508. }
  1509. else if (response == 5){
  1510. hideModal();
  1511. callSaved(system.maxRoom, 3);
  1512. }
  1513. else if (response == 6){
  1514. callSaved(system.roomExist, 3);
  1515. }
  1516. else if(response.match(/room/)){
  1517. var splt = response.split('|');
  1518. hideModal();
  1519. targetRoom = splt[0];
  1520. resetRoom(splt[2]);
  1521. }
  1522. else {
  1523. waitRoom = 0;
  1524. return false;
  1525. }
  1526. waitRoom = 0;
  1527. });
  1528. }
  1529. else {
  1530. return false;
  1531. }
  1532. }
  1533. }
  1534. streamLook = function(streamType){
  1535. if($(window).width() > 480){
  1536. var swidth = '480';
  1537. var sheight = '270';
  1538. var mtop = '-160';
  1539. var mleft = '-240';
  1540. var maxHeight = 'none';
  1541. var ctheight = 320;
  1542. }
  1543. else {
  1544. return false;
  1545. }
  1546. $("#wrap_stream").css("width", swidth+"px");
  1547. $("#wrap_stream").css("height", sheight+"px");
  1548. $("#wrap_stream").css("max-height", maxHeight);
  1549. $("#wrap_stream").css("min-height", '60px');
  1550. $("#container_stream").css("margin-top", mtop+"px");
  1551. $("#container_stream").css("margin-left", mleft+"px");
  1552. $("#stream_header").css("width",swidth+"px");
  1553. $("#container_stream").css("height", "auto")
  1554. $("#container_stream").css("width", swidth+"px")
  1555. $('#boom_stream_stream').val("");
  1556. $("#stream_panel").hide();
  1557. }
  1558. hideThisPost = function(elem){
  1559. $(elem).closest( ".other_logs" ).remove();
  1560. }
  1561. openAddons = function(){
  1562. var addonsContent = $('#addons_loaded').html();
  1563. showModal('<div class="pad_box">'+addonsContent+'<div class="clear"></div></div>');
  1564. }
  1565. getMonitor = function(){
  1566. $('#monitor_data').toggle();
  1567. }
  1568. chatInput = function(){
  1569. $('#content').val('');
  1570. if($(window).width() > 768 && $(window).height() > 480){
  1571. $('#content').focus();
  1572. }
  1573. }
  1574. showEmoticon = function(){
  1575. if($('.other_emo_box:visible').length){
  1576. $('.other_emo_box').hide();
  1577. }
  1578. $('#main_emoticon').toggle();
  1579. $('#main_emoticon').attr('value', 0);
  1580. if($('#emo_item').attr('value') == 0){
  1581. lazyBoom();
  1582. $('#emo_item').attr('value', 1);
  1583. }
  1584. }
  1585. hideEmoticon = function(){
  1586. $('#main_emoticon').hide();
  1587. }
  1588. adjustPanelWidth = function(){
  1589. $('.cright, .cright2').css('width', defRightWidth+'px');
  1590. $('.cleft, .cleft2').css('width', defLeftWidth+'px');
  1591. }
  1592. openMoreMenu = function(){
  1593. $('#more_menu_list').toggle();
  1594. }
  1595. registrationMute = function(){
  1596. if(regMute > 0){
  1597. $.post('system/box/registration_mute.php', {
  1598. token: utk,
  1599. }, function(response) {
  1600. showModal(response);
  1601. });
  1602. }
  1603. }
  1604.  
  1605. adjustHeight();
  1606.  
  1607. // document load start -----------------------------------------------------------------------------------------------------
  1608. //--------------------------------------------------------------------------------------------------------------------------
  1609.  
  1610. $(document).ready(function(){
  1611.  
  1612. $(document).click(function() {
  1613. resetChatActivity();
  1614. });
  1615. $(document).keydown(function(){
  1616. resetChatActivity();
  1617. });
  1618.  
  1619. $('#content, #submit_button').prop('disabled', false);
  1620. $('#container_show_chat').on('click', '#show_chat .username', function() {
  1621. emoticon($('#content')[0], $(this).text() + ' ');
  1622. });
  1623.  
  1624. adjustPanelWidth();
  1625. userlist = setInterval(userReload, 30000);
  1626. friendlis = setInterval(myFriends, 30000);
  1627. chatLog = setInterval(chat_reload, speed);
  1628. addBalance = setInterval(chatActivity, 30000);
  1629. clearOtherLogs = setInterval(manageOthers, 30000);
  1630. chat_reload();
  1631. userReload();
  1632. adjustHeight();
  1633. chatActivity();
  1634. registrationMute();
  1635. checkSubItem();
  1636. manageOthers();
  1637.  
  1638. var waitReply = 0;
  1639. $('#main_input').submit(function(event){
  1640. var message = $('#content').val();
  1641. if(message == ''){
  1642. event.preventDefault();
  1643. }
  1644. else if(message == '/console' && boomAllow(10)){
  1645. getConsole();
  1646. event.preventDefault();
  1647. chatInput();
  1648. }
  1649. else if(message == '/monitor'){
  1650. getMonitor();
  1651. event.preventDefault();
  1652. chatInput();
  1653. }
  1654. else if (/^\s+$/.test(message)){
  1655. event.preventDefault();
  1656. chatInput();
  1657. }
  1658. else if(message == '/clean'){
  1659. $('.ch_logs').remove();
  1660. chatInput();
  1661. event.preventDefault();
  1662. }
  1663. else{
  1664. chatInput();
  1665. if(waitReply == 0){
  1666. waitReply = 1;
  1667. $.post('system/chat_process.php', {
  1668. content: message,
  1669. snum: snum,
  1670. token: utk,
  1671. }, function(response) {
  1672. if(response == ''){;
  1673. }
  1674. else if(response == 0){
  1675. callSaved(system.cannotUser, 3);
  1676. }
  1677. else if(response == 1){
  1678. callSaved(system.actionComplete, 1);
  1679. }
  1680. else if (response == 2){
  1681. callSaved(system.alreadyAction, 3);
  1682. }
  1683. else if (response == 3){
  1684. callSaved(system.noUser, 3);
  1685. }
  1686. else if (response == 4){
  1687. callSaved(system.error, 3);
  1688. }
  1689. else if (response == 100){
  1690. checkRm(2);
  1691. }
  1692. else if (response == 202){
  1693. callSaved(system.invalidCommand, 3);
  1694. }
  1695. else{
  1696. $('#name').val('');
  1697. $("#show_chat ul").append(response);
  1698. scrollIt(0);
  1699. }
  1700. waitReply = 0;
  1701. });
  1702. }
  1703. else {
  1704. event.preventDefault();
  1705. }
  1706. }
  1707. return false;
  1708. });
  1709.  
  1710. $(document).on('click', '.closesmilies', function(){
  1711. if( $('#main_emoticon').attr('value') == 0 ){
  1712. $('#main_emoticon').toggle();
  1713. }
  1714. });
  1715.  
  1716. $(document).on('click', '#content, #submit_button', function(){
  1717. var checkLock = $('#main_emoticon').attr('value');
  1718. if(checkLock == 0){
  1719. $('#main_emoticon').hide();
  1720. }
  1721. });
  1722.  
  1723. $(document).on('click', '.sub_main', function(){
  1724. closeChatSub();
  1725. });
  1726.  
  1727. $(document).on('click', '.emo_menu_item', function(){
  1728. var thisEmo = $(this).attr('data');
  1729. var emoSelect = $(this);
  1730. $.post('system/emoticon.php', {
  1731. get_emo: thisEmo,
  1732. token: utk,
  1733. type: 1,
  1734. }, function(response) {
  1735. $('#main_emo').html(response);
  1736. $('.emo_menu_item').removeClass('dark_selected');
  1737. emoSelect.addClass('dark_selected');
  1738. });
  1739. });
  1740.  
  1741. $(document).on('click', '.emo_menu_item_priv', function(){
  1742. var thisEmo = $(this).attr('data');
  1743. var emoSelect = $(this);
  1744. $.post('system/emoticon.php', {
  1745. get_emo: thisEmo,
  1746. type: 2,
  1747. token: utk,
  1748. }, function(response) {
  1749. $('#private_emo').html(response);
  1750. $('.emo_menu_item_priv').removeClass('dark_selected');
  1751. emoSelect.addClass('dark_selected');
  1752. });
  1753. });
  1754.  
  1755. $(document).on('click', '#emo_item_priv, #emo_close_priv, .closesmilies_priv', function(){
  1756. $('#private_emoticon').toggle();
  1757. if($('#emo_item_priv').attr('value') == 0){
  1758. lazyBoom();
  1759. $('#emo_item_priv').attr('value', 1);
  1760. }
  1761. });
  1762.  
  1763. $(document).mouseup(function (e){
  1764. var c = $(".post_drop");
  1765. var c2 = $(".post_options");
  1766. if (!c.is(e.target) && !c2.is(e.target) && c.has(e.target).length === 0){
  1767. c.hide();
  1768. }
  1769. });
  1770.  
  1771. $(document).on('click', '#private_close', function(){
  1772. $('#private_content ul').html(largeSpinner);
  1773. $('#get_private').attr('value', 0);
  1774. $('#private_name p').text('');
  1775. $('#private_box').toggle();
  1776. lastPriv = 0;
  1777. });
  1778.  
  1779. $(document).on('click', '.gprivate', function(){
  1780. morePriv = 0;
  1781. var thisPrivate = $(this).attr('data');
  1782. var thisUser = $(this).attr('value');
  1783. $('#private_content ul').html(largeSpinner);
  1784. openPrivate(thisPrivate, thisUser);
  1785. closeList();
  1786. hideModal();
  1787. privReload = 1;
  1788. lastPriv = 0;
  1789. });
  1790.  
  1791. specialCommand = function(item, action) {
  1792. $.post('system/get_emote.php', {
  1793. special_action: action,
  1794. target: $(item).attr('value'),
  1795. token: utk
  1796. }, function(response) {
  1797. if (response == 44) {
  1798. closeList()
  1799. } else {
  1800. return !1
  1801. }
  1802. })
  1803. }
  1804.  
  1805. $(document).on('click', '.delete_private', function(){
  1806. var toDelete = $(this).attr('data');
  1807. var toClear = $(this);
  1808. $.post('system/action_chat.php', {
  1809. private_delete: toDelete,
  1810. token: utk,
  1811. }, function(response) {
  1812. if(response == 1){
  1813. toClear.parent().hide();
  1814. }
  1815. else {
  1816. return false;
  1817. }
  1818. });
  1819. });
  1820.  
  1821. var pWait = 0;
  1822. $('#private_input').submit(function(event){
  1823. var target = $('#get_private').attr('value');
  1824. var message = $('#message_content').val();
  1825. $('#message_content').val('');
  1826. if(message == ''){
  1827. pWait = 0;
  1828. event.preventDefault();
  1829. }
  1830. else if (/^\s+$/.test(message)){
  1831. pWait = 0;
  1832. event.preventDefault();
  1833. }
  1834. else{
  1835. if(pWait == 0){
  1836. pWait = 1;
  1837. $.post('system/private_process.php', {
  1838. target: target,
  1839. content: message,
  1840. token: utk,
  1841. }, function(response) {
  1842. if(response == 10){
  1843. $("#private_content ul").html('');
  1844. $('#message_content').focus();
  1845. scrollPriv(1);
  1846. }
  1847. else if(response == 20){
  1848. $('#message_content').focus();
  1849. callSaved(system.cannotContact, 3);
  1850. }
  1851. else if (response == 100){
  1852. checkRm(2);
  1853. }
  1854. else {
  1855. $('#message_content').focus();
  1856. $("#private_content ul").append(response);
  1857. scrollPriv(1);
  1858. }
  1859. pWait = 0;
  1860. });
  1861. }
  1862. else {
  1863. event.preventDefault();
  1864. }
  1865. }
  1866. return false;
  1867. });
  1868.  
  1869. $(document).on('click', '#save_room', function(){
  1870. saveRoom();
  1871. });
  1872.  
  1873. $('body').css('overflow', 'hidden');
  1874.  
  1875. $(function() {
  1876. if($(window).width() > 1024){
  1877. $( "#private_box" ).draggable({
  1878. handle: "#private_top",
  1879. containment: "document",
  1880. });
  1881. }
  1882. });
  1883.  
  1884. $('#show_chat ul').scroll(function() {
  1885. var s = $('#show_chat ul').scrollTop();
  1886. var c = $('#show_chat ul').innerHeight();
  1887. var d = $('#show_chat ul')[0].scrollHeight;
  1888. if(s + c >= d - 100){
  1889. $('#show_chat').attr('value', 1);
  1890. }
  1891. else {
  1892. $('#show_chat').attr('value', 0);
  1893. }
  1894.  
  1895. });
  1896.  
  1897. $('#private_content').scroll(function() {
  1898. var s = $('#private_content').scrollTop();
  1899. var c = $('#private_content').innerHeight();
  1900. var d = $('#private_content')[0].scrollHeight;
  1901. if(s + c >= d - 100){
  1902. $('#private_content').attr('value', 1);
  1903. }
  1904. else {
  1905. $('#private_content').attr('value', 0);
  1906. }
  1907.  
  1908. });
  1909.  
  1910. var waitScroll = 0;
  1911. $('#show_chat ul').scroll(function() {
  1912. if(moreMain == 1 && $('#show_chat ul .ch_logs').length != 0){
  1913. var pos = $('#show_chat ul').scrollTop();
  1914. if (pos == 0) {
  1915. if(waitScroll == 0){
  1916. waitScroll = 1;
  1917. var lastlog = $('#show_chat ul .ch_logs').eq(0).attr('id');
  1918. lastget = lastlog.replace('log', '');
  1919. $.ajax({
  1920. url: "system/action_chat.php",
  1921. type: "post",
  1922. cache: false,
  1923. dataType: 'json',
  1924. data: {
  1925. more_chat: lastget,
  1926. token: utk
  1927. },
  1928. success: function(response)
  1929. {
  1930. var ccount = response.total;
  1931. var newLogs = response.clogs;
  1932.  
  1933. if(newLogs != 0){
  1934. $("#show_chat ul").prepend(newLogs);
  1935. }
  1936. if(ccount < 60){
  1937. moreMain = 0;
  1938. }
  1939. $("#"+lastlog).get(0).scrollIntoView();
  1940. beautyLogs();
  1941. waitScroll = 0;
  1942. },
  1943. });
  1944. }
  1945. else {
  1946. return false;
  1947. }
  1948. }
  1949. }
  1950. });
  1951.  
  1952. var waitpScroll = 0;
  1953. $('#private_content').scroll(function() {
  1954. if(morePriv == 1){
  1955. var pos = $('#private_content').scrollTop();
  1956. if (pos == 0) {
  1957. if(waitpScroll == 0){
  1958. waitpScroll = 1;
  1959. var lprivate = $('#private_content ul li').eq(0).attr('id');
  1960. var cprivate = $('#get_private').attr('value');
  1961. lastgetp = lprivate.replace('priv', '');
  1962. $.ajax({
  1963. url: "system/action_chat.php",
  1964. type: "post",
  1965. cache: false,
  1966. dataType: 'json',
  1967. data: {
  1968. more_private: lastgetp,
  1969. target: cprivate,
  1970. token: utk
  1971. },
  1972. success: function(response)
  1973. {
  1974. var prcount = response.total;
  1975. var newpLogs = response.clogs;
  1976.  
  1977. if(newpLogs != 0){
  1978. $("#private_content ul").prepend(newpLogs);
  1979. }
  1980. if(prcount < 30){
  1981. morePriv = 0;
  1982. }
  1983. $("#"+lprivate).get(0).scrollIntoView();
  1984. waitpScroll = 0;
  1985. },
  1986. });
  1987. }
  1988. else {
  1989. return false;
  1990. }
  1991. }
  1992. }
  1993. });
  1994.  
  1995. $(document).on('click', '.user_choice', function() {
  1996. var curColor = $(this).attr('data');
  1997. if($('.color_choices').attr('data') == curColor){
  1998. $('.bccheck').remove();
  1999. $('.color_choices').attr('data', '');
  2000. }
  2001. else {
  2002. $('.bccheck').remove();
  2003. $(this).append('<i class="bccheck fa fa-check"></i>');
  2004. $('.color_choices').attr('data', curColor);
  2005. }
  2006. saveColor();
  2007. });
  2008.  
  2009. $(document).on('keydown', function(event) {
  2010. if( event.which === 13 && event.ctrlKey && event.altKey ) {
  2011. getMonitor();
  2012. }
  2013. });
  2014.  
  2015. $(document).on('click', '#boldit', function() {
  2016. var curBold = $(this).attr('data');
  2017. if(curBold == 'bolded'){
  2018. $(this).attr('data', '').removeClass('theme_btn').addClass('default_btn');
  2019. }
  2020. else {
  2021. $(this).attr('data', 'bolded').removeClass('default_btn').addClass('theme_btn');
  2022. }
  2023. saveColor();
  2024. });
  2025.  
  2026. $(document).on('mouseleave', '#av_menu ul', function(){
  2027. resetAvMenu();
  2028. });
  2029.  
  2030. $(document).on('click', '.closeright', function(){
  2031. closeRight();
  2032. });
  2033.  
  2034. $(document).on('click', '#back_home', function(){
  2035. backHome();
  2036. });
  2037.  
  2038. $(document).on('click', '.menu_header', function() {
  2039. if ($('.menu_drop:visible').length){
  2040. $(".menu_drop").fadeOut(100);
  2041. }
  2042. else {
  2043. $(".menu_drop").fadeIn(200);
  2044. }
  2045. $("#wrap_options").fadeOut(100);
  2046. });
  2047.  
  2048. $(document).on('click', '.other_panels, .addon_button, .head_li, #content', function(){
  2049. $(".menu_drop, #wrap_options").fadeOut(100);
  2050. });
  2051.  
  2052. var addons = '';
  2053.  
  2054. getPrivate = function(){
  2055. $.post('system/box/private_notify.php', {
  2056. token: utk,
  2057. }, function(response) {
  2058. showEmptyModal(response, 400);
  2059. });
  2060. }
  2061.  
  2062. clearPrivateList = function(){
  2063. $.post('system/action_chat.php', {
  2064. clear_private: 1,
  2065. token: utk,
  2066. }, function(response) {
  2067. hideModal();
  2068. });
  2069. }
  2070.  
  2071. var curDel = 1000;
  2072.  
  2073. $(document).on('click', '#show_chat .delete_log', function() {
  2074.  
  2075. var delTime = Math.round(new Date() / 1000);
  2076.  
  2077. if(delTime > ( curDel + 5 )){
  2078. var delType = 0;
  2079. }
  2080. else {
  2081. var delType = 1;
  2082. }
  2083.  
  2084. curDel = delTime;
  2085.  
  2086. var del_post = $(this).attr('value');
  2087. $.post('system/action_chat.php', {
  2088. del_post: del_post,
  2089. type: delType,
  2090. token: utk,
  2091. }, function(response) {
  2092. $("#log"+del_post).remove();
  2093. });
  2094. });
  2095.  
  2096. $(document).on('click', '#close_right', function(){
  2097. closeRight();
  2098. });
  2099.  
  2100. $(document).on('click', '#open_left_menu', function(){
  2101. $('#chat_left').toggle();
  2102. });
  2103.  
  2104. $( window ).resize(function() {
  2105. adjustHeight();
  2106. resizeScroll();
  2107. hidePanel();
  2108. });
  2109.  
  2110. $(document).on('change, paste, keyup', '#search_friend', function(){
  2111. var searchFriend = $(this).val().toLowerCase();
  2112. if(searchFriend == ''){
  2113. $(".fitem").each(function(){
  2114. $(this).show();
  2115. });
  2116. }
  2117. else {
  2118. $(".fitem").each(function(){
  2119. var fdata = $(this).text().toLowerCase();
  2120. if(fdata.indexOf(searchFriend) < 0){
  2121. $(this).hide();
  2122. }
  2123. else if(fdata.indexOf(searchFriend) > 0){
  2124. $(this).show();
  2125. }
  2126. });
  2127. }
  2128. });
  2129.  
  2130. $(document).on('click', '.cur_status', function(){
  2131. $('#status_list').toggle();
  2132. });
  2133.  
  2134. $(document).on('click', '.open_addons', function(){
  2135. $('#addons_chat_list').toggle();
  2136. });
  2137.  
  2138. $(document).on('click', '.status_option', function(){
  2139. var t = $(this);
  2140. var newStatus = $(this).attr('data');
  2141. updateStatus(newStatus, t);
  2142. });
  2143.  
  2144. $(document).on('click', '.more_left', function(){
  2145. $('#more_menu_list').toggle();
  2146. closeLeft();
  2147. });
  2148.  
  2149. $('#container_stream').on('click', '#close_stream', function(){
  2150. $("#wrap_stream iframe").attr("src", "");
  2151. $("#container_stream").hide();
  2152. });
  2153.  
  2154. $(function() {
  2155. $( "#container_stream" ).draggable({
  2156. containment: "document",
  2157. scroll: false
  2158. });
  2159. $( "#stream_panel" ).draggable({
  2160. containment: "document",
  2161. scroll: false
  2162. });
  2163. });
  2164. $(function() {
  2165. $( "#wrap_stream" ).resizable({
  2166. aspectRatio: true,
  2167. minWidth: 320,
  2168. containment: "document",
  2169. handles: "se",
  2170. });
  2171. });
  2172. $("#wrap_stream").resize(function() {
  2173. var streamWidth = $("#wrap_stream").width();
  2174. var streamHeight = $("#wrap_stream").outerHeight();
  2175. var streamHead = $("#stream_header").outerHeight();
  2176.  
  2177. $("#stream_header, #container_stream").css("width", streamWidth);
  2178. $("#container_stream").css("height", streamHeight + streamHead);
  2179. });
  2180.  
  2181. $(document).on('click', '.boom_youtube', function(event){
  2182. event.preventDefault();
  2183. if($(window).height() > 400 && $(window).width() > 400 || streamMobile == 1 && $(window).height() > 400){
  2184. var streamType = $(this).attr("value");
  2185. streamLook(streamType);
  2186. $("#container_stream").fadeIn(300);
  2187. var linkto = $(this).attr("data");
  2188. $("#wrap_stream iframe").attr("src", linkto);
  2189. }
  2190. else {
  2191. alert(streamAvail);
  2192. }
  2193.  
  2194. });
  2195.  
  2196. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement