5 148
redigeringar
Niklas (diskussion | bidrag) Ingen redigeringssammanfattning |
Niklas (diskussion | bidrag) Ingen redigeringssammanfattning |
||
(5 mellanliggande sidversioner av samma användare visas inte) | |||
Rad 1: | Rad 1: | ||
/ | $(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(); | |||
}); | |||
}); | |||
} |