Index: branches/SemanticMaps0.8/includes/services/GoogleMaps3/jquery.googlemapsinput.js |
— | — | @@ -29,6 +29,13 @@ |
30 | 30 | |
31 | 31 | this.mapDiv.googlemaps( options ); |
32 | 32 | |
| 33 | + google.maps.event.addListener( this.mapDiv.map, 'click', function( event ) { |
| 34 | + var location = { lat: event.latLng.lat(), lon: event.latLng.lng() }; |
| 35 | + self.mapDiv.map.panTo( event.latLng ); |
| 36 | + self.showCoordinate( location ); |
| 37 | + self.input.attr( 'value', semanticMaps.buildInputValue( [ location ] ) ); |
| 38 | + } ); |
| 39 | + |
33 | 40 | return this; |
34 | 41 | |
35 | 42 | }; })( jQuery ); |
\ No newline at end of file |
Index: branches/SemanticMaps0.8/includes/services/OpenLayers/jquery.openlayersinput.js |
— | — | @@ -48,7 +48,7 @@ |
49 | 49 | |
50 | 50 | self.mapDiv.map.panTo( location ); |
51 | 51 | |
52 | | - $( '#' + mapDivId + '_values' ).attr( 'value', semanticMaps.buildInputValue( [ normalProjectionLocation ] ) ); |
| 52 | + self.input.attr( 'value', semanticMaps.buildInputValue( [ normalProjectionLocation ] ) ); |
53 | 53 | }; |
54 | 54 | |
55 | 55 | this.projectAndShowLocation = function( location, title ) { |
Index: branches/SemanticMaps0.8/includes/forminputs/jquery.mapforminput.js |
— | — | @@ -23,7 +23,7 @@ |
24 | 24 | |
25 | 25 | var self = this; |
26 | 26 | |
27 | | - var input = $( '<input />' ).attr( { |
| 27 | + this.input = $( '<input />' ).attr( { |
28 | 28 | 'type': 'text', |
29 | 29 | 'name': options.inputname, |
30 | 30 | 'id': mapDivId + '_values', |
— | — | @@ -34,7 +34,7 @@ |
35 | 35 | var updateButton = $( '<button />' ).text( mediaWiki.msg( 'semanticmaps-updatemap' ) ); |
36 | 36 | |
37 | 37 | updateButton.click( function() { |
38 | | - var locations = coord.split( $( '#' + mapDivId + '_values' ).attr( 'value' ) ); |
| 38 | + var locations = coord.split( this.input.attr( 'value' ) ); |
39 | 39 | var location = coord.parse( locations[0] ); |
40 | 40 | |
41 | 41 | if ( location !== false ) { |
— | — | @@ -44,13 +44,13 @@ |
45 | 45 | return false; |
46 | 46 | } ); |
47 | 47 | |
48 | | - input.keypress( function( event ) { |
| 48 | + this.input.keypress( function( event ) { |
49 | 49 | if ( event.which == '13' ) { |
50 | 50 | updateButton.click(); |
51 | 51 | } |
52 | 52 | } ); |
53 | 53 | |
54 | | - var geofield = $( '<input />' ).attr( { |
| 54 | + this.geofield = $( '<input />' ).attr( { |
55 | 55 | 'type': 'text', |
56 | 56 | 'id': mapDivId + '_geofield', |
57 | 57 | 'value': mediaWiki.msg( 'semanticmaps_enteraddresshere' ), |
— | — | @@ -58,14 +58,14 @@ |
59 | 59 | 'size': options.fieldsize |
60 | 60 | } ); |
61 | 61 | |
62 | | - geofield.focus( function() { |
| 62 | + this.geofield.focus( function() { |
63 | 63 | if ( this.value == mediaWiki.msg( 'semanticmaps_enteraddresshere' ) ) { |
64 | 64 | this.value = ''; |
65 | 65 | $( this ).css( 'color', '' ); |
66 | 66 | } |
67 | 67 | } ); |
68 | 68 | |
69 | | - geofield.blur( function() { |
| 69 | + this.geofield.blur( function() { |
70 | 70 | if ( this.value == '' ) { |
71 | 71 | this.value = mediaWiki.msg( 'semanticmaps_enteraddresshere' ); |
72 | 72 | $( this ).css( 'color', 'darkgray' ); |
— | — | @@ -75,11 +75,11 @@ |
76 | 76 | var geoButton = $( '<button />' ).text( mediaWiki.msg( 'semanticmaps_lookupcoordinates' ) ); |
77 | 77 | |
78 | 78 | geoButton.click( function() { |
79 | | - self.geocodeAddress( $( '#' + mapDivId + '_geofield' ).attr( 'value' ) ); |
| 79 | + self.geocodeAddress( this.geofield.attr( 'value' ) ); |
80 | 80 | return false; |
81 | 81 | } ); |
82 | 82 | |
83 | | - geofield.keypress( function( event ) { |
| 83 | + this.geofield.keypress( function( event ) { |
84 | 84 | if ( event.which == '13' ) { |
85 | 85 | geoButton.click(); |
86 | 86 | } |
— | — | @@ -97,11 +97,11 @@ |
98 | 98 | this.mapDiv = mapDiv; |
99 | 99 | |
100 | 100 | if ( this.showCoordinate ) { |
101 | | - this.html( $( '<p />' ).append( input ).append( updateButton ) ); |
| 101 | + this.html( $( '<p />' ).append( this.input ).append( updateButton ) ); |
102 | 102 | } |
103 | 103 | |
104 | 104 | if ( this.geocodeAddress ) { |
105 | | - this.append( $( '<p />' ).append( geofield ).append( geoButton ) ); |
| 105 | + this.append( $( '<p />' ).append( this.geofield ).append( geoButton ) ); |
106 | 106 | } |
107 | 107 | |
108 | 108 | this.append( mapDiv ); |