<commit_before><%= javascript_include_tag 'openlayers.js' %>
<%= javascript_include_tag '//www.google.com/jsapi' %>
<%= javascript_include_tag params[:controller] %>

<!-- Initialize OpenLayers and Google Overlay view-->
<%= javascript_tag do %>
function initOpenLayers() {
  window.annotation_view = new maphub.AnnotationView({
      width: <%= @map.width %>,
      height: <%= @map.height %>,
      zoomify_url: "<%= @map.tileset_uri + '/' %>",
      annotations_url: "<%= map_annotations_url(@map, :format => :json) %>",
      control_points_url: "<%= map_control_points_url(@map, :format => :json) %>",
      editable: <%= user_signed_in? ? "true" : "false" %>,
      user_id: <%= user_signed_in? ? current_user.id : "0" %>
  });
}

function initGoogleOverlay() {
    <% if @map.has_overlay? %>
      <% overlay_boundary = @map.overlay_boundary %>
        <% unless overlay_boundary.nil? %>
          if (typeof window.overlay_view === 'undefined') {
            window.overlay_view = new maphub.OverlayView({
              id: <%= @map.id %>,
              ne_lat: <%= overlay_boundary.ne_lat%>,
              ne_lng: <%= overlay_boundary.ne_lng%>,
              sw_lat: <%= overlay_boundary.sw_lat%>,
              sw_lng: <%= overlay_boundary.sw_lng%>,
              overlay_tileset_uri: "<%= @map.overlay_tileset_uri %>",
              min_tileset: <%= overlay_boundary.min_tileset %>,
              max_tileset: <%= overlay_boundary.max_tileset %>
            });
          }
        <% end %>
    <% end %>
}

function initGoogleEarth(){
  <% if @map.has_overlay? %>
    if (typeof window.earth_view === 'undefined') {
      window.earth_view = new maphub.EarthView({
        kml_uri: "<%= @map.kml_uri %>"
      });
    }
  <% end %>
}

function initTaggingView() {
  window.tagging_view = new maphub.TaggingView(
    "<%= annotation_tag_find_url(:map => @map.id) %>",
    1000
  );
}

$(document).ready(function(){
  initOpenLayers();   // initialize OpenLayers by default
  initTaggingView();
  
  $("#overlay_viewer").hide();
  $("earth_viewer").hide();
  $("#map-type-regular").click(function() {
    $("#overlay_viewer").hide();
    $("earth_viewer").hide();
    $("#viewer").show();
    $("#control-toggle button").removeAttr("disabled");
  });
  $("#map-type-google").click(function() {
    initGoogleOverlay();
    $("#viewer").hide();
    $("earth_viewer").hide();
    $("#overlay_viewer").show();
    $("#control-toggle button").attr("disabled", "disabled");
  });
  $("#map-type-earth").click(function() {
    initGoogleEarth();
    $("#viewer").hide();
    $("#overlay_viewer").hide();
    $("earth_viewer").show();
    $("#control-toggle button").attr("disabled", "disabled");
  });
});
<% end %>

<div class="row">
  <div id="tooltip-selected">
  <p id="notice"><%= notice %></p>
  
  <div class="span12">
    <div class="row">
      
      <!-- Map View -->
      <div class="span8">
        <div id="viewer" class="span8" style="height:600px;"></div>
        <div id="overlay_viewer" style="height:600px;"></div>
        <div id="earth_viewer" style="height:600px;"></div>
      </div>
      <!-- Right column-->
      <div class="span4">
        
        <% if user_signed_in? %>
        <div id="control-toggle">
        
          <div class="btn-group" data-toggle="buttons-radio">
            <button class="btn btn-primary" id="control-toggle-navigate" value="none">
              <i class="icon-move icon-white"></i><commit_msg>Fixed minor bug where Earth wouldn't disappear<commit_after><%= javascript_include_tag 'openlayers.js' %>
<%= javascript_include_tag '//www.google.com/jsapi' %>
<%= javascript_include_tag params[:controller] %>

<!-- Initialize OpenLayers and Google Overlay view-->
<%= javascript_tag do %>
function initOpenLayers() {
  window.annotation_view = new maphub.AnnotationView({
      width: <%= @map.width %>,
      height: <%= @map.height %>,
      zoomify_url: "<%= @map.tileset_uri + '/' %>",
      annotations_url: "<%= map_annotations_url(@map, :format => :json) %>",
      control_points_url: "<%= map_control_points_url(@map, :format => :json) %>",
      editable: <%= user_signed_in? ? "true" : "false" %>,
      user_id: <%= user_signed_in? ? current_user.id : "0" %>
  });
}

function initGoogleOverlay() {
    <% if @map.has_overlay? %>
      <% overlay_boundary = @map.overlay_boundary %>
        <% unless overlay_boundary.nil? %>
          if (typeof window.overlay_view === 'undefined') {
            window.overlay_view = new maphub.OverlayView({
              id: <%= @map.id %>,
              ne_lat: <%= overlay_boundary.ne_lat%>,
              ne_lng: <%= overlay_boundary.ne_lng%>,
              sw_lat: <%= overlay_boundary.sw_lat%>,
              sw_lng: <%= overlay_boundary.sw_lng%>,
              overlay_tileset_uri: "<%= @map.overlay_tileset_uri %>",
              min_tileset: <%= overlay_boundary.min_tileset %>,
              max_tileset: <%= overlay_boundary.max_tileset %>
            });
          }
        <% end %>
    <% end %>
}

function initGoogleEarth(){
  <% if @map.has_overlay? %>
    if (typeof window.earth_view === 'undefined') {
      window.earth_view = new maphub.EarthView({
        kml_uri: "<%= @map.kml_uri %>"
      });
    }
  <% end %>
}

function initTaggingView() {
  window.tagging_view = new maphub.TaggingView(
    "<%= annotation_tag_find_url(:map => @map.id) %>",
    1000
  );
}

$(document).ready(function(){
  initOpenLayers();   // initialize OpenLayers by default
  initTaggingView();
  
  $("#overlay_viewer").hide();
  $("earth_viewer").hide();
  $("#map-type-regular").click(function() {
    $("#overlay_viewer").hide();
    $("#earth_viewer").hide();
    $("#viewer").show();
    $("#control-toggle button").removeAttr("disabled");
  });
  $("#map-type-google").click(function() {
    initGoogleOverlay();
    $("#viewer").hide();
    $("#earth_viewer").hide();
    $("#overlay_viewer").show();
    $("#control-toggle button").attr("disabled", "disabled");
  });
  $("#map-type-earth").click(function() {
    initGoogleEarth();
    $("#viewer").hide();
    $("#overlay_viewer").hide();
    $("#earth_viewer").show();
    $("#control-toggle button").attr("disabled", "disabled");
  });
});
<% end %>

<div class="row">
  <div id="tooltip-selected">
  <p id="notice"><%= notice %></p>
  
  <div class="span12">
    <div class="row">
      
      <!-- Map View -->
      <div class="span8">
        <div id="viewer" class="span8" style="height:600px;"></div>
        <div id="overlay_viewer" style="height:600px;"></div>
        <div id="earth_viewer" style="height:600px;"></div>
      </div>
      <!-- Right column-->
      <div class="span4">
        
        <% if user_signed_in? %>
        <div id="control-toggle">
        
          <div class="btn-group" data-toggle="buttons-radio">
            <button class="btn btn-primary" id="control-toggle-navigate" value="none">
              <i class="icon-move icon-white"></i>
{'fraction_non_alphanumeric': 0.2045977011494253, 'fraction_numerical': 0.005459770114942529, 'mean_word_length': 2.9799885648942253, 'pattern_counts': {'":': 0, '<': 111, '<?xml version=': 0, '>': 117, 'https://': 0, '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': '4011389', 'n_tokens_mistral': 2441, 'n_tokens_neox': 2248, 'n_words': 355}