123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413 |
- <?php
- include '../auth.php';
- ?>
- <html>
- <head>
- <?php
- //header("Content-Type: text/plain");
- $bg = array('1.jpeg','2.jpeg','3.jpeg','4.jpeg','5.jpeg','6.jpeg','7.jpeg','8.jpeg','9.jpeg'); // array of filenames
- $i = rand(0, count($bg)-1); // generate random number size of the array
- $selectedBg = "$bg[$i]"; // set variable equal to which random filename was chosen
- ?>
- <title>ArOZ Mirror</title>
- <link rel="stylesheet" href="../script/tocas/tocas.css">
- <script src="../script/tocas/tocas.js"></script>
- <script src="../script/jquery.min.js"></script>
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/weather-icons/2.0.9/css/weather-icons-wind.min.css">
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/weather-icons/2.0.9/css/weather-icons.min.css">
- <style>
- h1 { margin:0 0 10px 0; }
- .wrapper { position: relative; height:200px; width:300px; margin:20px 0; overflow:hidden; }
- .content { position:absolute; bottom:0; width:100%; }
- .content div { padding:10px;}
-
- body{
- background: url(img/bg/<?php echo $selectedBg; ?>);
- background-size: auto 100%;
- background-repeat: no-repeat;
- background-attachment: fixed;
- background-position: center top;
- }
- </style>
- <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
- <!-- style="background-color:black;color:white;" -->
- </head>
- <body style="color:white;height:100%;">
- <div id="time" align="right" style="position: fixed; top: 10%; right: 5%; width: auto; height: 300px;">
- <div id="dayOfWeek" style="font-size: 5vh;height:5vh;"></div>
- <div id="CurrentDate" style="font-size: 4vh;height:4vh;"></div>
- <div id="CurrentTime" style="font-size: 3vh;height:3vh;"></div>
- </div>
- <div id="weather" align="left" style="position: fixed; top: 10%; left: 5%; width: auto; height: 500px;">
- <div style="font-size: 4vh;height:4vh;" id="country" style="text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black !important;"></div>
- <div style="font-size: 2vh;height:2vh;">
- <div class="h1"></div>
- <p id="city" style="font-size: 3vh;"></p>
- <br>
- <P><i class="wi wi-night-sleet" style="font-size:80px" id="weathericon"></i></p>
- <div class="h2" id="temp" style="text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;"></div>
- <p id="description" style="text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;"></p>
- <!-- <br class="clear"> -->
- <p id="forecast_details" style="text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;"></p>
- <p id="wind_details" style="text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;"></p>
- </div>
- </div>
- </body>
- <script>
- $( document ).ready(function() {
- var t = setInterval(updateTime,1000);
- //show(22.302242, 114.174052);
- setTimeout(getLocation(),1500);
- });
- function updateTime(){
- var currentdate = new Date();
- $("#dayOfWeek").html(GetDay());
- $("#CurrentTime").html(zeroFill(currentdate.getHours(),2) + ":"+ zeroFill(currentdate.getMinutes(),2) + ":" + zeroFill(currentdate.getSeconds(),2));
- //$("#CurrentDate").html(currentdate.getDate() + "/" + (currentdate.getMonth()+1) + "/" + currentdate.getFullYear());
- $("#CurrentDate").html(GetMonthName() + " " + currentdate.getDate() +", " + currentdate.getFullYear());
- }
- function GetDay(){
- var d = new Date();
- var weekday = new Array(7);
- weekday[0] = "Sunday";
- weekday[1] = "Monday";
- weekday[2] = "Tuesday";
- weekday[3] = "Wednesday";
- weekday[4] = "Thursday";
- weekday[5] = "Friday";
- weekday[6] = "Saturday";
- var n = weekday[d.getDay()];
- return n;
- }
- function GetMonthName(){
- var monthNames = ["January", "February", "March", "April", "May", "June","July", "August", "September", "October", "November", "December"];
- var d = new Date();
- return(monthNames[d.getMonth()]);
- }
- function zeroFill( number, width )
- {
- width -= number.toString().length;
- if ( width > 0 )
- {
- return new Array( width + (/\./.test( number ) ? 2 : 1) ).join( '0' ) + number;
- }
- return number + ""; // always return a string
- }
- </script>
- <script>
- function getLocation() {
- if (localStorage.getItem("MagicPanel-location") !== null && localStorage.getItem("MagicPanel-location") !== undefined ){
- var tmp = JSON.parse(localStorage.getItem("MagicPanel-location"));
- show(parseFloat(tmp[0]),parseFloat(tmp[1]));
- return;
- }
- if (confirm("Manual enter Latitude and Longitude?")){
- var lt = prompt("Latitude", "22.303797");
- var ln = prompt("Longitude", "114.179455");
- show(parseFloat(lt),parseFloat(ln));
- localStorage.setItem("MagicPanel-location",JSON.stringify([lt,ln]));
- }else{
- if (navigator.geolocation) {
- navigator.geolocation.getCurrentPosition(showPosition);
- } else {
- console.log("Geolocation is not supported by this browser.");}
- }
- }
-
- function showPosition(position) {
- console.log("Latitude: " + position.coords.latitude + "Longitude: " + position.coords.longitude);
- show(position.coords.latitude , position.coords.longitude);
- }
- function show(lt , ln){
- $.getJSON( "https://fcc-weather-api.glitch.me/api/current?lat=" + lt.toFixed(5) + "&lon=" + ln.toFixed(5), function( data ) {
- if(typeof data.sys.country !== "undefined"){
- $( "#country" ).text(ISO3166[data.sys.country]);
- }
- if(typeof data.name !== "undefined"){
- $( "#city" ).text(data.name);
- }
- if(typeof data.weather[0].id !== "undefined"){
- $( "#weathericon").attr('class',"wi wi-owm-" + data.weather[0].id);
- }
- if(typeof data.main.temp !== "undefined"){
- $( "#temp" ).text(data.main.temp + " °C");
- }
- if(typeof data.weather[0].main !== "undefined"){
- $( "#description" ).text(data.weather[0].main);
- }
- if(typeof data.main.temp_max !== "undefined" && typeof data.main.temp_min !== "undefined"){
- $( "#forecast_details" ).html('Forecast: ' + data.main.temp_max + ' / ' + data.main.temp_min + ' °C');
- }
- if(typeof data.wind.speed !== "undefined"){
- $( "#wind_details" ).html('Wind: ' + data.wind.speed + ' km/h');
- }
- if(typeof data.wind.deg !== "undefined"){
- $( "#wind_details" ).append(' <span class="comp sa20" ><i class="wi wi-wind towards-' + data.wind.deg + '-deg"></i></span> from ' + data.wind.deg + 'degree');
- }
- });
- }
- var ISO3166 = {
- "AF": "Afghanistan",
- "AX": "land Islands",
- "AL": "Albania",
- "DZ": "Algeria",
- "AS": "American Samoa",
- "AD": "Andorra",
- "AO": "Angola",
- "AI": "Anguilla",
- "AQ": "Antarctica",
- "AG": "Antigua and Barbuda",
- "AR": "Argentina",
- "AM": "Armenia",
- "AW": "Aruba",
- "AU": "Australia",
- "AT": "Austria",
- "AZ": "Azerbaijan",
- "BS": "Bahamas",
- "BH": "Bahrain",
- "BD": "Bangladesh",
- "BB": "Barbados",
- "BY": "Belarus",
- "BE": "Belgium",
- "BZ": "Belize",
- "BJ": "Benin",
- "BM": "Bermuda",
- "BT": "Bhutan",
- "BO": "Bolivia",
- "BQ": "Bonaire",
- "BA": "Bosnia and Herzegovina",
- "BW": "Botswana",
- "BV": "Bouvet Island",
- "BR": "Brazil",
- "IO": "British Indian Ocean Territory",
- "BN": "Brunei Darussalam",
- "BG": "Bulgaria",
- "BF": "Burkina Faso",
- "BI": "Burundi",
- "KH": "Cambodia",
- "CM": "Cameroon",
- "CA": "Canada",
- "CV": "Cape Verde",
- "KY": "Cayman Islands",
- "CF": "Central African Republic",
- "TD": "Chad",
- "CL": "Chile",
- "CN": "China",
- "CX": "Christmas Island",
- "CC": "Cocos (Keeling) Islands",
- "CO": "Colombia",
- "KM": "Comoros",
- "CG": "Congo",
- "CD": "Congo",
- "CK": "Cook Islands",
- "CR": "Costa Rica",
- "CI": "Cte d'Ivoire",
- "HR": "Croatia",
- "CU": "Cuba",
- "CW": "Curaao",
- "CY": "Cyprus",
- "CZ": "Czech Republic",
- "DK": "Denmark",
- "DJ": "Djibouti",
- "DM": "Dominica",
- "DO": "Dominican Republic",
- "EC": "Ecuador",
- "EG": "Egypt",
- "SV": "El Salvador",
- "GQ": "Equatorial Guinea",
- "ER": "Eritrea",
- "EE": "Estonia",
- "ET": "Ethiopia",
- "FK": "Falkland Islands (Malvinas)",
- "FO": "Faroe Islands",
- "FJ": "Fiji",
- "FI": "Finland",
- "FR": "France",
- "GF": "French Guiana",
- "PF": "French Polynesia",
- "TF": "French Southern Territories",
- "GA": "Gabon",
- "GM": "Gambia",
- "GE": "Georgia",
- "DE": "Germany",
- "GH": "Ghana",
- "GI": "Gibraltar",
- "GR": "Greece",
- "GL": "Greenland",
- "GD": "Grenada",
- "GP": "Guadeloupe",
- "GU": "Guam",
- "GT": "Guatemala",
- "GG": "Guernsey",
- "GN": "Guinea",
- "GW": "Guinea-Bissau",
- "GY": "Guyana",
- "HT": "Haiti",
- "HM": "Heard Island and McDonald Islands",
- "VA": "Holy See (Vatican City State)",
- "HN": "Honduras",
- "HK": "Hong Kong",
- "HU": "Hungary",
- "IS": "Iceland",
- "IN": "India",
- "ID": "Indonesia",
- "IR": "Iran",
- "IQ": "Iraq",
- "IE": "Ireland",
- "IM": "Isle of Man",
- "IL": "Israel",
- "IT": "Italy",
- "JM": "Jamaica",
- "JP": "Japan",
- "JE": "Jersey",
- "JO": "Jordan",
- "KZ": "Kazakhstan",
- "KE": "Kenya",
- "KI": "Kiribati",
- "KP": "Korea",
- "KR": "Korea",
- "KW": "Kuwait",
- "KG": "Kyrgyzstan",
- "LA": "Lao People's Democratic Republic",
- "LV": "Latvia",
- "LB": "Lebanon",
- "LS": "Lesotho",
- "LR": "Liberia",
- "LY": "Libya",
- "LI": "Liechtenstein",
- "LT": "Lithuania",
- "LU": "Luxembourg",
- "MO": "Macao",
- "MK": "Macedonia",
- "MG": "Madagascar",
- "MW": "Malawi",
- "MY": "Malaysia",
- "MV": "Maldives",
- "ML": "Mali",
- "MT": "Malta",
- "MH": "Marshall Islands",
- "MQ": "Martinique",
- "MR": "Mauritania",
- "MU": "Mauritius",
- "YT": "Mayotte",
- "MX": "Mexico",
- "FM": "Micronesia",
- "MD": "Moldova",
- "MC": "Monaco",
- "MN": "Mongolia",
- "ME": "Montenegro",
- "MS": "Montserrat",
- "MA": "Morocco",
- "MZ": "Mozambique",
- "MM": "Myanmar",
- "NA": "Namibia",
- "NR": "Nauru",
- "NP": "Nepal",
- "NL": "Netherlands",
- "NC": "New Caledonia",
- "NZ": "New Zealand",
- "NI": "Nicaragua",
- "NE": "Niger",
- "NG": "Nigeria",
- "NU": "Niue",
- "NF": "Norfolk Island",
- "MP": "Northern Mariana Islands",
- "NO": "Norway",
- "OM": "Oman",
- "PK": "Pakistan",
- "PW": "Palau",
- "PS": "Palestine",
- "PA": "Panama",
- "PG": "Papua New Guinea",
- "PY": "Paraguay",
- "PE": "Peru",
- "PH": "Philippines",
- "PN": "Pitcairn",
- "PL": "Poland",
- "PT": "Portugal",
- "PR": "Puerto Rico",
- "QA": "Qatar",
- "RE": "Runion",
- "RO": "Romania",
- "RU": "Russian Federation",
- "RW": "Rwanda",
- "BL": "Saint Barthlemy",
- "SH": "Saint Helena",
- "KN": "Saint Kitts and Nevis",
- "LC": "Saint Lucia",
- "MF": "Saint Martin (French part)",
- "PM": "Saint Pierre and Miquelon",
- "VC": "Saint Vincent and the Grenadines",
- "WS": "Samoa",
- "SM": "San Marino",
- "ST": "Sao Tome and Principe",
- "SA": "Saudi Arabia",
- "SN": "Senegal",
- "RS": "Serbia",
- "SC": "Seychelles",
- "SL": "Sierra Leone",
- "SG": "Singapore",
- "SX": "Sint Maarten (Dutch part)",
- "SK": "Slovakia",
- "SI": "Slovenia",
- "SB": "Solomon Islands",
- "SO": "Somalia",
- "ZA": "South Africa",
- "GS": "South Georgia and the South Sandwich Islands",
- "SS": "South Sudan",
- "ES": "Spain",
- "LK": "Sri Lanka",
- "SD": "Sudan",
- "SR": "Suriname",
- "SJ": "Svalbard and Jan Mayen",
- "SZ": "Swaziland",
- "SE": "Sweden",
- "CH": "Switzerland",
- "SY": "Syrian Arab Republic",
- "TW": "Taiwan",
- "TJ": "Tajikistan",
- "TZ": "Tanzania",
- "TH": "Thailand",
- "TL": "Timor-Leste",
- "TG": "Togo",
- "TK": "Tokelau",
- "TO": "Tonga",
- "TT": "Trinidad and Tobago",
- "TN": "Tunisia",
- "TR": "Turkey",
- "TM": "Turkmenistan",
- "TC": "Turks and Caicos Islands",
- "TV": "Tuvalu",
- "UG": "Uganda",
- "UA": "Ukraine",
- "AE": "United Arab Emirates",
- "GB": "United Kingdom",
- "US": "United States",
- "UM": "United States Minor Outlying Islands",
- "UY": "Uruguay",
- "UZ": "Uzbekistan",
- "VU": "Vanuatu",
- "VE": "Venezuela",
- "VN": "Viet Nam",
- "VG": "Virgin Islands",
- "VI": "Virgin Islands",
- "WF": "Wallis and Futuna",
- "EH": "Western Sahara",
- "YE": "Yemen",
- "ZM": "Zambia",
- "ZW": "Zimbabwe"
- }
- </script>
- </html>
|