Skip to content

Commit eb83a60

Browse files
committed
indentation tabs to 4 spaces
1 parent 257d07a commit eb83a60

File tree

10 files changed

+349
-349
lines changed

10 files changed

+349
-349
lines changed

ennead/models/task.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,4 @@ def html_description(self):
6464
def html_solution(self):
6565
"""`Task` solution in HTML"""
6666

67-
return render_markdown(self.solution)
67+
return render_markdown(self.solution)

ennead/static/app.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
window.addEventListener("load", function() {
2-
let forms = document.getElementsByTagName('form');
3-
for (let form of forms) {
4-
let textareas = form.getElementsByTagName('textarea');
5-
for (let textarea of textareas) {
6-
textarea.addEventListener('keydown', function(event) {
7-
if (event.ctrlKey && event.keyCode == 13) { // Ctrl-Enter pressed
8-
form.submit();
2+
let forms = document.getElementsByTagName('form');
3+
for (let form of forms) {
4+
let textareas = form.getElementsByTagName('textarea');
5+
for (let textarea of textareas) {
6+
textarea.addEventListener('keydown', function(event) {
7+
if (event.ctrlKey && event.keyCode == 13) { // Ctrl-Enter pressed
8+
form.submit();
9+
}
10+
});
911
}
10-
});
1112
}
12-
}
1313
});

ennead/static/editor.js

Lines changed: 76 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,87 @@
11
window.addEventListener('load', function() {
2-
var editors = document.getElementsByClassName('markdown-editor');
3-
for (let editor of editors) {
4-
var sourceLink = editor.getElementsByClassName('markdown-editor-source-link')[0];
5-
var previewLink = editor.getElementsByClassName('markdown-editor-preview-link')[0];
6-
var editorTextarea = editor.getElementsByClassName('markdown-editor-source')[0];
7-
var preview = editor.getElementsByClassName('markdown-editor-preview')[0];
8-
var fileUploader = editor.getElementsByClassName('file-uploader')[0];
9-
if (fileUploader === undefined) {
10-
continue;
11-
}
12-
var fileUploaderInput = fileUploader.getElementsByClassName('file-uploader-input')[0];
13-
var fileUploaderLink = fileUploader.getElementsByClassName('file-uploader-link')[0];
14-
if (
15-
sourceLink === undefined ||
16-
previewLink === undefined ||
17-
editorTextarea === undefined ||
18-
preview === undefined ||
19-
fileUploaderInput === undefined ||
20-
fileUploaderLink === undefined
21-
) {
22-
continue;
23-
}
2+
var editors = document.getElementsByClassName('markdown-editor');
3+
for (let editor of editors) {
4+
var sourceLink = editor.getElementsByClassName('markdown-editor-source-link')[0];
5+
var previewLink = editor.getElementsByClassName('markdown-editor-preview-link')[0];
6+
var editorTextarea = editor.getElementsByClassName('markdown-editor-source')[0];
7+
var preview = editor.getElementsByClassName('markdown-editor-preview')[0];
8+
var fileUploader = editor.getElementsByClassName('file-uploader')[0];
9+
if (fileUploader === undefined) {
10+
continue;
11+
}
12+
var fileUploaderInput = fileUploader.getElementsByClassName('file-uploader-input')[0];
13+
var fileUploaderLink = fileUploader.getElementsByClassName('file-uploader-link')[0];
14+
if (
15+
sourceLink === undefined ||
16+
previewLink === undefined ||
17+
editorTextarea === undefined ||
18+
preview === undefined ||
19+
fileUploaderInput === undefined ||
20+
fileUploaderLink === undefined
21+
) {
22+
continue;
23+
}
2424

25-
sourceLink.onclick = function() {
26-
if (editorTextarea.classList.contains('d-none')) {
27-
editorTextarea.classList.remove('d-none');
28-
preview.classList.add('d-none');
29-
sourceLink.classList.add('active');
30-
previewLink.classList.remove('active');
31-
fileUploader.classList.remove('d-none');
32-
}
33-
}
25+
sourceLink.onclick = function() {
26+
if (editorTextarea.classList.contains('d-none')) {
27+
editorTextarea.classList.remove('d-none');
28+
preview.classList.add('d-none');
29+
sourceLink.classList.add('active');
30+
previewLink.classList.remove('active');
31+
fileUploader.classList.remove('d-none');
32+
}
33+
}
3434

35-
previewLink.onclick = function() {
36-
if (preview.classList.contains('d-none')) {
37-
var xhr = new XMLHttpRequest();
38-
xhr.onreadystatechange = function() {
39-
if (xhr.readyState == 4 && xhr.status == 200) {
40-
preview.innerHTML = xhr.responseText;
41-
preview.querySelectorAll('pre code').forEach(function(block) {
42-
hljs.highlightBlock(block);
43-
});
44-
MathJax.Hub.Queue(["Typeset", MathJax.Hub, preview]);
45-
preview.classList.remove('d-none');
46-
editorTextarea.classList.add('d-none');
47-
previewLink.classList.add('active');
48-
sourceLink.classList.remove('active');
49-
fileUploader.classList.add('d-none');
50-
}
35+
previewLink.onclick = function() {
36+
if (preview.classList.contains('d-none')) {
37+
var xhr = new XMLHttpRequest();
38+
xhr.onreadystatechange = function() {
39+
if (xhr.readyState == 4 && xhr.status == 200) {
40+
preview.innerHTML = xhr.responseText;
41+
preview.querySelectorAll('pre code').forEach(function(block) {
42+
hljs.highlightBlock(block);
43+
});
44+
MathJax.Hub.Queue(["Typeset", MathJax.Hub, preview]);
45+
preview.classList.remove('d-none');
46+
editorTextarea.classList.add('d-none');
47+
previewLink.classList.add('active');
48+
sourceLink.classList.remove('active');
49+
fileUploader.classList.add('d-none');
50+
}
51+
}
52+
xhr.open('POST', '/md', true);
53+
xhr.send(editorTextarea.value);
54+
}
5155
}
52-
xhr.open('POST', '/md', true);
53-
xhr.send(editorTextarea.value);
54-
}
55-
}
5656

57-
fileUploaderLink.onclick = function() {
58-
fileUploaderInput.click();
59-
}
57+
fileUploaderLink.onclick = function() {
58+
fileUploaderInput.click();
59+
}
6060

61-
fileUploaderInput.onchange = function() {
62-
var file = fileUploaderInput.files[0];
63-
if (file === undefined) {
64-
return;
65-
}
61+
fileUploaderInput.onchange = function() {
62+
var file = fileUploaderInput.files[0];
63+
if (file === undefined) {
64+
return;
65+
}
6666

67-
var formData = new FormData();
68-
formData.append('file', file);
67+
var formData = new FormData();
68+
formData.append('file', file);
6969

70-
var xhr = new XMLHttpRequest();
71-
xhr.onreadystatechange = function() {
72-
if (xhr.readyState == 4 && xhr.status == 200) {
73-
var fileLink = '[' + file.name + '](' + xhr.responseText + ')';
74-
if (file.type.startsWith('image/')) {
75-
fileLink = '!' + fileLink;
76-
}
77-
if (editorTextarea.value.slice(-1) != '\n') {
78-
editorTextarea.value += '\n';
79-
}
80-
editorTextarea.value += fileLink;
70+
var xhr = new XMLHttpRequest();
71+
xhr.onreadystatechange = function() {
72+
if (xhr.readyState == 4 && xhr.status == 200) {
73+
var fileLink = '[' + file.name + '](' + xhr.responseText + ')';
74+
if (file.type.startsWith('image/')) {
75+
fileLink = '!' + fileLink;
76+
}
77+
if (editorTextarea.value.slice(-1) != '\n') {
78+
editorTextarea.value += '\n';
79+
}
80+
editorTextarea.value += fileLink;
81+
}
82+
};
83+
xhr.open('POST', '/upload', true);
84+
xhr.send(formData);
8185
}
82-
};
83-
xhr.open('POST', '/upload', true);
84-
xhr.send(formData);
8586
}
86-
}
8787
});

ennead/static/style.css

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,79 @@
11
/* Fix for Bootstrap 4 broken navbar baseline */
22
.nav-link, .navbar-text, .nav-item > .btn {
3-
margin-top: 0.125rem;
3+
margin-top: 0.125rem;
44
}
55

66
/* Fix for Bootstrap 4 broken navbar buttons & text margin */
77
.nav-item > .btn, .navbar-text{
8-
margin-left: 0.1rem;
9-
margin-right: 0.1rem;
8+
margin-left: 0.1rem;
9+
margin-right: 0.1rem;
1010
}
1111

1212
.btn.icon::before {
13-
margin-right: 0.4em;
14-
position: relative;
15-
top: 0.05em;
13+
margin-right: 0.4em;
14+
position: relative;
15+
top: 0.05em;
1616
}
1717

1818
.markdown-editor-source {
19-
width: 100%;
20-
border: 0;
21-
resize: none;
22-
height: 15em;
19+
width: 100%;
20+
border: 0;
21+
resize: none;
22+
height: 15em;
2323
}
2424

2525
.markdown-editor-preview {
26-
min-height: 15em;
26+
min-height: 15em;
2727
}
2828

2929
.markdown-editor-tab-content {
30-
border-radius: 0 0 0.25rem 0.25rem;
31-
border-top: 0;
30+
border-radius: 0 0 0.25rem 0.25rem;
31+
border-top: 0;
3232
}
3333

3434
.nav-tabs .nav-item.markdown-editor-nav-item {
35-
margin-bottom: -2px;
35+
margin-bottom: -2px;
3636
}
3737

3838
.markdown-image {
39-
display: block;
40-
margin-top: 1em;
41-
margin-bottom: 1em;
42-
margin-left: auto;
43-
margin-right: auto;
44-
max-width: 70%;
39+
display: block;
40+
margin-top: 1em;
41+
margin-bottom: 1em;
42+
margin-left: auto;
43+
margin-right: auto;
44+
max-width: 70%;
4545
}
4646

4747
.post {
48-
border: 1px solid black;
49-
margin: 10px 0;
50-
padding: 10px;
48+
border: 1px solid black;
49+
margin: 10px 0;
50+
padding: 10px;
5151
}
5252
.post-teacher {
53-
background-color: #ccf;
53+
background-color: #ccf;
5454
}
5555
.post-teacher-hidden {
56-
background-color: lightgray;
56+
background-color: lightgray;
5757
}
5858
.post-student {
59-
text-align: left;
60-
background-color: white;
59+
text-align: left;
60+
background-color: white;
6161
}
6262

6363
.post-header {
64-
font-size: 0.75em;
65-
color: #555;
64+
font-size: 0.75em;
65+
color: #555;
6666
}
6767

6868
.post-date {
69-
display: inline-block;
69+
display: inline-block;
7070
}
7171

7272
.post-author {
73-
display: inline-block;
74-
margin-right: 10px;
73+
display: inline-block;
74+
margin-right: 10px;
7575
}
7676

7777
#post-textarea {
78-
width: 100%;
78+
width: 100%;
7979
}

0 commit comments

Comments
 (0)