<commit_before><script>
  VisitorViewer = {
    selectedEntry:null,
    
    
    clear_detail: function() {
      if(VisitorViewer.selectedEntry) {
        Element.removeClassName('entry_' + VisitorViewer.selectedEntry,'selected_row');
      }
    },
  
    detail: function(entry_id) {
      VisitorViewer.clear_detail();
      new Ajax.Updater('visitor_detail',
                       "<%= url_for :action => 'visitor_detail' %>/" + entry_id);
      Element.addClassName('entry_' + entry_id,'selected_row');
      VisitorViewer.selectedEntry = entry_id;
    },
    
    loadStatistics: function() {
      if(!$('site_statistics_details')) {
        new Ajax.Updater('site_statistics',
                          "<%= url_for :action => 'site_statistics' %>/" );
      }
    
    
    },
    
    googleRadios: function() {
      if($('options_google_analytics_disabled').checked) {
        $('options_analytics_code').disabled = true;
        Element.hide('analytics_enabled');
        Element.show('analytics_disabled');
      }
      else if($('options_google_analytics_enabled').checked) {
        $('options_analytics_code').disabled = false;
        Element.show('analytics_enabled');
        Element.hide('analytics_disabled');
      }
    
    },
    
    saveOptions: function(frm) {
      params = Form.serialize(frm);
      $('submit_options').disabled = true;
      new Ajax.Request("<%= url_for :action=>'options_update' %>",
                      { 
                        parameters: params,
                        onComplete: function(req) {
                          $('submit_options').disabled = false;
                          new Effect.Appear('options_updated');
                        }
                      });
      return false;
    }
    
  
  
  }
  
   <%= active_table_javascript %>
</script>

<br/>
<br/>
<% ajax_tabs [ 'Site Visitors', 'Google Analytics' ], 'Site Visitors' do |t| -%>


<% t.tab do %>
<table>

<tr>
  <td style='padding-right:10px;' width='450' valign='top'>
<div id='entries_table'>
<%= render :partial => 'visitor_table' %>
</div>
  </td>
  <td style='padding-left:10px;' valign='top'>
    <div id='visitor_detail'>
    </div>
  </td>
</tr>
</table>

<% end -%>

<% t.tab do %>
  <div id='options_updated' style='display:none;'><b><%= "Options Updated".t %></b></div>
  <% tabled_form_for :options, @options, :html => { :onsubmit => 'return VisitorViewer.saveOptions(this);' } do |f| %>
    <%= f.radio_buttons :google_analytics, [ [ 'Enabled' , 'enabled' ], [ 'Disabled', 'disabled'] ], :label => "Google Analytics", :onchange => 'VisitorViewer.googleRadios()' %>
    <%= f.text_field :analytics_code, :disabled => @options.google_analytics == 'enabled' ? false : true %>
    <%= f.submit_tag 'Update', :id => 'submit_options' %>
  <% end -%>

  <div id='analytics_disabled' <%= "style='display:none;'" if @options.google_analytics == 'enabled'%>>
  <%= "Google Analytics is a free service that tracks visitors to your website and allows you to analyze your traffic.".t %>
  <%= "You must first".t %> <a target='_blank' href='<%= "http://www.google.com/analytics/".t %>'><%= "Register for Google Analytics".t %></a>. 
  <%="Once you are registered, please click enabled and enter your analytics code from the code block as highlighted below. ".t %>
  <pre>
    <%= h('
    <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
    </script>
    <script type="text/javascript">') %>
    _uacct = "<b>UA-XXXXXXX-X</b>";
    <%= h('
    urchinTracker();
    </script>  ') %>
</pre>
</div>
<div id='analytics_enabled' <%= "style='display:none;'" unless @options.google_analytics == 'enabled'%>>
  <%= "Goto".t %><a target='_blank' href='http://www.google.com/analytics/'><%= "Your Google Analytics Account".t %></a>
</div>

<% end -%>

<% end -%>
<commit_msg>Use more actions<commit_after><script>
  VisitorViewer = {
    selectedEntry:null,
    
    
    clear_detail: function() {
      if(VisitorViewer.selectedEntry) {
        Element.removeClassName('entry_' + VisitorViewer.selectedEntry,'selected_row');
      }
    },
  
    detail: function(entry_id) {
      VisitorViewer.clear_detail();
      new Ajax.Updater('visitor_detail',
                       "<%= url_for :action => 'visitor_detail' %>/" + entry_id);
      Element.addClassName('entry_' + entry_id,'selected_row');
      VisitorViewer.selectedEntry = entry_id;
    },
    
    loadStatistics: function() {
      if(!$('site_statistics_details')) {
        new Ajax.Updater('site_statistics',
                          "<%= url_for :action => 'site_statistics' %>/" );
      }
    
    
    },
    
    googleRadios: function() {
      if($('options_google_analytics_disabled').checked) {
        $('options_analytics_code').disabled = true;
        Element.hide('analytics_enabled');
        Element.show('analytics_disabled');
      }
      else if($('options_google_analytics_enabled').checked) {
        $('options_analytics_code').disabled = false;
        Element.show('analytics_enabled');
        Element.hide('analytics_disabled');
      }
    
    },
    
    saveOptions: function(frm) {
      params = Form.serialize(frm);
      $('submit_options').disabled = true;
      new Ajax.Request("<%= url_for :action=>'options_update' %>",
                      { 
                        parameters: params,
                        onComplete: function(req) {
                          $('submit_options').disabled = false;
                          new Effect.Appear('options_updated');
                        }
                      });
      return false;
    }
    
  }
  
   <%= active_table_javascript %>
</script>
<% action_panel :handler => 'visitors', :more => true do |p| -%>
<% end -%>

<% more_action_panel :handler => 'visitors' do |p| -%>
  <%= p.link "Visitors", {:url => "javascript:void(0);"}, :"j-action" => 'swap', :swap => '#visitors,#google_analytics' %>
  <%= p.link "Google Analytics", {:url => "javascript:void(0);"}, :"j-action" => 'swap', :swap => '#google_analytics,#visitors' %>
<% end -%>


<hr/>

<div id="visitors">
<table>
 <tr>
  <td style='padding-right:10px;' width='450' valign='top'>
<div id='entries_table'>
<%= render :partial => 'visitor_table' %>
</div>
  </td>
  <td style='padding-left:10px;' valign='top'>
    <div id='visitor_detail'>
    </div>
  </td>
</tr>
</table>
</div>

<div id="google_analytics" style="display:none;" class="visitor_container">
<div class="heading"><h2>Google Analytics</h2></div>
<div class="visitor_container_body" style="width:600px;">
<div id='options_updated' style='display:none;'><b><%= "Options Updated".t %></b></div>
  <% tabled_form_for :options, @options, :html => { :onsubmit => 'return VisitorViewer.saveOptions(this);' } do |f| %>
    <%= f.radio_buttons :google_analytics, [ [ 'Enabled' , 'enabled' ], [ 'Disabled', 'disabled'] ], :label => "Google Analytics", :onchange => 'VisitorViewer.googleRadios()' %>
    <%= f.text_field :analytics_code, :disabled => @options.google_analytics == 'enabled' ? false : true %>
    <%= f.spacer %>
    <%= f.submit_tag 'Update', :id => 'submit_options' %>
  <% end -%>

  <br/>

  <div id='analytics_disabled' <%= "style='display:none;'" if @options.google_analytics == 'enabled'%>>
  <%= "Google Analytics is a free service that tracks visitors to your website and allows you to analyze your traffic.".t %>
  <%= "You must first".t %> <a target='_blank' href='<%= "http://www.google.com/analytics/".t %>'><%= "Register for Google Analytics".t %></a>. 
  <%="Once you are registered, please click enabled and enter your analytics code from the code block as highlighted below. ".t %>
  <pre>
    <%= h('
    <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
    </script>
    <script type="text/javascript">') %>
    _uacct = "<b>UA-XXXXXXX-X</b>";
    <%= h('
    urchinTracker();
    </script>  ') %>
  </pre>
</div>
<div id='analytics_enabled' <%= "style='display:none;'" unless @options.google_analytics == 'enabled'%>>
  <%= "Goto".t %><a target='_blank' href='http://www.google.com/analytics/'><%= "Your Google Analytics Account".t %></a>
</div>
</div>
</div>
{'fraction_non_alphanumeric': 0.1874006116207951, 'fraction_numerical': 0.002568807339449541, 'mean_word_length': 2.9708596406022343, 'pattern_counts': {'":': 0, '<': 142, '<?xml version=': 0, '>': 171, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, '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': '6326193', 'n_tokens_mistral': 2753, 'n_tokens_neox': 2602, 'n_words': 493}