Redaktor:Teslaton/rc-highlighter.js
Vzhľad
Poznámka: Aby sa zmeny prejavili, po uložení musíte vymazať vyrovnávaciu pamäť vášho prehliadača. Mozilla / Firefox / Safari: držte stlačený Shift a kliknite na Reload alebo stlačte buď Ctrl-F5 alebo Ctrl-R (Command-R na Macintosh); Konqueror:: kliknite na tlačidlo Reload alebo stlačte F5; Opera vymazať vyrovnávaciu pamäť prehliadača v ponuke Tools→Preferences; Internet Explorer: držte Ctrl a kliknite na Refresh alebo stlačte Ctrl-F5;
/*
RC highlighter
Wikipedia suspicious recent changes highlighting tool
Nástroj na zvýrazňovanie podozrivých posledných úprav
Invoking from a wiki user script:
// RC highlighter
if ($('.rcoptions').length)
mw.loader.load('//sk.wikipedia.org/w/index.php?title=Redaktor:Teslaton/rc-highlighter.js&action=raw&ctype=text/javascript');
Author: Teslaton <https://sk.wikipedia.org/wiki/Redaktor:Teslaton>, 2016
License: CC BY-SA 3.0 <http://creativecommons.org/licenses/by-sa/3.0/>
*/
// Activate on RC page only; allow disabling by flag
if ($('.rcoptions').length && ((typeof(rchDisable) == 'undefined' || !rchDisable))) {
// Add .rch-susp* CSS rules (may be overriden or suppressed by pre-filling the rchCss variable)
if (typeof(rchCss) == 'undefined')
rchCss =
// '.rch-susp .mw-userlink { color: #E000E0 !important; }' +
// '.rch-susp .mw-userlink.new, .rch-susp .mw-anonuserlink { color: #E000E0 !important; }' +
'.rch-susp .mw-userlink.new, .rch-susp .mw-anonuserlink, .rch-susp.mw-tag-marker, .rch-susp.mw-tag-marker a { color: #E000E0 !important; }' +
'.rch-susp-last .mw-userlink { font-weight: bold; }' +
'.rch-susp-last .mw-changeslist-title { border-bottom: 1px solid #E000E0; }' +
'';
if (rchCss)
$('html > head').append($('<style>' + rchCss + '</style>'));
// establishedUserUpdatedTitles = {};
var anyUserUpdatedTitles = {};
// Traverse RC items (assume order by time desc)
$('.mw-changeslist a.mw-userlink').each(function() {
var userName = $(this).text();
var newUser = $(this).hasClass('new');
var anonUser = $(this).hasClass('mw-anonuserlink');
var suspiciousUser = (newUser || anonUser);
// Match by tags (abuse filter, etc.), excluding fixed ones (VE/mobile edit tags)
var $tags = $(this.parentNode).find('.mw-tag-marker:not(.mw-tag-marker-php7, .mw-tag-marker-mw-undo, .mw-tag-marker-mw-new-redirect, .mw-tag-marker-mw-changed-redirect-target, .mw-tag-marker-mw-removed-redirect, .mw-tag-marker-mw-rollback, .mw-tag-marker-massmessage-delivery, .mw-tag-marker-visualeditor, .mw-tag-marker-visualeditor-switched, .mw-tag-marker-visualeditor-wikitext, .mw-tag-marker-mobile_edit, .mw-tag-marker-mobile_web_edit, .mw-tag-marker-mobile_app_edit, .mw-tag-marker-OAuth_CID_1352)');
if ($tags.length) {
$tags.addClass('rch-susp');
suspiciousUser = true;
}
var $aTitle = $(this.parentNode).find('.mw-changeslist-title');
var aTitle = ($aTitle.length ? $aTitle[0] : null);
var title = (aTitle ? aTitle.title : null);
if (suspiciousUser) {
// Suspicious user, tag using .rch-susp class
$(this.parentNode).addClass('rch-susp');
if (aTitle && !anyUserUpdatedTitles[title]) {
// This edit seems to be a current revision (no later uptade by anyone), tag further (.rch-susp-last)
$(this.parentNode).addClass('rch-susp-last');
}
}
if (title) {
// Mark title as "seen" (=> already updated)
anyUserUpdatedTitles[title] = true;
// if (!suspiciousUser)
// establishedUserUpdatedTitles[title] = true;
}
});
}