customize: move save button above html textarea, add unsaved changes indicator
This commit is contained in:
parent
d97ba6d489
commit
117fc1312c
1 changed files with 13 additions and 3 deletions
|
|
@ -127,12 +127,22 @@ def handle_style_form(msg="", gateway_host="", scheme="http"):
|
||||||
f'<a href="/reindex">manage semantic index</a><br><br>'
|
f'<a href="/reindex">manage semantic index</a><br><br>'
|
||||||
f"</div>"
|
f"</div>"
|
||||||
f"{forum_section}"
|
f"{forum_section}"
|
||||||
|
f'<div id="unsaved" style="display:none;color:#888">* unsaved changes</div>'
|
||||||
|
f'<button type="submit">save</button>'
|
||||||
|
f'<script>'
|
||||||
|
f'(function(){{'
|
||||||
|
f"var f=document.querySelector('form');"
|
||||||
|
f"var u=document.getElementById('unsaved');"
|
||||||
|
f"f.addEventListener('change',function(){{u.style.display=''}});"
|
||||||
|
f"f.addEventListener('submit',function(){{u.style.display='none'}});"
|
||||||
|
f'}})();'
|
||||||
|
f'</script>'
|
||||||
|
f"</form>"
|
||||||
f"<h2>custom html</h2>"
|
f"<h2>custom html</h2>"
|
||||||
f"<p>Edit the full page template. Use <code>{esc('{{content}}')}</code> "
|
f"<p>Edit the full page template. Use <code>{esc('{{content}}')}</code> "
|
||||||
f"where page content should appear.</p>"
|
f"where page content should appear.</p>"
|
||||||
f'<textarea name="template" rows="20" cols="60">{esc(template)}</textarea><br><br>'
|
f'<textarea name="template" rows="20" cols="60">{esc(template)}</textarea><br>'
|
||||||
f'<button type="submit">save</button>'
|
f'<small>Saved with the form above.</small><br><br>'
|
||||||
f"</form>"
|
|
||||||
f"<h2>bookmarklet</h2>"
|
f"<h2>bookmarklet</h2>"
|
||||||
f"<p>Drag this link to your bookmarks bar. Click it on any page to index it instantly.</p>"
|
f"<p>Drag this link to your bookmarks bar. Click it on any page to index it instantly.</p>"
|
||||||
f'<p><a href="javascript:void(fetch(\'{esc(scheme)}://{esc(gateway_host or "localhost:8080")}/bookmark?url=\'+encodeURIComponent(location.href)+\'&token={_get_bookmark_token()}\').then(r=>r.text()).then(t=>alert(t)).catch(()=>alert(\'tinyweb not running\')))">+ save to {esc(name)}</a></p>'
|
f'<p><a href="javascript:void(fetch(\'{esc(scheme)}://{esc(gateway_host or "localhost:8080")}/bookmark?url=\'+encodeURIComponent(location.href)+\'&token={_get_bookmark_token()}\').then(r=>r.text()).then(t=>alert(t)).catch(()=>alert(\'tinyweb not running\')))">+ save to {esc(name)}</a></p>'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue