From d3de665cd057849e21d4f3dfe9d8a556eb20d7f6 Mon Sep 17 00:00:00 2001 From: Olivier Paroz Date: Fri, 30 Jan 2015 00:50:55 +0100 Subject: Only generate gallery links on folders --- js/gallerybutton.js | 47 ++++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 23 deletions(-) (limited to 'js/gallerybutton.js') diff --git a/js/gallerybutton.js b/js/gallerybutton.js index 4fc071dd..461b931e 100644 --- a/js/gallerybutton.js +++ b/js/gallerybutton.js @@ -50,32 +50,33 @@ GalleryButton.hijackShare = function () { var target = OC.Share.showLink; OC.Share.showLink = function () { var r = target.apply(this, arguments); + if ($('#dropdown.drop.shareDropDown').data('item-type') === "folder") { + + if (!$('#linkSwitchButton').length) { + var linkSwitchButton = '' + + t(GalleryButton.appName, 'Show Gallery link') + ''; + $('#linkCheckbox+label').after(linkSwitchButton); + } - if (!$('#linkSwitchButton').length) { - var linkSwitchButton = '' + - t(GalleryButton.appName, 'Show Gallery link') + ''; - $('#linkCheckbox+label').after(linkSwitchButton); - } + $("#linkSwitchButton").toggle(function () { + $(this).text("Show Files link"); + $('#linkText').val($('#linkText').val().replace('index.php/s/', 'index.php/apps/' + + GalleryButton.appName + '/s/')); + }, function () { + $(this).text("Show Gallery link"); + $('#linkText').val($('#linkText').val().replace('index.php/apps/' + + GalleryButton.appName + '/s/', 'index.php/s/')); - $("#linkSwitchButton").toggle(function () { - $(this).text("Show Files link"); - $('#linkText').val($('#linkText').val().replace('index.php/s/', 'index.php/apps/' + - GalleryButton.appName + '/s/')); - }, function () { - $(this).text("Show Gallery link"); - $('#linkText').val($('#linkText').val().replace('index.php/apps/' + - GalleryButton.appName + '/s/', 'index.php/s/')); - - }); - - $('#linkCheckbox').change(function () { - if (this.checked) { - $('#linkSwitchButton').show(); - } else { - $('#linkSwitchButton').hide(); - } - }); + }); + $('#linkCheckbox').change(function () { + if (this.checked) { + $('#linkSwitchButton').show(); + } else { + $('#linkSwitchButton').hide(); + } + }); + } return r; }; }; -- cgit v1.2.3