+ div.appendChild(history);
+
+ $("browse_content").appendChild(div);
+ }
+
+ function featureType(feature) {
+ if (feature.geometry.CLASS_NAME == "OpenLayers.Geometry.Point") {
+ return "node";
+ } else {
+ return "way";
+ }
+ }
+
+ function featureTypeName(feature) {
+ if (featureType(feature) == "node") {
+ return "#{I18n.t('browse.start_rjs.object_list.type.node')}";
+ } else if (featureType(feature) == "way") {
+ return "#{I18n.t('browse.start_rjs.object_list.type.way')}";
+ }
+ }
+
+ function featureNameSelect(feature) {
+ if (feature.attributes.name) {
+ return feature.attributes.name;
+ } else if (featureType(feature) == "node") {
+ return "#{I18n.t('browse.start_rjs.object_list.selected.type.node')} " + feature.osm_id;
+ } else if (featureType(feature) == "way") {
+ return "#{I18n.t('browse.start_rjs.object_list.selected.type.way')} " + feature.osm_id;
+ }
+ }
+
+ function featureNameHistory(feature) {
+ if (feature.attributes.name) {
+ return feature.attributes.name;
+ } else if (featureType(feature) == "node") {
+ return "#{I18n.t('browse.start_rjs.object_list.history.type.node')} " + feature.osm_id;
+ } else if (featureType(feature) == "way") {
+ return "#{I18n.t('browse.start_rjs.object_list.history.type.way')} " + feature.osm_id;
+ }
+ }
+
+ /*
+ This is a hack so that we can interpolate JavaScript variables in
+ translation strings from Ruby, doing the string replacement
+ client-side instead of on the server.
+ */
+ function i18n_js(string, keys) {
+ for (var key in keys) {
+ var re_key = '\{\{' + key + '\}\}';
+ var re = new RegExp(re_key, "g");
+
+ string = string.replace(re, keys[key]);
+ }
+
+ return string;
+ }
+
+ function setStatus(status) {
+ $("browse_status").innerHTML = status;
+ $("browse_status").style.display = "block";
+ }
+
+ function clearStatus() {
+ $("browse_status").innerHTML = "";
+ $("browse_status").style.display = "none";
+ }