forked from cloudmine/CloudMineSDK-JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnotes.html
More file actions
executable file
·57 lines (52 loc) · 2.1 KB
/
Copy pathnotes.html
File metadata and controls
executable file
·57 lines (52 loc) · 2.1 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
<!DOCTYPE HTML>
<html>
<head>
<title>CloudMine Demo App Monitor</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js" language="javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js" language="javascript"></script>
<script src="../js/cloudmine.js" language="javascript"></script>
<style>
th {
background-color: #ccc;
text-align: left;
}
</style>
</head>
<body>
<script language="javascript">
$(document).ready(function() {
var appid = "e3eda9b8240e4bb3a0ab9f53400104f5";
var apikey = "f824d345ffb04fda9491ff3f7af0e7aa";
cloudmine.init({app_id: appid, api_key: apikey});
var cached = {};
var fetch = function() {
cloudmine.getValues(null, {
success: function(success){
$('#content').html('');
var table = $('table#template').clone();
table.attr('id', 'thedata').attr('style', '');
success.forEach(function(key, value){
table.find('tbody').append('<tr><td>'+value.title+'</td><td>'+value.note.replace("\n", "<br />")+ '</td></tr>');
if(!cached || !cached[key] || cached[key].modified != value.modified) {
var lastRow = table.find('tr:last');
lastRow.css('background-color', 'yellow');
setTimeout(function() { lastRow.animate({ backgroundColor: '#fff' }, 'slow'); }, 500);
}
});
cached = success;
$('#content').append(table);
}
});
};
fetch();
setInterval(fetch, 1000);
});
</script>
<h1>Todo List Web Portal</h1>
<table id="template" style="display:none" width="100%">
<thead><th>Title</th><th>Content</th></thead>
<tbody></tbody>
</table>
<div id="content"> </div>
</body>
</html>