comparison mgallery.php @ 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
comparison
equal deleted inserted replaced
85:e017b5314d1c 86:fd08e061413b
208 { 208 {
209 if (!mgGetNaviActive($galIndex, $index, $delta, $res, $url, TRUE)) 209 if (!mgGetNaviActive($galIndex, $index, $delta, $res, $url, TRUE))
210 $url = FALSE; 210 $url = FALSE;
211 211
212 return mgGetNaviControlImage($galIndex, $res, $class, $url); 212 return mgGetNaviControlImage($galIndex, $res, $class, $url);
213 }
214
215
216 function mgGetNaviControlImageBoxJS(&$galIndex, $index, $class, $delta)
217 {
218 return
219 "<script type=\"text/javascript\">".
220 "document.write(\"".str_replace("\"", "\\\"",
221 mgGetNaviControlImageBox($galIndex, $index, $class, $delta)).
222 "\");".
223 "</script>";
213 } 224 }
214 225
215 226
216 function mgGetControlText($id, $active, $url, $naviFlags) 227 function mgGetControlText($id, $active, $url, $naviFlags)
217 { 228 {
576 if ($naviFlags & GNAV_TOP) 587 if ($naviFlags & GNAV_TOP)
577 echo mgGetNaviControls($galImagesIndex, $index, $naviFlags); 588 echo mgGetNaviControls($galImagesIndex, $index, $naviFlags);
578 589
579 echo 590 echo
580 "<div id=\"imageCBox\">\n". 591 "<div id=\"imageCBox\">\n".
581 mgGetNaviControlImageBox($galImagesIndex, $index, "prevBtm", -1). 592 mgGetNaviControlImageBoxJS($galImagesIndex, $index, "prevBtm", -1)."\n".
582 mgGetNaviControlImageBox($galImagesIndex, $index, "prev", -1). 593 mgGetNaviControlImageBox($galImagesIndex, $index, "prev", -1)."\n".
583 "<div class=\"imageBox\">\n". 594 "<div class=\"imageBox\">\n".
584 // "<a id=\"imageLink\" target=\"_blank\" href=\"".$galImageURL.$galPath."/".$galImage."\">". 595 // "<a id=\"imageLink\" target=\"_blank\" href=\"".$galImageURL.$galPath."/".$galImage."\">".
585 "<img id=\"imageImage\" src=\"".mgGetImageURL($galTNPath, $data["base"].$galMedSuffix.$data["ext"])."\" alt=\"".chentities($data["base"].$galMedSuffix.$data["ext"])."\">". 596 "<img id=\"imageImage\" src=\"".mgGetImageURL($galTNPath, $data["base"].$galMedSuffix.$data["ext"])."\" alt=\"".chentities($data["base"].$galMedSuffix.$data["ext"])."\">".
586 // "</a>\n". 597 // "</a>\n".
587 "</div>\n". 598 "</div>\n".
588 mgGetNaviControlImageBox($galImagesIndex, $index, "nextBtm", 1). 599 mgGetNaviControlImageBoxJS($galImagesIndex, $index, "nextBtm", 1)."\n".
589 mgGetNaviControlImageBox($galImagesIndex, $index, "next", 1). 600 mgGetNaviControlImageBox($galImagesIndex, $index, "next", 1)."\n".
590 "<div class=\"imageCaption\">".mgGetArr($data, "caption", "%1", "")."</div>\n". 601 "<div class=\"imageCaption\">".mgGetArr($data, "caption", "%1", "")."</div>\n".
591 "<a id=\"imageLink\" target=\"_blank\" href=\"".$galImageURL.$galPath."/".$galImage."\">". 602 "<a id=\"imageLink\" target=\"_blank\" href=\"".$galImageURL.$galPath."/".$galImage."\">".
592 "<div class=\"infoBox\">\n". 603 "<div class=\"infoBox\">\n".
593 mgGetArr($data, "datetime", "<span class=\"infoDateTime\">%1</span>", "", "mgTimeStr"). 604 mgGetArr($data, "datetime", "<span class=\"infoDateTime\">%1</span>", "", "mgTimeStr").
594 implode(", ", array_filter($list, function($a) { return $a !== NULL; })). 605 implode(", ", array_filter($list, function($a) { return $a !== NULL; })).