MediaWiki:CharInsert.js: Różnice pomiędzy wersjami

Z Minecraft Wiki Polska
Przejdź do nawigacji Przejdź do wyszukiwania
Nie podano opisu zmian
d 17 wersji: zaimportowano zawartość stron i zmian powstałych w staging oraz historie ich edycji
 
(Nie pokazano 9 wersji utworzonych przez jednego użytkownika)
Linia 1: Linia 1:
function specialchar(text)
function specialchar(text, type)
{
{
$(document).find('div.sections div[rel="characters"].section div.index div[rel="symbols"]').click();
var actions = $(document).find('div.sections div[rel="characters"].section').data('actions', {});
var actions = $(document).find('div.sections div[rel="characters"].section').data('actions', {});
window.addEventListener("load", function()
setTimeout(() =>
{
{
$(document).find('div.sections div[rel="characters"].section div.pages div[rel="symbols"].page div')[0].appendChild(
var page = $(document).find('div.sections div[rel="characters"].section div.pages div[rel="'+type+'"].page div');
$($.wikiEditor.modules.toolbar.fn.buildCharacter(text, actions)).on('click', function(e)
if(page.length)
{
{
$.wikiEditor.modules.toolbar.fn.doAction(
page[0].appendChild($($.wikiEditor.modules.toolbar.fn.buildCharacter(text, actions)).on('click', function(value)
$(this).parent().data('context'),
{
actions[$(this).attr('rel')]);
$.wikiEditor.modules.toolbar.fn.doAction(
e.preventDefault();
$(this).parent().data('context'),
return false;
actions[$(this).attr('rel')]);
})[0]);
value.preventDefault();
});
return false;
})[0]);
}
}, 500);
}
}


(function()
(function()
{
{
$('a.charinsert').each(function()
var action = new URLSearchParams(document.location.search).get("action");
if(action == 'edit' || action == 'submit')
{
{
var span = $(this)[0], text = span.textContent;
setTimeout(() =>
specialchar(text);
span.onclick = function()
{
{
$(document).find('div[rel="characters"].section div[rel="symbols"].page div span[rel="'+text+'"]').click();
$(document).find('div.sections div[rel="characters"].section div.index div[rel="symbols"]').click();
};
var types = [];
});
$('span.charinsert').each(function()
{
var main = $(this), span = main[0], text = span.textContent, type = main.attr('type');
if(type == null)
{
type = 'symbols';
}
else if(!types.includes(type))
{
$(document).find('div.sections div[rel="characters"].section div.index div[rel="'+type+'"]').click();
types.push(type);
}
specialchar(text, type);
main.click(function()
{
$(document).find('div[rel="characters"].section div[rel="'+type+'"].page div span[rel="'+text+'"]').click();
});
});
}, 500);
}
}());
}());

Aktualna wersja na dzień 23:58, 3 gru 2024

function specialchar(text, type)
{
	var actions = $(document).find('div.sections div[rel="characters"].section').data('actions', {});
	setTimeout(() =>
	{
		var page = $(document).find('div.sections div[rel="characters"].section div.pages div[rel="'+type+'"].page div');
		if(page.length)
		{
			page[0].appendChild($($.wikiEditor.modules.toolbar.fn.buildCharacter(text, actions)).on('click', function(value)
			{
				$.wikiEditor.modules.toolbar.fn.doAction(
					$(this).parent().data('context'),
					actions[$(this).attr('rel')]);
				value.preventDefault();
				return false;
			})[0]);
		}
	}, 500);
}

(function()
{
	var action = new URLSearchParams(document.location.search).get("action");
	if(action == 'edit' || action == 'submit')
	{
		setTimeout(() =>
		{
			$(document).find('div.sections div[rel="characters"].section div.index div[rel="symbols"]').click();
			var types = [];
			$('span.charinsert').each(function()
			{
				var main = $(this), span = main[0], text = span.textContent, type = main.attr('type');
				if(type == null)
				{
					type = 'symbols';
				}
				else if(!types.includes(type))
				{
					$(document).find('div.sections div[rel="characters"].section div.index div[rel="'+type+'"]').click();
					types.push(type);
				}
				specialchar(text, type);
				main.click(function()
				{
					$(document).find('div[rel="characters"].section div[rel="'+type+'"].page div span[rel="'+text+'"]').click();
				});
			});
		}, 500);
	}
}());