From f882bac6f2ba27367f0a302d6085faddefb49880 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Sat, 18 Oct 2014 18:08:35 +0200 Subject: [PATCH] Code adjustments --- dist/main.js | Bin 172266 -> 172363 bytes src/scripts/build.js | 26 +-- src/scripts/multiselect.js | 356 ++++++++++++++++++------------------- src/scripts/visible.js | 20 +-- 4 files changed, 200 insertions(+), 202 deletions(-) diff --git a/dist/main.js b/dist/main.js index 4998b4461de76dc078ea49a0a0509a939b2388f6..7f5b0effb1354d621783b0a5851cad75c706af4e 100644 GIT binary patch delta 8316 zcmZu$dwd(ko&SvNB#sGr`5niJq@>Djv{o$VX(?+ZAt50Y@+4`a6Wm5#*&DBSm6?_8 z)N&vk6#9Tdwq+@AXrYCaLQz3!FC32oX`w(V_sF$0go8p`dT>3iA6nYG-gjoDByRa< zS2O#Y-^~1;-``Kad8+<}r|TcyS3~I625ZP9Cdp&l+#8>4a=&#`!(^s};VeZRyp?Ve@(5yaF2hB%y8A9DpO`QwM!qoPf z1)x;*7;_GodXnl+fm%UJwTi_{97&fID-w~ITbj10h82tM^)GhR7K@npziBO(GdU7j z=foVHIg*3llC9F%h|%W^C&zh~SQ<=h4tHPtgOSP4=));)? z^J*DTHCa}MZKE&P6;f4}V$pCo!AeKYJxp-#-Wlz9?wO(BdCiP2Jde&;9AHuR+8Og2 zlyF|_>octWFjk5?M&0ktSmdsrSqH)mGq(ho>VEIn5%<{4Php~I)>b@ov(`nK+9l*= z>Q=uqkfgmV$)Zu&R`oQ?D7G(0$U;jq_tjZ^*V@_Z@w{O6=q#+AxWN7C?45*_7B!^F zG^QG{3RC7@-?&a_@YTkxms53f?6Um@y`XQh?Lj8#N;o$fhGq(;sX}rEOML9Zre_8? zrHOC)P~JHZ%NbOM+|CTtT*1mZhHb&3&a5dGO-UY?L0M%PjVgWaJxz;XFwZwFB((H? z)9xBvW@Fp@c805J)KPNWKw`Spr&ec}d#H_H`MI{Cg$#$!GA2%*wlfNgM8f)L9>y3p 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lU7QxSo6y8mX+@0JTj+sa*?5 zJkO(>QpsE*=JqPIYt=F&*+gd-^%Iworbz;Z54p=1CGV?#`1x*Kt?p z4HPGzM})5a!_MEfkKBxN{eB;r=hJ@D?1%eF3no_flSR|m;!c&jcanE@;pMd5e_|hL z@~`eEGH&ruKN-S-WQ%+-He4+pdr-v6l4};&0qJxcKm>&SGJ-$*eA)wWHOCu((1*ozSlCk z0JZ$NKPF-SGe08e8~Zo^h^+c(g3wcfVCGX~>Bj^Im-5w|m)p}N#dL1R9oZOXjWPJr zr^uQ))y+T))De)Mwe=rub3WE>sg;O#CwJQl9tf^ z%K6QqACU13a5CqvwJiV8NT{izw1n;sjYUOke#-D4Zy+-&f1DXA)lJ|4Zo8OG`q#_} zDgMjdp(gKd*N*cK-X3c3U!4;=*#LOHgLCs=N`_`t-kKWsF7{9%8nllb#lXai}i>|>$V+W#N4qVH1x diff --git a/src/scripts/build.js b/src/scripts/build.js index f1c16db..39b3a4c 100644 --- a/src/scripts/build.js +++ b/src/scripts/build.js @@ -11,19 +11,19 @@ build.divider = function(title) { return "

" + title + "

"; -}, +} build.editIcon = function(id) { return "
"; -}, +} build.multiselect = function(top, left) { return "
"; -}, +} build.album = function(albumJSON) { @@ -66,7 +66,7 @@ build.album = function(albumJSON) { return album; -}, +} build.photo = function(photoJSON) { @@ -101,7 +101,7 @@ build.photo = function(photoJSON) { return photo; -}, +} build.imageview = function(photoJSON, size, visibleControls) { @@ -138,7 +138,7 @@ build.imageview = function(photoJSON, size, visibleControls) { return view; -}, +} build.no_content = function(typ) { @@ -155,7 +155,7 @@ build.no_content = function(typ) { return no_content; -}, +} build.modal = function(title, text, button, marginTop, closeButton) { @@ -192,7 +192,7 @@ build.modal = function(title, text, button, marginTop, closeButton) { return modal; -}, +} build.signInModal = function() { @@ -213,7 +213,7 @@ build.signInModal = function() { return modal; -}, +} build.uploadModal = function(title, files) { @@ -246,7 +246,7 @@ build.uploadModal = function(title, files) { return modal; -}, +} build.contextMenu = function(items) { @@ -272,7 +272,7 @@ build.contextMenu = function(items) { return menu; -}, +} build.tags = function(tags, forView) { @@ -300,7 +300,7 @@ build.tags = function(tags, forView) { return html; -}, +} build.infoboxPhoto = function(photoJSON, forView) { @@ -405,7 +405,7 @@ build.infoboxPhoto = function(photoJSON, forView) { return infobox; -}, +} build.infoboxAlbum = function(albumJSON, forView) { diff --git a/src/scripts/multiselect.js b/src/scripts/multiselect.js index 69be00c..fcc563c 100644 --- a/src/scripts/multiselect.js +++ b/src/scripts/multiselect.js @@ -5,206 +5,204 @@ * @copyright 2014 by Tobias Reich */ -multiselect = { +multiselect = {}; - position: { +multiselect.position = { - top: null, - right: null, - bottom: null, - left: null + top: null, + right: null, + bottom: null, + left: null - }, +} - show: function(e) { +multiselect.show = function(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 ($('.album:hover, .photo:hover').length!==0) return false; - if (visible.multiselect()) $('#multiselect').remove(); + 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(); - multiselect.position.top = e.pageY; - multiselect.position.right = -1 * (e.pageX - $(document).width()); - multiselect.position.bottom = -1 * (multiselect.position.top - $(window).height()); - multiselect.position.left = e.pageX; + multiselect.position.top = e.pageY; + multiselect.position.right = -1 * (e.pageX - $(document).width()); + multiselect.position.bottom = -1 * (multiselect.position.top - $(window).height()); + multiselect.position.left = e.pageX; - $('body').append(build.multiselect(multiselect.position.top, multiselect.position.left)); - $(document).on('mousemove', multiselect.resize); + $('body').append(build.multiselect(multiselect.position.top, multiselect.position.left)); + $(document).on('mousemove', multiselect.resize); - }, +} - selectAll: function() { +multiselect.selectAll = function() { - var e, - newWidth, - newHeight; + var e, + newWidth, + newHeight; - 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(); + 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; + 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)); + $('body').append(build.multiselect(multiselect.position.top, multiselect.position.left)); - newWidth = $(document).width() - multiselect.position.right + 2; - newHeight = $(document).height() - multiselect.position.bottom; + 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); + +} + +multiselect.resize = function(e) { + + var mouse_x = e.pageX, + mouse_y = e.pageY, + newHeight, + newWidth; + + if (multiselect.position.top===null|| + multiselect.position.right===null|| + multiselect.position.bottom===null|| + multiselect.position.left===null) return false; + + if (mouse_y>=multiselect.position.top) { + + // Do not leave the screen + newHeight = mouse_y - multiselect.position.top; + if ((multiselect.position.top+newHeight)>=$(document).height()) + newHeight -= (multiselect.position.top + newHeight) - $(document).height() + 2; $('#multiselect').css({ - width: newWidth, + top: multiselect.position.top, + bottom: 'inherit', 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, - mouse_y = e.pageY, - newHeight, - newWidth; - - if (multiselect.position.top===null|| - multiselect.position.right===null|| - multiselect.position.bottom===null|| - multiselect.position.left===null) return false; - - if (mouse_y>=multiselect.position.top) { - - // Do not leave the screen - newHeight = mouse_y - multiselect.position.top; - if ((multiselect.position.top+newHeight)>=$(document).height()) - newHeight -= (multiselect.position.top + newHeight) - $(document).height() + 2; - - $('#multiselect').css({ - top: multiselect.position.top, - bottom: 'inherit', - height: newHeight - }); - - } else { - - $('#multiselect').css({ - top: 'inherit', - bottom: multiselect.position.bottom, - height: multiselect.position.top - e.pageY - }); - - } - - if (mouse_x>=multiselect.position.left) { - - // Do not leave the screen - newWidth = mouse_x - multiselect.position.left; - if ((multiselect.position.left+newWidth)>=$(document).width()) - newWidth -= (multiselect.position.left + newWidth) - $(document).width() + 2; - - $('#multiselect').css({ - right: 'inherit', - left: multiselect.position.left, - width: newWidth - }); - - } else { - - $('#multiselect').css({ - right: multiselect.position.right, - left: 'inherit', - width: multiselect.position.left - e.pageX - }); - - } - - }, - - stopResize: function() { - - $(document).off('mousemove'); - - }, - - getSize: function() { - - if (!visible.multiselect()) return false; - - return { - top: $('#multiselect').offset().top, - left: $('#multiselect').offset().left, - width: parseInt($('#multiselect').css('width').replace('px', '')), - height: parseInt($('#multiselect').css('height').replace('px', '')) - }; - - }, - - getSelection: function(e) { - - var tolerance = 150, - id, - ids = [], - offset, - size = multiselect.getSize(); - - if (visible.contextMenu()) return false; - if (!visible.multiselect()) return false; - - $('.photo, .album').each(function() { - - offset = $(this).offset(); - - if (offset.top>=(size.top-tolerance)&& - offset.left>=(size.left-tolerance)&& - (offset.top+206)<=(size.top+size.height+tolerance)&& - (offset.left+206)<=(size.left+size.width+tolerance)) { - - id = $(this).data('id'); - - if (id!=='0'&&id!==0&&id!=='f'&&id!=='s'&&id!=='r'&&id!==null&&id!==undefined) { - - ids.push(id); - $(this).addClass('active'); - - } - - } + } else { + $('#multiselect').css({ + top: 'inherit', + bottom: multiselect.position.bottom, + height: multiselect.position.top - e.pageY }); - if (ids.length!==0&&visible.album()) contextMenu.photoMulti(ids, e); - else if (ids.length!==0&&visible.albums()) contextMenu.albumMulti(ids, e); - else multiselect.close(); - - }, - - close: function() { - - multiselect.stopResize(); - - multiselect.position.top = null; - multiselect.position.right = null; - multiselect.position.bottom = null; - multiselect.position.left = null; - - lychee.animate('#multiselect', 'fadeOut'); - setTimeout(function() { - $('#multiselect').remove(); - }, 300); - } -}; \ No newline at end of file + if (mouse_x>=multiselect.position.left) { + + // Do not leave the screen + newWidth = mouse_x - multiselect.position.left; + if ((multiselect.position.left+newWidth)>=$(document).width()) + newWidth -= (multiselect.position.left + newWidth) - $(document).width() + 2; + + $('#multiselect').css({ + right: 'inherit', + left: multiselect.position.left, + width: newWidth + }); + + } else { + + $('#multiselect').css({ + right: multiselect.position.right, + left: 'inherit', + width: multiselect.position.left - e.pageX + }); + + } + +} + +multiselect.stopResize = function() { + + $(document).off('mousemove'); + +} + +multiselect.getSize = function() { + + if (!visible.multiselect()) return false; + + return { + top: $('#multiselect').offset().top, + left: $('#multiselect').offset().left, + width: parseInt($('#multiselect').css('width').replace('px', '')), + height: parseInt($('#multiselect').css('height').replace('px', '')) + }; + +} + +multiselect.getSelection = function(e) { + + var tolerance = 150, + id, + ids = [], + offset, + size = multiselect.getSize(); + + if (visible.contextMenu()) return false; + if (!visible.multiselect()) return false; + + $('.photo, .album').each(function() { + + offset = $(this).offset(); + + if (offset.top>=(size.top-tolerance)&& + offset.left>=(size.left-tolerance)&& + (offset.top+206)<=(size.top+size.height+tolerance)&& + (offset.left+206)<=(size.left+size.width+tolerance)) { + + id = $(this).data('id'); + + if (id!=='0'&&id!==0&&id!=='f'&&id!=='s'&&id!=='r'&&id!==null&&id!==undefined) { + + ids.push(id); + $(this).addClass('active'); + + } + + } + + }); + + if (ids.length!==0&&visible.album()) contextMenu.photoMulti(ids, e); + else if (ids.length!==0&&visible.albums()) contextMenu.albumMulti(ids, e); + else multiselect.close(); + +} + +multiselect.close = function() { + + multiselect.stopResize(); + + multiselect.position.top = null; + multiselect.position.right = null; + multiselect.position.bottom = null; + multiselect.position.left = null; + + lychee.animate('#multiselect', 'fadeOut'); + setTimeout(function() { + $('#multiselect').remove(); + }, 300); + +} \ No newline at end of file diff --git a/src/scripts/visible.js b/src/scripts/visible.js index dd88928..226f014 100755 --- a/src/scripts/visible.js +++ b/src/scripts/visible.js @@ -10,54 +10,54 @@ visible = {}; visible.albums = function() { if ($('#tools_albums').css('display')==='block') return true; else return false; -}, +} visible.album = function() { if ($('#tools_album').css('display')==='block') return true; else return false; -}, +} visible.photo = function() { if ($('#imageview.fadeIn').length>0) return true; else return false; -}, +} visible.search = function() { if (search.code!==null&&search.code!=='') return true; else return false; -}, +} visible.infobox = function() { if ($('#infobox.active').length>0) return true; else return false; -}, +} visible.infoboxbutton = function() { if (visible.albums()) return false; if (visible.photo()) return true; if (visible.album()&&$('#button_info_album:visible').length>0) return true; else return false; -}, +} visible.controls = function() { if (lychee.loadingBar.css('opacity')<1) return false; else return true; -}, +} visible.message = function() { if ($('.message').length>0) return true; else return false; -}, +} visible.signin = function() { if ($('.message .sign_in').length>0) return true; else return false; -}, +} visible.contextMenu = function() { if ($('.contextmenu').length>0) return true; else return false; -}, +} visible.multiselect = function() { if ($('#multiselect').length>0) return true;