From: David ‘Bombe’ Roden Date: Fri, 23 Sep 2011 05:29:30 +0000 (+0200) Subject: Show image editing functions on click. X-Git-Tag: 0.7^2~2^2~37 X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=commitdiff_plain;h=b89370064bdc618ee7a3ce77a705fcecb28c3dcc Show image editing functions on click. --- diff --git a/src/main/resources/templates/imageBrowser.html b/src/main/resources/templates/imageBrowser.html index 162441a..f34f4a6 100644 --- a/src/main/resources/templates/imageBrowser.html +++ b/src/main/resources/templates/imageBrowser.html @@ -77,6 +77,23 @@ hideAndShowBlock(".create-album", ".show-create-album", ".hide-create-album"); hideAndShowBlock(".upload-image", ".show-upload-image", ".hide-upload-image"); hideAndShowBlock(".delete-album", ".show-delete-album", ".hide-delete-album"); + + hideAndShowData = function(activationElements, activeElements, hideElement, showElement) { + $(activationElements).click(function() { + imageId = $(this).closest(".image").find(".image-id").text(); + $(hideElement, $("#image-" + imageId)).hide(); + $(showElement, $("#image-" + imageId)).show(); + $(document).click(function(event) { + if ($(event.target).closest("#image-" + imageId).size() == 0) { + $(showElement).hide(); + $(hideElement).show(); + } + return false; + }); + }); + }; + + hideAndShowData(".image-title, .image-description", ".image", ".show-data", ".edit-data"); }); <%/if>