diff mgallery.php @ 154:0b87e7c1675c

Improve the JavaScript event hook functions.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 07 Nov 2017 14:40:14 +0200
parents fd84c6a8c4c9
children 458c2d6637b1
line wrap: on
line diff
--- a/mgallery.php	Wed Sep 06 18:21:17 2017 +0300
+++ b/mgallery.php	Tue Nov 07 14:40:14 2017 +0200
@@ -614,12 +614,13 @@
       "\n";
 ?>
 mgalDisplayInfo(false);
-mgalAddEvent(document.getElementById("pageInfoButton"), "click", mgalOpenInfo);
-mgalAddEvent(document.getElementById("imageCBox"), "click", mgalCloseInfo);
+mgalAddEvent("pageInfoButton", "click", mgalOpenInfo);
+mgalAddEvent("imageCBox", "click", mgalCloseInfo);
 
-mgalAddEvent(document.getElementById("imageImage"), "load", mgalAdjustImageDo);
-mgalAddEvent(window, "resize", mgalAdjustImage);
-mgalAddEvent(document, "keypress", mgalProcessKeyPress);
+mgalAddEvent("imageImage", "load", mgalAdjustImageDo);
+mgalAddEventOb("window", window, "resize", mgalAdjustImage);
+mgalAddEventOb("document", document, "keypress", mgalProcessKeyPress);
+
 adjustPID = -1;
 </script>
 <?