From bc7d48bab4b4519ad1befc29eb05a969fd88d7b0 Mon Sep 17 00:00:00 2001 From: Liz W Date: Mon, 14 Aug 2017 15:56:50 -0500 Subject: [PATCH] Add welcome message --- src/main.js | 23 +++++++++++++++++++---- src/options.js | 2 +- wavetab.html | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+), 5 deletions(-) diff --git a/src/main.js b/src/main.js index 7296204..33362f5 100644 --- a/src/main.js +++ b/src/main.js @@ -7,6 +7,7 @@ var optionsElem = document.getElementById("options"); // flags var showingOptions = false; +var showWelcomeMsg = true; // storage object for options var options = {}; @@ -77,6 +78,10 @@ function pickColors() { container.style.animation = "Animation 8s ease-in-out infinite"; } +function hideWelcomeMessage() { + document.getElementById("welcomeMsg").style.display = "none"; +} + // when the page loads, do all this stuff document.addEventListener("DOMContentLoaded", function() { // set up event listeners for checkboxes @@ -86,10 +91,9 @@ document.addEventListener("DOMContentLoaded", function() { } // setup event listeners for buttons - var buttons = document.querySelectorAll("button"); - for (var i = 0; i < buttons.length; i++) { - buttons[i].onclick = toggleOptions; - } + document.getElementById("info-icon").onclick = toggleOptions; + document.getElementById("close-icon").onclick = toggleOptions; + document.getElementById("close-welcome").onclick = hideWelcomeMessage; // add event listener for when storage changes chrome.storage.onChanged.addListener(updateDisplay); @@ -102,4 +106,15 @@ document.addEventListener("DOMContentLoaded", function() { updateTime(); updateDate(); pickColors(); + + // show welcome message if necessary + //chrome.storage.sync.clear(); // test line to clear storage & see msg again + chrome.storage.sync.get({ + showWelcomeMsg: true + }, function (items) { + if (items.showWelcomeMsg) { + document.getElementById("welcomeMsg").style.display = "block"; + chrome.storage.sync.set({showWelcomeMsg: false}); + } + }); }); \ No newline at end of file diff --git a/src/options.js b/src/options.js index f92a6ab..790da36 100644 --- a/src/options.js +++ b/src/options.js @@ -28,7 +28,7 @@ function restoreOptions() { showTime: true, showDate: true, use24HourTime: false - }, function(items) {; + }, function(items) { // set up switches according to stored options timeOption.checked = items.showTime; dateOption.checked = items.showDate; diff --git a/wavetab.html b/wavetab.html index 24311e7..8e50f36 100644 --- a/wavetab.html +++ b/wavetab.html @@ -118,6 +118,44 @@ margin-bottom: 10px; } + /* welcome message */ + #welcomeMsg { + font-family: 'Quicksand', sans-serif; + color: #ffffff; + font-size: 1rem; + text-align: left; + + border: 2px solid #ffffff; + padding: 5px; + border-radius: 10px; + background: rgba(119, 119, 119, 0.4); + + position: absolute; + bottom: 10px; + right: 60px; + display: none; + } + + #welcomeMsg h3, p { + margin: 2px; + } + + #welcomeMsg .icon { + font-size: 1.1rem; + position: absolute; + top: 5px; + right: 5px; + } + + #welcomeMsg .popover { + position: absolute; + top: 35px; + right: -10px; + border-top: 10px solid transparent; + border-bottom: 10px solid transparent; + border-left: 10px solid #ffffff; + } + /* font awesome icons */ .icon { color: #ffffff; @@ -234,6 +272,14 @@

Info

Coded with by Liz Wigglesworth
Font Awesome by Dave Gandy

+
+
+ +

Welcome to WaveTab!

+

Click the to change your settings.

+