MediaWiki:CommentsDelete.js

/* For sysops only */ function CommentDelete { $('.article-comm-delete').each(function {       if ($(this).parents('div.buttons').find('.article-comm-quickdelete').length) {            return;        }        $(this).after('QDelete');        $(this).parents('div.buttons').find('.article-comm-quickdelete').click(function { var $that = $(this).parents('li.SpeechBubble'); var title = $that.find('.article-comm-delete').attr('href').replace(/\/wiki\/(.+)\?redirect.*/g, '$1'); $.post("/api.php", {               action:'delete',                title:decodeURIComponent(title),                reason:'comment cleanup',                token:deltoken,                format:'json'            }).done(function(data){                if (data['delete']) {                    var cd_color = 'lightgreen';                } else {                    var cd_color = 'firebrick';                }                $that.find('.article-comm-quickdelete').css('background-color',cd_color);            }); });   }); } function unitCD { // Первичный запуск CommentDelete; // Повторные запуски при переключении страниц с комментариями $('#article-comments-ul').bind("DOMSubtreeModified", function{       CommentDelete;    }); } $(function {   if(!$('#WikiaArticleComments').length) {        return;    }    console.log('V1.3b');    deltoken = mw.user.tokens.values.editToken;    if (!$('#article-comments').length) {        $("#WikiaArticleComments").bind("DOMSubtreeModified", function{ if (!$('#article-comments').length){ return; }           $("#WikiaArticleComments").unbind("DOMSubtreeModified"); unitCD; });   } else {        unitCD;    } });