mirror of
https://github.com/jcreek/SelectionWheel.git
synced 2026-07-14 03:33:43 +00:00
Compare commits
37 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a8af91a104 | |||
| daf9e01dfa | |||
| 5117591567 | |||
| b8fd761e2f | |||
| 4b94d42271 | |||
| f20995a879 | |||
| 84e1e39f9c | |||
| 7783162127 | |||
| f1efac7c7f | |||
| d8fe76f62c | |||
| b9a40bb8a5 | |||
| ff58967c8c | |||
| d15f55b94b | |||
| d411a76c49 | |||
| 546c647234 | |||
| e7f80e1885 | |||
| 5dc201eac7 | |||
| bd7ef970b9 | |||
| 0d641c4f66 | |||
| 983b097a3c | |||
| 86b94e2e6a | |||
| 9e56971116 | |||
| 77049455b9 | |||
| f549faab16 | |||
| fced394f3e | |||
| c51fca8425 | |||
| 866346ea01 | |||
| 050f87301c | |||
| 39d4ded1fb | |||
| eff426550b | |||
| 75425e954e | |||
| b5e578acdc | |||
| f5c404f58b | |||
| c7f6d43bdc | |||
| 29b4822732 | |||
| 797d04c403 | |||
| eb449b0e62 |
+2
-1
@@ -27,6 +27,7 @@
|
||||
"ts": "never",
|
||||
"tsx": "never"
|
||||
}
|
||||
]
|
||||
],
|
||||
"quotes": [2, "single", { "avoidEscape": true }]
|
||||
}
|
||||
}
|
||||
|
||||
Generated
+212
-460
File diff suppressed because it is too large
Load Diff
+3
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "SelectionWheel",
|
||||
"version": "1.1.0",
|
||||
"version": "1.5.0",
|
||||
"description": "A fun and simple selection wheel.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@@ -38,8 +38,10 @@
|
||||
"workbox-cli": "^6.5.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@fireworks-js/web": "^2.5.1",
|
||||
"@types/d3": "^7.4.0",
|
||||
"d3": "^7.6.1",
|
||||
"fireworks-js": "^2.5.1",
|
||||
"html-webpack-plugin": "^5.5.0",
|
||||
"react-dev-utils": "^12.0.1",
|
||||
"webpack-manifest-plugin": "^5.0.0",
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,17 @@
|
||||
export default {
|
||||
pauseAudio(audio: HTMLAudioElement) {
|
||||
audio.pause();
|
||||
},
|
||||
playAudio(audio: HTMLAudioElement) {
|
||||
audio.play();
|
||||
},
|
||||
stopAudio(audio: HTMLAudioElement) {
|
||||
audio.pause();
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
audio.currentTime = 0;
|
||||
},
|
||||
toggleMute(audio: HTMLAudioElement) {
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
audio.muted = !audio.muted;
|
||||
},
|
||||
};
|
||||
+147
-30
@@ -1,9 +1,50 @@
|
||||
import * as d3 from 'd3';
|
||||
import { Fireworks } from 'fireworks-js';
|
||||
import loadServiceWorker from './loadServiceWorker';
|
||||
import audioControls from './audioControls';
|
||||
import spinnerMp3 from './assets/spinner-sound.mp3';
|
||||
import tadaMp3 from './assets/tada-fanfare.mp3';
|
||||
|
||||
require('./assets/favicon.ico');
|
||||
require('./assets/android-chrome-192x192.png');
|
||||
require('./assets/android-chrome-512x512.png');
|
||||
require('./assets/apple-touch-icon.png');
|
||||
require('./assets/favicon-16x16.png');
|
||||
require('./assets/favicon-32x32.png');
|
||||
require('./styles/main.scss');
|
||||
require('./styles/buttons.scss');
|
||||
require('./styles/modal.scss');
|
||||
require('./styles/spinner.scss');
|
||||
|
||||
const wheelSpinningSound = new Audio(spinnerMp3);
|
||||
const tadaSound = new Audio(tadaMp3);
|
||||
if (window.localStorage.audioMuteSetting) {
|
||||
wheelSpinningSound.muted = window.localStorage.audioMuteSetting;
|
||||
tadaSound.muted = window.localStorage.audioMuteSetting;
|
||||
}
|
||||
const modal = document.getElementById('myModal');
|
||||
|
||||
const fireworksContainer = document.getElementById('fireworks-container');
|
||||
function fireworksContainerOnClick() {
|
||||
fireworksContainer.style.display = 'none';
|
||||
modal.style.display = 'none';
|
||||
document.getElementById('chart').click();
|
||||
document.getElementsByClassName('chartholder')[0].dispatchEvent(new Event('click'));
|
||||
}
|
||||
fireworksContainer.onclick = fireworksContainerOnClick;
|
||||
|
||||
const fireworks = new Fireworks(fireworksContainer, {
|
||||
// sound: {
|
||||
// enabled: !wheelSpinningSound.muted,
|
||||
// },
|
||||
});
|
||||
|
||||
// When the user clicks anywhere outside of the modal, close it
|
||||
window.onclick = (event) => {
|
||||
if (event.target === modal) {
|
||||
modal.style.display = 'none';
|
||||
}
|
||||
};
|
||||
|
||||
const padding = {
|
||||
top: 20,
|
||||
@@ -11,8 +52,11 @@ const padding = {
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
};
|
||||
const w = 500 - padding.left - padding.right;
|
||||
const h = 500 - padding.top - padding.bottom;
|
||||
|
||||
const baseSpinnerSizePx = 800;
|
||||
|
||||
const w = baseSpinnerSizePx - padding.left - padding.right;
|
||||
const h = baseSpinnerSizePx - padding.top - padding.bottom;
|
||||
const r = Math.min(w, h) / 2;
|
||||
let rotation = 0;
|
||||
let oldrotation = 0;
|
||||
@@ -22,6 +66,8 @@ const color = d3.scaleOrdinal(d3.schemeCategory10);
|
||||
let data = [];
|
||||
const testData = ['Person 1', 'Person 2', 'Person 3', 'Person 4'];
|
||||
|
||||
let imageUrlForSpinner = '';
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function rotTween(to) {
|
||||
const i = d3.interpolate(oldrotation % 360, rotation);
|
||||
@@ -32,8 +78,6 @@ function stopSpinning() {
|
||||
// console.log('done');
|
||||
const chartElement = document.getElementById('chart');
|
||||
chartElement.remove();
|
||||
const questionElement = document.getElementById('question');
|
||||
questionElement.remove();
|
||||
document.getElementById('input-lines').style.display = 'block';
|
||||
document.getElementById('startSpinning').style.display = 'block';
|
||||
}
|
||||
@@ -53,22 +97,39 @@ function makeArrowAndCircle(
|
||||
.attr('d', `M-${r * 0.15},0L0,${r * 0.05}L0,-${r * 0.05}Z`)
|
||||
.style('fill', 'black');
|
||||
// draw spin circle
|
||||
container
|
||||
.append('circle')
|
||||
.attr('cx', 0)
|
||||
.attr('cy', 0)
|
||||
.attr('r', 60)
|
||||
.style('fill', 'white')
|
||||
.style('cursor', 'pointer');
|
||||
// spin text
|
||||
container
|
||||
.append('text')
|
||||
.attr('x', 0)
|
||||
.attr('y', 10)
|
||||
.attr('text-anchor', 'middle')
|
||||
.text('SPIN')
|
||||
.style('font-weight', 'bold')
|
||||
.style('font-size', '30px');
|
||||
if (imageUrlForSpinner.length > 0) {
|
||||
const defs = svg.append('svg:defs');
|
||||
|
||||
defs.append('svg:pattern')
|
||||
.attr('id', 'image')
|
||||
.attr('width', 1)
|
||||
.attr('height', 1)
|
||||
.attr('patternContentUnits', 'objectBoundingBox')
|
||||
.append('svg:image')
|
||||
.attr('xlink:href', imageUrlForSpinner)
|
||||
.attr('width', 1)
|
||||
.attr('height', 1)
|
||||
.attr('x', 0)
|
||||
.attr('y', 0)
|
||||
.attr('preserveAspectRatio', 'xMaxYMax slice');
|
||||
|
||||
container
|
||||
.append('circle')
|
||||
.attr('cx', 0)
|
||||
.attr('cy', 0)
|
||||
.attr('r', 60)
|
||||
.style('fill', 'white')
|
||||
.style('fill', 'url(#image)')
|
||||
.style('cursor', 'pointer');
|
||||
} else {
|
||||
container
|
||||
.append('circle')
|
||||
.attr('cx', 0)
|
||||
.attr('cy', 0)
|
||||
.attr('r', 60)
|
||||
.style('fill', 'white')
|
||||
.style('cursor', 'pointer');
|
||||
}
|
||||
}
|
||||
|
||||
function drawWheel() {
|
||||
@@ -76,8 +137,8 @@ function drawWheel() {
|
||||
.select('#chart')
|
||||
.append('svg')
|
||||
.data([data])
|
||||
.attr('width', w + padding.left + padding.right)
|
||||
.attr('height', h + padding.top + padding.bottom);
|
||||
.attr('preserveAspectRatio', 'xMinYMin meet')
|
||||
.attr('viewBox', `0 0 ${w + padding.left + padding.right} ${h + padding.top + padding.bottom}`);
|
||||
const container = svg
|
||||
.append('g')
|
||||
.attr('class', 'chartholder')
|
||||
@@ -130,9 +191,16 @@ function drawWheel() {
|
||||
// all slices have been seen, all done
|
||||
// console.log(`OldPick: ${oldpick.length}`, `Data length: ${data.length}`);
|
||||
if (oldpick.length === data.length) {
|
||||
fireworksContainer.style.display = 'none';
|
||||
fireworks.clear();
|
||||
stopSpinning();
|
||||
return;
|
||||
}
|
||||
|
||||
audioControls.stopAudio(tadaSound);
|
||||
audioControls.playAudio(wheelSpinningSound);
|
||||
fireworksContainer.style.display = 'none';
|
||||
fireworks.stop();
|
||||
const ps = 360 / data.length;
|
||||
const rng = Math.floor(Math.random() * 1440 + 360);
|
||||
|
||||
@@ -154,10 +222,22 @@ function drawWheel() {
|
||||
.on('end', () => {
|
||||
// mark question as seen
|
||||
d3.select(`.slice:nth-child(${picked + 1}) path`).attr('fill', '#111');
|
||||
d3.select(`.slice:nth-child(${picked + 1}) text`).attr('fill', '#ffffff');
|
||||
// populate question
|
||||
d3.select('#question h1').text(data[picked].label.trim());
|
||||
modal.style.display = 'block';
|
||||
d3.select('#selection').text(data[picked].label.trim());
|
||||
oldrotation = rotation;
|
||||
|
||||
audioControls.stopAudio(wheelSpinningSound);
|
||||
audioControls.playAudio(tadaSound);
|
||||
fireworksContainer.style.display = 'block';
|
||||
const sizes = {
|
||||
width: window.innerWidth,
|
||||
height: window.innerHeight,
|
||||
};
|
||||
fireworks.updateSize(sizes);
|
||||
fireworks.start();
|
||||
|
||||
/* Get the result value from object "data" */
|
||||
// console.log(data[picked].value);
|
||||
|
||||
@@ -171,10 +251,23 @@ function drawWheel() {
|
||||
makeArrowAndCircle(svg, container);
|
||||
}
|
||||
|
||||
function startOver() {
|
||||
stopSpinning();
|
||||
audioControls.stopAudio(wheelSpinningSound);
|
||||
}
|
||||
|
||||
function toggleMute() {
|
||||
audioControls.toggleMute(wheelSpinningSound);
|
||||
audioControls.toggleMute(tadaSound);
|
||||
this.textContent = wheelSpinningSound.muted ? 'Unmute' : 'Mute';
|
||||
window.localStorage.audioMuteSetting = wheelSpinningSound.muted;
|
||||
// TODO - toggle muting the fireworks from here
|
||||
}
|
||||
|
||||
function startSpinning() {
|
||||
const textArea = <HTMLInputElement>document.getElementById('input-lines');
|
||||
const inputData = textArea.value.trim()
|
||||
? textArea.value.split('\n')
|
||||
? textArea.value.split('\n').filter((elm) => elm)
|
||||
: testData;
|
||||
const tempData = [];
|
||||
for (let index = 0; index < inputData.length; index += 1) {
|
||||
@@ -192,17 +285,27 @@ function startSpinning() {
|
||||
// Make the elements
|
||||
const chartElement = document.createElement('div');
|
||||
chartElement.setAttribute('id', 'chart');
|
||||
chartElement.setAttribute('class', 'spinner-items');
|
||||
document.getElementById('spinner-container').appendChild(chartElement);
|
||||
const startOverElement = document.createElement('button');
|
||||
startOverElement.setAttribute('id', 'start-over');
|
||||
startOverElement.setAttribute('class', 'button button-blue');
|
||||
startOverElement.setAttribute('role', 'button');
|
||||
startOverElement.onclick = startOver;
|
||||
startOverElement.textContent = 'Start over';
|
||||
const muteElement = document.createElement('button');
|
||||
muteElement.setAttribute('id', 'mute');
|
||||
muteElement.setAttribute('class', 'button button-black');
|
||||
muteElement.setAttribute('role', 'button');
|
||||
muteElement.onclick = toggleMute;
|
||||
muteElement.textContent = wheelSpinningSound.muted ? 'Unmute' : 'Mute';
|
||||
chartElement.appendChild(startOverElement);
|
||||
chartElement.appendChild(muteElement);
|
||||
document.getElementById('spinner-container').appendChild(chartElement);
|
||||
const questionElement = document.createElement('div');
|
||||
questionElement.setAttribute('id', 'question');
|
||||
const h1Element = document.createElement('h1');
|
||||
questionElement.appendChild(h1Element);
|
||||
document.getElementById('spinner-container').appendChild(questionElement);
|
||||
|
||||
drawWheel();
|
||||
|
||||
document.getElementById('chart').style.display = 'block';
|
||||
document.getElementById('question').style.display = 'block';
|
||||
document.getElementById('input-lines').style.display = 'none';
|
||||
document.getElementById('startSpinning').style.display = 'none';
|
||||
}
|
||||
@@ -210,6 +313,20 @@ function startSpinning() {
|
||||
const button = document.getElementById('startSpinning');
|
||||
button.onclick = startSpinning;
|
||||
|
||||
const textArea = <HTMLInputElement>document.getElementById('input-lines');
|
||||
if (window.localStorage.TextEditorData) {
|
||||
textArea.value = window.localStorage.TextEditorData;
|
||||
}
|
||||
|
||||
textArea.addEventListener('keyup', () => {
|
||||
window.localStorage.TextEditorData = textArea.value;
|
||||
});
|
||||
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
if (urlParams.has('imgUrl')) {
|
||||
imageUrlForSpinner = urlParams.get('imgUrl');
|
||||
}
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
loadServiceWorker();
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ export default function loadServiceWorker() {
|
||||
let deferredPrompt;
|
||||
|
||||
window.addEventListener('beforeinstallprompt', (e) => {
|
||||
const installApp = document.getElementById('install-offline-app');
|
||||
const installApp = document.getElementById('install-app-btn-container');
|
||||
|
||||
installApp.addEventListener('click', async () => {
|
||||
if (deferredPrompt !== null) {
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<!-- Google tag (gtag.js) -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-EZ2WT7NQMK"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag('config', 'G-EZ2WT7NQMK');
|
||||
</script>
|
||||
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description" content="A fun and simple selection wheel - input names and get click to select them at random.">
|
||||
<title><%= htmlWebpackPlugin.options.title %></title>
|
||||
<link rel="manifest" href="<%= require('../src/assets/manifest.webmanifest') %>" />
|
||||
<link rel="shortcut icon" href="favicon.ico">
|
||||
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Fuzzy+Bubbles:wght@400;700&display=swap" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<header class="topbar-container">
|
||||
<div class="topbar-items"><h1><a href="/">Selection Wheel</a></h1></div>
|
||||
<p id="install-app-btn-container" class="topbar-items">
|
||||
<button id="install-offline-app" class="button button-black" role="button">
|
||||
<span>Install the app (you can even use it offline!)</span>
|
||||
</button>
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<div id="privacy-container">
|
||||
<h1>Privacy Policy</h1>
|
||||
<p>This Website stores none of your information remotely. The only information stored locally is a saved list of your input names, on your own device.</p>
|
||||
<h2>What data do we collect?</h2>
|
||||
<p>None.</p>
|
||||
<h2>How do we collect your data?</h2>
|
||||
<p>I don't.</p>
|
||||
<h2>How will we use your data?</h2>
|
||||
<p>I won't.</p>
|
||||
<h2>How do we store your data?</h2>
|
||||
<p>I don't.</p>
|
||||
<h2>Marketing</h2>
|
||||
<p>I don't market anything to you.</p>
|
||||
<h2>What are your data protection rights?</h2>
|
||||
<p>I would like to make sure you are fully aware of all of your data protection rights. Every user is entitled to
|
||||
the following:</p>
|
||||
<ul>
|
||||
<li>
|
||||
<p>The right to access - You have the right to request copies of your personal data. We may
|
||||
charge you a small fee for this service.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>The right to rectification - You have the right to request that we correct any information you
|
||||
believe is inaccurate. You also have the right to request we complete the information you
|
||||
believe is incomplete.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>The right to erasure - You have the right to request that we erase your personal data, under
|
||||
certain conditions.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>The right to restrict processing - You have the right to request that we restrict the processing
|
||||
of your personal data, under certain conditions.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>The right to object to processing - You have the right to object to our processing of your
|
||||
personal data, under certain conditions.</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>The right to data portability - You have the right to request that we transfer the data that we
|
||||
have collected to another organization, or directly to you, under certain conditions.</p>
|
||||
</li>
|
||||
</ul>
|
||||
<p>If you make a request, I have one month to respond to you. If you would like to exercise any of these rights,
|
||||
please contact me via <a href="https://www.twitter.com/jcreek23">Twitter</a>.</p>
|
||||
<h2 >What are cookies?</h2>
|
||||
<p>Cookies are text files placed on your computer to collect standard Internet log information and visitor behavior
|
||||
information. When you visit our websites, we may collect information from you automatically through cookies or
|
||||
similar technology</p>
|
||||
<p>For further information, visit <a href="https://allaboutcookies.org">allaboutcookies.org</a>.</p>
|
||||
<h2 >How do we use cookies?</h2>
|
||||
<p>I don't.</p>
|
||||
<h2>What types of cookies do we use?</h2>
|
||||
<p>None.</p>
|
||||
<h2>How to manage your cookies</h2>
|
||||
<p>You can set your browser not to accept cookies, and the above website tells you how to remove cookies from your
|
||||
browser. However, in a few cases, some of our website features may not function as a result.</p>
|
||||
<h2></h2>Privacy policies of other websites</h2>
|
||||
<p>This website contains links to other websites. My privacy policy applies only to this website, so if you click on
|
||||
a link to another website, you should read their privacy policy.</p>
|
||||
<h2></h2>Changes to our privacy policy</h2>
|
||||
<p>I keep my privacy policy under regular review and places any updates on this web page. This privacy policy was
|
||||
last updated on 8th October 2022.</p>
|
||||
<h2>How to contact us</h2>
|
||||
<p>If you have any questions about this privacy policy, the data I hold on you, or you would like to exercise one of
|
||||
your data protection rights, please do not hesitate to contact me via <a href="https://www.twitter.com/jcreek23">Twitter</a>.</p>
|
||||
<h2>How to contact the appropriate authorities</h2>
|
||||
<p>Should you wish to report a complaint or if you feel that I have not addressed your concern in a satisfactory
|
||||
manner, you may contact the Information Commissioner's Office.</p>
|
||||
</div>
|
||||
|
||||
|
||||
<footer class="footer-container">
|
||||
<hr>
|
||||
<span class="footer-items">Copyright © 2022 Josh Creek</span>
|
||||
<span> | </span>
|
||||
<span class="footer-items"><a href="/privacy-policy.html">Privacy Policy</a></span>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,15 +1,12 @@
|
||||
import { precacheAndRoute } from 'workbox-precaching';
|
||||
import * as navigationPreload from 'workbox-navigation-preload';
|
||||
import { NetworkFirst, CacheFirst } from 'workbox-strategies';
|
||||
import { NetworkFirst, CacheFirst, StaleWhileRevalidate } from 'workbox-strategies';
|
||||
import { registerRoute, NavigationRoute, Route } from 'workbox-routing';
|
||||
|
||||
// Precache the manifest
|
||||
// eslint-disable-next-line no-underscore-dangle, no-restricted-globals
|
||||
precacheAndRoute(self.__WB_MANIFEST);
|
||||
|
||||
// Enable navigation preload - this should reduce navigation latency
|
||||
navigationPreload.enable();
|
||||
|
||||
const navigationRoute = new NavigationRoute(new NetworkFirst({
|
||||
cacheName: 'navigations',
|
||||
}));
|
||||
@@ -20,3 +17,10 @@ const imageAssetRoute = new Route(({ request }) => request.destination === 'imag
|
||||
|
||||
registerRoute(navigationRoute);
|
||||
registerRoute(imageAssetRoute);
|
||||
|
||||
registerRoute(
|
||||
({ url }) => url.origin === 'https://fonts.googleapis.com',
|
||||
new StaleWhileRevalidate({
|
||||
cacheName: 'google-fonts-stylesheets',
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
.button {
|
||||
appearance: none;
|
||||
border: 1px solid rgba(27, 31, 35, 0.15);
|
||||
border-radius: 6px;
|
||||
box-shadow: rgba(27, 31, 35, 0.1) 0 1px 0;
|
||||
box-sizing: border-box;
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
font-family: -apple-system, system-ui, "Segoe UI", Helvetica, Arial,
|
||||
sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
line-height: 20px;
|
||||
padding: 6px 16px;
|
||||
position: relative;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
user-select: none;
|
||||
-webkit-user-select: none;
|
||||
touch-action: manipulation;
|
||||
vertical-align: middle;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.button:focus:not(:focus-visible):not(.focus-visible) {
|
||||
box-shadow: none;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.button:disabled {
|
||||
border-color: rgba(27, 31, 35, 0.1);
|
||||
color: rgba(255, 255, 255, 0.8);
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.button:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.button-green {
|
||||
background-color: #2ea44f;
|
||||
}
|
||||
|
||||
.button-green:hover {
|
||||
background-color: #2c974b;
|
||||
}
|
||||
|
||||
.button-green:focus {
|
||||
box-shadow: rgba(46, 164, 79, 0.4) 0 0 0 3px;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.button-green:disabled {
|
||||
background-color: #94d3a2;
|
||||
}
|
||||
|
||||
.button-green:active {
|
||||
background-color: #298e46;
|
||||
box-shadow: rgba(20, 70, 32, 0.2) 0 1px 0 inset;
|
||||
}
|
||||
|
||||
.button-black {
|
||||
background-color: #423e37;
|
||||
}
|
||||
|
||||
.button-black:hover {
|
||||
background-color: #2e2b26;
|
||||
}
|
||||
|
||||
.button-blue {
|
||||
background-color: #388697;
|
||||
}
|
||||
|
||||
.button-blue:hover {
|
||||
background-color: #275d69;
|
||||
}
|
||||
|
||||
.button-white {
|
||||
background-color: #ffffff;
|
||||
color: black;
|
||||
}
|
||||
+117
-30
@@ -1,34 +1,121 @@
|
||||
text{
|
||||
font-family:Helvetica, Arial, sans-serif;
|
||||
font-size:11px;
|
||||
pointer-events:none;
|
||||
}
|
||||
#chart{
|
||||
position:absolute;
|
||||
width:500px;
|
||||
height:500px;
|
||||
top:0;
|
||||
left:0;
|
||||
}
|
||||
#question{
|
||||
position: absolute;
|
||||
width:400px;
|
||||
height:500px;
|
||||
top:0;
|
||||
left:520px;
|
||||
}
|
||||
#question h1{
|
||||
font-size: 50px;
|
||||
font-weight: bold;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
position: absolute;
|
||||
padding: 0;
|
||||
body {
|
||||
margin: 0;
|
||||
top:50%;
|
||||
-webkit-transform:translate(0,-50%);
|
||||
transform:translate(0,-50%);
|
||||
font-family: Arial, sans-serif;
|
||||
}
|
||||
|
||||
#install-offline-app {
|
||||
.topbar-container {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: space-around;
|
||||
align-items: flex-start;
|
||||
align-content: flex-start;
|
||||
background-color: #ff8800;
|
||||
margin-bottom: 25px;
|
||||
gap: 5px;
|
||||
}
|
||||
|
||||
.topbar-container h1 {
|
||||
color: white;
|
||||
font-family: "Fuzzy Bubbles", cursive;
|
||||
font-weight: 700;
|
||||
margin-block-start: 0.2em;
|
||||
margin-block-end: 0.2em;
|
||||
|
||||
a {
|
||||
color: white;
|
||||
}
|
||||
|
||||
a:link {
|
||||
text-decoration: none;
|
||||
}
|
||||
}
|
||||
.topbar-container p {
|
||||
margin-block-start: 0.2em;
|
||||
margin-block-end: 0.2em;
|
||||
}
|
||||
|
||||
.topbar-items:nth-child(1) {
|
||||
display: block;
|
||||
flex-grow: 0;
|
||||
flex-shrink: 1;
|
||||
flex-basis: auto;
|
||||
align-self: flex-start;
|
||||
order: 0;
|
||||
}
|
||||
|
||||
.topbar-items:nth-child(2) {
|
||||
display: block;
|
||||
flex-grow: 0;
|
||||
flex-shrink: 1;
|
||||
flex-basis: 200px;
|
||||
align-self: center;
|
||||
order: 0;
|
||||
}
|
||||
|
||||
#input-container {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
align-items: flex-start;
|
||||
align-content: center;
|
||||
gap: 25px;
|
||||
}
|
||||
|
||||
.input-items:nth-child(1) {
|
||||
display: block;
|
||||
flex-grow: 0;
|
||||
flex-shrink: 1;
|
||||
flex-basis: 500px;
|
||||
align-self: auto;
|
||||
order: 0;
|
||||
}
|
||||
|
||||
.input-items:nth-child(2) {
|
||||
display: block;
|
||||
flex-grow: 0;
|
||||
flex-shrink: 1;
|
||||
flex-basis: auto;
|
||||
align-self: center;
|
||||
order: 0;
|
||||
}
|
||||
|
||||
#install-app-btn-container {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.footer-container {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
color: #423e37;
|
||||
padding-bottom: 10px;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.footer-container hr {
|
||||
max-width: 500px;
|
||||
border-top: 0.5px solid #423e37;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.footer-container a,
|
||||
#privacy-container a {
|
||||
color: #423e37;
|
||||
}
|
||||
|
||||
.footer-container a:hover,
|
||||
#privacy-container a:hover {
|
||||
color: #81796c;
|
||||
}
|
||||
|
||||
#privacy-container {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
max-width: 800px;
|
||||
margin-bottom: 50px;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
/* The Modal (background) */
|
||||
.modal {
|
||||
display: none; /* Hidden by default */
|
||||
position: fixed; /* Stay in place */
|
||||
z-index: 1; /* Sit on top */
|
||||
// padding-top: 100px; /* Location of the box */
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%; /* Full width */
|
||||
height: 100%; /* Full height */
|
||||
overflow: auto; /* Enable scroll if needed */
|
||||
background-color: rgb(0, 0, 0); /* Fallback color */
|
||||
background-color: rgba(0, 0, 0, 0.4); /* Black w/ opacity */
|
||||
}
|
||||
|
||||
/* Modal Content/Box */
|
||||
#modal-content {
|
||||
position: relative;
|
||||
background-color: #fefefe;
|
||||
margin: auto;
|
||||
padding: 0;
|
||||
border: 1px solid #888;
|
||||
width: 80%;
|
||||
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
|
||||
-webkit-animation-name: animatetop;
|
||||
-webkit-animation-duration: 0.8s;
|
||||
animation-name: animatetop;
|
||||
animation-duration: 0.4s;
|
||||
top: 30%;
|
||||
transform: translateY(-30%);
|
||||
text-align: center;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
@-webkit-keyframes animatetop {
|
||||
from {
|
||||
top: -300px;
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
top: 30%;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes animatetop {
|
||||
from {
|
||||
top: -300px;
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
top: 30%;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
#input-lines {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
#start-over {
|
||||
position: absolute;
|
||||
top: 100px;
|
||||
left: auto;
|
||||
}
|
||||
|
||||
#mute {
|
||||
position: absolute;
|
||||
top: 140px;
|
||||
left: auto;
|
||||
}
|
||||
|
||||
#spinner-container {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
align-items: flex-start;
|
||||
align-content: center;
|
||||
}
|
||||
|
||||
.spinner-items:nth-child(1) {
|
||||
display: block;
|
||||
flex-grow: 0;
|
||||
flex-shrink: 1;
|
||||
flex-basis: 800px;
|
||||
align-self: auto;
|
||||
order: 0;
|
||||
}
|
||||
|
||||
@media screen and ( max-height: 920px )
|
||||
{
|
||||
.spinner-items:nth-child(1){
|
||||
flex-basis: 650px;
|
||||
flex-grow: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.spinner-items:nth-child(2) {
|
||||
display: block;
|
||||
flex-grow: 0;
|
||||
flex-shrink: 1;
|
||||
flex-basis: auto;
|
||||
align-self: auto;
|
||||
order: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
text {
|
||||
font-family: Arial, sans-serif;
|
||||
font-size: 35px;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
#chart {
|
||||
max-width: calc(90%);
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
@media screen and ( min-width: 800px ) and ( max-height: 800px )
|
||||
{
|
||||
#chart{
|
||||
max-width: 650px;
|
||||
}
|
||||
}
|
||||
|
||||
#selection h1 {
|
||||
font-size: 50px;
|
||||
font-weight: bold;
|
||||
font-family: Arial, sans-serif;
|
||||
-webkit-transform: translate(0, -50%);
|
||||
transform: translate(0, -50%);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#fireworks-container {
|
||||
display: none;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#image {
|
||||
width: 100%;
|
||||
}
|
||||
+45
-8
@@ -18,19 +18,56 @@
|
||||
<title><%= htmlWebpackPlugin.options.title %></title>
|
||||
<link rel="manifest" href="<%= require('../src/assets/manifest.webmanifest') %>" />
|
||||
<link rel="shortcut icon" href="favicon.ico">
|
||||
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Fuzzy+Bubbles:wght@400;700&display=swap" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<header class="topbar-container">
|
||||
<div class="topbar-items"><h1><a href="/">Selection Wheel</a></h1></div>
|
||||
<p id="install-app-btn-container" class="topbar-items">
|
||||
<button id="install-offline-app" class="button button-black" role="button">
|
||||
<span>Install the app (you can even use it offline!)</span>
|
||||
</button>
|
||||
</p>
|
||||
</header>
|
||||
|
||||
|
||||
|
||||
<div id="spinner-container">
|
||||
</div>
|
||||
|
||||
<textarea id="input-lines" rows="15" cols="60" name="text"
|
||||
placeholder="Enter names to be shuffled, one per line. Leave this area empty in order to use a default set of generated names."></textarea>
|
||||
<button id="startSpinning">Start spinning</button>
|
||||
<div id="input-container">
|
||||
<textarea id="input-lines" class="input-items" rows="15" cols="60" name="text"
|
||||
placeholder="Enter names to be shuffled, one per line. Leave this area empty in order to use a default set of generated names.
|
||||
|
||||
<p id="install-app-btn-container">
|
||||
<button id="install-offline-app" class="btn btn-secondary btn-xs">
|
||||
<span>Install the app (you can even use it offline!)</span>
|
||||
</button>
|
||||
</p>
|
||||
Click or tap on the wheel to spin it.
|
||||
|
||||
You can also customise the centre of the spinner with an image. Just put ?imgUrl= at the end of the web address and the URL of the image you want to use.
|
||||
|
||||
For example, https://wheel.jcreek.co.uk/?imgUrl=https://www.mammal.org.uk/wp-content/uploads/2021/09/red-fox-300x300.jpg"></textarea>
|
||||
<button id="startSpinning" class="input-items button button-green" role="button">Start spinning</button>
|
||||
</div>
|
||||
|
||||
<footer class="footer-container">
|
||||
<hr>
|
||||
<span class="footer-items">Copyright © 2022 Josh Creek</span>
|
||||
<span> | </span>
|
||||
<span class="footer-items"><a href="/privacy-policy.html">Privacy Policy</a></span>
|
||||
</footer>
|
||||
|
||||
<div id="myModal" class="modal">
|
||||
|
||||
|
||||
<!-- Modal content -->
|
||||
<div id="modal-content">
|
||||
<h1 id="selection"></h1>
|
||||
</div>
|
||||
<div id="fireworks-container"></div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -86,6 +86,12 @@ module.exports = {
|
||||
filename: 'index.html',
|
||||
template: 'src/template.html',
|
||||
}),
|
||||
new HtmlWebpackPlugin({
|
||||
inject: 'body',
|
||||
title: 'Privacy Policy',
|
||||
filename: 'privacy-policy.html',
|
||||
template: 'src/privacy.html',
|
||||
}),
|
||||
new InlineChunkHtmlPlugin(HtmlWebpackPlugin, [/.*/]),
|
||||
new WebpackManifestPlugin(options),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user