Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
v3.0.6
  • Loading branch information
Gurge44 committed Jul 18, 2023
1 parent 086f6c4 commit 9c99a23
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 20 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ <h1 id="title">Customized Wordle</h1>
<p id="animationsLine"><label><input type="checkbox" name="animations" id="animations" checked>Enable Animations</label></p>
<p id="numOfGuesses" title="Changing this value automatically restarts the game and generates a new word to guess.">Number of Guesses: <input type="number" name="numOfGuessesType" id="numOfGuessesType" min="1" max="20" value="9" class="input"></p>
<p id="wordLength" title="Changing this value automatically restarts the game and generates a new word to guess.">Word Length: <input type="number" name="wordLengthInput" id="wordLengthInput" min="3" max="16" value="5" class="input"> <span id="tooFewWords" hidden title="The database is a bit weak of words in the length you chose. Some valid words may not be accepted.">⚠️</span></p>
<p id="squareFontLine"><label><input type="checkbox" name="squareFont" id="squareFont" checked>Square Font for Timers</label></p>
<p id="squareFontLine"><label><input type="checkbox" name="squareFont" id="squareFont">Square Font for Timers</label></p>
</div>
<div id="main" hidden>
<h2 style="color: rgb(0, 255, 200);" id="h2title">Color customization</h2>
Expand Down
102 changes: 83 additions & 19 deletions script.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
document.getElementById("error").innerHTML = "Loading....";
let version = "v3.0.5";
let version = "v3.0.6";
document.getElementById("title").innerText = "Customized Wordle " + version;
toastr.options.progressBar = true;

Expand Down Expand Up @@ -133,7 +133,7 @@ function changeWordLength() {
document.getElementById("tooFewWords").hidden = true;
} else if (wordLength === 3) {
rightGuessString = THREELETTERWORDS[Math.floor(Math.random() * THREELETTERWORDS.length)]
document.getElementById("tooFewWords").hidden = false;
document.getElementById("tooFewWords").hidden = true;
} else if (wordLength === 4) {
rightGuessString = FOURLETTERWORDS[Math.floor(Math.random() * FOURLETTERWORDS.length)]
document.getElementById("tooFewWords").hidden = true;
Expand Down Expand Up @@ -208,7 +208,7 @@ function changeNumOfGuesses() {
document.getElementById("tooFewWords").hidden = true;
} else if (wordLength === 3) {
rightGuessString = THREELETTERWORDS[Math.floor(Math.random() * THREELETTERWORDS.length)]
document.getElementById("tooFewWords").hidden = false;
document.getElementById("tooFewWords").hidden = true;
} else if (wordLength === 4) {
rightGuessString = FOURLETTERWORDS[Math.floor(Math.random() * FOURLETTERWORDS.length)]
document.getElementById("tooFewWords").hidden = true;
Expand Down Expand Up @@ -309,13 +309,19 @@ function startMainTimer() {
if (yellowTimeBonus < 0) {yellowTimeBonus = 0}
if (greyTimePenalty < 0) {greyTimePenalty = 0}
var totalSecondsLeftDisplay = totalSecondsLeft;
var totalMinutesLeftDisplay = totalMinutesLeft;
if (totalSecondsLeft < 10) {
totalSecondsLeftDisplay = "0" + totalSecondsLeft;
} else {
totalSecondsLeftDisplay = totalSecondsLeft;
}
if (totalMinutesLeft < 10) {
totalMinutesLeftDisplay = "0" + totalMinutesLeft;
} else {
totalMinutesLeftDisplay = totalMinutesLeft;
}
document.getElementById("mainTimerDisplay").style.color = document.getElementById("letterColor").value;
document.getElementById("mainTimer").innerHTML = totalMinutesLeft + ":" + totalSecondsLeftDisplay;
document.getElementById("mainTimer").innerHTML = "<nobr>Good Luck!</nobr>";
document.getElementById("mainTimerDisplay").hidden = false;
var outputWarn = true;

Expand Down Expand Up @@ -345,6 +351,11 @@ function startMainTimer() {
} else {
totalSecondsLeftDisplay = totalSecondsLeft;
}
if (totalMinutesLeft < 10) {
totalMinutesLeftDisplay = "0" + totalMinutesLeft;
} else {
totalMinutesLeftDisplay = totalMinutesLeft;
}
if (isSquare) {
if (totalSecondsLeft <= 19 && totalSecondsLeft >= 10) {
pull = 8;
Expand Down Expand Up @@ -383,7 +394,7 @@ function startMainTimer() {
mainTimerRunning = false;
cancel3 = true;
}
document.getElementById("mainTimer").innerHTML = "<nobr><span style='margin-left: " + pull3 + "px; letter-spacing: " + pull4 + "px;'>" + totalMinutesLeft + "</span>:<span style='margin-left: " + pull + "px; letter-spacing: " + pull2 + "px;'>" + totalSecondsLeftDisplay + "</span></nobr>";
document.getElementById("mainTimer").innerHTML = "<nobr><span style='margin-left: " + pull3 + "px; letter-spacing: " + pull4 + "px;'>" + totalMinutesLeftDisplay + "</span>:<span style='margin-left: " + pull + "px; letter-spacing: " + pull2 + "px;'>" + totalSecondsLeftDisplay + "</span></nobr>";
}
}, 1000);
}
Expand All @@ -399,13 +410,19 @@ function startPerGuessTimer() {
fixTimeToGuessMinutes = timeToGuessMinutes;
fixTimeToGuessSeconds = timeToGuessSeconds;
var timeToGuessSecondsDisplay = timeToGuessSeconds;
var timeToGuessMinutesDisplay = timeToGuessMinutes;
if (timeToGuessSeconds < 10) {
timeToGuessSecondsDisplay = "0" + timeToGuessSeconds;
} else {
timeToGuessSecondsDisplay = timeToGuessSeconds;
}
if (timeToGuessMinutes < 10) {
timeToGuessMinutesDisplay = "0" + timeToGuessMinutes;
} else {
timeToGuessMinutesDisplay = timeToGuessMinutes;
}
document.getElementById("per-GuessTimerDisplay").style.color = document.getElementById("letterColor").value;
document.getElementById("per-GuessTimer").innerHTML = timeToGuessMinutes + ":" + timeToGuessSecondsDisplay;
document.getElementById("per-GuessTimer").innerHTML = "<nobr>Good Luck!</nobr>";
document.getElementById("per-GuessTimerDisplay").hidden = false;

var timer3 = setInterval(function() {
Expand All @@ -421,11 +438,42 @@ function startPerGuessTimer() {
timeToGuessSeconds = 60;
}
timeToGuessSeconds -= 1;
var pull = 0;
var pull2 = 0;
var pull3 = 0;
var pull4 = 0;
if (timeToGuessSeconds < 10) {
timeToGuessSecondsDisplay = "0" + timeToGuessSeconds;
} else {
timeToGuessSecondsDisplay = timeToGuessSeconds;
}
if (timeToGuessMinutes < 10) {
timeToGuessMinutesDisplay = "0" + timeToGuessMinutes;
} else {
timeToGuessMinutesDisplay = timeToGuessMinutes;
}
if (isSquare) {
if (timeToGuessSeconds <= 19 && timeToGuessSeconds >= 10) {
pull = 8;
} else {
pull = 0;
}
if (timeToGuessSeconds % 10 === 1) {
pull2 = 10;
} else {
pull2 = 3;
}
if (timeToGuessMinutes <= 19 && timeToGuessMinutes >= 10) {
pull3 = 8;
} else {
pull3 = 0;
}
if (timeToGuessMinutes % 10 === 1) {
pull4 = 10;
} else {
pull4 = 3;
}
}
if (timeToGuessSeconds <= 10 && timeToGuessMinutes <= 0) {
document.getElementById("per-GuessTimerDisplay").style.color = timerWarningColor;
}
Expand All @@ -439,7 +487,7 @@ function startPerGuessTimer() {
hideMainTimer = false;
cancel2 = true;
}
document.getElementById("per-GuessTimer").innerHTML = timeToGuessMinutes + ":" + timeToGuessSecondsDisplay;
document.getElementById("per-GuessTimer").innerHTML = "<nobr><span style='margin-left: " + pull3 + "px; letter-spacing: " + pull4 + "px;'>" + timeToGuessMinutesDisplay + "</span>:<span style='margin-left: " + pull + "px; letter-spacing: " + pull2 + "px;'>" + timeToGuessSecondsDisplay + "</span></nobr>";
}
}, 1000);
}
Expand Down Expand Up @@ -596,12 +644,18 @@ function checkGuess() {
timeToGuessMinutes = fixTimeToGuessMinutes;
timeToGuessSeconds = fixTimeToGuessSeconds;
var timeToGuessSecondsDisplay = timeToGuessSeconds;
var timeToGuessMinutesDisplay = timeToGuessMinutes;
if (timeToGuessSeconds < 10) {
timeToGuessSecondsDisplay = "0" + timeToGuessSeconds;
} else {
timeToGuessSecondsDisplay = timeToGuessSeconds;
}
document.getElementById("per-GuessTimer").innerHTML = timeToGuessMinutes + ":" + timeToGuessSecondsDisplay;
if (timeToGuessMinutes < 10) {
timeToGuessMinutesDisplay = "0" + timeToGuessMinutes;
} else {
timeToGuessMinutesDisplay = timeToGuessMinutes;
}
document.getElementById("per-GuessTimer").innerHTML = timeToGuessMinutesDisplay + ":" + timeToGuessSecondsDisplay;

if (document.getElementById("enableLogging").checked) {
console.log("---------------- NEW GUESS ----------------");
Expand Down Expand Up @@ -797,7 +851,10 @@ function checkGuess() {
if (document.getElementById("autoRestart").checked) {
autoRestart();
}
return
setTimeout(() => {
isGuessCheckInProgress = false;
}, 200)
return;
} else {
guessesRemaining -= 1;
currentGuess = [];
Expand All @@ -814,7 +871,9 @@ function checkGuess() {
toastr.info(`The right word was: "${rightGuessString}"`);
}
}
isGuessCheckInProgress = false;
setTimeout(() => {
isGuessCheckInProgress = false;
}, 200)
}

function delay(milliseconds) {
Expand Down Expand Up @@ -948,30 +1007,35 @@ function cancelAutoRestart() {

document.querySelector('#cancel').addEventListener("click", () => cancelAutoRestart());

function restart() {
async function restart() {
if (guessesRemaining === NUMBER_OF_GUESSES) {
return;
}
if (isGuessCheckInProgress) {
setTimeout(() => {
restart();
}, 100);
return;
}
if (onCooldown) {
if (restartInQueue) {
return;
} else {
restartInQueue = true;
toastr.warning("Restart will happen after the animations are done.")
setTimeout(() => {
restart();
onCooldown = false;
restartInQueue = false;
restart();
}, 350 * wordLength + 3500);
return;
}
}
await delay(150);
if (isGuessCheckInProgress && guessesRemaining != 0) {
return;
}
if (guessesRemaining === 0 && isGuessCheckInProgress) {
toastr.warning("Restarting in 10 seconds");
setTimeout(() => {
restart();
}, 10000);
return;
}
document.getElementById("error").innerHTML = "Loading....";
var input = document.getElementById("numOfGuessesType").value;
if (input <= 0 || input === "") {
Expand Down Expand Up @@ -1001,7 +1065,7 @@ function restart() {
document.getElementById("tooFewWords").hidden = true;
} else if (wordLength === 3) {
rightGuessString = THREELETTERWORDS[Math.floor(Math.random() * THREELETTERWORDS.length)]
document.getElementById("tooFewWords").hidden = false;
document.getElementById("tooFewWords").hidden = true;
} else if (wordLength === 4) {
rightGuessString = FOURLETTERWORDS[Math.floor(Math.random() * FOURLETTERWORDS.length)]
document.getElementById("tooFewWords").hidden = true;
Expand Down
2 changes: 2 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,8 @@ input[type=color] {
font-size: 30px;
letter-spacing: 2px;
width: 70px;
min-width: 70px;
max-width: 70px;
}

#openDebugOptions {
Expand Down

0 comments on commit 9c99a23

Please sign in to comment.