PageSourceSearch

https://fupo.jp/wp-content/cache/wpfc-minified/2yhyg19w/4lidu.js

js fupo.jp collected 2026-10-02 10:32:03 UTC 5,116 bytes, 198 lines download raw bytes

1;(function($){
2var plugname='mw_google_maps';
3var useRoute=false;
4var methods={
5init:function(params){
6return this.each(function(){
7var data=$(this).data(plugname);
8if(!data){
9var defaults={
10latitude:35.71012566481748,
11longitude: 139.81149673461914,
12zoom:13
13};
14$(this).data(plugname, {
15config:$.extend(defaults, params),
16points:[],
17geocode: {}});
18}});
19},
20addMarker: function(params){
21return this.each(function(){
22var data=$(this).data(plugname);
23var defaults={
24latitude:35.71012566481748,
25longitude: 139.81149673461914,
26title:'',
27draggable: false
28}
29data.points.push($.extend(defaults, params));
30});
31},
32render: function(params){
33return this.each(function(){
34var gmap=$(this);
35var data=gmap.data(plugname);
36var position=new google.maps.LatLng(data.config.latitude,
37data.config.longitude
38);
39var map=new google.maps.Map(gmap.get(0), {
40center: position,
41zoom: data.config.zoom,
42mapTypeId: google.maps.MapTypeId.ROADMAP,
43scrollwheel: false,
44scaleControl: true
45});
46if(data.points.length < 1 ||
47typeof(data.points[0].latitude)=='undefined' ||
48typeof(data.points[0].longitude)=='undefined')
49return true;
50if(useRoute===true){
51var directionsRenderer=new google.maps.DirectionsRenderer();
52directionsRenderer.setMap(map);
53var wayPoints=[];
54$.each(data.points, function(key, val){
55wayPoints.push({
56location: new google.maps.LatLng(val.latitude,
57val.longitude
58)
59});
60});
61var request={
62origin: wayPoints[0].location,
63destination: wayPoints.pop().location,
64travelMode: google.maps.DirectionsTravelMode.DRIVING,
65waypoints: wayPoints
66};
67var directionsService=new google.maps.DirectionsService();
68directionsService.route(request, function(result, status){
69if(status==google.maps.DirectionsStatus.OK){
70directionsRenderer.setDirections(result);
71directionsRenderer.setOptions({
72suppressMarkers: true
73});
74}});
75}
76var getIcon=function(key){
77if(useRoute===true){
78return 'http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=' +(key + 1) + '|F96757|000000';
79}
80return '';
81}
82var minLat=data.points[0].latitude;
83var maxLat=data.points[0].latitude;
84var minLng=data.points[0].longitude;
85var maxLng=data.points[0].longitude;
86var currentInfoWindow=null;
87$.each(data.points, function(key, val){
88var marker=new google.maps.Marker({
89position: new google.maps.LatLng(val.latitude,
90val.longitude
91),
92draggable: val.draggable,
93map: map,
94icon: getIcon(key)
95});
96if(typeof(val.title!='undefined')){
97var infowindow=new google.maps.InfoWindow({
98content: val.title
99});
100google.maps.event.addListener(marker, 'click', function(){
101if(currentInfoWindow){
102currentInfoWindow.close();
103}
104infowindow.open(map, marker);
105currentInfoWindow=infowindow;
106});
107}
108if(data.points.length > 1){
109var Lat=val.latitude;
110var Lng=val.longitude;
111if(Lat < minLat) minLat=Lat;
112if(Lat > maxLat) maxLat=Lat;
113if(Lng < minLng) minLng=Lng;
114if(Lng > maxLng) maxLng=Lng;
115}
116render_geocode(data, map, marker);
117});
118if(data.points.length > 1){
119var sw=new google.maps.LatLng(maxLat, minLng);
120var ne=new google.maps.LatLng(minLat, maxLng);
121var bounds=new google.maps.LatLngBounds(sw, ne);
122map.fitBounds(bounds);
123}else{
124var latlng=new google.maps.LatLng(data.points[0].latitude, data.points[0].longitude);
125map.setCenter(latlng);
126}});
127},
128geocode: function(params){
129return this.each(function(){
130var data=$(this).data(plugname);
131var defaults={
132btn:'',
133address:'',
134latitude:'',
135longitude: ''
136}
137data.geocode=$.extend(defaults, params);
138})
139},
140useRoute: function(){
141useRoute=true;
142}};
143function render_geocode(data, map, marker){
144if(!(
145typeof(data.geocode.btn)!=='undefined' &&
146typeof(data.geocode.address)!=='undefined' &&
147typeof(data.geocode.latitude)!=='undefined' &&
148typeof(data.geocode.longitude)!=='undefined' &&
149typeof(data.geocode.zoom)!=='undefined' &&
150data.geocode.btn.length &&
151data.geocode.address.length &&
152data.geocode.latitude.length &&
153data.geocode.longitude.length &&
154data.geocode.zoom.length &&
155data.points.length==1)
156)
157return true;
158data.geocode.btn.click(function(){
159var geocoder=new google.maps.Geocoder();
160geocoder.geocode({
161address: data.geocode.address.val()
162},
163function(results, status){
164if(status==google.maps.GeocoderStatus.OK){
165map.setCenter(results[0].geometry.location);
166marker.setOptions({
167position: results[0].geometry.location
168});
169setInputValueLatLng(results[0].geometry.location.lat(), results[0].geometry.location.lng());
170}else{
171alert('Failed!');
172}}
173);
174});
175google.maps.event.addListener(marker, 'dragend', function(event){
176var latlng=new google.maps.LatLng(event.latLng.lat(), event.latLng.lng());
177map.setCenter(latlng);
178data.geocode.address.val('');
179setInputValueLatLng(event.latLng.lat(), event.latLng.lng());
180});
181google.maps.event.addListener(map, 'zoom_changed', function(){
182var zoom=map.getZoom();
183data.geocode.zoom.val(zoom);
184});
185function setInputValueLatLng(lat, lng){
186data.geocode.latitude.val(lat);
187data.geocode.longitude.val(lng);
188}}
189$.fn[plugname]=function(method){
190if(methods[method]){
191return methods[method]
192.apply(this, Array.prototype.slice.call(arguments, 1));
193}else if(typeof method==='object'||! method){
194return methods.init.apply(this, arguments);
195}else{
196$.error('Method ' +  method + ' does not exist on jQuery.' + plugn
196ame);
197return this;
198}};})(jQuery);

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.