Last active
September 10, 2015 18:51
-
-
Save williankeller/fb02a22eb53b2a97fffe to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function() { | |
| /* | |
| * Remove estilos in-line e adiciona no cabeçalho do site | |
| * | |
| * @author Willian Keller | |
| * | |
| * Definições das Variáveis | |
| * | |
| * @variables | |
| * a = Array (saída do laço de repetição) | |
| * c = Contagem (contagem de novas classes css) | |
| * e = Espaço (caso já exista uma classe, adicionas o espaço) | |
| * h = Header (cria uma base de estilos no cabeçalho "head") | |
| * n = Novo Estilo (insere novo estilo na base de estilos) | |
| * r = Random (cria uma nova classe/id randomica) | |
| * s = Seletores (busca todos os seletores de estilo) | |
| * t = Texto Inline (captura o texto inline do estilo) | |
| * | |
| */ | |
| var a, c, e, h, n, r, s, t; | |
| r = Math.random().toString(36).substring(14); | |
| s = document.querySelectorAll("*[style]"); | |
| h = document.createElement('style'); | |
| h.id = r; | |
| document.getElementsByTagName('head')[0].appendChild(h); | |
| c = 1; | |
| Array.prototype.forEach.call(s, function(a) { | |
| e = '' | |
| if (a.className != ''){ | |
| e = ' ' | |
| } | |
| a.className = a.className + e + r +'_' + c; | |
| t = a.style.cssText; | |
| n = document.getElementById(r); | |
| n.innerHTML = n.innerHTML + '.' + r + '_' + c + '{' + t + '}'; | |
| a.style.cssText = ''; | |
| c = c +1; | |
| }); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment