Created
April 1, 2018 12:59
-
-
Save UlisesGascon/3a5e76311ee4242ed555ec781066c3a8 to your computer and use it in GitHub Desktop.
Generar un fichero MD con los mas descargados y populares generadores de http://yeoman.io/generators/
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
// Ejecutar en la consola cuando estemos en http://yeoman.io/generators/ | |
var md = "" | |
function generateMd(dataItem){ | |
md += `**:top: ${dataItem}**\n` | |
var datos = document.querySelectorAll(".list > tr") | |
datos.forEach(function(dato){ | |
var linkSelector = dato.querySelector("a") | |
var nameSelector = dato.querySelector(".name") | |
var descripcionSelector = dato.querySelector(".description") | |
var usefulldata; | |
if(linkSelector && nameSelector){ | |
var usefulldata = { | |
official: dato.classList.contains('official'), | |
titulo: nameSelector.innerText, | |
descripcion: descripcionSelector.innerText, | |
link: linkSelector.href | |
} | |
} | |
if(usefulldata){ | |
md += `- [${usefulldata.official ? ":small_blue_diamond:": ""} ${usefulldata.titulo}](${usefulldata.link}): *${usefulldata.descripcion}*\n`; | |
} | |
}) | |
md += "\n\n" | |
} | |
function orderListBy (dataItem){ | |
document.querySelector(`[data-sort='${dataItem}']`).click() | |
} | |
function startSecuence(dataItem){ | |
orderListBy(dataItem) | |
orderListBy(dataItem) | |
generateMd(dataItem) | |
} | |
startSecuence("downloads") | |
startSecuence("stars") | |
console.log(md) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment