<commit_before><div class="modal fade" id="badgeContent" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none">
  <div class="modal-dialog">
    <div class="modal-content">

      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span></button>
        <h3 class="modal-title">Badge</h3>
      </div>

      <div class="modal-body">

        <div class="control-group">
          <label class="control-label" for="size">Badge size</label>
          <div class="controls">
            <% ['mini', 'small', 'medium', 'large'].each do |size| %>
              <label class="radio inline">
                <%= radio_button_tag("size", size, size == 'small', class: "size") %>
                <%= size.titleize %>
              </label>
            <% end %>
          </div>
        </div>

        <div class="control-group" id="align">
          <label class="control-label" for="align">Badge alignment</label>
          <% { standard: ['left', 'right'], mini: ['top-left', 'top-right', 'bottom-left', 'bottom-right'] }.each do |size, alignments| %>
            <div class="controls" id="<%= size %>_align">
              <% alignments.each do |align| %>
                <label class="radio inline" id="label_<%= align %>">
                  <%= radio_button_tag("align", align, align == 'left', class: "align") %>
                  <%= align.titleize %>
                </label>
              <% end %>
            </div>
          <% end %>
        </div>

        <div class="control-group">
          <label class="control-label" for="colour">Badge colour</label>
          <div class="controls">
            <% ['black', 'grey', member_colour(@member)].each do |colour| %>
              <label class="radio inline">
                <%= radio_button_tag("colour", colour, colour == 'black', class: "colour") %>
                <%= colour.titleize %>
              </label>
            <% end %>
          </div>
        </div>

        <div class="row-fluid">
          <div class="span6">
            <h3>Code</h3>
            <p><%= text_area_tag("code", javascript_include_tag(badge_member_url(@member, format: :js)), rows: 5, cols: 30, id: "code") %></p>
            <p><button id="copy-button" class="btn btn-primary"><i class="icon-copy"></i></button></p>
          </div>

          <div class="span6">
            <h3>Preview</h3>

            <div id="preview" class="well">
              <%= render(:partial => 'badge') %>
            </div>

          </div>
        </div>

        <script type="text/javascript">
          $(document).ready(function() {
            client = new ZeroClipboard($("#copy-button"));
            $('#mini_align').addClass('hidden');

            $("#copy-button").click(function() {
              return false;
            });

            $("#copy-button").hover(function() {
              $(this).tooltip({"title": "Copy code"})
              $(this).tooltip('show')
            })

            client.on( 'ready', function(event) {
              client.on( "copy", function (event) {
                var clipboard = event.clipboardData;
                clipboard.setData( "text/plain", $("#code").val() );
              });

              client.on( 'aftercopy', function(event) {
                $("#copy-button").tooltip('hide')
                                 .attr('data-original-title', 'Copied!')
                                 .tooltip('fixTitle')
                                 .tooltip('show')
                                 .attr('data-original-title', 'Copy code');
              });
            });


            $('.size, .align, .colour').click(function() {
              url = "<%= badge_member_url(@member, format: :js) %>"

              $('#mini_align, #standard_align').addClass('hidden');

              params = {
                  size: $('.size:checked')[0].value,
                  align: $('.align:checked')[0].value,
                  colour: $('.colour:checked')[0].value
              }

              if (params["size"] == "mini") {
                $('#mini_align').removeClass('hidden');
                if ($.inArray(params["align"], ['left', 'right']) >= 0) {
                  $('#align_top-left').prop('checked', true);
                  params["align"] = "top-left";
                }
              } else {
                $('#standard_align').removeClass('hidden');
                if ($.inArray(params["align"], ['left', 'right']) < 0) {
                  $('#align_left').prop('checked', true);
                  params["align"] = "left";
                }
              }

              $('#preview .odi-badge').attr('class', 'odi-badge odi-<%= @member.product_name %> ' + params["size"] + ' ' + params["align"] + ' ' + params["colour"] )

              url = url + "?" + jQuery.param(params)
              $('#code').val("<script src=\""+ url +"\" type=\"text/javascript\"><\/script>")
            })
          })
        </script>

      </div>

    </div>
  </div>
</div>
<commit_msg>Use jquery feature instead of manual attr accessor<commit_after><div class="modal fade" id="badgeContent" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none">
  <div class="modal-dialog">
    <div class="modal-content">

      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span></button>
        <h3 class="modal-title">Badge</h3>
      </div>

      <div class="modal-body">

        <div class="control-group">
          <label class="control-label" for="size">Badge size</label>
          <div class="controls">
            <% ['mini', 'small', 'medium', 'large'].each do |size| %>
              <label class="radio inline">
                <%= radio_button_tag("size", size, size == 'small', class: "size") %>
                <%= size.titleize %>
              </label>
            <% end %>
          </div>
        </div>

        <div class="control-group" id="align">
          <label class="control-label" for="align">Badge alignment</label>
          <% { standard: ['left', 'right'], mini: ['top-left', 'top-right', 'bottom-left', 'bottom-right'] }.each do |size, alignments| %>
            <div class="controls" id="<%= size %>_align">
              <% alignments.each do |align| %>
                <label class="radio inline" id="label_<%= align %>">
                  <%= radio_button_tag("align", align, align == 'left', class: "align") %>
                  <%= align.titleize %>
                </label>
              <% end %>
            </div>
          <% end %>
        </div>

        <div class="control-group">
          <label class="control-label" for="colour">Badge colour</label>
          <div class="controls">
            <% ['black', 'grey', member_colour(@member)].each do |colour| %>
              <label class="radio inline">
                <%= radio_button_tag("colour", colour, colour == 'black', class: "colour") %>
                <%= colour.titleize %>
              </label>
            <% end %>
          </div>
        </div>

        <div class="row-fluid">
          <div class="span6">
            <h3>Code</h3>
            <p><%= text_area_tag("code", javascript_include_tag(badge_member_url(@member, format: :js)), rows: 5, cols: 30, id: "code") %></p>
            <p><button id="copy-button" class="btn btn-primary"><i class="icon-copy"></i></button></p>
          </div>

          <div class="span6">
            <h3>Preview</h3>

            <div id="preview" class="well">
              <%= render(:partial => 'badge') %>
            </div>

          </div>
        </div>

        <script type="text/javascript">
          $(document).ready(function() {
            client = new ZeroClipboard($("#copy-button"));
            $('#mini_align').addClass('hidden');

            $("#copy-button").click(function() {
              return false;
            });

            $("#copy-button").hover(function() {
              $(this).tooltip({"title": "Copy code"})
              $(this).tooltip('show')
            })

            client.on( 'ready', function(event) {
              client.on( "copy", function (event) {
                var clipboard = event.clipboardData;
                clipboard.setData( "text/plain", $("#code").val() );
              });

              client.on( 'aftercopy', function(event) {
                $("#copy-button").tooltip('hide')
                                 .attr('data-original-title', 'Copied!')
                                 .tooltip('fixTitle')
                                 .tooltip('show')
                                 .attr('data-original-title', 'Copy code');
              });
            });


            $('.size, .align, .colour').click(function() {
              url = "<%= badge_member_url(@member, format: :js) %>"

              $('#mini_align, #standard_align').addClass('hidden');

              params = {
                  size: $('.size:checked').val(),
                  align: $('.align:checked').val(),
                  colour: $('.colour:checked').val(),
              }

              if (params["size"] == "mini") {
                $('#mini_align').removeClass('hidden');
                if ($.inArray(params["align"], ['left', 'right']) >= 0) {
                  $('#align_top-left').prop('checked', true);
                  params["align"] = "top-left";
                }
              } else {
                $('#standard_align').removeClass('hidden');
                if ($.inArray(params["align"], ['left', 'right']) < 0) {
                  $('#align_left').prop('checked', true);
                  params["align"] = "left";
                }
              }

              $('#preview .odi-badge').attr('class', 'odi-badge odi-<%= @member.product_name %> ' + params["size"] + ' ' + params["align"] + ' ' + params["colour"] )

              url = url + "?" + jQuery.param(params)
              $('#code').val("<script src=\""+ url +"\" type=\"text/javascript\"><\/script>")
            })
          })
        </script>

      </div>

    </div>
  </div>
</div>

{'fraction_non_alphanumeric': 0.19710739763510213, 'fraction_numerical': 0.0030294146389133196, 'mean_word_length': 1.6748562467328802, 'pattern_counts': {'":': 2, '<': 173, '<?xml version=': 0, '>': 175, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4317310', 'n_tokens_mistral': 2972, 'n_tokens_neox': 2764, 'n_words': 523}