Added select all

This commit is contained in:
Tobias Reich 2014-08-24 22:10:21 +02:00
parent 61ae1b3dc3
commit c90b5f2d99
3 changed files with 70 additions and 29 deletions

View File

@ -104,6 +104,10 @@ $(document).ready(function(){
.bind(['command+backspace', 'ctrl+backspace'], function() {
if (visible.photo()&&!visible.message()) photo.delete([photo.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() {

View File

@ -21,6 +21,8 @@ multiselect = {
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 ($('.album:hover, .photo:hover').length!==0) return false;
if (visible.multiselect()) $('#multiselect').remove();
@ -34,6 +36,41 @@ multiselect = {
},
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) {
var mouse_x = e.pageX,
@ -49,7 +86,7 @@ multiselect = {
if (mouse_y>=multiselect.position.top) {
// Do not leave the screen
newHeight = e.pageY - multiselect.position.top;
newHeight = mouse_y - multiselect.position.top;
if ((multiselect.position.top+newHeight)>=$(document).height())
newHeight -= (multiselect.position.top + newHeight) - $(document).height() + 2;
@ -72,7 +109,7 @@ multiselect = {
if (mouse_x>=multiselect.position.left) {
// Do not leave the screen
newWidth = e.pageX - multiselect.position.left;
newWidth = mouse_x - multiselect.position.left;
if ((multiselect.position.left+newWidth)>=$(document).width())
newWidth -= (multiselect.position.left + newWidth) - $(document).width() + 2;

File diff suppressed because one or more lines are too long