Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCZdYinebnv3Lf0KYxxVBFQpIwKIUAtGCg&callback=initMap"
- type="text/javascript"></script>
- <script type="text/javascript">
- var GALL_PETERS_RANGE_X = 256;
- var GALL_PETERS_RANGE_Y = 256;
- function degreesToRadians(deg)
- {
- return deg * (Math.PI / 180);
- }
- function radiansToDegrees(rad)
- {
- return rad / (Math.PI / 180);
- }
- function GallPetersProjection()
- {
- this.worldOrigin_ = new google.maps.Point(GALL_PETERS_RANGE_X * 400 / 800,
- GALL_PETERS_RANGE_Y / 2);
- this.worldCoordinatePerLonDegree_ = GALL_PETERS_RANGE_X / 360;
- this.worldCoordinateLatRange = GALL_PETERS_RANGE_Y / 2;
- };
- GallPetersProjection.prototype.fromLatLngToPoint = function(latLng)
- {
- var origin = this.worldOrigin_;
- var x = origin.x + this.worldCoordinatePerLonDegree_ * latLng.lng();
- var latRadians = degreesToRadians(latLng.lat());
- var y = origin.y - this.worldCoordinateLatRange * Math.sin(latRadians);
- return new google.maps.Point(x, y);
- };
- GallPetersProjection.prototype.fromPointToLatLng = function(point, noWrap) {
- var y = point.y;
- var x = point.x;
- if (y < 0) {
- y = 0;
- }
- if (y >= GALL_PETERS_RANGE_Y) {
- y = GALL_PETERS_RANGE_Y;
- }
- var origin = this.worldOrigin_;
- var lng = (x - origin.x) / this.worldCoordinatePerLonDegree_;
- var latRadians = Math.asin((origin.y - y) / this.worldCoordinateLatRange);
- var lat = radiansToDegrees(latRadians);
- return new google.maps.LatLng(lat, lng, noWrap);
- };
- function initialize() {
- var gallPetersMap;
- var gallPetersMapType = new google.maps.ImageMapType({
- getTileUrl: function(coord, zoom)
- {
- var numTiles = 1 << zoom;
- if (coord.y < 0 || coord.y >= numTiles) {
- return null;
- }
- if (coord.x < 0 || coord.x >= numTiles) {
- return null;
- }
- var x = ((coord.x % numTiles) + numTiles) % numTiles;
- var y = ((coord.y % numTiles) + numTiles) % numTiles;
- var baseURL = '/map/';
- baseURL += '' + x + 'x' + coord.y + '-' +(6-zoom)+ '.jpg';
- return baseURL;
- },
- tileSize: new google.maps.Size(256, 256),
- isPng: true,
- minZoom: 2,
- maxZoom: 4,
- name: 'Świat gry'
- });
- gallPetersMapType.projection = new GallPetersProjection();
- document.getElementById('irpmap').style.background = "#324a54";
- var mapOptions = {
- zoom: 3,
- center: new google.maps.LatLng(-35.3536147483593, 100.15234375),
- streetViewControl: false,
- mapTypeControlOptions: {
- mapTypeIds: [google.maps.MapTypeId.ROADMAP, 'gallPetersMap']
- }
- };
- gallPetersMap = new google.maps.Map(document.getElementById('irpmap'),
- mapOptions);
- gallPetersMap.mapTypes.set('gallPetersMap', gallPetersMapType);
- gallPetersMap.setMapTypeId('gallPetersMap');
- var map = gallPetersMap;
- var load = new XMLHttpRequest();
- load.open("GET", "/index.php?app=panel&module=ajax§ion=map&md5check={$this->member->form_hash}", false);
- load.send(null);
- var data = JSON.parse(load.responseText);
- for(var id = 0, len = data.items.length, item; id != len && (item = data.items[id]); ++id) {
- var item = data.items[id];
- var point = new google.maps.LatLng(parseFloat((((item.pos.y*90)/4100)+2.5)), parseFloat((item.pos.x*90)/1500));
- function buildInfoWindow(marker,map,point){
- var contentString = '<div id="contentxD" style="overflow: auto; min-width:160px; min-height: 35px;">' +
- '<div id="siteNotice">' +
- '</div>' +
- '<h3 id="firstHeading" class="firstHeading">' + item.name + '</h3>' +
- '<div id="bodyContent">' +
- '<p>' + item.text + '</p>' +
- '</div>' +
- '</div>';
- var infowindow = new google.maps.InfoWindow({
- content: contentString
- });
- google.maps.event.addListener(marker, 'click', function() {
- infowindow.open(map,marker);
- console.log(marker);
- });
- }
- var marker = new google.maps.Marker({
- position: point,
- map: gallPetersMap,
- title: item.name,
- icon: 'http://net4game.com/public/hrp/map/icons/Icon_'+item.icon+'.gif',
- zIndex: 1000
- });
- buildInfoWindow(marker,map,point);
- }
- }
- google.maps.event.addDomListener(window, 'load', initialize);
- </script>
- <div class="ipsBox">
- <div class="ipsVerticalTabbed ipsLayout ipsLayout_withleft ipsLayout_smallleft clearfix">
- <div class="ipsVerticalTabbed_tabs ipsLayout_left">
- <ul class="clear">
- <li><a href="index.php?app=panel&module=online"><i class="fas fa-gamepad"></i> Gracze online</a></li>
- <li><a href="index.php?app=panel&module=market&sort=1"><i class="fas fa-shopping-basket"></i> Aukcje</a></li>
- <li><a href="index.php?app=panel&module=leader"><i class="fas fa-building"></i> Grupy</a></li>
- <li><a href="index.php?app=panel&module=characters§ion=create"><i class="fas fa-plus"></i> Stwórz postać</a></li>
- <li><a href="index.php?app=panel&module=apelacje"><i class="fas fa-bookmark"></i> Apelacje</a></li>
- <li><a href="index.php?app=panel&module=tickets"><i class="fas fa-code"></i> Zgłoszenia</a></li>
- <li><a href="index.php?app=panel&module=ekipa"><i class="fas fa-users"></i> Ekipa</a></li>
- <li><a href="index.php?app=panel&module=services"><i class="fas fa-credit-card"></i> Premium</a></li>
- <li><a href="index.php?app=panel&module=hosting"><i class="fas fa-image"></i> Hosting Obrazków</a></li>
- <li class="active"><a href="index.php?app=panel&module=map"><i class="fas fa-map-marker-alt"></i> Mapa świata</a></li>
- </ul>
- </div>
- <div class="ipsVerticalTabbed_content ipsLayout_content ipsBox_container" id="modcp_content" style="min-height: 360px;">
- <div class="ipsPad">
- <div id="irpmap" style="height: 500px; width:100%;"></div>
- </div>
- </div>
- </div>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement