clean up includes, double up of fullscreen var, and use of current still

This commit is contained in:
2025-10-04 10:37:00 +10:00
parent 525b823632
commit 4138f392d3

View File

@@ -1,14 +1,17 @@
{% extends "base.html" %}
{% block main_content %}
<script src="{{ url_for( 'internal', filename='js/files_support.js')}}"></script>
<script src="{{ url_for( 'internal', filename='js/files_transform.js')}}"></script>
<script src="{{ url_for( 'internal', filename='js/files_support.js')}}"></script>
<script src="{{ url_for( 'internal', filename='js/view_support.js')}}"></script>
<script>
// FIXME: used by viewer code - should probably get rid of this?
var fullscreen=false;
// FIXME: why is this script block at the top? and not at the bottom
document.fake_shift=0
document.fake_ctrl=0
// FIXME: used by viewer code - should probably get rid of this?
var fullscreen=false;
// FIXME: doco / and convert to json
var move_paths=[]
{% for p in move_paths %}
p = new Object()
@@ -19,8 +22,7 @@
{% endfor %}
// GLOBALS
// this is which eid we are viewing an image/video (when we dbl-click & then next/prev)
document.viewing_eid=null;
// this is the current entry (object) we are viewing - an image/video (used when we dbl-click to view & then in next/prev in view)
document.viewing=null;
var OPT = {{ OPT.to_dict()|tojson }};
@@ -34,6 +36,7 @@
// force pageList to set pageList for & render the first page
getPage(1,getPageFigures)
// FIXME: MOVE to file_support.js
function changeSize()
{
sz=$('input[name="size"]:checked').val();
@@ -78,6 +81,7 @@
<span class="alert alert-primary p-2">Searched for: '{{search_term}}'</span>
</div class="col my-auto">
<script>
// FIXME: need to move this into getPage (or similar), so its picked up always not just on first load
$('#folders').prop('disabled', 'disabled').removeClass('border-info').addClass('border-secondary').removeClass('text-info').addClass('text-secondary');
</script>
{% endif %}
@@ -158,10 +162,9 @@
#tst90:hover,#tst90:focus { filter: invert(73%) sepia(27%) saturate(3970%) hue-rotate(146deg) brightness(94%) contrast(100%); }
</style>
<script src="{{ url_for( 'internal', filename='js/view_transform.js')}}"></script>
<script src="{{ url_for( 'internal', filename='js/view_support.js')}}"></script>
<script>
// FIXME: doco, but also gather all globals together, many make them all document. to be obviously global (and add fullscreen)
var gap=0.8
var grayscale=0
var throbber=0
@@ -172,6 +175,7 @@
var st_path="static/Storage/{{st_path}}"
var bin_path="static/Bin/{{bin_path}}"
// FIXME: MOVE these functions to file_support.js
function PrettyFname(fname)
{
s='<span class="alert alert-secondary py-2">'
@@ -352,7 +356,7 @@
<svg width="32" height="32" fill="currentColor"><use xlink:href="{{url_for('internal', filename='icons.svg')}}#download"/></svg>
</button>
<button id="del" class="btn btn-outline-danger p-1" title="Delete (hotkey: Del)"
onClick="$.ajax({ type: 'POST', data: '&eid-0={{current}}', url: '/delete_files', success: function(data){ window.location='/'; return false; } })">
onClick="$.ajax({ type: 'POST', data: '&eid-0='+document.viewing.id, url: '/delete_files', success: function(data){ window.location='/'; return false; } })">
<svg width="32" height="32" fill="currentColor"><use xlink:href="{{url_for('internal', filename='icons.svg')}}#trash"/></svg>
</button>
</div>
@@ -363,6 +367,7 @@
{% block script_content %}
<script>
// FIXME: MOVE the majorty of below to files_support/view_support. MIGHT help to have urls go into a global too, and then can ignore many of the above items needing url_for
$( document ).keydown(function(event) {
// if dbox is visible, dont process this hot-key, we are inputting text
// into inputs instead
@@ -403,8 +408,6 @@ $( document ).keydown(function(event) {
}
});
var fullscreen=false;
$(document).on('click', function(e) { $('.highlight').removeClass('highlight') ; SetButtonState() });
function dblClickToViewEntry(id) {