diff options
author | Olivier Paroz <github@oparoz.com> | 2015-06-01 00:10:44 +0300 |
---|---|---|
committer | Olivier Paroz <github@oparoz.com> | 2015-06-01 00:10:44 +0300 |
commit | 833b519f984282e42e26e169601a35727d2e4dd0 (patch) | |
tree | a5871c185e6c7bce476b0c43e8c1894a073fd5f4 /js | |
parent | 80c1016d8cd9bf2ab0e7e516f3074aea5c6a96a5 (diff) |
Merge fixes
Diffstat (limited to 'js')
-rw-r--r-- | js/gallery.js | 2 | ||||
-rw-r--r-- | js/galleryfileaction.js | 10 | ||||
-rw-r--r-- | js/slideshow.js | 82 |
3 files changed, 6 insertions, 88 deletions
diff --git a/js/gallery.js b/js/gallery.js index c476014a..b3a23944 100644 --- a/js/gallery.js +++ b/js/gallery.js @@ -283,7 +283,7 @@ Gallery.slideShow = function (images, startImage, autoPlay) { var start = images.indexOf(startImage); images = images.map(function (image) { var name = OC.basename(image.path); - var previewUrl = Gallery.utility.getPreviewUrl(image.fileId); + var previewUrl = Gallery.utility.getPreviewUrl(image.fileId, image.etag); var downloadUrl = previewUrl + '&download'; return { diff --git a/js/galleryfileaction.js b/js/galleryfileaction.js index 5d2a7c42..e8205f2e 100644 --- a/js/galleryfileaction.js +++ b/js/galleryfileaction.js @@ -69,18 +69,18 @@ var galleryFileAction = { if (galleryFileAction.mediaTypes[file.mimetype]) { /* jshint camelcase: false */ var params = { - file: dir + file.name, + width: width, + height: height, c: file.etag, - x: width, - y: height, requesttoken: oc_requesttoken }; - imageUrl = galleryFileAction.buildGalleryUrl('preview', '', params); - downloadUrl = galleryFileAction.buildGalleryUrl('download', '', params); + imageUrl = galleryFileAction.buildGalleryUrl('preview', '/' + file.id, params); + downloadUrl = imageUrl + '&download'; images.push({ name: file.name, path: dir + file.name, + fileId: file.id, mimeType: file.mimetype, url: imageUrl, downloadUrl: downloadUrl diff --git a/js/slideshow.js b/js/slideshow.js index dee0ed44..ab211b76 100644 --- a/js/slideshow.js +++ b/js/slideshow.js @@ -330,86 +330,4 @@ $(document).ready(function () { }).fail(function () { OC.Notification.show(t('core', 'Error loading slideshow template')); }); - - if (OCA.Files && OCA.Files.fileActions) { - // This is still required in OC8 - var requestToken; - if ($('#filesApp').val() && $('#isPublic').val()) { - // That's the only way to get one with the broken template - requestToken = $('#publicUploadRequestToken').val(); - } else if ($('#gallery').data('requesttoken')) { - requestToken = $('#gallery').data('requesttoken'); - } else { - requestToken = oc_requesttoken; - } - $(document).on('ajaxSend', function (elm, xhr) { - xhr.setRequestHeader('requesttoken', requestToken); - }); - - var prepareFileActions = function (mime) { - return OCA.Files.fileActions.register(mime, 'View', OC.PERMISSION_READ, '', - function (filename, context) { - var imageUrl, downloadUrl; - var fileList = context.fileList; - var files = fileList.files; - var start = 0; - var images = []; - var dir = context.dir + '/'; - var width = Math.floor($(window).width() * window.devicePixelRatio); - var height = Math.floor($(window).height() * window.devicePixelRatio); - - for (var i = 0; i < files.length; i++) { - var file = files[i]; - // We only add images to the slideshow if we think we'll be able - // to generate previews for this media type - if (file.isPreviewAvailable || file.mimetype === 'image/svg+xml') { - var params = { - width: width, - height: height, - requesttoken: requestToken - }; - imageUrl = SlideShow.buildGalleryUrl('preview', '/' + file.id, params); - downloadUrl = imageUrl + '&download'; - - images.push({ - name: file.name, - path: dir + file.name, - fileId: file.id, - mimeType: file.mimetype, - url: imageUrl, - downloadUrl: downloadUrl - }); - } - } - for (i = 0; i < images.length; i++) { - //console.log("Images in the slideshow : ", images[i]); - if (images[i].name === filename) { - start = i; - } - } - var slideShow = new SlideShow($('#slideshow'), images); - slideShow.onStop = function () { - location.hash = ''; - }; - slideShow.init(); - slideShow.show(start); - }); - }; - - var url = SlideShow.buildGalleryUrl('mediatypes', '', {slideshow: 1}); - // We're asking for a list of supported media types. Media files are retrieved through the - // context - $.getJSON(url).then(function (mediaTypes) { - //console.log("enabledPreviewProviders: ", mediaTypes); - SlideShow.mediaTypes = mediaTypes; - - // We only want to create slideshows for supported media types - for (var i = 0, keys = Object.keys(mediaTypes); i < keys.length; i++) { - // Each click handler gets the same function and images array and - // is responsible to load the slideshow - prepareFileActions(keys[i]); - OCA.Files.fileActions.setDefault(keys[i], 'View'); - } - }); - } }); |