projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Return the post element if its containing post element is requested.
[Sone.git]
/
src
/
main
/
resources
/
static
/
javascript
/
sone.js
diff --git
a/src/main/resources/static/javascript/sone.js
b/src/main/resources/static/javascript/sone.js
index
a346894
..
4277d9a
100644
(file)
--- 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.
/**
* 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) {
* 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) {
$.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) {
callback(data.value);
}
}, function(xmlHttpRequest, textStatus, error) {
@@
-275,7
+282,7
@@
function generateSoneList(sones) {
var soneList = "";
$.each(sones, function() {
if (soneList != "") {
var soneList = "";
$.each(sones, function() {
if (soneList != "") {
- soneList += "
\n
";
+ soneList += "
,
";
}
soneList += this.name;
});
}
soneList += this.name;
});
@@
-294,7
+301,7
@@
function getSoneId(element) {
}
function getPostElement(element) {
}
function getPostElement(element) {
- return $(element).parents(".post");
+ return $(element).
hasClass("post") ? $(element) : $(element).
parents(".post");
}
function getPostId(element) {
}
function getPostId(element) {