Skip to content

Commit

Permalink
bug fixes & changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Escartem committed Apr 23, 2024
1 parent 960f2ca commit 69bdd12
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 40 deletions.
11 changes: 6 additions & 5 deletions public/assets/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,9 @@ img {
img#char, img#guessMap { border: solid 1px #ffffff }

/* scroll bar */
::-webkit-scrollbar { width: 7px }
::-webkit-srollbar-track { background: #f1f1f1 }
::-webkit-scrollbar-thumb { background: #888; border-radius: 10px }
::-webkit-scrollbar-thumb:hover { background: #555 }
::-webkit-scrollbar { width: 4px }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 30px }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.5) }

/* spinner */
#load-spinner, #load-spinner-map {
Expand Down Expand Up @@ -643,13 +642,15 @@ kbd {
.optionsContent {
overflow: auto;
width: 90%;
height: 90%;
height: 95%;
background: var(--options-bg);
color: var(--text-color) !important;
padding: 10px;
margin-top: 20px;
margin-bottom: 5px;
border-radius: 10px;
transition: 0.5s;
box-shadow: inset 0px 0px 4px 0px black;
}

#bottomText {
Expand Down
32 changes: 15 additions & 17 deletions public/assets/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
setupEMS({"RCB": true, "DVT": false, "BSC": true, "SRC": true});

// version
VERSION = "2.6.6";
VERSION = "2.7";
console.log(`📦 v${VERSION}`);
document.getElementById("version").innerHTML = `V${VERSION}`;
initConfig();
Expand Down Expand Up @@ -40,8 +40,6 @@ optionsBetterMap = getElem("optionsBetterMap");
// game modes
leftWrapper = getElem("left-panel-wrapper");
mainWrapper = getElem("main-wrapper");
gmMap = getElem("gmMap");
gmChar = getElem("gmChar");
// map
showMapBtn = getElem("showMapBtn");
genMapBtn = getElem("genMapBtn");
Expand All @@ -50,20 +48,20 @@ genMapBtnBottom = getElem("genMapBtnBottom");

// shortcuts
document.addEventListener("keydown", function(e) {
if ((e.ctrlKey && e.keyCode == 81) || (e.ctrlKey && e.keyCode == 87)) { // ctrl+q or ctrl+w
if ((e.ctrlKey && e.keyCode == 13) || (e.ctrlKey && e.keyCode == 81)) { // ctrl+enter or ctrl+q
e.preventDefault();
if (gameMode == "char") {
if (gen==false && charsListEnabled==false && optionsShown==false) {genImage();};
if (!gen && !charsListEnabled && !optionsShown) { genImage() };
} else {
if (genMap==false && optionsShown==false) {genMapGuess();};
if (!genMap && !optionsShown) { genMapGuess() };
}
} else if (e.keyCode == 13) { // enter
e.preventDefault();
if (gameMode == "map" && checkMapBtn.disabled == false) {
if (gameMode == "map" && !checkMapBtn.disabled) {
checkMap();
}
} else if (e.keyCode == 32) { // space
if (gameMode == "map" && genMap == false) {
if (gameMode == "map" && !genMap) {
e.preventDefault();
showMap();
}
Expand All @@ -72,24 +70,24 @@ document.addEventListener("keydown", function(e) {
mode = gameMode == "char" ? "map" : "char";
switchMode(mode);
} else if (e.ctrlKey && e.keyCode == 76) { // ctrl+l
e.preventDefault()
e.preventDefault();
if (gameMode == "char") {
switchCharList()
switchCharList();
}
} else if (e.ctrlKey && e.keyCode == 83) { // ctrl+s
e.preventDefault()
switchOptions()
e.preventDefault();
switchOptions();
} else if (e.ctrlKey && e.keyCode == 68) { // ctrl+d
e.preventDefault()
switchLeftPanel()
e.preventDefault();
switchLeftPanel();
}
});
// input enter shortcut
uinput.onkeydown = function(event) {if (event.keyCode == 13) {check();}};

// buttons links
gmMap.addEventListener("click", function(event) {event.preventDefault(); switchMode("map");})
gmChar.addEventListener("click", function(event) {event.preventDefault(); switchMode("char");})
getElem("gmMap").addEventListener("click", (e) => {switchMode("map")});
getElem("gmChar").addEventListener("click", (e) => {switchMode("char")});
getElem("resetScores").addEventListener("click", (e) => {resetScores()});
regenBtn.addEventListener("click", function(event) {event.preventDefault(); genImage();});
reportBtn.addEventListener("click", function(event) {event.preventDefault(); showPopup("Report image", "Please join the <a href='https://discord.gg/fzRdtVh', target='_blank'>discord</a> and provide this : <span style='color: white; background: #2a2a2a;'>"+buid+"</span>", 60, 33);});
Expand Down Expand Up @@ -667,7 +665,7 @@ function showPopup(title, content, width=80, height=70) {

window.addEventListener("load", () => {
setupData(() => {
console.log("📈 app init")
console.log("📈 done !")
switchMode(gameMode);
updateMapLayer(optionsBetterMap.checked);
document.getElementsByClassName("main")[0].style.opacity = 1;
Expand Down
52 changes: 34 additions & 18 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no, maximum-scale=1">
<link rel="icon" href="favicon.ico" />
<!-- meta -->
<meta property="og:description" content="Genshin Impact minigames with character guesser using a cropped image of them or geoguessr style game with the game map.">
Expand All @@ -26,7 +26,7 @@
<!-- CSS -->
<link rel="stylesheet" href="assets/css/material-components-web.min.css">
<link rel="stylesheet" href="assets/css/material.indigo-pink.min.css">
<link rel="stylesheet" href="assets/css/styles.css?v=2.6.6">
<link rel="stylesheet" href="assets/css/styles.css?v=2.7">
<link rel="stylesheet" href="assets/css/leaflet.css" />
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-132CTGT17P"></script>
Expand Down Expand Up @@ -91,7 +91,7 @@
<div id="left-panel-wrapper">
<div id="left-panel-map">
<div class="aboutContent">
<span class="pic-title">About</span>
<span class="pic-title">🧾 About</span>

<div id="news" style="height: max-content; color: var(--text-alt-color); margin: 10px; margin-bottom: 20px; width: 100%; background-color: var(--about-bg);">
<span style="margin: 10px; font-size: 13px;">
Expand All @@ -113,7 +113,7 @@

<hr style="width: calc(100% + 20px);">

<span class="optionsCatTitle">Settings</span>
<span class="optionsCatTitle">🔧 Settings</span>

<div class="leftPanelSettings">
<div class="mdc-form-field">
Expand All @@ -126,7 +126,7 @@

<div id="left-panel-char">
<div class="aboutContent">
<span class="pic-title">About</span>
<span class="pic-title">🧾 About</span>

<div id="news" style="height: max-content; color: var(--text-alt-color); margin: 10px; width: 100%; background-color: var(--about-bg);">
<span style="margin: 10px; font-size: 13px;">
Expand All @@ -142,7 +142,7 @@

<hr style="width: calc(100% + 20px);">

<span class="optionsCatTitle">Settings</span>
<span class="optionsCatTitle">🔧 Settings</span>

<div class="leftPanelSettings">
<div class="mdc-form-field">
Expand Down Expand Up @@ -172,9 +172,9 @@
</div>
<div id="topwrapper">
<div class="options" id="options">
<span class="pic-title" id="options-title" style="transition: 0.5s;">Settings</span>

<div class="optionsContent" id="optionsContent">
<span class="optionsCatTitle">⚙ Settings</span>

<div>
<div class="mdc-form-field">
<div class="mdc-checkbox"><input id="optionsLightMode" type="checkbox" class="mdc-checkbox__native-control" id="checkbox-1"/><div class="mdc-checkbox__background"><svg class="mdc-checkbox__checkmark" viewBox="0 0 24 24"><path class="mdc-checkbox__checkmark-path" fill="none" d="M1.73,12.91 8.1,19.28 22.79,4.59"/></svg><div class="mdc-checkbox__mixedmark"></div></div><div class="mdc-checkbox__ripple"></div></div>
Expand Down Expand Up @@ -214,22 +214,22 @@

<div>
<ul style="padding-left: 15px;">
<li id="stats-map">0 games in map mode with 0 won (0% win ratio)</li>
<li id="stats-map">...</li>

<li id="stats-char">0 games in character mode with 0 won (0% win ratio)</li>
<li id="stats-char">...</li>
</ul>
</div>
</div>

<hr>

<div>
<span class="optionsCatTitle">Shortcuts</span>
<span class="optionsCatTitle">Shortcuts</span>

<div>
<ul style="padding-left: 15px;">
<li>Switch gamemode : <kbd>Ctrl</kbd> + <kbd>M</kbd></li>
<li>Generate new image : <kbd>Ctrl</kbd> + <kbd>Q</kbd> (<kbd>Ctrl</kbd> + <kbd>W</kbd> for Firefox)</li>
<li>Generate new image : <kbd>Ctrl</kbd> + <kbd>Enter</kbd> or <kbd>Ctrl</kbd> + <kbd>Q</kbd></li>
<br>
<li>Check answer : <kbd>Enter</kbd></li>
<li>Open map : <kbd>Space</kbd> (map mode only)</li>
Expand All @@ -245,7 +245,7 @@
<hr>

<div>
<span class="optionsCatTitle">Links</span>
<span class="optionsCatTitle">🔗 Links</span>
<div style="display: flex; justify-content: space-evenly;">
<button type="button" class="mdc-button mdc-button--raised" id="github" onclick="window.open('https://github.com/Escartem/GenshinCrop', '_blank');"><span class="mdc-button__label"><i class="fa-brands fa-github"></i> Source code</span></button>
<button type="button" class="mdc-button mdc-button--raised" id="discord" onclick="window.open('https://discord.gg/fzRdtVh', '_blank');"><span class="mdc-button__label"><i class="fa-brands fa-discord"></i> Discord</span></button>
Expand All @@ -254,20 +254,33 @@

<hr>

<span class="optionsCatTitle">What's new</span>
<span class="optionsCatTitle">📃 What's new</span>

<div style="display: flex; justify-content: center;">
<button type="button" class="mdc-button mdc-button--raised" id="oldVersionsSwitch" style="height: 25px;"><span class="mdc-button__label">Show older versions</span></button>
<button type="button" class="mdc-button mdc-button--raised" id="oldVersionsSwitch" style="height: 25px;"><span class="mdc-button__label">📦 Show older versions</span></button>
</div>

<div id="news" style="height: max-content;">
<span style="margin-top: 10px; margin-left: 10px; width: calc(100% - 20px);">
version 2.6.6 (1 April 2024)
version 2.7 (23 April 2024)
<ul>
<li>Star Rail : Added Acheron, Aventurine and Gallagher</li>
<li>Added a button to reset scores</li>
<li>Tweaked interface, fixed some light mode issues</li>
<li>Changed shortcut for generating a new image</li>
<li>Some bugs fixes</li>
</ul>
</span>
</div>

<div id="oldAppUpdates" style="height: 0; opacity: 0;">
<span style="margin-top: 10px; margin-left: 10px; width: calc(100% - 20px);">
version 2.6.6 (1 April 2024)
<ul>
<li>Star Rail : Added Acheron, Aventurine and Gallagher</li>
</ul>

<hr>

version 2.6.5 (4 March 2024)
<ul>
<li>Major API update, fixes, optimisation, and now <a href="https://github.com/Escartem/GenshinCropApi" target="_blank">open source</a></li>
Expand Down Expand Up @@ -625,6 +638,9 @@
</div>
</div>
</div>
<script src="./assets/js/app.js?v=2.6.6"></script>
<script src="./assets/js/elements.js?v=1.0"></script>
<script src="./assets/js/config.js?v=1.0"></script>
<script src="./assets/js/utils.js?v=1.0"></script>
<script src="./assets/js/app.js?v=2.7"></script>
</body>
</html>

0 comments on commit 69bdd12

Please sign in to comment.