Changeset 1559880
- Timestamp:
- 12/22/2016 03:06:18 PM (9 years ago)
- Location:
- dml-easy-map/trunk
- Files:
-
- 4 added
- 3 edited
-
dmlmap.php (modified) (4 diffs)
-
icons/m1.png (added)
-
icons/m2.png (added)
-
icons/m3.png (added)
-
js/markerclusterer.js (added)
-
js/private/dmlmap.js (modified) (7 diffs)
-
js/public/dmlmap.js (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
dml-easy-map/trunk/dmlmap.php
r1556050 r1559880 202 202 wp_localize_script( 'dmlmap-js-public', 'dml_pub_php_links', $dataPubToBePassed ); 203 203 wp_enqueue_script('dmlmap-js-public'); 204 205 wp_register_script('dmlmap-clusterjs', plugins_url('/js/markerclusterer.js',__FILE__), array('jquery'),'',true); 206 wp_enqueue_script('dmlmap-clusterjs'); 204 207 205 208 wp_register_script('dmlmap-bootstrapjs-public', plugins_url('/js/bootstrap.min.js',__FILE__), array('jquery'),'',true); … … 235 238 wp_localize_script( 'dmlmap-js-private', 'dml_php_links', $dataToBePassed ); 236 239 wp_enqueue_script('dmlmap-js-private'); 240 241 wp_register_script('dmlmap-clusterjs', plugins_url('/js/markerclusterer.js',__FILE__), array('jquery'),'',true); 242 wp_enqueue_script('dmlmap-clusterjs'); 237 243 238 244 wp_register_script('dmlmap-bootstrapjs-public', plugins_url('/js/bootstrap.min.js',__FILE__), array('jquery'),'',true); … … 461 467 $args = array( 462 468 'post_type' => 'dml_location', 463 ' numberposts'=> -1,469 'posts_per_page' => -1, 464 470 'orderby' => 'ID', 465 471 'order' => 'ASC', … … 857 863 $dmlLinkSearch = dml_search_link_string($needle); 858 864 859 if ( $dmlLinkSearch == 1 && is_plugin_active('dml map/dmlmap.php') ):865 if ( $dmlLinkSearch == 1 && is_plugin_active('dml-easy-map/dmlmap.php') ): 860 866 861 867 // get the wp version -
dml-easy-map/trunk/js/private/dmlmap.js
r1556050 r1559880 16 16 17 17 3. MARKER FUNCTIONS 18 3.1 - dml_ delete_Markers()Adds temporary marker when clicked on the map18 3.1 - dml_add_Cluster_Markers() Adds temporary marker when clicked on the map 19 19 3.2 - dml_add_Marker() Creates new pin on the map 20 20 3.3 - dml_delete_Markers() … … 196 196 // 2.4 - Load Google Map with customized style if selected 197 197 function dml_load_JSON(myStyleNu) { 198 var myStyleFile = dml_php_links.UrlofPlugin + "/dml map/styles/style" + myStyleNu + ".json";198 var myStyleFile = dml_php_links.UrlofPlugin + "/dml-easy-map/styles/style" + myStyleNu + ".json"; 199 199 var xobj = new XMLHttpRequest(); 200 200 xobj.overrideMimeType("application/json"); … … 278 278 279 279 // Adds a markers at the map. 280 dml_add_ Markers();280 dml_add_Cluster_Markers(); 281 281 } 282 282 283 283 // 3 - MARKER FUNCTIONS 284 284 // 3.1 - Adds temporary marker when clicked on the map 285 function dml_add_ Markers() {285 function dml_add_Cluster_Markers() { 286 286 var infowindow = new google.maps.InfoWindow({}); 287 287 var marker, i; 288 var imagePath = dml_php_links.UrlofPlugin + "/dmlmap/icons/"; 289 for (i = 1; i < dmlmyArr.length; i++) { 290 291 marker = new google.maps.Marker({ 292 position: new google.maps.LatLng(dmlmyArr[i].dml_lat, dmlmyArr[i].dml_lng), 293 map: dmlmap, 294 icon: imagePath + dmlmyArr[i].dml_zoom_icon + ".png" 295 }); 296 297 google.maps.event.addListener(marker, 'click', (function (marker, i) { 298 return function () { 299 if (jQuery("#dmlmyMap1Edit").html() == 1) { 300 301 infowindow.setContent('<strong><span id="' + dmlmyArr[i].dml_id + '_H">' + dmlmyArr[i].dml_height_title + '</span></strong><br><span id="' + dmlmyArr[i].dml_id + '_D">' + dmlmyArr[i].dml_maptype__markerdesc + '</span><br><div onclick="dml_Edit_Marker_Description(' + dmlmyArr[i].dml_id + ');" class="button btn btn-success btn-sm fontawesome-pencil"></div><div onclick="dml_Delete_Db_Marker(' + dmlmyArr[i].dml_id + ');" class="btn btn-danger btn-sm fontawesome-trash" style="margin-left:2px;"></div><div onclick="dml_Fill_Marker_Settings(' + dmlmyArr[i].dml_id + ');" class="btn btn-primary btn-sm fontawesome-picture" style="margin-left:2px;"></div><div class="btn btn-default btn-sm" style="display:none;"><span class="badge">' + dmlmyArr[i].dml_id + '</span></div>'); 302 303 } else { 304 infowindow.setContent('<strong>' + dmlmyArr[i].dml_height_title + '</strong><br>' + dmlmyArr[i].dml_maptype__markerdesc + '<br>'); 288 var imagePath = dml_php_links.UrlofPlugin + "/dml-easy-map/icons/"; 289 290 var dmlClusterArr = []; 291 292 for (var i = 0; i < dmlmyArr.length; i++) { 293 if (dmlmyArr[i].dml_record_type != "M") { 294 dmlClusterArr.push({ 295 dml_id: dmlmyArr[i].dml_id 296 }); 297 } 298 } 299 var markers = dmlClusterArr.map(function(location, i) { 300 marker = new google.maps.Marker({ 301 position: new google.maps.LatLng(dmlmyArr[i+1].dml_lat, dmlmyArr[i+1].dml_lng), 302 map: dmlmap, 303 icon: imagePath + dmlmyArr[i+1].dml_zoom_icon + ".png" 304 }); 305 306 google.maps.event.addListener(marker, 'click', (function (marker, i) { 307 return function () { 308 if (jQuery("#dmlmyMap1Edit").html() == 1) { 309 310 infowindow.setContent('<strong><span id="' + dmlmyArr[i+1].dml_id + '_H">' + dmlmyArr[i+1].dml_height_title + '</span></strong><br><span id="' + dmlmyArr[i+1].dml_id + '_D">' + dmlmyArr[i+1].dml_maptype__markerdesc + '</span><br><div onclick="dml_Edit_Marker_Description(' + dmlmyArr[i+1].dml_id + ');" class="button btn btn-success btn-sm fontawesome-pencil"></div><div onclick="dml_Delete_Db_Marker(' + dmlmyArr[i+1].dml_id + ', 1);" class="btn btn-danger btn-sm fontawesome-trash" style="margin-left:2px;"></div><div onclick="dml_Fill_Marker_Settings(' + dmlmyArr[i+1].dml_id + ');" class="btn btn-primary btn-sm fontawesome-picture" style="margin-left:2px;"></div><div class="btn btn-default btn-sm" style="display:none;"><span class="badge">' + dmlmyArr[i+1].dml_id + '</span></div>'); 311 312 } else { 313 infowindow.setContent('<strong>' + dmlmyArr[i+1].dml_height_title + '</strong><br>' + dmlmyArr[i+1].dml_maptype__markerdesc + '<br>'); 314 } 315 infowindow.open(dmlmap, marker); 305 316 } 306 infowindow.open(dmlmap, marker); 307 } 308 })(marker, i)); 309 310 dmlDbMarkers.push(marker); 311 } 312 317 })(marker, i)); 318 319 dmlDbMarkers.push(marker); 320 321 return marker; 322 }); 323 324 var clusterStyles = [ 325 { 326 textColor: 'black', 327 url: dml_php_links.UrlofPlugin + '/dml-easy-map/icons/m1.png', 328 height: 52, 329 width: 53, 330 textSize: 12 331 }, 332 { 333 textColor: 'black', 334 url: dml_php_links.UrlofPlugin + '/dml-easy-map/icons/m2.png', 335 height: 56, 336 width: 55, 337 textSize: 12 338 }, 339 { 340 textColor: 'black', 341 url: dml_php_links.UrlofPlugin + '/dml-easy-map/icons/m3.png', 342 height: 66, 343 width: 65, 344 textSize: 12 345 } 346 ]; 347 var mcOptions = { 348 gridSize: 50, 349 styles: clusterStyles, 350 maxZoom: 15 351 }; 352 var markerCluster = new MarkerClusterer(dmlmap, markers, mcOptions); 353 dmlClusterArr = []; 313 354 } 314 355 // 3.2 - Creates new pin on the map … … 465 506 jQuery("#dmlOpt" + mySelectedStyle).attr("selected", "selected"); 466 507 jQuery("#dmlSelectedStyleHolder").html(mySelectedStyle); 467 jQuery("#dmlSelectedStyleThmb").html("<div class='input-group'><img src='" + dml_php_links.UrlofPlugin + "/dml map/styles/thmbs/" + mySelectedStyle + ".png' /></div>");508 jQuery("#dmlSelectedStyleThmb").html("<div class='input-group'><img src='" + dml_php_links.UrlofPlugin + "/dml-easy-map/styles/thmbs/" + mySelectedStyle + ".png' /></div>"); 468 509 469 510 //SETTINGS SAVE PARAMETER … … 489 530 //var myiconTempList; 490 531 for (var i = 1; i < 112; i++) { 491 jQuery('#dmlIconList').append("<img onclick='dml_Select_One_icon(" + i + ");' src='" + dml_php_links.UrlofPlugin + "/dml map/icons/" + i + ".png' title='" + i + "' style='float:left;' />");532 jQuery('#dmlIconList').append("<img onclick='dml_Select_One_icon(" + i + ");' src='" + dml_php_links.UrlofPlugin + "/dml-easy-map/icons/" + i + ".png' title='" + i + "' style='float:left;' />"); 492 533 } 493 534 jQuery("#dmlSettingsDiv").modal("toggle"); … … 593 634 function dml_Change_Map_Type(myStyleNu) { 594 635 jQuery("#dmlSelectedStyleHolder").html(myStyleNu); 595 jQuery("#dmlSelectedStyleThmb").html("<div class='input-group'><img src='" + dml_php_links.UrlofPlugin + "/dml map/styles/thmbs/" + myStyleNu + ".png' /></div>");636 jQuery("#dmlSelectedStyleThmb").html("<div class='input-group'><img src='" + dml_php_links.UrlofPlugin + "/dml-easy-map/styles/thmbs/" + myStyleNu + ".png' /></div>"); 596 637 dmlmyArr[0].dml_fill_color = myStyleNu; 597 638 … … 613 654 // 5.3 - Sets icon ID when a new icon selected for the marker 614 655 function dml_Select_One_icon(myId) { 615 var mySelectionText = "<img src='" + dml_php_links.UrlofPlugin + "/dml map/icons/" + myId + ".png' /> You selected this icon.";656 var mySelectionText = "<img src='" + dml_php_links.UrlofPlugin + "/dml-easy-map/icons/" + myId + ".png' /> You selected this icon."; 616 657 jQuery("#dmlMySelectediconText").html(mySelectionText); 617 658 jQuery("#dmlMySelectediconID").html(myId); -
dml-easy-map/trunk/js/public/dmlmap.js
r1556050 r1559880 143 143 // 2.4 - Load Google Map with customized style if selected 144 144 function dml_load_JSON(myStyleNu) { 145 var myStyleFile = dml_pub_php_links.UrlofPubPlugin + "/dml map/styles/style" + myStyleNu + ".json";145 var myStyleFile = dml_pub_php_links.UrlofPubPlugin + "/dml-easy-map/styles/style" + myStyleNu + ".json"; 146 146 var xobj = new XMLHttpRequest(); 147 147 xobj.overrideMimeType("application/json"); … … 195 195 196 196 // Adds a markers at the map. 197 dml_add_ Markers();197 dml_add_Cluster_Markers(); 198 198 } 199 199 … … 201 201 // 3 - MARKER FUNCTIONS 202 202 // 3.1 - Adds temporary marker when clicked on the map 203 function dml_add_ Markers() {203 function dml_add_Cluster_Markers() { 204 204 var infowindow = new google.maps.InfoWindow({}); 205 205 var marker, i; 206 var imagePath = dml_pub_php_links.UrlofPubPlugin + "/dmlmap/icons/"; 207 for (i = 1; i < dmlmyArr.length; i++) { 208 209 marker = new google.maps.Marker({ 210 position: new google.maps.LatLng(dmlmyArr[i].dml_lat, dmlmyArr[i].dml_lng), 211 map: dmlmap, 212 icon: imagePath + dmlmyArr[i].dml_zoom_icon + ".png" 213 }); 206 var imagePath = dml_pub_php_links.UrlofPubPlugin + "/dml-easy-map/icons/"; 207 208 var dmlClusterArr = []; 209 210 for (var i = 0; i < dmlmyArr.length; i++) { 211 if (dmlmyArr[i].dml_record_type != "M") { 212 dmlClusterArr.push({ 213 dml_id: dmlmyArr[i].dml_id 214 }); 215 } 216 } 217 218 var markers = dmlClusterArr.map(function(location, i) { 219 marker = new google.maps.Marker({ 220 position: new google.maps.LatLng(dmlmyArr[i+1].dml_lat, dmlmyArr[i+1].dml_lng), 221 map: dmlmap, 222 icon: imagePath + dmlmyArr[i+1].dml_zoom_icon + ".png" 223 }); 224 225 google.maps.event.addListener(marker, 'click', (function (marker, i) { 226 return function () { 227 infowindow.setContent('<strong>' + dmlmyArr[i+1].dml_height_title + '</strong><br>' + dmlmyArr[i+1].dml_maptype__markerdesc + '<br>'); 228 infowindow.open(dmlmap, marker); 229 } 230 })(marker, i)); 231 232 dmlDbMarkers.push(marker); 214 233 215 google.maps.event.addListener(marker, 'click', (function (marker, i) { 216 return function () { 217 218 infowindow.setContent('<strong>' + dmlmyArr[i].dml_height_title + '</strong><br>' + dmlmyArr[i].dml_maptype__markerdesc + '<br>'); 219 infowindow.open(dmlmap, marker); 220 } 221 })(marker, i)); 222 223 dmlDbMarkers.push(marker); 224 } 225 234 return marker; 235 }); 236 var clusterStyles = [ 237 { 238 textColor: 'black', 239 url: dml_pub_php_links.UrlofPubPlugin + '/dml-easy-map/icons/m1.png', 240 height: 52, 241 width: 53, 242 textSize: 12 243 }, 244 { 245 textColor: 'black', 246 url: dml_pub_php_links.UrlofPubPlugin + '/dml-easy-map/icons/m2.png', 247 height: 56, 248 width: 55, 249 textSize: 12 250 }, 251 { 252 textColor: 'black', 253 url: dml_pub_php_links.UrlofPubPlugin + '/dml-easy-map/icons/m3.png', 254 height: 66, 255 width: 65, 256 textSize: 12 257 } 258 ]; 259 var mcOptions = { 260 gridSize: 50, 261 styles: clusterStyles, 262 maxZoom: 15 263 }; 264 var markerCluster = new MarkerClusterer(dmlmap, markers, mcOptions); 265 dmlClusterArr = []; 226 266 } 227 267 // 3.2 - Clear markers
Note: See TracChangeset
for help on using the changeset viewer.