MediaWiki:CharInsert.js: Różnice pomiędzy wersjami
Przejdź do nawigacji
Przejdź do wyszukiwania
Nie podano opisu zmian |
Nie podano opisu zmian |
||
| Linia 1: | Linia 1: | ||
function specialchar(text) | function specialchar(text) | ||
{ | { | ||
var actions = $(document).find('div.sections div[rel="characters"].section').data('actions', {}); | var actions = $(document).find('div.sections div[rel="characters"].section').data('actions', {}); | ||
setTimeout(() => | setTimeout(() => | ||
| Linia 17: | Linia 16: | ||
})[0]); | })[0]); | ||
} | } | ||
}, | }, 500); | ||
} | } | ||
| Linia 24: | Linia 23: | ||
if(new URLSearchParams(document.location.search).get("action") == 'edit') | if(new URLSearchParams(document.location.search).get("action") == 'edit') | ||
{ | { | ||
setTimeout(() => | |||
{ | { | ||
$(document).find('div.sections div[rel="characters"].section div.index div[rel="symbols"]').click(); | |||
$('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(); | |||
}); | |||
}); | }); | ||
}); | }, 500); | ||
} | } | ||
}()); | }()); | ||
Wersja z 08:38, 16 mar 2024
function specialchar(text)
{
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]);
}
}, 500);
}
(function()
{
if(new URLSearchParams(document.location.search).get("action") == 'edit')
{
setTimeout(() =>
{
$(document).find('div.sections div[rel="characters"].section div.index div[rel="symbols"]').click();
$('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();
});
});
}, 500);
}
}());