Skip to content

Commit

Permalink
issues fixed (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
MUDITJAINN authored Oct 3, 2024
1 parent b2242e0 commit e91516e
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 28 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"liveServer.settings.port": 5501
}
10 changes: 5 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@
<a href="https://fuelish.dtho.xyz" target="_blank" rel="noopener noreferrer"><img class="logo-image" src="images/logo.png" width="150px" alt=""></a>
<!-- Sharing icon section -->
<label id="social-sharing-icon" class="hide-the-icon">
<img src="images\icons\material-share.svg" class="m3-share" id="Web-share">
<img src="images\icons\material-share.svg" class="m3-share" id="Web-share" title="Share" alt="Share Icon">
</label>
</div>
<!-- Search box section -->
<div class="container">
<div class="search-box">
<button id="getlocation"><img src="images\icons\material-location.svg" id="getlocation"></button>
<button id="getlocation" title="Get Location"><img src="images\icons\material-location.svg" id="getlocation" alt="Location Icon"></button>
<select name="state" id="state" class="dropdown">
<option value="" selected>Select a state</option>
</select>
<br>
<a href="https://www.google.com/maps/search/petrol+pumps+near+me/" target="_blank" rel="noopener noreferrer"><button><img src="images\icons\material-fuel.svg"></button></a>
<a href="https://www.google.com/maps/search/petrol+pumps+near+me/" target="_blank" rel="noopener noreferrer" title="Find Petrol Pumps"><button><img src="images\icons\material-fuel.svg" alt="Fuel Icon"></button></a>
<select name="city" id="city" disabled class="dropdown">
<option value="" selected disabled style="color: azure;">Select a city</option>
</select>
Expand Down Expand Up @@ -86,8 +86,8 @@
<!-- Footer Section -->
<footer>
<p id="animation">Made with &hearts; in India</p>
<p>Help improve this site! <a href="https://github.com/Doofenshmirtz-Evil-Incorp/Fuelish" target="_blank" rel="noopener noreferrer"><img src="images\icons\fa-gh.svg" style="height: 2.1vh; filter: invert(1)"></a></p>
<a href="https://hits.seeyoufarm.com"><img src="https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fdoofenshmirtz-evil-incorp.github.io%2FFuelish%2Fhit-counter&count_bg=%231AC5B4&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=Total+Visits&edge_flat=false"/></a>
<p>Help improve this site! <a href="https://github.com/Doofenshmirtz-Evil-Incorp/Fuelish" target="_blank" rel="noopener noreferrer"><img src="images\icons\fa-gh.svg" class="github-icon" alt="GitHub Icon"></a></p>
<a href="https://hits.seeyoufarm.com"><img src="https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fdoofenshmirtz-evil-incorp.github.io%2FFuelish%2Fhit-counter&count_bg=%231AC5B4&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=Total+Visits&edge_flat=false" alt="Total Visits Badge"/></a>
<p>©️ 2023-24 <a class="name1" href="https://www.github.com/actuallyaryaman" target="_blank" rel="noopener noreferrer">Aryaman</a> and <a class="name2" href="https://www.github.com/asvin1" target="_blank" rel="noopener noreferrer"> Asvin</a></p>
</footer>
</div>
Expand Down
46 changes: 23 additions & 23 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ let petrolPrice , dieselPrice , petrolChange , dieselChange;
// Create variable to get the selected State and City name
let selectedState , selectedCity;

var cords=[];
var rslt=[];//state data
var datac=[];//city data of select state
var slent;
var clent;
var corlent;
var b0,b1,b2,b3;
var markers=L.layerGroup();
let cords=[];
let rslt=[];//state data
let datac=[];//city data of select state
let slent;
let clent;
let corlent;
let b0,b1,b2,b3;
let markers=L.layerGroup();
const map = L.map('map').setView([25, 75], 3);
const tiles = L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
Expand All @@ -36,10 +36,10 @@ async function getcsv(url,splitter='\r\n')
return await fetch(url)
.then(response => response.text())
.then( data => {
var loc=[];
let loc=[];
const rows = data.split(splitter);
const headers = rows[0].split(',');
var len=rows.length;
let len=rows.length;
for (let i = 1; i < rows.length; i++) {
const row = rows[i].split(',');
if (row.length === headers.length) {
Expand All @@ -60,8 +60,8 @@ async function bharat()
container.style.marginTop = '1px';
st.style.display='block';
map.invalidateSize();
markers=L.layerGroup();var mar;
var order=Closest (cords,[8.058382,77.544730],"Tamil Nadu",markers);
markers=L.layerGroup();let mar;
let order=Closest (cords,[8.058382,77.544730],"Tamil Nadu",markers);
for(let i=0;i<707;i++)
{ map.invalidateSize();
if(parseFloat(order[1][i]["circ"])<300)
Expand Down Expand Up @@ -123,19 +123,19 @@ async function getdata(st,ct)

async function genmark(gs,gc,lat,lon,out)
{
markers=L.layerGroup();var mar;
markers=L.layerGroup();let mar;
mar=L.circleMarker([lat,lon],{
radius:5,
color: 'cyan',
fillColor: 'cyan'
}).bindPopup("Idhar hain aap").openPopup();
markers.addLayer(mar);
var pp,dp;
let pp,dp;
getdata(gs,gc).then(data=>{
pp=parseFloat(data["Price(P)"]).toFixed(2);
dp=parseFloat(data["Price(D)"]).toFixed(2);
});
var pp1,dp1;
let pp1,dp1;
for(let i=0;i<8;i++)
{ await getdata(out[1][i]["State"],out[1][i]["City"]).then(data=>{
pp1=parseFloat(data["Price(P)"]).toFixed(2);
Expand Down Expand Up @@ -182,10 +182,10 @@ const npr = document.getElementById('npr');
getdata(ar[0],ar[1]).then(data=>{
npr.innerHTML="";
npr.innerText=data["City"];
var pp=parseFloat(document.getElementById("pp").innerText).toFixed(2);
var dp=parseFloat(document.getElementById("dp").innerText).toFixed(2);
var pp1=parseFloat(data["Price(P)"]).toFixed(2);
var dp1=parseFloat(data["Price(D)"]).toFixed(2);
let pp=parseFloat(document.getElementById("pp").innerText).toFixed(2);
let dp=parseFloat(document.getElementById("dp").innerText).toFixed(2);
let pp1=parseFloat(data["Price(P)"]).toFixed(2);
let dp1=parseFloat(data["Price(D)"]).toFixed(2);
if((pp-pp1)>=0)
npr.innerHTML+="<p style='color: #72ff72'>"+"Petrol : "+data["Price(P)"]+"("+(pp1-pp).toFixed(2)+")"+"</p>";
else
Expand All @@ -209,7 +209,7 @@ getLoc.addEventListener('click', event => {
fetch('https://nominatim.openstreetmap.org/reverse?format=jsonv2&lat='+latitude+'&lon='+longitude)
.then(response => response.json())
.then(async data => {
var out=Closest(cords,[latitude,longitude],data["address"]["state"],markers);
let out=Closest(cords,[latitude,longitude],data["address"]["state"],markers);
[gcity,gstate]=out[0];
document.getElementById("state").value=gstate;
console.log(document.getElementById("state").value);
Expand All @@ -226,7 +226,7 @@ getLoc.addEventListener('click', event => {
}
});
window.onload=async ()=>{
var status=0;
let status=0;
while(status!=2){
await getcsv('https://rapid-wave-c8e3.redfor14314.workers.dev/https://raw.githubusercontent.com/Fuelish/FuelishCLI/main/State.csv')
.then(data =>{
Expand All @@ -245,7 +245,7 @@ window.onload=async ()=>{
}

async function getcord(city)
{ var arr=[];var i,bl,bound=[];
{ let arr=[];let i,bl,bound=[];
arr=await fetch('https://nominatim.openstreetmap.org/search.php?q='+city.replace(/ /g, '+')+'&format=jsonv2')
.then(response => response.json())
.then(data => {
Expand Down Expand Up @@ -342,7 +342,7 @@ document.getElementById('social-sharing-icon').classList.remove('hide-the-icon')
{
if(cords[j]["City"]==city.value)
{
var out=Closest(cords,[cords[j]["lat"],cords[j]["long"]],state.value,markers);
let out=Closest(cords,[cords[j]["lat"],cords[j]["long"]],state.value,markers);
genmark(state.value,city.value,cords[j]["lat"],cords[j]["long"],out);
break;
}
Expand Down

0 comments on commit e91516e

Please sign in to comment.