forked from sakshigandhi/daily
-
Notifications
You must be signed in to change notification settings - Fork 0
/
daily.js
33 lines (26 loc) · 929 Bytes
/
daily.js
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
var d = new Date();
var n = d.getDate(),
m = d.getMonth()+ 1,
y = d.getFullYear(),
diff = (y - 1985)%30;
y = 1985 + diff;
if(n<10) n = '0' + n;
if(m<10) m = '0' + m;
var date = y+''+m+''+n;
function getImageSource() {
var url = "http://marcel-oehler.marcellosendos.ch/comics/ch/"
url = url + '' + y + '/' + m + '/' + date + '.gif';
document.getElementById('comicImage').src = url;
document.getElementById('facebookShare').href =
"http://www.facebook.com/sharer/sharer.php?u=" + url;
document.getElementById('twitterShare').href =
href="https://twitter.com/intent/tweet?url=" + url +
"&text=Calvin%20and%20Hobbes&via=daily_extension";
}
function getDateHeading() {
document.getElementById('comicTitle').innerHTML = "Calvin and Hobbes by Bill Watterson "+n+'-'+m+'-'+y;
}
document.addEventListener('DOMContentLoaded', function() {
getImageSource();
getDateHeading();
});