mandelmapper/web.go

73 lines
1.8 KiB
Go
Raw Permalink Normal View History

2018-07-31 04:41:10 +00:00
package main
import (
"fmt"
"net/http"
)
func init() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path != "/" {
w.Header().Set("Location", "/")
w.WriteHeader(http.StatusMovedPermanently)
return
}
fmt.Fprintf(w, `<!DOCTYPE html>
<html>
<head>
2018-07-31 22:21:41 +00:00
<title>MandelMapper</title>
2018-08-03 06:26:25 +00:00
<meta property="og:url" content="http://mc.deadbeef.codes/" />
<meta property="og:type" content="website" />
<meta property="og:title" content="Mandelbrot Mapper">
<meta property="og:description" content="A Google maps front end to a distributed real-time fractal renderer">
<meta property="og:image" content="https://deadbeef.codes/img/mandelbrot.png" />
<meta property="og:site_name" content="deadbeef.codes">
2018-08-01 03:40:30 +00:00
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAZItO5CjoqDfPLwH_FZ4KcvQFt_L5dQBw"></script>
2018-07-31 04:41:10 +00:00
<script>
var mandelbrotTypeOptions = {
getTileUrl: function(coord, zoom) {
return '/mandelbrot/' + zoom + '/' + coord.x + '/' + coord.y + '.png';
},
tileSize: new google.maps.Size(128, 128),
maxZoom: (1<<16),
minZoom: 1,
name: '0xdeadbeef Mandel Mapper'
2018-07-31 04:41:10 +00:00
};
var mandelbrotMapType = new google.maps.ImageMapType(mandelbrotTypeOptions);
function initialize() {
var mapOptions = {
center: new google.maps.LatLng(0, 0),
zoom: 1,
streetViewControl: false,
mapTypeControlOptions: {
mapTypeIds: ['mandelbrot']
}
};
var map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);
map.mapTypes.set('mandelbrot', mandelbrotMapType);
map.setMapTypeId('mandelbrot');
}
</script>
<style>
#map_canvas {
position: absolute !important;
left: 0 !important;
right: 0 !important;
top: 0 !important;
bottom: 0 !important;
}
</style>
</head>
<body onload="initialize()">
<div id="map_canvas"></div>
</body>
</html>`)
})
}