forked from ramonszo/zuck.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
221 lines (193 loc) · 9.09 KB
/
index.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
<html>
<head>
<title>Zuck.js</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0"/>
<!-- styles just for demo -->
<link rel="icon" href="ICON.png">
<link href="https://fonts.googleapis.com/css?family=Roboto:400,500,700" rel="stylesheet">
<style>
body {font-family:'Roboto', sans-serif;font-size:14px;padding:0;margin:0;color:#333}
#stories {padding: 12px;}
h1 {text-align: center;font-family: monospace;padding:0 12px;border-bottom:1px solid #ddd;font-size:24px;height:56px;line-height:56px;margin-bottom: 0;white-space: nowrap;text-overflow: ellipsis;overflow:hidden;}
h1.Snapgram {background: #fff;color:#333;}
h1.FaceSnap {background: #3B5998;color: #fff;}
h1.VemDeZAP {background: #085E53;color: #fff;}
h1.Snapssenger {background: #0084FF;color:#fff;}
.disclaimer {display:block;text-decoration: none !important;color:#333;line-height: 1.5em;background: #ffffd2;border-radius:3px;margin: 12px 12px 0;padding:12px 12px 12px 74px;font-size:13px;max-width: 500px;overflow: hidden;min-height: 50px;}
.disclaimer img {float:left;margin-right: 12px;width:50px;position: absolute;margin-left:-62px;}
.disclaimer a {color: inherit !important;border:0;}
.disclaimer p {margin: 0;}
.disclaimer p + p {margin-top: 1.25em}
.skin {text-transform: uppercase;white-space: nowrap;overflow: hidden;font-weight: bold;position: absolute;z-index: 10;left:0;right:0;bottom: 0;background: #fff;font-size:16px;padding:12px;color:#fff;background:#333;}
.skin select {background: #fff; font-size:inherit;text-transform: none; max-width: 30%;}
#stories {max-width: 500px;margin:0 auto;}
@media (min-width: 524px){
.disclaimer {margin: 12px auto;}
}
</style>
<!-- script styles -->
<link rel="stylesheet" href="zuck.css">
<link rel="stylesheet" href="skins/snapgram.css">
<link rel="stylesheet" href="skins/vemdezap.css">
<link rel="stylesheet" href="skins/facesnap.css">
<link rel="stylesheet" href="skins/snapssenger.css">
</head>
<body style="display:none">
<h1 id="header"> </h1>
<a href="https://ramon.codes/projects/zuck.js" target="_blank" class="disclaimer">
<img src="ICON.png">
<p>This a demonstration of <strong>zuck.js</strong> javascript library.</p>
<p>Not associated with Facebook, Instagram, WhatsApp or Snapchat.</p>
</a>
<div id="stories"></div>
<div class="skin">
Choose your theme:
<select id="skin" onchange="location.href=location.href.split('#')[0].split('?')[0]+'?skin='+this.options[this.selectedIndex].value;">
<option value="Snapgram">Snapgram (without fullscreen)</option>
<option value="FaceSnap">FaceSnap (with fullscreen)</option>
<option value="VemDeZAP">VemDeZAP (timeline)</option>
<option value="Snapssenger">Snapssenger (with previews)</option>
</select>
</div>
<script src="zuck.js"></script>
<script>
function buildItem(id, type, length, src, preview, link, linkText, seen, time){
return {
"id": id,
"type": type,
"length": length,
"src": src,
"preview": preview,
"link": link,
"linkText": linkText,
"seen": seen,
"time": time
};
}
var initDemo = function(){
var header = document.getElementById("header");
var skin = location.href.split('skin=')[1];
if(!skin) {
skin = 'Snapgram';
}
if(skin.indexOf('#')!==-1){
skin = skin.split('#')[0];
}
var skins = {
'Snapgram': {
'avatars': true,
'list': false,
'autoFullScreen': false,
'cubeEffect': true
},
'VemDeZAP': {
'avatars': false,
'list': true,
'autoFullScreen': false,
'cubeEffect': false
},
'FaceSnap': {
'avatars': true,
'list': false,
'autoFullScreen': true,
'cubeEffect': false
},
'Snapssenger': {
'avatars': false,
'list': false,
'autoFullScreen': false,
'cubeEffect': false
}
};
var timeIndex = 0;
var shifts = [35, 60, 60*3, 60*60*2, 60*60*25, 60*60*24*4, 60*60*24*10];
var timestamp = function() {
var now = new Date();
var shift = shifts[timeIndex++] || 0;
var date = new Date( now - shift*1000);
return date.getTime() / 1000;
};
var stories = new Zuck('stories', {
backNative: true,
previousTap: true,
autoFullScreen: skins[skin]['autoFullScreen'],
skin: skin,
avatars: skins[skin]['avatars'],
list: skins[skin]['list'],
cubeEffect: skins[skin]['cubeEffect'],
localStorage: true,
stories: [
{
id: "ramon",
photo: "https://avatars1.githubusercontent.com/u/2271175?v=3&s=460",
name: "Ramon",
link: "https://ramon.codes",
lastUpdated: timestamp(),
items: [
buildItem("ramon-1", "photo", 3, "https://instagram.fcpq1-1.fna.fbcdn.net/vp/58d0a550c53088cdb35b35df264b08dd/5B71DD99/t51.2885-15/s750x750/sh0.08/e35/30087632_1840683112891500_5841478972252094464_n.jpg", "https://instagram.fcpq1-1.fna.fbcdn.net/vp/58d0a550c53088cdb35b35df264b08dd/5B71DD99/t51.2885-15/s750x750/sh0.08/e35/30087632_1840683112891500_5841478972252094464_n.jpg", '', false, false, timestamp()),
buildItem("ramon-2", "video", 0, "https://instagram.fcpq1-1.fna.fbcdn.net/vp/9eeb88fc715827f48548e13c29bbf5f2/5ADB46A4/t50.2886-16/30746685_2117671735183416_1093170958966980608_n.mp4", "https://instagram.fcpq1-1.fna.fbcdn.net/vp/84bf84eed18f43cbd25314c4fc785c65/5ADB83C2/t51.2885-15/s1080x1080/e15/fr/30602505_193116778164680_1241426731739381760_n.jpg", '', false, false, timestamp()),
buildItem("ramon-3", "photo", 3, "https://ramon.codes/ICON.png", "https://ramon.codes/ICON.png", 'https://ramon.codes', 'Visit my Portfolio', false, timestamp())
]
},
{
id: "gorillaz",
photo: "https://lh3.googleusercontent.com/xYFz6B9FHMQq7fDOI_MA61gf0sNdzGBbdR7-mZ7i4rEVvE_N-kZEY_A4eP74Imcf8Sq3FYxAgd4eJA=w200",
name: "Gorillaz",
link: "",
lastUpdated: timestamp(),
items: [
buildItem("gorillaz-1", "video", 0, "https://instagram.frao1-1.fna.fbcdn.net/t50.2886-16/17886251_1128605603951544_572796556789415936_n.mp4", "https://pbs.twimg.com/media/C8VgMQ8WAAE5i9M.jpg:small", '', false, false, timestamp()),
buildItem("gorillaz-2", "photo", 3, "https://pbs.twimg.com/media/C8VgMQ8WAAE5i9M.jpg:large","https://pbs.twimg.com/media/C8VgMQ8WAAE5i9M.jpg:small", '', false, false, timestamp()),
]
},
{
id: "ladygaga",
photo: "https://lh3.googleusercontent.com/VkANYSL1HOzINPSnzBJRM879b302ShsRwLoKD7mLezgTLvlpHPm_dIVop7mkAQfepze6O5N8rw8l4yM=w200",
name: "Lady Gaga",
link: "",
lastUpdated: timestamp(),
items: [
buildItem("ladygaga-1", "photo", 5, "https://pbs.twimg.com/media/C8mtrEMXcAA9KKM.jpg:large", "https://pbs.twimg.com/media/C8mtrEMXcAA9KKM.jpg:small", '', false, false, timestamp()),
buildItem("ladygaga-2", "photo", 3, "https://pbs.twimg.com/media/C4t_bxcXAAE3Hwb.jpg:large", "https://pbs.twimg.com/media/C4t_bxcXAAE3Hwb.jpg:small", 'http://ladygaga.com', false, false, timestamp()),
]
},
{
id: "starboy",
photo: "https://lh3.googleusercontent.com/nMxfllzaAmaCCZJEMiKe2EARjyUNItQ-mdgAq6he-LWXwkIWbiiBIHyC3rGiqDu6fgyVK6NnjcgueA=w200",
name: "The Weeknd",
link: "",
lastUpdated: timestamp(),
items: [
buildItem("starboy-1", "photo", 5, "https://pbs.twimg.com/media/C6f-dTqVQAAiy1K.jpg:large", "https://pbs.twimg.com/media/C6f-dTqVQAAiy1K.jpg:small", '', false, false, timestamp())
]
},
{
id: "qotsa",
photo: "https://lh3.googleusercontent.com/nE4grkY8s88P_1mFFA06mGCNshhqtIz4C4y2dV7AZbm0360zopRKDMCYtUHR0uQR2DAfYMRZdA=s180-p-e100-rwu-v1",
name: "QOTSA",
link: "",
lastUpdated: timestamp(),
items: [
buildItem("qotsa-1", "photo", 10, "https://pbs.twimg.com/media/C8wTxgUVoAALPGA.jpg:large", "https://pbs.twimg.com/media/C8wTxgUVoAALPGA.jpg:small", '', false, false, timestamp())
]
}
]
});
var el = document.querySelectorAll('#skin option');
var total = el.length;
for (var i = 0; i < total; i++) {
var what = (skin==el[i].value)?true:false;
if(what){
el[i].setAttribute('selected', what);
header.innerHTML = skin;
header.className = skin;
} else {
el[i].removeAttribute('selected');
}
}
document.body.style.display = 'block';
};
initDemo();
</script>
</body>
</html>