PageSourceSearch

https://saspeakup.com/Scripts/mappoll.parcels.js

js saspeakup.com collected 2026-09-28 06:00:11 UTC 5,466 bytes, 170 lines download raw bytes

1MapPoll.prototype.initParcelMapUI = function (callback) {
2  var self = this;
3  if ($("#map-poll-header-template").length == 0) {
4    $.post("/Comments/GetMapPollTemplatesHtml").done(function (html) {
5      $("body").append(html);
6      initInner();
7    });
8  } else initInner();
9
10  function initInner() {
11    self.initTopSearchBarUI();
12    self.pollContainer.on("click", ".comment-on-parcel", function () {
13      self.initEditParcelCommentForm($(this));
14    });
15    callback && callback();
16  }
17};
18
19MapPoll.prototype.initParcelKml = function (mapFile) {
20  var self = this;
21  self.parcelInfoWindow = new google.maps.InfoWindow({
22    maxWidth: self.pollContainer.width() - 50
23  });
24
25  var kmlLayer = new google.maps.KmlLayer({
26    suppressInfoWindows: true,
27    url: mapFile.serverFullPathAndFileName,
28    map: self.map,
29    preserveViewport: true
30  });
31  google.maps.event.addListener(kmlLayer, "click", function (kmlMouseEvent) {
32    self.kmlLayerClicked(kmlMouseEvent);
33  });
34
35  this._kmlLayers.push(kmlLayer);
36};
37
38MapPoll.prototype.kmlLayerClicked = function (kmlMouseEvent) {
39  var self = this;
40  var clickData = kmlMouseEvent;
41
42  self.parcelInfoWindow =
43    self.parcelInfoWindow ||
44    new google.maps.InfoWindow({ maxWidth: self.pollContainer.width() - 50 });
45  self.parcelInfoWindow.close();
46
47  self.clickedLatLng = clickData.latLng;
48
49  if (clickData.featureData && clickData.featureData.name) {
50    var content = self.generateParcelInfoWindow(clickData.featureData);
51    self.parcelInfoWindow.setOptions({
52      position: clickData.latLng,
53      pixelOffset: clickData.pixelOffset,
54      content: content
55    });
56    self.parcelInfoWindow.open(self.map);
57  }
58};
59
60MapPoll.prototype.generateParcelInfoWindow = function (featureData) {
61  var self = this;
62  var $content = $(
63    '<div id="content">' +
64      '<h4 id="firstHeading" class="parcel-name">' +
65      featureData.name +
66      "</h4>" +
67      '<div class="bodyContent"></div>'
68  );
69
70  var $body = $content.find(".bodyContent");
71  if (featureData.address != null && featureData.address.indexOf("N/A") == -1) {
72    $body.append("<div>").html(featureData.address);
73  }
74  var $commentButton = $(
75    '<button class="btn btn-primary comment-on-parcel"><i class="fas fa-comment"></i> Comment on this parcel</button>'
76  )
77    .attr("data-parcel-id", featureData.id)
78    .attr("data-parcel-number", featureData.parcelNumber)
79    .attr("data-parcel-name", featureData.name);
80
81  $body.append('<div class="text-center m-t"></div>').append($commentButton);
82
83  return $content[0].outerHTML;
84};
85
86MapPoll.prototype.initEditParcelCommentForm = function ($commentBtn) {
87  var self = this;
88  $commentBtn = $commentBtn || $();
89  self.currentParcel = {
90    id: $commentBtn.data("parcel-id"),
91    number: $commentBtn.data("parcel-number"),
92    name: $commentBtn.data("parcel-name")
93  };
94  self.$editPopup.find('[name="ParcelId"]').val(self.currentParcel.id);
95  self.parcelInfoWindow.close();
96
97  if (self.currentParcel.id == null || self.currentParcel.id < 1) {
98    self.$parcelInfo.hide();
99    self.$parcelRelationshipWrapper.detach();
100  } else {
101    self.$parcelInfo.next(self.$parcelRelationshipWrapper);
102    self.$editPopup
103      .find(".comment-parcel-display")
104      .text(self.currentParcel.name);
105    self.$parcelInfo.show();
106  }
107  self._setMode(MAP_POLL_MODE.EDIT_PARCEL_POINT);
108};
109
110MapPoll.prototype.initTopSearchBarUI = function () {
111  var self = this;
112  //self.$topBar = $(Mustache.render($("#map-poll-header-template").html(), self.options));
113  //self.$mapElement.before(self.$topBar);
114};
115
116MapPoll.prototype._addEditParcelCommentPopup = function () {
117  var self = this;
118  self.$editPopup = $(
119    Mustache.render($("#map-poll-parcel-edit-template").html(), self.options)
120  );
121
122  self.$closeButton = self.$editPopup.find(".map-close");
123  self.$commentForm = $(
124    "<form class='mapPoll-editPopup-content'></form>"
125  ).appendTo(self.$editPopup);
126  self.$commentText = self.$editPopup.find(".mapPoll-editPopup-commentText");
127  self.$parcelInfo = self.$editPopup.find(".parcel-info");
128
129  self.$parcelRelationshipWrapper = self.$editPopup.find(
130    ".wrapper-relationship"
131  );
132  self.$parcelEmailWrapper = self.$editPopup.find(".wrapper-email");
133  self.$parcelPhoneWrapper = self.$editPopup.find(".wrapper-phone");
134
135  // mappoll comment attachments stuff
136  var mapPollCommentAttachment = null;
137  if (self._pollAllowsAttachments()) {
138    mapPollCommentAttachment = new MapPollCommentAttachment(self.$editPopup);
139    mapPollCommentAttachment.init();
140  }
141  this.addToMapDiv(self.$editPopup);
142
143  self.$commentText.on("focus", this._onCommentTextFocus.bind(this));
144
145  self.$closeButton.on("click", function () {
146    self._onEditPopupClose();
147  });
148
149  self.$editPopup.on("submit", "form", function (e) {
150    e.preventDefault();
151    if ($.fn.parsley && !self.$commentForm.parsley().isValid()) return;
152    if (self.$commentText.val().trim().length == 0) return;
153
154    if (self.poll._needsLightLogin()) {
155      self.poll.UI.openLightLogin(function () {
156        self.postMapComment(
157          self.$commentText.val(),
158          mapPollCommentAttachment,
159          self.clickedLatLng
160        );
161      });
162      return;
163    }
164    self.postMapComment(
165      self.$commentText.val(),
166      mapPollCommentAttachment,
167      self.clickedLatLng
168    );
169  });
170};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.