Skip to content

Commit 1937dc2

Browse files
committed
Prevent click on coordinate to propagate
1 parent 07d69be commit 1937dc2

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jquery-bootstrap-niord",
3-
"version": "3.5.0",
3+
"version": "3.5.1",
44
"homepage": "https://github.com/FCOO/jquery-bootstrap-niord",
55
"authors": [
66
"Niels Holt"

dist/jquery-bootstrap-niord.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,16 @@
9898
}, ns.options || {} );
9999

100100
//__onClickCoordinate__ = internal function used if onClickCoordinate is given
101-
ns.__onClickCoordinate__ = function(elem){
101+
ns.__onClickCoordinate__ = function(elem, event){
102102
var $elem = $(elem),
103103
coordIdStr = $elem.data('coord_id'),
104104
list = coordIdStr.split(' '),
105105
coord = [parseFloat(list[0]), parseFloat(list[1])],
106106
messId = list.length >= 3 ? list[2] : null;
107107
ns.options.onClickCoordinate(coord, $elem.text(), messId);
108+
109+
event && event.stopPropagation ? event.stopPropagation() : null;
110+
return false;
108111
};
109112

110113

@@ -545,7 +548,8 @@
545548
text =
546549
text.replace(
547550
'>>>>>>>>'+index+'<<<<<<<<',
548-
'<a data-coord_id="'+textAndCoord.coord[0]+' '+textAndCoord.coord[1]+' '+_this.id+'" href="javascript:undefined" onclick="window.Niord.__onClickCoordinate__(this)">'+textAndCoord.text+'</a>'
551+
'<a data-coord_id="'+textAndCoord.coord[0]+' '+textAndCoord.coord[1]+' '+_this.id+'" href="javascript:undefined" onclick="window.Niord.__onClickCoordinate__(this, arguments[0])">'+textAndCoord.text+'</a>'
552+
549553
);
550554
});
551555
_this.partList[partIndex][partId][lang] = text;

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jquery-bootstrap-niord",
3-
"version": "3.5.0",
3+
"version": "3.5.1",
44
"homepage": "https://github.com/FCOO/jquery-bootstrap-niord",
55
"author": "Niels Holt nho@fcoo.dk",
66
"description": "package.json is only use for building the package. see bower.json for more info",

src/jquery-bootstrap-niord-message.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,16 @@
9898
}, ns.options || {} );
9999

100100
//__onClickCoordinate__ = internal function used if onClickCoordinate is given
101-
ns.__onClickCoordinate__ = function(elem){
101+
ns.__onClickCoordinate__ = function(elem, event){
102102
var $elem = $(elem),
103103
coordIdStr = $elem.data('coord_id'),
104104
list = coordIdStr.split(' '),
105105
coord = [parseFloat(list[0]), parseFloat(list[1])],
106106
messId = list.length >= 3 ? list[2] : null;
107107
ns.options.onClickCoordinate(coord, $elem.text(), messId);
108+
109+
event && event.stopPropagation ? event.stopPropagation() : null;
110+
return false;
108111
};
109112

110113

@@ -545,7 +548,8 @@
545548
text =
546549
text.replace(
547550
'>>>>>>>>'+index+'<<<<<<<<',
548-
'<a data-coord_id="'+textAndCoord.coord[0]+' '+textAndCoord.coord[1]+' '+_this.id+'" href="javascript:undefined" onclick="window.Niord.__onClickCoordinate__(this)">'+textAndCoord.text+'</a>'
551+
'<a data-coord_id="'+textAndCoord.coord[0]+' '+textAndCoord.coord[1]+' '+_this.id+'" href="javascript:undefined" onclick="window.Niord.__onClickCoordinate__(this, arguments[0])">'+textAndCoord.text+'</a>'
552+
549553
);
550554
});
551555
_this.partList[partIndex][partId][lang] = text;

0 commit comments

Comments
 (0)