Merge pull request #2 from gocivici/thankyou-screen-and-archive
Thankyou screen and archive
This commit is contained in:
commit
a643b1f11b
13
index.html
13
index.html
@ -38,7 +38,7 @@
|
|||||||
<a class="mobileInfo" href="#info"><i class="fa fa-question"></i></a>
|
<a class="mobileInfo" href="#info"><i class="fa fa-question"></i></a>
|
||||||
<a class="mobileInfo" href="#support"><i class="fa fa-heart"></i></a>
|
<a class="mobileInfo" href="#support"><i class="fa fa-heart"></i></a>
|
||||||
<a class="wideInfo" href="#support"><i class="fa fa-heart"></i></a>
|
<a class="wideInfo" href="#support"><i class="fa fa-heart"></i></a>
|
||||||
<a href="#stats"><i class="fas fa-chart-bar"></i></a>
|
<a onclick="remember()" href="#stats"><image class="gif" src="new.gif"></image><i class="fas fa-history"></i></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -88,7 +88,7 @@
|
|||||||
|
|
||||||
<div id="stats" class="overlay">
|
<div id="stats" class="overlay">
|
||||||
<div class="popup">
|
<div class="popup">
|
||||||
<h2>Stats</h2>
|
<h2>Archive</h2>
|
||||||
<h3>October 2022</h3>
|
<h3>October 2022</h3>
|
||||||
<div class="archive">
|
<div class="archive">
|
||||||
|
|
||||||
@ -141,20 +141,21 @@
|
|||||||
<div class="calendar__number">29</div>
|
<div class="calendar__number">29</div>
|
||||||
<div class="calendar__number">30</div>
|
<div class="calendar__number">30</div>
|
||||||
<div class="calendar__number">31</div>
|
<div class="calendar__number">31</div>
|
||||||
|
<div class="calendar__number">1</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="chartNumber">
|
<!-- <div class="chartNumber">
|
||||||
<canvas id="myChart"></canvas>
|
<canvas id="myChart"></canvas>
|
||||||
</div>
|
</div> -->
|
||||||
<a class="close" href="#">×</a>
|
<a class="close" href="#">×</a>
|
||||||
<!-- <h3>Streak</h3> -->
|
<!-- <h3>Streak</h3> -->
|
||||||
<!-- <div id="streakNumber" class="content">
|
<!-- <div id="streakNumber" class="content">
|
||||||
your stats
|
your stats
|
||||||
</div> -->
|
</div> -->
|
||||||
|
<input onclick="copyToClipboardCalendar()" type="button" id="shareResultCalender" value="Share Total Result">
|
||||||
<button onclick="resetFunction();"class="resetButton">Reset Stats</button>
|
<!-- <button onclick="resetFunction();"class="resetButton">Reset Stats</button> -->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
257
main.js
257
main.js
@ -10,6 +10,11 @@
|
|||||||
//pre-load images
|
//pre-load images
|
||||||
//image placeholder
|
//image placeholder
|
||||||
// gameover movie name
|
// gameover movie name
|
||||||
|
getReady()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function getReady() {
|
||||||
|
|
||||||
window.addEventListener ("load", function() {
|
window.addEventListener ("load", function() {
|
||||||
loader.style.display = 'none';
|
loader.style.display = 'none';
|
||||||
@ -23,12 +28,20 @@ guess='Skipped';
|
|||||||
localStorage.setItem('playedBefore',"true");
|
localStorage.setItem('playedBefore',"true");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(localStorage.getItem('archiveButtonPressed')){
|
||||||
|
|
||||||
|
document.getElementsByClassName("gif")[0].style.display="none";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var buttonNo = 0;
|
var buttonNo = 0;
|
||||||
|
|
||||||
|
|
||||||
bonusRoundState = false;
|
bonusRoundState = false;
|
||||||
var playedBefore = false;
|
var playedBefore = false;
|
||||||
var sameDay = false;
|
var sameDay = false;
|
||||||
|
}
|
||||||
for (var i = 0; i < localStorage.length; i++){
|
for (var i = 0; i < localStorage.length; i++){
|
||||||
console.log(localStorage.key(i));
|
console.log(localStorage.key(i));
|
||||||
}
|
}
|
||||||
@ -36,6 +49,9 @@ for (var i = 0; i < localStorage.length; i++){
|
|||||||
function revealButtons(g = guessNo){
|
function revealButtons(g = guessNo){
|
||||||
picButtons = document.getElementsByClassName('imageButton');
|
picButtons = document.getElementsByClassName('imageButton');
|
||||||
picButtons[g].classList.add('active');
|
picButtons[g].classList.add('active');
|
||||||
|
picButtons[0].style.display = "none";
|
||||||
|
picButtons[1].style.display = "none";
|
||||||
|
picButtons[2].style.display = "none";
|
||||||
for (var i = 0; i <= g; i++){
|
for (var i = 0; i <= g; i++){
|
||||||
console.log("revealButton guess no " + guessNo);
|
console.log("revealButton guess no " + guessNo);
|
||||||
picButtons[i].style.display = "inline";
|
picButtons[i].style.display = "inline";
|
||||||
@ -1056,68 +1072,84 @@ var movies = [
|
|||||||
];
|
];
|
||||||
var pix = [];
|
var pix = [];
|
||||||
// autocomplete(document.getElementById("guess"), movies);
|
// autocomplete(document.getElementById("guess"), movies);
|
||||||
var gameBeginning = new Date('September 30, 2022 00:00:00');
|
var gameBeginning = new Date('October 1, 2022 00:00:00');
|
||||||
var countDownTime = new Date();
|
var countDownTime = new Date();
|
||||||
var present_date = new Date();
|
var present_date = new Date();
|
||||||
|
// var present_date = new Date('November 1, 2022 00:00:00');
|
||||||
// var present_date = new Date('September 26, 2022 00:00:00');
|
// var present_date = new Date('September 26, 2022 00:00:00');
|
||||||
|
|
||||||
// gameBeginning = new Date(gameBeginning.getTime() + 0 * 60 * 1000);
|
// gameBeginning = new Date(gameBeginning.getTime() + 0 * 60 * 1000);
|
||||||
console.log(gameBeginning.getTimezoneOffset());
|
// console.log(gameBeginning.getTimezoneOffset());
|
||||||
dayCounter();
|
dayCounter();
|
||||||
console.log("gameBeginning: ",gameBeginning);
|
if(dayCount>30){
|
||||||
console.log("now: ",present_date);
|
document.getElementsByClassName("gif")[0].style.display="block";
|
||||||
|
}
|
||||||
|
// console.log("gameBeginning: ",gameBeginning);
|
||||||
|
// console.log("now: ",present_date);
|
||||||
|
// console.log("Current dayCount: ", dayCount)
|
||||||
|
|
||||||
|
|
||||||
// console.log(textResult);
|
// console.log(textResult);
|
||||||
function dayCounter(){
|
function dayCounter(){
|
||||||
dayCount = Math.floor((present_date - gameBeginning) / (1000 * 60 * 60 * 24));
|
dayCount = Math.floor((present_date - gameBeginning) / (1000 * 60 * 60 * 24));
|
||||||
|
console.log("dayCount: " + dayCount);
|
||||||
|
|
||||||
return dayCount;
|
return dayCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
markCalendar();
|
markCalendar();
|
||||||
|
|
||||||
function markCalendar() {
|
function markCalendar() {
|
||||||
|
calendarResult=" "
|
||||||
winCount = 0;
|
winCount = 0;
|
||||||
loseCount = 0;
|
loseCount = 0;
|
||||||
dates = document.getElementsByClassName('calendar__number');
|
dates = document.getElementsByClassName('calendar__number');
|
||||||
console.log(dates[10].innerHTML);
|
console.log("dateslength: " + dates.length);
|
||||||
var tag = [];
|
var tag = [];
|
||||||
for (var i = 0; i < dates.length; i++) {
|
for (var i = 0; i < dates.length; i++) {
|
||||||
|
|
||||||
|
|
||||||
if (dates[i].innerHTML==dayCount) {
|
if (dates[i].innerHTML==dayCount) {
|
||||||
dates[i].classList.add('current');
|
dates[i+1].classList.add('current');
|
||||||
|
}
|
||||||
|
|
||||||
for (var j = 0; j <= i; j++) {
|
if (localStorage.getItem('day'+(i))) {
|
||||||
if (localStorage.getItem('day'+(j+1))) {
|
if (localStorage.getItem('day'+(i))=='true') {
|
||||||
if (localStorage.getItem('day'+(j+1))=='true') {
|
dates[i].classList.add('won');
|
||||||
dates[j].classList.add('won');
|
calendarResult+="🟩"
|
||||||
|
if((i+6)%7==0){calendarResult+="\n"}
|
||||||
winCount=winCount + 1;
|
winCount=winCount + 1;
|
||||||
} else if (localStorage.getItem('day'+(j+1))=='false') {
|
} else if (localStorage.getItem('day'+(i))=='false') {
|
||||||
dates[j].classList.add('lost');
|
dates[i].classList.add('lost');
|
||||||
|
calendarResult+="🟥"
|
||||||
|
if((i+6)%7==0){calendarResult+="\n"}
|
||||||
loseCount=loseCount + 1;
|
loseCount=loseCount + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
|
|
||||||
|
|
||||||
dates[j].classList.add('past');
|
dates[i].classList.add('past');
|
||||||
dates[j] = document.createElement('a');
|
dates[i] = document.createElement('a');
|
||||||
|
calendarResult+="🟧"
|
||||||
|
if((i+6)%7==0){calendarResult+="\n"}
|
||||||
//dates[j].setAttribute('href','#');
|
//dates[j].setAttribute('href','#');
|
||||||
if(localStorage.getItem("playedToday")){
|
// if(localStorage.getItem("playedToday")){
|
||||||
// dates[j].setAttribute('onclick','getArchive(' + (j+1) +')');
|
dates[i].setAttribute('onclick','getArchive(' + (i+1) +')');
|
||||||
// dates[j] = "<a href='#'>" + dates[j] + "</a>";
|
// dates[j] = "<a href='#'>" + dates[j] + "</a>";
|
||||||
}
|
}
|
||||||
}
|
// }
|
||||||
// dates[j] = "<a href='" + dayCount + "'>" + dates[j] + "</a>";
|
// dates[j] = "<a href='" + dayCount + "'>" + dates[j] + "</a>";
|
||||||
//tag[j].appendChild(dates[j]);
|
//tag[j].appendChild(dates[j]);
|
||||||
//console.log(tag[j]);
|
//console.log(tag[j]);
|
||||||
console.log(dates[j]);
|
// console.log(dates[j]);
|
||||||
}
|
|
||||||
|
|
||||||
console.log(dates[i]);
|
// console.log(dates[i]);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// calendarResult = calendarResult.replace(/(.{8})/g, "$1|");
|
||||||
|
console.log("calo reso"+ calendarResult);
|
||||||
console.log("win:"+ winCount)
|
console.log("win:"+ winCount)
|
||||||
console.log("lose:"+ loseCount)
|
console.log("lose:"+ loseCount)
|
||||||
winPerc.textContent = Math.ceil(winCount/(winCount+loseCount)*100)+"%";
|
winPerc.textContent = Math.ceil(winCount/(winCount+loseCount)*100)+"%";
|
||||||
@ -1157,7 +1189,24 @@ function clearGuess() {
|
|||||||
document.getElementById("shareResult").style.display = "none";
|
document.getElementById("shareResult").style.display = "none";
|
||||||
document.getElementById("guessForm").style.display = "block";
|
document.getElementById("guessForm").style.display = "block";
|
||||||
document.getElementById("countDown").style.display = "none";
|
document.getElementById("countDown").style.display = "none";
|
||||||
document.getElementById("footer").style.display = "none";
|
// document.getElementById("footer").style.display = "none";
|
||||||
|
// document.getElementById("resultText").innerHTML =textResult;
|
||||||
|
document.getElementById("movieFrame").style.display = "block";
|
||||||
|
document.getElementsByClassName("resultContainer")[0].style.display="none";
|
||||||
|
document.getElementsByClassName("picButtons")[0].style.display="block";
|
||||||
|
document.getElementById("movieName").innerHTML="";
|
||||||
|
document.getElementById("bonusQuestion").innerHTML="";
|
||||||
|
tempButton = document.getElementsByClassName("imageButton");
|
||||||
|
for (let i = 0; i < 3; i++) {
|
||||||
|
tempButton[i].classList.remove("bonusScreen");
|
||||||
|
}
|
||||||
|
// revealButtons(2);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// document.getElementById("movieFrame").style.display = "block";
|
||||||
|
// document.getElementById("resultContainer").style.display = "none";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1174,15 +1223,15 @@ streakNumber.textContent =localStorage.getItem('streak');
|
|||||||
textResult=localStorage.getItem('result')
|
textResult=localStorage.getItem('result')
|
||||||
document.getElementById("movieName").innerHTML = localStorage.getItem('movieName')
|
document.getElementById("movieName").innerHTML = localStorage.getItem('movieName')
|
||||||
|
|
||||||
console.log("played before: ",playedBefore);
|
// console.log("played before: ",playedBefore);
|
||||||
console.log(localStorage.getItem('firstGuess'));
|
// console.log(localStorage.getItem('firstGuess'));
|
||||||
console.log(localStorage.getItem('secondGuess'));
|
// console.log(localStorage.getItem('secondGuess'));
|
||||||
if(localStorage.getItem('guessNo')){guessNo=localStorage.getItem('guessNo')};
|
if(localStorage.getItem('guessNo')){guessNo=localStorage.getItem('guessNo')};
|
||||||
feedback.textContent = "🩸 " + (3-guessNo) + " guesses remaining";
|
feedback.textContent = "🩸 " + (3-guessNo) + " guesses remaining";
|
||||||
if(localStorage.getItem('result')) {localStorage.setItem('result', textResult);}
|
if(localStorage.getItem('result')) {localStorage.setItem('result', textResult);}
|
||||||
if(localStorage.getItem('firstGuess')){firstGuess.textContent = "❌ " + localStorage.getItem('firstGuess');document.getElementById("firstGuess").style.display = "block";}
|
if(localStorage.getItem('firstGuess')){firstGuess.textContent = "❌ " + localStorage.getItem('firstGuess');document.getElementById("firstGuess").style.display = "block";}
|
||||||
if(localStorage.getItem('secondGuess')){secondGuess.textContent = "❌ " + localStorage.getItem('secondGuess');document.getElementById("secondGuess").style.display = "block";}
|
if(localStorage.getItem('secondGuess')){secondGuess.textContent = "❌ " + localStorage.getItem('secondGuess');document.getElementById("secondGuess").style.display = "block";}
|
||||||
if(localStorage.getItem('winningGuess')||localStorage.getItem('lost')){document.getElementById("resultText").innerHTML =textResult;document.getElementById("movieFrame").style.display = "none";document.getElementsByClassName("resultContainer")[0].style.display="flex";document.getElementsByClassName("picButtons")[0].style.display="none";revealButtons(2);document.getElementById("feedback").innerHTML = "Next movie at <b>midnight!</b> 🕛";document.getElementById("shareResult").style.display = "block";document.getElementById("countDown").style.display = "block";document.getElementById("footer").style.display = "block";document.getElementById("guessForm").style.display = "none";document.getElementById("firstGuess").style.display = "none";document.getElementById("secondGuess").style.display = "none";document.getElementById("resultText").style.display="block";}else {document.getElementById("shareResult").style.display = "none";document.getElementById("guessForm").style.display = "block";document.getElementById("resultText").style.display="none";};
|
if(localStorage.getItem('winningGuess')||localStorage.getItem('lost')){document.getElementById("resultText").innerHTML =textResult;document.getElementById("movieFrame").style.display = "none";document.getElementsByClassName("resultContainer")[0].style.display="flex";document.getElementsByClassName("picButtons")[0].style.display="none";document.getElementById("feedback").innerHTML = "Next movie at <b>midnight!</b> 🕛";document.getElementById("shareResult").style.display = "block";document.getElementById("countDown").style.display = "block";document.getElementById("footer").style.display = "block";document.getElementById("guessForm").style.display = "none";document.getElementById("firstGuess").style.display = "none";document.getElementById("secondGuess").style.display = "none";document.getElementById("resultText").style.display="block";}else {document.getElementById("resultText").innerHTML =textResult;document.getElementById("movieFrame").style.display = "block";document.getElementsByClassName("resultContainer")[0].style.display="none";document.getElementsByClassName("picButtons")[0].style.display="block";document.getElementById("shareResult").style.display = "none";document.getElementById("countDown").style.display = "none";document.getElementById("footer").style.display = "block";document.getElementById("guessForm").style.display = "block";};
|
||||||
if(localStorage.getItem('lost')){ document.getElementById("congratz").innerHTML = "You lost☠️"; document.getElementsByClassName("resultContainer")[0].style.borderColor = "#C62828";}
|
if(localStorage.getItem('lost')){ document.getElementById("congratz").innerHTML = "You lost☠️"; document.getElementsByClassName("resultContainer")[0].style.borderColor = "#C62828";}
|
||||||
secondGuess.textContent = "❌ " + localStorage.getItem('secondGuess');
|
secondGuess.textContent = "❌ " + localStorage.getItem('secondGuess');
|
||||||
revealButtons();
|
revealButtons();
|
||||||
@ -1194,7 +1243,9 @@ markCalendar();
|
|||||||
|
|
||||||
}
|
}
|
||||||
checkingGuess();
|
checkingGuess();
|
||||||
|
|
||||||
window.onload = deathOftheDay();
|
window.onload = deathOftheDay();
|
||||||
|
|
||||||
// console.log(dayCount);
|
// console.log(dayCount);
|
||||||
|
|
||||||
|
|
||||||
@ -1202,8 +1253,9 @@ window.onload = deathOftheDay();
|
|||||||
|
|
||||||
function deathOftheDay(x=dayCount){
|
function deathOftheDay(x=dayCount){
|
||||||
pix = [];
|
pix = [];
|
||||||
movieOfTheDay = movies[x-1];
|
movieOfTheDay = movies[x];
|
||||||
|
if (x<31){
|
||||||
|
document.getElementById("movieFrame").style.display = "block";
|
||||||
for (let i = 1; i < 4; i++) {
|
for (let i = 1; i < 4; i++) {
|
||||||
pix.push("images/"+movieOfTheDay[0]+"/"+i+".png");
|
pix.push("images/"+movieOfTheDay[0]+"/"+i+".png");
|
||||||
preloadImage("images/"+movieOfTheDay[0]+"/"+i+".png");
|
preloadImage("images/"+movieOfTheDay[0]+"/"+i+".png");
|
||||||
@ -1213,6 +1265,13 @@ window.onload = deathOftheDay();
|
|||||||
console.log('Movie: ', movieOfTheDay[0]);
|
console.log('Movie: ', movieOfTheDay[0]);
|
||||||
console.log('Array: ', pix);
|
console.log('Array: ', pix);
|
||||||
showPic();
|
showPic();
|
||||||
|
} else{
|
||||||
|
document.getElementById("movieFrame").style.display = "none";
|
||||||
|
document.getElementById("guessForm").style.display = "none";
|
||||||
|
document.getElementsByClassName("picButtons")[0].style.display="none";
|
||||||
|
document.getElementById("movieName").innerHTML = "<br><br>Thanks for playing!";
|
||||||
|
document.getElementById("feedback").innerHTML = "Horrordle will be back next October! <br><br> <a href='test'>follow me on twitter for updates</a><br><br> In the meantime you can go back and play <br> the days you've missed by visiting the <br> <a href='#stats'>archive page</a> on the top right and <br>clicking on the orange dates.";
|
||||||
|
}
|
||||||
|
|
||||||
// picButton = document.getElementsByClassName('picButton');
|
// picButton = document.getElementsByClassName('picButton');
|
||||||
// picButton.setAttribute('onclick','getImage()');
|
// picButton.setAttribute('onclick','getImage()');
|
||||||
@ -1268,18 +1327,21 @@ window.onload = deathOftheDay();
|
|||||||
document.getElementById("skipBonusGuess").style.display="none";
|
document.getElementById("skipBonusGuess").style.display="none";
|
||||||
document.getElementsByClassName("picButtons")[0].style.display="none";
|
document.getElementsByClassName("picButtons")[0].style.display="none";
|
||||||
showPic(movieOfTheDay[1])
|
showPic(movieOfTheDay[1])
|
||||||
console.log(buttonNo);
|
// console.log(buttonNo);
|
||||||
addData();
|
// addData();
|
||||||
}
|
}
|
||||||
|
setResult();
|
||||||
|
function setResult(){
|
||||||
if(!localStorage.getItem('result')){
|
if(!localStorage.getItem('result')){
|
||||||
textResult = "🔪";
|
textResult = "🔪";
|
||||||
}else{
|
}else{
|
||||||
textResult = localStorage.getItem('result');
|
textResult = localStorage.getItem('result');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
function checkGuess() {
|
function checkGuess() {
|
||||||
localStorage.setItem('playedBefore','true');
|
localStorage.setItem('playedBefore','true');
|
||||||
|
|
||||||
console.log("day count:" + dayCount);
|
// console.log("day count:" + dayCount);
|
||||||
let myGuess = guess
|
let myGuess = guess
|
||||||
|
|
||||||
if (myGuess === movieOfTheDay[0]) {
|
if (myGuess === movieOfTheDay[0]) {
|
||||||
@ -1289,8 +1351,9 @@ console.log("day count:" + dayCount);
|
|||||||
if(guessNo==2){localStorage.setItem('thirdGuessStat',parseInt(localStorage.getItem('thirdGuessStat')) + 1);}
|
if(guessNo==2){localStorage.setItem('thirdGuessStat',parseInt(localStorage.getItem('thirdGuessStat')) + 1);}
|
||||||
localStorage.setItem('streak',parseInt(localStorage.getItem('streak')) + 1);
|
localStorage.setItem('streak',parseInt(localStorage.getItem('streak')) + 1);
|
||||||
localStorage.setItem('day'+dayCount,'true');
|
localStorage.setItem('day'+dayCount,'true');
|
||||||
|
|
||||||
// document.getElementById("movieFrame").src = "images/"+movieOfTheDay+"/poster.jpg";
|
// document.getElementById("movieFrame").src = "images/"+movieOfTheDay+"/poster.jpg";
|
||||||
// console.log(localStorage.getItem('day'+dayCount));
|
console.log(localStorage.getItem('day'+dayCount));
|
||||||
streakNumber.textContent = localStorage.getItem('streak');
|
streakNumber.textContent = localStorage.getItem('streak');
|
||||||
document.getElementById("guessForm").style.display = "none";
|
document.getElementById("guessForm").style.display = "none";
|
||||||
document.getElementById("feedback").style.display = "none";
|
document.getElementById("feedback").style.display = "none";
|
||||||
@ -1313,14 +1376,14 @@ console.log("day count:" + dayCount);
|
|||||||
for (let i = 0; i < 3; i++) {
|
for (let i = 0; i < 3; i++) {
|
||||||
tempButton[i].classList.add("bonusScreen");
|
tempButton[i].classList.add("bonusScreen");
|
||||||
}
|
}
|
||||||
document.getElementsByClassName("imageButton")[0].style.fontSize = "32px";
|
// document.getElementsByClassName("imageButton")[0].style.fontSize = "32px";
|
||||||
localStorage.setItem("winningGuess", guess);
|
localStorage.setItem("winningGuess", guess);
|
||||||
localStorage.setItem("playedToday", "yes");
|
localStorage.setItem("playedToday", "yes");
|
||||||
document.getElementById("firstGuess").style.display = "none";
|
document.getElementById("firstGuess").style.display = "none";
|
||||||
document.getElementById("secondGuess").style.display = "none";
|
document.getElementById("secondGuess").style.display = "none";
|
||||||
|
|
||||||
|
|
||||||
dates[dayCount-1].classList.add('won');
|
dates[dayCount].classList.add('won');
|
||||||
revealButtons(2);
|
revealButtons(2);
|
||||||
|
|
||||||
} else if(guessNo==1){
|
} else if(guessNo==1){
|
||||||
@ -1411,7 +1474,7 @@ autoCompleteJS.input.addEventListener("selection", function (event) {
|
|||||||
guess = event.detail.selection.value
|
guess = event.detail.selection.value
|
||||||
autoCompleteJS.input.value = guess;
|
autoCompleteJS.input.value = guess;
|
||||||
// Console log autoComplete data feedback
|
// Console log autoComplete data feedback
|
||||||
console.log(event.detail.selection.value);
|
// console.log(event.detail.selection.value);
|
||||||
checkGuess();
|
checkGuess();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1425,14 +1488,46 @@ function copyToClipboard() {
|
|||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
function copyToClipboardCalendar() {
|
||||||
|
|
||||||
|
navigator.clipboard.writeText("Horrordle 2022: \n" + calendarResult + "").then(() => {
|
||||||
|
shareResultCalender.value = "copied!";
|
||||||
|
|
||||||
|
// Alert the user that the action took place.
|
||||||
|
// Nobody likes hidden stuff being done under the hood!
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function getArchive(j,d = dayCount){
|
function getArchive(j,d = dayCount){
|
||||||
|
for (var i = 0; i < dates.length; i++) {
|
||||||
|
dates[i].classList.remove('current');
|
||||||
|
}
|
||||||
|
present_date.setMonth(9,j);
|
||||||
|
// present_date.setDate(j);
|
||||||
|
console.log(present_date);
|
||||||
|
getReady();
|
||||||
|
var pix = [];
|
||||||
|
dayCounter();
|
||||||
|
markCalendar();
|
||||||
|
var points = "⬛⬛⬛"
|
||||||
|
firstCheck();
|
||||||
|
clearGuess();
|
||||||
|
revealButtons();
|
||||||
|
checkingGuess();
|
||||||
|
deathOftheDay();
|
||||||
|
setResult();
|
||||||
|
|
||||||
dates[d-1].classList.remove('current');
|
// dayCounter();
|
||||||
d = j;
|
// firstCheck();
|
||||||
dates[j-1].classList.add('current');
|
// revealButtons();
|
||||||
deathOftheDay(j);
|
// clearGuess();
|
||||||
document.getElementById('guess').value = "";
|
|
||||||
|
// dates[d-1].classList.remove('current');
|
||||||
|
// d = j;
|
||||||
|
// dates[j-1].classList.add('current');
|
||||||
|
// deathOftheDay(j);
|
||||||
|
// document.getElementById('guess').value = "";
|
||||||
location.href='#';
|
location.href='#';
|
||||||
//window.open("#");
|
//window.open("#");
|
||||||
}
|
}
|
||||||
@ -1477,45 +1572,45 @@ const config = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var x = setInterval(function() {
|
// var x = setInterval(function() {
|
||||||
// countDownTime.setDate(Math.floor((present_date - gameBeginning) / (1000 * 60 * 60 * 24))+2);
|
// // countDownTime.setDate(Math.floor((present_date - gameBeginning) / (1000 * 60 * 60 * 24))+2);
|
||||||
dayCounter();
|
// dayCounter();
|
||||||
|
|
||||||
dateVariable = present_date.getDate()
|
// dateVariable = present_date.getDate()
|
||||||
countDownTime.setDate(dateVariable+1);
|
// countDownTime.setDate(dateVariable+1);
|
||||||
countDownTime.setHours(0);
|
// countDownTime.setHours(0);
|
||||||
countDownTime.setMinutes(0);
|
// countDownTime.setMinutes(0);
|
||||||
countDownTime.setSeconds(0);
|
// countDownTime.setSeconds(0);
|
||||||
var now = new Date();
|
// var now = new Date();
|
||||||
// console.log("now: ",now);
|
// // console.log("now: ",now);
|
||||||
var remainingTime = countDownTime - now;
|
// var remainingTime = countDownTime - now;
|
||||||
const second = 1000;
|
// const second = 1000;
|
||||||
const minute = second * 60;
|
// const minute = second * 60;
|
||||||
const hour = minute * 60;
|
// const hour = minute * 60;
|
||||||
const day = hour * 24;
|
// const day = hour * 24;
|
||||||
hoursLeft = Math.trunc((remainingTime % day) / hour);
|
// hoursLeft = Math.trunc((remainingTime % day) / hour);
|
||||||
minutesLeft = Math.trunc((remainingTime % hour) / minute);
|
// minutesLeft = Math.trunc((remainingTime % hour) / minute);
|
||||||
secondsLeft = Math.trunc((remainingTime % minute) / second);
|
// secondsLeft = Math.trunc((remainingTime % minute) / second);
|
||||||
document.getElementById("countDown").innerHTML = hoursLeft + "h "
|
// document.getElementById("countDown").innerHTML = hoursLeft + "h "
|
||||||
+ minutesLeft + "m " + secondsLeft + "s ";
|
// + minutesLeft + "m " + secondsLeft + "s ";
|
||||||
//console.log(remainingTime);
|
// //console.log(remainingTime);
|
||||||
// console.log(localStorage.getItem('day'));
|
// // console.log(localStorage.getItem('day'));
|
||||||
// console.log("day count: " + dayCount);
|
// // console.log("day count: " + dayCount);
|
||||||
dayCount = Math.floor((now - gameBeginning) / (1000 * 60 * 60 * 24));
|
// dayCount = Math.floor((now - gameBeginning) / (1000 * 60 * 60 * 24));
|
||||||
if (localStorage.getItem('day')!=dayCount) {
|
// if (localStorage.getItem('day')!=dayCount) {
|
||||||
window.location.reload();
|
// // window.location.reload();
|
||||||
}
|
// }
|
||||||
}, 1000);
|
// }, 1000);
|
||||||
function addData(){
|
// function addData(){
|
||||||
myChart.data.datasets[0].data[0] = localStorage.getItem('firstGuessStat');
|
// myChart.data.datasets[0].data[0] = localStorage.getItem('firstGuessStat');
|
||||||
myChart.data.datasets[0].data[1] = localStorage.getItem('secondGuessStat');
|
// myChart.data.datasets[0].data[1] = localStorage.getItem('secondGuessStat');
|
||||||
myChart.data.datasets[0].data[2] = localStorage.getItem('thirdGuessStat');
|
// myChart.data.datasets[0].data[2] = localStorage.getItem('thirdGuessStat');
|
||||||
myChart.update();
|
// myChart.update();
|
||||||
}
|
// }
|
||||||
const myChart = new Chart(
|
// const myChart = new Chart(
|
||||||
document.getElementById('myChart'),
|
// document.getElementById('myChart'),
|
||||||
config
|
// config
|
||||||
);
|
// );
|
||||||
function preloadImage(url)
|
function preloadImage(url)
|
||||||
{
|
{
|
||||||
var img=new Image();
|
var img=new Image();
|
||||||
@ -1528,4 +1623,10 @@ function resetFunction() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function remember(){
|
||||||
|
localStorage.setItem('archiveButtonPressed','true');
|
||||||
|
document.getElementsByClassName("gif")[0].style.display="none";
|
||||||
|
}
|
||||||
|
|
||||||
//window.localStorage.clear();
|
//window.localStorage.clear();
|
18
style.css
18
style.css
@ -26,6 +26,16 @@
|
|||||||
font-size: 1.5em;
|
font-size: 1.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.gif{
|
||||||
|
transform:rotate(60deg);
|
||||||
|
width: 35px;
|
||||||
|
margin-left: 5px;
|
||||||
|
top:2px;
|
||||||
|
padding-right: 5px;
|
||||||
|
position:absolute;
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
|
|
||||||
.resultImage{
|
.resultImage{
|
||||||
/* padding-right: 8px; */
|
/* padding-right: 8px; */
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -413,6 +423,14 @@ i{
|
|||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#shareResultCalender{
|
||||||
|
background-color: green;
|
||||||
|
margin-top: 20px;
|
||||||
|
bottom: 5px;
|
||||||
|
display:block;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
#countDown{
|
#countDown{
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user