Skip to content

Instantly share code, notes, and snippets.

@sjpuas
Created January 8, 2022 20:49
Show Gist options
  • Save sjpuas/b1a9f065220fc2376c5d6dcf087d1520 to your computer and use it in GitHub Desktop.
Save sjpuas/b1a9f065220fc2376c5d6dcf087d1520 to your computer and use it in GitHub Desktop.
/** to use in https://iniciativas.chileconvencion.cl/m/iniciativa_popular/# **/
let propuestas = [];
$("#iniciativas>.card").each((i,e) => {
let propuesta = {
textId: $(e).children("h2").text().trim(),
title: $(e).children("h1").text().trim(),
text: $(e).children("p").text().trim(),
votes: $(e).data("apoyos")
};
propuestas.push(propuesta);
});
propuestas = propuestas.sort((a,b) => b.votes - a.votes );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment