summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
authorWuzzy <almikes@aol.com>2016-12-02 17:29:02 +0100
committerWuzzy <almikes@aol.com>2016-12-02 17:29:02 +0100
commite79efcb3704ca9e9e937731a49d0fcca534efd87 (patch)
treeaeb9f04895bdbf55d6af0f318e263a7745b5af54 /init.lua
parentb4a680447c17237c7eab3f47a9584ca0b971dd31 (diff)
Hide gallery buttons at start or end of gallery
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua32
1 files changed, 18 insertions, 14 deletions
diff --git a/init.lua b/init.lua
index 1023bba..2280ada 100644
--- a/init.lua
+++ b/init.lua
@@ -556,22 +556,26 @@ doc.widgets.gallery = function(imagedata, playername, x, y, aspect_ratio, width,
totalimagewidth = width - bw*2
iw = totalimagewidth / rows
ih = iw * aspect_ratio
- formstring = formstring .. "button["..x..","..y..";"..bw..","..ih..";doc_button_gallery_prev;"..F("<").."]"
- local tt
- if rows == 1 then
- tt = F("Show previous image")
- else
- tt = F("Show previous gallery page")
+ if imageindex > 1 then
+ formstring = formstring .. "button["..x..","..y..";"..bw..","..ih..";doc_button_gallery_prev;"..F("<").."]"
+ local tt
+ if rows == 1 then
+ tt = F("Show previous image")
+ else
+ tt = F("Show previous gallery page")
+ end
+ formstring = formstring .. "tooltip[doc_button_gallery_prev;"..tt.."]"
end
- formstring = formstring .. "tooltip[doc_button_gallery_prev;"..tt.."]"
- local rightx = buttonoffset + (x + rows * iw)
- formstring = formstring .. "button["..rightx..","..y..";"..bw..","..ih..";doc_button_gallery_next;"..F(">").."]"
- if rows == 1 then
- tt = F("Show next image")
- else
- tt = F("Show next gallery page")
+ if (imageindex + rows) <= #imagedata then
+ local rightx = buttonoffset + (x + rows * iw)
+ formstring = formstring .. "button["..rightx..","..y..";"..bw..","..ih..";doc_button_gallery_next;"..F(">").."]"
+ if rows == 1 then
+ tt = F("Show next image")
+ else
+ tt = F("Show next gallery page")
+ end
+ formstring = formstring .. "tooltip[doc_button_gallery_next;"..tt.."]"
end
- formstring = formstring .. "tooltip[doc_button_gallery_next;"..tt.."]"
buttonoffset = bw
else
totalimagewidth = width