Repository navigation
Expand file tree
/
Copy pathscripts.php
More file actions
81 lines (71 loc) · 2.34 KB
/
Copy pathscripts.php
File metadata and controls
81 lines (71 loc) · 2.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php if(!isset($TIMEZONE))
{
$TIMEZONE = 0;
}
?>
<!-- Put all JQuery and other script here. -->
<script type="text/javascript">
// Div animation options
AOS.init({duration: 1200});
// Displays information when hovering over countries
$(document).ready(function(){
$('[data-toggle="tooltip"]').tooltip();
});
// Sets the Zoom as active on the world map view.
$(document).ready(function() {
$("#element").zoomTarget();
});
// Sets a delay on the world map URL's so the animation can play out.
function delay (URL) { setTimeout( function() { window.location = URL }, 500 );}
// Full screen loading activator.
$(document).ready(function() { $(".animsition").animsition();});
// Moment.JS function. Gets the time for a specific location.
$(document).ready(function() {
var timezone = '<?php echo $TIMEZONE ?>';
if (timezone !== null) {
// instantiate a moment object
var NowMoment = moment().utcOffset(<?php echo $TIMEZONE ?>).format('llll');
// instantiate a JavaScript Date object
// var NowDate = new Date();
// display value of moment object in #displayMoment div
var eDisplayMoment = document.getElementById('displayMoment');
eDisplayMoment.innerHTML = NowMoment;
// display value of Date object in #displayJsDate div
var eDisplayDate = document.getElementById('displayJsDate');
console.log(timezone);
};
});
<?php if(!isset($CITY)){
$CITY = 'London';
}
?>
// Set the city page to a variable for JSON / AJAX
var cityInput = '<?php echo $CITY ?>';
// If the city name is not empty:
if (cityInput !== null) {
// Create a function that gets the city details via weather API.
function getWeather(cityInput, callback) {
var city = cityInput;
var format = '&units=metric';
var apikey = '&appid=081cd01d8e673a2fae8ea192acd8715b';
var url = 'http://api.openweathermap.org/data/2.5/weather?q=' + city + format + apikey;
$.ajax({
dataType: "json",
url: url,
jsonCallback: 'json',
data: { 'main': 'temp' },
cache: false,
success: function (data) {
console.log(url);
console.log(data.main.temp);
}
}).done(function ( data ) {
$('#weather').append(data.main.temp + ' °C');
});
}
$(document).ready(function() {
getWeather(cityInput, 'Callback');
});
};
</script>
</body> <!-- DO NOT DELETE BODY TAG!!! No content below this line. Body start tag is in the header.php file. -->