SHOW:
|
|
- or go back to the newest paste.
1 | define("backbone/helpers/richmarker", ["backbone/assets", "backbone/helpers/maps"], function(e, t) { | |
2 | function r(t) { | |
3 | var r = t || {}; | |
4 | this.ready_ = !1, this.bulkAdd = r.bulkAdd || !1, this.dragging_ = !1, void 0 == r.visible && (r.visible = !0), void 0 == r.shadow && (r.shadow = "0 0 0 transparent"), void 0 == r.anchor && (r.anchor = l.BOTTOM), void 0 == r.id && (r.id = null), r.states = void 0 == r.state ? [e.MarkerStates.Normal] : [r.state], void 0 == t.axis && (t.axis = null), void 0 == t.animate && (t.animate = !1), this.setValues(t) | |
5 | } | |
6 | google.maps = t, r.prototype = new google.maps.OverlayView, window.RichMarker = r, r.prototype.getVisible = function() { | |
7 | return this.get("visible") | |
8 | }, r.prototype.getVisible = r.prototype.getVisible, r.prototype.setVisible = function(e) { | |
9 | this.set("visible", e) | |
10 | }, r.prototype.setVisible = r.prototype.setVisible, r.prototype.getAxis = function() { | |
11 | return this.get("axis") | |
12 | }, r.prototype.getAxis = r.prototype.getAxis, r.prototype.setAxis = function(e) { | |
13 | this.set("axis", e) | |
14 | }, r.prototype.setAxis = r.prototype.setAxis, r.prototype.removeAxis = function() { | |
15 | this.set("axis", null) | |
16 | }, r.prototype.removeAxis = r.prototype.removeAxis, r.prototype.visible_changed = function() { | |
17 | this.ready_ && (this.markerWrapper_.style.display = this.getVisible() ? "" : "none", this.draw()) | |
18 | }, r.prototype.visible_changed = r.prototype.visible_changed, r.prototype.setFlat = function(e) { | |
19 | this.set("flat", !!e) | |
20 | }, r.prototype.setFlat = r.prototype.setFlat, r.prototype.getFlat = function() { | |
21 | return this.get("flat") | |
22 | }, r.prototype.getFlat = r.prototype.getFlat, r.prototype.getWidth = function() { | |
23 | return this.get("width") | |
24 | }, r.prototype.getWidth = r.prototype.getWidth, r.prototype.getHeight = function() { | |
25 | return this.get("height") | |
26 | }, r.prototype.getHeight = r.prototype.getHeight, r.prototype.setShadow = function() {}, r.prototype.setShadow = r.prototype.setShadow, r.prototype.getShadow = function() {}, r.prototype.getShadow = r.prototype.getShadow, r.prototype.flat_changed = function() { | |
27 | !this.ready_ | |
28 | }, r.prototype.flat_changed = r.prototype.flat_changed, r.prototype.setZIndex = function(e) { | |
29 | this.set("zIndex", e) | |
30 | }, r.prototype.setZIndex = r.prototype.setZIndex, r.prototype.getZIndex = function() { | |
31 | return this.get("zIndex") | |
32 | }, r.prototype.getZIndex = r.prototype.getZIndex, r.prototype.zIndex_changed = function() { | |
33 | this.getZIndex() && this.ready_ && (this.markerWrapper_.style.zIndex = this.getZIndex()) | |
34 | }, r.prototype.zIndex_changed = r.prototype.zIndex_changed, r.prototype.getDraggable = function() { | |
35 | return this.get("draggable") | |
36 | }, r.prototype.getDraggable = r.prototype.getDraggable, r.prototype.setDraggable = function(e) { | |
37 | this.set("draggable", !!e) | |
38 | }, r.prototype.setDraggable = r.prototype.setDraggable, r.prototype.draggable_changed = function() { | |
39 | this.ready_ && (this.getDraggable() ? this.addDragging_(this.markerWrapper_) : this.removeDragListeners_()) | |
40 | }, r.prototype.draggable_changed = r.prototype.draggable_changed, r.prototype.getPosition = function() { | |
41 | return this.get("position") | |
42 | }, r.prototype.getPosition = r.prototype.getPosition, r.prototype.setPosition = function(e) { | |
43 | this.set("position", e) | |
44 | }, r.prototype.setPosition = r.prototype.setPosition, r.prototype.position_changed = function() { | |
45 | this.draw() | |
46 | }, r.prototype.position_changed = r.prototype.position_changed, r.prototype.getAnchor = function() { | |
47 | return this.get("anchor") | |
48 | }, r.prototype.getAnchor = r.prototype.getAnchor, r.prototype.setAnchor = function(e) { | |
49 | this.set("anchor", e) | |
50 | }, r.prototype.setAnchor = r.prototype.setAnchor, r.prototype.anchor_changed = function() { | |
51 | this.draw() | |
52 | }, r.prototype.anchor_changed = r.prototype.anchor_changed, r.prototype.htmlToDocumentFragment_ = function(e) { | |
53 | var t = document.createElement("DIV"); | |
54 | if (t.innerHTML = e, 1 == t.childNodes.length) return t.removeChild(t.firstChild); | |
55 | for (var r = document.createDocumentFragment(); t.firstChild;) r.appendChild(t.firstChild); | |
56 | return r | |
57 | }, r.prototype.removeChildren_ = function(e) { | |
58 | if (e) | |
59 | for (var t; t = e.firstChild;) e.removeChild(t) | |
60 | }, r.prototype.setContent = function(e) { | |
61 | this.set("content", e) | |
62 | }, r.prototype.setContent = r.prototype.setContent, r.prototype.getContent = function() { | |
63 | return this.get("content") | |
64 | }, r.prototype.getContent = r.prototype.getContent, r.prototype.setStates_ = function() { | |
65 | if (this.markerContent_) { | |
66 | var e = 0, | |
67 | t = ""; | |
68 | for (e = 0; e < this.states.length; e++) t += " " + this.states[e].className; | |
69 | this.markerContent_.className = t | |
70 | } | |
71 | lastState = this.states[this.states.length - 1], this.setZIndex(lastState.zIndex), lastState.size && (this.set("width", lastState.size.width), this.set("height", lastState.size.height)), this.setColor_() | |
72 | }, r.prototype.addState = function(e) { | |
73 | -1 == this.states.indexOf(e) && this.states.push(e), this.states = _.sortBy(this.states, function(e) { | |
74 | return e.priority | |
75 | }), this.setStates_(), this.draw() | |
76 | }, r.prototype.addState = r.prototype.addState, r.prototype.removeState = function(e) { | |
77 | -1 != this.states.indexOf(e) && (this.states = _.without(this.states, e)), this.states = _.sortBy(this.states, function(e) { | |
78 | return e.priority | |
79 | }), this.setStates_(), this.draw() | |
80 | }, r.prototype.removeState = r.prototype.removeState, r.prototype.setColor = function(e) { | |
81 | this.set("color", e), this.setColor_() | |
82 | }, r.prototype.setColor = r.prototype.setColor, r.prototype.setColor_ = function() { | |
83 | color = this.get("color"), lastState = this.states[this.states.length - 1], lastState.priority >= 10 && (color = null), this.markerContent_ && (arrow = this.markerContent_.getElementsByClassName("arrow")[0], color ? (this.markerContent_.style.backgroundImage = "none", this.markerContent_.style.backgroundColor = color, this.markerContent_.style.filter = 'e(%("progid:DXImageTransform.Microsoft.gradient(enabled = false)"))', arrow && (arrow.style.borderTopColor = color)) : (this.markerContent_.style.cssText = "", arrow && (arrow.style.cssText = ""))) | |
84 | }, r.prototype.getStates = function() { | |
85 | return this.get("states") | |
86 | }, r.prototype.getStates = r.prototype.getStates, r.prototype.setStates = function(e) { | |
87 | return this.set("states", e) | |
88 | }, r.prototype.setStates = r.prototype.setStates, r.prototype.hasState = function(e) { | |
89 | return -1 != this.get("states").indexOf(e) | |
90 | }, r.prototype.hasState = r.prototype.hasState, r.prototype.setAnimate = function(e) { | |
91 | e && this.set("animate", e), this.draw() | |
92 | }, r.prototype.setAnimate = r.prototype.setAnimate, r.prototype.getAnimate = function() { | |
93 | return this.animate | |
94 | }, r.prototype.getAnimate = r.prototype.getAnimate, r.prototype.content_changed = function() { | |
95 | if (this.markerContent_) { | |
96 | this.removeChildren_(this.markerContent_); | |
97 | var e = this.getContent(); | |
98 | if (e) { | |
99 | "string" == typeof e && (e = e.replace(/^\s*([\S\s]*)\b\s*$/, "$1"), e = this.htmlToDocumentFragment_(e)), e.title ? (this.markerContent_.title = e.title, e.title = "") : e.childNodes.length && e.childNodes[0].title && (this.markerContent_.title = e.childNodes[0].title, e.childNodes[0].title = ""), this.markerContent_.appendChild(e); | |
100 | for (var t, r = this, i = this.markerContent_.getElementsByTagName("IMG"), s = 0; t = i[s]; s++) google.maps.event.addDomListener(t, "mousedown", function(e) { | |
101 | r.getDraggable() && (e.preventDefault && e.preventDefault(), e.returnValue = !1) | |
102 | }), google.maps.event.addDomListener(t, "load", function() { | |
103 | r.draw() | |
104 | }); | |
105 | google.maps.event.trigger(this, "domready") | |
106 | } | |
107 | this.ready_ && this.draw() | |
108 | } | |
109 | }, r.prototype.content_changed = r.prototype.content_changed, r.prototype.setCursor_ = function(e) { | |
110 | if (this.ready_) { | |
111 | var t = ""; - 1 !== navigator.userAgent.indexOf("Gecko/") ? ("dragging" == e && (t = "-moz-grabbing"), "dragready" == e && (t = "-moz-grab"), "draggable" == e && (t = "pointer")) : (("dragging" == e || "dragready" == e) && (t = "move"), "draggable" == e && (t = "pointer")), this.markerWrapper_.style.cursor != t && (this.markerWrapper_.style.cursor = t) | |
112 | } | |
113 | }; | |
114 | var i, s, n, o; | |
115 | r.prototype.startDrag = function(e) { | |
116 | if (this.getDraggable() && (google.maps.event.trigger(this, "before_dragstart"), !this.dragging_)) { | |
117 | this.dragging_ = !0; | |
118 | var t = this.getMap(); | |
119 | this.mapDraggable_ = t.get("draggable"), t.set("draggable", !1), i = e.clientX, s = e.clientY, this.mouseX_ = e.clientX, this.mouseY_ = e.clientY, this.setCursor_("dragready"), this.markerWrapper_.style.MozUserSelect = "none", this.markerWrapper_.style.KhtmlUserSelect = "none", this.markerWrapper_.style.WebkitUserSelect = "none", this.markerWrapper_.unselectable = "on", this.markerWrapper_.onselectstart = function() { | |
120 | return !1 | |
121 | }, this.addDraggingListeners_(), google.maps.event.trigger(this, "dragstart") | |
122 | } | |
123 | }, r.prototype.stopDrag = function() { | |
124 | this.getDraggable() && this.dragging_ && (this.dragging_ = !1, this.getMap().set("draggable", this.mapDraggable_), n = this.mouseX_, o = this.mouseY_, this.mouseX_ = this.mouseY_ = this.mapDraggable_ = null, this.markerWrapper_.style.MozUserSelect = "", this.markerWrapper_.style.KhtmlUserSelect = "", this.markerWrapper_.style.WebkitUserSelect = "", this.markerWrapper_.unselectable = "off", this.markerWrapper_.onselectstart = function() {}, this.removeDraggingListeners_(), this.setCursor_("draggable"), (Math.abs(n - i) > 2 || Math.abs(o - s) > 2) && google.maps.event.trigger(this, "dragend"), this.draw()) | |
125 | }; | |
126 | var a; | |
127 | r.prototype.drag = function(e) { | |
128 | if (!this.getDraggable() || !this.dragging_) return void this.stopDrag(); | |
129 | var t = this.getAxis(), | |
130 | r = this.mouseX_ - e.clientX, | |
131 | i = this.mouseY_ - e.clientY; | |
132 | if (this.mouseX_ = e.clientX, this.mouseY_ = e.clientY, "x" == t) var s = parseInt(this.markerWrapper_.style.top, 10), | |
133 | n = parseInt(this.markerWrapper_.style.left, 10) - r; | |
134 | else if ("y" == t) var s = parseInt(this.markerWrapper_.style.top, 10) - i, | |
135 | n = parseInt(this.markerWrapper_.style.left, 10); | |
136 | else if ("stop" == t) var s = parseInt(this.markerWrapper_.style.top, 10), | |
137 | n = parseInt(this.markerWrapper_.style.left, 10); | |
138 | else var s = parseInt(this.markerWrapper_.style.top, 10) - i, | |
139 | n = parseInt(this.markerWrapper_.style.left, 10) - r; | |
140 | this.markerWrapper_.style.left = n + "px", this.markerWrapper_.style.top = s + "px"; | |
141 | var o = this.getOffset_(), | |
142 | l = new google.maps.Point(n - o.width, s - o.height), | |
143 | h = this.getProjection(); | |
144 | a = h.fromDivPixelToLatLng(l), this.setPosition(h.fromDivPixelToLatLng(l)), this.setCursor_("dragging"), google.maps.event.trigger(this, "drag") | |
145 | }, r.prototype.calculateDistance = function(e) { | |
146 | { | |
147 | var r = (this.getOffset_(), this.getProjection(), this.getPosition()); | |
148 | t.geometry.spherical.computeDistanceBetween(r, e) | |
149 | } | |
150 | }, r.prototype.calculateDistance = r.prototype.calculateDistance, r.prototype.removeDragListeners_ = function() { | |
151 | this.draggableListener_ && (google.maps.event.removeListener(this.draggableListener_), delete this.draggableListener_), this.setCursor_("") | |
152 | }, r.prototype.addDragging_ = function(e) { | |
153 | if (e) { | |
154 | var t = this; | |
155 | this.draggableListener_ = google.maps.event.addDomListener(e, "mousedown", function(e) { | |
156 | t.startDrag(e) | |
157 | }), this.setCursor_("draggable") | |
158 | } | |
159 | }, r.prototype.addDraggingListeners_ = function() { | |
160 | var e = this; | |
161 | this.markerWrapper_.setCapture ? (this.markerWrapper_.setCapture(!0), this.draggingListeners_ = [google.maps.event.addDomListener(this.markerWrapper_, "mousemove", function(t) { | |
162 | e.drag(t) | |
163 | }, !0), google.maps.event.addDomListener(this.markerWrapper_, "mouseup", function() { | |
164 | e.stopDrag(), e.markerWrapper_.releaseCapture() | |
165 | }, !0)]) : this.draggingListeners_ = [google.maps.event.addDomListener(window, "mousemove", function(t) { | |
166 | e.drag(t) | |
167 | }, !0), google.maps.event.addDomListener(window, "mouseup", function() { | |
168 | e.stopDrag() | |
169 | }, !0)] | |
170 | }, r.prototype.removeDraggingListeners_ = function() { | |
171 | if (this.draggingListeners_) { | |
172 | for (var e, t = 0; e = this.draggingListeners_[t]; t++) google.maps.event.removeListener(e); | |
173 | this.draggingListeners_.length = 0 | |
174 | } | |
175 | }, r.prototype.getOffset_ = function() { | |
176 | var e = this.getAnchor(); | |
177 | if ("object" == typeof e) return e; | |
178 | var t = new google.maps.Size(0, 0); | |
179 | if (!this.markerContent_) return t; | |
180 | var r = this.get("width") || this.markerContent_.offsetWidth, | |
181 | i = this.get("height") || this.markerContent_.offsetHeight; | |
182 | switch (e) { | |
183 | case l.TOP_LEFT: | |
184 | break; | |
185 | case l.TOP: | |
186 | t.width = -r / 2; | |
187 | break; | |
188 | case l.TOP_RIGHT: | |
189 | t.width = -r; | |
190 | break; | |
191 | case l.LEFT: | |
192 | t.height = -i / 2; | |
193 | break; | |
194 | case l.MIDDLE: | |
195 | t.width = -r / 2, t.height = -i / 2; | |
196 | break; | |
197 | case l.RIGHT: | |
198 | t.width = -r, t.height = -i / 2; | |
199 | break; | |
200 | case l.BOTTOM_LEFT: | |
201 | t.height = -i; | |
202 | break; | |
203 | case l.BOTTOM: | |
204 | t.width = -r / 2, t.height = -i; | |
205 | break; | |
206 | case l.BOTTOM_RIGHT: | |
207 | t.width = -r, t.height = -i | |
208 | } | |
209 | return t | |
210 | }, r.prototype.onAdd = function() { | |
211 | var t = !1; | |
212 | if (this.markerWrapper_ || (this.markerWrapper_ = document.createElement("DIV"), this.markerWrapper_.style.position = "absolute", t = !0), this.markerWrapper_.style.display = this.getVisible() ? "" : "none", this.animate && (this.markerWrapper_.style.webkitTransition = this.markerWrapper_.style.MozTransition = this.markerWrapper_.style.oTransition = this.markerWrapper_.style.transition = this.animate), !this.markerContent_) { | |
213 | this.markerContent_ = document.createElement("DIV"), this.markerWrapper_.appendChild(this.markerContent_); | |
214 | var r = this; | |
215 | google.maps.event.addDomListener(this.markerContent_, "click", function(e) { | |
216 | google.maps.event.trigger(r, "click", e) | |
217 | }), google.maps.event.addDomListener(this.markerContent_, "mouseover", function() { | |
218 | google.maps.event.trigger(r, "mouseover") | |
219 | }), google.maps.event.addDomListener(this.markerContent_, "mouseout", function() { | |
220 | google.maps.event.trigger(r, "mouseout") | |
221 | }), $(this.markerContent_).data() && ($(this.markerContent_).data().id = this.get("id")) | |
222 | } | |
223 | this.ready_ = !0, this.content_changed(), this.draggable_changed(), this.setStates_(); | |
224 | var i = this.getPanes(); | |
225 | i ? this.bulkAdd && t ? e.map_fragment && (e.map_fragment.appendChild(this.markerWrapper_), e.map_pane = i.overlayMouseTarget) : i.overlayMouseTarget.appendChild(this.markerWrapper_) : (e.map_fragment.appendChild(this.markerWrapper_), e.map_pane = i.overlayMouseTarget), google.maps.event.trigger(this, "ready") | |
226 | }, r.prototype.onAdd = r.prototype.onAdd, r.prototype.draw = function() { | |
227 | if (this.ready_ && !this.dragging_) { | |
228 | var e = this.getProjection(); | |
229 | if (e) { | |
230 | var t = this.get("position"), | |
231 | r = e.fromLatLngToDivPixel(t), | |
232 | i = this.getOffset_(); | |
233 | $.fn.tooltip && $(this.markerContent_).tooltip("destroy").tooltip({ | |
234 | container: ".map-view", | |
235 | html: !0 | |
236 | }), this.markerWrapper_.style.top = r.y + i.height + "px", this.markerWrapper_.style.left = r.x + i.width + "px" | |
237 | } | |
238 | } | |
239 | }, r.prototype.draw = r.prototype.draw, r.prototype.onRemove = function() { | |
240 | this.markerWrapper_ && this.markerWrapper_.parentNode && ($.fn.tooltip && $(this.markerContent_).tooltip("destroy"), this.markerWrapper_.parentNode.removeChild(this.markerWrapper_), this.markerWrapper_.style.display = "none"), this.removeDragListeners_() | |
241 | }, r.prototype.onRemove = r.prototype.onRemove; | |
242 | var l = { | |
243 | TOP_LEFT: 1, | |
244 | TOP: 2, | |
245 | TOP_RIGHT: 3, | |
246 | LEFT: 4, | |
247 | MIDDLE: 5, | |
248 | RIGHT: 6, | |
249 | BOTTOM_LEFT: 7, | |
250 | BOTTOM: 8, | |
251 | BOTTOM_RIGHT: 9 | |
252 | }; | |
253 | return window.RichMarkerPosition = l, r | |
254 | }), define("backbone/helpers/maps_util", ["backbone/helpers/maps", "backbone/assets", "backbone/helpers/richmarker"], function(e, t, r) { | |
255 | return { | |
256 | Maps: e, | |
257 | RichMarker: r | |
258 | } | |
259 | }), | |
260 | /* ========================================================== | |
261 | * bootstrap-carousel.js v2.3.2 | |
262 | * http://twitter.github.com/bootstrap/javascript.html#carousel | |
263 | * ========================================================== | |
264 | * Copyright 2012 Twitter, Inc. | |
265 | * | |
266 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
267 | * you may not use this file except in compliance with the License. | |
268 | * You may obtain a copy of the License at | |
269 | * | |
270 | * http://www.apache.org/licenses/LICENSE-2.0 | |
271 | * | |
272 | * Unless required by applicable law or agreed to in writing, software | |
273 | * distributed under the License is distributed on an "AS IS" BASIS, | |
274 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
275 | * See the License for the specific language governing permissions and | |
276 | * limitations under the License. | |
277 | * ========================================================== */ | |
278 | ! function(e) { | |
279 | "use strict"; | |
280 | e(function() { | |
281 | e.support.transition = function() { | |
282 | var e = function() { | |
283 | var e, t = document.createElement("bootstrap"), | |
284 | r = { | |
285 | WebkitTransition: "webkitTransitionEnd", | |
286 | MozTransition: "transitionend", | |
287 | OTransition: "oTransitionEnd otransitionend", | |
288 | transition: "transitionend" | |
289 | }; | |
290 | for (e in r) | |
291 | if (void 0 !== t.style[e]) return r[e] | |
292 | }(); | |
293 | return e && { | |
294 | end: e | |
295 | } | |
296 | }() | |
297 | }) | |
298 | }(window.jQuery), ! function(e) { | |
299 | "use strict"; | |
300 | var t = function(t, r) { | |
301 | this.$element = e(t), this.$indicators = this.$element.find(".carousel-indicators"), this.options = r, "hover" == this.options.pause && this.$element.on("mouseenter", e.proxy(this.pause, this)).on("mouseleave", e.proxy(this.cycle, this)) | |
302 | }; | |
303 | t.prototype = { | |
304 | cycle: function(t) { | |
305 | return t || (this.paused = !1), this.interval && clearInterval(this.interval), this.options.interval && !this.paused && (this.interval = setInterval(e.proxy(this.next, this), this.options.interval)), this | |
306 | }, | |
307 | getActiveIndex: function() { | |
308 | return this.$active = this.$element.find(".item.active"), this.$items = this.$active.parent().children(), this.$items.index(this.$active) | |
309 | }, | |
310 | to: function(t) { | |
311 | var r = this.getActiveIndex(), | |
312 | i = this; | |
313 | if (!(t > this.$items.length - 1 || 0 > t)) return this.sliding ? this.$element.one("slid", function() { | |
314 | i.to(t) | |
315 | }) : r == t ? this.pause().cycle() : this.slide(t > r ? "next" : "prev", e(this.$items[t])) | |
316 | }, | |
317 | pause: function(t) { | |
318 | return t || (this.paused = !0), this.$element.find(".next, .prev").length && e.support.transition.end && (this.$element.trigger(e.support.transition.end), this.cycle(!0)), clearInterval(this.interval), this.interval = null, this | |
319 | }, | |
320 | next: function() { | |
321 | return this.sliding ? void 0 : this.slide("next") | |
322 | }, | |
323 | prev: function() { | |
324 | return this.sliding ? void 0 : this.slide("prev") | |
325 | }, | |
326 | slide: function(t, r) { | |
327 | var i, s = this.$element.find(".item.active"), | |
328 | n = r || s[t](), | |
329 | o = this.interval, | |
330 | a = "next" == t ? "left" : "right", | |
331 | l = "next" == t ? "first" : "last", | |
332 | h = this; | |
333 | if (this.sliding = !0, o && this.pause(), n = n.length ? n : this.$element.find(".item")[l](), i = e.Event("slide", { | |
334 | relatedTarget: n[0], | |
335 | direction: a | |
336 | }), !n.hasClass("active")) { | |
337 | if (this.$indicators.length && (this.$indicators.find(".active").removeClass("active"), this.$element.one("slid", function() { | |
338 | var t = e(h.$indicators.children()[h.getActiveIndex()]); | |
339 | t && t.addClass("active") | |
340 | })), e.support.transition && this.$element.hasClass("slide") && n && s) { | |
341 | if (this.$element.trigger(i), i.isDefaultPrevented()) return; | |
342 | n.addClass(t), n[0].offsetWidth, s.addClass(a), n.addClass(a), this.$element.one(e.support.transition.end, function() { | |
343 | n.removeClass([t, a].join(" ")).addClass("active"), s.removeClass(["active", a].join(" ")), h.sliding = !1, setTimeout(function() { | |
344 | h.$element.trigger("slid") | |
345 | }, 0) | |
346 | }) | |
347 | } else { | |
348 | if (this.$element.trigger(i), i.isDefaultPrevented()) return; | |
349 | s.removeClass("active"), n.addClass("active"), this.sliding = !1, this.$element.trigger("slid") | |
350 | } | |
351 | return o && this.cycle(), this | |
352 | } | |
353 | } | |
354 | }; | |
355 | var r = e.fn.carousel; | |
356 | e.fn.carousel = function(r) { | |
357 | return this.each(function() { | |
358 | var i = e(this), | |
359 | s = i.data("carousel"), | |
360 | n = e.extend({}, e.fn.carousel.defaults, "object" == typeof r && r), | |
361 | o = "string" == typeof r ? r : n.slide; | |
362 | s || i.data("carousel", s = new t(this, n)), "number" == typeof r ? s.to(r) : o ? s[o]() : n.interval && s.pause().cycle() | |
363 | }) | |
364 | }, e.fn.carousel.defaults = { | |
365 | interval: 5e3, | |
366 | pause: "hover" | |
367 | }, e.fn.carousel.Constructor = t, e.fn.carousel.noConflict = function() { | |
368 | return e.fn.carousel = r, this | |
369 | }, e(document).on("click.carousel.data-api", "[data-slide], [data-slide-to]", function(t) { | |
370 | var r, i, s = e(this), | |
371 | n = e(s.attr("data-target") || (r = s.attr("href")) && r.replace(/.*(?=#[^\s]+$)/, "")), | |
372 | o = e.extend({}, n.data(), s.data()); | |
373 | n.carousel(o), (i = s.attr("data-slide-to")) && n.data("carousel").pause().to(i).cycle(), t.preventDefault() | |
374 | }) | |
375 | }(window.jQuery), define("backbone/bootstrap/carousel", ["jquery"], function() {}), | |
376 | function() { | |
377 | null == window.JST && (window.JST = {}), window.JST["website/contact_view"] = function(e) { | |
378 | return function() { | |
379 | var e, t, r, i, s, n, o, a, l, h, _, p, d, c; | |
380 | if (t = function(e) { | |
381 | return ("" + e).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/'/g, "'").replace(/\//g, "/").replace(/"/g, """) | |
382 | }, e = function(e) { | |
383 | switch (e) { | |
384 | case null: | |
385 | case void 0: | |
386 | return ""; | |
387 | case !0: | |
388 | case !1: | |
389 | return "\x93" + e; | |
390 | default: | |
391 | return e | |
392 | } | |
393 | }, r = [], r.push("<div class='modal-close'>\n<i class='icon icon-close'></i>\n</div>\n<div class='" + ["body-container", "clearfix", "" + t(e(this.service))].sort().join(" ").replace(/^\s+|\s+$/g, "") + "'>"), this.property_details && (r.push("<div class='property-container' style=\"background-image: url('" + t(e(this.property_details.image_url_content)) + "')\">\n<div class='overlay'></div>\n<div class='property-info'>\n<div class='info-container'>"), r.push("pg" === this.service ? "<div class='property-id'>PG id: " + this.property_details.id + "</div>" : "serviced-apartments" === this.service ? "<div class='property-id'>Serviced Apartment id: " + this.property_details.id + "</div>" : "<div class='property-id'>Flat id: " + this.property_details.id + "</div>"), "pg" === this.service ? (r.push("<div class='property-type'>"), this.property_details.apartment_type && r.push("<span class='apartment-type'>PG For " + this.property_details.available_for_type + "</span>"), r.push("</div>")) : "serviced-apartments" === this.service ? (r.push("<div class='property-type'>\n<span class='apartment-type'>"), r.push("" + t(e(this.get_apartment_full_name_for_serviced_apartments(this.apartment_sharing_types, this.apartment_type)))), r.push("</span>\n</div>")) : (r.push("<div class='property-type'>"), this.property_details.apartment_type && r.push("<span class='apartment-type'>" + this.property_details.apartment_type + "</span>"), this.property_details.apartment_type && this.property_details.furnish_type && r.push("<span>,</span>"), this.property_details.furnish_type && r.push("<span class='furnish-type'>" + this.property_details.furnish_type + "</span>"), this.property_details.property_type && !this.property_details.furnish_type && r.push("<span class='furnish-type'>" + this.property_details.property_type + "</span>"), r.push("</div>")), this.property_details.locality && r.push("<div class='property-address'>\n<span class='street-info'>" + this.property_details.locality + "</span>\n</div>"), d = !1, "serviced-apartments" === this.service ? (h = this.get_apartment_display_tariff_serviced_apartments(this.property_details.apartment_tariff_info, this.property_details.bedrooms_info, this.property_details.min_tariff, this.property_details.formatted_min_tariff), d = !0) : (this.property_details.formatted_rent || this.property_details.formatted_price) && (h = this.property_details.formatted_rent || this.property_details.formatted_price, d = !0), d && (r.push("<div class='property-price'>\n\x91<i class='icon icon-rupee'></i>\x92\n<span class='price-info'>" + h + "</span>"), "serviced-apartments" === this.service && r.push(1 === this.property_details.apartment_sharing_types.length && 1 === this.property_details.apartment_sharing_types[0] ? "<span class='per-room'>\nfull apt.\n</span>" : "<span class='per-room'>\nper room\n</span>"), r.push("</div>")), "serviced-apartments" !== this.service && (r.push("<div class='report-container'>\n<hr>\n<div class='not-reported'>"), "pg" === this.service ? r.push("<div class='report-line'>PG already full?</div>") : "rent" === this.service && r.push("Apartment" === this.property_details.property_type ? "<div class='report-line'>Flat already taken?</div>" : "<div class='report-line'>House already taken?</div>"), r.push("<div class='bordered btn report-btn report-gone small'>\n<i class='icon icon-flag-filled'></i>\n<span class='text'>Report</span>\n</div>\n</div>\n<div class='reported'>\n<div class='report-line'>\n<i class='icon icon-tick-circle'></i>\nThanks for reporting.\n</div>\n<span class='text undo-report'>\nUndo\n</span>\n</div>\n</div>")), r.push("</div>\n</div>\n</div>")), r.push("<div class='person-container'>\n<div class='person-container-elem'>"), c = "more", this.contact_persons && 1 === this.contact_persons.length && (c = "one"), r.push("<div class='" + ["persons-info", "" + t(e(c))].sort().join(" ").replace(/^\s+|\s+$/g, "") + "'>\n<div class='carousel person-carousel slide'>\n<div class='carousel-navigation prev-carousel'>\n<i class='icon icon-arrow-left'></i>\n</div>\n<div class='carousel-navigation next-carousel'>\n<i class='icon icon-arrow-right'></i>\n</div>\n<div class='carousel-inner'>"), s = 0, this.contact_persons) | |
394 | for (_ = this.contact_persons, n = 0, o = _.length; o > n; n++) a = _[n], l = a.id, s++, i = "", 1 === s && (i = "active"), r.push("<div class='" + ["item", "person-item", "clearfix", "" + t(e(i))].sort().join(" ").replace(/^\s+|\s+$/g, "") + "' data-id='" + t(e(l)) + "'>"), r.push("Project" === a.type ? "<div class='person-image-container' style=\"background-image: url('" + t(e(a.thumb_url)) + "')\"></div>" : "mystery-man" === a.image_url_content ? "<div class='mystery-man person-image-container'></div>" : "<div class='person-image-container' style=\"background-image: url('" + t(e(a.image_url_content)) + "')\"></div>"), r.push("<div class='person-details-container'>\n<div class='person-name'>"), r.push(a.profile_url ? "<a class='name' href='" + t(e(a.profile_url)) + "' target='_blank' data-bypass>" + a.name + "</a>" : "<span class='name'>" + a.name + "</span>"), r.push("<a class='verified-tag' data-original-title='Verified'>\n<i class='icon icon-tick-circle'></i>\n</a>\n</div>"), (a.profile_type || a.type || a.contact_person_id) && ("serviced-apartments" === this.service ? r.push("<span class='profile-type'>Host</span>") : "Owner" === a.profile_type || "Owner" === a.type ? r.push("<span class='profile-type'>Landlord</span>") : "Broker" === a.profile_type || "Agent" === a.type ? r.push("<span class='profile-type'>Agent</span>") : a.profile_type ? r.push("<span class='profile-type'>" + a.profile_type + "</span>") : a.type ? r.push("<span class='profile-type'>" + a.type + "</span>") : 1 === a.contact_person_id ? r.push("<span class='profile-type'>Agent</span>") : 2 === a.contact_person_id ? r.push("<span class='profile-type'>Owner</span>") : 3 === a.contact_person_id && r.push("<span class='profile-type'>Builder</span>")), a.number && r.push("<div class='person-number'>\n<span class='number'>" + a.number + "</span>\n</div>"), r.push("</div>\n</div>"); | |
395 | return r.push("</div>\n</div>\n</div>\n<div class='forms-container not-sent'>\n<div class='refer-container'>\n<div class='refer-form'>\n<div class='text'>Your Landlord's Information</div>\n<form class='landlord-refer-form' autocomplete='off' novalidate>\n<div class='form-element'>\n<div class='placeholder'>Name</div>\n<input class='input name-ll' id='inputLandloardName' required name='name'>\n</div>\n<div class='form-element'>\n<div class='placeholder'>Phone</div>\n<input class='input phone-ll' id='inputLandlordContact' required name='phone' type='tel'>\n</div>\n<div class='form-field sent-button-container'>\n<input class='btn primary submit-button' type='submit' value='Refer Landlord'>\n</div>\n</form>\n</div>\n</div>\n<div class='not-sent send-container'>\n<div class='user-form'>\n<form class='contact-form' autocomplete='on' novalidate>\n<div class='form-element'>\n<div class='placeholder'>Name</div>\n<input class='input name' id='inputName' required name='name'>\n</div>\n<div class='form-element'>\n<div class='placeholder'>Phone</div>\n<input class='input phone' id='inputContact' required name='phone' type='tel'>\n</div>\n<div class='form-element'>\n<div class='placeholder'>Email</div>\n<input class='email input' id='inputEmail' required name='email' type='email'>\n</div>\n<div class='form-field sent-button-container'>\n<input class='btn primary submit-button' type='submit' value='Send Contact Information'>\n</div>\n</form>\n</div>\n</div>\n<div class='on-success'>\n<div class='success-message-container'>\n<div class='message-sent-illustration'></div>\n<div class='message-sent-text'>Your message has been successfully sent.</div>\n</div>"), p = this.logged_in ? "refer" : "", r.push("<div class='" + ["login-options-container", "" + t(e(p))].sort().join(" ").replace(/^\s+|\s+$/g, "") + "'>"), r.push(this.show_ra_banner ? "<div class='container-box'>\n<h3>Online Rental Agreements</h3>\n<div class='ra-text'>\n<div class='rental-agreement'></div>\n<div class='text-container'>\n<div class=''>Customized Online.</div>\n<div class=''>Delivered to your doorstep.</div>\n</div>\n</div>\n<a class='btn explore-ra h-track secondary' href='/in/rental-agreements/' target='_blank' data-bypass data-category='Services selection' data-action='Selected rental-agreements' data-label='{\"from\": \"contact_request_form\", \"city_id\": " + this.city_id + "}'>Explore Now</a>\n</div>" : this.logged_in ? "<div class='refer-box'>\n<div class='login-text'>\n<div class='signup-txt'>Moving out of a rented home? Help your landlord find a new tenant.</div>\n</div>\n<div class='landlord-refer-btn'>\n<div class='btn primary refer-ll-btn'>\n<text>Refer Landlord</text>\n</div>\n</div>\n</div>\n<div class='login-signup-btn view-all-props'>\n<a class='btn contact-all-btn primary' href='/user-profile/messaged/' target='_blank'>\n<text>View All Contacted Properties</text>\n</a>\n</div>" : "<div class='login-text'>\n<div class='signup-txt'>Sign up to keep track of all contacted properties.</div>\n<div class='minute-txt'>It takes less than a minute.</div>\n</div>\n<div class='login-signup-btn'>\n<div class='btn primary signup-btn'>\n<text>Sign up now</text>\n</div>\n</div>"), r.push("</div>\n</div>\n</div>\n</div>"), "rent" === this.service && (r.push("<div class='contact cross-product-elem ra'>"), r.push("" + e(this.render("website/cross_product", { | |
396 | type: "ra", | |
397 | heading: "Explore Online <br> Rental Agreement", | |
398 | subheading: "", | |
399 | url: "/in/rental-agreements/", | |
400 | data_bypass: "true" | |
401 | }))), r.push("</div>")), "buy" === this.service && (r.push("<div class='contact cross-product-elem hl'>"), r.push("" + e(this.render("website/cross_product", { | |
402 | type: "hl", | |
403 | heading: "Need a Home Loan?", | |
404 | subheading: "Compare and Apply online.", | |
405 | url: "/in/home-loans/", | |
406 | data_bypass: "true", | |
407 | from: "buy" | |
408 | }))), r.push("</div>")), r.push("</div>\n</div>"), r.join("\n").replace(/\s([\w-]+)='\x93true'/gm, " $1").replace(/\s([\w-]+)='\x93false'/gm, "").replace(/\s(?:id|class)=(['"])(\1)/gm, "").replace(/[\s\n]*\u0091/gm, "").replace(/\u0092[\s\n]*/gm, "") | |
409 | }.call(window.HAML.context(e)) | |
410 | } | |
411 | }.call(this), define("backbone/templates/website/_contact_view", function() {}), | |
412 | function() { | |
413 | null == window.JST && (window.JST = {}), window.JST["website/cross_product"] = function(e) { | |
414 | return function() { | |
415 | var e, t, r, i, s; | |
416 | return t = function(e) { | |
417 | return ("" + e).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/'/g, "'").replace(/\//g, "/").replace(/"/g, """) | |
418 | }, e = function(e) { | |
419 | switch (e) { | |
420 | case null: | |
421 | case void 0: | |
422 | return ""; | |
423 | case !0: | |
424 | case !1: | |
425 | return "\x93" + e; | |
426 | default: | |
427 | return e | |
428 | } | |
429 | }, r = [], i = !1, s = "", "true" === this.data_bypass && (i = !0, s = "_blank"), "iref" === this.type && "np" === this.from ? this.href = this.href + "?utm_source=Housing.com&utm_medium=New%20Property%20Page%20(ad)&utm_campaign=Link" : "iref" === this.type && "buy" === this.from && (this.href = this.href + "?utm_source=Housing.com&utm_medium=Buy%20Page%20(ad)&utm_campaign=Link"), r.push("<a class='" + ["cross-product-card", "service-banner-btn", "h-track", "" + t(e(this.type))].sort().join(" ").replace(/^\s+|\s+$/g, "") + "' href='" + t(e(this.url)) + "' data-bypass='" + t(e(i)) + "' target='" + t(e(s)) + "' data-category='promoted-entity' data-action='" + t(e(this.type)) + "' data-label='{\"element\":\"seed_element\"}'>\n<div class='header-links-elem' title='" + t(e(this.subheading)) + "'>\n<span class='" + ["product-icon", "" + t(e(this.type))].sort().join(" ").replace(/^\s+|\s+$/g, "") + "'></span>\n<span class='info-elem'>\n<span>" + this.heading + "</span>\n<br>\n<p class='color-grey text'>" + this.subheading + "</p>\n</span>\n<span class='next-arrow'>\n<i class='icon icon-arrow-right'></i>\n</span>\n</div>\n</a>"), r.join("\n").replace(/\s([\w-]+)='\x93true'/gm, " $1").replace(/\s([\w-]+)='\x93false'/gm, "").replace(/\s(?:id|class)=(['"])(\1)/gm, "") | |
430 | }.call(window.HAML.context(e)) | |
431 | } | |
432 | }.call(this), define("backbone/templates/website/_cross_product", function() {}), | |
433 | function() { | |
434 | define("backbone/helpers/smarty", ["backbone/assets"], function(e) { | |
435 | var t; | |
436 | return t = function(e, t) { | |
437 | return this.element = e, this.options = $.extend({ | |
438 | onfocus: null, | |
439 | onblur: null, | |
440 | select_key: !0, | |
441 | mature: !0, | |
442 | refreshMaturity: !0, | |
443 | tooltips: !0 | |
444 | }, t), this.listeners = [], this.common_events(), this.types = { | |
445 | select: { | |
446 | selector: "[type=select]" | |
447 | }, | |
448 | numeric: { | |
449 | selector: ".numeric" | |
450 | } | |
451 | }, this.refresh(), this | |
452 | }, $.fn.smarty = function(e, r) { | |
453 | return this.each(function() { | |
454 | var i, s; | |
455 | return s = $(this), i = s.data("smarty"), "string" != typeof e ? i ? i.refresh() : (e = $.extend($.fn.smarty.defaults, "object" == typeof e && e), i = new t(s, e), s.data("smarty", i), i) : i ? i[e]({ | |
456 | target: r | |
457 | }) : void 0 | |
458 | }) | |
459 | }, t.prototype = { | |
460 | common_events: function() { | |
461 | return this.on("focus", this.focus, !0), this.on("blur", this.blur, !0), this.on("input", this.input, !0), this.on("change", this.change, !0), this.on("click", ".form-element", this.intercept_click), this.on("mouseover", ".input-helper", function(e) { | |
462 | return $(e.currentTarget).hide() | |
463 | }) | |
464 | }, | |
465 | other_events: function() { | |
466 | var e, t, r, i, s; | |
467 | e = this.element.find(".form-element > .input"), r = this.types, i = []; | |
468 | for (s in r) | |
469 | if (t = r[s], t.present) i.push(void 0); | |
470 | else { | |
471 | if (!e.filter(t.selector).length && !this.options[s + "_events"]) continue; | |
472 | t.present = !0, i.push(this[s + "_events"]()) | |
473 | } | |
474 | return i | |
475 | }, | |
476 | select_events: function() { | |
477 | return this.on("click", ".input[type=select]", this.select_reveal), this.on("mouseover", ".option", this.select_hover), this.on("click", ".option", this.select_option), this.on("mousedown", ".select", this.select_down), this.options.select_key ? (this.on("keydown", "input[type=select]", function(e) { | |
478 | return -1 !== [13, 38, 40].indexOf(e.which) ? e.preventDefault() : void 0 | |
479 | }), this.on("keyup", "input[type=select]", this.select_key)) : void 0 | |
480 | }, | |
481 | numeric_events: function() { | |
482 | return this.on("click", ".plus-btn", this.numeric_plus), this.on("click", ".minus-btn", this.numeric_minus) | |
483 | }, | |
484 | focus: function(e) { | |
485 | var t; | |
486 | return t = $(e.target.parentNode), t.addClass("focused"), e.relatedTarget && "string" == typeof e.target.getAttribute("autoreveal") && "select" === e.target.getAttribute("type") && t.addClass("open"), "function" == typeof this.options.onfocus ? this.options.onfocus.call(this, e) : void 0 | |
487 | }, | |
488 | intercept_click: function(e) { | |
489 | return /input/.test(e.target.className) ? void 0 : $(e.currentTarget).children(".input").focus() | |
490 | }, | |
491 | blur: function(e) { | |
492 | var t, r; | |
493 | if (!this.selectdown) return this.input(e), r = $(e.target.parentNode), t = "focused", r.hasClass("open") && (t += " open"), r.removeClass(t), setTimeout(function(e) { | |
494 | return function() { | |
495 | return e.options.mature && !r.hasClass("focused") ? r.addClass("mature") : void 0 | |
496 | } | |
497 | }(this), 50), "function" == typeof this.options.onblur ? this.options.onblur.call(this, e) : void 0 | |
498 | }, | |
499 | input: function(e) { | |
500 | var t, r, i, s, n, o, a, l, h, _, p, d, c; | |
501 | if (r = e.target, t = $(r), a = $(r.parentNode), p = r.getAttribute("type"), /checkbox|radio/.test(p)) return void(r.required && (a[0].querySelector(".input:checked") ? a.removeClass("invalid") : a.addClass("invalid"))); | |
502 | if (c = t.val(), _ = t.prop("required"), r.readOnly) d = c || !_; | |
503 | else if (r.validity) { | |
504 | if (d = r.validity.valid, !d) { | |
505 | i = !0, h = r.validity; | |
506 | for (s in h) | |
507 | if (n = h[s], "valid" !== s && "valueMissing" !== s && n) { | |
508 | i = !1; | |
509 | break | |
510 | } | |
511 | d = i && !_ | |
512 | } | |
513 | } else d = !0, l = r.pattern, _ && !c && (d = !1), d && l && (d = new RegExp(l).test(c)); | |
514 | if (d && a.hasClass("invalid") ? a.removeClass("invalid") : d || a.addClass("invalid"), c && !a.hasClass("filled") ? (a.addClass("filled"), this.options.tooltips && a.find(".helper-text").html(this.helptext(r))) : c || r.getAttribute("placeholder") || (a.removeClass("filled"), this.options.tooltips && a.find(".helper-text").html(this.helptext(r))), "TEXTAREA" === r.tagName) { | |
515 | if (o = /\n/.test(c), !o && a.hasClass("multiline")) return a.removeClass("multiline"); | |
516 | if (o) return a.addClass("multiline") | |
517 | } | |
518 | }, | |
519 | helptext: function(e) { | |
520 | var t, r, i; | |
521 | return r = e.getAttribute("type"), i = e.value, t = e.getAttribute("data-helptext"), t ? t : "select" === r ? "Please select an item in the list." : i ? "tel" === r ? "Please enter a valid 10 digit phone number." : "name" === r ? "Please enter valid name, like Rajesh Kumar" : "email" === r ? "Please enter valid email address, like you@example.com" : "ccexp" === r ? "Please enter valid expiry date, like 11/17" : "zip" === r ? "Please enter valid zip code, like 400072" : "Please enter valid input." : "Please fill out this field." | |
522 | }, | |
523 | validations: { | |
524 | name: e.validations.name_validation_pattern, | |
525 | email: e.validations.email_validation_pattern, | |
526 | phone: e.validations.phone_validation_pattern, | |
527 | creditcard: "^([0-9]{4} ){3}[0-9]{4}$", | |
528 | zip: "^[0-9]{6}$", | |
529 | ccexp: "^[0-9]{2}/[0-9]{2}$" | |
530 | }, | |
531 | change: function(e) { | |
532 | var t, r; | |
533 | return t = e.target, r = t.type, "radio" === r && (t.checked = !0), this.input(e), "function" == typeof this.options.onchange ? this.options.onchange.call(this, e) : void 0 | |
534 | }, | |
535 | on: function() { | |
536 | var e, t, r, i, s; | |
537 | return e = arguments[0], r = arguments[arguments.length - 1], s = "string" == typeof arguments[1] ? arguments[1] : ".input", r === !0 ? (t = arguments[arguments.length - 2], i = $.proxy(function(e) { | |
538 | return $(e.target).is(s) ? t.apply(this, arguments) : void 0 | |
539 | }, this), this.element[0].addEventListener(e, i, !0), this.listeners.push([e, i, !0])) : (i = $.proxy(r, this), this.element.on(e, s, i), this.listeners.push([e, s, i])) | |
540 | }, | |
541 | bye: function() { | |
542 | return this.listeners.forEach(function(e) { | |
543 | return function(t) { | |
544 | return t[2] === !0 ? e.element[0].removeEventListener(t[0], t[1], !0) : e.element.off(t[0], t[1], t[2]) | |
545 | } | |
546 | }(this)) | |
547 | }, | |
548 | select_filterable: function(e) { | |
549 | return !e.readOnly && typeof e.getAttribute(!0) | |
550 | }, | |
551 | select_reveal: function(e) { | |
552 | var t, r, i, s, n; | |
553 | return r = e.target, "function" == typeof r.select && r.select(), s = $(r.parentNode), s.toggleClass("open"), i = s.find(".input"), "string" == typeof i.attr("multiselectwithall") && (t = s.find(".select-outer"), n = t[0].getBoundingClientRect(), n.height + n.top + 10 > window.innerHeight ? t.addClass("select-outer-top") : t.removeClass("select-outer-top")), this.select_filterable(r) && this.select_filter(s.find(".option"), r.value), s.find(".option.hover").removeClass("hover"), s.find(".option:visible:eq(0)").addClass("hover") | |
554 | }, | |
555 | select_key: function(e) { | |
556 | var t, r, i, s, n; | |
557 | if (n = $(e.target.parentNode), s = n.find(".option"), this.select_filterable(e.target) && (this.select_filter(s, e.target.value), s = s.filter(":visible")), e.target.readOnly || n.hasClass("open") || n.addClass("open"), t = s.filter(".hover"), i = _.indexOf(s, t[0]), n.hasClass("open")) 40 === e.which ? r = i === s.length - 1 ? 0 : i + 1 : 38 === e.which ? (r = i - 1, 0 > r && (n.removeClass("open"), r = 0)) : 27 === e.which ? n.removeClass("open") : 13 === e.which && t.length && (this.select_option({ | |
558 | currentTarget: t.get(0) | |
559 | }), n.removeClass("open")); | |
560 | else if (40 === e.which) return this.select_reveal(e); | |
561 | return "number" == typeof r && this.select_hover({ | |
562 | currentTarget: s.get(r) | |
563 | }), !1 | |
564 | }, | |
565 | select_filter: function(e, t) { | |
566 | var r, i; | |
567 | return e.each(function(e, r) { | |
568 | var i; | |
569 | return i = r.textContent, e = i.toLowerCase().indexOf(t.toLowerCase()), 0 === e ? (r.innerHTML = "<strong>" + i.slice(0, t.length) + "</strong>" + i.slice(t.length, i.length), r.style.display = "block") : r.style.display = "none" | |
570 | }), i = e.filter(":visible"), r = i.filter(".hover"), r.length || (e.filter(".hover").removeClass("hover"), r = i.eq(0).addClass("hover")), r.length ? this.select_scroll(r[0]) : void 0 | |
571 | }, | |
572 | select_hover: function(e) { | |
573 | var t; | |
574 | if ((!this.js_scrolling || "mouseover" !== e.type) && (t = $(e.currentTarget).addClass("hover"), t.siblings(".hover").removeClass("hover"), "mouseover" !== e.type && t[0])) return this.js_scrolling = !0, this.select_scroll(t[0]), setTimeout(function(e) { | |
575 | return function() { | |
576 | return e.js_scrolling = !1 | |
577 | } | |
578 | }(this), 100) | |
579 | }, | |
580 | select_scroll: function(e) { | |
581 | var t, r, i; | |
582 | return r = e.parentNode, t = e.getBoundingClientRect(), i = r.getBoundingClientRect(), i.bottom < t.bottom ? r.scrollTop += t.bottom - i.bottom : i.top > t.top ? r.scrollTop -= i.top - t.top : void 0 | |
583 | }, | |
584 | select_in_multiselectwithall: function(e) { | |
585 | var t, r, i, s, n, o, a, l, h, _, p; | |
586 | if (t = $(e), i = t.closest(".form-element"), i.hasClass("filled") || i.addClass("filled"), n = i.find(".input"), "string" == typeof n.attr("multiselectwithall") && (t.toggleClass("selected"), p = t.prop("textContent"), this.options.select_key)) { | |
587 | if (_ = t.hasClass("selected"), t.hasClass("all-option") ? _ ? t.siblings(".item-option").addClass("selected") : t.siblings(".item-option").removeClass("selected") : _ && i.find(".item-option").length === i.find(".item-option.selected").length ? i.find(".all-option").addClass("selected") : i.find(".all-option").removeClass("selected"), l = "", r = [], i.find(".all-option.selected").length > 0) l = i.find(".all-option.selected").text().trim(); | |
588 | else if (i.find(".item-option.selected").length > 0) { | |
589 | for (h = i.find(".item-option.selected"), s = 0, a = h.length; a > s; s++) o = h[s], r.push(o.textContent.trim()); | |
590 | l = r.join().trim() | |
591 | } | |
592 | return n.val(l).trigger("change", t.attr("value")), this.input({ | |
593 | target: n[0] | |
594 | }) | |
595 | } | |
596 | }, | |
597 | select_option: function(e) { | |
598 | var t, r, i, s; | |
599 | return t = $(e.currentTarget), r = t.closest(".form-element"), r.hasClass("filled") || r.addClass("filled"), i = r.find(".input"), "string" == typeof i.attr("multiselectwithall") ? (this.select_in_multiselectwithall(t), r.addClass("open")) : (t.addClass("selected").siblings(".selected").removeClass("selected"), s = t.prop("textContent"), this.options.select_key && (i.val(s).trigger("change", t.attr("value")), this.input({ | |
600 | target: i[0] | |
601 | })), "string" == typeof i.attr("multiselect") ? r.addClass("open") : void 0) | |
602 | }, | |
603 | select_down: function(e) { | |
604 | var t; | |
605 | return this.selectdown = !0, t = $(e.currentTarget), $(window).one("mouseup", function(e) { | |
606 | return function(r) { | |
607 | var i, s; | |
608 | return e.selectdown = !1, s = r.target.className, (i = t.closest(".form-element").children(".input")[0]) ? t[0] === r.target ? i.focus() : e.blur({ | |
609 | target: i | |
610 | }) : void 0 | |
611 | } | |
612 | }(this)) | |
613 | }, | |
614 | numeric_plus: function(e) { | |
615 | return this.numeric_update(e, 1) | |
616 | }, | |
617 | numeric_minus: function(e) { | |
618 | return this.numeric_update(e, -1) | |
619 | }, | |
620 | numeric_update: function(e, t) { | |
621 | var r, i, s; | |
622 | return i = $(e.target), r = i.siblings(".input.numeric"), s = parseInt(r.val()) || 0, s += t, 0 > s && (s = 0), r.val(s).trigger("input"), "function" == typeof this.options.onchange ? this.options.onchange.call(this, { | |
623 | target: r | |
624 | }) : void 0 | |
625 | }, | |
626 | refresh: function() { | |
627 | return this.other_events(), this.element.find(".form-element").each(function(e) { | |
628 | return function(t, r) { | |
629 | return e.update(r) | |
630 | } | |
631 | }(this)) | |
632 | }, | |
633 | initiate: function(e, t, r) { | |
634 | var i; | |
635 | return e.data("smarty", !0), this.options.tooltips && e.append('<div class="input-helper"><div class="up-arrow"></div><div class="helper-text">' + this.helptext(t) + "</div></div>"), document.activeElement === t && e.addClass("focused"), /checkbox|radio/.test(r) && e.addClass("filled"), t.getAttribute("pattern") && !t.pattern && (t.pattern = t.getAttribute("pattern")), i = t.getAttribute("name"), i && (i = i.toLowerCase().replace(/[^a-z].*/, ""), !t.pattern && this.validations[i]) ? t.pattern = this.validations[i] : void 0 | |
636 | }, | |
637 | update: function(e) { | |
638 | var t, r, i, s, n; | |
639 | return i = e.querySelector(".input"), n = i.getAttribute("type"), t = $(e), s = "filled invalid", this.options.mature && this.options.refreshMaturity && (s += " mature"), t.removeClass(s), t.data("smarty") || this.initiate(t, i, n), /checkbox|radio/.test(n) || (i.value ? (r = "filled", this.options.mature && (r += " mature"), t.addClass(r)) : i.getAttribute("placeholder") && t.addClass("filled")), "string" == typeof $(i).attr("multiselectwithall") && (t.find(".all-option").removeClass("selected"), this.select_in_multiselectwithall(t.find(".all-option"))), this.input({ | |
640 | target: i | |
641 | }) | |
642 | } | |
643 | } | |
644 | }) | |
645 | }.call(this), | |
646 | function() { | |
647 | var e = function(e, t) { | |
648 | return function() { | |
649 | return e.apply(t, arguments) | |
650 | } | |
651 | }, | |
652 | t = function(e, t) { | |
653 | function i() { | |
654 | this.constructor = e | |
655 | } | |
656 | for (var s in t) r.call(t, s) && (e[s] = t[s]); | |
657 | return i.prototype = t.prototype, e.prototype = new i, e.__super__ = t.prototype, e | |
658 | }, | |
659 | r = {}.hasOwnProperty; | |
660 | define("backbone/views/contact_view", ["backbone/assets", "backbone/bootstrap/carousel", "backbone/templates/website/_contact_view", "backbone/templates/website/_cross_product", "backbone/helpers/smarty"], function(r) { | |
661 | var i; | |
662 | return i = function(i) { | |
663 | function s() { | |
664 | return this.destroy = e(this.destroy, this), this.renderErrorTemplate = e(this.renderErrorTemplate, this), this.supress = e(this.supress, this), this.undo_report_property = e(this.undo_report_property, this), this.report_property = e(this.report_property, this), this.set_localdata = e(this.set_localdata, this), this.on_hidden = e(this.on_hidden, this), this.submitContact = e(this.submitContact, this), this.getLandlordReferred = e(this.getLandlordReferred, this), this.referLandlordSubmit = e(this.referLandlordSubmit, this), this.referLandlord = e(this.referLandlord, this), this.fetch_model_data = e(this.fetch_model_data, this), this.navigate_carousel = e(this.navigate_carousel, this), this._init_carousel = e(this._init_carousel, this), this._post_render = e(this._post_render, this), this.init_login = e(this.init_login, this), this.hide = e(this.hide, this), this.show = e(this.show, this), this._render = e(this._render, this), this.initialize = e(this.initialize, this), s.__super__.constructor.apply(this, arguments) | |
665 | } | |
666 | return t(s, i), s.prototype.template = window.JST["website/contact_view"], s.prototype.el = "#contactModal", s.prototype.events = { | |
667 | "submit .contact-form": "submitContact", | |
668 | "click .login-signup-btn": "init_login", | |
669 | "click .carousel-navigation": "navigate_carousel", | |
670 | "click .report-gone": "report_property", | |
671 | "click .undo-report": "undo_report_property", | |
672 | "click .view-all-props": "hide", | |
673 | "click .landlord-refer-btn": "referLandlord", | |
674 | "submit .refer-form": "referLandlordSubmit" | |
675 | }, s.prototype.initialize = function() { | |
676 | var e; | |
677 | return this.fetchXhr = null, e = this.options.fetch_required || !1, this.options.$el && (this.$el = this.options.$el), this.$el.addClass("contact-modal-form"), !this.options.service && r.selected_service && (this.options.service = r.selected_service.get("url_name")), e && this.options.model ? this.fetch_model_data() : this._render(), this.reported_property_id = null | |
678 | }, s.prototype._render = function() { | |
679 | var e, t, i, s, n, o, a, l; | |
680 | if (this.model && (this.property_details = this.model.toJSON()), !this.property_details && this.options.model && (this.property_details = this.options.model.toJSON()), this.model && this.model.get("contact_persons") && (this.contact_person_obj = this.property_details.contact_persons), !this.property_details && this.options.property_details && (this.property_details = this.options.property_details), this.contact_person_obj || (this.contact_person_obj = this.options.contact_persons), this.property_details && !this.property_details.image_url_content && (this.property_details.thumb_url_new || this.property_details.thumb_url) && ("rent" === this.options.service ? this.property_details.image_url_content = r.Util.get_image_url(this.property_details.thumb_url_new, "large") : "pg" === this.options.service ? this.property_details.image_url_content = this.property_details.thumb_url.replace("thumb", "large").replace("small_", "large") : "serviced-apartments" === this.options.service && (this.property_details.image_url_content = this.property_details.thumb_url.replace("version", "260x480"))), this.property_details && !this.property_details.image_url_content && (this.property_details.image_url_content = r.Images.pseudo), this.contact_person_obj && this.contact_person_obj.length) | |
681 | for (a = this.contact_person_obj, t = 0, i = a.length; i > t; t++) n = a[t], (n.image_url_new && "" !== n.image_url_new || n.thumb_url_new && "" !== n.thumb_url_new) && ("Agent" === n.type || this.options.uv_agent) ? (n.image_url_new && (n.image_url_content = n.image_url_new.replace("version", "thumb")), n.thumb_url_new && (n.image_url_content = n.thumb_url_new.replace("version", "thumb"))) : n.thumb_path_new && "agents" === this.options.service ? n.image_url_content = n.thumb_path_new.replace("version", "thumb") : n.image_url_new && "" !== n.image_url_new && "rent" === this.options.service ? n.image_url_content = n.image_url_new.replace("version", "thumb") : n.image_url && "" !== n.image_url && "pg" === this.options.service ? n.image_url_content = n.image_url : n.image_url_content && "" !== n.image_url || (n.image_url_content = "mystery-man"); | |
682 | return s = !1, r.Login && r.Login.logged_in && (s = !0), "undefined" == typeof this.options.routing && (this.options.routing = !0), e = null, r.filters && r.filters.get("loct") && ("poly" === r.filters.get("loct") && r.polygon_data.getItem(r.filters.get("poly").id) ? e = r.polygon_data.getItem(r.filters.get("poly").id).city_id : "est" === r.filters.get("loct") && r.establishment_data.getItem(r.filters.get("est").id) && (e = r.establishment_data.getItem(r.filters.get("est").id).city_id)), this.city_id = e, l = !1, o = r.services.findWhere({ | |
683 | url_name: "rental-agreements" | |
684 | }).get("city_ids"), e && -1 !== o.indexOf(e) && "rent" === this.options.service && (l = !0), this.$el.html(this.template({ | |
685 | property_details: this.property_details, | |
686 | contact_persons: this.contact_person_obj, | |
687 | service: this.options.service, | |
688 | logged_in: s, | |
689 | show_ra_banner: l, | |
690 | city_id: e ? e : void 0 | |
691 | })), this.contact_person_obj && this.contact_person_obj.length > 1 && this._init_carousel(), this.$el.modal({ | |
692 | show: !1, | |
693 | animation: !0, | |
694 | hiddenCallback: this.on_hidden | |
695 | }), this.form = this.$el.find(".contact-form"), this.smarty = this.form.smarty(), this.form_refer = this.$el.find(".landlord-refer-form"), this.form_refer.smarty(), this._post_render(), (r.Util.is_service("rent") || r.Util.is_service("buy") || r.Util.is_service("pg")) && $("body").is(".details-page") && r.submit_last_data && (this.submitContact(), r.submit_last_data = !1), this.options.show ? this.show() : void 0 | |
696 | }, s.prototype.show = function() { | |
697 | return this.$el.modal("show") | |
698 | }, s.prototype.hide = function() { | |
699 | return this.$el.modal("hide") | |
700 | }, s.prototype.init_login = function() { | |
701 | var e; | |
702 | return e = r.Login.logged_in ? "user-profile/contacted" : "user-login?direct_signup=true", this.$el.data("modal") && this.options.routing ? ($(document).one("route:changed", function() { | |
703 | return r.router.goto_url(e) | |
704 | }), this.$el.modal("hide")) : r.router.goto_url(e) | |
705 | }, s.prototype._post_render = function() { | |
706 | return this.set_localdata(), r.Util.prefillForm(this.$el.find(".contact-form")), this.form.smarty("refresh") | |
707 | }, s.prototype._init_carousel = function() { | |
708 | var e; | |
709 | return this.$carousel_container = this.$el.find(".person-carousel"), this.$carousel_container.carousel({ | |
710 | interval: 5e11, | |
711 | pause: "" | |
712 | }), e = Math.floor(Math.random() * this.contact_person_obj.length + 1) | |
713 | }, s.prototype.navigate_carousel = function(e) { | |
714 | if (e && this.$carousel_container) { | |
715 | if ($(e.currentTarget).hasClass("prev-carousel")) return this.$carousel_container.carousel("prev"); | |
716 | if ($(e.currentTarget).hasClass("next-carousel")) return this.$carousel_container.carousel("next") | |
717 | } | |
718 | }, s.prototype.fetch_model_data = function() { | |
719 | var e; | |
720 | return this.fetchXhr && this.fetchXhr.abort, this.model = this.options.model, this.model || (this.model = this.options.collection.getSelectedModel()), e = this, this.model.get("contact_persons") ? this._render() : this.fetchXhr = this.model.fetch({ | |
721 | success: function(t, i, s) { | |
722 | return i && i.captcha_required ? r.Util.api_captcha_reroute(this) : "INACTIVE" === i.pg_status ? e.renderErrorTemplate("This PG has been deactivated for some reason") : "OK" === i.status || 200 === s.xhr.status ? e._render() : e.renderErrorTemplate("This flat has been deactivated for some reason") | |
723 | }, | |
724 | error: function(t, r) { | |
725 | return "abort" !== r.statusText ? e.renderErrorTemplate("Network communication error. Please check your internet connection.") : void 0 | |
726 | } | |
727 | }) | |
728 | }, s.prototype.referLandlord = function() { | |
729 | return this.form_refer.smarty("refresh"), this.$el.find(".refer-container").addClass("not-sent"), this.$el.find(".forms-container").addClass("not-sent"), this.$el.find(".persons-info").hide() | |
730 | }, s.prototype.referLandlordSubmit = function(e) { | |
731 | var t, i, s, n, o; | |
732 | return this.supress(e), t = this.form_refer.find(".invalid"), t.length ? t.addClass("mature").find(".input").eq(0).focus() : r.Login.logged_in ? (o = "v2/referrals", i = { | |
733 | name: this.$el.find("input.name-ll").val(), | |
734 | phone: this.$el.find("input.phone-ll").val() | |
735 | }, s = { | |
736 | referrer_type: "ContactRequest", | |
737 | referrer_uuid: r.Login.UserData.uuid, | |
738 | referrer_name: r.Login.UserData.name | |
739 | }, n = { | |
740 | referrer_details: s, | |
741 | referral_details: i | |
742 | }, r.ajax({ | |
743 | url: r.API_BaseUrl + o, | |
744 | dataType: "json", | |
745 | data: n, | |
746 | method: "POST", | |
747 | success: function(e) { | |
748 | return function() { | |
749 | return e.$el.find(".message-sent-text").text("Thank you for referring your landlord."), e.$el.find(".refer-container").removeClass("not-sent"), e.$el.find(".forms-container").removeClass("not-sent"), e.$el.find(".login-options-container").length && e.$el.find(".login-options-container").removeClass("refer"), e.$el.find(".persons-info").hide() | |
750 | } | |
751 | }(this), | |
752 | error: function(e) { | |
753 | return function() { | |
754 | return e.$el.find(".message-sent-text").text("Thank you for referring your landlord."), e.$el.find(".refer-container").removeClass("not-sent"), e.$el.find(".forms-container").removeClass("not-sent"), e.$el.find(".persons-info").hide(), e.$el.find(".login-options-container").removeClass("refer") | |
755 | } | |
756 | }(this) | |
757 | })) : void 0 | |
758 | }, s.prototype.getLandlordReferred = function() { | |
759 | var e, t; | |
760 | return t = "v2/referrals/check_referral", r.Login.logged_in ? (e = { | |
761 | referrer_uuid: r.Login.UserData.uuid, | |
762 | referrer_type: "ContactRequest" | |
763 | }, r.ajax({ | |
764 | url: r.API_BaseUrl + t, | |
765 | dataType: "json", | |
766 | method: "GET", | |
767 | data: e, | |
768 | success: function(e) { | |
769 | return function(t, r, i) { | |
770 | return 200 === i.status ? (e.$el.find(".forms-container").removeClass("not-sent"), e.$el.find(".send-container").removeClass("not-sent")) : (e.$el.find(".forms-container").removeClass("not-sent"), e.$el.find(".send-container").removeClass("not-sent"), e.$el.find(".login-options-container").removeClass("refer")), e.$el.find(".persons-info").hide() | |
771 | } | |
772 | }(this), | |
773 | error: function(e) { | |
774 | return function(t) { | |
775 | return e.$el.find(".forms-container").removeClass("not-sent"), e.$el.find(".send-container").removeClass("not-sent"), e.$el.find(".persons-info").hide(), e.$el.find(".login-options-container").removeClass("refer"), hlog(t) | |
776 | } | |
777 | }(this) | |
778 | })) : void 0 | |
779 | }, s.prototype.submitContact = function(e) { | |
780 | var t, i, s, n, o, a, l, h, _, p; | |
781 | return this.supress(e), a = this.form.find(".invalid"), a.length ? a.addClass("mature").find(".input").eq(0).focus() : (e && (n = $(e.currentTarget)), n || (n = this.$el.find(".user-form .contact-form")), h = this.options.service, this.property_details && (o = this.property_details.id), this.contact_person_obj && this.contact_person_obj[0].property_id && (o = this.contact_person_obj[0].property_id), this.agent_id = this.$el.find(".person-item.active").data("id"), !o && this.agent_id && (o = this.agent_id), r.Track.track_contact_request_form(o, "filled_crf"), this.property_details && this.property_details.city_id && (i = this.property_details.city_id), !i && this.contact_person_obj && this.contact_person_obj.city_id && (i = this.contact_person_obj.city_id), i || (i = 1), s = { | |
782 | city_id: i, | |
783 | name: this.$el.find("input.name").val(), | |
784 | email: this.$el.find("input.email").val(), | |
785 | phone: this.$el.find("input.phone").val(), | |
786 | user_id: this.agent_id | |
787 | }, s = r.Util.sanitize(s), r.Login.logged_in && r.Login.add_phone_no(s.phone), l = this, p = "requests/" + h + "/contact", t = r.API_V2_BaseUrl, _ = { | |
788 | name: s.name, | |
789 | email: s.email, | |
790 | phone: s.phone, | |
791 | city_id: s.city_id, | |
792 | ga_id: r.Util.get_ga_uid() | |
793 | }, "serviced-apartments" === h ? _.uuid = s.user_id : _.user_id = s.user_id, r.utm_params && (_.utm_source = r.utm_params.utm_source, _.utm_medium = r.utm_params.utm_medium, _.utm_campaign = r.utm_params.utm_campaign, _.utm_content = r.utm_params.utm_content), _.service_object_id = "agents" === h ? s.user_id : o, r.ajax({ | |
794 | url: t + p, | |
795 | dataType: "json", | |
796 | method: "POST", | |
797 | data: _, | |
798 | success: function(e) { | |
799 | return function(t) { | |
800 | return "OK" === t.status ? (o = o, e.contactRequest_id = t.result.request_id, r.Track.track_contact_request_form(o, "submitted_crf", t.result.request_id, s), r.Login.event.trigger("finished:contact_form_request"), r.Login.ContactUserDataChanged = !0, r.Util.write_localStorage("form-data", JSON.stringify(s)), r.Login.logged_in && (e.property_details && "Landlord" === e.property_details.contact_person_type || e.contact_person_obj && e.contact_person_obj.length && "Landlord" === e.contact_person_obj[0].profile_type) && ("rent" === h || "pg" === h) ? e.getLandlordReferred(e.contactRequest_id) : (e.$el.find(".forms-container").removeClass("not-sent"), e.$el.find(".send-container").removeClass("not-sent"), e.$el.find(".persons-info").hide(), e.$el.find(".login-options-container").removeClass("refer"))) : void 0 | |
801 | } | |
802 | }(this), | |
803 | error: function() { | |
804 | return function(e) { | |
805 | return hlog(e) | |
806 | } | |
807 | }(this) | |
808 | })) | |
809 | }, s.prototype.on_hidden = function() { | |
810 | return this.destroy(), this.options.routing ? r.router.routesHit <= 1 && this.property_details ? r.router.goto_url(r.router.get_url_till_flat_id(this.property_details.id), !1, !1) : r.router.routesHit <= 1 && !this.property_details ? r.router.goto_url(r.router.get_url_till_filter(), !1, !1) : window.history.back() : void 0 | |
811 | }, s.prototype.set_localdata = function() { | |
812 | var e; | |
813 | return r.Util.read_localStorage("form-data") ? (e = JSON.parse(r.Util.read_localStorage("form-data")), this.$el.find(".user-form input.name").val(e.name), this.$el.find(".user-form input.email").val(e.email), this.$el.find(".user-form input.phone").val(e.phone)) : void 0 | |
814 | }, s.prototype.report_property = function(e) { | |
815 | var t, i, s, n, o, a, l, h, _; | |
816 | return this.supress(e), _ = 1, i = {}, i.name = $("#inputName")[0] && $("#inputName")[0].value ? $("#inputName")[0].value : r.Login.UserData && r.Login.UserData.name ? r.Login.UserData.name : "from_info_window", i.email = $("#inputEmail")[0] && $("#inputEmail")[0].value ? $("#inputEmail")[0].value : r.Login.UserData && r.Login.UserData.email ? r.Login.UserData.email : "from_info_window@info_window.com", n = this, r.selected_service && (l = r.selected_service.get("url_name")), !l && this.options.service && (l = this.options.service), l && (o = r.services.where({ | |
817 | url_name: l | |
818 | }), a = o[0].get("id")), s = this.property_details.id, this.property_details.city_id && (t = this.property_details.city_id), e.preventDefault(), e.stopPropagation(), h = { | |
819 | key: r.APIKey, | |
820 | name: i.name, | |
821 | email: i.email, | |
822 | phone: $("#inputContact")[0].value, | |
823 | city_id: t, | |
824 | service_id: a, | |
825 | flat_id: s, | |
826 | type_id: _ | |
827 | }, r.Track.track_flat_flagged_in_info_window(s), n = this, $.ajax({ | |
828 | url: r.API_V1_BaseUrl + "report_error", | |
829 | type: "post", | |
830 | data: h, | |
831 | dataType: "json", | |
832 | success: function(e) { | |
833 | return hlog("error_report", e), "OK" === e.status && e.id ? (n.reported_property_id = e.id, n.$el.find(".not-reported").css("display", "none"), n.$el.find(".reported").css("display", "inline-block"), n.undo_timer = setTimeout(function() { | |
834 | return function() { | |
835 | return n.$el.find(".undo-report").remove() | |
836 | } | |
837 | }(this), 15e3)) : void 0 | |
838 | }, | |
839 | error: function() { | |
840 | return hlog("connection error") | |
841 | }, | |
842 | complete: function() { | |
843 | return hlog("report error sent ") | |
844 | } | |
845 | }), !1 | |
846 | }, s.prototype.undo_report_property = function() { | |
847 | var e; | |
848 | return e = this, $.ajax({ | |
849 | url: r.API_V1_BaseUrl + "undo_reported_error", | |
850 | type: "get", | |
851 | data: { | |
852 | key: r.APIKey, | |
853 | id: this.reported_property_id | |
854 | }, | |
855 | dataType: "json", | |
856 | success: function(t) { | |
857 | return "OK" === t.status ? (e.$el.find(".reported").css("display", "none"), e.$el.find(".not-reported").css("display", "inline-block"), clearTimeout(e.undo_timer), e.undo_timer = null, e.reported_property_id = null) : void 0 | |
858 | }, | |
859 | error: function() { | |
860 | return hlog("connection error") | |
861 | }, | |
862 | complete: function() { | |
863 | return hlog("report error sent ") | |
864 | } | |
865 | }), !1 | |
866 | }, s.prototype.supress = function(e) { | |
867 | return e ? (e.stopPropagation(), e.preventDefault()) : void 0 | |
868 | }, s.prototype.renderErrorTemplate = function(e) { | |
869 | return r.event.trigger("finished:notify:loading"), r.event.trigger("sticky:remove"), r.event.trigger("notify", { | |
870 | sticky: !1, | |
871 | type: "error", | |
872 | text: e | |
873 | }) | |
874 | }, s.prototype.destroy = function() { | |
875 | return r.contact_form_opened_for = null, this.$el.removeData().unbind().html(""), this.stopListening() | |
876 | }, s | |
877 | }(Backbone.View) | |
878 | }) | |
879 | }.call(this), | |
880 | function() { | |
881 | var e = function(e, t) { | |
882 | return function() { | |
883 | return e.apply(t, arguments) | |
884 | } | |
885 | }, | |
886 | t = function(e, t) { | |
887 | function i() { | |
888 | this.constructor = e | |
889 | } | |
890 | for (var s in t) r.call(t, s) && (e[s] = t[s]); | |
891 | return i.prototype = t.prototype, e.prototype = new i, e.__super__ = t.prototype, e | |
892 | }, | |
893 | r = {}.hasOwnProperty; | |
894 | define("backbone/views/common_map_view", ["backbone/assets", "backbone/helpers/maps_util", "backbone/views/contact_view"], function(r, i) { | |
895 | var s, n, o; | |
896 | return n = i.Maps, o = i.RichMarker, s = function(i) { | |
897 | function s() { | |
898 | return this.destroy = e(this.destroy, this), this.hide_establishment_circle = e(this.hide_establishment_circle, this), this.fit_map_to_establishment = e(this.fit_map_to_establishment, this), this.refresh_polygon = e(this.refresh_polygon, this), this.refresh_est_circle = e(this.refresh_est_circle, this), this.shortlist_mode = e(this.shortlist_mode, this), this.poi_mode = e(this.poi_mode, this), this.set_marker_visiblities = e(this.set_marker_visiblities, this), this.update_visibilities = e(this.update_visibilities, this), this.create_bounds = e(this.create_bounds, this), this.fit_map_to_polygon = e(this.fit_map_to_polygon, this), this.get_polygon_mask_path = e(this.get_polygon_mask_path, this), this.is_buffered = e(this.is_buffered, this), this.show_polygons = e(this.show_polygons, this), this.hide_polygons = e(this.hide_polygons, this), this.reset_polygons = e(this.reset_polygons, this), this.get_polygon_map_path = e(this.get_polygon_map_path, this), this.setup_polygon = e(this.setup_polygon, this), this.refresh_map_view = e(this.refresh_map_view, this), this.get_donut_paths = e(this.get_donut_paths, this), this.setup_est_circle = e(this.setup_est_circle, this), this.fit_map_to_markers = e(this.fit_map_to_markers, this), this.addAll = e(this.addAll, this), this.get_nc_name = e(this.get_nc_name, this), this.check_search_here = e(this.check_search_here, this), this.map_drag_end = e(this.map_drag_end, this), this.initialize = e(this.initialize, this), s.__super__.constructor.apply(this, arguments) | |
899 | } | |
900 | return t(s, i), s.prototype.el = ".map-view", s.prototype.initialize = function() { | |
901 | var e, t, i; | |
902 | if (r.map ? google.maps.event.trigger(r.map, "resize") : r.create_map(!0, i), this.setElement(".map-view"), r.map.add_projection_helper_layer(), this.track_mapdrag_count = 0, this.track_mapdrag_flag = !0, this.ignore_map_click = !1, this.map_drag_end_listener = n.event.addListener(r.map, "dragend", this.map_drag_end), this.listenTo(r.event, "highlighted:id", this.get_highlighted), this.listenTo(r.event, "unhighlighted:id", this.get_unhighlighted), this.listenTo(r.event, "stopped:poi_mode", this.start_map), this.listenTo(r.event, "started:poi_mode", this.stop_map), this.listenTo(r.event, "stopped:shortlist_mode", this.stopped_shortlist_mode), this.listenTo(r.event, "started:shortlist_mode", this.started_shortlist_mode), this.listenTo(this.options.shortlist, "added:shortlist", this.add_one_shortlist_marker), this.listenTo(this.options.shortlist, "removed:shortlist", this.remove_one_shortlist_marker), this.listenTo(this.options.shortlist, "cleared:shortlist", this.remove_all_shortlist_marker), this.listenTo(this.options.shortlist, "fetched:shortlist", this.first_time_add_shortlisted_markers), this.map_offset = $(".map-view").offset(), this.listenTo(this.options.filter_model, "change:nearby", this.refresh_map_elems), this.listenTo(this.options.filter_model.get("poly"), "change:buffer change", this.refresh_map_elems), this.listenTo(this.options.filter_model.get("est"), "change:radius change", this.refresh_map_elems), this.filter_model = r.filters, this.filter_model && "poly" === this.filter_model.get("loct")) { | |
903 | if (t = this.filter_model.get("poly").id, r.polygon_data.getItem(t)) return t && r.polygon_data && r.polygon_data.getItem(t) && (e = r.polygon_data.getItem(t).center), e && (i = new n.LatLng(e[1], e[0])), this.refresh_map_elems() | |
904 | } else if (this.filter_model && "est" === this.filter_model.get("loct") && (t = this.filter_model.get("est").id, r.establishment_data.getItem(t))) return t && r.establishment_data && r.establishment_data.getItem(t) && (e = r.establishment_data.getItem(t).center), e && (i = new n.LatLng(e[1], e[0])), this.refresh_map_elems() | |
905 | }, s.prototype.map_drag_end = function() { | |
906 | return this.ignore_map_click = !0, this.track_mapdrag_count++, this.track_mapdrag_count > 3 && this.track_mapdrag_flag ? (r.Track.track_gaq_event("Filters-" + r.selected_service.get("url_name"), "map_drag", {}), this.track_mapdrag_flag = !1) : void 0 | |
907 | }, s.prototype.check_search_here = function(e) {}, s.prototype.get_nc_name = function(e) { | |
908 | var t, r, i, s, n, o, a; | |
909 | for (s = [], o = 0, a = [], n = [], r = 0, i = e.length; i > r; r++) t = e[r], t.types[0] && -1 === ["street_number", "postal_code", "premise"].indexOf(t.types[0]) && -1 === t.long_name.indexOf("Unamed") && t.long_name.length > 2 && -1 === t.long_name.indexOf("Unnamed") && n.push(t.long_name), "sublocality" === t.types[0] && a.push(t.long_name); | |
910 | return s = "", n.length && a.length ? s = n[0] + ", " + a[a.length - 1] : n.length && !a.length ? s = n[0] : !n.length && a.length && (s = a[a.length - 1]), s | |
911 | }, s.prototype.addAll = function() {}, s.prototype.fit_map_to_markers = function() { | |
912 | var e, t, i, s, o, a, l, h, _, p, d; | |
913 | return (t = this.est_obj) && (e = t.getBounds()) ? (i = e.getNorthEast(), h = e.getSouthWest(), a = .2 * Math.abs(i.lat() - h.lat()), l = .2 * Math.abs(i.lng() - h.lng()), s = new n.LatLng(i.lat() - a, i.lng() - l), _ = new n.LatLng(h.lat() + a, h.lng() + l), o = new n.LatLngBounds(_, s), p = r.map.getBoundsZoomLevel(e), d = r.map.getBoundsZoomLevel(o), r.map.setCenter(t.getCenter()), r.map.setZoom(d)) : void 0 | |
914 | }, s.prototype.setup_est_circle = function() { | |
915 | var e, t, i; | |
916 | return t = r.filters.get("est"), t && (i = t.get("radius")), (e = r.establishment_data.getItem(t.id)) ? (this.est_obj = new n.Circle({ | |
917 | radius: i || e.radius, | |
918 | center: new n.LatLng(e.lat_lon[1], e.lat_lon[0]), | |
919 | fillColor: "white", | |
920 | fillOpacity: 0, | |
921 | strokeColor: "#7323dc", | |
922 | strokeOpacity: .9, | |
923 | clickable: !1, | |
924 | strokeWeight: 1 | |
925 | }), this.nearby_circle_loading_icon = '<div class = "marker-circle"><img src = "' + r.Images.MarkerImages.nearby_center_loading + '" style="width:20px; height:20px;" ></img></div>', this.est_obj.set_drag_marker(5e3, "properties"), this.est_obj.set_center_marker(e.name, !1), this.placesCircleScrubberDragEndListener = n.event.addListener(this.est_obj.marker, "dragend", function(e) { | |
926 | return function() { | |
927 | return t = e.options.filter_model.get("est"), t.set("radius", parseInt(e.est_obj.getRadius())), e.options.filter_model.trigger("change"), e.donut.setPaths(e.get_donut_paths()), r.Track.track_gaq_event("Filters-" + r.selected_service.get("url_name"), "radius", { | |
928 | radius: t.get("radius") | |
929 | }) | |
930 | } | |
931 | }(this)), this.donut = new n.Polygon({ | |
932 | paths: this.get_donut_paths(), | |
933 | strokeColor: "#0000FF", | |
934 | strokeOpacity: .8, | |
935 | strokeWeight: 0, | |
936 | fillColor: "#FFF", | |
937 | fillOpacity: .5, | |
938 | zIndex: -1 | |
939 | }), this.donut.setMap(r.map), this.fit_map_to_establishment()) : void herr("error in getting est details data") | |
940 | }, s.prototype.get_donut_paths = function() { | |
941 | return [r.map.getCirclePath(this.est_obj.getCenter(), 100, 1, 4), r.map.getCirclePath(this.est_obj.getCenter(), this.est_obj.getRadius() / 1e3, -1, 64)] | |
942 | }, s.prototype.refresh_map_view = function(e) { | |
943 | var t, i; | |
944 | return hlog("common map view "), i = new Date, r.Util.is_tiling_service() || this.addAll(), t = !1, e && e.force && (t = e.force), this.poi_mode() || this.shortlist_mode() || this.options.get_listings_mode("commute") || ("poly" === this.options.filter_model.get("loct") ? this.refresh_polygon(t) : "est" === this.options.filter_model.get("loct") && this.refresh_est_circle()), hlog("refresh map view"), e && (e.zoom_to_fit && this.fit_map_to_markers(), e.zoom_to_fit_shortlist && this.fit_map_to_shortlisted_markers()), this.update_visibilities() | |
945 | }, s.prototype.setup_polygon = function(e) { | |
946 | var t, i, s, o, a; | |
947 | return s = { | |
948 | path: "M 0,-1 0,1", | |
949 | strokeOpacity: 1, | |
950 | scale: 3, | |
951 | strokeWeight: 2 | |
952 | }, o = r.filters.get("poly"), o && (a = r.polygon_data.getItem(o.id)), a ? (t = this.is_buffered(), this.polygon_obj ? (this.polygon_obj.setPaths(this.get_polygon_map_path()), this.polyline_obj.setPath(this.get_polygon_map_path())) : (this.polygon_obj = new n.Polygon({ | |
953 | paths: this.get_polygon_map_path(), | |
954 | strokeColor: "#7323dc", | |
955 | strokeOpacity: .8, | |
956 | strokeWeight: 2, | |
957 | fillColor: "#0000FF", | |
958 | fillOpacity: .01, | |
959 | geodesic: !1 | |
960 | }), this.polyline_obj = new n.Polyline({ | |
961 | icons: [{ | |
962 | icon: s, | |
963 | offset: "0", | |
964 | repeat: "14px" | |
965 | }], | |
966 | path: this.get_polygon_map_path(), | |
967 | strokeColor: "#7323dc", | |
968 | geodesic: !0, | |
969 | strokeOpacity: 0 | |
970 | }), this.polyline_obj.show = function(e) { | |
971 | return function() { | |
972 | return e.polyline_obj ? e.polyline_obj.setMap(r.map) : void 0 | |
973 | } | |
974 | }(this), this.polyline_obj.hide = function(e) { | |
975 | return function() { | |
976 | return e.polyline_obj ? e.polyline_obj.setMap(null) : void 0 | |
977 | } | |
978 | }(this)), i = a.center, this.polygon_obj.center = new n.LatLng(i[1], i[0]), t || (this.mask_layer ? this.mask_layer.setPaths(this.get_polygon_mask_path()) : (this.mask_layer = new n.Polygon({ | |
979 | paths: this.get_polygon_mask_path(), | |
980 | strokeColor: "#FFF", | |
981 | strokeOpacity: .8, | |
982 | strokeWeight: 0, | |
983 | fillColor: "#FFF", | |
984 | fillOpacity: .55, | |
985 | zIndex: -1 | |
986 | }), this.mask_layer.show = function(e) { | |
987 | return function() { | |
988 | return e.mask_layer ? e.mask_layer.setMap(r.map) : void 0 | |
989 | } | |
990 | }(this), this.mask_layer.hide = function(e) { | |
991 | return function() { | |
992 | return e.mask_layer ? e.mask_layer.setMap(null) : void 0 | |
993 | } | |
994 | }(this))), this.polyline_obj.show(), t || this.mask_layer.show(), this.fit_map_to_polygon(e)) : void 0 | |
995 | }, s.prototype.get_polygon_map_path = function(e) { | |
996 | var t, i, s, o; | |
997 | return null == e && (e = !1), t = r.filters.get("poly"), t && t.id && r.polygon_data.getItem(t.id) && (t && (s = r.polygon_data.getItem(t.id)), s && (s && (i = s.polygon.coordinates[0]), o = [], i)) ? (_.each(i, function() { | |
998 | return function(e) { | |
999 | return o.push(new n.LatLng(e[1], e[0])) | |
1000 | } | |
1001 | }(this)), o.push(new n.LatLng(i[0][1], i[0][0])), o instanceof Array || (o = []), o) : void 0 | |
1002 | }, s.prototype.reset_polygons = function() { | |
1003 | return this.polyline_obj && this.polyline_obj.hide(), this.mask_layer ? this.mask_layer.hide() : void 0 | |
1004 | }, s.prototype.hide_polygons = function() { | |
1005 | return this.polyline_obj && this.polyline_obj.hide(), this.mask_layer ? this.mask_layer.hide() : void 0 | |
1006 | }, s.prototype.show_polygons = function() { | |
1007 | return this.polyline_obj && this.polyline_obj.show(), this.mask_layer && !this.is_buffered() ? this.mask_layer.show() : void 0 | |
1008 | }, s.prototype.is_buffered = function() { | |
1009 | var e, t, i; | |
1010 | return r.filters && (i = r.filters.get("poly")), i && (e = r.polygon_data.getItem(i.id)), e ? (e && (t = "city" === e.feature_type), t ? !1 : i ? i.get("buffer") : void 0) : void 0 | |
1011 | }, s.prototype.get_polygon_mask_path = function() { | |
1012 | return [r.map.getCirclePath(this.polygon_obj.center, 150, 1, 4), this.get_polygon_map_path().reverse()] | |
1013 | }, s.prototype.fit_map_to_polygon = function(e) { | |
1014 | var t, i, s, o, a, l, h, p, d, c, u; | |
1015 | return null == e && (e = !1), this.polygon_obj ? (i = r.filters.get("poly").changedAttributes(), i && (s = Object.keys(i)), (e || i && (!s || 1 !== s.length || "buffer" !== s[0])) && (r.filters.get("poly").set({ | |
1016 | id: r.filters.get("poly").id | |
1017 | }, { | |
1018 | silent: !0 | |
1019 | }), t = new n.LatLngBounds, _.each(this.polygon_obj.getPath().j, function() { | |
1020 | return function(e) { | |
1021 | return e ? t.extend(e) : void 0 | |
1022 | } | |
1023 | }(this)), t && (o = t.getNorthEast(), d = t.getSouthWest(), h = .2 * Math.abs(o.lat() - d.lat()), p = .2 * Math.abs(o.lng() - d.lng()), a = new n.LatLng(o.lat() - h, o.lng() - p), c = new n.LatLng(d.lat() + h, d.lng() + p), l = new n.LatLngBounds(c, a), u = r.map.getBoundsZoomLevel(t), r.set_map_zoom = !0, l && this.create_bounds(l), l)) ? r.map.fitBounds(l) : void 0) : void 0 | |
1024 | }, s.prototype.create_bounds = function(e, t) {}, s.prototype.update_visibilities = function() { | |
1025 | var e, t; | |
1026 | return this.poi_mode() === !0 ? ("poly" === this.options.filter_model.get("loct") ? this.hide_polygons() : "est" === this.options.filter_model.get("loct") && this.hide_establishment_circle(), r.Util.is_tiling_service() || null !== this.options.rentals.getSelected() && (e = this.options.rentals.getSelected(), t = this.options.rentals.get(e), this.show_marker(t)), this.hide_all_markers()) : this.shortlist_mode() === !0 ? ("poly" === this.options.filter_model.get("loct") ? this.hide_polygons() : "est" === this.options.filter_model.get("loct") && this.hide_establishment_circle(), this.hide_all_markers(!0)) : (r.Util.is_tiling_service() && this.add_shortlisted_markers(), "poly" === this.options.filter_model.get("loct") ? this.show_polygons() : "est" === this.options.filter_model.get("loct") && (this.est_obj && this.est_obj.show(), this.donut.setMap(r.map)), r.Util.is_tiling_service() ? void 0 : this.set_marker_visiblities()) | |
1027 | }, s.prototype.set_marker_visiblities = function() {}, s.prototype.poi_mode = function() { | |
1028 | return this.options.get_listings_mode("poi") | |
1029 | }, s.prototype.shortlist_mode = function() { | |
1030 | return this.options.get_listings_mode("shortlist") | |
1031 | }, s.prototype.refresh_est_circle = function() { | |
1032 | var e, t; | |
1033 | if (this.reset_polygons(), this.options.filter_model && this.options.filter_model.get("est")) { | |
1034 | if (this.est_obj || this.setup_est_circle(), t = this.options.filter_model.get("est"), e = r.establishment_data.getItem(t.id), !e) return; | |
1035 | return this.est_obj.setCenter(new n.LatLng(e.lat_lon[1], e.lat_lon[0])), this.est_obj.setRadius(t.get("radius")), this.est_obj.set_center_marker(e.name, !1), this.est_obj.set_drag_marker(), this.est_obj.show(), this.donut.setPaths(this.get_donut_paths()), this.donut.setMap(r.map), this.fit_map_to_establishment() | |
1036 | } | |
1037 | }, s.prototype.refresh_polygon = function(e) { | |
1038 | var t; | |
1039 | return this.hide_establishment_circle(), this.reset_polygons(), t = this.options.filter_model.get("poly"), this.options.filter_model && t ? this.setup_polygon(e) : void 0 | |
1040 | }, s.prototype.fit_map_to_establishment = function(e) { | |
1041 | var t, i, s, o, a, l, h, _, p, d; | |
1042 | return null == e && (e = !1), i = r.filters.get("est").changedAttributes(), i && (s = Object.keys(i)), (e || i && (!s || 1 !== s.length || "radius" !== s[0])) && (r.filters.get("est").set({ | |
1043 | id: r.filters.get("est").id | |
1044 | }, { | |
1045 | silent: !0 | |
1046 | }), this.est_obj && (t = this.est_obj.getBounds()), t && (o = t.getNorthEast(), p = t.getSouthWest(), h = .2 * Math.abs(o.lat() - p.lat()), _ = .2 * Math.abs(o.lng() - p.lng()), a = new n.LatLng(o.lat() - h, o.lng() - _), d = new n.LatLng(p.lat() + h, p.lng() + _), l = new n.LatLngBounds(d, a))) ? r.map.fitBounds(l) : void 0 | |
1047 | }, s.prototype.hide_establishment_circle = function() { | |
1048 | return this.est_obj ? (this.est_obj.hide(), this.donut.setMap(null)) : void 0 | |
1049 | }, s.prototype.getDistanceFromLatLonInKm = function(e, t) { | |
1050 | var r, i, s, n, o, a, l, h, _, p, d; | |
1051 | return r = 6371, h = e.lat(), p = e.lng(), _ = t.lat(), d = t.lng(), l = Math.PI / 180, o = (_ - h) * l, a = (d - p) * l, i = Math.sin(o / 2) * Math.sin(o / 2) + Math.cos(h * l) * Math.cos(_ * l) * Math.sin(a / 2) * Math.sin(a / 2), s = 2 * Math.atan2(Math.sqrt(i), Math.sqrt(1 - i)), n = r * s | |
1052 | }, s.prototype.destroy = function() { | |
1053 | var e; | |
1054 | return this.stopListening(), n.event.removeListener(this.map_drag_end_listener), this.stopListening(r.event, "highlighted:id", this.get_highlighted), this.stopListening(r.event, "unhighlighted:id", this.get_unhighlighted), this.stopListening(r.event, "stopped:poi_mode", this.start_map), this.stopListening(r.event, "started:poi_mode", this.stop_map), this.stopListening(r.event, "stopped:shortlist_mode", this.stopped_shortlist_mode), this.stopListening(r.event, "started:shortlist_mode", this.started_shortlist_mode), this.stopListening(this.options.shortlist, "added:shortlist", this.add_one_shortlist_marker), this.stopListening(this.options.shortlist, "removed:shortlist", this.remove_one_shortlist_marker), this.stopListening(this.options.shortlist, "cleared:shortlist", this.remove_all_shortlist_marker), (e = this.est_obj) && (n.event.clearInstanceListeners(e), e.destroy()), this.reset_polygons(), this.donut && n.event.clearInstanceListeners(this.donut), this.donut && this.donut.setMap(null), this.$el.removeData().unbind(), this.contact_modal_view ? this.contact_modal_view.destroy() : void 0 | |
1055 | }, s | |
1056 | }(Backbone.View) | |
1057 | }) | |
1058 | }.call(this), | |
1059 | function() { | |
1060 | var e = function(e, r) { | |
1061 | function i() { | |
1062 | this.constructor = e | |
1063 | } | |
1064 | for (var s in r) t.call(r, s) && (e[s] = r[s]); | |
1065 | return i.prototype = r.prototype, e.prototype = new i, e.__super__ = r.prototype, e | |
1066 | }, | |
1067 | t = {}.hasOwnProperty; | |
1068 | define("backbone/models/buy/buy", ["backbone/assets", "backbone/models/listing", "backbone"], function(t, r) { | |
1069 | var i, s; | |
1070 | return i = function(r) { | |
1071 | function i() { | |
1072 | return i.__super__.constructor.apply(this, arguments) | |
1073 | } | |
1074 | return e(i, r), i.prototype.defaults = { | |
1075 | formatted_price: null, | |
1076 | gallery_images: [] | |
1077 | }, i.prototype.parse = function(e) { | |
1078 | var r; | |
1079 | return r = e.result ? e.result : e, window.debug_mode && r.canonical_url && (r.canonical_url = r.canonical_url.replace(t.default_url, "")), r | |
1080 | }, i.prototype.initialize = function() { | |
1081 | return i.__super__.initialize.apply(this, arguments) | |
1082 | }, i | |
1083 | }(r.Model), _.defaults(i.prototype.defaults, r.Model.prototype.defaults), s = function(r) { | |
1084 | function s() { | |
1085 | return s.__super__.constructor.apply(this, arguments) | |
1086 | } | |
1087 | return e(s, r), s.prototype.model = i, s.prototype.url = function() { | |
1088 | return t.API_V2_BaseUrl + "buy" | |
1089 | }, s.prototype.parse = function(e) { | |
1090 | return e.result | |
1091 | }, s.prototype.initialize = function() { | |
1092 | return s.__super__.initialize.apply(this, arguments), this.rent_range = null | |
1093 | }, s.prototype.getUrlText = function(e) { | |
1094 | var t, r; | |
1095 | return (t = this.get(e) && t && t.get("apartment_type") && t.get("furnish_type") && t.get("locality")) ? (r = t.get("apartment_type").replace(" ", "-") + "-Flat-in-" + t.get("locality").replace(" ", "-") + "-for-Rs-" + t.get("formatted_price"), e + "-" + r.toLowerCase().replace(" ", "-")) : e | |
1096 | }, s.prototype.getTitle = function() { | |
1097 | var e, t; | |
1098 | return t = s.__super__.getTitle.apply(this, arguments), t += (e = this.get(this.getSelected())) ? " For Sale Rs. " + e.get("formatted_price") : " For Sale " | |
1099 | }, s | |
1100 | }(r.Collection), { | |
1101 | Model: i, | |
1102 | Collection: s | |
1103 | } | |
1104 | }) | |
1105 | }.call(this), | |
1106 | function() { | |
1107 | define("backbone/helpers/map_tiles", ["backbone/helpers/maps", "backbone/assets", "backbone/helpers/lru_cache"], function(e, t) { | |
1108 | var r, i; | |
1109 | return t.tilesdata = {}, t.threshold = {}, t.heat_map_tile_size = 1024, t.agents_tile_arr_size = 128, Cache && (t.RentBuyTilesData = new Cache(40, !1)), Cache && (t.AgentTilesData = new Cache(25, !1)), r = function() { | |
1110 | var e; | |
1111 | return e = "Mumbai", r.prototype.tileSize = new google.maps.Size(1024, 1024), r.prototype.maxZoom = 19, r.prototype.minZoom = 0 | |
1112 | }, r.prototype.getTile = function(e, t, r) { | |
1113 | var i, s, n; | |
1114 | for (i = r.createElement("div"), i.style.width = this.tileSize.width + "px", i.style.height = this.tileSize.height + "px", i.style.fontSize = "10", i.style.borderStyle = "solid", i.style.borderWidth = "1px", i.style.borderColor = "#000", i.style.backgroundColor = "#E5E3DF", $(i).append('<span style="position:absolute;">' + e + "</span>"), s = n = 1; 64 >= n; s = ++n) $(i).append('<div style="width:128px;height:128px;border-right: 1px solid red;border-bottom: 1px solid red;display:inline-block;box-sizing:border-box;float:left;">'); | |
1115 | return i | |
1116 | }, r.prototype.name = "Tile #s", r.prototype.alt = "Tile Coordinate Map Type", i = new r, t.getbytes = function() { | |
1117 | return function(e) { | |
1118 | var t, r, i; | |
1119 | for (t = [], r = void 0, i = 0; i < e.length;) r = e.charCodeAt(i), t.push(255 & r), i++; | |
1120 | return t | |
1121 | } | |
1122 | }(this), t.add_rentbuy_tiles = function() { | |
1123 | return function() { | |
1124 | return t.map.mapTypes.set("coordinate", i), t.AddRentBuyImageMapType() | |
1125 | } | |
1126 | }(this), t.AddRentBuyImageMapType = function() { | |
1127 | return function() { | |
1128 | return t.RentBuyImageMapType = new e.ImageMapType({ | |
1129 | getTileUrl: function(e, r) { | |
1130 | return t.get_tile_key(e.x, e.y, r) | |
1131 | }, | |
1132 | tileSize: new google.maps.Size(t.rent_buy_tile_size, t.rent_buy_tile_size) | |
1133 | }), t.map.overlayMapTypes.push(t.RentBuyImageMapType) | |
1134 | } | |
1135 | }(this), t.get_tile_key = function() { | |
1136 | return function(e, r, i, s, n) { | |
1137 | var o, a, l, h, _, p, d; | |
1138 | if (null == s && (s = !1), null == n && (n = 1), t.filters) { | |
1139 | if (l = "date_added", !t.selected_service) return; | |
1140 | a = t.filters.get_filter_api_url(!1, !0) | |
1141 | } else a = "", l = "date_added"; | |
1142 | return o = 10, _ = 8437072819, p = 15, t.map_zoom && t.map_zoom >= 15 && (p = t.map_zoom + 1), i >= p && (_ = 0), t.selected_service && (h = t.selected_service.get("url_name")), d = [t.Util.get_tile_server(e, r, s), "?tile_x=", e, "&tile_y=", r, "&zoom=", i, "&importance=", l, "&clutter_big=", n, "&clutter_small=", o, "&txt=", s, "&service=", h, "&threshold=", _, "&filters=details=true&", a].join("").trim() | |
1143 | } | |
1144 | }(this), t.decodeString = function() { | |
1145 | return function(e) { | |
1146 | var r, i, s, n, o; | |
1147 | if (s = e.length, n = 0, s) | |
1148 | for (r = i = 0, o = s - 1; o >= 0 ? o >= i : i >= o; r = o >= 0 ? ++i : --i) n += e.charCodeAt(r) * Math.pow(t.rent_buy_byte_size, s - r - 1); | |
1149 | return n | |
1150 | } | |
1151 | }(this), t.get_starting_position = function() { | |
1152 | return function(e) { | |
1153 | var r, i, s, n, o, a, l, h, _, p; | |
1154 | return t.RentBuyTilesData && t.RentBuyTilesData.getItem(e) && (s = t.RentBuyTilesData.getItem(e).data, l = t.rent_buy_tile_size / t.rent_buy_elem_size, n = s.length, a = t.TilesBytesConfig.starting_indices_byte_size, s) ? (h = 2 * Math.pow(l, 2), r = t.decodeString(s.substr(n - 2 * a, a)), i = t.decodeString(s.substr(n - a, a)), _ = s.substr(i, n - 8).split("|"), _.pop(), o = { | |
1155 | start_stop_starting: h, | |
1156 | actual_data_starting: r, | |
1157 | big_icons_starting: i, | |
1158 | subtile_data: _ | |
1159 | }, p = { | |
1160 | data: s, | |
1161 | pointers: o | |
1162 | }, t.RentBuyTilesData.setItem(e, p)) : void 0 | |
1163 | } | |
1164 | }(this) | |
1165 | }) | |
1166 | }.call(this), | |
1167 | function() { | |
1168 | define("backbone/helpers/custom_circle", ["backbone/assets", "backbone/helpers/maps_util"], function(e, t) { | |
1169 | var r, i; | |
1170 | return r = t.Maps, i = t.RichMarker, r.Circle.prototype.show_drag_marker = function() { | |
1171 | var t; | |
1172 | return t = this, t.marker ? (t.drag_marker_before_drag_start_listener || (t.drag_marker_before_drag_start_listener = r.event.addListener(t.marker, "before_dragstart", function() { | |
1173 | return t.marker.addState(e.MarkerStates.Circle_Drag_marker_dragging) | |
1174 | })), t.drag_marker_drag_start_listener || (t.drag_marker_drag_start_listener = r.event.addListener(t.marker, "dragstart", function() { | |
1175 | var e, i; | |
1176 | return e = new r.LatLng(t.getCenter().lat(), t.marker.getPosition().lng()), t.marker.setPosition(e), i = r.geometry.spherical.computeDistanceBetween(t.getCenter(), e), t.marker.heading = r.geometry.spherical.computeHeading(t.getCenter(), e), t.setRadius(i <= t.MAX_RADIUS ? i : t.MAX_RADIUS) | |
1177 | })), t.drag_marker_drag_listener || (t.drag_marker_drag_listener = r.event.addListener(t.marker, "drag", function() { | |
1178 | var e, i; | |
1179 | return e = new r.LatLng(t.getCenter().lat(), t.marker.getPosition().lng()), i = r.geometry.spherical.computeDistanceBetween(t.getCenter(), e), t.marker.heading = r.geometry.spherical.computeHeading(t.getCenter(), e), t.setRadius(i <= t.MAX_RADIUS ? i : t.MAX_RADIUS), t.marker.setPosition(e) | |
1180 | })), t.drag_marker_drag_end_listener || (t.drag_marker_drag_end_listener = r.event.addListener(t.marker, "dragend", function() { | |
1181 | return t.marker.removeState(e.MarkerStates.Circle_Drag_marker_dragging) | |
1182 | })), this.circle_radius_listener || (this.circle_radius_listener = r.event.addListener(t, "radius_changed", function() { | |
1183 | var e, i; | |
1184 | if (t.marker) return e = t.marker.heading || 90, t.getRadius() <= t.MAX_RADIUS ? i = r.geometry.spherical.computeOffset(t.getCenter(), t.getRadius(), e) : (i = r.geometry.spherical.computeOffset(t.getCenter(), t.MAX_RADIUS, e), t.setRadius(t.MAX_RADIUS)), t.marker.setContent('<i class ="drag-marker-image icon-arrow-horizontal"><div class="arrow"></div><div class="drag-title">Showing ' + this.type + " within <b>" + parseInt(t.getRadius()) + " m</b> <br/> Drag to change circle radius</div></i>"), t.marker.calculateDistance(t.getCenter()) | |
1185 | })), t.marker.getMap() ? void 0 : t.marker.setMap(e.map)) : void 0 | |
1186 | }, r.Circle.prototype.set_drag_marker = function(t, s) { | |
1187 | var n, o; | |
1188 | return n = this, n.MAX_RADIUS = t || 5e3, this.type = s || "properties", n.marker ? (n.marker.setPosition(r.geometry.spherical.computeOffset(n.getCenter(), parseInt(n.getRadius()), n.marker.heading)), n.marker.setContent('<i class ="drag-marker-image icon-arrow-horizontal"><div class="arrow"></div><div class="drag-title">Showing ' + this.type + " within <b>" + parseInt(n.getRadius()) + " m</b> <br/> Drag to change circle radius</div></i>")) : (o = new i({ | |
1189 | content: '<i class ="drag-marker-image icon-arrow-horizontal"><div class="arrow"></div><div class="drag-title">Showing ' + this.type + " within <b>" + parseInt(n.getRadius()) + " m</b> <br/> Drag to change circle radius</div></i>", | |
1190 | draggable: !0, | |
1191 | axis: "x", | |
1192 | raiseOnDrag: !1, | |
1193 | cursor: "ew-resize", | |
1194 | title: "Drag to change radius", | |
1195 | position: r.geometry.spherical.computeOffset(n.getCenter(), parseInt(n.getRadius()), 90), | |
1196 | animate: !1, | |
1197 | anchor: RichMarkerPosition.MIDDLE | |
1198 | }), n.marker = new r.Marker(o), n.marker.heading = 90, this.marker.addState(e.MarkerStates.Circle_Drag_marker), this.marker.removeState(e.MarkerStates.Normal)) | |
1199 | }, r.Circle.prototype.get_drag_marker = function() { | |
1200 | return this.marker | |
1201 | }, r.Circle.prototype.hide_drag_marker = function() { | |
1202 | return this.marker ? (r.event.removeListener(this.circle_radius_listener), this.circle_radius_listener = null, this.marker.setMap(null)) : void 0 | |
1203 | }, r.Circle.prototype.set_center_marker = function(t, r) { | |
1204 | var s, n, o; | |
1205 | return null == r && (r = !0), s = this, n = "", r && (n = '<i class="icon-move"></i>'), o = '<span class ="marker-circle-image">' + n + '<div class="arrow"></div></span><div class="info-box"><b>' + t + "</b></div>", this.center_marker ? (this.center_marker.setPosition(s.getCenter()), this.center_marker.set("title", t), this.center_marker.setContent(o)) : (this.center_marker = new i({ | |
1206 | content: o, | |
1207 | draggable: r, | |
1208 | cursor: "move", | |
1209 | title: t, | |
1210 | position: s.getCenter(), | |
1211 | optimized: !1, | |
1212 | animate: !1, | |
1213 | anchor: RichMarkerPosition.MIDDLE | |
1214 | }), this.center_marker.addState(e.MarkerStates.Circle_center_marker), this.center_marker.removeState(e.MarkerStates.Normal)) | |
1215 | }, r.Circle.prototype.show_center_marker = function() { | |
1216 | var t; | |
1217 | return t = this, this.center_marker && (this.center_marker.getMap() || this.center_marker.setMap(e.map), this.center_marker_drag_listener || (this.center_marker_drag_listener = r.event.addListener(t.center_marker, "drag", function() { | |
1218 | return t.setCenter(t.center_marker.getPosition()), t.marker ? t.marker.setPosition(r.geometry.spherical.computeOffset(t.getCenter(), t.getRadius(), t.marker.heading)) : void 0 | |
1219 | })), this.center_marker_dragend_listener || (this.center_marker_dragend_listener = r.event.addListener(t.center_marker, "dragend", function() { | |
1220 | return hlog(t.center_marker), hlog(t.center_marker.getPosition()), t.setCenter(t.center_marker.getPosition()), t.marker ? t.marker.setPosition(r.geometry.spherical.computeOffset(t.getCenter(), t.getRadius(), t.marker.heading)) : void 0 | |
1221 | })), !this.center_marker_center_listener) ? this.center_marker_center_listener = r.event.addListener(t, "center_changed", function() { | |
1222 | return t.center_marker.setPosition(t.getCenter()) | |
1223 | }) : void 0 | |
1224 | }, r.Circle.prototype.hide_center_marker = function() { | |
1225 | var e; | |
1226 | return e = this, this.center_marker ? (this.center_marker.setMap(null), r.event.removeListener(this.center_marker_drag_listener), this.center_marker_drag_listener = null, r.event.removeListener(this.center_marker_dragend_listener), this.center_marker_dragend_listener = null) : void 0 | |
1227 | }, r.Circle.prototype.hide = function() { | |
1228 | return this.hide_center_marker(), this.hide_drag_marker(), this.setMap(null) | |
1229 | }, r.Circle.prototype.show = function() { | |
1230 | return this.show_center_marker(), this.show_drag_marker(), this.setMap(e.map) | |
1231 | }, r.Circle.prototype.destroy = function() { | |
1232 | return this.hide(), this.center_marker && r.event.clearInstanceListeners(this.center_marker), this.marker ? r.event.clearInstanceListeners(this.marker) : void 0 | |
1233 | }, r | |
1234 | }) | |
1235 | }.call(this), | |
1236 | function() { | |
1237 | var e = function(e, t) { | |
1238 | return function() { | |
1239 | return e.apply(t, arguments) | |
1240 | } | |
1241 | }, | |
1242 | t = function(e, t) { | |
1243 | function i() { | |
1244 | this.constructor = e | |
1245 | } | |
1246 | for (var s in t) r.call(t, s) && (e[s] = t[s]); | |
1247 | return i.prototype = t.prototype, e.prototype = new i, e.__super__ = t.prototype, e | |
1248 | }, | |
1249 | r = {}.hasOwnProperty; | |
1250 | define("backbone/views/tile_map_view", ["backbone/assets", "backbone/views/common_map_view", "backbone/helpers/maps_util", "backbone/models/buy/buy", "backbone/models/rent/rental", "backbone/models/pg/pg", "backbone/helpers/map_tiles", "backbone/helpers/custom_circle"], function(r, i, s, n, o, a) { | |
1251 | var l, h, p; | |
1252 | return l = s.Maps, h = s.RichMarker, p = function(i) { | |
1253 | function s() { | |
1254 | return this.destroy = e(this.destroy, this), this.get_subtile_ids = e(this.get_subtile_ids, this), this.remove_subtile = e(this.remove_subtile, this), this.draw_all_subtiles = e(this.draw_all_subtiles, this), this.draw_subtile = e(this.draw_subtile, this), this.parse_data_for_ref_id = e(this.parse_data_for_ref_id, this), this.get_big_tile_key = e(this.get_big_tile_key, this), this.get_id_at_x_y = e(this.get_id_at_x_y, this), this.check_for_points_inside = e(this.check_for_points_inside, this), this.is_small_dot_inside = e(this.is_small_dot_inside, this), this.lat_lng_to_tile = e(this.lat_lng_to_tile, this), this.clearTilesOverlay = e(this.clearTilesOverlay, this), this.showTilesOverlay = e(this.showTilesOverlay, this), this.remove_idle_listener = e(this.remove_idle_listener, this), this.add_idle_listener = e(this.add_idle_listener, this), this.add_map_listener = e(this.add_map_listener, this), this.remove_map_listener = e(this.remove_map_listener, this), this.stopped_shortlist_mode = e(this.stopped_shortlist_mode, this), this.started_shortlist_mode = e(this.started_shortlist_mode, this), this.stop_map = e(this.stop_map, this), this.start_map = e(this.start_map, this), this.parse_and_update_bmc = e(this.parse_and_update_bmc, this), this.clean_rendered_markers_collection = e(this.clean_rendered_markers_collection, this), this.parse_and_update_rendered_collection = e(this.parse_and_update_rendered_collection, this), this.check_count_and_apply = e(this.check_count_and_apply, this), this.add_remove_subtiles = e(this.add_remove_subtiles, this), this.get_tiles_in_viewport = e(this.get_tiles_in_viewport, this), this.throttle_call_delete_previous_tiles_and_setup = e(this.throttle_call_delete_previous_tiles_and_setup, this), this.throttle_call_get_tiles_in_viewport = e(this.throttle_call_get_tiles_in_viewport, this), this.remove_all_markers = e(this.remove_all_markers, this), this.delete_previous_tiles_and_setup = e(this.delete_previous_tiles_and_setup, this), this.remove_selected_marker = e(this.remove_selected_marker, this), this.manage_selected_marker = e(this.manage_selected_marker, this), this.remove_hover_marker = e(this.remove_hover_marker, this), this.manage_hover_marker = e(this.manage_hover_marker, this), this.mouseMove = e(this.mouseMove, this), this.fit_map_to_shortlisted_markers = e(this.fit_map_to_shortlisted_markers, this), this.is_in_buffer_region = e(this.is_in_buffer_region, this), this.add_animate_class_to_markers = e(this.add_animate_class_to_markers, this), this.apply_markers = e(this.apply_markers, this), this.marker_ready = e(this.marker_ready, this), this.hide_marker = e(this.hide_marker, this), this.hide_all_markers = e(this.hide_all_markers, this), this.addOne = e(this.addOne, this), this.get_unhighlighted = e(this.get_unhighlighted, this), this.get_highlighted = e(this.get_highlighted, this), this.on_mouseenter_marker = e(this.on_mouseenter_marker, this), this.on_mouseleave_marker = e(this.on_mouseleave_marker, this), this.hide_tile_marker = e(this.hide_tile_marker, this), this.render_marker = e(this.render_marker, this), this.remove_marker_state = e(this.remove_marker_state, this), this.add_marker_state = e(this.add_marker_state, this), this.remove_all_shortlist_marker = e(this.remove_all_shortlist_marker, this), this.remove_one_shortlist_marker = e(this.remove_one_shortlist_marker, this), this.add_one_shortlist_marker = e(this.add_one_shortlist_marker, this), this.first_time_add_shortlisted_markers = e(this.first_time_add_shortlisted_markers, this), this.add_shortlisted_markers = e(this.add_shortlisted_markers, this), this.refresh_map_elems = e(this.refresh_map_elems, this), this.select_rental = e(this.select_rental, this), this.update_seen_collections = e(this.update_seen_collections, this), this.handle_click = e(this.handle_click, this), this.initialize = e(this.initialize, this), s.__super__.constructor.apply(this, arguments) | |
1255 | } | |
1256 | return t(s, i), s.prototype.el = ".map-view", s.prototype.type = "tile_map", s.prototype.events = { | |
1257 | click: "handle_click", | |
1258 | "mouseenter .marker .marker-track": "on_mouseenter_marker", | |
1259 | "mouseleave .marker .marker-track": "on_mouseleave_marker", | |
1260 | "mousemove #map-div": "mouseMove" | |
1261 | }, s.prototype.initialize = function() { | |
1262 | var e, t; | |
1263 | return s.__super__.initialize.apply(this, arguments), r.add_rentbuy_tiles(), r.map_fragment = document.createDocumentFragment(), e = r.selected_service.attributes.url_name, "buy" === e ? (r.AllBigMarkerListing = new n.Collection, r.RenderedMarkers = new n.Collection) : "rent" === e ? (r.AllBigMarkerListing = new o.Collection, r.RenderedMarkers = new o.Collection) : "pg" === e && (r.AllBigMarkerListing = new a.Collection, r.RenderedMarkers = new a.Collection), this.markers_remaining = 0, t = this, this.options.rentals.on("id:selected", this.select_rental), r.listings.on("change:seen", this.update_seen_collections), this.listenTo(this.options.filter_model, "completed:filtering", this.refresh_map_view), this.first_time_add_shortlisted_markers(), this.track_mapdrag_count = 0, this.track_mapdrag_flag = !0, this.destroyed = !1, this.hover_marker_data = null, this.selected_marker_data = null, this.previous_tiles_in_view = [], this.fetching_count = 0, this.filter_tile_url = r.filters.get_filter_api_url(void 0, !0), this.tiles_xhr_count = 0, this.tiles_xhr_made = [], this.subtiles_to_be_drawn = [], this.debounced_get_tiles_in_viewport = _.debounce(this.get_tiles_in_viewport, 700), this.debounced_delete_previous_tiles_and_setup = _.debounce(this.delete_previous_tiles_and_setup, 300), this.listenTo(this.options.filter_model, "completed:filtering", this.throttle_call_delete_previous_tiles_and_setup), this.idleListener && l.event.removeListener(this.idleListener), this.idleListener = l.event.addListener(r.map, "idle", function(e) { | |
1264 | return function() { | |
1265 | return e.throttle_call_get_tiles_in_viewport(), e.idleListener ? l.event.removeListener(e.idleListener) : void 0 | |
1266 | } | |
1267 | }(this)), this.add_map_listener(), this.refresh_map_view({ | |
1268 | zoom_to_fit: !0, | |
1269 | force: !0 | |
1270 | }), this.tileSize = r.rent_buy_tile_size, this.elemSize = r.rent_buy_elem_size, this.subTileSize = r.rent_buy_subtile_size, setTimeout(function(e) { | |
1271 | return function() { | |
1272 | return e.throttle_call_get_tiles_in_viewport() | |
1273 | } | |
1274 | }(this), 100) | |
1275 | }, s.prototype.handle_click = function(e, t) { | |
1276 | var i; | |
1277 | return null == e && (e = !1), this.ignore_map_click || this.check_search_here(e), e ? (i = $(e.target).parents(".marker-container").data("id") || $(e.target).parents(".marker").data("id"), i || (i = $(e.target).data("id"))) : i = t, i && (r.router.goto_url(this.shortlist_mode() === !0 ? i === r.listings.getSelected() ? r.router.get_url_till_shortlist() : r.router.get_url_till_shortlist_id(i) : i === r.listings.getSelected() ? r.router.get_url_till_filter() : r.router.get_url_till_flat_id(i)), r.Track.track_open_info_window(i, "map", { | |
1278 | marker_data: this.hover_marker_data | |
1279 | })), this.ignore_map_click = !1, !0 | |
1280 | }, s.prototype.update_seen_collections = function(e) { | |
1281 | var t; | |
1282 | return e && r.RenderedMarkers.get(e.get("id")) && (t = r.RenderedMarkers.get(e.get("id")), t.set("seen", e.get("seen"))), e && r.AllBigMarkerListing.get(e.get("id")) ? (t = r.AllBigMarkerListing.get(e.get("id")), t.set("seen", e.get("seen"))) : void 0 | |
1283 | }, s.prototype.select_rental = function(e) { | |
1284 | var t, i, s, n, o; | |
1285 | if (e) return t = { | |
1286 | top: 50, | |
1287 | left: 50, | |
1288 | bottom: -50, | |
1289 | right: -($(".info-window").width() + 50) | |
1290 | }, null !== e["new"] && (i = r.RenderedMarkers.get(e["new"]), i || r.listings && (i = r.listings.get(e["new"])), i && (s = i.get("marker"), this.manage_selected_marker(i.attributes)), s ? (o = i.get("marker").getPosition(), o && r.map.set_map_center(o, !1, t)) : this.direct_reload || (this.direct_reload = !0, i && this.manage_selected_marker(i.attributes, !0))), null !== e.old && (n = r.RenderedMarkers.get(e.old), n || r.listings && (n = r.listings.get(e.old)), null != this.selected_marker_data && this.selected_marker_data.id === e.old) ? this.remove_selected_marker() : void 0 | |
1291 | }, s.prototype.refresh_map_elems = function() { | |
1292 | var e, t; | |
1293 | if ("est" === this.options.filter_model.get("loct")) { | |
1294 | if (this.options.filter_model && this.est_obj) return e = this.est_obj.center, this.panned_by_locatity_search = !0, r.map.center.equals(e) ? this.throttle_call_get_tiles_in_viewport() : (r.map.setCenter(e), t = setTimeout(function(e) { | |
1295 | return function() { | |
1296 | return e.refresh_pan_listener = l.event.addListenerOnce(r.map, "idle", function() { | |
1297 | return e.throttle_call_get_tiles_in_viewport() | |
1298 | }) | |
1299 | } | |
1300 | }(this), 0)) | |
1301 | } else if ("poly" === this.options.filter_model.get("loct") && this.options.filter_model && this.polygon_obj) return this.panned_by_locatity_search = !0, this.throttle_call_get_tiles_in_viewport() | |
1302 | }, s.prototype.add_shortlisted_markers = function() { | |
1303 | var e; | |
1304 | return e = r.RenderedMarkers.where({ | |
1305 | isShortlisted: !0 | |
1306 | }), _.each(e, function(e) { | |
1307 | return function(t) { | |
1308 | return e.add_one_shortlist_marker(t) | |
1309 | } | |
1310 | }(this)) | |
1311 | }, s.prototype.first_time_add_shortlisted_markers = function() { | |
1312 | var e; | |
1313 | return r.listings ? (e = r.listings.where({ | |
1314 | isShortlisted: !0 | |
1315 | }), _.each(e, function(e) { | |
1316 | return r.RenderedMarkers.add(e.clone(), { | |
1317 | merge: !0 | |
1318 | }) | |
1319 | }), this.add_shortlisted_markers()) : void 0 | |
1320 | }, s.prototype.add_one_shortlist_marker = function(e) { | |
1321 | var t, i, s, n, o; | |
1322 | return e && (t = "INACTIVE" === e.get("status"), !t) ? (o = r.RenderedMarkers.get(e.get("id")), this.is_small_dot_inside(e.id) && this.remove_hover_marker(), o ? o.set("isShortlisted", !0) : (r.RenderedMarkers.add(e.clone(), { | |
1323 | merge: !0 | |
1324 | }), o = r.RenderedMarkers.get(e.get("id")), o && o.set("isShortlisted", !0)), i = o.get("marker"), i ? i.getMap() || i.setMap(r.map) : (n = new l.LatLng(o.get("latitude"), o.get("longitude")), s = r.Util.get_new_marker_div(o.toJSON()), i = new h({ | |
1325 | position: n, | |
1326 | map: r.map, | |
1327 | draggable: !1, | |
1328 | content: s, | |
1329 | id: o.id, | |
1330 | closeBoxURL: "" | |
1331 | }), i.setColor(o.get("sort_color")), o.set("marker", i)), r.Util.add_shortlist_marker_state(i), this.add_marker_state(i, "BufferMarker")) : void 0 | |
1332 | }, s.prototype.remove_one_shortlist_marker = function(e) { | |
1333 | var t, i; | |
1334 | return e && (i = r.RenderedMarkers.get(e.get("id")), i && (i.set("isShortlisted", !1), t = i.get("marker"))) ? r.Util.remove_shortlist_marker_state(this.shortlist_mode() === !0 ? t : t) : void 0 | |
1335 | }, s.prototype.remove_all_shortlist_marker = function() { | |
1336 | var e; | |
1337 | return e = r.RenderedMarkers.where({ | |
1338 | isShortlisted: !0 | |
1339 | }), _.each(e, function(e) { | |
1340 | return function(t) { | |
1341 | return e.remove_one_shortlist_marker(t) | |
1342 | } | |
1343 | }(this)) | |
1344 | }, s.prototype.add_marker_state = function(e, t) { | |
1345 | if (e) switch (t) { | |
1346 | case "ImageMarker": | |
1347 | return e.addState(r.MarkerStates.ImageMarker); | |
1348 | case "PopAnimate": | |
1349 | return e.addState(r.MarkerStates.PopAnimate); | |
1350 | case "BufferMarker": | |
1351 | if (this.is_in_buffer_region(e)) return e.addState(r.MarkerStates.BufferMarker) | |
1352 | } | |
1353 | }, s.prototype.remove_marker_state = function(e, t) { | |
1354 | if (e) switch (t) { | |
1355 | case "BufferMarker": | |
1356 | if (!this.is_in_buffer_region(e)) return e.removeState(r.MarkerStates.BufferMarker) | |
1357 | } | |
1358 | }, s.prototype.render_marker = function() { | |
1359 | return r.RenderedMarkers && r.RenderedMarkers.length ? r.RenderedMarkers.each(function(e) { | |
1360 | return function(t) { | |
1361 | return t.set("fromFilter", !0), e.addOne(t) | |
1362 | } | |
1363 | }(this)) : void 0 | |
1364 | }, s.prototype.hide_tile_marker = function(e) { | |
1365 | var t; | |
1366 | return e ? (t = e.get("marker"), t && t.getMap() && t.setMap(null), r.RenderedMarkers.remove(e)) : void 0 | |
1367 | }, s.prototype.on_mouseleave_marker = function(e) { | |
1368 | var t, i, s; | |
1369 | return t = $(e.currentTarget).data().id, this.get_unhighlighted(t), i = r.RenderedMarkers.get(t), s = this, clearTimeout(s.track_var) | |
1370 | }, s.prototype.on_mouseenter_marker = function(e) { | |
1371 | var t; | |
1372 | return t = $(e.currentTarget).data().id, this.get_highlighted(t, !1), this.track_var = setTimeout(function(e) { | |
1373 | return function() { | |
1374 | return r.Track.track_marker_hover(t, e.is_small_dot_inside(t)) | |
1375 | } | |
1376 | }(this), 3e3) | |
1377 | }, s.prototype.get_highlighted = function(e, t) { | |
1378 | var i, s, n; | |
1379 | if (null == t && (t = !0), null != r.RenderedMarkers && (s = r.RenderedMarkers.get(e)), s || (s = null != (n = r.listings) ? n.get(e) : void 0), e && this.is_small_dot_inside(e) && !this.hover_marker_data) { | |
1380 | if (s) return this.manage_hover_marker(s.attributes) | |
1381 | } else if (s && (i = s.get("marker"), i && !this.is_small_dot_inside(s.id))) return this.manage_hover_marker(s.attributes) | |
1382 | }, s.prototype.get_unhighlighted = function(e) { | |
1383 | var t, i; | |
1384 | return r.event.trigger("hide:sort_position"), null != r.RenderedMarkers && (t = r.RenderedMarkers.get(e)), t && t.get("isShortlisted") && (i = t.get("marker"), i && r.Util.remove_hover_state(i)), this.remove_hover_marker() | |
1385 | }, s.prototype.addOne = function(e) { | |
1386 | var t, i, s; | |
1387 | return e.get("marker") ? (t = e.get("marker"), void(this.shortlist_mode() ? t.setColor(null) : e.get("sort_color") && t.setColor(e.get("sort_color")))) : (s = new l.LatLng(e.get("latitude"), e.get("longitude")), i = r.Util.get_new_marker_div(e.toJSON()), t = new h({ | |
1388 | position: s, | |
1389 | map: null, | |
1390 | draggable: !1, | |
1391 | content: i, | |
1392 | id: e.id, | |
1393 | bulkAdd: !0 | |
1394 | }), e.get("isShortlisted") === !0 && r.Util.add_shortlist_marker_state(t), e.get("fromFilter") === !0 && t && t.addState(r.MarkerStates.Filtered), t.setColor(e.get("sort_color")), e.get("seen") && t && t.addState(r.MarkerStates.Seen), r.Util.is_service("pg") && t && ("Boys" === e.get("available_for_type") ? t.addState(r.MarkerStates.Male) : "Girls" === e.get("available_for_type") ? t.addState(r.MarkerStates.Female) : "Both" === e.get("available_for_type") && t.addState(r.MarkerStates.MaleFemale), t.addState(r.MarkerStates.PGMarker)), this.add_marker_state(t, "BufferMarker"), e.on("change:seen", this.add_seen), e.set("newMarker", !0), e.set("marker", t), l.event.addListenerOnce(t, "ready", function(e) { | |
1395 | return function() { | |
1396 | return e.marker_ready(t) | |
1397 | } | |
1398 | }(this)), t.setMap(r.map), this.markers_remaining++) | |
1399 | }, s.prototype.add_seen = function(e) { | |
1400 | return e && e.get("marker") ? e.get("marker").addState(r.MarkerStates.Seen) : void 0 | |
1401 | }, s.prototype.hide_all_markers = function(e) { | |
1402 | var t; | |
1403 | return null == e && (e = !1), t = this, r.RenderedMarkers.each(function(r) { | |
1404 | return e && r.get("isShortlisted") ? void 0 : t.hide_marker(r) | |
1405 | }) | |
1406 | }, s.prototype.hide_marker = function(e) { | |
1407 | var t; | |
1408 | return e && (t = e.get("marker"), t && t.getMap() && (t.setMap(null), !t.counted)) ? this.markers_remaining-- : void 0 | |
1409 | }, s.prototype.marker_ready = function(e) { | |
1410 | return this.markers_remaining--, e.counted = !0, 0 === this.markers_remaining ? (this.panned_by_locatity_search ? this.apply_markers() : setTimeout(function(e) { | |
1411 | return function() { | |
1412 | return e.apply_markers() | |
1413 | } | |
1414 | }(this), 0), this.panned_by_locatity_search = !1) : void 0 | |
1415 | }, s.prototype.apply_markers = function() { | |
1416 | return this.options.filter_model.trigger("refresh:heat-bar", !0), this.shortlist_mode() ? void 0 : (r.map_pane.appendChild(r.map_fragment), r.map_fragment = document.createDocumentFragment(), this.add_animate_class_to_markers()) | |
1417 | }, s.prototype.add_animate_class_to_markers = function() { | |
1418 | var e; | |
1419 | return e = r.RenderedMarkers.where({ | |
1420 | newMarker: !0 | |
1421 | }), _.each(e, function(e) { | |
1422 | return function(t) { | |
1423 | var i; | |
1424 | return t && (i = t.get("marker")), t.set("newMarker", !1), i ? (i.getMap() || i.setMap(r.map), e.add_marker_state(i, "PopAnimate")) : void 0 | |
1425 | } | |
1426 | }(this)) | |
1427 | }, s.prototype.is_in_buffer_region = function(e) { | |
1428 | var t; | |
1429 | return t = r.filters.get("poly"), t.get("buffer") && e && this.polygon_obj ? !l.geometry.poly.containsLocation(e.position, this.polygon_obj) : void 0 | |
1430 | }, s.prototype.fit_map_to_shortlisted_markers = function() { | |
1431 | var e, t; | |
1432 | return t = r.RenderedMarkers.where({ | |
1433 | isShortlisted: !0 | |
1434 | }), e = new l.LatLngBounds, _.each(t, function(t) { | |
1435 | var r; | |
1436 | return r = t.get("marker"), r ? e.extend(r.getPosition()) : void 0 | |
1437 | }), e.isEmpty() ? void 0 : r.map.fitBounds(e) | |
1438 | }, s.prototype.mouseMove = function(e) { | |
1439 | var t, i, s, n, o, a, h, _, p, d, c, u, m, g; | |
1440 | if (!(e && ($(e.target).parents(".marker-circle").length || $(e.target).hasClass(".marker-circle") || $(e.target).parents(".drag-marker-circle").length || $(e.target).hasClass(".drag-marker-circle")) || (a = $(".map-view").offset(), this.poi_mode() || this.shortlist_mode() || this.options.get_listings_mode("commute") || !r.projection || !a))) | |
1441 | if (t = r.projection.fromContainerPixelToLatLng(new l.Point(e.pageX - a.left, e.pageY - a.top)), d = r.map.fromCoordinatesToPixel(t), m = d[0], g = d[1], _ = parseInt(m % this.tileSize / this.elemSize), p = parseInt(g % this.tileSize / this.elemSize), u = r.get_tile_key(parseInt(m / this.tileSize), parseInt(g / this.tileSize), r.map.zoom, !0), c = r.RentBuyTilesData.getItem(u), i = this.get_id_at_x_y(_, p, c)) { | |
1442 | if (this.previous_id && this.previous_id === i && null !== this.hover_marker_data) return; | |
1443 | if (this.previous_id = i, h = this.parse_data_for_ref_id(parseInt(i), u), h && (s = h.latitude, o = h.longitude, n = new l.LatLng(s, o), this.is_small_dot_inside(h.id) && this.check_for_points_inside(h))) return this.manage_hover_marker(h) | |
1444 | } else if (null != this.hover_marker_data && this.is_small_dot_inside(this.hover_marker_data.id)) return this.remove_hover_marker() | |
1445 | }, s.prototype.manage_hover_marker = function(e) { | |
1446 | var t, i, s; | |
1447 | if (this.remove_hover_marker(), this.is_small_dot_inside(e.id)) { | |
1448 | if (null != this.selected_marker_data && this.selected_marker_data.id === e.id) return; | |
1449 | return s = new l.LatLng(e.latitude, e.longitude), i = r.Util.get_new_marker_div(e, null, !0), t = new h({ | |
1450 | position: s, | |
1451 | map: null, | |
1452 | draggable: !1, | |
1453 | content: i, | |
1454 | id: e.id, | |
1455 | bulkAdd: !1 | |
1456 | }), this.add_marker_state(t, "BufferMarker"), r.Util.add_hover_state(t), e.marker = t, t.setMap(r.map), e.dot_marker = !0, this.hover_marker_data = e | |
1457 | } | |
1458 | return t = e.marker, r.Util.add_hover_state(t), e.dot_marker = !1, this.hover_marker_data = e | |
1459 | }, s.prototype.remove_hover_marker = function() { | |
1460 | var e; | |
1461 | return null != this.hover_marker_data ? this.hover_marker_data.dot_marker || this.is_small_dot_inside(this.hover_marker_data.id) ? (e = this.hover_marker_data.marker, e && e.setMap(null), e = null, this.hover_marker_data = null) : (r.Util.remove_hover_state(this.hover_marker_data.marker), this.hover_marker_data = null) : void 0 | |
1462 | }, s.prototype.manage_selected_marker = function(e, t) { | |
1463 | var i, s, n; | |
1464 | return null == t && (t = !1), this.remove_selected_marker(), t || this.is_small_dot_inside(e.id) ? (null != this.hover_marker_data && this.hover_marker_data.id === e.id && this.remove_hover_marker(), n = new l.LatLng(e.latitude, e.longitude), s = r.Util.get_new_marker_div(e), i = new h({ | |
1465 | position: n, | |
1466 | map: null, | |
1467 | draggable: !1, | |
1468 | content: s, | |
1469 | id: e.id, | |
1470 | bulkAdd: !1 | |
1471 | }), this.add_marker_state(i, "BufferMarker"), r.Util.add_selected_marker_state(i), e.marker = i, i.setMap(r.map), e.dot_marker = !0, this.selected_marker_data = e) : (i = e.marker, r.Util.add_selected_marker_state(i), e.dot_marker = !1, this.selected_marker_data = e) | |
1472 | }, s.prototype.remove_selected_marker = function() { | |
1473 | var e; | |
1474 | return null != this.selected_marker_data ? this.selected_marker_data.dot_marker || this.is_small_dot_inside(this.selected_marker_data.id) ? (e = this.selected_marker_data.marker, this.selected_marker_data.isShortlisted ? e && r.Util.remove_selected_marker_state(e) : (e && e.setMap(null), e = null), this.selected_marker_data = null) : (r.Util.remove_selected_marker_state(this.selected_marker_data.marker), this.selected_marker_data = null) : void 0 | |
1475 | }, s.prototype.delete_previous_tiles_and_setup = function(e) { | |
1476 | var t; | |
1477 | return null == e && (e = !1), t = r.filters.get_filter_api_url(void 0, !0), r.Util.getTimeFromLastUpdate() && (e = !0), e || t !== this.filter_tile_url ? (r.Util.updateDataVersion(), this.filter_tile_url = t, this.clearTilesOverlay(), this.remove_all_markers(), this.current_tiles_in_view = [], r.AllBigMarkerListing.reset(), this.throttle_call_get_tiles_in_viewport(), this.showTilesOverlay()) : (r.event.trigger("completed:tile-marker-placement"), this.options.filter_model.trigger("refresh:heat-bar", !0)) | |
1478 | }, s.prototype.remove_all_markers = function() { | |
1479 | return r.RenderedMarkers.each(function() { | |
1480 | return function(e) { | |
1481 | var t; | |
1482 | return e.get("isShortlisted") ? void 0 : (t = e.get("marker"), t && t.removeState(r.MarkerStates.PopAnimate), t.setMap(null), e.set("newMarker", !0), e.set("removeMarker", !0)) | |
1483 | } | |
1484 | }(this)) | |
1485 | }, s.prototype.throttle_call_get_tiles_in_viewport = function() { | |
1486 | return this.debounced_get_tiles_in_viewport.apply() | |
1487 | }, s.prototype.throttle_call_delete_previous_tiles_and_setup = function() { | |
1488 | return this.debounced_delete_previous_tiles_and_setup.apply() | |
1489 | }, s.prototype.get_tiles_in_viewport = function() { | |
1490 | var e, t, i, s, n, o, a, l, h, p, d, c, u, m, g, f; | |
1491 | if (r.filters && !(r.filters && r.filters.get("est") && null === r.filters.get("est").id && r.filters && r.filters.get("poly") && null === r.filters.get("poly").id) && !this.destroyed) { | |
1492 | if (!(this.poi_mode() || this.shortlist_mode() || this.options.get_listings_mode("commute"))) { | |
1493 | if (this.current_tiles_in_view && (this.previous_tiles_in_view = this.current_tiles_in_view), t = r.map.getBounds(), !t) return; | |
1494 | for (g = r.map.fromCoordinatesToPixel(t.getNorthEast()), i = 100, g && (g = [g[0] + i, g[1] - i], f = [Math.floor(g[0] / this.subTileSize), Math.floor(g[1] / this.subTileSize)]), t && (a = r.map.fromCoordinatesToPixel(t.getSouthWest())), a && (a = [a[0] - i, a[1] + i], l = [Math.floor(a[0] / this.subTileSize), Math.floor(a[1] / this.subTileSize)]), this.current_tiles_in_view = [], s = o = p = l[0], d = f[0]; d >= p ? d >= o : o >= d; s = d >= p ? ++o : --o) | |
1495 | for (n = h = c = f[1], u = l[1]; u >= c ? u >= h : h >= u; n = u >= c ? ++h : --h) this.current_tiles_in_view.push(s + "_" + n + "_" + r.map.zoom); | |
1496 | return e = _.difference(this.current_tiles_in_view, this.previous_tiles_in_view), m = _.difference(this.previous_tiles_in_view, this.current_tiles_in_view), this.viewport_tiles = { | |
1497 | current: this.current_tiles_in_view, | |
1498 | addition: e, | |
1499 | removed: m | |
1500 | }, this.add_remove_subtiles(this.viewport_tiles) | |
1501 | } | |
1502 | return this.shortlist_mode() ? (r.event.trigger("completed:tile-marker-placement"), this.started_shortlist_mode()) : void 0 | |
1503 | } | |
1504 | }, s.prototype.add_remove_subtiles = function(e) { | |
1505 | var t, r; | |
1506 | return hlog("add_remove_subtiles"), t = e.addition, r = e.removed, t.length || r.length ? (this.tiles_addition_removal = t.length + r.length, this.fetching_count = 0, r.length && _.each(r, function(e) { | |
1507 | return function(t) { | |
1508 | return e.remove_subtile(t) | |
1509 | } | |
1510 | }(this)), t.length ? _.each(t, function(e) { | |
1511 | return function(t) { | |
1512 | return e.draw_subtile(t) | |
1513 | } | |
1514 | }(this)) : void 0) : this.check_count_and_apply(!0) | |
1515 | }, s.prototype.check_count_and_apply = function(e) { | |
1516 | var t, i; | |
1517 | return null == e && (e = !1), this.fetching_count === this.tiles_addition_removal || e ? (r.RenderedMarkers.each(function(e) { | |
1518 | return function(t) { | |
1519 | var i; | |
1520 | return t.get("isShortlisted") ? void 0 : (i = t.get("marker"), t.set("newMarker", !1), i && i.removeState(r.MarkerStates.PopAnimate), i && e.remove_marker_state(i, "BufferMarker"), t.set("removeMarker", !0)) | |
1521 | } | |
1522 | }(this)), this.parse_and_update_rendered_collection(), this.clean_rendered_markers_collection(), r.listings && r.listings.getSelected() && (t = r.listings.getSelected(), i = r.RenderedMarkers.get(t), i || (i = r.listings.get(t)), i && this.manage_selected_marker(i.attributes)), r.RenderedMarkers.each(function() { | |
1523 | return function(e) { | |
1524 | return e.set("fromFilter", !0) | |
1525 | } | |
1526 | }(this)), setTimeout(function() { | |
1527 | return function() { | |
1528 | return r.event.trigger("completed:tile-marker-placement") | |
1529 | } | |
1530 | }(this), 0)) : void 0 | |
1531 | }, s.prototype.parse_and_update_rendered_collection = function() { | |
1532 | return r.AllBigMarkerListing && r.AllBigMarkerListing.length ? r.AllBigMarkerListing.each(function(e) { | |
1533 | return function(t) { | |
1534 | var i, s; | |
1535 | if (i = r.RenderedMarkers.get(t.get("id")), e.check_for_points_inside(t.toJSON())) { | |
1536 | if (!i) return r.RenderedMarkers.add(t.toJSON()), e.addOne(r.RenderedMarkers.get(t.get("id"))); | |
1537 | if (i.set("removeMarker", !1), s = i.get("marker"), !s) return herr("Listing in rendered markers without a marker - error"); | |
1538 | if (!i.get("newMarker") && !s.getMap()) return s.setMap(r.map) | |
1539 | } else if (i && i.get("isShortlisted")) { | |
1540 | if (i.set("removeMarker", !1), s = i.get("marker"), !s) return herr("Listing in rendered markers without a marker - error"); | |
1541 | if (!s.getMap()) return s.setMap(r.map) | |
1542 | } | |
1543 | } | |
1544 | }(this)) : void 0 | |
1545 | }, s.prototype.clean_rendered_markers_collection = function() { | |
1546 | var e; | |
1547 | return r.RenderedMarkers && (r.RenderedMarkers.each(function() { | |
1548 | return function(e) { | |
1549 | var t; | |
1550 | return e.get("removeMarker") ? (t = e.get("marker"), setTimeout(function() { | |
1551 | return t ? t.setMap(null) : void 0 | |
1552 | }, 0)) : void 0 | |
1553 | } | |
1554 | }(this)), e = r.RenderedMarkers.where({ | |
1555 | removeMarker: !0 | |
1556 | }), e.length) ? _.each(e, function() { | |
1557 | return function(e) { | |
1558 | return r.RenderedMarkers.remove(e) | |
1559 | } | |
1560 | }(this)) : void 0 | |
1561 | }, s.prototype.parse_and_update_bmc = function(e, t, i) { | |
1562 | return e && e.length ? _.each(e, function(e) { | |
1563 | return function(s) { | |
1564 | var n, o; | |
1565 | if (s && (o = e.parse_data_for_ref_id(parseInt(s), t)), n = r.AllBigMarkerListing.get(o.id), o && "add" === i) { | |
1566 | if (o.thumb_url || (o.thumb_url = "5ace9487/79590af9e38c2d1b3318548a0e7a9774/small_.jpg"), !n) return r.AllBigMarkerListing.add(o) | |
1567 | } else if (n && "remove" === i) return r.AllBigMarkerListing.remove(n) | |
1568 | } | |
1569 | }(this)) : void 0 | |
1570 | }, s.prototype.start_map = function() { | |
1571 | return this.shortlist_mode() ? (this.clearTilesOverlay(), this.refresh_map_view({ | |
1572 | zoom_to_fit_shortlist: !0 | |
1573 | })) : (this.delete_previous_tiles_and_setup(!0), this.refresh_map_view({ | |
1574 | zoom_to_fit: !0 | |
1575 | })), this.add_map_listener() | |
1576 | }, s.prototype.stop_map = function() { | |
1577 | return this.clearTilesOverlay(), this.remove_map_listener(), this.refresh_map_view({ | |
1578 | zoom_to_fit: !1 | |
1579 | }) | |
1580 | }, s.prototype.started_shortlist_mode = function() { | |
1581 | return this.clearTilesOverlay(), this.remove_map_listener(), this.refresh_map_view({ | |
1582 | zoom_to_fit_shortlist: !0 | |
1583 | }), this.listenTo(r.event, "completed:tile-marker-placement", this.remove_all_markers), this.remove_all_markers() | |
1584 | }, s.prototype.stopped_shortlist_mode = function() { | |
1585 | return this.stopListening(r.event, "completed:tile-marker-placement", this.remove_all_markers), this.add_map_listener(), this.delete_previous_tiles_and_setup(!0), this.refresh_map_view({ | |
1586 | zoom_to_fit: !0, | |
1587 | force: !0 | |
1588 | }) | |
1589 | }, s.prototype.remove_map_listener = function() { | |
1590 | return this.zoomListener && l.event.removeListener(this.zoomListener), this.panListener && l.event.removeListener(this.panListener), this.centerListener ? l.event.removeListener(this.centerListener) : void 0 | |
1591 | }, s.prototype.add_map_listener = function() { | |
1592 | return this.idle_listeners = {}, this.panListener = l.event.addListener(r.map, "dragend", function(e) { | |
1593 | return function() { | |
1594 | return e.add_idle_listener("dragIdleListener") | |
1595 | } | |
1596 | }(this)), this.centerListener = l.event.addListener(r.map, "center_changed", function(e) { | |
1597 | return function() { | |
1598 | return e.add_idle_listener("centerIdleListener") | |
1599 | } | |
1600 | }(this)), this.zoomListener = l.event.addListener(r.map, "zoom_changed", function(e) { | |
1601 | return function() { | |
1602 | return r.set_map_zoom && (r.map_zoom = r.map.getZoom(), r.set_map_zoom = !1), e.add_idle_listener("zoomIdleListener") | |
1603 | } | |
1604 | }(this)) | |
1605 | }, s.prototype.add_idle_listener = function(e) { | |
1606 | return this.idle_listeners[e] = l.event.addListener(r.map, "idle", function(t) { | |
1607 | return function() { | |
1608 | return t.remove_idle_listener(e), t.throttle_call_get_tiles_in_viewport() | |
1609 | } | |
1610 | }(this)) | |
1611 | }, s.prototype.remove_idle_listener = function(e) { | |
1612 | return this.idle_listeners[e] ? l.event.removeListener(this.idle_listeners[e]) : void 0 | |
1613 | }, s.prototype.showTilesOverlay = function() { | |
1614 | return r.map.overlayMapTypes.length ? void 0 : r.map.overlayMapTypes.push(r.RentBuyImageMapType) | |
1615 | }, s.prototype.clearTilesOverlay = function() { | |
1616 | return r.map.overlayMapTypes.length ? r.map.overlayMapTypes.clear() : void 0 | |
1617 | }, s.prototype.lat_lng_to_tile = function(e, t, i) { | |
1618 | var s, n, o, a, l; | |
1619 | return o = {}, n = Math.pow(2, i), a = Math.ceil(256 * (t / 360 * n + n / 2)), s = Math.sin(e * Math.PI / 180), -.9999 > s && (s = -.9999), s > .9999 && (s = .9999), l = Math.ceil(256 * (n / 2)) + .5 * Math.log((1 + s) / (1 - s)) * (-256 * n / (2 * Math.PI)), o.x = Math.floor(a / r.rent_buy_tile_size), o.y = Math.floor(l / r.rent_buy_tile_size), o | |
1620 | }, s.prototype.is_small_dot_inside = function(e, t) { | |
1621 | var i, s; | |
1622 | return null == t && (t = null), t && this.est_obj && "est" === this.options.filter_model.get("loct") && this.getDistanceFromLatLonInKm(t, this.est_obj.center) > this.est_obj.radius / 1e3 || t && "poly" === this.options.filter_model.get("loct") && !this.is_buffered() && !l.geometry.poly.containsLocation(t, this.polygon_obj) ? void 0 : r.AllBigMarkerListing.length && r.RenderedMarkers ? (i = r.AllBigMarkerListing.get(e), i || (s = r.RenderedMarkers.where({ | |
1623 | isShortlisted: !0 | |
1624 | }), _.each(s, function() { | |
1625 | return function(t) { | |
1626 | t.get("id") === e && (i = t) | |
1627 | } | |
1628 | }(this))), null === i || "undefined" == typeof i) : void 0 | |
1629 | }, s.prototype.check_for_points_inside = function(e) { | |
1630 | var t, r, i; | |
1631 | if (e) { | |
1632 | if (t = e.latitude, i = e.longitude, r = new l.LatLng(t, i), "poly" === this.options.filter_model.get("loct") && this.polygon_obj) return this.is_buffered() ? !0 : l.geometry.poly.containsLocation(r, this.polygon_obj); | |
1633 | if ("est" === this.options.filter_model.get("loct") && this.est_obj) return this.est_obj.getBounds().contains(r) && this.getDistanceFromLatLonInKm(r, this.est_obj.center) < parseInt(this.est_obj.radius) / 1e3 | |
1634 | } | |
1635 | return !1 | |
1636 | }, s.prototype.get_id_at_x_y = function(e, t, i) { | |
1637 | var s, n, o, a; | |
1638 | return i ? (a = i.data, n = r.TilesBytesConfig.interaction_byte_size, a ? (s = a.substr(t * (r.rent_buy_tile_size / r.rent_buy_elem_size) * n + e * n, n), o = r.decodeString(s)) : hlog("No data in tile")) : void 0 | |
1639 | }, s.prototype.get_big_tile_key = function(e) { | |
1640 | var t, i, s, n, o, a, l, h; | |
1641 | return e = e.split("_"), t = r.rent_buy_tile_size / r.rent_buy_subtile_size, o = parseInt(e[0]), l = parseInt(e[1]), n = Math.floor(o / t), a = Math.floor(l / t), h = parseInt(e[2]), s = r.get_tile_key(n, a, h, !0), i = l % t * t + o % t, [s, i] | |
1642 | }, s.prototype.parse_data_for_ref_id = function(e, t) { | |
1643 | var i, s, n, o, a, l, h, _, p, d, c, u, m, g; | |
1644 | if (g = r.RentBuyTilesData.getItem(t), g && (m = g.data), d = r.TilesBytesConfig.start_stop_byte_size, i = g.pointers.actual_data_starting, !m || !m.length) return herr("No data in tile"); | |
1645 | if (c = m.substr(g.pointers.start_stop_starting + 2 * (e - 1) * d, d), u = m.substr(g.pointers.start_stop_starting + 2 * (e - 1) * d + d, d), a = r.decodeString(c), l = r.decodeString(u), n = i + a, o = i + l, p = o - n, s = m.substr(n, p + 1), !s || "" === s) return !1; | |
1646 | try { | |
1647 | return _ = JSON.parse(s) | |
1648 | } catch (f) { | |
1649 | return h = f, herr("parsing error ", h, s) | |
1650 | } | |
1651 | }, s.prototype.draw_subtile = function(e) { | |
1652 | var t, i, s, n; | |
1653 | return s = this.get_big_tile_key(e), i = r.RentBuyTilesData.getItem(s[0]), i && i.data ? (t = this.get_subtile_ids(s), this.parse_and_update_bmc(t, s[0], "add"), this.fetching_count++, this.check_count_and_apply()) : (n = s[0], this.subtiles_to_be_drawn.push(e), -1 === this.tiles_xhr_made.indexOf(n) ? (this.tiles_xhr_count++, this.tiles_xhr_made.push(n), n && r.Track.track_log_tile_url(n), $.ajax({ | |
1654 | url: n, | |
1655 | type: "GET", | |
1656 | success: function(e) { | |
1657 | return function(t) { | |
1658 | var i; | |
1659 | return i = { | |
1660 | data: t | |
1661 | }, e.tiles_xhr_count--, n ? (r.RentBuyTilesData.setItem(n, i), r.get_starting_position(n), r.Util.removeItem(e.tiles_xhr_made, [n])) : herr("url called and its reference is missing: tile success"), 0 === e.tiles_xhr_count ? e.draw_all_subtiles(e.subtiles_to_be_drawn) : void 0 | |
1662 | } | |
1663 | }(this), | |
1664 | error: function() { | |
1665 | return function() { | |
1666 | return herr("error fetching data, subtile_id ", e) | |
1667 | } | |
1668 | }(this) | |
1669 | })) : void 0) | |
1670 | }, s.prototype.draw_all_subtiles = function(e) { | |
1671 | return this.subtiles_to_be_drawn = [], _.each(e, function(e) { | |
1672 | return function(t) { | |
1673 | return e.draw_subtile(t) | |
1674 | } | |
1675 | }(this)) | |
1676 | }, s.prototype.remove_subtile = function(e) { | |
1677 | var t, r; | |
1678 | return r = this.get_big_tile_key(e), t = this.get_subtile_ids(r), this.parse_and_update_bmc(t, r[0], "remove"), this.fetching_count++, this.check_count_and_apply() | |
1679 | }, s.prototype.get_subtile_ids = function(e) { | |
1680 | var t, i, s, n, o; | |
1681 | return null == e && (e = !1), e ? (n = e[0], s = e[1], o = r.RentBuyTilesData.getItem(n), o && o.pointers && o.pointers.subtile_data && (i = o.pointers.subtile_data[s], i && i.length) ? (t = i.split(","), t.pop(), t) : void 0) : herr("No data in tile") | |
1682 | }, s.prototype.destroy = function() { | |
1683 | return s.__super__.destroy.apply(this, arguments), this.destroyed = !0, l.event.removeListener(this.placesCircleCenterDragEndListener), l.event.removeListener(this.placesCircleScrubberDragEndListener), l.event.removeListener(this.placesCircleClickListener), this.options.rentals.off("id:selected", this.select_rental), this.stopListening(), this.idleListener && l.event.removeListener(this.idleListener), this.refresh_pan_listener && l.event.removeListener(this.refresh_pan_listener), this.remove_selected_marker(), this.remove_hover_marker(), this.remove_map_listener(), this.zoomIdleListener && l.event.removeListener(this.zoomIdleListener), this.centerIdleListener && l.event.removeListener(this.centerIdleListener), this.zoomIdleListener && l.event.removeListener(this.dragIdleListener), r.RenderedMarkers.each(function(e) { | |
1684 | var t; | |
1685 | return (t = e.get("marker")) ? (t.setMap(null), l.event.clearInstanceListeners(t), e.unset("marker")) : void 0 | |
1686 | }), r.RenderedMarkers.reset(), r.AllBigMarkerListing.reset(), this.clearTilesOverlay(), r.RentBuyTilesData.clear() | |
1687 | }, s | |
1688 | }(i) | |
1689 | }) | |
1690 | }.call(this), | |
1691 | function() { | |
1692 | var e = function(e, t) { | |
1693 | return function() { | |
1694 | return e.apply(t, arguments) | |
1695 | } | |
1696 | }, | |
1697 | t = function(e, t) { | |
1698 | function i() { | |
1699 | this.constructor = e | |
1700 | } | |
1701 | for (var s in t) r.call(t, s) && (e[s] = t[s]); | |
1702 | return i.prototype = t.prototype, e.prototype = new i, e.__super__ = t.prototype, e | |
1703 | }, | |
1704 | r = {}.hasOwnProperty; | |
1705 | define("backbone/views/map_view", ["backbone/assets", "backbone/views/common_map_view", "backbone/helpers/maps_util", "backbone/helpers/custom_circle"], function(r, i, s) { | |
1706 | var n, o, a; | |
1707 | return o = s.Maps, a = s.RichMarker, n = function(i) { | |
1708 | function s() { | |
1709 | return this.destroy = e(this.destroy, this), this.started_shortlist_mode = e(this.started_shortlist_mode, this), this.stopped_shortlist_mode = e(this.stopped_shortlist_mode, this), this.stop_map = e(this.stop_map, this), this.start_map = e(this.start_map, this), this.keepTopMarkers = e(this.keepTopMarkers, this), this.set_marker_visiblities = e(this.set_marker_visiblities, this), this.show_marker = e(this.show_marker, this), this.hide_marker = e(this.hide_marker, this), this.hide_all_markers = e(this.hide_all_markers, this), this.send_marker_to_back = e(this.send_marker_to_back, this), this.bring_marker_to_front = e(this.bring_marker_to_front, this), this.refresh_map_elems = e(this.refresh_map_elems, this), this.marker_click = e(this.marker_click, this), this.addOne = e(this.addOne, this), this.addAll = e(this.addAll, this), this.select_rental = e(this.select_rental, this), this.nearby_region_name = e(this.nearby_region_name, this), this.region_mode = e(this.region_mode, this), this.fit_map_to_shortlisted_markers = e(this.fit_map_to_shortlisted_markers, this), this.handle_click = e(this.handle_click, this), this.clear_earlier_markers = e(this.clear_earlier_markers, this), this.get_unhighlighted = e(this.get_unhighlighted, this), this.get_highlighted = e(this.get_highlighted, this), this.on_mouseenter_marker = e(this.on_mouseenter_marker, this), this.on_mouseleave_marker = e(this.on_mouseleave_marker, this), this.check_map_ready = e(this.check_map_ready, this), this.zoom_changed = e(this.zoom_changed, this), this.remove_all_shortlist_marker = e(this.remove_all_shortlist_marker, this), this.remove_one_shortlist_marker = e(this.remove_one_shortlist_marker, this), this.add_one_shortlist_marker = e(this.add_one_shortlist_marker, this), this.first_time_add_shortlisted_markers = e(this.first_time_add_shortlisted_markers, this), this.initialize = e(this.initialize, this), s.__super__.constructor.apply(this, arguments) | |
1710 | } | |
1711 | return t(s, i), s.prototype.el = ".map-view", s.prototype.type = "map", s.prototype.events = { | |
1712 | click: "handle_click", | |
1713 | "click .marker": "marker_click", | |
1714 | "mouseenter .marker": "on_mouseenter_marker", | |
1715 | "mouseleave .marker": "on_mouseleave_marker" | |
1716 | }, s.prototype.initialize = function() { | |
1717 | var e; | |
1718 | return s.__super__.initialize.apply(this, arguments), this.markers_remaining = 0, this.zoom_changed_listener = o.event.addListener(r.map, "zoom_changed", this.zoom_changed), e = this, this.listenTo(this.options.rentals, "id:selected", this.select_rental), this.listenTo(this.options.rentals, "reset", this.clear_earlier_markers), this.listenTo(this.options.filter_model, "completed:filtering", this.refresh_map_view), this.refresh_map_view({ | |
1719 | zoom_to_fit: !0, | |
1720 | force: !0 | |
1721 | }), this.first_time_add_shortlisted_markers(), this.checkMapReadyInterval = setInterval(this.check_map_ready, 100) | |
1722 | }, s.prototype.first_time_add_shortlisted_markers = function() { | |
1723 | var e; | |
1724 | return e = this.options.rentals.where({ | |
1725 | isShortlisted: !0 | |
1726 | }), _.each(e, function(e) { | |
1727 | return function(t) { | |
1728 | return e.add_one_shortlist_marker(t) | |
1729 | } | |
1730 | }(this)) | |
1731 | }, s.prototype.add_one_shortlist_marker = function(e) { | |
1732 | var t, i, s, n, l; | |
1733 | return e && (t = "INACTIVE" === e.get("status"), !t) ? (l = this.options.rentals.get(e.get("id")), l ? l.set("isShortlisted", !0) : (this.options.rentals.add(e.clone(), { | |
1734 | merge: !0 | |
1735 | }), l = this.options.rentals.get(e.get("id"))), i = l.get("marker"), i ? i.setMap(r.map) : (n = new o.LatLng(l.get("latitude"), l.get("longitude")), s = r.Util.get_new_marker_div(l.toJSON()), i = new a({ | |
1736 | position: n, | |
1737 | map: r.map, | |
1738 | draggable: !1, | |
1739 | content: s, | |
1740 | id: l.id | |
1741 | }), i.setColor(l.get("sort_color")), l.set("marker", i)), (r.Util.is_service("pg") || r.Util.is_service("serviced-apartments")) && i.addState(r.MarkerStates.PGMarker), r.Util.add_shortlist_marker_state(i)) : void 0 | |
1742 | }, s.prototype.remove_one_shortlist_marker = function(e) { | |
1743 | var t, i; | |
1744 | if (e && (i = this.options.rentals.get(e.get("id")))) | |
1745 | if (t = i.get("marker"), this.options.get_listings_mode("shortlist")) { | |
1746 | if (t) return t.setMap(null) | |
1747 | } else { | |
1748 | if (i.get("fromFilter")) return r.Util.remove_shortlist_marker_state(t); | |
1749 | if (t) return t.setMap(null) | |
1750 | } | |
1751 | }, s.prototype.remove_all_shortlist_marker = function() { | |
1752 | var e; | |
1753 | return e = this.options.rentals.where({ | |
1754 | isShortlisted: !0 | |
1755 | }), _.each(e, function(e) { | |
1756 | return function(t) { | |
1757 | return e.remove_one_shortlist_marker(t) | |
1758 | } | |
1759 | }(this)) | |
1760 | }, s.prototype.zoom_changed = function() { | |
1761 | return this.listener && o.event.removeListener(this.listener), this.listener = o.event.addListener(r.map, "idle", this.set_marker_visiblities) | |
1762 | }, s.prototype.check_map_ready = function() { | |
1763 | this.projection_used_once && clearInterval(this.checkMapReadyInterval) | |
1764 | }, s.prototype.on_mouseleave_marker = function(e) { | |
1765 | var t, r; | |
1766 | return t = $(e.currentTarget).data().id, this.get_unhighlighted(t), r = this, clearTimeout(r.track_var) | |
1767 | }, s.prototype.on_mouseenter_marker = function(e) { | |
1768 | var t, i, s, n, o; | |
1769 | return t = $(e.currentTarget).data().id, this.get_highlighted(t), s = this.options.rentals.get(t), i = s.get("marker"), s && (n = s.id), i && (o = i.hasState(r.MarkerStates.WasRemoved)), this.track_var = setTimeout(function() { | |
1770 | return function() { | |
1771 | return s && i ? r.Track.track_marker_hover(n, o) : void 0 | |
1772 | } | |
1773 | }(this), 3e3) | |
1774 | }, s.prototype.get_highlighted = function(e) { | |
1775 | var t, i; | |
1776 | return null != this.options.rentals && (i = this.options.rentals.get(e)), i && (t = i.get("marker"), t && (r.Util.add_hover_state(t), i.get("removed") && (t.addState(r.MarkerStates.WasRemoved), t.removeState(r.MarkerStates.Removed)), i.get("fromFilter") === !0 && i)) ? r.event.trigger("show:sort_position", i) : void 0 | |
1777 | }, s.prototype.get_unhighlighted = function(e) { | |
1778 | var t, i; | |
1779 | return null != this.options.rentals && (i = this.options.rentals.get(e)), r.event.trigger("hide:sort_position"), i && (t = i.get("marker"), t && (r.Util.remove_hover_state(t), i.get("removed"))) ? (t.removeState(r.MarkerStates.WasRemoved), t.addState(r.MarkerStates.Removed)) : void 0 | |
1780 | }, s.prototype.clear_earlier_markers = function(e, t) { | |
1781 | return this.markers_remaining = 0, _.each(t.previousModels, function(e) { | |
1782 | var t; | |
1783 | return (t = e.get("marker")) ? (t.setMap(null), o.event.clearInstanceListeners(t), e.unset("marker")) : void 0 | |
1784 | }) | |
1785 | }, s.prototype.handle_click = function(e) { | |
1786 | return this.ignore_map_click || this.check_search_here(e), this.ignore_map_click = !1, !0 | |
1787 | }, s.prototype.fit_map_to_shortlisted_markers = function() { | |
1788 | var e, t; | |
1789 | return t = this.options.rentals.where({ | |
1790 | isShortlisted: !0 | |
1791 | }), e = new o.LatLngBounds, _.each(t, function(t) { | |
1792 | var r; | |
1793 | return r = t.get("marker"), r ? e.extend(r.getPosition()) : void 0 | |
1794 | }), e.isEmpty() ? void 0 : r.map.fitBounds(e) | |
1795 | }, s.prototype.region_mode = function() { | |
1796 | return r.filters.get("region_select_mode") | |
1797 | }, s.prototype.nearby_region_name = function() { | |
1798 | return r.filters.get("nearby").name | |
1799 | }, s.prototype.select_rental = function(e) { | |
1800 | var t, i, s, n, o, a, l, h; | |
1801 | return l = this, h = r.map.getZoom(), t = { | |
1802 | top: 50, | |
1803 | left: 50, | |
1804 | bottom: -50, | |
1805 | right: -($(".info-window").width() + 50) | |
1806 | }, null !== e["new"] && (i = this.options.rentals.get(e["new"])), i && (s = i.get("marker")), s && r.Util.add_selected_marker_state(s), s && (a = i.get("marker").getPosition()), a && r.map.set_map_center(a, !1, t), null !== e.old && (n = this.options.rentals.get(e.old)), n && (o = n.get("marker")), o && r.Util.remove_selected_marker_state(o), hlog("called from select_rental") | |
1807 | }, s.prototype.addAll = function() { | |
1808 | return r.map_fragment = document.createDocumentFragment(), this.options.rentals.length && this.options.rentals.each(this.addOne), this.options.filter_model.trigger("refresh:heat-bar", !0), setTimeout(function() { | |
1809 | return function() { | |
1810 | return o.event.trigger(r.map, "resize") | |
1811 | } | |
1812 | }(this), 2e3) | |
1813 | }, s.prototype.addOne = function(e) { | |
1814 | var t, i, s; | |
1815 | return e.get("marker") ? (t = e.get("marker"), void(this.options.get_listings_mode("shortlist") ? t.setColor(null) : e.get("sort_color") && t.setColor(e.get("sort_color")))) : (s = new o.LatLng(e.get("latitude"), e.get("longitude")), i = r.Util.get_new_marker_div(e.toJSON()), t = new a({ | |
1816 | position: s, | |
1817 | map: null, | |
1818 | draggable: !1, | |
1819 | content: i, | |
1820 | id: e.id, | |
1821 | bulkAdd: !0 | |
1822 | }), e.get("isShortlisted") === !0 && r.Util.add_shortlist_marker_state(t), e.get("fromFilter") === !0 && t.addState(r.MarkerStates.Filtered), t.setColor(e.get("sort_color")), e.get("seen") && t.addState(r.MarkerStates.Seen), r.Util.is_service("pg") && ("Boys" === e.get("available_for_type") ? t.addState(r.MarkerStates.Male) : "Girls" === e.get("available_for_type") ? t.addState(r.MarkerStates.Female) : "Both" === e.get("available_for_type") && t.addState(r.MarkerStates.MaleFemale), t.addState(r.MarkerStates.PGMarker)), r.Util.is_service("serviced-apartments") && t.addState(r.MarkerStates.PGMarker), e.on("change:seen", this.add_seen), e.set("marker", t), o.event.addListenerOnce(t, "ready", function(e) { | |
1823 | return function() { | |
1824 | return e.markers_remaining--, t.counted = !0, 0 === e.markers_remaining ? (r.map_pane.appendChild(r.map_fragment), r.map_fragment = document.createDocumentFragment()) : void 0 | |
1825 | } | |
1826 | }(this))) | |
1827 | }, s.prototype.add_seen = function(e) { | |
1828 | return e && e.get("marker") ? e.get("marker").addState(r.MarkerStates.Seen) : void 0 | |
1829 | }, s.prototype.marker_click = function(e) { | |
1830 | var t, i; | |
1831 | return t = parseInt($(e.currentTarget).data().id), this.options.get_listings_mode("shortlist") === !0 ? (i = r.listings.get(t), r.router.goto_url(t === this.options.rentals.getSelected() ? r.router.get_url_till_shortlist() : r.router.get_url_till_shortlist_id(t))) : r.router.goto_url(t === this.options.rentals.getSelected() ? r.router.get_url_till_filter() : r.router.get_url_till_flat_id(t)), r.Track.track_open_info_window(t, "map", {}) | |
1832 | }, s.prototype.refresh_map_elems = function() { | |
1833 | return "poly" === this.options.filter_model.get("loct") ? this.refresh_polygon() : "est" === this.options.filter_model.get("loct") ? this.refresh_est_circle() : void 0 | |
1834 | }, s.prototype.bring_marker_to_front = function(e) { | |
1835 | var t; | |
1836 | return t = this, | |
1837 | function() { | |
1838 | return function() { | |
1839 | var r, i, s, n; | |
1840 | return i = e.get("locality"), r = t.options.locality_map.where({ | |
1841 | name: i | |
1842 | })[0], n = r.get("map_polygon"), s = e.get("marker"), s.setZIndex(o.Marker.MAX_ZINDEX + 1) | |
1843 | } | |
1844 | }(this) | |
1845 | }, s.prototype.send_marker_to_back = function(e) { | |
1846 | var t; | |
1847 | return t = this, | |
1848 | function() { | |
1849 | return function() { | |
1850 | var r, i, s, n; | |
1851 | return i = e.get("locality"), r = t.options.locality_map.where({ | |
1852 | name: i | |
1853 | })[0], n = r.get("map_polygon"), s = e.get("marker"), s.setZIndex(o.Marker.MAX_ZINDEX - 10) | |
1854 | } | |
1855 | }(this) | |
1856 | }, s.prototype.hide_all_markers = function(e) { | |
1857 | var t; | |
1858 | return null == e && (e = !1), t = this, this.options.rentals.each(function(r) { | |
1859 | return e && r.get("isShortlisted") ? t.show_marker(r) : t.hide_marker(r) | |
1860 | }) | |
1861 | }, s.prototype.hide_marker = function(e) { | |
1862 | var t; | |
1863 | return e && (t = e.get("marker"), t && t.getMap() && (t.setMap(null), !t.counted)) ? this.markers_remaining-- : void 0 | |
1864 | }, s.prototype.show_marker = function(e, t) { | |
1865 | var i; | |
1866 | return null == t && (t = !1), e ? (i = e.attributes, !i.marker || i.visibility !== !0 || i.isShortlisted !== !0 && i.fromFilter !== !0 ? this.hide_marker(e) : (i.marker.getMap() || (i.marker.counted || this.markers_remaining++, i.marker.setMap(r.map), i.marker.setVisible(!0)), t ? i.marker.addState(r.MarkerStates.Removed) : i.marker.removeState(r.MarkerStates.Removed))) : void 0 | |
1867 | }, s.prototype.set_marker_visiblities = function() { | |
1868 | var e, t, i; | |
1869 | return this.listener && o.event.removeListener(this.listener), this.poi_mode() ? void 0 : this.options.get_listings_mode("shortlist") ? (i = this.options.rentals.where({ | |
1870 | isShortlisted: !0 | |
1871 | }), void _.each(i, function(e) { | |
1872 | return e.get("marker") && e.get("marker").removeState(r.MarkerStates.Removed), e.set("removed", !1) | |
1873 | })) : (this.options.rentals.each(function() { | |
1874 | return function(e) { | |
1875 | return e.unset("removed") | |
1876 | } | |
1877 | }(this)), e = 0, t = 0, this.options.rentals.each(function(r) { | |
1878 | return function(i) { | |
1879 | return i.get("hidden") ? r.hide_marker(i) : i.get("removed") ? (t++, r.show_marker(i, !0)) : (e++, r.show_marker(i)) | |
1880 | } | |
1881 | }(this)), hlog(e + t + " markers seen, " + e + " complete markers, " + t + " markers seen as dots at zoom level " + r.map.getZoom())) | |
1882 | }, s.prototype.keepTopMarkers = function(e) { | |
1883 | return e.length > 1 ? (this.max_factor = null, _.each(e, function(e) { | |
1884 | return function(t) { | |
1885 | var r; | |
1886 | return r = e.options.rentals.get(t.id).get("freshness_index"), e.max_factor ? r > e.max_factor ? (e.max_factor = r, e.best_rental_id = t.id) : void 0 : (e.best_rental_id = t.id, e.max_factor = r) | |
1887 | } | |
1888 | }(this)), _.each(e, function(e) { | |
1889 | return function(t) { | |
1890 | var r; | |
1891 | return t.id === e.best_rental_id || (r = e.options.rentals.get(t.id), r.get("isShortlisted")) ? void 0 : r.set("removed", !0) | |
1892 | } | |
1893 | }(this))) : void 0 | |
1894 | }, s.prototype.start_map = function() { | |
1895 | return hlog("start_map called"), this.options.get_listings_mode("shortlist") ? this.hide_all_markers(!0) : (this.set_marker_visiblities(), this.est_obj.show(), this.donut.setPaths(this.get_donut_paths()), this.donut.setMap(r.map)) | |
1896 | }, s.prototype.stop_map = function() { | |
1897 | return hlog("stop_map called"), this.est_obj.hide(), this.hide_all_markers(), this.donut.setMap(null) | |
1898 | }, s.prototype.stopped_shortlist_mode = function() { | |
1899 | return this.refresh_map_view({ | |
1900 | zoom_to_fit: !0, | |
1901 | force: !0 | |
1902 | }) | |
1903 | }, s.prototype.started_shortlist_mode = function() { | |
1904 | return this.refresh_map_view({ | |
1905 | zoom_to_fit_shortlist: !0 | |
1906 | }) | |
1907 | }, s.prototype.destroy = function() { | |
1908 | return s.__super__.destroy.apply(this, arguments), clearInterval(this.checkMapReadyInterval), o.event.removeListener(this.placesCircleCenterDragEndListener), o.event.removeListener(this.placesCircleScrubberDragEndListener), o.event.removeListener(this.placesCircleClickListener), o.event.removeListener(this.zoom_changed_listener), this.stopListening(), hlog("destroying markers"), this.options.rentals.each(function(e) { | |
1909 | var t; | |
1910 | return (t = e.get("marker")) ? (t.setMap(null), o.event.clearInstanceListeners(t), e.unset("marker")) : void 0 | |
1911 | }), this.$el.removeData().unbind() | |
1912 | }, s | |
1913 | }(i) | |
1914 | }) | |
1915 | }.call(this), | |
1916 | function() { | |
1917 | var e = function(e, t) { | |
1918 | return function() { | |
1919 | return e.apply(t, arguments) | |
1920 | } | |
1921 | }, | |
1922 | t = function(e, t) { | |
1923 | function i() { | |
1924 | this.constructor = e | |
1925 | } | |
1926 | for (var s in t) r.call(t, s) && (e[s] = t[s]); | |
1927 | return i.prototype = t.prototype, e.prototype = new i, e.__super__ = t.prototype, e | |
1928 | }, | |
1929 | r = {}.hasOwnProperty; | |
1930 | define("backbone/views/pg/map_view", ["backbone/assets", "backbone/views/tile_map_view", "backbone/helpers/maps", "backbone/views/map_view"], function(r, i, s, n) { | |
1931 | var o; | |
1932 | return n = -1 !== r.tiling_services.indexOf("pg") ? i : n, o = function(r) { | |
1933 | function i() { | |
1934 | return this.initialize = e(this.initialize, this), i.__super__.constructor.apply(this, arguments) | |
1935 | } | |
1936 | return t(i, r), i.prototype.initialize = function() { | |
1937 | return i.__super__.initialize.apply(this, arguments), hlog("PG Map View init") | |
1938 | }, i | |
1939 | }(n) | |
1940 | }) | |
1941 | }.call(this); | |
1942 | //# sourceMappingURL=https://assets-sources.housingcdn.com/website/javascripts/backbone/views/pg/map_view-32e453a73b94a961763c5332a81e82d8.js.map |