-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
58 lines (54 loc) · 1.85 KB
/
index.html
File metadata and controls
58 lines (54 loc) · 1.85 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
<!doctype html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html">
<title>Github API Webapp using jQuery - Treehouse Demo</title>
<meta name="author" content="Jake Rocheleau">
<link rel="shortcut icon" href="http://d15dxvojnvxp1x.cloudfront.net/assets/favicon.ico">
<link rel="icon" href="http://d15dxvojnvxp1x.cloudfront.net/assets/favicon.ico">
<link rel="stylesheet" type="text/css" media="all" href="css/bootstrap.css">
<link rel="stylesheet" type="text/css" media="all" href="css/style.css">
<script type="text/javascript" src="./js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="js/markdown.js"></script>
</head>
<body>
<div id="w">
<h1>Posts</h1>
<div id="content">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
var repouri = 'https://api.github.com/repos/ylevtov/devart-template/contents/project_posts';
var commitsuri = 'https://api.github.com/repos/ylevtov/devart-template/commits';
var postcontent;
var parsedpostcontent;
function getContents(filename){
var fileuri = repouri+'/'+filename;
$.getJSON(fileuri, function(json){
console.log(json);
var postcontentfat = json.content.replace(/\s/g, '');
postcontent = atob(postcontentfat);
parsedpostcontent = markdown.toHTML(postcontent);
var post = '<div class="post-content">'+parsedpostcontent+'</div>';
post = post+'</br>';
$('#content').append(post);
});
};
$.getJSON(repouri, function(json){
for (var i = 0; i<json.length; i++) {
console.log(json[i].name);
getContents(json[i].name);
};
});
$.getJSON(commitsuri, function(json){
for (var i = 0; i<json.length; i++) {
console.log(json[i].commit.author.date);
// getContents(json[i].name);
};
});
});
</script>
</body>
</html>