textarea.show().focus();
}).addClass("default");
(function(inputField) {
- $.getJSON("ajax/getTranslation.ajax", {"key": defaultText}, function(data, textStatus) {
- $(inputField).val(data.value);
+ getTranslation(defaultText, function(translation) {
+ $(inputField).val(translation);
});
})(inputField);
$(inputField.form).submit(function() {
}
/**
+ * Retrieves the translation for the given key and calls the callback function.
+ * The callback function takes a single parameter, the translated string.
+ *
+ * @param key
+ * The key of the translation string
+ * @param callback
+ * The callback function
+ */
+function getTranslation(key, callback) {
+ $.getJSON("ajax/getTranslation.ajax", {"key": key}, function(data, textStatus) {
+ callback(data.value);
+ });
+}
+
+/**
* Fires off an AJAX request to retrieve the current status of a Sone.
*
* @param soneId