PageSourceSearch

https://www.vilniusyramokykla.lt/modules/Zemelapis/lib/infobox.js

js vilniusyramokykla.lt collected 2026-10-08 08:08:52 UTC 26,108 bytes, 828 lines download raw bytes

vendor: 9,445 bytes, lines 1-232
1/**
2 * @name InfoBox
3 * @version 1.1.13 [March 19, 2014]
4 * @author Gary Little (inspired by proof-of-concept code from Pamela Fox of Google)
5 * @copyright Copyright 2010 Gary Little [gary at luxcentral.com]
6 * @fileoverview InfoBox extends the Google Maps JavaScript API V3 <tt>OverlayView</tt> class.
7 *  <p>
8 *  An InfoBox behaves like a <tt>google.maps.InfoWindow</tt>, but it supports several
9 *  additional properties for advanced styling. An InfoBox can also be used as a map label.
10 *  <p>
11 *  An InfoBox also fires the same events as a <tt>google.maps.InfoWindow</tt>.
12 */
13
14/*!
15 *
16 * Licensed under the Apache License, Version 2.0 (the "License");
17 * you may not use this file except in compliance with the License.
18 * You may obtain a copy of the License at
19 *
20 *       http://www.apache.org/licenses/LICENSE-2.0
21 *
22 * Unless required by applicable law or agreed to in writing, software
23 * distributed under the License is distributed on an "AS IS" BASIS,
24 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25 * See the License for the specific language governing permissions and
26 * limitations under the License.
27 */
28
29/*jslint browser:true */
30/*global google */
31
32/**
33 * @name InfoBoxOptions
34 * @class This class represents the optional parameter passed to the {@link InfoBox} constructor.
35 * @property {string|Node} content The content of the InfoBox (plain text or an HTML DOM node).
36 * @property {boolean} [disableAutoPan=false] Disable auto-pan on <tt>open</tt>.
37 * @property {number} maxWidth The maximum width (in pixels) of the InfoBox. Set to 0 if no maximum.
38 * @property {Size} pixelOffset The offset (in pixels) from the top left corner of the InfoBox
39 *  (or the bottom left corner if the <code>alignBottom</code> property is <code>true</code>)
40 *  to the map pixel corresponding to <tt>position</tt>.
41 * @property {LatLng} position The geographic location at which to display the InfoBox.
42 * @property {number} zIndex The CSS z-index style value for the InfoBox.
43 *  Note: This value overrides a zIndex setting specified in the <tt>boxStyle</tt> property.
44 * @property {string} [boxClass="infoBox"] The name of the CSS class defining the styles for the InfoBox container.
45 * @property {Object} [boxStyle] An object literal whose properties define specific CSS
46 *  style values to be applied to the InfoBox. Style values defined here override those that may
47 *  be defined in the <code>boxClass</code> style sheet. If this property is changed after the
48 *  InfoBox has been created, all previously set styles (except those defined in the style sheet)
49 *  are removed from the InfoBox before the new style values are applied.
50 * @property {string} closeBoxMargin The CSS margin style value for the close box.
51 *  The default is "2px" (a 2-pixel margin on all sides).
52 * @property {string} closeBoxURL The URL of the image representing the close box.
53 *  Note: The default is the URL for Google's standard close box.
54 *  Set this property to "" if no close box is required.
55 * @property {Size} infoBoxClearance Minimum offset (in pixels) from the InfoBox to the
56 *  map edge after an auto-pan.
57 * @property {boolean} [isHidden=false] Hide the InfoBox on <tt>open</tt>.
58 *  [Deprecated in favor of the <tt>visible</tt> property.]
59 * @property {boolean} [visible=true] Show the InfoBox on <tt>open</tt>.
60 * @property {boolean} alignBottom Align the bottom left corner of the InfoBox to the <code>position</code>
61 *  location (default is <tt>false</tt> which means that the top left corner of the InfoBox is aligned).
62 * @property {string} pane The pane where the InfoBox is to appear (default is "floatPane").
63 *  Set the pane to "mapPane" if the InfoBox is being used as a map label.
64 *  Valid pane names are the property names for the <tt>google.maps.MapPanes</tt> object.
65 * @property {boolean} enableEventPropagation Propagate mousedown, mousemove, mouseover, mouseout,
66 *  mouseup, click, dblclick, touchstart, touchend, touchmove, and contextmenu events in the InfoBox
67 *  (default is <tt>false</tt> to mimic the behavior of a <tt>google.maps.InfoWindow</tt>). Set
68 *  this property to <tt>true</tt> if the InfoBox is being used as a map label.
69 */
70
71/**
72 * Creates an InfoBox with the options specified in {@link InfoBoxOptions}.
73 *  Call <tt>InfoBox.open</tt> to add the box to the map.
74 * @constructor
75 * @param {InfoBoxOptions} [opt_opts]
76 */
77function InfoBox(opt_opts) {
78
79    opt_opts = opt_opts || {};
80
81    google.maps.OverlayView.apply(this, arguments);
82
83    // Standard options (in common with google.maps.InfoWindow):
84    //
85    this.content_ = opt_opts.content || "";
86    this.disableAutoPan_ = opt_opts.disableAutoPan || false;
87    this.maxWidth_ = opt_opts.maxWidth || 0;
88    this.pixelOffset_ = opt_opts.pixelOffset || new google.maps.Size(0, 0);
89    this.position_ = opt_opts.position || new google.maps.LatLng(0, 0);
90    this.zIndex_ = opt_opts.zIndex || null;
91
92    // Additional options (unique to InfoBox):
93    //
94    this.boxClass_ = opt_opts.boxClass || "infoBox";
95    this.boxStyle_ = opt_opts.boxStyle || {};
96    this.closeBoxMargin_ = opt_opts.closeBoxMargin || "2px";
97    this.closeBoxURL_ = opt_opts.closeBoxURL || "http://www.google.com/intl/en_us/mapfiles/close.gif";
98    if (opt_opts.closeBoxURL === "") {
99        this.closeBoxURL_ = "";
100    }
101    this.infoBoxClearance_ = opt_opts.infoBoxClearance || new google.maps.Size(1, 1);
102
103    if (typeof opt_opts.visible === "undefined") {
104        if (typeof opt_opts.isHidden === "undefined") {
105            opt_opts.visible = true;
106        } else {
107            opt_opts.visible = !opt_opts.isHidden;
108        }
109    }
110    this.isHidden_ = !opt_opts.visible;
111
112    this.alignBottom_ = opt_opts.alignBottom || false;
113    this.pane_ = opt_opts.pane || "floatPane";
114    this.enableEventPropagation_ = opt_opts.enableEventPropagation || false;
115
116    this.div_ = null;
117    this.closeListener_ = null;
118    this.moveListener_ = null;
119    this.mapListener_ = null;
120    this.contextListener_ = null;
121    this.eventListeners_ = null;
122    this.fixedWidthSet_ = null;
123}
124
125/* InfoBox extends OverlayView in the Google Maps API v3.
126 */
127InfoBox.prototype = new google.maps.OverlayView();
128
129/**
130 * Creates the DIV representing the InfoBox.
131 * @private
132 */
133InfoBox.prototype.createInfoBoxDiv_ = function () {
134
135    var i;
136    var events;
137    var bw;
138    var me = this;
139
140    // This handler prevents an event in the InfoBox from being passed on to the map.
141    //
142    var cancelHandler = function (e) {
143        e.cancelBubble = true;
144        if (e.stopPropagation) {
145            e.stopPropagation();
146        }
147    };
148
149    // This handler ignores the current event in the InfoBox and conditionally prevents
150    // the event from being passed on to the map. It is used for the contextmenu event.
151    //
152    var ignoreHandler = function (e) {
153
154        e.returnValue = false;
155
156        if (e.preventDefault) {
157
158            e.preventDefault();
159        }
160
161        if (!me.enableEventPropagation_) {
162
163            cancelHandler(e);
164        }
165    };
166
167    if (!this.div_) {
168
169        this.div_ = document.createElement("div");
170
171        this.setBoxStyle_();
172
173        if (typeof this.content_.nodeType === "undefined") {
174            this.div_.innerHTML = this.getCloseBoxImg_() + this.content_;
175        } else {
176            this.div_.innerHTML = this.getCloseBoxImg_();
177            this.div_.appendChild(this.content_);
178        }
179
180        // Add the InfoBox DIV to the DOM
181        this.getPanes()[this.pane_].appendChild(this.div_);
182
183        this.addClickHandler_();
184
185        if (this.div_.style.width) {
186
187            this.fixedWidthSet_ = true;
188
189        } else {
190
191            if (this.maxWidth_ !== 0 && this.div_.offsetWidth > this.maxWidth_) {
192
193                this.div_.style.width = this.maxWidth_;
194                this.div_.style.overflow = "auto";
195                this.fixedWidthSet_ = true;
196
197            } else { // The following code is needed to overcome problems with MSIE
198
199                bw = this.getBoxWidths_();
200
201                this.div_.style.width = (this.div_.offsetWidth - bw.left - bw.right) + "px";
202                this.fixedWidthSet_ = false;
203            }
204        }
205
206        this.panBox_(this.disableAutoPan_);
207
208        if (!this.enableEventPropagation_) {
209
210            this.eventListeners_ = [];
211
212            // Cancel event propagation.
213            //
214            // Note: mousemove not included (to resolve Issue 152)
215            events = ["mousedown", "mouseover", "mouseout", "mouseup",
216                "click", "dblclick", "touchstart", "touchend", "touchmove"];
217
218            for (i = 0; i < events.length; i++) {
219
220                this.eventListeners_.push(google.maps.event.addDomListener(this.div_, events[i], cancelHandler));
221            }
222
223            // Workaround for Google bug that causes the cursor to change to a pointer
224            // when the mouse moves over a marker underneath InfoBox.
225            this.eventListeners_.push(google.maps.event.addDomListener(this.div_, "mouseover", function (e) {
226                this.style.cursor = "default";
227            }));
228        }
229
230        this.contextListener_ = google.maps.event.addDomListener(this.div_, "contextmenu", ignoreHandler);
231
232        /**
233         * This event is fired when the DIV containing the InfoBox's content is attached to the DOM.
234         * @name InfoBox#domready
235         * @event
236         */
237        google.maps.event.trigger(this, "domready");
238    }
239};
240
241/**
242 * Returns the HTML <IMG> tag for the close box.
243 * @private
244 */
245InfoBox.prototype.getCloseBoxImg_ = function () {
246
247    var img = "";
248
249    if (this.closeBoxURL_ !== "") {
250
251        img = "<img";
252        img += " src='" + this.closeBoxURL_ + "'";
253        img += " align=right"; // Do this because Opera chokes on style='float: right;'
254        img += " style='";
255        img += " position: relative;"; // Required by MSIE
256        img += " cursor: pointer;";
257        img += " margin: " + this.closeBoxMargin_ + ";";
258        img += "'>";
259    }
260
261    return img;
262};
263
264/**
265 * Adds the click handler to the InfoBox close box.
266 * @private
267 */
268InfoBox.prototype.addClickHandler_ = function () {
269
270    var closeBox;
271
272    if (this.closeBoxURL_ !== "") {
273
274        closeBox = this.div_.firstChild;
275        this.closeListener_ = google.maps.event.addDomListener(closeBox, "click", this.getCloseClickHandler_());
276
277    } else {
278
279        this.closeListener_ = null;
280    }
281};
282
283/**
284 * Returns the function to call when the user clicks the close box of an InfoBox.
285 * @private
286 */
287InfoBox.prototype.getCloseClickHandler_ = function () {
288
289    var me = this;
290
291    return function (e) {
292
293        // 1.0.3 fix: Always prevent propagation of a close box click to the map:
294        e.cancelBubble = true;
295
296        if (e.stopPropagation) {
297
298            e.stopPropagation();
299        }
300
301        /**
302         * This event is fired when the InfoBox's close box is clicked.
303         * @name InfoBox#closeclick
304         * @event
305         */
306        google.maps.event.trigger(me, "closeclick");
307
308        me.close();
309    };
310};
vendor: 9,653 bytes, lines 311-611
311
312/**
313 * Pans the map so that the InfoBox appears entirely within the map's visible area.
314 * @private
315 */
316InfoBox.prototype.panBox_ = function (disablePan) {
317
318    var map;
319    var bounds;
320    var xOffset = 0, yOffset = 0;
321
322    if (!disablePan) {
323
324        map = this.getMap();
325
326        if (map instanceof google.maps.Map) { // Only pan if attached to map, not panorama
327
328            if (!map.getBounds().contains(this.position_)) {
329                // Marker not in visible area of map, so set center
330                // of map to the marker position first.
331                map.setCenter(this.position_);
332            }
333
334            bounds = map.getBounds();
335
336            var mapDiv = map.getDiv();
337            var mapWidth = mapDiv.offsetWidth;
338            var mapHeight = mapDiv.offsetHeight;
339            var iwOffsetX = this.pixelOffset_.width;
340            var iwOffsetY = this.pixelOffset_.height;
341            var iwWidth = this.div_.offsetWidth;
342            var iwHeight = this.div_.offsetHeight;
343            var padX = this.infoBoxClearance_.width;
344            var padY = this.infoBoxClearance_.height;
345            var pixPosition = this.getProjection().fromLatLngToContainerPixel(this.position_);
346
347            if (pixPosition.x < (-iwOffsetX + padX)) {
348                xOffset = pixPosition.x + iwOffsetX - padX;
349            } else if ((pixPosition.x + iwWidth + iwOffsetX + padX) > mapWidth) {
350                xOffset = pixPosition.x + iwWidth + iwOffsetX + padX - mapWidth;
351            }
352            if (this.alignBottom_) {
353                if (pixPosition.y < (-iwOffsetY + padY + iwHeight)) {
354                    yOffset = pixPosition.y + iwOffsetY - padY - iwHeight;
355                } else if ((pixPosition.y + iwOffsetY + padY) > mapHeight) {
356                    yOffset = pixPosition.y + iwOffsetY + padY - mapHeight;
357                }
358            } else {
359                if (pixPosition.y < (-iwOffsetY + padY)) {
360                    yOffset = pixPosition.y + iwOffsetY - padY;
361                } else if ((pixPosition.y + iwHeight + iwOffsetY + padY) > mapHeight) {
362                    yOffset = pixPosition.y + iwHeight + iwOffsetY + padY - mapHeight;
363                }
364            }
365
366            if (!(xOffset === 0 && yOffset === 0)) {
367
368                // Move the map to the shifted center.
369                //
370                var c = map.getCenter();
371                map.panBy(xOffset, yOffset);
372            }
373        }
374    }
375};
376
377/**
378 * Sets the style of the InfoBox by setting the style sheet and applying
379 * other specific styles requested.
380 * @private
381 */
382InfoBox.prototype.setBoxStyle_ = function () {
383
384    var i, boxStyle;
385
386    if (this.div_) {
387
388        // Apply style values from the style sheet defined in the boxClass parameter:
389        this.div_.className = this.boxClass_;
390
391        // Clear existing inline style values:
392        this.div_.style.cssText = "";
393
394        // Apply style values defined in the boxStyle parameter:
395        boxStyle = this.boxStyle_;
396        for (i in boxStyle) {
397
398            if (boxStyle.hasOwnProperty(i)) {
399
400                this.div_.style[i] = boxStyle[i];
401            }
402        }
403
404        // Fix for iOS disappearing InfoBox problem.
405        // See http://stackoverflow.com/questions/9229535/google-maps-markers-disappear-at-certain-zoom-level-only-on-iphone-ipad
406        this.div_.style.WebkitTransform = "translateZ(0)";
407
408        // Fix up opacity style for benefit of MSIE:
409        //
410        if (typeof this.div_.style.opacity !== "undefined" && this.div_.style.opacity !== "") {
411            // See http://www.quirksmode.org/css/opacity.html
412            this.div_.style.MsFilter = "\"progid:DXImageTransform.Microsoft.Alpha(Opacity=" + (this.div_.style.opacity * 100) + ")\"";
413            this.div_.style.filter = "alpha(opacity=" + (this.div_.style.opacity * 100) + ")";
414        }
415
416        // Apply required styles:
417        //
418        this.div_.style.position = "absolute";
419        this.div_.style.visibility = 'hidden';
420        if (this.zIndex_ !== null) {
421
422            this.div_.style.zIndex = this.zIndex_;
423        }
424    }
425};
426
427/**
428 * Get the widths of the borders of the InfoBox.
429 * @private
430 * @return {Object} widths object (top, bottom left, right)
431 */
432InfoBox.prototype.getBoxWidths_ = function () {
433
434    var computedStyle;
435    var bw = {top: 0, bottom: 0, left: 0, right: 0};
436    var box = this.div_;
437
438    if (document.defaultView && document.defaultView.getComputedStyle) {
439
440        computedStyle = box.ownerDocument.defaultView.getComputedStyle(box, "");
441
442        if (computedStyle) {
443
444            // The computed styles are always in pixel units (good!)
445            bw.top = parseInt(computedStyle.borderTopWidth, 10) || 0;
446            bw.bottom = parseInt(computedStyle.borderBottomWidth, 10) || 0;
447            bw.left = parseInt(computedStyle.borderLeftWidth, 10) || 0;
448            bw.right = parseInt(computedStyle.borderRightWidth, 10) || 0;
449        }
450
451    } else if (document.documentElement.currentStyle) { // MSIE
452
453        if (box.currentStyle) {
454
455            // The current styles may not be in pixel units, but assume they are (bad!)
456            bw.top = parseInt(box.currentStyle.borderTopWidth, 10) || 0;
457            bw.bottom = parseInt(box.currentStyle.borderBottomWidth, 10) || 0;
458            bw.left = parseInt(box.currentStyle.borderLeftWidth, 10) || 0;
459            bw.right = parseInt(box.currentStyle.borderRightWidth, 10) || 0;
460        }
461    }
462
463    return bw;
464};
465
466/**
467 * Invoked when <tt>close</tt> is called. Do not call it directly.
468 */
469InfoBox.prototype.onRemove = function () {
470
471    if (this.div_) {
472
473        this.div_.parentNode.removeChild(this.div_);
474        this.div_ = null;
475    }
476};
477
478/**
479 * Draws the InfoBox based on the current map projection and zoom level.
480 */
481InfoBox.prototype.draw = function () {
482
483    this.createInfoBoxDiv_();
484
485    var pixPosition = this.getProjection().fromLatLngToDivPixel(this.position_);
486
487    this.div_.style.left = (pixPosition.x + this.pixelOffset_.width) + "px";
488
489    if (this.alignBottom_) {
490        this.div_.style.bottom = -(pixPosition.y + this.pixelOffset_.height) + "px";
491    } else {
492        this.div_.style.top = (pixPosition.y + this.pixelOffset_.height) + "px";
493    }
494
495    if (this.isHidden_) {
496
497        this.div_.style.visibility = "hidden";
498
499    } else {
500
501        this.div_.style.visibility = "visible";
502    }
503};
504
505/**
506 * Sets the options for the InfoBox. Note that changes to the <tt>maxWidth</tt>,
507 *  <tt>closeBoxMargin</tt>, <tt>closeBoxURL</tt>, and <tt>enableEventPropagation</tt>
508 *  properties have no affect until the current InfoBox is <tt>close</tt>d and a new one
509 *  is <tt>open</tt>ed.
510 * @param {InfoBoxOptions} opt_opts
511 */
512InfoBox.prototype.setOptions = function (opt_opts) {
513    if (typeof opt_opts.boxClass !== "undefined") { // Must be first
514
515        this.boxClass_ = opt_opts.boxClass;
516        this.setBoxStyle_();
517    }
518    if (typeof opt_opts.boxStyle !== "undefined") { // Must be second
519
520        this.boxStyle_ = opt_opts.boxStyle;
521        this.setBoxStyle_();
522    }
523    if (typeof opt_opts.content !== "undefined") {
524
525        this.setContent(opt_opts.content);
526    }
527    if (typeof opt_opts.disableAutoPan !== "undefined") {
528
529        this.disableAutoPan_ = opt_opts.disableAutoPan;
530    }
531    if (typeof opt_opts.maxWidth !== "undefined") {
532
533        this.maxWidth_ = opt_opts.maxWidth;
534    }
535    if (typeof opt_opts.pixelOffset !== "undefined") {
536
537        this.pixelOffset_ = opt_opts.pixelOffset;
538    }
539    if (typeof opt_opts.alignBottom !== "undefined") {
540
541        this.alignBottom_ = opt_opts.alignBottom;
542    }
543    if (typeof opt_opts.position !== "undefined") {
544
545        this.setPosition(opt_opts.position);
546    }
547    if (typeof opt_opts.zIndex !== "undefined") {
548
549        this.setZIndex(opt_opts.zIndex);
550    }
551    if (typeof opt_opts.closeBoxMargin !== "undefined") {
552
553        this.closeBoxMargin_ = opt_opts.closeBoxMargin;
554    }
555    if (typeof opt_opts.closeBoxURL !== "undefined") {
556
557        this.closeBoxURL_ = opt_opts.closeBoxURL;
558    }
559    if (typeof opt_opts.infoBoxClearance !== "undefined") {
560
561        this.infoBoxClearance_ = opt_opts.infoBoxClearance;
562    }
563    if (typeof opt_opts.isHidden !== "undefined") {
564
565        this.isHidden_ = opt_opts.isHidden;
566    }
567    if (typeof opt_opts.visible !== "undefined") {
568
569        this.isHidden_ = !opt_opts.visible;
570    }
571    if (typeof opt_opts.enableEventPropagation !== "undefined") {
572
573        this.enableEventPropagation_ = opt_opts.enableEventPropagation;
574    }
575
576    if (this.div_) {
577
578        this.draw();
579    }
580};
581
582/**
583 * Sets the content of the InfoBox.
584 *  The content can be plain text or an HTML DOM node.
585 * @param {string|Node} content
586 */
587InfoBox.prototype.setContent = function (content) {
588    this.content_ = content;
589
590    if (this.div_) {
591
592        if (this.closeListener_) {
593
594            google.maps.event.removeListener(this.closeListener_);
595            this.closeListener_ = null;
596        }
597
598        // Odd code required to make things work with MSIE.
599        //
600        if (!this.fixedWidthSet_) {
601
602            this.div_.style.width = "";
603        }
604
605        if (typeof content.nodeType === "undefined") {
606            this.div_.innerHTML = this.getCloseBoxImg_() + content;
607        } else {
608            this.div_.innerHTML = this.getCloseBoxImg_();
609            this.div_.appendChild(content);
610        }
611
vendor: 4,092 bytes, lines 612-778
612        // Perverse code required to make things work with MSIE.
613        // (Ensures the close box does, in fact, float to the right.)
614        //
615        if (!this.fixedWidthSet_) {
616            this.div_.style.width = this.div_.offsetWidth + "px";
617            if (typeof content.nodeType === "undefined") {
618                this.div_.innerHTML = this.getCloseBoxImg_() + content;
619            } else {
620                this.div_.innerHTML = this.getCloseBoxImg_();
621                this.div_.appendChild(content);
622            }
623        }
624
625        this.addClickHandler_();
626    }
627
628    /**
629     * This event is fired when the content of the InfoBox changes.
630     * @name InfoBox#content_changed
631     * @event
632     */
633    google.maps.event.trigger(this, "content_changed");
634};
635
636/**
637 * Sets the geographic location of the InfoBox.
638 * @param {LatLng} latlng
639 */
640InfoBox.prototype.setPosition = function (latlng) {
641
642    this.position_ = latlng;
643
644    if (this.div_) {
645
646        this.draw();
647    }
648
649    /**
650     * This event is fired when the position of the InfoBox changes.
651     * @name InfoBox#position_changed
652     * @event
653     */
654    google.maps.event.trigger(this, "position_changed");
655};
656
657/**
658 * Sets the zIndex style for the InfoBox.
659 * @param {number} index
660 */
661InfoBox.prototype.setZIndex = function (index) {
662
663    this.zIndex_ = index;
664
665    if (this.div_) {
666
667        this.div_.style.zIndex = index;
668    }
669
670    /**
671     * This event is fired when the zIndex of the InfoBox changes.
672     * @name InfoBox#zindex_changed
673     * @event
674     */
675    google.maps.event.trigger(this, "zindex_changed");
676};
677
678/**
679 * Sets the visibility of the InfoBox.
680 * @param {boolean} isVisible
681 */
682InfoBox.prototype.setVisible = function (isVisible) {
683
684    this.isHidden_ = !isVisible;
685    if (this.div_) {
686        this.div_.style.visibility = (this.isHidden_ ? "hidden" : "visible");
687    }
688};
689
690/**
691 * Returns the content of the InfoBox.
692 * @returns {string}
693 */
694InfoBox.prototype.getContent = function () {
695
696    return this.content_;
697};
698
699/**
700 * Returns the geographic location of the InfoBox.
701 * @returns {LatLng}
702 */
703InfoBox.prototype.getPosition = function () {
704
705    return this.position_;
706};
707
708/**
709 * Returns the zIndex for the InfoBox.
710 * @returns {number}
711 */
712InfoBox.prototype.getZIndex = function () {
713
714    return this.zIndex_;
715};
716
717/**
718 * Returns a flag indicating whether the InfoBox is visible.
719 * @returns {boolean}
720 */
721InfoBox.prototype.getVisible = function () {
722
723    var isVisible;
724
725    if ((typeof this.getMap() === "undefined") || (this.getMap() === null)) {
726        isVisible = false;
727    } else {
728        isVisible = !this.isHidden_;
729    }
730    return isVisible;
731};
732
733/**
734 * Shows the InfoBox. [Deprecated; use <tt>setVisible</tt> instead.]
735 */
736InfoBox.prototype.show = function () {
737
738    this.isHidden_ = false;
739    if (this.div_) {
740        this.div_.style.visibility = "visible";
741    }
742};
743
744/**
745 * Hides the InfoBox. [Deprecated; use <tt>setVisible</tt> instead.]
746 */
747InfoBox.prototype.hide = function () {
748
749    this.isHidden_ = true;
750    if (this.div_) {
751        this.div_.style.visibility = "hidden";
752    }
753};
754
755/**
756 * Adds the InfoBox to the specified map or Street View panorama. If <tt>anchor</tt>
757 *  (usually a <tt>google.maps.Marker</tt>) is specified, the position
758 *  of the InfoBox is set to the position of the <tt>anchor</tt>. If the
759 *  anchor is dragged to a new location, the InfoBox moves as well.
760 * @param {Map|StreetViewPanorama} map
761 * @param {MVCObject} [anchor]
762 */
763InfoBox.prototype.open = function (map, anchor) {
764
765    var me = this;
766
767    if (anchor) {
768
769        this.position_ = anchor.getPosition();
770        this.moveListener_ = google.maps.event.addListener(anchor, "position_changed", function () {
771            me.setPosition(this.getPosition());
772        });
773
774        this.mapListener_ = google.maps.event.addListener(anchor, "map_changed", function () {
775            me.setMap(this.map);
776        });
777    }
778
779    this.setMap(map);
780
781    if (this.div_) {
782
783        this.panBox_();
784    }
785};
786
787/**
788 * Removes the InfoBox from the map.
789 */
790InfoBox.prototype.close = function () {
791
792    var i;
793
794    if (this.closeListener_) {
795
796        google.maps.event.removeListener(this.closeListener_);
797        this.closeListener_ = null;
798    }
799
800    if (this.eventListeners_) {
801
802        for (i = 0; i < this.eventListeners_.length; i++) {
803
804            google.maps.event.removeListener(this.eventListeners_[i]);
805        }
806        this.eventListeners_ = null;
807    }
808
809    if (this.moveListener_) {
810
811        google.maps.event.removeListener(this.moveListener_);
812        this.moveListener_ = null;
813    }
814
815    if (this.mapListener_) {
816
817        google.maps.event.removeListener(this.mapListener_);
818        this.mapListener_ = null;
819    }
820
821    if (this.contextListener_) {
822
823        google.maps.event.removeListener(this.contextListener_);
824        this.contextListener_ = null;
825    }
826
827    this.setMap(null);
828};

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