convert OPT from a dict to a class

This commit is contained in:
2021-08-29 20:13:26 +10:00
parent f9bd558727
commit 10fcda0d7c
7 changed files with 347 additions and 177 deletions

View File

@@ -54,14 +54,14 @@
{
s='<form id="_fmv" method="POST" action="/viewlist">'
s+='<input type="hidden" name="eids" value="'+$("#eids").val() + '">'
s+='<input type="hidden" name="noo" value="{{OPT['noo']}}">'
s+='<input type="hidden" name="cwd" value="{{OPT['cwd']}}">'
s+='<input type="hidden" name="root" value="{{OPT['root']}}">'
s+='<input type="hidden" name="size" value="{{OPT['size']}}">'
s+='<input type="hidden" name="grouping" value="{{OPT['grouping']}}">'
s+='<input type="hidden" name="offset" value="{{OPT['offset']}}">'
s+='<input type="hidden" name="folders" value="{{OPT['folders']}}">'
s+='<input type="hidden" name="how_many" value="{{OPT['how_many']}}">'
s+='<input type="hidden" name="noo" value="{{OPT.noo}}">'
s+='<input type="hidden" name="cwd" value="{{OPT.cwd}}">'
s+='<input type="hidden" name="root" value="{{OPT.root}}">'
s+='<input type="hidden" name="size" value="{{OPT.size}}">'
s+='<input type="hidden" name="grouping" value="{{OPT.grouping}}">'
s+='<input type="hidden" name="offset" value="{{OPT.offset}}">'
s+='<input type="hidden" name="folders" value="{{OPT.folders}}">'
s+='<input type="hidden" name="how_many" value="{{OPT.how_many}}">'
s+='<input type="hidden" name="orig_url" value="{{request.path}}">'
s+='<input type="hidden" name="' + dir + '" value="1">'
{% if search_term is defined %}
@@ -80,7 +80,7 @@
<input type="hidden" name="eids" value={{eids}}>
<div class="row">
<button title="Show previous image" class="col-auto btn btn-outline-info px-2" style="padding: 10%" id="la"
{% if OPT['offset'] == 0 and eids.find(current|string) == 0 %}
{% if OPT.offset == 0 and eids.find(current|string) == 0 %}
disabled
{% endif %}
onClick="
@@ -90,7 +90,7 @@
prev=cidx-1
if( prev < 0 )
{
if( {{OPT['offset']}} )
if( {{OPT.offset}} )
{
CallViewListRoute('prev')
return
@@ -136,8 +136,8 @@
<button title="Show next image" class="col-auto btn btn-outline-info px-2" style="padding: 10%" id="ra"
onClick="
{% if 'last_entry_in_db' in OPT %}
if( current == {{OPT['last_entry_in_db']}} )
{% if OPT.last_entry_in_db is defined %}
if( current == {{OPT.last_entry_in_db}} )
{
$('#ra').attr('disabled', true )
return
@@ -155,7 +155,7 @@
else
{
{# only go next route if list contains as many elements as we asked to display... can be more than how_many on any page in reality, as its really how_many per dir? #}
if( eid_lst.length >= {{OPT['how_many']}} )
if( eid_lst.length >= {{OPT.how_many}} )
CallViewListRoute('next')
}
">
@@ -240,7 +240,7 @@ $( document ).keydown(function(event) {
});
var fullscreen=false;
{% if OPT['fullscreen']=='true' %}
{% if OPT.fullscreen=='true' %}
fullscreen=true;
ViewImageOrVideo()
{% endif %}