Thread:Project:Support desk/How can I add to wiki map with javascript?/reply

Put the following in MediaWiki:Common.js:

mtparam = {}

mtparam.width='80%';       //the width of the embedded map in pixels or percentage mtparam.height=400;        //the height of the embedded map in pixels or percentage mtparam.border=1;          //the width of border around the map. Zero means no border mtparam.notation=false;    //true or false to display or not the vessel icons and options at the left mtparam.shownames=false;   //true or false to dispaly ship names on the map mtparam.latitude=37.4460;  //the latitude of the center of the map in decimal degrees mtparam.longitude=24.9467; //the longitude of the center of the map in decimal degrees mtparam.zoom=9;            //the zoom level of the map. Use values between 2 and 17 mtparam.maptype=3;         //use 0 for Normal map, 1 for Satellite, 2 for Hybrid, 3 for Terrain mtparam.trackvessel=0;     //the MMSI of the vessel to track, if within the range of the system mtparam.fleet='';          //the registered email address of a user-defined fleet to display mtparam.remember=false;    //true or false to remember or not the last position of the map

$(function {

$('#embedmarinetraffic').append('<iframe name="marinetraffic" id="marinetraffic"' +		' width="' + ((mtparam.width === undefined) ? '550' : mtparam.width) + '"' +		' height="' + ((mtparam.height === undefined) ? '300' : mtparam.height) + '"' +		' scrolling="no" frameborder="' + ((mtparam.border === undefined) ? '0' : mtparam.border) + '"' +		' src="http://www.marinetraffic.com/ais/embed.aspx?' +		'zoom=' + ((mtparam.zoom === undefined) ? '3' : mtparam.zoom) +		'&amp;centery=' + ((mtparam.latitude === undefined) ? '36' : mtparam.latitude) +		'&amp;centerx=' + ((mtparam.longitude === undefined) ? '23' : mtparam.longitude) +		'&amp;maptype=' + ((mtparam.maptype === undefined) ? '0' : mtparam.maptype) +		'&amp;notation=' + ((mtparam.notation === undefined) ? 'false' : mtparam.notation) +		'&amp;shownames=' + ((mtparam.shownames === undefined) ? 'false' : mtparam.shownames) +		'&amp;mmsi=' + ((mtparam.trackvessel === undefined) ? '0' : mtparam.trackvessel) +		'&amp;fleet=' + ((mtparam.fleet === undefined) ? '' : mtparam.fleet) +		'&amp;remember=' + ((mtparam.remember === undefined) ? 'false' : mtparam.remember) +		'"/>'); });

To display the map on a page, put the following in the place where you want the map to be displayed: