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

Z Minecraft Wiki Polska
Przejdź do nawigacji Przejdź do wyszukiwania
Nie podano opisu zmian
Nie podano opisu zmian
Linia 5: Linia 5:
setTimeout(() =>
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="symbols"].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]);
}
}, 1000);
}, 1000);
}
}
Linia 19: Linia 22:
(function()
(function()
{
{
$('span.charinsert').each(function()
if(new URLSearchParams(document.location.search).get("action") == 'edit')
{
{
var main = $(this), span = main[0], text = span.textContent;
$('span.charinsert').each(function()
specialchar(text);
main.click(function()
{
{
$(document).find('div[rel="characters"].section div[rel="symbols"].page div span[rel="'+text+'"]').click();
var main = $(this), span = main[0], text = span.textContent;
specialchar(text);
main.click(function()
{
$(document).find('div[rel="characters"].section div[rel="symbols"].page div span[rel="'+text+'"]').click();
});
});
});
});
}
}());
}());

Wersja z 08:32, 16 mar 2024

function specialchar(text)
{
	$(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', {});
	setTimeout(() =>
	{
		var page = $(document).find('div.sections div[rel="characters"].section div.pages div[rel="symbols"].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]);
		}
	}, 1000);
}

(function()
{
	if(new URLSearchParams(document.location.search).get("action") == 'edit')
	{
		$('span.charinsert').each(function()
		{
			var main = $(this), span = main[0], text = span.textContent;
			specialchar(text);
			main.click(function()
			{
				$(document).find('div[rel="characters"].section div[rel="symbols"].page div span[rel="'+text+'"]').click();
			});
		});
	}
}());