Skip to content

Commit

Permalink
jumps added
Browse files Browse the repository at this point in the history
  • Loading branch information
AfzGit committed Jul 16, 2024
1 parent 66defaa commit a73f955
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ <h4 id="copy-status" style="background-color: darkgoldenrod">
Clipboard
</h4>
<h3 id="result" style="background-color: rosybrown">Urls</h3>
<p id="jump2"></p>
</div>
<script src="script.js"></script>
</body>
Expand Down
24 changes: 21 additions & 3 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ const site2 = "https://quranwbw.com/";
// https://tanzil.net/#2:6
const site3 = "https://tanzil.net/";

const jump = `<a href="#quran">Quran</a> - <a href="#copy-status">Clipboard</a> - <a href="#result">Urls</a>`;
const jumpTafsir = `<a href="#quran">Quran</a> - <a href="#tafsir-print">Tafsir</a> - <a href="#copy-status">Clipboard</a> - <a href="#result">Urls</a>`;

// copy variables
let fullc, arc, enc, tafsirCopy;

Expand Down Expand Up @@ -249,11 +252,11 @@ document.getElementById("urlForm").addEventListener("submit", function (e) {
console.error("Error fetching data:", error);
document.getElementById(
"quran"
).innerHTML = `${error}<br><br>Potential culprits: <br>- Website/Network problem. <br>- Are you sure the Ayah number is correct for that Surah?<br><br>Try the Urls above instead.`;
).innerHTML = `${error}<br><br>Potential culprits: <br>- Website/Network problem. <br>- Are you sure the Ayah number is correct for that Surah?<br><br>Try the Urls below instead.`;
});

if (!tafsirHTML == "") {
// Append Tafsir
// insert Tafsir
getTafsir(surah, ayahNum, tafsirHTML)
.then((tafsir) => {
document.getElementById("tafsir-print").style.display =
Expand Down Expand Up @@ -281,10 +284,25 @@ document.getElementById("urlForm").addEventListener("submit", function (e) {
console.error("Error fetching tafsir: ", error);
document.getElementById(
"tafsir-print"
).innerHTML = `${error}<br><br>Potential culprits: <br>- Website/Network problem. <br>- Are you sure the Ayah number is correct for that Surah?<br><br>Try the Urls above instead.`;
).innerHTML = `${error}<br><br>Potential culprits: <br>- Website/Network problem. <br>- Are you sure the Ayah number is correct for that Surah?<br><br>Try the Urls below instead.`;
});

// jumpers top and bottom
document.getElementById(
"buttons"
).innerHTML += `<br><br>Jump to: ${jumpTafsir} - <a href="#jump2">Bottom</a>`;
document.getElementById(
"jumpBottom"
).innerHTML = `Jump To: ${jumpTafsir} - <a href="#">Top</a>`;
} else {
document.getElementById("tafsir-print").style.display = "none";
// jumpers top and bottom
document.getElementById(
"buttons"
).innerHTML += `<br><br>Jump to: ${jump} - <a href="#jump2">Bottom</a>`;
document.getElementById(
"jump2"
).innerHTML += `Jump to: ${jump} - <a href="#">Top</a>`;
}
}
});

0 comments on commit a73f955

Please sign in to comment.