Added select all
This commit is contained in:
parent
61ae1b3dc3
commit
c90b5f2d99
@ -104,6 +104,10 @@ $(document).ready(function(){
|
|||||||
.bind(['command+backspace', 'ctrl+backspace'], function() {
|
.bind(['command+backspace', 'ctrl+backspace'], function() {
|
||||||
if (visible.photo()&&!visible.message()) photo.delete([photo.getID()]);
|
if (visible.photo()&&!visible.message()) photo.delete([photo.getID()]);
|
||||||
else if (visible.album()&&!visible.message()) album.delete([album.getID()]);
|
else if (visible.album()&&!visible.message()) album.delete([album.getID()]);
|
||||||
|
})
|
||||||
|
.bind(['command+a', 'ctrl+a'], function() {
|
||||||
|
if (visible.album()&&!visible.message()) multiselect.selectAll();
|
||||||
|
else if (visible.albums()&&!visible.message()) multiselect.selectAll();
|
||||||
});
|
});
|
||||||
|
|
||||||
Mousetrap.bindGlobal('enter', function() {
|
Mousetrap.bindGlobal('enter', function() {
|
||||||
|
@ -9,31 +9,68 @@ multiselect = {
|
|||||||
|
|
||||||
position: {
|
position: {
|
||||||
|
|
||||||
top: null,
|
top: null,
|
||||||
right: null,
|
right: null,
|
||||||
bottom: null,
|
bottom: null,
|
||||||
left: null
|
left: null
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
show: function(e) {
|
show: function(e) {
|
||||||
|
|
||||||
if (mobileBrowser()) return false;
|
if (mobileBrowser()) return false;
|
||||||
if (lychee.publicMode) return false;
|
if (lychee.publicMode) return false;
|
||||||
if (visible.search()) return false;
|
if (visible.search()) return false;
|
||||||
if ($('.album:hover, .photo:hover').length!==0) return false;
|
if (visible.infobox()) return false;
|
||||||
if (visible.multiselect()) $('#multiselect').remove();
|
if (!visible.albums()&&!visible.album) return false;
|
||||||
|
if ($('.album:hover, .photo:hover').length!==0) return false;
|
||||||
|
if (visible.multiselect()) $('#multiselect').remove();
|
||||||
|
|
||||||
multiselect.position.top = e.pageY;
|
multiselect.position.top = e.pageY;
|
||||||
multiselect.position.right = -1 * (e.pageX - $(document).width());
|
multiselect.position.right = -1 * (e.pageX - $(document).width());
|
||||||
multiselect.position.bottom = -1 * (multiselect.position.top - $(window).height());
|
multiselect.position.bottom = -1 * (multiselect.position.top - $(window).height());
|
||||||
multiselect.position.left = e.pageX;
|
multiselect.position.left = e.pageX;
|
||||||
|
|
||||||
$('body').append(build.multiselect(multiselect.position.top, multiselect.position.left));
|
$('body').append(build.multiselect(multiselect.position.top, multiselect.position.left));
|
||||||
$(document).on('mousemove', multiselect.resize);
|
$(document).on('mousemove', multiselect.resize);
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
selectAll: function() {
|
||||||
|
|
||||||
|
var e;
|
||||||
|
|
||||||
|
if (mobileBrowser()) return false;
|
||||||
|
if (lychee.publicMode) return false;
|
||||||
|
if (visible.search()) return false;
|
||||||
|
if (visible.infobox()) return false;
|
||||||
|
if (!visible.albums()&&!visible.album) return false;
|
||||||
|
if (visible.multiselect()) $('#multiselect').remove();
|
||||||
|
|
||||||
|
multiselect.position.top = 70;
|
||||||
|
multiselect.position.right = 40;
|
||||||
|
multiselect.position.bottom = 90;
|
||||||
|
multiselect.position.left = 20;
|
||||||
|
|
||||||
|
$('body').append(build.multiselect(multiselect.position.top, multiselect.position.left));
|
||||||
|
|
||||||
|
newWidth = $(document).width() - multiselect.position.right + 2;
|
||||||
|
newHeight = $(document).height() - multiselect.position.bottom;
|
||||||
|
|
||||||
|
$('#multiselect').css({
|
||||||
|
width: newWidth,
|
||||||
|
height: newHeight
|
||||||
|
});
|
||||||
|
|
||||||
|
e = {
|
||||||
|
pageX: $(document).width() - (multiselect.position.right / 2),
|
||||||
|
pageY: $(document).height() - multiselect.position.bottom
|
||||||
|
}
|
||||||
|
|
||||||
|
multiselect.getSelection(e);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
resize: function(e) {
|
resize: function(e) {
|
||||||
|
|
||||||
var mouse_x = e.pageX,
|
var mouse_x = e.pageX,
|
||||||
@ -49,7 +86,7 @@ multiselect = {
|
|||||||
if (mouse_y>=multiselect.position.top) {
|
if (mouse_y>=multiselect.position.top) {
|
||||||
|
|
||||||
// Do not leave the screen
|
// Do not leave the screen
|
||||||
newHeight = e.pageY - multiselect.position.top;
|
newHeight = mouse_y - multiselect.position.top;
|
||||||
if ((multiselect.position.top+newHeight)>=$(document).height())
|
if ((multiselect.position.top+newHeight)>=$(document).height())
|
||||||
newHeight -= (multiselect.position.top + newHeight) - $(document).height() + 2;
|
newHeight -= (multiselect.position.top + newHeight) - $(document).height() + 2;
|
||||||
|
|
||||||
@ -72,7 +109,7 @@ multiselect = {
|
|||||||
if (mouse_x>=multiselect.position.left) {
|
if (mouse_x>=multiselect.position.left) {
|
||||||
|
|
||||||
// Do not leave the screen
|
// Do not leave the screen
|
||||||
newWidth = e.pageX - multiselect.position.left;
|
newWidth = mouse_x - multiselect.position.left;
|
||||||
if ((multiselect.position.left+newWidth)>=$(document).width())
|
if ((multiselect.position.left+newWidth)>=$(document).width())
|
||||||
newWidth -= (multiselect.position.left + newWidth) - $(document).width() + 2;
|
newWidth -= (multiselect.position.left + newWidth) - $(document).width() + 2;
|
||||||
|
|
||||||
@ -105,10 +142,10 @@ multiselect = {
|
|||||||
if (!visible.multiselect()) return false;
|
if (!visible.multiselect()) return false;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
top: $('#multiselect').offset().top,
|
top: $('#multiselect').offset().top,
|
||||||
left: $('#multiselect').offset().left,
|
left: $('#multiselect').offset().left,
|
||||||
width: parseInt($('#multiselect').css('width').replace('px', '')),
|
width: parseInt($('#multiselect').css('width').replace('px', '')),
|
||||||
height: parseInt($('#multiselect').css('height').replace('px', ''))
|
height: parseInt($('#multiselect').css('height').replace('px', ''))
|
||||||
};
|
};
|
||||||
|
|
||||||
},
|
},
|
||||||
@ -156,10 +193,10 @@ multiselect = {
|
|||||||
|
|
||||||
multiselect.stopResize();
|
multiselect.stopResize();
|
||||||
|
|
||||||
multiselect.position.top = null;
|
multiselect.position.top = null;
|
||||||
multiselect.position.right = null;
|
multiselect.position.right = null;
|
||||||
multiselect.position.bottom = null;
|
multiselect.position.bottom = null;
|
||||||
multiselect.position.left = null;
|
multiselect.position.left = null;
|
||||||
|
|
||||||
lychee.animate('#multiselect', 'fadeOut');
|
lychee.animate('#multiselect', 'fadeOut');
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user