<commit_before>// ==UserScript==
// @name        Charcount
// @namespace   kaff_is_one_grease
// @include     http://aimgames.forummotion.com/*
// @version     1.1.5
// @grant       none
// @require     https://raw.githubusercontent.com/RadLikeWhoa/Countable/master/Countable.js
// @icon        http://i62.tinypic.com/mkg51f.png
// ==/UserScript==
var cssLabel = "color: grey;font-size: 12px;";

var loc = "";
var refined_loc = "";
var cssTd = "";

////// CODE FOR DEALING WITH OBJECTS
function values(o) {
  return Object.keys(o).map(function (k) {
    return o[k]
  })
}
//////

//////INITIALIZE THIS
window.onload = function()   {
  if (typeof document.getElementsByTagName("textarea")[1] === 'undefined') { ////PREVIEW PAGE
    loc = document.getElementById("parent_editor_simple").getElementsByClassName("row2")[0];   
    refined_loc = document.getElementById("parent_editor_simple").getElementsByClassName("row2")[0];
  }else{ //// QUICK REPLY
    loc = document.getElementById("quick_reply").getElementsByClassName("row2")[1];  
    cssTd = "padding-top:5px;";
    var new_td = document.createElement("td");
    loc.appendChild(new_td).style.cssText = cssTd;
    refined_loc = document.getElementById("quick_reply").getElementsByClassName("row2")[1].getElementsByTagName("td")[0];
  }    
  var element = document.createElement("label");
  refined_loc.appendChild(element).style.cssText = cssLabel;
};

setInterval(function () {      
  var area = document.getElementsByTagName("textarea")[0];  ////this is preview window shit  
  if(!typeof document.getElementsByTagName("textarea")[1] === 'undefined'){    ///if were not in preview window, we need to set some variables differently
    document.getElementsByTagName("textarea")[0].value = document.getElementsByTagName("textarea")[1].value;
    area = document.getElementsByTagName("textarea")[0];     
  }  
  
  if(typeof area !== 'undefined'){    ////dont run this shit if it's undefined yo
    Countable.once(area, function (counter) {
      loc.getElementsByTagName("label")[0].innerHTML = values(counter)[4] + " characters";
      console.log(values(counter)[4]);
      if(values(counter)[4] > 32000){
        console.log("got here");
        element.style.cssText += "color:red;";
      }else if(values(counter)[4] < 32000){
        element.style.cssText = cssLabel;
      }
    });  
  }
}, 3000);<commit_msg>so done wid dis<commit_after>// ==UserScript==
// @name        Charcount
// @description Uses Countable.js to display character count below post box
// @namespace   kaff_is_one_grease
// @include     http://aimgames.forummotion.com/*
// @version     1.2
// @grant       none
// @require     https://raw.githubusercontent.com/RadLikeWhoa/Countable/master/Countable.js
// @icon        http://i62.tinypic.com/mkg51f.png
// ==/UserScript==
var cssLabel = "color: grey;font-size: 12px;";

var loc = "";
var refined_loc = "";
var cssTd = "";

////// CODE FOR DEALING WITH OBJECTS
function values(o) {
  return Object.keys(o).map(function (k) {
    return o[k]
  })
}
//////

//////INITIALIZE THIS
window.onload = function()   {
  if (typeof document.getElementsByTagName("textarea")[1] === 'undefined') { ////PREVIEW PAGE
    loc = document.getElementById("parent_editor_simple").getElementsByClassName("row2")[0];   
    refined_loc = document.getElementById("parent_editor_simple").getElementsByClassName("row2")[0];
  }else{ //// QUICK REPLY
    loc = document.getElementById("quick_reply").getElementsByClassName("row2")[1];  
    cssTd = "padding-top:5px;";
    var new_td = document.createElement("td");
    loc.appendChild(new_td).style.cssText = cssTd;
    refined_loc = document.getElementById("quick_reply").getElementsByClassName("row2")[1].getElementsByTagName("td")[0];
  }    
  var element = document.createElement("label");
  refined_loc.appendChild(element).style.cssText = cssLabel;
  setInterval(function () {      
    var area = document.getElementsByTagName("textarea")[0];  ////this is preview window shit  
    if(typeof document.getElementsByTagName("textarea")[1] === 'object'){    ///if were not in preview window, we need to set some variables differently
      area.value = document.getElementsByTagName("textarea")[1].value;
    }  
    if(typeof area !== 'undefined'){    ////dont run this shit if it's undefined yo
      Countable.once(area, function (counter) {
        loc.getElementsByTagName("label")[0].innerHTML = values(counter)[4] + " characters";
        console.log(values(counter)[4]);
        if(values(counter)[4] > 32000){
          console.log("got here");
          element.style.cssText += "color:red;";
        }else if(values(counter)[4] < 32000){
          element.style.cssText = cssLabel;
        }
      });  
    }
  }, 3000);
};
{'fraction_non_alphanumeric': 0.1665264928511354, 'fraction_numerical': 0.01787216148023549, 'mean_word_length': 3.534795042897998, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 4, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5065067', 'n_tokens_mistral': 1559, 'n_tokens_neox': 1496, 'n_words': 274}