feat: UI enhancements, exam mode

- fullscreen toggle

- Largen Clock toggle

- Hide Tools toggle

- Exam Mode
This commit is contained in:
Aliberk Sandıkçı 2023-12-25 19:08:30 +03:00
parent d1ed8ef9fa
commit 5636088690
Signed by: asandikci
GPG key ID: 25C67A03B5666BC1
5 changed files with 205 additions and 20 deletions

View file

@ -67,10 +67,21 @@ section#top .clock #time {
justify-content: center; justify-content: center;
font-size: 80px; font-size: 80px;
} }
section#top .settings-box { section#top .toolbox {
min-width: 20vw; min-width: 20vw;
margin-left: auto; margin-left: auto;
text-align: right; text-align: right;
display: block;
}
section#top .toolbox button {
height: 30px;
width: 30px;
line-height: 20px;
}
section#top .settings-box {
min-width: min-content;
margin-left: 0;
text-align: right;
} }
section#top .settings-box button { section#top .settings-box button {
height: 30px; height: 30px;
@ -87,7 +98,8 @@ section#top .settings-box #settings {
section#top .settings-box #settings form { section#top .settings-box #settings form {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
position: relative; position: absolute;
min-width: 10vw;
background-color: grey; background-color: grey;
} }
section#top .settings-box #settings form .cell { section#top .settings-box #settings form .cell {

View file

@ -1 +1 @@
{"version":3,"sourceRoot":"","sources":["../scss/main.scss","../scss/_animation.scss","../scss/_button.scss"],"names":[],"mappings":";AAAA;ACAA;AAEA;EACE;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;;ADZJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;AAAA;EAEE;EACA;EAEA;EACA;EACA;EAEA;EACA;EACA;;;AAMA;EACE;EACA;EACA;EAEA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;;AAEA;EACE;EAGA;EACA;EACA;EACA;EACA;EACA;EACA;;AAIJ;EACE;EACA;EACA;;AAEA;EACE;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;;AAGA;EACE;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;;AAEA;EAEE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EAEE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;;AAGF;EACE;EACA;;AAIJ;EACE;EACA;EACA;EACA;;AAWZ;EACE;EACA;EACA;EACA;;AAEA;EACE;EACA;;AAGE;EACE;EACA;EACA;;AAEA;EAEE;EACA;;AEtKV;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA,YACE;;AAGJ;EACE;EACA;EACA;EACA;EACA;EAEA;;AAOF;EACE;EACA;EACA;EAGA;EACA;EACA;EACA;EACA,YACE;;AAGJ;EACE;;AAGF;EACE;EACA,YACE;;AAGJ;EACE;EACA;;AAGF;EACE;EACA,YACE;;AAGJ;EACE;EACA;;AAGF;EACE;;AAKA;AAAA;AAAA;EAGE;EACA;;AAGF;EACE;;AAUF;AAAA;AAAA;EAIE;EACA;;AAGF;EACE;;AF2DM;EACE;EACA;;AAOR;EACE;EACA;;AAEA;EACE;EACA;EACA;;AAEA;AAAA;AAAA;EAGE;;AAKN;EACE;EACA;;AAEA;EACE;;AAMN;EACE;EACA;;AAGF;EACE;EACA;;AAMJ;EACE;;AAEA;EACE;EACA;EACA;;;AAKN;EACE;EACA;EACA","file":"main.css"} {"version":3,"sourceRoot":"","sources":["../scss/main.scss","../scss/_animation.scss","../scss/_button.scss"],"names":[],"mappings":";AAAA;ACAA;AAEA;EACE;IACE;;EAGF;IACE;;EAGF;IACE;;EAGF;IACE;;;ADZJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;AAAA;EAEE;EACA;EAEA;EACA;EACA;EAEA;EACA;EACA;;;AAMA;EACE;EACA;EACA;EAEA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;;AAEA;EACE;EAGA;EACA;EACA;EACA;EACA;EACA;EACA;;AAIJ;EACE;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;;AAIJ;EACE;EACA;EACA;;AAEA;EACE;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;;AAGA;EACE;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;;AAEA;EAEE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EAEE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;;AAGF;EACE;EACA;;AAIJ;EACE;EACA;EACA;EACA;;AAWZ;EACE;EACA;EACA;EACA;;AAEA;EACE;EACA;;AAGE;EACE;EACA;EACA;;AAEA;EAEE;EACA;;AEpLV;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA,YACE;;AAGJ;EACE;EACA;EACA;EACA;EACA;EAEA;;AAOF;EACE;EACA;EACA;EAGA;EACA;EACA;EACA;EACA,YACE;;AAGJ;EACE;;AAGF;EACE;EACA,YACE;;AAGJ;EACE;EACA;;AAGF;EACE;EACA,YACE;;AAGJ;EACE;EACA;;AAGF;EACE;;AAKA;AAAA;AAAA;EAGE;EACA;;AAGF;EACE;;AAUF;AAAA;AAAA;EAIE;EACA;;AAGF;EACE;;AFyEM;EACE;EACA;;AAOR;EACE;EACA;;AAEA;EACE;EACA;EACA;;AAEA;AAAA;AAAA;EAGE;;AAKN;EACE;EACA;;AAEA;EACE;;AAMN;EACE;EACA;;AAGF;EACE;EACA;;AAMJ;EACE;;AAEA;EACE;EACA;EACA;;;AAKN;EACE;EACA;EACA","file":"main.css"}

View file

@ -5,6 +5,9 @@ var FlagSecond = 0;
var FlagSettings = 0; var FlagSettings = 0;
var FlagTimers = 1; var FlagTimers = 1;
var FlagExtras = 1; var FlagExtras = 1;
var FlagTools = 1;
var FlagFullscreen = 0;
var FlagLargenClock = 0;
var MidItems = ["timers", "stopwatch", "timer", "yemek-listesi", "animations"] var MidItems = ["timers", "stopwatch", "timer", "yemek-listesi", "animations"]
// RUN FUNCTIONS ON START // RUN FUNCTIONS ON START
@ -32,7 +35,7 @@ function updateTime() {
document.getElementById("time").innerHTML = curHour + "." + curMin; document.getElementById("time").innerHTML = curHour + "." + curMin;
} }
if (curHour == 12 && (curMin >= 24 && curMin <= 30)) { if (curHour == 12 && (curMin >= 24 && curMin <= 30) && FlagExtras == 1) {
document.getElementById("time").style.color = "red"; document.getElementById("time").style.color = "red";
document.getElementById("rainbow").style.display = "inherit"; document.getElementById("rainbow").style.display = "inherit";
} else { } else {
@ -109,6 +112,66 @@ function toggleExtra() {
} }
function toggleTools() {
let chx = document.getElementById("chx-closeTools");
if (chx.checked) {
FlagTools = 0;
} else {
FlagTools = 1;
}
updateToolVisibility();
}
function toggleFullscreen() {
let chx = document.getElementById("chx-fullscreen");
if (chx.checked) {
FlagFullscreen = 1;
} else {
FlagFullscreen = 0;
}
updateFullscreen();
}
function toggleLargenClock() {
let chx = document.getElementById("chx-largenClock");
if (chx.checked) {
FlagLargenClock = 1;
} else {
FlagLargenClock = 0;
}
updateClockSize();
}
function toggleExamMode() {
let chx = document.getElementById("chx-examMode");
if (chx.checked) {
document.getElementById("chx-largenClock").checked = true;
document.getElementById("chx-closeExtra").checked = true;
document.getElementById("chx-clockSecond").checked = true;
document.getElementById("chx-closeTools").checked = true;
// document.getElementById("chx-fullscreen").checked = true;
// toggleFullscreen();
// FIXME Try, if not works open new tab and make fullscreen automatically, when exiting fullscreen actually close tab !!!
toggleExtra();
toggleLargenClock();
toggleClockSeconds();
toggleTools();
document.getElementById("header-note").style.display = "block";
} else {
document.getElementById("chx-largenClock").checked = false;
document.getElementById("chx-closeExtra").checked = false;
document.getElementById("chx-clockSecond").checked = false;
document.getElementById("chx-closeTools").checked = false;
// document.getElementById("chx-fullscreen").checked = false;
// toggleFullscreen();
toggleExtra();
toggleLargenClock();
toggleClockSeconds();
toggleTools();
document.getElementById("header-note").style.display = "none";
}
}
// ----------------------------------------- // -----------------------------------------
// UTILITIES // UTILITIES
// //
@ -129,27 +192,84 @@ function hideMidAll(...except) {
}); });
} }
/** type: id, class /**
* * @param type id, class
* name: id or class name * @param name id or class name
* @param display display type
*/ */
function toggleItem(type, name) { function toggleItem(type, name, display = "default") {
switch (type) { switch (type) {
case "id": case "id":
let item = document.getElementById(name);
if (item.style.display == "flex") { // TODO AUTO display type recognizer, do not require to type display type
var targetDisplay = "flex";
switch (display) {
case "absolute":
targetDisplay = "absolute";
break;
case "block":
targetDisplay = "block";
break;
default:
break;
}
var item = document.getElementById(name);
if (item.style.display == targetDisplay) {
item.style.display = "none"; item.style.display = "none";
} else { } else {
item.style.display = "flex"; item.style.display = targetDisplay;
} }
break; break;
default: default:
console.error("no toggle item except ids!"); console.error("no toggle item except ids!");
break; break;
} }
} }
function updateFullscreen() {
var elem = document.documentElement;
if (FlagFullscreen) {
console.warn("FULLSCREEN");
/* View in fullscreen */
if (elem.requestFullscreen) {
elem.requestFullscreen();
} else if (elem.webkitRequestFullscreen) { /* Safari */
elem.webkitRequestFullscreen();
} else if (elem.msRequestFullscreen) { /* IE11 */
elem.msRequestFullscreen();
}
} else {
/* Close fullscreen */
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.webkitExitFullscreen) { /* Safari */
document.webkitExitFullscreen();
} else if (document.msExitFullscreen) { /* IE11 */
document.msExitFullscreen();
}
}
}
function updateToolVisibility() {
var item = document.getElementsByClassName("settings-box")[0];
if (FlagTools) {
document.getElementById("toolbox").style.display = "block";
item.style.marginLeft = "0px";
item.style.minWidth = "min-content";
} else {
hideMidAll();
document.getElementById("toolbox").style.display = "none";
item.style.marginLeft = "auto";
item.style.minWidth = "20vw";
}
}
function updateExtras() { function updateExtras() {
var arr = document.getElementsByClassName("extraItem"); var arr = document.getElementsByClassName("extraItem");
for (let i = 0; i < arr.length; i++) { for (let i = 0; i < arr.length; i++) {
@ -161,4 +281,19 @@ function updateExtras() {
element.style.display = "none"; element.style.display = "none";
} }
} }
}
function updateClockSize() {
let clock = document.getElementById("time");
let top = document.getElementById("top");
if (FlagLargenClock) {
document.getElementById("clock-divider").style.display = "none";
clock.style.fontSize="200px";
top.style.height="max-content";
} else {
document.getElementById("clock-divider").style.display = "block";
clock.style.fontSize="80px";
top.style.height="100px";
}
} }

View file

@ -65,10 +65,23 @@ section {
} }
} }
.settings-box { .toolbox {
min-width: 20vw; min-width: 20vw;
margin-left: auto; margin-left: auto;
text-align: right; text-align: right;
display: block;
button {
height: 30px;
width: 30px;
line-height: 20px;
}
}
.settings-box {
min-width: min-content;
margin-left: 0;
text-align: right;
button { button {
height: 30px; height: 30px;
@ -87,7 +100,8 @@ section {
form { form {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
position: relative; position: absolute;
min-width: 10vw;
background-color: grey; background-color: grey;
.cell { .cell {

View file

@ -31,15 +31,23 @@
<div style="display:flex; align-content: center; align-items: center; margin-top: 10px;" class="extraItem"> <div style="display:flex; align-content: center; align-items: center; margin-top: 10px;" class="extraItem">
<a href="https://asandikci.com/bagis/" target="_blank"><img src="assets/images/bagis-qr.png" width="50"></a> <a href="https://asandikci.com/bagis/" target="_blank"><img src="assets/images/bagis-qr.png" width="50"></a>
<p style="align-self: center; font-style: normal; text-align: center; font-size: small;"> &nbsp; &#x1F448; <p style="align-self: center; font-style: normal; text-align: center; font-size: small;"> &nbsp; &#x1F448;
Geliştirme sürecine destek verin<br>&nbsp; &nbsp; &nbsp; (Sıradaki: <span style="width: min-content; font-size: x-small;"id="sirada-yapilacaklar"></span>) </p> Geliştirme sürecine destek verin<br>&nbsp; &nbsp; &nbsp; (Sıradaki: <span
style="width: min-content; font-size: x-small;" id="sirada-yapilacaklar"></span>) </p>
</div>
<div id="header-note" style="display:none;">
Başarılar
</div> </div>
</div> </div>
<div class="clock"> <div class="clock">
<h1 id="time">12.00</h1> <h1 id="time">12.00</h1>
</div> </div>
<div class="settings-box"> <div class="toolbox" id="toolbox">
<form> <form>
<button id="timers-button" type="button" onmouseover="toggleTimers()" onclick="toggleTimers()"></button> <button id="timers-button" type="button" onmouseover="toggleTimers()" onclick="toggleTimers()"></button>
</form>
</div>
<div class="settings-box">
<form>
<button id="settings-button" type="button" onmouseover="toggleSettings()" onclick="toggleSettings()"></button> <button id="settings-button" type="button" onmouseover="toggleSettings()" onclick="toggleSettings()"></button>
</form> </form>
<div id="settings"> <div id="settings">
@ -58,14 +66,30 @@
</div> </div>
<div class="cell"> <div class="cell">
<input type="checkbox" id="chx-closeExtra" onchange="toggleExtra()"> <input type="checkbox" id="chx-closeExtra" onchange="toggleExtra()">
<label for="chx-devVersion">Ekstra Bildirimleri Kapatın</label> <label for="chx-closeExtra">Ekstra Bildirimleri Kapatın</label>
</div>
<div class="cell">
<input type="checkbox" id="chx-closeTools" onchange="toggleTools()">
<label for="chx-closeTools">Araç Çubuğunu Gizle</label>
</div>
<div class="cell">
<input type="checkbox" id="chx-largenClock" onchange="toggleLargenClock()">
<label for="chx-largenClock">Saati Büyült</label>
</div>
<div class="cell">
<input type="checkbox" id="chx-fullscreen" onchange="toggleFullscreen()">
<label for="chx-fullscreen">Tam Ekran</label>
</div>
<div class="cell">
<input type="checkbox" id="chx-examMode" onchange="toggleExamMode()">
<label for="chx-examMode"><b style="color:red;">Sınav Modu</b></label>
</div> </div>
</form> </form>
</div> </div>
</div> </div>
</section> </section>
<hr style="width: 100%; box-sizing: border-box;"> <hr style="width: 100%; box-sizing: border-box;" id="clock-divider">
<!-- INTERACTIVE / FUNCTIONAL AREA --> <!-- INTERACTIVE / FUNCTIONAL AREA -->
<section id="mid"> <section id="mid">
@ -185,8 +209,8 @@
} }
} }
let aka = publicjson[i][goalAmount][0]; let aka = publicjson[i][goalAmount][0];
document.getElementById("sirada-yapilacaklar").innerHTML = aka.split("- ")[1]; document.getElementById("sirada-yapilacaklar").innerHTML = aka.split("- ")[1];
}) })
.catch(err => { .catch(err => {
throw err throw err