/
preview.html
112 lines (92 loc) · 3.22 KB
/
preview.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<!DOCTYPE html>
<html>
<head>
<title>AsciidocFX Editor</title>
<meta charset="UTF-8">
<link rel="stylesheet" href="/css/grid.css" type="text/css"/>
<link rel="stylesheet" href="/css/hljs.css" type="text/css"/>
<link rel="stylesheet" href="/css/font-awesome.css"/>
<link rel="stylesheet" href="/css/asciidoctor-default.css"/>
<link rel="stylesheet" href="/css/custom.css"/>
</head>
<body>
<div class="container" id="container"></div>
<div class="row">
<div class="columns justify large-10 large-centered medium-12 small-12">
<div id="placeholder">
...
</div>
</div>
</div>
<script src="/js/asciidoctor-all.js"></script>
<script src="/js/asciidoctor-uml-block.js"></script>
<script src="/js/asciidoctor-math-block.js"></script>
<script src="/js/asciidoctor-tree-block.js"></script>
<script src="/js/asciidoctor-docbook.js"></script>
<script src="/js/jquery.js"></script>
<script src="/js/highlight.pack.js"></script>
<script src="/js/to-asciidoc.js"></script>
<script src="/js/to-markdown.js"></script>
<script src="/js/index.js"></script>
<script src="/js/progressbar.min.js"></script>
<script>
var imageCacheNumber = Math.floor(Math.random() * (999999999999 - 2)) + 1;
function clearImageCache(){
imageCacheNumber = Math.floor(Math.random() * (999999999999 - 2)) + 1;
refreshUI($("#placeholder").html());
}
function imageToBase64Url() {
window.clonedContent = $("#placeholder").clone();
clonedContent.find("img").each(function (index) {
app.imageToBase64Url(this.src, index);
});
}
function isHtml(html){
var div = $("<div></div>");
div.append(html);
return div.find("div,span,p,br,b,strong,h1,h2,h2,h4,h5,h6,pre,code,table,section,img,a,sub,sup,del,u").length > 5;
}
function updateBase64Url(index, base64) {
var imageUrl = "data:image/png;base64," + base64;
clonedContent.find("img").eq(index).attr("src", imageUrl);
app.cutCopy(clonedContent.html());
}
function refreshUI(data) {
var $data = $("<div></div>").append(data);
$data.find("img").each(function(){
$(this).attr("src",$(this).attr("src")+"?"+imageCacheNumber);
});
$("#placeholder").html($data.html());
$('pre code').each(function (i, e) {
hljs.highlightBlock(e)
});
}
document.onkeydown = function (e) {
e = e || window.event;
if (e.keyCode == 123) {
if (!$("#firebug-script").length) {
var script = $("<script>")
script.attr("id", "firebug-script");
script.attr("src", "http://getfirebug.com/firebug-lite.js#startOpened=true");
$("body").append(script);
}
}
};
var progressBar;
function startProgressBar() {
progressBar = new ProgressBar.Line('#container', {
color: '#FCB03C',
duration: 15000
});
progressBar.animate(1);
}
function stopProgressBar() {
progressBar.animate(1, {
duration: 800
}, function() {
setTimeout(function() { progressBar.destroy(); }, 500);
});
}
</script>
</body>
</html>