-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
100 lines (85 loc) · 3.15 KB
/
index.html
File metadata and controls
100 lines (85 loc) · 3.15 KB
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
<!DOCTYPE html>
<!-- saved from url=(0049)file:///C:/Users/Craig/Downloads/index%20(1).html -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<title>Assignment 1</title>
<meta name="description" content="Assignment 1">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="assets/css/reset.css">
<link rel="stylesheet" href="assets/css/styles.css">
<script type="text/javascript" src="assets/js/jquery.min.js"></script>
<script type="text/javascript" src="assets/js/parse-1.3.5.min.js"></script>
<script type="text/javascript">
// waits foer the document to load, then starts the js code
$(document).ready(function(){
Parse.initialize("nVVTfcLwuU5OgI6zB1E72KQGvwKJex8XRzvNZWJ0", "exGizwFvu9fQkU2tYQaOSQvhpW9ck6imTQQtC6go");
var Todo = Parse.Object.extend("Todo");
var query = new Parse.Query(Todo);
query.find({
success: function(results) {
// html elements
var table, row, column;
// strings
var title, description, completedString;
// boolean
var completed;
table = $("#main .todos");
progress = $("#main .progress");
for (var i = 0; i < results.length; i++) {
var object = results[i];
title = object.get("title");
description = object.get("description");
completed = object.get("completed");
if (completed){
completedString = "Completed";
} else {
completedString = "Not Completed";
}
row = $("<tr>");
// title
column = $("<td>");
column.html(title);
row.append(column);
// description
column = $("<td>");
column.html(description);
row.append(column);
column = $("<td>");
column.html(completedString);
row.append(column);
table.append(row);
}
// hide progress
progress.hide();
// show table, but animate it into view, like a boss!
table.fadeIn(1500);
},
error: function(error) {
alert("Error: " + error.code + " " + error.message);
// hide progress
progress.hide();
}
});
});
</script>
</head>
<body>
<div id="main">
<h1>Mal's Learning - Project 1</h1>
<div class="progress">
<p>Loading... Please be patient!</p>
</div>
<table class="todos">
<tr class="header">
<th>Title</th>
<th>Description</th>
<th>Completed?</th>
</tr>
</table>
<p><sub>Created by Neil Williams on 16th March 2015</sub></p>
<p><sub>#html #javascript #jquery #parse</sub></p>
</div>
</body>
</html>