diff options
author | Florian Pritz <bluewind@xinu.at> | 2013-08-09 22:41:14 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2013-08-09 22:41:14 +0200 |
commit | 4808179f5f11f77bfc38f8b6dc41a6d88bd3b192 (patch) | |
tree | 3b9000dbd846e59383e944827bc8710121933d25 /data/js/script.js | |
parent | 712c0c158e468220a91884394be2c8e53957c628 (diff) |
Add delete support to thumbnail history
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'data/js/script.js')
-rw-r--r-- | data/js/script.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/data/js/script.js b/data/js/script.js index f747941e5..ec5da9a2b 100644 --- a/data/js/script.js +++ b/data/js/script.js @@ -68,6 +68,41 @@ function fixedEncodeURIComponent (str) { html: true, }); + $('#toggle_delete_mode').on("click", function() { + switch (window.page_mode) { + case "delete": + window.page_mode = "normal"; + $('#delete_button').hide(); + $("#delete_form input[id^='delete_']").remove(); + $(".upload_history_thumbnails .marked").removeClass("marked"); + break; + default: + window.page_mode = "delete"; + $('#delete_button').show(); + break; + } + }); + + $('.upload_history_thumbnails a').on("click", function(event) { + if (window.page_mode == "delete") { + event.preventDefault(); + var data_id = $(event.target).parent().attr("data-id"); + + if ($('#delete_'+data_id).length == 0) { + $('<input>').attr({ + type: "hidden", + name: "ids["+data_id+"]", + value: data_id, + id: "delete_"+data_id, + }).appendTo('#delete_form'); + $(event.target).parent().addClass("marked"); + } else { + $('#delete_'+data_id).remove(); + $(event.target).parent().removeClass("marked"); + } + } + }); + function handle_resize() { var div = $('.upload_history_thumbnails'); div.width(div.parent().width() - (div.parent().width() % div.find('a').outerWidth(true))); |