-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
86 lines (61 loc) · 2.18 KB
/
index.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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" />
<style>
.wrapper {
width: 320px;
margin: 0 auto;
}
.container {
margin-top: 50px;
margin-bottom: 100px;
}
button {
margin-top: 25px;
}
</style>
<!-- Netlify Identity Widget -->
<script type="text/javascript" src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script>
<!-- Github -->
<script type="text/javascript" src="js/github.js"></script>
<!-- Markdown parser, just for this example -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/showdown/1.9.1/showdown.min.js"></script>
</head>
<body>
<div class="wrapper mt-5">
<div class="card">
<div class="card-body text-center">
<h5 class="card-title">Log In</h5>
<p class="card-text">Log in with Netlify Identity</p>
<button class="btn btn-outline-dark w-100" id="login">Log In / Register</button>
</div>
</div>
</div>
<div class="container" id="result"></div>
<script>
document.querySelector('#login').addEventListener('click', function() {
netlifyIdentity.open()
})
netlifyIdentity.on('login', function(user) {
document.querySelector('#login').innerHTML = 'Log Out'
getData('README.md').then(function(result) {
console.log(result)
let data = result.content
var converter = new showdown.Converter(),
html = converter.makeHtml(data)
document.querySelector('#result').innerHTML = html
})
// save data example
/*
saveData('newfile.txt', 'Some data').then(function(result){
console.log(result);
});
*/
})
</script>
</body>
</html>