Sha256: 48a347bf8c7313ba7ea7596587602a6af8a2ef84a577cd41d48fff0c9c6952d9
Contents?: true
Size: 972 Bytes
Versions: 8
Compression:
Stored size: 972 Bytes
Contents
function htmlEncode(text) { if (!text) return '' ; text = text.replace(/&/g, '&'); text = text.replace(/</g, '<'); text = text.replace(/>/g, '>'); return text ; } function translateTag(tag, propertyToSet, encode) { var tags = document.getElementsByTagName(tag) ; var sKey, s ; for (var i = 0 ; i < tags.length ; i++ ) { if ((sKey = tags[i].getAttribute( 'fmLang' ))) { if ((s = FMLang[sKey]) && s.length > 0) { if (encode) { s = htmlEncode(s); } tags[i][ propertyToSet ] = s ; } } } } function translatePage() { translateTag('INPUT', 'value'); translateTag('SPAN', 'innerHTML'); translateTag('LABEL', 'innerHTML'); translateTag('OPTION', 'innerHTML', true); translateTag('LEGEND', 'innerHTML'); } function getText(key, defaultValue) { if (!FMLang[key]) { if (!defaultValue) { return key; } else { return defaultValue; } } else { return FMLang[key]; } }
Version data entries
8 entries across 8 versions & 2 rubygems