Clicking publicly shared image opens direct preview url
Signed-off-by: Jan-Christoph Borchardt <hey@jancborchardt.net>
This commit is contained in:
parent
18dff925be
commit
84b8cb12be
2 changed files with 6 additions and 4 deletions
|
@ -116,7 +116,8 @@ OCA.Sharing.PublicApp = {
|
|||
scalingup: 0
|
||||
};
|
||||
|
||||
var img = $('<img class="publicpreview" alt="">');
|
||||
var imgcontainer = $('<a href="' + $('#previewURL').val() + '" target="_blank"><img class="publicpreview" alt=""></a>');
|
||||
var img = imgcontainer.find('.publicpreview');
|
||||
img.css({
|
||||
'max-width': previewWidth,
|
||||
'max-height': previewHeight
|
||||
|
@ -128,7 +129,7 @@ OCA.Sharing.PublicApp = {
|
|||
if (mimetype === 'image/gif' &&
|
||||
(maxGifSize === -1 || fileSize <= (maxGifSize * 1024 * 1024))) {
|
||||
img.attr('src', $('#downloadURL').val());
|
||||
img.appendTo('#imgframe');
|
||||
imgcontainer.appendTo('#imgframe');
|
||||
} else if (mimetype.substr(0, mimetype.indexOf('/')) === 'text' && window.btoa) {
|
||||
// Undocumented Url to public WebDAV endpoint
|
||||
var url = parent.location.protocol + '//' + location.host + OC.linkTo('', 'public.php/webdav');
|
||||
|
@ -145,11 +146,11 @@ OCA.Sharing.PublicApp = {
|
|||
mimetype.substr(0, mimetype.indexOf('/')) === 'image' &&
|
||||
mimetype !== 'image/svg+xml') {
|
||||
img.attr('src', OC.filePath('files_sharing', 'ajax', 'publicpreview.php') + '?' + OC.buildQueryString(params));
|
||||
img.appendTo('#imgframe');
|
||||
imgcontainer.appendTo('#imgframe');
|
||||
} else if (mimetype.substr(0, mimetype.indexOf('/')) !== 'video') {
|
||||
img.attr('src', OC.Util.replaceSVGIcon(mimetypeIcon));
|
||||
img.attr('width', 128);
|
||||
img.appendTo('#imgframe');
|
||||
imgcontainer.appendTo('#imgframe');
|
||||
}
|
||||
else if (previewSupported === 'true') {
|
||||
$('#imgframe > video').attr('poster', OC.filePath('files_sharing', 'ajax', 'publicpreview.php') + '?' + OC.buildQueryString(params));
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
<input type="hidden" id="isPublic" name="isPublic" value="1">
|
||||
<input type="hidden" name="dir" value="<?php p($_['dir']) ?>" id="dir">
|
||||
<input type="hidden" name="downloadURL" value="<?php p($_['downloadURL']) ?>" id="downloadURL">
|
||||
<input type="hidden" name="previewURL" value="<?php p($_['previewURL']) ?>" id="previewURL">
|
||||
<input type="hidden" name="sharingToken" value="<?php p($_['sharingToken']) ?>" id="sharingToken">
|
||||
<input type="hidden" name="filename" value="<?php p($_['filename']) ?>" id="filename">
|
||||
<input type="hidden" name="mimetype" value="<?php p($_['mimetype']) ?>" id="mimetype">
|
||||
|
|
Loading…
Reference in a new issue