Możliwość dodania API do przeglądarki

This commit is contained in:
Christopher
2024-02-01 03:04:27 +01:00
committed by GitHub
parent b75cc4ebef
commit 3648dd880b
2 changed files with 16 additions and 2 deletions
+1 -1
View File
@@ -36,7 +36,7 @@
</div>
</div>
<br>
<h4 class="author">Stworzone przez <a href="https://www.smaga.me">Krzysztof Smaga</a><br>Wykorzystano: <a href="https://openweathermap.org">OpenWeatherMap API</a></h4>
<h4 class="author">Stworzone przez <a href="https://www.smaga.me">Krzysztof Smaga</a><br>Wykorzystano: <a href="https://openweathermap.org">OpenWeatherMap API</a><br><span onclick="addApi()">Dodaj API do ciasteczek</span></h4>
</div>
</div>
</body>
+15 -1
View File
@@ -1,4 +1,7 @@
let api = "{ADD_YOUR_API_KEY}";
if(getCookie("api") == "")
addApi();
let api = getCookie("api") != "" ? getCookie("api") : "";
let city = getCookie("city") != "" ? getCookie("city") : "3093133";
let type = getCookie("type") != "" ? getCookie("type") : "id";
@@ -66,4 +69,15 @@ function getCookie(cname) {
}
}
return "";
}
function addApi(){
let temp_api = prompt("Podaj swoje API, które zapiszesz w ciasteczkach swojej przeglądarki:");
if(temp_api != null && temp_api != "")
api = temp_api;
setCookie("api", api);
call();
}