<commit_before><html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>TileLite Mapnik Server</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <style type="text/css">
    html, body { height: 100%; }
    body {margin: 0px;}
    #map {
      width: 100%;
      height: 100%;
    }
  </style>
<script src="http://dev.openlayers.org/nightly/OpenLayers.js"></script>
<script src="http://openstreetmap.org/openlayers/OpenStreetMap.js"></script>
<script type="text/javascript">
        var map, osm_official_tiles, tilelite_layer;
        
        function init() {
            
            // Options for World Map in Google Spherical Mercator Projection
            var options = { 
                maxResolution: 156543.0339,
                units: 'm',
                projection: new OpenLayers.Projection("EPSG:900913"),
                maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34),
                };
            
             function getTileURL (bounds) {
                var res = this.map.getResolution();
                var x = Math.round((bounds.left - this.maxExtent.left) / (res * this.tileSize.w));
                var y = Math.round((this.maxExtent.top - bounds.top) / (res * this.tileSize.h));
                var z = this.map.getZoom();
                var limit = Math.pow(2, z);
                if (y < 0 || y >= limit)
                {
                    return ""; // Tile not found. Use Firefox and Firebug to see url requested
                }
                else
                {
                    x = ((x % limit) + limit) % limit;       
                    var url = this.url;
                    var path = z + "/" + x + "/" + y + ".png";
                    if (url instanceof Array)
                    {
                        url = this.selectUrl(path, url);
                    }
                    return url + path;
                }
            }
            
            map = new OpenLayers.Map("map", options);
            
            
            var tiles_url = "http://localhost:8000/"

            // http://trac.openlayers.org/browser/trunk/openlayers/lib/OpenLayers/Layer/TileCache.js#L75            
            tilelite_layer = new OpenLayers.Layer.TileCache("Tilelite server layer", tiles_url,
                    "dummy", // layername: unused but must be set
                        {   type: "png",
                            getURL: getTileURL,
                            gutter:0,
                            //ratio:1,
                            //wrapDateLine: true,
                            transitionEffect:'resize'
                        }
                    );
            
            // Uses linked OpenStreetMap.js from openstreetmap as a comparison layer<commit_msg>fiddle with the openlayers example adding attribution, fake multiple server requests, and using the OSM layer for creating the layer instead of TMS<commit_after><html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>TileLite Mapnik Server</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <style type="text/css">
    html, body { height: 100%; }
    body {margin: 0px;}
    #map {
      width: 100%;
      height: 100%;
    }
  </style>
<script src="http://dev.openlayers.org/nightly/OpenLayers.js"></script>
<script src="http://openstreetmap.org/openlayers/OpenStreetMap.js"></script>
<script type="text/javascript">
        var map, osm_official_tiles, tilelite_layer;
        
        function init() {
            
            // Options for World Map in Google Spherical Mercator Projection
            var options = { 
                maxResolution: 156543.0339,
                units: 'm',
                projection: new OpenLayers.Projection("EPSG:900913"),
                maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34),
                };
            
             function getTileURL (bounds) {
                var res = this.map.getResolution();
                var x = Math.round((bounds.left - this.maxExtent.left) / (res * this.tileSize.w));
                var y = Math.round((this.maxExtent.top - bounds.top) / (res * this.tileSize.h));
                var z = this.map.getZoom();
                var limit = Math.pow(2, z);
                if (y < 0 || y >= limit)
                {
                    return ""; // Tile not found. Use Firefox and Firebug to see url requested
                }
                else
                {
                    x = ((x % limit) + limit) % limit;       
                    var url = this.url;
                    var path = z + "/" + x + "/" + y + ".png";
                    if (url instanceof Array)
                    {
                        url = this.selectUrl(path, url);
                    }
                    return url + path;
                }
            }
            
            map = new OpenLayers.Map("map", options);
            
            
            var tiles_url = "http://localhost:8000/"
            // Note this is an openlayers/browser trick of pointing to multiple urls,
            // TileLite just happens to work with it out of the box since it ignores any url prefix
            var servers = [tiles_url+'a/',tiles_url+'b/',tiles_url+'c/']

            // http://trac.openlayers.org/browser/trunk/openlayers/lib/OpenLayers/Layer/TileCache.js#L75            
            __tilelite_layer = new OpenLayers.Layer.TileCache("Tilelite server layer", servers,
                    "dummy", // layername: unused but must be set
                        {   type: "png",
                            getURL: getTileURL,
                            attribution: "Data served by <a href='http://bitbucket.org/springmeyer/tilelite/'>TileLite </a>",
                            maxResolution: 156543.0339,
                            maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),
                            maxResolution: 156543.0339,
                            units: "m",
                            projection: "EPSG:900913",
                            gutter:0,
                            //ratio:1,
                            //wrapDateLine: true,
                            transitionEffect:'resize'
                        }
                    );
            
            // To create the tilelite layers lets borrow from the OSM layer contructor but repoint urls to localhost
            tilelite_layer = new OpenLayers.Layer.OSM.Mapnik("TileLite Server Layer");
            tilelite_layer.url = servers;
            tilelite_layer.attribution = "Data served by <a href='http://bitbucket.org/springmeyer/tilelite/'>TileLite </a>"
                        
            // Uses linked OpenStreetMap.js from openstreetmap as a comparison layer
{'fraction_non_alphanumeric': 0.11077191452245966, 'fraction_numerical': 0.03343509230992877, 'mean_word_length': 1.3329942353340116, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6501085', 'n_tokens_mistral': 2072, 'n_tokens_neox': 1818, 'n_words': 435}