<commit_before>/**
 * Observe DOM mutations and convert monospace code blocks
 * @author <NAME>, <NAME>
 */
getVars();

var SMobserverConfig = {
    childList: true,
    subtree: true, 
    characterData: false, 
    attributes: false
};

//draws on code blocks when large chat is updated
function SMmonospaceListen() {
    var SMmonospaceObserver = new MutationObserver(function(ms) {
         ms.forEach(function(m){
            if( m.addedNodes.length > 0){
              if( typeof( m.addedNodes[0].className ) === 'string' ){ //makes sure we can get elements from m.addedNodes[0] (could be a better way)
                if( m.addedNodes[0].className.indexOf( '_5wd4' ) > -1 ){
                  var cfx = m.addedNodes[0].getElementsByClassName( '_5wdf' );
                  for(c=0; c<cfx.length; c++){
                    //if( cfx[c].firstChild.className !== "null monospaced" ){ //i think this is redundant since messages are not refreshed.
                        cfx[c].firstChild.firstChild.innerHTML = cfx[c].firstChild.firstChild.innerHTML.replace(/\n{2,}/g, "\n\n");
                        draw(cfx[c].firstChild.firstChild);
                    //}
                  }
                }
              }
            }
        });
    });
    SMmonospaceObserver.observe(document.getElementById('ChatTabsPagelet'), SMobserverConfig);
}


function SMcode(){
    var cfx = document.getElementsByClassName( "_5wdf" );
    for(c=0; c<cfx.length; c++){
        cfx[c].firstChild.firstChild.innerText = cfx[c].firstChild.firstChild.innerText.replace(/\n{2,}/g, "\n\n");
        draw(cfx[c].firstChild.firstChild);
    }
}

var SMcheckForMsg = setInterval(function() {
    var SMmsgWindow = document.getElementById('ChatTabsPagelet');
    if (SMmsgWindow !== null) {
        console.log('found!');
        SMcode();
        SMmonospaceListen(SMmsgWindow, SMobserverConfig);
        clearInterval(SMcheckForMsg);
    }
}, 50);<commit_msg>emoticon patch<commit_after>/**
 * Observe DOM mutations and convert monospace code blocks
 * @author <NAME>, <NAME>
 */
getVars();

var SMobserverConfig = {
    childList: true,
    subtree: true, 
    characterData: false, 
    attributes: false
};

//draws on code blocks when large chat is updated
function SMmonospaceListen() {
    var SMmonospaceObserver = new MutationObserver(function(ms) {
         ms.forEach(function(m){
            if( m.addedNodes.length > 0){
              if( typeof( m.addedNodes[0].className ) === 'string' ){ //makes sure we can get elements from m.addedNodes[0] (could be a better way)
                if( m.addedNodes[0].className.indexOf( '_5wd4' ) > -1 ){
                  var cfx = m.addedNodes[0].getElementsByClassName( '_5wdf' );
                  for(c=0; c<cfx.length; c++){
                    // if( cfx[c].firstChild.firstChild.className !== "_5y15 monospaced" ){ //i think this is redundant since messages are not refreshed.
                        cfx[c].firstChild.firstChild.innerHTML = cfx[c].firstChild.firstChild.innerHTML.replace(/\n{2,}/g, "\n\n");
                        draw(cfx[c].firstChild.firstChild);
                    // }
                  }
                }
              }
            }
        });
    });
    SMmonospaceObserver.observe(document.getElementById('ChatTabsPagelet'), SMobserverConfig);
}


function SMcode(){
    var cfx = document.getElementsByClassName( "_5wdf" );
    for(c=0; c<cfx.length; c++){
        cfx[c].firstChild.firstChild.innerHTML = cfx[c].firstChild.firstChild.innerHTML.replace(/\n{2,}/g, "\n\n");
        draw(cfx[c].firstChild.firstChild);
    }
}

var SMcheckForMsg = setInterval(function() {
    var SMmsgWindow = document.getElementById('ChatTabsPagelet');
    if (SMmsgWindow !== null) {
        console.log('found!');
        SMcode();
        SMmonospaceListen(SMmsgWindow, SMobserverConfig);
        clearInterval(SMcheckForMsg);
    }
}, 50);
{'fraction_non_alphanumeric': 0.14117345631565462, 'fraction_numerical': 0.008967460927491674, 'mean_word_length': 2.3918331885317117, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '877855', 'n_tokens_mistral': 1220, 'n_tokens_neox': 1164, 'n_words': 236}