<commit_before><!DOCTYPE html>
<html>
  <head>
    <meta charset='utf-8'>
    <title>Remote Shade Control App</title>
    <link rel="apple-touch-icon" href="apple-touch-icon.png"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- Bootstrap -->
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/bootstrap-switch.css" rel="stylesheet">
    
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
      <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
    <![endif]-->
  </head>
  <body>
    <% @shades.each do |name, shade| %>
      <h1><%= shade.name %></h1>
      <a class="btn btn-lg btn-default" href="/shades/<%= shade.id %>/up">up</a><br>
      <a class="btn btn-lg btn-default" href="/shades/<%= shade.id %>/stop">stop</a><br>
      <a class="btn btn-lg btn-default" href="/shades/<%= shade.id %>/down">down</a><br>
      <br>
      <div>
        <div id="auto-switch-<%= shade.id %>" class="make-switch has-switch" data-text-label="Auto">
          <input type="checkbox" <%= shade.auto_toggled? ? "checked" : '' %>>
        </div>
      </div>
      <br>
      The sun rises at <%= shade.sunrise %>. Shades will rise <%= shade.raise_up_time %> sunrise.<br>
      The sun sets at <%= shade.sunset %>. Shades will lower <%= shade.lower_down_time %> sunset.<br>
      <script>
        $('#auto-switch-<%= shade.id %>').on('switch-change', function (e, data) {
            var $el = $(data.el)
              , value = data.value;
            // console.log(e, $el, value);
            $.get( "/shades/<%= shade.id %>/auto_toggle", { toggle: value } );
        });
      </script>
    <% end %>
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://code.jquery.com/jquery.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="js/bootstrap.min.js"></script>
    <script src="js/bootstrap-switch.js"></script>
  </body>
</html><commit_msg>Moves jquery JS loads to head so we can script auto toggling.<commit_after><!DOCTYPE html>
<html>
  <head>
    <meta charset='utf-8'>
    <title>Remote Shade Control App</title>
    <link rel="apple-touch-icon" href="apple-touch-icon.png"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- Bootstrap -->
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/bootstrap-switch.css" rel="stylesheet">
    
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
      <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
    <![endif]-->
    
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://code.jquery.com/jquery.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="js/bootstrap.min.js"></script>
    <script src="js/bootstrap-switch.js"></script>
  </head>
  <body>
    <% @shades.each do |name, shade| %>
      <h1><%= shade.name %></h1>
      <a class="btn btn-lg btn-default" href="/shades/<%= shade.id %>/up">up</a><br>
      <a class="btn btn-lg btn-default" href="/shades/<%= shade.id %>/stop">stop</a><br>
      <a class="btn btn-lg btn-default" href="/shades/<%= shade.id %>/down">down</a><br>
      <br>
      <div>
        <div id="auto-switch-<%= shade.id %>" class="make-switch has-switch" data-text-label="Auto">
          <input type="checkbox" <%= shade.auto_toggled? ? "checked" : '' %>>
        </div>
      </div>
      <br>
      The sun rises at <%= shade.sunrise %>. Shades will rise <%= shade.raise_up_time %> sunrise.<br>
      The sun sets at <%= shade.sunset %>. Shades will lower <%= shade.lower_down_time %> sunset.<br>
      <script>
        $('#auto-switch-<%= shade.id %>').on('switch-change', function (e, data) {
            var $el = $(data.el)
              , value = data.value;
            // console.log(e, $el, value);
            $.get( "/shades/<%= shade.id %>/auto_toggle", { toggle: value } );
        });
      </script>
    <% end %>
  </body>
</html>
{'fraction_non_alphanumeric': 0.20795976383118303, 'fraction_numerical': 0.007434944237918215, 'mean_word_length': 2.6768488745980705, 'pattern_counts': {'":': 0, '<': 137, '<?xml version=': 0, '>': 137, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, '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': '6911083', 'n_tokens_mistral': 1600, 'n_tokens_neox': 1511, 'n_words': 348}