Difference between revisions of "MediaWiki:Common.js"

From Rizon Wiki
Jump to navigation Jump to search
(Created page with "$(document).ready(function () { if ($("#server-map").length) { var map; var elevator; var myOptions = { zoom: 1, center: n...")
 
(Blanked the page)
 
Line 1: Line 1:
$(document).ready(function () {


    if ($("#server-map").length) {
        var map;
        var elevator;
        var myOptions = {
            zoom: 1,
            center: new google.maps.LatLng(0, 0),
            mapTypeId: 'terrain'
        };
        map = new google.maps.Map($('#server-map')[0], myOptions);
        var addresses = [];
        $(".server-list td:last-child").each(function (e) {
            var a = e.text();
            if (a !== "Location") {
                addresses.push(a);
            }
        });
        for (var x = 0; x < addresses.length; x++) {
            $.getJSON('http://maps.googleapis.com/maps/api/geocode/json?address='+addresses[x]+'&sensor=false', null, function (data) {
                var p = data.results[0].geometry.location;
                var latlng = new google.maps.LatLng(p.lat, p.lng);
                new google.maps.Marker({
                    position: latlng,
                    map: map
                });
            });
        }
    }
});

Latest revision as of 14:01, 19 May 2017