Difference between revisions of "Wikispooks:Sandbox"

From Wikispooks
Jump to navigation Jump to search
(Google maps testing)
(obviously no JavaScript allowed (not that I was expecting it but thought it worth a try))
Line 24: Line 24:
 
}}
 
}}
 
Neither does this
 
Neither does this
 +
---------------
 +
And trying to use javascript just prints the code:
 +
 +
<style>#map-canvas { height: 100%; margin: 0px; padding: 0px }</style>
 +
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
 +
<script>
 +
var map; var pins;
 +
function initialize() {
 +
  var mapOptions = { zoom: 9, center: new google.maps.LatLng(48.3756, 37.8218) };
 +
  map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
 +
  pins = [
 +
    ['GANRA', 48.44801, 37.18560, 'https://wikispooks.com/w/images/2/29/icons/mobilephonetower.png'],
 +
    ['TAMAK', 47.85380, 39.20381, 'https://wikispooks.com/w/images/2/29/icons/mobilephonetower.png'],
 +
];
 +
  makepins2(0);
 +
}
 +
google.maps.event.addDomListener(window, 'load', initialize);
 +
 +
function makepins2(startZ) { //includes an individual logo per pin, eg" for track points
 +
  for (var i = 0; i < pins.length; i++) {
 +
    var thisMarker = pins[i];
 +
    var thisLatLng = new google.maps.LatLng(thisMarker[1], thisMarker[2]);
 +
    var marker = new google.maps.Marker({
 +
      title: thisMarker[0],
 +
      position: thisLatLng,
 +
      zIndex: startZ+i,
 +
      icon: thisMarker[3],
 +
      map: map,
 +
    });
 +
  }
 +
}
 +
</script>
 +
 +
 +
<div id="map-canvas"></div>
 +
With thanks to the <a href="http://mapicons.nicolasmollet.com" target="nic">
 +
<img src="i/icons/miclogo-88x31.gif"></a> project.
 +
 +
*obviously no JavaScript allowed (not that I was expecting it but thought it worth a try) --[[User:Two Dogs|Two Dogs]] ([[User talk:Two Dogs|talk]]) 13:51, 5 September 2014 (IST)

Revision as of 12:51, 5 September 2014

Edit this page

This "sandbox" page is to allow you to carry out experiments. Please feel free to try your skills at formatting here. If you want to learn more about how to edit a wiki, please read this introduction or the tutorial at Wikipedia. For in-depth experimentation, design and testing of templates etc, please use the separate sandbox wiki

To edit, click here or "edit" at the top of the page and make your changes. Then, click the "Show Preview", "Cancel", or "Save page" button above and below the editing box. Previewed or saved work will appear under the "Testing Area" heading below. Please do not add material that is offensive, copyrighted, or libelous.

Please be sure not to change anything on the top line of the edit box.


Content added here will not stay permanently; this page may be cleared at any time.

This is for single page test edits, - for more complex tests, go to Test:Test, where you will have more room, and might find others able to help you.

Testing Area

WL:
WL2:Anders breivik

Google Maps

Loading map...

Does not work!


Loading map...

Neither does this


And trying to use javascript just prints the code:

<style>#map-canvas { height: 100%; margin: 0px; padding: 0px }</style> <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script> <script> var map; var pins; function initialize() {

 var mapOptions = { zoom: 9, center: new google.maps.LatLng(48.3756, 37.8218) };
 map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
 pins = [
   ['GANRA', 48.44801, 37.18560, 'https://wikispooks.com/w/images/2/29/icons/mobilephonetower.png'],
   ['TAMAK', 47.85380, 39.20381, 'https://wikispooks.com/w/images/2/29/icons/mobilephonetower.png'],
];
 makepins2(0);

} google.maps.event.addDomListener(window, 'load', initialize);

function makepins2(startZ) { //includes an individual logo per pin, eg" for track points

 for (var i = 0; i < pins.length; i++) {
   var thisMarker = pins[i]; 
   var thisLatLng = new google.maps.LatLng(thisMarker[1], thisMarker[2]);
   var marker = new google.maps.Marker({
     title: thisMarker[0], 
     position: thisLatLng,
     zIndex: startZ+i,
     icon: thisMarker[3], 
     map: map, 
   });
 }

} </script>


With thanks to the <a href="http://mapicons.nicolasmollet.com" target="nic"> <img src="i/icons/miclogo-88x31.gif"></a> project.

  • obviously no JavaScript allowed (not that I was expecting it but thought it worth a try) --Two Dogs (talk) 13:51, 5 September 2014 (IST)