diff options
author | plegall <plg@piwigo.org> | 2012-02-09 10:34:45 +0000 |
---|---|---|
committer | plegall <plg@piwigo.org> | 2012-02-09 10:34:45 +0000 |
commit | 065debcad40ffcc7676339f519588be15ee8b0c1 (patch) | |
tree | c6d5295c11eb4ad46e5fd29239a2769f8eb67dc8 /admin | |
parent | e1b5e45c12a25ac8ed674acf200f11c8a5003d9d (diff) |
feature 2460 added: ability to Shift-click in the Batch Manager, to select
several photos easily. Patch from Dsls.
git-svn-id: http://piwigo.org/svn/trunk@13065 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | admin/themes/default/template/batch_manager_global.tpl | 63 |
1 files changed, 56 insertions, 7 deletions
diff --git a/admin/themes/default/template/batch_manager_global.tpl b/admin/themes/default/template/batch_manager_global.tpl index 76a99de5b..562704661 100644 --- a/admin/themes/default/template/batch_manager_global.tpl +++ b/admin/themes/default/template/batch_manager_global.tpl @@ -7,6 +7,52 @@ pwg_initialization_datepicker("#date_creation_day", "#date_creation_month", "#date_creation_year", "#date_creation_linked_date", "#date_creation_action_set"); {/literal}{/footer_script} +{footer_script}{literal} +/* Shift-click: select all photos between the click and the shift+click */ +jQuery(document).ready(function() { + var last_clicked=0; + var last_clickedstatus=true; + jQuery.fn.enableShiftClick = function() { + var inputs = []; + var count=0; + var This=$(this); + this.find('input[type=checkbox]').each(function() { + var pos=count; + inputs[count++]=this; + $(this).bind("shclick", function (dummy,event) { + if (event.shiftKey) { + var first = last_clicked; + var last = pos; + if (first > last) { + first=pos; + last=last_clicked; + } + + for (var i=first; i<=last;i++) { + input = $(inputs[i]); + $(input).attr('checked', last_clickedstatus); + if (last_clickedstatus) + { + $(input).siblings("span.wrap2").addClass("thumbSelected"); + } + else + { + $(input).siblings("span.wrap2").removeClass("thumbSelected"); + } + } + } + else { + last_clicked = pos; + last_clickedstatus = this.checked; + } + return true; + }); + $(this).click(function(event) {console.log(event.shiftKey);$(this).triggerHandler("shclick",event)}); + }); + } +}); +{/literal}{/footer_script} + {combine_script id='jquery.tokeninput' load='footer' require='jquery' path='themes/default/js/plugins/jquery.tokeninput.js'} {combine_script id='jquery.progressBar' load='footer' path='themes/default/js/plugins/jquery.progressbar.min.js'} {combine_script id='jquery.ajaxmanager' load='footer' path='themes/default/js/plugins/jquery.ajaxmanager.js'} @@ -209,12 +255,14 @@ $(document).ready(function() { } }); - $(".wrap1 label").click(function () { + $(".wrap1 label").click(function (event) { $("input[name=setSelected]").attr('checked', false); var wrap2 = $(this).children(".wrap2"); var checkbox = $(this).children("input[type=checkbox]"); + checkbox.triggerHandler("shclick",event); + if ($(checkbox).is(':checked')) { $(wrap2).addClass("thumbSelected"); } @@ -453,12 +501,13 @@ $(document).ready(function() { }); jQuery(window).load(function() { - var max_dim = 0; - $(".thumbnails img").each(function () { - max_dim = Math.max(max_dim, $(this).height(), $(this).width() ); - }); - max_dim += 20; - $("ul.thumbnails span, ul.thumbnails label").css('width', max_dim+'px').css('height', max_dim+'px'); + var max_dim = 0; + $(".thumbnails img").each(function () { + max_dim = Math.max(max_dim, $(this).height(), $(this).width() ); + }); + max_dim += 20; + $("ul.thumbnails span, ul.thumbnails label").css('width', max_dim+'px').css('height', max_dim+'px'); + $('ul.thumbnails').enableShiftClick(); }); {/literal}{/footer_script} |