MediaWiki:CharInsert.js: Różnice pomiędzy wersjami
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') | var page = $(document).find('div.sections div[rel="characters"].section div.pages div[rel="symbols"].page div'); | ||
if(page.length) | |||
{ | { | ||
$.wikiEditor.modules.toolbar.fn.doAction( | 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); | }, 1000); | ||
} | } | ||
| Linia 19: | Linia 22: | ||
(function() | (function() | ||
{ | { | ||
if(new URLSearchParams(document.location.search).get("action") == 'edit') | |||
{ | { | ||
$('span.charinsert').each(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();
});
});
}
}());