Możliwość dodania API do przeglądarki
This commit is contained in:
+1
-1
@@ -36,7 +36,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -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 city = getCookie("city") != "" ? getCookie("city") : "3093133";
|
||||||
let type = getCookie("type") != "" ? getCookie("type") : "id";
|
let type = getCookie("type") != "" ? getCookie("type") : "id";
|
||||||
|
|
||||||
@@ -67,3 +70,14 @@ function getCookie(cname) {
|
|||||||
}
|
}
|
||||||
return "";
|
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();
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user