PageSourceSearch

https://vstupenkadecin.cz/components/com_focalpoint/assets/js/infobox.js

js vstupenkadecin.cz collected 2026-10-08 12:10:53 UTC 25,154 bytes, 994 lines download raw bytes

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

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.