-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbadscript.js
More file actions
56 lines (48 loc) · 2.09 KB
/
Copy pathbadscript.js
File metadata and controls
56 lines (48 loc) · 2.09 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
function showClock(offset) {
// Create two variable with the names of the months and days in an array
var monthNames = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ];
var dayNames= ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]
var local_time = new Date();
var newDate = new Date();
// Create a newDate() object
if (offset != 0) {
newDate.setHours(newDate.getHours() - ((offset/60)/60));
}
// Extract the current date from Date object
newDate.setDate(newDate.getDate());
// Output the day, date, month and year
$('#Date').html(dayNames[newDate.getDay()] + " " + newDate.getDate() + ' ' + monthNames[newDate.getMonth()] + ' ' + newDate.getFullYear());
window.setIntervalId = setInterval( function() {
// Create a newDate() object and extract the seconds of the current time on the visitor's
var seconds = new Date().getSeconds();
// Add a leading zero to seconds value
$("#sec").html(( seconds < 10 ? "0" : "" ) + seconds);
// Create a newDate() object and extract the minutes of the current time on the visitor's
var minutes = new Date().getMinutes();
// Add a leading zero to the minutes value
$("#min").html(( minutes < 10 ? "0" : "" ) + minutes);
// Create a newDate() object and extract the hours of the current time on the visitor's
var hours = newDate.getHours();
$("#hours").html((hours < 10 ? "0" : "" ) + (hours));
}, 1000);
}
function getOffset(newTimezone) {
var offset;
$.ajax({
dataType: "json",
url: './getoffset.php',
async: false,
data: 'r='+newTimezone+'&o='+getTimeZone(),
success: function(response) {
offset = response.offset;
}
});
return offset;
}
jQuery(document).ready(function($) {
$.get('swears.txt', function(data) {
var quotes = data.split("\@");
var idx = Math.floor(quotes.length * Math.random());
$('.quotes').html(quotes[idx]);
});
});