Mercurial > hg > mgallery
changeset 86:fd08e061413b
Use JavaScript to generate the "shadow"/bottom navigation elements in the
image view, in order to not have duplicate navigation elements when
JavaScript is disabled or not available.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 15 Sep 2016 13:40:15 +0300 |
parents | e017b5314d1c |
children | f150d044f743 |
files | mgallery.php |
diffstat | 1 files changed, 15 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mgallery.php Thu Sep 15 13:39:13 2016 +0300 +++ b/mgallery.php Thu Sep 15 13:40:15 2016 +0300 @@ -213,6 +213,17 @@ } +function mgGetNaviControlImageBoxJS(&$galIndex, $index, $class, $delta) +{ + return + "<script type=\"text/javascript\">". + "document.write(\"".str_replace("\"", "\\\"", + mgGetNaviControlImageBox($galIndex, $index, $class, $delta)). + "\");". + "</script>"; +} + + function mgGetControlText($id, $active, $url, $naviFlags) { if ($naviFlags & GNAV_TEXT) @@ -578,15 +589,15 @@ echo "<div id=\"imageCBox\">\n". - mgGetNaviControlImageBox($galImagesIndex, $index, "prevBtm", -1). - mgGetNaviControlImageBox($galImagesIndex, $index, "prev", -1). + mgGetNaviControlImageBoxJS($galImagesIndex, $index, "prevBtm", -1)."\n". + mgGetNaviControlImageBox($galImagesIndex, $index, "prev", -1)."\n". "<div class=\"imageBox\">\n". // "<a id=\"imageLink\" target=\"_blank\" href=\"".$galImageURL.$galPath."/".$galImage."\">". "<img id=\"imageImage\" src=\"".mgGetImageURL($galTNPath, $data["base"].$galMedSuffix.$data["ext"])."\" alt=\"".chentities($data["base"].$galMedSuffix.$data["ext"])."\">". // "</a>\n". "</div>\n". - mgGetNaviControlImageBox($galImagesIndex, $index, "nextBtm", 1). - mgGetNaviControlImageBox($galImagesIndex, $index, "next", 1). + mgGetNaviControlImageBoxJS($galImagesIndex, $index, "nextBtm", 1)."\n". + mgGetNaviControlImageBox($galImagesIndex, $index, "next", 1)."\n". "<div class=\"imageCaption\">".mgGetArr($data, "caption", "%1", "")."</div>\n". "<a id=\"imageLink\" target=\"_blank\" href=\"".$galImageURL.$galPath."/".$galImage."\">". "<div class=\"infoBox\">\n".