<commit_before>/**
 * There are various use cases for hidng content on load
 * 1. on initial load to hide placeholder strings that will be interpolated
 * 2. large data set load that might change and or flicker the content when loaded
 * 3. async data loading, loading icon and reloading icon
 */

//Example: http://jsbin.com/kocodalaqu/edit?html,js,output 

//Example with large data set: http://jsbin.com/muxisecaxa/edit?html,js,output

/* MagJS Example - mag.cloak */

mag.cloak = function(id, key) {
  
  var classHide =mag.cloak.classHideName= 'cloak';
  
  var cloak = function(node, index) {
    
    // should be already hidden at this point before code is run on page load class="cloak|hide"
    //node.style.display = 'none';
    //TODO: only onload? run only once then remove handler?
    
    mag.utils.onLCEvent('willupdate', index, function(vnode) {
     //Check self
     if(vnode.classList.contains(classHide)){
       vnode.classList.remove(classHide)
     }
      //class based for all sub nodes
      var nodes = vnode.getElementsByClassName(classHide);
      if (nodes.length) {
        for (var i = 0; i < nodes.length; i++) {
          var item = nodes[i];
          item.classList.remove(classHide);
        }
      }
      //if (vnode.style.display == 'none') vnode.style.display = 'block'
    }.bind({}, node));

  };

  var cloaker = function(id) {<commit_msg>Update mag-cloak.js<commit_after>/**
 * There are various use cases for hidng content on load
 * 1. on initial load to hide placeholder strings that will be interpolated
 * 2. large data set load that might change and or flicker the content when loaded
 * 3. async data loading, loading icon and reloading icon
 */

//Example: http://jsbin.com/kocodalaqu/edit?html,js,output 

//Example with large data set: http://jsbin.com/muxisecaxa/edit?html,js,output

/* MagJS Example - mag.cloak */

mag.cloak = function(id, key) {
  
  var classHide = mag.cloak.classHideName || 'cloak';
  
  var cloak = function(node, index) {
    
    // should be already hidden at this point before code is run on page load class="cloak|hide"
    //node.style.display = 'none';
    //TODO: only onload? run only once then remove handler?
    
    mag.utils.onLCEvent('willupdate', index, function(vnode) {
     //Check self
     if(vnode.classList.contains(classHide)){
       vnode.classList.remove(classHide)
     }
      //class based for all sub nodes
      var nodes = vnode.getElementsByClassName(classHide);
      if (nodes.length) {
        for (var i = 0; i < nodes.length; i++) {
          var item = nodes[i];
          item.classList.remove(classHide);
        }
      }
      //if (vnode.style.display == 'none') vnode.style.display = 'block'
    }.bind({}, node));

  };

  var cloaker = function(id) {
{'fraction_non_alphanumeric': 0.12261776339446243, 'fraction_numerical': 0.002876663070837828, 'mean_word_length': 2.8109589041095893, 'pattern_counts': {'":': 0, '<': 5, '<?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': '7114546', 'n_tokens_mistral': 888, 'n_tokens_neox': 864, 'n_words': 269}