adding the feature "show five"

هذا الالتزام موجود في:
2025-08-19 03:09:38 +03:00
الأصل 7e7a593bf6
التزام d9741b878a
6 ملفات معدلة مع 46 إضافات و11 حذوفات

15
app.js
عرض الملف

@@ -1,5 +1,5 @@
city.focus(); city.focus();
async function getTimes(city, countryCode){ async function getTimes(city, countryCode, wantsAll){
document.getElementById("city").focus() document.getElementById("city").focus()
document.getElementById("show_city").innerText = city.toUpperCase() + " City " document.getElementById("show_city").innerText = city.toUpperCase() + " City "
document.getElementById("show_country").innerText = countryCode.toUpperCase() + " Country" document.getElementById("show_country").innerText = countryCode.toUpperCase() + " Country"
@@ -8,8 +8,17 @@ async function getTimes(city, countryCode){
const parsedResponse = await response.json(); const parsedResponse = await response.json();
const times = parsedResponse.data.timings const times = parsedResponse.data.timings
let container = "" let container = ""
let current = 0
for (const time in times) { for (const time in times) {
container += `<li><span class="cell">${time}</span><span class="cell">${times[time]}</span></li>` if (wantsAll) {
container += `<li><span class="cell">${time}</span><span class="cell">${times[time]}</span></li>`
} else {
const fiveTimes = [0, 2, 3, 5, 6]
if(fiveTimes.includes(current)){
container += `<li><span class="cell">${time}</span><span class="cell">${times[time]}</span></li>`
}
current++
}
} }
document.getElementById("times_container").innerHTML = container document.getElementById("times_container").innerHTML = container
} catch(err){ } catch(err){
@@ -17,4 +26,4 @@ async function getTimes(city, countryCode){
} }
} }
document.getElementById("getTimes").onclick = ()=> getTimes(city.value, code.value) document.getElementById("getTimes").onclick = ()=> getTimes(city.value, code.value, document.getElementById("wantsAll").checked)

عرض الملف

@@ -14,6 +14,10 @@
<label id="code_label">Enter The Country Code</label> <label id="code_label">Enter The Country Code</label>
<input id="code"> <input id="code">
</div> </div>
<div class="show_all">
<label for="wantsAll">Do you want to show all times ? uncheck the box to get only the 5 prayings</label>
<input id="wantsAll" type="checkbox" name="wantsAll">
</div>
<div class="show"> <div class="show">
<button id="getTimes">Get Times</button> <button id="getTimes">Get Times</button>
<h3>Here is the praying times of <span id="show_city"> ____________ </span>City, and <span id="show_country">______ </span>country</h3> <h3>Here is the praying times of <span id="show_city"> ____________ </span>City, and <span id="show_country">______ </span>country</h3>

عرض الملف

@@ -12,6 +12,9 @@ html
.block .block
label#code_label Enter The Country Code label#code_label Enter The Country Code
input#code input#code
.show_all
label(for="wantsAll") Do you want to show all times ? uncheck the box to get only the 5 prayings
input#wantsAll(type="checkbox", name="wantsAll")
.show .show
button#getTimes Get Times button#getTimes Get Times
h3 Here is the praying times of h3 Here is the praying times of

عرض الملف

@@ -21,19 +21,19 @@ div {
width: min(800px, 90%); width: min(800px, 90%);
} }
input { input:not([type=checkbox]) {
padding: 10px 20px; padding: 10px 20px;
border-radius: 5px; border-radius: 5px;
border: none; border: none;
width: 100%; width: 100%;
} }
input:focus { input:not([type=checkbox]):focus {
outline: none; outline: none;
} }
label { label {
display: block; display: block;
margin: 10px 0; margin: 0px 0 10px;
} }
button { button {
@@ -63,4 +63,15 @@ span {
text-align: center; text-align: center;
} }
.show_all {
text-align: center;
display: flex;
justify-content: center;
gap: 20px;
}
.show_all input {
width: 20px;
height: 20px;
}
/*# sourceMappingURL=style.css.map */ /*# sourceMappingURL=style.css.map */

عرض الملف

@@ -1 +1 @@
{"version":3,"sourceRoot":"","sources":["style.sass"],"names":[],"mappings":"AAAA;EACE;EACA;EACA;;;AAEF;EACE;;;AACF;EACE;;;AAEF;EACE;;;AAEF;EACE;EACA;;;AACF;EACE;EACA;EACA;EACA;;AACA;EACE;;;AACJ;EACE;EACA;;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;;;AACF;EACE;;;AACF;EACE;EACA;;;AACF;EACE;EACA;EACA;EACA;EACA;EACA","file":"style.css"} {"version":3,"sourceRoot":"","sources":["style.sass"],"names":[],"mappings":"AAAA;EACE;EACA;EACA;;;AAEF;EACE;;;AACF;EACE;;;AAEF;EACE;;;AAEF;EACE;EACA;;;AACF;EACE;EACA;EACA;EACA;;AACA;EACE;;;AAEJ;EACE;EACA;;;AAEF;EACE;EACA;EACA;EACA;EACA;EACA;;;AACF;EACE;;;AACF;EACE;EACA;;;AACF;EACE;EACA;EACA;EACA;EACA;EACA;;;AACF;EACE;EACA;EACA;EACA;;AAEA;EACE;EACA","file":"style.css"}

عرض الملف

@@ -14,16 +14,17 @@ body
div div
margin: 20px auto margin: 20px auto
width: min(800px, 90%) width: min(800px, 90%)
input input:not([type=checkbox])
padding: 10px 20px padding: 10px 20px
border-radius: 5px border-radius: 5px
border: none border: none
width: 100% width: 100%
&:focus &:focus
outline: none outline: none
input[type=checkbox]
label label
display: block display: block
margin: 10px 0 margin: 0px 0 10px
button button
padding: 10px 20px padding: 10px 20px
@@ -44,8 +45,15 @@ span
margin: 10px -1px margin: 10px -1px
width: 50% width: 50%
text-align: center text-align: center
.show_all
text-align: center
display: flex
justify-content: center
gap: 20px
label
input
width: 20px
height: 20px