(function (document) { var eventButtonText = {}; // DO NOT DELETE // Back button text. var eventBackButtonText = 'Go back to my awsome events!' // Default text for all buttons for each event listing item. eventButtonText['default'] = 'View my awesome event!'; // Target specific item in the event listing. Remove the 2 forward slashes // below before the `eventButtonText` variableto uncomment the lines. Update // the number in the bracket to equal the position of the event in the listing. // eventButtonText[1] = 'Event 1'; // eventButtonText[3] = 'Event 3'; /************************************************************************** * DO NOT EDIT CODE BELOW, unless you know what your doing. ***************************************************************************/ // Initialized code depending on if the user places it in the header or footer if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', init); } else { init(); } function init() { addNodeListForEachPolyfill(); var eventButtons = document.querySelectorAll('.eventlist .eventlist-button'); var backLink = document.querySelector('.eventitem-backlink'); var text; if (eventButtons) { eventButtons.forEach(function (button, index) { index = index + 1; text = eventButtonText[index] || eventButtonText['default']; if (text) { button.textContent = text; } }); } if (backLink) { backLink.textContent = eventBackButtonText; } } function addNodeListForEachPolyfill() { if (window.NodeList && !NodeList.prototype.forEach) { NodeList.prototype.forEach = Array.prototype.forEach; } } })(document);