Partrick55Bateman / Dobrados

// ==UserScript==
// @name        Dobrados
// @namespace   Violentmonkey Scripts
// @match       https://55chan.org/b/*
// @grant       none
// @version     1.1
// @author      Partrick Bateman
// @license MIT
// @description 9/22/2020, 4:04:57 PM
// ==/UserScript==

var posts = document.body.getElementsByClassName("post_no")

for (const element of posts) {
  let postId = element.href.substring(element.href.indexOf("#") + 1);
  let posArray = [];
  posArray.push(postId.charAt(postId.length - 1))
  posArray.push(postId.charAt(postId.length - 2))
  posArray.push(postId.charAt(postId.length - 3))
  posArray.push(postId.charAt(postId.length - 4))
  posArray.push(postId.charAt(postId.length - 5))
  
  if(posArray[0] == posArray[1]){
    element.classList.add("dobradosCSS")
    element.classList.add("gracinhaDoAnao")
    //applyClass('dobradosCSS',element,false);
    if(posArray[0] == posArray[2]){
      element.classList.remove("dobradosCSS")
      element.classList.add("triplicadosCSS")
      if(posArray[0] == posArray[3]){
        element.classList.remove("triplicadosCSS")
        element.classList.add("quadruplicadosCSS")
      }
    }
  }
}



function createClass(name,rules){
    var style = document.createElement('style');
    style.type = 'text/css';
    document.getElementsByTagName('head')[0].appendChild(style);
    if(!(style.sheet||{}).insertRule) 
        (style.styleSheet || style.sheet).addRule(name, rules);
    else
      style.sheet.insertRule(name+"{"+rules+"}",0);
    
    return style
      
}
createClass('.dobradosCSS',      "color: white !important;   font-size: 200%;");
createClass('.triplicadosCSS',   "background-color: green !important;   color: #f5428d !important; font-size: 250%;");
createClass('.quadruplicadosCSS',"background-color: yellow !important; color: red !important;     font-size: 300%;");
var gracinha = createClass('.gracinhaDoAnao',"  height: 100%;  widht: 100%;  background: linear-gradient(180deg, #f71000, #f7f700, #000000); background-size: 600% 600%; animation: BackgroundAnimation 5s infinite;");
gracinha.sheet.insertRule("@keyframes BackgroundAnimation {  0% {    background-position: 50% 0;  }  50% {    background-position: 50% 100%;  }  100% {    background-position: 50% 0;  }}");