simplifying theme layout

This commit is contained in:
evilchili 2025-12-25 10:58:59 -08:00
parent 27cf36c390
commit 995e75d3e2
11 changed files with 71 additions and 91 deletions

View File

@ -3,7 +3,7 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>{% block title %}TTFROG{% endblock %}</title> <title>{% block title %}TTFROG{% endblock %}</title>
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='site.css' ) }}"> <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='froghat.css' ) }}">
{% block styles %} {% block styles %}
{% endblock %} {% endblock %}
</head> </head>
@ -22,9 +22,9 @@
<div class='content'> <div class='content'>
<main> <main>
{% for message in g.messages %} {% for message in g.messages %}
<div class="alert"> <article class="alert">
{{ message }} {{ message }}
</div> </article>
{% endfor %} {% endfor %}
{% block content %}{% endblock %} {% block content %}{% endblock %}
</main> </main>
@ -36,7 +36,6 @@
{% endblock %} {% endblock %}
</footer> </footer>
<script src="{{ url_for('static', filename='site.js') }}"></script>
{% block scripts %}{% endblock %} {% block scripts %}{% endblock %}
</body> </body>
</html> </html>

View File

@ -11,13 +11,13 @@
{% block scripts %} {% block scripts %}
<!-- for converting markdown to html --> <!-- for converting markdown to html -->
<script src="{{ url_for('static', filename='editor/purify.min.js' ) }}"></script> <script src="{{ url_for('static', filename='purify.min.js' ) }}"></script>
<script src="{{ url_for('static', filename='editor/marked.umd.min.js' ) }}"></script> <script src="{{ url_for('static', filename='marked.umd.min.js' ) }}"></script>
<script src="{{ url_for('static', filename='editor/froghat.js' ) }}"></script> <script src="{{ url_for('static', filename='froghat.js' ) }}"></script>
{% if user.can_write(page) %} {% if user.can_write(page) %}
<script src="{{ url_for('static', filename='editor/turndown.js' ) }}"></script> <script src="{{ url_for('static', filename='turndown.js' ) }}"></script>
<script src="{{ url_for('static', filename='editor/joplin-turndown-plugin-gfm.js' ) }}"></script> <script src="{{ url_for('static', filename='joplin-turndown-plugin-gfm.js' ) }}"></script>
<script src="{{ url_for('static', filename='editor/froghat-editor.js' ) }}"></script> <script src="{{ url_for('static', filename='froghat-editor.js' ) }}"></script>
{% endif %} {% endif %}
<script> <script>
const wiki = new Froghat{% if user.can_write(page) %}Editor{% endif %}({plugins: [MacroPlugin, WidgetPlugin]}); const wiki = new Froghat{% if user.can_write(page) %}Editor{% endif %}({plugins: [MacroPlugin, WidgetPlugin]});

View File

@ -1,22 +0,0 @@
#editor {
display: none;
}
#editor.loaded {
display: block;
}
#editor.view {
}
#editor.edit {
font-family: monospace;
white-space: pre;
}
#editor.wysiwyg {
}
#editor.wysiwyg .md {
opacity: 0.5;
}

View File

@ -1,8 +1,69 @@
FroghatAPIv1 = {
get: function(doc_id, callback) {
(async () => {
const raw = await fetch('/_/v1/get/' + doc_id, {
method: 'GET',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
});
const res = await raw.json();
if (res['code'] != 200) {
console.error("APIv1 error: ", res)
}
callback(res);
})();
},
put: function(data, callback) {
(async () => {
const raw = await fetch('/_/v1/put/' + window.location.pathname, {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
'body': data
}),
});
const res = await raw.json();
if (res['code'] != 200) {
console.error("APIv1 error: ", res)
}
callback(res);
})();
},
search: function(space, query, callback) {
(async () => {
const raw = await fetch('/_/v1/search/' + space, {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
'body': query
}),
});
const res = await raw.json();
if (res['code'] != 200) {
console.error("APIv1 error: ", res)
}
callback(res);
})();
},
};
class Froghat { class Froghat {
constructor(settings) { constructor(settings) {
/* /*
* Create a new Editor instance. * Create a new Froghat instance.
*/ */
this.api = settings.api || FroghatAPIv1;
this.element = document.getElementById(settings.editorId || 'froghat'); this.element = document.getElementById(settings.editorId || 'froghat');
this.source = this.element.textContent; this.source = this.element.textContent;

View File

@ -1,58 +0,0 @@
APIv1 = {
get: function(doc_id, callback) {
(async () => {
const raw = await fetch('/_/v1/get/' + doc_id, {
method: 'GET',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
}
});
const res = await raw.json();
if (res['code'] != 200) {
console.error("APIv1 error: ", res)
}
callback(res);
})();
},
put: function(data, callback) {
(async () => {
const raw = await fetch('/_/v1/put/' + window.location.pathname, {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
'body': data
}),
});
const res = await raw.json();
if (res['code'] != 200) {
console.error("APIv1 error: ", res)
}
callback(res);
})();
},
search: function(space, query, callback) {
(async () => {
const raw = await fetch('/_/v1/search/' + space, {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
'body': query
}),
});
const res = await raw.json();
if (res['code'] != 200) {
console.error("APIv1 error: ", res)
}
callback(res);
})();
},
};