Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function custom() {
- function widgets() {
- var ided;
- var uid;
- var username;
- accept = function() {
- socket.emit('updbanl', {uid: parseInt(uid)});
- socket.emit('message', {msg:'edited the banlist', nickto:'0', colorsht: colorshout, font: fontype, size: fontsize, bold: fontbold, uidto:0, type: 'system'});
- }
- blocker = ".jquery-modal.blocker";
- menu = function() {
- $('body').prepend(
- '<div class="modal current" style="position: fixed; top: 50%; left: 50%; margin-top: -65px; margin-left: -200px; z-index: 8; display: block;">' +
- '<div style="overflow-y: auto; max-height: 120px;"><table cellspacing="3" cellpadding="3" class="tborder">' +
- '<tbody>' +
- '<tr>' +
- '<td class="thead" colspan="2">' +
- '<div><strong>Ban User</strong></div>' +
- '</td>' +
- '</tr>' +
- '<tr>' +
- '<td class="trow1"><span>Are you sure that you would like to ban ' + username + '?</span></td>' +
- '</tr>' +
- '</tbody>' +
- '</table>' +
- '</div>' +
- '<button id="buttonAccept" onclick="accept();$(this).parent().remove();$(blocker).remove();" style="margin:4px;">Accept</button>' +
- '<button id="buttonCancel" onclick="$(this).parent().remove();$(blocker).remove();" style="margin:4px;">Cancel</button>' +
- '<a onclick="$(this).parent().remove();$(blocker).remove();" style="cursor:pointer;" rel="modal:close" class="close-modal">Close</a>' +
- '</div>' +
- '<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);">' +
- '</div>'
- );
- };
- buttonBan = function(element) {
- element.prepend('<button class="ban-button"><img src="https://i.imgur.com/x6R9HhR.gif"></button>');
- }
- buttonRemove = function(element) {
- element.prepend('<button class="remove-button"><img src="https://i.imgur.com/MuoEzKG.png"></button>');
- }
- $('.msgShout').each(function() {
- buttonBan($(this));
- buttonRemove($(this));
- });
- socket.on('message', function() {
- buttonBan($('.msgShout:last'));
- buttonRemove($('.msgShout:last'));
- });
- $('body').on('click', '.remove-button', function() {
- ided = $(this).parent().attr('data-ided');
- socket.emit('rmvmsg', {id:ided});
- });
- $('body').on('click', '.ban-button', function() {
- uid = $(this).parent().attr('data-uid');
- username = $(this).parent().find('.username_msgShout').find('span:last').text();
- if (username.length == 0) {
- username = $(this).parent().find('.username_msgShout').find('img').attr('original-title');
- }
- menu();
- });
- }
- function logger() {
- var currentDate;
- var currentYear;
- var currentMonth;
- var currentDay;
- var currentToday;
- var currentHour;
- var currentMinute;
- var currentClock;
- var currentTime;
- var months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
- var days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
- var messages = [];
- var shoutContent = [];
- var usernames = [];
- var uids = [];
- var ideds = [];
- socket.on('message', function(data) {
- currentDate = new Date();
- currentYear = currentDate.getYear() + 1900;
- currentMonth = currentDate.getMonth();
- currentDay = currentDate.getDate();
- currentToday = currentDate.getDay();
- currentHour = currentDate.getHours();
- currentMinute = currentDate.getMinutes();
- currentClock = ('0' + currentHour).slice(-2) + ':' + ('0' + currentMinute).slice(-2);
- currentTime = days[currentToday] + ' ' + currentDay + '/' + months[currentMonth] + '/' + currentYear + ' ' + currentHour + ':' + currentMinute;
- messages.push($('.msgShout:last').find('.content_msgShout').text());
- shoutContent.push($('.msgShout:last').find('.username_msgShout').find('span').text());
- k = $('.msgShout:last').find('.username_msgShout').find('span:last').text();
- if (k.length === 0) {
- k = $('.msgShout:last').find('.username_msgShout').find('img').attr('original-title');
- }
- usernames.push(k);
- uids.push($('.msgShout:last').attr('data-uid'));
- ideds.push($('.msgShout:last').attr('data-ided'));
- console.log(currentClock + ' [' + uids[uids.length-1] + '] ' + usernames[usernames.length-1] + ': ' + messages[messages.length-1]);
- });
- }
- setTimeout(function() {
- widgets();
- logger();
- }, 5000);
- }
- custom();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement