-
Notifications
You must be signed in to change notification settings - Fork 0
/
home.html_bak
309 lines (225 loc) · 11.7 KB
/
home.html_bak
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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="home.css" type="text/css"/>
<title>MemeMaster Home Page</title>
<style type="text/css">
</style>
</head>
<body onresize="memeresize('memes')" onload="memeresize('memes')">
<div id="blackout" style="display:none;z-index:300;position:fixed;width:100%;height:100%;background-color:rgba(0,0,0,0.4);"></div>
<header class="nav-container">
<div class="logo-container">
<a href="./"><img src="logo4.png" alt="MemeMaster" class="logo-img"></a></div>
<!-- testing -->
<nav class="nav-head">
<ul class="navglobal">
<li class="navmenu-selected"><a class="navmenu-selected" href="home.html">Home</a></li>
<li class="navmenu"><a class="navmenu" id="upload-modal-show" title="Need Javascript to create popup for meme sumbition" href="#">Upload</a></li>
<li class="navmenu"><a class="navmenu" href="creatememe.html">Create</a></li>
<li class="navmenu"><a class="navmenu" href="./">Trending</a></li>
<li class="navmenu"><a class="navmenu" href="#">Help</a></li>
<li class="nav-search"><div class="search-container"><form method="get" name="search" action="searchpage.html">
<input class="search" type="text" name="globalq" placeholder="Search"></form></div></li>
</ul>
</nav>
<div id="user-container" class="nav-user-container">
<article class="nav-user-welcome" id="welcome-message"></article>
<aside class="nav-userpic stretch-container" id="userimg"></aside></div>
</header>
<div class="everything-container">
<div id="js-container">
<div id="display-options">
<header id="display-opt-head"><h4>Display Options</h4></header>
<ul class="display-nav">
<li class="display-menu"><a href="#"><img src="../displayImage/detailedviewicon.png" alt="Detailed View"></a></li>
<li class="display-menu"><a href="#"><img src="../displayImage/picviewicon.png" alt="Picture View"></a></li>
<li class="display-menu"><a href="#"><img src="../displayImage/filterIcon2.png" alt="Filter Folders"></a></li>
<li class="display-menu"><a href="#"><img src="../displayImage/newfoldericon.png" alt="New Folder"></a></li>
<li class="display-menu"><a href="#"><img src="../displayImage/help-icon.png" alt="Help"></a></li>
<li class="display-search"><form method="get" name="localsearch"><input class="display-search" type="text" name ="mysearch" placeholder="Search your files"></form></li></ul></div>
<!-- Sidebar Trending starts-->
<div id="memes-trending-landing" class="trending-container" >
</div></div>
<!-- Sidebar Trending ends-->
<!-- Saved Meme starts-->
<div id="memes" >
<header id="memes-top-header"><h3>Saved Memes</h3></header>
<div id = "memes-savedmeme-landing">
<!-- Saved Meme ends-->
</div>
</div>
</div>
<footer id="common-footer">
<div id="footer-left"><ul class="footer">
<li class="footer"><a href="#" class="footer">About This Site</a></li>
<li class="footer"><a href="#" class="footer">Privacy Policy</a></li>
<li class="footer"><a href="team/index.html" class="footer">Team Page</a></li>
</ul></div>
<div id="footer-right"><a href="#" class="footer">Jump to Top</a></div></footer>
<a onclick="signOut();">Signout</a>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="//www.parsecdn.com/js/parse-1.2.19.min.js"></script>
<script src="init.js"></script>
<script>
//Resize script to keep boxes on fixed intervals using browser window width
function memeresize(target) {
var boxsz = 275;
var offset = 295;
var width = Math.floor((window.innerWidth-offset)/boxsz);
document.getElementById(target).style.maxWidth=(width*boxsz)+"px";
}
$(function() {
$("h4").click(function() {
$(".trending-container").toggleClass("trending-container-change");
});
});
</script>
<script>
var currentUser = Parse.User.current();
var galleryObj = new galleryQuery();
galleryObj.sendQuery(40, 0);
// Initializing our events
var queryComplete = document.createEvent('Event');
queryComplete.initEvent('queryComplete', true, true);
function getTrendingFill(title,id, cover, date,total_likes,likes){
var shortTitle = title;
if (title.length > 25)
shortTitle = title.substring(0,25);
var body="<article class=\"trending-meme\"><header class=\"trending-title\"><h4><a href =\"memepage.html?gal="+id+"\">" + shortTitle +"</a></h4></header><a href =\"memepage.html?gal="+id+"\"><img class=\"meme\" src=\""+ cover +"\" alt=\""+title+"\" width=\"200\" height=\"200\"></a><br><time datetime=\"" +date+ "\"></time></article>";
return body;
}
function getSavedFill(title,id, cover, date,total_likes,likes){
alert("hi");
var shortTitle = title;
if (title.length > 25)
shortTitle = title.substring(0,25);
var body="<article class=\"meme\"><header class=\"meme-head\"><h4><a href =\"memepage.html?gal="+id+"\">" + shortTitle +"</a></h4></header><div class=\"meme-img stretch-container\"><a href =\"memepage.html?gal="+id+"\"><img class=\"meme\" src=\""+ cover +"\" alt=\""+title+"\"></a></div><br><time datetime=\"" +date+ "\"></time><progress max=\""+total_likes+"\" value=\""+likes+"\"></progress></article>";
return body;
}
document.addEventListener('queryComplete',
function(){
var body = "<header id=\"trending-head\"><h4>Trending Memes</h4></header><hr class=\"trending\">"
var body2 = ""
var tags =""
for (var i=0; i < 3; i++){
if (galleryObj.public[i]) {
body += getTrendingFill(galleryObj.title[i], galleryObj.myId[i], galleryObj.coverPic[i], galleryObj.date[i], galleryObj.total_likes[i], galleryObj.likes[i]);
}
}
for (var i=0; i < galleryObj.title.length; i++){
if (!galleryObj.public[i]){
body2 += getTrendingFill(galleryObj.title[i], galleryObj.myId[i], galleryObj.coverPic[i], galleryObj.date[i], galleryObj.total_likes[i], galleryObj.likes[i]);
}
}
$("#memes-trending-landing").html(body);
$("#memes-savedmeme-landing").html(body2);
stretchContainers();
$("#memes").slideDown(200);
});
/* ---------------------------- */
/* ---------------------------- */
/* --- Gallery Query Object --- */
/* ---------------------------- */
/* ---------------------------- */
function galleryQuery(){
this.coverPic=[""];
this.public = [true];
this.images = [];
this.myId=[""];
this.nsfw=[false];
this.title=[""];
this.user=[];
this.tags=[""];
this.likes=[0];
this.total_likes=[0];
this.comments = [];
this.title_to_lower=[""];
this.date=[""];
this.humanReadableQuery=[""];
// Required for child functions to reach parent members
var parent = this;
this.sendQuery = (function(limit, skip){
var gallery = Parse.Object.extend("gallery");
var galquery = new Parse.Query(gallery);
galquery.include("cover"); // Fetches pointer information
galquery.include("user"); // Fetches the pointer information
galquery.descending("likes");
galquery.limit(limit);
galquery.skip(skip);
galquery.find({
success: function(galresults) {
//alert("query complete");
/* Fill object values */
for (var i = 0; i < galresults.length; i++) {
parent.myId[i] = galresults[i].id;
parent.title[i] = galresults[i].get('title');
//alert ("Received: " + parent.title[i]);
parent.coverPic[i] = galresults[i].get("cover").get("thumb").url();
parent.likes[i] = galresults[i].get("likes");
parent.total_likes[i] = galresults[i].get("total_likes");
parent.tags[i] = galresults[i].get("tags");
parent.user[i] = galresults[i].get("user");
parent.nsfw[i] = galresults[i].get("nsfw");
parent.date[i] = galresults[i].updatedAt;
parent.public[i] = galresults[i].get("public");
parent.title_to_lower[i] = galresults[i].get("title_to_lower");
}
/* Query finished. Dispatch event */
document.dispatchEvent(queryComplete);
},
error: function(error) {
alert("Error: " + error.code + " " + error.message);
}
});
});
}
</script>
<!-- Upload Modal -->
<div id="upload-modal">
<div style="display:inline-block;margin: 0 0 8px 0;">
<section class="upload-modal-heading">
<ul class="upload-modal">
<li class="upload-modal-menu-selected">
<a class="upload-modal" href="#" id="upload-modal-local-option">From Your Computer</a>
</li>
<li class="upload-modal-menu">
<a class="upload-modal" href="#" id="upload-modal-web-option">From the Web</a>
</li>
</ul>
</section>
<aside class="upload-modal-heading">
<div href="#" class="upload-modal-close modal-close"></div>
</aside>
</div>
<section class="upload-modal-file-landing">
<article class="upload-modal-file-landing">
<button id="upload-modal-browse" type="button">Browse</button><input type="file" id="input-upload-modal-browse" accept="image/*" multiple>
</article>
<aside class="upload-modal-file-landing" id="upload-modal-drag-drop">
Drag and Drop
</aside>
</section>
<section class="upload-modal-option">
<label for="upload-modal-gallery-option" style="margin:6px;float:right;">Gallery</label>
<input type="checkbox" id="upload-modal-gallery-option" style="vertical-align:top;margin:8px 0 0 8px;float:right;">
<input type="text" class="upload-modal-gallery-title" id="upload-modal-gallery-title" style="float:right;" placeholder="Gallery Title">
</section>
<section id="upload-modal-files-container" class="upload-modal-files-container">
</section>
<footer class="upload-modal-footer">
<section class="upload-modal-footer">
<button class="upload-modal-close" type="button">Cancel</button>
<button id="upload-modal-done" type="button">Upload »</button>
</section>
</footer>
</div>
<script src="uploader.js"></script>
<script>
function signOut(){
Parse.User.logOut();
}
</script>
</body>
</html>