Advertisement
Guest User

Untitled

a guest
Jul 27th, 2016
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.58 KB | None | 0 0
  1. function custom() {
  2.  
  3. function widgets() {
  4.  
  5. var ided;
  6. var uid;
  7. var username;
  8.  
  9. accept = function() {
  10.  
  11. socket.emit('updbanl', {uid: parseInt(uid)});
  12. socket.emit('message', {msg:'edited the banlist', nickto:'0', colorsht: colorshout, font: fontype, size: fontsize, bold: fontbold, uidto:0, type: 'system'});
  13.  
  14. }
  15.  
  16. blocker = ".jquery-modal.blocker";
  17.  
  18. menu = function() {
  19.  
  20. $('body').prepend(
  21. '<div class="modal current" style="position: fixed; top: 50%; left: 50%; margin-top: -65px; margin-left: -200px; z-index: 8; display: block;">' +
  22. '<div style="overflow-y: auto; max-height: 120px;"><table cellspacing="3" cellpadding="3" class="tborder">' +
  23. '<tbody>' +
  24. '<tr>' +
  25. '<td class="thead" colspan="2">' +
  26. '<div><strong>Ban User</strong></div>' +
  27. '</td>' +
  28. '</tr>' +
  29. '<tr>' +
  30. '<td class="trow1"><span>Are you sure that you would like to ban ' + username + '?</span></td>' +
  31. '</tr>' +
  32. '</tbody>' +
  33. '</table>' +
  34. '</div>' +
  35. '<button id="buttonAccept" onclick="accept();$(this).parent().remove();$(blocker).remove();" style="margin:4px;">Accept</button>' +
  36. '<button id="buttonCancel" onclick="$(this).parent().remove();$(blocker).remove();" style="margin:4px;">Cancel</button>' +
  37. '<a onclick="$(this).parent().remove();$(blocker).remove();" style="cursor:pointer;" rel="modal:close" class="close-modal">Close</a>' +
  38. '</div>' +
  39. '<div class="jquery-modal blocker" style="top: 0px; right: 0px; bottom: 0px; left: 0px; width: 100%; height: 100%; position: fixed; z-index: 7; opacity: 0.75; background: rgb(0, 0, 0);">' +
  40. '</div>'
  41. );
  42.  
  43. };
  44.  
  45. buttonBan = function(element) {
  46.  
  47. element.prepend('<button class="ban-button"><img src="https://i.imgur.com/x6R9HhR.gif"></button>');
  48.  
  49. }
  50.  
  51. buttonRemove = function(element) {
  52.  
  53. element.prepend('<button class="remove-button"><img src="https://i.imgur.com/MuoEzKG.png"></button>');
  54.  
  55. }
  56.  
  57. $('.msgShout').each(function() {
  58.  
  59. buttonBan($(this));
  60. buttonRemove($(this));
  61.  
  62. });
  63.  
  64. socket.on('message', function() {
  65.  
  66. buttonBan($('.msgShout:last'));
  67. buttonRemove($('.msgShout:last'));
  68.  
  69. });
  70.  
  71. $('body').on('click', '.remove-button', function() {
  72.  
  73. ided = $(this).parent().attr('data-ided');
  74. socket.emit('rmvmsg', {id:ided});
  75.  
  76. });
  77.  
  78. $('body').on('click', '.ban-button', function() {
  79.  
  80. uid = $(this).parent().attr('data-uid');
  81.  
  82. username = $(this).parent().find('.username_msgShout').find('span:last').text();
  83.  
  84. if (username.length == 0) {
  85.  
  86. username = $(this).parent().find('.username_msgShout').find('img').attr('original-title');
  87.  
  88. }
  89.  
  90. menu();
  91.  
  92. });
  93.  
  94. }
  95.  
  96. function logger() {
  97.  
  98. var currentDate;
  99. var currentYear;
  100. var currentMonth;
  101. var currentDay;
  102. var currentToday;
  103. var currentHour;
  104. var currentMinute;
  105. var currentClock;
  106. var currentTime;
  107.  
  108. var months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
  109. var days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
  110.  
  111. var messages = [];
  112. var shoutContent = [];
  113. var usernames = [];
  114. var uids = [];
  115. var ideds = [];
  116.  
  117. socket.on('message', function(data) {
  118.  
  119. currentDate = new Date();
  120. currentYear = currentDate.getYear() + 1900;
  121. currentMonth = currentDate.getMonth();
  122. currentDay = currentDate.getDate();
  123. currentToday = currentDate.getDay();
  124. currentHour = currentDate.getHours();
  125. currentMinute = currentDate.getMinutes();
  126. currentClock = ('0' + currentHour).slice(-2) + ':' + ('0' + currentMinute).slice(-2);
  127. currentTime = days[currentToday] + ' ' + currentDay + '/' + months[currentMonth] + '/' + currentYear + ' ' + currentHour + ':' + currentMinute;
  128.  
  129. messages.push($('.msgShout:last').find('.content_msgShout').text());
  130.  
  131. shoutContent.push($('.msgShout:last').find('.username_msgShout').find('span').text());
  132.  
  133. k = $('.msgShout:last').find('.username_msgShout').find('span:last').text();
  134.  
  135. if (k.length === 0) {
  136.  
  137. k = $('.msgShout:last').find('.username_msgShout').find('img').attr('original-title');
  138.  
  139. }
  140.  
  141. usernames.push(k);
  142.  
  143. uids.push($('.msgShout:last').attr('data-uid'));
  144.  
  145. ideds.push($('.msgShout:last').attr('data-ided'));
  146.  
  147. console.log(currentClock + ' [' + uids[uids.length-1] + '] ' + usernames[usernames.length-1] + ': ' + messages[messages.length-1]);
  148.  
  149. });
  150.  
  151. }
  152.  
  153. setTimeout(function() {
  154. widgets();
  155. logger();
  156. }, 5000);
  157. }
  158.  
  159. custom();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement