Skip to content

Instantly share code, notes, and snippets.

@michaelsanford
Last active January 27, 2017 16:12
Show Gist options
  • Save michaelsanford/f9f63dff45ee88683bf5d0fcdc97443f to your computer and use it in GitHub Desktop.
Save michaelsanford/f9f63dff45ee88683bf5d0fcdc97443f to your computer and use it in GitHub Desktop.
Will there be pizza? πŸ‘πŸ½πŸ•
(() => {
"use strict";
/**
* Attendees to JS-Montreal often don't know if there will be pizza or not. This aims to make it more clear.
* Traditionally, pizza is available if the meetup starts at 6 PM, but not if it starts at 7.
*
* @see https://www.meetup.com/js-montreal/
*/
const description = document.getElementById('event-description-wrap').innerText;
const time = document.getElementsByTagName('time')[0].getElementsByTagName('p')[0].innerText;
const pizza = document.createElement('span');
document.getElementsByTagName('h1')[1].appendChild(pizza);
if (time.includes('6') || description.includes('will be pizza'))
pizza.innerText = "πŸ‘πŸ½πŸ•";
else if (time.includes('7') || description.includes('t be pizza'))
pizza.innerText="πŸš«πŸ•";
else
pizza.innerText = "πŸ•...🀷";
})();
@michaelsanford
Copy link
Author

michaelsanford commented Jan 10, 2017

Run this in the console on a JS-Montreal Meetup Upcoming Event page.
The event title will get a badge representing the pizza availability best-guess.

(It will only work on "upcoming" event pages, as past events have a different DOM structure for whatever reason.)

I'll make it a bit more clever and pack it as a Chrome Extension some snowy evening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment