<commit_before>$(function() {

  function bindSidebarFadeActions() {
    $(document).scroll(function() {
      var bottomViewPort, footer, footerTop, sidebar;
      footer = '.footer';
      sidebar = '.docked-menu';
      bottomViewPort = $(window).scrollTop() + $(window).height();
      footerTop = $(footer).offset().top;
      if (bottomViewPort >= footerTop) {
        $(sidebar).fadeOut();
      } else {
        $(sidebar).fadeIn();
      }
    });
  }

  bindSidebarFadeActions();

});

<commit_msg>Copy 2 Clipboard WIP. Functional but no affordance yet.<commit_after>$(function() {

  function bindSidebarFadeActions() {
    $(document).scroll(function() {
      var bottomViewPort, footer, footerTop, sidebar;
      footer = '.footer';
      sidebar = '.docked-menu';
      bottomViewPort = $(window).scrollTop() + $(window).height();
      footerTop = $(footer).offset().top;
      if (bottomViewPort >= footerTop) {
        $(sidebar).fadeOut();
      } else {
        $(sidebar).fadeIn();
      }
    });
  }

  function executeCopy (text) {
    var input;
    try {
      input = document.createElement('textarea');
      input.style.position = 'fixed';
      input.style.opacity = 0;
      document.body.appendChild(input);
      input.value = text;
      input.focus();
      input.select();
      document.execCommand('Copy');
      input.remove();
    } catch (err) {
      console.warn("Unable to copy color to clipboard.");
    }
  }

  function executeCopy2(html, useInnerHtml) {
    var text, doc = new DOMParser().parseFromString(html, 'text/html')
    if (useInnerHtml) {
      text = doc.body.innerHTML;
    }
    else {
      text = doc.body.textContent;
    }

    return executeCopy(text);
  }

  function bindCopySnippet() {
    var target, code, copied;

    $('.tdcss-copy-btn').on('click', function(ev) {
      ev.preventDefault();
      ev.stopPropagation();
      var target = $(ev.currentTarget);
      code = $(target).next().text();
      executeCopy2(code, true);
    });
  }

  bindSidebarFadeActions();
  bindCopySnippet();

});


{'fraction_non_alphanumeric': 0.1612747464992757, 'fraction_numerical': 0.001931434089811685, 'mean_word_length': 2.654320987654321, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, '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': '4847215', 'n_tokens_mistral': 653, 'n_tokens_neox': 619, 'n_words': 121}