Thread:Liggliluff/@comment-26040294-20190425135926/@comment-915779-20190505203505

It's part of the javascript, along with a template putting span tags around the text.

On this wiki, there's the template template:sr to mark Serbian text, as well as template:srl to make it into links. The "sr" template will also work as a link if a second argument is inserted.

Then I made this Javascript: var text_serbian = document.getElementsByClassName('serbian'); if (text_serbian.length > 0) { var iDiv = document.createElement('section'); iDiv.id = 'SerbianScript'; iDiv.className = 'ScriptModule module'; var iClose = document.createElement('a'); iClose.style.float = 'right'; iClose.style.fontSize = '160%'; iClose.style.textDecoration = 'none'; iClose.innerHTML = '×'; iClose.href = 'javascript:closeModul("Serbian")'; iDiv.appendChild(iClose); var iHead = document.createElement('h2'); iHead.style.margin = '0'; iHead.innerHTML = 'Serbian Script'; iDiv.appendChild(iHead); var iDesc = document.createElement('p'); iDesc.style.marginBottom = '25px'; iDesc.innerHTML = 'Display Serbian text with Latin or Cyrillic script'; iDiv.appendChild(iDesc); var iUL = document.createElement('ul'); var iA1 = document.createElement('a'); iA1.id = 'rsDefault'; iA1.className = 'link_active'; iA1.style.float = 'left'; iA1.innerHTML = 'Default'; iA1.href = 'javascript:findScript("Serbian","Default",1)'; var iA2 = document.createElement('a'); iA2.id = 'rsCyrillic'; iA2.style.float = 'left'; iA2.innerHTML = 'Ћирилица'; iA2.href = 'javascript:findScript("Serbian","Cyrillic",0)'; var iA3 = document.createElement('a'); iA3.id = 'rsLatin'; iA3.style.float = 'left'; iA3.innerHTML = 'Latin'; iA3.href = 'javascript:findScript("Serbian","Latin",0)'; iUL.appendChild(iA1); iUL.appendChild(iA2); iUL.appendChild(iA3); iDiv.appendChild(iUL); var w_rail = document.getElementsByClassName('wikia-rail-inner'); w_rail[0].prepend(iDiv,w_rail[0].childNodes[0]); }

function findScript(lng,scpt,updt) { if (lng == "Serbian") { if (scpt != "Default") { if (!updt) { var text_serbian = document.getElementsByClassName('serbian'); for (var i = 0; i < text_serbian.length; i++) { text_serbian[i].innerHTML = swapScript(text_serbian[i].innerHTML,"Serbian",scpt); }               if (scpt == "Cyrillic") { document.getElementById('rsDefault').className = ''; document.getElementById('rsLatin').className = ''; document.getElementById('rsCyrillic').className = 'link_active'; } else if (scpt == "Latin") { document.getElementById('rsDefault').className = ''; document.getElementById('rsLatin').className = 'link_active'; document.getElementById('rsCyrillic').className = ''; }           }        }    } }

function swapScript(inpt,lng,scpt,tpe) { } else if (lng == "Serbian") { if (scpt == "Cyrillic") { return inpt.replace(/LJ/g, 'Љ') .replace(/NJ/g, 'Њ') .replace(/DŽ/g, 'Џ') .replace(/Lj/g, 'Љ') .replace(/Nj/g, 'Њ') .replace(/Dž/g, 'Џ') .replace(/lj/g, 'љ') .replace(/nj/g, 'њ') .replace(/dž/g, 'џ') .replace(/A/g, 'А') .replace(/B/g, 'Б') .replace(/V/g, 'В') .replace(/G/g, 'Г') .replace(/D/g, 'Д') .replace(/Đ/g, 'Ђ') .replace(/E/g, 'Е') .replace(/Ž/g, 'Ж') .replace(/Z/g, 'З') .replace(/I/g, 'И') .replace(/J/g, 'Ј') .replace(/K/g, 'К') .replace(/L/g, 'Л') .replace(/M/g, 'М') .replace(/N/g, 'Н') .replace(/O/g, 'О') .replace(/P/g, 'П') .replace(/R/g, 'Р') .replace(/S/g, 'С') .replace(/T/g, 'Т') .replace(/Ć/g, 'Ћ') .replace(/U/g, 'У') .replace(/F/g, 'Ф') .replace(/H/g, 'Х') .replace(/C/g, 'Ц') .replace(/Č/g, 'Ч') .replace(/Š/g, 'Ш') .replace(/a/g, 'а') .replace(/b/g, 'б') .replace(/v/g, 'в') .replace(/g/g, 'г') .replace(/d/g, 'д') .replace(/đ/g, 'ђ') .replace(/e/g, 'е') .replace(/ž/g, 'ж') .replace(/z/g, 'з') .replace(/i/g, 'и') .replace(/j/g, 'ј') .replace(/k/g, 'к') .replace(/l/g, 'л') .replace(/m/g, 'м') .replace(/n/g, 'н') .replace(/o/g, 'о') .replace(/p/g, 'п') .replace(/r/g, 'р') .replace(/s/g, 'с') .replace(/t/g, 'т') .replace(/ć/g, 'ћ') .replace(/u/g, 'у') .replace(/f/g, 'ф') .replace(/h/g, 'х') .replace(/c/g, 'ц') .replace(/č/g, 'ч') .replace(/š/g, 'ш'); } else if (scpt == "Latin") { return inpt.replace(/Љ/g, 'Lj') .replace(/Њ/g, 'Nj') .replace(/Џ/g, 'Dž') .replace(/љ/g, 'lj') .replace(/њ/g, 'nj') .replace(/џ/g, 'dž') .replace(/А/g, 'A') .replace(/Б/g, 'B') .replace(/В/g, 'V') .replace(/Г/g, 'G') .replace(/Д/g, 'D') .replace(/Ђ/g, 'Đ') .replace(/Е/g, 'E') .replace(/Ж/g, 'Ž') .replace(/З/g, 'Z') .replace(/И/g, 'I') .replace(/Ј/g, 'J') .replace(/К/g, 'K') .replace(/Л/g, 'L') .replace(/М/g, 'M') .replace(/Н/g, 'N') .replace(/О/g, 'O') .replace(/П/g, 'P') .replace(/Р/g, 'R') .replace(/С/g, 'S') .replace(/Т/g, 'T') .replace(/Ћ/g, 'Ć') .replace(/У/g, 'U') .replace(/Ф/g, 'F') .replace(/Х/g, 'H') .replace(/Ц/g, 'C') .replace(/Ч/g, 'Č') .replace(/Ш/g, 'Š') .replace(/а/g, 'a') .replace(/б/g, 'b') .replace(/в/g, 'v') .replace(/г/g, 'g') .replace(/д/g, 'd') .replace(/ђ/g, 'đ') .replace(/е/g, 'e') .replace(/ж/g, 'ž') .replace(/з/g, 'z') .replace(/и/g, 'i') .replace(/ј/g, 'j') .replace(/к/g, 'k') .replace(/л/g, 'l') .replace(/м/g, 'm') .replace(/н/g, 'n') .replace(/о/g, 'o') .replace(/п/g, 'p') .replace(/р/g, 'r') .replace(/с/g, 's') .replace(/т/g, 't') .replace(/ћ/g, 'ć') .replace(/у/g, 'u') .replace(/ф/g, 'f') .replace(/х/g, 'h') .replace(/ц/g, 'c') .replace(/ч/g, 'č') .replace(/ш/g, 'š'); }   } }