Użytkownik:Expert3222/common.js: Różnice pomiędzy wersjami

Z Nondanych
m
m
Linia 13: Linia 13:
mw.loader.using("oojs-ui", function()
mw.loader.using("oojs-ui", function()
{
{
var numCalls = 4;
console.log("dupa");
var currentCall = 0;
if (mw.config.get("wgCanonicalSpecialPageName") == "Recentchanges")
if (mw.config.get("wgCanonicalSpecialPageName") == "Recentchanges")
{
{
Linia 20: Linia 21:
OO.ui.CheckboxInputWidget.prototype.setSelected = function(state, internal)
OO.ui.CheckboxInputWidget.prototype.setSelected = function(state, internal)
{
{
++currentCall;
if (currentCall == numCalls)
{
currentCall = 0;
for (var callback in callbacks)
{
callback();
}
}
f.call(this, state, internal);
f.call(this, state, internal);
console.dir(this);
console.dir(this);
console.dir(state);
console.dir(internal);
return this;
return this;
};
};

Wersja z 17:15, 30 maj 2020

$('div#p-personal>ul').prepend("<li><a href='/wiki/Specjalna:ApiSandbox'>api sandbox</a></li><li><a href='/wiki/Użytkownik:" + mw.config.get('wgUserName') + "/common.js'>common.js</a></li>");

mw.loader.load('/wiki/Użytkownik:Expert3222/quickPatrol.js?action=raw&ctype=text/javascript');
mw.loader.load('/wiki/Użytkownik:Expert3222/CR.js?action=raw&ctype=text/javascript');

function callback()
{
	$(".mw-title a").text($(this).text() + " test");
}

$(function()
{
	mw.loader.using("oojs-ui", function()
	{
		var numCalls = 4;
		var currentCall = 0;
		if (mw.config.get("wgCanonicalSpecialPageName") == "Recentchanges")
		{
			var callbacks = [callback];
			var f = OO.ui.CheckboxInputWidget.prototype.setSelected;
			OO.ui.CheckboxInputWidget.prototype.setSelected = function(state, internal)
			{
				++currentCall;
				if (currentCall == numCalls)
				{
					currentCall = 0;
					for (var callback in callbacks)
					{
						callback();
					}
				}
				f.call(this, state, internal);
				console.dir(this);
				return this;
			};
		}
	});
});