!' This is the third party lib "GW_GALLERY.bas"
!' http://laughton.com/basic/programs/html/GW%20(GUI-Web%20lib)/
!'
!' This lib requires the main lib "GW.bas" and of course Android RFO-BASIC!
!' To download the lib when you have "GW.bas" on your device, do:
!' GW_DOWNLOAD_THIRD_PARTY("GW_GALLERY.bas")
!'
!' USAGE: in your program do: INCLUDE "GW_GALLERY.bas"
!' Then call:
!' mygallery = GW_ADD_GALLERY (mypage, thumbnails_height, imgs_list$[])
!' GW_GALLERY_IS_OPEN (mygallery) % return 1 if gallery is open else 0
!' GW_CLOSE_GALLERY (mygallery) % close an opened gallery
!' GW_AMODIFY (mygallery, "content", new_imgs_list$[])
INCLUDE "GW.bas"
FN.DEF GW_ADD_GALLERY$(img$[]) %' (internal) builds a series of for use with gallery
ARRAY.LENGTH al, img$[]
FOR i=1 TO al
j=IS_IN(">", img$[i])
IF j>0 THEN
i$=LEFT$(img$[i], j-1)
lnk$=WEB$("javascript:RFO("+CHR$(34)+MID$(img$[i], j+1)+CHR$(34)+")")
ELSE
i$=img$[i]
lnk$="false"
END IF
e$+="
"
script1$+="var img"+INT$(i)+"dat='"+i$+"';$('#img"+INT$(i)+"thb').attr('src',img"+INT$(i)+"dat);"
script2$+="$('#img"+INT$(i)+"big').attr('data-src',img"+INT$(i)+"dat);"
NEXT
FN.RTN e$+""
FN.END
FN.DEF GW_ADD_GALLERY(page, height, img$[])
!' Check resources
IF IS_APK()
MAKE_SURE_IS_ON_SD("GW/lightgallery/lightgallery.min.css")
MAKE_SURE_IS_ON_SD("GW/lightgallery/lightgallery.min.js")
MAKE_SURE_IS_ON_SD("GW/lightgallery/lg-zoom.min.js")
MAKE_SURE_IS_ON_SD("GW/lightgallery/lg-thumbnail.min.js")
MAKE_SURE_IS_ON_SD("GW/lightgallery/lg.ttf")
MAKE_SURE_IS_ON_SD("GW/lightgallery/justifiedGallery.min.css")
MAKE_SURE_IS_ON_SD("GW/lightgallery/justifiedGallery.min.js")
END IF
GW_CHECK_AND_DOWNLOAD("GW/lightgallery/lightgallery.min.css")
GW_CHECK_AND_DOWNLOAD("GW/lightgallery/lightgallery.min.js")
GW_CHECK_AND_DOWNLOAD("GW/lightgallery/lg-zoom.min.js")
GW_CHECK_AND_DOWNLOAD("GW/lightgallery/lg-thumbnail.min.js")
GW_CHECK_AND_DOWNLOAD("GW/lightgallery/lg.ttf")
GW_CHECK_AND_DOWNLOAD("GW/lightgallery/justifiedGallery.min.css")
GW_CHECK_AND_DOWNLOAD("GW/lightgallery/justifiedGallery.min.js")
!' Add 'LightGallery' and 'justifiedGallery' references to the page
e$=GW_PAGE$(page)
IF !IS_IN("GW/lightgallery/lightgallery", e$) THEN
script$=""
script$+=""
script$+=""
script$+=""
script$+=""
script$+=""
i=IS_IN("", e$)
e$=LEFT$(e$,i-1)+script$+MID$(e$,i)
END IF
!' Create the control
u$=GW_NEWID$("gallery")
!' Add the element to the page
e$+="