Skip to content

Commit

Permalink
Update view.js file
Browse files Browse the repository at this point in the history
  • Loading branch information
kian-ahmadian committed Feb 11, 2024
1 parent 39bd655 commit e92891b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
9 changes: 2 additions & 7 deletions assets/js/view.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
window.onload = async () => {
window.onload = () => {
const xhr = new XMLHttpRequest()
xhr.open("POST", "https://api.python-bale-bot.ir/api/countView")
xhr.setRequestHeader("Content-Type", "application/json")
xhr.onload = () => console.log("View was calculated!")
const data = JSON.stringify({
websiteAddress: "python-bale-bot",
ip: await getIP()
websiteAddress: "python-bale-bot"
})
xhr.send(data)
}

async function getIP(){
return await fetch("https://api.ipify.org/").then((r) => r.text())
}
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ <h3 class="lang-description" id="more-info">برای دریافت مثال ها
<p dir="ltr"><b>2022-Present</b></p>
</footer>
</div>
<script src="assets/js/view.js"></script>
<script src="assets/js/index.js"></script>
<script src="assets/js/modal.js"></script>
<script src="assets/js/copybutton.js"></script>
<script src="assets/js/view.js"></script>
</body>

</html>

0 comments on commit e92891b

Please sign in to comment.