From 4808179f5f11f77bfc38f8b6dc41a6d88bd3b192 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Fri, 9 Aug 2013 22:41:14 +0200 Subject: Add delete support to thumbnail history Signed-off-by: Florian Pritz --- data/css/style.css | 8 ++++++++ data/js/script.js | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) (limited to 'data') diff --git a/data/css/style.css b/data/css/style.css index ad956c57f..bcbcaafc5 100644 --- a/data/css/style.css +++ b/data/css/style.css @@ -238,6 +238,14 @@ body { display: inline-block; } +.upload_history_thumbnails .marked { + background: red; +} + +.upload_history_thumbnails .marked img { + opacity: 0.4; +} + /* highlighting theme */ .hll { background-color: #ffffcc } 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) { + $('').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))); -- cgit v1.2.3-24-g4f1b