-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwiki.html
62 lines (56 loc) · 1.47 KB
/
wiki.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
<html>
<head>
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/bootstrap-responsive.min.css">
<script src="src/Model.js"></script>
<script src="jquery.js"></script>
<style>
html body {
margin: 20px;
}
.hidden {
display: none;
}
#title img {
display: inline-block;
height: 10px;
width: 10px;
vertical-align: top;
margin-top: 5px;
}
</style>
</head>
<body>
<h1 id="title"></h1>
<div id="wiki"></div>
<textarea id="wikiEditArea"></textarea>
</body>
<script>
var currentPage = null;
var toggleEdit = function(){
$('#wikiEditArea').toggleClass('hidden');
};
$('#title').click(function(){ toggleEdit() });
$('#wikiEditArea').keyup(function() {
pages[currentPage] = $('#wikiEditArea').val();
openPage(currentPage);
});
var pages = {
Home : "Hello [[World]].",
World : "Goodbye world"
};
var openPage = function(page) {
currentPage = page;
var pageText = pages[page];
if(!pageText){
pages[page] = ''
pageText = '';
}
var transformedText = wikiTransform(pageText);
$('#title').html(page+'<img src="pencil.png">');
$('#wiki').html(transformedText);
$('#wikiEditArea').val(pageText);
};
openPage("Home")
</script>
</html>