From cde515c741d914aff1576c7d68bc2077aa33984e Mon Sep 17 00:00:00 2001 From: Sky4git Date: Sat, 11 Jul 2015 22:28:22 +1000 Subject: [PATCH 1/3] Added class for close button image Added option to add close image class. option name is 'closeClass' This can be used to apply css class to close image. I have added this because recently i encountered problem where I want to apply some css rules to close button and there was no easiest way as per the script to achieve that. Now we can apply css class and apply css rules as we wish. --- src/infobubble.js | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/infobubble.js b/src/infobubble.js index 0f8f82b..bdc9c7d 100755 --- a/src/infobubble.js +++ b/src/infobubble.js @@ -93,6 +93,10 @@ function InfoBubble(opt_options) { if (options['closeSrc'] == undefined) { options['closeSrc'] = this.CLOSE_SRC_; } + + if (options['closeClass'] == undefined) { + options['closeClass'] = this.CLOSE_CLASS_; + } this.buildDom_(); this.setValues(options); @@ -186,6 +190,13 @@ InfoBubble.prototype.BACKGROUND_COLOR_ = '#fff'; */ InfoBubble.prototype.CLOSE_SRC_ = 'https://maps.gstatic.com/intl/en_us/mapfiles/iw_close.gif'; +/** + * Default close image css class + * @const + * @private + */ +InfoBubble.prototype.CLOSE_CLASS_ = 'close-image'; + /** * Extends a objects prototype by anothers. * @@ -223,6 +234,7 @@ InfoBubble.prototype.buildDom_ = function() { close.style['zIndex'] = this.baseZIndex_ + 1; close.style['cursor'] = 'pointer'; close.src = this.get('closeSrc'); + close.className = this.get('closeClass'); var that = this; google.maps.event.addDomListener(close, 'click', function() { @@ -781,6 +793,18 @@ InfoBubble.prototype.setCloseSrc = function(src) { }; InfoBubble.prototype['setCloseSrc'] = InfoBubble.prototype.setCloseSrc; +/** + * Set the close image css class + * + * @param {string} css class of the image used as a close icon + */ +InfoBubble.prototype.setCloseClass = function(classname) { + if (classname && this.close_) { + this.close_.className = classname; + } +}; +InfoBubble.prototype['setCloseClass'] = InfoBubble.prototype.setCloseClass; + /** * Set the padding of the InfoBubble @@ -1735,7 +1759,7 @@ InfoBubble.prototype.figureOutSize_ = function() { } this.contentContainer_.style['width'] = this.px(width); - this.contentContainer_.style['height'] = this.px(height); + // this.contentContainer_.style['height'] = this.px(height); }; From 08015dd9fca1d710a5ff7ec10cfc4e120be858e0 Mon Sep 17 00:00:00 2001 From: Sky4git Date: Fri, 30 Oct 2015 11:12:35 +1100 Subject: [PATCH 2/3] Updated infobubble to remove commented height line For this merge request, I am just removing comment // for line no 1762, which I have done for my personal changes. Its back now as it is with changes I have done to add css class for close button. --- src/infobubble.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/infobubble.js b/src/infobubble.js index bdc9c7d..2eaf1d0 100755 --- a/src/infobubble.js +++ b/src/infobubble.js @@ -1759,7 +1759,7 @@ InfoBubble.prototype.figureOutSize_ = function() { } this.contentContainer_.style['width'] = this.px(width); - // this.contentContainer_.style['height'] = this.px(height); + this.contentContainer_.style['height'] = this.px(height); }; From db5d068b16b522b52f16942b1ab5fc3564cad9e7 Mon Sep 17 00:00:00 2001 From: Sky4git Date: Tue, 24 Nov 2015 15:20:28 +1100 Subject: [PATCH 3/3] updated className string Updated className string in line 799, 801, 802 and 803 --- src/infobubble.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/infobubble.js b/src/infobubble.js index 2eaf1d0..4513a77 100755 --- a/src/infobubble.js +++ b/src/infobubble.js @@ -796,11 +796,11 @@ InfoBubble.prototype['setCloseSrc'] = InfoBubble.prototype.setCloseSrc; /** * Set the close image css class * - * @param {string} css class of the image used as a close icon + * @param {string} className css class of the image used as a close icon */ -InfoBubble.prototype.setCloseClass = function(classname) { - if (classname && this.close_) { - this.close_.className = classname; +InfoBubble.prototype.setCloseClass = function(className) { + if (className && this.close_) { + this.close_.className = className; } }; InfoBubble.prototype['setCloseClass'] = InfoBubble.prototype.setCloseClass;