<commit_before><!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <title>Retroscope</title>
  <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0" />
  <link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.1/dist/leaflet.css" />
  <script src="https://unpkg.com/leaflet@1.0.1/dist/leaflet.js"></script>
  <script src="https://unpkg.com/leaflet-hash@0.2.1/leaflet-hash.js"></script>
  <script src="//frogcat.github.io/leaflet-tileoverlay-mask/leaflet-tileoverlay-mask.js"></script>
</head>

<body>
  <div id="map" style="position:absolute;top:0;left:0;right:0;bottom:0;"></div>
  <script>
    var mask = L.svg.mask();
    var map = L.map("map", L.extend({
      zoom: 15,
      center: [35.6707, 139.7852],
      renderer: mask,
    }, L.Hash.parseHash(location.hash)));
    map.attributionControl.addAttribution("<a href='https://github.com/frogcat/retroscope'>fork me on GitHub</a>");
    L.hash(map);
    L.tileLayer("https://cyberjapandata.gsi.go.jp/xyz/ort/{z}/{x}/{y}.jpg", {
      attribution: "<a href='http://maps.gsi.go.jp/development/ichiran.html'>地理院タイル</a>"
    }).addTo(map);

    L.tileOverlay("http://www.finds.jp/ws/tmc/1.0.0/Kanto_Rapid-900913-L/{z}/{x}/{y}.png", {
      attribution: "<a href='http://habs.dc.affrc.go.jp/'>歴史的農業環境閲覧システム(NIAES)</a>"
    }).addTo(map);
    map.on("mousemove", function(event) {
      mask.setCenter(event.containerPoint);
    });
  </script>
</body><commit_msg>read layer definitions from URL search part<commit_after><!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <title>Retroscope</title>
  <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0" />
  <link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.1/dist/leaflet.css" />
  <script src="https://unpkg.com/leaflet@1.0.1/dist/leaflet.js"></script>
  <script src="https://unpkg.com/leaflet-hash@0.2.1/leaflet-hash.js"></script>
  <script src="//frogcat.github.io/leaflet-tileoverlay-mask/leaflet-tileoverlay-mask.js"></script>
</head>

<body>
  <div id="map" style="position:absolute;top:0;left:0;right:0;bottom:0;"></div>
  <script>
    var db = {
      gsi: {
        template: "https://cyberjapandata.gsi.go.jp/xyz/{$1}/{z}/{x}/{y}.{$2}",
        attribution: "<a href='http://maps.gsi.go.jp/development/ichiran.html'>地理院タイル</a>"
      },
      mw: {
        template: "http://mapwarper.net/maps/tile/{$1}/{z}/{x}/{y}.png",
        attribution: "<a href='http://mapwarper.net/maps/{$1}'>Map Warper</a>"
      },
      osm: {
        template: "http://{s}.tile.osm.org/{z}/{x}/{y}.png",
        attribution: "&copy; <a href='http://osm.org/copyright'>OpenStreetMap</a> contributors"
      },
      habs: {
        template: "http://www.finds.jp/ws/tmc/1.0.0/Kanto_Rapid-900913-L/{z}/{x}/{y}.png",
        attribution: "<a href='http://habs.dc.affrc.go.jp/'>歴史的農業環境閲覧システム(NIAES)</a>"
      },
      nls: {
        template: "http://nls-0.tileserver.com/nls/{z}/{x}/{y}.jpg",
        attribution: "Historical maps from 1919-47  <a href='http://geo.nls.uk/maps/api/'>NLS Maps API</a>"
      }
    };

    var layers = [];
    if (location.search.match(/^\?(.+)&(.+)$/)) {
      [RegExp.$1, RegExp.$2].forEach(function(a) {
        var b = a.split("/");
        var c = db[b[0]];
        if (c) {
          var template = null;
          var option = {};
          for (var key in c) {
            var d = c[key];
            for (var i = 1; i < b.length; i++)
              d = d.replace("{$" + i + "}", b[i]);
            if (key === "template")
              template = d;
            else
              option[key] = d;
          }
          if (template)
            layers.push(layers.length == 0 ? L.tileLayer(template, option) : L.tileOverlay(template, option));
        }
      });
    }

    if (layers.length != 2)
      location.href = "?gsi/ort/jpg&habs" + location.hash;

    var mask = L.svg.mask();
    var map = L.map("map", L.extend({
      zoom: 15,
      center: [35.6707, 139.7852],
      layers: layers,
      renderer: mask,
    }, L.Hash.parseHash(location.hash)));
    map.attributionControl.addAttribution("<a href='https://github.com/frogcat/retroscope'>fork me on GitHub</a>");
    L.hash(map);
    map.on("mousemove", function(event) {
      mask.setCenter(event.containerPoint);
    });
  </script>
</body>
{'fraction_non_alphanumeric': 0.22154991854782408, 'fraction_numerical': 0.023504770770304863, 'mean_word_length': 2.740644038294169, 'pattern_counts': {'":': 0, '<': 64, '<?xml version=': 0, '>': 63, 'https://': 10, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, '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': '4372340', 'n_tokens_mistral': 1747, 'n_tokens_neox': 1676, 'n_words': 222}