forked from selemon/team23-project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
load.html
executable file
·166 lines (122 loc) · 4.67 KB
/
load.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
<!DOCTYPE html>
<!-- Originally Coded by April, Redesigned by Regan -->
<html><head>
<title>TestingPage</title>
<meta name='viewport' intial-scale='1.0', content='user-scalable=no, width=device-width, initial-scale=1'>
<!-- <meta name='viewport' intial-scale='1.0', content=''> -->
<link rel='stylesheet' type='text/css' href='css/stylesheet.css'>
<!-- local Jquery -->
<script src='js/jquery/jquery.js'></script>
<!-- <script src='js/modernizr.js'></script> -->
<script src='js/hammer.min.js'></script>
<script type='text/javascript'>
jQuery(document).on('mobileinit', function() { jQuery.mobile.autoInitializePage = false;
});</script>
<script src='js/jquery/jquery.mobile-1.4.5.min.js'></script>
<!-- local lib and tests -->
<script src='js/page-script.js'></script>
<script>
function loadMemoriesFromDB(){
userid=1; //maybe get from cookie?
//make ajax request to get data ... generate a div like template below for each of them
var resultantHTML = ''; //store the HTML containing all the memories.
$.ajax({
dataType: 'json',
method: 'GET',
url: 'https://team23-project.herokuapp.com/memory/get/timeline/' + userid
}).done(function(data){
data.forEach(function (memory, index){
resultantHTML += '<div class="imgContainer" >';
resultantHTML += '<div class="load-info-box">';
// resultantHTML += '<img class="load-smiley" src="'+ memory.emotion +'">';
if(memory.circlecolor != 0){
resultantHTML += '<img class="load-smiley" src="'+ memory.emotion +'" style="background-image: url("img/smiley/drawing-happy.png")">';
} else {
resultantHTML += '<img class="load-smiley" src="'+ memory.emotion +'" style="background-image: url("img/smiley/drawing-sad.png")">';
}
resultantHTML += ' <div class="load-date-box">';
resultantHTML += '<p> Feb </p> <p> 11 </p> </div>';
resultantHTML += '<div class="load-description-box"><h2>'+ memory.title +' </h2> <h3>'+ memory.hashtags +' </h3></div>';
resultantHTML += '<img class="load-arrow" src="img/icons/right_arrow.png" onclick="retrieveMemory()">'
resultantHTML += '</div></div>';
});
//add the resultantHTML to the content-wrapper element.
//DEBUG alert(resultantHTML);
$('#load-content-wrapper').append(resultantHTML);
}).fail(function(jgXHR, textStatus, errorThrown){
alert('Server Connection Error'); //let user know something is wrong.
console.log('ERROR: '+textStatus+ errorThrown);
});
}
//This is we will (i think) state the values of the variables/elements on the retrieved page once the user clicks the arrow. - Regan
function retrieveMemory() {
$(".white-fader").fadeTo(1500, 1, function () {
window.location.href = 'retrieved.html';
});
}
</script>
<!--
<div class='imgContainer'>
<div class='load-info-box'>
<img class='load-smiley' src='img/stock/drawn_01.png'>
<div class='load-date-box'>
<p> Feb </p>
<p> 11 </p>
</div>
<div class='load-description-box'>
<h2>A Short Description...</h2>
<h3>#Fun #Hashtag </h3>
</div>
<img class="load-arrow" src="img/icons/right_arrow.png">
</div>
</div> -->
</head>
<body>
<div id="wrapper">
<div class='navbar'>
<img class='nav-logo' src="img/Logo_Final_Small.png">
<img class="nav-icon-settings" src="img/icons/settings_icon.png">
</div>
<div id ='bottom-navbar'>
<ul>
<li>
<img class="nav-icon home-button" src="img/icons/home_icon.png">
</li>
<li>
<img class="nav-icon create-button" src="img/icons/create_icon.png">
</li>
<li>
<img class="nav-icon history-button" src="img/icons/history_icon.png">
</li>
<li>
<img class="nav-icon graph-button" src="img/icons/graph_icon.png">
</li>
</ul>
</div>
<div class="white-fader"></div>
<div id="load-content-wrapper" style="padding-top: 0px; margin-top: 70px">
<!-- add for each loop -->
<div class='imgContainer'>
<div class='load-info-box' >
<img class='load-smiley' src='img/stock/drawn_01.png' >
<div class='load-date-box'>
<p> Feb </p>
<p> 11 </p>
</div>
<div class='load-description-box'>
<h2>A Short Description...</h2>
<h3>#Fun #Hashtag </h3>
</div>
<img class="load-arrow" src="img/icons/right_arrow.png" onclick="retrieveMemory()">
</div>
</div>
</div>
</div>
<script type='text/javascript'>
//Once the document has loaded do this function.. loads the memories from the DB.
$( document ).ready(function() {
loadMemoriesFromDB();
});
</script>
</body>
</html>