https://www.googletagmanager.com/gtag/js?id=G-64MBDNFME4
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag(‘js’, new Date());
gtag(‘config’, ‘G-64MBDNFME4’);
https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4101278535595097
https://cdn.jsdelivr.net/npm/canvas-confetti@1.3.3
Wherele – Guess the Country
body {
background-color: white;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: center;
height: 150vh;
margin: 0;
}
img {
max-width: 100%;
height: auto;
}
h1 {
font-family: Arial, sans-serif;
font-size: 36px;
color: black;
position: relative;
display: inline-block;
margin-top: 10px;
}
.green-text {
font-weight: bold;
color: green;
}
.underline {
position: absolute;
bottom: 0;
left: 0;
right: 0;
border-bottom: 2px solid black;
}
.image-container {
width: 350px;
height: 250px;
overflow: hidden;
border-radius: 20px;
/*width: 70%;*/
}
.image-container img {
width: 100%;
height: 100%;
object-fit: cover;
/*top: 50%;
left: 50%;
right: 50%;
transform: translate(-20%, -20%);*/
}
.text-field-container {
display: flex;
align-items: center;
flex-direction: column; /* Align elements vertically */
position: relative; /* Required for relative positioning of suggestions */
margin-bottom: 0px;
width: 350px;
}
.text-input-group {
display: flex;
align-items: center;
width: 351px; /* Full width for both input and button */
margin-bottom: 0;
position: relative;
}
.text-field {
flex: 1; /* Allow the text field to grow to fill the available space */
padding: 10px;
margin: 10px 0;
border: 1px solid #ccc;
border-radius: 5px;
margin-bottom: 0px;
margin-right: 5px;
font-size: 16px;
height: 14px;
}
.submit-button {
padding: 5px 10px;
height: 36px; /* This sets the height of the button */
margin: 10px 0;
border: 1px solid #b9c9ff;
border-radius: 5px;
background-color: #007bff;
text-align: center;
color: white;
cursor: pointer;
font-size: 18px; /* This line sets the font size to 16px */
margin-bottom: 0px;
margin-right: 0px
}
.suggestions {
width: 100%; /* Same width as the text input */
max-height: 150px; /* Set a maximum height for the suggestions */
overflow-y: auto; /* Add a scrollbar if the suggestions overflow */
position: absolute;
background-color: white;
border: 1px solid #ccc;
border-radius: 5px;
display: none; /* Initially, hide the suggestions */
top: 75%; /* Position below the text input */
z-index: 1000; /* Ensure the suggestions are above other elements */
}
.suggestion {
padding: 5px;
cursor: pointer;
}
.guesses-container {
margin-top: -20px;
}
.guess-box {
width: 350px;
height: 30px;
border: 1px dashed #ccc;
margin: 5px 0;
display: flex;
align-items: center;
justify-content: center;
font-weight: bold;
border-radius: 5px;
background-color: #f3f3f3;
font-family: Helvetica, sans-serif;
}
.guess-made {
border: 1px solid #ccc; /*This gives a 2-pixel solid black border*/
background-color: white;
}
.correct-guess {
background-color: rgb(65, 128, 65);
color: white; /* You might want the text to be white for better visibility */
}
.incorrect-guess {
background-color: rgb(233, 110, 110);
color: white; /* You might want the text to be white for better visibility */
}
#incorrect-message {
color: red;
margin: 10px 0;
}
.image-indicators {
display: flex;
justify-content: center;
margin-top: 15px;
}
.image-indicator {
width: 30px;
height: 30px;
line-height: 30px; /* Vertically align the text in the center */
border: 1px solid #b9c9ff;
border-radius: 5px; /* Rounded corners */
margin: 0 5px;
text-align: center;
cursor: pointer;
display: none; /* By default, hide the indicator */
}
.image-indicator:first-child {
display: block; /* Only show the first indicator by default */
}
.image-indicator.completed {
background-color: #79abf7; /* light shaded blue */
color: white;
}
.image-indicator.active {
background-color: #007bff;
color: white;
}
#game-result {
font-size: 20px; /* You can adjust this value based on your preference */
margin-top: 5px; /* This will push it 20 pixels away from the above element. Adjust as needed. */
/*margin-right: 150px;
margin-left: 150px;*/
}
.current-guess {
border: 2px solid black; /* or any other desired color for the border */
background-color: #f2f2f2; /* light gray, but you can pick any color you like */
}
body, button, input, textarea, select {
font-family: Helvetica, sans-serif;
/* other styles if needed, like font-size, font-weight, etc. */
}
.title-container {
position: relative;
align-items: center; /* Vertically centers the items */
}
/* Help Button */
#help-button {
position: absolute;
left: -80px; /* Adjust this value to move the button more to the left or right */
top: 50%;
transform: translateY(-50%); /* This vertically centers the button */
display: inline-block;
vertical-align: middle;
background-color: rgb(245, 65, 65);
border: 1px solid rgb(245, 65, 65);
border-radius: 50%;
width: 25px;
height: 25px;
display: inline-block;
margin-right: 10px;
cursor: pointer;
font-size: 19px;
font-weight: bold;
color: white;
margin-top: -6px;
}
/* Wherele logo */
#wherele-logo {
position: absolute;
right: -85px; /* Adjust this value to move the button more to the left or right */
top: 50%;
transform: translateY(-50%); /* This vertically centers the button */
display: inline-block;
vertical-align: middle;
background-image: url(‘logo.png’); /* Add the path to your JPG image here */
background-size: cover; /* This will ensure that your image covers the button area */
border-radius: 50%;
width: 40px; /* Adjust if needed to fit your image */
height: 40px; /* Adjust if needed to fit your image */
display: inline-block;
margin-right: 10px;
cursor: pointer;
}
/* Overlay */
#help-overlay {
display: show; /* Initially hidden */
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.7);
z-index: 1000;
}
#help-content {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: #fff;
padding: 20px;
width: 80%;
max-width: 400px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
border-radius:20px;
text-align: center;
}
#close-help {
background-color: #f4f4f4;
border: none;
padding: 5px 10px;
cursor: pointer;
}
.facebook-button {
padding: 10px 15px;
background-color: #1877F2;
color: #ffffff;
border: none;
text-decoration: none;
display: inline-block;
border-radius: 10px;
margin-top: 20px;
}
.facebook-button:hover {
background-color: #155B9C;
}
.button-container {
display: flex; /* This enables Flexbox layout for the container */
justify-content: space-around; /* This distributes the space around the items */
align-items: center; /* This aligns the items vertically at the center */
}
#share-button {
padding: 5px 10px;
height: 36px; /* Adjust the height as needed */
margin: 5px 0;
background-color: #007bff;
color: white;
border: 1px solid #b9c9ff;
border-radius: 5px;
cursor: pointer;
font-size: 18px; /* Sets the font size */
margin-bottom: 0px;
margin-right: 0px;
}
?
<!–?–>
WHERELE
GUESS
// Listen for a keydown event on the entire window
window.addEventListener(‘keydown’, function(event) {
// Check if the Enter key was pressed
if (event.key === ‘Enter’) {
// Prevent any default action
event.preventDefault();
// Get the button by its ID and click it
document.getElementById(‘submit-button’).click();
}
});
// Add an event listener to the button to perform some action when it’s clicked
document.getElementById(‘submit-button’).addEventListener(‘click’, function() {
});
// Event listener for clicks on the document
document.addEventListener(‘click’, function(event) {
var suggestionsBox = document.getElementById(‘suggestions’);
// Check if the click target is not the suggestion box and not a child of the suggestion box
if (!suggestionsBox.contains(event.target)) {
hideSuggestions();
}
});
// Function to hide the suggestion box
function hideSuggestions() {
document.getElementById(‘suggestions’).style.display = ‘none’;
}
// Stop propagation of the click event on the search box
document.getElementById(‘search-box’).addEventListener(‘click’, function(event) {
event.stopPropagation();
});
// Event listener for the search box to show suggestions when it receives focus
document.getElementById(‘search-box’).addEventListener(‘focus’, function() {
document.getElementById(‘suggestions’).style.display = ‘block’; // Adjust as needed for your styling
});
let activeIndicatorIndex = 1;
initializeGuessBoxes();
let hasWon = false;
const suggestionsData = [
“AFGHANISTAN”, “ALBANIA”, “ALGERIA”, “ANDORRA”, “ANGOLA”, “ANTIGUA AND BARBUDA”, “ARGENTINA”, “ARMENIA”, “AUSTRALIA”, “AUSTRIA”, “AZERBAIJAN”,
“BAHAMAS”, “BAHRAIN”, “BANGLADESH”, “BARBADOS”, “BELARUS”, “BELGIUM”, “BELIZE”, “BENIN”, “BHUTAN”, “BOLIVIA”, “BOSNIA AND HERZEGOVINA”, “BOTSWANA”, “BRAZIL”, “BRUNEI”, “BULGARIA”, “BURKINA FASO”, “BURUNDI”,
“CAPE VERDE”, “CAMBODIA”, “CAMEROON”, “CANADA”, “CENTRAL AFRICAN REPUBLIC”, “CHAD”, “CHILE”, “CHINA”, “COLOMBIA”, “COMOROS”, “COSTA RICA”, “COTE D’IVOIRE”, “CROATIA”, “CUBA”, “CYPRUS”, “CZECHIA”, “DEMOCRATIC REPUBLIC OF THE CONGO”, “REPUBLIC OF THE CONGO”,
“DENMARK”, “DJIBOUTI”, “DOMINICA”, “DOMINICAN REPUBLIC”,
“ECUADOR”, “EGYPT”, “EL SALVADOR”, “EQUATORIAL GUINEA”, “ERITREA”, “ESTONIA”, “ESWATINI”, “ETHIOPIA”,
“FIJI”, “FINLAND”, “FRANCE”,
“GABON”, “GAMBIA”, “GEORGIA”, “GERMANY”, “GHANA”, “GREECE”, “GRENADA”, “GUATEMALA”, “GUINEA”, “GUINEA-BISSAU”, “GUYANA”,
“HAITI”, “HONDURAS”, “HUNGARY”,
“ICELAND”, “INDIA”, “INDONESIA”, “IRAN”, “IRAQ”, “IRELAND”, “ISRAEL”, “ITALY”,
“JAMAICA”, “JAPAN”, “JORDAN”,
“KAZAKHSTAN”, “KENYA”, “KIRIBATI”, “KOSOVO”, “KUWAIT”, “KYRGYZSTAN”,
“LAOS”, “LATVIA”, “LEBANON”, “LESOTHO”, “LIBERIA”, “LIBYA”, “LIECHTENSTEIN”, “LITHUANIA”, “LUXEMBOURG”,
“MADAGASCAR”, “MALAWI”, “MALAYSIA”, “MALDIVES”, “MALI”, “MALTA”, “MARSHALL ISLANDS”, “MAURITANIA”, “MAURITIUS”, “MEXICO”, “MICRONESIA”, “MOLDOVA”, “MONACO”, “MONGOLIA”, “MONTENEGRO”, “MOROCCO”, “MOZAMBIQUE”, “MYANMAR”,
“NAMIBIA”, “NAURU”, “NEPAL”, “NETHERLANDS”, “NEW ZEALAND”, “NICARAGUA”, “NIGER”, “NIGERIA”, “NORTH KOREA”, “NORTH MACEDONIA”, “NORWAY”,
“OMAN”,
“PAKISTAN”, “PALAU”, “PALESTINE”, “PANAMA”, “PAPUA NEW GUINEA”, “PARAGUAY”, “PERU”, “PHILIPPINES”, “POLAND”, “PORTUGAL”,
“QATAR”,
“ROMANIA”, “RUSSIA”, “RWANDA”,
“SAINT KITTS AND NEVIS”, “SAINT LUCIA”, “SAINT VINCENT AND THE GRENADINES”, “SAMOA”, “SAN MARINO”, “SAO TOME AND PRINCIPE”, “SAUDI ARABIA”, “SENEGAL”, “SERBIA”, “SEYCHELLES”, “SIERRA LEONE”, “SINGAPORE”, “SLOVAKIA”, “SLOVENIA”, “SOLOMON ISLANDS”, “SOMALIA”, “SOUTH AFRICA”, “SOUTH KOREA”, “SOUTH SUDAN”, “SPAIN”, “SRI LANKA”, “SUDAN”, “SURINAME”, “SWEDEN”, “SWITZERLAND”, “SYRIA”,
“TAIWAN”, “TAJIKISTAN”, “TANZANIA”, “THAILAND”, “TIMOR-LESTE”, “TOGO”, “TONGA”, “TRINIDAD AND TOBAGO”, “TUNISIA”, “TURKEY”, “TURKMENISTAN”, “TUVALU”,
“UGANDA”, “UKRAINE”, “UNITED ARAB EMIRATES”, “UNITED KINGDOM”, “UNITED STATES OF AMERICA”, “URUGUAY”, “UZBEKISTAN”,
“VANUATU”, “VATICAN CITY”, “VENEZUELA”, “VIETNAM”,
“YEMEN”,
“ZAMBIA”, “ZIMBABWE”
];
const searchBox = document.getElementById(“search-box”);
const suggestions = document.getElementById(“suggestions”);
const submitButton = document.getElementById(“submit-button”);
const gameResult = document.getElementById(“game-result”);
const cityImage = document.getElementById(“city-image”);
const incorrectMessage = document.getElementById(“incorrect-message”);
const imageIndicatorsContainer = document.getElementById(“image-indicators”);
const correctCity = “SPAIN”;
let answer = correctCity
let currentImageIndex = 1;
const maxImages = 5;
let guessCount = 0;
searchBox.addEventListener(“input”, () => {
const searchText = searchBox.value.toLowerCase();
if (searchText.trim() === “”) {
suggestions.style.display = “none”;
return;
}
const filteredSuggestions = suggestionsData.filter(suggestion => suggestion.toLowerCase().includes(searchText));
updateSuggestions(filteredSuggestions);
});
function initializeGuessBoxes() {
const firstGuessBox = document.getElementById(‘guess-box-1’);
firstGuessBox.textContent = ‘GUESS 1/5’;
}
function fireConfetti() {
confetti({
particleCount: 150, // number of confetti particles
spread: 70, // spread angle in degrees
origin: { y: 0.6 } // set the Y position of the confetti source
});
}
function unlockAllImages() {
const indicators = document.querySelectorAll(“.image-indicator”);
indicators.forEach(indicator => {
indicator.classList.add(“viewed”);
let idx = parseInt(indicator.id.split(“-“)[1]);
indicator.addEventListener(“click”, () => viewImageByIndex(idx));
});
}
submitButton.addEventListener(“click”, () => {
const userGuess = searchBox.value;
displayGuess(userGuess);
if (userGuess.toLowerCase() === correctCity.toLowerCase()) {
//currentImageIndex = maxImages; // Set the current image index to the max value
hasWon = true;
for (let i = guessCount + 1; i {
indicator.classList.add(“completed”);
});
unlockAllImages(); // Allow the user to view all images
} else {
updateCityImage();
if (guessCount === 5) {
gameResult.textContent = `The correct answer was ${answer}`;
searchBox.disabled = true;
submitButton.disabled = true;
}
}
searchBox.value = “”;
});
function updateCityImage() {
if (currentImageIndex {
indicator.classList.add(“viewed”);
});
}
function unlockAllImages() {
for (let i = 1; i {
currentImageIndex = i;
cityImage.src = `images/${currentImageIndex}.jpg`;
updateActiveIndicator(currentImageIndex);
});
}
}
function updateSuggestions(suggestionList) {
const suggestionContainer = document.getElementById(“suggestions”);
suggestionContainer.innerHTML = “”;
if (suggestionList.length > 0) {
suggestionContainer.style.display = “block”;
suggestionList.forEach(suggestion => {
const suggestionElement = document.createElement(“div”);
suggestionElement.className = “suggestion”;
suggestionElement.textContent = suggestion;
suggestionElement.addEventListener(“click”, () => {
searchBox.value = suggestion;
suggestionContainer.style.display = “none”;
});
suggestionContainer.appendChild(suggestionElement);
});
} else {
suggestionContainer.style.display = “none”;
}
}
function displayGuess(guess) {
guessCount++;
const guessBox = document.getElementById(`guess-box-${guessCount}`);
if (guessBox) {
guessBox.textContent = guess;
if (guess.toLowerCase() === correctCity.toLowerCase()) {
guessBox.classList.add(‘correct-guess’); // Turn the box green for correct guesses
} else {
guessBox.classList.add(‘incorrect-guess’); // Turn the box red for incorrect guesses
}
guessBox.classList.add(‘guess-made’); // Add the new class to change the border to solid
}
// If correct guess, unlock all images and show the last one
if (guess.toLowerCase() === correctCity.toLowerCase()) {
unlockAllIndicators();
}
// Increment the active indicator after every guess
if (activeIndicatorIndex < maxImages) {
activeIndicatorIndex++;
}
// Prepare the next guess box
if (guessCount {
indicator.classList.remove(“active”);
});
const targetIndicator = document.querySelector(`.image-indicator:nth-child(${index})`);
if (targetIndicator) {
targetIndicator.classList.add(“active”);
}
}
// Image indicator functions
for (let i = 1; i {
cityImage.src = `images/${i}.jpg`;
setActiveIndicator(i);
});
// Clear ‘active’ from all indicators
//const allIndicators = document.querySelectorAll(“.image-indicator”);
//allIndicators.forEach((ind) => {
//ind.classList.remove(“active”);
//});
// Add ‘active’ to the clicked indicator
//indicator.classList.add(“active”);
// Update the image based on the clicked indicator
//cityImage.src = `file:///C:/Users/benra_000/OneDrive/Wherele/Test%20pictures/${i}.jpg`;
// Highlight the clicked indicator
//setActiveIndicator(i);
//});
imageIndicatorsContainer.appendChild(indicator);
}
// Highlight the first indicator
document.querySelector(“.image-indicator”).classList.add(“active”);
function viewImagePostWin(index) {
cityImage.src = `images/${index}.jpg`;
setActiveIndicator(index); // No need to update the currentImageIndex after winning
}
function viewPreviousImage(index) {
cityImage.src = `images/${index}.jpg`;
// Highlight the clicked indicator and reset others
const indicators = document.querySelectorAll(“.image-indicator”);
indicators.forEach((indicator, idx) => {
if (idx + 1 === index) {
indicator.classList.add(“active”);
} else {
indicator.classList.remove(“active”);
}
});
}
function updateActiveIndicator(index) {
const indicators = document.querySelectorAll(“.image-indicator”);
indicators.forEach((indicator, idx) => {
if (idx === index – 1) {
indicator.classList.add(“active”);
indicator.style.display = ‘inline-block’; // Show the current indicator
} else {
indicator.classList.remove(“active”);
}
if (indicator.classList.contains(“completed”)) {
return; // Skip the ones already completed
}
if (idx {
indicator.addEventListener(“click”, () => {
if (hasWon) {
viewImagePostWin(idx + 1);
} else {
viewPreviousImage(idx + 1);
}
});
indicator.style.display = ‘inline-block’;
});
}
function updateIndicatorsDisplay() {
const indicators = document.querySelectorAll(“.image-indicator”);
indicators.forEach((indicator, idx) => {
if (idx + 1 === currentImageIndex) {
indicator.classList.add(“active”);
} else {
indicator.classList.remove(“active”);
}
});
}
function viewImageByIndex(index) {
if(hasWon) {
viewImagePostWin(index);
} else {
cityImage.src = `images/${index}.jpg`;
lastViewedImageIndex = index;
updateActiveIndicator(lastViewedImageIndex);
}
}
// Highlight the first indicator
document.querySelector(“.image-indicator”).classList.add(“active”);
document.addEventListener(‘DOMContentLoaded’, function() {
// Reference to the overlay and its content
const helpOverlay = document.getElementById(‘help-overlay’);
const helpContent = document.getElementById(‘help-content’);
document.getElementById(‘help-button’).addEventListener(‘click’, function() {
helpOverlay.style.display = ‘block’;
});
document.getElementById(‘close-help’).addEventListener(‘click’, function() {
helpOverlay.style.display = ‘none’;
});
// Event listener to detect clicks on the document
document.addEventListener(‘click’, function(event) {
// Check if the click was outside the help content and the help button
if (!helpContent.contains(event.target) && !event.target.matches(‘#help-button’)) {
helpOverlay.style.display = ‘none’;
}
});
});
document.getElementById(‘share-button’).addEventListener(‘click’, function() {
let shareText = “”;
let alertMessage = “”; // Message to show in the alert
// Assuming ‘hasWon’ and ‘guessCount’ are defined in your game’s logic
if (hasWon) {
// User has won
shareText = `I got WHERELE in ${guessCount} / 5 guesses today. Can you beat my score? Play now: wherele.app`;
alertMessage = ‘Your game result has been copied to your clipboard. Paste it in a message and send to your friends!’;
} else if (guessCount === 5) {
// User has used all guesses
shareText = `I used all my guesses at WHERELE today but couldn’t get the correct answer. Can you do better? Play now: wherele.app`;
alertMessage = ‘Your game result has been copied to your clipboard. Paste it in a message and send to your friends!’;
} else {
// The game is still ongoing or the user hasn’t started playing
shareText = `I’m playing WHERELE, the game where you use pictures to guess the location. Play now: wherele.app`;
alertMessage = ‘Info about this game copied to your clipboard! Paste it in a message and invite friends to play!’;
}
// Use the Clipboard API to copy the text to the clipboard
navigator.clipboard.writeText(shareText).then(function() {
// Inform the user that the text has been copied
alert(alertMessage);
})
.catch(function(error) {
// Handle any errors
alert(‘Failed to copy text: ‘ + error);
});
});
Welcome to WHERELE
HOW TO PLAY
Use the picture provided to guess the name of the country.
Each incorrect guess reveals a new picture from the country.
To skip a picture leave the input box blank and click GUESS.
That’s it, have fun.
Close
<!–
Use the pictures provided to guess the name of the country in which they were taken.
Each picture is taken in the same country. You are trying to guess just one country.
The maximum number of pictures you will see is five. Therefore, you have five chances to guess the country.
Each incorrect guess reveals a new picture from that same country.
To skip a picture leave the input box blank and click GUESS.
–>