1 OSM.ChangesetList = function(map) {
4 var group = L.featureGroup()
6 mouseover: function (e) {
7 highlightChangeset(e.layer.id);
9 mouseout: function (e) {
10 unHighlightChangeset(e.layer.id);
14 group.getLayerId = function(layer) {
18 function highlightChangeset(id) {
19 group.getLayer(id).setStyle({fillOpacity: 0.5});
20 $("#changeset_" + id).addClass("selected");
23 function unHighlightChangeset(id) {
24 group.getLayer(id).setStyle({fillOpacity: 0});
25 $("#changeset_" + id).removeClass("selected");
28 page.pushstate = page.popstate = function(path) {
29 $("#history_tab").addClass("current");
30 $("#sidebar").removeClass("minimized");
32 $('#sidebar_content').load(path, page.load);
35 page.load = function() {
39 $("[data-changeset]").each(function () {
40 var changeset = $(this).data('changeset');
42 changeset.bounds = L.latLngBounds([changeset.bbox.minlat, changeset.bbox.minlon],
43 [changeset.bbox.maxlat, changeset.bbox.maxlon]);
44 changesets.push(changeset);
48 changesets.sort(function (a, b) {
49 return b.bounds.getSize() - a.bounds.getSize();
52 for (var i = 0; i < changesets.length; ++i) {
53 var changeset = changesets[i],
54 rect = L.rectangle(changeset.bounds,
55 {weight: 2, color: "#ee9900", fillColor: "#ffff55", fillOpacity: 0});
56 rect.id = changeset.id;
60 $("[data-changeset]").on({
61 mouseover: function () {
62 highlightChangeset($(this).data("changeset").id);
64 mouseout: function () {
65 unHighlightChangeset($(this).data("changeset").id);
70 page.unload = function() {
71 map.removeLayer(group);
73 $("#history_tab").removeClass("current");