Advertisement
Guest User

Untitled

a guest
Nov 20th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.13 KB | None | 0 0
  1. /*Define awaiting_duel_response*/
  2. var awaiting_duel_response = false;
  3.  
  4. /*Add chat, red, blue buttons*/
  5. $('#duel').append('<div id="duel" class="chat_btn tab_btn selected" style="pointer-events: none; top: 192px; width: 59px; height: 22px; background-color: #666666; border-top-left-radius: 5px; border-top-right-radius: 5px; text-align: center; font-size: 16px; font-weight: bold; cursor: pointer; color: white; line-height: 24px; left: 842px;">Chat</div>');
  6. $('#duel').append('<div id="duel" class="red_btn tab_btn" style="pointer-events: auto; top: 192px; width: 60px; height: 22px; background-color: #666666; border-top-left-radius: 5px; border-top-right-radius: 5px; text-align: center; font-size: 16px; font-weight: bold; cursor: pointer; color: white; line-height: 24px; left: 903px;">Red</div>');
  7. $('#duel').append('<div id="duel" class="blue_btn tab_btn" style="pointer-events: auto; top: 192px; width: 60px; height: 22px; background-color: #666666; border-top-left-radius: 5px; border-top-right-radius: 5px; text-align: center; font-size: 16px; font-weight: bold; cursor: pointer; color: white; line-height: 24px; left: 964px;">Blue</div>');
  8. $("#duel .chat_btn").hide();
  9. $("#duel .red_btn").hide();
  10. $("#duel .blue_btn").hide();
  11.  
  12. /*Add textbox for history*/
  13. $('#duel').append('<div class="cout_txt2 textarea scrollpane selectable os-host os-theme-dark os-host-overflow os-host-overflow-x os-host-resize-disabled os-host-transition" tabindex="0" style="transform-style: flat; left: 843px; top: 216px; width: 170.6px; height: 197px;"><div class="os-size-auto-observer" style="height: calc(100% + 1px); float: left;"><div class="os-resize-observer observed"></div></div><div class="os-content-glue" style="margin: -4px; width: 168px; height: 219px;"></div><div class="os-padding" style="top: 4px; right: 4px; bottom: 4px; left: 4px;"><div class="os-viewport os-viewport-native-scrollbars-invisible unselectable" style="right: 0px; bottom: 0px;"><div class="os-content selectable os-textarea" style="height: 100%; width: 100%;"></div></div></div><div class="os-scrollbar os-scrollbar-horizontal os-scrollbar-unusable"><div class="os-scrollbar-track" style="background-color: rgba(255, 255, 255, 0.3);"><div class="os-scrollbar-handle" style="width: 99.4152%; transform: translate(0px, 0px); opacity: 0;"></div></div></div><div class="os-scrollbar os-scrollbar-vertical os-scrollbar-unusable"><div class="os-scrollbar-track" style="background-color: rgba(255, 255, 255, 0.3);"><div class="os-scrollbar-handle" style="height: 100%; transform: translate(0px, 0px); opacity: 0;"></div></div></div></div>');
  14. $("#duel .cout_txt2").hide();
  15.  
  16. /*Functionality for chat, red, blue buttons*/
  17. function showChat(e) {
  18. duelTabChange(e);
  19. $("#duel .cout_txt").show();
  20. $("#duel .cout_txt2").hide();
  21. }
  22.  
  23. function showRed(e) {
  24. duelTabChange(e);
  25. $('#duel .cout_txt2').html("");
  26. awaiting_duel_response = true
  27. getBanStatus(player1.username);
  28. $("#duel .cout_txt2").show();
  29. $("#duel .cout_txt").hide();
  30. }
  31.  
  32. function showBlue(e) {
  33. duelTabChange(e);
  34. $('#duel .cout_txt2').html("");
  35. awaiting_duel_response = true
  36. getBanStatus(player2.username);
  37. $("#duel .cout_txt2").show();
  38. $("#duel .cout_txt").hide();
  39. }
  40.  
  41. function duelTabChange(e) {
  42. $('#duel .tab_btn').removeClass("selected");
  43. $('#duel .tab_btn').css("pointer-events", "auto");
  44. $(e.currentTarget).addClass("selected");
  45. $(e.currentTarget).css("pointer-events", "none");
  46. }
  47.  
  48. $('#duel .chat_btn').click(showChat);
  49. $('#duel .red_btn').click(showRed);
  50. $('#duel .blue_btn').click(showBlue);
  51.  
  52. /*Edit banStatusResponse function*/
  53. function banStatusResponse(data) {
  54. hideDim();
  55. if (awaiting_response) {
  56. $('#calls .status_txt').text("Status: " + data.status);
  57. setText($('#calls .status_txt'));
  58. $('#calls .strikes_txt').text("Strikes: " + data.strikes);
  59. $('#calls .result_txt').html(arrayToNotes(data.notes));
  60. awaiting_response = false;
  61. return;
  62. } else if (awaiting_duel_response) {
  63. $('#duel .cout_txt2').html(arrayToNotes(data.notes));
  64. awaiting_duel_response = false;
  65. return;
  66. }
  67. $('#ban_status .ban_note_txt').html(arrayToNotes(data.notes));
  68. $('#ban_status .strikes_txt').text(data.strikes);
  69. $('#ban_status .status_txt').text(data.status);
  70. setText($('#ban_status .status_txt'));
  71. }
  72.  
  73. function initAdmin(){
  74. console.log('initAdmin');
  75. $('#duel .cin_txt').show();
  76. $('#duel .cin_txt').val("");
  77. $('#duel .cin_txt').focus();
  78. $('#duel .html_cb').checked(false);
  79. if (html) {
  80. $('#duel .html_cb').show();
  81. }
  82. $('#cancel_duel_btn').show();
  83. $('#host_loss_btn').show();
  84. $('#opponent_loss_btn').show();
  85. resetDuelButtons();
  86.  
  87. /*Show buttons and textbox*/
  88. $("#duel .chat_btn").show();
  89. $("#duel .red_btn").show();
  90. $("#duel .blue_btn").show();
  91.  
  92. /*Clear leftover history on join*/
  93. $('#duel .cout_txt2').html("");
  94.  
  95. /*Edit duel chat -- this shoudln't have any unintended side effects -- initAdmin will override the size of the textbox*/
  96. $('#duel .cout_txt').attr('style', 'transform-style: flat; left: 843px; top: 216px; !important; width: 170.6px; height: 197px; !important;');
  97.  
  98. /*Edit the refresh button*/
  99. $('#duel .refresh_btn').attr('style', 'top: 218px; !important;');
  100. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement