-
Notifications
You must be signed in to change notification settings - Fork 0
/
list.html
204 lines (187 loc) · 7.16 KB
/
list.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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta property="og:title" content="{{.Result.Title}} - Stagram" />
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
<title>{{.Result.Title}} - Stagram</title>
<link rel="shortcut icon" href="/static/favicon.ico">
<link rel="stylesheet" type="text/css" href="/static/css/reset.css" media="all" />
<link rel="stylesheet" type="text/css" href="/static/css/transitions.css" media="all" />
<link rel="stylesheet" type="text/css" href="/static/css/header.css" media="all" />
<link rel="stylesheet" type="text/css" href="/static/css/style.css" media="all" />
<script src="/static/js/jquery.min.js"></script>
<script src="/static/js/jquery.collagePlus.js"></script>
<script src="/static/js/jquery.removeWhitespace.js"></script>
<script src="/static/js/jquery.collageCaption.js"></script>
<script src="/static/js/script.js"></script>
<script type="text/javascript">
var type = "{{ .Result.Type }}";
var next_url = "{{ .Result.Response.Pagination.NextURL }}";
var isloading = false;
$(window).scroll(function() {
if ($(window).scrollTop() + 50 >= $(document).height() - $(window).height() && isloading == false) {
loadMore();
}
});
$(window).load(function() {
$(document).ready(function() {
collage();
$('.Collage').collageCaption();
$('#page-title').show();
});
});
var resizeTimer = null;
$(window).bind('resize', function() {
$('.Collage .Image_Wrapper').css("opacity", 0);
if (resizeTimer) clearTimeout(resizeTimer);
resizeTimer = setTimeout(collage, 200);
});
function loadMore() {
$('div#loadmoreajaxloader').show();
isloading = true;
var url = "";
if (type == "popular") {
url = "/ajax/popular";
} else {
if (next_url == ""){
$('div#loadmoreajaxloader').html('<center>No more posts to show.</center>');
return;
}
url = "/ajax/more?next_url=" + next_url
}
$.ajax({
url: url,
success: function(json) {
if (json) {
if (json.pagination) {
next_url = json.pagination.next_url;
}
for (var i = 0; i < json.data.length; i++) {
$(".Collage")
.append($("<div>")
.addClass("Image_Wrapper")
.attr({
"data-caption": "<a href='/" + json.data[i].user.username + "'>" +
"<img src='" + json.data[i].user.profile_picture + "' class='Caption_Image'/> " +
"<span class='Caption_Text'>" + json.data[i].user.username + "</span></a>" +
"<div class='Caption_Action'>" +
"<img src='/static/img/like.png' class='Caption_Action_Image'/> " + json.data[i].likes.count + " " +
"<img src='/static/img/comment.png' class='Caption_Action_Image'/> " + json.data[i].comments.count + " " +
"<a href='/media/" + json.data[i].id + "'><img src='/static/img/media.png' class='Caption_Action_Image'/></a>" +
"</div>"
})
.append($("<img>")
.attr({
"src": json.data[i].images.standard_resolution.url,
"width": "640px",
"height": "640px"
})
)
)
}
collage();
$('.Collage').collageCaption();
} else {
$('div#loadmoreajaxloader').html('<center>No more posts to show.</center>');
}
isloading = false;
}
});
};
function collage() {
$('.Collage').removeWhitespace().collagePlus({
'fadeSpeed': 2000,
'targetHeight': 600,
'effect': 'effect-2',
'direction': 'vertical'
});
};
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-56717919-6', 'auto');
ga('send', 'pageview');
</script>
</head>
<body>
<header class="top-bar">
<div class="navBtn">
<button class="navIcon">
<span class="iconLayer"></span>
</button>
</div>
<div class="menu menuOff">
<ul>
{{if .Result.IsLoggedIn }}
<li><a href="/feed">Feed</a></li>
<li><a href="/me">Me</a></li>
<li><a href="/like">Like</a></li>
<li><a href="/">Popular</a></li>
<li><a href="/logout">Logout</a></li>
{{else}}
<li><a href="/">Popular</a></li>
<li><a href="/oauth/authorize">Login with Instagram</a></li>
{{end}}
<li><a href="/about">About</a></li>
</ul>
</div>
<div id="wrapper">
<div id="page-title" style="display: none;">{{.Result.Title}}</div>
</div>
</header>
<div id="contents">
{{if eq .Result.Type "user"}}
<div id="UserInfo">
<div id="UserInfoIcon">
<img src="{{.Result.User.Data.ProfilePicture}}" class="user_icon"/>
</div>
<div id="UserInfoDetail">
<div class="name">
{{if eq .Result.User.Data.FullName ""}}
{{.Result.User.Data.Username}}
{{else}}
{{.Result.User.Data.FullName}}
{{end}}
</div>
<div class="website">
{{if ne .Result.User.Data.Website ""}}
<a href="{{.Result.User.Data.Website}}">{{.Result.User.Data.Website}}</a>
{{end}}
</div>
<div class="counts">
<strong>{{.Result.User.Data.Counts.Media}}</strong> posts
<strong>{{.Result.User.Data.Counts.Follows}}</strong> following
<strong>{{.Result.User.Data.Counts.FollowedBy}}</strong> followers
</div>
</div>
</div>
{{end}}
<div class="Collage">
{{range .Result.Response.Data}}
<div class="Image_Wrapper" data-caption="
<a href='/{{ .User.Username }}'>
<img src='{{.User.ProfilePicture}}' class='Caption_Image'/>
<span class='Caption_Text'>{{ .User.Username }}</span>
</a>
<div class='Caption_Action'>
<img src='/static/img/like.png' class='Caption_Action_Image'/> {{ .Likes.Count }}
<img src='/static/img/comment.png' class='Caption_Action_Image'/> {{ .Comments.Count }}
<a href='/media/{{ .ID }}'><img src='/static/img/media.png' class='Caption_Action_Image'/></a>
</div>">
<img src="{{.Images.StandardResolution.URL}}" />
</div>
{{end}}
</div>
<div id="loadmore">
<div id="loadmoreajaxloader">
<img src="/static/img/loader.gif">
</div>
</div>
</div>
<script src="https://dongrity.appspot.com/t.js" type="text/javascript"></script>
</body>
</html>