0Спам
' + response.error + '
');
} else if (response.status) {
if (response.status == 'message_spam') {
context.elem.text(uCoz.spam.sign.notSpam).attr('data-not-spam', '1');
var toggle = $('#report-spam-toggle-wrapper-' + response.message_id);
if (toggle.length) {
toggle.find('.report-spam-toggle-text').text(uCoz.spam.sign.hidden);
toggle.find('.report-spam-toggle-button').text(uCoz.spam.sign.show);
} else {
toggle = $('' + uCoz.spam.sign.hidden + ' ' + uCoz.spam.sign.show + '
').hide().insertBefore(context.target);
uCoz.spam.handleDOM(toggle);
}
context.target.addClass('report-spam-hidden').fadeOut('fast', function() {
toggle.fadeIn('fast');
});
} else if (response.status == 'message_not_spam') {
context.elem.text(uCoz.spam.sign.spam).attr('data-not-spam', '0');
$('#report-spam-toggle-wrapper-' + response.message_id).fadeOut('fast');
$('#' + uCoz.spam.config.idPrefix + response.message_id).removeClass('report-spam-hidden').show();
} else if (response.status == 'admin_message_not_spam') {
elem.text(uCoz.spam.sign.admSpam).attr('title', uCoz.spam.sign.admSpamTitle).attr('data-not-spam', '0');
} else if (response.status == 'admin_message_spam') {
elem.text(uCoz.spam.sign.admNotSpam).attr('title', uCoz.spam.sign.admNotSpamTitle).attr('data-not-spam', '1');
} else {
alert('uCoz.spam.report: unknown status: ' + response.status);
}
} else {
context.target.remove(); // no status returned by the server - remove message (from DOM).
}
}, { elem: elem, target: target, height: height, margin: margin });
return false;
};
uCoz.spam.handleDOM = function(within) {
within = $(within || 'body');
within.find('.report-spam-wrap').each(function() {
var elem = $(this);
elem.parent().prepend(elem);
});
within.find('.report-spam-toggle-button').not('.report-spam-handled').click(function(event) {
if (event.preventDefault ) event.preventDefault();
var elem = $(this);
var wrapper = elem.parents('.report-spam-toggle-wrapper');
var text = wrapper.find('.report-spam-toggle-text');
var target = elem.attr('data-target');
target = $(target);
target.slideToggle('fast', function() {
if (target.is(':visible')) {
wrapper.addClass('report-spam-toggle-shown');
text.text(uCoz.spam.sign.shown);
elem.text(uCoz.spam.sign.hide);
} else {
wrapper.removeClass('report-spam-toggle-shown');
text.text(uCoz.spam.sign.hidden);
elem.text(uCoz.spam.sign.show);
}
});
return false;
}).addClass('report-spam-handled');
within.find('.report-spam-remove').not('.report-spam-handled').click(function(event) {
if (event.preventDefault ) event.preventDefault();
var messageID = $(this).attr('data-message-id');
del_item(messageID, 1);
return false;
}).addClass('report-spam-handled');
within.find('.report-spam-btn').not('.report-spam-handled').click(uCoz.spam.reportDOM).addClass('report-spam-handled');
window.console && console.log && console.log('uCoz.spam.handleDOM: done.');
try { if (uCoz.manageCommentControls) { uCoz.manageCommentControls() } } catch(e) { window.console && console.log && console.log('manageCommentControls: fail.'); }
return this;
};
uCoz.spam.handleDOM();
1