forked from yoavram/markx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
285 lines (256 loc) · 9.11 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
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
{% extends "base.html" %}
{% block header %}
<div class="row-fluid">
<div class="span12" style="line-height: 40px;">
<a class="brand" href="/" rel="tooltip" title="Karl Heinrich Marx, 1818 – 1883">
<img class="img-rounded" src="/static/img/karl-marx-160x40.png">
</a>
<div class="btn-toolbar" id="general-toolbar">
<button href="#modal-github-signin" id="btn-github-signin-show" role="button" class="btn" data-toggle="modal" rel="tooltip" title="Sign in to GitHub">
<i class="icon-github-2"></i>
</button>
<button id="btn-github-signout" class="btn" rel="tooltip" title="Sign out of GitHub" style="display: none;">
<i class="icon-exit"></i>
</button>
<button class="btn" id="btn-display-panels" rel="tooltip" title="Change display">
<i class=" icon-screen"></i>
</button>
<button class="btn" id="btn-citations" rel="tooltip" title="Update citations list">
<i class="icon-books"></i>
</button>
<div class="btn-group">
<button class="btn dropdown-toggle" data-toggle="dropdown" rel="tooltip" title="Download and convert. May take up to a minute.">
<i class="icon-download-2"></i>
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a href='#' id="btn-download-md" rel="tooltip" title="Download as Markdown">
<i class="icon-file-css"></i> Markdown
</a></li>
<li><a href='#' id="btn-download-pdf" rel="tooltip" title="Download as PDF">
<i class="icon-file-pdf"></i> PDF
</a></li>
<li><a href='#' id="btn-download-docx" rel="tooltip" title="Download as Word docx">
<i class="icon-file-word"></i> Word
</a></li>
<li><a href='#' id="btn-download-latex" rel="tooltip" title="Download as LaTeX">
<i class="icon-file-css"></i> LaTeX
</a></li>
<li><a href='#' id="btn-download-epub" rel="tooltip" title="Download as ePub. No images allowed.">
<i class="icon-book"></i> ePub
</a></li>
<li><a href='#' id="btn-download-html" rel="tooltip" title="Download as HTML">
<i class="icon-file-xml"></i> HTML
</a></li>
<li><a href='#' id="btn-download-bibtex" rel="tooltip" title="Download citations as BibTeX">
<i class="icon-books"></i> BibTeX
</a></li>
</ul>
</div>
<button class="btn" id="btn-converter" rel="tooltip" title="Toggle Markdown converters: Pandoc or Docverter">D</button>
<div class="btn-group">
<button class="btn dropdown-toggle" data-toggle="dropdown" rel="tooltip" title="Change code highlighting theme">
<i class="icon-code"></i>
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
{% for style in config.PRETTIFY_STYLESHEETS %}
<li><a href='#' class="btn-prettify">{{ style }}</a></li>
{% endfor %}
</ul>
</div>
<button class="btn btn-inverse" id="word_counter" rel="tooltip" title="Word count" disabled>0</button>
</div>
<div class="btn-toolbar" id="github-toolbar" style="display: none">
<button class="btn" rel="tooltip" title="GitHub links" style="margin: auto 5px" disabled><i class="icon-github-2"></i></button>
<input class="input-small" type="text" id="user" placeholder="user" style="margin: auto 5px" disabled>
<select class="input-medium" type="text" id="repo" style="margin: auto 5px">
</select>
<button class="btn" id="repo-ok" rel="tooltip" title="Open repository">
<i class="icon-folder-open"></i>
</button>
<select class="input-medium" type="text" id="branch" style="margin: auto 5px">
</select>
<button id="branch-ok" class="btn" rel="tooltip" title="Open branch">
<i class="icon-folder-open"></i>
</button>
<select class="input-medium" type="text" id="path" placeholder="/path/to/file" style="margin: auto 5px">
</select>
<div class="btn-group">
<button class="btn" id="btn-pull" rel="tooltip" title="Pull file and load to editor">
<i class="icon-cloud-download"></i>
</button>
<button class="btn" id="btn-commit-push" rel="tooltip" title="Commit file and push">
<i class="icon-cloud-upload"></i>
</button>
</div>
<input class="input" type="text" id="commit-message" placeholder="Commit message: Fixed typos" style="margin: auto 5px">
</div>
</div>
</div>
</div>
<div class="row-fluid">
<div class="alert alert-error" id="general-alert" style="display: none">
<button type="button" class="close" onclick="$('#general-alert').hide()">×</button>
<div id="general-alert-message">
</div>
</div>
</div>
<div class="row-fluid">
<div class="alert alert-info span4" id="general-info" style="display: none">
<button type="button" class="close" onclick="$('#general-info').hide()">×</button>
<div id="general-info-message">
</div>
</div>
</div>
{% include 'github_signin.html' %}
{% endblock header %}
{% block left %}
<div class="wmd-panel" id="editor-panel">
<div id="wmd-button-bar-second"></div>
<textarea class="wmd-input" id="wmd-input-second">
{{ config.DEFAULT_TEXT }}
</textarea>
</div>
{% endblock left %}
{% block right %}
<div id="preview-panel">
<div id="wmd-preview-second" class="wmd-panel wmd-preview"></div>
<div id="bibtex_display" class="wmd-panel wmd-preview">
</div>
</div>
{% endblock right %}
{% block footer %}
<script type="text/javascript">
/* markdown editor */
var editor = init_markdown_editor();
$('#wmd-input-second').wordCount({counterElement:"word_counter"});
/* citations */
$("#btn-citations").click(updateCitations);
updateCitations();
/* code highlighting stuff */
$(function() {
$('.btn-prettify').click(function() {
$('#prettify-style').attr('href','{{ config.PRETTIFY_STYLESHEETS_FOLDER }}' + $(this).text() + '.css');
prettyPrintOne();
});
})
prettyPrintOne();
/* github api */
var github = null;
var user = null;
var repo = null;
$(function() {
$('#user').change(function() {
//alert("user changed");
//loadUserRepos($(this).val());
});
$('#btn-github-signin-cancel').click(clearGithubSigninForm);
$('#btn-github-signin-close').click(clearGithubSigninForm);
$('#btn-github-signin-submit').click(function() {
signinToGithub();
});
$('#btn-github-signout').click(function() {
signoutOfGithub();
});
$('#repo-ok').click( function() {
var username = $('#user').val();
var reponame = $('#repo').val();
if (!username || !username.length) {
alertMessage("Please enter a user name");
$('#user').focus();
return false;
}
if (!reponame || !reponame.length) {
alertMessage("Please choose a repository name");
$('#repo').focus();
return false;
}
loadRepoBranches(username, reponame);
});
$('#branch-ok').click(function() {
if (!repo || repo==null) {
alertMessage("Please load a repository");
$('#repo-ok').focus();
return false;
}
branchname = $('#branch').val();
if (!branchname || !branchname.length) {
alertMessage("Please choose a branch name");
$('#branch').focus();
return false;
}
loadBranchPaths(branchname);
});
$('#btn-pull').click(function() {
var branchname = $('#branch').val();
var filepath = $('#path').val();
var text = $('textarea#wmd-input-second').val();
pullFromGithub(branchname, filepath, text);
});
$('#btn-commit-push').click(function() {
var branchname = $('#branch').val();
var filepath = $('#path').val();
var commit_msg = $('#commit-message').val();
var text = $('textarea#wmd-input-second').val();
pushToGithub(branchname, filepath, commit_msg, text);
});
/* file conversion */
$('#btn-download-md').click(function() {
save('md', download);
});
$('#btn-download-bibtex').click(function() {
save('bib', view);
});
$('#btn-download-pdf').click(function() {
if (window.location.hostname == 'localhost' || getConverter == 'docverter') {
save('pdf', view);
} else {
save('latex', function(filename) {
var filepath = window.location.origin + '/view/' + filename;
window.location.assign("http://latex.aslushnikov.com/compile?url=" + filepath);
});
}
});
$('#btn-download-docx').click(function() {
save('docx', download);
});
$('#btn-download-latex').click(function() {
save('latex', download);
});
$('#btn-download-epub').click(function() {
save('epub', download);
});
$('#btn-download-html').click(function() {
save('html', view);
});
$('#btn-converter').click(function() {
/*if ($(this).text() == 'D')
$(this).text('P');
else
$(this).text('D');*/
});
document.getElementById('fileinput').addEventListener('change', readSingleFile, false);
})
/* display */
var panelsDisplayStatus = 'dual';
$(function() {
$('#btn-display-panels').click(panelsDisplay);
})
</script>
{% if config.GOOGLE_ANALYTICS %}
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '{{ config.GOOGLE_ANALYTICS }}']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
{% endif %}
<input type="file" id="fileinput" style="display:none;"/>
<textarea id="bibtex_input" style="display:none;">
</textarea>
{%endblock footer %}