From 327e907c7da077c64cf13e76e1d97521d8696163 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Mon, 17 Feb 2014 16:22:53 +0100 Subject: [PATCH] Trim whitespace --- assets/js/modules/album.js | 30 +++++----- assets/js/modules/build.js | 4 +- assets/js/modules/lychee.js | 1 - assets/js/modules/multiselect.js | 94 ++++++++++++++++---------------- assets/js/modules/photo.js | 46 ++++++++-------- assets/js/modules/upload.js | 18 +++--- assets/js/modules/view.js | 8 +-- assets/js/modules/visible.js | 4 +- 8 files changed, 102 insertions(+), 103 deletions(-) diff --git a/assets/js/modules/album.js b/assets/js/modules/album.js index 2fea995..232b971 100644 --- a/assets/js/modules/album.js +++ b/assets/js/modules/album.js @@ -120,7 +120,7 @@ album = { }], ["Cancel", function() {}] ]; - + modal.show("New Album", "Enter a title for this album: ", buttons); }, @@ -130,7 +130,7 @@ album = { var params, buttons, albumTitle; - + if (!albumIDs) return false; if (albumIDs instanceof Array===false) albumIDs = [albumIDs]; @@ -141,12 +141,12 @@ album = { lychee.api(params, function(data) { if (visible.albums()) { - + albumIDs.forEach(function(id, index, array) { albums.json.num--; view.albums.content.delete(id); }); - + } else lychee.goto(""); if (data!==true) lychee.error(null, params, data); @@ -161,27 +161,27 @@ album = { buttons[0][0] = "Clear Unsorted"; buttons[1][0] = "Keep Unsorted"; - + modal.show("Clear Unsorted", "Are you sure you want to delete all photos from 'Unsorted'?
This action can't be undone!", buttons) } else if (albumIDs.length===1) { - + buttons[0][0] = "Delete Album and Photos"; buttons[1][0] = "Keep Album"; - + // Get title if (album.json) albumTitle = album.json.title; else if (albums.json) albumTitle = albums.json.content[albumIDs].title; - + modal.show("Delete Album", "Are you sure you want to delete the album '" + albumTitle + "' and all of the photos it contains? This action can't be undone!", buttons); } else { - + buttons[0][0] = "Delete Albums and Photos"; buttons[1][0] = "Keep Albums"; - + modal.show("Delete Albums", "Are you sure you want to delete all " + albumIDs.length + " selected albums and all of the photos they contain? This action can't be undone!", buttons); - + } }, @@ -195,7 +195,7 @@ album = { if (!albumIDs) return false; if (albumIDs instanceof Array===false) albumIDs = [albumIDs]; - + if (albumIDs.length===1) { // Get old title if only one album is selected if (album.json) oldTitle = album.json.title; @@ -213,7 +213,7 @@ album = { view.album.title(); } else if (visible.albums()) { - + albumIDs.forEach(function(id, index, array) { albums.json.content[id].title = newTitle; view.albums.content.title(id); @@ -231,7 +231,7 @@ album = { }], ["Cancel", function() {}] ]; - + if (albumIDs.length===1) modal.show("Set Title", "Enter a new title for this album: ", buttons); else modal.show("Set Titles", "Enter a title for all " + albumIDs.length + " selected album: ", buttons); @@ -264,7 +264,7 @@ album = { }], ["Cancel", function() {}] ]; - + modal.show("Set Description", "Please enter a description for this album: ", buttons); }, diff --git a/assets/js/modules/build.js b/assets/js/modules/build.js index b7e9ff5..e662d09 100644 --- a/assets/js/modules/build.js +++ b/assets/js/modules/build.js @@ -255,12 +255,12 @@ build = { html += "" + tag + ""; }); - + html += editTagsHTML; } else { - + html = "
No Tags" + editTagsHTML + "
"; } diff --git a/assets/js/modules/lychee.js b/assets/js/modules/lychee.js index 6429ff2..f61ac2f 100644 --- a/assets/js/modules/lychee.js +++ b/assets/js/modules/lychee.js @@ -13,7 +13,6 @@ var lychee = { update_path: "http://lychee.electerious.com/version/index.php", updateURL: "https://github.com/electerious/Lychee", website: "http://lychee.electerious.com", - website_donate: "http://lychee.electerious.com#donate", upload_path_thumb: "uploads/thumb/", upload_path_big: "uploads/big/", diff --git a/assets/js/modules/multiselect.js b/assets/js/modules/multiselect.js index da71b20..e24b9bd 100644 --- a/assets/js/modules/multiselect.js +++ b/assets/js/modules/multiselect.js @@ -8,164 +8,164 @@ multiselect = { position: { - + top: null, right: null, bottom: null, left: null - + }, show: function(e) { - + if (mobileBrowser()) return false; if (lychee.publicMode) return false; if (visible.search()) 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; - + $('body').append(build.multiselect(multiselect.position.top, multiselect.position.left)); $(document).on('mousemove', multiselect.resize); - + }, - + 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 = e.pageY - 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 = e.pageX - 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!==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(); - + }, - + 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/assets/js/modules/photo.js b/assets/js/modules/photo.js index 6165df5..74200d4 100644 --- a/assets/js/modules/photo.js +++ b/assets/js/modules/photo.js @@ -291,19 +291,19 @@ photo = { }], ["Cancel", function() {}] ]; - + modal.show("Set Description", "Enter a description for this photo: ", buttons); }, - + editTags: function(photoIDs) { - + var oldTags = "", tags = ""; - + if (!photoIDs) return false; if (photoIDs instanceof Array===false) photoIDs = [photoIDs]; - + // Get tags if (visible.photo()) oldTags = photo.json.tags; if (visible.album()&&photoIDs.length===1) oldTags = album.json.content[photoIDs].tags; @@ -315,10 +315,10 @@ photo = { }); if (same) oldTags = album.json.content[photoIDs[0]].tags; } - + // Improve tags oldTags = oldTags.replace(/,/g, ', '); - + buttons = [ ["Set Tags", function() { @@ -329,55 +329,55 @@ photo = { }], ["Cancel", function() {}] ]; - + if (photoIDs.length===1) modal.show("Set Tags", "Enter your tags for this photo. You can add multiple tags by separating them with a comma: ", buttons); else modal.show("Set Tags", "Enter your tags for all " + photoIDs.length + " selected photos. Existing tags will be overwritten. You can add multiple tags by separating them with a comma: ", buttons); - + }, - + setTags: function(photoIDs, tags) { - + var params; - + if (!photoIDs) return false; if (photoIDs instanceof Array===false) photoIDs = [photoIDs]; - + // Parse tags tags = tags.replace(/(\ ,\ )|(\ ,)|(,\ )|(,{1,}\ {0,})|(,$|^,)/g, ','); tags = tags.replace(/,$|^,/g, ''); - + if (visible.photo()) { photo.json.tags = tags; view.photo.tags(); } - + photoIDs.forEach(function(id, index, array) { album.json.content[id].tags = tags; }); - + params = "setPhotoTags&photoIDs=" + photoIDs + "&tags=" + tags; lychee.api(params, function(data) { if (data!==true) lychee.error(null, params, data); }); - + }, - + deleteTag: function(photoID, index) { - + var tags; - + // Remove tags = photo.json.tags.split(','); tags.splice(index, 1); - + // Save photo.json.tags = tags.toString(); photo.setTags([photoID], photo.json.tags); - + }, - + share: function(photoID, service) { var link = "", diff --git a/assets/js/modules/upload.js b/assets/js/modules/upload.js index 4082470..917a46d 100755 --- a/assets/js/modules/upload.js +++ b/assets/js/modules/upload.js @@ -35,20 +35,20 @@ upload = { $(".upload_message").append("

" + text + "

"); }, - + notify: function(title) { - + var popup; - + if (!window.webkitNotifications) return false; - + if (window.webkitNotifications.checkPermission()!=0) window.webkitNotifications.requestPermission(); - + if (window.webkitNotifications.checkPermission()==0&&title) { popup = window.webkitNotifications.createNotification("", title, "You can now manage your new photo(s)."); popup.show(); } - + }, start: { @@ -64,7 +64,7 @@ upload = { if (files.length<=0) return false; if (albumID===false) albumID = 0; - + formData.append("function", "upload"); formData.append("albumID", albumID); @@ -170,7 +170,7 @@ upload = { }], ["Cancel", function() {}] ]; - + modal.show("Import from Link", "Please enter the direct link to a photo to import it: ", buttons); }, @@ -211,7 +211,7 @@ upload = { }], ["Cancel", function() {}] ]; - + modal.show("Import from Server", "This action will import all photos and albums which are located in 'uploads/import/' of your Lychee installation.", buttons); }, diff --git a/assets/js/modules/view.js b/assets/js/modules/view.js index fd498a3..c646189 100644 --- a/assets/js/modules/view.js +++ b/assets/js/modules/view.js @@ -59,7 +59,7 @@ view = { }, mode: function(mode) { - + var albumID = album.getID(); switch (mode) { @@ -447,11 +447,11 @@ view = { } }, - + tags: function() { - + $("#infobox #tags").html(build.tags(photo.json.tags)); - + }, photo: function() { diff --git a/assets/js/modules/visible.js b/assets/js/modules/visible.js index 4afaab7..867424b 100755 --- a/assets/js/modules/visible.js +++ b/assets/js/modules/visible.js @@ -21,7 +21,7 @@ visible = { if ($('#imageview.fadeIn').length>0) return true; else return false; }, - + search: function() { if (search.code!==null&&search.code!=='') return true; else return false; @@ -51,7 +51,7 @@ visible = { if ($('.contextmenu').length>0) return true; else return false; }, - + multiselect: function() { if ($('#multiselect').length>0) return true; else return false;