diff --git a/src/app.js b/src/app.js index 82bbf86..3ef9926 100644 --- a/src/app.js +++ b/src/app.js @@ -192,19 +192,19 @@ function fillCells(content) { /** * Loads content from the specified file to fill the board. - * @param {String} cluefile URL of the JSON clue file. + * @param {String} tropeDefinitions URL of the JSON trope file. */ -function loadBoard(cluefile) { +function loadBoard(tropeDefinitions) { req=new XMLHttpRequest(); - req.open("GET", cluefile ,true); + req.open("GET", tropeDefinitions, true); req.overrideMimeType("application/json"); req.send(); req.onload = function onLoad() { - const clues = JSON.parse(req.responseText); - shuffle(clues); - clues[12] = 'FREE'; - trackEvent('load', { value: cluefile }); - fillCells(clues.map((text) => { + const tropes = JSON.parse(req.responseText); + shuffle(tropes); + tropes[12] = 'FREE'; + trackEvent('load', { value: tropeDefinitions }); + fillCells(tropes.map((text) => { return { t: text, m: false @@ -215,10 +215,10 @@ function loadBoard(cluefile) { /** * Pull text into the cells, either from Saved data or from - * a clue file. - * @param {String} cluefile URL JSON file to get new clues. + * a trope file. + * @param {String} tropeDefinitions URL JSON file to get new tropes. */ -function populateBoard(cluefile) { +function populateBoard(tropeDefinitions) { let age = 0; const saved = localStorage.getItem('saved'); if (saved) { @@ -226,7 +226,7 @@ function populateBoard(cluefile) { age = Math.floor((Date.now() - savedAt) / 1000); } if (!saved || (age > 7200)) { - loadBoard(cluefile); + loadBoard(tropeDefinitions); } else { trackEvent('restore', { value: age }); fillCells(JSON.parse(saved)); @@ -239,19 +239,19 @@ function populateBoard(cluefile) { */ function ready() { const searchParams = new URLSearchParams(window.location.search); - let cluefile = 'film-tropes.json' - if (searchParams.has('clues')) { - cluefile = searchParams.get('clues'); + let tropeDefinitions = 'film-tropes.json' + if (searchParams.has('tropes')) { + tropeDefinitions = searchParams.get('tropes'); } const board = document.querySelector('.board'); buildEmptyBoard(board); - populateBoard(cluefile); + populateBoard(tropeDefinitions); buildHeading(); const resetButton = document.querySelector('.controls .reset'); resetButton.addEventListener('click', (event)=> { trackEvent('reset', { event_category: 'user' }); clearBingos(); - loadBoard(cluefile); + loadBoard(tropeDefinitions); }) window.addEventListener('unload', (event) => { saveBoard(); diff --git a/www/film-tropes.json b/www/film-tropes.json index 868cc34..faccf32 100644 --- a/www/film-tropes.json +++ b/www/film-tropes.json @@ -32,7 +32,7 @@ "Big city ambitions", "Holiday magic", "Festival", - "Children's Charity", + "Children's charity", "Christmas tree lighting", "Obviously artificial snow", "Old flame", @@ -68,7 +68,7 @@ "Happiness over success", "Lacey Chabert", "Danica McKellar", - "Excessive Candles", + "Excessive candles", "Hospital visit", "Female lead has more than three coats", "Outside craft booths", diff --git a/www/kids.json b/www/kids.json new file mode 100644 index 0000000..7db4d64 --- /dev/null +++ b/www/kids.json @@ -0,0 +1,65 @@ +[ + "Chopping wood", + "Carriage or sleigh ride", + "Job offer", + "Bad Christmas memory", + "Carousel", + "Two hands on a hot drink", + "Friendly police officer", + "Home town", + "Cute dog", + "The perfect gift", + "Baking", + "Someone plays guitar", + "\"Please stay!\"", + "Traditions", + "Dressing up as Santa", + "Snowfall", + "Interrupted kiss", + "Engagement or wedding", + "Small town vs. big city", + "Matchmaker", + "Deceased parent", + "Drinking coffee", + "Holiday magic", + "Festival", + "Children's charity", + "Christmas tree lighting", + "Old flame", + "An inn", + "Hanging Christmas decorations", + "Carolers", + "Misunderstood royalty", + "Hot chocolate", + "Single parent", + "Boutique", + "Car trouble", + "\"Follow your heart\"", + "\"I got the job\"", + "Mistletoe", + "Snow globe", + "Heartfelt apology", + "Reindeer", + "Santa", + "Excessive decorations", + "Snow", + "Christmas tree farm", + "Overheard conversation", + "Mis\u00adunderstanding", + "Falling in love", + "Snowman", + "Wearing pajamas", + "Excessive candles", + "Hospital visit", + "Outside craft booths", + "Gingerbread house", + "Fireplace or woodstove", + "Seasonal food", + "Ice skating", + "Wrapped Present", + "Cookies", + "Kissing (yuck!)", + "Santa hat", + "Red bow", + "Stockings hung by chimney" +]