-
Notifications
You must be signed in to change notification settings - Fork 9
/
flickrset.html
93 lines (87 loc) · 2.21 KB
/
flickrset.html
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
82
83
84
85
86
87
88
89
90
91
92
93
<head>
<title>New Tab</title>
<style>
#byline {
position: absolute;
bottom: 3%;
left: 3%;
}
#wrapper {
background-color: #EEE;
opacity: 0;
-webkit-transition-property: opacity;
-webkit-transition-duration: 0.8s;
padding: 0.4em;
border-radius: 6px;
font-family: sans-serif;
display: block;
}
a:link, a:visited {
color: #333;
text-decoration: none;
}
span.title {
font-size: large;
}
span.owner {
font-size: small;
}
</style>
</head>
<body>
<div id="byline">
<a href="#" id="wrapper">
</a>
</div>
<script>
var cachedImages = JSON.parse(localStorage["photoCache"]);
var whichImage = Math.round(Math.random() * (cachedImages.length - 1));
var cached = cachedImages[whichImage];
document.body.style.backgroundImage = "url(" + cached.src + ")";
document.body.style.backgroundSize = "cover";
var byline = document.getElementById("wrapper");
byline.href =
'http://www.flickr.com/photos/' + cached.owner + '/' + cached.id;
if (false && localStorage['showTitle']) {
var title = document.createElement("span");
title.setAttribute("class", "title");
if (cached.title) {
var escapedTitle = cached.title.replace(
'&', '&').replace(
'<', '<').replace(
'>', '>');
title.innerHTML = escapedTitle;
} else {
title.innerHTML = "untitled";
}
byline.appendChild(title);
if (localStorage['showOwner']) {
var owner = document.createElement("span");
owner.setAttribute("class", "owner");
var escapedOwnername = cached.ownername.replace(
'&', '&').replace(
'<', '<').replace(
'>', '>');
owner.innerHTML = " by " + escapedOwnername;
byline.appendChild(owner);
}
} else {
byline.innerHTML = "view in photostream";
}
window.onbeforeunload = function () {
document.body.onmousemove = null;
}
window.setTimeout(function () {
var mouseX = 0;
document.body.onmousemove = function (evt) {
if (mouseX == 0) {
mouseX = evt.pageX;
}
if (!mouseX != evt.pageX) {
byline.style.opacity = 0.6;
document.body.onmousemove = null;
}
}
}, 200);
</script>
</body>