Skip to content

Commit

Permalink
quieres
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonyhuang07 committed Mar 8, 2024
1 parent 6e063e2 commit fd7ebe5
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 51 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta charset="utf-8">
<title>Ontario IB Converter</title>
<meta content="Ontario IB Mark Converter" property="og:title" />
<meta content="A website to help you convert your IB Raw Marks!" property="og:description" />
<meta name="description" content="A website to help you convert your IB Raw Marks to Ontario Marks!" property="og:description" />
<meta content="https://ah07.xyz/ibconverter" property="og:url" />
<meta content="https://www.ibschoolsofontario.ca/wp-content/uploads/2018/12/IB-world-shools-1.png"
property="og:image" />
Expand Down
78 changes: 28 additions & 50 deletions scripts/converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,67 +117,45 @@ function convert() {
fetch(jsons[subject.value])
.then(response => response.json())
.then(data => {
let val = undefined;
if (mode.value == "raw") {
let val = parseInt(Math.floor(parseFloat(mark.value)));
if (mark.value == "") {
alert("Please enter a valid number.")
} else {

converted.innerHTML = ""
joobi.src = ""

for (let level in data) {
if (data[level][val] !== undefined) {
let levelNum = parseInt(level.match(/\d+/)[0], 10) - 1;
joobi.src = emojis[levelNum];
joobi.alt = level;

if (matchMedia('only screen and (max-width: 900px)').matches) {
colSpan.innerHTML = level
location.href = "#sub"
} else {
colSpan.innerHTML = level + ":&nbsp;"
}

colSpan.style.color = colors[levelNum]
textSpan.innerHTML = data[level][val] + "%";

converted.appendChild(colSpan);
converted.appendChild(textSpan);

break;
}
}
val = parseInt(Math.floor(parseFloat(mark.value)));
}
} else if (mode.value == "frac") {
let val = parseInt(Math.floor(parseFloat(mark21.value/mark22.value) * 100)) ;
if (mark21.value == "" || mark22.value == "" || val > 100) {
alert("Please enter a valid mark.")
} else {
converted.innerHTML = ""
joobi.src = ""

for (let level in data) {
if (data[level][val] !== undefined) {
let levelNum = parseInt(level.match(/\d+/)[0], 10) - 1;
joobi.src = emojis[levelNum];
joobi.alt = level;

if (matchMedia('only screen and (max-width: 900px)').matches) {
colSpan.innerHTML = level
location.href = "#sub"
} else {
colSpan.innerHTML = level + ":&nbsp;"
}

colSpan.style.color = colors[levelNum]
textSpan.innerHTML = data[level][val] + "%";

converted.appendChild(colSpan);
converted.appendChild(textSpan);
val = parseInt(Math.floor(parseFloat(mark21.value/mark22.value) * 100)) ;
}
}

break;
if (val !== undefined) {
converted.innerHTML = ""
joobi.src = ""

for (let level in data) {
if (data[level][val] !== undefined) {
let levelNum = parseInt(level.match(/\d+/)[0], 10) - 1;
joobi.src = emojis[levelNum];
joobi.alt = level;

if (matchMedia('only screen and (max-width: 900px)').matches) {
colSpan.innerHTML = level
location.href = "#sub"
} else {
colSpan.innerHTML = level + ":&nbsp;"
}

colSpan.style.color = colors[levelNum]
textSpan.innerHTML = data[level][val] + "%";

converted.appendChild(colSpan);
converted.appendChild(textSpan);

break;
}
}
}
Expand Down

0 comments on commit fd7ebe5

Please sign in to comment.