add multi-box support for toggle bingo
This commit is contained in:
parent
f7bb6b6e6c
commit
0d37be6c6b
@ -7,6 +7,11 @@
|
|||||||
background: linear-gradient(45deg, gray, white, white, gray)
|
background: linear-gradient(45deg, gray, white, white, gray)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.card-row-3 .card-column-3.toggled,
|
||||||
|
.card-row-3 .card-column-3.bingo {
|
||||||
|
background: white;
|
||||||
|
}
|
||||||
|
|
||||||
/* https://jsfiddle.net/elin/7m3bL/ */
|
/* https://jsfiddle.net/elin/7m3bL/ */
|
||||||
.pyro {margin: 0;padding: 0;background: linear-gradient(45deg, green, rgba(0,0,0,0.6), white, rgba(0,0,0,0.6), red);overflow: hidden;z-index: 10; position: absolute;top: 0;left: 0;right: 0;bottom: 0;}
|
.pyro {margin: 0;padding: 0;background: linear-gradient(45deg, green, rgba(0,0,0,0.6), white, rgba(0,0,0,0.6), red);overflow: hidden;z-index: 10; position: absolute;top: 0;left: 0;right: 0;bottom: 0;}
|
||||||
.pyro > .before, .pyro > .after {position: absolute;width: 5px;height: 5px;border-radius: 50%;box-shadow: -120px -218.66667px blue, 248px -16.66667px #00ff84, 190px 16.33333px #002bff, -113px -308.66667px #ff009d, -109px -287.66667px #ffb300, -50px -313.66667px #ff006e, 226px -31.66667px #ff4000, 180px -351.66667px #ff00d0, -12px -338.66667px #00f6ff, 220px -388.66667px #99ff00, -69px -27.66667px #ff0400, -111px -339.66667px #6200ff, 155px -237.66667px #00ddff, -152px -380.66667px #00ffd0, -50px -37.66667px #00ffdd, -95px -175.66667px #a6ff00, -88px 10.33333px #0d00ff, 112px -309.66667px #005eff, 69px -415.66667px #ff00a6, 168px -100.66667px #ff004c, -244px 24.33333px #ff6600, 97px -325.66667px #ff0066, -211px -182.66667px #00ffa2, 236px -126.66667px #b700ff, 140px -196.66667px #9000ff, 125px -175.66667px #00bbff, 118px -381.66667px #ff002f, 144px -111.66667px #ffae00, 36px -78.66667px #f600ff, -63px -196.66667px #c800ff, -218px -227.66667px #d4ff00, -134px -377.66667px #ea00ff, -36px -412.66667px #ff00d4, 209px -106.66667px #00fff2, 91px -278.66667px #000dff, -22px -191.66667px #9dff00, 139px -392.66667px #a6ff00, 56px -2.66667px #0099ff, -156px -276.66667px #ea00ff, -163px -233.66667px #00fffb, -238px -346.66667px #00ff73, 62px -363.66667px #0088ff, 244px -170.66667px #0062ff, 224px -142.66667px #b300ff, 141px -208.66667px #9000ff, 211px -285.66667px #ff6600, 181px -128.66667px #1e00ff, 90px -123.66667px #c800ff, 189px 70.33333px #00ffc8, -18px -383.66667px #00ff33, 100px -6.66667px #ff008c;-moz-animation: 1s bang ease-out infinite backwards, 1s gravity ease-in infinite backwards, 5s position linear infinite backwards;-webkit-animation: 1s bang ease-out infinite backwards, 1s gravity ease-in infinite backwards, 5s position linear infinite backwards;-o-animation: 1s bang ease-out infinite backwards, 1s gravity ease-in infinite backwards, 5s position linear infinite backwards;-ms-animation: 1s bang ease-out infinite backwards, 1s gravity ease-in infinite backwards, 5s position linear infinite backwards;animation: 1s bang ease-out infinite backwards, 1s gravity ease-in infinite backwards, 5s position linear infinite backwards; }
|
.pyro > .before, .pyro > .after {position: absolute;width: 5px;height: 5px;border-radius: 50%;box-shadow: -120px -218.66667px blue, 248px -16.66667px #00ff84, 190px 16.33333px #002bff, -113px -308.66667px #ff009d, -109px -287.66667px #ffb300, -50px -313.66667px #ff006e, 226px -31.66667px #ff4000, 180px -351.66667px #ff00d0, -12px -338.66667px #00f6ff, 220px -388.66667px #99ff00, -69px -27.66667px #ff0400, -111px -339.66667px #6200ff, 155px -237.66667px #00ddff, -152px -380.66667px #00ffd0, -50px -37.66667px #00ffdd, -95px -175.66667px #a6ff00, -88px 10.33333px #0d00ff, 112px -309.66667px #005eff, 69px -415.66667px #ff00a6, 168px -100.66667px #ff004c, -244px 24.33333px #ff6600, 97px -325.66667px #ff0066, -211px -182.66667px #00ffa2, 236px -126.66667px #b700ff, 140px -196.66667px #9000ff, 125px -175.66667px #00bbff, 118px -381.66667px #ff002f, 144px -111.66667px #ffae00, 36px -78.66667px #f600ff, -63px -196.66667px #c800ff, -218px -227.66667px #d4ff00, -134px -377.66667px #ea00ff, -36px -412.66667px #ff00d4, 209px -106.66667px #00fff2, 91px -278.66667px #000dff, -22px -191.66667px #9dff00, 139px -392.66667px #a6ff00, 56px -2.66667px #0099ff, -156px -276.66667px #ea00ff, -163px -233.66667px #00fffb, -238px -346.66667px #00ff73, 62px -363.66667px #0088ff, 244px -170.66667px #0062ff, 224px -142.66667px #b300ff, 141px -208.66667px #9000ff, 211px -285.66667px #ff6600, 181px -128.66667px #1e00ff, 90px -123.66667px #c800ff, 189px 70.33333px #00ffc8, -18px -383.66667px #00ff33, 100px -6.66667px #ff008c;-moz-animation: 1s bang ease-out infinite backwards, 1s gravity ease-in infinite backwards, 5s position linear infinite backwards;-webkit-animation: 1s bang ease-out infinite backwards, 1s gravity ease-in infinite backwards, 5s position linear infinite backwards;-o-animation: 1s bang ease-out infinite backwards, 1s gravity ease-in infinite backwards, 5s position linear infinite backwards;-ms-animation: 1s bang ease-out infinite backwards, 1s gravity ease-in infinite backwards, 5s position linear infinite backwards;animation: 1s bang ease-out infinite backwards, 1s gravity ease-in infinite backwards, 5s position linear infinite backwards; }
|
||||||
|
28
clickable.js
28
clickable.js
@ -1,11 +1,39 @@
|
|||||||
const toggled = 'toggled';
|
const toggled = 'toggled';
|
||||||
|
|
||||||
|
replaceAt = function(str, index, replacement) {
|
||||||
|
return str.substr(0, index) + replacement+ str.substr(index + replacement.length);
|
||||||
|
}
|
||||||
|
|
||||||
function handleClickableBoxes(evt) {
|
function handleClickableBoxes(evt) {
|
||||||
let me = evt.target;
|
let me = evt.target;
|
||||||
|
|
||||||
|
var hasMultiTarget = false;
|
||||||
|
var goodMultiTarget = false;
|
||||||
|
|
||||||
|
if(me.classList.contains('multi-count')) {
|
||||||
|
hasMultiTarget = true;
|
||||||
|
var counterClass = 0;
|
||||||
|
Array.from(me.classList).forEach(x => {if (x.startsWith('multi-count-')) {counterClass = x.replace('multi-count-','')}});
|
||||||
|
if (!me.classList.contains(`multi-click-${counterClass}`)) {
|
||||||
|
var innerCount = 0;
|
||||||
|
Array.from(me.classList).forEach(x => {if (x.startsWith('multi-click-')) {innerCount = x.replace('multi-click-','')}});
|
||||||
|
me.innerHTML = replaceAt(me.innerHTML, me.innerHTML.indexOf('◻'), '◼️');
|
||||||
|
Array.from(me.classList).forEach(x => {if (x.startsWith('multi-click-')) {me.classList.remove(x)}});
|
||||||
|
innerCount = parseInt(innerCount) + 1;
|
||||||
|
me.classList.add(`multi-click-${innerCount}`);
|
||||||
|
if (innerCount == counterClass) {
|
||||||
|
goodMultiTarget = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
goodMultiTarget = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var goodMulti = (hasMultiTarget && goodMultiTarget) || (!hasMultiTarget && !goodMultiTarget)
|
||||||
if(me.classList.contains(toggled)) {
|
if(me.classList.contains(toggled)) {
|
||||||
me.classList.remove(toggled)
|
me.classList.remove(toggled)
|
||||||
} else {
|
} else {
|
||||||
|
if (goodMulti)
|
||||||
me.classList.add(toggled)
|
me.classList.add(toggled)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
<div class="card-column card-column-2">
|
<div class="card-column card-column-2">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="card-column card-column-3">
|
<div class="card-column card-column-3 toggled">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="card-column card-column-4">
|
<div class="card-column card-column-4">
|
||||||
|
@ -113,6 +113,8 @@ function generatePhrases() {
|
|||||||
for(let r = 0; r < r2; r++) {
|
for(let r = 0; r < r2; r++) {
|
||||||
inner += "◻ "
|
inner += "◻ "
|
||||||
}
|
}
|
||||||
|
cell.classList.add(`multi-count-${r2}`)
|
||||||
|
cell.classList.add(`multi-count`)
|
||||||
}
|
}
|
||||||
cell.innerHTML = inner;
|
cell.innerHTML = inner;
|
||||||
cell.classList.add(item.list);
|
cell.classList.add(item.list);
|
||||||
|
Loading…
Reference in New Issue
Block a user