User:Chlod/Scripts/RCP-CV Quicklink.js
Appearance
< User:Chlod | Scripts
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
This user script seems to have a documentation page at User:Chlod/Scripts/RCP-CV Quicklink. |
// RCP-CV Quicklink
// Recent Changes Patrol - Counter-Vandalism Quicklink
// Author: Chlod
// Version: 1.0.0-REL
// Adds a quick link to the RecentChanges page. Defaults to my configuration.
// DO NOT MODIFY UNLESS YOU KNOW WHAT YOU'RE DOING
const rcpcvqlURLRegex = /https:\/\/[a-z]{2,4}\.wikipedia\.org\/wiki\/Special\:RecentChanges[?A-Za-z0-9=%&_\-]*/gi;
if (rcpcvqlTargetLink === undefined)
var rcpcvqlTargetLink = "https://en.wikipedia.org/wiki/Special:RecentChanges"
+ "?damaging=likelybad%3Bverylikelybad&goodfaith=likelybad%3Bverylikelybad&hidebots=1&hidecategorization=1"
+ "&hideWikibase=1&limit=50&days=7&damaging__likelybad_color=c3&damaging__verylikelybad_color=c3&goodfaith"
+ "__likelybad_color=c4&goodfaith__verylikelybad_color=c5&lastRevision__hidelastrevision_color=c1&urlversion=2";
$(document).ready(() => {
if (typeof(rcpcvqlTargetLink) !== "string") {
$("#p-personal #pt-logout").before(`<li id="pt-rcp_cv_ql"><abbr style="color: red; font-weight: bold; cursor: not-allowed;"`
+ `title="RCP-CV failed to start because the target link is not a string">RCP-CV</span></li>`);
} else if (!rcpcvqlURLRegex.test(rcpcvqlTargetLink)) {
$("#p-personal #pt-logout").before(`<li id="pt-rcp_cv_ql"><abbr style="color: red; font-weight: bold; cursor: not-allowed;"`
+ `title="RCP-CV failed to start because the target link is not a usable URL or does not lead to Wikipedia's Special:RecentChanges. `
+ `Please correct the target link by modifying 'rcpcvqlTargetLink' in your user script.">RCP-CV</span></li>`);
} else {
$("#p-personal #pt-logout").before(`<li id="pt-rcp_cv_ql"><a href=${rcpcvqlTargetLink}">RCP-CV</a></li>`);
}
});