Dark Sky - Simple 5-day Forecast
How do I make an dark sky - simple 5-day forecast?
What is a dark sky - simple 5-day forecast? How do you make a dark sky - simple 5-day forecast? This script and codes were developed by Sky on 29 January 2023, Sunday.
Dark Sky - Simple 5-day Forecast - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Dark Sky - Simple 5-day Forecast</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="container-fluid text-center"> <h1>Weather App</h1> <p id="location"></p>
</div>
<div id="forecast" class="container">
</div> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/skycons/1396634940/skycons.min.js'></script>
<script src='js/mmdaog.js'></script> <script src="js/index.js"></script>
</body>
</html>
Dark Sky - Simple 5-day Forecast - Script Codes CSS Codes
html { height: 100vh;
}
body { background-image: -webkit-linear-gradient( 315deg, #FCCF31 0%, #F55555 100%); background-image: linear-gradient( 135deg, #FCCF31 0%, #F55555 100%); color: #eee; text-align: center; font-family: verdana; font-size: 16px; padding-top: 70px;
}
#forecast { margin-top: 2em;
}
.forecast-day { border: 1px solid #eee; display: inline-block; width: 240px; margin: .5em; box-shadow: 0 8px 17px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
}
.date { margin-bottom: 0;
}
.temperature:hover { cursor: pointer; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; text-decoration: underline;
}
canvas { vertical-align:middle; margin: 1em;
}
Dark Sky - Simple 5-day Forecast - Script Codes JS Codes
"use strict";
// get the location
getCoords().then(getWeather);
// use the location to call the weather API and the Google Maps API for City/Region/Country display
function getWeather(location) { $.getJSON("https://api.darksky.net/forecast/e384cf6eba5746799aff9814ac6c3480/" + location + "?callback=?", handleWeather); $.getJSON("https://maps.googleapis.com/maps/api/geocode/json?latlng=" + location, showLocation);
}
function handleWeather(data) { // create HTML for 5 days $('#forecast').empty(); for (var i = 0; i < 5; i++) { $('#forecast').append("<div class=\"forecast-day\" id=\"forecast-day-" + i + "\">\n <p id=\"date-" + i + "\" class=\"date\"></p>\n <span id=\"min-temperature-" + i + "\" class=\"temperature\"></span>\n <canvas id=\"skycon-" + i + "\" height=64 width=64></canvas>\n <span id=\"max-temperature-" + i + "\" class=\"temperature\"></span>\n </div>"); } for (var day in data.daily.data) { showWeather(data.daily.data[day], day); }
}
// show the weather
function showWeather(data, day) { var minfahrenheit = Math.round(data.temperatureMin), mintemperature = { F: minfahrenheit + " °F", C: Math.round((minfahrenheit - 32) * 5 / 9) + " °C", unit: "F" }, maxfahrenheit = Math.round(data.temperatureMax), maxtemperature = { F: maxfahrenheit + " °F", C: Math.round((maxfahrenheit - 32) * 5 / 9) + " °C", unit: "F" }, d = new Date(data.time * 1000); $("#date-" + day).html(d.toLocaleDateString()); // add the temperature data to the temperature element and switch between F/C on click $("#min-temperature-" + day).data(mintemperature).html(mintemperature.F).on("click", function () { $(this).html(mintemperature[mintemperature.unit = mintemperature.unit === "F" ? "C" : "F"]); }); $("#max-temperature-" + day).data(maxtemperature).html(maxtemperature.F).on("click", function () { $(this).html(maxtemperature[maxtemperature.unit = maxtemperature.unit === "F" ? "C" : "F"]); }); // add the icon var skycons = new Skycons({ color: "#eee" }); skycons.add(document.getElementById('skycon-' + day), data.icon); skycons.play();
}
// get city + region + country and display on the page
function showLocation(geoData) { var city = "", region = "", country = ""; geoData.results[0].address_components.forEach(function (addressComponent) { var types = addressComponent.types.join(","); // change "long_name" to "short_name" as desired for formatting if (types === "locality,political") city = addressComponent.long_name; if (types === "administrative_area_level_1,political") region = addressComponent.long_name; if (types === "country,political") country = addressComponent.long_name; }); $("#location").html(city + ", " + region + ", " + country);
}
Developer | Sky |
Username | skycoder |
Uploaded | January 29, 2023 |
Rating | 3 |
Size | 4,941 Kb |
Views | 2,024 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
JSONP Examples with the Dark Sky API | 5,884 Kb |
Random Quote Machine | 2,259 Kb |
Ionicons | 6,688 Kb |
Media Queries | 2,045 Kb |
Bootstrap 3 Grid Example | 2,111 Kb |
Feather Icons | 2,918 Kb |
A Pen by Sky | 4,531 Kb |
Use the Twitch.tv JSON API | 2,862 Kb |
Portfolio - Work In Progress | 4,572 Kb |
Show the Local Weather - and a local background image | 8,205 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
BSP Dungeon Generation | Xgundam05 | 5,326 Kb |
Slide out Menu | Rbiggs | 4,936 Kb |
Simple Accordion | Wearebold | 3,683 Kb |
Svg penguin | _massimo | 2,990 Kb |
WRENCH - STAFF | Lolita-adams | 1,608 Kb |
RAQuote | Naderk007 | 4,412 Kb |
Nested table email layout | Massimo-cassandro | 2,355 Kb |
Scroll effect with text with help from Skrollr | Luxonglassing | 2,935 Kb |
Simple Weather App | Cmwebby | 0 Kb |
Typefaces with descriptions | Megandoty | 2,944 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!