X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fresources%2Fstatic%2Fjavascript%2Fsone.js;h=149520f3650ee0e46e379d3d820400b08831cce6;hb=51cdfee0b350955d9f858adb892f18b2a4fa8ab4;hp=a346894037e7c3eff9337ad1dff4378e7c2b377e;hpb=80822a0b544648746b293b562eed1da88e439991;p=Sone.git diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index a346894..149520f 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -99,6 +99,8 @@ function addCommentLink(postId, element) { }); } +var translations = {}; + /** * Retrieves the translation for the given key and calls the callback function. * The callback function takes a single parameter, the translated string. @@ -109,8 +111,13 @@ function addCommentLink(postId, element) { * The callback function */ function getTranslation(key, callback) { + if (key in translations) { + callback(translations[key]); + return; + } $.getJSON("ajax/getTranslation.ajax", {"key": key}, function(data, textStatus) { if ((data != null) && data.success) { + translations[key] = data.value; callback(data.value); } }, function(xmlHttpRequest, textStatus, error) { @@ -275,7 +282,7 @@ function generateSoneList(sones) { var soneList = ""; $.each(sones, function() { if (soneList != "") { - soneList += "\n"; + soneList += ", "; } soneList += this.name; });