Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions about.html
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,12 @@
<h3>Navigation Bar</h3>
<p>The PC navbar of this project is heavily inspired from one of FIRESHIP.IO's episodes. Every thing apart from that is made out of scratch.</p>
<h3>API</h3>
I've built an API to fetch contests' data. Here I'm just calling the API and fetching its data.<br>
I've built an API to fetch contests' data. Here I'm just calling the API and fetching its data.All the data is being pulled from clist.by<br>
<b>API : </b><code>https://cp-contests.vercel.com/</code><br>
<b>Method :</b> <code>GET</code><br>
<b>Parameter :</b> <code>Any valid timezone</code><br>
If you want to learn more about it you can contact me at <b><em>dev.jaybee@gmail.com</em></b><br>
<h3>Developer: <a class="con-link" href="https://terminalwarlord.github.io" target="_blank" rel="noopener noreferrer">TerminalWarlord</a></h3>
<h3>Developer: <a class="con-link" href="https://github.com/TerminalWarlord" target="_blank" rel="noopener noreferrer">TerminalWarlord</a></h3>
<h3>RESOURCES:</h3>
<ol>
<li><a class="con-link" href="https://youtu.be/biOMz4puGt8" target="_blank" rel="noopener noreferrer">NavBar Tutorial</a></li>
Expand Down
20 changes: 10 additions & 10 deletions cf_contests.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ const contests = document.getElementById('recent-centests');
const loader = document.getElementById('loader');
const statsCard = document.getElementById('Cards');
statsCard.classList.add("hide-item");
var timeZone = ''
var timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone
var timeZonePoint = ''
fetch(`https://api.ipregistry.co/?key=xu1vqqbg0xmho0nq`)
.then(response => response.json())
.then(data=>{
timeZonePoint = data.time_zone.current_time;
timeZonePoint = timeZonePoint.substr(timeZonePoint.length-6, timeZonePoint.length);
timeZone = data.time_zone.id;
})
if(timeZone=='') timeZone='Asia/Dhaka', timeZonePoint="+06:00";
// fetch(`https://api.ipregistry.co/?key=xu1vqqbg0xmho0nq`)
// .then(response => response.json())
// .then(data=>{
// timeZonePoint = data.time_zone.current_time;
// timeZonePoint = timeZonePoint.substr(timeZonePoint.length-6, timeZonePoint.length);
// timeZone = data.time_zone.id;
// })
// if(timeZone=='') timeZone='Asia/Dhaka', timeZonePoint="+06:00";

loader.classList.add("hide-item");

Expand Down Expand Up @@ -293,7 +293,7 @@ function fetchMore(username){
fetch(`https://cp-contests.vercel.app/time/?timeZone=${timeZone}`)
.then(response=>response.json())
.then(data=>{
const dateTime = `${data}<br>Timezone : ${timeZonePoint}`;
const dateTime = `${data}<br>Timezone : ${timeZone}`;
const timezone = document.getElementById('timezone').innerHTML = dateTime;
})

Expand Down
10 changes: 3 additions & 7 deletions ip.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,9 @@
</head>
<body>
<script>
fetch(`https://api.ipregistry.co/?key=xu1vqqbg0xmho0nq`)
.then(response => response.json())
.then(data=>{
console.log(data);
console.log(data.time_zone.id);
})

// var timeZone = new Date().getTimezoneOffset();
var timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
console.log(timeZone);
</script>
</body>
</html>
25 changes: 2 additions & 23 deletions running.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,6 @@
// running.addEventListener('click', runningList);

// function runningList(){
// let allRunning = document.getElementById('running-list');
// fetch(`https://cp-contests.vercel.app/running`)
// .then(response => response.json())
// .then(data=>console.log(data))
// }


const contests = document.getElementById('fetch-con');
const loader = document.getElementById('loader');

var timeZone = ''
var timeZonePoint = ''
fetch(`https://api.ipregistry.co/?key=xu1vqqbg0xmho0nq`)
.then(response => response.json())
.then(data=>{
timeZonePoint = data.time_zone.current_time;
timeZonePoint = timeZonePoint.substr(timeZonePoint.length-6, timeZonePoint.length);
timeZone = data.time_zone.id;
})
if(timeZone=='') timeZone='Asia/Dhaka', timeZonePoint="+06:00";

var timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone
fetch(`https://cp-contests.vercel.app/running/?timeZone=${timeZone}`)
.then(response => response.json())
.then(data=>{
Expand Down Expand Up @@ -56,6 +35,6 @@ fetch(`https://cp-contests.vercel.app/running/?timeZone=${timeZone}`)
fetch(`https://cp-contests.vercel.app/time/?timeZone=${timeZone}`)
.then(response=>response.json())
.then(data=>{
const dateTime = `${data}<br>Timezone : ${timeZonePoint}`;
const dateTime = `${data}<br>Timezone : ${timeZone}`;
const timezone = document.getElementById('timezone').innerHTML = dateTime;
})
15 changes: 3 additions & 12 deletions script.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
const running = document.getElementById('fetch-running');
const upcoming = document.getElementById('fetch-upcoming');
const loader = document.getElementById('loader');
// const running = document.getElementById('running');
var timeZone = ''
var timeZonePoint = ''
fetch(`https://api.ipregistry.co/?key=xu1vqqbg0xmho0nq`)
.then(response => response.json())
.then(data=>{
timeZonePoint = data.time_zone.current_time;
timeZonePoint = timeZonePoint.substr(timeZonePoint.length-6, timeZonePoint.length);
timeZone = data.time_zone.id;
})
if(timeZone=='') timeZone='Asia/Dhaka', timeZonePoint="+06:00";
var timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone

fetch(`https://cp-contests.vercel.app/running/?timeZone=${timeZone}`)
.then(response => response.json())
.then(data=>{
Expand Down Expand Up @@ -78,6 +69,6 @@ fetch(`https://cp-contests.vercel.app/?timeZone=${timeZone}`)
fetch(`https://cp-contests.vercel.app/time/?timeZone=${timeZone}`)
.then(response=>response.json())
.then(data=>{
const dateTime = `${data}<br>Timezone : ${timeZonePoint}`;
const dateTime = `${data}<br>Timezone : ${timeZone}`;
const timezone = document.getElementById('timezone').innerHTML = dateTime;
})
2 changes: 1 addition & 1 deletion style.css
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ footer{
#ispc{
display: none;
}
#fetch-upcoming tr th{
#fetch-upcoming tr thm{
font-size: .7rem;
}
#fetch-running tr th,
Expand Down
16 changes: 2 additions & 14 deletions upcoming.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
const contests = document.getElementById('fetch-con');
const loader = document.getElementById('loader');
var timeZone = ''
var timeZonePoint = ''
fetch(`https://api.ipregistry.co/?key=xu1vqqbg0xmho0nq`)
.then(response => response.json())
.then(data=>{
console.log(data);
timeZonePoint = data.time_zone.current_time;
timeZonePoint = timeZonePoint.substr(timeZonePoint.length-6, timeZonePoint.length);
timeZone = data.time_zone.id;
})
if(timeZone=='') timeZone='Asia/Dhaka', timeZonePoint="+06:00";

var timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone
fetch(`https://cp-contests.vercel.app/?timeZone=${timeZone}`)
.then(response => response.json())
.then(data=>{
Expand Down Expand Up @@ -47,7 +36,6 @@ fetch(`https://cp-contests.vercel.app/?timeZone=${timeZone}`)
fetch(`https://cp-contests.vercel.app/time/?timeZone=${timeZone}`)
.then(response=>response.json())
.then(data=>{
const dateTime = `${data}<br>Timezone : ${timeZonePoint}`;
const dateTime = `${data}<br>Timezone : ${timeZone}`;
const timezone = document.getElementById('timezone').innerHTML = dateTime;
})