<commit_before>var demo = function (el) {
   
   el = document.getElementById(el);

   function type(string, callback, p) {
      
      if (!p) {
         p = document.createElement('p');
         el.appendChild(p);
      }

      if (string === '') {
         return callback()
      }

      setTimeout(function(){
         var character = string.slice(0,1);
             string = string.slice(1);

         p.innerHTML += character;
         type(string, callback, p)
      }, Math.floor(Math.random()*200)); 
   }
<commit_msg>added strike function to demo<commit_after>var demo = function (el) {
   
   el = document.getElementById(el);

   function type(string, callback, p) {
      
      if (!p) {
         p = document.createElement('p');
         el.appendChild(p);
      }

      if (string === '') {
         return callback()
      }

      setTimeout(function(){
         var character = string.slice(0,1);
             string = string.slice(1);

         p.innerHTML += character;
         type(string, callback, p)
      }, Math.floor(Math.random()*200)); 
   }

   function crossOut(count, callback) {

      var i = 1;

      var lastP = el.lastChild,
          lastPText = lastP.firstChild;

      selectChars(count);

      function selectChars(count) {

         if (count === i) {return callback()};

         var range = document.createRange();

         range.selectNode(lastPText);
         range.setStart(lastPText, lastPText.length - i);

         var selection = window.getSelection();

         selection.removeAllRanges();
         selection.addRange(range);

         i++;

         setTimeout(function(){
            selectChars(count);
         }, Math.floor(Math.random()*200) + 100); 

      }
   }

   function strike(callback) {
      var selectedText = window.getSelection();
      var range = selectedText.getRangeAt();

      var strike = document.createElement('span');
          strike.className = 'strike';

      range.surroundContents(strike);

      // The 'empty' span is to stop the user typing within strike out text
      var emptySpan = document.createElement('span');
          emptySpan.innerHTML = '&#8203;'; // zero width character

      // Adds empty span after strike
      range.collapse(false);
      range.insertNode(emptySpan);         
   
      setFocus(document.getElementById('input'));

      return callback()
   }

   function setFocus (el) {

      var range = document.createRange();
          range.selectNodeContents(el);
          range.collapse(false);
      
      var selection = window.getSelection();
          selection.removeAllRanges();
          selection.addRange(range);
   }

{'fraction_non_alphanumeric': 0.12777151446824503, 'fraction_numerical': 0.00864336715520481, 'mean_word_length': 2.0703575547866206, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1294130', 'n_tokens_mistral': 761, 'n_tokens_neox': 717, 'n_words': 160}