diff --git a/index.html b/index.html index 1ba9b49..2661c6d 100644 --- a/index.html +++ b/index.html @@ -55,15 +55,49 @@ - - + + diff --git a/strike-js/strike.css b/strike-js/strike.css new file mode 100644 index 0000000..3e52807 --- /dev/null +++ b/strike-js/strike.css @@ -0,0 +1,27 @@ +div#strike-screen { + background-color: black; + min-height: 100%; + position: fixed; + top: 0; + bottom: 0; + left: 0; + right: 0; + z-index: 999999999999999; + display: flex; + align-items: center; + justify-content: center; +} + +div#strike-screen div { + padding: 16px; +} + +div#strike-screen div p { + color: white; + font-size: 32px; + text-align: center; +} + +div#strike-screen div a { + color: white; +} diff --git a/strike-js/strike.js b/strike-js/strike.js new file mode 100644 index 0000000..e73fd44 --- /dev/null +++ b/strike-js/strike.js @@ -0,0 +1,43 @@ +(function (window, document) { + "use strict"; + + var onStrike = function (messages) { + var body = document.getElementsByTagName('body')[0]; + + // Create the main black full screen container + var screen = document.createElement('div'); + screen.setAttribute('id', 'strike-screen'); + body.appendChild(screen); + + var container = document.createElement('div'); + screen.appendChild(container); + + // Create a `p` element for each phrase. + messages.forEach(function (m) { + var p = document.createElement('p'); + p.insertAdjacentHTML('beforeend', m); + container.appendChild(p); + }); + }; + + window.strike = function (strikeDays, messages) { + + var strikeTest = window.location.search.search('strikeTest') != -1; + + var today = new Date(); + + if (!Array.isArray(strikeDays)) + { + strikeDays = [strikeDays]; + } + + var strikeIsToday = strikeDays.some(function (day) { + return today.toDateString() == day.toDateString(); + }); + + if (strikeTest || strikeIsToday) { + onStrike(messages); + } + }; + +})(window, document);