Last active
January 6, 2020 19:14
-
-
Save hugoruscitti/4e49a4d0b3d3e8ac76a045f34dde05d1 to your computer and use it in GitHub Desktop.
Copia al clipboard todas las columnas de un board de trello listas para pegar sobre excel o similar
This file contains 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
var s = []; | |
jQuery.fn.reverse = [].reverse; | |
USUARIOS = { | |
"22d719c": "hugoruscitti", | |
b98fcc0: "l2radamanthys", | |
"976af97": "digitalh", | |
c21ac6c: "hectorsanchez3" | |
}; | |
function sanitizarNombres(nombres) { | |
var g = nombres.match(/\((.*)\)/); | |
for (let i in USUARIOS) { | |
if (nombres.indexOf(i) > -1) { | |
return USUARIOS[i]; | |
} | |
} | |
console.error("Cuidado, no se conoce al usuario cuyo avatar es" + nombres); | |
if (g) { | |
return g[1]; | |
} else { | |
return ""; | |
} | |
} | |
jQuery(".list:has(.list-header-name)") | |
.reverse() | |
.each(function() { | |
var columna = jQuery(this).find(".list-header-name-assist")[0].innerText; | |
s.push("--------------"); | |
jQuery(this) | |
.find(".list-card-details") | |
.each(function() { | |
var titulo = jQuery(this).find(".list-card-title")[0].innerText; | |
var usuarioSinAvatar = jQuery(this) | |
.find(".member-initials") | |
.attr("title"); | |
var usuarioConAvatar = jQuery(this) | |
.find(".member-avatar") | |
.attr("src"); | |
var personas = usuarioSinAvatar || usuarioConAvatar || ""; | |
var horas = jQuery(this) | |
.find(".point-count.consumed") | |
.text(); | |
horas = horas.replace(".", ","); | |
personas = sanitizarNombres(personas); | |
s.push(columna + ";" + titulo + ";" + horas + ";" + personas); | |
}); | |
console.log(s.join("\n")); | |
//copy(s.join("\n")); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment