MediaWiki:Common.js: Skillnad mellan sidversioner
Hoppa till navigering
Hoppa till sök
Niklas (diskussion | bidrag) Ingen redigeringssammanfattning |
Niklas (diskussion | bidrag) Ingen redigeringssammanfattning |
||
Rad 1: | Rad 1: | ||
// Customized transcription table | $(document).ready(function() { | ||
var transcriptionTable = { | // Use mw.loader.using to ensure compatibility with Mediawiki's module loading system | ||
mw.loader.using(['mediawiki.util'], function() { | |||
// Customized transcription table | |||
var transcriptionTable = { | |||
"α":"a", | "α":"a", | ||
"ἁ":"â", | "ἁ":"â", | ||
Rad 41: | Rad 44: | ||
"ϗ":"ķ", | "ϗ":"ķ", | ||
"ₓ":"x" | "ₓ":"x" | ||
// Add more mappings as needed | |||
}; | }; | ||
function transcribeString() { | // Function to transcribe a string based on the transcription table | ||
function transcribeString() { | |||
var element = document.getElementById("convert-go"); | var element = document.getElementById("convert-go"); | ||
if (element) { | if (element) { | ||
Rad 63: | Rad 67: | ||
// Automatically transcribe when the page finishes loading | // Automatically transcribe when the page finishes loading | ||
transcribeString(); | |||
}); | |||
}); |
Nuvarande version från 11 juni 2023 kl. 17.16
$(document).ready(function() { // Use mw.loader.using to ensure compatibility with Mediawiki's module loading system mw.loader.using(['mediawiki.util'], function() { // Customized transcription table var transcriptionTable = { "α":"a", "ἁ":"â", "β":"v", "γ":"g", "δ":"d", "ε":"e", "ἑ":"ê", "ϛ":"ņ", "η":"h", "ἡ":"ļ", "θ":"þ", "ι":"i", "ἱ":"î", "ϊ":":ï", "κ":"k", "λ":"l", "μ":"m", "ν":"n", "ο":"o", "ὁ":"ô", "π":"p", "ϙ":"q", "ρ":"r", "ῥ":"ŗ", "σ":"s", "ϲ":"c", "τ":"ț", "υ":"y", "ὑ":"ŷ", "ϋ":"ÿ", "φ":"f", "χ":"x", "ψ":"ps", "ω":"u", "ὡ":"û", "ϣ":"ñ", "ϥ":"ș", "ϧ":"ŋ", "ϗ":"ķ", "ₓ":"x" // Add more mappings as needed }; // Function to transcribe a string based on the transcription table function transcribeString() { var element = document.getElementById("convert-go"); if (element) { var input = element.textContent || element.innerText; var output = ""; for (var i = 0; i < input.length; i++) { var character = input[i].toLowerCase(); var transcription = transcriptionTable[character]; if (transcription) { output += transcription; } else { output += input[i]; } } element.textContent = output; // Update the text content of the element with the transcribed string } } // Automatically transcribe when the page finishes loading transcribeString(); }); });