Skip to content

Instantly share code, notes, and snippets.

@degliwe
Last active March 11, 2019 13:12
Show Gist options
  • Save degliwe/ac07424c14c5fa2f3d48a42da1d6d705 to your computer and use it in GitHub Desktop.
Save degliwe/ac07424c14c5fa2f3d48a42da1d6d705 to your computer and use it in GitHub Desktop.
Proof of concept Open initiatives
// Open a new tab (Ctrl+t) to http://ec.europa.eu/
// On the new tab open the dev tools console (Ctrl+Shift+J)
// Copy/paste the whole snippet (Ctrl+c, Ctrl+v)
// Execute (Return)
fetch("http://ec.europa.eu/citizens-initiative/services/initiative/get/open", {
mode: "no-cors",
headers: {
"Content-Type": "application/json"
}
}).then(function(response) {
return response.json();
})
.then(function(resJson) {
console.log(resJson)
document.body.prepend(document.createElement("ul"));
resJson.initiative.forEach(buildNewList);
});
function buildNewList(item, index) {
var node = document.createElement("li");
node.appendChild(document.createTextNode(item.searchEntry.title+" | "+ item.searchEntry.registrationNumber+" | "+ item.searchEntry['@status']));
document.querySelector("ul").appendChild(node);
}
/* RESULTS
- Europe CARES - Inclusive Quality Education for Children with Disabilities | ECI(2019)000002 | OPEN
- Let's demand smarter vaping regulation! | ECI(2019)000001 | OPEN
- Mandatory food labelling Non-Vegetarian / Vegetarian / Vegan | ECI(2018)000007 | OPEN
- Eat ORIGINal! Unmask your food | ECI(2018)000006 | OPEN
- STOP FRAUD and abuse of EU FUNDS - by better control of decisions, implementation and penalties | ECI(2018)000005 | OPEN
- End the Cage Age | ECI(2018)000004 | OPEN
- Permanent European Union Citizenship | ECI(2018)000003 | OPEN
- Stop starvation for 8% of the European population! | ECI(2018)000002 | OPEN
- We are a welcoming Europe, let us help! | ECI(2018)000001 | OPEN
- Stop Extremism | ECI(2017)000007 | OPEN
- Minority SafePack – one million signatures for diversity in Europe | ECI(2017)000004 | OPEN
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment