diff options
-rw-r--r-- | js/album.js | 17 | ||||
-rw-r--r-- | js/gallery.js | 11 | ||||
-rw-r--r-- | js/gallerybutton.js | 2 |
3 files changed, 16 insertions, 14 deletions
diff --git a/js/album.js b/js/album.js index 4c89f030..b27dde70 100644 --- a/js/album.js +++ b/js/album.js @@ -177,7 +177,7 @@ Album.prototype = { var album = this; return this._getThumbnail().then(function (img) { - var a = $('<a/>').addClass('album').attr('href', '#' + encodeURI(album.path)); + var a = $('<a/>').addClass('album').attr('href', '#' + encodeURIComponent(album.path)); a.append($('<span/>').addClass('album-label').text(album.name)); var ratio = Math.round(img.ratio * 100) / 100; @@ -213,6 +213,7 @@ Album.prototype = { */ getNextRow: function (width) { var numberOfThumbnailsToPreload = 6; + /** * Add images to the row until it's full * @@ -367,9 +368,14 @@ GalleryImage.prototype = { var image = this; if (this.domDef === null || this.domHeigth !== targetHeight) { this.domHeigth = targetHeight; + // img is a Thumbnail.image this.domDef = this.getThumbnail().then(function (img) { - var a = $('<a/>').addClass('image').attr('href', '#' + - encodeURI(image.path)).attr('data-path', image.path); + img.height = targetHeight; + img.width = targetHeight * img.ratio; + img.setAttribute('width', 'auto'); + img.alt = encodeURI(image.path); + var url = '#' + encodeURIComponent(image.path); + var a = $('<a/>').addClass('image').attr('href', url).attr('data-path', image.path); var imageLabel = $('<span/>').addClass('image-label'); var imageTitle = $('<span/>').addClass('title').html('<strong>> </strong>' + @@ -381,11 +387,6 @@ GalleryImage.prototype = { imageLabel.slideToggle(250); }); a.append(imageLabel); - - img.height = targetHeight; - img.width = targetHeight * img.ratio; - img.setAttribute('width', 'auto'); - img.alt = encodeURI(image.path); a.append(img); return a; }); diff --git a/js/gallery.js b/js/gallery.js index 6422d39e..1eda583c 100644 --- a/js/gallery.js +++ b/js/gallery.js @@ -78,7 +78,7 @@ Gallery.fillAlbums = function () { Gallery.images = []; Gallery.albumMap = {}; Gallery.imageMap = {}; - var currentLocation = decodeURI(window.location.href.split('#')[1] || ''); + var currentLocation = window.location.href.split('#')[1] || ''; var params = { location: currentLocation, mediatypes: Gallery.getMediaTypes() @@ -608,7 +608,7 @@ Gallery.view.buildBreadCrumb = function (albumPath) { * @param {string} path */ Gallery.view.pushBreadCrumb = function (text, path) { - OC.Breadcrumb.push(text, '#' + path); + OC.Breadcrumb.push(text, '#' + encodeURIComponent(path)); }; /** @@ -720,7 +720,7 @@ Gallery.slideShow = function (images, startImage, autoPlay) { slideShow.onStop = function () { Gallery.activeSlideShow = null; $('#content').show(); - location.hash = encodeURI(Gallery.currentAlbum); + location.hash = encodeURIComponent(Gallery.currentAlbum); }; Gallery.activeSlideShow = slideShow; @@ -771,7 +771,7 @@ $(document).ready(function () { $('#openAsFileListButton').click(function () { var subUrl = ''; - var params = {path: '/' + Gallery.currentAlbum}; + var params = {path: '/' + encodeURIComponent(Gallery.currentAlbum)}; if (Gallery.token) { params.token = Gallery.token; subUrl = 's/{token}?path={path}'; @@ -803,7 +803,8 @@ $(document).ready(function () { }); window.onhashchange = function () { - var path = decodeURI(window.location.href.split('#')[1] || ''); + // The hash location is ALWAYS encoded + var path = decodeURIComponent(window.location.href.split('#')[1] || ''); var albumPath = OC.dirname(path); if (Gallery.albumMap[path]) { albumPath = path; diff --git a/js/gallerybutton.js b/js/gallerybutton.js index 8d69a572..e6d7dd90 100644 --- a/js/gallerybutton.js +++ b/js/gallerybutton.js @@ -40,7 +40,7 @@ GalleryButton.buildUrl = function (dir) { params.token = token; tokenPath = 's/{token}'; } - GalleryButton.url = OC.generateUrl('apps/galleryplus/' + tokenPath, params) + '#' + dir; + GalleryButton.url = OC.generateUrl('apps/galleryplus/' + tokenPath, params) + '#' + encodeURIComponent(dir); }; GalleryButton.hijackShare = function () { |