let wordList = ["juicy","power","kanye","chris","brown","juelz","sauce","money","cardi","racks","lewis","migos","bruno","glory","loyal","wayne","lamar","bling","drake","young","flava","freak","megan","gucci","quavo","logic","tiara","tpain","geazy","snoop","nasir","storm","belly","shaft","fresh","bones","crips","crash","drugs","bitch","truth","hurts","bodak","boner","scott","sicko","kills","crack","pussy","world","human","lyric","jason","shade","beats","style","rhyme","flows","dripp","grind","fiend","ghost","miami","flint","akron","tampa","brick","pound","jails","trick","bronx","vegas","jcole","beast","rocky","views","astro","flame","dirty","pablo","danny","xxxxx","tyler","music","group","death","after","rocks","stuss","pelle","gunit","kappa","dopey"];
let height = 6;
let row = 0;
let col = 0;
let gameOver = false;
let correctGuess = false;
const offsetFromDate = new Date(2023,0,1);
const msOffset = Date.now() - offsetFromDate;
const dayOffset = msOffset / 1000 / 60 / 60 / 24;
const word = wordList[Math.floor(dayOffset)];
console.log(word);
let todayPlayed = {};
let allTimeGamePlayed = [];
let todayplayeddone = false;
let dateTime = new Date();
let currentYear = dateTime.getFullYear();
let currentMonth = dateTime.getMonth();
let currentDate = dateTime.getDate();
if(currentMonth < 10)
currentMonth = "0"+currentMonth;
if(currentDate < 10)
currentDate = "0"+currentDate;
let todayDate = currentYear+"-"+currentMonth+"-"+currentDate;
window.onload = function() {
intializeEnglish();
}
function copyToClipBoard()
{
hidePlayed();
let todayWordlePlayed = JSON.parse(localStorage.getItem("todayWordlePlayed"));
if(todayWordlePlayed != null)
{
for(let d = 0; d < todayWordlePlayed.length; d++)
{
if(todayWordlePlayed[d]["date"] == todayDate)
{
let copyScore = "Wordle "+todayWordlePlayed[d]["todayWordle"]+" Score : "+todayWordlePlayed[d]["score"]+"/6";
navigator.clipboard.writeText(copyScore);
let messageBox = document.getElementById("message-box");
messageBox.textContent = "Score copied!";
messageBox.style.display = "flex";
setTimeout(() => {
messageBox.style.display = "none";
}, 2000);
break;
}
}
}
}
function checkTodayPlayed()
{
let todayWordlePlayed = JSON.parse(localStorage.getItem("todayWordlePlayed"));
if(todayWordlePlayed != null)
{
for(let d = 0; d < todayWordlePlayed.length; d++)
{
if(todayWordlePlayed[d]["date"] == todayDate)
{
todayplayeddone = true;
for(let h = 0; h < todayWordlePlayed[d]["guesses"].length; h++)
{
for (let r = 0; r < 5; r++)
{
document.getElementById(h+"-"+r).innerHTML = todayWordlePlayed[d]["guesses"][h][r];
if(todayWordlePlayed[d]["letterAPC"][h][r] == "A")
document.getElementById(h+"-"+r).classList.add("absent");
else if(todayWordlePlayed[d]["letterAPC"][h][r] == "P")
document.getElementById(h+"-"+r).classList.add("present");
else if(todayWordlePlayed[d]["letterAPC"][h][r] == "C")
document.getElementById(h+"-"+r).classList.add("correct");
}
}
let keys = document.querySelectorAll(".key-tile");
for(let k = 0; k < keys.length; k++)
{
keys[k].style.cursor = "default";
keys[k].style.pointerEvents = "none";
}
document.querySelector(".enter-key-tile").style.cursor = "default";
document.querySelector(".enter-key-tile").style.pointerEvents = "none";
document.getElementById("played").style.display = "block";
document.getElementById("todayWordle").style.display = "inline-block";
document.getElementById("todayWordle").innerHTML = todayWordlePlayed[d]["todayWordle"];
document.getElementById("yourScore").innerHTML = todayWordlePlayed[d]["score"]+"/6";
break;
}
}
}
}
function intializeEnglish()
{
width = word.length;
for (let r = 0; r < height; r++) {
for (let c = 0; c < width; c++) {
let tile = document.createElement("span");
tile.id = r.toString() + "-" + c.toString();
tile.classList.add("tile");
tile.innerText = "";
document.getElementById("board").appendChild(tile);
}
}
let x = 60 * width;
document.getElementById("board").style.width = x + "px";
let keyboard = [
["Q","W","E","R","T","Y","U","I","O","P"],
["A","S","D","F","G","H","J","K","L"],
["ENT","Z","X","C","V","B","N","M","⌫"]];
for (let i = 0; i < keyboard.length; i++)
{
let currRow = keyboard[i];
let keyboardRow = document.createElement("div");
keyboardRow.classList.add("keyboard-row");
for (let j = 0; j < currRow.length; j++)
{
let keyTile = document.createElement("div");
let key = currRow[j];
keyTile.innerText = key;
if (key == "ENT") {
keyTile.id = "Enter";
}
else if (key == "⌫") {
keyTile.id = "Backspace";
}
else if ("A" <= key && key <= "Z") {
keyTile.id ="Key" + key;
}
keyTile.addEventListener("click", processKey);
if (key == "ENT") {
keyTile.classList.add("enter-key-tile");
} else {
keyTile.classList.add("key-tile");
}
if (key == "⌫") {
keyTile.classList.add("key-tile");
keyTile.innerText = String.fromCharCode(9003);
}
keyboardRow.appendChild(keyTile);
}
document.getElementById("keyboard").appendChild(keyboardRow);
}
checkTodayPlayed();
document.addEventListener("keyup",function(e){
processInput(e);
});
}
function saveToLocalStorage()
{
todayWordleGamePlayed = JSON.parse(localStorage.getItem("todayWordlePlayed"));
if(todayWordleGamePlayed == null)
{
todayPlayed.date = currentYear+"-"+currentMonth+"-"+currentDate;
todayPlayed.word = word;
todayPlayed.guesses = typedWords;
todayPlayed.letterAPC = allGuesses;
todayPlayed.todayWordle = wordList.indexOf(word)+1;
if(correctGuess == true)
todayPlayed.score = allGuesses.length;
else
todayPlayed.score = "X";
allTimeGamePlayed.push(todayPlayed);
localStorage.setItem("todayWordlePlayed", JSON.stringify(allTimeGamePlayed));
}
else
{
todayPlayed.date = currentYear+"-"+currentMonth+"-"+currentDate;
todayPlayed.word = word;
todayPlayed.guesses = typedWords;
todayPlayed.letterAPC = allGuesses;
todayPlayed.todayWordle = wordList.indexOf(word)+1;
if(correctGuess == true)
todayPlayed.score = allGuesses.length;
else
todayPlayed.score = "X";
todayWordleGamePlayed.push(todayPlayed);
localStorage.setItem("todayWordlePlayed", JSON.stringify(todayWordleGamePlayed));
}
document.getElementById("played").style.display = "block";
document.getElementById("todayWordle").style.display = "inline-block";
document.getElementById("todayWordle").innerHTML = wordList.indexOf(word)+1;
if(correctGuess == true)
document.getElementById("yourScore").innerHTML = allGuesses.length+"/6";
else
document.getElementById("yourScore").innerHTML = "X/6";
}
function processKey()
{
let e = {"code" : this.id};
processInput(e);
}
let typedWords = [];
let enteredWord="";
function processInput(e)
{
if (gameOver) return;
if ("KeyA" <= e.code && e.code <= "KeyZ")
{
if (col < width)
{
let currTile = document.getElementById(row.toString() + '-' + col.toString());
if (currTile.innerText == "" && currTile.dataset.disabled != "yes")
{
currTile.innerText = e.code[3];
enteredWord = enteredWord + e.code[3];
col += 1;
}
}
}
else if (e.code == "Backspace")
{
if (0 < col && col <= width)
{
col -= 1;
enteredWord = enteredWord.slice(0, -1);
}
let currTile = document.getElementById(row.toString() + '-' + col.toString());
currTile.innerText = "";
}
else if (e.code =="Enter" && col == width)
{
if (wordList.includes(enteredWord.toLowerCase()))
{
typedWords.push(enteredWord);
update();
enteredWord = "";
}
else if (!wordList.includes(enteredWord.toLowerCase()))
{
let messageBox = document.getElementById("message-box");
messageBox.textContent = "Not in word list!";
messageBox.style.display = "flex";
setTimeout(() => {
messageBox.style.display = "none";
}, 5000);
}
}
if(!gameOver && row == height)
{
gameOver = true;
messageBox = document.getElementById("message-box");
messageBox.textContent = "Almost! Good luck next time!\n Correct Word is :"+word;
messageBox.style.display = "flex";
setTimeout(() => {
messageBox.style.display = "none";
saveToLocalStorage();
}, 3000);
let currentWordIndex = parseInt(localStorage.getItem('currentWordIndex'));
currentWordIndex--;
localStorage.setItem('currentWordIndex', currentWordIndex.toString());
}
}
let result = [];
function check(input, wordle)
{
const letters = Array.from(input.toUpperCase()),
word = Array.from(wordle.toUpperCase());
result = Array(5).fill('');
for (let i = 0; i < 5; i++)
{
if (letters[i] === word[i])
{
result[i] = 'green',
word[i] = '';
letters[i] = '';
}
}
for (let i = 0; i < 5; i++)
{
if (!letters[i]) continue;
const index = word.indexOf(letters[i]);
if (index !== -1)
{
result[i] = 'yellow',
word[index] = '';
}
}
return result;
}
let allGuesses = [];
let typedLetters = "";
function update()
{
let guess = "";
for(let c = 0; c < width; c++)
{
let currTile = document.getElementById(row.toString() + "-" + c.toString());
currTile.style.color = "white";
let letter = currTile.innerText;
guess += letter;
}
guess = guess.toLowerCase();
check(guess,word);
let correct = 0;
let letterCount = {};
for (let i = 0; i < word.length; i++)
{
letter = word[i];
if (letterCount[letter])
letterCount[letter] += 1;
else
letterCount[letter] = 1;
}
for(let c= 0; c < width; c++)
{
let currTile = document.getElementById(row.toString() + '-' + c.toString());
let letter = currTile.innerText;
if(result[c] == "green")
{
currTile.classList.add("correct");
let keyTile = document.getElementById("Key" + letter);
keyTile.classList.remove("present");
keyTile.classList.add("correct");
correct += 1;
letterCount[letter] -= 1;
if(correct == width) {
gameOver = true;
correctGuess = true;
let messageBox = document.getElementById("message-box");
messageBox.textContent = "You did it! Great Job!";
messageBox.style.display = "flex";
setTimeout(() => {
messageBox.style.display = "none";
saveToLocalStorage();
}, 3000);
}
}
}
typedLetters = "";
for (let c= 0; c < width; c++)
{
let currTile = document.getElementById(row.toString() + '-' + c.toString());
let letter = currTile.innerText.toLowerCase();
if(!currTile.classList.contains("correct"))
{
if(result[c] == "yellow" && letterCount[letter] > 0)
{
typedLetters += "P";
currTile.classList.add("present");
let keyTile = document.getElementById("Key" + letter.toUpperCase());
if(!keyTile.classList.contains("correct"))
keyTile.classList.add("present");
letterCount[letter] -= 1;
}
else
{
typedLetters += "A";
currTile.classList.add("absent");
let keyTile = document.getElementById("Key" + letter.toUpperCase());
if(keyTile.classList.contains("correct"))
continue;
else
keyTile.classList.add("absent");
}
}
else
typedLetters += "C";
}
allGuesses.push(typedLetters);
row += 1;
col = 0;
result = [];
}
function hidePlayed()
{
document.getElementById("played").style.display = "none";
document.querySelectorAll(".tile").forEach(tile => {
tile.dataset.disabled = "yes";
});
document.querySelectorAll(".key-tile").forEach(keytile => {
keytile.style.cursor = "default";
keytile.style.pointerEvents = "none";
});
document.querySelector(".enter-key-tile").style.cursor = "default";
document.querySelector(".enter-key-tile").style.pointerEvents = "none";
}
document.getElementById("hidePlayed").addEventListener("click", function() {
hidePlayed();
});
If you are using the jQuery library, then don't forget to wrap your code inside jQuery.ready() as follows:
jQuery(document).ready(function( $ ){
// body
{
font-family: Helvetica, sans-serif;
text-align: center;
margin: 0 auto;
color: #000;
}
h1
{
height: 100%;
margin: 0 auto;
border: 30px solid transparent;
}
#board
{
height: 350px;
margin: 0 auto 20px;
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.tile
{
border: 2px solid rgb(65, 65, 65);
width: 50px;
height: 50px;
margin: 2.5px;
font-size: 30px;
font-weight: bold;
display: flex;
justify-content: center;
align-items: center;
background-color: transparent;
}
.tile.correct
{
background-color: green;
color: white;
border-color: white;
}
.tile.present
{
background-color: rgb(211, 211, 0);
color: white;
border-color: white;
}
.tile.absent
{
background-color: #4b4b4b;
color: white;
border-color: white;
}
.keyboard-row
{
width: 440px;
height: 70px;
margin: 0 auto;
display: flex;
flex-wrap: wrap;
background-color: transparent;
justify-content: center;
align-items: center;
}
.key-tile
{
border: 1px solid rgb(65,65,65);
width: 30px;
height: 45px;
margin: 3px;
border-radius: 5px;
cursor: pointer;
background-color: transparent;
font-size: 20px;
font-weight: bold;
display: flex;
justify-content: center;
align-items: center;
color: rgb(65,65,65);
}
.key-tile.present
{
color: #fff;
background: rgb(211,211,0);
}
.key-tile.absent
{
color: #fff;
background: rgb(75,75,75);
}
.key-tile.correct
{
color: #fff;
background: green;
}
.enter-key-tile
{
border: 1px solid rgb(65,65,65);
width: 60px;
height: 45px;
margin: 3px;
border-radius: 5px;
cursor: pointer;
background-color: transparent;
font-size: 20px;
font-weight: bold;
display: flex;
justify-content: center;
align-items: center;
color: rgb(65,65,65);
}
#message-box
{
display: none;
z-index: 99;
position: absolute;
left: 50%;
top: 30%;
transform: translate(-50%,-50%);
justify-content: center;
align-items: center;
background-color: white;
height: 100px;
width: 350px;
border: 1px solid #000;
border-radius: 20px;
opacity: 1;
transition: opacity 1s ease-in-out;
animation: fade-out 2s 1s forwards;
}
#shareScore
{
display: none;
}
.shareScoreBtn
{
background: green;
color: #fff;
cursor: pointer;
font-size: 30px;
font-weight: bold;
padding: 5px 10px;
border: none;
margin: 10px 0 20px;
}
@keyframes fade-out {
from {
opacity: 1;
}
to {
opacity: 0;
}
}
#settings-button
{
height: 50px;
width: 50px;
position: absolute;
top: 20px;
right: 20px;
cursor: pointer;
color: #000;
background-color: transparent;
font-size: 35px;
border-radius: 30px;
border: transparent;
}
#settings-button:active
{
font-size: 32px;
}
.letters
{
width: 50px;
height: 50px;
}
.pLetter
{
background: rgb(211, 211, 0);
}
.cLetter
{
background: green;
}
.aLetter
{
background: #4b4b4b;
}
.played
{
display: none;
position: absolute;
box-sizing: border-box;
padding: 6% 20px;
margin: 0 auto 0 -25%;
width: 50%;
top: 15%;
left: 50%;
color: #000;
background: #efefef;
border-radius: 5px;
text-align: center;
}
.played h1
{
color: #000;
}
#hidePlayed
{
position: absolute;
top: 20px;
right: 20px;
background: none;
border-radius: 5px;
padding: 5px 6px;
font-size: 24px;
color: #000;
border: none;
cursor: pointer;
opacity: 0.5;
font-weight: bold;
}
@media only screen and (max-width: 450px)
{
#title
{
font-size: 30px;
}
#settings-button
{
width: 40px;
height: 40px;
}
.keyboard-row
{
width: 100%;
}
.key-tile
{
width: 32px;
height: 40px;
font-size: 20px;
}
.enter-key-tile
{
width: 70px;
height: 40px;
font-size: 20px;
}
.played
{
width: 96%;
left: 2%;
margin: 0;
min-height: 600px;
padding: 6% 5px;
}
.played h1
{
font-size: 24px;
}
}
@media only screen and (max-width: 400px)
{
#title
{
font-size: 24px;
}
.key-tile
{
width: 30px;
height: 40px;
font-size: 20px;
}
.enter-key-tile
{
width: 66px;
font-size: 20px;
}
}
@media only screen and (max-width: 390px)
{
.key-tile
{
width: 28px;
height: 40px;
font-size: 18px;
}
.enter-key-tile
{
width: 64px;
height: 40px;
font-size: 18px;
}
}
});
--
If you want to link a JavaScript file that resides on another server (similar to
), then please use
the
The Hip Hop Wordle
The Hip Hop Wordle
The Hip Hop Wordle
Your Score :
Thanks for playing today!
Come back tomorrow to play again!
page, as this is a HTML code that links a JavaScript file.
End of comment */
Skip to content
Click here to watch the video
“Imagine” remix by Songplux featuring Omah Lay, Cardi B & Lil Wayne My Spotify playlist https://open.spotify.com/playlist/2Z3… Stream This Song: https://omahlay.lnk.to/BoyAloneDeluxe Beat by Sawn Temple Global / @sawntemple Buy This Beat Beat Store: https://www.beatstars.com/sawntemple Follow Songplux: Instagram: http://instagram.com/songplux TikTok: https://tiktok.com/songplux Facebook: https://facebook.com/songplux Twitter: https://twitter.com/songplux 📧 E-mail ⇾ songplux@gmail.com Song Tag: omah lay, cardi b, lil wayne, asake, burna boy, shallipopi, olamide, rema, ayra starr, khaid, kizz daniel, seyi vibez, tems, odumodublvck, Joeboy, Victon, BNXN, iyanya, tekno, young John, adekunle gold, naira marley, zinoleesky, fireboy dml, pheelz, ruger, reekado banks, davido, wizkid, afrobeats