The official discord link if you wish to join the discord: https://discord.gg/j5RKwCvAFu

Support the wiki on our official Ko-Fi page or Patreon page!

MediaWiki:Common.js: Difference between revisions

From The Codex
Line 384: Line 384:
}
}
}
}
returnHTML += '<a href="/wiki/User_talk:' + change.user + '">' + change.user + '</a> ';
returnHTML += '<a href="/User_talk:' + change.user + '">' + change.user + '</a> ';
switch (change.type) {
switch (change.type) {
case "edit":  
case "edit":  
if (change.tags.includes("mw-undo")) {
if (change.tags.includes("mw-undo")) {
returnHTML += "<a href=\"/wiki/Project:Undo\">undid</a> an <a href=\"/wiki/Special:Diff/" + change.revid + "\">edit</a> to <a href=\"/wiki/" + change.title + "\">" + change.title + '</a>';
returnHTML += "<a href=\"/Project:Undo\">undid</a> an <a href=\"/Special:Diff/" + change.revid + "\">edit</a> to <a href=\"/" + change.title + "\">" + change.title + '</a>';
} else if (change.tags.includes("mw-rollback")) {
} else if (change.tags.includes("mw-rollback")) {
returnHTML += "<a href=\"/wiki/Project:Rollback\">rolled back</a> edits to <a href=\"/wiki/Special:Diff/" + change.revid + "\">edit</a> to <a href=\"/wiki/" + change.title + "\">" + change.title + '</a>';
returnHTML += "<a href=\"/Project:Rollback\">rolled back</a> edits to <a href=\"/Special:Diff/" + change.revid + "\">edit</a> to <a href=\"/" + change.title + "\">" + change.title + '</a>';
} else if (change.ns == 3) {
} else if (change.ns == 3) {
returnHTML += 'left a message for <a href="/wiki/' + change.title + '">' + change.title.replace("User talk:", "") + "</a>";
returnHTML += 'left a message for <a href="/' + change.title + '">' + change.title.replace("User talk:", "") + "</a>";
} else {
} else {
returnHTML += "made an <a href=\"/wiki/Special:Diff/" + change.revid + "\">edit</a> to <a href=\"/wiki/" + change.title + "\">" + change.title + '</a>';
returnHTML += "made an <a href=\"/Special:Diff/" + change.revid + "\">edit</a> to <a href=\"/" + change.title + "\">" + change.title + '</a>';
}
}
break;
break;
case "new":
case "new":
if (change.ns == 3) {
if (change.ns == 3) {
returnHTML += 'left a message for <a href="/wiki/' + change.title + '">' + change.title.replace("User talk:", "") + "</a>";
returnHTML += 'left a message for <a href="/' + change.title + '">' + change.title.replace("User talk:", "") + "</a>";
} else {
} else {
returnHTML += "created the page <a href=\"/wiki/" + change.title + "\">" + change.title + '</a>';
returnHTML += "created the page <a href=\"/" + change.title + "\">" + change.title + '</a>';
}
}
break;
break;
Line 423: Line 423:
} else {
} else {
returnHTML += "<li>";
returnHTML += "<li>";
returnHTML += '<a href="/wiki/User_talk:' + change.user + '">' + change.user + '</a> ';
returnHTML += '<a href="/User_talk:' + change.user + '">' + change.user + '</a> ';
switch (change.type) {
switch (change.type) {
case "edit":  
case "edit":  
if (change.tags.includes("mw-undo")) {
if (change.tags.includes("mw-undo")) {
returnHTML += "<a href=\"/wiki/Project:Undo\">undid</a> an <a href=\"/wiki/Special:Diff/" + change.revid + "\">edit</a> to <a href=\"/wiki/" + change.title + "\">" + change.title + '</a>';
returnHTML += "<a href=\"/Project:Undo\">undid</a> an <a href=\"/Special:Diff/" + change.revid + "\">edit</a> to <a href=\"/" + change.title + "\">" + change.title + '</a>';
} else if (change.tags.includes("mw-rollback")) {
} else if (change.tags.includes("mw-rollback")) {
returnHTML += "<a href=\"/wiki/Project:Rollback\">rolled back</a> edits to <a href=\"/wiki/Special:Diff/" + change.revid + "\">edit</a> to <a href=\"/wiki/" + change.title + "\">" + change.title + '</a>';
returnHTML += "<a href=\"/Project:Rollback\">rolled back</a> edits to <a href=\"/Special:Diff/" + change.revid + "\">edit</a> to <a href=\"/" + change.title + "\">" + change.title + '</a>';
} else if (change.ns == 3) {
} else if (change.ns == 3) {
returnHTML += 'left a message for <a href="/wiki/' + change.title + '">' + change.title.replace("User talk:", "") + "</a>";
returnHTML += 'left a message for <a href="/' + change.title + '">' + change.title.replace("User talk:", "") + "</a>";
} else {
} else {
returnHTML += "made an <a href=\"/wiki/Special:Diff/" + change.revid + "\">edit</a> to <a href=\"/wiki/" + change.title + "\">" + change.title + '</a>';
returnHTML += "made an <a href=\"/Special:Diff/" + change.revid + "\">edit</a> to <a href=\"/" + change.title + "\">" + change.title + '</a>';
}
}
break;
break;
case "new":
case "new":
if (change.ns == 3) {
if (change.ns == 3) {
returnHTML += 'left a message for <a href="/wiki/' + change.title + '">' + change.title.replace("User talk:", "") + "</a>";
returnHTML += 'left a message for <a href="/' + change.title + '">' + change.title.replace("User talk:", "") + "</a>";
} else {
} else {
returnHTML += "created the page <a href=\"/wiki/" + change.title + "\">" + change.title + '</a>';
returnHTML += "created the page <a href=\"/" + change.title + "\">" + change.title + '</a>';
}
}
break;
break;
Line 457: Line 457:
} else {
} else {
returnHTML += "<li>";
returnHTML += "<li>";
returnHTML += '<a href="/wiki/User_talk:' + change.user + '">' + change.user + '</a> ';
returnHTML += '<a href="/User_talk:' + change.user + '">' + change.user + '</a> ';
switch (change.type) {
switch (change.type) {
case "edit":  
case "edit":  
if (change.tags.includes("mw-undo")) {
if (change.tags.includes("mw-undo")) {
returnHTML += "<a href=\"/wiki/Project:Undo\">undid</a> an <a href=\"/wiki/Special:Diff/" + change.revid + "\">edit</a> to <a href=\"/wiki/" + change.title + "\">" + change.title + '</a>';
returnHTML += "<a href=\"/Project:Undo\">undid</a> an <a href=\"/Special:Diff/" + change.revid + "\">edit</a> to <a href=\"/" + change.title + "\">" + change.title + '</a>';
} else if (change.tags.includes("mw-rollback")) {
} else if (change.tags.includes("mw-rollback")) {
returnHTML += "<a href=\"/wiki/Project:Rollback\">rolled back</a> edits to <a href=\"/wiki/Special:Diff/" + change.revid + "\">edit</a> to <a href=\"/wiki/" + change.title + "\">" + change.title + '</a>';
returnHTML += "<a href=\"/Project:Rollback\">rolled back</a> edits to <a href=\"/Special:Diff/" + change.revid + "\">edit</a> to <a href=\"/" + change.title + "\">" + change.title + '</a>';
} else if (change.ns == 3) {
} else if (change.ns == 3) {
returnHTML += 'left a message for <a href="/wiki/' + change.title + '">' + change.title.replace("User talk:", "") + "</a>";
returnHTML += 'left a message for <a href="/' + change.title + '">' + change.title.replace("User talk:", "") + "</a>";
} else {
} else {
returnHTML += "made an <a href=\"/wiki/Special:Diff/" + change.revid + "\">edit</a> to <a href=\"/wiki/" + change.title + "\">" + change.title + '</a>';
returnHTML += "made an <a href=\"/Special:Diff/" + change.revid + "\">edit</a> to <a href=\"/" + change.title + "\">" + change.title + '</a>';
}
}
break;
break;
case "new":
case "new":
if (change.ns == 3) {
if (change.ns == 3) {
returnHTML += 'left a message for <a href="/wiki/' + change.title + '">' + change.title.replace("User talk:", "") + "</a>";
returnHTML += 'left a message for <a href="/' + change.title + '">' + change.title.replace("User talk:", "") + "</a>";
} else {
} else {
returnHTML += "created the page <a href=\"/wiki/" + change.title + "\">" + change.title + '</a>';
returnHTML += "created the page <a href=\"/" + change.title + "\">" + change.title + '</a>';
}
}
break;
break;
Line 491: Line 491:
} else {
} else {
returnHTML += "<li>";
returnHTML += "<li>";
returnHTML += '<a href="/wiki/User_talk:' + change.user + '">' + change.user + '</a> ';
returnHTML += '<a href="/User_talk:' + change.user + '">' + change.user + '</a> ';
switch (change.type) {
switch (change.type) {
case "edit":  
case "edit":  
if (change.tags.includes("mw-undo")) {
if (change.tags.includes("mw-undo")) {
returnHTML += "<a href=\"/wiki/Project:Undo\">undid</a> an <a href=\"/wiki/Special:Diff/" + change.revid + "\">edit</a> to <a href=\"/wiki/" + change.title + "\">" + change.title + '</a>';
returnHTML += "<a href=\"/Project:Undo\">undid</a> an <a href=\"/Special:Diff/" + change.revid + "\">edit</a> to <a href=\"/" + change.title + "\">" + change.title + '</a>';
} else if (change.tags.includes("mw-rollback")) {
} else if (change.tags.includes("mw-rollback")) {
returnHTML += "<a href=\"/wiki/Project:Rollback\">rolled back</a> edits to <a href=\"/wiki/Special:Diff/" + change.revid + "\">edit</a> to <a href=\"/wiki/" + change.title + "\">" + change.title + '</a>';
returnHTML += "<a href=\"/Project:Rollback\">rolled back</a> edits to <a href=\"/Special:Diff/" + change.revid + "\">edit</a> to <a href=\"/" + change.title + "\">" + change.title + '</a>';
} else if (change.ns == 3) {
} else if (change.ns == 3) {
returnHTML += 'left a message for <a href="/wiki/' + change.title + '">' + change.title.replace("User talk:", "") + "</a>";
returnHTML += 'left a message for <a href="/' + change.title + '">' + change.title.replace("User talk:", "") + "</a>";
} else {
} else {
returnHTML += "made an <a href=\"/wiki/Special:Diff/" + change.revid + "\">edit</a> to <a href=\"/wiki/" + change.title + "\">" + change.title + '</a>';
returnHTML += "made an <a href=\"/Special:Diff/" + change.revid + "\">edit</a> to <a href=\"/" + change.title + "\">" + change.title + '</a>';
}
}
break;
break;
case "new":
case "new":
if (change.ns == 3) {
if (change.ns == 3) {
returnHTML += 'left a message for <a href="/wiki/' + change.title + '">' + change.title.replace("User talk:", "") + "</a>";
returnHTML += 'left a message for <a href="/' + change.title + '">' + change.title.replace("User talk:", "") + "</a>";
} else {
} else {
returnHTML += "created the page <a href=\"/wiki/" + change.title + "\">" + change.title + '</a>';
returnHTML += "created the page <a href=\"/" + change.title + "\">" + change.title + '</a>';
}
}
break;
break;
Line 524: Line 524:
}
}
}
}
returnHTML += "<li><a href=\"/wiki/Special:RecentChanges\">View all recent changes</a></li>"
returnHTML += "<li><a href=\"/Special:RecentChanges\">View all recent changes</a></li>"
    returnHTML += "</ul>";
    returnHTML += "</ul>";
    $("#rcwidget-content").html(returnHTML);
    $("#rcwidget-content").html(returnHTML);
Line 540: Line 540:
     $("#rcwidget-content").css("overflow", "auto");
     $("#rcwidget-content").css("overflow", "auto");
$(document).ready(function() {
$(document).ready(function() {
         rcwidget.addToSidebar((mw.config.get('skin') == 'vector' || mw.config.get('skin') == 'vector-2022') ? '<div id="rcwidget-label" lang="en" dir="ltr"><span><a href="/wiki/Special:RecentChanges">Recent changes</a></span></div><div class="mw-portlet-body body pBody" id="rcwidget-content" style="height:250px;overflow:hidden;">Loading...</div>' : '<h3 id="rcwidget-label" lang="en" dir="ltr"><span><a href="/wiki/Special:RecentChanges">Recent changes</a></span></h3><div class="mw-portlet-body body pBody" id="rcwidget-content" style="height:250px;overflow:hidden;">Loading...</div>');
         rcwidget.addToSidebar((mw.config.get('skin') == 'vector' || mw.config.get('skin') == 'vector-2022') ? '<div id="rcwidget-label" lang="en" dir="ltr"><span><a href="/Special:RecentChanges">Recent changes</a></span></div><div class="mw-portlet-body body pBody" id="rcwidget-content" style="height:250px;overflow:hidden;">Loading...</div>' : '<h3 id="rcwidget-label" lang="en" dir="ltr"><span><a href="/Special:RecentChanges">Recent changes</a></span></h3><div class="mw-portlet-body body pBody" id="rcwidget-content" style="height:250px;overflow:hidden;">Loading...</div>');
         rcwidget.fetch();
         rcwidget.fetch();
     window.setInterval(function() {
     window.setInterval(function() {

Revision as of 23:08, 21 October 2024

/* Any JavaScript here will be loaded for all users on every page load. */

window.AutoEditDropdownConfig = {
    expandedAreaContribute: true,
    expandedAreaEdit: false
};

window.ajaxRefresh = 60000;
window.ajaxPages = [
    'Special:RecentChanges',
    'Special:Contributions',
    'Special:Log',
    'Special:Log/move',
    'Special:AbuseLog',
    'Special:NewFiles',
    'Special:NewPages',
    'Special:Watchlist',
    'Special:Statistics',
    'Special:ListFiles',
];
window.AjaxRCRefreshText = 'Auto-refresh';
window.AjaxRCRefreshHoverText = 'Automatically refresh the page';

window.UserTagsJS = {
    modules: {},
    tags: {
        // group: { associated tag data },
        founder: {
            u: 'Founder',
            order: 1
        },
        bureaucrat: {
            u: 'Bureaucrat',
            order: 2
        },
        'former-bureaucrat': {
            u: 'Retired Bureaucrat',
            order: 3
        },
        sysop: {
            u: 'Administrator',
            order: 4
        },
        'former-sysop': {
            u: 'Retired Administrator',
            order: 5
        },
        'bot-global': {
            u: 'Global Bot',
            order: 7
        },
        bot: {
            u: 'Bot',
            order: 8
        },
        'content-moderator': {
            u: 'Content Moderator',
            order: 10
        },
        'former-content-moderator': {
            u: 'Retired Content Moderator',
            order: 11
        },
        threadmoderator: {
            u: 'Discussion Moderator',
            order: 13
        },
        'former-threadmoderator': {
            u: 'Retired Discussion Moderator',
            order: 14
        },
        chatmoderator: {
            u: 'Chat Moderator',
            order: 16
        },
        'former-chatmoderator': {
            u: 'Retired Chat Moderator',
            order: 17
        },
        rollback: {
            u: 'Rollback',
            order: 19
        },
        'former-rollback': {
            u: 'Former Rollback',
            order: 20
        },
        calc: {
            u: 'Calc Group',
            order: 22
        },
        'former-calc': {
            u: 'Retired Calc Group',
            order: 23
        },
        guru: {
            u: 'Guru',
            order: 40
        },
        'js-helper': {
            u: 'JS Helper',
            order: 51
        },
        'css-helper': {
            u: 'CSS Helper',
            order: 52
        },
        'image-helper': {
            u: 'Image Helper',
            order: 53
        },
        'template-helper': {
            u: 'Templates Helper',
            order: 54
        },
        'human-resources': {
            u: 'Human Resources',
            order: 55
        },
        'former-human-resources': {
            u: 'Retired Human Resources',
            order: 56
        },        
        consultant: {
            u: 'Consultant',
            order: 100
        },
        bannedfromchat: {
            u: 'Banned from Chat',
            order: 500
        },
        inactive: {
            u: 'Inactive',
            order: 1 / 0
        }
    }
};
UserTagsJS.modules.inactive = {
    days: 30,
    zeroIsInactive: true // 0 edits = inactive
};
UserTagsJS.modules.nonuser = (mediaWiki.config.get('skin') === 'monobook');
UserTagsJS.modules.autoconfirmed = true; // Switch on Autoconfirmed User check
UserTagsJS.modules.newuser = {
    computation: function(days, edits) {
        // If the expression is true then they will be marked as a new user
        // If the expression is false then they won't.
        // In this instance, newuser is removed as soon as the user gets 30
        // edits, OR as soon as they have been present for 10 days, whichever
        // happens first.
        return days < 10 && edits < 30;
    }
};
// NOTE: bannedfromchat displays in Oasis but is not a user-identity group so must be checked manually
UserTagsJS.modules.mwGroups = [
    'bureaucrat',
    'sysop',
    'bot',
    'bot-global',
    'content-moderator',
    'threadmoderator', 
    'chatmoderator',
    'patroller',
    'rollback',
    'bannedfromchat'
];

UserTagsJS.modules.metafilter = {
	'inactive': [
        'sysop',
        'bureaucrat',
        'bot',
        'bot-global',
        'staff',
        'util',
        'vstf'
    ], 
    'sysop': ['bot', 'bot-global'], // Remove "Administrator" tag from bots and global bots
    'content-moderator': ['bureaucrat', 'sysop'], // Remove "Content Moderator" tag from bureaucrats and administrators
    'threadmoderator': ['bureaucrat', 'sysop'], // Remove "Discussions Moderator" tag from bureaucrats and administrators
    'chatmoderator': ['bureaucrat', 'sysop'], // Remove "Chat Moderator" tag from bureaucrats and administrators
    'rollback': ['bureaucrat', 'sysop'] // Remove "Rollback" tag from bureaucrats and administrators
};
// UserTagsJS.modules.stopblocked = true; //Enabled by default
//Manually turn off by changing true -> false

// Username script // 

(function () { 

mw.config.get('wgUserName');

if (mw.config.get('wgUserName') !== null) $('span.insertusername').text(mw.config.get('wgUserName'));
	 
})();

// Bureaucrat promotion warning message //
!function() {
    if (mw.config.get('wgCanonicalSpecialPageName') !== 'Userrights') return;
    $('#mw-content-text').on('change', '#wpGroup-bureaucrat', function() {
    if ($('#wpGroup-bureaucrat').attr('checked') && !confirm('Do you truly want to appoint a bureaucrat?')) $('#wpGroup-bureaucrat').attr('checked', null);
    });
}();

window.pPreview = $.extend(true, window.pPreview, {RegExp: (window.pPreview || {}).RegExp || {} });
window.pPreview.noimage = 'https://thecodex.wiki/images/e/e6/Site-logo.png';
window.pPreview.tlen = 1000;

//==============================================================
// Sorts content on Special:WhatLinksHere alphabetically
//==============================================================
 
(function($) {
    if (mw.config.get('wgCanonicalSpecialPageName') !== 'Whatlinkshere') return;
    var sorted_list,
        $list = $('#mw-whatlinkshere-list');
    sorted_list = $list.children('li').sort(function (a, b) {
        return ($(a).find('a:first').attr('title') > 
        $(b).find('a:first').attr('title')) ? 1 : -1;});
    $list.children('li').remove();
    $list.append(sorted_list);
})(jQuery);

//==============================================================
// Personalized imports
//==============================================================
// Import scripts if user has one of the following ranks:
/* Rollback, Content Moderator, Admin, Bureaucrat, Content Volunteer, */

(function(){
const wgUserGroups = mw.config.get('wgUserGroups');

if(wgUserGroups.includes('rollback') || 
   wgUserGroups.includes('content-moderator') ||
   wgUserGroups.includes('sysop') ||
   wgUserGroups.includes('bureaucrat') ||
   wgUserGroups.includes('content-volunteer') ||
   wgUserGroups.includes('vstf') ||
   wgUserGroups.includes('helper') ||
   wgUserGroups.includes('staff')){
      importArticles({
            type: 'script',
            articles: [
            'u:dev:MediaWiki:AjaxRename/code.js'
        ]
    });
}

if(wgUserGroups.includes('sysop') ||
   wgUserGroups.includes('bureaucrat') ||
   wgUserGroups.includes('content-volunteer') ||
   wgUserGroups.includes('vstf') ||
   wgUserGroups.includes('helper') ||
   wgUserGroups.includes('staff')){
      importArticles({
            type: 'script',
            articles: [
            'u:dev:MediaWiki:WHAM/code.2.js',
            'u:dev:MediaWiki:AjaxUserRights.js'
        ]
    });
}
}());
//==============================================================
// Category Sorter Resolution
//==============================================================
!function(cfg) {
    // sorts categories by name
    // do not bother anons
    if (cfg.loaded || !mw.config.get('wgUserName')) return;
    cfg.loaded = !0;
    
    var targets = [
            '#mw-normal-catlinks:first > ul:first > li',
            '#mw-hidden-catlinks:first > ul:first > li',
            '#articleCategories .category',
        ];
    
    function sorter(a, b) {
        // locale will be determined automatically. probably. works on my machine
        return (a.textContent || '').localeCompare(b.textContent || '');
    }// sorter

    $(function() {
        targets.forEach(function(target) {
            var $target = $(target),
                $parent = $target.parent(),// cache parent, cuz it will be lost after .remove
                sorted = $target.sort(sorter);
            $target.remove();
            $parent.append(sorted);
        });
    });
}((window.fng = window.fng || {}).catsorter = window.fng.catsorter || {});

window.AddRailModule = ['Template:RailModule', 'Template:NewPagesModule'];

// Template:Tabs
$(function() {
	// If a sub-tab is "selected", make the parent tabs also "selected"
	$('.at-selected').parents('.article-tabs li').each(function () {
		$(this).addClass('at-selected');
	});

	// Margin fix
	$('.article-tabs .at-selected .article-tabs').each(function () {
		// Get height of subtabs
		var $TabsHeight = $(this).height();

		// Increase bottom margin of main tabs
		$(this).parents('.article-tabs').last().css('margin-bottom' , '+=' + $TabsHeight);
	});
});
// END of Template:Tabs

// Script for floating actions scroll

// Custom Scripts

// Recent Changes Widget written and made by Awesome Aasim, link here: https://en.wikipedia.org/wiki/User:Awesome_Aasim/rcwidget.js

if (!rcwidget) {
	var rcwidget = {};
	rcwidget.onlyshowores = (typeof onlyshowores !== 'undefined') ? onlyshowores : false;
	rcwidget.orestolerance = (typeof orestolerance !== 'undefined') ? orestolerance : 0.70;
	rcwidget.fetchtime = (typeof rcfetchtime !== 'undefined') ? rcfetchtime : 0.5
	rcwidget.addToSidebar = function(text) {
		if (mw.config.get("skin") == "timeless") {
	        $('<div class="sidebar-chunk" id="rcwidget"><div class="sidebar-inner">' + text + '</div></div>').appendTo("#mw-related-navigation");
	        $("#catlinks-sidebar").appendTo("#mw-related-navigation");
	        $("#other-languages").appendTo("#mw-related-navigation");
		}
        $('<div class="portal" role="navigation" id="rcwidget" aria-labelledby="p-rcwidget-label">' + text + '</div>').prependTo("#mw-panel");
        $('<div role="navigation" class="portlet generated-sidebar" id="rcwidget" aria-labelledby="p-rcwidget-label">' + text + '</div>').prependTo("#sidebar");
        $('<div class="portlet" id="rcwidget">' + text + '</div>').prependTo("#mw_portlets");
        $("#p-navigation").prependTo("#mw-panel");
        $("#p-search").prependTo("#quickbar");
        $('#p-logo').prependTo("#mw-site-navigation");
        $('#p-logo').prependTo("#mw-panel");
        $('#p-logo').prependTo("#sidebar");
        $('#p-logo').prependTo("#mw_portlets");
        $('ul.hlist:first').appendTo('#mw-mf-page-left');
        if (mw.config.get("skin") == "vector" || mw.config.get("skin") == "vector-2022" ) {
        	$("#rcwidget").addClass("mw-portlet mw-portlet-navigation vector-menu vector-menu-portal");
        }
    };
    rcwidget.fetch = function() {
    	if (!document.hasFocus()) {
    		window.setTimeout(rcwidget.fetch, rcwidget.fetchtime * 1000);
    	} else {
	    	var returnHTML = "";
	    	returnHTML += "<ul>";
	    	$.get(mw.config.get("wgScriptPath") + "/api.php", {
				"action": "query",
				"format": "json",
				"list": "recentchanges",
				"rcnamespace": "0|3",
				"rcprop": "title|timestamp|flags|loginfo|oresscores|parsedcomment|user|ids|tags",
				"rcshow": "!bot" + (rcwidget.onlyshowores ? "|oresreview" : ""),
				"rctoponly": true,
				"rclimit": "50",
				"rctype": "edit|new"
			}).done(function(result) {
				if (result.error) {
					console.error(result.error.info);
		    		window.setTimeout(rcwidget.fetch, rcwidget.fetchtime * 1000);
				} else {
					var currDate = new Date();
					for (var change of result.query.recentchanges) {
						var changeDate = new Date(change.timestamp);
						var mildate = new Date(currDate - changeDate);
						var seconds = mildate.getUTCSeconds();
						var minutes = mildate.getUTCMinutes();
						var hours = mildate.getUTCHours();
						if (typeof change.oresscores != 'undefined') {
							if (typeof change.oresscores.damaging != 'undefined') {
								if (typeof change.oresscores.damaging.true != 'undefined') {
									if (rcwidget.onlyshowores && change.oresscores.damaging.true < rcwidget.orestolerance) {
										continue;
									} else {
										returnHTML += "<li>";
										if (change.type == "edit" && change.oresscores.damaging) {
											if (change.oresscores.damaging.true >= rcwidget.orestolerance) {
												returnHTML += "<b>";
											}
										}
										returnHTML += '<a href="/User_talk:' + change.user + '">' + change.user + '</a> ';
										switch (change.type) {
											case "edit": 
												if (change.tags.includes("mw-undo")) {
													returnHTML += "<a href=\"/Project:Undo\">undid</a> an <a href=\"/Special:Diff/" + change.revid + "\">edit</a> to <a href=\"/" + change.title + "\">" + change.title + '</a>';
												} else if (change.tags.includes("mw-rollback")) {
													returnHTML += "<a href=\"/Project:Rollback\">rolled back</a> edits to <a href=\"/Special:Diff/" + change.revid + "\">edit</a> to <a href=\"/" + change.title + "\">" + change.title + '</a>';
												} else if (change.ns == 3) {
													returnHTML += 'left a message for <a href="/' + change.title + '">' + change.title.replace("User talk:", "") + "</a>";
												} else {
													returnHTML += "made an <a href=\"/Special:Diff/" + change.revid + "\">edit</a> to <a href=\"/" + change.title + "\">" + change.title + '</a>';
												}
												break;
											case "new":
												if (change.ns == 3) {
													returnHTML += 'left a message for <a href="/' + change.title + '">' + change.title.replace("User talk:", "") + "</a>";
												} else {
													returnHTML += "created the page <a href=\"/" + change.title + "\">" + change.title + '</a>';
												}
												break;
										}
										if (change.type == "edit" && change.oresscores.damaging) {
											if (change.oresscores.damaging.true >= rcwidget.orestolerance) {
												returnHTML += "</b>";
											}
										}
										returnHTML += "<br><small class=\"rcwidget-date\" data-revtimestamp=\"" + change.timestamp + "\">";
										if (hours > 0) {
											returnHTML += " " + hours + ((hours == 1) ? " hour" : " hours") + " ago";
										} else if (minutes > 0) {
											returnHTML += " " + minutes + ((minutes == 1) ? " minute" : " minutes") + " ago";
										} else if (seconds > 0) {
											returnHTML += " " + seconds + ((seconds == 1) ? " second" : " seconds") + " ago";
										}
										returnHTML += "</small>";
										returnHTML += "</li>";
									}
								} else {
									returnHTML += "<li>";
									returnHTML += '<a href="/User_talk:' + change.user + '">' + change.user + '</a> ';
									switch (change.type) {
										case "edit": 
											if (change.tags.includes("mw-undo")) {
												returnHTML += "<a href=\"/Project:Undo\">undid</a> an <a href=\"/Special:Diff/" + change.revid + "\">edit</a> to <a href=\"/" + change.title + "\">" + change.title + '</a>';
											} else if (change.tags.includes("mw-rollback")) {
												returnHTML += "<a href=\"/Project:Rollback\">rolled back</a> edits to <a href=\"/Special:Diff/" + change.revid + "\">edit</a> to <a href=\"/" + change.title + "\">" + change.title + '</a>';
											} else if (change.ns == 3) {
												returnHTML += 'left a message for <a href="/' + change.title + '">' + change.title.replace("User talk:", "") + "</a>";
											} else {
												returnHTML += "made an <a href=\"/Special:Diff/" + change.revid + "\">edit</a> to <a href=\"/" + change.title + "\">" + change.title + '</a>';
											}
											break;
										case "new":
											if (change.ns == 3) {
												returnHTML += 'left a message for <a href="/' + change.title + '">' + change.title.replace("User talk:", "") + "</a>";
											} else {
												returnHTML += "created the page <a href=\"/" + change.title + "\">" + change.title + '</a>';
											}
											break;
									}
									returnHTML += "<br><small class=\"rcwidget-date\" data-revtimestamp=\"" + change.timestamp + "\">";
									if (hours > 0) {
										returnHTML += " " + hours + ((hours == 1) ? " hour" : " hours") + " ago";
									} else if (minutes > 0) {
										returnHTML += " " + minutes + ((minutes == 1) ? " minute" : " minutes") + " ago";
									} else if (seconds > 0) {
										returnHTML += " " + seconds + ((seconds == 1) ? " second" : " seconds") + " ago";
									}
									returnHTML += "</small>";
									returnHTML += "</li>";
								}
							} else {
								returnHTML += "<li>";
								returnHTML += '<a href="/User_talk:' + change.user + '">' + change.user + '</a> ';
								switch (change.type) {
									case "edit": 
										if (change.tags.includes("mw-undo")) {
											returnHTML += "<a href=\"/Project:Undo\">undid</a> an <a href=\"/Special:Diff/" + change.revid + "\">edit</a> to <a href=\"/" + change.title + "\">" + change.title + '</a>';
										} else if (change.tags.includes("mw-rollback")) {
											returnHTML += "<a href=\"/Project:Rollback\">rolled back</a> edits to <a href=\"/Special:Diff/" + change.revid + "\">edit</a> to <a href=\"/" + change.title + "\">" + change.title + '</a>';
										} else if (change.ns == 3) {
											returnHTML += 'left a message for <a href="/' + change.title + '">' + change.title.replace("User talk:", "") + "</a>";
										} else {
											returnHTML += "made an <a href=\"/Special:Diff/" + change.revid + "\">edit</a> to <a href=\"/" + change.title + "\">" + change.title + '</a>';
										}
										break;
									case "new":
										if (change.ns == 3) {
											returnHTML += 'left a message for <a href="/' + change.title + '">' + change.title.replace("User talk:", "") + "</a>";
										} else {
											returnHTML += "created the page <a href=\"/" + change.title + "\">" + change.title + '</a>';
										}
										break;
								}
								returnHTML += "<br><small class=\"rcwidget-date\" data-revtimestamp=\"" + change.timestamp + "\">";
								if (hours > 0) {
									returnHTML += " " + hours + ((hours == 1) ? " hour" : " hours") + " ago";
								} else if (minutes > 0) {
									returnHTML += " " + minutes + ((minutes == 1) ? " minute" : " minutes") + " ago";
								} else if (seconds > 0) {
									returnHTML += " " + seconds + ((seconds == 1) ? " second" : " seconds") + " ago";
								}
								returnHTML += "</small>";
								returnHTML += "</li>";
							}
						} else {
							returnHTML += "<li>";
							returnHTML += '<a href="/User_talk:' + change.user + '">' + change.user + '</a> ';
							switch (change.type) {
								case "edit": 
									if (change.tags.includes("mw-undo")) {
										returnHTML += "<a href=\"/Project:Undo\">undid</a> an <a href=\"/Special:Diff/" + change.revid + "\">edit</a> to <a href=\"/" + change.title + "\">" + change.title + '</a>';
									} else if (change.tags.includes("mw-rollback")) {
										returnHTML += "<a href=\"/Project:Rollback\">rolled back</a> edits to <a href=\"/Special:Diff/" + change.revid + "\">edit</a> to <a href=\"/" + change.title + "\">" + change.title + '</a>';
									} else if (change.ns == 3) {
										returnHTML += 'left a message for <a href="/' + change.title + '">' + change.title.replace("User talk:", "") + "</a>";
									} else {
										returnHTML += "made an <a href=\"/Special:Diff/" + change.revid + "\">edit</a> to <a href=\"/" + change.title + "\">" + change.title + '</a>';
									}
									break;
								case "new":
									if (change.ns == 3) {
										returnHTML += 'left a message for <a href="/' + change.title + '">' + change.title.replace("User talk:", "") + "</a>";
									} else {
										returnHTML += "created the page <a href=\"/" + change.title + "\">" + change.title + '</a>';
									}
									break;
							}
							returnHTML += "<br><small class=\"rcwidget-date\" data-revtimestamp=\"" + change.timestamp + "\">";
							if (hours > 0) {
								returnHTML += " " + hours + ((hours == 1) ? " hour" : " hours") + " ago";
							} else if (minutes > 0) {
								returnHTML += " " + minutes + ((minutes == 1) ? " minute" : " minutes") + " ago";
							} else if (seconds > 0) {
								returnHTML += " " + seconds + ((minutes == 1) ? " second" : " seconds") + " ago";
							}
							returnHTML += "</small>";
							returnHTML += "</li>";
						}
					}
					returnHTML += "<li><a href=\"/Special:RecentChanges\">View all recent changes</a></li>"
		    		returnHTML += "</ul>";
			    	$("#rcwidget-content").html(returnHTML);
			    	if ($("#rcwidget-content").text().toLowerCase() == "View all recent changes".toLowerCase()) {
			    		$("#rcwidget-content").html("<ul><li>No recent changes found.</li></ul>");
			    	}
				}
		    	window.setTimeout(rcwidget.fetch, rcwidget.fetchtime * 1000);
			}).fail(function(result) {
		    	window.setTimeout(rcwidget.fetch, rcwidget.fetchtime * 1000);
			});
    	}
    };
    $("#rcwidget-content").css("height", "auto");
    $("#rcwidget-content").css("overflow", "auto");
	$(document).ready(function() {
        rcwidget.addToSidebar((mw.config.get('skin') == 'vector' || mw.config.get('skin') == 'vector-2022') ? '<div id="rcwidget-label" lang="en" dir="ltr"><span><a href="/Special:RecentChanges">Recent changes</a></span></div><div class="mw-portlet-body body pBody" id="rcwidget-content" style="height:250px;overflow:hidden;">Loading...</div>' : '<h3 id="rcwidget-label" lang="en" dir="ltr"><span><a href="/Special:RecentChanges">Recent changes</a></span></h3><div class="mw-portlet-body body pBody" id="rcwidget-content" style="height:250px;overflow:hidden;">Loading...</div>');
        rcwidget.fetch();
    	window.setInterval(function() {
			var currDate = new Date();
    		$('.rcwidget-date').each(function() {
    			var changeDate = new Date($(this).data('revtimestamp'));
				var mildate = new Date(currDate - changeDate);
				var seconds = mildate.getUTCSeconds();
				var minutes = mildate.getUTCMinutes();
				var hours = mildate.getUTCHours();
				if (hours > 0) {
					$(this).html(hours + ((hours == 1) ? " hour" : " hours") + " ago");
				} else if (minutes > 0) {
					$(this).html(minutes + ((minutes == 1) ? " minute" : " minutes") + " ago");
				} else if (seconds > 0) {
					$(this).html(seconds + ((seconds == 1) ? " second" : " seconds") + " ago");
				}
    		})
    	}, rcwidget.fetchtime);
	});
}