').text(nick + ' will be muted for:'))
.append(time)
.append(unit)
.append($('
').text('Reason:'))
.append(reason)
.appendTo($(Admin._dialogHtml));
var title = 'Mute ' + nick;
var close = function() { html.dialog('close'); }
var submit = function() {
html.find('[name]').removeClass('ui-state-error');
var t = parseInt(time.val());
var u = unit.val();
var r = reason.val();
if (!t) { time.addClass('ui-state-error'); }
if (!u) { reason.addClass('ui-state-error'); }
if (!r) { reason.addClass('ui-state-error'); }
if (!t || !u || !r) { return; }
$.ajax({
type: 'POST',
timeout: 5000,
url: '/mute',
cache: false,
data: { 'time': t, 'unit': u,
'reason': r, 'nick': nick },
success: close,
error: function(s) {
alert("Error muting user: " + s.responseText);
}
});
};
html.dialog({
modal: true,
title: title,
width: 400,
buttons: { 'OK': submit , 'Cancel': close }
});
html.dialog('open');
};
Admin.cancelMute = function(id, nick) {
var reason = $('