Skip to content

Commit

Permalink
feature 2460 added: ability to Shift-click in the Batch Manager, to s…
Browse files Browse the repository at this point in the history
…elect

several photos easily. Patch from Dsls.


git-svn-id: http://piwigo.org/svn/trunk@13065 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
plegall committed Feb 9, 2012
1 parent e1b5e45 commit 065debc
Showing 1 changed file with 56 additions and 7 deletions.
63 changes: 56 additions & 7 deletions admin/themes/default/template/batch_manager_global.tpl
Expand Up @@ -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'}
Expand Down Expand Up @@ -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");
}
Expand Down Expand Up @@ -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}

Expand Down

0 comments on commit 065debc

Please sign in to comment.