-
- function loadHistory() {
- $(this).attr("href", "").text(I18n.t('browse.start_rjs.wait'));
-
- var feature = selectedLayer.feature;
-
- $.ajax({
- url: "/api/" + OSM.API_VERSION + "/" + feature.type + "/" + feature.id + "/history",
- success: function (xml) {
- if (selectedLayer.feature != feature || $("#browse_content").firstChild == browseObjectList) {
- return;
- }
-
- $(this).remove();
-
- var history = [];
- var nodes = xml.getElementsByTagName(feature.type);
- for (var i = nodes.length - 1; i >= 0; i--) {
- history.push({
- user: nodes[i].getAttribute("user") || I18n.t('browse.start_rjs.private_user'),
- timestamp: nodes[i].getAttribute("timestamp")
- });
- }
-
- $("#browse_content").append(JST["templates/browse/feature_history"]({
- name: featureNameHistory(feature),
- url: "/browse/" + feature.type + "/" + feature.id,
- history: history
- }));
- }.bind(this)
- });
-
- return false;
- }
-
- function featureTypeName(feature) {
- return I18n.t('browse.start_rjs.object_list.type.' + feature.type);
- }
-
- function featureName(feature) {
- return feature.tags['name:' + $('html').attr('lang')] ||
- feature.tags.name ||
- feature.id;
- }
-
- function featureNameSelect(feature) {
- return feature.tags['name:' + $('html').attr('lang')] ||
- feature.tags.name ||
- I18n.t("browse.start_rjs.object_list.selected.type." + feature.type, { id: feature.id });
- }
-
- function featureNameHistory(feature) {
- return feature.tags['name:' + $('html').attr('lang')] ||
- feature.tags.name ||
- I18n.t("browse.start_rjs.object_list.history.type." + feature.type, { id: feature.id });
- }
-
- function setStatus(status) {
- $("#browse_status").html(status);
- $("#browse_status").show();
- }
-
- function clearStatus() {
- $("#browse_status").html("");
- $("#browse_status").hide();
- }
-}